diff options
| author | Jordan K. Hubbard <jkh@FreeBSD.org> | 1996-06-05 02:59:00 +0000 |
|---|---|---|
| committer | Jordan K. Hubbard <jkh@FreeBSD.org> | 1996-06-05 02:59:00 +0000 |
| commit | 78e55a1f29558e8be54566ead1e7be8ab9d45273 (patch) | |
| tree | 65fd45fa55d0cd3888b40a4f41dd3383616dfd74 /bin | |
| parent | 885f2f31b4599f4bc7468278c783c1c30f1f86ed (diff) | |
Notes
Diffstat (limited to 'bin')
55 files changed, 161 insertions, 225 deletions
diff --git a/bin/Makefile b/bin/Makefile index 1310471e6101..e2c4bcc8af20 100644 --- a/bin/Makefile +++ b/bin/Makefile @@ -1,7 +1,7 @@ # From: @(#)Makefile 8.1 (Berkeley) 5/31/93 # $Id: Makefile,v 1.2 1994/09/18 21:25:26 wollman Exp $ -SUBDIR= cat chmod cp csh date dd df domainname echo ed expr hostname \ +SUBDIR= cat chmod cp csh date dd df domainname echo ed expr hostname \ kill ln ls mkdir mv pax ps pwd rcp rm rmail rmdir sh sleep \ stty sync test diff --git a/bin/Makefile.inc b/bin/Makefile.inc index 5e19e782632a..4760782bef05 100644 --- a/bin/Makefile.inc +++ b/bin/Makefile.inc @@ -2,13 +2,3 @@ BINDIR?= /bin NOSHARED?= YES - -.if exists (${.CURDIR}/../../secure) - -.if exists(${.CURDIR}/../../secure/lib/libcipher/obj) -CIPHEROBJDIR= ${.CURDIR}/../../secure/lib/libcipher/obj -.else -CIPHEROBJDIR= ${.CURDIR}/../../secure/lib/libcipher -.endif - -.endif diff --git a/bin/cp/cp.1 b/bin/cp/cp.1 index 4841e41c666b..fad0c0acc72e 100644 --- a/bin/cp/cp.1 +++ b/bin/cp/cp.1 @@ -47,16 +47,14 @@ .Fl R .Op Fl H | Fl L | Fl P .Oc -.Op Fl f | i -.Op Fl p +.Op Fl fip .Ar source_file target_file .Nm cp .Oo .Fl R .Op Fl H | Fl L | Fl P .Oc -.Op Fl f | i -.Op Fl p +.Op Fl fip .Ar source_file ... target_directory .Sh DESCRIPTION In the first synopsis form, the @@ -107,25 +105,18 @@ For each existing destination pathname, remove it and create a new file, without prompting for confirmation regardless of its permissions. (The -.Fl f -option overrides any previous .Fl i -options.) +option is ignored if the +.Fl f +option is specified.) .It Fl i Causes .Nm cp to write a prompt to the standard error output before copying a file that would overwrite an existing file. If the response from the standard input begins with the character -.Sq Li y -or -.Sq Li Y , +.Sq Li y , the file copy is attempted. -(The -.Fl i -option overrides any previous -.Fl f -options.) .It Fl p Causes .Nm cp diff --git a/bin/cp/cp.c b/bin/cp/cp.c index 8b69f83b415b..cfbcd5636f3a 100644 --- a/bin/cp/cp.c +++ b/bin/cp/cp.c @@ -86,7 +86,7 @@ static char sccsid[] = "@(#)cp.c 8.2 (Berkeley) 4/1/94"; PATH_T to = { to.p_path, "" }; uid_t myuid; -int Rflag, iflag, pflag, rflag, fflag; +int Rflag, iflag, pflag, rflag; int myumask; enum op { FILE_TO_FILE, FILE_TO_DIR, DIR_TO_DNE }; @@ -104,7 +104,7 @@ main(argc, argv) int Hflag, Lflag, Pflag, ch, fts_options, r; char *target; - Hflag = Lflag = Pflag = 0; + Hflag = Lflag = Pflag = Rflag = 0; while ((ch = getopt(argc, argv, "HLPRfipr")) != EOF) switch (ch) { case 'H': @@ -123,12 +123,10 @@ main(argc, argv) Rflag = 1; break; case 'f': - fflag = 1; iflag = 0; break; case 'i': - iflag = 1; - fflag = 0; + iflag = isatty(fileno(stdin)); break; case 'p': pflag = 1; @@ -136,6 +134,7 @@ main(argc, argv) case 'r': rflag = 1; break; + case '?': default: usage(); break; diff --git a/bin/cp/extern.h b/bin/cp/extern.h index 6ca9910c3eb5..d97d76aa46d6 100644 --- a/bin/cp/extern.h +++ b/bin/cp/extern.h @@ -42,7 +42,7 @@ typedef struct { extern PATH_T to; extern uid_t myuid; -extern int iflag, pflag, fflag, myumask; +extern int iflag, pflag, myumask; #include <sys/cdefs.h> diff --git a/bin/cp/utils.c b/bin/cp/utils.c index 3d73c790a7c5..0f2c100c6a4b 100644 --- a/bin/cp/utils.c +++ b/bin/cp/utils.c @@ -86,21 +86,12 @@ copy_file(entp, dne) checkch = ch = getchar(); while (ch != '\n' && ch != EOF) ch = getchar(); - if (checkch != 'y' && checkch != 'Y') { + if (checkch != 'y') { (void)close(from_fd); return (0); } } - - if (fflag) { - /* remove existing destination file name, - * create a new file */ - (void)unlink(to.p_path); - to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT, - fs->st_mode & ~(S_ISUID | S_ISGID)); - } else - /* overwrite existing destination file name */ - to_fd = open(to.p_path, O_WRONLY | O_TRUNC, 0); + to_fd = open(to.p_path, O_WRONLY | O_TRUNC, 0); } else to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT, fs->st_mode & ~(S_ISUID | S_ISGID)); @@ -290,7 +281,7 @@ void usage() { (void)fprintf(stderr, "%s\n%s\n", -"usage: cp [-R [-H | -L | -P]] [-f | -i] [-p] src target", -" cp [-R [-H | -L | -P]] [-f | -i] [-p] src1 ... srcN directory"); +"usage: cp [-R [-H | -L | -P] [-fip] src target", +" cp [-R [-H | -L | -P] [-fip] src1 ... srcN directory"); exit(1); } diff --git a/bin/csh/const.c b/bin/csh/const.c index 0d6068b2d73f..7a6df42c26a6 100644 --- a/bin/csh/const.c +++ b/bin/csh/const.c @@ -47,9 +47,7 @@ Char STR0[] = { '0', '\0' }; Char STR1[] = { '1', '\0' }; Char STRHOME[] = { 'H', 'O', 'M', 'E', '\0' }; Char STRLANG[] = { 'L', 'A', 'N', 'G', '\0' }; -Char STRLC_ALL[] = { 'L', 'C', '_', 'A', 'L', 'L', '\0' }; -Char STRLC_CTYPE[] = { 'L', 'C', '_', 'C', 'T', 'Y', 'P', 'E', '\0' }; -Char STRLC_COLLATE[] = { 'L', 'C', '_', 'C', 'O', 'L', 'L', 'A', 'T', 'E', '\0' }; +Char STRLC_CTYPE[] = { 'L', 'C', '_', 'C', 'T', 'Y', 'P', 'E' ,'\0' }; Char STRLOGNAME[] = { 'L', 'O', 'G', 'N', 'A', 'M', 'E', '\0' }; Char STRLbrace[] = { '{', '\0' }; Char STRLparen[] = { '(', '\0' }; diff --git a/bin/csh/csh.1 b/bin/csh/csh.1 index 7400412ad7ad..7f179d85a466 100644 --- a/bin/csh/csh.1 +++ b/bin/csh/csh.1 @@ -1405,7 +1405,7 @@ of the names suffice. .Pp .It Ic login Terminate a login shell, replacing it with an instance of -.Pa /usr/bin/login. +.Pa /bin/login. This is one way to log off, included for compatibility with .Xr sh 1 . .Pp diff --git a/bin/csh/csh.c b/bin/csh/csh.c index 727cf4641349..98a719b9c892 100644 --- a/bin/csh/csh.c +++ b/bin/csh/csh.c @@ -186,9 +186,7 @@ main(argc, argv) AsciiOnly = k > 0377; } #else - AsciiOnly = getenv("LANG") == NULL && - getenv("LC_ALL") == NULL && - getenv("LC_CTYPE") == NULL; + AsciiOnly = getenv("LANG") == NULL && getenv("LC_CTYPE") == NULL; #endif /* NLS */ /* diff --git a/bin/csh/func.c b/bin/csh/func.c index 445d42edab01..cdf191659309 100644 --- a/bin/csh/func.c +++ b/bin/csh/func.c @@ -967,8 +967,7 @@ dosetenv(v, t) importpath(lp); dohash(NULL, NULL); } - else if (eq(vp, STRLANG) || eq(vp, STRLC_CTYPE) || - eq(vp, STRLC_ALL) || eq(vp, STRLC_COLLATE)) { + else if (eq(vp, STRLANG) || eq(vp, STRLC_CTYPE)) { #ifdef NLS int k; @@ -1016,8 +1015,7 @@ dounsetenv(v, t) if (!Gmatch(name, *v)) continue; maxi = 1; - if (eq(name, STRLANG) || eq(name, STRLC_CTYPE) || - eq(name, STRLC_ALL) || eq(name, STRLC_COLLATE)) { + if (eq(name, STRLANG) || eq(name, STRLC_CTYPE)) { #ifdef NLS int k; @@ -1027,7 +1025,6 @@ dounsetenv(v, t) AsciiOnly = k > 0377; #else AsciiOnly = getenv("LANG") == NULL && - getenv("LC_ALL") == NULL && getenv("LC_CTYPE") == NULL; #endif /* NLS */ } diff --git a/bin/date/date.c b/bin/date/date.c index 811cb9f88a34..af348ee15a92 100644 --- a/bin/date/date.c +++ b/bin/date/date.c @@ -54,7 +54,6 @@ static char sccsid[] = "@(#)date.c 8.1 (Berkeley) 5/31/93"; #include <string.h> #include <syslog.h> #include <unistd.h> -#include <locale.h> #include "extern.h" @@ -80,7 +79,6 @@ main(argc, argv) char *endptr; int set_timezone; - (void) setlocale(LC_TIME, ""); tz.tz_dsttime = tz.tz_minuteswest = 0; rflag = 0; set_timezone = 0; @@ -210,7 +208,7 @@ setthetime(p) /* convert broken-down time to GMT clock time */ if ((tval = mktime(lt)) == -1) - errx(1, "nonexistent time"); + badformat(); /* set the time */ if (nflag || netsettime(tval)) { diff --git a/bin/dd/dd.c b/bin/dd/dd.c index 55c4e76a06c8..89f3d3a207f0 100644 --- a/bin/dd/dd.c +++ b/bin/dd/dd.c @@ -61,7 +61,6 @@ static char sccsid[] = "@(#)dd.c 8.5 (Berkeley) 4/2/94"; #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <locale.h> #include "dd.h" #include "extern.h" @@ -85,7 +84,6 @@ main(argc, argv) int argc; char *argv[]; { - (void) setlocale(LC_CTYPE, ""); jcl(argv); setup(); diff --git a/bin/df/df.c b/bin/df/df.c index 701a9adac46c..d53fb960ee0f 100644 --- a/bin/df/df.c +++ b/bin/df/df.c @@ -386,7 +386,10 @@ ufs_df(file, maxwidth) sfsp->f_blocks = sblock.fs_dsize; sfsp->f_bfree = sblock.fs_cstotal.cs_nbfree * sblock.fs_frag + sblock.fs_cstotal.cs_nffree; - sfsp->f_bavail = freespace(&sblock, sblock.fs_minfree); + sfsp->f_bavail = (sblock.fs_dsize * (100 - sblock.fs_minfree) / 100) - + (sblock.fs_dsize - sfsp->f_bfree); + if (sfsp->f_bavail < 0) + sfsp->f_bavail = 0; sfsp->f_files = sblock.fs_ncg * sblock.fs_ipg; sfsp->f_ffree = sblock.fs_cstotal.cs_nifree; sfsp->f_fsid.val[0] = 0; diff --git a/bin/echo/echo.1 b/bin/echo/echo.1 index d045b3dcc67c..e97ac08c837c 100644 --- a/bin/echo/echo.1 +++ b/bin/echo/echo.1 @@ -55,9 +55,7 @@ output. The following option is available: .Bl -tag -width flag .It Fl n -Do not print the trailing newline character. This may also be -achieved by appending `\ec' to the end of the string, as is done -by iBCS2 compatible systems. +Do not print the trailing newline character. .El .Pp The diff --git a/bin/echo/echo.c b/bin/echo/echo.c index e604765e48a3..e12f0a6e9ee9 100644 --- a/bin/echo/echo.c +++ b/bin/echo/echo.c @@ -62,14 +62,8 @@ main(argc, argv) else nflag = 0; - while (argv[0]) { - int len = strlen(argv[0]); - - if (len >= 2 && !argv[1] && argv[0][len - 2] == '\\' && argv[0][len - 1] == 'c') { - argv[0][len - 2] = '\0'; - nflag = 1; - } - (void)printf("%s", argv[0]); + while (*argv) { + (void)printf("%s", *argv); if (*++argv) putchar(' '); } diff --git a/bin/ed/Makefile b/bin/ed/Makefile index fa13ceb61946..7da27f20079f 100644 --- a/bin/ed/Makefile +++ b/bin/ed/Makefile @@ -1,15 +1,8 @@ # $Id: Makefile,v 1.10 1994/12/18 15:15:10 jkh Exp $ PROG= ed -SRCS= buf.c cbc.c glbl.c io.c main.c re.c sub.c undo.c +SRCS= buf.c cbc.c glbl.c io.c main.c re.c sub.c undo.c LINKS= ${BINDIR}/ed ${BINDIR}/red MLINKS= ed.1 red.1 -.if exists(../../secure) && !defined(NOCRYPT) && !defined(NOSECURE) -DISTRIBUTION=des -CFLAGS+=-DDES -LDADD+= -L${CIPHEROBJDIR} -lcipher -DPADD+= ${CIPHEROBJDIR}/libcipher.a -.endif - .include <bsd.prog.mk> diff --git a/bin/ed/io.c b/bin/ed/io.c index 99e832acbb7b..f4b4f76ba17a 100644 --- a/bin/ed/io.c +++ b/bin/ed/io.c @@ -58,7 +58,7 @@ read_file(fn, n) sprintf(errmsg, "cannot close input file"); return ERR; } - fprintf(stdout, !scripted ? "%lu\n" : "", size); + fprintf(stderr, !scripted ? "%lu\n" : "", size); return current_addr - n; } @@ -173,7 +173,7 @@ write_file(fn, mode, n, m) sprintf(errmsg, "cannot close output file"); return ERR; } - fprintf(stdout, !scripted ? "%lu\n" : "", size); + fprintf(stderr, !scripted ? "%lu\n" : "", size); return n ? m - n + 1 : 0; } diff --git a/bin/expr/Makefile b/bin/expr/Makefile index 63c0055d945d..71cf46a00383 100644 --- a/bin/expr/Makefile +++ b/bin/expr/Makefile @@ -7,7 +7,7 @@ CLEANFILES+= expr.c y.tab.h expr.c: ${YACC} -d ${.IMPSRC} - mv -f y.tab.c expr.c + mv y.tab.c expr.c .include <bsd.prog.mk> diff --git a/bin/hostname/hostname.1 b/bin/hostname/hostname.1 index 68548f748813..5493b2579a78 100644 --- a/bin/hostname/hostname.1 +++ b/bin/hostname/hostname.1 @@ -58,7 +58,7 @@ Trims off any domain information from the printed name. .El .Sh SEE ALSO -.Xr gethostname 3 +.Xr gethostname 2 .Sh HISTORY The .Nm hostname diff --git a/bin/ln/ln.c b/bin/ln/ln.c index b9c4f3f1eed5..69ae926cabce 100644 --- a/bin/ln/ln.c +++ b/bin/ln/ln.c @@ -53,6 +53,7 @@ static char sccsid[] = "@(#)ln.c 8.2 (Berkeley) 3/31/94"; #include <string.h> #include <unistd.h> +int dirflag; /* Undocumented directory flag. */ int fflag; /* Unlink existing files. */ int sflag; /* Symbolic, not hard, link. */ /* System link call. */ @@ -71,8 +72,11 @@ main(argc, argv) int ch, exitval; char *sourcedir; - while ((ch = getopt(argc, argv, "fs")) != EOF) + while ((ch = getopt(argc, argv, "Ffs")) != EOF) switch (ch) { + case 'F': + dirflag = 1; /* XXX: deliberately undocumented. */ + break; case 'f': fflag = 1; break; @@ -123,10 +127,9 @@ linkit(target, source, isdir) warn("%s", target); return (1); } - /* Only symbolic links to directories. */ - if (S_ISDIR(sb.st_mode)) { - errno = EISDIR; - warn("%s", target); + /* Only symbolic links to directories, unless -F option used. */ + if (!dirflag && (sb.st_mode & S_IFMT) == S_IFDIR) { + warnx("%s: is a directory", target); return (1); } } diff --git a/bin/ls/ls.c b/bin/ls/ls.c index a02b1fbf8a38..c125d678e543 100644 --- a/bin/ls/ls.c +++ b/bin/ls/ls.c @@ -58,7 +58,6 @@ static char sccsid[] = "@(#)ls.c 8.5 (Berkeley) 4/2/94"; #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <locale.h> #include "ls.h" #include "extern.h" @@ -105,8 +104,6 @@ main(argc, argv) int ch, fts_options, notused; char *p; - (void) setlocale(LC_ALL, ""); - /* Terminal defaults to -Cq, non-terminal defaults to -1. */ if (isatty(STDOUT_FILENO)) { if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &win) == -1 || diff --git a/bin/ls/print.c b/bin/ls/print.c index d6a2bc7d2354..54e76bbfa8d5 100644 --- a/bin/ls/print.c +++ b/bin/ls/print.c @@ -53,6 +53,7 @@ static char sccsid[] = "@(#)print.c 8.4 (Berkeley) 4/17/94"; #include <string.h> #include <time.h> #include <unistd.h> +#include <utmp.h> #include "ls.h" #include "extern.h" @@ -107,12 +108,8 @@ printlong(dp) if (f_flags) (void)printf("%-*s ", dp->s_flags, np->flags); if (S_ISCHR(sp->st_mode) || S_ISBLK(sp->st_mode)) - if (minor(sp->st_rdev) > 255) - (void)printf("%3d, 0x%08x ", - major(sp->st_rdev), minor(sp->st_rdev)); - else - (void)printf("%3d, %3d ", - major(sp->st_rdev), minor(sp->st_rdev)); + (void)printf("%3d, %3d ", + major(sp->st_rdev), minor(sp->st_rdev)); else if (dp->bcfile) (void)printf("%*s%*qd ", 8 - dp->s_size, "", dp->s_size, sp->st_size); diff --git a/bin/ls/util.c b/bin/ls/util.c index d16ab6aa7a14..12679945cc8f 100644 --- a/bin/ls/util.c +++ b/bin/ls/util.c @@ -57,7 +57,7 @@ prcopy(src, dest, len) char *src, *dest; int len; { - unsigned char ch; + int ch; while (len--) { ch = *src++; diff --git a/bin/mv/mv.1 b/bin/mv/mv.1 index 9ad2ea34d050..c79f74a3271c 100644 --- a/bin/mv/mv.1 +++ b/bin/mv/mv.1 @@ -77,25 +77,17 @@ The following options are available: Do not prompt for confirmation before overwriting the destination path. (The -.Fl f -option overrides any previous .Fl i -options.) +option is ignored if the +.Fl f +option is specified.) .It Fl i Causes .Nm mv to write a prompt to standard error before moving a file that would overwrite an existing file. -If the response from the standard input begins with the character -.Sq Li y -or -.Sq Li Y , +If the response from the standard input begins with the character ``y'', the move is attempted. -(The -.Fl i -option overrides any previous -.Fl f -options.) .El .Pp It is an error for either the @@ -129,7 +121,6 @@ The utility exits 0 on success, and >0 if an error occurs. .Sh SEE ALSO .Xr cp 1 , -.Xr rm 1 , .Xr symlink 7 .Sh STANDARDS The diff --git a/bin/mv/mv.c b/bin/mv/mv.c index 1486052ddaa5..41c71bd12b4f 100644 --- a/bin/mv/mv.c +++ b/bin/mv/mv.c @@ -79,20 +79,21 @@ main(argc, argv) int ch; char path[MAXPATHLEN + 1]; - while ((ch = getopt(argc, argv, "fi")) != EOF) + while ((ch = getopt(argc, argv, "-if")) != EOF) switch (ch) { case 'i': iflg = 1; - fflg = 0; break; case 'f': fflg = 1; - iflg = 0; break; + case '-': /* Undocumented; for compatibility. */ + goto endarg; + case '?': default: usage(); } - argc -= optind; +endarg: argc -= optind; argv += optind; if (argc < 2) @@ -151,13 +152,6 @@ do_move(from, to) * make sure the user wants to clobber it. */ if (!fflg && !access(to, F_OK)) { - - /* prompt only if source exist */ - if (lstat(from, &sb) == -1) { - warn("%s", from); - return (1); - } - ask = 0; if (iflg) { (void)fprintf(stderr, "overwrite %s? ", to); @@ -173,7 +167,7 @@ do_move(from, to) if (ask) { if ((ch = getchar()) != EOF && ch != '\n') while (getchar() != '\n'); - if (ch != 'y' && ch != 'Y') + if (ch != 'y') return (0); } } @@ -308,8 +302,7 @@ copy(from, to) void usage() { - (void)fprintf(stderr, "%s\n%s\n", - "usage: mv [-f | -i] src target", - " mv [-f | -i] src1 ... srcN directory"); + (void)fprintf(stderr, +"usage: mv [-if] src target;\n or: mv [-if] src1 ... srcN directory\n"); exit(1); } diff --git a/bin/pax/ar_io.c b/bin/pax/ar_io.c index 827a02d2224d..9bf75662f15d 100644 --- a/bin/pax/ar_io.c +++ b/bin/pax/ar_io.c @@ -52,6 +52,7 @@ static char sccsid[] = "@(#)ar_io.c 8.2 (Berkeley) 4/18/94"; #include <fcntl.h> #include <unistd.h> #include <stdio.h> +#include <ctype.h> #include <errno.h> #include <stdlib.h> #include "pax.h" diff --git a/bin/pax/ar_subs.c b/bin/pax/ar_subs.c index 7777afb79f41..79cbe0338a9a 100644 --- a/bin/pax/ar_subs.c +++ b/bin/pax/ar_subs.c @@ -48,6 +48,7 @@ static char sccsid[] = "@(#)ar_subs.c 8.2 (Berkeley) 4/18/94"; #include <signal.h> #include <string.h> #include <stdio.h> +#include <ctype.h> #include <fcntl.h> #include <errno.h> #include <unistd.h> diff --git a/bin/pax/buf_subs.c b/bin/pax/buf_subs.c index fa6f925ac3b1..1cca4138b270 100644 --- a/bin/pax/buf_subs.c +++ b/bin/pax/buf_subs.c @@ -46,6 +46,7 @@ static char sccsid[] = "@(#)buf_subs.c 8.2 (Berkeley) 4/18/94"; #include <sys/stat.h> #include <sys/param.h> #include <stdio.h> +#include <ctype.h> #include <errno.h> #include <unistd.h> #include <stdlib.h> diff --git a/bin/pax/cache.c b/bin/pax/cache.c index 6ffe469ac7c4..5e8770fd70b5 100644 --- a/bin/pax/cache.c +++ b/bin/pax/cache.c @@ -47,6 +47,7 @@ static char sccsid[] = "@(#)cache.c 8.1 (Berkeley) 5/31/93"; #include <sys/param.h> #include <string.h> #include <stdio.h> +#include <ctype.h> #include <pwd.h> #include <grp.h> #include <unistd.h> diff --git a/bin/pax/cpio.c b/bin/pax/cpio.c index e3fd4f1a420d..f0b0586e7a33 100644 --- a/bin/pax/cpio.c +++ b/bin/pax/cpio.c @@ -46,6 +46,7 @@ static char sccsid[] = "@(#)cpio.c 8.1 (Berkeley) 5/31/93"; #include <sys/stat.h> #include <sys/param.h> #include <string.h> +#include <ctype.h> #include <stdio.h> #include <unistd.h> #include <stdlib.h> diff --git a/bin/pax/file_subs.c b/bin/pax/file_subs.c index 107a1003329e..e8c6fd345d58 100644 --- a/bin/pax/file_subs.c +++ b/bin/pax/file_subs.c @@ -49,6 +49,7 @@ static char sccsid[] = "@(#)file_subs.c 8.1 (Berkeley) 5/31/93"; #include <fcntl.h> #include <string.h> #include <stdio.h> +#include <ctype.h> #include <errno.h> #include <sys/uio.h> #include <stdlib.h> diff --git a/bin/pax/ftree.c b/bin/pax/ftree.c index 375e62071693..36bdecf6ba35 100644 --- a/bin/pax/ftree.c +++ b/bin/pax/ftree.c @@ -48,6 +48,7 @@ static char sccsid[] = "@(#)ftree.c 8.2 (Berkeley) 4/18/94"; #include <unistd.h> #include <string.h> #include <stdio.h> +#include <ctype.h> #include <errno.h> #include <stdlib.h> #include <fts.h> diff --git a/bin/pax/gen_subs.c b/bin/pax/gen_subs.c index dc0d5a07280c..8fb957514b5d 100644 --- a/bin/pax/gen_subs.c +++ b/bin/pax/gen_subs.c @@ -46,6 +46,7 @@ static char sccsid[] = "@(#)gen_subs.c 8.1 (Berkeley) 5/31/93"; #include <sys/stat.h> #include <sys/param.h> #include <stdio.h> +#include <ctype.h> #include <utmp.h> #include <unistd.h> #include <stdlib.h> diff --git a/bin/pax/options.c b/bin/pax/options.c index 53a9ad6b06a2..da5229829a06 100644 --- a/bin/pax/options.c +++ b/bin/pax/options.c @@ -47,6 +47,7 @@ static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 4/18/94"; #include <sys/mtio.h> #include <sys/param.h> #include <stdio.h> +#include <ctype.h> #include <string.h> #include <unistd.h> #include <stdlib.h> diff --git a/bin/pax/pat_rep.c b/bin/pax/pat_rep.c index 451a9dfc0a2f..6c43f37ab191 100644 --- a/bin/pax/pat_rep.c +++ b/bin/pax/pat_rep.c @@ -46,6 +46,7 @@ static char sccsid[] = "@(#)pat_rep.c 8.2 (Berkeley) 4/18/94"; #include <sys/stat.h> #include <sys/param.h> #include <stdio.h> +#include <ctype.h> #include <string.h> #include <unistd.h> #include <stdlib.h> diff --git a/bin/pax/pax.c b/bin/pax/pax.c index 5d5e31f21e68..6b9ee71d8ee6 100644 --- a/bin/pax/pax.c +++ b/bin/pax/pax.c @@ -57,7 +57,6 @@ static char sccsid[] = "@(#)pax.c 8.2 (Berkeley) 4/18/94"; #include <unistd.h> #include <stdlib.h> #include <errno.h> -#include <locale.h> #include "pax.h" #include "extern.h" static int gen_init __P((void)); @@ -228,7 +227,6 @@ main(argc, argv) char **argv; #endif { - (void) setlocale(LC_TIME, ""); /* * parse options, determine operational mode, general init */ diff --git a/bin/pax/sel_subs.c b/bin/pax/sel_subs.c index e759bdb58dbc..2af13397a5af 100644 --- a/bin/pax/sel_subs.c +++ b/bin/pax/sel_subs.c @@ -48,6 +48,7 @@ static char sccsid[] = "@(#)sel_subs.c 8.1 (Berkeley) 5/31/93"; #include <pwd.h> #include <grp.h> #include <stdio.h> +#include <ctype.h> #include <string.h> #include <strings.h> #include <unistd.h> diff --git a/bin/pax/tables.c b/bin/pax/tables.c index b0694176c06d..5cc749d9dd93 100644 --- a/bin/pax/tables.c +++ b/bin/pax/tables.c @@ -47,6 +47,7 @@ static char sccsid[] = "@(#)tables.c 8.1 (Berkeley) 5/31/93"; #include <sys/param.h> #include <sys/fcntl.h> #include <stdio.h> +#include <ctype.h> #include <string.h> #include <unistd.h> #include <errno.h> diff --git a/bin/pax/tar.c b/bin/pax/tar.c index a88f6585c090..48a6ebfda0b9 100644 --- a/bin/pax/tar.c +++ b/bin/pax/tar.c @@ -47,6 +47,7 @@ static char sccsid[] = "@(#)tar.c 8.2 (Berkeley) 4/18/94"; #include <sys/param.h> #include <string.h> #include <stdio.h> +#include <ctype.h> #include <unistd.h> #include <stdlib.h> #include "pax.h" diff --git a/bin/pax/tty_subs.c b/bin/pax/tty_subs.c index 0c47facdca90..ef507c1808da 100644 --- a/bin/pax/tty_subs.c +++ b/bin/pax/tty_subs.c @@ -47,6 +47,7 @@ static char sccsid[] = "@(#)tty_subs.c 8.2 (Berkeley) 4/18/94"; #include <sys/param.h> #include <fcntl.h> #include <stdio.h> +#include <ctype.h> #include <errno.h> #include <unistd.h> #include <stdlib.h> diff --git a/bin/ps/Makefile b/bin/ps/Makefile index d7d3094bb65f..dea0ff4e821d 100644 --- a/bin/ps/Makefile +++ b/bin/ps/Makefile @@ -4,7 +4,7 @@ PROG= ps SRCS= fmt.c keyword.c nlist.c print.c ps.c CFLAGS+=-I/sys -DPADD= ${LIBM} ${LIBKVM} +DPADD= ${LIBMATH} ${LIBKVM} LDADD= -lm -lkvm BINGRP= kmem BINMODE=2555 diff --git a/bin/ps/fmt.c b/bin/ps/fmt.c index 8231c73850be..23d6adb6acc4 100644 --- a/bin/ps/fmt.c +++ b/bin/ps/fmt.c @@ -41,6 +41,7 @@ static char sccsid[] = "@(#)fmt.c 8.4 (Berkeley) 4/15/94"; #include <sys/syslimits.h> #include <sys/time.h> #include <sys/resource.h> +#include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c index 4fb2bd28969f..3b2f5a3bdc7c 100644 --- a/bin/ps/keyword.c +++ b/bin/ps/keyword.c @@ -57,7 +57,6 @@ static char sccsid[] = "@(#)keyword.c 8.5 (Berkeley) 4/2/94"; #ifdef NEWVM #include <sys/ucred.h> -#include <sys/user.h> #include <sys/sysctl.h> #endif diff --git a/bin/ps/print.c b/bin/ps/print.c index b1d76ee28c77..be2a4d089a4a 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -49,7 +49,6 @@ static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94"; #ifdef NEWVM #include <sys/ucred.h> -#include <sys/user.h> #include <sys/sysctl.h> #include <vm/vm.h> #else @@ -419,7 +418,7 @@ wchan(k, ve) (void)printf("%-*s", v->width, "-"); } -#define pgtok(a) (((a)*getpagesize())/1024) +#define pgtok(a) (((a)*NBPG)/1024) void vsize(k, ve) @@ -575,7 +574,7 @@ getpmem(k) /* XXX want pmap ptpages, segtab, etc. (per architecture) */ szptudot = UPAGES; /* XXX don't have info about shared */ - fracmem = ((float)e->e_vm.vm_rssize + szptudot)/getpagesize()/mempages; + fracmem = ((float)e->e_vm.vm_rssize + szptudot)/CLSIZE/mempages; #endif return (100.0 * fracmem); } @@ -612,7 +611,7 @@ maxrss(k, ve) v = ve->var; #ifndef NEWVM /* not yet */ - if (KI_PROC(k)->p_maxrss != (RLIM_INFINITY/PAGE_SIZE)) + if (KI_PROC(k)->p_maxrss != (RLIM_INFINITY/NBPG)) (void)printf("%*d", v->width, pgtok(KI_PROC(k)->p_maxrss)); else #endif diff --git a/bin/ps/ps.1 b/bin/ps/ps.1 index e77ab9975730..250df97815cf 100644 --- a/bin/ps/ps.1 +++ b/bin/ps/ps.1 @@ -186,29 +186,46 @@ fields to exceed 100%. .It %mem The percentage of real memory used by this process. .It flags -The flags associated with the process as in +The flags (in hexadecimal) associated with the process as in the include file .Aq Pa sys/proc.h : -.Bl -column P_NOCLDSTOP P_NOCLDSTOP -.It Dv "P_ADVLOCK" Ta No "0x00001 Process may hold a POSIX advisory lock" -.It Dv "P_CONTROLT" Ta No "0x00002 Has a controlling terminal" -.It Dv "P_INMEM" Ta No "0x00004 Loaded into memory" -.It Dv "P_NOCLDSTOP" Ta No "0x00008 No SIGCHLD when children stop" -.It Dv "P_PPWAIT" Ta No "0x00010 Parent is waiting for child to exec/exit" -.It Dv "P_PROFIL" Ta No "0x00020 Has started profiling" -.It Dv "P_SELECT" Ta No "0x00040 Selecting; wakeup/waiting danger" -.It Dv "P_SINTR" Ta No "0x00080 Sleep is interruptible" -.It Dv "P_SUGID" Ta No "0x00100 Had set id privileges since last exec" -.It Dv "P_SYSTEM" Ta No "0x00200 System proc: no sigs, stats or swapping" -.It Dv "P_TIMEOUT" Ta No "0x00400 Timing out during sleep" -.It Dv "P_TRACED" Ta No "0x00800 Debugged process being traced" -.It Dv "P_WAITED" Ta No "0x01000 Debugging process has waited for child" -.It Dv "P_WEXIT" Ta No "0x02000 Working on exiting" -.It Dv "P_EXEC" Ta No "0x04000 Process called exec" -.It Dv "P_NOSWAP" Ta No "0x08000 Another flag to prevent swap out" -.It Dv "P_PHYSIO" Ta No "0x10000 Doing physical I/O" -.It Dv "P_OWEUPC" Ta No "0x20000 Owe process an addupc() call at next ast" -.It Dv "P_SWAPPING" Ta No "0x40000 Process is being swapped" +.Bl -column SNOCLDSTOP SNOCLDSTOP +.It Dv "SLOAD" Ta No "0x0000001 in core" +.It Dv "SSYS" Ta No "0x0000002 swapper or pager process" +.It Dv "SLOCK" Ta No "0x0000004 process being swapped out" +.It Dv "SSWAP" Ta No "0x0000008 save area flag" +.It Dv "STRC" Ta No "0x0000010 process is being traced" +.It Dv "SWTED" Ta No "0x0000020 another tracing flag" +.It Dv "SSINTR" Ta No "0x0000040 sleep is interruptible" +.It Dv "SKEEP" Ta No "0x0000100 another flag to prevent swap out" +.It Dv "SOMASK" Ta No "0x0000200 restore old mask after taking signal" +.It Dv "SWEXIT" Ta No "0x0000400 working on exiting" +.It Dv "SPHYSIO" Ta No "0x0000800 doing physical" +.Tn I/O +.It Dv "SVFORK" Ta No "0x0001000 process resulted from" +.Xr vfork 2 +.It Dv "SVFDONE" Ta No "0x0002000 another" +.Xr vfork +flag +.It Dv "SNOVM" Ta No "0x0004000 no vm, parent in a" +.Xr vfork +.It Dv "SPAGV" Ta No "0x0008000 init data space on demand, from vnode" +.It Dv "SSEQL" Ta No "0x0010000 user warned of sequential vm behavior" +.It Dv "SUANOM" Ta No "0x0020000 user warned of random vm behavior" +.It Dv "STIMO" Ta No "0x0040000 timing out during sleep" +.It Dv "SNOCLDSTOP" Ta No "0x0080000 no" +.Dv SIGCHLD +when children stop +.It Dv "SCTTY" Ta No "0x0100000 has a controlling terminal" +.It Dv "SOWEUPC" Ta No "0x0200000 owe process an addupc() call at next ast" +.\" the routine addupc is not documented in the man pages +.It Dv "SSEL" Ta No "0x0400000 selecting; wakeup/waiting danger" +.It Dv "SEXEC" Ta No "0x0800000 process called" +.Xr exec 2 +.It Dv "SHPUX" Ta No "0x1000000 \\*(tNHP-UX\\*(sP process +.Pq Dv HPUXCOMPAT +.It Dv "SULOCK" Ta No "0x2000000 locked in core after swap error" +.It Dv "SPTECHG" Ta No "0x4000000 pte's for process have changed" .El .It lim The soft limit on memory used, specified via a call to diff --git a/bin/ps/ps.c b/bin/ps/ps.c index 1684810314f7..0fe890abce87 100644 --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -57,15 +57,13 @@ static char sccsid[] = "@(#)ps.c 8.4 (Berkeley) 4/2/94"; #include <errno.h> #include <fcntl.h> #include <kvm.h> -#include <limits.h> #include <nlist.h> #include <paths.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <unistd.h> -#include <locale.h> #include <pwd.h> +#include <unistd.h> #include "ps.h" @@ -118,9 +116,7 @@ main(argc, argv) uid_t uid; int all, ch, flag, i, fmt, lineno, nentries; int prtheader, wflag, what, xflg; - char *nlistf, *memf, *swapf, errbuf[_POSIX2_LINE_MAX]; - - (void) setlocale(LC_ALL, ""); + char *nlistf, *memf, *swapf, errbuf[256]; if ((ioctl(STDOUT_FILENO, TIOCGWINSZ, (char *)&ws) == -1 && ioctl(STDERR_FILENO, TIOCGWINSZ, (char *)&ws) == -1 && diff --git a/bin/rcp/rcp.c b/bin/rcp/rcp.c index 34c38a852bde..5cedc6cb41f0 100644 --- a/bin/rcp/rcp.c +++ b/bin/rcp/rcp.c @@ -69,11 +69,9 @@ static char sccsid[] = "@(#)rcp.c 8.2 (Berkeley) 4/2/94"; #include "extern.h" #ifdef KERBEROS -#include <des.h> +#include <kerberosIV/des.h> #include <kerberosIV/krb.h> -#include "../../usr.bin/rlogin/krb.h" - char dst_realm_buf[REALM_SZ]; char *dest_realm = NULL; int use_kerberos = 1; @@ -592,21 +590,22 @@ sink(argc, argv) if (ch == '\n') *--cp = 0; +#define getnum(t) (t) = 0; while (isdigit(*cp)) (t) = (t) * 10 + (*cp++ - '0'); cp = buf; if (*cp == 'T') { setimes++; cp++; - mtime.tv_sec = strtol(cp, &cp, 10); - if (!cp || *cp++ != ' ') + getnum(mtime.tv_sec); + if (*cp++ != ' ') SCREWUP("mtime.sec not delimited"); - mtime.tv_usec = strtol(cp, &cp, 10); - if (!cp || *cp++ != ' ') + getnum(mtime.tv_usec); + if (*cp++ != ' ') SCREWUP("mtime.usec not delimited"); - atime.tv_sec = strtol(cp, &cp, 10); - if (!cp || *cp++ != ' ') + getnum(atime.tv_sec); + if (*cp++ != ' ') SCREWUP("atime.sec not delimited"); - atime.tv_usec = strtol(cp, &cp, 10); - if (!cp || *cp++ != '\0') + getnum(atime.tv_usec); + if (*cp++ != '\0') SCREWUP("atime.usec not delimited"); (void)write(rem, "", 1); continue; diff --git a/bin/rm/rm.1 b/bin/rm/rm.1 index 693c1cf35705..31aba2cfe6ce 100644 --- a/bin/rm/rm.1 +++ b/bin/rm/rm.1 @@ -118,26 +118,10 @@ removed. If an error occurs, .Nm rm exits with a value >0. -.Sh NOTE -.Nm rm -use -.Xr getopt 3 -parsing routine. Getopt accept a -.Sq Li -- -argument, which stop reading options, anything after this -is not an option. -So -.Nm rm -handle files whose names begins with a -.Sq Li - . -Example: - -``$ rm -- -filename''. .Sh SEE ALSO .Xr rmdir 1 , .Xr unlink 2 , .Xr fts 3 , -.Xr getopt 3 , .Xr symlink 7 .Sh BUGS The diff --git a/bin/rm/rm.c b/bin/rm/rm.c index 8df172f61cf0..ffe565505241 100644 --- a/bin/rm/rm.c +++ b/bin/rm/rm.c @@ -81,7 +81,7 @@ main(argc, argv) { int ch, rflag; - rflag = 0; + Pflag = rflag = 0; while ((ch = getopt(argc, argv, "dfiPRr")) != EOF) switch(ch) { case 'd': @@ -102,6 +102,7 @@ main(argc, argv) case 'r': /* Compatibility. */ rflag = 1; break; + case '?': default: usage(); } @@ -377,7 +378,7 @@ check(path, name, sp) first = ch = getchar(); while (ch != '\n' && ch != EOF) ch = getchar(); - return (first == 'y' || first == 'Y'); + return (first == 'y'); } #define ISDOT(a) ((a)[0] == '.' && (!(a)[1] || ((a)[1] == '.' && !(a)[2]))) @@ -409,6 +410,6 @@ void usage() { - (void)fprintf(stderr, "usage: rm [-f | -i] [-dPRr] file ...\n"); + (void)fprintf(stderr, "usage: rm [-dfiRr] file ...\n"); exit(1); } diff --git a/bin/rmail/rmail.c b/bin/rmail/rmail.c index b45ec457682e..d3f6221a211f 100644 --- a/bin/rmail/rmail.c +++ b/bin/rmail/rmail.c @@ -211,8 +211,6 @@ main(argc, argv) /* Save off from user's address; the last one wins. */ for (p = addrp; *p && !isspace(*p); ++p); *p = '\0'; - if (*addrp == '\0') - addrp = "<>"; if (from_user != NULL) free(from_user); if ((from_user = strdup(addrp)) == NULL) diff --git a/bin/sh/Makefile b/bin/sh/Makefile index d703e92b082b..ac48c2ced455 100644 --- a/bin/sh/Makefile +++ b/bin/sh/Makefile @@ -23,9 +23,6 @@ CLEANFILES+=\ token.def: mktokens sh ${.CURDIR}/mktokens -${.CURDIR}/builtins: - # just override the default rule - builtins.h builtins.c: ${.CURDIR}/mkbuiltins ${.CURDIR}/builtins cd ${.CURDIR}; sh mkbuiltins diff --git a/bin/sh/bltin/bltin.h b/bin/sh/bltin/bltin.h index 0300d14ba626..ee25eba9c14b 100644 --- a/bin/sh/bltin/bltin.h +++ b/bin/sh/bltin/bltin.h @@ -60,10 +60,10 @@ #define fputs outstr #define fflush flushout #define INITARGS(argv) -#define warnx(a, b, c) { \ - char buf[64]; \ - (void)snprintf(buf, sizeof(buf), a, b, c); \ - error(buf); \ +#define warnx(a, b, c) { \ + char buf[64]; \ + (void)snprintf(buf, sizeof(buf), a, b, c); \ + error(buf); \ } #else #undef NULL diff --git a/bin/sh/parser.c b/bin/sh/parser.c index d96667350e3d..2ade7328d00c 100644 --- a/bin/sh/parser.c +++ b/bin/sh/parser.c @@ -150,12 +150,29 @@ list(nlflag) { for (;;) { switch (readtoken()) { case TBACKGND: + if (n1->type == NCMD || n1->type == NPIPE) { + n1->ncmd.backgnd = 1; + } else if (n1->type == NREDIR) { + n1->type = NBACKGND; + } else { + n3 = (union node *)stalloc(sizeof (struct nredir)); + n3->type = NBACKGND; + n3->nredir.n = n1; + n3->nredir.redirect = NULL; + n1 = n3; + } + goto tsemi; case TNL: - parseheredoc(); - if (nlflag) - return n1; + tokpushback++; /* fall through */ - case TSEMI: +tsemi: case TSEMI: + if (readtoken() == TNL) { + parseheredoc(); + if (nlflag) + return n1; + } else { + tokpushback++; + } checkkwd = 2; if (tokendlist[peektoken()]) return n1; @@ -195,19 +212,6 @@ andor() { } else if (t == TOR) { t = NOR; } else { - if (t == TBACKGND) { - if (n1->type == NCMD || n1->type == NPIPE) { - n1->ncmd.backgnd = 1; - } else if (n1->type == NREDIR) { - n1->type = NBACKGND; - } else { - n3 = (union node *)stalloc(sizeof (struct nredir)); - n3->type = NBACKGND; - n3->nredir.n = n1; - n3->nredir.redirect = NULL; - n1 = n3; - } - } tokpushback++; return n1; } diff --git a/bin/stty/stty.1 b/bin/stty/stty.1 index e582a16ae103..8de1d8da1a7f 100644 --- a/bin/stty/stty.1 +++ b/bin/stty/stty.1 @@ -160,10 +160,10 @@ Signal (do not signal) on break. .It Cm ignpar Pq Fl ignpar -Ignore (do not ignore) characters with parity +Ignore (do not ignore) parity errors. .It Cm parmrk Pq Fl parmrk -Mark (do not mark) characters with parity errors. +Mark (do not mark) parity errors. .It Cm inpck Pq Fl inpck Enable (disable) input parity checking. @@ -235,7 +235,7 @@ output modes). Map (do not map) .Dv NL to -.Dv CR-NL +.DV CR-NL on output. .It Cm oxtabs Pq Fl oxtabs Expand (do not expand) tabs to spaces on output. diff --git a/bin/sync/sync.8 b/bin/sync/sync.8 index 513b7016810c..33c20574a302 100644 --- a/bin/sync/sync.8 +++ b/bin/sync/sync.8 @@ -64,9 +64,9 @@ function call. .Sh SEE ALSO .Xr sync 2 , .Xr fsync 2 , -.Xr update 4 , .Xr halt 8 , -.Xr reboot 8 +.Xr reboot 8 , +.Xr update 8 .Sh HISTORY A .Nm sync |
