summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Leeds <randall@apache.org>2011-10-02 14:04:27 -0700
committerRandall Leeds <randall@apache.org>2011-10-02 14:08:12 -0700
commitf2211f21f2da9bf78845d3da6d6cb784dd8f1464 (patch)
treed616a44c61fe6801af0323cb73c45c24faecde0d
parent76d90953bb6e16aec214549d5719b6b7e5fbedfc (diff)
fix couchjs help language and use short options
-rw-r--r--src/couchdb/priv/couch_js/help.h12
-rw-r--r--src/couchdb/priv/couch_js/util.c21
-rw-r--r--test/javascript/run.tpl2
3 files changed, 12 insertions, 23 deletions
diff --git a/src/couchdb/priv/couch_js/help.h b/src/couchdb/priv/couch_js/help.h
index e7c3af0e..84c83c06 100644
--- a/src/couchdb/priv/couch_js/help.h
+++ b/src/couchdb/priv/couch_js/help.h
@@ -46,12 +46,12 @@ static const char USAGE_TEMPLATE[] =
"\n"
"Options:\n"
"\n"
- " -h, --help display a short help message and exit\n"
- " -V, --version display version information and exit\n"
- " -H, --http install %s cURL bindings (only avaiable\n"
- " if package was built with cURL available)\n"
- " --stack-size=SIZE specify that the interpreter should set the\n"
- " the stack quota for JS contexts to SIZE bytes\n"
+ " -h display a short help message and exit\n"
+ " -V display version information and exit\n"
+ " -H enable %s cURL bindings (only avaiable\n"
+ " if package was built with cURL available)\n"
+ " -S SIZE specify that the interpreter should set the\n"
+ " the stack quota for JS contexts to SIZE bytes\n"
"\n"
"Report bugs at <%s>.\n";
diff --git a/src/couchdb/priv/couch_js/util.c b/src/couchdb/priv/couch_js/util.c
index ab1295f8..3076856a 100644
--- a/src/couchdb/priv/couch_js/util.c
+++ b/src/couchdb/priv/couch_js/util.c
@@ -80,27 +80,16 @@ couch_parse_args(int argc, const char* argv[])
args->stack_size = 8L * 1024L;
while(i < argc) {
- if(strcmp("-h", argv[i]) == 0 ||
- strcmp("--help", argv[i]) == 0) {
+ if(strcmp("-h", argv[i]) == 0) {
DISPLAY_USAGE;
exit(0);
- } else if(strcmp("-V", argv[i]) == 0 ||
- strcmp("--version", argv[i]) == 0) {
+ } else if(strcmp("-V", argv[i]) == 0) {
DISPLAY_VERSION;
exit(0);
- } else if(strcmp("-H", argv[i]) == 0 ||
- strcmp("--http", argv[i]) == 0) {
+ } else if(strcmp("-H", argv[i]) == 0) {
args->use_http = 1;
- } else if(strncmp("--stack-size", argv[i], 12) == 0) {
- if(argv[i][12] == '\0') {
- args->stack_size = atoi(argv[++i]);
- } else if(argv[i][12] == '=') {
- args->stack_size = atoi(argv[i]+13);
- } else {
- DISPLAY_USAGE;
- exit(2);
- }
-
+ } else if(strcmp("-S", argv[i]) == 0) {
+ args->stack_size = atoi(argv[++i]);
if(args->stack_size <= 0) {
fprintf(stderr, "Invalid stack size.\n");
exit(2);
diff --git a/test/javascript/run.tpl b/test/javascript/run.tpl
index 1389a4f9..5f971581 100644
--- a/test/javascript/run.tpl
+++ b/test/javascript/run.tpl
@@ -27,4 +27,4 @@ cat $SCRIPT_DIR/json2.js \
$SCRIPT_DIR/test/*.js \
$JS_TEST_DIR/couch_http.js \
$JS_TEST_DIR/cli_runner.js \
- | $COUCHJS --http -
+ | $COUCHJS -H -