diff options
author | Guy Harris <guy@alum.mit.edu> | 2005-08-20 22:28:49 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2005-08-20 22:28:49 +0000 |
commit | ce8ac34225e9c2f297f3aed71cf9bcac2f9be039 (patch) | |
tree | 859be6e44274b47ced7fcf9cb70cbe6a1acb12fd | |
parent | 65064719d3770c5d892f6eaea98555179af20642 (diff) |
The routines registered with "register_stat_cmd_arg()" *are* called if
you use the "-z" command-line options for them; make them pop up the
appropriate windows.
Move the calls to "register_stat_cmd_arg()" after the code to register
the tap, just as the calls to "register_stat_menu_item()" are done after
registering the tap.
Use "g_strdup_printf()" rather than formatting into a fixed-length
buffer and "g_strdup()"ing that buffer.
svn path=/trunk/; revision=15489
-rw-r--r-- | gtk/ansi_a_stat.c | 42 | ||||
-rw-r--r-- | gtk/ansi_map_stat.c | 27 | ||||
-rw-r--r-- | gtk/gsm_a_stat.c | 88 | ||||
-rw-r--r-- | gtk/gsm_map_stat.c | 27 | ||||
-rw-r--r-- | gtk/mtp3_stat.c | 22 |
5 files changed, 123 insertions, 83 deletions
diff --git a/gtk/ansi_a_stat.c b/gtk/ansi_a_stat.c index ca2998f537..c5e9d94535 100644 --- a/gtk/ansi_a_stat.c +++ b/gtk/ansi_a_stat.c @@ -362,24 +362,12 @@ ansi_a_stat_gtk_win_create( } -/* - * Never gets called ? - */ -static void -ansi_a_stat_gtk_init( - const char *optarg _U_) -{ - /* does not appear to be called */ -} - - static void ansi_a_stat_gtk_bsmap_cb( GtkWidget *w _U_, gpointer d _U_) { int i; - char str[100]; /* @@ -396,8 +384,8 @@ ansi_a_stat_gtk_bsmap_cb( i = 0; while (ansi_a_ios401_bsmap_strings[i].strptr) { - g_snprintf(str, 100, "0x%02x", ansi_a_ios401_bsmap_strings[i].value); - dlg_bsmap.entries[0] = g_strdup(str); + dlg_bsmap.entries[0] = g_strdup_printf("0x%02x", + ansi_a_ios401_bsmap_strings[i].value); dlg_bsmap.entries[1] = g_strdup(ansi_a_ios401_bsmap_strings[i].strptr); @@ -414,12 +402,19 @@ ansi_a_stat_gtk_bsmap_cb( static void +ansi_a_stat_gtk_bsmap_init( + const char *optarg _U_) +{ + ansi_a_stat_gtk_bsmap_cb(NULL, NULL); +} + + +static void ansi_a_stat_gtk_dtap_cb( GtkWidget *w _U_, gpointer d _U_) { int i; - char str[100]; /* @@ -436,8 +431,8 @@ ansi_a_stat_gtk_dtap_cb( i = 0; while (ansi_a_ios401_dtap_strings[i].strptr) { - g_snprintf(str, 100, "0x%02x", ansi_a_ios401_dtap_strings[i].value); - dlg_dtap.entries[0] = g_strdup(str); + dlg_dtap.entries[0] = g_strdup_printf("0x%02x", + ansi_a_ios401_dtap_strings[i].value); dlg_dtap.entries[1] = g_strdup(ansi_a_ios401_dtap_strings[i].strptr); @@ -453,14 +448,20 @@ ansi_a_stat_gtk_dtap_cb( } +static void +ansi_a_stat_gtk_dtap_init( + const char *optarg _U_) +{ + ansi_a_stat_gtk_dtap_cb(NULL, NULL); +} + + void register_tap_listener_gtkansi_a_stat(void) { GString *err_p; - register_stat_cmd_arg("ansi_a,", ansi_a_stat_gtk_init); - memset((void *) &stat, 0, sizeof(ansi_a_stat_t)); err_p = @@ -479,6 +480,9 @@ register_tap_listener_gtkansi_a_stat(void) register_stat_menu_item("ANSI/A-Interface BSMAP", REGISTER_STAT_GROUP_TELEPHONY, ansi_a_stat_gtk_bsmap_cb, NULL, NULL ,NULL); + register_stat_cmd_arg("ansi_a,bsmap", ansi_a_stat_gtk_bsmap_init); + register_stat_menu_item("ANSI/A-Interface DTAP", REGISTER_STAT_GROUP_TELEPHONY, ansi_a_stat_gtk_dtap_cb, NULL, NULL ,NULL); + register_stat_cmd_arg("ansi_a,dtap", ansi_a_stat_gtk_dtap_init); } diff --git a/gtk/ansi_map_stat.c b/gtk/ansi_map_stat.c index 96ad9efc06..e831708ac6 100644 --- a/gtk/ansi_map_stat.c +++ b/gtk/ansi_map_stat.c @@ -362,24 +362,12 @@ ansi_map_stat_gtk_win_create( } -/* - * Never gets called ? - */ -static void -ansi_map_stat_gtk_init( - const char *optarg _U_) -{ - /* does not appear to be called */ -} - - static void ansi_map_stat_gtk_cb( GtkWidget *w _U_, gpointer d _U_) { int i; - char str[100]; /* @@ -396,8 +384,8 @@ ansi_map_stat_gtk_cb( i = 0; while (ansi_map_opr_code_strings[i].strptr) { - g_snprintf(str, 100, "0x%02x", ansi_map_opr_code_strings[i].value); - dlg.entries[0] = g_strdup(str); + dlg.entries[0] = g_strdup_printf("0x%02x", + ansi_map_opr_code_strings[i].value); dlg.entries[1] = g_strdup(ansi_map_opr_code_strings[i].strptr); @@ -417,14 +405,20 @@ ansi_map_stat_gtk_cb( } +static void +ansi_map_stat_gtk_init( + const char *optarg _U_) +{ + ansi_map_stat_gtk_cb(NULL, NULL); +} + + void register_tap_listener_gtkansi_map_stat(void) { GString *err_p; - register_stat_cmd_arg("ansi_map,", ansi_map_stat_gtk_init); - memset((void *) &stat, 0, sizeof(ansi_map_stat_t)); err_p = @@ -443,4 +437,5 @@ register_tap_listener_gtkansi_map_stat(void) register_stat_menu_item("ANSI/MAP Operation", REGISTER_STAT_GROUP_TELEPHONY, ansi_map_stat_gtk_cb, NULL, NULL, NULL); + register_stat_cmd_arg("ansi_map", ansi_map_stat_gtk_init); } diff --git a/gtk/gsm_a_stat.c b/gtk/gsm_a_stat.c index a4d647280c..46eebaf264 100644 --- a/gtk/gsm_a_stat.c +++ b/gtk/gsm_a_stat.c @@ -449,24 +449,12 @@ gsm_a_stat_gtk_win_create( } -/* - * Never gets called ? - */ -static void -gsm_a_stat_gtk_init( - const char *optarg _U_) -{ - /* does not appear to be called */ -} - - static void gsm_a_stat_gtk_bssmap_cb( GtkWidget *w _U_, gpointer d _U_) { int i; - char str[100]; /* @@ -483,8 +471,8 @@ gsm_a_stat_gtk_bssmap_cb( i = 0; while (gsm_a_bssmap_msg_strings[i].strptr) { - g_snprintf(str, 100, "0x%02x", gsm_a_bssmap_msg_strings[i].value); - dlg_bssmap.entries[0] = g_strdup(str); + dlg_bssmap.entries[0] = g_strdup_printf("0x%02x", + gsm_a_bssmap_msg_strings[i].value); dlg_bssmap.entries[1] = g_strdup(gsm_a_bssmap_msg_strings[i].strptr); @@ -501,6 +489,14 @@ gsm_a_stat_gtk_bssmap_cb( static void +gsm_a_stat_gtk_bssmap_init( + const char *optarg _U_) +{ + gsm_a_stat_gtk_bssmap_cb(NULL, NULL); +} + + +static void gsm_a_stat_gtk_dtap_cb( GtkWidget *w _U_, gpointer d _U_, @@ -509,7 +505,6 @@ gsm_a_stat_gtk_dtap_cb( const value_string *dtap_msg_strings) { int i; - char str[100]; /* @@ -526,8 +521,8 @@ gsm_a_stat_gtk_dtap_cb( i = 0; while (dtap_msg_strings[i].strptr) { - g_snprintf(str, 100, "0x%02x", dtap_msg_strings[i].value); - dlg_dtap_p->entries[0] = g_strdup(str); + dlg_dtap_p->entries[0] = g_strdup_printf("0x%02x", + dtap_msg_strings[i].value); dlg_dtap_p->entries[1] = g_strdup(dtap_msg_strings[i].strptr); @@ -553,6 +548,13 @@ gsm_a_stat_gtk_dtap_mm_cb( } static void +gsm_a_stat_gtk_dtap_mm_init( + const char *optarg _U_) +{ + gsm_a_stat_gtk_dtap_mm_cb(NULL, NULL); +} + +static void gsm_a_stat_gtk_dtap_rr_cb( GtkWidget *w _U_, gpointer d _U_) @@ -563,6 +565,13 @@ gsm_a_stat_gtk_dtap_rr_cb( } static void +gsm_a_stat_gtk_dtap_rr_init( + const char *optarg _U_) +{ + gsm_a_stat_gtk_dtap_rr_cb(NULL, NULL); +} + +static void gsm_a_stat_gtk_dtap_cc_cb( GtkWidget *w _U_, gpointer d _U_) @@ -573,6 +582,13 @@ gsm_a_stat_gtk_dtap_cc_cb( } static void +gsm_a_stat_gtk_dtap_cc_init( + const char *optarg _U_) +{ + gsm_a_stat_gtk_dtap_cc_cb(NULL, NULL); +} + +static void gsm_a_stat_gtk_dtap_gmm_cb( GtkWidget *w _U_, gpointer d _U_) @@ -583,6 +599,13 @@ gsm_a_stat_gtk_dtap_gmm_cb( } static void +gsm_a_stat_gtk_dtap_gmm_init( + const char *optarg _U_) +{ + gsm_a_stat_gtk_dtap_gmm_cb(NULL, NULL); +} + +static void gsm_a_stat_gtk_dtap_sms_cb( GtkWidget *w _U_, gpointer d _U_) @@ -593,6 +616,13 @@ gsm_a_stat_gtk_dtap_sms_cb( } static void +gsm_a_stat_gtk_dtap_sms_init( + const char *optarg _U_) +{ + gsm_a_stat_gtk_dtap_sms_cb(NULL, NULL); +} + +static void gsm_a_stat_gtk_dtap_sm_cb( GtkWidget *w _U_, gpointer d _U_) @@ -603,6 +633,13 @@ gsm_a_stat_gtk_dtap_sm_cb( } static void +gsm_a_stat_gtk_dtap_sm_init( + const char *optarg _U_) +{ + gsm_a_stat_gtk_dtap_sm_cb(NULL, NULL); +} + +static void gsm_a_stat_gtk_dtap_ss_cb( GtkWidget *w _U_, gpointer d _U_) @@ -612,6 +649,13 @@ gsm_a_stat_gtk_dtap_ss_cb( gsm_a_dtap_msg_ss_strings); } +static void +gsm_a_stat_gtk_dtap_ss_init( + const char *optarg _U_) +{ + gsm_a_stat_gtk_dtap_ss_cb(NULL, NULL); +} + void register_tap_listener_gtkgsm_a_stat(void) @@ -619,8 +663,6 @@ register_tap_listener_gtkgsm_a_stat(void) GString *err_p; - register_stat_cmd_arg("gsm_a,", gsm_a_stat_gtk_init); - memset((void *) &stat, 0, sizeof(gsm_a_stat_t)); err_p = @@ -639,25 +681,33 @@ register_tap_listener_gtkgsm_a_stat(void) register_stat_menu_item("GSM/A-Interface BSSMAP", REGISTER_STAT_GROUP_TELEPHONY, gsm_a_stat_gtk_bssmap_cb, NULL, NULL, NULL); + register_stat_cmd_arg("gsm_a,bssmap", gsm_a_stat_gtk_bssmap_init); register_stat_menu_item("GSM/A-Interface DTAP/Mobility Management", REGISTER_STAT_GROUP_TELEPHONY, gsm_a_stat_gtk_dtap_mm_cb, NULL, NULL, NULL); + register_stat_cmd_arg("gsm_a,dtap_mm", gsm_a_stat_gtk_dtap_mm_init); register_stat_menu_item("GSM/A-Interface DTAP/Radio Resource Management", REGISTER_STAT_GROUP_TELEPHONY, gsm_a_stat_gtk_dtap_rr_cb, NULL, NULL, NULL); + register_stat_cmd_arg("gsm_a,dtap_rr", gsm_a_stat_gtk_dtap_rr_init); register_stat_menu_item("GSM/A-Interface DTAP/Call Control", REGISTER_STAT_GROUP_TELEPHONY, gsm_a_stat_gtk_dtap_cc_cb, NULL, NULL, NULL); + register_stat_cmd_arg("gsm_a,dtap_cc", gsm_a_stat_gtk_dtap_cc_init); register_stat_menu_item("GSM/A-Interface DTAP/GPRS Mobility Management", REGISTER_STAT_GROUP_TELEPHONY, gsm_a_stat_gtk_dtap_gmm_cb, NULL, NULL, NULL); + register_stat_cmd_arg("gsm_a,dtap_gmm", gsm_a_stat_gtk_dtap_gmm_init); register_stat_menu_item("GSM/A-Interface DTAP/Short Message Service", REGISTER_STAT_GROUP_TELEPHONY, gsm_a_stat_gtk_dtap_sms_cb, NULL, NULL, NULL); + register_stat_cmd_arg("gsm_a,dtap_sms", gsm_a_stat_gtk_dtap_sms_init); register_stat_menu_item("GSM/A-Interface DTAP/GPRS Session Management", REGISTER_STAT_GROUP_TELEPHONY, gsm_a_stat_gtk_dtap_sm_cb, NULL, NULL, NULL); + register_stat_cmd_arg("gsm_a,dtap_sm", gsm_a_stat_gtk_dtap_sm_init); register_stat_menu_item("GSM/A-Interface DTAP/Supplementary Services", REGISTER_STAT_GROUP_TELEPHONY, gsm_a_stat_gtk_dtap_ss_cb, NULL, NULL, NULL); + register_stat_cmd_arg("gsm_a,dtap_ss", gsm_a_stat_gtk_dtap_ss_init); } diff --git a/gtk/gsm_map_stat.c b/gtk/gsm_map_stat.c index 336b21ec07..8d5b32a4c3 100644 --- a/gtk/gsm_map_stat.c +++ b/gtk/gsm_map_stat.c @@ -392,24 +392,12 @@ gsm_map_stat_gtk_win_create( } -/* - * Never gets called ? - */ -static void -gsm_map_stat_gtk_init( - const char *optarg _U_) -{ - /* does not appear to be called */ -} - - static void gsm_map_stat_gtk_cb( GtkWidget *w _U_, gpointer d _U_) { int i; - char str[100]; /* @@ -426,8 +414,8 @@ gsm_map_stat_gtk_cb( i = 0; while (gsm_map_opr_code_strings[i].strptr) { - g_snprintf(str, 100, "%u", gsm_map_opr_code_strings[i].value); - dlg.entries[0] = g_strdup(str); + dlg.entries[0] = g_strdup_printf("%u", + gsm_map_opr_code_strings[i].value); dlg.entries[1] = g_strdup(gsm_map_opr_code_strings[i].strptr); @@ -449,14 +437,20 @@ gsm_map_stat_gtk_cb( } +static void +gsm_map_stat_gtk_init( + const char *optarg _U_) +{ + gsm_map_stat_gtk_cb(NULL, NULL); +} + + void register_tap_listener_gtkgsm_map_stat(void) { GString *err_p; - register_stat_cmd_arg("gsm_map,", gsm_map_stat_gtk_init); - memset((void *) &gsm_map_stat, 0, sizeof(gsm_map_stat_t)); err_p = @@ -475,4 +469,5 @@ register_tap_listener_gtkgsm_map_stat(void) register_stat_menu_item("GSM/MAP Operation", REGISTER_STAT_GROUP_TELEPHONY, gsm_map_stat_gtk_cb, NULL, NULL, NULL); + register_stat_cmd_arg("gsm_map", gsm_map_stat_gtk_init); } diff --git a/gtk/mtp3_stat.c b/gtk/mtp3_stat.c index 8f49d5d493..c2b2a957a6 100644 --- a/gtk/mtp3_stat.c +++ b/gtk/mtp3_stat.c @@ -410,17 +410,6 @@ mtp3_stat_gtk_win_create( } -/* - * Never gets called ? - */ -static void -mtp3_stat_gtk_init( - const char *optarg _U_) -{ - /* does not appear to be called */ -} - - static void mtp3_stat_gtk_cb( GtkWidget *w _U_, @@ -442,14 +431,20 @@ mtp3_stat_gtk_cb( } +static void +mtp3_stat_gtk_init( + const char *optarg _U_) +{ + mtp3_stat_gtk_cb(NULL, NULL); +} + + void register_tap_listener_gtkmtp3_stat(void) { GString *err_p; - register_stat_cmd_arg("mtp3,", mtp3_stat_gtk_init); - memset((void *) &mtp3_stat, 0, sizeof(mtp3_stat_t)); err_p = @@ -468,4 +463,5 @@ register_tap_listener_gtkmtp3_stat(void) register_stat_menu_item("MTP3/MSUs", REGISTER_STAT_GROUP_TELEPHONY, mtp3_stat_gtk_cb, NULL, NULL, NULL); + register_stat_cmd_arg("mtp3,msus", mtp3_stat_gtk_init); } |