summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-07-05 19:25:08 +0000
committerEric Andersen <andersen@codepoet.org>2000-07-05 19:25:08 +0000
commitca9bd30c262ed788486c1d367ad40550e5d806c2 (patch)
treedaf86037f4b4d34e91c6f147e287fb26694df103 /libc
parent9281d180d13057917f618c35ef7433d2e4d4dd86 (diff)
Many bugfixes, header cleanups, etc. Added abort and glob.
It is getting closer... -Erik
Diffstat (limited to 'libc')
-rw-r--r--libc/inet/Makefile1
-rw-r--r--libc/inet/rpc/svc_tcp.c4
-rw-r--r--libc/misc/time/Makefile1
-rw-r--r--libc/pwd_grp/Makefile3
-rw-r--r--libc/stdio/Makefile1
-rw-r--r--libc/stdlib/Makefile4
-rw-r--r--libc/stdlib/abort.c53
-rw-r--r--libc/stdlib/atexit.c1
-rw-r--r--libc/stdlib/malloc/Makefile5
-rw-r--r--libc/string/Makefile1
-rw-r--r--libc/termios/Makefile1
11 files changed, 60 insertions, 15 deletions
diff --git a/libc/inet/Makefile b/libc/inet/Makefile
index 14afc1763..b73a5499e 100644
--- a/libc/inet/Makefile
+++ b/libc/inet/Makefile
@@ -22,7 +22,6 @@ gethostbyaddr.o
OBJ=$(AOBJ) $(ROBJ)
all: $(LIBC)
- @$(RM) $(OBJ)
$(LIBC): $(LIBC)($(OBJ))
diff --git a/libc/inet/rpc/svc_tcp.c b/libc/inet/rpc/svc_tcp.c
index 2f859476b..837e70c82 100644
--- a/libc/inet/rpc/svc_tcp.c
+++ b/libc/inet/rpc/svc_tcp.c
@@ -41,13 +41,11 @@ static char sccsid[] = "@(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro";
* and a record/tcp stream.
*/
+#include <stdlib.h>
#include <stdio.h>
#include <rpc/rpc.h>
#include <sys/socket.h>
#include <errno.h>
-/*#ifndef linux*/
-extern bool_t abort();
-/*#endif*/
extern errno;
/*
diff --git a/libc/misc/time/Makefile b/libc/misc/time/Makefile
index 7d648f867..2ee2a14e0 100644
--- a/libc/misc/time/Makefile
+++ b/libc/misc/time/Makefile
@@ -13,7 +13,6 @@ OBJ=localtime.o gmtime.o asctime.o ctime.o asc_conv.o tm_conv.o mktime.o \
localtime_r.o gmtime_r.o asctime_r.o ctime_r.o
all: $(LIBC)
- @$(RM) $(OBJ)
$(LIBC): $(LIBC)($(OBJ))
diff --git a/libc/pwd_grp/Makefile b/libc/pwd_grp/Makefile
index 8be9015f1..06f1cb7c1 100644
--- a/libc/pwd_grp/Makefile
+++ b/libc/pwd_grp/Makefile
@@ -21,10 +21,11 @@ UOBJ=utent.o
OBJ=$(POBJ) $(GOBJ) $(UOBJ)
all: $(LIBC)($(OBJ))
- @$(RM) $(OBJ)
$(LIBC)($(GOBJ)): config-grp.h
+$(LIBC): $(LIBC)($(OBJ))
+
clean:
rm -f *.o libc.a
diff --git a/libc/stdio/Makefile b/libc/stdio/Makefile
index 1aa8354f4..3357b3a93 100644
--- a/libc/stdio/Makefile
+++ b/libc/stdio/Makefile
@@ -21,7 +21,6 @@ SOBJ=scanf.o sscanf.o fscanf.o vscanf.o vsscanf.o vfscanf.o
OBJ= $(AOBJ) $(POBJ) $(SOBJ) dputs.o
all: $(LIBC)
- @$(RM) $(OBJ)
$(LIBC): $(LIBC)($(OBJ))
diff --git a/libc/stdlib/Makefile b/libc/stdlib/Makefile
index 61a82a2d6..2c2d0f5fb 100644
--- a/libc/stdlib/Makefile
+++ b/libc/stdlib/Makefile
@@ -17,7 +17,8 @@ EOBJ=on_exit.o atexit.o __do_exit.o exit.o
GOBJ=atoi.o atol.o ltoa.o ltostr.o \
ctype.o qsort.o bsearch.o rand.o lsearch.o getopt.o \
- itoa.o strtol.o crypt.o sleep.o mkstemp.o mktemp.o
+ glob.o fnmatch.o itoa.o strtol.o crypt.o sleep.o mkstemp.o \
+ mktemp.o
UOBJ=getenv.o putenv.o popen.o system.o getcwd.o setenv.o \
execl.o execv.o execlp.o execvp.o execvep.o
@@ -31,7 +32,6 @@ OBJ=$(MOBJ) $(EOBJ) $(GOBJ) $(UOBJ)
#endif
all: $(LIBC)
- @$(RM) $(OBJ)
$(LIBC): $(LIBC)($(OBJ))
diff --git a/libc/stdlib/abort.c b/libc/stdlib/abort.c
new file mode 100644
index 000000000..3d1c75fe0
--- /dev/null
+++ b/libc/stdlib/abort.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 1991 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+/* Hacked up for uC-Libc by Erik Andersen */
+
+#include <ansidecl.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <signal.h>
+#include <errno.h>
+
+typedef void (*vfuncp) ();
+extern vfuncp __cleanup;
+extern void _exit __P ((int __status)) __attribute__ ((__noreturn__));
+
+/* Cause an abnormal program termination with core-dump. */
+void
+abort(void)
+{
+ sigset_t sigset;
+
+ if (sigemptyset(&sigset) == 0 &&
+ sigaddset(&sigset, SIGABRT) == 0) {
+ sigprocmask(SIG_UNBLOCK, &sigset, (sigset_t *) NULL);
+ }
+
+ if (__cleanup)
+ __cleanup();
+
+ while (1)
+ if (raise(SIGABRT))
+ /* If we can't signal ourselves, exit. */
+ _exit(127);
+ /* If we signal ourselves and are still alive,
+ or can't exit, loop forever. */
+}
diff --git a/libc/stdlib/atexit.c b/libc/stdlib/atexit.c
index 2a82c6edb..7c6a03af8 100644
--- a/libc/stdlib/atexit.c
+++ b/libc/stdlib/atexit.c
@@ -20,6 +20,7 @@ typedef void (*vfuncp) ();
extern vfuncp __cleanup;
extern void __do_exit();
+extern void _exit __P ((int __status)) __attribute__ ((__noreturn__));
extern struct exit_table
{
diff --git a/libc/stdlib/malloc/Makefile b/libc/stdlib/malloc/Makefile
index ece276ba3..b3aca377b 100644
--- a/libc/stdlib/malloc/Makefile
+++ b/libc/stdlib/malloc/Makefile
@@ -10,14 +10,11 @@ LIBC=../libc.a
MSRC=alloc.c
MOBJ=malloc.o realloc.o free.o calloc.o malloc_dbg.o free_dbg.o calloc_dbg.o
-OBJ=$(MOBJ)
-
CFLAGS=$(ARCH) $(CCFLAGS) $(DEFS)
all: $(LIBC)
- @$(RM) $(OBJ)
-$(LIBC): $(LIBC)($(OBJ))
+$(LIBC): $(LIBC)($(MOBJ))
$(LIBC)($(MOBJ)): $(MSRC)
$(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
diff --git a/libc/string/Makefile b/libc/string/Makefile
index a64d0b82b..251948183 100644
--- a/libc/string/Makefile
+++ b/libc/string/Makefile
@@ -16,7 +16,6 @@ OBJ=$(SOBJ) strpbrk.o strsep.o strstr.o strtok.o strcspn.o \
strspn.o strcasecmp.o strncasecmp.o config.o
all: $(LIBC)
- @$(RM) $(OBJ)
$(LIBC): $(LIBC)($(OBJ))
diff --git a/libc/termios/Makefile b/libc/termios/Makefile
index a4ff4b7d9..4ab80e9da 100644
--- a/libc/termios/Makefile
+++ b/libc/termios/Makefile
@@ -19,7 +19,6 @@ OBJ=$(TOBJ) ttyname.o
# ttyname.o
all: $(LIBC)
- @$(RM) $(OBJ)
$(LIBC): $(LIBC)($(OBJ))