add rmdir

This commit is contained in:
Dave Murphy 2011-02-09 17:43:29 +00:00
parent 9243e1f826
commit 5f8fb671b2

View File

@ -7111,6 +7111,58 @@ diff -Nbaur newlib-1.19.0/newlib/libc/misc/init.c newlib-1.19.0-ppc/newlib/libc/
+#error why am I not defined
+
#endif
diff -Nbaur newlib-1.19.0/newlib/libc/stdio/Makefile.am newlib-1.19.0-ppc/newlib/libc/stdio/Makefile.am
--- newlib-1.19.0/newlib/libc/stdio/Makefile.am 2009-07-03 12:58:04.000000000 +0100
+++ newlib-1.19.0-ppc/newlib/libc/stdio/Makefile.am 2011-02-08 17:22:10.000000000 +0000
@@ -54,6 +54,7 @@
rename.c \
rewind.c \
rget.c \
+ rmdir.c \
scanf.c \
sccl.c \
setbuf.c \
diff -Nbaur newlib-1.19.0/newlib/libc/stdio/Makefile.in newlib-1.19.0-ppc/newlib/libc/stdio/Makefile.in
--- newlib-1.19.0/newlib/libc/stdio/Makefile.in 2010-12-16 21:59:02.000000000 +0000
+++ newlib-1.19.0-ppc/newlib/libc/stdio/Makefile.in 2011-02-09 15:03:58.000000000 +0000
@@ -79,6 +79,7 @@
lib_a-refill.$(OBJEXT) lib_a-remove.$(OBJEXT) \
lib_a-rename.$(OBJEXT) lib_a-rewind.$(OBJEXT) \
lib_a-rget.$(OBJEXT) lib_a-scanf.$(OBJEXT) \
+ lib_a-rmdir.$(OBJEXT) \
lib_a-sccl.$(OBJEXT) lib_a-setbuf.$(OBJEXT) \
lib_a-setbuffer.$(OBJEXT) lib_a-setlinebuf.$(OBJEXT) \
lib_a-setvbuf.$(OBJEXT) lib_a-siprintf.$(OBJEXT) \
@@ -148,7 +149,7 @@
getc_u.lo getchar_u.lo getdelim.lo getline.lo gets.lo \
iprintf.lo iscanf.lo makebuf.lo perror.lo printf.lo putc.lo \
putchar.lo putc_u.lo putchar_u.lo puts.lo refill.lo remove.lo \
- rename.lo rewind.lo rget.lo scanf.lo sccl.lo setbuf.lo \
+ rename.lo rewind.lo rget.lo rmdir.lo scanf.lo sccl.lo setbuf.lo \
setbuffer.lo setlinebuf.lo setvbuf.lo siprintf.lo siscanf.lo \
sniprintf.lo snprintf.lo sprintf.lo sscanf.lo stdio.lo \
tmpfile.lo tmpnam.lo ungetc.lo vdiprintf.lo vdprintf.lo \
@@ -409,6 +410,7 @@
rename.c \
rewind.c \
rget.c \
+ rmdir.c \
scanf.c \
sccl.c \
setbuf.c \
@@ -957,6 +959,12 @@
lib_a-rget.obj: rget.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-rget.obj `if test -f 'rget.c'; then $(CYGPATH_W) 'rget.c'; else $(CYGPATH_W) '$(srcdir)/rget.c'; fi`
+lib_a-rmdir.o: rmdir.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-rmdir.o `test -f 'rmdir.c' || echo '$(srcdir)/'`rmdir.c
+
+lib_a-rmdir.obj: rmdir.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-rmdir.obj `if test -f 'rmdir.c'; then $(CYGPATH_W) 'rmdir.c'; else $(CYGPATH_W) '$(srcdir)/rmdir.c'; fi`
+
lib_a-scanf.o: scanf.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-scanf.o `test -f 'scanf.c' || echo '$(srcdir)/'`scanf.c
diff -Nbaur newlib-1.19.0/newlib/libc/stdio/findfp.c newlib-1.19.0-ppc/newlib/libc/stdio/findfp.c
--- newlib-1.19.0/newlib/libc/stdio/findfp.c 2008-12-10 23:43:12.000000000 +0000
+++ newlib-1.19.0-ppc/newlib/libc/stdio/findfp.c 2011-01-13 13:58:57.000000000 +0000
@ -7192,6 +7244,100 @@ diff -Nbaur newlib-1.19.0/newlib/libc/stdio/fvwrite.c newlib-1.19.0-ppc/newlib/l
if (w <= 0)
goto err;
p += w;
diff -Nbaur newlib-1.19.0/newlib/libc/stdio/rmdir.c newlib-1.19.0-ppc/newlib/libc/stdio/rmdir.c
--- newlib-1.19.0/newlib/libc/stdio/rmdir.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.19.0-ppc/newlib/libc/stdio/rmdir.c 2011-02-08 17:26:52.000000000 +0000
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley. The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+/*
+FUNCTION
+<<rmdir>>---delete a directory
+
+INDEX
+ rmdir
+INDEX
+ _rmdir_r
+
+ANSI_SYNOPSIS
+ #include <stdio.h>
+ int rmdir(char *<[filename]>);
+
+ int _rmdir_r(struct _reent *<[reent]>, char *<[filename]>);
+
+TRAD_SYNOPSIS
+ #include <stdio.h>
+ int rmdir(<[filename]>)
+ char *<[filename]>;
+
+ int _rmdir_r(<[reent]>, <[filename]>)
+ struct _reent *<[reent]>;
+ char *<[filename]>;
+
+DESCRIPTION
+Use <<remove>> to dissolve the association between a particular
+filename (the string at <[filename]>) and the file it represents.
+After calling <<remove>> with a particular filename, you will no
+longer be able to open the file by that name.
+
+In this implementation, you may use <<remove>> on an open file without
+error; existing file descriptors for the file will continue to access
+the file's data until the program using them closes the file.
+
+The alternate function <<_rmdir_r>> is a reentrant version. The
+extra argument <[reent]> is a pointer to a reentrancy structure.
+
+RETURNS
+<<remove>> returns <<0>> if it succeeds, <<-1>> if it fails.
+
+PORTABILITY
+ANSI C requires <<remove>>, but only specifies that the result on
+failure be nonzero. The behavior of <<remove>> when you call it on an
+open file may vary among implementations.
+
+Supporting OS subroutine required: <<unlink>>.
+*/
+
+#include <_ansi.h>
+#include <reent.h>
+#include <stdio.h>
+
+int
+_DEFUN(_rmdir_r, (ptr, filename),
+ struct _reent *ptr _AND
+ _CONST char *filename)
+{
+ if (_unlink_r (ptr, filename) == -1)
+ return -1;
+
+ return 0;
+}
+
+#ifndef _REENT_ONLY
+
+int
+_DEFUN(rmdir, (filename),
+ _CONST char *filename)
+{
+ return _rmdir_r (_REENT, filename);
+}
+
+#endif
diff -Nbaur newlib-1.19.0/newlib/libc/stdlib/mbtowc_r.c newlib-1.19.0-ppc/newlib/libc/stdlib/mbtowc_r.c
--- newlib-1.19.0/newlib/libc/stdlib/mbtowc_r.c 2010-01-17 09:39:06.000000000 +0000
+++ newlib-1.19.0-ppc/newlib/libc/stdlib/mbtowc_r.c 2011-01-13 14:01:14.000000000 +0000