File time-debian-quiet.patch of Package time
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);
}