Tried to add symlinks the worst way possible. Please fix

This commit is contained in:
qorg11 2020-06-02 21:46:28 +02:00
parent 0575e4de01
commit 3843efd08f
Signed by: qorg11
GPG Key ID: 343FC20A4ACA62B9
1 changed files with 10 additions and 0 deletions

View File

@ -6,11 +6,21 @@
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
if(argc == 1) if(argc == 1)
{ {
printf("Usage: ln oldfile newfile\n"); printf("Usage: ln oldfile newfile\n");
return 1; return 1;
} }
int c = getopt(argc, argv, "s");
if(c == 's')
{
symlink(argv[2],argv[3]);
return 0;
}
int fd = link(argv[1],argv[2]); int fd = link(argv[1],argv[2]);
if(fd == -1) if(fd == -1)
{ {