#	modem-stats

# Send a command to a modem, and echo the modem's response.

# This program is typically used to document a modem's status after a
# connection, and may also be used to gather accounting statistics.

# This program may also be used to reset a modem,
# or send an initialization string to a modem.

# This program may be freely copied and used, as long as this header,
# the accompanying documentation, and the author's name remain intact.

# Copyright (c) 1995, Kenneth J. Hendrickson
#      kjh@usc.edu, kjh@seas.smu.edu

# To compile, type	make
# To install, type	make install install.man

# A snazzy use for modem-stats is to gather modem link statistics at
# the termination of a ppp or slip call.  If you are using ppp, the
# following six lines in your /etc/ppp/ip-down file will do the job:
# (Make sure to have /etc/ppp permissions set at drwxrwxrwt)

# Gather modem statistics about this particular call
sleep 2 # make sure the modem is really down
DEV=`echo $2 | sed -e 's./dev/..'`
echo '----------' >> /etc/ppp/modem.$DEV
date              >> /etc/ppp/modem.$DEV
modem-stats $2    >> /etc/ppp/modem.$DEV

