[SR-Dev] git:andrei/script_vars: core: new command line option (debugging)

Andrei Pelinescu-Onciul andrei at iptel.org
Wed Dec 10 14:53:47 CET 2008


Module: sip-router
Branch: andrei/script_vars
Commit: 5219ecb708daba13749ec8d242129a117449ba9f
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5219ecb708daba13749ec8d242129a117449ba9f

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Wed Dec 10 14:52:12 2008 +0100

core: new command line option (debugging)

- new command line option controlling the script optimization
  level: -O (e.g. -O0 - no optimizations). By default the
  optimization level is set to maximum (2 for now).
- renamed sctp max process number command line option from -O to -Q

---

 main.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/main.c b/main.c
index 86c7a2f..802e1f0 100644
--- a/main.c
+++ b/main.c
@@ -222,7 +222,7 @@ Options:\n\
 #endif
 #ifdef USE_SCTP
 "    -S           disable sctp\n\
-    -O            Number of sctp child processes (default: equal to `-n')\n"
+    -Q            Number of sctp child processes (default: equal to `-n')\n"
 #endif /* USE_SCTP */
 "    -V           Version number\n\
     -h           This help message\n\
@@ -234,7 +234,8 @@ Options:\n\
     -u uid       Change uid \n\
     -g gid       Change gid \n\
     -P file      Create a pid file\n\
-    -G file      Create a pgid file\n"
+    -G file      Create a pgid file\n\
+    -O nr        Script optimization level (debugging option)\n"
 #ifdef STATS
 "    -s file     File to which statistics is dumped (disabled otherwise)\n"
 #endif
@@ -1502,7 +1503,7 @@ int main(int argc, char** argv)
 		"DBG_MSG_QA enabled, ser may exit abruptly\n");
 #endif
 
-	options=  ":f:cm:dVhEb:l:L:n:vrRDTN:W:w:t:u:g:P:G:SO:"
+	options=  ":f:cm:dVhEb:l:L:n:vrRDTN:W:w:t:u:g:P:G:SQ:O:"
 #ifdef STATS
 		"s:"
 #endif
@@ -1572,6 +1573,14 @@ int main(int argc, char** argv)
 			case 'E':
 					log_stderr=1;
 					break;
+			case 'O':
+					scr_opt_lev=strtol(optarg, &tmp, 10);
+					if (tmp &&(*tmp)){
+						fprintf(stderr, "bad optimization level: -O %s\n",
+										optarg);
+						goto error;
+					};
+					break;
 			case 'b':
 			case 'l':
 			case 'n':
@@ -1589,7 +1598,7 @@ int main(int argc, char** argv)
 			case 'P':
 			case 'G':
 			case 'S':
-			case 'O':
+			case 'Q':
 			case 's':
 					break;
 			case '?':
@@ -1676,6 +1685,7 @@ try_again:
 			case 'd':
 			case 'V':
 			case 'h':
+			case 'O':
 					break;
 			case 'E':
 					log_stderr=1;	// use in both getopt switches
@@ -1762,7 +1772,7 @@ try_again:
 					fprintf(stderr,"WARNING: sctp support not compiled in\n");
 				#endif
 					break;
-			case 'O':
+			case 'Q':
 				#ifdef USE_SCTP
 					sctp_children_no=strtol(optarg, &tmp, 10);
 					if ((tmp==0) ||(*tmp)){




More information about the sr-dev mailing list