home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Unix / Shells / zsh / Source / src / config / bz.ifdef < prev    next >
Encoding:
Text File  |  1994-04-07  |  2.7 KB  |  124 lines

  1. _tst_="$1"
  2. _sym_="$2"
  3. _val_="$3"
  4. _yea_="$4"
  5. _nay_="$5"
  6. test -n "$6" && _fea_="$6" || _fea_="$4"
  7. _yea_fea_="$7"
  8. _nay_fea_="$8"
  9. test -n "$F_define" -a -n "$_sym_" && echo "/* define this if you use $_fea_ */"
  10.  
  11. _auto=
  12.  
  13. if test -n "$B_query"
  14. then
  15.   _ans_=
  16.   while test Z"$_ans_" != Zok
  17.   do
  18.     if test -n "$F_define" -a -z "$F_ifdef_warned"
  19.     then 
  20.       echo "    * 'Do you have' means 'Do you have _a working_ version of'" >&2
  21.       F_ifdef_warned=yep
  22.     fi
  23.     if test -n "$B_query"
  24.     then
  25.       eval "$_tst_" && _dfl_='Y n' || _dfl_='N y'
  26.       {
  27.         echo
  28.         test -n "$G_verb1_" && _verb1_="$G_verb1_" || _verb1_=Do
  29.         test -n "$G_subj_"  && _subj_="$G_subj_"   || _subj_=you
  30.         test -n "$G_verb2_" && _verb2_="$G_verb2_" || _verb2_=use
  31.         echo "$_verb1_ $_subj_ $_verb2_ $_fea_? [${_dfl_}aq?] " | tr -d '\012'
  32.       } >&2
  33.     fi
  34.     read _ans_
  35.     case $_ans_ in
  36.     [Yy]* )
  37.       _tst_=true
  38.       _ans_=ok
  39.       _yea=yep
  40.       _nay=
  41.       ;;
  42.     [Nn]* )
  43.       _tst_=false
  44.       _ans_=ok
  45.       _yea=
  46.       _nay=nope
  47.       ;;
  48.     [Aa]* )
  49.       {
  50.         echo
  51.         echo "    OK, will autoproceed..."
  52.     echo
  53.       } >&2
  54.       _ans_=ok
  55.       _auto=yep
  56.       ;;
  57.    [?]*  )
  58.       {
  59. cat <<__eoh__
  60.   
  61.   The default will be selected by simply pressing Return/Newline/Enter.
  62.   The default is probed out from the system by buildzsh, the probing
  63.   can take sometimes couple of seconds.
  64.   Inside the [brackets] the default is shown Capitalized, as the first
  65.   option and separated from the other options by a space.
  66.   
  67.   y (or Y)  yep
  68.   n (or N)  no
  69.   a         auto: proceed until end without querying
  70.   q         quit configuring this file, this file will be left unfinished;
  71.             to quit altogether, use Ctrl-C or your respective
  72.             interrupt key
  73. __eoh__
  74.       } >&2
  75.       _ans_=
  76.       ;;
  77.     [Qq]* )
  78.       exit 1
  79.       ;;
  80.     ''    )
  81.       case "$_dfl_" in
  82.       Y* ) _tst_=true  ;;
  83.       N* ) _tst_=false ;;
  84.       esac
  85.       _ans_=ok
  86.       ;;
  87.     esac
  88.   done
  89. fi
  90.  
  91. test -n "$G_verb3a_" && _verb3a_="$G_verb3a_" || _verb3a_=using
  92. test -n "$G_verb3b_" && _verb3b_="$G_verb3b_" || _verb3b_=using
  93.   
  94. if eval "$_tst_" && test -z "$_auto"
  95. then
  96.   if test -n "$F_define"
  97.   then
  98.     test -n "$_sym_" && echo "#define $_sym_ $_val_" || echo "$_yea_fea_"
  99.   fi
  100.   test -n "$F_using" && echo "    $_verb3a_ $_yea_..." >&2
  101.   _yea=yep
  102.   _nay=
  103. else
  104.   if test -n "$F_define"
  105.   then
  106.     test -n "$_sym_" && echo "/*#define $_sym_*/" || echo "$_nay_fea_"
  107.   fi
  108.   if test -n "$F_using"
  109.   then
  110.     test -n "$_nay_" && echo "    $_verb3b_ $_nay_..." >&2 || echo "    not $_verb3a_ $_yea_..." >&2
  111.   fi
  112.   _yea=
  113.   _nay=nope
  114. fi
  115.  
  116. _res="${_yea}${_nay}"
  117. test -n "$F_define" && echo
  118.  
  119. G_verb1_=
  120. G_subj_=
  121. G_verb2_=
  122. G_verb3a_=
  123. G_verb3b_=
  124.