10SN/A#!/bin/sh
2157SN/A
30SN/A#-
40SN/A# Copyright (c) 1991, 1993
50SN/A#	The Regents of the University of California.  All rights reserved.
60SN/A#
7157SN/A# This code is derived from software contributed to Berkeley by
80SN/A# Kenneth Almquist.
9157SN/A#
100SN/A# Redistribution and use in source and binary forms, with or without
110SN/A# modification, are permitted provided that the following conditions
120SN/A# are met:
130SN/A# 1. Redistributions of source code must retain the above copyright
140SN/A#    notice, this list of conditions and the following disclaimer.
150SN/A# 2. Redistributions in binary form must reproduce the above copyright
160SN/A#    notice, this list of conditions and the following disclaimer in the
170SN/A#    documentation and/or other materials provided with the distribution.
180SN/A# 3. Neither the name of the University nor the names of its contributors
190SN/A#    may be used to endorse or promote products derived from this software
200SN/A#    without specific prior written permission.
21157SN/A#
22157SN/A# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23157SN/A# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
240SN/A# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
250SN/A# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
260SN/A# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
270SN/A# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
280SN/A# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
290SN/A# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
300SN/A# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
310SN/A# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
320SN/A# SUCH DAMAGE.
330SN/A
340SN/A# pushd, popd, and dirs --- written by Chris Bertin
350SN/A# Pixel Computer Inc. ...!wjh12!pixel!pixutl!chris
360SN/A# as modified by Patrick Elam of GTRI and Kenneth Almquist at UW
370SN/A
380SN/Apushd () {
390SN/A	SAVE=`pwd`
400SN/A	if [ "$1" = "" ] 
410SN/A	then	if [ "$DSTACK" = "" ]
420SN/A		then	echo "pushd: directory stack empty."
430SN/A			return 1
440SN/A		fi
450SN/A		set $DSTACK
460SN/A		cd $1 || return
470SN/A		shift 1
480SN/A		DSTACK="$*"
490SN/A	else	cd $1 > /dev/null || return
500SN/A	fi
510SN/A	DSTACK="$SAVE $DSTACK"
520SN/A	dirs
530SN/A}
540SN/A
550SN/Apopd () {
560SN/A	if [ "$DSTACK" = "" ] 
570SN/A	then	echo "popd: directory stack empty."
580SN/A		return 1
590SN/A	fi
600SN/A	set $DSTACK
610SN/A	cd $1
620SN/A	shift
630SN/A	DSTACK=$*
640SN/A	dirs
650SN/A}
660SN/A
670SN/Adirs () {
680SN/A	echo "`pwd` $DSTACK"
690SN/A	return 0
700SN/A}
710SN/A