This commit is contained in:
Your Name 2023-10-17 20:38:55 +03:00
parent 689899cbec
commit 31133309c2
2 changed files with 5 additions and 22 deletions

3
TODO
View File

@ -1,6 +1,3 @@
*1/2:
ln
*Todo:
chmod
chown

View File

@ -24,32 +24,18 @@ int main(const int argc, const char **argv) {
else if (!strcmp("-s", argv[i]))
s_flag = 1;
else {
else if (!strcmp("-h", argv[i])) {
printf("ln [-s] [TARGET] [LINK/DIR]\n");
return 0;
}
}
switch (argc - i) {
case 0:
fprintf(stderr, "ln: missing operand\n");
if (argc - i == 2) {
if (single_link(argv[i], argv[i + 1])) {
fprintf(stderr, "ln: %s %s\n", argv[i], strerror(errno));
return 1;
case 1:
fprintf(stderr, "ln: missing destination\n");
return 1;
case 2:
if (single_link(argv[i], argv[i + 1])) {
fprintf(stderr, "ln: %s %s\n", argv[i], strerror(errno));
return 1;
}
break;
default:
break;
}
}
return 0;