aboutsummaryrefslogtreecommitdiffstats
path: root/wsutil
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2022-04-28 13:41:27 -0700
committerGerald Combs <gerald@wireshark.org>2022-04-29 18:00:21 +0000
commit70bd130379643e16b19679f8d2f26fbea5607a3d (patch)
treee5141413e72ed733423482293ae880543104f972 /wsutil
parentb244db8f3c3ed5e2e97d64d00e62be4e17359268 (diff)
Fix "generated by" comments in configuration files.
Add get_configuration_namespace() and use it in code that writes "generated by" comments at the top of various configuration files. Update our Logwolf colorfilters.
Diffstat (limited to 'wsutil')
-rw-r--r--wsutil/filesystem.c14
-rw-r--r--wsutil/filesystem.h6
2 files changed, 17 insertions, 3 deletions
diff --git a/wsutil/filesystem.c b/wsutil/filesystem.c
index 217cd8a68a..b152cd19e8 100644
--- a/wsutil/filesystem.c
+++ b/wsutil/filesystem.c
@@ -54,6 +54,8 @@
/*
* Application configuration namespace. Used to construct configuration
* paths and environment variables.
+ * XXX We might want to use the term "application flavor" instead, with
+ * "packet" and "log" flavors.
*/
enum configuration_namespace_e {
CONFIGURATION_NAMESPACE_UNINITIALIZED,
@@ -62,6 +64,7 @@ enum configuration_namespace_e {
};
enum configuration_namespace_e configuration_namespace = CONFIGURATION_NAMESPACE_UNINITIALIZED;
+#define CONFIGURATION_NAMESPACE_PROPER (configuration_namespace == CONFIGURATION_NAMESPACE_WIRESHARK ? "Wireshark" : "Logwolf")
#define CONFIGURATION_NAMESPACE_LOWER (configuration_namespace == CONFIGURATION_NAMESPACE_WIRESHARK ? "wireshark" : "logwolf")
#define CONFIGURATION_ENVIRONMENT_VARIABLE(suffix) (configuration_namespace == CONFIGURATION_NAMESPACE_WIRESHARK ? "WIRESHARK_" suffix : "LOGWOLF_" suffix)
@@ -297,8 +300,13 @@ set_configuration_namespace(const char *namespace_name)
ws_error("Unknown configuration namespace %s", namespace_name);
}
- ws_debug("Using configuration namespace %s.",
- configuration_namespace == CONFIGURATION_NAMESPACE_WIRESHARK ? "Wireshark" : "Logwolf");
+ ws_debug("Using configuration namespace %s.", CONFIGURATION_NAMESPACE_PROPER);
+}
+
+const char *
+get_configuration_namespace(void)
+{
+ return CONFIGURATION_NAMESPACE_PROPER;
}
#ifndef _WIN32
@@ -1330,7 +1338,7 @@ get_persconffile_dir_no_profile(void)
* is an inaccessible network drive.
*/
env = g_getenv("APPDATA");
- const char *persconf_namespace = configuration_namespace == CONFIGURATION_NAMESPACE_WIRESHARK ? "Wireshark" : "Logwolf";
+ const char *persconf_namespace = CONFIGURATION_NAMESPACE_PROPER;
if (env != NULL) {
/*
* Concatenate %APPDATA% with "\Wireshark" or "\Logwolf".
diff --git a/wsutil/filesystem.h b/wsutil/filesystem.h
index 8d276f3d99..9c8432f813 100644
--- a/wsutil/filesystem.h
+++ b/wsutil/filesystem.h
@@ -39,6 +39,12 @@ extern "C" {
*/
WS_DLL_PUBLIC char *configuration_init(const char *arg0, const char *namespace_name);
+/**
+ * Get the configuration namespace name.
+ * @return The namespace name. One of "Wireshark" or "Logwolf".
+ */
+WS_DLL_PUBLIC const char *get_configuration_namespace(void);
+
/*
* Get the directory in which the program resides.
*/