summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-26 07:40:02 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-26 07:40:02 +0000
commite18443c3ae8593a5e5931232337ad03ad01dd370 (patch)
tree563d73ce35e2a03146142ebe1f3bdd0844009bfb /usr.sbin
parent422df5edeb27127e38fdf07d12a2b9860394ada7 (diff)
Exit Byzantine era
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/Makefile4
-rw-r--r--usr.sbin/gettable/Makefile7
-rw-r--r--usr.sbin/gettable/gettable.8103
-rw-r--r--usr.sbin/gettable/gettable.c183
4 files changed, 2 insertions, 295 deletions
diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile
index 4fd0d0c65c7..ffd8b0d57b0 100644
--- a/usr.sbin/Makefile
+++ b/usr.sbin/Makefile
@@ -1,10 +1,10 @@
-# $OpenBSD: Makefile,v 1.15 1996/06/30 01:57:36 deraadt Exp $
+# $OpenBSD: Makefile,v 1.16 1996/08/26 07:39:58 deraadt Exp $
# not yet done: catman
SUBDIR= ac accton arp bootpd bootpgw bootpef bootptest \
chown chroot config cron dev_mkdb \
- diskpart edquota gettable gspa htable inetd iostat \
+ diskpart edquota gspa htable inetd iostat \
ipftest ipmon ipsend kgmon \
kvm_mkdb lpr map-mbone mrinfo mrouted mtrace mtree named \
netgroup_mkdb pkg_install portmap pppd pstat pwd_mkdb quot quotaon \
diff --git a/usr.sbin/gettable/Makefile b/usr.sbin/gettable/Makefile
deleted file mode 100644
index 1d7e482b0a1..00000000000
--- a/usr.sbin/gettable/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# from: @(#)Makefile 5.3 (Berkeley) 5/11/90
-# $Id: Makefile,v 1.1 1995/10/18 08:47:33 deraadt Exp $
-
-PROG= gettable
-MAN= gettable.8
-
-.include <bsd.prog.mk>
diff --git a/usr.sbin/gettable/gettable.8 b/usr.sbin/gettable/gettable.8
deleted file mode 100644
index 2ad66dc64af..00000000000
--- a/usr.sbin/gettable/gettable.8
+++ /dev/null
@@ -1,103 +0,0 @@
-.\" Copyright (c) 1983, 1991 The Regents of the University of California.
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" from: @(#)gettable.8 6.5 (Berkeley) 3/16/91
-.\" $Id: gettable.8,v 1.1 1995/10/18 08:47:34 deraadt Exp $
-.\"
-.Dd March 16, 1991
-.Dt GETTABLE 8
-.Os BSD 4.2
-.Sh NAME
-.Nm gettable
-.Nd get
-.Tn NIC
-format host tables from a host
-.Sh SYNOPSIS
-.Nm gettable
-.Op Fl v
-.Ar host
-.Op Ar outfile
-.Sh DESCRIPTION
-.Nm Gettable
-is a simple program used to obtain the
-.Tn NIC
-standard
-host tables from a
-.Dq nicname
-server. The indicated
-.Ar host
-is queried for the tables. The tables, if retrieved,
-are placed in the file
-.Ar outfile
-or by default,
-.Pa hosts.txt .
-.Pp
-Available option:
-.Bl -tag -width Ds
-.It Fl v
-Get just the version number instead of the complete host table
-and put the output in the file
-.Ar outfile
-or by default,
-.Pa hosts.ver .
-.El
-.Pp
-.Nm Gettable
-operates by opening a
-.Tn TCP
-connection to the port indicated
-in the service specification for ``nicname''. A request
-is then made for
-.Dq ALL
-names and the resultant information
-is placed in the output file.
-.Pp
-.Nm Gettable
-is best used in conjunction with the
-.Xr htable 8
-program which converts the
-.Tn NIC
-standard file format to
-that used by the network library lookup routines.
-.Sh SEE ALSO
-.Xr intro 3 ,
-.Xr htable 8 ,
-.Xr named 8
-.Sh BUGS
-If the name-domain system provided network name mapping well as host
-name mapping,
-.Nm gettable
-would no longer be needed.
-.Sh HISTORY
-The
-.Nm
-command appeared in
-.Bx 4.2 .
diff --git a/usr.sbin/gettable/gettable.c b/usr.sbin/gettable/gettable.c
deleted file mode 100644
index 967e715dc34..00000000000
--- a/usr.sbin/gettable/gettable.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright (c) 1983 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1983 The Regents of the University of California.\n\
- All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-/*static char sccsid[] = "from: @(#)gettable.c 5.6 (Berkeley) 3/2/91";*/
-static char rcsid[] = "$Id: gettable.c,v 1.1 1995/10/18 08:47:34 deraadt Exp $";
-#endif /* not lint */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#include <netinet/in.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <netdb.h>
-
-#define OUTFILE "hosts.txt" /* default output file */
-#define VERFILE "hosts.ver" /* default version file */
-#define QUERY "ALL\r\n" /* query to hostname server */
-#define VERSION "VERSION\r\n" /* get version number */
-
-#define equaln(s1, s2, n) (!strncmp(s1, s2, n))
-
-struct sockaddr_in s_in;
-char buf[BUFSIZ];
-char *outfile = OUTFILE;
-
-main(argc, argv)
- int argc;
- char *argv[];
-{
- int s;
- register len;
- register FILE *sfi, *sfo, *hf;
- char *host;
- register struct hostent *hp;
- struct servent *sp;
- int version = 0;
- int beginseen = 0;
- int endseen = 0;
-
- argv++, argc--;
- if (*argv && **argv == '-') {
- if (argv[0][1] != 'v')
- fprintf(stderr, "unknown option %s ignored\n", *argv);
- else
- version++, outfile = VERFILE;
- argv++, argc--;
- }
- if (argc < 1 || argc > 2) {
- fprintf(stderr, "usage: gettable [-v] host [ file ]\n");
- exit(1);
- }
- sp = getservbyname("hostnames", "tcp");
- if (sp == NULL) {
- fprintf(stderr, "gettable: hostnames/tcp: unknown service\n");
- exit(3);
- }
- host = *argv;
- argv++, argc--;
- hp = gethostbyname(host);
- if (hp == NULL) {
- fprintf(stderr, "gettable: %s: ", host);
- herror((char *)NULL);
- exit(2);
- }
- host = hp->h_name;
- if (argc > 0)
- outfile = *argv;
- s_in.sin_family = hp->h_addrtype;
- s = socket(hp->h_addrtype, SOCK_STREAM, 0);
- if (s < 0) {
- perror("gettable: socket");
- exit(4);
- }
- if (bind(s, (struct sockaddr *)&s_in, sizeof (s_in)) < 0) {
- perror("gettable: bind");
- exit(5);
- }
- bcopy(hp->h_addr, &s_in.sin_addr, hp->h_length);
- s_in.sin_port = sp->s_port;
- if (connect(s, (struct sockaddr *)&s_in, sizeof (s_in)) < 0) {
- perror("gettable: connect");
- exit(6);
- }
- fprintf(stderr, "Connection to %s opened.\n", host);
- sfi = fdopen(s, "r");
- sfo = fdopen(s, "w");
- if (sfi == NULL || sfo == NULL) {
- perror("gettable: fdopen");
- close(s);
- exit(1);
- }
- hf = fopen(outfile, "w");
- if (hf == NULL) {
- fprintf(stderr, "gettable: "); perror(outfile);
- close(s);
- exit(1);
- }
- fprintf(sfo, version ? VERSION : QUERY);
- fflush(sfo);
- while (fgets(buf, sizeof(buf), sfi) != NULL) {
- len = strlen(buf);
- buf[len-2] = '\0';
- if (!version && equaln(buf, "BEGIN", 5)) {
- if (beginseen || endseen) {
- fprintf(stderr,
- "gettable: BEGIN sequence error\n");
- exit(90);
- }
- beginseen++;
- continue;
- }
- if (!version && equaln(buf, "END", 3)) {
- if (!beginseen || endseen) {
- fprintf(stderr,
- "gettable: END sequence error\n");
- exit(91);
- }
- endseen++;
- continue;
- }
- if (equaln(buf, "ERR", 3)) {
- fprintf(stderr,
- "gettable: hostname service error: %s", buf);
- exit(92);
- }
- fprintf(hf, "%s\n", buf);
- }
- fclose(hf);
- if (!version) {
- if (!beginseen) {
- fprintf(stderr, "gettable: no BEGIN seen\n");
- exit(93);
- }
- if (!endseen) {
- fprintf(stderr, "gettable: no END seen\n");
- exit(94);
- }
- fprintf(stderr, "Host table received.\n");
- } else
- fprintf(stderr, "Version number received.\n");
- close(s);
- fprintf(stderr, "Connection to %s closed\n", host);
- exit(0);
-}