link.c (482B)
1 /* see LICENSE file for copyright and license details */ 2 3 #include <unistd.h> 4 5 #include "util.h" 6 7 static void 8 usage(void) 9 { 10 eprintf("usage: %s target name\n", argv0); 11 } 12 13 // ?man link: create a link to a file 14 // ?man arguments: target name 15 // ?man create a hard link to an existing file 16 int 17 main(int argc, char *argv[]) 18 { 19 ARGBEGIN 20 { 21 default: 22 usage(); 23 } 24 ARGEND 25 26 if (argc != 2) 27 usage(); 28 29 if (link(argv[0], argv[1]) < 0) 30 eprintf("link:"); 31 32 return 0; 33 }