aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-03-15 01:28:30 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-03-15 01:28:30 +0000
commit7241e6d37781dc7e72e2b8b809f2643b98b66c25 (patch)
tree0edb24823ce755867ce7678021babab3eb8f2b9e /coreutils
parent7aaedcf21ee4c9eb49d7f1f74500c1b84cef75e7 (diff)
downloadbusybox-7241e6d37781dc7e72e2b8b809f2643b98b66c25.tar.gz
uname: correct cut/paste error
touch: add long options function old new delta static.longopts 137 162 +25 touch_main 221 231 +10 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 35/0) Total: 35 bytes
Diffstat (limited to 'coreutils')
-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;
int touch_main(int argc UNUSED_PARAM, char **argv)
{
#if ENABLE_DESKTOP
+#if ENABLE_GETOPT_LONG
+ static const char longopts[] ALIGN1 =
+ /* name, has_arg, val */
+ "no-create\0" No_argument "c"
+ "reference\0" Required_argument "r"
+ ;
+#endif
struct utimbuf timebuf;
char *reference_file = NULL;
#else
@@ -49,11 +56,18 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
#endif
int fd;
int status = EXIT_SUCCESS;
- int flags = getopt32(argv, "c" USE_DESKTOP("r:")
+ int opts;
+
+#if ENABLE_DESKTOP
+#if ENABLE_GETOPT_LONG
+ applet_long_options = longopts;
+#endif
+#endif
+ opts = getopt32(argv, "c" USE_DESKTOP("r:")
/*ignored:*/ "fma"
USE_DESKTOP(, &reference_file));
- flags &= 1; /* only -c bit is left */
+ opts &= 1; /* only -c bit is left */
argv += optind;
if (!*argv) {
bb_show_usage();
@@ -69,7 +83,7 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
do {
if (utime(*argv, reference_file ? &timebuf : NULL)) {
if (errno == ENOENT) { /* no such file */
- if (flags) { /* creation is disabled, so ignore */
+ if (opts) { /* creation is disabled, so ignore */
continue;
}
/* 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[] = {
int uname_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int uname_main(int argc UNUSED_PARAM, char **argv)
{
-#if ENABLE_FEATURE_UNEXPAND_LONG_OPTIONS
+#if ENABLE_GETOPT_LONG
static const char longopts[] ALIGN1 =
/* name, has_arg, val */
"all\0" No_argument "a"
@@ -97,7 +97,7 @@ int uname_main(int argc UNUSED_PARAM, char **argv)
const unsigned short *delta;
unsigned toprint;
- USE_FEATURE_UNEXPAND_LONG_OPTIONS(applet_long_options = longopts);
+ USE_GETOPT_LONG(applet_long_options = longopts);
toprint = getopt32(argv, options);
if (argv[optind]) { /* coreutils-6.9 compat */