From: Alan Cox Date: Sun, 13 Nov 2016 00:08:17 +0000 (+0000) Subject: utils: minor fixes and changes X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=2add6a2f9e208264c4cd84924ea474ec623d2904;p=FUZIX.git utils: minor fixes and changes chmod we switch to opendir because we can't handle big stack objects on a 6502, and our newer malloc is way smaller so it's not a big hit any more --- diff --git a/Applications/util/chmod.c b/Applications/util/chmod.c index 82effc70..276cb15f 100644 --- a/Applications/util/chmod.c +++ b/Applications/util/chmod.c @@ -210,7 +210,7 @@ int main(int argc, char *argv[]) int do_change(char *name) { mode_t m; - DIR dir; + DIR *dir; struct dirent *entp; char *namp; @@ -235,7 +235,7 @@ int do_change(char *name) } if (S_ISDIR(st.st_mode) && rflag) { - if (!opendir_r(&dir, name)) { + if ((dir = opendir(name)) == NULL) { perror(name); return (1); } @@ -243,14 +243,14 @@ int do_change(char *name) strcpy(path, name); namp = path + strlen(path); *namp++ = '/'; - while (entp = readdir(&dir)) + while (entp = readdir(dir)) if (entp->d_name[0] != '.' || (entp->d_name[1] && (entp->d_name[1] != '.' || entp->d_name[2]))) { strcpy(namp, entp->d_name); errors |= do_change(path); } - closedir_r(&dir); + closedir(dir); *--namp = '\0'; } return (errors); diff --git a/Applications/util/dd.c b/Applications/util/dd.c index d1f94889..638c7cf3 100644 --- a/Applications/util/dd.c +++ b/Applications/util/dd.c @@ -126,7 +126,7 @@ int main(int argc, char *argv[]) count = getnum(cp); if (count < 0) { fprintf(stderr, "Bad count value\n"); - return; + return 1; } break; diff --git a/Applications/util/decomp16.c b/Applications/util/decomp16.c index cd9fb4a2..a3f118c1 100644 --- a/Applications/util/decomp16.c +++ b/Applications/util/decomp16.c @@ -175,7 +175,7 @@ void die(const char *s) /* Write any error message */ if (s != (const char *) NULL) write(fderr, s, strlen(s)); - exit((s == (char *) NULL) ? 0 : 1); + exit((s == (const char *) NULL) ? 0 : 1); } @@ -438,4 +438,5 @@ int main(int argc, char *argv[]) } } } + return 0; }