From 8a0efa53e44919bcf5ccb1d3353618a82afdf8bc Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Thu, 17 Feb 2000 19:39:52 +0000 Subject: import newlib-2000-02-17 snapshot --- newlib/libc/stdio/remove.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 newlib/libc/stdio/remove.c (limited to 'newlib/libc/stdio/remove.c') diff --git a/newlib/libc/stdio/remove.c b/newlib/libc/stdio/remove.c new file mode 100644 index 000000000..074dd9ac8 --- /dev/null +++ b/newlib/libc/stdio/remove.c @@ -0,0 +1,69 @@ +/* +FUNCTION +<>---delete a file's name + +INDEX + remove + +ANSI_SYNOPSIS + #include + int remove(char *<[filename]>); + + int _remove_r(void *<[reent]>, char *<[filename]>); + +TRAD_SYNOPSIS + #include + int remove(<[filename]>) + char *<[filename]>; + + int _remove_r(<[reent]>, <[filename]>) + char *<[reent]>; + char *<[filename]>; + +DESCRIPTION +Use <> to dissolve the association between a particular +filename (the string at <[filename]>) and the file it represents. +After calling <> with a particular filename, you will no +longer be able to open the file by that name. + +In this implementation, you may use <> 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 <<_remove_r>> is a reentrant version. The +extra argument <[reent]> is a pointer to a reentrancy structure. + +RETURNS +<> returns <<0>> if it succeeds, <<-1>> if it fails. + +PORTABILITY +ANSI C requires <>, but only specifies that the result on +failure be nonzero. The behavior of <> when you call it on an +open file may vary among implementations. + +Supporting OS subroutine required: <>. +*/ + +#include + +int +_remove_r (ptr, filename) + struct _reent *ptr; + _CONST char *filename; +{ + if (_unlink_r (ptr, filename) == -1) + return -1; + + return 0; +} + +#ifndef _REENT_ONLY + +int +remove (filename) + _CONST char *filename; +{ + return _remove_r (_REENT, filename); +} + +#endif -- cgit v1.2.3