head	1.3;
access;
symbols
	RELENG_7_4_0_RELEASE:1.2.38.1
	RELENG_7_4:1.2.0.38
	RELENG_7_4_BP:1.2
	RELENG_7_3_0_RELEASE:1.2.36.1
	RELENG_7_3:1.2.0.36
	RELENG_7_3_BP:1.2
	RELENG_7_2_0_RELEASE:1.2.34.1
	RELENG_7_2:1.2.0.34
	RELENG_7_2_BP:1.2
	RELENG_7_1_0_RELEASE:1.2.32.1
	RELENG_6_4_0_RELEASE:1.2.30.1
	RELENG_7_1:1.2.0.32
	RELENG_7_1_BP:1.2
	RELENG_6_4:1.2.0.30
	RELENG_6_4_BP:1.2
	RELENG_7_0_0_RELEASE:1.2
	RELENG_6_3_0_RELEASE:1.2
	RELENG_7_0:1.2.0.28
	RELENG_7_0_BP:1.2
	RELENG_6_3:1.2.0.26
	RELENG_6_3_BP:1.2
	RELENG_7:1.2.0.24
	RELENG_7_BP:1.2
	RELENG_6_2_0_RELEASE:1.2
	RELENG_6_2:1.2.0.22
	RELENG_6_2_BP:1.2
	RELENG_5_5_0_RELEASE:1.2
	RELENG_5_5:1.2.0.20
	RELENG_5_5_BP:1.2
	RELENG_6_1_0_RELEASE:1.2
	RELENG_6_1:1.2.0.18
	RELENG_6_1_BP:1.2
	RELENG_6_0_0_RELEASE:1.2
	RELENG_6_0:1.2.0.16
	RELENG_6_0_BP:1.2
	RELENG_6:1.2.0.14
	RELENG_6_BP:1.2
	RELENG_5_4_0_RELEASE:1.2
	RELENG_5_4:1.2.0.12
	RELENG_5_4_BP:1.2
	RELENG_4_11_0_RELEASE:1.1.2.1
	RELENG_4_11:1.1.2.1.0.16
	RELENG_4_11_BP:1.1.2.1
	RELENG_5_3_0_RELEASE:1.2
	RELENG_5_3:1.2.0.10
	RELENG_5_3_BP:1.2
	RELENG_5:1.2.0.8
	RELENG_5_BP:1.2
	RELENG_4_10_0_RELEASE:1.1.2.1
	RELENG_4_10:1.1.2.1.0.14
	RELENG_4_10_BP:1.1.2.1
	RELENG_5_2_1_RELEASE:1.2
	RELENG_5_2_0_RELEASE:1.2
	RELENG_5_2:1.2.0.6
	RELENG_5_2_BP:1.2
	RELENG_4_9_0_RELEASE:1.1.2.1
	RELENG_4_9:1.1.2.1.0.12
	RELENG_4_9_BP:1.1.2.1
	RELENG_5_1_0_RELEASE:1.2
	RELENG_5_1:1.2.0.4
	RELENG_5_1_BP:1.2
	RELENG_4_8_0_RELEASE:1.1.2.1
	RELENG_4_8:1.1.2.1.0.10
	RELENG_4_8_BP:1.1.2.1
	RELENG_5_0_0_RELEASE:1.2
	RELENG_5_0:1.2.0.2
	RELENG_5_0_BP:1.2
	RELENG_4_7_0_RELEASE:1.1.2.1
	RELENG_4_7:1.1.2.1.0.8
	RELENG_4_7_BP:1.1.2.1
	RELENG_4_6_2_RELEASE:1.1.2.1
	RELENG_4_6_1_RELEASE:1.1.2.1
	RELENG_4_6_0_RELEASE:1.1.2.1
	RELENG_4_6:1.1.2.1.0.6
	RELENG_4_6_BP:1.1.2.1
	RELENG_4_5_0_RELEASE:1.1.2.1
	RELENG_4_5:1.1.2.1.0.4
	RELENG_4_5_BP:1.1.2.1
	RELENG_4_4_0_RELEASE:1.1.2.1
	RELENG_4_4:1.1.2.1.0.2
	RELENG_4_4_BP:1.1.2.1
	RELENG_4:1.1.0.2;
locks; strict;
comment	@# @;


1.3
date	2008.05.26.10.39.49;	author bz;	state dead;
branches;
next	1.2;

1.2
date	2002.04.22.13.44.29;	author des;	state Exp;
branches
	1.2.14.1
	1.2.24.1
	1.2.30.1
	1.2.32.1
	1.2.34.1
	1.2.36.1
	1.2.38.1;
next	1.1;

1.1
date	2001.05.25.13.25.59;	author hm;	state Exp;
branches
	1.1.2.1;
next	;

1.2.14.1
date	2012.11.17.07.41.33;	author svnexp;	state Exp;
branches;
next	;

1.2.24.1
date	2012.11.17.08.03.53;	author svnexp;	state Exp;
branches;
next	;

1.2.30.1
date	2008.10.02.02.57.24;	author kensmith;	state Exp;
branches;
next	;

1.2.32.1
date	2008.11.25.02.59.29;	author kensmith;	state Exp;
branches;
next	;

1.2.34.1
date	2009.04.15.03.14.26;	author kensmith;	state Exp;
branches;
next	;

1.2.36.1
date	2010.02.10.00.26.20;	author kensmith;	state Exp;
branches;
next	;

1.2.38.1
date	2010.12.21.17.10.29;	author kensmith;	state Exp;
branches;
next	1.2.38.2;

1.2.38.2
date	2012.11.17.08.16.56;	author svnexp;	state Exp;
branches;
next	;

1.1.2.1
date	2001.08.10.14.59.48;	author obrien;	state Exp;
branches;
next	1.1.2.2;

1.1.2.2
date	2012.11.17.07.24.45;	author svnexp;	state Exp;
branches;
next	;


desc
@@


1.3
log
@Remove ISDN4BSD (I4B) from HEAD as it is not MPSAFE and
parts relied on the now removed NET_NEEDS_GIANT.
Most of I4B has been disconnected from the build
since July 2007 in HEAD/RELENG_7.

This is what was removed:
- configuration in /etc/isdn
- examples
- man pages
- kernel configuration
- sys/i4b (drivers, layers, include files)
- user space tools
- i4b support from ppp
- further documentation

Discussed with: rwatson, re
@
text
@#!/bin/sh

# isdnctl
# Control the ISDN line based on usage
#
# This script can control the state of your ISDN line.  It counts
# how many scripts/users currently use the ISDN line and uses
# "ifconfig down" if noone uses it any more.
# I use this script for cronjobs that fetch mail and news and run cvsup.
# If I'm still using the line, the script won't close the connection,
# but if not, it saves a lot of phone costs.
#
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42, (c) Poul-Henning Kamp):
# Alexander Langer <alex@@big.endian.de> wrote this file.  As long as you retain
# this notice you can do whatever you want with this stuff. If we meet some
# day, and you think this stuff is worth it, you can buy me a beer in return.
#
# Alexander Langer
# ----------------------------------------------------------------------------
#
# $FreeBSD: src/share/examples/isdn/contrib/isdnctl,v 1.2 2002/04/22 13:44:29 des Exp $
#


usage () {
	echo "usage: $0 [-i interface] [-f /path/to/users.file] [up|down|show]"
}

# Defaults
INTERFACE=isp0
USERSFILE=

# Getopt stuff
args=`getopt i:f: $*`
if [ $? != 0 ]; then
		usage
		exit 2
	fi
set -- $args
for i; do
	case "$i" in
		-i)
			INTERFACE="$2"
			shift; shift
			;;
		-f)
			USERSFILE="$2"
			shift; shift
			;;
		--)
			shift
			break
			;;
	esac
done

if [ -z $USERSFILE ]; then
	USERSFILE=/var/run/isdn.users.$INTERFACE
fi

if [ -z $1 ]; then
	usage
	exit 2
fi

# Does Usersfile exist?
if [ ! -f $USERSFILE ]; then
	# Try to create it
	if ! /sbin/ifconfig $INTERFACE | grep "^$INTERFACE.*<UP," > /dev/null; then
		echo "0" > $USERSFILE || exit 1
	else
		echo "1" > $USERSFILE || exit 1
	fi
elif [ ! -w $USERSFILE ]; then
	echo "Error: $USERSFILE not writeable!"
	exit 1
fi

if ! /sbin/ifconfig $INTERFACE | grep "^$INTERFACE.*<UP," > /dev/null; then
	if ! cat $USERSFILE | grep '^0$' > /dev/null ; then 
		echo "Interface down, removing number from file";
		echo "0" > $USERSFILE
	fi;
fi;

case "$1" in
		show)
			echo "`cat $USERSFILE` users online"
			;;
		up)
			expr `cat $USERSFILE` + 1 > $USERSFILE
			/sbin/ifconfig $INTERFACE up
			echo "`cat $USERSFILE` users online"
			;;
		down)
			if cat $USERSFILE | grep '^0$' > /dev/null ; then 
				echo "Already down"
				exit 0
			fi
			expr `cat $USERSFILE` - 1 > $USERSFILE
			if cat $USERSFILE | grep '^0$' > /dev/null ; then 
				echo "`cat $USERSFILE` users online, interface down"
				/sbin/ifconfig $INTERFACE down
				exit 0
			fi
			echo "`cat $USERSFILE` users online"
			;;
esac

exit 0
@


1.2
log
@Usage style sweep: spell "usage" with a small 'u'.
Also change one case of blatant __progname abuse (several more remain)
This commit does not touch anything in src/{contrib,crypto,gnu}/.
@
text
@d22 1
a22 1
# $FreeBSD$
@


1.2.24.1
log
@Switch importer
@
text
@d22 1
a22 1
# $FreeBSD: stable/7/share/examples/isdn/contrib/isdnctl 95258 2002-04-22 13:44:47Z des $
@


1.2.14.1
log
@Switch importer
@
text
@d22 1
a22 1
# $FreeBSD: stable/6/share/examples/isdn/contrib/isdnctl 95258 2002-04-22 13:44:47Z des $
@


1.2.38.1
log
@SVN rev 216618 on 2010-12-21 17:10:29Z by kensmith

Copy stable/7 to releng/7.4 in preparation for FreeBSD-7.4 release.

Approved by:	re (implicit)
@
text
@@


1.2.38.2
log
@Switch importer
@
text
@d22 1
a22 1
# $FreeBSD: releng/7.4/share/examples/isdn/contrib/isdnctl 95258 2002-04-22 13:44:47Z des $
@


1.2.36.1
log
@SVN rev 203736 on 2010-02-10 00:26:20Z by kensmith

Copy stable/7 to releng/7.3 as part of the 7.3-RELEASE process.

Approved by:	re (implicit)
@
text
@@


1.2.34.1
log
@SVN rev 191087 on 2009-04-15 03:14:26Z by kensmith

Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.

Approved by:	re (implicit)
@
text
@@


1.2.32.1
log
@SVN rev 185281 on 2008-11-25 02:59:29Z by kensmith

Create releng/7.1 in preparation for moving into RC phase of 7.1 release
cycle.

Approved by:	re (implicit)
@
text
@@


1.2.30.1
log
@SVN rev 183531 on 2008-10-02 02:57:24Z by kensmith

Create releng/6.4 from stable/6 in preparation for 6.4-RC1.

Approved by:	re (implicit)
@
text
@@


1.1
log
@Add the contributed directory from the i4b tarball and the files from it
which would be nice to have.
Move isdnd_acct and isdnctl to the contrib directory where they belong to.
@
text
@d27 1
a27 1
	echo "Usage: $0 [-i interface] [-f /path/to/users.file] [up|down|show]"
@


1.1.2.1
log
@MFC: version 1.01

Approved by:	jkh
@
text
@d22 1
a22 1
# $FreeBSD: src/share/examples/isdn/contrib/isdnctl,v 1.1 2001/05/25 13:25:59 hm Exp $
@


1.1.2.2
log
@Switch importer
@
text
@d22 1
a22 1
# $FreeBSD: stable/4/share/examples/isdn/contrib/isdnctl 81456 2001-08-10 14:59:48Z obrien $
@


