* ln [ -f ] target [ new name ]
char nb
[100], *name
=nb
, *arg2
;
if (argc
>1 && strcmp(argv
[1], "-f")==0) {
printf("Usage: ln target [ newname ]\n");
np
= rindex(argv
[1], '/');
statres
= stat(argv
[1], &statb
);
printf ("ln: %s does not exist\n", argv
[1]);
if (fflag
==0 && (statb
.st_mode
&S_IFMT
) == S_IFDIR
) {
printf("ln: %s is a directory\n", argv
[1]);
statres
= stat(arg2
, &statb
);
if (statres
>=0 && (statb
.st_mode
&S_IFMT
) == S_IFDIR
)
sprintf(name
, "%s/%s", arg2
, np
);
if (link(argv
[1], name
)<0) {