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
141 mhshow-suffix-application/msword: .doc
142 mhshow-suffix-application/msword: .docx
143 mhshow-suffix-application/ogg: .ogg
144 mhshow-suffix-application/pdf: .pdf
145 mhshow-suffix-application/postscript: .ps
146 mhshow-suffix-application/rtf: .rtf
147 mhshow-suffix-application/vnd.ms-excel: .xla
148 mhshow-suffix-application/vnd.ms-excel: .xlc
149 mhshow-suffix-application/vnd.ms-excel: .xld
150 mhshow-suffix-application/vnd.ms-excel: .xll
151 mhshow-suffix-application/vnd.ms-excel: .xlm
152 mhshow-suffix-application/vnd.ms-excel: .xls
153 mhshow-suffix-application/vnd.openxmlformats-officedocument.spreadsheetml.sheet: .xlsx
154 mhshow-suffix-application/vnd.ms-excel: .xlt
155 mhshow-suffix-application/vnd.ms-excel: .xlw
156 mhshow-suffix-application/vnd.ms-powerpoint: .pot
157 mhshow-suffix-application/vnd.ms-powerpoint: .pps
158 mhshow-suffix-application/vnd.ms-powerpoint: .ppt
159 mhshow-suffix-application/vnd.ms-powerpoint: .ppz
160 mhshow-suffix-application/x-bzip2: .bz2
161 mhshow-suffix-application/x-cpio: .cpio
162 mhshow-suffix-application/x-dvi: .dvi
163 mhshow-suffix-application/x-gzip: .gz
164 mhshow-suffix-application/x-java-archive: .jar
165 mhshow-suffix-application/x-javascript: .js
166 mhshow-suffix-application/x-latex: .latex
167 mhshow-suffix-application/x-sh: .sh
168 mhshow-suffix-application/x-tar: .tar
169 mhshow-suffix-application/x-texinfo: .texinfo
170 mhshow-suffix-application/x-tex: .tex
171 mhshow-suffix-application/x-troff-man: .man
172 mhshow-suffix-application/x-troff-me: .me
173 mhshow-suffix-application/x-troff-ms: .ms
174 mhshow-suffix-application/x-troff: .t
175 mhshow-suffix-application/zip: .zip
176 mhshow-suffix-audio/basic: .au
177 mhshow-suffix-audio/midi: .midi
178 mhshow-suffix-audio/mpeg: .mp3
179 mhshow-suffix-audio/mpeg: .mpg
180 mhshow-suffix-audio/x-ms-wma: .wma
181 mhshow-suffix-audio/x-wav: .wav
182 mhshow-suffix-image/gif: .gif
183 mhshow-suffix-image/jpeg: .jpeg
184 mhshow-suffix-image/jpeg: .jpg
185 mhshow-suffix-image/png: .png
186 mhshow-suffix-image/tiff: .tif
187 mhshow-suffix-image/tiff: .tiff
188 mhshow-suffix-text/calendar: .ics
189 mhshow-suffix-text/css: .css
190 mhshow-suffix-text/html: .html
191 mhshow-suffix-text/rtf: .rtf
192 mhshow-suffix-text/sgml: .sgml
193 mhshow-suffix-text/xml: .xml
194 mhshow-suffix-video/mpeg: .mpeg
195 mhshow-suffix-video/mpeg: .mpg
196 mhshow-suffix-video/quicktime: .moov
197 mhshow-suffix-video/quicktime: .mov
198 mhshow-suffix-video/quicktime: .qt
199 mhshow-suffix-video/quicktime: .qtvr
200 mhshow-suffix-video/x-msvideo: .avi
201 mhshow-suffix-video/x-ms-wmv: .wmv
204 # I'd like to check if netscape is available and use it preferentially to lynx,
205 # but only once I've added a new %-escape that makes more permanent temp files,
206 # so netscape -remote can be used (without -remote you get a complaint dialog
207 # that another netscape is already running and certain things can't be done).
208 PGM
="`$SEARCHPROG $SEARCHPATH lynx`"
209 if [ ! -z "$PGM" ]; then
210 echo "mhshow-show-text/html: %p$PGM '%F'" >> $TMP
213 PGM
="`$SEARCHPROG $SEARCHPATH richtext`"
214 if [ ! -z "$PGM" ]; then
215 echo "mhshow-show-text/richtext: %p$PGM -p '%F'" >> $TMP
217 PGM
="`$SEARCHPROG $SEARCHPATH rt2raw`"
218 if [ ! -z "$PGM" ]; then
219 echo "mhshow-show-text/richtext: %p$PGM < '%f' | fmt -78 | more" >> $TMP
223 # staroffice to read .doc files
224 PGM
="`$SEARCHPROG $SEARCHPATH soffice`"
225 if [ ! -z "$PGM" ]; then
226 echo "mhshow-show-application/msword: %psoffice '%F'" >> $TMP
227 echo "mhshow-suffix-application/msword: .doc" >> $TMP
230 # output a sorted version of the file
235 : not
until we get a
"safe" postscript environment...
237 PGM
="`$SEARCHPROG $SEARCHPATH pageview`"
238 if [ "$DISPLAY" = "unix:0.0" -a ! -z "$PGM" ]; then
239 echo "mhshow-show-application/PostScript: %p$PGM -" >> $TMP
241 PGM
="`$SEARCHPROG $SEARCHPATH gs`"
242 if [ ! -z "$PGM" ]; then
243 echo "mhshow-show-application/PostScript: %p$PGM -- '%F'" >> $TMP
244 echo "mhshow-suffix-application/PostScript: .ps" >> $TMP
248 : have to experiment
more with this
250 PGM
="`$SEARCHPROG $SEARCHPATH ivs_record`"
251 if [ ! -z "$PGM" ]; then
252 echo "mhbuild-compose-application/x-ivs: $PGM -u localhost '%F'" >> $TMP