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 --- hdlcutil/sethdlc.c | 116 ++++++++++++++++++++++++++--------------------------- 1 file changed, 58 insertions(+), 58 deletions(-) (limited to 'hdlcutil/sethdlc.c') diff --git a/hdlcutil/sethdlc.c b/hdlcutil/sethdlc.c index 34e1467..faa4765 100644 --- a/hdlcutil/sethdlc.c +++ b/hdlcutil/sethdlc.c @@ -52,14 +52,14 @@ static char *progname; /* ---------------------------------------------------------------------- */ -static void display_packet(unsigned char *bp, unsigned int len) +static void display_packet(unsigned char *bp, unsigned int len) { unsigned char v1=1,cmd=0; unsigned char i,j; - if (!bp || !len) + if (!bp || !len) return; - if (len < 8) + if (len < 8) return; if (bp[1] & 1) { /* @@ -69,24 +69,24 @@ static void display_packet(unsigned char *bp, unsigned int len) cmd = (bp[1] & 2) != 0; printf("fm ? to "); i = (bp[2] >> 2) & 0x3f; - if (i) + if (i) printf("%c",i+0x20); i = ((bp[2] << 4) | ((bp[3] >> 4) & 0xf)) & 0x3f; - if (i) + if (i) printf("%c",i+0x20); i = ((bp[3] << 2) | ((bp[4] >> 6) & 3)) & 0x3f; - if (i) + if (i) printf("%c",i+0x20); i = bp[4] & 0x3f; - if (i) + if (i) printf("%c",i+0x20); i = (bp[5] >> 2) & 0x3f; - if (i) + if (i) printf("%c",i+0x20); i = ((bp[5] << 4) | ((bp[6] >> 4) & 0xf)) & 0x3f; - if (i) + if (i) printf("%c",i+0x20); - printf("-%u QSO Nr %u", bp[6] & 0xf, (bp[0] << 6) | + printf("-%u QSO Nr %u", bp[6] & 0xf, (bp[0] << 6) | (bp[1] >> 2)); bp += 7; len -= 7; @@ -94,41 +94,41 @@ static void display_packet(unsigned char *bp, unsigned int len) /* * normal header */ - if (len < 15) + if (len < 15) return; if ((bp[6] & 0x80) != (bp[13] & 0x80)) { v1 = 0; cmd = (bp[6] & 0x80); } printf("fm "); - for(i = 7; i < 13; i++) - if ((bp[i] &0xfe) != 0x40) + for(i = 7; i < 13; i++) + if ((bp[i] &0xfe) != 0x40) printf("%c",bp[i] >> 1); printf("-%u to ",(bp[13] >> 1) & 0xf); - for(i = 0; i < 6; i++) - if ((bp[i] &0xfe) != 0x40) + for(i = 0; i < 6; i++) + if ((bp[i] &0xfe) != 0x40) printf("%c", bp[i] >> 1); printf("-%u", (bp[6] >> 1) & 0xf); bp += 14; len -= 14; - if ((!(bp[-1] & 1)) && (len >= 7)) + if ((!(bp[-1] & 1)) && (len >= 7)) printf(" via "); while ((!(bp[-1] & 1)) && (len >= 7)) { - for(i = 0; i < 6; i++) - if ((bp[i] &0xfe) != 0x40) + for(i = 0; i < 6; i++) + if ((bp[i] &0xfe) != 0x40) printf("%c",bp[i] >> 1); printf("-%u",(bp[6] >> 1) & 0xf); bp += 7; len -= 7; - if ((!(bp[-1] & 1)) && (len >= 7)) + if ((!(bp[-1] & 1)) && (len >= 7)) printf(","); } } - if(!len) + if(!len) return; i = *bp++; len--; - j = v1 ? ((i & 0x10) ? '!' : ' ') : + j = v1 ? ((i & 0x10) ? '!' : ' ') : ((i & 0x10) ? (cmd ? '+' : '-') : (cmd ? '^' : 'v')); if (!(i & 1)) { /* @@ -177,7 +177,7 @@ static void display_packet(unsigned char *bp, unsigned int len) printf(" REJ%u%c",(i >> 5) & 7,j); break; default: - printf(" unknown S (0x%x)%u%c", i & 0xf, + printf(" unknown S (0x%x)%u%c", i & 0xf, (i >> 5) & 7, j); break; } @@ -191,19 +191,19 @@ static void display_packet(unsigned char *bp, unsigned int len) j = 0; while (len) { i = *bp++; - if ((i >= 32) && (i < 128)) + if ((i >= 32) && (i < 128)) printf("%c",i); else if (i == 13) { - if (j) + if (j) printf("\n"); j = 0; - } else + } else printf("."); - if (i >= 32) + if (i >= 32) j = 1; len--; } - if (j) + if (j) printf("\n"); } @@ -215,7 +215,7 @@ static void print_bits(int (*bitproc)(void)) int i; char str[9]; char *cp; - + for(;;) { ret = bitproc(); if (ret < 0) { @@ -226,7 +226,7 @@ static void print_bits(int (*bitproc)(void)) return; } strcpy(cp = str, "00000000"); - for(i = 0; i < 8; i++, cp++, ret >>= 1) + for(i = 0; i < 8; i++, cp++, ret >>= 1) *cp += (ret & 1); printf("%s", str); } @@ -236,7 +236,7 @@ static void print_bits(int (*bitproc)(void)) #ifdef HDRVC_KERNEL -static void do_set_params(int argc, char **argv) +static void do_set_params(int argc, char **argv) { struct hdlcdrv_ioctl drvname, curm, newm, mlist, curp, newp, mpmask; char set = 0; @@ -268,7 +268,7 @@ static void do_set_params(int argc, char **argv) newp = curp; while (argc >= 2) { if (!strcasecmp(argv[0], "mode")) { - strncpy(newm.data.modename, argv[1], + strncpy(newm.data.modename, argv[1], sizeof(newm.data.modename)); set |= 1; } else if (!strcasecmp(argv[0], "io") && mask & HDLCDRV_PARMASK_IOBASE) { @@ -291,17 +291,17 @@ static void do_set_params(int argc, char **argv) set |= 2; } else if (!strcasecmp(argv[0], "midiio") && mask & HDLCDRV_PARMASK_MIDIIOBASE) { newp.data.mp.midiiobase = strtol(argv[1], NULL, 0); - set |= 2; + set |= 2; } else { fprintf(stderr, "%s: invalid parameter type '%s', " "valid: mode%s%s%s%s%s%s%s\n", - progname, argv[0], - (mask & HDLCDRV_PARMASK_IOBASE) ? " io" : "", - (mask & HDLCDRV_PARMASK_IRQ) ? " irq" : "", - (mask & HDLCDRV_PARMASK_DMA) ? " dma" : "", - (mask & HDLCDRV_PARMASK_DMA2) ? " dma2" : "", - (mask & HDLCDRV_PARMASK_SERIOBASE) ? " serio" : "", - (mask & HDLCDRV_PARMASK_PARIOBASE) ? " pario" : "", + progname, argv[0], + (mask & HDLCDRV_PARMASK_IOBASE) ? " io" : "", + (mask & HDLCDRV_PARMASK_IRQ) ? " irq" : "", + (mask & HDLCDRV_PARMASK_DMA) ? " dma" : "", + (mask & HDLCDRV_PARMASK_DMA2) ? " dma2" : "", + (mask & HDLCDRV_PARMASK_SERIOBASE) ? " serio" : "", + (mask & HDLCDRV_PARMASK_PARIOBASE) ? " pario" : "", (mask & HDLCDRV_PARMASK_MIDIIOBASE) ? " midiio" : ""); } argv += 2; @@ -327,7 +327,7 @@ static void do_set_params(int argc, char **argv) printf(" midiio 0x%x", curp.data.mp.midiiobase); printf("\n"); - if (set & 1) + if (set & 1) ret = hdrvc_hdlcdrv_ioctl(HDLCDRVCTL_SETMODE, &newm); if (ret < 0) { perror("ioctl (HDLCDRVCTL_SETMODE)"); @@ -336,7 +336,7 @@ static void do_set_params(int argc, char **argv) perror("ioctl (HDLCDRVCTL_MODELIST)"); exit(1); } - printf("driver supported modes: %s\n", + printf("driver supported modes: %s\n", mlist.data.modename); exit(1); } @@ -347,7 +347,7 @@ static void do_set_params(int argc, char **argv) fprintf(stderr, "%s: trying to restore old " "parameters\n", progname); ret = hdrvc_hdlcdrv_ioctl(HDLCDRVCTL_SETMODEMPAR, &curp); - if (ret < 0) + if (ret < 0) perror("ioctl (HDLCDRVCTL_SETMODEMPAR)"); exit(1); } @@ -377,17 +377,17 @@ static void do_set_params(int argc, char **argv) /* ---------------------------------------------------------------------- */ -static void display_channel_params(const struct hdrvc_channel_params *par) +static void display_channel_params(const struct hdrvc_channel_params *par) { printf("TX delay %ums, TX tail %ums, slottime %ums, p-persistence " " %u/256, %s duplex\n", 10*par->tx_delay, 10*par->tx_tail, - 10*par->slottime, par->ppersist, + 10*par->slottime, par->ppersist, par->fulldup ? "Full" : "Half"); } /* ---------------------------------------------------------------------- */ -static void do_set_channel_params(int argc, char **argv) +static void do_set_channel_params(int argc, char **argv) { struct hdrvc_channel_params par1, par2; char set = 0; @@ -452,13 +452,13 @@ static void do_set_channel_params(int argc, char **argv) /* ---------------------------------------------------------------------- */ -static const char *usage_str = +static const char *usage_str = "[-b] [-i] [-d] [-i ] [-h] [-c ]\n" "[-p] [hw ] [type ] [io ] [irq ] [dma ]\n" " [options ] [serio ] [pario ] [midiio ]\n" "[-a] [txd ] [txtail ] [slot ]\n" " [ppersist ] [full] [half]\n" -" -a: set or display channel access parameters\n" +" -a: set or display channel access parameters\n" " -b: trace demodulated bits\n" " -s: trace sampled input from tcm3105 (ser12 only)\n" " -d: trace dcd and ptt status on stdout\n" @@ -531,7 +531,7 @@ int main(int argc, char *argv[]) perror("hdrvc_calibrate"); exit(1); } - fprintf(stdout, "%s: calibrating for %i seconds\n", *argv, + fprintf(stdout, "%s: calibrating for %i seconds\n", *argv, cal_val); exit(0); } @@ -543,24 +543,24 @@ int main(int argc, char *argv[]) ret = hdrvc_get_channel_state(&chst); if (ret < 0) perror("hdrvc_get_channel_state"); - printf("%c%c rx: %lu tx: %lu rxerr: %lu txerr: %lu", + printf("%c%c rx: %lu tx: %lu rxerr: %lu txerr: %lu", chst.dcd ? 'D' : '-', chst.ptt ? 'P' : '-', - chst.rx_packets, chst.tx_packets, chst.rx_errors, + chst.rx_packets, chst.tx_packets, chst.rx_errors, chst.tx_errors); #ifdef HDRVC_KERNEL if (hdrvc_sm_ioctl(SMCTL_GETDEBUG, &bsi) >= 0) { printf(" intrate: %u modcyc: %u " - "demodcyc: %u dmares: %u", - bsi.data.dbg.int_rate, - bsi.data.dbg.mod_cycles, + "demodcyc: %u dmares: %u", + bsi.data.dbg.int_rate, + bsi.data.dbg.mod_cycles, bsi.data.dbg.demod_cycles, bsi.data.dbg.dma_residue); - } + } if (hdrvc_baycom_ioctl(BAYCOMCTL_GETDEBUG, &bbi) >= 0) { - printf(" dbg1: %lu dbg2: %lu dbg3: %li", - bbi.data.dbg.debug1, bbi.data.dbg.debug2, + printf(" dbg1: %lu dbg2: %lu dbg3: %li", + bbi.data.dbg.debug1, bbi.data.dbg.debug2, bbi.data.dbg.debug3); - } + } #endif /* HDRVC_KERNEL */ printf("\n"); break; @@ -582,7 +582,7 @@ int main(int argc, char *argv[]) FD_ZERO(&fds_write); FD_SET(hdrvc_getfd(), &fds_read); ret = select(hdrvc_getfd()+1, &fds_read, &fds_write, NULL, &tm); - } else + } else ret = select(0, NULL, NULL, NULL, &tm); if (ret < 0) { fprintf(stderr, "%s: Error %s (%i) in select\n", *argv, -- 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 --- hdlcutil/sethdlc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hdlcutil/sethdlc.c') diff --git a/hdlcutil/sethdlc.c b/hdlcutil/sethdlc.c index faa4765..3389a9e 100644 --- a/hdlcutil/sethdlc.c +++ b/hdlcutil/sethdlc.c @@ -47,7 +47,7 @@ /* ---------------------------------------------------------------------- */ -static unsigned char trace_stat = 0; +static unsigned char trace_stat; static char *progname; /* ---------------------------------------------------------------------- */ -- 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 --- hdlcutil/sethdlc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hdlcutil/sethdlc.c') diff --git a/hdlcutil/sethdlc.c b/hdlcutil/sethdlc.c index 3389a9e..a9f16b3 100644 --- a/hdlcutil/sethdlc.c +++ b/hdlcutil/sethdlc.c @@ -222,7 +222,7 @@ static void print_bits(int (*bitproc)(void)) if (errno == EAGAIN) return; fprintf(stderr, "%s: Error %s (%i), cannot ioctl\n", - progname, strerror(errno), errno); + progname, strerror(errno), errno); return; } strcpy(cp = str, "00000000"); -- cgit v1.2.3 From 4eb951133d9d301184ebd7b675598e11973b6ab8 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Wed, 5 Jun 2013 02:34:19 +0200 Subject: Always have a space between if, for, switch, while and the following `('. Signed-off-by: Ralf Baechle --- hdlcutil/sethdlc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'hdlcutil/sethdlc.c') diff --git a/hdlcutil/sethdlc.c b/hdlcutil/sethdlc.c index a9f16b3..657eed6 100644 --- a/hdlcutil/sethdlc.c +++ b/hdlcutil/sethdlc.c @@ -101,11 +101,11 @@ static void display_packet(unsigned char *bp, unsigned int len) cmd = (bp[6] & 0x80); } printf("fm "); - for(i = 7; i < 13; i++) + for (i = 7; i < 13; i++) if ((bp[i] &0xfe) != 0x40) printf("%c",bp[i] >> 1); printf("-%u to ",(bp[13] >> 1) & 0xf); - for(i = 0; i < 6; i++) + for (i = 0; i < 6; i++) if ((bp[i] &0xfe) != 0x40) printf("%c", bp[i] >> 1); printf("-%u", (bp[6] >> 1) & 0xf); @@ -114,7 +114,7 @@ static void display_packet(unsigned char *bp, unsigned int len) if ((!(bp[-1] & 1)) && (len >= 7)) printf(" via "); while ((!(bp[-1] & 1)) && (len >= 7)) { - for(i = 0; i < 6; i++) + for (i = 0; i < 6; i++) if ((bp[i] &0xfe) != 0x40) printf("%c",bp[i] >> 1); printf("-%u",(bp[6] >> 1) & 0xf); @@ -124,7 +124,7 @@ static void display_packet(unsigned char *bp, unsigned int len) printf(","); } } - if(!len) + if (!len) return; i = *bp++; len--; @@ -216,7 +216,7 @@ static void print_bits(int (*bitproc)(void)) char str[9]; char *cp; - for(;;) { + for (;;) { ret = bitproc(); if (ret < 0) { if (errno == EAGAIN) @@ -226,7 +226,7 @@ static void print_bits(int (*bitproc)(void)) return; } strcpy(cp = str, "00000000"); - for(i = 0; i < 8; i++, cp++, ret >>= 1) + for (i = 0; i < 8; i++, cp++, ret >>= 1) *cp += (ret & 1); printf("%s", str); } -- cgit v1.2.3