aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2012-03-08 20:14:55 -0600
committerRob Landley <rob@landley.net>2012-03-08 20:14:55 -0600
commitb7529b608ea3e56784c7682b382f285008a2fc90 (patch)
tree95f47b19499f5df2bc78f303a63588da4ce43ce4
parent13cacbd09de09e38e4d1227f7122fda8f1d6fc63 (diff)
downloadtoybox-b7529b608ea3e56784c7682b382f285008a2fc90.tar.gz
More stabs at getting #includes right, and moving off of deprecated functions.
-rw-r--r--lib/lib.c2
-rw-r--r--toys/mdev.c2
-rw-r--r--toys/mkswap.c2
-rw-r--r--toys/sleep.c3
-rw-r--r--toys/which.c2
5 files changed, 6 insertions, 5 deletions
diff --git a/lib/lib.c b/lib/lib.c
index cc441f9d..a1f4a528 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -390,7 +390,7 @@ struct string_list *find_in_path(char *path, char *filename)
char *cwd = xgetcwd();
for (;;) {
- char *next = path ? index(path, ':') : NULL;
+ char *next = path ? strchr(path, ':') : NULL;
int len = next ? next-path : strlen(path);
struct string_list *rnext;
struct stat st;
diff --git a/toys/mdev.c b/toys/mdev.c
index b6444088..d83e10bf 100644
--- a/toys/mdev.c
+++ b/toys/mdev.c
@@ -11,7 +11,7 @@ USE_MDEV(NEWTOY(mdev, "s", TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_UMASK))
config MDEV
bool "mdev"
- default y
+ default n
help
usage: mdev [-s]
diff --git a/toys/mkswap.c b/toys/mkswap.c
index 43fb6bfb..87c1550f 100644
--- a/toys/mkswap.c
+++ b/toys/mkswap.c
@@ -21,7 +21,7 @@ config MKSWAP
void mkswap_main(void)
{
- int fd = xopen(*toys.optargs, O_RDWR), pagesize = getpagesize();
+ int fd = xopen(*toys.optargs, O_RDWR), pagesize = sysconf(_SC_PAGE_SIZE);
off_t len = fdlength(fd);
unsigned int pages = (len/pagesize)-1, *swap = (unsigned int *)toybuf;
diff --git a/toys/sleep.c b/toys/sleep.c
index d56678bb..471011be 100644
--- a/toys/sleep.c
+++ b/toys/sleep.c
@@ -49,6 +49,7 @@ void sleep_main(void)
l = (unsigned long)d;
d -= l;
if (l) toys.exitval = sleep(l);
- if (!toys.exitval) toys.exitval = usleep((unsigned long)(d * 1000000));
+ if (!toys.exitval)
+ toys.exitval = nanosleep((unsigned long)(d * 1000000000));
}
}
diff --git a/toys/which.c b/toys/which.c
index 13198363..0ffc725a 100644
--- a/toys/which.c
+++ b/toys/which.c
@@ -30,7 +30,7 @@ static int which_in_path(char *filename)
// If they gave us a path, don't worry about $PATH or -a
- if (index(filename, '/')) {
+ if (strchr(filename, '/')) {
// Confirm it has the executable bit set, and it's not a directory.
if (!access(filename, X_OK)) {
struct stat st;