add syntax to api structures, use them for usage returns, do more checking on valid usage and cleanup some output of api commands.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3001 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris committed 2006-10-08 07:11:42 +00:00
1 parent 2b53e80e34
commit c822f94125
6 files changed
+83 -82

No files matched your search

@@ -69,6 +69,7 @@ static const char modname[] = "mod_spidermonkey";
static int eval_some_js(char *code, JSContext *cx, JSObject *obj, jsval *rval);
static void session_destroy(JSContext *cx, JSObject *obj);
static JSBool session_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
static switch_api_interface_t js_run_interface;
static struct {
size_t gStackChunkSize;
@@ -2675,12 +2676,12 @@ static switch_status_t launch_async(char *text, switch_core_session_t *session,
{
if (switch_strlen_zero(text)) {
stream->write_function(stream, "INVALID");
stream->write_function(stream, "USAGE: %s\n", js_run_interface.syntax);
return SWITCH_STATUS_SUCCESS;
}
js_thread_launch(text);
stream->write_function(stream, "OK");
stream->write_function(stream, "OK\n");
return SWITCH_STATUS_SUCCESS;
}
@@ -2696,7 +2697,7 @@ static switch_api_interface_t js_run_interface = {
/*.interface_name */ "jsrun",
/*.desc */ "run a script",
/*.function */ launch_async,
/*.syntax */ NULL,
/*.syntax */ "jsrun <script>",
/*.next */ NULL
};