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