From 1245fbd2a8d60bab7b16b8a1d3c0122fee72f53f Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Wed, 5 Jun 2013 00:57:38 +0200 Subject: Nuke trailing whitespace. Signed-off-by: Ralf Baechle --- netrom/netromd.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'netrom/netromd.c') diff --git a/netrom/netromd.c b/netrom/netromd.c index e7a0362..a78db4b 100644 --- a/netrom/netromd.c +++ b/netrom/netromd.c @@ -17,7 +17,7 @@ #include -#ifdef __GLIBC__ +#ifdef __GLIBC__ #include #else #include @@ -51,7 +51,7 @@ static void terminate(int sig) syslog(LOG_INFO, "terminating on SIGTERM\n"); closelog(); } - + exit(0); } @@ -59,12 +59,12 @@ static int bcast_config_load_ports(void) { char buffer[255], port[32], *s; FILE *fp; - + if ((fp = fopen(CONF_NETROMD_FILE, "r")) == NULL) { fprintf(stderr, "netromd: cannot open config file\n"); return -1; } - + while (fgets(buffer, 255, fp) != NULL) { if ((s = strchr(buffer, '\n')) != NULL) *s = '\0'; @@ -109,16 +109,16 @@ static int bcast_config_load_ports(void) fprintf(stderr, "netromd: invalid verbose setting\n"); return -1; } - + port_count++; } - + fclose(fp); if (port_count == 0) return -1; - - return 0; + + return 0; } int main(int argc, char **argv) @@ -187,7 +187,7 @@ int main(int argc, char **argv) fprintf(stderr, "netromd: no AX.25 ports defined\n"); return 1; } - + if (nr_config_load_ports() == 0) { fprintf(stderr, "netromd: no NET/ROM ports defined\n"); return 1; @@ -200,7 +200,7 @@ int main(int argc, char **argv) ax25_aton_entry(nr_config_get_addr(NULL), (char *)&my_call); ax25_aton_entry("NODES", (char *)&node_call); - + if ((s = socket(PF_PACKET, SOCK_PACKET, htons(ETH_P_AX25))) == -1) { perror("netromd: socket"); return 1; @@ -210,7 +210,7 @@ int main(int argc, char **argv) fprintf(stderr, "netromd: cannot become a daemon\n"); return 1; } - + if (logging) { openlog("netromd", LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "starting"); @@ -222,7 +222,7 @@ int main(int argc, char **argv) timeout.tv_sec = 30; timeout.tv_usec = 0; - + if (select(s + 1, &fdset, NULL, NULL, &timeout) == -1) continue; /* Signal received ? */ @@ -238,7 +238,7 @@ int main(int argc, char **argv) } if (ax25_cmp((ax25_address *)(buffer + 1), &node_call) == 0 && - ax25_cmp((ax25_address *)(buffer + 8), &my_call) != 0 && + ax25_cmp((ax25_address *)(buffer + 8), &my_call) != 0 && buffer[16] == NETROM_PID && buffer[17] == NODES_SIG) { for (i = 0; i < port_count; i++) { if (strcmp(port_list[i].device, sa.sa_data) == 0) { -- cgit v1.2.3 From 5feb3d651dbd1b096a26963bd1dffcfe0a5f9eea Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Wed, 5 Jun 2013 01:42:05 +0200 Subject: Remove useless initializations to 0 or NULL. They only inflate the .data section of the binary. Initializations to FALSE are still left to do. Signed-off-by: Ralf Baechle --- netrom/netromd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'netrom/netromd.c') diff --git a/netrom/netromd.c b/netrom/netromd.c index a78db4b..bd2b69c 100644 --- a/netrom/netromd.c +++ b/netrom/netromd.c @@ -40,7 +40,7 @@ struct port_struct port_list[20]; int port_count = FALSE; int compliant = FALSE; int logging = FALSE; -int debug = 0; +int debug; ax25_address my_call; ax25_address node_call; -- cgit v1.2.3 From f76e0b330f0be28f9f3af3073904ede3a34d48f5 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Wed, 5 Jun 2013 15:34:56 +0200 Subject: Reformat consistently. Strictly whitespace changes only. Indentation by tabs only. Move case labels in switches are on the same level as the switch keyword. Signed-off-by: Ralf Baechle --- netrom/netromd.c | 78 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 39 insertions(+), 39 deletions(-) (limited to 'netrom/netromd.c') diff --git a/netrom/netromd.c b/netrom/netromd.c index bd2b69c..fbad930 100644 --- a/netrom/netromd.c +++ b/netrom/netromd.c @@ -138,46 +138,46 @@ int main(int argc, char **argv) while ((i = getopt(argc, argv, "cdilp:q:t:v")) != -1) { switch (i) { - case 'c': - compliant = TRUE; - break; - case 'd': - debug++; - break; - case 'i': - timelast = 0; - break; - case 'l': - logging = TRUE; - break; - case 'p': - pause = atoi(optarg); - if (pause < 1 || pause > 120) { - fprintf(stderr, "netromd: invalid pause value\n"); - return 1; - } - break; - case 'q': - localval = atoi(optarg); - if (localval < 10 || localval > 255) { - fprintf(stderr, "netromd: invalid local quality\n"); - return 1; - } - break; - case 't': - interval = atoi(optarg) * 60; - if (interval < 60 || interval > 7200) { - fprintf(stderr, "netromd: invalid time interval\n"); - return 1; - } - break; - case 'v': - printf("netromd: %s\n", VERSION); - return 0; - case '?': - case ':': - fprintf(stderr, "usage: netromd [-d] [-i] [-l] [-q quality] [-t interval] [-v]\n"); + case 'c': + compliant = TRUE; + break; + case 'd': + debug++; + break; + case 'i': + timelast = 0; + break; + case 'l': + logging = TRUE; + break; + case 'p': + pause = atoi(optarg); + if (pause < 1 || pause > 120) { + fprintf(stderr, "netromd: invalid pause value\n"); + return 1; + } + break; + case 'q': + localval = atoi(optarg); + if (localval < 10 || localval > 255) { + fprintf(stderr, "netromd: invalid local quality\n"); + return 1; + } + break; + case 't': + interval = atoi(optarg) * 60; + if (interval < 60 || interval > 7200) { + fprintf(stderr, "netromd: invalid time interval\n"); return 1; + } + break; + case 'v': + printf("netromd: %s\n", VERSION); + return 0; + case '?': + case ':': + fprintf(stderr, "usage: netromd [-d] [-i] [-l] [-q quality] [-t interval] [-v]\n"); + return 1; } } -- cgit v1.2.3