diff --git a/bin/expr/expr.c b/bin/expr/expr.c index 850e0e926940..1bc7d0af526d 100644 --- a/bin/expr/expr.c +++ b/bin/expr/expr.c @@ -1,4 +1,4 @@ -/* $NetBSD: expr.c,v 1.5 1997/07/20 17:33:00 christos Exp $ */ +/* $NetBSD: expr.c,v 1.6 1998/07/27 17:06:48 mycroft Exp $ */ /* * Written by J.T. Conklin . @@ -174,7 +174,8 @@ to_string(vp) if (tmp == NULL) { err(2, "%s", ""); } - sprintf(tmp, "%d", vp->u.i); + (void)snprintf(tmp, 25, "%d", vp->u.i); + tmp[24] = '\0'; vp->type = string; vp->u.s = tmp; } diff --git a/bin/ls/ls.c b/bin/ls/ls.c index 7f2f66a46158..5dcf1f1a9184 100644 --- a/bin/ls/ls.c +++ b/bin/ls/ls.c @@ -1,4 +1,4 @@ -/* $NetBSD: ls.c,v 1.26 1998/05/16 15:12:26 lukem Exp $ */ +/* $NetBSD: ls.c,v 1.27 1998/07/27 17:06:48 mycroft Exp $ */ /* * Copyright (c) 1989, 1993, 1994 @@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993, 1994\n\ #if 0 static char sccsid[] = "@(#)ls.c 8.7 (Berkeley) 8/5/94"; #else -__RCSID("$NetBSD: ls.c,v 1.26 1998/05/16 15:12:26 lukem Exp $"); +__RCSID("$NetBSD: ls.c,v 1.27 1998/07/27 17:06:48 mycroft Exp $"); #endif #endif /* not lint */ @@ -115,7 +115,7 @@ main(argc, argv) struct winsize win; int ch, fts_options, notused; int kflag = 0; - char *p; + const char *p; /* Terminal defaults to -Cq, non-terminal defaults to -1. */ if (isatty(STDOUT_FILENO)) { @@ -401,7 +401,7 @@ display(p, list) int maxinode, maxnlink, maxmajor, maxminor; int bcfile, entries, flen, glen, ulen, maxflags, maxgroup, maxlen; int maxuser, needstats; - char *user, *group; + const char *user, *group; char buf[21]; /* 64 bits == 20 digits, +1 for NUL */ char nuser[12], ngroup[12]; char *flags = NULL; diff --git a/bin/mt/mt.c b/bin/mt/mt.c index e4b83df6fec6..fe453240a53b 100644 --- a/bin/mt/mt.c +++ b/bin/mt/mt.c @@ -1,4 +1,4 @@ -/* $NetBSD: mt.c,v 1.26 1998/07/04 02:14:22 mjacob Exp $ */ +/* $NetBSD: mt.c,v 1.27 1998/07/27 17:06:48 mycroft Exp $ */ /* * Copyright (c) 1980, 1993 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ #if 0 static char sccsid[] = "@(#)mt.c 8.2 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: mt.c,v 1.26 1998/07/04 02:14:22 mjacob Exp $"); +__RCSID("$NetBSD: mt.c,v 1.27 1998/07/27 17:06:48 mycroft Exp $"); #endif #endif /* not lint */ @@ -103,7 +103,7 @@ const struct commands com[] = { { NULL } }; -void printreg __P((char *, u_int, char *)); +void printreg __P((const char *, u_int, const char *)); void status __P((struct mtget *)); void usage __P((void)); int main __P((int, char *[])); @@ -117,7 +117,8 @@ main(argc, argv) struct mtget mt_status; struct mtop mt_com; int ch, len, mtfd, flags; - char *p, *tape; + char *p; + const char *tape; int count; if ((tape = getenv("TAPE")) == NULL) @@ -223,11 +224,11 @@ main(argc, argv) #include #endif -struct tape_desc { +const struct tape_desc { short t_type; /* type of magtape device */ - char *t_name; /* printing name */ - char *t_dsbits; /* "drive status" register */ - char *t_erbits; /* "error" register */ + const char *t_name; /* printing name */ + const char *t_dsbits; /* "drive status" register */ + const char *t_erbits; /* "error" register */ } tapes[] = { #ifdef sun { MT_ISCPC, "TapeMaster", TMS_BITS, 0 }, @@ -249,7 +250,7 @@ void status(bp) struct mtget *bp; { - struct tape_desc *mt; + const struct tape_desc *mt; for (mt = tapes;; mt++) { if (mt->t_type == 0) { @@ -277,9 +278,9 @@ status(bp) */ void printreg(s, v, bits) - char *s; + const char *s; u_int v; - char *bits; + const char *bits; { int i, any = 0; char c; diff --git a/bin/ps/print.c b/bin/ps/print.c index dd0c5242f34d..550e0c98216a 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -1,4 +1,4 @@ -/* $NetBSD: print.c,v 1.37 1998/04/01 14:19:27 kleink Exp $ */ +/* $NetBSD: print.c,v 1.38 1998/07/27 17:06:48 mycroft Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94"; #else -__RCSID("$NetBSD: print.c,v 1.37 1998/04/01 14:19:27 kleink Exp $"); +__RCSID("$NetBSD: print.c,v 1.38 1998/07/27 17:06:48 mycroft Exp $"); #endif #endif /* not lint */ @@ -323,7 +323,7 @@ tname(k, ve) { VAR *v; dev_t dev; - char *ttname; + const char *ttname; v = ve->var; dev = KI_EPROC(k)->e_tdev; @@ -344,7 +344,7 @@ longtname(k, ve) { VAR *v; dev_t dev; - char *ttname; + const char *ttname; v = ve->var; dev = KI_EPROC(k)->e_tdev; diff --git a/bin/ps/ps.c b/bin/ps/ps.c index c764dbae90de..3d89a6e3a8a4 100644 --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -1,4 +1,4 @@ -/* $NetBSD: ps.c,v 1.21 1998/07/06 07:50:18 mrg Exp $ */ +/* $NetBSD: ps.c,v 1.22 1998/07/27 17:06:48 mycroft Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 1993, 1994\n\ #if 0 static char sccsid[] = "@(#)ps.c 8.4 (Berkeley) 4/2/94"; #else -__RCSID("$NetBSD: ps.c,v 1.21 1998/07/06 07:50:18 mrg Exp $"); +__RCSID("$NetBSD: ps.c,v 1.22 1998/07/27 17:06:48 mycroft Exp $"); #endif #endif /* not lint */ @@ -120,6 +120,7 @@ main(argc, argv) int all, ch, flag, i, fmt, lineno, nentries; int prtheader, wflag, what, xflg; char *nlistf, *memf, *swapf, errbuf[_POSIX2_LINE_MAX]; + const char *ttname; (void)setegid(getgid()); if ((ioctl(STDOUT_FILENO, TIOCGWINSZ, (char *)&ws) == -1 && @@ -202,10 +203,12 @@ main(argc, argv) sumrusage = 1; break; case 'T': - if ((optarg = ttyname(STDIN_FILENO)) == NULL) + if ((ttname = ttyname(STDIN_FILENO)) == NULL) errx(1, "stdin: not a terminal"); - /* FALLTHROUGH */ - case 't': { + goto tty; + case 't': + ttname = optarg; + tty: { struct stat sb; char *ttypath, pathbuf[MAXPATHLEN];