diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2010-10-15 10:42:17 +0200 |
---|---|---|
committer | Denys Vlasenko <dvlasenk@redhat.com> | 2010-10-15 10:42:17 +0200 |
commit | f2710d02210bbba4a9580c11ff053b01081eaf54 (patch) | |
tree | fe18f6f4f483c3180e46ed00df7c0531e3be5c97 /coreutils | |
parent | 05e8605ab8a01120af7c9f011c2334ab34381fdf (diff) |
date: move applet and usage bits to date.c
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/date.c | 106 |
1 files changed, 74 insertions, 32 deletions
diff --git a/coreutils/date.c b/coreutils/date.c index c9dfedf81..87cc8f2ef 100644 --- a/coreutils/date.c +++ b/coreutils/date.c @@ -19,38 +19,7 @@ /* Input parsing code is always bulky - used heavy duty libc stuff as much as possible, missed out a lot of bounds checking */ -/* Default input handling to save surprising some people */ - -/* GNU coreutils 6.9 man page: - * date [OPTION]... [+FORMAT] - * date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]] - * -d, --date=STRING - * display time described by STRING, not `now' - * -f, --file=DATEFILE - * like --date once for each line of DATEFILE - * -r, --reference=FILE - * display the last modification time of FILE - * -R, --rfc-2822 - * output date and time in RFC 2822 format. - * Example: Mon, 07 Aug 2006 12:34:56 -0600 - * --rfc-3339=TIMESPEC - * output date and time in RFC 3339 format. - * TIMESPEC='date', 'seconds', or 'ns' - * Date and time components are separated by a single space: - * 2006-08-07 12:34:56-06:00 - * -s, --set=STRING - * set time described by STRING - * -u, --utc, --universal - * print or set Coordinated Universal Time - * - * Busybox: - * long options are not supported - * -f is not supported - * -I seems to roughly match --rfc-3339, but -I has _optional_ param - * (thus "-I seconds" doesn't work, only "-Iseconds"), - * and does not support -Ins - * -D FMT is a bbox extension for _input_ conversion of -d DATE - */ +//applet:IF_DATE(APPLET(date, _BB_DIR_BIN, _BB_SUID_DROP)) //kbuild:lib-$(CONFIG_DATE) += date.o @@ -69,6 +38,7 @@ //config: Enable option (-I) to output an ISO-8601 compliant //config: date/time string. //config: +//config:# defaults to "no": stat's nanosecond field is a bit non-portable //config:config FEATURE_DATE_NANO //config: bool "Support %[num]N nanosecond format specifier" //config: default n @@ -92,6 +62,78 @@ //config: the same format. With it on, 'date DATE' additionally supports //config: MMDDhhmm[[YY]YY][.ss] format. +/* GNU coreutils 6.9 man page: + * date [OPTION]... [+FORMAT] + * date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]] + * -d, --date=STRING + * display time described by STRING, not `now' + * -f, --file=DATEFILE + * like --date once for each line of DATEFILE + * -r, --reference=FILE + * display the last modification time of FILE + * -R, --rfc-2822 + * output date and time in RFC 2822 format. + * Example: Mon, 07 Aug 2006 12:34:56 -0600 + * --rfc-3339=TIMESPEC + * output date and time in RFC 3339 format. + * TIMESPEC='date', 'seconds', or 'ns' + * Date and time components are separated by a single space: + * 2006-08-07 12:34:56-06:00 + * -s, --set=STRING + * set time described by STRING + * -u, --utc, --universal + * print or set Coordinated Universal Time + * + * Busybox: + * long options are not supported + * -f is not supported + * -I seems to roughly match --rfc-3339, but -I has _optional_ param + * (thus "-I seconds" doesn't work, only "-Iseconds"), + * and does not support -Ins + * -D FMT is a bbox extension for _input_ conversion of -d DATE + */ + +//usage:#define date_trivial_usage +//usage: "[OPTIONS] [+FMT] [TIME]" +//usage:#define date_full_usage "\n\n" +//usage: "Display time (using +FMT), or set time\n" +//usage: "\nOptions:" +//usage: IF_NOT_LONG_OPTS( +//usage: "\n [-s] TIME Set time to TIME" +//usage: "\n -u Work in UTC (don't convert to local time)" +//usage: "\n -R Output RFC-2822 compliant date string" +//usage: ) IF_LONG_OPTS( +//usage: "\n [-s,--set] TIME Set time to TIME" +//usage: "\n -u,--utc Work in UTC (don't convert to local time)" +//usage: "\n -R,--rfc-2822 Output RFC-2822 compliant date string" +//usage: ) +//usage: IF_FEATURE_DATE_ISOFMT( +//usage: "\n -I[SPEC] Output ISO-8601 compliant date string" +//usage: "\n SPEC='date' (default) for date only," +//usage: "\n 'hours', 'minutes', or 'seconds' for date and" +//usage: "\n time to the indicated precision" +//usage: ) +//usage: IF_NOT_LONG_OPTS( +//usage: "\n -r FILE Display last modification time of FILE" +//usage: "\n -d TIME Display TIME, not 'now'" +//usage: ) IF_LONG_OPTS( +//usage: "\n -r,--reference FILE Display last modification time of FILE" +//usage: "\n -d,--date TIME Display TIME, not 'now'" +//usage: ) +//usage: IF_FEATURE_DATE_ISOFMT( +//usage: "\n -D FMT Use FMT for -d TIME conversion" +//usage: ) +//usage: "\n" +//usage: "\nRecognized TIME formats:" +//usage: "\n hh:mm[:ss]" +//usage: "\n [YYYY.]MM.DD-hh:mm[:ss]" +//usage: "\n YYYY-MM-DD hh:mm[:ss]" +//usage: "\n [[[[[YY]YY]MM]DD]hh]mm[.ss]" +//usage: +//usage:#define date_example_usage +//usage: "$ date\n" +//usage: "Wed Apr 12 18:52:41 MDT 2000\n" + #include "libbb.h" #if ENABLE_FEATURE_DATE_NANO # include <sys/syscall.h> |