summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorThorsten Lockert <tholo@cvs.openbsd.org>1996-09-16 05:43:41 +0000
committerThorsten Lockert <tholo@cvs.openbsd.org>1996-09-16 05:43:41 +0000
commitf929de3d9b768f2bb0272124885f8a9860781208 (patch)
treecbbc8c3021290e73a7b91183af12830fb5a3a5c0 /lib
parentacffe15bb87bda932379dba7c5f7d408f43debbf (diff)
Avoid pulling in stdio
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/stdlib/malloc.c6
-rw-r--r--lib/libc/string/__strerror.c24
-rw-r--r--lib/libc/string/__strsignal.c24
3 files changed, 43 insertions, 11 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c
index 54a802b0c95..780980e7cb3 100644
--- a/lib/libc/stdlib/malloc.c
+++ b/lib/libc/stdlib/malloc.c
@@ -8,7 +8,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: malloc.c,v 1.11 1996/09/15 09:31:49 tholo Exp $";
+static char rcsid[] = "$OpenBSD: malloc.c,v 1.12 1996/09/16 05:43:40 tholo Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -20,9 +20,9 @@ static char rcsid[] = "$OpenBSD: malloc.c,v 1.11 1996/09/15 09:31:49 tholo Exp $
/*
* Defining MALLOC_STATS will enable you to call malloc_dump() and set
* the [dD] options in the MALLOC_OPTIONS environment variable.
- * It has no run-time performance hit.
+ * It has no run-time performance hit, but does pull in stdio...
*/
-#define MALLOC_STATS
+#undef MALLOC_STATS
#if defined(EXTRA_SANITY) && !defined(MALLOC_STATS)
# define MALLOC_STATS /* required for EXTRA_SANITY */
diff --git a/lib/libc/string/__strerror.c b/lib/libc/string/__strerror.c
index 619bebf2291..16d82058683 100644
--- a/lib/libc/string/__strerror.c
+++ b/lib/libc/string/__strerror.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: __strerror.c,v 1.4 1996/09/15 09:31:53 tholo Exp $";
+static char *rcsid = "$OpenBSD: __strerror.c,v 1.5 1996/09/16 05:43:38 tholo Exp $";
#endif /* LIBC_SCCS and not lint */
#ifdef NLS
@@ -49,6 +49,21 @@ static char *rcsid = "$OpenBSD: __strerror.c,v 1.4 1996/09/15 09:31:53 tholo Exp
#include <stdio.h>
#include <string.h>
+static char *itoa(num)
+ int num;
+{
+ static char buffer[11];
+ char *p;
+
+ p = buffer + 4;
+ while (num >= 10) {
+ *--p = (num % 10) + '0';
+ num /= 10;
+ }
+ *p = (num % 10) + '0';
+ return p;
+}
+
/*
* Since perror() is not allowed to change the contents of strerror()'s
* static buffer, both functions supply their own buffers to the
@@ -60,7 +75,7 @@ __strerror(num, buf)
int num;
char *buf;
{
-#define UPREFIX "Unknown error: %u"
+#define UPREFIX "Unknown error: "
register unsigned int errnum;
#ifdef NLS
@@ -78,10 +93,11 @@ __strerror(num, buf)
#endif
} else {
#ifdef NLS
- sprintf(buf, catgets(catd, 1, 0xffff, UPREFIX), errnum);
+ strcpy(buf, catgets(catd, 1, 0xffff, UPREFIX));
#else
- sprintf(buf, UPREFIX, errnum);
+ strcpy(buf, UPREFIX);
#endif
+ strcat(buf, itoa(errnum));
}
#ifdef NLS
diff --git a/lib/libc/string/__strsignal.c b/lib/libc/string/__strsignal.c
index 5d8700818ea..5a424bfde28 100644
--- a/lib/libc/string/__strsignal.c
+++ b/lib/libc/string/__strsignal.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: __strsignal.c,v 1.2 1996/08/19 08:33:56 tholo Exp $";
+static char *rcsid = "$OpenBSD: __strsignal.c,v 1.3 1996/09/16 05:43:39 tholo Exp $";
#endif /* LIBC_SCCS and not lint */
#ifdef NLS
@@ -48,12 +48,27 @@ static char *rcsid = "$OpenBSD: __strsignal.c,v 1.2 1996/08/19 08:33:56 tholo Ex
#include <signal.h>
#include <string.h>
+static char *itoa(num)
+ int num;
+{
+ static char buffer[11];
+ char *p;
+
+ p = buffer + 4;
+ while (num >= 10) {
+ *--p = (num % 10) + '0';
+ num /= 10;
+ }
+ *p = (num % 10) + '0';
+ return p;
+}
+
char *
__strsignal(num, buf)
int num;
char *buf;
{
-#define UPREFIX "Unknown signal: %u"
+#define UPREFIX "Unknown signal: "
register unsigned int signum;
#ifdef NLS
@@ -71,10 +86,11 @@ __strsignal(num, buf)
#endif
} else {
#ifdef NLS
- sprintf(buf, catgets(catd, 1, 0xffff, UPREFIX), signum);
+ strcpy(buf, catgets(catd, 1, 0xffff, UPREFIX));
#else
- sprintf(buf, UPREFIX, signum);
+ strcpy(buf, UPREFIX);
#endif
+ strcat(buf, itoa(signum));
}
#ifdef NLS