[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[tyndur-devel] [PATCH 3/3] shell: Teilweise englische Übersetzung
+ shell: Angefangene Übersetzung ins Englische (commmands.c mit Ausnahme
der Ausgabe von help)
Signed-off-by: Kevin Wolf <kevin@xxxxxxxxxx>
---
src/modules/c/shell/Makefile.all | 4 +-
src/modules/c/shell/commmands.c | 64 ++++++++++++++++++-------------
src/modules/c/shell/lang/lang_en.c | 75 ++++++++++++++++++++++++++++++++++++
src/modules/c/shell/lang/resstr.h | 41 +++++++++++++++++++
src/modules/c/shell/shell.c | 3 +
5 files changed, 158 insertions(+), 29 deletions(-)
create mode 100644 src/modules/c/shell/lang/lang_en.c
create mode 100644 src/modules/c/shell/lang/resstr.h
diff --git a/src/modules/c/shell/Makefile.all b/src/modules/c/shell/Makefile.all
index dcf40c0..e2d67da 100644
--- a/src/modules/c/shell/Makefile.all
+++ b/src/modules/c/shell/Makefile.all
@@ -5,9 +5,9 @@ echo "LD $1/apps/sh"
if [ -z "`grep '#define CONFIG_SHELL_BUILTIN_ONLY' ../../../include/lost/config.h`" ];
then
- $LOST_TOOLS_LD -osh $LDSCRIPT *.o --start-group $2 --end-group
+ $LOST_TOOLS_LD -osh $LDSCRIPT *.o lang/*.o --start-group $2 --end-group
else
- $LOST_TOOLS_LD -osh $LDSCRIPT *.o cmds/*.o --start-group $2 --end-group
+ $LOST_TOOLS_LD -osh $LDSCRIPT *.o lang/*.o cmds/*.o --start-group $2 --end-group
fi
$LOST_TOOLS_STRIP -s sh -o $1/apps/sh
diff --git a/src/modules/c/shell/commmands.c b/src/modules/c/shell/commmands.c
index d2ef5ba..4b2e748 100644
--- a/src/modules/c/shell/commmands.c
+++ b/src/modules/c/shell/commmands.c
@@ -48,6 +48,9 @@
#include <io.h>
#include <env.h>
+#define TMS_MODULE cmd
+#include <tms.h>
+
#include <lost/config.h>
@@ -111,7 +114,7 @@ int shell_command_default(int argc, char* argv[], const char* cmd)
return 0;
}
- puts("Befehl wurde nicht gefunden!");
+ puts(TMS(exec_not_found, "Befehl wurde nicht gefunden!"));
return -1;
}
@@ -124,7 +127,7 @@ int shell_command_start(int argc, char* argv[], const char* cmd)
DEBUG_MSG("start");
if (argc < 2) {
- puts("Aufruf: start <Pfad> [Argumente ...]");
+ puts(TMS(start_usage, "Aufruf: start <Pfad> [Argumente ...]"));
return -1;
}
@@ -135,9 +138,9 @@ int shell_command_start(int argc, char* argv[], const char* cmd)
if (shell_start_path_app(program, false) == 0) {
return 0;
- }
-
- puts("Befehl wurde nicht gefunden!");
+ }
+
+ puts(TMS(start_not_found, "Befehl wurde nicht gefunden!"));
return -1;
}
@@ -236,35 +239,41 @@ int shell_command_exit(int argc, char* argv[], const char* args)
int shell_command_cd(int argc, char* argv[], const char* args)
{
char* cd_args = strchr(args, ' ');
+ char* path;
+ DIR* dir;
if (cd_args == NULL) {
- puts("Aufruf: cd <Verzeichnis>");
- return -1;
- } else {
- cd_args++;
- char* path = io_get_absolute_path(cd_args);
- if (path == NULL) {
- puts("Aufruf: cd <Verzeichnis>");
- return -1;
- }
+ goto usage;
+ }
- DIR* dir = opendir(path);
- if (dir == NULL) {
- printf("Wechseln in das Verzeichnis '%s' nicht moeglich\n", path);
- } else {
- chdir(path);
- closedir(dir);
- }
- free(path);
+ cd_args++;
+ path = io_get_absolute_path(cd_args);
+ if (path == NULL) {
+ goto usage;
+ }
+
+ dir = opendir(path);
+ if (dir == NULL) {
+ printf(TMS(cd_error, "Wechseln in das Verzeichnis '%s' "
+ "nicht moeglich\n"), path);
+ } else {
+ chdir(path);
+ closedir(dir);
}
+ free(path);
+
return 0;
+
+usage:
+ puts(TMS(cd_usage, "Aufruf: cd <Verzeichnis>"));
+ return -1;
}
int shell_command_source(int argc, char* argv[], const char* args)
{
const char* path;
if (argc != 2) {
- puts("Aufruf: source <Pfad>");
+ puts(TMS(source_usage, "Aufruf: source <Pfad>"));
return -1;
}
@@ -272,7 +281,8 @@ int shell_command_source(int argc, char* argv[], const char* args)
if (shell_script(path)) {
return 0;
} else {
- printf("Ausfuehren des Skripts '%s' fehlgeschlagen.\n", path);
+ printf(TMS(source_error, "Ausfuehren des Skripts '%s' "
+ "fehlgeschlagen.\n"), path);
return -1;
}
}
@@ -337,8 +347,8 @@ void set_list_vars()
void set_display_usage()
{
- puts("\nAufruf: set [-d] [<Variable> [<Wert>]]");
- puts(" -d: Defaultwert setzen. Wenn die Variable schon gesetzt ist, wird "
- "ihr Wert\n nicht geändert.\n");
+ puts(TMS(set_usage, "\nAufruf: set [-d] [<Variable> [<Wert>]]\n"
+ " -d: Defaultwert setzen. Wenn die Variable schon gesetzt ist, wird "
+ "ihr Wert\n nicht geändert.\n"));
}
diff --git a/src/modules/c/shell/lang/lang_en.c b/src/modules/c/shell/lang/lang_en.c
new file mode 100644
index 0000000..d9cb5fe
--- /dev/null
+++ b/src/modules/c/shell/lang/lang_en.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2009 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.
+ *
+ * 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 <tms.h>
+#include "resstr.h"
+
+static int get_number(int n)
+{
+ return (n == 1 ? 0 : 1);
+}
+
+static const struct tms_strings dict[] = {
+ &__tms_cmd_exec_not_found,
+ "Command not found",
+
+ &__tms_cmd_start_not_found,
+ "Executable not found",
+
+ &__tms_cmd_start_usage,
+ "Usage: start <path> [arguments ...]",
+
+ &__tms_cmd_cd_error,
+ "Cannot change to directory '%s'\n",
+
+ &__tms_cmd_cd_usage,
+ "Usage: cd <directory>",
+
+ &__tms_cmd_source_error,
+ "Cannot execute script '%s'\n",
+
+ &__tms_cmd_source_usage,
+ "Usage: source <path>",
+
+ &__tms_cmd_set_usage,
+ "\nUsage: set [-d] [<variable>] [<value>]\n"
+ " -d: Set a default value. If the variable is already set, its value is\n"
+ " not changed\n",
+
+ 0,
+ 0,
+};
+
+static const struct tms_lang lang = {
+ .lang = "en",
+ .numbers = 2,
+ .get_number = get_number,
+ .strings = dict,
+};
+
+LANGUAGE(&lang)
diff --git a/src/modules/c/shell/lang/resstr.h b/src/modules/c/shell/lang/resstr.h
new file mode 100644
index 0000000..073a262
--- /dev/null
+++ b/src/modules/c/shell/lang/resstr.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2009 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.
+ *
+ * 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.
+ */
+
+#ifndef RESSTR_H
+#define RESSTR_H
+
+extern void* __tms_cmd_exec_not_found;
+extern void* __tms_cmd_start_not_found;
+extern void* __tms_cmd_start_usage;
+extern void* __tms_cmd_cd_error;
+extern void* __tms_cmd_cd_usage;
+extern void* __tms_cmd_source_error;
+extern void* __tms_cmd_source_usage;
+extern void* __tms_cmd_set_usage;
+
+#endif
diff --git a/src/modules/c/shell/shell.c b/src/modules/c/shell/shell.c
index f9d57f8..07cde7a 100644
--- a/src/modules/c/shell/shell.c
+++ b/src/modules/c/shell/shell.c
@@ -47,6 +47,7 @@
#include <lost/config.h>
#include <sleep.h>
#include <env.h>
+#include <tms.h>
#include <readline/readline.h>
#include <readline/history.h>
@@ -107,6 +108,8 @@ shell_command_t shell_commands[] = {
int main(int argc, char* argv[])
{
+ tms_init();
+
// Startskript ausfuehren
shell_script("file:/config/shell/start.lsh");
--
1.6.0.2