svn commit: trunk/busybox: include libbb shell

vda at busybox.net vda at busybox.net
Mon Dec 18 22:32:47 UTC 2006


Author: vda
Date: 2006-12-18 14:32:45 -0800 (Mon, 18 Dec 2006)
New Revision: 16998

Log:
xfuncs.c: dietlibc actually HAS fdprintf!
platform.h: define strchrnul for dietlibc
ash: stop using few non-standard functions


Modified:
   trunk/busybox/include/platform.h
   trunk/busybox/libbb/xfuncs.c
   trunk/busybox/shell/ash.c


Changeset:
Modified: trunk/busybox/include/platform.h
===================================================================
--- trunk/busybox/include/platform.h	2006-12-18 22:10:24 UTC (rev 16997)
+++ trunk/busybox/include/platform.h	2006-12-18 22:32:45 UTC (rev 16998)
@@ -193,11 +193,20 @@
 /* Platforms that haven't got dprintf need to implement fdprintf() in
  * libbb.  This would require a platform.c.  It's not going to be cleaned
  * out of the tree, so stop saying it should be. */
+#if !defined(__dietlibc__)
+/* Needed for: glibc */
+/* Not needed for: dietlibc */
+/* Others: ?? (add as needed) */
 #define fdprintf dprintf
-#ifdef __dietlibc__
-int dprintf(int fd, const char *format, ...);
 #endif
 
+#if defined(__dietlibc__)
+static ATTRIBUTE_ALWAYS_INLINE char* strchrnul(const char *s, char c) {
+	while (*s && *s != c) ++s;
+	return (char*)s;
+}
+#endif
+
 /* Don't use lchown with glibc older than 2.1.x ... uC-libc lacks it */
 #if (defined __GLIBC__ && __GLIBC__ <= 2 && __GLIBC_MINOR__ < 1) || \
     defined __UC_LIBC__

Modified: trunk/busybox/libbb/xfuncs.c
===================================================================
--- trunk/busybox/libbb/xfuncs.c	2006-12-18 22:10:24 UTC (rev 16997)
+++ trunk/busybox/libbb/xfuncs.c	2006-12-18 22:32:45 UTC (rev 16998)
@@ -411,8 +411,8 @@
 	return string_ptr;
 }
 
-#ifdef __dietlibc__
-int dprintf(int fd, const char *format, ...)
+#if 0 /* If we will ever meet a libc which hasn't [f]dprintf... */
+int fdprintf(int fd, const char *format, ...)
 {
 	va_list p;
 	int r;

Modified: trunk/busybox/shell/ash.c
===================================================================
--- trunk/busybox/shell/ash.c	2006-12-18 22:10:24 UTC (rev 16997)
+++ trunk/busybox/shell/ash.c	2006-12-18 22:32:45 UTC (rev 16998)
@@ -5851,7 +5851,7 @@
 		}
 		q = r;
 		if (len > 0) {
-			q = mempcpy(q, str, len);
+			q = memcpy(q, str, len) + len;
 		}
 	}
 	inquotes = (flag & RMESCAPE_QUOTED) ^ RMESCAPE_QUOTED;
@@ -8433,7 +8433,7 @@
 stnputs(const char *s, size_t n, char *p)
 {
 	p = makestrspace(n, p);
-	p = mempcpy(p, s, n);
+	p = memcpy(p, s, n) + n;
 	return p;
 }
 
@@ -8517,7 +8517,7 @@
 		q = p = makestrspace(len + 3, p);
 
 		*q++ = '\'';
-		q = mempcpy(q, s, len);
+		q = memcpy(q, s, len) + len;
 		*q++ = '\'';
 		s += len;
 
@@ -8530,7 +8530,7 @@
 		q = p = makestrspace(len + 3, p);
 
 		*q++ = '"';
-		q = mempcpy(q, s, len);
+		q = memcpy(q, s, len) + len;
 		*q++ = '"';
 		s += len;
 
@@ -8754,11 +8754,12 @@
 
 
 static char *
-nodesavestr(char   *s)
+nodesavestr(char *s)
 {
-	char   *rtn = funcstring;
+	char *rtn = funcstring;
 
-	funcstring = stpcpy(funcstring, s) + 1;
+	strcpy(funcstring, s);
+	funcstring += strlen(s) + 1;
 	return rtn;
 }
 
@@ -12013,10 +12014,11 @@
 		vallen = strlen(val);
 	}
 	INTOFF;
-	p = mempcpy(nameeq = ckmalloc(namelen + vallen + 2), name, namelen);
+	nameeq = ckmalloc(namelen + vallen + 2)
+	p = memcpy(nameeq, name, namelen) + namelen;
 	if (val) {
 		*p++ = '=';
-		p = mempcpy(p, val, vallen);
+		p = memcpy(p, val, vallen) + vallen;
 	}
 	*p = '\0';
 	setvareq(nameeq, flags | VNOSAVE);




More information about the busybox-cvs mailing list