diff options
| author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-12-18 14:06:03 +0000 |
|---|---|---|
| committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-12-18 14:06:03 +0000 |
| commit | 418ff464c5dcdfa8411ac3a67b1a9c8cd8b27e46 (patch) | |
| tree | 661b06aed50c423157b9f39bd40aba6e5dd46ad0 | |
| parent | 0b31c54b61af762d574892427a6dfeebbd07dc63 (diff) | |
| download | busybox-w32-418ff464c5dcdfa8411ac3a67b1a9c8cd8b27e46.tar.gz busybox-w32-418ff464c5dcdfa8411ac3a67b1a9c8cd8b27e46.tar.bz2 busybox-w32-418ff464c5dcdfa8411ac3a67b1a9c8cd8b27e46.zip | |
Vodz' last_patch31
Very minimal last corrections:
1) busybox.c: fix warining
2) docs/: add applets for list from pwd_grp
3) usage.h: add -n option for route
4) run_parts.c: many todo fix for busybox style
5) addgroup.c: add #ifdef CONFIG_FEATURE_SHADOWPASSWDS, reduce one
perror_msg
6) adduser.c: fix bug "variable i not initialize" and
add #ifdef CONFIG_FEATURE_SHADOWPASSWDS
git-svn-id: svn://busybox.net/trunk/busybox@3900 69ca8d6d-28ef-0310-b511-8ec308f3f277
| -rw-r--r-- | applets/busybox.c | 2 | ||||
| -rw-r--r-- | docs/busybox.sgml | 34 | ||||
| -rw-r--r-- | docs/busybox_footer.pod | 4 | ||||
| -rw-r--r-- | docs/busybox_header.pod | 27 | ||||
| -rw-r--r-- | include/usage.h | 2 | ||||
| -rw-r--r-- | init/run_parts.c | 89 |
6 files changed, 63 insertions, 95 deletions
diff --git a/applets/busybox.c b/applets/busybox.c index e6e5eca2d..858358175 100644 --- a/applets/busybox.c +++ b/applets/busybox.c | |||
| @@ -35,7 +35,7 @@ typedef int (*__link_f)(const char *, const char *); | |||
| 35 | * malloc'd string w/ full pathname of busybox's location | 35 | * malloc'd string w/ full pathname of busybox's location |
| 36 | * NULL on failure | 36 | * NULL on failure |
| 37 | */ | 37 | */ |
| 38 | static char *busybox_fullpath() | 38 | static char *busybox_fullpath(void) |
| 39 | { | 39 | { |
| 40 | return xreadlink("/proc/self/exe"); | 40 | return xreadlink("/proc/self/exe"); |
| 41 | } | 41 | } |
diff --git a/docs/busybox.sgml b/docs/busybox.sgml index 34559dab4..0a2683faf 100644 --- a/docs/busybox.sgml +++ b/docs/busybox.sgml | |||
| @@ -136,19 +136,23 @@ | |||
| 136 | </para> | 136 | </para> |
| 137 | 137 | ||
| 138 | <para> | 138 | <para> |
| 139 | ar, basename, cat, chgrp, chmod, chown, chroot, chvt, clear, | 139 | addgroup, adduser, adjtimex, ar, basename, busybox, cat, |
| 140 | cp, cut, date, dc, dd, deallocvt, df, dirname, dmesg, dpkg-deb, | 140 | chgrp, chmod, chown, chroot, chvt, clear, cmp, cp, cpio, cut, |
| 141 | du, dumpkmap, dutmp, echo, false, fbset, fdflush, find, free, | 141 | date, dc, dd, deallocvt, deluser, df, dirname, dmesg, |
| 142 | freeramdisk, fsck.minix, grep, gunzip, gzip, halt, head, | 142 | dos2unix, dpkg, dpkg-deb, du, dumpkmap, dutmp, echo, expr, |
| 143 | hostid, hostname, id, init, insmod, kill, killall, length, ln, | 143 | false, fbset, fdflush, find, free, freeramdisk, fsck.minix, |
| 144 | loadacm, loadfont, loadkmap, logger, logname, ls, lsmod, | 144 | getopt, getty, grep, gunzip, gzip, halt, head, hostid, |
| 145 | makedevs, mkdir, mkfifo, mkfs.minix, mknod, mkswap, mktemp, | 145 | hostname, id, ifconfig, init, insmod, kill, killall, klogd, |
| 146 | more, mount, mt, mv, nc, nslookup, ping, poweroff, printf, ps, | 146 | length, ln, loadacm, loadfont, loadkmap, logger, logname, ls, |
| 147 | pwd, reboot, renice, reset, rm, rmdir, rmmod, run-parts, sed, setkeycodes, sh, sleep, | 147 | lsmod, makedevs, md5sum, mkdir, mkfifo, mkfs.minix, mknod, |
| 148 | sort, swapoff, swapon, sync, syslogd, tail, tar, tee, telnet, | 148 | mkswap, mktemp, more, mount, mt, mv, nc, nslookup, ping, |
| 149 | test, touch, tr, true, tty, umount, uname, uniq, update, | 149 | pivot_root, poweroff, printf, ps, pwd, rdate, readlink, |
| 150 | uptime, usleep, uudecode, uuencode, wc, which, whoami, yes, | 150 | reboot, renice, reset, rm, rmdir, rmmod, route, rpm2cpio, |
| 151 | zcat, [ | 151 | sed, setkeycodes, sh, sleep, sort, stty, swapoff, swapon, |
| 152 | sync, syslogd, tail, tar, tee, telnet, test, tftp, touch, tr, | ||
| 153 | true, tty, umount, uname, uniq, unix2dos, update, uptime, | ||
| 154 | usleep, uudecode, uuencode, watchdog, wc, wget, which, | ||
| 155 | whoami, xargs, yes, zcat, [ | ||
| 152 | </para> | 156 | </para> |
| 153 | </sect1> | 157 | </sect1> |
| 154 | 158 | ||
| @@ -3996,6 +4000,10 @@ | |||
| 3996 | Enrique Zanardi <ezanardi@ull.es> | 4000 | Enrique Zanardi <ezanardi@ull.es> |
| 3997 | </para> | 4001 | </para> |
| 3998 | 4002 | ||
| 4003 | <para> | ||
| 4004 | Vladimir Oleynik <dzo@simtreas.ru> | ||
| 4005 | </para> | ||
| 4006 | |||
| 3999 | 4007 | ||
| 4000 | </chapter> | 4008 | </chapter> |
| 4001 | </book> <!-- End of the book --> | 4009 | </book> <!-- End of the book --> |
diff --git a/docs/busybox_footer.pod b/docs/busybox_footer.pod index 2ab4e166e..7c02003fc 100644 --- a/docs/busybox_footer.pod +++ b/docs/busybox_footer.pod | |||
| @@ -113,7 +113,7 @@ Glenn McGrath <bug1@netconnect.com.au> | |||
| 113 | 113 | ||
| 114 | Vladimir Oleynik <dzo@simtreas.ru> | 114 | Vladimir Oleynik <dzo@simtreas.ru> |
| 115 | 115 | ||
| 116 | cmdedit, stty-port, locale, various fixes | 116 | cmdedit; ports: ash, stty, traceroute; locale, various fixes |
| 117 | and irreconcilable critic of everything not perfect. | 117 | and irreconcilable critic of everything not perfect. |
| 118 | 118 | ||
| 119 | =for html <br> | 119 | =for html <br> |
| @@ -166,4 +166,4 @@ Enrique Zanardi <ezanardi@ull.es> | |||
| 166 | 166 | ||
| 167 | =cut | 167 | =cut |
| 168 | 168 | ||
| 169 | # $Id: busybox_footer.pod,v 1.4 2001/04/17 17:09:34 beppu Exp $ | 169 | # $Id: busybox_footer.pod,v 1.5 2001/12/18 14:06:01 andersen Exp $ |
diff --git a/docs/busybox_header.pod b/docs/busybox_header.pod index 764d6e35f..0ea7dbfe7 100644 --- a/docs/busybox_header.pod +++ b/docs/busybox_header.pod | |||
| @@ -55,19 +55,20 @@ terse runtime description of their behavior. | |||
| 55 | 55 | ||
| 56 | Currently defined functions include: | 56 | Currently defined functions include: |
| 57 | 57 | ||
| 58 | adjtimex, ar, basename, busybox, cat, chgrp, chmod, chown, chroot, chvt, clear, | 58 | addgroup, adduser, adjtimex, ar, basename, busybox, cat, chgrp, chmod, |
| 59 | cmp, cp, cpio, cut, date, dc, dd, deallocvt, df, dirname, dmesg, dos2unix, dpkg, | 59 | chown, chroot, chvt, clear, cmp, cp, cpio, cut, date, dc, dd, deallocvt, |
| 60 | dpkg-deb, du, dumpkmap, dutmp, echo, expr, false, fbset, fdflush, find, free, | 60 | deluser, df, dirname, dmesg, dos2unix, dpkg, dpkg-deb, du, dumpkmap, dutmp, |
| 61 | freeramdisk, fsck.minix, getopt, grep, gunzip, gzip, halt, head, hostid, | 61 | echo, expr, false, fbset, fdflush, find, free, freeramdisk, fsck.minix, |
| 62 | hostname, id, ifconfig, init, insmod, kill, killall, klogd, length, ln, | 62 | getopt, getty, grep, gunzip, gzip, halt, head, hostid, hostname, id, |
| 63 | loadacm, loadfont, loadkmap, logger, logname, ls, lsmod, makedevs, md5sum, | 63 | ifconfig, init, insmod, kill, killall, klogd, length, ln, loadacm, |
| 64 | mkdir, mkfifo, mkfs.minix, mknod, mkswap, mktemp, more, mount, mt, mv, nc, | 64 | loadfont, loadkmap, logger, logname, ls, lsmod, makedevs, md5sum, mkdir, |
| 65 | nslookup, ping, pivot_root, poweroff, printf, ps, pwd, rdate, readlink, reboot, | 65 | mkfifo, mkfs.minix, mknod, mkswap, mktemp, more, mount, mt, mv, nc, |
| 66 | renice, reset, rm, rmdir, rmmod, route, rpm2cpio, sed, setkeycodes, | 66 | nslookup, ping, pivot_root, poweroff, printf, ps, pwd, rdate, readlink, |
| 67 | sh, sleep, sort, stty, swapoff, swapon, sync, syslogd, tail, tar, tee, telnet, | 67 | reboot, renice, reset, rm, rmdir, rmmod, route, rpm2cpio, sed, setkeycodes, |
| 68 | test, tftp, touch, tr, true, tty, umount, uname, uniq, unix2dos, update, uptime, | 68 | sh, sleep, sort, stty, swapoff, swapon, sync, syslogd, tail, tar, tee, |
| 69 | usleep, uudecode, uuencode, watchdog, wc, wget, which, whoami, xargs, yes, zcat, | 69 | telnet, test, tftp, touch, tr, true, tty, umount, uname, uniq, unix2dos, |
| 70 | [ | 70 | update, uptime, usleep, uudecode, uuencode, watchdog, wc, wget, which, |
| 71 | whoami, xargs, yes, zcat, [ | ||
| 71 | 72 | ||
| 72 | =over 4 | 73 | =over 4 |
| 73 | 74 | ||
diff --git a/include/usage.h b/include/usage.h index a970c0f9c..20e2448fd 100644 --- a/include/usage.h +++ b/include/usage.h | |||
| @@ -1432,6 +1432,8 @@ | |||
| 1432 | "[{add|del|flush}]" | 1432 | "[{add|del|flush}]" |
| 1433 | #define route_full_usage \ | 1433 | #define route_full_usage \ |
| 1434 | "Edit the kernel's routing tables" | 1434 | "Edit the kernel's routing tables" |
| 1435 | "Options:\n" \ | ||
| 1436 | "\t-n\tDont resolve names." | ||
| 1435 | 1437 | ||
| 1436 | #define rpm2cpio_trivial_usage \ | 1438 | #define rpm2cpio_trivial_usage \ |
| 1437 | "package.rpm" | 1439 | "package.rpm" |
diff --git a/init/run_parts.c b/init/run_parts.c index 258afb4db..3ec4b9d10 100644 --- a/init/run_parts.c +++ b/init/run_parts.c | |||
| @@ -45,9 +45,9 @@ | |||
| 45 | * done - convert calls to error in perror... and remove error() | 45 | * done - convert calls to error in perror... and remove error() |
| 46 | * done - convert malloc/realloc to their x... counterparts | 46 | * done - convert malloc/realloc to their x... counterparts |
| 47 | * done - remove catch_sigchld | 47 | * done - remove catch_sigchld |
| 48 | * use bb's isdirectory() ? It seems that no applet use it. | ||
| 49 | * done - use bb's concat_path_file() | 48 | * done - use bb's concat_path_file() |
| 50 | * declare run_parts_main() as extern and any other function as static? */ | 49 | * done - declare run_parts_main() as extern and any other function as static? |
| 50 | */ | ||
| 51 | 51 | ||
| 52 | #include <stdio.h> | 52 | #include <stdio.h> |
| 53 | #include <stdarg.h> | 53 | #include <stdarg.h> |
| @@ -61,17 +61,14 @@ | |||
| 61 | #include <string.h> | 61 | #include <string.h> |
| 62 | #include <errno.h> | 62 | #include <errno.h> |
| 63 | #include <ctype.h> | 63 | #include <ctype.h> |
| 64 | /* #include <signal.h> | ||
| 65 | #include <sys/time.h> */ | ||
| 66 | 64 | ||
| 67 | #include "busybox.h" | 65 | #include "busybox.h" |
| 68 | 66 | ||
| 69 | int test_mode = 0; | 67 | static int test_mode = 0; |
| 70 | int verbose_mode = 0; | 68 | static int exitstatus = 0; |
| 71 | int exitstatus = 0; | ||
| 72 | 69 | ||
| 73 | int argcount = 0, argsize = 0; | 70 | static int argcount = 0, argsize = 0; |
| 74 | char **args = 0; | 71 | static char **args = 0; |
| 75 | 72 | ||
| 76 | 73 | ||
| 77 | /* set_umask */ | 74 | /* set_umask */ |
| @@ -80,7 +77,7 @@ char **args = 0; | |||
| 80 | * 8 and 9 digits under some circumstances. We'll just have to live with it. | 77 | * 8 and 9 digits under some circumstances. We'll just have to live with it. |
| 81 | */ | 78 | */ |
| 82 | 79 | ||
| 83 | void set_umask (void) | 80 | static void set_umask (void) |
| 84 | { | 81 | { |
| 85 | int mask, result; | 82 | int mask, result; |
| 86 | 83 | ||
| @@ -97,14 +94,14 @@ void set_umask (void) | |||
| 97 | /* add_argument */ | 94 | /* add_argument */ |
| 98 | /* Add an argument to the commands that we will call. Called once for | 95 | /* Add an argument to the commands that we will call. Called once for |
| 99 | every argument. */ | 96 | every argument. */ |
| 100 | void add_argument (char *newarg) | 97 | static void add_argument (char *newarg) |
| 101 | { | 98 | { |
| 102 | if (argcount+1 >= argsize) { | 99 | if (argcount+1 >= argsize) { |
| 103 | argsize = argsize ? argsize*2 : 4; | 100 | argsize = argsize ? argsize*2 : 4; |
| 104 | /*TODO if we convert to xrealloc we lose the verbose error message */ | 101 | /*TODO if we convert to xrealloc we lose the verbose error message */ |
| 105 | args = realloc(args, argsize * (sizeof(char*))); | 102 | args = realloc(args, argsize * (sizeof(char*))); |
| 106 | if (!args) { | 103 | if (!args) { |
| 107 | perror_msg_and_die ("failed to reallocate memory for arguments: %s", strerror(errno)); | 104 | perror_msg_and_die ("failed to reallocate memory for arguments"); |
| 108 | } | 105 | } |
| 109 | } | 106 | } |
| 110 | args[argcount++] = newarg; | 107 | args[argcount++] = newarg; |
| @@ -116,7 +113,7 @@ void add_argument (char *newarg) | |||
| 116 | * underscores, and hyphens only?) | 113 | * underscores, and hyphens only?) |
| 117 | */ | 114 | */ |
| 118 | 115 | ||
| 119 | int valid_name (const struct dirent *d) | 116 | static int valid_name (const struct dirent *d) |
| 120 | { | 117 | { |
| 121 | char *c = d->d_name; | 118 | char *c = d->d_name; |
| 122 | while (*c) { | 119 | while (*c) { |
| @@ -132,19 +129,19 @@ int valid_name (const struct dirent *d) | |||
| 132 | /* run_part */ | 129 | /* run_part */ |
| 133 | /* Execute a file */ | 130 | /* Execute a file */ |
| 134 | 131 | ||
| 135 | void run_part (char *progname) | 132 | static void run_part (char *progname) |
| 136 | { | 133 | { |
| 137 | int result; | 134 | int result; |
| 138 | int pid; | 135 | int pid; |
| 139 | 136 | ||
| 140 | 137 | ||
| 141 | if ((pid=fork()) < 0) { | 138 | if ((pid=fork()) < 0) { |
| 142 | perror_msg_and_die ("failed to fork: %s", strerror(errno)); | 139 | perror_msg_and_die ("failed to fork"); |
| 143 | } | 140 | } |
| 144 | else if (!pid) { | 141 | else if (!pid) { |
| 145 | args[0] = progname; | 142 | args[0] = progname; |
| 146 | execv (progname, args); | 143 | execv (progname, args); |
| 147 | perror_msg_and_die ("failed to exec %s: %s", progname, strerror (errno)); | 144 | perror_msg_and_die ("failed to exec %s", progname); |
| 148 | } | 145 | } |
| 149 | 146 | ||
| 150 | if (0) { | 147 | if (0) { |
| @@ -168,70 +165,30 @@ void run_part (char *progname) | |||
| 168 | /* run_parts */ | 165 | /* run_parts */ |
| 169 | /* Find the parts to run & call run_part() */ | 166 | /* Find the parts to run & call run_part() */ |
| 170 | 167 | ||
| 171 | void run_parts (char *dir_name) | 168 | static void run_parts (char *dir_name) |
| 172 | { | 169 | { |
| 173 | struct dirent **namelist; | 170 | struct dirent **namelist = 0; |
| 174 | char *filename = NULL; | 171 | char *filename; |
| 175 | size_t filename_length, dir_name_length; | 172 | int entries, i; |
| 176 | int entries, i, result; | ||
| 177 | struct stat st; | 173 | struct stat st; |
| 178 | 174 | ||
| 179 | /* dir_name + "/" */ | ||
| 180 | dir_name_length = strlen(dir_name) + 1; | ||
| 181 | |||
| 182 | /* dir_name + "/" + ".." + "\0" (This will save one realloc.) */ | ||
| 183 | filename_length = dir_name_length + 2 + 1; | ||
| 184 | |||
| 185 | /* -- | ||
| 186 | * Removed this part because I want try to use concat_path_file() */ | ||
| 187 | |||
| 188 | /* if (! (filename = malloc(filename_length))) { | ||
| 189 | error ("failed to allocate memory for path: %s", strerror(errno)); | ||
| 190 | exit (1); | ||
| 191 | } */ | ||
| 192 | |||
| 193 | /* -- */ | 175 | /* -- */ |
| 194 | 176 | ||
| 195 | /* scandir() isn't POSIX, but it makes things easy. */ | 177 | /* scandir() isn't POSIX, but it makes things easy. */ |
| 196 | entries = scandir (dir_name, &namelist, valid_name, alphasort); | 178 | entries = scandir (dir_name, &namelist, valid_name, alphasort); |
| 197 | 179 | ||
| 198 | if (entries < 0) { | 180 | if (entries < 0) { |
| 199 | perror_msg_and_die ("failed to open directory %s: %s", dir_name, strerror (errno)); | 181 | perror_msg_and_die ("failed to open directory %s", dir_name); |
| 200 | } | 182 | } |
| 201 | 183 | ||
| 202 | for (i = 0; i < entries; i++) { | 184 | for (i = 0; i < entries; i++) { |
| 203 | 185 | ||
| 204 | /* -- | ||
| 205 | * Removed this part because I want try to use concat_path_file() */ | ||
| 206 | |||
| 207 | /* if (filename_length < dir_name_length + strlen(namelist[i]->d_name) + 1) { | ||
| 208 | filename_length = dir_name_length + strlen(namelist[i]->d_name) + 1; | ||
| 209 | if (!(filename = realloc(filename, filename_length))) { | ||
| 210 | error ("failed to reallocate memory for path: %s", strerror(errno)); | ||
| 211 | exit (1); | ||
| 212 | } | ||
| 213 | } | ||
| 214 | |||
| 215 | */ | ||
| 216 | |||
| 217 | /* -- */ | ||
| 218 | |||
| 219 | |||
| 220 | /* -- | ||
| 221 | * Removed for concat_path_file() */ | ||
| 222 | |||
| 223 | /* strcpy (filename, dir_name); | ||
| 224 | strcat (filename, "/"); | ||
| 225 | strcat (filename, namelist[i]->d_name); */ | ||
| 226 | |||
| 227 | /* -- */ | 186 | /* -- */ |
| 228 | 187 | ||
| 229 | filename = concat_path_file (dir_name, namelist[i]->d_name); | 188 | filename = concat_path_file (dir_name, namelist[i]->d_name); |
| 230 | 189 | ||
| 231 | result = stat (filename, &st); | 190 | if (stat (filename, &st) < 0) { |
| 232 | if (result < 0) { | 191 | perror_msg_and_die ("failed to stat component %s", filename); |
| 233 | perror_msg_and_die ("failed to stat component %s: %s", filename, | ||
| 234 | strerror (errno)); | ||
| 235 | } | 192 | } |
| 236 | if (S_ISREG(st.st_mode) && !access (filename, X_OK)) { | 193 | if (S_ISREG(st.st_mode) && !access (filename, X_OK)) { |
| 237 | if (test_mode) | 194 | if (test_mode) |
| @@ -240,17 +197,17 @@ void run_parts (char *dir_name) | |||
| 240 | run_part (filename); | 197 | run_part (filename); |
| 241 | } | 198 | } |
| 242 | } | 199 | } |
| 243 | /*TODO convert to isdirectory() */ | 200 | |
| 244 | else if (!S_ISDIR(st.st_mode)) { | 201 | else if (!S_ISDIR(st.st_mode)) { |
| 245 | printf ("run-parts: component %s is not an executable plain file\n", | 202 | error_msg ("component %s is not an executable plain file", |
| 246 | filename); | 203 | filename); |
| 247 | exitstatus = 1; | 204 | exitstatus = 1; |
| 248 | } | 205 | } |
| 249 | 206 | ||
| 250 | free (namelist[i]); | 207 | free (namelist[i]); |
| 208 | free (filename); | ||
| 251 | } | 209 | } |
| 252 | free (namelist); | 210 | free (namelist); |
| 253 | free (filename); | ||
| 254 | } | 211 | } |
| 255 | 212 | ||
| 256 | /* run_parts_main */ | 213 | /* run_parts_main */ |
