diff options
Diffstat (limited to 'miscutils')
| -rw-r--r-- | miscutils/time.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/miscutils/time.c b/miscutils/time.c index dd0c0208a..e377bb6b7 100644 --- a/miscutils/time.c +++ b/miscutils/time.c | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | //usage: "Run PROG, display resource usage when it exits\n" | 26 | //usage: "Run PROG, display resource usage when it exits\n" |
| 27 | //usage: "\n -v Verbose" | 27 | //usage: "\n -v Verbose" |
| 28 | //usage: "\n -p POSIX output format" | 28 | //usage: "\n -p POSIX output format" |
| 29 | //usage: "\n -f FMT Custom format" | ||
| 29 | //usage: "\n -o FILE Write result to FILE" | 30 | //usage: "\n -o FILE Write result to FILE" |
| 30 | //usage: "\n -a Append (else overwrite)" | 31 | //usage: "\n -a Append (else overwrite)" |
| 31 | 32 | ||
| @@ -415,7 +416,8 @@ int time_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | |||
| 415 | int time_main(int argc UNUSED_PARAM, char **argv) | 416 | int time_main(int argc UNUSED_PARAM, char **argv) |
| 416 | { | 417 | { |
| 417 | resource_t res; | 418 | resource_t res; |
| 418 | const char *output_format = default_format; | 419 | /* $TIME has lowest prio (-v,-p,-f FMT overrride it) */ |
| 420 | const char *output_format = getenv("TIME") ? : default_format; | ||
| 419 | char *output_filename; | 421 | char *output_filename; |
| 420 | int output_fd; | 422 | int output_fd; |
| 421 | int opt; | 423 | int opt; |
| @@ -425,11 +427,12 @@ int time_main(int argc UNUSED_PARAM, char **argv) | |||
| 425 | OPT_p = (1 << 1), | 427 | OPT_p = (1 << 1), |
| 426 | OPT_a = (1 << 2), | 428 | OPT_a = (1 << 2), |
| 427 | OPT_o = (1 << 3), | 429 | OPT_o = (1 << 3), |
| 430 | OPT_f = (1 << 4), | ||
| 428 | }; | 431 | }; |
| 429 | 432 | ||
| 430 | opt_complementary = "-1"; /* at least one arg */ | 433 | opt_complementary = "-1"; /* at least one arg */ |
| 431 | /* "+": stop on first non-option */ | 434 | /* "+": stop on first non-option */ |
| 432 | opt = getopt32(argv, "+vpao:", &output_filename); | 435 | opt = getopt32(argv, "+vpao:f:", &output_filename, &output_format); |
| 433 | argv += optind; | 436 | argv += optind; |
| 434 | if (opt & OPT_v) | 437 | if (opt & OPT_v) |
| 435 | output_format = long_format; | 438 | output_format = long_format; |
