This commit is contained in:
rsc 2007-08-22 05:54:55 +00:00
parent c88bf235fe
commit 6bf2e5c898
2 changed files with 20 additions and 1 deletions

View file

@ -105,6 +105,10 @@ _rm : rm.o $(ULIB)
$(LD) -N -e main -Ttext 0 -o _rm rm.o $(ULIB)
$(OBJDUMP) -S _rm > rm.asm
_ln : ln.o $(ULIB)
$(LD) -N -e main -Ttext 0 -o _ln ln.o $(ULIB)
$(OBJDUMP) -S _ln > ln.asm
_sh : sh.o $(ULIB)
$(LD) -N -e main -Ttext 0 -o _sh sh.o $(ULIB)
$(OBJDUMP) -S _sh > sh.asm
@ -116,7 +120,7 @@ _zombie: zombie.o $(ULIB)
mkfs : mkfs.c fs.h
cc -o mkfs mkfs.c
UPROGS=usertests _echo _cat _init _kill _ls _mkdir _rm _sh _zombie
UPROGS=usertests _echo _cat _init _kill _ln _ls _mkdir _rm _sh _zombie
fs.img : mkfs README $(UPROGS)
./mkfs fs.img README $(UPROGS)

15
ln.c Normal file
View file

@ -0,0 +1,15 @@
#include "types.h"
#include "stat.h"
#include "user.h"
int
main(int argc, char *argv[])
{
if(argc != 3){
printf(2, "Usage: ln old new\n");
exit();
}
if(link(argv[1], argv[2]) < 0)
printf(2, "link %s %s: failed\n", argv[1], argv[2]);
exit();
}