diff --git a/src/modules/c/shell/cmds/bench.c b/src/modules/c/shell/cmds/bench.c index b9e4ba5..0752dbc 100644 --- a/src/modules/c/shell/cmds/bench.c +++ b/src/modules/c/shell/cmds/bench.c @@ -43,8 +43,6 @@ #ifdef CONFIG_SHELL_BUILTIN_ONLY int shell_command_bench(int argc, char* argv[], const char* args) #else - #define _USE_START_ - #include "init.h" int main(int argc, char* argv[]) #endif { diff --git a/src/modules/c/shell/cmds/bincat.c b/src/modules/c/shell/cmds/bincat.c index d7e0eed..8c0372e 100644 --- a/src/modules/c/shell/cmds/bincat.c +++ b/src/modules/c/shell/cmds/bincat.c @@ -46,8 +46,6 @@ void bincat_display_usage(void); #ifdef CONFIG_SHELL_BUILTIN_ONLY int shell_command_bincat(int argc, char* argv[], const char* args) #else - #define _USE_START_ - #include "init.h" int main(int argc, char* argv[]) #endif { diff --git a/src/modules/c/shell/cmds/cat.c b/src/modules/c/shell/cmds/cat.c index 65993d9..ffa70ce 100644 --- a/src/modules/c/shell/cmds/cat.c +++ b/src/modules/c/shell/cmds/cat.c @@ -46,8 +46,6 @@ void cat_display_usage(void); #ifdef CONFIG_SHELL_BUILTIN_ONLY int shell_command_cat(int argc, char* argv[], const char* args) #else - #define _USE_START_ - #include "init.h" int main(int argc, char* argv[]) #endif { diff --git a/src/modules/c/shell/cmds/cp.c b/src/modules/c/shell/cmds/cp.c index 7df88fb..2c1ada5 100644 --- a/src/modules/c/shell/cmds/cp.c +++ b/src/modules/c/shell/cmds/cp.c @@ -50,8 +50,6 @@ void cp_display_usage(void); #ifdef CONFIG_SHELL_BUILTIN_ONLY int shell_command_cp(int argc, char* argv[], const char* args) #else - #define _USE_START_ - #include "init.h" int main(int argc, char* argv[]) #endif { diff --git a/src/modules/c/shell/cmds/date.c b/src/modules/c/shell/cmds/date.c index 21ee6a5..6fa4a37 100644 --- a/src/modules/c/shell/cmds/date.c +++ b/src/modules/c/shell/cmds/date.c @@ -43,8 +43,6 @@ void date_display_usage(void); #ifdef CONFIG_SHELL_BUILTIN_ONLY int shell_command_date(int argc, char* argv[], const char* args) #else - #define _USE_START_ - #include "init.h" int main(int argc, char* argv[]) #endif { diff --git a/src/modules/c/shell/cmds/dbg_st.c b/src/modules/c/shell/cmds/dbg_st.c index c43222e..53e2246 100644 --- a/src/modules/c/shell/cmds/dbg_st.c +++ b/src/modules/c/shell/cmds/dbg_st.c @@ -46,8 +46,6 @@ void dbg_st_display_usage(void); #ifdef CONFIG_SHELL_BUILTIN_ONLY int shell_command_dbg_st(int argc, char* argv[], const char* args) #else - #define _USE_START_ - #include "init.h" int main(int argc, char* argv[]) #endif { diff --git a/src/modules/c/shell/cmds/echo.c b/src/modules/c/shell/cmds/echo.c index d18bdf9..fdb42b7 100644 --- a/src/modules/c/shell/cmds/echo.c +++ b/src/modules/c/shell/cmds/echo.c @@ -41,8 +41,6 @@ #ifdef CONFIG_SHELL_BUILTIN_ONLY int shell_command_echo(int argc, char* argv[], const char* args) #else - #define _USE_START_ - #include "init.h" int main(int argc, char* argv[]) #endif { diff --git a/src/modules/c/shell/cmds/free.c b/src/modules/c/shell/cmds/free.c index 9c5d2eb..20bdf28 100644 --- a/src/modules/c/shell/cmds/free.c +++ b/src/modules/c/shell/cmds/free.c @@ -41,8 +41,6 @@ #ifdef CONFIG_SHELL_BUILTIN_ONLY int shell_command_free(int argc, char* argv[], const char* args) #else - #define _USE_START_ - #include "init.h" int main(int argc, char* argv[]) #endif { diff --git a/src/modules/c/shell/cmds/irc.c b/src/modules/c/shell/cmds/irc.c index bdc6780..7121da6 100644 --- a/src/modules/c/shell/cmds/irc.c +++ b/src/modules/c/shell/cmds/irc.c @@ -51,8 +51,6 @@ FILE* connection; #ifdef CONFIG_SHELL_BUILTIN_ONLY int shell_command_irc(int argc, char* argv[], const char* args) #else - #define _USE_START_ - #include "init.h" int main(int argc, char* argv[]) #endif { diff --git a/src/modules/c/shell/cmds/ln.c b/src/modules/c/shell/cmds/ln.c index 3bf2ac8..29f5435 100644 --- a/src/modules/c/shell/cmds/ln.c +++ b/src/modules/c/shell/cmds/ln.c @@ -45,8 +45,6 @@ void ln_display_usage(void); #ifdef CONFIG_SHELL_BUILTIN_ONLY int shell_command_ln(int argc, char* argv[], const char* args) #else - #define _USE_START_ - #include "init.h" int main(int argc, char* argv[]) #endif { diff --git a/src/modules/c/shell/cmds/ls.c b/src/modules/c/shell/cmds/ls.c index 10755a4..195f769 100644 --- a/src/modules/c/shell/cmds/ls.c +++ b/src/modules/c/shell/cmds/ls.c @@ -45,8 +45,6 @@ void ls_display_usage(void); #ifdef CONFIG_SHELL_BUILTIN_ONLY int shell_command_ls(int argc, char* argv[], const char* args) #else - #define _USE_START_ - #include "init.h" int main(int argc, char* argv[]) #endif { diff --git a/src/modules/c/shell/cmds/mkdir.c b/src/modules/c/shell/cmds/mkdir.c index b18439e..5c2abd3 100644 --- a/src/modules/c/shell/cmds/mkdir.c +++ b/src/modules/c/shell/cmds/mkdir.c @@ -45,8 +45,6 @@ void mkdir_display_usage(void); #ifdef CONFIG_SHELL_BUILTIN_ONLY int shell_command_mkdir(int argc, char* argv[], const char* args) #else - #define _USE_START_ - #include "init.h" int main(int argc, char* argv[]) #endif { diff --git a/src/modules/c/shell/cmds/pipe.c b/src/modules/c/shell/cmds/pipe.c index de01b65..4c1162a 100644 --- a/src/modules/c/shell/cmds/pipe.c +++ b/src/modules/c/shell/cmds/pipe.c @@ -44,8 +44,6 @@ void pipe_display_usage(void); #ifdef CONFIG_SHELL_BUILTIN_ONLY int shell_command_pipe(int argc, char* argv[], const char* args) #else - #define _USE_START_ - #include "init.h" int main(int argc, char* argv[]) #endif { diff --git a/src/modules/c/shell/cmds/ps.c b/src/modules/c/shell/cmds/ps.c index 4fc780a..e6ffe3b 100644 --- a/src/modules/c/shell/cmds/ps.c +++ b/src/modules/c/shell/cmds/ps.c @@ -45,8 +45,6 @@ void ps_display_usage(void); #ifdef CONFIG_SHELL_BUILTIN_ONLY int shell_command_ps(int argc, char* argv[], const char* args) #else - #define _USE_START_ - #include "init.h" int main(int argc, char* argv[]) #endif { diff --git a/src/modules/c/shell/cmds/pstree.c b/src/modules/c/shell/cmds/pstree.c index fde9c86..d6f63dd 100644 --- a/src/modules/c/shell/cmds/pstree.c +++ b/src/modules/c/shell/cmds/pstree.c @@ -46,8 +46,6 @@ task_info_t* task_info; #ifdef CONFIG_SHELL_BUILTIN_ONLY int shell_command_pstree(int argc, char* argv[], const char* args) #else - #define _USE_START_ - #include "init.h" int main(int argc, char* argv[]) #endif { diff --git a/src/modules/c/shell/cmds/pwd.c b/src/modules/c/shell/cmds/pwd.c index 3011c5a..00315ee 100644 --- a/src/modules/c/shell/cmds/pwd.c +++ b/src/modules/c/shell/cmds/pwd.c @@ -44,8 +44,6 @@ void pwd_display_usage(void); #ifdef CONFIG_SHELL_BUILTIN_ONLY int shell_command_pwd(int argc, char* argv[], const char* args) #else - #define _USE_START_ - #include "init.h" int main(int argc, char* argv[]) #endif { diff --git a/src/modules/c/shell/cmds/readlink.c b/src/modules/c/shell/cmds/readlink.c index 35535e0..2c31bd3 100644 --- a/src/modules/c/shell/cmds/readlink.c +++ b/src/modules/c/shell/cmds/readlink.c @@ -45,8 +45,6 @@ void readlink_display_usage(void); #ifdef CONFIG_SHELL_BUILTIN_ONLY int shell_command_readlink(int argc, char* argv[], const char* args) #else - #define _USE_START_ - #include "init.h" int main(int argc, char* argv[]) #endif { diff --git a/src/modules/c/shell/cmds/rm.c b/src/modules/c/shell/cmds/rm.c index efddfbd..a9d160f 100644 --- a/src/modules/c/shell/cmds/rm.c +++ b/src/modules/c/shell/cmds/rm.c @@ -45,8 +45,6 @@ void rm_display_usage(void); #ifdef CONFIG_SHELL_BUILTIN_ONLY int shell_command_rm(int argc, char* argv[], const char* args) #else - #define _USE_START_ - #include "init.h" int main(int argc, char* argv[]) #endif { diff --git a/src/modules/c/shell/cmds/sleep.c b/src/modules/c/shell/cmds/sleep.c index 9c8f007..7b88141 100644 --- a/src/modules/c/shell/cmds/sleep.c +++ b/src/modules/c/shell/cmds/sleep.c @@ -44,8 +44,6 @@ void sleep_display_usage(void); #ifdef CONFIG_SHELL_BUILTIN_ONLY int shell_command_sleep(int argc, char* argv[], const char* args) #else - #define _USE_START_ - #include "init.h" int main(int argc, char* argv[]) #endif { diff --git a/src/modules/c/shell/cmds/stat.c b/src/modules/c/shell/cmds/stat.c index c4a7bc7..af47c4b 100644 --- a/src/modules/c/shell/cmds/stat.c +++ b/src/modules/c/shell/cmds/stat.c @@ -46,8 +46,6 @@ void stat_display_results(const char* path, struct stat* stat_buf); #ifdef CONFIG_SHELL_BUILTIN_ONLY int shell_command_stat(int argc, char* argv[], const char* args) #else - #define _USE_START_ - #include "init.h" int main(int argc, char* argv[]) #endif { diff --git a/src/modules/c/shell/cmds/symlink.c b/src/modules/c/shell/cmds/symlink.c index 0116788..01e40a6 100644 --- a/src/modules/c/shell/cmds/symlink.c +++ b/src/modules/c/shell/cmds/symlink.c @@ -45,8 +45,6 @@ void symlink_display_usage(void); #ifdef CONFIG_SHELL_BUILTIN_ONLY int shell_command_symlink(int argc, char* argv[], const char* args) #else - #define _USE_START_ - #include "init.h" int main(int argc, char* argv[]) #endif { diff --git a/src/modules/c/shell/commmands.c b/src/modules/c/shell/commmands.c index 25d0cb7..82ec008 100644 --- a/src/modules/c/shell/commmands.c +++ b/src/modules/c/shell/commmands.c @@ -45,6 +45,7 @@ #include #include #include +#include //Hier koennen die Debug-Nachrichten aktiviert werden @@ -255,3 +256,46 @@ int shell_command_clear(int argc, char* argv[], const char* args) return 0; } +void set_display_usage(void); +void set_list_vars(void); + +int shell_command_set(int argc, char* argv[], const char* args) +{ + + switch (argc) { + case 1: + set_list_vars(); + break; + + case 2: + unsetenv(argv[1]); + break; + + case 3: + setenv(argv[1], argv[2], 1); + break; + + default: + set_display_usage(); + return EXIT_FAILURE; + } + + + return EXIT_SUCCESS; +} + +void set_list_vars() +{ + int i, cnt; + + cnt = getenv_count(); + for (i = 0; i < cnt; i++) { + printf("%s = %s\n", getenv_name_by_index(i), getenv_index(i)); + } +} + +void set_display_usage() +{ + puts("\nAufruf: set [ []]\n"); +} + diff --git a/src/modules/c/shell/cmds/set.c b/src/modules/c/shell/cmds/set.c deleted file mode 100644 index 528ecca..0000000 --- a/src/modules/c/shell/cmds/set.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2008 The tyndur Project. All rights reserved. - * - * This code is derived from software contributed to the tyndur Project - * by Kevin Wolf. - * - * 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 tyndur Project - * and its contributors. - * 4. Neither the name of the tyndur 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 - -#include "types.h" -#include "stdlib.h" -#include "stdio.h" -#include "dir.h" -#include "unistd.h" -#include - -void set_display_usage(void); -void set_list_vars(void); - -int shell_command_set(int argc, char* argv[], const char* args) -{ - - switch (argc) { - case 1: - set_list_vars(); - break; - - case 2: - unsetenv(argv[1]); - break; - - case 3: - setenv(argv[1], argv[2], 1); - break; - - default: - set_display_usage(); - return EXIT_FAILURE; - } - - - return EXIT_SUCCESS; -} - -void set_list_vars() -{ - int i, cnt; - - cnt = getenv_count(); - for (i = 0; i < cnt; i++) { - printf("%s = %s\n", getenv_name_by_index(i), getenv_index(i)); - } -} - -void set_display_usage() -{ - puts("\nAufruf: set [ []]\n"); -} -