link.c 497 B

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