Home | History | Annotate | Download | only in posix
      1 /* link.c - hardlink a file
      2  *
      3  * Copyright 2011 Rob Landley <rob (at) landley.net>
      4  *
      5  * See http://opengroup.org/onlinepubs/9699919799/utilities/link.html
      6 
      7 USE_LINK(NEWTOY(link, "<2>2", TOYFLAG_USR|TOYFLAG_BIN))
      8 
      9 config LINK
     10   bool "link"
     11   default y
     12   help
     13     usage: link FILE NEWLINK
     14 
     15     Create hardlink to a file.
     16 */
     17 
     18 #include "toys.h"
     19 
     20 void link_main(void)
     21 {
     22   if (link(toys.optargs[0], toys.optargs[1]))
     23     perror_exit("couldn't link '%s' to '%s'", toys.optargs[1],
     24       toys.optargs[0]);
     25 }
     26