inbrowse (webrowse-1.7.3.tgz) | : | inbrowse (webrowse-2.0.0.tgz) | ||
---|---|---|---|---|
#!/bin/sh - | #!/bin/sh - | |||
inbrowser=webrowse | inbrowser=webrowse | |||
mailbrowser=mimebrowse | mailbrowser=mimebrowse | |||
# inbrowse - web browse the given standard input, guessing its nature | # inbrowse - web browse the given standard input, guessing its nature | |||
# Steve Kinzler, kinzler@cs.indiana.edu, Feb 99/Mar 00/Jul 05 | # Steve Kinzler, steve@kinzler.com, Feb 99/Mar 00/Jul 05 | |||
# see website http://www.cs.indiana.edu/~kinzler/webrowse/ | # see website http://kinzler.com/me/webrowse/ | |||
# http://www.cs.indiana.edu/~kinzler/home.html#web | # http://kinzler.com/me/home.html#web | |||
case "$1" in | case "$1" in | |||
-h) cat << EOF 1>&2 | -h) cat << EOF 1>&2 | |||
usage: $0 [ $inbrowser options ] | usage: $0 [ $inbrowser options ] | |||
If the standard input is just the word "reload", it's taken as a browser | If the standard input is just the word "reload", it's taken as a browser | |||
command to run. If the stdin is a single line without whitespace, it's | command to run. If the stdin is a single line without whitespace, it's | |||
taken as a URL piece to browse. Otherwise, if the stdin resembles an | taken as a URL piece to browse. Otherwise, if the stdin resembles an | |||
email message, it's browsed with a mail browser ($mailbrowser), if any. | email message, it's browsed with a mail browser ($mailbrowser), if any. | |||
Otherwise, the stdin is searched for anything resembling HTML or XML and, | Otherwise, the stdin is searched for anything resembling HTML or XML and, | |||
if found, is taken to be an HTML or XML page to display. Otherwise, | if found, is taken to be an HTML or XML page to display. Otherwise, | |||
skipping to change at line 69 | skipping to change at line 69 | |||
esac | esac | |||
case "$mailbrowser" in | case "$mailbrowser" in | |||
?*) case "`sed -n '/^From[ :].*@.*\./p; 1q' < $tmp`" in | ?*) case "`sed -n '/^From[ :].*@.*\./p; 1q' < $tmp`" in | |||
?*) $mailbrowser - < $tmp; exit $?;; | ?*) $mailbrowser - < $tmp; exit $?;; | |||
esac;; | esac;; | |||
esac | esac | |||
args=-m | args=-m | |||
egrep -is '<html|<body|</.*>' < $tmp > /dev/null && args=-s | egrep -is '<html|<body|</.*>' < $tmp > /dev/null && args=-s | |||
egrep -is '<?xml|<soap|<saml' < $tmp > /dev/null && args=-x | egrep -is '<xml|<soap|<saml' < $tmp > /dev/null && args=-x | |||
$inbrowser ${1+"$@"} $args < $tmp | $inbrowser ${1+"$@"} $args < $tmp | |||
End of changes. 2 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added |