1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-23 12:33:03 +01:00

more intuitive option logic

This commit is contained in:
Jfreegman 2014-06-08 01:05:01 -04:00
parent 6a2ef5cc6c
commit 33000598fc
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
2 changed files with 8 additions and 8 deletions

View File

@ -81,7 +81,7 @@ char *DATA_FILE = NULL;
ToxWindow *prompt = NULL; ToxWindow *prompt = NULL;
struct arg_opts { struct arg_opts {
int load_data_file; int ignore_data_file;
int use_ipv4; int use_ipv4;
char config_path[MAX_STR_SIZE]; char config_path[MAX_STR_SIZE];
char nodes_path[MAX_STR_SIZE]; char nodes_path[MAX_STR_SIZE];
@ -346,7 +346,7 @@ static void load_friendlist(Tox *m)
*/ */
int store_data(Tox *m, char *path) int store_data(Tox *m, char *path)
{ {
if (arg_opts.load_data_file == 0) /*If file loading/saving is disabled*/ if (arg_opts.ignore_data_file)
return 0; return 0;
if (path == NULL) if (path == NULL)
@ -384,7 +384,7 @@ int store_data(Tox *m, char *path)
static void load_data(Tox *m, char *path) static void load_data(Tox *m, char *path)
{ {
if (arg_opts.load_data_file == 0) /*If file loading/saving is disabled*/ if (arg_opts.ignore_data_file)
return; return;
FILE *fd; FILE *fd;
@ -487,7 +487,7 @@ static void print_usage(void)
static void set_default_opts(void) static void set_default_opts(void)
{ {
arg_opts.use_ipv4 = 0; arg_opts.use_ipv4 = 0;
arg_opts.load_data_file = 1; arg_opts.ignore_data_file = 0;
} }
static void parse_args(int argc, char *argv[]) static void parse_args(int argc, char *argv[])
@ -518,7 +518,7 @@ static void parse_args(int argc, char *argv[])
break; break;
case 'x': case 'x':
arg_opts.load_data_file = 0; arg_opts.ignore_data_file = 1;
break; break;
case '4': case '4':
@ -596,7 +596,7 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (arg_opts.load_data_file) if (!arg_opts.ignore_data_file)
load_data(m, DATA_FILE); load_data(m, DATA_FILE);
prompt = init_windows(m); prompt = init_windows(m);

View File

@ -178,8 +178,8 @@ int settings_load(struct user_settings *s, char *path)
if (line[0] == '#' || !line[0]) if (line[0] == '#' || !line[0])
continue; continue;
char *key = strtok(line, ":"); const char *key = strtok(line, ":");
char *val = strtok(NULL, ";"); const char *val = strtok(NULL, ";");
if (key == NULL || val == NULL) if (key == NULL || val == NULL)
continue; continue;