From 450843b48fd2adf12e5360da961b4ec553bf61fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 11 May 2004 02:04:38 +0000 Subject: [PATCH] New "symlink" command which can create a symbolic link on the file system. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7515 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/file_systems/fs_shell/fsh.c | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/tests/add-ons/kernel/file_systems/fs_shell/fsh.c b/src/tests/add-ons/kernel/file_systems/fs_shell/fsh.c index 05874d0bb2..8cb954518f 100644 --- a/src/tests/add-ons/kernel/file_systems/fs_shell/fsh.c +++ b/src/tests/add-ons/kernel/file_systems/fs_shell/fsh.c @@ -62,7 +62,6 @@ main(int argc, char **argv) do_fsh(); - if (sys_unmount(1, -1, "/myfs") != 0) { printf("could not un-mount /myfs\n"); return 5; @@ -1135,6 +1134,29 @@ do_rename(int argc, char **argv) } +static void +do_symlink(int argc, char **argv) +{ + char target[B_PATH_NAME_LENGTH]; + char *source; + status_t status; + + if (argc < 3) { + printf("usage: symlink \n"); + return; + } + + source = argv[1]; + + strcpy(target, "/myfs/"); + strcpy(target + 6, argv[2]); + + status = sys_symlink(1, source, -1, target); + if (status != B_OK) + printf("symlink failed with error: %s\n", strerror(status)); +} + + static void do_sync(int argc, char **argv) { @@ -1501,6 +1523,7 @@ cmd_entry fsh_cmds[] = { "tracker", do_tracker, "starts a Tracker like background thread that will listen to fs updates" }, { "cio", do_cio, "does a I/O speed test" }, { "stattest", do_stattest, "does an \"early\"/\"late\" stat test for files that are created or deleted" }, + { "symlink", do_symlink, "creates the specified symlink on the device" }, // additional commands from the file system will be included here # include "additional_commands.h"