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 /coreutils | |
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
Diffstat (limited to 'coreutils')
-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 |
5 files changed, 13 insertions, 17 deletions
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"); |