switch (DTYPE(p->type))
{
case DT_STRING:
- case DT_COMMAND:
mutt_str_replace((char **) p->var, (char *) p->initial);
break;
case DT_MBTABLE:
*ptr = mutt_regex_create((const char *) p->initial, p->type, NULL);
break;
}
+ case DT_COMMAND:
+ {
+ char *init = (char *) p->initial;
+ FREE((char **) p->var);
+ if (init)
+ {
+ char command[LONG_STRING];
+ mutt_str_strfcpy(command, init, sizeof(command));
+ mutt_expand_path(command, sizeof(command));
+ *((char **) p->var) = mutt_str_strdup(command);
+ }
+
+ break;
+ }
}
if (p->flags & R_INDEX)
switch (DTYPE(p->type))
{
case DT_STRING:
- case DT_COMMAND:
if (!p->initial && *((char **) p->var))
p->initial = (unsigned long) mutt_str_strdup(*((char **) p->var));
break;
case DT_PATH:
+ case DT_COMMAND:
if (!p->initial && *((char **) p->var))
{
char *cp = mutt_str_strdup(*((char **) p->var));
mutt_pretty_mailbox(tmp2, sizeof(tmp2));
val = tmp2;
}
+ else if (DTYPE(MuttVars[idx].type) == DT_COMMAND)
+ {
+ tmp2[0] = '\0';
+ mutt_str_strfcpy(tmp2, NONULL(*((char **) MuttVars[idx].var)), sizeof(tmp2));
+ mutt_pretty_mailbox(tmp2, sizeof(tmp2));
+ val = tmp2;
+ }
else if (DTYPE(MuttVars[idx].type) == DT_MBTABLE)
{
struct MbTable *mbt = (*((struct MbTable **) MuttVars[idx].var));
char scratch[PATH_MAX];
mutt_str_strfcpy(scratch, buf->data, sizeof(scratch));
mutt_expand_path(scratch, sizeof(scratch));
+
+ struct ListNode *np = STAILQ_FIRST(&MuttrcStack);
+ if (!mutt_file_to_absolute_path(scratch, np ? NONULL(np->data) : "./"))
+ {
+ mutt_error("Error: impossible to build path of '%s'.", scratch);
+ }
+
if (mutt_str_strcmp(MuttVars[idx].name, "debug_file") == 0)
{
mutt_log_set_file(scratch, true);
*((char **) MuttVars[idx].var) = mutt_str_strdup(scratch);
}
}
- else if ((idx >= 0) && ((DTYPE(MuttVars[idx].type) == DT_STRING) || (DTYPE(MuttVars[idx].type) == DT_COMMAND)))
+ else if ((idx >= 0) && (DTYPE(MuttVars[idx].type) == DT_COMMAND))
+ {
+ char scratch[PATH_MAX];
+ mutt_str_strfcpy(scratch, buf->data, sizeof(scratch));
+ mutt_expand_path(scratch, sizeof(scratch));
+ /* MuttVars[idx].var is already 'char**' (or some 'void**') or...
+ * so cast to 'void*' is okay */
+ FREE((void *) MuttVars[idx].var);
+ *((char **) MuttVars[idx].var) = mutt_str_strdup(scratch);
+ }
+ else if ((idx >= 0) && (DTYPE(MuttVars[idx].type) == DT_STRING))
{
if ((strstr(MuttVars[idx].name, "charset") &&
check_charset(&MuttVars[idx], buf->data) < 0) |
char scratch[LONG_STRING];
mutt_str_strfcpy(scratch, NONULL((const char *) val->var), sizeof(scratch));
mutt_expand_path(scratch, sizeof(scratch));
+
+ struct ListNode *np = STAILQ_FIRST(&MuttrcStack);
+ if (!mutt_file_to_absolute_path(scratch, np ? NONULL(np->data) : "./"))
+ {
+ mutt_error("Error: impossible to build path of '%s'.", scratch);
+ }
+
/* MuttVars[idx].var is already 'char**' (or some 'void**') or...
* so cast to 'void*' is okay */
FREE((void *) MuttVars[idx].var);
*((char **) MuttVars[idx].var) = mutt_str_strdup(scratch);
break;
}
- case DT_STRING:
case DT_COMMAND:
+ {
+ char scratch[LONG_STRING];
+ mutt_str_strfcpy(scratch, NONULL((const char *) val->var), sizeof(scratch));
+ mutt_expand_path(scratch, sizeof(scratch));
+
+ /* MuttVars[idx].var is already 'char**' (or some 'void**') or...
+ * so cast to 'void*' is okay */
+ FREE((void *) MuttVars[idx].var);
+ *((char **) MuttVars[idx].var) = mutt_str_strdup(scratch);
+ break;
+ }
+ case DT_STRING:
{
/* MuttVars[idx].var is already 'char**' (or some 'void**') or...
* so cast to 'void*' is okay */
tmp[0] = '\0';
- if ((DTYPE(MuttVars[idx].type) == DT_STRING) || (DTYPE(MuttVars[idx].type) == DT_PATH))
+ if ((DTYPE(MuttVars[idx].type) == DT_STRING) || (DTYPE(MuttVars[idx].type) == DT_PATH) ||
+ (DTYPE(MuttVars[idx].type) == DT_COMMAND))
{
mutt_str_strfcpy(tmp, NONULL(*((char **) MuttVars[idx].var)), sizeof(tmp));
if (DTYPE(MuttVars[idx].type) == DT_PATH)