4 * Extension command line options
6 * (c) 2006, Luis E. Garcia Ontanon <luis@ontanon.org>
10 * Wireshark - Network traffic analyzer
11 * By Gerald Combs <gerald@wireshark.org>
12 * Copyright 1998 Gerald Combs
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
36 static GHashTable* ex_opts = NULL;
38 gboolean ex_opt_add(const gchar* optarg) {
42 ex_opts = g_hash_table_new(g_str_hash,g_str_equal);
44 splitted = g_strsplit(optarg,":",2);
46 if (splitted[0] && splitted[1]) {
47 GPtrArray* this_opts = g_hash_table_lookup(ex_opts,splitted[0]);
50 g_ptr_array_add(this_opts,splitted[1]);
53 this_opts = g_ptr_array_new();
54 g_ptr_array_add(this_opts,splitted[1]);
55 g_hash_table_insert(ex_opts,splitted[0],this_opts);
67 gint ex_opt_count(const gchar* key) {
73 this_opts = g_hash_table_lookup(ex_opts,key);
76 return this_opts->len;
82 const gchar* ex_opt_get_nth(const gchar* key, guint index) {
88 this_opts = g_hash_table_lookup(ex_opts,key);
91 if (this_opts->len > index) {
92 return g_ptr_array_index(this_opts,index);
103 extern const gchar* ex_opt_get_next(const gchar* key) {
104 GPtrArray* this_opts;
109 this_opts = g_hash_table_lookup(ex_opts,key);
113 return g_ptr_array_remove_index(this_opts,0);