#! /bin/bash

## 
## Usage: @PROG@
## 
##   Display IP address using gxmessage
## 


PROG=$(basename $0)
XMESSAGE=${XMESSAGE:-gxmessage}
MSG_TITLE="IP Address"
MSG_POS=-center
[ "$XMESSAGE" = "gxmessage" ] && MSG_WRAP=-wrap


showUsage ()
{
  sed -n '/^##/s/^## //p' $0 |
  sed -e "s/@PROG@/${PROG}/g"
  exit 0
}


[ "$1" = "-h" -o "$1" = "--help" ] && showUsage


msg=$( /sbin/ifconfig ppp0 2>&1 ) &&
    msg=$( echo "$msg" |
        sed -n 's/^[[:space:]]*inet addr:\([0-9.]\+\).*/\1/p' )

$XMESSAGE $MSG_POS $MSG_WRAP -title "$MSG_TITLE" "$msg"

