head	1.1;
branch	1.1.1;
access;
symbols
	RELENG_8_4:1.1.1.2.0.56
	RELENG_9_1_0_RELEASE:1.1.1.2
	RELENG_9_1:1.1.1.2.0.54
	RELENG_9_1_BP:1.1.1.2
	RELENG_8_3_0_RELEASE:1.1.1.2
	RELENG_8_3:1.1.1.2.0.52
	RELENG_8_3_BP:1.1.1.2
	RELENG_9_0_0_RELEASE:1.1.1.2
	RELENG_9_0:1.1.1.2.0.50
	RELENG_9_0_BP:1.1.1.2
	RELENG_9:1.1.1.2.0.48
	RELENG_9_BP:1.1.1.2
	RELENG_7_4_0_RELEASE:1.1.1.2
	RELENG_8_2_0_RELEASE:1.1.1.2
	RELENG_7_4:1.1.1.2.0.46
	RELENG_7_4_BP:1.1.1.2
	RELENG_8_2:1.1.1.2.0.44
	RELENG_8_2_BP:1.1.1.2
	RELENG_8_1_0_RELEASE:1.1.1.2
	RELENG_8_1:1.1.1.2.0.42
	RELENG_8_1_BP:1.1.1.2
	RELENG_7_3_0_RELEASE:1.1.1.2
	RELENG_7_3:1.1.1.2.0.40
	RELENG_7_3_BP:1.1.1.2
	RELENG_8_0_0_RELEASE:1.1.1.2
	RELENG_8_0:1.1.1.2.0.38
	RELENG_8_0_BP:1.1.1.2
	RELENG_8:1.1.1.2.0.36
	RELENG_8_BP:1.1.1.2
	RELENG_7_2_0_RELEASE:1.1.1.2
	RELENG_7_2:1.1.1.2.0.34
	RELENG_7_2_BP:1.1.1.2
	RELENG_7_1_0_RELEASE:1.1.1.2
	RELENG_6_4_0_RELEASE:1.1.1.2
	RELENG_7_1:1.1.1.2.0.32
	RELENG_7_1_BP:1.1.1.2
	RELENG_6_4:1.1.1.2.0.30
	RELENG_6_4_BP:1.1.1.2
	RELENG_7_0_0_RELEASE:1.1.1.2
	RELENG_6_3_0_RELEASE:1.1.1.2
	RELENG_7_0:1.1.1.2.0.28
	RELENG_7_0_BP:1.1.1.2
	RELENG_6_3:1.1.1.2.0.26
	RELENG_6_3_BP:1.1.1.2
	RELENG_7:1.1.1.2.0.24
	RELENG_7_BP:1.1.1.2
	RELENG_6_2_0_RELEASE:1.1.1.2
	RELENG_6_2:1.1.1.2.0.22
	RELENG_6_2_BP:1.1.1.2
	RELENG_5_5_0_RELEASE:1.1.1.2
	RELENG_5_5:1.1.1.2.0.20
	RELENG_5_5_BP:1.1.1.2
	RELENG_6_1_0_RELEASE:1.1.1.2
	RELENG_6_1:1.1.1.2.0.18
	RELENG_6_1_BP:1.1.1.2
	RELENG_6_0_0_RELEASE:1.1.1.2
	RELENG_6_0:1.1.1.2.0.16
	RELENG_6_0_BP:1.1.1.2
	RELENG_6:1.1.1.2.0.14
	RELENG_6_BP:1.1.1.2
	RELENG_5_4_0_RELEASE:1.1.1.2
	RELENG_5_4:1.1.1.2.0.12
	RELENG_5_4_BP:1.1.1.2
	RELENG_4_11_0_RELEASE:1.1.1.1.8.1
	RELENG_4_11:1.1.1.1.8.1.0.10
	RELENG_4_11_BP:1.1.1.1.8.1
	RELENG_5_3_0_RELEASE:1.1.1.2
	RELENG_5_3:1.1.1.2.0.10
	RELENG_5_3_BP:1.1.1.2
	RELENG_5:1.1.1.2.0.8
	RELENG_5_BP:1.1.1.2
	RELENG_4_10_0_RELEASE:1.1.1.1.8.1
	RELENG_4_10:1.1.1.1.8.1.0.8
	RELENG_4_10_BP:1.1.1.1.8.1
	RELENG_5_2_1_RELEASE:1.1.1.2
	RELENG_5_2_0_RELEASE:1.1.1.2
	RELENG_5_2:1.1.1.2.0.6
	RELENG_5_2_BP:1.1.1.2
	RELENG_4_9_0_RELEASE:1.1.1.1.8.1
	RELENG_4_9:1.1.1.1.8.1.0.6
	RELENG_4_9_BP:1.1.1.1.8.1
	RELENG_5_1_0_RELEASE:1.1.1.2
	RELENG_5_1:1.1.1.2.0.4
	RELENG_5_1_BP:1.1.1.2
	RELENG_4_8_0_RELEASE:1.1.1.1.8.1
	RELENG_4_8:1.1.1.1.8.1.0.4
	RELENG_4_8_BP:1.1.1.1.8.1
	RELENG_5_0_0_RELEASE:1.1.1.2
	RELENG_5_0:1.1.1.2.0.2
	RELENG_5_0_BP:1.1.1.2
	RELENG_4_7_0_RELEASE:1.1.1.1.8.1
	RELENG_4_7:1.1.1.1.8.1.0.2
	RELENG_4_7_BP:1.1.1.1.8.1
	RELENG_4_6_2_RELEASE:1.1.1.1
	RELENG_4_6_1_RELEASE:1.1.1.1
	RELENG_4_6_0_RELEASE:1.1.1.1
	RELENG_4_6:1.1.1.1.0.16
	RELENG_4_6_BP:1.1.1.1
	RELENG_4_5_0_RELEASE:1.1.1.1
	RELENG_4_5:1.1.1.1.0.14
	RELENG_4_5_BP:1.1.1.1
	v3_5beta12:1.1.1.2
	RELENG_4_4_0_RELEASE:1.1.1.1
	RELENG_4_4:1.1.1.1.0.12
	RELENG_4_4_BP:1.1.1.1
	RELENG_4_3_0_RELEASE:1.1.1.1
	RELENG_4_3:1.1.1.1.0.10
	RELENG_4_3_BP:1.1.1.1
	RELENG_4_2_0_RELEASE:1.1.1.1
	RELENG_4_1_1_RELEASE:1.1.1.1
	PRE_SMPNG:1.1.1.1
	RELENG_4_1_0_RELEASE:1.1.1.1
	RELENG_3_5_0_RELEASE:1.1.1.1
	RELENG_4_0_0_RELEASE:1.1.1.1
	RELENG_4:1.1.1.1.0.8
	RELENG_4_BP:1.1.1.1
	RELENG_3_4_0_RELEASE:1.1.1.1
	RELENG_3_3_0_RELEASE:1.1.1.1
	RELENG_3_2_PAO:1.1.1.1.0.6
	RELENG_3_2_PAO_BP:1.1.1.1
	RELENG_3_2_0_RELEASE:1.1.1.1
	RELENG_3_1_0_RELEASE:1.1.1.1
	RELENG_3:1.1.1.1.0.4
	RELENG_3_BP:1.1.1.1
	RELENG_2_2_8_RELEASE:1.1.1.1
	RELENG_3_0_0_RELEASE:1.1.1.1
	RELENG_2_2_7_RELEASE:1.1.1.1
	RELENG_2_2_6_RELEASE:1.1.1.1
	RELENG_2_2_5_RELEASE:1.1.1.1
	RELENG_2_2_2_RELEASE:1.1.1.1
	RELENG_2_2:1.1.1.1.0.2
	v3_4:1.1.1.1
	NWU:1.1.1;
locks; strict;
comment	@# @;


1.1
date	97.03.23.18.51.21;	author joerg;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	97.03.23.18.51.21;	author joerg;	state Exp;
branches
	1.1.1.1.8.1;
next	1.1.1.2;

1.1.1.2
date	2002.01.24.17.24.15;	author dwmalone;	state Exp;
branches
	1.1.1.2.56.1;
next	;

1.1.1.1.8.1
date	2002.08.11.17.09.25;	author dwmalone;	state Exp;
branches;
next	;

1.1.1.2.56.1
date	2002.01.24.17.24.15;	author svnexp;	state dead;
branches;
next	1.1.1.2.56.2;

1.1.1.2.56.2
date	2013.03.28.13.02.09;	author svnexp;	state Exp;
branches;
next	;


desc
@@


1.1
log
@Initial revision
@
text
@#!/bin/csh -f
set ny = (no yes)
if ($2 == "yesno") then
    @@ i = $3 + 1
    set pmpt = "$1 [$ny[$i]]: "
else
    if ("$3" == "") then
        set pmpt = "${1}"
    else
        set pmpt = "$1 [$3]: "
    endif
endif
rpt:
echo -n "$pmpt"
set input = $<
switch ($2)
    case number:
	set tmp = `echo $input | tr -d 0123456789.`
	if ("x$tmp" != x) then
	    echo "Invalid number.  Please try again."
	    goto rpt
	endif
	breaksw

    case integer:
	set tmp = `echo $input | tr -d 0123456789`
	if ("x$tmp" != x) then
	    echo "Invalid integer.  Please try again."
	    goto rpt
	endif
	breaksw

    case neginteger:
	if ("x$input" != x-1) then
	    set tmp = `echo $input | tr -d 0123456789`
	    if ("x$tmp" != x) then
	        echo "Invalid integer.  Please try again."
	        goto rpt
	    endif
	endif
	breaksw

    case file:
	if ("x$input" == "x") then
	    set input = $3
	endif
	if (! -e "$input") then
	    echo The file $input "does not exist.  Please try again."
	    goto rpt
	endif
	breaksw

    case path:
	if ("x$input" == "x") then
	    set input = "$3"
	endif
	if (! -e "$input") then
	    foreach elt ($path)
		if (-e "$elt/$input") breaksw
	    end
	    echo The command $input "was not found.  Please try again."
	    goto rpt
	endif
	breaksw

    case yesno:
	if ("x$input" == xy || "x$input" == xyes) then
	   set input = 1
	else if ("x$input" == xn || "x$input" == xno) then
	   set input = 0
	else if ("x$input" != x) then
	   echo 'Please answer "yes" or "no".'
	   goto rpt
	endif
	breaksw

    default:
	breaksw

endsw

if ("x$input" == x) then
    set input = "$3"
endif

echo $input > $4
@


1.1.1.1
log
@This is the long-awaited import of top into the base system (actually,
the src/contrib/top part right now).  This tools is simply too system-
dependant to maintain it in the ports collection.
@
text
@@


1.1.1.1.8.1
log
@MFC: top 3.5beta12
This fixes a few minor bugs and brings us up the the last version
William LeFebvre released.
@
text
@d1 5
a5 20
#!/bin/sh
# getans prompt type default  results_filename
#  type is one of 
#   number  
#   integer
#   neginteger
#   file    default=default filename
#   path        
#   yesno   default=0,1 corres yes or no 
#   string (default)

RAWPMPT=$1
TYP=$2
DFLT=$3
OFNM=$4

ny0="no"; ny1="yes"
if [ ${TYP} = "yesno" ]; then
    eval ny=\$ny${DFLT}
    pmpt="${RAWPMPT} [$ny]: "
d7 2
a8 2
    if [ -z "${DFLT}" ]; then
        pmpt="${RAWPMPT}"
d10 10
a19 18
        pmpt="${RAWPMPT} [${DFLT}]: "
    fi
fi
if [ x"`echo -n`" = x-n ]
then
    c=\\c
else
    n=-n
fi

while :
do
    echo $n "$pmpt"$c
    read input
    case "$TYP" in
    number)
	tmp=`echo $input | tr -d 0123456789.`
	if [ -n "$tmp" ]; then
d21 7
a27 7
	    continue
	fi
	;;

    integer)
	tmp=`echo $input | tr -d 0123456789`
	if [ -n "$tmp" ]; then
d29 8
a36 8
	    continue
	fi
	;;

    neginteger)
	if [ "x$input" != "x-1" ]; then
	    tmp=`echo $input | tr -d 0123456789`
	    if [ -n "$tmp" ]; then
d38 47
a84 56
	        continue
	    fi
	fi
        ;;

    file)
	if [ -z "$input" ]; then
	    input=${DFLT}
	fi
	if [ ! -f "$input"  -a ! -d "$input" ]; then
	    echo "The file $input does not exist.  Please try again."
	    continue
	fi
	;;

    path)
	if [ -z "$input" ];  then
	    input="${DFLT}"
	fi
	if [ ! -f "$input" ]; then
            path=`echo $PATH | sed -e s'/::/ . /g' -e 's/:/ /g'`
	    x=
            for elt in $path;  do
		if [ -f "$elt/$input" ]; then  x=1; break; fi
	    done
	    if [ -z "$x" ] ;then 
                echo "The command $input was not found.  Please try again."
	        continue
            fi
	fi
	;;

    yesno)
	if [ -z "$input" ];  then  
            input="${DFLT}"
        else
            case $input in 
            y | yes)
                input=1 ;;
            n | no)
                input=0 ;;
            *)
	        echo 'Please answer "yes" or "no".'
	        continue ;;
            esac
        fi
        ;;

    *)	;;
    esac
    break
done

if [ -z "$input" ]; then
    input="${DFLT}"
fi
d86 1
a86 1
echo $input > ${OFNM}
@


1.1.1.2
log
@import top_3_5beta12
@
text
@d1 5
a5 20
#!/bin/sh
# getans prompt type default  results_filename
#  type is one of 
#   number  
#   integer
#   neginteger
#   file    default=default filename
#   path        
#   yesno   default=0,1 corres yes or no 
#   string (default)

RAWPMPT=$1
TYP=$2
DFLT=$3
OFNM=$4

ny0="no"; ny1="yes"
if [ ${TYP} = "yesno" ]; then
    eval ny=\$ny${DFLT}
    pmpt="${RAWPMPT} [$ny]: "
d7 2
a8 2
    if [ -z "${DFLT}" ]; then
        pmpt="${RAWPMPT}"
d10 10
a19 18
        pmpt="${RAWPMPT} [${DFLT}]: "
    fi
fi
if [ x"`echo -n`" = x-n ]
then
    c=\\c
else
    n=-n
fi

while :
do
    echo $n "$pmpt"$c
    read input
    case "$TYP" in
    number)
	tmp=`echo $input | tr -d 0123456789.`
	if [ -n "$tmp" ]; then
d21 7
a27 7
	    continue
	fi
	;;

    integer)
	tmp=`echo $input | tr -d 0123456789`
	if [ -n "$tmp" ]; then
d29 8
a36 8
	    continue
	fi
	;;

    neginteger)
	if [ "x$input" != "x-1" ]; then
	    tmp=`echo $input | tr -d 0123456789`
	    if [ -n "$tmp" ]; then
d38 47
a84 56
	        continue
	    fi
	fi
        ;;

    file)
	if [ -z "$input" ]; then
	    input=${DFLT}
	fi
	if [ ! -f "$input"  -a ! -d "$input" ]; then
	    echo "The file $input does not exist.  Please try again."
	    continue
	fi
	;;

    path)
	if [ -z "$input" ];  then
	    input="${DFLT}"
	fi
	if [ ! -f "$input" ]; then
            path=`echo $PATH | sed -e s'/::/ . /g' -e 's/:/ /g'`
	    x=
            for elt in $path;  do
		if [ -f "$elt/$input" ]; then  x=1; break; fi
	    done
	    if [ -z "$x" ] ;then 
                echo "The command $input was not found.  Please try again."
	        continue
            fi
	fi
	;;

    yesno)
	if [ -z "$input" ];  then  
            input="${DFLT}"
        else
            case $input in 
            y | yes)
                input=1 ;;
            n | no)
                input=0 ;;
            *)
	        echo 'Please answer "yes" or "no".'
	        continue ;;
            esac
        fi
        ;;

    *)	;;
    esac
    break
done

if [ -z "$input" ]; then
    input="${DFLT}"
fi
d86 1
a86 1
echo $input > ${OFNM}
@


1.1.1.2.56.1
log
@file getans was added on branch RELENG_8_4 on 2013-03-28 13:02:09 +0000
@
text
@d1 118
@


1.1.1.2.56.2
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/248810
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@a0 118
#!/bin/sh
# getans prompt type default  results_filename
#  type is one of 
#   number  
#   integer
#   neginteger
#   file    default=default filename
#   path        
#   yesno   default=0,1 corres yes or no 
#   string (default)

RAWPMPT=$1
TYP=$2
DFLT=$3
OFNM=$4

ny0="no"; ny1="yes"
if [ ${TYP} = "yesno" ]; then
    eval ny=\$ny${DFLT}
    pmpt="${RAWPMPT} [$ny]: "
else
    if [ -z "${DFLT}" ]; then
        pmpt="${RAWPMPT}"
    else
        pmpt="${RAWPMPT} [${DFLT}]: "
    fi
fi
if [ x"`echo -n`" = x-n ]
then
    c=\\c
else
    n=-n
fi

while :
do
    echo $n "$pmpt"$c
    read input
    case "$TYP" in
    number)
	tmp=`echo $input | tr -d 0123456789.`
	if [ -n "$tmp" ]; then
	    echo "Invalid number.  Please try again."
	    continue
	fi
	;;

    integer)
	tmp=`echo $input | tr -d 0123456789`
	if [ -n "$tmp" ]; then
	    echo "Invalid integer.  Please try again."
	    continue
	fi
	;;

    neginteger)
	if [ "x$input" != "x-1" ]; then
	    tmp=`echo $input | tr -d 0123456789`
	    if [ -n "$tmp" ]; then
	        echo "Invalid integer.  Please try again."
	        continue
	    fi
	fi
        ;;

    file)
	if [ -z "$input" ]; then
	    input=${DFLT}
	fi
	if [ ! -f "$input"  -a ! -d "$input" ]; then
	    echo "The file $input does not exist.  Please try again."
	    continue
	fi
	;;

    path)
	if [ -z "$input" ];  then
	    input="${DFLT}"
	fi
	if [ ! -f "$input" ]; then
            path=`echo $PATH | sed -e s'/::/ . /g' -e 's/:/ /g'`
	    x=
            for elt in $path;  do
		if [ -f "$elt/$input" ]; then  x=1; break; fi
	    done
	    if [ -z "$x" ] ;then 
                echo "The command $input was not found.  Please try again."
	        continue
            fi
	fi
	;;

    yesno)
	if [ -z "$input" ];  then  
            input="${DFLT}"
        else
            case $input in 
            y | yes)
                input=1 ;;
            n | no)
                input=0 ;;
            *)
	        echo 'Please answer "yes" or "no".'
	        continue ;;
            esac
        fi
        ;;

    *)	;;
    esac
    break
done

if [ -z "$input" ]; then
    input="${DFLT}"
fi

echo $input > ${OFNM}
@


