Hi,
i can't seem to source input from an external script in mutt-1.5.6.
I have something like
source "~/.mutt/scripts/chkmbox|"
in my ~/.muttrc and mutt complains that "~/.mutt/scripts/chkmbox|"
does not exist. I think this is because stat(rcfile, &s) is called
in source_rc() without stripping away the pipe sign, if it exists
at the end.
For what it's worth, here is a patch that seemed to fix the problem
for me.
--- init.c.orig 2004-05-20 16:25:26.581558456 +0200
+++ init.c 2004-05-20 17:13:02.064459072 +0200
@@ -1369,17 +1369,30 @@
size_t buflen;
pid_t pid;
struct stat s;
+ char *rcstat = NULL;
+ int len = mutt_strlen(rcfile);
- if (stat (rcfile, &s) < 0)
+ rcstat = safe_strdup (rcfile);
+
+ if (rcstat[len - 1] == '|')
+ {
+ /* strip last character, if it is a pipe (|) */
+ rcstat[len - 1] = 0;
+ }
+
+ if (stat (rcstat, &s) < 0)
{
- snprintf (err->data, err->dsize, _("%s: stat: %s"), rcfile, strerror
(errno));
+ snprintf (err->data, err->dsize, _("%s: stat: %s"), rcstat, strerror
(errno));
+ FREE(&rcstat);
return (-1);
}
if (!S_ISREG (s.st_mode))
{
- snprintf (err->data, err->dsize, _("%s: not a regular file"), rcfile);
+ snprintf (err->data, err->dsize, _("%s: not a regular file"), rcstat);
+ FREE(&rcstat);
return (-1);
}
+ FREE(&rcstat);
if ((f = mutt_open_read (rcfile, &pid)) == NULL)
{
Regards - Juergen
--
GPG A997BA7A | 87FC DA31 5F00 C885 0DC3 E28F BD0D 4B33 A997 BA7A
Attachment:
pgpobSEIhGX5C.pgp
Description: PGP signature