Print-mimetype is useful if you don't have GNU file(1).
/uip/packf
/uip/pick
/uip/post
+/uip/print-mimetype
/uip/prompter
/uip/rcvdist
/uip/rcvpack
(profile, default: `Attach')
.RE
.PP
+.BR Mime-Type-Query :
+file \-b \-\-mime
+.RS 5
+A command that prints the MIME type of a file.
+The file name gets appended to the command line.
+Note: Older GNU versions of file(1) won't generate the desired
+output. GNU file-4.26, for instance, omits a required semicolon.
+GNU file-5.04 is known to work. Non-GNU version likely need different
+options or don't provide this function at all. Alternatively, you can use
+.BR print\-mimetype ,
+which is part of mmh, but guesses MIME types by file name extensions only.
+.RE
+.PP
.BR Msg\-Protect :
644
.RS 5
# commands to build
CMDS = ali anno burst comp dist flist folder forw mmh mark mhbuild mhl \
- mhlist mhmail mhparam mhpath mhshow mhstore msgchk \
- new packf pick prompter refile repl rmf rmm scan send sendfiles show \
+ mhlist mhmail mhparam mhpath mhshow mhstore msgchk new packf pick \
+ print-mimetype prompter refile repl rmf rmm scan send sendfiles show \
sortm whatnow
# commands that are links to other commands
mhbuildsbr.c mhcachesbr.c mhfree.c mhl.c mhlist.c mhlistsbr.c \
mhmail.c mhmisc.c mhoutsbr.c mhparam.c mhparse.c \
mhpath.c mhshow.c mhshowsbr.c mhstore.c mhstoresbr.c mhtest.c \
- msgchk.c new.c packf.c pick.c \
+ msgchk.c new.c packf.c pick.c print-mimetype.sh \
prompter.c rcvdist.c rcvpack.c rcvstore.c \
refile.c repl.c rmf.c rmm.c scan.c scansbr.c send.c \
sendfiles.sh show.c slocal.c sortm.c spost.c termsbr.c \
pick: pick.o $(LOCALLIBS)
$(LINK) pick.o $(LINKLIBS)
+print-mimetype: print-mimetype.sh
+ cp print-mimetype.sh print-mimetype
+ chmod +x print-mimetype
+
prompter: prompter.o $(LOCALLIBS)
$(LINK) prompter.o $(LINKLIBS)
--- /dev/null
+#!/bin/sh
+#
+# print mime type of file, depending on file name extension
+
+if [ $# -eq 0 ] ; then
+ echo "Usage: $0 FILE..." >&2
+ exit 1
+fi
+
+for i do
+
+case "$i" in
+*.xls) type=application/excel;;
+*.ppt) type=application/mspowerpoint;;
+*.doc) type=application/msword;;
+*.pdf) type=application/pdf;;
+*.deb) type=application/x-debian-package;;
+*.tar) type=application/x-tar;;
+*.[1-9]) type=application/x-troff-man;;
+*.zip) type=application/zip;;
+*.au) type=audio/basic;;
+*.gif) type=image/gif;;
+*.jpg|*.jpeg) type=image/jpeg;;
+*.png) type=image/png;;
+*.ps) type=application/postscript;;
+*.eps) type=image/eps;;
+*.tif|*.tiff) type=image/tiff;;
+*.ico) type=image/x-icon;;
+*.bmp) type=image/x-ms-bmp;;
+*.pnm) type=image/x-portable-anymap;;
+*.pbm) type=image/x-portable-bitmap;;
+*.pgm) type=image/x-portable-graymap;;
+*.ppm) type=image/x-portable-pixmap;;
+*.xbm) type=image/x-xbitmap;;
+*.xpm) type=image/x-xpixmap;;
+*.xwd) type=image/x-xwindowdump;;
+*.eml) type=message/rfc822;;
+*.rtf) type=text/richtext;;
+*.html|*.htm) type=text/html;;
+*.txt) type=text/plain;;
+*.mpg|*.mpeg) video/mpeg;;
+*)
+ if file "$i" | grep -q ' text$' ; then
+ type=text/plain;;
+ else
+ type=application/octet-stream;;
+ fi
+esac
+echo "$type"
+
+done
+