man(1) Manual page archive


     LINK(2)                                                   LINK(2)

     NAME
          link, symlink, readlink - link to a file

     SYNOPSIS
          link(name1, name2)
          char *name1, *name2;

          symlink(name1, name2)
          char *name1, *name2;

          readlink(name, buf, size)
          char *name, *buf;

     DESCRIPTION
          A link to name1 is created; the link has the name name2.
          Either name may be an arbitrary path name.  After link,
          name2 is entirely equivalent to name1; it is a directory
          entry referring to the same file as name1.

          After symlink, name2 is a new symbolic link; when it is
          encountered in any path name, name1 is substituted for
          name2, and path name parsing continues.  If name1 begins
          with the `/' character, it is interpreted with respect to
          the root directory; if not, it is interpreted with respect
          to the directory in which name2 resides.

          The readlink call returns the contents of a symbolic link
          name into buf. No more than size characters are returned.
          If there is room, the returned string will be null-padded.
          An error is reported if name is not a symbolic link.

     SEE ALSO
          ln(1), unlink(2), stat(2)

     DIAGNOSTICS
          Zero is returned when a link is made; -1 is returned when
          name1 cannot be found; when name2 already exists; when the
          directory of name2 cannot be written.  With link, only the
          super-user may link to a directory.  Furthermore, the target
          must exist in the same file system, and not have too many
          links.