Fwd: [PATCH] specifying storefile in command line.

Rachman Chavik <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Re-sent to list.
Originally sent using a wrong subscription address.

Regards

>Hi all,
>
>This patch allows specifying the location+filename of the store in
>the command line.
>Eg:
>
>$ ./bearerbox --storefile /tmp/store.dat
>
>Note that this overrides the value specified in the configuration
>file.
>
>I intended this to complement --logfile option. Useful if you have
>multiple
>directories for each kannel environment.
>
>Comments?
>
>Regards,
>Rachman
bearerbox.c.diff (application/octet-stream, 1.2 KB)
Index: bearerbox.c
===================================================================
RCS file: /home/cvs/gateway/gw/bearerbox.c,v
retrieving revision 1.137
diff -u -r1.137 bearerbox.c
--- bearerbox.c	27 Mar 2003 08:55:01 -0000	1.137
+++ bearerbox.c	6 May 2003 10:51:38 -0000
@@ -66,6 +66,7 @@
 Mutex *boxid_mutex;
 static time_t start_time;
 volatile sig_atomic_t restart = 0;
+Octstr *storefile = NULL;
 
 
 /* to avoid copied code */
@@ -274,6 +275,16 @@
 	bb_status = BB_SUSPENDED;
     else if (strcmp(argv[i], "-I")==0 || strcmp(argv[i], "--isolated")==0)
 	bb_status = BB_ISOLATED;
+    else if (strcmp(argv[i], "-O")==0 || strcmp(argv[i], "--storefile")==0) {
+	int j = i + 1;
+	if (j >= argc)
+	    return 0;
+	if (argv[j]) {
+	    storefile = octstr_create(argv[j]);
+	    return 1;
+	}
+	return 0;
+    }
     else
 	return -1;
 
@@ -314,10 +325,11 @@
 	octstr_destroy(log);
     }
 
-    log = cfg_get(grp, octstr_imm("store-file"));
-    if (log != NULL) {
-	store_init(log);
-	octstr_destroy(log);
+    if (storefile == NULL)
+	storefile = cfg_get(grp, octstr_imm("store-file"));
+    if (storefile != NULL) {
+	store_init(storefile);
+	octstr_destroy(storefile);
     }
 
     conn_config_ssl (grp);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.