remove the --sm-disable from argv

This commit is contained in:
Dana Jansens 2003-10-10 16:20:48 +00:00
parent c8678108eb
commit da9bda5e9b

View file

@ -112,13 +112,13 @@ static void save_commands()
g_free(prop_cmd.vals); g_free(prop_cmd.vals);
} }
static void remove_two_args(int *argc, char ***argv, int index) static void remove_args(int *argc, char ***argv, int index, int num)
{ {
int i; int i;
for (i = index; i < index + 2; ++i) for (i = index; i < index + num; ++i)
(*argv)[i] = (*argv)[i+2]; (*argv)[i] = (*argv)[i+num];
*argc -= 2; *argc -= num;
} }
static void parse_args(int *argc, char ***argv) static void parse_args(int *argc, char ***argv)
@ -131,7 +131,7 @@ static void parse_args(int *argc, char ***argv)
g_printerr(_("--sm-client-id requires an argument\n")); g_printerr(_("--sm-client-id requires an argument\n"));
else { else {
sm_id = g_strdup((*argv)[i+1]); sm_id = g_strdup((*argv)[i+1]);
remove_two_args(argc, argv, i); remove_args(argc, argv, i, 2);
++i; ++i;
} }
} else if (!strcmp((*argv)[i], "--sm-save-file")) { } else if (!strcmp((*argv)[i], "--sm-save-file")) {
@ -139,11 +139,12 @@ static void parse_args(int *argc, char ***argv)
g_printerr(_("--sm-save-file requires an argument\n")); g_printerr(_("--sm-save-file requires an argument\n"));
else { else {
save_file = g_strdup((*argv)[i+1]); save_file = g_strdup((*argv)[i+1]);
remove_two_args(argc, argv, i); remove_args(argc, argv, i, 2);
++i; ++i;
} }
} else if (!strcmp((*argv)[i], "--sm-disable")) { } else if (!strcmp((*argv)[i], "--sm-disable")) {
sm_disable = TRUE; sm_disable = TRUE;
remove_args(argc, argv, i, 1);
} }
} }
} }