Added a "symlink" command that can create symlinks from the shell (like "ln -s").

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@561 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2002-08-03 02:04:50 +00:00
parent ae372703ce
commit 28cdc245d3
2 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,3 @@
SubDir OBOS_TOP src kernel apps symlink ;
KernelObjects <$(SOURCE_GRIST)>main.c : -fpic -Wno-unused ;

View File

@ -0,0 +1,22 @@
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
int
main(int argc, char **argv)
{
if (argc < 3) {
fprintf(stderr, "usage: symlink <target> <link-name>\n");
return -1;
}
if (symlink(argv[2], argv[1]) < 0) {
fprintf(stderr, "symlink failed: %s\n", strerror(errno));
return -1;
}
return 0;
}