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 --- rsconfig.c | 144 ++++++++++++++++++++++++++++++------------------------------- 1 file changed, 72 insertions(+), 72 deletions(-) (limited to 'rsconfig.c') diff --git a/rsconfig.c b/rsconfig.c index b484c76..21b91e0 100644 --- a/rsconfig.c +++ b/rsconfig.c @@ -167,11 +167,11 @@ static int rs_config_init_port(int fd, int lineno, char *line, const char **ifca found = 0; for (;ifcalls && *ifcalls; ++ifcalls, ++ifdevs) { - if (strcmp(addr,*ifcalls) == 0) { - found = 1; - dev = *ifdevs; - break; - } + if (strcmp(addr,*ifcalls) == 0) { + found = 1; + dev = *ifdevs; + break; + } } if (!found) { @@ -219,83 +219,83 @@ int rs_config_load_ports(void) if ((fd = socket(PF_FILE, SOCK_DGRAM, 0)) < 0) { - fprintf(stderr, "rsconfig: unable to open socket (%s)\n", strerror(errno)); - goto cleanup; + fprintf(stderr, "rsconfig: 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, "rsconfig: SIOCGIFHWADDR: %s\n", strerror(errno)); - return FALSE; - } - - if (ifr.ifr_hwaddr.sa_family != ARPHRD_ROSE) - continue; - - /* store found interface callsigns */ - /* rose_ntoa() returns pointer to static buffer */ - s = rose_ntoa((void*)ifr.ifr_hwaddr.sa_data); - - if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) { - fprintf(stderr, "rsconfig: 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]); - } - } - } - 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, "rsconfig: SIOCGIFHWADDR: %s\n", strerror(errno)); + return FALSE; + } + + if (ifr.ifr_hwaddr.sa_family != ARPHRD_ROSE) + continue; + + /* store found interface callsigns */ + /* rose_ntoa() returns pointer to static buffer */ + s = rose_ntoa((void*)ifr.ifr_hwaddr.sa_data); + + if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) { + fprintf(stderr, "rsconfig: 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]); + } + } + } + fclose(fp); + fp = NULL; } if ((fp = fopen(CONF_RSPORTS_FILE, "r")) == NULL) { - fprintf(stderr, "rsconfig: unable to open axports file %s (%s)\n", CONF_RSPORTS_FILE, strerror(errno)); - goto cleanup; + fprintf(stderr, "rsconfig: unable to open axports file %s (%s)\n", CONF_RSPORTS_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 (rs_config_init_port(fd, lineno, buffer, calllist, devlist)) - n++; + if (strlen(buffer) > 0 && *buffer != '#') + if (rs_config_init_port(fd, lineno, buffer, calllist, devlist)) + n++; - lineno++; + lineno++; } cleanup:; @@ -303,8 +303,8 @@ int rs_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*)calllist[i]); + if (devlist[i] != NULL) free((void*)devlist[i]); } if (calllist) free(calllist); -- cgit v1.2.3