Behave like GNU time. More cleanup. Reword man page.
Pointed out by: Bruce Evans
This commit is contained in:
parent
a69546de82
commit
28f5cafe82
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=37891
@ -39,9 +39,9 @@
|
||||
.Nd time command execution
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl a Ar file
|
||||
.Op Fl o Ar file
|
||||
.Op Fl l
|
||||
.Op Fl a
|
||||
.Op Fl o Ar file
|
||||
.Ar command
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
@ -68,25 +68,25 @@ process.
|
||||
.Pp
|
||||
Available options:
|
||||
.Bl -tag -width Ds
|
||||
.It Fl a Ar file
|
||||
Append the output of
|
||||
.Nm
|
||||
to
|
||||
.Ar file
|
||||
instead of writing to stderr.
|
||||
.It Fl l
|
||||
The contents of the
|
||||
.Em rusage
|
||||
structure are printed as well.
|
||||
.It Fl a
|
||||
If the
|
||||
.Fl o
|
||||
flag is used, append to the specified file rather than overwriting
|
||||
it. Otherwise, this option has no effect.
|
||||
.It Fl o Ar file
|
||||
Write the output to
|
||||
.Ar file
|
||||
instead of stderr. If
|
||||
.Ar file
|
||||
exists, then
|
||||
.Nm
|
||||
will overwrite the file if its permissions allow it.
|
||||
.It Fl l
|
||||
The contents of the
|
||||
.Em rusage
|
||||
structure are printed as well.
|
||||
exists and the
|
||||
.Fl a
|
||||
flag is not specified, the file will be overwritten.
|
||||
.El
|
||||
.Sh NOTES
|
||||
.Pp
|
||||
The
|
||||
.Xr csh 1
|
||||
@ -98,7 +98,6 @@ is available as
|
||||
to
|
||||
.Xr csh
|
||||
users.
|
||||
.Sh NOTES
|
||||
The output of
|
||||
.Nm
|
||||
can be directed to standard output by specifying
|
||||
|
@ -42,7 +42,7 @@ static const char copyright[] =
|
||||
static char sccsid[] = "@(#)time.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$Id: time.c,v 1.7 1998/07/24 07:19:29 phk Exp $";
|
||||
"$Id: time.c,v 1.8 1998/07/27 16:08:58 des Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -78,17 +78,12 @@ main(argc, argv)
|
||||
char *ofn = NULL;
|
||||
|
||||
lflag = 0;
|
||||
while ((ch = getopt(argc, argv, "a:o:l")) != -1)
|
||||
while ((ch = getopt(argc, argv, "lao:")) != -1)
|
||||
switch((char)ch) {
|
||||
case 'a':
|
||||
if (ofn)
|
||||
usage();
|
||||
ofn = optarg;
|
||||
aflag = 1;
|
||||
break;
|
||||
case 'o':
|
||||
if (ofn)
|
||||
usage();
|
||||
ofn = optarg;
|
||||
break;
|
||||
case 'l':
|
||||
@ -187,7 +182,7 @@ main(argc, argv)
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
fprintf(stderr, "usage: time [-l] [-{o|a} file] command\n");
|
||||
fprintf(stderr, "usage: time [-l] [-a] [-o file] command\n");
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user