*BSD News Article 62833


Return to BSD News archive

Newsgroups: comp.bugs.2bsd
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!newshost.telstra.net!act.news.telstra.net!psgrain!news.uoregon.edu!cyberspace.com!news.sprintlink.net!news.gdbnet.ad.jp!news.hebel.net!nntp.inet.fi!news.funet.fi!news.eunet.fi!EU.net!newsfeed.internetmci.com!salliemae!europa.chnt.gtegsc.com!wlbr!sms
From: sms@wlv.iipo.gtegsc.com (Steven M. Schultz)
Subject: install(1) does not know about '-f flags' (#304)
Sender: news@wlbr.iipo.gtegsc.com (System Administrator)
Organization: GTE Government Systems, Thousand Oaks CA USA
Message-ID: <DnMow9.BL8@wlbr.iipo.gtegsc.com>
X-Nntp-Posting-Host: wlv.iipo.gtegsc.com
Date: Sat, 2 Mar 1996 07:02:33 GMT
Lines: 1555

Subject: install(1) does not know about '-f flags' (#304)
Index:	usr.bin/xinstall/install.c 2.11BSD

Description:
	install(1) can not set the flags (see chflags(1)) of a file
	during installation.

Repeat-By:
	Observation.

Fix:
	Port the 4.4BSD-Lite2 version of install(1).

	Naturally there was more to it than that - but the snowball factor
	is quite small this time, only 1 module (with a corresponding manpage)
	needs to be added to libc.a. 

	The attached shar file consists of 3 parts:

	1 - /tmp/304.shar - shar archive of new files being added to the system

	2 - /tmp/304.script - shell script to remove 2 no longer needed  files

	3 - /tmp/304.patch - a patch file to update files in the system

	To install the update cut where indicated saving to a file (/tmp/304)
	and then:

		cd /tmp
		sh 304
		sh 304.shar
		sh 304.script
		patch -p0 < 304.patch

		cd /usr/src/lib/libc/gen
		cc -O -p -c setmode.c
		ld -X -r setmode.o
		mv a.out profiled/setmode.o
		cc -O -c setmode.c
		ld -X -r setmode.o
		mv a.out setmode.o
		ar r /lib/libc.a setmode.o
		cd profiled
		ar r /usr/lib/libc_p.a setmode.o
		cd ..
		rm setmode.o profiled/setmode.o
		ranlib /lib/libc.a /usr/lib/libc_p.a

		cd /usr/src/man/man3
		/usr/man/manroff setmode.3 > setmode.0
		install -m 444 setmode.0 /usr/man/cat3/setmode.0

		cd /usr/src/usr.bin/xinstall
		make
		make install
		make clean

		cd /tmp
		rm 304 304.patch 304.script 304.shar

	This and previous updates are available via anonymous FTP to
	either FTP.IIPO.GTEGSC.COM or MOE.2BSD.COM in the directory
	/pub/2.11BSD.
=============================cut here=====================
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	/tmp/304.shar
#	/tmp/304.patch
#	/tmp/304.script
# This archive created: Fri Mar  1 22:33:27 1996
export PATH; PATH=/bin:/usr/bin:$PATH
if test -f '/tmp/304.shar'
then
	echo shar: "will not over-write existing file '/tmp/304.shar'"
else
sed 's/^Y//' << \SHAR_EOF > '/tmp/304.shar'
Y#! /bin/sh
Y# This is a shell archive, meaning:
Y# 1. Remove everything above the #! /bin/sh line.
Y# 2. Save the resulting text in a file.
Y# 3. Execute the file with /bin/sh (not csh) to create:
Y#	/usr/src/lib/libc/gen/setmode.c
Y#	/usr/src/man/man3/setmode.3
Y#	/usr/src/usr.bin/xinstall
Y# This archive created: Fri Mar  1 19:58:28 1996
Yexport PATH; PATH=/bin:/usr/bin:$PATH
Yif test -f '/usr/src/lib/libc/gen/setmode.c'
Ythen
Y	echo shar: "will not over-write existing file '/usr/src/lib/libc/gen/setmode.c'"
Yelse
Ysed 's/^X//' << \SHAR_EOF > '/usr/src/lib/libc/gen/setmode.c'
YX/*
YX * Copyright (c) 1989, 1993, 1994
YX *	The Regents of the University of California.  All rights reserved.
YX *
YX * This code is derived from software contributed to Berkeley by
YX * Dave Borman at Cray Research, Inc.
YX *
YX * Redistribution and use in source and binary forms, with or without
YX * modification, are permitted provided that the following conditions
YX * are met:
YX * 1. Redistributions of source code must retain the above copyright
YX *    notice, this list of conditions and the following disclaimer.
YX * 2. Redistributions in binary form must reproduce the above copyright
YX *    notice, this list of conditions and the following disclaimer in the
YX *    documentation and/or other materials provided with the distribution.
YX * 3. All advertising materials mentioning features or use of this software
YX *    must display the following acknowledgement:
YX *	This product includes software developed by the University of
YX *	California, Berkeley and its contributors.
YX * 4. Neither the name of the University nor the names of its contributors
YX *    may be used to endorse or promote products derived from this software
YX *    without specific prior written permission.
YX *
YX * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
YX * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
YX * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
YX * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
YX * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
YX * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
YX * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
YX * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
YX * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
YX * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
YX * SUCH DAMAGE.
YX */
YX
YX#if defined(LIBC_SCCS) && !defined(lint)
YXstatic char sccsid[] = "@(#)setmode.c	8.2.1 (2.11BSD) 1996/2/20";
YX#endif /* LIBC_SCCS and not lint */
YX
YX#include <sys/types.h>
YX#include <sys/stat.h>
YX
YX#include <ctype.h>
YX#include <errno.h>
YX#include <signal.h>
YX#include <sys/stddef.h>
YX#include <stdlib.h>
YX
YX#ifdef SETMODE_DEBUG
YX#include <stdio.h>
YX#endif
YX
YX#define	SET_LEN	6		/* initial # of bitcmd struct to malloc */
YX#define	SET_LEN_INCR 4		/* # of bitcmd structs to add as needed */
YX
YXtypedef struct bitcmd {
YX	char	cmd;
YX	char	cmd2;
YX	mode_t	bits;
YX} BITCMD;
YX
YX#define	CMD2_CLR	0x01
YX#define	CMD2_SET	0x02
YX#define	CMD2_GBITS	0x04
YX#define	CMD2_OBITS	0x08
YX#define	CMD2_UBITS	0x10
YX
YXstatic BITCMD	*addcmd();
YXstatic int	 compress_mode();
YX#ifdef SETMODE_DEBUG
YXstatic void	 dumpmode();
YX#endif
YX
YX/*
YX * Given the old mode and an array of bitcmd structures, apply the operations
YX * described in the bitcmd structures to the old mode, and return the new mode.
YX * Note that there is no '=' command; a strict assignment is just a '-' (clear
YX * bits) followed by a '+' (set bits).
YX */
YXmode_t
YXgetmode(bbox, omode)
YX	void *bbox;
YX	mode_t omode;
YX{
YX	register BITCMD *set;
YX	register mode_t clrval, newmode, value;
YX
YX	set = (BITCMD *)bbox;
YX	newmode = omode;
YX	for (value = 0;; set++)
YX		switch(set->cmd) {
YX		/*
YX		 * When copying the user, group or other bits around, we "know"
YX		 * where the bits are in the mode so that we can do shifts to
YX		 * copy them around.  If we don't use shifts, it gets real
YX		 * grundgy with lots of single bit checks and bit sets.
YX		 */
YX		case 'u':
YX			value = (newmode & S_IRWXU) >> 6;
YX			goto common;
YX
YX		case 'g':
YX			value = (newmode & S_IRWXG) >> 3;
YX			goto common;
YX
YX		case 'o':
YX			value = newmode & S_IRWXO;
YXcommon:			if (set->cmd2 & CMD2_CLR) {
YX				clrval =
YX				    (set->cmd2 & CMD2_SET) ?  S_IRWXO : value;
YX				if (set->cmd2 & CMD2_UBITS)
YX					newmode &= ~((clrval<<6) & set->bits);
YX				if (set->cmd2 & CMD2_GBITS)
YX					newmode &= ~((clrval<<3) & set->bits);
YX				if (set->cmd2 & CMD2_OBITS)
YX					newmode &= ~(clrval & set->bits);
YX			}
YX			if (set->cmd2 & CMD2_SET) {
YX				if (set->cmd2 & CMD2_UBITS)
YX					newmode |= (value<<6) & set->bits;
YX				if (set->cmd2 & CMD2_GBITS)
YX					newmode |= (value<<3) & set->bits;
YX				if (set->cmd2 & CMD2_OBITS)
YX					newmode |= value & set->bits;
YX			}
YX			break;
YX
YX		case '+':
YX			newmode |= set->bits;
YX			break;
YX
YX		case '-':
YX			newmode &= ~set->bits;
YX			break;
YX
YX		case 'X':
YX			if (omode & (S_IFDIR|S_IXUSR|S_IXGRP|S_IXOTH))
YX				newmode |= set->bits;
YX			break;
YX
YX		case '\0':
YX		default:
YX#ifdef SETMODE_DEBUG
YX			(void)printf("getmode:%04o -> %04o\n", omode, newmode);
YX#endif
YX			return (newmode);
YX		}
YX}
YX
YX#define	ADDCMD(a, b, c, d)						\
YX	if (set >= endset) {						\
YX		register BITCMD *newset;				\
YX		setlen += SET_LEN_INCR;					\
YX		newset = (BITCMD *)realloc(saveset, sizeof(BITCMD) * setlen); \
YX		if (!saveset)						\
YX			return ((void *)NULL);				\
YX		set = newset + (set - saveset);				\
YX		saveset = newset;					\
YX		endset = newset + (setlen - 2);				\
YX	}								\
YX	set = addcmd(set, (a), (b), (c), (d))
YX
YX#define	STANDARD_BITS	(S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO)
YX
YXvoid *
YXsetmode(p)
YX	register char *p;
YX{
YX	register int perm, who;
YX	char op;
YX	BITCMD *set, *saveset, *endset;
YX#ifdef	notnow
YX	sigset_t sigset, sigoset;
YX#endif
YX	mode_t mask;
YX	int equalopdone, permXbits, setlen;
YX
YX	if (!*p)
YX		return ((void *)NULL);
YX
YX#ifdef	notnow
YX	/*
YX	 * Get a copy of the mask for the permissions that are mask relative.
YX	 * Flip the bits, we want what's not set.  Since it's possible that
YX	 * the caller is opening files inside a signal handler, protect them
YX	 * as best we can.
YX	 */
YX	sigfillset(&sigset);
YX        (void)sigprocmask(SIG_BLOCK, &sigset, &sigoset);
YX#endif
YX	(void)umask(mask = umask(0));
YX	mask = ~mask;
YX#ifdef	notnow
YX        (void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
YX#endif
YX
YX	setlen = SET_LEN + 2;
YX	
YX	if ((set = (BITCMD *)malloc((u_int)(sizeof(BITCMD) * setlen))) == NULL)
YX		return ((void *)NULL);
YX	saveset = set;
YX	endset = set + (setlen - 2);
YX
YX	/*
YX	 * If an absolute number, get it and return; disallow non-octal digits
YX	 * or illegal bits.
YX	 */
YX	if (isdigit(*p)) {
YX		perm = (mode_t)strtol(p, NULL, 8);
YX		if (perm & ~(STANDARD_BITS|S_ISVTX)) {
YX			free(saveset);
YX			return ((void *)NULL);
YX		}
YX		while (*++p)
YX			if (*p < '0' || *p > '7') {
YX				free(saveset);
YX				return ((void *)NULL);
YX			}
YX		ADDCMD('=', (STANDARD_BITS|S_ISVTX), perm, mask);
YX		return ((void *)saveset);
YX	}
YX
YX	/*
YX	 * Build list of structures to set/clear/copy bits as described by
YX	 * each clause of the symbolic mode.
YX	 */
YX	for (;;) {
YX		/* First, find out which bits might be modified. */
YX		for (who = 0;; ++p) {
YX			switch (*p) {
YX			case 'a':
YX				who |= STANDARD_BITS;
YX				break;
YX			case 'u':
YX				who |= S_ISUID|S_IRWXU;
YX				break;
YX			case 'g':
YX				who |= S_ISGID|S_IRWXG;
YX				break;
YX			case 'o':
YX				who |= S_IRWXO;
YX				break;
YX			default:
YX				goto getop;
YX			}
YX		}
YX
YXgetop:		if ((op = *p++) != '+' && op != '-' && op != '=') {
YX			free(saveset);
YX			return ((void *)NULL);
YX		}
YX		if (op == '=')
YX			equalopdone = 0;
YX
YX		who &= ~S_ISVTX;
YX		for (perm = 0, permXbits = 0;; ++p) {
YX			switch (*p) {
YX			case 'r':
YX				perm |= S_IRUSR|S_IRGRP|S_IROTH;
YX				break;
YX			case 's':
YX				/* If only "other" bits ignore set-id. */
YX				if (who & ~S_IRWXO)
YX					perm |= S_ISUID|S_ISGID;
YX				break;
YX			case 't':
YX				/* If only "other" bits ignore sticky. */
YX				if (who & ~S_IRWXO) {
YX					who |= S_ISVTX;
YX					perm |= S_ISVTX;
YX				}
YX				break;
YX			case 'w':
YX				perm |= S_IWUSR|S_IWGRP|S_IWOTH;
YX				break;
YX			case 'X':
YX				permXbits = S_IXUSR|S_IXGRP|S_IXOTH;
YX				break;
YX			case 'x':
YX				perm |= S_IXUSR|S_IXGRP|S_IXOTH;
YX				break;
YX			case 'u':
YX			case 'g':
YX			case 'o':
YX				/*
YX				 * When ever we hit 'u', 'g', or 'o', we have
YX				 * to flush out any partial mode that we have,
YX				 * and then do the copying of the mode bits.
YX				 */
YX				if (perm) {
YX					ADDCMD(op, who, perm, mask);
YX					perm = 0;
YX				}
YX				if (op == '=')
YX					equalopdone = 1;
YX				if (op == '+' && permXbits) {
YX					ADDCMD('X', who, permXbits, mask);
YX					permXbits = 0;
YX				}
YX				ADDCMD(*p, who, op, mask);
YX				break;
YX
YX			default:
YX				/*
YX				 * Add any permissions that we haven't already
YX				 * done.
YX				 */
YX				if (perm || (op == '=' && !equalopdone)) {
YX					if (op == '=')
YX						equalopdone = 1;
YX					ADDCMD(op, who, perm, mask);
YX					perm = 0;
YX				}
YX				if (permXbits) {
YX					ADDCMD('X', who, permXbits, mask);
YX					permXbits = 0;
YX				}
YX				goto apply;
YX			}
YX		}
YX
YXapply:		if (!*p)
YX			break;
YX		if (*p != ',')
YX			goto getop;
YX		++p;
YX	}
YX	set->cmd = 0;
YX#ifdef SETMODE_DEBUG
YX	(void)printf("Before compress_mode()\n");
YX	dumpmode(saveset);
YX#endif
YX	compress_mode(saveset);
YX#ifdef SETMODE_DEBUG
YX	(void)printf("After compress_mode()\n");
YX	dumpmode(saveset);
YX#endif
YX	return ((void *)saveset);
YX}
YX
YXstatic BITCMD *
YXaddcmd(set, op, who, oparg, mask)
YX	BITCMD *set;
YX	register int oparg, who;
YX	register int op;
YX	u_int mask;
YX{
YX	switch (op) {
YX	case '=':
YX		set->cmd = '-';
YX		set->bits = who ? who : STANDARD_BITS;
YX		set++;
YX
YX		op = '+';
YX		/* FALLTHROUGH */
YX	case '+':
YX	case '-':
YX	case 'X':
YX		set->cmd = op;
YX		set->bits = (who ? who : mask) & oparg;
YX		break;
YX
YX	case 'u':
YX	case 'g':
YX	case 'o':
YX		set->cmd = op;
YX		if (who) {
YX			set->cmd2 = ((who & S_IRUSR) ? CMD2_UBITS : 0) |
YX				    ((who & S_IRGRP) ? CMD2_GBITS : 0) |
YX				    ((who & S_IROTH) ? CMD2_OBITS : 0);
YX			set->bits = ~0;
YX		} else {
YX			set->cmd2 = CMD2_UBITS | CMD2_GBITS | CMD2_OBITS;
YX			set->bits = mask;
YX		}
YX	
YX		if (oparg == '+')
YX			set->cmd2 |= CMD2_SET;
YX		else if (oparg == '-')
YX			set->cmd2 |= CMD2_CLR;
YX		else if (oparg == '=')
YX			set->cmd2 |= CMD2_SET|CMD2_CLR;
YX		break;
YX	}
YX	return (set + 1);
YX}
YX
YX#ifdef SETMODE_DEBUG
YXstatic void
YXdumpmode(set)
YX	register BITCMD *set;
YX{
YX	for (; set->cmd; ++set)
YX		(void)printf("cmd: '%c' bits %04o%s%s%s%s%s%s\n",
YX		    set->cmd, set->bits, set->cmd2 ? " cmd2:" : "",
YX		    set->cmd2 & CMD2_CLR ? " CLR" : "",
YX		    set->cmd2 & CMD2_SET ? " SET" : "",
YX		    set->cmd2 & CMD2_UBITS ? " UBITS" : "",
YX		    set->cmd2 & CMD2_GBITS ? " GBITS" : "",
YX		    set->cmd2 & CMD2_OBITS ? " OBITS" : "");
YX}
YX#endif
YX
YX/*
YX * Given an array of bitcmd structures, compress by compacting consecutive
YX * '+', '-' and 'X' commands into at most 3 commands, one of each.  The 'u',
YX * 'g' and 'o' commands continue to be separate.  They could probably be 
YX * compacted, but it's not worth the effort.
YX */
YXstatic int
YXcompress_mode(set)
YX	register BITCMD *set;
YX{
YX	register BITCMD *nset;
YX	register int setbits, clrbits, Xbits, op;
YX
YX	for (nset = set;;) {
YX		/* Copy over any 'u', 'g' and 'o' commands. */
YX		while ((op = nset->cmd) != '+' && op != '-' && op != 'X') {
YX			*set++ = *nset++;
YX			if (!op)
YX				return;
YX		}
YX
YX		for (setbits = clrbits = Xbits = 0;; nset++) {
YX			if ((op = nset->cmd) == '-') {
YX				clrbits |= nset->bits;
YX				setbits &= ~nset->bits;
YX				Xbits &= ~nset->bits;
YX			} else if (op == '+') {
YX				setbits |= nset->bits;
YX				clrbits &= ~nset->bits;
YX				Xbits &= ~nset->bits;
YX			} else if (op == 'X')
YX				Xbits |= nset->bits & ~setbits;
YX			else
YX				break;
YX		}
YX		if (clrbits) {
YX			set->cmd = '-';
YX			set->cmd2 = 0;
YX			set->bits = clrbits;
YX			set++;
YX		}
YX		if (setbits) {
YX			set->cmd = '+';
YX			set->cmd2 = 0;
YX			set->bits = setbits;
YX			set++;
YX		}
YX		if (Xbits) {
YX			set->cmd = 'X';
YX			set->cmd2 = 0;
YX			set->bits = Xbits;
YX			set++;
YX		}
YX	}
YX}
YSHAR_EOF
Ychmod 644 '/usr/src/lib/libc/gen/setmode.c'
Yfi
Yif test -f '/usr/src/man/man3/setmode.3'
Ythen
Y	echo shar: "will not over-write existing file '/usr/src/man/man3/setmode.3'"
Yelse
Ysed 's/^X//' << \SHAR_EOF > '/usr/src/man/man3/setmode.3'
YX.\" Copyright (c) 1989, 1991, 1993
YX.\"	The Regents of the University of California.  All rights reserved.
YX.\"
YX.\" Redistribution and use in source and binary forms, with or without
YX.\" modification, are permitted provided that the following conditions
YX.\" are met:
YX.\" 1. Redistributions of source code must retain the above copyright
YX.\"    notice, this list of conditions and the following disclaimer.
YX.\" 2. Redistributions in binary form must reproduce the above copyright
YX.\"    notice, this list of conditions and the following disclaimer in the
YX.\"    documentation and/or other materials provided with the distribution.
YX.\" 3. All advertising materials mentioning features or use of this software
YX.\"    must display the following acknowledgement:
YX.\"	This product includes software developed by the University of
YX.\"	California, Berkeley and its contributors.
YX.\" 4. Neither the name of the University nor the names of its contributors
YX.\"    may be used to endorse or promote products derived from this software
YX.\"    without specific prior written permission.
YX.\"
YX.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
YX.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
YX.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
YX.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
YX.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
YX.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
YX.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
YX.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
YX.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
YX.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
YX.\" SUCH DAMAGE.
YX.\"
YX.\"     @(#)setmode.3	8.2.1 (2.11BSD) 1996/2/20
YX.\"
YX.TH SETMODE 3 "February 20, 1996"
YX.UC 7
YX.SH NAME
YX\fBgetmode\fP, \fBsetmode\fP \- modify mode bits
YX.SH SYNOPSIS
YX.B #include <sys/types.h>
YX.sp
YX.B mode_t
YX.br
YX\fBgetmode\fP(set, mode)
YX.br
YX.I void *set;
YX.br
YX.I mode_t mode
YX.sp
YX.B void *
YX.br
YX\fBsetmode\fP(mode_str)
YX.br
YX.I char *mode_str;
YX.SH DESCRIPTION
YXThe
YX.B getmode
YXfunction
YXreturns a copy of the file permission bits
YX.I mode
YXas altered by the values pointed to by
YX.IR set .
YXWhile only the mode bits are altered, other parts of the file mode
YXmay be examined.
YX.PP
YXThe
YX.B setmode
YXfunction
YXtakes an absolute (octal) or symbolic value, as described in
YXchmod(1),
YXas an argument
YXand returns a pointer to mode values to be supplied to
YX.BR getmode .
YXBecause some of the symbolic values are relative to the file
YXcreation mask,
YX.B setmode
YXmay call
YXumask(2).
YXIf this occurs, the file creation mask will be restored before
YX.B setmode
YXreturns.
YXIf the calling program changes the value of its file creation mask
YXafter calling
YX.BR setmode ,
YX.B setmode
YXmust be called again if
YX.B getmode
YXis to modify future file modes correctly.
YX.PP
YXIf the mode passed to
YX.B setmode
YXis invalid,
YX.B setmode
YXreturns
YX.BR NULL . 
YX.SH ERRORS
YXThe
YX.B setmode
YXfunction
YXmay fail and set errno for any of the errors specified for the library
YXroutine
YXmalloc(3).
YX.SH SEE ALSO
YXchmod(1),
YXstat(2),
YXumask(2),
YXmalloc(3)
YX.SH HISTORY
YXThe
YX.B getmode
YXand
YX.B setmode
YXfunctions first appeared in 4.4BSD.
YSHAR_EOF
Ychmod 644 '/usr/src/man/man3/setmode.3'
Yfi
Yif test ! -d '/usr/src/usr.bin/xinstall'
Ythen
Y	mkdir '/usr/src/usr.bin/xinstall'
Yfi
Ycd '/usr/src/usr.bin/xinstall'
Yif test -f 'install.1'
Ythen
Y	echo shar: "will not over-write existing file 'install.1'"
Yelse
Ysed 's/^X//' << \SHAR_EOF > 'install.1'
YX.\" Copyright (c) 1987, 1990, 1993
YX.\"	The Regents of the University of California.  All rights reserved.
YX.\"
YX.\" Redistribution and use in source and binary forms, with or without
YX.\" modification, are permitted provided that the following conditions
YX.\" are met:
YX.\" 1. Redistributions of source code must retain the above copyright
YX.\"    notice, this list of conditions and the following disclaimer.
YX.\" 2. Redistributions in binary form must reproduce the above copyright
YX.\"    notice, this list of conditions and the following disclaimer in the
YX.\"    documentation and/or other materials provided with the distribution.
YX.\" 3. All advertising materials mentioning features or use of this software
YX.\"    must display the following acknowledgement:
YX.\"	This product includes software developed by the University of
YX.\"	California, Berkeley and its contributors.
YX.\" 4. Neither the name of the University nor the names of its contributors
YX.\"    may be used to endorse or promote products derived from this software
YX.\"    without specific prior written permission.
YX.\"
YX.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
YX.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
YX.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
YX.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
YX.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
YX.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
YX.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
YX.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
YX.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
YX.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
YX.\" SUCH DAMAGE.
YX.\"
YX.\"     @(#)install.1	8.1.1 (2.11BSD) 1996/2/20
YX.\"
YX.TH INSTALL 1 "February 20, 1996"
YX.UC 5
YX.SH NAME
YX\fBinstall\fP \- install binaries
YX.SH SYNOPSIS
YX.B install
YX[\fB\-cs\fP]
YX[\fB\-f\fP \fIflags\fP]
YX[\fB\-g\fP \fIgroup\fP]
YX[\fB\-m\fP \fImode\fP]
YX[\fB\-o\fP \fIowner\fP]
YX.I file1 file2
YX.sp
YX.B install
YX[\fB\-cs\fP]
YX[\fB\-f\fP \fIflags\fP]
YX[\fB\-g\fP \fIgroup\fP]
YX[\fB\-m\fP \fImode\fP]
YX[\fB\-o\fP \fIowner\fP]
YX.I file1 \&... fileN directory
YX.SH DESCRIPTION
YXThe file(s) are moved (or copied if the
YX.B\-c
YXoption is specified) to the target file or directory.
YXIf the destination is a directory, then the
YX.I file
YXis moved into
YX.I directory
YXwith its original filename.
YXIf the target file already exists, it is overwritten if permissions
YXallow.
YX.TP 8
YX.B\-c
YXCopy the file.
YXThis flag turns off the default behavior of
YX.B install
YXwhere it deletes the original file after creating the target.
YX.TP 8
YX.B\-f
YXSpecify the target's file flags.
YX(See
YXchflags(1)
YXfor a list of possible flags and their meanings.)
YX.TP 8
YX.B\-g
YXSpecify a group.
YX.TP 8
YX.B\-m
YXSpecify an alternate mode.
YXThe default mode is set to rwxr-xr-x (0755).
YXThe specified mode may be either an octal or symbolic value; see
YXchmod(1)
YXfor a description of possible mode values.
YX.TP 8
YX.B\-o
YXSpecify an owner.
YX.TP 8
YX.B\-s
YX.B Install
YXexec's the command
YXstrip(1)
YXto strip binaries so that install can be portable over a large
YXnumber of systems and binary types.
YX.PP
YXBy default,
YX.B install
YXpreserves all file flags, with the exception of the ``nodump'' flag.
YX.PP
YXThe
YX.B install
YXutility attempts to prevent moving a file onto itself.
YX.PP
YXInstalling
YX.I /dev/null
YXcreates an empty file.
YX.PP
YXUpon successful completion a value of 0 is returned.
YXOtherwise, a value of 1 is returned.
YX.SH SEE ALSO
YXchflags(1),
YXchgrp(1),
YXchmod(1),
YXcp(1),
YXmv(1),
YXstrip(1),
YXchown(8)
YX.SH HISTORY
YXThe
YX.B install
YXutility appeared in
YX4.2BSD.
YSHAR_EOF
Ychmod 644 'install.1'
Yfi
Yif test -f 'pathnames.h'
Ythen
Y	echo shar: "will not over-write existing file 'pathnames.h'"
Yelse
Ysed 's/^X//' << \SHAR_EOF > 'pathnames.h'
YX/*
YX * Copyright (c) 1989, 1993
YX *	The Regents of the University of California.  All rights reserved.
YX *
YX * Redistribution and use in source and binary forms, with or without
YX * modification, are permitted provided that the following conditions
YX * are met:
YX * 1. Redistributions of source code must retain the above copyright
YX *    notice, this list of conditions and the following disclaimer.
YX * 2. Redistributions in binary form must reproduce the above copyright
YX *    notice, this list of conditions and the following disclaimer in the
YX *    documentation and/or other materials provided with the distribution.
YX * 3. All advertising materials mentioning features or use of this software
YX *    must display the following acknowledgement:
YX *	This product includes software developed by the University of
YX *	California, Berkeley and its contributors.
YX * 4. Neither the name of the University nor the names of its contributors
YX *    may be used to endorse or promote products derived from this software
YX *    without specific prior written permission.
YX *
YX * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
YX * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
YX * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
YX * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
YX * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
YX * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
YX * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
YX * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
YX * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
YX * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
YX * SUCH DAMAGE.
YX *
YX *	@(#)pathnames.h	8.1.1 (2.11BSD) 1996/2/20
YX */
YX
YX#define	_PATH_STRIP	"/bin/strip"
YSHAR_EOF
Ychmod 644 'pathnames.h'
Yfi
Yif test -f 'xinstall.c'
Ythen
Y	echo shar: "will not over-write existing file 'xinstall.c'"
Yelse
Ysed 's/^X//' << \SHAR_EOF > 'xinstall.c'
YX/*
YX * Copyright (c) 1987, 1993
YX *	The Regents of the University of California.  All rights reserved.
YX *
YX * Redistribution and use in source and binary forms, with or without
YX * modification, are permitted provided that the following conditions
YX * are met:
YX * 1. Redistributions of source code must retain the above copyright
YX *    notice, this list of conditions and the following disclaimer.
YX * 2. Redistributions in binary form must reproduce the above copyright
YX *    notice, this list of conditions and the following disclaimer in the
YX *    documentation and/or other materials provided with the distribution.
YX * 3. All advertising materials mentioning features or use of this software
YX *    must display the following acknowledgement:
YX *	This product includes software developed by the University of
YX *	California, Berkeley and its contributors.
YX * 4. Neither the name of the University nor the names of its contributors
YX *    may be used to endorse or promote products derived from this software
YX *    without specific prior written permission.
YX *
YX * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
YX * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
YX * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
YX * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
YX * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
YX * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
YX * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
YX * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
YX * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
YX * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
YX * SUCH DAMAGE.
YX */
YX
YX#if	!defined(lint) && defined(DOSCCS)
YXstatic char copyright[] =
YX"@(#) Copyright (c) 1987, 1993\n\
YX	The Regents of the University of California.  All rights reserved.\n";
YX
YXstatic char sccsid[] = "@(#)xinstall.c	8.1.1 (2.11BSD) 1996/2/21";
YX#endif /* not lint */
YX
YX#include <sys/param.h>
YX#include <sys/wait.h>
YX#include <sys/stat.h>
YX
YX#include <ctype.h>
YX#include <errno.h>
YX#include <fcntl.h>
YX#include <grp.h>
YX#include <paths.h>
YX#include <pwd.h>
YX#include <stdio.h>
YX#include <stdlib.h>
YX#include <string.h>
YX#include <unistd.h>
YX
YX#include "pathnames.h"
YX
YXstruct passwd *pp;
YXstruct group *gp;
YXint docopy, dostrip;
YXint mode = S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;
YXchar *group, *owner, pathbuf[MAXPATHLEN];
YX
YX#define	DIRECTORY	0x01		/* Tell install it's a directory. */
YX#define	SETFLAGS	0x02		/* Tell install to set flags. */
YX
YXvoid	copy();
YXvoid	err();
YXvoid	install();
YXu_short	string_to_flags();
YXvoid	strip();
YXvoid	usage();
YX
YXint
YXmain(argc, argv)
YX	int argc;
YX	register char *argv[];
YX{
YX	struct stat from_sb, to_sb;
YX	mode_t *set;
YX	u_short fset;
YX	u_int iflags;
YX	int ch, no_target;
YX	char *flags, *to_name;
YX
YX	iflags = 0;
YX	while ((ch = getopt(argc, argv, "cf:g:m:o:s")) != EOF)
YX		switch((char)ch) {
YX		case 'c':
YX			docopy = 1;
YX			break;
YX		case 'f':
YX			flags = optarg;
YX			if (string_to_flags(&flags, &fset, NULL))
YX				err("%s: invalid flag", flags);
YX			iflags |= SETFLAGS;
YX			break;
YX		case 'g':
YX			group = optarg;
YX			break;
YX		case 'm':
YX			if (!(set = (mode_t *)setmode(optarg)))
YX				err("%s: invalid file mode", optarg);
YX			mode = getmode(set, 0);
YX			break;
YX		case 'o':
YX			owner = optarg;
YX			break;
YX		case 's':
YX			dostrip = 1;
YX			break;
YX		case '?':
YX		default:
YX			usage();
YX		}
YX	argc -= optind;
YX	argv += optind;
YX	if (argc < 2)
YX		usage();
YX
YX	/* get group and owner id's */
YX	if (group && !(gp = getgrnam(group)))
YX		err("unknown group %s", group);
YX	if (owner && !(pp = getpwnam(owner)))
YX		err("unknown user %s", owner);
YX
YX	no_target = stat(to_name = argv[argc - 1], &to_sb);
YX	if (!no_target && (to_sb.st_mode & S_IFMT) == S_IFDIR) {
YX		for (; *argv != to_name; ++argv)
YX			install(*argv, to_name, fset, iflags | DIRECTORY);
YX		exit(0);
YX	}
YX
YX	/* can't do file1 file2 directory/file */
YX	if (argc != 2)
YX		usage();
YX
YX	if (!no_target) {
YX		if (stat(*argv, &from_sb))
YX			err("%s: %s", *argv, strerror(errno));
YX		if ((to_sb.st_mode & S_IFMT) != S_IFREG)
YX			err("%s: %s", to_name, strerror(EFTYPE));
YX		if (to_sb.st_dev == from_sb.st_dev &&
YX		    to_sb.st_ino == from_sb.st_ino)
YX			err("%s and %s are the same file", *argv, to_name);
YX		/*
YX		 * Unlink now... avoid ETXTBSY errors later.  Try and turn
YX		 * off the append/immutable bits -- if we fail, go ahead,
YX		 * it might work.
YX		 */
YX#define	NOCHANGEBITS	(UF_IMMUTABLE | UF_APPEND | SF_IMMUTABLE | SF_APPEND)
YX		if (to_sb.st_flags & NOCHANGEBITS)
YX			(void)chflags(to_name,
YX			    to_sb.st_flags & ~(NOCHANGEBITS));
YX		(void)unlink(to_name);
YX	}
YX	install(*argv, to_name, fset, iflags);
YX	exit(0);
YX}
YX
YX/*
YX * install --
YX *	build a path name and install the file
YX */
YXvoid
YXinstall(from_name, to_name, fset, flags)
YX	register char *from_name, *to_name;
YX	u_short fset;
YX	u_int flags;
YX{
YX	struct stat from_sb, to_sb;
YX	int devnull, from_fd, to_fd, serrno;
YX	register char *p;
YX
YX	/* If try to install NULL file to a directory, fails. */
YX	if (flags & DIRECTORY || strcmp(from_name, _PATH_DEVNULL)) {
YX		if (stat(from_name, &from_sb))
YX			err("%s: %s", from_name, strerror(errno));
YX		if ((from_sb.st_mode & S_IFMT) != S_IFREG)
YX			err("%s: %s", from_name, strerror(EFTYPE));
YX		/* Build the target path. */
YX		if (flags & DIRECTORY) {
YX			(void)sprintf(pathbuf, "%s/%s", to_name,
YX			    (p = rindex(from_name, '/')) ? ++p : from_name);
YX			to_name = pathbuf;
YX		}
YX		devnull = 0;
YX	} else {
YX		from_sb.st_flags = 0;	/* XXX */
YX		devnull = 1;
YX	}
YX
YX	/*
YX	 * Unlink now... avoid ETXTBSY errors later.  Try and turn
YX	 * off the append/immutable bits -- if we fail, go ahead,
YX	 * it might work.
YX	 */
YX	if (stat(to_name, &to_sb) == 0 &&
YX	    to_sb.st_flags & (NOCHANGEBITS))
YX		(void)chflags(to_name, to_sb.st_flags & ~(NOCHANGEBITS));
YX	(void)unlink(to_name);
YX
YX	/* Create target. */
YX	if ((to_fd = open(to_name,
YX	    O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR)) < 0)
YX		err("%s: %s", to_name, strerror(errno));
YX	if (!devnull) {
YX		if ((from_fd = open(from_name, O_RDONLY, 0)) < 0) {
YX			(void)unlink(to_name);
YX			err("%s: %s", from_name, strerror(errno));
YX		}
YX		copy(from_fd, from_name, to_fd, to_name, from_sb.st_size);
YX		(void)close(from_fd);
YX	}
YX	if (dostrip)
YX		strip(to_name);
YX	/*
YX	 * Set owner, group, mode for target; do the chown first,
YX	 * chown may lose the setuid bits.
YX	 */
YX	if ((group || owner) &&
YX	    fchown(to_fd, owner ? pp->pw_uid : -1, group ? gp->gr_gid : -1)) {
YX		serrno = errno;
YX		(void)unlink(to_name);
YX		err("%s: chown/chgrp: %s", to_name, strerror(serrno));
YX	}
YX	if (fchmod(to_fd, mode)) {
YX		serrno = errno;
YX		(void)unlink(to_name);
YX		err("%s: chmod: %s", to_name, strerror(serrno));
YX	}
YX
YX	/*
YX	 * If provided a set of flags, set them, otherwise, preserve the
YX	 * flags, except for the dump flag.
YX	 */
YX	if (fchflags(to_fd,
YX	    flags & SETFLAGS ? fset : from_sb.st_flags & ~UF_NODUMP)) {
YX		serrno = errno;
YX		(void)unlink(to_name);
YX		err("%s: chflags: %s", to_name, strerror(serrno));
YX	}
YX
YX	(void)close(to_fd);
YX	if (!docopy && !devnull && unlink(from_name))
YX		err("%s: %s", from_name, strerror(errno));
YX}
YX
YX/*
YX * copy --
YX *	copy from one file to another
YX */
YXvoid
YXcopy(from_fd, from_name, to_fd, to_name, size)
YX	register int from_fd, to_fd;
YX	char *from_name, *to_name;
YX	off_t size;
YX{
YX	register int nr, nw;
YX	int serrno;
YX	char buf[MAXBSIZE];
YX
YX	while ((nr = read(from_fd, buf, sizeof(buf))) > 0)
YX		if ((nw = write(to_fd, buf, nr)) != nr) {
YX			serrno = errno;
YX			(void)unlink(to_name);
YX			err("%s: %s",
YX			    to_name, strerror(nw > 0 ? EIO : serrno));
YX		}
YX	if (nr != 0) {
YX		serrno = errno;
YX		(void)unlink(to_name);
YX		err("%s: %s", from_name, strerror(serrno));
YX	}
YX}
YX
YX/*
YX * strip --
YX *	use strip(1) to strip the target file
YX */
YXvoid
YXstrip(to_name)
YX	register char *to_name;
YX{
YX	register int serrno;
YX	int status;
YX
YX	switch (vfork()) {
YX	case -1:
YX		serrno = errno;
YX		(void)unlink(to_name);
YX		err("forks: %s", strerror(errno));
YX	case 0:
YX		execl(_PATH_STRIP, "strip", to_name, NULL);
YX		err("%s: %s", _PATH_STRIP, strerror(errno));
YX	default:
YX		if (wait(&status) == -1 || status)
YX			(void)unlink(to_name);
YX	}
YX}
YX
YX/*
YX * usage --
YX *	print a usage message and die
YX */
YXvoid
YXusage()
YX{
YX	(void)fprintf(stderr,
YX"usage: install [-cs] [-f flags] [-g group] [-m mode] [-o owner] file1 file2;\n\tor file1 ... fileN directory\n");
YX	exit(1);
YX}
YX
YX#if __STDC__
YX#include <stdarg.h>
YX#else
YX#include <varargs.h>
YX#endif
YX
YXvoid
YX#if __STDC__
YXerr(const char *fmt, ...)
YX#else
YXerr(fmt, va_alist)
YX	char *fmt;
YX        va_dcl
YX#endif
YX{
YX	va_list ap;
YX#if __STDC__
YX	va_start(ap, fmt);
YX#else
YX	va_start(ap);
YX#endif
YX	(void)fprintf(stderr, "install: ");
YX	(void)vfprintf(stderr, fmt, ap);
YX	va_end(ap);
YX	(void)fprintf(stderr, "\n");
YX	exit(1);
YX	/* NOTREACHED */
YX}
YSHAR_EOF
Ychmod 644 'xinstall.c'
Yfi
Yif test -f 'Makefile'
Ythen
Y	echo shar: "will not over-write existing file 'Makefile'"
Yelse
Ysed 's/^X//' << \SHAR_EOF > 'Makefile'
YX#
YX# Public Domain.  1996/2/20 - Steven Schultz
YX#
YX#	@(#)Makefile	1.0 (2.11BSD GTE) 1996/2/20
YX#
YXCFLAGS=	 -O
YXSEPFLAG= -i
YXVPATH=	/usr/src/bin/ls
YXSRCS=	xinstall.c stat_flags.c
YXOBJS=	xinstall.o stat_flags.o
YXMAN=	install.0
YXMANSRC=	install.1
YX
YXall: xinstall ${MAN}
YX
YXxinstall: ${OBJS}
YX	${CC} ${CFLAGS} ${SEPFLAG} -o $@ ${OBJS}
YX
YXinstall.0: ${MANSRC}
YX	/usr/man/manroff ${MANSRC} > ${MAN}
YX
YXclean:
YX	rm -f ${OBJS} ${MAN} xinstall tags 
YX
YXdepend: ${SRCS}
YX	mkdep ${CFLAGS} ${SRCS}
YX
YXinstall: all
YX	install -c -o bin -g bin -m 444 ${MAN} ${DESTDIR}/usr/man/cat1
YX	install -s -o root -g bin -m 755 xinstall ${DESTDIR}/usr/bin/install
YX
YXlint: ${SRCS}
YX	lint -hax ${SRCS}
YX
YXtags: ${SRCS}
YX	ctags ${SRCS}
YX# DO NOT DELETE THIS LINE -- mkdep uses it.
YX# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
YSHAR_EOF
Ychmod 644 'Makefile'
Yfi
Ychmod 755 .
Ycd ..
Yexit 0
Y#	End of shell archive
SHAR_EOF
fi
if test -f '/tmp/304.patch'
then
	echo shar: "will not over-write existing file '/tmp/304.patch'"
else
sed 's/^Y//' << \SHAR_EOF > '/tmp/304.patch'
Y*** /usr/src/lib/libc/gen/Makefile.old	Tue Dec 26 17:22:42 1995
Y--- /usr/src/lib/libc/gen/Makefile	Fri Feb 23 20:45:36 1996
Y***************
Y*** 3,9 ****
Y  # All rights reserved.  The Berkeley software License Agreement
Y  # specifies the terms and conditions for redistribution.
Y  #
Y! #	@(#)Makefile	5.7.4 (2.11BSD) 1995/04/13
Y  #
Y  # Several routines have been rewritten in assembly language for the VAX and
Y  # the PDP. If you are not running on a VAX or PDP, you should use the
Y--- 3,9 ----
Y  # All rights reserved.  The Berkeley software License Agreement
Y  # specifies the terms and conditions for redistribution.
Y  #
Y! #	@(#)Makefile	5.7.5 (2.11BSD) 1996/02/23
Y  #
Y  # Several routines have been rewritten in assembly language for the VAX and
Y  # the PDP. If you are not running on a VAX or PDP, you should use the
Y***************
Y*** 22,27 ****
Y--- 22,28 ----
Y  	initgroups.c isatty.c malloc.c mktemp.c ndbm.c nlist.c \
Y  	opendir.c perror.c popen.c psignal.c qsort.c random.c readdir.c \
Y  	regex.c scandir.c seekdir.c setgid.c setegid.c setrgid.c setuid.c \
Y+ 	setmode.c \
Y  	setenv.c seteuid.c setruid.c siglist.c signal.c siginterrupt.c \
Y  	sleep.c strcasecmp.c strftime.c swab.c sysctl.c syslog.c system.c \
Y  	telldir.c time.c timezone.c ttyname.c ttyslot.c ualarm.c usleep.c \
Y***************
Y*** 35,40 ****
Y--- 36,42 ----
Y  	initgroups.o isatty.o malloc.o mktemp.o ndbm.o nlist.o \
Y  	opendir.o perror.o popen.o psignal.o qsort.o random.o readdir.o \
Y  	regex.o scandir.o seekdir.o setgid.o setegid.o setrgid.o setuid.o \
Y+ 	setmode.o \
Y  	setenv.o seteuid.o setruid.o siglist.o signal.o siginterrupt.o \
Y  	sleep.o strcasecmp.o strftime.o swab.o sysctl.o syslog.o system.o \
Y  	telldir.o time.o timezone.o ttyname.o ttyslot.o ualarm.o usleep.o \
Y*** /usr/src/man/man1/Makefile.old	Fri Jan 26 00:46:47 1996
Y--- /usr/src/man/man1/Makefile	Fri Feb 23 20:42:35 1996
Y***************
Y*** 14,20 ****
Y  # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
Y  # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Y  #
Y! #	@(#)Makefile	1.3 (2.11BSD) 1996/01/26
Y  #
Y  MDIR=	/usr/man/cat1
Y  SRCS=	adb.1 addbib.1 apply.1 apropos.1 as.1 at.1 atq.1 atrm.1 \
Y--- 14,20 ----
Y  # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
Y  # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Y  #
Y! #	@(#)Makefile	1.4 (2.11BSD) 1996/02/23
Y  #
Y  MDIR=	/usr/man/cat1
Y  SRCS=	adb.1 addbib.1 apply.1 apropos.1 as.1 at.1 atq.1 atrm.1 \
Y***************
Y*** 25,31 ****
Y  	efl.1 eqn.1 error.1 ex.1 expand.1 expr.1 f77.1 false.1 file.1 \
Y  	find.1 fmt.1 fold.1 fpr.1 from.1 fsplit.1 gcore.1 \
Y  	graph.1 grep.1 groups.1 head.1 hostid.1 indent.1 \
Y! 	install.1 intro.1 iostat.1 join.1 kill.1 last.1 lastcomm.1 ld.1 \
Y  	learn.1 leave.1 lex.1 lint.1 lisp.1 ln.1 logger.1 login.1 \
Y  	look.1 lookbib.1 lorder.1 lpq.1 lpr.1 lprm.1 lptest.1 ls.1 \
Y  	lxref.1 m4.1 mail.1 make.1 man.1 mesg.1 mkdep.1 mkdir.1 mkstr.1 \
Y--- 25,31 ----
Y  	efl.1 eqn.1 error.1 ex.1 expand.1 expr.1 f77.1 false.1 file.1 \
Y  	find.1 fmt.1 fold.1 fpr.1 from.1 fsplit.1 gcore.1 \
Y  	graph.1 grep.1 groups.1 head.1 hostid.1 indent.1 \
Y! 	intro.1 iostat.1 join.1 kill.1 last.1 lastcomm.1 ld.1 \
Y  	learn.1 leave.1 lex.1 lint.1 lisp.1 ln.1 logger.1 login.1 \
Y  	look.1 lookbib.1 lorder.1 lpq.1 lpr.1 lprm.1 lptest.1 ls.1 \
Y  	lxref.1 m4.1 mail.1 make.1 man.1 mesg.1 mkdep.1 mkdir.1 mkstr.1 \
Y***************
Y*** 53,59 ****
Y  	efl.0 eqn.0 error.0 ex.0 expand.0 expr.0 f77.0 false.0 file.0 \
Y  	find.0 fmt.0 fold.0 fpr.0 from.0 fsplit.0 gcore.0 \
Y  	graph.0 grep.0 groups.0 head.0 hostid.0 indent.0 \
Y! 	install.0 intro.0 iostat.0 join.0 kill.0 last.0 lastcomm.0 ld.0 \
Y  	learn.0 leave.0 lex.0 lint.0 lisp.0 ln.0 logger.0 login.0 \
Y  	look.0 lookbib.0 lorder.0 lpq.0 lpr.0 lprm.0 lptest.0 ls.0 \
Y  	lxref.0 m4.0 mail.0 make.0 man.0 mesg.0 mkdep.0 mkdir.0 mkstr.0 \
Y--- 53,59 ----
Y  	efl.0 eqn.0 error.0 ex.0 expand.0 expr.0 f77.0 false.0 file.0 \
Y  	find.0 fmt.0 fold.0 fpr.0 from.0 fsplit.0 gcore.0 \
Y  	graph.0 grep.0 groups.0 head.0 hostid.0 indent.0 \
Y! 	intro.0 iostat.0 join.0 kill.0 last.0 lastcomm.0 ld.0 \
Y  	learn.0 leave.0 lex.0 lint.0 lisp.0 ln.0 logger.0 login.0 \
Y  	look.0 lookbib.0 lorder.0 lpq.0 lpr.0 lprm.0 lptest.0 ls.0 \
Y  	lxref.0 m4.0 mail.0 make.0 man.0 mesg.0 mkdep.0 mkdir.0 mkstr.0 \
Y*** /usr/src/man/man3/Makefile.old	Thu Jan 25 23:31:29 1996
Y--- /usr/src/man/man3/Makefile	Fri Feb 23 20:40:26 1996
Y***************
Y*** 14,20 ****
Y  # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
Y  # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Y  #
Y! #	@(#)Makefile	5.4.8 (2.11BSD) 1996/1/25
Y  #
Y  MDIR=	/usr/man/cat3
Y  SRCS1=	abort.3 abs.3 alarm.3 asinh.3 assert.3 atof.3 bstring.3 byteorder.3 \
Y--- 14,20 ----
Y  # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
Y  # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Y  #
Y! #	@(#)Makefile	5.4.9 (2.11BSD) 1996/2/23
Y  #
Y  MDIR=	/usr/man/cat3
Y  SRCS1=	abort.3 abs.3 alarm.3 asinh.3 assert.3 atof.3 bstring.3 byteorder.3 \
Y***************
Y*** 32,37 ****
Y--- 32,38 ----
Y  	qsort.3 rand.3 random.3 rcmd.3 regex.3 resolver.3 rexec.3 scandir.3 \
Y  	scanf.3 setbuf.3 setjmp.3 setuid.3 siginterrupt.3 signal.3 sin.3 \
Y  	sinh.3 sleep.3 sqrt.3 stdio.3 strftime.3 string.3 strtok.3 stty.3 \
Y+ 	setmode.3 \
Y  	strcspn.3 strpbrk.3 strsep.3 strspn.3 strtol.3 strtoul.3 strstr.3 \
Y  	swab.3 sysctl.3 syslog.3 \
Y  	system.3 termcap.3 time.3 times.3 ttyname.3 ualarm.3 uname.3 ungetc.3 \
Y***************
Y*** 51,56 ****
Y--- 52,58 ----
Y  	qsort.0 rand.0 random.0 rcmd.0 regex.0 resolver.0 rexec.0 scandir.0 \
Y  	scanf.0 setbuf.0 setjmp.0 setuid.0 siginterrupt.0 signal.0 sin.0 \
Y  	sinh.0 sleep.0 sqrt.0 stdio.0 strftime.0 string.0 strtok.0 stty.0 \
Y+ 	setmode.0 \
Y  	strcspn.0 strpbrk.0 strsep.0 strspn.0 strtol.0 strtoul.0 strstr.0 \
Y  	swab.0 sysctl.0 syslog.0 \
Y  	system.0 termcap.0 time.0 times.0 ttyname.0 ualarm.0 uname.0 ungetc.0 \
Y***************
Y*** 94,100 ****
Y  	setprotoent.0 setusershell.0 endhostent.0 gethostbyaddr.0 gethostent.0 \
Y  	sethostent.0 sethostfile.0 memccpy.0 memchr.0 memcmp.0 memcpy.0 \
Y  	memset.0 strchr.0 strrchr.0 tmpnam.0 tmpfile.0 \
Y! 	tempnam.0
Y  
Y  REMO4=	verr.0 errx.0 verrx.0 warn.0 warnx.0 vwarnx.0
Y  
Y--- 96,102 ----
Y  	setprotoent.0 setusershell.0 endhostent.0 gethostbyaddr.0 gethostent.0 \
Y  	sethostent.0 sethostfile.0 memccpy.0 memchr.0 memcmp.0 memcpy.0 \
Y  	memset.0 strchr.0 strrchr.0 tmpnam.0 tmpfile.0 \
Y! 	tempnam.0 getmode.0
Y  
Y  REMO4=	verr.0 errx.0 verrx.0 warn.0 warnx.0 vwarnx.0
Y  
Y***************
Y*** 369,374 ****
Y--- 371,377 ----
Y  	ln ${DESTDIR}${MDIR}/gethostbyname.0 ${DESTDIR}${MDIR}/gethostent.0
Y  	ln ${DESTDIR}${MDIR}/gethostbyname.0 ${DESTDIR}${MDIR}/sethostent.0
Y  	ln ${DESTDIR}${MDIR}/gethostbyname.0 ${DESTDIR}${MDIR}/sethostfile.0
Y+ 	ln ${DESTDIR}${MDIR}/setmode.0 ${DESTDIR}${MDIR}/getmode.0
Y  	ln ${DESTDIR}${MDIR}/compat-sys5.0 ${DESTDIR}${MDIR}/memccpy.0
Y  	ln ${DESTDIR}${MDIR}/compat-sys5.0 ${DESTDIR}${MDIR}/memchr.0
Y  	ln ${DESTDIR}${MDIR}/compat-sys5.0 ${DESTDIR}${MDIR}/memcmp.0
Y*** /usr/src/usr.bin/Makefile.old	Wed Jun 21 20:38:08 1995
Y--- /usr/src/usr.bin/Makefile	Fri Feb 23 20:33:28 1996
Y***************
Y*** 1,4 ****
Y! #	Makefile	1.2 (2.11BSD GTE) 1995/06/21
Y  #
Y  DESTDIR=
Y  CFLAGS=	-O
Y--- 1,4 ----
Y! #	Makefile	1.3 (2.11BSD GTE) 1996/02/23
Y  #
Y  DESTDIR=
Y  CFLAGS=	-O
Y***************
Y*** 8,14 ****
Y  #
Y  SUBDIR=	at calendar dc diction diff3 eqn f77 find graph learn lex lint \
Y  	m4 neqn plot printf prof ranlib ratfor refer roff spell struct tbl \
Y! 	tip uucp uname yacc xargs
Y  
Y  # Shell scripts that need only be installed and are never removed.
Y  #
Y--- 8,14 ----
Y  #
Y  SUBDIR=	at calendar dc diction diff3 eqn f77 find graph learn lex lint \
Y  	m4 neqn plot printf prof ranlib ratfor refer roff spell struct tbl \
Y! 	tip uucp uname yacc xargs xinstall
Y  
Y  # Shell scripts that need only be installed and are never removed.
Y  #
Y***************
Y*** 17,23 ****
Y  # C source that lives in the current directory
Y  #
Y  SRCS=	basename.c cal.c cb.c checkeq.c col.c comm.c crypt.c deroff.c \
Y! 	fgrep.c file.c install.c iostat.c join.c look.c mesg.c ptx.c \
Y  	rev.c sleep.c sort.c spline.c split.c sum.c tabs.c \
Y  	tc.c tk.c touch.c tr.c tsort.c tty.c uniq.c units.c
Y  
Y--- 17,23 ----
Y  # C source that lives in the current directory
Y  #
Y  SRCS=	basename.c cal.c cb.c checkeq.c col.c comm.c crypt.c deroff.c \
Y! 	fgrep.c file.c iostat.c join.c look.c mesg.c ptx.c \
Y  	rev.c sleep.c sort.c spline.c split.c sum.c tabs.c \
Y  	tc.c tk.c touch.c tr.c tsort.c tty.c uniq.c units.c
Y  
Y***************
Y*** 37,43 ****
Y  #
Y  KMEM=	iostat
Y  
Y! all: ${SUBDIR} ${STD} ${NSTD} ${KMEM} xinstall
Y  
Y  ${SUBDIR}: FRC
Y  	cd $@; make ${MFLAGS} SEPFLAG=${SEPFLAG}
Y--- 37,43 ----
Y  #
Y  KMEM=	iostat
Y  
Y! all: ${SUBDIR} ${STD} ${NSTD} ${KMEM}
Y  
Y  ${SUBDIR}: FRC
Y  	cd $@; make ${MFLAGS} SEPFLAG=${SEPFLAG}
Y***************
Y*** 47,53 ****
Y  ${STD} ${KMEM}:
Y  	${CC} ${CFLAGS} ${SEPFLAG} -o $@ $@.c
Y  
Y! install: ${STD} ${NSTD} ${KMEM} xinstall units.lib
Y  	-for i in ${SUBDIR}; do \
Y  		(cd $$i; make ${MFLAGS} DESTDIR=${DESTDIR} install); done
Y  	-for i in ${SCRIPT}; do \
Y--- 47,53 ----
Y  ${STD} ${KMEM}:
Y  	${CC} ${CFLAGS} ${SEPFLAG} -o $@ $@.c
Y  
Y! install: ${STD} ${NSTD} ${KMEM} units.lib
Y  	-for i in ${SUBDIR}; do \
Y  		(cd $$i; make ${MFLAGS} DESTDIR=${DESTDIR} install); done
Y  	-for i in ${SCRIPT}; do \
Y***************
Y*** 55,61 ****
Y  	-for i in ${KMEM}; do \
Y  		(install -s -g kmem -m 2755 $$i ${DESTDIR}/usr/bin/$$i); done
Y  	install -s ${STD} ${NSTD} ${DESTDIR}/usr/bin
Y- 	install -s -m 755 xinstall ${DESTDIR}/usr/bin/install
Y  	install -c -m 755 units.lib ${DESTDIR}/usr/lib/units
Y  
Y  clean:
Y--- 55,60 ----
Y***************
Y*** 76,85 ****
Y  	mv y.tab.o $@.o
Y  	${CC} ${SEPFLAG} -o $@ $@.o
Y  	rm -f $@.o
Y- 
Y- # Can't have two "install" targets in a makefile now, can we?
Y- xinstall: install.c
Y- 	${CC} ${CFLAGS} ${SEPFLAG} -o xinstall install.c
Y  
Y  # DO NOT DELETE THIS LINE -- make depend uses it
Y  
Y--- 75,80 ----
Y*** /VERSION.old	Wed Feb  7 23:29:24 1996
Y--- /VERSION	Fri Feb 23 20:34:10 1996
Y***************
Y*** 1,4 ****
Y! Current Patch Level: 303
Y  
Y  2.11 BSD
Y  ============
Y--- 1,4 ----
Y! Current Patch Level: 304
Y  
Y  2.11 BSD
Y  ============
SHAR_EOF
fi
if test -f '/tmp/304.script'
then
	echo shar: "will not over-write existing file '/tmp/304.script'"
else
sed 's/^Y//' << \SHAR_EOF > '/tmp/304.script'
Y#!/bin/sh
Y
Yrm /usr/src/man/man1/install.1
Yrm /usr/src/usr.bin/install.c
SHAR_EOF
chmod +x '/tmp/304.script'
fi
exit 0
#	End of shell archive