summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorJordan K. Hubbard <jkh@FreeBSD.org>1998-07-16 09:35:53 +0000
committerJordan K. Hubbard <jkh@FreeBSD.org>1998-07-16 09:35:53 +0000
commit8fbfdc72cb8b9840eb2f2cf054d0be4bf28addd5 (patch)
tree9cbf799b47da8c47579f2b5a2c5631ffbb6bc27a /bin
parentb7d4f10dad0bd2d0bf0aa8a95cb1e596602469dc (diff)
Notes
Diffstat (limited to 'bin')
-rw-r--r--bin/echo/echo.18
-rw-r--r--bin/mkdir/mkdir.16
-rw-r--r--bin/mv/mv.119
-rw-r--r--bin/mv/mv.c10
-rw-r--r--bin/pax/ftree.c6
-rw-r--r--bin/pax/pax.160
-rw-r--r--bin/ps/fmt.c13
-rw-r--r--bin/pwd/pwd.14
-rw-r--r--bin/rcp/pathnames.h4
-rw-r--r--bin/rcp/rcp.135
-rw-r--r--bin/rcp/rcp.c35
-rw-r--r--bin/rm/rm.121
-rw-r--r--bin/rm/rm.c40
-rw-r--r--bin/rmail/rmail.84
-rw-r--r--bin/rmdir/rmdir.110
-rw-r--r--bin/rmdir/rmdir.c16
-rw-r--r--bin/sleep/sleep.18
-rw-r--r--bin/stty/gfmt.c8
-rw-r--r--bin/stty/key.c4
-rw-r--r--bin/stty/stty.112
-rw-r--r--bin/sync/sync.86
-rw-r--r--bin/test/test.114
22 files changed, 184 insertions, 159 deletions
diff --git a/bin/echo/echo.1 b/bin/echo/echo.1
index d045b3dcc67c..feebd9d1e101 100644
--- a/bin/echo/echo.1
+++ b/bin/echo/echo.1
@@ -33,7 +33,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)echo.1 8.1 (Berkeley) 7/22/93
-.\" $Id: echo.1,v 1.2 1994/09/24 02:55:17 davidg Exp $
+.\" $Id: echo.1,v 1.3 1995/08/31 17:25:54 jkh Exp $
.\"
.Dd July 22, 1993
.Dt ECHO 1
@@ -47,7 +47,7 @@
.Op "string ..."
.Sh DESCRIPTION
The
-.Nm echo
+.Nm
utility writes any specified operands, separated by single blank (`` '')
characters and followed by a newline (``\en'') character, to the standard
output.
@@ -61,13 +61,13 @@ by iBCS2 compatible systems.
.El
.Pp
The
-.Nm echo
+.Nm
utility exits 0 on success, and >0 if an error occurs.
.Sh SEE ALSO
.Xr printf 1
.Sh STANDARDS
The
-.Nm echo
+.Nm
utility is expected to be
.St -p1003.2
compatible.
diff --git a/bin/mkdir/mkdir.1 b/bin/mkdir/mkdir.1
index de42de3ed231..3b84125c2ed9 100644
--- a/bin/mkdir/mkdir.1
+++ b/bin/mkdir/mkdir.1
@@ -33,7 +33,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)mkdir.1 8.2 (Berkeley) 1/25/94
-.\" $Id: mkdir.1,v 1.3.2.1 1997/02/28 07:54:38 mpp Exp $
+.\" $Id: mkdir.1,v 1.3.2.2 1998/06/30 06:42:30 charnier Exp $
.\"
.Dd January 25, 1994
.Dt MKDIR 1
@@ -47,7 +47,7 @@
.Op Fl m Ar mode
.Ar directory_name ...
.Sh DESCRIPTION
-.Nm
+.Nm Mkdir
creates the directories named as operands, in the order specified,
using mode
.Li rwxrwxrwx (\&0777)
@@ -87,7 +87,7 @@ exits 0 if successful, and >0 if an error occurred.
.Xr rmdir 1
.Sh STANDARDS
The
-.Nm mkdir
+.Nm
utility is expected to be
.St -p1003.2
compatible.
diff --git a/bin/mv/mv.1 b/bin/mv/mv.1
index c67817f7f61b..5938aae70f64 100644
--- a/bin/mv/mv.1
+++ b/bin/mv/mv.1
@@ -33,7 +33,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)mv.1 8.1 (Berkeley) 5/31/93
-.\" $Id: mv.1,v 1.7 1996/08/29 18:06:04 wosch Exp $
+.\" $Id: mv.1,v 1.7.2.1 1998/02/15 11:16:27 jkh Exp $
.\"
.Dd May 31, 1993
.Dt MV 1
@@ -49,9 +49,8 @@
.Op Fl f | Fl i
.Ar source ... directory
.Sh DESCRIPTION
-.Pp
In its first form, the
-.Nm mv
+.Nm
utility renames the file named by the
.Ar source
operand to the destination path named by the
@@ -61,7 +60,7 @@ This form is assumed when the last operand does not name an already
existing directory.
.Pp
In its second form,
-.Nm mv
+.Nm
moves each file named by a
.Ar source
operand to a destination file in the existing directory named by the
@@ -82,8 +81,8 @@ option overrides any previous
.Fl i
options.)
.It Fl i
-Causes
-.Nm mv
+Cause
+.Nm
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
@@ -103,7 +102,7 @@ It is an error for either the
operand or the destination path to specify a directory unless both do.
.Pp
If the destination path does not have a mode which permits writing,
-.Nm mv
+.Nm
prompts the user for confirmation as specified for the
.Fl i
option.
@@ -111,7 +110,7 @@ option.
As the
.Xr rename 2
call does not work across file systems,
-.Nm mv
+.Nm
uses
.Xr cp 1
and
@@ -125,7 +124,7 @@ rm -f destination_path && \e
.Ed
.Pp
The
-.Nm mv
+.Nm
utility exits 0 on success, and >0 if an error occurs.
.Sh SEE ALSO
.Xr cp 1 ,
@@ -133,7 +132,7 @@ utility exits 0 on success, and >0 if an error occurs.
.Xr symlink 7
.Sh STANDARDS
The
-.Nm mv
+.Nm
utility is expected to be
.St -p1003.2
compatible.
diff --git a/bin/mv/mv.c b/bin/mv/mv.c
index 6a6ecbca34c8..5420b0d4bc35 100644
--- a/bin/mv/mv.c
+++ b/bin/mv/mv.c
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mv.c,v 1.8.2.2 1998/02/15 11:16:28 jkh Exp $
+ * $Id: mv.c,v 1.8.2.3 1998/05/25 22:45:42 steve Exp $
*/
#ifndef lint
@@ -78,7 +78,7 @@ main(argc, argv)
register char *p, *endp;
struct stat sb;
int ch;
- char path[MAXPATHLEN + 1];
+ char path[MAXPATHLEN];
while ((ch = getopt(argc, argv, "fi")) != -1)
switch (ch) {
@@ -110,6 +110,8 @@ main(argc, argv)
}
/* It's a directory, move each file into it. */
+ if (strlen(argv[argc - 1]) > sizeof(path) - 1)
+ errx(1, "%s: destination pathname too long", *argv);
(void)strcpy(path, argv[argc - 1]);
baselen = strlen(path);
endp = &path[baselen];
@@ -268,8 +270,8 @@ err: if (unlink(to))
oldmode = sbp->st_mode & ALLPERMS;
if (fchown(to_fd, sbp->st_uid, sbp->st_gid)) {
- warn("%s: set owner/group (was: %u/%u)", to, sbp->st_uid,
- sbp->st_gid);
+ warn("%s: set owner/group (was: %lu/%lu)", to,
+ (u_long)sbp->st_uid, (u_long)sbp->st_gid);
if (oldmode & (S_ISUID | S_ISGID)) {
warnx(
"%s: owner/group changed; clearing suid/sgid (mode was 0%03o)",
diff --git a/bin/pax/ftree.c b/bin/pax/ftree.c
index 63a867760d40..9abc3c68f6af 100644
--- a/bin/pax/ftree.c
+++ b/bin/pax/ftree.c
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ftree.c,v 1.4.2.2 1997/09/14 13:07:23 jkh Exp $
+ * $Id: ftree.c,v 1.4.2.3 1998/02/15 11:18:19 jkh Exp $
*/
#ifndef lint
@@ -506,14 +506,14 @@ next_file(arcn)
* have to read the symlink path from the file
*/
if ((cnt = readlink(ftent->fts_path, arcn->ln_name,
- PAXPATHLEN)) < 0) {
+ PAXPATHLEN - 1)) < 0) {
sys_warn(1, errno, "Unable to read symlink %s",
ftent->fts_path);
continue;
}
/*
* set link name length, watch out readlink does not
- * allways null terminate the link path
+ * allways NUL terminate the link path
*/
arcn->ln_name[cnt] = '\0';
arcn->ln_nlen = cnt;
diff --git a/bin/pax/pax.1 b/bin/pax/pax.1
index cb85a754bc84..321a4753c6ec 100644
--- a/bin/pax/pax.1
+++ b/bin/pax/pax.1
@@ -34,7 +34,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)pax.1 8.4 (Berkeley) 4/18/94
-.\" $Id: pax.1,v 1.3.2.1 1998/05/31 22:44:52 steve Exp $
+.\" $Id: pax.1,v 1.3.2.2 1998/06/30 06:42:49 charnier Exp $
.\"
.Dd April 18, 1994
.Dt PAX 1
@@ -194,7 +194,7 @@ The presence of the
and the
.Fl w
options specifies which of the following functional modes
-.Nm pax
+.Nm
will operate under:
.Em list , read , write ,
and
@@ -284,7 +284,7 @@ While processing a damaged archive during a
or
.Em list
operation,
-.Nm pax
+.Nm
will attempt to recover from media defects and will search through the archive
to locate and process the largest number of archive members possible (see the
.Fl E
@@ -317,7 +317,7 @@ be selected.
When a
.Ar pattern
operand does not select at least one archive member,
-.Nm pax
+.Nm
will write these
.Ar pattern
operands in a diagnostic message to
@@ -330,7 +330,7 @@ operand specifies the pathname of a file to be copied or archived.
When a
.Ar file
operand does not select at least one archive member,
-.Nm pax
+.Nm
will write these
.Ar file
operand pathnames in a diagnostic message to
@@ -357,7 +357,7 @@ and
as the mode argument.
When the selected archive format supports the specification of linked
files and these files cannot be linked while the archive is being extracted,
-.Nm pax
+.Nm
will write a diagnostic message to
.Dv standard error
and exit with a non-zero exit status at the completion of operation.
@@ -381,7 +381,7 @@ If an archive format is not specified with a
option, the format currently being used in the archive will be selected.
Any attempt to append to an archive in a format different from the
format already used in the archive will cause
-.Nm pax
+.Nm
to exit immediately
with a non-zero exit status.
The blocking size used in the archive volume where writing starts
@@ -450,7 +450,7 @@ or
.Em write ) .
A single archive may span multiple files and different archive devices.
When required,
-.Nm pax
+.Nm
will prompt for the pathname of the file or device of the next volume in the
archive.
.It Fl i
@@ -460,7 +460,7 @@ For each archive member matching a
operand or each file matching a
.Ar file
operand,
-.Nm pax
+.Nm
will prompt to
.Pa /dev/tty
giving the name of the file, its file mode and its modification time.
@@ -569,7 +569,7 @@ nor the
.Cm o
specification character is specified, or the user ID and group ID are not
preserved for any reason,
-.Nm pax
+.Nm
will not set the
.Dv S_ISUID
.Em ( setuid )
@@ -578,7 +578,7 @@ and
.Em ( setgid )
bits of the file mode.
If the preservation of any of these items fails for any reason,
-.Nm pax
+.Nm
will write a diagnostic message to
.Dv standard error .
Failure to preserve these items will affect the final exit status,
@@ -636,9 +636,9 @@ File or archive member names that substitute to the empty string
are not selected and will be skipped.
.It Fl t
Reset the access times of any file or directory read or accessed by
-.Nm pax
+.Nm
to be the same as they were before being read or accessed by
-.Nm pax .
+.Nm Ns .
.It Fl u
Ignore files that are older (having a less recent file modification time)
than a pre-existing file or archive member with the same name.
@@ -699,7 +699,7 @@ standard.
The default blocksize for this format is 5120 bytes.
Inode and device information about a file (used for detecting file hard links
by this format) which may be truncated by this format is detected by
-.Nm pax
+.Nm
and is repaired.
.It Ar bcpio
The old binary cpio format.
@@ -708,21 +708,21 @@ This format is not very portable and should not be used when other formats
are available.
Inode and device information about a file (used for detecting file hard links
by this format) which may be truncated by this format is detected by
-.Nm pax
+.Nm
and is repaired.
.It Ar sv4cpio
The System V release 4 cpio.
The default blocksize for this format is 5120 bytes.
Inode and device information about a file (used for detecting file hard links
by this format) which may be truncated by this format is detected by
-.Nm pax
+.Nm
and is repaired.
.It Ar sv4crc
The System V release 4 cpio with file crc checksums.
The default blocksize for this format is 5120 bytes.
Inode and device information about a file (used for detecting file hard links
by this format) which may be truncated by this format is detected by
-.Nm pax
+.Nm
and is repaired.
.It Ar tar
The old BSD tar format as found in BSD4.3.
@@ -790,20 +790,20 @@ archives to
.Ar limit .
With a positive
.Ar limit ,
-.Nm pax
+.Nm
will attempt to recover from an archive read error and will
continue processing starting with the next file stored in the archive.
A
.Ar limit
of 0 will cause
-.Nm pax
+.Nm
to stop operation after the first read error is detected on an archive volume.
A
.Ar limit
of
.Li NONE
will cause
-.Nm pax
+.Nm
to attempt to recover from read errors forever.
The default
.Ar limit
@@ -813,7 +813,7 @@ is a small positive number of retries.
Using this option with
.Li NONE
should be used with extreme caution as
-.Nm pax
+.Nm
may get stuck in an infinite loop on a very badly flawed archive.
.It Fl G Ar group
Select a file based on its
@@ -857,7 +857,7 @@ only files with a modification or inode change time of exactly that
time will be selected.
.Pp
When
-.Nm pax
+.Nm
is in the
.Em write
or
@@ -887,7 +887,7 @@ created and had their modification time reset to an older time (as what
happens when a file is extracted from an archive and the modification time
is preserved).
Time comparisons using both file times is useful when
-.Nm pax
+.Nm
is used to create a time based incremental archive (only files that were
changed during a specified time range will be archived).
.Pp
@@ -1093,7 +1093,7 @@ files with the same name found in the source file tree
.Pa home .
.Sh STANDARDS
The
-.Nm pax
+.Nm
utility is a superset of the
.St -p1003.2
standard.
@@ -1135,7 +1135,7 @@ An error occurred.
.El
.Pp
Whenever
-.Nm pax
+.Nm
cannot create a file or a link when reading an archive or cannot
find a file when writing an archive, or cannot preserve the user ID,
group ID, or file mode when the
@@ -1144,28 +1144,28 @@ option is specified, a diagnostic message is written to
.Dv standard error
and a non-zero exit status will be returned, but processing will continue.
In the case where pax cannot create a link to a file,
-.Nm pax
+.Nm
will not create a second copy of the file.
.Pp
If the extraction of a file from an archive is prematurely terminated by
a signal or error,
-.Nm pax
+.Nm
may have only partially extracted a file the user wanted.
Additionally, the file modes of extracted files and directories
may have incorrect file bits, and the modification and access times may be
wrong.
.Pp
If the creation of an archive is prematurely terminated by a signal or error,
-.Nm pax
+.Nm
may have only partially created the archive which may violate the specific
archive format specification.
.Pp
If while doing a
.Em copy ,
-.Nm pax
+.Nm
detects a file is about to overwrite itself, the file is not copied,
a diagnostic message is written to
.Dv standard error
and when
-.Nm pax
+.Nm
completes it will exit with a non-zero exit status.
diff --git a/bin/ps/fmt.c b/bin/ps/fmt.c
index d259fef8b4c6..8105aaacff9c 100644
--- a/bin/ps/fmt.c
+++ b/bin/ps/fmt.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: fmt.c,v 1.6 1995/10/23 21:03:40 ache Exp $
+ * $Id: fmt.c,v 1.6.2.1 1997/03/10 19:10:52 guido Exp $
*/
#ifndef lint
@@ -44,6 +44,7 @@ static char sccsid[] = "@(#)fmt.c 8.4 (Berkeley) 4/15/94";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include <vis.h>
#include "ps.h"
@@ -58,8 +59,16 @@ static char *
shquote(argv)
char **argv;
{
+ long arg_max;
char **p, *dst, *src;
- static char buf[4*ARG_MAX]; /* XXX */
+ static char *buf = NULL;
+
+ if (buf == NULL) {
+ if ((arg_max = sysconf(_SC_ARG_MAX)) == -1)
+ errx(1, "sysconf _SC_ARG_MAX failed");
+ if ((buf = malloc((4 * arg_max) + 1)) == NULL)
+ errx(1, "malloc failed");
+ }
if (*argv == 0) {
buf[0] = 0;
diff --git a/bin/pwd/pwd.1 b/bin/pwd/pwd.1
index 10b303988403..517199eeb4f6 100644
--- a/bin/pwd/pwd.1
+++ b/bin/pwd/pwd.1
@@ -33,7 +33,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)pwd.1 8.2 (Berkeley) 4/28/95
-.\" $Id: pwd.1,v 1.2.8.1 1997/02/28 07:54:40 mpp Exp $
+.\" $Id: pwd.1,v 1.2.8.2 1998/06/30 06:43:02 charnier Exp $
.\"
.Dd April 28, 1995
.Dt PWD 1
@@ -51,7 +51,7 @@ the standard output.
The pwd utility exits 0 on success, and >0 if an error occurs.
.Sh STANDARDS
The
-.Nm pwd
+.Nm
command is expected to be
.St -p1003.2
compatible.
diff --git a/bin/rcp/pathnames.h b/bin/rcp/pathnames.h
index 39158f0d49ca..761625412aac 100644
--- a/bin/rcp/pathnames.h
+++ b/bin/rcp/pathnames.h
@@ -31,10 +31,12 @@
* SUCH DAMAGE.
*
* @(#)pathnames.h 8.1 (Berkeley) 5/31/93
- * $Id$
+ * $Id: pathnames.h,v 1.2 1994/09/24 02:56:55 davidg Exp $
*/
#include <paths.h>
#define _PATH_CP "/bin/cp"
+#define _PATH_RCP "/bin/rcp"
+#define _PATH_RLOGIN "/usr/bin/rlogin"
#define _PATH_RSH "/usr/bin/rsh"
diff --git a/bin/rcp/rcp.1 b/bin/rcp/rcp.1
index 51c7d41cd3a5..740340a865ad 100644
--- a/bin/rcp/rcp.1
+++ b/bin/rcp/rcp.1
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)rcp.1 8.1 (Berkeley) 5/31/93
-.\" $Id: rcp.1,v 1.5 1997/02/22 14:05:21 peter Exp $
+.\" $Id: rcp.1,v 1.2.8.1 1997/02/28 07:54:41 mpp Exp $
.\"
.Dd May 31, 1993
.Dt RCP 1
@@ -58,26 +58,21 @@ argument is either a remote file name of the
form ``rname@rhost:path'', or a local file name (containing no `:' characters,
or a `/' before any `:'s).
.Pp
-.Bl -tag -width flag
+The following options are available:
+.Bl -tag -width indent
.It Fl K
-The
-.Fl K
-option turns off all Kerberos authentication.
+Turn off all Kerberos authentication.
.It Fl k
-The
-.Fl k
-option requests
-.Nm rcp
+Request
+.Nm
to obtain tickets
for the remote host in realm
.Ar realm
instead of the remote host's realm as determined by
.Xr krb_realmofhost 3 .
.It Fl p
-The
-.Fl p
-option causes
-.Nm rcp
+Cause
+.Nm
to attempt to preserve (duplicate) in its copies the modification
times and modes of the source files, ignoring the
.Ar umask .
@@ -89,16 +84,14 @@ modified by the
on the destination host is used.
.It Fl r
If any of the source files are directories,
-.Nm rcp
+.Nm
copies each subtree rooted at that name; in this case
the destination must be a directory.
.It Fl x
-The
-.Fl x
-option turns on
+Turn on
.Tn DES
encryption for all data passed by
-.Nm rcp .
+.Nm Ns .
This may impact response time and
.Tn CPU
utilization, but provides
@@ -134,11 +127,11 @@ are on the current machine.
.Xr rsh 1
.Sh HISTORY
The
-.Nm rcp
+.Nm
command appeared in
.Bx 4.2 .
The version of
-.Nm rcp
+.Nm
described here
has been reimplemented with Kerberos in
.Bx 4.3 Reno .
@@ -157,4 +150,4 @@ The destination user and hostname may have to be specified as
``rhost.rname'' when the destination machine is running the
.Bx 4.2
version of
-.Nm rcp .
+.Nm Ns .
diff --git a/bin/rcp/rcp.c b/bin/rcp/rcp.c
index 162d4b98a1c1..e7409b33f7ed 100644
--- a/bin/rcp/rcp.c
+++ b/bin/rcp/rcp.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: rcp.c,v 1.8.2.4 1998/02/18 11:38:37 markm Exp $
*/
#ifndef lint
@@ -72,8 +72,6 @@ static char const sccsid[] = "@(#)rcp.c 8.2 (Berkeley) 4/2/94";
#include <des.h>
#include <krb.h>
-/* #include "../../usr.bin/rlogin/krb.h" */
-
char dst_realm_buf[REALM_SZ];
char *dest_realm = NULL;
int use_kerberos = 1;
@@ -96,6 +94,9 @@ uid_t userid;
int errs, rem;
int pflag, iamremote, iamrecursive, targetshouldbedirectory;
+static int argc_copy;
+static char **argv_copy;
+
#define CMDNEEDS 64
char cmd[CMDNEEDS]; /* must hold "rcp -r -p -d\0" */
@@ -119,6 +120,24 @@ main(argc, argv)
struct servent *sp;
int ch, fflag, tflag;
char *targ, *shell;
+ int i;
+
+ /*
+ * Prepare for execing ourselves.
+ */
+
+ argc_copy = argc + 1;
+ argv_copy = malloc((argc_copy + 1) * sizeof(*argv_copy));
+ if (argv_copy == NULL)
+ err(1, "malloc");
+ argv_copy[0] = argv[0];
+ argv_copy[1] = "-K";
+ for(i = 1; i < argc; ++i) {
+ argv_copy[i + 1] = strdup(argv[i]);
+ if (argv_copy[i + 1] == NULL)
+ errx(1, "strdup: out of memory");
+ }
+ argv_copy[argc + 1] = NULL;
fflag = tflag = 0;
while ((ch = getopt(argc, argv, OPTIONS)) != -1)
@@ -774,10 +793,8 @@ int
kerberos(host, bp, locuser, user)
char **host, *bp, *locuser, *user;
{
- struct servent *sp;
-
-again:
if (use_kerberos) {
+ setuid(getuid());
rem = KSUCCESS;
errno = 0;
if (dest_realm == NULL)
@@ -791,15 +808,11 @@ again:
krcmd(host, port, user, bp, 0, dest_realm);
if (rem < 0) {
- use_kerberos = 0;
- if ((sp = getservbyname("shell", "tcp")) == NULL)
- errx(1, "unknown service shell/tcp");
if (errno == ECONNREFUSED)
oldw("remote host doesn't support Kerberos");
else if (errno == ENOENT)
oldw("can't provide Kerberos authentication data");
- port = sp->s_port;
- goto again;
+ execv(_PATH_RCP, argv_copy);
}
} else {
#ifdef CRYPT
diff --git a/bin/rm/rm.1 b/bin/rm/rm.1
index e2d4c640410c..0c76918ce1f9 100644
--- a/bin/rm/rm.1
+++ b/bin/rm/rm.1
@@ -33,7 +33,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)rm.1 8.2 (Berkeley) 4/18/94
-.\" $Id: rm.1,v 1.4.2.1 1997/04/08 20:43:37 mpp Exp $
+.\" $Id: rm.1,v 1.4.2.2 1997/04/09 05:05:46 mpp Exp $
.\"
.Dd April 18, 1994
.Dt RM 1
@@ -44,11 +44,11 @@
.Sh SYNOPSIS
.Nm rm
.Op Fl f | Fl i
-.Op Fl dPRr
+.Op Fl dPRrW
.Ar file ...
.Sh DESCRIPTION
The
-.Nm rm
+.Nm
utility attempts to remove the non-directory type files specified on the
command line.
If the permissions of the file do not permit writing, and the standard
@@ -100,23 +100,27 @@ that directory is skipped.
.It Fl r
Equivalent to
.Fl R .
+.It Fl W
+Attempt to undelete the named files.
+Currently, this option can only be used to recover
+files covered by whiteouts.
.El
.Pp
The
-.Nm rm
+.Nm
utility removes symbolic links, not the files referenced by the links.
.Pp
It is an error to attempt to remove the files ``.'' and ``..''.
.Pp
The
-.Nm rm
+.Nm
utility exits 0 if all of the named files or file hierarchies were removed,
or if the
.Fl f
option was specified and all of the existing files or file hierarchies were
removed.
If an error occurs,
-.Nm rm
+.Nm
exits with a value >0.
.Sh NOTE
The
@@ -141,6 +145,7 @@ This is useful for commands that do not use
to parse the command line arguments.
.Sh SEE ALSO
.Xr rmdir 1 ,
+.Xr undelete 2 ,
.Xr unlink 2 ,
.Xr fts 3 ,
.Xr getopt 3 ,
@@ -155,7 +160,7 @@ In addition, only regular files are overwritten, other types of files
are not.
.Sh COMPATIBILITY
The
-.Nm rm
+.Nm
utility differs from historical implementations in that the
.Fl f
option only masks attempts to remove non-existent files instead of
@@ -167,7 +172,7 @@ implementations prompted on the standard output,
not the standard error output.
.Sh STANDARDS
The
-.Nm rm
+.Nm
command is expected to be
.St -p1003.2
compatible.
diff --git a/bin/rm/rm.c b/bin/rm/rm.c
index 6083bb75ce2a..e6a0d487f095 100644
--- a/bin/rm/rm.c
+++ b/bin/rm/rm.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: rm.c,v 1.11 1996/03/07 23:26:59 wosch Exp $
+ * $Id: rm.c,v 1.11.2.1 1997/12/03 05:40:08 imp Exp $
*/
#ifndef lint
@@ -81,7 +81,7 @@ main(argc, argv)
{
int ch, rflag;
- rflag = 0;
+ Pflag = rflag = 0;
while ((ch = getopt(argc, argv, "dfiPRr")) != -1)
switch(ch) {
case 'd':
@@ -112,16 +112,17 @@ main(argc, argv)
usage();
checkdot(argv);
- if (!*argv)
- exit (eval);
-
- stdin_ok = isatty(STDIN_FILENO);
uid = geteuid();
- if (rflag)
- rm_tree(argv);
- else
- rm_file(argv);
+ if (*argv) {
+ stdin_ok = isatty(STDIN_FILENO);
+
+ if (rflag)
+ rm_tree(argv);
+ else
+ rm_file(argv);
+ }
+
exit (eval);
}
@@ -132,13 +133,14 @@ rm_tree(argv)
FTS *fts;
FTSENT *p;
int needstat;
+ int flags;
int rval;
/*
* Remove a file hierarchy. If forcing removal (-f), or interactive
* (-i) or can't ask anyway (stdin_ok), don't stat the file.
*/
- needstat = !uid || !fflag && !iflag && stdin_ok;
+ needstat = !uid || (!fflag && !iflag && stdin_ok);
/*
* If the -i option is specified, the user can skip on the pre-order
@@ -176,7 +178,7 @@ rm_tree(argv)
continue;
case FTS_D:
/* Pre-order: give user chance to skip. */
- if (iflag && !check(p->fts_path, p->fts_accpath,
+ if (!fflag && !check(p->fts_path, p->fts_accpath,
p->fts_statp)) {
(void)fts_set(fts, p, FTS_SKIP);
p->fts_number = SKIPPED;
@@ -193,10 +195,11 @@ rm_tree(argv)
if (p->fts_number == SKIPPED)
continue;
break;
+ default:
+ if (!fflag &&
+ !check(p->fts_path, p->fts_accpath, p->fts_statp))
+ continue;
}
- if (!fflag &&
- !check(p->fts_path, p->fts_accpath, p->fts_statp))
- continue;
rval = 0;
if (!uid &&
@@ -357,9 +360,9 @@ check(path, name, sp)
* first because we may not have stat'ed the file.
*/
if (!stdin_ok || S_ISLNK(sp->st_mode) ||
- !access(name, W_OK) &&
+ (!access(name, W_OK) &&
!(sp->st_flags & (SF_APPEND|SF_IMMUTABLE)) &&
- (!(sp->st_flags & (UF_APPEND|UF_IMMUTABLE)) || !uid))
+ (!(sp->st_flags & (UF_APPEND|UF_IMMUTABLE)) || !uid)))
return (1);
strmode(sp->st_mode, modep);
strcpy(flagsp, flags_to_string(sp->st_flags, NULL));
@@ -398,7 +401,8 @@ checkdot(argv)
if (!complained++)
warnx("\".\" and \"..\" may not be removed");
eval = 1;
- for (save = t; (t[0] = t[1]) != NULL; ++t);
+ for (save = t; (t[0] = t[1]) != NULL; ++t)
+ continue;
t = save;
} else
++t;
diff --git a/bin/rmail/rmail.8 b/bin/rmail/rmail.8
index a364357ae41b..1b17d0b5304d 100644
--- a/bin/rmail/rmail.8
+++ b/bin/rmail/rmail.8
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)rmail.8 6.10 (Berkeley) 4/29/93
-.\" $Id: rmail.8,v 1.2.8.1 1997/02/28 07:54:43 mpp Exp $
+.\" $Id: rmail.8,v 1.2.8.2 1998/06/30 06:43:18 charnier Exp $
.\"
.Dd April 29, 1993
.Dt RMAIL 8
@@ -63,7 +63,7 @@ and
.Xr sendmail 8
.Sh HISTORY
The
-.Nm rmail
+.Nm
program appeared in
.Bx 4.2 .
.Sh BUGS
diff --git a/bin/rmdir/rmdir.1 b/bin/rmdir/rmdir.1
index 52144c369806..cdeb09f0d071 100644
--- a/bin/rmdir/rmdir.1
+++ b/bin/rmdir/rmdir.1
@@ -33,7 +33,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)rmdir.1 8.1 (Berkeley) 5/31/93
-.\" $Id: rmdir.1,v 1.3.2.1 1997/08/25 08:43:05 jkh Exp $
+.\" $Id: rmdir.1,v 1.3.2.2 1998/06/30 06:42:35 charnier Exp $
.\"
.Dd May 31, 1993
.Dt RMDIR 1
@@ -58,11 +58,11 @@ In order to remove both a parent directory and a subdirectory
of that parent, the subdirectory
must be specified first so the parent directory
is empty when
-.Nm rmdir
+.Nm
tries to remove it.
.Pp
The following option is available:
-.Bl -tag -width Ds
+.Bl -tag -width indent
.It Fl p
Each
.Ar directory
@@ -75,7 +75,7 @@ for fully non-discriminant recursive removal.)
.El
.Pp
The
-.Nm rmdir
+.Nm
utility exits with one of the following values:
.Bl -tag -width Ds
.It Li \&0
@@ -89,7 +89,7 @@ An error occurred.
.Xr rm 1
.Sh STANDARDS
The
-.Nm rmdir
+.Nm
command is expected to be
.St -p1003.2
compatible.
diff --git a/bin/rmdir/rmdir.c b/bin/rmdir/rmdir.c
index d9db72d70e14..f03665bfb0cd 100644
--- a/bin/rmdir/rmdir.c
+++ b/bin/rmdir/rmdir.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: rmdir.c,v 1.2 1994/09/24 02:57:13 davidg Exp $
+ * $Id: rmdir.c,v 1.2.8.1 1997/08/25 08:43:06 jkh Exp $
*/
#ifndef lint
@@ -40,7 +40,11 @@ static char const copyright[] =
#endif /* not lint */
#ifndef lint
-static char const sccsid[] = "@(#)rmdir.c 8.3 (Berkeley) 4/2/94";
+#if 0
+static char sccsid[] = "@(#)rmdir.c 8.3 (Berkeley) 4/2/94";
+#endif
+static const char rcsid[] =
+ "$Id$";
#endif /* not lint */
#include <err.h>
@@ -78,14 +82,6 @@ main(argc, argv)
usage();
for (errors = 0; *argv; argv++) {
- char *p;
-
- /* Delete trailing slashes, per POSIX. */
- p = *argv + strlen(*argv);
- while (--p > *argv && *p == '/')
- ;
- *++p = '\0';
-
if (rmdir(*argv) < 0) {
warn("%s", *argv);
errors = 1;
diff --git a/bin/sleep/sleep.1 b/bin/sleep/sleep.1
index cabb537ef7ba..5dca806d37ed 100644
--- a/bin/sleep/sleep.1
+++ b/bin/sleep/sleep.1
@@ -33,7 +33,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)sleep.1 8.3 (Berkeley) 4/18/94
-.\" $Id: sleep.1,v 1.2.8.2 1997/08/25 09:18:37 jkh Exp $
+.\" $Id: sleep.1,v 1.2.8.3 1998/06/30 06:43:08 charnier Exp $
.\"
.Dd April 18, 1994
.Dt SLEEP 1
@@ -46,7 +46,7 @@
.Ar seconds
.Sh DESCRIPTION
The
-.Nm sleep
+.Nm
command
suspends execution for a minimum of
.Ar seconds .
@@ -56,7 +56,7 @@ is used to schedule the execution of other commands (see
below).
.Pp
If the
-.Nm sleep
+.Nm
command
receives a SIGALRM signal, it terminates normally with a zero exit status,
for any other signal it takes the standard action.
@@ -117,7 +117,7 @@ awk job.
.Xr sleep 3
.Sh STANDARDS
The
-.Nm sleep
+.Nm
command is expected to be
.St -p1003.2
compatible.
diff --git a/bin/stty/gfmt.c b/bin/stty/gfmt.c
index 62b30dcb4c51..f28f8dcab774 100644
--- a/bin/stty/gfmt.c
+++ b/bin/stty/gfmt.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: gfmt.c,v 1.4 1995/05/30 00:07:26 rgrimes Exp $
+ * $Id: gfmt.c,v 1.4.6.1 1997/08/25 09:24:02 jkh Exp $
*/
#ifndef lint
@@ -65,10 +65,12 @@ gprint(tp, wp, ldisc)
struct cchar *cp;
(void)printf("gfmt1:cflag=%lx:iflag=%lx:lflag=%lx:oflag=%lx:",
- tp->c_cflag, tp->c_iflag, tp->c_lflag, tp->c_oflag);
+ (u_long)tp->c_cflag, (u_long)tp->c_iflag, (u_long)tp->c_lflag,
+ (u_long)tp->c_oflag);
for (cp = cchars1; cp->name; ++cp)
(void)printf("%s=%x:", cp->name, tp->c_cc[cp->sub]);
- (void)printf("ispeed=%ld:ospeed=%ld\n", cfgetispeed(tp), cfgetospeed(tp));
+ (void)printf("ispeed=%lu:ospeed=%lu\n",
+ (u_long)cfgetispeed(tp), (u_long)cfgetospeed(tp));
}
void
diff --git a/bin/stty/key.c b/bin/stty/key.c
index 5e293d0d1f1b..519404931f2d 100644
--- a/bin/stty/key.c
+++ b/bin/stty/key.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: key.c,v 1.4.6.1 1996/12/10 16:40:37 joerg Exp $
+ * $Id: key.c,v 1.4.6.2 1997/08/25 09:24:04 jkh Exp $
*/
#ifndef lint
@@ -286,7 +286,7 @@ f_speed(ip)
struct info *ip;
{
- (void)printf("%ld\n", cfgetospeed(&ip->t));
+ (void)printf("%lu\n", (u_long)cfgetospeed(&ip->t));
}
void
diff --git a/bin/stty/stty.1 b/bin/stty/stty.1
index 3276c7401684..09a8dadc230b 100644
--- a/bin/stty/stty.1
+++ b/bin/stty/stty.1
@@ -33,7 +33,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)stty.1 8.4 (Berkeley) 4/18/94
-.\" $Id: stty.1,v 1.4.2.3 1998/06/03 04:12:26 jkoshy Exp $
+.\" $Id: stty.1,v 1.4.2.4 1998/06/30 06:43:23 charnier Exp $
.\"
.Dd April 18, 1994
.Dt STTY 1
@@ -48,7 +48,7 @@
.Op operands
.Sh DESCRIPTION
The
-.Nm stty
+.Nm
utility sets or reports on terminal
characteristics for the device that is its standard input.
If no options or operands are specified, it reports the settings of a subset
@@ -60,7 +60,7 @@ Some combinations of arguments are mutually
exclusive on some terminal types.
.Pp
The following options are available:
-.Bl -tag -width Ds
+.Bl -tag -width indent
.It Fl a
Display all the current settings for the terminal to standard output
as per
@@ -84,7 +84,7 @@ block on the open.
.It Fl g
Display all the current settings for the terminal to standard output
in a form that may be used as an argument to a subsequent invocation of
-.Nm stty
+.Nm
to restore the current terminal state as per
.St -p1003.2 .
.El
@@ -566,13 +566,13 @@ Same as the control character
.El
.Pp
The
-.Nm stty
+.Nm
utility exits with a value of 0 if successful, and >0 if an error occurs.
.Sh SEE ALSO
.Xr termios 4
.Sh STANDARDS
The
-.Nm stty
+.Nm
function is expected to be
.St -p1003.2
compatible. The flags
diff --git a/bin/sync/sync.8 b/bin/sync/sync.8
index 30b3859ef89a..745c71a14f13 100644
--- a/bin/sync/sync.8
+++ b/bin/sync/sync.8
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)sync.8 8.1 (Berkeley) 5/31/93
-.\" $Id: sync.8,v 1.3.2.1 1997/08/25 09:25:24 jkh Exp $
+.\" $Id: sync.8,v 1.3.2.2 1998/06/30 06:42:40 charnier Exp $
.\"
.Dd May 31, 1993
.Dt SYNC 8
@@ -55,7 +55,7 @@ to shut down the system,
as they may perform additional actions
such as resynchronizing the hardware clock
and flushing internal caches before performing a final
-.Nm sync .
+.Nm Ns .
.Pp
.Nm Sync
utilizes the
@@ -69,6 +69,6 @@ function call.
.Xr reboot 8
.Sh HISTORY
A
-.Nm sync
+.Nm
command appeared in
.At v6 .
diff --git a/bin/test/test.1 b/bin/test/test.1
index e89504e7ecd2..1c1e2c62712a 100644
--- a/bin/test/test.1
+++ b/bin/test/test.1
@@ -33,7 +33,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)test.1 8.1 (Berkeley) 5/31/93
-.\" $Id: test.1,v 1.2 1994/09/24 02:59:14 davidg Exp $
+.\" $Id: test.1,v 1.2.8.1 1997/06/02 06:40:08 charnier Exp $
.\"
.Dd May 31, 1993
.Dt TEST 1
@@ -46,7 +46,7 @@
.Ar expression
.Sh DESCRIPTION
The
-.Nm test
+.Nm
utility evaluates the expression and, if it evaluates
to true, returns a zero (true) exit status; otherwise
it returns 1 (false).
@@ -54,11 +54,11 @@ If there is no expression, test also
returns 1 (false).
.Pp
All operators and flags are separate arguments to the
-.Nm test
+.Nm
utility.
.Pp
The following primaries are used to construct expression:
-.Bl -tag -width Ar
+.Bl -tag -width indent
.It Fl b Ar file
True if
.Ar file
@@ -228,7 +228,7 @@ operator has higher precedence than the
operator.
.Sh GRAMMAR AMBIGUITY
The
-.Nm test
+.Nm
grammar is inherently ambiguous. In order to assure a degree of consistency,
the cases described in the
.St -p1003.2 ,
@@ -238,7 +238,7 @@ standards document. All other cases are subject to the ambiguity in the
command semantics.
.Sh RETURN VALUES
The
-.Nm test
+.Nm
utility exits with one of the following values:
.Bl -tag -width Ds
.It 0
@@ -251,7 +251,7 @@ An error occurred.
.El
.Sh STANDARDS
The
-.Nm test
+.Nm
function is expected to be
.St -p1003.2
compatible.