From 8779549de990ea6aa8bc246e15af4e4f01f88bea Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Wed, 5 Jun 2013 15:32:22 +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 --- nrconfig.c | 152 ++++++++++++++++++++++++++++++------------------------------- 1 file changed, 76 insertions(+), 76 deletions(-) (limited to 'nrconfig.c') diff --git a/nrconfig.c b/nrconfig.c index 048d81b..003dfb2 100644 --- a/nrconfig.c +++ b/nrconfig.c @@ -215,15 +215,15 @@ static int nr_config_init_port(int fd, int lineno, char *line, const char **ifca char *cp; if ((cp = strstr(call, "-0")) != NULL) - *cp = 0; + *cp = 0; found = 0; for (;ifcalls && *ifcalls; ++ifcalls, ++ifdevs) { - if (strcmp(call, *ifcalls) == 0) { - found = 1; - dev = *ifdevs; - break; - } + if (strcmp(call, *ifcalls) == 0) { + found = 1; + dev = *ifdevs; + break; + } } if (!found) { @@ -273,85 +273,85 @@ int nr_config_load_ports(void) if ((fd = socket(PF_FILE, SOCK_DGRAM, 0)) < 0) { - fprintf(stderr, "nrconfig: unable to open socket (%s)\n", strerror(errno)); - goto cleanup; + fprintf(stderr, "nrconfig: unable to open socket (%s)\n", strerror(errno)); + goto cleanup; } if ((fp = fopen("/proc/net/dev", "r"))) { - /* Two header lines.. */ - s = fgets(buffer, sizeof(buffer), fp); - s = fgets(buffer, sizeof(buffer), fp); - /* .. then network interface names */ - while (!feof(fp)) { - if (!fgets(buffer, sizeof(buffer), fp)) - break; - s = strchr(buffer, ':'); - if (s) *s = 0; - s = buffer; - while (isspace(*s & 0xff)) ++s; - - memset(&ifr, 0, sizeof(ifr)); - strncpy(ifr.ifr_name, s, IFNAMSIZ-1); - ifr.ifr_name[IFNAMSIZ-1] = 0; - - if (ioctl(fd, SIOCGIFHWADDR, &ifr) < 0) { - fprintf(stderr, "nrconfig: SIOCGIFHWADDR: %s\n", strerror(errno)); - return FALSE; - } - - if (ifr.ifr_hwaddr.sa_family != ARPHRD_NETROM) - continue; - - /* store found interface callsigns */ - /* ax25_ntoa() returns pointer to static buffer */ - s = ax25_ntoa((void*)ifr.ifr_hwaddr.sa_data); - - if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) { - fprintf(stderr, "nrconfig: SIOCGIFFLAGS: %s\n", strerror(errno)); - return FALSE; - } - - if (!(ifr.ifr_flags & IFF_UP)) - continue; - - - if ((pp = realloc(calllist, sizeof(char *) * (callcount+2))) == 0) - break; - calllist = pp; - if ((pp = realloc(devlist, sizeof(char *) * (callcount+2))) == 0) - break; - devlist = pp; - if ((calllist[callcount] = strdup(s)) != NULL) { - if ((devlist[callcount] = strdup(ifr.ifr_name)) != NULL) { - ++callcount; - calllist[callcount] = NULL; - devlist [callcount] = NULL; - } else { - free((void*)calllist[callcount]); - calllist[callcount] = NULL; - devlist[callcount] = NULL; - } - } - } - fclose(fp); - fp = NULL; + /* Two header lines.. */ + s = fgets(buffer, sizeof(buffer), fp); + s = fgets(buffer, sizeof(buffer), fp); + /* .. then network interface names */ + while (!feof(fp)) { + if (!fgets(buffer, sizeof(buffer), fp)) + break; + s = strchr(buffer, ':'); + if (s) *s = 0; + s = buffer; + while (isspace(*s & 0xff)) ++s; + + memset(&ifr, 0, sizeof(ifr)); + strncpy(ifr.ifr_name, s, IFNAMSIZ-1); + ifr.ifr_name[IFNAMSIZ-1] = 0; + + if (ioctl(fd, SIOCGIFHWADDR, &ifr) < 0) { + fprintf(stderr, "nrconfig: SIOCGIFHWADDR: %s\n", strerror(errno)); + return FALSE; + } + + if (ifr.ifr_hwaddr.sa_family != ARPHRD_NETROM) + continue; + + /* store found interface callsigns */ + /* ax25_ntoa() returns pointer to static buffer */ + s = ax25_ntoa((void*)ifr.ifr_hwaddr.sa_data); + + if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) { + fprintf(stderr, "nrconfig: SIOCGIFFLAGS: %s\n", strerror(errno)); + return FALSE; + } + + if (!(ifr.ifr_flags & IFF_UP)) + continue; + + + if ((pp = realloc(calllist, sizeof(char *) * (callcount+2))) == 0) + break; + calllist = pp; + if ((pp = realloc(devlist, sizeof(char *) * (callcount+2))) == 0) + break; + devlist = pp; + if ((calllist[callcount] = strdup(s)) != NULL) { + if ((devlist[callcount] = strdup(ifr.ifr_name)) != NULL) { + ++callcount; + calllist[callcount] = NULL; + devlist [callcount] = NULL; + } else { + free((void*)calllist[callcount]); + calllist[callcount] = NULL; + devlist[callcount] = NULL; + } + } + } + fclose(fp); + fp = NULL; } if ((fp = fopen(CONF_NRPORTS_FILE, "r")) == NULL) { - fprintf(stderr, "nrconfig: unable to open nrports file %s (%s)\n", CONF_NRPORTS_FILE, strerror(errno)); - goto cleanup; + fprintf(stderr, "nrconfig: unable to open nrports file %s (%s)\n", CONF_NRPORTS_FILE, strerror(errno)); + goto cleanup; } while (fp && fgets(buffer, 255, fp)) { - if ((s = strchr(buffer, '\n'))) - *s = '\0'; + if ((s = strchr(buffer, '\n'))) + *s = '\0'; - if (strlen(buffer) > 0 && *buffer != '#') - if (nr_config_init_port(fd, lineno, buffer, calllist, devlist)) - n++; + if (strlen(buffer) > 0 && *buffer != '#') + if (nr_config_init_port(fd, lineno, buffer, calllist, devlist)) + n++; - lineno++; + lineno++; } cleanup:; @@ -359,9 +359,9 @@ int nr_config_load_ports(void) if (fp) fclose(fp); for (i = 0; calllist && calllist[i]; ++i) { - free((void*)calllist[i]); - if (devlist[i] != NULL) - free((void*)devlist[i]); + free((void*)calllist[i]); + if (devlist[i] != NULL) + free((void*)devlist[i]); } if (calllist) free(calllist); if (devlist) free(devlist); -- cgit v1.2.3