From a4cc50373fbe27c973f95628fc142efec14e05cf Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Tue, 10 Aug 1999 05:54:53 +0200 Subject: Import ax25-tools 0.0.4 from tarball --- kiss/Makefile.am | 2 +- kiss/Makefile.in | 7 ++----- kiss/kissattach.8 | 9 +++++++-- kiss/kissattach.c | 21 ++++++++++++++++----- kiss/kissparms.c | 5 +++++ kiss/net2kiss.c | 6 ++++++ 6 files changed, 37 insertions(+), 13 deletions(-) (limited to 'kiss') diff --git a/kiss/Makefile.am b/kiss/Makefile.am index c37accc..47c6ef4 100644 --- a/kiss/Makefile.am +++ b/kiss/Makefile.am @@ -16,5 +16,5 @@ AX25_SYSCONFDIR=${sysconfdir}/ax25/ AX25_LOCALSTATEDIR=${localstatedir}/ax25/ install-exec-local: - (cd $(DESTDIR)$(sbindir) ; ln -s kissattach spattach) + (cd $(DESTDIR)$(sbindir) ; ln -sf kissattach spattach) diff --git a/kiss/Makefile.in b/kiss/Makefile.in index fdada1d..1fcf531 100644 --- a/kiss/Makefile.in +++ b/kiss/Makefile.in @@ -61,6 +61,7 @@ AWK = @AWK@ AX25IO_LIB = @AX25IO_LIB@ AX25_LIB = @AX25_LIB@ CC = @CC@ +DMASCC = @DMASCC@ MAKEINFO = @MAKEINFO@ NCURSES_LIB = @NCURSES_LIB@ PACKAGE = @PACKAGE@ @@ -91,10 +92,6 @@ DEFS = @DEFS@ -I. -I$(srcdir) -I.. CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_LIBS = @X_LIBS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ kissattach_SOURCES = kissattach.c kissattach_OBJECTS = kissattach.o kissattach_LDADD = $(LDADD) @@ -372,7 +369,7 @@ maintainer-clean-generic clean mostlyclean distclean maintainer-clean installconf: install-exec-local: - (cd $(DESTDIR)$(sbindir) ; ln -s kissattach spattach) + (cd $(DESTDIR)$(sbindir) ; ln -sf kissattach spattach) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/kiss/kissattach.8 b/kiss/kissattach.8 index 1ba0ea7..54bb648 100644 --- a/kiss/kissattach.8 +++ b/kiss/kissattach.8 @@ -2,7 +2,7 @@ .SH NAME kissattach, spattach \- Attach a KISS or 6PACK interface .SH SYNOPSIS -.B kissattach [-6] [-i inetaddr] [-l] [-m mtu] [-v] tty port +.B kissattach [-6] [-l] [-m mtu] [-v] tty port inetaddr .sp .B spattach [-i inetaddr] [-l] [-m mtu] [-v] tty port .SH DESCRIPTION @@ -22,6 +22,10 @@ The tty argument will typically be that of a serial port with a KISS or 6PACK TNC attached, although it could be a pseudo tty or a KISS port emulator such as an SCC card. The port arguments is the name of a port as given in the axports(5) file. +.LP +The inetaddr argument is the IP address of the new interface. This is now a +mandatory argument although due to historical reasons this restriction is +lifted if the old -i option is used. .SH OPTIONS .TP 16 .BI "\-6" @@ -30,7 +34,8 @@ the program is called as spattach. .TP 16 .BI "\-i inetaddr" Set the internet address of the interface. This address may either be a -dotted decimal address or a host name. +dotted decimal address or a host name. This option is now depreciated and +the program will complain about it, though still work. .TP 16 .BI \-l Log messages to the system log, the default is not to. diff --git a/kiss/kissattach.c b/kiss/kissattach.c index 7b26560..8da27f5 100644 --- a/kiss/kissattach.c +++ b/kiss/kissattach.c @@ -45,7 +45,7 @@ static int mtu = 0; static int logging = FALSE; static char *progname; -static char *basename(char *s) +static char *kiss_bname(char *s) { char *p = strrchr(s, '/'); return p ? p + 1 : s; @@ -206,6 +206,10 @@ static int startiface(char *dev, struct hostent *hp) return TRUE; } +static void usage(char *progname) +{ + fprintf(stderr, "usage: %s [-l] [-m mtu] [-v] ttyinterface port inetaddr\n", progname); +} int main(int argc, char *argv[]) { @@ -215,7 +219,7 @@ int main(int argc, char *argv[]) int v = 4; struct hostent *hp = NULL; - progname = basename(argv[0]); + progname = kiss_bname(argv[0]); if (!strcmp(progname, "spattach")) disc = N_6PACK; @@ -226,6 +230,7 @@ int main(int argc, char *argv[]) disc = N_6PACK; break; case 'i': + fprintf(stderr,"%s: -i flag depreciated, use new command line format instead.\n", progname); if ((hp = gethostbyname(optarg)) == NULL) { fprintf(stderr, "%s: invalid internet name/address - %s\n", progname, optarg); return 1; @@ -245,13 +250,13 @@ int main(int argc, char *argv[]) return 0; case ':': case '?': - fprintf(stderr, "usage: %s [-i inetaddr] [-l] [-m mtu] [-v] ttyinterface port\n", progname); + usage(progname); return 1; } } - if ((argc - optind) != 2) { - fprintf(stderr, "usage: %s [-i inetaddr] [-l] [-m mtu] [-v] ttyinterface port\n", progname); + if ((argc - optind) != 3 && ((argc - optind) != 2 || hp == NULL)) { + usage(progname); return 1; } @@ -263,6 +268,12 @@ int main(int argc, char *argv[]) if (!readconfig(argv[optind + 1])) return 1; + if ((argc - optind) == 3) { + if ((hp = gethostbyname(argv[optind + 2])) == NULL) { + fprintf(stderr, "%s: invalid internet name/address - %s\n", progname, argv[optind+2]); + } + } + if ((fd = open(argv[optind], O_RDONLY | O_NONBLOCK)) == -1) { fprintf(stderr, "%s: ", progname); perror("open"); diff --git a/kiss/kissparms.c b/kiss/kissparms.c index ea0f0bd..3d23ed6 100644 --- a/kiss/kissparms.c +++ b/kiss/kissparms.c @@ -8,7 +8,12 @@ #include #include #include + +#ifdef __GLIBC__ #include +#else +#include +#endif #ifdef HAVE_NETAX25_AX25_H #include diff --git a/kiss/net2kiss.c b/kiss/net2kiss.c index 19a7385..72e10e0 100644 --- a/kiss/net2kiss.c +++ b/kiss/net2kiss.c @@ -47,7 +47,13 @@ #include #include + +#ifdef __GLIBC__ #include +#else +#include +#endif + /* --------------------------------------------------------------------- */ -- cgit v1.2.3