OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [newlib/] [newlib/] [libc/] [stdio/] [remove.c] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 39 lampret
/*
2
FUNCTION
3
<<remove>>---delete a file's name
4
 
5
INDEX
6
        remove
7
 
8
ANSI_SYNOPSIS
9
        #include <stdio.h>
10
        int remove(char *<[filename]>);
11
 
12
        int _remove_r(void *<[reent]>, char *<[filename]>);
13
 
14
TRAD_SYNOPSIS
15
        #include <stdio.h>
16
        int remove(<[filename]>)
17
        char *<[filename]>;
18
 
19
        int _remove_r(<[reent]>, <[filename]>)
20
        char *<[reent]>;
21
        char *<[filename]>;
22
 
23
DESCRIPTION
24
Use <<remove>> to dissolve the association between a particular
25
filename (the string at <[filename]>) and the file it represents.
26
After calling <<remove>> with a particular filename, you will no
27
longer be able to open the file by that name.
28
 
29
In this implementation, you may use <<remove>> on an open file without
30
error; existing file descriptors for the file will continue to access
31
the file's data until the program using them closes the file.
32
 
33
The alternate function <<_remove_r>> is a reentrant version.  The
34
extra argument <[reent]> is a pointer to a reentrancy structure.
35
 
36
RETURNS
37
<<remove>> returns <<0>> if it succeeds, <<-1>> if it fails.
38
 
39
PORTABILITY
40
ANSI C requires <<remove>>, but only specifies that the result on
41
failure be nonzero.  The behavior of <<remove>> when you call it on an
42
open file may vary among implementations.
43
 
44
Supporting OS subroutine required: <<unlink>>.
45
*/
46
 
47
#include <stdio.h>
48
 
49
int
50
_remove_r (ptr, filename)
51
     struct _reent *ptr;
52
     _CONST char *filename;
53
{
54
  if (_unlink_r (ptr, filename) == -1)
55
    return -1;
56
 
57
  return 0;
58
}
59
 
60
#ifndef _REENT_ONLY
61
 
62
int
63
remove (filename)
64
     _CONST char *filename;
65
{
66
  return _remove_r (_REENT, filename);
67
}
68
 
69
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.