More stabs at getting #includes right, and moving off of deprecated functions.
authorRob Landley <rob@landley.net>
Fri, 9 Mar 2012 02:14:55 +0000 (20:14 -0600)
committerRob Landley <rob@landley.net>
Fri, 9 Mar 2012 02:14:55 +0000 (20:14 -0600)
lib/lib.c
toys/mdev.c
toys/mkswap.c
toys/sleep.c
toys/which.c

index cc441f9..a1f4a52 100644 (file)
--- 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;
index b644408..d83e10b 100644 (file)
@@ -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]
 
index 43fb6bf..87c1550 100644 (file)
@@ -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;
 
index d56678b..471011b 100644 (file)
@@ -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));
        }
 }
index 1319836..0ffc725 100644 (file)
@@ -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;