diff options
| author | walter harms <wharms@bfs.de> | 2011-12-14 08:48:59 +0100 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-12-14 08:48:59 +0100 |
| commit | fdf514f3433de6de30b01ca355fa1146729a3307 (patch) | |
| tree | 33b72075695c1d1821dddf8bd89a3bf840245709 /coreutils | |
| parent | 3ef3cc59493aef4464458ddc47035815f4d13635 (diff) | |
| download | busybox-w32-fdf514f3433de6de30b01ca355fa1146729a3307.tar.gz busybox-w32-fdf514f3433de6de30b01ca355fa1146729a3307.tar.bz2 busybox-w32-fdf514f3433de6de30b01ca355fa1146729a3307.zip | |
touch: add new option FEATURE_TOUCH_SUSV3
This options -d -t -r where hidden under DESKTOP.
This option allows the user to enable these options for (only) touch.
The patch only changes DESKTOP to FEATURE_TOUCH_SUSV3.
Signed-off-by: walter harms <wharms@bfs.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
| -rw-r--r-- | coreutils/touch.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/coreutils/touch.c b/coreutils/touch.c index dc95edf1f..1216ca202 100644 --- a/coreutils/touch.c +++ b/coreutils/touch.c | |||
| @@ -25,17 +25,24 @@ | |||
| 25 | //config: help | 25 | //config: help |
| 26 | //config: touch is used to create or change the access and/or | 26 | //config: touch is used to create or change the access and/or |
| 27 | //config: modification timestamp of specified files. | 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. | ||
| 28 | 35 | ||
| 29 | //applet:IF_TOUCH(APPLET_NOFORK(touch, touch, BB_DIR_BIN, BB_SUID_DROP, touch)) | 36 | //applet:IF_TOUCH(APPLET_NOFORK(touch, touch, BB_DIR_BIN, BB_SUID_DROP, touch)) |
| 30 | 37 | ||
| 31 | //kbuild:lib-$(CONFIG_TOUCH) += touch.o | 38 | //kbuild:lib-$(CONFIG_TOUCH) += touch.o |
| 32 | 39 | ||
| 33 | //usage:#define touch_trivial_usage | 40 | //usage:#define touch_trivial_usage |
| 34 | //usage: "[-c]" IF_DESKTOP(" [-d DATE] [-t DATE] [-r FILE]") " FILE [FILE]..." | 41 | //usage: "[-c]" IF_FEATURE_TOUCH_SUSV3(" [-d DATE] [-t DATE] [-r FILE]") " FILE..." |
| 35 | //usage:#define touch_full_usage "\n\n" | 42 | //usage:#define touch_full_usage "\n\n" |
| 36 | //usage: "Update the last-modified date on the given FILE[s]\n" | 43 | //usage: "Update the last-modified date on the given FILE[s]\n" |
| 37 | //usage: "\n -c Don't create files" | 44 | //usage: "\n -c Don't create files" |
| 38 | //usage: IF_DESKTOP( | 45 | //usage: IF_FEATURE_TOUCH_SUSV3( |
| 39 | //usage: "\n -d DT Date/time to use" | 46 | //usage: "\n -d DT Date/time to use" |
| 40 | //usage: "\n -t DT Date/time to use" | 47 | //usage: "\n -t DT Date/time to use" |
| 41 | //usage: "\n -r FILE Use FILE's date/time" | 48 | //usage: "\n -r FILE Use FILE's date/time" |
| @@ -72,7 +79,7 @@ int touch_main(int argc UNUSED_PARAM, char **argv) | |||
| 72 | int fd; | 79 | int fd; |
| 73 | int status = EXIT_SUCCESS; | 80 | int status = EXIT_SUCCESS; |
| 74 | int opts; | 81 | int opts; |
| 75 | #if ENABLE_DESKTOP | 82 | #if ENABLE_FEATURE_TOUCH_SUSV3 |
| 76 | # if ENABLE_LONG_OPTS | 83 | # if ENABLE_LONG_OPTS |
| 77 | static const char touch_longopts[] ALIGN1 = | 84 | static const char touch_longopts[] ALIGN1 = |
| 78 | /* name, has_arg, val */ | 85 | /* name, has_arg, val */ |
| @@ -91,17 +98,17 @@ int touch_main(int argc UNUSED_PARAM, char **argv) | |||
| 91 | # define timebuf ((struct timeval*)NULL) | 98 | # define timebuf ((struct timeval*)NULL) |
| 92 | #endif | 99 | #endif |
| 93 | 100 | ||
| 94 | #if ENABLE_DESKTOP && ENABLE_LONG_OPTS | 101 | #if ENABLE_FEATURE_TOUCH_SUSV3 && ENABLE_LONG_OPTS |
| 95 | applet_long_options = touch_longopts; | 102 | applet_long_options = touch_longopts; |
| 96 | #endif | 103 | #endif |
| 97 | /* -d and -t both set time. In coreutils, | 104 | /* -d and -t both set time. In coreutils, |
| 98 | * accepted data format differs a bit between -d and -t. | 105 | * accepted data format differs a bit between -d and -t. |
| 99 | * We accept the same formats for both */ | 106 | * We accept the same formats for both */ |
| 100 | opts = getopt32(argv, "c" IF_DESKTOP("r:d:t:") | 107 | opts = getopt32(argv, "c" IF_FEATURE_TOUCH_SUSV3("r:d:t:") |
| 101 | /*ignored:*/ "fma" | 108 | /*ignored:*/ "fma" |
| 102 | IF_DESKTOP(, &reference_file) | 109 | IF_FEATURE_TOUCH_SUSV3(, &reference_file) |
| 103 | IF_DESKTOP(, &date_str) | 110 | IF_FEATURE_TOUCH_SUSV3(, &date_str) |
| 104 | IF_DESKTOP(, &date_str) | 111 | IF_FEATURE_TOUCH_SUSV3(, &date_str) |
| 105 | ); | 112 | ); |
| 106 | 113 | ||
| 107 | opts &= 1; /* only -c bit is left */ | 114 | opts &= 1; /* only -c bit is left */ |
