aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/rc/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/cmd/rc/util.c')
-rw-r--r--sys/cmd/rc/util.c65
1 files changed, 0 insertions, 65 deletions
diff --git a/sys/cmd/rc/util.c b/sys/cmd/rc/util.c
deleted file mode 100644
index b0be788..0000000
--- a/sys/cmd/rc/util.c
+++ /dev/null
@@ -1,65 +0,0 @@
-#include "rc.h"
-
-void
-fatal(char *msg, ...)
-{
- va_list args;
- vfprintf(stderr, msg, args);
- va_end(args);
-
- abort();
-}
-
-void*
-emalloc(uintptr n)
-{
- void *p;
- if(!(p = malloc(n)))
- fatal("out of memory: can't allocate %d bytes", n);
-
- memset(p, 0, n);
- return p;
-}
-
-void*
-erealloc(void *p, uintptr n)
-{
- void *r;
- if(!(r = realloc(p,n)))
- fatal("out of memory: can't reallocate %d bytes", n);
-
- return r;
-}
-
-void
-efree(void *p)
-{
- if(p)
- free(p);
- // TODO: log the double free
-}
-
-
-char *bp;
-
-static
-void
-iacvt(int n)
-{
- if(n<0){
- *bp++='-';
- n=-n; /* doesn't work for n==-inf */
- }
- if(n/10)
- iacvt(n/10);
-
- *bp++=n%10+'0';
-}
-
-void
-itoa(char *s, long n)
-{
- bp = s;
- iacvt(n);
- *bp='\0';
-}