diff options
Diffstat (limited to 'usr.sbin')
31 files changed, 0 insertions, 3498 deletions
diff --git a/usr.sbin/adduser/adduser b/usr.sbin/adduser/adduser deleted file mode 100644 index 0980004..0000000 --- a/usr.sbin/adduser/adduser +++ /dev/null @@ -1,195 +0,0 @@ -#!/usr/bin/perl - - - -# Copyright (c) 1994 GB Data Systems -# 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. The name of the Author may not be used to endorse or promote products -# derived from this software without specific prior written permission. -# THIS SOFTWARE IS PROVIDED BY GB DATA 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 GB DATA 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. - -# -# $Id: adduser,v 1.3 1994/12/28 13:49:55 ache Exp $ -# - -$configfile = "\/etc\/adduser.conf"; - -if (-f $configfile) { - open (CONFIG, "$configfile"); - while (<CONFIG>) { - eval "$_"; - } -} - -open (WHOAMI, "whoami|"); - -while (<WHOAMI>) { -$whoami = $_; -} -chop $whoami; - -if ($whoami ne "root") { -system "clear"; -print "\n\nYou must be root to add an user\n\n"; -close WHOAMI; -exit; -} -close WHOAMI; - -# Start getting information and print a banner - -print " Adduser\n"; -print " A system utility for adding users with defaults\n"; -print "\n\n"; - -# -# User ID -# - - -print "Please enter the login name of the user: "; -chop ($userlogin = <STDIN>); - - -sub subuid { -$userid = ""; -print "Please enter the user id or hit enter for the next id: "; -chop ($userid = <STDIN>); -} - -while (!$userid) { -&subuid; -if (!$userid) { - if ($useautoids) { - open (USERID, "+<$userids"); - chop ($xxuserid = <USERID>); - $userid = $xxuserid + 1; - close USERID; - open (USERID, "+>$userids"); - print (USERID "$userid\n"); - close USERID; - } else { &subuid; } -} -} - -# -# Group ID -# - -sub groupids { -print "Please enter the group id or hit enter for the default id: "; -chop ($groupid = <STDIN>); -} - -&groupids; - -while (!$groupid) { - if ($defgroupid) { - if (!$groupid) { - $groupid = "$defgroupid"; - } else { &groupids; } - } else { &groupids; } -} - -# -# User name -# - -print "Please enter the user's name: "; -chop ($username = <STDIN>); - -# -# Home directory -# - -print "Please enter the users home directory or hit enter for default: "; -chop ($userdir = <STDIN>); - -if (!$userdir) { - $userdir = "$defusrdir\/$userlogin"; - print "$userdir\n"; -} - -# -# Login Shell -# - -print "Please enter the users login shell or hit enter for default: "; -chop ($usershell = <STDIN>); - -if (!$usershell) { - $usershell = "$userdefshell"; - print "$usershell\n"; -} - -# -# Create password file entry -# - -print "Opening and locking passwd file in blocking mode.\n"; -open (PASS, '>>/etc/master.passwd'); -flock (PASS, 2) || die "Can't lock passwd file, must be in use!!\n"; -print (PASS "$userlogin::$userid:$groupid::0:0:$username,,,:$userdir:$usershell\n"); -print "Unlocking and closing password file\n"; -flock (PASS,8); -close PASS; -print "Re-indexing password databases\n"; -system 'pwd_mkdb -p /etc/master.passwd'; -system "passwd $userlogin"; - -# -# Create user directory -# -print "Creating user directory\n"; -if (! -e $defusrdir) { - system "mkdir -p $defusrdir\/$userdir"; -} else { - system "mkdir $userdir"; -} - - -print "Copying user shell files\n"; -system "cp $skel_location\/dot.login $userdir\/\.login"; -system "cp $skel_location\/dot.profile $userdir\/\.profile"; - -if ($usershell eq "\/bin\/csh" || $usershell eq "\/usr\/local\/bin\/tcsh") - { - system "cp $skel_location\/dot.cshrc $userdir\/.cshrc"; - } -system "chmod -R 664 $userdir"; -system "chown -R $userid.$groupid $userdir"; - - - -# -# Print out information used in creation of this account -# -print "\n\n"; -print "Information used to create this account follows.\n"; -print "\n"; -print "Login Name: $userlogin\n"; -print "UserId: $userid\n"; -print "GroupId: $groupid\n"; -print "UserName: $username\n"; -print "HomeDir: $userdir\n"; -print "Shell: $usershell\n"; -print "\nDONE\n\n"; - diff --git a/usr.sbin/adduser/adduser.1 b/usr.sbin/adduser/adduser.1 deleted file mode 100644 index 88534d8..0000000 --- a/usr.sbin/adduser/adduser.1 +++ /dev/null @@ -1,75 +0,0 @@ - -.\" Copyright (c) 1994 GB Data Systems -.\" 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. The name of the Author may not be used to endorse or promote products -.\" derived from this software without specific prior written permission. -.\" THIS SOFTWARE IS PROVIDED BY GB DATA 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 GB DATA 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. - -.\" $Id: adduser.1,v 1.2 1994/12/28 07:11:29 gclarkii Exp $ - -.Dd December 28, 1994 -.Dt ADDUSER 1 -.Os FreeBSD - -.Sh NAME -.Nm adduser - -.Sh SYNOPSIS -.Nm - -.Sh DESCRIPTION -.Nm -is a Perl script for adding users under a BSD system. It has the ability to -keep track of the current userid and increment this automaticly. It can -also use a default group id. -.Ss SETUP -In the normal course of usage there is no setup needed. If you wish to use -auto-increment mode, you must do two things. - -.Bl -enum -compact -.It -Change the variable in -.Pa /etc/adduser.conf -to allow for the auto-increment -.It -Change the file -.Pa /etc/userids -to show the current id number. -.El - -To use the default group id, just change the variable in -.Pa /etc/adduser.conf -to reflect the group that you wish as a default. - -.Sh FILES -.Pa /etc/adduser.conf -.Pa /etc/userids -.Pa /usr/share/skel/* - -.Sh SEE ALSO -.Xr adduser 8 -.Xr perl 1 - -.Sh HISTORY -The adduser command appeared in FreeBSD 2.0C (12-94). - - - diff --git a/usr.sbin/adduser/adduser.conf b/usr.sbin/adduser/adduser.conf deleted file mode 100644 index a5f52dd..0000000 --- a/usr.sbin/adduser/adduser.conf +++ /dev/null @@ -1,12 +0,0 @@ -# -# Configuration file for adduser (1) -# -# $Id:$ - -$useautoids = "1"; # Define this if you wish to use auto-increment -$defgroupid = "20"; # Default ID -$defusrdir = "\/usr\/u"; # Default User Dir -$userdefshell = "\/bin\/csh"; # Default user shell -$skel_location = "\/usr\/share\/skel"; # Location of shell skeletons -$userids = "\.\/userids"; # Location of 'userids' file - diff --git a/usr.sbin/adduser/adduser.sh b/usr.sbin/adduser/adduser.sh deleted file mode 100644 index 58aac32..0000000 --- a/usr.sbin/adduser/adduser.sh +++ /dev/null @@ -1,195 +0,0 @@ -#!/usr/bin/perl - - - -# Copyright (c) 1994 GB Data Systems -# 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. The name of the Author may not be used to endorse or promote products -# derived from this software without specific prior written permission. -# THIS SOFTWARE IS PROVIDED BY GB DATA 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 GB DATA 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. - -# -# $Id: adduser,v 1.4 1994/12/28 17:27:21 gclarkii Exp $ -# - -$configfile = "\/etc\/adduser.conf"; - -if (-f $configfile) { - open (CONFIG, "$configfile"); - while (<CONFIG>) { - eval "$_"; - } -} - -open (WHOAMI, "whoami|"); - -while (<WHOAMI>) { -$whoami = $_; -} -chop $whoami; - -if ($whoami ne "root") { -system "clear"; -print "\n\nYou must be root to add an user\n\n"; -close WHOAMI; -exit; -} -close WHOAMI; - -# Start getting information and print a banner - -print " Adduser\n"; -print " A system utility for adding users with defaults\n"; -print "\n\n"; - -# -# User ID -# - - -print "Please enter the login name of the user: "; -chop ($userlogin = <STDIN>); - - -sub subuid { -$userid = ""; -print "Please enter the user id or hit enter for the next id: "; -chop ($userid = <STDIN>); -} - -while (!$userid) { -&subuid; -if (!$userid) { - if ($useautoids) { - open (USERID, "+<$userids"); - chop ($xxuserid = <USERID>); - $userid = $xxuserid + 1; - close USERID; - open (USERID, "+>$userids"); - print (USERID "$userid\n"); - close USERID; - } else { &subuid; } -} -} - -# -# Group ID -# - -sub groupids { -print "Please enter the group id or hit enter for the default id: "; -chop ($groupid = <STDIN>); -} - -&groupids; - -while (!$groupid) { - if ($defgroupid) { - if (!$groupid) { - $groupid = "$defgroupid"; - } else { &groupids; } - } else { &groupids; } -} - -# -# User name -# - -print "Please enter the user's name: "; -chop ($username = <STDIN>); - -# -# Home directory -# - -print "Please enter the users home directory or hit enter for default: "; -chop ($userdir = <STDIN>); - -if (!$userdir) { - $userdir = "$defusrdir\/$userlogin"; - print "$userdir\n"; -} - -# -# Login Shell -# - -print "Please enter the users login shell or hit enter for default: "; -chop ($usershell = <STDIN>); - -if (!$usershell) { - $usershell = "$userdefshell"; - print "$usershell\n"; -} - -# -# Create password file entry -# - -print "Opening and locking passwd file in blocking mode.\n"; -open (PASS, '>>/etc/master.passwd'); -flock (PASS, 2) || die "Can't lock passwd file, must be in use!!\n"; -print (PASS "$userlogin::$userid:$groupid::0:0:$username,,,:$userdir:$usershell\n"); -print "Unlocking and closing password file\n"; -flock (PASS,8); -close PASS; -print "Re-indexing password databases\n"; -system 'pwd_mkdb -p /etc/master.passwd'; -system "passwd $userlogin"; - -# -# Create user directory -# -print "Creating user directory\n"; -if (! -e $defusrdir) { - system "mkdir -p $defusrdir\/$userdir"; -} else { - system "mkdir $userdir"; -} - - -print "Copying user shell files\n"; -system "cp $skel_location\/dot.login $userdir\/\.login"; -system "cp $skel_location\/dot.profile $userdir\/\.profile"; - -if ($usershell eq "\/bin\/csh" || $usershell eq "\/usr\/local\/bin\/tcsh") - { - system "cp $skel_location\/dot.cshrc $userdir\/.cshrc"; - } -system "chmod -R 664 $userdir"; -system "chown -R $userid.$groupid $userdir"; - - - -# -# Print out information used in creation of this account -# -print "\n\n"; -print "Information used to create this account follows.\n"; -print "\n"; -print "Login Name: $userlogin\n"; -print "UserId: $userid\n"; -print "GroupId: $groupid\n"; -print "UserName: $username\n"; -print "HomeDir: $userdir\n"; -print "Shell: $usershell\n"; -print "\nDONE\n\n"; - diff --git a/usr.sbin/bootpd/Makefile b/usr.sbin/bootpd/Makefile deleted file mode 100644 index e661b6b..0000000 --- a/usr.sbin/bootpd/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -# bootpd/Makefile -# $Id: Makefile,v 1.1.1.1 1994/09/10 14:44:53 csgr Exp $ - -PROG= bootpd -#CFLAGS+= -DETC_ETHERS -CFLAGS+= -DSYSLOG -DDEBUG -DVEND_CMU - - -SRCS= bootpd.c dovend.c readfile.c hash.c dumptab.c \ - lookup.c getif.c hwaddr.c report.c tzone.c rtmsg.c - -MAN5= bootptab.5 -MAN8= bootpd.8 - -.include <bsd.prog.mk> diff --git a/usr.sbin/bootpd/getether.c b/usr.sbin/bootpd/getether.c deleted file mode 100644 index 724a376..0000000 --- a/usr.sbin/bootpd/getether.c +++ /dev/null @@ -1,374 +0,0 @@ -/* - * getether.c : get the ethernet address of an interface - * - * All of this code is quite system-specific. As you may well - * guess, it took a good bit of detective work to figure out! - * - * If you figure out how to do this on another system, - * please let me know. <gwr@mc.com> - */ - -#include <sys/types.h> -#include <sys/socket.h> - -#include <ctype.h> -#include <syslog.h> - -#include "report.h" -#define EALEN 6 - -#if defined(ultrix) || (defined(__osf__) && defined(__alpha)) -/* - * This is really easy on Ultrix! Thanks to - * Harald Lundberg <hl@tekla.fi> for this code. - * - * The code here is not specific to the Alpha, but that was the - * only symbol we could find to identify DEC's version of OSF. - * (Perhaps we should just define DEC in the Makefile... -gwr) - */ - -#include <sys/ioctl.h> -#include <net/if.h> /* struct ifdevea */ - -getether(ifname, eap) - char *ifname, *eap; -{ - int rc = -1; - int fd; - struct ifdevea phys; - bzero(&phys, sizeof(phys)); - strcpy(phys.ifr_name, ifname); - if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { - report(LOG_ERR, "getether: socket(INET,DGRAM) failed"); - return -1; - } - if (ioctl(fd, SIOCRPHYSADDR, &phys) < 0) { - report(LOG_ERR, "getether: ioctl SIOCRPHYSADDR failed"); - } else { - bcopy(&phys.current_pa[0], eap, EALEN); - rc = 0; - } - close(fd); - return rc; -} - -#define GETETHER -#endif /* ultrix|osf1 */ - - -#ifdef SUNOS - -#include <sys/sockio.h> -#include <sys/time.h> /* needed by net_if.h */ -#include <net/nit_if.h> /* for NIOCBIND */ -#include <net/if.h> /* for struct ifreq */ - -getether(ifname, eap) - char *ifname; /* interface name from ifconfig structure */ - char *eap; /* Ether address (output) */ -{ - int rc = -1; - - struct ifreq ifrnit; - int nit; - - bzero((char *) &ifrnit, sizeof(ifrnit)); - strncpy(&ifrnit.ifr_name[0], ifname, IFNAMSIZ); - - nit = open("/dev/nit", 0); - if (nit < 0) { - report(LOG_ERR, "getether: open /dev/nit: %s", - get_errmsg()); - return rc; - } - do { - if (ioctl(nit, NIOCBIND, &ifrnit) < 0) { - report(LOG_ERR, "getether: NIOCBIND on nit"); - break; - } - if (ioctl(nit, SIOCGIFADDR, &ifrnit) < 0) { - report(LOG_ERR, "getether: SIOCGIFADDR on nit"); - break; - } - bcopy(&ifrnit.ifr_addr.sa_data[0], eap, EALEN); - rc = 0; - } while (0); - close(nit); - return rc; -} - -#define GETETHER -#endif /* SUNOS */ - - -#if defined(__FreeBSD__) || defined(__NetBSD__) -/* Thanks to John Brezak <brezak@ch.hp.com> for this code. */ -#include <sys/ioctl.h> -#include <net/if.h> -#include <net/if_dl.h> -#include <net/if_types.h> - -getether(ifname, eap) - char *ifname; /* interface name from ifconfig structure */ - char *eap; /* Ether address (output) */ -{ - int fd, rc = -1; - register int n; - struct ifreq ibuf[16], ifr; - struct ifconf ifc; - register struct ifreq *ifrp, *ifend; - - /* Fetch the interface configuration */ - fd = socket(AF_INET, SOCK_DGRAM, 0); - if (fd < 0) { - report(LOG_ERR, "getether: socket %s: %s", ifname, get_errmsg()); - return (fd); - } - ifc.ifc_len = sizeof(ibuf); - ifc.ifc_buf = (caddr_t) ibuf; - if (ioctl(fd, SIOCGIFCONF, (char *) &ifc) < 0 || - ifc.ifc_len < sizeof(struct ifreq)) { - report(LOG_ERR, "getether: SIOCGIFCONF: %s", get_errmsg); - goto out; - } - /* Search interface configuration list for link layer address. */ - ifrp = ibuf; - ifend = (struct ifreq *) ((char *) ibuf + ifc.ifc_len); - while (ifrp < ifend) { - /* Look for interface */ - if (strcmp(ifname, ifrp->ifr_name) == 0 && - ifrp->ifr_addr.sa_family == AF_LINK && - ((struct sockaddr_dl *) &ifrp->ifr_addr)->sdl_type == IFT_ETHER) { - bcopy(LLADDR((struct sockaddr_dl *) &ifrp->ifr_addr), eap, EALEN); - rc = 0; - break; - } - /* Bump interface config pointer */ - n = ifrp->ifr_addr.sa_len + sizeof(ifrp->ifr_name); - if (n < sizeof(*ifrp)) - n = sizeof(*ifrp); - ifrp = (struct ifreq *) ((char *) ifrp + n); - } - - out: - close(fd); - return (rc); -} - -#define GETETHER -#endif /* __NetBSD__ */ - - -#ifdef SVR4 -/* - * This is for "Streams TCP/IP" by Lachman Associates. - * They sure made this cumbersome! -gwr - */ - -#include <sys/sockio.h> -#include <sys/dlpi.h> -#include <stropts.h> -#ifndef NULL -#define NULL 0 -#endif - -getether(ifname, eap) - char *ifname; /* interface name from ifconfig structure */ - char *eap; /* Ether address (output) */ -{ - int rc = -1; - char devname[32]; - char tmpbuf[sizeof(union DL_primitives) + 16]; - struct strbuf cbuf; - int fd, flags; - union DL_primitives *dlp; - char *enaddr; - int unit = -1; /* which unit to attach */ - - sprintf(devname, "/dev/%s", ifname); - fd = open(devname, 2); - if (fd < 0) { - /* Try without the trailing digit. */ - char *p = devname + 5; - while (isalpha(*p)) - p++; - if (isdigit(*p)) { - unit = *p - '0'; - *p = '\0'; - } - fd = open(devname, 2); - if (fd < 0) { - report(LOG_ERR, "getether: open %s: %s", - devname, get_errmsg()); - return rc; - } - } -#ifdef DL_ATTACH_REQ - /* - * If this is a "Style 2" DLPI, then we must "attach" first - * to tell the driver which unit (board, port) we want. - * For now, decide this based on the device name. - * (Should do "info_req" and check dl_provider_style ...) - */ - if (unit >= 0) { - memset(tmpbuf, 0, sizeof(tmpbuf)); - dlp = (union DL_primitives *) tmpbuf; - dlp->dl_primitive = DL_ATTACH_REQ; - dlp->attach_req.dl_ppa = unit; - cbuf.buf = tmpbuf; - cbuf.len = DL_ATTACH_REQ_SIZE; - if (putmsg(fd, &cbuf, NULL, 0) < 0) { - report(LOG_ERR, "getether: attach: putmsg: %s", get_errmsg()); - goto out; - } - /* Recv the ack. */ - cbuf.buf = tmpbuf; - cbuf.maxlen = sizeof(tmpbuf); - flags = 0; - if (getmsg(fd, &cbuf, NULL, &flags) < 0) { - report(LOG_ERR, "getether: attach: getmsg: %s", get_errmsg()); - goto out; - } - /* - * Check the type, etc. - */ - if (dlp->dl_primitive == DL_ERROR_ACK) { - report(LOG_ERR, "getether: attach: dlpi_errno=%d, unix_errno=%d", - dlp->error_ack.dl_errno, - dlp->error_ack.dl_unix_errno); - goto out; - } - if (dlp->dl_primitive != DL_OK_ACK) { - report(LOG_ERR, "getether: attach: not OK or ERROR"); - goto out; - } - } /* unit >= 0 */ -#endif /* DL_ATTACH_REQ */ - - /* - * Get the Ethernet address the same way the ARP module - * does when it is pushed onto a new stream (bind). - * One should instead be able just do an dl_info_req - * but many drivers do not supply the hardware address - * in the response to dl_info_req (they MUST supply it - * for dl_bind_ack because the ARP module requires it). - */ - memset(tmpbuf, 0, sizeof(tmpbuf)); - dlp = (union DL_primitives *) tmpbuf; - dlp->dl_primitive = DL_BIND_REQ; - dlp->bind_req.dl_sap = 0x8FF; /* XXX - Unused SAP */ - cbuf.buf = tmpbuf; - cbuf.len = DL_BIND_REQ_SIZE; - if (putmsg(fd, &cbuf, NULL, 0) < 0) { - report(LOG_ERR, "getether: bind: putmsg: %s", get_errmsg()); - goto out; - } - /* Recv the ack. */ - cbuf.buf = tmpbuf; - cbuf.maxlen = sizeof(tmpbuf); - flags = 0; - if (getmsg(fd, &cbuf, NULL, &flags) < 0) { - report(LOG_ERR, "getether: bind: getmsg: %s", get_errmsg()); - goto out; - } - /* - * Check the type, etc. - */ - if (dlp->dl_primitive == DL_ERROR_ACK) { - report(LOG_ERR, "getether: bind: dlpi_errno=%d, unix_errno=%d", - dlp->error_ack.dl_errno, - dlp->error_ack.dl_unix_errno); - goto out; - } - if (dlp->dl_primitive != DL_BIND_ACK) { - report(LOG_ERR, "getether: bind: not OK or ERROR"); - goto out; - } - if (dlp->bind_ack.dl_addr_offset == 0) { - report(LOG_ERR, "getether: bind: ack has no address"); - goto out; - } - if (dlp->bind_ack.dl_addr_length < EALEN) { - report(LOG_ERR, "getether: bind: ack address truncated"); - goto out; - } - /* - * Copy the Ethernet address out of the message. - */ - enaddr = tmpbuf + dlp->bind_ack.dl_addr_offset; - memcpy(eap, enaddr, EALEN); - rc = 0; - - out: - close(fd); - return rc; -} - -#define GETETHER -#endif /* SVR4 */ - - -#ifdef linux -/* - * This is really easy on Linux! This version (for linux) - * written by Nigel Metheringham <nigelm@ohm.york.ac.uk> - * - * The code is almost identical to the Ultrix code - however - * the names are different to confuse the innocent :-) - * Most of this code was stolen from the Ultrix bit above. - */ - -#include <sys/ioctl.h> -#include <net/if.h> /* struct ifreq */ - -/* In a properly configured system this should be either sys/socketio.h - or sys/sockios.h, but on my distribution these don't line up correctly */ -#include <linux/sockios.h> /* Needed for IOCTL defs */ - -getether(ifname, eap) - char *ifname, *eap; -{ - int rc = -1; - int fd; - struct ifreq phys; - bzero(&phys, sizeof(phys)); - strcpy(phys.ifr_name, ifname); - if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { - report(LOG_ERR, "getether: socket(INET,DGRAM) failed"); - return -1; - } - if (ioctl(fd, SIOCGIFHWADDR, &phys) < 0) { - report(LOG_ERR, "getether: ioctl SIOCGIFHWADDR failed"); - } else { - bcopy(phys.ifr_hwaddr, eap, EALEN); - rc = 0; - } - close(fd); - return rc; -} - -#define GETETHER -#endif /* linux */ - - -/* If we don't know how on this system, just return an error. */ -#ifndef GETETHER -getether(ifname, eap) - char *ifname, *eap; -{ - return -1; -} - -#endif /* !GETETHER */ - -/* - * Local Variables: - * tab-width: 4 - * c-indent-level: 4 - * c-argdecl-indent: 4 - * c-continued-statement-offset: 4 - * c-continued-brace-offset: -4 - * c-label-offset: -4 - * c-brace-offset: 0 - * End: - */ diff --git a/usr.sbin/bootpd/hwaddr.c b/usr.sbin/bootpd/hwaddr.c deleted file mode 100644 index 840b953..0000000 --- a/usr.sbin/bootpd/hwaddr.c +++ /dev/null @@ -1,294 +0,0 @@ -/* - * hwaddr.c - routines that deal with hardware addresses. - * (i.e. Ethernet) - */ - -#include <sys/types.h> -#include <sys/param.h> -#include <sys/socket.h> -#include <sys/ioctl.h> - -#if defined(SUNOS) || defined(SVR4) -#include <sys/sockio.h> -#endif -#ifdef SVR4 -#include <sys/stream.h> -#include <stropts.h> -#include <fcntl.h> -#endif - -#include <net/if_arp.h> -#include <netinet/in.h> -#include <stdio.h> -#ifndef NO_UNISTD -#include <unistd.h> -#endif -#include <syslog.h> - -#ifndef USE_BFUNCS -/* Yes, memcpy is OK here (no overlapped copies). */ -#include <memory.h> -#define bcopy(a,b,c) memcpy(b,a,c) -#define bzero(p,l) memset(p,0,l) -#define bcmp(a,b,c) memcmp(a,b,c) -#endif - -/* For BSD 4.4, set arp entry by writing to routing socket */ -#if defined(BSD) -#if BSD >= 199306 -extern int bsd_arp_set __P((struct in_addr *, char *, int)); -#endif -#endif - -#include "bptypes.h" -#include "hwaddr.h" -#include "report.h" - -extern int debug; - -/* - * Hardware address lengths (in bytes) and network name based on hardware - * type code. List in order specified by Assigned Numbers RFC; Array index - * is hardware type code. Entries marked as zero are unknown to the author - * at this time. . . . - */ - -struct hwinfo hwinfolist[] = -{ - {0, "Reserved"}, /* Type 0: Reserved (don't use this) */ - {6, "Ethernet"}, /* Type 1: 10Mb Ethernet (48 bits) */ - {1, "3Mb Ethernet"}, /* Type 2: 3Mb Ethernet (8 bits) */ - {0, "AX.25"}, /* Type 3: Amateur Radio AX.25 */ - {1, "ProNET"}, /* Type 4: Proteon ProNET Token Ring */ - {0, "Chaos"}, /* Type 5: Chaos */ - {6, "IEEE 802"}, /* Type 6: IEEE 802 Networks */ - {0, "ARCNET"} /* Type 7: ARCNET */ -}; -int hwinfocnt = sizeof(hwinfolist) / sizeof(hwinfolist[0]); - - -/* - * Setup the arp cache so that IP address 'ia' will be temporarily - * bound to hardware address 'ha' of length 'len'. - */ -void -setarp(s, ia, ha, len) - int s; /* socket fd */ - struct in_addr *ia; - u_char *ha; - int len; -{ -#ifdef SIOCSARP - struct arpreq arpreq; /* Arp request ioctl block */ - struct sockaddr_in *si; -#ifdef SVR4 - int fd; - struct strioctl iocb; -#endif /* SVR4 */ - - bzero((caddr_t) & arpreq, sizeof(arpreq)); - arpreq.arp_flags = ATF_INUSE | ATF_COM; - - /* Set up the protocol address. */ - arpreq.arp_pa.sa_family = AF_INET; - si = (struct sockaddr_in *) &arpreq.arp_pa; - si->sin_addr = *ia; - - /* Set up the hardware address. */ - bcopy(ha, arpreq.arp_ha.sa_data, len); - -#ifdef SVR4 - /* - * And now the stuff for System V Rel 4.x which does not - * appear to allow SIOCxxx ioctls on a socket descriptor. - * Thanks to several people: (all sent the same fix) - * Barney Wolff <barney@databus.com>, - * bear@upsys.se (Bj|rn Sj|holm), - * Michael Kuschke <Michael.Kuschke@Materna.DE>, - */ - if ((fd=open("/dev/arp", O_RDWR)) < 0) { - report(LOG_ERR, "open /dev/arp: %s\n", get_errmsg()); - } - iocb.ic_cmd = SIOCSARP; - iocb.ic_timout = 0; - iocb.ic_dp = (char *)&arpreq; - iocb.ic_len = sizeof(arpreq); - if (ioctl(fd, I_STR, (caddr_t)&iocb) < 0) { - report(LOG_ERR, "ioctl I_STR: %s\n", get_errmsg()); - } - close (fd); - -#else /* SVR4 */ - /* - * On SunOS, the ioctl sometimes returns ENXIO, and it - * appears to happen when the ARP cache entry you tried - * to add is already in the cache. (Sigh...) - * XXX - Should this error simply be ignored? -gwr - */ - if (ioctl(s, SIOCSARP, (caddr_t) & arpreq) < 0) { - report(LOG_ERR, "ioctl SIOCSARP: %s", get_errmsg()); - } -#endif /* SVR4 */ -#else /* SIOCSARP */ -#if defined(BSD) && (BSD >= 199306) - bsd_arp_set(ia, ha, len); -#else /* Not BSD 4.4, and SIOCSARP not defined */ - /* - * Oh well, SIOCSARP is not defined. Just run arp(8). - * XXX - Gag! - */ - char buf[256]; - int status; - - sprintf(buf, "arp -s %s %s temp", - inet_ntoa(*ia), haddrtoa(ha, len)); - if (debug > 2) - report(LOG_INFO, buf); - status = system(buf); - if (status) - report(LOG_ERR, "arp failed, exit code=0x%x", status); - return; -#endif /* ! 4.4 BSD */ -#endif /* SIOCSARP */ -} - - -/* - * Convert a hardware address to an ASCII string. - */ -char * -haddrtoa(haddr, hlen) - u_char *haddr; - int hlen; -{ - static char haddrbuf[3 * MAXHADDRLEN + 1]; - char *bufptr; - - if (hlen > MAXHADDRLEN) - hlen = MAXHADDRLEN; - - bufptr = haddrbuf; - while (hlen > 0) { - sprintf(bufptr, "%02X:", (unsigned) (*haddr++ & 0xFF)); - bufptr += 3; - hlen--; - } - bufptr[-1] = 0; - return (haddrbuf); -} - - -/* - * haddr_conv802() - * -------------- - * - * Converts a backwards address to a canonical address and a canonical address - * to a backwards address. - * - * INPUTS: - * adr_in - pointer to six byte string to convert (unsigned char *) - * addr_len - how many bytes to convert - * - * OUTPUTS: - * addr_out - The string is updated to contain the converted address. - * - * CALLER: - * many - * - * DATA: - * Uses conv802table to bit-reverse the address bytes. - */ - -static u_char conv802table[256] = -{ - /* 0x00 */ 0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, - /* 0x08 */ 0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0, - /* 0x10 */ 0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8, - /* 0x18 */ 0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8, - /* 0x20 */ 0x04, 0x84, 0x44, 0xC4, 0x24, 0xA4, 0x64, 0xE4, - /* 0x28 */ 0x14, 0x94, 0x54, 0xD4, 0x34, 0xB4, 0x74, 0xF4, - /* 0x30 */ 0x0C, 0x8C, 0x4C, 0xCC, 0x2C, 0xAC, 0x6C, 0xEC, - /* 0x38 */ 0x1C, 0x9C, 0x5C, 0xDC, 0x3C, 0xBC, 0x7C, 0xFC, - /* 0x40 */ 0x02, 0x82, 0x42, 0xC2, 0x22, 0xA2, 0x62, 0xE2, - /* 0x48 */ 0x12, 0x92, 0x52, 0xD2, 0x32, 0xB2, 0x72, 0xF2, - /* 0x50 */ 0x0A, 0x8A, 0x4A, 0xCA, 0x2A, 0xAA, 0x6A, 0xEA, - /* 0x58 */ 0x1A, 0x9A, 0x5A, 0xDA, 0x3A, 0xBA, 0x7A, 0xFA, - /* 0x60 */ 0x06, 0x86, 0x46, 0xC6, 0x26, 0xA6, 0x66, 0xE6, - /* 0x68 */ 0x16, 0x96, 0x56, 0xD6, 0x36, 0xB6, 0x76, 0xF6, - /* 0x70 */ 0x0E, 0x8E, 0x4E, 0xCE, 0x2E, 0xAE, 0x6E, 0xEE, - /* 0x78 */ 0x1E, 0x9E, 0x5E, 0xDE, 0x3E, 0xBE, 0x7E, 0xFE, - /* 0x80 */ 0x01, 0x81, 0x41, 0xC1, 0x21, 0xA1, 0x61, 0xE1, - /* 0x88 */ 0x11, 0x91, 0x51, 0xD1, 0x31, 0xB1, 0x71, 0xF1, - /* 0x90 */ 0x09, 0x89, 0x49, 0xC9, 0x29, 0xA9, 0x69, 0xE9, - /* 0x98 */ 0x19, 0x99, 0x59, 0xD9, 0x39, 0xB9, 0x79, 0xF9, - /* 0xA0 */ 0x05, 0x85, 0x45, 0xC5, 0x25, 0xA5, 0x65, 0xE5, - /* 0xA8 */ 0x15, 0x95, 0x55, 0xD5, 0x35, 0xB5, 0x75, 0xF5, - /* 0xB0 */ 0x0D, 0x8D, 0x4D, 0xCD, 0x2D, 0xAD, 0x6D, 0xED, - /* 0xB8 */ 0x1D, 0x9D, 0x5D, 0xDD, 0x3D, 0xBD, 0x7D, 0xFD, - /* 0xC0 */ 0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3, - /* 0xC8 */ 0x13, 0x93, 0x53, 0xD3, 0x33, 0xB3, 0x73, 0xF3, - /* 0xD0 */ 0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB, - /* 0xD8 */ 0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB, - /* 0xE0 */ 0x07, 0x87, 0x47, 0xC7, 0x27, 0xA7, 0x67, 0xE7, - /* 0xE8 */ 0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7, - /* 0xF0 */ 0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF, - /* 0xF8 */ 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF, -}; - -void -haddr_conv802(addr_in, addr_out, len) - register u_char *addr_in, *addr_out; - int len; -{ - u_char *lim; - - lim = addr_out + len; - while (addr_out < lim) - *addr_out++ = conv802table[*addr_in++]; -} - -#if 0 -/* - * For the record, here is a program to generate the - * bit-reverse table above. - */ -static int -bitrev(n) - int n; -{ - int i, r; - - r = 0; - for (i = 0; i < 8; i++) { - r <<= 1; - r |= (n & 1); - n >>= 1; - } - return r; -} - -main() -{ - int i; - for (i = 0; i <= 0xFF; i++) { - if ((i & 7) == 0) - printf("/* 0x%02X */", i); - printf(" 0x%02X,", bitrev(i)); - if ((i & 7) == 7) - printf("\n"); - } -} - -#endif - -/* - * Local Variables: - * tab-width: 4 - * c-indent-level: 4 - * c-argdecl-indent: 4 - * c-continued-statement-offset: 4 - * c-continued-brace-offset: -4 - * c-label-offset: -4 - * c-brace-offset: 0 - * End: - */ diff --git a/usr.sbin/bootpd/rtmsg.c b/usr.sbin/bootpd/rtmsg.c deleted file mode 100644 index 6de6102..0000000 --- a/usr.sbin/bootpd/rtmsg.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright (c) 1984, 1993 - * The Regents of the University of California. All rights reserved. - * Copyright (c) 1994 - * Geoffrey M. Rehmet, All rights reserved. - * - * This code is derived from software which forms part of the 4.4-Lite - * Berkeley software distribution, which was in derived from software - * contributed to Berkeley by Sun Microsystems, Inc. - * - * 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 arp.c 8.2 (Berkeley) 1/2/94 - * $Id$ - */ - -#include <sys/param.h> -/* - * Verify that we are at least 4.4 BSD - */ -#if defined(BSD) -#if BSD >= 199306 - -#include <sys/socket.h> - -#include <net/if.h> -#include <net/if_dl.h> -#include <net/if_types.h> -#include <net/route.h> - -#include <netinet/in.h> -#include <netinet/if_ether.h> - -#include <arpa/inet.h> - -#include <errno.h> -#include <stdio.h> -#include <string.h> -#include <syslog.h> -#include <unistd.h> - -#include "report.h" - - -static int rtmsg __P((int)); - -static int s = -1; /* routing socket */ - - -/* - * Open the routing socket - */ -static void getsocket () { - if (s < 0) { - s = socket(PF_ROUTE, SOCK_RAW, 0); - if (s < 0) { - report(LOG_ERR, "socket %s", strerror(errno)); - exit(1); - } - } -} - -static struct sockaddr_in so_mask = {8, 0, 0, { 0xffffffff}}; -static struct sockaddr_inarp blank_sin = {sizeof(blank_sin), AF_INET }, sin_m; -static struct sockaddr_dl blank_sdl = {sizeof(blank_sdl), AF_LINK }, sdl_m; -static int expire_time, flags, export_only, doing_proxy; -static struct { - struct rt_msghdr m_rtm; - char m_space[512]; -} m_rtmsg; - -/* - * Set an individual arp entry - */ -int bsd_arp_set(ia, eaddr, len) - struct in_addr *ia; - char *eaddr; - int len; -{ - register struct sockaddr_inarp *sin = &sin_m; - register struct sockaddr_dl *sdl; - register struct rt_msghdr *rtm = &(m_rtmsg.m_rtm); - u_char *ea; - struct timeval time; - - getsocket(); - sdl_m = blank_sdl; - sin_m = blank_sin; - sin->sin_addr = *ia; - - ea = (u_char *)LLADDR(&sdl_m); - bcopy(eaddr, ea, len); - sdl_m.sdl_alen = len; - doing_proxy = flags = export_only = expire_time = 0; - - /* make arp entry temporary */ - gettimeofday(&time, 0); - expire_time = time.tv_sec + 20 * 60; - -tryagain: - if (rtmsg(RTM_GET) < 0) { - report(LOG_WARNING, "rtmget: %s", strerror(errno)); - return (1); - } - sin = (struct sockaddr_inarp *)(rtm + 1); - sdl = (struct sockaddr_dl *)(sin->sin_len + (char *)sin); - if (sin->sin_addr.s_addr == sin_m.sin_addr.s_addr) { - if (sdl->sdl_family == AF_LINK && - (rtm->rtm_flags & RTF_LLINFO) && - !(rtm->rtm_flags & RTF_GATEWAY)) switch (sdl->sdl_type) { - case IFT_ETHER: case IFT_FDDI: case IFT_ISO88023: - case IFT_ISO88024: case IFT_ISO88025: - goto overwrite; - } - if (doing_proxy == 0) { - report(LOG_WARNING, "set: can only proxy for %s\n", - inet_ntoa(sin->sin_addr)); - return (1); - } - if (sin_m.sin_other & SIN_PROXY) { - report(LOG_WARNING, - "set: proxy entry exists for non 802 device\n"); - return(1); - } - sin_m.sin_other = SIN_PROXY; - export_only = 1; - goto tryagain; - } -overwrite: - if (sdl->sdl_family != AF_LINK) { - report(LOG_WARNING, - "cannot intuit interface index and type for %s\n", - inet_ntoa(sin->sin_addr)); - return (1); - } - sdl_m.sdl_type = sdl->sdl_type; - sdl_m.sdl_index = sdl->sdl_index; - return (rtmsg(RTM_ADD)); -} - - -static int rtmsg(cmd) - int cmd; -{ - static int seq; - int rlen; - register struct rt_msghdr *rtm = &m_rtmsg.m_rtm; - register char *cp = m_rtmsg.m_space; - register int l; - - errno = 0; - bzero((char *)&m_rtmsg, sizeof(m_rtmsg)); - rtm->rtm_flags = flags; - rtm->rtm_version = RTM_VERSION; - - switch (cmd) { - default: - report(LOG_ERR, "set_arp: internal wrong cmd - exiting"); - exit(1); - case RTM_ADD: - rtm->rtm_addrs |= RTA_GATEWAY; - rtm->rtm_rmx.rmx_expire = expire_time; - rtm->rtm_inits = RTV_EXPIRE; - rtm->rtm_flags |= (RTF_HOST | RTF_STATIC); - sin_m.sin_other = 0; - if (doing_proxy) { - if (export_only) - sin_m.sin_other = SIN_PROXY; - else { - rtm->rtm_addrs |= RTA_NETMASK; - rtm->rtm_flags &= ~RTF_HOST; - } - } - /* FALLTHROUGH */ - case RTM_GET: - rtm->rtm_addrs |= RTA_DST; - } -#define NEXTADDR(w, s) \ - if (rtm->rtm_addrs & (w)) { \ - bcopy((char *)&s, cp, sizeof(s)); cp += sizeof(s);} - - NEXTADDR(RTA_DST, sin_m); - NEXTADDR(RTA_GATEWAY, sdl_m); - NEXTADDR(RTA_NETMASK, so_mask); - - rtm->rtm_msglen = cp - (char *)&m_rtmsg; - - l = rtm->rtm_msglen; - rtm->rtm_seq = ++seq; - rtm->rtm_type = cmd; - if ((rlen = write(s, (char *)&m_rtmsg, l)) < 0) { - if ((errno != ESRCH) && !(errno == EEXIST && cmd == RTM_ADD)){ - report(LOG_WARNING, "writing to routing socket: %s", - strerror(errno)); - return (-1); - } - } - do { - l = read(s, (char *)&m_rtmsg, sizeof(m_rtmsg)); - } while (l > 0 && (rtm->rtm_seq != seq || rtm->rtm_pid != getpid())); - if (l < 0) - report(LOG_WARNING, "arp: read from routing socket: %s\n", - strerror(errno)); - return (0); -} - -#endif /* BSD */ -#endif /* BSD >= 199306 */ diff --git a/usr.sbin/bootpef/Makefile b/usr.sbin/bootpef/Makefile deleted file mode 100644 index 4abb5f1..0000000 --- a/usr.sbin/bootpef/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# bootpef/Makefile -# $Id: Makefile,v 1.2 1994/09/10 15:00:04 csgr Exp $ - -PROG= bootpef -SRCDIR= ${.CURDIR}/../bootpd -#CFLAGS+= -DETC_ETHERS -CFLAGS+= -DDEBUG -I${SRCDIR} -.PATH: ${SRCDIR} -MANSRC= ${SRCDIR} - -SRCS= bootpef.c dovend.c readfile.c hash.c dumptab.c \ - lookup.c hwaddr.c report.c rtmsg.c tzone.c - -MAN8= bootpef.8 - -.include <bsd.prog.mk> - diff --git a/usr.sbin/bootpgw/Makefile b/usr.sbin/bootpgw/Makefile deleted file mode 100644 index 6be63f6..0000000 --- a/usr.sbin/bootpgw/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# bootpgw/Makefile -# $Id: Makefile,v 1.1.1.1 1994/09/10 14:44:56 csgr Exp $ - -PROG= bootpgw -SRCDIR= ${.CURDIR}/../bootpd -CFLAGS+= -DSYSLOG -DDEBUG -I${SRCDIR} -.PATH: ${SRCDIR} - -SRCS= bootpgw.c getif.c hwaddr.c report.c rtmsg.c - -MAN8= - -.include <bsd.prog.mk> - diff --git a/usr.sbin/bootptest/Makefile b/usr.sbin/bootptest/Makefile deleted file mode 100644 index 35e9867..0000000 --- a/usr.sbin/bootptest/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -# bootptest/Makefile -# $Id: Makefile,v 1.3 1994/08/22 22:19:04 gwr Exp $ - -PROG= bootptest -SRCDIR= ${.CURDIR}/../bootpd -CFLAGS+= -I${SRCDIR} -.PATH: ${SRCDIR} -MANSRC= ${SRCDIR} - -SRCS= bootptest.c print-bootp.c getif.c getether.c report.c - -MAN8= bootptest.8 - -.include <bsd.prog.mk> - diff --git a/usr.sbin/dbsym/Makefile b/usr.sbin/dbsym/Makefile deleted file mode 100644 index e1fbf2c..0000000 --- a/usr.sbin/dbsym/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# $Id$ - -PROG= dbsym -NOMAN= noman - -.include <bsd.prog.mk> diff --git a/usr.sbin/dbsym/dbsym.c b/usr.sbin/dbsym/dbsym.c deleted file mode 100644 index 833627c..0000000 --- a/usr.sbin/dbsym/dbsym.c +++ /dev/null @@ -1,255 +0,0 @@ -/* Written by Pace Willisson (pace@blitz.com) - * and placed in the public domain. - */ - -#ifndef lint -static char rcsid[] = "$Id: dbsym.c,v 1.3 1994/01/19 03:52:25 nate Exp $"; -#endif /* not lint */ - -#include <stdio.h> -#include <stdlib.h> -#include <a.out.h> -#include <stab.h> -#include <machine/param.h> -#include <vm/vm_param.h> -#include <vm/lock.h> -#include <vm/pmap.h> -#include <machine/pmap.h> -#include <machine/vmparam.h> - -#define FILE_OFFSET(vadr) (((vadr) - text_adr) - N_DATADDR(hdr) + \ - N_DATOFF(hdr) + N_TXTADDR(hdr)) - -u_int text_adr = KERNBASE; - -struct nlist *old_syms; -int num_old_syms; -char *old_strtab; -int old_strtab_size; - -struct nlist *new_syms; -int num_new_syms; -int new_syms_bytes; -char *new_strtab; -int new_strtab_size; - -int db_symtabsize_adr; -int db_symtab_adr; - -int avail; - -int force = 0; -int zap_locals = 0; -int debugging = 0; - -usage () -{ - fprintf (stderr, "usage: dbsym [-fgx] [-T addr] file\n"); - exit (1); -} - -struct exec hdr; - -main (argc, argv) -char **argv; -{ - FILE *f; - char *name; - extern int optind; - int c, i; - int need; - char *buf, *p; - struct nlist *nsp, *sp; - int len; - - - while ((c = getopt (argc, argv, "fgxT:")) != EOF) { - switch (c) { - case 'f': - force = 1; - break; - case 'g': - debugging = 1; - break; - case 'x': - zap_locals = 1; - break; - case 'T': - text_adr = strtoul(optarg, &p, 16); - if (*p) - err("illegal text address: %s", optarg); - break; - default: - usage (); - } - } - - if (optind >= argc) - usage (); - - name = argv[optind++]; - - if (optind != argc) - usage (); - - if ((f = fopen (name, "r+")) == NULL) { - fprintf (stderr, "can't open %s\n", name); - exit (1); - } - - if (fread ((char *)&hdr, sizeof hdr, 1, f) != 1) { - fprintf (stderr, "can't read header\n"); - exit (1); - } - - if (N_BADMAG (hdr)) { - fprintf (stderr, "bad magic number\n"); - exit (1); - } - - if (hdr.a_syms == 0) { - fprintf (stderr, "no symbols\n"); - exit (1); - } - - fseek (f, N_STROFF (hdr), 0); - if (fread ((char *)&old_strtab_size, sizeof (int), 1, f) != 1) { - fprintf (stderr, "can't read old strtab size\n"); - exit (1); - } - - if ((old_syms = (struct nlist *)malloc (hdr.a_syms)) == NULL - || ((old_strtab = malloc (old_strtab_size)) == NULL) - || ((new_syms = (struct nlist *)malloc (hdr.a_syms)) == NULL) - || ((new_strtab = malloc (old_strtab_size)) == NULL)) { - fprintf (stderr, "out of memory\n"); - exit (1); - } - - fseek (f, N_SYMOFF (hdr), 0); - if (fread ((char *)old_syms, hdr.a_syms, 1, f) != 1) { - fprintf (stderr, "can't read symbols\n"); - exit (1); - } - - fseek (f, N_STROFF (hdr), 0); - if (fread ((char *)old_strtab, old_strtab_size, 1, f) != 1) { - fprintf (stderr, "can't read string table\n"); - exit (1); - } - - num_old_syms = hdr.a_syms / sizeof (struct nlist); - - new_strtab_size = 4; - - nsp = new_syms; - for (i = 0, sp = old_syms; i < num_old_syms; i++, sp++) { - if (zap_locals && !(sp->n_type & N_EXT)) - continue; - - if (sp->n_type & N_STAB) - switch (sp->n_type & ~N_EXT) { - case N_SLINE: - if (debugging) - *nsp++ = *sp; - continue; - case N_FUN: - case N_PSYM: - case N_SO: - if (!debugging) - continue; - goto skip_tests; - break; - default: - continue; - } - - if ((sp->n_type & ~N_EXT) == N_UNDF) - continue; - - if (!debugging && (sp->n_type & ~N_EXT) == N_FN) - continue; - - if (sp->n_un.n_strx == 0) - continue; - - if (sp->n_value < text_adr) - continue; - - if (sp->n_value > (text_adr + hdr.a_text + hdr.a_data + - hdr.a_bss)) - continue; - - skip_tests: - - name = old_strtab + sp->n_un.n_strx; - - len = strlen (name); - - if (len == 0) - continue; - - if (strcmp (name, "gcc_compiled.") == 0) - continue; - - if (strcmp (name, "gcc2_compiled.") == 0) - continue; - - if (strcmp (name, "___gnu_compiled_c") == 0) - continue; - - *nsp = *sp; - - nsp->n_un.n_strx = new_strtab_size; - strcpy (new_strtab + new_strtab_size, name); - new_strtab_size += len + 1; - nsp++; - - if (strcmp (name, "_db_symtab") == 0) - db_symtab_adr = sp->n_value; - if (strcmp (name, "_db_symtabsize") == 0) - db_symtabsize_adr = sp->n_value; - } - - if (db_symtab_adr == 0 || db_symtabsize_adr == 0) - if (!force) { - fprintf (stderr, "couldn't find db_symtab symbols\n"); - exit (1); - } else - exit (0); - - *(int *)new_strtab = new_strtab_size; - num_new_syms = nsp - new_syms; - new_syms_bytes = num_new_syms * sizeof (struct nlist); - - need = sizeof (int) - + num_new_syms * sizeof (struct nlist) - + new_strtab_size; - - fseek (f, FILE_OFFSET (db_symtabsize_adr), 0); - - if (fread ((char *)&avail, sizeof (int), 1, f) != 1) { - fprintf (stderr, "can't read symtabsize\n"); - exit (1); - } - - printf ("dbsym: need %d; avail %d\n", need, avail); - - if (need > avail) { - fprintf (stderr, "not enough room in db_symtab array\n"); - exit (1); - } - - fseek (f, FILE_OFFSET (db_symtab_adr), 0); - fwrite ((char *)&new_syms_bytes, sizeof (int), 1, f); - fwrite ((char *)new_syms, new_syms_bytes, 1, f); - fwrite (new_strtab, new_strtab_size, 1, f); - fflush (f); - - if (feof (f) || ferror (f)) { - fprintf (stderr, "write error\n"); - exit (1); - } - exit (0); -} - diff --git a/usr.sbin/named/tools/nsquery/Makefile b/usr.sbin/named/tools/nsquery/Makefile deleted file mode 100644 index 5263aa1..0000000 --- a/usr.sbin/named/tools/nsquery/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# @(#)Makefile 5.1 (Berkeley) 5/28/90 - -PROG= nsquery -NOMAN= noman - -.include "../../../Makefile.inc" -.include <bsd.prog.mk> diff --git a/usr.sbin/named/tools/nsquery/nsquery.c b/usr.sbin/named/tools/nsquery/nsquery.c deleted file mode 100644 index c1ac28e..0000000 --- a/usr.sbin/named/tools/nsquery/nsquery.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * ++Copyright++ 1986 - * - - * Copyright (c) 1986 - * 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. - * - - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies, and that - * the name of Digital Equipment Corporation not be used in advertising or - * publicity pertaining to distribution of the document or software without - * specific, written prior permission. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT - * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - - * --Copyright-- - */ - -#ifndef lint -char copyright[] = -"@(#) Copyright (c) 1986 Regents of the University of California.\n\ - portions Copyright (c) 1993 Digital Equipment Corporation\n\ - All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint -static char sccsid[] = "@(#)nsquery.c 4.8 (Berkeley) 6/1/90"; -static char rcsid[] = "$Id: nsquery.c,v 1.2 1994/09/22 20:45:28 pst Exp $"; -#endif /* not lint */ - -#include <sys/param.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/nameser.h> -#include <arpa/inet.h> -#include <stdio.h> -#include <netdb.h> -#include <resolv.h> -#include <string.h> - -main(argc, argv) - int argc; - char **argv; -{ - extern struct __res_state _res; - register struct hostent *hp; - register char *s; - - res_init(); - - if (argc >= 2 && strcmp(argv[1], "-d") == 0) { - _res.options |= RES_DEBUG; - argc--; - argv++; - } - if (argc < 2) { - fprintf(stderr, "usage: nsquery [-d] host [server]\n"); - exit(1); - } - if (argc == 3) { - hp = gethostbyname(argv[2]); - if (hp == NULL) { - fprintf(stderr, "nsquery:"); - herror(argv[2]); - exit(1); - } - printf("\nServer:\n"); - printanswer(hp); - _res.nsaddr.sin_addr = *(struct in_addr *)hp->h_addr; -#ifdef nsaddr /* struct __res_state includes nscount and nsaddr_list[] */ - _res.nscount = 1; -#endif - } - - hp = gethostbyname(argv[1]); - if (hp == NULL) { - fprintf(stderr, "nsquery: %s: ", argv[1]); - herror((char *)NULL); - exit(1); - } - printanswer(hp); - exit(0); -} - -printanswer(hp) - register struct hostent *hp; -{ - register char **cp; - - printf("Name: %s\n", hp->h_name); -#if BSD >= 43 || defined(h_addr) - printf("Addresses:"); - for (cp = hp->h_addr_list; cp && *cp; cp++) - printf(" %s", inet_ntoa(*(struct in_addr *)(*cp))); - printf("\n"); -#else - printf("Address: %s\n", inet_ntoa(*(struct in_addr *)hp->h_addr)); -#endif - printf("Aliases:"); - for (cp = hp->h_aliases; cp && *cp && **cp; cp++) - printf(" %s", *cp); - printf("\n\n"); -} diff --git a/usr.sbin/named/tools/nstest/Makefile b/usr.sbin/named/tools/nstest/Makefile deleted file mode 100644 index e976d52..0000000 --- a/usr.sbin/named/tools/nstest/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# @(#)Makefile 5.1 (Berkeley) 5/28/90 - -PROG= nstest -NOMAN= noman - -.include "../../../Makefile.inc" -.include <bsd.prog.mk> diff --git a/usr.sbin/named/tools/nstest/nstest.c b/usr.sbin/named/tools/nstest/nstest.c deleted file mode 100644 index d40e748..0000000 --- a/usr.sbin/named/tools/nstest/nstest.c +++ /dev/null @@ -1,423 +0,0 @@ -/* - * ++Copyright++ 1986 - * - - * Copyright (c) 1986 - * 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. - * - - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies, and that - * the name of Digital Equipment Corporation not be used in advertising or - * publicity pertaining to distribution of the document or software without - * specific, written prior permission. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT - * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - - * --Copyright-- - */ - -#ifndef lint -char copyright[] = -"@(#) Copyright (c) 1986 Regents of the University of California.\n\ - portions Copyright (c) 1993 Digital Equipment Corporation\n\ - All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint -static char sccsid[] = "@(#)nstest.c 4.15 (Berkeley) 3/21/91"; -static char rcsid[] = "$Id: nstest.c,v 1.2 1994/09/22 20:45:31 pst Exp $"; -#endif /* not lint */ - -#include <sys/param.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#include <arpa/nameser.h> -#include <stdio.h> -#include <resolv.h> - -char *progname; -FILE *log; -#define MAXDATA 256 /* really should get this from named/db.h */ -main(argc, argv) - char **argv; -{ - register char *cp; - register u_char *ucp; - struct hostent *hp; - u_short port = htons(NAMESERVER_PORT); - char buf[BUFSIZ]; - u_char packet[PACKETSZ], answer[8*1024], OldRRData[MAXDATA]; - struct rrec NewRR; - u_int32_t l; - int n, dump_packet; - - NewRR.r_data = (char *) malloc(MAXDATA); - NewRR.r_data = (char *) malloc(MAXDATA); - progname = argv[0]; - dump_packet = 0; - _res.options |= RES_DEBUG|RES_RECURSE; - (void) res_init(); - while (argc > 1 && argv[1][0] == '-') { - argc--; - cp = *++argv; - while (*++cp) - switch (*cp) { - case 'p': - if (--argc <= 0) - usage(); - port = htons(atoi(*++argv)); - break; - - case 'i': - _res.options |= RES_IGNTC; - break; - - case 'v': - _res.options |= RES_USEVC|RES_STAYOPEN; - break; - - case 'r': - _res.options &= ~RES_RECURSE; - break; - - case 'd': - dump_packet++; - break; - - default: - usage(); - } - } - _res.nsaddr.sin_family = AF_INET; - _res.nsaddr.sin_addr = inet_makeaddr(IN_LOOPBACKNET, 1); - _res.nsaddr.sin_port = port; - if (argc > 1) { - if (!inet_aton(argv[1], - (struct in_addr *)&_res.nsaddr.sin_addr)) - usage(); - } - if (argc > 2) { - log = fopen(argv[2],"w"); - if (log == NULL) perror(argv[2]); - } - for (;;) { - printf("> "); - fflush(stdout); - if ((cp = fgets(buf, sizeof buf, stdin)) == NULL) - break; - switch (*cp++) { - case 'a': - n = res_mkquery(QUERY, cp, C_IN, T_A, NULL, 0, - NULL, packet, sizeof packet); - break; - - case 'A': - n = ntohl(inet_addr(cp)); - putlong((u_int32_t)n, (u_char*)cp); - n = res_mkquery(IQUERY, "", C_IN, T_A, (u_char *)cp, - INT32SZ, NULL, - packet, sizeof(packet)); - break; - - case 'f': - n = res_mkquery(QUERY, cp, C_ANY, T_UINFO, NULL, - 0, NULL, packet, sizeof packet); - break; - - case 'F': - n = res_mkquery(QUERY, cp, C_IN, T_AFSDB, NULL, 0, - NULL, packet, sizeof packet); - break; - - case 'g': - n = res_mkquery(QUERY, cp, C_ANY, T_GID, NULL, 0, - NULL, packet, sizeof packet); - break; - - case 'G': - *(int *)cp = htonl(atoi(cp)); - n = res_mkquery(IQUERY, "", C_ANY, T_GID, (u_char *)cp, - sizeof(int), NULL, packet, sizeof packet); - break; - - case 'c': - n = res_mkquery(QUERY, cp, C_IN, T_CNAME, NULL, 0, - NULL, packet, sizeof packet); - break; - - case 'h': - n = res_mkquery(QUERY, cp, C_IN, T_HINFO, NULL, 0, - NULL, packet, sizeof packet); - break; - - case 'm': - n = res_mkquery(QUERY, cp, C_IN, T_MX, NULL, 0, - NULL, packet, sizeof packet); - break; - - case 'M': - n = res_mkquery(QUERY, cp, C_IN, T_MAILB, NULL, 0, - NULL, packet, sizeof packet); - break; - - case 'n': - n = res_mkquery(QUERY, cp, C_IN, T_NS, NULL, 0, - NULL, packet, sizeof packet); - break; - - case 'p': - n = res_mkquery(QUERY, cp, C_IN, T_PTR, NULL, 0, - NULL, packet, sizeof packet); - break; - - case 's': - n = res_mkquery(QUERY, cp, C_IN, T_SOA, NULL, 0, - NULL, packet, sizeof packet); - break; - - case 'T': - n = res_mkquery(QUERY, cp, C_IN, T_TXT, NULL, 0, - NULL, packet, sizeof packet); - break; - - case 'u': - n = res_mkquery(QUERY, cp, C_ANY, T_UID, NULL, 0, - NULL, packet, sizeof packet); - break; - - case 'U': - *(int *)cp = htonl(atoi(cp)); - n = res_mkquery(IQUERY, "", C_ANY, T_UID, (u_char *)cp, - sizeof(int), NULL, - packet, sizeof packet); - break; - - case 'x': - n = res_mkquery(QUERY, cp, C_IN, T_AXFR, NULL, 0, - NULL, packet, sizeof packet); - break; - - case 'w': - n = res_mkquery(QUERY, cp, C_IN, T_WKS, NULL, 0, - NULL, packet, sizeof packet); - break; - - case 'b': - n = res_mkquery(QUERY, cp, C_IN, T_MB, NULL, 0, - NULL, packet, sizeof packet); - break; - - case 'B': - n = res_mkquery(QUERY, cp, C_IN, T_MG, NULL, 0, - NULL, packet, sizeof packet); - break; - - case 'i': - n = res_mkquery(QUERY, cp, C_IN, T_MINFO, NULL, 0, - NULL, packet, sizeof packet); - break; - - case 'r': - n = res_mkquery(QUERY, cp, C_IN, T_MR, NULL, 0, - NULL, packet, sizeof packet); - break; - - case '*': - n = res_mkquery(QUERY, cp, C_IN, T_ANY, NULL, 0, - NULL, packet, sizeof packet); - break; - -#ifdef ALLOW_UPDATES - case '^': - { - char IType[10], TempStr[50]; - int Type, oldnbytes, nbytes, i; -#ifdef ALLOW_T_UNSPEC - printf("Data type (a = T_A, u = T_UNSPEC): "); - gets(IType); - if (IType[0] == 'u') { - Type = T_UNSPEC; - printf("How many data bytes? "); - gets(TempStr); /* Throw away CR */ - sscanf(TempStr, "%d", &nbytes); - for (i = 0; i < nbytes; i++) { - (NewRR.r_data)[i] = (char) i; - } - } else { -#endif /* ALLOW_T_UNSPEC */ - Type = T_A; - nbytes = INT32SZ; - printf( - "Inet addr for new dname (e.g., 192.4.3.2): " - ); - gets(TempStr); - putlong(ntohl(inet_addr(TempStr)), - NewRR.r_data); -#ifdef ALLOW_T_UNSPEC - } -#endif - NewRR.r_class = C_IN; - NewRR.r_type = Type; - NewRR.r_size = nbytes; - NewRR.r_ttl = 99999999; - printf("Add, modify, or modify all (a/m/M)? "); - gets(TempStr); - if (TempStr[0] == 'a') { - n = res_mkquery(UPDATEA, cp, C_IN, Type, - OldRRData, nbytes, - &NewRR, packet, - sizeof packet); - } else { - if (TempStr[0] == 'm') { - printf("How many data bytes in old RR? "); - gets(TempStr); /* Throw away CR */ - sscanf(TempStr, "%d", &oldnbytes); - for (i = 0; i < oldnbytes; i++) { - OldRRData[i] = (char) i; - } - n = res_mkquery(UPDATEM, cp, - C_IN, Type, - OldRRData, oldnbytes, - &NewRR, packet, - sizeof packet); - } else { /* Modify all */ - n = res_mkquery(UPDATEMA, cp, - C_IN, Type, NULL, 0, - &NewRR, packet, - sizeof packet); - - } - } - } - break; - -#ifdef ALLOW_T_UNSPEC - case 'D': - n = res_mkquery(UPDATEDA, cp, C_IN, T_UNSPEC, - (char *)0, 0, NULL, - packet, sizeof packet); - break; - - case 'd': - { - char TempStr[100]; - int nbytes, i; - printf("How many data bytes in oldrr data? "); - gets(TempStr); /* Throw away CR */ - sscanf(TempStr, "%d", &nbytes); - for (i = 0; i < nbytes; i++) { - OldRRData[i] = (char) i; - } - n = res_mkquery(UPDATED, cp, C_IN, T_UNSPEC, - OldRRData, nbytes, NULL, - packet, sizeof packet); - } - break; -#endif /* ALLOW_T_UNSPEC */ -#endif /* ALLOW_UPDATES */ - - default: - printf("a{host} - query T_A\n"); - printf("A{addr} - iquery T_A\n"); - printf("b{user} - query T_MB\n"); - printf("B{user} - query T_MG\n"); - printf("f{host} - query T_UINFO\n"); - printf("g{host} - query T_GID\n"); - printf("G{gid} - iquery T_GID\n"); - printf("h{host} - query T_HINFO\n"); - printf("i{host} - query T_MINFO\n"); - printf("p{host} - query T_PTR\n"); - printf("m{host} - query T_MX\n"); - printf("M{host} - query T_MAILB\n"); - printf("n{host} - query T_NS\n"); - printf("r{host} - query T_MR\n"); - printf("s{host} - query T_SOA\n"); - printf("T{host} - query T_TXT\n"); - printf("u{host} - query T_UID\n"); - printf("U{uid} - iquery T_UID\n"); - printf("x{host} - query T_AXFR\n"); - printf("w{host} - query T_WKS\n"); - printf("F{host} - query T_AFSDB\n"); - printf("c{host} - query T_CNAME\n"); - printf("*{host} - query T_ANY\n"); -#ifdef ALLOW_UPDATES - printf("^{host} - add/mod/moda (T_A/T_UNSPEC)\n"); -#ifdef ALLOW_T_UNSPEC - printf("D{host} - deletea T_UNSPEC\n"); - printf("d{host} - delete T_UNSPEC\n"); -#endif /* ALLOW_T_UNSPEC */ -#endif /* ALLOW_UPDATES */ - continue; - } - if (n < 0) { - printf("res_mkquery: buffer too small\n"); - continue; - } - if (log) { - fprintf(log,"SEND QUERY\n"); - fp_query(packet, log); - } - n = res_send(packet, n, answer, sizeof(answer)); - if (n < 0) { - printf("res_send: send error\n"); - if (log) fprintf(log, "res_send: send error\n"); - } - else { - if (dump_packet) { - int f; - f = creat("ns_packet.dump", 0644); - write(f, answer, n); - (void) close(f); - } - if (log) { - fprintf(log, "GOT ANSWER\n"); - fp_query(answer, log); - } - } - } -} - -usage() -{ - fprintf(stderr, "Usage: %s [-v] [-i] [-r] [-d] [-p port] hostaddr\n", - progname); - exit(1); -} diff --git a/usr.sbin/pkg_install/+COMMENT b/usr.sbin/pkg_install/+COMMENT deleted file mode 100644 index d29a496..0000000 --- a/usr.sbin/pkg_install/+COMMENT +++ /dev/null @@ -1 +0,0 @@ -Package install (source), version 0.5
\ No newline at end of file diff --git a/usr.sbin/pkg_install/+CONTENTS b/usr.sbin/pkg_install/+CONTENTS deleted file mode 100644 index ff4d7d9..0000000 --- a/usr.sbin/pkg_install/+CONTENTS +++ /dev/null @@ -1,2 +0,0 @@ -@cwd /usr/ports -pkg_install diff --git a/usr.sbin/pkg_install/+DESC b/usr.sbin/pkg_install/+DESC deleted file mode 100644 index dd42917..0000000 --- a/usr.sbin/pkg_install/+DESC +++ /dev/null @@ -1,5 +0,0 @@ -This is the pkg_install suite of tools for doing maintainance of -software "packages". More documentation is available in the man pages -for each individual command. - -This is pkg_install version 0.5. diff --git a/usr.sbin/pkg_install/pkg b/usr.sbin/pkg_install/pkg deleted file mode 100755 index f3e53c9..0000000 --- a/usr.sbin/pkg_install/pkg +++ /dev/null @@ -1,158 +0,0 @@ -#!/usr/local/bin/wish -f -#$Id: pkg,v 1.6 1993/09/03 23:37:22 rich Exp $ -# -#$Log: pkg,v $ -# Revision 1.6 1993/09/03 23:37:22 rich -# warn user if no tar archives are found in the current directory. -# removed the revision string from the lower text frame. -# -# Revision 1.5 1993/09/03 15:48:04 rich -# glob for .tar.gz, .tar.z and .tar.Z looking for archives -# -# Revision 1.4 1993/08/28 15:53:59 rich -# added version and date info to lower text window. -# -# Revision 1.3 1993/08/28 15:47:12 rich -# filtered out ^Ls in pkg_* output. -# -# -set pkgname "" -wm title . "Package Installation" -#-------------------------------------------------------------- -# The top level main window, consisting of a bar of buttons and a list -# of packages and a description of the current package. -#-------------------------------------------------------------- -frame .menu -relief raised -borderwidth 1 -frame .frame -borderwidth 4 - -scrollbar .frame.scroll -relief sunken -command ".frame.list yview" -listbox .frame.list -yscroll ".frame.scroll set" -relief sunken -setgrid 1 -pack append .frame .frame.scroll {right filly} \ - .frame.list {left expand fill} - -# build the lower window shoing the complete description of a pacage -frame .f -borderwidth 4 -text .f.t -width 80 -height 20 -yscrollcommand ".f.s set" -relief sunken - -# Initially display instructions in this window. Erase the -# instructions and show the package description when the user clicks -# on a package. -# -.f.t insert end "Double click on a package above to see it's -complete description here." -scrollbar .f.s -relief sunken -command ".f.t yview" -pack append .f .f.s {right filly} .f.t {left expand fill} - -bind .frame.list <Double-Button-1> \ - {foreach i [selection get] {do_description $i}} -pack append . .menu {top fill} \ - .f {bottom expand fill} \ - .frame {bottom expand fill} - -#---------------------------------------------------------------- -# Make menu bar: -#---------------------------------------------------------------- -button .menu.inst -text "Install" \ - -command "apply_to_pkg \"pkg_add -v\"" -button .menu.dein -text "Deinstall" \ - -command "apply_to_pkg \"pkg_delete -v\"" -button .menu.installed -text "What is Installed?" \ - -command "list_pkgs \"pkg_info -I -a |tr ' ' ' '\"" -button .menu.available -text "What can I install?" \ - -command "list_pkgs \"pkg_info -I -c [glob -nocomplain *.{tgz,tar.z,tar.gz,tar.Z}] |tr ' ' ' '\"" -button .menu.cont -text "Contents?" \ - -command "global pkgname; apply_to_pkg \"pkg_info -d -v |tr -d ''\"" -button .menu.quit -text "Quit" -command "destroy ." -button .menu.help -text "Help" -command "do_help" - -pack append .menu \ - .menu.inst left \ - .menu.dein left \ - .menu.installed left \ - .menu.available left \ - .menu.cont left \ - .menu.quit left \ - .menu.help right -#------------------------------------------------------- -# Display the package description. -#------------------------------------------------------- -proc list_pkgs {s} { - set line "" - set f [eval "open {| csh -c \"$s\" } r"] - .frame.list delete 0 end - while {[gets $f line] > 0} { - .frame.list insert end $line - } - close $f -} - -# display the list of available packages -set archives [glob -nocomplain *.{tgz,tar.z,tar.gz,tar.Z}] -if {$pkgname == ""} { - .frame.list delete 0 end - .frame.list insert end "Warning: no compressed tar archives files found." -} else { - list_pkgs "pkg_info -I -c $archives |tr ' ' ' '" -} - -#------------------------------------------------------- -# Display the package description. -#------------------------------------------------------- -proc do_description {s} { - global pkgname - regexp {[^ ]*} $s filename - set pkgname $filename - .f.t delete 0.0 end - set cmd "pkg_info -d $filename |tr -d ''" - set f [eval "open {| csh -c \"$cmd\" } r"] - while {![eof $f]} { - .f.t insert end [read $f] - } -} -#------------------------------------------------------- -# package install window. -#------------------------------------------------------- -proc do_help {{w .help}} { - catch {destroy $w} - toplevel $w - wm title $w "Help" - wm iconname $w "Help" - button $w.ok -text OK -command "destroy $w" - message $w.t -relief raised -bd 2 \ - -text "You can install, deinstall and list info on the available packages. To select a package and see it's complete description, press mouse button 1 over the package name. To install a selected package, press the Install button. To exit, press the \"Quit\" button." - pack append $w $w.ok {bottom fillx} $w.t {expand fill} -} -#------------------------------------------------------- -# Apply a command to a package. -#------------------------------------------------------- -proc apply_to_pkg {s} { - global pkgname - .f.t delete 0.0 end - if {$pkgname == ""} { - .f.t insert end "You must double click on a package name first!" - } else { - .f.t delete 0.0 end - .f.t insert end "Running: $s $pkgname\n" - set f [eval "open {| $s $pkgname} r"] - while {![eof $f]} { - .f.t insert end [read $f 64] - } - } -} -#------------------------------------------------------- -# Invoke an arbitrary command. -#------------------------------------------------------- -proc do_command {s} { - .f.t delete 0.0 end - .f.t insert end "Running: $s\n" - set f [eval "open {| $s} r"] - while {![eof $f]} { - .f.t insert end [read $f 64] - } -} -# local variables: -# mode: csh -# compile-command: "" -# comment-start: "# " -# comment-start-skip: "# " -# end: diff --git a/usr.sbin/rarpd/ether_addr.c b/usr.sbin/rarpd/ether_addr.c deleted file mode 100644 index 7404c81..0000000 --- a/usr.sbin/rarpd/ether_addr.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - * ethernet address conversion and lookup routines - * - * Written by Bill Paul <wpaul@ctr.columbia.edu> - * Center for Telecommunications Research - * Columbia University, New York City - * - * This code is public domain. There is no copyright. There are no - * distribution or usage restrictions. There are no strings attached. - * - * Have a party. - * - * $Id: ether_addr.c,v 1.4 1995/03/05 22:03:58 wpaul Exp $ - */ - - -#include <stdio.h> -#include <sys/types.h> -#include <string.h> -#include <sys/param.h> - -#ifndef _PATH_ETHERS -#define _PATH_ETHERS "/etc/ethers" -#endif - -/* - * This should be defined in <netinet/if_ether.h> but it isn't. - */ -struct ether_addr { - unsigned char octet[6]; -}; - -extern int yp_get_default_domain(); -extern int yp_match(); -char *yp_domain; - -/* - * Parse a string of text containing an ethernet address and hostname - * and separate it into its component parts. - */ -int ether_line(l, e, hostname) - char *l; - struct ether_addr *e; - char *hostname; -{ - int i, o[6]; - - i = sscanf(l, "%x:%x:%x:%x:%x:%x %s", &o[0], &o[1], &o[2], - &o[3], &o[4], &o[5], - hostname); - if (i != 7) - return (i); - - for (i=0; i<6; i++) - e->octet[i] = o[i]; - return (0); -} - -/* - * Convert an ASCII representation of an ethernet address to - * binary form. - */ -struct ether_addr *ether_aton(a) - char *a; -{ - int i; - static struct ether_addr o; - - i = sscanf(a, "%x:%x:%x:%x:%x:%x", o.octet[0], o.octet[1], o.octet[2], - o.octet[3], o.octet[4], o.octet[5]); - if (i != 6) - return (NULL); - return ((struct ether_addr *)&o); -} - -/* - * Convert a binary representation of an ethernet address to - * an ASCII string. - */ -char *ether_ntoa(n) - struct ether_addr *n; -{ - int i; - static char a[18]; - - i = sprintf(a,"%x:%x:%x:%x:%x:%x",n->octet[0],n->octet[1],n->octet[2], - n->octet[3],n->octet[4],n->octet[5]); - if (i < 11) - return (NULL); - return ((char *)&a); -} - -/* - * Map an ethernet address to a hostname. Use either /etc/ethers or - * NIS/YP. - */ - -int ether_ntohost(hostname, e) - char *hostname; - struct ether_addr *e; -{ - FILE *fp; - char buf[BUFSIZ]; - struct ether_addr local_ether; - char local_host[MAXHOSTNAMELEN]; - char *result; - int resultlen; - char *ether_a; - - if ((fp = fopen(_PATH_ETHERS, "r")) == NULL) - return (1); - - while (fgets(buf,BUFSIZ,fp)) { - if (buf[0] == '#') - continue; - if (buf[0] == '+') { - fclose(fp); /* Can ignore /etc/ethers from here on. */ - if (yp_get_default_domain(&yp_domain)) - return(1); - ether_a = ether_ntoa(e); - if (yp_match(yp_domain, "ethers.byaddr", ether_a, - strlen(ether_a), &result, &resultlen)) { - free(result); - return(1); - } - if (!ether_line(result, &local_ether, &local_host)) { - strcpy(hostname, (char *)&local_host); - free(result); - return(0); - } else { - free(result); - return(1); - } - } - if (!ether_line(&buf, &local_ether, &local_host)) { - if (!bcmp((char *)&local_ether.octet[0], - (char *)&e->octet[0], 6)) { - /* We have a match */ - strcpy(hostname, (char *)&local_host); - fclose(fp); - return(0); - } - } - } -fclose(fp); -return (1); -} - -/* - * Map a hostname to an ethernet address using /etc/ethers or - * NIS/YP. - */ -int ether_hostton(hostname, e) - char *hostname; - struct ether_addr *e; -{ - FILE *fp; - char buf[BUFSIZ]; - struct ether_addr local_ether; - char local_host[MAXHOSTNAMELEN]; - char *result; - int resultlen; - - if ((fp = fopen(_PATH_ETHERS, "r")) == NULL) - return (1); - - while (fgets(buf,BUFSIZ,fp)) { - if (buf[0] == '#') - continue; - if (buf[0] == '+') { - fclose(fp); /* Can ignore /etc/ethers from here on. */ - if (yp_get_default_domain(&yp_domain)) - return(1); - if (yp_match(yp_domain, "ethers.byname", hostname, - strlen(hostname), &result, &resultlen)) { - free(result); - return(1); - } - if (!ether_line(result, &local_ether, &local_host)) { - bcopy((char *)&local_ether.octet[0], - (char *)&e->octet[0], 6); - free(result); - return(0); - } else { - free(result); - return(1); - } - } - if (!ether_line(&buf, &local_ether, &local_host)) { - if (!strcmp(hostname, (char *)&local_host)) { - /* We have a match */ - bcopy((char *)&local_ether.octet[0], - (char *)&e->octet[0], 6); - fclose(fp); - return(0); - } - } - } -fclose(fp); -return (1); -} diff --git a/usr.sbin/rtprio/rtprio.2 b/usr.sbin/rtprio/rtprio.2 deleted file mode 100644 index 2c1b4c7..0000000 --- a/usr.sbin/rtprio/rtprio.2 +++ /dev/null @@ -1,106 +0,0 @@ -.\" Copyright (c) 1994, Henrik Vestergaard Draboel -.\" 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 Henrik Vestergaard Draboel. -.\" 4. The name of the author may not be used to endorse or promote products -.\" derived from this software without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. -.\" -.\" $Id: rtprio.2,v 1.2 1994/09/01 12:09:17 davidg Exp $ -.\" -.Dd July 23, 1994 -.Dt RTPRIO 2 -.Sh NAME -.Nm rtprio -.Nd examine or modify a process realtime or idle priority -.Sh SYNOPSIS -.Fd #include <sys/resource.h> -.Fd #include <sys/rtprio.h> -.Ft int -.Fn rtprio "function" "pid_t pid" "struct rtprio *rtp" -.Sh DESCRIPTION -.Fn rtprio -is used to lookup or change the realtime or idle priority of a process. - -.Fa function -specifies the operation to be performed. RTP_LOOKUP to lookup the current priority, -and RTP_SET to set the priority. -.Fa pid -specifies the process to be used, 0 for the current process. - -.Fa *rtp -is a pointer to a struct rtprio which is used to specify the priority and priority type. -This structure has the following form: -.Bd -literal -struct rtprio { - u_short type; - u_short prio; -}; -.Ed -.Pp -The value of the -.Nm type -field may be RTP_PRIO_REALTIME for realtime priorities, -RTP_PRIO_NORMAL for normal priorities, and RTP_PRIO_IDLE for idle priorities. -The priority specified by the -.Nm prio -field ranges between 0 and -.Dv RTP_PRIO_MAX (usually 31) . -0 is the highest possible priority. - -Realtime and idle priority is inherited through fork() and exec(). - -A realtime process can only be preempted by a process of equal or -higher priority, or by an interrupt; idle priority processes will run only -when no other real/normal priority process is runnable. Higher real/idle priority processes -preempt lower real/idle priority processes. Processes of equal real/idle priority are run round-robin. -.Sh RETURN VALUES -.Fn rtprio -will return 0 for success and -1 for all errors. The global variable -.Va errno -will be set to indicate the error. -.Sh ERRORS -.Fn rtprio -will fail if -.Bl -tag -width Er -.It Bq Er EINVAL -The specified -.Fa prio -was out of range. -.It Bq Er EPERM -The calling process is not allowed to set the realtime priority. Only -root is allowed to change the realtime priority of any process, and non-root -may only change the idle priority of the current process. -.It Bq Er ESRCH -The specified process was not found. -.Sh AUTHOR -The original author was Henrik Vestergaard Draboel - hvd@terry.ping.dk. This -implementation in FreeBSD was substantially rewritten by David Greenman. -.Sh SEE ALSO -.Xr rtprio 1 , -.Xr nice 1 , -.Xr ps 1 , -.Xr nice 2 , -.Xr renice 8 - diff --git a/usr.sbin/swapinfo/Makefile b/usr.sbin/swapinfo/Makefile deleted file mode 100644 index fb02166..0000000 --- a/usr.sbin/swapinfo/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# @(#)Makefile 5.5 (Berkeley) 4/23/91 - -PROG= swapinfo -SRCS= swapinfo.c -.PATH: ${.CURDIR}/../../bin/df - -DPADD= ${LIBMATH} ${LIBUTIL} -LDADD= -lm -lkvm -BINGRP= kmem -BINMODE=2555 - -.include <bsd.prog.mk> diff --git a/usr.sbin/swapinfo/README b/usr.sbin/swapinfo/README deleted file mode 100644 index f8019a8..0000000 --- a/usr.sbin/swapinfo/README +++ /dev/null @@ -1,38 +0,0 @@ -swapinfo -======== - -Swapinfo is designed to provide some information to the user about the -state of the swap space on the system. I've written it based on a -brief (!) perusal of the VM code in 386BSD. I could be pretty confused -about how it all fits together, and perhaps this is totally bogus. -It seems to work for me, though. - -How it works: - -During startup, the system traverses the list of configured swap partitions, -and determines the size of the various partitions. As each new partition -is added for swapping (via swapon), the free space on that disk is added -to a linked list of free space. Adjacent areas are coalesced to form -larger areas. The swapping algorithm seems to take the first free section -that it finds [?]. - -Swapinfo reads in the list of configured swap partitions from the /dev/kmem, -to determine the size of the partitions. It then traverses the list -of free space, figuring up how much is still available and how much -has therefore been used. Things get a little hairy in that the swap space -is divided amongst the configured swap partitions so that the first -4096 blocks of swap go on the first swap partition, the second 4096 on -the second swap partition, and so on. This works out to be a fairly -simple bit of code, though. - -More caveats: - -This works on my system. Your milage may vary. Since I'm reading /dev/kmem -to follow a linked list, the program could easily get lost looking for -some free space if anything got changed between reads of /dev/kmem. -If you get occasional inconsistant results, ignore 'em. - -Feel free to send bug reports, flames, etc., to: - -Kevin Lahey -kml@rokkaku.atl.ga.us diff --git a/usr.sbin/swapinfo/devname.c b/usr.sbin/swapinfo/devname.c deleted file mode 100644 index 5f2815d..0000000 --- a/usr.sbin/swapinfo/devname.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 1989 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)devname.c 5.14 (Berkeley) 5/6/91"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/types.h> -#include <fcntl.h> -#include <db.h> -#include <stdio.h> -#include <paths.h> - -char * -devname(dev, type) - dev_t dev; - mode_t type; -{ - struct { - mode_t type; - dev_t dev; - } bkey; - static DB *db; - static int failure; - DBT data, key; - - if (!db && !failure && - !(db = dbopen(_PATH_DEVDB, O_RDONLY, 0, DB_HASH, NULL))) { - (void)fprintf(stderr, - "warning: no device database %s\n", _PATH_DEVDB); - failure = 1; - } - if (failure) - return("??"); - - /* - * Keys are a mode_t followed by a dev_t. The former is the type of - * the file (mode & S_IFMT), the latter is the st_rdev field. - */ - bkey.dev = dev; - bkey.type = type; - key.data = &bkey; - key.size = sizeof(bkey); - return((db->get)(db, &key, &data, 0L) ? "??" : (char *)data.data); -} diff --git a/usr.sbin/swapinfo/swapinfo.1 b/usr.sbin/swapinfo/swapinfo.1 deleted file mode 100644 index 54e89c5..0000000 --- a/usr.sbin/swapinfo/swapinfo.1 +++ /dev/null @@ -1,53 +0,0 @@ -.\" -.\" swapinfo -.\" -.Dd February 23, 1993 -.Dt SWAPINFO 1 -.Sh NAME -.Nm swapinfo -.Nd display free swap space -.Sh SYNOPSIS -.Nm swapinfo -.Op Fl k -.Sh DESCRIPTION -.Nm Swapinfo -displays statistics about the amount of free swap space on all of the -swap areas compiled into the kernel. -.Pp -The following options are available: -.Bl -tag -width Ds -.It Fl k -By default, all sizes are reported in 512-byte block counts. -The -.Fl k -option causes the numbers to be reported in kilobyte counts. -.El -.Sh STATISTICS -Statistics are reported for all swap partitions configured into the kernel. -The first column is the device name of the partition. The next column is -the total space available in the partition. The -.Ar Used -column indicates the total blocks used so far; the -.Ar Available -column indicates how much space is remaining on each partition. -The -.Ar Capacity -reports the percentage of space used. -.Pp -If more than one partition is configured into the system, totals for all -of the statistics will be reported in the final line of the report. -.Sh "BUGS AND CAVEATS" -The information reported by -.Nm swapinfo -is stored in the kernel in a linked list. Since we are merely reading -this list out of kernel memory, it is entirely possible that the list could -change as we try to read it. Suspicious and unrepeatable values are probably -incorrect. -.Pp -Statistics are reported for all swap partitions compiled into the kernel, -regardless of whether those partitions are being used. -.Sh AUTHOR -.RS -Kevin Lahey -.br -kml@rokkaku.atl.ga.us diff --git a/usr.sbin/swapinfo/swapinfo.c b/usr.sbin/swapinfo/swapinfo.c deleted file mode 100644 index 811a936..0000000 --- a/usr.sbin/swapinfo/swapinfo.c +++ /dev/null @@ -1,214 +0,0 @@ -/* - * swapinfo - * - * Swapinfo will provide some information about the state of the swap - * space for the system. It'll determine the number of swap areas, - * their original size, and their utilization. - * - * Kevin Lahey, February 16, 1993 - */ - -#include <stdio.h> -#include <stdlib.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/conf.h> -#include <sys/rlist.h> -#include <nlist.h> -#include <kvm.h> -#include <limits.h> - -struct rlist *swaplist; - -static struct nlist nl[] = {{"_swaplist"}, /* list of free swap areas */ -#define VM_SWAPMAP 0 - {"_swdevt"}, /* list of swap devices and sizes */ -#define VM_SWDEVT 1 - {"_nswap"}, /* size of largest swap device */ -#define VM_NSWAP 2 - {"_nswdev"}, /* number of swap devices */ -#define VM_NSWDEV 3 - {"_dmmax"}, /* maximum size of a swap block */ -#define VM_DMMAX 4 - {""}}; - -char *getbsize __P((int *, long *)); -void usage __P((void)); - -main (argc, argv) -int argc; -char **argv; -{ - int i, total_avail, total_free, total_partitions, *by_device, - nswap, nswdev, dmmax, ch; - struct swdevt *swdevt; - struct rlist head; - static long blocksize; - static int headerlen; - static char *header; - kvm_t *kd; - char errbuf[_POSIX2_LINE_MAX]; - - /* We are trying to be simple here: */ - - while ((ch = getopt(argc, argv, "k")) != EOF) - switch(ch) { - case 'k': - putenv("BLOCKSIZE=1k"); - break; - case '?': - default: - usage(); - } - - /* Open up /dev/kmem for reading. */ - - kd = kvm_openfiles((char *)NULL, (char *)NULL, (char *)NULL, 0, errbuf); - if (kd == NULL) { - fprintf (stderr, "%s: kvm_openfiles: %s\n", - argv [0], errbuf); - exit (1); - } - - /* Figure out the offset of the various structures we'll need. */ - - if (kvm_nlist(kd, nl) == -1) { - fprintf (stderr, "%s: kvm_nlist: %s\n", - argv [0], kvm_geterr(kd)); - exit (1); - } - - if (kvm_read(kd, nl[VM_NSWAP].n_value, &nswap, sizeof (nswap)) != - sizeof (nswap)) { - fprintf (stderr, "%s: didn't read all of nswap\n", - argv [0]); - exit (5); - } - - if (kvm_read(kd, nl[VM_NSWDEV].n_value, &nswdev, sizeof (nswdev)) != - sizeof (nswdev)) { - fprintf (stderr, "%s: didn't read all of nswdev\n", - argv [0]); - exit (5); - } - - if (kvm_read(kd, nl[VM_DMMAX].n_value, &dmmax, sizeof (dmmax)) != - sizeof (dmmax)) { - fprintf (stderr, "%s: didn't read all of dmmax\n", - argv [0]); - exit (5); - } - - if ((swdevt = malloc (sizeof (struct swdevt) * nswdev)) == NULL || - (by_device = calloc (sizeof (*by_device), nswdev)) == NULL) { - perror ("malloc"); - exit (5); - } - - if (kvm_read(kd, nl[VM_SWDEVT].n_value, swdevt, - sizeof (struct swdevt) * nswdev) != - sizeof (struct swdevt) * nswdev) { - fprintf (stderr, "%s: didn't read all of swdevt\n", - argv [0]); - exit (5); - } - - if (kvm_read(kd, nl[0].n_value, &swaplist, sizeof (struct rlist *)) != - sizeof (struct rlist *)) { - fprintf (stderr, "%s: didn't read all of swaplist\n", - argv [0]); - exit (5); - } - - /* Traverse the list of free swap space... */ - - total_free = 0; - while (swaplist) { - int top, bottom, next_block; - - if (kvm_read(kd, (long) swaplist, &head, sizeof (struct rlist )) != - sizeof (struct rlist )) { - fprintf (stderr, "%s: didn't read all of head\n", - argv [0]); - exit (5); - } - - top = head.rl_end; - bottom = head.rl_start; - - total_free += top - bottom + 1; - - /* - * Swap space is split up among the configured disk. - * The first dmmax blocks of swap space some from the - * first disk, the next dmmax blocks from the next, - * and so on. The list of free space joins adjacent - * free blocks, ignoring device boundries. If we want - * to keep track of this information per device, we'll - * just have to extract it ourselves. - */ - - while (top / dmmax != bottom / dmmax) { - next_block = ((bottom + dmmax) / dmmax); - by_device [(bottom / dmmax) % nswdev] += - next_block * dmmax - bottom; - bottom = next_block * dmmax; - } - - by_device [(bottom / dmmax) % nswdev] += - top - bottom + 1; - - swaplist = head.rl_next; - } - - header = getbsize(&headerlen, &blocksize); - printf ("%-10s %10s %10s %10s %10s\n", - "Device", header, "Used", "Available", "Capacity"); - for (total_avail = total_partitions = i = 0; i < nswdev; i++) { - printf ("/dev/%-5s %10d ", - devname (swdevt [i].sw_dev, S_IFBLK), - swdevt [i].sw_nblks / (blocksize/512)); - - /* - * Don't report statistics for partitions which have not - * yet been activated via swapon(8). - */ - - if (!swdevt [i].sw_freed) { - printf (" *** not available for swapping ***\n"); - } else { - total_partitions++; - total_avail += swdevt [i].sw_nblks; - printf ("%10d %10d %7.0f%%\n", - (swdevt [i].sw_nblks - by_device [i]) / (blocksize/512), - by_device [i] / (blocksize/512), - (double) (swdevt [i].sw_nblks - - by_device [i]) / - (double) swdevt [i].sw_nblks * 100.0); - } - } - - /* - * If only one partition has been set up via swapon(8), we don't - * need to bother with totals. - */ - - if (total_partitions > 1) - printf ("%-10s %10d %10d %10d %7.0f%%\n", "Total", - total_avail / (blocksize/512), - (total_avail - total_free) / (blocksize/512), - total_free / (blocksize/512), - (double) (total_avail - total_free) / - (double) total_avail * 100.0); - - exit (0); -} - -void -usage() -{ - (void)fprintf(stderr, "usage: swapinfo [-k]\n"); - exit(1); -} - - diff --git a/usr.sbin/tcpdump/tcpdump/tcplex.l b/usr.sbin/tcpdump/tcpdump/tcplex.l deleted file mode 100644 index 3db8a32..0000000 --- a/usr.sbin/tcpdump/tcpdump/tcplex.l +++ /dev/null @@ -1,144 +0,0 @@ -%{ -/* - * Copyright (c) 1988-1990 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: (1) source code distributions - * retain the above copyright notice and this paragraph in its entirety, (2) - * distributions including binary code include the above copyright notice and - * this paragraph in its entirety in the documentation or other materials - * provided with the distribution, and (3) all advertising materials mentioning - * features or use of this software display the following acknowledgement: - * ``This product includes software developed by the University of California, - * Lawrence Berkeley Laboratory and its contributors.'' 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - -#ifndef lint -static char rcsid[] = - "@(#) $Header: /home/ncvs/src/usr.sbin/tcpdump/tcpdump/tcplex.l,v 1.1.1.1 1993/06/12 14:42:05 rgrimes Exp $ (LBL)"; -#endif - -/* - * Compiling with gcc under SunOS will cause problems unless we have this - * cruft here. The flex skeleton includes stddef.h which defines these types - * (under gcc). They will conflict with Sun's definitions in sys/types.h. - */ -#define size_t xxxsize_t -#define ptrdiff_t xxxptrdiff_t -#define wchar_t xxxwchar_t -#include <sys/types.h> -#undef size_t -#undef ptrdiff_t -#undef wchar_t - -#include "nametoaddr.h" - -/* - * We need bpf since enum bpf_code is in YYSTYPE. - */ -#include <sys/time.h> -#include <net/bpf.h> - -#include "gencode.h" -#include "y.tab.h" /* "tokdefs.h" */ - -#ifdef FLEX_SCANNER -#undef YY_INPUT -#define YY_INPUT(buf, result, max)\ - {\ - char *src = in_buffer;\ - int i;\ -\ - if (*src == 0)\ - result = YY_NULL;\ - else {\ - for (i = 0; *src && i < max; ++i)\ - buf[i] = *src++;\ - in_buffer += i;\ - result = i;\ - }\ - } -#else -#undef getc -#define getc(fp) (*in_buffer == 0 ? EOF : *in_buffer++) -#endif - -extern YYSTYPE yylval; -static char *in_buffer; - -%} - -N ([0-9]+|(0X|0x)[0-9A-Fa-f]+) -B ([0-9A-Fa-f][0-9A-Fa-f]?) - -%a 3000 - -%% -dst return DST; -src return SRC; - -link|ether|ppp|slip return LINK; -arp return ARP; -rarp return RARP; -ip return IP; -tcp return TCP; -udp return UDP; -icmp return ICMP; - -host return HOST; -net return NET; -port return PORT; -proto return PROTO; - -gateway return GATEWAY; - -less return LESS; -greater return GREATER; -byte return BYTE; -broadcast return TK_BROADCAST; -multicast return TK_MULTICAST; - -and return AND; -or return OR; -not return '!'; - -len return LEN; - -[ \n\t] ; -[+\-*/:\[\]!<>()&|=] return yytext[0]; -">=" return GEQ; -"<=" return LEQ; -"!=" return NEQ; -"==" return '='; -"<<" return LSH; -">>" return RSH; -{N} { yylval.i = stoi(yytext); return NUM; } -({N}\.{N})|({N}\.{N}\.{N})|({N}\.{N}\.{N}\.{N}) { - yylval.h = atoin(yytext); return HID; -} -{B}:{B}:{B}:{B}:{B}:{B} { yylval.e = ETHER_aton(yytext); return EID; } -{B}:+({B}:+)+ { error("bogus ethernet address %s", yytext); } -[A-Za-z][-_.A-Za-z0-9]* { yylval.s = yytext; return ID; } -"\\"[^ !()\n\t]+ { yylval.s = yytext + 1; return ID; } -[^ \[\]\t\n\-_.A-Za-z0-9!<>()&|=]+ { error("illegal token: %s\n", yytext); } -. { error("illegal char '%c'", *yytext); } -%% -void -lex_init(buf) - char *buf; -{ - in_buffer = buf; -} -int -yywrap() -/* so we don't need -ll */ -{ - return 1; -} diff --git a/usr.sbin/tzsetup/tzsetup.sh b/usr.sbin/tzsetup/tzsetup.sh deleted file mode 100644 index f3d9431..0000000 --- a/usr.sbin/tzsetup/tzsetup.sh +++ /dev/null @@ -1,181 +0,0 @@ -#!/bin/sh -# $Id: tzsetup.sh,v 1.3 1994/11/02 00:00:17 ache Exp $ -# -# Copyright 1994, Garrett A. Wollman. All rights reserved. -# This script is subject to the terms and conditions listed at the -# end. -# - -ask() { - while true; do - echo -n "$1" "(${2-no default}) " - read ans - if [ -z "$ans" ]; then - ans="$2" - fi - if [ -z "$ans" ]; then - echo 'An empty response is not valid.' - continue - fi - return 0 - done -} - -askyn() { - while : ; do - ask "$1 [yn]?" $2 - case $ans in - [Yy]*) return 0;; - [Nn]*) return 1;; - esac - done -} - -select() { - where=$1 - while true; do - echo "Please select a location from the following list which" - echo "has the same legal time as your location:" - echo "" - ls -C /usr/share/zoneinfo/$where - echo "" - echo "Type \`\`exit'' to return to the main menu." - ask "Your choice:" exit - if [ "$ans" = "exit" ]; then return 0; fi - city="$ans" - if [ -r /usr/share/zoneinfo/$where/$city ]; then - echo -n "I think the time in `echo $city | tr _ ' '` is: " - TZ=$where/$city date - if askyn "Is this what you wanted" y; then - rm -f /etc/localtime - cp /usr/share/zoneinfo/$where/$city \ - /etc/localtime && echo "Timezone changed." - return 0 - fi - fi - done -} - -setadjkerntz() { - cat << EOF - -You can configure your system to assume that the battery-backed CMOS -clock is set to your local legal time rather than Universal or -Greenwich time. When the system boots, the \`adjkerntz' program will -examine your current time, reverse-apply the timezone correction, and -then set the system's UTC time to the corrected value. This approach -is NOT guaranteed to always work; in particular, if you reboot your -system during the transition from or to summer time, the calculation -is sometimes impossible, and wierd things may result. - -For this reason, we recommend that, unless you absolutely positively -must leave your CMOS clock on local time, you set your CMOS clock to GMT. - -EOF - if [ -f /etc/wall_cmos_clock ]; then - curr=y - echo "This system is currently set up for local CMOS time." - else - curr=n - echo "This system is currently set up for GMT CMOS time." - fi - if askyn "Do you want a local CMOS clock" $curr; then - touch /etc/wall_cmos_clock - if [ $curr = "n" ] && askyn "Start now" y; then - /sbin/adjkerntz -i - fi - else - rm -f /etc/wall_cmos_clock - fi - echo "Done." -} - -mainmenu() { - set `TZ= date` - if askyn "Is $4, $1 $2 $3 $6 the correct current date and time" n; then - cat << EOF - -Unless your local time is GMT, this probably means that your CMOS -clock is on local time. In this case, the local times that you will -be shown will be incorrect. You should either set your CMOS clock to -GMT, or select option 98 from the main menu after selecting a -timezone. - -EOF - echo -n "Press return to continue ==>" - read junk - fi - - while true; do - cat <<EOH - - - Pick the item that best describes your location: - - 1) Africa - 2) North, South, Central America (includes Greenland) - 3) Atlantic Ocean islands - 4) Asia and the Middle East - 5) Australia - 6) Europe - 7) Indian Ocean islands - 8) Pacific islands (includes Hawaii) - - 98) Select CMOS time status (UTC or local) - 99) Exit this menu - -EOH - ask 'Your choice?' 99 - case $ans in - 1) select Africa;; - 2) select America;; - 3) select Atlantic;; - 4) select Asia;; - 5) select Australia;; - 6) select Europe;; - 7) select Indian;; - 8) select Pacific;; - 9) select Etc;; - 10) select SystemV;; - 98) setadjkerntz;; - 99) return 0;; - esac - done -} - -cat <<EOH -Welcome to `sysctl -n kern.ostype` `sysctl -n kern.osrelease`! - -This program will help you select a default timezone for your users and -for system processes. - -EOH -echo -n 'Press return to continue ==>' -read return - -mainmenu -exit 0 -# -# Copyright (c) 1994 Garrett A. Wollman. 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. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. -# diff --git a/usr.sbin/xntpd/xntpres/Makefile b/usr.sbin/xntpd/xntpres/Makefile deleted file mode 100644 index fc41047..0000000 --- a/usr.sbin/xntpd/xntpres/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -# -# $Id: Makefile,v 1.1 1993/12/21 20:38:27 wollman Exp $ -# - -CFLAGS+= -I${.CURDIR}/../include - -.if exists(${.CURDIR}/../lib/obj) -LDADD+= -L${.CURDIR}/../lib/obj -DPADD+= -L${.CURDIR}/../lib/obj/libntp.a -.else -LDADD+= -L${.CURDIR}/../lib -DPADD+= -L${.CURDIR}/../lib/libntp.a -.endif - -LDADD+= -lntp - -PROG= xntpres -NOMAN= -CLEANFILES+= .version version.c - -SRCS= xntpres.c version.c - -beforedepend: version.c - -version.c: ${.CURDIR}/../VERSION - ${.CURDIR}/../scripts/mkversion xntpres - -.include <bsd.prog.mk> |