Simplified parse_options to take gchar**

This commit is contained in:
James Booth
2014-04-15 00:13:32 +01:00
parent 79088d0150
commit 4425aba1f2
4 changed files with 24 additions and 56 deletions

View File

@@ -68,9 +68,7 @@ cmd_connect(gchar **args, struct cmd_help_t help)
cons_show("You are either connected already, or a login is in process.");
result = TRUE;
} else {
GList *opt_keys = NULL;
opt_keys = g_list_append(opt_keys, "server");
opt_keys = g_list_append(opt_keys, "port");
gchar *opt_keys[] = { "server", "port", NULL };
gboolean parsed;
GHashTable *options = parse_options(args, 1, opt_keys, &parsed);
@@ -93,7 +91,6 @@ cmd_connect(gchar **args, struct cmd_help_t help)
}
options_destroy(options);
g_list_free(opt_keys);
char *user = args[0];
char *lower = g_utf8_strdown(user, -1);
@@ -1572,9 +1569,7 @@ cmd_join(gchar **args, struct cmd_help_t help)
}
// Additional args supplied
GList *opt_keys = NULL;
opt_keys = g_list_append(opt_keys, "nick");
opt_keys = g_list_append(opt_keys, "password");
gchar *opt_keys[] = { "nick", "password", NULL };
gboolean parsed;
GHashTable *options = parse_options(args, 1, opt_keys, &parsed);
@@ -1588,7 +1583,6 @@ cmd_join(gchar **args, struct cmd_help_t help)
passwd = g_hash_table_lookup(options, "password");
options_destroy(options);
g_list_free(opt_keys);
// In the case that a nick wasn't provided by the optional args...
if (nick == NULL) {