--- uwhois-0.3.2 Tue Nov 12 02:36:57 2002 +++ uwhois Mon Feb 3 15:01:04 2003 @@ -1,8 +1,11 @@ #!/bin/sh - echo + ver="0.3.3a" + copy="2002, 2003" + mail="PointedEars@gmx.de" + mail_feedback="bug-uwhois@PointedEars.de" # ---------------------------------------------------------------------------- - echo "uWhois 0.3.2 -- Retrieves universal WHOIS data using whois.thur.de" - echo "Copyright (c) 2002 Thomas Lahn " + # uWhois 0.3.3a -- Retrieves universal WHOIS data using whois.thur.de + # Copyright (c) 2002, 2003 Thomas Lahn # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,45 +18,124 @@ echo "Copyright (c) 2002 Thomas Lahn

# # ---------------------------------------------------------------------------- + # from /etc/rc.status + + 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}[1m" + norm=`echo -en "${esc}[m\017"` + stat=`echo -en "\015${esc}[${COLUMNS}C${esc}[10D"` + else + esc="" + extd="" + warn="" + done="" + attn="" + norm="" + stat="" + fi + + rc_done="${extd}done${norm}" + rc_running="${stat}${done}running${norm}" + rc_failed="${warn}failed${norm}" + rc_missed="${warn}not found${norm}" + rc_skipped="${attn}skipped${norm}" + rc_done_up="${esc}[1A${rc_done}" + rc_failed_up="${esc}[1A${rc_failed}" + + # check for fold + fold="fold -sw $COLUMNS" + chk=`which fold 2> /dev/null` + test $? -ne 0 && fold="cat" + chk=`echo x | $fold 1> /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 + function help { - echo "Usage: `basename $0` [-c COMMAND | -mlptv?] OBJECT [...]" + echo "Usage: ${extd}`basename $0`${norm} [${extd}-t${norm}] [ ( ${extd}-c${norm} COMMAND | ${extd}-mlpv?${norm} | ${extd}--version${norm} ) ] OBJECT [...]" echo - echo "-c, --command Try to use COMMAND to display output which must read from" - echo " standard input." - echo "-m, --more Try to use \`more' to display output (page by page)." - echo "-l, --less Try to use \`less' to display output (scrollable)." - echo " --vi Try to use \`vi' to display output (scrollable and editable)." - echo "-p, --pager Try to use the command from the PAGER environment variable" - echo -n " (currently " + echo -n "\ + ${extd}-t${norm}, ${extd}--test${norm} Run a test to determine the query \ + method that is used. + ${extd}-c${norm}, ${extd}--command${norm} Try to use COMMAND to display output which must read from + standard input. + ${extd}-m${norm}, ${extd}--more${norm} Try to use \`more' to display output (page by page). + ${extd}-l${norm}, ${extd}--less${norm} Try to use \`less' to display output (scrollable). + ${extd}--vi${norm} Try to use \`vi' to display output (scrollable and editable). + ${extd}-p${norm}, ${extd}--pager${norm} Try to use the command from the PAGER environment variable + (currently " if [ -n "$PAGER" ]; then echo -n "\`$PAGER'" else echo -n "undefined" fi - echo ") to display output." - echo " Note that the first command must read from standard input." - echo "-t, --test Run a test to determine the query method that is used" - echo " (\`whois' or \`telnet') and which of the supporting" - echo " programs are available." - echo "-v, --verbose For future use. Verbose mode is always enabled for now." - echo " --version Display version and exit." - echo "-?, --help Display this help and exit." - echo "OBJECT Domain name or IP address or (if \`sed' is available)" - echo " an URI containing the domain name/an IP address." - echo " Two or more OBJECTs are separated by spaces." + echo ") to display output. + Note that the first command must read from standard input. + (\`whois' or \`telnet') and which of the supporting + programs are available. + ${extd}-v${norm}, ${extd}--verbose${norm} ${extd}For future use.${norm} Verbose mode is always enabled for now. + ${extd}--version${norm} Display version and exit. + ${extd}-?${norm}, ${extd}--help${norm} Display this help and exit. + OBJECT Domain name or IPv4 address or (if \`sed' is available) + an URI containing the domain name/an IPv4 address. + Two or more OBJECTs are separated by spaces." } - echo "Protected under the terms of the GNU General Public License (GPL)." - echo "See COPYING file or http://www.fsf.org/copyleft/gpl.html for details." - echo "This is work in progress. Feel free to submit suggestions and report any bugs." - echo + echo " + ${extd}uWhois $ver -- Retrieves universal WHOIS data using whois.thur.de${norm} + Copyright (c) $copy Thomas Lahn <${mail}> + Distributed under the terms of the GNU General Public License (GPL). + See COPYING file or http://www.fsf.org/copyleft/gpl.html for details. + This is work in progress. Feel free to submit suggestions and report any bugs. + " if [ -z "$1" ] || [ "$1" = "-?" ] || [ "$1" = "--help" ]; then help