From 6509abc16fd5726d1227fbcbbfb69c62df67a04b Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Tue, 25 Jul 2017 21:00:15 +0200 Subject: ax25ipd: Sort out prototypes for usr1_handler(). make usr1_handler() static, remove its prototype from the header and reorder code to avoid prototypes. Signed-off-by: Ralf Baechle --- ax25ipd/ax25ipd.c | 110 +++++++++++++++++++++++++++--------------------------- 1 file changed, 55 insertions(+), 55 deletions(-) (limited to 'ax25ipd/ax25ipd.c') diff --git a/ax25ipd/ax25ipd.c b/ax25ipd/ax25ipd.c index 28e5c38..b3fc2f9 100644 --- a/ax25ipd/ax25ipd.c +++ b/ax25ipd/ax25ipd.c @@ -60,12 +60,6 @@ static struct option options[] = { {NULL, 0, NULL, 0} }; -static void hupper(int i) -{ - printf("\nSIGHUP!\n"); - longjmp(restart_env, 1); -} - static void greet_world(void) { printf("\nax25ipd %s / %s\n", VERSION); @@ -76,6 +70,61 @@ static void greet_world(void) fflush(stdout); } +static void do_stats(void) +{ + int save_loglevel; + +/* save the old loglevel, and force at least loglevel 1 */ + save_loglevel = loglevel; + loglevel = 1; + + printf("\nSIGUSR1 signal: statistics and configuration report\n"); + + greet_world(); + + dump_config(); + dump_routes(); + dump_params(); + + printf("\nInput stats:\n"); + printf("KISS input packets: %d\n", stats.kiss_in); + printf(" too big: %d\n", stats.kiss_toobig); + printf(" bad type: %d\n", stats.kiss_badtype); + printf(" too short: %d\n", stats.kiss_tooshort); + printf(" not for me: %d\n", stats.kiss_not_for_me); + printf(" I am destination: %d\n", stats.kiss_i_am_dest); + printf(" no route found: %d\n", stats.kiss_no_ip_addr); + printf("UDP input packets: %d\n", stats.udp_in); + printf("IP input packets: %d\n", stats.ip_in); + printf(" failed CRC test: %d\n", stats.ip_failed_crc); + printf(" too short: %d\n", stats.ip_tooshort); + printf(" not for me: %d\n", stats.ip_not_for_me); + printf(" I am destination: %d\n", stats.ip_i_am_dest); + printf("\nOutput stats:\n"); + printf("KISS output packets: %d\n", stats.kiss_out); + printf(" beacons: %d\n", stats.kiss_beacon_outs); + printf("UDP output packets: %d\n", stats.udp_out); + printf("IP output packets: %d\n", stats.ip_out); + printf("\n"); + + fflush(stdout); + +/* restore the old loglevel */ + loglevel = save_loglevel; +} + +static void hupper(int i) +{ + printf("\nSIGHUP!\n"); + longjmp(restart_env, 1); +} + +static void usr1_handler(int i) +{ + printf("\nSIGUSR1!\n"); + do_stats(); +} + int main(int argc, char **argv) { if (setjmp(restart_env) == 0) { @@ -200,55 +249,6 @@ int main(int argc, char **argv) return 0; } -static void do_stats(void) -{ - int save_loglevel; - -/* save the old loglevel, and force at least loglevel 1 */ - save_loglevel = loglevel; - loglevel = 1; - - printf("\nSIGUSR1 signal: statistics and configuration report\n"); - - greet_world(); - - dump_config(); - dump_routes(); - dump_params(); - - printf("\nInput stats:\n"); - printf("KISS input packets: %d\n", stats.kiss_in); - printf(" too big: %d\n", stats.kiss_toobig); - printf(" bad type: %d\n", stats.kiss_badtype); - printf(" too short: %d\n", stats.kiss_tooshort); - printf(" not for me: %d\n", stats.kiss_not_for_me); - printf(" I am destination: %d\n", stats.kiss_i_am_dest); - printf(" no route found: %d\n", stats.kiss_no_ip_addr); - printf("UDP input packets: %d\n", stats.udp_in); - printf("IP input packets: %d\n", stats.ip_in); - printf(" failed CRC test: %d\n", stats.ip_failed_crc); - printf(" too short: %d\n", stats.ip_tooshort); - printf(" not for me: %d\n", stats.ip_not_for_me); - printf(" I am destination: %d\n", stats.ip_i_am_dest); - printf("\nOutput stats:\n"); - printf("KISS output packets: %d\n", stats.kiss_out); - printf(" beacons: %d\n", stats.kiss_beacon_outs); - printf("UDP output packets: %d\n", stats.udp_out); - printf("IP output packets: %d\n", stats.ip_out); - printf("\n"); - - fflush(stdout); - -/* restore the old loglevel */ - loglevel = save_loglevel; -} - -void usr1_handler(int i) -{ - printf("\nSIGUSR1!\n"); - do_stats(); -} - void int_handler(int i) { printf("\nSIGINT!\n"); -- cgit v1.2.3