Behave like GNU time. More cleanup. Reword man page.
Pointed out by: Bruce Evans
This commit is contained in:
+15
-16
@@ -39,9 +39,9 @@
|
|||||||
.Nd time command execution
|
.Nd time command execution
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm
|
.Nm
|
||||||
.Op Fl a Ar file
|
|
||||||
.Op Fl o Ar file
|
|
||||||
.Op Fl l
|
.Op Fl l
|
||||||
|
.Op Fl a
|
||||||
|
.Op Fl o Ar file
|
||||||
.Ar command
|
.Ar command
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
The
|
The
|
||||||
@@ -68,25 +68,25 @@ process.
|
|||||||
.Pp
|
.Pp
|
||||||
Available options:
|
Available options:
|
||||||
.Bl -tag -width Ds
|
.Bl -tag -width Ds
|
||||||
.It Fl a Ar file
|
.It Fl l
|
||||||
Append the output of
|
The contents of the
|
||||||
.Nm
|
.Em rusage
|
||||||
to
|
structure are printed as well.
|
||||||
.Ar file
|
.It Fl a
|
||||||
instead of writing to stderr.
|
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
|
.It Fl o Ar file
|
||||||
Write the output to
|
Write the output to
|
||||||
.Ar file
|
.Ar file
|
||||||
instead of stderr. If
|
instead of stderr. If
|
||||||
.Ar file
|
.Ar file
|
||||||
exists, then
|
exists and the
|
||||||
.Nm
|
.Fl a
|
||||||
will overwrite the file if its permissions allow it.
|
flag is not specified, the file will be overwritten.
|
||||||
.It Fl l
|
|
||||||
The contents of the
|
|
||||||
.Em rusage
|
|
||||||
structure are printed as well.
|
|
||||||
.El
|
.El
|
||||||
|
.Sh NOTES
|
||||||
.Pp
|
.Pp
|
||||||
The
|
The
|
||||||
.Xr csh 1
|
.Xr csh 1
|
||||||
@@ -98,7 +98,6 @@ is available as
|
|||||||
to
|
to
|
||||||
.Xr csh
|
.Xr csh
|
||||||
users.
|
users.
|
||||||
.Sh NOTES
|
|
||||||
The output of
|
The output of
|
||||||
.Nm
|
.Nm
|
||||||
can be directed to standard output by specifying
|
can be directed to standard output by specifying
|
||||||
|
|||||||
+3
-8
@@ -42,7 +42,7 @@ static const char copyright[] =
|
|||||||
static char sccsid[] = "@(#)time.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)time.c 8.1 (Berkeley) 6/6/93";
|
||||||
#endif
|
#endif
|
||||||
static const char rcsid[] =
|
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 */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@@ -78,17 +78,12 @@ main(argc, argv)
|
|||||||
char *ofn = NULL;
|
char *ofn = NULL;
|
||||||
|
|
||||||
lflag = 0;
|
lflag = 0;
|
||||||
while ((ch = getopt(argc, argv, "a:o:l")) != -1)
|
while ((ch = getopt(argc, argv, "lao:")) != -1)
|
||||||
switch((char)ch) {
|
switch((char)ch) {
|
||||||
case 'a':
|
case 'a':
|
||||||
if (ofn)
|
|
||||||
usage();
|
|
||||||
ofn = optarg;
|
|
||||||
aflag = 1;
|
aflag = 1;
|
||||||
break;
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
if (ofn)
|
|
||||||
usage();
|
|
||||||
ofn = optarg;
|
ofn = optarg;
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
@@ -187,7 +182,7 @@ main(argc, argv)
|
|||||||
static void
|
static void
|
||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
fprintf(stderr, "usage: time [-l] [-{o|a} file] command\n");
|
fprintf(stderr, "usage: time [-l] [-a] [-o file] command\n");
|
||||||
exit(EX_USAGE);
|
exit(EX_USAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user