--- 2003-04-05-04/moz Sat Apr 5 04:49:14 2003 +++ latest/moz Thu Apr 10 00:06:37 2003 @@ -1,5 +1,6 @@ #!/bin/sh - ver="0.2.2b+.2003040504" + appname=`basename "$0"` + ver="0.2.2b+.2003041000" copy="2002, 2003" mail="PointedEars@gmx.de" mail_feedback="bug-moz@PointedEars.de" @@ -81,152 +82,12 @@ mail_feedback="bug-moz@PointedEars.de" # * `-C', `--command' options to execute arbitrary Mozilla commands # * Cosmetics: # - More modular code (incomplete) - # + # # TO DO (later): # # * New option to call Mozilla if and only if it is not running - # - # ---------------------------------------------------------------------------- - - # Note that we use `"$@"' to let each command-line parameter expand to a - # separate word. The quotes around `$@' are essential! - # We need `tmp' as the `eval set --' would nuke the return value of getopt. - - if `getopt -T >/dev/null 2>&1` ; [ $? = 4 ] ; then - getopt_type=long - echo "Enhanced getopt(1)" - tmp=`getopt -o vL:hVM:kl::n:w:t:-m::ic \ - -l verbose,locale:,help,version,mozilla:,term,kill,list,full,\ - new:,win:,tab:,mailto::,inbox,compose \ - -n $(basename "$0") -s sh \ - -- "$@"` - else - getopt_type=short - echo "Old getopt(1)" - tmp=`getopt vL:hVM:kl:n:w:t:-m:ic "$@"` - fi - - getopt_exit_code=$? - if [ $getopt_exit_code -eq 0 ]; then - ## getopt returns error code 0 for successful parsing, 1 if - ## getopt(3) returns errors, 2 if it does not understand its - ## own parameters, 3 if an internal error occurs like out-of- - ## memory, and 4 if it is called with -T. # - # Note the quotes around `$tmp': they are essential! - echo $tmp - # remove "--" - for i in $tmp; do if [ "$i" != "--" ]; then tmp2="${tmp2} $i"; fi; done - eval set -- "$tmp2" - echo $* - #exit 0 - else - echo "getopt exited: $getopt_exit_code - " >&2 - exit $getopt_exit_code - fi - - # check for verbose mode - verbose=0 - help=0 - if [ "$1" = "--verbose" ] || [ "$1" = "-v" ]; then - verbose=1 - shift - test -z "$1" -a $help -eq 0 && help=1 - fi - - # from /etc/rc.status - # check for $COLUMNS - if test -z "$LINES" -o -z "$COLUMNS" ; then - eval `stty size 2>/dev/null | (read L C; echo LINES=${L:-24} \ - COLUMNS=${C:-80})` - fi - test $LINES -eq 0 && LINES=24 - test $COLUMNS -eq 0 && COLUMNS=80 - - if test "$TERM" != "raw" && stty size >/dev/null 2>&1 ; then - esc=`echo -en "\033"` - extd="${esc}[1m" - warn="${esc}[1;31m" - done="${esc}[1;32m" - attn="${esc}[1;33m" - norm=`echo -en "${esc}[m\017"` - stat=`echo -en "\015${esc}[${COLUMNS}C${esc}[10D"` - - rc_done="${done}done${norm}" - rc_running="${stat}${done}running${norm}" - rc_failed="${warn}failed${norm}" - rc_missed="${warn}not found${norm}" - rc_skipped="${stat}${attn}skipped${norm}" - rc_dead="${stat}${warn}dead${norm}" - rc_unused="${stat}${extd}unused${norm}" - rc_done_up="${esc}[1A${rc_done}" - rc_failed_up="${esc}[1A${rc_failed}" - rc_reset="${norm}" - rc_save="${esc}7" - rc_restore="${esc}8" - else - esc="" - extd="" - warn="" - done="" - attn="" - norm="" - stat="... " - - rc_done="done" - rc_running="running" - rc_failed="failed" - rc_missed="missing" - rc_skipped="skipped" - rc_dead="dead" - rc_unused="unused" - rc_done_up="${rc_done}" - rc_failed_up="${rc_failed}" - rc_reset="" - rc_save="" - rc_restore="" - fi - - # check for fold - fold="fold -sw $COLUMNS" - chk=`which fold 2>/dev/null` - test $? -ne 0 && fold="cat" - chk=`echo x | $fold 2>/dev/null` - test -n "$chk" && fold="cat" - - # check for fmt - fmt=cat - if [ $COLUMNS -ne 80 ]; then # output is preformatted for 80 cols - chk=`which fmt 2>/dev/null` - if [ $? -ne 0 ]; then - fmt=$fold - else - # check for columns - fmt="fmt -$COLUMNS" - chk=`echo x | $fmt 2>/dev/null` - test -z "$chk" && fmt="fmt" - # check for -c|--crown-margin - chk=`echo x | $fmt -c 2>/dev/null` - if [ -n "$chk" ]; then - fmt=$fmt" -c" - else - chk=`echo x | $fmt --crown-margin 2>/dev/null` - test -n "$chk" && fmt=$fmt" --crown-margin" - fi - fi - fi - - # L10n - lg="" - test -n "$LANG" && lg=`echo $LANG | sed 's/_.*[.].*//' 2>/dev/null` - test -z "$lg" && lg=`echo $LC_CTYPE | sed 's/_.*//' 2>/dev/null` - - if [ "$1" = "-L" ] || [ "$1" = "--locale" ]; then - shift - lg=$1 - shift - fi + # ---------------------------------------------------------------------------- function L { case $lg in @@ -235,23 +96,6 @@ function L { esac } - # Status msgs - function msg_done { - if [ -n "$rc_done" ]; then - echo $rc_done - else - echo "done" - fi - } - - function msg_failed { - if [ -n "$rc_failed" ]; then - echo $rc_failed - else - echo "failed" - fi - } - function Title { echo "\ ${extd}moz $ver -- "`L "Mozilla process manager" "Manager für \ @@ -269,7 +113,7 @@ details." \ function help { future=${extd}`L "For future use" "Für zukünftige Verwendung"`.${norm} echo - echo "${extd}`basename "$1"`${norm} + echo "${extd}${appname}${norm} [${extd}-v${norm}] [${extd}-L${norm} LOCALE] [( ${extd}-h${norm} \ | ${extd}-V${norm} )] [${extd}-M${norm} COMMAND] [( ${extd}-T${norm} \ | ${extd}-k${norm} )] [${extd}-l${norm}[OPTIONS]] @@ -347,7 +191,7 @@ befindet, # echo " --block Block the shell for the 'mozilla' process, i.e. prevent" # echo " following commands to be executed until Mozilla is \ # quit." - + echo -n " ${extd}-T${norm}, ${extd}--term${norm} " L "Terminate all Mozilla processes (first), sending each" \ "Beendet (zuerst) alle Mozilla-Prozesse, indem jedem" | $fold @@ -508,7 +352,7 @@ L "Execute arbitrary Mozilla COMMAND. $f "Beliebigen Mozilla-Befehl COMMAND ausführen. $future" | $fold - if [ $getopt_type = "long" ]; then + if [ $getopt_type = "short" ]; then _XPG=1 echo " $(L "\ @@ -527,7 +371,7 @@ _XPG=0 } function isMozRunning { - # check for supported `ps' options + # check for supported `ps' options whoami=`whoami` # BSD style user-oriented args="u " @@ -559,21 +403,21 @@ function isMozRunning { function KillMoz { local result=0 + echo -n `L "Sending all Mozilla processes the" \ + "Sende allen Mozilla-Prozessen das"`" " + case "$1" in + "-9") echo -n "KILL";; + *) echo -n "TERM";; + esac + Lout=`L " signal" "-Signal"` + echo -n "$Lout$stat" if isMozRunning; then - echo -n `L "Sending all Mozilla processes the" \ - "Sende allen Mozilla-Prozessen das"`" " - case "$1" in - "-9") echo -n "KILL";; - *) echo -n "TERM";; - esac - Lout=`L " signal" "-Signal"` - echo -n "$Lout$stat" killall $1 mozilla-bin 2>/dev/null result=$? # FIX ME! # allow other user's processes to run and be successful anyway if [ $result -ne 0 ]; then - msg_failed + echo $rc_failed else ping=1 mozilla -remote "ping()" 2>/dev/null @@ -596,13 +440,13 @@ $stat" >&2 fi done if [ $error -ne 0 ]; then - msg_done + echo $rc_done test $verbose -eq 1 && \ L "Mozilla was pinged "$ping" times until shutdown was complete." \ "Mozilla wurde "$ping" Mal gepingt, bevor er vollständig beendet \ war." | $fmt >&2 else - msg_failed + echo $rc_failed test $verbose -eq 1 && \ L " Mozilla was pinged "$ping" times without response. @@ -613,9 +457,10 @@ Bitte überprüfen Sie ihre Mozilla-Instal fi fi else - echo `L "No Mozilla process is running that could be terminated or killed."\ - "Es läuft kein Mozilla-Prozess, der beendet werden kann."` \ - | $fold >&2 + echo $rc_dead + # echo `L "No Mozilla process is running that could be terminated or killed."\ + # "Es läuft kein Mozilla-Prozess, der beendet werden kann."` \ + # | $fold >&2 fi _XPG=1 @@ -682,231 +527,381 @@ function ListMoz { echo } + # MAIN - test "$1" != "-V" -o "$1" != "--version" && echo - Title + # from /etc/rc.status + # check for $COLUMNS + if test -z "$LINES" -o -z "$COLUMNS" ; then + eval `stty size 2>/dev/null | (read L C; echo LINES=${L:-24} \ + COLUMNS=${C:-80})` + fi + test $LINES -eq 0 && LINES=24 + test $COLUMNS -eq 0 && COLUMNS=80 - if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then - help=1 - help "$0" - test -n "$1" && shift + if test "$TERM" != "raw" && stty size >/dev/null 2>&1 ; then + esc=`echo -en "\033"` + extd="${esc}[1m" + warn="${esc}[1;31m" + done="${esc}[1;32m" + attn="${esc}[1;33m" + norm=`echo -en "${esc}[m\017"` + stat=`echo -en "\015${esc}[${COLUMNS}C${esc}[10D"` + + rc_done="${done}done${norm}" + rc_running="${stat}${done}running${norm}" + rc_failed="${warn}failed${norm}" + rc_missed="${warn}not found${norm}" + rc_skipped="${stat}${attn}skipped${norm}" + rc_dead="${stat}${warn}not running${norm}" + rc_unused="${stat}${extd}unused${norm}" + rc_done_up="${esc}[1A${rc_done}" + rc_failed_up="${esc}[1A${rc_failed}" + rc_reset="${norm}" + rc_save="${esc}7" + rc_restore="${esc}8" + else + esc="" + extd="" + warn="" + done="" + attn="" + norm="" + stat="... " + + rc_done="done" + rc_running="running" + rc_failed="failed" + rc_missed="missing" + rc_skipped="skipped" + rc_dead="not running" + rc_unused="unused" + rc_done_up="${rc_done}" + rc_failed_up="${rc_failed}" + rc_reset="" + rc_save="" + rc_restore="" + fi + + # check for fold + fold="fold -sw $COLUMNS" + chk=`which fold 2>/dev/null` + test $? -ne 0 && fold="cat" + chk=`echo x | $fold 2>/dev/null` + test -n "$chk" && fold="cat" + + # check for fmt + fmt=cat + if [ $COLUMNS -ne 80 ]; then # output is preformatted for 80 cols + chk=`which fmt 2>/dev/null` + if [ $? -ne 0 ]; then + fmt=$fold + else + # check for columns + fmt="fmt -$COLUMNS" + chk=`echo x | $fmt 2>/dev/null` + test -z "$chk" && fmt="fmt" + # check for -c|--crown-margin + chk=`echo x | $fmt -c 2>/dev/null` + if [ -n "$chk" ]; then + fmt=$fmt" -c" + else + chk=`echo x | $fmt --crown-margin 2>/dev/null` + test -n "$chk" && fmt=$fmt" --crown-margin" + fi + fi + fi + + # Note that we use `"$@"' to let each command-line parameter expand to a + # separate word. The quotes around `$@' are essential! + # We need `tmp' as the `eval set --' would nuke the return value of getopt. + + echo "$*" + if `getopt -T >/dev/null 2>&1` ; [ $? = 4 ] ; then + getopt_type=long + echo "Enhanced getopt(1)" + tmp=`getopt -o vL:hVM:Tkl::n:w:t:-m::ic \ + -l verbose,locale:,help,version,mozilla:,term,kill,list,full,\ + new:,win:,tab:,mailto::,inbox,compose \ + -n "$appname" -s sh \ + -- "$@"` + else + getopt_type=short + echo "Old getopt(1)" + tmp=`getopt vL:hVM:Tkl:n:w:t:-m:ic "$@"` fi + getopt_exit_code=$? + help=0 + verbose=0 + + # L10n + lg="" + test -n "$LANG" && lg=`echo $LANG | sed 's/_.*[.].*//' 2>/dev/null` + test -z "$lg" && lg=`echo $LC_CTYPE | sed 's/_.*//' 2>/dev/null` + + version=0 + mozilla="mozilla" + term="" + list=0 + list_style="" + args="" + if [ $getopt_exit_code -eq 0 ]; then + ## getopt returns error code 0 for successful parsing, 1 if + ## getopt(3) returns errors, 2 if it does not understand its + ## own parameters, 3 if an internal error occurs like out-of- + ## memory, and 4 if it is called with -T. + # + # Note the quotes around `$tmp': they are essential! + # echo $tmp + # remove "--" + # for i in $tmp; do if [ "$i" != "--" ]; then tmp2="${tmp2} $i"; fi; done + eval set -- "$tmp" + while true ; do + case "$1" in + -h | --help) help=1; shift;; + -v | --verbose) verbose=1; shift;; + # -b | --block) block=1; shift;; + -L | --locale) lg=$2; shift 2;; + -V | --version) version=1; shift;; + -M | --mozilla) mozilla=$2; shift 2;; + -T | --term) test -z "$term" && term=t; shift;; + -k | --kill) term=k; shift;; + -l | --list) list=1; list_style=$2; shift 2;; + --) shift; break;; + -n | --new | -w | --win | -t | --tab | -m | --mailto) + args=$args" "$1" "$2; shift 2;; + -i | --inbox | -c | --compose | *) + args=$args" "$1; shift;; + esac + done + test -n "$*" && args=$args" $*" + test -z "$args" -a $version -eq 0 -a $list -eq 0 && help=1 + set -- $args + else + echo "getopt exited: $getopt_exit_code + " >&2 + if [ $getopt_exit_code -eq 1 ]; then + help=1 + else + exit $getopt_exit_code + fi + fi + + test $version -eq 0 && echo + Title + + test $help -eq 1 && help && test -n "$1" && shift + echo `L "Send suggestions and bug reports to" \ "Senden Sie Vorschläge und Fehlerberichte an"`" <$mail_feedback> " | $fold - test "$1" = "-V" -o "$1" = "--version" && exit 0 - test $help -eq 1 && exit 255 + # test $version -eq 1 && exit 0 + # test $help -eq 1 && exit 255 # check for term/kill kill=0 - if [ "$1" = "-T" ] || [ "$1" = "--term" ] || \ - [ "$1" = "-k" ] || [ "$1" = "--kill" ]; then + if [ "$term" = "t" ] || [ "$term" = "k" ]; then kill=1 - if [ "$1" = "-k" ] || [ "$1" = "--kill" ]; then sig=-9; fi + test "$term" = "k" && sig=-9 KillMoz - if [ $? -ne 0 ] && [ $sig -eq -9 ]; then KillMoz $sig; fi + test $? -ne 0 && $sig -eq -9 && KillMoz $sig shift test -z "$1" && echo && exit 0 fi # check for list - if [ "$1" = "-l" ] || [ "$1" = "--list" ]; then - ListMoz $2 - exit 0 - fi + test $list -eq 1 && ListMoz "$list_style" && exit 0 - # check for Mozilla - chk=`which mozilla 2>/dev/null` - if [ $? -ne 0 ]; then - _XPG=1 - echo "`basename $0`: \ - $(L "The \`mozilla' executable is required for this program." \ - "Die ausführbare Datei \`mozilla' wird für dieses Programm benötigt.") - " | $fold >&2 - _XPG=0 - exit 255 - fi + if [ -n "$1" ]; then - # block=0 - # check for block mode - # if [ "$1" = "-b" ] || [ "$1" = "--block" ]; then block=1; shift; fi + # check for Mozilla + chk=`which mozilla 2>/dev/null` + if [ $? -ne 0 ]; then + _XPG=1 + echo "${appname}: \ + $(L "The \`mozilla' executable is required for this program." \ + "Die ausführbare Datei \`mozilla' wird für dieses Programm benötigt.") + " | $fold >&2 + _XPG=0 + exit 255 + fi - new_win=0 - new_tab=0 - while [ -n "$1" ]; do - mailto=0 - inbox=0 - compose=0 - uri="" - cmd="" - case "$1" in - # check for new-window - "-n" | "--new" | "-w" | "--win") - new_win=1 - new_tab=0 - shift;; - # check for new-tab - "-t" | "--tab") - new_win=0 - new_tab=1 - shift;; - # check for mailto - "-m" | "--mailto") - mailto=1 - shift - uri="-mail" - cmd="mailto($1)";; - "-i" | "--inbox") - inbox=1 - uri="-mail" - cmd="xfeDoCommand(openInbox)" - shift;; - "-c" | "--compose") - compose=1 - uri="-compose $2" - cmd="xfeDoCommand(composeMessage)" - shift;; - # check for disabling new-* - "-") - new_win=0 - new_tab=0 - shift;; - esac + new_win=0 + new_tab=0 + while [ -n "$1" ]; do + mailto=0 + inbox=0 + compose=0 + uri="" + cmd="" + case "$1" in + # check for new-window + "-n" | "--new" | "-w" | "--win") + new_win=1 + new_tab=0 + shift;; + # check for new-tab + "-t" | "--tab") + new_win=0 + new_tab=1 + shift;; + # check for mailto + "-m" | "--mailto") + mailto=1 + shift + uri="-mail" + cmd="mailto($1)";; + "-i" | "--inbox") + inbox=1 + uri="-mail" + cmd="xfeDoCommand(openInbox)" + shift;; + "-c" | "--compose") + compose=1 + uri="-compose $2" + cmd="xfeDoCommand(composeMessage)" + shift;; + # check for disabling new-* + "-") + new_win=0 + new_tab=0 + shift;; + esac - # check if the current user has Mozilla already run - # AFAIK mozilla -remote "ping()" does not pay respect to different accounts - _XPG=1 - chk=`ps -fu $(whoami) 2>/dev/null | grep mozilla-bin | grep -v grep` - _XPG=0 - test -z "$uri" && uri="$1" - - # check if argument denotes a local file or directory, - # determine the current working directory and append - # to the URI if successful - test -d "$uri" -o -f "$uri" && uri="file://"`pwd 2>/dev/null`"/$uri" - - if [ -z "$chk" ]; then - echo -n `L "Starting a new Mozilla process" \ - "Starte einen neuen Mozilla-Prozess"` - test -n "$uri" && test $mailto -eq 1 && test $inbox -eq 0 \ - && test $compose -eq 0 && echo -n " "`L "with URI" "mit dem URI"`" '$uri'" - echo -n "$stat" - #if [ $block -eq 1 ]; then - # mozilla "$uri" - #else - mozilla "$uri" & - #fi - error=$? - if [ -n "$2" ]; then - ping=1 - mozilla -remote "ping()" 2>/dev/null + # check if the current user has Mozilla already run + # AFAIK mozilla -remote "ping()" does not pay respect to different accounts + _XPG=1 + chk=`ps -fu $(whoami) 2>/dev/null | grep mozilla-bin | grep -v grep` + _XPG=0 + test -z "$uri" && uri="$1" + + # check if argument denotes a local file or directory, + # determine the current working directory and append + # to the URI if successful + test -d "$uri" -o -f "$uri" && uri="file://"`pwd 2>/dev/null`"/$uri" + + if [ -z "$chk" ]; then + echo -n `L "Starting a new Mozilla process" \ + "Starte einen neuen Mozilla-Prozess"` + test -n "$uri" && test $mailto -eq 1 && test $inbox -eq 0 \ + && test $compose -eq 0 && echo -n " "`L "with URI" "mit dem URI"`" '$uri'" + echo -n "$stat" + #if [ $block -eq 1 ]; then + # mozilla "$uri" + #else + mozilla "$uri" & + #fi error=$? - test $verbose -eq 1 && echo -n $error" " >&2 - while [ $error -ne 0 ] && [ $ping -le 50 ]; do - let ping++ + if [ -n "$2" ]; then + ping=1 mozilla -remote "ping()" 2>/dev/null error=$? test $verbose -eq 1 && echo -n $error" " >&2 - if [ $ping -eq 25 ]; then - echo " - " - L "Mozilla was pinged $ping times without response, trying - $ping more times before giving up. Press Ctrl+C to quit." \ - "Mozilla wurde $ping Mal erfolglos gepingt, es werden weitere - $ping Versuche unternommen. Drücken Sie Strg+C, um abzubrechen." | $fmt >&2 - echo -n " - $stat" >&2 + while [ $error -ne 0 ] && [ $ping -le 50 ]; do + let ping++ + mozilla -remote "ping()" 2>/dev/null + error=$? + test $verbose -eq 1 && echo -n $error" " >&2 + if [ $ping -eq 25 ]; then + echo " + " + L "Mozilla was pinged $ping times without response, trying + $ping more times before giving up. Press Ctrl+C to quit." \ + "Mozilla wurde $ping Mal erfolglos gepingt, es werden weitere + $ping Versuche unternommen. Drücken Sie Strg+C, um abzubrechen." | $fmt >&2 + echo -n " + $stat" >&2 + fi + done + if [ $error -eq 0 ]; then + echo $rc_done + test $verbose -eq 1 && \ + L "Mozilla was pinged "$ping" times until startup was complete." \ + "Mozilla wurde "$ping" Mal gepingt, bevor er vollständig gestartet \ + war." | $fmt >&2 + else + echo $rc_failed + test $verbose -eq 1 && \ + L " + Mozilla was pinged "$ping" times without response. + Please check your Mozilla installation." \ + " + Mozilla wurde "$ping" Mal erfolglos gepingt. + Bitte überprüfen Sie ihre Mozilla-Installation." | $fmt >&2 fi - done - if [ $error -eq 0 ]; then - msg_done - test $verbose -eq 1 && \ - L "Mozilla was pinged "$ping" times until startup was complete." \ - "Mozilla wurde "$ping" Mal gepingt, bevor er vollständig gestartet \ - war." | $fmt >&2 else - msg_failed - test $verbose -eq 1 && \ - L " - Mozilla was pinged "$ping" times without response. - Please check your Mozilla installation." \ - " - Mozilla wurde "$ping" Mal erfolglos gepingt. - Bitte überprüfen Sie ihre Mozilla-Installation." | $fmt >&2 + if [ $error -eq 0 ]; then + echo $rc_done + else + echo $rc_failed + fi fi else - if [ $error -eq 0 ]; then - msg_done + # check what kind of URI was given + if [ -z "$cmd" ]; then + cmd="openURL($uri" + test $new_win -eq 1 && cmd=$cmd", new-window" + test $new_tab -eq 1 && cmd=$cmd", new-tab" + cmd=$cmd")" + fi + # checking for grep + chk=`which grep 2>/dev/null` + _XPG=1 + if [ $? -ne 0 ]; then + echo "${appname}: \`grep' "\ + $(L "not found. Cannot check for \`mailto:' URI." \ + "nicht gefunden. Überprüfung auf \`mailto:'-URI nicht möglich.") >&2 else - msg_failed + if [ -n "`echo "$uri" | grep "^mailto:"`" ]; then + address="$uri" + # checking for sed + chk=`which sed 2>/dev/null` + if [ $? -ne 0 ]; then + echo $appname": \`sed' "\ + $(L "not found. Cannot handle \`mailto:' URI properly." \ + "nicht gefunden. \`mailto:'-URI kann nicht richtig umgesetzt werden.") >&2 + else + address=`echo "$address" | sed "s/^mailto://"` + fi + cmd="mailto($address)" + mailto=1 + fi fi - fi - else - # check what kind of URI was given - if [ -z "$cmd" ]; then - cmd="openURL($uri" - test $new_win -eq 1 && cmd=$cmd", new-window" - test $new_tab -eq 1 && cmd=$cmd", new-tab" - cmd=$cmd")" - fi - # checking for grep - chk=`which grep 2>/dev/null` - _XPG=1 - if [ $? -ne 0 ]; then - echo "`basename $0`: \`grep' "\ - $(L "not found. Cannot check for \`mailto:' URI." \ - "nicht gefunden. Überprüfung auf \`mailto:'-URI nicht möglich.") >&2 - else - if [ -n "`echo "$uri" | grep "^mailto:"`" ]; then - address="$uri" - # checking for sed - chk=`which sed 2>/dev/null` - if [ $? -ne 0 ]; then - echo `basename $0`": \`sed' "\ - $(L "not found. Cannot handle \`mailto:' URI properly." \ - "nicht gefunden. \`mailto:'-URI kann nicht richtig umgesetzt werden.") >&2 + _XPG=0 + if [ $mailto -eq 0 ] && [ $inbox -eq 0 ] && [ $compose -eq 0 ]; then + echo -n `L "Accessing URI" "Lade URI"`" " + if [ -n "$uri" ]; then + echo -n "'$uri'" else - address=`echo "$address" | sed "s/^mailto://"` + echo -n "'about:blank'" fi - cmd="mailto($address)" - mailto=1 - fi - fi - _XPG=0 - if [ $mailto -eq 0 ] && [ $inbox -eq 0 ] && [ $compose -eq 0 ]; then - echo -n `L "Accessing URI" "Lade URI"`" " - if [ -n "$uri" ]; then - echo -n "'$uri'" - else - echo -n "'about:blank'" - fi - test $new_win -eq 1 && \ - echo -n " "`L "in a new browser window" "in einem neuen Browserfenster"` - test $new_tab -eq 1 && \ - echo -n " "`L "in a new browser tab" "in einem neuen Browser-Tab"` - else - if [ $mailto -eq 1 ]; then - echo -n `L "Opening new e-mail Compose window" \ - "Neues Fenster zur E-Mail-Bearbeitung wird geöffnet"` - elif [ $inbox -eq 1 ]; then - echo -n `L "Opening new MailNews window" \ - "Neues MailNews-Fenster wird geöffnet"` + test $new_win -eq 1 && \ + echo -n " "`L "in a new browser window" "in einem neuen Browserfenster"` + test $new_tab -eq 1 && \ + echo -n " "`L "in a new browser tab" "in einem neuen Browser-Tab"` else - echo -n `L "Opening new Compose window" \ - "Neues Fenster zur Nachrichtenbearbeitung wird geöffnet"` + if [ $mailto -eq 1 ]; then + echo -n `L "Opening new e-mail Compose window" \ + "Neues Fenster zur E-Mail-Bearbeitung wird geöffnet"` + elif [ $inbox -eq 1 ]; then + echo -n `L "Opening new MailNews window" \ + "Neues MailNews-Fenster wird geöffnet"` + else + echo -n `L "Opening new Compose window" \ + "Neues Fenster zur Nachrichtenbearbeitung wird geöffnet"` + fi fi + echo -n "$stat" + mozilla -remote "$cmd" & + if [ $? -eq 0 ]; then echo $rc_done; else echo $rc_failed; fi fi - echo -n "$stat" - mozilla -remote "$cmd" & - if [ $? -eq 0 ]; then msg_done; else msg_failed; fi - fi - test -n "$1" && shift - # new_win=1 - done + test -n "$1" && shift + # new_win=1 + done + fi echo - test $verbose -eq 1 && L "Press any key..." "Beliebige Taste drücken ..." \ - | $fold && read -n 1 + test $verbose -eq 1 -o $getopt_exit_code -eq 1 \ + && L "Press any key..." "Beliebige Taste drücken ..." | $fold && read -n 1 exit 0