[sr-dev] git:master: core: added option '-a' to control auto aliases

Daniel-Constantin Mierla miconda at gmail.com
Tue Jul 27 23:53:57 CEST 2010


Module: sip-router
Branch: master
Commit: b01dc20a7a45e3b80b00b03889762fdff8feda8b
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b01dc20a7a45e3b80b00b03889762fdff8feda8b

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Tue Jul 27 23:20:24 2010 +0200

core: added option '-a' to control auto aliases

- enable auto aliases with '-a yes' or -'-a on'
- disable auto aliases with '-a no' or -'-a off'
- the option overwirtes config value of global parameter auto_aliases

---

 main.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/main.c b/main.c
index e79d810..5b0c476 100644
--- a/main.c
+++ b/main.c
@@ -244,7 +244,9 @@ Options:\n\
     -g gid       Change gid \n\
     -P file      Create a pid file\n\
     -G file      Create a pgid file\n\
-    -O nr        Script optimization level (debugging option)\n"
+    -O nr        Script optimization level (debugging option)\n\
+    -a mode      Auto aliases mode: enable with yes or on,\n\
+                  disable with no or off\n"
 #ifdef STATS
 "    -s file     File to which statistics is dumped (disabled otherwise)\n"
 #endif
@@ -1665,7 +1667,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:SQ:O:"
+	options=  ":f:cm:dVhEb:l:L:n:vrRDTN:W:w:t:u:g:P:G:SQ:O:a:"
 #ifdef STATS
 		"s:"
 #endif
@@ -1764,6 +1766,7 @@ int main(int argc, char** argv)
 			case 'G':
 			case 'S':
 			case 'Q':
+			case 'a':
 			case 's':
 					break;
 			case '?':
@@ -1977,6 +1980,18 @@ try_again:
 			case 'G':
 					pgid_file=optarg;
 					break;
+			case 'a':
+					if(strcmp(optarg, "on")==0 || strcmp(optarg, "yes")==0)
+						sr_auto_aliases = 1;
+					else if(strcmp(optarg, "off")==0 || strcmp(optarg, "no")==0)
+						sr_auto_aliases = 0;
+					else {
+						fprintf(stderr,
+							"bad auto aliases parameter: %s (valid on, off, yes, no)\n",
+							optarg);
+						goto error;
+					}
+					break;
 			case 's':
 				#ifdef STATS
 					stat_file=optarg;




More information about the sr-dev mailing list