--- 2003-04-24-03/moz Thu Apr 24 03:12:56 2003 +++ latest/moz Fri Apr 25 07:52:05 2003 @@ -1,6 +1,6 @@ #!/bin/sh appname=`basename "$0"` - ver="0.2.2RC1.2003042403" + ver="0.2.2RC1.2003042507" copy="2002, 2003" mail="PointedEars@gmx.de" mail_feedback="bug-moz@PointedEars.de" @@ -30,7 +30,7 @@ mail_feedback="bug-moz@PointedEars.de" ## the "other" thousands of unices. But it worksforme. --ramiro # (from /usr/local/mozilla/run-mozilla.sh) # - # This is work in progress. If you have an improvement, patch, + # This is work in progress. If you have an improvement, patch, # idea, whatever, on how to make this script better, please # send it to # @@ -57,8 +57,9 @@ mail_feedback="bug-moz@PointedEars.de" # * Use local directories and filenames as URI argument; # (the argument is then preceded internally by file://`pwd`/) # * Support other programs similar to Mozilla (like Phoenix) by specifying - # the start-up command; use MOZILLA_CMD environment as default or `mozilla' - # if it is not present. + # the start-up command (use `MOZILLA_CMD' environment as default or `mozilla' + # if it is not present) and the binary (use `MOZILLA_BIN' environment as + # default or `mozilla-bin' if it is not present). # * Cosmetics # - Added status messages # - Send error messages to stderr @@ -69,7 +70,7 @@ mail_feedback="bug-moz@PointedEars.de" # - Reformatted source not to exceed 80 cols per line (with `\') # to make it easier legible on the console # - Workaround kate's imperfect syntax highlighting with a bunch of `# `' - # (post complains at kate.kde.org) + # (send your complaints to kate.kde.org!) # - Separated help source by a blank line # - Removed unused variables # @@ -91,17 +92,17 @@ mail_feedback="bug-moz@PointedEars.de" # # See the ChangeLog text file for further information. # - # TO DO (0.2.2 RC1, scheduled 2003-04-14) + # TO DO (0.2.2RC1, scheduled 2003-04-28) # # * POSIX conform parsing of options and arguments (incomplete) # * L10n: English and German (using macro function) (incomplete) - # * `-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 + # * `-C', `--command' options to execute arbitrary Mozilla commands # # See the ROADMAP text file for further information. # @@ -135,47 +136,48 @@ function help { echo 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]] - [( [${extd}-wt${norm}] [URI] [...] | ${extd}-${norm} )] \ - [${extd}-m${norm}[ADDRESS[${extd},${norm}...]]] [${extd}-ic${norm}] \ - [${extd}-C${norm} COMMAND] [...] + | ${extd}-V${norm} )] [${extd}-M${norm} COMMAND] [${extd}-B${norm} BINARY] \ + [( ${extd}-T${norm} | ${extd}-k${norm} )] + [${extd}-l${norm}[OPTIONS]] [( [${extd}-wt${norm}] [URI] [...] \ + | ${extd}-${norm} )] [${extd}-m${norm}[ADDRESS[${extd},${norm}...]]] \ + [${extd}-ic${norm}] + [${extd}-C${norm} COMMAND] [...] " echo -n " ${extd}-v${norm}, ${extd}--verbose${norm} " - L "Activate verbose mode. For testing purposes." \ + L "Activate verbose mode. For testing purposes." \ "Ausführliche Ausgabe. Zu Testzwecken." | $fold echo -n " ${extd}-L${norm}, ${extd}--locale${norm} " L "Preselects the locale for program output." \ "Wählt die Ausgabesprache." | $fold echo -n " LOCALE " L "A string of the form \`lc'[\`_CC'[\`.CHARSET']], where \`lc'" \ - "Eine Zeichenfolge der Form \`lc'[\`_CC'[\`.CHARSET']]," + "Eine Zeichenfolge der Form \`lc'[\`_CC'[\`.CHARSET']], wobei" L "\ is a lowercased language code, \`CC' an uppercased country - code and \`CHARSET' a character set code. While \`CC' and - \`CHARSET' are optional (note the rectangle brackets), - a language code must be provided. e.g. \`en', \`en_US' - and \`en_US.US-ASCII'." \ + code and \`CHARSET' a character set code. While \`CC' and + \`CHARSET' are optional (note the rectangle brackets), a + language code must be provided, e.g. \`en', \`en_US' and + \`en_US.US-ASCII'." \ "\ - wobei \`lc' ein Sprachcode in Kleinbuchstaben, \`CC' - ein Ländercode in Grossbuchstaben und \`CHARSET' ein - Zeichensatz ist. Während \`CC' und \`CHARSET' optional - sind (siehe die eckigen Klammern), ist ein Sprachcode - erforderlich, z.B. \`de', \`de_DE' und \ - \`de_DE.ISO-8859-1'." | $fmt + \`lc' ein Sprachcode in Kleinbuchstaben, \`CC' ein \ + Ländercode + in Grossbuchstaben und \`CHARSET' ein Zeichensatz ist. + Während \`CC' und \`CHARSET' optional sind (siehe die + eckigen Klammern), ist ein Sprachcode erforderlich, + z.B. \`de', \`de_DE' und \`de_DE.ISO-8859-1'." | $fmt L "\ - This program currently supports the English (\`en') - and German (\`de') locale. If you are not using the \ + This program currently supports the English (\`en') and + German (\`de') locale. If you are not using the \ \`${extd}-L${norm}' option, be sure to have your \`LANG' and/or \`LC_CTYPE' environment properly set." \ "\ - Dieses Programm unterstützt zur Zeit Englisch (\`en') - und Deutsch (\`de') . Wenn Sie die Option \ - \`${extd}-L${norm}' nicht - angeben, stellen Sie sicher, dass die Umgebungsvariable(n) - \`LANG' und/oder \`LC_CTYPE' korrekt gesetzt sind." | $fmt - + Dieses Programm unterstützt zur Zeit Englisch (\`en') und + Deutsch (\`de'). Wenn Sie die Option \`${extd}-L${norm}' \ + nicht angeben, + stellen Sie sicher, dass die Umgebungsvariable(n) \`LANG' + und/oder \`LC_CTYPE' korrekt gesetzt sind." | $fmt + echo -n " ${extd}-h${norm}, ${extd}--help${norm} " L "Display this help and exit." "Anzeige dieser Hilfe und beenden." | $fold @@ -184,28 +186,56 @@ L "Display version information and exit. "Anzeige der Version und beenden." | $fold echo -n " ${extd}-M${norm}, ${extd}--mozilla${norm} " - L "Specifies how to run Mozilla. " \ - "Definiert, wie Mozilla gestartet werden soll." | $fold - echo "\ - $future" | $fmt + L "Specifies how to run Mozilla." \ + "Gibt an, wie Mozilla gestartet werden soll." | $fold echo -n " COMMAND " - L "The command to run Mozilla. The default is \`mozilla'" \ + L "The command to run Mozilla. The default is \`mozilla'," \ "Befehl, der benutzt werden soll, um Mozilla zu starten." L "\ - which requires the \`mozilla' executable in \`\$PATH' + which requires the \`mozilla' executable in the \`PATH' + environment if it is not in the current directory and if you have not defined one using the \`MOZILLA_CMD' - environment. You may also specify a command in - \`\$PATH' here, so the program will not check if the - path is correct." \ + environment. No check is performed, neither on the + argument nor on the environment, but for \ + \`${extd}moz${norm}' working + properly with a running Mozilla, the command must accept + the \`-remote' option." \ "\ Standard ist \`mozilla', was es erforderlich macht, dass - sich die ausführbare Datei \`mozilla' im \`\$PATH' \ - befindet, - falls Sie nicht mit der Umgebungsvariable \`MOZILLA_CMD' - etwas anderes definiert haben. Sie können hier auch einen - Befehl angeben, der sich im \`\$PATH' befindet, daher wird - das Programm nicht überprüfen, ob der angegebene Pfad - korrekt ist." | $fmt + sich die ausführbare Datei \`mozilla' im Suchpfad (\`PATH') + befindet, falls Sie nicht mit der Umgebungsvariablen + \`MOZILLA_CMD' etwas anderes definiert haben. Weder das + Argument noch die Umgebungsvariable werden einer Prüfung + unterzogen, aber damit \`${extd}moz${norm}' zusammen mit \ + einem laufenden + Mozilla funktioniert, muss der Befehl die Option \`-remote' + akzeptieren." | $fmt + + echo -n " ${extd}-B${norm}, ${extd}--binary${norm} " + L "Specifies what binary is used by Mozilla." \ + "Gibt an, welche Binärdatei von Mozilla benutzt wird." | $fold + echo -n " BINARY " + L "This is needed to determine if Mozilla is already running" \ + "Diese Angabe wird benötigt, um zu ermitteln, ob Mozilla" + L "\ + and for \`${extd}-l${norm}' display. The default is \ + \`mozilla-bin' which + applies at least for Mozilla, Netscape 6.2.3 and above, + and for Phoenix < 0.5. Users of Netscape < 6.2.3 need to + specify \`netscape-bin', users of Phoenix/ Firebird 0.5 + and above need to specify \`phoenix-bin' here. If this + option is left out, the default value can be overwritten + defining the \`MOZILLA_BIN' environment." \ + "\ + bereits läuft und für die Anzeige mit der Option \ + \`${extd}-l${norm}'. + Standard ist \`mozilla-bin', was für Mozilla, Netscape + ab Version 6.2.3 und Phoenix < 0.5 zutrifft. Benutzer + von Netscape < 6.2.3 müssen hier \`netscape-bin', Benutzer + von Phoenix/ Firebird ab 0.5 müssen \`phoenix-bin' angeben. + Wird diese Option nicht angegeben, so kann der Standardwert + durch Definition der Umgebungsvariablen \`MOZILLA_BIN' + überschrieben werden." | $fmt # ` # version 0.2.3 proposal @@ -217,7 +247,7 @@ befindet, L "Terminate all Mozilla processes (first), sending each" \ "Beendet (zuerst) alle Mozilla-Prozesse, indem jedem" | $fold L "\ - of them a SIGTERM(15) signal. Need not to work as a + of them a SIGTERM(15) signal. Need not to work as a process may refuse to terminate (see \ \`${extd}-k${norm}')." \ "\ @@ -237,12 +267,12 @@ diese neuer Browser-Tab erzeugt wird (siehe unten)." | $fmt echo -n " ${extd}-k${norm}, ${extd}--kill${norm} " - L "Kill all Mozilla processes (first). Tries first to send" \ + L "Kill all Mozilla processes (first). Tries first to send" \ "Beendet (zuerst) alle Mozilla-Prozesse." | $fold L "\ - each of the processes a SIGTERM(15) signal to end - them politely. If (and only if) this does not work, - send them the kinda rude SIGKILL(9) signal ;-)" \ + each of the processes a SIGTERM(15) signal to end them + politely. If (and only if) this does not work, send + them the kinda rude SIGKILL(9) signal ;-)" \ "\ Versucht zunächst, jedem Prozess ein SIGTERM(15)-Signal zu senden, um ihn höflich um seine Beendigung zu bitten. @@ -254,7 +284,7 @@ L "List running Mozilla processes and th "Zeigt laufende Mozilla-Prozesse an." | $fold echo -n " OPTIONS " - L "Options for \`ps'. Type \`ps --help' for details." \ + L "Options for \`ps'. Type \`ps --help' for details." \ "Optionen für \`ps'. \`ps --help' für Details eingeben." | $fold L "\ The default is to use the user-oriented format @@ -264,7 +294,7 @@ L "\ benutzt, falls es unterstützt wird." | $fmt echo -n " ${extd}-n${norm}, ${extd}--new${norm} " - L "Same as \`${extd}-w${norm}'. For backwards compatibility only," \ + L "Same as \`${extd}-w${norm}'. For backwards compatibility only," \ "Wie \`${extd}-w${norm}'. Nur für Abwärtskompatibilität vorhanden," | $fold L "\ this may become obsolete in future versions." \ @@ -276,23 +306,23 @@ L "\ L "Show the resource(s) specified by URI in a new browser" \ "Zeigt die mit URI angegebene(n) Ressource(n) in" | $fold L "\ - window. If not provided, the current window/tab content - will be replaced. Resources with \`mailto:' URIs will - create a new e-mail compose window anyway." \ + window. If not provided, the current window/ tab + content will be replaced. Resources with \`mailto:' + URIs will create a new Message Compose window anyway." \ "\ - einem neuen Browser-Fenster. Wenn nicht angegeben, + einem neuen Browser-Fenster. Wenn nicht angegeben, wird der Inhalt des aktuellen Fensters/Tabs ersetzt. Ressourcen mit \`mailto:'-URIs erzeugen jedoch immer ein neues Fenster für die Mailbearbeitung." | $fmt echo -n " ${extd}-t${norm}, ${extd}--tab${norm} " - L "Show the resource(s) specified by URI in a new browser tab." \ + L "Show the resource(s) specified by URI in a new browser" \ "Zeigt die mit URI angegebene(n) Ressource(n) in einem" | $fold L "\ - Works with Mozilla 1.0.1, 1.1 and beyond. If not provided, - the current window/tab content will be replaced. Resources - with \`mailto:' URIs will create a new e-mail compose - window anyway." \ + tab. Works with Mozilla 1.0.1, 1.1 and beyond. + If not provided, the current window/ tab content + will be replaced. Resources with \`mailto:' URIs + will create a new Message Compose window anyway." \ "\ neuen Browser-Tab. Funktioniert mit Mozilla 1.0.1, 1.1 und höher. Wenn nicht angegeben, wird der Inhalt @@ -301,7 +331,7 @@ L "\ für die Mailbearbeitung." | $fmt echo -n " URI " - L "The URI(s) of the resource(s) to display. If not provided" \ + L "The URI(s) of the resource(s) to display. If not provided" \ "URI(s) der anzuzeigenden Ressource(n). Wenn nicht" | $fold L "\ and no further options are given, show this help and \ @@ -329,7 +359,7 @@ L "(Re)start Mozilla with a blank page ( "(Neu)start von Mozilla mit einer leeren Seite (bzw." | $fold L "\ new process) or show a window that allows you to select - what to do (Mozilla 1.1 and beyond). This disables any + what to do (Mozilla 1.1 and beyond). This disables any previous \`${extd}-w${norm}' or \`${extd}-t${norm}' \ options and is especially useful in conjunction with \`${extd}-T${norm}' or \ @@ -347,7 +377,7 @@ Verbindung mit L "Pop up the mail dialog." "Öffnet ein neues Fenster zum Verfassen einer E-Mail." | $fold echo -n " ADDRESS " - L "If left out, the \`To:' field is empty. Given one or more" \ + L "If left out, the \`To:' field is empty. Given one or more" \ "Wenn dieses Argument ausgelassen wird, ist das Feld" | $fold L "\ comma-separated addresses, put those in the default \ @@ -369,7 +399,7 @@ L "Open a new Message Compose window. Wie \`${extd}-m${norm}' ohne ADDRESS." | $fold echo -n " ${extd}-C${norm}, ${extd}--command${norm} " - L "Execute arbitrary Mozilla COMMAND. $future" \ + L "Execute arbitrary Mozilla COMMAND. $future" \ "Beliebigen Mozilla-Befehl COMMAND ausführen. $future" | $fold @@ -378,7 +408,7 @@ _XPG=1 echo " $(L "\ Note that the long options are not available on this system, so you - must use the short options instead. Also, optional arguments are not + must use the short options instead. Also, optional arguments are not supported, so if you do not pass an argument to an option, you must use \"\" instead." \ "\ @@ -416,7 +446,7 @@ function isMozRunning { ps $args >/dev/null 2>&1 test $? -ne 0 && args=$fallback fi - chk=`ps $args | grep mozilla-bin | grep -v grep` + chk=`ps $args | grep $mozilla_bin | grep -v grep` test -z "$chk" && return 1 return 0 } @@ -433,7 +463,7 @@ function KillMoz { Lout=`L " signal" "-Signal"` echo -n "$Lout$stat" if isMozRunning; then - killall $1 mozilla-bin 2>/dev/null + killall $1 $mozilla_bin 2>/dev/null result=$? # FIX ME! # allow other user's processes to run and be successful anyway @@ -453,9 +483,9 @@ function KillMoz { echo " " L "Mozilla was pinged $ping times without response, trying - $ping more times before giving up. Press Ctrl+C to quit." \ + $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 + $ping Versuche unternommen. Drücken Sie Strg+C, um abzubrechen." | $fmt >&2 echo -n " $stat" >&2 fi @@ -490,7 +520,7 @@ _XPG=0 } function ListMoz { - # check for supported `ps' options + # check for supported `ps' options whoami=`whoami` args=" $1 " ps $args >/dev/null 2>&1 @@ -534,10 +564,10 @@ function ListMoz { ps $args >/dev/null 2>&1 test $? -ne 0 && args=$fallback fi - chk=`ps $args | grep mozilla-bin | grep -v grep` + chk=`ps $args | grep $mozilla_bin | grep -v grep` if [ -z "$chk" ]; then - L "There are no \`mozilla-bin' processes running." \ - "Es laufen keine \`mozilla-bin'-Prozesse." | $fold >&2 + L "There are no \`${mozilla_bin}' processes running." \ + "Es laufen keine \`${mozilla_bin}'-Prozesse." | $fold >&2 else echo `L "Running Mozilla processes and threads" \ "Laufende Mozilla-Prozesse und Threads"`": @@ -647,9 +677,9 @@ Original arguments: $*" >&2 if `getopt -T >/dev/null 2>&1` ; [ $? = 4 ] ; then getopt_type=long echo "getopt(1) type: enhanced" >&2 - 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 \ + tmp=`getopt -o vL:hVM:B:Tkl::n:w:t:-m::ic \ + -l verbose,locale:,help,version,mozilla:,binary:,term,kill,list,\ + full,new:,win:,tab:,mailto::,inbox,compose \ -n "$appname" -s sh \ -- "$@"` else @@ -663,6 +693,7 @@ help=0 verbose=0 version=0 mozilla=${MOZILLA_CMD:-mozilla} + mozilla_bin=${MOZILLA_BIN:-mozilla-bin} term="" list=0 list_style="" @@ -688,6 +719,7 @@ echo "New arguments: $*$norm -L | --locale) lg=$2; shift 2;; -V | --version) version=1; shift;; -M | --mozilla) mozilla=$2; shift 2;; + -B | --binary) mozilla_bin=$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;; @@ -794,7 +826,7 @@ $(L "The \`${mozilla}' executable is req # 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` + chk=`ps -fu $(whoami) 2>/dev/null | grep $mozilla_bin | grep -v grep` _XPG=0 test -z "$uri" && uri="$1" @@ -828,7 +860,7 @@ $(L "The \`${mozilla}' executable is req echo " " L "Mozilla was pinged $ping times without response, trying - $ping more times before giving up. Press Ctrl+C to quit." \ + $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 " @@ -871,7 +903,7 @@ Bitte überprüfen Sie ihre Mozilla-Instal _XPG=1 if [ $? -ne 0 ]; then echo "${appname}: \`grep' "\ - $(L "not found. Cannot check for \`mailto:' URI." \ + $(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 @@ -880,7 +912,7 @@ Bitte überprüfen Sie ihre Mozilla-Instal chk=`which sed 2>/dev/null` if [ $? -ne 0 ]; then echo $appname": \`sed' "\ - $(L "not found. Cannot handle \`mailto:' URI properly." \ + $(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://"`