Skip to content

Commit

Permalink
Change startup help text to the actual help page
Browse files Browse the repository at this point in the history
  • Loading branch information
zuckschwerdt committed Oct 6, 2023
1 parent 7565025 commit ee12b3e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/compat_paths.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ 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];
}
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];
Expand Down
12 changes: 10 additions & 2 deletions src/rtl_433.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,23 @@ 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
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"
Expand Down Expand Up @@ -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]);
Expand Down

0 comments on commit ee12b3e

Please sign in to comment.