1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-12 23:43:02 +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 ch;
int i = 0;
int f_flag = 0;
char *filename = "data";
ToxWindow* a;
@ -292,7 +293,7 @@ int main(int argc, char* argv[]) {
if(argv[i + 1] != NULL)
filename = argv[i + 1];
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);
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) {
// Update tox.
do_tox();