diff options
| author | "Vladimir N. Oleynik" <dzo@simtreas.ru> | 2005-10-11 14:38:01 +0000 |
|---|---|---|
| committer | "Vladimir N. Oleynik" <dzo@simtreas.ru> | 2005-10-11 14:38:01 +0000 |
| commit | 064f04e7e2b1316f7c3de1ac7dd1fc4d4e108dd5 (patch) | |
| tree | dcf88d0a287b1f154984bfc0acb292631df2f1f3 /coreutils | |
| parent | ff567f7943f50b88dea14cd27636168ba2d319b5 (diff) | |
| download | busybox-w32-064f04e7e2b1316f7c3de1ac7dd1fc4d4e108dd5.tar.gz busybox-w32-064f04e7e2b1316f7c3de1ac7dd1fc4d4e108dd5.tar.bz2 busybox-w32-064f04e7e2b1316f7c3de1ac7dd1fc4d4e108dd5.zip | |
- 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.c | 2 | ||||
| -rw-r--r-- | coreutils/id.c | 21 | ||||
| -rw-r--r-- | coreutils/install.c | 2 |
3 files changed, 12 insertions, 13 deletions
diff --git a/coreutils/date.c b/coreutils/date.c index 9583a0036..5ee2c74e8 100644 --- a/coreutils/date.c +++ b/coreutils/date.c | |||
| @@ -151,7 +151,7 @@ int date_main(int argc, char **argv) | |||
| 151 | #else | 151 | #else |
| 152 | # define GETOPT_ISOFMT | 152 | # define GETOPT_ISOFMT |
| 153 | #endif | 153 | #endif |
| 154 | bb_opt_complementally = "!d~ds:s~ds"; | 154 | bb_opt_complementally = "?d~ds:s~ds"; |
| 155 | opt = bb_getopt_ulflags(argc, argv, "Rs:ud:r:" GETOPT_ISOFMT, | 155 | opt = bb_getopt_ulflags(argc, argv, "Rs:ud:r:" GETOPT_ISOFMT, |
| 156 | &date_str, &date_str, &filename | 156 | &date_str, &date_str, &filename |
| 157 | #ifdef CONFIG_FEATURE_DATE_ISOFMT | 157 | #ifdef CONFIG_FEATURE_DATE_ISOFMT |
diff --git a/coreutils/id.c b/coreutils/id.c index 28050ddf2..14497b416 100644 --- a/coreutils/id.c +++ b/coreutils/id.c | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | 22 | ||
| 23 | /* BB_AUDIT SUSv3 _NOT_ compliant -- option -G is not currently supported. */ | 23 | /* BB_AUDIT SUSv3 _NOT_ compliant -- option -G is not currently supported. */ |
| 24 | /* Hacked by Tito Ragusa (C) 2004 to handle usernames of whatever length and to | 24 | /* Hacked by Tito Ragusa (C) 2004 to handle usernames of whatever length and to |
| 25 | * be more similar to GNU id. | 25 | * be more similar to GNU id. |
| 26 | */ | 26 | */ |
| 27 | 27 | ||
| 28 | #include "busybox.h" | 28 | #include "busybox.h" |
| @@ -41,10 +41,10 @@ | |||
| 41 | #define JUST_GROUP 8 | 41 | #define JUST_GROUP 8 |
| 42 | 42 | ||
| 43 | static short printf_full(unsigned int id, const char *arg, const char prefix) | 43 | static short printf_full(unsigned int id, const char *arg, const char prefix) |
| 44 | { | 44 | { |
| 45 | const char *fmt = "%cid=%u"; | 45 | const char *fmt = "%cid=%u"; |
| 46 | short status=EXIT_FAILURE; | 46 | short status=EXIT_FAILURE; |
| 47 | 47 | ||
| 48 | if(arg) { | 48 | if(arg) { |
| 49 | fmt = "%cid=%u(%s)"; | 49 | fmt = "%cid=%u(%s)"; |
| 50 | status=EXIT_SUCCESS; | 50 | status=EXIT_SUCCESS; |
| @@ -61,15 +61,14 @@ extern int id_main(int argc, char **argv) | |||
| 61 | unsigned long flags; | 61 | unsigned long flags; |
| 62 | short status; | 62 | short status; |
| 63 | 63 | ||
| 64 | bb_opt_complementally = "!u~g:g~u"; | 64 | /* Don't allow -n -r -nr -ug -rug -nug -rnug */ |
| 65 | bb_opt_complementally = "?u~g:g~u:r?ug:n?ug"; | ||
| 65 | flags = bb_getopt_ulflags(argc, argv, "rnug"); | 66 | flags = bb_getopt_ulflags(argc, argv, "rnug"); |
| 66 | 67 | ||
| 67 | /* Don't allow -n -r -nr */ | ||
| 68 | if ((flags <= 3 && flags > 0) | ||
| 69 | /* Don't allow more than one username */ | 68 | /* Don't allow more than one username */ |
| 70 | || (argc > optind + 1)) | 69 | if (argc > (optind + 1)) |
| 71 | bb_show_usage(); | 70 | bb_show_usage(); |
| 72 | 71 | ||
| 73 | /* This values could be overwritten later */ | 72 | /* This values could be overwritten later */ |
| 74 | uid = geteuid(); | 73 | uid = geteuid(); |
| 75 | gid = getegid(); | 74 | gid = getegid(); |
| @@ -77,13 +76,13 @@ extern int id_main(int argc, char **argv) | |||
| 77 | uid = getuid(); | 76 | uid = getuid(); |
| 78 | gid = getgid(); | 77 | gid = getgid(); |
| 79 | } | 78 | } |
| 80 | 79 | ||
| 81 | if(argv[optind]) { | 80 | if(argv[optind]) { |
| 82 | p=getpwnam(argv[optind]); | 81 | p=getpwnam(argv[optind]); |
| 83 | /* bb_xgetpwnam is needed because it exits on failure */ | 82 | /* bb_xgetpwnam is needed because it exits on failure */ |
| 84 | uid = bb_xgetpwnam(argv[optind]); | 83 | uid = bb_xgetpwnam(argv[optind]); |
| 85 | gid = p->pw_gid; | 84 | gid = p->pw_gid; |
| 86 | /* in this case PRINT_REAL is the same */ | 85 | /* in this case PRINT_REAL is the same */ |
| 87 | } | 86 | } |
| 88 | 87 | ||
| 89 | if(flags & (JUST_GROUP | JUST_USER)) { | 88 | if(flags & (JUST_GROUP | JUST_USER)) { |
| @@ -94,7 +93,7 @@ extern int id_main(int argc, char **argv) | |||
| 94 | } else { | 93 | } else { |
| 95 | bb_printf("%u\n",(flags & JUST_USER) ? uid : gid); | 94 | bb_printf("%u\n",(flags & JUST_USER) ? uid : gid); |
| 96 | } | 95 | } |
| 97 | /* exit */ | 96 | /* exit */ |
| 98 | bb_fflush_stdout_and_exit(EXIT_SUCCESS); | 97 | bb_fflush_stdout_and_exit(EXIT_SUCCESS); |
| 99 | } | 98 | } |
| 100 | 99 | ||
diff --git a/coreutils/install.c b/coreutils/install.c index 9fcb75405..9e5eb6037 100644 --- a/coreutils/install.c +++ b/coreutils/install.c | |||
| @@ -61,7 +61,7 @@ extern int install_main(int argc, char **argv) | |||
| 61 | int ret = EXIT_SUCCESS, flags, i, isdir; | 61 | int ret = EXIT_SUCCESS, flags, i, isdir; |
| 62 | 62 | ||
| 63 | bb_applet_long_options = install_long_options; | 63 | bb_applet_long_options = install_long_options; |
| 64 | bb_opt_complementally = "!s~d:d~s"; | 64 | bb_opt_complementally = "?s~d:d~s"; |
| 65 | /* -c exists for backwards compatability, its needed */ | 65 | /* -c exists for backwards compatability, its needed */ |
| 66 | flags = bb_getopt_ulflags(argc, argv, "cdpsg:m:o:", &gid_str, &mode_str, &uid_str); /* 'a' must be 2nd */ | 66 | flags = bb_getopt_ulflags(argc, argv, "cdpsg:m:o:", &gid_str, &mode_str, &uid_str); /* 'a' must be 2nd */ |
| 67 | 67 | ||
