summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorErik Andersen2000-04-28 00:18:56 +0000
committerErik Andersen2000-04-28 00:18:56 +0000
commit4f3f757d56fbf420ea5030dcf7ea971b3da3ab47 (patch)
treed986e9bb9f03bf1f83465c274c35c0d58ed544e4 /coreutils
parent227a59b05d6df9b4be5990915646249d6f548822 (diff)
downloadbusybox-4f3f757d56fbf420ea5030dcf7ea971b3da3ab47.zip
busybox-4f3f757d56fbf420ea5030dcf7ea971b3da3ab47.tar.gz
Latest and greatest. Some effort at libc5 (aiming towards newlib)
compatability. -Erik
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/du.c7
-rw-r--r--coreutils/ln.c13
-rw-r--r--coreutils/ls.c2
-rw-r--r--coreutils/mkdir.c5
-rw-r--r--coreutils/pwd.c3
5 files changed, 13 insertions, 17 deletions
diff --git a/coreutils/du.c b/coreutils/du.c
index 8745380..c4fb3a3 100644
--- a/coreutils/du.c
+++ b/coreutils/du.c
@@ -32,7 +32,6 @@
#include <dirent.h>
#include <stdio.h>
#include <errno.h>
-#include <sys/param.h> /* for PATH_MAX */
typedef void (Display) (long, char *);
@@ -97,7 +96,7 @@ static long du(char *filename)
filename[--len] = '\0';
while ((entry = readdir(dir))) {
- char newfile[PATH_MAX + 1];
+ char newfile[BUFSIZ + 1];
char *name = entry->d_name;
if ((strcmp(name, "..") == 0)
@@ -105,7 +104,7 @@ static long du(char *filename)
continue;
}
- if (len + strlen(name) + 1 > PATH_MAX) {
+ if (len + strlen(name) + 1 > BUFSIZ) {
fprintf(stderr, name_too_long, "du");
du_depth--;
return 0;
@@ -182,7 +181,7 @@ int du_main(int argc, char **argv)
exit(0);
}
-/* $Id: du.c,v 1.17 2000/04/13 01:18:56 erik Exp $ */
+/* $Id: du.c,v 1.18 2000/04/28 00:18:56 erik Exp $ */
/*
Local Variables:
c-file-style: "linux"
diff --git a/coreutils/ln.c b/coreutils/ln.c
index 4be6062..eb7c996 100644
--- a/coreutils/ln.c
+++ b/coreutils/ln.c
@@ -30,7 +30,6 @@
#include <stdio.h>
#include <dirent.h>
#include <errno.h>
-#include <sys/param.h> /* for PATH_MAX */
static const char ln_usage[] =
"ln [OPTION] TARGET... LINK_NAME|DIRECTORY\n\n"
@@ -78,7 +77,7 @@ extern int ln_main(int argc, char **argv)
linkName = argv[argc - 1];
- if (strlen(linkName) > PATH_MAX) {
+ if (strlen(linkName) > BUFSIZ) {
fprintf(stderr, name_too_long, "ln");
exit FALSE;
}
@@ -91,10 +90,10 @@ extern int ln_main(int argc, char **argv)
}
while (argc-- >= 2) {
- char srcName[PATH_MAX + 1];
+ char srcName[BUFSIZ + 1];
int nChars, status;
- if (strlen(*argv) > PATH_MAX) {
+ if (strlen(*argv) > BUFSIZ) {
fprintf(stderr, name_too_long, "ln");
exit FALSE;
}
@@ -102,9 +101,9 @@ extern int ln_main(int argc, char **argv)
if (followLinks == FALSE) {
strcpy(srcName, *argv);
} else {
- /* Warning! This can silently truncate if > PATH_MAX, but
- I don't think that there can be one > PATH_MAX anyway. */
- nChars = readlink(*argv, srcName, PATH_MAX);
+ /* Warning! This can silently truncate if > BUFSIZ, but
+ I don't think that there can be one > BUFSIZ anyway. */
+ nChars = readlink(*argv, srcName, BUFSIZ);
srcName[nChars] = '\0';
}
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 0c7f652..3c518ab 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -183,7 +183,7 @@ static char append_char(mode_t mode)
static void list_single(const char *name, struct stat *info,
const char *fullname)
{
- char scratch[PATH_MAX + 1];
+ char scratch[BUFSIZ + 1];
short len = strlen(name);
#ifdef BB_FEATURE_LS_FILETYPES
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c
index b0a2d57..54d9b72 100644
--- a/coreutils/mkdir.c
+++ b/coreutils/mkdir.c
@@ -28,7 +28,6 @@
#include <stdio.h>
#include <errno.h>
-#include <sys/param.h> /* for PATH_MAX */
static const char mkdir_usage[] =
"mkdir [OPTION] DIRECTORY...\n\n"
@@ -86,9 +85,9 @@ extern int mkdir_main(int argc, char **argv)
while (argc > 0) {
int status;
struct stat statBuf;
- char buf[PATH_MAX + 1];
+ char buf[BUFSIZ + 1];
- if (strlen(*argv) > PATH_MAX - 1) {
+ if (strlen(*argv) > BUFSIZ - 1) {
fprintf(stderr, name_too_long, "mkdir");
exit FALSE;
}
diff --git a/coreutils/pwd.c b/coreutils/pwd.c
index 0016317..e77a0ca 100644
--- a/coreutils/pwd.c
+++ b/coreutils/pwd.c
@@ -24,11 +24,10 @@
#include "internal.h"
#include <stdio.h>
#include <dirent.h>
-#include <sys/param.h>
extern int pwd_main(int argc, char **argv)
{
- char buf[PATH_MAX + 1];
+ char buf[BUFSIZ + 1];
if (getcwd(buf, sizeof(buf)) == NULL) {
perror("get working directory");