free_mbtable((struct MbTable **) p->var);
*((struct MbTable **) p->var) = parse_mbtable((char *) p->initial);
break;
- case DT_COMMAND:
case DT_PATH:
{
char *init = (char *) p->initial;
*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)
*((struct Address **) MuttVars[idx].var), false);
val = tmp2;
}
- else if ((DTYPE(MuttVars[idx].type) == DT_PATH) || (DTYPE(MuttVars[idx].type) == DT_COMMAND))
+ else if ((DTYPE(MuttVars[idx].type) == DT_PATH) ||
+ (DTYPE(MuttVars[idx].type) == DT_COMMAND))
{
tmp2[0] = '\0';
mutt_str_strfcpy(tmp2, NONULL(*((char **) MuttVars[idx].var)), sizeof(tmp2));
char scratch[PATH_MAX];
mutt_str_strfcpy(scratch, buf->data, sizeof(scratch));
mutt_expand_path(scratch, sizeof(scratch));
+
+ size_t scratchlen = mutt_str_strlen(scratch);
+ if (scratchlen != 0)
+ {
+ if ((scratch[scratchlen - 1] != '|') && /* not a command */
+ (url_check_scheme(scratch) == U_UNKNOWN)) /* probably a local file */
+ {
+ 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 scratch[LONG_STRING];
mutt_str_strfcpy(scratch, NONULL((const char *) val->var), sizeof(scratch));
mutt_expand_path(scratch, sizeof(scratch));
+
+ size_t scratchlen = mutt_str_strlen(scratch);
+ if (scratchlen != 0)
+ {
+ if ((scratch[scratchlen - 1] != '|') && /* not a command */
+ (url_check_scheme(scratch) == U_UNKNOWN)) /* probably a local file */
+ {
+ 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);
+ }
+ }
+ }
+
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));
+
+ FREE((void *) MuttVars[idx].var);
+ *((char **) MuttVars[idx].var) = mutt_str_strdup(scratch);
+ break;
+ }
+ case DT_STRING:
{
FREE((void *) MuttVars[idx].var);
*((char **) MuttVars[idx].var) = mutt_str_strdup((char *) val->var);
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)