Skip to content

Commit

Permalink
Use a dash for unset values in DefaultAnswer ('config dump')
Browse files Browse the repository at this point in the history
  • Loading branch information
leo-arch committed Dec 23, 2024
1 parent b6947e4 commit f4e211f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
17 changes: 8 additions & 9 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,17 +227,16 @@ gen_default_answer_value_str(const int cfg)
#define DA_BUFSIZE 32
static char bufa[DA_BUFSIZE];
static char bufb[DA_BUFSIZE];
memset(cfg ? bufa : bufb, '\0', DA_BUFSIZE);

char *p = cfg ? bufa : bufb;
int l = 0;

l += snprintf(p + l, DA_BUFSIZE - (size_t)l, "d:%c,", val_d ? val_d : '0');
l += snprintf(p + l, DA_BUFSIZE - (size_t)l, "D:%c,", val_D ? val_D : '0');
l += snprintf(p + l, DA_BUFSIZE - (size_t)l, "o:%c,", val_o ? val_o : '0');
l += snprintf(p + l, DA_BUFSIZE - (size_t)l, "r:%c,", val_r ? val_r : '0');
l += snprintf(p + l, DA_BUFSIZE - (size_t)l, "R:%c,", val_R ? val_R : '0');
l += snprintf(p + l, DA_BUFSIZE - (size_t)l, "t:%c,", val_t ? val_t : '0');
memset(p, '\0', DA_BUFSIZE);

l += snprintf(p + l, DA_BUFSIZE - (size_t)l, "d:%c,", val_d ? val_d : '-');
l += snprintf(p + l, DA_BUFSIZE - (size_t)l, "D:%c,", val_D ? val_D : '-');
l += snprintf(p + l, DA_BUFSIZE - (size_t)l, "o:%c,", val_o ? val_o : '-');
l += snprintf(p + l, DA_BUFSIZE - (size_t)l, "r:%c,", val_r ? val_r : '-');
l += snprintf(p + l, DA_BUFSIZE - (size_t)l, "R:%c,", val_R ? val_R : '-');
l += snprintf(p + l, DA_BUFSIZE - (size_t)l, "t:%c,", val_t ? val_t : '-');
#undef DA_BUFSIZE

if (l > 0 && p[l - 1] == ',')
Expand Down
4 changes: 2 additions & 2 deletions src/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -464,10 +464,10 @@ ws2=31:ws3=38;5;228:ws4=32:ws5=36:ws6=38;5;214:ws7=35:ws8=2;37:xf=1;31:xs=32:"

/* Default options */
/* Default answers for confirmation prompts: 0 (none), 'y', or 'n' */
#define DEF_ANSWER_REMOVE 'n' /* 'r' command */
#define DEF_ANSWER_TRASH 'y' /* 't' command */
#define DEF_ANSWER_BULK_RENAME 'n' /* 'br' command */
#define DEF_ANSWER_OVERWRITE 'n' /* 'c' and 'm' commands mostly */
#define DEF_ANSWER_REMOVE 'n' /* 'r' command */
#define DEF_ANSWER_TRASH 'y' /* 't' command */
#define DEF_ANSWER_DEFAULT 'y' /* Remaining prompts */
#define DEF_ANSWER_DEFAULT_ALL 0 /* All prompts (overrides the above ones) */

Expand Down

0 comments on commit f4e211f

Please sign in to comment.