diff options
| author | Jordan K. Hubbard <jkh@FreeBSD.org> | 1998-07-17 04:21:57 +0000 |
|---|---|---|
| committer | Jordan K. Hubbard <jkh@FreeBSD.org> | 1998-07-17 04:21:57 +0000 |
| commit | 3d2b5d3d9b22eaf88c8bed2cae02ac8811923614 (patch) | |
| tree | c9ac43c48ba137f19b127e63dd3afe8ad7ae6523 /usr.bin | |
| parent | e3c0ee2101808536b97cdf4749bd1c352d49b31a (diff) | |
Notes
Diffstat (limited to 'usr.bin')
68 files changed, 467 insertions, 325 deletions
diff --git a/usr.bin/finger/net.c b/usr.bin/finger/net.c index aa07577deb95..afb5e6d6a48a 100644 --- a/usr.bin/finger/net.c +++ b/usr.bin/finger/net.c @@ -39,11 +39,12 @@ static char sccsid[] = "@(#)net.c 8.4 (Berkeley) 4/28/95"; #else static const char rcsid[] = - "$Id: net.c,v 1.6.2.2 1997/08/03 19:23:28 peter Exp $"; + "$Id: net.c,v 1.6.2.3 1998/03/08 09:08:11 jkh Exp $"; #endif #endif /* not lint */ #include <sys/types.h> +#include <sys/param.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> @@ -96,7 +97,7 @@ netfinger(name) return; } sin.sin_family = hp->h_addrtype; - bcopy(hp->h_addr, (char *)&sin.sin_addr, hp->h_length); + bcopy(hp->h_addr, (char *)&sin.sin_addr, MIN(hp->h_length,sizeof(sin.sin_addr))); sin.sin_port = sp->s_port; if ((s = socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0) { perror("finger: socket"); diff --git a/usr.bin/fsplit/fsplit.1 b/usr.bin/fsplit/fsplit.1 index 249449518969..760bcc5dae9a 100644 --- a/usr.bin/fsplit/fsplit.1 +++ b/usr.bin/fsplit/fsplit.1 @@ -85,17 +85,19 @@ option are not found, a diagnostic is written to standard error. .Sh HISTORY The -.Nm fsplit +.Nm command appeared in .Bx 4.2 . .Sh AUTHORS -Asa Romberger and Jerry Berkman +.An Asa Romberger +and +.An Jerry Berkman .Sh BUGS .Nm Fsplit assumes the subprogram name is on the first noncomment line of the subprogram unit. Nonstandard source formats may confuse -.Nm fsplit . +.Nm Ns . .Pp It is hard to use .Fl e diff --git a/usr.bin/fsplit/fsplit.c b/usr.bin/fsplit/fsplit.c index 73a2b349e6e9..cffc74295335 100644 --- a/usr.bin/fsplit/fsplit.c +++ b/usr.bin/fsplit/fsplit.c @@ -45,12 +45,13 @@ static const char copyright[] = static char sccsid[] = "@(#)fsplit.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id$"; + "$Id: fsplit.c,v 1.2.6.1 1997/07/10 06:34:54 charnier Exp $"; #endif /* not lint */ #include <ctype.h> #include <err.h> #include <stdio.h> +#include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c index efc1ee2ded1e..0127646353ef 100644 --- a/usr.bin/fstat/fstat.c +++ b/usr.bin/fstat/fstat.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)fstat.c 8.3 (Berkeley) 5/2/95"; #endif static const char rcsid[] = - "$Id: fstat.c,v 1.7.2.4 1997/09/18 23:19:00 dima Exp $"; + "$Id: fstat.c,v 1.7.2.5 1998/03/08 09:14:38 jkh Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -55,6 +55,7 @@ static const char rcsid[] = #include <sys/socketvar.h> #include <sys/domain.h> #include <sys/protosw.h> +#include <sys/un.h> #include <sys/unpcb.h> #include <sys/sysctl.h> #include <sys/filedesc.h> @@ -308,8 +309,8 @@ dofiles(kp) if (p->p_fd == NULL) return; if (!KVM_READ(p->p_fd, &filed0, sizeof (filed0))) { - dprintf(stderr, "can't read filedesc at %x for pid %d\n", - p->p_fd, Pid); + dprintf(stderr, "can't read filedesc at %p for pid %d\n", + (void *)p->p_fd, Pid); return; } /* @@ -340,8 +341,8 @@ dofiles(kp) if (!KVM_READ(filed.fd_ofiles, ofiles, (filed.fd_lastfile+1) * FPSIZE)) { dprintf(stderr, - "can't read file structures at %x for pid %d\n", - filed.fd_ofiles, Pid); + "can't read file structures at %p for pid %d\n", + (void *)filed.fd_ofiles, Pid); return; } } else @@ -350,8 +351,8 @@ dofiles(kp) if (ofiles[i] == NULL) continue; if (!KVM_READ(ofiles[i], &file, sizeof (struct file))) { - dprintf(stderr, "can't read file %d at %x for pid %d\n", - i, ofiles[i], Pid); + dprintf(stderr, "can't read file %d at %p for pid %d\n", + i, (void *)ofiles[i], Pid); continue; } if (file.f_type == DTYPE_VNODE) @@ -388,8 +389,8 @@ vtrans(vp, i, flag) filename = badtype = NULL; if (!KVM_READ(vp, &vn, sizeof (struct vnode))) { - dprintf(stderr, "can't read vnode at %x for pid %d\n", - vp, Pid); + dprintf(stderr, "can't read vnode at %p for pid %d\n", + (void *)vp, Pid); return; } if (vn.v_type == VNON || vn.v_tag == VT_NON) @@ -446,7 +447,7 @@ vtrans(vp, i, flag) (void)sprintf(mode, "%o", fst.mode); else strmode(fst.mode, mode); - (void)printf(" %6d %10s", fst.fileid, mode); + (void)printf(" %6ld %10s", fst.fileid, mode); switch (vn.v_type) { case VBLK: case VCHR: { @@ -481,8 +482,8 @@ ufs_filestat(vp, fsp) struct inode inode; if (!KVM_READ(VTOI(vp), &inode, sizeof (inode))) { - dprintf(stderr, "can't read inode at %x for pid %d\n", - VTOI(vp), Pid); + dprintf(stderr, "can't read inode at %p for pid %d\n", + (void *)VTOI(vp), Pid); return 0; } fsp->fsid = inode.i_dev & 0xffff; @@ -503,8 +504,8 @@ nfs_filestat(vp, fsp) register mode_t mode; if (!KVM_READ(VTONFS(vp), &nfsnode, sizeof (nfsnode))) { - dprintf(stderr, "can't read nfsnode at %x for pid %d\n", - VTONFS(vp), Pid); + dprintf(stderr, "can't read nfsnode at %p for pid %d\n", + (void *)VTONFS(vp), Pid); return 0; } fsp->fsid = nfsnode.n_vattr.va_fsid; @@ -557,7 +558,7 @@ getmnton(m) if (m == mt->m) return (mt->mntonname); if (!KVM_READ(m, &mount, sizeof(struct mount))) { - warnx("can't read mount table at %x", m); + warnx("can't read mount table at %p", (void *)m); return (NULL); } if ((mt = malloc(sizeof (struct mtab))) == NULL) @@ -582,7 +583,7 @@ pipetrans(pi, i, flag) /* fill in socket */ if (!KVM_READ(pi, &pip, sizeof(struct pipe))) { - dprintf(stderr, "can't read pipe at %x\n", pi); + dprintf(stderr, "can't read pipe at %p\n", (void *)pi); goto bad; } @@ -627,26 +628,28 @@ socktrans(sock, i) /* fill in socket */ if (!KVM_READ(sock, &so, sizeof(struct socket))) { - dprintf(stderr, "can't read sock at %x\n", sock); + dprintf(stderr, "can't read sock at %p\n", (void *)sock); goto bad; } /* fill in protosw entry */ if (!KVM_READ(so.so_proto, &proto, sizeof(struct protosw))) { - dprintf(stderr, "can't read protosw at %x", so.so_proto); + dprintf(stderr, "can't read protosw at %p", + (void *)so.so_proto); goto bad; } /* fill in domain */ if (!KVM_READ(proto.pr_domain, &dom, sizeof(struct domain))) { - dprintf(stderr, "can't read domain at %x\n", proto.pr_domain); + dprintf(stderr, "can't read domain at %p\n", + (void *)proto.pr_domain); goto bad; } if ((len = kvm_read(kd, (u_long)dom.dom_name, dname, sizeof(dname) - 1)) < 0) { - dprintf(stderr, "can't read domain name at %x\n", - dom.dom_name); + dprintf(stderr, "can't read domain name at %p\n", + (void *)dom.dom_name); dname[0] = '\0'; } else @@ -677,8 +680,8 @@ socktrans(sock, i) (char *)&inpcb, sizeof(struct inpcb)) != sizeof(struct inpcb)) { dprintf(stderr, - "can't read inpcb at %x\n", - so.so_pcb); + "can't read inpcb at %p\n", + (void *)so.so_pcb); goto bad; } printf(" %x", (int)inpcb.inp_ppcb); @@ -693,8 +696,8 @@ socktrans(sock, i) printf(" %x", (int)so.so_pcb); if (kvm_read(kd, (u_long)so.so_pcb, (char *)&unpcb, sizeof(struct unpcb)) != sizeof(struct unpcb)){ - dprintf(stderr, "can't read unpcb at %x\n", - so.so_pcb); + dprintf(stderr, "can't read unpcb at %p\n", + (void *)so.so_pcb); goto bad; } if (unpcb.unp_conn) { diff --git a/usr.bin/ftp/ftp.c b/usr.bin/ftp/ftp.c index 1d9b12f84f9c..79a659c0bb48 100644 --- a/usr.bin/ftp/ftp.c +++ b/usr.bin/ftp/ftp.c @@ -1,4 +1,4 @@ -/* $Id: ftp.c,v 1.12 1997/12/16 08:22:37 ache Exp $ */ +/* $Id: ftp.c,v 1.8.2.2 1998/01/28 02:27:57 msmith Exp $ */ /* $NetBSD: ftp.c,v 1.29.2.1 1997/11/18 01:01:04 mellon Exp $ */ /* @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)ftp.c 8.6 (Berkeley) 10/27/94"; #else -__RCSID("$Id: ftp.c,v 1.12 1997/12/16 08:22:37 ache Exp $"); +__RCSID("$Id: ftp.c,v 1.8.2.2 1998/01/28 02:27:57 msmith Exp $"); __RCSID_SOURCE("$NetBSD: ftp.c,v 1.29.2.1 1997/11/18 01:01:04 mellon Exp $"); #endif #endif /* not lint */ @@ -95,8 +95,7 @@ hookup(host, port) memset((void *)&hisctladdr, 0, sizeof(hisctladdr)); if (inet_aton(host, &hisctladdr.sin_addr) != 0) { hisctladdr.sin_family = AF_INET; - (void)strncpy(hostnamebuf, host, sizeof(hostnamebuf) - 1); - hostnamebuf[sizeof(hostnamebuf) - 1] = '\0'; + (void) strncpy(hostnamebuf, host, sizeof(hostnamebuf)); } else { hp = gethostbyname(host); if (hp == NULL) { @@ -105,10 +104,11 @@ hookup(host, port) return ((char *) 0); } hisctladdr.sin_family = hp->h_addrtype; - memcpy(&hisctladdr.sin_addr, hp->h_addr, hp->h_length); - (void)strncpy(hostnamebuf, hp->h_name, sizeof(hostnamebuf) - 1); - hostnamebuf[sizeof(hostnamebuf) - 1] = '\0'; + memcpy(&hisctladdr.sin_addr, hp->h_addr_list[0], + MIN(hp->h_length,sizeof(hisctladdr.sin_addr))); + (void) strncpy(hostnamebuf, hp->h_name, sizeof(hostnamebuf)); } + hostnamebuf[sizeof(hostnamebuf) - 1] = '\0'; hostname = hostnamebuf; s = socket(hisctladdr.sin_family, SOCK_STREAM, 0); if (s < 0) { @@ -127,7 +127,8 @@ hookup(host, port) errno = oerrno; warn("connect to address %s", ia); hp->h_addr_list++; - memcpy(&hisctladdr.sin_addr, hp->h_addr, hp->h_length); + memcpy(&hisctladdr.sin_addr, hp->h_addr_list[0], + MIN(hp->h_length,sizeof(hisctladdr.sin_addr))); printf("Trying %s...\n", inet_ntoa(hisctladdr.sin_addr)); (void)close(s); diff --git a/usr.bin/gencat/genlib.c b/usr.bin/gencat/genlib.c index b1179afe9740..a6321cb40982 100644 --- a/usr.bin/gencat/genlib.c +++ b/usr.bin/gencat/genlib.c @@ -147,29 +147,29 @@ char *cptr; static char tok[MAXTOKEN+1]; char *tptr = tok; - while (*cptr && isspace(*cptr)) ++cptr; - while (*cptr && !isspace(*cptr)) *tptr++ = *cptr++; + while (*cptr && isspace((unsigned char)*cptr)) ++cptr; + while (*cptr && !isspace((unsigned char)*cptr)) *tptr++ = *cptr++; *tptr = '\0'; return(tok); } static char *wskip(cptr) char *cptr; { - if (!*cptr || !isspace(*cptr)) { + if (!*cptr || !isspace((unsigned char)*cptr)) { warning(cptr, "expected a space"); return(cptr); } - while (*cptr && isspace(*cptr)) ++cptr; + while (*cptr && isspace((unsigned char)*cptr)) ++cptr; return(cptr); } static char *cskip(cptr) char *cptr; { - if (!*cptr || isspace(*cptr)) { + if (!*cptr || isspace((unsigned char)*cptr)) { warning(cptr, "wasn't expecting a space"); return(cptr); } - while (*cptr && !isspace(*cptr)) ++cptr; + while (*cptr && !isspace((unsigned char)*cptr)) ++cptr; return(cptr); } @@ -202,7 +202,7 @@ char quote; if (quote && *cptr == quote) { char *tmp; tmp = cptr+1; - if (*tmp && (!isspace(*tmp) || *wskip(tmp))) { + if (*tmp && (!isspace((unsigned char)*tmp) || *wskip(tmp))) { warning(cptr, "unexpected quote character, ignoreing"); *tptr++ = *cptr++; } else { @@ -256,10 +256,10 @@ char quote; ++cptr; break; default: - if (isdigit(*cptr)) { + if (isdigit((unsigned char)*cptr)) { *tptr = 0; for (i = 0; i < 3; ++i) { - if (!isdigit(*cptr)) break; + if (!isdigit((unsigned char)*cptr)) break; if (*cptr > '7') warning(cptr, "octal number greater than 7?!"); *tptr *= 8; *tptr += (*cptr - '0'); @@ -378,7 +378,7 @@ int fd; if (!*cptr) quote = 0; else quote = *cptr; } - } else if (isspace(*cptr)) { + } else if (isspace((unsigned char)*cptr)) { cptr = wskip(cptr); if (*cptr == '#') { ++cptr; @@ -391,7 +391,7 @@ int fd; } } } else { - if (isdigit(*cptr) || *cptr == '#') { + if (isdigit((unsigned char)*cptr) || *cptr == '#') { if (*cptr == '#') { ++msgid; ++cptr; @@ -400,7 +400,7 @@ int fd; hconst[0] = '\0'; continue; } - if (!isspace(*cptr)) warning(cptr, "expected a space"); + if (!isspace((unsigned char)*cptr)) warning(cptr, "expected a space"); ++cptr; if (!*cptr) { MCAddMsg(msgid, "", hconst); diff --git a/usr.bin/global/systags/Makefile b/usr.bin/global/systags/Makefile index 1714e3219abf..da6c4f35c137 100644 --- a/usr.bin/global/systags/Makefile +++ b/usr.bin/global/systags/Makefile @@ -1,8 +1,10 @@ -# $Id: Makefile,v 1.3 1997/12/15 23:34:57 cwt Exp $ +# $Id: Makefile,v 1.1.1.1.2.1 1998/02/05 04:53:30 cwt Exp $ GLOBAL_DIR= ${.CURDIR}/../../../contrib/global .PATH: ${GLOBAL_DIR}/systags +NOOBJ= + beforeinstall: ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ ${GLOBAL_DIR}/systags/systags.sh ${DESTDIR}${BINDIR}/systags diff --git a/usr.bin/indent/lexi.c b/usr.bin/indent/lexi.c index 69f24319acd1..7a0929f13682 100644 --- a/usr.bin/indent/lexi.c +++ b/usr.bin/indent/lexi.c @@ -152,7 +152,8 @@ lexi() if (isdigit(*buf_ptr) || buf_ptr[0] == '.' && isdigit(buf_ptr[1])) { int seendot = 0, - seenexp = 0; + seenexp = 0, + seensfx = 0; if (*buf_ptr == '0' && (buf_ptr[1] == 'x' || buf_ptr[1] == 'X')) { *e_token++ = *buf_ptr++; @@ -183,8 +184,25 @@ lexi() *e_token++ = *buf_ptr++; } } - if (*buf_ptr == 'L' || *buf_ptr == 'l') - *e_token++ = *buf_ptr++; + while (1) { + if (!(seensfx & 1) && + (*buf_ptr == 'U' || *buf_ptr == 'u')) { + CHECK_SIZE_TOKEN; + *e_token++ = *buf_ptr++; + seensfx |= 1; + continue; + } + if (!(seensfx & 2) && + (*buf_ptr == 'L' || *buf_ptr == 'l')) { + CHECK_SIZE_TOKEN; + if (buf_ptr[1] == buf_ptr[0]) + *e_token++ = *buf_ptr++; + *e_token++ = *buf_ptr++; + seensfx |= 2; + continue; + } + break; + } } else while (chartype[*buf_ptr] == alphanum) { /* copy it over */ diff --git a/usr.bin/ipcs/ipcs.1 b/usr.bin/ipcs/ipcs.1 index 65dd1c1a44a1..f4f7b1679c37 100644 --- a/usr.bin/ipcs/ipcs.1 +++ b/usr.bin/ipcs/ipcs.1 @@ -27,7 +27,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: ipcs.1,v 1.3.2.1 1997/07/16 06:44:26 charnier Exp $ +.\" $Id: ipcs.1,v 1.3.2.2 1997/09/15 08:32:02 jkh Exp $ .\" .Dd June 18, 1994 .Dt "IPCS" 1 @@ -145,7 +145,5 @@ default system name list .El .Sh SEE ALSO .Xr ipcrm 1 -.Sh AUTHOR -.Bl -tag -Thorsten Lockert <tholo@sigmasoft.com> -.El +.Sh AUTHORS +.An Thorsten Lockert Aq tholo@sigmasoft.com diff --git a/usr.bin/key/key.1 b/usr.bin/key/key.1 index aaeadd8dfe70..4b02916fb00d 100644 --- a/usr.bin/key/key.1 +++ b/usr.bin/key/key.1 @@ -1,5 +1,5 @@ .\" from: @(#)key.1 1.0 (Bellcore) 12/2/91 -.\" $Id$ +.\" $Id: key.1,v 1.2.2.1 1997/07/17 06:39:15 charnier Exp $ .\" .Dd December 2, 1991 .Dt KEY 1 @@ -42,7 +42,10 @@ The default is one. .Xr keyinit 1 , .Xr skey 1 .\" .BR keysu(1), -.Sh AUTHOR -Command by Phil Karn, Neil M. Haller, John S. Walden +.Sh AUTHORS +Command by +.An Phil Karn , +.An Neil M. Haller , +.An John S. Walden .Sh CONTACT -staff@thumper.bellcore.com +.Aq staff@thumper.bellcore.com diff --git a/usr.bin/keyinfo/keyinfo.1 b/usr.bin/keyinfo/keyinfo.1 index 837a1b8ce0d0..e44628885cdb 100644 --- a/usr.bin/keyinfo/keyinfo.1 +++ b/usr.bin/keyinfo/keyinfo.1 @@ -1,5 +1,5 @@ .\" from: @(#)keyinfo.1 1.1 (Bellcore) 7/20/93 -.\" $Id: keyinfo.1,v 1.2 1996/04/26 21:35:07 joerg Exp $ +.\" $Id: keyinfo.1,v 1.2.2.1 1997/07/17 06:40:14 charnier Exp $ .\" .Dd April 26, 1996 .Dt KEYINFO 1 @@ -41,8 +41,11 @@ else with status 1. .Sh SEE ALSO .Xr key 1 , .Xr keyinit 1 -.Sh AUTHOR -Original command by Phil Karn, Neil M. Haller, John S. Walden. +.Sh AUTHORS +Original command by +.An Phil Karn , +.An Neil M. Haller , +.An John S. Walden . Rewritten in Perl by .ie t J\(:org \%Wunsch .el Joerg Wunsch diff --git a/usr.bin/keyinit/keyinit.1 b/usr.bin/keyinit/keyinit.1 index 31cd25402f3d..4652289926f3 100644 --- a/usr.bin/keyinit/keyinit.1 +++ b/usr.bin/keyinit/keyinit.1 @@ -78,5 +78,8 @@ data base of information for S/Key system. .Xr keyinfo 1 , .Xr skey 1 , .Xr su 1 -.Sh AUTHOR -Command by Phil Karn, Neil M. Haller, John S. Walden +.Sh AUTHORS +Command by +.An Phil Karn , +.An Neil M. Haller , +.An John S. Walden diff --git a/usr.bin/killall/killall.1 b/usr.bin/killall/killall.1 index 874064d640a4..dd2faeb6cc6b 100644 --- a/usr.bin/killall/killall.1 +++ b/usr.bin/killall/killall.1 @@ -22,7 +22,7 @@ .\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: killall.1,v 1.6 1996/08/27 20:04:19 wosch Exp $ +.\" $Id: killall.1,v 1.6.2.1 1997/11/01 15:11:46 wosch Exp $ .\" .Dd June 25, 1995 .Os FreeBSD 2.2 @@ -118,7 +118,7 @@ Diagnostic messages will only be printed if requested by options. .Sh SEE ALSO .Xr kill 1 , -.Xr procfs 5 . +.Xr procfs 5 .Sh HISTORY The .Nm @@ -127,8 +127,9 @@ command appeared in It has been modeled after the .Nm command as available on other platforms. -.Sh AUTHOR -The program has been contributed by Wolfram Schneider, this manual -page has been written by +.Sh AUTHORS +The program has been contributed by +.An Wolfram Schneider , +this manual page has been written by .if n Joerg Wunsch. .if t J\(:org Wunsch. diff --git a/usr.bin/kzip/kzip.8 b/usr.bin/kzip/kzip.8 index 24ca98f844db..2c2c2e11bfcd 100644 --- a/usr.bin/kzip/kzip.8 +++ b/usr.bin/kzip/kzip.8 @@ -23,7 +23,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: kzip.8,v 1.1 1996/08/21 19:07:22 mpp Exp $ +.\" $Id: kzip.8,v 1.1.2.1 1997/07/21 11:56:34 charnier Exp $ .\" .Dd August 15, 1996 .Os @@ -69,5 +69,6 @@ command appeared in Obtained from Linux via 386BSD -- based on tools/build.c by Linus Torvalds, and ported to 386BSD by Serge Vakulenko. .Sh AUTHORS -This man page was written by David E. O'Brien. +This man page was written by +.An David E. O'Brien . .\" .Sh BUGS diff --git a/usr.bin/last/last.c b/usr.bin/last/last.c index 48791f84d74a..6ad6f3b2004d 100644 --- a/usr.bin/last/last.c +++ b/usr.bin/last/last.c @@ -75,7 +75,7 @@ ARG *arglist; /* head of linked list */ LIST_HEAD(ttylisthead, ttytab) ttylist; struct ttytab { - long logout; /* log out time */ + time_t logout; /* log out time */ char tty[UT_LINESIZE + 1]; /* terminal name */ LIST_ENTRY(ttytab) list; }; @@ -180,7 +180,8 @@ wtmp() struct utmp *bp; /* current structure */ struct ttytab *tt, *ttx; /* ttylist entry */ struct stat stb; /* stat of file for size */ - long bl, delta; /* time difference */ + long bl; + time_t delta; /* time difference */ int bytes, wfd; char *crmsg; char ct[80]; @@ -319,8 +320,8 @@ wtmp() } } tm = localtime(&buf[0].ut_time); - (void) strftime(ct, sizeof(ct), "%c", tm); - printf("\nwtmp begins %10.10s %5.5s \n", ct, ct + 11); + (void) strftime(ct, sizeof(ct), "\nwtmp begins %c\n", tm); + printf(ct); } /* diff --git a/usr.bin/limits/limits.1 b/usr.bin/limits/limits.1 index 90599a313597..20ce6f92f1b3 100644 --- a/usr.bin/limits/limits.1 +++ b/usr.bin/limits/limits.1 @@ -17,7 +17,7 @@ .\" 5. Modifications may be freely made to this file providing the above .\" conditions are met. .\" -.\" $Id: limits.1,v 1.2.2.4 1998/03/08 09:22:01 jkh Exp $ +.\" $Id: limits.1,v 1.2.2.5 1998/05/08 14:49:24 max Exp $ .\" .Dd January 15, 1996 .Dt LIMITS 1 @@ -168,7 +168,7 @@ flags. Selects "eval mode" formatting for output. This is valid only on display mode and cannot be used when running a command. -The exact syntax used for output depeneds upon the type of shell from +The exact syntax used for output depends upon the type of shell from which .Nm limits is invoked. @@ -226,7 +226,7 @@ megabytes (1024*1024 bytes). .It g gigabytes. .It t -terrabytes. +terabytes. .El .Pp The diff --git a/usr.bin/locate/bigram/Makefile b/usr.bin/locate/bigram/Makefile index fbba14d1a10c..bcb016e24a7f 100644 --- a/usr.bin/locate/bigram/Makefile +++ b/usr.bin/locate/bigram/Makefile @@ -1,9 +1,9 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 +# $Id$ PROG= locate.bigram NOMAN= noman BINDIR= ${LIBEXECDIR} CFLAGS+= -I${.CURDIR}/../locate -.include "../Makefile.inc" .include <bsd.prog.mk> diff --git a/usr.bin/locate/code/Makefile b/usr.bin/locate/code/Makefile index a7d8e80ef5bc..7e4c4fd573fe 100644 --- a/usr.bin/locate/code/Makefile +++ b/usr.bin/locate/code/Makefile @@ -1,9 +1,9 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 +# $Id$ PROG= locate.code CFLAGS+=-I${.CURDIR}/../locate NOMAN= noman BINDIR= ${LIBEXECDIR} -.include "../Makefile.inc" .include <bsd.prog.mk> diff --git a/usr.bin/locate/code/locate.code.c b/usr.bin/locate/code/locate.code.c index 93b4e68497c2..8ac4aef9e935 100644 --- a/usr.bin/locate/code/locate.code.c +++ b/usr.bin/locate/code/locate.code.c @@ -34,7 +34,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: locate.code.c,v 1.7 1996/10/27 19:04:27 wosch Exp $ + * $Id: locate.code.c,v 1.7.2.1 1997/08/29 05:29:28 imp Exp $ */ #ifndef lint @@ -132,7 +132,7 @@ main(argc, argv) FILE *fp; register int i, j; - while ((ch = getopt(argc, argv, "")) != -1) + while ((ch = getopt(argc, argv, "")) != -1) switch(ch) { default: usage(); diff --git a/usr.bin/locate/locate/Makefile b/usr.bin/locate/locate/Makefile index b752bbbf17f9..e90d6286901e 100644 --- a/usr.bin/locate/locate/Makefile +++ b/usr.bin/locate/locate/Makefile @@ -1,5 +1,5 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 -# $Id: Makefile,v 1.6 1996/08/31 23:14:51 wosch Exp $ +# $Id: Makefile,v 1.7 1996/09/01 16:03:28 wosch Exp $ PROG= locate SRCS= util.c locate.c @@ -21,5 +21,4 @@ beforeinstall: # ${.CURDIR}/locate.rc ${DESTDIR}/etc .include "../../Makefile.inc" -.include "../Makefile.inc" .include <bsd.prog.mk> diff --git a/usr.bin/locate/locate/concatdb.sh b/usr.bin/locate/locate/concatdb.sh index 9ca687ddddb2..0be7619f5f85 100644 --- a/usr.bin/locate/locate/concatdb.sh +++ b/usr.bin/locate/locate/concatdb.sh @@ -30,25 +30,23 @@ # # Sequence of databases is important. # -# $Id: concatdb.sh,v 1.3 1996/10/31 22:46:52 wosch Exp $ +# $Id: concatdb.sh,v 1.3.2.1 1997/12/13 18:20:59 sef Exp $ # The directory containing locate subprograms -: ${LIBEXECDIR=/usr/libexec}; export LIBEXECDIR +: ${LIBEXECDIR:=/usr/libexec}; export LIBEXECDIR PATH=$LIBEXECDIR:/bin:/usr/bin:$PATH; export PATH umask 077 # protect temp files -TMPDIR=${TMPDIR:-/tmp}; export TMPDIR; -if test X"$TMPDIR" = X -o ! -d "$TMPDIR"; then - TMPDIR=/tmp; export TMPDIR -fi +: ${TMPDIR:=/var/tmp}; export TMPDIR; +test -d "$TMPDIR" || TMPDIR=/var/tmp # utilities to built locate database -: ${bigram=locate.bigram} -: ${code=locate.code} -: ${sort=sort} -: ${locate=locate} +: ${bigram:=locate.bigram} +: ${code:=locate.code} +: ${sort:=sort} +: ${locate:=locate} case $# in diff --git a/usr.bin/locate/locate/fastfind.c b/usr.bin/locate/locate/fastfind.c index cea18a14b6c3..b425906b154e 100644 --- a/usr.bin/locate/locate/fastfind.c +++ b/usr.bin/locate/locate/fastfind.c @@ -34,7 +34,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: fastfind.c,v 1.6 1996/10/27 19:18:06 alex Exp $ + * $Id: fastfind.c,v 1.6.2.1 1997/07/22 07:25:26 charnier Exp $ */ @@ -89,10 +89,10 @@ statistic (fp, path_fcodes) (void)printf("\nDatabase: %s\n", path_fcodes); (void)printf("Compression: Front: %2.2f%%, ", - (float)(100 * (size + big - (2 * NBG))) / chars); - (void)printf("Bigram: %2.2f%%, ", (float)(100 * (size - big)) / size); + (size + big - (2 * NBG)) / (chars / (float)100)); + (void)printf("Bigram: %2.2f%%, ", (size - big) / (size / (float)100)); (void)printf("Total: %2.2f%%\n", - (float)(100 * (size - (2 * NBG))) / chars); + (size - (2 * NBG)) / (chars / (float)100)); (void)printf("Filenames: %d, ", lines); (void)printf("Characters: %d, ", chars); (void)printf("Database size: %d\n", size); @@ -183,6 +183,9 @@ fastfind #ifdef FF_ICASE /* set patend char to true */ + for (c = 0; c < UCHAR_MAX + 1; c++) + table[c] = 0; + table[TOLOWER(*patend)] = 1; table[toupper(*patend)] = 1; #endif /* FF_ICASE */ diff --git a/usr.bin/locate/locate/locate.c b/usr.bin/locate/locate/locate.c index 090a09f307b3..9f7668cb5172 100644 --- a/usr.bin/locate/locate/locate.c +++ b/usr.bin/locate/locate/locate.c @@ -34,7 +34,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: locate.c,v 1.6.2.1 1997/07/22 07:25:29 charnier Exp $ + * $Id: locate.c,v 1.6.2.2 1997/08/29 05:29:29 imp Exp $ */ #ifndef lint @@ -49,7 +49,7 @@ static const char copyright[] = static char sccsid[] = "@(#)locate.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id: locate.c,v 1.6.2.1 1997/07/22 07:25:29 charnier Exp $"; + "$Id: locate.c,v 1.6.2.2 1997/08/29 05:29:29 imp Exp $"; #endif /* not lint */ /* @@ -158,7 +158,7 @@ main(argc, argv) #endif (void) setlocale(LC_ALL, ""); - while ((ch = getopt(argc, argv, "Scd:il:ms")) != -1) + while ((ch = getopt(argc, argv, "Scd:il:ms")) != -1) switch(ch) { case 'S': /* statistic lines */ f_statistic = 1; @@ -303,7 +303,7 @@ search_mmap(db, s) if ((p = mmap((caddr_t)0, (size_t)len, PROT_READ, MAP_SHARED, - fd, (off_t)0)) == (caddr_t)-1) + fd, (off_t)0)) == MAP_FAILED) err(1, "mmap ``%s''", path_fcodes); /* foreach search string ... */ diff --git a/usr.bin/locate/locate/locate.rc b/usr.bin/locate/locate/locate.rc index 6591af12ab1b..1595db7de057 100644 --- a/usr.bin/locate/locate/locate.rc +++ b/usr.bin/locate/locate/locate.rc @@ -1,13 +1,13 @@ # # /etc/locate.rc - command script for updatedb(8) # -# $Id: locate.rc,v 1.2 1996/09/05 20:18:14 guido Exp $ +# $Id: locate.rc,v 1.2.2.1 1998/03/08 09:31:57 jkh Exp $ # # All commented values are the defaults # # temp directory -#TMPDIR="/tmp" +#TMPDIR="/var/tmp" # the actual database #FCODES="/var/db/locate.database" diff --git a/usr.bin/locate/locate/mklocatedb.sh b/usr.bin/locate/locate/mklocatedb.sh index 477e752042f0..317e4a74a5a1 100644 --- a/usr.bin/locate/locate/mklocatedb.sh +++ b/usr.bin/locate/locate/mklocatedb.sh @@ -28,25 +28,23 @@ # # usage: mklocatedb [-presort] < filelist > database # -# $Id: mklocatedb.sh,v 1.2 1996/08/27 20:04:25 wosch Exp $ +# $Id: mklocatedb.sh,v 1.2.2.1 1997/12/13 18:21:02 sef Exp $ # The directory containing locate subprograms -: ${LIBEXECDIR=/usr/libexec}; export LIBEXECDIR +: ${LIBEXECDIR:=/usr/libexec}; export LIBEXECDIR PATH=$LIBEXECDIR:/bin:/usr/bin:$PATH; export PATH umask 077 # protect temp files -TMPDIR=${TMPDIR:-/tmp}; export TMPDIR -if test X"$TMPDIR" = X -o ! -d "$TMPDIR"; then - TMPDIR=/tmp; export TMPDIR -fi +: ${TMPDIR:=/var/tmp}; export TMPDIR +test -d "$TMPDIR" || TMPDIR=/var/tmp # utilities to built locate database -: ${bigram=locate.bigram} -: ${code=locate.code} -: ${sort=sort} +: ${bigram:=locate.bigram} +: ${code:=locate.code} +: ${sort:=sort} sortopt="-u -T $TMPDIR" diff --git a/usr.bin/locate/locate/updatedb.sh b/usr.bin/locate/locate/updatedb.sh index 56bee02a5461..648908cb12c8 100644 --- a/usr.bin/locate/locate/updatedb.sh +++ b/usr.bin/locate/locate/updatedb.sh @@ -26,7 +26,7 @@ # # updatedb - update locate database for local mounted filesystems # -# $Id: updatedb.sh,v 1.5 1996/10/12 20:29:25 wosch Exp $ +# $Id: updatedb.sh,v 1.5.2.1 1997/12/13 18:21:05 sef Exp $ LOCATE_CONFIG="/etc/locate.rc" if [ -f "$LOCATE_CONFIG" -a -r "$LOCATE_CONFIG" ]; then @@ -34,21 +34,22 @@ if [ -f "$LOCATE_CONFIG" -a -r "$LOCATE_CONFIG" ]; then fi # The directory containing locate subprograms -: ${LIBEXECDIR=/usr/libexec}; export LIBEXECDIR -TMPDIR=${TMPDIR:-/tmp}; export TMPDIR -if test X"$TMPDIR" = X -o ! -d "$TMPDIR"; then - TMPDIR=/tmp; export TMPDIR +: ${LIBEXECDIR:=/usr/libexec}; export LIBEXECDIR +: ${TMPDIR:=/var/tmp}; export TMPDIR +if TMPDIR=`mktemp -d $TMPDIR/locateXXXXXX`; then : +else + exit 1 fi PATH=$LIBEXECDIR:/bin:/usr/bin:$PATH; export PATH -: ${mklocatedb=locate.mklocatedb} # make locate database program -: ${FCODES=/var/db/locate.database} # the database -: ${SEARCHPATHS="/"} # directories to be put in the database +: ${mklocatedb:=locate.mklocatedb} # make locate database program +: ${FCODES:=/var/db/locate.database} # the database +: ${SEARCHPATHS:="/"} # directories to be put in the database : ${PRUNEPATHS="/tmp /usr/tmp /var/tmp"} # unwanted directories -: ${FILESYSTEMS="ufs"} # allowed filesystems -: ${find=find} +: ${FILESYSTEMS:="ufs"} # allowed filesystems +: ${find:=find} case X"$SEARCHPATHS" in X) echo "$0: empty variable SEARCHPATHS"; exit 1;; esac @@ -86,3 +87,5 @@ then exit 1 esac fi +rm -f $tmp +rmdir $TMPDIR diff --git a/usr.bin/lock/lock.c b/usr.bin/lock/lock.c index 8301c54bc75a..d504decd7ed5 100644 --- a/usr.bin/lock/lock.c +++ b/usr.bin/lock/lock.c @@ -45,7 +45,7 @@ static const char copyright[] = static char sccsid[] = "@(#)lock.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id: lock.c,v 1.2.2.2 1997/08/29 05:29:29 imp Exp $"; + "$Id: lock.c,v 1.2.2.3 1997/09/15 08:32:17 jkh Exp $"; #endif /* not lint */ /* @@ -88,6 +88,7 @@ main(argc, argv) { struct passwd *pw; struct timeval timval; + time_t timval_sec; struct itimerval ntimer, otimer; struct tm *timp; int ch, sectimeout, usemine; @@ -130,7 +131,8 @@ main(argc, argv) if (gettimeofday(&timval, (struct timezone *)NULL)) err(1, "gettimeofday"); nexttime = timval.tv_sec + (sectimeout * 60); - timp = localtime(&timval.tv_sec); + timval_sec = timval.tv_sec; + timp = localtime(&timval_sec); ap = asctime(timp); tzn = timp->tm_zone; diff --git a/usr.bin/m4/m4.1 b/usr.bin/m4/m4.1 index ef2e65839d3e..3d1e88c9d2ce 100644 --- a/usr.bin/m4/m4.1 +++ b/usr.bin/m4/m4.1 @@ -1,5 +1,5 @@ .\" -.\" @(#) $Id$ +.\" @(#) $Id: m4.1,v 1.1.8.2 1997/03/15 21:22:16 bde Exp $ .\" .Dd January 26, 1993 .Dt m4 1 @@ -54,7 +54,7 @@ Undefine the symbol .Sh SYNTAX .Nm m4 provides the following built-in macros. They may be -redefined, loosing their original meaning. +redefined, losing their original meaning. Return values are NULL unless otherwise stated. .Bl -tag -width changequotexxx .It changecom @@ -177,5 +177,7 @@ Flushes the named output queues (or all queues if no arguments). .It unix A pre-defined macro for testing the OS platform. .El -.Sh AUTHOR -Ozan Yigit <oz@sis.yorku.ca> and Richard A. O'Keefe (ok@goanna.cs.rmit.OZ.AU) +.Sh AUTHORS +.An Ozan Yigit Aq oz@sis.yorku.ca +and +.An Richard A. O'Keefe Aq ok@goanna.cs.rmit.OZ.AU diff --git a/usr.bin/mail/cmd1.c b/usr.bin/mail/cmd1.c index 1f87fa87b56e..25c08fa552c1 100644 --- a/usr.bin/mail/cmd1.c +++ b/usr.bin/mail/cmd1.c @@ -194,7 +194,7 @@ printhead(mesg) if (mp->m_flag & MBOX) dispc = 'M'; parse(headline, &hl, pbuf); - sprintf(wcount, "%3d/%-5ld", mp->m_lines, mp->m_size); + sprintf(wcount, "%3ld/%-5ld", mp->m_lines, mp->m_size); subjlen = screenwidth - 50 - strlen(wcount); name = value("show-rcpt") != NOSTR ? skin(hfield("to", mp)) : nameof(mp, 0); diff --git a/usr.bin/mail/cmd3.c b/usr.bin/mail/cmd3.c index b4d7d441bd75..04cecf6a0b30 100644 --- a/usr.bin/mail/cmd3.c +++ b/usr.bin/mail/cmd3.c @@ -336,7 +336,7 @@ messize(msgvec) for (ip = msgvec; *ip != 0; ip++) { mesg = *ip; mp = &message[mesg-1]; - printf("%d: %d/%ld\n", mesg, mp->m_lines, mp->m_size); + printf("%d: %ld/%ld\n", mesg, mp->m_lines, mp->m_size); } return(0); } diff --git a/usr.bin/modstat/modstat.8 b/usr.bin/modstat/modstat.8 index b69672a04fc3..2381b4d8b5f9 100644 --- a/usr.bin/modstat/modstat.8 +++ b/usr.bin/modstat/modstat.8 @@ -23,7 +23,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: modstat.8,v 1.2.8.1 1996/12/04 16:08:27 phk Exp $ +.\" $Id: modstat.8,v 1.2.8.2 1997/07/30 06:42:43 charnier Exp $ .\" .Dd June 7, 1993 .Dt MODSTAT 8 @@ -63,7 +63,5 @@ The command was designed to be similar in functionality to the corresponding command in .Tn "SunOS 4.1.3" . -.Sh AUTHOR -.Bl -tag -Terrence R. Lambert, terry@cs.weber.edu -.El +.Sh AUTHORS +.An Terrence R. Lambert Aq terry@cs.weber.edu diff --git a/usr.bin/more/ch.c b/usr.bin/more/ch.c index 52e80d08d473..3e402cc3ca4a 100644 --- a/usr.bin/more/ch.c +++ b/usr.bin/more/ch.c @@ -394,8 +394,8 @@ ch_init(want_nbufs, keep) * If we don't have ANY, then quit. * Otherwise, just report the error and return. */ - (void)sprintf(message, "cannot allocate %d buffers", - want_nbufs - nbufs); + (void)snprintf(message, sizeof(message), + "cannot allocate %d buffers", want_nbufs - nbufs); error(message); if (nbufs == 0) quit(); diff --git a/usr.bin/more/command.c b/usr.bin/more/command.c index 2b8d3a412787..a8785d22312a 100644 --- a/usr.bin/more/command.c +++ b/usr.bin/more/command.c @@ -57,6 +57,7 @@ extern int sc_height; extern int sc_window; extern int curr_ac; extern int ac; +extern char **av; extern int quitting; extern int scroll; extern int screen_trashed; /* The screen has been overwritten */ @@ -185,19 +186,21 @@ prompt() putstr(current_name); putstr(":"); if (!ispipe) { - (void)sprintf(pbuf, " file %d/%d", curr_ac + 1, ac); + (void)snprintf(pbuf, sizeof(pbuf), + " file %d/%d", curr_ac + 1, ac); putstr(pbuf); } if (linenums) { - (void)sprintf(pbuf, " line %d", currline(BOTTOM)); + (void)snprintf(pbuf, sizeof(pbuf), + " line %d", currline(BOTTOM)); putstr(pbuf); } if ((pos = position(BOTTOM)) != NULL_POSITION) { - (void)sprintf(pbuf, " byte %qd", pos); + (void)snprintf(pbuf, sizeof(pbuf), " byte %qd", pos); putstr(pbuf); if (!ispipe && (len = ch_length())) { - (void)sprintf(pbuf, "/%qd pct %qd%%", - len, ((100 * pos) / len)); + (void)snprintf(pbuf, sizeof(pbuf), + "/%qd pct %qd%%", len, ((100 * pos) / len)); putstr(pbuf); } } @@ -218,7 +221,8 @@ prompt() else if (!ispipe && (pos = position(BOTTOM)) != NULL_POSITION && (len = ch_length())) { - (void)sprintf(pbuf, " (%qd%%)", ((100 * pos) / len)); + (void)snprintf(pbuf, sizeof(pbuf), + " (%qd%%)", ((100 * pos) / len)); putstr(pbuf); } so_exit(); @@ -508,6 +512,10 @@ again: if (sigs) number, wsearch); break; case A_HELP: /* help */ + if (ac > 0 && !strcmp(_PATH_HELPFILE, av[curr_ac])) { + error("Already viewing help."); + break; + } lower_left(); clear_eol(); putstr("help"); @@ -620,16 +628,16 @@ editfile() dolinenumber = 0; } if (dolinenumber && (c = currline(MIDDLE))) - (void)sprintf(buf, "%s +%d %s", editor, c, current_file); + (void)snprintf(buf, sizeof(buf), + "%s +%d %s", editor, c, current_file); else - (void)sprintf(buf, "%s %s", editor, current_file); + (void)snprintf(buf, sizeof(buf), "%s %s", editor, current_file); lsystem(buf); } showlist() { extern int sc_width; - extern char **av; register int indx, width; int len; char *p; diff --git a/usr.bin/more/help.c b/usr.bin/more/help.c index eeb379584998..5fdf595fed44 100644 --- a/usr.bin/more/help.c +++ b/usr.bin/more/help.c @@ -44,6 +44,6 @@ help() { char cmd[MAXPATHLEN + 20]; - (void)sprintf(cmd, "-more %s", _PATH_HELPFILE); + (void)snprintf(cmd, sizeof(cmd), "-more -e %s", _PATH_HELPFILE); lsystem(cmd); } diff --git a/usr.bin/more/main.c b/usr.bin/more/main.c index bb77d0b4c432..6df972849b5b 100644 --- a/usr.bin/more/main.c +++ b/usr.bin/more/main.c @@ -48,9 +48,11 @@ static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/7/93"; */ #include <sys/types.h> +#include <sys/param.h> #include <sys/file.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <locale.h> #include "less.h" @@ -86,7 +88,7 @@ edit(filename) register char *m; off_t initial_pos, position(); static int didpipe; - char message[100], *p; + char message[MAXPATHLEN + 50], *p; char *rindex(), *strerror(), *save(), *bad_file(); initial_pos = NULL_POSITION; @@ -121,7 +123,8 @@ edit(filename) return(0); } else if ((f = open(filename, O_RDONLY, 0)) < 0) { - (void)sprintf(message, "%s: %s", filename, strerror(errno)); + (void)snprintf(message, sizeof(message), + "%s: %s", filename, strerror(errno)); error(message); free(filename); return(0); diff --git a/usr.bin/more/more.1 b/usr.bin/more/more.1 index ff4991081803..3ab85748dcfc 100644 --- a/usr.bin/more/more.1 +++ b/usr.bin/more/more.1 @@ -292,9 +292,10 @@ characteristics necessary to manipulate the screen. .Sh BUGS Incorrect output can result from omitting the -u flag when accessing regular files with CRLF line termination. -.Sh AUTHOR +.Sh AUTHORS This software is derived from software contributed to Berkeley -by Mark Nudleman. +by +.An Mark Nudleman . .Sh HISTORY The .Nm diff --git a/usr.bin/more/os.c b/usr.bin/more/os.c index 75b7a6ee113e..da22d0dc2ecb 100644 --- a/usr.bin/more/os.c +++ b/usr.bin/more/os.c @@ -54,6 +54,7 @@ static char sccsid[] = "@(#)os.c 8.1 (Berkeley) 6/6/93"; #include <signal.h> #include <setjmp.h> #include <stdio.h> +#include <string.h> #include <less.h> #include "pathnames.h" @@ -122,7 +123,8 @@ lsystem(cmd) cmd = shell; else { - (void)sprintf(cmdbuf, "%s -c \"%s\"", shell, cmd); + (void)snprintf(cmdbuf, sizeof(cmdbuf), + "%s -c \"%s\"", shell, cmd); cmd = cmdbuf; } } @@ -214,19 +216,17 @@ glob(filename) /* * Read the output of <echo filename>. */ - cmd = malloc((u_int)(strlen(filename)+8)); + (void)asprintf(&cmd, "echo \"%s\"", filename); if (cmd == NULL) return (filename); - (void)sprintf(cmd, "echo \"%s\"", filename); } else { /* * Read the output of <$SHELL -c "echo filename">. */ - cmd = malloc((u_int)(strlen(p)+12)); + (void)asprintf(&cmd, "%s -c \"echo %s\"", p, filename); if (cmd == NULL) return (filename); - (void)sprintf(cmd, "%s -c \"echo %s\"", p, filename); } if ((f = popen(cmd, "r")) == NULL) @@ -254,7 +254,8 @@ bad_file(filename, message, len) char *strcat(), *strerror(); if (stat(filename, &statbuf) < 0) { - (void)sprintf(message, "%s: %s", filename, strerror(errno)); + (void)snprintf(message, len, + "%s: %s", filename, strerror(errno)); return(message); } if ((statbuf.st_mode & S_IFMT) == S_IFDIR) { diff --git a/usr.bin/more/output.c b/usr.bin/more/output.c index 5b0a562c4d37..0d015501326e 100644 --- a/usr.bin/more/output.c +++ b/usr.bin/more/output.c @@ -42,6 +42,7 @@ static char sccsid[] = "@(#)output.c 8.1 (Berkeley) 6/6/93"; #include <ctype.h> #include <stdio.h> +#include <string.h> #include "less.h" int errmsgs; /* Count of messages displayed by error() */ diff --git a/usr.bin/more/prim.c b/usr.bin/more/prim.c index adb17d1e6d09..1a571e657044 100644 --- a/usr.bin/more/prim.c +++ b/usr.bin/more/prim.c @@ -374,8 +374,8 @@ jump_back(n) while ((c = ch_forw_get()) != '\n') if (c == EOI) { char message[40]; - (void)sprintf(message, "File has only %d lines", - nlines - 1); + (void)snprintf(message, sizeof(message), + "File has only %d lines", nlines - 1); error(message); return; } diff --git a/usr.bin/more/screen.c b/usr.bin/more/screen.c index bf12ad62cefb..83352cfed02c 100644 --- a/usr.bin/more/screen.c +++ b/usr.bin/more/screen.c @@ -44,6 +44,7 @@ static char sccsid[] = "@(#)screen.c 8.2 (Berkeley) 4/20/94"; */ #include <stdio.h> +#include <string.h> #include <less.h> #define TERMIOS 1 diff --git a/usr.bin/more/tags.c b/usr.bin/more/tags.c index 0d805faff1d1..54865676459c 100644 --- a/usr.bin/more/tags.c +++ b/usr.bin/more/tags.c @@ -38,6 +38,7 @@ static char sccsid[] = "@(#)tags.c 8.1 (Berkeley) 6/6/93"; #include <sys/types.h> #include <stdio.h> +#include <string.h> #include <less.h> #define WHITESP(c) ((c)==' ' || (c)=='\t') diff --git a/usr.bin/msgs/msgs.1 b/usr.bin/msgs/msgs.1 index 779fc0a9bba4..edab4a77ac8e 100644 --- a/usr.bin/msgs/msgs.1 +++ b/usr.bin/msgs/msgs.1 @@ -134,11 +134,15 @@ to enable posting of messages. The .Fl c option is used for performing cleanup on -.Pa /var/msgs. -An entry with the +.Pa /var/msgs . +A shell script entry to run +.Nm +with the .Fl c option should be placed in -.Pa /etc/crontab +.Pa /etc/periodic/daily +(see +.Xr periodic 8 ) to run every night. This will remove all messages over 21 days old. A different expiration may be specified on the command line to override the default. @@ -146,7 +150,7 @@ the default. Options when reading messages include: .Bl -tag -width Fl .It Fl f -Do not to say ``No new messages.''. +Do not say ``No new messages.''. This is useful in a .Pa .login file since this is often the case here. @@ -205,8 +209,8 @@ number of next message to be presented .Sh SEE ALSO .Xr mail 1 , .Xr more 1 , -.Xr aliases 5 -.\".Xr crontab 5 , +.Xr aliases 5 , +.Xr periodic 8 .Sh HISTORY The .Nm diff --git a/usr.bin/msgs/msgs.c b/usr.bin/msgs/msgs.c index d685bb5b3cd9..146801ea00a4 100644 --- a/usr.bin/msgs/msgs.c +++ b/usr.bin/msgs/msgs.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)msgs.c 8.2 (Berkeley) 4/28/95"; #endif static const char rcsid[] = - "$Id: msgs.c,v 1.8.2.2 1998/07/07 12:09:52 jkh Exp $"; + "$Id: msgs.c,v 1.8.2.3 1998/07/07 22:21:12 jkh Exp $"; #endif /* not lint */ /* @@ -78,6 +78,7 @@ static const char rcsid[] = #include <dirent.h> #include <err.h> #include <errno.h> +#include <fcntl.h> #include <locale.h> #include <pwd.h> #include <setjmp.h> @@ -610,11 +611,16 @@ prmesg(length) int length; { FILE *outf; + char *env_pager; if (use_pager && length > Lpp) { signal(SIGPIPE, SIG_IGN); signal(SIGQUIT, SIG_IGN); - snprintf(cmdbuf, sizeof(cmdbuf), _PATH_PAGER, Lpp); + if ((env_pager = getenv("PAGER")) == NULL) { + snprintf(cmdbuf, sizeof(cmdbuf), _PATH_PAGER, Lpp); + } else { + snprintf(cmdbuf, sizeof(cmdbuf), env_pager); + } outf = popen(cmdbuf, "w"); if (!outf) outf = stdout; @@ -716,7 +722,7 @@ ask(prompt) char *prompt; { char inch; - int n, cmsg; + int n, cmsg, fd; off_t oldpos; FILE *cpfrom, *cpto; @@ -760,15 +766,20 @@ char *prompt; } else strcpy(fname, "Messages"); + fd = open(fname, O_RDWR|O_EXCL|O_CREAT|O_APPEND); } else { strcpy(fname, _PATH_TMP); - mktemp(fname); - snprintf(cmdbuf, sizeof(cmdbuf), _PATH_MAIL, fname); - mailing = YES; + fd = mkstemp(fname); + if (fd != -1) { + snprintf(cmdbuf, sizeof(cmdbuf), _PATH_MAIL, + fname); + mailing = YES; + } } - cpto = fopen(fname, "a"); - if (!cpto) { + if (fd == -1 || (cpto = fdopen(fd, "a")) == NULL) { + if (fd != -1) + close(fd); warn("%s", fname); mailing = NO; fseek(newmsg, oldpos, 0); @@ -798,6 +809,7 @@ gfrsub(infile) FILE *infile; { off_t frompos; + int count; seensubj = seenfrom = NO; local = YES; @@ -815,11 +827,14 @@ FILE *infile; frompos = ftell(infile); ptr = from; in = nxtfld(inbuf); - if (*in) while (*in && *in > ' ') { - if (*in == ':' || *in == '@' || *in == '!') - local = NO; - *ptr++ = *in++; - /* what about sizeof from ? */ + if (*in) { + count = sizeof(from) - 1; + while (*in && *in > ' ' && count-- > 0) { + if (*in == ':' || *in == '@' || + *in == '!') + local = NO; + *ptr++ = *in++; + } } *ptr = NULL; if (*(in = nxtfld(in))) diff --git a/usr.bin/mt/mt.c b/usr.bin/mt/mt.c index d1c498e68216..8c222015a886 100644 --- a/usr.bin/mt/mt.c +++ b/usr.bin/mt/mt.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)mt.c 8.2 (Berkeley) 5/4/95"; #endif static const char rcsid[] = - "$Id: mt.c,v 1.9.2.3 1997/08/29 05:29:38 imp Exp $"; + "$Id: mt.c,v 1.9.2.4 1997/09/15 09:20:54 jkh Exp $"; #endif /* not lint */ /* @@ -415,8 +415,8 @@ getblksiz(int bs) void st_status(struct mtget *bp) { - printf("Present Mode: Density = %-12s Blocksize %s\n", - denstostring(bp->mt_density), getblksiz(bp->mt_blksiz)); + printf("Present Mode: Density = %-12s Blocksize %s Comp %d\n", + denstostring(bp->mt_density), getblksiz(bp->mt_blksiz), (int)bp->mt_comp); printf("---------available modes---------\n"); printf("Mode 0: Density = %-12s Blocksize %s\n", denstostring(bp->mt_density0), getblksiz(bp->mt_blksiz0)); diff --git a/usr.bin/ncal/ncal.1 b/usr.bin/ncal/ncal.1 index a2b21a381812..85775bb47e1b 100644 --- a/usr.bin/ncal/ncal.1 +++ b/usr.bin/ncal/ncal.1 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: ncal.1,v 1.5.2.1 1998/01/12 05:11:04 obrien Exp $ +.\" $Id: ncal.1,v 1.5.2.2 1998/01/12 06:21:22 obrien Exp $ .\" .Dd December 16, 1997 .Dt CAL 1 @@ -107,12 +107,13 @@ command appeared in .At v6 . The .Nm ncal -command appeared after -.Fx 2.2.5 . -.Sh AUTHOR -This -manual page and the command was written by -.An Wolfgang Helbig Aq helbig@FreeBSD.ORG . +command appeared in +.Fx 2.2.6 . +.Sh AUTHORS +The +.Nm ncal +command and manual were written by +.An Wolfgang Helbig Aq helbig@FreeBSD.org . .Sh BUGS The assignment of Julian - Gregorian switching dates to country codes is historically naive for many countries. diff --git a/usr.bin/netstat/atalk.c b/usr.bin/netstat/atalk.c index 49717e68299d..9d75b6807ced 100644 --- a/usr.bin/netstat/atalk.c +++ b/usr.bin/netstat/atalk.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)atalk.c 1.1 (Whistle) 6/6/96"; */ static const char rcsid[] = - "$Id: atalk.c,v 1.6 1996/10/28 18:56:31 wollman Exp $"; + "$Id: atalk.c,v 1.6.2.1 1997/07/30 06:52:04 charnier Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -243,8 +243,8 @@ atalkprotopr(off, name) first = 0; } if (Aflag) - printf("%8x ", ppcb); - printf("%-5.5s %6d %6d ", name, sockb.so_rcv.sb_cc, + printf("%8lx ", ppcb); + printf("%-5.5s %6lu %6lu ", name, sockb.so_rcv.sb_cc, sockb.so_snd.sb_cc); printf(Aflag?" %-18.18s":" %-22.22s", atalk_print( (struct sockaddr *)&ddpcb.ddp_lsat,7)); @@ -253,8 +253,9 @@ atalkprotopr(off, name) putchar('\n'); } } + #define ANY(x,y,z) \ - ((x) ? printf("\t%d %s%s%s\n",x,y,plural(x),z) : 0) + ((x) ? printf("\t%lu %s%s%s\n",x,y,plural(x),z) : 0) /* * Dump DDP statistics structure. @@ -281,6 +282,3 @@ ddp_stats(off, name) ANY(ddpstat.ddps_cantforward, "packet", " rcvd for unreachable dest "); ANY(ddpstat.ddps_nosockspace, "packet", " dropped due to no socket space "); } -#undef ANY - - diff --git a/usr.bin/nice/nice.1 b/usr.bin/nice/nice.1 index 148b0cabcc0b..90ec95c0b6d2 100644 --- a/usr.bin/nice/nice.1 +++ b/usr.bin/nice/nice.1 @@ -30,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)nice.1 8.1 (Berkeley) 6/6/93 -.\" $Id: nice.1,v 1.1.1.1.8.2 1997/03/06 07:44:50 mpp Exp $ +.\" $Id: nice.1,v 1.1.1.1.8.3 1997/09/15 09:20:56 jkh Exp $ .\" .Dd June 6, 1993 .Dt NICE 1 @@ -39,7 +39,7 @@ .Nm nice .Nd execute a command at a low scheduling priority .Sh SYNOPSIS -.Nm nice +.Nm .Op Fl Ns Ar number .Ar command .Op Ar arguments @@ -96,7 +96,7 @@ shell is 0 and you are the super-user. .Xr renice 8 .Sh HISTORY A -.Nm nice +.Nm command appeared in .At v6 . .Sh BUGS diff --git a/usr.bin/nm/nm.c b/usr.bin/nm/nm.c index 42d95fd3f840..46583a44e4b6 100644 --- a/usr.bin/nm/nm.c +++ b/usr.bin/nm/nm.c @@ -45,7 +45,7 @@ static const char copyright[] = static char sccsid[] = "@(#)nm.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id: nm.c,v 1.9.2.2 1997/08/29 05:29:40 imp Exp $"; + "$Id: nm.c,v 1.9.2.3 1997/09/15 09:20:57 jkh Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -309,7 +309,7 @@ show_archive(fname, fp) rval = 1; } } else { - (void)fseek(fp, (long)-sizeof(exec_head), + (void)fseek(fp, -(long)sizeof(exec_head), SEEK_CUR); if (!print_file_each_line && !table) (void)printf("\n%s:\n", name); @@ -346,7 +346,7 @@ show_objfile(objname, fp) register struct nlist *names, *np; register int i, nnames, nrawnames; struct exec head; - long stabsize; + int32_t stabsize; char *stab; /* read a.out header */ @@ -359,7 +359,7 @@ show_objfile(objname, fp) * skip back to the header - the N_-macros return values relative * to the beginning of the a.out header */ - if (fseek(fp, (long)-sizeof(head), SEEK_CUR)) { + if (fseek(fp, -(long)sizeof(head), SEEK_CUR)) { warn("%s", objname); return(1); } @@ -474,7 +474,7 @@ print_symbol(objname, sym) if (table) { printf("%s|", objname); if (SYMBOL_TYPE(sym->n_type) != N_UNDF) - (void)printf("%08lx", sym->n_value); + (void)printf("%08lx", (u_long)sym->n_value); (void)printf("|"); if (IS_DEBUGGER_SYMBOL(sym->n_type)) (void)printf("-|%02x %04x %5s|", sym->n_other, @@ -506,7 +506,7 @@ print_symbol(objname, sym) if (SYMBOL_TYPE(sym->n_type) == N_UNDF) (void)printf(" "); else - (void)printf("%08lx", sym->n_value); + (void)printf("%08lx", (u_long)sym->n_value); /* print type information */ if (IS_DEBUGGER_SYMBOL(sym->n_type)) diff --git a/usr.bin/paste/paste.c b/usr.bin/paste/paste.c index bba63a3bcaa9..3810f5540a23 100644 --- a/usr.bin/paste/paste.c +++ b/usr.bin/paste/paste.c @@ -45,7 +45,7 @@ static const char copyright[] = static char sccsid[] = "@(#)paste.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id: paste.c,v 1.1.1.1.8.2 1997/08/05 03:40:23 asami Exp $"; + "$Id: paste.c,v 1.1.1.1.8.3 1997/08/29 05:29:41 imp Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -73,7 +73,7 @@ main(argc, argv) int ch, seq; seq = 0; - while ((ch = getopt(argc, argv, "d:s")) != -1) + while ((ch = getopt(argc, argv, "d:s")) != -1) switch(ch) { case 'd': delimcnt = tr(delim = optarg); diff --git a/usr.bin/pr/pr.c b/usr.bin/pr/pr.c index ed729d891cb2..c4fac42fa0f3 100644 --- a/usr.bin/pr/pr.c +++ b/usr.bin/pr/pr.c @@ -1255,6 +1255,7 @@ nxtfile(argc, argv, fname, buf, dt) { FILE *inf = NULL; struct timeval tv; + time_t tv_sec; struct timezone tz; struct tm *timeptr = NULL; struct stat statbuf; @@ -1282,7 +1283,8 @@ nxtfile(argc, argv, fname, buf, dt) eoptind = argc - 1; return(NULL); } - timeptr = localtime(&(tv.tv_sec)); + tv_sec = tv.tv_sec; + timeptr = localtime(&tv_sec); } for (; eoptind < argc; ++eoptind) { if (strcmp(argv[eoptind], "-") == 0) { @@ -1305,7 +1307,8 @@ nxtfile(argc, argv, fname, buf, dt) strerror(errno)); return(NULL); } - timeptr = localtime(&(tv.tv_sec)); + tv_sec = tv.tv_sec; + timeptr = localtime(&tv_sec); } else { /* * normal file processing @@ -1336,7 +1339,8 @@ nxtfile(argc, argv, fname, buf, dt) strerror(errno)); return(NULL); } - timeptr = localtime(&(tv.tv_sec)); + tv_sec = tv.tv_sec; + timeptr = localtime(&tv_sec); } else { if (fstat(fileno(inf), &statbuf) < 0) { ++errcnt; diff --git a/usr.bin/quota/quota.c b/usr.bin/quota/quota.c index 9fd27642e5aa..be0d6c3f1317 100644 --- a/usr.bin/quota/quota.c +++ b/usr.bin/quota/quota.c @@ -45,7 +45,7 @@ static const char copyright[] = static char sccsid[] = "from: @(#)quota.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id: quota.c,v 1.5.2.2 1997/08/29 05:29:44 imp Exp $"; + "$Id: quota.c,v 1.5.2.3 1997/09/15 10:19:35 jkh Exp $"; #endif /* not lint */ /* @@ -692,7 +692,7 @@ callaurpc(host, prognum, versnum, procnum, inproc, in, outproc, out) return ((int) RPC_UNKNOWNHOST); timeout.tv_usec = 0; timeout.tv_sec = 6; - bcopy(hp->h_addr, &server_addr.sin_addr, hp->h_length); + bcopy(hp->h_addr, &server_addr.sin_addr, MIN(hp->h_length,sizeof(server_addr.sin_addr))); server_addr.sin_family = AF_INET; server_addr.sin_port = 0; diff --git a/usr.bin/ranlib/touch.c b/usr.bin/ranlib/touch.c index 93670b39b696..62fbbac16dd6 100644 --- a/usr.bin/ranlib/touch.c +++ b/usr.bin/ranlib/touch.c @@ -39,7 +39,7 @@ static char sccsid[] = "@(#)touch.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id$"; + "$Id: touch.c,v 1.3.2.1 1997/08/05 06:39:15 charnier Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -89,7 +89,7 @@ settime(afd) size = SARMAG + sizeof(hdr->ar_name); if (lseek(afd, size, SEEK_SET) == (off_t)-1) error(archive); - (void)sprintf(buf, "%-12ld", time((time_t *)NULL) + RANLIBSKEW); + (void)sprintf(buf, "%-12ld", (long)time((time_t *)NULL) + RANLIBSKEW); if (write(afd, buf, sizeof(hdr->ar_date)) != sizeof(hdr->ar_date)) error(archive); } diff --git a/usr.bin/rs/rs.c b/usr.bin/rs/rs.c index a023db94f943..8f41647a446d 100644 --- a/usr.bin/rs/rs.c +++ b/usr.bin/rs/rs.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)rs.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id$"; + "$Id: rs.c,v 1.2.2.1 1997/08/08 07:51:52 charnier Exp $"; #endif /* not lint */ /* @@ -55,6 +55,7 @@ static const char rcsid[] = #include <ctype.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> long flags; #define TRANSPOSE 000001 diff --git a/usr.bin/rsh/rsh.c b/usr.bin/rsh/rsh.c index 126d61704133..e4ffa75022a6 100644 --- a/usr.bin/rsh/rsh.c +++ b/usr.bin/rsh/rsh.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "From: @(#)rsh.c 8.3 (Berkeley) 4/6/94"; #endif static char rcsid[] = - "$Id$"; + "$Id: rsh.c,v 1.8.2.4 1998/02/18 12:13:58 markm Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -98,7 +98,7 @@ main(argc, argv) struct servent *sp; long omask; int argoff, asrsh, ch, dflag, nflag, one, rem; - pid_t pid; + pid_t pid = 0; uid_t uid; char *args, *host, *p, *user; int timeout = 0; diff --git a/usr.bin/rwall/rwall.c b/usr.bin/rwall/rwall.c index 1acf445c402f..7d3c68f8949e 100644 --- a/usr.bin/rwall/rwall.c +++ b/usr.bin/rwall/rwall.c @@ -43,7 +43,7 @@ char const copyright[] = static char sccsid[] = "from: @(#)wall.c 5.14 (Berkeley) 3/2/91"; #endif static char rcsid[] = - "$Id: rwall.c,v 1.2 1995/05/30 06:33:30 rgrimes Exp $"; + "$Id: rwall.c,v 1.2.6.1 1997/08/11 07:13:00 charnier Exp $"; #endif /* not lint */ /* @@ -81,6 +81,7 @@ main(argc, argv) { char *wallhost, res; CLIENT *cl; + struct timeval tv; if ((argc < 2) || (argc > 3)) usage(); @@ -103,7 +104,9 @@ main(argc, argv) errx(1, "%s", clnt_spcreateerror(wallhost)); } - if (clnt_call(cl, WALLPROC_WALL, xdr_wrapstring, &mbuf, xdr_void, &res, NULL) != RPC_SUCCESS) { + tv.tv_sec = 15; /* XXX ?? */ + tv.tv_usec = 0; + if (clnt_call(cl, WALLPROC_WALL, xdr_wrapstring, &mbuf, xdr_void, &res, tv) != RPC_SUCCESS) { /* * An error occurred while calling the server. * Print error message and die. diff --git a/usr.bin/sasc/sasc.1 b/usr.bin/sasc/sasc.1 index 6aa4f0f1690e..961456314b27 100644 --- a/usr.bin/sasc/sasc.1 +++ b/usr.bin/sasc/sasc.1 @@ -28,7 +28,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: sasc.1,v 1.3 1996/01/30 13:50:40 mpp Exp $ +.\" $Id: sasc.1,v 1.3.2.1 1997/08/11 07:16:15 charnier Exp $ .\" .Dd January 6, 1995 .Dt SASC 1 @@ -95,5 +95,5 @@ file format. .El .Sh SEE ALSO .Xr asc 4 -.Sh AUTHOR -Gunther Schadow <gusw@fub46.zedat.fu-berlin.de> +.Sh AUTHORS +.An Gunther Schadow Aq gusw@fub46.zedat.fu-berlin.de diff --git a/usr.bin/script/script.1 b/usr.bin/script/script.1 index 6c0f7d697ea7..266d8094c292 100644 --- a/usr.bin/script/script.1 +++ b/usr.bin/script/script.1 @@ -30,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)script.1 8.1 (Berkeley) 6/6/93 -.\" $Id$ +.\" $Id: script.1,v 1.1.1.1.8.2 1998/03/08 12:12:12 jkh Exp $ .\" .Dd June 6, 1993 .Dt SCRIPT 1 @@ -41,7 +41,9 @@ .Sh SYNOPSIS .Nm .Op Fl a +.Op Fl k .Op Fl q +.Op Fl t Ar time .Op Ar file .Op Ar command ... .Sh DESCRIPTION @@ -68,16 +70,23 @@ is given, will run the specified command with an optional argument vector instead of an interactive shell. .Pp -Option: -.Bl -tag -width Ds +Options: +.Bl -tag -width xxxxxxx .It Fl a Append the output to .Ar file or .Pa typescript , retaining the prior contents. +.It Fl k +Log keys sent to program as well as output. .It Fl q Run in quiet mode, omit the start and stop status messages. +.It Fl t Ar time +Specify time interval between flushing script output file. A value of 0 +causes +.Nm +to flush for every character I/O event. .El .Pp The script ends when the forked shell (or command) exits (a @@ -135,4 +144,10 @@ in the log file, including linefeeds and backspaces. This is not what the naive user expects. .Pp It is not possible to specify a command without also naming the script file -because of argument parsing compatability issues. +because of argument parsing compatibility issues. +.Pp +When running in +.Fl k +mode, echo cancelling far from ideal. The slave terminal mode is checked +for ECHO mode to check when to avoid manual echo logging. This does not +work when in a raw mode where the program being run is doing manual echo. diff --git a/usr.bin/script/script.c b/usr.bin/script/script.c index 7bfa190546fb..4edf915694c5 100644 --- a/usr.bin/script/script.c +++ b/usr.bin/script/script.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)script.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id: script.c,v 1.3.2.2 1997/08/29 05:29:52 imp Exp $"; + "$Id: script.c,v 1.3.2.3 1998/03/08 12:12:16 jkh Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -52,6 +52,7 @@ static const char rcsid[] = #include <sys/time.h> #include <err.h> +#include <errno.h> #include <fcntl.h> #include <libutil.h> #include <paths.h> @@ -64,8 +65,7 @@ static const char rcsid[] = FILE *fscript; int master, slave; -int child, subchild; -int outcc; +int child; char *fname; int qflg; @@ -76,7 +76,6 @@ void dooutput __P((void)); void doshell __P((char **)); void fail __P((void)); void finish __P((int)); -void scriptflush __P((int)); static void usage __P((void)); int @@ -85,13 +84,19 @@ main(argc, argv) char *argv[]; { register int cc; - struct termios rtt; + struct termios rtt, stt; struct winsize win; - int aflg, ch; + int aflg, kflg, ch, n; + struct timeval tv, *tvp; + time_t tvec, start; + char obuf[BUFSIZ]; char ibuf[BUFSIZ]; + fd_set rfd; + int flushtime = 30; + int lastc = 1000; - aflg = 0; - while ((ch = getopt(argc, argv, "aq")) != -1) + aflg = kflg = 0; + while ((ch = getopt(argc, argv, "aqkt:")) != -1) switch(ch) { case 'a': aflg = 1; @@ -99,6 +104,14 @@ main(argc, argv) case 'q': qflg = 1; break; + case 'k': + kflg = 1; + break; + case 't': + flushtime = atoi(optarg); + if (flushtime < 0) + err(1, "invalid flush time %d", flushtime); + break; case '?': default: usage(); @@ -121,8 +134,12 @@ main(argc, argv) if (openpty(&master, &slave, NULL, &tt, &win) == -1) err(1, "openpty"); - if (!qflg) + if (!qflg) { + tvec = time(NULL); (void)printf("Script started, output file is %s\n", fname); + (void)fprintf(fscript, "Script started on %s", ctime(&tvec)); + fflush(fscript); + } rtt = tt; cfmakeraw(&rtt); rtt.c_lflag &= ~ECHO; @@ -134,28 +151,59 @@ main(argc, argv) warn("fork"); fail(); } - if (child == 0) { - subchild = child = fork(); - if (child < 0) { - warn("fork"); - fail(); + if (child == 0) + doshell(argv); + + if (flushtime > 0) + tvp = &tv; + else + tvp = NULL; + + start = time(0); + FD_ZERO(&rfd); + for (;;) { + FD_SET(master, &rfd); + FD_SET(STDIN_FILENO, &rfd); + if (flushtime > 0) { + tv.tv_sec = flushtime; + tv.tv_usec = 0; + } + n = select(master + 1, &rfd, 0, 0, tvp); + if (n < 0 && errno != EINTR) + break; + if (n > 0 && FD_ISSET(STDIN_FILENO, &rfd)) { + cc = read(STDIN_FILENO, ibuf, BUFSIZ); + if (cc <= 0) + break; + if (cc > 0) { + (void)write(master, ibuf, cc); + if (kflg && tcgetattr(master, &stt) >= 0 && + ((stt.c_lflag & ECHO) == 0)) { + (void)fwrite(ibuf, 1, cc, fscript); + } + } + } + if (n > 0 && FD_ISSET(master, &rfd)) { + cc = read(master, obuf, sizeof (obuf)); + if (cc <= 0) + break; + (void)write(1, obuf, cc); + (void)fwrite(obuf, 1, cc, fscript); + } + tvec = time(0); + if (tvec - start >= flushtime) { + fflush(fscript); + start = tvec; } - if (child) - dooutput(); - else - doshell(argv); } - - (void)fclose(fscript); - while ((cc = read(STDIN_FILENO, ibuf, BUFSIZ)) > 0) - (void)write(master, ibuf, cc); done(); } static void usage() { - (void)fprintf(stderr, "usage: script [-a] [-q] [file] [command]\n"); + (void)fprintf(stderr, + "usage: script [-a] [-q] [-k] [-t time] [file] [command]\n"); exit(1); } @@ -176,45 +224,6 @@ finish(signo) } void -dooutput() -{ - struct itimerval value; - register int cc; - time_t tvec; - char obuf[BUFSIZ]; - - (void)close(STDIN_FILENO); - tvec = time(NULL); - if (!qflg) - (void)fprintf(fscript, "Script started on %s", ctime(&tvec)); - - (void)signal(SIGALRM, scriptflush); - value.it_interval.tv_sec = 60 / 2; - value.it_interval.tv_usec = 0; - value.it_value = value.it_interval; - (void)setitimer(ITIMER_REAL, &value, NULL); - for (;;) { - cc = read(master, obuf, sizeof (obuf)); - if (cc <= 0) - break; - (void)write(1, obuf, cc); - (void)fwrite(obuf, 1, cc, fscript); - outcc += cc; - } - done(); -} - -void -scriptflush(signo) - int signo; -{ - if (outcc) { - (void)fflush(fscript); - outcc = 0; - } -} - -void doshell(av) char **av; { @@ -248,16 +257,13 @@ done() { time_t tvec; - if (subchild) { - tvec = time(NULL); - if (!qflg) - (void)fprintf(fscript,"\nScript done on %s", ctime(&tvec)); - (void)fclose(fscript); - (void)close(master); - } else { - (void)tcsetattr(STDIN_FILENO, TCSAFLUSH, &tt); - if (!qflg) - (void)printf("Script done, output file is %s\n", fname); + (void)tcsetattr(STDIN_FILENO, TCSAFLUSH, &tt); + tvec = time(NULL); + if (!qflg) { + (void)fprintf(fscript,"\nScript done on %s", ctime(&tvec)); + (void)printf("\nScript done, output file is %s\n", fname); } + (void)fclose(fscript); + (void)close(master); exit(0); } diff --git a/usr.bin/sed/process.c b/usr.bin/sed/process.c index dbe7e8b73d43..dc1ea2f6500d 100644 --- a/usr.bin/sed/process.c +++ b/usr.bin/sed/process.c @@ -40,7 +40,7 @@ static char sccsid[] = "@(#)process.c 8.6 (Berkeley) 4/20/94"; #endif static const char rcsid[] = - "$Id$"; + "$Id: process.c,v 1.5.2.1 1997/08/12 06:36:13 charnier Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -240,7 +240,7 @@ redirect: if (pd) break; for (p = ps, len = psl; --len; ++p) - *p = cp->u.y[*p]; + *p = cp->u.y[(unsigned char)*p]; break; case ':': case '}': diff --git a/usr.bin/size/size.c b/usr.bin/size/size.c index 23169c956946..1e0921b4599b 100644 --- a/usr.bin/size/size.c +++ b/usr.bin/size/size.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)size.c 8.2 (Berkeley) 12/9/93"; #endif static const char rcsid[] = - "$Id: size.c,v 1.1.1.1.8.2 1997/08/29 05:29:54 imp Exp $"; + "$Id: size.c,v 1.1.1.1.8.3 1998/03/08 12:18:47 jkh Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -109,8 +109,8 @@ show(count, name) (void)printf("text\tdata\tbss\tdec\thex\n"); } total = head.a_text + head.a_data + head.a_bss; - (void)printf("%lu\t%lu\t%lu\t%lu\t%lx", head.a_text, head.a_data, - head.a_bss, total, total); + (void)printf("%lu\t%lu\t%lu\t%lu\t%lx", (u_long)head.a_text, + (u_long)head.a_data, (u_long)head.a_bss, total, total); if (count > 1) (void)printf("\t%s", name); (void)printf("\n"); diff --git a/usr.bin/su/su.1 b/usr.bin/su/su.1 index 905360fdd301..0e2799a1358c 100644 --- a/usr.bin/su/su.1 +++ b/usr.bin/su/su.1 @@ -30,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)su.1 8.2 (Berkeley) 4/18/94 -.\" $Id: su.1,v 1.3.2.7 1998/06/04 22:30:51 steve Exp $ +.\" $Id: su.1,v 1.3.2.8 1998/06/08 05:44:03 jkoshy Exp $ .\" .\" this is for hilit19's braindeadness: " .Dd April 18, 1994 @@ -144,7 +144,7 @@ overrides any previous ones. If the optional .Ar args are provided on the command line, they are passed to the login shell of -the target login. +the target login. .Pp Only users who are a member of group 0 (normally .Dq wheel ) @@ -199,18 +199,18 @@ You will be asked for man's password unless your real UID is 0. .It Li "su man -c 'catman /usr/share/man /usr/local/man /usr/X11R6/man'" Same as above, but the target command constitutes of more than a single word and hence is quoted for use with the -.Fl c +.Fl c option being passed to the shell. (Most shells expect the argument to .Fl c to be a single word). .It Li "su -c staff man -c 'catman /usr/share/man /usr/local/man /usr/X11R6/man'" -Same as above, but the target command is run with the resource limits of -the login class +Same as above, but the target command is run with the resource limits of +the login class .Dq staff . Note: in this example, the first -.Fl c -option applies to -.Nm +.Fl c +option applies to +.Nm while the second is an argument to the shell being invoked. .It Li "su -l foo" Pretend a login for user diff --git a/usr.bin/su/su.c b/usr.bin/su/su.c index fd7cdb18c934..2e5b147ee66a 100644 --- a/usr.bin/su/su.c +++ b/usr.bin/su/su.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)su.c 8.3 (Berkeley) 4/2/94"; #endif static const char rcsid[] = - "$Id: su.c,v 1.14.2.7 1998/05/26 06:28:30 danny Exp $"; + "$Id: su.c,v 1.14.2.8 1998/06/04 22:30:53 steve Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -169,7 +169,7 @@ main(argc, argv) break; } - if (strlen(user) > MAXLOGNAME) { + if (strlen(user) > MAXLOGNAME - 1) { (void)fprintf(stderr, "su: username too long.\n"); exit(1); } diff --git a/usr.bin/tail/extern.h b/usr.bin/tail/extern.h index f9a8bdfbf4ac..0ec272d6384e 100644 --- a/usr.bin/tail/extern.h +++ b/usr.bin/tail/extern.h @@ -48,5 +48,5 @@ int lines __P((FILE *, off_t)); void ierr __P((void)); void oerr __P((void)); -extern int fflag, rflag, rval; +extern int Fflag, fflag, rflag, rval; extern char *fname; diff --git a/usr.bin/tail/forward.c b/usr.bin/tail/forward.c index 1c4020d3c6df..31f5ea66fc16 100644 --- a/usr.bin/tail/forward.c +++ b/usr.bin/tail/forward.c @@ -86,6 +86,7 @@ forward(fp, style, off, sbp) { register int ch; struct timeval interval; + struct stat sb2; switch(style) { case FBYTES: @@ -179,6 +180,21 @@ forward(fp, style, off, sbp) (void) usleep(250000); clearerr(fp); + + if (Fflag && fileno(fp) != STDIN_FILENO && + stat(fname, &sb2) != -1) { + if (sb2.st_ino != sbp->st_ino || + sb2.st_dev != sbp->st_dev || + sb2.st_rdev != sbp->st_rdev || + sb2.st_nlink == 0) { + fp = freopen(fname, "r", fp); + if (fp == NULL) { + ierr(); + break; + } + *sbp = sb2; + } + } } } diff --git a/usr.bin/tail/reverse.c b/usr.bin/tail/reverse.c index 031b216d76cb..b7a3df46c3e8 100644 --- a/usr.bin/tail/reverse.c +++ b/usr.bin/tail/reverse.c @@ -39,7 +39,7 @@ static char sccsid[] = "@(#)reverse.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id: reverse.c,v 1.5.2.1 1997/08/14 06:34:42 charnier Exp $"; + "$Id: reverse.c,v 1.5.2.2 1998/03/08 13:29:46 jkh Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -228,7 +228,7 @@ r_buf(fp) } if (enomem) { - warnx("warning: %ld bytes discarded", enomem); + warnx("warning: %qd bytes discarded", enomem); rval = 1; } diff --git a/usr.bin/tail/tail.1 b/usr.bin/tail/tail.1 index 8c967372946b..be5a03f468f9 100644 --- a/usr.bin/tail/tail.1 +++ b/usr.bin/tail/tail.1 @@ -42,7 +42,11 @@ .Nd display the last part of a file .Sh SYNOPSIS .Nm -.Op Fl f Li | Fl r +.Oo +.Fl F | +.Fl f | +.Fl r +.Oc .Oo .Fl b Ar number | .Fl c Ar number | @@ -91,6 +95,20 @@ data to be appended to the input. The .Fl f option is ignored if the standard input is a pipe, but not if it is a FIFO. +.It Fl F +The +.Fl F +option implies the +.Fl f +option, but +.Nm +will also check to see if the file being followed has been renamed or rotated. +The file is closed and reopened when +.Nm +detects that the filename being read from has a new inode number. +The +.Fl F +option is ignored if reading from standard input rather than a file. .It Fl n Ar number The location is .Ar number @@ -136,6 +154,7 @@ utility is expected to be a superset of the .St -p1003.2-92 specification. In particular, the +.Fl F , .Fl b and .Fl r diff --git a/usr.bin/tail/tail.c b/usr.bin/tail/tail.c index 4c7ea6f6a9f5..454ef65ca176 100644 --- a/usr.bin/tail/tail.c +++ b/usr.bin/tail/tail.c @@ -54,7 +54,7 @@ static char sccsid[] = "@(#)tail.c 8.1 (Berkeley) 6/6/93"; #include <err.h> #include "extern.h" -int fflag, rflag, rval; +int Fflag, fflag, rflag, rval; char *fname; static void obsolete __P((char **)); @@ -107,8 +107,11 @@ main(argc, argv) obsolete(argv); style = NOTSET; - while ((ch = getopt(argc, argv, "b:c:fn:r")) != -1) + while ((ch = getopt(argc, argv, "Fb:c:fn:r")) != -1) switch(ch) { + case 'F': /* -F is superset of (and implies) -f */ + Fflag = fflag = 1; + break; case 'b': ARG(512, FBYTES, RBYTES); break; diff --git a/usr.bin/talk/ctl.c b/usr.bin/talk/ctl.c index 2f77608a2b7c..d4f109cb73af 100644 --- a/usr.bin/talk/ctl.c +++ b/usr.bin/talk/ctl.c @@ -109,7 +109,7 @@ print_addr(addr) int i; printf("addr = %lx, port = %o, family = %o zero = ", - addr.sin_addr.s_addr, addr.sin_port, addr.sin_family); + (u_long)addr.sin_addr.s_addr, addr.sin_port, addr.sin_family); for (i = 0; i<8;i++) printf("%o ", (int)addr.sin_zero[i]); putchar('\n'); |
