From f22b757743025494de57753b9f39ad23f9a3ffef Mon Sep 17 00:00:00 2001
From: "Christian W. Zuckschwerdt" <zany@triq.net>
Date: Fri, 6 Oct 2023 17:02:38 +0200
Subject: [PATCH] Change startup help text to the actual help page (#2659)

---
 src/compat_paths.c |  4 ++--
 src/rtl_433.c      | 12 ++++++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/compat_paths.c b/src/compat_paths.c
index 772f8f67..26b51647 100644
--- a/src/compat_paths.c
+++ b/src/compat_paths.c
@@ -57,7 +57,7 @@ char **compat_get_default_conf_paths(void)
     else {
         paths[0] = NULL;
     }
-    // Local per user configuration files (e.g. Win7: C:\Users\myusername\AppData\Local\rtl_433\rtl_433.conf)
+    // Local per user configuration files %LocalAppData% (e.g. Win7: C:\Users\myusername\AppData\Local\rtl_433\rtl_433.conf)
     if (SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, bufs[1]) == S_OK) {
         strcat_s(bufs[1], sizeof(bufs[1]), "\\rtl_433\\rtl_433.conf");
         paths[1] = bufs[1];
@@ -65,7 +65,7 @@ char **compat_get_default_conf_paths(void)
     else {
         paths[1] = NULL;
     }
-    // Per machine configuration data (e.g. Win7: C:\ProgramData\rtl_433\rtl_433.conf)
+    // Per machine configuration data %ProgramData% (e.g. Win7: C:\ProgramData\rtl_433\rtl_433.conf)
     if (SHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, 0, bufs[2]) == S_OK) {
         strcat_s(bufs[2], sizeof(bufs[2]), "\\rtl_433\\rtl_433.conf");
         paths[2] = bufs[2];
diff --git a/src/rtl_433.c b/src/rtl_433.c
index 22bee114..de4e8f59 100644
--- a/src/rtl_433.c
+++ b/src/rtl_433.c
@@ -127,7 +127,6 @@ r_device *flex_create_device(char *spec); // maybe put this in some header file?
 static void print_version(void)
 {
     fprintf(stderr, "%s\n", version_string());
-    fprintf(stderr, "Use -h for usage help and see https://triq.org/ for documentation.\n");
 }
 
 _Noreturn
@@ -135,7 +134,16 @@ static void usage(int exit_code)
 {
     term_help_fprintf(exit_code ? stderr : stdout,
             "Generic RF data receiver and decoder for ISM band devices using RTL-SDR and SoapySDR.\n"
+            "Full documentation is available at https://triq.org/\n"
             "\nUsage:\n"
+#ifdef _WIN32
+            "  A \"rtl_433.conf\" file is searched in the current dir, %%LocalAppData%%, %%ProgramData%%,\n"
+            "  e.g. \"C:\\Users\\username\\AppData\\Local\\rtl_433\\\", \"C:\\ProgramData\\rtl_433\\\",\n"
+            "  then command line args will be parsed in order.\n"
+#else
+            "  A \"rtl_433.conf\" file is searched in \"./\", XDG_CONFIG_HOME e.g. \"$HOME/.config/rtl_433/\",\n"
+            "  \"/usr/local/etc/rtl_433/\", \"/etc/rtl_433/\", then command line args will be parsed in order.\n"
+#endif
             "\t\t= General options =\n"
             "  [-V] Output the version string and exit\n"
             "  [-v] Increase verbosity (can be used multiple times).\n"
@@ -832,7 +840,7 @@ static void parse_conf_try_default_files(r_cfg_t *cfg)
 {
     char **paths = compat_get_default_conf_paths();
     for (int a = 0; paths[a]; a++) {
-        fprintf(stderr, "Trying conf file at \"%s\"...\n", paths[a]);
+        // fprintf(stderr, "Trying conf file at \"%s\"...\n", paths[a]);
         if (hasconf(paths[a])) {
             fprintf(stderr, "Reading conf from \"%s\".\n", paths[a]);
             parse_conf_file(cfg, paths[a]);