Add to TODO and clean up ln

This commit is contained in:
call-cc 2020-06-02 16:19:26 -04:00
parent 3843efd08f
commit bdbe212df7
2 changed files with 21 additions and 14 deletions

1
TODO
View File

@ -1,3 +1,4 @@
* The rest of programs.
* Manuals
* flags for the programs
* fix yes (constantly returns y when no argument is passed)

View File

@ -12,16 +12,20 @@ main(int argc, char *argv[])
printf("Usage: ln oldfile newfile\n");
return 1;
}
int c = getopt(argc, argv, "s");
if(c == 's')
int opts;
int fd;
while((opts = getopt(argc, argv, "s:")) != -1)
{
switch(opts)
{
case 's':
symlink(argv[2],argv[3]);
return 0;
}
int fd = link(argv[1],argv[2]);
break;
case '?':
printf("-%c: Argument not found", optopt);
break;
default:
fd = link(argv[1],argv[2]);
if(fd == -1)
{
fprintf(stderr,"Error creating link\n");
@ -29,3 +33,5 @@ main(int argc, char *argv[])
}
return 0;
}
}
}