diff options
Diffstat (limited to 'commands/setenv.c')
-rw-r--r-- | commands/setenv.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/commands/setenv.c b/commands/setenv.c index 3cf769d24a..ad26770655 100644 --- a/commands/setenv.c +++ b/commands/setenv.c @@ -5,15 +5,24 @@ #include <command.h> #include <errno.h> #include <environment.h> +#include <complete.h> static int do_setenv(int argc, char *argv[]) { + char *equal; + if (argc < 2) return COMMAND_ERROR_USAGE; - setenv(argv[1], argv[2]); + equal = strrchr(argv[1], '='); + if (equal) { + equal[0] = '\0'; + if (equal[1]) + argv[2] = &equal[1]; + } + - return 0; + return setenv(argv[1], argv[2]) ? COMMAND_ERROR : COMMAND_SUCCESS; } BAREBOX_CMD_HELP_START(setenv) @@ -26,5 +35,6 @@ BAREBOX_CMD_START(setenv) BAREBOX_CMD_DESC("set environment variable") BAREBOX_CMD_OPTS("NAME [VALUE]") BAREBOX_CMD_GROUP(CMD_GRP_ENV) + BAREBOX_CMD_COMPLETE(env_param_noeval_complete) BAREBOX_CMD_HELP(cmd_setenv_help) BAREBOX_CMD_END |