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 --- 6pack/Makefile.am | 2 +- 6pack/m6pack.c | 40 +++++------ AUTHORS | 4 +- ChangeLog | 6 +- Makefile.am | 2 +- README | 2 +- ax25/Makefile.am | 4 +- ax25/access.c | 6 +- ax25/ax25.4 | 2 +- ax25/ax25d.c | 34 +++++----- ax25/axctl.c | 10 +-- ax25/axgetput/Makefile.am | 10 +-- ax25/axgetput/axgetput.c | 2 +- ax25/axgetput/proto_bin.c | 6 +- ax25/axgetput/util.c | 2 +- ax25/axparms.8 | 8 +-- ax25/axparms.c | 24 +++---- ax25/axspawn.8 | 6 +- ax25/axspawn.c | 142 +++++++++++++++++++-------------------- ax25/beacon.c | 8 +-- ax25/bpqparms.c | 28 ++++---- ax25/mheard.c | 4 +- ax25/mheardd.8 | 2 +- ax25/mheardd.c | 22 +++--- ax25/rxecho.c | 22 +++--- dmascc/dmascc_cfg.1 | 6 +- hdlcutil/Makefile.am | 2 +- hdlcutil/baycom.9 | 6 +- hdlcutil/fl/xfhdlcchpar_main.cxx | 4 +- hdlcutil/fl/xfhdlcst_main.cxx | 8 +-- hdlcutil/fl/xfsmdiag_main.cxx | 18 ++--- hdlcutil/fl/xfsmmixer_main.cxx | 20 +++--- hdlcutil/hdlcdrv.9 | 6 +- hdlcutil/hdrvcomm.c | 50 +++++++------- hdlcutil/sethdlc.8 | 16 ++--- hdlcutil/sethdlc.c | 116 ++++++++++++++++---------------- hdlcutil/smdiag.8 | 2 +- hdlcutil/smdiag.c | 42 ++++++------ hdlcutil/smmixer.c | 112 +++++++++++++++--------------- hdlcutil/soundmodem.9 | 4 +- hdlcutil/soundmodem.h | 2 +- hdlcutil/usersmdiag.h | 6 +- kiss/Makefile.am | 2 +- kiss/kissattach.c | 32 ++++----- kiss/kissnetd.c | 82 +++++++++++----------- kiss/kissparms.8 | 2 +- kiss/kissparms.c | 6 +- kiss/mkiss.c | 18 ++--- kiss/net2kiss.c | 96 +++++++++++++------------- netrom/Makefile.am | 6 +- netrom/netrom.4 | 2 +- netrom/netromd.c | 26 +++---- netrom/netromr.c | 6 +- netrom/netromt.c | 14 ++-- netrom/nrattach.c | 40 +++++------ netrom/nrparms.c | 16 ++--- netrom/nrsdrv.c | 20 +++--- rose/Makefile.am | 6 +- rose/rose.4 | 2 +- rose/rsattach.c | 40 +++++------ rose/rsdwnlnk.8 | 2 +- rose/rsdwnlnk.c | 10 +-- rose/rsmemsiz.c | 10 +-- rose/rsparms.c | 8 +-- rose/rsuplnk.c | 4 +- tcpip/Makefile.am | 2 +- tcpip/rip98d.c | 30 ++++----- tcpip/rip98r.c | 18 ++--- tcpip/rip98t.c | 4 +- tcpip/ttylinkd.8 | 8 +-- tcpip/ttylinkd.c | 116 ++++++++++++++++---------------- tcpip/ttylinkd.conf.5 | 2 +- user_call/ax25_call.8 | 2 +- user_call/user_io.c | 2 +- yamdrv/README.yamdrv | 52 +++++++------- yamdrv/mcs2h.c | 30 ++++----- 76 files changed, 767 insertions(+), 767 deletions(-) diff --git a/6pack/Makefile.am b/6pack/Makefile.am index 605fe89..a5ad261 100644 --- a/6pack/Makefile.am +++ b/6pack/Makefile.am @@ -8,7 +8,7 @@ LDADD= $(AX25_LIB) dist_man_MANS = m6pack.8 INCLUDES = -DAX25_SYSCONFDIR=\""$(AX25_SYSCONFDIR)"\" \ - -DAX25_LOCALSTATEDIR=\""$(AX25_LOCALSTATEDIR)"\" + -DAX25_LOCALSTATEDIR=\""$(AX25_LOCALSTATEDIR)"\" AX25_SYSCONFDIR=${sysconfdir}/ax25/ AX25_LOCALSTATEDIR=${localstatedir}/ax25/ diff --git a/6pack/m6pack.c b/6pack/m6pack.c index e5ee2ee..19c07ba 100644 --- a/6pack/m6pack.c +++ b/6pack/m6pack.c @@ -1,4 +1,4 @@ -/* Hey Emacs! this is -*- linux-c -*- +/* Hey Emacs! this is -*- linux-c -*- * from /usr/src/linux/Documentation/CodingStyle * * m6pack.c @@ -152,7 +152,7 @@ static int sixpack_rx(struct iface *ifp, __u8 c, __u8 *tnc_addr, frame_t *type) { int i, len; __u8 checksum; - + /* Is it a data octect? */ if (SIXP_IS_DATA(c)) { @@ -164,20 +164,20 @@ static int sixpack_rx(struct iface *ifp, __u8 c, __u8 *tnc_addr, frame_t *type) *ifp->optr = (c & 0x3F); break; case 1: - *ifp->optr++ |= (c & 0x30) << 2; + *ifp->optr++ |= (c & 0x30) << 2; *ifp->optr = (c & 0x0F); break; case 2: - *ifp->optr++ |= (c & 0x3C) << 2; + *ifp->optr++ |= (c & 0x3C) << 2; *ifp->optr = (c & 0x03); break; default: - *ifp->optr++ |= (c & 0x3F) << 2; + *ifp->optr++ |= (c & 0x3F) << 2; } ifp->sixp_cnt++; return 0; } - + /* Nope, it's a command octect. See which kind of command. * Anything but a SEOF command is a one-octect command, so * process it immediately and return. @@ -222,7 +222,7 @@ static int sixpack_rx(struct iface *ifp, __u8 c, __u8 *tnc_addr, frame_t *type) *type = command; return 1; } - + /* We're dealing with a SEOF command. */ len = ifp->optr - ifp->databuf; @@ -234,9 +234,9 @@ static int sixpack_rx(struct iface *ifp, __u8 c, __u8 *tnc_addr, frame_t *type) */ goto error_reset_state; } - + /* Now that we've decoded 6PACK octects, - * check the checksum of the frame. + * check the checksum of the frame. */ checksum = 0; for (i = 0; i < len; i++) { @@ -247,13 +247,13 @@ static int sixpack_rx(struct iface *ifp, __u8 c, __u8 *tnc_addr, frame_t *type) */ *tnc_addr = SIXP_ADDR(ifp->seof); checksum += *tnc_addr; - + if (checksum != SIXP_CHKSUM) { /* Signal error and reset state. */ goto error_reset_state; } - + /* Now remove checksum from the frame (this makes * sixpack_tx easier). */ @@ -271,8 +271,8 @@ static int sixpack_rx(struct iface *ifp, __u8 c, __u8 *tnc_addr, frame_t *type) ifp->seof = c; ifp->sixp_cnt = 0; ifp->decod_cnt = 0; - return len; - + return len; + error_reset_state: ifp->errors++; ifp->optr = ifp->databuf; @@ -345,7 +345,7 @@ static void sixpack_tx(int fd, __u8 tnc_addr, __u8 *ibuf, int len, frame_t type) count = ptr - obuf; written = 0; - ptr = obuf; + ptr = obuf; while (count > 0) { written = write (fd, ptr, count); count -= written; @@ -356,16 +356,16 @@ static void sixpack_tx(int fd, __u8 tnc_addr, __u8 *ibuf, int len, frame_t type) static void sigterm_handler(int sig) { int i; - + if (logging) { syslog(LOG_INFO, "terminating on SIGTERM\n"); closelog(); } - + tty_unlock(tty->name); close(tty->fd); free(tty); - + for (i = 0; i < numptys; i++) { tty_unlock(pty[i]->name); close(pty[i]->fd); @@ -620,7 +620,7 @@ int main(int argc, char *argv[]) * A character has arrived on the ttyinterface. */ if (FD_ISSET(tty->fd, &readfd)) { - if ((size = read(tty->fd, ibuf, SIZE)) < 0 + if ((size = read(tty->fd, ibuf, SIZE)) < 0 && errno != EINTR) { if (logging) syslog(LOG_ERR, "tty->fd: %m"); @@ -633,8 +633,8 @@ int main(int argc, char *argv[]) if (tnc_addr <= numptys) { sixpack_tx(pty[tnc_addr]->fd, 0, - (type == data) ? - tty->databuf : + (type == data) ? + tty->databuf : tty->cmdbuf, len, type); diff --git a/AUTHORS b/AUTHORS index 25068b7..15d81ee 100644 --- a/AUTHORS +++ b/AUTHORS @@ -18,11 +18,11 @@ sethdlc Thomas Sailer HB9JNX smdiag Thomas Sailer HB9JNX smmixer Thomas Sailer HB9JNX ttylinkd Craig Small VK2XLZ -dmascc_cfg Klaus Kudielka +dmascc_cfg Klaus Kudielka xfhdlcchpar Thomas Sailer HB9JNX xfhdlcst Thomas Sailer HB9JNX xfsmdiag Thomas Sailer HB9JNX xfsmmixer Thomas Sailer HB9JNX -yamcfg Jean-Paul Roubelat F6FBB +yamcfg Jean-Paul Roubelat F6FBB All others Jonathon Naylor G4KLX diff --git a/ChangeLog b/ChangeLog index 7cd0baf..228416c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,7 +18,7 @@ ax25-tools (0.0.10) -- Ralf Baechle DL5RB Sat, 6 Jun 2009 17:36:01 +0100 ax25-tools (0.0.9) - * Fix for mkiss pid problem + * Fix for mkiss pid problem * Removed inline statesment in hdrvcomm.c * Added remaining missing sys/time.h * Netromd now uses PF_SOCKET @@ -36,7 +36,7 @@ ax25-tools (0.0.8) * netromd was printing raw callsigns, now use ax25_ntoa() * synced dmascc_cfg to Klauss' latest - -- Craig Small + -- Craig Small ax25-tools (0.0.7) * Fixed automake/autoconf stuff to sort out FLTK tools. @@ -59,7 +59,7 @@ ax25-tools (0.0.5) -- Craig Small Mon, 23 Aug 1999 12:41:12 +1000 ax25-tools (0.0.4) - + * Changed kissattach so that it demands an IP address * The hdlc stuff now has -i in it * mheardd.c patch for old glibc headers diff --git a/Makefile.am b/Makefile.am index 3215b0f..25f36bc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,7 +7,7 @@ SUBDIRS = ax25 hdlcutil kiss 6pack netrom rose tcpip user_call yamdrv dmascc EXTRA_DIST = pathnames.h ax25-tools.spec INCLUDES = -DAX25_SYSCONFDIR=\""$(sysconfdir)/ax25/"\" \ - -DAX25_LOCALSTATEDIR=\""$(localstatedir)/ax25/"\" + -DAX25_LOCALSTATEDIR=\""$(localstatedir)/ax25/"\" AX25_SYSCONFDIR=@sysconfdir@/ax25/ AX25_LOCALSTATEDIR=@localstatedir@/ax25/ diff --git a/README b/README index c3d95a8..4867f61 100644 --- a/README +++ b/README @@ -4,7 +4,7 @@ AX25 Tools Note that kissattch has changed its command line format slight. While the old format will work, the -i option is now, err, not optional. This was done to stop the million or so emails we get on linux-hams email list -saying why do people get axports unconfigured even after a kissattach +saying why do people get axports unconfigured even after a kissattach command. diff --git a/ax25/Makefile.am b/ax25/Makefile.am index b3d393e..327510e 100644 --- a/ax25/Makefile.am +++ b/ax25/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = axgetput +SUBDIRS = axgetput etcfiles = ax25.profile ax25d.conf axspawn.conf rxecho.conf varfiles = mheard.dat @@ -24,7 +24,7 @@ LDADD = $(AX25_LIB) axspawn_LDADD = $(AX25_LIB) $(UTIL_LIB) INCLUDES = -DAX25_SYSCONFDIR=\""$(AX25_SYSCONFDIR)"\" \ - -DAX25_LOCALSTATEDIR=\""$(AX25_LOCALSTATEDIR)"\" + -DAX25_LOCALSTATEDIR=\""$(AX25_LOCALSTATEDIR)"\" AX25_SYSCONFDIR=$(sysconfdir)/ax25/ AX25_LOCALSTATEDIR=$(localstatedir)/ax25/ diff --git a/ax25/access.c b/ax25/access.c index bf02b04..6fac554 100644 --- a/ax25/access.c +++ b/ax25/access.c @@ -214,14 +214,14 @@ void write_example_passwd(char *pwfile, char pwlocation, struct passwd *pw) { close(i); if ( ! (f = fopen(pwfile, "w")) ) return; - fprintf(f, "# %s Password file for axspawn\n", (pwlocation == SYSTEMPW ? "System" : "User")); + fprintf(f, "# %s Password file for axspawn\n", (pwlocation == SYSTEMPW ? "System" : "User")); if (pwlocation == SYSTEMPW) { fprintf(f, "# disable user self-administered passwords in $HOME/.%s\n", PWFILE); fprintf(f, "# with the line \"systempasswordonly\"\n"); fprintf(f, "# systempasswordonly\n"); } fprintf(f, "# Examples (sys and md5 passwords may differ):\n"); - fprintf(f, "# md5 standard (secure) - length: >= %d and <= %d characters\n", MINPWLEN_MD5, PASSSIZE); + fprintf(f, "# md5 standard (secure) - length: >= %d and <= %d characters\n", MINPWLEN_MD5, PASSSIZE); fprintf(f, "# %smd5:%s\n", (pwlocation == SYSTEMPW ? "username:" : ""), generate_rand_pw(MINPWLEN_MD5)); fprintf(f, "# sys/baycom standard (not very secure) - length: >= %d and <= %d characters\n", MINPWLEN_SYS, PASSSIZE); fprintf(f, "# %ssys:%s\n", (pwlocation == SYSTEMPW ? "username:" : ""), generate_rand_pw(MINPWLEN_SYS)); @@ -373,7 +373,7 @@ char *read_pwd (struct passwd *pw, int *pwtype) } } found: - + if (!pass || !*pwtype) goto end; diff --git a/ax25/ax25.4 b/ax25/ax25.4 index 6456971..f10bc06 100644 --- a/ax25/ax25.4 +++ b/ax25/ax25.4 @@ -38,7 +38,7 @@ association. a set of ioctl calls are provided to manage an association table, and in addition the superuser may use an arbitary callsign by binding to the callsign desired and specifying the port to use as a first digipeated hop. -.LP +.LP AX.25 supports the following socket options for SOL_AX25. AX25_T1 is the T1 timer in 1/10ths of a second, AX25_T2 is the T2 timer in 1/10ths of a second, AX25_T3 is the T3 timer. The window is settable with AX25_WINDOW. diff --git a/ax25/ax25d.c b/ax25/ax25d.c index 730ca49..9e20b03 100644 --- a/ax25/ax25d.c +++ b/ax25/ax25d.c @@ -71,7 +71,7 @@ * 1.6 Aug 1995 Reset the 'defaults' entry's when we start parsing * a new interface. * - * 1.7 Dec 1995 Added BROKEN_NETROM_KERNEL define for setsockopt. + * 1.7 Dec 1995 Added BROKEN_NETROM_KERNEL define for setsockopt. * * 1.8 Jan 1996 Added support for AX25_BIND_ANY_DEVICE, specify just * [CALL-X VIA *]. @@ -228,7 +228,7 @@ void err_config(void) { if (Logging) syslog(LOG_INFO, "config file reload error, continuing with original"); } -} +} /*--------------------------------------------------------------------------*/ @@ -265,7 +265,7 @@ int main(int argc, char *argv[]) char buf[1024]; char *p; char *mesg; - + while ((cnt = getopt(argc, argv, "c:lv")) != EOF) { switch (cnt) { case 'c': @@ -336,7 +336,7 @@ int main(int argc, char *argv[]) int argc; int new; int i; - + /* * Setting up a non-blocking accept() so is does not hang up * - I am not sure at this time why I didn't/don't assign @@ -358,7 +358,7 @@ int main(int argc, char *argv[]) i = FALSE; ioctl(paxl->fd, FIONBIO, &i); - + if (new < 0) { if (errno == EWOULDBLOCK) continue; /* It's gone ??? */ @@ -368,7 +368,7 @@ int main(int argc, char *argv[]) close(paxl->fd); paxl->fd = -1; reload_timer(10); - continue; + continue; } switch (paxl->af_type) { @@ -522,7 +522,7 @@ int main(int argc, char *argv[]) /* checkVC == 1: wait for data */ if (Logging && (!(paxl->flags & FLAG_NOLOGGING) || raxl->LoggingVC)) { - syslog((raxl->LoggingVC ? LOG_NOTICE : LOG_INFO), "AX.25 %s (%s:%s) AX25.IP-VC host connected. %s", + syslog((raxl->LoggingVC ? LOG_NOTICE : LOG_INFO), "AX.25 %s (%s:%s) AX25.IP-VC host connected. %s", User, Port, myAX25Name, (raxl->VCloginEnable ? "waiting for first PID=text packet for triggered login" : "discarding PID=text packets")); } @@ -533,7 +533,7 @@ int main(int argc, char *argv[]) buf[i] = 0; if (Logging && raxl->LoggingVC > 1) { /* debug */ - syslog((LOG_DEBUG), "DEBUG: AX.25 %s (%s:%s) AX25.IP-VC host said: >%s<", User, Port, myAX25Name, buf); + syslog((LOG_DEBUG), "DEBUG: AX.25 %s (%s:%s) AX25.IP-VC host said: >%s<", User, Port, myAX25Name, buf); } /* skip leading mess */ for (p = buf; *p && (isspace(*p & 0xff) || *p == '\r'); p++) ; @@ -645,7 +645,7 @@ static void SignalTERM(int code) syslog(LOG_INFO, "terminating on SIGTERM\n"); closelog(); } - + exit(0); } @@ -655,7 +655,7 @@ static void WorkoutArgs(int af_type, char *shell, int *argc, char **argv) char *sp, *cp; int cnt = 0; int args = 0; - + for (cp = shell; *cp != '\0'; cp++) { if (isspace(*cp) && cnt != 0) { buffer[cnt] = '\0'; @@ -829,7 +829,7 @@ static int ReadConfig(void) if (buffer[0] == '#') continue; - + switch (buffer[0]) { case '[': /* AX25 port call */ af_type = AF_AX25; @@ -837,7 +837,7 @@ static int ReadConfig(void) error = FALSE; iamdigi = FALSE; break; - + case '<': /* NETROM iface call */ af_type = AF_NETROM; hunt = TRUE; @@ -851,7 +851,7 @@ static int ReadConfig(void) error = FALSE; iamdigi = FALSE; break; - + default: if (hunt && !error) goto BadLine; @@ -1210,7 +1210,7 @@ ignore: goto BadArgsFree; axl_ent->flags = ParseFlags(s, line); - + if (!(axl_ent->flags & FLAG_LOCKOUT)) { /* Get username */ if ((s = strtok(NULL, " \t")) == NULL) @@ -1340,7 +1340,7 @@ static unsigned long ParseFlags(const char *kp, int line) static struct axlist *ClearList(struct axlist *list) { struct axlist *tp1, *tp2, *tmp; - + for (tp1 = list; tp1 != NULL; ) { for (tp2 = tp1->ents; tp2 != NULL; ) { if (tp2->port != NULL) @@ -1384,11 +1384,11 @@ static char *stripssid(const char *call) { static char newcall[10]; char *s; - + strcpy(newcall, call); if ((s = strchr(newcall, '-')) != NULL) *s = '\0'; - + return newcall; } diff --git a/ax25/axctl.c b/ax25/axctl.c index 2b7c034..45c742a 100644 --- a/ax25/axctl.c +++ b/ax25/axctl.c @@ -23,7 +23,7 @@ int main(int argc, char **argv) struct ax25_ctl_struct ax25_ctl; char *addr; int s; - + if (argc == 2 && strncmp(argv[1], "-v", 2) == 0) { printf("axctl: %s\n", VERSION); return 0; @@ -50,7 +50,7 @@ int main(int argc, char **argv) return 1; if (ax25_aton_entry(argv[3], (char *)&ax25_ctl.source_addr) == -1) return 1; - + if ((s = socket(AF_AX25, SOCK_SEQPACKET, 0)) < 0) { perror("axctl: socket"); return 1; @@ -65,7 +65,7 @@ int main(int argc, char **argv) return 1; } ax25_ctl.arg = atoi(argv[5]); - + if (strcmp(argv[4], "t1") == 0 || strcmp(argv[4], "-t1") == 0) ax25_ctl.cmd = AX25_T1; else if (strcmp(argv[4], "t2") == 0 || strcmp(argv[4], "-t2") == 0) @@ -83,11 +83,11 @@ int main(int argc, char **argv) } ax25_ctl.digi_count = 0; - + if (ioctl(s, SIOCAX25CTLCON, &ax25_ctl) != 0) { perror("axctl: SIOAX25CTLCON"); return 1; } - + return 0; } diff --git a/ax25/axgetput/Makefile.am b/ax25/axgetput/Makefile.am index 8eae7cc..de92dda 100644 --- a/ax25/axgetput/Makefile.am +++ b/ax25/axgetput/Makefile.am @@ -1,19 +1,19 @@ installconf: -etcfiles = -varfiles = +etcfiles = +varfiles = -sbin_PROGRAMS = +sbin_PROGRAMS = bin_PROGRAMS = axgetput -dist_man_MANS = axgetput.1 +dist_man_MANS = axgetput.1 axgetput_SOURCES = axgetput.c axgetput.h util.h proto_bin.h util.c proto_bin.c includes.h install-exec-hook: (cd $(DESTDIR)$(bindir) && ln -sf axgetput bget && ln -sf axgetput bput) -install-data-hook: +install-data-hook: (cd $(DESTDIR)$(mandir)/man1 && ln -sf axgetput.1 bget.1 && ln -sf axgetput.1 bput.1) diff --git a/ax25/axgetput/axgetput.c b/ax25/axgetput/axgetput.c index 9513a8f..1696dbf 100644 --- a/ax25/axgetput/axgetput.c +++ b/ax25/axgetput/axgetput.c @@ -223,7 +223,7 @@ int main(int argc, char *argv[]) fdin_is_pipe = (isatty(fdin) ? 0 : 1); fdout_is_pipe = (isatty(fdout) ? 0 : 1); - if (fdin_is_pipe && fdout_is_pipe) { + if (fdin_is_pipe && fdout_is_pipe) { fprintf(stderr, "error: cannot work in between two pipes\n"); exit(1); } diff --git a/ax25/axgetput/proto_bin.c b/ax25/axgetput/proto_bin.c index 004ca5e..d02249b 100644 --- a/ax25/axgetput/proto_bin.c +++ b/ax25/axgetput/proto_bin.c @@ -21,7 +21,7 @@ static int crcbit[8] = { static int init_crc(void) { int i,j; - + for (i = 0; i < 256; i++) { crctab[i] = 0; for (j = 0; j < 8; j++) { @@ -192,7 +192,7 @@ int bput(void) goto abort; } if (!len) { - save_close(fddata); + save_close(fddata); if (!term_line) { sprintf(err_msg, "error: unexpected end of file during read: %s\n", strerror(errno)); return 1; @@ -331,7 +331,7 @@ int bget(void) { file_time = statbuf.st_mtime; else file_time = time(0); - + /* compute crc */ while ((len = read(fddata, buf, BLOCKSIZ)) > 0) { int i; diff --git a/ax25/axgetput/util.c b/ax25/axgetput/util.c index 5ce6ffb..98caeeb 100644 --- a/ax25/axgetput/util.c +++ b/ax25/axgetput/util.c @@ -79,7 +79,7 @@ int my_read(int fd, char *s, int len_max, int *eof, char *p_break) return len_got; } - + /*---------------------------------------------------------------------------*/ int secure_write(int fd, char *s, int len_write) { diff --git a/ax25/axparms.8 b/ax25/axparms.8 index 9989be8..3187158 100644 --- a/ax25/axparms.8 +++ b/ax25/axparms.8 @@ -70,12 +70,12 @@ The formats of this option are: .fi .LP Routes added via this command will not be removed from the internal routing -table when they are \(lqold\(rq as normal entries are. The +table when they are \(lqold\(rq as normal entries are. The .B --ipmode option sets mode vc or mode datagram for this destination. .LP -If the argument is set to \(lqdefault\(rq then this will set the -default route for all outgoing AX.25 connections which will be used when there +If the argument is set to \(lqdefault\(rq then this will set the +default route for all outgoing AX.25 connections which will be used when there is no specific route to the required destination. .SH "--setcall Argument" .LP @@ -92,7 +92,7 @@ ax0, ax1, .., sp0, .., bpq0, ... etc.. The change is permanent as long as the interface exists, or another \(lqaxparms --setcall\(rq is issued. .LP -The interface has to exist already in order to use this option; it +The interface has to exist already in order to use this option; it may be in state UP or DOWN. .SH "--version Argument" .LP diff --git a/ax25/axparms.c b/ax25/axparms.c index daac7d4..8decf93 100644 --- a/ax25/axparms.c +++ b/ax25/axparms.c @@ -103,18 +103,18 @@ int routes(int s, int argc, char *argv[], ax25_address *callsign) perror("axparms: SIOCADDRT"); return 1; } - + ax25_opt.port_addr = *callsign; ax25_opt.dest_addr = ax25_route.dest_addr; ax25_opt.cmd = AX25_SET_RT_IPMODE; ax25_opt.arg = ip_mode; - + if (ioctl(s, SIOCAX25OPTRT, &ax25_opt) != 0) { perror("axparms: SIOCAX25OPTRT"); return 1; } } - + if (strcmp(argv[2], "del") == 0) { ax25_route.port_addr = *callsign; ax25_route.digi_count = 0; @@ -150,14 +150,14 @@ int setifcall(int s, char *ifn, char *name) { char call[7]; struct ifreq ifr; - + if (ax25_aton_entry(name, call) == -1) return 1; strcpy(ifr.ifr_name, ifn); memcpy(ifr.ifr_hwaddr.sa_data, call, 7); ifr.ifr_hwaddr.sa_family = AF_AX25; - + if (ioctl(s, SIOCSIFHWADDR, &ifr) != 0) { perror("axparms: SIOCSIFHWADDR"); return 1; @@ -174,7 +174,7 @@ int associate(int s, int argc, char *argv[]) int opt; FILE *fp; - + if (strcmp(argv[2], "show") == 0) { if (argc < 3) { usageassoc(); @@ -239,7 +239,7 @@ int associate(int s, int argc, char *argv[]) usageassoc(); exit(1); } - + if (ax25_aton_entry(argv[2], (char *)&sax25.sax25_call) == -1) { fprintf(stderr, "axparms: associate: invalid callsign %s\n", argv[2]); return 1; @@ -260,7 +260,7 @@ int associate(int s, int argc, char *argv[]) } sax25.sax25_uid = pw->pw_uid; - + if (ioctl(s, SIOCAX25ADDUID, &sax25) == -1) { perror("axparms: SIOCAX25ADDUID"); return 1; @@ -383,7 +383,7 @@ int main(int argc, char **argv) usageroute(); return 1; } - + if (strcmp(argv[2], "add") != 0 && strcmp(argv[2], "del") != 0 && strcmp(argv[2], "list") != 0) { usageroute(); return 1; @@ -393,7 +393,7 @@ int main(int argc, char **argv) usageroute(); return 1; } - + if (ax25_config_load_ports() == 0) { fprintf(stderr, "axparms: no AX.25 port data configured\n"); return 1; @@ -415,7 +415,7 @@ int main(int argc, char **argv) n = routes(s, argc, argv, &callsign); close(s); - + return n; } @@ -424,7 +424,7 @@ int main(int argc, char **argv) usagesetcall(); return 1; } - + if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { perror("axparms: socket"); return 1; diff --git a/ax25/axspawn.8 b/ax25/axspawn.8 index db34d23..672f680 100644 --- a/ax25/axspawn.8 +++ b/ax25/axspawn.8 @@ -40,7 +40,7 @@ and standards. axspawn searches in /etc/ax25/bcpasswd (first) and ~user/.bcpasswd (second) for a match of the required authentication mechanism and password. -md5 and baycom passwords may differ. md5 passwords gain over baycom passwords. +md5 and baycom passwords may differ. md5 passwords gain over baycom passwords. Note: you could "lock" special "friends" out by specifying an empty password in /etc/ax25/bcpasswd (line "n0call:md5:"). -> md5 Passwords are enforced. But @@ -48,7 +48,7 @@ the length is shorter than the minimum (len 8 for md5, len 20 for baycom); user's password file is not searched because in /etc/ax25/bcpasswd its already found.. -Syntax and caveeats for /etc/ax25/bcpasswd: +Syntax and caveeats for /etc/ax25/bcpasswd: - Has to be a regular file (no symlink). Not world-readable/writable. - Example lines: # Thomas @@ -82,7 +82,7 @@ properly. .TP 5 .B -c, --changeuser Allow connecting ax25 users to change their username for login. They'll be -asked for their real login name. +asked for their real login name. .TP 5 .B -e, --embedded Special treatment for axspawn on non-standard conform embedded devices. diff --git a/ax25/axspawn.c b/ax25/axspawn.c index e8ad0fa..31fddbc 100644 --- a/ax25/axspawn.c +++ b/ax25/axspawn.c @@ -4,18 +4,18 @@ * Copyright (c) 1996 Joerg Reuter DL1BKE (jreuter@poboxes.com) * * This program is a hack. - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * It might even kill your cat... ;-) + * It might even kill your cat... ;-) * * Status: alpha (still...) * @@ -28,19 +28,19 @@ * default * * * * * 1 root /usr/local/sbin/axspawn axspawn --wait * * The program will check if the peer is an AX.25 socket, the - * callsign is a valid amateur radio callsign, strip the SSID, + * callsign is a valid amateur radio callsign, strip the SSID, * check if UID/GID are valid, allow a password-less login if the * password-entry in /etc/passwd is "+" or empty; in every other case * login will prompt for a password. * - * Still on my TODO list: a TheNet compatible or MD5 based + * Still on my TODO list: a TheNet compatible or MD5 based * authentication scheme... Won't help you if you changed the "+"-entry - * in /etc/passwd to a valid passord and login with telnet, though. + * in /etc/passwd to a valid passord and login with telnet, though. * A better solution could be a small program called from .profile. * * Axspawn can create user accounts automatically. You may specify * the user shell, first and maximum user id, group ID in the config - * file and (unlike WAMPES) create a file "/usr/local/etc/ax25.profile" + * file and (unlike WAMPES) create a file "/usr/local/etc/ax25.profile" * which will be copied to ~/.profile. * * This is an example for the config file: @@ -126,7 +126,7 @@ * shorter than 6 characters (without SSID). There must be at least * one digit, and max. two digits within the call. The SSID must * be within the range of 0 and 15. Please drop me a note if you - * know a valid Amateur Radio (sic!) callsign that does not fit this + * know a valid Amateur Radio (sic!) callsign that does not fit this * pattern _and_ can be represented correctly in AX.25. * * It uses the forkpty from libbsd.a (found after analyzing logind) @@ -509,7 +509,7 @@ int Strncasecmp(const char *s1, const char *s2, int n) pid_t forkpty(int *, char *, void *, struct winsize *); /* The buffer in src (first byte length-1) is decoded into dest - (first byte length-1). If decoding is not successful, non-0 + (first byte length-1). If decoding is not successful, non-0 is returned */ @@ -522,7 +522,7 @@ int encstathuf(char *src, int srclen, char *dest, int *destlen) int bit8; unsigned short huffcode; int hufflen; - + if ((src == NULL) || (dest == NULL)) { syslog(LOG_NOTICE, "Huffman encode: src or dest NULL!"); return(1); @@ -574,7 +574,7 @@ int encstathuf(char *src, int srclen, char *dest, int *destlen) } /* The buffer in src (first byte length-1) is decoded into dest - (first byte length-1). If decoding is not successful, non-0 + (first byte length-1). If decoding is not successful, non-0 is returned */ @@ -679,11 +679,11 @@ int read_ax25(unsigned char *s, int size) if (bin) { return(len); } - + for (k = 0; k < len; k++) if (s[k] == '\r') s[k] = '\n'; - + if (!huffman && !Strncasecmp(s, "//COMP ON\n", 10)) { sprintf(buffer,"\r//COMP 1\r"); @@ -746,7 +746,7 @@ void kick_wqueue(int dummy) int bufsize = (huffman ? 256-1 : paclen); char decoded[260]; int declen; - + signal(SIGALRM, SIG_IGN); itv.it_value.tv_sec = 0; itv.it_value.tv_usec = QUEUE_DELAY; @@ -767,7 +767,7 @@ void kick_wqueue(int dummy) } p = s; s_len = 0; - + while ((w_buf = wqueue_head)) { curr_len = (w_buf->len > bufsize-s_len ? bufsize-s_len : w_buf->len); memcpy(p, w_buf->data, curr_len); @@ -821,7 +821,7 @@ void kick_wqueue(int dummy) wqueue_head = w_buf->next; free(w_buf->data); free(w_buf); - + if (!wqueue_head) { wqueue_tail = NULL; return; @@ -833,7 +833,7 @@ void kick_wqueue(int dummy) * new data is available in order to send "full packets" */ if (wqueue_length < paclen) - break; + break; } itv.it_interval.tv_sec = 0; @@ -855,7 +855,7 @@ int write_ax25(char *s, int len, int kick) int i = 0; int j = 0; char *p; - + if (!len) return 0; signal(SIGALRM, SIG_IGN); @@ -888,7 +888,7 @@ int write_ax25(char *s, int len, int kick) tcsetattr(0, TCSANOW, &save_termios); last_ended_with_CR = 0; return 0; - } + } if (!bin) { @@ -915,7 +915,7 @@ int write_ax25(char *s, int len, int kick) } else *(p + i) = *(p + j); - i++; j++; + i++; j++; } len = i; if (len && s[len-1] == '\r') @@ -935,8 +935,8 @@ int write_ax25(char *s, int len, int kick) memcpy(buf->data, s, len); buf->len = len; - buf->next = NULL; - + buf->next = NULL; + if (wqueue_head == NULL) { wqueue_head = buf; @@ -947,7 +947,7 @@ int write_ax25(char *s, int len, int kick) wqueue_tail = buf; wqueue_length += len; } - + if (wqueue_length > 7*paclen || kick || bin) { kick_wqueue(0); @@ -967,12 +967,12 @@ int get_assoc(struct sockaddr_ax25 *sax25) FILE *fp; int uid; char buf[81]; - + fp = fopen(PROC_AX25_CALLS_FILE, "r"); if (!fp) return -1; - + fgets(buf, sizeof(buf)-1, fp); - + while(!feof(fp)) { if (fscanf(fp, "%d %s", &uid, buf) == 2) @@ -984,7 +984,7 @@ int get_assoc(struct sockaddr_ax25 *sax25) } } fclose(fp); - + return -1; } @@ -1020,7 +1020,7 @@ void cleanup(char *tty) } -/* +/* * add a new user to /etc/passwd and do some init */ @@ -1040,7 +1040,7 @@ void new_user(char *newuser) struct stat fst; int fd_a, fd_b, fd_l; mode_t homedir_mode = S_IRUSR|S_IWUSR|S_IXUSR|S_IXOTH|(secure_home ? 0 : (S_IRGRP|S_IXGRP)); - + /* * build path for home directory */ @@ -1072,9 +1072,9 @@ retry: /* * build directories for home */ - + p = homedir; - + while (*p == '/') p++; chdir("/"); @@ -1117,12 +1117,12 @@ retry: { chown(p, uid, user_gid); chmod(p, homedir_mode); - } + } } else goto out; } - + if (chdir(p) < 0) goto out; p = q; @@ -1157,7 +1157,7 @@ end_mkdirs: fp = fopen(PASSWDFILE, "a+"); if (fp == NULL) goto out; - + pw.pw_name = newuser; pw.pw_passwd = ((policy_add_empty_password) ? "" : "+"); pw.pw_uid = uid; @@ -1165,12 +1165,12 @@ end_mkdirs: pw.pw_gecos = username; pw.pw_dir = userdir; pw.pw_shell = user_shell; - + if (getpwuid(uid) != NULL) goto retry; /* oops?! */ if (putpwent(&pw, fp) < 0) goto out; - + fclose(fp); } @@ -1179,7 +1179,7 @@ end_mkdirs: */ fd_a = open(CONF_AXSPAWN_PROF_FILE, O_RDONLY); - + if (fd_a > 0) { int first = 1; @@ -1187,7 +1187,7 @@ end_mkdirs: if (fd_b < 0) goto out; - + /* just 2b sure */ if (lseek(fd_b, 0L, SEEK_END) > 0L) write(fd_b, "\n", 1); @@ -1222,16 +1222,16 @@ void read_config(void) char buf[512]; char cmd[40], param[80]; char *p; - + if (fp == NULL) return; - + while (!feof(fp)) { fgets(buf, sizeof(buf), fp); p = strchr(buf, '#'); if (p) *p='\0'; - + if (buf[0] != '\0') { sscanf(buf, "%s %s", cmd, param); @@ -1297,12 +1297,12 @@ void read_config(void) } else if (!strncmp(cmd, "secure_home", 11)) { secure_home = (param[0] == 'y'); - } else + } else if (!strncmp(cmd, "assoc", 5)) { if (!strcmp(param, "yes")) policy_associate = 1; - else + else policy_associate = 0; } else if (!strncmp(cmd, "shell", 5)) @@ -1315,7 +1315,7 @@ void read_config(void) } } } - + fclose(fp); } @@ -1328,7 +1328,7 @@ void signal_handler(int dummy) cleanup(ptyslave+5); exit(1); } - + int main(int argc, char **argv) { char call[20], user[20], as_user[20]; @@ -1400,7 +1400,7 @@ int main(int argc, char **argv) } } strupr(prompt); - + openlog("axspawn", LOG_PID, LOG_DAEMON); if (getuid() != 0) { @@ -1411,7 +1411,7 @@ int main(int argc, char **argv) addrlen = sizeof(struct full_sockaddr_ax25); k = getpeername(0, (struct sockaddr *) &sockaddr, &addrlen); - + if (k < 0) { syslog(LOG_NOTICE, "getpeername: %m\n"); return 1; @@ -1457,7 +1457,7 @@ int main(int argc, char **argv) { ssid *= 10; ssid += (int) (call[k] - '0'); - + if (ssid > 15) invalid++; } ssidcnt++; @@ -1481,7 +1481,7 @@ int main(int argc, char **argv) else invalid++; } - + if ( invalid || (k < MINLEN) || (digits > 2) || (digits < 1) ) { write_ax25_static_line(MSG_NOCALL); @@ -1489,7 +1489,7 @@ int main(int argc, char **argv) sleep(EXITDELAY); return 1; } - + if (wait_for_tcp) { /* incoming TCP/IP connection? */ if (read_ax25(buf, sizeof(buf)) < 0) @@ -1522,7 +1522,7 @@ int main(int argc, char **argv) user_changed = 1; } } - + if (!*as_user) strcpy(as_user, user); pw = getpwnam(as_user); @@ -1536,13 +1536,13 @@ int main(int argc, char **argv) return 1; } - if (policy_add_user) + if (policy_add_user) { new_user(as_user); pw = getpwnam(as_user); endpwent(); } - + if (pw == NULL && policy_guest) { strcpy(as_user,guest); @@ -1557,7 +1557,7 @@ int main(int argc, char **argv) sleep(EXITDELAY); return 1; } - + if (!rootlogin && (pw->pw_uid == 0 || pw->pw_gid == 0)) { write_ax25_static_line(MSG_NOCALL); @@ -1565,7 +1565,7 @@ int main(int argc, char **argv) sleep(EXITDELAY); return 1; } - + again: if (!(pwd = read_pwd(pw, &pwtype))) { if ((!pwtype || pwtype != PW_CLEARTEXT) && (pwtype != PW_UNIX)) { @@ -1649,18 +1649,18 @@ again: close(fds); } } - + fcntl(1, F_SETFL, O_NONBLOCK); - + pid = forkpty(&fdmaster, ptyslave, NULL, &win); - + if (pid == 0) { struct termios termios; char *shell = "/bin/sh"; memset((char *) &termios, 0, sizeof(termios)); - + ioctl(0, TIOCSCTTY, (char *) 0); termios.c_iflag = ICRNL | IXOFF; @@ -1686,7 +1686,7 @@ again: gettimeofday(&tv, NULL); ut_line.ut_tv.tv_sec = tv.tv_sec; ut_line.ut_tv.tv_usec = tv.tv_usec; - ut_line.ut_addr = 0; + ut_line.ut_addr = 0; pututline(&ut_line); endutent(); @@ -1731,7 +1731,7 @@ again: if (p[1]) { if ((p = strdup(p))) *p = '-'; - + } else p = 0; } if (!p) @@ -1773,7 +1773,7 @@ again: */ chargv[chargc++] = "-h"; chargv[chargc++] = protocol; - if (pwtype != PW_CLEARTEXT /* PW_SYS or PW_MD5 are already authenticated */ + if (pwtype != PW_CLEARTEXT /* PW_SYS or PW_MD5 are already authenticated */ || pwcheck == 2 || (pwcheck == 3 && (pw->pw_gid == user_gid || is_guest)) || !strcmp(pw->pw_passwd, "+")) chargv[chargc++] = "-f"; chargv[chargc++] = as_user; @@ -1816,7 +1816,7 @@ again: signal(SIGTERM, signal_handler); signal(SIGINT, signal_handler); signal(SIGQUIT, signal_handler); - + while(1) { FD_ZERO(&fds_read); @@ -1826,9 +1826,9 @@ again: if (wqueue_length <= paclen*7) FD_SET(fdmaster, &fds_read); FD_SET(fdmaster, &fds_err); - + k = select(fdmaster+1, &fds_read, NULL, &fds_err, NULL); - + if (k > 0) { if (FD_ISSET(0, &fds_err)) @@ -1842,9 +1842,9 @@ again: cleanup(ptyslave+5); return 1; } - + if (FD_ISSET(fdmaster, &fds_err)) - { + { /* give the last packet in the timer controlled sendqueue a chance.. */ if (wqueue_length) { continue; @@ -1869,7 +1869,7 @@ again: } else write(fdmaster, buf, cnt); } - + if (FD_ISSET(fdmaster, &fds_read)) { cnt = read(fdmaster, buf, (huffman ? 254 : sizeof(buf))); @@ -1889,7 +1889,7 @@ again: } write_ax25(buf, cnt, 0); } - } else + } else if (k < 0 && errno != EINTR) { if (huffman) { @@ -1903,7 +1903,7 @@ again: return 0; } } - } + } else { write_ax25_static_line(MSG_CANNOTFORK); @@ -1911,7 +1911,7 @@ again: sleep(EXITDELAY); return 1; } - + sleep(EXITDELAY); return 0; diff --git a/ax25/beacon.c b/ax25/beacon.c index 095614f..26d1998 100644 --- a/ax25/beacon.c +++ b/ax25/beacon.c @@ -26,7 +26,7 @@ static void terminate(int sig) syslog(LOG_INFO, "terminating on SIGTERM\n"); closelog(); } - + exit(0); } @@ -37,7 +37,7 @@ int main(int argc, char *argv[]) int s, n, dlen, len, interval = 30; char *addr, *port, *message, *portcall; char *srccall = NULL, *destcall = NULL; - + while ((n = getopt(argc, argv, "c:d:lmst:v")) != -1) { switch (n) { case 'c': @@ -81,7 +81,7 @@ int main(int argc, char *argv[]) port = argv[optind]; message = argv[optind + 1]; - + if (ax25_config_load_ports() == 0) { fprintf(stderr, "beacon: no AX.25 ports defined\n"); return 1; @@ -151,7 +151,7 @@ int main(int argc, char *argv[]) } return 1; } - + if (sendto(s, message, strlen(message), 0, (struct sockaddr *)&dest, dlen) == -1) { if (logging) { syslog(LOG_ERR, "sendto: %m"); diff --git a/ax25/bpqparms.c b/ax25/bpqparms.c index f8e9d66..c5e12ad 100644 --- a/ax25/bpqparms.c +++ b/ax25/bpqparms.c @@ -1,19 +1,19 @@ -/* +/* bpqparms.c Copyright 1996, by Joerg Reuter jreuter@poboxes.com - This program is free software; you can redistribute it and/or modify - it under the terms of the (modified) GNU General Public License + This program is free software; you can redistribute it and/or modify + it under the terms of the (modified) GNU General Public License delivered with the LinuX kernel source. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should find a copy of the GNU General Public License in - /usr/src/linux/COPYING; + You should find a copy of the GNU General Public License in + /usr/src/linux/COPYING; */ @@ -54,9 +54,9 @@ int get_hwaddr(unsigned char *k, char *s) if (strcmp(s, "default") == 0 || strcmp(s, "broadcast") == 0) { memcpy(k, broadcast, ETH_ALEN); } else { - n = sscanf(s, "%x:%x:%x:%x:%x:%x", + n = sscanf(s, "%x:%x:%x:%x:%x:%x", ð[0], ð[1], ð[2], ð[3], ð[4], ð[5]); - + if (n < 6) return 1; @@ -86,7 +86,7 @@ int main(int argc, char **argv) return 1; } break; - + case 'a': flag |= 2; if (get_hwaddr(addr.accept, optarg)) { @@ -117,26 +117,26 @@ int main(int argc, char **argv) usage(); } } - + if (!(flag & 0x01) || optind+1 > argc) usage(); - + strcpy(dev, argv[optind]); if ((flag & 0x02) == 0) memcpy(addr.accept, addr.destination, ETH_ALEN); fd = socket(AF_INET, SOCK_DGRAM, 0); - + strcpy(ifr.ifr_name, dev); ifr.ifr_data = (caddr_t) &addr; - + if (ioctl(fd, SIOCSBPQETHADDR, &ifr) < 0) { perror("bpqparms SIOCSBPQETHADDR"); close(fd); return 1; } - + close(fd); return 0; diff --git a/ax25/mheard.c b/ax25/mheard.c index 5aeacf4..a7b46cf 100644 --- a/ax25/mheard.c +++ b/ax25/mheard.c @@ -286,7 +286,7 @@ static void SortByFrame(void) p = n; } } - + int main(int argc, char *argv[]) { int headers = TRUE; @@ -346,7 +346,7 @@ int main(int argc, char *argv[]) return 1; } } - + LoadPortData(); switch (mode) { diff --git a/ax25/mheardd.8 b/ax25/mheardd.8 index c0dd200..be4a121 100644 --- a/ax25/mheardd.8 +++ b/ax25/mheardd.8 @@ -29,7 +29,7 @@ Sets the number of entries in the activity list file, the default is 100. The minimum value allowed is 10 and the maximum is 1000. .TP 10 .BI "\-p [!]port1[,port2,..]" -With -p, you instruct mheardd to only listen on specified ax25 ports. +With -p, you instruct mheardd to only listen on specified ax25 ports. You may give more ports, seperated by ','. If you introduce the port(s) by a leading '!', then mheardd will listen on all ports except those you specified. diff --git a/ax25/mheardd.c b/ax25/mheardd.c index 79acd79..40eab3b 100644 --- a/ax25/mheardd.c +++ b/ax25/mheardd.c @@ -187,7 +187,7 @@ int main(int argc, char **argv) position = ftell(fp); s++; } - + fclose(fp); } else { if ((fp = fopen(DATA_MHEARD_FILE, "w")) != NULL) @@ -198,7 +198,7 @@ int main(int argc, char **argv) perror("mheardd: socket"); return 1; } - + if (!daemon_start(FALSE)) { fprintf(stderr, "mheardd: cannot become a daemon\n"); return 1; @@ -220,7 +220,7 @@ int main(int argc, char **argv) } return 1; } - + if ((port = ax25_config_get_name(sa.sa_data)) == NULL) { if (logging) syslog(LOG_WARNING, "unknown port '%s'\n", sa.sa_data); @@ -276,9 +276,9 @@ int main(int argc, char **argv) while (!end) { memcpy(&mheard->entry.digis[mheard->entry.ndigis], data, sizeof(ax25_address)); mheard->entry.ndigis++; - + end = (data[ALEN] & HDLCAEB); - + data += AXLEN; size -= AXLEN; } @@ -387,10 +387,10 @@ int main(int argc, char **argv) break; } } - + if (mheard->entry.first_heard == 0) time(&mheard->entry.first_heard); - + time(&mheard->entry.last_heard); if ((fp = fopen(DATA_MHEARD_FILE, "r+")) == NULL) { @@ -398,16 +398,16 @@ int main(int argc, char **argv) syslog(LOG_ERR, "cannot open mheard data file\n"); continue; } - + if (mheard->position == 0xFFFFFF) { fseek(fp, 0L, SEEK_END); mheard->position = ftell(fp); } fseek(fp, mheard->position, SEEK_SET); - + fwrite(&mheard->entry, sizeof(struct mheard_struct), 1, fp); - + fclose(fp); } } @@ -445,7 +445,7 @@ static struct mheard_list_struct *findentry(ax25_address *callsign, char *port) { struct mheard_list_struct *oldest = NULL; int i; - + for (i = 0; i < mheard_list_size; i++) if (mheard_list[i].in_use && ax25_cmp(&mheard_list[i].entry.from_call, callsign) == 0 && diff --git a/ax25/rxecho.c b/ax25/rxecho.c index 7acb156..e9c7daa 100644 --- a/ax25/rxecho.c +++ b/ax25/rxecho.c @@ -136,7 +136,7 @@ static void terminate(int sig) syslog(LOG_INFO, "terminating on SIGTERM\n"); closelog(); } - + exit(0); } @@ -238,7 +238,7 @@ static struct config *readconfig(void) } /* - * Slightly modified from linux/include/net/ax25.h and + * Slightly modified from linux/include/net/ax25.h and * linux/net/ax25/ax25_subr.c: */ @@ -264,13 +264,13 @@ typedef struct { static unsigned char *ax25_parse_addr(unsigned char *buf, int len, ax25_address *src, ax25_address *dest, ax25_digi *digi) { int d = 0; - + if (len < 14) return NULL; - + #if 0 if (flags != NULL) { *flags = 0; - + if (buf[6] & LAPB_C) { *flags = C_COMMAND; } @@ -279,16 +279,16 @@ static unsigned char *ax25_parse_addr(unsigned char *buf, int len, ax25_address *flags = C_RESPONSE; } } - - if (dama != NULL) + + if (dama != NULL) *dama = ~buf[13] & DAMA_FLAG; #endif - + /* Copy to, from */ - if (dest != NULL) + if (dest != NULL) memcpy(dest, buf + 0, AX25_ADDR_LEN); - if (src != NULL) + if (src != NULL) memcpy(src, buf + 7, AX25_ADDR_LEN); buf += 2 * AX25_ADDR_LEN; @@ -296,7 +296,7 @@ static unsigned char *ax25_parse_addr(unsigned char *buf, int len, ax25_address digi->lastrepeat = -1; digi->ndigi = 0; - + while (!(buf[-1] & LAPB_E)) { if (d >= AX25_MAX_DIGIS) return NULL; /* Max of 6 digis */ if (len < 7) return NULL; /* Short packet */ diff --git a/dmascc/dmascc_cfg.1 b/dmascc/dmascc_cfg.1 index f5884ea..659c76f 100644 --- a/dmascc/dmascc_cfg.1 +++ b/dmascc/dmascc_cfg.1 @@ -14,10 +14,10 @@ used by root. .BI "\-\-speed "\fIfrequency\fR Set frequency of baud rate generator to \fIfrequency\fR. A value of 0 disables the baud rate generator and the digital PLL. Use the \fB\-\-show\fR -option to check whether the frequency you selected could be approximated +option to check whether the frequency you selected could be approximated with sufficient accuracy. .TP 10 -.BI "\-\-nrzi "\fR[\fI0\fR|\fI1\fR] +.BI "\-\-nrzi "\fR[\fI0\fR|\fI1\fR] \fI0\fR selects NRZ mode, \fI1\fR selects NRZI mode. .TP 10 .BI "\-\-clocks "\fIinteger\fR @@ -82,7 +82,7 @@ Set the minimum time between the transmitter turning off to when it turns on to \fImilliseconds\fR. Maximum wait time is 2500 ms. .TP 10 .BI "\-\-persist "\fIf\fR -Set the persistance parameter to \fIf\fR. Must be between 0 and 255 +Set the persistance parameter to \fIf\fR. Must be between 0 and 255 (inclusive). .TP 10 .BI "\-\-dma "\fIchannel\fR diff --git a/hdlcutil/Makefile.am b/hdlcutil/Makefile.am index 24c25af..fd94b2a 100644 --- a/hdlcutil/Makefile.am +++ b/hdlcutil/Makefile.am @@ -14,7 +14,7 @@ smdiag_SOURCES = smdiag.c hdrvcomm.c hdrvcomm.h usersmdiag.h soundmodem.h smdiag_LDADD = $(X_LIBS) -lX11 $(X_EXTRA_LIBS) INCLUDES = -DAX25_SYSCONFDIR=\""$(AX25_SYSCONFDIR)"\" \ - -DAX25_LOCALSTATEDIR=\""$(AX25_LOCALSTATEDIR)"\" + -DAX25_LOCALSTATEDIR=\""$(AX25_LOCALSTATEDIR)"\" AX25_SYSCONFDIR=$(sysconfdir)/ax25/ AX25_LOCALSTATEDIR=$(localstatedir)/ax25/ diff --git a/hdlcutil/baycom.9 b/hdlcutil/baycom.9 index ad87253..893a20d 100644 --- a/hdlcutil/baycom.9 +++ b/hdlcutil/baycom.9 @@ -17,10 +17,10 @@ par97. .SS ser12 This is a very simple 1200 baud AFSK modem. The modem consists only of a modulator/demodulator chip, usually a TI TCM3105. The computer -is responsible for regenerating the receiver bit clock. The modem +is responsible for regenerating the receiver bit clock. The modem connects to a serial port, hence the name. Since the serial port is not used as an async serial port, the kernel driver for serial ports -cannot be used, and this driver only supports standard serial +cannot be used, and this driver only supports standard serial hardware (8250, 16450, 16550). .SS par96 This is a modem for 9600 baud FSK compatible to the G3RUH standard. @@ -40,7 +40,7 @@ The \fBioctl\fP calls follow the implementation in the \fIhdlcdrv\fP. .TP .B BAYCOMCTL_GETMODEMTYPE -returns the modem type (i.e. \fIser12\fP or \fIpar96\fP) and the +returns the modem type (i.e. \fIser12\fP or \fIpar96\fP) and the options in effect (currently only the source of the DCD signal) .TP .B BAYCOMCTL_SETMODEMTYPE diff --git a/hdlcutil/fl/xfhdlcchpar_main.cxx b/hdlcutil/fl/xfhdlcchpar_main.cxx index 8ebee3d..7078d36 100644 --- a/hdlcutil/fl/xfhdlcchpar_main.cxx +++ b/hdlcutil/fl/xfhdlcchpar_main.cxx @@ -58,7 +58,7 @@ void cb_update(Fl_Widget *widget, void *udata) cp.ppersist = (int)(ppersist->value()); cp.fulldup = !!fulldup->value(); ret = hdrvc_set_channel_access_param(cp); - if (ret < 0) + if (ret < 0) perror("hdrvc_set_channel_access_param"); } @@ -71,7 +71,7 @@ void cb_quit(Fl_Button *, long) /* ---------------------------------------------------------------------- */ -static const char *usage_str = +static const char *usage_str = "[-i smif]\n" " -i: specify the name of the baycom kernel driver interface\n\n"; diff --git a/hdlcutil/fl/xfhdlcst_main.cxx b/hdlcutil/fl/xfhdlcst_main.cxx index a17e546..4542fe1 100644 --- a/hdlcutil/fl/xfhdlcst_main.cxx +++ b/hdlcutil/fl/xfhdlcst_main.cxx @@ -62,7 +62,7 @@ void cb_timer(void *) /* ---------------------------------------------------------------------- */ -static const char *usage_str = +static const char *usage_str = "[-i smif]\n" " -i: specify the name of the baycom kernel driver interface\n\n"; @@ -112,13 +112,13 @@ int main(int argc, char *argv[]) if (ret < 0) { perror("hdrvc_get_mode_name"); modename->hide(); - } else + } else modename->value(name); ret = hdrvc_get_driver_name(name, sizeof(name)); if (ret < 0) { perror("hdrvc_get_driver_name"); drivername->hide(); - } else + } else drivername->value(name); /* * check for soundmodem driver @@ -171,7 +171,7 @@ int main(int argc, char *argv[]) demodcyc->value(buf); sprintf(buf, "%d", smi.data.dbg.dma_residue); dmares->value(buf); - } + } } exit (0); } diff --git a/hdlcutil/fl/xfsmdiag_main.cxx b/hdlcutil/fl/xfsmdiag_main.cxx index 695d98f..1fd0dd8 100644 --- a/hdlcutil/fl/xfsmdiag_main.cxx +++ b/hdlcutil/fl/xfsmdiag_main.cxx @@ -58,7 +58,7 @@ static unsigned int drawflags = 0; /* ---------------------------------------------------------------------- */ scope::scope(int x, int y, int w, int h, const char *l) - : Fl_Box(x, y, w, h, l) + : Fl_Box(x, y, w, h, l) { box(FL_DOWN_FRAME); X = x+3; @@ -205,8 +205,8 @@ void scope::drawdata(short data[], int len, int xm) XGCValues gcv; mode(); - if (!pixmalloc || (drawmode != HDRVC_DIAGMODE_CONSTELLATION && - drawmode != HDRVC_DIAGMODE_INPUT && + if (!pixmalloc || (drawmode != HDRVC_DIAGMODE_CONSTELLATION && + drawmode != HDRVC_DIAGMODE_INPUT && drawmode != HDRVC_DIAGMODE_DEMOD)) return; gcv.line_width = 1; @@ -268,7 +268,7 @@ void cb_mode(Fl_Check_Button *, long which) case 256: drawflags ^= HDRVC_DIAGFLAG_DCDGATE; break; - + case 0: scdisp->mode(HDRVC_DIAGMODE_OFF); drawflags = 0; @@ -298,7 +298,7 @@ void cb_quit(Fl_Button *, long) { struct sm_diag_data diag; short data; - + diag.mode = HDRVC_DIAGMODE_OFF; diag.flags = 0; diag.datalen = 1; @@ -330,7 +330,7 @@ void cb_timer(void *) /* * draw scope */ - if ((ret = hdrvc_diag2(scdisp->mode(), drawflags, data, sizeof(data) / sizeof(short), + if ((ret = hdrvc_diag2(scdisp->mode(), drawflags, data, sizeof(data) / sizeof(short), &samplesperbit)) < 0) { perror("hdrvc_diag2"); exit(1); @@ -341,7 +341,7 @@ void cb_timer(void *) /* ---------------------------------------------------------------------- */ -static const char *usage_str = +static const char *usage_str = "[-i smif]\n" " -i: specify the name of the baycom kernel driver interface\n\n"; @@ -396,13 +396,13 @@ int main(int argc, char *argv[]) if (ret < 0) { perror("hdrvc_get_mode_name"); modename->hide(); - } else + } else modename->value(name); ret = hdrvc_get_driver_name(name, sizeof(name)); if (ret < 0) { perror("hdrvc_get_driver_name"); drivername->hide(); - } else + } else drivername->value(name); Fl::add_timeout(0.1, cb_timer); scopewindow->show(); diff --git a/hdlcutil/fl/xfsmmixer_main.cxx b/hdlcutil/fl/xfsmmixer_main.cxx index 5569e7c..83774a0 100644 --- a/hdlcutil/fl/xfsmmixer_main.cxx +++ b/hdlcutil/fl/xfsmmixer_main.cxx @@ -52,7 +52,7 @@ static int do_mix_ioctl(int cmd, struct sm_mixer_data *mixdat) { struct sm_ioctl par; int i; - + par.cmd = cmd; par.data.mix = *mixdat; i = hdrvc_sm_ioctl(cmd, &par); @@ -120,7 +120,7 @@ void update_ad1848(Fl_Widget *widget, void *udata) mdata |= 0x20; } mval *= 0.666666; - if (mval > 15) + if (mval > 15) mval = 15; mdata |= (int)mval; set_mixer_reg(0x00, mdata); @@ -139,7 +139,7 @@ void update_ad1848(Fl_Widget *widget, void *udata) mdata |= 0x20; } mval *= 0.666666; - if (mval > 15) + if (mval > 15) mval = 15; mdata |= (int)mval; set_mixer_reg(0x01, mdata); @@ -150,12 +150,12 @@ void update_ad1848(Fl_Widget *widget, void *udata) mval = ad1848_outl->value(); if (mval < -95) set_mixer_reg(0x06, 0x80); - else + else set_mixer_reg(0x06, (unsigned char)(mval * (-0.66666666))); mval = ad1848_outr->value(); if (mval < -95) set_mixer_reg(0x07, 0x80); - else + else set_mixer_reg(0x07, (unsigned char)(mval * (-0.66666666))); set_mixer_reg(0x0d, 0x00); } @@ -272,7 +272,7 @@ void update_ct1745(Fl_Widget *widget, void *udata) if (ct1745_srcl_midil->value()) mdata |= 0x40; if (ct1745_srcl_midir->value()) - mdata |= 0x20; + mdata |= 0x20; set_mixer_reg(0x3d, mdata); /* input sources left */ mdata = 0; if (ct1745_srcr_mic->value()) @@ -288,7 +288,7 @@ void update_ct1745(Fl_Widget *widget, void *udata) if (ct1745_srcr_midil->value()) mdata |= 0x40; if (ct1745_srcr_midir->value()) - mdata |= 0x20; + mdata |= 0x20; set_mixer_reg(0x3e, mdata); /* input sources right*/ } @@ -301,7 +301,7 @@ void cb_quit(Fl_Button *, long) /* ---------------------------------------------------------------------- */ -static const char *usage_str = +static const char *usage_str = "[-i smif]\n" " -i: specify the name of the soundmodem kernel driver interface\n\n"; @@ -312,7 +312,7 @@ int main(int argc, char *argv[]) int c, i; struct sm_mixer_data mixdat; unsigned char mdata; - + progname = *argv; printf("%s: Version 0.3; (C) 1996,1997,2000 by Thomas Sailer HB9JNX/AE4WA\n", progname); hdrvc_args(&argc, argv, "sm0"); @@ -352,7 +352,7 @@ int main(int argc, char *argv[]) case SM_MIXER_AD1848: case SM_MIXER_CRYSTAL: - printf("Mixer device: %s\n", mixdevice == SM_MIXER_CRYSTAL ? + printf("Mixer device: %s\n", mixdevice == SM_MIXER_CRYSTAL ? "CS423x" : "AD1848"); create_form_ad1848(); mdata = get_mixer_reg(0); diff --git a/hdlcutil/hdlcdrv.9 b/hdlcutil/hdlcdrv.9 index 6ec7be2..31b0e7e 100644 --- a/hdlcutil/hdlcdrv.9 +++ b/hdlcutil/hdlcdrv.9 @@ -33,8 +33,8 @@ hdlcdrv \- HDLC amateur (AX.25) packet radio network driver .SH DESCRIPTION This driver should ease the implementation of simple AX.25 packet radio modems where the software is responsible for the HDLC encoding and decoding. -Examples of such modems include the \fIbaycom\fP family and the -\fIsoundcard\fP modems. +Examples of such modems include the \fIbaycom\fP family and the +\fIsoundcard\fP modems. This driver provides a standard Linux network driver interface. It can even be compiled if Kernel AX.25 is not enabled in the Linux @@ -140,7 +140,7 @@ which then gets invoked by the hardware. \fBifconfig\ \fP\fIifname\fP\fB\ down\fP and should undo all actions done by \fBopen\fP, i.e. release io regions and irqs. -\fBioctl\fP may be provided to implement device specific ioctl's. +\fBioctl\fP may be provided to implement device specific ioctl's. .SH "IOCTL CALLS" diff --git a/hdlcutil/hdrvcomm.c b/hdlcutil/hdrvcomm.c index 6b4335e..9f387ee 100644 --- a/hdlcutil/hdrvcomm.c +++ b/hdlcutil/hdrvcomm.c @@ -130,7 +130,7 @@ int hdrvc_recvpacket(char *pkt, int maxlen) } } else { struct sockaddr sa; - + strcpy(sa.sa_data, if_name); sa.sa_family = AF_INET; if (bind(fd, &sa, sizeof(sa)) < 0) { @@ -196,7 +196,7 @@ void hdrvc_args(int *argc, char *argv[], const char *def_if) if (i < ac) memmove(argv+i, argv+i+2, (ac-i) * sizeof(void *)); i--; - } else + } else #endif /* HDRVC_KERNEL */ if (!strcmp(argv[i], "-u")) { #ifdef HDRVC_KERNEL @@ -229,24 +229,24 @@ void hdrvc_init(void) close(fd); afpacket = 0; if ((fd = socket(PF_INET, SOCK_PACKET, htons(ETH_P_AX25))) < 0) { - fprintf(stderr, "%s: Error %s (%i), cannot open %s\n", prg_name, + fprintf(stderr, "%s: Error %s (%i), cannot open %s\n", prg_name, strerror(errno), errno, if_name); exit(-1); } if (ioctl(fd, SIOCGIFFLAGS, &ifr_h) < 0) { - fprintf(stderr, "%s: Error %s (%i), cannot ioctl SIOCGIFFLAGS %s\n", prg_name, + fprintf(stderr, "%s: Error %s (%i), cannot ioctl SIOCGIFFLAGS %s\n", prg_name, strerror(errno), errno, if_name); exit(-1); } } strcpy(ifr.ifr_name, if_name); if (ioctl(fd, SIOCGIFHWADDR, &ifr) < 0 ) { - fprintf(stderr, "%s: Error %s (%i), cannot ioctl SIOCGIFHWADDR %s\n", prg_name, + fprintf(stderr, "%s: Error %s (%i), cannot ioctl SIOCGIFHWADDR %s\n", prg_name, strerror(errno), errno, if_name); exit(-1); } if (ifr.ifr_hwaddr.sa_family != ARPHRD_AX25) { - fprintf(stderr, "%s: Error, interface %s not AX25 (%i)\n", prg_name, + fprintf(stderr, "%s: Error, interface %s not AX25 (%i)\n", prg_name, if_name, ifr.ifr_hwaddr.sa_family); exit(-1); } @@ -255,12 +255,12 @@ void hdrvc_init(void) #endif /* HDRVC_KERNEL */ k = ftok(if_name, USERSM_KEY_PROJ); if (k == (key_t)-1) { - fprintf(stderr, "%s: Error %s (%i), cannot ftok on %s\n", prg_name, + fprintf(stderr, "%s: Error %s (%i), cannot ftok on %s\n", prg_name, strerror(errno), errno, if_name); exit(-1); } if ((msqid = msgget(k, 0700)) < 0) { - fprintf(stderr, "%s: Error %s (%i), cannot msgget %d\n", prg_name, + fprintf(stderr, "%s: Error %s (%i), cannot msgget %d\n", prg_name, strerror(errno), errno, k); exit(-1); } @@ -276,7 +276,7 @@ void hdrvc_sendmsg(struct usersmmsg *msg, int len) } } -int hdrvc_recvmsg(struct usersmmsg *msg, int maxlen, long type) +int hdrvc_recvmsg(struct usersmmsg *msg, int maxlen, long type) { int len; @@ -286,15 +286,15 @@ int hdrvc_recvmsg(struct usersmmsg *msg, int maxlen, long type) } #if 0 for (;;) { - if ((len = msgrcv(msqid, (struct msgbuf *)msg, maxlen-sizeof(long), type, IPC_NOWAIT|MSG_NOERROR)) >= 0) + if ((len = msgrcv(msqid, (struct msgbuf *)msg, maxlen-sizeof(long), type, IPC_NOWAIT|MSG_NOERROR)) >= 0) return len+sizeof(long); - if (errno != ENOMSG) { + if (errno != ENOMSG) { perror("msgrcv"); exit(1); } usleep(250000); } -#endif +#endif return len+sizeof(long); } @@ -305,7 +305,7 @@ int hdrvc_recvmsg(struct usersmmsg *msg, int maxlen, long type) int hdrvc_hdlcdrv_ioctl(int cmd, struct hdlcdrv_ioctl *par) { struct ifreq ifr = ifr_h; - + if (!kernel_mode) { errno = EINVAL; return -1; @@ -320,7 +320,7 @@ int hdrvc_hdlcdrv_ioctl(int cmd, struct hdlcdrv_ioctl *par) int hdrvc_sm_ioctl(int cmd, struct sm_ioctl *par) { struct ifreq ifr = ifr_h; - + if (!kernel_mode) { errno = EINVAL; return -1; @@ -335,7 +335,7 @@ int hdrvc_sm_ioctl(int cmd, struct sm_ioctl *par) int hdrvc_baycom_ioctl(int cmd, struct baycom_ioctl *par) { struct ifreq ifr = ifr_h; - + if (!kernel_mode) { errno = EINVAL; return -1; @@ -410,11 +410,11 @@ int hdrvc_get_samples(void) { int ret; struct hdlcdrv_ioctl bi; - + #ifdef HDRVC_KERNEL if (kernel_mode) { ret = hdrvc_hdlcdrv_ioctl(HDLCDRVCTL_GETSAMPLES, &bi); - if (ret < 0) + if (ret < 0) return ret; return bi.data.bits & 0xff; } @@ -429,11 +429,11 @@ int hdrvc_get_bits(void) { int ret; struct hdlcdrv_ioctl bi; - + #ifdef HDRVC_KERNEL if (kernel_mode) { ret = hdrvc_hdlcdrv_ioctl(HDLCDRVCTL_GETBITS, &bi); - if (ret < 0) + if (ret < 0) return ret; return bi.data.bits & 0xff; } @@ -490,11 +490,11 @@ int hdrvc_set_channel_access_param(struct hdrvc_channel_params par) { int ret; struct usersmmsg msg; - + #ifdef HDRVC_KERNEL if (kernel_mode) { struct hdlcdrv_ioctl hi; - + hi.data.cp.tx_delay = par.tx_delay; hi.data.cp.tx_tail = par.tx_tail; hi.data.cp.slottime = par.slottime; @@ -513,7 +513,7 @@ int hdrvc_set_channel_access_param(struct hdrvc_channel_params par) msg.data.cp.ppersist = par.ppersist; msg.data.cp.fulldup = par.fulldup; hdrvc_sendmsg(&msg, sizeof(msg.data.cp)); - return 0; + return 0; } /* ---------------------------------------------------------------------- */ @@ -585,16 +585,16 @@ int hdrvc_get_channel_state(struct hdrvc_channel_state *st) /* ---------------------------------------------------------------------- */ -int hdrvc_diag2(unsigned int mode, unsigned int flags, short *data, +int hdrvc_diag2(unsigned int mode, unsigned int flags, short *data, unsigned int maxdatalen, unsigned int *samplesperbit) { int ret; struct usersmmsg msg; static unsigned int modeconvusersm[4] = { - USERSM_DIAGMODE_OFF, USERSM_DIAGMODE_INPUT, USERSM_DIAGMODE_DEMOD, + USERSM_DIAGMODE_OFF, USERSM_DIAGMODE_INPUT, USERSM_DIAGMODE_DEMOD, USERSM_DIAGMODE_CONSTELLATION }; - + if (mode > HDRVC_DIAGMODE_CONSTELLATION) { errno = EINVAL; return -1; diff --git a/hdlcutil/sethdlc.8 b/hdlcutil/sethdlc.8 index 0d784f3..bfbf8a2 100644 --- a/hdlcutil/sethdlc.8 +++ b/hdlcutil/sethdlc.8 @@ -66,7 +66,7 @@ instructs the driver to send a calibration pattern for .I cal seconds. -Without the +Without the .B \-p, .B \-a and @@ -76,7 +76,7 @@ option, will stay in the foreground and display received packets. The AX.25 header and eventually a FlexNet compressed header are decoded. CTRL-C terminates .B sethdlc. -Specifying additional options, +Specifying additional options, .B sethdlc may display additional information. @@ -87,7 +87,7 @@ accepts the following options: .TP .B \-b -Trace the bits at the output of the demodulator, after RX clock recovery. +Trace the bits at the output of the demodulator, after RX clock recovery. This option is only available if \fBsethdlc\fP and the soundcard modem kernel driver is compiled with debugging support on. This is useful for driver debugging. @@ -110,7 +110,7 @@ interrogated. It will usually have the following form: .B \-s Trace the bits at the demodulator output, \fIbefore\fP the RX clock recovery, to stdout. This option is only available the modem driver -is compiled with debugging support on. It may not be available on some modem, such +is compiled with debugging support on. It may not be available on some modem, such as the \fIpar96\fP. .SH PARAMETERS @@ -161,14 +161,14 @@ The .B seriobase parameter optionally sets the address of a serial port, where the driver will output a PTT signal at the TxD and RTS pins, and a DCD -signal at the DTR pin. As Baycom modems do have their own PTT pin, this +signal at the DTR pin. As Baycom modems do have their own PTT pin, this parameter is not used by the Baycom modem driver. The .B pariobase parameter optionally sets the address of a LPT port where the driver will output a PTT signal on the DATA0 line and a DCD signal -on the DATA1 line. As Baycom modems do have their own PTT pin, this +on the DATA1 line. As Baycom modems do have their own PTT pin, this parameter is not used by the Baycom modem driver. The @@ -198,7 +198,7 @@ time to actually clock the last bits out to the transmitter. The .B slottime parameter specifies how often the channel access algorithm is executed. -Unlike \fIkissparms\fP, the unit is \fItens of ms\fP. Unless you have very +Unlike \fIkissparms\fP, the unit is \fItens of ms\fP. Unless you have very specific requirements, set this to 100ms (i.e. 10). The @@ -220,7 +220,7 @@ sets the modem to half duplex mode. .SH CONSIDERATIONS OF CONFIGURING BAYCOM PORTS It is important to note that sethdlc merely tells the Linux kernel where it should expect to find the I/O port and IRQ lines of a -particular serial port. It does +particular serial port. It does .I not configure the hardware to use a particular I/O port. In order to do that, you will need to physically 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, diff --git a/hdlcutil/smdiag.8 b/hdlcutil/smdiag.8 index f1c5478..996ec9a 100644 --- a/hdlcutil/smdiag.8 +++ b/hdlcutil/smdiag.8 @@ -64,7 +64,7 @@ quits .SH BUGS .B smdiag Reacts sluggishly to keypresses. The window size is fixed. For speed reasons, -two square root operations per sample are not implemented in the AFSK 1200 +two square root operations per sample are not implemented in the AFSK 1200 baud modes. The eye diagram for the AFSK 1200 baud mode is therefore distorted. diff --git a/hdlcutil/smdiag.c b/hdlcutil/smdiag.c index e9b615d..7dd9a00 100644 --- a/hdlcutil/smdiag.c +++ b/hdlcutil/smdiag.c @@ -69,11 +69,11 @@ static int x_error_handler(Display *disp, XErrorEvent *evt) XGetErrorText(disp, evt->error_code, err_buf, sizeof(err_buf)); fprintf(stderr, "X Error: %s\n", err_buf); - XGetErrorDatabaseText(disp, mtype, "MajorCode", "Request Major code %d", + XGetErrorDatabaseText(disp, mtype, "MajorCode", "Request Major code %d", mesg, sizeof(mesg)); fprintf(stderr, mesg, evt->request_code); sprintf(number, "%d", evt->request_code); - XGetErrorDatabaseText(disp, "XRequest", number, "", err_buf, + XGetErrorDatabaseText(disp, "XRequest", number, "", err_buf, sizeof(err_buf)); fprintf(stderr, " (%s)\n", err_buf); abort(); @@ -100,9 +100,9 @@ static int openwindow(char *disp, int constell, int samplesperbit) col_background = WhitePixel(display, 0); col_trace = BlackPixel(display, 0); attr.background_pixel = col_background; - if (!(window = XCreateWindow(display, XRootWindow(display, 0), - 200, 200, WIDTH, HEIGHT, 5, - DefaultDepth(display, 0), + if (!(window = XCreateWindow(display, XRootWindow(display, 0), + 200, 200, WIDTH, HEIGHT, 5, + DefaultDepth(display, 0), InputOutput, DefaultVisual(display, 0), CWBackPixel, &attr))) { fprintf(stderr, "smdiag: unable to open X window\n"); @@ -161,7 +161,7 @@ static void drawdata(short *data, int len, int replace, int xm) int cnt; GC gc; XGCValues gcv; - XWindowAttributes winattrs; + XWindowAttributes winattrs; if (!display || !pixmap) return; @@ -169,13 +169,13 @@ static void drawdata(short *data, int len, int replace, int xm) gcv.line_width = 1; gcv.line_style = LineSolid; gc = XCreateGC(display, pixmap, GCLineWidth | GCLineStyle, &gcv); - XSetState(display, gc, col_background, col_background, GXcopy, + XSetState(display, gc, col_background, col_background, GXcopy, AllPlanes); if (replace) - XFillRectangle(display, pixmap, gc, 0, 0, + XFillRectangle(display, pixmap, gc, 0, 0, winattrs.width, winattrs.height); else - XCopyArea(display, window, pixmap, gr_context, 0, 0, + XCopyArea(display, window, pixmap, gr_context, 0, 0, winattrs.width, winattrs.height, 0, 0); XSetForeground(display, gc, col_trace); for (cnt = 0; cnt < len-1; cnt++) @@ -203,7 +203,7 @@ static void drawconstell(short *data, int len) int cnt; GC gc; XGCValues gcv; - XWindowAttributes winattrs; + XWindowAttributes winattrs; if (!display || !pixmap) return; @@ -211,13 +211,13 @@ static void drawconstell(short *data, int len) gcv.line_width = 1; gcv.line_style = LineSolid; gc = XCreateGC(display, pixmap, GCLineWidth | GCLineStyle, &gcv); - XSetState(display, gc, col_background, col_background, GXcopy, + XSetState(display, gc, col_background, col_background, GXcopy, AllPlanes); - XCopyArea(display, window, pixmap, gr_context, 0, 0, + XCopyArea(display, window, pixmap, gr_context, 0, 0, winattrs.width, winattrs.height, 0, 0); XSetForeground(display, gc, col_trace); for (cnt = 0; cnt < len-1; cnt += 2) - XDrawPoint(display, pixmap, gc, + XDrawPoint(display, pixmap, gc, XCOORD(data[cnt]), YCOORD(data[cnt+1])); XSetForeground(display, gc, col_zeroline); XDrawLine(display, pixmap, gc, 0, YCOORD(0), winattrs.width, YCOORD(0)); @@ -235,7 +235,7 @@ static void drawconstell(short *data, int len) static void clearwindow(void) { - XWindowAttributes winattrs; + XWindowAttributes winattrs; GC gc; XGCValues gcv; @@ -245,15 +245,15 @@ static void clearwindow(void) gcv.line_width = 1; gcv.line_style = LineSolid; gc = XCreateGC(display, pixmap, GCLineWidth | GCLineStyle, &gcv); - XSetState(display, gc, col_background, col_background, GXcopy, + XSetState(display, gc, col_background, col_background, GXcopy, AllPlanes); - XFillRectangle(display, pixmap, gc, 0, 0, + XFillRectangle(display, pixmap, gc, 0, 0, winattrs.width, winattrs.height); XSetForeground(display, gc, col_zeroline); XClearArea(display, window, 0, 0, 0, 0, False); XCopyArea(display, pixmap, window, gr_context, 0, 0, winattrs.width, winattrs.height, 0, 0); - XFreeGC(display, gc); + XFreeGC(display, gc); } /* ---------------------------------------------------------------------- */ @@ -267,7 +267,7 @@ static Bool predicate(Display *display, XEvent *event, char *arg) static char *getkey(void) { - XWindowAttributes winattrs; + XWindowAttributes winattrs; XEvent evt; static char kbuf[32]; int i; @@ -278,7 +278,7 @@ static char *getkey(void) while (XCheckIfEvent(display, &evt, predicate, NULL)) { switch (evt.type) { case KeyPress: - i = XLookupString((XKeyEvent *)&evt, kbuf, sizeof(kbuf)-1, + i = XLookupString((XKeyEvent *)&evt, kbuf, sizeof(kbuf)-1, NULL, NULL); if (!i) return NULL; @@ -290,7 +290,7 @@ static char *getkey(void) return NULL; case Expose: XGetWindowAttributes(display, window, &winattrs); - XCopyArea(display, pixmap, window, gr_context, 0, 0, + XCopyArea(display, pixmap, window, gr_context, 0, 0, winattrs.width, winattrs.height, 0, 0); break; default: @@ -311,7 +311,7 @@ static void printmode(unsigned int mode, unsigned int trigger) /* ---------------------------------------------------------------------- */ -static const char *usage_str = +static const char *usage_str = "[-d display] [-i smif] [-c] [-e]\n" " -d: display host\n" " -i: specify the name of the baycom kernel driver interface\n" diff --git a/hdlcutil/smmixer.c b/hdlcutil/smmixer.c index 8adca7f..473b3a6 100644 --- a/hdlcutil/smmixer.c +++ b/hdlcutil/smmixer.c @@ -105,7 +105,7 @@ static void display_mixer_ad1848(void) { static const char *src[4] = { "Line", "Aux1", "Mic", "Dac" }; unsigned char data; - + data = get_mixer_reg(0); printf("Left input: Source: %-4s Gain: %3ddB\n", src[(data>>6)&3], (((data & 0xe0) == 0xa0) ? 20 : 0) + (data & 0xf) * 3 / 2); @@ -114,31 +114,31 @@ static void display_mixer_ad1848(void) (((data & 0xe0) == 0xa0) ? 20 : 0) + (data & 0xf) * 3 / 2); data = get_mixer_reg(2); if (!(data & 0x80)) - printf("Left Aux1 mixing: Gain: %3ddB\n", + printf("Left Aux1 mixing: Gain: %3ddB\n", (8 - (int)(data & 0x1f)) * 3 / 2); data = get_mixer_reg(3); if (!(data & 0x80)) - printf("Right Aux1 mixing: Gain: %3ddB\n", + printf("Right Aux1 mixing: Gain: %3ddB\n", (8 - (int)(data & 0x1f)) * 3 / 2); data = get_mixer_reg(4); if (!(data & 0x80)) - printf("Left Aux2 mixing: Gain: %3ddB\n", + printf("Left Aux2 mixing: Gain: %3ddB\n", (8 - (int)(data & 0x1f)) * 3 / 2); data = get_mixer_reg(5); if (!(data & 0x80)) - printf("Right Aux2 mixing: Gain: %3ddB\n", + printf("Right Aux2 mixing: Gain: %3ddB\n", (8 - (int)(data & 0x1f)) * 3 / 2); data = get_mixer_reg(6); - if (data & 0x80) + if (data & 0x80) printf("Left output: muted\n"); - else - printf("Left output: Gain: %3ddB\n", + else + printf("Left output: Gain: %3ddB\n", ((int)(data & 0x3f)) * (-3) / 2); data = get_mixer_reg(7); - if (data & 0x80) + if (data & 0x80) printf("Right output: muted\n"); - else - printf("Right output: Gain: %3ddB\n", + else + printf("Right output: Gain: %3ddB\n", ((int)(data & 0x3f)) * (-3) / 2); data = get_mixer_reg(13); if (data & 1) @@ -154,24 +154,24 @@ static void display_mixer_cs423x(void) display_mixer_ad1848(); data = get_mixer_reg(26); - printf("Mono: %s%s%s Gain: %3ddB\n", + printf("Mono: %s%s%s Gain: %3ddB\n", (data & 0x80) ? "input muted, " : "", (data & 0x40) ? "output muted, " : "", (data & 0x20) ? "bypass, " : "", (int)(data & 0xf) * (-3)); data = get_mixer_reg(27); - if (data & 0x80) + if (data & 0x80) printf("Left output: muted\n"); - else - printf("Left output: Gain: %3ddB\n", + else + printf("Left output: Gain: %3ddB\n", ((int)(data & 0xf)) * (-2)); data = get_mixer_reg(29); - if (data & 0x80) + if (data & 0x80) printf("Right output: muted\n"); - else - printf("Right output: Gain: %3ddB\n", + else + printf("Right output: Gain: %3ddB\n", ((int)(data & 0xf)) * (-2)); - + } /* ---------------------------------------------------------------------- */ @@ -179,73 +179,73 @@ static void display_mixer_cs423x(void) static void display_mixer_ct1335(void) { unsigned char data; - + data = get_mixer_reg(0x2); - printf("Master volume: %3ddB\n", + printf("Master volume: %3ddB\n", (((int)((data >> 1) & 7)) - 7) * 46 / 7); data = get_mixer_reg(0xa); - printf("Voice volume: %3ddB\n", + printf("Voice volume: %3ddB\n", (((int)((data >> 1) & 3)) - 3) * 46 / 3); data = get_mixer_reg(0x6); - printf("MIDI volume: %3ddB\n", + printf("MIDI volume: %3ddB\n", (((int)((data >> 1) & 7)) - 7) * 46 / 7); data = get_mixer_reg(0x8); - printf("CD volume: %3ddB\n", + printf("CD volume: %3ddB\n", (((int)((data >> 1) & 7)) - 7) * 46 / 7); } /* ---------------------------------------------------------------------- */ static void display_mixer_ct1345(void) -{ +{ static const char *src[4] = { "Mic", "CD", "Mic", "Line" }; unsigned char data, data2; - + data = get_mixer_reg(0xc); data2 = get_mixer_reg(0xe); printf("Input source: %s\n", src[(data >> 1) & 3]); - if (!(data & data2 & 0x20)) { - printf("Filter: Low pass %s kHz: ", (data & 0x8) ? + if (!(data & data2 & 0x20)) { + printf("Filter: Low pass %s kHz: ", (data & 0x8) ? "8.8" : "3.2"); if (data & 0x20) printf("output\n"); - else + else printf("input%s\n", (data2 & 0x20) ? "" : ", output"); } if (data2 & 2) printf("stereo\n"); - + data = get_mixer_reg(0x22); - printf("Master volume: Left: %3ddB Right: %3ddB\n", + printf("Master volume: Left: %3ddB Right: %3ddB\n", (((int)((data >> 5) & 7)) - 7) * 46 / 7, (((int)((data >> 1) & 7)) - 7) * 46 / 7); data = get_mixer_reg(0x4); - printf("Voice volume: Left: %3ddB Right: %3ddB\n", + printf("Voice volume: Left: %3ddB Right: %3ddB\n", (((int)((data >> 5) & 7)) - 7) * 46 / 7, (((int)((data >> 1) & 7)) - 7) * 46 / 7); data = get_mixer_reg(0x26); - printf("MIDI volume: Left: %3ddB Right: %3ddB\n", + printf("MIDI volume: Left: %3ddB Right: %3ddB\n", (((int)((data >> 5) & 7)) - 7) * 46 / 7, (((int)((data >> 1) & 7)) - 7) * 46 / 7); data = get_mixer_reg(0x28); - printf("CD volume: Left: %3ddB Right: %3ddB\n", + printf("CD volume: Left: %3ddB Right: %3ddB\n", (((int)((data >> 5) & 7)) - 7) * 46 / 7, (((int)((data >> 1) & 7)) - 7) * 46 / 7); data = get_mixer_reg(0x2e); - printf("Line volume: Left: %3ddB Right: %3ddB\n", + printf("Line volume: Left: %3ddB Right: %3ddB\n", (((int)((data >> 5) & 7)) - 7) * 46 / 7, (((int)((data >> 1) & 7)) - 7) * 46 / 7); data = get_mixer_reg(0x0a); - printf("Mic mixing volume: %3ddB\n", + printf("Mic mixing volume: %3ddB\n", (((int)((data >> 1) & 3)) - 3) * 46 / 3); } /* ---------------------------------------------------------------------- */ static void display_mixer_ct1745(void) -{ +{ unsigned char data, data2; - + printf("Master volume: Left: %3ddB Right: %3ddB\n", ((int)((get_mixer_reg(0x30) >> 3) & 0x1f) - 31) * 2, ((int)((get_mixer_reg(0x31) >> 3) & 0x1f) - 31) * 2); @@ -265,7 +265,7 @@ static void display_mixer_ct1745(void) ((int)((get_mixer_reg(0x3a) >> 3) & 0x1f) - 31) * 2); printf("PC speaker volume: %3ddB\n", ((int)((get_mixer_reg(0x3b) >> 6) & 0x3) - 3) * 6); - printf("Mic gain: %s\n", + printf("Mic gain: %s\n", (get_mixer_reg(0x43) & 1) ? "fixed 20dB" : "AGC"); printf("Output gain: Left: %3ddB Right: %3ddB\n", ((int)((get_mixer_reg(0x41) >> 6) & 3)) * 6, @@ -298,14 +298,14 @@ static void display_mixer_ct1745(void) (data & 8) ? " Line.R" : ""); data = get_mixer_reg(0x3d); printf("Input sources left: %s%s%s%s%s%s%s\n", - (data & 1) ? " Mic" : "", (data & 2) ? " CD.R" : "", - (data & 4) ? " CD.L" : "", (data & 8) ? " Line.R" : "", + (data & 1) ? " Mic" : "", (data & 2) ? " CD.R" : "", + (data & 4) ? " CD.L" : "", (data & 8) ? " Line.R" : "", (data & 0x10) ? " Line.L" : "", (data & 0x20) ? " Midi.R" : "", (data & 0x40) ? " Midi.L" : ""); data = get_mixer_reg(0x3e); printf("Input sources right: %s%s%s%s%s%s%s\n", - (data & 1) ? " Mic" : "", (data & 2) ? " CD.R" : "", - (data & 4) ? " CD.L" : "", (data & 8) ? " Line.R" : "", + (data & 1) ? " Mic" : "", (data & 2) ? " CD.R" : "", + (data & 4) ? " CD.L" : "", (data & 8) ? " Line.R" : "", (data & 0x10) ? " Line.L" : "", (data & 0x20) ? " Midi.R" : "", (data & 0x40) ? " Midi.L" : ""); } @@ -445,13 +445,13 @@ static int set_mixer_ad1848(int argc, char *argv[]) if (mask & 1) { if (olvll < -95) set_mixer_reg(0x06, 0x80); - else + else set_mixer_reg(0x06, (olvll * (-2) / 3)); } if (mask & 2) { if (olvlr < -95) set_mixer_reg(0x07, 0x80); - else + else set_mixer_reg(0x07, (olvlr * (-2) / 3)); } set_mixer_reg(0x0d, 0x00); @@ -620,25 +620,25 @@ static int set_mixer_ct1745(int argc, char *argv[]) } } else if (!strncasecmp(argv[0], "s=", 2)) { mask |= 16; - if (!strcasecmp(argv[0]+2, "mic")) + if (!strcasecmp(argv[0]+2, "mic")) insrc |= 1; - else if (!strcasecmp(argv[0]+2, "cd.r")) + else if (!strcasecmp(argv[0]+2, "cd.r")) insrc |= 2; - else if (!strcasecmp(argv[0]+2, "cd.l")) + else if (!strcasecmp(argv[0]+2, "cd.l")) insrc |= 4; - else if (!strcasecmp(argv[0]+2, "cd")) + else if (!strcasecmp(argv[0]+2, "cd")) insrc |= 6; - else if (!strcasecmp(argv[0]+2, "line.r")) + else if (!strcasecmp(argv[0]+2, "line.r")) insrc |= 0x08; - else if (!strcasecmp(argv[0]+2, "line.l")) + else if (!strcasecmp(argv[0]+2, "line.l")) insrc |= 0x10; - else if (!strcasecmp(argv[0]+2, "line")) + else if (!strcasecmp(argv[0]+2, "line")) insrc |= 0x18; - else if (!strcasecmp(argv[0]+2, "midi.r")) + else if (!strcasecmp(argv[0]+2, "midi.r")) insrc |= 0x20; - else if (!strcasecmp(argv[0]+2, "midi.l")) + else if (!strcasecmp(argv[0]+2, "midi.l")) insrc |= 0x40; - else if (!strcasecmp(argv[0]+2, "midi")) + else if (!strcasecmp(argv[0]+2, "midi")) insrc |= 0x60; else { fprintf(stderr, "invalid input source, must " @@ -715,7 +715,7 @@ static int set_mixer_ct1745(int argc, char *argv[]) /* ---------------------------------------------------------------------- */ -static const char *usage_str = +static const char *usage_str = "[-i smif]\n\n"; int main(int argc, char *argv[]) diff --git a/hdlcutil/soundmodem.9 b/hdlcutil/soundmodem.9 index cbf6159..277e293 100644 --- a/hdlcutil/soundmodem.9 +++ b/hdlcutil/soundmodem.9 @@ -13,7 +13,7 @@ soundmodem \- amateur (AX.25) packet radio network driver for soundcards .SH DESCRIPTION The driver currently supports both 1200 baud AFSK and 9600 baud FSK -(G3RUH compatible) using a standard SoundBlaster compatible or +(G3RUH compatible) using a standard SoundBlaster compatible or WindowsSoundSystem compatible soundcard. The whole decoding is done in software, so you definitely do not want to use it on a 386SX class machine. @@ -59,7 +59,7 @@ mixer register. .TP .B SMCTL_SETMIXER sets the specified mixer register, if the specified -mixer type matches the mixer type of the soundcard. Only +mixer type matches the mixer type of the soundcard. Only superuser can do this. .TP .B SMCTL_DIAGNOSE diff --git a/hdlcutil/soundmodem.h b/hdlcutil/soundmodem.h index 10d0799..3caa850 100644 --- a/hdlcutil/soundmodem.h +++ b/hdlcutil/soundmodem.h @@ -43,7 +43,7 @@ struct sm_ioctl { int cmd; union { struct sm_config cfg; - struct sm_diag_data diag; + struct sm_diag_data diag; struct sm_mixer_data mix; struct sm_debug_data dbg; } data; diff --git a/hdlcutil/usersmdiag.h b/hdlcutil/usersmdiag.h index 0fe829d..e40f889 100644 --- a/hdlcutil/usersmdiag.h +++ b/hdlcutil/usersmdiag.h @@ -25,7 +25,7 @@ */ /*****************************************************************************/ - + #ifndef _USERSMDIAG_H #define _USERSMDIAG_H @@ -85,7 +85,7 @@ struct usersmmsg { int fulldup; /* some driver do not support full duplex, setting */ /* this just makes them send even if DCD is on */ } cp; - + int calib; struct usersm_channel_state { @@ -97,7 +97,7 @@ struct usersmmsg { unsigned long rx_packets; unsigned long rx_errors; } cs; - + struct usersm_diag { unsigned int mode; unsigned int flags; diff --git a/kiss/Makefile.am b/kiss/Makefile.am index 38ba8fb..1fcdc6a 100644 --- a/kiss/Makefile.am +++ b/kiss/Makefile.am @@ -9,7 +9,7 @@ dist_man_MANS = kissattach.8 spattach.8 kissnetd.8 kissparms.8 mkiss.8 \ net2kiss.8 INCLUDES = -DAX25_SYSCONFDIR=\""$(AX25_SYSCONFDIR)"\" \ - -DAX25_LOCALSTATEDIR=\""$(AX25_LOCALSTATEDIR)"\" + -DAX25_LOCALSTATEDIR=\""$(AX25_LOCALSTATEDIR)"\" AX25_SYSCONFDIR=${sysconfdir}/ax25/ AX25_LOCALSTATEDIR=${localstatedir}/ax25/ 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) { diff --git a/kiss/kissnetd.c b/kiss/kissnetd.c index d993e4a..304aed1 100644 --- a/kiss/kissnetd.c +++ b/kiss/kissnetd.c @@ -8,7 +8,7 @@ * * F1OAT 960804 - Frederic RIBLE */ - + #include #define __USE_XOPEN #include @@ -52,7 +52,7 @@ static void Usage(void) fprintf(stderr, " -f size : Set max frame size to size bytes (default 512)\n"); fprintf(stderr, " -p num : Number of /dev/ptmx-master-devices has to open\n"); exit(1); -} +} static void Banner(int Small) { @@ -64,7 +64,7 @@ static void Banner(int Small) printf("* Network broadcast between kiss ports *\n"); printf("* ATEPRA FPAC/Linux Project *\n"); printf("****************************************\n"); - printf("* kissnetd Version %-4s *\n", Version); + printf("* kissnetd Version %-4s *\n", Version); printf("* by Frederic RIBLE F1OAT *\n"); printf("****************************************\n"); } @@ -73,23 +73,23 @@ static void Banner(int Small) static void NewPort(char *Name) { struct PortDescriptor *MyPort; - + if (VerboseMode) { printf("Opening port %s\n", Name); } - + if (NbPort == FD_SETSIZE) { fprintf(stderr, "Cannot handle %s : too many ports\n", Name); exit(1); } - + MyPort = calloc(sizeof(struct PortDescriptor), 1); if (MyPort) MyPort->FrameBuffer = calloc(sizeof (unsigned char), MaxFrameSize); if (!MyPort || !MyPort->FrameBuffer) { perror("cannot allocate port descriptor"); exit(1); } - + strncpy(MyPort->Name, Name, PATH_MAX-1); MyPort->Name[PATH_MAX-1] = '\0'; MyPort->Fd = -1; @@ -104,17 +104,17 @@ static void ReopenPort(int PortNumber) { char MyString[80]; PortList[PortNumber]->TimeLastOpen = time(NULL); - + if (VerboseMode) { printf("Reopening port %d\n", PortNumber); } - + if (PortList[PortNumber]->namepts[0] == '\0') { - + syslog(LOG_WARNING, "kissnetd : Opening port %s\n", PortList[PortNumber]->Name); PortList[PortNumber]->Fd = open(PortList[PortNumber]->Name, O_RDWR | O_NONBLOCK); if (PortList[PortNumber]->Fd < 0) { - syslog(LOG_WARNING, "kissnetd : Error opening port %s : %s\n", + syslog(LOG_WARNING, "kissnetd : Error opening port %s : %s\n", PortList[PortNumber]->Name, strerror(errno)); if (VerboseMode) { sprintf(MyString, "cannot reopen %s", PortList[PortNumber]->Name); @@ -128,7 +128,7 @@ static void ReopenPort(int PortNumber) /* get name of pts-device */ if ((npts = ptsname(PortList[PortNumber]->Fd)) == NULL) { sprintf(MyString, "Cannot get name of pts-device.\n"); - syslog(LOG_WARNING, "kissnetd : Cannot get name of pts-device\n"); + syslog(LOG_WARNING, "kissnetd : Cannot get name of pts-device\n"); exit(1); } strncpy(PortList[PortNumber]->namepts, npts, PATH_MAX-1); @@ -144,7 +144,7 @@ static void ReopenPort(int PortNumber) } } else { if (PortList[PortNumber]->Fd == -1) { - syslog(LOG_WARNING, "kissnetd : Cannot reopen port ptmx (slave %s) : not supported by ptmx-device\n", + syslog(LOG_WARNING, "kissnetd : Cannot reopen port ptmx (slave %s) : not supported by ptmx-device\n", PortList[PortNumber]->namepts); if (VerboseMode) { sprintf(MyString, "cannot reopen ptmx (slave %s).", PortList[PortNumber]->namepts); @@ -152,7 +152,7 @@ static void ReopenPort(int PortNumber) } return; } - syslog(LOG_WARNING, "kissnetd : Trying to poll port ptmx (slave %s).\n", + syslog(LOG_WARNING, "kissnetd : Trying to poll port ptmx (slave %s).\n", PortList[PortNumber]->namepts); PortList[PortNumber]->is_active = 1; } @@ -163,12 +163,12 @@ static void TickReopen(void) int i; static int wrote_info = 0; time_t CurrentTime = time(NULL); - + for (i=0; iFd >= 0 && PortList[i]->is_active == 1) continue; if ( (CurrentTime - PortList[i]->TimeLastOpen) > REOPEN_TIMEOUT ) ReopenPort(i); } - + if (!wrote_info) { for (i=0; inamepts[0] != '\0') { @@ -197,37 +197,37 @@ static void Broadcast(int InputPort) { int i; int rc; - + /* Broadcast only info frames */ - + if (PortList[InputPort]->FrameBuffer[1] != 0x00 && \ PortList[InputPort]->FrameBuffer[1] != 0x20 && \ PortList[InputPort]->FrameBuffer[1] != 0x80) return; - + for (i=0; iFd < 0 || PortList[i]->is_active == 0) continue; again: - rc = write(PortList[i]->Fd, - PortList[InputPort]->FrameBuffer+offset, + rc = write(PortList[i]->Fd, + PortList[InputPort]->FrameBuffer+offset, PortList[InputPort]->BufferIndex-offset); if (rc < 0) { if (errno == EAGAIN) { if (PortList[i]->namepts[0] == '\0') - syslog(LOG_WARNING, "kissnetd : write buffer full on port %s. dropping frame. %s", + syslog(LOG_WARNING, "kissnetd : write buffer full on port %s. dropping frame. %s", PortList[i]->Name, strerror(errno)); else - syslog(LOG_WARNING, "kissnetd : write buffer full on ptmx port %s. dropping frame. %s", + syslog(LOG_WARNING, "kissnetd : write buffer full on ptmx port %s. dropping frame. %s", PortList[i]->namepts, strerror(errno)); continue; } if (PortList[i]->namepts[0] == '\0') - syslog(LOG_WARNING, "kissnetd : Error writing to port %s : %s\n", + syslog(LOG_WARNING, "kissnetd : Error writing to port %s : %s\n", PortList[i]->Name, strerror(errno)); else - syslog(LOG_WARNING, "kissnetd : Error writing to port ptmx (slave %s) : %s\n", + syslog(LOG_WARNING, "kissnetd : Error writing to port ptmx (slave %s) : %s\n", PortList[i]->namepts, strerror(errno)); if (VerboseMode) perror("write"); PortList[i]->is_active = 0; @@ -241,7 +241,7 @@ again: printf("Sending %d bytes on port %d : rc=%d\n", PortList[InputPort]->BufferIndex, i, rc); - } + } if (rc < PortList[InputPort]->BufferIndex-offset) { offset += rc; goto again; @@ -255,7 +255,7 @@ static void ProcessInput(int PortNumber) int Length; int i; struct PortDescriptor *MyPort = PortList[PortNumber]; - + Length = read(MyPort->Fd, MyBuffer, sizeof(MyBuffer)); if (VerboseMode) { printf("Read port %d : rc=%d\n", PortNumber, Length); @@ -265,10 +265,10 @@ static void ProcessInput(int PortNumber) if (errno == EAGAIN) return; if (MyPort->namepts[0] == '\0') - syslog(LOG_WARNING, "kissnetd : Error reading from port %s : %s\n", + syslog(LOG_WARNING, "kissnetd : Error reading from port %s : %s\n", PortList[PortNumber]->Name, strerror(errno)); else - syslog(LOG_WARNING, "kissnetd : Error reading from port ptmx (slave %s) : %s\n", + syslog(LOG_WARNING, "kissnetd : Error reading from port ptmx (slave %s) : %s\n", PortList[PortNumber]->namepts, strerror(errno)); if (VerboseMode) perror("read"); MyPort->is_active = 0; @@ -285,11 +285,11 @@ static void ProcessInput(int PortNumber) MyPort->BufferIndex = 1; } } - else { + else { MyPort->FrameBuffer[MyPort->BufferIndex++] = MyBuffer[i]; if (MyBuffer[i] == 0xC0) { Broadcast(PortNumber); - MyPort->BufferIndex = 1; + MyPort->BufferIndex = 1; } } } @@ -300,19 +300,19 @@ static void ProcessPortList(void) static fd_set MyFdSet; int i, rc; struct timeval Timeout; - + Timeout.tv_sec = 1; Timeout.tv_usec = 0; - + FD_ZERO(&MyFdSet); for (i=0; iFd >= 0 && PortList[i]->is_active) FD_SET(PortList[i]->Fd, &MyFdSet); } rc = select(FD_SETSIZE, &MyFdSet, NULL, NULL, &Timeout); - + if (VerboseMode) printf("select : rc=%d\n", rc); if (!rc ) TickReopen(); - + if (rc > 0) { for (i=0; iFd < 0) continue; @@ -321,7 +321,7 @@ static void ProcessPortList(void) rc--; } } - } + } } static void ProcessArgv(int argc, char *argv[]) @@ -329,7 +329,7 @@ static void ProcessArgv(int argc, char *argv[]) int opt; int i=0; int ptmxdevices = 0; - + while ((opt = getopt(argc, argv, "vf:p:")) != -1) { switch (opt) { case 'v': @@ -353,7 +353,7 @@ static void ProcessArgv(int argc, char *argv[]) exit(1); } } - + while (optind < argc) NewPort(argv[optind++]); @@ -364,7 +364,7 @@ static void ProcessArgv(int argc, char *argv[]) } -int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { if (argc < 2) { Banner(0); @@ -373,8 +373,8 @@ int main(int argc, char *argv[]) else { Banner(1); } - + ProcessArgv(argc, argv); while (1) ProcessPortList(); - return 0; + return 0; } diff --git a/kiss/kissparms.8 b/kiss/kissparms.8 index 99dfd64..8d2f57e 100644 --- a/kiss/kissparms.8 +++ b/kiss/kissparms.8 @@ -2,7 +2,7 @@ .SH NAME kissparms \- Configure KISS TNCs. .SH SYNOPSIS -.B kissparms [-c crc-type] -p [-f y|n] [-h hw] [-l txtail] [-r pers] [-s slot] [-t txd] [-e feclevel] [-v] [-x] [-X raw] +.B kissparms [-c crc-type] -p [-f y|n] [-h hw] [-l txtail] [-r pers] [-s slot] [-t txd] [-e feclevel] [-v] [-x] [-X raw] .SH DESCRIPTION .LP .B Kissparms diff --git a/kiss/kissparms.c b/kiss/kissparms.c index 9d7192c..4b26d29 100644 --- a/kiss/kissparms.c +++ b/kiss/kissparms.c @@ -10,7 +10,7 @@ #include #include -#ifdef __GLIBC__ +#ifdef __GLIBC__ #include #else #include @@ -250,8 +250,8 @@ rawsend: } } } - + close(s); - + return 0; } diff --git a/kiss/mkiss.c b/kiss/mkiss.c index 4ad4852..7cce904 100644 --- a/kiss/mkiss.c +++ b/kiss/mkiss.c @@ -32,7 +32,7 @@ * 1.06 23/11/96 Tomi Manninen - Added simple support for polled kiss. * * 1.07 12/24/97 Deti Fliegl - Added Flexnet/BayCom CRC mode with commandline - * parameter -f + * parameter -f * * 1.08 xx/xx/99 Tom Mazouch - Adjustable poll interval */ @@ -158,14 +158,14 @@ static int poll(int fd, int ports) } static int put_ubyte(unsigned char* s, u16* crc, unsigned char c, int usecrc) -{ +{ int len = 1; - if (c == FEND) { + if (c == FEND) { *s++ = FESC; *s++ = TFEND; len++; - } else { + } else { *s++ = c; if (c == FESC) { *s++ = TFESC; @@ -214,7 +214,7 @@ static int kiss_tx(int fd, int port, unsigned char *s, int len, int usecrc) c = (c & 0x0F) | (port << 4); ptr += put_ubyte(ptr, &crc, c, usecrc); } - + /* * For each byte in the packet, send the appropriate * character sequence, according to the SLIP protocol. @@ -238,7 +238,7 @@ static int kiss_tx(int fd, int port, unsigned char *s, int len, int usecrc) } break; } - + *ptr++ = FEND; return write(fd, obuf, ptr - obuf); } @@ -255,7 +255,7 @@ static int kiss_rx(struct iface *ifp, unsigned char c, int usecrc) len = 0; /* ...drop frame */ ifp->errors++; } - + if (len != 0) { switch (usecrc) { case G8BPQ_CRC: @@ -334,7 +334,7 @@ static int kiss_rx(struct iface *ifp, unsigned char c, int usecrc) *ifp->optr++ = c; switch (usecrc) { - case G8BPQ_CRC: + case G8BPQ_CRC: ifp->crc ^= c; break; case FLEX_CRC: @@ -393,7 +393,7 @@ static void report(void) crcflag == G8BPQ_CRC ? "en" : "dis"); syslog(LOG_INFO, "FLEX checksumming %sabled.", crcflag == FLEX_CRC ? "en" : "dis"); - + syslog(LOG_INFO, "polling %sabled.", pollspeed ? "en" : "dis"); if (pollspeed) diff --git a/kiss/net2kiss.c b/kiss/net2kiss.c index 716107d..04b4032 100644 --- a/kiss/net2kiss.c +++ b/kiss/net2kiss.c @@ -72,7 +72,7 @@ static char *namepts = NULL; /* name of the unix98 pts slave, which /* --------------------------------------------------------------------- */ -static void die(char *func) +static void die(char *func) { fprintf(stderr, "%s: %s (%i)%s%s\n", progname, strerror(errno), errno, func ? " in " : "", func ? func : ""); @@ -88,7 +88,7 @@ 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) return; @@ -100,24 +100,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; @@ -132,33 +132,33 @@ static void display_packet(unsigned char *bp, unsigned int len) 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)) 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)) { /* @@ -207,7 +207,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; } @@ -221,25 +221,25 @@ 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"); } /* ---------------------------------------------------------------------- */ -static int openpty(int *amaster, int *aslave, char *name, +static int openpty(int *amaster, int *aslave, char *name, struct termios *termp, struct winsize *winp) { char line[PATH_MAX]; @@ -257,7 +257,7 @@ static int openpty(int *amaster, int *aslave, char *name, return (-1); /* out of ptys */ } else { line[5] = 't'; - (void) chown(line, getuid(), + (void) chown(line, getuid(), gr ? gr->gr_gid : -1); (void) chmod(line, S_IRUSR|S_IWUSR|S_IWGRP); #if 0 @@ -270,11 +270,11 @@ static int openpty(int *amaster, int *aslave, char *name, strcpy(name, line); if (termp) (void) tcsetattr(slave, - TCSAFLUSH, + TCSAFLUSH, termp); if (winp) - (void) ioctl(slave, - TIOCSWINSZ, + (void) ioctl(slave, + TIOCSWINSZ, (char *)winp); return 0; } @@ -318,22 +318,22 @@ static void restore_ifflags(int signum) /* --------------------------------------------------------------------- */ -static void kiss_overflow(void) +static void kiss_overflow(void) { if (verbose) printf("KISS: packet overflow\n"); } -static void kiss_bad_escape(void) +static void kiss_bad_escape(void) { if (verbose) printf("KISS: bad escape sequence\n"); } -static void display_kiss_packet(char *pfx, unsigned char *pkt, - unsigned int pktlen) +static void display_kiss_packet(char *pfx, unsigned char *pkt, + unsigned int pktlen) { - if (!verbose) + if (!verbose) return; switch (*pkt) { case KISS_CMD_DATA: @@ -344,7 +344,7 @@ static void display_kiss_packet(char *pfx, unsigned char *pkt, case KISS_CMD_TXDELAY: printf("%s: txdelay = %dms\n", pfx, (int)pkt[1] * 10); break; - + case KISS_CMD_PPERSIST: printf("%s: p persistence = %d\n", pfx, pkt[1]); break; @@ -367,8 +367,8 @@ static void display_kiss_packet(char *pfx, unsigned char *pkt, } } -static void kiss_packet(int fdif, char *addr, - unsigned char *pkt, unsigned int pktlen) +static void kiss_packet(int fdif, char *addr, + unsigned char *pkt, unsigned int pktlen) { struct sockaddr to; int i; @@ -410,19 +410,19 @@ static int doio(int fdif, int fdpty, char *ifaddr) fd_set rmask, wmask; struct sockaddr from; socklen_t from_len; - + #define ADD_CHAR(c) \ obuf[ob_wpx] = c; \ ob_wpx = (ob_wpx + 1) % sizeof(obuf); \ if (ob_wpx == ob_rp) goto kissencerr; - + #define ADD_KISSCHAR(c) \ if (((c) & 0xff) == KISS_FEND) \ { ADD_CHAR(KISS_FESC); ADD_CHAR(KISS_TFEND); } \ else if (((c) & 0xff) == KISS_FESC) \ { ADD_CHAR(KISS_FESC); ADD_CHAR(KISS_TFESC); } \ else { ADD_CHAR(c); } - + for (;;) { FD_ZERO(&rmask); FD_ZERO(&wmask); @@ -436,9 +436,9 @@ static int doio(int fdif, int fdpty, char *ifaddr) die("select"); if (FD_ISSET(fdpty, &wmask)) { if (ob_rp > ob_wp) - i = write(fdpty, obuf+ob_rp, + i = write(fdpty, obuf+ob_rp, sizeof(obuf)-ob_rp); - else + else i = write(fdpty, obuf+ob_rp, ob_wp - ob_rp); if (i < 0) die("write"); @@ -468,7 +468,7 @@ static int doio(int fdif, int fdpty, char *ifaddr) } if (*bp == KISS_FEND) { kiss_packet(fdif, ifaddr, - pktbuf, + pktbuf, pktptr - pktbuf); pktptr = pktbuf; break; @@ -499,7 +499,7 @@ static int doio(int fdif, int fdpty, char *ifaddr) pktstate = KISS_RX; break; } - } + } } if (FD_ISSET(fdif, &rmask)) { from_len = sizeof(from); @@ -602,7 +602,7 @@ int main(int argc, char *argv[]) slavename[5] = 'p'; master_name = slavename; } else { - if ((fdpty = open(name_pname, + if ((fdpty = open(name_pname, O_RDWR | O_NOCTTY | O_NONBLOCK)) < 0) { fprintf(stderr, "%s: cannot open \"%s\"\n", progname, name_pname); @@ -612,17 +612,17 @@ int main(int argc, char *argv[]) i_am_unix98_pty_master = 1; master_name = name_pname; } - if ((fdif = socket(PF_INET, SOCK_PACKET, proto)) < 0) + if ((fdif = socket(PF_INET, SOCK_PACKET, proto)) < 0) die("socket"); memset(&sa, 0, sizeof(struct sockaddr)); memcpy(sa.sa_data, name_iface, sizeof(sa.sa_data)); sa.sa_family = AF_INET; if (bind(fdif, &sa, sizeof(struct sockaddr)) < 0) - die("bind"); + die("bind"); memcpy(ifr.ifr_name, name_iface, IFNAMSIZ); if (ioctl(fdif, SIOCGIFFLAGS, &ifr) < 0) die("ioctl SIOCGIFFLAGS"); - ifr_new = ifr; + ifr_new = ifr; ifr_new.ifr_flags |= if_newflags; if (ioctl(fdif, SIOCSIFFLAGS, &ifr_new) < 0) die("ioctl SIOCSIFFLAGS"); diff --git a/netrom/Makefile.am b/netrom/Makefile.am index ffc3984..97e1741 100644 --- a/netrom/Makefile.am +++ b/netrom/Makefile.am @@ -1,5 +1,5 @@ -etcfiles = nrbroadcast +etcfiles = nrbroadcast installconf: $(mkinstalldirs) $(DESTDIR)$(AX25_SYSCONFDIR) @@ -22,11 +22,11 @@ netromd_SOURCES = \ netromd.c \ netromd.h \ netromr.c \ - netromt.c + netromt.c INCLUDES = -DAX25_SYSCONFDIR=\""$(AX25_SYSCONFDIR)"\" \ - -DAX25_LOCALSTATEDIR=\""$(AX25_LOCALSTATEDIR)"\" + -DAX25_LOCALSTATEDIR=\""$(AX25_LOCALSTATEDIR)"\" AX25_SYSCONFDIR=${sysconfdir}/ax25/ AX25_LOCALSTATEDIR=${localstatedir}/ax25/ diff --git a/netrom/netrom.4 b/netrom/netrom.4 index cceae77..a472972 100644 --- a/netrom/netrom.4 +++ b/netrom/netrom.4 @@ -27,7 +27,7 @@ NET/ROM has some unusual properties. Notably in a multi-user system an AX.25 address is often associated with a user, and some users may not have such an association. a set of ioctl calls are provided to manage an association table. -.LP +.LP NET/ROM supports the following socket options for SOL_NETROM. NETROM_T1 is the T1 timer in 1/10ths of a second, NETROM_T2 is the T2 timer in 1/10ths of a second. NETROM_N2, the retry counter is also configurable. There is no 'infinite diff --git a/netrom/netromd.c b/netrom/netromd.c index e7a0362..a78db4b 100644 --- a/netrom/netromd.c +++ b/netrom/netromd.c @@ -17,7 +17,7 @@ #include -#ifdef __GLIBC__ +#ifdef __GLIBC__ #include #else #include @@ -51,7 +51,7 @@ static void terminate(int sig) syslog(LOG_INFO, "terminating on SIGTERM\n"); closelog(); } - + exit(0); } @@ -59,12 +59,12 @@ static int bcast_config_load_ports(void) { char buffer[255], port[32], *s; FILE *fp; - + if ((fp = fopen(CONF_NETROMD_FILE, "r")) == NULL) { fprintf(stderr, "netromd: cannot open config file\n"); return -1; } - + while (fgets(buffer, 255, fp) != NULL) { if ((s = strchr(buffer, '\n')) != NULL) *s = '\0'; @@ -109,16 +109,16 @@ static int bcast_config_load_ports(void) fprintf(stderr, "netromd: invalid verbose setting\n"); return -1; } - + port_count++; } - + fclose(fp); if (port_count == 0) return -1; - - return 0; + + return 0; } int main(int argc, char **argv) @@ -187,7 +187,7 @@ int main(int argc, char **argv) fprintf(stderr, "netromd: no AX.25 ports defined\n"); return 1; } - + if (nr_config_load_ports() == 0) { fprintf(stderr, "netromd: no NET/ROM ports defined\n"); return 1; @@ -200,7 +200,7 @@ int main(int argc, char **argv) ax25_aton_entry(nr_config_get_addr(NULL), (char *)&my_call); ax25_aton_entry("NODES", (char *)&node_call); - + if ((s = socket(PF_PACKET, SOCK_PACKET, htons(ETH_P_AX25))) == -1) { perror("netromd: socket"); return 1; @@ -210,7 +210,7 @@ int main(int argc, char **argv) fprintf(stderr, "netromd: cannot become a daemon\n"); return 1; } - + if (logging) { openlog("netromd", LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "starting"); @@ -222,7 +222,7 @@ int main(int argc, char **argv) timeout.tv_sec = 30; timeout.tv_usec = 0; - + if (select(s + 1, &fdset, NULL, NULL, &timeout) == -1) continue; /* Signal received ? */ @@ -238,7 +238,7 @@ int main(int argc, char **argv) } if (ax25_cmp((ax25_address *)(buffer + 1), &node_call) == 0 && - ax25_cmp((ax25_address *)(buffer + 8), &my_call) != 0 && + ax25_cmp((ax25_address *)(buffer + 8), &my_call) != 0 && buffer[16] == NETROM_PID && buffer[17] == NODES_SIG) { for (i = 0; i < port_count; i++) { if (strcmp(port_list[i].device, sa.sa_data) == 0) { diff --git a/netrom/netromr.c b/netrom/netromr.c index 9ed716f..3cbaeb4 100644 --- a/netrom/netromr.c +++ b/netrom/netromr.c @@ -14,7 +14,7 @@ #include #include -#ifdef __GLIBC__ +#ifdef __GLIBC__ #include #else #include @@ -160,7 +160,7 @@ void receive_nodes(unsigned char *buffer, int length, ax25_address *neighbour, i } fgets(neigh_buffer, 90, fp); - + obs_count = atoi(neigh_buffer); fclose(fp); @@ -179,7 +179,7 @@ void receive_nodes(unsigned char *buffer, int length, ax25_address *neighbour, i } fgets(neigh_buffer, 90, fp); - + portcall = ax25_ntoa(neighbour); quality = port_list[index].default_qual; diff --git a/netrom/netromt.c b/netrom/netromt.c index b3f99b3..d74b091 100644 --- a/netrom/netromt.c +++ b/netrom/netromt.c @@ -26,7 +26,7 @@ static int build_header(unsigned char *message) { message[0] = NODES_SIG; - + strcpy(message + 1, nr_config_get_alias(NULL)); strncat(message + 1, " ", MNEMONIC_LEN - strlen(message + 1)); @@ -83,12 +83,12 @@ static void build_mine(int s, struct full_sockaddr_ax25 *dest, int dlen, int loc } fclose(fp); - + if (sendto(s, message, len, 0, (struct sockaddr *)dest, dlen) == -1) { if (logging) syslog(LOG_ERR, "netromt: sendto: %m"); } - + sleep(pause); } @@ -129,7 +129,7 @@ static void build_others(int s, int min_obs, struct full_sockaddr_ax25 *dest, in obs_count = atoi(strtok(NULL, " ")); neigh_no = atoi(strtok(NULL, " ")); neighbour = NULL; - + if (obs_count < min_obs || quality == 0) continue; /* "Blank" mnemonic */ @@ -139,7 +139,7 @@ static void build_others(int s, int min_obs, struct full_sockaddr_ax25 *dest, in fseek(fpneigh, 0L, SEEK_SET); fgets(neigh_buffer, 90, fpneigh); - + while (fgets(neigh_buffer, 90, fpneigh) != NULL) { if (atoi(strtok(neigh_buffer, " ")) == neigh_no) { neighbour = strtok(NULL, " "); @@ -172,7 +172,7 @@ static void build_others(int s, int min_obs, struct full_sockaddr_ax25 *dest, in } len += CALLSIGN_LEN; - message[len] = quality; + message[len] = quality; len += QUALITY_LEN; /* No room for another entry? */ @@ -186,7 +186,7 @@ static void build_others(int s, int min_obs, struct full_sockaddr_ax25 *dest, in if (logging) syslog(LOG_ERR, "netromt: sendto: %m"); } - + sleep(pause); } 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; } diff --git a/netrom/nrparms.c b/netrom/nrparms.c index ff8b60e..b179416 100644 --- a/netrom/nrparms.c +++ b/netrom/nrparms.c @@ -64,12 +64,12 @@ void nodes(int s, char *nodecall, char *op, char *ident, int quality, int count, close(s); exit(1); } - + if (strcmp(ident, "*") != 0) { for (p = ident, q = nr_node.mnemonic; *p != '\0'; p++, q++) *q = toupper(*p); *q = '\0'; - + if (strspn(nr_node.mnemonic, "&#-_/ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") != strlen(nr_node.mnemonic)) { fprintf(stderr, "nrparms: nodes: invalid ident %s\n", ident); close(s); @@ -101,7 +101,7 @@ void nodes(int s, char *nodecall, char *op, char *ident, int quality, int count, } strcpy(nr_node.device, dev); - + nr_node.quality = quality; nr_node.obs_count = count; @@ -192,7 +192,7 @@ void routes(int s, char *port, char *nodecall, char *rest[]) int main(int argc, char *argv[]) { int s; - + if (argc == 1) { fprintf(stderr, "usage: nrparms -nodes|-routes|-version ...\n"); return 1; @@ -202,12 +202,12 @@ int main(int argc, char *argv[]) printf("nrparms: %s\n", VERSION); return 0; } - + if ((s = socket(AF_NETROM, SOCK_SEQPACKET, 0)) < 0) { perror("nrparms: socket"); return 1; } - + if (strncmp(argv[1], "-n", 2) == 0) { if (argc < 9) { fprintf(stderr, nodes_usage); @@ -231,8 +231,8 @@ int main(int argc, char *argv[]) } fprintf(stderr, "usage: nrparms -nodes|-routes|-version ...\n"); - + close(s); - + return 1; } diff --git a/netrom/nrsdrv.c b/netrom/nrsdrv.c index 92b3d6a..4383f84 100644 --- a/netrom/nrsdrv.c +++ b/netrom/nrsdrv.c @@ -145,7 +145,7 @@ static void nrs_esc(unsigned char *s, int len) *ptr++ = c; break; } - + csum += c; } @@ -192,7 +192,7 @@ static void kiss_esc(unsigned char *s, int len) static void nrs_unesc(unsigned char *buffer, int len) { int i; - + for (i = 0; i < len; i++) { switch (nrs_state) { case NRS_WAIT: @@ -204,7 +204,7 @@ static void nrs_unesc(unsigned char *buffer, int len) break; case NRS_DATA: - switch (buffer[i]) { + switch (buffer[i]) { case STX: /* !! */ nrs_rxcount = 0; nrs_cksum = 0; @@ -225,7 +225,7 @@ static void nrs_unesc(unsigned char *buffer, int len) break; case NRS_ESCAPE: - nrs_state = NRS_DATA; + nrs_state = NRS_DATA; if (nrs_rxcount < 512) { nrs_cksum += buffer[i]; nrs_rxbuffer[nrs_rxcount++] = buffer[i]; @@ -246,7 +246,7 @@ static void nrs_unesc(unsigned char *buffer, int len) static void kiss_unesc(unsigned char *buffer, int len) { int i; - + for (i = 0; i < len; i++) { switch (kiss_state) { case KISS_WAIT: @@ -267,7 +267,7 @@ static void kiss_unesc(unsigned char *buffer, int len) break; case KISS_DATA: - switch (buffer[i]) { + switch (buffer[i]) { case FEND: if (kiss_rxcount > 2) nrs_esc(kiss_rxbuffer, kiss_rxcount); @@ -336,7 +336,7 @@ int main(int argc, char *argv[]) } if (debugging) { - fprintf(stderr,"Flow control %s\n", + fprintf(stderr,"Flow control %s\n", flowcontrol ? "enabled" : "disabled"); } @@ -399,7 +399,7 @@ int main(int argc, char *argv[]) openlog("nrsdrv", LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "KISS device %s connected to NRS device %s\n", argv[optind + 0], argv[optind + 1]); } - + signal(SIGHUP, SIG_IGN); signal(SIGTERM, terminate); @@ -421,7 +421,7 @@ int main(int argc, char *argv[]) for (;;) { FD_ZERO(&read_fd); - + FD_SET(kissfd, &read_fd); FD_SET(nrsfd, &read_fd); @@ -437,7 +437,7 @@ int main(int argc, char *argv[]) } kiss_unesc(buffer, n); } - + if (FD_ISSET(nrsfd, &read_fd)) { if ((n = read(nrsfd, buffer, 512)) <= 0) { if (logging) { diff --git a/rose/Makefile.am b/rose/Makefile.am index 1729e9a..2a2e95b 100644 --- a/rose/Makefile.am +++ b/rose/Makefile.am @@ -1,9 +1,9 @@ -sbin_PROGRAMS = rsattach rsdwnlnk rsmemsiz rsparms rsuplnk +sbin_PROGRAMS = rsattach rsdwnlnk rsmemsiz rsparms rsuplnk LDADD = $(AX25_LIB) -rsmemsiz_LDADD = +rsmemsiz_LDADD = sbin_SCRIPTS = rsusers.sh @@ -13,7 +13,7 @@ dist_man_MANS = rose.4 rsattach.8 rsparms.8 rsdwnlnk.8 rsuplnk.8 EXTRA_DIST = $(sbin_SCRIPTS) INCLUDES = -DAX25_SYSCONFDIR=\""$(AX25_SYSCONFDIR)"\" \ - -DAX25_LOCALSTATEDIR=\""$(AX25_LOCALSTATEDIR)"\" + -DAX25_LOCALSTATEDIR=\""$(AX25_LOCALSTATEDIR)"\" AX25_SYSCONFDIR=${sysconfdir}/ax25/ AX25_LOCALSTATEDIR=${localstatedir}/ax25/ diff --git a/rose/rose.4 b/rose/rose.4 index a06f324..7904017 100644 --- a/rose/rose.4 +++ b/rose/rose.4 @@ -24,7 +24,7 @@ Rose has some unusual properties. Notably in a multi-user system an AX.25 address is often associated with a user, and some users may not have such an association. a set of ioctl calls are provided to manage an association table. -.LP +.LP Rose supports the following socket options for SOL_ROSE. ROSE_T1 is the T11/T21 timer in 1/10ths of a second, ROSE_T2 is the T12/T22 timer in 1/10ths of a second. ROSE_T3, is the T13/T23 timer in 1/10ths of a second. diff --git a/rose/rsattach.c b/rose/rsattach.c index 924d152..62892d8 100644 --- a/rose/rsattach.c +++ b/rose/rsattach.c @@ -35,7 +35,7 @@ int readconfig(char *port) FILE *fp; char buffer[90], *s; int n = 0; - + if ((fp = fopen(CONF_RSPORTS_FILE, "r")) == NULL) { fprintf(stderr, "rsattach: cannot open rsports file\n"); return FALSE; @@ -43,7 +43,7 @@ int readconfig(char *port) while (fgets(buffer, 90, fp) != NULL) { n++; - + if ((s = strchr(buffer, '\n')) != NULL) *s = '\0'; @@ -54,10 +54,10 @@ int readconfig(char *port) fprintf(stderr, "rsattach: unable to parse line %d of the rsports file\n", n); return FALSE; } - + if (strcmp(s, port) != 0) continue; - + if ((s = strtok(NULL, " \t\r\n")) == NULL) { fprintf(stderr, "rsattach: unable to parse line %d of the rsports file\n", n); return FALSE; @@ -66,14 +66,14 @@ int readconfig(char *port) address = strdup(s); fclose(fp); - + return TRUE; } - + fclose(fp); fprintf(stderr, "rsattach: cannot find port %s in rsports\n", port); - + return FALSE; } @@ -82,7 +82,7 @@ int getfreedev(char *dev) struct ifreq ifr; int fd; int i; - + if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { perror("rsattach: socket"); return FALSE; @@ -91,7 +91,7 @@ int getfreedev(char *dev) for (i = 0; i < 6; i++) { sprintf(dev, "rose%d", i); strcpy(ifr.ifr_name, dev); - + if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) { perror("rsattach: SIOCGIFFLAGS"); return FALSE; @@ -113,17 +113,17 @@ int startiface(char *dev, struct hostent *hp) struct ifreq ifr; char addr[5]; int fd; - + if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { perror("rsattach: 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]; @@ -143,7 +143,7 @@ int startiface(char *dev, struct hostent *hp) ifr.ifr_hwaddr.sa_family = ARPHRD_ROSE; memcpy(ifr.ifr_hwaddr.sa_data, addr, 5); - + if (ioctl(fd, SIOCSIFHWADDR, &ifr) != 0) { perror("rsattach: SIOCSIFHWADDR"); return FALSE; @@ -169,12 +169,12 @@ int startiface(char *dev, struct hostent *hp) perror("rsattach: SIOCSIFFLAGS"); return FALSE; } - + close(fd); - + return TRUE; } - + int main(int argc, char *argv[]) { @@ -199,7 +199,7 @@ int main(int argc, char *argv[]) return 1; } } - + if ((argc - optind) != 1) { fprintf(stderr, "usage: rsattach [-i inetaddr] [-v] port\n"); return 1; @@ -212,11 +212,11 @@ int main(int argc, char *argv[]) fprintf(stderr, "rsattach: cannot find free Rose device\n"); return 1; } - + if (!startiface(dev, hp)) - return 1; + return 1; printf("Rose port %s bound to device %s\n", argv[optind], dev); - + return 0; } diff --git a/rose/rsdwnlnk.8 b/rose/rsdwnlnk.8 index f0d4c2d..db1a601 100644 --- a/rose/rsdwnlnk.8 +++ b/rose/rsdwnlnk.8 @@ -23,7 +23,7 @@ you need an entry in to listen for incoming ROSE connections to any callsigns that are not matched by the more specific ROSE entries. In the example below, I will be listening for ROSE connections on my ROSE port rs144, the exiting AX.25 -connection will be via the associated AX.25 port, 144, using the callsign +connection will be via the associated AX.25 port, 144, using the callsign KE4GAJ-10. Please note that the callsign should be on the same line as the rest of the command, it may be wrapped onto the next line on your screen. .LP diff --git a/rose/rsdwnlnk.c b/rose/rsdwnlnk.c index 9ff6f31..8c7bb08 100644 --- a/rose/rsdwnlnk.c +++ b/rose/rsdwnlnk.c @@ -114,7 +114,7 @@ int main(int argc, char **argv) return 1; } axconnect.fsa_digipeater[n].ax25_call[6] |= AX25_HBIT; - n++; + n++; } /* @@ -127,7 +127,7 @@ int main(int argc, char **argv) return 1; } axconnect.fsa_digipeater[n].ax25_call[6] |= AX25_HBIT; - n++; + n++; /* * And my local ROSE callsign. @@ -215,9 +215,9 @@ int main(int argc, char **argv) close(s); write(STDOUT_FILENO, buffer, strlen(buffer)); - + sleep(20); - + return 0; } @@ -236,7 +236,7 @@ int main(int argc, char **argv) FD_ZERO(&read_fd); FD_SET(STDIN_FILENO, &read_fd); FD_SET(s, &read_fd); - + select(s + 1, &read_fd, NULL, NULL, NULL); if (FD_ISSET(s, &read_fd)) { diff --git a/rose/rsmemsiz.c b/rose/rsmemsiz.c index c71737c..bdddb45 100644 --- a/rose/rsmemsiz.c +++ b/rose/rsmemsiz.c @@ -54,7 +54,7 @@ static char buf[300]; int uptime(double *uptime_secs, double *idle_secs) { double up=0, idle=0; - + FILE_TO_BUF(UPTIME_FILE) if (sscanf(buf, "%lf %lf", &up, &idle) < 2) { fprintf(stdout, "ERROR: Bad data in %s\r", UPTIME_FILE); @@ -67,7 +67,7 @@ int uptime(double *uptime_secs, double *idle_secs) { int loadavg(double *av1, double *av5, double *av15) { double avg_1=0, avg_5=0, avg_15=0; - + FILE_TO_BUF(LOADAVG_FILE) if (sscanf(buf, "%lf %lf %lf", &avg_1, &avg_5, &avg_15) < 3) { fprintf(stdout, "ERROR: Bad data in %s\r", LOADAVG_FILE); @@ -83,7 +83,7 @@ int loadavg(double *av1, double *av5, double *av15) { [