the code checks to see if those escapes are quoted before quoting
them. Removed quoting of them in mhn.defaults.sh because it isn't
(and wasn't) necessary.
expand | sed -e 's/^ //' -e 's/ *$//'" >> $TMP
elif [ ! -z "`$SEARCHPROG $SEARCHPATH elinks`" ]; then
echo "mhfixmsg-format-text/html: elinks -dump -force-html -no-numbering \
expand | sed -e 's/^ //' -e 's/ *$//'" >> $TMP
elif [ ! -z "`$SEARCHPROG $SEARCHPATH elinks`" ]; then
echo "mhfixmsg-format-text/html: elinks -dump -force-html -no-numbering \
--eval 'set document.browse.margin_width = 0' '%F'" >> $TMP
+-eval 'set document.browse.margin_width = 0' %F" >> $TMP
PGM="`$SEARCHPROG $SEARCHPATH xv`"
if [ ! -z "$PGM" ]; then
PGM="`$SEARCHPROG $SEARCHPATH xv`"
if [ ! -z "$PGM" ]; then
- echo "mhshow-show-image: %p$PGM -geometry =-0+0 '%f'" >> $TMP
+ echo "mhshow-show-image: %p$PGM -geometry =-0+0 %f" >> $TMP
elif [ ! -z $"NETPBM" -a ! -z "$XWUD" ]; then
echo "mhshow-show-image/gif: %p${NETPBMDIR}giftopnm | ${NETPBMDIR}ppmtopgm | ${NETPBMDIR}pgmtopbm | ${NETPBMDIR}pnmtoxwd | $XWUD -geometry =-0+0" >> $TMP
echo "mhshow-show-image/x-pnm: %p${NETPBMDIR}pnmtoxwd | $XWUD -geometry =-0+0" >> $TMP
elif [ ! -z $"NETPBM" -a ! -z "$XWUD" ]; then
echo "mhshow-show-image/gif: %p${NETPBMDIR}giftopnm | ${NETPBMDIR}ppmtopgm | ${NETPBMDIR}pgmtopbm | ${NETPBMDIR}pnmtoxwd | $XWUD -geometry =-0+0" >> $TMP
echo "mhshow-show-image/x-pnm: %p${NETPBMDIR}pnmtoxwd | $XWUD -geometry =-0+0" >> $TMP
PGM="`$SEARCHPROG $SEARCHPATH recorder`"
if [ ! -z "$PGM" ]; then
echo "mhstore-store-audio/basic: %m%P.au" >> $TMP
PGM="`$SEARCHPROG $SEARCHPATH recorder`"
if [ ! -z "$PGM" ]; then
echo "mhstore-store-audio/basic: %m%P.au" >> $TMP
- echo "mhbuild-compose-audio/basic: ${AUDIODIR}recorder '%f' -au -pause > /dev/tty" >> $TMP
+ echo "mhbuild-compose-audio/basic: ${AUDIODIR}recorder %f -au -pause > /dev/tty" >> $TMP
echo "mhshow-show-audio/basic: %p${AUDIODIR}splayer -au" >> $TMP
fi
elif [ -f "/dev/audio" ]; then
echo "mhshow-show-audio/basic: %p${AUDIODIR}splayer -au" >> $TMP
fi
elif [ -f "/dev/audio" ]; then
echo "mhstore-store-audio/x-next: %m%P.au" >> $TMP
AUDIOTOOL="`$SEARCHPROG $SEARCHPATH audiotool`"
if [ ! -z "$AUDIOTOOL" ]; then
echo "mhstore-store-audio/x-next: %m%P.au" >> $TMP
AUDIOTOOL="`$SEARCHPROG $SEARCHPATH audiotool`"
if [ ! -z "$AUDIOTOOL" ]; then
- echo "mhbuild-compose-audio/basic: $AUDIOTOOL '%f' && ${AUDIODIR}raw2audio -F < '%f'" >> $TMP
+ echo "mhbuild-compose-audio/basic: $AUDIOTOOL %f && ${AUDIODIR}raw2audio -F < %f" >> $TMP
else
echo "mhbuild-compose-audio/basic: trap \"exit 0\" 2 && ${AUDIODIR}record | ${AUDIODIR}raw2audio -F" >> $TMP
fi
else
echo "mhbuild-compose-audio/basic: trap \"exit 0\" 2 && ${AUDIODIR}record | ${AUDIODIR}raw2audio -F" >> $TMP
fi
if [ ! -z "$PGM" ]; then
DIR="`echo $PGM | awk -F/ '{ for(i=2;i<NF;i++)printf "/%s", $i;}'`"/
if [ ! -z "$AUDIOTOOL" ]; then
if [ ! -z "$PGM" ]; then
DIR="`echo $PGM | awk -F/ '{ for(i=2;i<NF;i++)printf "/%s", $i;}'`"/
if [ ! -z "$AUDIOTOOL" ]; then
- echo "mhbuild-compose-audio/x-next: $AUDIOTOOL '%f' && ${DIR}adpcm_enc < '%f'" >> $TMP
+ echo "mhbuild-compose-audio/x-next: $AUDIOTOOL %f && ${DIR}adpcm_enc < %f" >> $TMP
else
echo "mhbuild-compose-audio/x-next: ${AUDIODIR}record | ${DIR}adpcm_enc" >> $TMP
fi
echo "mhshow-show-audio/x-next: %p${DIR}adpcm_dec | ${AUDIODIR}play" >> $TMP
else
if [ ! -z "$AUDIOTOOL" ]; then
else
echo "mhbuild-compose-audio/x-next: ${AUDIODIR}record | ${DIR}adpcm_enc" >> $TMP
fi
echo "mhshow-show-audio/x-next: %p${DIR}adpcm_dec | ${AUDIODIR}play" >> $TMP
else
if [ ! -z "$AUDIOTOOL" ]; then
- echo "mhbuild-compose-audio/x-next: $AUDIOTOOL '%f'" >> $TMP
+ echo "mhbuild-compose-audio/x-next: $AUDIOTOOL %f" >> $TMP
else
echo "mhbuild-compose-audio/x-next: ${AUDIODIR}record" >> $TMP
fi
else
echo "mhbuild-compose-audio/x-next: ${AUDIODIR}record" >> $TMP
fi
PGM="`$SEARCHPROG $SEARCHPATH mpeg_play`"
if [ ! -z "$PGM" ]; then
PGM="`$SEARCHPROG $SEARCHPATH mpeg_play`"
if [ ! -z "$PGM" ]; then
- echo "mhshow-show-video/mpeg: %p$PGM '%f'" >> $TMP
+ echo "mhshow-show-video/mpeg: %p$PGM %f" >> $TMP
fi
PGM="`$SEARCHPROG $SEARCHPATH okular`"
if [ ! -z "$PGM" ]; then
fi
PGM="`$SEARCHPROG $SEARCHPATH okular`"
if [ ! -z "$PGM" ]; then
- echo "mhshow-show-application/PostScript: %pokular '%F'" >> $TMP
+ echo "mhshow-show-application/PostScript: %pokular %F" >> $TMP
else
PGM="`$SEARCHPROG $SEARCHPATH evince`"
if [ ! -z "$PGM" ]; then
else
PGM="`$SEARCHPROG $SEARCHPATH evince`"
if [ ! -z "$PGM" ]; then
- echo "mhshow-show-application/PostScript: %pevince '%F'" >> $TMP
+ echo "mhshow-show-application/PostScript: %pevince %F" >> $TMP
else
PGM="`$SEARCHPROG $SEARCHPATH gv`"
if [ ! -z "$PGM" ]; then
else
PGM="`$SEARCHPROG $SEARCHPATH gv`"
if [ ! -z "$PGM" ]; then
- echo "mhshow-show-application/PostScript: %pgv '%F'" >> $TMP
+ echo "mhshow-show-application/PostScript: %pgv %F" >> $TMP
fi
fi
fi
PGM="`$SEARCHPROG $SEARCHPATH ivs_replay`"
if [ ! -z "$PGM" ]; then
fi
fi
fi
PGM="`$SEARCHPROG $SEARCHPATH ivs_replay`"
if [ ! -z "$PGM" ]; then
- echo "mhshow-show-application/x-ivs: %p$PGM -o '%F'" >> $TMP
+ echo "mhshow-show-application/x-ivs: %p$PGM -o %F" >> $TMP
fi
# The application/vnd.openxmlformats-officedocument.wordprocessingml.document
fi
# The application/vnd.openxmlformats-officedocument.wordprocessingml.document
PGM="`$SEARCHPROG $SEARCHPATH richtext`"
if [ ! -z "$PGM" ]; then
PGM="`$SEARCHPROG $SEARCHPATH richtext`"
if [ ! -z "$PGM" ]; then
- echo "mhshow-show-text/richtext: %p$PGM -p '%F'" >> $TMP
+ echo "mhshow-show-text/richtext: %p$PGM -p %F" >> $TMP
else
PGM="`$SEARCHPROG $SEARCHPATH rt2raw`"
if [ ! -z "$PGM" ]; then
else
PGM="`$SEARCHPROG $SEARCHPATH rt2raw`"
if [ ! -z "$PGM" ]; then
- echo "mhshow-show-text/richtext: %p$PGM < '%f' | fmt -78 | more" >> $TMP
+ echo "mhshow-show-text/richtext: %p$PGM < %f | fmt -78 | more" >> $TMP
fi
fi
# staroffice to read .doc files
PGM="`$SEARCHPROG $SEARCHPATH soffice`"
if [ ! -z "$PGM" ]; then
fi
fi
# staroffice to read .doc files
PGM="`$SEARCHPROG $SEARCHPATH soffice`"
if [ ! -z "$PGM" ]; then
- echo "mhshow-show-application/msword: %psoffice '%F'" >> $TMP
+ echo "mhshow-show-application/msword: %psoffice %F" >> $TMP
echo "mhshow-suffix-application/msword: .doc" >> $TMP
fi
echo "mhshow-suffix-application/msword: .doc" >> $TMP
fi
else
PGM="`$SEARCHPROG $SEARCHPATH gs`"
if [ ! -z "$PGM" ]; then
else
PGM="`$SEARCHPROG $SEARCHPATH gs`"
if [ ! -z "$PGM" ]; then
- echo "mhshow-show-application/PostScript: %p$PGM -- '%F'" >> $TMP
+ echo "mhshow-show-application/PostScript: %p$PGM -- %F" >> $TMP
echo "mhshow-suffix-application/PostScript: .ps" >> $TMP
fi
fi
echo "mhshow-suffix-application/PostScript: .ps" >> $TMP
fi
fi
PGM="`$SEARCHPROG $SEARCHPATH ivs_record`"
if [ ! -z "$PGM" ]; then
PGM="`$SEARCHPROG $SEARCHPATH ivs_record`"
if [ ! -z "$PGM" ]; then
- echo "mhbuild-compose-application/x-ivs: $PGM -u localhost '%F'" >> $TMP
+ echo "mhbuild-compose-application/x-ivs: $PGM -u localhost %F" >> $TMP
user wishes. The default values are given in the examples.
.PP
If the profile element contains spaces, the element is split at spaces
user wishes. The default values are given in the examples.
.PP
If the profile element contains spaces, the element is split at spaces
-into tokens and each token is given as a seperate argument to the
+into tokens and each token is given as a separate argument to the
.IR execvp (2)
system call. If the element contains shell metacharacters then the entire
element is executed using
.IR execvp (2)
system call. If the element contains shell metacharacters then the entire
element is executed using
-.TH MHSHOW %manext1% "February 16, 2014" "%nmhversion%"
+.TH MHSHOW %manext1% "February 18, 2014" "%nmhversion%"
.B mhshow
to wrap things up immediately.
.PP
.B mhshow
to wrap things up immediately.
.PP
+The {charset} escape is typically used in a command line argument that
+should only be present if it has a non-null value. Shell parameter
+expansion can construct the argument only when it is non-null, e.g.,
+.PP
+.RS 5
+.nf
+mhshow-show-text/html: charset="%{charset}";
+ w3m ${charset:+-I $charset} -T text/html %F
+.fi
+.RE
+.PP
+That example also shows the use of indentation to signify continuation:
+the two text lines combine to form a single entry.
+.PP
Note that if the content being displayed is multipart, but not one of
the subtypes listed above, then the f- and F-escapes expand to multiple
filenames, one for each subordinate content. Further, stdin is not
Note that if the content being displayed is multipart, but not one of
the subtypes listed above, then the f- and F-escapes expand to multiple
filenames, one for each subordinate content. Further, stdin is not
-mhshow-show-text/plain: %pmoreproc '%F'
-mhshow-show-message/rfc822: %pshow -file '%F'
+mhshow-show-text/plain: %pmoreproc %F
+mhshow-show-message/rfc822: %pshow -file %F
.RS 5
.nf
mhshow-show-audio/basic: raw2audio 2>/dev/null | play
.RS 5
.nf
mhshow-show-audio/basic: raw2audio 2>/dev/null | play
-mhshow-show-image: xv '%f'
+mhshow-show-image: xv %f
mhshow-show-application/PostScript: lpr -Pps
.fi
.RE
.PP
mhshow-show-application/PostScript: lpr -Pps
.fi
.RE
.PP
-Note that when using the f- or F-escape, it's a good idea to use
-single-quotes around the escape. This prevents misinterpretation by
-the shell of any funny characters that might be present in the filename.
+If an f- or F-escape is not quoted with single quotes, double quotes,
+or backticks, its expansion will be wrapped with single quotes.
for (part = m->mp_parts; part; part = part->mp_next) {
p = part->mp_part;
for (part = m->mp_parts; part; part = part->mp_next) {
p = part->mp_part;
- snprintf (bp, buflen, "%s'%s'", s, p->c_storage);
+ /* Don't quote filename if it's already quoted. Assume
+ it's quoted if previous character was a quote. */
+ if (p->c_storage && (*(p->c_storage-1) == '\'' ||
+ *(p->c_storage-1) == '"' ||
+ *(p->c_storage-1) == '`')) {
+ snprintf (bp, buflen, "%s%s", s, p->c_storage);
+ } else {
+ snprintf (bp, buflen, "%s'%s'", s, p->c_storage);
+ }
+
len = strlen (bp);
bp += len;
buflen -= len;
s = " ";
}
len = strlen (bp);
bp += len;
buflen -= len;
s = " ";
}
- /* set our starting pointer back to bp, to avoid
- * requoting the filenames we just added
- */
- pp = bp;
} else {
/* insert filename containing content */
} else {
/* insert filename containing content */
- snprintf (bp, buflen, "'%s'", file);
+ if (bp > buffer &&
+ (*(bp-1) == '\'' || *(bp-1) == '"' || *(bp-1) == '`')) {
+ /* Don't quote filename if it's already quoted. Assume
+ it's quoted if previous character was a quote. */
+ snprintf (bp, buflen, "%s", file);
+ } else {
+ snprintf (bp, buflen, "'%s'", file);
+ }
+
/* since we've quoted the file argument, set things up
* to look past it, to avoid problems with the quoting
* logic below. (I know, I should figure out what's
* broken with the quoting logic, but..)
*/
len = strlen(bp);
/* since we've quoted the file argument, set things up
* to look past it, to avoid problems with the quoting
* logic below. (I know, I should figure out what's
* broken with the quoting logic, but..)
*/
len = strlen(bp);
+
+ /* set our starting pointer back to bp, to avoid
+ * requoting the filenames we just added
+ */
+ pp = bp;
* broken with the quoting logic, but..)
*/
len = strlen(bp);
* broken with the quoting logic, but..)
*/
len = strlen(bp);