[Freeswitch-svn] [commit] r6011 - freeswitch/trunk/src

Freeswitch SVN mikej at freeswitch.org
Sat Oct 20 02:46:16 EDT 2007


Author: mikej
Date: Sat Oct 20 02:46:16 2007
New Revision: 6011

Modified:
   freeswitch/trunk/src/switch.c

Log:
Make script_dir setting on command line FSCORE-48
cleanup the usage string

Modified: freeswitch/trunk/src/switch.c
==============================================================================
--- freeswitch/trunk/src/switch.c	(original)
+++ freeswitch/trunk/src/switch.c	Sat Oct 20 02:46:16 2007
@@ -221,28 +221,24 @@
 		{SERVICENAME, &service_main},
 		{NULL, NULL}
 	};
+#endif
 	usageDesc = "these are the optional arguments you can pass to freeswitch\n"
+#ifdef WIN32
 		"\t-service         -- start freeswitch as a service, cannot be used if loaded as a console app\n"
 		"\t-install         -- install freeswitch as a service\n"
 		"\t-uninstall       -- remove freeswitch as a service\n"
-		"\t-hp              -- enable high priority settings\n"
-		"\t-nosql           -- disable internal sql scoreboard\n"
-		"\t-stop            -- stop freeswitch\n"
-		"\t-nc              -- do not output to a console and background\n"
-		"\t-conf [confdir]  -- specify an alternate config dir\n"
-		"\t-log [logdir]    -- specify an alternate log dir\n" "\t-db [dbdir]      -- specify an alternate db dir\n";
 #else
-	usageDesc = "these are the optional arguments you can pass to freeswitch\n"
-		"\t-help            -- this message\n"
 		"\t-nf              -- no forking\n"
+#endif
+		"\t-help            -- this message\n"
 		"\t-hp              -- enable high priority settings\n"
 		"\t-nosql           -- disable internal sql scoreboard\n"
 		"\t-stop            -- stop freeswitch\n"
 		"\t-nc              -- do not output to a console and background\n"
 		"\t-conf [confdir]  -- specify an alternate config dir\n"
-		"\t-log [logdir]    -- specify an alternate log dir\n" "\t-db [dbdir]      -- specify an alternate db dir\n";
-
-#endif
+		"\t-log [logdir]    -- specify an alternate log dir\n"
+		"\t-db [dbdir]      -- specify an alternate db dir\n"
+		"\t-scripts [scriptsdir]      -- specify an alternate scripts dir\n";
 
 	for (x = 1; x < argc; x++) {
 		known_opt = 0;
@@ -350,7 +346,19 @@
 			known_opt++;
 		}
 
-		if ((!known_opt || argv[x]) && !strcmp(argv[x], "-help")) {
+		if (argv[x] && !strcmp(argv[x], "-scripts")) {
+			x++;
+			if (argv[x] && strlen(argv[x])) {
+				SWITCH_GLOBAL_dirs.script_dir = (char *) malloc(strlen(argv[x]) + 1);
+				strcpy(SWITCH_GLOBAL_dirs.script_dir, argv[x]);
+			} else {
+				fprintf(stderr, "When using -scripts you must specify a scripts directory\n");
+				return 255;
+			}
+			known_opt++;
+		}
+
+		if ((!known_opt || argv[x]) && (!strcmp(argv[x], "-help") || !strcmp(argv[x], "-h") || !strcmp(argv[x], "-?"))) {
 			printf("%s\n", usageDesc);
 			exit(0);
 		}
@@ -362,7 +370,7 @@
 	}
 
 	if (alt_dirs && alt_dirs != 3) {
-		fprintf(stderr, "You must use -conf, -log, and -db together\n");
+		fprintf(stderr, "You must specify all or none of -conf, -log, and -db\n");
 		return 255;
 	}
 



More information about the Freeswitch-svn mailing list