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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [newlib/] [libc/] [stdio/] [remove.c] - Blame information for rev 1773

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1010 ivang
/*
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
#include <reent.h>
49
 
50
int
51
_remove_r (ptr, filename)
52
     struct _reent *ptr;
53
     _CONST char *filename;
54
{
55
  if (_unlink_r (ptr, filename) == -1)
56
    return -1;
57
 
58
  return 0;
59
}
60
 
61
#ifndef _REENT_ONLY
62
 
63
int
64
remove (filename)
65
     _CONST char *filename;
66
{
67
  return _remove_r (_REENT, filename);
68
}
69
 
70
#endif

powered by: WebSVN 2.1.0

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