summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--6pack/Makefile.am7
-rw-r--r--6pack/m6pack.82
-rw-r--r--6pack/m6pack.c47
-rw-r--r--AUTHORS4
-rw-r--r--ChangeLog6
-rw-r--r--Makefile.am2
-rw-r--r--NEWS2
-rw-r--r--README4
-rw-r--r--ax25/Makefile.am8
-rw-r--r--ax25/access.c78
-rw-r--r--ax25/access.h9
-rw-r--r--ax25/ax25.42
-rw-r--r--ax25/ax25d.c806
-rw-r--r--ax25/axctl.c11
-rw-r--r--ax25/axgetput/Makefile.am11
-rw-r--r--ax25/axgetput/axgetput.c555
-rw-r--r--ax25/axgetput/proto_bin.c842
-rw-r--r--ax25/axgetput/util.c71
-rw-r--r--ax25/axparms.88
-rw-r--r--ax25/axparms.c48
-rw-r--r--ax25/axspawn.86
-rw-r--r--ax25/axspawn.c946
-rw-r--r--ax25/beacon.c66
-rw-r--r--ax25/bpqparms.c98
-rw-r--r--ax25/md5.c274
-rw-r--r--ax25/md5.h8
-rw-r--r--ax25/mheard.c268
-rw-r--r--ax25/mheardd.82
-rw-r--r--ax25/mheardd.c249
-rw-r--r--ax25/rxecho.c54
-rw-r--r--dmascc/Makefile.am7
-rw-r--r--dmascc/dmascc_cfg.16
-rw-r--r--dmascc/dmascc_cfg.c506
-rw-r--r--hdlcutil/Makefile.am7
-rw-r--r--hdlcutil/baycom.910
-rw-r--r--hdlcutil/fl/xfhdlcchpar_main.cxx6
-rw-r--r--hdlcutil/fl/xfhdlcst_main.cxx10
-rw-r--r--hdlcutil/fl/xfsmdiag.cxx40
-rw-r--r--hdlcutil/fl/xfsmdiag_main.cxx44
-rw-r--r--hdlcutil/fl/xfsmmixer.cxx202
-rw-r--r--hdlcutil/fl/xfsmmixer_main.cxx24
-rw-r--r--hdlcutil/hdlcdrv.936
-rw-r--r--hdlcutil/hdrvcomm.c54
-rw-r--r--hdlcutil/hdrvcomm.h26
-rw-r--r--hdlcutil/sethdlc.816
-rw-r--r--hdlcutil/sethdlc.c122
-rw-r--r--hdlcutil/smdiag.84
-rw-r--r--hdlcutil/smdiag.c198
-rw-r--r--hdlcutil/smmixer.c132
-rw-r--r--hdlcutil/soundmodem.98
-rw-r--r--hdlcutil/soundmodem.h2
-rw-r--r--hdlcutil/usersmdiag.h6
-rw-r--r--kiss/Makefile.am8
-rw-r--r--kiss/kissattach.c106
-rw-r--r--kiss/kissnetd.c96
-rw-r--r--kiss/kissparms.82
-rw-r--r--kiss/kissparms.c164
-rw-r--r--kiss/mkiss.c51
-rw-r--r--kiss/net2kiss.c121
-rw-r--r--netrom/Makefile.am11
-rw-r--r--netrom/netrom.42
-rw-r--r--netrom/netromd.c106
-rw-r--r--netrom/netromr.c8
-rw-r--r--netrom/netromt.c30
-rw-r--r--netrom/nodesave.c22
-rw-r--r--netrom/nrattach.c78
-rw-r--r--netrom/nrparms.c16
-rw-r--r--netrom/nrsdrv.c278
-rw-r--r--pathnames.h2
-rw-r--r--rose/Makefile.am10
-rw-r--r--rose/rose.42
-rw-r--r--rose/rsattach.c64
-rw-r--r--rose/rsdwnlnk.82
-rw-r--r--rose/rsdwnlnk.c34
-rw-r--r--rose/rsmemsiz.c60
-rw-r--r--rose/rsparms.c10
-rw-r--r--rose/rsuplnk.c48
-rw-r--r--[-rwxr-xr-x]rose/rsusers.sh1
-rw-r--r--tcpip/Makefile.am9
-rw-r--r--tcpip/rip98d.c78
-rw-r--r--tcpip/rip98r.c68
-rw-r--r--tcpip/rip98t.c4
-rw-r--r--tcpip/ttylinkd.88
-rw-r--r--tcpip/ttylinkd.c206
-rw-r--r--tcpip/ttylinkd.conf1
-rw-r--r--tcpip/ttylinkd.conf.53
-rw-r--r--user_call/Makefile.am7
-rw-r--r--user_call/ax25_call.82
-rw-r--r--user_call/ax25_call.c24
-rw-r--r--user_call/netrom_call.c24
-rw-r--r--user_call/rose_call.c24
-rw-r--r--user_call/user_io.c6
-rw-r--r--yamdrv/Makefile.am5
-rw-r--r--yamdrv/README.yamdrv54
-rw-r--r--yamdrv/mcs2h.c30
95 files changed, 3896 insertions, 3949 deletions
diff --git a/6pack/Makefile.am b/6pack/Makefile.am
index 014cfe2..a5ad261 100644
--- a/6pack/Makefile.am
+++ b/6pack/Makefile.am
@@ -5,16 +5,13 @@ sbin_PROGRAMS = m6pack
LDADD= $(AX25_LIB)
-man_MANS = m6pack.8
-
-EXTRA_DIST = $(man_MANS)
+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/
install-exec-hook:
(cd $(DESTDIR)$(sbindir))
-
diff --git a/6pack/m6pack.8 b/6pack/m6pack.8
index 7ed202c..7963054 100644
--- a/6pack/m6pack.8
+++ b/6pack/m6pack.8
@@ -48,7 +48,7 @@ This option is for Unix98 PTYs. It allocates "number" ptys; their names are writ
.BR ifconfig (8),
.BR kill (1).
.SH AUTHORS
-Iņaki Arenaza EB2EBU <iarenaza@escomposlinux.org>, based in the work by:
+I.aki Arenaza EB2EBU <iarenaza@escomposlinux.org>, based in the work by:
.br
Tomi Manninen OH2BNS <oh2bns@sral.fi>
.br
diff --git a/6pack/m6pack.c b/6pack/m6pack.c
index e5ee2ee..e698ef3 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
@@ -67,7 +67,7 @@ typedef enum {data, command} frame_t;
static __u8 ibuf[SIZE]; /* buffer for input operations */
static __u8 obuf[SIZE]; /* buffer for sixpack_tx() */
-static int invalid_ports = 0;
+static int invalid_ports;
static char *usage_string = "usage: m6pack [-l] [-s speed] [-x num_ptmx_devices] [-v] tyinterface pty ..\n";
@@ -95,7 +95,7 @@ struct iface
unsigned long rxbytes; /* RX bytes count */
unsigned long txbytes; /* TX bytes count */
char namepts[PATH_MAX]; /* name of the unix98 pts slaves, which
- * the client has to use */
+ * the client has to use */
};
#define PTY_ID_TTY (-1)
@@ -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);
@@ -408,7 +408,6 @@ static void report(struct iface *tty, struct iface **pty, int numptys)
pty[i]->rxpackets, pty[i]->rxbytes,
pty[i]->errors);
}
- return;
}
int main(int argc, char *argv[])
@@ -459,7 +458,7 @@ int main(int argc, char *argv[])
return 1;
}
- numptys = argc - optind - 1;
+ numptys = argc - optind - 1;
if (numptys + ptmxdevices > MAX_PTYS) {
fprintf(stderr, "m6pack: max %d pty interfaces allowed.\n",
@@ -620,7 +619,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 +632,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 <t.sailer@alumni.ethz.ch>
smdiag Thomas Sailer HB9JNX <t.sailer@alumni.ethz.ch>
smmixer Thomas Sailer HB9JNX <t.sailer@alumni.ethz.ch>
ttylinkd Craig Small VK2XLZ <csmall@small.dropbear.id.au>
-dmascc_cfg Klaus Kudielka
+dmascc_cfg Klaus Kudielka
xfhdlcchpar Thomas Sailer HB9JNX <t.sailer@alumni.ethz.ch>
xfhdlcst Thomas Sailer HB9JNX <t.sailer@alumni.ethz.ch>
xfsmdiag Thomas Sailer HB9JNX <t.sailer@alumni.ethz.ch>
xfsmmixer Thomas Sailer HB9JNX <t.sailer@alumni.ethz.ch>
-yamcfg Jean-Paul Roubelat F6FBB <jpr@f6fbb.org>
+yamcfg Jean-Paul Roubelat F6FBB <jpr@f6fbb.org>
All others Jonathon Naylor G4KLX <g4klx@g4klx.demon.co.uk>
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 <ralf@linux-mips.org> 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 <csmall@small.dropbear.id.au>
+ -- Craig Small <csmall@small.dropbear.id.au>
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 <csmall@small.dropbear.id.au> 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/NEWS b/NEWS
index 51c9a85..3605bda 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1 @@
This is some news about ax25-tools
-
-
diff --git a/README b/README
index 293e64f..4867f61 100644
--- a/README
+++ b/README
@@ -4,10 +4,8 @@ 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.
- Craig Small <csmall@small.dropbear.id.au>
-
-
diff --git a/ax25/Makefile.am b/ax25/Makefile.am
index f5c0ebb..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,18 +24,18 @@ 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/
-man_MANS = ax25.4 ax25d.conf.5 axspawn.conf.5 rxecho.conf.5 \
+dist_man_MANS = ax25.4 ax25d.conf.5 axspawn.conf.5 rxecho.conf.5 \
ax25d.8 axctl.8 axparms.8 axspawn.8 beacon.8 bpqparms.8 \
mheard.1 mheardd.8 rxecho.8
-EXTRA_DIST = $(man_MANS) $(etcfiles) $(varfiles)
+EXTRA_DIST = $(etcfiles) $(varfiles)
ax25d_SOURCES = ax25d.c
axctl_SOURCES = axctl.c
diff --git a/ax25/access.c b/ax25/access.c
index bf02b04..5a588db 100644
--- a/ax25/access.c
+++ b/ax25/access.c
@@ -32,7 +32,7 @@ static void char_to_hex(char *c, char *h, int n);
int conv_rand(void)
{
seed = (1103515245L * seed + 12345) & CONV_RAND_MAX;
- return ((int) (seed & 077777));
+ return (int) (seed & 077777);
}
/*--------------------------------------------------------------------------*/
@@ -46,7 +46,7 @@ void conv_randomize(void)
int conv_random(int num, int base)
{
- return (((long) (conv_rand() * time(0)) & CONV_RAND_MAX) % num + base);
+ return ((long) (conv_rand() * time(0)) & CONV_RAND_MAX) % num + base;
}
/*--------------------------------------------------------------------------*/
@@ -82,23 +82,23 @@ char *generate_rand_pw(int len)
if (len > PASSSIZE)
len = PASSSIZE;
- for (i = 0; i < len; i++) {
- j = conv_random(10+26*2, 0);
- if (j < 10) {
- pass[i] = j + '0';
- continue;
- }
- j -= 10;
- if (j < 26) {
- pass[i] = j + 'A';
+ for (i = 0; i < len; i++) {
+ j = conv_random(10+26*2, 0);
+ if (j < 10) {
+ pass[i] = j + '0';
continue;
- }
- j -= 26;
- pass[i] = j + 'a';
- }
- pass[len] = 0;
+ }
+ j -= 10;
+ if (j < 26) {
+ pass[i] = j + 'A';
+ continue;
+ }
+ j -= 26;
+ pass[i] = j + 'a';
+ }
+ pass[len] = 0;
- return pass;
+ return pass;
}
/*--------------------------------------------------------------------------*/
@@ -178,28 +178,28 @@ void ask_pw_md5(char *prompt, char *pass_want, char *pw)
void calc_md5_pw (const char *MD5prompt, const char *MD5pw, char *MD5result)
{
- MD5_CTX context;
- short i, n, len;
- char buffer[1024];
+ MD5_CTX context;
+ short i, n, len;
+ char buffer[1024];
- strncpy(buffer, MD5prompt, 10);
- buffer[10] = 0;
- strcat(buffer, MD5pw);
+ strncpy(buffer, MD5prompt, 10);
+ buffer[10] = 0;
+ strcat(buffer, MD5pw);
- MD5Init(&context);
+ MD5Init(&context);
- len = strlen(buffer);
- for (i= 0; i < len; i += 16) {
- n = (len - i) > 16 ? 16 : (len - i);
- MD5Update(&context, buffer+i, n);
- }
+ len = strlen(buffer);
+ for (i= 0; i < len; i += 16) {
+ n = (len - i) > 16 ? 16 : (len - i);
+ MD5Update(&context, buffer+i, n);
+ }
- MD5Final(&context);
+ MD5Final(&context);
- MD5result[0] = '\0';
- for (i = 0; i < 16; i++) {
- MD5result[i] = context.digest[i];
- }
+ MD5result[0] = '\0';
+ for (i = 0; i < 16; i++) {
+ MD5result[i] = context.digest[i];
+ }
}
/*--------------------------------------------------------------------------*/
@@ -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));
@@ -357,7 +357,7 @@ char *read_pwd (struct passwd *pw, int *pwtype)
for (p = pass; *p && !isspace(*p & 0xff); p++) ;
*p = 0;
- if ( (*pwtype & PW_MD5) && !Strcasecmp(p_buf, "md5") ) {
+ if ( (*pwtype & PW_MD5) && !Strcasecmp(p_buf, "md5") ) {
fclose(f);
*pwtype = PW_MD5;
goto found;
@@ -373,7 +373,7 @@ char *read_pwd (struct passwd *pw, int *pwtype)
}
}
found:
-
+
if (!pass || !*pwtype)
goto end;
@@ -391,6 +391,6 @@ found:
end:
*pwtype = (((*pwtype) & PW_CLEARTEXT) ? PW_CLEARTEXT : 0);
- /* ^ may allow cleartext? - then cleartext, else deny */
+ /* ^ may allow cleartext? - then cleartext, else deny */
return 0;
}
diff --git a/ax25/access.h b/ax25/access.h
index 4901418..8859262 100644
--- a/ax25/access.h
+++ b/ax25/access.h
@@ -8,13 +8,12 @@
#define PWFILE "bcpasswd"
/* PWxxx: set bits */
-#define PW_CLEARTEXT 1
-#define PW_SYS 2
-#define PW_MD5 4
-#define PW_UNIX 8
+#define PW_CLEARTEXT 1
+#define PW_SYS 2
+#define PW_MD5 4
+#define PW_UNIX 8
void ask_pw_sys(char *prompt, char *pass_want, char *pw);
void ask_pw_md5(char *prompt, char *pass_want, char *pw);
char *read_pwd (struct passwd *pw, int *pwtype);
#endif
-
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 899e04e..4694fb9 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 *].
@@ -182,7 +182,7 @@ struct axlist { /* Have used same struct for quickness */
int LoggingVC; /* extra log stuff */
};
-static struct axlist *AXL = NULL;
+static struct axlist *AXL;
static char *ConfigFile = CONF_AX25D_FILE;
static char User[10]; /* Room for 'GB9ZZZ-15\0' */
static char Node[11]; /* Room for 'GB9ZZZ-15\0' (NETROM) and 10 bytes ROSE '6505551234\0' */
@@ -228,7 +228,7 @@ void err_config(void) {
if (Logging)
syslog(LOG_INFO, "config file reload error, continuing with original");
}
-}
+}
/*--------------------------------------------------------------------------*/
@@ -265,24 +265,24 @@ 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':
- ConfigFile = optarg;
- break;
+ case 'c':
+ ConfigFile = optarg;
+ break;
- case 'l':
- Logging = TRUE;
- break;
+ case 'l':
+ Logging = TRUE;
+ break;
- case 'v':
- printf("ax25d: %s\n", VERSION);
- return 1;
+ case 'v':
+ printf("ax25d: %s\n", VERSION);
+ return 1;
- default:
- fprintf(stderr, "Usage: ax25d [-v] [-c altfile] [-l]\n");
- return 1;
+ default:
+ fprintf(stderr, "Usage: ax25d [-v] [-c altfile] [-l]\n");
+ return 1;
}
}
@@ -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,22 +368,22 @@ int main(int argc, char *argv[])
close(paxl->fd);
paxl->fd = -1;
reload_timer(10);
- continue;
+ continue;
}
switch (paxl->af_type) {
- case AF_AX25:
- strcpy(User, ax25_ntoa(&sockaddr.ax25.fsa_ax25.sax25_call));
- strcpy(Node, "");
- break;
- case AF_NETROM:
- strcpy(User, ax25_ntoa(&sockaddr.ax25.fsa_ax25.sax25_call));
- strcpy(Node, ax25_ntoa(&sockaddr.ax25.fsa_digipeater[0]));
- break;
- case AF_ROSE:
- strcpy(User, ax25_ntoa(&sockaddr.rose.srose_call));
- strcpy(Node, rose_ntoa(&sockaddr.rose.srose_addr));
- break;
+ case AF_AX25:
+ strcpy(User, ax25_ntoa(&sockaddr.ax25.fsa_ax25.sax25_call));
+ strcpy(Node, "");
+ break;
+ case AF_NETROM:
+ strcpy(User, ax25_ntoa(&sockaddr.ax25.fsa_ax25.sax25_call));
+ strcpy(Node, ax25_ntoa(&sockaddr.ax25.fsa_digipeater[0]));
+ break;
+ case AF_ROSE:
+ strcpy(User, ax25_ntoa(&sockaddr.rose.srose_call));
+ strcpy(Node, rose_ntoa(&sockaddr.rose.srose_addr));
+ break;
}
for (raxl = paxl->ents; raxl != NULL; raxl = raxl->ents) {
@@ -413,33 +413,33 @@ int main(int argc, char *argv[])
getsockname(new, (struct sockaddr *)&sockaddr, &addrlen);
switch (paxl->af_type) {
- case AF_AX25:
- Port = ax25_config_get_port(&sockaddr.ax25.fsa_digipeater[0]);
- break;
- case AF_NETROM:
- Port = nr_config_get_port(&sockaddr.ax25.fsa_ax25.sax25_call);
- break;
- case AF_ROSE:
- Port = rs_config_get_port(&sockaddr.rose.srose_addr);
- break;
- default:
- Port = "???";
- break;
+ case AF_AX25:
+ Port = ax25_config_get_port(&sockaddr.ax25.fsa_digipeater[0]);
+ break;
+ case AF_NETROM:
+ Port = nr_config_get_port(&sockaddr.ax25.fsa_ax25.sax25_call);
+ break;
+ case AF_ROSE:
+ Port = rs_config_get_port(&sockaddr.rose.srose_addr);
+ break;
+ default:
+ Port = "???";
+ break;
}
if (raxl == NULL) {
/* No default */
if (Logging && !(paxl->flags & FLAG_NOLOGGING)) {
switch (paxl->af_type) {
- case AF_AX25:
- syslog(LOG_INFO, "AX.25 %s (%s) rejected - no default", User, Port);
- break;
- case AF_NETROM:
- syslog(LOG_INFO, "NET/ROM %s@%s (%s) rejected - no default", User, Node, Port);
- break;
- case AF_ROSE:
- syslog(LOG_INFO, "Rose %s@%s (%s) rejected - no default", User, Node, Port);
- break;
+ case AF_AX25:
+ syslog(LOG_INFO, "AX.25 %s (%s) rejected - no default", User, Port);
+ break;
+ case AF_NETROM:
+ syslog(LOG_INFO, "NET/ROM %s@%s (%s) rejected - no default", User, Node, Port);
+ break;
+ case AF_ROSE:
+ syslog(LOG_INFO, "Rose %s@%s (%s) rejected - no default", User, Node, Port);
+ break;
}
}
close(new);
@@ -450,15 +450,15 @@ int main(int argc, char *argv[])
/* Not allowed to connect */
if (Logging && !(paxl->flags & FLAG_NOLOGGING)) {
switch (raxl->af_type) {
- case AF_AX25:
- syslog(LOG_INFO, "AX.25 %s (%s) rejected - port locked", User, Port);
- break;
- case AF_NETROM:
- syslog(LOG_INFO, "NET/ROM %s@%s (%s) rejected - port locked", User, Node, Port);
- break;
- case AF_ROSE:
- syslog(LOG_INFO, "Rose %s@%s (%s) rejected - port locked", User, Node, Port);
- break;
+ case AF_AX25:
+ syslog(LOG_INFO, "AX.25 %s (%s) rejected - port locked", User, Port);
+ break;
+ case AF_NETROM:
+ syslog(LOG_INFO, "NET/ROM %s@%s (%s) rejected - port locked", User, Node, Port);
+ break;
+ case AF_ROSE:
+ syslog(LOG_INFO, "Rose %s@%s (%s) rejected - port locked", User, Node, Port);
+ break;
}
}
close(new);
@@ -476,155 +476,155 @@ int main(int argc, char *argv[])
pid = fork();
switch (pid) {
- case -1:
- if (Logging)
- syslog(LOG_ERR, "fork error %m");
- /*
- * I don't think AX25 at the moment will hold the
- * connection open, if the above does not make it
- * through first time.
- */
- close(new);
- break; /* Oh well... */
+ case -1:
+ if (Logging)
+ syslog(LOG_ERR, "fork error %m");
+ /*
+ * I don't think AX25 at the moment will hold the
+ * connection open, if the above does not make it
+ * through first time.
+ */
+ close(new);
+ break; /* Oh well... */
- case 0:
+ case 0:
- if (raxl->af_type == AF_AX25 && raxl->checkVC) {
- /* to which of my own addresses has the user connected? */
- getsockname(new, (struct sockaddr *)&sockaddr, &addrlen);
- strcpy(myAX25Name, ax25_ntoa(&sockaddr.ax25.fsa_ax25.sax25_call));
+ if (raxl->af_type == AF_AX25 && raxl->checkVC) {
+ /* to which of my own addresses has the user connected? */
+ getsockname(new, (struct sockaddr *)&sockaddr, &addrlen);
+ strcpy(myAX25Name, ax25_ntoa(&sockaddr.ax25.fsa_ax25.sax25_call));
- sprintf(buf, "/usr/sbin/ax25rtctl -l ip | grep -i ' %s ' | /bin/grep 'v ' >/dev/null", User);
+ sprintf(buf, "/usr/sbin/ax25rtctl -l ip | grep -i ' %s ' | /bin/grep 'v ' >/dev/null", User);
- /* he's not a VC user? */
- if (system(buf) != 0)
- goto login;
+ /* he's not a VC user? */
+ if (system(buf) != 0)
+ goto login;
- if (raxl->checkVC > 1) {
- /* setproctitle("ax25d [%d]: rejecting, User); */
- } else {
- /* setproctitle("ax25d [%d]: %s, User, (VCloginEnable ? "waiting" : "discarding")); */
- }
+ if (raxl->checkVC > 1) {
+ /* setproctitle("ax25d [%d]: rejecting, User); */
+ } else {
+ /* setproctitle("ax25d [%d]: %s, User, (VCloginEnable ? "waiting" : "discarding")); */
+ }
- /* is a VC user. checkVC > 0? then reject now, or fork and wait for pid=textdata.. */
- if (raxl->VCsendFailureMsg) {
- sprintf(buf, "*** %s: NO MODE VC with %s\r", myAX25Name, myAX25Name);
- write(new, buf, strlen(buf));
- if (raxl->checkVC > 1)
- sleep(1);
- }
+ /* is a VC user. checkVC > 0? then reject now, or fork and wait for pid=textdata.. */
+ if (raxl->VCsendFailureMsg) {
+ sprintf(buf, "*** %s: NO MODE VC with %s\r", myAX25Name, myAX25Name);
+ write(new, buf, strlen(buf));
+ if (raxl->checkVC > 1)
+ sleep(1);
+ }
- if (raxl->checkVC > 1) {
- if (Logging && (!(paxl->flags & FLAG_NOLOGGING) || raxl->LoggingVC))
- syslog((raxl->LoggingVC ? LOG_NOTICE : LOG_INFO), "AX.25 %s (%s:%s) rejected - AX25.IP-VC entry found", User, Port, myAX25Name);
- goto close_link;
- }
+ if (raxl->checkVC > 1) {
+ if (Logging && (!(paxl->flags & FLAG_NOLOGGING) || raxl->LoggingVC))
+ syslog((raxl->LoggingVC ? LOG_NOTICE : LOG_INFO), "AX.25 %s (%s:%s) rejected - AX25.IP-VC entry found", User, Port, myAX25Name);
+ goto close_link;
+ }
- /* 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",
- User, Port, myAX25Name,
- (raxl->VCloginEnable ? "waiting for first PID=text packet for triggered login" : "discarding PID=text packets"));
- }
+ /* 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",
+ User, Port, myAX25Name,
+ (raxl->VCloginEnable ? "waiting for first PID=text packet for triggered login" : "discarding PID=text packets"));
+ }
- *buf = 0;
- mesg = 0;
- while ((i = read(new, buf, (sizeof(buf)-1))) > 0) {
- 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);
- }
- /* skip leading mess */
- for (p = buf; *p && (isspace(*p & 0xff) || *p == '\r'); p++) ;
- if (raxl->VCdiscOnLinkfailureMsg && !strncmp(p, "***", 3)) {
- /* format received line for debug purposes */
- /* 1. skip "***" */
- for (p += 3; *p && isspace(*p & 0xff); p++ ) ;
- mesg = p;
- /* 2. get rid off EOL delimiters */
- while (*p) {
- if (*p == '\r' || *p == '\n') {
- *p = 0;
- break;
- }
- p++;
+ *buf = 0;
+ mesg = 0;
+ while ((i = read(new, buf, (sizeof(buf)-1))) > 0) {
+ 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);
+ }
+ /* skip leading mess */
+ for (p = buf; *p && (isspace(*p & 0xff) || *p == '\r'); p++) ;
+ if (raxl->VCdiscOnLinkfailureMsg && !strncmp(p, "***", 3)) {
+ /* format received line for debug purposes */
+ /* 1. skip "***" */
+ for (p += 3; *p && isspace(*p & 0xff); p++ ) ;
+ mesg = p;
+ /* 2. get rid off EOL delimiters */
+ while (*p) {
+ if (*p == '\r' || *p == '\n') {
+ *p = 0;
+ break;
}
- /* end read loop */
- break;
+ p++;
}
- /* per default, we discard all messages,
- * because there's no useful combination
- * using VC and pidText togegther
- */
- if (raxl->VCloginEnable)
- goto login;
+ /* end read loop */
+ break;
}
+ /* per default, we discard all messages,
+ * because there's no useful combination
+ * using VC and pidText togegther
+ */
+ if (raxl->VCloginEnable)
+ goto login;
+ }
- if (Logging && (!(paxl->flags & FLAG_NOLOGGING) || raxl->LoggingVC)) {
- syslog((raxl->LoggingVC ? LOG_NOTICE : LOG_INFO),
- "AX.25 %s (%s:%s) AX25.IP-VC host disconnected%s%s",
- User,
- Port,
- myAX25Name,
- (mesg ? ": " : "."),
- (mesg ? mesg : ""));
- }
- /* point of no return */
-close_link:
- /* close link */
- /* setproctitle("ax25d [%s]: disconnecting", User); */
- close(new);
- exit(0);
+ if (Logging && (!(paxl->flags & FLAG_NOLOGGING) || raxl->LoggingVC)) {
+ syslog((raxl->LoggingVC ? LOG_NOTICE : LOG_INFO),
+ "AX.25 %s (%s:%s) AX25.IP-VC host disconnected%s%s",
+ User,
+ Port,
+ myAX25Name,
+ (mesg ? ": " : "."),
+ (mesg ? mesg : ""));
}
+ /* point of no return */
+close_link:
+ /* close link */
+ /* setproctitle("ax25d [%s]: disconnecting", User); */
+ close(new);
+ exit(0);
+ }
login:
- /* setproctitle("ax25d [%s]: login", User); */
-
- SetupOptions(new, raxl);
- WorkoutArgs(raxl->af_type, raxl->shell, &argc, argv);
-
- if (Logging && !(paxl->flags & FLAG_NOLOGGING)) {
- switch (paxl->af_type) {
- case AF_AX25:
- syslog(LOG_INFO, "AX.25 %s (%s) %s", User, Port, argv[0]);
- break;
- case AF_NETROM:
- syslog(LOG_INFO, "NET/ROM %s@%s (%s) %s", User, Node, Port, argv[0]);
- break;
- case AF_ROSE:
- syslog(LOG_INFO, "Rose %s@%s (%s) %s", User, Node, Port, argv[0]);
- break;
- }
+ /* setproctitle("ax25d [%s]: login", User); */
+
+ SetupOptions(new, raxl);
+ WorkoutArgs(raxl->af_type, raxl->shell, &argc, argv);
+
+ if (Logging && !(paxl->flags & FLAG_NOLOGGING)) {
+ switch (paxl->af_type) {
+ case AF_AX25:
+ syslog(LOG_INFO, "AX.25 %s (%s) %s", User, Port, argv[0]);
+ break;
+ case AF_NETROM:
+ syslog(LOG_INFO, "NET/ROM %s@%s (%s) %s", User, Node, Port, argv[0]);
+ break;
+ case AF_ROSE:
+ syslog(LOG_INFO, "Rose %s@%s (%s) %s", User, Node, Port, argv[0]);
+ break;
}
+ }
- dup2(new, STDIN_FILENO);
- dup2(new, STDOUT_FILENO);
- close(new);
+ dup2(new, STDIN_FILENO);
+ dup2(new, STDOUT_FILENO);
+ close(new);
+
+ /*
+ * Might be more efficient if we just went down AXL,
+ * we cleaned up our parents left overs on bootup.
+ */
+ for (axltmp = AXL; axltmp != NULL; axltmp = axltmp->next)
+ close(axltmp->fd);
- /*
- * Might be more efficient if we just went down AXL,
- * we cleaned up our parents left overs on bootup.
- */
- for (axltmp = AXL; axltmp != NULL; axltmp = axltmp->next)
- close(axltmp->fd);
-
- if (Logging)
- closelog();
-
- /* Make root secure, before we exec() */
- /* Strip any supplementary gid's */
- if (setgroups(0, grps) == -1)
- exit(1);
- if (setgid(raxl->gid) == -1)
- exit(1);
- if (setuid(raxl->uid) == -1)
- exit(1);
- execve(raxl->exec, argv, NULL);
+ if (Logging)
+ closelog();
+
+ /* Make root secure, before we exec() */
+ /* Strip any supplementary gid's */
+ if (setgroups(0, grps) == -1)
+ exit(1);
+ if (setgid(raxl->gid) == -1)
exit(1);
+ if (setuid(raxl->uid) == -1)
+ exit(1);
+ execve(raxl->exec, argv, NULL);
+ exit(1);
- default:
- close(new);
- break;
+ default:
+ close(new);
+ break;
}
}
}
@@ -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';
@@ -675,73 +675,73 @@ static void WorkoutArgs(int af_type, char *shell, int *argc, char **argv)
if (*cp == '%') {
cp++;
- switch(*cp) {
- case 'd': /* portname */
- for (sp = Port; *sp != '\0' && *sp != '-'; sp++)
- buffer[cnt++] = *sp;
- break;
-
- case 'U': /* username in UPPER */
- for (sp = User; *sp != '\0' && *sp != '-'; sp++)
- buffer[cnt++] = toupper(*sp);
- break;
+ switch (*cp) {
+ case 'd': /* portname */
+ for (sp = Port; *sp != '\0' && *sp != '-'; sp++)
+ buffer[cnt++] = *sp;
+ break;
- case 'u': /* USERNAME IN lower */
- for (sp = User; *sp != '\0' && *sp != '-'; sp++)
- buffer[cnt++] = tolower(*sp);
- break;
+ case 'U': /* username in UPPER */
+ for (sp = User; *sp != '\0' && *sp != '-'; sp++)
+ buffer[cnt++] = toupper(*sp);
+ break;
- case 'S': /* username in UPPER (with SSID) */
- for (sp = User; *sp != '\0'; sp++)
- buffer[cnt++] = toupper(*sp);
- break;
+ case 'u': /* USERNAME IN lower */
+ for (sp = User; *sp != '\0' && *sp != '-'; sp++)
+ buffer[cnt++] = tolower(*sp);
+ break;
- case 's': /* USERNAME IN lower (with SSID) */
- for (sp = User; *sp != '\0'; sp++)
- buffer[cnt++] = tolower(*sp);
- break;
+ case 'S': /* username in UPPER (with SSID) */
+ for (sp = User; *sp != '\0'; sp++)
+ buffer[cnt++] = toupper(*sp);
+ break;
- case 'P': /* nodename in UPPER */
- if (af_type == AF_NETROM) {
- for (sp = Node; *sp != '\0' && *sp != '-'; sp++)
- buffer[cnt++] = toupper(*sp);
- } else {
- buffer[cnt++] = '%';
- }
- break;
+ case 's': /* USERNAME IN lower (with SSID) */
+ for (sp = User; *sp != '\0'; sp++)
+ buffer[cnt++] = tolower(*sp);
+ break;
- case 'p': /* NODENAME IN lower */
- if (af_type == AF_NETROM) {
- for(sp = Node; *sp != '\0' && *sp != '-'; sp++)
- buffer[cnt++] = tolower(*sp);
- } else {
- buffer[cnt++] = '%';
- }
- break;
+ case 'P': /* nodename in UPPER */
+ if (af_type == AF_NETROM) {
+ for (sp = Node; *sp != '\0' && *sp != '-'; sp++)
+ buffer[cnt++] = toupper(*sp);
+ } else {
+ buffer[cnt++] = '%';
+ }
+ break;
- case 'R': /* nodename in UPPER (with SSID) */
- if (af_type == AF_NETROM) {
- for (sp = Node; *sp != '\0'; sp++)
- buffer[cnt++] = toupper(*sp);
- } else {
- buffer[cnt++] = '%';
- }
- break;
+ case 'p': /* NODENAME IN lower */
+ if (af_type == AF_NETROM) {
+ for (sp = Node; *sp != '\0' && *sp != '-'; sp++)
+ buffer[cnt++] = tolower(*sp);
+ } else {
+ buffer[cnt++] = '%';
+ }
+ break;
- case 'r': /* NODENAME IN lower (with SSID) */
- if (af_type == AF_NETROM) {
- for (sp = Node; *sp != '\0'; sp++)
- buffer[cnt++] = tolower(*sp);
- } else {
- buffer[cnt++] = '%';
- }
- break;
+ case 'R': /* nodename in UPPER (with SSID) */
+ if (af_type == AF_NETROM) {
+ for (sp = Node; *sp != '\0'; sp++)
+ buffer[cnt++] = toupper(*sp);
+ } else {
+ buffer[cnt++] = '%';
+ }
+ break;
- case '\0':
- case '%':
- default:
+ case 'r': /* NODENAME IN lower (with SSID) */
+ if (af_type == AF_NETROM) {
+ for (sp = Node; *sp != '\0'; sp++)
+ buffer[cnt++] = tolower(*sp);
+ } else {
buffer[cnt++] = '%';
- break;
+ }
+ break;
+
+ case '\0':
+ case '%':
+ default:
+ buffer[cnt++] = '%';
+ break;
}
} else {
buffer[cnt++] = *cp;
@@ -829,33 +829,33 @@ static int ReadConfig(void)
if (buffer[0] == '#')
continue;
-
- switch (buffer[0]) {
- case '[': /* AX25 port call */
- af_type = AF_AX25;
- hunt = TRUE;
- error = FALSE;
- iamdigi = FALSE;
- break;
-
- case '<': /* NETROM iface call */
- af_type = AF_NETROM;
- hunt = TRUE;
- error = FALSE;
- iamdigi = FALSE;
- break;
- case '{': /* ROSE iface call */
- af_type = AF_ROSE;
- hunt = TRUE;
- error = FALSE;
- iamdigi = FALSE;
- break;
-
- default:
- if (hunt && !error)
- goto BadLine;
- break;
+ switch (buffer[0]) {
+ case '[': /* AX25 port call */
+ af_type = AF_AX25;
+ hunt = TRUE;
+ error = FALSE;
+ iamdigi = FALSE;
+ break;
+
+ case '<': /* NETROM iface call */
+ af_type = AF_NETROM;
+ hunt = TRUE;
+ error = FALSE;
+ iamdigi = FALSE;
+ break;
+
+ case '{': /* ROSE iface call */
+ af_type = AF_ROSE;
+ hunt = TRUE;
+ error = FALSE;
+ iamdigi = FALSE;
+ break;
+
+ default:
+ if (hunt && !error)
+ goto BadLine;
+ break;
}
if (hunt) { /* We've found a Iface entry */
@@ -863,104 +863,104 @@ static int ReadConfig(void)
memset(&axl_defaults, 0, sizeof(axl_defaults));
switch (af_type) {
- case AF_AX25:
- if ((s = strchr(buffer, ']')) == NULL)
- goto BadLine;
- *s = '\0';
- if ((s = strtok(buffer + 1, " \t")) == NULL)
- goto BadLine;
- port = s;
- call = NULL;
- if ((s = strtok(NULL, " \t")) != NULL) {
- if (strcasecmp(s, "VIA") == 0 || strcasecmp(s, "V") == 0) {
- if ((s = strtok(NULL, " \t")) == NULL)
- goto BadLine;
- }
+ case AF_AX25:
+ if ((s = strchr(buffer, ']')) == NULL)
+ goto BadLine;
+ *s = '\0';
+ if ((s = strtok(buffer + 1, " \t")) == NULL)
+ goto BadLine;
+ port = s;
+ call = NULL;
+ if ((s = strtok(NULL, " \t")) != NULL) {
+ if (strcasecmp(s, "VIA") == 0 || strcasecmp(s, "V") == 0) {
+ if ((s = strtok(NULL, " \t")) == NULL)
+ goto BadLine;
+ }
- call = port;
- port = s;
+ call = port;
+ port = s;
- if ((s = strchr(call, '*')) != NULL) {
- iamdigi = TRUE;
- *s = '\0';
- }
- }
- if (strcmp(port, "*") == 0 && call == NULL) {
- fprintf(stderr, "ax25d: invalid port name\n");
- continue;
+ if ((s = strchr(call, '*')) != NULL) {
+ iamdigi = TRUE;
+ *s = '\0';
}
- if (strcmp(port, "*") != 0) {
- if ((addr = ax25_config_get_addr(port)) == NULL) {
- fprintf(stderr, "ax25d: invalid AX.25 port '%s'\n", port);
- continue;
- }
- }
- if (call == NULL) {
- sockaddr.ax25.fsa_ax25.sax25_family = AF_AX25;
- sockaddr.ax25.fsa_ax25.sax25_ndigis = 0;
- ax25_aton_entry(addr, sockaddr.ax25.fsa_ax25.sax25_call.ax25_call);
- } else {
- sockaddr.ax25.fsa_ax25.sax25_family = AF_AX25;
- sockaddr.ax25.fsa_ax25.sax25_ndigis = 1;
- ax25_aton_entry(call, sockaddr.ax25.fsa_ax25.sax25_call.ax25_call);
- if (strcmp(port, "*") != 0)
- ax25_aton_entry(addr, sockaddr.ax25.fsa_digipeater[0].ax25_call);
- else
- sockaddr.ax25.fsa_digipeater[0] = null_ax25_address;
- }
- addrlen = sizeof(struct full_sockaddr_ax25);
- break;
-
- case AF_NETROM:
- if ((s = strchr(buffer, '>')) == NULL)
- goto BadLine;
- *s = '\0';
- port = buffer + 1;
- if ((addr = nr_config_get_addr(port)) == NULL) {
- fprintf(stderr, "ax25d: invalid NET/ROM port '%s'\n", port);
+ }
+ if (strcmp(port, "*") == 0 && call == NULL) {
+ fprintf(stderr, "ax25d: invalid port name\n");
+ continue;
+ }
+ if (strcmp(port, "*") != 0) {
+ if ((addr = ax25_config_get_addr(port)) == NULL) {
+ fprintf(stderr, "ax25d: invalid AX.25 port '%s'\n", port);
continue;
}
- sockaddr.ax25.fsa_ax25.sax25_family = AF_NETROM;
+ }
+ if (call == NULL) {
+ sockaddr.ax25.fsa_ax25.sax25_family = AF_AX25;
sockaddr.ax25.fsa_ax25.sax25_ndigis = 0;
ax25_aton_entry(addr, sockaddr.ax25.fsa_ax25.sax25_call.ax25_call);
- addrlen = sizeof(struct full_sockaddr_ax25);
- break;
+ } else {
+ sockaddr.ax25.fsa_ax25.sax25_family = AF_AX25;
+ sockaddr.ax25.fsa_ax25.sax25_ndigis = 1;
+ ax25_aton_entry(call, sockaddr.ax25.fsa_ax25.sax25_call.ax25_call);
+ if (strcmp(port, "*") != 0)
+ ax25_aton_entry(addr, sockaddr.ax25.fsa_digipeater[0].ax25_call);
+ else
+ sockaddr.ax25.fsa_digipeater[0] = null_ax25_address;
+ }
+ addrlen = sizeof(struct full_sockaddr_ax25);
+ break;
- case AF_ROSE:
- if ((s = strchr(buffer, '}')) == NULL)
- goto BadLine;
- *s = '\0';
- if ((s = strtok(buffer + 1, " \t")) == NULL)
- goto BadLine;
- call = s;
+ case AF_NETROM:
+ if ((s = strchr(buffer, '>')) == NULL)
+ goto BadLine;
+ *s = '\0';
+ port = buffer + 1;
+ if ((addr = nr_config_get_addr(port)) == NULL) {
+ fprintf(stderr, "ax25d: invalid NET/ROM port '%s'\n", port);
+ continue;
+ }
+ sockaddr.ax25.fsa_ax25.sax25_family = AF_NETROM;
+ sockaddr.ax25.fsa_ax25.sax25_ndigis = 0;
+ ax25_aton_entry(addr, sockaddr.ax25.fsa_ax25.sax25_call.ax25_call);
+ addrlen = sizeof(struct full_sockaddr_ax25);
+ break;
+
+ case AF_ROSE:
+ if ((s = strchr(buffer, '}')) == NULL)
+ goto BadLine;
+ *s = '\0';
+ if ((s = strtok(buffer + 1, " \t")) == NULL)
+ goto BadLine;
+ call = s;
+ if ((s = strtok(NULL, " \t")) == NULL)
+ goto BadLine;
+ if (strcasecmp(s, "VIA") == 0 || strcasecmp(s, "V") == 0) {
if ((s = strtok(NULL, " \t")) == NULL)
goto BadLine;
- if (strcasecmp(s, "VIA") == 0 || strcasecmp(s, "V") == 0) {
- if ((s = strtok(NULL, " \t")) == NULL)
- goto BadLine;
- }
- port = s;
- if ((addr = rs_config_get_addr(port)) == NULL) {
- fprintf(stderr, "ax25d: invalid Rose port '%s'\n", port);
- continue;
- }
- if (strcmp(call, "*") == 0) {
- sockaddr.rose.srose_family = AF_ROSE;
- sockaddr.rose.srose_ndigis = 0;
- rose_aton(addr, sockaddr.rose.srose_addr.rose_addr);
- sockaddr.rose.srose_call = null_ax25_address;
- } else {
- sockaddr.rose.srose_family = AF_ROSE;
- sockaddr.rose.srose_ndigis = 0;
- rose_aton(addr, sockaddr.rose.srose_addr.rose_addr);
- ax25_aton_entry(call, sockaddr.rose.srose_call.ax25_call);
- }
- addrlen = sizeof(struct sockaddr_rose);
- break;
+ }
+ port = s;
+ if ((addr = rs_config_get_addr(port)) == NULL) {
+ fprintf(stderr, "ax25d: invalid Rose port '%s'\n", port);
+ continue;
+ }
+ if (strcmp(call, "*") == 0) {
+ sockaddr.rose.srose_family = AF_ROSE;
+ sockaddr.rose.srose_ndigis = 0;
+ rose_aton(addr, sockaddr.rose.srose_addr.rose_addr);
+ sockaddr.rose.srose_call = null_ax25_address;
+ } else {
+ sockaddr.rose.srose_family = AF_ROSE;
+ sockaddr.rose.srose_ndigis = 0;
+ rose_aton(addr, sockaddr.rose.srose_addr.rose_addr);
+ ax25_aton_entry(call, sockaddr.rose.srose_call.ax25_call);
+ }
+ addrlen = sizeof(struct sockaddr_rose);
+ break;
- default:
- fprintf(stderr, "ax25d: unknown af_type=%d\n", af_type);
- exit(1);
+ default:
+ fprintf(stderr, "ax25d: unknown af_type=%d\n", af_type);
+ exit(1);
}
if ((axl_port = calloc(1, sizeof(*axl_port))) == NULL) {
@@ -979,13 +979,13 @@ static int ReadConfig(void)
reload_timer(60);
continue;
}
- /* xlz - have to nuke this as this option is gone
- * what should be here?
+ /* xlz - have to nuke this as this option is gone
+ * what should be here?
if (iamdigi) {
yes = 1;
setsockopt(axl_port->fd, SOL_AX25, AX25_IAMDIGI, &yes, sizeof(yes));
}
- */
+ */
if (bind(axl_port->fd, (struct sockaddr *)&sockaddr, addrlen) < 0) {
fprintf(stderr, "ax25d: bind: %s on port %s\n", strerror(errno), axl_port->port);
@@ -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)
@@ -1298,39 +1298,39 @@ static unsigned long ParseFlags(const char *kp, int line)
for (; *kp != '\0'; kp++) {
switch (*kp) {
- case 'v':
- case 'V':
- flags |= FLAG_VALIDCALL;
- break;
-
- case 'q':
- case 'Q':
- flags |= FLAG_NOLOGGING;
- break;
-
- case 'n':
- case 'N':
- flags |= FLAG_CHKNRN;
- break;
-
- case 'd':
- case 'D':
- flags |= FLAG_NODIGIS;
- break;
-
- case 'l':
- case 'L':
- flags |= FLAG_LOCKOUT;
- break;
-
- case '0':
- case '*':
- case '-': /* Be compatible and allow markers */
- break;
-
- default:
- fprintf(stderr, "ax25d: config file line %d bad flag option '%c'.\n", line, *kp);
- break;
+ case 'v':
+ case 'V':
+ flags |= FLAG_VALIDCALL;
+ break;
+
+ case 'q':
+ case 'Q':
+ flags |= FLAG_NOLOGGING;
+ break;
+
+ case 'n':
+ case 'N':
+ flags |= FLAG_CHKNRN;
+ break;
+
+ case 'd':
+ case 'D':
+ flags |= FLAG_NODIGIS;
+ break;
+
+ case 'l':
+ case 'L':
+ flags |= FLAG_LOCKOUT;
+ break;
+
+ case '0':
+ case '*':
+ case '-': /* Be compatible and allow markers */
+ break;
+
+ default:
+ fprintf(stderr, "ax25d: config file line %d bad flag option '%c'.\n", line, *kp);
+ break;
}
}
@@ -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 3186229..f1116a7 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,12 +83,11 @@ int main(int argc, char **argv)
}
ax25_ctl.digi_count = 0;
-
+
if (ioctl(s, SIOCAX25CTLCON, &ax25_ctl) != 0) {
perror("axctl: SIOCAX25CTLCON");
return 1;
}
-
+
return 0;
}
-
diff --git a/ax25/axgetput/Makefile.am b/ax25/axgetput/Makefile.am
index d3f8f8f..de92dda 100644
--- a/ax25/axgetput/Makefile.am
+++ b/ax25/axgetput/Makefile.am
@@ -1,20 +1,19 @@
installconf:
-etcfiles =
-varfiles =
+etcfiles =
+varfiles =
-sbin_PROGRAMS =
+sbin_PROGRAMS =
bin_PROGRAMS = axgetput
-man_MANS = axgetput.1
-EXTRA_DIST = $(man_MANS)
+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 d3d3f53..de21bc5 100644
--- a/ax25/axgetput/axgetput.c
+++ b/ax25/axgetput/axgetput.c
@@ -24,25 +24,25 @@
#include "util.h"
#include "proto_bin.h"
-int fdin = 0;
+int fdin;
int fdout = 1;
int fderr = 2;
-int fdout_is_pipe = 0;
-int fdin_is_pipe = 0;
+int fdout_is_pipe;
+int fdin_is_pipe;
-int is_stream = 0;
-int mode = 0;
-int do_crc_only = 0;
+int is_stream;
+int mode;
+int do_crc_only;
char c_eol = '\n';
unsigned int BLOCKSIZ = BLOCKSIZ_DEFAULT;
-char *send_on_signal = 0;
+char *send_on_signal;
static struct termios prev_termios;
-static int prev_termios_stored = 0;
-static mode_t mode_tty = 0;
+static int prev_termios_stored;
+static mode_t mode_tty;
#ifndef MYNAME
#define MYNAME "axgetput"
@@ -52,92 +52,92 @@ static mode_t mode_tty = 0;
static void set_tty_flags(void)
{
- struct termios termios;
- struct stat statbuf;
-
- if (fdin_is_pipe)
- return;
- /* mesg no */
- if (!fstat(fdin, &statbuf)) {
- /* save old mode */
- mode_tty = statbuf.st_mode;
- fchmod(fdin, 0600);
- }
- /* make tty 8bit clean */
- if (tcgetattr(fdin, &prev_termios) != -1)
- prev_termios_stored = 1;
- memset((char *) &termios, 0, sizeof(termios));
- termios.c_iflag = IGNBRK | IGNPAR;
- termios.c_oflag = 0;
- termios.c_cflag = CBAUD | CS8 | CREAD | CLOCAL;
- termios.c_cflag = ~(CSTOPB|PARENB|PARODD|HUPCL);
- termios.c_lflag = 0;
- termios.c_cc[VMIN] = 1;
- termios.c_cc[VTIME] = 0;
- termios.c_cc[VSTART] = -1;
- termios.c_cc[VSTOP] = -1;
- tcsetattr(fdin, TCSANOW, &termios);
+ struct termios termios;
+ struct stat statbuf;
+
+ if (fdin_is_pipe)
+ return;
+ /* mesg no */
+ if (!fstat(fdin, &statbuf)) {
+ /* save old mode */
+ mode_tty = statbuf.st_mode;
+ fchmod(fdin, 0600);
+ }
+ /* make tty 8bit clean */
+ if (tcgetattr(fdin, &prev_termios) != -1)
+ prev_termios_stored = 1;
+ memset((char *) &termios, 0, sizeof(termios));
+ termios.c_iflag = IGNBRK | IGNPAR;
+ termios.c_oflag = 0;
+ termios.c_cflag = CBAUD | CS8 | CREAD | CLOCAL;
+ termios.c_cflag = ~(CSTOPB|PARENB|PARODD|HUPCL);
+ termios.c_lflag = 0;
+ termios.c_cc[VMIN] = 1;
+ termios.c_cc[VTIME] = 0;
+ termios.c_cc[VSTART] = -1;
+ termios.c_cc[VSTOP] = -1;
+ tcsetattr(fdin, TCSANOW, &termios);
}
/*---------------------------------------------------------------------------*/
static void restore_tty_flags(void)
{
- if (fdin_is_pipe)
- return;
- if (prev_termios_stored)
- tcsetattr(fdin, TCSANOW, &prev_termios);
- if (mode_tty)
- fchmod(fdin, mode_tty);
+ if (fdin_is_pipe)
+ return;
+ if (prev_termios_stored)
+ tcsetattr(fdin, TCSANOW, &prev_termios);
+ if (mode_tty)
+ fchmod(fdin, mode_tty);
}
/*---------------------------------------------------------------------------*/
static void eol_convention(int state_should)
{
- /* need patched axspawn */
+ /* need patched axspawn */
#define BIN_ON "//BIN ON\r"
#define BIN_OFF "//BIN OFF\r"
- static int state_is = 0;
+ static int state_is;
- /* already in correct state? */
- if ((state_is && state_should) || (!state_is && !state_should))
- return;
+ /* already in correct state? */
+ if ((state_is && state_should) || (!state_is && !state_should))
+ return;
- sleep(1);
+ sleep(1);
- if (state_should) {
- write(fderr, BIN_ON, strlen(BIN_ON));
- c_eol = '\r';
- } else {
- write(fderr, BIN_OFF, strlen(BIN_OFF));
- c_eol = '\n';
- }
- state_is = state_should;
+ if (state_should) {
+ write(fderr, BIN_ON, strlen(BIN_ON));
+ c_eol = '\r';
+ } else {
+ write(fderr, BIN_OFF, strlen(BIN_OFF));
+ c_eol = '\n';
+ }
+ state_is = state_should;
- sleep(1);
+ sleep(1);
}
/*---------------------------------------------------------------------------*/
static void restore_defaults(void)
{
- eol_convention(0);
- restore_tty_flags();
+ eol_convention(0);
+ restore_tty_flags();
}
/*---------------------------------------------------------------------------*/
static void signal_handler(int sig)
{
- if (send_on_signal)
- secure_write(fdout, send_on_signal, strlen(send_on_signal));
- restore_defaults();
- if (*err_msg) {
- fputs(err_msg, stderr);
- }
- fprintf(stderr, "Died by signal %d.\n", sig);
- exit(sig);
+ if (send_on_signal)
+ secure_write(fdout, send_on_signal, strlen(send_on_signal));
+ restore_defaults();
+ if (*err_msg) {
+ fputs(err_msg, stderr);
+ }
+ fprintf(stderr, "Died by signal %d.\n", sig);
+ exit(sig);
}
/*---------------------------------------------------------------------------*/
@@ -153,40 +153,40 @@ void do_version(void)
/*---------------------------------------------------------------------------*/
static void usage(int all) {
- fprintf(stderr, "usage: %s ", myname);
- if (mode % 2) {
- fprintf(stderr, "[-ivh] [filename]\n");
- } else {
- fprintf(stderr, "[-isvh] [-b <blocksize>] [filename]\n");
- }
- fprintf(stderr, " -h prints detailed help\n");
- fprintf(stderr, " -i computes checksum only\n");
- fprintf(stderr, " -v prints version and exits\n");
- if (!all)
- return;
- if (mode % 2) {
- fprintf(stderr, " filename is usually got from the remote side by the protocol\n");
- fprintf(stderr, " but can be forced if you like to ignore this.\n");
- fprintf(stderr, " filename should be ommitted if output is sent to a pipe\n.");
- } else {
- fprintf(stderr, " -b value is the blocksize (framelen) of the transmitted data\n");
- fprintf(stderr, " default %d, which is a useful choice for ampr ax25.\n", BLOCKSIZ_DEFAULT);
- fprintf(stderr, " -s indicates a stream with unknown size.\n");
- fprintf(stderr, " otherwise, the data will be read to memory until EOF.\n");
- fprintf(stderr, " -s is only available if stdin is a pipe\n");
- fprintf(stderr, " if filename specified in filter, the given name will be suggested instead.\n");
- fprintf(stderr, " filename may be ommited if used as filter.\n");
- }
- fputc('\n', stderr);
- fprintf(stderr, "Tips: - compressed download:\n");
- fprintf(stderr, " gzip -c foo.txt | bget foo.txt.gz\n");
- fprintf(stderr, " tar cjf - ~/foo ~/bar/ | bget my_data.tar.bz2\n");
- fputc('\n', stderr);
- fprintf(stderr, "Other protocols:\n");
- fprintf(stderr, " bget / bput: receive / send with #BIN# protocol\n");
- fprintf(stderr, " yget / yput: receive / send with yapp\n");
- fprintf(stderr, " rget / rput: receive / send with didadit\n");
- fprintf(stderr, "These are (sym)links to one program: " MYNAME "\n");
+ fprintf(stderr, "usage: %s ", myname);
+ if (mode % 2) {
+ fprintf(stderr, "[-ivh] [filename]\n");
+ } else {
+ fprintf(stderr, "[-isvh] [-b <blocksize>] [filename]\n");
+ }
+ fprintf(stderr, " -h prints detailed help\n");
+ fprintf(stderr, " -i computes checksum only\n");
+ fprintf(stderr, " -v prints version and exits\n");
+ if (!all)
+ return;
+ if (mode % 2) {
+ fprintf(stderr, " filename is usually got from the remote side by the protocol\n");
+ fprintf(stderr, " but can be forced if you like to ignore this.\n");
+ fprintf(stderr, " filename should be ommitted if output is sent to a pipe\n.");
+ } else {
+ fprintf(stderr, " -b value is the blocksize (framelen) of the transmitted data\n");
+ fprintf(stderr, " default %d, which is a useful choice for ampr ax25.\n", BLOCKSIZ_DEFAULT);
+ fprintf(stderr, " -s indicates a stream with unknown size.\n");
+ fprintf(stderr, " otherwise, the data will be read to memory until EOF.\n");
+ fprintf(stderr, " -s is only available if stdin is a pipe\n");
+ fprintf(stderr, " if filename specified in filter, the given name will be suggested instead.\n");
+ fprintf(stderr, " filename may be ommited if used as filter.\n");
+ }
+ fputc('\n', stderr);
+ fprintf(stderr, "Tips: - compressed download:\n");
+ fprintf(stderr, " gzip -c foo.txt | bget foo.txt.gz\n");
+ fprintf(stderr, " tar cjf - ~/foo ~/bar/ | bget my_data.tar.bz2\n");
+ fputc('\n', stderr);
+ fprintf(stderr, "Other protocols:\n");
+ fprintf(stderr, " bget / bput: receive / send with #BIN# protocol\n");
+ fprintf(stderr, " yget / yput: receive / send with yapp\n");
+ fprintf(stderr, " rget / rput: receive / send with didadit\n");
+ fprintf(stderr, "These are (sym)links to one program: " MYNAME "\n");
}
@@ -203,191 +203,190 @@ static int rput(void) { strcpy(err_msg, "yapp: not implementet yet\n"); return 1
int main(int argc, char *argv[])
{
- int len;
- int ret = 0;
- int c;
- char *p;
-
- /* determine what to so in the way how we are called */
- if ((p = strrchr(argv[0], '/')))
- p++; /* skip '/' */
- else
- p = argv[0];
- len = strlen(p);
- if (len < 0 || len > sizeof(myname)-1)
- len = sizeof(myname)-1;
- strncpy(myname, p, len);
- myname[len] = 0;
- strlwc(myname);
-
- fdin_is_pipe = (isatty(fdin) ? 0 : 1);
- fdout_is_pipe = (isatty(fdout) ? 0 : 1);
-
- if (fdin_is_pipe && fdout_is_pipe) {
- fprintf(stderr, "error: cannot work in between two pipes\n");
- exit(1);
- }
-
- *filename = 0;
- *err_msg = 0;
-
- if (!strcmp(myname, "bput"))
- mode = RECV_BIN;
- else if (!strcmp(myname, "bget"))
- mode = SEND_BIN;
- else if (!strcmp(myname, "yput"))
- mode = RECV_YAPP;
- else if (!strcmp(myname, "yget"))
- mode = SEND_YAPP;
- else if (!strcmp(myname, "rput"))
- mode = RECV_DIDADIT;
- else if (!strcmp(myname, "rget"))
- mode = SEND_DIDADIT;
-
- if (mode % 2) {
- if (fdin_is_pipe) {
- fprintf(stderr, "error: error: stdin must be a tty\n");
- exit(1);
- }
- } else {
- if (fdout_is_pipe) {
- fprintf(stderr, "error: stdout must be a tty\n");
- exit(1);
- }
- }
-
- signal(SIGHUP, signal_handler);
- signal(SIGTERM, signal_handler);
- signal(SIGINT, signal_handler);
+ int len;
+ int ret = 0;
+ int c;
+ char *p;
+
+ /* determine what to so in the way how we are called */
+ if ((p = strrchr(argv[0], '/')))
+ p++; /* skip '/' */
+ else
+ p = argv[0];
+ len = strlen(p);
+ if (len < 0 || len > sizeof(myname)-1)
+ len = sizeof(myname)-1;
+ strncpy(myname, p, len);
+ myname[len] = 0;
+ strlwc(myname);
+
+ fdin_is_pipe = (isatty(fdin) ? 0 : 1);
+ fdout_is_pipe = (isatty(fdout) ? 0 : 1);
+
+ if (fdin_is_pipe && fdout_is_pipe) {
+ fprintf(stderr, "error: cannot work in between two pipes\n");
+ exit(1);
+ }
+
+ *filename = 0;
+ *err_msg = 0;
+
+ if (!strcmp(myname, "bput"))
+ mode = RECV_BIN;
+ else if (!strcmp(myname, "bget"))
+ mode = SEND_BIN;
+ else if (!strcmp(myname, "yput"))
+ mode = RECV_YAPP;
+ else if (!strcmp(myname, "yget"))
+ mode = SEND_YAPP;
+ else if (!strcmp(myname, "rput"))
+ mode = RECV_DIDADIT;
+ else if (!strcmp(myname, "rget"))
+ mode = SEND_DIDADIT;
+
+ if (mode % 2) {
+ if (fdin_is_pipe) {
+ fprintf(stderr, "error: error: stdin must be a tty\n");
+ exit(1);
+ }
+ } else {
+ if (fdout_is_pipe) {
+ fprintf(stderr, "error: stdout must be a tty\n");
+ exit(1);
+ }
+ }
+
+ signal(SIGHUP, signal_handler);
+ signal(SIGTERM, signal_handler);
+ signal(SIGINT, signal_handler);
/* for difference betreen "bput -f file" and "bget file" */
-#define get_filename(f) { \
- if (!strcmp(f, "-")) { \
- if (mode % 2) \
- fdin_is_pipe = 1; \
- else \
- fdout_is_pipe = 1; \
- } else { \
- strncpy(filename, f, sizeof(filename)-1); \
- filename[sizeof(filename)-1] = 0; \
- if (mode % 2) { \
- if (fdin_is_pipe) \
- fdin_is_pipe = 0; \
- } else { \
- if (fdout_is_pipe) \
- fdout_is_pipe = 0; \
- } \
- } \
+#define get_filename(f) { \
+ if (!strcmp(f, "-")) { \
+ if (mode % 2) \
+ fdin_is_pipe = 1; \
+ else \
+ fdout_is_pipe = 1; \
+ } else { \
+ strncpy(filename, f, sizeof(filename)-1); \
+ filename[sizeof(filename)-1] = 0; \
+ if (mode % 2) { \
+ if (fdin_is_pipe) \
+ fdin_is_pipe = 0; \
+ } else { \
+ if (fdout_is_pipe) \
+ fdout_is_pipe = 0; \
+ } \
+ } \
}
- while ((c = getopt(argc, argv, (mode % 2) ? "ivh?" : "b:isvh?")) != EOF) {
- switch(c) {
- case 'b':
- if (((BLOCKSIZ = (unsigned ) atoi(optarg)) < BLOCKSIZ_MIN) || BLOCKSIZ > BLOCKSIZ_MAX) {
- fprintf(stderr, "error: invalid blocksize: %d\n", BLOCKSIZ);
- fprintf(stderr, " blocksize must be in the range %d <= x <= %d. a value\n", BLOCKSIZ_MIN, BLOCKSIZ_MAX);
- fprintf(stderr, " of %d (default) is suggested, because it fits in an ax25 frame.\n", BLOCKSIZ_DEFAULT);
- exit(1);
- }
- break;
- case 'i':
- do_crc_only = 1;
- break;
- case 's':
- is_stream = 1;
- break;
- case 'v':
- do_version();
- exit(0);
- break;
- case 'h':
- case '?':
- usage((c == 'h'));
- exit(0);
- break;
- }
- }
-
- if (mode == 0) {
- usage(1);
- exit(0);
- }
-
- if (optind < argc) {
- get_filename(argv[optind]);
- optind++;
- }
- if (optind < argc) {
- usage(0);
- exit(1);
- }
-
- if (is_stream && !fdin_is_pipe) {
- fprintf(stderr, "error: -s is only available in a pipe\n");
- exit(1);
- }
-
- if (do_crc_only)
- goto skiped_crc_only_tag_1;
-
- if (mode % 2) {
- if (fdin_is_pipe) {
- fprintf(stderr, "error: error: stdin must be a tty.\n");
- exit(1);
- }
- if (fdout_is_pipe && *filename) {
- fprintf(stderr, "error: filename in a pipe does not make sense.\n");
- exit(1);
- }
- } else {
- if (fdout_is_pipe) {
- fprintf(stderr, "error: stdout must be a tty.\n");
- exit(1);
- }
- if (!fdin_is_pipe && !*filename) {
- fprintf(stderr, "error: no file to send.\n");
- exit(1);
- }
- }
-
- signal(SIGQUIT, signal_handler);
-
- set_tty_flags();
- eol_convention(1);
+ while ((c = getopt(argc, argv, (mode % 2) ? "ivh?" : "b:isvh?")) != EOF) {
+ switch (c) {
+ case 'b':
+ if (((BLOCKSIZ = (unsigned ) atoi(optarg)) < BLOCKSIZ_MIN) || BLOCKSIZ > BLOCKSIZ_MAX) {
+ fprintf(stderr, "error: invalid blocksize: %d\n", BLOCKSIZ);
+ fprintf(stderr, " blocksize must be in the range %d <= x <= %d. a value\n", BLOCKSIZ_MIN, BLOCKSIZ_MAX);
+ fprintf(stderr, " of %d (default) is suggested, because it fits in an ax25 frame.\n", BLOCKSIZ_DEFAULT);
+ exit(1);
+ }
+ break;
+ case 'i':
+ do_crc_only = 1;
+ break;
+ case 's':
+ is_stream = 1;
+ break;
+ case 'v':
+ do_version();
+ exit(0);
+ break;
+ case 'h':
+ case '?':
+ usage((c == 'h'));
+ exit(0);
+ break;
+ }
+ }
+
+ if (mode == 0) {
+ usage(1);
+ exit(0);
+ }
+
+ if (optind < argc) {
+ get_filename(argv[optind]);
+ optind++;
+ }
+ if (optind < argc) {
+ usage(0);
+ exit(1);
+ }
+
+ if (is_stream && !fdin_is_pipe) {
+ fprintf(stderr, "error: -s is only available in a pipe\n");
+ exit(1);
+ }
+
+ if (do_crc_only)
+ goto skiped_crc_only_tag_1;
+
+ if (mode % 2) {
+ if (fdin_is_pipe) {
+ fprintf(stderr, "error: error: stdin must be a tty.\n");
+ exit(1);
+ }
+ if (fdout_is_pipe && *filename) {
+ fprintf(stderr, "error: filename in a pipe does not make sense.\n");
+ exit(1);
+ }
+ } else {
+ if (fdout_is_pipe) {
+ fprintf(stderr, "error: stdout must be a tty.\n");
+ exit(1);
+ }
+ if (!fdin_is_pipe && !*filename) {
+ fprintf(stderr, "error: no file to send.\n");
+ exit(1);
+ }
+ }
+
+ signal(SIGQUIT, signal_handler);
+
+ set_tty_flags();
+ eol_convention(1);
skiped_crc_only_tag_1:
- switch (mode) {
- case RECV_BIN:
- if (do_crc_only)
- ret = bget();
- else
- ret = bput();
- break;
- case SEND_BIN:
- ret = bget();
- break;
- case RECV_YAPP:
- ret = yput();
- break;
- case SEND_YAPP:
- ret = yget();
- break;
- case RECV_DIDADIT:
- ret = rput();
- break;
- case SEND_DIDADIT:
- ret = rget();
- break;
- }
-
- restore_defaults();
- if (*err_msg) {
- fputs(err_msg, stderr);
- }
- exit(ret);
-
- return 0;
+ switch (mode) {
+ case RECV_BIN:
+ if (do_crc_only)
+ ret = bget();
+ else
+ ret = bput();
+ break;
+ case SEND_BIN:
+ ret = bget();
+ break;
+ case RECV_YAPP:
+ ret = yput();
+ break;
+ case SEND_YAPP:
+ ret = yget();
+ break;
+ case RECV_DIDADIT:
+ ret = rput();
+ break;
+ case SEND_DIDADIT:
+ ret = rget();
+ break;
+ }
+
+ restore_defaults();
+ if (*err_msg) {
+ fputs(err_msg, stderr);
+ }
+ exit(ret);
+
+ return 0;
}
-
diff --git a/ax25/axgetput/proto_bin.c b/ax25/axgetput/proto_bin.c
index 004ca5e..5d1bde9 100644
--- a/ax25/axgetput/proto_bin.c
+++ b/ax25/axgetput/proto_bin.c
@@ -11,34 +11,39 @@
#include "util.h"
static int crctab[256];
-static int bittab[8] = { 128,64,32,16,8,4,2,1 };
static int crcbit[8] = {
- 0x9188,0x48c4,0x2462,0x1231,0x8108,0x4084,0x2042,0x1021
+ 0x9188, 0x48c4, 0x2462, 0x1231, 0x8108, 0x4084, 0x2042, 0x1021
};
/*---------------------------------------------------------------------------*/
static int init_crc(void)
{
- int i,j;
-
- for (i = 0; i < 256; i++) {
- crctab[i] = 0;
- for (j = 0; j < 8; j++) {
- if ((bittab[j] & i) != 0) {
- crctab[i] = crctab[i] ^ crcbit[j];
- }
- }
- }
- return 0;
+ int i,j;
+
+ for (i = 0; i < 256; i++) {
+ crctab[i] = 0;
+ for (j = 0; j < 8; j++) {
+ if ((i << j) & 0x80)
+ crctab[i] = crctab[i] ^ crcbit[j];
+ }
+ }
+ return 0;
}
/*---------------------------------------------------------------------------*/
-static int do_crc(char b, int n, unsigned int crc)
+static int do_crc(char b, unsigned int crc)
{
- crc = (crctab[(crc >> 8)] ^ ((crc << 8) | (b & 0xff))) & 0xffff;
- return (crc);
+ return (crctab[(crc >> 8)] ^ ((crc << 8) | (b & 0xff))) & 0xffff;
+}
+
+unsigned int calc_crc(char *buf, int n, unsigned crc)
+{
+ while (--n >= 0)
+ crc = do_crc(*buf++, crc);
+
+ return crc;
}
/*---------------------------------------------------------------------------*/
@@ -46,11 +51,11 @@ static int do_crc(char b, int n, unsigned int crc)
static long parse_sfbin_date_to_unix(const char *s)
{
- unsigned long x;
+ unsigned long x;
- sscanf(s, "%lX", &x);
+ sscanf(s, "%lX", &x);
- return date_dos2unix(((x << 16) >> 16), (x >> 16));
+ return date_dos2unix(((x << 16) >> 16), (x >> 16));
}
/*---------------------------------------------------------------------------*/
@@ -58,450 +63,443 @@ static long parse_sfbin_date_to_unix(const char *s)
static char * unix_to_sfbin_date_string(long gmt)
{
- static char buf[9];
- unsigned short s_time, s_date;
+ static char buf[9];
+ unsigned short s_time, s_date;
- date_unix2dos(((gmt == -1) ? time(0) : gmt), &s_time, &s_date);
- sprintf(buf, "%X", ((s_date << 16) + s_time));
- return buf;
+ date_unix2dos(((gmt == -1) ? time(0) : gmt), &s_time, &s_date);
+ sprintf(buf, "%X", ((s_date << 16) + s_time));
+ return buf;
}
/*---------------------------------------------------------------------------*/
int bput(void)
{
- struct stat statbuf;
- char buf[1024]; /* < signed int */
- char filename_given[PATH_MAX];
- unsigned long len_read_expected = 0L;
- unsigned long len_read_left;
- time_t file_time = 0L;
- unsigned int msg_crc = 0;
- unsigned int crc = 0;
- char *term_line = 0;
- int last_line_had_CR = 0;
- int len_termline = 0;
- int len = 0;
- int fddata = fdout;
- int is_eof;
- int i;
- char *p;
- char *p_buf;
+ struct stat statbuf;
+ char buf[1024]; /* < signed int */
+ char filename_given[PATH_MAX];
+ unsigned long len_read_expected = 0L;
+ unsigned long len_read_left;
+ time_t file_time = 0L;
+ unsigned int msg_crc = 0;
+ unsigned int crc = 0;
+ char *term_line = 0;
+ int last_line_had_CR = 0;
+ int len_termline = 0;
+ int len = 0;
+ int fddata = fdout;
+ int is_eof;
+ int i;
+ char *p;
+ char *p_buf;
#define save_close(x) { \
- if (!fdout_is_pipe) \
- close(x); \
+ if (!fdout_is_pipe) \
+ close(x); \
}
- for (;;) {
- len = my_read(fdin, buf, sizeof(buf), &is_eof, "\r\n");
- if (is_eof || len < 1) {
- sprintf(err_msg, "error: read failed (%s)\n", strerror(errno));
- return 1;
- }
- if (buf[len-1] == '\n') {
+ for (;;) {
+ len = my_read(fdin, buf, sizeof(buf), &is_eof, "\r\n");
+ if (is_eof || len < 1) {
+ sprintf(err_msg, "error: read failed (%s)\n", strerror(errno));
+ return 1;
+ }
+ if (buf[len-1] == '\n') {
#if 0
- p = "warning: <LF> received. not 8bit clean?\r";
- secure_write(fdout, p, strlen(p));
+ p = "warning: <LF> received. not 8bit clean?\r";
+ secure_write(fdout, p, strlen(p));
#endif
- sprintf(err_msg, "bad EOL: <LF>\n");
- return 1;
- }
- if (IS_BIN_ABORT(buf, len)) {
- sprintf(err_msg, "Aborted by user request\n");
- return 1;
- }
- if (buf[len-1] == '\r' && len > 5 && !memcmp(buf, "#BIN#", 5)) {
- break;
- }
- if (len == sizeof(buf)) {
- sprintf(err_msg, "line to long\n");
- return 1;
- }
- }
- buf[len-1] = 0; /* without trailing \r. and: string termination */
-
- send_on_signal = bin_send_no_on_sig;
-
- /* parse #BIN arguments */
- *filename_given = 0;
-
- p_buf = buf;
- for (i = 0; (p = strsep(&p_buf, "#")); i++) {
- switch(i) {
- case 0:
- case 1:
- break;
- case 2:
- if (*p)
- len_read_expected = (unsigned long ) atol(p);
- break;
- default:
- if (*p == '|') {
- msg_crc = (unsigned int ) atoi(p+1);
- } else if (*p == '$') {
- file_time = parse_sfbin_date_to_unix(p+1);
- } else {
- strncpy(filename_given, p, sizeof(filename_given)-1);
- filename_given[sizeof(filename_given)-1] = 0;
- }
- }
- }
-
- if (!fdout_is_pipe) {
- /* normal mode: store in given filename */
- if (!*filename) {
- p = get_fixed_filename(filename_given, len_read_expected, msg_crc, 1);
- strncpy(filename, p, sizeof(filename)-1);
- filename[sizeof(filename)-1] = 0;
- }
- if (!stat(filename, &statbuf)) {
- /* file exist */
- if (unlink(filename)) {
- sprintf(err_msg, "error: cannot unlink %s (%s)\n", filename, strerror(errno));
- goto abort;
- }
- }
- if ((fddata = open(filename, O_WRONLY | O_CREAT | O_EXCL, 0640)) < 0) {
- sprintf(err_msg, "error: cannot open %s (%s)\n", filename, strerror(errno));
- write(fderr, "\r#NO#\r", 6);
- return 1;
- }
- }
-
- if (!len_read_expected) {
- term_line = "***END\r";
- len_termline = strlen(term_line);
- }
-
- /* say helo */
- send_on_signal = bin_send_abort_on_sig;
- write(fderr, "\r#OK#\r", 6);
-
- len_read_left = len_read_expected;
-
- /* #bin# chechsum initialization */
- init_crc();
-
- for (;;) {
-
- if ((len = my_read(fdin, buf, ((term_line || len_read_left > sizeof(buf)) ? sizeof(buf) : len_read_left), &is_eof, "\r")) < 1) {
- save_close(fddata);
- sprintf(err_msg, "error: read failed (%s)\n", strerror(errno));
- goto abort;
- }
- if (!len) {
- save_close(fddata);
- if (!term_line) {
- sprintf(err_msg, "error: unexpected end of file during read: %s\n", strerror(errno));
- return 1;
- }
- return 0;
- }
-
- if (msg_crc) {
- int i;
- for (i = 0; i < len; i++)
- crc = do_crc((int ) buf[i], 1, crc);
- }
-
- if (buf[len-1] == '\r') {
- if (last_line_had_CR) {
- if (IS_BIN_ABORT(buf, len)) {
- /* "\r#ABORT#\r" was sent */
- if (!fdout_is_pipe) {
- close(fddata);
- /* clean up */
- unlink(filename);
- }
- return 1;
+ sprintf(err_msg, "bad EOL: <LF>\n");
+ return 1;
+ }
+ if (IS_BIN_ABORT(buf, len)) {
+ sprintf(err_msg, "Aborted by user request\n");
+ return 1;
+ }
+ if (buf[len-1] == '\r' && len > 5 && !memcmp(buf, "#BIN#", 5)) {
+ break;
+ }
+ if (len == sizeof(buf)) {
+ sprintf(err_msg, "line to long\n");
+ return 1;
+ }
+ }
+ buf[len-1] = 0; /* without trailing \r. and: string termination */
+
+ send_on_signal = bin_send_no_on_sig;
+
+ /* parse #BIN arguments */
+ *filename_given = 0;
+
+ p_buf = buf;
+ for (i = 0; (p = strsep(&p_buf, "#")); i++) {
+ switch (i) {
+ case 0:
+ case 1:
+ break;
+ case 2:
+ if (*p)
+ len_read_expected = (unsigned long ) atol(p);
+ break;
+ default:
+ if (*p == '|') {
+ msg_crc = (unsigned int ) atoi(p+1);
+ } else if (*p == '$') {
+ file_time = parse_sfbin_date_to_unix(p+1);
+ } else {
+ strncpy(filename_given, p, sizeof(filename_given)-1);
+ filename_given[sizeof(filename_given)-1] = 0;
+ }
+ }
+ }
+
+ if (!fdout_is_pipe) {
+ /* normal mode: store in given filename */
+ if (!*filename) {
+ p = get_fixed_filename(filename_given, len_read_expected, msg_crc, 1);
+ strncpy(filename, p, sizeof(filename)-1);
+ filename[sizeof(filename)-1] = 0;
+ }
+ if (!stat(filename, &statbuf)) {
+ /* file exist */
+ if (unlink(filename)) {
+ sprintf(err_msg, "error: cannot unlink %s (%s)\n", filename, strerror(errno));
+ goto abort;
+ }
+ }
+ if ((fddata = open(filename, O_WRONLY | O_CREAT | O_EXCL, 0640)) < 0) {
+ sprintf(err_msg, "error: cannot open %s (%s)\n", filename, strerror(errno));
+ write(fderr, "\r#NO#\r", 6);
+ return 1;
+ }
+ }
+
+ if (!len_read_expected) {
+ term_line = "***END\r";
+ len_termline = strlen(term_line);
+ }
+
+ /* say helo */
+ send_on_signal = bin_send_abort_on_sig;
+ write(fderr, "\r#OK#\r", 6);
+
+ len_read_left = len_read_expected;
+
+ /* #bin# chechsum initialization */
+ init_crc();
+
+ for (;;) {
+
+ if ((len = my_read(fdin, buf, ((term_line || len_read_left > sizeof(buf)) ? sizeof(buf) : len_read_left), &is_eof, "\r")) < 1) {
+ save_close(fddata);
+ sprintf(err_msg, "error: read failed (%s)\n", strerror(errno));
+ goto abort;
+ }
+ if (!len) {
+ save_close(fddata);
+ if (!term_line) {
+ sprintf(err_msg, "error: unexpected end of file during read: %s\n", strerror(errno));
+ return 1;
+ }
+ return 0;
+ }
+
+ if (msg_crc)
+ crc = calc_crc(buf, len, 0);
+
+ if (buf[len-1] == '\r') {
+ if (last_line_had_CR) {
+ if (IS_BIN_ABORT(buf, len)) {
+ /* "\r#ABORT#\r" was sent */
+ if (!fdout_is_pipe) {
+ close(fddata);
+ /* clean up */
+ unlink(filename);
+ }
+ return 1;
+ }
+ if (term_line && len == len_termline && !memcmp(buf, term_line, len_termline)) {
+ /* sucessfully read until termination string */
+ break;
+ }
+ }
+ last_line_had_CR = 1;
+ } else {
+ last_line_had_CR = 0;
+ }
+ if (!term_line)
+ len_read_left -= len;
+
+ if (secure_write(fddata, buf, len) == -1) {
+ save_close(fddata);
+ sprintf(err_msg, "error: write failed (%s)\n", strerror(errno));
+ goto abort;
+ }
+
+ /* nothing left? */
+ if (!term_line && len_read_left == 0L)
+ break;
+ if (is_eof) {
+ if (!term_line && len_read_left) {
+ save_close(fddata);
+ goto abort;
+ }
+ break;
+ }
}
- if (term_line && len == len_termline && !memcmp(buf, term_line, len_termline)) {
- /* sucessfully read until termination string */
- break;
+ if (crc != msg_crc) {
+ sprintf(err_msg, "Invalid crc: computed %d, expected %d.\n", crc, msg_crc);
+ /* don't unlink */
+ save_close(fddata);
+ return 1;
}
- }
- last_line_had_CR = 1;
- } else {
- last_line_had_CR = 0;
- }
- if (!term_line)
- len_read_left -= len;
-
- if (secure_write(fddata, buf, len) == -1) {
- save_close(fddata);
- sprintf(err_msg, "error: write failed (%s)\n", strerror(errno));
- goto abort;
- }
-
- /* nothing left? */
- if (!term_line && len_read_left == 0L)
- break;
- if (is_eof) {
- if (!term_line && len_read_left) {
- save_close(fddata);
- goto abort;
- }
- break;
- }
- }
- if (crc != msg_crc) {
- sprintf(err_msg, "Invalid crc: computed %d, expected %d.\n", crc, msg_crc);
- /* don't unlink */
- save_close(fddata);
- return 1;
- }
- if (!fdout_is_pipe) {
- close(fddata);
- if (file_time != 0L) {
- struct utimbuf utb;
- utb.modtime = file_time;
- utb.actime = time(0);
- utime(filename, &utb);
- }
- }
-
- send_on_signal = 0;
- return 0;
+ if (!fdout_is_pipe) {
+ close(fddata);
+ if (file_time != 0L) {
+ struct utimbuf utb;
+ utb.modtime = file_time;
+ utb.actime = time(0);
+ utime(filename, &utb);
+ }
+ }
+
+ send_on_signal = 0;
+ return 0;
abort:
- sleep(1);
- write(fderr, "\r#ABORT#\r", 9);
- return 1;
+ sleep(1);
+ write(fderr, "\r#ABORT#\r", 9);
+ return 1;
#undef save_close
}
/*---------------------------------------------------------------------------*/
int bget(void) {
- struct strlist {
- struct strlist *next;
- size_t len;
- char data[1]; /* actually a the address of char * pointer */
- };
-
- struct strlist *stored_file = 0;
- struct strlist *sl_tail = 0;
- struct strlist *sl;
- struct timeval timeout;
- struct stat statbuf;
-
- unsigned int crc = 0;
-
- char buf[1024];
- fd_set readfds;
- int fddata = fdin;
- int len;
- unsigned long file_size = 0;
- unsigned long len_remains;
- int is_eof;
- time_t file_time = 0L;
+ struct strlist {
+ struct strlist *next;
+ size_t len;
+ char data[1]; /* actually a the address of char * pointer */
+ };
+
+ struct strlist *stored_file = 0;
+ struct strlist *sl_tail = 0;
+ struct strlist *sl;
+ struct timeval timeout;
+ struct stat statbuf;
+
+ unsigned int crc = 0;
+
+ char buf[1024];
+ fd_set readfds;
+ int fddata = fdin;
+ int len;
+ unsigned long file_size = 0;
+ unsigned long len_remains;
+ int is_eof;
+ time_t file_time = 0L;
#define save_close(x) { \
- if (!fdin_is_pipe) \
- close(x); \
+ if (!fdin_is_pipe) \
+ close(x); \
}
#define store_line(s, len) { \
- if (!(sl = (struct strlist *) malloc(sizeof(struct strlist *) + sizeof(size_t) + len))) \
- return 1; \
+ if (!(sl = (struct strlist *) malloc(sizeof(struct strlist *) + sizeof(size_t) + len))) \
+ return 1; \
sl->next = 0; \
sl->len = len; \
memcpy(sl->data, s, len); \
if (!stored_file) { \
- stored_file = sl; \
+ stored_file = sl; \
} else { \
- sl_tail->next = sl; \
+ sl_tail->next = sl; \
} \
sl_tail = sl; \
}
- if (BLOCKSIZ < 1 || BLOCKSIZ > sizeof(buf))
- BLOCKSIZ = BLOCKSIZ_DEFAULT;
-
- init_crc();
-
- if (!fdin_is_pipe && *filename) {
- if ((fddata = open(filename, O_RDONLY)) == -1) {
- sprintf(err_msg, "error: cannot open %s (%s)\n", filename, strerror(errno));
- return 1;
- }
- if (!fstat(fddata, &statbuf))
- file_time = statbuf.st_mtime;
- else
- file_time = time(0);
-
- /* compute crc */
- while ((len = read(fddata, buf, BLOCKSIZ)) > 0) {
- int i;
- for (i = 0; i < len; i++)
- crc = do_crc((int ) buf[i], 1, crc);
- file_size += len;
- }
- if (len < 0) {
- sprintf(err_msg, "error: read failed (%s)\n", strerror(errno));
- close(fddata);
- return 1;
- }
- /* rewind */
- if (lseek(fddata, 0L, SEEK_SET) != 0L) {
- sprintf(err_msg, "error: file io failed on lseek() (%s)\n", strerror(errno));
- close(fddata);
- return 1;
- }
- sprintf(buf, "\r#BIN#%ld#|%d#$%s#%s\r", file_size, crc, unix_to_sfbin_date_string(file_time), get_fixed_filename(filename, file_size, crc, 1));
- } else {
- file_time = time(0);
- if (!is_stream || do_crc_only) {
- sprintf(err_msg, "error: not enough memory\n");
- while ((len = read(fddata, buf, sizeof(buf))) > 0) {
- int i;
- for (i = 0; i < len; i++)
- crc = do_crc((int ) buf[i], 1, crc);
- file_size += len;
- if (!do_crc_only)
- store_line(buf, len);
- }
- if (len < 0) {
- sprintf(err_msg, "error: read failed (%s)\n", strerror(errno));
- close(fddata);
- return 1;
- }
- *err_msg = 0;
- sprintf(buf, "\r#BIN#%ld#|%d#$%s#%s\r", file_size, crc, unix_to_sfbin_date_string(file_time), get_fixed_filename(filename, file_size, crc, 1));
- } else {
- sprintf(buf, "\r#BIN###$%s#%s\r", unix_to_sfbin_date_string(file_time), get_fixed_filename(filename, 0, 0, 1));
- }
- /*
- * hack: check for #ABORT# from fdout (fd 1), because fddata (fd 0) is
- * our pipe we read the data from, which we actually tx.
- * believe me, it does work.
- */
- fdin = fdout;
- }
-
- if (do_crc_only) {
- printf("File information for %s:\n", get_fixed_filename(filename, file_size, crc, 1));
- printf(" size %ld bytes, crc %d, date %s (%ld)\n", file_size, crc, unix_to_sfbin_date_string(file_time), file_time);
- return 0;
- }
-
- send_on_signal = bin_send_abort_on_sig;
- if (secure_write(fdout, buf, strlen(buf)) == -1) {
- sprintf(err_msg, "error: write failed (%s)\n", strerror(errno));
- save_close(fddata);
- return 1;
- }
-
- /* wait for answer */
- for (;;) {
- /*
- * make sure we do not read from a pipe. fdout is also
- * assigned to the tty
- */
- len = my_read(fdout, buf, sizeof(buf), &is_eof, "\r\n");
- if (is_eof || len < 1) {
- sprintf(err_msg, "error: read failed (%s)\n", strerror(errno));
- save_close(fddata);
- return 1;
- }
- if (buf[len-1] == '\n') {
+ if (BLOCKSIZ < 1 || BLOCKSIZ > sizeof(buf))
+ BLOCKSIZ = BLOCKSIZ_DEFAULT;
+
+ init_crc();
+
+ if (!fdin_is_pipe && *filename) {
+ if ((fddata = open(filename, O_RDONLY)) == -1) {
+ sprintf(err_msg, "error: cannot open %s (%s)\n", filename, strerror(errno));
+ return 1;
+ }
+ if (!fstat(fddata, &statbuf))
+ file_time = statbuf.st_mtime;
+ else
+ file_time = time(0);
+
+ /* compute crc */
+ while ((len = read(fddata, buf, BLOCKSIZ)) > 0) {
+ crc = calc_crc(buf, len, 0);
+ file_size += len;
+ }
+ if (len < 0) {
+ sprintf(err_msg, "error: read failed (%s)\n", strerror(errno));
+ close(fddata);
+ return 1;
+ }
+ /* rewind */
+ if (lseek(fddata, 0L, SEEK_SET) != 0L) {
+ sprintf(err_msg, "error: file io failed on lseek() (%s)\n", strerror(errno));
+ close(fddata);
+ return 1;
+ }
+ sprintf(buf, "\r#BIN#%ld#|%d#$%s#%s\r", file_size, crc, unix_to_sfbin_date_string(file_time), get_fixed_filename(filename, file_size, crc, 1));
+ } else {
+ file_time = time(0);
+ if (!is_stream || do_crc_only) {
+ sprintf(err_msg, "error: not enough memory\n");
+ while ((len = read(fddata, buf, sizeof(buf))) > 0) {
+ crc = calc_crc(buf, len, 0);
+ file_size += len;
+ if (!do_crc_only)
+ store_line(buf, len);
+ }
+ if (len < 0) {
+ sprintf(err_msg, "error: read failed (%s)\n", strerror(errno));
+ close(fddata);
+ return 1;
+ }
+ *err_msg = 0;
+ sprintf(buf, "\r#BIN#%ld#|%d#$%s#%s\r", file_size, crc, unix_to_sfbin_date_string(file_time), get_fixed_filename(filename, file_size, crc, 1));
+ } else {
+ sprintf(buf, "\r#BIN###$%s#%s\r", unix_to_sfbin_date_string(file_time), get_fixed_filename(filename, 0, 0, 1));
+ }
+ /*
+ * hack: check for #ABORT# from fdout (fd 1), because fddata (fd 0) is
+ * our pipe we read the data from, which we actually tx.
+ * believe me, it does work.
+ */
+ fdin = fdout;
+ }
+
+ if (do_crc_only) {
+ printf("File information for %s:\n", get_fixed_filename(filename, file_size, crc, 1));
+ printf(" size %ld bytes, crc %d, date %s (%ld)\n", file_size, crc, unix_to_sfbin_date_string(file_time), file_time);
+ return 0;
+ }
+
+ send_on_signal = bin_send_abort_on_sig;
+ if (secure_write(fdout, buf, strlen(buf)) == -1) {
+ sprintf(err_msg, "error: write failed (%s)\n", strerror(errno));
+ save_close(fddata);
+ return 1;
+ }
+
+ /* wait for answer */
+ for (;;) {
+ /*
+ * make sure we do not read from a pipe. fdout is also
+ * assigned to the tty
+ */
+ len = my_read(fdout, buf, sizeof(buf), &is_eof, "\r\n");
+ if (is_eof || len < 1) {
+ sprintf(err_msg, "error: read failed (%s)\n", strerror(errno));
+ save_close(fddata);
+ return 1;
+ }
+ if (buf[len-1] == '\n') {
#if 0
- char *p = "warning: <LF> received. not 8bit clean?\r";
- secure_write(fdout, p, strlen(p));
+ char *p = "warning: <LF> received. not 8bit clean?\r";
+ secure_write(fdout, p, strlen(p));
#endif
- sprintf(err_msg, "bad EOL: <LF>\n");
- goto abort;
- } else if (buf[len-1] != '\r') {
- sprintf(err_msg, "line to long\n");
- continue;
- }
- if (IS_BIN_OK(buf, len))
- break;
- if (IS_BIN_NO(buf, len)) {
- save_close(fddata);
- return 0;
- }
- if (IS_BIN_ABORT(buf, len)) {
- sprintf(err_msg, "Aborted by user request\n");
- save_close(fddata);
- return 1;
- }
- }
-
- len_remains = file_size;
- timeout.tv_sec = 0;
- timeout.tv_usec = 0;
-
- for (;;) {
- char *p_buf;
-
- /* check for user \r#ABORT#\r on tty stream */
- FD_ZERO(&readfds);
- FD_SET(fdin, &readfds);
- if (select(fdin+1, &readfds, 0, 0, &timeout) && FD_ISSET(fdin, &readfds)) {
- if ((len = read(fdin, buf, sizeof(buf))) < 0) {
- sprintf(err_msg, "read from tty failed (%s)\n", strerror(errno));
- save_close(fddata);
- goto abort;
- }
- if (IS_BIN_ABORT(buf, len)) {
- sprintf(err_msg, "Aborted by user request\n");
- save_close(fddata);
- return 1;
- }
- }
- /* read data */
- if (!fdin_is_pipe || is_stream) {
- p_buf = buf;
- if ((len = my_read(fddata, buf, ((len_remains > BLOCKSIZ || is_stream) ? BLOCKSIZ : len_remains), &is_eof, 0)) < 1) {
- save_close(fddata);
- if (len < 0) {
- sprintf(err_msg, "error: read failed (%s)\n", strerror(errno));
- goto abort;
- }
- break;
- }
- len_remains -= len;
- } else {
- p_buf = stored_file->data;
- len = stored_file->len;
- }
- /* write to client */
- if (secure_write(fdout, p_buf, len) == -1) {
- sprintf(err_msg, "error: write failed (%s)\n", strerror(errno));
- save_close(fddata);
- goto abort;
- }
- if (fdin_is_pipe && !is_stream) {
- sl = stored_file;
- if (!(stored_file = stored_file->next))
- is_eof = 1;
- free(sl);
- }
- if (!fdin_is_pipe && !len_remains) {
- if (read(fddata, buf, 1) == 1) {
- sprintf(err_msg, "Warning: file has grown in the meantime\n");
- }
- is_eof = 1;
- break;
- }
- /*
- * need this because my_read may returned lenth != 0 (data to be written)
- * but also has detected EOF.
- */
- if (is_eof)
- break;
- }
-
- sleep(10);
-
- return 0;
+ sprintf(err_msg, "bad EOL: <LF>\n");
+ goto abort;
+ } else if (buf[len-1] != '\r') {
+ sprintf(err_msg, "line to long\n");
+ continue;
+ }
+ if (IS_BIN_OK(buf, len))
+ break;
+ if (IS_BIN_NO(buf, len)) {
+ save_close(fddata);
+ return 0;
+ }
+ if (IS_BIN_ABORT(buf, len)) {
+ sprintf(err_msg, "Aborted by user request\n");
+ save_close(fddata);
+ return 1;
+ }
+ }
+
+ len_remains = file_size;
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 0;
+
+ for (;;) {
+ char *p_buf;
+
+ /* check for user \r#ABORT#\r on tty stream */
+ FD_ZERO(&readfds);
+ FD_SET(fdin, &readfds);
+ if (select(fdin+1, &readfds, 0, 0, &timeout) && FD_ISSET(fdin, &readfds)) {
+ if ((len = read(fdin, buf, sizeof(buf))) < 0) {
+ sprintf(err_msg, "read from tty failed (%s)\n", strerror(errno));
+ save_close(fddata);
+ goto abort;
+ }
+ if (IS_BIN_ABORT(buf, len)) {
+ sprintf(err_msg, "Aborted by user request\n");
+ save_close(fddata);
+ return 1;
+ }
+ }
+ /* read data */
+ if (!fdin_is_pipe || is_stream) {
+ p_buf = buf;
+ if ((len = my_read(fddata, buf, ((len_remains > BLOCKSIZ || is_stream) ? BLOCKSIZ : len_remains), &is_eof, 0)) < 1) {
+ save_close(fddata);
+ if (len < 0) {
+ sprintf(err_msg, "error: read failed (%s)\n", strerror(errno));
+ goto abort;
+ }
+ break;
+ }
+ len_remains -= len;
+ } else {
+ p_buf = stored_file->data;
+ len = stored_file->len;
+ }
+ /* write to client */
+ if (secure_write(fdout, p_buf, len) == -1) {
+ sprintf(err_msg, "error: write failed (%s)\n", strerror(errno));
+ save_close(fddata);
+ goto abort;
+ }
+ if (fdin_is_pipe && !is_stream) {
+ sl = stored_file;
+ if (!(stored_file = stored_file->next))
+ is_eof = 1;
+ free(sl);
+ }
+ if (!fdin_is_pipe && !len_remains) {
+ if (read(fddata, buf, 1) == 1) {
+ sprintf(err_msg, "Warning: file has grown in the meantime\n");
+ }
+ is_eof = 1;
+ break;
+ }
+ /*
+ * need this because my_read may returned lenth != 0 (data to be written)
+ * but also has detected EOF.
+ */
+ if (is_eof)
+ break;
+ }
+
+ sleep(10);
+
+ return 0;
abort:
- sleep(1);
- write(fderr, "\r#ABORT#\r", 9);
- return 1;
+ sleep(1);
+ write(fderr, "\r#ABORT#\r", 9);
+ return 1;
#undef save_close
}
diff --git a/ax25/axgetput/util.c b/ax25/axgetput/util.c
index 4aff6a0..5501035 100644
--- a/ax25/axgetput/util.c
+++ b/ax25/axgetput/util.c
@@ -54,15 +54,15 @@ int my_read(int fd, char *s, int len_max, int *eof, char *p_break)
if ((len = read(fd, s_curr, (p_break ? 1 : len_max))) < 1) {
if (len == -1 && errno == EAGAIN) {
- sleep(10);
- continue;
+ sleep(10);
+ continue;
}
*eof = 1;
/*
* len = 0: normal eof. if we're looking for a string, return -1 since
* we have'nt found
*/
- return (len == 0 && p_break ? -1 : (len_got ? len_got : len));
+ return len == 0 && p_break ? -1 : (len_got ? len_got : len);
}
len_got += len;
@@ -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) {
@@ -89,8 +89,8 @@ int secure_write(int fd, char *s, int len_write) {
int len;
if ((len = write(fd, s, len_write_left_curr)) < 0) {
if (len == -1 && errno == EAGAIN) {
- sleep(10);
- continue;
+ sleep(10);
+ continue;
}
return -1;
}
@@ -162,22 +162,22 @@ char *get_fixed_filename(char *line, long size, unsigned int msg_crc, int genera
/* Linear day numbers of the respective 1sts in non-leap years. */
static int day_n[] = { 0,31,59,90,120,151,181,212,243,273,304,334,0,0,0,0 };
- /* JanFebMarApr May Jun Jul Aug Sep Oct Nov Dec */
+ /* JanFebMarApr May Jun Jul Aug Sep Oct Nov Dec */
/*---------------------------------------------------------------------------*/
long date_dos2unix(unsigned short time,unsigned short date)
{
- int month,year;
- long secs;
-
- month = ((date >> 5) & 15)-1;
- year = date >> 9;
- secs = (time & 31)*2+60*((time >> 5) & 63)+(time >> 11)*3600+86400*
- ((date & 31)-1+day_n[month]+(year/4)+year*365-((year & 3) == 0 &&
- month < 2 ? 1 : 0)+3653);
- /* days since 1.1.70 plus 80's leap day */
- return secs;
+ int month,year;
+ long secs;
+
+ month = ((date >> 5) & 15)-1;
+ year = date >> 9;
+ secs = (time & 31)*2+60*((time >> 5) & 63)+(time >> 11)*3600+86400*
+ ((date & 31)-1+day_n[month]+(year/4)+year*365-((year & 3) == 0 &&
+ month < 2 ? 1 : 0)+3653);
+ /* days since 1.1.70 plus 80's leap day */
+ return secs;
}
/*---------------------------------------------------------------------------*/
@@ -186,23 +186,22 @@ long date_dos2unix(unsigned short time,unsigned short date)
void date_unix2dos(int unix_date,unsigned short *time, unsigned short *date)
{
- int day,year,nl_day,month;
-
- *time = (unix_date % 60)/2+(((unix_date/60) % 60) << 5)+
- (((unix_date/3600) % 24) << 11);
- day = unix_date/86400-3652;
- year = day/365;
- if ((year+3)/4+365*year > day) year--;
- day -= (year+3)/4+365*year;
- if (day == 59 && !(year & 3)) {
- nl_day = day;
- month = 2;
- }
- else {
- nl_day = (year & 3) || day <= 59 ? day : day-1;
- for (month = 0; month < 12; month++)
- if (day_n[month] > nl_day) break;
- }
- *date = nl_day-day_n[month-1]+1+(month << 5)+(year << 9);
+ int day,year,nl_day,month;
+
+ *time = (unix_date % 60)/2+(((unix_date/60) % 60) << 5)+
+ (((unix_date/3600) % 24) << 11);
+ day = unix_date/86400-3652;
+ year = day/365;
+ if ((year+3)/4+365*year > day) year--;
+ day -= (year+3)/4+365*year;
+ if (day == 59 && !(year & 3)) {
+ nl_day = day;
+ month = 2;
+ }
+ else {
+ nl_day = (year & 3) || day <= 59 ? day : day-1;
+ for (month = 0; month < 12; month++)
+ if (day_n[month] > nl_day) break;
+ }
+ *date = nl_day-day_n[month-1]+1+(month << 5)+(year << 9);
}
-
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 <callsign> 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 <callsign> 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..71724f7 100644
--- a/ax25/axparms.c
+++ b/ax25/axparms.c
@@ -79,17 +79,17 @@ int routes(int s, int argc, char *argv[], ax25_address *callsign)
return 1;
}
switch (*argv[i]) {
- case 'd':
- case 'D':
- ip_mode = 'D';
- break;
- case 'v':
- case 'V':
- ip_mode = 'V';
- break;
- default:
- ip_mode = ' ';
- break;
+ case 'd':
+ case 'D':
+ ip_mode = 'D';
+ break;
+ case 'v':
+ case 'V':
+ ip_mode = 'V';
+ break;
+ default:
+ ip_mode = ' ';
+ break;
}
} else {
if (ax25_aton_entry(argv[i], (char *)&ax25_route.digi_addr[j]) == -1)
@@ -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;
@@ -319,7 +319,7 @@ int forward(int s, int argc, char *argv[])
return 1;
}
#else
- fprintf(stderr, "axparms: Not compiled in with forwarding option.\n");
+ fprintf(stderr, "axparms: Not compiled in with forwarding option.\n");
#endif /* HAVE_AX25_FWD_STRUCT */
return 0;
@@ -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 6092b77..4b1e410 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)
@@ -219,222 +219,222 @@ struct huffdecodtab {
/* huffman encoding table */
static struct huffencodtab huffencodtab[] = {
-{0xab2c,15},{0xaa84,15},{0x9fc4,15},{0xab3c,15},
-{0xab1c,15},{0xaafc,15},{0xaaec,15},{0xaad4,15},
-{0xaab4,15},{0xf340,10},{0xaaa4,15},{0x7d64,15},
-{0xaadc,15},{0xf400, 7},{0xaa94,15},{0x9ff4,15},
-{0x9fd4,15},{0x7d74,15},{0xab44,15},{0xab34,15},
-{0xab24,15},{0xab14,15},{0xab04,15},{0xaaf4,15},
-{0xaae4,15},{0xab60,14},{0xab0c,15},{0xaacc,15},
-{0xaabc,15},{0xaaac,15},{0xaa9c,15},{0xaa8c,15},
-{0xc000, 3},{0x3a80, 9},{0xabc0,10},{0x0060,11},
-{0x7d40,12},{0xab5c,14},{0x0000,12},{0xab58,14},
-{0x7c00, 9},{0x3c80, 9},{0x7d00,11},{0x0010,12},
-{0x1200, 7},{0x7a00, 7},{0xb800, 6},{0x3200, 7},
-{0x2200, 7},{0xf600, 8},{0x3d00, 8},{0x9e00, 9},
-{0xbd80, 9},{0x7c80, 9},{0x0080, 9},{0xaa00, 9},
-{0xbd00, 9},{0x9f00, 9},{0x0300, 8},{0xab78,13},
-{0xab68,13},{0x3c00, 9},{0x3000, 9},{0x0020,11},
-{0x7d50,12},{0x3800, 7},{0x7800, 7},{0x9c00, 7},
-{0xfe00, 7},{0x2400, 6},{0xbc00, 8},{0x0200, 8},
-{0x0100, 8},{0xf100, 8},{0x0040,11},{0x3100, 8},
-{0xf200, 8},{0x3400, 7},{0x1c00, 7},{0x1e00, 7},
-{0xbe00, 7},{0xaba0,11},{0x3e00, 7},{0x1400, 6},
-{0x3600, 7},{0xf380, 9},{0xf080, 9},{0x2000, 8},
-{0xfc00, 8},{0x9f80,10},{0x9e80, 9},{0xab90,12},
-{0x3b80, 9},{0xab80,12},{0xab54,14},{0x3a50,13},
-{0xab50,14},{0xa000, 5},{0x1800, 6},{0x9800, 6},
-{0x7000, 5},{0x4000, 3},{0x0400, 6},{0xac00, 6},
-{0xf800, 6},{0x6000, 4},{0x3a00,10},{0xfd00, 8},
-{0x2800, 5},{0xb000, 6},{0x8000, 4},{0xb400, 6},
-{0x1000, 7},{0x7d20,12},{0xe000, 5},{0x9000, 5},
-{0xe800, 5},{0x0800, 5},{0xf700, 8},{0xa800, 7},
-{0x7d80, 9},{0xf300,10},{0x7e00, 7},{0xab48,14},
-{0x3a48,13},{0xab4c,14},{0x3a60,12},{0x9ffc,15},
-{0x9fec,15},{0x2100, 8},{0x9fdc,15},{0x9fcc,15},
-{0xf000, 9},{0x7d7c,15},{0x7d6c,15},{0x3a40,14},
-{0xab40,15},{0xab38,15},{0xab30,15},{0xab28,15},
-{0xab20,15},{0xab18,15},{0xab70,13},{0xab10,15},
-{0xab08,15},{0xab00,15},{0xaaf8,15},{0xaaf0,15},
-{0x3b00, 9},{0xaae8,15},{0xaae0,15},{0xaad8,15},
-{0xaad0,15},{0xab64,14},{0x7d30,12},{0xaac8,15},
-{0xaac0,15},{0xaab8,15},{0xaab0,15},{0xaaa8,15},
-{0xaaa0,15},{0xaa98,15},{0xaa90,15},{0xaa88,15},
-{0xaa80,15},{0x9ff8,15},{0x9ff0,15},{0x9fe8,15},
-{0x9fe0,15},{0x9fd8,15},{0x9fd0,15},{0x9fc8,15},
-{0x9fc0,15},{0x7d78,15},{0x7d70,15},{0x3a58,13},
-{0x7d68,15},{0x7d60,15},{0xab46,15},{0xab42,15},
-{0xab3e,15},{0xab3a,15},{0xab36,15},{0xab32,15},
-{0xab2e,15},{0xab2a,15},{0xab26,15},{0xab22,15},
-{0xab1e,15},{0xab1a,15},{0xab16,15},{0xab12,15},
-{0xab0e,15},{0xab0a,15},{0xab06,15},{0xab02,15},
-{0xaafe,15},{0xaafa,15},{0xaaf6,15},{0xaaf2,15},
-{0xaaee,15},{0xaaea,15},{0xaae6,15},{0xaae2,15},
-{0xaade,15},{0xaada,15},{0xaad6,15},{0xaad2,15},
-{0xaace,15},{0xaaca,15},{0xaac6,15},{0xaac2,15},
-{0xaabe,15},{0xaaba,15},{0xaab6,15},{0xaab2,15},
-{0xaaae,15},{0xaaaa,15},{0xaaa6,15},{0xaaa2,15},
-{0xaa9e,15},{0x3a70,12},{0xaa9a,15},{0xaa96,15},
-{0xaa92,15},{0x3080, 9},{0xaa8e,15},{0xaa8a,15},
-{0xaa86,15},{0xaa82,15},{0x9ffe,15},{0x9ffa,15},
-{0x9ff6,15},{0x9ff2,15},{0x9fee,15},{0x9fea,15},
-{0x9fe6,15},{0x9fe2,15},{0x9fde,15},{0x9fda,15},
-{0x9fd6,15},{0x9fd2,15},{0x9fce,15},{0x9fca,15},
-{0x9fc6,15},{0x9fc2,15},{0x7d7e,15},{0x7d7a,15},
-{0x7d76,15},{0x7d72,15},{0x7d6e,15},{0x7d6a,15},
-{0x7d66,15},{0x7d62,15},{0x3a46,15},{0x3a44,15}
+ {0xab2c, 15}, {0xaa84, 15}, {0x9fc4, 15}, {0xab3c, 15},
+ {0xab1c, 15}, {0xaafc, 15}, {0xaaec, 15}, {0xaad4, 15},
+ {0xaab4, 15}, {0xf340, 10}, {0xaaa4, 15}, {0x7d64, 15},
+ {0xaadc, 15}, {0xf400, 7}, {0xaa94, 15}, {0x9ff4, 15},
+ {0x9fd4, 15}, {0x7d74, 15}, {0xab44, 15}, {0xab34, 15},
+ {0xab24, 15}, {0xab14, 15}, {0xab04, 15}, {0xaaf4, 15},
+ {0xaae4, 15}, {0xab60, 14}, {0xab0c, 15}, {0xaacc, 15},
+ {0xaabc, 15}, {0xaaac, 15}, {0xaa9c, 15}, {0xaa8c, 15},
+ {0xc000, 3}, {0x3a80, 9}, {0xabc0, 10}, {0x0060, 11},
+ {0x7d40, 12}, {0xab5c, 14}, {0x0000, 12}, {0xab58, 14},
+ {0x7c00, 9}, {0x3c80, 9}, {0x7d00, 11}, {0x0010, 12},
+ {0x1200, 7}, {0x7a00, 7}, {0xb800, 6}, {0x3200, 7},
+ {0x2200, 7}, {0xf600, 8}, {0x3d00, 8}, {0x9e00, 9},
+ {0xbd80, 9}, {0x7c80, 9}, {0x0080, 9}, {0xaa00, 9},
+ {0xbd00, 9}, {0x9f00, 9}, {0x0300, 8}, {0xab78, 13},
+ {0xab68, 13}, {0x3c00, 9}, {0x3000, 9}, {0x0020, 11},
+ {0x7d50, 12}, {0x3800, 7}, {0x7800, 7}, {0x9c00, 7},
+ {0xfe00, 7}, {0x2400, 6}, {0xbc00, 8}, {0x0200, 8},
+ {0x0100, 8}, {0xf100, 8}, {0x0040, 11}, {0x3100, 8},
+ {0xf200, 8}, {0x3400, 7}, {0x1c00, 7}, {0x1e00, 7},
+ {0xbe00, 7}, {0xaba0, 11}, {0x3e00, 7}, {0x1400, 6},
+ {0x3600, 7}, {0xf380, 9}, {0xf080, 9}, {0x2000, 8},
+ {0xfc00, 8}, {0x9f80, 10}, {0x9e80, 9}, {0xab90, 12},
+ {0x3b80, 9}, {0xab80, 12}, {0xab54, 14}, {0x3a50, 13},
+ {0xab50, 14}, {0xa000, 5}, {0x1800, 6}, {0x9800, 6},
+ {0x7000, 5}, {0x4000, 3}, {0x0400, 6}, {0xac00, 6},
+ {0xf800, 6}, {0x6000, 4}, {0x3a00, 10}, {0xfd00, 8},
+ {0x2800, 5}, {0xb000, 6}, {0x8000, 4}, {0xb400, 6},
+ {0x1000, 7}, {0x7d20, 12}, {0xe000, 5}, {0x9000, 5},
+ {0xe800, 5}, {0x0800, 5}, {0xf700, 8}, {0xa800, 7},
+ {0x7d80, 9}, {0xf300, 10}, {0x7e00, 7}, {0xab48, 14},
+ {0x3a48, 13}, {0xab4c, 14}, {0x3a60, 12}, {0x9ffc, 15},
+ {0x9fec, 15}, {0x2100, 8}, {0x9fdc, 15}, {0x9fcc, 15},
+ {0xf000, 9}, {0x7d7c, 15}, {0x7d6c, 15}, {0x3a40, 14},
+ {0xab40, 15}, {0xab38, 15}, {0xab30, 15}, {0xab28, 15},
+ {0xab20, 15}, {0xab18, 15}, {0xab70, 13}, {0xab10, 15},
+ {0xab08, 15}, {0xab00, 15}, {0xaaf8, 15}, {0xaaf0, 15},
+ {0x3b00, 9}, {0xaae8, 15}, {0xaae0, 15}, {0xaad8, 15},
+ {0xaad0, 15}, {0xab64, 14}, {0x7d30, 12}, {0xaac8, 15},
+ {0xaac0, 15}, {0xaab8, 15}, {0xaab0, 15}, {0xaaa8, 15},
+ {0xaaa0, 15}, {0xaa98, 15}, {0xaa90, 15}, {0xaa88, 15},
+ {0xaa80, 15}, {0x9ff8, 15}, {0x9ff0, 15}, {0x9fe8, 15},
+ {0x9fe0, 15}, {0x9fd8, 15}, {0x9fd0, 15}, {0x9fc8, 15},
+ {0x9fc0, 15}, {0x7d78, 15}, {0x7d70, 15}, {0x3a58, 13},
+ {0x7d68, 15}, {0x7d60, 15}, {0xab46, 15}, {0xab42, 15},
+ {0xab3e, 15}, {0xab3a, 15}, {0xab36, 15}, {0xab32, 15},
+ {0xab2e, 15}, {0xab2a, 15}, {0xab26, 15}, {0xab22, 15},
+ {0xab1e, 15}, {0xab1a, 15}, {0xab16, 15}, {0xab12, 15},
+ {0xab0e, 15}, {0xab0a, 15}, {0xab06, 15}, {0xab02, 15},
+ {0xaafe, 15}, {0xaafa, 15}, {0xaaf6, 15}, {0xaaf2, 15},
+ {0xaaee, 15}, {0xaaea, 15}, {0xaae6, 15}, {0xaae2, 15},
+ {0xaade, 15}, {0xaada, 15}, {0xaad6, 15}, {0xaad2, 15},
+ {0xaace, 15}, {0xaaca, 15}, {0xaac6, 15}, {0xaac2, 15},
+ {0xaabe, 15}, {0xaaba, 15}, {0xaab6, 15}, {0xaab2, 15},
+ {0xaaae, 15}, {0xaaaa, 15}, {0xaaa6, 15}, {0xaaa2, 15},
+ {0xaa9e, 15}, {0x3a70, 12}, {0xaa9a, 15}, {0xaa96, 15},
+ {0xaa92, 15}, {0x3080, 9}, {0xaa8e, 15}, {0xaa8a, 15},
+ {0xaa86, 15}, {0xaa82, 15}, {0x9ffe, 15}, {0x9ffa, 15},
+ {0x9ff6, 15}, {0x9ff2, 15}, {0x9fee, 15}, {0x9fea, 15},
+ {0x9fe6, 15}, {0x9fe2, 15}, {0x9fde, 15}, {0x9fda, 15},
+ {0x9fd6, 15}, {0x9fd2, 15}, {0x9fce, 15}, {0x9fca, 15},
+ {0x9fc6, 15}, {0x9fc2, 15}, {0x7d7e, 15}, {0x7d7a, 15},
+ {0x7d76, 15}, {0x7d72, 15}, {0x7d6e, 15}, {0x7d6a, 15},
+ {0x7d66, 15}, {0x7d62, 15}, {0x3a46, 15}, {0x3a44, 15}
};
/* huffman decoding table */
static struct huffdecodtab huffdecodtab[] = {
{ 79, 1},{ 2, 66},{ 24, 3},{ 4,208},
-{292, 5},{ 6,298},{317, 7},{ 16, 8},
-{ 9,173},{ 10,116},{ 41, 11},{ 12, 37},
-{125, 13},{357, 14},{ 15,438},{ 0, 0},
-{229, 17},{ 18, 46},{ 19, 61},{ 20, 99},
-{ 21,161},{404, 22},{ 23,483},{ 1, 0},
-{306, 25},{313, 26},{294, 27},{245, 28},
-{221, 29},{231, 30},{277, 31},{ 32,103},
-{ 33,108},{ 34,339},{421, 35},{ 36,500},
-{ 2, 0},{122, 38},{353, 39},{ 40,434},
-{ 3, 0},{131, 42},{128, 43},{361, 44},
-{ 45,442},{ 4, 0},{ 56, 47},{ 52, 48},
-{135, 49},{370, 50},{ 51,450},{ 5, 0},
-{138, 53},{375, 54},{ 55,454},{ 6, 0},
-{148, 57},{ 58, 94},{381, 59},{ 60,460},
-{ 7, 0},{ 75, 62},{ 63,152},{392, 64},
-{ 65,469},{ 8, 0},{164, 67},{311, 68},
-{ 69,246},{ 70, 97},{253, 71},{257, 72},
-{ 73,270},{319, 74},{ 9, 0},{ 76,155},
-{396, 77},{ 78,473},{ 10, 0},{165, 80},
-{296, 81},{300, 82},{295, 83},{206, 84},
-{ 85,320},{193, 86},{ 87,318},{199, 88},
-{184, 89},{ 90,112},{ 91,346},{430, 92},
-{ 93,508},{ 11, 0},{379, 95},{ 96,458},
-{ 12, 0},{ 98,218},{ 13, 0},{100,158},
-{400,101},{102,478},{ 14, 0},{331,104},
-{105,328},{408,106},{107,487},{ 15, 0},
-{109,336},{417,110},{111,496},{ 16, 0},
-{113,343},{425,114},{115,504},{ 17, 0},
-{117,141},{118,186},{119,321},{351,120},
-{121,432},{ 18, 0},{355,123},{124,436},
-{ 19, 0},{359,126},{127,440},{ 20, 0},
-{364,129},{130,444},{ 21, 0},{132,145},
-{368,133},{134,448},{ 22, 0},{372,136},
-{137,452},{ 23, 0},{377,139},{140,456},
-{ 24, 0},{142,234},{143,236},{144,383},
-{ 25, 0},{366,146},{147,446},{ 26, 0},
-{387,149},{385,150},{151,462},{ 27, 0},
-{390,153},{154,467},{ 28, 0},{394,156},
-{157,471},{ 29, 0},{398,159},{160,475},
-{ 30, 0},{402,162},{163,481},{ 31, 0},
-{ 32, 0},{175,166},{214,167},{211,168},
-{169,195},{243,170},{171,281},{286,172},
-{ 33, 0},{265,174},{ 34, 0},{176,202},
-{177,315},{178,297},{179,232},{180,252},
-{181,228},{189,182},{255,183},{ 35, 0},
-{185,242},{ 36, 0},{284,187},{192,188},
-{ 37, 0},{190,241},{191,201},{ 38, 0},
-{ 39, 0},{194,227},{ 40, 0},{196,267},
-{197,220},{237,198},{ 41, 0},{200,309},
-{ 42, 0},{ 43, 0},{203,260},{204,268},
-{308,205},{ 44, 0},{244,207},{ 45, 0},
-{304,209},{210,223},{ 46, 0},{212,258},
-{238,213},{ 47, 0},{215,303},{216,249},
-{273,217},{ 48, 0},{219,316},{ 49, 0},
-{ 50, 0},{222,278},{ 51, 0},{224,264},
-{250,225},{230,226},{ 52, 0},{ 53, 0},
-{ 54, 0},{ 55, 0},{ 56, 0},{ 57, 0},
-{251,233},{ 58, 0},{363,235},{ 59, 0},
-{ 60, 0},{ 61, 0},{239,256},{240,480},
-{ 62, 0},{ 63, 0},{ 64, 0},{ 65, 0},
-{ 66, 0},{ 67, 0},{299,247},{275,248},
-{ 68, 0},{ 69, 0},{ 70, 0},{ 71, 0},
-{ 72, 0},{271,254},{ 73, 0},{ 74, 0},
-{ 75, 0},{ 76, 0},{259,269},{ 77, 0},
-{293,261},{262,263},{ 78, 0},{ 79, 0},
-{ 80, 0},{279,266},{ 81, 0},{ 82, 0},
-{ 83, 0},{ 84, 0},{ 85, 0},{342,272},
-{ 86, 0},{274,335},{ 87, 0},{276,302},
-{ 88, 0},{ 89, 0},{ 90, 0},{283,280},
-{ 91, 0},{374,282},{ 92, 0},{ 93, 0},
-{291,285},{ 94, 0},{301,287},{288,326},
-{323,289},{290,427},{ 95, 0},{ 96, 0},
-{ 97, 0},{ 98, 0},{ 99, 0},{100, 0},
-{101, 0},{102, 0},{103, 0},{104, 0},
-{105, 0},{106, 0},{107, 0},{108, 0},
-{305,307},{109, 0},{110, 0},{111, 0},
-{112, 0},{310,384},{113, 0},{312,314},
-{114, 0},{115, 0},{116, 0},{117, 0},
-{118, 0},{119, 0},{120, 0},{121, 0},
-{122, 0},{322,325},{123, 0},{349,324},
-{124, 0},{125, 0},{327,476},{126, 0},
-{406,329},{330,485},{127, 0},{412,332},
-{410,333},{334,489},{128, 0},{129, 0},
-{415,337},{338,494},{130, 0},{419,340},
-{341,498},{131, 0},{132, 0},{423,344},
-{345,502},{133, 0},{428,347},{348,506},
-{134, 0},{350,510},{135, 0},{352,433},
-{136, 0},{354,435},{137, 0},{356,437},
-{138, 0},{358,439},{139, 0},{360,441},
-{140, 0},{362,443},{141, 0},{142, 0},
-{365,445},{143, 0},{367,447},{144, 0},
-{369,449},{145, 0},{371,451},{146, 0},
-{373,453},{147, 0},{148, 0},{376,455},
-{149, 0},{378,457},{150, 0},{380,459},
-{151, 0},{382,461},{152, 0},{153, 0},
-{154, 0},{386,463},{155, 0},{388,464},
-{389,466},{156, 0},{391,468},{157, 0},
-{393,470},{158, 0},{395,472},{159, 0},
-{397,474},{160, 0},{399,477},{161, 0},
-{401,479},{162, 0},{403,482},{163, 0},
-{405,484},{164, 0},{407,486},{165, 0},
-{409,488},{166, 0},{411,490},{167, 0},
-{413,491},{414,493},{168, 0},{416,495},
-{169, 0},{418,497},{170, 0},{420,499},
-{171, 0},{422,501},{172, 0},{424,503},
-{173, 0},{426,505},{174, 0},{175, 0},
-{429,507},{176, 0},{431,509},{177, 0},
-{178, 0},{179, 0},{180, 0},{181, 0},
-{182, 0},{183, 0},{184, 0},{185, 0},
-{186, 0},{187, 0},{188, 0},{189, 0},
-{190, 0},{191, 0},{192, 0},{193, 0},
-{194, 0},{195, 0},{196, 0},{197, 0},
-{198, 0},{199, 0},{200, 0},{201, 0},
-{202, 0},{203, 0},{204, 0},{205, 0},
-{206, 0},{207, 0},{208, 0},{209, 0},
-{ 0,465},{210, 0},{211, 0},{212, 0},
-{213, 0},{214, 0},{215, 0},{216, 0},
-{217, 0},{218, 0},{219, 0},{220, 0},
-{221, 0},{222, 0},{223, 0},{224, 0},
-{225, 0},{226, 0},{227, 0},{228, 0},
-{229, 0},{230, 0},{231, 0},{232, 0},
-{233, 0},{234, 0},{235, 0},{ 0,492},
-{236, 0},{237, 0},{238, 0},{239, 0},
-{240, 0},{241, 0},{242, 0},{243, 0},
-{244, 0},{245, 0},{246, 0},{247, 0},
-{248, 0},{249, 0},{250, 0},{251, 0},
-{252, 0},{253, 0},{512,511},{254, 0},
-{255, 0}
+ {292, 5}, { 6,298}, {317, 7}, { 16, 8},
+ { 9,173}, { 10,116}, { 41, 11}, { 12, 37},
+ {125, 13}, {357, 14}, { 15,438}, { 0, 0},
+ {229, 17}, { 18, 46}, { 19, 61}, { 20, 99},
+ { 21,161}, {404, 22}, { 23,483}, { 1, 0},
+ {306, 25}, {313, 26}, {294, 27}, {245, 28},
+ {221, 29}, {231, 30}, {277, 31}, { 32,103},
+ { 33,108}, { 34,339}, {421, 35}, { 36,500},
+ { 2, 0}, {122, 38}, {353, 39}, { 40,434},
+ { 3, 0}, {131, 42}, {128, 43}, {361, 44},
+ { 45,442}, { 4, 0}, { 56, 47}, { 52, 48},
+ {135, 49}, {370, 50}, { 51,450}, { 5, 0},
+ {138, 53}, {375, 54}, { 55,454}, { 6, 0},
+ {148, 57}, { 58, 94}, {381, 59}, { 60,460},
+ { 7, 0}, { 75, 62}, { 63,152}, {392, 64},
+ { 65,469}, { 8, 0}, {164, 67}, {311, 68},
+ { 69,246}, { 70, 97}, {253, 71}, {257, 72},
+ { 73,270}, {319, 74}, { 9, 0}, { 76,155},
+ {396, 77}, { 78,473}, { 10, 0}, {165, 80},
+ {296, 81}, {300, 82}, {295, 83}, {206, 84},
+ { 85,320}, {193, 86}, { 87,318}, {199, 88},
+ {184, 89}, { 90,112}, { 91,346}, {430, 92},
+ { 93,508}, { 11, 0}, {379, 95}, { 96,458},
+ { 12, 0}, { 98,218}, { 13, 0}, {100,158},
+ {400,101}, {102,478}, { 14, 0}, {331,104},
+ {105,328}, {408,106}, {107,487}, { 15, 0},
+ {109,336}, {417,110}, {111,496}, { 16, 0},
+ {113,343}, {425,114}, {115,504}, { 17, 0},
+ {117,141}, {118,186}, {119,321}, {351,120},
+ {121,432}, { 18, 0}, {355,123}, {124,436},
+ { 19, 0}, {359,126}, {127,440}, { 20, 0},
+ {364,129}, {130,444}, { 21, 0}, {132,145},
+ {368,133}, {134,448}, { 22, 0}, {372,136},
+ {137,452}, { 23, 0}, {377,139}, {140,456},
+ { 24, 0}, {142,234}, {143,236}, {144,383},
+ { 25, 0}, {366,146}, {147,446}, { 26, 0},
+ {387,149}, {385,150}, {151,462}, { 27, 0},
+ {390,153}, {154,467}, { 28, 0}, {394,156},
+ {157,471}, { 29, 0}, {398,159}, {160,475},
+ { 30, 0}, {402,162}, {163,481}, { 31, 0},
+ { 32, 0}, {175,166}, {214,167}, {211,168},
+ {169,195}, {243,170}, {171,281}, {286,172},
+ { 33, 0}, {265,174}, { 34, 0}, {176,202},
+ {177,315}, {178,297}, {179,232}, {180,252},
+ {181,228}, {189,182}, {255,183}, { 35, 0},
+ {185,242}, { 36, 0}, {284,187}, {192,188},
+ { 37, 0}, {190,241}, {191,201}, { 38, 0},
+ { 39, 0}, {194,227}, { 40, 0}, {196,267},
+ {197,220}, {237,198}, { 41, 0}, {200,309},
+ { 42, 0}, { 43, 0}, {203,260}, {204,268},
+ {308,205}, { 44, 0}, {244,207}, { 45, 0},
+ {304,209}, {210,223}, { 46, 0}, {212,258},
+ {238,213}, { 47, 0}, {215,303}, {216,249},
+ {273,217}, { 48, 0}, {219,316}, { 49, 0},
+ { 50, 0}, {222,278}, { 51, 0}, {224,264},
+ {250,225}, {230,226}, { 52, 0}, { 53, 0},
+ { 54, 0}, { 55, 0}, { 56, 0}, { 57, 0},
+ {251,233}, { 58, 0}, {363,235}, { 59, 0},
+ { 60, 0}, { 61, 0}, {239,256}, {240,480},
+ { 62, 0}, { 63, 0}, { 64, 0}, { 65, 0},
+ { 66, 0}, { 67, 0}, {299,247}, {275,248},
+ { 68, 0}, { 69, 0}, { 70, 0}, { 71, 0},
+ { 72, 0}, {271,254}, { 73, 0}, { 74, 0},
+ { 75, 0}, { 76, 0}, {259,269}, { 77, 0},
+ {293,261}, {262,263}, { 78, 0}, { 79, 0},
+ { 80, 0}, {279,266}, { 81, 0}, { 82, 0},
+ { 83, 0}, { 84, 0}, { 85, 0}, {342,272},
+ { 86, 0}, {274,335}, { 87, 0}, {276,302},
+ { 88, 0}, { 89, 0}, { 90, 0}, {283,280},
+ { 91, 0}, {374,282}, { 92, 0}, { 93, 0},
+ {291,285}, { 94, 0}, {301,287}, {288,326},
+ {323,289}, {290,427}, { 95, 0}, { 96, 0},
+ { 97, 0}, { 98, 0}, { 99, 0}, {100, 0},
+ {101, 0}, {102, 0}, {103, 0}, {104, 0},
+ {105, 0}, {106, 0}, {107, 0}, {108, 0},
+ {305,307}, {109, 0}, {110, 0}, {111, 0},
+ {112, 0}, {310,384}, {113, 0}, {312,314},
+ {114, 0}, {115, 0}, {116, 0}, {117, 0},
+ {118, 0}, {119, 0}, {120, 0}, {121, 0},
+ {122, 0}, {322,325}, {123, 0}, {349,324},
+ {124, 0}, {125, 0}, {327,476}, {126, 0},
+ {406,329}, {330,485}, {127, 0}, {412,332},
+ {410,333}, {334,489}, {128, 0}, {129, 0},
+ {415,337}, {338,494}, {130, 0}, {419,340},
+ {341,498}, {131, 0}, {132, 0}, {423,344},
+ {345,502}, {133, 0}, {428,347}, {348,506},
+ {134, 0}, {350,510}, {135, 0}, {352,433},
+ {136, 0}, {354,435}, {137, 0}, {356,437},
+ {138, 0}, {358,439}, {139, 0}, {360,441},
+ {140, 0}, {362,443}, {141, 0}, {142, 0},
+ {365,445}, {143, 0}, {367,447}, {144, 0},
+ {369,449}, {145, 0}, {371,451}, {146, 0},
+ {373,453}, {147, 0}, {148, 0}, {376,455},
+ {149, 0}, {378,457}, {150, 0}, {380,459},
+ {151, 0}, {382,461}, {152, 0}, {153, 0},
+ {154, 0}, {386,463}, {155, 0}, {388,464},
+ {389,466}, {156, 0}, {391,468}, {157, 0},
+ {393,470}, {158, 0}, {395,472}, {159, 0},
+ {397,474}, {160, 0}, {399,477}, {161, 0},
+ {401,479}, {162, 0}, {403,482}, {163, 0},
+ {405,484}, {164, 0}, {407,486}, {165, 0},
+ {409,488}, {166, 0}, {411,490}, {167, 0},
+ {413,491}, {414,493}, {168, 0}, {416,495},
+ {169, 0}, {418,497}, {170, 0}, {420,499},
+ {171, 0}, {422,501}, {172, 0}, {424,503},
+ {173, 0}, {426,505}, {174, 0}, {175, 0},
+ {429,507}, {176, 0}, {431,509}, {177, 0},
+ {178, 0}, {179, 0}, {180, 0}, {181, 0},
+ {182, 0}, {183, 0}, {184, 0}, {185, 0},
+ {186, 0}, {187, 0}, {188, 0}, {189, 0},
+ {190, 0}, {191, 0}, {192, 0}, {193, 0},
+ {194, 0}, {195, 0}, {196, 0}, {197, 0},
+ {198, 0}, {199, 0}, {200, 0}, {201, 0},
+ {202, 0}, {203, 0}, {204, 0}, {205, 0},
+ {206, 0}, {207, 0}, {208, 0}, {209, 0},
+ { 0,465}, {210, 0}, {211, 0}, {212, 0},
+ {213, 0}, {214, 0}, {215, 0}, {216, 0},
+ {217, 0}, {218, 0}, {219, 0}, {220, 0},
+ {221, 0}, {222, 0}, {223, 0}, {224, 0},
+ {225, 0}, {226, 0}, {227, 0}, {228, 0},
+ {229, 0}, {230, 0}, {231, 0}, {232, 0},
+ {233, 0}, {234, 0}, {235, 0}, { 0,492},
+ {236, 0}, {237, 0}, {238, 0}, {239, 0},
+ {240, 0}, {241, 0}, {242, 0}, {243, 0},
+ {244, 0}, {245, 0}, {246, 0}, {247, 0},
+ {248, 0}, {249, 0}, {250, 0}, {251, 0},
+ {252, 0}, {253, 0}, {512,511}, {254, 0},
+ {255, 0}
};
static unsigned char mask8tab[8] = {
- 0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01
+ 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01
};
static unsigned short mask16tab[16] = {
- 0x8000,0x4000,0x2000,0x1000,0x0800,0x0400,0x0200,0x0100,
- 0x0080,0x0040,0x0020,0x0010,0x0008,0x0004,0x0002,0x0001
+ 0x8000, 0x4000, 0x2000, 0x1000, 0x0800, 0x0400, 0x0200, 0x0100,
+ 0x0080, 0x0040, 0x0020, 0x0010, 0x0008, 0x0004, 0x0002, 0x0001
};
char policy_add_user = 1;
-char policy_add_empty_password = 0;
-char policy_add_prog_useradd = 0;
+char policy_add_empty_password;
+char policy_add_prog_useradd;
char policy_guest = 1;
-char policy_associate = 0;
+char policy_associate;
char pwcheck = 1;
-char secure_home = 0;
+char secure_home;
gid_t user_gid = 400;
char *user_shell = "/bin/bash";
@@ -445,8 +445,8 @@ int start_uid = 400;
int end_uid = 65535;
int paclen = ROSE_PACLEN; /* Its the shortest ie safest */
-int huffman = 0;
-int bin = 0;
+int huffman;
+int bin;
int fdmaster;
struct write_queue {
@@ -455,8 +455,8 @@ struct write_queue {
unsigned int len;
};
-struct write_queue *wqueue_head = NULL;
-struct write_queue *wqueue_tail = NULL;
+struct write_queue *wqueue_head;
+struct write_queue *wqueue_tail;
long wqueue_length = 0L;
@@ -511,7 +511,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
*/
@@ -524,14 +524,14 @@ 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);
+ return 1;
}
if (srclen > 255) {
syslog(LOG_NOTICE, "Huffman encode: srclen > 255: %d", srclen);
- return(1);
+ return 1;
}
srcptr = src;
destptr = &dest[1];
@@ -554,7 +554,7 @@ int encstathuf(char *src, int srclen, char *dest, int *destlen)
memcpy(&dest[1],src,srclen);
dest[0] = 255;
*destlen = srclen + 1;
- return(0);
+ return 0;
}
bit8 = 0;
*destptr = 0;
@@ -572,11 +572,11 @@ int encstathuf(char *src, int srclen, char *dest, int *destlen)
if (bit8 != 0) (*destlen)++;
(*destlen)++;
dest[0] = (char)(srclen-1);
- return(0);
+ return 0;
}
/* 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
*/
@@ -590,24 +590,24 @@ int decstathuf(char *src, char *dest, int srclen, int *destlen)
unsigned short decod;
unsigned short newnode;
- if ((src == NULL) || (dest == NULL)) return(1);
+ if ((src == NULL) || (dest == NULL)) return 1;
srcptr = src;
destptr = dest;
*destlen = (int)((*srcptr)+1);
srcptr++;
if (--srclen == 0) {
- return(1);
+ return 1;
}
if (*destlen == 0) {
- return(1);
+ return 1;
}
if (*destlen == 256) {
/* no compression, only copy */
memcpy(dest,src+1,srclen);
*destlen = (unsigned char)(srclen);
- return(0);
+ return 0;
}
wrklen = 0;
decod = 0;
@@ -641,10 +641,10 @@ int decstathuf(char *src, char *dest, int srclen, int *destlen)
if (wrklen >= *destlen) break;
bitmask = 0x80;
srcptr++;
- if (srclen == 0) return(1);
+ if (srclen == 0) return 1;
srclen--;
}
- return(0);
+ return 0;
}
@@ -656,7 +656,7 @@ int _write_ax25(const char *s, int len)
i = write(1, s, len);
fflush(stdout);
- return (i > 0 ? i : 0); /* on error, -1 is returned */
+ return i > 0 ? i : 0; /* on error, -1 is returned */
}
int read_ax25(unsigned char *s, int size)
@@ -673,19 +673,19 @@ int read_ax25(unsigned char *s, int size)
if (huffman) {
if (!decstathuf(s, decomp, len, &declen)) {
- *(decomp+declen) = 0;
+ *(decomp+declen) = 0;
strcpy(s, decomp);
len = declen;
}
}
if (bin) {
- return(len);
+ 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");
@@ -748,7 +748,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;
@@ -769,7 +769,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);
@@ -778,7 +778,7 @@ void kick_wqueue(int dummy)
if (w_buf->len > curr_len) {
/* rewrite current buffer, and break */
w_buf->len -= curr_len;
- for (q = w_buf->data, r = w_buf->data+curr_len, i = 0; i < w_buf->len; i++)
+ for (q = w_buf->data, r = w_buf->data+curr_len, i = 0; i < w_buf->len; i++)
*q++ = *r++;
break;
}
@@ -823,7 +823,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;
@@ -835,7 +835,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;
@@ -852,12 +852,12 @@ int write_ax25(char *s, int len, int kick)
struct termios termios;
static struct termios save_termios;
static struct termios save_termios_master;
- static int last_ended_with_CR = 0;
+ static int last_ended_with_CR;
int i = 0;
int j = 0;
char *p;
-
+
if (!len)
return 0;
signal(SIGALRM, SIG_IGN);
@@ -881,7 +881,7 @@ int write_ax25(char *s, int len, int kick)
bin = 1;
kick_wqueue(0);
return 0;
- }
+ }
if (bin && !strncmp(s, "//BIN OFF\r", 10)) {
kick_wqueue(0);
@@ -890,7 +890,7 @@ int write_ax25(char *s, int len, int kick)
tcsetattr(0, TCSANOW, &save_termios);
last_ended_with_CR = 0;
return 0;
- }
+ }
if (!bin) {
@@ -912,12 +912,12 @@ int write_ax25(char *s, int len, int kick)
}
while (j < len) {
if ((j + 1 < len) && *(p + j) == '\r' && *(p + j + 1) == '\n') {
- *(p + i) = '\r';
+ *(p + i) = '\r';
j++;
}
else
*(p + i) = *(p + j);
- i++; j++;
+ i++; j++;
}
len = i;
if (len && s[len-1] == '\r')
@@ -937,8 +937,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;
@@ -949,7 +949,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);
@@ -969,13 +969,13 @@ 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))
+
+ while (!feof(fp))
{
if (fscanf(fp, "%d %s", &uid, buf) == 2)
if (sax25->sax25_uid == uid)
@@ -986,7 +986,7 @@ int get_assoc(struct sockaddr_ax25 *sax25)
}
}
fclose(fp);
-
+
return -1;
}
@@ -1037,8 +1037,8 @@ void signal_handler_sigchild(int dummy)
{
exit(0);
}
-
-/*
+
+/*
* add a new user to /etc/passwd and do some init
*/
@@ -1058,7 +1058,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
*/
@@ -1090,14 +1090,14 @@ retry:
/*
* build directories for home
*/
-
+
p = homedir;
-
+
while (*p == '/') p++;
chdir("/");
- while(p)
+ while (p)
{
q = strchr(p, '/');
if (q)
@@ -1135,12 +1135,12 @@ retry:
{
chown(p, uid, user_gid);
chmod(p, homedir_mode);
- }
+ }
}
else
goto out;
}
-
+
if (chdir(p) < 0)
goto out;
p = q;
@@ -1156,16 +1156,16 @@ end_mkdirs:
pid_t pid = -1;
struct stat statbuf;
if (!user_shell_configured && stat(USERADD_CONF, &statbuf) == -1) {
- /* some programs need a shell explicitely specified
- * in /etc/passwd, although this field is not required
- * (and useradd does not set a shell when not
- * specified).
- * useradd has a config file. On debian for e.g.,
- * there is no /etc/default/useradd. Thus we
- * explecitely give the shell option to useradd, when
- * no useradd config file is present.
- */
- user_shell_configured = 1;
+ /* some programs need a shell explicitely specified
+ * in /etc/passwd, although this field is not required
+ * (and useradd does not set a shell when not
+ * specified).
+ * useradd has a config file. On debian for e.g.,
+ * there is no /etc/default/useradd. Thus we
+ * explecitely give the shell option to useradd, when
+ * no useradd config file is present.
+ */
+ user_shell_configured = 1;
}
pid = fork();
@@ -1218,7 +1218,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;
@@ -1226,12 +1226,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);
}
@@ -1241,7 +1241,7 @@ end_mkdirs:
*/
fd_a = open(CONF_AXSPAWN_PROF_FILE, O_RDONLY);
-
+
if (fd_a > 0)
{
int first = 1;
@@ -1249,7 +1249,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);
@@ -1264,7 +1264,7 @@ end_mkdirs:
* as an optimization.
* -> mark #!... as ##
*/
- if (buf[0] == '#' && buf[1] == '!')
+ if (buf[0] == '#' && buf[1] == '!')
buf[1] = '#';
first = 0;
}
@@ -1284,16 +1284,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);
if ((p = strchr(buf, '#')) || (p = strchr(buf, '\n')))
*p='\0';
-
+
if (buf[0] != '\0')
{
sscanf(buf, "%s %s", cmd, param);
@@ -1359,12 +1359,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))
@@ -1378,7 +1378,7 @@ void read_config(void)
}
}
}
-
+
fclose(fp);
}
@@ -1430,7 +1430,7 @@ int main(int argc, char **argv)
digits = letters = invalid = ssid = ssidcnt = 0;
- for (k = 1; k < argc; k++){
+ for (k = 1; k < argc; k++) {
if (!strcmp(argv[k], "-w") || !strcmp(argv[k], "--wait"))
wait_for_tcp = 1;
if (!strcmp(argv[k], "-c") || !strcmp(argv[k], "--changeuser"))
@@ -1463,7 +1463,7 @@ int main(int argc, char **argv)
}
}
strupr(prompt);
-
+
openlog("axspawn", LOG_PID, LOG_DAEMON);
if (getuid() != 0) {
@@ -1474,34 +1474,34 @@ 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;
}
switch (sockaddr.fsax25.fsa_ax25.sax25_family) {
- case AF_AX25:
- strcpy(call, ax25_ntoa(&sockaddr.fsax25.fsa_ax25.sax25_call));
- protocol = "AX.25";
- paclen = AX_PACLEN;
- break;
-
- case AF_NETROM:
- strcpy(call, ax25_ntoa(&sockaddr.fsax25.fsa_ax25.sax25_call));
- protocol = "NET/ROM";
- paclen = NETROM_PACLEN;
- break;
-
- case AF_ROSE:
- strcpy(call, ax25_ntoa(&sockaddr.rose.srose_call));
- protocol = "Rose";
- paclen = ROSE_PACLEN;
- break;
-
- default:
- syslog(LOG_NOTICE, "peer is not an AX.25, NET/ROM or Rose socket\n");
- return 1;
+ case AF_AX25:
+ strcpy(call, ax25_ntoa(&sockaddr.fsax25.fsa_ax25.sax25_call));
+ protocol = "AX.25";
+ paclen = AX_PACLEN;
+ break;
+
+ case AF_NETROM:
+ strcpy(call, ax25_ntoa(&sockaddr.fsax25.fsa_ax25.sax25_call));
+ protocol = "NET/ROM";
+ paclen = NETROM_PACLEN;
+ break;
+
+ case AF_ROSE:
+ strcpy(call, ax25_ntoa(&sockaddr.rose.srose_call));
+ protocol = "Rose";
+ paclen = ROSE_PACLEN;
+ break;
+
+ default:
+ syslog(LOG_NOTICE, "peer is not an AX.25, NET/ROM or Rose socket\n");
+ return 1;
}
for (k = 0; k < strlen(call); k++)
@@ -1520,7 +1520,7 @@ int main(int argc, char **argv)
{
ssid *= 10;
ssid += (int) (call[k] - '0');
-
+
if (ssid > 15) invalid++;
}
ssidcnt++;
@@ -1544,7 +1544,7 @@ int main(int argc, char **argv)
else
invalid++;
}
-
+
if ( invalid || (k < MINLEN) || (digits > 2) || (digits < 1) )
{
write_ax25_static_line(MSG_NOCALL);
@@ -1552,7 +1552,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)
@@ -1585,7 +1585,7 @@ int main(int argc, char **argv)
user_changed = 1;
}
}
-
+
if (!*as_user)
strcpy(as_user, user);
pw = getpwnam(as_user);
@@ -1599,7 +1599,7 @@ int main(int argc, char **argv)
return 1;
}
- if (policy_add_user)
+ if (policy_add_user)
{
new_user(as_user);
pw = getpwnam(as_user);
@@ -1610,7 +1610,7 @@ int main(int argc, char **argv)
return 1;
}
}
-
+
if (pw == NULL && policy_guest)
{
strcpy(as_user,guest);
@@ -1625,7 +1625,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);
@@ -1633,7 +1633,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)) {
@@ -1651,7 +1651,7 @@ again:
if (pwtype == PW_MD5)
ask_pw_md5(prompt, pass_want, pwd);
else
- ask_pw_sys(prompt, pass_want, pwd);
+ ask_pw_sys(prompt, pass_want, pwd);
cnt = read_ax25(buf, sizeof(buf)-1);
if (cnt <= 0) {
@@ -1705,58 +1705,58 @@ again:
if (get_assoc(&sax25) != -1)
ioctl(fds, SIOCAX25DELUID, &sax25);
switch (sockaddr.fsax25.fsa_ax25.sax25_family) {
- case AF_AX25:
- case AF_NETROM:
- sax25.sax25_call = sockaddr.fsax25.fsa_ax25.sax25_call;
- break;
- case AF_ROSE:
- sax25.sax25_call = sockaddr.rose.srose_call;
- break;
+ case AF_AX25:
+ case AF_NETROM:
+ sax25.sax25_call = sockaddr.fsax25.fsa_ax25.sax25_call;
+ break;
+ case AF_ROSE:
+ sax25.sax25_call = sockaddr.rose.srose_call;
+ break;
}
ioctl(fds, SIOCAX25ADDUID, &sax25);
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);
+ memset((char *) &termios, 0, sizeof(termios));
+
+ ioctl(0, TIOCSCTTY, (char *) 0);
termios.c_iflag = ICRNL | IXOFF;
- termios.c_oflag = OPOST | ONLCR;
- termios.c_cflag = CS8 | CREAD | CLOCAL;
- termios.c_lflag = ISIG | ICANON;
- termios.c_cc[VINTR] = /* 127 */ 0x03;
- termios.c_cc[VQUIT] = 28;
- termios.c_cc[VERASE] = 8;
- termios.c_cc[VKILL] = 24;
- termios.c_cc[VEOF] = 4;
- cfsetispeed(&termios, B19200);
- cfsetospeed(&termios, B19200);
- tcsetattr(0, TCSANOW, &termios);
+ termios.c_oflag = OPOST | ONLCR;
+ termios.c_cflag = CS8 | CREAD | CLOCAL;
+ termios.c_lflag = ISIG | ICANON;
+ termios.c_cc[VINTR] = /* 127 */ 0x03;
+ termios.c_cc[VQUIT] = 28;
+ termios.c_cc[VERASE] = 8;
+ termios.c_cc[VKILL] = 24;
+ termios.c_cc[VEOF] = 4;
+ cfsetispeed(&termios, B19200);
+ cfsetospeed(&termios, B19200);
+ tcsetattr(0, TCSANOW, &termios);
setutent();
- ut_line.ut_type = LOGIN_PROCESS;
- ut_line.ut_pid = getpid();
- strncpy(ut_line.ut_line, ptyslave + 5, sizeof(ut_line.ut_line));
- strncpy(ut_line.ut_id, ptyslave + 8, sizeof(ut_line.ut_id));
- strncpy(ut_line.ut_user, "LOGIN", sizeof(ut_line.ut_user));
- strncpy(ut_line.ut_host, protocol, sizeof(ut_line.ut_host));
+ ut_line.ut_type = LOGIN_PROCESS;
+ ut_line.ut_pid = getpid();
+ strncpy(ut_line.ut_line, ptyslave + 5, sizeof(ut_line.ut_line));
+ strncpy(ut_line.ut_id, ptyslave + 8, sizeof(ut_line.ut_id));
+ strncpy(ut_line.ut_user, "LOGIN", sizeof(ut_line.ut_user));
+ strncpy(ut_line.ut_host, protocol, sizeof(ut_line.ut_host));
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;
- pututline(&ut_line);
- endutent();
+ ut_line.ut_addr = 0;
+ pututline(&ut_line);
+ endutent();
/* become process group leader, if we not already are */
if (getpid() != getsid(0)) {
@@ -1764,8 +1764,8 @@ again:
exit(1);
}
- chargc = 0;
- envc = 0;
+ chargc = 0;
+ envc = 0;
if (dumb_embedded_system) {
int ret = -1;
@@ -1777,18 +1777,18 @@ again:
ret = -1;
if (pw->pw_dir && *(pw->pw_dir))
p = pw->pw_dir;
- ret = chdir(p);
+ ret = chdir(p);
if (ret != 0) {
p = "/tmp";
- chdir(p);
+ chdir(p);
}
- if ((envp[envc] = (char *) malloc(strlen(p)+6)))
- sprintf(envp[envc++], "HOME=%s", p);
- if ((envp[envc] = (char *) malloc(strlen(pw->pw_name)+6)))
- sprintf(envp[envc++], "USER=%s", pw->pw_name);
- if ((envp[envc] = (char *) malloc(strlen(pw->pw_name)+9)))
- sprintf(envp[envc++], "LOGNAME=%s", pw->pw_name);
+ if ((envp[envc] = (char *) malloc(strlen(p)+6)))
+ sprintf(envp[envc++], "HOME=%s", p);
+ if ((envp[envc] = (char *) malloc(strlen(pw->pw_name)+6)))
+ sprintf(envp[envc++], "USER=%s", pw->pw_name);
+ if ((envp[envc] = (char *) malloc(strlen(pw->pw_name)+9)))
+ sprintf(envp[envc++], "LOGNAME=%s", pw->pw_name);
if (pw->pw_shell && *(pw->pw_shell)) {
shell = pw->pw_shell;
@@ -1799,61 +1799,61 @@ again:
if (p[1]) {
if ((p = strdup(p)))
*p = '-';
-
+
} else p = 0;
}
if (!p)
p = shell;
- chargv[chargc++] = p;
- if ((envp[envc] = (char *) malloc(strlen(shell)+7)))
- sprintf(envp[envc++], "SHELL=%s", shell);
+ chargv[chargc++] = p;
+ if ((envp[envc] = (char *) malloc(strlen(shell)+7)))
+ sprintf(envp[envc++], "SHELL=%s", shell);
if (pw->pw_uid == 0)
p = "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin";
else
p = "/bin:/usr/bin:/usr/local/bin";
- if ((envp[envc] = (char *) malloc(strlen(p)+6)))
- sprintf(envp[envc++], "PATH=%s", p);
+ if ((envp[envc] = (char *) malloc(strlen(p)+6)))
+ sprintf(envp[envc++], "PATH=%s", p);
} else {
- chargv[chargc++] = "/bin/login";
- chargv[chargc++] = "-p";
+ chargv[chargc++] = "/bin/login";
+ chargv[chargc++] = "-p";
/* there exist several conectps:
- * Historicaly, the special character '+' in the password
- * field indicated that users may login via ax25, netrom, rose,
- * etc.. - but not via other protocols like telnet.
- * This secures the digipeater from abuse by inet access of
- * non-hams.
- * On the other hand, this leads to the problem that telent
- * via HF, pop3, etc.. do not work.
- * The "pwcheck == 2 method means, that the password is used on
- * every login mechanism other than this axspawn program;
- * here we do not rely on the password - the ax25 call of
- * the ham is enough. We have already checked above, that
- * the call of the user is valid (and not root, httpd, etc..);
- * thus this method is safe here.
- * Another mechanism (pwcheck == 3) is to check if the gid
- * equals to user_gid preference. I prefer this way, because
- * this approach gives the chance to temporary lock a user
- * out (abuse, ..) by changing his gid in passwd to for e.g.
- * 65534 (nogroup).
- */
+ * Historicaly, the special character '+' in the password
+ * field indicated that users may login via ax25, netrom, rose,
+ * etc.. - but not via other protocols like telnet.
+ * This secures the digipeater from abuse by inet access of
+ * non-hams.
+ * On the other hand, this leads to the problem that telent
+ * via HF, pop3, etc.. do not work.
+ * The "pwcheck == 2 method means, that the password is used on
+ * every login mechanism other than this axspawn program;
+ * here we do not rely on the password - the ax25 call of
+ * the ham is enough. We have already checked above, that
+ * the call of the user is valid (and not root, httpd, etc..);
+ * thus this method is safe here.
+ * Another mechanism (pwcheck == 3) is to check if the gid
+ * equals to user_gid preference. I prefer this way, because
+ * this approach gives the chance to temporary lock a user
+ * out (abuse, ..) by changing his gid in passwd to for e.g.
+ * 65534 (nogroup).
+ */
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;
+ chargv[chargc++] = "-f";
+ chargv[chargc++] = as_user;
}
- chargv[chargc] = NULL;
-
- if ((envp[envc] = (char *) malloc(30)))
- sprintf(envp[envc++], "AXCALL=%s", call);
- if ((envp[envc] = (char *) malloc(30)))
- sprintf(envp[envc++], "CALL=%s", user);
- if ((envp[envc] = (char *) malloc(30)))
- sprintf(envp[envc++], "PROTOCOL=%s", protocol);
+ chargv[chargc] = NULL;
+
+ if ((envp[envc] = (char *) malloc(30)))
+ sprintf(envp[envc++], "AXCALL=%s", call);
+ if ((envp[envc] = (char *) malloc(30)))
+ sprintf(envp[envc++], "CALL=%s", user);
+ if ((envp[envc] = (char *) malloc(30)))
+ sprintf(envp[envc++], "PROTOCOL=%s", protocol);
if ((envp[envc] = (char *) malloc(30)))
sprintf(envp[envc++], "TERM=dumb"); /* SuSE bug (dump - tsts) */
/* other useful defaults */
@@ -1868,51 +1868,51 @@ again:
exit(1);
if (setuid(pw->pw_uid) == -1)
exit(1);
- execve(shell, chargv, envp);
+ execve(shell, chargv, envp);
/* point of no return */
exit(1);
}
- execve(chargv[0], chargv, envp);
+ execve(chargv[0], chargv, envp);
/* point of no return */
exit(1);
- }
- else if (pid > 0)
- {
- child_pid = 0;
- signal(SIGHUP, signal_handler);
- signal(SIGTERM, signal_handler);
- signal(SIGINT, signal_handler);
- signal(SIGQUIT, signal_handler);
-
- while(1)
- {
- FD_ZERO(&fds_read);
- FD_ZERO(&fds_err);
- FD_SET(0, &fds_read);
- FD_SET(0, &fds_err);
- if (wqueue_length <= paclen*7)
+ }
+ else if (pid > 0)
+ {
+ child_pid = 0;
+ signal(SIGHUP, signal_handler);
+ signal(SIGTERM, signal_handler);
+ signal(SIGINT, signal_handler);
+ signal(SIGQUIT, signal_handler);
+
+ while (1)
+ {
+ FD_ZERO(&fds_read);
+ FD_ZERO(&fds_err);
+ FD_SET(0, &fds_read);
+ FD_SET(0, &fds_err);
+ 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))
- {
+ FD_SET(fdmaster, &fds_err);
+
+ k = select(fdmaster+1, &fds_read, NULL, &fds_err, NULL);
+
+ if (k > 0)
+ {
+ if (FD_ISSET(0, &fds_err))
+ {
if (huffman) {
sprintf(buf,"\r//COMP 0\r");
write_ax25(buf, strlen(buf), 1);
sleep(EXITDELAY);
- }
- kill(pid, SIGHUP);
- cleanup(ptyslave+5);
- return 1;
- }
-
- if (FD_ISSET(fdmaster, &fds_err))
- {
+ }
+ kill(pid, SIGHUP);
+ 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;
@@ -1921,28 +1921,28 @@ again:
sprintf(buf,"\r//COMP 0\r");
write_ax25(buf, strlen(buf), 1);
sleep(EXITDELAY);
- }
- cleanup(ptyslave+5);
- return 1;
- }
-
- if (FD_ISSET(0, &fds_read))
- {
- cnt = read_ax25(buf, sizeof(buf));
- if (cnt < 0) /* Connection died */
- {
- kill(pid, SIGHUP);
- cleanup(ptyslave+5);
- return 1;
- } else
- write(fdmaster, buf, cnt);
- }
-
- if (FD_ISSET(fdmaster, &fds_read))
- {
- cnt = read(fdmaster, buf, (huffman ? 254 : sizeof(buf)));
- if (cnt < 0)
- {
+ }
+ cleanup(ptyslave+5);
+ return 1;
+ }
+
+ if (FD_ISSET(0, &fds_read))
+ {
+ cnt = read_ax25(buf, sizeof(buf));
+ if (cnt < 0) /* Connection died */
+ {
+ kill(pid, SIGHUP);
+ cleanup(ptyslave+5);
+ return 1;
+ } else
+ write(fdmaster, buf, cnt);
+ }
+
+ if (FD_ISSET(fdmaster, &fds_read))
+ {
+ cnt = read(fdmaster, buf, (huffman ? 254 : sizeof(buf)));
+ if (cnt < 0)
+ {
/* give the last packet in the timer controlled sendqueue a chance.. */
if (wqueue_length) {
continue;
@@ -1951,36 +1951,36 @@ again:
sprintf(buf,"\r//COMP 0\r");
write_ax25(buf, strlen(buf), 1);
sleep(EXITDELAY);
- }
- cleanup(ptyslave+5);
- return 1; /* Child died */
- }
- write_ax25(buf, cnt, 0);
- }
- } else
- if (k < 0 && errno != EINTR)
- {
+ }
+ cleanup(ptyslave+5);
+ return 1; /* Child died */
+ }
+ write_ax25(buf, cnt, 0);
+ }
+ } else
+ if (k < 0 && errno != EINTR)
+ {
if (huffman) {
sprintf(buf,"\r//COMP 0\r");
write_ax25(buf, strlen(buf), 1);
sleep(EXITDELAY);
- }
-
- kill(pid, SIGHUP); /* just in case... */
- cleanup(ptyslave+5);
- return 0;
- }
- }
- }
- else
- {
+ }
+
+ kill(pid, SIGHUP); /* just in case... */
+ cleanup(ptyslave+5);
+ return 0;
+ }
+ }
+ }
+ else
+ {
write_ax25_static_line(MSG_CANNOTFORK);
- syslog(LOG_ERR, "cannot fork %m, closing connection to %s\n", call);
- sleep(EXITDELAY);
- return 1;
- }
-
- sleep(EXITDELAY);
+ syslog(LOG_ERR, "cannot fork %m, closing connection to %s\n", call);
+ sleep(EXITDELAY);
+ return 1;
+ }
+
+ sleep(EXITDELAY);
return 0;
}
diff --git a/ax25/beacon.c b/ax25/beacon.c
index 095614f..ca229c7 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,38 +37,38 @@ 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':
- srccall = optarg;
- break;
- case 'd':
- destcall = optarg;
- break;
- case 'l':
- logging = TRUE;
- break;
- case 'm':
- mail = TRUE;
- /* falls through */
- case 's':
- single = TRUE;
- break;
- case 't':
- interval = atoi(optarg);
- if (interval < 1) {
- fprintf(stderr, "beacon: interval must be greater than on minute\n");
- return 1;
- }
- break;
- case 'v':
- printf("beacon: %s\n", VERSION);
- return 0;
- case '?':
- case ':':
- fprintf(stderr, "usage: beacon [-c <src_call>] [-d <dest_call>] [-l] [-m] [-s] [-t interval] [-v] <port> <message>\n");
+ case 'c':
+ srccall = optarg;
+ break;
+ case 'd':
+ destcall = optarg;
+ break;
+ case 'l':
+ logging = TRUE;
+ break;
+ case 'm':
+ mail = TRUE;
+ /* falls through */
+ case 's':
+ single = TRUE;
+ break;
+ case 't':
+ interval = atoi(optarg);
+ if (interval < 1) {
+ fprintf(stderr, "beacon: interval must be greater than on minute\n");
return 1;
+ }
+ break;
+ case 'v':
+ printf("beacon: %s\n", VERSION);
+ return 0;
+ case '?':
+ case ':':
+ fprintf(stderr, "usage: beacon [-c <src_call>] [-d <dest_call>] [-l] [-m] [-s] [-t interval] [-v] <port> <message>\n");
+ return 1;
}
}
@@ -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;
@@ -100,7 +100,7 @@ int main(int argc, char *argv[])
else
addr = strdup("IDENT");
if (addr == NULL)
- return 1;
+ return 1;
if ((dlen = ax25_aton(addr, &dest)) == -1) {
fprintf(stderr, "beacon: unable to convert callsign '%s'\n", addr);
@@ -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..83734a8 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",
&eth[0], &eth[1], &eth[2], &eth[3], &eth[4], &eth[5]);
-
+
if (n < 6)
return 1;
@@ -79,64 +79,64 @@ int main(int argc, char **argv)
while ((cmd = getopt(argc, argv, "d:a:vVh")) != EOF) {
switch (cmd) {
- case 'd':
- flag |= 1;
- if (get_hwaddr(addr.destination, optarg)) {
- fprintf(stderr, "bpqparms: invalid 'destination' address %s\n", optarg);
- return 1;
- }
- break;
-
- case 'a':
- flag |= 2;
- if (get_hwaddr(addr.accept, optarg)) {
- fprintf(stderr, "bpqparms: invalid 'accept' address %s\n", optarg);
- return 1;
- }
- break;
-
- case 'V':
- printf("bpqparms version " VERSION "\n");
- printf("Copyright 1996, Jörg Reuter (jreuter@poboxes.com)\n");
- printf("This program is free software; you can redistribute it and/or modify\n");
- printf("it under the terms of the GNU General Public License as published by\n");
- printf("the Free Software Foundation; either version 2 of the License, or\n");
- printf(" (at your option) any later version.\n\n");
- printf("This program is distributed in the hope that it will be useful,\n");
- printf("but WITHOUT ANY WARRANTY; without even the implied warranty of\n");
- printf("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n");
- return 0;
-
- case 'v':
- printf("bpqparms: %s\n", VERSION);
- return(0);
-
- case 'h':
- case ':':
- case '?':
- usage();
+ case 'd':
+ flag |= 1;
+ if (get_hwaddr(addr.destination, optarg)) {
+ fprintf(stderr, "bpqparms: invalid 'destination' address %s\n", optarg);
+ return 1;
+ }
+ break;
+
+ case 'a':
+ flag |= 2;
+ if (get_hwaddr(addr.accept, optarg)) {
+ fprintf(stderr, "bpqparms: invalid 'accept' address %s\n", optarg);
+ return 1;
+ }
+ break;
+
+ case 'V':
+ printf("bpqparms version " VERSION "\n");
+ printf("Copyright 1996, Jörg Reuter (jreuter@poboxes.com)\n");
+ printf("This program is free software; you can redistribute it and/or modify\n");
+ printf("it under the terms of the GNU General Public License as published by\n");
+ printf("the Free Software Foundation; either version 2 of the License, or\n");
+ printf(" (at your option) any later version.\n\n");
+ printf("This program is distributed in the hope that it will be useful,\n");
+ printf("but WITHOUT ANY WARRANTY; without even the implied warranty of\n");
+ printf("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n");
+ return 0;
+
+ case 'v':
+ printf("bpqparms: %s\n", VERSION);
+ return 0;
+
+ case 'h':
+ case ':':
+ case '?':
+ 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/md5.c b/ax25/md5.c
index 8bd0d11..d007b91 100644
--- a/ax25/md5.c
+++ b/ax25/md5.c
@@ -49,14 +49,14 @@
static void Transform(UINT4 *buf, UINT4 *in);
static unsigned char PADDING[64] = {
- 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
/* F, G, H and I are basic MD5 functions */
@@ -96,14 +96,14 @@ static unsigned char PADDING[64] = {
*/
void MD5Init(MD5_CTX *mdContext)
{
- mdContext->i[0] = mdContext->i[1] = (UINT4)0;
+ mdContext->i[0] = mdContext->i[1] = (UINT4)0;
- /* Load magic initialization constants.
- */
- mdContext->buf[0] = (UINT4)0x67452301;
- mdContext->buf[1] = (UINT4)0xefcdab89;
- mdContext->buf[2] = (UINT4)0x98badcfe;
- mdContext->buf[3] = (UINT4)0x10325476;
+ /* Load magic initialization constants.
+ */
+ mdContext->buf[0] = (UINT4)0x67452301;
+ mdContext->buf[1] = (UINT4)0xefcdab89;
+ mdContext->buf[2] = (UINT4)0x98badcfe;
+ mdContext->buf[3] = (UINT4)0x10325476;
}
/* The routine MD5Update updates the message-digest context to
@@ -112,34 +112,34 @@ void MD5Init(MD5_CTX *mdContext)
*/
void MD5Update(MD5_CTX *mdContext, unsigned char *inBuf, unsigned int inLen)
{
- UINT4 in[16];
- int mdi;
- unsigned int i, ii;
+ UINT4 in[16];
+ int mdi;
+ unsigned int i, ii;
- /* compute number of bytes mod 64 */
- mdi = (int)((mdContext->i[0] >> 3) & 0x3F);
+ /* compute number of bytes mod 64 */
+ mdi = (int)((mdContext->i[0] >> 3) & 0x3F);
- /* update number of bits */
- if ((mdContext->i[0] + ((UINT4)inLen << 3)) < mdContext->i[0])
- mdContext->i[1]++;
- mdContext->i[0] += ((UINT4)inLen << 3);
- mdContext->i[1] += ((UINT4)inLen >> 29);
+ /* update number of bits */
+ if ((mdContext->i[0] + ((UINT4)inLen << 3)) < mdContext->i[0])
+ mdContext->i[1]++;
+ mdContext->i[0] += ((UINT4)inLen << 3);
+ mdContext->i[1] += ((UINT4)inLen >> 29);
- while (inLen--) {
- /* add new character to buffer, increment mdi */
- mdContext->in[mdi++] = *inBuf++;
+ while (inLen--) {
+ /* add new character to buffer, increment mdi */
+ mdContext->in[mdi++] = *inBuf++;
- /* transform if necessary */
- if (mdi == 0x40) {
- for (i = 0, ii = 0; i < 16; i++, ii += 4)
- in[i] = (((UINT4)mdContext->in[ii+3]) << 24) |
- (((UINT4)mdContext->in[ii+2]) << 16) |
- (((UINT4)mdContext->in[ii+1]) << 8) |
- ((UINT4)mdContext->in[ii]);
- Transform (mdContext->buf, in);
- mdi = 0;
- }
- }
+ /* transform if necessary */
+ if (mdi == 0x40) {
+ for (i = 0, ii = 0; i < 16; i++, ii += 4)
+ in[i] = (((UINT4)mdContext->in[ii+3]) << 24) |
+ (((UINT4)mdContext->in[ii+2]) << 16) |
+ (((UINT4)mdContext->in[ii+1]) << 8) |
+ ((UINT4)mdContext->in[ii]);
+ Transform (mdContext->buf, in);
+ mdi = 0;
+ }
+ }
}
/* The routine MD5Final terminates the message-digest computation and
@@ -147,140 +147,140 @@ void MD5Update(MD5_CTX *mdContext, unsigned char *inBuf, unsigned int inLen)
*/
void MD5Final(MD5_CTX *mdContext)
{
- UINT4 in[16];
- int mdi;
- unsigned int i, ii;
- unsigned int padLen;
+ UINT4 in[16];
+ int mdi;
+ unsigned int i, ii;
+ unsigned int padLen;
- /* save number of bits */
- in[14] = mdContext->i[0];
- in[15] = mdContext->i[1];
+ /* save number of bits */
+ in[14] = mdContext->i[0];
+ in[15] = mdContext->i[1];
- /* compute number of bytes mod 64 */
- mdi = (int)((mdContext->i[0] >> 3) & 0x3F);
+ /* compute number of bytes mod 64 */
+ mdi = (int)((mdContext->i[0] >> 3) & 0x3F);
- /* pad out to 56 mod 64 */
- padLen = (mdi < 56) ? (56 - mdi) : (120 - mdi);
- MD5Update (mdContext, PADDING, padLen);
+ /* pad out to 56 mod 64 */
+ padLen = (mdi < 56) ? (56 - mdi) : (120 - mdi);
+ MD5Update (mdContext, PADDING, padLen);
- /* append length in bits and transform */
- for (i = 0, ii = 0; i < 14; i++, ii += 4)
- in[i] = (((UINT4)mdContext->in[ii+3]) << 24) |
- (((UINT4)mdContext->in[ii+2]) << 16) |
- (((UINT4)mdContext->in[ii+1]) << 8) |
- ((UINT4)mdContext->in[ii]);
- Transform (mdContext->buf, in);
+ /* append length in bits and transform */
+ for (i = 0, ii = 0; i < 14; i++, ii += 4)
+ in[i] = (((UINT4)mdContext->in[ii+3]) << 24) |
+ (((UINT4)mdContext->in[ii+2]) << 16) |
+ (((UINT4)mdContext->in[ii+1]) << 8) |
+ ((UINT4)mdContext->in[ii]);
+ Transform (mdContext->buf, in);
- /* store buffer in digest */
- for (i = 0, ii = 0; i < 4; i++, ii += 4) {
- mdContext->digest[ii] = (unsigned char)(mdContext->buf[i] & 0xFF);
- mdContext->digest[ii+1] =
- (unsigned char)((mdContext->buf[i] >> 8) & 0xFF);
- mdContext->digest[ii+2] =
- (unsigned char)((mdContext->buf[i] >> 16) & 0xFF);
- mdContext->digest[ii+3] =
- (unsigned char)((mdContext->buf[i] >> 24) & 0xFF);
- }
+ /* store buffer in digest */
+ for (i = 0, ii = 0; i < 4; i++, ii += 4) {
+ mdContext->digest[ii] = (unsigned char)(mdContext->buf[i] & 0xFF);
+ mdContext->digest[ii+1] =
+ (unsigned char)((mdContext->buf[i] >> 8) & 0xFF);
+ mdContext->digest[ii+2] =
+ (unsigned char)((mdContext->buf[i] >> 16) & 0xFF);
+ mdContext->digest[ii+3] =
+ (unsigned char)((mdContext->buf[i] >> 24) & 0xFF);
+ }
}
/* Basic MD5 step. Transforms buf based on in.
*/
static void Transform(UINT4 *buf, UINT4 *in)
{
- UINT4 a = buf[0], b = buf[1], c = buf[2], d = buf[3];
+ UINT4 a = buf[0], b = buf[1], c = buf[2], d = buf[3];
/* Round 1 */
#define S11 7
#define S12 12
#define S13 17
#define S14 22
- FF ( a, b, c, d, in[ 0], S11, 3614090360UL); /* 1 */
- FF ( d, a, b, c, in[ 1], S12, 3905402710UL); /* 2 */
- FF ( c, d, a, b, in[ 2], S13, 606105819UL); /* 3 */
- FF ( b, c, d, a, in[ 3], S14, 3250441966UL); /* 4 */
- FF ( a, b, c, d, in[ 4], S11, 4118548399UL); /* 5 */
- FF ( d, a, b, c, in[ 5], S12, 1200080426UL); /* 6 */
- FF ( c, d, a, b, in[ 6], S13, 2821735955UL); /* 7 */
- FF ( b, c, d, a, in[ 7], S14, 4249261313UL); /* 8 */
- FF ( a, b, c, d, in[ 8], S11, 1770035416UL); /* 9 */
- FF ( d, a, b, c, in[ 9], S12, 2336552879UL); /* 10 */
- FF ( c, d, a, b, in[10], S13, 4294925233UL); /* 11 */
- FF ( b, c, d, a, in[11], S14, 2304563134UL); /* 12 */
- FF ( a, b, c, d, in[12], S11, 1804603682UL); /* 13 */
- FF ( d, a, b, c, in[13], S12, 4254626195UL); /* 14 */
- FF ( c, d, a, b, in[14], S13, 2792965006UL); /* 15 */
- FF ( b, c, d, a, in[15], S14, 1236535329UL); /* 16 */
+ FF ( a, b, c, d, in[ 0], S11, 3614090360UL); /* 1 */
+ FF ( d, a, b, c, in[ 1], S12, 3905402710UL); /* 2 */
+ FF ( c, d, a, b, in[ 2], S13, 606105819UL); /* 3 */
+ FF ( b, c, d, a, in[ 3], S14, 3250441966UL); /* 4 */
+ FF ( a, b, c, d, in[ 4], S11, 4118548399UL); /* 5 */
+ FF ( d, a, b, c, in[ 5], S12, 1200080426UL); /* 6 */
+ FF ( c, d, a, b, in[ 6], S13, 2821735955UL); /* 7 */
+ FF ( b, c, d, a, in[ 7], S14, 4249261313UL); /* 8 */
+ FF ( a, b, c, d, in[ 8], S11, 1770035416UL); /* 9 */
+ FF ( d, a, b, c, in[ 9], S12, 2336552879UL); /* 10 */
+ FF ( c, d, a, b, in[10], S13, 4294925233UL); /* 11 */
+ FF ( b, c, d, a, in[11], S14, 2304563134UL); /* 12 */
+ FF ( a, b, c, d, in[12], S11, 1804603682UL); /* 13 */
+ FF ( d, a, b, c, in[13], S12, 4254626195UL); /* 14 */
+ FF ( c, d, a, b, in[14], S13, 2792965006UL); /* 15 */
+ FF ( b, c, d, a, in[15], S14, 1236535329UL); /* 16 */
/* Round 2 */
#define S21 5
#define S22 9
#define S23 14
#define S24 20
- GG ( a, b, c, d, in[ 1], S21, 4129170786UL); /* 17 */
- GG ( d, a, b, c, in[ 6], S22, 3225465664UL); /* 18 */
- GG ( c, d, a, b, in[11], S23, 643717713UL); /* 19 */
- GG ( b, c, d, a, in[ 0], S24, 3921069994UL); /* 20 */
- GG ( a, b, c, d, in[ 5], S21, 3593408605UL); /* 21 */
- GG ( d, a, b, c, in[10], S22, 38016083UL); /* 22 */
- GG ( c, d, a, b, in[15], S23, 3634488961UL); /* 23 */
- GG ( b, c, d, a, in[ 4], S24, 3889429448UL); /* 24 */
- GG ( a, b, c, d, in[ 9], S21, 568446438UL); /* 25 */
- GG ( d, a, b, c, in[14], S22, 3275163606UL); /* 26 */
- GG ( c, d, a, b, in[ 3], S23, 4107603335UL); /* 27 */
- GG ( b, c, d, a, in[ 8], S24, 1163531501UL); /* 28 */
- GG ( a, b, c, d, in[13], S21, 2850285829UL); /* 29 */
- GG ( d, a, b, c, in[ 2], S22, 4243563512UL); /* 30 */
- GG ( c, d, a, b, in[ 7], S23, 1735328473UL); /* 31 */
- GG ( b, c, d, a, in[12], S24, 2368359562UL); /* 32 */
+ GG ( a, b, c, d, in[ 1], S21, 4129170786UL); /* 17 */
+ GG ( d, a, b, c, in[ 6], S22, 3225465664UL); /* 18 */
+ GG ( c, d, a, b, in[11], S23, 643717713UL); /* 19 */
+ GG ( b, c, d, a, in[ 0], S24, 3921069994UL); /* 20 */
+ GG ( a, b, c, d, in[ 5], S21, 3593408605UL); /* 21 */
+ GG ( d, a, b, c, in[10], S22, 38016083UL); /* 22 */
+ GG ( c, d, a, b, in[15], S23, 3634488961UL); /* 23 */
+ GG ( b, c, d, a, in[ 4], S24, 3889429448UL); /* 24 */
+ GG ( a, b, c, d, in[ 9], S21, 568446438UL); /* 25 */
+ GG ( d, a, b, c, in[14], S22, 3275163606UL); /* 26 */
+ GG ( c, d, a, b, in[ 3], S23, 4107603335UL); /* 27 */
+ GG ( b, c, d, a, in[ 8], S24, 1163531501UL); /* 28 */
+ GG ( a, b, c, d, in[13], S21, 2850285829UL); /* 29 */
+ GG ( d, a, b, c, in[ 2], S22, 4243563512UL); /* 30 */
+ GG ( c, d, a, b, in[ 7], S23, 1735328473UL); /* 31 */
+ GG ( b, c, d, a, in[12], S24, 2368359562UL); /* 32 */
/* Round 3 */
#define S31 4
#define S32 11
#define S33 16
#define S34 23
- HH ( a, b, c, d, in[ 5], S31, 4294588738UL); /* 33 */
- HH ( d, a, b, c, in[ 8], S32, 2272392833UL); /* 34 */
- HH ( c, d, a, b, in[11], S33, 1839030562UL); /* 35 */
- HH ( b, c, d, a, in[14], S34, 4259657740UL); /* 36 */
- HH ( a, b, c, d, in[ 1], S31, 2763975236UL); /* 37 */
- HH ( d, a, b, c, in[ 4], S32, 1272893353UL); /* 38 */
- HH ( c, d, a, b, in[ 7], S33, 4139469664UL); /* 39 */
- HH ( b, c, d, a, in[10], S34, 3200236656UL); /* 40 */
- HH ( a, b, c, d, in[13], S31, 681279174UL); /* 41 */
- HH ( d, a, b, c, in[ 0], S32, 3936430074UL); /* 42 */
- HH ( c, d, a, b, in[ 3], S33, 3572445317UL); /* 43 */
- HH ( b, c, d, a, in[ 6], S34, 76029189UL); /* 44 */
- HH ( a, b, c, d, in[ 9], S31, 3654602809UL); /* 45 */
- HH ( d, a, b, c, in[12], S32, 3873151461UL); /* 46 */
- HH ( c, d, a, b, in[15], S33, 530742520UL); /* 47 */
- HH ( b, c, d, a, in[ 2], S34, 3299628645UL); /* 48 */
+ HH ( a, b, c, d, in[ 5], S31, 4294588738UL); /* 33 */
+ HH ( d, a, b, c, in[ 8], S32, 2272392833UL); /* 34 */
+ HH ( c, d, a, b, in[11], S33, 1839030562UL); /* 35 */
+ HH ( b, c, d, a, in[14], S34, 4259657740UL); /* 36 */
+ HH ( a, b, c, d, in[ 1], S31, 2763975236UL); /* 37 */
+ HH ( d, a, b, c, in[ 4], S32, 1272893353UL); /* 38 */
+ HH ( c, d, a, b, in[ 7], S33, 4139469664UL); /* 39 */
+ HH ( b, c, d, a, in[10], S34, 3200236656UL); /* 40 */
+ HH ( a, b, c, d, in[13], S31, 681279174UL); /* 41 */
+ HH ( d, a, b, c, in[ 0], S32, 3936430074UL); /* 42 */
+ HH ( c, d, a, b, in[ 3], S33, 3572445317UL); /* 43 */
+ HH ( b, c, d, a, in[ 6], S34, 76029189UL); /* 44 */
+ HH ( a, b, c, d, in[ 9], S31, 3654602809UL); /* 45 */
+ HH ( d, a, b, c, in[12], S32, 3873151461UL); /* 46 */
+ HH ( c, d, a, b, in[15], S33, 530742520UL); /* 47 */
+ HH ( b, c, d, a, in[ 2], S34, 3299628645UL); /* 48 */
/* Round 4 */
#define S41 6
#define S42 10
#define S43 15
#define S44 21
- II ( a, b, c, d, in[ 0], S41, 4096336452UL); /* 49 */
- II ( d, a, b, c, in[ 7], S42, 1126891415UL); /* 50 */
- II ( c, d, a, b, in[14], S43, 2878612391UL); /* 51 */
- II ( b, c, d, a, in[ 5], S44, 4237533241UL); /* 52 */
- II ( a, b, c, d, in[12], S41, 1700485571UL); /* 53 */
- II ( d, a, b, c, in[ 3], S42, 2399980690UL); /* 54 */
- II ( c, d, a, b, in[10], S43, 4293915773UL); /* 55 */
- II ( b, c, d, a, in[ 1], S44, 2240044497UL); /* 56 */
- II ( a, b, c, d, in[ 8], S41, 1873313359UL); /* 57 */
- II ( d, a, b, c, in[15], S42, 4264355552UL); /* 58 */
- II ( c, d, a, b, in[ 6], S43, 2734768916UL); /* 59 */
- II ( b, c, d, a, in[13], S44, 1309151649UL); /* 60 */
- II ( a, b, c, d, in[ 4], S41, 4149444226UL); /* 61 */
- II ( d, a, b, c, in[11], S42, 3174756917UL); /* 62 */
- II ( c, d, a, b, in[ 2], S43, 718787259UL); /* 63 */
- II ( b, c, d, a, in[ 9], S44, 3951481745UL); /* 64 */
+ II ( a, b, c, d, in[ 0], S41, 4096336452UL); /* 49 */
+ II ( d, a, b, c, in[ 7], S42, 1126891415UL); /* 50 */
+ II ( c, d, a, b, in[14], S43, 2878612391UL); /* 51 */
+ II ( b, c, d, a, in[ 5], S44, 4237533241UL); /* 52 */
+ II ( a, b, c, d, in[12], S41, 1700485571UL); /* 53 */
+ II ( d, a, b, c, in[ 3], S42, 2399980690UL); /* 54 */
+ II ( c, d, a, b, in[10], S43, 4293915773UL); /* 55 */
+ II ( b, c, d, a, in[ 1], S44, 2240044497UL); /* 56 */
+ II ( a, b, c, d, in[ 8], S41, 1873313359UL); /* 57 */
+ II ( d, a, b, c, in[15], S42, 4264355552UL); /* 58 */
+ II ( c, d, a, b, in[ 6], S43, 2734768916UL); /* 59 */
+ II ( b, c, d, a, in[13], S44, 1309151649UL); /* 60 */
+ II ( a, b, c, d, in[ 4], S41, 4149444226UL); /* 61 */
+ II ( d, a, b, c, in[11], S42, 3174756917UL); /* 62 */
+ II ( c, d, a, b, in[ 2], S43, 718787259UL); /* 63 */
+ II ( b, c, d, a, in[ 9], S44, 3951481745UL); /* 64 */
- buf[0] += a;
- buf[1] += b;
- buf[2] += c;
- buf[3] += d;
+ buf[0] += a;
+ buf[1] += b;
+ buf[2] += c;
+ buf[3] += d;
}
/*
diff --git a/ax25/md5.h b/ax25/md5.h
index fc45c8a..898479e 100644
--- a/ax25/md5.h
+++ b/ax25/md5.h
@@ -50,10 +50,10 @@ typedef unsigned long int UINT4;
/* Data structure for MD5 (Message-Digest) computation */
typedef struct {
- UINT4 i[2]; /* number of _bits_ handled mod 2^64 */
- UINT4 buf[4]; /* scratch buffer */
- unsigned char in[64]; /* input buffer */
- unsigned char digest[16]; /* actual digest after MD5Final call */
+ UINT4 i[2]; /* number of _bits_ handled mod 2^64 */
+ UINT4 buf[4]; /* scratch buffer */
+ unsigned char in[64]; /* input buffer */
+ unsigned char digest[16]; /* actual digest after MD5Final call */
} MD5_CTX;
void MD5Init(MD5_CTX *mdContext);
diff --git a/ax25/mheard.c b/ax25/mheard.c
index 5aeacf4..2370a46 100644
--- a/ax25/mheard.c
+++ b/ax25/mheard.c
@@ -35,23 +35,23 @@ static char *types[] = {
"UI",
"????"};
-static struct PortRecord *PortList = NULL;
+static struct PortRecord *PortList;
static void PrintHeader(int data)
{
switch (data) {
- case 0:
- printf("Callsign Port Packets Last Heard\n");
- break;
- case 1:
- printf("Callsign Port\n");
- break;
- case 2:
- printf("Callsign Port #I #S #U First Heard Last Heard\n");
- break;
- case 3:
- printf("Callsign Port Packets Type PIDs\n");
- break;
+ case 0:
+ printf("Callsign Port Packets Last Heard\n");
+ break;
+ case 1:
+ printf("Callsign Port\n");
+ break;
+ case 2:
+ printf("Callsign Port #I #S #U First Heard Last Heard\n");
+ break;
+ case 3:
+ printf("Callsign Port Packets Type PIDs\n");
+ break;
}
}
@@ -62,81 +62,81 @@ static void PrintPortEntry(struct PortRecord *pr, int data)
int i;
switch (data) {
- case 0:
- strcpy(lh, ctime(&pr->entry.last_heard));
- lh[19] = 0;
- call = ax25_ntoa(&pr->entry.from_call);
- if ((s = strstr(call, "-0")) != NULL)
- *s = '\0';
- printf("%-10s %-5s %5d %s\n",
- call, pr->entry.portname, pr->entry.count, lh);
- break;
- case 1:
- buffer[0] = '\0';
- call = ax25_ntoa(&pr->entry.from_call);
- if ((s = strstr(call, "-0")) != NULL)
- *s = '\0';
- strcat(buffer, call);
- call = ax25_ntoa(&pr->entry.to_call);
+ case 0:
+ strcpy(lh, ctime(&pr->entry.last_heard));
+ lh[19] = 0;
+ call = ax25_ntoa(&pr->entry.from_call);
+ if ((s = strstr(call, "-0")) != NULL)
+ *s = '\0';
+ printf("%-10s %-5s %5d %s\n",
+ call, pr->entry.portname, pr->entry.count, lh);
+ break;
+ case 1:
+ buffer[0] = '\0';
+ call = ax25_ntoa(&pr->entry.from_call);
+ if ((s = strstr(call, "-0")) != NULL)
+ *s = '\0';
+ strcat(buffer, call);
+ call = ax25_ntoa(&pr->entry.to_call);
+ if ((s = strstr(call, "-0")) != NULL)
+ *s = '\0';
+ strcat(buffer, ">");
+ strcat(buffer, call);
+ for (i = 0; i < pr->entry.ndigis && i < 4; i++) {
+ strcat(buffer, ",");
+ call = ax25_ntoa(&pr->entry.digis[i]);
if ((s = strstr(call, "-0")) != NULL)
*s = '\0';
- strcat(buffer, ">");
strcat(buffer, call);
- for (i = 0; i < pr->entry.ndigis && i < 4; i++) {
- strcat(buffer, ",");
- call = ax25_ntoa(&pr->entry.digis[i]);
- if ((s = strstr(call, "-0")) != NULL)
- *s = '\0';
- strcat(buffer, call);
- }
- if (pr->entry.ndigis >= 4)
- strcat(buffer, ",...");
- printf("%-70s %-5s\n",
- buffer, pr->entry.portname);
- break;
- case 2:
- strcpy(lh, ctime(&pr->entry.last_heard));
- lh[19] = 0;
- strcpy(fh, ctime(&pr->entry.first_heard));
- fh[19] = 0;
- call = ax25_ntoa(&pr->entry.from_call);
- if ((s = strstr(call, "-0")) != NULL)
- *s = '\0';
- printf("%-10s %-5s %5d %5d %5d %s %s\n",
- call, pr->entry.portname, pr->entry.iframes, pr->entry.sframes, pr->entry.uframes, fh, lh);
- break;
- case 3:
- call = ax25_ntoa(&pr->entry.from_call);
- if ((s = strstr(call, "-0")) != NULL)
- *s = '\0';
- printf("%-10s %-5s %5d %5s ",
- call, pr->entry.portname, pr->entry.count, types[pr->entry.type]);
- if (pr->entry.mode & MHEARD_MODE_ARP)
- printf(" ARP");
- if (pr->entry.mode & MHEARD_MODE_FLEXNET)
- printf(" FlexNet");
- if (pr->entry.mode & MHEARD_MODE_IP_DG)
- printf(" IP-DG");
- if (pr->entry.mode & MHEARD_MODE_IP_VC)
- printf(" IP-VC");
- if (pr->entry.mode & MHEARD_MODE_NETROM)
- printf(" NET/ROM");
- if (pr->entry.mode & MHEARD_MODE_ROSE)
- printf(" Rose");
- if (pr->entry.mode & MHEARD_MODE_SEGMENT)
- printf(" Segment");
- if (pr->entry.mode & MHEARD_MODE_TEXNET)
- printf(" TexNet");
- if (pr->entry.mode & MHEARD_MODE_TEXT)
- printf(" Text");
- if (pr->entry.mode & MHEARD_MODE_PSATFT)
- printf(" PacsatFT");
- if (pr->entry.mode & MHEARD_MODE_PSATPB)
- printf(" PacsatPB");
- if (pr->entry.mode & MHEARD_MODE_UNKNOWN)
- printf(" Unknown");
- printf("\n");
- break;
+ }
+ if (pr->entry.ndigis >= 4)
+ strcat(buffer, ",...");
+ printf("%-70s %-5s\n",
+ buffer, pr->entry.portname);
+ break;
+ case 2:
+ strcpy(lh, ctime(&pr->entry.last_heard));
+ lh[19] = 0;
+ strcpy(fh, ctime(&pr->entry.first_heard));
+ fh[19] = 0;
+ call = ax25_ntoa(&pr->entry.from_call);
+ if ((s = strstr(call, "-0")) != NULL)
+ *s = '\0';
+ printf("%-10s %-5s %5d %5d %5d %s %s\n",
+ call, pr->entry.portname, pr->entry.iframes, pr->entry.sframes, pr->entry.uframes, fh, lh);
+ break;
+ case 3:
+ call = ax25_ntoa(&pr->entry.from_call);
+ if ((s = strstr(call, "-0")) != NULL)
+ *s = '\0';
+ printf("%-10s %-5s %5d %5s ",
+ call, pr->entry.portname, pr->entry.count, types[pr->entry.type]);
+ if (pr->entry.mode & MHEARD_MODE_ARP)
+ printf(" ARP");
+ if (pr->entry.mode & MHEARD_MODE_FLEXNET)
+ printf(" FlexNet");
+ if (pr->entry.mode & MHEARD_MODE_IP_DG)
+ printf(" IP-DG");
+ if (pr->entry.mode & MHEARD_MODE_IP_VC)
+ printf(" IP-VC");
+ if (pr->entry.mode & MHEARD_MODE_NETROM)
+ printf(" NET/ROM");
+ if (pr->entry.mode & MHEARD_MODE_ROSE)
+ printf(" Rose");
+ if (pr->entry.mode & MHEARD_MODE_SEGMENT)
+ printf(" Segment");
+ if (pr->entry.mode & MHEARD_MODE_TEXNET)
+ printf(" TexNet");
+ if (pr->entry.mode & MHEARD_MODE_TEXT)
+ printf(" Text");
+ if (pr->entry.mode & MHEARD_MODE_PSATFT)
+ printf(" PacsatFT");
+ if (pr->entry.mode & MHEARD_MODE_PSATPB)
+ printf(" PacsatPB");
+ if (pr->entry.mode & MHEARD_MODE_UNKNOWN)
+ printf(" Unknown");
+ printf("\n");
+ break;
}
}
@@ -286,7 +286,7 @@ static void SortByFrame(void)
p = n;
}
}
-
+
int main(int argc, char *argv[])
{
int headers = TRUE;
@@ -296,64 +296,64 @@ int main(int argc, char *argv[])
while ((c = getopt(argc, argv, "d:no:v")) != -1) {
switch (c) {
- case 'd':
- switch (*optarg) {
- case 'c':
- data = 1;
- break;
- case 'm':
- data = 3;
- break;
- case 'n':
- data = 0;
- break;
- case 's':
- data = 2;
- break;
- default:
- fprintf(stderr, "mheard: invalid display type '%s'\n", optarg);
- return 1;
- }
+ case 'd':
+ switch (*optarg) {
+ case 'c':
+ data = 1;
+ break;
+ case 'm':
+ data = 3;
break;
case 'n':
- headers = FALSE;
+ data = 0;
+ break;
+ case 's':
+ data = 2;
+ break;
+ default:
+ fprintf(stderr, "mheard: invalid display type '%s'\n", optarg);
+ return 1;
+ }
+ break;
+ case 'n':
+ headers = FALSE;
+ break;
+ case 'o':
+ switch (*optarg) {
+ case 'c':
+ mode = 2;
+ break;
+ case 'f':
+ mode = 3;
break;
- case 'o':
- switch (*optarg) {
- case 'c':
- mode = 2;
- break;
- case 'f':
- mode = 3;
- break;
- case 'p':
- mode = 1;
- break;
- case 't':
- mode = 0;
- break;
- default:
- fprintf(stderr, "mheard: invalid ordering type '%s'\n", optarg);
- return 1;
- }
+ case 'p':
+ mode = 1;
break;
- case 'v':
- printf("mheard: %s\n", VERSION);
- return 0;
- case '?':
- case ':':
- fprintf(stderr, "Usage: %s [-d cmns] [-n] [-o cfpt] [-v] [port ...]\n", argv[0]);
+ case 't':
+ mode = 0;
+ break;
+ default:
+ fprintf(stderr, "mheard: invalid ordering type '%s'\n", optarg);
return 1;
+ }
+ break;
+ case 'v':
+ printf("mheard: %s\n", VERSION);
+ return 0;
+ case '?':
+ case ':':
+ fprintf(stderr, "Usage: %s [-d cmns] [-n] [-o cfpt] [-v] [port ...]\n", argv[0]);
+ return 1;
}
}
-
+
LoadPortData();
switch (mode) {
- case 0: SortByTime(); break;
- case 1: SortByPort(); break;
- case 2: SortByCall(); break;
- case 3: SortByFrame(); break;
+ case 0: SortByTime(); break;
+ case 1: SortByPort(); break;
+ case 2: SortByCall(); break;
+ case 3: SortByFrame(); break;
}
if (argc == optind) {
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 3d45131..ec8cc2c 100644
--- a/ax25/mheardd.c
+++ b/ax25/mheardd.c
@@ -120,43 +120,43 @@ int main(int argc, char **argv)
*ports = 0;
while ((s = getopt(argc, argv, "fln:p:v")) != -1) {
switch (s) {
- case 'l':
- logging = TRUE;
- break;
- case 'f':
- flush = TRUE;
- break;
- case 'n':
- mheard_list_size = atoi(optarg);
- if (mheard_list_size < 10 || mheard_list_size > MHEARD_LIST_SIZE) {
- fprintf(stderr, "mheardd: list size must be between 10 and %d\n", MHEARD_LIST_SIZE);
- return 1;
- }
- break;
- case 'p':
- if (strlen(optarg) > sizeof(ports)-4) {
- fprintf(stderr, "mheardd: too many ports specified.");
- return 1;
- }
- if (*optarg == '!') {
- ports_excl = 1;
- optarg++;
- }
- sprintf(ports, "|%s|", optarg);
- for (p = ports; *p; p++) {
- if (*p == ' ' || *p == ',')
- *p = '|';
- }
- break;
- case 'v':
- printf("mheardd: %s\n", VERSION);
- return 0;
- case ':':
- fprintf(stderr, "mheardd: option -n needs an argument\n");
+ case 'l':
+ logging = TRUE;
+ break;
+ case 'f':
+ flush = TRUE;
+ break;
+ case 'n':
+ mheard_list_size = atoi(optarg);
+ if (mheard_list_size < 10 || mheard_list_size > MHEARD_LIST_SIZE) {
+ fprintf(stderr, "mheardd: list size must be between 10 and %d\n", MHEARD_LIST_SIZE);
return 1;
- case '?':
- fprintf(stderr, "Usage: mheardd [-f] [-l] [-n number] [-p [!]port1[,port2,..]] [-v]\n");
+ }
+ break;
+ case 'p':
+ if (strlen(optarg) > sizeof(ports)-4) {
+ fprintf(stderr, "mheardd: too many ports specified.");
return 1;
+ }
+ if (*optarg == '!') {
+ ports_excl = 1;
+ optarg++;
+ }
+ sprintf(ports, "|%s|", optarg);
+ for (p = ports; *p; p++) {
+ if (*p == ' ' || *p == ',')
+ *p = '|';
+ }
+ break;
+ case 'v':
+ printf("mheardd: %s\n", VERSION);
+ return 0;
+ case ':':
+ fprintf(stderr, "mheardd: option -n needs an argument\n");
+ return 1;
+ case '?':
+ fprintf(stderr, "Usage: mheardd [-f] [-l] [-n number] [-p [!]port1[,port2,..]] [-v]\n");
+ return 1;
}
}
@@ -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;
}
@@ -294,103 +294,103 @@ int main(int argc, char **argv)
mheard->entry.count++;
switch (type) {
- case SABM:
- mheard->entry.type = MHEARD_TYPE_SABM;
- mheard->entry.uframes++;
- break;
- case SABME:
- mheard->entry.type = MHEARD_TYPE_SABME;
- mheard->entry.uframes++;
+ case SABM:
+ mheard->entry.type = MHEARD_TYPE_SABM;
+ mheard->entry.uframes++;
+ break;
+ case SABME:
+ mheard->entry.type = MHEARD_TYPE_SABME;
+ mheard->entry.uframes++;
+ break;
+ case DISC:
+ mheard->entry.type = MHEARD_TYPE_DISC;
+ mheard->entry.uframes++;
+ break;
+ case UA:
+ mheard->entry.type = MHEARD_TYPE_UA;
+ mheard->entry.uframes++;
+ break;
+ case DM:
+ mheard->entry.type = MHEARD_TYPE_DM;
+ mheard->entry.uframes++;
+ break;
+ case RR:
+ mheard->entry.type = MHEARD_TYPE_RR;
+ mheard->entry.sframes++;
+ break;
+ case RNR:
+ mheard->entry.type = MHEARD_TYPE_RNR;
+ mheard->entry.sframes++;
+ break;
+ case REJ:
+ mheard->entry.type = MHEARD_TYPE_REJ;
+ mheard->entry.sframes++;
+ break;
+ case FRMR:
+ mheard->entry.type = MHEARD_TYPE_FRMR;
+ mheard->entry.uframes++;
+ break;
+ case I:
+ mheard->entry.type = MHEARD_TYPE_I;
+ mheard->entry.iframes++;
+ break;
+ case UI:
+ mheard->entry.type = MHEARD_TYPE_UI;
+ mheard->entry.uframes++;
+ break;
+ default:
+ if (logging)
+ syslog(LOG_WARNING, "unknown packet type %02X\n", *data);
+ mheard->entry.type = MHEARD_TYPE_UNKNOWN;
+ break;
+ }
+
+ data += ctlen;
+ size -= ctlen;
+
+ if (type == I || type == UI) {
+ switch (*data) {
+ case PID_TEXT:
+ mheard->entry.mode |= MHEARD_MODE_TEXT;
break;
- case DISC:
- mheard->entry.type = MHEARD_TYPE_DISC;
- mheard->entry.uframes++;
+ case PID_SEGMENT:
+ mheard->entry.mode |= MHEARD_MODE_SEGMENT;
break;
- case UA:
- mheard->entry.type = MHEARD_TYPE_UA;
- mheard->entry.uframes++;
+ case PID_ARP:
+ mheard->entry.mode |= MHEARD_MODE_ARP;
break;
- case DM:
- mheard->entry.type = MHEARD_TYPE_DM;
- mheard->entry.uframes++;
+ case PID_NETROM:
+ mheard->entry.mode |= MHEARD_MODE_NETROM;
break;
- case RR:
- mheard->entry.type = MHEARD_TYPE_RR;
- mheard->entry.sframes++;
+ case PID_IP:
+ mheard->entry.mode |= (type == I) ? MHEARD_MODE_IP_VC : MHEARD_MODE_IP_DG;
break;
- case RNR:
- mheard->entry.type = MHEARD_TYPE_RNR;
- mheard->entry.sframes++;
+ case PID_ROSE:
+ mheard->entry.mode |= MHEARD_MODE_ROSE;
break;
- case REJ:
- mheard->entry.type = MHEARD_TYPE_REJ;
- mheard->entry.sframes++;
+ case PID_TEXNET:
+ mheard->entry.mode |= MHEARD_MODE_TEXNET;
break;
- case FRMR:
- mheard->entry.type = MHEARD_TYPE_FRMR;
- mheard->entry.uframes++;
+ case PID_FLEXNET:
+ mheard->entry.mode |= MHEARD_MODE_FLEXNET;
break;
- case I:
- mheard->entry.type = MHEARD_TYPE_I;
- mheard->entry.iframes++;
+ case PID_PSATPB:
+ mheard->entry.mode |= MHEARD_MODE_PSATPB;
break;
- case UI:
- mheard->entry.type = MHEARD_TYPE_UI;
- mheard->entry.uframes++;
+ case PID_PSATFT:
+ mheard->entry.mode |= MHEARD_MODE_PSATFT;
break;
default:
if (logging)
- syslog(LOG_WARNING, "unknown packet type %02X\n", *data);
- mheard->entry.type = MHEARD_TYPE_UNKNOWN;
+ syslog(LOG_WARNING, "unknown PID %02X\n", *data);
+ mheard->entry.mode |= MHEARD_MODE_UNKNOWN;
break;
- }
-
- data += ctlen;
- size -= ctlen;
-
- if (type == I || type == UI) {
- switch (*data) {
- case PID_TEXT:
- mheard->entry.mode |= MHEARD_MODE_TEXT;
- break;
- case PID_SEGMENT:
- mheard->entry.mode |= MHEARD_MODE_SEGMENT;
- break;
- case PID_ARP:
- mheard->entry.mode |= MHEARD_MODE_ARP;
- break;
- case PID_NETROM:
- mheard->entry.mode |= MHEARD_MODE_NETROM;
- break;
- case PID_IP:
- mheard->entry.mode |= (type == I) ? MHEARD_MODE_IP_VC : MHEARD_MODE_IP_DG;
- break;
- case PID_ROSE:
- mheard->entry.mode |= MHEARD_MODE_ROSE;
- break;
- case PID_TEXNET:
- mheard->entry.mode |= MHEARD_MODE_TEXNET;
- break;
- case PID_FLEXNET:
- mheard->entry.mode |= MHEARD_MODE_FLEXNET;
- break;
- case PID_PSATPB:
- mheard->entry.mode |= MHEARD_MODE_PSATPB;
- break;
- case PID_PSATFT:
- mheard->entry.mode |= MHEARD_MODE_PSATFT;
- break;
- default:
- if (logging)
- syslog(LOG_WARNING, "unknown PID %02X\n", *data);
- mheard->entry.mode |= MHEARD_MODE_UNKNOWN;
- 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 &&
@@ -475,4 +475,3 @@ static struct mheard_list_struct *findentry(ax25_address *callsign, char *port)
return oldest;
}
-
diff --git a/ax25/rxecho.c b/ax25/rxecho.c
index 7acb156..c67b95e 100644
--- a/ax25/rxecho.c
+++ b/ax25/rxecho.c
@@ -28,14 +28,14 @@
* callsign didn't match (and the frame wasn't echoed anywhere).
*
* *** 20021206 dl9sau:
- * - fixed a bug preventing echo to multible ports; it may also
+ * - fixed a bug preventing echo to multible ports; it may also
* lead to retransmission on the interface where it came from
* - fixed problem that frames via sendto(...,alen) had a wrong
* protocol (because alen became larger than the size of
* struct sockaddr).
* - sockaddr_pkt is the right struct for recvfrom/sendto on
* type SOCK_PACKET family AF_INET sockets.
- * - added support for new PF_PACKET family with sockaddr_ll
+ * - added support for new PF_PACKET family with sockaddr_ll
*
* ***
*
@@ -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 */
@@ -382,15 +382,15 @@ int main(int argc, char **argv)
while ((s = getopt(argc, argv, "lv")) != -1) {
switch (s) {
- case 'l':
- logging = TRUE;
- break;
- case 'v':
- printf("rxecho: %s\n", VERSION);
- return 0;
- default:
- fprintf(stderr, "usage: rxecho [-l] [-v]\n");
- return 1;
+ case 'l':
+ logging = TRUE;
+ break;
+ case 'v':
+ printf("rxecho: %s\n", VERSION);
+ return 0;
+ default:
+ fprintf(stderr, "usage: rxecho [-l] [-v]\n");
+ return 1;
}
}
@@ -455,7 +455,7 @@ int main(int argc, char **argv)
}
for (;;) {
- alen = sa_len;
+ alen = sa_len;
if ((size = recvfrom(s, buf, 1500, 0, psa, &alen)) == -1) {
if (logging) {
@@ -479,11 +479,11 @@ int main(int argc, char **argv)
for (p = list; p != NULL; p = p->next)
#ifdef USE_SOCKADDR_SLL
- if (p->from_idx == from_idx && (check_calls(p, buf, size) == 0)) {
- sll.sll_ifindex = p->to_idx;
+ if (p->from_idx == from_idx && (check_calls(p, buf, size) == 0)) {
+ sll.sll_ifindex = p->to_idx;
#else
- if ((strcmp(p->from, from_dev_name) == 0) && (check_calls(p, buf, size) == 0)) {
- strcpy(psa->sa_data, p->to);
+ if ((strcmp(p->from, from_dev_name) == 0) && (check_calls(p, buf, size) == 0)) {
+ strcpy(psa->sa_data, p->to);
#endif
/*
* cave: alen (set by recvfrom()) may > salen
diff --git a/dmascc/Makefile.am b/dmascc/Makefile.am
index 45bd335..c905156 100644
--- a/dmascc/Makefile.am
+++ b/dmascc/Makefile.am
@@ -3,11 +3,8 @@ sbin_PROGRAMS = dmascc_cfg
dmascc_cfg_SOURCE = dmascc_cfg.c
-man_MANS = dmascc_cfg.1
+dist_man_MANS = dmascc_cfg.1
-EXTRA_DIST = $(man_MANS) $(doc_DATA)
-
-doc_DATA = README.dmascc
+dist_doc_DATA = README.dmascc
installconf:
-
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/dmascc/dmascc_cfg.c b/dmascc/dmascc_cfg.c
index 80f27c0..fc4ae4c 100644
--- a/dmascc/dmascc_cfg.c
+++ b/dmascc/dmascc_cfg.c
@@ -62,280 +62,280 @@ struct scc_param {
void usage(void)
{
- fprintf(stderr,
- "usage: dmascc_cfg <interface> [ options ... ]\n\n"
- "options: --show show updated configuration\n"
- " --frequency f frequency of baud rate generator in Hz\n"
- " --nrzi n NRZ (0) or NRZI (1) encoding\n"
- " --clocks n clock mode (see manual page)\n"
- " --txdelay t transmit delay in ms\n"
- " --txpause t inter-packet delay in ms\n"
- " --txtimeout t stop transmitting packets after t ms\n"
- " --txtail t transmit tail in ms\n"
- " --rtsoff t DCD settling time in ms (after RTS off)\n"
- " --dcdon t DCD settling time in ms (after DCD on)\n"
- " --dcdoff t DCD settling time in ms (after DCD off)\n"
- " --slottime t slot time in ms\n"
- " --persist n persistence parameter (1..256)\n"
- " --waittime t wait time after transmit in ms\n"
- " --dma n "
- "DMA channel: -1 (no DMA), 0 (S5SCC/DMA only), 1, 3\n"
- );
+ fprintf(stderr,
+ "usage: dmascc_cfg <interface> [ options ... ]\n\n"
+ "options: --show show updated configuration\n"
+ " --frequency f frequency of baud rate generator in Hz\n"
+ " --nrzi n NRZ (0) or NRZI (1) encoding\n"
+ " --clocks n clock mode (see manual page)\n"
+ " --txdelay t transmit delay in ms\n"
+ " --txpause t inter-packet delay in ms\n"
+ " --txtimeout t stop transmitting packets after t ms\n"
+ " --txtail t transmit tail in ms\n"
+ " --rtsoff t DCD settling time in ms (after RTS off)\n"
+ " --dcdon t DCD settling time in ms (after DCD on)\n"
+ " --dcdoff t DCD settling time in ms (after DCD off)\n"
+ " --slottime t slot time in ms\n"
+ " --persist n persistence parameter (1..256)\n"
+ " --waittime t wait time after transmit in ms\n"
+ " --dma n "
+ "DMA channel: -1 (no DMA), 0 (S5SCC/DMA only), 1, 3\n"
+ );
}
int main(int argc, char *argv[])
{
- int sk, show = 0, set = 0, old = 0, secondary;
- struct ifreq ifr;
- struct scc_param param;
- char **option, *end, *error = NULL;
- long hz = -1L;
+ int sk, show = 0, set = 0, old = 0, secondary;
+ struct ifreq ifr;
+ struct scc_param param;
+ char **option, *end, *error = NULL;
+ long hz = -1L;
- if (argc < 2) {
- usage();
- return 1;
- }
+ if (argc < 2) {
+ usage();
+ return 1;
+ }
- if ((sk = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
- perror("socket");
- return 2;
- }
+ if ((sk = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ perror("socket");
+ return 2;
+ }
- memset(&param, 0, sizeof(param));
- param.txpause = -1;
+ memset(&param, 0, sizeof(param));
+ param.txpause = -1;
- if (strncmp(argv[1], "dmascc", 6)) {
- fprintf(stderr, "invalid interface name.\n");
- return 5;
- }
+ if (strncmp(argv[1], "dmascc", 6)) {
+ fprintf(stderr, "invalid interface name.\n");
+ return 5;
+ }
- strncpy(ifr.ifr_name, argv[1], IFNAMSIZ);
- ifr.ifr_data = (caddr_t) &param;
- if (ioctl(sk, SIOCGSCCPARAM, &ifr) < 0) {
- perror("ioctl");
- close(sk);
- return 3;
- }
+ strncpy(ifr.ifr_name, argv[1], IFNAMSIZ);
+ ifr.ifr_data = (caddr_t) &param;
+ if (ioctl(sk, SIOCGSCCPARAM, &ifr) < 0) {
+ perror("ioctl");
+ close(sk);
+ return 3;
+ }
- if (param.txpause == -1) {
- param.txpause = 0;
- old = 1;
- }
+ if (param.txpause == -1) {
+ param.txpause = 0;
+ old = 1;
+ }
#ifdef _SC_CLK_TCKxx
- hz = sysconf(_SC_CLK_TCK);
- if (hz == -1)
- perror("sysconf(_SC_CLK_TCK)");
+ hz = sysconf(_SC_CLK_TCK);
+ if (hz == -1)
+ perror("sysconf(_SC_CLK_TCK)");
#endif
- if (hz == -1) {
+ if (hz == -1) {
#ifdef HZ
- hz = HZ;
+ hz = HZ;
#else
- hz = 100;
+ hz = 100;
#endif
- fprintf(stderr, "warning: cannot dermine the clock rate HZ on which this system is running.\n");
- fprintf(stderr, " Assuming %ld, what may be wrong.\n", hz);
- }
+ fprintf(stderr, "warning: cannot dermine the clock rate HZ on which this system is running.\n");
+ fprintf(stderr, " Assuming %ld, what may be wrong.\n", hz);
+ }
- secondary = argv[1][strlen(argv[1])-1]%2;
+ secondary = argv[1][strlen(argv[1])-1]%2;
- option = argv + 2;
- while (!error && *option != NULL) {
- if (!strcmp(*option, "--show")) {
- show = 1;
- option++;
- } else if (!strcmp(*option, "--frequency")) {
- option++;
- if (*option != NULL) {
- double f;
- set = 1;
- f = strtod(*option++, &end);
- if (*end) error = "frequency not a number";
- else {
- if (f < 0.0) error = "frequency < 0";
- else if (f == 0.0) param.brg_tc = -1;
- else {
- param.brg_tc = param.pclk_hz / (f * 2) - 2;
- if (param.brg_tc > 0xffff) error = "frequency too low";
- if (param.brg_tc < 0) error = "frequency too high";
- }
+ option = argv + 2;
+ while (!error && *option != NULL) {
+ if (!strcmp(*option, "--show")) {
+ show = 1;
+ option++;
+ } else if (!strcmp(*option, "--frequency")) {
+ option++;
+ if (*option != NULL) {
+ double f;
+ set = 1;
+ f = strtod(*option++, &end);
+ if (*end) error = "frequency not a number";
+ else {
+ if (f < 0.0) error = "frequency < 0";
+ else if (f == 0.0) param.brg_tc = -1;
+ else {
+ param.brg_tc = param.pclk_hz / (f * 2) - 2;
+ if (param.brg_tc > 0xffff) error = "frequency too low";
+ if (param.brg_tc < 0) error = "frequency too high";
+ }
+ }
+ } else error = "--frequency requires parameter";
+ } else if (!strcmp(*option, "--nrzi")) {
+ option++;
+ if (*option != NULL) {
+ set = 1;
+ param.nrzi = strtol(*option++, &end, 0);
+ if (*end || param.nrzi < 0 || param.nrzi > 1)
+ error = "nrzi must be 0 or 1";
+ } else error = "--nrzi requires parameter";
+ } else if (!strcmp(*option, "--clocks")) {
+ option++;
+ if (*option != NULL) {
+ set = 1;
+ param.clocks = strtol(*option++, &end, 0);
+ if (*end) error = "clock mode not a number";
+ else if ((param.clocks & ~0x7f)) error = "invalid clock mode";
+ } else error = "--clocks requires parameter";
+ } else if (!strcmp(*option, "--txdelay")) {
+ option++;
+ if (*option != NULL) {
+ set = 1;
+ param.txdelay = TMR_0_HZ * strtod(*option++, &end) / 1000.0;
+ if (*end) error = "txdelay not a number";
+ else if (param.txdelay < 0) error = "txdelay < 0";
+ else if (param.txdelay > 0xffff) error = "txdelay too large";
+ } else error = "--txdelay requires parameter";
+ } else if (!strcmp(*option, "--txpause")) {
+ option++;
+ if (*option != NULL) {
+ set = 1;
+ param.txpause = TMR_0_HZ * strtod(*option++, &end) / 1000.0;
+ if (*end) error = "txpause not a number";
+ else if (param.txpause < 0) error = "txpause < 0";
+ else if (param.txpause > 0xffff) error = "txpause too large";
+ if (old && param.txpause != 0)
+ fprintf(stderr, "warning: old driver; txpause not supported.\n");
+ } else error = "--txpause requires parameter";
+ } else if (!strcmp(*option, "--txtimeout")) {
+ option++;
+ if (*option != NULL) {
+ set = 1;
+ param.txtimeout = hz * strtod(*option++, &end) / 1000.0;
+ if (*end) error = "txtimeout not a number";
+ else if (param.txtimeout < 0) error = "txtimeout < 0";
+ } else error = "--txtimeout requires parameter";
+ } else if (!strcmp(*option, "--txtail")) {
+ option++;
+ if (*option != NULL) {
+ set = 1;
+ param.txtail = TMR_0_HZ * strtod(*option++, &end) / 1000.0;
+ if (*end) error = "txtail not a number";
+ else if (param.txtail < 0) error = "txtail < 0";
+ else if (param.txtail > 0xffff) error = "txtail too large";
+ } else error = "--txtail requires parameter";
+ } else if (!strcmp(*option, "--rtsoff")) {
+ option++;
+ if (*option != NULL) {
+ set = 1;
+ param.rtsoff = TMR_0_HZ * strtod(*option++, &end) / 1000.0;
+ if (*end) error = "rtsoff not a number";
+ else if (param.rtsoff < 0) error = "rtsoff < 0";
+ else if (param.rtsoff > 0xffff) error = "rtsoff too large";
+ if (old && param.rtsoff != 0)
+ fprintf(stderr, "warning: old driver; rtsoff not supported.\n");
+ } else error = "--rtsoff requires parameter";
+ } else if (!strcmp(*option, "--dcdon")) {
+ option++;
+ if (*option != NULL) {
+ set = 1;
+ param.dcdon = TMR_0_HZ * strtod(*option++, &end) / 1000.0;
+ if (*end) error = "dcdon not a number";
+ else if (param.dcdon < 0) error = "dcdon < 0";
+ else if (param.dcdon > 0xffff) error = "dcdon too large";
+ if (old && param.dcdon != 0)
+ fprintf(stderr, "warning: old driver; dcdon not supported.\n");
+ } else error = "--dcdon requires parameter";
+ } else if (!strcmp(*option, "--dcdoff")) {
+ option++;
+ if (*option != NULL) {
+ set = 1;
+ param.dcdoff = TMR_0_HZ * strtod(*option++, &end) / 1000.0;
+ if (*end) error = "dcdoff not a number";
+ else if (param.dcdoff < 0) error = "dcdoff < 0";
+ else if (param.dcdoff > 0xffff) error = "dcdoff too large";
+ if (old && param.dcdoff != 0)
+ fprintf(stderr, "warning: old driver; dcdoff not supported.\n");
+ } else error = "--dcdoff requires parameter";
+ } else if (!strcmp(*option, "--slottime")) {
+ option++;
+ if (*option != NULL) {
+ set = 1;
+ param.slottime = TMR_0_HZ * strtod(*option++, &end) / 1000.0;
+ if (*end) error = "slottime not a number";
+ else if (param.slottime < 0) error = "slottime < 0";
+ else if (param.slottime > 0xffff) error = "slottime too large";
+ } else error = "--slottime requires parameter";
+ } else if (!strcmp(*option, "--persist")) {
+ option++;
+ if (*option != NULL) {
+ set = 1;
+ param.persist = strtol(*option++, &end, 0);
+ if (*end) error = "persist not a number";
+ else if (param.persist < 1) error = "persist < 1";
+ else if (param.persist > 256) error = "persist > 256";
+ } else error = "--persist requires parameter";
+ } else if (!strcmp(*option, "--waittime")) {
+ option++;
+ if (*option != NULL) {
+ set = 1;
+ param.waittime = TMR_0_HZ * strtod(*option++, &end) / 1000.0;
+ if (*end) error = "waittime not a number";
+ else if (param.waittime < 0) error = "waittime < 0";
+ else if (param.waittime > 0xffff) error = "waittime too large";
+ } else error = "--waittime requires parameter";
+ } else if (!strcmp(*option, "--dma")) {
+ option++;
+ if (*option != NULL) {
+ int dma = param.dma;
+ set = 1;
+ param.dma = strtol(*option++, &end, 0);
+ if (*end) error = "DMA channel not a number";
+ else if (secondary && param.dma != -1)
+ error = "SCC port B must have DMA disabled";
+ else if (param.dma < -1 || param.dma == 2 || param.dma > 3)
+ error = "invalid DMA channel";
+ else if (param.pclk_hz != 9830400 && param.dma == 0)
+ error = "only S5SCC/DMA supports DMA channel 0";
+ else if (old && param.dma == 0)
+ error = "old driver; DMA channel 0 not supported";
+ else if (old && param.dma == -1 && dma > 0)
+ error = "old driver; reload module or reboot to disable DMA";
+ else if (old && param.dma == -1 && dma == 0)
+ param.dma = 0;
+ } else error = "--dma requires parameter";
+ } else error = "invalid option";
}
- } else error = "--frequency requires parameter";
- } else if (!strcmp(*option, "--nrzi")) {
- option++;
- if (*option != NULL) {
- set = 1;
- param.nrzi = strtol(*option++, &end, 0);
- if (*end || param.nrzi < 0 || param.nrzi > 1)
- error = "nrzi must be 0 or 1";
- } else error = "--nrzi requires parameter";
- } else if (!strcmp(*option, "--clocks")) {
- option++;
- if (*option != NULL) {
- set = 1;
- param.clocks = strtol(*option++, &end, 0);
- if (*end) error = "clock mode not a number";
- else if ((param.clocks & ~0x7f)) error = "invalid clock mode";
- } else error = "--clocks requires parameter";
- } else if (!strcmp(*option, "--txdelay")) {
- option++;
- if (*option != NULL) {
- set = 1;
- param.txdelay = TMR_0_HZ * strtod(*option++, &end) / 1000.0;
- if (*end) error = "txdelay not a number";
- else if (param.txdelay < 0) error = "txdelay < 0";
- else if (param.txdelay > 0xffff) error = "txdelay too large";
- } else error = "--txdelay requires parameter";
- } else if (!strcmp(*option, "--txpause")) {
- option++;
- if (*option != NULL) {
- set = 1;
- param.txpause = TMR_0_HZ * strtod(*option++, &end) / 1000.0;
- if (*end) error = "txpause not a number";
- else if (param.txpause < 0) error = "txpause < 0";
- else if (param.txpause > 0xffff) error = "txpause too large";
- if (old && param.txpause != 0)
- fprintf(stderr, "warning: old driver; txpause not supported.\n");
- } else error = "--txpause requires parameter";
- } else if (!strcmp(*option, "--txtimeout")) {
- option++;
- if (*option != NULL) {
- set = 1;
- param.txtimeout = hz * strtod(*option++, &end) / 1000.0;
- if (*end) error = "txtimeout not a number";
- else if (param.txtimeout < 0) error = "txtimeout < 0";
- } else error = "--txtimeout requires parameter";
- } else if (!strcmp(*option, "--txtail")) {
- option++;
- if (*option != NULL) {
- set = 1;
- param.txtail = TMR_0_HZ * strtod(*option++, &end) / 1000.0;
- if (*end) error = "txtail not a number";
- else if (param.txtail < 0) error = "txtail < 0";
- else if (param.txtail > 0xffff) error = "txtail too large";
- } else error = "--txtail requires parameter";
- } else if (!strcmp(*option, "--rtsoff")) {
- option++;
- if (*option != NULL) {
- set = 1;
- param.rtsoff = TMR_0_HZ * strtod(*option++, &end) / 1000.0;
- if (*end) error = "rtsoff not a number";
- else if (param.rtsoff < 0) error = "rtsoff < 0";
- else if (param.rtsoff > 0xffff) error = "rtsoff too large";
- if (old && param.rtsoff != 0)
- fprintf(stderr, "warning: old driver; rtsoff not supported.\n");
- } else error = "--rtsoff requires parameter";
- } else if (!strcmp(*option, "--dcdon")) {
- option++;
- if (*option != NULL) {
- set = 1;
- param.dcdon = TMR_0_HZ * strtod(*option++, &end) / 1000.0;
- if (*end) error = "dcdon not a number";
- else if (param.dcdon < 0) error = "dcdon < 0";
- else if (param.dcdon > 0xffff) error = "dcdon too large";
- if (old && param.dcdon != 0)
- fprintf(stderr, "warning: old driver; dcdon not supported.\n");
- } else error = "--dcdon requires parameter";
- } else if (!strcmp(*option, "--dcdoff")) {
- option++;
- if (*option != NULL) {
- set = 1;
- param.dcdoff = TMR_0_HZ * strtod(*option++, &end) / 1000.0;
- if (*end) error = "dcdoff not a number";
- else if (param.dcdoff < 0) error = "dcdoff < 0";
- else if (param.dcdoff > 0xffff) error = "dcdoff too large";
- if (old && param.dcdoff != 0)
- fprintf(stderr, "warning: old driver; dcdoff not supported.\n");
- } else error = "--dcdoff requires parameter";
- } else if (!strcmp(*option, "--slottime")) {
- option++;
- if (*option != NULL) {
- set = 1;
- param.slottime = TMR_0_HZ * strtod(*option++, &end) / 1000.0;
- if (*end) error = "slottime not a number";
- else if (param.slottime < 0) error = "slottime < 0";
- else if (param.slottime > 0xffff) error = "slottime too large";
- } else error = "--slottime requires parameter";
- } else if (!strcmp(*option, "--persist")) {
- option++;
- if (*option != NULL) {
- set = 1;
- param.persist = strtol(*option++, &end, 0);
- if (*end) error = "persist not a number";
- else if (param.persist < 1) error = "persist < 1";
- else if (param.persist > 256) error = "persist > 256";
- } else error = "--persist requires parameter";
- } else if (!strcmp(*option, "--waittime")) {
- option++;
- if (*option != NULL) {
- set = 1;
- param.waittime = TMR_0_HZ * strtod(*option++, &end) / 1000.0;
- if (*end) error = "waittime not a number";
- else if (param.waittime < 0) error = "waittime < 0";
- else if (param.waittime > 0xffff) error = "waittime too large";
- } else error = "--waittime requires parameter";
- } else if (!strcmp(*option, "--dma")) {
- option++;
- if (*option != NULL) {
- int dma = param.dma;
- set = 1;
- param.dma = strtol(*option++, &end, 0);
- if (*end) error = "DMA channel not a number";
- else if (secondary && param.dma != -1)
- error = "SCC port B must have DMA disabled";
- else if (param.dma < -1 || param.dma == 2 || param.dma > 3)
- error = "invalid DMA channel";
- else if (param.pclk_hz != 9830400 && param.dma == 0)
- error = "only S5SCC/DMA supports DMA channel 0";
- else if (old && param.dma == 0)
- error = "old driver; DMA channel 0 not supported";
- else if (old && param.dma == -1 && dma > 0)
- error = "old driver; reload module or reboot to disable DMA";
- else if (old && param.dma == -1 && dma == 0)
- param.dma = 0;
- } else error = "--dma requires parameter";
- } else error = "invalid option";
- }
- if (error) {
- fprintf(stderr, "usage error: %s.\n", error);
- close(sk);
- return 1;
- }
+ if (error) {
+ fprintf(stderr, "usage error: %s.\n", error);
+ close(sk);
+ return 1;
+ }
- if (set) {
- if (ioctl(sk, SIOCSSCCPARAM, &ifr) < 0) {
- perror("ioctl");
- close(sk);
- return 4;
- }
- }
+ if (set) {
+ if (ioctl(sk, SIOCSSCCPARAM, &ifr) < 0) {
+ perror("ioctl");
+ close(sk);
+ return 4;
+ }
+ }
- if (show) {
- double f;
- if (param.brg_tc < 0) f = 0.0;
- else f = ((double) param.pclk_hz) / ( 2 * (param.brg_tc + 2));
- printf("dmascc_cfg %s \\\n--frequency %.2f --nrzi %d --clocks 0x%02X "
- "--txdelay %.2f \\\n--txpause %.2f --txtimeout %.2f "
- "--txtail %.2f --rtsoff %.2f \\\n--dcdon %.2f --dcdoff %.2f "
- "--slottime %.2f --persist %d \\\n--waittime %.2f --dma %d\n",
- argv[1],
- f,
- param.nrzi,
- param.clocks,
- param.txdelay * 1000.0 / TMR_0_HZ,
- param.txpause * 1000.0 / TMR_0_HZ,
- param.txtimeout * 1000.0 / hz,
- param.txtail * 1000.0 / TMR_0_HZ,
- param.rtsoff * 1000.0 / TMR_0_HZ,
- param.dcdon * 1000.0 / TMR_0_HZ,
- param.dcdoff * 1000.0 / TMR_0_HZ,
- param.slottime * 1000.0 / TMR_0_HZ,
- param.persist,
- param.waittime * 1000.0 / TMR_0_HZ,
- (old && param.dma == 0) ? -1 : param.dma);
- }
+ if (show) {
+ double f;
+ if (param.brg_tc < 0) f = 0.0;
+ else f = ((double) param.pclk_hz) / ( 2 * (param.brg_tc + 2));
+ printf("dmascc_cfg %s \\\n--frequency %.2f --nrzi %d --clocks 0x%02X "
+ "--txdelay %.2f \\\n--txpause %.2f --txtimeout %.2f "
+ "--txtail %.2f --rtsoff %.2f \\\n--dcdon %.2f --dcdoff %.2f "
+ "--slottime %.2f --persist %d \\\n--waittime %.2f --dma %d\n",
+ argv[1],
+ f,
+ param.nrzi,
+ param.clocks,
+ param.txdelay * 1000.0 / TMR_0_HZ,
+ param.txpause * 1000.0 / TMR_0_HZ,
+ param.txtimeout * 1000.0 / hz,
+ param.txtail * 1000.0 / TMR_0_HZ,
+ param.rtsoff * 1000.0 / TMR_0_HZ,
+ param.dcdon * 1000.0 / TMR_0_HZ,
+ param.dcdoff * 1000.0 / TMR_0_HZ,
+ param.slottime * 1000.0 / TMR_0_HZ,
+ param.persist,
+ param.waittime * 1000.0 / TMR_0_HZ,
+ (old && param.dma == 0) ? -1 : param.dma);
+ }
- close(sk);
- return 0;
+ close(sk);
+ return 0;
}
diff --git a/hdlcutil/Makefile.am b/hdlcutil/Makefile.am
index b200566..fd94b2a 100644
--- a/hdlcutil/Makefile.am
+++ b/hdlcutil/Makefile.am
@@ -14,12 +14,9 @@ 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/
-man_MANS = sethdlc.8 smmixer.8 baycom.9 hdlcdrv.9 soundmodem.9 smdiag.8
-
-EXTRA_DIST = $(man_MANS)
-
+dist_man_MANS = sethdlc.8 smmixer.8 baycom.9 hdlcdrv.9 soundmodem.9 smdiag.8
diff --git a/hdlcutil/baycom.9 b/hdlcutil/baycom.9
index 3e2c740..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
@@ -56,7 +56,3 @@ linux/drivers/net/hdlcdrv.c,
.SH AUTHOR
baycom was written by Thomas Sailer, HB9JNX/AE4WA, (t.sailer@alumni.ethz.ch).
-
-
-
-
diff --git a/hdlcutil/fl/xfhdlcchpar_main.cxx b/hdlcutil/fl/xfhdlcchpar_main.cxx
index 8ebee3d..4b01138 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";
@@ -79,7 +79,7 @@ static const char *usage_str =
int main(int argc, char *argv[])
{
- int c, i;
+ int c, i;
int ret;
struct hdrvc_channel_params cp;
diff --git a/hdlcutil/fl/xfhdlcst_main.cxx b/hdlcutil/fl/xfhdlcst_main.cxx
index a17e546..85a66db 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";
@@ -70,7 +70,7 @@ static const char *usage_str =
int main(int argc, char *argv[])
{
- int c, i;
+ int c, i;
int ret;
struct hdrvc_channel_state cs;
#ifdef HDRVC_KERNEL
@@ -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.cxx b/hdlcutil/fl/xfsmdiag.cxx
index 84c4bac..7232cfa 100644
--- a/hdlcutil/fl/xfsmdiag.cxx
+++ b/hdlcutil/fl/xfsmdiag.cxx
@@ -52,36 +52,36 @@ Fl_Window* create_the_forms() {
{ Fl_Group* o = scopemode = new Fl_Group(550, 10, 140, 130);
o->align(FL_ALIGN_CENTER);
{ Fl_Box* o = new Fl_Box(550, 10, 140, 130);
- o->box(FL_DOWN_BOX);
+ o->box(FL_DOWN_BOX);
}
{ Fl_Check_Button* o = sm_off = new Fl_Check_Button(560, 20, 120, 20, "Off");
- o->type(102);
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)cb_mode, (void*)(0));
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)cb_mode, (void*)(0));
}
{ Fl_Check_Button* o = sm_input = new Fl_Check_Button(560, 40, 120, 20, "Input");
- o->type(102);
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)cb_mode, (void*)(1));
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)cb_mode, (void*)(1));
}
{ Fl_Check_Button* o = sm_demod = new Fl_Check_Button(560, 60, 120, 20, "Demodulator");
- o->type(102);
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)cb_mode, (void*)(2));
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)cb_mode, (void*)(2));
}
{ Fl_Check_Button* o = sm_constell = new Fl_Check_Button(560, 80, 120, 20, "Constellation");
- o->type(102);
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)cb_mode, (void*)(3));
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)cb_mode, (void*)(3));
}
{ Fl_Check_Button* o = sm_dcd = new Fl_Check_Button(560, 110, 120, 20, "Gated with DCD");
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)cb_mode, (void*)(256));
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)cb_mode, (void*)(256));
}
o->end();
}
diff --git a/hdlcutil/fl/xfsmdiag_main.cxx b/hdlcutil/fl/xfsmdiag_main.cxx
index 695d98f..dce7029 100644
--- a/hdlcutil/fl/xfsmdiag_main.cxx
+++ b/hdlcutil/fl/xfsmdiag_main.cxx
@@ -53,12 +53,12 @@
/* ---------------------------------------------------------------------- */
static char *progname;
-static unsigned int drawflags = 0;
+static unsigned int drawflags;
/* ---------------------------------------------------------------------- */
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;
@@ -94,7 +94,7 @@ void scope::resize(int xx, int yy, int ww, int hh)
void scope::draw()
{
GC gc;
- XGCValues gcv;
+ XGCValues gcv;
/* cannot use draw_box(); as it clears the whole window -> flicker */
/* from fl_boxtype.C, fl_down_frame */
@@ -178,17 +178,17 @@ void scope::mode(int dmode)
void scope::clear(void)
{
GC gc;
- XGCValues gcv;
+ XGCValues gcv;
if (!pixmalloc)
return;
gcv.line_width = 1;
- gcv.line_style = LineSolid;
+ gcv.line_style = LineSolid;
gcv.fill_style = FillSolid;
- gc = XCreateGC(fl_display, pixmap, GCLineWidth | GCLineStyle | GCFillStyle, &gcv);
- XSetState(fl_display, gc, col_background, col_background, GXcopy, AllPlanes);
+ gc = XCreateGC(fl_display, pixmap, GCLineWidth | GCLineStyle | GCFillStyle, &gcv);
+ XSetState(fl_display, gc, col_background, col_background, GXcopy, AllPlanes);
XFillRectangle(fl_display, pixmap, gc, 0, 0, W, H);
- XFreeGC(fl_display, gc);
+ XFreeGC(fl_display, gc);
redraw();
}
@@ -201,17 +201,17 @@ void scope::clear(void)
void scope::drawdata(short data[], int len, int xm)
{
int cnt;
- GC gc;
- XGCValues gcv;
+ GC gc;
+ 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;
- gcv.line_style = LineSolid;
- gc = XCreateGC(fl_display, pixmap, GCLineWidth | GCLineStyle, &gcv);
+ gcv.line_style = LineSolid;
+ gc = XCreateGC(fl_display, pixmap, GCLineWidth | GCLineStyle, &gcv);
if (drawmode == HDRVC_DIAGMODE_CONSTELLATION) {
#define XCOORD(x) ((SHRT_MAX - (int)(x)) * W / USHRT_MAX)
#define YCOORD(y) ((SHRT_MAX - (int)(y)) * H / USHRT_MAX)
@@ -241,7 +241,7 @@ void scope::drawdata(short data[], int len, int xm)
#undef XCOORD
#undef YCOORD
}
- XFreeGC(fl_display, gc);
+ XFreeGC(fl_display, gc);
redraw();
}
@@ -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";
@@ -349,7 +349,7 @@ static const char *usage_str =
int main(int argc, char *argv[])
{
- int c, i;
+ int c, i;
int ret;
unsigned int ifflags;
char name[64];
@@ -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.cxx b/hdlcutil/fl/xfsmmixer.cxx
index 57b5306..b5ba9b1 100644
--- a/hdlcutil/fl/xfsmmixer.cxx
+++ b/hdlcutil/fl/xfsmmixer.cxx
@@ -71,70 +71,70 @@ Fl_Window* create_form_ad1848() {
{ Fl_Group* o = ad1848_srcr = new Fl_Group(180, 150, 100, 120);
o->align(FL_ALIGN_CENTER);
{ Fl_Box* o = new Fl_Box(180, 150, 100, 120);
- o->box(FL_DOWN_BOX);
+ o->box(FL_DOWN_BOX);
}
{ Fl_Check_Button* o = ad1848_srcr_line = new Fl_Check_Button(190, 180, 60, 20, "Line");
- o->type(102);
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)update_ad1848);
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ad1848);
}
{ Fl_Check_Button* o = ad1848_srcr_aux1 = new Fl_Check_Button(190, 200, 60, 20, "Aux1");
- o->type(102);
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)update_ad1848);
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ad1848);
}
{ Fl_Check_Button* o = ad1848_srcr_mic = new Fl_Check_Button(190, 220, 60, 20, "Mic");
- o->type(102);
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)update_ad1848);
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ad1848);
}
{ Fl_Check_Button* o = ad1848_srcr_dac = new Fl_Check_Button(190, 240, 60, 20, "DAC");
- o->type(102);
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)update_ad1848);
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ad1848);
}
{ Fl_Box* o = new Fl_Box(190, 160, 60, 20, "Right source");
- o->box(FL_FLAT_BOX);
- o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ o->box(FL_FLAT_BOX);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
}
o->end();
}
{ Fl_Group* o = ad1848_srcl = new Fl_Group(180, 20, 100, 120);
o->align(FL_ALIGN_CENTER);
{ Fl_Box* o = new Fl_Box(180, 20, 100, 120);
- o->box(FL_DOWN_BOX);
+ o->box(FL_DOWN_BOX);
}
{ Fl_Box* o = new Fl_Box(190, 30, 60, 20, "Left source");
- o->box(FL_FLAT_BOX);
- o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ o->box(FL_FLAT_BOX);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
}
{ Fl_Check_Button* o = ad1848_srcl_line = new Fl_Check_Button(190, 50, 60, 20, "Line");
- o->type(102);
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)update_ad1848);
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ad1848);
}
{ Fl_Check_Button* o = ad1848_srcl_aux1 = new Fl_Check_Button(190, 70, 60, 20, "Aux1");
- o->type(102);
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)update_ad1848);
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ad1848);
}
{ Fl_Check_Button* o = ad1848_srcl_mic = new Fl_Check_Button(190, 90, 60, 20, "Mic");
- o->type(102);
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)update_ad1848);
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ad1848);
}
{ Fl_Check_Button* o = ad1848_srcl_dac = new Fl_Check_Button(190, 110, 60, 20, "DAC");
- o->type(102);
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)update_ad1848);
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ad1848);
}
o->end();
}
@@ -216,29 +216,29 @@ Fl_Window* create_form_ct1345() {
{ Fl_Group* o = ct1345_src = new Fl_Group(100, 20, 70, 100);
o->align(FL_ALIGN_CENTER);
{ Fl_Box* o = new Fl_Box(100, 20, 70, 100);
- o->box(FL_DOWN_BOX);
+ o->box(FL_DOWN_BOX);
}
{ Fl_Check_Button* o = ct1345_src_mic = new Fl_Check_Button(110, 50, 50, 20, "Mic");
- o->type(102);
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)update_ct1345);
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1345);
}
{ Fl_Check_Button* o = ct1345_src_cd = new Fl_Check_Button(110, 70, 50, 20, "CD");
- o->type(102);
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)update_ct1345);
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1345);
}
{ Fl_Check_Button* o = ct1345_src_line = new Fl_Check_Button(110, 90, 50, 20, "Line");
- o->type(102);
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)update_ct1345);
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1345);
}
{ Fl_Box* o = new Fl_Box(110, 30, 50, 20, "Source");
- o->box(FL_FLAT_BOX);
- o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ o->box(FL_FLAT_BOX);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
}
o->end();
}
@@ -342,92 +342,92 @@ Fl_Window* create_form_ct1745() {
{ Fl_Group* o = ct1745_srcl = new Fl_Group(180, 20, 110, 180);
o->align(FL_ALIGN_CENTER);
{ Fl_Box* o = new Fl_Box(180, 20, 110, 180);
- o->box(FL_DOWN_BOX);
+ o->box(FL_DOWN_BOX);
}
{ Fl_Box* o = new Fl_Box(191, 29, 89, 18, "Left source");
- o->box(FL_FLAT_BOX);
- o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ o->box(FL_FLAT_BOX);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
}
{ Fl_Check_Button* o = ct1745_srcl_mic = new Fl_Check_Button(190, 50, 90, 20, "Mic");
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)update_ct1745);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
}
{ Fl_Check_Button* o = ct1745_srcl_cdl = new Fl_Check_Button(190, 70, 90, 20, "CD left");
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)update_ct1745);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
}
{ Fl_Check_Button* o = ct1745_srcl_cdr = new Fl_Check_Button(190, 90, 90, 20, "CD right");
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)update_ct1745);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
}
{ Fl_Check_Button* o = ct1745_srcl_linel = new Fl_Check_Button(190, 110, 90, 20, "Line left");
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)update_ct1745);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
}
{ Fl_Check_Button* o = ct1745_srcl_midil = new Fl_Check_Button(190, 150, 90, 20, "MIDI left");
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)update_ct1745);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
}
{ Fl_Check_Button* o = ct1745_srcl_midir = new Fl_Check_Button(190, 170, 90, 20, "MIDI right");
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)update_ct1745);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
}
{ Fl_Check_Button* o = ct1745_srcl_liner = new Fl_Check_Button(190, 130, 90, 20, "Line right");
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)update_ct1745);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
}
o->end();
}
{ Fl_Group* o = ct1745_srcr = new Fl_Group(300, 20, 110, 180);
o->align(FL_ALIGN_CENTER);
{ Fl_Box* o = new Fl_Box(300, 20, 110, 180);
- o->box(FL_DOWN_BOX);
+ o->box(FL_DOWN_BOX);
}
{ Fl_Box* o = new Fl_Box(311, 29, 89, 18, "Right source");
- o->box(FL_FLAT_BOX);
- o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ o->box(FL_FLAT_BOX);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
}
{ Fl_Check_Button* o = ct1745_srcr_mic = new Fl_Check_Button(310, 50, 90, 20, "Mic");
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)update_ct1745);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
}
{ Fl_Check_Button* o = ct1745_srcr_cdl = new Fl_Check_Button(310, 70, 90, 20, "CD left");
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)update_ct1745);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
}
{ Fl_Check_Button* o = ct1745_srcr_cdr = new Fl_Check_Button(310, 90, 90, 20, "CD right");
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)update_ct1745);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
}
{ Fl_Check_Button* o = ct1745_srcr_linel = new Fl_Check_Button(310, 110, 90, 20, "Line left");
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)update_ct1745);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
}
{ Fl_Check_Button* o = ct1745_srcr_midil = new Fl_Check_Button(310, 150, 90, 20, "MIDI left");
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)update_ct1745);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
}
{ Fl_Check_Button* o = ct1745_srcr_midir = new Fl_Check_Button(310, 170, 90, 20, "MIDI right");
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)update_ct1745);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
}
{ Fl_Check_Button* o = ct1745_srcr_liner = new Fl_Check_Button(310, 130, 90, 20, "Line right");
- o->down_box(FL_DIAMOND_DOWN_BOX);
- o->selection_color(3);
- o->callback((Fl_Callback*)update_ct1745);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
}
o->end();
}
diff --git a/hdlcutil/fl/xfsmmixer_main.cxx b/hdlcutil/fl/xfsmmixer_main.cxx
index 5569e7c..b33533f 100644
--- a/hdlcutil/fl/xfsmmixer_main.cxx
+++ b/hdlcutil/fl/xfsmmixer_main.cxx
@@ -50,9 +50,9 @@ static unsigned int mixdevice;
static int do_mix_ioctl(int cmd, struct sm_mixer_data *mixdat)
{
- struct sm_ioctl par;
+ 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";
@@ -309,10 +309,10 @@ static const char *usage_str =
int main(int argc, char *argv[])
{
- int c, i;
+ 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 d0182ff..e76c391 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
@@ -118,11 +118,11 @@ the HDLC driver:
.nf
struct hdlcdrv_ops {
- const char *\fIdrvname\fP;
- const char *\fIdrvinfo\fP;
- int (*\fIopen\fP)(struct device *);
- int (*\fIclose\fP)(struct device *);
- int (*\fIioctl\fP)(struct device *, struct ifreq *, int);
+ const char *\fIdrvname\fP;
+ const char *\fIdrvinfo\fP;
+ int (*\fIopen\fP)(struct device *);
+ int (*\fIclose\fP)(struct device *);
+ int (*\fIioctl\fP)(struct device *, struct ifreq *, int);
};
.fi
@@ -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"
@@ -149,14 +149,14 @@ from and to the driver using the following struct:
.nf
struct hdlcdrv_ioctl {
- int cmd;
- union {
- struct hdlcdrv_params mp;
- struct hdlcdrv_channel_params cp;
- struct hdlcdrv_channel_state cs;
- unsigned int calibrate;
- unsigned char bits;
- } data;
+ int cmd;
+ union {
+ struct hdlcdrv_params mp;
+ struct hdlcdrv_channel_params cp;
+ struct hdlcdrv_channel_state cs;
+ unsigned int calibrate;
+ unsigned char bits;
+ } data;
};
.fi
@@ -214,7 +214,3 @@ linux/drivers/net/hdlcdrv.c,
.SH AUTHOR
hdlcdrv was written by Thomas Sailer, HB9JNX/AE4WA, (t.sailer@alumni.ethz.ch).
-
-
-
-
diff --git a/hdlcutil/hdrvcomm.c b/hdlcutil/hdrvcomm.c
index 6b4335e..c362c1b 100644
--- a/hdlcutil/hdrvcomm.c
+++ b/hdlcutil/hdrvcomm.c
@@ -69,7 +69,7 @@ static const char *if_name = "bcsf0";
static char *prg_name;
static int fd = -1;
static struct ifreq ifr_h;
-static int promisc = 0;
+static int promisc;
static int afpacket = 1;
static int msqid = -1;
@@ -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/hdrvcomm.h b/hdlcutil/hdrvcomm.h
index fbb4965..520f2d9 100644
--- a/hdlcutil/hdrvcomm.h
+++ b/hdlcutil/hdrvcomm.h
@@ -49,22 +49,22 @@ extern "C" {
/* ---------------------------------------------------------------------- */
struct hdrvc_channel_params {
- int tx_delay; /* the transmitter keyup delay in 10ms units */
- int tx_tail; /* the transmitter keyoff delay in 10ms units */
- int slottime; /* the slottime in 10ms; usually 10 = 100ms */
- int ppersist; /* the p-persistence 0..255 */
- int fulldup; /* some driver do not support full duplex, setting */
- /* this just makes them send even if DCD is on */
+ int tx_delay; /* the transmitter keyup delay in 10ms units */
+ int tx_tail; /* the transmitter keyoff delay in 10ms units */
+ int slottime; /* the slottime in 10ms; usually 10 = 100ms */
+ int ppersist; /* the p-persistence 0..255 */
+ int fulldup; /* some driver do not support full duplex, setting */
+ /* this just makes them send even if DCD is on */
};
struct hdrvc_channel_state {
- int ptt;
- int dcd;
- int ptt_keyed;
- unsigned long tx_packets;
- unsigned long tx_errors;
- unsigned long rx_packets;
- unsigned long rx_errors;
+ int ptt;
+ int dcd;
+ int ptt_keyed;
+ unsigned long tx_packets;
+ unsigned long tx_errors;
+ unsigned long rx_packets;
+ unsigned long rx_errors;
};
/* ---------------------------------------------------------------------- */
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..657eed6 100644
--- a/hdlcutil/sethdlc.c
+++ b/hdlcutil/sethdlc.c
@@ -47,19 +47,19 @@
/* ---------------------------------------------------------------------- */
-static unsigned char trace_stat = 0;
+static unsigned char trace_stat;
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,18 +215,18 @@ static void print_bits(int (*bitproc)(void))
int i;
char str[9];
char *cp;
-
- for(;;) {
+
+ for (;;) {
ret = bitproc();
if (ret < 0) {
if (errno == EAGAIN)
return;
fprintf(stderr, "%s: Error %s (%i), cannot ioctl\n",
- progname, strerror(errno), errno);
+ progname, strerror(errno), errno);
return;
}
strcpy(cp = str, "00000000");
- 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 <baycomif>] [-h] [-c <cal>]\n"
"[-p] [hw <hw>] [type <type>] [io <iobase>] [irq <irq>] [dma <dma>]\n"
" [options <opt>] [serio <serio>] [pario <pario>] [midiio <midiio>]\n"
"[-a] [txd <txdelay>] [txtail <txtail>] [slot <slottime>]\n"
" [ppersist <ppersistence>] [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 abc960f..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.
@@ -74,5 +74,3 @@ linux/drivers/net/soundmodem.c
.SH AUTHOR
smdiag was written by Thomas Sailer (t.sailer@alumni.ethz.ch).
-
-
diff --git a/hdlcutil/smdiag.c b/hdlcutil/smdiag.c
index e9b615d..16d34f0 100644
--- a/hdlcutil/smdiag.c
+++ b/hdlcutil/smdiag.c
@@ -51,7 +51,7 @@
/* ---------------------------------------------------------------------- */
static char *progname;
-static Display *display = NULL;
+static Display *display;
static Window window;
static Pixmap pixmap;
static unsigned long col_zeroline;
@@ -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();
@@ -86,23 +86,23 @@ static int x_error_handler(Display *disp, XErrorEvent *evt)
static int openwindow(char *disp, int constell, int samplesperbit)
{
- XSetWindowAttributes attr;
- XGCValues gr_values;
- XColor color, dummy;
- XSizeHints sizehints;
-
- if (!(display = XOpenDisplay(NULL)))
- return -1;
- XSetErrorHandler(x_error_handler);
- XAllocNamedColor(display, DefaultColormap(display, 0), "red",
- &color, &dummy);
+ XSetWindowAttributes attr;
+ XGCValues gr_values;
+ XColor color, dummy;
+ XSizeHints sizehints;
+
+ if (!(display = XOpenDisplay(NULL)))
+ return -1;
+ XSetErrorHandler(x_error_handler);
+ XAllocNamedColor(display, DefaultColormap(display, 0), "red",
+ &color, &dummy);
col_zeroline = color.pixel;
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),
+ attr.background_pixel = col_background;
+ 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");
@@ -113,28 +113,28 @@ static int openwindow(char *disp, int constell, int samplesperbit)
fprintf(stderr, "smdiag: unable to open offscreen pixmap\n");
exit(1);
}
- xmul = WIDTH / (2*(samplesperbit > 0 ? samplesperbit : 1));
- XSelectInput(display, window, KeyPressMask | StructureNotifyMask
+ xmul = WIDTH / (2*(samplesperbit > 0 ? samplesperbit : 1));
+ XSelectInput(display, window, KeyPressMask | StructureNotifyMask
| ExposureMask) ;
- XAllocNamedColor(display, DefaultColormap(display, 0), "red",
- &color, &dummy);
- gr_values.foreground = col_trace;
- gr_values.line_width = 1;
- gr_values.line_style = LineSolid;
- gr_context = XCreateGC(display, window, GCForeground | GCLineWidth |
- GCLineStyle, &gr_values);
- XStoreName(display, window, "diagnostics");
- /*
- * Do not allow the window to be resized
- */
- memset(&sizehints, 0, sizeof(sizehints));
- sizehints.min_width = sizehints.max_width = WIDTH;
- sizehints.min_height = sizehints.max_height = HEIGHT;
- sizehints.flags = PMinSize | PMaxSize;
- XSetWMNormalHints(display, window, &sizehints);
- XMapWindow(display, window);
- XSynchronize(display, 1);
- return 0;
+ XAllocNamedColor(display, DefaultColormap(display, 0), "red",
+ &color, &dummy);
+ gr_values.foreground = col_trace;
+ gr_values.line_width = 1;
+ gr_values.line_style = LineSolid;
+ gr_context = XCreateGC(display, window, GCForeground | GCLineWidth |
+ GCLineStyle, &gr_values);
+ XStoreName(display, window, "diagnostics");
+ /*
+ * Do not allow the window to be resized
+ */
+ memset(&sizehints, 0, sizeof(sizehints));
+ sizehints.min_width = sizehints.max_width = WIDTH;
+ sizehints.min_height = sizehints.max_height = HEIGHT;
+ sizehints.flags = PMinSize | PMaxSize;
+ XSetWMNormalHints(display, window, &sizehints);
+ XMapWindow(display, window);
+ XSynchronize(display, 1);
+ return 0;
}
#undef WIDTH
@@ -144,11 +144,11 @@ static int openwindow(char *disp, int constell, int samplesperbit)
static void closewindow(void)
{
- if (!display)
- return;
- XDestroyWindow(display, window);
- XCloseDisplay(display);
- display = NULL;
+ if (!display)
+ return;
+ XDestroyWindow(display, window);
+ XCloseDisplay(display);
+ display = NULL;
}
/* ---------------------------------------------------------------------- */
@@ -159,34 +159,34 @@ static void closewindow(void)
static void drawdata(short *data, int len, int replace, int xm)
{
int cnt;
- GC gc;
- XGCValues gcv;
- XWindowAttributes winattrs;
+ GC gc;
+ XGCValues gcv;
+ XWindowAttributes winattrs;
- if (!display || !pixmap)
- return;
- XGetWindowAttributes(display, window, &winattrs);
+ if (!display || !pixmap)
+ return;
+ XGetWindowAttributes(display, window, &winattrs);
gcv.line_width = 1;
- gcv.line_style = LineSolid;
- gc = XCreateGC(display, pixmap, GCLineWidth | GCLineStyle, &gcv);
- XSetState(display, gc, col_background, col_background, GXcopy,
+ gcv.line_style = LineSolid;
+ gc = XCreateGC(display, pixmap, GCLineWidth | GCLineStyle, &gcv);
+ 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);
+ XSetForeground(display, gc, col_trace);
for (cnt = 0; cnt < len-1; cnt++)
XDrawLine(display, pixmap, gc, XCOORD(cnt), YCOORD(data[cnt]),
XCOORD(cnt+1), YCOORD(data[cnt+1]));
- XSetForeground(display, gc, col_zeroline);
+ XSetForeground(display, gc, col_zeroline);
XDrawLine(display, pixmap, gc, 0, YCOORD(0), winattrs.width,
YCOORD(0));
XCopyArea(display, pixmap, window, gr_context, 0, 0, winattrs.width,
- winattrs.height, 0, 0);
- XFreeGC(display, gc);
+ winattrs.height, 0, 0);
+ XFreeGC(display, gc);
XSync(display, 0);
}
@@ -201,30 +201,30 @@ static void drawdata(short *data, int len, int replace, int xm)
static void drawconstell(short *data, int len)
{
int cnt;
- GC gc;
- XGCValues gcv;
- XWindowAttributes winattrs;
+ GC gc;
+ XGCValues gcv;
+ XWindowAttributes winattrs;
- if (!display || !pixmap)
- return;
- XGetWindowAttributes(display, window, &winattrs);
+ if (!display || !pixmap)
+ return;
+ XGetWindowAttributes(display, window, &winattrs);
gcv.line_width = 1;
- gcv.line_style = LineSolid;
- gc = XCreateGC(display, pixmap, GCLineWidth | GCLineStyle, &gcv);
- XSetState(display, gc, col_background, col_background, GXcopy,
+ gcv.line_style = LineSolid;
+ gc = XCreateGC(display, pixmap, GCLineWidth | GCLineStyle, &gcv);
+ 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);
+ 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);
+ XSetForeground(display, gc, col_zeroline);
XDrawLine(display, pixmap, gc, 0, YCOORD(0), winattrs.width, YCOORD(0));
XDrawLine(display, pixmap, gc, XCOORD(0), 0, XCOORD(0), winattrs.height);
XCopyArea(display, pixmap, window, gr_context, 0, 0, winattrs.width,
- winattrs.height, 0, 0);
- XFreeGC(display, gc);
+ winattrs.height, 0, 0);
+ XFreeGC(display, gc);
XSync(display, 0);
}
@@ -235,50 +235,50 @@ static void drawconstell(short *data, int len)
static void clearwindow(void)
{
- XWindowAttributes winattrs;
+ XWindowAttributes winattrs;
GC gc;
- XGCValues gcv;
+ XGCValues gcv;
- if (!display || !pixmap)
- return;
- XGetWindowAttributes(display, window, &winattrs);
+ if (!display || !pixmap)
+ return;
+ XGetWindowAttributes(display, window, &winattrs);
gcv.line_width = 1;
- gcv.line_style = LineSolid;
- gc = XCreateGC(display, pixmap, GCLineWidth | GCLineStyle, &gcv);
- XSetState(display, gc, col_background, col_background, GXcopy,
+ gcv.line_style = LineSolid;
+ gc = XCreateGC(display, pixmap, GCLineWidth | GCLineStyle, &gcv);
+ 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);
+ 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);
+ winattrs.height, 0, 0);
+ XFreeGC(display, gc);
}
/* ---------------------------------------------------------------------- */
static Bool predicate(Display *display, XEvent *event, char *arg)
{
- return True;
+ return True;
}
/* ---------------------------------------------------------------------- */
static char *getkey(void)
{
- XWindowAttributes winattrs;
- XEvent evt;
- static char kbuf[32];
- int i;
+ XWindowAttributes winattrs;
+ XEvent evt;
+ static char kbuf[32];
+ int i;
- if (!display)
- return NULL;
+ if (!display)
+ return NULL;
XSync(display, 0);
- while (XCheckIfEvent(display, &evt, predicate, NULL)) {
+ 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,14 +290,14 @@ 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:
break;
}
- }
- return NULL;
+ }
+ return NULL;
}
/* ---------------------------------------------------------------------- */
@@ -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..8efeac8 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)
+ data = get_mixer_reg(27);
+ 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" : "");
}
@@ -314,15 +314,15 @@ static void display_mixer_ct1745(void)
static int parse_ad_src(const char *cp)
{
- if (!strcasecmp(cp, "line"))
- return 0;
- if (!strcasecmp(cp, "aux1"))
- return 1;
- if (!strcasecmp(cp, "mic"))
- return 2;
- if (!strcasecmp(cp, "dac"))
- return 3;
- return -1;
+ if (!strcasecmp(cp, "line"))
+ return 0;
+ if (!strcasecmp(cp, "aux1"))
+ return 1;
+ if (!strcasecmp(cp, "mic"))
+ return 2;
+ if (!strcasecmp(cp, "dac"))
+ return 3;
+ return -1;
}
/* ---------------------------------------------------------------------- */
@@ -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 c3faf9a..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
@@ -76,7 +76,3 @@ linux/drivers/net/hdlcdrv.c,
.SH AUTHOR
soundmodem was written by Thomas Sailer, HB9JNX/AE4WA, (t.sailer@alumni.ethz.ch).
-
-
-
-
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 120afb4..1fcdc6a 100644
--- a/kiss/Makefile.am
+++ b/kiss/Makefile.am
@@ -5,16 +5,14 @@ sbin_PROGRAMS = kissattach kissnetd kissparms mkiss net2kiss
LDADD= $(AX25_LIB)
-man_MANS = kissattach.8 spattach.8 kissnetd.8 kissparms.8 mkiss.8 net2kiss.8
-
-EXTRA_DIST = $(man_MANS)
+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/
install-exec-hook:
(cd $(DESTDIR)$(sbindir) ; ln -sf kissattach spattach)
-
diff --git a/kiss/kissattach.c b/kiss/kissattach.c
index 6ed66a2..e30ed05 100644
--- a/kiss/kissattach.c
+++ b/kiss/kissattach.c
@@ -33,15 +33,15 @@
#endif
static char *callsign;
-static int speed = 0;
-static int mtu = 0;
+static int speed;
+static int mtu;
static int logging = FALSE;
-static char *progname = NULL;
-static char *kttyname = NULL;
-static char *portname = NULL;
-static char *inetaddr = NULL;
-static int allow_broadcast = 0;
-static int i_am_unix98_pty_master = 0; /* unix98 ptmx support */
+static char *progname;
+static char *kttyname;
+static char *portname;
+static char *inetaddr;
+static int allow_broadcast;
+static int i_am_unix98_pty_master; /* unix98 ptmx support */
static char *kiss_basename(char *s)
{
@@ -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",
- progname, CONF_AXPORTS_FILE);
+ 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,15 +206,15 @@ static int startiface(char *dev, struct hostent *hp)
perror("SIOCSIFFLAGS");
return FALSE;
}
-
+
close(fd);
-
+
return TRUE;
}
static void usage(void)
{
- fprintf(stderr, "usage: %s [-b] [-l] [-m mtu] [-v] tty port [inetaddr]\n", progname);
+ fprintf(stderr, "usage: %s [-b] [-l] [-m mtu] [-v] tty port [inetaddr]\n", progname);
}
int main(int argc, char *argv[])
@@ -224,7 +224,7 @@ int main(int argc, char *argv[])
char dev[64];
int v = 4;
char *namepts = NULL; /* name of the unix98 pts slave, which
- * the client has to use */
+ * the client has to use */
struct hostent *hp = NULL;
progname = kiss_basename(argv[0]);
@@ -234,32 +234,32 @@ int main(int argc, char *argv[])
while ((fd = getopt(argc, argv, "b6i:lm:v")) != -1) {
switch (fd) {
- case '6':
- disc = N_6PACK;
- break;
- case 'b':
- allow_broadcast = 1;
- break;
- case 'i':
- fprintf(stderr, "%s: -i flag depreciated, use new command line format instead.\n", progname);
- inetaddr = optarg;
- break;
- case 'l':
- logging = TRUE;
- break;
- case 'm':
- if ((mtu = atoi(optarg)) <= 0) {
- fprintf(stderr, "%s: invalid mtu size - %s\n", progname, optarg);
- return 1;
- }
- break;
- case 'v':
- printf("%s: %s\n", progname, VERSION);
- return 0;
- case ':':
- case '?':
- usage();
+ case '6':
+ disc = N_6PACK;
+ break;
+ case 'b':
+ allow_broadcast = 1;
+ break;
+ case 'i':
+ fprintf(stderr, "%s: -i flag depreciated, use new command line format instead.\n", progname);
+ inetaddr = optarg;
+ break;
+ case 'l':
+ logging = TRUE;
+ break;
+ case 'm':
+ if ((mtu = atoi(optarg)) <= 0) {
+ fprintf(stderr, "%s: invalid mtu size - %s\n", progname, optarg);
return 1;
+ }
+ break;
+ case 'v':
+ printf("%s: %s\n", progname, VERSION);
+ return 0;
+ case ':':
+ case '?':
+ usage();
+ return 1;
}
}
@@ -291,7 +291,7 @@ int main(int argc, char *argv[])
if (!readconfig(portname))
return 1;
- if (inetaddr && (hp = gethostbyname(inetaddr)) == NULL) {
+ if (inetaddr && (hp = gethostbyname(inetaddr)) == NULL) {
fprintf(stderr, "%s: invalid internet name/address - %s\n", progname, inetaddr);
return 1;
}
@@ -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..8c8fce9 100644
--- a/kiss/kissnetd.c
+++ b/kiss/kissnetd.c
@@ -8,7 +8,7 @@
*
* F1OAT 960804 - Frederic RIBLE
*/
-
+
#include <stdio.h>
#define __USE_XOPEN
#include <stdlib.h>
@@ -25,7 +25,7 @@
#include <limits.h>
static char *Version = "1.5";
-static int VerboseMode = 0;
+static int VerboseMode;
static int MaxFrameSize = 512;
#define REOPEN_TIMEOUT 30 /* try tio reopen every 10 s */
@@ -36,14 +36,14 @@ struct PortDescriptor {
unsigned char *FrameBuffer;
int BufferIndex;
time_t TimeLastOpen;
- char namepts[PATH_MAX]; /* name of the unix98 pts slaves, which
- * the client has to use */
+ char namepts[PATH_MAX]; /* name of the unix98 pts slaves, which
+ * the client has to use */
int is_active;
};
static struct PortDescriptor *PortList[FD_SETSIZE];
-static int NbPort = 0;
+static int NbPort;
static void Usage(void)
{
@@ -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,16 +144,16 @@ 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",
- PortList[PortNumber]->namepts);
+ 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);
perror(MyString);
}
return;
}
- syslog(LOG_WARNING, "kissnetd : Trying to poll port ptmx (slave %s).\n",
- PortList[PortNumber]->namepts);
+ syslog(LOG_WARNING, "kissnetd : Trying to poll port ptmx (slave %s).\n",
+ PortList[PortNumber]->namepts);
PortList[PortNumber]->is_active = 1;
}
}
@@ -161,14 +161,14 @@ static void ReopenPort(int PortNumber)
static void TickReopen(void)
{
int i;
- static int wrote_info = 0;
+ static int wrote_info;
time_t CurrentTime = time(NULL);
-
+
for (i=0; i<NbPort; i++) {
if (PortList[i]->Fd >= 0 && PortList[i]->is_active == 1) continue;
if ( (CurrentTime - PortList[i]->TimeLastOpen) > REOPEN_TIMEOUT ) ReopenPort(i);
}
-
+
if (!wrote_info) {
for (i=0; i<NbPort; i++) {
if (PortList[i]->namepts[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; i<NbPort; i++) {
int offset = 0;
if (i == InputPort) continue;
if (PortList[i]->Fd < 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; i<NbPort; i++) {
if (PortList[i]->Fd >= 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; i<NbPort && rc; i++) {
if (PortList[i]->Fd < 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 <port> [-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 <port> [-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..fc57f7b 100644
--- a/kiss/kissparms.c
+++ b/kiss/kissparms.c
@@ -10,7 +10,7 @@
#include <netinet/in.h>
#include <net/if.h>
-#ifdef __GLIBC__
+#ifdef __GLIBC__
#include <net/ethernet.h>
#else
#include <linux/if_ether.h>
@@ -58,96 +58,96 @@ int main(int argc, char *argv[])
while ((s = getopt(argc, argv, "c:e:f:h:l:p:r:s:t:X:vx")) != -1) {
switch (s) {
- case 'c':
- crcmode = atoi(optarg);
- break;
- case 'e':
- feclevel = atoi(optarg);
- if (feclevel < 0 || feclevel > 3) {
- fprintf(stderr, "kissparms: invalid FEC level value\n");
- return 1;
- }
- break;
+ case 'c':
+ crcmode = atoi(optarg);
+ break;
+ case 'e':
+ feclevel = atoi(optarg);
+ if (feclevel < 0 || feclevel > 3) {
+ fprintf(stderr, "kissparms: invalid FEC level value\n");
+ return 1;
+ }
+ break;
- case 'f':
- if (*optarg != 'y' && *optarg != 'n') {
- fprintf(stderr, "kissparms: invalid full duplex setting\n");
- return 1;
- }
- fulldup = *optarg == 'y';
- break;
+ case 'f':
+ if (*optarg != 'y' && *optarg != 'n') {
+ fprintf(stderr, "kissparms: invalid full duplex setting\n");
+ return 1;
+ }
+ fulldup = *optarg == 'y';
+ break;
- case 'l':
- txtail = atoi(optarg) / 10;
- if (txtail < 0 || txtail > 255) {
- fprintf(stderr, "kissparms: invalid txtail value\n");
- return 1;
- }
- break;
+ case 'l':
+ txtail = atoi(optarg) / 10;
+ if (txtail < 0 || txtail > 255) {
+ fprintf(stderr, "kissparms: invalid txtail value\n");
+ return 1;
+ }
+ break;
- case 'h':
- hardware = atoi(optarg);
- if (hardware < 0 || hardware > 255) {
- fprintf(stderr, "kissparms: invalid hardware value\n");
- return 1;
- }
- break;
+ case 'h':
+ hardware = atoi(optarg);
+ if (hardware < 0 || hardware > 255) {
+ fprintf(stderr, "kissparms: invalid hardware value\n");
+ return 1;
+ }
+ break;
- case 'p':
- port = optarg;
- if (ax25_config_get_addr(port) == NULL) {
- fprintf(stderr, "kissparms: invalid port name - %s\n", port);
- return 1;
- }
- break;
+ case 'p':
+ port = optarg;
+ if (ax25_config_get_addr(port) == NULL) {
+ fprintf(stderr, "kissparms: invalid port name - %s\n", port);
+ return 1;
+ }
+ break;
- case 'r':
- persist = atoi(optarg);
- if (persist < 0 || persist > 255) {
- fprintf(stderr, "kissparms: invalid persist value\n");
- return 1;
- }
- break;
+ case 'r':
+ persist = atoi(optarg);
+ if (persist < 0 || persist > 255) {
+ fprintf(stderr, "kissparms: invalid persist value\n");
+ return 1;
+ }
+ break;
- case 's':
- slottime = atoi(optarg) / 10;
- if (slottime < 0 || slottime > 255) {
- fprintf(stderr, "kissparms: invalid slottime value\n");
- return 1;
- }
- break;
+ case 's':
+ slottime = atoi(optarg) / 10;
+ if (slottime < 0 || slottime > 255) {
+ fprintf(stderr, "kissparms: invalid slottime value\n");
+ return 1;
+ }
+ break;
- case 't':
- txdelay = atoi(optarg) / 10;
- if (txdelay < 0 || txdelay > 255) {
- fprintf(stderr, "kissparms: invalid txdelay value\n");
- return 1;
- }
- break;
+ case 't':
+ txdelay = atoi(optarg) / 10;
+ if (txdelay < 0 || txdelay > 255) {
+ fprintf(stderr, "kissparms: invalid txdelay value\n");
+ return 1;
+ }
+ break;
- case 'v':
- printf("kissparms: %s\n", VERSION);
- return 0;
+ case 'v':
+ printf("kissparms: %s\n", VERSION);
+ return 0;
- case 'x':
- kissoff = 1;
- break;
+ case 'x':
+ kissoff = 1;
+ break;
- case 'X':
- do {
- buffer[buflen++] = atoi(optarg);
- while (*optarg && isalnum(*optarg & 0xff))
- optarg++;
- while (*optarg && isspace(*optarg & 0xff))
- optarg++;
- } while (*optarg);
- X = 1;
- break;
- case ':':
- case '?':
- fprintf(stderr, USAGE);
- return 1;
+ case 'X':
+ do {
+ buffer[buflen++] = atoi(optarg);
+ while (*optarg && isalnum(*optarg & 0xff))
+ optarg++;
+ while (*optarg && isspace(*optarg & 0xff))
+ optarg++;
+ } while (*optarg);
+ X = 1;
+ break;
+ case ':':
+ case '?':
+ fprintf(stderr, USAGE);
+ return 1;
}
}
@@ -250,8 +250,8 @@ rawsend:
}
}
}
-
+
close(s);
-
+
return 0;
}
diff --git a/kiss/mkiss.c b/kiss/mkiss.c
index 4ad4852..6973b4f 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
*/
@@ -78,9 +78,9 @@
static unsigned char ibuf[SIZE]; /* buffer for input operations */
static unsigned char obuf[SIZE]; /* buffer for kiss_tx() */
-static int crc_errors = 0;
-static int invalid_ports = 0;
-static int return_polls = 0;
+static int crc_errors;
+static int invalid_ports;
+static int return_polls ;
static char *usage_string = "usage: mkiss [-p interval] [-c] [-f] [-h] [-l] [-s speed] [-v] [-x <num_ptmx_devices>] ttyinterface pty ..\n";
@@ -89,7 +89,7 @@ static int dump_report = FALSE;
static int logging = FALSE;
static int crcflag = FALSE;
static int hwflag = FALSE;
-static int pollspeed = 0;
+static int pollspeed;
/* CRC-stuff */
typedef unsigned short int u16;
@@ -111,12 +111,12 @@ struct iface
unsigned long rxbytes; /* RX bytes count */
unsigned long txbytes; /* TX bytes count */
char namepts[PATH_MAX]; /* name of the unix98 pts slaves, which
- * the client has to use */
+ * the client has to use */
};
-static struct iface *tty = NULL;
-static struct iface *pty[16] = { NULL };
-static int numptys = 0;
+static struct iface *tty;
+static struct iface *pty[16];
+static int numptys;
static void init_crc(void)
{
@@ -143,7 +143,7 @@ static void init_crc(void)
static int poll(int fd, int ports)
{
char buffer[3];
- static int port = 0;
+ static int port;
buffer[0] = FEND;
buffer[1] = POLL | (port << 4);
@@ -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;
+{
+ int len = 1;
- if (c == FEND) {
+ if (c == FEND) {
*s++ = FESC;
*s++ = TFEND;
len++;
- } else {
+ } else {
*s++ = c;
if (c == FESC) {
*s++ = TFESC;
@@ -205,7 +205,7 @@ static int kiss_tx(int fd, int port, unsigned char *s, int len, int usecrc)
*/
*ptr++ = FEND;
- if (usecrc == FLEX_CRC) {
+ if (usecrc == FLEX_CRC) {
crc = 0xffff;
ptr += put_ubyte(ptr, &crc, CRCTYP, usecrc);
c = *s++;
@@ -214,12 +214,12 @@ 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.
*/
- for(i = 0; i < len - 1; i++)
+ for (i = 0; i < len - 1; i++)
ptr += put_ubyte(ptr, &crc, s[i], usecrc);
/*
@@ -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)
@@ -418,7 +418,6 @@ static void report(void)
pty[i]->rxpackets, pty[i]->rxbytes,
pty[i]->errors);
}
- return;
}
int main(int argc, char *argv[])
@@ -445,13 +444,13 @@ int main(int argc, char *argv[])
hwflag = TRUE;
break;
case 'l':
- logging = TRUE;
- break;
+ logging = TRUE;
+ break;
case 'p':
pollspeed = atoi(optarg);
pollinterval.tv_sec = pollspeed / 10;
pollinterval.tv_usec = (pollspeed % 10) * 100000L;
- break;
+ break;
case 's':
speed = atoi(optarg);
break;
@@ -482,7 +481,7 @@ int main(int argc, char *argv[])
return 1;
}
- numptys = argc - optind - 1;
+ numptys = argc - optind - 1;
if ((numptys + ptmxdevices) > 16) {
fprintf(stderr, "mkiss: max 16 pty interfaces allowed.\n");
return 1;
diff --git a/kiss/net2kiss.c b/kiss/net2kiss.c
index 716107d..1ec8524 100644
--- a/kiss/net2kiss.c
+++ b/kiss/net2kiss.c
@@ -65,14 +65,14 @@
static int fdif, fdpty;
static struct ifreq ifr;
static char *progname;
-static int verbose = 0;
-static int i_am_unix98_pty_master = 0; /* unix98 ptmx support */
-static char *namepts = NULL; /* name of the unix98 pts slave, which
- * the client has to use */
+static int verbose;
+static int i_am_unix98_pty_master; /* unix98 ptmx support */
+static char *namepts; /* name of the unix98 pts slave, which
+ * the client has to use */
/* --------------------------------------------------------------------- */
-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,29 +221,29 @@ 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];
- const char *cp1, *cp2;
+ const char *cp1, *cp2;
int master, slave;
struct group *gr = getgrnam("tty");
@@ -254,10 +254,10 @@ static int openpty(int *amaster, int *aslave, char *name,
line[9] = *cp2;
if ((master = open(line, O_RDWR, 0)) == -1) {
if (errno == ENOENT)
- return (-1); /* out of ptys */
+ 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;
}
@@ -284,7 +284,7 @@ static int openpty(int *amaster, int *aslave, char *name,
}
}
errno = ENOENT; /* out of ptys */
- return (-1);
+ return -1;
}
/* ---------------------------------------------------------------------- */
@@ -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;
@@ -392,7 +392,6 @@ static void kiss_packet(int fdif, char *addr,
return;
}
die("sendto");
- return;
}
/* --------------------------------------------------------------------- */
@@ -404,25 +403,25 @@ static int doio(int fdif, int fdpty, char *ifaddr)
unsigned char pktbuf[2048];
unsigned char *pktptr = pktbuf;
unsigned char pktstate = KISS_HUNT;
- unsigned char obuf[16384];
+ unsigned char obuf[16384];
unsigned int ob_wp = 0, ob_rp = 0, ob_wpx;
int i;
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); } \
+ { ADD_CHAR(KISS_FESC); ADD_CHAR(KISS_TFEND); } \
else if (((c) & 0xff) == KISS_FESC) \
- { ADD_CHAR(KISS_FESC); ADD_CHAR(KISS_TFESC); } \
+ { ADD_CHAR(KISS_FESC); ADD_CHAR(KISS_TFESC); } \
else { ADD_CHAR(c); }
-
+
for (;;) {
FD_ZERO(&rmask);
FD_ZERO(&wmask);
@@ -436,9 +435,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 +467,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 +498,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 +601,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 +611,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");
@@ -639,7 +638,7 @@ int main(int argc, char *argv[])
}
/* Users await the slave pty to be referenced in the 2nd line */
printf("Awaiting client connects on\n%s\n", namepts);
- if (!verbose){
+ if (!verbose) {
fflush(stdout);
fflush(stderr);
close(0);
@@ -674,7 +673,7 @@ int main(int argc, char *argv[])
} else {
/*
* try to reopen master
- */
+ */
if (verbose)
printf("reopening master tty: %s\n", master_name);
close(fdpty);
diff --git a/netrom/Makefile.am b/netrom/Makefile.am
index 0678996..97e1741 100644
--- a/netrom/Makefile.am
+++ b/netrom/Makefile.am
@@ -1,5 +1,5 @@
-etcfiles = nrbroadcast
+etcfiles = nrbroadcast
installconf:
$(mkinstalldirs) $(DESTDIR)$(AX25_SYSCONFDIR)
@@ -13,21 +13,20 @@ sbin_PROGRAMS = netromd nodesave nrattach nrparms nrsdrv
LDADD = $(AX25_LIB)
-man_MANS = netrom.4 nrbroadcast.5 netromd.8 nodesave.8 \
+dist_man_MANS = netrom.4 nrbroadcast.5 netromd.8 nodesave.8 \
nrattach.8 nrparms.8 nrsdrv.8
-EXTRA_DIST = $(man_MANS) $(etcfiles)
+EXTRA_DIST = $(etcfiles)
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..fbad930 100644
--- a/netrom/netromd.c
+++ b/netrom/netromd.c
@@ -17,7 +17,7 @@
#include <net/if.h>
-#ifdef __GLIBC__
+#ifdef __GLIBC__
#include <net/ethernet.h>
#else
#include <linux/if_ether.h>
@@ -40,7 +40,7 @@ struct port_struct port_list[20];
int port_count = FALSE;
int compliant = FALSE;
int logging = FALSE;
-int debug = 0;
+int debug;
ax25_address my_call;
ax25_address node_call;
@@ -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)
@@ -138,46 +138,46 @@ int main(int argc, char **argv)
while ((i = getopt(argc, argv, "cdilp:q:t:v")) != -1) {
switch (i) {
- case 'c':
- compliant = TRUE;
- break;
- case 'd':
- debug++;
- break;
- case 'i':
- timelast = 0;
- break;
- case 'l':
- logging = TRUE;
- break;
- case 'p':
- pause = atoi(optarg);
- if (pause < 1 || pause > 120) {
- fprintf(stderr, "netromd: invalid pause value\n");
- return 1;
- }
- break;
- case 'q':
- localval = atoi(optarg);
- if (localval < 10 || localval > 255) {
- fprintf(stderr, "netromd: invalid local quality\n");
- return 1;
- }
- break;
- case 't':
- interval = atoi(optarg) * 60;
- if (interval < 60 || interval > 7200) {
- fprintf(stderr, "netromd: invalid time interval\n");
- return 1;
- }
- break;
- case 'v':
- printf("netromd: %s\n", VERSION);
- return 0;
- case '?':
- case ':':
- fprintf(stderr, "usage: netromd [-d] [-i] [-l] [-q quality] [-t interval] [-v]\n");
+ case 'c':
+ compliant = TRUE;
+ break;
+ case 'd':
+ debug++;
+ break;
+ case 'i':
+ timelast = 0;
+ break;
+ case 'l':
+ logging = TRUE;
+ break;
+ case 'p':
+ pause = atoi(optarg);
+ if (pause < 1 || pause > 120) {
+ fprintf(stderr, "netromd: invalid pause value\n");
return 1;
+ }
+ break;
+ case 'q':
+ localval = atoi(optarg);
+ if (localval < 10 || localval > 255) {
+ fprintf(stderr, "netromd: invalid local quality\n");
+ return 1;
+ }
+ break;
+ case 't':
+ interval = atoi(optarg) * 60;
+ if (interval < 60 || interval > 7200) {
+ fprintf(stderr, "netromd: invalid time interval\n");
+ return 1;
+ }
+ break;
+ case 'v':
+ printf("netromd: %s\n", VERSION);
+ return 0;
+ case '?':
+ case ':':
+ fprintf(stderr, "usage: netromd [-d] [-i] [-l] [-q quality] [-t interval] [-v]\n");
+ return 1;
}
}
@@ -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 9c1f17e..605aa2d 100644
--- a/netrom/netromr.c
+++ b/netrom/netromr.c
@@ -14,7 +14,7 @@
#include <netinet/in.h>
#include <net/if.h>
-#ifdef __GLIBC__
+#ifdef __GLIBC__
#include <net/ethernet.h>
#else
#include <linux/if_ether.h>
@@ -48,7 +48,7 @@ static int validcallsign(ax25_address *a)
}
return FALSE;
- }
+ }
return TRUE;
}
@@ -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..2a5bc3c 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);
}
@@ -206,14 +206,14 @@ void transmit_nodes(int localval, int pause)
int i;
switch (fork()) {
- case 0:
- break;
- case -1:
- if (logging)
- syslog(LOG_ERR, "netromt: fork: %m\n");
- return;
- default:
- return;
+ case 0:
+ break;
+ case -1:
+ if (logging)
+ syslog(LOG_ERR, "netromt: fork: %m\n");
+ return;
+ default:
+ return;
}
dlen = ax25_aton("NODES", &dest);
diff --git a/netrom/nodesave.c b/netrom/nodesave.c
index 1258c36..ce6c106 100644
--- a/netrom/nodesave.c
+++ b/netrom/nodesave.c
@@ -40,17 +40,17 @@ int main(int argc, char **argv)
while ((s = getopt(argc, argv, "p:v")) != -1) {
switch (s) {
- case 'p':
- sprintf(buf, "%s/nrparms", optarg);
- Nrparms = strdup(buf);
- break;
- case 'v':
- printf("nodesave: %s\n", VERSION);
- return 0;
- case ':':
- case '?':
- fputs(Usage, stderr);
- return 1;
+ case 'p':
+ sprintf(buf, "%s/nrparms", optarg);
+ Nrparms = strdup(buf);
+ break;
+ case 'v':
+ printf("nodesave: %s\n", VERSION);
+ return 0;
+ case ':':
+ case '?':
+ fputs(Usage, stderr);
+ return 1;
}
}
diff --git a/netrom/nrattach.c b/netrom/nrattach.c
index f1ca298..804e4b8 100644
--- a/netrom/nrattach.c
+++ b/netrom/nrattach.c
@@ -28,14 +28,14 @@
#include "../pathnames.h"
char *callsign;
-int mtu = 0;
+int mtu;
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;
@@ -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, "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;
@@ -83,14 +83,14 @@ int readconfig(char *port)
}
fclose(fp);
-
+
return TRUE;
}
-
+
fclose(fp);
fprintf(stderr, "nrattach: cannot find port %s in nrports\n", port);
-
+
return FALSE;
}
@@ -99,7 +99,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;
@@ -108,7 +108,7 @@ int getfreedev(char *dev)
for (i = 0; i < INT_MAX; i++) {
sprintf(dev, "nr%d", i);
strcpy(ifr.ifr_name, dev);
-
+
if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) {
perror("nrattach: SIOCGIFFLAGS");
return FALSE;
@@ -130,17 +130,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];
@@ -160,7 +160,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;
@@ -186,12 +186,12 @@ int startiface(char *dev, struct hostent *hp)
perror("nrattach: SIOCSIFFLAGS");
return FALSE;
}
-
+
close(fd);
-
+
return TRUE;
}
-
+
int main(int argc, char *argv[])
{
@@ -201,28 +201,28 @@ int main(int argc, char *argv[])
while ((fd = getopt(argc, argv, "i:m:v")) != -1) {
switch (fd) {
- case 'i':
- if ((hp = gethostbyname(optarg)) == NULL) {
- fprintf(stderr, "nrattach: invalid internet name/address - %s\n", optarg);
- return 1;
- }
- break;
- case 'm':
- if ((mtu = atoi(optarg)) <= 0) {
- fprintf(stderr, "nrattach: invalid mtu size - %s\n", optarg);
- return 1;
- }
- break;
- case 'v':
- printf("nrattach: %s\n", VERSION);
- return 0;
- case ':':
- case '?':
- fprintf(stderr, "usage: nrattach [-i inetaddr] [-m mtu] [-v] port\n");
+ case 'i':
+ if ((hp = gethostbyname(optarg)) == NULL) {
+ fprintf(stderr, "nrattach: invalid internet name/address - %s\n", optarg);
+ return 1;
+ }
+ break;
+ case 'm':
+ if ((mtu = atoi(optarg)) <= 0) {
+ fprintf(stderr, "nrattach: invalid mtu size - %s\n", optarg);
return 1;
+ }
+ break;
+ case 'v':
+ printf("nrattach: %s\n", VERSION);
+ return 0;
+ case ':':
+ case '?':
+ fprintf(stderr, "usage: nrattach [-i inetaddr] [-m mtu] [-v] port\n");
+ return 1;
}
}
-
+
if ((argc - optind) != 1) {
fprintf(stderr, "usage: nrattach [-i inetaddr] [-m mtu] [-v] port\n");
return 1;
@@ -235,11 +235,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..d5979d2 100644
--- a/netrom/nrsdrv.c
+++ b/netrom/nrsdrv.c
@@ -39,10 +39,10 @@ static char *kissdev, *nrsdev;
#define NRS_CKSUM 3
static int nrs_state = NRS_WAIT;
-static unsigned char nrs_cksum = 0;
+static unsigned char nrs_cksum;
static unsigned char nrs_rxbuffer[512];
-static int nrs_rxcount = 0;
+static int nrs_rxcount;
#define FEND 0300
#define FESC 0333
@@ -56,7 +56,7 @@ static int nrs_rxcount = 0;
static int kiss_state = KISS_WAIT;
static unsigned char kiss_rxbuffer[512];
-static int kiss_rxcount = 0;
+static int kiss_rxcount;
static void terminate(int sig)
{
@@ -81,16 +81,16 @@ static void key_rts(int fd)
/* Wait for CTS to be low */
while (1) {
/* Get CTS status */
- if (ioctl(fd, TIOCMGET, &status) < 0) {
+ if (ioctl(fd, TIOCMGET, &status) < 0) {
syslog(LOG_INFO|LOG_ERR, "TIOCMGET failed: flowcontrol disabled (%m)\n");
flowcontrol = 0;
- return;
- }
+ return;
+ }
if (status & TIOCM_CTS) {
if (debugging) {
fprintf(stderr,"CTS high: waiting\n");
}
- ioctl(fd, TIOCMIWAIT, &status);
+ ioctl(fd, TIOCMIWAIT, &status);
} else {
break;
}
@@ -100,10 +100,10 @@ static void key_rts(int fd)
fprintf(stderr,"CTS low: keying RTS\n");
}
status |= TIOCM_RTS | TIOCM_DTR;
- if (ioctl(fd, TIOCMSET, &status) < 0) {
+ if (ioctl(fd, TIOCMSET, &status) < 0) {
syslog(LOG_INFO|LOG_ERR, "TIOCMGET failed: flowcontrol disabled (%m)\n");
flowcontrol = 0;
- }
+ }
}
static void unkey_rts(int fd)
@@ -116,13 +116,13 @@ static void unkey_rts(int fd)
if (debugging) {
fprintf(stderr,"Transmission finished: unkeying RTS\n");
}
- ioctl(fd, TIOCMGET, &status);
+ ioctl(fd, TIOCMGET, &status);
status &= ~TIOCM_RTS;
- status |= TIOCM_DTR;
- if (ioctl(fd, TIOCMSET, &status) < 0) {
+ status |= TIOCM_DTR;
+ if (ioctl(fd, TIOCMSET, &status) < 0) {
syslog(LOG_INFO|LOG_ERR, "TIOCMGET failed: flowcontrol disabled (%m)\n");
flowcontrol = 0;
- }
+ }
}
static void nrs_esc(unsigned char *s, int len)
@@ -136,16 +136,16 @@ static void nrs_esc(unsigned char *s, int len)
while (len-- > 0) {
switch (c = *s++) {
- case STX:
- case ETX:
- case DLE:
- *ptr++ = DLE;
- /* Fall through */
- default:
- *ptr++ = c;
- break;
+ case STX:
+ case ETX:
+ case DLE:
+ *ptr++ = DLE;
+ /* Fall through */
+ default:
+ *ptr++ = c;
+ break;
}
-
+
csum += c;
}
@@ -170,17 +170,17 @@ static void kiss_esc(unsigned char *s, int len)
while (len-- > 0) {
switch (c = *s++) {
- case FESC:
- *ptr++ = FESC;
- *ptr++ = FESCESC;
- break;
- case FEND:
- *ptr++ = FESC;
- *ptr++ = FESCEND;
- break;
- default:
- *ptr++ = c;
- break;
+ case FESC:
+ *ptr++ = FESC;
+ *ptr++ = FESCESC;
+ break;
+ case FEND:
+ *ptr++ = FESC;
+ *ptr++ = FESCEND;
+ break;
+ default:
+ *ptr++ = c;
+ break;
}
}
@@ -192,53 +192,53 @@ 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:
- if (buffer[i] == STX) {
- nrs_state = NRS_DATA;
- nrs_rxcount = 0;
- nrs_cksum = 0;
- }
- break;
+ case NRS_WAIT:
+ if (buffer[i] == STX) {
+ nrs_state = NRS_DATA;
+ nrs_rxcount = 0;
+ nrs_cksum = 0;
+ }
+ break;
- case NRS_DATA:
- switch (buffer[i]) {
- case STX: /* !! */
- nrs_rxcount = 0;
- nrs_cksum = 0;
- break;
- case DLE:
- nrs_state = NRS_ESCAPE;
- break;
- case ETX:
- nrs_state = NRS_CKSUM;
- break;
- default:
- if (nrs_rxcount < 512) {
- nrs_cksum += buffer[i];
- nrs_rxbuffer[nrs_rxcount++] = buffer[i];
- }
- break;
- }
+ case NRS_DATA:
+ switch (buffer[i]) {
+ case STX: /* !! */
+ nrs_rxcount = 0;
+ nrs_cksum = 0;
break;
-
- case NRS_ESCAPE:
- nrs_state = NRS_DATA;
+ case DLE:
+ nrs_state = NRS_ESCAPE;
+ break;
+ case ETX:
+ nrs_state = NRS_CKSUM;
+ break;
+ default:
if (nrs_rxcount < 512) {
nrs_cksum += buffer[i];
nrs_rxbuffer[nrs_rxcount++] = buffer[i];
}
break;
+ }
+ break;
- case NRS_CKSUM:
- if (buffer[i] == nrs_cksum)
- kiss_esc(nrs_rxbuffer, nrs_rxcount);
- nrs_state = NRS_WAIT;
- nrs_cksum = 0;
- nrs_rxcount = 0;
- break;
+ case NRS_ESCAPE:
+ nrs_state = NRS_DATA;
+ if (nrs_rxcount < 512) {
+ nrs_cksum += buffer[i];
+ nrs_rxbuffer[nrs_rxcount++] = buffer[i];
+ }
+ break;
+
+ case NRS_CKSUM:
+ if (buffer[i] == nrs_cksum)
+ kiss_esc(nrs_rxbuffer, nrs_rxcount);
+ nrs_state = NRS_WAIT;
+ nrs_cksum = 0;
+ nrs_rxcount = 0;
+ break;
}
}
}
@@ -246,57 +246,57 @@ 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:
- if (buffer[i] == FEND) {
- kiss_state = KISS_CTRL;
- kiss_rxcount = 0;
- }
- break;
+ case KISS_WAIT:
+ if (buffer[i] == FEND) {
+ kiss_state = KISS_CTRL;
+ kiss_rxcount = 0;
+ }
+ break;
- case KISS_CTRL:
- if ((buffer[i] & 0x0F) == 0x00) {
- kiss_state = KISS_DATA;
- kiss_rxcount = 0;
- } else {
- kiss_state = KISS_WAIT;
- kiss_rxcount = 0;
- }
- break;
+ case KISS_CTRL:
+ if ((buffer[i] & 0x0F) == 0x00) {
+ kiss_state = KISS_DATA;
+ kiss_rxcount = 0;
+ } else {
+ kiss_state = KISS_WAIT;
+ kiss_rxcount = 0;
+ }
+ break;
- case KISS_DATA:
- switch (buffer[i]) {
- case FEND:
- if (kiss_rxcount > 2)
- nrs_esc(kiss_rxbuffer, kiss_rxcount);
- kiss_state = KISS_WAIT;
- kiss_rxcount = 0;
- break;
- case FESC:
- kiss_state = KISS_ESCAPE;
- break;
- default:
- if (kiss_rxcount < 512)
- kiss_rxbuffer[kiss_rxcount++] = buffer[i];
- break;
- }
+ case KISS_DATA:
+ switch (buffer[i]) {
+ case FEND:
+ if (kiss_rxcount > 2)
+ nrs_esc(kiss_rxbuffer, kiss_rxcount);
+ kiss_state = KISS_WAIT;
+ kiss_rxcount = 0;
+ break;
+ case FESC:
+ kiss_state = KISS_ESCAPE;
+ break;
+ default:
+ if (kiss_rxcount < 512)
+ kiss_rxbuffer[kiss_rxcount++] = buffer[i];
break;
+ }
+ break;
- case KISS_ESCAPE:
- kiss_state = KISS_DATA;
- switch (buffer[i]) {
- case FESCESC:
- if (kiss_rxcount < 512)
- kiss_rxbuffer[kiss_rxcount++] = FESC;
- break;
- case FESCEND:
- if (kiss_rxcount < 512)
- kiss_rxbuffer[kiss_rxcount++] = FEND;
- break;
- }
+ case KISS_ESCAPE:
+ kiss_state = KISS_DATA;
+ switch (buffer[i]) {
+ case FESCESC:
+ if (kiss_rxcount < 512)
+ kiss_rxbuffer[kiss_rxcount++] = FESC;
break;
+ case FESCEND:
+ if (kiss_rxcount < 512)
+ kiss_rxbuffer[kiss_rxcount++] = FEND;
+ break;
+ }
+ break;
}
}
}
@@ -310,33 +310,33 @@ int main(int argc, char *argv[])
while ((c = getopt(argc, argv, "dfls:v")) != -1) {
switch (c) {
- case 'd':
- debugging = TRUE;
- break;
- case 'f':
- flowcontrol = TRUE;
- break;
- case 'l':
- logging = TRUE;
- break;
- case 's':
- if ((speed = atoi(optarg)) <= 0) {
- fprintf(stderr, "nrsdrv: invalid speed %s\n", optarg);
- return 1;
- }
- break;
- case 'v':
- printf("kissattach: %s\n", VERSION);
- return 0;
- case ':':
- case '?':
- fprintf(stderr, "usage: nrsdrv [-f] [-l] [-s speed] [-v] kisstty nrstty\n");
+ case 'd':
+ debugging = TRUE;
+ break;
+ case 'f':
+ flowcontrol = TRUE;
+ break;
+ case 'l':
+ logging = TRUE;
+ break;
+ case 's':
+ if ((speed = atoi(optarg)) <= 0) {
+ fprintf(stderr, "nrsdrv: invalid speed %s\n", optarg);
return 1;
+ }
+ break;
+ case 'v':
+ printf("kissattach: %s\n", VERSION);
+ return 0;
+ case ':':
+ case '?':
+ fprintf(stderr, "usage: nrsdrv [-f] [-l] [-s speed] [-v] kisstty nrstty\n");
+ return 1;
}
}
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/pathnames.h b/pathnames.h
index f5e871c..3584ae8 100644
--- a/pathnames.h
+++ b/pathnames.h
@@ -24,5 +24,3 @@
#define PROC_AX25_CALLS_FILE "/proc/net/ax25_calls"
#define PROC_NR_NEIGH_FILE "/proc/net/nr_neigh"
#define PROC_NR_NODES_FILE "/proc/net/nr_nodes"
-
-
diff --git a/rose/Makefile.am b/rose/Makefile.am
index 5596113..2a2e95b 100644
--- a/rose/Makefile.am
+++ b/rose/Makefile.am
@@ -1,19 +1,19 @@
-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
-man_MANS = rose.4 rsattach.8 rsparms.8 rsdwnlnk.8 rsuplnk.8
+dist_man_MANS = rose.4 rsattach.8 rsparms.8 rsdwnlnk.8 rsuplnk.8
-EXTRA_DIST = $(man_MANS) $(sbin_SCRIPTS)
+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 079d793..df042aa 100644
--- a/rose/rsattach.c
+++ b/rose/rsattach.c
@@ -36,7 +36,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;
@@ -44,7 +44,7 @@ int readconfig(char *port)
while (fgets(buffer, 90, fp) != NULL) {
n++;
-
+
if ((s = strchr(buffer, '\n')) != NULL)
*s = '\0';
@@ -55,10 +55,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;
@@ -67,14 +67,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;
}
@@ -83,7 +83,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;
@@ -92,7 +92,7 @@ int getfreedev(char *dev)
for (i = 0; i < INT_MAX; i++) {
sprintf(dev, "rose%d", i);
strcpy(ifr.ifr_name, dev);
-
+
if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) {
perror("rsattach: SIOCGIFFLAGS");
return FALSE;
@@ -114,17 +114,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];
@@ -144,7 +144,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;
@@ -170,12 +170,12 @@ int startiface(char *dev, struct hostent *hp)
perror("rsattach: SIOCSIFFLAGS");
return FALSE;
}
-
+
close(fd);
-
+
return TRUE;
}
-
+
int main(int argc, char *argv[])
{
@@ -185,22 +185,22 @@ int main(int argc, char *argv[])
while ((fd = getopt(argc, argv, "i:m:v")) != -1) {
switch (fd) {
- case 'i':
- if ((hp = gethostbyname(optarg)) == NULL) {
- fprintf(stderr, "rsattach: invalid internet name/address - %s\n", optarg);
- return 1;
- }
- break;
- case 'v':
- printf("rsattach: %s\n", VERSION);
- return 0;
- case ':':
- case '?':
- fprintf(stderr, "usage: rsattach [-i inetaddr] [-v] port\n");
+ case 'i':
+ if ((hp = gethostbyname(optarg)) == NULL) {
+ fprintf(stderr, "rsattach: invalid internet name/address - %s\n", optarg);
return 1;
+ }
+ break;
+ case 'v':
+ printf("rsattach: %s\n", VERSION);
+ return 0;
+ case ':':
+ case '?':
+ fprintf(stderr, "usage: rsattach [-i inetaddr] [-v] port\n");
+ return 1;
}
}
-
+
if ((argc - optind) != 1) {
fprintf(stderr, "usage: rsattach [-i inetaddr] [-v] port\n");
return 1;
@@ -213,11 +213,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..dd1cb96 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.
@@ -198,26 +198,26 @@ int main(int argc, char **argv)
*/
if (connect(s, (struct sockaddr *)&axconnect, addrlen) != 0) {
switch (errno) {
- case ECONNREFUSED:
- strcpy(buffer, "*** Connection refused\r");
- break;
- case ENETUNREACH:
- strcpy(buffer, "*** No known route\r");
- break;
- case EINTR:
- strcpy(buffer, "*** Connection timed out\r");
- break;
- default:
- sprintf(buffer, "ERROR: cannot connect to AX.25 callsign, %s\r", strerror(errno));
- break;
+ case ECONNREFUSED:
+ strcpy(buffer, "*** Connection refused\r");
+ break;
+ case ENETUNREACH:
+ strcpy(buffer, "*** No known route\r");
+ break;
+ case EINTR:
+ strcpy(buffer, "*** Connection timed out\r");
+ break;
+ default:
+ sprintf(buffer, "ERROR: cannot connect to AX.25 callsign, %s\r", strerror(errno));
+ break;
}
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..506395f 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) {
[ <label> ... ] # header lines
[ <label> ] <num> [ <num> ... ] # table rows
[ repeats of above line ]
-
+
Any lines with fewer <num>s than <label>s get trailing <num>s set to zero.
The return value is a NULL terminated unsigned** which is the table of
numbers without labels. Convenient enumeration constants for the major and
@@ -96,35 +96,35 @@ int loadavg(double *av1, double *av5, double *av15) {
#define MAX_COL 7
unsigned** meminfo(void) {
- static unsigned *row[MAX_ROW + 1]; /* row pointers */
- static unsigned num[MAX_ROW * MAX_COL]; /* number storage */
- char *p;
- int i, j, k, l;
-
- FILE_TO_BUF(MEMINFO_FILE)
- if (!row[0]) /* init ptrs 1st time through */
+ static unsigned *row[MAX_ROW + 1]; /* row pointers */
+ static unsigned num[MAX_ROW * MAX_COL]; /* number storage */
+ char *p;
+ int i, j, k, l;
+
+ FILE_TO_BUF(MEMINFO_FILE)
+ if (!row[0]) /* init ptrs 1st time through */
for (i=0; i < MAX_ROW; i++) /* std column major order: */
- row[i] = num + MAX_COL*i; /* A[i][j] = A + COLS*i + j */
- p = buf;
- for (i=0; i < MAX_ROW; i++) /* zero unassigned fields */
- for (j=0; j < MAX_COL; j++)
- row[i][j] = 0;
- for (i=0; i < MAX_ROW && *p; i++) { /* loop over rows */
- while(*p && !isdigit(*p)) p++; /* skip chars until a digit */
- for (j=0; j < MAX_COL && *p; j++) { /* scanf column-by-column */
- l = sscanf(p, "%u%n", row[i] + j, &k);
- p += k; /* step over used buffer */
- if (*p == '\n' || l < 1) /* end of line/buffer */
- break;
- }
- }
+ row[i] = num + MAX_COL*i; /* A[i][j] = A + COLS*i + j */
+ p = buf;
+ for (i=0; i < MAX_ROW; i++) /* zero unassigned fields */
+ for (j=0; j < MAX_COL; j++)
+ row[i][j] = 0;
+ for (i=0; i < MAX_ROW && *p; i++) { /* loop over rows */
+ while (*p && !isdigit(*p)) p++; /* skip chars until a digit */
+ for (j=0; j < MAX_COL && *p; j++) { /* scanf column-by-column */
+ l = sscanf(p, "%u%n", row[i] + j, &k);
+ p += k; /* step over used buffer */
+ if (*p == '\n' || l < 1) /* end of line/buffer */
+ break;
+ }
+ }
/* row[i+1] = NULL; terminate the row list, currently unnecessary */
- return row; /* NULL return ==> error */
+ return row; /* NULL return ==> error */
}
/*
- * by Heikki Hannikainen <oh7lzb@sral.fi>
+ * by Heikki Hannikainen <oh7lzb@sral.fi>
* The following was mostly learnt from the procps package and the
* gnu sh-utils (mainly uname).
*/
@@ -163,7 +163,7 @@ int main(int argc, char **argv)
upminutes = upminutes % 60;
fprintf(stdout, "Uptime: ");
- if (updays)
+ if (updays)
fprintf(stdout, "%d day%s, ", updays, (updays != 1) ? "s" : "");
if (uphours)
@@ -171,7 +171,7 @@ int main(int argc, char **argv)
fprintf(stdout, "%d minute%s\r", upminutes, (upminutes != 1) ? "s" : "");
loadavg(&av[0], &av[1], &av[2]);
- fprintf(stdout, "Load average: %.2f, %.2f, %.2f\r", av[0], av[1], av[2]);
+ fprintf(stdout, "Load average: %.2f, %.2f, %.2f\r", av[0], av[1], av[2]);
if (!(mem = meminfo()) || mem[meminfo_main][meminfo_total] == 0) {
/* cannot normalize mem usage */
@@ -180,10 +180,10 @@ int main(int argc, char **argv)
fprintf(stdout, "Memory: %5d KB available, %5d KB used, %5d KB free\r",
mem[meminfo_main][meminfo_total] >> 10,
(mem[meminfo_main][meminfo_used] -
- mem[meminfo_main][meminfo_buffers] -
+ mem[meminfo_main][meminfo_buffers] -
mem[meminfo_total][meminfo_cached]) >> 10,
(mem[meminfo_main][meminfo_free] +
- mem[meminfo_main][meminfo_buffers] +
+ mem[meminfo_main][meminfo_buffers] +
mem[meminfo_total][meminfo_cached]) >> 10);
fprintf(stdout, "Swap: %5d KB available, %5d KB used, %5d KB free\r",
diff --git a/rose/rsparms.c b/rose/rsparms.c
index 4de807e..e9266aa 100644
--- a/rose/rsparms.c
+++ b/rose/rsparms.c
@@ -89,7 +89,7 @@ void nodes(int s, int argc, char *argv[])
exit(1);
}
- while(fgets(buff,80,fn)) {
+ while (fgets(buff,80,fn)) {
args=sscanf(buff,"%10s %4s %*s %9s %9s %9s",address, rmask, neigh1, neigh2, neigh3);
if (strcmp(address,"address")==0)
continue;
@@ -197,7 +197,7 @@ int main(int argc, char *argv[])
{
ax25_address rose_call;
int s = 0;
-
+
if (argc == 1) {
fprintf(stderr, "usage: rsparms -call|-nodes|-version ...\n");
return 1;
@@ -227,7 +227,7 @@ int main(int argc, char *argv[])
perror("rsparms: socket");
return 1;
}
-
+
if (ioctl(s, SIOCRSL2CALL, &rose_call) == -1) {
perror("rsparms: ioctl");
close(s);
@@ -251,8 +251,8 @@ int main(int argc, char *argv[])
}
fprintf(stderr, "usage: rsparms -call|-nodes|-version ...\n");
-
+
close(s);
-
+
return 1;
}
diff --git a/rose/rsuplnk.c b/rose/rsuplnk.c
index eadb0ed..fdc88ee 100644
--- a/rose/rsuplnk.c
+++ b/rose/rsuplnk.c
@@ -102,21 +102,21 @@ int main(int argc, char **argv)
for (n = 0; n < ax25peer.fsa_ax25.sax25_ndigis; n++) {
addr = ax25_ntoa(&ax25peer.fsa_digipeater[n]);
-
+
if (strspn(addr, "0123456789-") == strlen(addr)) {
if ((p = strchr(addr, '-')) != NULL)
*p = '\0';
switch (strlen(addr)) {
- case 4:
- memcpy(rose_address + 0, addr, 4);
- dnicindex = n;
- break;
- case 6:
- memcpy(rose_address + 4, addr, 6);
- addrindex = n;
- break;
- default:
- break;
+ case 4:
+ memcpy(rose_address + 0, addr, 4);
+ dnicindex = n;
+ break;
+ case 6:
+ memcpy(rose_address + 4, addr, 6);
+ addrindex = n;
+ break;
+ default:
+ break;
}
}
}
@@ -208,18 +208,18 @@ int main(int argc, char **argv)
*/
if (connect(s, (struct sockaddr *)&roseconnect, addrlen) != 0) {
switch (errno) {
- case ECONNREFUSED:
- strcpy(buffer, "*** Disconnected - 0100 - Number Busy\r");
- break;
- case ENETUNREACH:
- strcpy(buffer, "*** Disconnected - 0D00 - Not Obtainable\r");
- break;
- case EINTR:
- strcpy(buffer, "*** Disconnected - 3900 - Ship Absent\r");
- break;
- default:
- sprintf(buffer, "*** Disconnected - %d - %s\r", errno, strerror(errno));
- break;
+ case ECONNREFUSED:
+ strcpy(buffer, "*** Disconnected - 0100 - Number Busy\r");
+ break;
+ case ENETUNREACH:
+ strcpy(buffer, "*** Disconnected - 0D00 - Not Obtainable\r");
+ break;
+ case EINTR:
+ strcpy(buffer, "*** Disconnected - 3900 - Ship Absent\r");
+ break;
+ default:
+ sprintf(buffer, "*** Disconnected - %d - %s\r", errno, strerror(errno));
+ break;
}
close(s);
@@ -249,7 +249,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/rsusers.sh b/rose/rsusers.sh
index 6dff1ce..58b563c 100755..100644
--- a/rose/rsusers.sh
+++ b/rose/rsusers.sh
@@ -125,4 +125,3 @@ fi
read x
exit 0
-
diff --git a/tcpip/Makefile.am b/tcpip/Makefile.am
index 7a5a2cb..847c42f 100644
--- a/tcpip/Makefile.am
+++ b/tcpip/Makefile.am
@@ -10,11 +10,11 @@ installconf:
sbin_PROGRAMS = rip98d ttylinkd
-man_MANS = rip98d.conf.5 rip98d.8 ttylinkd.conf.5 ttylinkd.8
+dist_man_MANS = rip98d.conf.5 rip98d.8 ttylinkd.conf.5 ttylinkd.8
-doc_DATA= ttylinkd.README ttylinkd.INSTALL
+dist_doc_DATA = ttylinkd.README ttylinkd.INSTALL
-EXTRA_DIST = $(man_MANS) $(etcfiles) $(doc_DATA)
+EXTRA_DIST = $(etcfiles)
rip98d_SOURCES = \
rip98d.c \
@@ -25,8 +25,7 @@ rip98d_SOURCES = \
rip98d_LDADD = $(AX25_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/tcpip/rip98d.c b/tcpip/rip98d.c
index 8688177..ca9a7b5 100644
--- a/tcpip/rip98d.c
+++ b/tcpip/rip98d.c
@@ -30,13 +30,13 @@
struct dest_struct dest_list[50];
-int dest_count = 0;
+int dest_count;
int debug = FALSE;
int route_restrict = FALSE;
int logging = FALSE;
-struct route_struct *first_route = NULL;
+struct route_struct *first_route;
static struct mask_struct {
unsigned long int mask;
@@ -83,14 +83,14 @@ static void terminate(int sig)
syslog(LOG_INFO, "terminating on SIGTERM\n");
closelog();
}
-
+
exit(0);
}
unsigned int mask2bits(unsigned long int mask)
{
struct mask_struct *t;
-
+
for (t = mask_table; t->mask != 0; t++)
if (mask == t->mask)
return t->bits;
@@ -101,7 +101,7 @@ unsigned int mask2bits(unsigned long int mask)
unsigned long int bits2mask(unsigned int bits)
{
struct mask_struct *t;
-
+
for (t = mask_table; t->mask != 0; t++)
if (bits == t->bits)
return htonl(t->mask);
@@ -168,7 +168,7 @@ static int read_routes(void)
if (first_route != NULL) {
route = first_route;
-
+
while (route != NULL) {
temp = route->next;
free(route);
@@ -177,7 +177,7 @@ static int read_routes(void)
first_route = NULL;
}
-
+
if ((fp = fopen(PROC_IP_ROUTE_FILE, "r")) == NULL) {
if (logging)
syslog(LOG_ERR, "error cannot open %s\n", PROC_IP_ROUTE_FILE);
@@ -196,7 +196,7 @@ static int read_routes(void)
netmask = mask2bits(hex2intrev(mask_addr));
network = inet_netof(address);
-
+
if (network == 0 || network == 127) {
if (debug && logging)
syslog(LOG_DEBUG, "rejecting route to %s/%ld - should not be propogated\n", inet_ntoa(address), netmask);
@@ -225,9 +225,9 @@ static int read_routes(void)
route->next = first_route;
first_route = route;
}
-
+
fclose(fp);
-
+
return TRUE;
}
@@ -236,12 +236,12 @@ static int load_dests(void)
struct hostent *host;
char buffer[255], *s;
FILE *fp;
-
+
if ((fp = fopen(CONF_RIP98D_FILE, "r")) == NULL) {
fprintf(stderr, "rip98d: cannot open config file\n");
return FALSE;
}
-
+
while (fgets(buffer, 255, fp) != NULL) {
if ((s = strchr(buffer, '\n')) != NULL) *s = '\0';
@@ -254,12 +254,12 @@ static int load_dests(void)
memcpy((char *)&dest_list[dest_count].dest_addr, host->h_addr, host->h_length);
dest_count++;
}
-
+
fclose(fp);
if (dest_count == 0)
return FALSE;
-
+
return TRUE;
}
@@ -279,31 +279,31 @@ int main(int argc, char **argv)
while ((i = getopt(argc, argv, "dlrt:v")) != -1) {
switch (i) {
- case 'd':
- debug = TRUE;
- break;
- case 'l':
- logging = TRUE;
- break;
- case 'r':
- route_restrict = TRUE;
- break;
- case 't':
- interval = atoi(optarg) * 60;
- if (interval < 60 || interval > 7200) {
- fprintf(stderr, "rip98d: invalid time interval\n");
- return 1;
- }
- break;
- case 'v':
- printf("rip98d: %s\n", VERSION);
- return 0;
- case ':':
+ case 'd':
+ debug = TRUE;
+ break;
+ case 'l':
+ logging = TRUE;
+ break;
+ case 'r':
+ route_restrict = TRUE;
+ break;
+ case 't':
+ interval = atoi(optarg) * 60;
+ if (interval < 60 || interval > 7200) {
fprintf(stderr, "rip98d: invalid time interval\n");
return 1;
- case '?':
- fprintf(stderr, "usage: rip98d [-d] [-l] [-r] [-t interval] [-v]\n");
- return 1;
+ }
+ break;
+ case 'v':
+ printf("rip98d: %s\n", VERSION);
+ return 0;
+ case ':':
+ fprintf(stderr, "rip98d: invalid time interval\n");
+ return 1;
+ case '?':
+ fprintf(stderr, "usage: rip98d [-d] [-l] [-r] [-t interval] [-v]\n");
+ return 1;
}
}
@@ -317,7 +317,7 @@ int main(int argc, char **argv)
memset((char *)&loc_addr, 0, sizeof(loc_addr));
loc_addr.sin_family = AF_INET;
loc_addr.sin_addr.s_addr = htonl(INADDR_ANY);
- loc_addr.sin_port = htons(RIP_PORT);
+ loc_addr.sin_port = htons(RIP_PORT);
if (bind(s, (struct sockaddr *)&loc_addr, sizeof(loc_addr)) < 0) {
perror("rip98d: bind");
@@ -342,7 +342,7 @@ int main(int argc, char **argv)
timeout.tv_sec = 60;
timeout.tv_usec = 0;
-
+
select(s + 1, &fdset, NULL, NULL, &timeout);
if (!read_routes()) {
diff --git a/tcpip/rip98r.c b/tcpip/rip98r.c
index f8d8090..b1f283c 100644
--- a/tcpip/rip98r.c
+++ b/tcpip/rip98r.c
@@ -42,7 +42,7 @@ static int cmp_route(struct route_struct *route, struct in_addr addr, int bits,
if (route->action == DEL_ROUTE || route->action == NEW_ROUTE)
return UNMATCH_ROUTE;
-
+
if (old_addr != new_addr)
return UNMATCH_ROUTE;
@@ -118,7 +118,7 @@ void receive_routes(int s)
for (p = message + RIP98_HEADER; p < message + mess_len; p += RIP98_ENTRY) {
memcpy((char *)&addr, (char *)p, sizeof(addr));
bits = p[4];
- metric = p[5];
+ metric = p[5];
network = inet_netof(addr);
@@ -140,7 +140,7 @@ void receive_routes(int s)
syslog(LOG_DEBUG, " route to %s/%d metric %d\n", inet_ntoa(addr), bits, metric);
metric++;
-
+
if (metric > RIP98_INFINITY)
metric = RIP98_INFINITY;
@@ -151,37 +151,37 @@ void receive_routes(int s)
switch (cmp_route(route, addr, bits, metric)) {
- case NO_ROUTE:
- matched = TRUE;
- break;
-
- case REPLACE_ROUTE:
- route->action = DEL_ROUTE;
-
- case ADDITIONAL_ROUTE:
- if (!found) {
- if ((new = malloc(sizeof(struct route_struct))) == NULL) {
- if (logging)
- syslog(LOG_ERR, "out of memory\n");
- return;
- }
-
- new->addr = addr;
- new->bits = bits;
- new->metric = metric;
- new->action = NEW_ROUTE;
-
- new->next = first_route;
- first_route = new;
-
- found = TRUE;
+ case NO_ROUTE:
+ matched = TRUE;
+ break;
+
+ case REPLACE_ROUTE:
+ route->action = DEL_ROUTE;
+
+ case ADDITIONAL_ROUTE:
+ if (!found) {
+ if ((new = malloc(sizeof(struct route_struct))) == NULL) {
+ if (logging)
+ syslog(LOG_ERR, "out of memory\n");
+ return;
}
- matched = TRUE;
- break;
+ new->addr = addr;
+ new->bits = bits;
+ new->metric = metric;
+ new->action = NEW_ROUTE;
+
+ new->next = first_route;
+ first_route = new;
- default:
- break;
+ found = TRUE;
+ }
+
+ matched = TRUE;
+ break;
+
+ default:
+ break;
}
}
@@ -196,12 +196,12 @@ void receive_routes(int s)
new->bits = bits;
new->metric = metric;
new->action = NEW_ROUTE;
-
+
new->next = first_route;
first_route = new;
}
}
-
+
for (route = first_route; route != NULL; route = route->next) {
if (route->action == DEL_ROUTE) {
memset((char *)&rt, 0, sizeof(rt));
@@ -233,7 +233,7 @@ void receive_routes(int s)
rt.rt_flags |= RTF_HOST;
} else {
netmask = bits2mask(route->bits);
-
+
trg.sin_family = AF_INET;
memcpy((char *)&trg.sin_addr, (char *)&netmask, sizeof(struct in_addr));
trg.sin_port = 0;
diff --git a/tcpip/rip98t.c b/tcpip/rip98t.c
index 2441c49..9fd78c6 100644
--- a/tcpip/rip98t.c
+++ b/tcpip/rip98t.c
@@ -45,7 +45,7 @@ void transmit_routes(int s)
memset((char *)&rem_addr, 0, sizeof(rem_addr));
rem_addr.sin_family = AF_INET;
rem_addr.sin_addr = dest_list[i].dest_addr;
- rem_addr.sin_port = htons(RIP_PORT);
+ rem_addr.sin_port = htons(RIP_PORT);
route = first_route;
@@ -58,7 +58,7 @@ void transmit_routes(int s)
memcpy(message + mess_len + 0, (char *)&route->addr, sizeof(struct in_addr));
message[mess_len + 4] = route->bits;
message[mess_len + 5] = route->metric;
-
+
mess_len += RIP98_ENTRY;
}
diff --git a/tcpip/ttylinkd.8 b/tcpip/ttylinkd.8
index bd427b6..0437626 100644
--- a/tcpip/ttylinkd.8
+++ b/tcpip/ttylinkd.8
@@ -1,6 +1,6 @@
.TH TTYLINKD 8 "5 March 1997" Linux "Linux System Managers Manual"
.SH NAME
-ttylinkd \- TTYlink daemon for AX.25, NET/ROM, ROSE and IP.
+ttylinkd \- TTYlink daemon for AX.25, NET/ROM, ROSE and IP.
.SH SYNOPSIS
.B ttylinkd [-hv] [-c callsign] [-f file]
.SH DESCRIPTION
@@ -10,11 +10,11 @@ is a simple daemon that allows incoming ttylink calls to be routed through
to Linux's normal talkd(8)
system and provides a pipe between the two.
.LP
-.B ttylinkd
+.B ttylinkd
is usually setup to be spawned from ax25d(8) or inetd(8)
but can, since version 0.03, be used on the command line, although
talk(1) is a much better idea for interactive users.
-.LP
+.LP
Use splitscreen(1)
for outgoing ttylink sessions.
.SH OPTIONS
@@ -44,7 +44,7 @@ Use <file> for the configuration file, instead of the default
.BR talkd (8).
.SH BUGS
.LP
-There is still some need for some checking of who is still logged on.
+There is still some need for some checking of who is still logged on.
.LP
The daemon may hang if you disconnect from it strangely.
.LP
diff --git a/tcpip/ttylinkd.c b/tcpip/ttylinkd.c
index 792969e..c4399d5 100644
--- a/tcpip/ttylinkd.c
+++ b/tcpip/ttylinkd.c
@@ -7,13 +7,13 @@
* 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,
+ * 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 have recieved a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge. MA 02139, USA.
*/
/*
@@ -80,7 +80,7 @@ void read_config_file(int dummy);
"look-up",
"delete",
"announce" };
-*/
+*/
static char *Responses[] = {
"success",
"sysop not logged on",
@@ -112,18 +112,18 @@ int main(int argc, char *argv[])
struct sockaddr_rose *peer_srose;
socklen_t sa_len, length;
int i;
-
+
/* Open up the system logger */
openlog(argv[0], LOG_PID, LOG_DAEMON);
-
+
write(STDOUT_FILENO, version, strlen(version));
-
+
/* Work out who is calling us */
userfamily = AF_UNSPEC;
memset(user, 0, NAME_SIZE);
strcpy(sysop_addr, SYSOP_USER);
strcpy(config_file, CONF_TTYLINKD_FILE);
- for(i=1 ; i < argc ; i++)
+ for (i=1 ; i < argc ; i++)
{
if (argv[i][0] == '-')
{
@@ -163,60 +163,60 @@ int main(int argc, char *argv[])
break;
} /*switch */
} /* - */
- } /* for */
+ } /* for */
if (user[0] == '\0')
{
sa_len = sizeof(sa);
- if (getpeername(STDOUT_FILENO, &sa, &sa_len) < 0)
+ if (getpeername(STDOUT_FILENO, &sa, &sa_len) < 0)
{
fprintf(stderr, "%s: getpeername() failed, you must specify a callsign in stdin mode.\n", argv[0]);
syslog(LOG_CRIT | LOG_DAEMON, "main(): getpeername() failed.");
return 0;
} else {
userfamily = sa.sa_family;
- switch(sa.sa_family) {
- case AF_INET:
- peer_sin = (struct sockaddr_in*)&sa;
- write(STDOUT_FILENO, buf, strlen(buf));
- sprintf(buf, "Please enter your callsign: ");
- write(STDOUT_FILENO, buf, strlen(buf));
- fflush(stdout);
- if (fgets(user, NAME_SIZE-1, stdin) == NULL)
- return 0;
- for (i = 0; user[i] != '\0' && user[i] != '\n' && user[i] != '\r'; i++)
- ;
- user[i] = '\0';
- if (strlen(user) < 1)
- return 0;
- userfamily = AF_INET;
- break;
- case AF_AX25:
- case AF_NETROM:
- peer_sax = (struct sockaddr_ax25*)&sa;
- for(i=0 ; i < 6 ; i++)
- {
- user[i] = tolower(((peer_sax->sax25_call.ax25_call[i]) >>1)&0x7f);
- if (user[i] == ' ')
- break;
- }
- user[i] = '\0';
+ switch (sa.sa_family) {
+ case AF_INET:
+ peer_sin = (struct sockaddr_in*)&sa;
+ write(STDOUT_FILENO, buf, strlen(buf));
+ sprintf(buf, "Please enter your callsign: ");
+ write(STDOUT_FILENO, buf, strlen(buf));
+ fflush(stdout);
+ if (fgets(user, NAME_SIZE-1, stdin) == NULL)
+ return 0;
+ for (i = 0; user[i] != '\0' && user[i] != '\n' && user[i] != '\r'; i++)
+ ;
+ user[i] = '\0';
+ if (strlen(user) < 1)
+ return 0;
+ userfamily = AF_INET;
+ break;
+ case AF_AX25:
+ case AF_NETROM:
+ peer_sax = (struct sockaddr_ax25*)&sa;
+ for (i=0 ; i < 6 ; i++)
+ {
+ user[i] = tolower(((peer_sax->sax25_call.ax25_call[i]) >>1)&0x7f);
+ if (user[i] == ' ')
break;
- case AF_ROSE:
- peer_srose = (struct sockaddr_rose*)&sa;
- for(i=0 ; i < 6 ; i++)
- {
- user[i] = tolower(((peer_srose->srose_call.ax25_call[i]) >>1)&0x7f);
- if (user[i] == ' ')
- break;
- }
- user[i] = '\0';
+ }
+ user[i] = '\0';
+ break;
+ case AF_ROSE:
+ peer_srose = (struct sockaddr_rose*)&sa;
+ for (i=0 ; i < 6 ; i++)
+ {
+ user[i] = tolower(((peer_srose->srose_call.ax25_call[i]) >>1)&0x7f);
+ if (user[i] == ' ')
break;
- default:
- syslog(LOG_DAEMON | LOG_CRIT, "Unsupported address family.");
- exit(1);
+ }
+ user[i] = '\0';
+ break;
+ default:
+ syslog(LOG_DAEMON | LOG_CRIT, "Unsupported address family.");
+ exit(1);
}
-
- }
+
+ }
} /* argc */
/* Read the configuration file to find the System Operator. */
@@ -265,22 +265,22 @@ int main(int argc, char *argv[])
memset((char*)&msg_sa, 0, sizeof(msg_sa));
msg_sa.sa_family = AF_INET;
- msg_sin = (struct sockaddr_in*)&msg_sa;
+ msg_sin = (struct sockaddr_in*)&msg_sa;
msg_sin->sin_port = htons(0);
memcpy((char*)&(msg_sin->sin_addr), phe->h_addr, phe->h_length);
-
+
if ((skt = socket(PF_INET, SOCK_STREAM, 0)) < 0)
{
syslog(LOG_DAEMON | LOG_CRIT, "main(): socket() failed.");
exit(1);
}
-
+
if (bind( skt, &msg_sa, sizeof(msg_sa)) != 0)
{
syslog(LOG_DAEMON | LOG_CRIT, "main(): bind() failed.");
exit(1);
}
-
+
length = sizeof(msg_sa);
if (getsockname(skt, &msg_sa, &length) < 0)
{
@@ -294,21 +294,21 @@ int main(int argc, char *argv[])
ctl_sin.sin_family = AF_INET;
memcpy((char*)&ctl_sin.sin_addr, phe->h_addr, phe->h_length);
ctl_sin.sin_port = htons(0);
-
+
if ((ctl_skt = socket(PF_INET, SOCK_DGRAM, 0)) < 0)
{
syslog(LOG_DAEMON | LOG_CRIT, "main(): socket() while attempting to create control socket.");
close(skt);
exit(1);
}
-
+
if (bind(ctl_skt, (struct sockaddr*)&ctl_sin, sizeof(ctl_sin)) != 0)
{
syslog(LOG_DAEMON | LOG_CRIT, "main(): Error when trying to bind() control socket.");
close(skt);
exit(1);
}
-
+
length = sizeof(ctl_sin);
if (getsockname(ctl_skt, (struct sockaddr*)&ctl_sin, &length) < 0)
{
@@ -317,21 +317,21 @@ int main(int argc, char *argv[])
close(ctl_skt);
exit(1);
}
-
+
/* Start talking to the talk daemon */
memset((char*)&msg, 0, sizeof(msg));
msg.vers = TALK_VERSION;
msg.id_num = htonl(0);
msg.addr.sa_family = ntohs(AF_INET);
- memcpy(&(msg.ctl_addr), &msg_sa, sizeof(struct osockaddr));
+ memcpy(&(msg.ctl_addr), &msg_sa, sizeof(struct osockaddr));
/*msg.ctl_addr = *(struct sockaddr*)&ctl_sin;
msg.ctl_addr = *(struct sockaddr*)&ctl_sin;*/
msg.ctl_addr.sa_family = ntohs(AF_INET);
msg.pid = htonl(getpid());
strncpy(msg.l_name, user, NAME_SIZE-1);
strncpy(msg.r_name, sysop_user, NAME_SIZE-1);
-
-
+
+
/* Now look for an invite */
msg.type = LOOK_UP;
(void) send_control(ctl_skt, rem_addr, msg, &resp);
@@ -348,7 +348,7 @@ int main(int argc, char *argv[])
printf("Cannot talk to sysop errno=%d.\n",i);
else
printf("Cannot talk to sysop, reason: %s.\n",Responses[i]);
-
+
close(skt);
close(ctl_skt);
return 0;
@@ -362,7 +362,7 @@ int main(int argc, char *argv[])
syslog(LOG_DAEMON | LOG_CRIT, "main(): Error when trying to listen() on socket.");
exit(1);
}
-
+
/* Now we have to make an invitation for the other user */
msg.type = LEAVE_INVITE;
if (send_control(ctl_skt, my_addr, msg, &resp) != SUCCESS)
@@ -374,14 +374,14 @@ int main(int argc, char *argv[])
return 0;
}
local_id = resp.id_num;
-
+
sprintf(buf, "Paging sysop.\n");
write(STDOUT_FILENO, buf, strlen(buf));
-
+
/* Wait for the sysop to connect to us */
signal(SIGALRM, alarm_handle);
alarm(30);
-
+
if ((new_skt = accept(skt, 0, 0)) < 0)
{
if (errno == EINTR)
@@ -401,21 +401,21 @@ int main(int argc, char *argv[])
}
alarm(0);
signal(SIGALRM, SIG_DFL);
-
+
close(skt);
skt = new_skt;
-
+
/* Delete invitations from both daemons */
msg.type = DELETE;
msg.id_num = htonl(local_id);
send_control(ctl_skt, my_addr, msg, &resp);
msg.id_num = htonl(remote_id);
send_control(ctl_skt, rem_addr, msg, &resp);
-
- sprintf(buf, "Sysop has responded.\n");
+
+ sprintf(buf, "Sysop has responded.\n");
write(STDOUT_FILENO, buf, strlen(buf));
-
- /*
+
+ /*
* A little thing that they don't mention anywhere is the fact that the
* first three characters on a connection are used to work out to erase,
* kill and word erase characters. Nice to know eh?
@@ -443,7 +443,7 @@ int main(int argc, char *argv[])
erasec = buf[0];
killc = buf[1];
werasec = buf[2];
-
+
/* Tell the sysop who this person is */
if (sa.sa_family == AF_AX25)
{
@@ -455,26 +455,26 @@ int main(int argc, char *argv[])
sprintf(buf, "Incoming ttylink from %s@%s.\n", user, inet_ntoa(peer_sin->sin_addr));
write(skt, buf, strlen(buf));
}
-
-
+
+
do_talk(skt);
close(skt);
- close(ctl_skt);
+ close(ctl_skt);
return 0;
}
/*
* Used to send control messages to our friendly local talk daemon
- */
+ */
int send_control(int skt, struct in_addr addr, CTL_MSG msg, CTL_RESPONSE *resp)
{
fd_set fdvar;
struct timeval timeout;
struct sockaddr_in sin;
- static int talk_port = 0;
+ static int talk_port;
struct servent *pse;
-
+
/* Look up talk port once only */
if (talk_port == 0)
{
@@ -492,7 +492,7 @@ int send_control(int skt, struct in_addr addr, CTL_MSG msg, CTL_RESPONSE *resp)
sin.sin_addr = addr;
sin.sin_family = AF_INET;
sin.sin_port = talk_port;
-
+
if (sendto(skt, (char*)&msg, sizeof(msg), 0, (struct sockaddr*)&sin, sizeof(sin)) != sizeof(msg))
{
syslog(LOG_DAEMON | LOG_ERR, "send_control(): sendto failed (%m).");
@@ -504,23 +504,23 @@ int send_control(int skt, struct in_addr addr, CTL_MSG msg, CTL_RESPONSE *resp)
FD_SET(skt, &fdvar);
timeout.tv_sec = RING_WAIT;
timeout.tv_usec = 0;
-
+
if (select(32, &fdvar, NULL, NULL, &timeout) < 0)
syslog(LOG_DAEMON | LOG_ERR, "send_control(): select failed. (%m)");
-
+
/*
* The server is ignoring us, see ya later
- */
+ */
if (!(FD_ISSET(skt, &fdvar)))
{
printf("Talk server not responding after %d seconds, aborting.\n", RING_WAIT);
return -1;
}
-
+
/* Get the message */
- if(recv(skt, resp, sizeof(resp),0) ==0)
+ if (recv(skt, resp, sizeof(resp),0) ==0)
syslog(LOG_DAEMON | LOG_ERR, "send_control(): recv failed. (%m)");
-
+
return resp->answer;
}
@@ -530,8 +530,8 @@ int send_sysop_data(char *buf, int len)
static char outbuf[82];
static char *bptr = outbuf;
int i;
-
- for(i = 0; i < len; i++)
+
+ for (i = 0; i < len; i++)
{
/* Check for erase character */
if (buf[i] == erasec)
@@ -540,18 +540,18 @@ int send_sysop_data(char *buf, int len)
bptr--;
continue;
}
-
+
/* Check for kill character */
if (buf[i] == killc)
{
bptr = outbuf;
continue;
}
-
+
/* Check for word-erase character */
if (buf[i] == werasec)
{
- while( (bptr > outbuf) && (*bptr != ' ') )
+ while ( (bptr > outbuf) && (*bptr != ' ') )
bptr--;
continue;
}
@@ -573,7 +573,7 @@ int send_sysop_data(char *buf, int len)
*bptr = buf[i];
bptr++;
}
-
+
/* Check for carriage return, which means send it */
/* We also send if we have more than 80 characters */
if (buf[i] == '\n' || (bptr - outbuf) > 80 )
@@ -587,7 +587,7 @@ int send_sysop_data(char *buf, int len)
} /* for */
return 0;
}
-
+
/* Used to process the data from the user - len must not exceed 256 */
int send_user_data(int skt, char *buf, int len)
{
@@ -595,7 +595,7 @@ int send_user_data(int skt, char *buf, int len)
char *bptr = outbuf;
int i;
- for(i = 0; i < len; i++)
+ for (i = 0; i < len; i++)
{
if (buf[i] == '\r')
{
@@ -637,14 +637,14 @@ void do_talk(int skt)
char inbuf[256], outbuf[256];
struct timeval timeout;
int i;
-
-
- while(1)
+
+
+ while (1)
{
FD_ZERO(&fdvar);
FD_SET(skt, &fdvar);
FD_SET(STDIN_FILENO, &fdvar);
-
+
timeout.tv_sec = 30;
timeout.tv_usec = 0;
if (select(32, &fdvar, NULL, NULL, &timeout) == 0)
@@ -654,7 +654,7 @@ void do_talk(int skt)
if (ioctl(skt, FIONREAD, (struct sgttyb*)&i) < 0)
return;
}
-
+
if (FD_ISSET(skt, &fdvar))
{
if ((i = read(skt, inbuf, 256)) <= 0)
@@ -686,12 +686,12 @@ void do_talk(int skt)
}
}
}
-}
+}
void alarm_handle(int i)
{
char buf[256];
-
+
strcpy(buf, "Sysop not responding.\n");
write(STDOUT_FILENO, buf, strlen(buf));
}
@@ -701,13 +701,13 @@ void read_config_file(int dummy)
char buf[128];
char param[20], value[108];
FILE *fp;
-
+
if ( (fp = fopen(config_file, "r")) == NULL) {
- syslog(LOG_DAEMON | LOG_ERR, "Cannot find configuration file: %s (%m)\n",config_file);
+ syslog(LOG_DAEMON | LOG_ERR, "Cannot find configuration file: %s (%m)\n",config_file);
return;
}
/* Reset any variables here */
-
+
while ( fgets(buf, 128, fp) != NULL) {
if ( buf[0] == '#')
continue;
diff --git a/tcpip/ttylinkd.conf b/tcpip/ttylinkd.conf
index ae65749..8f581ff 100644
--- a/tcpip/ttylinkd.conf
+++ b/tcpip/ttylinkd.conf
@@ -7,4 +7,3 @@
# sysop=user
#
sysop=root
-
diff --git a/tcpip/ttylinkd.conf.5 b/tcpip/ttylinkd.conf.5
index 7af2dd8..d9a87ef 100644
--- a/tcpip/ttylinkd.conf.5
+++ b/tcpip/ttylinkd.conf.5
@@ -4,7 +4,7 @@ ttylinkd.conf \- ttylinkd configuration file.
.SH DESCRIPTION
.LP
.B ttylinkd.conf
-allows the super user to determine certain parameters with ttylinkd(8).
+allows the super user to determine certain parameters with ttylinkd(8).
Current there is only one field, with the view of not extending this further
(ttylinkd is about a resourceful as it is going to get).
.SH PARAMETERS
@@ -19,4 +19,3 @@ launched. If you do not supply a hostname then the local host will be assumed.
.BR ttylinkd (8).
.SH AUTHOR
Craig Small VK2XLZ <csmall@small.dropbear.id.au>
-
diff --git a/user_call/Makefile.am b/user_call/Makefile.am
index 1911d6f..d7b1fb8 100644
--- a/user_call/Makefile.am
+++ b/user_call/Makefile.am
@@ -4,11 +4,9 @@ installconf:
sbin_PROGRAMS = ax25_call netrom_call rose_call tcp_call
-man_MANS = ax25_call.8 netrom_call.8 rose_call.8 tcp_call.8
+dist_man_MANS = ax25_call.8 netrom_call.8 rose_call.8 tcp_call.8
-doc_DATA= README.user_call
-
-EXTRA_DIST = $(man_MANS) $(doc_DATA)
+dist_doc_DATA= README.user_call
LDADD = $(AX25_LIB) $(Z_LIB)
@@ -27,4 +25,3 @@ rose_call_SOURCES = rose_call.c \
tcp_call_SOURCES = tcp_call.c \
user_io.c \
user_io.h
-
diff --git a/user_call/ax25_call.8 b/user_call/ax25_call.8
index 81b305f..ce1d394 100644
--- a/user_call/ax25_call.8
+++ b/user_call/ax25_call.8
@@ -27,7 +27,7 @@ For
.B netrom_call
the remote_netrom_addr parameter may either be in the form of a single
callsign or as a NET/ROM alias and callsign pair separated by
-colon. For example NMCLUS:GB7BPQ.
+colon. For example NMCLUS:GB7BPQ.
.sp
For
.B rose_call
diff --git a/user_call/ax25_call.c b/user_call/ax25_call.c
index 1fafe4f..29b788e 100644
--- a/user_call/ax25_call.c
+++ b/user_call/ax25_call.c
@@ -123,18 +123,18 @@ int main(int argc, char **argv)
*/
if (connect(s, (struct sockaddr *)&axconnect, addrlen) != 0) {
switch (errno) {
- case ECONNREFUSED:
- strcpy(buffer, "*** Connection refused - aborting\r");
- break;
- case ENETUNREACH:
- strcpy(buffer, "*** No known route - aborting\r");
- break;
- case EINTR:
- strcpy(buffer, "*** Connection timed out - aborting\r");
- break;
- default:
- sprintf(buffer, "ERROR: cannot connect to AX.25 callsign, %s\r", strerror(errno));
- break;
+ case ECONNREFUSED:
+ strcpy(buffer, "*** Connection refused - aborting\r");
+ break;
+ case ENETUNREACH:
+ strcpy(buffer, "*** No known route - aborting\r");
+ break;
+ case EINTR:
+ strcpy(buffer, "*** Connection timed out - aborting\r");
+ break;
+ default:
+ sprintf(buffer, "ERROR: cannot connect to AX.25 callsign, %s\r", strerror(errno));
+ break;
}
err(buffer);
diff --git a/user_call/netrom_call.c b/user_call/netrom_call.c
index 8d7fd85..e247e8c 100644
--- a/user_call/netrom_call.c
+++ b/user_call/netrom_call.c
@@ -134,18 +134,18 @@ int main(int argc, char **argv)
*/
if (connect(s, (struct sockaddr *)&nrconnect, addrlen) != 0) {
switch (errno) {
- case ECONNREFUSED:
- strcpy(buffer, "*** Connection refused - aborting\r");
- break;
- case ENETUNREACH:
- strcpy(buffer, "*** No known route - aborting\r");
- break;
- case EINTR:
- strcpy(buffer, "*** Connection timed out - aborting\r");
- break;
- default:
- sprintf(buffer, "ERROR: cannot connect to NET/ROM node, %s\r", strerror(errno));
- break;
+ case ECONNREFUSED:
+ strcpy(buffer, "*** Connection refused - aborting\r");
+ break;
+ case ENETUNREACH:
+ strcpy(buffer, "*** No known route - aborting\r");
+ break;
+ case EINTR:
+ strcpy(buffer, "*** Connection timed out - aborting\r");
+ break;
+ default:
+ sprintf(buffer, "ERROR: cannot connect to NET/ROM node, %s\r", strerror(errno));
+ break;
}
err(buffer);
diff --git a/user_call/rose_call.c b/user_call/rose_call.c
index 43a27ae..602b1fe 100644
--- a/user_call/rose_call.c
+++ b/user_call/rose_call.c
@@ -129,18 +129,18 @@ int main(int argc, char **argv)
*/
if (connect(s, (struct sockaddr *)&roseconnect, addrlen) != 0) {
switch (errno) {
- case ECONNREFUSED:
- strcpy(buffer, "*** Connection refused - aborting\r");
- break;
- case ENETUNREACH:
- strcpy(buffer, "*** No known route - aborting\r");
- break;
- case EINTR:
- strcpy(buffer, "*** Connection timed out - aborting\r");
- break;
- default:
- sprintf(buffer, "ERROR: cannot connect to Rose address, %s\r", strerror(errno));
- break;
+ case ECONNREFUSED:
+ strcpy(buffer, "*** Connection refused - aborting\r");
+ break;
+ case ENETUNREACH:
+ strcpy(buffer, "*** No known route - aborting\r");
+ break;
+ case EINTR:
+ strcpy(buffer, "*** Connection timed out - aborting\r");
+ break;
+ default:
+ sprintf(buffer, "ERROR: cannot connect to Rose address, %s\r", strerror(errno));
+ break;
}
err(buffer);
diff --git a/user_call/user_io.c b/user_call/user_io.c
index c486e46..0a25136 100644
--- a/user_call/user_io.c
+++ b/user_call/user_io.c
@@ -11,7 +11,7 @@
#define BUFLEN 8192
-int compression = 0;
+int compression;
int paclen_in = 256;
int paclen_out = 256;
@@ -22,7 +22,7 @@ static unsigned char buf[BUFLEN];
#include <zlib.h>
/* Error in (de)compression happened? */
-static int compression_error = 0;
+static int compression_error;
/* These are for the (de)compressor */
static unsigned char input_buffer[BUFLEN];
@@ -193,7 +193,7 @@ int select_loop(int s)
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/yamdrv/Makefile.am b/yamdrv/Makefile.am
index 1a514f3..f9ebd1a 100644
--- a/yamdrv/Makefile.am
+++ b/yamdrv/Makefile.am
@@ -5,9 +5,6 @@ yamcfg_SOURCES = yamcfg.c yam.h
mcs2h_SOURCES = mcs2h.c
-doc_DATA = README.yamdrv
-
-EXTRA_DIST = $(doc_DATA)
+dist_doc_DATA = README.yamdrv
installconf:
-
diff --git a/yamdrv/README.yamdrv b/yamdrv/README.yamdrv
index f76ac10..ada27f2 100644
--- a/yamdrv/README.yamdrv
+++ b/yamdrv/README.yamdrv
@@ -11,23 +11,23 @@ yam3 default to COM4 0x3e8 irq3
----------
Added : bitrate/baudrate configuration.
-Added : mcs file may be loaded from yamcfg.
- One mcs file is affected to each bitrate.
-
+Added : mcs file may be loaded from yamcfg.
+ One mcs file is affected to each bitrate.
+
mcs data for 1200 and 9600 bds are preloaded in the driver
but may be changed by yamcfg.
options of yamcfg :
- [iobase <iobase>]
- [irq <irq>]
- [bitrate <bitrate>]
+ [iobase <iobase>]
+ [irq <irq>]
+ [bitrate <bitrate>]
[baudrate <baudrate>]
- [duplex <mode>]
- [hold <delay>]
+ [duplex <mode>]
+ [hold <delay>]
[txdelay <txdelay>]
- [txtail <txtail>]
- [slottime <slottime>]
+ [txtail <txtail>]
+ [slottime <slottime>]
[persist <persistence>]
[load <bitrate> <filename.mcs>]
@@ -52,26 +52,26 @@ The program yamcfg get or set the parameters of the yam driver
yamcfg -h gives a minimum help
Example setup of yam0 for 1 serial port (com2) :
-
+
file /etc/ax25/axports :
- port0 F1OAT-9 9600 256 2 VHF (9600 bit/s)
+ port0 F1OAT-9 9600 256 2 VHF (9600 bit/s)
commands :
setserial /dev/cua0 port 0 # to avoid conflict with yam driver
insmod yam
yamcfg yam0 io 0x2f8 irq 3
- ifconfig yam0 hw ax25 f1oat-9 up
-
-
+ ifconfig yam0 hw ax25 f1oat-9 up
+
+
Example setup of yam0,3 for 4 serial port (com1->com4) :
-
+
file /etc/ax25/axports :
- port0 F1OAT-9 9600 256 2 VHF (9600 bit/s)
- port1 F1OAT-8 9600 256 2 UHF1 (9600 bit/s)
- port2 F1OAT-7 9600 256 2 UHF2 (9600 bit/s)
- port3 F1OAT-8 9600 256 2 UHF3 (9600 bit/s)
-
+ port0 F1OAT-9 9600 256 2 VHF (9600 bit/s)
+ port1 F1OAT-8 9600 256 2 UHF1 (9600 bit/s)
+ port2 F1OAT-7 9600 256 2 UHF2 (9600 bit/s)
+ port3 F1OAT-8 9600 256 2 UHF3 (9600 bit/s)
+
commands :
setserial /dev/cua0 port 0 # to avoid conflict with yam driver
setserial /dev/cua1 port 0 # to avoid conflict with yam driver
@@ -80,13 +80,13 @@ Example setup of yam0,3 for 4 serial port (com1->com4) :
insmod yam
yamcfg yam2 irq 5
yamcfg yam3 irq 7
- ifconfig yam0 hw ax25 f1oat-9 up
- ifconfig yam1 hw ax25 f1oat-8 up
- ifconfig yam2 hw ax25 f1oat-7 up
- ifconfig yam3 hw ax25 f1oat-6 up
-
+ ifconfig yam0 hw ax25 f1oat-9 up
+ ifconfig yam1 hw ax25 f1oat-8 up
+ ifconfig yam2 hw ax25 f1oat-7 up
+ ifconfig yam3 hw ax25 f1oat-6 up
+
+
-
Good test !!!
73's Frederic F1OAT and Jean-Paul F6FBB
diff --git a/yamdrv/mcs2h.c b/yamdrv/mcs2h.c
index 6914965..bf1ae72 100644
--- a/yamdrv/mcs2h.c
+++ b/yamdrv/mcs2h.c
@@ -6,12 +6,12 @@ int in2hex(char *ptr)
{
char str[3];
int val;
-
+
memcpy(str, ptr, 2);
str[2] = '\0';
-
+
sscanf(str, "%x", &val);
-
+
return val;
}
@@ -19,7 +19,7 @@ unsigned char swap(unsigned char c)
{
unsigned char r = 0;
int i;
-
+
for (i = 0 ; i < 8 ; i++)
{
r <<= 1;
@@ -34,12 +34,12 @@ int in4hex(char *ptr)
{
char str[5];
int val;
-
+
memcpy(str, ptr, 4);
str[4] = '\0';
-
+
sscanf(str, "%x", &val);
-
+
return val;
}
@@ -50,22 +50,22 @@ int main(int ac, char *av[])
time_t temps;
FILE *fptr;
char buf[256];
-
+
if (ac != 3)
{
fprintf(stderr, "format : mcs2h 1200|9600 filename\n");
return 1;
}
-
+
fptr = fopen(av[2], "r");
if (fptr == NULL)
{
fprintf(stderr, "file %s not found\n", av[2]);
return 1;
}
-
+
time(&temps);
-
+
printf( "/*\n"
" *\n"
" * File %s converted to h format by mcs2h\n"
@@ -84,10 +84,10 @@ int main(int ac, char *av[])
nb = in2hex(buf+1);
add = in4hex(buf+3);
type = in2hex(buf+7);
-
+
if (type != 0)
continue;
-
+
if (first)
first = 0;
else
@@ -98,9 +98,9 @@ int main(int ac, char *av[])
printf("0x%02x%s", swap(in2hex(buf+9+i*2)), (i < (nb-1)) ? "," : "");
}
}
-
+
printf(" };\n");
-
+
fclose(fptr);
return 0;
}