--- 2003-03-29-13/moz Sat Mar 29 12:22:56 2003 +++ latest/moz Sat Apr 5 04:49:08 2003 @@ -1,5 +1,5 @@ #!/bin/sh - ver="0.2.2b+.2003032913" + ver="0.2.2b+.2003040504" copy="2002, 2003" mail="PointedEars@gmx.de" mail_feedback="bug-moz@PointedEars.de" @@ -45,7 +45,7 @@ mail_feedback="bug-moz@PointedEars.de" # doing anything # * `-l' lists running `mozilla-bin' processes/threads using `ps'; # Tests for and support of user-oriented `ps' output (`u'), - # uses Unix98 options as fallback + # uses Unix98 options as fallback; allow arbitrary `ps' options # * `-m' allows to open new Compose window with predefined `To:' field # * `-i' opens a new MailNews window # * `-c' opens a new Compose window with empty `To:' field @@ -78,7 +78,6 @@ mail_feedback="bug-moz@PointedEars.de" # # * POSIX conform parsing of options and arguments (incomplete) # * `-M', `--mozilla': Support other programs similar to Mozilla like Phoenix - # * `-l -f': Force full output format; ignore if not supported (incomplete) # * `-C', `--command' options to execute arbitrary Mozilla commands # * Cosmetics: # - More modular code (incomplete) @@ -94,14 +93,17 @@ mail_feedback="bug-moz@PointedEars.de" # 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:klfn:w:t:-m::ic \ - --long verbose,locale:,help,version,mozilla:,term,kill,list,\ - full,new:,win:,tab:,mailto::,inbox,compose \ - -n $(basename "$0") -- "$@"` + 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:klfn:w:t:-m:ic "$@"` + tmp=`getopt vL:hVM:kl:n:w:t:-m:ic "$@"` fi getopt_exit_code=$? @@ -270,11 +272,10 @@ function help { echo "${extd}`basename "$1"`${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} [${extd}-f${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}-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." \ @@ -387,14 +388,15 @@ L "\ L "List running Mozilla processes and threads and exit." \ "Zeigt laufende Mozilla-Prozesse an." | $fold - echo -n " ${extd}-f${norm}, ${extd}--full${norm} " - L "Force full output format. The default is to use the" \ - "Erzwinge das vollständige Ausgabeformat. Standardmässig" | $fold + echo -n " OPTIONS " + L "Options for \`ps'. Type \`ps --help' for details." \ + "Optionen für \`ps'. \`ps --help' für Details eingeben." | $fold L "\ - user-oriented format if supported. $future" \ + The default is to use the user-oriented format + if supported." \ "\ - wird das benutzerorientierte Format benutzt, falls es - unterstützt wird. $future" | $fmt + Standardmässig wird das benutzerorientierte Format + 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," \ @@ -505,16 +507,23 @@ L "Opens a new Message Compose window. L "Execute arbitrary Mozilla COMMAND. $future" \ "Beliebigen Mozilla-Befehl COMMAND ausführen. $future" | $fold - + + if [ $getopt_type = "long" ]; then _XPG=1 - echo " - $(L "Note that the long options may not be available on this - system, so you must use the short options instead." \ - "Beachten Sie, dass die langen Optionen möglicherweise auf diesem System - nicht verfügbar sind. Nutzen Sie in diesem Fall die kurzen Optionen." \ - | $fmt) - " + 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 + supported, so if you do not pass an argument to an option, you must + use '' instead." \ + "\ + Beachten Sie, dass die langen Optionen auf diesem System nicht verfügbar + sind, so dass Sie die kurzen Optionen verwenden müssen. Weiterhin werden + optionale Argumente nicht unterstützt. Wenn Sie ein optionales Argument + nicht angeben, müssen Sie stattdessen '' angeben." | $fmt)" _XPG=0 + fi + echo } function isMozRunning { @@ -617,11 +626,17 @@ _XPG=0 function ListMoz { # check for supported `ps' options whoami=`whoami` - # BSD style user-oriented - args="u $1 " + args=" $1 " ps $args >/dev/null 2>&1 if [ $? -eq 0 ]; then fallback=$args + args=$args" u" # BSD style user-oriented + ps $args >/dev/null 2>&1 + if [ $? -eq 0 ]; then + fallback=$args + else + args=$fallback + fi args=$args" -H" # with process hierarchy ps $args >/dev/null 2>&1 if [ $? -eq 0 ]; then