Add error alert to ln and another item to the todo
This commit is contained in:
parent
fbacc8d7c5
commit
02699d5c8f
1
TODO.org
1
TODO.org
|
@ -11,3 +11,4 @@
|
||||||
- [ ] rm
|
- [ ] rm
|
||||||
- [ ] touch
|
- [ ] touch
|
||||||
- [X] yes
|
- [X] yes
|
||||||
|
- [ ] Add error handling and returning for ln
|
||||||
|
|
7
src/ln.c
7
src/ln.c
|
@ -20,7 +20,12 @@ main(int argc, char *argv[])
|
||||||
case 's':
|
case 's':
|
||||||
if(fflag && (access(argv[3], F_OK) != 1))
|
if(fflag && (access(argv[3], F_OK) != 1))
|
||||||
unlink(argv[3]);
|
unlink(argv[3]);
|
||||||
symlink(argv[2],argv[3]);
|
int symstat = symlink(argv[2],argv[3]);
|
||||||
|
if(symstat == -1)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Symlink error!");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
printf("-%c: Argument not found", optopt);
|
printf("-%c: Argument not found", optopt);
|
||||||
|
|
Loading…
Reference in New Issue