aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coreutils/touch.c20
-rw-r--r--coreutils/uname.c4
2 files changed, 19 insertions, 5 deletions
diff --git a/coreutils/touch.c b/coreutils/touch.c
index 92f20235c..20191546c 100644
--- a/coreutils/touch.c
+++ b/coreutils/touch.c
@@ -41,6 +41,13 @@ int touch_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
41int touch_main(int argc UNUSED_PARAM, char **argv) 41int touch_main(int argc UNUSED_PARAM, char **argv)
42{ 42{
43#if ENABLE_DESKTOP 43#if ENABLE_DESKTOP
44#if ENABLE_GETOPT_LONG
45 static const char longopts[] ALIGN1 =
46 /* name, has_arg, val */
47 "no-create\0" No_argument "c"
48 "reference\0" Required_argument "r"
49 ;
50#endif
44 struct utimbuf timebuf; 51 struct utimbuf timebuf;
45 char *reference_file = NULL; 52 char *reference_file = NULL;
46#else 53#else
@@ -49,11 +56,18 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
49#endif 56#endif
50 int fd; 57 int fd;
51 int status = EXIT_SUCCESS; 58 int status = EXIT_SUCCESS;
52 int flags = getopt32(argv, "c" USE_DESKTOP("r:") 59 int opts;
60
61#if ENABLE_DESKTOP
62#if ENABLE_GETOPT_LONG
63 applet_long_options = longopts;
64#endif
65#endif
66 opts = getopt32(argv, "c" USE_DESKTOP("r:")
53 /*ignored:*/ "fma" 67 /*ignored:*/ "fma"
54 USE_DESKTOP(, &reference_file)); 68 USE_DESKTOP(, &reference_file));
55 69
56 flags &= 1; /* only -c bit is left */ 70 opts &= 1; /* only -c bit is left */
57 argv += optind; 71 argv += optind;
58 if (!*argv) { 72 if (!*argv) {
59 bb_show_usage(); 73 bb_show_usage();
@@ -69,7 +83,7 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
69 do { 83 do {
70 if (utime(*argv, reference_file ? &timebuf : NULL)) { 84 if (utime(*argv, reference_file ? &timebuf : NULL)) {
71 if (errno == ENOENT) { /* no such file */ 85 if (errno == ENOENT) { /* no such file */
72 if (flags) { /* creation is disabled, so ignore */ 86 if (opts) { /* creation is disabled, so ignore */
73 continue; 87 continue;
74 } 88 }
75 /* Try to create the file. */ 89 /* Try to create the file. */
diff --git a/coreutils/uname.c b/coreutils/uname.c
index 4c3bf2f3b..33d026f18 100644
--- a/coreutils/uname.c
+++ b/coreutils/uname.c
@@ -73,7 +73,7 @@ static const unsigned short utsname_offset[] = {
73int uname_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 73int uname_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
74int uname_main(int argc UNUSED_PARAM, char **argv) 74int uname_main(int argc UNUSED_PARAM, char **argv)
75{ 75{
76#if ENABLE_FEATURE_UNEXPAND_LONG_OPTIONS 76#if ENABLE_GETOPT_LONG
77 static const char longopts[] ALIGN1 = 77 static const char longopts[] ALIGN1 =
78 /* name, has_arg, val */ 78 /* name, has_arg, val */
79 "all\0" No_argument "a" 79 "all\0" No_argument "a"
@@ -97,7 +97,7 @@ int uname_main(int argc UNUSED_PARAM, char **argv)
97 const unsigned short *delta; 97 const unsigned short *delta;
98 unsigned toprint; 98 unsigned toprint;
99 99
100 USE_FEATURE_UNEXPAND_LONG_OPTIONS(applet_long_options = longopts); 100 USE_GETOPT_LONG(applet_long_options = longopts);
101 toprint = getopt32(argv, options); 101 toprint = getopt32(argv, options);
102 102
103 if (argv[optind]) { /* coreutils-6.9 compat */ 103 if (argv[optind]) { /* coreutils-6.9 compat */