[PATCH] Dump all known config options
Alexander Malysh <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Organization | Centrium GmbH |
| Message-ID | <[email protected]> |
Hi All, I would be like to know, should I apply attached patch to cvs? This patch doesn't break any functionality, but adds new command line option "-g" or "--generate" for dumping all known config options and groups to stdout and exit. Later (if we have module API) we can dump default values also. Comments and votes please... -- Best regards / Mit besten Grüßen aus Köln Dipl.-Ing. Alexander Malysh ___________________________________ Centrium GmbH Ehrenstrasse 2 50672 Köln Fon: +49 (0221) 277 49 240 Fax: +49 (0221) 277 49 109 email: a.malysh at centrium.de web: http://www.centrium.de msn: olek2002 at hotmail.com ___________________________________________ Please avoid sending me Word or PowerPoint attachments. See http://www.fsf.org/philosophy/no-word-attachments.html
cfg_dump_all.diff
(text/x-diff, 1.8 KB)
Index: gw/bearerbox.c
===================================================================
RCS file: /home/cvs/gateway/gw/bearerbox.c,v
retrieving revision 1.137
diff -a -u -r1.137 bearerbox.c
--- gw/bearerbox.c 27 Mar 2003 08:55:01 -0000 1.137
+++ gw/bearerbox.c 24 May 2003 17:54:42 -0000
@@ -274,7 +274,10 @@
bb_status = BB_SUSPENDED;
else if (strcmp(argv[i], "-I")==0 || strcmp(argv[i], "--isolated")==0)
bb_status = BB_ISOLATED;
- else
+ else if (strcmp(argv[i], "-g")==0 || strcmp(argv[i], "--generate")==0) {
+ cfg_dump_all();
+ exit(0);
+ }
return -1;
return 0;
Index: gwlib/cfg.c
===================================================================
RCS file: /home/cvs/gateway/gwlib/cfg.c,v
retrieving revision 1.22
diff -a -u -r1.22 cfg.c
--- gwlib/cfg.c 9 Sep 2002 10:49:28 -0000 1.22
+++ gwlib/cfg.c 24 May 2003 17:54:43 -0000
@@ -648,3 +648,20 @@
debug("gwlib.cfg", 0, "Dump ends.");
}
+
+void cfg_dump_all()
+{
+ #define OCTSTR(name) \
+ printf("%s = <please consult user doc>\n", #name);
+ #define SINGLE_GROUP(name, fields) \
+ printf("#\n# Single Group\n#\n"); \
+ printf("group = %s\n", #name); \
+ fields; \
+ printf("\n\n");
+ #define MULTI_GROUP(name, fields) \
+ printf("#\n# Multi Group\n#\n"); \
+ printf("group = %s\n", #name); \
+ fields; \
+ printf("\n\n");
+ #include "cfg.def"
+}
Index: gwlib/cfg.h
===================================================================
RCS file: /home/cvs/gateway/gwlib/cfg.h,v
retrieving revision 1.9
diff -a -u -r1.9 cfg.h
--- gwlib/cfg.h 2 Sep 2002 12:42:19 -0000 1.9
+++ gwlib/cfg.h 24 May 2003 17:54:43 -0000
@@ -40,4 +40,9 @@
void grp_dump(CfgGroup *grp);
void cfg_dump(Cfg *cfg);
+/*
+ * Dump all known config groups and values to stdout.
+ */
+void cfg_dump_all();
+
#endif