nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] mhshow display bug

2014-04-12 10:06:32
Paul F. wrote:

the %s isn't getting dropped -- it's getting expanded to an empty
string.  i.e., at this point, at the end of parse_display_string():

        snprintf (buffer, buflen, ct->c_termproc, term);

the value of term is an empty string, and the value of ct->c_termproc
is this:

      %s | /usr/bin/iconv -f ISO-8859-1 -t UTF-8 | less

term is an empty string because the only thing in cp at the start of
parse_display_string() (cp is expanded to buffer, which is in turn
copied to term) is "%l".  the %l that gets consumed along the way, as
you say, creating no output.

continuing back, the reason cp contains just "%l" at the start of
parse_display_string() is this snippet, in show_text():
        if (concatsw)
            snprintf(buffer, sizeof(buffer), "%%l");
        else
            snprintf (buffer, sizeof(buffer), "%%l%s %%F", progsw ? progsw :
                      moreproc && *moreproc ? moreproc : DEFAULT_PAGER);

if the concatsw test weren't there, then cp would be "%lless %F", which
is the command that should eventually be expanded into the %s in my
configured display filter.

OK, I can reproduce it now.  "%%l" obviously works in the common case
but I don't if it should be changed all the time, or not used when
there's a ct->c_termproc, i.e.,

    if (concatsw  &&  ! ct->c_termproc)

Or if parse_display_string() show look for the empty buffer when
appending c_termproc?  (Definitely my last choice.)

I'll leave this for Ken.  While this is probably redundant given your
explanation above, here's what my debug statements printed out:

  uip/mhshowsbr.c:517; concatsw=0, cp=%lcat %F
  uip/mhshowsbr.c:1018; end of parse_display_string(), buffer=cat 
'/tmp/mhshowFwSznm' | /usr/bin/iconv -f ISO-8859-1 -t UTF-8 | less

  uip/mhshowsbr.c:517; concatsw=1, cp=%l
  uip/mhshowsbr.c:1018; end of parse_display_string(), buffer= | /usr/bin/iconv 
-f ISO-8859-1 -t UTF-8 | less
  /bin/sh: -c: line 0: syntax error near unexpected token `|'
  /bin/sh: -c: line 0: ` | /usr/bin/iconv -f ISO-8859-1 -t UTF-8 | less "$@"'

David

_______________________________________________
Nmh-workers mailing list
Nmh-workers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>