Subject: chflags - immutable|appendonly files come to 2BSD(#208 - Part 12 of 14)
Index:	bin,etc,lib,sys/many_files 2.11BSD

Description:
	Files/directories can not be declared append-only, immutable, archived 
	or not to be dumped under 2.11BSD.

	dump(8) lacked the ability to bypass files marked for 'nodump'.

	Upper case only and Hazeltine terminal support made the tty driver 
	(and several utilities - 'vi' and 'getty' to name two) needlessly
	complicated and larger (especially since those devices are obsolete).

	open(2) can not provide for atomically obtaining a flock(2)'d
	file descriptor.

	open(2)ing with O_NDELAY (now called O_NONBLOCK) would not wait
	for carrier on the first i/o operation.

	Obsolete stub system calls 'setdopt' and 'getdopt' were still
	present in the kernel even though they have never done anything
	except take up space.

Repeat-By:
	This section does not apply this time since this is an 'update'
	which adds new functionality rather than fixing an existing bug.

Fix:
	Refer to part 1 (#197) for the complete description and installation
	instructions.

	This is part 12 of 14 (#208).

	Files affected by this part are:

/usr/src/etc/dump/Makefile
/usr/src/etc/dump/dump.h
/usr/src/etc/dump/dumpitime.c
/usr/src/etc/dump/dumpmain.c
/usr/src/etc/dump/dumpoptr.c
/usr/src/etc/dump/dumprmt.c
/usr/src/etc/dump/dumptraverse.c
/usr/src/etc/getty/get_date.c
/usr/src/etc/getty/gettytab.h
/usr/src/etc/getty/gettytab
/usr/src/etc/getty/init.c
/usr/src/etc/getty/main.c
/usr/src/etc/getty/subr.c
/usr/src/etc/pstat.c

=====================cut  here========================
*** /usr/src/etc/dump/Makefile.old	Sun Feb 28 18:22:26 1993
--- /usr/src/etc/dump/Makefile	Tue Dec  6 21:35:10 1994
***************
*** 1,4 ****
! # sccsid = "@(#)Makefile	1.3 (Berkeley) 2/20/81"
  #
  #	dump.h			header file
  #	dumpitime.c		reads /etc/ddate
--- 1,4 ----
! # sccsid = "@(#)Makefile	1.4 (2.11BSD GTE) 12/6/94"
  #
  #	dump.h			header file
  #	dumpitime.c		reads /etc/ddate
***************
*** 43,49 ****
  	rm -f *.o dump rdump dumpdir
  
  lint:
! 	lint -chapbx ${CFLAGS} -DRDUMP ${SRCS}
  
  ${OBJS}: dump.h
  
--- 43,49 ----
  	rm -f *.o dump rdump dumpdir
  
  lint:
! 	lint -chabx ${CFLAGS} -DRDUMP ${SRCS}
  
  ${OBJS}: dump.h
  
*** /usr/src/etc/dump/dump.h.old	Sun Feb 28 22:27:40 1993
--- /usr/src/etc/dump/dump.h	Tue Dec  6 21:48:31 1994
***************
*** 1,5 ****
  /*
!  * "@(#)dump.h	1.1 (Berkeley) 10/13/80"
   */
  #define	NI	4	/* number of blocks of inodes per read */
  
--- 1,5 ----
  /*
!  * "@(#)dump.h	1.2 (2.11BSD GTE) 12/6/94"
   */
  #define	NI	4	/* number of blocks of inodes per read */
  
***************
*** 40,50 ****
  int	to;		/* tape file descriptor */
  int	pipeout;	/* true => output to standard output */
  ino_t	ino;		/* current inumber; used globally */
  int	nsubdir;
  int	newtape;	/* new tape flag */
  int	nadded;		/* number of added sub directories */
  int	dadded;		/* directory added flag */
! int	density;	/* density in 0.1" units */
  long	tsize;		/* tape size in 0.1" units */
  long	esize;		/* estimated tape size, blocks */
  long	asize;		/* number of 0.1" units written on current tape */
--- 40,52 ----
  int	to;		/* tape file descriptor */
  int	pipeout;	/* true => output to standard output */
  ino_t	ino;		/* current inumber; used globally */
+ int	lastlevel;
+ int	nonodump;
  int	nsubdir;
  int	newtape;	/* new tape flag */
  int	nadded;		/* number of added sub directories */
  int	dadded;		/* directory added flag */
! u_short	density;	/* density in 0.1" units */
  long	tsize;		/* tape size in 0.1" units */
  long	esize;		/* estimated tape size, blocks */
  long	asize;		/* number of 0.1" units written on current tape */
***************
*** 54,60 ****
  long	blockswritten;	/* number of blocks written on current tape */
  int	tapeno;		/* current tape number */
  time_t	tstart_writing;	/* when started writing the first tape block */
- char	*processname;
  
  time_t	time();
  off_t	lseek();
--- 56,61 ----
***************
*** 68,74 ****
  int	dmpspc();
  int	dsrch();
  int	nullf();
- char	*getsuffix();
  char	*rawname();
  
  int	interrupt();		/* in case operator bangs on console */
--- 69,74 ----
*** /usr/src/etc/dump/dumpitime.c.old	Sat Apr 28 20:36:52 1990
--- /usr/src/etc/dump/dumpitime.c	Thu Dec 15 19:28:36 1994
***************
*** 1,5 ****
  #if	!defined(lint) && defined(DOSCCS)
! static	char *sccsid = "@(#)dumpitime.c	1.1 (Berkeley) 10/13/80";
  #endif
  
  #include "dump.h"
--- 1,5 ----
  #if	!defined(lint) && defined(DOSCCS)
! static	char *sccsid = "@(#)dumpitime.c	1.2 (2.11BSD GTE) 12/6/94";
  #endif
  
  #include "dump.h"
***************
*** 7,13 ****
  char *prdate(d)
  	time_t d;
  {
! 	char *p;
  
  	if(d == 0)
  		return("the epoch");
--- 7,13 ----
  char *prdate(d)
  	time_t d;
  {
! 	register char *p;
  
  	if(d == 0)
  		return("the epoch");
***************
*** 16,26 ****
  	return(p);
  }
  
- struct	idates	**idatev = 0;
- int	nidates = 0;
- int	idates_in = 0;
- struct	itime	*ithead = 0;
- 
  inititimes()
  {
  			FILE	*df;
--- 16,21 ----
***************
*** 66,71 ****
--- 61,67 ----
  		fname, increm, incno);
  #endif
  	spcl.c_ddate = 0;
+ 	lastlevel = '0';
  
  	inititimes();
  	/*
***************
*** 81,86 ****
--- 77,83 ----
  		if (ip->id_ddate <= spcl.c_ddate)
  			continue;
  		spcl.c_ddate = ip->id_ddate;
+ 		lastlevel = ip->id_incno;
  	} 
  }
  
***************
*** 158,200 ****
  		idatep->id_name, idatep->id_incno, prdate(idatep->id_ddate));
  #endif
  	return(0);
- }
- 
- /*
-  *	Convert from old format to new format
-  *	Convert from /etc/ddate to /etc/dumpdates format
-  */
- o_nconvert()
- {
- 	FILE	*oldfile;
- 	FILE	*newfile;
- 	struct	idates	idate;
- 	struct	idates	idatecopy;
- 
- 	if( (newfile = fopen(NINCREM, "w")) == NULL){
- 		msg("%s: Can not open %s to update.\n", processname, NINCREM);
- 		Exit(X_ABORT);
- 	}
- 	if ( (oldfile = fopen(OINCREM, "r")) != NULL){
- 		while(!feof(oldfile)){
- 			if (fread((char *)&idate, sizeof(idate), 1, oldfile) != 1)
- 				break;
- 			/*
- 			 *	The old format ddate did not have
- 			 *	the full special path name on it;
- 			 *	we add the prefix /dev/ to the
- 			 *	special name, although this may not be
- 			 *	always the right thing to do.
- 			 */
- 			idatecopy = idate;
- 			strcpy(idatecopy.id_name, "/dev/");
- 			strncat(idatecopy.id_name, idate.id_name,
- 				sizeof(idate.id_name) - sizeof ("/dev/"));
- 			recout(newfile, &idatecopy);
- 		}
- 	}
- 	fclose(oldfile);
- 	fclose(newfile);
  }
  
  time_t	unctime();
--- 155,160 ----
*** /usr/src/etc/dump/dumpmain.c.old	Sun Feb 28 17:38:02 1993
--- /usr/src/etc/dump/dumpmain.c	Tue Dec  6 21:26:20 1994
***************
*** 1,133 ****
  #if	!defined(lint) && defined(DOSCCS)
! static	char *sccsid = "@(#)dumpmain.c	1.2 (Berkeley) 10/16/80";
  #endif
  
  #include "dump.h"
  
! int	notify = 0;	/* notify operator flag */
! long	blockswritten = 0L;	/* number of blocks written on current tape */
! int	tapeno = 0;	/* current tape number */
! int	density = 160;	/* density in 0.1" units */
! #ifdef RDUMP
! char	*host;
! int	rmthost();
! #endif
  
  main(argc, argv)
  	int	argc;
  	char	*argv[];
  {
! 	char		*arg;
! 	register	i;
! 	float		fetapes;
! 	register	struct	fstab	*dt;
  
  	time(&(spcl.c_date));
  
! 	tsize = 2300L*12L*10L;
  	tape = TAPE;
- 	disk = DISK;
  	increm = NINCREM;
  
! 	incno = '9';
! 	uflag = 0;
! 	arg = "u";
! 	if(argc > 1) {
! 		argv++;
! 		argc--;
! 		arg = *argv;
! 		if (*arg == '-')
! 			arg++;
  	}
! 	while(*arg)
! 	switch (*arg++) {
! 	case 'w':
! 		lastdump('w');		/* tell us only what has to be done */
! 		exit(0);
! 		break;
! 	case 'W':			/* what to do */
! 		lastdump('W');		/* tell us the current state of what has been done */
! 		exit(0);		/* do nothing else */
! 		break;
  
! 	case 'J':			/* update old to new */
! 		o_nconvert();
! 		exit(0);		/* do nothing else */
! 		break;
  
! 	case 'f':			/* output file */
! 		if(argc > 1) {
! 			argv++;
! 			argc--;
! 			tape = *argv;
! 		}
! 		break;
  
! 	case 'd':			/* density, in bits per inch */
! 		if (argc > 1) {
! 			argv++;
  			argc--;
! 			density = atoi(*argv) / 10;
! 		}
! 		break;
  
! 	case 's':			/* tape size, feet */
! 		if(argc > 1) {
! 			argv++;
  			argc--;
! 			tsize = atol(*argv);
! 			tsize *= 12L*10L;
! 		}
! 		break;
  
! 	case '0':			/* dump level */
! 	case '1':
! 	case '2':
! 	case '3':
! 	case '4':
! 	case '5':
! 	case '6':
! 	case '7':
! 	case '8':
! 	case '9':
! 		incno = arg[-1];
! 		break;
  
! 	case 'u':			/* update /etc/dumpdates */
! 		uflag++;
! 		break;
  
! 	case 'n':			/* notify operators */
! 		notify++;
! 		break;
  
! 	default:
! 		printf("bad key '%c%'\n", arg[-1]);
! 		Exit(X_ABORT);
  	}
! 	if(argc > 1) {
! 		argv++;
! 		argc--;
! 		disk = *argv;
  	}
  	if (strcmp(tape, "-") == 0) {
  		pipeout++;
  		tape = "standard output";
  	}
  #ifdef RDUMP
! 	{ char *index();
! 	  host = tape;
! 	  tape = index(host, ':');
! 	  if (tape == 0) {
! 		msg("need keyletter ``f'' and device ``host:tape''\n");
! 		exit(1);
! 	  }
! 	  *tape++ = 0;
! 	  if (rmthost(host) == 0)
  		exit(X_ABORT);
- 	}
- 	setuid(getuid());	/* rmthost() is the only reason to be setuid */
  #endif
  	if (signal(SIGHUP, sighup) == SIG_IGN)
  		signal(SIGHUP, SIG_IGN);
  	if (signal(SIGTRAP, sigtrap) == SIG_IGN)
--- 1,179 ----
  #if	!defined(lint) && defined(DOSCCS)
! static	char *sccsid = "@(#)dumpmain.c	1.3 (2.11BSD GTE) 12/6/94";
  #endif
  
  #include "dump.h"
  
! long	blocksperfile;
! int	cartridge = 0;
! static	long	numarg();
! static	void	missingarg();
  
+ char	*host = NULL;
+ 
  main(argc, argv)
  	int	argc;
  	char	*argv[];
  {
! 	register char	*cp;
! 	int	i, Tflag = 0, honorlevel = 1, mapsize;
! 	register struct	fstab	*dt;
  
+ 	density = 160;	/* density in 0.1" units */
  	time(&(spcl.c_date));
  
! 	tsize = 0;	/* Default later, based on 'c' option for cart tapes */
  	tape = TAPE;
  	increm = NINCREM;
+ 	incno = '0';
  
! 	if (argc == 1) {
! 		(void) fprintf(stderr, "Must specify a key.\n");
! 		Exit(X_ABORT);
  	}
! 	argv++;
! 	argc -= 2;
  
! 	for (cp = *argv++; *cp; cp++) {
! 		switch (*cp) {
! 		case '-':
! 			break;
  
! 		case 'w':
! 			lastdump('w');	/* tell us only what has to be done */
! 			exit(0);
! 			break;
  
! 		case 'W':		/* what to do */
! 			lastdump('W');	/* tell us state of what is done */
! 			exit(0);	/* do nothing else */
! 
! 		case 'f':		/* output file */
! 			if (argc < 1)
! 				missingarg('f', "output file");
! 			tape = *argv++;
  			argc--;
! 			break;
  
! 		case 'd':		/* density, in bits per inch */
! 			density = numarg('d', "density",
! 				10L, 327670L, &argc, &argv) / 10;
! 			break;
! 
! 		case 's':			/* tape size, feet */
! 			tsize = numarg('s', "size",
! 				1L, 0L, &argc, &argv) * 12 * 10;
! 			break;
! 
! 		case 'T':		/* time of last dump */
! 			if (argc < 1)
! 				missingarg('T', "time of last dump");
! 			spcl.c_ddate = unctime(*argv);
! 			if (spcl.c_ddate < 0) {
! 				(void)fprintf(stderr, "bad time \"%s\"\n",
! 					*argv);
! 				exit(X_ABORT);
! 			}
! 			Tflag = 1;
! 			lastlevel = '?';
  			argc--;
! 			argv++;
! 			break;
! #ifdef	notnow
! 		case 'b':		/* blocks per tape write */
! 			ntrec = numarg('b', "number of blocks per write",
! 				    1L, 1000L, &argc, &argv);
! 			break;
! #endif
  
! 		case 'B':		/* blocks per output file */
! 			blocksperfile = numarg('B', "number of blocks per file",
! 				    1L, 0L, &argc, &argv);
! 			break;
  
! 		case 'c':		/* Tape is cart. not 9-track */
! 			cartridge = 1;
! 			break;
  
! 		/* dump level */
! 		case '0': case '1': case '2': case '3': case '4':
! 		case '5': case '6': case '7': case '8': case '9':
! 			incno = *cp;
! 			break;
  
! 		case 'u':			/* update /etc/dumpdates */
! 			uflag++;
! 			break;
! 
! 		case 'n':			/* notify operators */
! 			notify++;
! 			break;
! 
! 		case 'h':
! 			honorlevel = numarg('h', "honor level",
! 				0L, 10L, &argc, &argv);
! 			break;
! 
! 		default:
! 			fprintf(stderr, "bad key '%c%'\n", *cp);
! 			exit(X_ABORT);
! 		}
  	}
! 	if (argc < 1) {
! 		(void)fprintf(stderr, "Must specify disk or filesystem\n");
! 		exit(X_ABORT);
  	}
+ 	disk = *argv++;
+ 	argc--;
+ 	if (argc >= 1) {
+ 		(void)fprintf(stderr, "Unknown arguments to dump:");
+ 		while (argc--)
+ 			(void)fprintf(stderr, " %s", *argv++);
+ 		(void)fprintf(stderr, "\n");
+ 		exit(X_ABORT);
+ 	}
+ 	if (Tflag && uflag) {
+ 	        (void)fprintf(stderr,
+ 		    "You cannot use the T and u flags together.\n");
+ 		exit(X_ABORT);
+ 	}
  	if (strcmp(tape, "-") == 0) {
  		pipeout++;
  		tape = "standard output";
  	}
+ 
+ 	if (blocksperfile)
+ 		blocksperfile = blocksperfile / NTREC * NTREC; /* round down */
+ 	else {
+ 		/*
+ 		 * Determine how to default tape size and density
+ 		 *
+ 		 *         	density				tape size
+ 		 * 9-track	1600 bpi (160 bytes/.1")	2300 ft.
+ 		 * 9-track	6250 bpi (625 bytes/.1")	2300 ft.
+ 		 * cartridge	8000 bpi (100 bytes/.1")	1700 ft.
+ 		 *						(450*4 - slop)
+ 		 */
+ 		if (density == 0)
+ 			density = cartridge ? 100 : 160;
+ 		if (tsize == 0)
+ 			tsize = cartridge ? 1700L*120L : 2300L*120L;
+ 	}
+ 
+ 	if (index(tape, ':')) {
+ 		host = tape;
+ 		tape = index(host, ':');
+ 		*tape++ = '\0';
  #ifdef RDUMP
! 		if (rmthost(host) == 0)
! 			exit(X_ABORT);
! #else
! 		(void)fprintf(stderr, "remote dump not enabled\n");
  		exit(X_ABORT);
  #endif
+ 	}
+ 	(void)setuid(getuid()); /* rmthost() is the only reason to be setuid */
+ 
  	if (signal(SIGHUP, sighup) == SIG_IGN)
  		signal(SIGHUP, SIG_IGN);
  	if (signal(SIGTRAP, sigtrap) == SIG_IGN)
***************
*** 140,147 ****
  		signal(SIGSEGV, SIG_IGN);
  	if (signal(SIGTERM, sigterm) == SIG_IGN)
  		signal(SIGTERM, SIG_IGN);
- 	
- 
  	if (signal(SIGINT, interrupt) == SIG_IGN)
  		signal(SIGINT, SIG_IGN);
  
--- 186,191 ----
***************
*** 158,175 ****
  		else
  			dt = getfsspec(deraw(disk));
  
! 	getitime();		/* /etc/dumpdates snarfed */
  
! 	msg("Date of this level %c dump: %s\n", incno, prdate(spcl.c_date));
! 	msg("Date of last level %c dump: %s\n", incno, prdate(spcl.c_ddate));
  	msg("Dumping %s ", disk);
  	if (dt != 0)
  		msgtail("(%s) ", dt->fs_file);
! #ifdef RDUMP
! 	msgtail("to %s on host %s\n", tape, host);
! #else
! 	msgtail("to %s\n", tape);
! #endif
  
  	fi = open(disk, 0);
  	if (fi < 0) {
--- 202,221 ----
  		else
  			dt = getfsspec(deraw(disk));
  
! 	if (!Tflag)
! 		getitime();	/* /etc/dumpdates snarfed */
  
! 	msg("Date of this level %c dump: %s\n", incno,
! 		prdate(spcl.c_date));
! 	msg("Date of last level %c dump: %s\n", lastlevel,
! 		prdate(spcl.c_ddate));
  	msg("Dumping %s ", disk);
  	if (dt != 0)
  		msgtail("(%s) ", dt->fs_file);
! 	if (host)
! 		msgtail("to %s on host %s\n", tape, host);
! 	else
! 		msgtail("to %s\n", tape);
  
  	fi = open(disk, 0);
  	if (fi < 0) {
***************
*** 179,186 ****
--- 225,236 ----
  	bzero(clrmap, sizeof (clrmap));
  	bzero(dirmap, sizeof (dirmap));
  	bzero(nodmap, sizeof (nodmap));
+ 	mapsize = roundup(howmany(sizeof(dirmap),NBBY), DEV_BSIZE);
+ 
  	esize = 0;
  
+ 	nonodump = (incno - '0') < honorlevel;
+ 
  	msg("mapping (Pass I) [regular files]\n");
  	pass(mark, (short *)NULL);		/* mark updates esize */
  
***************
*** 193,216 ****
  	bmapest(clrmap);
  	bmapest(nodmap);
  
! 	fetapes =
! 		(	 esize		/* blocks */
! 			*DEV_BSIZE	/* bytes / block */
! 			*(1.0/density)	/* 0.1" / byte */
! 		  +
! 			 esize		/* blocks */
! 			*(1.0/NTREC)	/* IRG's / block */
! 			*7		/* 0.1" / IRG */
! 		) * (1.0 / tsize )	/* tape / 0.1" */
! 	;
! 	etapes = fetapes;		/* truncating assignment */
! 	etapes++;
! 	/*
! 	 *	esize is typically about 5% too low; we frob it here
! 	 */
! 	esize += ((5*esize)/100);
! 	msg("estimated %ld tape blocks on %3.2f tape(s).\n", esize, fetapes);
  
  	alloctape();			/* Allocate tape buffer */
  
  	otape();			/* bitmap is the first to tape write */
--- 243,294 ----
  	bmapest(clrmap);
  	bmapest(nodmap);
  
! 	if (pipeout) {
! 		esize += 10;	/* 10 trailer blocks */
! 		msg("estimated %ld tape blocks.\n", esize);
! 	} else {
! 		double fetapes;
  
+ 		if (blocksperfile)
+ 			fetapes = (double) esize / blocksperfile;
+ 		else if (cartridge) {
+ 			/* Estimate number of tapes, assuming streaming stops at
+ 			   the end of each block written, and not in mid-block.
+ 			   Assume no erroneous blocks; this can be compensated
+ 			   for with an artificially low tape size. */
+ 			fetapes = 
+ 			(	  esize		/* blocks */
+ 				* DEV_BSIZE	/* bytes/block */
+ 				* (1.0/density)	/* 0.1" / byte */
+ 			  +
+ 				  esize		/* blocks */
+ 				* (1.0/NTREC)	/* streaming-stops per block */
+ 				* 15.48		/* 0.1" / streaming-stop */
+ 			) * (1.0 / tsize );	/* tape / 0.1" */
+ 		} else {
+ 			/* Estimate number of tapes, for old fashioned 9-track
+ 			   tape */
+ 			int tenthsperirg = (density == 625) ? 3 : 7;
+ 			fetapes =
+ 			(	  esize		/* blocks */
+ 				* DEV_BSIZE	/* bytes / block */
+ 				* (1.0/density)	/* 0.1" / byte */
+ 			  +
+ 				  esize		/* blocks */
+ 				* (1.0/NTREC)	/* IRG's / block */
+ 				* tenthsperirg	/* 0.1" / IRG */
+ 			) * (1.0 / tsize );	/* tape / 0.1" */
+ 		}
+ 		etapes = fetapes;		/* truncating assignment */
+ 		etapes++;
+ 		/* count the dumped inodes map on each additional tape */
+ 		esize += (etapes - 1) *
+ 			(howmany(mapsize * sizeof(char), DEV_BSIZE) + 1);
+ 		esize += etapes + 10;	/* headers + 10 trailer blks */
+ 		msg("estimated %ld tape blocks on %3.2f tape(s).\n",
+ 		    esize, fetapes);
+ 	}
+ 
  	alloctape();			/* Allocate tape buffer */
  
  	otape();			/* bitmap is the first to tape write */
***************
*** 224,249 ****
  	pass(dump, nodmap);
  
  	spcl.c_type = TS_END;
- #ifndef	RDUMP
  	for(i=0; i<NTREC; i++)
  		spclrec();
- #endif
  	msg("DUMP: %ld tape blocks on %d tape(s)\n",spcl.c_tapea,spcl.c_volume);
  	msg("DUMP IS DONE\n");
  
  	putitime();
- #ifndef RDUMP
- 	if (!pipeout) {
- 		close(to);
- 		rewind();
- 	}
- #else
- 	for (i = 0; i < NTREC; i++)
- 		spclrec();
  	rewind();
- #endif
  	broadcast("DUMP IS DONE!\7\7\n");
  	Exit(X_FINOK);
  }
  
  int	sighup(){	msg("SIGHUP()  try rewriting\n"); sigAbort();}
--- 302,361 ----
  	pass(dump, nodmap);
  
  	spcl.c_type = TS_END;
  	for(i=0; i<NTREC; i++)
  		spclrec();
  	msg("DUMP: %ld tape blocks on %d tape(s)\n",spcl.c_tapea,spcl.c_volume);
  	msg("DUMP IS DONE\n");
  
  	putitime();
  	rewind();
  	broadcast("DUMP IS DONE!\7\7\n");
  	Exit(X_FINOK);
+ }
+ 
+ /*
+  * Pick up a numeric argument.  It must be nonnegative and in the given
+  * range (except that a vmax of 0 means unlimited).
+  */
+ static long
+ numarg(letter, meaning, vmin, vmax, pargc, pargv)
+ 	int letter;
+ 	char *meaning;
+ 	long vmin, vmax;
+ 	int *pargc;
+ 	char ***pargv;
+ {
+ 	register char *p;
+ 	long val;
+ 	char *str;
+ 
+ 	if (--*pargc < 0)
+ 		missingarg(letter, meaning);
+ 	str = *(*pargv)++;
+ 	for (p = str; *p; p++)
+ 		if (!isdigit(*p))
+ 			goto bad;
+ 	val = atol(str);
+ 	if (val < vmin || (vmax && val > vmax))
+ 		goto bad;
+ 	return (val);
+ 
+ bad:
+ 	(void)fprintf(stderr, "bad '%c' (%s) value \"%s\"\n",
+ 	    letter, meaning, str);
+ 	exit(X_ABORT);
+ /* NOTREACHED */
+ }
+ 
+ static void
+ missingarg(letter, meaning)
+ 	int letter;
+ 	char *meaning;
+ {
+ 
+ 	(void)fprintf(stderr, "The '%c' flag (%s) requires an argument\n",
+ 	    letter, meaning);
+ 	exit(X_ABORT);
  }
  
  int	sighup(){	msg("SIGHUP()  try rewriting\n"); sigAbort();}
*** /usr/src/etc/dump/dumpoptr.c.old	Sat Apr 28 20:37:32 1990
--- /usr/src/etc/dump/dumpoptr.c	Thu Dec 15 19:38:56 1994
***************
*** 1,5 ****
  #if	!defined(lint) && defined(DOSCCS)
! static	char *sccsid = "@(#)dumpoptr.c	1.4 (Berkeley) 12/17/80";
  #endif
  
  #include "dump.h"
--- 1,5 ----
  #if	!defined(lint) && defined(DOSCCS)
! static	char *sccsid = "@(#)dumpoptr.c	1.5 (2.11BSD GTE) 12/6/94";
  #endif
  
  #include "dump.h"
***************
*** 18,23 ****
--- 18,24 ----
   */
  int	timeout;
  char	*attnmessage;		/* attemtion message */
+ 
  query(question)
  	char	*question;
  {
***************
*** 177,185 ****
  {
  	char t[50], buf[BUFSIZ];
  	register char *cp;
! 	register int c, ch;
! 	int	msize;
! 	FILE *f_tty;
  
  	msize = strlen(message);
  	strcpy(t, "/dev/");
--- 178,186 ----
  {
  	char t[50], buf[BUFSIZ];
  	register char *cp;
! 	register int c;
! 	int	ch, msize;
! 	register FILE *f_tty;
  
  	msize = strlen(message);
  	strcpy(t, "/dev/");
***************
*** 234,257 ****
  	}
  }
  
! int blocksontape()
! {
! 	/*
! 	 *	esize: total number of blocks estimated over all reels
! 	 *	blockswritten:	blocks actually written, over all reels
! 	 *	etapes:	estimated number of tapes to write
! 	 *
! 	 *	tsize:	blocks can write on this reel
! 	 *	asize:	blocks written on this reel
! 	 *	tapeno:	number of tapes written so far
! 	 */
! 	if (tapeno == etapes)
! 		return(esize - (etapes - 1)*tsize);
! 	return(tsize);
! }
! 
! 	/* VARARGS1 */
! 	/* ARGSUSED */
  msg(fmt, a1, a2, a3, a4, a5)
  	char	*fmt;
  {
--- 235,242 ----
  	}
  }
  
! /* VARARGS1 */
! /* ARGSUSED */
  msg(fmt, a1, a2, a3, a4, a5)
  	char	*fmt;
  {
***************
*** 264,271 ****
  	fflush(stderr);
  }
  
! 	/* VARARGS1 */
! 	/* ARGSUSED */
  msgtail(fmt, a1, a2, a3, a4, a5)
  	char	*fmt;
  {
--- 249,256 ----
  	fflush(stderr);
  }
  
! /* VARARGS1 */
! /* ARGSUSED */
  msgtail(fmt, a1, a2, a3, a4, a5)
  	char	*fmt;
  {
***************
*** 334,346 ****
  				return (-1);
  	else
  		return (diff);
- }
- 
- int max(a,b)
- {
- 	return(a>b?a:b);
- }
- int min(a,b)
- {
- 	return(a<b?a:b);
  }
--- 319,322 ----
*** /usr/src/etc/dump/dumprmt.c.old	Sun Feb 28 18:01:35 1993
--- /usr/src/etc/dump/dumprmt.c	Thu Dec 15 19:36:26 1994
***************
*** 32,38 ****
   */
  
  #if	!defined(lint) && defined(DOSCCS)
! static char sccsid[] = "@(#)dumprmt.c	5.11 (Berkeley) 3/7/91";
  #endif
  
  #include <sys/param.h>
--- 32,38 ----
   */
  
  #if	!defined(lint) && defined(DOSCCS)
! static char sccsid[] = "@(#)dumprmt.c	1.2 (2.11BSD GTE) 12/7/94";
  #endif
  
  #include <sys/param.h>
***************
*** 41,58 ****
  #include <sys/socket.h>
  #include <sys/inode.h>
  #include <signal.h>
- 
  #include <netinet/in.h>
- 
  #include <netdb.h>
  #include <protocols/dumprestor.h>
  #include <pwd.h>
  #include <stdio.h>
- #ifdef __STDC__
- #include <unistd.h>
- #include <stdlib.h>
- #include <string.h>
- #endif
  
  #define	TS_CLOSED	0
  #define	TS_OPEN		1
--- 41,51 ----
***************
*** 139,168 ****
  }
  
  int
- rmtread(buf, count)
- 	char *buf;
- 	int count;
- {
- 	char line[30];
- 	int n, i, cc;
- 	extern errno;
- 
- 	(void)sprintf(line, "R%d\n", count);
- 	n = rmtcall("read", line);
- 	if (n < 0) {
- 		errno = n;
- 		return (-1);
- 	}
- 	for (i = 0; i < n; i += cc) {
- 		cc = read(rmtape, buf+i, n - i);
- 		if (cc <= 0) {
- 			rmtconnaborted();
- 		}
- 	}
- 	return (n);
- }
- 
- int
  rmtwrite(buf, count)
  	char *buf;
  	int count;
--- 132,137 ----
***************
*** 173,243 ****
  	write(rmtape, line, strlen(line));
  	write(rmtape, buf, count);
  	return (rmtreply("write"));
- }
- 
- void
- rmtwrt0(count)
- 	int count;
- {
- 	char line[30];
- 
- 	(void)sprintf(line, "W%d\n", count);
- 	write(rmtape, line, strlen(line));
- }
- 
- void
- rmtwrt1(buf, count)
- 	char *buf;
- 	int count;
- {
- 
- 	write(rmtape, buf, count);
- }
- 
- int
- rmtwrt2()
- {
- 
- 	return (rmtreply("write"));
- }
- 
- int
- rmtseek(offset, pos)
- 	off_t offset;
- 	int pos;
- {
- 	char line[80];
- 
- 	(void)sprintf(line, "L%ld\n%d\n", offset, pos);
- 	return (rmtcall("seek", line));
- }
- 
- struct	mtget mts;
- 
- struct mtget *
- rmtstatus()
- {
- 	register int i;
- 	register char *cp;
- 
- 	if (rmtstate != TS_OPEN)
- 		return (0);
- 	rmtcall("status", "S\n");
- 	for (i = 0, cp = (char *)&mts; i < sizeof(mts); i++)
- 		*cp++ = rmtgetb();
- 	return (&mts);
- }
- 
- int
- rmtioctl(cmd, count)
- 	int cmd, count;
- {
- 	char buf[256];
- 
- 	if (count < 0)
- 		return (-1);
- 	(void)sprintf(buf, "I%d\n%d\n", cmd, count);
- 	return (rmtcall("ioctl", buf));
  }
  
  int
--- 142,147 ----
*** /usr/src/etc/dump/dumptraverse.c.old	Tue Jun 19 15:11:32 1990
--- /usr/src/etc/dump/dumptraverse.c	Tue Dec  6 20:10:48 1994
***************
*** 1,5 ****
  #if	!defined(lint) && defined(DOSCCS)
! static	char *sccsid = "@(#)dumptraverse.c	1.1 (Berkeley) 10/13/80";
  #endif
  
  #include "dump.h"
--- 1,5 ----
  #if	!defined(lint) && defined(DOSCCS)
! static	char *sccsid = "@(#)dumptraverse.c	1.2 (2.11BSD GTE) 12/6/94";
  #endif
  
  #include "dump.h"
***************
*** 87,94 ****
  	}
  }
  
  mark(ip)
! struct dinode *ip;
  {
  	register f;
  
--- 87,98 ----
  	}
  }
  
+ #define	CHANGEDSINCE(dp,t)  ((dp)->di_mtime >= (t) || (dp)->di_ctime >= (t))
+ #define	WANTTODUMP(dp)  (CHANGEDSINCE(dp,spcl.c_ddate) && \
+ 			 (nonodump || (dp->di_flags & UF_NODUMP) != UF_NODUMP))
+ 
  mark(ip)
! register struct dinode *ip;
  {
  	register f;
  
***************
*** 98,105 ****
  	BIS(ino, clrmap);
  	if(f == IFDIR)
  		BIS(ino, dirmap);
! 	if(ip->di_mtime >= spcl.c_ddate ||
! 	   ip->di_ctime >= spcl.c_ddate) {
  		BIS(ino, nodmap);
  		if (f != IFREG && f != IFDIR && f != IFLNK){
  			esize++;
--- 102,108 ----
  	BIS(ino, clrmap);
  	if(f == IFDIR)
  		BIS(ino, dirmap);
! 	if (WANTTODUMP(ip)) {
  		BIS(ino, nodmap);
  		if (f != IFREG && f != IFDIR && f != IFLNK){
  			esize++;
*** /usr/src/etc/getty/get_date.c.old	Sun Feb 15 20:50:42 1987
--- /usr/src/etc/getty/get_date.c	Fri Dec  9 22:49:14 1994
***************
*** 4,12 ****
   * specifies the terms and conditions for redistribution.
   */
  
! #ifndef lint
! static char sccsid[] = "@(#)get_date.c	5.1 (Berkeley) 4/29/85";
! #endif not lint
  
  #include <stdio.h>
  #include <sys/time.h>
--- 4,12 ----
   * specifies the terms and conditions for redistribution.
   */
  
! #if	!defined(lint) && defined(DOSCCS)
! static char sccsid[] = "@(#)get_date.c	5.1.1 (2.11BSD GTE) 12/9/94";
! #endif
  
  #include <stdio.h>
  #include <sys/time.h>
***************
*** 26,35 ****
  get_date(datebuffer)
  	char *datebuffer;
  {
! 	struct tm *localtime(), *tmp;
  	struct timeval tv;
  	int realhour;
! 	char *zone;
  
  	gettimeofday(&tv, 0);
  	tmp = localtime(&tv.tv_sec);
--- 26,35 ----
  get_date(datebuffer)
  	char *datebuffer;
  {
! 	register struct tm *tmp;
  	struct timeval tv;
  	int realhour;
! 	register char *zone;
  
  	gettimeofday(&tv, 0);
  	tmp = localtime(&tv.tv_sec);
*** /usr/src/etc/getty/gettytab.h.old	Mon Jan 10 21:44:34 1994
--- /usr/src/etc/getty/gettytab.h	Fri Dec  9 22:32:21 1994
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)gettytab.h	5.2.1 (2.11BSD GTE) 12/31/93
   */
  
  /*
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)gettytab.h	5.2.2 (2.11BSD GTE) 12/9/94
   */
  
  /*
***************
*** 97,110 ****
  #define	PE	gettyflags[10].value
  #define	RW	gettyflags[11].value
  #define	XC	gettyflags[12].value
! #define	LC	gettyflags[13].value
! #define	UC	gettyflags[14].value
! #define	IG	gettyflags[15].value
! #define	PS	gettyflags[16].value
! #define	HC	gettyflags[17].value
! #define UB	gettyflags[18].value
! #define AB	gettyflags[19].value
! #define DX	gettyflags[20].value
  
  int	getent();
  long	getnum();
--- 97,108 ----
  #define	PE	gettyflags[10].value
  #define	RW	gettyflags[11].value
  #define	XC	gettyflags[12].value
! #define	IG	gettyflags[13].value
! #define	PS	gettyflags[14].value
! #define	HC	gettyflags[15].value
! #define UB	gettyflags[16].value
! #define AB	gettyflags[17].value
! #define DX	gettyflags[18].value
  
  int	getent();
  long	getnum();
*** /usr/src/etc/getty/gettytab.old	Fri Jan 22 12:43:59 1993
--- /usr/src/etc/getty/gettytab	Fri Dec  9 22:37:31 1994
***************
*** 2,8 ****
  # All rights reserved.  The Berkeley software License Agreement
  # specifies the terms and conditions for redistribution.
  #
! #	@(#)gettytab	5.7 (Berkeley) 2/16/86
  #
  #
  # Most of the table entries here are just copies of the
--- 2,8 ----
  # All rights reserved.  The Berkeley software License Agreement
  # specifies the terms and conditions for redistribution.
  #
! #	@(#)gettytab	5.7.1 (2.11BSD GTE) 12/9/94
  #
  #
  # Most of the table entries here are just copies of the
***************
*** 29,35 ****
  #	be assigned to any table desired (hopefully the same speed).
  #
  a|std.110|110-baud:\
! 	:nd#1:cd#1:uc:sp#110:
  b|std.134|134.5-baud:\
  	:ep:nd#1:cd#2:ff#1:td#1:sp#134:ht:nl:
  1|std.150|150-baud:\
--- 29,35 ----
  #	be assigned to any table desired (hopefully the same speed).
  #
  a|std.110|110-baud:\
! 	:nd#1:cd#1:sp#110:
  b|std.134|134.5-baud:\
  	:ep:nd#1:cd#2:ff#1:td#1:sp#134:ht:nl:
  1|std.150|150-baud:\
***************
*** 72,80 ****
  
  e|Console-1200|Console Decwriter III:\
  	:fd@:nd@:cd@:rw:tc=1200-baud:
- 
- i|Interdata console:\
- 	:uc:sp#0:
  
  l|lsi chess terminal:\
  	:sp#300:
--- 72,77 ----
*** /usr/src/etc/getty/init.c.old	Sun Feb 15 20:50:40 1987
--- /usr/src/etc/getty/init.c	Fri Dec  9 22:31:55 1994
***************
*** 4,12 ****
   * specifies the terms and conditions for redistribution.
   */
  
! #ifndef lint
! static char sccsid[] = "@(#)init.c	5.2 (Berkeley) 1/7/86";
! #endif not lint
  
  /*
   * Getty table initializations.
--- 4,12 ----
   * specifies the terms and conditions for redistribution.
   */
  
! #if	!defined(lint) && defined(DOSCCS)
! static char sccsid[] = "@(#)init.c	5.2.1 (2.11BSD GTE) 12/9/94";
! #endif
  
  /*
   * Getty table initializations.
***************
*** 80,87 ****
  	{ "pe",	0 },			/* printer erase */
  	{ "rw",	1 },			/* don't use raw */
  	{ "xc",	1 },			/* don't ^X ctl chars */
- 	{ "lc",	0 },			/* terminal las lower case */
- 	{ "uc",	0 },			/* terminal has no lower case */
  	{ "ig",	0 },			/* ignore garbage */
  	{ "ps",	0 },			/* do port selector speed select */
  	{ "hc",	1 },			/* don't set hangup on close */
--- 80,85 ----
*** /usr/src/etc/getty/main.c.old	Sat Dec  5 13:04:59 1987
--- /usr/src/etc/getty/main.c	Fri Dec  9 22:42:41 1994
***************
*** 4,18 ****
   * specifies the terms and conditions for redistribution.
   */
  
! #ifndef lint
  char copyright[] =
  "@(#) Copyright (c) 1980 Regents of the University of California.\n\
   All rights reserved.\n";
- #endif not lint
  
! #ifndef lint
! static char sccsid[] = "@(#)main.c	5.5 (Berkeley) 1/23/86";
! #endif not lint
  
  /*
   * getty -- adapt to terminal speed on dialup, and call login
--- 4,16 ----
   * specifies the terms and conditions for redistribution.
   */
  
! #if	!defined(lint) && defined(DOSCCS)
  char copyright[] =
  "@(#) Copyright (c) 1980 Regents of the University of California.\n\
   All rights reserved.\n";
  
! static char sccsid[] = "@(#)main.c	5.5.1 (2.11BSD GTE) 12/9/94";
! #endif
  
  /*
   * getty -- adapt to terminal speed on dialup, and call login
***************
*** 110,116 ****
  main(argc, argv)
  	char *argv[];
  {
! 	char *tname;
  	long allflags;
  	int repcnt = 0;
  	int someflags;
--- 108,114 ----
  main(argc, argv)
  	char *argv[];
  {
! 	register char *tname;
  	long allflags;
  	int repcnt = 0;
  	int someflags;
***************
*** 225,234 ****
  			someflags = allflags >> 16;
  			if (crmod || NL)
  				tmode.sg_flags |= CRMOD;
- 			if (upper || UC)
- 				tmode.sg_flags |= LCASE;
- 			if (lower || LC)
- 				tmode.sg_flags &= ~LCASE;
  			ioctl(0, TIOCSETP, &tmode);
  			ioctl(0, TIOCSLTC, &ltc);
  			ioctl(0, TIOCLSET, &someflags);
--- 223,228 ----
***************
*** 288,296 ****
  			putf("\r\n");
  			break;
  		}
! 		if (c >= 'a' && c <= 'z')
  			lower++;
! 		else if (c >= 'A' && c <= 'Z')
  			upper++;
  		else if (c == ERASE || c == '#' || c == '\b') {
  			if (np > name) {
--- 282,290 ----
  			putf("\r\n");
  			break;
  		}
! 		if (islower(c))
  			lower++;
! 		else if (isupper(c))
  			upper++;
  		else if (c == ERASE || c == '#' || c == '\b') {
  			if (np > name) {
***************
*** 312,318 ****
  			prompt();
  			np = name;
  			continue;
! 		} else if (c >= '0' && c <= '9')
  			digit++;
  		if (IG && (c <= ' ' || c > 0176))
  			continue;
--- 306,312 ----
  			prompt();
  			np = name;
  			continue;
! 		} else if (isdigit(c))
  			digit++;
  		if (IG && (c <= ' ' || c > 0176))
  			continue;
***************
*** 323,332 ****
  	*np = 0;
  	if (c == '\r')
  		crmod++;
- 	if (upper && !lower && !LC || UC)
- 		for (np = name; *np; np++)
- 			if (isupper(*np))
- 				*np = tolower(*np);
  	return (1);
  }
  
--- 317,322 ----
*** /usr/src/etc/getty/subr.c.old	Fri Mar 17 20:01:57 1989
--- /usr/src/etc/getty/subr.c	Fri Dec  9 22:43:32 1994
***************
*** 4,12 ****
   * specifies the terms and conditions for redistribution.
   */
  
! #ifndef lint
! static char sccsid[] = "@(#)subr.c	5.4 (Berkeley) 1/7/86";
! #endif not lint
  
  /*
   * Melbourne getty.
--- 4,12 ----
   * specifies the terms and conditions for redistribution.
   */
  
! #if	!defined(lint) && defined(DOSCCS)
! static char sccsid[] = "@(#)subr.c	5.4.1 (2.11BSD GTE) 12/9/94";
! #endif
  
  /*
   * Melbourne getty.
***************
*** 148,156 ****
  		f |= ODDP;
  	else if (EP)
  		f |= EVENP;
- 
- 	if (UC)
- 		f |= LCASE;
  
  	if (NL)
  		f |= CRMOD;
--- 148,153 ----
*** /usr/src/etc/pstat.c.old	Sat Jan 15 11:55:22 1994
--- /usr/src/etc/pstat.c	Thu Dec 15 19:45:46 1994
***************
*** 4,17 ****
   * specifies the terms and conditions for redistribution.
   */
  
! #ifdef never
  char copyright[] =
  "@(#) Copyright (c) 1980 Regents of the University of California.\n\
   All rights reserved.\n";
  
! /* static char sccsid[] = "@(#)pstat.c	5.8 (Berkeley) 5/5/86"; */
! static char sccsid[] = "@(#)pstat.c	1.2 (2.11BSD) 12/31/93";
! #endif not lint
  
  /*
   * Print system stuff
--- 4,16 ----
   * specifies the terms and conditions for redistribution.
   */
  
! #if	!defined(lint) && defined(DOSCCS)
  char copyright[] =
  "@(#) Copyright (c) 1980 Regents of the University of California.\n\
   All rights reserved.\n";
  
! static char sccsid[] = "@(#)pstat.c	5.8.2 (2.11BSD GTE) 12/7/94";
! #endif
  
  /*
   * Print system stuff
***************
*** 499,505 ****
  	putf(tp->t_state&TS_TBLOCK, 'b');
  	putf(tp->t_state&TS_RCOLL, 'r');
  	putf(tp->t_state&TS_WCOLL, 'w');
- 	putf(tp->t_state&TS_NBIO, 'n');
  	putf(tp->t_state&TS_ASYNC, 'a');
  	printf("%6d", tp->t_pgrp);
  	switch (tp->t_line) {
--- 498,503 ----
***************
*** 756,762 ****
  		putf((long)fp->f_flag&FSHLOCK, 'S');
  		putf((long)fp->f_flag&FEXLOCK, 'X');
  		putf((long)fp->f_flag&FASYNC, 'I');
! 		putf((long)fp->f_flag&FNDELAY, 'n');
  		putf((long)fp->f_flag&FMARK, 'm');
  		putf((long)fp->f_flag&FDEFER, 'd');
  		printf("  %3d", fp->f_count);
--- 754,760 ----
  		putf((long)fp->f_flag&FSHLOCK, 'S');
  		putf((long)fp->f_flag&FEXLOCK, 'X');
  		putf((long)fp->f_flag&FASYNC, 'I');
! 		putf((long)fp->f_flag&FNONBLOCK, 'n');
  		putf((long)fp->f_flag&FMARK, 'm');
  		putf((long)fp->f_flag&FDEFER, 'd');
  		printf("  %3d", fp->f_count);
