# and edit it to reflect your system. Some packages may include samples
# of config.h for certain machines, so you might look for one of those.)
#
-# $RCSfile: Configure,v $$Revision: 4.0.1.2 $$Date: 91/06/07 10:09:34 $
+# $RCSfile: Configure,v $$Revision: 4.0.1.5 $$Date: 91/11/05 23:11:32 $
#
# Yes, you may rip this off to use in other distribution packages.
# (Note: this Configure script was generated automatically. Rather than
cat >/tmp/c1$$ <<EOF
ARGGGHHHH!!!!!
-SCO csh still thinks true is false. Write to SCO today and tell them that next
-year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
+Your csh still thinks true is false. Write to your vendor today and tell
+them that next year Configure ought to "rm /bin/csh" unless they fix their
+blasted shell. :-)
-(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
-we'd have to do is go in and swap the && and || tokens, wherever they are.)
-
-[End of diatribe. We now return you to your regularly scheduled programming...]
+[End of diatribe. We now return you to your regularly scheduled
+programming...]
EOF
cat >/tmp/c2$$ <<EOF
ndiro=''
mallocsrc=''
mallocobj=''
-usemymalloc=''
+d_mymalloc=''
mallocptrtype=''
mansrc=''
manext=''
undef='undef'
: change the next line if compiling for Xenix/286 on Xenix/386
xlibpth='/usr/lib/386 /lib/386'
-libpth='/usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib /usr/lib/large /lib '$xlibpth' /lib/large /usr/lib/small /lib/small'
+
+: the hints files may add more components to libpth
+test -d /usr/cs/lib && libpth="$libpth /usr/cs/lib"
+test -d /usr/ccs/lib && libpth="$libpth /usr/ccs/lib"
+test -d /usr/lib && libpth="$libpth /usr/lib"
+test -d /usr/ucblib && libpth="$libpth /usr/ucblib"
+test -d /usr/local/lib && libpth="$libpth /usr/local/lib"
+test -d /usr/lib/large && libpth="$libpth /usr/lib/large"
+test -d /lib && libpth="$libpth /lib"
+ libpth="$libpth $xlibpth"
+test -d /lib/large && libpth="$libpth /lib/large"
+test -d /usr/lib/small && libpth="$libpth /usr/lib/small"
+test -d /lib/small && libpth="$libpth /lib/small"
+test -d /usr/lib/cmplrs/cc && libpth="$libpth /usr/lib/cmplrs/cc"
+
smallmach='pdp11 i8086 z8000 i80286 iAPX286'
trap 'echo " "; exit 1' 1 2 3
d_ndir=ndir
voidwant=1
voidwant=7
-libswanted="c_s net_s net nsl_s nsl socket nm ndir ndbm dbm malloc sun m bsd BSD x posix ucb"
+libswanted="c_s net_s net nsl_s nsl socket nm ndir ndbm dbm PW malloc sun m bsd BSD x posix ucb"
inclwanted='/usr/include /usr/netinclude /usr/include/sun /usr/include/bsd /usr/include/lan /usr/ucbinclude'
: Now test for existence of everything in MANIFEST
hint=previous
;;
esac
+else
+ lastuname=`(uname -a) 2>&1`
fi
if test -d ../hints && test ! -f ../config.sh; then
echo ' '
n*) nativegcc="$undef"; gccflags='-fpcc-struct-return';;
*) nativegcc="$define"; gccflags='';;
esac
+ case "$gccflags" in
+ *-ansi*) ;;
+ *-traditional*) ;;
+ *) gccflags="$gccflags -traditional -Dvolatile=__volatile__" ;;
+ esac
;;
esac
cd ..
echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
chmod 755 cppstdin
-wrapper=`pwd`/cppstdin
+wrapper=cppstdin
+
+case "$cppstdin" in
+/*cppstdin) cppstdin=cppstdin;;
+esac
+cp cppstdin UU
cd UU
if test "X$cppstdin" != "X" && \
echo "Yup, it does."
cppstdin="$cc -E"
cppminus='-';
-elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
- $wrapper <testcpp.c >testcpp.out 2>&1; \
- $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
- cppstdin="$wrapper"
- cppminus=''
- echo "Eureka!."
elif echo 'No such luck, maybe "'$cpp'" will work...'; \
$cpp <testcpp.c >testcpp.out 2>&1; \
$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
echo "Hooray, it works! I was beginning to wonder."
cppstdin="$cpp"
cppminus='-';
+elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
+ $wrapper <testcpp.c >testcpp.out 2>&1; \
+ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
+ cppstdin="$wrapper"
+ cppminus=''
+ echo "Eureka!."
elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
$cc -P <testcpp.c >testcpp.out 2>&1; \
$contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
if $test -r $usrinclude/pwd.h ; then
i_pwd="$define"
echo "pwd.h found."
- $cppstdin $cppflags $cppminus <$usrinclude/pwd.h >pwd.txt
+ $cppstdin $cppflags $cppminus <$usrinclude/pwd.h | \
+ sed -n '/struct[ ][ ]*passwd/,/^};/p' >pwd.txt
if $contains 'pw_quota' pwd.txt >/dev/null 2>&1; then
d_pwquota="$define"
else
: determine which malloc to compile in
echo " "
-case "$usemymalloc" in
+case "$d_mymalloc" in
'')
- if bsd || v7; then
- dflt='y'
- else
- dflt='n'
- fi
+ case "$usemymalloc" in
+ '')
+ if bsd || v7; then
+ dflt='y'
+ else
+ dflt='n'
+ fi
+ ;;
+ n*) dflt=n;;
+ *) dflt=y;;
+ esac
;;
-*) dflt="$usemymalloc"
+define) dflt="y"
+ ;;
+*) dflt="n"
;;
esac
rp="Do you wish to attempt to use the malloc that comes with $package? [$dflt]"
case "$ans" in
'') ans=$dflt;;
esac
-usemymalloc="$ans"
case "$ans" in
y*) mallocsrc='malloc.c'; mallocobj='malloc.o'
libs=`echo $libs | sed 's/-lmalloc//'`
+ val="$define"
case "$mallocptrtype" in
'')
cat >usemymalloc.c <<'END'
echo " "
echo "Your system wants malloc to return $mallocptrtype*, it would seem."
;;
-*) mallocsrc=''; mallocobj=''; mallocptrtype=void;;
+*) mallocsrc='';
+ mallocobj='';
+ mallocptrtype=void
+ val="$define"
+ ;;
esac
+set d_mymalloc
+eval $setvar
: determine where private executables go
case "$privlib" in
ndiro='$ndiro'
mallocsrc='$mallocsrc'
mallocobj='$mallocobj'
-usemymalloc='$usemymalloc'
+d_mymalloc='$d_mymalloc'
mallocptrtype='$mallocptrtype'
mansrc='$mansrc'
manext='$manext'
echo "Extracting Makefile (with variable substitutions)"
cat >Makefile <<!GROK!THIS!
-# $RCSfile: Makefile.SH,v $$Revision: 4.0.1.2 $$Date: 91/06/07 10:14:43 $
+# $RCSfile: Makefile.SH,v $$Revision: 4.0.1.3 $$Date: 91/11/05 15:48:11 $
#
# $Log: Makefile.SH,v $
+# Revision 4.0.1.3 91/11/05 15:48:11 lwall
+# patch11: saberized perl
+# patch11: added support for dbz
+#
# Revision 4.0.1.2 91/06/07 10:14:43 lwall
# patch4: cflags now emits entire cc command except for the filename
# patch4: alternate make programs are now semi-supported
mallocsrc = $mallocsrc
mallocobj = $mallocobj
SLN = $sln
+RMS = rm -f
libs = $libs $cryptlib
c = $(c1) $(c2) $(c3)
+s1 = array.c cmd.c cons.c consarg.c doarg.c doio.c dolist.c dump.c
+s2 = eval.c form.c hash.c perl.c regcomp.c regexec.c
+s3 = stab.c str.c toke.c util.c usersub.c perly.c
+
+saber = $(s1) $(s2) $(s3)
+
obj1 = array.o cmd.o cons.o consarg.o doarg.o doio.o dolist.o dump.o
-obj2 = eval.o form.o hash.o $(mallocobj) perl.o regcomp.o regexec.o
+obj2 = eval.o form.o $(mallocobj) perl.o regcomp.o regexec.o
obj3 = stab.o str.o toke.o util.o
obj = $(obj1) $(obj2) $(obj3)
# The $& notation is tells Sequent machines that it can do a parallel make,
# and is harmless otherwise.
-perl: $& perly.o $(obj) usersub.o
- $(CC) $(LARGE) $(CLDFLAGS) $(obj) perly.o usersub.o $(libs) -o perl
+perl: $& perly.o $(obj) hash.o usersub.o
+ $(CC) $(LARGE) $(CLDFLAGS) $(obj) hash.o perly.o usersub.o $(libs) -o perl
+
+# This command assumes that /usr/include/dbz.h and /usr/lib/dbz.o exist.
+
+dbzperl: $& perly.o $(obj) zhash.o usersub.o
+ $(CC) $(LARGE) $(CLDFLAGS) $(obj) zhash.o /usr/lib/dbz.o perly.o usersub.o $(libs) -o dbzperl
+
+zhash.o: hash.c $(h)
+ $(RMS) zhash.c
+ $(SLN) hash.c zhash.c
+ $(CCCMD) -DWANT_DBZ zhash.c
+ $(RMS) zhash.c
-uperl.o: $& perly.o $(obj)
- -ld $(LARGE) $(LDFLAGS) -r $(obj) perly.o -o uperl.o
+uperl.o: $& perly.o $(obj) hash.o
+ -ld $(LARGE) $(LDFLAGS) -r $(obj) hash.o perly.o -o uperl.o
-saber: perly.c
- # load $(c) perly.c
+saber: $(saber)
+ # load $(saber)
+ # load /lib/libm.a
# This version, if specified in Configure, does ONLY those scripts which need
# set-id emulation. Suidperl must be setuid root. It contains the "taint"
# Replicating all this junk is yucky, but I don't see a portable way to fix it.
tperly.o: perly.c perly.h $(h)
- /bin/rm -f tperly.c
+ $(RMS) tperly.c
$(SLN) perly.c tperly.c
$(CCCMD) -DTAINT tperly.c
- /bin/rm -f tperly.c
+ $(RMS) tperly.c
tperl.o: perl.c perly.h patchlevel.h perl.h $(h)
- /bin/rm -f tperl.c
+ $(RMS) tperl.c
$(SLN) perl.c tperl.c
$(CCCMD) -DTAINT tperl.c
- /bin/rm -f tperl.c
+ $(RMS) tperl.c
sperl.o: perl.c perly.h patchlevel.h $(h)
- /bin/rm -f sperl.c
+ $(RMS) sperl.c
$(SLN) perl.c sperl.c
$(CCCMD) -DTAINT -DIAMSUID sperl.c
- /bin/rm -f sperl.c
+ $(RMS) sperl.c
tarray.o: array.c $(h)
- /bin/rm -f tarray.c
+ $(RMS) tarray.c
$(SLN) array.c tarray.c
$(CCCMD) -DTAINT tarray.c
- /bin/rm -f tarray.c
+ $(RMS) tarray.c
tcmd.o: cmd.c $(h)
- /bin/rm -f tcmd.c
+ $(RMS) tcmd.c
$(SLN) cmd.c tcmd.c
$(CCCMD) -DTAINT tcmd.c
- /bin/rm -f tcmd.c
+ $(RMS) tcmd.c
tcons.o: cons.c $(h) perly.h
- /bin/rm -f tcons.c
+ $(RMS) tcons.c
$(SLN) cons.c tcons.c
$(CCCMD) -DTAINT tcons.c
- /bin/rm -f tcons.c
+ $(RMS) tcons.c
tconsarg.o: consarg.c $(h)
- /bin/rm -f tconsarg.c
+ $(RMS) tconsarg.c
$(SLN) consarg.c tconsarg.c
$(CCCMD) -DTAINT tconsarg.c
- /bin/rm -f tconsarg.c
+ $(RMS) tconsarg.c
tdoarg.o: doarg.c $(h)
- /bin/rm -f tdoarg.c
+ $(RMS) tdoarg.c
$(SLN) doarg.c tdoarg.c
$(CCCMD) -DTAINT tdoarg.c
- /bin/rm -f tdoarg.c
+ $(RMS) tdoarg.c
tdoio.o: doio.c $(h)
- /bin/rm -f tdoio.c
+ $(RMS) tdoio.c
$(SLN) doio.c tdoio.c
$(CCCMD) -DTAINT tdoio.c
- /bin/rm -f tdoio.c
+ $(RMS) tdoio.c
tdolist.o: dolist.c $(h)
- /bin/rm -f tdolist.c
+ $(RMS) tdolist.c
$(SLN) dolist.c tdolist.c
$(CCCMD) -DTAINT tdolist.c
- /bin/rm -f tdolist.c
+ $(RMS) tdolist.c
tdump.o: dump.c $(h)
- /bin/rm -f tdump.c
+ $(RMS) tdump.c
$(SLN) dump.c tdump.c
$(CCCMD) -DTAINT tdump.c
- /bin/rm -f tdump.c
+ $(RMS) tdump.c
teval.o: eval.c $(h)
- /bin/rm -f teval.c
+ $(RMS) teval.c
$(SLN) eval.c teval.c
$(CCCMD) -DTAINT teval.c
- /bin/rm -f teval.c
+ $(RMS) teval.c
tform.o: form.c $(h)
- /bin/rm -f tform.c
+ $(RMS) tform.c
$(SLN) form.c tform.c
$(CCCMD) -DTAINT tform.c
- /bin/rm -f tform.c
+ $(RMS) tform.c
thash.o: hash.c $(h)
- /bin/rm -f thash.c
+ $(RMS) thash.c
$(SLN) hash.c thash.c
$(CCCMD) -DTAINT thash.c
- /bin/rm -f thash.c
+ $(RMS) thash.c
tregcomp.o: regcomp.c $(h)
- /bin/rm -f tregcomp.c
+ $(RMS) tregcomp.c
$(SLN) regcomp.c tregcomp.c
$(CCCMD) -DTAINT tregcomp.c
- /bin/rm -f tregcomp.c
+ $(RMS) tregcomp.c
tregexec.o: regexec.c $(h)
- /bin/rm -f tregexec.c
+ $(RMS) tregexec.c
$(SLN) regexec.c tregexec.c
$(CCCMD) -DTAINT tregexec.c
- /bin/rm -f tregexec.c
+ $(RMS) tregexec.c
tstab.o: stab.c $(h)
- /bin/rm -f tstab.c
+ $(RMS) tstab.c
$(SLN) stab.c tstab.c
$(CCCMD) -DTAINT tstab.c
- /bin/rm -f tstab.c
+ $(RMS) tstab.c
tstr.o: str.c $(h) perly.h
- /bin/rm -f tstr.c
+ $(RMS) tstr.c
$(SLN) str.c tstr.c
$(CCCMD) -DTAINT tstr.c
- /bin/rm -f tstr.c
+ $(RMS) tstr.c
ttoke.o: toke.c $(h) perly.h
- /bin/rm -f ttoke.c
+ $(RMS) ttoke.c
$(SLN) toke.c ttoke.c
$(CCCMD) -DTAINT ttoke.c
- /bin/rm -f ttoke.c
+ $(RMS) ttoke.c
tutil.o: util.c $(h)
- /bin/rm -f tutil.c
+ $(RMS) tutil.c
$(SLN) util.c tutil.c
$(CCCMD) -DTAINT tutil.c
- /bin/rm -f tutil.c
+ $(RMS) tutil.c
perly.h: perly.c
@ echo Dummy dependency for dumb parallel make
rm -f *.orig */*.orig *~ */*~ core $(addedbyconf) h2ph h2ph.man
rm -f perly.c perly.h t/perl Makefile config.h makedepend makedir
rm -f makefile x2p/Makefile x2p/makefile cflags x2p/cflags
+ rm -f c2ph pstruct
# The following lint has practically everything turned on. Unfortunately,
# you have to wade through a lot of mumbo jumbo that can't be suppressed.
echo $(sh) | tr ' ' '\012' >.shlist
# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
-$(obj):
+$(obj) hash.o:
@ echo "You haven't done a "'"make depend" yet!'; exit 1
makedepend: makedepend.SH
/bin/sh makedepend.SH
ln Makefile ../Makefile
;;
esac
+rm -f makefile
--- /dev/null
+/* $RCSfile: bsdcurses.mus,v $$Revision: 4.0.1.1 $$Date: 91/11/05 19:04:53 $
+ *
+ * $Log: bsdcurses.mus,v $
+ * Revision 4.0.1.1 91/11/05 19:04:53 lwall
+ * initial checkin
+ *
+ * Revision 4.0 91/03/20 01:56:13 lwall
+ * 4.0 baseline.
+ *
+ * Revision 3.0.1.1 90/08/09 04:05:21 lwall
+ * patch19: Initial revision
+ *
+ */
+
+#include "EXTERN.h"
+#include "perl.h"
+
+char *savestr();
+
+#include <curses.h>
+
+static enum uservars {
+ UV_curscr,
+ UV_stdscr,
+ UV_Def_term,
+ UV_My_term,
+ UV_ttytype,
+ UV_LINES,
+ UV_COLS,
+ UV_ERR,
+ UV_OK,
+};
+
+static enum usersubs {
+ US_addch,
+ US_waddch,
+ US_addstr,
+ US_waddstr,
+ US_box,
+ US_clear,
+ US_wclear,
+ US_clearok,
+ US_clrtobot,
+ US_wclrtobot,
+ US_clrtoeol,
+ US_wclrtoeol,
+ US_delch,
+ US_wdelch,
+ US_deleteln,
+ US_wdeleteln,
+ US_erase,
+ US_werase,
+ US_flushok,
+ US_idlok,
+ US_insch,
+ US_winsch,
+ US_insertln,
+ US_winsertln,
+ US_move,
+ US_wmove,
+ US_overlay,
+ US_overwrite,
+ US_printw,
+ US_wprintw,
+ US_refresh,
+ US_wrefresh,
+ US_standout,
+ US_wstandout,
+ US_standend,
+ US_wstandend,
+ US_cbreak,
+ US_nocbreak,
+ US_echo,
+ US_noecho,
+ US_getch,
+ US_wgetch,
+ US_getstr,
+ US_wgetstr,
+ US_raw,
+ US_noraw,
+ US_scanw,
+ US_wscanw,
+ US_baudrate,
+ US_delwin,
+ US_endwin,
+ US_erasechar,
+ US_getcap,
+ US_getyx,
+ US_inch,
+ US_winch,
+ US_initscr,
+ US_killchar,
+ US_leaveok,
+ US_longname,
+ US_fullname,
+ US_mvwin,
+ US_newwin,
+ US_nl,
+ US_nonl,
+ US_scrollok,
+ US_subwin,
+ US_touchline,
+ US_touchoverlap,
+ US_touchwin,
+ US_unctrl,
+ US_gettmode,
+ US_mvcur,
+ US_scroll,
+ US_savetty,
+ US_resetty,
+ US_setterm,
+ US_tstp,
+ US__putchar,
+ US_testcallback,
+};
+
+static int usersub();
+static int userset();
+static int userval();
+
+int
+init_curses()
+{
+ struct ufuncs uf;
+ char *filename = "curses.c";
+
+ uf.uf_set = userset;
+ uf.uf_val = userval;
+
+#define MAGICVAR(name, ix) uf.uf_index = ix, magicname(name, &uf, sizeof uf)
+
+ MAGICVAR("curscr", UV_curscr);
+ MAGICVAR("stdscr", UV_stdscr);
+ MAGICVAR("Def_term",UV_Def_term);
+ MAGICVAR("My_term", UV_My_term);
+ MAGICVAR("ttytype", UV_ttytype);
+ MAGICVAR("LINES", UV_LINES);
+ MAGICVAR("COLS", UV_COLS);
+ MAGICVAR("ERR", UV_ERR);
+ MAGICVAR("OK", UV_OK);
+
+ make_usub("addch", US_addch, usersub, filename);
+ make_usub("waddch", US_waddch, usersub, filename);
+ make_usub("addstr", US_addstr, usersub, filename);
+ make_usub("waddstr", US_waddstr, usersub, filename);
+ make_usub("box", US_box, usersub, filename);
+ make_usub("clear", US_clear, usersub, filename);
+ make_usub("wclear", US_wclear, usersub, filename);
+ make_usub("clearok", US_clearok, usersub, filename);
+ make_usub("clrtobot", US_clrtobot, usersub, filename);
+ make_usub("wclrtobot", US_wclrtobot, usersub, filename);
+ make_usub("clrtoeol", US_clrtoeol, usersub, filename);
+ make_usub("wclrtoeol", US_wclrtoeol, usersub, filename);
+ make_usub("delch", US_delch, usersub, filename);
+ make_usub("wdelch", US_wdelch, usersub, filename);
+ make_usub("deleteln", US_deleteln, usersub, filename);
+ make_usub("wdeleteln", US_wdeleteln, usersub, filename);
+ make_usub("erase", US_erase, usersub, filename);
+ make_usub("werase", US_werase, usersub, filename);
+ make_usub("flushok", US_flushok, usersub, filename);
+ make_usub("idlok", US_idlok, usersub, filename);
+ make_usub("insch", US_insch, usersub, filename);
+ make_usub("winsch", US_winsch, usersub, filename);
+ make_usub("insertln", US_insertln, usersub, filename);
+ make_usub("winsertln", US_winsertln, usersub, filename);
+ make_usub("move", US_move, usersub, filename);
+ make_usub("wmove", US_wmove, usersub, filename);
+ make_usub("overlay", US_overlay, usersub, filename);
+ make_usub("overwrite", US_overwrite, usersub, filename);
+ make_usub("printw", US_printw, usersub, filename);
+ make_usub("wprintw", US_wprintw, usersub, filename);
+ make_usub("refresh", US_refresh, usersub, filename);
+ make_usub("wrefresh", US_wrefresh, usersub, filename);
+ make_usub("standout", US_standout, usersub, filename);
+ make_usub("wstandout", US_wstandout, usersub, filename);
+ make_usub("standend", US_standend, usersub, filename);
+ make_usub("wstandend", US_wstandend, usersub, filename);
+ make_usub("cbreak", US_cbreak, usersub, filename);
+ make_usub("nocbreak", US_nocbreak, usersub, filename);
+ make_usub("echo", US_echo, usersub, filename);
+ make_usub("noecho", US_noecho, usersub, filename);
+ make_usub("getch", US_getch, usersub, filename);
+ make_usub("wgetch", US_wgetch, usersub, filename);
+ make_usub("getstr", US_getstr, usersub, filename);
+ make_usub("wgetstr", US_wgetstr, usersub, filename);
+ make_usub("raw", US_raw, usersub, filename);
+ make_usub("noraw", US_noraw, usersub, filename);
+ make_usub("scanw", US_scanw, usersub, filename);
+ make_usub("wscanw", US_wscanw, usersub, filename);
+ make_usub("baudrate", US_baudrate, usersub, filename);
+ make_usub("delwin", US_delwin, usersub, filename);
+ make_usub("endwin", US_endwin, usersub, filename);
+ make_usub("erasechar", US_erasechar, usersub, filename);
+ make_usub("getcap", US_getcap, usersub, filename);
+ make_usub("getyx", US_getyx, usersub, filename);
+ make_usub("inch", US_inch, usersub, filename);
+ make_usub("winch", US_winch, usersub, filename);
+ make_usub("initscr", US_initscr, usersub, filename);
+ make_usub("killchar", US_killchar, usersub, filename);
+ make_usub("leaveok", US_leaveok, usersub, filename);
+ make_usub("longname", US_longname, usersub, filename);
+ make_usub("fullname", US_fullname, usersub, filename);
+ make_usub("mvwin", US_mvwin, usersub, filename);
+ make_usub("newwin", US_newwin, usersub, filename);
+ make_usub("nl", US_nl, usersub, filename);
+ make_usub("nonl", US_nonl, usersub, filename);
+ make_usub("scrollok", US_scrollok, usersub, filename);
+ make_usub("subwin", US_subwin, usersub, filename);
+ make_usub("touchline", US_touchline, usersub, filename);
+ make_usub("touchoverlap", US_touchoverlap,usersub, filename);
+ make_usub("touchwin", US_touchwin, usersub, filename);
+ make_usub("unctrl", US_unctrl, usersub, filename);
+ make_usub("gettmode", US_gettmode, usersub, filename);
+ make_usub("mvcur", US_mvcur, usersub, filename);
+ make_usub("scroll", US_scroll, usersub, filename);
+ make_usub("savetty", US_savetty, usersub, filename);
+ make_usub("resetty", US_resetty, usersub, filename);
+ make_usub("setterm", US_setterm, usersub, filename);
+ make_usub("tstp", US_tstp, usersub, filename);
+ make_usub("_putchar", US__putchar, usersub, filename);
+ make_usub("testcallback", US_testcallback,usersub, filename);
+};
+
+static int
+usersub(ix, sp, items)
+int ix;
+register int sp;
+register int items;
+{
+ STR **st = stack->ary_array + sp;
+ register int i;
+ register char *tmps;
+ register STR *Str; /* used in str_get and str_gnum macros */
+
+ switch (ix) {
+CASE int addch
+I char ch
+END
+
+CASE int waddch
+I WINDOW* win
+I char ch
+END
+
+CASE int addstr
+I char* str
+END
+
+CASE int waddstr
+I WINDOW* win
+I char* str
+END
+
+CASE int box
+I WINDOW* win
+I char vert
+I char hor
+END
+
+CASE int clear
+END
+
+CASE int wclear
+I WINDOW* win
+END
+
+CASE int clearok
+I WINDOW* win
+I bool boolf
+END
+
+CASE int clrtobot
+END
+
+CASE int wclrtobot
+I WINDOW* win
+END
+
+CASE int clrtoeol
+END
+
+CASE int wclrtoeol
+I WINDOW* win
+END
+
+CASE int delch
+END
+
+CASE int wdelch
+I WINDOW* win
+END
+
+CASE int deleteln
+END
+
+CASE int wdeleteln
+I WINDOW* win
+END
+
+CASE int erase
+END
+
+CASE int werase
+I WINDOW* win
+END
+
+CASE int flushok
+I WINDOW* win
+I bool boolf
+END
+
+CASE int idlok
+I WINDOW* win
+I bool boolf
+END
+
+CASE int insch
+I char c
+END
+
+CASE int winsch
+I WINDOW* win
+I char c
+END
+
+CASE int insertln
+END
+
+CASE int winsertln
+I WINDOW* win
+END
+
+CASE int move
+I int y
+I int x
+END
+
+CASE int wmove
+I WINDOW* win
+I int y
+I int x
+END
+
+CASE int overlay
+I WINDOW* win1
+I WINDOW* win2
+END
+
+CASE int overwrite
+I WINDOW* win1
+I WINDOW* win2
+END
+
+ case US_printw:
+ if (items < 1)
+ fatal("Usage: &printw($fmt, $arg1, $arg2, ... )");
+ else {
+ int retval;
+ STR* str = str_new(0);
+
+ do_sprintf(str, items - 1, st + 1);
+ retval = addstr(str->str_ptr);
+ str_numset(st[0], (double) retval);
+ str_free(str);
+ }
+ return sp;
+
+ case US_wprintw:
+ if (items < 2)
+ fatal("Usage: &wprintw($win, $fmt, $arg1, $arg2, ... )");
+ else {
+ int retval;
+ STR* str = str_new(0);
+ WINDOW* win = *(WINDOW**) str_get(st[1]);
+
+ do_sprintf(str, items - 1, st + 1);
+ retval = waddstr(win, str->str_ptr);
+ str_numset(st[0], (double) retval);
+ str_free(str);
+ }
+ return sp;
+
+CASE int refresh
+END
+
+CASE int wrefresh
+I WINDOW* win
+END
+
+CASE int standout
+END
+
+CASE int wstandout
+I WINDOW* win
+END
+
+CASE int standend
+END
+
+CASE int wstandend
+I WINDOW* win
+END
+
+CASE int cbreak
+END
+
+CASE int nocbreak
+END
+
+CASE int echo
+END
+
+CASE int noecho
+END
+
+ case US_getch:
+ if (items != 0)
+ fatal("Usage: &getch()");
+ else {
+ int retval;
+ char retch;
+
+ retval = getch();
+ if (retval == EOF)
+ st[0] = &str_undef;
+ else {
+ retch = retval;
+ str_nset(st[0], &retch, 1);
+ }
+ }
+ return sp;
+
+ case US_wgetch:
+ if (items != 1)
+ fatal("Usage: &wgetch($win)");
+ else {
+ int retval;
+ char retch;
+ WINDOW* win = *(WINDOW**) str_get(st[1]);
+
+ retval = wgetch(win);
+ if (retval == EOF)
+ st[0] = &str_undef;
+ else {
+ retch = retval;
+ str_nset(st[0], &retch, 1);
+ }
+ }
+ return sp;
+
+CASE int getstr
+IO char* str
+END
+
+CASE int wgetstr
+I WINDOW* win
+IO char* str
+END
+
+CASE int raw
+END
+
+CASE int noraw
+END
+
+CASE int baudrate
+END
+
+CASE int delwin
+I WINDOW* win
+END
+
+CASE int endwin
+END
+
+CASE int erasechar
+END
+
+CASE char* getcap
+I char* str
+END
+
+ case US_getyx:
+ if (items != 3)
+ fatal("Usage: &getyx($win, $y, $x)");
+ else {
+ int retval;
+ STR* str = str_new(0);
+ WINDOW* win = *(WINDOW**) str_get(st[1]);
+ int y;
+ int x;
+
+ do_sprintf(str, items - 1, st + 1);
+ retval = getyx(win, y, x);
+ str_numset(st[2], (double)y);
+ str_numset(st[3], (double)x);
+ str_numset(st[0], (double) retval);
+ str_free(str);
+ }
+ return sp;
+
+
+CASE int inch
+END
+
+CASE int winch
+I WINDOW* win
+END
+
+CASE WINDOW* initscr
+END
+
+CASE int killchar
+END
+
+CASE int leaveok
+I WINDOW* win
+I bool boolf
+END
+
+CASE char* longname
+I char* termbuf
+IO char* name
+END
+
+CASE int fullname
+I char* termbuf
+IO char* name
+END
+
+CASE int mvwin
+I WINDOW* win
+I int y
+I int x
+END
+
+CASE WINDOW* newwin
+I int lines
+I int cols
+I int begin_y
+I int begin_x
+END
+
+CASE int nl
+END
+
+CASE int nonl
+END
+
+CASE int scrollok
+I WINDOW* win
+I bool boolf
+END
+
+CASE WINDOW* subwin
+I WINDOW* win
+I int lines
+I int cols
+I int begin_y
+I int begin_x
+END
+
+CASE int touchline
+I WINDOW* win
+I int y
+I int startx
+I int endx
+END
+
+CASE int touchoverlap
+I WINDOW* win1
+I WINDOW* win2
+END
+
+CASE int touchwin
+I WINDOW* win
+END
+
+CASE char* unctrl
+I char ch
+END
+
+CASE int gettmode
+END
+
+CASE int mvcur
+I int lasty
+I int lastx
+I int newy
+I int newx
+END
+
+CASE int scroll
+I WINDOW* win
+END
+
+CASE int savetty
+END
+
+CASE void resetty
+END
+
+CASE int setterm
+I char* name
+END
+
+CASE int tstp
+END
+
+CASE int _putchar
+I char ch
+END
+
+ case US_testcallback:
+ sp = callback("callback", sp + items, curcsv->wantarray, 1, items);
+ break;
+
+ default:
+ fatal("Unimplemented user-defined subroutine");
+ }
+ return sp;
+}
+
+static int
+userval(ix, str)
+int ix;
+STR *str;
+{
+ switch (ix) {
+ case UV_COLS:
+ str_numset(str, (double)COLS);
+ break;
+ case UV_Def_term:
+ str_set(str, Def_term);
+ break;
+ case UV_ERR:
+ str_numset(str, (double)ERR);
+ break;
+ case UV_LINES:
+ str_numset(str, (double)LINES);
+ break;
+ case UV_My_term:
+ str_numset(str, (double)My_term);
+ break;
+ case UV_OK:
+ str_numset(str, (double)OK);
+ break;
+ case UV_curscr:
+ str_nset(str, &curscr, sizeof(WINDOW*));
+ break;
+ case UV_stdscr:
+ str_nset(str, &stdscr, sizeof(WINDOW*));
+ break;
+ case UV_ttytype:
+ str_set(str, ttytype);
+ break;
+ }
+ return 0;
+}
+
+static int
+userset(ix, str)
+int ix;
+STR *str;
+{
+ switch (ix) {
+ case UV_COLS:
+ COLS = (int)str_gnum(str);
+ break;
+ case UV_Def_term:
+ Def_term = savestr(str_get(str)); /* never freed */
+ break;
+ case UV_LINES:
+ LINES = (int)str_gnum(str);
+ break;
+ case UV_My_term:
+ My_term = (bool)str_gnum(str);
+ break;
+ case UV_ttytype:
+ strcpy(ttytype, str_get(str)); /* hope it fits */
+ break;
+ }
+ return 0;
+}