summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2013-06-05 15:32:22 +0200
committerRalf Baechle <ralf@linux-mips.org>2013-06-17 17:04:02 +0200
commit8779549de990ea6aa8bc246e15af4e4f01f88bea (patch)
tree7c86f71206ba948f0d15092c59aeb4318fea7139
parent26cb1ffe2710f617a7f986008860983135f232f7 (diff)
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 <ralf@linux-mips.org>
-rw-r--r--axconfig.c148
-rw-r--r--axutils.c2
-rw-r--r--nrconfig.c152
-rw-r--r--rsconfig.c144
4 files changed, 223 insertions, 223 deletions
diff --git a/axconfig.c b/axconfig.c
index 1b7077c..84199c1 100644
--- a/axconfig.c
+++ b/axconfig.c
@@ -237,13 +237,13 @@ static int ax25_config_init_port(int fd, int lineno, char *line, const char **if
found = 0;
char *cp;
if ((cp = strstr(call, "-0")) != NULL)
- *cp = '\0';
+ *cp = '\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) {
@@ -294,83 +294,83 @@ int ax25_config_load_ports(void)
if ((fd = socket(PF_FILE, SOCK_DGRAM, 0)) < 0) {
- fprintf(stderr, "axconfig: unable to open socket (%s)\n", strerror(errno));
- goto cleanup;
+ fprintf(stderr, "axconfig: 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, "axconfig: SIOCGIFHWADDR: %s\n", strerror(errno));
- return FALSE;
- }
-
- if (ifr.ifr_hwaddr.sa_family != ARPHRD_AX25)
- 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, "axconfig: 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;
- }
- }
- }
- 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, "axconfig: SIOCGIFHWADDR: %s\n", strerror(errno));
+ return FALSE;
+ }
+
+ if (ifr.ifr_hwaddr.sa_family != ARPHRD_AX25)
+ 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, "axconfig: 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;
+ }
+ }
+ }
+ fclose(fp);
+ fp = NULL;
}
if ((fp = fopen(CONF_AXPORTS_FILE, "r")) == NULL) {
- fprintf(stderr, "axconfig: unable to open axports file %s (%s)\n", CONF_AXPORTS_FILE, strerror(errno));
- goto cleanup;
+ fprintf(stderr, "axconfig: unable to open axports file %s (%s)\n", CONF_AXPORTS_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 (ax25_config_init_port(fd, lineno, buffer, calllist, devlist))
- n++;
+ if (strlen(buffer) > 0 && *buffer != '#')
+ if (ax25_config_init_port(fd, lineno, buffer, calllist, devlist))
+ n++;
- lineno++;
+ lineno++;
}
cleanup:;
@@ -378,9 +378,9 @@ int ax25_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);
diff --git a/axutils.c b/axutils.c
index 240a0b4..8833531 100644
--- a/axutils.c
+++ b/axutils.c
@@ -201,7 +201,7 @@ char *ax25_ntoa(const ax25_address *a)
/* Convention is: -0 suffixes are NOT printed */
if (a->ax25_call[6] & 0x1E) {
- *s++ = '-';
+ *s++ = '-';
if ((n = ((a->ax25_call[6] >> 1) & 0x0F)) > 9) {
*s++ = '1';
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);
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);