aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2021-04-13 15:44:13 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2021-04-13 15:45:59 +0200
commit6b6ff80299cd840849532405b4ca758ce44089f5 (patch)
tree4c66059d37a08dcb50d477d9f3b5b92c62f8d2a0
parent36300545046a4f33dca90cedf14a6025a313aeac (diff)
downloadbusybox-w32-6b6ff80299cd840849532405b4ca758ce44089f5.tar.gz
busybox-w32-6b6ff80299cd840849532405b4ca758ce44089f5.tar.bz2
busybox-w32-6b6ff80299cd840849532405b4ca758ce44089f5.zip
touch: make FEATURE_TOUCH_NODEREF unconditional
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--coreutils/touch.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/coreutils/touch.c b/coreutils/touch.c
index 52605fb7c..355455363 100644
--- a/coreutils/touch.c
+++ b/coreutils/touch.c
@@ -19,13 +19,6 @@
19//config: touch is used to create or change the access and/or 19//config: touch is used to create or change the access and/or
20//config: modification timestamp of specified files. 20//config: modification timestamp of specified files.
21//config: 21//config:
22//config:config FEATURE_TOUCH_NODEREF
23//config: bool "Add support for -h"
24//config: default y
25//config: depends on TOUCH
26//config: help
27//config: Enable touch to have the -h option.
28//config:
29//config:config FEATURE_TOUCH_SUSV3 22//config:config FEATURE_TOUCH_SUSV3
30//config: bool "Add support for SUSV3 features (-a -d -m -t -r)" 23//config: bool "Add support for SUSV3 features (-a -d -m -t -r)"
31//config: default y 24//config: default y
@@ -44,9 +37,7 @@
44//usage:#define touch_full_usage "\n\n" 37//usage:#define touch_full_usage "\n\n"
45//usage: "Update the last-modified date on the given FILE[s]\n" 38//usage: "Update the last-modified date on the given FILE[s]\n"
46//usage: "\n -c Don't create files" 39//usage: "\n -c Don't create files"
47//usage: IF_FEATURE_TOUCH_NODEREF(
48//usage: "\n -h Don't follow links" 40//usage: "\n -h Don't follow links"
49//usage: )
50//usage: IF_FEATURE_TOUCH_SUSV3( 41//usage: IF_FEATURE_TOUCH_SUSV3(
51//usage: "\n -a Change only atime" 42//usage: "\n -a Change only atime"
52//usage: "\n -m Change only mtime" 43//usage: "\n -m Change only mtime"
@@ -100,20 +91,20 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
100 91
101 enum { 92 enum {
102 OPT_c = (1 << 0), 93 OPT_c = (1 << 0),
103 OPT_h = (1 << 1) * ENABLE_FEATURE_TOUCH_NODEREF, 94 OPT_h = (1 << 1),
104 OPT_r = (1 << (1+ENABLE_FEATURE_TOUCH_NODEREF)) * ENABLE_FEATURE_TOUCH_SUSV3, 95 OPT_r = (1 << 2) * ENABLE_FEATURE_TOUCH_SUSV3,
105 OPT_d = (1 << (2+ENABLE_FEATURE_TOUCH_NODEREF)) * ENABLE_FEATURE_TOUCH_SUSV3, 96 OPT_d = (1 << 3) * ENABLE_FEATURE_TOUCH_SUSV3,
106 OPT_t = (1 << (3+ENABLE_FEATURE_TOUCH_NODEREF)) * ENABLE_FEATURE_TOUCH_SUSV3, 97 OPT_t = (1 << 4) * ENABLE_FEATURE_TOUCH_SUSV3,
107 OPT_a = (1 << (4+ENABLE_FEATURE_TOUCH_NODEREF)) * ENABLE_FEATURE_TOUCH_SUSV3, 98 OPT_a = (1 << 5) * ENABLE_FEATURE_TOUCH_SUSV3,
108 OPT_m = (1 << (5+ENABLE_FEATURE_TOUCH_NODEREF)) * ENABLE_FEATURE_TOUCH_SUSV3, 99 OPT_m = (1 << 6) * ENABLE_FEATURE_TOUCH_SUSV3,
109 }; 100 };
110#if ENABLE_LONG_OPTS 101#if ENABLE_LONG_OPTS
111 static const char touch_longopts[] ALIGN1 = 102 static const char touch_longopts[] ALIGN1 =
112 /* name, has_arg, val */ 103 /* name, has_arg, val */
113 "no-create\0" No_argument "c" 104 "no-create\0" No_argument "c"
105 "no-dereference\0" No_argument "h"
114 IF_FEATURE_TOUCH_SUSV3("reference\0" Required_argument "r") 106 IF_FEATURE_TOUCH_SUSV3("reference\0" Required_argument "r")
115 IF_FEATURE_TOUCH_SUSV3("date\0" Required_argument "d") 107 IF_FEATURE_TOUCH_SUSV3("date\0" Required_argument "d")
116 IF_FEATURE_TOUCH_NODEREF("no-dereference\0" No_argument "h")
117 ; 108 ;
118#endif 109#endif
119 /* -d and -t both set time. In coreutils, 110 /* -d and -t both set time. In coreutils,
@@ -121,7 +112,7 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
121 * We accept the same formats for both 112 * We accept the same formats for both
122 */ 113 */
123 opts = getopt32long(argv, "^" 114 opts = getopt32long(argv, "^"
124 "c" IF_FEATURE_TOUCH_NODEREF("h") 115 "ch"
125 IF_FEATURE_TOUCH_SUSV3("r:d:t:am") 116 IF_FEATURE_TOUCH_SUSV3("r:d:t:am")
126 /*ignored:*/ "f" IF_NOT_FEATURE_TOUCH_SUSV3("am") 117 /*ignored:*/ "f" IF_NOT_FEATURE_TOUCH_SUSV3("am")
127 "\0" /* opt_complementary: */ 118 "\0" /* opt_complementary: */