aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Blundell <philb@gnu.org>1999-02-27 11:27:47 +0000
committerPhil Blundell <philb@gnu.org>1999-02-27 11:27:47 +0000
commit841d05de923c8d357a49c9b362e1f6a6ca92bf92 (patch)
treeb655362d01933e883ee9c123ada9313cc18cd67a
parentAdd support for `-V' to slattach and plipconfig (diff)
downloadnet-tools-841d05de923c8d357a49c9b362e1f6a6ca92bf92.tar.gz
net-tools-841d05de923c8d357a49c9b362e1f6a6ca92bf92.tar.bz2
net-tools-841d05de923c8d357a49c9b362e1f6a6ca92bf92.zip
DECnet support, from Steve Whitehouse, <SteveW@ACM.org>
-rw-r--r--Makefile10
-rw-r--r--README5
-rw-r--r--config.in1
-rw-r--r--hostname.c86
-rw-r--r--man/en_US/hostname.129
5 files changed, 116 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index 8945418..5498d3f 100644
--- a/Makefile
+++ b/Makefile
@@ -89,6 +89,10 @@ COPTS = -D_GNU_SOURCE -O2 -Wall -g # -I/usr/inet6/include
LOPTS =
RESLIB = # -L/usr/inet6/lib -linet6
+ifeq ($(HAVE_AFDECnet),1)
+DNLIB = -ldnet
+endif
+
# -------- end of user definitions --------
MAINTAINER = Philip.Blundell@pobox.com
@@ -174,7 +178,7 @@ ifconfig: $(NET-LIB) ifconfig.o
$(CC) $(LDFLAGS) -o ifconfig ifconfig.o $(NLIB) $(RESLIB)
hostname: hostname.o
- $(CC) $(LDFLAGS) -o hostname hostname.o
+ $(CC) $(LDFLAGS) -o hostname hostname.o $(DNLIB)
route: $(NET-LIB) route.o
$(CC) $(LDFLAGS) -o route route.o $(NLIB) $(RESLIB)
@@ -217,7 +221,9 @@ installbin:
ln -fs hostname $(BASEDIR)/bin/ypdomainname
ln -fs hostname $(BASEDIR)/bin/nisdomainname
ln -fs hostname $(BASEDIR)/bin/domainname
-
+ifeq ($(HAVE_AFDECnet),1)
+ ln -fs hostname $(BASEDIR)/bin/nodename
+endif
savebin:
@for i in ${BASEDIR}/sbin/arp ${BASEDIR}/sbin/ifconfig \
diff --git a/README b/README
index f82c94d..29cd271 100644
--- a/README
+++ b/README
@@ -30,11 +30,12 @@ Contents:
This is net-tools 1.51. Notable changes since 1.50 include:
- - a compilation problem with 2.0 kernels has been fixed
- Tuan Hoang added support to netstat for printing multicast group
information (option --groups)
- Jan Kratochvil added support to netstat for displaying details of
the process owning a socket (option --programs)
+ - Steve Whitehouse contributed support for DECnet
+ - some bugs and compilation problems have been fixed
Notable changes since 1.49 include:
@@ -73,7 +74,7 @@ Notable changes since 1.45 include:
You need kernel 2.0 or later to use these programs. These programs
should compile cleanly with either glibc or libc5. The `iptunnel' and
-`ipmaddr' programs require kernel 2.1 or later.
+`ipmaddr' programs require kernel version 2.2 or later.
The NLS support was changed from catgets to GNU gettext by Arnaldo
Carvalho de Melo <acme@conectiva.com.br> in June, 1998, to make the
diff --git a/config.in b/config.in
index 93f1e22..7764085 100644
--- a/config.in
+++ b/config.in
@@ -59,6 +59,7 @@ bool 'AX25 (packet radio) protocol family' HAVE_AFAX25 y
bool 'NET/ROM (packet radio) protocol family' HAVE_AFNETROM y
bool 'Rose (packet radio) protocol family' HAVE_AFROSE n
bool 'Econet protocol family' HAVE_AFECONET n
+bool 'DECnet protocol family' HAVE_AFDECnet n
*
*
* Device Hardware types.
diff --git a/hostname.c b/hostname.c
index 865119d..b9c1c7f 100644
--- a/hostname.c
+++ b/hostname.c
@@ -3,7 +3,7 @@
* that maintains the hostname and the domainname. It
* is also used to show the FQDN and the IP-Addresses.
*
- * Usage: hostname [-d|-f|-s|-a|-i|-y]
+ * Usage: hostname [-d|-f|-s|-a|-i|-y|-n]
* hostname [-h|-V]
* hostname {name|-F file}
* dnsdmoainname
@@ -41,7 +41,11 @@
#include "version.h"
#include "../intl.h"
-char *Release = RELEASE, *Version = "hostname 1.97 (1998-06-29)";
+#if HAVE_AFDECnet
+#include <netdnet/dn.h>
+#endif
+
+char *Release = RELEASE, *Version = "hostname 1.98 (1998-02-27)";
static char *program_name;
static int opt_v;
@@ -55,6 +59,28 @@ static void setfilename(char *, int);
#define SETHOST 1
#define SETDOMAIN 2
+#define SETNODE 3
+
+#if HAVE_AFDECnet
+static void setnname(char *nname)
+{
+ if (opt_v)
+ fprintf(stderr, _("Setting nodename to `%s'\n"),
+ nname);
+ if (setnodename(nname, strlen(nname))) {
+ switch(errno) {
+ case EPERM:
+ fprintf(stderr, _("%s: you must be root to change the node name\n"), program_name);
+ break;
+ case EINVAL:
+ fprintf(stderr, _("%s: name too long\n"), program_name);
+ break;
+ default:
+ }
+ exit(1);
+ }
+}
+#endif /* HAVE_AFDECnet */
static void sethname(char *hname)
{
@@ -163,11 +189,19 @@ static void setfilename(char *name, int what)
fprintf(stderr, ">> %s\n", fline);
if (fline[0] == '#')
continue;
- if (what == SETHOST) {
- sethname(fline);
- } else {
- setdname(fline);
- }
+ switch(what) {
+ case SETHOST:
+ sethname(fline);
+ break;
+ case SETDOMAIN:
+ setdname(fline);
+ break;
+#if HAVE_AFDECnet
+ case SETNODE:
+ setnname(fline);
+ break;
+#endif /* HAVE_AFDECnet */
+ }
}
(void) fclose(fd);
} else {
@@ -187,7 +221,10 @@ static void usage(void)
{
fprintf(stderr, _("Usage: hostname [-v] {hostname|-F file} set hostname (from file)\n"));
fprintf(stderr, _(" domainname [-v] {nisdomain|-F file} set NIS domainname (from file)\n"));
- fprintf(stderr, _(" hostname [-v] [-d|-f|-s|-a|-i|-y] display formated name\n"));
+#if HAVE_AFDECnet
+ fprintf(stderr, _(" nodename [-v] {nodename|-F file} set DECnet node name (from file)\n"));
+#endif
+ fprintf(stderr, _(" hostname [-v] [-d|-f|-s|-a|-i|-y|-n] display formatted name\n"));
fprintf(stderr, _(" hostname [-v] display hostname\n\n"));
fprintf(stderr, _(" hostname -V|--version|-h|--help print info and exit\n\n"));
fprintf(stderr, _(" dnsdomainname=hostname -d, {yp,nis,}domainname=hostname -y\n\n"));
@@ -197,6 +234,9 @@ static void usage(void)
fprintf(stderr, _(" -f, --fqdn, --long long host name (FQDN)\n"));
fprintf(stderr, _(" -d, --domain DNS domain name\n"));
fprintf(stderr, _(" -y, --yp, --nis NIS/YP domainname\n"));
+#if HAVE_AFDECnet
+ fprintf(stderr, _(" -n, --node DECnet node name\n"));
+#endif /* HAVE_AFDECnet */
fprintf(stderr, _(" -F, --file read hostname or nis domainname from given File\n\n"));
fprintf(stderr, _(" This comand can get or set the hostname or the NIS domainname. You can\n"));
fprintf(stderr, _(" also get the DNS domain or the FQDN (fully qualified domain name).\n"));
@@ -231,6 +271,9 @@ int main(int argc, char **argv)
{"ip-address", no_argument, 0, 'i'},
{"nis", no_argument, 0, 'y'},
{"yp", no_argument, 0, 'y'},
+#if HAVE_AFDECnet
+ {"node", no_argument, 0, 'n'},
+#endif /* HAVE_AFDECnet */
{0, 0, 0, 0}
};
#if I18N
@@ -245,8 +288,12 @@ int main(int argc, char **argv)
what = 3;
if (!strcmp(program_name, "dnsdomainname"))
what = 2;
+#if HAVE_AFDECnet
+ if (!strcmp(program_name, "nodename"))
+ what = 4;
+#endif /* HAVE_AFDECnet */
- while ((c = getopt_long(argc, argv, "adfF:h?isVvy", long_options, &option_index)) != EOF)
+ while ((c = getopt_long(argc, argv, "adfF:h?isVvyn", long_options, &option_index)) != EOF)
switch (c) {
case 'd':
what = 2;
@@ -261,6 +308,11 @@ int main(int argc, char **argv)
case 'y':
what = 3;
break;
+#if HAVE_AFDECnet
+ case 'n':
+ what = 4;
+ break;
+#endif /* HAVE_AFDECnet */
case 'F':
file = optarg;
break;
@@ -319,6 +371,22 @@ int main(int argc, char **argv)
fprintf(stderr, _("getdomainname()=`%s'\n"), myname);
printf("%s\n", myname);
break;
+#if HAVE_AFDECnet
+ case 4:
+ if (file) {
+ setfilename(file, SETNODE);
+ break;
+ }
+ if (optind < argc) {
+ setnname(argv[optind]);
+ break;
+ }
+ getnodename(myname, sizeof(myname));
+ if (opt_v)
+ fprintf(stderr, _("getnodename()=`%s'\n"), myname);
+ printf("%s\n", myname);
+ break;
+#endif /* HAVE_AFDECnet */
}
exit(0);
}
diff --git a/man/en_US/hostname.1 b/man/en_US/hostname.1
index aee2da0..cea3f6e 100644
--- a/man/en_US/hostname.1
+++ b/man/en_US/hostname.1
@@ -10,6 +10,8 @@ dnsdomainname \- show the system's DNS domain name
nisdomainname \- show or set system's NIS/YP domain name
.br
ypdomainname \- show or set the system's NIS/YP domain name
+.br
+nodename \- show or set the system's DECnet node name
.SH SYNOPSIS
.B hostname
@@ -28,6 +30,8 @@ ypdomainname \- show or set the system's NIS/YP domain name
.RB [ \-y ]
.RB [ \-\-yp ]
.RB [ \-\-nis ]
+.RB [ \-n ]
+.RB [ \-\-node ]
.PP
.B hostname
@@ -43,6 +47,13 @@ ypdomainname \- show or set the system's NIS/YP domain name
.RB [ \-\-file\ filename ]
.RB [ name ]
+.PP
+.B nodename
+.RB [ \-v ]
+.RB [ \-F\ filename ]
+.RB [ \-\-file\ filename ]
+.RB [ name ]
+
.PP
.B hostname
.RB [ \-v ]
@@ -64,7 +75,7 @@ ypdomainname \- show or set the system's NIS/YP domain name
.SH DESCRIPTION
.B Hostname
is the program that is used to either set or display
-the current host or domain name of the system. This name is used
+the current host, domain or node name of the system. These names are used
by many of the networking programs to identify the machine. The domain
name is also used by NIS/YP.
@@ -85,6 +96,12 @@ will print the name of the system as returned by the
function. This is also known as the YP/NIS domain name of the system.
.LP
+.B nodename
+will print the DECnet node name of the system as returned by the
+.BR getnodename (2)
+function.
+
+.LP
.B dnsdomainname
will print the domain part of the FQDN (Fully Qualified Domain Name). The
complete FQDN of the system is returned with
@@ -93,7 +110,8 @@ complete FQDN of the system is returned with
.SS "SET NAME"
When called with one argument or with the
.B \-\-file
-option, the commands set the host name or the NIS/YP domain name.
+option, the commands set the host name, the NIS/YP domain name or
+the node name.
.LP
Note, that only the super-user can change the names.
@@ -166,6 +184,11 @@ Print a usage message and exit.
.I "\-i, \-\-ip-address"
Display the IP address(es) of the host.
.TP
+.I "\-n, \-\-node"
+Display the DECnet node name. If a parameter is given (or
+.B \-\-file name
+) the root can also set a new node name.
+.TP
.I "\-s, \-\-short"
Display the short host name. This is the host name cut at the first dot.
.TP
@@ -186,3 +209,5 @@ Peter Tobias, <tobias@et-inf.fho-emden.de>
.br
Bernd Eckenfels, <net-tools@lina.inka.de> (NIS and manpage).
.br
+Steve Whitehouse, <SteveW@ACM.org> (DECnet support and manpage).
+