Ignore:
Timestamp:
Jan 1, 2014, 12:47:38 AM (7 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.21.1
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mindi-busybox/coreutils/touch.c

    r2725 r3232  
    88 */
    99
    10 /* BB_AUDIT SUSv3 _NOT_ compliant -- options -a, -m, -r, -t not supported. */
     10/* BB_AUDIT SUSv3 _NOT_ compliant -- options -a, -m not supported. */
    1111/* http://www.opengroup.org/onlinepubs/007904975/utilities/touch.html */
    1212
     
    1919
    2020#include "libbb.h"
     21
     22//config:config TOUCH
     23//config:   bool "touch"
     24//config:   default y
     25//config:   help
     26//config:     touch is used to create or change the access and/or
     27//config:     modification timestamp of specified files.
     28//config:
     29//config:config FEATURE_TOUCH_SUSV3
     30//config:   bool "Add support for SUSV3 features (-d -t -r)"
     31//config:   default y
     32//config:   depends on TOUCH
     33//config:   help
     34//config:     Enable touch to use a reference file or a given date/time argument.
     35
     36//applet:IF_TOUCH(APPLET_NOFORK(touch, touch, BB_DIR_BIN, BB_SUID_DROP, touch))
     37
     38//kbuild:lib-$(CONFIG_TOUCH) += touch.o
     39
     40//usage:#define touch_trivial_usage
     41//usage:       "[-c]" IF_FEATURE_TOUCH_SUSV3(" [-d DATE] [-t DATE] [-r FILE]") " FILE..."
     42//usage:#define touch_full_usage "\n\n"
     43//usage:       "Update the last-modified date on the given FILE[s]\n"
     44//usage:     "\n    -c  Don't create files"
     45//usage:    IF_FEATURE_TOUCH_SUSV3(
     46//usage:     "\n    -d DT   Date/time to use"
     47//usage:     "\n    -t DT   Date/time to use"
     48//usage:     "\n    -r FILE Use FILE's date/time"
     49//usage:    )
     50//usage:
     51//usage:#define touch_example_usage
     52//usage:       "$ ls -l /tmp/foo\n"
     53//usage:       "/bin/ls: /tmp/foo: No such file or directory\n"
     54//usage:       "$ touch /tmp/foo\n"
     55//usage:       "$ ls -l /tmp/foo\n"
     56//usage:       "-rw-rw-r--    1 andersen andersen        0 Apr 15 01:11 /tmp/foo\n"
    2157
    2258/* This is a NOFORK applet. Be very careful! */
     
    4480    int status = EXIT_SUCCESS;
    4581    int opts;
    46 #if ENABLE_DESKTOP
     82#if ENABLE_FEATURE_TOUCH_SUSV3
    4783# if ENABLE_LONG_OPTS
    4884    static const char touch_longopts[] ALIGN1 =
     
    6399#endif
    64100
    65 #if ENABLE_DESKTOP && ENABLE_LONG_OPTS
     101#if ENABLE_FEATURE_TOUCH_SUSV3 && ENABLE_LONG_OPTS
    66102    applet_long_options = touch_longopts;
    67103#endif
     
    69105     * accepted data format differs a bit between -d and -t.
    70106     * We accept the same formats for both */
    71     opts = getopt32(argv, "c" IF_DESKTOP("r:d:t:")
     107    opts = getopt32(argv, "c" IF_FEATURE_TOUCH_SUSV3("r:d:t:")
    72108                /*ignored:*/ "fma"
    73                 IF_DESKTOP(, &reference_file)
    74                 IF_DESKTOP(, &date_str)
    75                 IF_DESKTOP(, &date_str)
     109                IF_FEATURE_TOUCH_SUSV3(, &reference_file)
     110                IF_FEATURE_TOUCH_SUSV3(, &date_str)
     111                IF_FEATURE_TOUCH_SUSV3(, &date_str)
    76112    );
    77113
     
    92128        time_t t;
    93129
    94         //time(&t);
    95         //localtime_r(&t, &tm_time);
    96         memset(&tm_time, 0, sizeof(tm_time));
     130        //memset(&tm_time, 0, sizeof(tm_time));
     131        /* Better than memset: makes "HH:MM" dates meaningful */
     132        time(&t);
     133        localtime_r(&t, &tm_time);
    97134        parse_datestr(date_str, &tm_time);
    98135
Note: See TracChangeset for help on using the changeset viewer.