4.104.114.84.95
Last change
on this file since 9c49db4 was
9c49db4,
checked in by Joel Sherrill <joel.sherrill@…>, on 01/08/01 at 18:26:44
|
2001-01-08 Ralf Corsepius <corsepiu@…>
- configure.in: Add libc/config.h
- libc/Makefile.am: Add INCLUDES += -I. to pickup config.h
- libc/.cvsignore: Add config.h and stamp-h
- libc/*.c: Add config.h support.
|
-
Property mode set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | /* |
---|
2 | * unlink() - POSIX 1003.1b - 5.5.1 - Remove an existing link |
---|
3 | * |
---|
4 | * COPYRIGHT (c) 1989-1999. |
---|
5 | * On-Line Applications Research Corporation (OAR). |
---|
6 | * |
---|
7 | * The license and distribution terms for this file may be |
---|
8 | * found in the file LICENSE in this distribution or at |
---|
9 | * http://www.OARcorp.com/rtems/license.html. |
---|
10 | * |
---|
11 | * $Id$ |
---|
12 | */ |
---|
13 | |
---|
14 | #if HAVE_CONFIG_H |
---|
15 | #include "config.h" |
---|
16 | #endif |
---|
17 | |
---|
18 | #include <errno.h> |
---|
19 | |
---|
20 | #include <rtems/libio_.h> |
---|
21 | |
---|
22 | int unlink( |
---|
23 | const char *path |
---|
24 | ) |
---|
25 | { |
---|
26 | rtems_filesystem_location_info_t loc; |
---|
27 | int result; |
---|
28 | |
---|
29 | /* |
---|
30 | * Get the node to be unlinked. |
---|
31 | */ |
---|
32 | |
---|
33 | result = rtems_filesystem_evaluate_path( path, 0, &loc, FALSE ); |
---|
34 | if ( result != 0 ) |
---|
35 | return -1; |
---|
36 | |
---|
37 | if ( !loc.ops->node_type_h ) { |
---|
38 | rtems_filesystem_freenode( &loc ); |
---|
39 | set_errno_and_return_minus_one( ENOTSUP ); |
---|
40 | } |
---|
41 | |
---|
42 | if ( (*loc.ops->node_type_h)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY ) { |
---|
43 | rtems_filesystem_freenode( &loc ); |
---|
44 | set_errno_and_return_minus_one( EISDIR ); |
---|
45 | } |
---|
46 | |
---|
47 | if ( !loc.ops->unlink_h ) { |
---|
48 | rtems_filesystem_freenode( &loc ); |
---|
49 | set_errno_and_return_minus_one( ENOTSUP ); |
---|
50 | } |
---|
51 | |
---|
52 | result = (*loc.ops->unlink_h)( &loc ); |
---|
53 | |
---|
54 | rtems_filesystem_freenode( &loc ); |
---|
55 | |
---|
56 | return result; |
---|
57 | } |
---|
58 | |
---|
59 | /* |
---|
60 | * _unlink_r |
---|
61 | * |
---|
62 | * This is the Newlib dependent reentrant version of unlink(). |
---|
63 | */ |
---|
64 | |
---|
65 | #if defined(RTEMS_NEWLIB) |
---|
66 | |
---|
67 | #include <reent.h> |
---|
68 | |
---|
69 | int _unlink_r( |
---|
70 | struct _reent *ptr, |
---|
71 | const char *path |
---|
72 | ) |
---|
73 | { |
---|
74 | return unlink( path ); |
---|
75 | } |
---|
76 | #endif |
---|
77 | |
---|
Note: See
TracBrowser
for help on using the repository browser.