Tried to add symlinks the worst way possible. Please fix
This commit is contained in:
parent
0575e4de01
commit
3843efd08f
10
src/ln.c
10
src/ln.c
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue