log noise reduction
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Wed, 6 May 2009 11:22:30 +0000 (11:22 +0000)
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Wed, 6 May 2009 11:22:30 +0000 (11:22 +0000)
git-svn-id: svn://svn.berlios.de/openocd/trunk@1613 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/jtag/zy1000.c

index 7911a5efb6c6ca656380cf58ff8d86490cb02651..f2765c0b60934c37932797a45d5326202b2ab497 100644 (file)
@@ -285,37 +285,43 @@ int handle_power_command(struct command_context_s *cmd_ctx, char *cmd, char **ar
 
 
 /* Give TELNET a way to find out what version this is */
-int handle_zy1000_version_command(struct command_context_s *cmd_ctx, char *cmd,
-               char **args, int argc)
+static int jim_zy1000_version(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 {
-       if (argc > 1)
-       {
-               return ERROR_COMMAND_SYNTAX_ERROR;
-       }
-       if (argc == 0)
-       {
-               command_print(cmd_ctx, ZYLIN_OPENOCD_VERSION);
-       }
-       else if (strcmp("openocd", args[0]) == 0)
-       {
-               int revision;
-               revision = atol(ZYLIN_OPENOCD+strlen("XRevision: "));
-               command_print(cmd_ctx, "%d", revision);
-       }
-       else if (strcmp("zy1000", args[0]) == 0)
-       {
-               command_print(cmd_ctx, "%s", ZYLIN_VERSION);
-       }
-       else if (strcmp("date", args[0]) == 0)
+       if ((argc < 1) || (argc > 2))
+               return JIM_ERR;
+       char buff[128];
+       const char *version_str=NULL;
+
+       if (argc == 1)
        {
-               command_print(cmd_ctx, "%s", ZYLIN_DATE);
-       }
-       else
+               version_str=ZYLIN_OPENOCD_VERSION;
+       } else
        {
-               return ERROR_COMMAND_SYNTAX_ERROR;
+               const char *str = Jim_GetString(argv[1], NULL);
+               if (strcmp("openocd", str) == 0)
+               {
+                       int revision;
+                       revision = atol(ZYLIN_OPENOCD+strlen("XRevision: "));
+                       sprintf(buff, "%d", revision);
+                       version_str=buff;
+               }
+               else if (strcmp("zy1000", str) == 0)
+               {
+                       version_str=ZYLIN_VERSION;
+               }
+               else if (strcmp("date", str) == 0)
+               {
+                       version_str=ZYLIN_DATE;
+               }
+               else
+               {
+                       return JIM_ERR;
+               }
        }
 
-       return ERROR_OK;
+       Jim_SetResult(interp, Jim_NewStringObj(interp, version_str, -1));
+
+       return JIM_OK;
 }
 
 
@@ -342,8 +348,9 @@ int zy1000_register_commands(struct command_context_s *cmd_ctx)
 {
        register_command(cmd_ctx, NULL, "power", handle_power_command, COMMAND_ANY,
                        "power <on/off> - turn power switch to target on/off. No arguments - print status.");
-       register_command(cmd_ctx, NULL, "zy1000_version", handle_zy1000_version_command,
-                       COMMAND_EXEC, "show zy1000 version numbers");
+
+       Jim_CreateCommand(interp, "zy1000_version", jim_zy1000_version, NULL, NULL);
+
 
        Jim_CreateCommand(interp, "powerstatus", zylinjtag_Jim_Command_powerstatus, NULL, NULL);
 

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)