bce8f29a0e
- Sync patches with Debian and Fedora: * Add man page (time.1). * Less nonverbose output (time-fedora-verbose.patch). * Fix maximal RSS report (time-fedora-ru_maxrss-is-in-kilobytes-on-Linux.patch, bnc#836049, Redhat#702826). * Switch to microsecond accuracy if miliseconds arithmetic rounds to zero (time-fedora-Recompute-CPU-usage-at-microsecond-level.patch, Redhat#527276). * When time exits in a non-normal way, return 128 plus the number of the signal which caused time to stop or abort (time-debian-non-normal-exit.patch). * struct rusage and sys/resource.h portability fix (time-debian-rusage-portability.patch, Debian#144819). * Add -q,--quiet functionality (time-debian-quiet.patch, Debian#56853). * Update bug reporting address (time-debian-bug-address.patch, Debian#542469). * Modernize the configure.in file to current autoconf style (time-debian-configure.patch). * Add a directory entry to the info page (time-debian-info-direntry.patch). - Fix FSF address (time-fsf-address.patch). - Update Summary. - Rename time-1.7.diff to time-alpha.patch. ... And cherry pick changelog entries relevant to time. OBS-URL: https://build.opensuse.org/request/show/198137 OBS-URL: https://build.opensuse.org/package/show/Base:System/time?expand=0&rev=3
86 lines
2.2 KiB
Diff
86 lines
2.2 KiB
Diff
Description: Adds -q,--quiet functionality.
|
||
Requested by Adam Heath.
|
||
Author: Dirk Eddelbuettel
|
||
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=56853
|
||
|
||
--- time-1.7.orig/time.texi
|
||
+++ time-1.7/time.texi
|
||
@@ -185,6 +185,10 @@
|
||
sys %S
|
||
@end example
|
||
|
||
+@item -q
|
||
+@itemx --quiet
|
||
+Suppress non-zero error code from the executed program.
|
||
+
|
||
@item -v
|
||
@itemx --verbose
|
||
@cindex format
|
||
--- time-1.7.orig/time.c
|
||
+++ time-1.7/time.c
|
||
@@ -147,6 +147,10 @@
|
||
NULL
|
||
};
|
||
|
||
+
|
||
+/* If true, do not show the exit message */
|
||
+static boolean quiet;
|
||
+
|
||
/* If true, show an English description next to each statistic. */
|
||
static boolean verbose;
|
||
|
||
@@ -172,6 +176,7 @@
|
||
{"help", no_argument, NULL, 'h'},
|
||
{"output-file", required_argument, NULL, 'o'},
|
||
{"portability", no_argument, NULL, 'p'},
|
||
+ {"quiet", no_argument,NULL, 'q'},
|
||
{"verbose", no_argument, NULL, 'v'},
|
||
{"version", no_argument, NULL, 'V'},
|
||
{NULL, no_argument, NULL, 0}
|
||
@@ -337,7 +342,8 @@
|
||
else if (WIFSIGNALED (resp->waitstatus))
|
||
fprintf (fp, "Command terminated by signal %d\n",
|
||
WTERMSIG (resp->waitstatus));
|
||
- else if (WIFEXITED (resp->waitstatus) && WEXITSTATUS (resp->waitstatus))
|
||
+ else if (WIFEXITED (resp->waitstatus) && WEXITSTATUS (resp->waitstatus)
|
||
+ && !quiet)
|
||
fprintf (fp, "Command exited with non-zero status %d\n",
|
||
WEXITSTATUS (resp->waitstatus));
|
||
}
|
||
@@ -545,6 +551,7 @@
|
||
char *format; /* Format found in environment. */
|
||
|
||
/* Initialize the option flags. */
|
||
+ quiet = false;
|
||
verbose = false;
|
||
outfile = NULL;
|
||
outfp = stderr;
|
||
@@ -558,7 +565,7 @@
|
||
if (format)
|
||
output_format = format;
|
||
|
||
- while ((optc = getopt_long (argc, argv, "+af:o:pvV", longopts, (int *) 0))
|
||
+ while ((optc = getopt_long (argc, argv, "+af:o:pqvV", longopts, (int *) 0))
|
||
!= EOF)
|
||
{
|
||
switch (optc)
|
||
@@ -577,6 +584,9 @@
|
||
case 'p':
|
||
output_format = posix_format;
|
||
break;
|
||
+ case 'q':
|
||
+ quiet = true;
|
||
+ break;
|
||
case 'v':
|
||
verbose = true;
|
||
break;
|
||
@@ -679,7 +689,7 @@
|
||
fprintf (stream, "\
|
||
Usage: %s [-apvV] [-f format] [-o file] [--append] [--verbose]\n\
|
||
[--portability] [--format=format] [--output=file] [--version]\n\
|
||
- [--help] command [arg...]\n",
|
||
+ [--quiet] [--help] command [arg...]\n",
|
||
program_name);
|
||
exit (status);
|
||
}
|