4 * Extension command line options
6 * (c) 2006, Luis E. Garcia Ontanon <luis@ontanon.org>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * SPDX-License-Identifier: GPL-2.0-or-later
20 static GHashTable
* ex_opts
;
22 bool ex_opt_add(const char* ws_optarg
) {
26 ex_opts
= g_hash_table_new(g_str_hash
,g_str_equal
);
28 splitted
= g_strsplit(ws_optarg
,":",2);
30 if (splitted
[0] && splitted
[1]) {
31 GPtrArray
* this_opts
= (GPtrArray
*)g_hash_table_lookup(ex_opts
,splitted
[0]);
34 g_ptr_array_add(this_opts
,splitted
[1]);
37 this_opts
= g_ptr_array_new();
38 g_ptr_array_add(this_opts
,splitted
[1]);
39 g_hash_table_insert(ex_opts
,splitted
[0],this_opts
);
51 int ex_opt_count(const char* key
) {
57 this_opts
= (GPtrArray
*)g_hash_table_lookup(ex_opts
,key
);
60 return this_opts
->len
;
66 const char* ex_opt_get_nth(const char* key
, unsigned key_index
) {
72 this_opts
= (GPtrArray
*)g_hash_table_lookup(ex_opts
,key
);
75 if (this_opts
->len
> key_index
) {
76 return (const char *)g_ptr_array_index(this_opts
,key_index
);
87 extern const char* ex_opt_get_next(const char* key
) {
93 this_opts
= (GPtrArray
*)g_hash_table_lookup(ex_opts
,key
);
97 return (const char *)g_ptr_array_remove_index(this_opts
,0);
106 * Editor modelines - https://www.wireshark.org/tools/modelines.html
111 * indent-tabs-mode: nil
114 * vi: set shiftwidth=4 tabstop=8 expandtab:
115 * :indentSize=4:tabSize=8:noTabs=true: