summaryrefslogtreecommitdiffstats
path: root/netrom/nrattach.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2013-06-05 00:57:38 +0200
committerRalf Baechle <ralf@linux-mips.org>2013-06-17 17:11:30 +0200
commit1245fbd2a8d60bab7b16b8a1d3c0122fee72f53f (patch)
tree6dcf938b1472a9b5cac35648ffb0f3d185c39590 /netrom/nrattach.c
parent0b4425760be1f92a1f25daeb5d3dc91814a98622 (diff)
Nuke trailing whitespace.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'netrom/nrattach.c')
-rw-r--r--netrom/nrattach.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/netrom/nrattach.c b/netrom/nrattach.c
index 49c5553..0f8055e 100644
--- a/netrom/nrattach.c
+++ b/netrom/nrattach.c
@@ -34,7 +34,7 @@ int readconfig(char *port)
FILE *fp;
char buffer[90], *s;
int n = 0;
-
+
if ((fp = fopen(CONF_NRPORTS_FILE, "r")) == NULL) {
fprintf(stderr, "nrattach: cannot open nrports file\n");
return FALSE;
@@ -42,7 +42,7 @@ int readconfig(char *port)
while (fgets(buffer, 90, fp) != NULL) {
n++;
-
+
if ((s = strchr(buffer, '\n')) != NULL)
*s = '\0';
@@ -53,10 +53,10 @@ int readconfig(char *port)
fprintf(stderr, "nrattach: unable to parse line %d of the nrports file\n", n);
return FALSE;
}
-
+
if (strcmp(s, port) != 0)
continue;
-
+
if ((s = strtok(NULL, " \t\r\n")) == NULL) {
fprintf(stderr, "nrattach: unable to parse line %d of the nrports file\n", n);
return FALSE;
@@ -82,14 +82,14 @@ int readconfig(char *port)
}
fclose(fp);
-
+
return TRUE;
}
-
+
fclose(fp);
fprintf(stderr, "nrattach: cannot find port %s in nrports\n", port);
-
+
return FALSE;
}
@@ -98,7 +98,7 @@ int getfreedev(char *dev)
struct ifreq ifr;
int fd;
int i;
-
+
if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
perror("nrattach: socket");
return FALSE;
@@ -107,7 +107,7 @@ int getfreedev(char *dev)
for (i = 0; i < 4; i++) {
sprintf(dev, "nr%d", i);
strcpy(ifr.ifr_name, dev);
-
+
if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) {
perror("nrattach: SIOCGIFFLAGS");
return FALSE;
@@ -129,17 +129,17 @@ int startiface(char *dev, struct hostent *hp)
struct ifreq ifr;
char call[7];
int fd;
-
+
if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
perror("nrattach: socket");
return FALSE;
}
strcpy(ifr.ifr_name, dev);
-
+
if (hp != NULL) {
ifr.ifr_addr.sa_family = AF_INET;
-
+
ifr.ifr_addr.sa_data[0] = 0;
ifr.ifr_addr.sa_data[1] = 0;
ifr.ifr_addr.sa_data[2] = hp->h_addr_list[0][0];
@@ -159,7 +159,7 @@ int startiface(char *dev, struct hostent *hp)
ifr.ifr_hwaddr.sa_family = ARPHRD_NETROM;
memcpy(ifr.ifr_hwaddr.sa_data, call, 7);
-
+
if (ioctl(fd, SIOCSIFHWADDR, &ifr) != 0) {
perror("nrattach: SIOCSIFHWADDR");
return FALSE;
@@ -185,12 +185,12 @@ int startiface(char *dev, struct hostent *hp)
perror("nrattach: SIOCSIFFLAGS");
return FALSE;
}
-
+
close(fd);
-
+
return TRUE;
}
-
+
int main(int argc, char *argv[])
{
@@ -221,7 +221,7 @@ int main(int argc, char *argv[])
return 1;
}
}
-
+
if ((argc - optind) != 1) {
fprintf(stderr, "usage: nrattach [-i inetaddr] [-m mtu] [-v] port\n");
return 1;
@@ -234,11 +234,11 @@ int main(int argc, char *argv[])
fprintf(stderr, "nrattach: cannot find free NET/ROM device\n");
return 1;
}
-
+
if (!startiface(dev, hp))
- return 1;
+ return 1;
printf("NET/ROM port %s bound to device %s\n", argv[optind], dev);
-
+
return 0;
}