added a proper error message for messing up the -f flag

This commit is contained in:
charmlesscoin 2013-08-03 16:12:02 -04:00
parent d34e4a3408
commit 9b56e21f81

View File

@ -283,6 +283,7 @@ void prepare_window(WINDOW* w) {
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
int ch; int ch;
int i = 0; int i = 0;
int f_flag = 0;
char *filename = "data"; char *filename = "data";
ToxWindow* a; ToxWindow* a;
@ -292,7 +293,7 @@ int main(int argc, char* argv[]) {
if(argv[i + 1] != NULL) if(argv[i + 1] != NULL)
filename = argv[i + 1]; filename = argv[i + 1];
else { else {
fputs("[!] you passed '-f' without giving an argument!\n", stderr); f_flag = -1;
} }
} }
} }
@ -303,6 +304,14 @@ int main(int argc, char* argv[]) {
load_data(filename); load_data(filename);
init_windows(); init_windows();
if(f_flag == -1) {
attron(COLOR_PAIR(3) | A_BOLD);
wprintw(prompt->window, "You passed '-f' without giving an argument!\n"
"defaulting to 'data' for a keyfile...\n");
attroff(COLOR_PAIR(3) | A_BOLD);
}
while(true) { while(true) {
// Update tox. // Update tox.
do_tox(); do_tox();