Index: src/modules/c/shell/shell.h =================================================================== --- src/modules/c/shell/shell.h (Revision 622) +++ src/modules/c/shell/shell.h (Arbeitskopie) @@ -62,6 +62,8 @@ int shell_command_symlink(int argc, char* argv[], const char* args); int shell_command_dbg_st(int argc, char* argv[], const char* args); int shell_command_cp(int argc, char* argv[], const char* args); + int shell_command_link(int argc, char* argv[], const char* args); + int shell_command_unlink(int argc, char* argv[], const char* args); #endif #endif Index: src/modules/c/shell/shell.c =================================================================== --- src/modules/c/shell/shell.c (Revision 622) +++ src/modules/c/shell/shell.c (Arbeitskopie) @@ -91,6 +91,8 @@ {"symlink", &shell_command_symlink}, {"dbg_st", &shell_command_dbg_st}, {"cp", &shell_command_cp}, + {"link", &shell_command_link}, + {"unlink", &shell_command_unlink} #endif }; Index: src/modules/c/shell/cmds/unlink.c =================================================================== --- src/modules/c/shell/cmds/unlink.c (Revision 0) +++ src/modules/c/shell/cmds/unlink.c (Revision 0) @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2007 The LOST Project. All rights reserved. + * + * This code is derived from software contributed to the LOST Project + * by Antoine Kaufmann. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the LOST Project + * and its contributors. + * 4. Neither the name of the LOST Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "types.h" +#include "stdlib.h" +#include "stdio.h" +#include "unistd.h" +#include "dir.h" +#include "config.h" + +void unlink_display_usage(); + +#ifdef CONFIG_SHELL_BUILTIN_ONLY + int shell_command_unlink(int argc, char* argv[], const char* args) +#else + #define _USE_START_ + #include "init.h" + int main(int argc, char* argv[]) +#endif +{ + if (argc != 2) { + unlink_display_usage(); + return -1; + } + + int result = io_remove_link(argv[1]); + + if (result != 0) { + puts("Fehler beim Loeschen des Links"); + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} + +void unlink_display_usage() +{ + puts("\nAufruf: unlink "); + puts("\nHardlink an loeschen. Falls es sich um den Letzten " + "handelt, wird die Datei/das Verzeichnis geloescht."); +} + Index: src/modules/c/shell/cmds/link.c =================================================================== --- src/modules/c/shell/cmds/link.c (Revision 0) +++ src/modules/c/shell/cmds/link.c (Revision 0) @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2007 The LOST Project. All rights reserved. + * + * This code is derived from software contributed to the LOST Project + * by Antoine Kaufmann. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the LOST Project + * and its contributors. + * 4. Neither the name of the LOST Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "types.h" +#include "stdlib.h" +#include "stdio.h" +#include "unistd.h" +#include "dir.h" +#include "config.h" + +void link_display_usage(); + +#ifdef CONFIG_SHELL_BUILTIN_ONLY + int shell_command_link(int argc, char* argv[], const char* args) +#else + #define _USE_START_ + #include "init.h" + int main(int argc, char* argv[]) +#endif +{ + if (argc != 3) { + link_display_usage(); + return -1; + } + + int result = io_create_link(argv[1], argv[2], TRUE); + + if (result != 0) { + puts("Fehler beim Anlegen des Links"); + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} + +void link_display_usage() +{ + puts("\nAufruf: link "); + puts("\nHardlink zur Datei/zum Verzeichnis an " + "erstellen"); +} +