#include #include #include int main(int argc, char *argv[]) { initscr(); std::string param = "-h"; // default to usage if(argc == 2) param = std::string(argv[1]); if(param == "--help" || param == "-h") { printw("Supply the filename as the only parameter.\n"); printw("At the end of the file you will be prompted for a fake password.\n"); printw("Pressing enter at this point closes the program.\n"); refresh(); getch(); endwin(); return 0; } std::ifstream ifs(argv[1]); if(!ifs.is_open()) { printw("ERROR: File \"%s\" Not Found.", param.c_str()); refresh(); getch(); endwin(); return 1; } noecho(); cbreak(); printw("New file, \"%s\".\n\n", param.c_str()); refresh(); getch(); char c = ' '; while((c = ifs.get()) && !ifs.eof()) { addch( c); refresh(); getch(); } printw("\n"); printw("\n"); printw("Please enter your password to encrypt this file.\n"); printw(" password: "); while((c = getch())) { if(c == '\n') break; } endwin(); return 0; }