From 0575e4de01c907b372011c5eac705132d3aefffe Mon Sep 17 00:00:00 2001 From: qorg11 Date: Tue, 2 Jun 2020 19:48:59 +0200 Subject: [PATCH] Add ln --- src/ln.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/ln.c diff --git a/src/ln.c b/src/ln.c new file mode 100644 index 0000000..b34ac02 --- /dev/null +++ b/src/ln.c @@ -0,0 +1,21 @@ +#include +#include + +/* TODO -s flag */ + +int +main(int argc, char *argv[]) +{ + if(argc == 1) + { + printf("Usage: ln oldfile newfile\n"); + return 1; + } + int fd = link(argv[1],argv[2]); + if(fd == -1) + { + fprintf(stderr,"Error creating link\n"); + return 1; + } + return 0; +}