source: rtems/cpukit/libcsupport/src/link.c @ 9b4422a2

4.115
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  link() - POSIX 1003.1b - 5.3.4 - Create a new 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.rtems.com/license/LICENSE.
10 */
11
12#if HAVE_CONFIG_H
13  #include "config.h"
14#endif
15
16#include <unistd.h>
17
18#include <rtems/libio_.h>
19
20int link( const char *path1, const char *path2 )
21{
22  int rv = 0;
23  rtems_filesystem_eval_path_context_t ctx_1;
24  rtems_filesystem_eval_path_context_t ctx_2;
25  int eval_flags_1 = RTEMS_FS_FOLLOW_LINK;
26  int eval_flags_2 = RTEMS_FS_FOLLOW_LINK
27    | RTEMS_FS_MAKE
28    | RTEMS_FS_EXCLUSIVE;
29  const rtems_filesystem_location_info_t *currentloc_1 =
30    rtems_filesystem_eval_path_start( &ctx_1, path1, eval_flags_1 );
31  const rtems_filesystem_location_info_t *currentloc_2 =
32    rtems_filesystem_eval_path_start( &ctx_2, path2, eval_flags_2 );
33
34  rv = rtems_filesystem_location_exists_in_same_fs_instance_as(
35    currentloc_1,
36    currentloc_2
37  );
38  if ( rv == 0 ) {
39    rv = (*currentloc_2->ops->link_h)(
40      currentloc_2,
41      currentloc_1,
42      rtems_filesystem_eval_path_get_token( &ctx_2 ),
43      rtems_filesystem_eval_path_get_tokenlen( &ctx_2 )
44    );
45  }
46
47  rtems_filesystem_eval_path_cleanup( &ctx_1 );
48  rtems_filesystem_eval_path_cleanup( &ctx_2 );
49
50  return rv;
51}
52
53/*
54 *  _link_r
55 *
56 *  This is the Newlib dependent reentrant version of link().
57 */
58
59#if defined(RTEMS_NEWLIB)
60
61#include <reent.h>
62
63int _link_r(
64  struct _reent *ptr __attribute__((unused)),
65  const char    *path1,
66  const char    *path2
67)
68{
69  return link( path1, path2 );
70}
71#endif
Note: See TracBrowser for help on using the repository browser.