summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>1998-07-28 10:08:16 +0000
committerdes <des@FreeBSD.org>1998-07-28 10:08:16 +0000
commit4e25ac7f8b4a800a937e11b06652ca929a37d468 (patch)
treedf4318cfdfc41d56a2d9bf40794b387f13a932cd /usr.bin
parentebdd0888b15b7f91c651f54813a4d70ab81247e2 (diff)
downloadFreeBSD-src-4e25ac7f8b4a800a937e11b06652ca929a37d468.zip
FreeBSD-src-4e25ac7f8b4a800a937e11b06652ca929a37d468.tar.gz
Brucifixion.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/time/time.133
-rw-r--r--usr.bin/time/time.c27
2 files changed, 17 insertions, 43 deletions
diff --git a/usr.bin/time/time.1 b/usr.bin/time/time.1
index 1c8bb77..f0fd00a 100644
--- a/usr.bin/time/time.1
+++ b/usr.bin/time/time.1
@@ -39,8 +39,7 @@
.Nd time command execution
.Sh SYNOPSIS
.Nm
-.Op Fl l
-.Op Fl a
+.Op Fl al
.Op Fl o Ar file
.Ar command
.Sh DESCRIPTION
@@ -68,15 +67,15 @@ process.
.Pp
Available options:
.Bl -tag -width Ds
-.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 l
+The contents of the
+.Em rusage
+structure are printed as well.
.It Fl o Ar file
Write the output to
.Ar file
@@ -86,7 +85,6 @@ exists and the
.Fl a
flag is not specified, the file will be overwritten.
.El
-.Sh NOTES
.Pp
The
.Xr csh 1
@@ -98,27 +96,6 @@ is available as
to
.Xr csh
users.
-The output of
-.Nm
-can be directed to standard output by specifying
-.Do
--
-.Dc
-as the argument to the
-.Fl a
-or
-.Fl o
-option.
-.Pp
-The
-.Fl a
-and
-.Fl o
-options are mutually exclusive.
-.Sh BUGS
-The granularity of seconds on micro processors is crude and
-can result in times being reported for CPU usage which are too large by
-a second.
.Sh SEE ALSO
.Xr csh 1 ,
.Xr getrusage 2 ,
diff --git a/usr.bin/time/time.c b/usr.bin/time/time.c
index 67f5e70..707ba10 100644
--- a/usr.bin/time/time.c
+++ b/usr.bin/time/time.c
@@ -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.8 1998/07/27 16:08:58 des Exp $";
+ "$Id: time.c,v 1.9 1998/07/27 16:54:05 des Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -56,7 +56,6 @@ static const char rcsid[] =
#include <err.h>
#include <stdio.h>
#include <string.h>
-#include <sysexits.h>
#include <unistd.h>
static int getstathz __P((void));
@@ -71,24 +70,24 @@ main(argc, argv)
extern int optind;
register int pid;
- int ch, status, lflag, aflag = 0;
+ int aflag, ch, lflag, status;
struct timeval before, after;
struct rusage ru;
FILE *out = stderr;
char *ofn = NULL;
- lflag = 0;
- while ((ch = getopt(argc, argv, "lao:")) != -1)
+ aflag = lflag = 0;
+ while ((ch = getopt(argc, argv, "alo:")) != -1)
switch((char)ch) {
case 'a':
aflag = 1;
break;
- case 'o':
- ofn = optarg;
- break;
case 'l':
lflag = 1;
break;
+ case 'o':
+ ofn = optarg;
+ break;
case '?':
default:
usage();
@@ -99,11 +98,9 @@ main(argc, argv)
argv += optind;
if (ofn) {
- if (strcmp(ofn, "-") == 0)
- out = stdout;
- else
- if ((out = fopen(ofn, aflag?"a":"w")) == NULL)
- err(EX_IOERR, ofn);
+ if ((out = fopen(ofn, aflag ? "a" : "w")) == NULL)
+ err(1, "%s", ofn);
+ setvbuf(out, (char *)NULL, _IONBF, (size_t)0);
}
gettimeofday(&before, (struct timezone *)NULL);
@@ -182,8 +179,8 @@ main(argc, argv)
static void
usage()
{
- fprintf(stderr, "usage: time [-l] [-a] [-o file] command\n");
- exit(EX_USAGE);
+ fprintf(stderr, "usage: time [-al] [-o file] command\n");
+ exit(1);
}
/*
OpenPOWER on IntegriCloud