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.
12 SEARCHPATH
="$PATH:/usr/demo/SOUND"
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
29 if [ ! -z "`$SEARCHPROG $SEARCHPATH w3m`" ]; then
30 echo 'mhfixmsg-format-text/html: charset="%{charset}"; '"\
31 "'w3m -dump -T text/html "${charset:+-I $charset}" -O utf-8 %F' >> $TMP
32 elif [ ! -z "`$SEARCHPROG $SEARCHPATH lynx`" ]; then
33 #### lynx indents with 3 spaces, remove them and any trailing spaces.
34 echo 'mhfixmsg-format-text/html: charset="%{charset}"; '"\
35 "'lynx -child -dump -force_html "${charset:+--assume_charset $charset}" %F | '"\
36 expand | sed -e 's/^ //' -e 's/ *$//'" >> $TMP
37 elif [ ! -z "`$SEARCHPROG $SEARCHPATH elinks`" ]; then
38 echo "mhfixmsg-format-text/html: elinks -dump -force-html -no-numbering \
39 -eval 'set document.browse.margin_width = 0' '%F'" >> $TMP
43 echo "mhstore-store-text: %m%P.txt" >> $TMP
44 echo "mhstore-store-text/richtext: %m%P.rt" >> $TMP
45 echo "mhstore-store-video/mpeg: %m%P.mpg" >> $TMP
46 echo "mhstore-store-application/PostScript: %m%P.ps" >> $TMP
48 PGM
="`$SEARCHPROG $SEARCHPATH xwud`"
49 if [ ! -z "$PGM" ]; then
50 XWUD
="$PGM" X11DIR
="`echo $PGM | awk -F/ '{ for(i=2;i<NF;i++)printf "/%s
", $i;}'`"/
55 PGM
="`$SEARCHPROG $SEARCHPATH pnmtoxwd`"
56 if [ ! -z "$PGM" ]; then
57 NETPBM
="$PGM" NETPBMDIR
="`echo $PGM | awk -F/ '{ for(i=2;i<NF;i++)printf "/%s
", $i;}'`"/
62 PGM
="`$SEARCHPROG $SEARCHPATH xv`"
63 if [ ! -z "$PGM" ]; then
64 echo "mhshow-show-image: %p$PGM -geometry =-0+0 '%f'" >> $TMP
65 elif [ ! -z $
"NETPBM" -a ! -z "$XWUD" ]; then
66 echo "mhshow-show-image/gif: %p${NETPBMDIR}giftopnm | ${NETPBMDIR}ppmtopgm | ${NETPBMDIR}pgmtopbm | ${NETPBMDIR}pnmtoxwd | $XWUD -geometry =-0+0" >> $TMP
67 echo "mhshow-show-image/x-pnm: %p${NETPBMDIR}pnmtoxwd | $XWUD -geometry =-0+0" >> $TMP
68 echo "mhshow-show-image/x-pgm: %p${NETPBMDIR}pgmtopbm | ${NETPBMDIR}pnmtoxwd | $XWUD -geometry =-0+0" >> $TMP
69 echo "mhshow-show-image/x-ppm: %p${NETPBMDIR}ppmtopgm | ${NETPBMDIR}pgmtopbm | ${NETPBMDIR}pnmtoxwd | $XWUD -geometry =-0+0" >> $TMP
70 echo "mhshow-show-image/x-xwd: %p$XWUD -geometry =-0+0" >> $TMP
72 PGM
="`$SEARCHPROG $SEARCHPATH djpeg`"
73 if [ ! -z "$PGM" ]; then
74 echo "mhshow-show-image/jpeg: %p$PGM -Pg | ${NETPBMDIR}ppmtopgm | ${NETPBMDIR}pgmtopbm | ${NETPBMDIR}pnmtoxwd | $XWUD -geometry =-0+0" >> $TMP
78 if [ -f "/dev/audioIU" ]; then
79 PGM
="`$SEARCHPROG $SEARCHPATH recorder`"
80 if [ ! -z "$PGM" ]; then
81 echo "mhstore-store-audio/basic: %m%P.au" >> $TMP
82 echo "mhbuild-compose-audio/basic: ${AUDIODIR}recorder '%f' -au -pause > /dev/tty" >> $TMP
83 echo "mhshow-show-audio/basic: %p${AUDIODIR}splayer -au" >> $TMP
85 elif [ -f "/dev/audio" ]; then
86 PGM
="`$SEARCHPROG $SEARCHPATH raw2audio`"
87 if [ ! -z "$PGM" ]; then
88 AUDIODIR
="`echo $PGM | awk -F/ '{ for(i=2;i<NF;i++)printf "/%s
", $i;}'`"/
89 echo "mhstore-store-audio/basic: | ${AUDIODIR}raw2audio -e ulaw -s 8000 -c 1 > %m%P.au" >> $TMP
90 echo "mhstore-store-audio/x-next: %m%P.au" >> $TMP
91 AUDIOTOOL
="`$SEARCHPROG $SEARCHPATH audiotool`"
92 if [ ! -z "$AUDIOTOOL" ]; then
93 echo "mhbuild-compose-audio/basic: $AUDIOTOOL '%f' && ${AUDIODIR}raw2audio -F < '%f'" >> $TMP
95 echo "mhbuild-compose-audio/basic: trap \"exit 0\" 2 && ${AUDIODIR}record | ${AUDIODIR}raw2audio -F" >> $TMP
97 echo "mhshow-show-audio/basic: %p${AUDIODIR}raw2audio 2>/dev/null | ${AUDIODIR}play" >> $TMP
99 PGM
="`$SEARCHPROG $SEARCHPATH adpcm_enc`"
100 if [ ! -z "$PGM" ]; then
101 DIR
="`echo $PGM | awk -F/ '{ for(i=2;i<NF;i++)printf "/%s
", $i;}'`"/
102 if [ ! -z "$AUDIOTOOL" ]; then
103 echo "mhbuild-compose-audio/x-next: $AUDIOTOOL '%f' && ${DIR}adpcm_enc < '%f'" >> $TMP
105 echo "mhbuild-compose-audio/x-next: ${AUDIODIR}record | ${DIR}adpcm_enc" >> $TMP
107 echo "mhshow-show-audio/x-next: %p${DIR}adpcm_dec | ${AUDIODIR}play" >> $TMP
109 if [ ! -z "$AUDIOTOOL" ]; then
110 echo "mhbuild-compose-audio/x-next: $AUDIOTOOL '%f'" >> $TMP
112 echo "mhbuild-compose-audio/x-next: ${AUDIODIR}record" >> $TMP
114 echo "mhshow-show-audio/x-next: %p${AUDIODIR}play" >> $TMP
117 echo "mhbuild-compose-audio/basic: cat < /dev/audio" >> $TMP
118 echo "mhshow-show-audio/basic: %pcat > /dev/audio" >> $TMP
122 PGM
="`$SEARCHPROG $SEARCHPATH mpeg_play`"
123 if [ ! -z "$PGM" ]; then
124 echo "mhshow-show-video/mpeg: %p$PGM '%f'" >> $TMP
127 PGM
="`$SEARCHPROG $SEARCHPATH okular`"
128 if [ ! -z "$PGM" ]; then
129 echo "mhshow-show-application/PostScript: %pokular '%F'" >> $TMP
131 PGM
="`$SEARCHPROG $SEARCHPATH evince`"
132 if [ ! -z "$PGM" ]; then
133 echo "mhshow-show-application/PostScript: %pevince '%F'" >> $TMP
135 PGM
="`$SEARCHPROG $SEARCHPATH gv`"
136 if [ ! -z "$PGM" ]; then
137 echo "mhshow-show-application/PostScript: %pgv '%F'" >> $TMP
142 PGM
="`$SEARCHPROG $SEARCHPATH ivs_replay`"
143 if [ ! -z "$PGM" ]; then
144 echo "mhshow-show-application/x-ivs: %p$PGM -o '%F'" >> $TMP
147 # The application/vnd.openxmlformats-officedocument.wordprocessingml.document
148 # through application/onenote associations are from
149 # http://technet.microsoft.com/en-us/library/cc179224.aspx
152 mhshow-suffix-application/msword: .doc
153 mhshow-suffix-application/ogg: .ogg
154 mhshow-suffix-application/pdf: .pdf
155 mhshow-suffix-application/postscript: .ps
156 mhshow-suffix-application/rtf: .rtf
157 mhshow-suffix-application/vnd.ms-excel: .xla
158 mhshow-suffix-application/vnd.ms-excel: .xlc
159 mhshow-suffix-application/vnd.ms-excel: .xld
160 mhshow-suffix-application/vnd.ms-excel: .xll
161 mhshow-suffix-application/vnd.ms-excel: .xlm
162 mhshow-suffix-application/vnd.ms-excel: .xls
163 mhshow-suffix-application/vnd.ms-excel: .xlt
164 mhshow-suffix-application/vnd.ms-excel: .xlw
165 mhshow-suffix-application/vnd.ms-powerpoint: .pot
166 mhshow-suffix-application/vnd.ms-powerpoint: .pps
167 mhshow-suffix-application/vnd.ms-powerpoint: .ppt
168 mhshow-suffix-application/vnd.ms-powerpoint: .ppz
169 mhshow-suffix-application/vnd.openxmlformats-officedocument.wordprocessingml.document: .docx
170 mhshow-suffix-application/vnd.ms-word.document.macroEnabled.12: .docm
171 mhshow-suffix-application/vnd.openxmlformats-officedocument.wordprocessingml.template: .dotx
172 mhshow-suffix-application/vnd.ms-word.template.macroEnabled.12: .dotm
173 mhshow-suffix-application/vnd.openxmlformats-officedocument.spreadsheetml.sheet: .xlsx
174 mhshow-suffix-application/vnd.ms-excel.sheet.macroEnabled.12: .xlsm
175 mhshow-suffix-application/vnd.openxmlformats-officedocument.spreadsheetml.template: .xltx
176 mhshow-suffix-application/vnd.ms-excel.template.macroEnabled.12: .xltm
177 mhshow-suffix-application/vnd.ms-excel.sheet.binary.macroEnabled.12: .xlsb
178 mhshow-suffix-application/vnd.ms-excel.addin.macroEnabled.12: .xlam
179 mhshow-suffix-application/vnd.openxmlformats-officedocument.presentationml.presentation: .pptx
180 mhshow-suffix-application/vnd.ms-powerpoint.presentation.macroEnabled.12: .pptm
181 mhshow-suffix-application/vnd.openxmlformats-officedocument.presentationml.slideshow: .ppsx
182 mhshow-suffix-application/vnd.ms-powerpoint.slideshow.macroEnabled.12: .ppsm
183 mhshow-suffix-application/vnd.openxmlformats-officedocument.presentationml.template: .potx
184 mhshow-suffix-application/vnd.ms-powerpoint.template.macroEnabled.12: .potm
185 mhshow-suffix-application/vnd.ms-powerpoint.addin.macroEnabled.12: .ppam
186 mhshow-suffix-application/vnd.openxmlformats-officedocument.presentationml.slide: .sldx
187 mhshow-suffix-application/vnd.ms-powerpoint.slide.macroEnabled.12: .sldm
188 mhshow-suffix-application/onenote: .onetoc
189 mhshow-suffix-application/onenote: .onetoc2
190 mhshow-suffix-application/onenote: .onetmp
191 mhshow-suffix-application/onenote: .onepkg
192 mhshow-suffix-application/x-bzip2: .bz2
193 mhshow-suffix-application/x-cpio: .cpio
194 mhshow-suffix-application/x-dvi: .dvi
195 mhshow-suffix-application/x-gzip: .gz
196 mhshow-suffix-application/x-java-archive: .jar
197 mhshow-suffix-application/x-javascript: .js
198 mhshow-suffix-application/x-latex: .latex
199 mhshow-suffix-application/x-sh: .sh
200 mhshow-suffix-application/x-tar: .tar
201 mhshow-suffix-application/x-texinfo: .texinfo
202 mhshow-suffix-application/x-tex: .tex
203 mhshow-suffix-application/x-troff-man: .man
204 mhshow-suffix-application/x-troff-me: .me
205 mhshow-suffix-application/x-troff-ms: .ms
206 mhshow-suffix-application/x-troff: .t
207 mhshow-suffix-application/zip: .zip
208 mhshow-suffix-audio/basic: .au
209 mhshow-suffix-audio/midi: .midi
210 mhshow-suffix-audio/mpeg: .mp3
211 mhshow-suffix-audio/mpeg: .mpg
212 mhshow-suffix-audio/x-ms-wma: .wma
213 mhshow-suffix-audio/x-wav: .wav
214 mhshow-suffix-image/gif: .gif
215 mhshow-suffix-image/jpeg: .jpeg
216 mhshow-suffix-image/jpeg: .jpg
217 mhshow-suffix-image/png: .png
218 mhshow-suffix-image/tiff: .tif
219 mhshow-suffix-image/tiff: .tiff
220 mhshow-suffix-text/calendar: .ics
221 mhshow-suffix-text/css: .css
222 mhshow-suffix-text/html: .html
223 mhshow-suffix-text/rtf: .rtf
224 mhshow-suffix-text/sgml: .sgml
225 mhshow-suffix-text/xml: .xml
226 mhshow-suffix-video/mpeg: .mpeg
227 mhshow-suffix-video/mpeg: .mpg
228 mhshow-suffix-video/quicktime: .moov
229 mhshow-suffix-video/quicktime: .mov
230 mhshow-suffix-video/quicktime: .qt
231 mhshow-suffix-video/quicktime: .qtvr
232 mhshow-suffix-video/x-msvideo: .avi
233 mhshow-suffix-video/x-ms-wmv: .wmv
236 # I'd like to check if netscape is available and use it preferentially to lynx,
237 # but only once I've added a new %-escape that makes more permanent temp files,
238 # so netscape -remote can be used (without -remote you get a complaint dialog
239 # that another netscape is already running and certain things can't be done).
240 PGM
="`$SEARCHPROG $SEARCHPATH lynx`"
241 if [ ! -z "$PGM" ]; then
242 echo 'mhshow-show-text/html: charset="%{charset}"; '"\
243 %p$PGM"' -force-html "${charset:+--assume_charset $charset}" %F' >> $TMP
245 PGM
="`$SEARCHPROG $SEARCHPATH w3m`"
246 if [ ! -z "$PGM" ]; then
247 echo 'mhshow-show-text/html: charset="%{charset}"; '"\
248 %p$PGM"' "${charset:+-I $charset}" -T text/html %F' >> $TMP
252 PGM
="`$SEARCHPROG $SEARCHPATH richtext`"
253 if [ ! -z "$PGM" ]; then
254 echo "mhshow-show-text/richtext: %p$PGM -p '%F'" >> $TMP
256 PGM
="`$SEARCHPROG $SEARCHPATH rt2raw`"
257 if [ ! -z "$PGM" ]; then
258 echo "mhshow-show-text/richtext: %p$PGM < '%f' | fmt -78 | more" >> $TMP
262 # staroffice to read .doc files
263 PGM
="`$SEARCHPROG $SEARCHPATH soffice`"
264 if [ ! -z "$PGM" ]; then
265 echo "mhshow-show-application/msword: %psoffice '%F'" >> $TMP
266 echo "mhshow-suffix-application/msword: .doc" >> $TMP
269 # output a sorted version of the file
274 : not
until we get a
"safe" postscript environment...
276 PGM
="`$SEARCHPROG $SEARCHPATH pageview`"
277 if [ "$DISPLAY" = "unix:0.0" -a ! -z "$PGM" ]; then
278 echo "mhshow-show-application/PostScript: %p$PGM -" >> $TMP
280 PGM
="`$SEARCHPROG $SEARCHPATH gs`"
281 if [ ! -z "$PGM" ]; then
282 echo "mhshow-show-application/PostScript: %p$PGM -- '%F'" >> $TMP
283 echo "mhshow-suffix-application/PostScript: .ps" >> $TMP
287 : have to experiment
more with this
289 PGM
="`$SEARCHPROG $SEARCHPATH ivs_record`"
290 if [ ! -z "$PGM" ]; then
291 echo "mhbuild-compose-application/x-ivs: $PGM -u localhost '%F'" >> $TMP