diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-04-09 22:48:12 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-04-09 22:48:12 +0000 |
commit | e5dfced23a904d08afa5dcee190c3c3d845d9f50 (patch) | |
tree | ef367ee8a9096884fb40debdc9e10af8583f9d5f /coreutils | |
parent | a75e2867435faa68ea03735fe09ad298fa3e4e72 (diff) | |
download | busybox-w32-e5dfced23a904d08afa5dcee190c3c3d845d9f50.tar.gz busybox-w32-e5dfced23a904d08afa5dcee190c3c3d845d9f50.tar.bz2 busybox-w32-e5dfced23a904d08afa5dcee190c3c3d845d9f50.zip |
Apply Vladimir's latest cleanup patch.
-Erik
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/du.c | 17 | ||||
-rw-r--r-- | coreutils/echo.c | 2 | ||||
-rw-r--r-- | coreutils/pwd.c | 16 | ||||
-rw-r--r-- | coreutils/tr.c | 2 |
4 files changed, 17 insertions, 20 deletions
diff --git a/coreutils/du.c b/coreutils/du.c index 7cb888de8..119895e49 100644 --- a/coreutils/du.c +++ b/coreutils/du.c | |||
@@ -83,7 +83,8 @@ static long du(char *filename) | |||
83 | int len; | 83 | int len; |
84 | 84 | ||
85 | if ((lstat(filename, &statbuf)) != 0) { | 85 | if ((lstat(filename, &statbuf)) != 0) { |
86 | perror_msg_and_die("%s", filename); | 86 | perror_msg("%s", filename); |
87 | return 0; | ||
87 | } | 88 | } |
88 | 89 | ||
89 | du_depth++; | 90 | du_depth++; |
@@ -110,22 +111,16 @@ static long du(char *filename) | |||
110 | filename[--len] = '\0'; | 111 | filename[--len] = '\0'; |
111 | 112 | ||
112 | while ((entry = readdir(dir))) { | 113 | while ((entry = readdir(dir))) { |
113 | char newfile[BUFSIZ + 1]; | 114 | char *newfile; |
114 | char *name = entry->d_name; | 115 | char *name = entry->d_name; |
115 | 116 | ||
116 | if ((strcmp(name, "..") == 0) | 117 | if ((strcmp(name, "..") == 0) |
117 | || (strcmp(name, ".") == 0)) { | 118 | || (strcmp(name, ".") == 0)) { |
118 | continue; | 119 | continue; |
119 | } | 120 | } |
120 | 121 | newfile = concat_path_file(filename, name); | |
121 | if (len + strlen(name) + 1 > BUFSIZ) { | ||
122 | error_msg(name_too_long); | ||
123 | du_depth--; | ||
124 | return 0; | ||
125 | } | ||
126 | sprintf(newfile, "%s/%s", filename, name); | ||
127 | |||
128 | sum += du(newfile); | 122 | sum += du(newfile); |
123 | free(newfile); | ||
129 | } | 124 | } |
130 | closedir(dir); | 125 | closedir(dir); |
131 | print(sum, filename); | 126 | print(sum, filename); |
@@ -197,7 +192,7 @@ int du_main(int argc, char **argv) | |||
197 | return status; | 192 | return status; |
198 | } | 193 | } |
199 | 194 | ||
200 | /* $Id: du.c,v 1.43 2001/03/09 14:36:42 andersen Exp $ */ | 195 | /* $Id: du.c,v 1.44 2001/04/09 22:48:11 andersen Exp $ */ |
201 | /* | 196 | /* |
202 | Local Variables: | 197 | Local Variables: |
203 | c-file-style: "linux" | 198 | c-file-style: "linux" |
diff --git a/coreutils/echo.c b/coreutils/echo.c index 1ca373467..31c031528 100644 --- a/coreutils/echo.c +++ b/coreutils/echo.c | |||
@@ -81,7 +81,7 @@ echo_main(int argc, char** argv) | |||
81 | 81 | ||
82 | just_echo: | 82 | just_echo: |
83 | while (argc > 0) { | 83 | while (argc > 0) { |
84 | char *arg = argv[0]; | 84 | const char *arg = argv[0]; |
85 | register int c; | 85 | register int c; |
86 | 86 | ||
87 | while ((c = *arg++)) { | 87 | while ((c = *arg++)) { |
diff --git a/coreutils/pwd.c b/coreutils/pwd.c index 2f36b1f05..f6a00bf1e 100644 --- a/coreutils/pwd.c +++ b/coreutils/pwd.c | |||
@@ -32,11 +32,13 @@ | |||
32 | 32 | ||
33 | extern int pwd_main(int argc, char **argv) | 33 | extern int pwd_main(int argc, char **argv) |
34 | { | 34 | { |
35 | char buf[BUFSIZ + 1]; | 35 | static char *buf; |
36 | 36 | ||
37 | if (getcwd(buf, sizeof(buf)) == NULL) | 37 | buf = xgetcwd(buf); |
38 | perror_msg_and_die("getcwd"); | 38 | |
39 | 39 | if (buf != NULL) { | |
40 | puts(buf); | 40 | puts(buf); |
41 | return EXIT_SUCCESS; | 41 | return EXIT_SUCCESS; |
42 | } | ||
43 | return EXIT_FAILURE; | ||
42 | } | 44 | } |
diff --git a/coreutils/tr.c b/coreutils/tr.c index 32a4f2917..ce15cfdf8 100644 --- a/coreutils/tr.c +++ b/coreutils/tr.c | |||
@@ -93,7 +93,7 @@ static void map(register unsigned char *string1, unsigned int string1_len, | |||
93 | } | 93 | } |
94 | } | 94 | } |
95 | 95 | ||
96 | static unsigned int expand(char *arg, register unsigned char *buffer) | 96 | static unsigned int expand(const char *arg, register unsigned char *buffer) |
97 | { | 97 | { |
98 | unsigned char *buffer_start = buffer; | 98 | unsigned char *buffer_start = buffer; |
99 | int i, ac; | 99 | int i, ac; |