]>
diplodocus.org Git - nmh/blob - etc/mhn.defaults.sh
3 # mhn.defaults.sh -- create extra profile file for MIME handling
5 # USAGE: mhn.defaults.sh [ search-path [ search-prog ]]
7 # If a search path is passed to the script, we
8 # use that, else we use a default search path.
15 # If a search program is passed to the script, we
16 # use that, else we use a default search program.
20 SEARCHPROG
="mhn.find.sh"
23 # put output into a temporary file, so we
24 # can sort it before output.
26 trap "rm -f $TMP" 0 1 2 3 13 15
28 PGM
=`$SEARCHPROG "$SEARCHPATH" w3m`
29 if [ ! -z "$PGM" ]; then
30 echo 'mhfixmsg-format-text/html: charset=%{charset}; '"\
31 $PGM "'-dump ${charset:+-I "$charset"} -O utf-8 -T text/html %F' >> $TMP
33 PGM
=`$SEARCHPROG "$SEARCHPATH" lynx`
34 if [ ! -z "$PGM" ]; then
35 #### lynx indents with 3 spaces, remove them and any trailing spaces.
36 echo 'mhfixmsg-format-text/html: charset=%{charset}; '"\
37 $PGM "'-child -dump -force_html ${charset:+--assume_charset "$charset"} %F | '"\
38 expand | sed -e 's/^ //' -e 's/ *$//'" >> $TMP
40 PGM
=`$SEARCHPROG "$SEARCHPATH" elinks`
41 if [ ! -z "$PGM" ]; then
42 echo "mhfixmsg-format-text/html: $PGM -dump -force-html \
43 -no-numbering -eval 'set document.browse.margin_width = 0' %F" >> $TMP
48 echo "mhstore-store-text: %m%P.txt" >> $TMP
49 echo "mhstore-store-text/html: %m%P.html" >> $TMP
50 echo "mhstore-store-text/richtext: %m%P.rt" >> $TMP
51 echo "mhstore-store-video/mpeg: %m%P.mpg" >> $TMP
52 echo "mhstore-store-application/PostScript: %m%P.ps" >> $TMP
54 PGM
=`$SEARCHPROG "$SEARCHPATH" xwud`
55 if [ ! -z "$PGM" ]; then
56 XWUD
="$PGM" X11DIR
="`echo $PGM | awk -F/ '{ for(i=2;i<NF;i++)printf "/%s
", $i;}'`"/
61 PGM
=`$SEARCHPROG "$SEARCHPATH" pnmtoxwd`
62 if [ ! -z "$PGM" ]; then
63 NETPBM
="$PGM" NETPBMDIR
="`echo $PGM | awk -F/ '{ for(i=2;i<NF;i++)printf "/%s
", $i;}'`"/
68 PGM
=`$SEARCHPROG "$SEARCHPATH" xv`
69 if [ ! -z "$PGM" ]; then
70 echo "mhshow-show-image: %l$PGM -geometry =-0+0 %f" >> $TMP
71 elif [ ! -z $
"NETPBM" -a ! -z "$XWUD" ]; then
72 echo "mhshow-show-image/gif: %l${NETPBMDIR}giftopnm | ${NETPBMDIR}ppmtopgm | ${NETPBMDIR}pgmtopbm | ${NETPBMDIR}pnmtoxwd | $XWUD -geometry =-0+0" >> $TMP
73 echo "mhshow-show-image/x-pnm: %l${NETPBMDIR}pnmtoxwd | $XWUD -geometry =-0+0" >> $TMP
74 echo "mhshow-show-image/x-pgm: %l${NETPBMDIR}pgmtopbm | ${NETPBMDIR}pnmtoxwd | $XWUD -geometry =-0+0" >> $TMP
75 echo "mhshow-show-image/x-ppm: %l${NETPBMDIR}ppmtopgm | ${NETPBMDIR}pgmtopbm | ${NETPBMDIR}pnmtoxwd | $XWUD -geometry =-0+0" >> $TMP
76 echo "mhshow-show-image/x-xwd: %l$XWUD -geometry =-0+0" >> $TMP
78 PGM
=`$SEARCHPROG "$SEARCHPATH" djpeg`
79 if [ ! -z "$PGM" ]; then
80 echo "mhshow-show-image/jpeg: %l$PGM -Pg | ${NETPBMDIR}ppmtopgm | ${NETPBMDIR}pgmtopbm | ${NETPBMDIR}pnmtoxwd | $XWUD -geometry =-0+0" >> $TMP
84 if [ -f "/dev/audioIU" ]; then
85 PGM
=`$SEARCHPROG "$SEARCHPATH" recorder`
86 if [ ! -z "$PGM" ]; then
87 echo "mhstore-store-audio/basic: %m%P.au" >> $TMP
88 echo "mhbuild-compose-audio/basic: ${AUDIODIR}recorder %f -au -pause > /dev/tty" >> $TMP
89 echo "mhshow-show-audio/basic: %l${AUDIODIR}splayer -au" >> $TMP
91 elif [ -f "/dev/audio" ]; then
92 PGM
=`$SEARCHPROG "$SEARCHPATH" raw2audio`
93 if [ ! -z "$PGM" ]; then
94 AUDIODIR
="`echo $PGM | awk -F/ '{ for(i=2;i<NF;i++)printf "/%s
", $i;}'`"/
95 echo "mhstore-store-audio/basic: | ${AUDIODIR}raw2audio -e ulaw -s 8000 -c 1 > %m%P.au" >> $TMP
96 echo "mhstore-store-audio/x-next: %m%P.au" >> $TMP
97 AUDIOTOOL
=`$SEARCHPROG "$SEARCHPATH" audiotool`
98 if [ ! -z "$AUDIOTOOL" ]; then
99 echo "mhbuild-compose-audio/basic: $AUDIOTOOL %f && ${AUDIODIR}raw2audio -F < %f" >> $TMP
101 echo "mhbuild-compose-audio/basic: trap \"exit 0\" 2 && ${AUDIODIR}record | ${AUDIODIR}raw2audio -F" >> $TMP
103 echo "mhshow-show-audio/basic: %l${AUDIODIR}raw2audio 2>/dev/null | ${AUDIODIR}play" >> $TMP
105 PGM
=`$SEARCHPROG "$SEARCHPATH" adpcm_enc`
106 if [ ! -z "$PGM" ]; then
107 DIR
="`echo $PGM | awk -F/ '{ for(i=2;i<NF;i++)printf "/%s
", $i;}'`"/
108 if [ ! -z "$AUDIOTOOL" ]; then
109 echo "mhbuild-compose-audio/x-next: $AUDIOTOOL %f && ${DIR}adpcm_enc < %f" >> $TMP
111 echo "mhbuild-compose-audio/x-next: ${AUDIODIR}record | ${DIR}adpcm_enc" >> $TMP
113 echo "mhshow-show-audio/x-next: %l${DIR}adpcm_dec | ${AUDIODIR}play" >> $TMP
115 if [ ! -z "$AUDIOTOOL" ]; then
116 echo "mhbuild-compose-audio/x-next: $AUDIOTOOL %f" >> $TMP
118 echo "mhbuild-compose-audio/x-next: ${AUDIODIR}record" >> $TMP
120 echo "mhshow-show-audio/x-next: %l${AUDIODIR}play" >> $TMP
123 echo "mhbuild-compose-audio/basic: cat < /dev/audio" >> $TMP
124 echo "mhshow-show-audio/basic: %lcat > /dev/audio" >> $TMP
129 #### mhbuild-disposition-<type>[/<subtype>] entries are used by the
130 #### WhatNow attach for deciding whether the Content-Disposition
131 #### should be 'attachment' or 'inline'. Only those values are
135 mhbuild-disposition-text/calendar: inline
136 mhbuild-disposition-message/rfc822: inline
139 PGM
=`$SEARCHPROG "$SEARCHPATH" mpeg_play`
140 if [ ! -z "$PGM" ]; then
141 echo "mhshow-show-video/mpeg: %l$PGM %f" >> $TMP
144 PGM
=`$SEARCHPROG "$SEARCHPATH" okular`
145 if [ ! -z "$PGM" ]; then
146 echo "mhshow-show-application/PostScript: %l$PGM %F" >> $TMP
148 PGM
=`$SEARCHPROG "$SEARCHPATH" evince`
149 if [ ! -z "$PGM" ]; then
150 echo "mhshow-show-application/PostScript: %l$PGM %F" >> $TMP
152 PGM
=`$SEARCHPROG "$SEARCHPATH" gv`
153 if [ ! -z "$PGM" ]; then
154 echo "mhshow-show-application/PostScript: %l$PGM %F" >> $TMP
159 PGM
=`$SEARCHPROG "$SEARCHPATH" acroread`
160 if [ ! -z "$PGM" ]; then
161 echo "mhshow-show-application/pdf: %l$PGM %F" >> $TMP
163 PGM
=`$SEARCHPROG "$SEARCHPATH" okular`
164 if [ ! -z "$PGM" ]; then
165 echo "mhshow-show-application/pdf: %l$PGM %F" >> $TMP
167 PGM
=`$SEARCHPROG "$SEARCHPATH" evince`
168 if [ ! -z "$PGM" ]; then
169 echo "mhshow-show-application/pdf: %l$PGM %F" >> $TMP
171 PGM
=`$SEARCHPROG "$SEARCHPATH" xpdf`
172 if [ ! -z "$PGM" ]; then
173 echo "mhshow-show-application/pdf: %l$PGM %F" >> $TMP
175 PGM
=`$SEARCHPROG "$SEARCHPATH" gv`
176 if [ ! -z "$PGM" ]; then
177 echo "mhshow-show-application/pdf: %l$PGM %F" >> $TMP
184 PGM
=`$SEARCHPROG "$SEARCHPATH" ivs_replay`
185 if [ ! -z "$PGM" ]; then
186 echo "mhshow-show-application/x-ivs: %l$PGM -o %F" >> $TMP
189 # The application/vnd.openxmlformats-officedocument.wordprocessingml.document
190 # through application/onenote associations are from
191 # http://technet.microsoft.com/en-us/library/cc179224.aspx
194 mhshow-suffix-application/msword: .doc
195 mhshow-suffix-application/ogg: .ogg
196 mhshow-suffix-application/pdf: .pdf
197 mhshow-suffix-application/postscript: .ps
198 mhshow-suffix-application/rtf: .rtf
199 mhshow-suffix-application/vnd.ms-excel: .xla
200 mhshow-suffix-application/vnd.ms-excel: .xlc
201 mhshow-suffix-application/vnd.ms-excel: .xld
202 mhshow-suffix-application/vnd.ms-excel: .xll
203 mhshow-suffix-application/vnd.ms-excel: .xlm
204 mhshow-suffix-application/vnd.ms-excel: .xls
205 mhshow-suffix-application/vnd.ms-excel: .xlt
206 mhshow-suffix-application/vnd.ms-excel: .xlw
207 mhshow-suffix-application/vnd.ms-powerpoint: .pot
208 mhshow-suffix-application/vnd.ms-powerpoint: .pps
209 mhshow-suffix-application/vnd.ms-powerpoint: .ppt
210 mhshow-suffix-application/vnd.ms-powerpoint: .ppz
211 mhshow-suffix-application/vnd.openxmlformats-officedocument.wordprocessingml.document: .docx
212 mhshow-suffix-application/vnd.ms-word.document.macroEnabled.12: .docm
213 mhshow-suffix-application/vnd.openxmlformats-officedocument.wordprocessingml.template: .dotx
214 mhshow-suffix-application/vnd.ms-word.template.macroEnabled.12: .dotm
215 mhshow-suffix-application/vnd.openxmlformats-officedocument.spreadsheetml.sheet: .xlsx
216 mhshow-suffix-application/vnd.ms-excel.sheet.macroEnabled.12: .xlsm
217 mhshow-suffix-application/vnd.openxmlformats-officedocument.spreadsheetml.template: .xltx
218 mhshow-suffix-application/vnd.ms-excel.template.macroEnabled.12: .xltm
219 mhshow-suffix-application/vnd.ms-excel.sheet.binary.macroEnabled.12: .xlsb
220 mhshow-suffix-application/vnd.ms-excel.addin.macroEnabled.12: .xlam
221 mhshow-suffix-application/vnd.openxmlformats-officedocument.presentationml.presentation: .pptx
222 mhshow-suffix-application/vnd.ms-powerpoint.presentation.macroEnabled.12: .pptm
223 mhshow-suffix-application/vnd.openxmlformats-officedocument.presentationml.slideshow: .ppsx
224 mhshow-suffix-application/vnd.ms-powerpoint.slideshow.macroEnabled.12: .ppsm
225 mhshow-suffix-application/vnd.openxmlformats-officedocument.presentationml.template: .potx
226 mhshow-suffix-application/vnd.ms-powerpoint.template.macroEnabled.12: .potm
227 mhshow-suffix-application/vnd.ms-powerpoint.addin.macroEnabled.12: .ppam
228 mhshow-suffix-application/vnd.openxmlformats-officedocument.presentationml.slide: .sldx
229 mhshow-suffix-application/vnd.ms-powerpoint.slide.macroEnabled.12: .sldm
230 mhshow-suffix-application/onenote: .onetoc
231 mhshow-suffix-application/onenote: .onetoc2
232 mhshow-suffix-application/onenote: .onetmp
233 mhshow-suffix-application/onenote: .onepkg
234 mhshow-suffix-application/x-bzip2: .bz2
235 mhshow-suffix-application/x-cpio: .cpio
236 mhshow-suffix-application/x-dvi: .dvi
237 mhshow-suffix-application/x-gzip: .gz
238 mhshow-suffix-application/x-java-archive: .jar
239 mhshow-suffix-application/x-javascript: .js
240 mhshow-suffix-application/x-latex: .latex
241 mhshow-suffix-application/x-sh: .sh
242 mhshow-suffix-application/x-tar: .tar
243 mhshow-suffix-application/x-texinfo: .texinfo
244 mhshow-suffix-application/x-tex: .tex
245 mhshow-suffix-application/x-troff-man: .man
246 mhshow-suffix-application/x-troff-me: .me
247 mhshow-suffix-application/x-troff-ms: .ms
248 mhshow-suffix-application/x-troff: .t
249 mhshow-suffix-application/zip: .zip
250 mhshow-suffix-audio/basic: .au
251 mhshow-suffix-audio/midi: .midi
252 mhshow-suffix-audio/mpeg: .mp3
253 mhshow-suffix-audio/mpeg: .mpg
254 mhshow-suffix-audio/x-ms-wma: .wma
255 mhshow-suffix-audio/x-wav: .wav
256 mhshow-suffix-image/gif: .gif
257 mhshow-suffix-image/jpeg: .jpeg
258 mhshow-suffix-image/jpeg: .jpg
259 mhshow-suffix-image/png: .png
260 mhshow-suffix-image/tiff: .tif
261 mhshow-suffix-image/tiff: .tiff
262 mhshow-suffix-text/calendar: .ics
263 mhshow-suffix-text/css: .css
264 mhshow-suffix-text/html: .html
265 mhshow-suffix-text/rtf: .rtf
266 mhshow-suffix-text/sgml: .sgml
267 mhshow-suffix-text/xml: .xml
268 mhshow-suffix-video/mpeg: .mpeg
269 mhshow-suffix-video/mpeg: .mpg
270 mhshow-suffix-video/quicktime: .moov
271 mhshow-suffix-video/quicktime: .mov
272 mhshow-suffix-video/quicktime: .qt
273 mhshow-suffix-video/quicktime: .qtvr
274 mhshow-suffix-video/x-msvideo: .avi
275 mhshow-suffix-video/x-ms-wmv: .wmv
278 # I'd like to check if netscape is available and use it preferentially to lynx,
279 # but only once I've added a new %-escape that makes more permanent temp files,
280 # so netscape -remote can be used (without -remote you get a complaint dialog
281 # that another netscape is already running and certain things can't be done).
282 PGM
=`$SEARCHPROG "$SEARCHPATH" w3m`
283 if [ ! -z "$PGM" ]; then
284 echo 'mhshow-show-text/html: charset=%{charset}; '"\
285 %l$PGM"' -dump ${charset:+-I "$charset"} -T text/html %F' >> $TMP
287 PGM
=`$SEARCHPROG "$SEARCHPATH" lynx`
288 if [ ! -z "$PGM" ]; then
289 echo 'mhshow-show-text/html: charset=%{charset}; '"\
290 %l$PGM"' -child -dump -force-html ${charset:+--assume_charset "$charset"} %F' >> $TMP
292 PGM
=`$SEARCHPROG "$SEARCHPATH" elinks`
293 if [ ! -z "$PGM" ]; then
294 echo "mhshow-show-text/html: $PGM -dump -force-html \
295 -eval 'set document.browse.margin_width = 0' %F" >> $TMP
300 PGM
=`$SEARCHPROG "$SEARCHPATH" richtext`
301 if [ ! -z "$PGM" ]; then
302 echo "mhshow-show-text/richtext: %l$PGM -p %F" >> $TMP
304 PGM
=`$SEARCHPROG "$SEARCHPATH" rt2raw`
305 if [ ! -z "$PGM" ]; then
306 echo "mhshow-show-text/richtext: %l$PGM < %f | fmt -78 | more" >> $TMP
310 # staroffice to read .doc files
311 PGM
=`$SEARCHPROG "$SEARCHPATH" soffice`
312 if [ ! -z "$PGM" ]; then
313 echo "mhshow-show-application/msword: %l$PGM %F" >> $TMP
316 # This entry is used to retrieve external-body types that use a "url"
320 echo "nmh-access-url: fetch -o -" >> $TMP
323 PGM
=`$SEARCHPROG "$SEARCHPATH" curl`
324 if [ ! -z "$PGM" ]; then
325 echo "nmh-access-url: $PGM -L" >> $TMP
330 # output a sorted version of the file
336 ###############################################################################
337 ###############################################################################
339 #### Note the exit 0 above; everything below is unused.
341 ###############################################################################
342 ###############################################################################
344 : have to experiment
more with this
346 PGM
=`$SEARCHPROG "$SEARCHPATH" ivs_record`
347 if [ ! -z "$PGM" ]; then
348 echo "mhbuild-compose-application/x-ivs: $PGM -u localhost %F" >> $TMP