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 --- kiss/kissattach.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'kiss/kissattach.c') diff --git a/kiss/kissattach.c b/kiss/kissattach.c index 6ed66a2..49f5ee2 100644 --- a/kiss/kissattach.c +++ b/kiss/kissattach.c @@ -67,16 +67,16 @@ static int readconfig(char *port) FILE *fp; char buffer[90], *s; int n = 0; - + if ((fp = fopen(CONF_AXPORTS_FILE, "r")) == NULL) { - fprintf(stderr, "%s: cannot open axports file %s\n", + fprintf(stderr, "%s: cannot open axports file %s\n", progname, CONF_AXPORTS_FILE); return FALSE; } while (fgets(buffer, 90, fp) != NULL) { n++; - + if ((s = strchr(buffer, '\n')) != NULL) *s = '\0'; @@ -87,10 +87,10 @@ static int readconfig(char *port) fprintf(stderr, "%s: unable to parse line %d of the axports file\n", progname, n); return FALSE; } - + if (strcmp(s, port) != 0) continue; - + if ((s = strtok(NULL, " \t\r\n")) == NULL) { fprintf(stderr, "%s: unable to parse line %d of the axports file\n", progname, n); return FALSE; @@ -118,14 +118,14 @@ static int readconfig(char *port) } fclose(fp); - + return TRUE; } - + fclose(fp); fprintf(stderr, "%s: cannot find port %s in axports\n", progname, port); - + return FALSE; } @@ -136,7 +136,7 @@ static int setifcall(int fd, char *name) if (ax25_aton_entry(name, call) == -1) return FALSE; - + if (ioctl(fd, SIOCSIFHWADDR, call) != 0) { close(fd); fprintf(stderr, "%s: ", progname); @@ -152,7 +152,7 @@ static int startiface(char *dev, struct hostent *hp) { struct ifreq ifr; int fd; - + if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { fprintf(stderr, "%s: ", progname); perror("socket"); @@ -160,10 +160,10 @@ static int startiface(char *dev, struct hostent *hp) } 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]; @@ -206,9 +206,9 @@ static int startiface(char *dev, struct hostent *hp) perror("SIOCSIFFLAGS"); return FALSE; } - + close(fd); - + return TRUE; } @@ -325,7 +325,7 @@ int main(int argc, char *argv[]) if (ioctl(fd, TIOCSETD, &disc) == -1) { fprintf(stderr, "%s: Error setting line discipline: ", progname); perror("TIOCSETD"); - fprintf(stderr, "Are you sure you have enabled %s support in the kernel\n", + fprintf(stderr, "Are you sure you have enabled %s support in the kernel\n", disc == N_AX25 ? "MKISS" : "6PACK"); fprintf(stderr, "or, if you made it a module, that the module is loaded?\n"); return 1; @@ -349,7 +349,7 @@ int main(int argc, char *argv[]) /* ax25 ifaces should not really need to have an IP address assigned to */ if (!startiface(dev, hp)) - return 1; + return 1; printf("AX.25 port %s bound to device %s\n", portname, dev); if (i_am_unix98_pty_master) { -- 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 --- kiss/kissattach.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'kiss/kissattach.c') diff --git a/kiss/kissattach.c b/kiss/kissattach.c index 49f5ee2..e61eabb 100644 --- a/kiss/kissattach.c +++ b/kiss/kissattach.c @@ -33,15 +33,15 @@ #endif static char *callsign; -static int speed = 0; -static int mtu = 0; +static int speed; +static int mtu; static int logging = FALSE; -static char *progname = NULL; -static char *kttyname = NULL; -static char *portname = NULL; -static char *inetaddr = NULL; -static int allow_broadcast = 0; -static int i_am_unix98_pty_master = 0; /* unix98 ptmx support */ +static char *progname; +static char *kttyname; +static char *portname; +static char *inetaddr; +static int allow_broadcast; +static int i_am_unix98_pty_master; /* unix98 ptmx support */ static char *kiss_basename(char *s) { -- cgit v1.2.3 From 90f6ab2eceada8987fc6e5017ae415eade165c00 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Wed, 5 Jun 2013 01:47:40 +0200 Subject: Use tabs for indentation, not spaces. Signed-off-by: Ralf Baechle --- kiss/kissattach.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'kiss/kissattach.c') diff --git a/kiss/kissattach.c b/kiss/kissattach.c index e61eabb..0f62892 100644 --- a/kiss/kissattach.c +++ b/kiss/kissattach.c @@ -70,7 +70,7 @@ static int readconfig(char *port) if ((fp = fopen(CONF_AXPORTS_FILE, "r")) == NULL) { fprintf(stderr, "%s: cannot open axports file %s\n", - progname, CONF_AXPORTS_FILE); + progname, CONF_AXPORTS_FILE); return FALSE; } @@ -214,7 +214,7 @@ static int startiface(char *dev, struct hostent *hp) static void usage(void) { - fprintf(stderr, "usage: %s [-b] [-l] [-m mtu] [-v] tty port [inetaddr]\n", progname); + fprintf(stderr, "usage: %s [-b] [-l] [-m mtu] [-v] tty port [inetaddr]\n", progname); } int main(int argc, char *argv[]) @@ -224,7 +224,7 @@ int main(int argc, char *argv[]) char dev[64]; int v = 4; char *namepts = NULL; /* name of the unix98 pts slave, which - * the client has to use */ + * the client has to use */ struct hostent *hp = NULL; progname = kiss_basename(argv[0]); @@ -291,7 +291,7 @@ int main(int argc, char *argv[]) if (!readconfig(portname)) return 1; - if (inetaddr && (hp = gethostbyname(inetaddr)) == NULL) { + if (inetaddr && (hp = gethostbyname(inetaddr)) == NULL) { fprintf(stderr, "%s: invalid internet name/address - %s\n", progname, inetaddr); return 1; } -- 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 --- kiss/kissattach.c | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'kiss/kissattach.c') diff --git a/kiss/kissattach.c b/kiss/kissattach.c index 0f62892..e30ed05 100644 --- a/kiss/kissattach.c +++ b/kiss/kissattach.c @@ -234,32 +234,32 @@ int main(int argc, char *argv[]) while ((fd = getopt(argc, argv, "b6i:lm:v")) != -1) { switch (fd) { - case '6': - disc = N_6PACK; - break; - case 'b': - allow_broadcast = 1; - break; - case 'i': - fprintf(stderr, "%s: -i flag depreciated, use new command line format instead.\n", progname); - inetaddr = optarg; - break; - case 'l': - logging = TRUE; - break; - case 'm': - if ((mtu = atoi(optarg)) <= 0) { - fprintf(stderr, "%s: invalid mtu size - %s\n", progname, optarg); - return 1; - } - break; - case 'v': - printf("%s: %s\n", progname, VERSION); - return 0; - case ':': - case '?': - usage(); + case '6': + disc = N_6PACK; + break; + case 'b': + allow_broadcast = 1; + break; + case 'i': + fprintf(stderr, "%s: -i flag depreciated, use new command line format instead.\n", progname); + inetaddr = optarg; + break; + case 'l': + logging = TRUE; + break; + case 'm': + if ((mtu = atoi(optarg)) <= 0) { + fprintf(stderr, "%s: invalid mtu size - %s\n", progname, optarg); return 1; + } + break; + case 'v': + printf("%s: %s\n", progname, VERSION); + return 0; + case ':': + case '?': + usage(); + return 1; } } -- cgit v1.2.3