git » nmdb » commit 5572599

Change nmdb's options to make them easier to remember.

author Alberto Bertogli
2007-06-24 08:23:40 UTC
committer Alberto Bertogli
2007-06-24 08:23:40 UTC
parent ac4c16aafb807a213b853d5d4e031b9c7a1609cb

Change nmdb's options to make them easier to remember.

Signed-off-by: Alberto Bertogli <albertito@gmail.com>

doc/guide.rst +6 -6
nmdb/main.c +15 -11
nmdb/nmdb.1 +14 -1

diff --git a/doc/guide.rst b/doc/guide.rst
index 02e3d58..4431722 100644
--- a/doc/guide.rst
+++ b/doc/guide.rst
@@ -184,13 +184,13 @@ Now that you know all that, starting a server should be quite simple: first
 create the database as explained above, and then run the daemon with
 ``nmdb -d /path/to/the/database``.
 
-To change the port, use ``-l port``, to change the cache size, use ``-c nobj``
-(where *nobj* is the number of objects in thousands), to make the server
-passive, use ``-p``. Of course you won't remember all that (I know I don't),
-that's why ``-h`` is your friend.
+There are several options you can change at start time. Of course you won't
+remember all that (I know I don't), so check out ``nmdb -h`` to see a complete
+list.
 
-Nothing prevents you from starting more than one server in the same machine,
-so be careful to select different ports and databases for each one.
+Nothing prevents you from starting more than one TIPC server in the same
+machine, so be careful to select different TIPC ports and databases for each
+one.
 
 
 Example
diff --git a/nmdb/main.c b/nmdb/main.c
index 4c91536..4e75eb7 100644
--- a/nmdb/main.c
+++ b/nmdb/main.c
@@ -26,12 +26,12 @@ static void help(void) {
 	char h[] = \
 	  "nmdb [options]\n"
 	  "  -d dbpath	database path ('database', must be created with dpmgr)\n"
-	  "  -l lower	lower TIPC port number (10)\n"
-	  "  -L upper	upper TIPC port number (= lower)\n"
-	  "  -a addr	TCP listening address (all local addresses)\n"
-	  "  -P port	TCP listening port (26010)\n"
-	  "  -U addr	UDP listening address (all local addresses)\n"
+	  "  -l lower	TIPC lower port number (10)\n"
+	  "  -L upper	TIPC upper port number (= lower)\n"
+	  "  -t port	TCP listening port (26010)\n"
+	  "  -T addr	TCP listening address (all local addresses)\n"
 	  "  -u port	UDP listening port (26010)\n"
+	  "  -U addr	UDP listening address (all local addresses)\n"
 	  "  -c nobj	max. number of objects to be cached, in thousands (128)\n"
 	  "  -f		don't fork and stay in the foreground\n"
 	  "  -p		enable passive mode, for redundancy purposes (read docs.)\n"
@@ -67,24 +67,27 @@ static int load_settings(int argc, char **argv)
 			settings.dbname = malloc(strlen(optarg) + 1);
 			strcpy(settings.dbname, optarg);
 			break;
+
 		case 'l':
 			settings.tipc_lower = atoi(optarg);
 			break;
 		case 'L':
 			settings.tipc_upper = atoi(optarg);
 			break;
-		case 'a':
-			settings.tcp_addr = optarg;
-			break;
-		case 'P':
+
+		case 't':
 			settings.tcp_port = atoi(optarg);
 			break;
-		case 'U':
-			settings.udp_addr = optarg;
+		case 'T':
+			settings.tcp_addr = optarg;
 			break;
+
 		case 'u':
 			settings.udp_port = atoi(optarg);
 			break;
+		case 'U':
+			settings.udp_addr = optarg;
+			break;
 
 		case 'c':
 			settings.numobjs = atoi(optarg) * 1024;
@@ -95,6 +98,7 @@ static int load_settings(int argc, char **argv)
 		case 'p':
 			settings.passive = 1;
 			break;
+
 		case 'h':
 		case '?':
 			help();
diff --git a/nmdb/nmdb.1 b/nmdb/nmdb.1
index 812c729..36d4418 100644
--- a/nmdb/nmdb.1
+++ b/nmdb/nmdb.1
@@ -2,7 +2,8 @@
 .SH NAME
 nmdb - A multiprotocol network database manager
 .SH SYNOPSYS
-nmdb [-d dbpath] [-l lower] [-L upper] [-c nobj] [-f] [-p] [-h]
+nmdb [-d dbpath] [-l lower] [-L upper] [-t tcpport] [-T tcpaddr]
+[-u udpport] [-U udpaddr] [-c nobj] [-f] [-p] [-h]
 .SH DESCRIPTION
 
 nmdb is a network database that can use several protocols to communicate with
@@ -46,6 +47,18 @@ Upper TIPC port number to bind to. Defaults to the same value
 .B lower
 is defined. Useful mainly for passive mode.
 .TP
+.B "-t tcpport"
+TCP listening port. Defaults to 26010.
+.TP
+.B "-T tcpaddr"
+IP listening address for TCP. Defaults to all local addresses.
+.TP
+.B "-u udpport"
+UDP listening port. Defaults to 26010.
+.TP
+.B "-U udpaddr"
+IP listening address for UDP. Defaults to all local addresses.
+.TP
 .B "-c nobj"
 Sets the maximum number of objects the cache will held, in thousands. Note
 that the size of the memory used by the cache layer depends on the size of the