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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [stdio/] [remove.c] - Blame information for rev 171

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

Line No. Rev Author Line
1 148 jeremybenn
/*
2
 * Copyright (c) 1990 The Regents of the University of California.
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms are permitted
6
 * provided that the above copyright notice and this paragraph are
7
 * duplicated in all such forms and that any documentation,
8
 * advertising materials, and other materials related to such
9
 * distribution and use acknowledge that the software was developed
10
 * by the University of California, Berkeley.  The name of the
11
 * University may not be used to endorse or promote products derived
12
 * from this software without specific prior written permission.
13
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16
 */
17
 
18
/*
19
FUNCTION
20
<<remove>>---delete a file's name
21
 
22
INDEX
23
        remove
24
INDEX
25
        _remove_r
26
 
27
ANSI_SYNOPSIS
28
        #include <stdio.h>
29
        int remove(char *<[filename]>);
30
 
31
        int _remove_r(struct _reent *<[reent]>, char *<[filename]>);
32
 
33
TRAD_SYNOPSIS
34
        #include <stdio.h>
35
        int remove(<[filename]>)
36
        char *<[filename]>;
37
 
38
        int _remove_r(<[reent]>, <[filename]>)
39
        struct _reent *<[reent]>;
40
        char *<[filename]>;
41
 
42
DESCRIPTION
43
Use <<remove>> to dissolve the association between a particular
44
filename (the string at <[filename]>) and the file it represents.
45
After calling <<remove>> with a particular filename, you will no
46
longer be able to open the file by that name.
47
 
48
In this implementation, you may use <<remove>> on an open file without
49
error; existing file descriptors for the file will continue to access
50
the file's data until the program using them closes the file.
51
 
52
The alternate function <<_remove_r>> is a reentrant version.  The
53
extra argument <[reent]> is a pointer to a reentrancy structure.
54
 
55
RETURNS
56
<<remove>> returns <<0>> if it succeeds, <<-1>> if it fails.
57
 
58
PORTABILITY
59
ANSI C requires <<remove>>, but only specifies that the result on
60
failure be nonzero.  The behavior of <<remove>> when you call it on an
61
open file may vary among implementations.
62
 
63
Supporting OS subroutine required: <<unlink>>.
64
*/
65
 
66
#include <_ansi.h>
67
#include <reent.h>
68
#include <stdio.h>
69
 
70
int
71
_DEFUN(_remove_r, (ptr, filename),
72
       struct _reent *ptr _AND
73
       _CONST char *filename)
74
{
75
  if (_unlink_r (ptr, filename) == -1)
76
    return -1;
77
 
78
  return 0;
79
}
80
 
81
#ifndef _REENT_ONLY
82
 
83
int
84
_DEFUN(remove, (filename),
85
       _CONST char *filename)
86
{
87
  return _remove_r (_REENT, filename);
88
}
89
 
90
#endif

powered by: WebSVN 2.1.0

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