summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1996-03-27 19:33:22 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1996-03-27 19:33:22 +0000
commitb4d055c56d56b705a9874806044897b6f933a892 (patch)
treeea6944e4424f24dce67f9a7422a498a2e3e97486
parentd413353d829242c97addbbe6aace0c12d53c4772 (diff)
From NetBSD: merge of 960317
-rw-r--r--usr.bin/Makefile14
-rw-r--r--usr.bin/cksum/crc.c10
-rw-r--r--usr.bin/cksum/sum1.c12
-rw-r--r--usr.bin/cksum/sum2.c12
-rw-r--r--usr.bin/fstat/fstat.c12
-rw-r--r--usr.bin/mail/Makefile3
-rw-r--r--usr.bin/mail/cmd1.c8
-rw-r--r--usr.bin/mail/cmdtab.c6
-rw-r--r--usr.bin/mail/extern.h4
-rw-r--r--usr.bin/mail/lex.c12
-rw-r--r--usr.bin/make/Makefile5
-rw-r--r--usr.bin/make/PSD.doc/tutorial.ms3
-rw-r--r--usr.bin/make/arch.c8
-rw-r--r--usr.bin/make/main.c11
-rw-r--r--usr.bin/make/make.18
-rw-r--r--usr.bin/make/make.c10
-rw-r--r--usr.bin/make/make.h3
-rw-r--r--usr.bin/make/parse.c8
-rw-r--r--usr.bin/make/pathnames.h4
-rw-r--r--usr.bin/nfsstat/Makefile3
-rw-r--r--usr.bin/nfsstat/nfsstat.14
-rw-r--r--usr.bin/nfsstat/nfsstat.c99
-rw-r--r--usr.bin/rpcgen/rpc_main.c8
-rw-r--r--usr.bin/systat/disks.c12
-rw-r--r--usr.bin/systat/iostat.c12
-rw-r--r--usr.bin/telnet/Makefile7
-rw-r--r--usr.bin/telnet/README244
-rw-r--r--usr.bin/telnet/authenc.c11
-rw-r--r--usr.bin/telnet/commands.c103
-rw-r--r--usr.bin/telnet/defines.h4
-rw-r--r--usr.bin/telnet/externs.h24
-rw-r--r--usr.bin/telnet/fdset.h4
-rw-r--r--usr.bin/telnet/general.h4
-rw-r--r--usr.bin/telnet/main.c47
-rw-r--r--usr.bin/telnet/network.c11
-rw-r--r--usr.bin/telnet/ring.c15
-rw-r--r--usr.bin/telnet/ring.h15
-rw-r--r--usr.bin/telnet/sys_bsd.c90
-rw-r--r--usr.bin/telnet/telnet.14
-rw-r--r--usr.bin/telnet/telnet.c29
-rw-r--r--usr.bin/telnet/terminal.c14
-rw-r--r--usr.bin/telnet/tn3270.c13
-rw-r--r--usr.bin/telnet/types.h4
-rw-r--r--usr.bin/telnet/utilities.c15
-rw-r--r--usr.bin/tip/remcap.c432
-rw-r--r--usr.bin/yacc/defs.h2
-rw-r--r--usr.bin/yacc/reader.c73
-rw-r--r--usr.bin/yacc/skeleton.c4
48 files changed, 704 insertions, 756 deletions
diff --git a/usr.bin/Makefile b/usr.bin/Makefile
index 18169cf03e5..af3ff9b2aff 100644
--- a/usr.bin/Makefile
+++ b/usr.bin/Makefile
@@ -1,15 +1,15 @@
+# $OpenBSD: Makefile,v 1.7 1996/03/27 19:32:19 niklas Exp $
+# $NetBSD: Makefile,v 1.62 1996/03/10 05:45:43 thorpej Exp $
# from: @(#)Makefile 5.8.1.1 (Berkeley) 5/8/91
-# $Id: Makefile,v 1.6 1996/02/03 12:11:34 dm Exp $
SUBDIR= apply apropos asa at banner basename bdes biff cal calendar cap_mkdb \
checknr chflags chpass cksum cmp col colcrt colrm column comm \
compress cpp crontab ctags cut dirname du \
- env error expand false file find finger fmt fold fpr from \
+ eject env error expand false file find finger fmt fold fpr from \
fsplit fstat ftp gencat getconf getopt head hexdump id indent \
- ipcrm ipcs join jot kdump ktrace lam last lastcomm leave less \
- lex locate \
- lock logger login logname look lorder m4 machine mail make man mesg \
- mkdep mkfifo mkstr modstat msgs netstat newsyslog nfsstat nice \
+ ipcrm ipcs join jot kdump ktrace lam last lastcomm leave less lex \
+ locate lock logger login logname look lorder m4 machine mail make man \
+ mesg mkdep mkfifo mkstr modstat msgs netstat newsyslog nfsstat nice \
nohup oldrdist pagesize passwd paste patch pr printenv printf quota \
rdist rdistd renice rev rlogin rpcgen rpcinfo rs \
rsh rup ruptime rusers rwall rwho \
@@ -21,7 +21,7 @@ SUBDIR= apply apropos asa at banner basename bdes biff cal calendar cap_mkdb \
which who whois window write \
xargs xinstall xlint xstr yacc yes ypcat ypmatch ypwhich
-# Don't use the standard tool chain on the alpha.
+# Don't use the standard tool chain on the alpha or mips.
.if (${MACHINE_ARCH} != "alpha" && ${MACHINE_ARCH} != "mips")
SUBDIR+= ar gprof nm ranlib size strip
.endif
diff --git a/usr.bin/cksum/crc.c b/usr.bin/cksum/crc.c
index 64f545abe9d..7301e342f50 100644
--- a/usr.bin/cksum/crc.c
+++ b/usr.bin/cksum/crc.c
@@ -1,4 +1,5 @@
-/* $NetBSD: crc.c,v 1.5 1995/03/26 05:15:18 glass Exp $ */
+/* $OpenBSD: crc.c,v 1.2 1996/03/27 19:32:21 niklas Exp $ */
+/* $NetBSD: crc.c,v 1.7 1996/02/27 21:29:53 jtc Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -39,15 +40,18 @@
#ifndef lint
#if 0
static char sccsid[] = "@(#)crc.c 8.1 (Berkeley) 6/17/93";
+static char rcsid[] = "$NetBSD: crc.c,v 1.7 1996/02/27 21:29:53 jtc Exp $";
#else
-static char rcsid[] = "$NetBSD: crc.c,v 1.5 1995/03/26 05:15:18 glass Exp $";
+static char rcsid[] = "$OpenBSD: crc.c,v 1.2 1996/03/27 19:32:21 niklas Exp $";
#endif
#endif /* not lint */
#include <sys/types.h>
#include <unistd.h>
-static u_int32_t crctab[] = {
+#include "extern.h"
+
+static const u_int32_t crctab[] = {
0x0,
0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,
0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6,
diff --git a/usr.bin/cksum/sum1.c b/usr.bin/cksum/sum1.c
index a3de50f7518..73850d4829b 100644
--- a/usr.bin/cksum/sum1.c
+++ b/usr.bin/cksum/sum1.c
@@ -1,4 +1,5 @@
-/* $NetBSD: sum1.c,v 1.4 1995/03/26 05:15:23 glass Exp $ */
+/* $OpenBSD: sum1.c,v 1.2 1996/03/27 19:32:22 niklas Exp $ */
+/* $NetBSD: sum1.c,v 1.5 1996/02/27 21:17:27 cgd Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -36,20 +37,23 @@
#ifndef lint
#if 0
static char sccsid[] = "@(#)sum1.c 8.1 (Berkeley) 6/6/93";
+static char rcsid[] = "$NetBSD: sum1.c,v 1.5 1996/02/27 21:17:27 cgd Exp $";
#else
-static char rcsid[] = "$NetBSD: sum1.c,v 1.4 1995/03/26 05:15:23 glass Exp $";
+static char rcsid[] = "$OpenBSD: sum1.c,v 1.2 1996/03/27 19:32:22 niklas Exp $";
#endif
#endif /* not lint */
#include <sys/types.h>
#include <unistd.h>
+#include "extern.h"
+
int
csum1(fd, cval, clen)
register int fd;
- u_long *cval, *clen;
+ u_int32_t *cval, *clen;
{
- register u_long total;
+ register u_int32_t total;
register int nr;
register u_int crc;
register u_char *p;
diff --git a/usr.bin/cksum/sum2.c b/usr.bin/cksum/sum2.c
index 9fc63f89485..d07b9740ce6 100644
--- a/usr.bin/cksum/sum2.c
+++ b/usr.bin/cksum/sum2.c
@@ -1,4 +1,5 @@
-/* $NetBSD: sum2.c,v 1.4 1995/03/26 05:15:25 glass Exp $ */
+/* $OpenBSD: sum2.c,v 1.2 1996/03/27 19:32:23 niklas Exp $ */
+/* $NetBSD: sum2.c,v 1.5 1996/02/27 21:17:28 cgd Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -36,20 +37,23 @@
#ifndef lint
#if 0
static char sccsid[] = "@(#)sum2.c 8.1 (Berkeley) 6/6/93";
+static char rcsid[] = "$NetBSD: sum2.c,v 1.5 1996/02/27 21:17:28 cgd Exp $";
#else
-static char rcsid[] = "$NetBSD: sum2.c,v 1.4 1995/03/26 05:15:25 glass Exp $";
+static char rcsid[] = "$OpenBSD: sum2.c,v 1.2 1996/03/27 19:32:23 niklas Exp $";
#endif
#endif /* not lint */
#include <sys/types.h>
#include <unistd.h>
+#include "extern.h"
+
int
csum2(fd, cval, clen)
register int fd;
- u_long *cval, *clen;
+ u_int32_t *cval, *clen;
{
- register u_long crc, total;
+ register u_int32_t crc, total;
register int nr;
register u_char *p;
u_char buf[8192];
diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c
index 04212f21414..f048a3b8458 100644
--- a/usr.bin/fstat/fstat.c
+++ b/usr.bin/fstat/fstat.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: fstat.c,v 1.2 1996/03/27 19:32:24 niklas Exp $ */
+
/*-
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -39,7 +41,7 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)fstat.c 8.1 (Berkeley) 6/6/93";*/
-static char *rcsid = "$Id: fstat.c,v 1.1 1995/10/18 08:45:16 deraadt Exp $";
+static char *rcsid = "$OpenBSD: fstat.c,v 1.2 1996/03/27 19:32:24 niklas Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -62,7 +64,7 @@ static char *rcsid = "$Id: fstat.c,v 1.1 1995/10/18 08:45:16 deraadt Exp $";
#undef _KERNEL
#define NFS
#include <sys/mount.h>
-#include <nfs/nfsv2.h>
+#include <nfs/nfsproto.h>
#include <nfs/rpcv2.h>
#include <nfs/nfs.h>
#include <nfs/nfsnode.h>
@@ -77,6 +79,7 @@ static char *rcsid = "$Id: fstat.c,v 1.1 1995/10/18 08:45:16 deraadt Exp $";
#include <ctype.h>
#include <errno.h>
#include <kvm.h>
+#include <limits.h>
#include <nlist.h>
#include <paths.h>
#include <pwd.h>
@@ -155,6 +158,7 @@ main(argc, argv)
struct kinfo_proc *p, *plast;
int arg, ch, what;
char *memf, *nlistf;
+ char buf[_POSIX2_LINE_MAX];
int cnt;
arg = 0;
@@ -229,8 +233,8 @@ main(argc, argv)
if (nlistf != NULL || memf != NULL)
setgid(getgid());
- if ((kd = kvm_open(nlistf, memf, NULL, O_RDONLY, NULL)) == NULL) {
- fprintf(stderr, "fstat: %s\n", kvm_geterr(kd));
+ if ((kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, buf)) == NULL) {
+ fprintf(stderr, "fstat: %s\n", buf);
exit(1);
}
#ifdef notdef
diff --git a/usr.bin/mail/Makefile b/usr.bin/mail/Makefile
index c17232028bf..f67171f6e18 100644
--- a/usr.bin/mail/Makefile
+++ b/usr.bin/mail/Makefile
@@ -1,8 +1,7 @@
+# $OpenBSD: Makefile,v 1.2 1996/03/27 19:32:29 niklas Exp $
# from: @(#)Makefile 8.2 (Berkeley) 1/25/94
-# $Id: Makefile,v 1.1 1995/10/18 08:45:37 deraadt Exp $
PROG= mail
-CFLAGS+=-DUSE_OLD_TTY
SRCS= version.c aux.c cmd1.c cmd2.c cmd3.c cmdtab.c collect.c edit.c fio.c \
getname.c head.c v7.local.c lex.c list.c main.c names.c popen.c \
quit.c send.c strings.c temp.c tty.c vars.c
diff --git a/usr.bin/mail/cmd1.c b/usr.bin/mail/cmd1.c
index 7778c4713e0..21f2e7b274c 100644
--- a/usr.bin/mail/cmd1.c
+++ b/usr.bin/mail/cmd1.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: cmd1.c,v 1.2 1996/03/27 19:32:30 niklas Exp $ */
+
/*-
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
@@ -33,7 +35,7 @@
#ifndef lint
static char sccsid[] = "from: @(#)cmd1.c 8.1 (Berkeley) 6/6/93";
-static char rcsid[] = "$Id: cmd1.c,v 1.1 1995/10/18 08:45:38 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: cmd1.c,v 1.2 1996/03/27 19:32:30 niklas Exp $";
#endif /* not lint */
#include "rcv.h"
@@ -224,9 +226,9 @@ pdot()
int
pcmdlist()
{
- register struct cmd *cp;
+ extern const struct cmd cmdtab[];
+ register const struct cmd *cp;
register int cc;
- extern struct cmd cmdtab[];
printf("Commands are:\n");
for (cc = 0, cp = cmdtab; cp->c_name != NULL; cp++) {
diff --git a/usr.bin/mail/cmdtab.c b/usr.bin/mail/cmdtab.c
index c5d5063ee22..c7b1cdd0fa5 100644
--- a/usr.bin/mail/cmdtab.c
+++ b/usr.bin/mail/cmdtab.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: cmdtab.c,v 1.2 1996/03/27 19:32:31 niklas Exp $ */
+
/*
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
@@ -33,7 +35,7 @@
#ifndef lint
static char sccsid[] = "from: @(#)cmdtab.c 8.1 (Berkeley) 6/6/93";
-static char rcsid[] = "$Id: cmdtab.c,v 1.1 1995/10/18 08:45:38 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: cmdtab.c,v 1.2 1996/03/27 19:32:31 niklas Exp $";
#endif /* not lint */
#include "def.h"
@@ -45,7 +47,7 @@ static char rcsid[] = "$Id: cmdtab.c,v 1.1 1995/10/18 08:45:38 deraadt Exp $";
* Define all of the command names and bindings.
*/
-struct cmd cmdtab[] = {
+const struct cmd cmdtab[] = {
"next", next, NDMLIST, 0, MMNDEL,
"alias", group, M|RAWLIST, 0, 1000,
"print", type, MSGLIST, 0, MMNDEL,
diff --git a/usr.bin/mail/extern.h b/usr.bin/mail/extern.h
index 616235810e9..469a3faddec 100644
--- a/usr.bin/mail/extern.h
+++ b/usr.bin/mail/extern.h
@@ -1,3 +1,5 @@
+/* $OpenBSD: extern.h,v 1.2 1996/03/27 19:32:32 niklas Exp $ */
+
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -156,7 +158,7 @@ int ishead __P((char []));
int isign __P((char *, struct ignoretab []));
int isprefix __P((char *, char *));
void istrcpy __P((char *, char *));
-struct cmd *
+const struct cmd *
lex __P((char []));
void load __P((char *));
struct var *
diff --git a/usr.bin/mail/lex.c b/usr.bin/mail/lex.c
index 733f1d237cc..d5741a0bbfa 100644
--- a/usr.bin/mail/lex.c
+++ b/usr.bin/mail/lex.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: lex.c,v 1.2 1996/03/27 19:32:33 niklas Exp $ */
+
/*
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
@@ -33,7 +35,7 @@
#ifndef lint
static char sccsid[] = "from: @(#)lex.c 8.1 (Berkeley) 6/6/93";
-static char rcsid[] = "$Id: lex.c,v 1.1 1995/10/18 08:45:39 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: lex.c,v 1.2 1996/03/27 19:32:33 niklas Exp $";
#endif /* not lint */
#include "rcv.h"
@@ -247,7 +249,7 @@ execute(linebuf, contxt)
{
char word[LINESIZE];
char *arglist[MAXARGC];
- struct cmd *com;
+ const struct cmd *com;
register char *cp, *cp2;
register int c;
int muvec[2];
@@ -452,12 +454,12 @@ setmsize(sz)
* to the passed command "word"
*/
-struct cmd *
+const struct cmd *
lex(word)
char word[];
{
- register struct cmd *cp;
- extern struct cmd cmdtab[];
+ extern const struct cmd cmdtab[];
+ register const struct cmd *cp;
for (cp = &cmdtab[0]; cp->c_name != NOSTR; cp++)
if (isprefix(word, cp->c_name))
diff --git a/usr.bin/make/Makefile b/usr.bin/make/Makefile
index 1405f3ee50f..b9b15eb0e89 100644
--- a/usr.bin/make/Makefile
+++ b/usr.bin/make/Makefile
@@ -1,10 +1,11 @@
-# $NetBSD: Makefile,v 1.9 1996/02/04 22:20:27 christos Exp $
+# $OpenBSD: Makefile,v 1.3 1996/03/27 19:32:34 niklas Exp $
+# $NetBSD: Makefile,v 1.10 1996/03/11 13:45:31 christos Exp $
# @(#)Makefile 5.2 (Berkeley) 12/28/90
PROG= make
CFLAGS+= -I${.CURDIR} -DPOSIX -DSYSVINCLUDE
SRCS= arch.c buf.c compat.c cond.c dir.c for.c hash.c job.c main.c \
- make.c parse.c str.c suff.c targ.c var.c
+ make.c parse.c str.c suff.c targ.c var.c util.c
SRCS+= lstAppend.c lstAtEnd.c lstAtFront.c lstClose.c lstConcat.c \
lstDatum.c lstDeQueue.c lstDestroy.c lstDupl.c lstEnQueue.c \
lstFind.c lstFindFrom.c lstFirst.c lstForEach.c lstForEachFrom.c \
diff --git a/usr.bin/make/PSD.doc/tutorial.ms b/usr.bin/make/PSD.doc/tutorial.ms
index 69c2c308c97..67a7c2cc05b 100644
--- a/usr.bin/make/PSD.doc/tutorial.ms
+++ b/usr.bin/make/PSD.doc/tutorial.ms
@@ -1,4 +1,5 @@
-.\" $NetBSD: tutorial.ms,v 1.2 1995/06/14 15:20:31 christos Exp $
+.\" $OpenBSD: tutorial.ms,v 1.3 1996/03/27 19:32:44 niklas Exp $
+.\" $NetBSD: tutorial.ms,v 1.3 1996/03/06 00:15:31 christos Exp $
.\" Copyright (c) 1988, 1989 by Adam de Boor
.\" Copyright (c) 1989 by Berkeley Softworks
.\" Copyright (c) 1988, 1989, 1993
diff --git a/usr.bin/make/arch.c b/usr.bin/make/arch.c
index a66af088ed9..3a95fe3c6e7 100644
--- a/usr.bin/make/arch.c
+++ b/usr.bin/make/arch.c
@@ -1,4 +1,5 @@
-/* $NetBSD: arch.c,v 1.13 1996/02/04 22:20:34 christos Exp $ */
+/* $OpenBSD: arch.c,v 1.4 1996/03/27 19:32:35 niklas Exp $ */
+/* $NetBSD: arch.c,v 1.14 1996/03/12 18:04:27 christos Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -41,8 +42,9 @@
#ifndef lint
#if 0
static char sccsid[] = "@(#)arch.c 5.7 (Berkeley) 12/28/90";
+static char rcsid[] = "$NetBSD: arch.c,v 1.14 1996/03/12 18:04:27 christos Exp $";
#else
-static char rcsid[] = "$NetBSD: arch.c,v 1.13 1996/02/04 22:20:34 christos Exp $";
+static char rcsid[] = "$OpenBSD: arch.c,v 1.4 1996/03/27 19:32:35 niklas Exp $";
#endif
#endif /* not lint */
@@ -1064,7 +1066,7 @@ Arch_LibOODate (gn)
oodate = TRUE;
}
#else
- oodata = FALSE;
+ oodate = FALSE;
#endif
}
return (oodate);
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c
index 4f7b2cba68b..0bf0ab56f1d 100644
--- a/usr.bin/make/main.c
+++ b/usr.bin/make/main.c
@@ -1,4 +1,5 @@
-/* $NetBSD: main.c,v 1.24 1996/02/04 22:20:49 christos Exp $ */
+/* $OpenBSD: main.c,v 1.6 1996/03/27 19:32:36 niklas Exp $ */
+/* $NetBSD: main.c,v 1.26 1996/03/11 13:45:33 christos Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -47,8 +48,9 @@ char copyright[] =
#ifndef lint
#if 0
static char sccsid[] = "@(#)main.c 5.25 (Berkeley) 4/1/91";
+static char rcsid[] = "$NetBSD: main.c,v 1.26 1996/03/11 13:45:33 christos Exp $";
#else
-static char rcsid[] = "$NetBSD: main.c,v 1.24 1996/02/04 22:20:49 christos Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.6 1996/03/27 19:32:36 niklas Exp $";
#endif
#endif /* not lint */
@@ -86,7 +88,6 @@ static char rcsid[] = "$NetBSD: main.c,v 1.24 1996/02/04 22:20:49 christos Exp $
#include <sys/signal.h>
#include <sys/stat.h>
#include <sys/utsname.h>
-#include <sys/resource.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
@@ -454,11 +455,15 @@ main(argc, argv)
* MACHINE_ARCH is always known at compile time.
*/
if (!machine) {
+#ifndef MACHINE
if (uname(&utsname) == -1) {
perror("make: uname");
exit(2);
}
machine = utsname.machine;
+#else
+ machine = MACHINE;
+#endif
}
/*
diff --git a/usr.bin/make/make.1 b/usr.bin/make/make.1
index 22d997ec01a..85777b15f2e 100644
--- a/usr.bin/make/make.1
+++ b/usr.bin/make/make.1
@@ -1,4 +1,5 @@
-.\" $NetBSD: make.1,v 1.12 1995/12/16 05:03:09 christos Exp $
+.\" $OpenBSD: make.1,v 1.6 1996/03/27 19:32:37 niklas Exp $
+.\" $NetBSD: make.1,v 1.14 1996/03/15 21:52:32 christos Exp $
.\" Copyright (c) 1990 The Regents of the University of California.
.\" All rights reserved.
.\"
@@ -871,6 +872,11 @@ The sources are directories which are to be searched for files not
found in the current directory.
If no sources are specified, any previously specified directories are
deleted.
+.It Ic .PHONY
+Apply the
+.Ic .PHONY
+attribute to any specified sources. Targets with this attribute are always
+considered to be out of date.
.It Ic .PRECIOUS
Apply the
.Ic .PRECIOUS
diff --git a/usr.bin/make/make.c b/usr.bin/make/make.c
index c142029dbd0..c366518faae 100644
--- a/usr.bin/make/make.c
+++ b/usr.bin/make/make.c
@@ -1,4 +1,5 @@
-/* $NetBSD: make.c,v 1.7 1995/06/14 15:19:40 christos Exp $ */
+/* $OpenBSD: make.c,v 1.2 1996/03/27 19:32:38 niklas Exp $ */
+/* $NetBSD: make.c,v 1.8 1996/03/15 21:52:37 christos Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -41,8 +42,9 @@
#ifndef lint
#if 0
static char sccsid[] = "@(#)make.c 5.3 (Berkeley) 6/1/90";
+static char rcsid[] = "$NetBSD: make.c,v 1.8 1996/03/15 21:52:37 christos Exp $";
#else
-static char rcsid[] = "$NetBSD: make.c,v 1.7 1995/06/14 15:19:40 christos Exp $";
+static char rcsid[] = "$OpenBSD: make.c,v 1.2 1996/03/27 19:32:38 niklas Exp $";
#endif
#endif /* not lint */
@@ -213,7 +215,7 @@ Make_OODate (gn)
printf(".JOIN node...");
}
oodate = gn->childMade;
- } else if (gn->type & (OP_FORCE|OP_EXEC)) {
+ } else if (gn->type & (OP_FORCE|OP_EXEC|OP_PHONY)) {
/*
* A node which is the object of the force (!) operator or which has
* the .EXEC attribute is always considered out-of-date.
@@ -221,6 +223,8 @@ Make_OODate (gn)
if (DEBUG(MAKE)) {
if (gn->type & OP_FORCE) {
printf("! operator...");
+ } else if (gn->type & OP_PHONY) {
+ printf(".PHONY node...");
} else {
printf(".EXEC node...");
}
diff --git a/usr.bin/make/make.h b/usr.bin/make/make.h
index 3da7124bf2b..c5f1a668ed5 100644
--- a/usr.bin/make/make.h
+++ b/usr.bin/make/make.h
@@ -1,4 +1,5 @@
-/* $NetBSD: make.h,v 1.8 1996/02/04 22:20:53 christos Exp $ */
+/* $OpenBSD: make.h,v 1.5 1996/03/27 19:32:39 niklas Exp $ */
+/* $NetBSD: make.h,v 1.9 1996/03/06 00:15:21 christos Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c
index bc14d48084c..a2099bd76b5 100644
--- a/usr.bin/make/parse.c
+++ b/usr.bin/make/parse.c
@@ -1,4 +1,5 @@
-/* $NetBSD: parse.c,v 1.19 1996/02/07 23:04:04 thorpej Exp $ */
+/* $OpenBSD: parse.c,v 1.7 1996/03/27 19:32:41 niklas Exp $ */
+/* $NetBSD: parse.c,v 1.22 1996/03/15 21:52:41 christos Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -42,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)parse.c 5.18 (Berkeley) 2/19/91";
#else
-static char rcsid[] = "$NetBSD: parse.c,v 1.19 1996/02/07 23:04:04 thorpej Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.22 1996/03/15 21:52:41 christos Exp $";
#endif
#endif /* not lint */
@@ -170,6 +171,7 @@ typedef enum {
Order, /* .ORDER */
Parallel, /* .PARALLEL */
ExPath, /* .PATH */
+ Phony, /* .PHONY */
Precious, /* .PRECIOUS */
ExShell, /* .SHELL */
Silent, /* .SILENT */
@@ -222,6 +224,7 @@ static struct {
{ ".ORDER", Order, 0 },
{ ".PARALLEL", Parallel, 0 },
{ ".PATH", ExPath, 0 },
+{ ".PHONY", Phony, OP_PHONY },
{ ".PRECIOUS", Precious, OP_PRECIOUS },
{ ".RECURSIVE", Attribute, OP_MAKE },
{ ".SHELL", ExShell, 0 },
@@ -832,6 +835,7 @@ ParseDoDependency (line)
* life easier later, when we'll
* use Make_HandleUse to actually
* apply the .DEFAULT commands.
+ * .PHONY The list of targets
* .BEGIN
* .END
* .INTERRUPT Are not to be considered the
diff --git a/usr.bin/make/pathnames.h b/usr.bin/make/pathnames.h
index b8ffcab31a9..3b4d50fc7f3 100644
--- a/usr.bin/make/pathnames.h
+++ b/usr.bin/make/pathnames.h
@@ -1,4 +1,5 @@
-/* $NetBSD: pathnames.h,v 1.3 1995/06/14 15:19:52 christos Exp $ */
+/* $OpenBSD: pathnames.h,v 1.3 1996/03/27 19:32:42 niklas Exp $ */
+/* $NetBSD: pathnames.h,v 1.4 1996/03/06 00:15:26 christos Exp $ */
/*
* Copyright (c) 1990 The Regents of the University of California.
@@ -33,7 +34,6 @@
* SUCH DAMAGE.
*
* from: @(#)pathnames.h 5.2 (Berkeley) 6/1/90
- * $Id: pathnames.h,v 1.2 1996/02/23 18:33:00 niklas Exp $
*/
#define _PATH_OBJDIR "obj"
diff --git a/usr.bin/nfsstat/Makefile b/usr.bin/nfsstat/Makefile
index 3863b686d26..0110fa511ad 100644
--- a/usr.bin/nfsstat/Makefile
+++ b/usr.bin/nfsstat/Makefile
@@ -1,5 +1,6 @@
+# $OpenBSD: Makefile,v 1.2 1996/03/27 19:32:47 niklas Exp $
+# $NetBSD: Makefile,v 1.5 1996/03/03 17:21:25 thorpej Exp $
# from: @(#)Makefile 8.1 (Berkeley) 6/6/93
-# $Id: Makefile,v 1.1 1995/10/18 08:45:52 deraadt Exp $
PROG= nfsstat
CFLAGS+=-DNFS
diff --git a/usr.bin/nfsstat/nfsstat.1 b/usr.bin/nfsstat/nfsstat.1
index 936e4950e5f..e7855402c35 100644
--- a/usr.bin/nfsstat/nfsstat.1
+++ b/usr.bin/nfsstat/nfsstat.1
@@ -1,3 +1,6 @@
+.\" $OpenBSD: nfsstat.1,v 1.2 1996/03/27 19:32:48 niklas Exp $
+.\" $NetBSD: nfsstat.1,v 1.8 1996/03/03 17:21:28 thorpej Exp $
+.\"
.\" Copyright (c) 1989, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
@@ -30,7 +33,6 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)nfsstat.1 8.1 (Berkeley) 6/6/93
-.\" $Id: nfsstat.1,v 1.1 1995/10/18 08:45:52 deraadt Exp $
.\"
.Dd June 6, 1993
.Dt NFSSTAT 1
diff --git a/usr.bin/nfsstat/nfsstat.c b/usr.bin/nfsstat/nfsstat.c
index 0507b9098c2..7d7d1a360e3 100644
--- a/usr.bin/nfsstat/nfsstat.c
+++ b/usr.bin/nfsstat/nfsstat.c
@@ -1,3 +1,6 @@
+/* $OpenBSD: nfsstat.c,v 1.2 1996/03/27 19:32:49 niklas Exp $ */
+/* $NetBSD: nfsstat.c,v 1.7 1996/03/03 17:21:30 thorpej Exp $ */
+
/*
* Copyright (c) 1983, 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -41,21 +44,19 @@ static char copyright[] =
#endif /* not lint */
#ifndef lint
-/*static char sccsid[] = "from: @(#)nfsstat.c 8.1 (Berkeley) 6/6/93";*/
-static char *rcsid = "$Id: nfsstat.c,v 1.1 1995/10/18 08:45:52 deraadt Exp $";
+#if 0
+static char sccsid[] = "from: @(#)nfsstat.c 8.1 (Berkeley) 6/6/93";
+static char *rcsid = "$NetBSD: nfsstat.c,v 1.7 1996/03/03 17:21:30 thorpej Exp $";
+#else
+static char *rcsid = "$OpenBSD: nfsstat.c,v 1.2 1996/03/27 19:32:49 niklas Exp $";
+#endif
#endif /* not lint */
#include <sys/param.h>
-#if BSD >= 199103
-#define NEWVM
-#endif
-#ifndef NEWVM
-#include <sys/vmmac.h>
-#include <sys/ucred.h>
-#include <machine/pte.h>
-#endif
#include <sys/mount.h>
-#include <nfs/nfsv2.h>
+#include <sys/sysctl.h>
+#include <nfs/rpcv2.h>
+#include <nfs/nfsproto.h>
#include <nfs/nfs.h>
#include <signal.h>
#include <fcntl.h>
@@ -68,6 +69,7 @@ static char *rcsid = "$Id: nfsstat.c,v 1.1 1995/10/18 08:45:52 deraadt Exp $";
#include <stdlib.h>
#include <string.h>
#include <paths.h>
+#include <err.h>
struct nlist nl[] = {
#define N_NFSSTAT 0
@@ -172,7 +174,7 @@ intpr(nfsstataddr)
nfsstats.rpccnt[NFSPROC_REMOVE]);
printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n",
"Rename", "Link", "Symlink", "Mkdir", "Rmdir",
- "Readdir", "Statfs", "RdirLook");
+ "Readdir", "RdirPlus", "Access");
printf("%9d %9d %9d %9d %9d %9d %9d %9d\n",
nfsstats.rpccnt[NFSPROC_RENAME],
nfsstats.rpccnt[NFSPROC_LINK],
@@ -180,11 +182,17 @@ intpr(nfsstataddr)
nfsstats.rpccnt[NFSPROC_MKDIR],
nfsstats.rpccnt[NFSPROC_RMDIR],
nfsstats.rpccnt[NFSPROC_READDIR],
- nfsstats.rpccnt[NFSPROC_STATFS],
- nfsstats.rpccnt[NQNFSPROC_READDIRLOOK]);
- printf("%9.9s %9.9s %9.9s\n",
+ nfsstats.rpccnt[NFSPROC_READDIRPLUS],
+ nfsstats.rpccnt[NFSPROC_ACCESS]);
+ printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n",
+ "Mknod", "Fsstat", "Fsinfo", "PathConf", "Commit",
"GLease", "Vacate", "Evict");
- printf("%9d %9d %9d\n",
+ printf("%9d %9d %9d %9d %9d %9d %9d %9d\n",
+ nfsstats.rpccnt[NFSPROC_MKNOD],
+ nfsstats.rpccnt[NFSPROC_FSSTAT],
+ nfsstats.rpccnt[NFSPROC_FSINFO],
+ nfsstats.rpccnt[NFSPROC_PATHCONF],
+ nfsstats.rpccnt[NFSPROC_COMMIT],
nfsstats.rpccnt[NQNFSPROC_GETLEASE],
nfsstats.rpccnt[NQNFSPROC_VACATED],
nfsstats.rpccnt[NQNFSPROC_EVICTED]);
@@ -235,7 +243,7 @@ intpr(nfsstataddr)
nfsstats.srvrpccnt[NFSPROC_REMOVE]);
printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n",
"Rename", "Link", "Symlink", "Mkdir", "Rmdir",
- "Readdir", "Statfs", "RdirLook");
+ "Readdir", "RdirPlus", "Access");
printf("%9d %9d %9d %9d %9d %9d %9d %9d\n",
nfsstats.srvrpccnt[NFSPROC_RENAME],
nfsstats.srvrpccnt[NFSPROC_LINK],
@@ -243,11 +251,17 @@ intpr(nfsstataddr)
nfsstats.srvrpccnt[NFSPROC_MKDIR],
nfsstats.srvrpccnt[NFSPROC_RMDIR],
nfsstats.srvrpccnt[NFSPROC_READDIR],
- nfsstats.srvrpccnt[NFSPROC_STATFS],
- nfsstats.srvrpccnt[NQNFSPROC_READDIRLOOK]);
- printf("%9.9s %9.9s %9.9s\n",
+ nfsstats.srvrpccnt[NFSPROC_READDIRPLUS],
+ nfsstats.srvrpccnt[NFSPROC_ACCESS]);
+ printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n",
+ "Mknod", "Fsstat", "Fsinfo", "PathConf", "Commit",
"GLease", "Vacate", "Evict");
- printf("%9d %9d %9d\n",
+ printf("%9d %9d %9d %9d %9d %9d %9d %9d\n",
+ nfsstats.srvrpccnt[NFSPROC_MKNOD],
+ nfsstats.srvrpccnt[NFSPROC_FSSTAT],
+ nfsstats.srvrpccnt[NFSPROC_FSINFO],
+ nfsstats.srvrpccnt[NFSPROC_PATHCONF],
+ nfsstats.srvrpccnt[NFSPROC_COMMIT],
nfsstats.srvrpccnt[NQNFSPROC_GETLEASE],
nfsstats.srvrpccnt[NQNFSPROC_VACATED],
nfsstats.srvrpccnt[NQNFSPROC_EVICTED]);
@@ -270,6 +284,13 @@ intpr(nfsstataddr)
nfsstats.srvnqnfs_leases,
nfsstats.srvnqnfs_maxleases,
nfsstats.srvnqnfs_getleases);
+ printf("Server Write Gathering:\n");
+ printf("%9.9s %9.9s %9.9s\n",
+ "WriteOps", "WriteRPC", "Opsaved");
+ printf("%9d %9d %9d\n",
+ nfsstats.srvvop_writes,
+ nfsstats.srvrpccnt[NFSPROC_WRITE],
+ nfsstats.srvrpccnt[NFSPROC_WRITE] - nfsstats.srvvop_writes);
}
u_char signalled; /* set if alarm goes off "early" */
@@ -304,23 +325,25 @@ sidewaysintpr(interval, off)
exit(1);
}
printf("Client: %8d %8d %8d %8d %8d %8d %8d %8d\n",
- nfsstats.rpccnt[1]-lastst.rpccnt[1],
- nfsstats.rpccnt[4]-lastst.rpccnt[4],
- nfsstats.rpccnt[5]-lastst.rpccnt[5],
- nfsstats.rpccnt[6]-lastst.rpccnt[6],
- nfsstats.rpccnt[8]-lastst.rpccnt[8],
- nfsstats.rpccnt[11]-lastst.rpccnt[11],
- nfsstats.rpccnt[12]-lastst.rpccnt[12],
- nfsstats.rpccnt[16]-lastst.rpccnt[16]);
+ nfsstats.rpccnt[NFSPROC_GETATTR]-lastst.rpccnt[NFSPROC_GETATTR],
+ nfsstats.rpccnt[NFSPROC_LOOKUP]-lastst.rpccnt[NFSPROC_LOOKUP],
+ nfsstats.rpccnt[NFSPROC_READLINK]-lastst.rpccnt[NFSPROC_READLINK],
+ nfsstats.rpccnt[NFSPROC_READ]-lastst.rpccnt[NFSPROC_READ],
+ nfsstats.rpccnt[NFSPROC_WRITE]-lastst.rpccnt[NFSPROC_WRITE],
+ nfsstats.rpccnt[NFSPROC_RENAME]-lastst.rpccnt[NFSPROC_RENAME],
+ nfsstats.rpccnt[NFSPROC_ACCESS]-lastst.rpccnt[NFSPROC_ACCESS],
+ (nfsstats.rpccnt[NFSPROC_READDIR]-lastst.rpccnt[NFSPROC_READDIR])
+ +(nfsstats.rpccnt[NFSPROC_READDIRPLUS]-lastst.rpccnt[NFSPROC_READDIRPLUS]));
printf("Server: %8d %8d %8d %8d %8d %8d %8d %8d\n",
- nfsstats.srvrpccnt[1]-lastst.srvrpccnt[1],
- nfsstats.srvrpccnt[4]-lastst.srvrpccnt[4],
- nfsstats.srvrpccnt[5]-lastst.srvrpccnt[5],
- nfsstats.srvrpccnt[6]-lastst.srvrpccnt[6],
- nfsstats.srvrpccnt[8]-lastst.srvrpccnt[8],
- nfsstats.srvrpccnt[11]-lastst.srvrpccnt[11],
- nfsstats.srvrpccnt[12]-lastst.srvrpccnt[12],
- nfsstats.srvrpccnt[16]-lastst.srvrpccnt[16]);
+ nfsstats.srvrpccnt[NFSPROC_GETATTR]-lastst.srvrpccnt[NFSPROC_GETATTR],
+ nfsstats.srvrpccnt[NFSPROC_LOOKUP]-lastst.srvrpccnt[NFSPROC_LOOKUP],
+ nfsstats.srvrpccnt[NFSPROC_READLINK]-lastst.srvrpccnt[NFSPROC_READLINK],
+ nfsstats.srvrpccnt[NFSPROC_READ]-lastst.srvrpccnt[NFSPROC_READ],
+ nfsstats.srvrpccnt[NFSPROC_WRITE]-lastst.srvrpccnt[NFSPROC_WRITE],
+ nfsstats.srvrpccnt[NFSPROC_RENAME]-lastst.srvrpccnt[NFSPROC_RENAME],
+ nfsstats.srvrpccnt[NFSPROC_ACCESS]-lastst.srvrpccnt[NFSPROC_ACCESS],
+ (nfsstats.srvrpccnt[NFSPROC_READDIR]-lastst.srvrpccnt[NFSPROC_READDIR])
+ +(nfsstats.srvrpccnt[NFSPROC_READDIRPLUS]-lastst.srvrpccnt[NFSPROC_READDIRPLUS]));
lastst = nfsstats;
fflush(stdout);
oldmask = sigblock(sigmask(SIGALRM));
@@ -338,7 +361,7 @@ printhdr()
{
printf(" %8.8s %8.8s %8.8s %8.8s %8.8s %8.8s %8.8s %8.8s\n",
"Getattr", "Lookup", "Readlink", "Read", "Write", "Rename",
- "Link", "Readdir");
+ "Access", "Readdir");
fflush(stdout);
}
diff --git a/usr.bin/rpcgen/rpc_main.c b/usr.bin/rpcgen/rpc_main.c
index 85ee577257e..b458729f00c 100644
--- a/usr.bin/rpcgen/rpc_main.c
+++ b/usr.bin/rpcgen/rpc_main.c
@@ -1,4 +1,5 @@
-/* $NetBSD: rpc_main.c,v 1.8 1995/08/29 23:05:53 cgd Exp $ */
+/* $OpenBSD: rpc_main.c,v 1.2 1996/03/27 19:32:51 niklas Exp $ */
+/* $NetBSD: rpc_main.c,v 1.9 1996/02/19 11:12:43 pk Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@@ -31,13 +32,15 @@
#ifndef lint
static char sccsid[] = "@(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI";
-static char cvsid[] = "$Id: rpc_main.c,v 1.1 1995/10/18 08:46:01 deraadt Exp $";
+static char cvsid[] = "$OpenBSD: rpc_main.c,v 1.2 1996/03/27 19:32:51 niklas Exp $";
#endif
/*
* rpc_main.c, Top level of the RPC protocol compiler.
*/
+#define RPCGEN_VERSION "199506" /* This program's version (year & month) */
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -533,6 +536,7 @@ h_output(infile, define, extend, outfile)
f_print(fout,"#ifndef _%s\n#define _%s\n\n", guard,
guard);
+ f_print(fout, "#define RPCGEN_VERSION\t%s\n\n", RPCGEN_VERSION);
f_print(fout, "#include <rpc/rpc.h>\n\n");
tell = ftell(fout);
diff --git a/usr.bin/systat/disks.c b/usr.bin/systat/disks.c
index 5b3a058e9cc..aa42b2c9d76 100644
--- a/usr.bin/systat/disks.c
+++ b/usr.bin/systat/disks.c
@@ -1,4 +1,5 @@
-/* $NetBSD: disks.c,v 1.2 1995/01/20 08:51:53 jtc Exp $ */
+/* $OpenBSD: disks.c,v 1.2 1996/03/27 19:32:52 niklas Exp $ */
+/* $NetBSD: disks.c,v 1.3 1996/03/15 22:19:23 ragge Exp $ */
/*-
* Copyright (c) 1980, 1992, 1993
@@ -36,8 +37,9 @@
#ifndef lint
#if 0
static char sccsid[] = "@(#)disks.c 8.1 (Berkeley) 6/6/93";
+static char rcsid[] = "$NetBSD: disks.c,v 1.3 1996/03/15 22:19:23 ragge Exp $";
#endif
-static char rcsid[] = "$NetBSD: disks.c,v 1.2 1995/01/20 08:51:53 jtc Exp $";
+static char rcsid[] = "$OpenBSD: disks.c,v 1.2 1996/03/27 19:32:52 niklas Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -59,12 +61,6 @@ static struct nlist namelist[] = {
{ "_dk_ndrive" },
#define X_DK_WPMS 1
{ "_dk_wpms" },
-#ifdef vax
-#define X_MBDINIT (X_DK_WPMS+1)
- { "_mbdinit" },
-#define X_UBDINIT (X_DK_WPMS+2)
- { "_ubdinit" },
-#endif
#ifdef sun
#define X_MBDINIT (X_DK_WPMS+1)
{ "_mbdinit" },
diff --git a/usr.bin/systat/iostat.c b/usr.bin/systat/iostat.c
index dc0525326c0..c2607d46790 100644
--- a/usr.bin/systat/iostat.c
+++ b/usr.bin/systat/iostat.c
@@ -1,4 +1,5 @@
-/* $NetBSD: iostat.c,v 1.3 1995/05/17 15:51:47 mycroft Exp $ */
+/* $OpenBSD: iostat.c,v 1.2 1996/03/27 19:32:54 niklas Exp $ */
+/* $NetBSD: iostat.c,v 1.4 1996/03/15 22:19:25 ragge Exp $ */
/*
* Copyright (c) 1980, 1992, 1993
@@ -36,8 +37,9 @@
#ifndef lint
#if 0
static char sccsid[] = "@(#)iostat.c 8.1 (Berkeley) 6/6/93";
+static char rcsid[] = "$NetBSD: iostat.c,v 1.4 1996/03/15 22:19:25 ragge Exp $";
#endif
-static char rcsid[] = "$NetBSD: iostat.c,v 1.3 1995/05/17 15:51:47 mycroft Exp $";
+static char rcsid[] = "$OpenBSD: iostat.c,v 1.2 1996/03/27 19:32:54 niklas Exp $";
#endif not lint
#include <sys/param.h>
@@ -64,12 +66,6 @@ static struct nlist namelist[] = {
{ "_dk_seek" },
#define X_CP_TIME 5
{ "_cp_time" },
-#ifdef vax
-#define X_MBDINIT (X_CP_TIME+1)
- { "_mbdinit" },
-#define X_UBDINIT (X_CP_TIME+2)
- { "_ubdinit" },
-#endif
#ifdef tahoe
#define X_VBDINIT (X_CP_TIME+1)
{ "_vbdinit" },
diff --git a/usr.bin/telnet/Makefile b/usr.bin/telnet/Makefile
index 054d24d96b7..b1ee15edd5e 100644
--- a/usr.bin/telnet/Makefile
+++ b/usr.bin/telnet/Makefile
@@ -1,3 +1,5 @@
+# $OpenBSD: Makefile,v 1.2 1996/03/27 19:32:55 niklas Exp $
+# $NetBSD: Makefile,v 1.6 1996/02/28 21:03:49 thorpej Exp $
#
# Copyright (c) 1990 The Regents of the University of California.
# All rights reserved.
@@ -31,7 +33,6 @@
# SUCH DAMAGE.
#
# from: @(#)Makefile 8.1 (Berkeley) 6/6/93
-# $Id: Makefile,v 1.1 1995/10/18 08:46:13 deraadt Exp $
#
PROG= telnet
@@ -39,10 +40,10 @@ PROG= telnet
CFLAGS+=-DTERMCAP -DKLUDGELINEMODE -DUSE_TERMIO -Dunix
CFLAGS+=-DENV_HACK
CFLAGS+=-I${.CURDIR}/../../lib
-
-LDADD= -ltermcap -ltelnet
+LDADD+= -ltermcap -ltelnet
DPADD= ${LIBTERMCAP}
+
SRCS= authenc.c commands.c main.c network.c ring.c sys_bsd.c telnet.c \
terminal.c tn3270.c utilities.c
diff --git a/usr.bin/telnet/README b/usr.bin/telnet/README
index 086c88f2950..4ddee63d51a 100644
--- a/usr.bin/telnet/README
+++ b/usr.bin/telnet/README
@@ -1,25 +1,211 @@
-
+ $OpenBSD: README,v 1.2 1996/03/27 19:32:56 niklas Exp $
This is a distribution of both client and server telnet. These programs
have been compiled on:
telnet telnetd
- BSD 4.3 Reno X X
- UNICOS 5.1 X X
- UNICOS 6.0 X X
- UNICOS 6.1 X X
- UNICOS 7.0 X X
- SunOs 3.5 X X (no linemode in server)
- SunOs 4.1 X X (no linemode in server)
- DYNIX V3.0.17.9 X X (no linemode in server)
- Ultrix 3.1 X X (no linemode in server)
- Ultrix 4.0 X X (no linemode in server)
+ 4.4 BSD-Lite x x
+ 4.3 BSD Reno X X
+ UNICOS 9.1 X X
+ UNICOS 9.0 X X
+ UNICOS 8.0 X X
+ BSDI 2.0 X X
+ Solaris 2.4 x x (no linemode in server)
+ SunOs 4.1.4 X X (no linemode in server)
+ Ultrix 4.3 X X (no linemode in server)
+ Ultrix 4.1 X X (no linemode in server)
In addition, previous versions have been compiled on the following
machines, but were not available for testing this version.
telnet telnetd
+ Next1.0 X X
+ UNICOS 8.3 X X
+ UNICOS 7.C X X
+ UNICOS 7.0 X X
SunOs 4.0.3c X X (no linemode in server)
- BSD 4.3 X X (no linemode in server)
+ 4.3 BSD X X (no linemode in server)
DYNIX V3.0.12 X X (no linemode in server)
+ Ultrix 3.1 X X (no linemode in server)
+ Ultrix 4.0 X X (no linemode in server)
+ SunOs 3.5 X X (no linemode in server)
+ SunOs 4.1.3 X X (no linemode in server)
+ Solaris 2.2 x x (no linemode in server)
+ Solaris 2.3 x x (no linemode in server)
+ BSDI 1.0 X X
+ BSDI 1.1 X X
+ DYNIX V3.0.17.9 X X (no linemode in server)
+ HP-UX 8.0 x x (no linemode in server)
+
+This code should work, but there are no guarantees.
+
+Oct 23, 1995
+
+This is a bugfix release.
+
+ The change in the previous release from using makeutx() to
+ pututxline() caused problems on SunOS/Solaris. It has been
+ changed back to using makeutx(). Symptoms include users
+ getting error messages when logging in about not being able
+ to open the tty.
+
+ Using memmove() instead of memcpy() caused problems under
+ SunOS 4.x, since it doesn't have memmove(). Config.generic
+ has been modified to include mem.o for SunOS 4.x.
+
+ Some new code was added to telnetd to do some enviornment
+ variable cleanup before execing login. Thanks to Sam Hartman
+ at MIT for pointing this out.
+
+ A couple of other minor bugfixes.
+
+May 30, 1995
+
+This release represents what is on the 4.4BSD-Lite2 release, which
+should be the final BSD release. I will continue to support of
+telnet, The code (without encryption) is available via anonymous ftp
+from ftp.cray.com, in src/telnet/telnet.YY.MM.DD.NE.tar.Z, where
+YY.MM.DD is replaced with the year, month and day of the release.
+If you can't find it at one of these places, at some point in the
+near future information about the latest releases should be available
+from ftp.borman.com.
+
+In addition, the version with the encryption code is available via
+ftp from net-dist.mit.edu, in the directory /pub/telnet. There
+is a README file there that gives further information on how
+to get the distribution.
+
+Questions, comments, bug reports and bug fixes can be sent to
+one of these addresses:
+ dab@borman.com
+ dab@cray.com
+ dab@bsdi.com
+
+This release is mainly bug fixes and code cleanup.
+
+ Replace all calls to bcopy()/bzero() with calls to
+ memmove()/memset() and all calls to index()/rindex()
+ with calls to strchr()/strrchr().
+
+ Add some missing diagnostics for option tracing
+ to telnetd.
+
+ Add support for BSDI 2.0 and Solaris 2.4.
+
+ Add support for UNICOS 8.0
+
+ Get rid of expanded tabs and trailing white spaces.
+
+ From Paul Vixie:
+ Fix for telnet going into an endless spin
+ when the session dies abnormally.
+
+ From Jef Poskanzer:
+ Changes to allow telnet to compile
+ under SunOS 3.5.
+
+ From Philip Guenther:
+ makeutx() doesn't expand utmpx,
+ use pututxline() instead.
+
+ From Chris Torek:
+ Add a sleep(1) before execing login
+ to avoid race condition that can eat
+ up the login prompt.
+ Use terminal speed directly if it is
+ not an encoded value.
+
+ From Steve Parker:
+ Fix to realloc() call. Fix for execing
+ login on solaris with no user name.
+
+January 19, 1994
+
+This is a list of some of the changes since the last tar release
+of telnet/telnetd. There are probably other changes that aren't
+listed here, but this should hit a lot of the main ones.
+
+ General:
+ Changed #define for AUTHENTICATE to AUTHENTICATION
+ Changed #define for ENCRYPT to ENCRYPTION
+ Changed #define for DES_ENCRYPT to DES_ENCRYPTION
+
+ Added support for SPX authentication: -DSPX
+
+ Added support for Kerberos Version 5 authentication: -DKRB5
+
+ Added support for ANSI C function prototypes
+
+ Added support for the NEW-ENVIRON option (RFC-1572)
+ including support for USERVAR.
+
+ Made support for the old Environment Option (RFC-1408)
+ conditional on -DOLD_ENVIRON
+
+ Added #define ENV_HACK - support for RFC 1571
+
+ The encryption code is removed from the public distributions.
+ Domestic 4.4 BSD distributions contain the encryption code.
+
+ ENV_HACK: Code to deal with systems that only implement
+ the old ENVIRON option, and have reversed definitions
+ of ENV_VAR and ENV_VAL. Also fixes ENV processing in
+ client to handle things besides just the default set...
+
+ NO_BSD_SETJMP: UNICOS configuration for
+ UNICOS 6.1/6.0/5.1/5.0 systems.
+
+ STREAMSPTY: Use /dev/ptmx to get a clean pty. This
+ is for SVr4 derivatives (Like Solaris)
+
+ UTMPX: For systems that have /etc/utmpx. This is for
+ SVr4 derivatives (Like Solaris)
+
+ Definitions for BSDI 1.0
+
+ Definitions for 4.3 Reno and 4.4 BSD.
+
+ Definitions for UNICOS 8.0 and UNICOS 7.C
+
+ Definitions for Solaris 2.0
+
+ Definitions for HP-UX 8.0
+
+ Latest Copyright notices from Berkeley.
+
+ FLOW-CONTROL: support for RFC-XXXx
+
+
+ Client Specific:
+
+ Fix the "send" command to not send garbage...
+
+ Fix status message for "skiprc"
+
+ Make sure to send NAWS after telnet has been suspended
+ or an external command has been run, if the window size
+ has changed.
+
+ sysV88 support.
+
+ Server Specific:
+
+ Support flowcontrol option in non-linemode servers.
+
+ -k Server supports Kludge Linemode, but will default to
+ either single character mode or real Linemode support.
+ The user will have to explicitly ask to switch into
+ kludge linemode. ("stty extproc", or escape back to
+ to telnet and say "mode line".)
+
+ -u Specify the length of the hostname field in the utmp
+ file. Hostname longer than this length will be put
+ into the utmp file in dotted decimal notation, rather
+ than putting in a truncated hostname.
+
+ -U Registered hosts only. If a reverse hostname lookup
+ fails, the connection will be refused.
+
+ -f/-F
+ Allows forwarding of credentials for KRB5.
Februrary 22, 1991:
@@ -30,9 +216,9 @@ Februrary 22, 1991:
AUTHENTICATION option is fairly well defined, and
an option number has been assigned to it. The
ENCRYPTION option is still in a state of flux; an
- option number has NOT been assigned to it yet.
- The code is provided in this release for experimental
- and testing purposes.
+ option number has been assigned to, but it is still
+ subject to change. The code is provided in this release
+ for experimental and testing purposes.
The telnet "send" command can now be used to send
do/dont/will/wont commands, with any telnet option
@@ -50,13 +236,20 @@ Februrary 22, 1991:
A new telnet command, "auth" has been added (if
AUTHENTICATE is defined). It has four sub-commands,
- "status", "debug", "disable", "enable" and "help".
+ "status", "disable", "enable" and "help".
A new telnet command, "encrypt" has been added (if
ENCRYPT is defined). It has many sub-commands:
"enable", "type", "start", "stop", "input",
- "-input", "output", "-output", "status", "auto",
- "verbose", "debug", and "help".
+ "-input", "output", "-output", "status", and "help".
+
+ The LOGOUT option is now supported by both telnet
+ and telnetd, a new command, "logout", was added
+ to support this.
+
+ Several new toggle options were added:
+ "autoencrypt", "autodecrypt", "autologin", "authdebug",
+ "encdebug", "skiprc", "verbose_encrypt"
An "rlogin" interface has been added. If the program
is named "rlogin", or the "-r" flag is given, then
@@ -477,10 +670,6 @@ telnet.state:
with option negotiation loops. The algorithm that is
used is described in this file.
-tmac.doc:
- Macros for use in formatting the man pages on non-4.3Reno
- systems.
-
telnet:
This directory contains the client code. No kernel changes are
needed to use this code.
@@ -496,6 +685,13 @@ libtelnet:
arpa:
This directory has a new <arpa/telnet.h>
+libtelnet/Makefile.4.4:
+telnet/Makefile.4.4:
+telnetd/Makefile.4.4:
+ These are the makefiles that can be used on a 4.3Reno
+ system when this software is installed in /usr/src/lib/libtelnet,
+ /usr/src/libexec/telnetd, and /usr/src/usr.bin/telnet.
+
The following TELNET options are supported:
@@ -537,6 +733,8 @@ The following TELNET options are supported:
ECHO: As per RFC 857
+ LOGOUT: As per RFC 727
+
STATUS:
The server will send its current status upon
request. It does not ask for the clients status.
@@ -559,7 +757,7 @@ The following TELNET options are supported:
but the definitions for the specific authentication
schemes is still in a state of flux.
- ENCRYPT:
+ ENCRYPTION:
This option is currently being defined by the IETF
Telnet Working Group, and an RFC has not yet been
issued. The draft RFC is still in a state of flux,
diff --git a/usr.bin/telnet/authenc.c b/usr.bin/telnet/authenc.c
index 284d12d88c0..99fc2ac9d81 100644
--- a/usr.bin/telnet/authenc.c
+++ b/usr.bin/telnet/authenc.c
@@ -1,3 +1,6 @@
+/* $OpenBSD: authenc.c,v 1.2 1996/03/27 19:32:57 niklas Exp $ */
+/* $NetBSD: authenc.c,v 1.5 1996/02/28 21:03:52 thorpej Exp $ */
+
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,8 +35,12 @@
*/
#ifndef lint
-/* from: static char sccsid[] = "@(#)authenc.c 8.1 (Berkeley) 6/6/93"; */
-static char *rcsid = "$Id: authenc.c,v 1.1 1995/10/18 08:46:14 deraadt Exp $";
+#if 0
+static char sccsid[] = "@(#)authenc.c 8.1 (Berkeley) 6/6/93";
+static char rcsid[] = "$NetBSD: authenc.c,v 1.5 1996/02/28 21:03:52 thorpej Exp $";
+#else
+static char rcsid[] = "$OpenBSD: authenc.c,v 1.2 1996/03/27 19:32:57 niklas Exp $";
+#endif
#endif /* not lint */
#if defined(AUTHENTICATION)
diff --git a/usr.bin/telnet/commands.c b/usr.bin/telnet/commands.c
index b175176cd96..85e8b9daeab 100644
--- a/usr.bin/telnet/commands.c
+++ b/usr.bin/telnet/commands.c
@@ -1,3 +1,6 @@
+/* $OpenBSD: commands.c,v 1.3 1996/03/27 19:32:58 niklas Exp $ */
+/* $NetBSD: commands.c,v 1.13 1996/02/28 21:03:53 thorpej Exp $ */
+
/*
* Copyright (c) 1988, 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,8 +35,12 @@
*/
#ifndef lint
-/* from: static char sccsid[] = "@(#)commands.c 8.1 (Berkeley) 6/6/93"; */
-static char *rcsid = "$Id: commands.c,v 1.2 1996/01/05 16:41:21 deraadt Exp $";
+#if 0
+static char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95";
+static char rcsid[] = "$NetBSD: commands.c,v 1.13 1996/02/28 21:03:53 thorpej Exp $";
+#else
+static char rcsid[] = "$OpenBSD: commands.c,v 1.3 1996/03/27 19:32:58 niklas Exp $";
+#endif
#endif /* not lint */
#if defined(unix)
@@ -59,6 +66,8 @@ static char *rcsid = "$Id: commands.c,v 1.2 1996/01/05 16:41:21 deraadt Exp $";
#include <errno.h>
#include <arpa/telnet.h>
+#include <sys/cdefs.h>
+#define P __P
#include "general.h"
@@ -77,9 +86,9 @@ static char *rcsid = "$Id: commands.c,v 1.2 1996/01/05 16:41:21 deraadt Exp $";
#include <netinet/ip.h>
-#ifndef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN 64
-#endif MAXHOSTNAMELEN
+#ifndef MAXHOSTNAMELEN
+#define MAXHOSTNAMELEN 64
+#endif MAXHOSTNAMELEN
#if defined(IPPROTO_IP) && defined(IP_TOS)
int tos = -1;
@@ -235,7 +244,7 @@ control(c)
* the "send" command.
*
*/
-
+
struct sendlist {
char *name; /* How user refers to it (case independent) */
char *help; /* Help information (0 ==> no help) */
@@ -413,7 +422,7 @@ send_tncmd(func, cmd, name)
extern char *telopts[];
register int val = 0;
- if (isprefix(name, "help") || isprefix(name, "?")) {
+ if (isprefix(name, "?")) {
register int col, len;
printf("Usage: send %s <value|option>\n", cmd);
@@ -1333,7 +1342,7 @@ suspend()
(void) kill(0, SIGTSTP);
/*
* If we didn't get the window size before the SUSPEND, but we
- * can get them now (???), then send the NAWS to make sure that
+ * can get them now (?), then send the NAWS to make sure that
* we are set up for the right window size.
*/
if (TerminalWindowSize(&newrows, &newcols) && connected &&
@@ -1373,12 +1382,12 @@ shell(argc, argv)
* Fire up the shell in the child.
*/
register char *shellp, *shellname;
- extern char *rindex();
+ extern char *strrchr();
shellp = getenv("SHELL");
if (shellp == NULL)
shellp = "/bin/sh";
- if ((shellname = rindex(shellp, '/')) == 0)
+ if ((shellname = strrchr(shellp, '/')) == 0)
shellname = shellp;
else
shellname++;
@@ -1514,14 +1523,14 @@ slccmd(argc, argv)
}
c = getslc(argv[1]);
if (c == 0) {
- fprintf(stderr, "'%s': unknown argument ('slc ?' for help).\n",
+ fprintf(stderr, "'%s': unknown argument ('slc ?' for help).\n",
argv[1]);
- return 0;
+ return 0;
}
if (Ambiguous(c)) {
- fprintf(stderr, "'%s': ambiguous argument ('slc ?' for help).\n",
+ fprintf(stderr, "'%s': ambiguous argument ('slc ?' for help).\n",
argv[1]);
- return 0;
+ return 0;
}
(*c->handler)(c->arg);
slcstate();
@@ -1610,14 +1619,14 @@ env_cmd(argc, argv)
}
c = getenvcmd(argv[1]);
if (c == 0) {
- fprintf(stderr, "'%s': unknown argument ('environ ?' for help).\n",
+ fprintf(stderr, "'%s': unknown argument ('environ ?' for help).\n",
argv[1]);
- return 0;
+ return 0;
}
if (Ambiguous(c)) {
- fprintf(stderr, "'%s': ambiguous argument ('environ ?' for help).\n",
+ fprintf(stderr, "'%s': ambiguous argument ('environ ?' for help).\n",
argv[1]);
- return 0;
+ return 0;
}
if (c->narg + 2 != argc) {
fprintf(stderr,
@@ -1660,10 +1669,10 @@ env_init()
extern char **environ;
register char **epp, *cp;
register struct env_lst *ep;
- extern char *index();
+ extern char *strchr();
for (epp = environ; *epp; epp++) {
- if (cp = index(*epp, '=')) {
+ if (cp = strchr(*epp, '=')) {
*cp = '\0';
ep = env_define((unsigned char *)*epp,
(unsigned char *)cp+1);
@@ -1678,9 +1687,9 @@ env_init()
*/
if ((ep = env_find("DISPLAY"))
&& ((*ep->value == ':')
- || (strncmp((char *)ep->value, "unix:", 5) == 0))) {
+ || (strncmp((char *)ep->value, "unix:", 5) == 0))) {
char hbuf[256+1];
- char *cp2 = index((char *)ep->value, ':');
+ char *cp2 = strchr((char *)ep->value, ':');
gethostname(hbuf, 256);
hbuf[256] = '\0';
@@ -1772,7 +1781,7 @@ env_send(var)
{
register struct env_lst *ep;
- if (my_state_is_wont(TELOPT_NEW_ENVIRON)
+ if (my_state_is_wont(TELOPT_NEW_ENVIRON)
#ifdef OLD_ENVIRON
&& my_state_is_wont(TELOPT_OLD_ENVIRON)
#endif
@@ -1885,8 +1894,8 @@ struct authlist {
};
extern int
- auth_enable P((int)),
- auth_disable P((int)),
+ auth_enable P((char *)),
+ auth_disable P((char *)),
auth_status P((void));
static int
auth_help P((void));
@@ -1925,17 +1934,23 @@ auth_cmd(argc, argv)
{
struct authlist *c;
+ if (argc < 2) {
+ fprintf(stderr,
+ "Need an argument to 'auth' command. 'auth ?' for help.\n");
+ return 0;
+ }
+
c = (struct authlist *)
genget(argv[1], (char **) AuthList, sizeof(struct authlist));
if (c == 0) {
- fprintf(stderr, "'%s': unknown argument ('auth ?' for help).\n",
+ fprintf(stderr, "'%s': unknown argument ('auth ?' for help).\n",
argv[1]);
- return 0;
+ return 0;
}
if (Ambiguous(c)) {
- fprintf(stderr, "'%s': ambiguous argument ('auth ?' for help).\n",
+ fprintf(stderr, "'%s': ambiguous argument ('auth ?' for help).\n",
argv[1]);
- return 0;
+ return 0;
}
if (c->narg + 2 != argc) {
fprintf(stderr,
@@ -2081,7 +2096,7 @@ tn(argc, argv)
char *cmd, *hostp = 0, *portp = 0, *user = 0;
/* clear the socket address prior to use */
- bzero((char *)&sin, sizeof(sin));
+ memset((char *)&sin, 0, sizeof(sin));
if (connected) {
printf("?Already connected to %s\n", hostname);
@@ -2099,7 +2114,7 @@ tn(argc, argv)
cmd = *argv;
--argc; ++argv;
while (argc) {
- if (isprefix(*argv, "?"))
+ if (strcmp(*argv, "help") == 0 || isprefix(*argv, "?"))
goto usage;
if (strcmp(*argv, "-l") == 0) {
--argc; ++argv;
@@ -2164,17 +2179,17 @@ tn(argc, argv)
if (host) {
sin.sin_family = host->h_addrtype;
#if defined(h_addr) /* In 4.3, this is a #define */
- memcpy((caddr_t)&sin.sin_addr,
+ memmove((caddr_t)&sin.sin_addr,
host->h_addr_list[0], host->h_length);
#else /* defined(h_addr) */
- memcpy((caddr_t)&sin.sin_addr, host->h_addr, host->h_length);
+ memmove((caddr_t)&sin.sin_addr, host->h_addr, host->h_length);
#endif /* defined(h_addr) */
strncpy(_hostname, host->h_name, sizeof(_hostname));
_hostname[sizeof(_hostname)-1] = '\0';
hostname = _hostname;
} else {
herror(hostp);
- setuid(getuid());
+ setuid(getuid());
return 0;
}
}
@@ -2194,7 +2209,7 @@ tn(argc, argv)
sin.sin_port = sp->s_port;
else {
printf("%s: bad port number\n", portp);
- setuid(getuid());
+ setuid(getuid());
return 0;
}
} else {
@@ -2208,7 +2223,7 @@ tn(argc, argv)
sp = getservbyname("telnet", "tcp");
if (sp == 0) {
fprintf(stderr, "telnet: tcp/telnet: unknown service\n");
- setuid(getuid());
+ setuid(getuid());
return 0;
}
sin.sin_port = sp->s_port;
@@ -2235,7 +2250,7 @@ tn(argc, argv)
tos = tp->t_tos;
# endif
if (tos < 0)
- tos = IPTOS_LOWDELAY;
+ tos = IPTOS_LOWDELAY; /* Low Delay bit */
if (tos
&& (setsockopt(net, IPPROTO_IP, IP_TOS,
(char *)&tos, sizeof(int)) < 0)
@@ -2258,7 +2273,7 @@ tn(argc, argv)
errno = oerrno;
perror((char *)0);
host->h_addr_list++;
- memcpy((caddr_t)&sin.sin_addr,
+ memmove((caddr_t)&sin.sin_addr,
host->h_addr_list[0], host->h_length);
(void) NetClose(net);
continue;
@@ -2436,7 +2451,7 @@ command(top, tbuf, cnt)
goto getline;
*cp = '\0';
if (rlogin == _POSIX_VDISABLE)
- printf("%s\n", line);
+ printf("%s\n", line);
} else {
getline:
if (rlogin != _POSIX_VDISABLE)
@@ -2639,10 +2654,10 @@ cmdrc(m1, m2)
* *cpp: If *cpp was equal to NULL, it will be filled
* in with a pointer to our static area that has
* the option filled in. This will be 32bit aligned.
- *
+ *
* *lenp: This will be filled in with how long the option
* pointed to by *cpp is.
- *
+ *
*/
unsigned long
sourceroute(arg, cpp, lenp)
@@ -2736,16 +2751,16 @@ sourceroute(arg, cpp, lenp)
sin_addr.s_addr = tmp;
} else if (host = gethostbyname(cp)) {
#if defined(h_addr)
- memcpy((caddr_t)&sin_addr,
+ memmove((caddr_t)&sin_addr,
host->h_addr_list[0], host->h_length);
#else
- memcpy((caddr_t)&sin_addr, host->h_addr, host->h_length);
+ memmove((caddr_t)&sin_addr, host->h_addr, host->h_length);
#endif
} else {
*cpp = cp;
return(0);
}
- memcpy(lsrp, (char *)&sin_addr, 4);
+ memmove(lsrp, (char *)&sin_addr, 4);
lsrp += 4;
if (cp2)
cp = cp2;
diff --git a/usr.bin/telnet/defines.h b/usr.bin/telnet/defines.h
index 3761524d74c..b1367794d86 100644
--- a/usr.bin/telnet/defines.h
+++ b/usr.bin/telnet/defines.h
@@ -1,3 +1,6 @@
+/* $OpenBSD: defines.h,v 1.2 1996/03/27 19:33:00 niklas Exp $ */
+/* $NetBSD: defines.h,v 1.5 1996/02/28 21:03:55 thorpej Exp $ */
+
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -31,7 +34,6 @@
* SUCH DAMAGE.
*
* from: @(#)defines.h 8.1 (Berkeley) 6/6/93
- * $Id: defines.h,v 1.1 1995/10/18 08:46:14 deraadt Exp $
*/
#define settimer(x) clocks.x = clocks.system++
diff --git a/usr.bin/telnet/externs.h b/usr.bin/telnet/externs.h
index fa9d3707261..52c5cbd02a4 100644
--- a/usr.bin/telnet/externs.h
+++ b/usr.bin/telnet/externs.h
@@ -1,3 +1,6 @@
+/* $OpenBSD: externs.h,v 1.2 1996/03/27 19:33:01 niklas Exp $ */
+/* $NetBSD: externs.h,v 1.8 1996/02/28 21:03:58 thorpej Exp $ */
+
/*
* Copyright (c) 1988, 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -30,8 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * from: @(#)externs.h 8.1 (Berkeley) 6/6/93
- * $Id: externs.h,v 1.1 1995/10/18 08:46:14 deraadt Exp $
+ * from: @(#)externs.h 8.3 (Berkeley) 5/30/95
*/
#ifndef BSD
@@ -85,8 +87,9 @@ typedef unsigned char cc_t;
#ifndef NO_STRING_H
#include <string.h>
-#endif
+#else
#include <strings.h>
+#endif
#ifndef _POSIX_VDISABLE
# ifdef sun
@@ -105,13 +108,8 @@ typedef unsigned char cc_t;
extern int errno; /* outside this world */
#endif /* !CRAY */
-#if !defined(P)
-# ifdef __STDC__
-# define P(x) x
-# else
-# define P(x) ()
-# endif
-#endif
+#include <sys/cdefs.h>
+#define P __P
extern int
autologin, /* Autologin enabled */
@@ -120,12 +118,12 @@ extern int
flushout, /* flush output */
connected, /* Are we connected to the other side? */
globalmode, /* Mode tty should be in */
- In3270, /* Are we in 3270 mode? */
+ In3270, /* Are we in 3270 mode? */
telnetport, /* Are we connected to the telnet port? */
localflow, /* Flow control handled locally */
restartany, /* If flow control, restart output on any character */
localchars, /* we recognize interrupt/quit */
- donelclchars, /* the user has set "localchars" */
+ donelclchars, /* the user has set "localchars" */
showoptions,
net, /* Network file descriptor */
tin, /* Terminal input file descriptor */
@@ -146,7 +144,7 @@ extern int
#endif /* defined(TN3270) */
termdata, /* Print out terminal data flow */
#endif /* defined(unix) */
- debug, /* Debug level */
+ debug, /* Debug level */
clienteof; /* Client received EOF */
extern cc_t escape; /* Escape to command mode */
diff --git a/usr.bin/telnet/fdset.h b/usr.bin/telnet/fdset.h
index 133b0ca8bde..72f9655a096 100644
--- a/usr.bin/telnet/fdset.h
+++ b/usr.bin/telnet/fdset.h
@@ -1,3 +1,6 @@
+/* $OpenBSD: fdset.h,v 1.2 1996/03/27 19:33:02 niklas Exp $ */
+/* $NetBSD: fdset.h,v 1.5 1996/02/28 21:04:00 thorpej Exp $ */
+
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -31,7 +34,6 @@
* SUCH DAMAGE.
*
* from: @(#)fdset.h 8.1 (Berkeley) 6/6/93
- * $Id: fdset.h,v 1.1 1995/10/18 08:46:14 deraadt Exp $
*/
/*
diff --git a/usr.bin/telnet/general.h b/usr.bin/telnet/general.h
index 3908e7a035a..f1a71404263 100644
--- a/usr.bin/telnet/general.h
+++ b/usr.bin/telnet/general.h
@@ -1,3 +1,6 @@
+/* $OpenBSD: general.h,v 1.2 1996/03/27 19:33:03 niklas Exp $ */
+/* $NetBSD: general.h,v 1.5 1996/02/28 21:04:02 thorpej Exp $ */
+
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -31,7 +34,6 @@
* SUCH DAMAGE.
*
* from: @(#)general.h 8.1 (Berkeley) 6/6/93
- * $Id: general.h,v 1.1 1995/10/18 08:46:14 deraadt Exp $
*/
/*
diff --git a/usr.bin/telnet/main.c b/usr.bin/telnet/main.c
index 29149a95530..4370fabc471 100644
--- a/usr.bin/telnet/main.c
+++ b/usr.bin/telnet/main.c
@@ -1,6 +1,9 @@
+/* $OpenBSD: main.c,v 1.2 1996/03/27 19:33:03 niklas Exp $ */
+/* $NetBSD: main.c,v 1.5 1996/02/28 21:04:05 thorpej Exp $ */
+
/*
- * Copyright (c) 1988, 1990 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1988, 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,14 +35,18 @@
*/
#ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1988, 1990 Regents of the University of California.\n\
- All rights reserved.\n";
+static char copyright[] =
+"@(#) Copyright (c) 1988, 1990, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
-/* from: static char sccsid[] = "@(#)main.c 5.5 (Berkeley) 12/18/92"; */
-static char *rcsid = "$Id: main.c,v 1.1 1995/10/18 08:46:14 deraadt Exp $";
+#if 0
+static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 5/30/95";
+static char rcsid[] = "$NetBSD: main.c,v 1.5 1996/02/28 21:04:05 thorpej Exp $";
+#else
+static char rcsid[] = "$OpenBSD: main.c,v 1.2 1996/03/27 19:33:03 niklas Exp $";
+#endif
#endif /* not lint */
#include <sys/types.h>
@@ -50,8 +57,8 @@ static char *rcsid = "$Id: main.c,v 1.1 1995/10/18 08:46:14 deraadt Exp $";
/* These values need to be the same as defined in libtelnet/kerberos5.c */
/* Either define them in both places, or put in some common header file. */
-#define OPTS_FORWARD_CREDS 0x00000002
-#define OPTS_FORWARDABLE_CREDS 0x00000001
+#define OPTS_FORWARD_CREDS 0x00000002
+#define OPTS_FORWARDABLE_CREDS 0x00000001
#if 0
#define FORWARD
@@ -66,7 +73,7 @@ tninit()
init_terminal();
init_network();
-
+
init_telnet();
init_sys();
@@ -82,17 +89,17 @@ usage()
fprintf(stderr, "Usage: %s %s%s%s%s\n",
prompt,
#ifdef AUTHENTICATION
- " [-8] [-E] [-K] [-L] [-X atype] [-a] [-d] [-e char] [-k realm]",
- "\n\t[-l user] [-f/-F] [-n tracefile] ",
+ "[-8] [-E] [-K] [-L] [-S tos] [-X atype] [-a] [-c] [-d] [-e char]",
+ "\n\t[-k realm] [-l user] [-f/-F] [-n tracefile] ",
#else
- " [-8] [-E] [-L] [-a] [-d] [-e char] [-l user] [-n tracefile]",
- "\n\t",
+ "[-8] [-E] [-L] [-S tos] [-a] [-c] [-d] [-e char] [-l user]",
+ "\n\t[-n tracefile]",
#endif
#if defined(TN3270) && defined(unix)
# ifdef AUTHENTICATION
- "[-noasynch] [-noasynctty] [-noasyncnet]\n\t[-r] [-t transcom] ",
+ "[-noasynch] [-noasynctty]\n\t[-noasyncnet] [-r] [-t transcom] ",
# else
- "[-noasynch] [-noasynctty] [-noasyncnet] [-r] [-t transcom]\n\t",
+ "[-noasynch] [-noasynctty] [-noasyncnet] [-r]\n\t[-t transcom]",
# endif
#else
"[-r] ",
@@ -189,7 +196,7 @@ main(argc, argv)
case 'f':
#if defined(AUTHENTICATION) && defined(KRB5) && defined(FORWARD)
if (forward_flags & OPTS_FORWARD_CREDS) {
- fprintf(stderr,
+ fprintf(stderr,
"%s: Only one of -f and -F allowed.\n",
prompt);
usage();
@@ -197,14 +204,14 @@ main(argc, argv)
forward_flags |= OPTS_FORWARD_CREDS;
#else
fprintf(stderr,
- "%s: Warning: -f ignored, no Kerberos V5 support.\n",
+ "%s: Warning: -f ignored, no Kerberos V5 support.\n",
prompt);
#endif
break;
case 'F':
#if defined(AUTHENTICATION) && defined(KRB5) && defined(FORWARD)
if (forward_flags & OPTS_FORWARD_CREDS) {
- fprintf(stderr,
+ fprintf(stderr,
"%s: Only one of -f and -F allowed.\n",
prompt);
usage();
@@ -213,7 +220,7 @@ main(argc, argv)
forward_flags |= OPTS_FORWARDABLE_CREDS;
#else
fprintf(stderr,
- "%s: Warning: -F ignored, no Kerberos V5 support.\n",
+ "%s: Warning: -F ignored, no Kerberos V5 support.\n",
prompt);
#endif
break;
diff --git a/usr.bin/telnet/network.c b/usr.bin/telnet/network.c
index 0ed8baaba55..cd63187d951 100644
--- a/usr.bin/telnet/network.c
+++ b/usr.bin/telnet/network.c
@@ -1,3 +1,6 @@
+/* $OpenBSD: network.c,v 1.2 1996/03/27 19:33:04 niklas Exp $ */
+/* $NetBSD: network.c,v 1.5 1996/02/28 21:04:06 thorpej Exp $ */
+
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,8 +35,12 @@
*/
#ifndef lint
-/* from: static char sccsid[] = "@(#)network.c 8.1 (Berkeley) 6/6/93"; */
-static char *rcsid = "$Id: network.c,v 1.1 1995/10/18 08:46:14 deraadt Exp $";
+#if 0
+static char sccsid[] = "@(#)network.c 8.2 (Berkeley) 12/15/93";
+static char rcsid[] = "$NetBSD: network.c,v 1.5 1996/02/28 21:04:06 thorpej Exp $";
+#else
+static char rcsid[] = "$OpenBSD: network.c,v 1.2 1996/03/27 19:33:04 niklas Exp $";
+#endif
#endif /* not lint */
#include <sys/types.h>
diff --git a/usr.bin/telnet/ring.c b/usr.bin/telnet/ring.c
index 694b045d831..56588d18dbd 100644
--- a/usr.bin/telnet/ring.c
+++ b/usr.bin/telnet/ring.c
@@ -1,3 +1,6 @@
+/* $OpenBSD: ring.c,v 1.2 1996/03/27 19:33:05 niklas Exp $ */
+/* $NetBSD: ring.c,v 1.7 1996/02/28 21:04:07 thorpej Exp $ */
+
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,8 +35,12 @@
*/
#ifndef lint
-/* from: static char sccsid[] = "@(#)ring.c 8.1 (Berkeley) 6/6/93"; */
-static char *rcsid = "$Id: ring.c,v 1.1 1995/10/18 08:46:14 deraadt Exp $";
+#if 0
+static char sccsid[] = "@(#)ring.c 8.2 (Berkeley) 5/30/95";
+static char rcsid[] = "$NetBSD: ring.c,v 1.7 1996/02/28 21:04:07 thorpej Exp $";
+#else
+static char rcsid[] = "$OpenBSD: ring.c,v 1.2 1996/03/27 19:33:05 niklas Exp $";
+#endif
#endif /* not lint */
/*
@@ -288,7 +295,7 @@ ring_supply_data(ring, buffer, count)
while (count) {
i = MIN(count, ring_empty_consecutive(ring));
- memcpy(ring->supply, buffer, i);
+ memmove(ring->supply, buffer, i);
ring_supplied(ring, i);
count -= i;
buffer += i;
@@ -310,7 +317,7 @@ ring_consume_data(ring, buffer, count)
while (count) {
i = MIN(count, ring_full_consecutive(ring));
- memcpy(buffer, ring->consume, i);
+ memmove(buffer, ring->consume, i);
ring_consumed(ring, i);
count -= i;
buffer += i;
diff --git a/usr.bin/telnet/ring.h b/usr.bin/telnet/ring.h
index 1e10970a973..6898afbc198 100644
--- a/usr.bin/telnet/ring.h
+++ b/usr.bin/telnet/ring.h
@@ -1,3 +1,6 @@
+/* $OpenBSD: ring.h,v 1.2 1996/03/27 19:33:06 niklas Exp $ */
+/* $NetBSD: ring.h,v 1.5 1996/02/28 21:04:09 thorpej Exp $ */
+
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -31,18 +34,10 @@
* SUCH DAMAGE.
*
* from: @(#)ring.h 8.1 (Berkeley) 6/6/93
- * $Id: ring.h,v 1.1 1995/10/18 08:46:14 deraadt Exp $
*/
-#if defined(P)
-# undef P
-#endif
-
-#if defined(__STDC__) || defined(LINT_ARGS)
-# define P(x) x
-#else
-# define P(x) ()
-#endif
+#include <sys/cdefs.h>
+#define P __P
/*
* This defines a structure for a ring buffer.
diff --git a/usr.bin/telnet/sys_bsd.c b/usr.bin/telnet/sys_bsd.c
index 77fb7e2b7df..daac07fe7ce 100644
--- a/usr.bin/telnet/sys_bsd.c
+++ b/usr.bin/telnet/sys_bsd.c
@@ -1,3 +1,6 @@
+/* $OpenBSD: sys_bsd.c,v 1.3 1996/03/27 19:33:07 niklas Exp $ */
+/* $NetBSD: sys_bsd.c,v 1.11 1996/02/28 21:04:10 thorpej Exp $ */
+
/*
* Copyright (c) 1988, 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,8 +35,12 @@
*/
#ifndef lint
-/* from: static char sccsid[] = "@(#)sys_bsd.c 8.1 (Berkeley) 6/6/93"; */
-static char *rcsid = "$Id: sys_bsd.c,v 1.2 1996/02/23 15:13:01 niklas Exp $";
+#if 0
+from: static char sccsid[] = "@(#)sys_bsd.c 8.4 (Berkeley) 5/30/95";
+static char rcsid[] = "$NetBSD: sys_bsd.c,v 1.11 1996/02/28 21:04:10 thorpej Exp $";
+#else
+static char rcsid[] = "$OpenBSD: sys_bsd.c,v 1.3 1996/03/27 19:33:07 niklas Exp $";
+#endif
#endif /* not lint */
/*
@@ -141,7 +148,7 @@ TerminalWrite(buf, n)
int
TerminalRead(buf, n)
- char *buf;
+ unsigned char *buf;
int n;
{
return read(tin, buf, n);
@@ -224,7 +231,7 @@ TerminalSpecialChars(c)
/*
* Flush output to the terminal
*/
-
+
void
TerminalFlushOutput()
{
@@ -329,7 +336,7 @@ TerminalDefaultChars()
nttyb.sg_kill = ottyb.sg_kill;
nttyb.sg_erase = ottyb.sg_erase;
#else /* USE_TERMIO */
- memcpy(new_tc.c_cc, old_tc.c_cc, sizeof(old_tc.c_cc));
+ memmove(new_tc.c_cc, old_tc.c_cc, sizeof(old_tc.c_cc));
# ifndef VDISCARD
termFlushChar = CONTROL('O');
# endif
@@ -668,7 +675,11 @@ TerminalNewMode(f)
#endif
#ifdef SIGTSTP
(void) signal(SIGTSTP, SIG_DFL);
+# ifndef SOLARIS
(void) sigsetmask(sigblock(0) & ~(1<<(SIGTSTP-1)));
+# else SOLARIS
+ (void) sigrelse(SIGTSTP);
+# endif SOLARIS
#endif /* SIGTSTP */
#ifndef USE_TERMIO
ltc = oltc;
@@ -703,14 +714,51 @@ TerminalNewMode(f)
}
+/*
+ * Try to guess whether speeds are "encoded" (4.2BSD) or just numeric (4.4BSD).
+ */
+#if B4800 != 4800
+#define DECODE_BAUD
+#endif
+
+#ifdef DECODE_BAUD
+#ifndef B7200
+#define B7200 B4800
+#endif
+
+#ifndef B14400
+#define B14400 B9600
+#endif
+
#ifndef B19200
-# define B19200 B9600
+# define B19200 B14400
+#endif
+
+#ifndef B28800
+#define B28800 B19200
#endif
#ifndef B38400
-# define B38400 B19200
+# define B38400 B28800
+#endif
+
+#ifndef B57600
+#define B57600 B38400
#endif
+#ifndef B76800
+#define B76800 B57600
+#endif
+
+#ifndef B115200
+#define B115200 B76800
+#endif
+
+#ifndef B230400
+#define B230400 B115200
+#endif
+
+
/*
* This code assumes that the values B0, B50, B75...
* are in ascending order. They do not have to be
@@ -720,20 +768,25 @@ struct termspeeds {
long speed;
long value;
} termspeeds[] = {
- { 0, B0 }, { 50, B50 }, { 75, B75 },
- { 110, B110 }, { 134, B134 }, { 150, B150 },
- { 200, B200 }, { 300, B300 }, { 600, B600 },
- { 1200, B1200 }, { 1800, B1800 }, { 2400, B2400 },
- { 4800, B4800 }, { 9600, B9600 }, { 19200, B19200 },
- { 38400, B38400 }, { -1, B38400 }
+ { 0, B0 }, { 50, B50 }, { 75, B75 },
+ { 110, B110 }, { 134, B134 }, { 150, B150 },
+ { 200, B200 }, { 300, B300 }, { 600, B600 },
+ { 1200, B1200 }, { 1800, B1800 }, { 2400, B2400 },
+ { 4800, B4800 }, { 7200, B7200 }, { 9600, B9600 },
+ { 14400, B14400 }, { 19200, B19200 }, { 28800, B28800 },
+ { 38400, B38400 }, { 57600, B57600 }, { 115200, B115200 },
+ { 230400, B230400 }, { -1, B230400 }
};
+#endif /* DECODE_BAUD */
void
TerminalSpeeds(ispeed, ospeed)
long *ispeed;
long *ospeed;
{
+#ifdef DECODE_BAUD
register struct termspeeds *tp;
+#endif /* DECODE_BAUD */
register long in, out;
out = cfgetospeed(&old_tc);
@@ -741,6 +794,7 @@ TerminalSpeeds(ispeed, ospeed)
if (in == 0)
in = out;
+#ifdef DECODE_BAUD
tp = termspeeds;
while ((tp->speed != -1) && (tp->value < in))
tp++;
@@ -750,6 +804,10 @@ TerminalSpeeds(ispeed, ospeed)
while ((tp->speed != -1) && (tp->value < out))
tp++;
*ospeed = tp->speed;
+#else /* DECODE_BAUD */
+ *ispeed = in;
+ *ospeed = out;
+#endif /* DECODE_BAUD */
}
int
@@ -945,7 +1003,7 @@ process_rings(netin, netout, netex, ttyin, ttyout, poll)
if (netout) {
FD_SET(net, &obits);
- }
+ }
if (ttyout) {
FD_SET(tout, &obits);
}
@@ -1084,7 +1142,7 @@ process_rings(netin, netout, netex, ttyin, ttyout, poll)
int i;
i = recv(net, netiring.supply + c, canread - c, MSG_OOB);
if (i == c &&
- bcmp(netiring.supply, netiring.supply + c, i) == 0) {
+ memcmp(netiring.supply, netiring.supply + c, i) == 0) {
bogus_oob = 1;
first = 0;
} else if (i < 0) {
@@ -1133,6 +1191,8 @@ process_rings(netin, netout, netex, ttyin, ttyout, poll)
if (FD_ISSET(tin, &ibits)) {
FD_CLR(tin, &ibits);
c = TerminalRead(ttyiring.supply, ring_empty_consecutive(&ttyiring));
+ if (c < 0 && errno == EIO)
+ c = 0;
if (c < 0 && errno == EWOULDBLOCK) {
c = 0;
} else {
diff --git a/usr.bin/telnet/telnet.1 b/usr.bin/telnet/telnet.1
index 98de351e7c7..446f994c14c 100644
--- a/usr.bin/telnet/telnet.1
+++ b/usr.bin/telnet/telnet.1
@@ -1,3 +1,6 @@
+.\" $OpenBSD: telnet.1,v 1.2 1996/03/27 19:33:08 niklas Exp $
+.\" $NetBSD: telnet.1,v 1.5 1996/02/28 21:04:12 thorpej Exp $
+.\"
.\" Copyright (c) 1983, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
@@ -30,7 +33,6 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)telnet.1 8.4 (Berkeley) 2/3/94
-.\" $Id: telnet.1,v 1.1 1995/10/18 08:46:15 deraadt Exp $
.\"
.Dd February 3, 1994
.Dt TELNET 1
diff --git a/usr.bin/telnet/telnet.c b/usr.bin/telnet/telnet.c
index 038c6b31874..25537f07895 100644
--- a/usr.bin/telnet/telnet.c
+++ b/usr.bin/telnet/telnet.c
@@ -1,3 +1,6 @@
+/* $OpenBSD: telnet.c,v 1.2 1996/03/27 19:33:10 niklas Exp $ */
+/* $NetBSD: telnet.c,v 1.7 1996/02/28 21:04:15 thorpej Exp $ */
+
/*
* Copyright (c) 1988, 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,8 +35,12 @@
*/
#ifndef lint
-/* from: static char sccsid[] = "@(#)telnet.c 8.1 (Berkeley) 6/6/93"; */
-static char *rcsid = "$Id: telnet.c,v 1.1 1995/10/18 08:46:15 deraadt Exp $";
+#if 0
+static char sccsid[] = "@(#)telnet.c 8.4 (Berkeley) 5/30/95";
+static char rcsid[] = "$NetBSD: telnet.c,v 1.7 1996/02/28 21:04:15 thorpej Exp $";
+#else
+static char rcsid[] = "$OpenBSD: telnet.c,v 1.2 1996/03/27 19:33:10 niklas Exp $";
+#endif
#endif /* not lint */
#include <sys/types.h>
@@ -58,7 +65,7 @@ static char *rcsid = "$Id: telnet.c,v 1.1 1995/10/18 08:46:15 deraadt Exp $";
#include "general.h"
-#define strip(x) ((x)&0x7f)
+#define strip(x) ((my_want_state_is_wont(TELOPT_BINARY)) ? ((x)&0x7f) : (x))
static unsigned char subbuffer[SUBBUFSIZE],
*subpointer, *subend; /* buffer for sub-options */
@@ -179,7 +186,7 @@ init_telnet()
ClearArray(options);
connected = In3270 = ISend = localflow = donebinarytoggle = 0;
-#if defined(AUTHENTICATION)
+#if defined(AUTHENTICATION)
auth_encrypt_connect(connected);
#endif /* defined(AUTHENTICATION) */
restartany = -1;
@@ -615,7 +622,7 @@ mklist(buf, name)
register char c, *cp, **argvp, *cp2, **argv, **avt;
if (name) {
- if (strlen(name) > 40) {
+ if ((int)strlen(name) > 40) {
name = 0;
unknown[0] = name_unknown;
} else {
@@ -681,7 +688,7 @@ mklist(buf, name)
else if (islower(c))
*cp = toupper(c);
}
-
+
/*
* Check for an old V6 2 character name. If the second
* name points to the beginning of the buffer, and is
@@ -774,7 +781,7 @@ gettermname()
(setupterm(tname, 1, &err) == 0)) {
tnamep = mklist(termbuf, tname);
} else {
- if (tname && (strlen(tname) <= 40)) {
+ if (tname && ((int)strlen(tname) <= 40)) {
unknown[0] = tname;
upcase(tname);
} else
@@ -1749,7 +1756,7 @@ telrcv()
case TS_IAC:
process_iac:
switch (c) {
-
+
case WILL:
telrcv_state = TS_WILL;
continue;
@@ -2135,7 +2142,7 @@ Scheduler(block)
ring_full_consecutive(&ttyiring));
if (c) {
returnValue = 1;
- ring_consumed(&ttyiring, c);
+ ring_consumed(&ttyiring, c);
}
} else {
# endif /* defined(TN3270) */
@@ -2164,7 +2171,7 @@ telnet(user)
{
sys_telnet_init();
-#if defined(AUTHENTICATION)
+#if defined(AUTHENTICATION)
{
static char local_host[256] = { 0 };
@@ -2342,7 +2349,7 @@ netclear()
next = nextitem(next);
} while (wewant(next) && (nfrontp > next));
length = next-thisitem;
- memcpy(good, thisitem, length);
+ memmove(good, thisitem, length);
good += length;
thisitem = next;
} else {
diff --git a/usr.bin/telnet/terminal.c b/usr.bin/telnet/terminal.c
index 01a021f5088..6d1108f009f 100644
--- a/usr.bin/telnet/terminal.c
+++ b/usr.bin/telnet/terminal.c
@@ -1,3 +1,6 @@
+/* $OpenBSD: terminal.c,v 1.2 1996/03/27 19:33:11 niklas Exp $ */
+/* $NetBSD: terminal.c,v 1.5 1996/02/28 21:04:17 thorpej Exp $ */
+
/*
* Copyright (c) 1988, 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,8 +35,12 @@
*/
#ifndef lint
-/* from: static char sccsid[] = "@(#)terminal.c 8.1 (Berkeley) 6/6/93"; */
-static char *rcsid = "$Id: terminal.c,v 1.1 1995/10/18 08:46:15 deraadt Exp $";
+#if 0
+static char sccsid[] = "@(#)terminal.c 8.2 (Berkeley) 2/16/95";
+static char rcsid[] = "$NetBSD: terminal.c,v 1.5 1996/02/28 21:04:17 thorpej Exp $";
+#else
+static char rcsid[] = "$OpenBSD: terminal.c,v 1.2 1996/03/27 19:33:11 niklas Exp $";
+#endif
#endif /* not lint */
#include <arpa/telnet.h>
@@ -141,7 +148,8 @@ ttyflush(drop)
n1 = n0 - n;
if (!drop)
n1 = TerminalWrite(ttyoring.bottom, n1);
- n += n1;
+ if (n1 > 0)
+ n += n1;
}
ring_consumed(&ttyoring, n);
}
diff --git a/usr.bin/telnet/tn3270.c b/usr.bin/telnet/tn3270.c
index c2a7f8c95f1..c170a993c0a 100644
--- a/usr.bin/telnet/tn3270.c
+++ b/usr.bin/telnet/tn3270.c
@@ -1,3 +1,6 @@
+/* $OpenBSD: tn3270.c,v 1.2 1996/03/27 19:33:12 niklas Exp $ */
+/* $NetBSD: tn3270.c,v 1.5 1996/02/28 21:04:18 thorpej Exp $ */
+
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,8 +35,12 @@
*/
#ifndef lint
-/* from: static char sccsid[] = "@(#)tn3270.c 8.1 (Berkeley) 6/6/93"; */
-static char *rcsid = "$Id: tn3270.c,v 1.1 1995/10/18 08:46:15 deraadt Exp $";
+#if 0
+static char sccsid[] = "@(#)tn3270.c 8.2 (Berkeley) 5/30/95";
+static char rcsid[] = "$NetBSD: tn3270.c,v 1.5 1996/02/28 21:04:18 thorpej Exp $";
+#else
+static char rcsid[] = "$OpenBSD: tn3270.c,v 1.2 1996/03/27 19:33:12 niklas Exp $";
+#endif
#endif /* not lint */
#include <sys/types.h>
@@ -243,7 +250,7 @@ Push3270()
if (save) {
if (Ifrontp+save > Ibuf+sizeof Ibuf) {
if (Ibackp != Ibuf) {
- memcpy(Ibuf, Ibackp, Ifrontp-Ibackp);
+ memmove(Ibuf, Ibackp, Ifrontp-Ibackp);
Ifrontp -= (Ibackp-Ibuf);
Ibackp = Ibuf;
}
diff --git a/usr.bin/telnet/types.h b/usr.bin/telnet/types.h
index 495eacd2852..d36b443ffd5 100644
--- a/usr.bin/telnet/types.h
+++ b/usr.bin/telnet/types.h
@@ -1,3 +1,6 @@
+/* $OpenBSD: types.h,v 1.2 1996/03/27 19:33:13 niklas Exp $ */
+/* $NetBSD: types.h,v 1.5 1996/02/28 21:04:20 thorpej Exp $ */
+
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -31,7 +34,6 @@
* SUCH DAMAGE.
*
* from: @(#)types.h 8.1 (Berkeley) 6/6/93
- * $Id: types.h,v 1.1 1995/10/18 08:46:15 deraadt Exp $
*/
typedef struct {
diff --git a/usr.bin/telnet/utilities.c b/usr.bin/telnet/utilities.c
index d9746124d2f..58df9e01285 100644
--- a/usr.bin/telnet/utilities.c
+++ b/usr.bin/telnet/utilities.c
@@ -1,3 +1,6 @@
+/* $OpenBSD: utilities.c,v 1.2 1996/03/27 19:33:15 niklas Exp $ */
+/* $NetBSD: utilities.c,v 1.5 1996/02/28 21:04:21 thorpej Exp $ */
+
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,8 +35,12 @@
*/
#ifndef lint
-/* from: static char sccsid[] = "@(#)utilities.c 8.1 (Berkeley) 6/6/93"; */
-static char *rcsid = "$Id: utilities.c,v 1.1 1995/10/18 08:46:15 deraadt Exp $";
+#if 0
+static char sccsid[] = "@(#)utilities.c 8.3 (Berkeley) 5/30/95";
+static char rcsid[] = "$NetBSD: utilities.c,v 1.5 1996/02/28 21:04:21 thorpej Exp $";
+#else
+static char rcsid[] = "$OpenBSD: utilities.c,v 1.2 1996/03/27 19:33:15 niklas Exp $";
+#endif
#endif /* not lint */
#define TELOPTS
@@ -524,7 +531,7 @@ printsub(direction, pointer, length)
break;
}
break;
-
+
case LM_SLC:
fprintf(NetTrace, "SLC");
for (i = 2; i < length - 2; i += 3) {
@@ -656,7 +663,7 @@ printsub(direction, pointer, length)
fprintf(NetTrace, "\n");
break;
-
+
default:
fprintf(NetTrace, " %d", pointer[i]);
break;
diff --git a/usr.bin/tip/remcap.c b/usr.bin/tip/remcap.c
deleted file mode 100644
index 151ad2eeef0..00000000000
--- a/usr.bin/tip/remcap.c
+++ /dev/null
@@ -1,432 +0,0 @@
-/* $NetBSD: remcap.c,v 1.5 1994/12/24 17:56:29 cgd Exp $ */
-
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)remcap.c 8.1 (Berkeley) 6/6/93";
-#endif
-static char rcsid[] = "$NetBSD: remcap.c,v 1.5 1994/12/24 17:56:29 cgd Exp $";
-#endif /* not lint */
-
-/*
- * remcap - routines for dealing with the remote host data base
- *
- * derived from termcap
- */
-#include <sys/types.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include "pathnames.h"
-
-#ifndef BUFSIZ
-#define BUFSIZ 1024
-#endif
-#define MAXHOP 32 /* max number of tc= indirections */
-
-#define tgetent rgetent
-#define tnchktc rnchktc
-#define tnamatch rnamatch
-#define tgetnum rgetnum
-#define tgetflag rgetflag
-#define tgetstr rgetstr
-#define E_TERMCAP RM = _PATH_REMOTE
-#define V_TERMCAP "REMOTE"
-#define V_TERM "HOST"
-
-char *RM;
-
-/*
- * termcap - routines for dealing with the terminal capability data base
- *
- * BUG: Should use a "last" pointer in tbuf, so that searching
- * for capabilities alphabetically would not be a n**2/2
- * process when large numbers of capabilities are given.
- * Note: If we add a last pointer now we will screw up the
- * tc capability. We really should compile termcap.
- *
- * Essentially all the work here is scanning and decoding escapes
- * in string capabilities. We don't use stdio because the editor
- * doesn't, and because living w/o it is not hard.
- */
-
-static char *tbuf;
-static int hopcount; /* detect infinite loops in termcap, init 0 */
-static char *tskip();
-static char *tdecode();
-char *tgetstr();
-static char *remotefile;
-
-/*
- * Get an entry for terminal name in buffer bp,
- * from the termcap file. Parse is very rudimentary;
- * we just notice escaped newlines.
- */
-tgetent(bp, name)
- char *bp, *name;
-{
- char lbuf[BUFSIZ], *cp, *p;
- int rc1, rc2;
-
- remotefile = cp = getenv(V_TERMCAP);
- if (cp == (char *)0 || strcmp(cp, _PATH_REMOTE) == 0) {
- remotefile = cp = _PATH_REMOTE;
- return (getent(bp, name, cp));
- } else {
- if ((rc1 = getent(bp, name, cp)) != 1)
- *bp = '\0';
- remotefile = cp = _PATH_REMOTE;
- rc2 = getent(lbuf, name, cp);
- if (rc1 != 1 && rc2 != 1)
- return (rc2);
- if (rc2 == 1) {
- p = lbuf;
- if (rc1 == 1)
- while (*p++ != ':')
- ;
- if (strlen(bp) + strlen(p) > BUFSIZ) {
- write(2, "Remcap entry too long\n", 23);
- return (-1);
- }
- strcat(bp, p);
- }
- tbuf = bp;
- return (1);
- }
-}
-
-getent(bp, name, cp)
- char *bp, *name, *cp;
-{
- register int c;
- register int i = 0, cnt = 0;
- char ibuf[BUFSIZ], *cp2;
- int tf;
-
- tbuf = bp;
- tf = 0;
- /*
- * TERMCAP can have one of two things in it. It can be the
- * name of a file to use instead of /etc/termcap. In this
- * case it better start with a "/". Or it can be an entry to
- * use so we don't have to read the file. In this case it
- * has to already have the newlines crunched out.
- */
- if (cp && *cp) {
- if (*cp!='/') {
- cp2 = getenv(V_TERM);
- if (cp2 == (char *)0 || strcmp(name,cp2) == 0) {
- strcpy(bp,cp);
- return (tnchktc());
- } else
- tf = open(E_TERMCAP, O_RDONLY);
- } else
- tf = open(RM = cp, O_RDONLY);
- }
- if (tf == 0)
- tf = open(E_TERMCAP, O_RDONLY);
- if (tf < 0)
- return (-1);
- for (;;) {
- cp = bp;
- for (;;) {
- if (i == cnt) {
- cnt = read(tf, ibuf, BUFSIZ);
- if (cnt <= 0) {
- close(tf);
- return (0);
- }
- i = 0;
- }
- c = ibuf[i++];
- if (c == '\n') {
- if (cp > bp && cp[-1] == '\\') {
- cp--;
- continue;
- }
- break;
- }
- if (cp >= bp+BUFSIZ) {
- write(2,"Remcap entry too long\n", 23);
- break;
- } else
- *cp++ = c;
- }
- *cp = 0;
-
- /*
- * The real work for the match.
- */
- if (tnamatch(name)) {
- close(tf);
- return (tnchktc());
- }
- }
-}
-
-/*
- * tnchktc: check the last entry, see if it's tc=xxx. If so,
- * recursively find xxx and append that entry (minus the names)
- * to take the place of the tc=xxx entry. This allows termcap
- * entries to say "like an HP2621 but doesn't turn on the labels".
- * Note that this works because of the left to right scan.
- */
-tnchktc()
-{
- register char *p, *q;
- char tcname[16]; /* name of similar terminal */
- char tcbuf[BUFSIZ];
- char *holdtbuf = tbuf;
- int l;
- char *cp;
-
- p = tbuf + strlen(tbuf) - 2; /* before the last colon */
- while (*--p != ':')
- if (p<tbuf) {
- write(2, "Bad remcap entry\n", 18);
- return (0);
- }
- p++;
- /* p now points to beginning of last field */
- if (p[0] != 't' || p[1] != 'c')
- return (1);
- strcpy(tcname, p+3);
- q = tcname;
- while (*q && *q != ':')
- q++;
- *q = 0;
- if (++hopcount > MAXHOP) {
- write(2, "Infinite tc= loop\n", 18);
- return (0);
- }
- if (getent(tcbuf, tcname, remotefile) != 1) {
- if (strcmp(remotefile, _PATH_REMOTE) == 0)
- return (0);
- else if (getent(tcbuf, tcname, _PATH_REMOTE) != 1)
- return (0);
- }
- for (q = tcbuf; *q++ != ':'; )
- ;
- l = p - holdtbuf + strlen(q);
- if (l > BUFSIZ) {
- write(2, "Remcap entry too long\n", 23);
- q[BUFSIZ - (p-holdtbuf)] = 0;
- }
- strcpy(p, q);
- tbuf = holdtbuf;
- return (1);
-}
-
-/*
- * Tnamatch deals with name matching. The first field of the termcap
- * entry is a sequence of names separated by |'s, so we compare
- * against each such name. The normal : terminator after the last
- * name (before the first field) stops us.
- */
-tnamatch(np)
- char *np;
-{
- register char *Np, *Bp;
-
- Bp = tbuf;
- if (*Bp == '#')
- return (0);
- for (;;) {
- for (Np = np; *Np && *Bp == *Np; Bp++, Np++)
- continue;
- if (*Np == 0 && (*Bp == '|' || *Bp == ':' || *Bp == 0))
- return (1);
- while (*Bp && *Bp != ':' && *Bp != '|')
- Bp++;
- if (*Bp == 0 || *Bp == ':')
- return (0);
- Bp++;
- }
-}
-
-/*
- * Skip to the next field. Notice that this is very dumb, not
- * knowing about \: escapes or any such. If necessary, :'s can be put
- * into the termcap file in octal.
- */
-static char *
-tskip(bp)
- register char *bp;
-{
-
- while (*bp && *bp != ':')
- bp++;
- if (*bp == ':')
- bp++;
- return (bp);
-}
-
-/*
- * Return the (numeric) option id.
- * Numeric options look like
- * li#80
- * i.e. the option string is separated from the numeric value by
- * a # character. If the option is not found we return -1.
- * Note that we handle octal numbers beginning with 0.
- */
-tgetnum(id)
- char *id;
-{
- register int i, base;
- register char *bp = tbuf;
-
- for (;;) {
- bp = tskip(bp);
- if (*bp == 0)
- return (-1);
- if (*bp++ != id[0] || *bp == 0 || *bp++ != id[1])
- continue;
- if (*bp == '@')
- return (-1);
- if (*bp != '#')
- continue;
- bp++;
- base = 10;
- if (*bp == '0')
- base = 8;
- i = 0;
- while (isdigit(*bp))
- i *= base, i += *bp++ - '0';
- return (i);
- }
-}
-
-/*
- * Handle a flag option.
- * Flag options are given "naked", i.e. followed by a : or the end
- * of the buffer. Return 1 if we find the option, or 0 if it is
- * not given.
- */
-tgetflag(id)
- char *id;
-{
- register char *bp = tbuf;
-
- for (;;) {
- bp = tskip(bp);
- if (!*bp)
- return (0);
- if (*bp++ == id[0] && *bp != 0 && *bp++ == id[1]) {
- if (!*bp || *bp == ':')
- return (1);
- else if (*bp == '@')
- return (0);
- }
- }
-}
-
-/*
- * Get a string valued option.
- * These are given as
- * cl=^Z
- * Much decoding is done on the strings, and the strings are
- * placed in area, which is a ref parameter which is updated.
- * No checking on area overflow.
- */
-char *
-tgetstr(id, area)
- char *id, **area;
-{
- register char *bp = tbuf;
-
- for (;;) {
- bp = tskip(bp);
- if (!*bp)
- return (0);
- if (*bp++ != id[0] || *bp == 0 || *bp++ != id[1])
- continue;
- if (*bp == '@')
- return (0);
- if (*bp != '=')
- continue;
- bp++;
- return (tdecode(bp, area));
- }
-}
-
-/*
- * Tdecode does the grung work to decode the
- * string capability escapes.
- */
-static char *
-tdecode(str, area)
- register char *str;
- char **area;
-{
- register char *cp;
- register int c;
- register char *dp;
- int i;
-
- cp = *area;
- while ((c = *str++) && c != ':') {
- switch (c) {
-
- case '^':
- c = *str++ & 037;
- break;
-
- case '\\':
- dp = "E\033^^\\\\::n\nr\rt\tb\bf\f";
- c = *str++;
-nextc:
- if (*dp++ == c) {
- c = *dp++;
- break;
- }
- dp++;
- if (*dp)
- goto nextc;
- if (isdigit(c)) {
- c -= '0', i = 2;
- do
- c <<= 3, c |= *str++ - '0';
- while (--i && isdigit(*str));
- }
- break;
- }
- *cp++ = c;
- }
- *cp++ = 0;
- str = *area;
- *area = cp;
- return (str);
-}
diff --git a/usr.bin/yacc/defs.h b/usr.bin/yacc/defs.h
index 4772d37c490..440f820ba8f 100644
--- a/usr.bin/yacc/defs.h
+++ b/usr.bin/yacc/defs.h
@@ -1,4 +1,4 @@
-/* $Id: defs.h,v 1.2 1996/02/04 08:37:00 etheisen Exp $ */
+/* $OpenBSD: defs.h,v 1.3 1996/03/27 19:33:18 niklas Exp $ */
#include <assert.h>
#include <ctype.h>
diff --git a/usr.bin/yacc/reader.c b/usr.bin/yacc/reader.c
index f4c0de4df35..e3367fa6569 100644
--- a/usr.bin/yacc/reader.c
+++ b/usr.bin/yacc/reader.c
@@ -1,5 +1,7 @@
+/* $OpenBSD: reader.c,v 1.3 1996/03/27 19:33:19 niklas Exp $ */
+
#ifndef lint
-static char rcsid[] = "$Id: reader.c,v 1.2 1996/02/04 08:37:02 etheisen Exp $";
+static char rcsid[] = "$OpenBSD: reader.c,v 1.3 1996/03/27 19:33:19 niklas Exp $";
#endif /* not lint */
#include "defs.h"
@@ -892,50 +894,6 @@ int assoc;
}
-/*
- * %expect requires special handling
- * as it really isn't part of the yacc
- * grammar only a flag for yacc proper.
- */
-declare_expect(assoc)
-int assoc;
-{
- register int c;
-
- if (assoc != EXPECT) ++prec;
-
- /*
- * Stay away from nextc - doesn't
- * detect EOL and will read to EOF.
- */
- c = *++cptr;
- if (c == EOF) unexpected_EOF();
-
- for(;;)
- {
- if (isdigit(c))
- {
- SRexpect = get_number();
- break;
- }
- /*
- * Looking for number before EOL.
- * Spaces, tabs, and numbers are ok,
- * words, punc., etc. are syntax errors.
- */
- else if (c == '\n' || isalpha(c) || !isspace(c))
- {
- syntax_error(lineno, line, cptr);
- }
- else
- {
- c = *++cptr;
- if (c == EOF) unexpected_EOF();
- }
- }
-}
-
-
declare_types()
{
register int c;
@@ -981,6 +939,23 @@ declare_start()
goal = bp;
}
+handle_expect()
+{
+ register int c;
+ register int num;
+
+ c = nextc();
+ if (c == EOF) unexpected_EOF();
+ if (!isdigit(c))
+ syntax_error(lineno, line, cptr);
+ num = get_number();
+ if (num == 1)
+ fprintf (stderr, "%s: Expect 1 shift/reduce conflict.\n", myname);
+ else
+ fprintf (stderr, "%s: Expect %d shift/reduce conflicts.\n", myname,
+ num);
+}
+
read_declarations()
{
@@ -1019,10 +994,6 @@ read_declarations()
declare_tokens(k);
break;
- case EXPECT:
- declare_expect(k);
- break;
-
case TYPE:
declare_types();
break;
@@ -1030,6 +1001,10 @@ read_declarations()
case START:
declare_start();
break;
+
+ case EXPECT:
+ handle_expect();
+ break;
}
}
}
diff --git a/usr.bin/yacc/skeleton.c b/usr.bin/yacc/skeleton.c
index 387f0437c92..7fa773f16a1 100644
--- a/usr.bin/yacc/skeleton.c
+++ b/usr.bin/yacc/skeleton.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: skeleton.c,v 1.3 1996/03/27 19:33:21 niklas Exp $ */
+
#include "defs.h"
/* The definition of yysccsid in the banner should be replaced with */
@@ -16,7 +18,7 @@ char *banner[] =
{
"#ifndef lint",
"/*static char yysccsid[] = \"from: @(#)yaccpar 1.9 (Berkeley) 02/21/93\";*/",
- "static char yyrcsid[] = \"$Id: skeleton.c,v 1.2 1995/12/22 01:41:55 niklas Exp $\";",
+ "static char yyrcsid[] = \"$OpenBSD: skeleton.c,v 1.3 1996/03/27 19:33:21 niklas Exp $\";",
"#endif",
"#define YYBYACC 1",
"#define YYMAJOR 1",