diff -c -P --recursive --exclude=COPYRIGHT --exclude=COPYING netstd.orig/finger.orig/Makefile netstd/finger/Makefile
*** netstd.orig/finger.orig/Makefile	Thu Jan  1 01:00:00 1970
--- netstd/finger/Makefile	Mon Jul  4 20:33:06 1994
***************
*** 0 ****
--- 1,14 ----
+ CFLAGS = -O2 -fomit-frame-pointer -m486 -include /usr/include/bsd/bsd.h \
+ 		-I/usr/include/bsd
+ LDFLAGS = -s -v
+ LDLIBS = -lbsd
+ 
+ finger: finger.o lprint.o net.o sprint.o util.o
+ 
+ install: finger
+ 	install -o root -g root -m 0755 finger ${DEBDIR}/usr/bin
+ 	install -o root -g root -m 0644 finger.1 ${DEBDIR}/usr/man/man1
+ 
+ clean:
+ 	rm -f *.o finger
+ 
diff -c -P --recursive --exclude=COPYRIGHT --exclude=COPYING netstd.orig/finger.orig/finger.1 netstd/finger/finger.1
*** netstd.orig/finger.orig/finger.1	Fri Dec 17 08:11:10 1993
--- netstd/finger/finger.1	Sun Jul 16 21:59:25 1995
***************
*** 40,46 ****
  .Nd user information lookup program
  .Sh SYNOPSIS
  .Nm finger
! .Op Fl lmsp
  .Op Ar user ...
  .Op Ar user@host ...
  .Sh DESCRIPTION
--- 40,46 ----
  .Nd user information lookup program
  .Sh SYNOPSIS
  .Nm finger
! .Op Fl 7lmsp
  .Op Ar user ...
  .Op Ar user@host ...
  .Sh DESCRIPTION
***************
*** 57,64 ****
  denied), idle time, login time, office location and office phone
  number.
  .Pp
- Idle time is in minutes if it is a single integer, hours and minutes
- if a ``:'' is present, or days if a ``d'' is present.
  Login time is displayed as month, day, hours and minutes, unless
  more than six months ago, in which case the year is displayed rather
  than the hours and minutes.
--- 57,62 ----
***************
*** 73,86 ****
  option as well as the user's home directory, home phone number, login
  shell, mail status, and the contents of the files
  .Dq Pa .plan
! and
  .Dq Pa .project
  from the user's home directory.
  .Pp
- If idle time is at least a minute and less than a day, it is
- presented in the form ``hh:mm''.
- Idle times greater than a day are presented as ``d day[s]hh:mm''.
- .Pp
  Phone numbers specified as eleven digits are printed as ``+N-NNN-NNN-NNNN''.
  Numbers specified as ten or seven digits are printed as the appropriate
  subset of that string.
--- 71,82 ----
  option as well as the user's home directory, home phone number, login
  shell, mail status, and the contents of the files
  .Dq Pa .plan
! ,
  .Dq Pa .project
+ and
+ .Dq Pa .forward
  from the user's home directory.
  .Pp
  Phone numbers specified as eleven digits are printed as ``+N-NNN-NNN-NNNN''.
  Numbers specified as ten or seven digits are printed as the appropriate
  subset of that string.
***************
*** 122,127 ****
--- 118,125 ----
  All name matching performed by
  .Nm finger
  is case insensitive.
+ .It Fl 7
+ Set character size to 7 bits (default: 8 bits).
  .El
  .Pp
  If no options are specified,
diff -c -P --recursive --exclude=COPYRIGHT --exclude=COPYING netstd.orig/finger.orig/finger.c netstd/finger/finger.c
*** netstd.orig/finger.orig/finger.c	Fri Dec 17 08:11:10 1993
--- netstd/finger/finger.c	Sun Jul 16 21:59:25 1995
***************
*** 65,74 ****
  #include <sys/param.h>
  #include <sys/file.h>
  #include <stdio.h>
  #include "finger.h"
  
  time_t now;
! int lflag, sflag, mflag, pplan;
  char tbuf[1024];
  
  main(argc, argv)
--- 65,75 ----
  #include <sys/param.h>
  #include <sys/file.h>
  #include <stdio.h>
+ #include <paths.h>
  #include "finger.h"
  
  time_t now;
! int eflag = 1, lflag, sflag, mflag, pplan;
  char tbuf[1024];
  
  main(argc, argv)
***************
*** 79,86 ****
  	int ch;
  	time_t time();
  
! 	while ((ch = getopt(argc, argv, "lmps")) != EOF)
  		switch(ch) {
  		case 'l':
  			lflag = 1;		/* long format */
  			break;
--- 80,90 ----
  	int ch;
  	time_t time();
  
! 	while ((ch = getopt(argc, argv, "7lmps")) != EOF)
  		switch(ch) {
+ 		case '7':
+ 			eflag = 0;		/* clear high (8th) bit */
+ 			break;
  		case 'l':
  			lflag = 1;		/* long format */
  			break;
***************
*** 96,102 ****
  		case '?':
  		default:
  			(void)fprintf(stderr,
! 			    "usage: finger [-lmps] [login ...]\n");
  			exit(1);
  		}
  	argc -= optind;
--- 100,106 ----
  		case '?':
  		default:
  			(void)fprintf(stderr,
! 			    "usage: finger [-7lmps] [login ...]\n");
  			exit(1);
  		}
  	argc -= optind;
***************
*** 145,154 ****
  		(void)fprintf(stderr, "finger: can't read %s.\n", _PATH_UTMP);
  		exit(2);
  	}
! 	name[UT_NAMESIZE] = NULL;
  	while (fread((char *)&user, sizeof(user), 1, stdin) == 1) {
  		if (!user.ut_name[0])
  			continue;
  		if ((pn = find_person(user.ut_name)) == NULL) {
  			bcopy(user.ut_name, name, UT_NAMESIZE);
  			if ((pw = getpwnam(name)) == NULL)
--- 149,161 ----
  		(void)fprintf(stderr, "finger: can't read %s.\n", _PATH_UTMP);
  		exit(2);
  	}
! 	name[UT_NAMESIZE] = '\0';
  	while (fread((char *)&user, sizeof(user), 1, stdin) == 1) {
  		if (!user.ut_name[0])
  			continue;
+ #ifdef USER_PROCESS
+ 		if (user.ut_type != USER_PROCESS) continue;
+ #endif
  		if ((pn = find_person(user.ut_name)) == NULL) {
  			bcopy(user.ut_name, name, UT_NAMESIZE);
  			if ((pw = getpwnam(name)) == NULL)
***************
*** 241,246 ****
--- 248,256 ----
  	while (fread((char *)&user, sizeof(user), 1, stdin) == 1) {
  		if (!user.ut_name[0])
  			continue;
+ #ifdef USER_PROCESS
+ 		if (user.ut_type != USER_PROCESS) continue;
+ #endif
  		if ((pn = find_person(user.ut_name)) == NULL)
  			continue;
  		enter_where(&user, pn);
diff -c -P --recursive --exclude=COPYRIGHT --exclude=COPYING netstd.orig/finger.orig/finger.h netstd/finger/finger.h
*** netstd.orig/finger.orig/finger.h	Fri Dec 17 08:11:10 1993
--- netstd/finger/finger.h	Sun Jul 16 13:59:20 1995
***************
*** 40,46 ****
  #include <pwd.h>
  #include <utmp.h>
  
! #define _PATH_MAILSPOOL "/var/mail"
  
  /*
   * All unique persons are linked in a list headed by "head" and linkd
--- 40,46 ----
  #include <pwd.h>
  #include <utmp.h>
  
! #define _PATH_MAILSPOOL "/var/spool/mail"
  
  /*
   * All unique persons are linked in a list headed by "head" and linkd
***************
*** 88,90 ****
--- 88,91 ----
  WHERE *walloc();
  
  extern char tbuf[1024];			/* temp buffer for anybody */
+ extern int eflag;			/* local 8bit support */
diff -c -P --recursive --exclude=COPYRIGHT --exclude=COPYING netstd.orig/finger.orig/lprint.c netstd/finger/lprint.c
*** netstd.orig/finger.orig/lprint.c	Fri Dec 17 08:11:11 1993
--- netstd/finger/lprint.c	Wed Oct 18 20:16:32 1995
***************
*** 51,56 ****
--- 51,57 ----
  
  #define	LINE_LEN	80
  #define	TAB_LEN		8		/* 8 spaces between tabs */
+ #define	_PATH_FORWARD	".forward"
  #define	_PATH_PLAN	".plan"
  #define	_PATH_PROJECT	".project"
  
***************
*** 147,178 ****
  		case LOGGEDIN:
  			tp = localtime(&w->loginat);
  			t = asctime(tp);
! 			tzn = tp->tm_zone;
  			cpr = printf("On since %.16s (%s) on %s",
  			    t, tzn, w->tty);
  			/*
  			 * idle time is tough; if have one, print a comma,
  			 * then spaces to pad out the device name, then the
  			 * idle time.  Follow with a comma if a remote login.
  			 */
  			delta = gmtime(&w->idletime);
! 			if (delta->tm_yday || delta->tm_hour || delta->tm_min) {
! 				cpr += printf("%-*s idle ",
! 				    maxlen - strlen(w->tty) + 1, ",");
  				if (delta->tm_yday > 0) {
  					cpr += printf("%d day%s ",
  					   delta->tm_yday,
  					   delta->tm_yday == 1 ? "" : "s");
  				}
! 				cpr += printf("%d:%02d",
! 				    delta->tm_hour, delta->tm_min);
! 				if (*w->host) {
! 					putchar(',');
! 					++cpr;
  				}
  			}
! 			if (!w->writable)
  				cpr += printf(" (messages off)");
  			break;
  		case LASTLOG:
  			if (w->loginat == 0) {
--- 148,201 ----
  		case LOGGEDIN:
  			tp = localtime(&w->loginat);
  			t = asctime(tp);
! 			tzset();
! 			tzn = tzname[1 - daylight];
  			cpr = printf("On since %.16s (%s) on %s",
  			    t, tzn, w->tty);
+ 			if (*w->host) {
+ 				cpr += printf(" from %s", w->host);
+ 			}
  			/*
  			 * idle time is tough; if have one, print a comma,
  			 * then spaces to pad out the device name, then the
  			 * idle time.  Follow with a comma if a remote login.
  			 */
  			delta = gmtime(&w->idletime);
! 			if (delta->tm_yday || delta->tm_hour
! 			    || delta->tm_min || delta->tm_sec) {
! 				if (*w->host)
! 				    putchar('\n');
! 				cpr += printf("%-*s",
! 				    maxlen - strlen(w->tty) + 3, " ");
  				if (delta->tm_yday > 0) {
  					cpr += printf("%d day%s ",
  					   delta->tm_yday,
  					   delta->tm_yday == 1 ? "" : "s");
  				}
! 				if (delta->tm_hour > 0) {
! 					cpr += printf("%d hour%s ",
! 					   delta->tm_hour,
! 					   delta->tm_hour == 1 ? "" : "s");
! 				}
! 				if ((delta->tm_min > 0) && !delta->tm_yday) {
! 					cpr += printf("%d minute%s ",
! 					   delta->tm_min,
! 					   delta->tm_min == 1 ? "" : "s");
! 				}
! 				if ((delta->tm_sec > 0) && !delta->tm_yday
! 				     && !delta->tm_hour) {
! 					cpr += printf("%d second%s ",
! 					   delta->tm_sec,
! 					   delta->tm_sec == 1 ? "" : "s");
  				}
+ 				cpr += printf("idle");
  			}
! 			if (!w->writable) {
! 				if (delta->tm_yday || delta->tm_hour
! 				    || delta->tm_min || delta->tm_sec)
! 					cpr += printf("\n    ");
  				cpr += printf(" (messages off)");
+ 			}
  			break;
  		case LASTLOG:
  			if (w->loginat == 0) {
***************
*** 181,187 ****
  			}
  			tp = localtime(&w->loginat);
  			t = asctime(tp);
! 			tzn = tp->tm_zone;
  			if (now - w->loginat > SECSPERDAY * DAYSPERNYEAR / 2)
  				cpr =
  				    printf("Last login %.16s %.4s (%s) on %s",
--- 204,211 ----
  			}
  			tp = localtime(&w->loginat);
  			t = asctime(tp);
! 			tzset();
! 			tzn = tzname[1 - daylight];
  			if (now - w->loginat > SECSPERDAY * DAYSPERNYEAR / 2)
  				cpr =
  				    printf("Last login %.16s %.4s (%s) on %s",
***************
*** 189,220 ****
  			else
  				cpr = printf("Last login %.16s (%s) on %s",
  				    t, tzn, w->tty);
  			break;
  		}
- 		if (*w->host) {
- 			if (LINE_LEN < (cpr + 6 + strlen(w->host)))
- 				(void)printf("\n   ");
- 			(void)printf(" from %s", w->host);
- 		}
  		putchar('\n');
  	}
! 	if (pn->mailrecv == -1)
! 		printf("No Mail.\n");
! 	else if (pn->mailrecv > pn->mailread) {
! 		tp = localtime(&pn->mailrecv);
! 		t = asctime(tp);
! 		tzn = tp->tm_zone;
! 		printf("New mail received %.16s %.4s (%s)\n", t, t + 20, tzn);
! 		tp = localtime(&pn->mailread);
! 		t = asctime(tp);
! 		tzn = tp->tm_zone;
! 		printf("     Unread since %.16s %.4s (%s)\n", t, t + 20, tzn);
! 	} else {
! 		tp = localtime(&pn->mailread);
! 		t = asctime(tp);
! 		tzn = tp->tm_zone;
! 		printf("Mail last read %.16s %.4s (%s)\n", t, t + 20, tzn);
! 	}
  }
  
  demi_print(str, oddfield)
--- 213,253 ----
  			else
  				cpr = printf("Last login %.16s (%s) on %s",
  				    t, tzn, w->tty);
+ 			if (*w->host) {
+ 				cpr += printf(" from %s", w->host);
+ 			}
  			break;
  		}
  		putchar('\n');
  	}
! 
! 	/* If the user forwards mail elsewhere, tell us about it */
! 	print_forward(pn->dir, _PATH_FORWARD, "Mail forwarded to ");
! 
! 	/* Print the standard mailbox information. */
! 		if (pn->mailrecv == -1)
! 			printf("No mail.\n");
! 		else if (pn->mailrecv > pn->mailread) {
! 			tp = localtime(&pn->mailrecv);
! 			t = asctime(tp);
! 			tzset();
! 			tzn = tzname[1 - daylight];
! 			printf("New mail received %.16s %.4s (%s)\n", t,
! 			       t + 20, tzn);
! 			tp = localtime(&pn->mailread);
! 			t = asctime(tp);
! 			tzset();
! 			tzn = tzname[1 - daylight];
! 			printf("     Unread since %.16s %.4s (%s)\n", t,
! 			       t + 20, tzn);
! 		} else {
! 			tp = localtime(&pn->mailread);
! 			t = asctime(tp);
! 			tzset();
! 			tzn = tzname[1 - daylight];
! 			printf("Mail last read %.16s %.4s (%s)\n", t,
! 			       t + 20, tzn);
! 		}
  }
  
  demi_print(str, oddfield)
***************
*** 256,261 ****
--- 289,312 ----
  	return(oddfield);
  }
  
+ print_forward(directory, file_name, header)
+ 	char *directory, *file_name, *header;
+ {
+ 	register int ch, lastc;
+ 	register FILE *fp;
+ 
+ 	(void)sprintf(tbuf, "%s/%s", directory, file_name);
+ 	if ((fp = fopen(tbuf, "r")) == NULL)
+ 		return(0);
+ 	(void)printf("%s", header);
+ 	while ((ch = getc(fp)) != EOF)
+ 		vputc(lastc = ch);
+ 	if (lastc != '\n')
+ 		(void)putchar('\n');
+ 	(void)fclose(fp);
+ 	return(1);
+ }
+ 
  show_text(directory, file_name, header)
  	char *directory, *file_name, *header;
  {
***************
*** 279,295 ****
  {
  	int meta;
  
! 	if (!isascii(ch)) {
! 		(void)putchar('M');
! 		(void)putchar('-');
! 		ch = toascii(ch);
! 		meta = 1;
! 	} else
! 		meta = 0;
! 	if (isprint(ch) || !meta && (ch == ' ' || ch == '\t' || ch == '\n'))
! 		(void)putchar(ch);
! 	else {
! 		(void)putchar('^');
! 		(void)putchar(ch == '\177' ? '?' : ch | 0100);
  	}
  }
--- 330,358 ----
  {
  	int meta;
  
! 	if(!eflag) {
! 		if (!isascii(ch)) {
! 			(void)putchar('M');
! 			(void)putchar('-');
! 			ch = toascii(ch);
! 			meta = 1;
! 		} else
! 			meta = 0;
! 		if (isprint(ch) || !meta && (ch == ' ' || ch == '\t'
! 		    || ch == '\n'))
! 			(void)putchar(ch);
! 		else {
! 			(void)putchar('^');
! 			(void)putchar(ch == '\177' ? '?' : ch | 0100);
! 		}
! 	} else {
! 		/* 8bit character handling support */
! 		/* Rune Karlsen (runek@eldarin.uio.no) */
! 
! 		if (isprint(ch) || isspace(ch) || ch >= 0240)
! 			(void)putchar(ch);
! 		else
! 			(void)putchar(ch ^ 0100);
! 
  	}
  }
diff -c -P --recursive --exclude=COPYRIGHT --exclude=COPYING netstd.orig/finger.orig/net.c netstd/finger/net.c
*** netstd.orig/finger.orig/net.c	Fri Dec 17 08:11:12 1993
--- netstd/finger/net.c	Sun Jul 16 21:59:25 1995
***************
*** 45,50 ****
--- 45,51 ----
  #include <netdb.h>
  #include <stdio.h>
  #include <ctype.h>
+ #include "finger.h"
  
  netfinger(name)
  	char *name;
***************
*** 57,68 ****
  	struct servent *sp;
  	struct sockaddr_in sin;
  	int s;
! 	char *alist[1], *host, *rindex();
  	u_long inet_addr();
  
! 	if (!(host = rindex(name, '@')))
  		return;
! 	*host++ = NULL;
  	if (!(hp = gethostbyname(host))) {
  		defaddr.s_addr = inet_addr(host);
  		if (defaddr.s_addr == -1) {
--- 58,73 ----
  	struct servent *sp;
  	struct sockaddr_in sin;
  	int s;
! 	char *alist[1], *at, *host, *rindex();
  	u_long inet_addr();
  
! 	if (!(at = (char *) index(name, '@')))
  		return;
! 	*at++ = '\0';
! 	if (!(host = rindex(at, '@')))
! 		host=at;
! 	else 
! 		host++;
  	if (!(hp = gethostbyname(host))) {
  		defaddr.s_addr = inet_addr(host);
  		if (defaddr.s_addr == -1) {
***************
*** 119,131 ****
  	 */ 
  	if (fp = fdopen(s, "r"))
  		while ((c = getc(fp)) != EOF) {
! 			c &= 0x7f;
  			if (c == 0x0d) {
  				c = '\n';
  				lastc = '\r';
  			} else {
! 				if (!isprint(c) && !isspace(c))
! 					c |= 0x40;
  				if (lastc != '\r' || c != '\n')
  					lastc = c;
  				else {
--- 124,136 ----
  	 */ 
  	if (fp = fdopen(s, "r"))
  		while ((c = getc(fp)) != EOF) {
! 			if(!eflag) c &= 0x7f;
  			if (c == 0x0d) {
  				c = '\n';
  				lastc = '\r';
  			} else {
! 				if (!(isprint(c) || isspace(c) || c >= 0240))
! 					c ^= 0100;
  				if (lastc != '\r' || c != '\n')
  					lastc = c;
  				else {
diff -c -P --recursive --exclude=COPYRIGHT --exclude=COPYING netstd.orig/finger.orig/sprint.c netstd/finger/sprint.c
*** netstd.orig/finger.orig/sprint.c	Fri Dec 17 08:11:12 1993
--- netstd/finger/sprint.c	Sat May 28 17:50:20 1994
***************
*** 104,116 ****
  				(void)printf("  %.4s", p + 20);
  			else
  				(void)printf(" %.5s", p + 11);
! office:			if (pn->office)
  				(void)printf(" %-10.10s", pn->office);
  			else if (pn->officephone)
  				(void)printf(" %-10.10s", " ");
  			if (pn->officephone)
  				(void)printf(" %-.15s",
  				    prphone(pn->officephone));
  			putchar('\n');
  		}
  	}
--- 104,121 ----
  				(void)printf("  %.4s", p + 20);
  			else
  				(void)printf(" %.5s", p + 11);
! office:
! 			if (w->host[0] != '\0') {
! 				printf(" (%s)", w->host);
! 			} else {
! 			if (pn->office)
  				(void)printf(" %-10.10s", pn->office);
  			else if (pn->officephone)
  				(void)printf(" %-10.10s", " ");
  			if (pn->officephone)
  				(void)printf(" %-.15s",
  				    prphone(pn->officephone));
+ 			}
  			putchar('\n');
  		}
  	}
***************
*** 149,155 ****
  	if (!delta->tm_yday)
  		if (!delta->tm_hour)
  			if (!delta->tm_min)
! 				(void)printf("    -");
  			else
  				(void)printf("%5d", delta->tm_min);
  		else
--- 154,160 ----
  	if (!delta->tm_yday)
  		if (!delta->tm_hour)
  			if (!delta->tm_min)
! 				(void)printf("     ");
  			else
  				(void)printf("%5d", delta->tm_min);
  		else
diff -c -P --recursive --exclude=COPYRIGHT --exclude=COPYING netstd.orig/finger.orig/util.c netstd/finger/util.c
*** netstd.orig/finger.orig/util.c	Fri Dec 17 08:11:12 1993
--- netstd/finger/util.c	Wed Oct 11 16:11:39 1995
***************
*** 48,53 ****
--- 48,54 ----
  #include <paths.h>
  #include <errno.h>
  #include "finger.h"
+ #include <lastlog.h>
  
  find_idle_and_ttywrite(w)
  	register WHERE *w;
***************
*** 59,66 ****
  
  	(void)sprintf(tbuf, "%s/%s", _PATH_DEV, w->tty);
  	if (stat(tbuf, &sb) < 0) {
! 		(void)fprintf(stderr,
! 		    "finger: %s: %s\n", tbuf, strerror(errno));
  		return;
  	}
  	w->idletime = now < sb.st_atime ? 0 : now - sb.st_atime;
--- 60,69 ----
  
  	(void)sprintf(tbuf, "%s/%s", _PATH_DEV, w->tty);
  	if (stat(tbuf, &sb) < 0) {
! 		if(errno != ENOENT) {
! 			(void)fprintf(stderr,
! 			    "finger: %s: %s\n", tbuf, strerror(errno));
! 		}
  		return;
  	}
  	w->idletime = now < sb.st_atime ? 0 : now - sb.st_atime;
***************
*** 171,177 ****
  	    (long)pn->uid * sizeof(ll) ||
  	    read(fd, (char *)&ll, sizeof(ll)) != sizeof(ll)) {
  			/* as if never logged in */
! 			ll.ll_line[0] = ll.ll_host[0] = NULL;
  			ll.ll_time = 0;
  		}
  	if ((w = pn->whead) == NULL)
--- 174,180 ----
  	    (long)pn->uid * sizeof(ll) ||
  	    read(fd, (char *)&ll, sizeof(ll)) != sizeof(ll)) {
  			/* as if never logged in */
! 			ll.ll_line[0] = ll.ll_host[0] = '\0';
  			ll.ll_time = 0;
  		}
  	if ((w = pn->whead) == NULL)
