more error message cleanup. invalid args & syntax errors both now print arguments...
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Thu, 24 Jul 2008 14:50:41 +0000 (14:50 +0000)
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Thu, 24 Jul 2008 14:50:41 +0000 (14:50 +0000)
git-svn-id: svn://svn.berlios.de/openocd/trunk@870 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/helper/command.c
src/helper/log.h

index ada745f2ae3dbeb8e6539533e809715a544e6c22..5ac57a1e2ff47083b7544049a7486870a11af019 100644 (file)
@@ -78,7 +78,7 @@ static int script_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
        for (i = 0; i < argc; i++)
        {
                int len;
-               char *w=Jim_GetString(argv[i], &len);
+               const char *w=Jim_GetString(argv[i], &len);
                if (*w=='#')
                {
                        /* hit an end of line comment */
@@ -539,7 +539,6 @@ static size_t openocd_jim_fwrite(const void *_ptr, size_t size, size_t n, void *
        size_t nbytes;
        const char *ptr;
        Jim_Interp *interp;
-       command_context_t *context;
 
        /* make it a char easier to read code */
        ptr = _ptr;
@@ -549,19 +548,11 @@ static size_t openocd_jim_fwrite(const void *_ptr, size_t size, size_t n, void *
                return 0;
        }
 
-       context = Jim_GetAssocData(interp, "context");
-       if (context == NULL)
-       {
-               LOG_ERROR("openocd_jim_fwrite: no command context");
-               /* TODO: Where should this go? */               
-               return n;
-       }
-
        /* do we have to chunk it? */
        if (ptr[nbytes] == 0)
        {
                /* no it is a C style string */
-               command_output_text(context, ptr);
+               LOG_USER_N("%s", ptr);
                return strlen(ptr);
        }
        /* GRR we must chunk - not null terminated */
@@ -578,7 +569,7 @@ static size_t openocd_jim_fwrite(const void *_ptr, size_t size, size_t n, void *
                /* terminate it */
                chunk[n] = 0;
                /* output it */
-               command_output_text(context, chunk);
+               LOG_USER_N("%s", chunk);
                ptr += x;
                nbytes -= x;
        }
@@ -597,24 +588,16 @@ static int openocd_jim_vfprintf(void *cookie, const char *fmt, va_list ap)
        char *cp;
        int n;
        Jim_Interp *interp;
-       command_context_t *context;
 
        n = -1;
        interp = cookie;
        if (interp == NULL)
                return n;
 
-       context = Jim_GetAssocData(interp, "context");
-       if (context == NULL)
-       {
-               LOG_ERROR("openocd_jim_vfprintf: no command context");
-               return n;
-       }
-
        cp = alloc_vprintf(fmt, ap);
        if (cp)
        {
-               command_output_text(context, cp);
+               LOG_USER_N("%s", cp);
                n = strlen(cp);
                free(cp);
        }
index 7a7c90cbc462678afe690aa3188074bac4f133f1..afe5da893ca2f156a4d4d570f42f7c92b7178a39 100644 (file)
@@ -109,10 +109,10 @@ extern int debug_level;
  * error codes < 100
  */
 #define ERROR_OK                                       (0)
-#define ERROR_INVALID_ARGUMENTS                (-1)
+#define ERROR_INVALID_ARGUMENTS                ERROR_COMMAND_SYNTAX_ERROR
 #define ERROR_NO_CONFIG_FILE           (-2)
 #define ERROR_BUF_TOO_SMALL                    (-3)
-/* see "Error:" message for meaningful message to the user. The caller should 
+/* see "Error:" log entry for meaningful message to the user. The caller should 
  * make no assumptions about what went wrong and try to handle the problem.
  */
 #define ERROR_FAIL                             (-4)

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)