1303 files changed, 32187 insertions, 57138 deletions
diff --git a/coreutils/date.c b/coreutils/date.c index 767e0d4..31b53d2 100644 --- a/coreutils/date.c +++ b/coreutils/date.c @@ -8,8 +8,7 @@ * bugfixes and cleanup by Bernhard Reutner-Fischer * * Licensed under GPLv2 or later, see file LICENSE in this source tree. -*/ - + */ /* This 'date' command supports only 2 time setting formats, all the GNU strftime stuff (its in libc, lets use it), setting time using UTC and displaying it, as well as @@ -19,10 +18,6 @@ /* Input parsing code is always bulky - used heavy duty libc stuff as much as possible, missed out a lot of bounds checking */ -//applet:IF_DATE(APPLET(date, BB_DIR_BIN, BB_SUID_DROP)) - -//kbuild:lib-$(CONFIG_DATE) += date.o - //config:config DATE //config: bool "date" //config: default y @@ -63,6 +58,10 @@ //config: the same format. With it on, 'date DATE' additionally supports //config: MMDDhhmm[[YY]YY][.ss] format. +//applet:IF_DATE(APPLET(date, BB_DIR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_DATE) += date.o + /* GNU coreutils 6.9 man page: * date [OPTION]... [+FORMAT] * date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]] @@ -138,9 +137,11 @@ //usage: "Wed Apr 12 18:52:41 MDT 2000\n" #include "libbb.h" +#include "common_bufsiz.h" #if ENABLE_FEATURE_DATE_NANO # include <sys/syscall.h> #endif +#include <android.h> enum { OPT_RFC2822 = (1 << 0), /* R */ @@ -368,16 +369,17 @@ int date_main(int argc UNUSED_PARAM, char **argv) #endif #define date_buf bb_common_bufsiz1 + setup_common_bufsiz(); if (*fmt_dt2str == '\0') { /* With no format string, just print a blank line */ date_buf[0] = '\0'; } else { /* Handle special conversions */ - if (strncmp(fmt_dt2str, "%f", 2) == 0) { + if (is_prefixed_with(fmt_dt2str, "%f")) { fmt_dt2str = (char*)"%Y.%m.%d-%H:%M:%S"; } /* Generate output string */ - strftime(date_buf, sizeof(date_buf), fmt_dt2str, &tm_time); + strftime(date_buf, COMMON_BUFSIZE, fmt_dt2str, &tm_time); } puts(date_buf); |