1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-22 21:53:05 +01:00

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 25093fa76e
commit 68476fba64

11
main.c
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();