changeset 535:d51be130fda2

More stabs at getting #includes right, and moving off of deprecated functions.
author Rob Landley <rob@landley.net>
date Thu, 08 Mar 2012 20:14:55 -0600
parents a864aa8c6331
children 2c1cb0d35031
files lib/lib.c toys/mdev.c toys/mkswap.c toys/sleep.c toys/which.c
diffstat 5 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lib/lib.c	Wed Mar 07 20:05:36 2012 -0600
+++ b/lib/lib.c	Thu Mar 08 20:14:55 2012 -0600
@@ -390,7 +390,7 @@
 	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;
--- a/toys/mdev.c	Wed Mar 07 20:05:36 2012 -0600
+++ b/toys/mdev.c	Thu Mar 08 20:14:55 2012 -0600
@@ -11,7 +11,7 @@
 
 config MDEV
 	bool "mdev"
-	default y
+	default n
 	help
 	  usage: mdev [-s]
 
--- a/toys/mkswap.c	Wed Mar 07 20:05:36 2012 -0600
+++ b/toys/mkswap.c	Thu Mar 08 20:14:55 2012 -0600
@@ -21,7 +21,7 @@
 
 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;
 
--- a/toys/sleep.c	Wed Mar 07 20:05:36 2012 -0600
+++ b/toys/sleep.c	Thu Mar 08 20:14:55 2012 -0600
@@ -49,6 +49,7 @@
 		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));
 	}
 }
--- a/toys/which.c	Wed Mar 07 20:05:36 2012 -0600
+++ b/toys/which.c	Thu Mar 08 20:14:55 2012 -0600
@@ -30,7 +30,7 @@
 
 	// 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;