diff options
author | Klaas Freitag <freitag@suse.de> | 1998-11-15 20:07:31 +0000 |
---|---|---|
committer | Klaas Freitag <freitag@suse.de> | 1998-11-15 20:07:31 +0000 |
commit | 49d6a0009c6ab09ed184028a082a098d455a34f2 (patch) | |
tree | f3e03429bb25dd641148c70cd8af596732c162f0 /lib/econet.c | |
parent | - Use numerical sort for interface sorting. (diff) | |
download | net-tools-49d6a0009c6ab09ed184028a082a098d455a34f2.tar.gz net-tools-49d6a0009c6ab09ed184028a082a098d455a34f2.tar.bz2 net-tools-49d6a0009c6ab09ed184028a082a098d455a34f2.zip |
Yow. This is net-tools completely reindented.
Some other cleanups:
- lib/net-string.c removed because it was not used and had a copyright notice
that conflicted with the GPL.
- Minor cleanups.
- Fix an potential buffer overflow in ax25.
- Switch to CVS $Id$ for versioning consistently
Diffstat (limited to 'lib/econet.c')
-rw-r--r-- | lib/econet.c | 87 |
1 files changed, 43 insertions, 44 deletions
diff --git a/lib/econet.c b/lib/econet.c index faf0246..41cbdac 100644 --- a/lib/econet.c +++ b/lib/econet.c @@ -1,19 +1,19 @@ /* - * lib/econet.c This file contains an implementation of the Econet - * support functions for the net-tools. - * (NET-3 base distribution). + * lib/econet.c This file contains an implementation of the Econet + * support functions for the net-tools. + * (NET-3 base distribution). * - * Version: lib/econet.c 1.00 1998-04-10 + * Version: $Id: econet.c,v 1.4 1998/11/15 20:09:30 freitag Exp $ * - * Author: Philip Blundell <philb@gnu.org> + * Author: Philip Blundell <philb@gnu.org> * * Modified: * - * 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 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. */ #include "config.h" @@ -33,54 +33,53 @@ /* Display an Econet address */ static char * -ec_print(unsigned char *ptr) + ec_print(unsigned char *ptr) { - static char buff[64]; - struct ec_addr *ec = (struct ec_addr *)ptr; - sprintf(buff,"%d.%d", ec->net, ec->station); - return buff; + static char buff[64]; + struct ec_addr *ec = (struct ec_addr *) ptr; + sprintf(buff, "%d.%d", ec->net, ec->station); + return buff; } /* Display an Econet socket address */ static char * -ec_sprint(struct sockaddr *sap, int numeric) + ec_sprint(struct sockaddr *sap, int numeric) { - struct sockaddr_ec *sec = (struct sockaddr_ec *)sap; + struct sockaddr_ec *sec = (struct sockaddr_ec *) sap; - if (sap->sa_family != AF_ECONET) - return _("[NONE SET]"); + if (sap->sa_family != AF_ECONET) + return _("[NONE SET]"); - return ec_print((unsigned char *)&sec->addr); + return ec_print((unsigned char *) &sec->addr); } -static int -ec_input(int type, char *bufp, struct sockaddr *sap) +static int ec_input(int type, char *bufp, struct sockaddr *sap) { - struct sockaddr_ec *sec = (struct sockaddr_ec *)sap; - int net, stn; - switch (sscanf(bufp, "%d.%d", &net, &stn)) - { - case 2: - sec->addr.station = stn; - sec->addr.net = net; - return 0; - case 1: - if (sscanf(bufp, "%d", &stn) == 1) { - sec->addr.net = 0; - sec->addr.station = stn; - return 0; + struct sockaddr_ec *sec = (struct sockaddr_ec *) sap; + int net, stn; + switch (sscanf(bufp, "%d.%d", &net, &stn)) { + case 2: + sec->addr.station = stn; + sec->addr.net = net; + return 0; + case 1: + if (sscanf(bufp, "%d", &stn) == 1) { + sec->addr.net = 0; + sec->addr.station = stn; + return 0; + } } - } - return -1; + return -1; } -struct aftype ec_aftype = { - "ec", NULL, AF_ECONET, 0, - ec_print, ec_sprint, ec_input, NULL, - NULL, NULL, NULL, - -1, - NULL +struct aftype ec_aftype = +{ + "ec", NULL, AF_ECONET, 0, + ec_print, ec_sprint, ec_input, NULL, + NULL, NULL, NULL, + -1, + NULL }; -#endif /* HAVE_AFECONET */ +#endif /* HAVE_AFECONET */ |