#!/bin/tcsh
#  ______________________
# / connect-or-disconnect
# ------------------------
# A simple script to connect/disconnect from internet.
# Displays a small window to ask the user if he wants to 
# connect (when not connected) and an other window if he wants
# to disconnect (when connected)

# By JC/2002

if ( `pidof pppd` == "" ) then
  Xdialog --title Connection \
	    --yesno "Not connected\nConnect now ?" \
	    --icon /home/julien/.fvwm2/icons/48/phone.xpm  \
	    10 30

  set OUTPUT=$?
  if ("$OUTPUT" == "0") then
    echo "connect now!"
     modem-connect
  else
    echo "cancel"
  endif
else
  Xdialog --title Connection \
	    --icon /home/julien/.fvwm2/icons/48/phone-locked.xpm \
	    --yesno "Modem is connected.\nDisconnect now ?" \
	    10 30
  set OUTPUT=$?
  if ("$OUTPUT" == "0") then
    echo "disconnect now!"
     modem-disconnect
  else
    echo "cancel"
  endif
endif
