diff options
author | Steve Bennett <steveb@workware.net.au> | 2010-01-24 13:46:32 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2010-10-15 11:02:45 +1000 |
commit | ee6dbe0a8d66f8f17a5da82e8dad810d88e33bf6 (patch) | |
tree | 994b59d11b3199f697adaea8303ae8b5dc438397 /jim-syslog.c | |
parent | 541fe7c30691ace08847a35280d9cc8bc02e9a72 (diff) | |
download | jimtcl-ee6dbe0a8d66f8f17a5da82e8dad810d88e33bf6.zip jimtcl-ee6dbe0a8d66f8f17a5da82e8dad810d88e33bf6.tar.gz jimtcl-ee6dbe0a8d66f8f17a5da82e8dad810d88e33bf6.tar.bz2 |
Allow catch to specify what is caught
*: Default to the same as Tcl. Not signal, eval, exit.
*: Use 'catch -exit' to also catch exit.
*: Also map for standard return codes: [info returncodes]
*: Also Jim_ReturnCode()
*: Add Jim_FindByName() for searching in a char* array
*: Fix 'info nameofexectutable' if $::jim_argv0 is not set
Diffstat (limited to 'jim-syslog.c')
-rw-r--r-- | jim-syslog.c | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/jim-syslog.c b/jim-syslog.c index 29f4d9c..18e63a6 100644 --- a/jim-syslog.c +++ b/jim-syslog.c @@ -53,24 +53,6 @@ static const char *priorities[] = { }; /** - * Find a matching name in the array of the given length. - * - * NULL entries are ignored. - * - * Returns the matching index if found, or -1 if not. - */ -static int find_by_name(const char *name, const char *array[], size_t len) -{ - int i; - for (i = 0; i < len; i++) { - if (array[i] && strcmp(array[i], name) == 0) { - return i; - } - } - return -1; -} - -/** * Deletes the syslog command. */ static void Jim_SyslogCmdDelete(Jim_Interp *interp, void *privData) @@ -102,7 +84,7 @@ wrongargs: } while (i < argc-1) { if (Jim_CompareStringImmediate(interp, argv[i], "-facility")) { - int entry = find_by_name(Jim_GetString(argv[i + 1], NULL), facilities, sizeof(facilities) / sizeof(*facilities)); + int entry = Jim_FindByName(Jim_GetString(argv[i + 1], NULL), facilities, sizeof(facilities) / sizeof(*facilities)); if (entry < 0) { Jim_SetResultString(interp, "Unknown facility", -1); return JIM_ERR; @@ -147,7 +129,7 @@ wrongargs: } if (i<argc-1) { - priority = find_by_name(Jim_GetString(argv[i], NULL), priorities, sizeof(priorities) / sizeof(*priorities)); + priority = Jim_FindByName(Jim_GetString(argv[i], NULL), priorities, sizeof(priorities) / sizeof(*priorities)); if (priority < 0) { Jim_SetResultString(interp, "Unknown priority", -1); return JIM_ERR; |