summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
author"Vladimir N. Oleynik"2005-10-11 14:38:01 +0000
committer"Vladimir N. Oleynik"2005-10-11 14:38:01 +0000
commit064f04e7e2b1316f7c3de1ac7dd1fc4d4e108dd5 (patch)
treedcf88d0a287b1f154984bfc0acb292631df2f1f3 /coreutils
parentff567f7943f50b88dea14cd27636168ba2d319b5 (diff)
downloadbusybox-064f04e7e2b1316f7c3de1ac7dd1fc4d4e108dd5.zip
busybox-064f04e7e2b1316f7c3de1ac7dd1fc4d4e108dd5.tar.gz
- use complementally '!' to '?' - 'ask' is best 'free' char for this.
- more long opt compatibility, can set flag for long opt struct now - more logic: check opt-depend requires and global requires, special for 'id' and 'start-stop-daemon' applets.
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/date.c2
-rw-r--r--coreutils/id.c21
-rw-r--r--coreutils/install.c2
3 files changed, 12 insertions, 13 deletions
diff --git a/coreutils/date.c b/coreutils/date.c
index 9583a00..5ee2c74 100644
--- a/coreutils/date.c
+++ b/coreutils/date.c
@@ -151,7 +151,7 @@ int date_main(int argc, char **argv)
#else
# define GETOPT_ISOFMT
#endif
- bb_opt_complementally = "!d~ds:s~ds";
+ bb_opt_complementally = "?d~ds:s~ds";
opt = bb_getopt_ulflags(argc, argv, "Rs:ud:r:" GETOPT_ISOFMT,
&date_str, &date_str, &filename
#ifdef CONFIG_FEATURE_DATE_ISOFMT
diff --git a/coreutils/id.c b/coreutils/id.c
index 28050dd..14497b4 100644
--- a/coreutils/id.c
+++ b/coreutils/id.c
@@ -22,7 +22,7 @@
/* BB_AUDIT SUSv3 _NOT_ compliant -- option -G is not currently supported. */
/* Hacked by Tito Ragusa (C) 2004 to handle usernames of whatever length and to
- * be more similar to GNU id.
+ * be more similar to GNU id.
*/
#include "busybox.h"
@@ -41,10 +41,10 @@
#define JUST_GROUP 8
static short printf_full(unsigned int id, const char *arg, const char prefix)
-{
+{
const char *fmt = "%cid=%u";
short status=EXIT_FAILURE;
-
+
if(arg) {
fmt = "%cid=%u(%s)";
status=EXIT_SUCCESS;
@@ -61,15 +61,14 @@ extern int id_main(int argc, char **argv)
unsigned long flags;
short status;
- bb_opt_complementally = "!u~g:g~u";
+ /* Don't allow -n -r -nr -ug -rug -nug -rnug */
+ bb_opt_complementally = "?u~g:g~u:r?ug:n?ug";
flags = bb_getopt_ulflags(argc, argv, "rnug");
- /* Don't allow -n -r -nr */
- if ((flags <= 3 && flags > 0)
/* Don't allow more than one username */
- || (argc > optind + 1))
+ if (argc > (optind + 1))
bb_show_usage();
-
+
/* This values could be overwritten later */
uid = geteuid();
gid = getegid();
@@ -77,13 +76,13 @@ extern int id_main(int argc, char **argv)
uid = getuid();
gid = getgid();
}
-
+
if(argv[optind]) {
p=getpwnam(argv[optind]);
/* bb_xgetpwnam is needed because it exits on failure */
uid = bb_xgetpwnam(argv[optind]);
gid = p->pw_gid;
- /* in this case PRINT_REAL is the same */
+ /* in this case PRINT_REAL is the same */
}
if(flags & (JUST_GROUP | JUST_USER)) {
@@ -94,7 +93,7 @@ extern int id_main(int argc, char **argv)
} else {
bb_printf("%u\n",(flags & JUST_USER) ? uid : gid);
}
- /* exit */
+ /* exit */
bb_fflush_stdout_and_exit(EXIT_SUCCESS);
}
diff --git a/coreutils/install.c b/coreutils/install.c
index 9fcb754..9e5eb60 100644
--- a/coreutils/install.c
+++ b/coreutils/install.c
@@ -61,7 +61,7 @@ extern int install_main(int argc, char **argv)
int ret = EXIT_SUCCESS, flags, i, isdir;
bb_applet_long_options = install_long_options;
- bb_opt_complementally = "!s~d:d~s";
+ bb_opt_complementally = "?s~d:d~s";
/* -c exists for backwards compatability, its needed */
flags = bb_getopt_ulflags(argc, argv, "cdpsg:m:o:", &gid_str, &mode_str, &uid_str); /* 'a' must be 2nd */