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 '%F'" >> $TMP
40 echo "mhstore-store-text: %m%P.txt" >> $TMP
41 echo "mhstore-store-text/richtext: %m%P.rt" >> $TMP
42 echo "mhstore-store-video/mpeg: %m%P.mpg" >> $TMP
43 echo "mhstore-store-application/PostScript: %m%P.ps" >> $TMP
45 PGM
="`$SEARCHPROG $SEARCHPATH xwud`"
46 if [ ! -z "$PGM" ]; then
47 XWUD
="$PGM" X11DIR
="`echo $PGM | awk -F/ '{ for(i=2;i<NF;i++)printf "/%s
", $i;}'`"/
52 PGM
="`$SEARCHPROG $SEARCHPATH pnmtoxwd`"
53 if [ ! -z "$PGM" ]; then
54 NETPBM
="$PGM" NETPBMDIR
="`echo $PGM | awk -F/ '{ for(i=2;i<NF;i++)printf "/%s
", $i;}'`"/
59 PGM
="`$SEARCHPROG $SEARCHPATH xv`"
60 if [ ! -z "$PGM" ]; then
61 echo "mhshow-show-image: %p$PGM -geometry =-0+0 '%f'" >> $TMP
62 elif [ ! -z $
"NETPBM" -a ! -z "$XWUD" ]; then
63 echo "mhshow-show-image/gif: %p${NETPBMDIR}giftopnm | ${NETPBMDIR}ppmtopgm | ${NETPBMDIR}pgmtopbm | ${NETPBMDIR}pnmtoxwd | $XWUD -geometry =-0+0" >> $TMP
64 echo "mhshow-show-image/x-pnm: %p${NETPBMDIR}pnmtoxwd | $XWUD -geometry =-0+0" >> $TMP
65 echo "mhshow-show-image/x-pgm: %p${NETPBMDIR}pgmtopbm | ${NETPBMDIR}pnmtoxwd | $XWUD -geometry =-0+0" >> $TMP
66 echo "mhshow-show-image/x-ppm: %p${NETPBMDIR}ppmtopgm | ${NETPBMDIR}pgmtopbm | ${NETPBMDIR}pnmtoxwd | $XWUD -geometry =-0+0" >> $TMP
67 echo "mhshow-show-image/x-xwd: %p$XWUD -geometry =-0+0" >> $TMP
69 PGM
="`$SEARCHPROG $SEARCHPATH djpeg`"
70 if [ ! -z "$PGM" ]; then
71 echo "mhshow-show-image/jpeg: %p$PGM -Pg | ${NETPBMDIR}ppmtopgm | ${NETPBMDIR}pgmtopbm | ${NETPBMDIR}pnmtoxwd | $XWUD -geometry =-0+0" >> $TMP
75 if [ -f "/dev/audioIU" ]; then
76 PGM
="`$SEARCHPROG $SEARCHPATH recorder`"
77 if [ ! -z "$PGM" ]; then
78 echo "mhstore-store-audio/basic: %m%P.au" >> $TMP
79 echo "mhbuild-compose-audio/basic: ${AUDIODIR}recorder '%f' -au -pause > /dev/tty" >> $TMP
80 echo "mhshow-show-audio/basic: %p${AUDIODIR}splayer -au" >> $TMP
82 elif [ -f "/dev/audio" ]; then
83 PGM
="`$SEARCHPROG $SEARCHPATH raw2audio`"
84 if [ ! -z "$PGM" ]; then
85 AUDIODIR
="`echo $PGM | awk -F/ '{ for(i=2;i<NF;i++)printf "/%s
", $i;}'`"/
86 echo "mhstore-store-audio/basic: | ${AUDIODIR}raw2audio -e ulaw -s 8000 -c 1 > %m%P.au" >> $TMP
87 echo "mhstore-store-audio/x-next: %m%P.au" >> $TMP
88 AUDIOTOOL
="`$SEARCHPROG $SEARCHPATH audiotool`"
89 if [ ! -z "$AUDIOTOOL" ]; then
90 echo "mhbuild-compose-audio/basic: $AUDIOTOOL '%f' && ${AUDIODIR}raw2audio -F < '%f'" >> $TMP
92 echo "mhbuild-compose-audio/basic: trap \"exit 0\" 2 && ${AUDIODIR}record | ${AUDIODIR}raw2audio -F" >> $TMP
94 echo "mhshow-show-audio/basic: %p${AUDIODIR}raw2audio 2>/dev/null | ${AUDIODIR}play" >> $TMP
96 PGM
="`$SEARCHPROG $SEARCHPATH adpcm_enc`"
97 if [ ! -z "$PGM" ]; then
98 DIR
="`echo $PGM | awk -F/ '{ for(i=2;i<NF;i++)printf "/%s
", $i;}'`"/
99 if [ ! -z "$AUDIOTOOL" ]; then
100 echo "mhbuild-compose-audio/x-next: $AUDIOTOOL '%f' && ${DIR}adpcm_enc < '%f'" >> $TMP
102 echo "mhbuild-compose-audio/x-next: ${AUDIODIR}record | ${DIR}adpcm_enc" >> $TMP
104 echo "mhshow-show-audio/x-next: %p${DIR}adpcm_dec | ${AUDIODIR}play" >> $TMP
106 if [ ! -z "$AUDIOTOOL" ]; then
107 echo "mhbuild-compose-audio/x-next: $AUDIOTOOL '%f'" >> $TMP
109 echo "mhbuild-compose-audio/x-next: ${AUDIODIR}record" >> $TMP
111 echo "mhshow-show-audio/x-next: %p${AUDIODIR}play" >> $TMP
114 echo "mhbuild-compose-audio/basic: cat < /dev/audio" >> $TMP
115 echo "mhshow-show-audio/basic: %pcat > /dev/audio" >> $TMP
119 PGM
="`$SEARCHPROG $SEARCHPATH mpeg_play`"
120 if [ ! -z "$PGM" ]; then
121 echo "mhshow-show-video/mpeg: %p$PGM '%f'" >> $TMP
124 PGM
="`$SEARCHPROG $SEARCHPATH lpr`"
125 if [ ! -z "$PGM" ]; then
126 echo "mhshow-show-application/PostScript: %plpr -Pps" >> $TMP
128 PGM
="`$SEARCHPROG $SEARCHPATH lp`"
129 if [ ! -z "$PGM" ]; then
130 echo "mhshow-show-application/PostScript: %plp -dps" >> $TMP
134 PGM
="`$SEARCHPROG $SEARCHPATH ivs_replay`"
135 if [ ! -z "$PGM" ]; then
136 echo "mhshow-show-application/x-ivs: %p$PGM -o '%F'" >> $TMP
140 mhshow-suffix-application/msword: .doc
141 mhshow-suffix-application/msword: .docx
142 mhshow-suffix-application/ogg: .ogg
143 mhshow-suffix-application/pdf: .pdf
144 mhshow-suffix-application/postscript: .ps
145 mhshow-suffix-application/rtf: .rtf
146 mhshow-suffix-application/vnd.ms-excel: .xla
147 mhshow-suffix-application/vnd.ms-excel: .xlc
148 mhshow-suffix-application/vnd.ms-excel: .xld
149 mhshow-suffix-application/vnd.ms-excel: .xll
150 mhshow-suffix-application/vnd.ms-excel: .xlm
151 mhshow-suffix-application/vnd.ms-excel: .xls
152 mhshow-suffix-application/vnd.openxmlformats-officedocument.spreadsheetml.sheet: .xlsx
153 mhshow-suffix-application/vnd.ms-excel: .xlt
154 mhshow-suffix-application/vnd.ms-excel: .xlw
155 mhshow-suffix-application/vnd.ms-powerpoint: .pot
156 mhshow-suffix-application/vnd.ms-powerpoint: .pps
157 mhshow-suffix-application/vnd.ms-powerpoint: .ppt
158 mhshow-suffix-application/vnd.ms-powerpoint: .ppz
159 mhshow-suffix-application/x-bzip2: .bz2
160 mhshow-suffix-application/x-cpio: .cpio
161 mhshow-suffix-application/x-dvi: .dvi
162 mhshow-suffix-application/x-gzip: .gz
163 mhshow-suffix-application/x-java-archive: .jar
164 mhshow-suffix-application/x-javascript: .js
165 mhshow-suffix-application/x-latex: .latex
166 mhshow-suffix-application/x-sh: .sh
167 mhshow-suffix-application/x-tar: .tar
168 mhshow-suffix-application/x-texinfo: .texinfo
169 mhshow-suffix-application/x-tex: .tex
170 mhshow-suffix-application/x-troff-man: .man
171 mhshow-suffix-application/x-troff-me: .me
172 mhshow-suffix-application/x-troff-ms: .ms
173 mhshow-suffix-application/x-troff: .t
174 mhshow-suffix-application/zip: .zip
175 mhshow-suffix-audio/basic: .au
176 mhshow-suffix-audio/midi: .midi
177 mhshow-suffix-audio/mpeg: .mp3
178 mhshow-suffix-audio/mpeg: .mpg
179 mhshow-suffix-audio/x-ms-wma: .wma
180 mhshow-suffix-audio/x-wav: .wav
181 mhshow-suffix-image/gif: .gif
182 mhshow-suffix-image/jpeg: .jpeg
183 mhshow-suffix-image/jpeg: .jpg
184 mhshow-suffix-image/png: .png
185 mhshow-suffix-image/tiff: .tif
186 mhshow-suffix-image/tiff: .tiff
187 mhshow-suffix-text/calendar: .ics
188 mhshow-suffix-text/css: .css
189 mhshow-suffix-text/html: .html
190 mhshow-suffix-text/rtf: .rtf
191 mhshow-suffix-text/sgml: .sgml
192 mhshow-suffix-text/xml: .xml
193 mhshow-suffix-video/mpeg: .mpeg
194 mhshow-suffix-video/mpeg: .mpg
195 mhshow-suffix-video/quicktime: .moov
196 mhshow-suffix-video/quicktime: .mov
197 mhshow-suffix-video/quicktime: .qt
198 mhshow-suffix-video/quicktime: .qtvr
199 mhshow-suffix-video/x-msvideo: .avi
200 mhshow-suffix-video/x-ms-wmv: .wmv
203 # I'd like to check if netscape is available and use it preferentially to lynx,
204 # but only once I've added a new %-escape that makes more permanent temp files,
205 # so netscape -remote can be used (without -remote you get a complaint dialog
206 # that another netscape is already running and certain things can't be done).
207 PGM
="`$SEARCHPROG $SEARCHPATH lynx`"
208 if [ ! -z "$PGM" ]; then
209 echo "mhshow-show-text/html: %p$PGM '%F'" >> $TMP
212 PGM
="`$SEARCHPROG $SEARCHPATH richtext`"
213 if [ ! -z "$PGM" ]; then
214 echo "mhshow-show-text/richtext: %p$PGM -p '%F'" >> $TMP
216 PGM
="`$SEARCHPROG $SEARCHPATH rt2raw`"
217 if [ ! -z "$PGM" ]; then
218 echo "mhshow-show-text/richtext: %p$PGM < '%f' | fmt -78 | more" >> $TMP
222 # staroffice to read .doc files
223 PGM
="`$SEARCHPROG $SEARCHPATH soffice`"
224 if [ ! -z "$PGM" ]; then
225 echo "mhshow-show-application/msword: %psoffice '%F'" >> $TMP
226 echo "mhshow-suffix-application/msword: .doc" >> $TMP
229 # output a sorted version of the file
234 : not
until we get a
"safe" postscript environment...
236 PGM
="`$SEARCHPROG $SEARCHPATH pageview`"
237 if [ "$DISPLAY" = "unix:0.0" -a ! -z "$PGM" ]; then
238 echo "mhshow-show-application/PostScript: %p$PGM -" >> $TMP
240 PGM
="`$SEARCHPROG $SEARCHPATH gs`"
241 if [ ! -z "$PGM" ]; then
242 echo "mhshow-show-application/PostScript: %p$PGM -- '%F'" >> $TMP
243 echo "mhshow-suffix-application/PostScript: .ps" >> $TMP
247 : have to experiment
more with this
249 PGM
="`$SEARCHPROG $SEARCHPATH ivs_record`"
250 if [ ! -z "$PGM" ]; then
251 echo "mhbuild-compose-application/x-ivs: $PGM -u localhost '%F'" >> $TMP