diff options
| author | Erik Andersen <andersen@codepoet.org> | 2000-04-28 00:18:56 +0000 |
|---|---|---|
| committer | Erik Andersen <andersen@codepoet.org> | 2000-04-28 00:18:56 +0000 |
| commit | 4f3f757d56fbf420ea5030dcf7ea971b3da3ab47 (patch) | |
| tree | d986e9bb9f03bf1f83465c274c35c0d58ed544e4 | |
| parent | 227a59b05d6df9b4be5990915646249d6f548822 (diff) | |
| download | busybox-w32-4f3f757d56fbf420ea5030dcf7ea971b3da3ab47.tar.gz busybox-w32-4f3f757d56fbf420ea5030dcf7ea971b3da3ab47.tar.bz2 busybox-w32-4f3f757d56fbf420ea5030dcf7ea971b3da3ab47.zip | |
Latest and greatest. Some effort at libc5 (aiming towards newlib)
compatability.
-Erik
| -rw-r--r-- | Makefile | 7 | ||||
| -rw-r--r-- | applets/busybox.c | 7 | ||||
| -rw-r--r-- | archival/gunzip.c | 5 | ||||
| -rw-r--r-- | archival/gzip.c | 1 | ||||
| -rw-r--r-- | archival/tar.c | 1 | ||||
| -rw-r--r-- | busybox.c | 7 | ||||
| -rw-r--r-- | busybox.def.h | 5 | ||||
| -rw-r--r-- | chvt.c | 2 | ||||
| -rw-r--r-- | console-tools/chvt.c | 2 | ||||
| -rw-r--r-- | console-tools/deallocvt.c | 1 | ||||
| -rw-r--r-- | coreutils/du.c | 7 | ||||
| -rw-r--r-- | coreutils/ln.c | 13 | ||||
| -rw-r--r-- | coreutils/ls.c | 2 | ||||
| -rw-r--r-- | coreutils/mkdir.c | 5 | ||||
| -rw-r--r-- | coreutils/pwd.c | 3 | ||||
| -rw-r--r-- | cp_mv.c | 18 | ||||
| -rw-r--r-- | deallocvt.c | 1 | ||||
| -rw-r--r-- | docs/busybox.pod | 24 | ||||
| -rw-r--r-- | du.c | 7 | ||||
| -rw-r--r-- | dutmp.c | 12 | ||||
| -rw-r--r-- | freeramdisk.c | 3 | ||||
| -rw-r--r-- | fsck_minix.c | 9 | ||||
| -rw-r--r-- | gunzip.c | 5 | ||||
| -rw-r--r-- | gzip.c | 1 | ||||
| -rw-r--r-- | init.c | 61 | ||||
| -rw-r--r-- | init/init.c | 61 | ||||
| -rw-r--r-- | insmod.c | 6 | ||||
| -rw-r--r-- | internal.h | 63 | ||||
| -rw-r--r-- | ln.c | 13 | ||||
| -rw-r--r-- | ls.c | 2 | ||||
| -rw-r--r-- | miscutils/dutmp.c | 12 | ||||
| -rw-r--r-- | mkdir.c | 5 | ||||
| -rw-r--r-- | mkfs_minix.c | 4 | ||||
| -rw-r--r-- | modutils/insmod.c | 6 | ||||
| -rw-r--r-- | more.c | 12 | ||||
| -rw-r--r-- | mount.c | 3 | ||||
| -rw-r--r-- | pwd.c | 3 | ||||
| -rw-r--r-- | sysklogd/syslogd.c | 4 | ||||
| -rw-r--r-- | syslogd.c | 4 | ||||
| -rw-r--r-- | tar.c | 1 | ||||
| -rw-r--r-- | util-linux/freeramdisk.c | 3 | ||||
| -rw-r--r-- | util-linux/fsck_minix.c | 9 | ||||
| -rw-r--r-- | util-linux/mkfs_minix.c | 4 | ||||
| -rw-r--r-- | util-linux/more.c | 12 | ||||
| -rw-r--r-- | util-linux/mount.c | 3 | ||||
| -rw-r--r-- | utility.c | 13 |
46 files changed, 280 insertions, 172 deletions
| @@ -37,8 +37,8 @@ ARCH := $(shell uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/') | |||
| 37 | 37 | ||
| 38 | CC = gcc | 38 | CC = gcc |
| 39 | 39 | ||
| 40 | GCCMAJVERSION = $(shell $(CC) --version | sed -n "s/^[^0-9]*\([0-9]\)\.\([0-9].*\)[\.].*/\1/p") | 40 | GCCMAJVERSION = $(shell $(CC) --version | cut -f1 -d'.') |
| 41 | GCCMINVERSION = $(shell $(CC) --version | sed -n "s/^[^0-9]*\([0-9]\)\.\([0-9].*\)[\.].*/\2/p") | 41 | GCCMINVERSION = $(shell $(CC) --version | cut -f2 -d'.') |
| 42 | 42 | ||
| 43 | 43 | ||
| 44 | GCCSUPPORTSOPTSIZE = $(shell \ | 44 | GCCSUPPORTSOPTSIZE = $(shell \ |
| @@ -68,6 +68,7 @@ ifndef $(STRIPTOOL) | |||
| 68 | STRIPTOOL = strip | 68 | STRIPTOOL = strip |
| 69 | endif | 69 | endif |
| 70 | 70 | ||
| 71 | #also to try -- use --prefix=/usr/my-libc2.0.7-stuff | ||
| 71 | 72 | ||
| 72 | # -D_GNU_SOURCE is needed because environ is used in init.c | 73 | # -D_GNU_SOURCE is needed because environ is used in init.c |
| 73 | ifeq ($(DODEBUG),true) | 74 | ifeq ($(DODEBUG),true) |
| @@ -77,6 +78,8 @@ ifeq ($(DODEBUG),true) | |||
| 77 | else | 78 | else |
| 78 | CFLAGS += -Wall $(OPTIMIZATION) -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE | 79 | CFLAGS += -Wall $(OPTIMIZATION) -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE |
| 79 | LDFLAGS = -s | 80 | LDFLAGS = -s |
| 81 | #CFLAGS += -nostdinc -I/home/andersen/apps/newlib/src/newlib/libc/include -Wall $(OPTIMIZATION) -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE | ||
| 82 | #LDFLAGS = -nostdlib -s -L/home/andersen/apps/newlib/src/newlib/libc.a | ||
| 80 | STRIP = $(STRIPTOOL) --remove-section=.note --remove-section=.comment $(PROG) | 83 | STRIP = $(STRIPTOOL) --remove-section=.note --remove-section=.comment $(PROG) |
| 81 | #Only staticly link when _not_ debugging | 84 | #Only staticly link when _not_ debugging |
| 82 | ifeq ($(DOSTATIC),true) | 85 | ifeq ($(DOSTATIC),true) |
diff --git a/applets/busybox.c b/applets/busybox.c index 4a6f928e0..ca767584a 100644 --- a/applets/busybox.c +++ b/applets/busybox.c | |||
| @@ -248,12 +248,15 @@ static const struct Applet applets[] = { | |||
| 248 | #ifdef BB_SED | 248 | #ifdef BB_SED |
| 249 | {"sed", sed_main, _BB_DIR_BIN}, | 249 | {"sed", sed_main, _BB_DIR_BIN}, |
| 250 | #endif | 250 | #endif |
| 251 | #ifdef BB_SH | 251 | #ifdef BB_SETKEYCODES |
| 252 | {"sh", shell_main, _BB_DIR_BIN}, | 252 | {"setkeycodes", setkeycodes_main, _BB_DIR_USR_BIN}, |
| 253 | #endif | 253 | #endif |
| 254 | #ifdef BB_SFDISK | 254 | #ifdef BB_SFDISK |
| 255 | {"sfdisk", sfdisk_main, _BB_DIR_SBIN}, | 255 | {"sfdisk", sfdisk_main, _BB_DIR_SBIN}, |
| 256 | #endif | 256 | #endif |
| 257 | #ifdef BB_SH | ||
| 258 | {"sh", shell_main, _BB_DIR_BIN}, | ||
| 259 | #endif | ||
| 257 | #ifdef BB_SLEEP | 260 | #ifdef BB_SLEEP |
| 258 | {"sleep", sleep_main, _BB_DIR_BIN}, | 261 | {"sleep", sleep_main, _BB_DIR_BIN}, |
| 259 | #endif | 262 | #endif |
diff --git a/archival/gunzip.c b/archival/gunzip.c index 1a5cdba88..97ab84e2d 100644 --- a/archival/gunzip.c +++ b/archival/gunzip.c | |||
| @@ -102,7 +102,6 @@ static char *license_msg[] = { | |||
| 102 | #include <signal.h> | 102 | #include <signal.h> |
| 103 | #include <sys/stat.h> | 103 | #include <sys/stat.h> |
| 104 | #include <errno.h> | 104 | #include <errno.h> |
| 105 | #include <sys/param.h> /* for PATH_MAX */ | ||
| 106 | 105 | ||
| 107 | /* #include "tailor.h" */ | 106 | /* #include "tailor.h" */ |
| 108 | 107 | ||
| @@ -641,8 +640,8 @@ typedef RETSIGTYPE(*sig_type) (int); | |||
| 641 | #define RW_USER (S_IRUSR | S_IWUSR) /* creation mode for open() */ | 640 | #define RW_USER (S_IRUSR | S_IWUSR) /* creation mode for open() */ |
| 642 | 641 | ||
| 643 | #ifndef MAX_PATH_LEN /* max pathname length */ | 642 | #ifndef MAX_PATH_LEN /* max pathname length */ |
| 644 | # ifdef PATH_MAX | 643 | # ifdef BUFSIZ |
| 645 | # define MAX_PATH_LEN PATH_MAX | 644 | # define MAX_PATH_LEN BUFSIZ |
| 646 | # else | 645 | # else |
| 647 | # define MAX_PATH_LEN 1024 | 646 | # define MAX_PATH_LEN 1024 |
| 648 | # endif | 647 | # endif |
diff --git a/archival/gzip.c b/archival/gzip.c index a9d34aeb1..cc6868b53 100644 --- a/archival/gzip.c +++ b/archival/gzip.c | |||
| @@ -2272,7 +2272,6 @@ local void set_file_type (void); | |||
| 2272 | * used. | 2272 | * used. |
| 2273 | */ | 2273 | */ |
| 2274 | 2274 | ||
| 2275 | #define MAX(a,b) (a >= b ? a : b) | ||
| 2276 | /* the arguments must not have side effects */ | 2275 | /* the arguments must not have side effects */ |
| 2277 | 2276 | ||
| 2278 | /* =========================================================================== | 2277 | /* =========================================================================== |
diff --git a/archival/tar.c b/archival/tar.c index 0177d5188..e205763db 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
| @@ -49,7 +49,6 @@ | |||
| 49 | #include <utime.h> | 49 | #include <utime.h> |
| 50 | #include <sys/types.h> | 50 | #include <sys/types.h> |
| 51 | #include <sys/sysmacros.h> | 51 | #include <sys/sysmacros.h> |
| 52 | #include <sys/param.h> /* for PATH_MAX */ | ||
| 53 | 52 | ||
| 54 | 53 | ||
| 55 | static const char tar_usage[] = | 54 | static const char tar_usage[] = |
| @@ -248,12 +248,15 @@ static const struct Applet applets[] = { | |||
| 248 | #ifdef BB_SED | 248 | #ifdef BB_SED |
| 249 | {"sed", sed_main, _BB_DIR_BIN}, | 249 | {"sed", sed_main, _BB_DIR_BIN}, |
| 250 | #endif | 250 | #endif |
| 251 | #ifdef BB_SH | 251 | #ifdef BB_SETKEYCODES |
| 252 | {"sh", shell_main, _BB_DIR_BIN}, | 252 | {"setkeycodes", setkeycodes_main, _BB_DIR_USR_BIN}, |
| 253 | #endif | 253 | #endif |
| 254 | #ifdef BB_SFDISK | 254 | #ifdef BB_SFDISK |
| 255 | {"sfdisk", sfdisk_main, _BB_DIR_SBIN}, | 255 | {"sfdisk", sfdisk_main, _BB_DIR_SBIN}, |
| 256 | #endif | 256 | #endif |
| 257 | #ifdef BB_SH | ||
| 258 | {"sh", shell_main, _BB_DIR_BIN}, | ||
| 259 | #endif | ||
| 257 | #ifdef BB_SLEEP | 260 | #ifdef BB_SLEEP |
| 258 | {"sleep", sleep_main, _BB_DIR_BIN}, | 261 | {"sleep", sleep_main, _BB_DIR_BIN}, |
| 259 | #endif | 262 | #endif |
diff --git a/busybox.def.h b/busybox.def.h index 3012b0cd5..c10c1a318 100644 --- a/busybox.def.h +++ b/busybox.def.h | |||
| @@ -75,6 +75,7 @@ | |||
| 75 | #define BB_RMDIR | 75 | #define BB_RMDIR |
| 76 | #define BB_RMMOD | 76 | #define BB_RMMOD |
| 77 | #define BB_SED | 77 | #define BB_SED |
| 78 | #define BB_SETKEYCODES | ||
| 78 | #define BB_SFDISK | 79 | #define BB_SFDISK |
| 79 | #define BB_SH | 80 | #define BB_SH |
| 80 | #define BB_SLEEP | 81 | #define BB_SLEEP |
| @@ -136,7 +137,7 @@ | |||
| 136 | //#define BB_FEATURE_TRIVIAL_HELP | 137 | //#define BB_FEATURE_TRIVIAL_HELP |
| 137 | // | 138 | // |
| 138 | // Use termios to manipulate the screen ('more' is prettier with this on) | 139 | // Use termios to manipulate the screen ('more' is prettier with this on) |
| 139 | #define BB_FEATURE_USE_TERMIOS | 140 | //#define BB_FEATURE_USE_TERMIOS |
| 140 | // | 141 | // |
| 141 | // calculate terminal & column widths (for more and ls) | 142 | // calculate terminal & column widths (for more and ls) |
| 142 | #define BB_FEATURE_AUTOWIDTH | 143 | #define BB_FEATURE_AUTOWIDTH |
| @@ -193,7 +194,7 @@ | |||
| 193 | #define BB_FEATURE_SORT_REVERSE | 194 | #define BB_FEATURE_SORT_REVERSE |
| 194 | // | 195 | // |
| 195 | // Enable command line editing in the shell | 196 | // Enable command line editing in the shell |
| 196 | #define BB_FEATURE_SH_COMMAND_EDITING | 197 | //#define BB_FEATURE_SH_COMMAND_EDITING |
| 197 | // | 198 | // |
| 198 | // Enable tab completion in the shell (not yet | 199 | // Enable tab completion in the shell (not yet |
| 199 | // working very well -- so don't turn this on) | 200 | // working very well -- so don't turn this on) |
| @@ -12,8 +12,6 @@ | |||
| 12 | #include <stdlib.h> | 12 | #include <stdlib.h> |
| 13 | #include <fcntl.h> | 13 | #include <fcntl.h> |
| 14 | 14 | ||
| 15 | extern int getfd(void); | ||
| 16 | |||
| 17 | int chvt_main(int argc, char **argv) | 15 | int chvt_main(int argc, char **argv) |
| 18 | { | 16 | { |
| 19 | int fd, num; | 17 | int fd, num; |
diff --git a/console-tools/chvt.c b/console-tools/chvt.c index bf1ed609b..37fd21ae9 100644 --- a/console-tools/chvt.c +++ b/console-tools/chvt.c | |||
| @@ -12,8 +12,6 @@ | |||
| 12 | #include <stdlib.h> | 12 | #include <stdlib.h> |
| 13 | #include <fcntl.h> | 13 | #include <fcntl.h> |
| 14 | 14 | ||
| 15 | extern int getfd(void); | ||
| 16 | |||
| 17 | int chvt_main(int argc, char **argv) | 15 | int chvt_main(int argc, char **argv) |
| 18 | { | 16 | { |
| 19 | int fd, num; | 17 | int fd, num; |
diff --git a/console-tools/deallocvt.c b/console-tools/deallocvt.c index 141062edc..ee858797c 100644 --- a/console-tools/deallocvt.c +++ b/console-tools/deallocvt.c | |||
| @@ -11,7 +11,6 @@ | |||
| 11 | #include <linux/vt.h> | 11 | #include <linux/vt.h> |
| 12 | #include <stdio.h> | 12 | #include <stdio.h> |
| 13 | 13 | ||
| 14 | extern int getfd(void); | ||
| 15 | char *progname; | 14 | char *progname; |
| 16 | 15 | ||
| 17 | int deallocvt_main(int argc, char *argv[]) | 16 | int deallocvt_main(int argc, char *argv[]) |
diff --git a/coreutils/du.c b/coreutils/du.c index 874538015..c4fb3a38d 100644 --- a/coreutils/du.c +++ b/coreutils/du.c | |||
| @@ -32,7 +32,6 @@ | |||
| 32 | #include <dirent.h> | 32 | #include <dirent.h> |
| 33 | #include <stdio.h> | 33 | #include <stdio.h> |
| 34 | #include <errno.h> | 34 | #include <errno.h> |
| 35 | #include <sys/param.h> /* for PATH_MAX */ | ||
| 36 | 35 | ||
| 37 | typedef void (Display) (long, char *); | 36 | typedef void (Display) (long, char *); |
| 38 | 37 | ||
| @@ -97,7 +96,7 @@ static long du(char *filename) | |||
| 97 | filename[--len] = '\0'; | 96 | filename[--len] = '\0'; |
| 98 | 97 | ||
| 99 | while ((entry = readdir(dir))) { | 98 | while ((entry = readdir(dir))) { |
| 100 | char newfile[PATH_MAX + 1]; | 99 | char newfile[BUFSIZ + 1]; |
| 101 | char *name = entry->d_name; | 100 | char *name = entry->d_name; |
| 102 | 101 | ||
| 103 | if ((strcmp(name, "..") == 0) | 102 | if ((strcmp(name, "..") == 0) |
| @@ -105,7 +104,7 @@ static long du(char *filename) | |||
| 105 | continue; | 104 | continue; |
| 106 | } | 105 | } |
| 107 | 106 | ||
| 108 | if (len + strlen(name) + 1 > PATH_MAX) { | 107 | if (len + strlen(name) + 1 > BUFSIZ) { |
| 109 | fprintf(stderr, name_too_long, "du"); | 108 | fprintf(stderr, name_too_long, "du"); |
| 110 | du_depth--; | 109 | du_depth--; |
| 111 | return 0; | 110 | return 0; |
| @@ -182,7 +181,7 @@ int du_main(int argc, char **argv) | |||
| 182 | exit(0); | 181 | exit(0); |
| 183 | } | 182 | } |
| 184 | 183 | ||
| 185 | /* $Id: du.c,v 1.17 2000/04/13 01:18:56 erik Exp $ */ | 184 | /* $Id: du.c,v 1.18 2000/04/28 00:18:56 erik Exp $ */ |
| 186 | /* | 185 | /* |
| 187 | Local Variables: | 186 | Local Variables: |
| 188 | c-file-style: "linux" | 187 | c-file-style: "linux" |
diff --git a/coreutils/ln.c b/coreutils/ln.c index 4be60624e..eb7c99608 100644 --- a/coreutils/ln.c +++ b/coreutils/ln.c | |||
| @@ -30,7 +30,6 @@ | |||
| 30 | #include <stdio.h> | 30 | #include <stdio.h> |
| 31 | #include <dirent.h> | 31 | #include <dirent.h> |
| 32 | #include <errno.h> | 32 | #include <errno.h> |
| 33 | #include <sys/param.h> /* for PATH_MAX */ | ||
| 34 | 33 | ||
| 35 | static const char ln_usage[] = | 34 | static const char ln_usage[] = |
| 36 | "ln [OPTION] TARGET... LINK_NAME|DIRECTORY\n\n" | 35 | "ln [OPTION] TARGET... LINK_NAME|DIRECTORY\n\n" |
| @@ -78,7 +77,7 @@ extern int ln_main(int argc, char **argv) | |||
| 78 | 77 | ||
| 79 | linkName = argv[argc - 1]; | 78 | linkName = argv[argc - 1]; |
| 80 | 79 | ||
| 81 | if (strlen(linkName) > PATH_MAX) { | 80 | if (strlen(linkName) > BUFSIZ) { |
| 82 | fprintf(stderr, name_too_long, "ln"); | 81 | fprintf(stderr, name_too_long, "ln"); |
| 83 | exit FALSE; | 82 | exit FALSE; |
| 84 | } | 83 | } |
| @@ -91,10 +90,10 @@ extern int ln_main(int argc, char **argv) | |||
| 91 | } | 90 | } |
| 92 | 91 | ||
| 93 | while (argc-- >= 2) { | 92 | while (argc-- >= 2) { |
| 94 | char srcName[PATH_MAX + 1]; | 93 | char srcName[BUFSIZ + 1]; |
| 95 | int nChars, status; | 94 | int nChars, status; |
| 96 | 95 | ||
| 97 | if (strlen(*argv) > PATH_MAX) { | 96 | if (strlen(*argv) > BUFSIZ) { |
| 98 | fprintf(stderr, name_too_long, "ln"); | 97 | fprintf(stderr, name_too_long, "ln"); |
| 99 | exit FALSE; | 98 | exit FALSE; |
| 100 | } | 99 | } |
| @@ -102,9 +101,9 @@ extern int ln_main(int argc, char **argv) | |||
| 102 | if (followLinks == FALSE) { | 101 | if (followLinks == FALSE) { |
| 103 | strcpy(srcName, *argv); | 102 | strcpy(srcName, *argv); |
| 104 | } else { | 103 | } else { |
| 105 | /* Warning! This can silently truncate if > PATH_MAX, but | 104 | /* Warning! This can silently truncate if > BUFSIZ, but |
| 106 | I don't think that there can be one > PATH_MAX anyway. */ | 105 | I don't think that there can be one > BUFSIZ anyway. */ |
| 107 | nChars = readlink(*argv, srcName, PATH_MAX); | 106 | nChars = readlink(*argv, srcName, BUFSIZ); |
| 108 | srcName[nChars] = '\0'; | 107 | srcName[nChars] = '\0'; |
| 109 | } | 108 | } |
| 110 | 109 | ||
diff --git a/coreutils/ls.c b/coreutils/ls.c index 0c7f6522c..3c518ab28 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
| @@ -183,7 +183,7 @@ static char append_char(mode_t mode) | |||
| 183 | static void list_single(const char *name, struct stat *info, | 183 | static void list_single(const char *name, struct stat *info, |
| 184 | const char *fullname) | 184 | const char *fullname) |
| 185 | { | 185 | { |
| 186 | char scratch[PATH_MAX + 1]; | 186 | char scratch[BUFSIZ + 1]; |
| 187 | short len = strlen(name); | 187 | short len = strlen(name); |
| 188 | 188 | ||
| 189 | #ifdef BB_FEATURE_LS_FILETYPES | 189 | #ifdef BB_FEATURE_LS_FILETYPES |
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c index b0a2d57d6..54d9b7241 100644 --- a/coreutils/mkdir.c +++ b/coreutils/mkdir.c | |||
| @@ -28,7 +28,6 @@ | |||
| 28 | 28 | ||
| 29 | #include <stdio.h> | 29 | #include <stdio.h> |
| 30 | #include <errno.h> | 30 | #include <errno.h> |
| 31 | #include <sys/param.h> /* for PATH_MAX */ | ||
| 32 | 31 | ||
| 33 | static const char mkdir_usage[] = | 32 | static const char mkdir_usage[] = |
| 34 | "mkdir [OPTION] DIRECTORY...\n\n" | 33 | "mkdir [OPTION] DIRECTORY...\n\n" |
| @@ -86,9 +85,9 @@ extern int mkdir_main(int argc, char **argv) | |||
| 86 | while (argc > 0) { | 85 | while (argc > 0) { |
| 87 | int status; | 86 | int status; |
| 88 | struct stat statBuf; | 87 | struct stat statBuf; |
| 89 | char buf[PATH_MAX + 1]; | 88 | char buf[BUFSIZ + 1]; |
| 90 | 89 | ||
| 91 | if (strlen(*argv) > PATH_MAX - 1) { | 90 | if (strlen(*argv) > BUFSIZ - 1) { |
| 92 | fprintf(stderr, name_too_long, "mkdir"); | 91 | fprintf(stderr, name_too_long, "mkdir"); |
| 93 | exit FALSE; | 92 | exit FALSE; |
| 94 | } | 93 | } |
diff --git a/coreutils/pwd.c b/coreutils/pwd.c index 00163178b..e77a0ca70 100644 --- a/coreutils/pwd.c +++ b/coreutils/pwd.c | |||
| @@ -24,11 +24,10 @@ | |||
| 24 | #include "internal.h" | 24 | #include "internal.h" |
| 25 | #include <stdio.h> | 25 | #include <stdio.h> |
| 26 | #include <dirent.h> | 26 | #include <dirent.h> |
| 27 | #include <sys/param.h> | ||
| 28 | 27 | ||
| 29 | extern int pwd_main(int argc, char **argv) | 28 | extern int pwd_main(int argc, char **argv) |
| 30 | { | 29 | { |
| 31 | char buf[PATH_MAX + 1]; | 30 | char buf[BUFSIZ + 1]; |
| 32 | 31 | ||
| 33 | if (getcwd(buf, sizeof(buf)) == NULL) { | 32 | if (getcwd(buf, sizeof(buf)) == NULL) { |
| 34 | perror("get working directory"); | 33 | perror("get working directory"); |
| @@ -74,7 +74,7 @@ static const char *baseSrcName; | |||
| 74 | static int srcDirFlag; | 74 | static int srcDirFlag; |
| 75 | static struct stat srcStatBuf; | 75 | static struct stat srcStatBuf; |
| 76 | 76 | ||
| 77 | static char baseDestName[PATH_MAX + 1]; | 77 | static char baseDestName[BUFSIZ + 1]; |
| 78 | static size_t baseDestLen; | 78 | static size_t baseDestLen; |
| 79 | static int destDirFlag; | 79 | static int destDirFlag; |
| 80 | static struct stat destStatBuf; | 80 | static struct stat destStatBuf; |
| @@ -97,12 +97,12 @@ fill_baseDest_buf(char *_buf, size_t * _buflen) { | |||
| 97 | if ((srcBasename = strrchr(baseSrcName, '/')) == NULL) { | 97 | if ((srcBasename = strrchr(baseSrcName, '/')) == NULL) { |
| 98 | srcBasename = baseSrcName; | 98 | srcBasename = baseSrcName; |
| 99 | if (_buf[*_buflen - 1] != '/') { | 99 | if (_buf[*_buflen - 1] != '/') { |
| 100 | if (++(*_buflen) > PATH_MAX) | 100 | if (++(*_buflen) > BUFSIZ) |
| 101 | name_too_long__exit(); | 101 | name_too_long__exit(); |
| 102 | strcat(_buf, "/"); | 102 | strcat(_buf, "/"); |
| 103 | } | 103 | } |
| 104 | } | 104 | } |
| 105 | if (*_buflen + strlen(srcBasename) > PATH_MAX) | 105 | if (*_buflen + strlen(srcBasename) > BUFSIZ) |
| 106 | name_too_long__exit(); | 106 | name_too_long__exit(); |
| 107 | strcat(_buf, srcBasename); | 107 | strcat(_buf, srcBasename); |
| 108 | return; | 108 | return; |
| @@ -112,7 +112,7 @@ fill_baseDest_buf(char *_buf, size_t * _buflen) { | |||
| 112 | static int | 112 | static int |
| 113 | cp_mv_Action(const char *fileName, struct stat *statbuf, void* junk) | 113 | cp_mv_Action(const char *fileName, struct stat *statbuf, void* junk) |
| 114 | { | 114 | { |
| 115 | char destName[PATH_MAX + 1]; | 115 | char destName[BUFSIZ + 1]; |
| 116 | size_t destLen; | 116 | size_t destLen; |
| 117 | const char *srcBasename; | 117 | const char *srcBasename; |
| 118 | char *name; | 118 | char *name; |
| @@ -128,7 +128,7 @@ cp_mv_Action(const char *fileName, struct stat *statbuf, void* junk) | |||
| 128 | srcBasename = (strstr(fileName, baseSrcName) | 128 | srcBasename = (strstr(fileName, baseSrcName) |
| 129 | + strlen(baseSrcName)); | 129 | + strlen(baseSrcName)); |
| 130 | 130 | ||
| 131 | if (destLen + strlen(srcBasename) > PATH_MAX) { | 131 | if (destLen + strlen(srcBasename) > BUFSIZ) { |
| 132 | fprintf(stderr, name_too_long, dz); | 132 | fprintf(stderr, name_too_long, dz); |
| 133 | return FALSE; | 133 | return FALSE; |
| 134 | } | 134 | } |
| @@ -230,7 +230,7 @@ extern int cp_mv_main(int argc, char **argv) | |||
| 230 | followLinks = FALSE; | 230 | followLinks = FALSE; |
| 231 | } | 231 | } |
| 232 | 232 | ||
| 233 | if (strlen(argv[argc - 1]) > PATH_MAX) { | 233 | if (strlen(argv[argc - 1]) > BUFSIZ) { |
| 234 | fprintf(stderr, name_too_long, "cp"); | 234 | fprintf(stderr, name_too_long, "cp"); |
| 235 | goto exit_false; | 235 | goto exit_false; |
| 236 | } | 236 | } |
| @@ -252,7 +252,7 @@ extern int cp_mv_main(int argc, char **argv) | |||
| 252 | 252 | ||
| 253 | baseSrcName = *(argv++); | 253 | baseSrcName = *(argv++); |
| 254 | 254 | ||
| 255 | if ((srcLen = strlen(baseSrcName)) > PATH_MAX) | 255 | if ((srcLen = strlen(baseSrcName)) > BUFSIZ) |
| 256 | name_too_long__exit(); | 256 | name_too_long__exit(); |
| 257 | 257 | ||
| 258 | if (srcLen == 0) continue; /* "" */ | 258 | if (srcLen == 0) continue; /* "" */ |
| @@ -266,7 +266,7 @@ extern int cp_mv_main(int argc, char **argv) | |||
| 266 | int state = 0; | 266 | int state = 0; |
| 267 | char *pushd, *d, *p; | 267 | char *pushd, *d, *p; |
| 268 | 268 | ||
| 269 | if ((pushd = getcwd(NULL, PATH_MAX + 1)) == NULL) { | 269 | if ((pushd = getcwd(NULL, BUFSIZ + 1)) == NULL) { |
| 270 | fprintf(stderr, "%s: getcwd(): %s\n", dz, strerror(errno)); | 270 | fprintf(stderr, "%s: getcwd(): %s\n", dz, strerror(errno)); |
| 271 | continue; | 271 | continue; |
| 272 | } | 272 | } |
| @@ -274,7 +274,7 @@ extern int cp_mv_main(int argc, char **argv) | |||
| 274 | fprintf(stderr, "%s: chdir(%s): %s\n", dz, baseSrcName, strerror(errno)); | 274 | fprintf(stderr, "%s: chdir(%s): %s\n", dz, baseSrcName, strerror(errno)); |
| 275 | continue; | 275 | continue; |
| 276 | } | 276 | } |
| 277 | if ((d = getcwd(NULL, PATH_MAX + 1)) == NULL) { | 277 | if ((d = getcwd(NULL, BUFSIZ + 1)) == NULL) { |
| 278 | fprintf(stderr, "%s: getcwd(): %s\n", dz, strerror(errno)); | 278 | fprintf(stderr, "%s: getcwd(): %s\n", dz, strerror(errno)); |
| 279 | continue; | 279 | continue; |
| 280 | } | 280 | } |
diff --git a/deallocvt.c b/deallocvt.c index 141062edc..ee858797c 100644 --- a/deallocvt.c +++ b/deallocvt.c | |||
| @@ -11,7 +11,6 @@ | |||
| 11 | #include <linux/vt.h> | 11 | #include <linux/vt.h> |
| 12 | #include <stdio.h> | 12 | #include <stdio.h> |
| 13 | 13 | ||
| 14 | extern int getfd(void); | ||
| 15 | char *progname; | 14 | char *progname; |
| 16 | 15 | ||
| 17 | int deallocvt_main(int argc, char *argv[]) | 16 | int deallocvt_main(int argc, char *argv[]) |
diff --git a/docs/busybox.pod b/docs/busybox.pod index 6fd8289f2..c331c65ec 100644 --- a/docs/busybox.pod +++ b/docs/busybox.pod | |||
| @@ -61,9 +61,9 @@ freeramdisk, deallocvt, fsck.minix, grep, gunzip, gzip, halt, head, hostid, | |||
| 61 | hostname, init, kill, killall, length, ln, loadacm, loadfont, loadkmap, logger, | 61 | hostname, init, kill, killall, length, ln, loadacm, loadfont, loadkmap, logger, |
| 62 | logname, ls, lsmod, makedevs, math, mkdir, mkfifo, mkfs.minix, mknod, mkswap, | 62 | logname, ls, lsmod, makedevs, math, mkdir, mkfifo, mkfs.minix, mknod, mkswap, |
| 63 | mktemp, mnc, more, mount, mt, mv, nslookup, ping, poweroff, printf, ps, pwd, | 63 | mktemp, mnc, more, mount, mt, mv, nslookup, ping, poweroff, printf, ps, pwd, |
| 64 | reboot, rm, rmdir, rmmod, sed, sh, sfdisk, sleep, sort, sync, syslogd, swapon, | 64 | reboot, rm, rmdir, rmmod, sed, setkeycodes, sh, sfdisk, sleep, sort, sync, |
| 65 | swapoff, tail, tar, test, tee, touch, tr, true, tty, umount, uname, uniq, | 65 | syslogd, swapon, swapoff, tail, tar, test, tee, touch, tr, true, tty, umount, |
| 66 | update, uptime, usleep, wc, whoami, yes, zcat, [ | 66 | uname, uniq, update, uptime, usleep, wc, whoami, yes, zcat, [ |
| 67 | 67 | ||
| 68 | =over 4 | 68 | =over 4 |
| 69 | 69 | ||
| @@ -1336,6 +1336,22 @@ Example: | |||
| 1336 | 1336 | ||
| 1337 | ------------------------------- | 1337 | ------------------------------- |
| 1338 | 1338 | ||
| 1339 | =item setkeycodes | ||
| 1340 | |||
| 1341 | Usage: setkeycodes SCANCODE KEYCODE ... | ||
| 1342 | |||
| 1343 | Set entries into the kernel's scancode-to-keycode map, | ||
| 1344 | allowing unusual keyboards to generate usable keycodes. | ||
| 1345 | |||
| 1346 | SCANCODE may be either xx or e0xx (hexadecimal), | ||
| 1347 | and KEYCODE is given in decimal | ||
| 1348 | |||
| 1349 | Example: | ||
| 1350 | |||
| 1351 | # setkeycodes e030 127 | ||
| 1352 | |||
| 1353 | ------------------------------- | ||
| 1354 | |||
| 1339 | =item sh | 1355 | =item sh |
| 1340 | 1356 | ||
| 1341 | Usage: sh | 1357 | Usage: sh |
| @@ -1833,4 +1849,4 @@ Enrique Zanardi <ezanardi@ull.es> | |||
| 1833 | 1849 | ||
| 1834 | =cut | 1850 | =cut |
| 1835 | 1851 | ||
| 1836 | # $Id: busybox.pod,v 1.23 2000/04/25 23:24:55 erik Exp $ | 1852 | # $Id: busybox.pod,v 1.24 2000/04/28 00:18:56 erik Exp $ |
| @@ -32,7 +32,6 @@ | |||
| 32 | #include <dirent.h> | 32 | #include <dirent.h> |
| 33 | #include <stdio.h> | 33 | #include <stdio.h> |
| 34 | #include <errno.h> | 34 | #include <errno.h> |
| 35 | #include <sys/param.h> /* for PATH_MAX */ | ||
| 36 | 35 | ||
| 37 | typedef void (Display) (long, char *); | 36 | typedef void (Display) (long, char *); |
| 38 | 37 | ||
| @@ -97,7 +96,7 @@ static long du(char *filename) | |||
| 97 | filename[--len] = '\0'; | 96 | filename[--len] = '\0'; |
| 98 | 97 | ||
| 99 | while ((entry = readdir(dir))) { | 98 | while ((entry = readdir(dir))) { |
| 100 | char newfile[PATH_MAX + 1]; | 99 | char newfile[BUFSIZ + 1]; |
| 101 | char *name = entry->d_name; | 100 | char *name = entry->d_name; |
| 102 | 101 | ||
| 103 | if ((strcmp(name, "..") == 0) | 102 | if ((strcmp(name, "..") == 0) |
| @@ -105,7 +104,7 @@ static long du(char *filename) | |||
| 105 | continue; | 104 | continue; |
| 106 | } | 105 | } |
| 107 | 106 | ||
| 108 | if (len + strlen(name) + 1 > PATH_MAX) { | 107 | if (len + strlen(name) + 1 > BUFSIZ) { |
| 109 | fprintf(stderr, name_too_long, "du"); | 108 | fprintf(stderr, name_too_long, "du"); |
| 110 | du_depth--; | 109 | du_depth--; |
| 111 | return 0; | 110 | return 0; |
| @@ -182,7 +181,7 @@ int du_main(int argc, char **argv) | |||
| 182 | exit(0); | 181 | exit(0); |
| 183 | } | 182 | } |
| 184 | 183 | ||
| 185 | /* $Id: du.c,v 1.17 2000/04/13 01:18:56 erik Exp $ */ | 184 | /* $Id: du.c,v 1.18 2000/04/28 00:18:56 erik Exp $ */ |
| 186 | /* | 185 | /* |
| 187 | Local Variables: | 186 | Local Variables: |
| 188 | c-file-style: "linux" | 187 | c-file-style: "linux" |
| @@ -14,11 +14,17 @@ | |||
| 14 | #include "internal.h" | 14 | #include "internal.h" |
| 15 | #include <stdio.h> | 15 | #include <stdio.h> |
| 16 | #include <errno.h> | 16 | #include <errno.h> |
| 17 | #include <utmp.h> | ||
| 18 | #define BB_DECLARE_EXTERN | 17 | #define BB_DECLARE_EXTERN |
| 19 | #define bb_need_io_error | 18 | #define bb_need_io_error |
| 20 | #include "messages.c" | 19 | #include "messages.c" |
| 21 | 20 | ||
| 21 | #if defined(__GLIBC__) | ||
| 22 | #include <utmp.h> | ||
| 23 | #else | ||
| 24 | #include <utmp-wrap.h> | ||
| 25 | #define utmp new_utmp | ||
| 26 | #endif | ||
| 27 | |||
| 22 | static const char dutmp_usage[] = "dutmp [FILE]\n\n" | 28 | static const char dutmp_usage[] = "dutmp [FILE]\n\n" |
| 23 | "Dump utmp file format (pipe delimited) from FILE\n" | 29 | "Dump utmp file format (pipe delimited) from FILE\n" |
| 24 | "or stdin to stdout. (i.e. 'dutmp /var/run/utmp')\n"; | 30 | "or stdin to stdout. (i.e. 'dutmp /var/run/utmp')\n"; |
| @@ -45,8 +51,8 @@ extern int dutmp_main(int argc, char **argv) | |||
| 45 | ut.ut_type, ut.ut_pid, ut.ut_line, | 51 | ut.ut_type, ut.ut_pid, ut.ut_line, |
| 46 | ut.ut_id, ut.ut_user, ut.ut_host, | 52 | ut.ut_id, ut.ut_user, ut.ut_host, |
| 47 | ut.ut_exit.e_termination, ut.ut_exit.e_exit, | 53 | ut.ut_exit.e_termination, ut.ut_exit.e_exit, |
| 48 | ut.ut_session, | 54 | ut.ut_session, ut.ut_tv.tv_sec, ut.ut_tv.tv_usec, |
| 49 | ut.ut_tv.tv_sec, ut.ut_tv.tv_usec, ut.ut_addr); | 55 | ut.ut_addr_v6[0]); |
| 50 | } | 56 | } |
| 51 | 57 | ||
| 52 | exit(TRUE); | 58 | exit(TRUE); |
diff --git a/freeramdisk.c b/freeramdisk.c index 9636dbdcf..d373bcbf7 100644 --- a/freeramdisk.c +++ b/freeramdisk.c | |||
| @@ -23,7 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | #include <stdio.h> | 24 | #include <stdio.h> |
| 25 | #include <string.h> | 25 | #include <string.h> |
| 26 | #include <sys/mount.h> | 26 | #include <linux/fs.h> |
| 27 | #include <sys/types.h> | 27 | #include <sys/types.h> |
| 28 | #include <sys/stat.h> | 28 | #include <sys/stat.h> |
| 29 | #include <fcntl.h> | 29 | #include <fcntl.h> |
| @@ -32,6 +32,7 @@ | |||
| 32 | #include "internal.h" | 32 | #include "internal.h" |
| 33 | 33 | ||
| 34 | 34 | ||
| 35 | |||
| 35 | static const char freeramdisk_usage[] = | 36 | static const char freeramdisk_usage[] = |
| 36 | "freeramdisk DEVICE\n\n" | 37 | "freeramdisk DEVICE\n\n" |
| 37 | "Free all memory used by the specified ramdisk.\n"; | 38 | "Free all memory used by the specified ramdisk.\n"; |
diff --git a/fsck_minix.c b/fsck_minix.c index aa0a82432..c890dff7d 100644 --- a/fsck_minix.c +++ b/fsck_minix.c | |||
| @@ -97,7 +97,6 @@ | |||
| 97 | #include <termios.h> | 97 | #include <termios.h> |
| 98 | #include <mntent.h> | 98 | #include <mntent.h> |
| 99 | #include <sys/stat.h> | 99 | #include <sys/stat.h> |
| 100 | #include <sys/param.h> /* for PATH_MAX */ | ||
| 101 | 100 | ||
| 102 | #include <linux/fs.h> | 101 | #include <linux/fs.h> |
| 103 | #include <linux/minix_fs.h> | 102 | #include <linux/minix_fs.h> |
| @@ -145,7 +144,7 @@ static int termios_set = 0; | |||
| 145 | /* File-name data */ | 144 | /* File-name data */ |
| 146 | #define MAX_DEPTH 32 | 145 | #define MAX_DEPTH 32 |
| 147 | static int name_depth = 0; | 146 | static int name_depth = 0; |
| 148 | // static char name_list[MAX_DEPTH][PATH_MAX + 1]; | 147 | // static char name_list[MAX_DEPTH][BUFSIZ + 1]; |
| 149 | static char **name_list = NULL; | 148 | static char **name_list = NULL; |
| 150 | 149 | ||
| 151 | static char *inode_buffer = NULL; | 150 | static char *inode_buffer = NULL; |
| @@ -178,8 +177,8 @@ static unsigned char *zone_count = NULL; | |||
| 178 | static void recursive_check(unsigned int ino); | 177 | static void recursive_check(unsigned int ino); |
| 179 | static void recursive_check2(unsigned int ino); | 178 | static void recursive_check2(unsigned int ino); |
| 180 | 179 | ||
| 181 | #define inode_in_use(x) (bit(inode_map,(x))) | 180 | #define inode_in_use(x) (isset(inode_map,(x))) |
| 182 | #define zone_in_use(x) (bit(zone_map,(x)-FIRSTZONE+1)) | 181 | #define zone_in_use(x) (isset(zone_map,(x)-FIRSTZONE+1)) |
| 183 | 182 | ||
| 184 | #define mark_inode(x) (setbit(inode_map,(x)),changed=1) | 183 | #define mark_inode(x) (setbit(inode_map,(x)),changed=1) |
| 185 | #define unmark_inode(x) (clrbit(inode_map,(x)),changed=1) | 184 | #define unmark_inode(x) (clrbit(inode_map,(x)),changed=1) |
| @@ -1239,7 +1238,7 @@ static void alloc_name_list(void) | |||
| 1239 | 1238 | ||
| 1240 | name_list = xmalloc(sizeof(char *) * MAX_DEPTH); | 1239 | name_list = xmalloc(sizeof(char *) * MAX_DEPTH); |
| 1241 | for (i = 0; i < MAX_DEPTH; i++) | 1240 | for (i = 0; i < MAX_DEPTH; i++) |
| 1242 | name_list[i] = xmalloc(sizeof(char) * PATH_MAX + 1); | 1241 | name_list[i] = xmalloc(sizeof(char) * BUFSIZ + 1); |
| 1243 | } | 1242 | } |
| 1244 | 1243 | ||
| 1245 | #if 0 | 1244 | #if 0 |
| @@ -102,7 +102,6 @@ static char *license_msg[] = { | |||
| 102 | #include <signal.h> | 102 | #include <signal.h> |
| 103 | #include <sys/stat.h> | 103 | #include <sys/stat.h> |
| 104 | #include <errno.h> | 104 | #include <errno.h> |
| 105 | #include <sys/param.h> /* for PATH_MAX */ | ||
| 106 | 105 | ||
| 107 | /* #include "tailor.h" */ | 106 | /* #include "tailor.h" */ |
| 108 | 107 | ||
| @@ -641,8 +640,8 @@ typedef RETSIGTYPE(*sig_type) (int); | |||
| 641 | #define RW_USER (S_IRUSR | S_IWUSR) /* creation mode for open() */ | 640 | #define RW_USER (S_IRUSR | S_IWUSR) /* creation mode for open() */ |
| 642 | 641 | ||
| 643 | #ifndef MAX_PATH_LEN /* max pathname length */ | 642 | #ifndef MAX_PATH_LEN /* max pathname length */ |
| 644 | # ifdef PATH_MAX | 643 | # ifdef BUFSIZ |
| 645 | # define MAX_PATH_LEN PATH_MAX | 644 | # define MAX_PATH_LEN BUFSIZ |
| 646 | # else | 645 | # else |
| 647 | # define MAX_PATH_LEN 1024 | 646 | # define MAX_PATH_LEN 1024 |
| 648 | # endif | 647 | # endif |
| @@ -2272,7 +2272,6 @@ local void set_file_type (void); | |||
| 2272 | * used. | 2272 | * used. |
| 2273 | */ | 2273 | */ |
| 2274 | 2274 | ||
| 2275 | #define MAX(a,b) (a >= b ? a : b) | ||
| 2276 | /* the arguments must not have side effects */ | 2275 | /* the arguments must not have side effects */ |
| 2277 | 2276 | ||
| 2278 | /* =========================================================================== | 2277 | /* =========================================================================== |
| @@ -28,31 +28,50 @@ | |||
| 28 | */ | 28 | */ |
| 29 | 29 | ||
| 30 | #include "internal.h" | 30 | #include "internal.h" |
| 31 | #include <asm/types.h> | 31 | #include <stdio.h> |
| 32 | #include <stdlib.h> | ||
| 32 | #include <errno.h> | 33 | #include <errno.h> |
| 33 | #include <linux/serial.h> /* for serial_struct */ | ||
| 34 | #include <linux/version.h> | ||
| 35 | #include <paths.h> | 34 | #include <paths.h> |
| 36 | #include <signal.h> | 35 | #include <signal.h> |
| 37 | #include <stdarg.h> | 36 | #include <stdarg.h> |
| 38 | #include <stdio.h> | ||
| 39 | #include <stdlib.h> | ||
| 40 | #include <string.h> | 37 | #include <string.h> |
| 38 | #include <termios.h> | ||
| 39 | #include <unistd.h> | ||
| 40 | #include <asm/types.h> | ||
| 41 | #include <linux/serial.h> /* for serial_struct */ | ||
| 42 | #include <linux/version.h> | ||
| 43 | #include <linux/reboot.h> | ||
| 44 | #include <linux/unistd.h> | ||
| 45 | #include <sys/sysinfo.h> /* For check_free_memory() */ | ||
| 41 | #include <sys/fcntl.h> | 46 | #include <sys/fcntl.h> |
| 42 | #include <sys/ioctl.h> | 47 | #include <sys/ioctl.h> |
| 43 | #include <sys/kdaemon.h> | ||
| 44 | #include <sys/mount.h> | 48 | #include <sys/mount.h> |
| 45 | #include <sys/reboot.h> | ||
| 46 | #include <sys/sysinfo.h> /* For check_free_memory() */ | ||
| 47 | #ifdef BB_SYSLOGD | ||
| 48 | # include <sys/syslog.h> | ||
| 49 | #endif | ||
| 50 | #include <sys/sysmacros.h> | 49 | #include <sys/sysmacros.h> |
| 51 | #include <sys/types.h> | 50 | #include <sys/types.h> |
| 52 | #include <sys/vt.h> /* for vt_stat */ | 51 | #include <sys/vt.h> /* for vt_stat */ |
| 53 | #include <sys/wait.h> | 52 | #include <sys/wait.h> |
| 54 | #include <termios.h> | 53 | #ifdef BB_SYSLOGD |
| 55 | #include <unistd.h> | 54 | # include <sys/syslog.h> |
| 55 | #endif | ||
| 56 | |||
| 57 | |||
| 58 | #ifndef RB_HALT_SYSTEM | ||
| 59 | #define RB_HALT_SYSTEM 0xcdef0123 | ||
| 60 | #define RB_ENABLE_CAD 0x89abcdef | ||
| 61 | #define RB_DISABLE_CAD 0 | ||
| 62 | #define RB_POWER_OFF 0x4321fedc | ||
| 63 | #define RB_AUTOBOOT 0x01234567 | ||
| 64 | #if defined(__GLIBC__) | ||
| 65 | #include <sys/reboot.h> | ||
| 66 | #define init_reboot(magic) reboot(magic) | ||
| 67 | #else | ||
| 68 | #define init_reboot(magic) reboot(0xfee1dead, 672274793, magic) | ||
| 69 | #endif | ||
| 70 | #endif | ||
| 71 | |||
| 72 | #ifndef _PATH_STDPATH | ||
| 73 | #define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin" | ||
| 74 | #endif | ||
| 56 | 75 | ||
| 57 | 76 | ||
| 58 | #if defined BB_FEATURE_INIT_COREDUMPS | 77 | #if defined BB_FEATURE_INIT_COREDUMPS |
| @@ -71,6 +90,12 @@ | |||
| 71 | #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) | 90 | #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) |
| 72 | #endif | 91 | #endif |
| 73 | 92 | ||
| 93 | #if defined(__GLIBC__) | ||
| 94 | #include <sys/kdaemon.h> | ||
| 95 | #else | ||
| 96 | _syscall2(int, bdflush, int, func, int, data); | ||
| 97 | #endif /* __GLIBC__ */ | ||
| 98 | |||
| 74 | 99 | ||
| 75 | #define VT_PRIMARY "/dev/tty1" /* Primary virtual console */ | 100 | #define VT_PRIMARY "/dev/tty1" /* Primary virtual console */ |
| 76 | #define VT_SECONDARY "/dev/tty2" /* Virtual console */ | 101 | #define VT_SECONDARY "/dev/tty2" /* Virtual console */ |
| @@ -510,7 +535,7 @@ static void shutdown_system(void) | |||
| 510 | signal(SIGHUP, SIG_DFL); | 535 | signal(SIGHUP, SIG_DFL); |
| 511 | 536 | ||
| 512 | /* Allow Ctrl-Alt-Del to reboot system. */ | 537 | /* Allow Ctrl-Alt-Del to reboot system. */ |
| 513 | reboot(RB_ENABLE_CAD); | 538 | init_reboot(RB_ENABLE_CAD); |
| 514 | 539 | ||
| 515 | message(CONSOLE|LOG, "\r\nThe system is going down NOW !!\r\n"); | 540 | message(CONSOLE|LOG, "\r\nThe system is going down NOW !!\r\n"); |
| 516 | sync(); | 541 | sync(); |
| @@ -550,10 +575,10 @@ static void halt_signal(int sig) | |||
| 550 | 575 | ||
| 551 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0) | 576 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0) |
| 552 | if (sig == SIGUSR2) | 577 | if (sig == SIGUSR2) |
| 553 | reboot(RB_POWER_OFF); | 578 | init_reboot(RB_POWER_OFF); |
| 554 | else | 579 | else |
| 555 | #endif | 580 | #endif |
| 556 | reboot(RB_HALT_SYSTEM); | 581 | init_reboot(RB_HALT_SYSTEM); |
| 557 | exit(0); | 582 | exit(0); |
| 558 | } | 583 | } |
| 559 | 584 | ||
| @@ -566,7 +591,7 @@ static void reboot_signal(int sig) | |||
| 566 | /* allow time for last message to reach serial console */ | 591 | /* allow time for last message to reach serial console */ |
| 567 | sleep(2); | 592 | sleep(2); |
| 568 | 593 | ||
| 569 | reboot(RB_AUTOBOOT); | 594 | init_reboot(RB_AUTOBOOT); |
| 570 | exit(0); | 595 | exit(0); |
| 571 | } | 596 | } |
| 572 | 597 | ||
| @@ -852,7 +877,7 @@ extern int init_main(int argc, char **argv) | |||
| 852 | 877 | ||
| 853 | /* Turn off rebooting via CTL-ALT-DEL -- we get a | 878 | /* Turn off rebooting via CTL-ALT-DEL -- we get a |
| 854 | * SIGINT on CAD so we can shut things down gracefully... */ | 879 | * SIGINT on CAD so we can shut things down gracefully... */ |
| 855 | reboot(RB_DISABLE_CAD); | 880 | init_reboot(RB_DISABLE_CAD); |
| 856 | #endif | 881 | #endif |
| 857 | 882 | ||
| 858 | /* Figure out what kernel this is running */ | 883 | /* Figure out what kernel this is running */ |
diff --git a/init/init.c b/init/init.c index af10f98f0..29d8f48f9 100644 --- a/init/init.c +++ b/init/init.c | |||
| @@ -28,31 +28,50 @@ | |||
| 28 | */ | 28 | */ |
| 29 | 29 | ||
| 30 | #include "internal.h" | 30 | #include "internal.h" |
| 31 | #include <asm/types.h> | 31 | #include <stdio.h> |
| 32 | #include <stdlib.h> | ||
| 32 | #include <errno.h> | 33 | #include <errno.h> |
| 33 | #include <linux/serial.h> /* for serial_struct */ | ||
| 34 | #include <linux/version.h> | ||
| 35 | #include <paths.h> | 34 | #include <paths.h> |
| 36 | #include <signal.h> | 35 | #include <signal.h> |
| 37 | #include <stdarg.h> | 36 | #include <stdarg.h> |
| 38 | #include <stdio.h> | ||
| 39 | #include <stdlib.h> | ||
| 40 | #include <string.h> | 37 | #include <string.h> |
| 38 | #include <termios.h> | ||
| 39 | #include <unistd.h> | ||
| 40 | #include <asm/types.h> | ||
| 41 | #include <linux/serial.h> /* for serial_struct */ | ||
| 42 | #include <linux/version.h> | ||
| 43 | #include <linux/reboot.h> | ||
| 44 | #include <linux/unistd.h> | ||
| 45 | #include <sys/sysinfo.h> /* For check_free_memory() */ | ||
| 41 | #include <sys/fcntl.h> | 46 | #include <sys/fcntl.h> |
| 42 | #include <sys/ioctl.h> | 47 | #include <sys/ioctl.h> |
| 43 | #include <sys/kdaemon.h> | ||
| 44 | #include <sys/mount.h> | 48 | #include <sys/mount.h> |
| 45 | #include <sys/reboot.h> | ||
| 46 | #include <sys/sysinfo.h> /* For check_free_memory() */ | ||
| 47 | #ifdef BB_SYSLOGD | ||
| 48 | # include <sys/syslog.h> | ||
| 49 | #endif | ||
| 50 | #include <sys/sysmacros.h> | 49 | #include <sys/sysmacros.h> |
| 51 | #include <sys/types.h> | 50 | #include <sys/types.h> |
| 52 | #include <sys/vt.h> /* for vt_stat */ | 51 | #include <sys/vt.h> /* for vt_stat */ |
| 53 | #include <sys/wait.h> | 52 | #include <sys/wait.h> |
| 54 | #include <termios.h> | 53 | #ifdef BB_SYSLOGD |
| 55 | #include <unistd.h> | 54 | # include <sys/syslog.h> |
| 55 | #endif | ||
| 56 | |||
| 57 | |||
| 58 | #ifndef RB_HALT_SYSTEM | ||
| 59 | #define RB_HALT_SYSTEM 0xcdef0123 | ||
| 60 | #define RB_ENABLE_CAD 0x89abcdef | ||
| 61 | #define RB_DISABLE_CAD 0 | ||
| 62 | #define RB_POWER_OFF 0x4321fedc | ||
| 63 | #define RB_AUTOBOOT 0x01234567 | ||
| 64 | #if defined(__GLIBC__) | ||
| 65 | #include <sys/reboot.h> | ||
| 66 | #define init_reboot(magic) reboot(magic) | ||
| 67 | #else | ||
| 68 | #define init_reboot(magic) reboot(0xfee1dead, 672274793, magic) | ||
| 69 | #endif | ||
| 70 | #endif | ||
| 71 | |||
| 72 | #ifndef _PATH_STDPATH | ||
| 73 | #define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin" | ||
| 74 | #endif | ||
| 56 | 75 | ||
| 57 | 76 | ||
| 58 | #if defined BB_FEATURE_INIT_COREDUMPS | 77 | #if defined BB_FEATURE_INIT_COREDUMPS |
| @@ -71,6 +90,12 @@ | |||
| 71 | #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) | 90 | #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) |
| 72 | #endif | 91 | #endif |
| 73 | 92 | ||
| 93 | #if defined(__GLIBC__) | ||
| 94 | #include <sys/kdaemon.h> | ||
| 95 | #else | ||
| 96 | _syscall2(int, bdflush, int, func, int, data); | ||
| 97 | #endif /* __GLIBC__ */ | ||
| 98 | |||
| 74 | 99 | ||
| 75 | #define VT_PRIMARY "/dev/tty1" /* Primary virtual console */ | 100 | #define VT_PRIMARY "/dev/tty1" /* Primary virtual console */ |
| 76 | #define VT_SECONDARY "/dev/tty2" /* Virtual console */ | 101 | #define VT_SECONDARY "/dev/tty2" /* Virtual console */ |
| @@ -510,7 +535,7 @@ static void shutdown_system(void) | |||
| 510 | signal(SIGHUP, SIG_DFL); | 535 | signal(SIGHUP, SIG_DFL); |
| 511 | 536 | ||
| 512 | /* Allow Ctrl-Alt-Del to reboot system. */ | 537 | /* Allow Ctrl-Alt-Del to reboot system. */ |
| 513 | reboot(RB_ENABLE_CAD); | 538 | init_reboot(RB_ENABLE_CAD); |
| 514 | 539 | ||
| 515 | message(CONSOLE|LOG, "\r\nThe system is going down NOW !!\r\n"); | 540 | message(CONSOLE|LOG, "\r\nThe system is going down NOW !!\r\n"); |
| 516 | sync(); | 541 | sync(); |
| @@ -550,10 +575,10 @@ static void halt_signal(int sig) | |||
| 550 | 575 | ||
| 551 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0) | 576 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0) |
| 552 | if (sig == SIGUSR2) | 577 | if (sig == SIGUSR2) |
| 553 | reboot(RB_POWER_OFF); | 578 | init_reboot(RB_POWER_OFF); |
| 554 | else | 579 | else |
| 555 | #endif | 580 | #endif |
| 556 | reboot(RB_HALT_SYSTEM); | 581 | init_reboot(RB_HALT_SYSTEM); |
| 557 | exit(0); | 582 | exit(0); |
| 558 | } | 583 | } |
| 559 | 584 | ||
| @@ -566,7 +591,7 @@ static void reboot_signal(int sig) | |||
| 566 | /* allow time for last message to reach serial console */ | 591 | /* allow time for last message to reach serial console */ |
| 567 | sleep(2); | 592 | sleep(2); |
| 568 | 593 | ||
| 569 | reboot(RB_AUTOBOOT); | 594 | init_reboot(RB_AUTOBOOT); |
| 570 | exit(0); | 595 | exit(0); |
| 571 | } | 596 | } |
| 572 | 597 | ||
| @@ -852,7 +877,7 @@ extern int init_main(int argc, char **argv) | |||
| 852 | 877 | ||
| 853 | /* Turn off rebooting via CTL-ALT-DEL -- we get a | 878 | /* Turn off rebooting via CTL-ALT-DEL -- we get a |
| 854 | * SIGINT on CAD so we can shut things down gracefully... */ | 879 | * SIGINT on CAD so we can shut things down gracefully... */ |
| 855 | reboot(RB_DISABLE_CAD); | 880 | init_reboot(RB_DISABLE_CAD); |
| 856 | #endif | 881 | #endif |
| 857 | 882 | ||
| 858 | /* Figure out what kernel this is running */ | 883 | /* Figure out what kernel this is running */ |
| @@ -67,8 +67,8 @@ unsigned long create_module(const char *name, size_t size) | |||
| 67 | #else | 67 | #else |
| 68 | _syscall2(unsigned long, create_module, const char *, name, size_t, size) | 68 | _syscall2(unsigned long, create_module, const char *, name, size_t, size) |
| 69 | #endif | 69 | #endif |
| 70 | static char m_filename[PATH_MAX + 1] = "\0"; | 70 | static char m_filename[BUFSIZ + 1] = "\0"; |
| 71 | static char m_fullName[PATH_MAX + 1] = "\0"; | 71 | static char m_fullName[BUFSIZ + 1] = "\0"; |
| 72 | static const char insmod_usage[] = | 72 | static const char insmod_usage[] = |
| 73 | "insmod [OPTION]... MODULE [symbol=value]...\n\n" | 73 | "insmod [OPTION]... MODULE [symbol=value]...\n\n" |
| 74 | "Loads the specified kernel modules into the kernel.\n\n" | 74 | "Loads the specified kernel modules into the kernel.\n\n" |
| @@ -103,7 +103,7 @@ extern int insmod_main(int argc, char **argv) | |||
| 103 | { | 103 | { |
| 104 | int len; | 104 | int len; |
| 105 | char *tmp; | 105 | char *tmp; |
| 106 | char m_name[PATH_MAX + 1] = "\0"; | 106 | char m_name[BUFSIZ + 1] = "\0"; |
| 107 | FILE *fp; | 107 | FILE *fp; |
| 108 | 108 | ||
| 109 | if (argc <= 1) { | 109 | if (argc <= 1) { |
diff --git a/internal.h b/internal.h index 1c267cbbb..a81651bec 100644 --- a/internal.h +++ b/internal.h | |||
| @@ -31,7 +31,7 @@ | |||
| 31 | #include <string.h> | 31 | #include <string.h> |
| 32 | #include <unistd.h> | 32 | #include <unistd.h> |
| 33 | #include <sys/stat.h> | 33 | #include <sys/stat.h> |
| 34 | //#include <sys/param.h> | 34 | #include <sys/param.h> |
| 35 | #include <mntent.h> | 35 | #include <mntent.h> |
| 36 | 36 | ||
| 37 | 37 | ||
| @@ -52,6 +52,36 @@ | |||
| 52 | #define isOctal(ch) (((ch) >= '0') && ((ch) <= '7')) | 52 | #define isOctal(ch) (((ch) >= '0') && ((ch) <= '7')) |
| 53 | #define isWildCard(ch) (((ch) == '*') || ((ch) == '?') || ((ch) == '[')) | 53 | #define isWildCard(ch) (((ch) == '*') || ((ch) == '?') || ((ch) == '[')) |
| 54 | 54 | ||
| 55 | /* Macros for min/max. */ | ||
| 56 | #ifndef MIN | ||
| 57 | #define MIN(a,b) (((a)<(b))?(a):(b)) | ||
| 58 | #endif | ||
| 59 | |||
| 60 | #ifndef MAX | ||
| 61 | #define MAX(a,b) (((a)>(b))?(a):(b)) | ||
| 62 | #endif | ||
| 63 | |||
| 64 | |||
| 65 | /* I don't like nested includes, but the string and io functions are used | ||
| 66 | * too often | ||
| 67 | */ | ||
| 68 | #include <stdio.h> | ||
| 69 | #if !defined(NO_STRING_H) || defined(STDC_HEADERS) | ||
| 70 | # include <string.h> | ||
| 71 | # if !defined(STDC_HEADERS) && !defined(NO_MEMORY_H) && !defined(__GNUC__) | ||
| 72 | # include <memory.h> | ||
| 73 | # endif | ||
| 74 | # define memzero(s, n) memset ((void *)(s), 0, (n)) | ||
| 75 | #else | ||
| 76 | # include <strings.h> | ||
| 77 | # define strchr index | ||
| 78 | # define strrchr rindex | ||
| 79 | # define memcpy(d, s, n) bcopy((s), (d), (n)) | ||
| 80 | # define memcmp(s1, s2, n) bcmp((s1), (s2), (n)) | ||
| 81 | # define memzero(s, n) bzero((s), (n)) | ||
| 82 | #endif | ||
| 83 | |||
| 84 | |||
| 55 | enum Location { | 85 | enum Location { |
| 56 | _BB_DIR_ROOT = 0, | 86 | _BB_DIR_ROOT = 0, |
| 57 | _BB_DIR_BIN, | 87 | _BB_DIR_BIN, |
| @@ -136,6 +166,7 @@ extern int rmdir_main(int argc, char **argv); | |||
| 136 | extern int rmmod_main(int argc, char** argv); | 166 | extern int rmmod_main(int argc, char** argv); |
| 137 | extern int sed_main(int argc, char** argv); | 167 | extern int sed_main(int argc, char** argv); |
| 138 | extern int sfdisk_main(int argc, char** argv); | 168 | extern int sfdisk_main(int argc, char** argv); |
| 169 | extern int setkeycodes_main(int argc, char** argv); | ||
| 139 | extern int shell_main(int argc, char** argv); | 170 | extern int shell_main(int argc, char** argv); |
| 140 | extern int sleep_main(int argc, char** argv); | 171 | extern int sleep_main(int argc, char** argv); |
| 141 | extern int sort_main(int argc, char** argv); | 172 | extern int sort_main(int argc, char** argv); |
| @@ -243,27 +274,15 @@ int nfsmount(const char *spec, const char *node, unsigned long *flags, | |||
| 243 | #endif | 274 | #endif |
| 244 | 275 | ||
| 245 | #if defined (BB_FSCK_MINIX) || defined (BB_MKFS_MINIX) | 276 | #if defined (BB_FSCK_MINIX) || defined (BB_MKFS_MINIX) |
| 246 | 277 | /* Bit map related macros. */ | |
| 247 | static inline int bit(char * addr,unsigned int nr) | 278 | #ifndef setbit |
| 248 | { | 279 | #define CHAR_BITS 8 /* Number of bits in a `char'. */ |
| 249 | return (addr[nr >> 3] & (1<<(nr & 7))) != 0; | 280 | #define setbit(a,i) ((a)[(i)/CHAR_BITS] |= 1<<((i)%CHAR_BITS)) |
| 250 | } | 281 | #define clrbit(a,i) ((a)[(i)/CHAR_BITS] &= ~(1<<((i)%CHAR_BITS))) |
| 251 | 282 | #define isset(a,i) ((a)[(i)/CHAR_BITS] & (1<<((i)%CHAR_BITS))) | |
| 252 | static inline int setbit(char * addr,unsigned int nr) | 283 | #define isclr(a,i) (((a)[(i)/CHAR_BITS] & (1<<((i)%CHAR_BITS))) == 0) |
| 253 | { | 284 | #endif |
| 254 | int __res = bit(addr, nr); | 285 | #endif |
| 255 | addr[nr >> 3] |= (1<<(nr & 7)); | ||
| 256 | return __res != 0; | ||
| 257 | } | ||
| 258 | |||
| 259 | static inline int clrbit(char * addr,unsigned int nr) | ||
| 260 | { | ||
| 261 | int __res = bit(addr, nr); | ||
| 262 | addr[nr >> 3] &= ~(1<<(nr & 7)); | ||
| 263 | return __res != 0; | ||
| 264 | } | ||
| 265 | |||
| 266 | #endif /* inline bitops junk */ | ||
| 267 | 286 | ||
| 268 | 287 | ||
| 269 | #ifndef RB_POWER_OFF | 288 | #ifndef RB_POWER_OFF |
| @@ -30,7 +30,6 @@ | |||
| 30 | #include <stdio.h> | 30 | #include <stdio.h> |
| 31 | #include <dirent.h> | 31 | #include <dirent.h> |
| 32 | #include <errno.h> | 32 | #include <errno.h> |
| 33 | #include <sys/param.h> /* for PATH_MAX */ | ||
| 34 | 33 | ||
| 35 | static const char ln_usage[] = | 34 | static const char ln_usage[] = |
| 36 | "ln [OPTION] TARGET... LINK_NAME|DIRECTORY\n\n" | 35 | "ln [OPTION] TARGET... LINK_NAME|DIRECTORY\n\n" |
| @@ -78,7 +77,7 @@ extern int ln_main(int argc, char **argv) | |||
| 78 | 77 | ||
| 79 | linkName = argv[argc - 1]; | 78 | linkName = argv[argc - 1]; |
| 80 | 79 | ||
| 81 | if (strlen(linkName) > PATH_MAX) { | 80 | if (strlen(linkName) > BUFSIZ) { |
| 82 | fprintf(stderr, name_too_long, "ln"); | 81 | fprintf(stderr, name_too_long, "ln"); |
| 83 | exit FALSE; | 82 | exit FALSE; |
| 84 | } | 83 | } |
| @@ -91,10 +90,10 @@ extern int ln_main(int argc, char **argv) | |||
| 91 | } | 90 | } |
| 92 | 91 | ||
| 93 | while (argc-- >= 2) { | 92 | while (argc-- >= 2) { |
| 94 | char srcName[PATH_MAX + 1]; | 93 | char srcName[BUFSIZ + 1]; |
| 95 | int nChars, status; | 94 | int nChars, status; |
| 96 | 95 | ||
| 97 | if (strlen(*argv) > PATH_MAX) { | 96 | if (strlen(*argv) > BUFSIZ) { |
| 98 | fprintf(stderr, name_too_long, "ln"); | 97 | fprintf(stderr, name_too_long, "ln"); |
| 99 | exit FALSE; | 98 | exit FALSE; |
| 100 | } | 99 | } |
| @@ -102,9 +101,9 @@ extern int ln_main(int argc, char **argv) | |||
| 102 | if (followLinks == FALSE) { | 101 | if (followLinks == FALSE) { |
| 103 | strcpy(srcName, *argv); | 102 | strcpy(srcName, *argv); |
| 104 | } else { | 103 | } else { |
| 105 | /* Warning! This can silently truncate if > PATH_MAX, but | 104 | /* Warning! This can silently truncate if > BUFSIZ, but |
| 106 | I don't think that there can be one > PATH_MAX anyway. */ | 105 | I don't think that there can be one > BUFSIZ anyway. */ |
| 107 | nChars = readlink(*argv, srcName, PATH_MAX); | 106 | nChars = readlink(*argv, srcName, BUFSIZ); |
| 108 | srcName[nChars] = '\0'; | 107 | srcName[nChars] = '\0'; |
| 109 | } | 108 | } |
| 110 | 109 | ||
| @@ -183,7 +183,7 @@ static char append_char(mode_t mode) | |||
| 183 | static void list_single(const char *name, struct stat *info, | 183 | static void list_single(const char *name, struct stat *info, |
| 184 | const char *fullname) | 184 | const char *fullname) |
| 185 | { | 185 | { |
| 186 | char scratch[PATH_MAX + 1]; | 186 | char scratch[BUFSIZ + 1]; |
| 187 | short len = strlen(name); | 187 | short len = strlen(name); |
| 188 | 188 | ||
| 189 | #ifdef BB_FEATURE_LS_FILETYPES | 189 | #ifdef BB_FEATURE_LS_FILETYPES |
diff --git a/miscutils/dutmp.c b/miscutils/dutmp.c index 1629067a1..886d7880d 100644 --- a/miscutils/dutmp.c +++ b/miscutils/dutmp.c | |||
| @@ -14,11 +14,17 @@ | |||
| 14 | #include "internal.h" | 14 | #include "internal.h" |
| 15 | #include <stdio.h> | 15 | #include <stdio.h> |
| 16 | #include <errno.h> | 16 | #include <errno.h> |
| 17 | #include <utmp.h> | ||
| 18 | #define BB_DECLARE_EXTERN | 17 | #define BB_DECLARE_EXTERN |
| 19 | #define bb_need_io_error | 18 | #define bb_need_io_error |
| 20 | #include "messages.c" | 19 | #include "messages.c" |
| 21 | 20 | ||
| 21 | #if defined(__GLIBC__) | ||
| 22 | #include <utmp.h> | ||
| 23 | #else | ||
| 24 | #include <utmp-wrap.h> | ||
| 25 | #define utmp new_utmp | ||
| 26 | #endif | ||
| 27 | |||
| 22 | static const char dutmp_usage[] = "dutmp [FILE]\n\n" | 28 | static const char dutmp_usage[] = "dutmp [FILE]\n\n" |
| 23 | "Dump utmp file format (pipe delimited) from FILE\n" | 29 | "Dump utmp file format (pipe delimited) from FILE\n" |
| 24 | "or stdin to stdout. (i.e. 'dutmp /var/run/utmp')\n"; | 30 | "or stdin to stdout. (i.e. 'dutmp /var/run/utmp')\n"; |
| @@ -45,8 +51,8 @@ extern int dutmp_main(int argc, char **argv) | |||
| 45 | ut.ut_type, ut.ut_pid, ut.ut_line, | 51 | ut.ut_type, ut.ut_pid, ut.ut_line, |
| 46 | ut.ut_id, ut.ut_user, ut.ut_host, | 52 | ut.ut_id, ut.ut_user, ut.ut_host, |
| 47 | ut.ut_exit.e_termination, ut.ut_exit.e_exit, | 53 | ut.ut_exit.e_termination, ut.ut_exit.e_exit, |
| 48 | ut.ut_session, | 54 | ut.ut_session, ut.ut_tv.tv_sec, ut.ut_tv.tv_usec, |
| 49 | ut.ut_tv.tv_sec, ut.ut_tv.tv_usec, ut.ut_addr); | 55 | ut.ut_addr_v6[0]); |
| 50 | } | 56 | } |
| 51 | 57 | ||
| 52 | exit(TRUE); | 58 | exit(TRUE); |
| @@ -28,7 +28,6 @@ | |||
| 28 | 28 | ||
| 29 | #include <stdio.h> | 29 | #include <stdio.h> |
| 30 | #include <errno.h> | 30 | #include <errno.h> |
| 31 | #include <sys/param.h> /* for PATH_MAX */ | ||
| 32 | 31 | ||
| 33 | static const char mkdir_usage[] = | 32 | static const char mkdir_usage[] = |
| 34 | "mkdir [OPTION] DIRECTORY...\n\n" | 33 | "mkdir [OPTION] DIRECTORY...\n\n" |
| @@ -86,9 +85,9 @@ extern int mkdir_main(int argc, char **argv) | |||
| 86 | while (argc > 0) { | 85 | while (argc > 0) { |
| 87 | int status; | 86 | int status; |
| 88 | struct stat statBuf; | 87 | struct stat statBuf; |
| 89 | char buf[PATH_MAX + 1]; | 88 | char buf[BUFSIZ + 1]; |
| 90 | 89 | ||
| 91 | if (strlen(*argv) > PATH_MAX - 1) { | 90 | if (strlen(*argv) > BUFSIZ - 1) { |
| 92 | fprintf(stderr, name_too_long, "mkdir"); | 91 | fprintf(stderr, name_too_long, "mkdir"); |
| 93 | exit FALSE; | 92 | exit FALSE; |
| 94 | } | 93 | } |
diff --git a/mkfs_minix.c b/mkfs_minix.c index 1ee3d4cfa..be180a46b 100644 --- a/mkfs_minix.c +++ b/mkfs_minix.c | |||
| @@ -154,8 +154,8 @@ static unsigned short good_blocks_table[MAX_GOOD_BLOCKS]; | |||
| 154 | static int used_good_blocks = 0; | 154 | static int used_good_blocks = 0; |
| 155 | static unsigned long req_nr_inodes = 0; | 155 | static unsigned long req_nr_inodes = 0; |
| 156 | 156 | ||
| 157 | #define inode_in_use(x) (bit(inode_map,(x))) | 157 | #define inode_in_use(x) (isset(inode_map,(x))) |
| 158 | #define zone_in_use(x) (bit(zone_map,(x)-FIRSTZONE+1)) | 158 | #define zone_in_use(x) (isset(zone_map,(x)-FIRSTZONE+1)) |
| 159 | 159 | ||
| 160 | #define mark_inode(x) (setbit(inode_map,(x))) | 160 | #define mark_inode(x) (setbit(inode_map,(x))) |
| 161 | #define unmark_inode(x) (clrbit(inode_map,(x))) | 161 | #define unmark_inode(x) (clrbit(inode_map,(x))) |
diff --git a/modutils/insmod.c b/modutils/insmod.c index 1ee96f1c8..eafec7d5d 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c | |||
| @@ -67,8 +67,8 @@ unsigned long create_module(const char *name, size_t size) | |||
| 67 | #else | 67 | #else |
| 68 | _syscall2(unsigned long, create_module, const char *, name, size_t, size) | 68 | _syscall2(unsigned long, create_module, const char *, name, size_t, size) |
| 69 | #endif | 69 | #endif |
| 70 | static char m_filename[PATH_MAX + 1] = "\0"; | 70 | static char m_filename[BUFSIZ + 1] = "\0"; |
| 71 | static char m_fullName[PATH_MAX + 1] = "\0"; | 71 | static char m_fullName[BUFSIZ + 1] = "\0"; |
| 72 | static const char insmod_usage[] = | 72 | static const char insmod_usage[] = |
| 73 | "insmod [OPTION]... MODULE [symbol=value]...\n\n" | 73 | "insmod [OPTION]... MODULE [symbol=value]...\n\n" |
| 74 | "Loads the specified kernel modules into the kernel.\n\n" | 74 | "Loads the specified kernel modules into the kernel.\n\n" |
| @@ -103,7 +103,7 @@ extern int insmod_main(int argc, char **argv) | |||
| 103 | { | 103 | { |
| 104 | int len; | 104 | int len; |
| 105 | char *tmp; | 105 | char *tmp; |
| 106 | char m_name[PATH_MAX + 1] = "\0"; | 106 | char m_name[BUFSIZ + 1] = "\0"; |
| 107 | FILE *fp; | 107 | FILE *fp; |
| 108 | 108 | ||
| 109 | if (argc <= 1) { | 109 | if (argc <= 1) { |
| @@ -48,6 +48,7 @@ static const char more_usage[] = "more [file ...]\n"; | |||
| 48 | #endif | 48 | #endif |
| 49 | 49 | ||
| 50 | FILE *cin; | 50 | FILE *cin; |
| 51 | |||
| 51 | struct termios initial_settings, new_settings; | 52 | struct termios initial_settings, new_settings; |
| 52 | 53 | ||
| 53 | void gotsig(int sig) | 54 | void gotsig(int sig) |
| @@ -65,7 +66,10 @@ void gotsig(int sig) | |||
| 65 | 66 | ||
| 66 | 67 | ||
| 67 | #if defined BB_FEATURE_AUTOWIDTH | 68 | #if defined BB_FEATURE_AUTOWIDTH |
| 68 | static int terminal_width = 0, terminal_height = 0; | 69 | #ifdef BB_FEATURE_USE_TERMIOS |
| 70 | static int terminal_width = 0; | ||
| 71 | #endif | ||
| 72 | static int terminal_height = 0; | ||
| 69 | #else | 73 | #else |
| 70 | #define terminal_width TERMINAL_WIDTH | 74 | #define terminal_width TERMINAL_WIDTH |
| 71 | #define terminal_height TERMINAL_HEIGHT | 75 | #define terminal_height TERMINAL_HEIGHT |
| @@ -80,7 +84,7 @@ extern int more_main(int argc, char **argv) | |||
| 80 | struct stat st; | 84 | struct stat st; |
| 81 | FILE *file; | 85 | FILE *file; |
| 82 | 86 | ||
| 83 | #ifdef BB_FEATURE_AUTOWIDTH | 87 | #if defined BB_FEATURE_AUTOWIDTH && defined BB_FEATURE_USE_TERMIOS |
| 84 | struct winsize win = { 0, 0 }; | 88 | struct winsize win = { 0, 0 }; |
| 85 | #endif | 89 | #endif |
| 86 | 90 | ||
| @@ -151,7 +155,11 @@ extern int more_main(int argc, char **argv) | |||
| 151 | ); | 155 | ); |
| 152 | 156 | ||
| 153 | fflush(stdout); | 157 | fflush(stdout); |
| 158 | #ifdef BB_FEATURE_USE_TERMIOS | ||
| 154 | input = getc(cin); | 159 | input = getc(cin); |
| 160 | #else | ||
| 161 | input = getc(stdin); | ||
| 162 | #endif | ||
| 155 | 163 | ||
| 156 | #ifdef BB_FEATURE_USE_TERMIOS | 164 | #ifdef BB_FEATURE_USE_TERMIOS |
| 157 | /* Erase the "More" message */ | 165 | /* Erase the "More" message */ |
| @@ -48,6 +48,9 @@ | |||
| 48 | #if defined BB_FEATURE_USE_DEVPS_PATCH | 48 | #if defined BB_FEATURE_USE_DEVPS_PATCH |
| 49 | #include <linux/devmtab.h> | 49 | #include <linux/devmtab.h> |
| 50 | #endif | 50 | #endif |
| 51 | #ifndef MS_RDONLY | ||
| 52 | #include <linux/fs.h> | ||
| 53 | #endif | ||
| 51 | 54 | ||
| 52 | 55 | ||
| 53 | #if defined BB_FEATURE_MOUNT_LOOP | 56 | #if defined BB_FEATURE_MOUNT_LOOP |
| @@ -24,11 +24,10 @@ | |||
| 24 | #include "internal.h" | 24 | #include "internal.h" |
| 25 | #include <stdio.h> | 25 | #include <stdio.h> |
| 26 | #include <dirent.h> | 26 | #include <dirent.h> |
| 27 | #include <sys/param.h> | ||
| 28 | 27 | ||
| 29 | extern int pwd_main(int argc, char **argv) | 28 | extern int pwd_main(int argc, char **argv) |
| 30 | { | 29 | { |
| 31 | char buf[PATH_MAX + 1]; | 30 | char buf[BUFSIZ + 1]; |
| 32 | 31 | ||
| 33 | if (getcwd(buf, sizeof(buf)) == NULL) { | 32 | if (getcwd(buf, sizeof(buf)) == NULL) { |
| 34 | perror("get working directory"); | 33 | perror("get working directory"); |
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index 0d400e535..cacb629e9 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c | |||
| @@ -53,7 +53,7 @@ extern int ksyslog(int type, char *buf, int len); | |||
| 53 | #define __LOG_FILE "/var/log/messages" | 53 | #define __LOG_FILE "/var/log/messages" |
| 54 | 54 | ||
| 55 | /* Path to the unix socket */ | 55 | /* Path to the unix socket */ |
| 56 | char lfile[PATH_MAX] = ""; | 56 | char lfile[BUFSIZ] = ""; |
| 57 | 57 | ||
| 58 | static char *logFilePath = __LOG_FILE; | 58 | static char *logFilePath = __LOG_FILE; |
| 59 | 59 | ||
| @@ -177,7 +177,7 @@ static void doSyslogd (void) | |||
| 177 | int sock_fd; | 177 | int sock_fd; |
| 178 | fd_set fds; | 178 | fd_set fds; |
| 179 | 179 | ||
| 180 | char lfile[PATH_MAX]; | 180 | char lfile[BUFSIZ]; |
| 181 | 181 | ||
| 182 | /* Set up signal handlers. */ | 182 | /* Set up signal handlers. */ |
| 183 | signal (SIGINT, quit_signal); | 183 | signal (SIGINT, quit_signal); |
| @@ -53,7 +53,7 @@ extern int ksyslog(int type, char *buf, int len); | |||
| 53 | #define __LOG_FILE "/var/log/messages" | 53 | #define __LOG_FILE "/var/log/messages" |
| 54 | 54 | ||
| 55 | /* Path to the unix socket */ | 55 | /* Path to the unix socket */ |
| 56 | char lfile[PATH_MAX] = ""; | 56 | char lfile[BUFSIZ] = ""; |
| 57 | 57 | ||
| 58 | static char *logFilePath = __LOG_FILE; | 58 | static char *logFilePath = __LOG_FILE; |
| 59 | 59 | ||
| @@ -177,7 +177,7 @@ static void doSyslogd (void) | |||
| 177 | int sock_fd; | 177 | int sock_fd; |
| 178 | fd_set fds; | 178 | fd_set fds; |
| 179 | 179 | ||
| 180 | char lfile[PATH_MAX]; | 180 | char lfile[BUFSIZ]; |
| 181 | 181 | ||
| 182 | /* Set up signal handlers. */ | 182 | /* Set up signal handlers. */ |
| 183 | signal (SIGINT, quit_signal); | 183 | signal (SIGINT, quit_signal); |
| @@ -49,7 +49,6 @@ | |||
| 49 | #include <utime.h> | 49 | #include <utime.h> |
| 50 | #include <sys/types.h> | 50 | #include <sys/types.h> |
| 51 | #include <sys/sysmacros.h> | 51 | #include <sys/sysmacros.h> |
| 52 | #include <sys/param.h> /* for PATH_MAX */ | ||
| 53 | 52 | ||
| 54 | 53 | ||
| 55 | static const char tar_usage[] = | 54 | static const char tar_usage[] = |
diff --git a/util-linux/freeramdisk.c b/util-linux/freeramdisk.c index 9636dbdcf..d373bcbf7 100644 --- a/util-linux/freeramdisk.c +++ b/util-linux/freeramdisk.c | |||
| @@ -23,7 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | #include <stdio.h> | 24 | #include <stdio.h> |
| 25 | #include <string.h> | 25 | #include <string.h> |
| 26 | #include <sys/mount.h> | 26 | #include <linux/fs.h> |
| 27 | #include <sys/types.h> | 27 | #include <sys/types.h> |
| 28 | #include <sys/stat.h> | 28 | #include <sys/stat.h> |
| 29 | #include <fcntl.h> | 29 | #include <fcntl.h> |
| @@ -32,6 +32,7 @@ | |||
| 32 | #include "internal.h" | 32 | #include "internal.h" |
| 33 | 33 | ||
| 34 | 34 | ||
| 35 | |||
| 35 | static const char freeramdisk_usage[] = | 36 | static const char freeramdisk_usage[] = |
| 36 | "freeramdisk DEVICE\n\n" | 37 | "freeramdisk DEVICE\n\n" |
| 37 | "Free all memory used by the specified ramdisk.\n"; | 38 | "Free all memory used by the specified ramdisk.\n"; |
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c index aa0a82432..c890dff7d 100644 --- a/util-linux/fsck_minix.c +++ b/util-linux/fsck_minix.c | |||
| @@ -97,7 +97,6 @@ | |||
| 97 | #include <termios.h> | 97 | #include <termios.h> |
| 98 | #include <mntent.h> | 98 | #include <mntent.h> |
| 99 | #include <sys/stat.h> | 99 | #include <sys/stat.h> |
| 100 | #include <sys/param.h> /* for PATH_MAX */ | ||
| 101 | 100 | ||
| 102 | #include <linux/fs.h> | 101 | #include <linux/fs.h> |
| 103 | #include <linux/minix_fs.h> | 102 | #include <linux/minix_fs.h> |
| @@ -145,7 +144,7 @@ static int termios_set = 0; | |||
| 145 | /* File-name data */ | 144 | /* File-name data */ |
| 146 | #define MAX_DEPTH 32 | 145 | #define MAX_DEPTH 32 |
| 147 | static int name_depth = 0; | 146 | static int name_depth = 0; |
| 148 | // static char name_list[MAX_DEPTH][PATH_MAX + 1]; | 147 | // static char name_list[MAX_DEPTH][BUFSIZ + 1]; |
| 149 | static char **name_list = NULL; | 148 | static char **name_list = NULL; |
| 150 | 149 | ||
| 151 | static char *inode_buffer = NULL; | 150 | static char *inode_buffer = NULL; |
| @@ -178,8 +177,8 @@ static unsigned char *zone_count = NULL; | |||
| 178 | static void recursive_check(unsigned int ino); | 177 | static void recursive_check(unsigned int ino); |
| 179 | static void recursive_check2(unsigned int ino); | 178 | static void recursive_check2(unsigned int ino); |
| 180 | 179 | ||
| 181 | #define inode_in_use(x) (bit(inode_map,(x))) | 180 | #define inode_in_use(x) (isset(inode_map,(x))) |
| 182 | #define zone_in_use(x) (bit(zone_map,(x)-FIRSTZONE+1)) | 181 | #define zone_in_use(x) (isset(zone_map,(x)-FIRSTZONE+1)) |
| 183 | 182 | ||
| 184 | #define mark_inode(x) (setbit(inode_map,(x)),changed=1) | 183 | #define mark_inode(x) (setbit(inode_map,(x)),changed=1) |
| 185 | #define unmark_inode(x) (clrbit(inode_map,(x)),changed=1) | 184 | #define unmark_inode(x) (clrbit(inode_map,(x)),changed=1) |
| @@ -1239,7 +1238,7 @@ static void alloc_name_list(void) | |||
| 1239 | 1238 | ||
| 1240 | name_list = xmalloc(sizeof(char *) * MAX_DEPTH); | 1239 | name_list = xmalloc(sizeof(char *) * MAX_DEPTH); |
| 1241 | for (i = 0; i < MAX_DEPTH; i++) | 1240 | for (i = 0; i < MAX_DEPTH; i++) |
| 1242 | name_list[i] = xmalloc(sizeof(char) * PATH_MAX + 1); | 1241 | name_list[i] = xmalloc(sizeof(char) * BUFSIZ + 1); |
| 1243 | } | 1242 | } |
| 1244 | 1243 | ||
| 1245 | #if 0 | 1244 | #if 0 |
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c index 1ee3d4cfa..be180a46b 100644 --- a/util-linux/mkfs_minix.c +++ b/util-linux/mkfs_minix.c | |||
| @@ -154,8 +154,8 @@ static unsigned short good_blocks_table[MAX_GOOD_BLOCKS]; | |||
| 154 | static int used_good_blocks = 0; | 154 | static int used_good_blocks = 0; |
| 155 | static unsigned long req_nr_inodes = 0; | 155 | static unsigned long req_nr_inodes = 0; |
| 156 | 156 | ||
| 157 | #define inode_in_use(x) (bit(inode_map,(x))) | 157 | #define inode_in_use(x) (isset(inode_map,(x))) |
| 158 | #define zone_in_use(x) (bit(zone_map,(x)-FIRSTZONE+1)) | 158 | #define zone_in_use(x) (isset(zone_map,(x)-FIRSTZONE+1)) |
| 159 | 159 | ||
| 160 | #define mark_inode(x) (setbit(inode_map,(x))) | 160 | #define mark_inode(x) (setbit(inode_map,(x))) |
| 161 | #define unmark_inode(x) (clrbit(inode_map,(x))) | 161 | #define unmark_inode(x) (clrbit(inode_map,(x))) |
diff --git a/util-linux/more.c b/util-linux/more.c index 909ed286b..30d2757cd 100644 --- a/util-linux/more.c +++ b/util-linux/more.c | |||
| @@ -48,6 +48,7 @@ static const char more_usage[] = "more [file ...]\n"; | |||
| 48 | #endif | 48 | #endif |
| 49 | 49 | ||
| 50 | FILE *cin; | 50 | FILE *cin; |
| 51 | |||
| 51 | struct termios initial_settings, new_settings; | 52 | struct termios initial_settings, new_settings; |
| 52 | 53 | ||
| 53 | void gotsig(int sig) | 54 | void gotsig(int sig) |
| @@ -65,7 +66,10 @@ void gotsig(int sig) | |||
| 65 | 66 | ||
| 66 | 67 | ||
| 67 | #if defined BB_FEATURE_AUTOWIDTH | 68 | #if defined BB_FEATURE_AUTOWIDTH |
| 68 | static int terminal_width = 0, terminal_height = 0; | 69 | #ifdef BB_FEATURE_USE_TERMIOS |
| 70 | static int terminal_width = 0; | ||
| 71 | #endif | ||
| 72 | static int terminal_height = 0; | ||
| 69 | #else | 73 | #else |
| 70 | #define terminal_width TERMINAL_WIDTH | 74 | #define terminal_width TERMINAL_WIDTH |
| 71 | #define terminal_height TERMINAL_HEIGHT | 75 | #define terminal_height TERMINAL_HEIGHT |
| @@ -80,7 +84,7 @@ extern int more_main(int argc, char **argv) | |||
| 80 | struct stat st; | 84 | struct stat st; |
| 81 | FILE *file; | 85 | FILE *file; |
| 82 | 86 | ||
| 83 | #ifdef BB_FEATURE_AUTOWIDTH | 87 | #if defined BB_FEATURE_AUTOWIDTH && defined BB_FEATURE_USE_TERMIOS |
| 84 | struct winsize win = { 0, 0 }; | 88 | struct winsize win = { 0, 0 }; |
| 85 | #endif | 89 | #endif |
| 86 | 90 | ||
| @@ -151,7 +155,11 @@ extern int more_main(int argc, char **argv) | |||
| 151 | ); | 155 | ); |
| 152 | 156 | ||
| 153 | fflush(stdout); | 157 | fflush(stdout); |
| 158 | #ifdef BB_FEATURE_USE_TERMIOS | ||
| 154 | input = getc(cin); | 159 | input = getc(cin); |
| 160 | #else | ||
| 161 | input = getc(stdin); | ||
| 162 | #endif | ||
| 155 | 163 | ||
| 156 | #ifdef BB_FEATURE_USE_TERMIOS | 164 | #ifdef BB_FEATURE_USE_TERMIOS |
| 157 | /* Erase the "More" message */ | 165 | /* Erase the "More" message */ |
diff --git a/util-linux/mount.c b/util-linux/mount.c index 972e5066c..456e45235 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
| @@ -48,6 +48,9 @@ | |||
| 48 | #if defined BB_FEATURE_USE_DEVPS_PATCH | 48 | #if defined BB_FEATURE_USE_DEVPS_PATCH |
| 49 | #include <linux/devmtab.h> | 49 | #include <linux/devmtab.h> |
| 50 | #endif | 50 | #endif |
| 51 | #ifndef MS_RDONLY | ||
| 52 | #include <linux/fs.h> | ||
| 53 | #endif | ||
| 51 | 54 | ||
| 52 | 55 | ||
| 53 | #if defined BB_FEATURE_MOUNT_LOOP | 56 | #if defined BB_FEATURE_MOUNT_LOOP |
| @@ -47,7 +47,6 @@ | |||
| 47 | #include <sys/stat.h> | 47 | #include <sys/stat.h> |
| 48 | #include <unistd.h> | 48 | #include <unistd.h> |
| 49 | #include <ctype.h> | 49 | #include <ctype.h> |
| 50 | #include <sys/param.h> /* for PATH_MAX */ | ||
| 51 | #include <sys/utsname.h> /* for uname(2) */ | 50 | #include <sys/utsname.h> /* for uname(2) */ |
| 52 | 51 | ||
| 53 | #if defined BB_FEATURE_MOUNT_LOOP | 52 | #if defined BB_FEATURE_MOUNT_LOOP |
| @@ -289,12 +288,12 @@ copyFile(const char *srcName, const char *destName, | |||
| 289 | return FALSE; | 288 | return FALSE; |
| 290 | } | 289 | } |
| 291 | } else if (S_ISLNK(srcStatBuf.st_mode)) { | 290 | } else if (S_ISLNK(srcStatBuf.st_mode)) { |
| 292 | char link_val[PATH_MAX + 1]; | 291 | char link_val[BUFSIZ + 1]; |
| 293 | int link_size; | 292 | int link_size; |
| 294 | 293 | ||
| 295 | //fprintf(stderr, "copying link %s to %s\n", srcName, destName); | 294 | //fprintf(stderr, "copying link %s to %s\n", srcName, destName); |
| 296 | /* Warning: This could possibly truncate silently, to PATH_MAX chars */ | 295 | /* Warning: This could possibly truncate silently, to BUFSIZ chars */ |
| 297 | link_size = readlink(srcName, &link_val[0], PATH_MAX); | 296 | link_size = readlink(srcName, &link_val[0], BUFSIZ); |
| 298 | if (link_size < 0) { | 297 | if (link_size < 0) { |
| 299 | perror(srcName); | 298 | perror(srcName); |
| 300 | return FALSE; | 299 | return FALSE; |
| @@ -602,13 +601,13 @@ int recursiveAction(const char *fileName, | |||
| 602 | } | 601 | } |
| 603 | } | 602 | } |
| 604 | while ((next = readdir(dir)) != NULL) { | 603 | while ((next = readdir(dir)) != NULL) { |
| 605 | char nextFile[PATH_MAX + 1]; | 604 | char nextFile[BUFSIZ + 1]; |
| 606 | 605 | ||
| 607 | if ((strcmp(next->d_name, "..") == 0) | 606 | if ((strcmp(next->d_name, "..") == 0) |
| 608 | || (strcmp(next->d_name, ".") == 0)) { | 607 | || (strcmp(next->d_name, ".") == 0)) { |
| 609 | continue; | 608 | continue; |
| 610 | } | 609 | } |
| 611 | if (strlen(fileName) + strlen(next->d_name) + 1 > PATH_MAX) { | 610 | if (strlen(fileName) + strlen(next->d_name) + 1 > BUFSIZ) { |
| 612 | fprintf(stderr, name_too_long, "ftw"); | 611 | fprintf(stderr, name_too_long, "ftw"); |
| 613 | return FALSE; | 612 | return FALSE; |
| 614 | } | 613 | } |
| @@ -658,7 +657,7 @@ extern int createPath(const char *name, int mode) | |||
| 658 | { | 657 | { |
| 659 | char *cp; | 658 | char *cp; |
| 660 | char *cpOld; | 659 | char *cpOld; |
| 661 | char buf[PATH_MAX + 1]; | 660 | char buf[BUFSIZ + 1]; |
| 662 | int retVal = 0; | 661 | int retVal = 0; |
| 663 | 662 | ||
| 664 | strcpy(buf, name); | 663 | strcpy(buf, name); |
