Subversion Repositories Kolibri OS

Rev

Rev 4874 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4349 Serge 1
/*
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
<>---delete a file's name
21
 
22
INDEX
23
	remove
24
INDEX
25
	_remove_r
26
 
27
ANSI_SYNOPSIS
28
	#include 
29
	int remove(char *<[filename]>);
30
 
31
	int _remove_r(struct _reent *<[reent]>, char *<[filename]>);
32
 
33
TRAD_SYNOPSIS
34
	#include 
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 <> to dissolve the association between a particular
44
filename (the string at <[filename]>) and the file it represents.
45
After calling <> 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 <> 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
<> returns <<0>> if it succeeds, <<-1>> if it fails.
57
 
58
PORTABILITY
59
ANSI C requires <>, but only specifies that the result on
60
failure be nonzero.  The behavior of <> when you call it on an
61
open file may vary among implementations.
62
 
63
Supporting OS subroutine required: <>.
64
*/
65
 
66
#include <_ansi.h>
67
#include 
68
#include 
69
 
70
int
71
_DEFUN(_remove_r, (ptr, filename),
72
       struct _reent *ptr _AND
73
       _CONST char *filename)
74
{
4921 Serge 75
  if (_unlink_r (ptr, filename) == -1)
76
    return -1;
77
 
78
  return 0;
4349 Serge 79
}
80
 
81
#ifndef _REENT_ONLY
82
 
83
int
84
_DEFUN(remove, (filename),
85
       _CONST char *filename)
86
{
4921 Serge 87
  return _remove_r (_REENT, filename);
4349 Serge 88
}
89
 
90
#endif