From d0fb9a0bc1d23da37762cd6a6a61237851d736e5 Mon Sep 17 00:00:00 2001 From: Duke Date: Fri, 12 Jan 2024 20:05:15 -0500 Subject: [PATCH] remove rogue --- src/cc/rogue/LICENSE.TXT | 93 - src/cc/rogue/Makefile.in | 225 - src/cc/rogue/Makefile.std | 158 - src/cc/rogue/Makefile_win | 222 - src/cc/rogue/armor.c | 92 - src/cc/rogue/chase.c | 544 -- src/cc/rogue/command.c | 847 -- src/cc/rogue/config.guess | 1500 ---- src/cc/rogue/config.h.in | 269 - src/cc/rogue/config.sub | 1608 ---- src/cc/rogue/configure | 7511 ----------------- src/cc/rogue/configure.ac | 246 - src/cc/rogue/cursesd.c | 435 - src/cc/rogue/cursesd.h | 201 - src/cc/rogue/daemon.c | 219 - src/cc/rogue/daemons.c | 364 - src/cc/rogue/extern.c | 519 -- src/cc/rogue/extern.h | 203 - src/cc/rogue/fight.c | 684 -- src/cc/rogue/init.c | 498 -- src/cc/rogue/install-sh | 323 - src/cc/rogue/io.c | 340 - src/cc/rogue/list.c | 182 - src/cc/rogue/mach_dep.c | 462 - src/cc/rogue/main.c | 1000 --- src/cc/rogue/mdport.c | 1447 ---- src/cc/rogue/misc.c | 620 -- src/cc/rogue/monsters.c | 258 - src/cc/rogue/move.c | 429 - src/cc/rogue/new_level.c | 247 - src/cc/rogue/options.c | 504 -- src/cc/rogue/pack.c | 543 -- src/cc/rogue/passages.c | 427 - src/cc/rogue/potions.c | 335 - src/cc/rogue/rings.c | 209 - src/cc/rogue/rip.c | 464 - src/cc/rogue/rogue.6 | 96 - src/cc/rogue/rogue.6.in | 96 - src/cc/rogue/rogue.c | 776 -- src/cc/rogue/rogue.cat | 61 - src/cc/rogue/rogue.cat.in | 61 - src/cc/rogue/rogue.desktop | 11 - src/cc/rogue/rogue.doc | 858 -- src/cc/rogue/rogue.doc.in | 858 -- src/cc/rogue/rogue.h | 863 -- src/cc/rogue/rogue.html | 1060 --- src/cc/rogue/rogue.html.in | 1060 --- src/cc/rogue/rogue.me | 892 -- src/cc/rogue/rogue.me.in | 892 -- src/cc/rogue/rogue.png | Bin 1005 -> 0 bytes src/cc/rogue/rogue.spec | 107 - src/cc/rogue/rogue54.sln | 27 - src/cc/rogue/rogue54.vcproj | 396 - src/cc/rogue/rogue54.vcxproj | 257 - src/cc/rogue/rogue_build_msvc.cmd | 64 - src/cc/rogue/rogue_player.h | 38 - src/cc/rogue/rooms.c | 479 -- src/cc/rogue/save.c | 465 - src/cc/rogue/score.h | 32 - src/cc/rogue/scrolls.c | 332 - src/cc/rogue/state.c | 2278 ----- src/cc/rogue/sticks.c | 435 - src/cc/rogue/things.c | 741 -- src/cc/rogue/vers.c | 20 - src/cc/rogue/weapons.c | 293 - src/cc/rogue/wizard.c | 289 - .../deps/install/include/acs_defs.h | 265 - .../deps/install/include/curses.h | 1846 ---- .../deps/install/include/curspriv.h | 134 - .../deps/install/include/getopt.h | 93 - .../deps/install/include/panel.h | 56 - .../deps/install/include/term.h | 48 - .../deps/install/include/unistd.h | 56 - src/cc/rogue/xcrypt.c | 711 -- src/cc/rogue_rpc.cpp | 1657 ---- 75 files changed, 42931 deletions(-) delete mode 100644 src/cc/rogue/LICENSE.TXT delete mode 100644 src/cc/rogue/Makefile.in delete mode 100755 src/cc/rogue/Makefile.std delete mode 100644 src/cc/rogue/Makefile_win delete mode 100644 src/cc/rogue/armor.c delete mode 100644 src/cc/rogue/chase.c delete mode 100644 src/cc/rogue/command.c delete mode 100755 src/cc/rogue/config.guess delete mode 100644 src/cc/rogue/config.h.in delete mode 100755 src/cc/rogue/config.sub delete mode 100755 src/cc/rogue/configure delete mode 100644 src/cc/rogue/configure.ac delete mode 100644 src/cc/rogue/cursesd.c delete mode 100644 src/cc/rogue/cursesd.h delete mode 100644 src/cc/rogue/daemon.c delete mode 100644 src/cc/rogue/daemons.c delete mode 100644 src/cc/rogue/extern.c delete mode 100644 src/cc/rogue/extern.h delete mode 100644 src/cc/rogue/fight.c delete mode 100644 src/cc/rogue/init.c delete mode 100755 src/cc/rogue/install-sh delete mode 100644 src/cc/rogue/io.c delete mode 100644 src/cc/rogue/list.c delete mode 100644 src/cc/rogue/mach_dep.c delete mode 100644 src/cc/rogue/main.c delete mode 100644 src/cc/rogue/mdport.c delete mode 100644 src/cc/rogue/misc.c delete mode 100644 src/cc/rogue/monsters.c delete mode 100644 src/cc/rogue/move.c delete mode 100644 src/cc/rogue/new_level.c delete mode 100644 src/cc/rogue/options.c delete mode 100644 src/cc/rogue/pack.c delete mode 100644 src/cc/rogue/passages.c delete mode 100644 src/cc/rogue/potions.c delete mode 100644 src/cc/rogue/rings.c delete mode 100644 src/cc/rogue/rip.c delete mode 100644 src/cc/rogue/rogue.6 delete mode 100644 src/cc/rogue/rogue.6.in delete mode 100644 src/cc/rogue/rogue.c delete mode 100644 src/cc/rogue/rogue.cat delete mode 100644 src/cc/rogue/rogue.cat.in delete mode 100644 src/cc/rogue/rogue.desktop delete mode 100644 src/cc/rogue/rogue.doc delete mode 100644 src/cc/rogue/rogue.doc.in delete mode 100644 src/cc/rogue/rogue.h delete mode 100644 src/cc/rogue/rogue.html delete mode 100644 src/cc/rogue/rogue.html.in delete mode 100644 src/cc/rogue/rogue.me delete mode 100644 src/cc/rogue/rogue.me.in delete mode 100644 src/cc/rogue/rogue.png delete mode 100644 src/cc/rogue/rogue.spec delete mode 100644 src/cc/rogue/rogue54.sln delete mode 100644 src/cc/rogue/rogue54.vcproj delete mode 100644 src/cc/rogue/rogue54.vcxproj delete mode 100644 src/cc/rogue/rogue_build_msvc.cmd delete mode 100644 src/cc/rogue/rogue_player.h delete mode 100644 src/cc/rogue/rooms.c delete mode 100644 src/cc/rogue/save.c delete mode 100644 src/cc/rogue/score.h delete mode 100644 src/cc/rogue/scrolls.c delete mode 100644 src/cc/rogue/state.c delete mode 100644 src/cc/rogue/sticks.c delete mode 100644 src/cc/rogue/things.c delete mode 100644 src/cc/rogue/vers.c delete mode 100644 src/cc/rogue/weapons.c delete mode 100644 src/cc/rogue/wizard.c delete mode 100644 src/cc/rogue/x86_64-w64-msvc/deps/install/include/acs_defs.h delete mode 100644 src/cc/rogue/x86_64-w64-msvc/deps/install/include/curses.h delete mode 100644 src/cc/rogue/x86_64-w64-msvc/deps/install/include/curspriv.h delete mode 100644 src/cc/rogue/x86_64-w64-msvc/deps/install/include/getopt.h delete mode 100644 src/cc/rogue/x86_64-w64-msvc/deps/install/include/panel.h delete mode 100644 src/cc/rogue/x86_64-w64-msvc/deps/install/include/term.h delete mode 100644 src/cc/rogue/x86_64-w64-msvc/deps/install/include/unistd.h delete mode 100644 src/cc/rogue/xcrypt.c delete mode 100644 src/cc/rogue_rpc.cpp diff --git a/src/cc/rogue/LICENSE.TXT b/src/cc/rogue/LICENSE.TXT deleted file mode 100644 index ae3f4715b..000000000 --- a/src/cc/rogue/LICENSE.TXT +++ /dev/null @@ -1,93 +0,0 @@ -Rogue: Exploring the Dungeons of Doom -Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -3. Neither the name(s) of the author(s) nor the names of other contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -SUCH DAMAGE. - -=========================================================================== - -Portions of this software (state.c, mdport.c) are based on the work -of Nicholas J. Kisseberth. Used under license: - -Copyright (C) 1999, 2000, 2005 Nicholas J. Kisseberth -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -3. Neither the name(s) of the author(s) nor the names of other contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -SUCH DAMAGE. - -=========================================================================== - -Portions of this software (xcrypt.c) are based on the work -of David Burren. Used under license: - -FreeSec: libcrypt - -Copyright (C) 1994 David Burren -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -3. Neither the name(s) of the author(s) nor the names of other contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -SUCH DAMAGE. diff --git a/src/cc/rogue/Makefile.in b/src/cc/rogue/Makefile.in deleted file mode 100644 index d8aa7f5e6..000000000 --- a/src/cc/rogue/Makefile.in +++ /dev/null @@ -1,225 +0,0 @@ -# Copyright (c) 2016-2023 The Hush developers -# Distributed under the GPLv3 software license, see the accompanying -# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -############################################################################### -# -# Makefile for rogue -# -# Rogue: Exploring the Dungeons of Doom -# Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman -# All rights reserved. -# -# See the file LICENSE.TXT for full copyright and licensing information. -# -############################################################################### - -############################################################################### -# Site configuration occurs beneath this comment -# Typically ./configure (autoconf tools) configures this section -# This section could be manually configured if autoconf/configure fails -############################################################################### - -DISTNAME=@PACKAGE_TARNAME@@PACKAGE_VERSION@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@-@PACKAGE_VERSION@ -PROGRAM=@PROGRAM@ - -O=o - -#CC=gcc -CC = @CC@ - -#CFLAGS=-O2 -CFLAGS= @CFLAGS@ -fPIC - -LIBS=-lcurses -lcurl -#LIBS = @LIBS@ - -#RM=rm -f -RM = rm -f - -#GROFF=groff -GROFF = @GROFF@ - -#NROFF=nroff -NROFF = @NROFF@ - -#TBL=tbl -TBL = @TBL@ - -#COLCRT=colcrt -COLCRT = @COLCRT@ - -#SED=sed -SED = @SED@ - -#SCOREFILE=rogue54.scr -SCOREFILE = @SCOREFILE@ - -#LOCKFILE=rogue54.lck -LOCKFILE = @LOCKFILE@ - -#GROUPOWNER=games -GROUPOWNER = @GROUPOWNER@ - -#CPPFLAGS=-DHAVE_CONFIG_H -CPPFLAGS =@DEFS@ @CPPFLAGS@ - -#DISTFILE = $(PROGRAM) -DISTFILE = $(DISTNAME)-@TARGET@ - -INSTALL=./install-sh - -#INSTGROUP=-g games -INSTGROUP= -#INSTOWNER=-u root -INSTOWNER= - -CHGRP=chgrp - -MKDIR=mkdir - -TOUCH=touch - -RMDIR=rmdir - -CHMOD=chmod - -DESTDIR= - -prefix=@prefix@ -exec_prefix=@exec_prefix@ -datarootdir=@datarootdir@ -datadir=@datadir@ -bindir=@bindir@ -mandir=@mandir@ -docdir=@docdir@ -man6dir = $(mandir)/man6 - -############################################################################### -# Site configuration occurs above this comment -# It should not be necessary to change anything below this comment -############################################################################### - -HDRS = rogue.h extern.h score.h -OBJS1 = vers.$(O) extern.$(O) armor.$(O) chase.$(O) command.$(O) \ - daemon.$(O) daemons.$(O) fight.$(O) init.$(O) io.$(O) list.$(O) \ - mach_dep.$(O) rogue.$(O) mdport.$(O) misc.$(O) monsters.$(O) \ - move.$(O) new_level.$(O) -OBJS2 = options.$(O) pack.$(O) passages.$(O) potions.$(O) rings.$(O) \ - rip.$(O) rooms.$(O) save.$(O) scrolls.$(O) state.$(O) sticks.$(O) \ - things.$(O) weapons.$(O) wizard.$(O) xcrypt.$(O) -OBJS = main.$(O) $(OBJS1) $(OBJS2) -CFILES = vers.c extern.c armor.c chase.c command.c daemon.c \ - daemons.c fight.c init.c io.c list.c mach_dep.c \ - main.c mdport.c misc.c monsters.c move.c new_level.c \ - options.c pack.c passages.c potions.c rings.c rip.c \ - rooms.c save.c scrolls.c state.c sticks.c things.c \ - weapons.c wizard.c xcrypt.c -MISC_C = findpw.c scedit.c scmisc.c -DOCSRC = rogue.me.in rogue.6.in rogue.doc.in rogue.html.in rogue.cat.in -DOCS = $(PROGRAM).doc $(PROGRAM).html $(PROGRAM).cat $(PROGRAM).me \ - $(PROGRAM).6 -AFILES = configure Makefile.in configure.ac config.h.in config.sub config.guess \ - install-sh rogue.6.in rogue.me.in rogue.html.in rogue.doc.in rogue.cat.in -MISC = Makefile.std LICENSE.TXT rogue54.sln rogue54.vcproj rogue.spec \ - rogue.png rogue.desktop - -.SUFFIXES: .obj - -.c.obj: - $(CC) $(CFLAGS) $(CPPFLAGS) /c $*.c - -.c.o: - $(CC) $(CFLAGS) $(CPPFLAGS) -c $*.c - -#$(RM) rogue.so ; $(CC) -shared -o rogue.so cursesd.c $(OBJS1) $(OBJS2); $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $@ - -$(PROGRAM): $(HDRS) $(OBJS) - $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $@ - -clean: - $(RM) $(OBJS1); $(RM) main.$(O) ; $(RM) rogue.so - $(RM) $(OBJS2) - $(RM) core a.exe a.out a.exe.stackdump $(PROGRAM) $(PROGRAM).exe - $(RM) $(PROGRAM).tar $(PROGRAM).tar.gz $(PROGRAM).zip - $(RM) $(DISTNAME)/* - -rmdir $(DISTNAME) - -maintainer-clean: - $(RM) config.h - $(RM) Makefile - $(RM) config.status - $(RM) -r autom4te.cache - $(RM) config.log - $(RM) $(PROGRAM).scr $(PROGRAM).lck - -stddocs: - sed -e 's/@PROGRAM@/rogue/' -e 's/@SCOREFILE@/rogue.scr/' rogue.6.in > rogue.6 - sed -e 's/@PROGRAM@/rogue/' -e 's/@SCOREFILE@/rogue.scr/' rogue.me.in > rogue.me - sed -e 's/@PROGRAM@/rogue/' -e 's/@SCOREFILE@/rogue.scr/' rogue.html.in > rogue,html - sed -e 's/@PROGRAM@/rogue/' -e 's/@SCOREFILE@/rogue.scr/' rogue.doc.in > rogue.doc - sed -e 's/@PROGRAM@/rogue/' -e 's/@SCOREFILE@/rogue.scr/' rogue.cat.in > rogue.cat - -dist.src: - $(MAKE) $(MAKEFILE) clean - mkdir $(DISTNAME) - cp $(CFILES) $(HDRS) $(MISC) $(AFILES) $(DISTNAME) - tar cf $(DISTNAME)-src.tar $(DISTNAME) - gzip -f $(DISTNAME)-src.tar - rm -fr $(DISTNAME) - -findpw: findpw.c xcrypt.o mdport.o xcrypt.o - $(CC) -s -o findpw findpw.c xcrypt.o mdport.o -lcurses - -scedit: scedit.o scmisc.o vers.o mdport.o xcrypt.o - $(CC) -s -o scedit vers.o scedit.o scmisc.o mdport.o xcrypt.o -lcurses - -scmisc.o scedit.o: - $(CC) -O -c $(SF) $*.c - -$(PROGRAM).doc: rogue.me - if test "x$(GROFF)" != "x" -a "x$(SED)" != "x" ; then \ - $(GROFF) -P-c -t -me -Tascii rogue.me | $(SED) -e 's/.\x08//g' > $(PROGRAM).doc ;\ - elif test "x$(NROFF)" != "x" -a "x$(TBL)" != "x" -a "x$(COLCRT)" != "x" ; then \ - tbl rogue.me | $(NROFF) -me | colcrt - > $(PROGRAM).doc ;\ - fi - -$(PROGRAM).cat: rogue.6 - if test "x$(GROFF)" != "x" -a "x$(SED)" != "x" ; then \ - $(GROFF) -Tascii -man rogue.6 | $(SED) -e 's/.\x08//g' > $(PROGRAM).cat ;\ - elif test "x$(NROFF)" != "x" -a "x$(TBL)" != "x" -a "x$(COLCRT)" != "x" ; then \ - $(NROFF) -man rogue.6 | $(COLCRT) - > $(PROGRAM).cat ;\ - fi - -dist: clean $(PROGRAM) - tar cf $(DISTFILE).tar $(PROGRAM) LICENSE.TXT $(DOCS) - gzip -f $(DISTFILE).tar - -install: $(PROGRAM) - -$(TOUCH) test - -if test ! -f $(DESTDIR)$(SCOREFILE) ; then $(INSTALL) -m 0664 test $(DESTDIR)$(SCOREFILE) ; fi - -$(INSTALL) -m 0755 $(PROGRAM) $(DESTDIR)$(bindir)/$(PROGRAM) - -if test "x$(GROUPOWNER)" != "x" ; then \ - $(CHGRP) $(GROUPOWNER) $(DESTDIR)$(SCOREFILE) ; \ - $(CHGRP) $(GROUPOWNER) $(DESTDIR)$(bindir)/$(PROGRAM) ; \ - $(CHMOD) 02755 $(DESTDIR)$(bindir)/$(PROGRAM) ; \ - $(CHMOD) 0464 $(DESTDIR)$(SCOREFILE) ; \ - fi - -if test -d $(man6dir) ; then $(INSTALL) -m 0644 rogue.6 $(DESTDIR)$(man6dir)/$(PROGRAM).6 ; fi - -if test ! -d $(man6dir) ; then $(INSTALL) -m 0644 rogue.6 $(DESTDIR)$(mandir)/$(PROGRAM).6 ; fi - -$(INSTALL) -m 0644 rogue.doc $(DESTDIR)$(docdir)/$(PROGRAM).doc - -$(INSTALL) -m 0644 rogue.html $(DESTDIR)$(docdir)/$(PROGRAM).html - -$(INSTALL) -m 0644 rogue.cat $(DESTDIR)$(docdir)/$(PROGRAM).cat - -$(INSTALL) -m 0644 LICENSE.TXT $(DESTDIR)$(docdir)/LICENSE.TXT - -$(INSTALL) -m 0644 rogue.me $(DESTDIR)$(docdir)/$(PROGRAM).me - -if test ! -f $(DESTDIR)$(LOCKFILE) ; then $(INSTALL) -m 0666 test $(DESTDIR)$(LOCKFILE) ; $(RM) $(DESTDIR)$(LOCKFILE) ; fi - -$(RM) test - -uninstall: - -$(RM) $(DESTDIR)$(bindir)/$(PROGRAM) - -$(RM) $(DESTDIR)$(man6dir)/$(PROGRAM).6 - -$(RM) $(DESTDIR)$(docdir)$(PROGRAM)/$(PROGRAM).doc - -$(RM) $(DESTDIR)$(LOCKFILE) - -$(RMDIR) $(DESTDIR)$(docdir)$(PROGRAM) - -reinstall: uninstall install diff --git a/src/cc/rogue/Makefile.std b/src/cc/rogue/Makefile.std deleted file mode 100755 index 923c74672..000000000 --- a/src/cc/rogue/Makefile.std +++ /dev/null @@ -1,158 +0,0 @@ -# -# Makefile for rogue -# @(#)Makefile 4.21 (Berkeley) 02/04/99 -# -# Rogue: Exploring the Dungeons of Doom -# Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman -# All rights reserved. -# -# See the file LICENSE.TXT for full copyright and licensing information. -# - -DISTNAME = rogue5.4.4 -PROGRAM = rogue54 -O = o -HDRS = rogue.h extern.h score.h -OBJS1 = vers.$(O) extern.$(O) armor.$(O) chase.$(O) command.$(O) \ - daemon.$(O) daemons.$(O) fight.$(O) init.$(O) io.$(O) list.$(O) \ - mach_dep.$(O) main.$(O) mdport.$(O) misc.$(O) monsters.$(O) \ - move.$(O) new_level.$(O) -OBJS2 = options.$(O) pack.$(O) passages.$(O) potions.$(O) rings.$(O) \ - rip.$(O) rooms.$(O) save.$(O) scrolls.$(O) state.$(O) sticks.$(O) \ - things.$(O) weapons.$(O) wizard.$(O) xcrypt.$(O) -OBJS = $(OBJS1) $(OBJS2) -CFILES = vers.c extern.c armor.c chase.c command.c daemon.c \ - daemons.c fight.c init.c io.c list.c mach_dep.c \ - main.c mdport.c misc.c monsters.c move.c new_level.c \ - options.c pack.c passages.c potions.c rings.c rip.c \ - rooms.c save.c scrolls.c state.c sticks.c things.c \ - weapons.c wizard.c xcrypt.c -MISC_C = findpw.c scedit.c scmisc.c -DOCSRC = rogue.me.in rogue.6.in rogue.doc.in rogue.html.in rogue.cat.in -DOCS = $(PROGRAM).doc $(PROGRAM).html $(PROGRAM).cat $(PROGRAM).me \ - $(PROGRAM).6 -AFILES = configure Makefile.in configure.ac config.h.in config.sub config.guess \ - install-sh rogue.6.in rogue.me.in rogue.html.in rogue.doc.in rogue.cat.in -MISC = Makefile.std LICENSE.TXT rogue54.sln rogue54.vcproj rogue.spec \ - rogue.png rogue.desktop -CC = gcc -FEATURES = -DALLSCORES -DSCOREFILE=\"$(SCOREFILE)\" -DLOCKFILE=\"$(LOCKFILE)\" -CPPFLAGS = -CFLAGS = -O3 -LDFLAGS = -LIBS = -lcurses -RM = rm -f -MAKEFILE = -f Makefile.std -SCOREFILE= $(PROGRAM).scr -LOCKFILE = $(PROGRAM).lck -OUTFLAG = -o -EXE = - -.SUFFIXES: .obj - -.c.obj: - $(CC) $(CFLAGS) $(CPPFLAGS) $(FEATURES) /c $*.c - -.c.o: - $(CC) $(CFLAGS) $(CPPFLAGS) $(FEATURES) -c $*.c - -$(PROGRAM): $(HDRS) $(OBJS) fixdocs - $(CC) $(LDFLAGS) $(OBJS) $(LIBS) $(OUTFLAG)$@$(EXE) - -clean: - $(RM) $(OBJS1) - $(RM) $(OBJS2) - $(RM) core a.exe a.out a.exe.stackdump $(PROGRAM) $(PROGRAM).exe $(PROGRAM).lck - $(RM) $(PROGRAM).tar $(PROGRAM).tar.gz $(PROGRAM).zip - $(RM) $(DISTNAME)/* - -dist.src: - $(MAKE) $(MAKEFILE) clean - mkdir $(DISTNAME) - cp $(CFILES) $(HDRS) $(MISC) $(AFILES) $(DISTNAME) - tar cf $(DISTNAME)-src.tar $(DISTNAME) - gzip -f $(DISTNAME)-src.tar - rm -fr $(DISTNAME) - -findpw: findpw.c xcrypt.o mdport.o xcrypt.o - $(CC) -s -o findpw findpw.c xcrypt.o mdport.o -lcurses - -scedit: scedit.o scmisc.o vers.o mdport.o xcrypt.o - $(CC) -s -o scedit vers.o scedit.o scmisc.o mdport.o xcrypt.o -lcurses - -scmisc.o scedit.o: - $(CC) -O -c $(SF) $*.c - -doc.nroff: - tbl rogue.me | nroff -me | colcrt - > rogue.doc - nroff -man rogue.6 | colcrt - > rogue.cat - -doc.groff: - groff -P-c -t -me -Tascii rogue.me | sed -e 's/.\x08//g' > rogue.doc - groff -man rogue.6 | sed -e 's/.\x08//g' > rogue.cat - -fixdocs: - sed -e 's/@PROGRAM@/$(PROGRAM)/' -e 's/@SCOREFILE@/$(SCOREFILE)/' rogue.6.in > $(PROGRAM).6 - sed -e 's/@PROGRAM@/$(PROGRAM)/' -e 's/@SCOREFILE@/$(SCOREFILE)/' rogue.me.in > $(PROGRAM).me - sed -e 's/@PROGRAM@/$(PROGRAM)/' -e 's/@SCOREFILE@/$(SCOREFILE)/' rogue.html.in > $(PROGRAM).html - sed -e 's/@PROGRAM@/$(PROGRAM)/' -e 's/@SCOREFILE@/$(SCOREFILE)/' rogue.doc.in > $(PROGRAM).doc - sed -e 's/@PROGRAM@/$(PROGRAM)/' -e 's/@SCOREFILE@/$(SCOREFILE)/' rogue.cat.in > $(PROGRAM).cat - -dist.irix: - $(MAKE) $(MAKEFILE) clean - $(MAKE) $(MAKEFILE) CC=cc $(PROGRAM) - tar cf $(DISTNAME)-irix.tar $(PROGRAM) LICENSE.TXT $(DOCS) - gzip -f $(DISTNAME)-irix.tar - -dist.aix: - $(MAKE) $(MAKEFILE) clean - $(MAKE) $(MAKEFILE) CC=xlc CFLAGS="-qmaxmem=16768 -O3 -qstrict" $(PROGRAM) - tar cf $(DISTNAME)-aix.tar $(PROGRAM) LICENSE.TXT $(DOCS) - gzip -f $(DISTNAME)-aix.tar - -dist.linux: - $(MAKE) $(MAKEFILE) clean - $(MAKE) $(MAKEFILE) $(PROGRAM) - tar cf $(DISTNAME)-linux.tar $(PROGRAM) LICENSE.TXT $(DOCS) - gzip -f $(DISTNAME)-linux.tar - -dist.interix: - @$(MAKE) $(MAKEFILE) clean - @$(MAKE) $(MAKEFILE) CFLAGS="-ansi" $(PROGRAM) - tar cf $(DISTNAME)-interix.tar $(PROGRAM) LICENSE.TXT $(DOCS) - gzip -f $(DISTNAME)-interix.tar - -dist.cygwin: - @$(MAKE) $(MAKEFILE) --no-print-directory clean - @$(MAKE) $(MAKEFILE) CPPFLAGS="-I/usr/include/ncurses" --no-print-directory $(PROGRAM) - tar cf $(DISTNAME)-cygwin.tar $(PROGRAM).exe LICENSE.TXT $(DOCS) - gzip -f $(DISTNAME)-cygwin.tar - -# -# Use MINGW32-MAKE to build this target -# -dist.mingw32: - @$(MAKE) $(MAKEFILE) --no-print-directory RM="cmd /c del" clean - @$(MAKE) $(MAKEFILE) --no-print-directory CPPFLAGS="-I../pdcurses" LIBS="../pdcurses/pdcurses.a" $(PROGRAM) - cmd /c del $(DISTNAME)-mingw32.zip - zip $(DISTNAME)-mingw32.zip $(PROGRAM).exe LICENSE.TXT $(DOCS) - -dist.djgpp: - @$(MAKE) $(MAKEFILE) --no-print-directory clean - @$(MAKE) $(MAKEFILE) --no-print-directory LDFLAGS="-L$(DJDIR)/LIB" \ - LIBS="-lpdcurses" $(PROGRAM) - rm -f $(DISTNAME)-djgpp.zip - zip $(DISTNAME)-djgpp.zip $(PROGRAM) LICENSE.TXT $(DOCS) - -# -# Use NMAKE to build this targer -# - -dist.win32: - @$(MAKE) $(MAKEFILE) /NOLOGO O="obj" RM="-del" clean - @$(MAKE) $(MAKEFILE) /NOLOGO O="obj" CC="CL" \ - LIBS="..\pdcurses\pdcurses.lib shell32.lib user32.lib Advapi32.lib" \ - EXE=".exe" OUTFLAG="/Fe" CPPFLAGS="-I..\pdcurses" \ - CFLAGS="-nologo -Ox -wd4033 -wd4716" $(PROGRAM) - -del $(DISTNAME)-win32.zip - zip $(DISTNAME)-win32.zip $(PROGRAM).exe LICENSE.TXT $(DOCS) diff --git a/src/cc/rogue/Makefile_win b/src/cc/rogue/Makefile_win deleted file mode 100644 index e5a36d9b4..000000000 --- a/src/cc/rogue/Makefile_win +++ /dev/null @@ -1,222 +0,0 @@ -############################################################################### -# -# Makefile for rogue -# -# Rogue: Exploring the Dungeons of Doom -# Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman -# All rights reserved. -# -# See the file LICENSE.TXT for full copyright and licensing information. -# -############################################################################### - -############################################################################### -# Site configuration occurs beneath this comment -# Typically ./configure (autoconf tools) configures this section -# This section could be manually configured if autoconf/configure fails -############################################################################### - -DISTNAME=rogue5.4.4 -PACKAGE_TARNAME = rogue-5.4.4 -PROGRAM=rogue - -O=o - -#CC=gcc -CC = x86_64-w64-mingw32-gcc - -#CFLAGS=-O2 -CFLAGS= -g -O2 -I./x86_64-w64-mingw32/include -I./x86_64-w64-mingw32/include/ncursesw - -#LIBS=-lcurses -LIBS = -L./x86_64-w64-mingw32/lib -lncursesw -lcurl - -#RM=rm -f -RM = rm -f - -#GROFF=groff -GROFF = groff - -#NROFF=nroff -NROFF = nroff - -#TBL=tbl -TBL = tbl - -#COLCRT=colcrt -COLCRT = colcrt - -#SED=sed -SED = sed - -#SCOREFILE=rogue54.scr -SCOREFILE = rogue.scr - -#LOCKFILE=rogue54.lck -LOCKFILE = rogue.lck - -#GROUPOWNER=games -GROUPOWNER = - -#CPPFLAGS=-DHAVE_CONFIG_H -CPPFLAGS =-DHAVE_CONFIG_H - -#DISTFILE = $(PROGRAM) -DISTFILE = $(DISTNAME)-x86_64-w64-mingw32 - -INSTALL=./install-sh - -#INSTGROUP=-g games -INSTGROUP= -#INSTOWNER=-u root -INSTOWNER= - -CHGRP=chgrp - -MKDIR=mkdir - -TOUCH=touch - -RMDIR=rmdir - -CHMOD=chmod - -DESTDIR= - -prefix=/usr/local -exec_prefix=${prefix} -datarootdir=${prefix}/share -datadir=${datarootdir} -bindir=${exec_prefix}/bin -mandir=${datarootdir}/man -docdir=${datarootdir}/doc/${PACKAGE_TARNAME} -man6dir = $(mandir)/man6 - -############################################################################### -# Site configuration occurs above this comment -# It should not be necessary to change anything below this comment -############################################################################### - -HDRS = rogue.h extern.h score.h -OBJS1 = vers.$(O) extern.$(O) armor.$(O) chase.$(O) command.$(O) \ - daemon.$(O) daemons.$(O) fight.$(O) init.$(O) io.$(O) list.$(O) \ - mach_dep.$(O) rogue.$(O) mdport.$(O) misc.$(O) monsters.$(O) \ - move.$(O) new_level.$(O) -OBJS2 = options.$(O) pack.$(O) passages.$(O) potions.$(O) rings.$(O) \ - rip.$(O) rooms.$(O) save.$(O) scrolls.$(O) state.$(O) sticks.$(O) \ - things.$(O) weapons.$(O) wizard.$(O) xcrypt.$(O) -OBJS = main.$(O) $(OBJS1) $(OBJS2) -CFILES = vers.c extern.c armor.c chase.c command.c daemon.c \ - daemons.c fight.c init.c io.c list.c mach_dep.c \ - main.c mdport.c misc.c monsters.c move.c new_level.c \ - options.c pack.c passages.c potions.c rings.c rip.c \ - rooms.c save.c scrolls.c state.c sticks.c things.c \ - weapons.c wizard.c xcrypt.c -MISC_C = findpw.c scedit.c scmisc.c -DOCSRC = rogue.me.in rogue.6.in rogue.doc.in rogue.html.in rogue.cat.in -DOCS = $(PROGRAM).doc $(PROGRAM).html $(PROGRAM).cat $(PROGRAM).me \ - $(PROGRAM).6 -AFILES = configure Makefile.in configure.ac config.h.in config.sub config.guess \ - install-sh rogue.6.in rogue.me.in rogue.html.in rogue.doc.in rogue.cat.in -MISC = Makefile.std LICENSE.TXT rogue54.sln rogue54.vcproj rogue.spec \ - rogue.png rogue.desktop - -.SUFFIXES: .obj - -.c.obj: - $(CC) $(CFLAGS) $(CPPFLAGS) /c $*.c - -.c.o: - $(CC) $(CFLAGS) $(CPPFLAGS) -c $*.c - -#$(RM) rogue.so ; $(CC) -shared -o rogue.so cursesd.c $(OBJS1) $(OBJS2); $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $@ - -$(PROGRAM): $(HDRS) $(OBJS) - $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $@.exe - -clean: - $(RM) $(OBJS1); $(RM) main.$(O) ; $(RM) rogue.so - $(RM) $(OBJS2) - $(RM) core a.exe a.out a.exe.stackdump $(PROGRAM) $(PROGRAM).exe - $(RM) $(PROGRAM).tar $(PROGRAM).tar.gz $(PROGRAM).zip - $(RM) $(DISTNAME)/* - -rmdir $(DISTNAME) - -maintainer-clean: - $(RM) config.h - $(RM) Makefile - $(RM) config.status - $(RM) -r autom4te.cache - $(RM) config.log - $(RM) $(PROGRAM).scr $(PROGRAM).lck - -stddocs: - sed -e 's/rogue/rogue/' -e 's/rogue.scr/rogue.scr/' rogue.6.in > rogue.6 - sed -e 's/rogue/rogue/' -e 's/rogue.scr/rogue.scr/' rogue.me.in > rogue.me - sed -e 's/rogue/rogue/' -e 's/rogue.scr/rogue.scr/' rogue.html.in > rogue,html - sed -e 's/rogue/rogue/' -e 's/rogue.scr/rogue.scr/' rogue.doc.in > rogue.doc - sed -e 's/rogue/rogue/' -e 's/rogue.scr/rogue.scr/' rogue.cat.in > rogue.cat - -dist.src: - $(MAKE) $(MAKEFILE) clean - mkdir $(DISTNAME) - cp $(CFILES) $(HDRS) $(MISC) $(AFILES) $(DISTNAME) - tar cf $(DISTNAME)-src.tar $(DISTNAME) - gzip -f $(DISTNAME)-src.tar - rm -fr $(DISTNAME) - -findpw: findpw.c xcrypt.o mdport.o xcrypt.o - $(CC) -s -o findpw findpw.c xcrypt.o mdport.o -lcurses - -scedit: scedit.o scmisc.o vers.o mdport.o xcrypt.o - $(CC) -s -o scedit vers.o scedit.o scmisc.o mdport.o xcrypt.o -lcurses - -scmisc.o scedit.o: - $(CC) -O -c $(SF) $*.c - -$(PROGRAM).doc: rogue.me - if test "x$(GROFF)" != "x" -a "x$(SED)" != "x" ; then \ - $(GROFF) -P-c -t -me -Tascii rogue.me | $(SED) -e 's/.\x08//g' > $(PROGRAM).doc ;\ - elif test "x$(NROFF)" != "x" -a "x$(TBL)" != "x" -a "x$(COLCRT)" != "x" ; then \ - tbl rogue.me | $(NROFF) -me | colcrt - > $(PROGRAM).doc ;\ - fi - -$(PROGRAM).cat: rogue.6 - if test "x$(GROFF)" != "x" -a "x$(SED)" != "x" ; then \ - $(GROFF) -Tascii -man rogue.6 | $(SED) -e 's/.\x08//g' > $(PROGRAM).cat ;\ - elif test "x$(NROFF)" != "x" -a "x$(TBL)" != "x" -a "x$(COLCRT)" != "x" ; then \ - $(NROFF) -man rogue.6 | $(COLCRT) - > $(PROGRAM).cat ;\ - fi - -dist: clean $(PROGRAM) - tar cf $(DISTFILE).tar $(PROGRAM) LICENSE.TXT $(DOCS) - gzip -f $(DISTFILE).tar - -install: $(PROGRAM) - -$(TOUCH) test - -if test ! -f $(DESTDIR)$(SCOREFILE) ; then $(INSTALL) -m 0664 test $(DESTDIR)$(SCOREFILE) ; fi - -$(INSTALL) -m 0755 $(PROGRAM) $(DESTDIR)$(bindir)/$(PROGRAM) - -if test "x$(GROUPOWNER)" != "x" ; then \ - $(CHGRP) $(GROUPOWNER) $(DESTDIR)$(SCOREFILE) ; \ - $(CHGRP) $(GROUPOWNER) $(DESTDIR)$(bindir)/$(PROGRAM) ; \ - $(CHMOD) 02755 $(DESTDIR)$(bindir)/$(PROGRAM) ; \ - $(CHMOD) 0464 $(DESTDIR)$(SCOREFILE) ; \ - fi - -if test -d $(man6dir) ; then $(INSTALL) -m 0644 rogue.6 $(DESTDIR)$(man6dir)/$(PROGRAM).6 ; fi - -if test ! -d $(man6dir) ; then $(INSTALL) -m 0644 rogue.6 $(DESTDIR)$(mandir)/$(PROGRAM).6 ; fi - -$(INSTALL) -m 0644 rogue.doc $(DESTDIR)$(docdir)/$(PROGRAM).doc - -$(INSTALL) -m 0644 rogue.html $(DESTDIR)$(docdir)/$(PROGRAM).html - -$(INSTALL) -m 0644 rogue.cat $(DESTDIR)$(docdir)/$(PROGRAM).cat - -$(INSTALL) -m 0644 LICENSE.TXT $(DESTDIR)$(docdir)/LICENSE.TXT - -$(INSTALL) -m 0644 rogue.me $(DESTDIR)$(docdir)/$(PROGRAM).me - -if test ! -f $(DESTDIR)$(LOCKFILE) ; then $(INSTALL) -m 0666 test $(DESTDIR)$(LOCKFILE) ; $(RM) $(DESTDIR)$(LOCKFILE) ; fi - -$(RM) test - -uninstall: - -$(RM) $(DESTDIR)$(bindir)/$(PROGRAM) - -$(RM) $(DESTDIR)$(man6dir)/$(PROGRAM).6 - -$(RM) $(DESTDIR)$(docdir)$(PROGRAM)/$(PROGRAM).doc - -$(RM) $(DESTDIR)$(LOCKFILE) - -$(RMDIR) $(DESTDIR)$(docdir)$(PROGRAM) - -reinstall: uninstall install diff --git a/src/cc/rogue/armor.c b/src/cc/rogue/armor.c deleted file mode 100644 index 9a90aebde..000000000 --- a/src/cc/rogue/armor.c +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * This file contains misc functions for dealing with armor - * @(#)armor.c 4.14 (Berkeley) 02/05/99 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -//#include -#include "rogue.h" - -/* - * wear: - * The player wants to wear something, so let him/her put it on. - */ -void -wear(struct rogue_state *rs) -{ - register THING *obj; - register char *sp; - - if ((obj = get_item(rs,"wear", ARMOR)) == NULL) - return; - if (cur_armor != NULL) - { - addmsg(rs,"you are already wearing some"); - if (!terse) - addmsg(rs,". You'll have to take it off first"); - endmsg(rs); - after = FALSE; - return; - } - if (obj->o_type != ARMOR) - { - msg(rs,"you can't wear that"); - return; - } - waste_time(rs); - obj->o_flags |= ISKNOW; - sp = inv_name(obj, TRUE); - cur_armor = obj; - if (!terse) - addmsg(rs,"you are now "); - msg(rs,"wearing %s", sp); -} - -/* - * take_off: - * Get the armor off of the players back - */ -void -take_off(struct rogue_state *rs) -{ - register THING *obj; - - if ((obj = cur_armor) == NULL) - { - after = FALSE; - if (terse) - msg(rs,"not wearing armor"); - else - msg(rs,"you aren't wearing any armor"); - return; - } - if (!dropcheck(rs,cur_armor)) - return; - cur_armor = NULL; - if (terse) - addmsg(rs,"was"); - else - addmsg(rs,"you used to be"); - msg(rs," wearing %c) %s", obj->o_packch, inv_name(obj, TRUE)); -} - -/* - * waste_time: - * Do nothing but let other things happen - */ -void -waste_time(struct rogue_state *rs) -{ - do_daemons(rs,BEFORE); - do_fuses(rs,BEFORE); - do_daemons(rs,AFTER); - do_fuses(rs,AFTER); -} diff --git a/src/cc/rogue/chase.c b/src/cc/rogue/chase.c deleted file mode 100644 index d5964936b..000000000 --- a/src/cc/rogue/chase.c +++ /dev/null @@ -1,544 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * Code for one creature to chase another - * - * @(#)chase.c 4.57 (Berkeley) 02/05/99 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -//#include -//#include -#include "rogue.h" - -#define DRAGONSHOT 5 /* one chance in DRAGONSHOT that a dragon will flame */ - -static coord ch_ret; /* Where chasing takes you */ - -/* - * runners: - * Make all the running monsters move. - */ -void -runners(struct rogue_state *rs,int arg) -{ - register THING *tp; - THING *next; - bool wastarget; - static coord orig_pos; - - for (tp = mlist; tp != NULL; tp = next) - { - /* remember this in case the monster's "next" is changed */ - next = next(tp); - if (!on(*tp, ISHELD) && on(*tp, ISRUN)) - { - orig_pos = tp->t_pos; - wastarget = on(*tp, ISTARGET); - if (move_monst(rs,tp) == -1) - continue; - if (on(*tp, ISFLY) && dist_cp(&hero, &tp->t_pos) >= 3) - move_monst(rs,tp); - if (wastarget && !ce(orig_pos, tp->t_pos)) - { - tp->t_flags &= ~ISTARGET; - to_death = FALSE; - } - } - } - if (has_hit) - { - endmsg(rs); - has_hit = FALSE; - } -} - -/* - * move_monst: - * Execute a single turn of running for a monster - */ -int -move_monst(struct rogue_state *rs,THING *tp) -{ - if (!on(*tp, ISSLOW) || tp->t_turn) - if (do_chase(rs,tp) == -1) - return(-1); - if (on(*tp, ISHASTE)) - if (do_chase(rs,tp) == -1) - return(-1); - tp->t_turn ^= TRUE; - return(0); -} - -/* - * relocate: - * Make the monster's new location be the specified one, updating - * all the relevant state. - */ -void -relocate(struct rogue_state *rs,THING *th, coord *new_loc) -{ - struct room *oroom; - - if (!ce(*new_loc, th->t_pos)) - { - mvaddch(th->t_pos.y, th->t_pos.x, th->t_oldch); - th->t_room = roomin(rs,new_loc); - set_oldch(th, new_loc); - oroom = th->t_room; - moat(th->t_pos.y, th->t_pos.x) = NULL; - - if (oroom != th->t_room) - th->t_dest = find_dest(rs,th); - th->t_pos = *new_loc; - moat(new_loc->y, new_loc->x) = th; - } - move(new_loc->y, new_loc->x); - if (see_monst(th)) - addch(th->t_disguise); - else if (on(player, SEEMONST)) - { - standout(); - addch(th->t_type); - standend(); - } -} - -/* - * do_chase: - * Make one thing chase another. - */ -int -do_chase(struct rogue_state *rs,THING *th) -{ - register coord *cp; - register struct room *rer, *ree; /* room of chaser, room of chasee */ - register int mindist = 32767, curdist; - register bool stoprun = FALSE; /* TRUE means we are there */ - register bool door; - register THING *obj; - static coord DEST; /* Temporary destination for chaser */ - - rer = th->t_room; /* Find room of chaser */ - if (on(*th, ISGREED) && rer->r_goldval == 0) - th->t_dest = &hero; /* If gold has been taken, run after hero */ - if (th->t_dest == &hero) /* Find room of chasee */ - ree = proom; - else - ree = roomin(rs,th->t_dest); - /* - * We don't count doors as inside rooms for this routine - */ - door = (chat(th->t_pos.y, th->t_pos.x) == DOOR); - /* - * If the object of our desire is in a different room, - * and we are not in a corridor, run to the door nearest to - * our goal. - */ -over: - if (rer != ree) - { - for (cp = rer->r_exit; cp < &rer->r_exit[rer->r_nexits]; cp++) - { - curdist = dist_cp(th->t_dest, cp); - if (curdist < mindist) - { - DEST = *cp; - mindist = curdist; - } - } - if (door) - { - rer = &passages[flat(th->t_pos.y, th->t_pos.x) & F_PNUM]; - door = FALSE; - goto over; - } - } - else - { - DEST = *th->t_dest; - /* - * For dragons check and see if (a) the hero is on a straight - * line from it, and (b) that it is within shooting distance, - * but outside of striking range. - */ - if (th->t_type == 'D' && (th->t_pos.y == hero.y || th->t_pos.x == hero.x - || abs(th->t_pos.y - hero.y) == abs(th->t_pos.x - hero.x)) - && dist_cp(&th->t_pos, &hero) <= BOLT_LENGTH * BOLT_LENGTH - && !on(*th, ISCANC) && rnd(DRAGONSHOT) == 0) - { - delta.y = sign(hero.y - th->t_pos.y); - delta.x = sign(hero.x - th->t_pos.x); - if (has_hit) - endmsg(rs); - fire_bolt(rs,&th->t_pos, &delta, "flame"); - running = FALSE; - count = 0; - quiet = 0; - if (to_death && !on(*th, ISTARGET)) - { - to_death = FALSE; - kamikaze = FALSE; - } - return(0); - } - } - /* - * This now contains what we want to run to this time - * so we run to it. If we hit it we either want to fight it - * or stop running - */ - if (!chase(th, &DEST)) - { - if (ce(DEST, hero)) - { - return( attack(rs,th) ); - } - else if (ce(DEST, *th->t_dest)) - { - for (obj = lvl_obj; obj != NULL; obj = next(obj)) - if (th->t_dest == &obj->o_pos) - { - detach(lvl_obj, obj); - attach(th->t_pack, obj); - chat(obj->o_pos.y, obj->o_pos.x) = - (th->t_room->r_flags & ISGONE) ? PASSAGE : FLOOR; - th->t_dest = find_dest(rs,th); - break; - } - if (th->t_type != 'F') - stoprun = TRUE; - } - } - else - { - if (th->t_type == 'F') - return(0); - } - relocate(rs,th, &ch_ret); - /* - * And stop running if need be - */ - if (stoprun && ce(th->t_pos, *(th->t_dest))) - th->t_flags &= ~ISRUN; - return(0); -} - -/* - * set_oldch: - * Set the oldch character for the monster - */ -void -set_oldch(THING *tp, coord *cp) -{ - char sch; - - if (ce(tp->t_pos, *cp)) - return; - - sch = tp->t_oldch; - tp->t_oldch = CCHAR( mvinch(cp->y,cp->x) ); - if (!on(player, ISBLIND)) - { - if ((sch == FLOOR || tp->t_oldch == FLOOR) && - (tp->t_room->r_flags & ISDARK)) - tp->t_oldch = ' '; - else if (dist_cp(cp, &hero) <= LAMPDIST && see_floor) - tp->t_oldch = chat(cp->y, cp->x); - } -} - -/* - * see_monst: - * Return TRUE if the hero can see the monster - */ -bool -see_monst(THING *mp) -{ - int y, x; - - if (on(player, ISBLIND)) - return FALSE; - if (on(*mp, ISINVIS) && !on(player, CANSEE)) - return FALSE; - y = mp->t_pos.y; - x = mp->t_pos.x; - if (dist(y, x, hero.y, hero.x) < LAMPDIST) - { - if (y != hero.y && x != hero.x && - !step_ok(chat(y, hero.x)) && !step_ok(chat(hero.y, x))) - return FALSE; - return TRUE; - } - if (mp->t_room != proom) - return FALSE; - return ((bool)!(mp->t_room->r_flags & ISDARK)); -} - -/* - * runto: - * Set a monster running after the hero. - */ -void -runto(struct rogue_state *rs,coord *runner) -{ - register THING *tp; - - /* - * If we couldn't find him, something is funny - */ -#ifdef MASTER - if ((tp = moat(runner->y, runner->x)) == NULL) - msg(rs,"couldn't find monster in runto at (%d,%d)", runner->y, runner->x); -#else - tp = moat(runner->y, runner->x); -#endif - /* - * Start the beastie running - */ - tp->t_flags |= ISRUN; - tp->t_flags &= ~ISHELD; - tp->t_dest = find_dest(rs,tp); -} - -/* - * chase: - * Find the spot for the chaser(er) to move closer to the - * chasee(ee). Returns TRUE if we want to keep on chasing later - * FALSE if we reach the goal. - */ -bool -chase(THING *tp, coord *ee) -{ - register THING *obj; - register int x, y; - register int curdist, thisdist; - register coord *er = &tp->t_pos; - register char ch; - register int plcnt = 1; - static coord tryp; - - /* - * If the thing is confused, let it move randomly. Invisible - * Stalkers are slightly confused all of the time, and bats are - * quite confused all the time - */ - if ((on(*tp, ISHUH) && rnd(5) != 0) || (tp->t_type == 'P' && rnd(5) == 0) - || (tp->t_type == 'B' && rnd(2) == 0)) - { - /* - * get a valid random move - */ - ch_ret = *rndmove(tp); - curdist = dist_cp(&ch_ret, ee); - /* - * Small chance that it will become un-confused - */ - if (rnd(20) == 0) - tp->t_flags &= ~ISHUH; - } - /* - * Otherwise, find the empty spot next to the chaser that is - * closest to the chasee. - */ - else - { - register int ey, ex; - /* - * This will eventually hold where we move to get closer - * If we can't find an empty spot, we stay where we are. - */ - curdist = dist_cp(er, ee); - ch_ret = *er; - - ey = er->y + 1; - if (ey >= NUMLINES - 1) - ey = NUMLINES - 2; - ex = er->x + 1; - if (ex >= NUMCOLS) - ex = NUMCOLS - 1; - - for (x = er->x - 1; x <= ex; x++) - { - if (x < 0) - continue; - tryp.x = x; - for (y = er->y - 1; y <= ey; y++) - { - tryp.y = y; - if (!diag_ok(er, &tryp)) - continue; - ch = winat(y, x); - if (step_ok(ch)) - { - /* - * If it is a scroll, it might be a scare monster scroll - * so we need to look it up to see what type it is. - */ - if (ch == SCROLL) - { - for (obj = lvl_obj; obj != NULL; obj = next(obj)) - { - if (y == obj->o_pos.y && x == obj->o_pos.x) - break; - } - if (obj != NULL && obj->o_which == S_SCARE) - continue; - } - /* - * It can also be a Xeroc, which we shouldn't step on - */ - if ((obj = moat(y, x)) != NULL && obj->t_type == 'X') - continue; - /* - * If we didn't find any scrolls at this place or it - * wasn't a scare scroll, then this place counts - */ - thisdist = dist(y, x, ee->y, ee->x); - if (thisdist < curdist) - { - plcnt = 1; - ch_ret = tryp; - curdist = thisdist; - } - else if (thisdist == curdist && rnd(++plcnt) == 0) - { - ch_ret = tryp; - curdist = thisdist; - } - } - } - } - } - return (bool)(curdist != 0 && !ce(ch_ret, hero)); -} - -/* - * roomin: - * Find what room some coordinates are in. NULL means they aren't - * in any room. - */ -struct room * -roomin(struct rogue_state *rs,coord *cp) -{ - register struct room *rp; - register char *fp; - - - fp = &flat(cp->y, cp->x); - if (*fp & F_PASS) - return &passages[*fp & F_PNUM]; - - for (rp = rooms; rp < &rooms[MAXROOMS]; rp++) - if (cp->x <= rp->r_pos.x + rp->r_max.x && rp->r_pos.x <= cp->x - && cp->y <= rp->r_pos.y + rp->r_max.y && rp->r_pos.y <= cp->y) - return rp; - - msg(rs,"in some bizarre place (%d, %d)", unc(*cp)); -#ifdef MASTER - abort(); - return NULL; -#else - return NULL; -#endif -} - -/* - * diag_ok: - * Check to see if the move is legal if it is diagonal - */ -bool -diag_ok(coord *sp, coord *ep) -{ - if (ep->x < 0 || ep->x >= NUMCOLS || ep->y <= 0 || ep->y >= NUMLINES - 1) - return FALSE; - if (ep->x == sp->x || ep->y == sp->y) - return TRUE; - return (bool)(step_ok(chat(ep->y, sp->x)) && step_ok(chat(sp->y, ep->x))); -} - -/* - * cansee: - * Returns true if the hero can see a certain coordinate. - */ -bool -cansee(struct rogue_state *rs,int y, int x) -{ - register struct room *rer; - static coord tp; - - if (on(player, ISBLIND)) - return FALSE; - if (dist(y, x, hero.y, hero.x) < LAMPDIST) - { - if (flat(y, x) & F_PASS) - if (y != hero.y && x != hero.x && - !step_ok(chat(y, hero.x)) && !step_ok(chat(hero.y, x))) - return FALSE; - return TRUE; - } - /* - * We can only see if the hero in the same room as - * the coordinate and the room is lit or if it is close. - */ - tp.y = y; - tp.x = x; - return (bool)((rer = roomin(rs,&tp)) == proom && !(rer->r_flags & ISDARK)); -} - -/* - * find_dest: - * find the proper destination for the monster - */ -coord * -find_dest(struct rogue_state *rs,THING *tp) -{ - register THING *obj; - register int prob; - - if ((prob = monsters[tp->t_type - 'A'].m_carry) <= 0 || tp->t_room == proom - || see_monst(tp)) - return &hero; - for (obj = lvl_obj; obj != NULL; obj = next(obj)) - { - if (obj->o_type == SCROLL && obj->o_which == S_SCARE) - continue; - if (roomin(rs,&obj->o_pos) == tp->t_room && rnd(100) < prob) - { - for (tp = mlist; tp != NULL; tp = next(tp)) - if (tp->t_dest == &obj->o_pos) - break; - if (tp == NULL) - return &obj->o_pos; - } - } - return &hero; -} - -/* - * dist: - * Calculate the "distance" between to points. Actually, - * this calculates d^2, not d, but that's good enough for - * our purposes, since it's only used comparitively. - */ -int -dist(int y1, int x1, int y2, int x2) -{ - return ((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); -} - -/* - * dist_cp: - * Call dist() with appropriate arguments for coord pointers - */ -int -dist_cp(coord *c1, coord *c2) -{ - return dist(c1->y, c1->x, c2->y, c2->x); -} diff --git a/src/cc/rogue/command.c b/src/cc/rogue/command.c deleted file mode 100644 index e5c5adce9..000000000 --- a/src/cc/rogue/command.c +++ /dev/null @@ -1,847 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * Read and execute the user commands - * - * @(#)command.c 4.73 (Berkeley) 08/06/83 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -//#include -#include "rogue.h" - -/* - * command: - * Process the user commands - */ -void -command(struct rogue_state *rs) -{ - register char ch; - register int ntimes = 1; /* Number of player moves */ - char *fp; - THING *mp; - static char countch, direction, newcount = FALSE; - if (on(player, ISHASTE)) - ntimes++; - /* - * Let the daemons start up - */ - do_daemons(rs,BEFORE); - do_fuses(rs,BEFORE); - while (ntimes--) - { - if ( rs->replaydone != 0 ) - return; - again = FALSE; - if (has_hit) - { - endmsg(rs); - has_hit = FALSE; - } - /* - * these are illegal things for the player to be, so if any are - * set, someone's been poking in memeory - */ - if (on(player, ISSLOW|ISGREED|ISINVIS|ISREGEN|ISTARGET)) - exit(1); - - look(rs,TRUE); - if (!running) - door_stop = FALSE; - status(rs); - lastscore = purse; - move(hero.y, hero.x); - if ( rs->sleeptime != 0 ) - { - if (!((running || count) && jump)) - refresh(); /* Draw screen */ - } - take = 0; - after = TRUE; - /* - * Read command or continue run - */ -#ifdef MASTER - if (wizard) - noscore = TRUE; -#endif - if (!no_command) - { - if (running || to_death) - ch = runch; - else if (count) - ch = countch; - else - { - ch = readchar(rs); - move_on = FALSE; - if (mpos != 0) /* Erase message if its there */ - msg(rs,""); - } - } - else - ch = '.'; - if (no_command) - { - if (--no_command == 0) - { - player.t_flags |= ISRUN; - msg(rs,"you can move again"); - } - } - else - { - /* - * check for prefixes - */ - newcount = FALSE; - if (isdigit(ch)) - { - count = 0; - newcount = TRUE; - while (isdigit(ch)) - { - count = count * 10 + (ch - '0'); - if (count > 255) - count = 255; - ch = readchar(rs); - } - countch = ch; - /* - * turn off count for commands which don't make sense - * to repeat - */ - if ( rs->guiflag == 0 && rs->replaydone != 0 ) - ch = 'Q'; - switch (ch) - { - case CTRL('B'): case CTRL('H'): case CTRL('J'): - case CTRL('K'): case CTRL('L'): case CTRL('N'): - case CTRL('U'): case CTRL('Y'): - case '.': case 'a': case 'b': case 'h': case 'j': - case 'k': case 'l': case 'm': case 'n': case 'q': - case 'r': case 's': case 't': case 'u': case 'y': - case 'z': case 'B': case 'C': case 'H': case 'I': - case 'J': case 'K': case 'L': case 'N': case 'U': - case 'Y': -#ifdef MASTER - case CTRL('D'): case CTRL('A'): -#endif - break; - default: - count = 0; - } - } - /* - * execute a command - */ - if (count && !running) - count--; - if (ch != 'a' && ch != ESCAPE && !(running || count || to_death)) - { - l_last_comm = last_comm; - l_last_dir = last_dir; - l_last_pick = last_pick; - last_comm = ch; - last_dir = '\0'; - last_pick = NULL; - } -over: - switch (ch) - { - case ',': { - THING *obj = NULL; - int found = 0; - for (obj = lvl_obj; obj != NULL; obj = next(obj)) - { - if (obj->o_pos.y == hero.y && obj->o_pos.x == hero.x) - { - found=1; - break; - } - } - - if (found) { - if (levit_check(rs)) - ; - else - pick_up(rs,(char)obj->o_type); - } - else { - if (!terse) - addmsg(rs,"there is "); - addmsg(rs,"nothing here"); - if (!terse) - addmsg(rs," to pick up"); - endmsg(rs); - } - } - when '!': shell(rs); - when 'h': do_move(rs,0, -1); - when 'j': do_move(rs,1, 0); - when 'k': do_move(rs,-1, 0); - when 'l': do_move(rs,0, 1); - when 'y': do_move(rs,-1, -1); - when 'u': do_move(rs,-1, 1); - when 'b': do_move(rs,1, -1); - when 'n': do_move(rs,1, 1); - when 'H': do_run('h'); - when 'J': do_run('j'); - when 'K': do_run('k'); - when 'L': do_run('l'); - when 'Y': do_run('y'); - when 'U': do_run('u'); - when 'B': do_run('b'); - when 'N': do_run('n'); - when CTRL('H'): case CTRL('J'): case CTRL('K'): case CTRL('L'): - case CTRL('Y'): case CTRL('U'): case CTRL('B'): case CTRL('N'): - { - if (!on(player, ISBLIND)) - { - door_stop = TRUE; - firstmove = TRUE; - } - if (count && !newcount) - ch = direction; - else - { - ch += ('A' - CTRL('A')); - direction = ch; - } - goto over; - } - when 'F': - kamikaze = TRUE; - /* FALLTHROUGH */ - case 'f': - if (!get_dir(rs)) - { - after = FALSE; - break; - } - delta.y += hero.y; - delta.x += hero.x; - if ( ((mp = moat(delta.y, delta.x)) == NULL) - || ((!see_monst(mp)) && !on(player, SEEMONST))) - { - if (!terse) - addmsg(rs,"I see "); - msg(rs,"no monster there"); - after = FALSE; - } - else if (diag_ok(&hero, &delta)) - { - to_death = TRUE; - max_hit = 0; - mp->t_flags |= ISTARGET; - runch = ch = dir_ch; - goto over; - } - when 't': - if (!get_dir(rs)) - after = FALSE; - else - missile(rs,delta.y, delta.x); - when 'a': - if (last_comm == '\0') - { - msg(rs,"you haven't typed a command yet"); - after = FALSE; - } - else - { - ch = last_comm; - again = TRUE; - goto over; - } - case 'q': quaff(rs); - break; - when 'Q': - after = FALSE; - q_comm = TRUE; - if ( _quit() > 0 ) - { - if ( rs->guiflag != 0 ) - { - if (rs->needflush == 0 ) - rs->needflush = (uint32_t)time(NULL); - rogue_bailout(rs); - } else rs->replaydone = (uint32_t)time(NULL); - } - q_comm = FALSE; - return; - when 'i': after = FALSE; inventory(rs,pack, 0); - when 'I': after = FALSE; picky_inven(rs); - when 'd': drop(rs); - when 'r': read_scroll(rs); - when 'e': eat(rs); - when 'w': wield(rs); - when 'W': wear(rs); - when 'T': take_off(rs); - when 'P': ring_on(rs); - when 'R': ring_off(rs); - when 'o': option(rs); after = FALSE; - when 'c': call(rs); after = FALSE; - - when '>': after = FALSE; d_level(rs); - if ( rs->guiflag != 0 && rs->needflush == 0 ) - rs->needflush = (uint32_t)time(NULL); - - when '<': after = FALSE; u_level(rs); - if ( rs->guiflag != 0 && rs->needflush == 0 ) - rs->needflush = (uint32_t)time(NULL); - - when '?': after = FALSE; help(rs); - when '/': after = FALSE; identify(rs); - when 's': search(rs); - when 'z': - if (get_dir(rs)) - do_zap(rs); - else - after = FALSE; - when 'D': after = FALSE; discovered(rs); - when CTRL('P'): after = FALSE; msg(rs,huh); - when CTRL('R'): - after = FALSE; - clearok(curscr,TRUE); - wrefresh(curscr); - when 'v': - after = FALSE; - msg(rs,"version %s. (mctesq was here)", release); - when 'S': - after = FALSE; -#ifdef STANDALONE - save_game(rs); -#else - msg(rs,"Saving is disabled, use bailout rpc"); -#endif - when '.': ; /* Rest command */ - when ' ': after = FALSE; /* "Legal" illegal command */ - when '^': - after = FALSE; - if (get_dir(rs)) { - delta.y += hero.y; - delta.x += hero.x; - fp = &flat(delta.y, delta.x); - if (!terse) - addmsg(rs,"You have found "); - if (chat(delta.y, delta.x) != TRAP) - msg(rs,"no trap there"); - else if (on(player, ISHALU)) - msg(rs,(char *)tr_name[rnd(NTRAPS)]); - else { - msg(rs,(char *)tr_name[*fp & F_TMASK]); - *fp |= F_SEEN; - } - } -#ifdef MASTER - when '+': - after = FALSE; - if (wizard) - { - wizard = FALSE; - turn_see(rs,TRUE); - msg(rs,"not wizard any more"); - } - else - { - wizard = passwd(); - if (wizard) - { - noscore = TRUE; - turn_see(rs,FALSE); - msg(rs,"you are suddenly as smart as Ken Arnold in dungeon #%d", dnum); - } - else - msg(rs,"sorry"); - } -#endif - when ESCAPE: /* Escape */ - door_stop = FALSE; - count = 0; - after = FALSE; - again = FALSE; - when 'm': - move_on = TRUE; - if (!get_dir(rs)) - after = FALSE; - else - { - ch = dir_ch; - countch = dir_ch; - goto over; - } - when ')': current(rs,cur_weapon, "wielding", NULL); - when ']': current(rs,cur_armor, "wearing", NULL); - when '=': - current(rs,cur_ring[LEFT], "wearing", - terse ? (char *)"(L)" : (char *)"on left hand"); - current(rs,cur_ring[RIGHT], "wearing", - terse ? (char *)"(R)" : (char *)"on right hand"); - when '@': - stat_msg = TRUE; - status(rs); - stat_msg = FALSE; - after = FALSE; - otherwise: - after = FALSE; -#ifdef MASTER - if (wizard) switch (ch) - { - case '|': msg(rs,"@ %d,%d", hero.y, hero.x); - when 'C': create_obj(); - when '$': msg(rs,"inpack = %d", inpack); - when CTRL('G'): inventory(rs,lvl_obj, 0); - when CTRL('W'): whatis(rs,FALSE, 0); - when CTRL('D'): level++; new_level(); - when CTRL('A'): level--; new_level(); - when CTRL('F'): show_map(); - when CTRL('T'): teleport(); - when CTRL('E'): msg(rs,"food left: %d", food_left); - when CTRL('C'): add_pass(); - when CTRL('X'): turn_see(rs,on(player, SEEMONST)); - when CTRL('~'): - { - THING *item; - - if ((item = get_item(rs,"charge", STICK)) != NULL) - item->o_charges = 10000; - } - when CTRL('I'): - { - int i; - THING *obj; - - for (i = 0; i < 9; i++) - raise_level(rs); - /* - * Give him a sword (+1,+1) - */ - obj = new_item(); - init_weapon(obj, TWOSWORD); - obj->o_hplus = 1; - obj->o_dplus = 1; - add_pack(rs,obj, TRUE); - cur_weapon = obj; - /* - * And his suit of armor - */ - obj = new_item(); - obj->o_type = ARMOR; - obj->o_which = PLATE_MAIL; - obj->o_arm = -5; - obj->o_flags |= ISKNOW; - obj->o_count = 1; - obj->o_group = 0; - cur_armor = obj; - add_pack(rs,obj, TRUE); - } - when '*' : - pr_list(); - otherwise: - illcom(rs,ch); - } - else -#endif - illcom(rs,ch); - } - /* - * turn off flags if no longer needed - */ - if (!running) - door_stop = FALSE; - } -/* - * If he ran into something to take, let him pick it up. - */ - if (take != 0) - pick_up(rs,take); - if (!running) - door_stop = FALSE; - if (!after) - ntimes++; - } - do_daemons(rs,AFTER); - do_fuses(rs,AFTER); - if (ISRING(LEFT, R_SEARCH)) - search(rs); - else if (ISRING(LEFT, R_TELEPORT) && rnd(50) == 0) - teleport(rs); - if (ISRING(RIGHT, R_SEARCH)) - search(rs); - else if (ISRING(RIGHT, R_TELEPORT) && rnd(50) == 0) - teleport(rs); -} - -/* - * illcom: - * What to do with an illegal command - */ -void -illcom(struct rogue_state *rs,int ch) -{ - save_msg = FALSE; - count = 0; - msg(rs,"illegal command '%s'", unctrl(ch)); - save_msg = TRUE; -} - -/* - * search: - * player gropes about him to find hidden things. - */ -void -search(struct rogue_state *rs) -{ - register int y, x; - register char *fp; - register int ey, ex; - int probinc; - bool found; - - ey = hero.y + 1; - ex = hero.x + 1; - probinc = (on(player, ISHALU) ? 3 : 0); - probinc += (on(player, ISBLIND) ? 2 : 0); - found = FALSE; - for (y = hero.y - 1; y <= ey; y++) - for (x = hero.x - 1; x <= ex; x++) - { - if (y == hero.y && x == hero.x) - continue; - fp = &flat(y, x); - if (!(*fp & F_REAL)) - switch (chat(y, x)) - { - case '|': - case '-': - if (rnd(5 + probinc) != 0) - break; - chat(y, x) = DOOR; - msg(rs,"a secret door"); -foundone: - found = TRUE; - *fp |= F_REAL; - count = FALSE; - running = FALSE; - break; - case FLOOR: - if (rnd(2 + probinc) != 0) - break; - chat(y, x) = TRAP; - if (!terse) - addmsg(rs,"you found "); - if (on(player, ISHALU)) - msg(rs,(char *)tr_name[rnd(NTRAPS)]); - else { - msg(rs,(char *)tr_name[*fp & F_TMASK]); - *fp |= F_SEEN; - } - goto foundone; - break; - case ' ': - if (rnd(3 + probinc) != 0) - break; - chat(y, x) = PASSAGE; - goto foundone; - } - } - if (found) - look(rs,FALSE); -} - -/* - * help: - * Give single character help, or the whole mess if he wants it - */ -void -help(struct rogue_state *rs) -{ - register const struct h_list *strp; - register char helpch; - register int numprint, cnt; - msg(rs,"character you want help for (* for all): "); - helpch = readchar(rs); - mpos = 0; - /* - * If its not a *, print the right help string - * or an error if he typed a funny character. - */ - if (helpch != '*') - { - move(0, 0); - for (strp = helpstr; strp->h_desc != NULL; strp++) - if (strp->h_ch == helpch) - { - lower_msg = TRUE; - msg(rs,"%s%s", unctrl(strp->h_ch), strp->h_desc); - lower_msg = FALSE; - return; - } - msg(rs,"unknown character '%s'", unctrl(helpch)); - return; - } - /* - * Here we print help for everything. - * Then wait before we return to command mode - */ - numprint = 0; - for (strp = helpstr; strp->h_desc != NULL; strp++) - if (strp->h_print) - numprint++; - if (numprint & 01) /* round odd numbers up */ - numprint++; - numprint /= 2; - if (numprint > LINES - 1) - numprint = LINES - 1; - - wclear(hw); - cnt = 0; - for (strp = helpstr; strp->h_desc != NULL; strp++) - if (strp->h_print) - { - wmove(hw, cnt % numprint, cnt >= numprint ? COLS / 2 : 0); - if (strp->h_ch) - waddstr(hw, unctrl(strp->h_ch)); - waddstr(hw, strp->h_desc); - if (++cnt >= numprint * 2) - break; - } - wmove(hw, LINES - 1, 0); - waddstr(hw, "--Press space to continue--"); - wrefresh(hw); - wait_for(rs,' '); - clearok(stdscr, TRUE); -/* - refresh(); -*/ - msg(rs,""); - touchwin(stdscr); - wrefresh(stdscr); -} - -/* - * identify: - * Tell the player what a certain thing is. - */ -void -identify(struct rogue_state *rs) -{ - register int ch; - register const struct h_list *hp; - register char *str; - static const struct h_list ident_list[] = { - {'|', "wall of a room", FALSE}, - {'-', "wall of a room", FALSE}, - {GOLD, "gold", FALSE}, - {STAIRS, "a staircase", FALSE}, - {DOOR, "door", FALSE}, - {FLOOR, "room floor", FALSE}, - {PLAYER, "you", FALSE}, - {PASSAGE, "passage", FALSE}, - {TRAP, "trap", FALSE}, - {POTION, "potion", FALSE}, - {SCROLL, "scroll", FALSE}, - {FOOD, "food", FALSE}, - {WEAPON, "weapon", FALSE}, - {' ', "solid rock", FALSE}, - {ARMOR, "armor", FALSE}, - {AMULET, "the Amulet of Yendor", FALSE}, - {RING, "ring", FALSE}, - {STICK, "wand or staff", FALSE}, - {'\0'} - }; - - msg(rs,"what do you want identified? "); - ch = readchar(rs); - mpos = 0; - if (ch == ESCAPE) - { - msg(rs,""); - return; - } - if (isupper(ch)) - str = monsters[ch-'A'].m_name; - else - { - str = "unknown character"; - for (hp = ident_list; hp->h_ch != '\0'; hp++) - if (hp->h_ch == ch) - { - str = hp->h_desc; - break; - } - } - msg(rs,"'%s': %s", unctrl(ch), str); -} - -/* - * d_level: - * He wants to go down a level - */ -void -d_level(struct rogue_state *rs) -{ - if (levit_check(rs)) - return; - if (chat(hero.y, hero.x) != STAIRS) - msg(rs,"I see no way down"); - else - { - level++; - seenstairs = FALSE; - new_level(rs); - } -} - -/* - * u_level: - * He wants to go up a level - */ -void -u_level(struct rogue_state *rs) -{ - if (levit_check(rs)) - return; - if (chat(hero.y, hero.x) == STAIRS) - if (amulet) - { - level--; - if (level == 0) - total_winner(rs); - new_level(rs); - msg(rs,"you feel a wrenching sensation in your gut"); - } - else - msg(rs,"your way is magically blocked"); - else - msg(rs,"I see no way up"); -} - -/* - * levit_check: - * Check to see if she's levitating, and if she is, print an - * appropriate message. - */ -bool -levit_check(struct rogue_state *rs) -{ - if (!on(player, ISLEVIT)) - return FALSE; - msg(rs,"You can't. You're floating off the ground!"); - return TRUE; -} - -/* - * call: - * Allow a user to call a potion, scroll, or ring something - */ -void -call(struct rogue_state *rs) -{ - register THING *obj; - register const struct obj_info *op = NULL; - register char **guess; const char *elsewise = NULL; - register const bool *know; - - obj = get_item(rs,"call", CALLABLE); - /* - * Make certain that it is somethings that we want to wear - */ - if (obj == NULL) - return; - switch (obj->o_type) - { - case RING: - op = &ring_info[obj->o_which]; - elsewise = r_stones[obj->o_which]; - goto norm; - when POTION: - op = &pot_info[obj->o_which]; - elsewise = p_colors[obj->o_which]; - goto norm; - when SCROLL: - op = &scr_info[obj->o_which]; - elsewise = s_names[obj->o_which]; - goto norm; - when STICK: - op = &ws_info[obj->o_which]; - elsewise = ws_made[obj->o_which]; -norm: - know = &op->oi_know; - guess = (char **)&op->oi_guess; - if (*guess != NULL) - elsewise = *guess; - when FOOD: - msg(rs,"you can't call that anything"); - return; - otherwise: - guess = &obj->o_label; - know = NULL; - elsewise = obj->o_label; - } - if (know != NULL && *know) - { - msg(rs,"that has already been identified"); - return; - } - if (elsewise != NULL && elsewise == *guess) - { - if (!terse) - addmsg(rs,"Was "); - msg(rs,"called \"%s\"", elsewise); - } - if (terse) - msg(rs,"call it: "); - else - msg(rs,"what do you want to call it? "); - - if (elsewise == NULL) - strcpy(prbuf, ""); - else - strcpy(prbuf, elsewise); - if (get_str(rs,prbuf, stdscr) == NORM) - { - if (*guess != NULL) - free(*guess); - *guess = (char *)malloc((unsigned int) strlen(prbuf) + 1); - strcpy(*guess, prbuf); - } -} - -/* - * current: - * Print the current weapon/armor - */ -void -current(struct rogue_state *rs,THING *cur, char *how, char *where) -{ - after = FALSE; - if (cur != NULL) - { - if (!terse) - addmsg(rs,"you are %s (", how); - inv_describe = FALSE; - addmsg(rs,"%c) %s", cur->o_packch, inv_name(cur, TRUE)); - inv_describe = TRUE; - if (where) - addmsg(rs," %s", where); - endmsg(rs); - } - else - { - if (!terse) - addmsg(rs,"you are "); - addmsg(rs,"%s nothing", how); - if (where) - addmsg(rs," %s", where); - endmsg(rs); - } -} diff --git a/src/cc/rogue/config.guess b/src/cc/rogue/config.guess deleted file mode 100755 index 396482d6c..000000000 --- a/src/cc/rogue/config.guess +++ /dev/null @@ -1,1500 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, -# Inc. - -timestamp='2006-07-02' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner . -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} - exit ;; - *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit ;; - *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} - exit ;; - macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} - exit ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; - *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; - *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - i86pc:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`$dummy $dummyarg` && - { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} - exit ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` - then - echo "$SYSTEM_NAME" - else - echo rs6000-ibm-aix3.2.5 - fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit ;; - *:AIX:*:[45]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - eval $set_cc_for_build - - # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating - # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler - # generating 64-bit code. GNU and HP use different nomenclature: - # - # $ CC_FOR_BUILD=cc ./config.guess - # => hppa2.0w-hp-hpux11.23 - # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess - # => hppa64-hp-hpux11.23 - - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep __LP64__ >/dev/null - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - esac - exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; - i*:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit ;; - x86:Interix*:[3456]*) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - EM64T:Interix*:[3456]*) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; - arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - cris:Linux:*:*) - echo cris-axis-linux-gnu - exit ;; - crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu - exit ;; - frv:Linux:*:*) - echo frv-unknown-linux-gnu - exit ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - mips:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips - #undef mipsel - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips64 - #undef mips64el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mips64el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips64 - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - or32:Linux:*:*) - echo or32-unknown-linux-gnu - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu - exit ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit ;; - coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit ;; - "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^LIBC/{ - s: ::g - p - }'`" - test x"${LIBC}" != x && { - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" - exit - } - test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } - ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit ;; - i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit ;; - i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; - i*86:VOS:*:*) - # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos - exit ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - unknown) UNAME_PROCESSOR=powerpc ;; - esac - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NSE-?:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit ;; - *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; - esac ;; - *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; - i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' - exit ;; - i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos - exit ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/src/cc/rogue/config.h.in b/src/cc/rogue/config.h.in deleted file mode 100644 index 54f9b7cba..000000000 --- a/src/cc/rogue/config.h.in +++ /dev/null @@ -1,269 +0,0 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define if scorefile is top scores, not top players */ -#undef ALLSCORES - -/* Define if checktime feature should be enabled */ -#undef CHECKTIME - -/* Define to group owner of setgid executable */ -#undef GROUPOWNER - -/* Define to 1 if you have the `alarm' function. */ -#undef HAVE_ALARM - -/* Define to 1 if you have the header file. */ -#undef HAVE_ARPA_INET_H - -/* Define to 1 if libcurses is requested */ -#undef HAVE_CURSES_H - -/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ -#undef HAVE_DOPRNT - -/* Define to 1 if you have the `erasechar' function. */ -#undef HAVE_ERASECHAR - -/* Define if ncurses has ESCDELAY variable */ -#undef HAVE_ESCDELAY - -/* Define to 1 if you have the header file. */ -#undef HAVE_FCNTL_H - -/* Define to 1 if you have the `fork' function. */ -#undef HAVE_FORK - -/* Define to 1 if you have the `getgid' function. */ -#undef HAVE_GETGID - -/* Define to 1 if you have the `getloadavg' function. */ -#undef HAVE_GETLOADAVG - -/* Define to 1 if you have the `getpass' function. */ -#undef HAVE_GETPASS - -/* Define to 1 if you have the `getpwuid' function. */ -#undef HAVE_GETPWUID - -/* Define to 1 if you have the `getuid' function. */ -#undef HAVE_GETUID - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `killchar' function. */ -#undef HAVE_KILLCHAR - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIMITS_H - -/* Define to 1 if you have the `loadav' function. */ -#undef HAVE_LOADAV - -/* Define to 1 if `lstat' has the bug that it succeeds when given the - zero-length file name argument. */ -#undef HAVE_LSTAT_EMPTY_STRING_BUG - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `memset' function. */ -#undef HAVE_MEMSET - -/* Define to 1 if libncurses is requested */ -#undef HAVE_NCURSES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NCURSES_TERM_H - -/* Define to 1 if you have the `nlist' function. */ -#undef HAVE_NLIST - -/* Define to 1 if you have the header file. */ -#undef HAVE_NLIST_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_PROCESS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_PWD_H - -/* Define to 1 if you have the `setenv' function. */ -#undef HAVE_SETENV - -/* Define to 1 if you have the `setgid' function. */ -#undef HAVE_SETGID - -/* Define to 1 if you have the `setregid' function. */ -#undef HAVE_SETREGID - -/* Define to 1 if you have the `setresgid' function. */ -#undef HAVE_SETRESGID - -/* Define to 1 if you have the `setresuid' function. */ -#undef HAVE_SETRESUID - -/* Define to 1 if you have the `setreuid' function. */ -#undef HAVE_SETREUID - -/* Define to 1 if you have the `setuid' function. */ -#undef HAVE_SETUID - -/* Define to 1 if you have the `spawnl' function. */ -#undef HAVE_SPAWNL - -/* Define to 1 if `stat' has the bug that it succeeds when given the - zero-length file name argument. */ -#undef HAVE_STAT_EMPTY_STRING_BUG - -/* Define to 1 if stdbool.h conforms to C99. */ -#undef HAVE_STDBOOL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the `strchr' function. */ -#undef HAVE_STRCHR - -/* Define to 1 if you have the `strerror' function. */ -#undef HAVE_STRERROR - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_IOCTL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_UTSNAME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_TERMIOS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_TERM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UTMP_H - -/* Define to 1 if you have the `vfork' function. */ -#undef HAVE_VFORK - -/* Define to 1 if you have the header file. */ -#undef HAVE_VFORK_H - -/* Define to 1 if you have the `vprintf' function. */ -#undef HAVE_VPRINTF - -/* Define to 1 if `fork' works. */ -#undef HAVE_WORKING_FORK - -/* Define to 1 if `vfork' works. */ -#undef HAVE_WORKING_VFORK - -/* Define to 1 if the system has the type `_Bool'. */ -#undef HAVE__BOOL - -/* Define to 1 if you have the `_spawnl' function. */ -#undef HAVE__SPAWNL - -/* define if we should use program's load average function instead of system - */ -#undef LOADAV - -/* Define to file to use for scoreboard lockfile */ -#undef LOCKFILE - -/* Define to 1 if `lstat' dereferences a symlink specified with a trailing - slash. */ -#undef LSTAT_FOLLOWS_SLASHED_SYMLINK - -/* Define to include wizard mode */ -#undef MASTER - -/* Define if maxusers feature should be enabled */ -#undef MAXLOAD - -/* Define if maxusers feature should be enabled */ -#undef MAXUSERS - -/* kernel file to pass to nlist() when reading load average (unlikely to work) - */ -#undef NAMELIST - -/* word for the number of scores to store in scoreboard */ -#undef NUMNAME - -/* number of scores to store in scoreboard */ -#undef NUMSCORES - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define crypt(3) wizard mode password */ -#undef PASSWD - -/* Define as the return type of signal handlers (`int' or `void'). */ -#undef RETSIGTYPE - -/* Define to file to use for scoreboard */ -#undef SCOREFILE - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define to 1 if your declares `struct tm'. */ -#undef TM_IN_SYS_TIME - -/* define if we should use program's user counting function instead of - system's */ -#undef UCOUNT - -/* utmp like file to pass to ucount() when counting online users (unlikely to - work) */ -#undef UTMP - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define to `int' if doesn't define. */ -#undef gid_t - -/* Define to `int' if does not define. */ -#undef pid_t - -/* Define to `unsigned int' if does not define. */ -#undef size_t - -/* Define to `int' if doesn't define. */ -#undef uid_t - -/* Define as `fork' if `vfork' does not work. */ -#undef vfork diff --git a/src/cc/rogue/config.sub b/src/cc/rogue/config.sub deleted file mode 100755 index 387c18d1a..000000000 --- a/src/cc/rogue/config.sub +++ /dev/null @@ -1,1608 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, -# Inc. - -timestamp='2006-07-02' - -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ - uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray) - os= - basic_machine=$1 - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ - | bfin \ - | c4x | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64vr | mips64vrel \ - | mips64orion | mips64orionel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | mt \ - | msp430 \ - | nios | nios2 \ - | ns16k | ns32k \ - | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ - | pyramid \ - | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu | strongarm \ - | tahoe | thumb | tic4x | tic80 | tron \ - | v850 | v850e \ - | we32k \ - | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ - | z8k) - basic_machine=$basic_machine-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12) - # Motorola 68HC11/12. - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nios-* | nios2-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ - | pyramid-* \ - | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tron-* \ - | v850-* | v850e-* | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ - | xstormy16-* | xtensa-* \ - | ymp-* \ - | z8k-*) - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16c) - basic_machine=cr16c-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc) basic_machine=powerpc-unknown - ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -kaos*) - os=-kaos - ;; - -zvmoe) - os=-zvmoe - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - spu-*) - os=-elf - ;; - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-haiku) - os=-haiku - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/src/cc/rogue/configure b/src/cc/rogue/configure deleted file mode 100755 index a7b95e78d..000000000 --- a/src/cc/rogue/configure +++ /dev/null @@ -1,7511 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for Rogue 5.4.4. -# -# Report bugs to . -# -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - - - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -as_nl=' -' -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } -fi - -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# CDPATH. -$as_unset CDPATH - - -if test "x$CONFIG_SHELL" = x; then - if (eval ":") 2>/dev/null; then - as_have_required=yes -else - as_have_required=no -fi - - if test $as_have_required = yes && (eval ": -(as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test \$exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=\$LINENO - as_lineno_2=\$LINENO - test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && - test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } -") 2> /dev/null; then - : -else - as_candidate_shells= - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - case $as_dir in - /*) - for as_base in sh bash ksh sh5; do - as_candidate_shells="$as_candidate_shells $as_dir/$as_base" - done;; - esac -done -IFS=$as_save_IFS - - - for as_shell in $as_candidate_shells $SHELL; do - # Try only shells that exist, to save several forks. - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { ("$as_shell") 2> /dev/null <<\_ASEOF -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - -: -_ASEOF -}; then - CONFIG_SHELL=$as_shell - as_have_required=yes - if { "$as_shell" 2> /dev/null <<\_ASEOF -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - -: -(as_func_return () { - (exit $1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = "$1" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test $exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } - -_ASEOF -}; then - break -fi - -fi - - done - - if test "x$CONFIG_SHELL" != x; then - for as_var in BASH_ENV ENV - do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - done - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} -fi - - - if test $as_have_required = no; then - echo This script requires a shell more modern than all the - echo shells that I found on your system. Please install a - echo modern shell, or manually run the script under such a - echo shell if you do have one. - { (exit 1); exit 1; } -fi - - -fi - -fi - - - -(eval "as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test \$exitcode = 0") || { - echo No shell found that supports shell functions. - echo Please tell autoconf@gnu.org about your system, - echo including any error possibly output before this - echo message -} - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in --n*) - case `echo 'x\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; - esac;; -*) - ECHO_N='-n';; -esac - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir -fi -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - - -exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Identity of this package. -PACKAGE_NAME='Rogue' -PACKAGE_TARNAME='rogue' -PACKAGE_VERSION='5.4.4' -PACKAGE_STRING='Rogue 5.4.4' -PACKAGE_BUGREPORT='yendor@rogueforge.net' - -ac_unique_file="armor.c" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS -# include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - -ac_subst_vars='SHELL -PATH_SEPARATOR -PACKAGE_NAME -PACKAGE_TARNAME -PACKAGE_VERSION -PACKAGE_STRING -PACKAGE_BUGREPORT -exec_prefix -prefix -program_transform_name -bindir -sbindir -libexecdir -datarootdir -datadir -sysconfdir -sharedstatedir -localstatedir -includedir -oldincludedir -docdir -infodir -htmldir -dvidir -pdfdir -psdir -libdir -localedir -mandir -DEFS -ECHO_C -ECHO_N -ECHO_T -LIBS -build_alias -host_alias -target_alias -build -build_cpu -build_vendor -build_os -host -host_cpu -host_vendor -host_os -target -target_cpu -target_vendor -target_os -CC -CFLAGS -LDFLAGS -CPPFLAGS -ac_ct_CC -EXEEXT -OBJEXT -CPP -GREP -EGREP -LIBOBJS -NROFF -GROFF -COLCRT -TBL -SED -PROGRAM -GROUPOWNER -SCOREFILE -LOCKFILE -TARGET -LTLIBOBJS' -ac_subst_files='' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CPP' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` - eval enable_$ac_feature=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` - eval enable_$ac_feature=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/[-.]/_/g'` - eval with_$ac_package=\$ac_optarg ;; - - -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/[-.]/_/g'` - eval with_$ac_package=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -# Be sure to have absolute directory names. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; } -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - { echo "$as_me: error: Working directory cannot be determined" >&2 - { (exit 1); exit 1; }; } -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - { echo "$as_me: error: pwd does not report name of working directory" >&2 - { (exit 1); exit 1; }; } - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$0" || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X"$0" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 - { (exit 1); exit 1; }; } - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures Rogue 5.4.4 to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/rogue] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] - --target=TARGET configure for building compilers for TARGET [HOST] -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of Rogue 5.4.4:";; - esac - cat <<\_ACEOF - -Optional Features: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-setgid=NAME install executable as setgid with group ownership of - NAME [default=no]] - --enable-scorefile=SCOREFILE - enable scoreboard with given filename - --enable-lockfile=LOCKFILE - enable scoreboard lockfile with given filename - --enable-wizardmode enable availability of wizard mode [default=no] - --enable-allscores enable scoreboard to show top scores, not just top - players [default=yes] - --enable-checktime enable checktime [default=no] - --enable-maxload enable maxload [default=no] - --enable-maxusers enable maxuser [default=no] - --enable-numscores number of scores to store in scoreboard [default=10] - --enable-numname word for number of scores to store in scoreboard - [default=Ten] - --enable-loadav=NAMELIST - use program's load average function (unlikely to - work) [default=no] - --enable-ucount=UTMPFILE - use program's own function to count users (unlikely - to work) [default=no] - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-ncurses Force the use of ncurses over curses - --with-program-name=NAME - alternate executable name - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CPP C preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to . -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -Rogue configure 5.4.4 -generated by GNU Autoconf 2.61 - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by Rogue $as_me 5.4.4, which was -generated by GNU Autoconf 2.61. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; - 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - ac_configure_args="$ac_configure_args '$ac_arg'" - ;; - esac - done -done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - cat <<\_ASBOX -## ---------------- ## -## Cache variables. ## -## ---------------- ## -_ASBOX - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 -echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - *) $as_unset $ac_var ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------------- ## -## File substitutions. ## -## ------------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. -if test -n "$CONFIG_SITE"; then - set x "$CONFIG_SITE" -elif test "x$prefix" != xNONE; then - set x "$prefix/share/config.site" "$prefix/etc/config.site" -else - set x "$ac_default_prefix/share/config.site" \ - "$ac_default_prefix/etc/config.site" -fi -shift -for ac_site_file -do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } -fi - - - - - - - - - - - - - - - - - - - - - - - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -ac_config_headers="$ac_config_headers config.h" - -ac_config_files="$ac_config_files Makefile rogue.6 rogue.cat rogue.doc rogue.html rogue.me" - -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 -echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} - { (exit 1); exit 1; }; } -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 -echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} - { (exit 1); exit 1; }; } - -{ echo "$as_me:$LINENO: checking build system type" >&5 -echo $ECHO_N "checking build system type... $ECHO_C" >&6; } -if test "${ac_cv_build+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 -echo "$as_me: error: cannot guess build type; you must specify one" >&2;} - { (exit 1); exit 1; }; } -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 -echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5 -echo "${ECHO_T}$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 -echo "$as_me: error: invalid value of canonical build" >&2;} - { (exit 1); exit 1; }; };; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - - -{ echo "$as_me:$LINENO: checking host system type" >&5 -echo $ECHO_N "checking host system type... $ECHO_C" >&6; } -if test "${ac_cv_host+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 -echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} - { (exit 1); exit 1; }; } -fi - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5 -echo "${ECHO_T}$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 -echo "$as_me: error: invalid value of canonical host" >&2;} - { (exit 1); exit 1; }; };; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - -{ echo "$as_me:$LINENO: checking target system type" >&5 -echo $ECHO_N "checking target system type... $ECHO_C" >&6; } -if test "${ac_cv_target+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "x$target_alias" = x; then - ac_cv_target=$ac_cv_host -else - ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || - { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5 -echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;} - { (exit 1); exit 1; }; } -fi - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_target" >&5 -echo "${ECHO_T}$ac_cv_target" >&6; } -case $ac_cv_target in -*-*-*) ;; -*) { { echo "$as_me:$LINENO: error: invalid value of canonical target" >&5 -echo "$as_me: error: invalid value of canonical target" >&2;} - { (exit 1); exit 1; }; };; -esac -target=$ac_cv_target -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_target -shift -target_cpu=$1 -target_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -target_os=$* -IFS=$ac_save_IFS -case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac - - -# The aliases save the names the user supplied, while $host etc. -# will get canonicalized. -test -n "$target_alias" && - test "$program_prefix$program_suffix$program_transform_name" = \ - NONENONEs,x,x, && - program_prefix=${target_alias}- - -# Checks for programs. -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - -# Provide some information about the compiler. -echo "$as_me:$LINENO: checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (ac_try="$ac_compiler --version >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler --version >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -v >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -v >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -V >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -V >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -# -# List of possible output files, starting from the most likely. -# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) -# only as a last resort. b.out is created by i960 compilers. -ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' -# -# The IRIX 6 linker writes into existing files which may not be -# executable, retaining their permissions. Remove them first so a -# subsequent execution test works. -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { (ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi - -{ echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6; } -if test -z "$ac_file"; then - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } -fi - -ac_exeext=$ac_cv_exeext - -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -{ echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } - -rm -f a.out a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } -{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6; } - -{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest$ac_cv_exeext -{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_compiler_gnu=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - CFLAGS="" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 -echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_c89=$ac_arg -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6; } ;; - xno) - { echo "$as_me:$LINENO: result: unsupported" >&5 -echo "${ECHO_T}unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; -esac - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -# Checks for libraries. - -# Checks for header files. - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi - -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi - -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 -echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Extract the first word of "grep ggrep" to use in msg output -if test -z "$GREP"; then -set dummy grep ggrep; ac_prog_name=$2 -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_path_GREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue - # Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - - $ac_path_GREP_found && break 3 - done -done - -done -IFS=$as_save_IFS - - -fi - -GREP="$ac_cv_path_GREP" -if test -z "$GREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } -fi - -else - ac_cv_path_GREP=$GREP -fi - - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 -echo "${ECHO_T}$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - # Extract the first word of "egrep" to use in msg output -if test -z "$EGREP"; then -set dummy egrep; ac_prog_name=$2 -if test "${ac_cv_path_EGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_path_EGREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue - # Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - - $ac_path_EGREP_found && break 3 - done -done - -done -IFS=$as_save_IFS - - -fi - -EGREP="$ac_cv_path_EGREP" -if test -z "$EGREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } -fi - -else - ac_cv_path_EGREP=$EGREP -fi - - - fi -fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 -echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_header_stdc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_stdc=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - -fi -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_Header=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - - - - - - - - - - - - - - -for ac_header in arpa/inet.h sys/utsname.h pwd.h fcntl.h limits.h nlist.h stdlib.h string.h sys/ioctl.h termios.h unistd.h utmp.h term.h ncurses/term.h process.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ------------------------------------ ## -## Report this to yendor@rogueforge.net ## -## ------------------------------------ ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -# Checks for typedefs, structures, and compiler characteristics. -{ echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5 -echo $ECHO_N "checking for stdbool.h that conforms to C99... $ECHO_C" >&6; } -if test "${ac_cv_header_stdbool_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include -#ifndef bool - "error: bool is not defined" -#endif -#ifndef false - "error: false is not defined" -#endif -#if false - "error: false is not 0" -#endif -#ifndef true - "error: true is not defined" -#endif -#if true != 1 - "error: true is not 1" -#endif -#ifndef __bool_true_false_are_defined - "error: __bool_true_false_are_defined is not defined" -#endif - - struct s { _Bool s: 1; _Bool t; } s; - - char a[true == 1 ? 1 : -1]; - char b[false == 0 ? 1 : -1]; - char c[__bool_true_false_are_defined == 1 ? 1 : -1]; - char d[(bool) 0.5 == true ? 1 : -1]; - bool e = &s; - char f[(_Bool) 0.0 == false ? 1 : -1]; - char g[true]; - char h[sizeof (_Bool)]; - char i[sizeof s.t]; - enum { j = false, k = true, l = false * true, m = true * 256 }; - _Bool n[m]; - char o[sizeof n == m * sizeof n[0] ? 1 : -1]; - char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; -# if defined __xlc__ || defined __GNUC__ - /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 - reported by James Lemley on 2005-10-05; see - http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html - This test is not quite right, since xlc is allowed to - reject this program, as the initializer for xlcbug is - not one of the forms that C requires support for. - However, doing the test right would require a runtime - test, and that would make cross-compilation harder. - Let us hope that IBM fixes the xlc bug, and also adds - support for this kind of constant expression. In the - meantime, this test will reject xlc, which is OK, since - our stdbool.h substitute should suffice. We also test - this with GCC, where it should work, to detect more - quickly whether someone messes up the test in the - future. */ - char digs[] = "0123456789"; - int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); -# endif - /* Catch a bug in an HP-UX C compiler. See - http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html - http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html - */ - _Bool q = true; - _Bool *pq = &q; - -int -main () -{ - - *pq |= q; - *pq |= ! q; - /* Refer to every declared value, to avoid compiler optimizations. */ - return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l - + !m + !n + !o + !p + !q + !pq); - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_header_stdbool_h=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_stdbool_h=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5 -echo "${ECHO_T}$ac_cv_header_stdbool_h" >&6; } -{ echo "$as_me:$LINENO: checking for _Bool" >&5 -echo $ECHO_N "checking for _Bool... $ECHO_C" >&6; } -if test "${ac_cv_type__Bool+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -typedef _Bool ac__type_new_; -int -main () -{ -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_type__Bool=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type__Bool=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5 -echo "${ECHO_T}$ac_cv_type__Bool" >&6; } -if test $ac_cv_type__Bool = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE__BOOL 1 -_ACEOF - - -fi - -if test $ac_cv_header_stdbool_h = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_STDBOOL_H 1 -_ACEOF - -fi - -{ echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 -echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; } -if test "${ac_cv_c_const+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -/* FIXME: Include the comments suggested by Paul. */ -#ifndef __cplusplus - /* Ultrix mips cc rejects this. */ - typedef int charset[2]; - const charset cs; - /* SunOS 4.1.1 cc rejects this. */ - char const *const *pcpcc; - char **ppc; - /* NEC SVR4.0.2 mips cc rejects this. */ - struct point {int x, y;}; - static struct point const zero = {0,0}; - /* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in - an arm of an if-expression whose if-part is not a constant - expression */ - const char *g = "string"; - pcpcc = &g + (g ? g-g : 0); - /* HPUX 7.0 cc rejects these. */ - ++pcpcc; - ppc = (char**) pcpcc; - pcpcc = (char const *const *) ppc; - { /* SCO 3.2v4 cc rejects this. */ - char *t; - char const *s = 0 ? (char *) 0 : (char const *) 0; - - *t++ = 0; - if (s) return 0; - } - { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; - } - { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; - } - { /* AIX XL C 1.02.0.0 rejects this saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; - } - { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; - if (!foo) return 0; - } - return !cs[0] && !zero.x; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_c_const=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_c_const=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 -echo "${ECHO_T}$ac_cv_c_const" >&6; } -if test $ac_cv_c_const = no; then - -cat >>confdefs.h <<\_ACEOF -#define const -_ACEOF - -fi - -{ echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5 -echo $ECHO_N "checking for uid_t in sys/types.h... $ECHO_C" >&6; } -if test "${ac_cv_type_uid_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "uid_t" >/dev/null 2>&1; then - ac_cv_type_uid_t=yes -else - ac_cv_type_uid_t=no -fi -rm -f conftest* - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5 -echo "${ECHO_T}$ac_cv_type_uid_t" >&6; } -if test $ac_cv_type_uid_t = no; then - -cat >>confdefs.h <<\_ACEOF -#define uid_t int -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define gid_t int -_ACEOF - -fi - -{ echo "$as_me:$LINENO: checking for size_t" >&5 -echo $ECHO_N "checking for size_t... $ECHO_C" >&6; } -if test "${ac_cv_type_size_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -typedef size_t ac__type_new_; -int -main () -{ -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_type_size_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_size_t=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 -echo "${ECHO_T}$ac_cv_type_size_t" >&6; } -if test $ac_cv_type_size_t = yes; then - : -else - -cat >>confdefs.h <<_ACEOF -#define size_t unsigned int -_ACEOF - -fi - -{ echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 -echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6; } -if test "${ac_cv_struct_tm+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include - -int -main () -{ -struct tm tm; - int *p = &tm.tm_sec; - return !p; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_struct_tm=time.h -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_struct_tm=sys/time.h -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 -echo "${ECHO_T}$ac_cv_struct_tm" >&6; } -if test $ac_cv_struct_tm = sys/time.h; then - -cat >>confdefs.h <<\_ACEOF -#define TM_IN_SYS_TIME 1 -_ACEOF - -fi - - -# Check whether --with-ncurses was given. -if test "${with_ncurses+set}" = set; then - withval=$with_ncurses; -fi - - mp_save_LIBS="$LIBS" - CURSES_LIB="" - if test "$with_ncurses" != yes - then - { echo "$as_me:$LINENO: checking for working curses" >&5 -echo $ECHO_N "checking for working curses... $ECHO_C" >&6; } -if test "${mp_cv_curses+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - LIBS="$LIBS -lcurses" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int -main () -{ -chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - mp_cv_curses=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - mp_cv_curses=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $mp_cv_curses" >&5 -echo "${ECHO_T}$mp_cv_curses" >&6; } - if test "$mp_cv_curses" = yes - then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_CURSES_H 1 -_ACEOF - - #AC_DEFINE(HAVE_CURSES_H) - CURSES_LIB="-lcurses" - fi - fi - if test ! "$CURSES_LIB" - then - { echo "$as_me:$LINENO: checking for working ncurses" >&5 -echo $ECHO_N "checking for working ncurses... $ECHO_C" >&6; } -if test "${mp_cv_ncurses+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - LIBS="$mp_save_LIBS -lncurses" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int -main () -{ -chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - mp_cv_ncurses=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - mp_cv_ncurses=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $mp_cv_ncurses" >&5 -echo "${ECHO_T}$mp_cv_ncurses" >&6; } - if test "$mp_cv_ncurses" = yes - then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_NCURSES_H 1 -_ACEOF - - CURSES_LIB="-lncurses" - fi - fi - if test ! "$CURSES_LIB" - then - { echo "$as_me:$LINENO: checking for working pdcurses" >&5 -echo $ECHO_N "checking for working pdcurses... $ECHO_C" >&6; } -if test "${mp_cv_pdcurses+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - LIBS="$mp_save_LIBS -lpdcurses" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int -main () -{ -chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - mp_cv_pdcurses=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - mp_cv_pdcurses=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $mp_cv_pdcurses" >&5 -echo "${ECHO_T}$mp_cv_pdcurses" >&6; } - if test "$mp_cv_pdcurses" = yes - then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_CURSES_H 1 -_ACEOF - - CURSES_LIB="-lpdcurses" - fi - fi - if test ! "$CURSES_LIB" - then - { echo "$as_me:$LINENO: checking for working pdcur" >&5 -echo $ECHO_N "checking for working pdcur... $ECHO_C" >&6; } -if test "${mp_cv_pdcur+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - LIBS="$mp_save_LIBS -lpdcur" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int -main () -{ -chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - mp_cv_pdcur=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - mp_cv_pdcur=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $mp_cv_pdcur" >&5 -echo "${ECHO_T}$mp_cv_pdcur" >&6; } - if test "$mp_cv_pdcur" = yes - then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_CURSES_H 1 -_ACEOF - - CURSES_LIB="-lpdcur" - fi - fi - if test ! "$CURSES_LIB" - then - { echo "$as_me:$LINENO: checking for working peer pdcurses" >&5 -echo $ECHO_N "checking for working peer pdcurses... $ECHO_C" >&6; } -if test "${mp_cv_lpdcurses+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - LIBS="$mp_save_LIBS ../pdcurses/pdcurses.a" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include "../pdcurses/curses.h" -int -main () -{ -chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - mp_cv_lpdcurses=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - mp_cv_lpdcurses=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $mp_cv_lpdcurses" >&5 -echo "${ECHO_T}$mp_cv_lpdcurses" >&6; } - if test "$mp_cv_lpdcurses" = yes - then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_CURSES_H 1 -_ACEOF - - CURSES_LIB="../pdcurses/pdcurses.a" - - if test "x$CPPFLAGS" = "x"; then - test "x$silent" != "xyes" && echo " setting CPPFLAGS to \""-I../pdcurses"\"" - CPPFLAGS=""-I../pdcurses"" - else - apr_addto_bugger=""-I../pdcurses"" - for i in $apr_addto_bugger; do - apr_addto_duplicate="0" - for j in $CPPFLAGS; do - if test "x$i" = "x$j"; then - apr_addto_duplicate="1" - break - fi - done - if test $apr_addto_duplicate = "0"; then - test "x$silent" != "xyes" && echo " adding \"$i\" to CPPFLAGS" - CPPFLAGS="$CPPFLAGS $i" - fi - done - fi - - fi - fi - { echo "$as_me:$LINENO: checking for ESCDELAY variable" >&5 -echo $ECHO_N "checking for ESCDELAY variable... $ECHO_C" >&6; } -if test "${mc_cv_ncurses_escdelay+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - extern int ESCDELAY; - ESCDELAY = 0; - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - mc_cv_ncurses_escdelay=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - mc_cv_ncurses_escdelay=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext - -fi -{ echo "$as_me:$LINENO: result: $mc_cv_ncurses_escdelay" >&5 -echo "${ECHO_T}$mc_cv_ncurses_escdelay" >&6; } - if test "$mc_cv_ncurses_escdelay" = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_ESCDELAY 1 -_ACEOF - - fi - if test ! "$CURSES_LIB" ; then - LIBS="$mp_save_LIBS" - fi - -# Checks for library functions. -{ echo "$as_me:$LINENO: checking for pid_t" >&5 -echo $ECHO_N "checking for pid_t... $ECHO_C" >&6; } -if test "${ac_cv_type_pid_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -typedef pid_t ac__type_new_; -int -main () -{ -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_type_pid_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_pid_t=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 -echo "${ECHO_T}$ac_cv_type_pid_t" >&6; } -if test $ac_cv_type_pid_t = yes; then - : -else - -cat >>confdefs.h <<_ACEOF -#define pid_t int -_ACEOF - -fi - - -for ac_header in vfork.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ------------------------------------ ## -## Report this to yendor@rogueforge.net ## -## ------------------------------------ ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - -for ac_func in fork vfork -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif - -int -main () -{ -return $ac_func (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_var=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_var'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - -if test "x$ac_cv_func_fork" = xyes; then - { echo "$as_me:$LINENO: checking for working fork" >&5 -echo $ECHO_N "checking for working fork... $ECHO_C" >&6; } -if test "${ac_cv_func_fork_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_fork_works=cross -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ - - /* By Ruediger Kuhlmann. */ - return fork () < 0; - - ; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_fork_works=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_func_fork_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_fork_works" >&5 -echo "${ECHO_T}$ac_cv_func_fork_works" >&6; } - -else - ac_cv_func_fork_works=$ac_cv_func_fork -fi -if test "x$ac_cv_func_fork_works" = xcross; then - case $host in - *-*-amigaos* | *-*-msdosdjgpp*) - # Override, as these systems have only a dummy fork() stub - ac_cv_func_fork_works=no - ;; - *) - ac_cv_func_fork_works=yes - ;; - esac - { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 -echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} -fi -ac_cv_func_vfork_works=$ac_cv_func_vfork -if test "x$ac_cv_func_vfork" = xyes; then - { echo "$as_me:$LINENO: checking for working vfork" >&5 -echo $ECHO_N "checking for working vfork... $ECHO_C" >&6; } -if test "${ac_cv_func_vfork_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_vfork_works=cross -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Thanks to Paul Eggert for this test. */ -$ac_includes_default -#include -#ifdef HAVE_VFORK_H -# include -#endif -/* On some sparc systems, changes by the child to local and incoming - argument registers are propagated back to the parent. The compiler - is told about this with #include , but some compilers - (e.g. gcc -O) don't grok . Test for this by using a - static variable whose address is put into a register that is - clobbered by the vfork. */ -static void -#ifdef __cplusplus -sparc_address_test (int arg) -# else -sparc_address_test (arg) int arg; -#endif -{ - static pid_t child; - if (!child) { - child = vfork (); - if (child < 0) { - perror ("vfork"); - _exit(2); - } - if (!child) { - arg = getpid(); - write(-1, "", 0); - _exit (arg); - } - } -} - -int -main () -{ - pid_t parent = getpid (); - pid_t child; - - sparc_address_test (0); - - child = vfork (); - - if (child == 0) { - /* Here is another test for sparc vfork register problems. This - test uses lots of local variables, at least as many local - variables as main has allocated so far including compiler - temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris - 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should - reuse the register of parent for one of the local variables, - since it will think that parent can't possibly be used any more - in this routine. Assigning to the local variable will thus - munge parent in the parent process. */ - pid_t - p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), - p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); - /* Convince the compiler that p..p7 are live; otherwise, it might - use the same hardware register for all 8 local variables. */ - if (p != p1 || p != p2 || p != p3 || p != p4 - || p != p5 || p != p6 || p != p7) - _exit(1); - - /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent - from child file descriptors. If the child closes a descriptor - before it execs or exits, this munges the parent's descriptor - as well. Test for this by closing stdout in the child. */ - _exit(close(fileno(stdout)) != 0); - } else { - int status; - struct stat st; - - while (wait(&status) != child) - ; - return ( - /* Was there some problem with vforking? */ - child < 0 - - /* Did the child fail? (This shouldn't happen.) */ - || status - - /* Did the vfork/compiler bug occur? */ - || parent != getpid() - - /* Did the file descriptor bug occur? */ - || fstat(fileno(stdout), &st) != 0 - ); - } -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_vfork_works=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_func_vfork_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_vfork_works" >&5 -echo "${ECHO_T}$ac_cv_func_vfork_works" >&6; } - -fi; -if test "x$ac_cv_func_fork_works" = xcross; then - ac_cv_func_vfork_works=$ac_cv_func_vfork - { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 -echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} -fi - -if test "x$ac_cv_func_vfork_works" = xyes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_WORKING_VFORK 1 -_ACEOF - -else - -cat >>confdefs.h <<\_ACEOF -#define vfork fork -_ACEOF - -fi -if test "x$ac_cv_func_fork_works" = xyes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_WORKING_FORK 1 -_ACEOF - -fi - -if test $ac_cv_c_compiler_gnu = yes; then - { echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 -echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6; } -if test "${ac_cv_prog_gcc_traditional+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_pattern="Autoconf.*'x'" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -Autoconf TIOCGETP -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "$ac_pattern" >/dev/null 2>&1; then - ac_cv_prog_gcc_traditional=yes -else - ac_cv_prog_gcc_traditional=no -fi -rm -f conftest* - - - if test $ac_cv_prog_gcc_traditional = no; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -Autoconf TCGETA -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "$ac_pattern" >/dev/null 2>&1; then - ac_cv_prog_gcc_traditional=yes -fi -rm -f conftest* - - fi -fi -{ echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 -echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6; } - if test $ac_cv_prog_gcc_traditional = yes; then - CC="$CC -traditional" - fi -fi - -{ echo "$as_me:$LINENO: checking whether lstat dereferences a symlink specified with a trailing slash" >&5 -echo $ECHO_N "checking whether lstat dereferences a symlink specified with a trailing slash... $ECHO_C" >&6; } -if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - rm -f conftest.sym conftest.file -echo >conftest.file -if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then - if test "$cross_compiling" = yes; then - ac_cv_func_lstat_dereferences_slashed_symlink=no -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -struct stat sbuf; - /* Linux will dereference the symlink and fail. - That is better in the sense that it means we will not - have to compile and use the lstat wrapper. */ - return lstat ("conftest.sym/", &sbuf) == 0; - ; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_lstat_dereferences_slashed_symlink=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_func_lstat_dereferences_slashed_symlink=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - -else - # If the `ln -s' command failed, then we probably don't even - # have an lstat function. - ac_cv_func_lstat_dereferences_slashed_symlink=no -fi -rm -f conftest.sym conftest.file - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 -echo "${ECHO_T}$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; } - -test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && - -cat >>confdefs.h <<_ACEOF -#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 -_ACEOF - - -if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then - case " $LIBOBJS " in - *" lstat.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS lstat.$ac_objext" - ;; -esac - -fi - -{ echo "$as_me:$LINENO: checking whether lstat accepts an empty string" >&5 -echo $ECHO_N "checking whether lstat accepts an empty string... $ECHO_C" >&6; } -if test "${ac_cv_func_lstat_empty_string_bug+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_lstat_empty_string_bug=yes -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -struct stat sbuf; - return lstat ("", &sbuf) == 0; - ; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_lstat_empty_string_bug=no -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_func_lstat_empty_string_bug=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_lstat_empty_string_bug" >&5 -echo "${ECHO_T}$ac_cv_func_lstat_empty_string_bug" >&6; } -if test $ac_cv_func_lstat_empty_string_bug = yes; then - case " $LIBOBJS " in - *" lstat.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS lstat.$ac_objext" - ;; -esac - - -cat >>confdefs.h <<_ACEOF -#define HAVE_LSTAT_EMPTY_STRING_BUG 1 -_ACEOF - -fi - -{ echo "$as_me:$LINENO: checking whether lstat dereferences a symlink specified with a trailing slash" >&5 -echo $ECHO_N "checking whether lstat dereferences a symlink specified with a trailing slash... $ECHO_C" >&6; } -if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - rm -f conftest.sym conftest.file -echo >conftest.file -if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then - if test "$cross_compiling" = yes; then - ac_cv_func_lstat_dereferences_slashed_symlink=no -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -struct stat sbuf; - /* Linux will dereference the symlink and fail. - That is better in the sense that it means we will not - have to compile and use the lstat wrapper. */ - return lstat ("conftest.sym/", &sbuf) == 0; - ; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_lstat_dereferences_slashed_symlink=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_func_lstat_dereferences_slashed_symlink=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - -else - # If the `ln -s' command failed, then we probably don't even - # have an lstat function. - ac_cv_func_lstat_dereferences_slashed_symlink=no -fi -rm -f conftest.sym conftest.file - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 -echo "${ECHO_T}$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; } - -test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && - -cat >>confdefs.h <<_ACEOF -#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 -_ACEOF - - -if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then - case " $LIBOBJS " in - *" lstat.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS lstat.$ac_objext" - ;; -esac - -fi - -{ echo "$as_me:$LINENO: checking return type of signal handlers" >&5 -echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6; } -if test "${ac_cv_type_signal+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include - -int -main () -{ -return *(signal (0, 0)) (0) == 1; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_type_signal=int -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_signal=void -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 -echo "${ECHO_T}$ac_cv_type_signal" >&6; } - -cat >>confdefs.h <<_ACEOF -#define RETSIGTYPE $ac_cv_type_signal -_ACEOF - - -{ echo "$as_me:$LINENO: checking whether stat accepts an empty string" >&5 -echo $ECHO_N "checking whether stat accepts an empty string... $ECHO_C" >&6; } -if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_stat_empty_string_bug=yes -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -struct stat sbuf; - return stat ("", &sbuf) == 0; - ; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_stat_empty_string_bug=no -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_func_stat_empty_string_bug=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_stat_empty_string_bug" >&5 -echo "${ECHO_T}$ac_cv_func_stat_empty_string_bug" >&6; } -if test $ac_cv_func_stat_empty_string_bug = yes; then - case " $LIBOBJS " in - *" stat.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS stat.$ac_objext" - ;; -esac - - -cat >>confdefs.h <<_ACEOF -#define HAVE_STAT_EMPTY_STRING_BUG 1 -_ACEOF - -fi - - -for ac_func in vprintf -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif - -int -main () -{ -return $ac_func (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_var=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_var'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -{ echo "$as_me:$LINENO: checking for _doprnt" >&5 -echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6; } -if test "${ac_cv_func__doprnt+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define _doprnt to an innocuous variant, in case declares _doprnt. - For example, HP-UX 11i declares gettimeofday. */ -#define _doprnt innocuous__doprnt - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char _doprnt (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef _doprnt - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char _doprnt (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub__doprnt || defined __stub____doprnt -choke me -#endif - -int -main () -{ -return _doprnt (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_func__doprnt=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_func__doprnt=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5 -echo "${ECHO_T}$ac_cv_func__doprnt" >&6; } -if test $ac_cv_func__doprnt = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_DOPRNT 1 -_ACEOF - -fi - -fi -done - - - - - - - - - - - - - - - - - - - - - - - - -for ac_func in erasechar killchar alarm getpass memset setenv strchr nlist _spawnl spawnl getpwuid loadav getloadavg strerror setresgid setregid setgid setresuid setreuid setuid getuid getgid -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif - -int -main () -{ -return $ac_func (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_var=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_var'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - -# Extract the first word of "nroff", so it can be a program name with args. -set dummy nroff; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_NROFF+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$NROFF"; then - ac_cv_prog_NROFF="$NROFF" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_NROFF="nroff" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -NROFF=$ac_cv_prog_NROFF -if test -n "$NROFF"; then - { echo "$as_me:$LINENO: result: $NROFF" >&5 -echo "${ECHO_T}$NROFF" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -# Extract the first word of "groff", so it can be a program name with args. -set dummy groff; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_GROFF+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$GROFF"; then - ac_cv_prog_GROFF="$GROFF" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_GROFF="groff" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -GROFF=$ac_cv_prog_GROFF -if test -n "$GROFF"; then - { echo "$as_me:$LINENO: result: $GROFF" >&5 -echo "${ECHO_T}$GROFF" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -# Extract the first word of "colcrt", so it can be a program name with args. -set dummy colcrt; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_COLCRT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$COLCRT"; then - ac_cv_prog_COLCRT="$COLCRT" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_COLCRT="colcrt" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -COLCRT=$ac_cv_prog_COLCRT -if test -n "$COLCRT"; then - { echo "$as_me:$LINENO: result: $COLCRT" >&5 -echo "${ECHO_T}$COLCRT" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -# Extract the first word of "tbl", so it can be a program name with args. -set dummy tbl; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_TBL+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$TBL"; then - ac_cv_prog_TBL="$TBL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_TBL="tbl" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -TBL=$ac_cv_prog_TBL -if test -n "$TBL"; then - { echo "$as_me:$LINENO: result: $TBL" >&5 -echo "${ECHO_T}$TBL" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -# Extract the first word of "sed", so it can be a program name with args. -set dummy sed; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_SED+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$SED"; then - ac_cv_prog_SED="$SED" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_SED="sed" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -SED=$ac_cv_prog_SED -if test -n "$SED"; then - { echo "$as_me:$LINENO: result: $SED" >&5 -echo "${ECHO_T}$SED" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - - -# Check whether --with-program-name was given. -if test "${with_program_name+set}" = set; then - withval=$with_program_name; progname="$withval" -else - progname="rogue" -fi - -PROGRAM=$progname - - -# Check whether --enable-setgid was given. -if test "${enable_setgid+set}" = set; then - enableval=$enable_setgid; -fi - -{ echo "$as_me:$LINENO: checking if using setgid execute bit" >&5 -echo $ECHO_N "checking if using setgid execute bit... $ECHO_C" >&6; } -if test "x$enable_setgid" = "xno" ; then -GROUPOWNER= -elif test "x$enable_setgid" = "xyes" ; then -GROUPOWNER=games -elif test "x$enable_setgid" = "x" ; then -GROUPOWNER= -else -GROUPOWNER=$enable_setgid -fi - -if test "x$GROUPOWNER" != "x" ; then - -cat >>confdefs.h <<_ACEOF -#define GROUPOWNER $GROUPOWNER -_ACEOF - -{ echo "$as_me:$LINENO: result: $GROUPOWNER" >&5 -echo "${ECHO_T}$GROUPOWNER" >&6; } -else -{ echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - -# Check whether --enable-scorefile was given. -if test "${enable_scorefile+set}" = set; then - enableval=$enable_scorefile; -fi - -{ echo "$as_me:$LINENO: checking for scoreboard file" >&5 -echo $ECHO_N "checking for scoreboard file... $ECHO_C" >&6; } -if test "x$enable_scorefile" = "xno" ; then -SCOREFILE= -elif test "x$enable_scorefile" = "xyes" ; then -SCOREFILE=$progname.scr -elif test "x$enable_scorefile" = "x" ; then -SCOREFILE=$progname.scr -else -SCOREFILE=$enable_scorefile -fi - -if test "x$SCOREFILE" != "x" ; then - -cat >>confdefs.h <<_ACEOF -#define SCOREFILE "$SCOREFILE" -_ACEOF - -{ echo "$as_me:$LINENO: result: $SCOREFILE" >&5 -echo "${ECHO_T}$SCOREFILE" >&6; } -else -{ echo "$as_me:$LINENO: result: disabled" >&5 -echo "${ECHO_T}disabled" >&6; } -fi - - - -# Check whether --enable-lockfile was given. -if test "${enable_lockfile+set}" = set; then - enableval=$enable_lockfile; -fi - -{ echo "$as_me:$LINENO: checking for scoreboard lockfile file" >&5 -echo $ECHO_N "checking for scoreboard lockfile file... $ECHO_C" >&6; } -if test "x$enable_lockfile" = "xno" ; then -LOCKFILE= -elif test "x$enable_lockfile" = "xyes" ; then -LOCKFILE=$progname.lck -elif test "x$enable_lockfile" = "x" ; then -LOCKFILE=$progname.lck -else -LOCKFILE=$enable_lockfile -fi - -if test "x$LOCKFILE" != "x" ; then - -cat >>confdefs.h <<_ACEOF -#define LOCKFILE "$LOCKFILE" -_ACEOF - -{ echo "$as_me:$LINENO: result: $LOCKFILE" >&5 -echo "${ECHO_T}$LOCKFILE" >&6; } -else -{ echo "$as_me:$LINENO: result: disabled" >&5 -echo "${ECHO_T}disabled" >&6; } -fi - - - -# Check whether --enable-wizardmode was given. -if test "${enable_wizardmode+set}" = set; then - enableval=$enable_wizardmode; -fi - -{ echo "$as_me:$LINENO: checking if wizard mode is enabled" >&5 -echo $ECHO_N "checking if wizard mode is enabled... $ECHO_C" >&6; } -if test "x$enable_wizardmode" = "xno" ; then -{ echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -elif test "x$enable_wizardmode" = "x" ; then -{ echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -else - -cat >>confdefs.h <<\_ACEOF -#define MASTER -_ACEOF - -if test "x$enable_wizardmode" != "xyes" ; then - -cat >>confdefs.h <<_ACEOF -#define PASSWD $enable_wizardmode -_ACEOF - -fi -{ echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } -fi - -# Check whether --enable-allscores was given. -if test "${enable_allscores+set}" = set; then - enableval=$enable_allscores; -else - enable_allscores=yes -fi - -{ echo "$as_me:$LINENO: checking if allscores is enabled" >&5 -echo $ECHO_N "checking if allscores is enabled... $ECHO_C" >&6; } -if test "x$enable_allscores" = "xyes" ; then - -cat >>confdefs.h <<\_ACEOF -#define ALLSCORES 1 -_ACEOF - -{ echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } -else -{ echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - -# Check whether --enable-checktime was given. -if test "${enable_checktime+set}" = set; then - enableval=$enable_checktime; -fi - -{ echo "$as_me:$LINENO: checking if checktime is enabled" >&5 -echo $ECHO_N "checking if checktime is enabled... $ECHO_C" >&6; } -if test "x$enable_checktime" = "xyes" ; then - -cat >>confdefs.h <<\_ACEOF -#define CHECKTIME 1 -_ACEOF - -{ echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } -else -{ echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - -# Check whether --enable-maxload was given. -if test "${enable_maxload+set}" = set; then - enableval=$enable_maxload; -fi - -{ echo "$as_me:$LINENO: checking runtime execution limit (maximum system load average)" >&5 -echo $ECHO_N "checking runtime execution limit (maximum system load average)... $ECHO_C" >&6; } -if test "x$enable_maxload" = "xyes" ; then - -cat >>confdefs.h <<\_ACEOF -#define MAXLOAD 100 -_ACEOF - -{ echo "$as_me:$LINENO: result: 100" >&5 -echo "${ECHO_T}100" >&6; } -elif test "x$enable_maxload" = "x" ; then -{ echo "$as_me:$LINENO: result: unlimited" >&5 -echo "${ECHO_T}unlimited" >&6; } -elif test "x$enable_maxload" = "xno" ; then -{ echo "$as_me:$LINENO: result: unlimited" >&5 -echo "${ECHO_T}unlimited" >&6; } -else - -cat >>confdefs.h <<_ACEOF -#define MAXLOAD $enable_maxload -_ACEOF - -{ echo "$as_me:$LINENO: result: $enable_maxload" >&5 -echo "${ECHO_T}$enable_maxload" >&6; } -fi - -# Check whether --enable-maxusers was given. -if test "${enable_maxusers+set}" = set; then - enableval=$enable_maxusers; -fi - -{ echo "$as_me:$LINENO: checking runtime execution limit (maximum online system users)" >&5 -echo $ECHO_N "checking runtime execution limit (maximum online system users)... $ECHO_C" >&6; } -if test "x$enable_maxusers" = "xyes" ; then - -cat >>confdefs.h <<\_ACEOF -#define MAXUSERS 100 -_ACEOF - -{ echo "$as_me:$LINENO: result: 100" >&5 -echo "${ECHO_T}100" >&6; } -elif test "x$enable_maxusers" = "x" ; then -{ echo "$as_me:$LINENO: result: unlimited" >&5 -echo "${ECHO_T}unlimited" >&6; } -elif test "x$enable_maxload" = "xno" ; then -{ echo "$as_me:$LINENO: result: unlimited" >&5 -echo "${ECHO_T}unlimited" >&6; } -else - -cat >>confdefs.h <<_ACEOF -#define MAXLOAD $enable_maxusers -_ACEOF - -{ echo "$as_me:$LINENO: result: $enable_maxusers" >&5 -echo "${ECHO_T}$enable_maxusers" >&6; } -fi - -# Check whether --enable-numscores was given. -if test "${enable_numscores+set}" = set; then - enableval=$enable_numscores; -fi - -{ echo "$as_me:$LINENO: checking what the number of scores to store in scoreboard is" >&5 -echo $ECHO_N "checking what the number of scores to store in scoreboard is... $ECHO_C" >&6; } -if test "x$numscores" = "xyes" ; then - -cat >>confdefs.h <<\_ACEOF -#define NUMSCORES 10 -_ACEOF - -{ echo "$as_me:$LINENO: result: 10" >&5 -echo "${ECHO_T}10" >&6; } -elif test "x$enable_numscores" = "x" ; then - -cat >>confdefs.h <<\_ACEOF -#define NUMSCORES 10 -_ACEOF - -{ echo "$as_me:$LINENO: result: 10" >&5 -echo "${ECHO_T}10" >&6; } -elif test "x$enable_numscores" = "xno" ; then - -cat >>confdefs.h <<\_ACEOF -#define NUMSCORES 10 -_ACEOF - -{ echo "$as_me:$LINENO: result: 10" >&5 -echo "${ECHO_T}10" >&6; } -else - -cat >>confdefs.h <<_ACEOF -#define NUMSCORES $enable_numscores -_ACEOF - -{ echo "$as_me:$LINENO: result: $enable_numscores" >&5 -echo "${ECHO_T}$enable_numscores" >&6; } -fi - -# Check whether --enable-numname was given. -if test "${enable_numname+set}" = set; then - enableval=$enable_numname; -fi - -{ echo "$as_me:$LINENO: checking word for the number of scores to store in scoreboard is" >&5 -echo $ECHO_N "checking word for the number of scores to store in scoreboard is... $ECHO_C" >&6; } -if test "x$enable_numname" = "xyes" ; then - -cat >>confdefs.h <<\_ACEOF -#define NUMNAME "Ten" -_ACEOF - -{ echo "$as_me:$LINENO: result: Ten" >&5 -echo "${ECHO_T}Ten" >&6; } -elif test "x$enable_numname" = "x" ; then - -cat >>confdefs.h <<\_ACEOF -#define NUMNAME "Ten" -_ACEOF - -{ echo "$as_me:$LINENO: result: Ten" >&5 -echo "${ECHO_T}Ten" >&6; } -elif test "x$enable_numname" = "xno" ; then - -cat >>confdefs.h <<\_ACEOF -#define NUMNAME "Ten" -_ACEOF - -{ echo "$as_me:$LINENO: result: Ten" >&5 -echo "${ECHO_T}Ten" >&6; } -else - -cat >>confdefs.h <<_ACEOF -#define NUMNAME "$enable_numname" -_ACEOF - -{ echo "$as_me:$LINENO: result: $enable_numname" >&5 -echo "${ECHO_T}$enable_numname" >&6; } -fi - -# Check whether --enable-loadav was given. -if test "${enable_loadav+set}" = set; then - enableval=$enable_loadav; -fi - -{ echo "$as_me:$LINENO: checking whether to use program's built in load average function" >&5 -echo $ECHO_N "checking whether to use program's built in load average function... $ECHO_C" >&6; } -if test "x$enable_loadav" = "xyes" ; then - -cat >>confdefs.h <<\_ACEOF -#define LOADAV -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define NAMELIST /vmunix -_ACEOF - -{ echo "$as_me:$LINENO: result: /vmunix" >&5 -echo "${ECHO_T}/vmunix" >&6; } -elif test "x$enable_loadav" = "x" ; then -{ echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -elif test "x$enable_loadav" = "xno" ; then -{ echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -else - -cat >>confdefs.h <<\_ACEOF -#define LOADAV -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define NAMELIST $enable_loadav -_ACEOF - -{ echo "$as_me:$LINENO: result: $enable_loadav" >&5 -echo "${ECHO_T}$enable_loadav" >&6; } -fi - -# Check whether --enable-ucount was given. -if test "${enable_ucount+set}" = set; then - enableval=$enable_ucount; -fi - -{ echo "$as_me:$LINENO: checking whether to use program's built in user counting function" >&5 -echo $ECHO_N "checking whether to use program's built in user counting function... $ECHO_C" >&6; } -if test "x$enable_ucount" = "xyes" ; then - -cat >>confdefs.h <<\_ACEOF -#define UCOUNT -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define UTMP /etc/utmp -_ACEOF - -{ echo "$as_me:$LINENO: result: /etc/utmp" >&5 -echo "${ECHO_T}/etc/utmp" >&6; } -elif test "x$enable_ucount" = "x" ; then -{ echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -elif test "x$enable_count" = "xno" ; then -{ echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -else - -cat >>confdefs.h <<\_ACEOF -#define UCOUNT -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define UTMP $enable_ucount -_ACEOF - -{ echo "$as_me:$LINENO: result: $enable_ucount" >&5 -echo "${ECHO_T}$enable_ucount" >&6; } -fi - -TARGET=$target - - -{ echo "$as_me:$LINENO: checking whether to docdir is defined" >&5 -echo $ECHO_N "checking whether to docdir is defined... $ECHO_C" >&6; } -if test "x$docdir" = "x" ; then -{ echo "$as_me:$LINENO: result: docdir undefined" >&5 -echo "${ECHO_T}docdir undefined" >&6; } -docdir=\${datadir}/doc/\${PACKAGE_TARNAME} - -else -{ echo "$as_me:$LINENO: result: docdir defined" >&5 -echo "${ECHO_T}docdir defined" >&6; } -fi - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 -echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - *) $as_unset $ac_var ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && - { echo "$as_me:$LINENO: updating cache $cache_file" >&5 -echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file - else - { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 -echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - -: ${CONFIG_STATUS=./config.status} -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - - - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -as_nl=' -' -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } -fi - -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# CDPATH. -$as_unset CDPATH - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in --n*) - case `echo 'x\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; - esac;; -*) - ECHO_N='-n';; -esac - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir -fi -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 - -# Save the log message, to keep $[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by Rogue $as_me 5.4.4, which was -generated by GNU Autoconf 2.61. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -# Files that config.status was made for. -config_files="$ac_config_files" -config_headers="$ac_config_headers" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTIONS] [FILE]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Report bugs to ." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -ac_cs_version="\\ -Rogue config.status 5.4.4 -configured by $0, generated by GNU Autoconf 2.61, - with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" - -Copyright (C) 2006 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - echo "$ac_cs_version"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" - ac_need_defaults=false;; - --he | --h) - # Conflict between --help and --header - { echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -if \$ac_cs_recheck; then - echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - CONFIG_SHELL=$SHELL - export CONFIG_SHELL - exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "rogue.6") CONFIG_FILES="$CONFIG_FILES rogue.6" ;; - "rogue.cat") CONFIG_FILES="$CONFIG_FILES rogue.cat" ;; - "rogue.doc") CONFIG_FILES="$CONFIG_FILES rogue.doc" ;; - "rogue.html") CONFIG_FILES="$CONFIG_FILES rogue.html" ;; - "rogue.me") CONFIG_FILES="$CONFIG_FILES rogue.me" ;; - - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= - trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status -' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -# -# Set up the sed scripts for CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "$CONFIG_FILES"; then - -_ACEOF - - - -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - cat >conf$$subs.sed <<_ACEOF -SHELL!$SHELL$ac_delim -PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim -PACKAGE_NAME!$PACKAGE_NAME$ac_delim -PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim -PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim -PACKAGE_STRING!$PACKAGE_STRING$ac_delim -PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim -exec_prefix!$exec_prefix$ac_delim -prefix!$prefix$ac_delim -program_transform_name!$program_transform_name$ac_delim -bindir!$bindir$ac_delim -sbindir!$sbindir$ac_delim -libexecdir!$libexecdir$ac_delim -datarootdir!$datarootdir$ac_delim -datadir!$datadir$ac_delim -sysconfdir!$sysconfdir$ac_delim -sharedstatedir!$sharedstatedir$ac_delim -localstatedir!$localstatedir$ac_delim -includedir!$includedir$ac_delim -oldincludedir!$oldincludedir$ac_delim -docdir!$docdir$ac_delim -infodir!$infodir$ac_delim -htmldir!$htmldir$ac_delim -dvidir!$dvidir$ac_delim -pdfdir!$pdfdir$ac_delim -psdir!$psdir$ac_delim -libdir!$libdir$ac_delim -localedir!$localedir$ac_delim -mandir!$mandir$ac_delim -DEFS!$DEFS$ac_delim -ECHO_C!$ECHO_C$ac_delim -ECHO_N!$ECHO_N$ac_delim -ECHO_T!$ECHO_T$ac_delim -LIBS!$LIBS$ac_delim -build_alias!$build_alias$ac_delim -host_alias!$host_alias$ac_delim -target_alias!$target_alias$ac_delim -build!$build$ac_delim -build_cpu!$build_cpu$ac_delim -build_vendor!$build_vendor$ac_delim -build_os!$build_os$ac_delim -host!$host$ac_delim -host_cpu!$host_cpu$ac_delim -host_vendor!$host_vendor$ac_delim -host_os!$host_os$ac_delim -target!$target$ac_delim -target_cpu!$target_cpu$ac_delim -target_vendor!$target_vendor$ac_delim -target_os!$target_os$ac_delim -CC!$CC$ac_delim -CFLAGS!$CFLAGS$ac_delim -LDFLAGS!$LDFLAGS$ac_delim -CPPFLAGS!$CPPFLAGS$ac_delim -ac_ct_CC!$ac_ct_CC$ac_delim -EXEEXT!$EXEEXT$ac_delim -OBJEXT!$OBJEXT$ac_delim -CPP!$CPP$ac_delim -GREP!$GREP$ac_delim -EGREP!$EGREP$ac_delim -LIBOBJS!$LIBOBJS$ac_delim -NROFF!$NROFF$ac_delim -GROFF!$GROFF$ac_delim -COLCRT!$COLCRT$ac_delim -TBL!$TBL$ac_delim -SED!$SED$ac_delim -PROGRAM!$PROGRAM$ac_delim -GROUPOWNER!$GROUPOWNER$ac_delim -SCOREFILE!$SCOREFILE$ac_delim -LOCKFILE!$LOCKFILE$ac_delim -TARGET!$TARGET$ac_delim -LTLIBOBJS!$LTLIBOBJS$ac_delim -_ACEOF - - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 71; then - break - elif $ac_last_try; then - { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` -if test -n "$ac_eof"; then - ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` - ac_eof=`expr $ac_eof + 1` -fi - -cat >>$CONFIG_STATUS <<_ACEOF -cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end -_ACEOF -sed ' -s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g -s/^/s,@/; s/!/@,|#_!!_#|/ -:n -t n -s/'"$ac_delim"'$/,g/; t -s/$/\\/; p -N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n -' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF -:end -s/|#_!!_#|//g -CEOF$ac_eof -_ACEOF - - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ -s/:*$// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF -fi # test -n "$CONFIG_FILES" - - -for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 -echo "$as_me: error: Invalid tag $ac_tag." >&2;} - { (exit 1); exit 1; }; };; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 -echo "$as_me: error: cannot find input file: $ac_f" >&2;} - { (exit 1); exit 1; }; };; - esac - ac_file_inputs="$ac_file_inputs $ac_f" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input="Generated from "`IFS=: - echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - fi - - case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin";; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - { as_dir="$ac_dir" - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -echo "$as_me: error: cannot create directory $as_dir" >&2;} - { (exit 1); exit 1; }; }; } - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= - -case `sed -n '/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p -' $ac_file_inputs` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s&@configure_input@&$configure_input&;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -$ac_datarootdir_hack -" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && - { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 -echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&2;} - - rm -f "$tmp/stdin" - case $ac_file in - -) cat "$tmp/out"; rm -f "$tmp/out";; - *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; - esac - ;; - :H) - # - # CONFIG_HEADER - # -_ACEOF - -# Transform confdefs.h into a sed script `conftest.defines', that -# substitutes the proper values into config.h.in to produce config.h. -rm -f conftest.defines conftest.tail -# First, append a space to every undef/define line, to ease matching. -echo 's/$/ /' >conftest.defines -# Then, protect against being on the right side of a sed subst, or in -# an unquoted here document, in config.status. If some macros were -# called several times there might be several #defines for the same -# symbol, which is useless. But do not sort them, since the last -# AC_DEFINE must be honored. -ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* -# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where -# NAME is the cpp macro being defined, VALUE is the value it is being given. -# PARAMS is the parameter list in the macro definition--in most cases, it's -# just an empty string. -ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' -ac_dB='\\)[ (].*,\\1define\\2' -ac_dC=' ' -ac_dD=' ,' - -uniq confdefs.h | - sed -n ' - t rset - :rset - s/^[ ]*#[ ]*define[ ][ ]*// - t ok - d - :ok - s/[\\&,]/\\&/g - s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p - s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p - ' >>conftest.defines - -# Remove the space that was appended to ease matching. -# Then replace #undef with comments. This is necessary, for -# example, in the case of _POSIX_SOURCE, which is predefined and required -# on some systems where configure will not decide to define it. -# (The regexp can be short, since the line contains either #define or #undef.) -echo 's/ $// -s,^[ #]*u.*,/* & */,' >>conftest.defines - -# Break up conftest.defines: -ac_max_sed_lines=50 - -# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" -# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" -# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" -# et cetera. -ac_in='$ac_file_inputs' -ac_out='"$tmp/out1"' -ac_nxt='"$tmp/out2"' - -while : -do - # Write a here document: - cat >>$CONFIG_STATUS <<_ACEOF - # First, check the format of the line: - cat >"\$tmp/defines.sed" <<\\CEOF -/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def -/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def -b -:def -_ACEOF - sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS - echo 'CEOF - sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS - ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in - sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail - grep . conftest.tail >/dev/null || break - rm -f conftest.defines - mv conftest.tail conftest.defines -done -rm -f conftest.defines conftest.tail - -echo "ac_result=$ac_in" >>$CONFIG_STATUS -cat >>$CONFIG_STATUS <<\_ACEOF - if test x"$ac_file" != x-; then - echo "/* $configure_input */" >"$tmp/config.h" - cat "$ac_result" >>"$tmp/config.h" - if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then - { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 -echo "$as_me: $ac_file is unchanged" >&6;} - else - rm -f $ac_file - mv "$tmp/config.h" $ac_file - fi - else - echo "/* $configure_input */" - cat "$ac_result" - fi - rm -f "$tmp/out12" - ;; - - - esac - -done # for ac_tag - - -{ (exit 0); exit 0; } -_ACEOF -chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } -fi - diff --git a/src/cc/rogue/configure.ac b/src/cc/rogue/configure.ac deleted file mode 100644 index 15c9cc7e4..000000000 --- a/src/cc/rogue/configure.ac +++ /dev/null @@ -1,246 +0,0 @@ -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.56) -AC_INIT([Rogue],[5.4.4], [yendor@rogueforge.net]) -AC_CONFIG_SRCDIR([armor.c]) -AC_CONFIG_HEADER([config.h]) -AC_CONFIG_FILES([Makefile rogue.6 rogue.cat rogue.doc rogue.html rogue.me]) -AC_CANONICAL_SYSTEM([]) - -# Checks for programs. -AC_PROG_CC - -# Checks for libraries. - -# Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS([arpa/inet.h sys/utsname.h pwd.h fcntl.h limits.h nlist.h stdlib.h string.h sys/ioctl.h termios.h unistd.h utmp.h term.h ncurses/term.h process.h]) - -# Checks for typedefs, structures, and compiler characteristics. -AC_HEADER_STDBOOL -AC_C_CONST -AC_TYPE_UID_T -AC_TYPE_SIZE_T -AC_STRUCT_TM -MP_WITH_CURSES -# Checks for library functions. -AC_FUNC_FORK -AC_PROG_GCC_TRADITIONAL -AC_FUNC_LSTAT -AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK -AC_TYPE_SIGNAL -AC_FUNC_STAT -AC_FUNC_VPRINTF -AC_CHECK_FUNCS([erasechar killchar alarm getpass memset setenv strchr nlist _spawnl spawnl getpwuid loadav getloadavg strerror setresgid setregid setgid setresuid setreuid setuid getuid getgid]) - -AC_CHECK_PROG([NROFF], [nroff], [nroff],) -AC_CHECK_PROG([GROFF], [groff], [groff],) -AC_CHECK_PROG([COLCRT], [colcrt], [colcrt],) -AC_CHECK_PROG([TBL], [tbl], [tbl],) -AC_CHECK_PROG([SED], [sed], [sed],) - -AC_ARG_WITH(program-name, AC_HELP_STRING([--with-program-name=NAME],[alternate executable name]),[progname="$withval" ], [progname="rogue"] ) -PROGRAM=$progname -AC_SUBST(PROGRAM) - -AC_ARG_ENABLE(setgid, AC_HELP_STRING([--enable-setgid=NAME],[install executable as setgid with group ownership of NAME @<:@default=no@:>@])],[],[]) -AC_MSG_CHECKING([if using setgid execute bit]) -if test "x$enable_setgid" = "xno" ; then -GROUPOWNER= -elif test "x$enable_setgid" = "xyes" ; then -GROUPOWNER=games -elif test "x$enable_setgid" = "x" ; then -GROUPOWNER= -else -GROUPOWNER=$enable_setgid -fi - -if test "x$GROUPOWNER" != "x" ; then -AC_DEFINE_UNQUOTED([GROUPOWNER],[$GROUPOWNER], [Define to group owner of setgid executable]) -AC_MSG_RESULT([$GROUPOWNER]) -else -AC_MSG_RESULT([no]) -fi - -AC_SUBST(GROUPOWNER) - -AC_ARG_ENABLE([scorefile],[AC_HELP_STRING([--enable-scorefile=SCOREFILE], [enable scoreboard with given filename])],[],[]) -AC_MSG_CHECKING([for scoreboard file]) -if test "x$enable_scorefile" = "xno" ; then -SCOREFILE= -elif test "x$enable_scorefile" = "xyes" ; then -SCOREFILE=$progname.scr -elif test "x$enable_scorefile" = "x" ; then -SCOREFILE=$progname.scr -else -SCOREFILE=$enable_scorefile -fi - -if test "x$SCOREFILE" != "x" ; then -AC_DEFINE_UNQUOTED([SCOREFILE], ["$SCOREFILE"], [Define to file to use for scoreboard]) -AC_MSG_RESULT([$SCOREFILE]) -else -AC_MSG_RESULT([disabled]) -fi - -AC_SUBST(SCOREFILE) - -AC_ARG_ENABLE([lockfile],[AC_HELP_STRING([--enable-lockfile=LOCKFILE], [enable scoreboard lockfile with given filename])],[],[]) -AC_MSG_CHECKING([for scoreboard lockfile file]) -if test "x$enable_lockfile" = "xno" ; then -LOCKFILE= -elif test "x$enable_lockfile" = "xyes" ; then -LOCKFILE=$progname.lck -elif test "x$enable_lockfile" = "x" ; then -LOCKFILE=$progname.lck -else -LOCKFILE=$enable_lockfile -fi - -if test "x$LOCKFILE" != "x" ; then -AC_DEFINE_UNQUOTED([LOCKFILE], ["$LOCKFILE"], [Define to file to use for scoreboard lockfile]) -AC_MSG_RESULT([$LOCKFILE]) -else -AC_MSG_RESULT([disabled]) -fi - -AC_SUBST(LOCKFILE) - -AC_ARG_ENABLE([wizardmode],[AC_HELP_STRING([--enable-wizardmode], [enable availability of wizard mode @<:@default=no@:>@])],[],[]) -AC_MSG_CHECKING([if wizard mode is enabled]) -if test "x$enable_wizardmode" = "xno" ; then -AC_MSG_RESULT([no]) -elif test "x$enable_wizardmode" = "x" ; then -AC_MSG_RESULT([no]) -else -AC_DEFINE([MASTER], [], [Define to include wizard mode]) -if test "x$enable_wizardmode" != "xyes" ; then -AC_DEFINE_UNQUOTED([PASSWD],[$enable_wizardmode], [Define crypt(3) wizard mode password]) -fi -AC_MSG_RESULT([yes]) -fi - -AC_ARG_ENABLE([allscores],[AC_HELP_STRING([--enable-allscores], [enable scoreboard to show top scores, not just top players @<:@default=yes@:>@])],[],[enable_allscores=yes]) -AC_MSG_CHECKING([if allscores is enabled]) -if test "x$enable_allscores" = "xyes" ; then -AC_DEFINE([ALLSCORES], [1], [Define if scorefile is top scores, not top players]) -AC_MSG_RESULT([yes]) -else -AC_MSG_RESULT([no]) -fi - -AC_ARG_ENABLE([checktime],[AC_HELP_STRING([--enable-checktime], [enable checktime @<:@default=no@:>@])],[],[]) -AC_MSG_CHECKING([if checktime is enabled]) -if test "x$enable_checktime" = "xyes" ; then -AC_DEFINE([CHECKTIME], [1], [Define if checktime feature should be enabled]) -AC_MSG_RESULT([yes]) -else -AC_MSG_RESULT([no]) -fi - -AC_ARG_ENABLE([maxload],[AC_HELP_STRING([--enable-maxload], [enable maxload @<:@default=no@:>@])],[],[]) -AC_MSG_CHECKING([runtime execution limit (maximum system load average)]) -if test "x$enable_maxload" = "xyes" ; then -AC_DEFINE([MAXLOAD], [100], [Define if maxload feature should be enabled]) -AC_MSG_RESULT([100]) -elif test "x$enable_maxload" = "x" ; then -AC_MSG_RESULT([unlimited]) -elif test "x$enable_maxload" = "xno" ; then -AC_MSG_RESULT([unlimited]) -else -AC_DEFINE_UNQUOTED([MAXLOAD], [$enable_maxload], [Define if maxload feature should be enabled]) -AC_MSG_RESULT([$enable_maxload]) -fi - -AC_ARG_ENABLE([maxusers],[AC_HELP_STRING([--enable-maxusers], [enable maxuser @<:@default=no@:>@])],[],[]) -AC_MSG_CHECKING([runtime execution limit (maximum online system users)]) -if test "x$enable_maxusers" = "xyes" ; then -AC_DEFINE([MAXUSERS], [100], [Define if maxusers feature should be enabled]) -AC_MSG_RESULT([100]) -elif test "x$enable_maxusers" = "x" ; then -AC_MSG_RESULT([unlimited]) -elif test "x$enable_maxload" = "xno" ; then -AC_MSG_RESULT([unlimited]) -else -AC_DEFINE_UNQUOTED([MAXLOAD], [$enable_maxusers], [Define if maxusers feature should be enabled]) -AC_MSG_RESULT([$enable_maxusers]) -fi - -AC_ARG_ENABLE([numscores],[AC_HELP_STRING([--enable-numscores], [number of scores to store in scoreboard @<:@default=10@:>@])],[],[]) -AC_MSG_CHECKING([what the number of scores to store in scoreboard is]) -if test "x$numscores" = "xyes" ; then -AC_DEFINE([NUMSCORES], [10], [number of scores to store in scoreboard]) -AC_MSG_RESULT([10]) -elif test "x$enable_numscores" = "x" ; then -AC_DEFINE([NUMSCORES], [10], [number of scores to store in scoreboard]) -AC_MSG_RESULT([10]) -elif test "x$enable_numscores" = "xno" ; then -AC_DEFINE([NUMSCORES], [10], [number of scores to store in scoreboard]) -AC_MSG_RESULT([10]) -else -AC_DEFINE_UNQUOTED([NUMSCORES], [$enable_numscores], [number of scores to store in scoreboard]) -AC_MSG_RESULT([$enable_numscores]) -fi - -AC_ARG_ENABLE([numname],[AC_HELP_STRING([--enable-numname], [word for number of scores to store in scoreboard @<:@default=Ten@:>@])],[],[]) -AC_MSG_CHECKING([word for the number of scores to store in scoreboard is]) -if test "x$enable_numname" = "xyes" ; then -AC_DEFINE([NUMNAME], ["Ten"], [word for the number of scores to store in scoreboard]) -AC_MSG_RESULT([Ten]) -elif test "x$enable_numname" = "x" ; then -AC_DEFINE([NUMNAME], ["Ten"], [word for the number of scores to store in scoreboard]) -AC_MSG_RESULT([Ten]) -elif test "x$enable_numname" = "xno" ; then -AC_DEFINE([NUMNAME], ["Ten"], [word for the number of scores to store in scoreboard]) -AC_MSG_RESULT([Ten]) -else -AC_DEFINE_UNQUOTED([NUMNAME], ["$enable_numname"], [word for the number of scores to store in scoreboard]) -AC_MSG_RESULT([$enable_numname]) -fi - -AC_ARG_ENABLE([loadav],[AC_HELP_STRING([--enable-loadav=NAMELIST], [use program's load average function (unlikely to work) @<:@default=no@:>@])],[],[]) -AC_MSG_CHECKING([whether to use program's built in load average function]) -if test "x$enable_loadav" = "xyes" ; then -AC_DEFINE([LOADAV], [], [define if we should use program's load average function instead of system]) -AC_DEFINE([NAMELIST], [/vmunix], [kernel file to pass to nlist() when reading load average (unlikely to work)]) -AC_MSG_RESULT([/vmunix]) -elif test "x$enable_loadav" = "x" ; then -AC_MSG_RESULT([no]) -elif test "x$enable_loadav" = "xno" ; then -AC_MSG_RESULT([no]) -else -AC_DEFINE([LOADAV], [], [define if we should use program's load average function instead of system]) -AC_DEFINE_UNQUOTED([NAMELIST], [$enable_loadav], [kernel file to pass to nlist() when reading load average (unlikely to work)]) -AC_MSG_RESULT([$enable_loadav]) -fi - -AC_ARG_ENABLE([ucount],[AC_HELP_STRING([--enable-ucount=UTMPFILE], [use program's own function to count users (unlikely to work) @<:@default=no@:>@])],[],[]) -AC_MSG_CHECKING([whether to use program's built in user counting function]) -if test "x$enable_ucount" = "xyes" ; then -AC_DEFINE([UCOUNT], [], [define if we should use program's user counting function instead of system's]) -AC_DEFINE([UTMP], [/etc/utmp], [utmp like file to pass to ucount() when counting online users (unlikely to work)]) -AC_MSG_RESULT([/etc/utmp]) -elif test "x$enable_ucount" = "x" ; then -AC_MSG_RESULT([no]) -elif test "x$enable_count" = "xno" ; then -AC_MSG_RESULT([no]) -else -AC_DEFINE([UCOUNT], [], [define if we should use program's user counting function instead of system's]) -AC_DEFINE_UNQUOTED([UTMP], [$enable_ucount], [utmp like file to pass to ucount() when counting online users (unlikely to work)]) -AC_MSG_RESULT([$enable_ucount]) -fi - -TARGET=$target -AC_SUBST(TARGET) - -AC_MSG_CHECKING([whether to docdir is defined]) -if test "x$docdir" = "x" ; then -AC_MSG_RESULT([docdir undefined]) -docdir=\${datadir}/doc/\${PACKAGE_TARNAME} -AC_SUBST(docdir) -else -AC_MSG_RESULT([docdir defined]) -fi - -AC_OUTPUT diff --git a/src/cc/rogue/cursesd.c b/src/cc/rogue/cursesd.c deleted file mode 100644 index b744e4015..000000000 --- a/src/cc/rogue/cursesd.c +++ /dev/null @@ -1,435 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/****************************************************************************** - * Copyright © 2014-2019 The SuperNET Developers. * - * * - * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * - * the top-level directory of this distribution for the individual copyright * - * holder information and the developer policies on copyright and licensing. * - * * - * Unless otherwise agreed in a custom licensing agreement, no part of the * - * SuperNET software, including this file may be copied, modified, propagated * - * or distributed except according to the terms contained in the LICENSE file * - * * - * Removal or modification of this copyright notice is prohibited. * - * * - ******************************************************************************/ - -#include "cursesd.h" - -static int32_t endwinflag; -WINDOW *stdscr,*curscr; -int32_t ESCDELAY; - -WINDOW *newwin(int32_t nlines,int32_t ncols,int32_t begin_y,int32_t begin_x) -{ - WINDOW *scr = 0; - if ( nlines == LINES && ncols == COLS && begin_y == 0 && begin_x == 0 ) - scr = (WINDOW *)calloc(1,sizeof(*stdscr)); - curscr = scr; - return(scr); -} - -WINDOW *initscr() -{ - if ( stdscr == 0 ) - stdscr = newwin(LINES,COLS,0,0); - return(stdscr); -} - -int32_t delwin(WINDOW *win) -{ - free(win); - return(0); -} - -int32_t wmove(WINDOW *win, int32_t y, int32_t x) -{ - win->y = y; - win->x = x; - return(0); -} - -int32_t move(int32_t y, int32_t x) -{ - return(wmove(stdscr,y,x)); -} - -int32_t werase(WINDOW *win) -{ - memset(win->screen,' ',sizeof(win->screen)); - return(0); -} - -int32_t wclear(WINDOW *win) -{ - werase(win); - clearok(win,TRUE); - return(0); -} - -int32_t wclrtoeol(WINDOW *win) -{ - if ( win->x < COLS-1 ) - memset(&win->screen[win->y][win->x],' ',COLS - win->x); - return(0); -} - -int32_t wclrtobot(WINDOW *win) -{ - wclrtoeol(win); - if ( win->y < LINES-1 ) - memset(&win->screen[win->y+1][0],' ',COLS); - return(0); -} - -int32_t erase(void) -{ - return(werase(stdscr)); -} - -int32_t clear(void) -{ - return(wclear(stdscr)); -} - -int32_t clrtobot(void) -{ - return(wclrtobot(stdscr)); -} - -int32_t clrtoeol(void) -{ - return(wclrtoeol(stdscr)); -} - -int32_t waddch(WINDOW *win, chtype ch) -{ - int32_t i; - if ( ch == '\t' ) - { - for (i=0; i<8; i++) - { - if ( win->x >= COLS-1 ) - break; - win->x++; - if ( (win->x & 7) == 0 ) - break; - } - } - else if ( ch == '\n' ) - { - wclrtoeol(win); - win->x = 0; - win->y++; - if ( win->y >= LINES ) - win->y = 0; - } - else if ( ch == '\b' ) - { - if ( win->x > 0 ) - win->x--; - } - else - { - win->screen[win->y][win->x++] = ch; - if ( win->x >= COLS ) - { - win->x = 0; - win->y++; - if ( win->y >= LINES ) - win->y = 0; - } - } - return(0); -} - -int32_t mvwaddch(WINDOW *win, int32_t y, int32_t x, chtype ch) -{ - win->y = y; - win->x = x; - return(waddch(win,ch)); -} - -int32_t addch(chtype ch) -{ - return(waddch(stdscr,ch)); -} - -int32_t mvaddch(int32_t y, int32_t x, chtype ch) -{ - return(mvwaddch(stdscr,y,x,ch)); -} - -int32_t waddstr(WINDOW *win, const char *str) -{ - int32_t i; - //fprintf(stderr,"%s\n",str); - for (i=0; str[i]!=0; i++) - waddch(win,str[i]); - return(0); -} - -int32_t waddnstr(WINDOW *win, const char *str, int32_t n) -{ - int32_t i; - for (i=0; str[i]!=0 && iy = y; - win->x = x; - return(waddstr(win,str)); -} - -int32_t mvwaddnstr(WINDOW *win, int32_t y, int32_t x, const char *str, int32_t n) -{ - win->y = y; - win->x = x; - return(waddnstr(win,str,n)); -} - -int32_t addstr(const char *str) -{ - return(waddstr(stdscr,str)); -} - -int32_t addnstr(const char *str, int32_t n) -{ - return(waddnstr(stdscr,str,n)); -} - -int32_t mvaddstr(int32_t y, int32_t x, const char *str) -{ - stdscr->y = y; - stdscr->x = x; - return(waddstr(stdscr,str)); -} - -int32_t mvaddnstr(int32_t y, int32_t x, const char *str, int32_t n) -{ - stdscr->y = y; - stdscr->x = x; - return(waddnstr(stdscr,str,n)); -} - -int32_t printw(char *fmt,...) -{ - char str[512]; int32_t ret; va_list myargs; // Declare a va_list type variable - va_start(myargs,fmt); // Initialise the va_list variable with the ... after fmt - ret = vsprintf(str,fmt,myargs); // Forward the '...' to vsprintf - va_end(myargs); // Clean up the va_list - return(addstr(str)); -} - -int32_t wprintw(WINDOW *win,char *fmt,...) -{ - char str[512]; int32_t ret; va_list myargs; // Declare a va_list type variable - va_start(myargs,fmt); // Initialise the va_list variable with the ... after fmt - ret = vsprintf(str,fmt,myargs); // Forward the '...' to vsprintf - va_end(myargs); // Clean up the va_list - return(waddstr(win,str)); -} - -int32_t mvprintw(int32_t y,int32_t x,char *fmt,...) -{ - char str[512]; int32_t ret; va_list myargs; // Declare a va_list type variable - va_start(myargs,fmt); // Initialise the va_list variable with the ... after fmt - ret = vsprintf(str,fmt,myargs); // Forward the '...' to vsprintf - va_end(myargs); // Clean up the va_list - stdscr->y = y; - stdscr->x = x; - return(addstr(str)); -} - -int32_t mvwprintw(WINDOW *win,int32_t y,int32_t x,char *fmt,...) -{ - char str[512]; int32_t ret; va_list myargs; // Declare a va_list type variable - va_start(myargs,fmt); // Initialise the va_list variable with the ... after fmt - ret = vsprintf(str,fmt,myargs); // Forward the '...' to vsprintf - va_end(myargs); // Clean up the va_list - win->y = y; - win->x = x; - return(waddstr(win,str)); -} - -chtype winch(WINDOW *win) -{ - return(win->screen[win->y][win->x]); -} - -chtype inch(void) -{ - return(winch(stdscr)); -} - -chtype mvwinch(WINDOW *win, int32_t y, int32_t x) -{ - win->y = y; - win->x = x; - return(win->screen[win->y][win->x]); -} - -chtype mvinch(int32_t y, int32_t x) -{ - return(mvwinch(stdscr,y,x)); -} - -int32_t mvcur(int32_t oldrow, int32_t oldcol, int32_t newrow, int32_t newcol) -{ - stdscr->y = newrow; - stdscr->x = newcol; - return(0); -} - -int32_t endwin(void) -{ - if ( stdscr != 0 ) - free(stdscr), stdscr = 0; - endwinflag = 1; - return(0); -} - -int32_t isendwin(void) -{ - return(endwinflag); -} - -int32_t refresh(void) -{ - endwinflag = 0; - return(wrefresh(stdscr)); -} - -int32_t redrawwin(WINDOW *win) -{ - return(wrefresh(win)); -} - -int32_t wredrawln(WINDOW *win, int32_t beg_line, int32_t num_lines) -{ - return(wrefresh(win)); -} - -// functions with no data side effect -#ifdef they_are_macros -int32_t wrefresh(WINDOW *win) -{ - return(0); -} - -int32_t wnoutrefresh(WINDOW *win) -{ - return(0); -} - -int32_t doupdate(void) -{ - return(0); -} - -int32_t touchwin(WINDOW *win) -{ - return(0); -} - -int32_t standout(void) -{ - return(0); -} - -int32_t standend(void) -{ - return(0); -} - -int32_t raw(void) -{ - return(0); -} - -int32_t keypad(WINDOW *win, bool bf) -{ - return(0); -} - -int32_t noecho(void) -{ - return(0); -} - -int32_t flushinp(void) -{ - return(0); -} - -int32_t clearok(WINDOW *win, bool bf) -{ - return(0); -} - -int32_t idlok(WINDOW *win, bool bf) -{ - return(0); -} - -int32_t leaveok(WINDOW *win, bool bf) -{ - return(0); -} -#endif - -int32_t mvwin(WINDOW *win, int32_t y, int32_t x) // stub -{ - fprintf(stderr,"unexpected call to mvwin\n"); - return(0); -} - -WINDOW *subwin(WINDOW *orig, int32_t nlines, int32_t ncols, int32_t begin_y, int32_t begin_x) -{ - fprintf(stderr,"unexpected and unsupported call to subwin\n"); - return(0); -} - -char erasechar(void) -{ - fprintf(stderr,"unexpected and unsupported call to erasechar\n"); - return(8); -} - -char killchar(void) -{ - fprintf(stderr,"unexpected and unsupported call to erasechar\n"); - return(3); -} - -int32_t wgetnstr(WINDOW *win, char *str, int32_t n) // stub -{ - fprintf(stderr,"unexpected and unsupported call to mvgetnstr\n"); - return(0); -} - -#ifndef __MINGW32__ -int32_t getch(void) -{ - fprintf(stderr,"unexpected and unsupported call to getch\n"); - return(0); -} -#endif - -int32_t md_readchar(void) -{ - fprintf(stderr,"unexpected and unsupported call to md_readchar\n"); - return(0); -} - -char *unctrl(char c) -{ - static char ctrlstr[5]; - sprintf(ctrlstr,"^%%%02x",c); - return(ctrlstr); -} diff --git a/src/cc/rogue/cursesd.h b/src/cc/rogue/cursesd.h deleted file mode 100644 index 47615b752..000000000 --- a/src/cc/rogue/cursesd.h +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/****************************************************************************** - * Copyright © 2014-2019 The SuperNET Developers. * - * * - * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * - * the top-level directory of this distribution for the individual copyright * - * holder information and the developer policies on copyright and licensing. * - * * - * Unless otherwise agreed in a custom licensing agreement, no part of the * - * SuperNET software, including this file may be copied, modified, propagated * - * or distributed except according to the terms contained in the LICENSE file * - * * - * Removal or modification of this copyright notice is prohibited. * - * * - ******************************************************************************/ - -#ifndef H_CURSESD_H -#define H_CURSESD_H - -#define KEY_OFFSET 0x100 -#define KEY_DOWN (KEY_OFFSET + 0x02) /* Down arrow key */ -#define KEY_UP (KEY_OFFSET + 0x03) /* Up arrow key */ -#define KEY_LEFT (KEY_OFFSET + 0x04) /* Left arrow key */ -#define KEY_RIGHT (KEY_OFFSET + 0x05) /* Right arrow key */ - - -#define COLOR_BLACK 0 - -#ifdef PDC_RGB /* RGB */ -# define COLOR_RED 1 -# define COLOR_GREEN 2 -# define COLOR_BLUE 4 -#else /* BGR */ -# define COLOR_BLUE 1 -# define COLOR_GREEN 2 -# define COLOR_RED 4 -#endif - -#define COLOR_CYAN (COLOR_BLUE | COLOR_GREEN) -#define COLOR_MAGENTA (COLOR_RED | COLOR_BLUE) -#define COLOR_YELLOW (COLOR_RED | COLOR_GREEN) - -#define COLOR_WHITE 7 - -#define LINES 24 -#define COLS 80 - -#include -#include -#include -#include -#include -#include -#include /* we need va_list */ -#include /* we want wchar_t */ -#include -#include - -#include -#include -#include -#include -#include - -#define ERR (-1) - -struct cursesd_info -{ - uint8_t screen[LINES][COLS]; - int32_t x,y; -}; -typedef struct cursesd_info WINDOW; -extern WINDOW *stdscr,*curscr; -extern int32_t ESCDELAY; -typedef char chtype; - -#ifndef __MINGW32__ -int32_t getch(void); // stub -#endif - -int32_t md_readchar(void); // stub - -WINDOW *initscr(void); -int32_t endwin(void); -int32_t isendwin(void); -//SCREEN *newterm(const char *type, FILE *outfd, FILE *infd); -//SCREEN *set_term(SCREEN *new); -//void delscreen(SCREEN* sp); - -int32_t refresh(void); -int32_t wrefresh(WINDOW *win); -//int32_t wnoutrefresh(WINDOW *win); -//int32_t doupdate(void); -int32_t redrawwin(WINDOW *win); -int32_t wredrawln(WINDOW *win, int32_t beg_line, int32_t num_lines); - -int32_t erase(void); -int32_t werase(WINDOW *win); -int32_t clear(void); -int32_t wclear(WINDOW *win); -int32_t clrtobot(void); -int32_t wclrtobot(WINDOW *win); -int32_t clrtoeol(void); -int32_t wclrtoeol(WINDOW *win); - -int32_t standout(void); -int32_t standend(void); -int32_t raw(void); -int32_t noecho(void); -int32_t flushinp(void); -int32_t keypad(WINDOW *win, bool bf); - -int32_t clearok(WINDOW *win, bool bf); -int32_t idlok(WINDOW *win, bool bf); -int32_t leaveok(WINDOW *win, bool bf); - -WINDOW *newwin(int32_t nlines,int32_t ncols,int32_t begin_y,int32_t begin_x); // only LINES,COLS,0,0 -int32_t delwin(WINDOW *win); -int32_t touchwin(WINDOW *win); // stub -WINDOW *subwin(WINDOW *orig, int32_t nlines, int32_t ncols, int32_t begin_y, int32_t begin_x); // stub -int32_t mvwin(WINDOW *win, int32_t y, int32_t x); // stub -int32_t mvcur(int32_t oldrow, int32_t oldcol, int32_t newrow, int32_t newcol); - -char erasechar(void); // stub -char killchar(void); // stub - -int32_t move(int32_t y, int32_t x); -int32_t wmove(WINDOW *win, int32_t y, int32_t x); - -chtype inch(void); -chtype winch(WINDOW *win); -chtype mvinch(int32_t y, int32_t x); -chtype mvwinch(WINDOW *win, int32_t y, int32_t x); - -int32_t addch(chtype ch); -int32_t waddch(WINDOW *win, chtype ch); -int32_t mvaddch(int32_t y, int32_t x, chtype ch); -int32_t mvwaddch(WINDOW *win, int32_t y, int32_t x, chtype ch); - -int32_t addstr(const char *str); -int32_t addnstr(const char *str, int32_t n); -int32_t waddstr(WINDOW *win, const char *str); -int32_t waddnstr(WINDOW *win, const char *str, int32_t n); -int32_t mvaddstr(int32_t y, int32_t x, const char *str); -int32_t mvaddnstr(int32_t y, int32_t x, const char *str, int32_t n); -int32_t mvwaddstr(WINDOW *win, int32_t y, int32_t x, const char *str); -int32_t mvwaddnstr(WINDOW *win, int32_t y, int32_t x, const char *str, int32_t n); - -int32_t wgetnstr(WINDOW *win, char *str, int32_t n); // stub -int32_t printw(char *fmt,...); -int32_t wprintw(WINDOW *win,char *fmt,...); -int32_t mvprintw(int32_t y,int32_t x,char *fmt,...); -int32_t mvwprintw(WINDOW *win,int32_t y,int32_t x,char *fmt,...); - -char *unctrl(char c); - -#define A_CHARTEXT 0xff -#define baudrate() 9600 -#define getmaxx(a) COLS -#define getmaxy(a) LINES -#define getyx(win,_argfory,_argforx) _argfory = win->y, _argforx = win->x - -// functions with only visible effects -#define wrefresh(win) 0 -#define wnoutrefresh(win) 0 -#define doupdate() 0 -#define touchwin(win) 0 -#define standout() 0 -#define standend() 0 -#define raw() 0 -#define keypad(win,bf) 0 -#define noecho() 0 -#define flushinp() 0 -#define clearok(win,bf) 0 -#define idlok(win,bf) 0 -#define leaveok(win,bf) 0 -#define halfdelay(x) 0 -#define nocbreak() 0 -#define cbreak() 0 -#define curs_set(x) 0 - -// for tetris -#define init_pair(a,b,c) 0 -#define start_color() 0 -#define box(a,b,c) 0 -#define A_REVERSE 0 -#define COLOR_PAIR(a) 0 -#define timeout(x) 0 -// end for tetris - -#ifndef TRUE -#define TRUE 1 -#endif -#ifndef FALSE -#define FALSE 0 -#endif - -#endif - diff --git a/src/cc/rogue/daemon.c b/src/cc/rogue/daemon.c deleted file mode 100644 index fbed7c2c0..000000000 --- a/src/cc/rogue/daemon.c +++ /dev/null @@ -1,219 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * Contains functions for dealing with things that happen in the - * future. - * - * @(#)daemon.c 4.7 (Berkeley) 02/05/99 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -//#include -#include "rogue.h" - -#define EMPTY 0 -#define DAEMON -1 -#define MAXDAEMONS 20 - -#define _X_ { EMPTY } - -struct delayed_action d_list[MAXDAEMONS] = { - _X_, _X_, _X_, _X_, _X_, _X_, _X_, _X_, _X_, _X_, - _X_, _X_, _X_, _X_, _X_, _X_, _X_, _X_, _X_, _X_, -}; - -/* - * d_slot: - * Find an empty slot in the daemon/fuse list - */ -struct delayed_action * -d_slot() -{ - register struct delayed_action *dev; - - for (dev = d_list; dev <= &d_list[MAXDAEMONS-1]; dev++) - if (dev->d_type == EMPTY) - return dev; -#ifdef MASTER - debug("Ran out of fuse slots"); -#endif - return NULL; -} - -/* - * find_slot: - * Find a particular slot in the table - */ -struct delayed_action * -find_slot(void (*func)(struct rogue_state *rs,int)) -{ - register struct delayed_action *dev; - - for (dev = d_list; dev <= &d_list[MAXDAEMONS-1]; dev++) - if (dev->d_type != EMPTY && func == dev->d_func) - return dev; - return NULL; -} - -/* - * start_daemon: - * Start a daemon, takes a function. - */ -void -start_daemon(void (*func)(struct rogue_state *rs,int), int arg, int type) -{ - register struct delayed_action *dev; - - dev = d_slot(); - dev->d_type = type; - dev->d_func = func; - dev->d_arg = arg; - dev->d_time = DAEMON; -} - -/* - * kill_daemon: - * Remove a daemon from the list - */ -void -kill_daemon(void (*func)(struct rogue_state *rs,int)) -{ - register struct delayed_action *dev; - - if ((dev = find_slot(func)) == NULL) - return; - /* - * Take it out of the list - */ - dev->d_type = EMPTY; -} - -/* - * do_daemons: - * Run all the daemons that are active with the current flag, - * passing the argument to the function. - */ -void -do_daemons(struct rogue_state *rs,int flag) -{ - register struct delayed_action *dev; - - /* - * Loop through the devil list - */ - for (dev = d_list; dev <= &d_list[MAXDAEMONS-1]; dev++) - /* - * Executing each one, giving it the proper arguments - */ - if (dev->d_type == flag && dev->d_time == DAEMON) - (*dev->d_func)(rs,dev->d_arg); -} - -/* - * fuse: - * Start a fuse to go off in a certain number of turns - */ -void -fuse(void (*func)(struct rogue_state *rs,int), int arg, int time, int type) -{ - register struct delayed_action *wire; - - wire = d_slot(); - wire->d_type = type; - wire->d_func = func; - wire->d_arg = arg; - wire->d_time = time; -} - -/* - * lengthen: - * Increase the time until a fuse goes off - */ -void -lengthen(void (*func)(struct rogue_state *rs,int), int xtime) -{ - register struct delayed_action *wire; - - if ((wire = find_slot(func)) == NULL) - return; - wire->d_time += xtime; -} - -/* - * extinguish: - * Put out a fuse - */ -void -extinguish(void (*func)(struct rogue_state *rs,int)) -{ - register struct delayed_action *wire; - - if ((wire = find_slot(func)) == NULL) - return; - wire->d_type = EMPTY; -} - -/* - * do_fuses: - * Decrement counters and start needed fuses - */ - -/*char *actionfunc_str(char *str,void *ptr) -{ - if ( ptr == (void *)runners ) - strcpy(str,"runners"); - else if ( ptr == (void *)doctor ) - strcpy(str,"doctor"); - else if ( ptr == (void *)stomach ) - strcpy(str,"stomach"); - else if ( ptr == (void *)nohaste ) - strcpy(str,"nohaste"); - else if ( ptr == (void *)unconfuse ) - strcpy(str,"unconfuse"); - else if ( ptr == (void *)swander ) - strcpy(str,"swander"); - else if ( ptr == (void *)come_down ) - strcpy(str,"come_down"); - else if ( ptr == (void *)unsee ) - strcpy(str,"unsee"); - else if ( ptr == (void *)sight ) - strcpy(str,"sight"); - else if ( ptr == (void *)land ) - strcpy(str,"land"); - else if ( ptr == (void *)rollwand ) - strcpy(str,"rollwand"); - else if ( ptr == (void *)visuals ) - strcpy(str,"visuals"); - else if ( ptr == (void *)turn_see ) - strcpy(str,"turn_see"); - else strcpy(str,"no match"); - return(str); -}*/ - -void -do_fuses(struct rogue_state *rs,int flag) -{ - register struct delayed_action *wire; char str[64]; - - /* - * Step though the list - */ - for (wire = d_list; wire <= &d_list[MAXDAEMONS-1]; wire++) - /* - * Decrementing counters and starting things we want. We also need - * to remove the fuse from the list once it has gone off. - */ - if (flag == wire->d_type && wire->d_time > 0 && --wire->d_time == 0) - { - //if ( fp != 0 ) - // fprintf(fp,"t.%d %d %s, ",wire->d_type,wire->d_time,actionfunc_str(str,wire->d_func)); - wire->d_type = EMPTY; - (*wire->d_func)(rs,wire->d_arg); - } -} diff --git a/src/cc/rogue/daemons.c b/src/cc/rogue/daemons.c deleted file mode 100644 index c5fa67397..000000000 --- a/src/cc/rogue/daemons.c +++ /dev/null @@ -1,364 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * All the daemon and fuse functions are in here - * - * @(#)daemons.c 4.24 (Berkeley) 02/05/99 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -//#include -#include "rogue.h" - -/* - * doctor: - * A healing daemon that restors hit points after rest - */ -void -doctor(struct rogue_state *rs,int arg) -{ - register int lv, ohp; - if ( rs->logfp != 0 ) - fprintf(rs->logfp,"doctor\n"); - - lv = pstats.s_lvl; - ohp = pstats.s_hpt; - quiet++; - if (lv < 8) - { - if (quiet + (lv << 1) > 20) - pstats.s_hpt++; - } - else - if (quiet >= 3) - pstats.s_hpt += rnd(lv - 7) + 1; - if (ISRING(LEFT, R_REGEN)) - pstats.s_hpt++; - if (ISRING(RIGHT, R_REGEN)) - pstats.s_hpt++; - if (ohp != pstats.s_hpt) - { - if (pstats.s_hpt > max_hp) - pstats.s_hpt = max_hp; - quiet = 0; - } -} - -/* - * Swander: - * Called when it is time to start rolling for wandering monsters - */ -void -swander(struct rogue_state *rs,int arg) -{ - if ( rs->logfp != 0 ) - fprintf(rs->logfp,"swander\n"); - start_daemon(rollwand, 0, BEFORE); -} - -/* - * rollwand: - * Called to roll to see if a wandering monster starts up - */ -int between = 0; -void -rollwand(struct rogue_state *rs,int arg) -{ - if ( rs->logfp != 0 ) - fprintf(rs->logfp,"rollwand\n"); - if (++between >= 4) - { - if (roll(1, 6) == 4) - { - wanderer(rs); - kill_daemon(rollwand); - fuse(swander, 0, WANDERTIME, BEFORE); - } - between = 0; - } -} - -/* - * unconfuse: - * Release the poor player from his confusion - */ -void -unconfuse(struct rogue_state *rs,int arg) -{ - if ( rs->logfp != 0 ) - fprintf(rs->logfp,"unconfuse\n"); - player.t_flags &= ~ISHUH; - msg(rs,"you feel less %s now", choose_str("trippy", "confused")); -} - -/* - * unsee: - * Turn off the ability to see invisible - */ -void -unsee(struct rogue_state *rs,int arg) -{ - register THING *th; - if ( rs->logfp != 0 ) - fprintf(rs->logfp,"unsee\n"); - - for (th = mlist; th != NULL; th = next(th)) - if (on(*th, ISINVIS) && see_monst(th)) - mvaddch(th->t_pos.y, th->t_pos.x, th->t_oldch); - player.t_flags &= ~CANSEE; -} - -/* - * sight: - * He gets his sight back - */ -void -sight(struct rogue_state *rs,int arg) -{ - if ( rs->logfp != 0 ) - fprintf(rs->logfp,"sight\n"); - if (on(player, ISBLIND)) - { - extinguish(sight); - player.t_flags &= ~ISBLIND; - if (!(proom->r_flags & ISGONE)) - enter_room(rs,&hero); - msg(rs,choose_str("far out! Everything is all cosmic again", - "the veil of darkness lifts")); - } -} - -/* - * nohaste: - * End the hasting - */ -void -nohaste(struct rogue_state *rs,int arg) -{ - if ( rs->logfp != 0 ) - fprintf(rs->logfp,"nohaste\n"); - player.t_flags &= ~ISHASTE; - msg(rs,"you feel yourself slowing down"); -} - -/* - * stomach: - * Digest the hero's food - */ -void -stomach(struct rogue_state *rs,int arg) -{ - register int oldfood; - int orig_hungry = hungry_state; - if ( rs->logfp != 0 ) - fprintf(rs->logfp,"stomach\n"); - - if (food_left <= 0) - { - if (food_left-- < -STARVETIME) - death(rs,'s'); - /* - * the hero is fainting - */ - if (no_command || rnd(5) != 0) - return; - no_command += rnd(8) + 4; - hungry_state = 3; - if (!terse) - addmsg(rs,choose_str("the munchies overpower your motor capabilities. ", - "you feel too weak from lack of food. ")); - msg(rs,choose_str("You freak out", "You faint")); - } - else - { - oldfood = food_left; - food_left -= ring_eat(LEFT) + ring_eat(RIGHT) + 1 - amulet; - - if (food_left < MORETIME && oldfood >= MORETIME) - { - hungry_state = 2; - msg(rs,choose_str("the munchies are interfering with your motor capabilites", - "you are starting to feel weak")); - } - else if (food_left < 2 * MORETIME && oldfood >= 2 * MORETIME) - { - hungry_state = 1; - if (terse) - msg(rs,choose_str("getting the munchies", "getting hungry")); - else - msg(rs,choose_str("you are getting the munchies", - "you are starting to get hungry")); - } - } - if (hungry_state != orig_hungry) { - player.t_flags &= ~ISRUN; - running = FALSE; - to_death = FALSE; - count = 0; - } -} - -/* - * come_down: - * Take the hero down off her acid trip. - */ -void -come_down(struct rogue_state *rs,int arg) -{ - register THING *tp; - register bool seemonst; - - if ( rs->logfp != 0 ) - fprintf(rs->logfp,"come_down\n"); - if (!on(player, ISHALU)) - return; - - kill_daemon(visuals); - player.t_flags &= ~ISHALU; - - if (on(player, ISBLIND)) - return; - - /* - * undo the things - */ - for (tp = lvl_obj; tp != NULL; tp = next(tp)) - if (cansee(rs,tp->o_pos.y, tp->o_pos.x)) - mvaddch(tp->o_pos.y, tp->o_pos.x, tp->o_type); - - /* - * undo the monsters - */ - seemonst = on(player, SEEMONST); - for (tp = mlist; tp != NULL; tp = next(tp)) - { - move(tp->t_pos.y, tp->t_pos.x); - if (cansee(rs,tp->t_pos.y, tp->t_pos.x)) - if (!on(*tp, ISINVIS) || on(player, CANSEE)) - addch(tp->t_disguise); - else - addch(chat(tp->t_pos.y, tp->t_pos.x)); - else if (seemonst) - { - standout(); - addch(tp->t_type); - standend(); - } - } - msg(rs,"Everything looks SO boring now."); -} - -/* - * visuals: - * change the characters for the player - */ -void -visuals(struct rogue_state *rs,int arg) -{ - register THING *tp; - register bool seemonst; - - if (!after || (running && jump)) - return; - if ( rs->logfp != 0 ) - fprintf(rs->logfp,"visuals\n"); - /* - * change the things - */ - for (tp = lvl_obj; tp != NULL; tp = next(tp)) - if (cansee(rs,tp->o_pos.y, tp->o_pos.x)) - mvaddch(tp->o_pos.y, tp->o_pos.x, rnd_thing()); - - /* - * change the stairs - */ - if (!seenstairs && cansee(rs,stairs.y, stairs.x)) - mvaddch(stairs.y, stairs.x, rnd_thing()); - - /* - * change the monsters - */ - seemonst = on(player, SEEMONST); - for (tp = mlist; tp != NULL; tp = next(tp)) - { - move(tp->t_pos.y, tp->t_pos.x); - if (see_monst(tp)) - { - if (tp->t_type == 'X' && tp->t_disguise != 'X') - addch(rnd_thing()); - else - addch(rnd(26) + 'A'); - } - else if (seemonst) - { - standout(); - addch(rnd(26) + 'A'); - standend(); - } - } -} - -/* - * land: - * Land from a levitation potion - */ -void -land(struct rogue_state *rs,int arg) -{ - if ( rs->logfp != 0 ) - fprintf(rs->logfp,"land\n"); - player.t_flags &= ~ISLEVIT; - msg(rs,choose_str("bummer! You've hit the ground", - "you float gently to the ground")); -} - -/* - * turn_see: - * Put on or off seeing monsters on this level - */ -bool -turn_see(struct rogue_state *rs,bool turn_off) -{ - THING *mp; - bool can_see, add_new; - if ( rs->logfp != 0 ) - fprintf(rs->logfp,"turn_see\n"); - - add_new = FALSE; - for (mp = mlist; mp != NULL; mp = next(mp)) - { - move(mp->t_pos.y, mp->t_pos.x); - can_see = see_monst(mp); - if (turn_off) - { - if (!can_see) - addch(mp->t_oldch); - } - else - { - if (!can_see) - standout(); - if (!on(player, ISHALU)) - addch(mp->t_type); - else - addch(rnd(26) + 'A'); - if (!can_see) - { - standend(); - add_new ^= 1;//add_new++; - } - } - } - if (turn_off) - player.t_flags &= ~SEEMONST; - else - player.t_flags |= SEEMONST; - return add_new; -} - diff --git a/src/cc/rogue/extern.c b/src/cc/rogue/extern.c deleted file mode 100644 index 506768506..000000000 --- a/src/cc/rogue/extern.c +++ /dev/null @@ -1,519 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * global variable initializaton - * - * @(#)extern.c 4.82 (Berkeley) 02/05/99 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -//#include -#include "rogue.h" - - - -bool after; /* True if we want after daemons */ -bool again; /* Repeating the last command */ -int noscore; /* Was a wizard sometime */ -bool seenstairs; /* Have seen the stairs (for lsd) */ -bool amulet = FALSE; /* He found the amulet */ -bool door_stop = FALSE; /* Stop running when we pass a door */ -bool fight_flush = FALSE; /* True if toilet input */ -bool firstmove = FALSE; /* First move after setting door_stop */ -bool got_ltc = FALSE; /* We have gotten the local tty chars */ -bool has_hit = FALSE; /* Has a "hit" message pending in msg */ -bool in_shell = FALSE; /* True if executing a shell */ -bool inv_describe = TRUE; /* Say which way items are being used */ -bool jump = FALSE; /* Show running as series of jumps */ -bool kamikaze = FALSE; /* to_death really to DEATH */ -bool lower_msg = FALSE; /* Messages should start w/lower case */ -bool move_on = FALSE; /* Next move shouldn't pick up items */ -bool msg_esc = FALSE; /* Check for ESC from msg's --More-- */ -bool passgo = FALSE; /* Follow passages */ -bool playing = TRUE; /* True until he quits */ -bool q_comm = FALSE; /* Are we executing a 'Q' command? */ -bool running = FALSE; /* True if player is running */ -bool save_msg = TRUE; /* Remember last msg */ -bool see_floor = TRUE; /* Show the lamp illuminated floor */ -bool stat_msg = FALSE; /* Should status() print as a msg() */ -bool terse = FALSE; /* True if we should be short */ -bool to_death = FALSE; /* Fighting is to the death! */ -bool tombstone = TRUE; /* Print out tombstone at end */ -#ifdef MASTER -int wizard = FALSE; /* True if allows wizard commands */ -#endif -bool pack_used[26] = { /* Is the character used in the pack? */ - FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, - FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, - FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE -}; - -char dir_ch; /* Direction from last get_dir() call */ -char runch; /* Direction player is running */ -char take; /* Thing she is taking */ - -int orig_dsusp; /* Original dsusp char */ -char file_name[MAXSTR]; /* Save file name */ -char huh[MAXSTR]; /* The last message printed */ -char prbuf[2*MAXSTR]; /* buffer for sprintfs */ -char whoami[MAXSTR]; /* Name of player */ -char fruit[MAXSTR] = /* Favorite fruit */ - { 's', 'l', 'i', 'm', 'e', '-', 'm', 'o', 'l', 'd', '\0' }; -char home[MAXSTR] = { '\0' }; /* User's home directory */ -char l_last_comm = '\0'; /* Last last_comm */ -char l_last_dir = '\0'; /* Last last_dir */ -char last_comm = '\0'; /* Last command typed */ -char last_dir = '\0'; /* Last direction given */ - -int n_objs; /* # items listed in inventory() call */ -int ntraps; /* Number of traps on this level */ -int hungry_state = 0; /* How hungry is he */ -int inpack = 0; /* Number of things in pack */ -int inv_type = 0; /* Type of inventory to use */ -int level = 1; /* What level she is on */ -int max_hit; /* Max damage done to her in to_death */ -int max_level; /* Deepest player has gone */ -int mpos = 0; /* Where cursor is on top line */ -int no_food = 0; /* Number of levels without food */ - -int count = 0; /* Number of times to repeat command */ -int food_left; /* Amount of food in hero's stomach */ -int lastscore = -1; /* Score before this turn */ -int no_command = 0; /* Number of turns asleep */ -int no_move = 0; /* Number of turns held in place */ -int purse = 0; /* How much gold he has */ -int quiet = 0; /* Number of quiet turns */ -int vf_hit = 0; /* Number of time flytrap has hit */ - - -//int dnum; /* Dungeon number */ -uint64_t seed; /* Random number seed */ - -coord delta; /* Change indicated to get_dir() */ -coord oldpos; /* Position before last look() call */ -coord stairs; /* Location of staircase */ - -PLACE places[MAXLINES*MAXCOLS]; /* level map */ - -const char *p_colors[MAXPOTIONS]; /* Colors of the potions */ -const char *r_stones[MAXRINGS]; /* Stone settings of the rings */ -const char *ws_made[MAXSTICKS]; /* What sticks are made of */ -const char *ws_type[MAXSTICKS]; /* Is it a wand or a staff */ - -THING *cur_armor; /* What he is wearing */ -THING *cur_ring[2]; /* Which rings are being worn */ -THING *cur_weapon; /* Which weapon he is weilding */ -THING *l_last_pick = NULL; /* Last last_pick */ -THING *last_pick = NULL; /* Last object picked in get_item() */ -THING *lvl_obj = NULL; /* List of objects on this level */ -THING *mlist = NULL; /* List of monsters on the level */ -struct room *oldrp; /* Roomin(&oldpos) */ -THING player; /* His stats */ -WINDOW *hw = NULL; /* used as a scratch window */ -char *s_names[MAXSCROLLS]; /* Names of the scrolls */ -FILE *scoreboard = NULL; /* File descriptor for score file */ - -#define INIT_STATS { 16, 0, 1, 10, 12, "1x4", 12 } - -struct stats max_stats = INIT_STATS; /* The maximum for the player */ -struct stats orig_max_stats = INIT_STATS; - -struct monster monsters[26]; -struct room passages[MAXPASS],rooms[MAXROOMS]; /* One for each room -- A level */ -struct obj_info things[NUMTHINGS],ring_info[MAXRINGS],pot_info[MAXPOTIONS],arm_info[MAXARMORS],scr_info[MAXSCROLLS],weap_info[MAXWEAPONS + 1],ws_info[MAXSTICKS]; - -////////////// constants -#define ___ 1 -#define XX 10 - -const struct obj_info origthings[NUMTHINGS] = { - { 0, 26 }, /* potion */ - { 0, 36 }, /* scroll */ - { 0, 16 }, /* food */ - { 0, 7 }, /* weapon */ - { 0, 7 }, /* armor */ - { 0, 4 }, /* ring */ - { 0, 4 }, /* stick */ -}; - -const struct room origpassages[MAXPASS] = /* One for each passage */ -{ - { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, {{0,0}} }, - { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, {{0,0}} }, - { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, {{0,0}} }, - { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, {{0,0}} }, - { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, {{0,0}} }, - { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, {{0,0}} }, - { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, {{0,0}} }, - { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, {{0,0}} }, - { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, {{0,0}} }, - { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, {{0,0}} }, - { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, {{0,0}} }, - { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, {{0,0}} } -}; -const struct monster origmonsters[26] = - { -/* Name CARRY FLAG str, exp, lvl, amr, hpt, dmg */ -{ "aquator", 0, ISMEAN, { XX, 20, 5, 2, ___, "0x0/0x0" } }, -{ "bat", 0, ISFLY, { XX, 1, 1, 3, ___, "1x2" } }, -{ "centaur", 15, 0, { XX, 17, 4, 4, ___, "1x2/1x5/1x5" } }, -{ "dragon", 100, ISMEAN, { XX,5000, 10, -1, ___, "1x8/1x8/3x10" } }, -{ "emu", 0, ISMEAN, { XX, 2, 1, 7, ___, "1x2" } }, -{ "venus flytrap", 0, ISMEAN, { XX, 80, 8, 3, ___, "%%%x0" } }, - /* NOTE: the damage is %%% so that xstr won't merge this */ - /* string with others, since it is written on in the program */ -{ "griffin", 20, ISMEAN|ISFLY|ISREGEN, { XX,2000, 13, 2, ___, "4x3/3x5" } }, -{ "hobgoblin", 0, ISMEAN, { XX, 3, 1, 5, ___, "1x8" } }, -{ "ice monster", 0, 0, { XX, 5, 1, 9, ___, "0x0" } }, -{ "jabberwock", 70, 0, { XX,3000, 15, 6, ___, "2x12/2x4" } }, -{ "kestrel", 0, ISMEAN|ISFLY, { XX, 1, 1, 7, ___, "1x4" } }, -{ "leprechaun", 0, 0, { XX, 10, 3, 8, ___, "1x1" } }, -{ "medusa", 40, ISMEAN, { XX,200, 8, 2, ___, "3x4/3x4/2x5" } }, -{ "nymph", 100, 0, { XX, 37, 3, 9, ___, "0x0" } }, -{ "orc", 15, ISGREED,{ XX, 5, 1, 6, ___, "1x8" } }, -{ "phantom", 0, ISINVIS,{ XX,120, 8, 3, ___, "4x4" } }, -{ "quagga", 0, ISMEAN, { XX, 15, 3, 3, ___, "1x5/1x5" } }, -{ "rattlesnake", 0, ISMEAN, { XX, 9, 2, 3, ___, "1x6" } }, -{ "snake", 0, ISMEAN, { XX, 2, 1, 5, ___, "1x3" } }, -{ "troll", 50, ISREGEN|ISMEAN,{ XX, 120, 6, 4, ___, "1x8/1x8/2x6" } }, -{ "black unicorn", 0, ISMEAN, { XX,190, 7, -2, ___, "1x9/1x9/2x9" } }, -{ "vampire", 20, ISREGEN|ISMEAN,{ XX,350, 8, 1, ___, "1x10" } }, -{ "wraith", 0, 0, { XX, 55, 5, 4, ___, "1x6" } }, -{ "xeroc", 30, 0, { XX,100, 7, 7, ___, "4x4" } }, -{ "yeti", 30, 0, { XX, 50, 4, 6, ___, "1x6/1x6" } }, -{ "zombie", 0, ISMEAN, { XX, 6, 2, 8, ___, "1x8" } } - }; -#undef ___ -#undef XX - -const struct obj_info origarm_info[MAXARMORS] = { - { "leather armor", 20, 20, NULL, FALSE }, - { "ring mail", 15, 25, NULL, FALSE }, - { "studded leather armor", 15, 20, NULL, FALSE }, - { "scale mail", 13, 30, NULL, FALSE }, - { "chain mail", 12, 75, NULL, FALSE }, - { "splint mail", 10, 80, NULL, FALSE }, - { "banded mail", 10, 90, NULL, FALSE }, - { "plate mail", 5, 150, NULL, FALSE }, -}; -const struct obj_info origpot_info[MAXPOTIONS] = { - { "confusion", 7, 5, NULL, FALSE }, - { "hallucination", 8, 5, NULL, FALSE }, - { "poison", 8, 5, NULL, FALSE }, - { "gain strength", 13, 150, NULL, FALSE }, - { "see invisible", 3, 100, NULL, FALSE }, - { "healing", 13, 130, NULL, FALSE }, - { "monster detection", 6, 130, NULL, FALSE }, - { "magic detection", 6, 105, NULL, FALSE }, - { "raise level", 2, 250, NULL, FALSE }, - { "extra healing", 5, 200, NULL, FALSE }, - { "haste self", 5, 190, NULL, FALSE }, - { "restore strength", 13, 130, NULL, FALSE }, - { "blindness", 5, 5, NULL, FALSE }, - { "levitation", 6, 75, NULL, FALSE }, -}; -const struct obj_info origring_info[MAXRINGS] = { - { "protection", 9, 400, NULL, FALSE }, - { "add strength", 9, 400, NULL, FALSE }, - { "sustain strength", 5, 280, NULL, FALSE }, - { "searching", 10, 420, NULL, FALSE }, - { "see invisible", 10, 310, NULL, FALSE }, - { "adornment", 1, 10, NULL, FALSE }, - { "aggravate monster", 10, 10, NULL, FALSE }, - { "dexterity", 8, 440, NULL, FALSE }, - { "increase damage", 8, 400, NULL, FALSE }, - { "regeneration", 4, 460, NULL, FALSE }, - { "slow digestion", 9, 240, NULL, FALSE }, - { "teleportation", 5, 30, NULL, FALSE }, - { "stealth", 7, 470, NULL, FALSE }, - { "maintain armor", 5, 380, NULL, FALSE }, -}; -const struct obj_info origscr_info[MAXSCROLLS] = { - { "monster confusion", 7, 140, NULL, FALSE }, - { "magic mapping", 4, 150, NULL, FALSE }, - { "hold monster", 2, 180, NULL, FALSE }, - { "sleep", 3, 5, NULL, FALSE }, - { "enchant armor", 7, 160, NULL, FALSE }, - { "identify potion", 10, 80, NULL, FALSE }, - { "identify scroll", 10, 80, NULL, FALSE }, - { "identify weapon", 6, 80, NULL, FALSE }, - { "identify armor", 7, 100, NULL, FALSE }, - { "identify ring, wand or staff", 10, 115, NULL, FALSE }, - { "scare monster", 3, 200, NULL, FALSE }, - { "food detection", 2, 60, NULL, FALSE }, - { "teleportation", 5, 165, NULL, FALSE }, - { "enchant weapon", 8, 150, NULL, FALSE }, - { "create monster", 4, 75, NULL, FALSE }, - { "remove curse", 7, 105, NULL, FALSE }, - { "aggravate monsters", 3, 20, NULL, FALSE }, - { "protect armor", 2, 250, NULL, FALSE }, -}; -const struct obj_info origweap_info[MAXWEAPONS + 1] = { - { "mace", 11, 8, NULL, FALSE }, - { "long sword", 11, 15, NULL, FALSE }, - { "short bow", 12, 15, NULL, FALSE }, - { "arrow", 12, 1, NULL, FALSE }, - { "dagger", 8, 3, NULL, FALSE }, - { "two handed sword", 10, 75, NULL, FALSE }, - { "dart", 12, 2, NULL, FALSE }, - { "shuriken", 12, 5, NULL, FALSE }, - { "spear", 12, 5, NULL, FALSE }, - { NULL, 0 }, /* DO NOT REMOVE: fake entry for dragon's breath */ -}; -const struct obj_info origws_info[MAXSTICKS] = { - { "light", 12, 250, NULL, FALSE }, - { "invisibility", 6, 5, NULL, FALSE }, - { "lightning", 3, 330, NULL, FALSE }, - { "fire", 3, 330, NULL, FALSE }, - { "cold", 3, 330, NULL, FALSE }, - { "polymorph", 15, 310, NULL, FALSE }, - { "magic missile", 10, 170, NULL, FALSE }, - { "haste monster", 10, 5, NULL, FALSE }, - { "slow monster", 11, 350, NULL, FALSE }, - { "drain life", 9, 300, NULL, FALSE }, - { "nothing", 1, 5, NULL, FALSE }, - { "teleport away", 6, 340, NULL, FALSE }, - { "teleport to", 6, 50, NULL, FALSE }, - { "cancellation", 5, 280, NULL, FALSE }, -}; - -const struct h_list helpstr[] = { - {'?', " prints help", TRUE}, - {'/', " identify object", TRUE}, - {'h', " left", TRUE}, - {'j', " down", TRUE}, - {'k', " up", TRUE}, - {'l', " right", TRUE}, - {'y', " up & left", TRUE}, - {'u', " up & right", TRUE}, - {'b', " down & left", TRUE}, - {'n', " down & right", TRUE}, - {'H', " run left", FALSE}, - {'J', " run down", FALSE}, - {'K', " run up", FALSE}, - {'L', " run right", FALSE}, - {'Y', " run up & left", FALSE}, - {'U', " run up & right", FALSE}, - {'B', " run down & left", FALSE}, - {'N', " run down & right", FALSE}, - {CTRL('H'), " run left until adjacent", FALSE}, - {CTRL('J'), " run down until adjacent", FALSE}, - {CTRL('K'), " run up until adjacent", FALSE}, - {CTRL('L'), " run right until adjacent", FALSE}, - {CTRL('Y'), " run up & left until adjacent", FALSE}, - {CTRL('U'), " run up & right until adjacent", FALSE}, - {CTRL('B'), " run down & left until adjacent", FALSE}, - {CTRL('N'), " run down & right until adjacent", FALSE}, - {'\0', " : run that way", TRUE}, - {'\0', " : run till adjacent", TRUE}, - {'f', " fight till death or near death", TRUE}, - {'t', " throw something", TRUE}, - {'m', " move onto without picking up", TRUE}, - {'z', " zap a wand in a direction", TRUE}, - {'^', " identify trap type", TRUE}, - {'s', " search for trap/secret door", TRUE}, - {'>', " go down a staircase", TRUE}, - {'<', " go up a staircase", TRUE}, - {'.', " rest for a turn", TRUE}, - {',', " pick something up", TRUE}, - {'i', " inventory", TRUE}, - {'I', " inventory single item", TRUE}, - {'q', " quaff potion", TRUE}, - {'r', " read scroll", TRUE}, - {'e', " eat food", TRUE}, - {'w', " wield a weapon", TRUE}, - {'W', " wear armor", TRUE}, - {'T', " take armor off", TRUE}, - {'P', " put on ring", TRUE}, - {'R', " remove ring", TRUE}, - {'d', " drop object", TRUE}, - {'c', " call object", TRUE}, - {'a', " repeat last command", TRUE}, - {')', " print current weapon", TRUE}, - {']', " print current armor", TRUE}, - {'=', " print current rings", TRUE}, - {'@', " print current stats", TRUE}, - {'D', " recall what's been discovered", TRUE}, - {'o', " examine/set options", TRUE}, - {CTRL('R'), " redraw screen", TRUE}, - {CTRL('P'), " repeat last message", TRUE}, - {ESCAPE, " cancel command", TRUE}, - {'S', " save game", TRUE}, - {'Q', " quit", TRUE}, - {'!', " shell escape", TRUE}, - {'F', " fight till either of you dies", TRUE}, - {'v', " print version number", TRUE}, - {0, NULL } -}; - -const char *inv_t_name[] = { - "Overwrite", - "Slow", - "Clear" -}; - -const char *tr_name[] = { /* Names of the traps */ - "a trapdoor", - "an arrow trap", - "a sleeping gas trap", - "a beartrap", - "a teleport trap", - "a poison dart trap", - "a rust trap", - "a mysterious trap" -}; - -const int32_t a_class[MAXARMORS] = { /* Armor class for each armor type */ - 8, /* LEATHER */ - 7, /* RING_MAIL */ - 7, /* STUDDED_LEATHER */ - 6, /* SCALE_MAIL */ - 5, /* CHAIN_MAIL */ - 4, /* SPLINT_MAIL */ - 4, /* BANDED_MAIL */ - 3, /* PLATE_MAIL */ -}; - -const int32_t e_levels[] = { - 10L, - 20L, - 40L, - 80L, - 160L, - 320L, - 640L, - 1300L, - 2600L, - 5200L, - 13000L, - 26000L, - 50000L, - 100000L, - 200000L, - 400000L, - 800000L, - 2000000L, - 4000000L, - 8000000L, - 0L -}; - -#include -extern int between; -extern int group; -extern coord nh; - -void externs_clear() -{ - int i; - after = 0; /* True if we want after daemons */ - again = 0; /* Repeating the last command */ - noscore = 0; /* Was a wizard sometime */ - seenstairs = 0; /* Have seen the stairs (for lsd) */ - amulet = FALSE; /* He found the amulet */ - door_stop = FALSE; /* Stop running when we pass a door */ - fight_flush = FALSE; /* True if toilet input */ - firstmove = FALSE; /* First move after setting door_stop */ - got_ltc = FALSE; /* We have gotten the local tty chars */ - has_hit = FALSE; /* Has a "hit" message pending in msg */ - in_shell = FALSE; /* True if executing a shell */ - inv_describe = TRUE; /* Say which way items are being used */ - jump = FALSE; /* Show running as series of jumps */ - kamikaze = FALSE; /* to_death really to DEATH */ - lower_msg = FALSE; /* Messages should start w/lower case */ - move_on = FALSE; /* Next move shouldn't pick up items */ - msg_esc = FALSE; /* Check for ESC from msg's --More-- */ - passgo = FALSE; /* Follow passages */ - playing = TRUE; /* True until he quits */ - q_comm = FALSE; /* Are we executing a 'Q' command? */ - running = FALSE; /* True if player is running */ - save_msg = TRUE; /* Remember last msg */ - see_floor = TRUE; /* Show the lamp illuminated floor */ - stat_msg = FALSE; /* Should status() print as a msg() */ - terse = FALSE; /* True if we should be short */ - to_death = FALSE; /* Fighting is to the death! */ - tombstone = TRUE; /* Print out tombstone at end */ -#ifdef MASTER - int wizard = FALSE; /* True if allows wizard commands */ -#endif - for (i=0; i<26; i++) - pack_used[i] = FALSE; - for (i=0; i -#include - -#ifdef HAVE_CONFIG_H -#ifdef PDCURSES -#undef HAVE_UNISTD_H -#undef HAVE_LIMITS_H -#undef HAVE_MEMORY_H -#undef HAVE_STRING_H -#endif -#include -#include "config.h" -#elif defined(__DJGPP__) -#define HAVE_SYS_TYPES_H 1 -#define HAVE_PROCESS_H 1 -#define HAVE_PWD_H 1 -#define HAVE_TERMIOS_H 1 -#define HAVE_SETGID 1 -#define HAVE_GETGID 1 -#define HAVE_SETUID 1 -#define HAVE_GETUID 1 -#define HAVE_GETPASS 1 -#define HAVE_SPAWNL 1 -#define HAVE_ALARM 1 -#define HAVE_ERASECHAR 1 -#define HAVE_KILLCHAR 1 -#elif defined(_WIN32) -#define HAVE_CURSES_H -#define HAVE_TERM_H -#define HAVE__SPAWNL -#define HAVE_SYS_TYPES_H -#define HAVE_PROCESS_H -#define HAVE_ERASECHAR 1 -#define HAVE_KILLCHAR 1 -#elif defined(__CYGWIN__) -#define HAVE_SYS_TYPES_H 1 -#define HAVE_PWD_H 1 -#define HAVE_PWD_H 1 -#define HAVE_SYS_UTSNAME_H 1 -#define HAVE_ARPA_INET_H 1 -#define HAVE_UNISTD_H 1 -#define HAVE_TERMIOS_H 1 -#define HAVE_NCURSES_TERM_H 1 -#define HAVE_ESCDELAY -#define HAVE_SETGID 1 -#define HAVE_GETGID 1 -#define HAVE_SETUID 1 -#define HAVE_GETUID 1 -#define HAVE_GETPASS 1 -#define HAVE_GETPWUID 1 -#define HAVE_WORKING_FORK 1 -#define HAVE_ALARM 1 -#define HAVE_SPAWNL 1 -#define HAVE__SPAWNL 1 -#define HAVE_ERASECHAR 1 -#define HAVE_KILLCHAR 1 -#else /* POSIX */ -#define HAVE_SYS_TYPES_H 1 -#define HAVE_PWD_H 1 -#define HAVE_PWD_H 1 -#define HAVE_SYS_UTSNAME_H 1 -#define HAVE_ARPA_INET_H 1 -#define HAVE_UNISTD_H 1 -#define HAVE_TERMIOS_H 1 -#define HAVE_TERM_H 1 -#define HAVE_SETGID 1 -#define HAVE_GETGID 1 -#define HAVE_SETUID 1 -#define HAVE_GETUID 1 -#define HAVE_SETREUID 1 -#define HAVE_SETREGID 1 -#define HAVE_GETPASS 1 -#define HAVE_GETPWUID 1 -#define HAVE_WORKING_FORK 1 -#define HAVE_ERASECHAR 1 -#define HAVE_KILLCHAR 1 -#ifndef _AIX -#define HAVE_GETLOADAVG 1 -#endif -#define HAVE_ALARM 1 -#endif - -#ifdef __DJGPP__ -#undef HAVE_GETPWUID /* DJGPP's limited version doesn't even work as documented */ -#endif - -/* - * Don't change the constants, since they are used for sizes in many - * places in the program. - */ - -#include -#include - -#ifdef _WIN32 -#ifdef _MSC_VER -#include -#endif -#endif - -#undef SIGTSTP - -#define MAXSTR 1024 /* maximum length of strings */ -#define MAXLINES 32 /* maximum number of screen lines used */ -#define MAXCOLS 80 /* maximum number of screen columns used */ - -#define RN ((int32_t)((seed = seed*11109+13849) >> 16) & 0xffff) -#ifdef CTRL -#undef CTRL -#endif -#define CTRL(c) (c & 037) - -/* - * Now all the global variables - */ - -extern bool got_ltc, in_shell; -extern int wizard; -extern char fruit[], prbuf[], whoami[]; -extern int orig_dsusp; -extern FILE *scoreboard; - -/* - * Function types - */ -void externs_clear(); - -void auto_save(int); -void endit(int sig); -void fatal(char *); -void getltchars(void); -void leave(int); -void my_exit(int st); -void playltchars(void); -void quit(int); -int32_t _quit(); - -void resetltchars(void); -void set_order(int *order, int numthings); -void tstp(int ignored); - -char *killname(char monst, bool doart); -char *nothing(char type); -char *type_name(int type); - -#ifdef CHECKTIME -int checkout(void); -#endif - -int md_chmod(char *filename, int mode); -char *md_crypt(char *key, char *salt); -int md_dsuspchar(void); -int md_erasechar(void); -char *md_gethomedir(void); -char *md_getusername(void); -int md_getuid(void); -char *md_getpass(char *prompt); -int md_getpid(void); -char *md_getrealname(int uid); -void md_init(void); -int md_killchar(void); -void md_normaluser(void); -void md_raw_standout(void); -void md_raw_standend(void); -int md_readchar(void); -int md_setdsuspchar(int c); -int md_shellescape(void); -void md_sleep(int s); -int md_suspchar(void); -int md_hasclreol(void); -int md_unlink(char *file); -int md_unlink_open_file(char *file, FILE *inf); -void md_tstpsignal(void); -void md_tstphold(void); -void md_tstpresume(void); -void md_ignoreallsignals(void); -void md_onsignal_autosave(void); -void md_onsignal_exit(void); -void md_onsignal_default(void); -int md_issymlink(char *sp); - -int32_t decode_hex(uint8_t *bytes,int32_t n,char *hex); - -#endif - diff --git a/src/cc/rogue/fight.c b/src/cc/rogue/fight.c deleted file mode 100644 index 304c48288..000000000 --- a/src/cc/rogue/fight.c +++ /dev/null @@ -1,684 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * All the fighting gets done here - * - * @(#)fight.c 4.67 (Berkeley) 09/06/83 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -//#include -//#include -//#include -//#include -#include "rogue.h" - -//#define EQSTR(a, b) (strcmp(a, b) == 0) - -const char *h_names[] = { /* strings for hitting */ - " scored an excellent hit on ", - " hit ", - " have injured ", - " swing and hit ", - " scored an excellent hit on ", - " hit ", - " has injured ", - " swings and hits " -}; - -const char *m_names[] = { /* strings for missing */ - " miss", - " swing and miss", - " barely miss", - " don't hit", - " misses", - " swings and misses", - " barely misses", - " doesn't hit", -}; - -/* - * adjustments to hit probabilities due to strength - */ -static const int str_plus[] = { - -7, -6, -5, -4, -3, -2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, - 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, -}; - -/* - * adjustments to damage done due to strength - */ -static const int add_dam[] = { - -7, -6, -5, -4, -3, -2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3, - 3, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6 -}; - -/* - * fight: - * The player attacks the monster. - */ -int -fight(struct rogue_state *rs,coord *mp, THING *weap, bool thrown) -{ - register THING *tp; - register bool did_hit = TRUE; - register char *mname, ch; - - /* - * Find the monster we want to fight - */ -#ifdef MASTER - if ((tp = moat(mp->y, mp->x)) == NULL) - debug("Fight what @ %d,%d", mp->y, mp->x); -#else - tp = moat(mp->y, mp->x); -#endif - /* - * Since we are fighting, things are not quiet so no healing takes - * place. - */ - count = 0; - quiet = 0; - runto(rs,mp); - /* - * Let him know it was really a xeroc (if it was one). - */ - ch = '\0'; - if (tp->t_type == 'X' && tp->t_disguise != 'X' && !on(player, ISBLIND)) - { - tp->t_disguise = 'X'; - if (on(player, ISHALU)) { - ch = (char)(rnd(26) + 'A'); - mvaddch(tp->t_pos.y, tp->t_pos.x, ch); - } - msg(rs,choose_str("heavy! That's a nasty critter!", - "wait! That's a xeroc!")); - if (!thrown) - return FALSE; - } - mname = set_mname(tp); - did_hit = FALSE; - has_hit = (terse && !to_death); - if (roll_em(&player, tp, weap, thrown)) - { - did_hit = FALSE; - if (thrown) - thunk(rs,weap, mname, terse); - else - hit(rs,(char *) NULL, mname, terse); - if (on(player, CANHUH)) - { - did_hit = TRUE; - tp->t_flags |= ISHUH; - player.t_flags &= ~CANHUH; - endmsg(rs); - has_hit = FALSE; - msg(rs,"your hands stop glowing %s", pick_color("red")); - } - if (tp->t_stats.s_hpt <= 0) - killed(rs,tp, TRUE); - else if (did_hit && !on(player, ISBLIND)) - msg(rs,"%s appears confused", mname); - did_hit = TRUE; - } - else - if (thrown) - bounce(rs,weap, mname, terse); - else - miss(rs,(char *) NULL, mname, terse); - return did_hit; -} - -/* - * attack: - * The monster attacks the player - */ -int -attack(struct rogue_state *rs,THING *mp) -{ - register char *mname; - register int oldhp; - - /* - * Since this is an attack, stop running and any healing that was - * going on at the time. - */ - running = FALSE; - count = 0; - quiet = 0; - if (to_death && !on(*mp, ISTARGET)) - { - to_death = FALSE; - kamikaze = FALSE; - } - if (mp->t_type == 'X' && mp->t_disguise != 'X' && !on(player, ISBLIND)) - { - mp->t_disguise = 'X'; - if (on(player, ISHALU)) - mvaddch(mp->t_pos.y, mp->t_pos.x, rnd(26) + 'A'); - } - mname = set_mname(mp); - oldhp = pstats.s_hpt; - if (roll_em(mp, &player, (THING *) NULL, FALSE)) - { - if (mp->t_type != 'I') - { - if (has_hit) - addmsg(rs,". "); - hit(rs,mname, (char *) NULL, FALSE); - } - else - if (has_hit) - endmsg(rs); - has_hit = FALSE; - if (pstats.s_hpt <= 0) - death(rs,mp->t_type); /* Bye bye life ... */ - else if (!kamikaze) - { - oldhp -= pstats.s_hpt; - if (oldhp > max_hit) - max_hit = oldhp; - if (pstats.s_hpt <= max_hit) - to_death = FALSE; - } - if (!on(*mp, ISCANC)) - switch (mp->t_type) - { - case 'A': - /* - * If an aquator hits, you can lose armor class. - */ - rust_armor(rs,cur_armor); - when 'I': - /* - * The ice monster freezes you - */ - player.t_flags &= ~ISRUN; - if (!no_command) - { - addmsg(rs,"you are frozen"); - if (!terse) - addmsg(rs," by the %s", mname); - endmsg(rs); - } - no_command += rnd(2) + 2; - if (no_command > BORE_LEVEL) - death(rs,'h'); - when 'R': - /* - * Rattlesnakes have poisonous bites - */ - if (!save(VS_POISON)) - { - if (!ISWEARING(R_SUSTSTR)) - { - chg_str(-1); - if (!terse) - msg(rs,"you feel a bite in your leg and now feel weaker"); - else - msg(rs,"a bite has weakened you"); - } - else if (!to_death) - { - if (!terse) - msg(rs,"a bite momentarily weakens you"); - else - msg(rs,"bite has no effect"); - } - } - when 'W': - case 'V': - /* - * Wraiths might drain energy levels, and Vampires - * can steal max_hp - */ - if (rnd(100) < (mp->t_type == 'W' ? 15 : 30)) - { - register int fewer; - - if (mp->t_type == 'W') - { - if (pstats.s_exp == 0) - death(rs,'W'); /* All levels gone */ - if (--pstats.s_lvl == 0) - { - pstats.s_exp = 0; - pstats.s_lvl = 1; - } - else - pstats.s_exp = e_levels[pstats.s_lvl-1]+1; - fewer = roll(1, 10); - } - else - fewer = roll(1, 3); - pstats.s_hpt -= fewer; - max_hp -= fewer; - if (pstats.s_hpt <= 0) - pstats.s_hpt = 1; - if (max_hp <= 0) - death(rs,mp->t_type); - msg(rs,"you suddenly feel weaker"); - } - when 'F': - /* - * Venus Flytrap stops the poor guy from moving - */ - player.t_flags |= ISHELD; - sprintf(monsters['F'-'A'].m_stats.s_dmg,"%dx1", ++vf_hit); - if (--pstats.s_hpt <= 0) - death(rs,'F'); - when 'L': - { - /* - * Leperachaun steals some gold - */ - register int lastpurse; - - lastpurse = purse; - purse -= GOLDCALC; - if (!save(VS_MAGIC)) - purse -= GOLDCALC + GOLDCALC + GOLDCALC + GOLDCALC; - if (purse < 0) - purse = 0; - remove_mon(rs,&mp->t_pos, mp, FALSE); - mp=NULL; - if (purse != lastpurse) - msg(rs,"your purse feels lighter"); - } - when 'N': - { - THING *obj, *steal; int nobj; - - /* - * Nymph's steal a magic item, look through the pack - * and pick out one we like. - */ - steal = NULL; - for (nobj = 0, obj = pack; obj != NULL; obj = next(obj)) - if (obj != cur_armor && obj != cur_weapon - && obj != cur_ring[LEFT] && obj != cur_ring[RIGHT] - && is_magic(obj) && rnd(++nobj) == 0) - steal = obj; - if (steal != NULL) - { - remove_mon(rs,&mp->t_pos, moat(mp->t_pos.y, mp->t_pos.x), FALSE); - mp=NULL; - leave_pack(rs,steal, FALSE, FALSE); - msg(rs,"she stole %s!", inv_name(steal, TRUE)); - if ( steal->o_count <= 0 ) - discard(steal); - } - } - otherwise: - break; - } - } - else if (mp->t_type != 'I') - { - if (has_hit) - { - addmsg(rs,". "); - has_hit = FALSE; - } - if (mp->t_type == 'F') - { - pstats.s_hpt -= vf_hit; - if (pstats.s_hpt <= 0) - death(rs,mp->t_type); /* Bye bye life ... */ - } - miss(rs,mname, (char *) NULL, FALSE); - } - if (fight_flush && !to_death) - flush_type(); - count = 0; - status(rs); - if (mp == NULL) - return(-1); - else - return(0); -} - -/* - * set_mname: - * return the monster name for the given monster - */ -char * -set_mname(THING *tp) -{ - int ch; - char *mname; - static char tbuf[MAXSTR] = { 't', 'h', 'e', ' ' }; - - if (!see_monst(tp) && !on(player, SEEMONST)) - return (terse ? (char *)"it" : (char *)"something"); - else if (on(player, ISHALU)) - { - move(tp->t_pos.y, tp->t_pos.x); - ch = toascii(inch()); - if (!isupper(ch)) - ch = rnd(26); - else - ch -= 'A'; - mname = monsters[ch].m_name; - } - else - mname = monsters[tp->t_type - 'A'].m_name; - strcpy(&tbuf[4], mname); - return tbuf; -} - -/* - * swing: - * Returns true if the swing hits - */ -int -swing(int at_lvl, int op_arm, int wplus) -{ - int res = rnd(20); - int need = (20 - at_lvl) - op_arm; - - return (res + wplus >= need); -} - -/* - * roll_em: - * Roll several attacks - */ -bool -roll_em(THING *thatt, THING *thdef, THING *weap, bool hurl) -{ - register struct stats *att, *def; - register char *cp; - register int ndice, nsides, def_arm; - register bool did_hit = FALSE; - register int hplus; - register int dplus; - register int damage; - - att = &thatt->t_stats; - def = &thdef->t_stats; - if (weap == NULL) - { - cp = att->s_dmg; - dplus = 0; - hplus = 0; - } - else - { - hplus = (weap == NULL ? 0 : weap->o_hplus); - dplus = (weap == NULL ? 0 : weap->o_dplus); - if (weap == cur_weapon) - { - if (ISRING(LEFT, R_ADDDAM)) - dplus += cur_ring[LEFT]->o_arm; - else if (ISRING(LEFT, R_ADDHIT)) - hplus += cur_ring[LEFT]->o_arm; - if (ISRING(RIGHT, R_ADDDAM)) - dplus += cur_ring[RIGHT]->o_arm; - else if (ISRING(RIGHT, R_ADDHIT)) - hplus += cur_ring[RIGHT]->o_arm; - } - cp = weap->o_damage; - if (hurl) - { - if ((weap->o_flags&ISMISL) && cur_weapon != NULL && - cur_weapon->o_which == weap->o_launch) - { - cp = weap->o_hurldmg; - hplus += cur_weapon->o_hplus; - dplus += cur_weapon->o_dplus; - } - else if (weap->o_launch < 0) - cp = weap->o_hurldmg; - } - } - /* - * If the creature being attacked is not running (alseep or held) - * then the attacker gets a plus four bonus to hit. - */ - if (!on(*thdef, ISRUN)) - hplus += 4; - def_arm = def->s_arm; - if (def == &pstats) - { - if (cur_armor != NULL) - def_arm = cur_armor->o_arm; - if (ISRING(LEFT, R_PROTECT)) - def_arm -= cur_ring[LEFT]->o_arm; - if (ISRING(RIGHT, R_PROTECT)) - def_arm -= cur_ring[RIGHT]->o_arm; - } - while(cp != NULL && *cp != '\0') - { - ndice = atoi(cp); - if ((cp = strchr(cp, 'x')) == NULL) - break; - nsides = atoi(++cp); - if (swing(att->s_lvl, def_arm, hplus + str_plus[att->s_str])) - { - int proll; - - proll = roll(ndice, nsides); -#ifdef MASTER - if (ndice + nsides > 0 && proll <= 0) - debug("Damage for %dx%d came out %d, dplus = %d, add_dam = %d, def_arm = %d", ndice, nsides, proll, dplus, add_dam[att->s_str], def_arm); -#endif - damage = dplus + proll + add_dam[att->s_str]; - def->s_hpt -= max(0, damage); - did_hit = TRUE; - } - if ((cp = strchr(cp, '/')) == NULL) - break; - cp++; - } - return did_hit; -} - -/* - * prname: - * The print name of a combatant - */ -char * -prname(char *mname, bool upper) -{ - static char tbuf[MAXSTR]; - - *tbuf = '\0'; - if (mname == 0) - strcpy(tbuf, "you"); - else - strcpy(tbuf, mname); - if (upper) - *tbuf = (char) toupper(*tbuf); - return tbuf; -} - -/* - * thunk: - * A missile hits a monster - */ -void -thunk(struct rogue_state *rs,THING *weap, char *mname, bool noend) -{ - if (to_death) - return; - if (weap->o_type == WEAPON) - addmsg(rs,"the %s hits ", weap_info[weap->o_which].oi_name); - else - addmsg(rs,"you hit "); - addmsg(rs,"%s", mname); - if (!noend) - endmsg(rs); -} - -/* - * hit: - * Print a message to indicate a succesful hit - */ - -void -hit(struct rogue_state *rs,char *er, char *ee, bool noend) -{ - int32_t i; const char *s; - - if (to_death) - return; - addmsg(rs,prname(er, TRUE)); - if (terse) - s = " hit"; - else - { - i = rnd(4); - if (er != NULL) - i += 4; - s = h_names[i]; - } - addmsg(rs,(char *)s); - if (!terse) - addmsg(rs,prname(ee, FALSE)); - if (!noend) - endmsg(rs); -} - -/* - * miss: - * Print a message to indicate a poor swing - */ -void -miss(struct rogue_state *rs,char *er, char *ee, bool noend) -{ - int i; - - if (to_death) - return; - addmsg(rs,prname(er, TRUE)); - if (terse) - i = 0; - else - i = rnd(4); - if (er != NULL) - i += 4; - addmsg(rs,(char *)m_names[i]); - if (!terse) - addmsg(rs," %s", prname(ee, FALSE)); - if (!noend) - endmsg(rs); -} - -/* - * bounce: - * A missile misses a monster - */ -void -bounce(struct rogue_state *rs,THING *weap, char *mname, bool noend) -{ - if (to_death) - return; - if (weap->o_type == WEAPON) - addmsg(rs,"the %s misses ", weap_info[weap->o_which].oi_name); - else - addmsg(rs,"you missed "); - addmsg(rs,mname); - if (!noend) - endmsg(rs); -} - -/* - * remove_mon: - * Remove a monster from the screen - */ -void -remove_mon(struct rogue_state *rs,coord *mp, THING *tp, bool waskill) -{ - register THING *obj, *nexti; - for (obj = tp->t_pack; obj != NULL; obj = nexti) - { - nexti = next(obj); - obj->o_pos = tp->t_pos; - detach(tp->t_pack, obj); - if (waskill) - fall(rs,obj, FALSE); - else discard(obj); - } - moat(mp->y, mp->x) = NULL; - mvaddch(mp->y, mp->x, tp->t_oldch); - detach(mlist, tp); - if (on(*tp, ISTARGET)) - { - kamikaze = FALSE; - to_death = FALSE; - if (fight_flush) - flush_type(); - } - discard(tp); -} - -/* - * killed: - * Called to put a monster to death - */ -void -killed(struct rogue_state *rs,THING *tp, bool pr) -{ - char *mname; - - pstats.s_exp += tp->t_stats.s_exp; - - /* - * If the monster was a venus flytrap, un-hold him - */ - switch (tp->t_type) - { - case 'F': - player.t_flags &= ~ISHELD; - vf_hit = 0; - strcpy(monsters['F'-'A'].m_stats.s_dmg, "000x0"); - when 'L': - { - THING *gold; - - if (fallpos(&tp->t_pos, &tp->t_room->r_gold) && level >= max_level) - { - gold = new_item(); - gold->o_type = GOLD; - gold->o_goldval = GOLDCALC; - if (save(VS_MAGIC)) - gold->o_goldval += GOLDCALC + GOLDCALC - + GOLDCALC + GOLDCALC; - attach(tp->t_pack, gold); - } - } - } - /* - * Get rid of the monster. - */ - mname = set_mname(tp); - remove_mon(rs,&tp->t_pos, tp, TRUE); - if (pr) - { - if (has_hit) - { - addmsg(rs,". Defeated "); - has_hit = FALSE; - } - else - { - if (!terse) - addmsg(rs,"you have "); - addmsg(rs,"defeated "); - } - msg(rs,mname); - } - /* - * Do adjustments if he went up a level - */ - check_level(rs); - if (fight_flush) - flush_type(); -} diff --git a/src/cc/rogue/init.c b/src/cc/rogue/init.c deleted file mode 100644 index 18d5c3f7f..000000000 --- a/src/cc/rogue/init.c +++ /dev/null @@ -1,498 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * global variable initializaton - * - * @(#)init.c 4.31 (Berkeley) 02/05/99 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -//#include -//#include -//#include -//#include -#include "rogue.h" - -/* - * init_player: - * Roll her up - */ -void rogue_restoreobject(THING *o,struct rogue_packitem *item); - -int32_t rogue_total(THING *o) -{ - if ( (o->o_flags & ISMANY) != 0 ) - return(1); - else return(o->o_count); -} - -void restore_player(struct rogue_state *rs) -{ - int32_t i,total = 0; THING *obj; - //rs->P.gold = purse; - max_hp = rs->P.hitpoints; - //pstats.s_hpt = max_hp; - pstats.s_str = rs->P.strength & 0xffff; - if ( (max_stats.s_str= (rs->P.strength >> 16) & 0xffff) == 0 ) - max_stats.s_str = 16; - if ( pstats.s_str > max_stats.s_str ) - pstats.s_str = max_stats.s_str; - pstats.s_lvl = rs->P.level; - pstats.s_exp = rs->P.experience; - for (i=0; iP.packsize&&iP.roguepack[i]); - total += rogue_total(obj); - if ( total > ROGUE_MAXTOTAL ) - break; - add_pack(rs,obj,TRUE); - } -} - -void init_player(struct rogue_state *rs) -{ - register THING *obj; int32_t i; - pstats = max_stats; - food_left = HUNGERTIME; - - if ( rs->restoring != 0 ) - { - // duplicate rng usage of normal case - obj = new_item(); - init_weapon(obj, MACE); - free(obj); - obj = new_item(); - init_weapon(obj, BOW); - free(obj); - obj = new_item(); - init_weapon(obj, ARROW); - obj->o_count = rnd(15) + 25; - free(obj); - } - else - { - /* - * Give him some food - */ - obj = new_item(); - obj->o_type = FOOD; - obj->o_count = 1; - add_pack(rs,obj, TRUE); - /* - * And his suit of armor - */ - obj = new_item(); - obj->o_type = ARMOR; - obj->o_which = RING_MAIL; - obj->o_arm = a_class[RING_MAIL] - 1; - obj->o_flags |= ISKNOW; - obj->o_count = 1; - cur_armor = obj; - add_pack(rs,obj, TRUE); - /* - * Give him his weaponry. First a mace. - */ - obj = new_item(); - init_weapon(obj, MACE); - obj->o_hplus = 1; - obj->o_dplus = 1; - obj->o_flags |= ISKNOW; - add_pack(rs,obj, TRUE); - cur_weapon = obj; - /* - * Now a +1 bow - */ - obj = new_item(); - init_weapon(obj, BOW); - obj->o_hplus = 1; - obj->o_flags |= ISKNOW; - add_pack(rs,obj, TRUE); - /* - * Now some arrows - */ - obj = new_item(); - init_weapon(obj, ARROW); - obj->o_count = rnd(15) + 25; - obj->o_flags |= ISKNOW; - add_pack(rs,obj, TRUE); - //fprintf(stderr,"initial o_count.%d\n",obj->o_count); sleep(3); - } -} - -/* - * Contains defintions and functions for dealing with things like - * potions and scrolls - */ - -const char *rainbow[] = { - "amber", - "aquamarine", - "black", - "blue", - "brown", - "clear", - "crimson", - "cyan", - "ecru", - "gold", - "green", - "grey", - "magenta", - "orange", - "pink", - "plaid", - "purple", - "red", - "silver", - "tan", - "tangerine", - "topaz", - "turquoise", - "vermilion", - "violet", - "white", - "yellow", -}; - -#define NCOLORS (sizeof rainbow / sizeof (char *)) -int cNCOLORS = NCOLORS; - -static const char *sylls[] = { - "a", "ab", "ag", "aks", "ala", "an", "app", "arg", "arze", "ash", - "bek", "bie", "bit", "bjor", "blu", "bot", "bu", "byt", "comp", - "con", "cos", "cre", "dalf", "dan", "den", "do", "e", "eep", "el", - "eng", "er", "ere", "erk", "esh", "evs", "fa", "fid", "fri", "fu", - "gan", "gar", "glen", "gop", "gre", "ha", "hyd", "i", "ing", "ip", - "ish", "it", "ite", "iv", "jo", "kho", "kli", "klis", "la", "lech", - "mar", "me", "mi", "mic", "mik", "mon", "mung", "mur", "nej", - "nelg", "nep", "ner", "nes", "nes", "nih", "nin", "o", "od", "ood", - "org", "orn", "ox", "oxy", "pay", "ple", "plu", "po", "pot", - "prok", "re", "rea", "rhov", "ri", "ro", "rog", "rok", "rol", "sa", - "san", "sat", "sef", "seh", "shu", "ski", "sna", "sne", "snik", - "sno", "so", "sol", "sri", "sta", "sun", "ta", "tab", "tem", - "ther", "ti", "tox", "trol", "tue", "turs", "u", "ulk", "um", "un", - "uni", "ur", "val", "viv", "vly", "vom", "wah", "wed", "werg", - "wex", "whon", "wun", "xo", "y", "yot", "yu", "zant", "zeb", "zim", - "zok", "zon", "zum", -}; - -const STONE stones[] = { - { "agate", 25}, - { "alexandrite", 40}, - { "amethyst", 50}, - { "carnelian", 40}, - { "diamond", 300}, - { "emerald", 300}, - { "germanium", 225}, - { "granite", 5}, - { "garnet", 50}, - { "jade", 150}, - { "kryptonite", 300}, - { "lapis lazuli", 50}, - { "moonstone", 50}, - { "obsidian", 15}, - { "onyx", 60}, - { "opal", 200}, - { "pearl", 220}, - { "peridot", 63}, - { "ruby", 350}, - { "sapphire", 285}, - { "stibotantalite", 200}, - { "tiger eye", 50}, - { "topaz", 60}, - { "turquoise", 70}, - { "taaffeite", 300}, - { "zircon", 80}, -}; - -#define NSTONES (sizeof stones / sizeof (STONE)) -int cNSTONES = NSTONES; - -const char *wood[] = { - "avocado wood", - "balsa", - "bamboo", - "banyan", - "birch", - "cedar", - "cherry", - "cinnibar", - "cypress", - "dogwood", - "driftwood", - "ebony", - "elm", - "eucalyptus", - "fall", - "hemlock", - "holly", - "ironwood", - "kukui wood", - "mahogany", - "manzanita", - "maple", - "oaken", - "persimmon wood", - "pecan", - "pine", - "poplar", - "redwood", - "rosewood", - "spruce", - "teak", - "walnut", - "zebrawood", -}; - -#define NWOOD (sizeof wood / sizeof (char *)) -int cNWOOD = NWOOD; - -const char *metal[] = { - "aluminum", - "beryllium", - "bone", - "brass", - "bronze", - "copper", - "electrum", - "gold", - "iron", - "lead", - "magnesium", - "mercury", - "nickel", - "pewter", - "platinum", - "steel", - "silver", - "silicon", - "tin", - "titanium", - "tungsten", - "zinc", -}; - -#define NMETAL (sizeof metal / sizeof (char *)) -int cNMETAL = NMETAL; -#define MAX3(a,b,c) (a > b ? (a > c ? a : c) : (b > c ? b : c)) - -static bool used[MAX3(NCOLORS, NSTONES, NWOOD)]; - -/* - * init_colors: - * Initialize the potion color scheme for this time - */ -void -init_colors() -{ - register int i, j; - memset(used,0,sizeof(used)); - for (i = 0; i < NCOLORS; i++) - used[i] = FALSE; - for (i = 0; i < MAXPOTIONS; i++) - { - do - j = rnd(NCOLORS); - until (!used[j]); - used[j] = TRUE; - p_colors[i] = rainbow[j]; - } -} - -/* - * init_names: - * Generate the names of the various scrolls - */ -#define MAXNAME 40 /* Max number of characters in a name */ - -void -init_names() -{ - register int nsyl; - register char *cp; const char *sp; - register int i, nwords; - - for (i = 0; i < MAXSCROLLS; i++) - { - cp = prbuf; - nwords = rnd(3) + 2; - while (nwords--) - { - nsyl = rnd(3) + 1; - while (nsyl--) - { - sp = sylls[rnd((sizeof sylls) / (sizeof (char *)))]; - if (&cp[strlen(sp)] > &prbuf[MAXNAME]) - break; - while (*sp) - *cp++ = *sp++; - } - *cp++ = ' '; - } - *--cp = '\0'; - s_names[i] = (char *) malloc((unsigned) strlen(prbuf)+1); - strcpy(s_names[i], prbuf); - } -} - -/* - * init_stones: - * Initialize the ring stone setting scheme for this time - */ -void -init_stones() -{ - register int i, j; - for (i = 0; i < NSTONES; i++) - used[i] = FALSE; - for (i = 0; i < MAXRINGS; i++) - { - do - j = rnd(NSTONES); - until (!used[j]); - used[j] = TRUE; - r_stones[i] = stones[j].st_name; - ring_info[i].oi_worth += stones[j].st_value; - } -} - -/* - * init_materials: - * Initialize the construction materials for wands and staffs - */ -void -init_materials() -{ - register int i, j; - register const char *str; - static bool metused[NMETAL]; - memset(metused,0,sizeof(metused)); - for (i = 0; i < NWOOD; i++) - used[i] = FALSE; - for (i = 0; i < NMETAL; i++) - metused[i] = FALSE; - for (i = 0; i < MAXSTICKS; i++) - { - for (;;) - if (rnd(2) == 0) - { - j = rnd(NMETAL); - if (!metused[j]) - { - ws_type[i] = "wand"; - str = metal[j]; - metused[j] = TRUE; - break; - } - } - else - { - j = rnd(NWOOD); - if (!used[j]) - { - ws_type[i] = "staff"; - str = wood[j]; - used[j] = TRUE; - break; - } - } - ws_made[i] = str; - } -} - -#ifdef MASTER -# define NT NUMTHINGS, "things" -# define MP MAXPOTIONS, "potions" -# define MS MAXSCROLLS, "scrolls" -# define MR MAXRINGS, "rings" -# define MWS MAXSTICKS, "sticks" -# define MW MAXWEAPONS, "weapons" -# define MA MAXARMORS, "armor" -#else -# define NT NUMTHINGS -# define MP MAXPOTIONS -# define MS MAXSCROLLS -# define MR MAXRINGS -# define MWS MAXSTICKS -# define MW MAXWEAPONS -# define MA MAXARMORS -#endif - -/* - * sumprobs: - * Sum up the probabilities for items appearing - */ -void -sumprobs(struct obj_info *info, int bound -#ifdef MASTER - , char *name -#endif -) -{ -#ifdef MASTER - struct obj_info *start = info; -#endif - struct obj_info *endp; - endp = info + bound; - while (++info < endp) - info->oi_prob += (info - 1)->oi_prob; -#ifdef MASTER - badcheck(name, start, bound); -#endif -} - -/* - * init_probs: - * Initialize the probabilities for the various items - */ -void -init_probs() -{ - sumprobs(things, NT); - sumprobs(pot_info, MP); - sumprobs(scr_info, MS); - sumprobs(ring_info, MR); - sumprobs(ws_info, MWS); - sumprobs(weap_info, MW); - sumprobs(arm_info, MA); -} - -#ifdef MASTER -/* - * badcheck: - * Check to see if a series of probabilities sums to 100 - */ -void -badcheck(char *name, struct obj_info *info, int bound) -{ - register struct obj_info *end; - - if (info[bound - 1].oi_prob == 100) - return; - printf("\nBad percentages for %s (bound = %d):\n", name, bound); - for (end = &info[bound]; info < end; info++) - printf("%3d%% %s\n", info->oi_prob, info->oi_name); - printf("[hit RETURN to continue]"); - fflush(stdout); - while (getchar() != '\n') - continue; -} -#endif - -/* - * pick_color: - * If he is halucinating, pick a random color name and return it, - * otherwise return the given color. - */ -char * -pick_color(char *col) -{ - return (on(player, ISHALU) ? (char *)rainbow[rnd(NCOLORS)] : col); -} diff --git a/src/cc/rogue/install-sh b/src/cc/rogue/install-sh deleted file mode 100755 index 4d4a9519e..000000000 --- a/src/cc/rogue/install-sh +++ /dev/null @@ -1,323 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2005-05-14.22 - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -chmodcmd="$chmodprog 0755" -chowncmd= -chgrpcmd= -stripcmd= -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src= -dst= -dir_arg= -dstarg= -no_target_directory= - -usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: --c (ignored) --d create directories instead of installing files. --g GROUP $chgrpprog installed files to GROUP. --m MODE $chmodprog installed files to MODE. --o USER $chownprog installed files to USER. --s $stripprog installed files. --t DIRECTORY install into DIRECTORY. --T report an error if DSTFILE is a directory. ---help display this help and exit. ---version display version info and exit. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG -" - -while test -n "$1"; do - case $1 in - -c) shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - --help) echo "$usage"; exit $?;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -s) stripcmd=$stripprog - shift - continue;; - - -t) dstarg=$2 - shift - shift - continue;; - - -T) no_target_directory=true - shift - continue;; - - --version) echo "$0 $scriptversion"; exit $?;; - - *) # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - test -n "$dir_arg$dstarg" && break - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dstarg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dstarg" - shift # fnord - fi - shift # arg - dstarg=$arg - done - break;; - esac -done - -if test -z "$1"; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -for src -do - # Protect names starting with `-'. - case $src in - -*) src=./$src ;; - esac - - if test -n "$dir_arg"; then - dst=$src - src= - - if test -d "$dst"; then - mkdircmd=: - chmodcmd= - else - mkdircmd=$mkdirprog - fi - else - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dstarg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - - dst=$dstarg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst ;; - esac - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dstarg: Is a directory" >&2 - exit 1 - fi - dst=$dst/`basename "$src"` - fi - fi - - # This sed command emulates the dirname command. - dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` - - # Make sure that the destination directory exists. - - # Skip lots of stat calls in the usual case. - if test ! -d "$dstdir"; then - defaultIFS=' - ' - IFS="${IFS-$defaultIFS}" - - oIFS=$IFS - # Some sh's can't handle IFS=/ for some reason. - IFS='%' - set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` - shift - IFS=$oIFS - - pathcomp= - - while test $# -ne 0 ; do - pathcomp=$pathcomp$1 - shift - if test ! -d "$pathcomp"; then - $mkdirprog "$pathcomp" - # mkdir can fail with a `File exist' error in case several - # install-sh are creating the directory concurrently. This - # is OK. - test -d "$pathcomp" || exit - fi - pathcomp=$pathcomp/ - done - fi - - if test -n "$dir_arg"; then - $doit $mkdircmd "$dst" \ - && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } - - else - dstfile=`basename "$dst"` - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - trap '(exit $?); exit' 1 2 13 15 - - # Copy the file name to the temp name. - $doit $cpprog "$src" "$dsttmp" && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && - - # Now rename the file to the real destination. - { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ - || { - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - if test -f "$dstdir/$dstfile"; then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ - || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ - || { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit 1 - } - else - : - fi - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" - } - } - fi || { (exit 1); exit 1; } -done - -# The final little trick to "correctly" pass the exit status to the exit trap. -{ - (exit 0); exit 0 -} - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/src/cc/rogue/io.c b/src/cc/rogue/io.c deleted file mode 100644 index 1f6d737b6..000000000 --- a/src/cc/rogue/io.c +++ /dev/null @@ -1,340 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * Various input/output functions - * - * @(#)io.c 4.32 (Berkeley) 02/05/99 - */ - -//#include -//#include -//#include -//#include - -#include "rogue.h" - -/* - * msg: - * Display a message at the top of the screen. - */ -#define MAXMSG (NUMCOLS - sizeof "--More--") - -static char msgbuf[2*MAXMSG+1]; -static int newpos = 0; - -/* VARARGS1 */ -int -msg(struct rogue_state *rs,char *fmt, ...) -{ - va_list args; - - /* - * if the string is "", just clear the line - */ - if (*fmt == '\0') - { - move(0, 0); - clrtoeol(); - mpos = 0; - return ~ESCAPE; - } - /* - * otherwise add to the message and flush it out - */ - va_start(args, fmt); - doadd(rs,fmt, args); - va_end(args); - return endmsg(rs); -} - -/* - * addmsg: - * Add things to the current message - */ -/* VARARGS1 */ -void -addmsg(struct rogue_state *rs,char *fmt, ...) -{ - va_list args; - - va_start(args, fmt); - doadd(rs,fmt, args); - va_end(args); -} - -/* - * endmsg: - * Display a new msg (giving him a chance to see the previous one - * if it is up there with the --More--) - */ -int -endmsg(struct rogue_state *rs) -{ - char ch; - - if (save_msg) - strcpy(huh, msgbuf); - if (mpos) - { - look(rs,FALSE); - mvaddstr(0, mpos, "--More--"); - if ( rs->sleeptime != 0 ) - refresh(); - if (!msg_esc) - wait_for(rs,' '); - else - { - while ((ch = readchar(rs)) != ' ') - if (ch == ESCAPE) - { - msgbuf[0] = '\0'; - mpos = 0; - newpos = 0; - msgbuf[0] = '\0'; - return ESCAPE; - } - } - } - /* - * All messages should start with uppercase, except ones that - * start with a pack addressing character - */ - if (islower(msgbuf[0]) && !lower_msg && msgbuf[1] != ')') - msgbuf[0] = (char) toupper(msgbuf[0]); - mvaddstr(0, 0, msgbuf); - clrtoeol(); - mpos = newpos; - newpos = 0; - msgbuf[0] = '\0'; - if ( rs->sleeptime != 0 ) - refresh(); - return ~ESCAPE; -} - -/* - * doadd: - * Perform an add onto the message buffer - */ -void -doadd(struct rogue_state *rs,char *fmt, va_list args) -{ - static char buf[MAXSTR]; - - /* - * Do the printf into buf - */ - vsprintf(buf, fmt, args); - if (strlen(buf) + newpos >= MAXMSG) - endmsg(rs); - strcat(msgbuf, buf); - newpos = (int) strlen(msgbuf); -} - -/* - * step_ok: - * Returns true if it is ok to step on ch - */ -int -step_ok(int ch) -{ - switch (ch) - { - case ' ': - case '|': - case '-': - return FALSE; - default: - return (!isalpha(ch)); - } -} - -/* - * readchar: - * Reads and returns a character, checking for gross input errors - */ -char -readchar(struct rogue_state *rs) -{ - char c,ch = -1; - if ( rs != 0 && rs->guiflag == 0 ) - { - static uint32_t counter; - if ( rs->ind < rs->numkeys ) - { - c = rs->keystrokes[rs->ind++]; - if ( 0 ) - { - static FILE *fp; static int32_t counter; - if ( fp == 0 ) - fp = fopen("log","wb"); - if ( fp != 0 ) - { - fprintf(fp,"%d: (%c) hp.%d num.%d gold.%d seed.%llu\n",counter,c,pstats.s_hpt,num_packitems(rs),purse,(long long)seed); - fflush(fp); - counter++; - } - } - while ( c == 'Q' && rs->ind < rs->numkeys ) - { - //fprintf(stderr,"Got 'Q' next (%c)\n",rs->keystrokes[rs->ind]); sleep(2); - if ( rs->keystrokes[rs->ind] == 'y' ) - return(c); - rs->ind++; - c = rs->keystrokes[rs->ind++]; - } - return(c); - } - if ( rs->replaydone != 0 && counter++ < 3 ) - fprintf(stderr,"replay finished but readchar called\n"); - rs->replaydone = (uint32_t)time(NULL); - if ( counter < 3 || (counter & 1) == 0 ) - return('y'); - else return(ESCAPE); - } - if ( rs == 0 || rs->guiflag != 0 ) - { - ch = (char) md_readchar(); - - if (ch == 3) - { - _quit(); - return(27); - } - if ( rs != 0 && rs->guiflag != 0 ) - { - if ( rs->num < sizeof(rs->buffered) ) - { - rs->buffered[rs->num++] = ch; - if ( rs->num > (sizeof(rs->buffered)*9)/10 && rs->needflush == 0 ) - { - rs->needflush = (uint32_t)time(NULL); - //fprintf(stderr,"needflush.%u %d of %d\n",rs->needflush,rs->num,(int32_t)sizeof(rs->buffered)); - //sleep(3); - } - } else fprintf(stderr,"buffer filled without flushed\n"); - } - } else fprintf(stderr,"readchar rs.%p non-gui error?\n",rs); - return(ch); -} - -/* - * status: - * Display the important stats line. Keep the cursor where it was. - */ -void -status(struct rogue_state *rs) -{ - register int oy, ox, temp; - static int hpwidth = 0; - static int s_hungry = 0; - static int s_lvl = 0; - static int s_pur = -1; - static int s_hp = 0; - static int s_arm = 0; - static str_t s_str = 0; - static int s_exp = 0; - static char *state_name[] = - { - "", "Hungry", "Weak", "Faint" - }; - - /* - * If nothing has changed since the last status, don't - * bother. - */ - temp = (cur_armor != NULL ? cur_armor->o_arm : pstats.s_arm); - if (s_hp == pstats.s_hpt && s_exp == pstats.s_exp && s_pur == purse - && s_arm == temp && s_str == pstats.s_str && s_lvl == level - && s_hungry == hungry_state - && !stat_msg - ) - return; - - s_arm = temp; - - getyx(stdscr, oy, ox); - if (s_hp != max_hp) - { - temp = max_hp; - s_hp = max_hp; - for (hpwidth = 0; temp; hpwidth++) - temp /= 10; - } - - /* - * Save current status - */ - s_lvl = level; - s_pur = purse; - s_hp = pstats.s_hpt; - s_str = pstats.s_str; - s_exp = pstats.s_exp; - s_hungry = hungry_state; - - if (stat_msg) - { - move(0, 0); - msg(rs,"Level: %d Gold: %-5d Hp: %*d(%*d) Str: %2d(%d) Arm: %-2d Exp: %d/%ld %s", - level, purse, hpwidth, pstats.s_hpt, hpwidth, max_hp, pstats.s_str, - max_stats.s_str, 10 - s_arm, pstats.s_lvl, pstats.s_exp, - state_name[hungry_state]); - } - else - { - move(STATLINE, 0); - - printw("Level: %d Gold: %-5d Hp: %*d(%*d) Str: %2d(%d) Arm: %-2d Exp: %d/%d %s", - level, purse, hpwidth, pstats.s_hpt, hpwidth, max_hp, pstats.s_str, - max_stats.s_str, 10 - s_arm, pstats.s_lvl, pstats.s_exp, - state_name[hungry_state]); - } - - clrtoeol(); - move(oy, ox); -} - -/* - * wait_for - * Sit around until the guy types the right key - */ -void -wait_for(struct rogue_state *rs,int ch) -{ - register char c; - - if (ch == '\n') - while ((c = readchar(rs)) != '\n' && c != '\r') - { - if ( rs->replaydone != 0 ) - return; - continue; - } - else - while (readchar(rs) != ch) - { - if ( rs->replaydone != 0 ) - return; - continue; - } -} - -/* - * show_win: - * Function used to display a window and wait before returning - */ -void -show_win(struct rogue_state *rs,char *message) -{ - WINDOW *win; - - win = hw; - wmove(win, 0, 0); - waddstr(win, message); - touchwin(win); - wmove(win, hero.y, hero.x); - wrefresh(win); - wait_for(rs,' '); - clearok(curscr, TRUE); - touchwin(stdscr); -} diff --git a/src/cc/rogue/list.c b/src/cc/rogue/list.c deleted file mode 100644 index 4fa1f9da8..000000000 --- a/src/cc/rogue/list.c +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * Functions for dealing with linked lists of goodies - * - * @(#)list.c 4.12 (Berkeley) 02/05/99 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -//#include -//#include -//#include -#include "rogue.h" - -#ifdef MASTER -int total = 0; /* total dynamic memory bytes */ -#endif - -/* - * discard: - * Free up an item - */ - -//#define ENABLE_DEBUG -#define MAX_DEBUGPTRS 100000 - -int32_t itemcounter; -THING *thingptrs[MAX_DEBUGPTRS]; -int32_t numptrs; - -int32_t thing_find(THING *item) -{ -#ifdef ENABLE_DEBUG - int32_t i; - for (i=0; i_t._t_type,thingptrs[i]->o_type,thingptrs[i]->o_type); - free(thingptrs[i]); - } - memset(thingptrs,0,sizeof(thingptrs)); - numptrs = 0; -} - -/* - * detach: - * takes an item out of whatever linked list it might be in - */ - -void -_detach(THING **list, THING *item) -{ - if (*list == item) - *list = next(item); - if (prev(item) != NULL) - item->l_prev->l_next = next(item); - if (next(item) != NULL) - item->l_next->l_prev = prev(item); - item->l_next = NULL; - item->l_prev = NULL; -} - -/* - * _attach: - * add an item to the head of a list - */ - -void -_attach(THING **list, THING *item) -{ - if (*list != NULL) - { - item->l_next = *list; - (*list)->l_prev = item; - item->l_prev = NULL; - } - else - { - item->l_next = NULL; - item->l_prev = NULL; - } - *list = item; -} - -/* - * _free_list: - * Throw the whole blamed thing away - */ - -void -_free_list(THING **ptr) -{ - THING *item; - while (*ptr != NULL) - { - item = *ptr; - *ptr = next(item); - discard(item); - } -} - -/* - * new_item - * Get a new item with a specified size - */ - -THING * -new_item(void) -{ - THING *item; - -#ifdef MASTER - if ((item = (THING *)calloc(1, sizeof *item)) == NULL) - msg(rs,"ran out of memory after %d items", total); - else - total++; -#else - item = (THING *)calloc(1, sizeof *item); -#endif -#ifdef ENABLE_DEBUG - if ( numptrs < MAX_DEBUGPTRS ) - { - thingptrs[numptrs++] = item; - if ( (++itemcounter % 100) == 0 ) - fprintf(stderr,"itemcounter.%d\n",itemcounter); - } -#endif - item->l_next = NULL; - item->l_prev = NULL; - return item; -} diff --git a/src/cc/rogue/mach_dep.c b/src/cc/rogue/mach_dep.c deleted file mode 100644 index 36daf97ab..000000000 --- a/src/cc/rogue/mach_dep.c +++ /dev/null @@ -1,462 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * Various installation dependent routines - * - * @(#)mach_dep.c 4.37 (Berkeley) 05/23/83 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -/* - * The various tuneable defines are: - * - * SCOREFILE Where/if the score file should live. - * ALLSCORES Score file is top ten scores, not top ten - * players. This is only useful when only a few - * people will be playing; otherwise the score file - * gets hogged by just a few people. - * NUMSCORES Number of scores in the score file (default 10). - * NUMNAME String version of NUMSCORES (first character - * should be capitalized) (default "Ten"). - * MAXLOAD What (if any) the maximum load average should be - * when people are playing. Since it is divided - * by 10, to specify a load limit of 4.0, MAXLOAD - * should be "40". If defined, then - * LOADAV Should it use it's own routine to get - * the load average? - * NAMELIST If so, where does the system namelist - * hide? - * MAXUSERS What (if any) the maximum user count should be - * when people are playing. If defined, then - * UCOUNT Should it use it's own routine to count - * users? - * UTMP If so, where does the user list hide? - * CHECKTIME How often/if it should check during the game - * for high load average. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -//#include -#include "rogue.h" -#include "extern.h" - -#define NOOP(x) (x += 0) - -# ifndef NUMSCORES -# define NUMSCORES 10 -# define NUMNAME "Ten" -# endif - -unsigned int numscores = NUMSCORES; -char *Numname = NUMNAME; - -# ifdef ALLSCORES -bool allscore = TRUE; -# else /* ALLSCORES */ -bool allscore = FALSE; -# endif /* ALLSCORES */ - -#ifdef CHECKTIME -static int num_checks; /* times we've gone over in checkout() */ -#endif /* CHECKTIME */ - -/* - * init_check: - * Check out too see if it is proper to play the game now - */ - -void -init_check() -{ -#if defined(MAXLOAD) || defined(MAXUSERS) - if (too_much()) - { - printf("Sorry, %s, but the system is too loaded now.\n", whoami); - printf("Try again later. Meanwhile, why not enjoy a%s %s?\n", - vowelstr(fruit), fruit); - if (author()) - printf("However, since you're a good guy, it's up to you\n"); - else - exit(1); - } -#endif -} - -/* - * open_score: - * Open up the score file for future use - */ - -void -open_score() -{ -#ifdef SCOREFILE - char *scorefile = SCOREFILE; - /* - * We drop setgid privileges after opening the score file, so subsequent - * open()'s will fail. Just reuse the earlier filehandle. - */ - - if (scoreboard != NULL) { - rewind(scoreboard); - return; - } - - scoreboard = fopen(scorefile, "r+"); - - if ((scoreboard == NULL) && (errno == ENOENT)) - { - scoreboard = fopen(scorefile, "w+"); - md_chmod(scorefile,0664); - } - - if (scoreboard == NULL) { - fprintf(stderr, "Could not open %s for writing: %s\n", scorefile, strerror(errno)); - fflush(stderr); - } -#else - scoreboard = NULL; -#endif -} - -/* - * setup: - * Get starting setup for all games - */ - -void -setup() -{ -#ifdef CHECKTIME - int checkout(); -#endif - -#ifdef DUMP - md_onsignal_autosave(); -#else - md_onsignal_default(); -#endif - -#ifdef CHECKTIME - md_start_checkout_timer(CHECKTIME*60); - num_checks = 0; -#endif - - raw(); /* Raw mode */ - noecho(); /* Echo off */ - keypad(stdscr,1); - getltchars(); /* get the local tty chars */ -} - -/* - * getltchars: - * Get the local tty chars for later use - */ - -void -getltchars() -{ - got_ltc = TRUE; - orig_dsusp = md_dsuspchar(); - md_setdsuspchar( md_suspchar() ); -} - -/* - * resetltchars: - * Reset the local tty chars to original values. - */ -void -resetltchars(void) -{ - if (got_ltc) { - md_setdsuspchar(orig_dsusp); - } -} - -/* - * playltchars: - * Set local tty chars to the values we use when playing. - */ -void -playltchars(void) -{ - if (got_ltc) { - md_setdsuspchar( md_suspchar() ); - } -} - -/* - * start_score: - * Start the scoring sequence - */ - -void -start_score() -{ -#ifdef CHECKTIME - md_stop_checkout_timer(); -#endif -} - -/* - * is_symlink: - * See if the file has a symbolic link - */ -bool -is_symlink(char *sp) -{ -#ifdef S_IFLNK - struct stat sbuf2; - - if (lstat(sp, &sbuf2) < 0) - return FALSE; - else - return ((sbuf2.st_mode & S_IFMT) != S_IFREG); -#else - NOOP(sp); - return FALSE; -#endif -} - -#if defined(MAXLOAD) || defined(MAXUSERS) -/* - * too_much: - * See if the system is being used too much for this game - */ -bool -too_much() -{ -#ifdef MAXLOAD - double avec[3]; -#else - int cnt; -#endif - -#ifdef MAXLOAD - md_loadav(avec); - if (avec[1] > (MAXLOAD / 10.0)) - return TRUE; -#endif -#ifdef MAXUSERS - if (ucount() > MAXUSERS) - return TRUE; -#endif - return FALSE; -} - -/* - * author: - * See if a user is an author of the program - */ -bool -author() -{ -#ifdef MASTER - if (wizard) - return TRUE; -#endif - switch (md_getuid()) - { - case -1: - return TRUE; - default: - return FALSE; - } -} -#endif - -#ifdef CHECKTIME -/* - * checkout: - * Check each CHECKTIME seconds to see if the load is too high - */ - -checkout(struct rogue_state *rs,int sig) -{ - static char *msgs[] = { - "The load is too high to be playing. Please leave in %0.1f minutes", - "Please save your game. You have %0.1f minutes", - "Last warning. You have %0.1f minutes to leave", - }; - int checktime; - - if (too_much()) - { - if (author()) - { - num_checks = 1; - chmsg(rs,"The load is rather high, O exaulted one"); - } - else if (num_checks++ == 3) - fatal("Sorry. You took too long. You are dead\n"); - checktime = (CHECKTIME * 60) / num_checks; - chmsg(rs,msgs[num_checks - 1], ((double) checktime / 60.0)); - } - else - { - if (num_checks) - { - num_checks = 0; - chmsg(rs,"The load has dropped back down. You have a reprieve"); - } - checktime = (CHECKTIME * 60); - } - - md_start_checkout_timer(checktime); -} - -/* - * chmsg: - * checkout()'s version of msg. If we are in the middle of a - * shell, do a printf instead of a msg to a the refresh. - */ -/* VARARGS1 */ - -chmsg(struct rogue_state *rs,char *fmt, int arg) -{ - if (!in_shell) - msg(rs,fmt, arg); - else - { - printf(fmt, arg); - putchar('\n'); - fflush(stdout); - } -} -#endif - -#ifdef UCOUNT -/* - * ucount: - * count number of users on the system - */ -#include - -struct utmp buf; - -int -ucount() -{ - struct utmp *up; - FILE *utmp; - int count; - - if ((utmp = fopen(UTMP, "r")) == NULL) - return 0; - - up = &buf; - count = 0; - - while (fread(up, 1, sizeof (*up), utmp) > 0) - if (buf.ut_name[0] != '\0') - count++; - fclose(utmp); - return count; -} -#endif - -/* - * lock_sc: - * lock the score file. If it takes too long, ask the user if - * they care to wait. Return TRUE if the lock is successful. - */ -static FILE *lfd = NULL; -bool -lock_sc() -{ -#if defined(SCOREFILE) && defined(LOCKFILE) - int cnt; - static struct stat sbuf; - char *lockfile = LOCKFILE; - -over: - if ((lfd=fopen(lockfile, "w+")) != NULL) - return TRUE; - for (cnt = 0; cnt < 5; cnt++) - { - md_sleep(1); - if ((lfd=fopen(lockfile, "w+")) != NULL) - return TRUE; - } - if (stat(lockfile, &sbuf) < 0) - { - lfd=fopen(lockfile, "w+"); - return TRUE; - } - if (time(NULL) - sbuf.st_mtime > 10) - { - if (md_unlink(lockfile) < 0) - return FALSE; - goto over; - } - else - { - printf("The score file is very busy. Do you want to wait longer\n"); - printf("for it to become free so your score can get posted?\n"); - printf("If so, type \"y\"\n"); - if (fgets(prbuf, MAXSTR, stdin) != 0 ) - ; - if (prbuf[0] == 'y') - for (;;) - { - if ((lfd=fopen(lockfile, "w+")) != 0) - return TRUE; - if (stat(lockfile, &sbuf) < 0) - { - lfd=fopen(lockfile, "w+"); - return TRUE; - } - if (time(NULL) - sbuf.st_mtime > 10) - { - if (md_unlink(lockfile) < 0) - return FALSE; - } - md_sleep(1); - } - else - return FALSE; - } -#else - return TRUE; -#endif -} - -/* - * unlock_sc: - * Unlock the score file - */ - -void -unlock_sc() -{ -#if defined(SCOREFILE) && defined(LOCKFILE) - if (lfd != NULL) - fclose(lfd); - lfd = NULL; - md_unlink(LOCKFILE); -#endif -} - -/* - * flush_type: - * Flush typeahead for traps, etc. - */ - -void -flush_type() -{ - flushinp(); -} diff --git a/src/cc/rogue/main.c b/src/cc/rogue/main.c deleted file mode 100644 index 4186812f3..000000000 --- a/src/cc/rogue/main.c +++ /dev/null @@ -1,1000 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/****************************************************************************** - * Copyright © 2014-2019 The SuperNET Developers. * - * * - * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * - * the top-level directory of this distribution for the individual copyright * - * holder information and the developer policies on copyright and licensing. * - * * - * Unless otherwise agreed in a custom licensing agreement, no part of the * - * SuperNET software, including this file may be copied, modified, propagated * - * or distributed except according to the terms contained in the LICENSE file * - * * - * Removal or modification of this copyright notice is prohibited. * - * * - ******************************************************************************/ -#include -#include -#include -#include -#include -#include -#include -#include - -char USERPASS[8192]; uint16_t ROGUE_PORT; -extern char Gametxidstr[67]; - -#define SMALLVAL 0.000000000000001 -#define SATOSHIDEN ((uint64_t)100000000L) -#define dstr(x) ((double)(x) / SATOSHIDEN) -#define HUSH_SMART_CHAIN_MAXLEN 65 -char ASSETCHAINS_SYMBOL[HUSH_SMART_CHAIN_MAXLEN],IPADDRESS[100]; - -#ifndef _BITS256 -#define _BITS256 -union _bits256 { uint8_t bytes[32]; uint16_t ushorts[16]; uint32_t uints[8]; uint64_t ulongs[4]; uint64_t txid; }; -typedef union _bits256 bits256; -#endif - -#ifdef _WIN32 -#ifdef _MSC_VER -int gettimeofday(struct timeval * tp, struct timezone * tzp) -{ - // Note: some broken versions only have 8 trailing zero's, the correct epoch has 9 trailing zero's - static const uint64_t EPOCH = ((uint64_t)116444736000000000ULL); - - SYSTEMTIME system_time; - FILETIME file_time; - uint64_t time; - - GetSystemTime(&system_time); - SystemTimeToFileTime(&system_time, &file_time); - time = ((uint64_t)file_time.dwLowDateTime); - time += ((uint64_t)file_time.dwHighDateTime) << 32; - - tp->tv_sec = (long)((time - EPOCH) / 10000000L); - tp->tv_usec = (long)(system_time.wMilliseconds * 1000); - return 0; -} -#endif // _MSC_VER -#endif - - - -double OS_milliseconds() -{ - struct timeval tv; double millis; - #ifdef __MINGW32__ - mingw_gettimeofday(&tv,NULL); - #else - gettimeofday(&tv,NULL); - #endif - millis = ((double)tv.tv_sec * 1000. + (double)tv.tv_usec / 1000.); - //printf("tv_sec.%ld usec.%d %f\n",tv.tv_sec,tv.tv_usec,millis); - return(millis); -} - -int32_t _unhex(char c) -{ - if ( c >= '0' && c <= '9' ) - return(c - '0'); - else if ( c >= 'a' && c <= 'f' ) - return(c - 'a' + 10); - else if ( c >= 'A' && c <= 'F' ) - return(c - 'A' + 10); - return(-1); -} - -int32_t is_hexstr(char *str,int32_t n) -{ - int32_t i; - if ( str == 0 || str[0] == 0 ) - return(0); - for (i=0; str[i]!=0; i++) - { - if ( n > 0 && i >= n ) - break; - if ( _unhex(str[i]) < 0 ) - break; - } - if ( n == 0 ) - return(i); - return(i == n); -} - -int32_t unhex(char c) -{ - int32_t hex; - if ( (hex= _unhex(c)) < 0 ) - { - //printf("unhex: illegal hexchar.(%c)\n",c); - } - return(hex); -} - -unsigned char _decode_hex(char *hex) { return((unhex(hex[0])<<4) | unhex(hex[1])); } - -int32_t decode_hex(uint8_t *bytes,int32_t n,char *hex) -{ - int32_t adjust,i = 0; - //printf("decode.(%s)\n",hex); - if ( is_hexstr(hex,n) <= 0 ) - { - memset(bytes,0,n); - return(n); - } - if ( hex[n-1] == '\n' || hex[n-1] == '\r' ) - hex[--n] = 0; - if ( n == 0 || (hex[n*2+1] == 0 && hex[n*2] != 0) ) - { - if ( n > 0 ) - { - bytes[0] = unhex(hex[0]); - printf("decode_hex n.%d hex[0] (%c) -> %d hex.(%s) [n*2+1: %d] [n*2: %d %c] len.%ld\n",n,hex[0],bytes[0],hex,hex[n*2+1],hex[n*2],hex[n*2],(long)strlen(hex)); - } - bytes++; - hex++; - adjust = 1; - } else adjust = 0; - if ( n > 0 ) - { - for (i=0; i>4) & 0xf); - hexbytes[i*2 + 1] = hexbyte(message[i] & 0xf); - //printf("i.%d (%02x) [%c%c]\n",i,message[i],hexbytes[i*2],hexbytes[i*2+1]); - } - hexbytes[len*2] = 0; - //printf("len.%ld\n",len*2+1); - return((int32_t)len*2+1); -} - -char *bits256_str(char hexstr[65],bits256 x) -{ - init_hexbytes_noT(hexstr,x.bytes,sizeof(x)); - return(hexstr); -} - -long _stripwhite(char *buf,int accept) -{ - int32_t i,j,c; - if ( buf == 0 || buf[0] == 0 ) - return(0); - for (i=j=0; buf[i]!=0; i++) - { - buf[j] = c = buf[i]; - if ( c == accept || (c != ' ' && c != '\n' && c != '\r' && c != '\t' && c != '\b') ) - j++; - } - buf[j] = 0; - return(j); -} - -char *clonestr(char *str) -{ - char *clone; - if ( str == 0 || str[0] == 0 ) - { - printf("warning cloning nullstr.%p\n",str); -#ifdef __APPLE__ - while ( 1 ) sleep(1); -#endif - str = (char *)""; - } - clone = (char *)malloc(strlen(str)+16); - strcpy(clone,str); - return(clone); -} - -char *parse_conf_line(char *line,char *field) -{ - line += strlen(field); - for (; *line!='='&&*line!=0; line++) - break; - if ( *line == 0 ) - return(0); - if ( *line == '=' ) - line++; - while ( line[strlen(line)-1] == '\r' || line[strlen(line)-1] == '\n' || line[strlen(line)-1] == ' ' ) - line[strlen(line)-1] = 0; - //printf("LINE.(%s)\n",line); - _stripwhite(line,0); - return(clonestr(line)); -} - -int32_t safecopy(char *dest,char *src,long len) -{ - int32_t i = -1; - if ( src != 0 && dest != 0 && src != dest ) - { - if ( dest != 0 ) - memset(dest,0,len); - for (i=0; i buflen ) - { - *allocsizep = filesize; - *bufp = buf = (uint8_t *)realloc(buf,(long)*allocsizep+64); - } - rewind(fp); - if ( buf == 0 ) - printf("Null buf ???\n"); - else - { - if ( fread(buf,1,(long)filesize,fp) != (unsigned long)filesize ) - printf("error reading filesize.%ld\n",(long)filesize); - buf[filesize] = 0; - } - fclose(fp); - *lenp = filesize; - //printf("loaded.(%s)\n",buf); - } //else printf("OS_loadfile couldnt load.(%s)\n",fname); - return(buf); -} - -uint8_t *OS_fileptr(long *allocsizep,char *fname) -{ - long filesize = 0; uint8_t *buf = 0; void *retptr; - *allocsizep = 0; - retptr = OS_loadfile(fname,&buf,&filesize,allocsizep); - return((uint8_t *)retptr); -} - -struct MemoryStruct { char *memory; size_t size; }; -struct return_string { char *ptr; size_t len; }; - -// return data from the server -#define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32) -#define CURL_GLOBAL_SSL (1<<0) -#define CURL_GLOBAL_WIN32 (1<<1) - - -/************************************************************************ - * - * Initialize the string handler so that it is thread safe - * - ************************************************************************/ - -void init_string(struct return_string *s) -{ - s->len = 0; - s->ptr = (char *)calloc(1,s->len+1); - if ( s->ptr == NULL ) - { - fprintf(stderr,"init_string malloc() failed\n"); - exit(-1); - } - s->ptr[0] = '\0'; -} - -/************************************************************************ - * - * Use the "writer" to accumulate text until done - * - ************************************************************************/ - -size_t accumulatebytes(void *ptr,size_t size,size_t nmemb,struct return_string *s) -{ - size_t new_len = s->len + size*nmemb; - s->ptr = (char *)realloc(s->ptr,new_len+1); - if ( s->ptr == NULL ) - { - fprintf(stderr, "accumulate realloc() failed\n"); - exit(-1); - } - memcpy(s->ptr+s->len,ptr,size*nmemb); - s->ptr[new_len] = '\0'; - s->len = new_len; - return(size * nmemb); -} - -/************************************************************************ - * - * return the current system time in milliseconds - * - ************************************************************************/ - -#define EXTRACT_BITCOIND_RESULT // if defined, ensures error is null and returns the "result" field -#ifdef EXTRACT_BITCOIND_RESULT - -/************************************************************************ - * - * perform post processing of the results - * - ************************************************************************/ - -char *post_process_bitcoind_RPC(char *debugstr,char *command,char *rpcstr,char *params) -{ - long i,j,len; char *retstr = 0; cJSON *json,*result,*error; - //printf("<<<<<<<<<<< bitcoind_RPC: %s post_process_bitcoind_RPC.%s.[%s]\n",debugstr,command,rpcstr); - if ( command == 0 || rpcstr == 0 || rpcstr[0] == 0 ) - { - if ( strcmp(command,"signrawtransaction") != 0 ) - printf("<<<<<<<<<<< bitcoind_RPC: %s post_process_bitcoind_RPC.%s.[%s]\n",debugstr,command,rpcstr); - return(rpcstr); - } - json = cJSON_Parse(rpcstr); - if ( json == 0 ) - { - printf("<<<<<<<<<<< bitcoind_RPC: %s post_process_bitcoind_RPC.%s can't parse.(%s) params.(%s)\n",debugstr,command,rpcstr,params); - free(rpcstr); - return(0); - } - result = cJSON_GetObjectItem(json,"result"); - error = cJSON_GetObjectItem(json,"error"); - if ( error != 0 && result != 0 ) - { - if ( (error->type&0xff) == cJSON_NULL && (result->type&0xff) != cJSON_NULL ) - { - retstr = cJSON_Print(result); - len = strlen(retstr); - if ( retstr[0] == '"' && retstr[len-1] == '"' ) - { - for (i=1,j=0; itype&0xff) != cJSON_NULL || (result->type&0xff) != cJSON_NULL ) - { - if ( strcmp(command,"signrawtransaction") != 0 ) - printf("<<<<<<<<<<< bitcoind_RPC: %s post_process_bitcoind_RPC (%s) error.%s\n",debugstr,command,rpcstr); - } - free(rpcstr); - } else retstr = rpcstr; - free_json(json); - //fprintf(stderr,"<<<<<<<<<<< bitcoind_RPC: postprocess returns.(%s)\n",retstr); - return(retstr); -} -#endif - -#ifdef _WIN32 -#ifdef _MSC_VER -#define sleep(x) Sleep(1000*(x)) -#endif -#endif - -/************************************************************************ - * - * perform the query - * - ************************************************************************/ - -char *bitcoind_RPC(char **retstrp,char *debugstr,char *url,char *userpass,char *command,char *params) -{ - static int didinit,count,count2; static double elapsedsum,elapsedsum2; - struct curl_slist *headers = NULL; struct return_string s; CURLcode res; CURL *curl_handle; - char *bracket0,*bracket1,*databuf = 0; long len; int32_t specialcase,numretries; double starttime; - if ( didinit == 0 ) - { - didinit = 1; - curl_global_init(CURL_GLOBAL_ALL); //init the curl session - } - numretries = 0; - if ( debugstr != 0 && strcmp(debugstr,"BTCD") == 0 && command != 0 && strcmp(command,"SuperNET") == 0 ) - specialcase = 1; - else specialcase = 0; - if ( url[0] == 0 ) - strcpy(url,"http://127.0.0.1:7876/nxt"); - if ( specialcase != 0 && 0 ) - printf("<<<<<<<<<<< bitcoind_RPC: debug.(%s) url.(%s) command.(%s) params.(%s)\n",debugstr,url,command,params); -try_again: - if ( retstrp != 0 ) - *retstrp = 0; - starttime = OS_milliseconds(); - curl_handle = curl_easy_init(); - init_string(&s); - headers = curl_slist_append(0,"Expect:"); - - curl_easy_setopt(curl_handle,CURLOPT_USERAGENT,"mozilla/4.0");//"Mozilla/4.0 (compatible; )"); - curl_easy_setopt(curl_handle,CURLOPT_HTTPHEADER, headers); - curl_easy_setopt(curl_handle,CURLOPT_URL, url); - curl_easy_setopt(curl_handle,CURLOPT_WRITEFUNCTION, (void *)accumulatebytes); // send all data to this function - curl_easy_setopt(curl_handle,CURLOPT_WRITEDATA, &s); // we pass our 's' struct to the callback - curl_easy_setopt(curl_handle,CURLOPT_NOSIGNAL, 1L); // supposed to fix "Alarm clock" and long jump crash - curl_easy_setopt(curl_handle,CURLOPT_NOPROGRESS, 1L); // no progress callback - if ( strncmp(url,"https",5) == 0 ) - { - curl_easy_setopt(curl_handle,CURLOPT_SSL_VERIFYPEER,0); - curl_easy_setopt(curl_handle,CURLOPT_SSL_VERIFYHOST,0); - } - if ( userpass != 0 ) - curl_easy_setopt(curl_handle,CURLOPT_USERPWD, userpass); - databuf = 0; - if ( params != 0 ) - { - if ( command != 0 && specialcase == 0 ) - { - len = strlen(params); - if ( len > 0 && params[0] == '[' && params[len-1] == ']' ) { - bracket0 = bracket1 = (char *)""; - } - else - { - bracket0 = (char *)"["; - bracket1 = (char *)"]"; - } - - databuf = (char *)malloc(256 + strlen(command) + strlen(params)); - sprintf(databuf,"{\"id\":\"jl777\",\"method\":\"%s\",\"params\":%s%s%s}",command,bracket0,params,bracket1); - //printf("url.(%s) userpass.(%s) databuf.(%s)\n",url,userpass,databuf); - // - } //else if ( specialcase != 0 ) fprintf(stderr,"databuf.(%s)\n",params); - curl_easy_setopt(curl_handle,CURLOPT_POST,1L); - if ( databuf != 0 ) - curl_easy_setopt(curl_handle,CURLOPT_POSTFIELDS,databuf); - else curl_easy_setopt(curl_handle,CURLOPT_POSTFIELDS,params); - } - //laststart = milliseconds(); - res = curl_easy_perform(curl_handle); - curl_slist_free_all(headers); - curl_easy_cleanup(curl_handle); - if ( databuf != 0 ) // clean up temporary buffer - { - free(databuf); - databuf = 0; - } - if ( res != CURLE_OK ) - { - numretries++; - if ( specialcase != 0 ) - { - printf("<<<<<<<<<<< bitcoind_RPC.(%s): BTCD.%s timeout params.(%s) s.ptr.(%s) err.%d\n",url,command,params,s.ptr,res); - free(s.ptr); - return(0); - } - else if ( numretries >= 1 ) - { - //printf("Maximum number of retries exceeded!\n"); - free(s.ptr); - return(0); - } - if ( (rand() % 1000) == 0 ) - printf( "curl_easy_perform() failed: %s %s.(%s %s), retries: %d\n",curl_easy_strerror(res),debugstr,url,command,numretries); - free(s.ptr); - sleep((1< (%s)\n",params,s.ptr); - count2++; - elapsedsum2 += (OS_milliseconds() - starttime); - if ( (count2 % 10000) == 0) - printf("%d: ave %9.6f | elapsed %.3f millis | NXT calls.(%s) cmd.(%s)\n",count2,elapsedsum2/count2,(double)(OS_milliseconds() - starttime),url,command); - return(s.ptr); - } - } - printf("bitcoind_RPC: impossible case\n"); - free(s.ptr); - return(0); -} - -static size_t WriteMemoryCallback(void *ptr,size_t size,size_t nmemb,void *data) -{ - size_t realsize = (size * nmemb); - struct MemoryStruct *mem = (struct MemoryStruct *)data; - mem->memory = (char *)((ptr != 0) ? realloc(mem->memory,mem->size + realsize + 1) : malloc(mem->size + realsize + 1)); - if ( mem->memory != 0 ) - { - if ( ptr != 0 ) - memcpy(&(mem->memory[mem->size]),ptr,realsize); - mem->size += realsize; - mem->memory[mem->size] = 0; - } - //printf("got %d bytes\n",(int32_t)(size*nmemb)); - return(realsize); -} - -char *curl_post(CURL **cHandlep,char *url,char *userpass,char *postfields,char *hdr0,char *hdr1,char *hdr2,char *hdr3) -{ - struct MemoryStruct chunk; CURL *cHandle; long code; struct curl_slist *headers = 0; - if ( (cHandle= *cHandlep) == NULL ) - *cHandlep = cHandle = curl_easy_init(); - else curl_easy_reset(cHandle); - //#ifdef DEBUG - //curl_easy_setopt(cHandle,CURLOPT_VERBOSE, 1); - //#endif - curl_easy_setopt(cHandle,CURLOPT_USERAGENT,"mozilla/4.0");//"Mozilla/4.0 (compatible; )"); - curl_easy_setopt(cHandle,CURLOPT_SSL_VERIFYPEER,0); - //curl_easy_setopt(cHandle,CURLOPT_SSLVERSION,1); - curl_easy_setopt(cHandle,CURLOPT_URL,url); - curl_easy_setopt(cHandle,CURLOPT_CONNECTTIMEOUT,10); - if ( userpass != 0 && userpass[0] != 0 ) - curl_easy_setopt(cHandle,CURLOPT_USERPWD,userpass); - if ( postfields != 0 && postfields[0] != 0 ) - { - curl_easy_setopt(cHandle,CURLOPT_POST,1); - curl_easy_setopt(cHandle,CURLOPT_POSTFIELDS,postfields); - } - if ( hdr0 != NULL && hdr0[0] != 0 ) - { - //printf("HDR0.(%s) HDR1.(%s) HDR2.(%s) HDR3.(%s)\n",hdr0!=0?hdr0:"",hdr1!=0?hdr1:"",hdr2!=0?hdr2:"",hdr3!=0?hdr3:""); - headers = curl_slist_append(headers,hdr0); - if ( hdr1 != 0 && hdr1[0] != 0 ) - headers = curl_slist_append(headers,hdr1); - if ( hdr2 != 0 && hdr2[0] != 0 ) - headers = curl_slist_append(headers,hdr2); - if ( hdr3 != 0 && hdr3[0] != 0 ) - headers = curl_slist_append(headers,hdr3); - } //headers = curl_slist_append(0,"Expect:"); - if ( headers != 0 ) - curl_easy_setopt(cHandle,CURLOPT_HTTPHEADER,headers); - //res = curl_easy_perform(cHandle); - memset(&chunk,0,sizeof(chunk)); - curl_easy_setopt(cHandle,CURLOPT_WRITEFUNCTION,WriteMemoryCallback); - curl_easy_setopt(cHandle,CURLOPT_WRITEDATA,(void *)&chunk); - curl_easy_perform(cHandle); - curl_easy_getinfo(cHandle,CURLINFO_RESPONSE_CODE,&code); - if ( headers != 0 ) - curl_slist_free_all(headers); - if ( code != 200 ) - printf("(%s) server responded with code %ld (%s)\n",url,code,chunk.memory); - return(chunk.memory); -} - -uint16_t _hush_userpass(char *username, char *password, FILE *fp) -{ - char *rpcuser,*rpcpassword,*str,*ipaddress,line[8192]; uint16_t port = 0; - rpcuser = rpcpassword = 0; - username[0] = password[0] = 0; - while ( fgets(line,sizeof(line),fp) != 0 ) - { - if ( line[0] == '#' ) - continue; - //printf("line.(%s) %p %p\n",line,strstr(line,(char *)"rpcuser"),strstr(line,(char *)"rpcpassword")); - if ( (str= strstr(line,(char *)"rpcuser")) != 0 ) - rpcuser = parse_conf_line(str,(char *)"rpcuser"); - else if ( (str= strstr(line,(char *)"rpcpassword")) != 0 ) - rpcpassword = parse_conf_line(str,(char *)"rpcpassword"); - else if ( (str= strstr(line,(char *)"rpcport")) != 0 ) - { - port = atoi(parse_conf_line(str,(char *)"rpcport")); - //fprintf(stderr,"rpcport.%u in file\n",port); - } - else if ( (str= strstr(line,(char *)"ipaddress")) != 0 ) - { - ipaddress = parse_conf_line(str,(char *)"ipaddress"); - strcpy(IPADDRESS,ipaddress); - } - } - if ( rpcuser != 0 && rpcpassword != 0 ) - { - strcpy(username,rpcuser); - strcpy(password,rpcpassword); - } - //printf("rpcuser.(%s) rpcpassword.(%s) %u ipaddress.%s\n",rpcuser,rpcpassword,port,ipaddress); - if ( rpcuser != 0 ) - free(rpcuser); - if ( rpcpassword != 0 ) - free(rpcpassword); - return(port); -} - -uint16_t hush_userpass(char *userpass,char *symbol) -{ - FILE *fp; uint16_t port = 0; char fname[512],username[512],password[512],confname[HUSH_SMART_CHAIN_MAXLEN]; - userpass[0] = 0; - - sprintf(confname,"%s.conf",symbol); - - //hush_statefname(fname,symbol,confname); - if ( (fp= fopen(confname,"rb")) != 0 ) - { - port = _hush_userpass(username,password,fp); - sprintf(userpass,"%s:%s",username,password); - if ( strcmp(symbol,ASSETCHAINS_SYMBOL) == 0 ) - strcpy(USERPASS,userpass); - fclose(fp); - } - return(port); -} - -#define is_cJSON_True(json) ((json) != 0 && ((json)->type & 0xff) == cJSON_True) - -char *hush_issuemethod(char *userpass,char *method,char *params,uint16_t port) -{ - //static void *cHandle; - char url[512],*retstr=0,*retstr2=0,postdata[8192]; - if ( params == 0 || params[0] == 0 ) - params = (char *)"[]"; - if ( strlen(params) < sizeof(postdata)-128 ) - { - sprintf(url,(char *)"http://%s:%u",IPADDRESS,port); - sprintf(postdata,"{\"method\":\"%s\",\"params\":%s}",method,params); - //printf("[%s] (%s) postdata.(%s) params.(%s) USERPASS.(%s)\n",ASSETCHAINS_SYMBOL,url,postdata,params,USERPASS); - retstr2 = bitcoind_RPC(&retstr,(char *)"debug",url,userpass,method,params); - //retstr = curl_post(&cHandle,url,USERPASS,postdata,0,0,0,0); - } - return(retstr2); -} - -#include "rogue.h" - -int32_t rogue_sendrawtransaction(char *rawtx) -{ - char *params,*retstr,*hexstr; cJSON *retjson,*resobj; int32_t retval = -1; - params = (char *)malloc(strlen(rawtx) + 16); - sprintf(params,"[\"%s\"]",rawtx); - if ( (retstr= hush_issuemethod(USERPASS,"sendrawtransaction",params,ROGUE_PORT)) != 0 ) - { - if ( 0 ) // causes 4th level crash - { - static FILE *fp; - if ( fp == 0 ) - fp = fopen("rogue.sendlog","wb"); - if ( fp != 0 ) - { - fprintf(fp,"%s\n",retstr); - fflush(fp); - } - } - if ( (retjson= cJSON_Parse(retstr)) != 0 ) - { - if ( (resobj= jobj(retjson,"result")) != 0 ) - { - if ( (hexstr= jstr(resobj,0)) != 0 && is_hexstr(hexstr,64) == 64 ) - retval = 0; - } - free_json(retjson); - } - - /* log sendrawtx result in file */ - - /* - FILE *debug_file; - debug_file = fopen("tx_debug.log", "a"); - fprintf(debug_file, "%s\n", retstr); - fflush(debug_file); - fclose(debug_file); - */ - - free(retstr); - } - free(params); - return(retval); -} - -int32_t rogue_progress(struct rogue_state *rs,int32_t waitflag,uint64_t seed,char *keystrokes,int32_t num) -{ - char cmd[16384],hexstr[16384],params[32768],*retstr,*errstr,*rawtx,*pastkeys,*pastcmp,*keys; int32_t i,len,numpastkeys,retflag = -1; cJSON *retjson,*resobj; - //fprintf(stderr,"rogue_progress num.%d\n",num); - if ( rs->guiflag != 0 && Gametxidstr[0] != 0 ) - { - if ( rs->keystrokeshex != 0 ) - { - if ( rogue_sendrawtransaction(rs->keystrokeshex) == 0 ) - { - if ( waitflag == 0 ) - return(0); - else if ( 0 ) - { - while ( rogue_sendrawtransaction(rs->keystrokeshex) == 0 ) - { - //fprintf(stderr,"pre-rebroadcast\n"); - sleep(10); - } - } - } - free(rs->keystrokeshex), rs->keystrokeshex = 0; - } - if ( 0 && (pastkeys= rogue_keystrokesload(&numpastkeys,seed,1)) != 0 ) - { - sprintf(params,"[\"extract\",\"17\",\"[%%22%s%%22]\"]",Gametxidstr); - if ( (retstr= hush_issuemethod(USERPASS,"cclib",params,ROGUE_PORT)) != 0 ) - { - if ( (retjson= cJSON_Parse(retstr)) != 0 ) - { - if ( (resobj= jobj(retjson,"result")) != 0 && (keys= jstr(resobj,"keystrokes")) != 0 ) - { - len = strlen(keys) / 2; - pastcmp = (char *)malloc(len + 1); - decode_hex(pastcmp,len,keys); - fprintf(stderr,"keystrokes.(%s) vs pastkeys\n",keys); - for (i=0; i> keystrokes.log",Gametxidstr,hexstr); - if ( system(cmd) != 0 ) - fprintf(stderr,"error issuing (%s)\n",cmd); - } - else - { - static FILE *fp; - if ( fp == 0 ) - fp = fopen("keystrokes.log","a"); - sprintf(params,"[\"keystrokes\",\"17\",\"[%%22%s%%22,%%22%s%%22]\"]",Gametxidstr,hexstr); - if ( (retstr= hush_issuemethod(USERPASS,"cclib",params,ROGUE_PORT)) != 0 ) - { - if ( fp != 0 ) - { - fprintf(fp,"%s\n",params); - fprintf(fp,"%s\n",retstr); - fflush(fp); - } - if ( (retjson= cJSON_Parse(retstr)) != 0 ) - { - if ( (resobj= jobj(retjson,"result")) != 0 && (rawtx= jstr(resobj,"hex")) != 0 ) - { - if ( rs->keystrokeshex != 0 ) - free(rs->keystrokeshex); - if ( (errstr= jstr(resobj,"error")) == 0 ) - { - rs->keystrokeshex = (char *)malloc(strlen(rawtx)+1); - strcpy(rs->keystrokeshex,rawtx); - retflag = 1; - } else fprintf(stderr,"error sending keystrokes tx\n"), sleep(1); -//fprintf(stderr,"set keystrokestx <- %s\n",rs->keystrokeshex); - } - free_json(retjson); - } - free(retstr); - } - if ( 0 && waitflag != 0 && rs->keystrokeshex != 0 ) - { - while ( rogue_sendrawtransaction(rs->keystrokeshex) == 0 ) - { - //fprintf(stderr,"post-rebroadcast\n"); - sleep(3); - } - free(rs->keystrokeshex), rs->keystrokeshex = 0; - } - } - } - return(retflag); -} - -int32_t rogue_setplayerdata(struct rogue_state *rs,char *gametxidstr) -{ - char cmd[32768]; int32_t i,n,retval=-1; char params[1024],*filestr=0,*pname,*statusstr,*datastr,fname[128]; long allocsize; cJSON *retjson,*array,*item,*resultjson; - if ( rs->guiflag == 0 ) - return(-1); - if ( gametxidstr == 0 || *gametxidstr == 0 ) - return(retval); - if ( 0 ) - { - sprintf(fname,"%s.gameinfo",gametxidstr); - sprintf(cmd,"./hush-cli -ac_name=ROGUE cclib gameinfo 17 \\\"[%%22%s%%22]\\\" > %s",gametxidstr,fname); - if ( system(cmd) != 0 ) - fprintf(stderr,"error issuing (%s)\n",cmd); - else filestr = (char *)OS_fileptr(&allocsize,fname); - } - else - { - sprintf(params,"[\"gameinfo\",\"17\",\"[%%22%s%%22]\"]",gametxidstr); - filestr = hush_issuemethod(USERPASS,"cclib",params,ROGUE_PORT); - } - if ( filestr != 0 ) - { - if ( (retjson= cJSON_Parse(filestr)) != 0 && (resultjson= jobj(retjson,"result")) != 0 ) - { - //fprintf(stderr,"gameinfo.(%s)\n",jprint(resultjson,0)); - if ( (array= jarray(&n,resultjson,"players")) != 0 ) - { - for (i=0; iP,(int32_t)strlen(datastr)/2,datastr); - fprintf(stderr,"set pname[%s] %s\n",pname==0?"":pname,jprint(item,0)); - rs->restoring = 1; - } - } - } - } - } - free_json(retjson); - } - free(filestr); - } - return(retval); -} - -#ifdef _WIN32 -#ifdef _MSC_VER -__inline int msver(void) { - switch (_MSC_VER) { - case 1500: return 2008; - case 1600: return 2010; - case 1700: return 2012; - case 1800: return 2013; - case 1900: return 2015; - //case 1910: return 2017; - default: return (_MSC_VER / 100); - } -} - -static inline bool is_x64(void) { -#if defined(__x86_64__) || defined(_WIN64) || defined(__aarch64__) - return 1; -#elif defined(__amd64__) || defined(__amd64) || defined(_M_X64) || defined(_M_IA64) - return 1; -#else - return 0; -#endif -} - -#define BUILD_DATE __DATE__ " " __TIME__ -#endif // _WIN32 -#endif // _MSC_VER - -int main(int argc, char **argv, char **envp) -{ - uint64_t seed; FILE *fp = 0; int32_t i,j,c; char userpass[8192]; - - #ifdef _WIN32 - #ifdef _MSC_VER - printf("*** rogue for Windows [ Build %s ] ***\n", BUILD_DATE); - const char* arch = is_x64() ? "64-bits" : "32-bits"; - printf(" Built with VC++ %d (%ld) %s\n\n", msver(), _MSC_FULL_VER, arch); - #endif - #endif - - for (i=j=0; argv[0][i]!=0&&j -#include - -#if defined(_WIN32) -#include -#include -#include -#include -#pragma warning( disable: 4201 ) -#include -#pragma warning( default: 4201 ) -#include -#undef MOUSE_MOVED -#endif - -//#include -#include "extern.h" - -#if defined(HAVE_SYS_TYPES) -#include -#endif - -#if defined(HAVE_PROCESS_H) -#include -#endif - -#if defined(HAVE_PWD_H) -#include -#endif - -#if defined(HAVE_SYS_UTSNAME) -#include -#endif - -#if defined(HAVE_ARPA_INET_H) -#include /* Solaris 2.8 required this for htonl() and ntohl() */ -#endif - -#if defined(HAVE_TERMIOS_H) -#include -#endif - -#if defined(HAVE_UNISTD_H) -#ifndef __USE_GNU -#define __USE_GNU -#include -#undef __USE_GNU -#else -#include -#endif -#endif - -#ifndef BUILD_ROGUE -#include /* AIX requires curses.h be included before term.h */ -#else -#include "cursesd.h" -#endif - - -#if defined(HAVE_TERM_H) -#include -#elif defined(HAVE_NCURSES_TERM_H) -#include -#endif - -#if defined(HAVE_WORKING_FORK) -#include -#endif - -#include -#include -#include -#include -#include -#include "extern.h" - -#if !defined(PATH_MAX) && defined(_MAX_PATH) -#define PATH_MAX _MAX_PATH -#endif - -#if !defined(PATH_MAX) && defined(_PATH_MAX) -#define PATH_MAX _PATH_MAX -#endif - -#define NOOP(x) (x += 0) - -void -md_init() -{ -#if defined(__INTERIX) - char *term; - - term = getenv("TERM"); - - if (term == NULL) - setenv("TERM","interix"); -#elif defined(__DJGPP__) - _fmode = _O_BINARY; -#elif defined(_WIN32) - _fmode = _O_BINARY; -#endif - -#if defined(HAVE_ESCDELAY) || defined(NCURSES_VERSION) - ESCDELAY=64; -#endif - -#if defined(DUMP) - md_onsignal_default(); -#else - md_onsignal_exit(); -#endif -} - -void -md_onsignal_default() -{ -#ifdef SIGHUP - signal(SIGHUP, SIG_DFL); -#endif -#ifdef SIGQUIT - signal(SIGQUIT, SIG_DFL); -#endif -#ifdef SIGILL - signal(SIGILL, SIG_DFL); -#endif -#ifdef SIGTRAP - signal(SIGTRAP, SIG_DFL); -#endif -#ifdef SIGIOT - signal(SIGIOT, SIG_DFL); -#endif -#ifdef SIGEMT - signal(SIGEMT, SIG_DFL); -#endif -#ifdef SIGFPE - signal(SIGFPE, SIG_DFL); -#endif -#ifdef SIGBUS - signal(SIGBUS, SIG_DFL); -#endif -#ifdef SIGSEGV - signal(SIGSEGV, SIG_DFL); -#endif -#ifdef SIGSYS - signal(SIGSYS, SIG_DFL); -#endif -#ifdef SIGTERM - signal(SIGTERM, SIG_DFL); -#endif -} - -void -md_onsignal_exit() -{ -#ifdef SIGHUP - signal(SIGHUP, SIG_DFL); -#endif -#ifdef SIGQUIT - signal(SIGQUIT, exit); -#endif -#ifdef SIGILL - signal(SIGILL, exit); -#endif -#ifdef SIGTRAP - signal(SIGTRAP, exit); -#endif -#ifdef SIGIOT - signal(SIGIOT, exit); -#endif -#ifdef SIGEMT - signal(SIGEMT, exit); -#endif -#ifdef SIGFPE - signal(SIGFPE, exit); -#endif -#ifdef SIGBUS - signal(SIGBUS, exit); -#endif -#ifdef SIGSEGV - signal(SIGSEGV, exit); -#endif -#ifdef SIGSYS - signal(SIGSYS, exit); -#endif -#ifdef SIGTERM - signal(SIGTERM, exit); -#endif -} - -void -md_onsignal_autosave() -{ -#ifdef SIGHUP - signal(SIGHUP, auto_save); -#endif -#ifdef SIGQUIT - signal(SIGQUIT, endit); -#endif -#ifdef SIGILL - signal(SIGILL, auto_save); -#endif -#ifdef SIGTRAP - signal(SIGTRAP, auto_save); -#endif -#ifdef SIGIOT - signal(SIGIOT, auto_save); -#endif -#ifdef SIGEMT - signal(SIGEMT, auto_save); -#endif -#ifdef SIGFPE - signal(SIGFPE, auto_save); -#endif -#ifdef SIGBUS - signal(SIGBUS, auto_save); -#endif -#ifdef SIGSEGV - signal(SIGSEGV, auto_save); -#endif -#ifdef SIGSYS - signal(SIGSYS, auto_save); -#endif -#ifdef SIGTERM - signal(SIGTERM, auto_save); -#endif -#ifdef SIGINT - signal(SIGINT, quit); -#endif -} - -int -md_hasclreol() -{ -/*#if defined(clr_eol) -#ifdef NCURSES_VERSION - if (cur_term == NULL) - return(0); - //if (cur_term->type.Strings == NULL) - return(0); -#endif - return((clr_eol != NULL) && (*clr_eol != 0)); -#elif defined(__PDCURSES__) - return(TRUE); -#else - return((CE != NULL) && (*CE != 0)); -#endif*/ - return(0); -} - -void -md_putchar(int c) -{ - putchar(c); -} - -#ifdef _WIN32 -static int md_standout_mode = 0; -#endif - -void -md_raw_standout() -{ -#ifdef _WIN32 - CONSOLE_SCREEN_BUFFER_INFO csbiInfo; - HANDLE hStdout; - WORD fgattr,bgattr; - - if (md_standout_mode == 0) - { - hStdout = GetStdHandle(STD_OUTPUT_HANDLE); - GetConsoleScreenBufferInfo(hStdout, &csbiInfo); - fgattr = (csbiInfo.wAttributes & 0xF); - bgattr = (csbiInfo.wAttributes & 0xF0); - SetConsoleTextAttribute(hStdout,(fgattr << 4) | (bgattr >> 4)); - md_standout_mode = 1; - } -#elif defined(SO) - tputs(SO,0,md_putchar); - fflush(stdout); -#endif -} - -void -md_raw_standend() -{ -#ifdef _WIN32 - CONSOLE_SCREEN_BUFFER_INFO csbiInfo; - HANDLE hStdout; - WORD fgattr,bgattr; - - if (md_standout_mode == 1) - { - hStdout = GetStdHandle(STD_OUTPUT_HANDLE); - GetConsoleScreenBufferInfo(hStdout, &csbiInfo); - fgattr = (csbiInfo.wAttributes & 0xF); - bgattr = (csbiInfo.wAttributes & 0xF0); - SetConsoleTextAttribute(hStdout,(fgattr << 4) | (bgattr >> 4)); - md_standout_mode = 0; - } -#elif defined(SE) - tputs(SE,0,md_putchar); - fflush(stdout); -#endif -} - -int -md_unlink_open_file(char *file, FILE *inf) -{ -#ifdef _WIN32 - fclose(inf); - _chmod(file, 0600); - return( _unlink(file) ); -#else - return(unlink(file)); -#endif -} - -int -md_unlink(char *file) -{ -#ifdef _WIN32 - _chmod(file, 0600); - return( _unlink(file) ); -#else - return(unlink(file)); -#endif -} - -int -md_chmod(char *filename, int mode) -{ -#ifdef _WIN32 - return( _chmod(filename, mode) ); -#else - return( chmod(filename, mode) ); -#endif -} - -void -md_normaluser() -{ -#if defined(HAVE_GETGID) && defined(HAVE_GETUID) - gid_t realgid = getgid(); - uid_t realuid = getuid(); - -#if defined(HAVE_SETRESGID) - if (setresgid(-1, realgid, realgid) != 0) { -#elif defined (HAVE_SETREGID) - if (setregid(realgid, realgid) != 0) { -#elif defined (HAVE_SETGID) - if (setgid(realgid) != 0) { -#else - if (0) { -#endif - perror("Could not drop setgid privileges. Aborting."); - exit(1); - } - -#if defined(HAVE_SETRESUID) - if (setresuid(-1, realuid, realuid) != 0) { -#elif defined(HAVE_SETREUID) - if (setreuid(realuid, realuid) != 0) { -#elif defined(HAVE_SETUID) - if (setuid(realuid) != 0) { -#else - if (0) { -#endif - perror("Could not drop setuid privileges. Aborting."); - exit(1); - } -#endif -} - -int -md_getuid() -{ -#ifdef HAVE_GETUID - return( getuid() ); -#else - return(42); -#endif -} - -int -md_getpid() -{ -#ifdef _WIN32 - return( _getpid() ); -#else - return( getpid() ); -#endif -} - -char * -md_getusername() -{ - static char login[80]; - char *l = NULL; -#ifdef _WIN32 - LPSTR mybuffer; - DWORD size = UNLEN + 1; - TCHAR buffer[UNLEN + 1]; - - mybuffer = buffer; - GetUserName(mybuffer,&size); - l = mybuffer; -#elif defined(HAVE_GETPWUID)&& !defined(__DJGPP__) - struct passwd *pw; - - pw = getpwuid(getuid()); - - l = pw->pw_name; -#endif - - if ((l == NULL) || (*l == '\0')) - if ( (l = getenv("USERNAME")) == NULL ) - if ( (l = getenv("LOGNAME")) == NULL ) - if ( (l = getenv("USER")) == NULL ) - l = "nobody"; - - strncpy(login,l,80); - login[79] = 0; - - return(login); -} - -char * -md_gethomedir() -{ - static char homedir[PATH_MAX]; - char *h = NULL; - size_t len; -#if defined(_WIN32) - TCHAR szPath[PATH_MAX]; -#endif -#if defined(_WIN32) || defined(DJGPP) - char slash = '\\'; -#else - char slash = '/'; - struct passwd *pw; - pw = getpwuid(getuid()); - - h = pw->pw_dir; - - if (strcmp(h,"/") == 0) - h = NULL; -#endif - homedir[0] = 0; -#ifdef _WIN32 - if(SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, 0, szPath))) - h = szPath; -#endif - - if ( (h == NULL) || (*h == '\0') ) - { - if ( (h = getenv("HOME")) == NULL ) - { - if ( (h = getenv("HOMEDRIVE")) == NULL) - h = ""; - else - { - strncpy(homedir,h,PATH_MAX-1); - homedir[PATH_MAX-1] = 0; - - if ( (h = getenv("HOMEPATH")) == NULL) - h = ""; - } - } - } - - - len = strlen(homedir); - strncat(homedir,h,PATH_MAX-len-1); - len = strlen(homedir); - - if ((len > 0) && (homedir[len-1] != slash)) { - homedir[len] = slash; - homedir[len+1] = 0; - } - - return(homedir); -} - -void -md_sleep(int s) -{ -#ifdef _WIN32 - Sleep(s); -#else - sleep(s); -#endif -} - -char * -md_getshell() -{ - static char shell[PATH_MAX]; - char *s = NULL; -#ifdef _WIN32 - char *def = "C:\\WINDOWS\\SYSTEM32\\CMD.EXE"; -#elif defined(__DJGPP__) - char *def = "C:\\COMMAND.COM"; -#else - char *def = "/bin/sh"; - struct passwd *pw; - pw = getpwuid(getuid()); - s = pw->pw_shell; -#endif - if ((s == NULL) || (*s == '\0')) - if ( (s = getenv("COMSPEC")) == NULL) - if ( (s = getenv("SHELL")) == NULL) - if ( (s = getenv("SystemRoot")) == NULL) - s = def; - - strncpy(shell,s,PATH_MAX); - shell[PATH_MAX-1] = 0; - - return(shell); -} - -int -md_shellescape() -{ -#if defined(HAVE_WORKING_FORK) - int ret_status; - int pid; - void (*myquit)(int); - void (*myend)(int); - char *sh; - - sh = md_getshell(); - - while((pid = fork()) < 0) - sleep(1); - - if (pid == 0) /* Shell Process */ - { - /* - * Set back to original user, just in case - */ - md_normaluser(); - execl(sh == NULL ? "/bin/sh" : sh, "shell", "-i", NULL); - perror("No shelly"); - _exit(-1); - } - else /* Application */ - { - myend = signal(SIGINT, SIG_IGN); -#ifdef SIGQUIT - myquit = signal(SIGQUIT, SIG_IGN); -#endif - while (wait(&ret_status) != pid) - continue; - - signal(SIGINT, myquit); -#ifdef SIGQUIT - signal(SIGQUIT, myend); -#endif - } - return(ret_status); -#elif defined(HAVE__SPAWNL) - return((int)_spawnl(_P_WAIT,md_getshell(),"shell",NULL,0)); -#elif defined(HAVE_SPAWNL) - return ( spawnl(P_WAIT,md_getshell(),"shell",NULL,0) ); -#else - return(0); -#endif -} - -int -directory_exists(char *dirname) -{ - struct stat sb; - - if (stat(dirname, &sb) == 0) /* path exists */ - return (sb.st_mode & S_IFDIR); - - return(0); -} - -char * -md_getrealname(int uid) -{ - static char uidstr[20]; -#if !defined(_WIN32) && !defined(DJGPP) - struct passwd *pp; - - if ((pp = getpwuid(uid)) == NULL) - { - sprintf(uidstr,"%d", uid); - return(uidstr); - } - else - return(pp->pw_name); -#else - sprintf(uidstr,"%d", uid); - return(uidstr); -#endif -} - -extern char *xcrypt(char *key, char *salt); - -char * -md_crypt(char *key, char *salt) -{ - return( xcrypt(key,salt) ); -} - -char * -md_getpass(char *prompt) -{ -#ifndef HAVE_GETPASS - static char password_buffer[9]; - char *p = password_buffer; - int c, count = 0; - int max_length = 9; - - fflush(stdout); - /* If we can't prompt, abort */ - if (fputs(prompt, stderr) < 0) - { - *p = '\0'; - return NULL; - } - - for(;;) - { - /* Get a character with no echo */ - c = _getch(); - - /* Exit on interrupt (^c or ^break) */ - if (c == '\003' || c == 0x100) - exit(1); - - /* Terminate on end of line or file (^j, ^m, ^d, ^z) */ - if (c == '\r' || c == '\n' || c == '\004' || c == '\032') - break; - - /* Back up on backspace */ - if (c == '\b') - { - if (count) - count--; - else if (p > password_buffer) - p--; - continue; - } - - /* Ignore DOS extended characters */ - if ((c & 0xff) != c) - continue; - - /* Add to password if it isn't full */ - if (p < password_buffer + max_length - 1) - *p++ = (char) c; - else - count++; - } - *p = '\0'; - - fputc('\n', stderr); - - return password_buffer; -#else - return( (char *) getpass(prompt) ); -#endif -} - -int -md_erasechar() -{ -#ifdef HAVE_ERASECHAR - return( erasechar() ); /* process erase character */ -#elif defined(VERASE) - return(_tty.c_cc[VERASE]); /* process erase character */ -#else - #ifndef __MINGW32__ - return(_tty.sg_erase); /* process erase character */ - #endif -#endif -} - -int -md_killchar() -{ -#ifdef HAVE_KILLCHAR - return( killchar() ); -#elif defined(VKILL) - return(_tty.c_cc[VKILL]); -#else - #ifndef __MINGW32__ - return(_tty.sg_kill); - #endif -#endif -} - -int -md_dsuspchar() -{ -#if defined(VDSUSP) /* POSIX has priority */ - struct termios attr; - tcgetattr(STDIN_FILENO, &attr); - return( attr.c_cc[VDSUSP] ); -#elif defined(TIOCGLTC) - struct ltchars ltc; - ioctl(1, TIOCGLTC, <c); - return(ltc.t_dsuspc); -#elif defined(_POSIX_VDISABLE) - return(_POSIX_VDISABLE); -#else - return(0); -#endif -} - -int -md_setdsuspchar(int c) -{ -#if defined(VDSUSP) /* POSIX has priority */ - struct termios attr; - tcgetattr(STDIN_FILENO, &attr); - attr.c_cc[VDSUSP] = c; - tcgetattr(STDIN_FILENO, &attr); -#elif defined(TIOCSLTC) - struct ltchars ltc; - ioctl(1, TIOCGLTC, <c); - ltc.t_dsuspc = c; - ioctl(1, TIOCSLTC, <c); -#else - NOOP(c); -#endif - return(0); -} - -int -md_suspchar() -{ -#if defined(VSUSP) /* POSIX has priority */ - struct termios attr; - tcgetattr(STDIN_FILENO, &attr); - return( attr.c_cc[VSUSP] ); -#elif defined(TIOCGLTC) - struct ltchars ltc; - ioctl(1, TIOCGLTC, <c); - return(ltc.t_suspc); -#elif defined(_POSIX_VDISABLE) - return(_POSIX_VDISABLE); -#else - return(0); -#endif -} - -int -md_setsuspchar(int c) -{ -#if defined(VSUSP) /* POSIX has priority */ - struct termios attr; - tcgetattr(STDIN_FILENO, &attr); - attr.c_cc[VSUSP] = c; - tcgetattr(STDIN_FILENO, &attr); -#elif defined(TIOCSLTC) - struct ltchars ltc; - ioctl(1, TIOCGLTC, <c); - ltc.t_suspc = c; - ioctl(1, TIOCSLTC, <c); -#else - NOOP(c); -#endif - - return(0); -} - -/* - Cursor/Keypad Support - - Sadly Cursor/Keypad support is less straightforward than it should be. - - The various terminal emulators/consoles choose to differentiate the - cursor and keypad keys (with modifiers) in different ways (if at all!). - Furthermore they use different code set sequences for each key only - a subset of which the various curses libraries recognize. Partly due - to incomplete termcap/terminfo entries and partly due to inherent - limitations of those terminal capability databases. - - I give curses first crack at decoding the sequences. If it fails to decode - it we check for common ESC-prefixed sequences. - - All cursor/keypad results are translated into standard rogue movement - commands. - - Unmodified keys are translated to walk commands: hjklyubn - Modified (shift,control,alt) are translated to run commands: HJKLYUBN - - Console and supported (differentiated) keys - Interix: Cursor Keys, Keypad, Ctl-Keypad - Cygwin: Cursor Keys, Keypad, Alt-Cursor Keys - MSYS: Cursor Keys, Keypad, Ctl-Cursor Keys, Ctl-Keypad - Win32: Cursor Keys, Keypad, Ctl/Shift/Alt-Cursor Keys, Ctl/Alt-Keypad - DJGPP: Cursor Keys, Keypad, Ctl/Shift/Alt-Cursor Keys, Ctl/Alt-Keypad - - Interix Console (raw, ncurses) - ============================== - normal shift ctrl alt - ESC [D, ESC F^, ESC [D, ESC [D /# Left #/ - ESC [C, ESC F$, ESC [C, ESC [C /# Right #/ - ESC [A, ESC F-, local win, ESC [A /# Up #/ - ESC [B, ESC F+, local win, ESC [B /# Down #/ - ESC [H, ESC [H, ESC [H, ESC [H /# Home #/ - ESC [S, local win, ESC [S, ESC [S /# Page Up #/ - ESC [T, local win, ESC [T, ESC [T /# Page Down #/ - ESC [U, ESC [U, ESC [U, ESC [U /# End #/ - ESC [D, ESC F^, ESC [D, O /# Keypad Left #/ - ESC [C, ESC F$, ESC [C, O /# Keypad Right #/ - ESC [A, ESC [A, ESC [-1, O /# Keypad Up #/ - ESC [B, ESC [B, ESC [-2, O /# Keypad Down #/ - ESC [H, ESC [H, ESC [-263, O /# Keypad Home #/ - ESC [S, ESC [S, ESC [-19, O /# Keypad PgUp #/ - ESC [T, ESC [T, ESC [-20, O /# Keypad PgDn #/ - ESC [U, ESC [U, ESC [-21, O /# Keypad End #/ - nothing, nothing, nothing, O /# Kaypad 5 #/ - - Interix Console (term=interix, ncurses) - ============================== - KEY_LEFT, ESC F^, KEY_LEFT, KEY_LEFT /# Left #/ - KEY_RIGHT, ESC F$, KEY_RIGHT, KEY_RIGHT /# Right #/ - KEY_UP, 0x146, local win, KEY_UP /# Up #/ - KEY_DOWN, 0x145, local win, KEY_DOWN /# Down #/ - ESC [H, ESC [H, ESC [H, ESC [H /# Home #/ - KEY_PPAGE, local win, KEY_PPAGE, KEY_PPAGE /# Page Up #/ - KEY_NPAGE, local win, KEY_NPAGE, KEY_NPAGE /# Page Down #/ - KEY_LL, KEY_LL, KEY_LL, KEY_LL /# End #/ - KEY_LEFT, ESC F^, ESC [-4, O /# Keypad Left #/ - KEY_RIGHT, ESC F$, ESC [-3, O /# Keypad Right #/ - KEY_UP, KEY_UP, ESC [-1, O /# Keypad Up #/ - KEY_DOWN, KEY_DOWN, ESC [-2, O /# Keypad Down #/ - ESC [H, ESC [H, ESC [-263, O /# Keypad Home #/ - KEY_PPAGE, KEY_PPAGE, ESC [-19, O /# Keypad PgUp #/ - KEY_NPAGE, KEY_NPAGE, ESC [-20, O /# Keypad PgDn #/ - KEY_LL, KEY_LL, ESC [-21, O /# Keypad End #/ - nothing, nothing, nothing, O /# Keypad 5 #/ - - Cygwin Console (raw, ncurses) - ============================== - normal shift ctrl alt - ESC [D, ESC [D, ESC [D, ESC ESC [D /# Left #/ - ESC [C, ESC [C, ESC [C, ESC ESC [C /# Rght #/ - ESC [A, ESC [A, ESC [A, ESC ESC [A /# Up #/ - ESC [B, ESC [B, ESC [B, ESC ESC [B /# Down #/ - ESC [1~, ESC [1~, ESC [1~, ESC ESC [1~ /# Home #/ - ESC [5~, ESC [5~, ESC [5~, ESC ESC [5~ /# Page Up #/ - ESC [6~, ESC [6~, ESC [6~, ESC ESC [6~ /# Page Down #/ - ESC [4~, ESC [4~, ESC [4~, ESC ESC [4~ /# End #/ - ESC [D, ESC [D, ESC [D, ESC ESC [D,O /# Keypad Left #/ - ESC [C, ESC [C, ESC [C, ESC ESC [C,O /# Keypad Right #/ - ESC [A, ESC [A, ESC [A, ESC ESC [A,O /# Keypad Up #/ - ESC [B, ESC [B, ESC [B, ESC ESC [B,O /# Keypad Down #/ - ESC [1~, ESC [1~, ESC [1~, ESC ESC [1~,O /# Keypad Home #/ - ESC [5~, ESC [5~, ESC [5~, ESC ESC [5~,O /# Keypad PgUp #/ - ESC [6~, ESC [6~, ESC [6~, ESC ESC [6~,O /# Keypad PgDn #/ - ESC [4~, ESC [4~, ESC [4~, ESC ESC [4~,O /# Keypad End #/ - ESC [-71, nothing, nothing, O /# Keypad 5 #/ - - Cygwin Console (term=cygwin, ncurses) - ============================== - KEY_LEFT, KEY_LEFT, KEY_LEFT, ESC-260 /# Left #/ - KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, ESC-261 /# Rght #/ - KEY_UP, KEY_UP, KEY_UP, ESC-259 /# Up #/ - KEY_DOWN, KEY_DOWN, KEY_DOWN, ESC-258 /# Down #/ - KEY_HOME, KEY_HOME, KEY_HOME, ESC-262 /# Home #/ - KEY_PPAGE, KEY_PPAGE, KEY_PPAGE, ESC-339 /# Page Up #/ - KEY_NPAGE, KEY_NPAGE, KEY_NPAGE, ESC-338 /# Page Down #/ - KEY_END, KEY_END, KEY_END, ESC-360 /# End #/ - KEY_LEFT, KEY_LEFT, KEY_LEFT, ESC-260,O /# Keypad Left #/ - KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, ESC-261,O /# Keypad Right #/ - KEY_UP, KEY_UP, KEY_UP, ESC-259,O /# Keypad Up #/ - KEY_DOWN, KEY_DOWN, KEY_DOWN, ESC-258,O /# Keypad Down #/ - KEY_HOME, KEY_HOME, KEY_HOME, ESC-262,O /# Keypad Home #/ - KEY_PPAGE, KEY_PPAGE, KEY_PPAGE, ESC-339,O /# Keypad PgUp #/ - KEY_NPAGE, KEY_NPAGE, KEY_NPAGE, ESC-338,O /# Keypad PgDn #/ - KEY_END, KEY_END, KEY_END, ESC-360,O /# Keypad End #/ - ESC [G, nothing, nothing, O /# Keypad 5 #/ - - MSYS Console (raw, ncurses) - ============================== - normal shift ctrl alt - ESC OD, ESC [d, ESC Od nothing /# Left #/ - ESC OE, ESC [e, ESC Oe, nothing /# Right #/ - ESC OA, ESC [a, ESC Oa, nothing /# Up #/ - ESC OB, ESC [b, ESC Ob, nothing /# Down #/ - ESC [7~, ESC [7$, ESC [7^, nothing /# Home #/ - ESC [5~, local window, ESC [5^, nothing /# Page Up #/ - ESC [6~, local window, ESC [6^, nothing /# Page Down #/ - ESC [8~, ESC [8$, ESC [8^, nothing /# End #/ - ESC OD, ESC [d, ESC Od O /# Keypad Left #/ - ESC OE, ESC [c, ESC Oc, O /# Keypad Right #/ - ESC OA, ESC [a, ESC Oa, O /# Keypad Up #/ - ESC OB, ESC [b, ESC Ob, O /# Keypad Down #/ - ESC [7~, ESC [7$, ESC [7^, O /# Keypad Home #/ - ESC [5~, local window, ESC [5^, O /# Keypad PgUp #/ - ESC [6~, local window, ESC [6^, O /# Keypad PgDn #/ - ESC [8~, ESC [8$, ESC [8^, O /# Keypad End #/ - 11, 11, 11, O /# Keypad 5 #/ - - MSYS Console (term=rxvt, ncurses) - ============================== - normal shift ctrl alt - KEY_LEFT, KEY_SLEFT, 514 nothing /# Left #/ - KEY_RIGHT, KEY_SRIGHT, 516, nothing /# Right #/ - KEY_UP, 518, 519, nothing /# Up #/ - KEY_DOWN, 511, 512, nothing /# Down #/ - KEY_HOME, KEY_SHOME, ESC [7^, nothing /# Home #/ - KEY_PPAGE, local window, ESC [5^, nothing /# Page Up #/ - KEY_NPAGE, local window, ESC [6^, nothing /# Page Down #/ - KEY_END, KEY_SEND, KEY_EOL, nothing /# End #/ - KEY_LEFT, KEY_SLEFT, 514 O /# Keypad Left #/ - KEY_RIGHT, KEY_SRIGHT, 516, O /# Keypad Right #/ - KEY_UP, 518, 519, O /# Keypad Up #/ - KEY_DOWN, 511, 512, O /# Keypad Down #/ - KEY_HOME, KEY_SHOME, ESC [7^, O /# Keypad Home #/ - KEY_PPAGE, local window, ESC [5^, O /# Keypad PgUp #/ - KEY_NPAGE, local window, ESC [6^, O /# Keypad PgDn #/ - KEY_END, KEY_SEND, KEY_EOL, O /# Keypad End #/ - 11, 11, 11, O /# Keypad 5 #/ - - Win32 Console (raw, pdcurses) - DJGPP Console (raw, pdcurses) - ============================== - normal shift ctrl alt - 260, 391, 443, 493 /# Left #/ - 261, 400, 444, 492 /# Right #/ - 259, 547, 480, 490 /# Up #/ - 258, 548, 481, 491 /# Down #/ - 262, 388, 447, 524 /# Home #/ - 339, 396, 445, 526 /# Page Up #/ - 338, 394, 446, 520 /# Page Down #/ - 358, 384, 448, 518 /# End #/ - 452, 52('4'), 511, 521 /# Keypad Left #/ - 454, 54('6'), 513, 523 /# Keypad Right #/ - 450, 56('8'), 515, 525 /# Keypad Up #/ - 456, 50('2'), 509, 519 /# Keypad Down #/ - 449, 55('7'), 514, 524 /# Keypad Home #/ - 451, 57('9'), 516, 526 /# Keypad PgUp #/ - 457, 51('3'), 510, 520 /# Keypad PgDn #/ - 455, 49('1'), 508, 518 /# Keypad End #/ - 453, 53('5'), 512, 522 /# Keypad 5 #/ - - Win32 Console (pdcurses, MSVC/MingW32) - DJGPP Console (pdcurses) - ============================== - normal shift ctrl alt - KEY_LEFT, KEY_SLEFT, CTL_LEFT, ALT_LEFT /# Left #/ - KEY_RIGHT, KEY_SRIGHT, CTL_RIGHT, ALT_RIGHT /# Right #/ - KEY_UP, KEY_SUP, CTL_UP, ALT_UP /# Up #/ - KEY_DOWN, KEY_SDOWN, CTL_DOWN, ALT_DOWN /# Down #/ - KEY_HOME, KEY_SHOME, CTL_HOME, ALT_HOME /# Home #/ - KEY_PPAGE, KEY_SPREVIOUS, CTL_PGUP, ALT_PGUP /# Page Up #/ - KEY_NPAGE, KEY_SNEXTE, CTL_PGDN, ALT_PGDN /# Page Down #/ - KEY_END, KEY_SEND, CTL_END, ALT_END /# End #/ - KEY_B1, 52('4'), CTL_PAD4, ALT_PAD4 /# Keypad Left #/ - KEY_B3, 54('6'), CTL_PAD6, ALT_PAD6 /# Keypad Right #/ - KEY_A2, 56('8'), CTL_PAD8, ALT_PAD8 /# Keypad Up #/ - KEY_C2, 50('2'), CTL_PAD2, ALT_PAD2 /# Keypad Down #/ - KEY_A1, 55('7'), CTL_PAD7, ALT_PAD7 /# Keypad Home #/ - KEY_A3, 57('9'), CTL_PAD9, ALT_PAD9 /# Keypad PgUp #/ - KEY_C3, 51('3'), CTL_PAD3, ALT_PAD3 /# Keypad PgDn #/ - KEY_C1, 49('1'), CTL_PAD1, ALT_PAD1 /# Keypad End #/ - KEY_B2, 53('5'), CTL_PAD5, ALT_PAD5 /# Keypad 5 #/ - - Windows Telnet (raw) - ============================== - normal shift ctrl alt - ESC [D, ESC [D, ESC [D, ESC [D /# Left #/ - ESC [C, ESC [C, ESC [C, ESC [C /# Right #/ - ESC [A, ESC [A, ESC [A, ESC [A /# Up #/ - ESC [B, ESC [B, ESC [B, ESC [B /# Down #/ - ESC [1~, ESC [1~, ESC [1~, ESC [1~ /# Home #/ - ESC [5~, ESC [5~, ESC [5~, ESC [5~ /# Page Up #/ - ESC [6~, ESC [6~, ESC [6~, ESC [6~ /# Page Down #/ - ESC [4~, ESC [4~, ESC [4~, ESC [4~ /# End #/ - ESC [D, ESC [D, ESC [D, ESC [D /# Keypad Left #/ - ESC [C, ESC [C, ESC [C, ESC [C /# Keypad Right #/ - ESC [A, ESC [A, ESC [A, ESC [A /# Keypad Up #/ - ESC [B, ESC [B, ESC [B, ESC [B /# Keypad Down #/ - ESC [1~, ESC [1~, ESC [1~, ESC [1~ /# Keypad Home #/ - ESC [5~, ESC [5~, ESC [5~, ESC [5~ /# Keypad PgUp #/ - ESC [6~, ESC [6~, ESC [6~, ESC [6~ /# Keypad PgDn #/ - ESC [4~, ESC [4~, ESC [4~, ESC [4~ /# Keypad End #/ - nothing, nothing, nothing, nothing /# Keypad 5 #/ - - Windows Telnet (term=xterm) - ============================== - normal shift ctrl alt - KEY_LEFT, KEY_LEFT, KEY_LEFT, KEY_LEFT /# Left #/ - KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT /# Right #/ - KEY_UP, KEY_UP, KEY_UP, KEY_UP /# Up #/ - KEY_DOWN, KEY_DOWN, KEY_DOWN, KEY_DOWN /# Down #/ - ESC [1~, ESC [1~, ESC [1~, ESC [1~ /# Home #/ - KEY_PPAGE, KEY_PPAGE, KEY_PPAGE, KEY_PPAGE /# Page Up #/ - KEY_NPAGE, KEY_NPAGE, KEY_NPAGE, KEY_NPAGE /# Page Down #/ - ESC [4~, ESC [4~, ESC [4~, ESC [4~ /# End #/ - KEY_LEFT, KEY_LEFT, KEY_LEFT, O /# Keypad Left #/ - KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, O /# Keypad Right #/ - KEY_UP, KEY_UP, KEY_UP, O /# Keypad Up #/ - KEY_DOWN, KEY_DOWN, KEY_DOWN, O /# Keypad Down #/ - ESC [1~, ESC [1~, ESC [1~, ESC [1~ /# Keypad Home #/ - KEY_PPAGE, KEY_PPAGE, KEY_PPAGE, KEY_PPAGE /# Keypad PgUp #/ - KEY_NPAGE, KEY_NPAGE, KEY_NPAGE, KEY_NPAGE /# Keypad PgDn #/ - ESC [4~, ESC [4~, ESC [4~, O /# Keypad End #/ - ESC [-71, nothing, nothing, O /# Keypad 5 #/ - - PuTTY - ============================== - normal shift ctrl alt - ESC [D, ESC [D, ESC OD, ESC [D /# Left #/ - ESC [C, ESC [C, ESC OC, ESC [C /# Right #/ - ESC [A, ESC [A, ESC OA, ESC [A /# Up #/ - ESC [B, ESC [B, ESC OB, ESC [B /# Down #/ - ESC [1~, ESC [1~, local win, ESC [1~ /# Home #/ - ESC [5~, local win, local win, ESC [5~ /# Page Up #/ - ESC [6~, local win, local win, ESC [6~ /# Page Down #/ - ESC [4~, ESC [4~, local win, ESC [4~ /# End #/ - ESC [D, ESC [D, ESC [D, O /# Keypad Left #/ - ESC [C, ESC [C, ESC [C, O /# Keypad Right #/ - ESC [A, ESC [A, ESC [A, O /# Keypad Up #/ - ESC [B, ESC [B, ESC [B, O /# Keypad Down #/ - ESC [1~, ESC [1~, ESC [1~, O /# Keypad Home #/ - ESC [5~, ESC [5~, ESC [5~, O /# Keypad PgUp #/ - ESC [6~, ESC [6~, ESC [6~, O /# Keypad PgDn #/ - ESC [4~, ESC [4~, ESC [4~, O /# Keypad End #/ - nothing, nothing, nothing, O /# Keypad 5 #/ - - PuTTY - ============================== - normal shift ctrl alt - KEY_LEFT, KEY_LEFT, ESC OD, ESC KEY_LEFT /# Left #/ - KEY_RIGHT KEY_RIGHT, ESC OC, ESC KEY_RIGHT /# Right #/ - KEY_UP, KEY_UP, ESC OA, ESC KEY_UP /# Up #/ - KEY_DOWN, KEY_DOWN, ESC OB, ESC KEY_DOWN /# Down #/ - ESC [1~, ESC [1~, local win, ESC ESC [1~ /# Home #/ - KEY_PPAGE local win, local win, ESC KEY_PPAGE /# Page Up #/ - KEY_NPAGE local win, local win, ESC KEY_NPAGE /# Page Down #/ - ESC [4~, ESC [4~, local win, ESC ESC [4~ /# End #/ - ESC Ot, ESC Ot, ESC Ot, O /# Keypad Left #/ - ESC Ov, ESC Ov, ESC Ov, O /# Keypad Right #/ - ESC Ox, ESC Ox, ESC Ox, O /# Keypad Up #/ - ESC Or, ESC Or, ESC Or, O /# Keypad Down #/ - ESC Ow, ESC Ow, ESC Ow, O /# Keypad Home #/ - ESC Oy, ESC Oy, ESC Oy, O /# Keypad PgUp #/ - ESC Os, ESC Os, ESC Os, O /# Keypad PgDn #/ - ESC Oq, ESC Oq, ESC Oq, O /# Keypad End #/ - ESC Ou, ESC Ou, ESC Ou, O /# Keypad 5 #/ -*/ - -#define M_NORMAL 0 -#define M_ESC 1 -#define M_KEYPAD 2 -#define M_TRAIL 3 - -#ifndef BUILD_ROGUE -int -md_readchar() -{ - int ch = 0; - int lastch = 0; - int mode = M_NORMAL; - int mode2 = M_NORMAL; - - for(;;) - { - ch = getch(); - - if (ch == ERR) /* timed out waiting for valid sequence */ - { /* flush input so far and start over */ - mode = M_NORMAL; - nocbreak(); - raw(); - ch = 27; - break; - } - - if (mode == M_TRAIL) - { - if (ch == '^') /* msys console : 7,5,6,8: modified*/ - ch = CTRL( toupper(lastch) ); - - if (ch == '~') /* cygwin console: 1,5,6,4: normal */ - ch = tolower(lastch); /* windows telnet: 1,5,6,4: normal */ - /* msys console : 7,5,6,8: normal */ - - if (mode2 == M_ESC) /* cygwin console: 1,5,6,4: modified*/ - ch = CTRL( toupper(ch) ); - - break; - } - - if (mode == M_ESC) - { - if (ch == 27) - { - mode2 = M_ESC; - continue; - } - - if ((ch == 'F') || (ch == 'O') || (ch == '[')) - { - mode = M_KEYPAD; - continue; - } - - - switch(ch) - { - /* Cygwin Console */ - /* PuTTY */ - case KEY_LEFT : ch = CTRL('H'); break; - case KEY_RIGHT: ch = CTRL('L'); break; - case KEY_UP : ch = CTRL('K'); break; - case KEY_DOWN : ch = CTRL('J'); break; - case KEY_HOME : ch = CTRL('Y'); break; - case KEY_PPAGE: ch = CTRL('U'); break; - case KEY_NPAGE: ch = CTRL('N'); break; - case KEY_END : ch = CTRL('B'); break; - - default: break; - } - - break; - } - - if (mode == M_KEYPAD) - { - switch(ch) - { - /* ESC F - Interix Console codes */ - case '^': ch = CTRL('H'); break; /* Shift-Left */ - case '$': ch = CTRL('L'); break; /* Shift-Right */ - - /* ESC [ - Interix Console codes */ - case 'H': ch = 'y'; break; /* Home */ - case 1: ch = CTRL('K'); break; /* Ctl-Keypad Up */ - case 2: ch = CTRL('J'); break; /* Ctl-Keypad Down */ - case 3: ch = CTRL('L'); break; /* Ctl-Keypad Right */ - case 4: ch = CTRL('H'); break; /* Ctl-Keypad Left */ - case 263: ch = CTRL('Y'); break; /* Ctl-Keypad Home */ - case 19: ch = CTRL('U'); break; /* Ctl-Keypad PgUp */ - case 20: ch = CTRL('N'); break; /* Ctl-Keypad PgDn */ - case 21: ch = CTRL('B'); break; /* Ctl-Keypad End */ - - /* ESC [ - Cygwin Console codes */ - case 'G': ch = '.'; break; /* Keypad 5 */ - case '7': lastch = 'Y'; mode=M_TRAIL; break; /* Ctl-Home */ - case '5': lastch = 'U'; mode=M_TRAIL; break; /* Ctl-PgUp */ - case '6': lastch = 'N'; mode=M_TRAIL; break; /* Ctl-PgDn */ - - /* ESC [ - Win32 Telnet, PuTTY */ - case '1': lastch = 'y'; mode=M_TRAIL; break; /* Home */ - case '4': lastch = 'b'; mode=M_TRAIL; break; /* End */ - - /* ESC O - PuTTY */ - case 'D': ch = CTRL('H'); break; - case 'C': ch = CTRL('L'); break; - case 'A': ch = CTRL('K'); break; - case 'B': ch = CTRL('J'); break; - case 't': ch = 'h'; break; - case 'v': ch = 'l'; break; - case 'x': ch = 'k'; break; - case 'r': ch = 'j'; break; - case 'w': ch = 'y'; break; - case 'y': ch = 'u'; break; - case 's': ch = 'n'; break; - case 'q': ch = 'b'; break; - case 'u': ch = '.'; break; - } - - if (mode != M_KEYPAD) - continue; - } - - if (ch == 27) - { - halfdelay(1); - mode = M_ESC; - continue; - } - - switch(ch) - { - case KEY_LEFT : ch = 'h'; break; - case KEY_DOWN : ch = 'j'; break; - case KEY_UP : ch = 'k'; break; - case KEY_RIGHT : ch = 'l'; break; - case KEY_HOME : ch = 'y'; break; - case KEY_PPAGE : ch = 'u'; break; - case KEY_END : ch = 'b'; break; -#ifdef KEY_LL - case KEY_LL : ch = 'b'; break; -#endif - case KEY_NPAGE : ch = 'n'; break; - -#ifdef KEY_B1 - case KEY_B1 : ch = 'h'; break; - case KEY_C2 : ch = 'j'; break; - case KEY_A2 : ch = 'k'; break; - case KEY_B3 : ch = 'l'; break; -#endif - case KEY_A1 : ch = 'y'; break; - case KEY_A3 : ch = 'u'; break; - case KEY_C1 : ch = 'b'; break; - case KEY_C3 : ch = 'n'; break; - /* next should be '.', but for problem with putty/linux */ - case KEY_B2 : ch = 'u'; break; - -#ifdef KEY_SLEFT - case KEY_SRIGHT : ch = CTRL('L'); break; - case KEY_SLEFT : ch = CTRL('H'); break; -#ifdef KEY_SUP - case KEY_SUP : ch = CTRL('K'); break; - case KEY_SDOWN : ch = CTRL('J'); break; -#endif - case KEY_SHOME : ch = CTRL('Y'); break; - case KEY_SPREVIOUS:ch = CTRL('U'); break; - case KEY_SEND : ch = CTRL('B'); break; - case KEY_SNEXT : ch = CTRL('N'); break; -#endif - case 0x146 : ch = CTRL('K'); break; /* Shift-Up */ - case 0x145 : ch = CTRL('J'); break; /* Shift-Down */ - - -#ifdef CTL_RIGHT - case CTL_RIGHT : ch = CTRL('L'); break; - case CTL_LEFT : ch = CTRL('H'); break; - case CTL_UP : ch = CTRL('K'); break; - case CTL_DOWN : ch = CTRL('J'); break; - case CTL_HOME : ch = CTRL('Y'); break; - case CTL_PGUP : ch = CTRL('U'); break; - case CTL_END : ch = CTRL('B'); break; - case CTL_PGDN : ch = CTRL('N'); break; -#endif -#ifdef KEY_EOL - case KEY_EOL : ch = CTRL('B'); break; -#endif - -#ifndef CTL_PAD1 - /* MSYS rxvt console */ - case 511 : ch = CTRL('J'); break; /* Shift Dn */ - case 512 : ch = CTRL('J'); break; /* Ctl Down */ - case 514 : ch = CTRL('H'); break; /* Ctl Left */ - case 516 : ch = CTRL('L'); break; /* Ctl Right*/ - case 518 : ch = CTRL('K'); break; /* Shift Up */ - case 519 : ch = CTRL('K'); break; /* Ctl Up */ -#endif - -#ifdef CTL_PAD1 - case CTL_PAD1 : ch = CTRL('B'); break; - case CTL_PAD2 : ch = CTRL('J'); break; - case CTL_PAD3 : ch = CTRL('N'); break; - case CTL_PAD4 : ch = CTRL('H'); break; - case CTL_PAD5 : ch = '.'; break; - case CTL_PAD6 : ch = CTRL('L'); break; - case CTL_PAD7 : ch = CTRL('Y'); break; - case CTL_PAD8 : ch = CTRL('K'); break; - case CTL_PAD9 : ch = CTRL('U'); break; -#endif - -#ifdef ALT_RIGHT - case ALT_RIGHT : ch = CTRL('L'); break; - case ALT_LEFT : ch = CTRL('H'); break; - case ALT_DOWN : ch = CTRL('J'); break; - case ALT_HOME : ch = CTRL('Y'); break; - case ALT_PGUP : ch = CTRL('U'); break; - case ALT_END : ch = CTRL('B'); break; - case ALT_PGDN : ch = CTRL('N'); break; -#endif - -#ifdef ALT_PAD1 - case ALT_PAD1 : ch = CTRL('B'); break; - case ALT_PAD2 : ch = CTRL('J'); break; - case ALT_PAD3 : ch = CTRL('N'); break; - case ALT_PAD4 : ch = CTRL('H'); break; - case ALT_PAD5 : ch = '.'; break; - case ALT_PAD6 : ch = CTRL('L'); break; - case ALT_PAD7 : ch = CTRL('Y'); break; - case ALT_PAD8 : ch = CTRL('K'); break; - case ALT_PAD9 : ch = CTRL('U'); break; -#endif -#ifdef KEY_BACKSPACE /* NCURSES in Keypad mode sends this for Ctrl-H */ - case KEY_BACKSPACE: ch = CTRL('H'); break; -#endif - } - - break; - } - - nocbreak(); /* disable halfdelay mode if on */ - raw(); - - return(ch & 0x7F); -} -#endif - -#if defined(LOADAV) && defined(HAVE_NLIST_H) && defined(HAVE_NLIST) -/* - * loadav: - * Looking up load average in core (for system where the loadav() - * system call isn't defined - */ - -#include - -struct nlist avenrun = { - "_avenrun" -}; - -void -md_loadav(double *avg) -{ - int kmem; - - if ((kmem = open("/dev/kmem", 0)) < 0) - goto bad; - nlist(NAMELIST, &avenrun); - if (avenrun.n_type == 0) - { - close(kmem); -bad: - avg[0] = 0.0; - avg[1] = 0.0; - avg[2] = 0.0; - return; - } - - lseek(kmem, avenrun.n_value, 0); - read(kmem, (char *) avg, 3 * sizeof (double)); - close(kmem); -} -#else -void -md_loadav(double *avg) -{ -#if defined(HAVE_LOADAV) - loadav(avg); -#elif defined(HAVE_GETLOADAVG) - getloadavg(avg,3); -#else - avg[0] = avg[1] = avg[2] = 0; -#endif -} -#endif - -#ifndef NSIG -#define NSIG 32 -#endif - -void -md_ignoreallsignals() -{ - int i; - - for (i = 0; i < NSIG; i++) - signal(i, SIG_IGN); -} - -void -md_tstphold() -{ -#ifdef SIGTSTP - /* - * If a process can be suspended, this code wouldn't work - */ -# ifdef SIG_HOLD - signal(SIGTSTP, SIG_HOLD); -# else - signal(SIGTSTP, SIG_IGN); -# endif -#endif -} - -void -md_tstpresume() -{ -#ifdef SIGTSTP - signal(SIGTSTP, tstp); -#endif -} - -void -md_tstpsignal() -{ -#ifdef SIGTSTP - kill(0, SIGTSTP); /* send actual signal and suspend process */ -#endif -} - -#if defined(CHECKTIME) -void -md_start_checkout_timer(int time) -{ - int checkout(); - -#if defined(HAVE_ALARM) && defined(SIGALRM) - signal(SIGALRM, checkout); - alarm(time); -#endif -} - -void -md_stop_checkout_timer() -{ -#if defined(SIGALRM) - signal(SIGALRM, SIG_IGN); -#endif -} - -#endif diff --git a/src/cc/rogue/misc.c b/src/cc/rogue/misc.c deleted file mode 100644 index b2aaffc9a..000000000 --- a/src/cc/rogue/misc.c +++ /dev/null @@ -1,620 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * All sorts of miscellaneous routines - * - * @(#)misc.c 4.66 (Berkeley) 08/06/83 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -//#include -//#include -//#include -//#include -#include "rogue.h" - -/* - * look: - * A quick glance all around the player - */ -#undef DEBUG - - -void -look(struct rogue_state *rs,bool wakeup) -{ - int x, y; - int ch; - THING *tp; - PLACE *pp; - struct room *rp; - int ey, ex; - int passcount; - char pfl, *fp, pch; - int sy, sx, sumhero = 0, diffhero = 0; -# ifdef DEBUG - static bool done = FALSE; - - if (done) - return; - done = TRUE; -# endif /* DEBUG */ - passcount = 0; - rp = proom; - if (!ce(oldpos, hero)) - { - erase_lamp(&oldpos, oldrp); - oldpos = hero; - oldrp = rp; - } - ey = hero.y + 1; - ex = hero.x + 1; - sx = hero.x - 1; - sy = hero.y - 1; - if (door_stop && !firstmove && running) - { - sumhero = hero.y + hero.x; - diffhero = hero.y - hero.x; - } - pp = INDEX(hero.y, hero.x); - pch = pp->p_ch; - pfl = pp->p_flags; - - for (y = sy; y <= ey; y++) - if (y > 0 && y < NUMLINES - 1) for (x = sx; x <= ex; x++) - { - if (x < 0 || x >= NUMCOLS) - continue; - if (!on(player, ISBLIND)) - { - if (y == hero.y && x == hero.x) - continue; - } - - pp = INDEX(y, x); - ch = pp->p_ch; - if (ch == ' ') /* nothing need be done with a ' ' */ - continue; - fp = &pp->p_flags; - if (pch != DOOR && ch != DOOR) - if ((pfl & F_PASS) != (*fp & F_PASS)) - continue; - if (((*fp & F_PASS) || ch == DOOR) && - ((pfl & F_PASS) || pch == DOOR)) - { - if (hero.x != x && hero.y != y && - !step_ok(chat(y, hero.x)) && !step_ok(chat(hero.y, x))) - continue; - } - - if ((tp = pp->p_monst) == NULL) - ch = trip_ch(y, x, ch); - else - if (on(player, SEEMONST) && on(*tp, ISINVIS)) - { - if (door_stop && !firstmove) - running = FALSE; - continue; - } - else - { - if (wakeup) - wake_monster(rs,y, x); - if (see_monst(tp)) - { - if (on(player, ISHALU)) - ch = rnd(26) + 'A'; - else - ch = tp->t_disguise; - } - } - if (on(player, ISBLIND) && (y != hero.y || x != hero.x)) - continue; - - move(y, x); - - if ((proom->r_flags & ISDARK) && !see_floor && ch == FLOOR) - ch = ' '; - - if (tp != NULL || ch != CCHAR( inch() )) - addch(ch); - - if (door_stop && !firstmove && running) - { - switch (runch) - { - case 'h': - if (x == ex) - continue; - when 'j': - if (y == sy) - continue; - when 'k': - if (y == ey) - continue; - when 'l': - if (x == sx) - continue; - when 'y': - if ((y + x) - sumhero >= 1) - continue; - when 'u': - if ((y - x) - diffhero >= 1) - continue; - when 'n': - if ((y + x) - sumhero <= -1) - continue; - when 'b': - if ((y - x) - diffhero <= -1) - continue; - } - switch (ch) - { - case DOOR: - if (x == hero.x || y == hero.y) - running = FALSE; - break; - case PASSAGE: - if (x == hero.x || y == hero.y) - passcount++; - break; - case FLOOR: - case '|': - case '-': - case ' ': - break; - default: - running = FALSE; - break; - } - } - } - if (door_stop && !firstmove && passcount > 1) - running = FALSE; - if (!running || !jump) - mvaddch(hero.y, hero.x, PLAYER); -# ifdef DEBUG - done = FALSE; -# endif /* DEBUG */ -} - -/* - * trip_ch: - * Return the character appropriate for this space, taking into - * account whether or not the player is tripping. - */ -int -trip_ch(int y, int x, int ch) -{ - if (on(player, ISHALU) && after) - switch (ch) - { - case FLOOR: - case ' ': - case PASSAGE: - case '-': - case '|': - case DOOR: - case TRAP: - break; - default: - if (y != stairs.y || x != stairs.x || !seenstairs) - ch = rnd_thing(); - break; - } - return ch; -} - -/* - * erase_lamp: - * Erase the area shown by a lamp in a dark room. - */ - -void -erase_lamp(coord *pos, struct room *rp) -{ - int y, x, ey, sy, ex; - - if (!(see_floor && (rp->r_flags & (ISGONE|ISDARK)) == ISDARK - && !on(player,ISBLIND))) - return; - - ey = pos->y + 1; - ex = pos->x + 1; - sy = pos->y - 1; - for (x = pos->x - 1; x <= ex; x++) - for (y = sy; y <= ey; y++) - { - if (y == hero.y && x == hero.x) - continue; - move(y, x); - if (inch() == FLOOR) - addch(' '); - } -} - -/* - * show_floor: - * Should we show the floor in her room at this time? - */ -bool -show_floor() -{ - if ((proom->r_flags & (ISGONE|ISDARK)) == ISDARK && !on(player, ISBLIND)) - return see_floor; - else - return TRUE; -} - -/* - * find_obj: - * Find the unclaimed object at y, x - */ -THING * -find_obj(struct rogue_state *rs,int y, int x) -{ - THING *obj; - - for (obj = lvl_obj; obj != NULL; obj = next(obj)) - { - if (obj->o_pos.y == y && obj->o_pos.x == x) - return obj; - } -#ifdef MASTER - sprintf(prbuf, "Non-object %d,%d", y, x); - msg(rs,prbuf); - return NULL; -#else - /* NOTREACHED */ - return NULL; -#endif -} - -/* - * eat: - * She wants to eat something, so let her try - */ - -void -eat(struct rogue_state *rs) -{ - THING *obj; - - if ((obj = get_item(rs,"eat", FOOD)) == NULL) - return; - if (obj->o_type != FOOD) - { - if (!terse) - msg(rs,"ugh, you would get ill if you ate that"); - else - msg(rs,"that's Inedible!"); - return; - } - if (food_left < 0) - food_left = 0; - if ((food_left += HUNGERTIME - 200 + rnd(400)) > STOMACHSIZE) - food_left = STOMACHSIZE; - hungry_state = 0; - if (obj == cur_weapon) - cur_weapon = NULL; - if (obj->o_which == 1) - msg(rs,"my, that was a yummy %s", fruit); - else - if (rnd(100) > 70) - { - pstats.s_exp++; - msg(rs,"%s, this food tastes awful", choose_str("bummer", "yuk")); - check_level(rs); - } - else - msg(rs,"%s, that tasted good", choose_str("oh, wow", "yum")); - leave_pack(rs,obj, FALSE, FALSE); -} - -/* - * check_level: - * Check to see if the guy has gone up a level. - */ - -void -check_level(struct rogue_state *rs) -{ - int i, add, olevel; - - for (i = 0; e_levels[i] != 0; i++) - if (e_levels[i] > pstats.s_exp) - break; - i++; - olevel = pstats.s_lvl; - pstats.s_lvl = i; - if (i > olevel) - { - add = roll(i - olevel, 10); - max_hp += add; - pstats.s_hpt += add; - msg(rs,"welcome to level %d", i); - } -} - -/* - * chg_str: - * used to modify the playes strength. It keeps track of the - * highest it has been, just in case - */ - -void -chg_str(int amt) -{ - //auto jl777: strange compiler error - uint32_t comp; - - if (amt == 0) - return; - //add_str(&pstats.s_str, amt); - pstats.s_str += amt; - if ( pstats.s_str < 3 ) - pstats.s_str = 3; - else if ( pstats.s_str > 31 ) - pstats.s_str = 31; - comp = pstats.s_str; - if (ISRING(LEFT, R_ADDSTR)) - { - // add_str(&comp, -cur_ring[LEFT]->o_arm); - comp += -cur_ring[LEFT]->o_arm; - if ( comp < 3 ) - comp = 3; - else if ( comp > 31 ) - comp = 31; - } - if (ISRING(RIGHT, R_ADDSTR)) - { - //add_str(&comp, -cur_ring[RIGHT]->o_arm); - comp += -cur_ring[RIGHT]->o_arm; - if ( comp < 3 ) - comp = 3; - else if ( comp > 31 ) - comp = 31; - } - if ( comp > max_stats.s_str ) - max_stats.s_str = comp; -} - -/* - * add_str: - * Perform the actual add, checking upper and lower bound limits - */ -void -add_str(str_t *sp, int amt) -{ - if ((*sp += amt) < 3) - *sp = 3; - else if (*sp > 31) - *sp = 31; -} - -/* - * add_haste: - * Add a haste to the player - */ -bool -add_haste(struct rogue_state *rs,bool potion) -{ - if (on(player, ISHASTE)) - { - no_command += rnd(8); - player.t_flags &= ~(ISRUN|ISHASTE); - extinguish(nohaste); - msg(rs,"you faint from exhaustion"); - return FALSE; - } - else - { - player.t_flags |= ISHASTE; - if (potion) - fuse(nohaste, 0, rnd(4)+4, AFTER); - return TRUE; - } -} - -/* - * aggravate: - * Aggravate all the monsters on this level - */ - -void -aggravate(struct rogue_state *rs) -{ - THING *mp; - - for (mp = mlist; mp != NULL; mp = next(mp)) - runto(rs,&mp->t_pos); -} - -/* - * vowelstr: - * For printfs: if string starts with a vowel, return "n" for an - * "an". - */ -char * -vowelstr(char *str) -{ - switch (*str) - { - case 'a': case 'A': - case 'e': case 'E': - case 'i': case 'I': - case 'o': case 'O': - case 'u': case 'U': - return "n"; - default: - return ""; - } -} - -/* - * is_current: - * See if the object is one of the currently used items - */ -bool -is_current(struct rogue_state *rs,THING *obj) -{ - if (obj == NULL) - return FALSE; - if (obj == cur_armor || obj == cur_weapon || obj == cur_ring[LEFT] - || obj == cur_ring[RIGHT]) - { - if (!terse) - addmsg(rs,"That's already "); - msg(rs,"in use"); - return TRUE; - } - return FALSE; -} - -/* - * get_dir: - * Set up the direction co_ordinate for use in varios "prefix" - * commands - */ -bool -get_dir(struct rogue_state *rs) -{ - char *prompt; - bool gotit; - static coord last_delt= {0,0}; - - if (again && last_dir != '\0') - { - delta.y = last_delt.y; - delta.x = last_delt.x; - dir_ch = last_dir; - } - else - { - if (!terse) - msg(rs,prompt = "which direction? "); - else - prompt = "direction: "; - do - { - gotit = TRUE; - switch (dir_ch = readchar(rs)) - { - case 'h': case'H': delta.y = 0; delta.x = -1; - when 'j': case'J': delta.y = 1; delta.x = 0; - when 'k': case'K': delta.y = -1; delta.x = 0; - when 'l': case'L': delta.y = 0; delta.x = 1; - when 'y': case'Y': delta.y = -1; delta.x = -1; - when 'u': case'U': delta.y = -1; delta.x = 1; - when 'b': case'B': delta.y = 1; delta.x = -1; - when 'n': case'N': delta.y = 1; delta.x = 1; - when ESCAPE: last_dir = '\0'; reset_last(); return FALSE; - otherwise: - mpos = 0; - msg(rs,prompt); - gotit = FALSE; - } - } until (gotit); - if (isupper(dir_ch)) - dir_ch = (char) tolower(dir_ch); - last_dir = dir_ch; - last_delt.y = delta.y; - last_delt.x = delta.x; - } - if (on(player, ISHUH) && rnd(5) == 0) - do - { - delta.y = rnd(3) - 1; - delta.x = rnd(3) - 1; - } while (delta.y == 0 && delta.x == 0); - mpos = 0; - return TRUE; -} - -/* - * sign: - * Return the sign of the number - */ -int -sign(int nm) -{ - if (nm < 0) - return -1; - else - return (nm > 0); -} - -/* - * spread: - * Give a spread around a given number (+/- 20%) - */ -int -spread(int nm) -{ - return nm - nm / 20 + rnd(nm / 10); -} - -/* - * call_it: - * Call an object something after use. - */ - -void -call_it(struct rogue_state *rs,struct obj_info *info) -{ - if (info->oi_know) - { - if (info->oi_guess) - { - free(info->oi_guess); - info->oi_guess = NULL; - } - } - else if (!info->oi_guess) - { - msg(rs,terse ? (char *)"call it: " : (char *)"what do you want to call it? "); - if (get_str(rs,prbuf, stdscr) == NORM) - { - if (info->oi_guess != NULL) - free(info->oi_guess); - info->oi_guess = (char *)malloc((unsigned int) strlen(prbuf) + 1); - strcpy(info->oi_guess, prbuf); - } - } -} - -/* - * rnd_thing: - * Pick a random thing appropriate for this level - */ -char -rnd_thing() -{ - int i; - static char thing_list[] = { - POTION, SCROLL, RING, STICK, FOOD, WEAPON, ARMOR, STAIRS, GOLD, AMULET - }; - - if (level >= AMULETLEVEL) - i = rnd(sizeof thing_list / sizeof (char)); - else - i = rnd(sizeof thing_list / sizeof (char) - 1); - return thing_list[i]; -} - -/* - str str: - * Choose the first or second string depending on whether it the - * player is tripping - */ -char * -choose_str(char *ts, char *ns) -{ - return (on(player, ISHALU) ? ts : ns); -} diff --git a/src/cc/rogue/monsters.c b/src/cc/rogue/monsters.c deleted file mode 100644 index ee309c291..000000000 --- a/src/cc/rogue/monsters.c +++ /dev/null @@ -1,258 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * File with various monster functions in it, none as evil as KYC - * - * @(#)monsters.c 4.46 (Berkeley) 02/05/99 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -//#include -//#include -#include "rogue.h" -//#include - -/* - * List of monsters in rough order of vorpalness - */ -static char lvl_mons[] = { - 'K', 'E', 'B', 'S', 'H', 'I', 'R', 'O', 'Z', 'L', 'C', 'Q', 'A', - 'N', 'Y', 'F', 'T', 'W', 'P', 'X', 'U', 'M', 'V', 'G', 'J', 'D' -}; - -static char wand_mons[] = { - 'K', 'E', 'B', 'S', 'H', 0, 'R', 'O', 'Z', 0, 'C', 'Q', 'A', - 0, 'Y', 0, 'T', 'W', 'P', 0, 'U', 'M', 'V', 'G', 'J', 0 -}; - -/* - * randmonster: - * Pick a monster to show up. The lower the level, - * the meaner the monster. - */ -char -randmonster(bool wander) -{ - int d; - char *mons; - - mons = (wander ? wand_mons : lvl_mons); - do - { - d = level + (rnd(10) - 6); - if (d < 0) - d = rnd(5); - if (d > 25) - d = rnd(5) + 21; - } while (mons[d] == 0); - return mons[d]; -} - -/* - * new_monster: - * Pick a new monster and add it to the list - */ - -void -new_monster(struct rogue_state *rs,THING *tp, char type, coord *cp) -{ - struct monster *mp; - int lev_add; - - if ((lev_add = level - AMULETLEVEL) < 0) - lev_add = 0; - attach(mlist, tp); - tp->t_type = type; - tp->t_disguise = type; - tp->t_pos = *cp; - move(cp->y, cp->x); - tp->t_oldch = CCHAR( inch() ); - tp->t_room = roomin(rs,cp); - moat(cp->y, cp->x) = tp; - mp = &monsters[tp->t_type-'A']; - tp->t_stats.s_lvl = mp->m_stats.s_lvl + lev_add; - tp->t_stats.s_maxhp = tp->t_stats.s_hpt = roll(tp->t_stats.s_lvl, 8); - tp->t_stats.s_arm = mp->m_stats.s_arm - lev_add; - strcpy(tp->t_stats.s_dmg,mp->m_stats.s_dmg); - tp->t_stats.s_str = mp->m_stats.s_str; - tp->t_stats.s_exp = mp->m_stats.s_exp + lev_add * 10 + exp_add(tp); - tp->t_flags = mp->m_flags; - if (level > 29) - tp->t_flags |= ISHASTE; - tp->t_turn = TRUE; - tp->t_pack = NULL; - if (ISWEARING(R_AGGR)) - runto(rs,cp); - if (type == 'X') - tp->t_disguise = rnd_thing(); -} - -/* - * expadd: - * Experience to add for this monster's level/hit points - */ -int -exp_add(THING *tp) -{ - int mod; - - if (tp->t_stats.s_lvl == 1) - mod = tp->t_stats.s_maxhp / 8; - else - mod = tp->t_stats.s_maxhp / 6; - if (tp->t_stats.s_lvl > 9) - mod *= 20; - else if (tp->t_stats.s_lvl > 6) - mod *= 4; - return mod; -} - -/* - * wanderer: - * Create a new wandering monster and aim it at the player - */ - -void -wanderer(struct rogue_state *rs) -{ - THING *tp; - static coord cp; - - tp = new_item(); - do - { - find_floor(rs,(struct room *) NULL, &cp, FALSE, TRUE); - } while (roomin(rs,&cp) == proom); - new_monster(rs,tp, randmonster(TRUE), &cp); - if (on(player, SEEMONST)) - { - standout(); - if (!on(player, ISHALU)) - addch(tp->t_type); - else - addch(rnd(26) + 'A'); - standend(); - } - runto(rs,&tp->t_pos); -#ifdef MASTER - if (wizard) - msg(rs,"started a wandering %s", monsters[tp->t_type-'A'].m_name); -#endif -} - -/* - * wake_monster: - * What to do when the hero steps next to a monster - */ -THING * -wake_monster(struct rogue_state *rs,int y, int x) -{ - THING *tp; - struct room *rp; - char ch, *mname; - -#ifdef MASTER - if ((tp = moat(y, x)) == NULL) - msg(rs,"can't find monster in wake_monster"); -#else - tp = moat(y, x); - if (tp == NULL) - endwin(), abort(); -#endif - ch = tp->t_type; - /* - * Every time he sees mean monster, it might start chasing him - */ - if (!on(*tp, ISRUN) && rnd(3) != 0 && on(*tp, ISMEAN) && !on(*tp, ISHELD) - && !ISWEARING(R_STEALTH) && !on(player, ISLEVIT)) - { - tp->t_dest = &hero; - tp->t_flags |= ISRUN; - } - if (ch == 'M' && !on(player, ISBLIND) && !on(player, ISHALU) - && !on(*tp, ISFOUND) && !on(*tp, ISCANC) && on(*tp, ISRUN)) - { - rp = proom; - if ((rp != NULL && !(rp->r_flags & ISDARK)) - || dist(y, x, hero.y, hero.x) < LAMPDIST) - { - tp->t_flags |= ISFOUND; - if (!save(VS_MAGIC)) - { - if (on(player, ISHUH)) - lengthen(unconfuse, spread(HUHDURATION)); - else - fuse(unconfuse, 0, spread(HUHDURATION), AFTER); - player.t_flags |= ISHUH; - mname = set_mname(tp); - addmsg(rs,"%s", mname); - if (strcmp(mname, "it") != 0) - addmsg(rs,"'"); - msg(rs,"s gaze has confused you"); - } - } - } - /* - * Let greedy ones guard gold - */ - if (on(*tp, ISGREED) && !on(*tp, ISRUN)) - { - tp->t_flags |= ISRUN; - if (proom->r_goldval) - tp->t_dest = &proom->r_gold; - else - tp->t_dest = &hero; - } - return tp; -} - -/* - * give_pack: - * Give a pack to a monster if it deserves one - */ - -void -give_pack(struct rogue_state *rs,THING *tp) -{ - if (level >= max_level && rnd(100) < monsters[tp->t_type-'A'].m_carry) - { - //fprintf(stderr,"give_pack\n"); - attach(tp->t_pack, new_thing(rs)); - } -} - -/* - * save_throw: - * See if a creature save against something - */ -int -save_throw(int which, THING *tp) -{ - int need; - - need = 14 + which - tp->t_stats.s_lvl / 2; - return (roll(1, 20) >= need); -} - -/* - * save: - * See if he saves against various nasty things - */ -int -save(int which) -{ - if (which == VS_MAGIC) - { - if (ISRING(LEFT, R_PROTECT)) - which -= cur_ring[LEFT]->o_arm; - if (ISRING(RIGHT, R_PROTECT)) - which -= cur_ring[RIGHT]->o_arm; - } - return save_throw(which, &player); -} diff --git a/src/cc/rogue/move.c b/src/cc/rogue/move.c deleted file mode 100644 index 4e20e54b4..000000000 --- a/src/cc/rogue/move.c +++ /dev/null @@ -1,429 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * hero movement commands - * - * @(#)move.c 4.49 (Berkeley) 02/05/99 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -//#include -//#include -#include "rogue.h" - -/* - * used to hold the new hero position - */ - -coord nh; - -/* - * do_run: - * Start the hero running - */ - -void -do_run(char ch) -{ - running = TRUE; - after = FALSE; - runch = ch; -} - -/* - * do_move: - * Check to see that a move is legal. If it is handle the - * consequences (fighting, picking up, etc.) - */ - -void -do_move(struct rogue_state *rs,int dy, int dx) -{ - char ch, fl; - - firstmove = FALSE; - if (no_move) - { - no_move--; - msg(rs,"you are still stuck in the bear trap"); - return; - } - /* - * Do a confused move (maybe) - */ - if (on(player, ISHUH) && rnd(5) != 0) - { - nh = *rndmove(&player); - if (ce(nh, hero)) - { - after = FALSE; - running = FALSE; - to_death = FALSE; - return; - } - } - else - { -over: - nh.y = hero.y + dy; - nh.x = hero.x + dx; - } - - /* - * Check if he tried to move off the screen or make an illegal - * diagonal move, and stop him if he did. - */ - if (nh.x < 0 || nh.x >= NUMCOLS || nh.y <= 0 || nh.y >= NUMLINES - 1) - goto hit_bound; - if (!diag_ok(&hero, &nh)) - { - after = FALSE; - running = FALSE; - return; - } - if (running && ce(hero, nh)) - after = running = FALSE; - fl = flat(nh.y, nh.x); - ch = winat(nh.y, nh.x); - if (!(fl & F_REAL) && ch == FLOOR) - { - if (!on(player, ISLEVIT)) - { - chat(nh.y, nh.x) = ch = TRAP; - flat(nh.y, nh.x) |= F_REAL; - } - } - else if (on(player, ISHELD) && ch != 'F') - { - msg(rs,"you are being held"); - return; - } - switch (ch) - { - case ' ': - case '|': - case '-': -hit_bound: - if (passgo && running && (proom->r_flags & ISGONE) - && !on(player, ISBLIND)) - { - bool b1, b2; - - switch (runch) - { - case 'h': - case 'l': - b1 = (bool)(hero.y != 1 && turn_ok(hero.y - 1, hero.x)); - b2 = (bool)(hero.y != NUMLINES - 2 && turn_ok(hero.y + 1, hero.x)); - if (!(b1 ^ b2)) - break; - if (b1) - { - runch = 'k'; - dy = -1; - } - else - { - runch = 'j'; - dy = 1; - } - dx = 0; - turnref(); - goto over; - case 'j': - case 'k': - b1 = (bool)(hero.x != 0 && turn_ok(hero.y, hero.x - 1)); - b2 = (bool)(hero.x != NUMCOLS - 1 && turn_ok(hero.y, hero.x + 1)); - if (!(b1 ^ b2)) - break; - if (b1) - { - runch = 'h'; - dx = -1; - } - else - { - runch = 'l'; - dx = 1; - } - dy = 0; - turnref(); - goto over; - } - } - running = FALSE; - after = FALSE; - break; - case DOOR: - running = FALSE; - if (flat(hero.y, hero.x) & F_PASS) - enter_room(rs,&nh); - goto move_stuff; - case TRAP: - ch = be_trapped(rs,&nh); - if (ch == T_DOOR || ch == T_TELEP) - return; - goto move_stuff; - case PASSAGE: - /* - * when you're in a corridor, you don't know if you're in - * a maze room or not, and there ain't no way to find out - * if you're leaving a maze room, so it is necessary to - * always recalculate proom. - */ - proom = roomin(rs,&hero); - goto move_stuff; - case FLOOR: - if (!(fl & F_REAL)) - be_trapped(rs,&hero); - goto move_stuff; - case STAIRS: - seenstairs = TRUE; - /* FALLTHROUGH */ - default: - running = FALSE; - if (isupper(ch) || moat(nh.y, nh.x)) - fight(rs,&nh, cur_weapon, FALSE); - else - { - if (ch != STAIRS) - take = ch; -move_stuff: - mvaddch(hero.y, hero.x, floor_at()); - if ((fl & F_PASS) && chat(oldpos.y, oldpos.x) == DOOR) - leave_room(rs,&nh); - hero = nh; - } - } -} - -/* - * turn_ok: - * Decide whether it is legal to turn onto the given space - */ -bool -turn_ok(int y, int x) -{ - PLACE *pp; - - pp = INDEX(y, x); - return (pp->p_ch == DOOR - || (pp->p_flags & (F_REAL|F_PASS)) == (F_REAL|F_PASS)); -} - -/* - * turnref: - * Decide whether to refresh at a passage turning or not - */ - -void -turnref() -{ - PLACE *pp; - - pp = INDEX(hero.y, hero.x); - if (!(pp->p_flags & F_SEEN)) - { - if (jump) - { - leaveok(stdscr, TRUE); - if ( globalR.sleeptime != 0 ) - refresh(); - leaveok(stdscr, FALSE); - } - pp->p_flags |= F_SEEN; - } -} - -/* - * door_open: - * Called to illuminate a room. If it is dark, remove anything - * that might move. - */ - -void -door_open(struct rogue_state *rs,struct room *rp) -{ - int y, x; - - if (!(rp->r_flags & ISGONE)) - for (y = rp->r_pos.y; y < rp->r_pos.y + rp->r_max.y; y++) - for (x = rp->r_pos.x; x < rp->r_pos.x + rp->r_max.x; x++) - if (isupper(winat(y, x))) - wake_monster(rs,y, x); -} - -/* - * be_trapped: - * The guy stepped on a trap.... Make him pay. - */ -char -be_trapped(struct rogue_state *rs,coord *tc) -{ - PLACE *pp; - THING *arrow; - char tr; - - if (on(player, ISLEVIT)) - return T_RUST; /* anything that's not a door or teleport */ - running = FALSE; - count = FALSE; - pp = INDEX(tc->y, tc->x); - pp->p_ch = TRAP; - tr = pp->p_flags & F_TMASK; - pp->p_flags |= F_SEEN; - switch (tr) - { - case T_DOOR: - level++; - new_level(rs); - msg(rs,"you fell into a trap!"); - when T_BEAR: - no_move += BEARTIME; - msg(rs,"you are caught in a bear trap"); - when T_MYST: - switch(rnd(11)) - { - case 0: msg(rs,"you are suddenly in a parallel dimension"); - when 1: msg(rs,"the light in here suddenly seems %s", rainbow[rnd(cNCOLORS)]); - when 2: msg(rs,"you feel a sting in the side of your neck"); - when 3: msg(rs,"multi-colored lines swirl around you, then fade"); - when 4: msg(rs,"a %s light flashes in your eyes", rainbow[rnd(cNCOLORS)]); - when 5: msg(rs,"a spike shoots past your ear!"); - when 6: msg(rs,"%s sparks dance across your armor", rainbow[rnd(cNCOLORS)]); - when 7: msg(rs,"you suddenly feel very thirsty"); - when 8: msg(rs,"you feel time speed up suddenly"); - when 9: msg(rs,"time now seems to be going slower"); - when 10: msg(rs,"you pack turns %s!", rainbow[rnd(cNCOLORS)]); - } - when T_SLEEP: - no_command += SLEEPTIME; - player.t_flags &= ~ISRUN; - msg(rs,"a strange white mist envelops you and you fall asleep"); - when T_ARROW: - if (swing(pstats.s_lvl - 1, pstats.s_arm, 1)) - { - pstats.s_hpt -= roll(1, 6); - if (pstats.s_hpt <= 0) - { - msg(rs,"an arrow killed you"); - death(rs,'a'); - } - else - msg(rs,"oh no! An arrow shot you"); - } - else - { - arrow = new_item(); - init_weapon(arrow, ARROW); - arrow->o_count = 1; - arrow->o_pos = hero; - fall(rs,arrow, FALSE); - msg(rs,"an arrow shoots past you"); - } - when T_TELEP: - /* - * since the hero's leaving, look() won't put a TRAP - * down for us, so we have to do it ourself - */ - teleport(rs); - mvaddch(tc->y, tc->x, TRAP); - when T_DART: - if (!swing(pstats.s_lvl+1, pstats.s_arm, 1)) - msg(rs,"a small dart whizzes by your ear and vanishes"); - else - { - pstats.s_hpt -= roll(1, 4); - if (pstats.s_hpt <= 0) - { - msg(rs,"a poisoned dart killed you"); - death(rs,'d'); - } - if (!ISWEARING(R_SUSTSTR) && !save(VS_POISON)) - chg_str(-1); - msg(rs,"a small dart just hit you in the shoulder"); - } - when T_RUST: - msg(rs,"a gush of water hits you on the head"); - rust_armor(rs,cur_armor); - } - flush_type(); - return tr; -} - -/* - * rndmove: - * Move in a random direction if the monster/person is confused - */ -coord * -rndmove(THING *who) -{ - THING *obj; - int x, y; - char ch; - static coord ret; /* what we will be returning */ - - y = ret.y = who->t_pos.y + rnd(3) - 1; - x = ret.x = who->t_pos.x + rnd(3) - 1; - /* - * Now check to see if that's a legal move. If not, don't move. - * (I.e., bump into the wall or whatever) - */ - if (y == who->t_pos.y && x == who->t_pos.x) - return &ret; - if (!diag_ok(&who->t_pos, &ret)) - goto bad; - else - { - ch = winat(y, x); - if (!step_ok(ch)) - goto bad; - if (ch == SCROLL) - { - for (obj = lvl_obj; obj != NULL; obj = next(obj)) - if (y == obj->o_pos.y && x == obj->o_pos.x) - break; - if (obj != NULL && obj->o_which == S_SCARE) - goto bad; - } - } - return &ret; - -bad: - ret = who->t_pos; - return &ret; -} - -/* - * rust_armor: - * Rust the given armor, if it is a legal kind to rust, and we - * aren't wearing a magic ring. - */ - -void -rust_armor(struct rogue_state *rs,THING *arm) -{ - if (arm == NULL || arm->o_type != ARMOR || arm->o_which == LEATHER || - arm->o_arm >= 9) - return; - - if ((arm->o_flags & ISPROT) || ISWEARING(R_SUSTARM)) - { - if (!to_death) - msg(rs,"the rust vanishes instantly"); - } - else - { - arm->o_arm++; - if (!terse) - msg(rs,"your armor appears to be weaker now. Oh my!"); - else - msg(rs,"your armor weakens"); - } -} diff --git a/src/cc/rogue/new_level.c b/src/cc/rogue/new_level.c deleted file mode 100644 index 3acc57622..000000000 --- a/src/cc/rogue/new_level.c +++ /dev/null @@ -1,247 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * new_level: - * Dig and draw a new level - * - * @(#)new_level.c 4.38 (Berkeley) 02/05/99 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -//#include -//#include -#include "rogue.h" - -#define TREAS_ROOM 20 /* one chance in TREAS_ROOM for a treasure room */ -#define MAXTREAS 10 /* maximum number of treasures in a treasure room */ -#define MINTREAS 2 /* minimum number of treasures in a treasure room */ - -void -new_level(struct rogue_state *rs) -{ - THING *tp; - PLACE *pp; - char *sp; - int i; - if ( 0 ) - { - static FILE *fp; - if ( fp == 0 ) - fp = fopen("debug","wb"); - if ( fp != 0 ) - { - fprintf(fp,"newlevel seed.%llu\n",(long long)seed); - fflush(fp); - } - } - player.t_flags &= ~ISHELD; /* unhold when you go down just in case */ - if (level > max_level) - max_level = level; - /* - * Clean things off from last level - */ - for (pp = places; pp < &places[MAXCOLS*MAXLINES]; pp++) - { - pp->p_ch = ' '; - pp->p_flags = F_REAL; - pp->p_monst = NULL; - } - clear(); - /* - * Free up the monsters on the last level - */ - for (tp = mlist; tp != NULL; tp = next(tp)) - free_list(tp->t_pack); - free_list(mlist); - /* - * Throw away stuff left on the previous level (if anything) - */ - free_list(lvl_obj); - do_rooms(rs); /* Draw rooms */ - do_passages(rs); /* Draw passages */ - no_food++; - //fprintf(stderr,"new_level.%d\n",level); - put_things(rs); /* Place objects (if any) */ - /* - * Place the traps - */ - if (rnd(10) < level) - { - ntraps = rnd(level / 4) + 1; - if (ntraps > MAXTRAPS) - ntraps = MAXTRAPS; - i = ntraps; - while (i--) - { - /* - * not only wouldn't it be NICE to have traps in mazes - * (not that we care about being nice), since the trap - * number is stored where the passage number is, we - * can't actually do it. - */ - do - { - find_floor(rs,(struct room *) NULL, &stairs, FALSE, FALSE); - } while (chat(stairs.y, stairs.x) != FLOOR); - sp = &flat(stairs.y, stairs.x); - *sp &= ~F_REAL; - *sp |= rnd(NTRAPS); - } - } - /* - * Place the staircase down. - */ - find_floor(rs,(struct room *) NULL, &stairs, FALSE, FALSE); - chat(stairs.y, stairs.x) = STAIRS; - seenstairs = FALSE; - - for (tp = mlist; tp != NULL; tp = next(tp)) - tp->t_room = roomin(rs,&tp->t_pos); - - find_floor(rs,(struct room *) NULL, &hero, FALSE, TRUE); - enter_room(rs,&hero); - mvaddch(hero.y, hero.x, PLAYER); - if (on(player, SEEMONST)) - turn_see(rs,FALSE); - if (on(player, ISHALU)) - visuals(rs,0); -} - -/* - * rnd_room: - * Pick a room that is really there - */ -int -rnd_room() -{ - int rm; - - do - { - rm = rnd(MAXROOMS); - } while (rooms[rm].r_flags & ISGONE); - return rm; -} - -/* - * put_things: - * Put potions and scrolls on this level - */ - -void -put_things(struct rogue_state *rs) -{ - int i; - THING *obj; - - /* - * Once you have found the amulet, the only way to get new stuff is - * go down into the dungeon. - */ - if (amulet && level < max_level) - return; - /* - * check for treasure rooms, and if so, put it in. - */ - if (rnd(TREAS_ROOM) == 0) - treas_room(rs); - /* - * Do MAXOBJ attempts to put things on a level - */ - for (i = 0; i < MAXOBJ; i++) - if (rnd(100) < 36) - { - /* - * Pick a new object and link it in the list - */ - obj = new_thing(rs); - //fprintf(stderr,"put_things i.%d obj.%p\n",i,obj); - attach(lvl_obj, obj); - /* - * Put it somewhere - */ - find_floor(rs,(struct room *) NULL, &obj->o_pos, FALSE, FALSE); - chat(obj->o_pos.y, obj->o_pos.x) = (char) obj->o_type; - } - /* - * If he is really deep in the dungeon and he hasn't found the - * amulet yet, put it somewhere on the ground - */ - if (level >= AMULETLEVEL && !amulet) - { - obj = new_item(); - attach(lvl_obj, obj); - obj->o_hplus = 0; - obj->o_dplus = 0; - strncpy(obj->o_damage,"0x0",sizeof(obj->o_damage)); - strncpy(obj->o_hurldmg,"0x0",sizeof(obj->o_hurldmg)); - obj->o_arm = 11; - obj->o_type = AMULET; - /* - * Put it somewhere - */ - find_floor(rs,(struct room *) NULL, &obj->o_pos, FALSE, FALSE); - chat(obj->o_pos.y, obj->o_pos.x) = AMULET; - } -} - -/* - * treas_room: - * Add a treasure room - */ -#define MAXTRIES 10 /* max number of tries to put down a monster */ - - -void -treas_room(struct rogue_state *rs) -{ - int nm; - THING *tp; - struct room *rp; - int spots, num_monst; - static coord mp; - - rp = &rooms[rnd_room()]; - spots = (rp->r_max.y - 2) * (rp->r_max.x - 2) - MINTREAS; - if (spots > (MAXTREAS - MINTREAS)) - spots = (MAXTREAS - MINTREAS); - num_monst = nm = rnd(spots) + MINTREAS; - while (nm--) - { - find_floor(rs,rp, &mp, 2 * MAXTRIES, FALSE); - //fprintf(stderr,"treas_room\n"); - tp = new_thing(rs); - tp->o_pos = mp; - attach(lvl_obj, tp); - chat(mp.y, mp.x) = (char) tp->o_type; - } - - /* - * fill up room with monsters from the next level down - */ - - if ((nm = rnd(spots) + MINTREAS) < num_monst + 2) - nm = num_monst + 2; - spots = (rp->r_max.y - 2) * (rp->r_max.x - 2); - if (nm > spots) - nm = spots; - level++; - while (nm--) - { - spots = 0; - if (find_floor(rs,rp, &mp, MAXTRIES, TRUE)) - { - tp = new_item(); - new_monster(rs,tp, randmonster(FALSE), &mp); - tp->t_flags |= ISMEAN; /* no sloughers in THIS room */ - give_pack(rs,tp); - } - } - level--; -} diff --git a/src/cc/rogue/options.c b/src/cc/rogue/options.c deleted file mode 100644 index a90edc149..000000000 --- a/src/cc/rogue/options.c +++ /dev/null @@ -1,504 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * This file has all the code for the option command. I would rather - * this command were not necessary, but it is the only way to keep the - * wolves off of my back. - * - * @(#)options.c 4.24 (Berkeley) 05/10/83 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -//#include -//#include -//#include -//#include -#include "rogue.h" - -#define EQSTR(a, b, c) (strncmp(a, b, c) == 0) - -#define NUM_OPTS (sizeof optlist / sizeof (OPTION)) - -/* - * description of an option and what to do with it - */ -struct optstruct { - char *o_name; /* option name */ - char *o_prompt; /* prompt for interactive entry */ - void *o_opt; /* pointer to thing to set */ - /* function to print value */ - void (*o_putfunc)(void *opt); - /* function to get value interactively */ - int (*o_getfunc)(struct rogue_state *rs,void *opt, WINDOW *win); -}; - -typedef struct optstruct OPTION; - -void pr_optname(OPTION *op); - -OPTION optlist[] = { - {"terse", "Terse output", - &terse, put_bool, get_bool }, - {"flush", "Flush typeahead during battle", - &fight_flush, put_bool, get_bool }, - {"jump", "Show position only at end of run", - &jump, put_bool, get_bool }, - {"seefloor", "Show the lamp-illuminated floor", - &see_floor, put_bool, get_sf }, - {"passgo", "Follow turnings in passageways", - &passgo, put_bool, get_bool }, - {"tombstone", "Print out tombstone when killed", - &tombstone, put_bool, get_bool }, - {"inven", "Inventory style", - &inv_type, put_inv_t, get_inv_t }, - {"name", "Name", - whoami, put_str, get_str }, - {"fruit", "Fruit", - fruit, put_str, get_str }, - {"file", "Save file", - file_name, put_str, get_str } -}; - -/* - * option: - * Print and then set options from the terminal - */ - -void -option(struct rogue_state *rs) -{ - OPTION *op; - int retval; - - wclear(hw); - /* - * Display current values of options - */ - for (op = optlist; op <= &optlist[NUM_OPTS-1]; op++) - { - pr_optname(op); - (*op->o_putfunc)(op->o_opt); - waddch(hw, '\n'); - } - /* - * Set values - */ - wmove(hw, 0, 0); - for (op = optlist; op <= &optlist[NUM_OPTS-1]; op++) - { - pr_optname(op); - retval = (*op->o_getfunc)(rs,op->o_opt, hw); - if (retval) - { - if (retval == QUIT) - break; - else if (op > optlist) { /* MINUS */ - wmove(hw, (int)(op - optlist) - 1, 0); - op -= 2; - } - else /* trying to back up beyond the top */ - { - putchar('\007'); - wmove(hw, 0, 0); - op--; - } - } - } - /* - * Switch back to original screen - */ - wmove(hw, LINES - 1, 0); - waddstr(hw, "--Press space to continue--"); - wrefresh(hw); - wait_for(rs,' '); - clearok(curscr, TRUE); - touchwin(stdscr); - after = FALSE; -} - -/* - * pr_optname: - * Print out the option name prompt - */ - -void -pr_optname(OPTION *op) -{ - wprintw(hw, "%s (\"%s\"): ", op->o_prompt, op->o_name); -} - -/* - * put_bool - * Put out a boolean - */ - -void -put_bool(void *b) -{ - waddstr(hw, *(bool *) b ? "True" : "False"); -} - -/* - * put_str: - * Put out a string - */ - -void -put_str(void *str) -{ - waddstr(hw, (char *) str); -} - -/* - * put_inv_t: - * Put out an inventory type - */ - -void -put_inv_t(void *ip) -{ - waddstr(hw, inv_t_name[*(int *) ip]); -} - -/* - * get_bool: - * Allow changing a boolean option and print it out - */ -int -get_bool(struct rogue_state *rs,void *vp, WINDOW *win) -{ - bool *bp = (bool *) vp; - int oy, ox; - bool op_bad; - - op_bad = TRUE; - getyx(win, oy, ox); - waddstr(win, *bp ? "True" : "False"); - while (op_bad) - { - wmove(win, oy, ox); - wrefresh(win); - switch (readchar(rs)) - { - case 't': - case 'T': - *bp = TRUE; - op_bad = FALSE; - break; - case 'f': - case 'F': - *bp = FALSE; - op_bad = FALSE; - break; - case '\n': - case '\r': - op_bad = FALSE; - break; - case ESCAPE: - return QUIT; - case '-': - return MINUS; - default: - wmove(win, oy, ox + 10); - waddstr(win, "(T or F)"); - } - } - wmove(win, oy, ox); - waddstr(win, *bp ? "True" : "False"); - waddch(win, '\n'); - return NORM; -} - -/* - * get_sf: - * Change value and handle transition problems from see_floor to - * !see_floor. - */ -int -get_sf(struct rogue_state *rs,void *vp, WINDOW *win) -{ - bool *bp = (bool *) vp; - bool was_sf; - int retval; - - was_sf = see_floor; - retval = get_bool(rs,bp, win); - if (retval == QUIT) return(QUIT); - if (was_sf != see_floor) - { - if (!see_floor) { - see_floor = TRUE; - erase_lamp(&hero, proom); - see_floor = FALSE; - } - else - look(rs,FALSE); - } - return(NORM); -} - -/* - * get_str: - * Set a string option - */ -#define MAXINP 50 /* max string to read from terminal or environment */ - -int -get_str(struct rogue_state *rs,void *vopt, WINDOW *win) -{ - char *opt = (char *) vopt; - char *sp; - int oy, ox; - int i; - signed char c; - static char buf[MAXSTR]; - - getyx(win, oy, ox); - wrefresh(win); - /* - * loop reading in the string, and put it in a temporary buffer - */ - for (sp = buf; (c = readchar(rs)) != '\n' && c != '\r' && c != ESCAPE; - wclrtoeol(win), wrefresh(win)) - { - if (c == -1) - continue; - /*else if (c == erasechar()) // process erase character - { - if (sp > buf) - { - sp--; - for (i = (int) strlen(unctrl(*sp)); i; i--) - waddch(win, '\b'); - } - continue; - } - else if (c == killchar()) // process kill character - { - sp = buf; - wmove(win, oy, ox); - continue; - }*/ - else if (sp == buf) - { - if (c == '-' && win != stdscr) - break; - else if (c == '~') - { - strcpy(buf, home); - waddstr(win, home); - sp += strlen(home); - continue; - } - } - if (sp >= &buf[MAXINP] || !(isprint(c) || c == ' ')) - putchar(CTRL('G')); - else - { - *sp++ = c; - waddstr(win, unctrl(c)); - } - } - *sp = '\0'; - if (sp > buf) /* only change option if something has been typed */ - strucpy(opt, buf, (int) strlen(buf)); - mvwprintw(win, oy, ox, "%s\n", opt); - wrefresh(win); - if (win == stdscr) - mpos += (int)(sp - buf); - if (c == '-') - return MINUS; - else if (c == ESCAPE) - return QUIT; - else - return NORM; -} - -/* - * get_inv_t - * Get an inventory type name - */ -int -get_inv_t(struct rogue_state *rs,void *vp, WINDOW *win) -{ - int *ip = (int *) vp; - int oy, ox; - bool op_bad; - - op_bad = TRUE; - getyx(win, oy, ox); - waddstr(win, inv_t_name[*ip]); - while (op_bad) - { - wmove(win, oy, ox); - wrefresh(win); - switch (readchar(rs)) - { - case 'o': - case 'O': - *ip = INV_OVER; - op_bad = FALSE; - break; - case 's': - case 'S': - *ip = INV_SLOW; - op_bad = FALSE; - break; - case 'c': - case 'C': - *ip = INV_CLEAR; - op_bad = FALSE; - break; - case '\n': - case '\r': - op_bad = FALSE; - break; - case ESCAPE: - return QUIT; - case '-': - return MINUS; - default: - wmove(win, oy, ox + 15); - waddstr(win, "(O, S, or C)"); - } - } - mvwprintw(win, oy, ox, "%s\n", inv_t_name[*ip]); - return NORM; -} - - -#ifdef MASTER -/* - * get_num: - * Get a numeric option - */ -int -get_num(struct rogue_state *rs,void *vp, WINDOW *win) -{ - short *opt = (short *) vp; - int i; - static char buf[MAXSTR]; - - if ((i = get_str(rs,buf, win)) == NORM) - *opt = (short) atoi(buf); - return i; -} -#endif - -/* - * parse_opts: - * Parse options from string, usually taken from the environment. - * The string is a series of comma seperated values, with booleans - * being stated as "name" (true) or "noname" (false), and strings - * being "name=....", with the string being defined up to a comma - * or the end of the entire option string. - */ - -void -parse_opts(char *str) -{ - char *sp; - OPTION *op; - int len; - const char **i; - char *start; - - while (*str) - { - /* - * Get option name - */ - for (sp = str; isalpha(*sp); sp++) - continue; - len = (int)(sp - str); - /* - * Look it up and deal with it - */ - for (op = optlist; op <= &optlist[NUM_OPTS-1]; op++) - if (EQSTR(str, op->o_name, len)) - { - if (op->o_putfunc == put_bool) /* if option is a boolean */ - *(bool *)op->o_opt = TRUE; /* NOSTRICT */ - else /* string option */ - { - /* - * Skip to start of string value - */ - for (str = sp + 1; *str == '='; str++) - continue; - if (*str == '~') - { - strcpy((char *) op->o_opt, home); /* NOSTRICT */ - start = (char *) op->o_opt + strlen(home);/* NOSTRICT */ - while (*++str == '/') - continue; - } - else - start = (char *) op->o_opt; /* NOSTRICT */ - /* - * Skip to end of string value - */ - for (sp = str + 1; *sp && *sp != ','; sp++) - continue; - /* - * check for type of inventory - */ - if (op->o_putfunc == put_inv_t) - { - if (islower(*str)) - *str = (char) toupper(*str); - for (i = inv_t_name; i <= &inv_t_name[INV_CLEAR]; i++) - if (strncmp(str, *i, sp - str) == 0) - { - inv_type = (int)(i - inv_t_name); - break; - } - } - else - strucpy(start, str, (int)(sp - str)); - } - break; - } - /* - * check for "noname" for booleans - */ - else if (op->o_putfunc == put_bool - && EQSTR(str, "no", 2) && EQSTR(str + 2, op->o_name, len - 2)) - { - *(bool *)op->o_opt = FALSE; /* NOSTRICT */ - break; - } - - /* - * skip to start of next option name - */ - while (*sp && !isalpha(*sp)) - sp++; - str = sp; - } -} - -/* - * strucpy: - * Copy string using unctrl for things - */ - -void -strucpy(char *s1, char *s2, int len) -{ - if (len > MAXINP) - len = MAXINP; - while (len--) - { - if (isprint(*s2) || *s2 == ' ') - *s1++ = *s2; - s2++; - } - *s1 = '\0'; -} diff --git a/src/cc/rogue/pack.c b/src/cc/rogue/pack.c deleted file mode 100644 index 63c135f7a..000000000 --- a/src/cc/rogue/pack.c +++ /dev/null @@ -1,543 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * Routines to deal with the pack - * - * @(#)pack.c 4.40 (Berkeley) 02/05/99 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -//#include -//#include -//#include -#include "rogue.h" - -/* - * add_pack: - * Pick up an object and add it to the pack. If the argument is - * non-null use it as the linked_list pointer instead of gettting - * it off the ground. - */ - -void -add_pack(struct rogue_state *rs,THING *obj, bool silent) -{ - THING *op, *lp; - bool from_floor; - - from_floor = FALSE; - if (obj == NULL) - { - if ((obj = find_obj(rs,hero.y, hero.x)) == NULL) - return; - from_floor = TRUE; - } - - /* - * Check for and deal with scare monster scrolls - */ - if (obj->o_type == SCROLL && obj->o_which == S_SCARE) - if (obj->o_flags & ISFOUND) - { - detach(lvl_obj, obj); - mvaddch(hero.y, hero.x, floor_ch()); - chat(hero.y, hero.x) = (proom->r_flags & ISGONE) ? PASSAGE : FLOOR; - discard(obj); - msg(rs,"the scroll turns to dust as you pick it up"); - return; - } - - if (pack == NULL) - { - pack = obj; - obj->o_packch = pack_char(); - inpack++; - } - else - { - lp = NULL; - for (op = pack; op != NULL; op = next(op)) - { - if (op->o_type != obj->o_type) - lp = op; - else - { - while (op->o_type == obj->o_type && op->o_which != obj->o_which) - { - lp = op; - if (next(op) == NULL) - break; - else - op = next(op); - } - if (op->o_type == obj->o_type && op->o_which == obj->o_which) - { - if (ISMULT(op->o_type)) - { - if (!pack_room(rs,from_floor, obj)) - return; - op->o_count++; -dump_it: - discard(obj); - obj = op; - lp = NULL; - goto out; - } - else if (obj->o_group) - { - lp = op; - while (op->o_type == obj->o_type - && op->o_which == obj->o_which - && op->o_group != obj->o_group) - { - lp = op; - if (next(op) == NULL) - break; - else - op = next(op); - } - if (op->o_type == obj->o_type - && op->o_which == obj->o_which - && op->o_group == obj->o_group) - { - op->o_count += obj->o_count; - inpack--; - if (!pack_room(rs,from_floor, obj)) - return; - goto dump_it; - } - } - else - lp = op; - } -out: - break; - } - } - - if (lp != NULL) - { - if (!pack_room(rs,from_floor, obj)) - return; - else - { - obj->o_packch = pack_char(); - next(obj) = next(lp); - prev(obj) = lp; - if (next(lp) != NULL) - prev(next(lp)) = obj; - next(lp) = obj; - } - } - } - - obj->o_flags |= ISFOUND; - - /* - * If this was the object of something's desire, that monster will - * get mad and run at the hero. - */ - for (op = mlist; op != NULL; op = next(op)) - if (op->t_dest == &obj->o_pos) - op->t_dest = &hero; - - if (obj->o_type == AMULET) - amulet = TRUE; - /* - * Notify the user - */ - if (!silent) - { - if (!terse) - addmsg(rs,"you now have "); - msg(rs,"%s (%c)", inv_name(obj, !terse), obj->o_packch); - } -} - -int32_t num_packitems(struct rogue_state *rs) -{ - THING *list = pack; - int32_t type = 0,n = 0,total = 0; - for (; list != NULL; list = next(list)) - { - if ( thing_find(list) < 0 ) - { - fprintf(stderr,"num_packitems cant find %p\n",list); - return(-1); - } - if ( list->o_packch != 0 ) - { - n++; - total += rogue_total(list); - } - } - if ( rs->guiflag != 0 ) - { - char str[MAXSTR]; - sprintf(str,"strength*2 %d vs total.%d vs %d inventory letters\n",ROGUE_MAXTOTAL,total,n); - add_line(rs,"%s",str); - } - if ( total > ROGUE_MAXTOTAL ) - return(MAXPACK); - return(n); -} - -/* - * pack_room: - * See if there's room in the pack. If not, print out an - * appropriate message - */ -bool pack_room(struct rogue_state *rs,bool from_floor, THING *obj) -{ - inpack = num_packitems(rs); - if ( ++inpack > MAXPACK ) - { - if (!terse) - addmsg(rs,"there's "); - addmsg(rs,"no room"); - if (!terse) - addmsg(rs," in your pack"); - endmsg(rs); - if (from_floor) - move_msg(rs,obj); - inpack = MAXPACK; - return FALSE; - } - //fprintf(stderr,"inpack.%d vs MAX.%d\n",inpack,MAXPACK), sleep(2); - if ( from_floor != 0 ) - { - detach(lvl_obj, obj); - mvaddch(hero.y, hero.x, floor_ch()); - chat(hero.y, hero.x) = (proom->r_flags & ISGONE) ? PASSAGE : FLOOR; - } - return TRUE; -} - -/* - * leave_pack: - * take an item out of the pack - */ -THING * -leave_pack(struct rogue_state *rs,THING *obj, bool newobj, bool all) -{ - THING *nobj; - - inpack--; - nobj = obj; - if (obj->o_count > 1 && !all) - { - last_pick = obj; - obj->o_count--; - if (obj->o_group) - inpack++; - if (newobj) - { - nobj = new_item(); - *nobj = *obj; - next(nobj) = NULL; - prev(nobj) = NULL; - nobj->o_count = 1; - } - } - else - { - last_pick = NULL; - pack_used[obj->o_packch - 'a'] = FALSE; - detach(pack, obj); - } - return nobj; -} - -/* - * pack_char: - * Return the next unused pack character. - */ -char -pack_char() -{ - bool *bp; - - for (bp = pack_used; *bp; bp++) - continue; - *bp = TRUE; - return (char)((int)(bp - pack_used) + 'a'); -} - -/* - * inventory: - * List what is in the pack. Return TRUE if there is something of - * the given type. - */ - - -bool -inventory(struct rogue_state *rs,THING *list, int type) -{ - char inv_temp[MAXSTR]; - - n_objs = 0; - for (; list != NULL; list = next(list)) - { - if (type && type != list->o_type && !(type == CALLABLE && - list->o_type != FOOD && list->o_type != AMULET) && - !(type == R_OR_S && (list->o_type == RING || list->o_type == STICK))) - continue; - n_objs++; -#ifdef MASTER - if (!list->o_packch) - strcpy(inv_temp, "%s"); - else -#endif - sprintf(inv_temp, "%c) %%s", list->o_packch); - msg_esc = TRUE; - if (add_line(rs,inv_temp, inv_name(list, FALSE)) == ESCAPE) - { - msg_esc = FALSE; - msg(rs,""); - return TRUE; - } - msg_esc = FALSE; - } - //if ( n_objs != inpack ) - // fprintf(stderr,"n_objs.%d vs inpack.%d\n",n_objs,inpack), sleep(2); - if (n_objs == 0) - { - if (terse) - msg(rs,type == 0 ? (char *)"empty handed" : (char *)"nothing appropriate"); - else - msg(rs,type == 0 ? (char *)"you are empty handed" : (char *)"you don't have anything appropriate"); - return FALSE; - } - end_line(rs); - return TRUE; -} - -/* - * pick_up: - * Add something to characters pack. - */ - -void -pick_up(struct rogue_state *rs,char ch) -{ - THING *obj; - - if (on(player, ISLEVIT)) - return; - - obj = find_obj(rs,hero.y, hero.x); - if (move_on) - move_msg(rs,obj); - else - switch (ch) - { - case GOLD: - if (obj == NULL) - return; - money(rs,obj->o_goldval); - detach(lvl_obj, obj); - discard(obj); - proom->r_goldval = 0; - break; - default: -#ifdef MASTER - debug("Where did you pick a '%s' up???", unctrl(ch)); -#endif - case ARMOR: - case POTION: - case FOOD: - case WEAPON: - case SCROLL: - case AMULET: - case RING: - case STICK: - add_pack(rs,(THING *) NULL, FALSE); - break; - } -} - -/* - * move_msg: - * Print out the message if you are just moving onto an object - */ - -void -move_msg(struct rogue_state *rs,THING *obj) -{ - if (!terse) - addmsg(rs,"you "); - msg(rs,"moved onto %s", inv_name(obj, TRUE)); -} - -/* - * picky_inven: - * Allow player to inventory a single item - */ - -void -picky_inven(struct rogue_state *rs) -{ - THING *obj; - char mch; - - if (pack == NULL) - msg(rs,"you aren't carrying anything"); - else if (next(pack) == NULL) - msg(rs,"a) %s", inv_name(pack, FALSE)); - else - { - msg(rs,terse ? (char *)"item: " : (char *)"which item do you wish to inventory: "); - mpos = 0; - if ((mch = readchar(rs)) == ESCAPE) - { - msg(rs,""); - return; - } - for (obj = pack; obj != NULL; obj = next(obj)) - if (mch == obj->o_packch) - { - msg(rs,"%c) %s", mch, inv_name(obj, FALSE)); - return; - } - msg(rs,"'%s' not in pack", unctrl(mch)); - } -} - -/* - * get_item: - * Pick something out of a pack for a purpose - */ -THING * -get_item(struct rogue_state *rs,char *purpose, int type) -{ - THING *obj; - char ch; - - if (pack == NULL) - msg(rs,"you aren't carrying anything"); - else if (again) - if (last_pick) - return last_pick; - else - msg(rs,"you ran out"); - else - { - for (;;) - { - if ( rs->replaydone != 0 ) - return(NULL); - if (!terse) - addmsg(rs,"which object do you want to "); - addmsg(rs,purpose); - if (terse) - addmsg(rs," what"); - msg(rs,"? (* for list): "); - ch = readchar(rs); - mpos = 0; - /* - * Give the poor player a chance to abort the command - */ - if (ch == ESCAPE) - { - reset_last(); - after = FALSE; - msg(rs,""); - return NULL; - } - n_objs = 1; /* normal case: person types one char */ - if (ch == '*') - { - mpos = 0; - if (inventory(rs,pack, type) == 0) - { - after = FALSE; - return NULL; - } - continue; - } - for (obj = pack; obj != NULL; obj = next(obj)) - if (obj->o_packch == ch) - break; - if (obj == NULL) - { - //msg(rs,"'%s' is not a valid item",unctrl(ch)); - //continue; - reset_last(); - after = FALSE; - msg(rs,"'%s' is not a valid item",unctrl(ch)); - return NULL; - } - else - { - return obj; - } - } - } - return NULL; -} - -/* - * money: - * Add or subtract gold from the pack - */ - -void -money(struct rogue_state *rs,int value) -{ - purse += value; - mvaddch(hero.y, hero.x, floor_ch()); - chat(hero.y, hero.x) = (proom->r_flags & ISGONE) ? PASSAGE : FLOOR; - if (value > 0) - { - if (!terse) - addmsg(rs,"you found "); - msg(rs,"%d gold pieces", value); - } -} - -/* - * floor_ch: - * Return the appropriate floor character for her room - */ -char -floor_ch() -{ - if (proom->r_flags & ISGONE) - return PASSAGE; - return (show_floor() ? FLOOR : ' '); -} - -/* - * floor_at: - * Return the character at hero's position, taking see_floor - * into account - */ -char -floor_at() -{ - char ch; - - ch = chat(hero.y, hero.x); - if (ch == FLOOR) - ch = floor_ch(); - return ch; -} - -/* - * reset_last: - * Reset the last command when the current one is aborted - */ - -void -reset_last() -{ - last_comm = l_last_comm; - last_dir = l_last_dir; - last_pick = l_last_pick; -} diff --git a/src/cc/rogue/passages.c b/src/cc/rogue/passages.c deleted file mode 100644 index 4bba3f2d7..000000000 --- a/src/cc/rogue/passages.c +++ /dev/null @@ -1,427 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * Draw the connecting passages - * - * @(#)passages.c 4.22 (Berkeley) 02/05/99 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -//#include -//#include -#include "rogue.h" - -/* - * do_passages: - * Draw all the passages on a level. - */ - -void -do_passages(struct rogue_state *rs) -{ - struct rdes *r1, *r2 = NULL; - int i, j; - int roomcount; - static struct rdes - { - bool conn[MAXROOMS]; /* possible to connect to room i? */ - bool isconn[MAXROOMS]; /* connection been made to room i? */ - bool ingraph; /* this room in graph already? */ - } rdes[MAXROOMS] = { - { { 0, 1, 0, 1, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 0 }, - { { 1, 0, 1, 0, 1, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 0 }, - { { 0, 1, 0, 0, 0, 1, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 0 }, - { { 1, 0, 0, 0, 1, 0, 1, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 0 }, - { { 0, 1, 0, 1, 0, 1, 0, 1, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 0 }, - { { 0, 0, 1, 0, 1, 0, 0, 0, 1 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 0 }, - { { 0, 0, 0, 1, 0, 0, 0, 1, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 0 }, - { { 0, 0, 0, 0, 1, 0, 1, 0, 1 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 0 }, - { { 0, 0, 0, 0, 0, 1, 0, 1, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 0 }, - }; - - /* - * reinitialize room graph description - */ - for (r1 = rdes; r1 <= &rdes[MAXROOMS-1]; r1++) - { - for (j = 0; j < MAXROOMS; j++) - r1->isconn[j] = FALSE; - r1->ingraph = FALSE; - } - - /* - * starting with one room, connect it to a random adjacent room and - * then pick a new room to start with. - */ - roomcount = 1; - r1 = &rdes[rnd(MAXROOMS)]; - r1->ingraph = TRUE; - do - { - /* - * find a room to connect with - */ - j = 0; - for (i = 0; i < MAXROOMS; i++) - if (r1->conn[i] && !rdes[i].ingraph && rnd(++j) == 0) - r2 = &rdes[i]; - /* - * if no adjacent rooms are outside the graph, pick a new room - * to look from - */ - if (j == 0) - { - do - r1 = &rdes[rnd(MAXROOMS)]; - until (r1->ingraph); - } - /* - * otherwise, connect new room to the graph, and draw a tunnel - * to it - */ - else - { - r2->ingraph = TRUE; - i = (int)(r1 - rdes); - j = (int)(r2 - rdes); - conn(rs,i, j); - r1->isconn[j] = TRUE; - r2->isconn[i] = TRUE; - roomcount++; - } - } while (roomcount < MAXROOMS); - - /* - * attempt to add passages to the graph a random number of times so - * that there isn't always just one unique passage through it. - */ - for (roomcount = rnd(5); roomcount > 0; roomcount--) - { - r1 = &rdes[rnd(MAXROOMS)]; /* a random room to look from */ - /* - * find an adjacent room not already connected - */ - j = 0; - for (i = 0; i < MAXROOMS; i++) - if (r1->conn[i] && !r1->isconn[i] && rnd(++j) == 0) - r2 = &rdes[i]; - /* - * if there is one, connect it and look for the next added - * passage - */ - if (j != 0) - { - i = (int)(r1 - rdes); - j = (int)(r2 - rdes); - conn(rs,i, j); - r1->isconn[j] = TRUE; - r2->isconn[i] = TRUE; - } - } - passnum(); -} - -/* - * conn: - * Draw a corridor from a room in a certain direction. - */ - -void -conn(struct rogue_state *rs,int r1, int r2) -{ - struct room *rpf, *rpt = NULL; - int rmt; - int distance = 0, turn_spot, turn_distance = 0; - int rm; - char direc; - static coord del, curr, turn_delta, spos, epos; - - if (r1 < r2) - { - rm = r1; - if (r1 + 1 == r2) - direc = 'r'; - else - direc = 'd'; - } - else - { - rm = r2; - if (r2 + 1 == r1) - direc = 'r'; - else - direc = 'd'; - } - rpf = &rooms[rm]; - /* - * Set up the movement variables, in two cases: - * first drawing one down. - */ - if (direc == 'd') - { - rmt = rm + 3; /* room # of dest */ - rpt = &rooms[rmt]; /* room pointer of dest */ - del.x = 0; /* direction of move */ - del.y = 1; - spos.x = rpf->r_pos.x; /* start of move */ - spos.y = rpf->r_pos.y; - epos.x = rpt->r_pos.x; /* end of move */ - epos.y = rpt->r_pos.y; - if (!(rpf->r_flags & ISGONE)) /* if not gone pick door pos */ - do - { - spos.x = rpf->r_pos.x + rnd(rpf->r_max.x - 2) + 1; - spos.y = rpf->r_pos.y + rpf->r_max.y - 1; - } while ((rpf->r_flags&ISMAZE) && !(flat(spos.y, spos.x)&F_PASS)); - if (!(rpt->r_flags & ISGONE)) - do - { - epos.x = rpt->r_pos.x + rnd(rpt->r_max.x - 2) + 1; - } while ((rpt->r_flags&ISMAZE) && !(flat(epos.y, epos.x)&F_PASS)); - distance = abs(spos.y - epos.y) - 1; /* distance to move */ - turn_delta.y = 0; /* direction to turn */ - turn_delta.x = (spos.x < epos.x ? 1 : -1); - turn_distance = abs(spos.x - epos.x); /* how far to turn */ - } - else if (direc == 'r') /* setup for moving right */ - { - rmt = rm + 1; - rpt = &rooms[rmt]; - del.x = 1; - del.y = 0; - spos.x = rpf->r_pos.x; - spos.y = rpf->r_pos.y; - epos.x = rpt->r_pos.x; - epos.y = rpt->r_pos.y; - if (!(rpf->r_flags & ISGONE)) - do - { - spos.x = rpf->r_pos.x + rpf->r_max.x - 1; - spos.y = rpf->r_pos.y + rnd(rpf->r_max.y - 2) + 1; - } while ((rpf->r_flags&ISMAZE) && !(flat(spos.y, spos.x)&F_PASS)); - if (!(rpt->r_flags & ISGONE)) - do - { - epos.y = rpt->r_pos.y + rnd(rpt->r_max.y - 2) + 1; - } while ((rpt->r_flags&ISMAZE) && !(flat(epos.y, epos.x)&F_PASS)); - distance = abs(spos.x - epos.x) - 1; - turn_delta.y = (spos.y < epos.y ? 1 : -1); - turn_delta.x = 0; - turn_distance = abs(spos.y - epos.y); - } -#ifdef MASTER - else - debug("error in connection tables"); -#endif - - turn_spot = rnd(distance - 1) + 1; /* where turn starts */ - - /* - * Draw in the doors on either side of the passage or just put #'s - * if the rooms are gone. - */ - if (!(rpf->r_flags & ISGONE)) - door(rpf, &spos); - else - putpass(&spos); - if (!(rpt->r_flags & ISGONE)) - door(rpt, &epos); - else - putpass(&epos); - /* - * Get ready to move... - */ - curr.x = spos.x; - curr.y = spos.y; - while (distance > 0) - { - /* - * Move to new position - */ - curr.x += del.x; - curr.y += del.y; - /* - * Check if we are at the turn place, if so do the turn - */ - if (distance == turn_spot) - while (turn_distance--) - { - putpass(&curr); - curr.x += turn_delta.x; - curr.y += turn_delta.y; - } - /* - * Continue digging along - */ - putpass(&curr); - distance--; - } - curr.x += del.x; - curr.y += del.y; - if (!ce(curr, epos)) - msg(rs,"warning, connectivity problem on this level"); -} - -/* - * putpass: - * add a passage character or secret passage here - */ - -void -putpass(coord *cp) -{ - PLACE *pp; - - pp = INDEX(cp->y, cp->x); - pp->p_flags |= F_PASS; - if (rnd(10) + 1 < level && rnd(40) == 0) - pp->p_flags &= ~F_REAL; - else - pp->p_ch = PASSAGE; -} - -/* - * door: - * Add a door or possibly a secret door. Also enters the door in - * the exits array of the room. - */ - -void -door(struct room *rm, coord *cp) -{ - PLACE *pp; - - rm->r_exit[rm->r_nexits++] = *cp; - - if (rm->r_flags & ISMAZE) - return; - - pp = INDEX(cp->y, cp->x); - if (rnd(10) + 1 < level && rnd(5) == 0) - { - if (cp->y == rm->r_pos.y || cp->y == rm->r_pos.y + rm->r_max.y - 1) - pp->p_ch = '-'; - else - pp->p_ch = '|'; - pp->p_flags &= ~F_REAL; - } - else - pp->p_ch = DOOR; -} - -#ifdef MASTER -/* - * add_pass: - * Add the passages to the current window (wizard command) - */ - -void -add_pass() -{ - PLACE *pp; - int y, x; - char ch; - - for (y = 1; y < NUMLINES - 1; y++) - for (x = 0; x < NUMCOLS; x++) - { - pp = INDEX(y, x); - if ((pp->p_flags & F_PASS) || pp->p_ch == DOOR || - (!(pp->p_flags&F_REAL) && (pp->p_ch == '|' || pp->p_ch == '-'))) - { - ch = pp->p_ch; - if (pp->p_flags & F_PASS) - ch = PASSAGE; - pp->p_flags |= F_SEEN; - move(y, x); - if (pp->p_monst != NULL) - pp->p_monst->t_oldch = pp->p_ch; - else if (pp->p_flags & F_REAL) - addch(ch); - else - { - standout(); - addch((pp->p_flags & F_PASS) ? PASSAGE : DOOR); - standend(); - } - } - } -} -#endif - -/* - * passnum: - * Assign a number to each passageway - */ -static int pnum; -static bool newpnum; - - -void -passnum() -{ - struct room *rp; - int i; - - pnum = 0; - newpnum = FALSE; - for (rp = passages; rp < &passages[MAXPASS]; rp++) - rp->r_nexits = 0; - for (rp = rooms; rp < &rooms[MAXROOMS]; rp++) - for (i = 0; i < rp->r_nexits; i++) - { - newpnum ^= 1;//newpnum++; - numpass(rp->r_exit[i].y, rp->r_exit[i].x); - } -} - -/* - * numpass: - * Number a passageway square and its brethren - */ - -void -numpass(int y, int x) -{ - char *fp; - struct room *rp; - char ch; - - if (x >= NUMCOLS || x < 0 || y >= NUMLINES || y <= 0) - return; - fp = &flat(y, x); - if (*fp & F_PNUM) - return; - if (newpnum) - { - pnum++; - newpnum = FALSE; - } - /* - * check to see if it is a door or secret door, i.e., a new exit, - * or a numerable type of place - */ - if ((ch = chat(y, x)) == DOOR || - (!(*fp & F_REAL) && (ch == '|' || ch == '-'))) - { - rp = &passages[pnum]; - rp->r_exit[rp->r_nexits].y = y; - rp->r_exit[rp->r_nexits++].x = x; - } - else if (!(*fp & F_PASS)) - return; - *fp |= pnum; - /* - * recurse on the surrounding places - */ - numpass(y + 1, x); - numpass(y - 1, x); - numpass(y, x + 1); - numpass(y, x - 1); -} diff --git a/src/cc/rogue/potions.c b/src/cc/rogue/potions.c deleted file mode 100644 index ac78594c1..000000000 --- a/src/cc/rogue/potions.c +++ /dev/null @@ -1,335 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * Function(s) for dealing with potions, mmmmmmmmmm, potionzzzzzzz - * - * @(#)potions.c 4.46 (Berkeley) 06/07/83 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -//#include -//#include -#include "rogue.h" - -typedef struct -{ - int pa_flags; - void (*pa_daemon)(struct rogue_state *rs,int); - int pa_time; - char *pa_high, *pa_straight; -} PACT; - -static PACT p_actions[] = -{ - { ISHUH, unconfuse, HUHDURATION, /* P_CONFUSE */ - "what a tripy feeling!", - "wait, what's going on here. Huh? What? Who?" }, - { ISHALU, come_down, SEEDURATION, /* P_LSD */ - "Oh, wow! Everything seems so cosmic!", - "Oh, wow! Everything seems so cosmic!" }, - { 0, NULL, 0 }, /* P_POISON */ - { 0, NULL, 0 }, /* P_STRENGTH */ - { CANSEE, unsee, SEEDURATION, /* P_SEEINVIS */ - prbuf, - prbuf }, - { 0, NULL, 0 }, /* P_HEALING */ - { 0, NULL, 0 }, /* P_MFIND */ - { 0, NULL, 0 }, /* P_TFIND */ - { 0, NULL, 0 }, /* P_RAISE */ - { 0, NULL, 0 }, /* P_XHEAL */ - { 0, NULL, 0 }, /* P_HASTE */ - { 0, NULL, 0 }, /* P_RESTORE */ - { ISBLIND, sight, SEEDURATION, /* P_BLIND */ - "oh, bummer! Everything is dark! Help!", - "a cloak of darkness falls around you" }, - { ISLEVIT, land, HEALTIME, /* P_LEVIT */ - "oh, wow! You're floating in the air!", - "you start to float in the air" } -}; - -/* - * quaff: - * Quaff a potion from the pack - */ - -void quaff(struct rogue_state *rs) -{ - THING *obj, *tp, *mp; - bool discardit = FALSE; - bool show, trip; - - obj = get_item(rs,"quaff", POTION); - /* - * Make certain that it is somethings that we want to drink - */ - if (obj == NULL) - return; - if (obj->o_type != POTION) - { - if (!terse) - msg(rs,"yuk! Why would you want to drink that?"); - else - msg(rs,"that's undrinkable"); - return; - } - if (obj == cur_weapon) - cur_weapon = NULL; - /* - * Calculate the effect it has on the poor guy. - */ - trip = on(player, ISHALU); - discardit = (bool)(obj->o_count == 1); - leave_pack(rs,obj, FALSE, FALSE); - switch (obj->o_which) - { - case P_CONFUSE: - do_pot(rs,P_CONFUSE, !trip); - when P_POISON: - pot_info[P_POISON].oi_know = TRUE; - if (ISWEARING(R_SUSTSTR)) - msg(rs,"you feel momentarily sick"); - else - { - chg_str(-(rnd(3) + 1)); - msg(rs,"you feel very sick now"); - come_down(rs,0); - } - when P_HEALING: - pot_info[P_HEALING].oi_know = TRUE; - if ((pstats.s_hpt += roll(pstats.s_lvl, 4)) > max_hp) - pstats.s_hpt = ++max_hp; - sight(rs,0); - msg(rs,"you begin to feel better"); - when P_STRENGTH: - pot_info[P_STRENGTH].oi_know = TRUE; - chg_str(1); - msg(rs,"you feel stronger, now. What bulging muscles!"); - when P_MFIND: - player.t_flags |= SEEMONST; - fuse((void(*)(struct rogue_state *rs,int))turn_see, TRUE, HUHDURATION, AFTER); - if (!turn_see(rs,FALSE)) - msg(rs,"you have a %s feeling for a moment, then it passes", - choose_str("normal", "strange")); - when P_TFIND: - /* - * Potion of magic detection. Show the potions and scrolls - */ - show = FALSE; - if (lvl_obj != NULL) - { - wclear(hw); - for (tp = lvl_obj; tp != NULL; tp = next(tp)) - { - if (is_magic(tp)) - { - show = TRUE; - wmove(hw, tp->o_pos.y, tp->o_pos.x); - waddch(hw, MAGIC); - pot_info[P_TFIND].oi_know = TRUE; - } - } - for (mp = mlist; mp != NULL; mp = next(mp)) - { - for (tp = mp->t_pack; tp != NULL; tp = next(tp)) - { - if (is_magic(tp)) - { - show = TRUE; - wmove(hw, mp->t_pos.y, mp->t_pos.x); - waddch(hw, MAGIC); - } - } - } - } - if (show) - { - pot_info[P_TFIND].oi_know = TRUE; - show_win(rs,"You sense the presence of magic on this level.--More--"); - } - else - msg(rs,"you have a %s feeling for a moment, then it passes", - choose_str("normal", "strange")); - when P_LSD: - if (!trip) - { - if (on(player, SEEMONST)) - turn_see(rs,FALSE); - start_daemon(visuals, 0, BEFORE); - seenstairs = seen_stairs(); - } - do_pot(rs,P_LSD, TRUE); - when P_SEEINVIS: - sprintf(prbuf, "this potion tastes like %s juice", fruit); - show = on(player, CANSEE); - do_pot(rs,P_SEEINVIS, FALSE); - if (!show) - invis_on(); - sight(rs,0); - when P_RAISE: - pot_info[P_RAISE].oi_know = TRUE; - msg(rs,"you suddenly feel much more skillful"); - raise_level(rs); - when P_XHEAL: - pot_info[P_XHEAL].oi_know = TRUE; - if ((pstats.s_hpt += roll(pstats.s_lvl, 8)) > max_hp) - { - if (pstats.s_hpt > max_hp + pstats.s_lvl + 1) - ++max_hp; - pstats.s_hpt = ++max_hp; - } - sight(rs,0); - come_down(rs,0); - msg(rs,"you begin to feel much better"); - when P_HASTE: - pot_info[P_HASTE].oi_know = TRUE; - after = FALSE; - if (add_haste(rs,TRUE)) - msg(rs,"you feel yourself moving much faster"); - when P_RESTORE: - if (ISRING(LEFT, R_ADDSTR)) - add_str(&pstats.s_str, -cur_ring[LEFT]->o_arm); - if (ISRING(RIGHT, R_ADDSTR)) - add_str(&pstats.s_str, -cur_ring[RIGHT]->o_arm); - if (pstats.s_str < max_stats.s_str) - pstats.s_str = max_stats.s_str; - if (ISRING(LEFT, R_ADDSTR)) - add_str(&pstats.s_str, cur_ring[LEFT]->o_arm); - if (ISRING(RIGHT, R_ADDSTR)) - add_str(&pstats.s_str, cur_ring[RIGHT]->o_arm); - msg(rs,"hey, this tastes great. It make you feel warm all over"); - when P_BLIND: - do_pot(rs,P_BLIND, TRUE); - when P_LEVIT: - do_pot(rs,P_LEVIT, TRUE); -#ifdef MASTER - otherwise: - msg(rs,"what an odd tasting potion!"); - return; -#endif - } - status(rs); - /* - * Throw the item away - */ - - call_it(rs,&pot_info[obj->o_which]); - - if (discardit) - discard(obj); - return; -} - -/* - * is_magic: - * Returns true if an object radiates magic - */ -bool -is_magic(THING *obj) -{ - switch (obj->o_type) - { - case ARMOR: - return (bool)((obj->o_flags&ISPROT) || obj->o_arm != a_class[obj->o_which]); - case WEAPON: - return (bool)(obj->o_hplus != 0 || obj->o_dplus != 0); - case POTION: - case SCROLL: - case STICK: - case RING: - case AMULET: - return TRUE; - } - return FALSE; -} - -/* - * invis_on: - * Turn on the ability to see invisible - */ - -void -invis_on() -{ - THING *mp; - - player.t_flags |= CANSEE; - for (mp = mlist; mp != NULL; mp = next(mp)) - if (on(*mp, ISINVIS) && see_monst(mp) && !on(player, ISHALU)) - mvaddch(mp->t_pos.y, mp->t_pos.x, mp->t_disguise); -} - - -/* - * seen_stairs: - * Return TRUE if the player has seen the stairs - */ -bool -seen_stairs() -{ - THING *tp; - - move(stairs.y, stairs.x); - if (inch() == STAIRS) /* it's on the map */ - return TRUE; - if (ce(hero, stairs)) /* It's under him */ - return TRUE; - - /* - * if a monster is on the stairs, this gets hairy - */ - if ((tp = moat(stairs.y, stairs.x)) != NULL) - { - if (see_monst(tp) && on(*tp, ISRUN)) /* if it's visible and awake */ - return TRUE; /* it must have moved there */ - - if (on(player, SEEMONST) /* if she can detect monster */ - && tp->t_oldch == STAIRS) /* and there once were stairs */ - return TRUE; /* it must have moved there */ - } - return FALSE; -} - -/* - * raise_level: - * The guy just magically went up a level. - */ - -void -raise_level(struct rogue_state *rs) -{ - pstats.s_exp = e_levels[pstats.s_lvl-1] + 1L; - check_level(rs); -} - -/* - * do_pot: - * Do a potion with standard setup. This means it uses a fuse and - * turns on a flag - */ - -void -do_pot(struct rogue_state *rs,int type, bool knowit) -{ - PACT *pp; - int t; - - pp = &p_actions[type]; - if (!pot_info[type].oi_know) - pot_info[type].oi_know = knowit; - t = spread(pp->pa_time); - if (!on(player, pp->pa_flags)) - { - player.t_flags |= pp->pa_flags; - fuse(pp->pa_daemon, 0, t, AFTER); - look(rs,FALSE); - } - else - lengthen(pp->pa_daemon, t); - msg(rs,choose_str(pp->pa_high, pp->pa_straight)); -} diff --git a/src/cc/rogue/rings.c b/src/cc/rogue/rings.c deleted file mode 100644 index 7398fd776..000000000 --- a/src/cc/rogue/rings.c +++ /dev/null @@ -1,209 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * Routines dealing specifically with rings - * - * @(#)rings.c 4.19 (Berkeley) 05/29/83 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -//#include -#include "rogue.h" - -/* - * ring_on: - * Put a ring on a hand - */ - -void -ring_on(struct rogue_state *rs) -{ - THING *obj; - int ring; - - obj = get_item(rs,"put on", RING); - /* - * Make certain that it is somethings that we want to wear - */ - if (obj == NULL) - return; - if (obj->o_type != RING) - { - if (!terse) - msg(rs,"it would be difficult to wrap that around a finger"); - else - msg(rs,"not a ring"); - return; - } - - /* - * find out which hand to put it on - */ - if (is_current(rs,obj)) - return; - - if (cur_ring[LEFT] == NULL && cur_ring[RIGHT] == NULL) - { - if ((ring = gethand(rs)) < 0) - return; - } - else if (cur_ring[LEFT] == NULL) - ring = LEFT; - else if (cur_ring[RIGHT] == NULL) - ring = RIGHT; - else - { - if (!terse) - msg(rs,"you already have a ring on each hand"); - else - msg(rs,"wearing two"); - return; - } - cur_ring[ring] = obj; - - /* - * Calculate the effect it has on the poor guy. - */ - switch (obj->o_which) - { - case R_ADDSTR: - chg_str(obj->o_arm); - break; - case R_SEEINVIS: - invis_on(); - break; - case R_AGGR: - aggravate(rs); - break; - } - - if (!terse) - addmsg(rs,"you are now wearing "); - msg(rs,"%s (%c)", inv_name(obj, TRUE), obj->o_packch); -} - -/* - * ring_off: - * take off a ring - */ - -void -ring_off(struct rogue_state *rs) -{ - int ring; - THING *obj; - - if (cur_ring[LEFT] == NULL && cur_ring[RIGHT] == NULL) - { - if (terse) - msg(rs,"no rings"); - else - msg(rs,"you aren't wearing any rings"); - return; - } - else if (cur_ring[LEFT] == NULL) - ring = RIGHT; - else if (cur_ring[RIGHT] == NULL) - ring = LEFT; - else - if ((ring = gethand(rs)) < 0) - return; - mpos = 0; - obj = cur_ring[ring]; - if (obj == NULL) - { - msg(rs,"not wearing such a ring"); - return; - } - if (dropcheck(rs,obj)) - msg(rs,"was wearing %s(%c)", inv_name(obj, TRUE), obj->o_packch); -} - -/* - * gethand: - * Which hand is the hero interested in? - */ -int -gethand(struct rogue_state *rs) -{ - int c; - - for (;;) - { - if ( rs->replaydone != 0 ) - return(-1); - if (terse) - msg(rs,"left or right ring? "); - else - msg(rs,"left hand or right hand? "); - if ((c = readchar(rs)) == ESCAPE) - return -1; - mpos = 0; - if (c == 'l' || c == 'L') - return LEFT; - else if (c == 'r' || c == 'R') - return RIGHT; - if (terse) - msg(rs,"L or R"); - else - msg(rs,"please type L or R"); - } -} - -/* - * ring_eat: - * How much food does this ring use up? - */ -int -ring_eat(int hand) -{ - THING *ring; - int eat; - static int uses[] = { - 1, /* R_PROTECT */ 1, /* R_ADDSTR */ - 1, /* R_SUSTSTR */ -3, /* R_SEARCH */ - -5, /* R_SEEINVIS */ 0, /* R_NOP */ - 0, /* R_AGGR */ -3, /* R_ADDHIT */ - -3, /* R_ADDDAM */ 2, /* R_REGEN */ - -2, /* R_DIGEST */ 0, /* R_TELEPORT */ - 1, /* R_STEALTH */ 1 /* R_SUSTARM */ - }; - - if ((ring = cur_ring[hand]) == NULL) - return 0; - if ((eat = uses[ring->o_which]) < 0) - eat = (rnd(-eat) == 0); - if (ring->o_which == R_DIGEST) - eat = -eat; - return eat; -} - -/* - * ring_num: - * Print ring bonuses - */ -char * -ring_num(THING *obj) -{ - static char buf[10]; - - if (!(obj->o_flags & ISKNOW)) - return ""; - switch (obj->o_which) - { - case R_PROTECT: - case R_ADDSTR: - case R_ADDDAM: - case R_ADDHIT: - sprintf(buf, " [%s]", num(obj->o_arm, 0, RING)); - otherwise: - return ""; - } - return buf; -} diff --git a/src/cc/rogue/rip.c b/src/cc/rogue/rip.c deleted file mode 100644 index 730a0c61f..000000000 --- a/src/cc/rogue/rip.c +++ /dev/null @@ -1,464 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * File for the fun ends - * Death or a total win - * - * @(#)rip.c 4.57 (Berkeley) 02/05/99 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -//#include -//#include -//#include -#include -//#include -//#include -//#include -//#include -#include "rogue.h" -#include "score.h" - -static char *rip[] = { -" __________\n", -" / \\\n", -" / REST \\\n", -" / IN \\\n", -" / PEACE \\\n", -" / \\\n", -" | |\n", -" | |\n", -" | killed by a |\n", -" | |\n", -" | 1980 |\n", -" *| * * * | *\n", -" ________)/\\\\_//(\\/(/\\)/\\//\\/|_)_______\n", - 0 -}; - -/* - * score: - * Figure score and post it. - */ -/* VARARGS2 */ - -void -score(struct rogue_state *rs,int amount, int flags, char monst) -{ - SCORE *scp; - int i; - SCORE *sc2; - SCORE *top_ten, *endp; - if ( rs->guiflag == 0 ) - return; -# ifdef MASTER - int prflags = 0; -# endif - void (*fp)(int); - unsigned int uid; - static char *reason[] = { - "killed", - "quit", - "A total winner", - "killed with Amulet" - }; - - start_score(); - - if (flags >= 0 -#ifdef MASTER - || wizard -#endif - ) - { - mvaddstr(LINES - 1, 0 , "[Press return to continue]"); - refresh(); - wgetnstr(stdscr,prbuf,80); - endwin(); - printf("\n"); - resetltchars(); - /* - * free up space to "guarantee" there is space for the top_ten - */ - delwin(stdscr); - delwin(curscr); - if (hw != NULL) - delwin(hw); - hw = NULL; - } - - top_ten = (SCORE *) malloc(numscores * sizeof (SCORE)); - endp = &top_ten[numscores]; - for (scp = top_ten; scp < endp; scp++) - { - scp->sc_score = 0; - for (i = 0; i < MAXSTR; i++) - scp->sc_name[i] = (unsigned char) rnd(255); - scp->sc_flags = RN; - scp->sc_level = RN; - scp->sc_monster = (unsigned short) RN; - scp->sc_uid = RN; - } - - signal(SIGINT, SIG_DFL); - -#ifdef MASTER - if (wizard) - if (strcmp(prbuf, "names") == 0) - prflags = 1; - else if (strcmp(prbuf, "edit") == 0) - prflags = 2; -#endif - rd_score(top_ten); - /* - * Insert her in list if need be - */ - sc2 = NULL; - if (!noscore) - { - uid = md_getuid(); - for (scp = top_ten; scp < endp; scp++) - if (amount > scp->sc_score) - break; - else if (!allscore && /* only one score per nowin uid */ - flags != 2 && scp->sc_uid == uid && scp->sc_flags != 2) - scp = endp; - if (scp < endp) - { - if (flags != 2 && !allscore) - { - for (sc2 = scp; sc2 < endp; sc2++) - { - if (sc2->sc_uid == uid && sc2->sc_flags != 2) - break; - } - if (sc2 >= endp) - sc2 = endp - 1; - } - else - sc2 = endp - 1; - while (sc2 > scp) - { - *sc2 = sc2[-1]; - sc2--; - } - scp->sc_score = amount; - strncpy(scp->sc_name, whoami, MAXSTR); - scp->sc_flags = flags; - if (flags == 2) - scp->sc_level = max_level; - else - scp->sc_level = level; - scp->sc_monster = monst; - scp->sc_uid = uid; - sc2 = scp; - } - } - /* - * Print the list - */ - if (flags != -1) - putchar('\n'); - printf("Top %s %s:\n", Numname, allscore ? "Scores" : "Rogueists"); - printf(" Score Name\n"); - for (scp = top_ten; scp < endp; scp++) - { - if (scp->sc_score) { - if (sc2 == scp) - md_raw_standout(); - printf("%2d %5d %s: %s on level %d", (int) (scp - top_ten + 1), - scp->sc_score, scp->sc_name, reason[scp->sc_flags], - scp->sc_level); - if (scp->sc_flags == 0 || scp->sc_flags == 3) - printf(" by %s", killname((char) scp->sc_monster, TRUE)); -#ifdef MASTER - if (prflags == 1) - { - printf(" (%s)", md_getrealname(scp->sc_uid)); - } - else if (prflags == 2) - { - fflush(stdout); - if ( fgets(prbuf,10,stdin) != 0 ) - fprintf(stderr,"fgets error\n"); - if (prbuf[0] == 'd') - { - for (sc2 = scp; sc2 < endp - 1; sc2++) - *sc2 = *(sc2 + 1); - sc2 = endp - 1; - sc2->sc_score = 0; - for (i = 0; i < MAXSTR; i++) - sc2->sc_name[i] = (char) rnd(255); - sc2->sc_flags = RN; - sc2->sc_level = RN; - sc2->sc_monster = (unsigned short) RN; - scp--; - } - } - else -#endif /* MASTER */ - printf("."); - if (sc2 == scp) - md_raw_standend(); - putchar('\n'); - } - else - break; - } - /* - * Update the list file - */ - if (sc2 != NULL) - { - if (lock_sc()) - { - fp = signal(SIGINT, SIG_IGN); - wr_score(top_ten); - unlock_sc(); - signal(SIGINT, fp); - } - } - free(top_ten); -} - -/* - * death: - * Do something really fun when he dies - */ - -void -death(struct rogue_state *rs,char monst) -{ - char **dp, *killer; - struct tm *lt; - static time_t date; - //struct tm *localtime(const time_t *); - if ( rs->guiflag == 0 ) - { - //fprintf(stderr,"death during replay by (%c)\n",monst); //sleep(3); - rs->replaydone = (uint32_t)time(NULL); - return; - } - signal(SIGINT, SIG_IGN); - purse -= purse / 10; - signal(SIGINT, leave); - clear(); - killer = killname(monst, FALSE); - if (!tombstone) - { - mvprintw(LINES - 2, 0, "Killed by "); - killer = killname(monst, FALSE); - if (monst != 's' && monst != 'h') - printw("a%s ", vowelstr(killer)); - printw("%s with %d gold", killer, purse); - } - else - { - time(&date); - lt = localtime(&date); - move(8, 0); - dp = rip; - while (*dp) - addstr(*dp++); - mvaddstr(17, center(killer), killer); - if (monst == 's' || monst == 'h') - mvaddch(16, 32, ' '); - else - mvaddstr(16, 33, vowelstr(killer)); - mvaddstr(14, center(whoami), whoami); - sprintf(prbuf, "%d Au", purse); - move(15, center(prbuf)); - addstr(prbuf); - sprintf(prbuf, "%4d", 1900+lt->tm_year); - mvaddstr(18, 26, prbuf); - } - move(LINES - 1, 0); - refresh(); - score(rs,purse, amulet ? 3 : 0, monst); - rogue_bailout(rs); - printf("[Press return to continue]"); - fflush(stdout); - if ( fgets(prbuf,10,stdin) != 0 ) - ; - my_exit(0); -} - -/* - * center: - * Return the index to center the given string - */ -int -center(char *str) -{ - return 28 - (((int)strlen(str) + 1) / 2); -} - -/* - * total_winner: - * Code for a winner - */ - -void -total_winner(struct rogue_state *rs) -{ - THING *obj; - struct obj_info *op; - int worth = 0; - int oldpurse; - - clear(); - standout(); - addstr(" \n"); - addstr(" @ @ @ @ @ @@@ @ @ \n"); - addstr(" @ @ @@ @@ @ @ @ @ \n"); - addstr(" @ @ @@@ @ @ @ @ @ @@@ @@@@ @@@ @ @@@ @ \n"); - addstr(" @@@@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ \n"); - addstr(" @ @ @ @ @ @ @ @@@@ @ @ @@@@@ @ @ @ \n"); - addstr(" @ @ @ @ @ @@ @ @ @ @ @ @ @ @ @ @ \n"); - addstr(" @@@ @@@ @@ @ @ @ @@@@ @@@@ @@@ @@@ @@ @ \n"); - addstr(" \n"); - addstr(" Congratulations, you have made it to the light of day! \n"); - standend(); - addstr("\nYou have joined the elite ranks of those who have escaped the\n"); - addstr("Dungeons of Doom alive. You journey home and sell all your loot at\n"); - addstr("a great profit and are admitted to the Fighters' Guild.\n"); - mvaddstr(LINES - 1, 0, "--Press space to continue--"); - refresh(); - wait_for(rs,' '); - clear(); - mvaddstr(0, 0, " Worth Item\n"); - oldpurse = purse; - for (obj = pack; obj != NULL; obj = next(obj)) - { - switch (obj->o_type) - { - case FOOD: - worth = 2 * obj->o_count; - when WEAPON: - worth = weap_info[obj->o_which].oi_worth; - worth *= 3 * (obj->o_hplus + obj->o_dplus) + obj->o_count; - obj->o_flags |= ISKNOW; - when ARMOR: - worth = arm_info[obj->o_which].oi_worth; - worth += (9 - obj->o_arm) * 100; - worth += (10 * (a_class[obj->o_which] - obj->o_arm)); - obj->o_flags |= ISKNOW; - when SCROLL: - worth = scr_info[obj->o_which].oi_worth; - worth *= obj->o_count; - op = &scr_info[obj->o_which]; - if (!op->oi_know) - worth /= 2; - op->oi_know = TRUE; - when POTION: - worth = pot_info[obj->o_which].oi_worth; - worth *= obj->o_count; - op = &pot_info[obj->o_which]; - if (!op->oi_know) - worth /= 2; - op->oi_know = TRUE; - when RING: - op = &ring_info[obj->o_which]; - worth = op->oi_worth; - if (obj->o_which == R_ADDSTR || obj->o_which == R_ADDDAM || - obj->o_which == R_PROTECT || obj->o_which == R_ADDHIT) - { - if (obj->o_arm > 0) - worth += obj->o_arm * 100; - else - worth = 10; - } - if (!(obj->o_flags & ISKNOW)) - worth /= 2; - obj->o_flags |= ISKNOW; - op->oi_know = TRUE; - when STICK: - op = &ws_info[obj->o_which]; - worth = op->oi_worth; - worth += 20 * obj->o_charges; - if (!(obj->o_flags & ISKNOW)) - worth /= 2; - obj->o_flags |= ISKNOW; - op->oi_know = TRUE; - when AMULET: - worth = 1000; - } - if (worth < 0) - worth = 0; - printw("%c) %5d %s\n", obj->o_packch, worth, inv_name(obj, FALSE)); - purse += worth; - } - printw(" %5d Gold Pieces ", oldpurse); - refresh(); - score(rs,purse, 2, ' '); - my_exit(0); -} - -/* - * killname: - * Convert a code to a monster name - */ -char * -killname(char monst, bool doart) -{ - struct h_list *hp; - char *sp; - bool article; - static struct h_list nlist[] = { - {'a', "arrow", TRUE}, - {'b', "bolt", TRUE}, - {'d', "dart", TRUE}, - {'h', "hypothermia", FALSE}, - {'s', "starvation", FALSE}, - {'\0'} - }; - - if (isupper(monst)) - { - sp = monsters[monst-'A'].m_name; - article = TRUE; - } - else - { - sp = "Wally the Wonder Badger"; - article = FALSE; - for (hp = nlist; hp->h_ch; hp++) - if (hp->h_ch == monst) - { - sp = hp->h_desc; - article = hp->h_print; - break; - } - } - if (doart && article) - sprintf(prbuf, "a%s ", vowelstr(sp)); - else - prbuf[0] = '\0'; - strcat(prbuf, sp); - return prbuf; -} - -/* - * death_monst: - * Return a monster appropriate for a random death. - */ -char -death_monst() -{ - static char poss[] = - { - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', - 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', - 'Y', 'Z', 'a', 'b', 'h', 'd', 's', - ' ' /* This is provided to generate the "Wally the Wonder Badger" - message for killer */ - }; - - return poss[rnd(sizeof poss / sizeof (char))]; -} diff --git a/src/cc/rogue/rogue.6 b/src/cc/rogue/rogue.6 deleted file mode 100644 index 6b63252ab..000000000 --- a/src/cc/rogue/rogue.6 +++ /dev/null @@ -1,96 +0,0 @@ -.\" -.\" @(#)rogue.6 6.2 (Berkeley) 5/6/86 -.\" -.\" Rogue: Exploring the Dungeons of Doom -.\" Copyright (C) 1980-1983, 1985, 1986 Michael Toy, Ken Arnold and Glenn Wichman -.\" All rights reserved. -.\" -.\" See the file LICENSE.TXT for full copyright and licensing information. -.\" -.TH ROGUE 6 "May 6, 1986" -.UC 4 -.SH NAME -rogue \- Exploring The Dungeons of Doom -.SH SYNOPSIS -.B rogue -[ -.B \-r -] -[ -.I save_file -] -[ -.B \-s -] -[ -.B \-d -] -.SH DESCRIPTION -.PP -.I Rogue -is a computer fantasy game with a new twist. It is crt oriented and the -object of the game is to survive the attacks of various monsters and get -a lot of gold, rather than the puzzle solving orientation of most computer -fantasy games. -.PP -To get started you really only need to know two commands. The command -.B ? -will give you a list of the available commands and the command -.B / -will identify the things you see on the screen. -.PP -To win the game (as opposed to merely playing to beat other people's high -scores) you must locate the Amulet of Yendor which is somewhere below -the 20th level of the dungeon and get it out. Nobody has achieved this -yet and if somebody does, they will probably go down in history as a hero -among heroes. -.PP -When the game ends, either by your death, when you quit, or if you (by -some miracle) manage to win, -.I rogue -will give you a list of the top-ten scorers. The scoring is based entirely -upon how much gold you get. There is a 10% penalty for getting yourself -killed. -.PP -If -.I save_file -is specified, -rogue will be restored from the specified saved game file. -If the -.B \-r -option is used, the save game file is presumed to be the default. -.PP -The -.B \-s -option will print out the list of scores. -.PP -The -.B \-d -option will kill you and try to add you to the score file. -.PP -For more detailed directions, read the document -.I "A Guide to the Dungeons of Doom." -.SH AUTHORS -Michael C. Toy, -Kenneth C. R. C. Arnold, -Glenn Wichman -.SH FILES -.DT -.ta \w'rogue.scr\ \ \ 'u -rogue.scr Score file -.br -\fB~\fP/rogue.save Default save file -.SH SEE ALSO -Michael C. Toy -and -Kenneth C. R. C. Arnold, -.I "A guide to the Dungeons of Doom" -.SH BUGS -.PP -Probably infinite -(although countably infinite). -However, -that Ice Monsters sometimes transfix you permanently is -.I not -a bug. -It's a feature. diff --git a/src/cc/rogue/rogue.6.in b/src/cc/rogue/rogue.6.in deleted file mode 100644 index a9d6d9903..000000000 --- a/src/cc/rogue/rogue.6.in +++ /dev/null @@ -1,96 +0,0 @@ -.\" -.\" @(#)rogue.6 6.2 (Berkeley) 5/6/86 -.\" -.\" Rogue: Exploring the Dungeons of Doom -.\" Copyright (C) 1980-1983, 1985, 1986 Michael Toy, Ken Arnold and Glenn Wichman -.\" All rights reserved. -.\" -.\" See the file LICENSE.TXT for full copyright and licensing information. -.\" -.TH ROGUE 6 "May 6, 1986" -.UC 4 -.SH NAME -rogue \- Exploring The Dungeons of Doom -.SH SYNOPSIS -.B @PROGRAM@ -[ -.B \-r -] -[ -.I save_file -] -[ -.B \-s -] -[ -.B \-d -] -.SH DESCRIPTION -.PP -.I Rogue -is a computer fantasy game with a new twist. It is crt oriented and the -object of the game is to survive the attacks of various monsters and get -a lot of gold, rather than the puzzle solving orientation of most computer -fantasy games. -.PP -To get started you really only need to know two commands. The command -.B ? -will give you a list of the available commands and the command -.B / -will identify the things you see on the screen. -.PP -To win the game (as opposed to merely playing to beat other people's high -scores) you must locate the Amulet of Yendor which is somewhere below -the 20th level of the dungeon and get it out. Nobody has achieved this -yet and if somebody does, they will probably go down in history as a hero -among heroes. -.PP -When the game ends, either by your death, when you quit, or if you (by -some miracle) manage to win, -.I rogue -will give you a list of the top-ten scorers. The scoring is based entirely -upon how much gold you get. There is a 10% penalty for getting yourself -killed. -.PP -If -.I save_file -is specified, -rogue will be restored from the specified saved game file. -If the -.B \-r -option is used, the save game file is presumed to be the default. -.PP -The -.B \-s -option will print out the list of scores. -.PP -The -.B \-d -option will kill you and try to add you to the score file. -.PP -For more detailed directions, read the document -.I "A Guide to the Dungeons of Doom." -.SH AUTHORS -Michael C. Toy, -Kenneth C. R. C. Arnold, -Glenn Wichman -.SH FILES -.DT -.ta \w'@SCOREFILE@\ \ \ 'u -@SCOREFILE@ Score file -.br -\fB~\fP/rogue.save Default save file -.SH SEE ALSO -Michael C. Toy -and -Kenneth C. R. C. Arnold, -.I "A guide to the Dungeons of Doom" -.SH BUGS -.PP -Probably infinite -(although countably infinite). -However, -that Ice Monsters sometimes transfix you permanently is -.I not -a bug. -It's a feature. diff --git a/src/cc/rogue/rogue.c b/src/cc/rogue/rogue.c deleted file mode 100644 index 858a2deb9..000000000 --- a/src/cc/rogue/rogue.c +++ /dev/null @@ -1,776 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - * - * @(#)main.c 4.22 (Berkeley) 02/05/99 - */ - -//#include -//#include -#include -//#include -//#include - -#include "rogue.h" -#ifdef STANDALONE -#include "../hush3/src/hush_cJSON.h" -#else -#include "../../hush_cJSON.h" -#endif - -/* - * main: - * The main program, of course - */ -struct rogue_state globalR; -char Gametxidstr[67]; -void garbage_collect(); - -void purge_obj_guess(struct obj_info *array,int32_t n) -{ - int32_t i; - for (i=0; iseed; - //clear(); - purge_obj_guess(things,NUMTHINGS); - purge_obj_guess(ring_info,MAXRINGS); - purge_obj_guess(pot_info,MAXPOTIONS); - purge_obj_guess(arm_info,MAXARMORS); - purge_obj_guess(scr_info,MAXSCROLLS); - purge_obj_guess(weap_info,MAXWEAPONS + 1); - purge_obj_guess(ws_info,MAXSTICKS); - free_list(player._t._t_pack); - for (tp = mlist; tp != NULL; tp = next(tp)) - free_list(tp->t_pack); - free_list(mlist); - free_list(lvl_obj); - garbage_collect(); - - externs_clear(); - memset(d_list,0,sizeof(d_list)); - - memcpy(passages,origpassages,sizeof(passages)); - memcpy(monsters,origmonsters,sizeof(monsters)); - memcpy(things,origthings,sizeof(things)); - - memcpy(ring_info,origring_info,sizeof(ring_info)); - memcpy(pot_info,origpot_info,sizeof(pot_info)); - memcpy(arm_info,origarm_info,sizeof(arm_info)); - memcpy(scr_info,origscr_info,sizeof(scr_info)); - memcpy(weap_info,origweap_info,sizeof(weap_info)); - memcpy(ws_info,origws_info,sizeof(ws_info)); - - initscr(); /* Start up cursor package */ - init_probs(); /* Set up prob tables for objects */ - init_player(rs); /* Set up initial player stats */ - init_names(); /* Set up names of scrolls */ - init_colors(); /* Set up colors of potions */ - init_stones(); /* Set up stone settings of rings */ - init_materials(); /* Set up materials of wands */ - setup(); - - /* - * The screen must be at least NUMLINES x NUMCOLS - */ - if (LINES < NUMLINES || COLS < NUMCOLS) - { - printf("\nSorry, the screen must be at least %dx%d\n", NUMLINES, NUMCOLS); - endwin(); - my_exit(1); - } - //fprintf(stderr,"LINES %d, COLS %d\n",LINES,COLS); - - // Set up windows - if ( hw == NULL ) - { - hw = newwin(LINES, COLS, 0, 0); - } - idlok(stdscr, TRUE); - idlok(hw, TRUE); -#ifdef MASTER - noscore = wizard; -#endif - new_level(rs); // Draw current level - // Start up daemons and fuses - start_daemon(runners, 0, AFTER); - start_daemon(doctor, 0, AFTER); - fuse(swander, 0, WANDERTIME, AFTER); - start_daemon(stomach, 0, AFTER); - if ( rs->restoring != 0 ) - { - restore_player(rs); - } - playit(rs); -} - -int32_t roguefname(char *fname,uint64_t seed,int32_t counter) -{ - sprintf(fname,"rogue.%llu.%d",(long long)seed,counter); - return(0); -} - -int32_t flushkeystrokes_local(struct rogue_state *rs,int32_t waitflag) -{ -#ifndef BUILD_ROGUE - char fname[1024]; FILE *fp; int32_t i,retflag = -1; - rs->counter++; - roguefname(fname,rs->seed,rs->counter); - if ( (fp= fopen(fname,"wb")) != 0 ) - { - if ( fwrite(rs->buffered,1,rs->num,fp) == rs->num ) - { - rs->num = 0; - retflag = 0; - fclose(fp); - /*if ( (fp= fopen("savefile","wb")) != 0 ) - { - save_file(rs,fp,0); - if ( 0 && (fp= fopen("savefile","rb")) != 0 ) - { - for (i=0; i<0x150; i++) - fprintf(stderr,"%02x",fgetc(fp)); - fprintf(stderr," first part rnd.%d\n",rnd(1000)); - fclose(fp); - }*/ - roguefname(fname,rs->seed,rs->counter+1); - if ( (fp= fopen(fname,"wb")) != 0 ) // truncate next file - fclose(fp); - //fprintf(stderr,"savefile <- %s retflag.%d\n",fname,retflag); - //} - } else fprintf(stderr,"error writing (%s)\n",fname); - } else fprintf(stderr,"error creating (%s)\n",fname); - return(retflag); -#else - return(0); -#endif -} - -#ifdef BUILD_ROGUE -// stubs for inside daemon - -int32_t rogue_progress(struct rogue_state *rs,int32_t waitflag,uint64_t seed,char *keystrokes,int32_t num) -{ -} - -int32_t rogue_setplayerdata(struct rogue_state *rs,char *gametxidstr) -{ - return(-1); -} -#endif - -int32_t flushkeystrokes(struct rogue_state *rs,int32_t waitflag) -{ - if ( rs->num > 0 ) - { - if ( rogue_progress(rs,waitflag,rs->seed,rs->buffered,rs->num) > 0 ) - { - flushkeystrokes_local(rs,waitflag); - memset(rs->buffered,0,sizeof(rs->buffered)); - } - } - return(0); -} - -void rogue_bailout(struct rogue_state *rs) -{ - char cmd[512]; - flushkeystrokes(rs,1); - //sleep(5); - return; - /*fprintf(stderr,"bailing out\n"); - sprintf(cmd,"./hush-cli -ac_name=ROGUE cclib bailout 17 \\\"[%%22%s%%22]\\\" >> bailout.log",Gametxidstr); - if ( system(cmd) != 0 ) - fprintf(stderr,"error issuing (%s)\n",cmd);*/ -} - -#ifdef _WIN32 -#ifdef _MSC_VER -#define sleep(x) Sleep(1000*(x)) -#endif -#endif - -int32_t rogue_replay2(uint8_t *newdata,uint64_t seed,char *keystrokes,int32_t num,struct rogue_player *player,int32_t sleepmillis) -{ - struct rogue_state *rs; FILE *fp; int32_t i,n; - rs = (struct rogue_state *)calloc(1,sizeof(*rs)); - rs->seed = seed; - rs->keystrokes = keystrokes; - rs->numkeys = num; - rs->sleeptime = sleepmillis * 1000; - if ( player != 0 ) - { - rs->P = *player; - rs->restoring = 1; - //fprintf(stderr,"restore player packsize.%d HP.%d\n",rs->P.packsize,rs->P.hitpoints); - if ( rs->P.packsize > MAXPACK ) - rs->P.packsize = MAXPACK; - } - globalR = *rs; - uint32_t starttime = (uint32_t)time(NULL); - rogueiterate(rs); - - /* - // keypress after replay - printf("[Press return to continue]"); - fflush(stdout); - if (fgets(prbuf, 10, stdin) != 0); - */ - - if ( 0 ) - { - fprintf(stderr,"elapsed %d seconds\n",(uint32_t)time(NULL) - starttime); - sleep(2); - - starttime = (uint32_t)time(NULL); - for (i=0; i<10000; i++) - { - memset(rs,0,sizeof(*rs)); - rs->seed = seed; - rs->keystrokes = keystrokes; - rs->numkeys = num; - rs->sleeptime = 0; - rogueiterate(rs); - } - fprintf(stderr,"elapsed %d seconds\n",(uint32_t)time(NULL)-starttime); - sleep(3); - } - if ( (fp= fopen("checkfile","wb")) != 0 ) - { - save_file(rs,fp,0); - //fprintf(stderr,"gold.%d hp.%d strength.%d/%d level.%d exp.%d dungeon.%d data[%d]\n",rs->P.gold,rs->P.hitpoints,rs->P.strength&0xffff,rs->P.strength>>16,rs->P.level,rs->P.experience,rs->P.dungeonlevel,rs->playersize); - if ( newdata != 0 && rs->playersize > 0 ) - memcpy(newdata,rs->playerdata,rs->playersize); - } - n = rs->playersize; - free(rs); - return(n); -} - -long get_filesize(FILE *fp) -{ - long fsize,fpos = ftell(fp); - fseek(fp,0,SEEK_END); - fsize = ftell(fp); - fseek(fp,fpos,SEEK_SET); - return(fsize); -} - -char *rogue_keystrokesload(int32_t *numkeysp,uint64_t seed,int32_t counter) -{ - char fname[1024],*keystrokes = 0; FILE *fp; long fsize; int32_t num = 0; - *numkeysp = 0; - while ( 1 ) - { - roguefname(fname,seed,counter); - //printf("check (%s)\n",fname); - if ( (fp= fopen(fname,"rb")) == 0 ) - break; - if ( (fsize= get_filesize(fp)) <= 0 ) - { - fclose(fp); - //printf("fsize.%ld\n",fsize); - break; - } - if ( (keystrokes= (char *)realloc(keystrokes,num+fsize)) == 0 ) - { - fprintf(stderr,"error reallocating keystrokes\n"); - fclose(fp); - return(0); - } - if ( fread(&keystrokes[num],1,fsize,fp) != fsize ) - { - fprintf(stderr,"error reading keystrokes from (%s)\n",fname); - fclose(fp); - free(keystrokes); - return(0); - } - fclose(fp); - num += fsize; - counter++; - //fprintf(stderr,"loaded %ld from (%s) total %d\n",fsize,fname,num); - } - *numkeysp = num; - return(keystrokes); -} - -int32_t rogue_replay(uint64_t seed,int32_t sleeptime) -{ - FILE *fp; char fname[1024]; char *keystrokes = 0; long fsize; int32_t i,num=0,counter = 0; struct rogue_state *rs; struct rogue_player P,*player = 0; - if ( seed == 0 ) - seed = 777; - keystrokes = rogue_keystrokesload(&num,seed,counter); - if ( num > 0 ) - { - sprintf(fname,"rogue.%llu.player",(long long)seed); - if ( (fp=fopen(fname,"rb")) != 0 ) - { - if ( fread(&P,1,sizeof(P),fp) > 0 ) - { - //printf("max size player\n"); - player = &P; - } - fclose(fp); - } - rogue_replay2(0,seed,keystrokes,num,player,sleeptime); - mvaddstr(LINES - 2, 0, (char *)"replay completed"); - endwin(); - my_exit(0); - } - if ( keystrokes != 0 ) - free(keystrokes); - return(num); -} - -int rogue(int argc, char **argv, char **envp) -{ - char *env; int lowtime; struct rogue_state *rs = &globalR; - memset(rs,0,sizeof(*rs)); - rs->guiflag = 1; - rs->sleeptime = 1; // non-zero to allow refresh() - if ( argc == 3 && strlen(argv[2]) == 64 ) - { - #ifdef _WIN32 - #ifdef _MSC_VER - rs->seed = _strtoui64(argv[1], NULL, 10); - #else - rs->seed = atol(argv[1]); // windows, but not MSVC - #endif // _MSC_VER - #else - rs->seed = atol(argv[1]); // non-windows - #endif // _WIN32 - strcpy(Gametxidstr,argv[2]); - fprintf(stderr,"setplayerdata\n"); - if ( rogue_setplayerdata(rs,Gametxidstr) < 0 ) - { - fprintf(stderr,"invalid gametxid, or already started\n"); - return(-1); - } - } else rs->seed = 777; - md_init(); - -#ifdef MASTER - /* - * Check to see if he is a wizard - */ - if (argc >= 2 && argv[1][0] == '\0') - if (strcmp(PASSWD, md_crypt(md_getpass("wizard's password: "), "mT")) == 0) - { - wizard = TRUE; - player.t_flags |= SEEMONST; - argv++; - argc--; - } - -#endif - - /* - * get home and options from environment - */ - - strncpy(home, md_gethomedir(), MAXSTR); - - strcpy(file_name, home); - strcat(file_name, "rogue.save"); - - if ((env = getenv("ROGUEOPTS")) != NULL) - parse_opts(env); - //if (env == NULL || whoami[0] == '\0') - // strucpy(whoami, md_getusername(), (int) strlen(md_getusername())); - lowtime = (int) time(NULL); -#ifdef MASTER - if (wizard && getenv("SEED") != NULL) - rs->seed = atoi(getenv("SEED")); - else -#endif - //dnum = lowtime + md_getpid(); - if ( rs != 0 ) - seed = rs->seed; - else seed = 777; - //dnum = (int)seed; - - open_score(); - - /* - * Drop setuid/setgid after opening the scoreboard file. - */ - - md_normaluser(); - - /* - * check for print-score option - */ - - md_normaluser(); /* we drop any setgid/setuid priveldges here */ - - if (argc == 2) - { - if (strcmp(argv[1], "-s") == 0) - { - noscore = TRUE; - score(rs,0, -1, 0); - exit(0); - } - else if (strcmp(argv[1], "-d") == 0) - { - rs->seed = rnd(100); /* throw away some rnd()s to break patterns */ - while (--rs->seed) - rnd(100); - purse = rnd(100) + 1; - level = rnd(100) + 1; - initscr(); - getltchars(); - death(rs,death_monst()); - exit(0); - } - } - - init_check(); /* check for legal startup */ - if (argc == 2) - if (!restore(rs,argv[1], envp)) /* Note: restore will never return */ - my_exit(1); -#ifdef MASTER - if (wizard) - printf("Hello %s, welcome to dungeon #%d", whoami, dnum); - else -#endif - printf("Hello %s, just a moment while I dig the dungeon... seed.%llu", whoami,(long long)rs->seed); - fflush(stdout); - fprintf(stderr,"rogueiterate\n"); - rogueiterate(rs); - return(0); -} - -/* - * endit: - * Exit the program abnormally. - */ - -void -endit(int sig) -{ - NOOP(sig); - fatal("Okay, bye bye!\n"); -} - -/* - * fatal: - * Exit the program, printing a message. - */ - -void -fatal(char *s) -{ - mvaddstr(LINES - 2, 0, s); - refresh(); - endwin(); - my_exit(0); -} - -/* - * rnd: - * Pick a very random number. - */ -int -rnd(int range) -{ - return range == 0 ? 0 : abs((int) RN) % range; -} - -/* - * roll: - * Roll a number of dice - */ -int -roll(int number, int sides) -{ - int dtotal = 0; - - while (number--) - dtotal += rnd(sides)+1; - return dtotal; -} - -/* - * tstp: - * Handle stop and start signals - */ - -void -tstp(int ignored) -{ - int y, x; - int oy, ox; - - NOOP(ignored); - - /* - * leave nicely - */ - getyx(curscr, oy, ox); - mvcur(0, COLS - 1, LINES - 1, 0); - endwin(); - resetltchars(); - fflush(stdout); - md_tstpsignal(); - - /* - * start back up again - */ - md_tstpresume(); - raw(); - noecho(); - keypad(stdscr,1); - playltchars(); - clearok(curscr, TRUE); - wrefresh(curscr); - getyx(curscr, y, x); - mvcur(y, x, oy, ox); - fflush(stdout); - wmove(curscr,oy,ox); -/*#ifndef __APPLE__ -#ifndef BUILD_ROGUE - curscr->_cury = oy; - curscr->_curx = ox; -#endif -#endif*/ -} - - -#ifdef _WIN32 -#ifdef _MSC_VER -void usleep(int32_t micros) -{ - if (micros < 1000) - Sleep(1); - else Sleep(micros / 1000); -} -#endif -#endif - -/* - * playit: - * The main loop of the program. Loop until the game is over, - * refreshing things and looking at the proper times. - */ - -void -playit(struct rogue_state *rs) -{ - char *opts; - - /* - * set up defaults for slow terminals - */ - - if (baudrate() <= 1200) - { - terse = TRUE; - jump = TRUE; - see_floor = FALSE; - } - - if (md_hasclreol()) - inv_type = INV_CLEAR; - - /* - * parse environment declaration of options - */ - if ((opts = getenv("ROGUEOPTS")) != NULL) - parse_opts(opts); - - - oldpos = hero; - oldrp = roomin(rs,&hero); - while (playing) - { - command(rs); // Command execution - if ( rs->guiflag == 0 ) - { - if ( rs->replaydone != 0 ) - { - if ( 0 && rs->sleeptime != 0 ) - sleep(3); - return; - } - if ( rs->sleeptime != 0 ) - usleep(rs->sleeptime); - } - else - { - if ( rs->needflush != 0 ) - { - if ( flushkeystrokes(rs,0) == 0 ) - rs->needflush = 0; - } - } - } - if ( rs->guiflag != 0 ) - flushkeystrokes(rs,1); - endit(0); -} - - - -int32_t _quit() -{ - struct rogue_state *rs = &globalR; - int oy, ox, c; - //fprintf(stderr,"inside quit(%d)\n",sig); - getyx(curscr, oy, ox); - msg(rs,"really quit?"); - //sleep(1); - if ( (c= readchar(rs)) == 'y') - { - if ( rs->guiflag != 0 ) - { - signal(SIGINT, leave); - clear(); - mvprintw(LINES - 2, 0, "You quit with %d gold pieces", purse); - move(LINES - 1, 0); - if ( rs->sleeptime != 0 ) - refresh(); - score(rs,purse, 1, 0); - flushkeystrokes(rs,1); - my_exit(0); - } - else - { - //score(rs,purse, 1, 0); - //fprintf(stderr,"done! (%c)\n",c); - } - return(1); - } - else - { - //fprintf(stderr,"'Q' answer (%c)\n",c); - move(0, 0); - clrtoeol(); - status(rs); - move(oy, ox); - if ( rs->sleeptime != 0 ) - refresh(); - mpos = 0; - count = 0; - to_death = FALSE; - return(0); - } -} - -/* - * quit: - * Have player make certain, then exit. - */ - -void quit(int sig) -{ - struct rogue_state *rs = &globalR; - int oy, ox, c; - //fprintf(stderr,"inside quit(%d)\n",sig); - if ( rs->guiflag != 0 ) - { - NOOP(sig); - - /* - * Reset the signal in case we got here via an interrupt - */ - if (!q_comm) - mpos = 0; - } - _quit(); -} - -/* - * leave: - * Leave quickly, but curteously - */ - -void -leave(int sig) -{ - static char buf[BUFSIZ]; - - NOOP(sig); - - setbuf(stdout, buf); /* throw away pending output */ - - if (!isendwin()) - { - mvcur(0, COLS - 1, LINES - 1, 0); - endwin(); - } - - putchar('\n'); - my_exit(0); -} - -/* - * shell: - * Let them escape for a while - */ - -void -shell(struct rogue_state *rs) -{ - if ( rs != 0 && rs->guiflag != 0 ) - { - /* - * Set the terminal back to original mode - */ - move(LINES-1, 0); - refresh(); - endwin(); - resetltchars(); - putchar('\n'); - in_shell = TRUE; - after = FALSE; - fflush(stdout); - /* - * Fork and do a shell - */ - md_shellescape(); - - printf("\n[Press return to continue]"); - fflush(stdout); - noecho(); - raw(); - keypad(stdscr,1); - playltchars(); - in_shell = FALSE; - wait_for(rs,'\n'); - clearok(stdscr, TRUE); - } - else fprintf(stderr,"no shell in the blockchain\n"); -} - -/* - * my_exit: - * Leave the process properly - */ - -void -my_exit(int st) -{ - uint32_t counter; - resetltchars(); - if ( globalR.guiflag != 0 || globalR.sleeptime != 0 ) - exit(st); - else if ( counter++ < 10 ) - { - fprintf(stderr,"would have exit.(%d) sleeptime.%d\n",st,globalR.sleeptime); - globalR.replaydone = 1; - } -} - diff --git a/src/cc/rogue/rogue.cat b/src/cc/rogue/rogue.cat deleted file mode 100644 index 66d9605a2..000000000 --- a/src/cc/rogue/rogue.cat +++ /dev/null @@ -1,61 +0,0 @@ -ROGUE(6) ROGUE(6) - - - -NAME - rogue - Exploring The Dungeons of Doom - -SYNOPSIS - rogue [ -r ] [ save_file ] [ -s ] [ -d ] - -DESCRIPTION - Rogue is a computer fantasy game with a new twist. It is crt oriented - and the object of the game is to survive the attacks of various mon- - sters and get a lot of gold, rather than the puzzle solving orientation - of most computer fantasy games. - - To get started you really only need to know two commands. The command - ? will give you a list of the available commands and the command / - will identify the things you see on the screen. - - To win the game (as opposed to merely playing to beat other people's - high scores) you must locate the Amulet of Yendor which is somewhere - below the 20th level of the dungeon and get it out. Nobody has - achieved this yet and if somebody does, they will probably go down in - history as a hero among heroes. - - When the game ends, either by your death, when you quit, or if you (by - some miracle) manage to win, rogue will give you a list of the top-ten - scorers. The scoring is based entirely upon how much gold you get. - There is a 10% penalty for getting yourself killed. - - If save_file is specified, rogue will be restored from the specified - saved game file. If the -r option is used, the save game file is pre- - sumed to be the default. - - The -s option will print out the list of scores. - - The -d option will kill you and try to add you to the score file. - - For more detailed directions, read the document A Guide to the Dungeons - of Doom. - -AUTHORS - Michael C. Toy, Kenneth C. R. C. Arnold, Glenn Wichman - -FILES - rogue.scr Score file - ~/rogue.save Default save file - -SEE ALSO - Michael C. Toy and Kenneth C. R. C. Arnold, A guide to the Dungeons of - Doom - -BUGS - Probably infinite (although countably infinite). However, that Ice - Monsters sometimes transfix you permanently is not a bug. It's a fea- - ture. - - - -4th Berkeley Distribution May 6, 1986 ROGUE(6) diff --git a/src/cc/rogue/rogue.cat.in b/src/cc/rogue/rogue.cat.in deleted file mode 100644 index 8dbef73c1..000000000 --- a/src/cc/rogue/rogue.cat.in +++ /dev/null @@ -1,61 +0,0 @@ -ROGUE(6) ROGUE(6) - - - -NAME - rogue - Exploring The Dungeons of Doom - -SYNOPSIS - @PROGRAM@ [ -r ] [ save_file ] [ -s ] [ -d ] - -DESCRIPTION - Rogue is a computer fantasy game with a new twist. It is crt oriented - and the object of the game is to survive the attacks of various mon- - sters and get a lot of gold, rather than the puzzle solving orientation - of most computer fantasy games. - - To get started you really only need to know two commands. The command - ? will give you a list of the available commands and the command / - will identify the things you see on the screen. - - To win the game (as opposed to merely playing to beat other people's - high scores) you must locate the Amulet of Yendor which is somewhere - below the 20th level of the dungeon and get it out. Nobody has - achieved this yet and if somebody does, they will probably go down in - history as a hero among heroes. - - When the game ends, either by your death, when you quit, or if you (by - some miracle) manage to win, rogue will give you a list of the top-ten - scorers. The scoring is based entirely upon how much gold you get. - There is a 10% penalty for getting yourself killed. - - If save_file is specified, rogue will be restored from the specified - saved game file. If the -r option is used, the save game file is pre- - sumed to be the default. - - The -s option will print out the list of scores. - - The -d option will kill you and try to add you to the score file. - - For more detailed directions, read the document A Guide to the Dungeons - of Doom. - -AUTHORS - Michael C. Toy, Kenneth C. R. C. Arnold, Glenn Wichman - -FILES - @SCOREFILE@ Score file - ~/rogue.save Default save file - -SEE ALSO - Michael C. Toy and Kenneth C. R. C. Arnold, A guide to the Dungeons of - Doom - -BUGS - Probably infinite (although countably infinite). However, that Ice - Monsters sometimes transfix you permanently is not a bug. It's a fea- - ture. - - - -4th Berkeley Distribution May 6, 1986 ROGUE(6) diff --git a/src/cc/rogue/rogue.desktop b/src/cc/rogue/rogue.desktop deleted file mode 100644 index 74f9518c7..000000000 --- a/src/cc/rogue/rogue.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Name=Rogue -GenericName=Rogue -Comment=The original curses-based adventure game -Exec=rogue -Icon=rogue.png -Terminal=true -Type=Application -Categories=Game;RolePlaying; -Version=1.0 diff --git a/src/cc/rogue/rogue.doc b/src/cc/rogue/rogue.doc deleted file mode 100644 index 684738d11..000000000 --- a/src/cc/rogue/rogue.doc +++ /dev/null @@ -1,858 +0,0 @@ - - - - - - - - A Guide to the Dungeons of Doom - - - Michael C. Toy - Kenneth C. R. C. Arnold - - - Computer Systems Research Group - Department of Electrical Engineering and Computer Science - University of California - Berkeley, California 94720 - - - - - ABSTRACT - - Rogue is a visual CRT based fantasy game which runs - under the UNIX timesharing system. This paper de- - scribes how to play rogue, and gives a few hints for - those who might otherwise get lost in the Dungeons - of Doom. - - - - -1. Introduction - - You have just finished your years as a student at the -local fighter's guild. After much practice and sweat you -have finally completed your training and are ready to embark -upon a perilous adventure. As a test of your skills, the -local guildmasters have sent you into the Dungeons of Doom. -Your task is to return with the Amulet of Yendor. Your -reward for the completion of this task will be a full mem- -bership in the local guild. In addition, you are allowed to -keep all the loot you bring back from the dungeons. - - In preparation for your journey, you are given an -enchanted mace, a bow, and a quiver of arrows taken from a -dragon's hoard in the far off Dark Mountains. You are also -outfitted with elf-crafted armor and given enough food to -reach the dungeons. You say goodbye to family and friends -for what may be the last time and head up the road. - - You set out on your way to the dungeons and after sev- -eral days of uneventful travel, you see the ancient ruins -that mark the entrance to the Dungeons of Doom. It is late -at night, so you make camp at the entrance and spend the -____________________ - UNIX is a trademark of Bell Laboratories - - - - - - - - - - - - -USD:33-2 A Guide to the Dungeons of Doom - - -night sleeping under the open skies. In the morning you -gather your weapons, put on your armor, eat what is almost -your last food, and enter the dungeons. - -2. What is going on here? - - You have just begun a game of rogue. Your goal is to -grab as much treasure as you can, find the Amulet of Yendor, -and get out of the Dungeons of Doom alive. On the screen, a -map of where you have been and what you have seen on the -current dungeon level is kept. As you explore more of the -level, it appears on the screen in front of you. - - Rogue differs from most computer fantasy games in that -it is screen oriented. Commands are all one or two -keystrokes1 and the results of your commands are displayed -graphically on the screen rather than being explained in -words.2 - - Another major difference between rogue and other com- -puter fantasy games is that once you have solved all the -puzzles in a standard fantasy game, it has lost most of its -excitement and it ceases to be fun. Rogue, on the other -hand, generates a new dungeon every time you play it and -even the author finds it an entertaining and exciting game. - -3. What do all those things on the screen mean? - - In order to understand what is going on in rogue you -have to first get some grasp of what rogue is doing with the -screen. The rogue screen is intended to replace the "You -can see ..." descriptions of standard fantasy games. Figure -1 is a sample of what a rogue screen might look like. - -3.1. The bottom line - - At the bottom line of the screen are a few pieces of -cryptic information describing your current status. Here is -an explanation of what these things mean: - -Level This number indicates how deep you have gone in the - dungeon. It starts at one and goes up as you go - deeper into the dungeon. - -Gold The number of gold pieces you have managed to find - and keep with you so far. -____________________ - 1 As opposed to pseudo English sentences. - 2 A minimum screen size of 24 lines by 80 columns is re- -quired. If the screen is larger, only the 24x80 section -will be used for the map. - - - - - - - - - - - - -A Guide to the Dungeons of Doom USD:33-3 - - - -____________________________________________________________ - - - ------------ - |..........+ - |..@....]..| - |....B.....| - |..........| - -----+------ - - - -Level: 1 Gold: 0 Hp: 12(12) Str: 16(16) Arm: 4 Exp: 1/0 - - Figure 1 -____________________________________________________________ - - -Hp Your current and maximum health points. Health - points indicate how much damage you can take before - you die. The more you get hit in a fight, the lower - they get. You can regain health points by resting. - The number in parentheses is the maximum number your - health points can reach. - -Str Your current strength and maximum ever strength. - This can be any integer less than or equal to 31, or - greater than or equal to three. The higher the num- - ber, the stronger you are. The number in the paren- - theses is the maximum strength you have attained so - far this game. - -Arm Your current armor protection. This number indicates - how effective your armor is in stopping blows from - unfriendly creatures. The higher this number is, the - more effective the armor. - -Exp These two numbers give your current experience level - and experience points. As you do things, you gain - experience points. At certain experience point - totals, you gain an experience level. The more expe- - rienced you are, the better you are able to fight and - to withstand magical attacks. - -3.2. The top line - - The top line of the screen is reserved for printing -messages that describe things that are impossible to repre- -sent visually. If you see a "--More--" on the top line, -this means that rogue wants to print another message on the -screen, but it wants to make certain that you have read the -one that is there first. To read the next message, just - - - - - - - - - - -USD:33-4 A Guide to the Dungeons of Doom - - -type a space. - -3.3. The rest of the screen - - The rest of the screen is the map of the level as you -have explored it so far. Each symbol on the screen repre- -sents something. Here is a list of what the various symbols -mean: - -@ This symbol represents you, the adventurer. - --| These symbols represent the walls of rooms. - -+ A door to/from a room. - -. The floor of a room. - -# The floor of a passage between rooms. - -* A pile or pot of gold. - -) A weapon of some sort. - -] A piece of armor. - -! A flask containing a magic potion. - -? A piece of paper, usually a magic scroll. - -= A ring with magic properties - -/ A magical staff or wand - -^ A trap, watch out for these. - -% A staircase to other levels - -: A piece of food. - -A-Z The uppercase letters represent the various inhabitants - of the Dungeons of Doom. Watch out, they can be nasty - and vicious. - -4. Commands - - Commands are given to rogue by typing one or two char- -acters. Most commands can be preceded by a count to repeat -them (e.g. typing "10s" will do ten searches). Commands for -which counts make no sense have the count ignored. To can- -cel a count or a prefix, type . The list of com- -mands is rather long, but it can be read at any time during -the game with the "?" command. Here it is for reference, -with a short explanation of each command. - - - - - - - - - - -A Guide to the Dungeons of Doom USD:33-5 - - -? The help command. Asks for a character to give help - on. If you type a "*", it will list all the commands, - otherwise it will explain what the character you typed - does. - -/ This is the "What is that on the screen?" command. A - "/" followed by any character that you see on the - level, will tell you what that character is. For - instance, typing "/@" will tell you that the "@" symbol - represents you, the player. - -h, H, ^H - Move left. You move one space to the left. If you use - upper case "h", you will continue to move left until - you run into something. This works for all movement - commands (e.g. "L" means run in direction "l") If you - use the "control" "h", you will continue moving in the - specified direction until you pass something interest- - ing or run into a wall. You should experiment with - this, since it is a very useful command, but very dif- - ficult to describe. This also works for all movement - commands. - -j Move down. - -k Move up. - -l Move right. - -y Move diagonally up and left. - -u Move diagonally up and right. - -b Move diagonally down and left. - -n Move diagonally down and right. - -t Throw an object. This is a prefix command. When fol- - lowed with a direction it throws an object in the spec- - ified direction. (e.g. type "th" to throw something to - the left.) - -f Fight until someone dies. When followed with a direc- - tion this will force you to fight the creature in that - direction until either you or it bites the big one. - -m Move onto something without picking it up. This will - move you one space in the direction you specify and, if - there is an object there you can pick up, it won't do - it. - -z Zap prefix. Point a staff or wand in a given direction - and fire it. Even non-directional staves must be - - - - - - - - - - -USD:33-6 A Guide to the Dungeons of Doom - - - pointed in some direction to be used. - -^ Identify trap command. If a trap is on your map and - you can't remember what type it is, you can get rogue - to remind you by getting next to it and typing "^" fol- - lowed by the direction that would move you on top of - it. - -s Search for traps and secret doors. Examine each space - immediately adjacent to you for the existence of a trap - or secret door. There is a large chance that even if - there is something there, you won't find it, so you - might have to search a while before you find something. - -> Climb down a staircase to the next level. Not surpris- - ingly, this can only be done if you are standing on - staircase. - -< Climb up a staircase to the level above. This can't be - done without the Amulet of Yendor in your possession. - -. Rest. This is the "do nothing" command. This is good - for waiting and healing. - -, Pick up something. This picks up whatever you are cur- - rently standing on, if you are standing on anything at - all. - -i Inventory. List what you are carrying in your pack. - -I Selective inventory. Tells you what a single item in - your pack is. - -q Quaff one of the potions you are carrying. - -r Read one of the scrolls in your pack. - -e Eat food from your pack. - -w Wield a weapon. Take a weapon out of your pack and - carry it for use in combat, replacing the one you are - currently using (if any). - -W Wear armor. You can only wear one suit of armor at a - time. This takes extra time. - -T Take armor off. You can't remove armor that is cursed. - This takes extra time. - -P Put on a ring. You can wear only two rings at a time - (one on each hand). If you aren't wearing any rings, - this command will ask you which hand you want to wear - it on, otherwise, it will place it on the unused hand. - - - - - - - - - - -A Guide to the Dungeons of Doom USD:33-7 - - - The program assumes that you wield your sword in your - right hand. - -R Remove a ring. If you are only wearing one ring, this - command takes it off. If you are wearing two, it will - ask you which one you wish to remove, - -d Drop an object. Take something out of your pack and - leave it lying on the floor. Only one object can - occupy each space. You cannot drop a cursed object at - all if you are wielding or wearing it. - -c Call an object something. If you have a type of object - in your pack which you wish to remember something - about, you can use the call command to give a name to - that type of object. This is usually used when you - figure out what a potion, scroll, ring, or staff is - after you pick it up, or when you want to remember - which of those swords in your pack you were wielding. - -D Print out which things you've discovered something - about. This command will ask you what type of thing - you are interested in. If you type the character for a - given type of object (e.g. "!" for potion) it will - tell you which kinds of that type of object you've dis- - covered (i.e., figured out what they are). This com- - mand works for potions, scrolls, rings, and staves and - wands. - -o Examine and set options. This command is further - explained in the section on options. - -^R Redraws the screen. Useful if spurious messages or - transmission errors have messed up the display. - -^P Print last message. Useful when a message disappears - before you can read it. This only repeats the last - message that was not a mistyped command so that you - don't loose anything by accidentally typing the wrong - character instead of ^P. - - - Cancel a command, prefix, or count. - -! Escape to a shell for some commands. - -Q Quit. Leave the game. - -S Save the current game in a file. It will ask you - whether you wish to use the default save file. Caveat: - Rogue won't let you start up a copy of a saved game, - and it removes the save file as soon as you start up a - restored game. This is to prevent people from saving a - - - - - - - - - - -USD:33-8 A Guide to the Dungeons of Doom - - - game just before a dangerous position and then restart- - ing it if they die. To restore a saved game, give the - file name as an argument to rogue. As in - % rogue save_file - - To restart from the default save file (see below), run - % rogue -r - -v Prints the program version number. - -) Print the weapon you are currently wielding - -] Print the armor you are currently wearing - -= Print the rings you are currently wearing - -@ Reprint the status line on the message line - -5. Rooms - - Rooms in the dungeons are either lit or dark. If you -walk into a lit room, the entire room will be drawn on the -screen as soon as you enter. If you walk into a dark room, -it will only be displayed as you explore it. Upon leaving a -room, all monsters inside the room are erased from the -screen. In the darkness you can only see one space in all -directions around you. A corridor is always dark. - -6. Fighting - - If you see a monster and you wish to fight it, just -attempt to run into it. Many times a monster you find will -mind its own business unless you attack it. It is often the -case that discretion is the better part of valor. - -7. Objects you can find - - When you find something in the dungeon, it is common to -want to pick the object up. This is accomplished in rogue -by walking over the object (unless you use the "m" prefix, -see above). If you are carrying too many things, the pro- -gram will tell you and it won't pick up the object, other- -wise it will add it to your pack and tell you what you just -picked up. - - Many of the commands that operate on objects must -prompt you to find out which object you want to use. If you -change your mind and don't want to do that command after -all, just type an and the command will be aborted. - - Some objects, like armor and weapons, are easily dif- -ferentiated. Others, like scrolls and potions, are given -labels which vary according to type. During a game, any two - - - - - - - - - - -A Guide to the Dungeons of Doom USD:33-9 - - -of the same kind of object with the same label are the same -type. However, the labels will vary from game to game. - - When you use one of these labeled objects, if its -effect is obvious, rogue will remember what it is for you. -If it's effect isn't extremely obvious you will be asked -what you want to scribble on it so you will recognize it -later, or you can use the "call" command (see above). - -7.1. Weapons - - Some weapons, like arrows, come in bunches, but most -come one at a time. In order to use a weapon, you must -wield it. To fire an arrow out of a bow, you must first -wield the bow, then throw the arrow. You can only wield one -weapon at a time, but you can't change weapons if the one -you are currently wielding is cursed. The commands to use -weapons are "w" (wield) and "t" (throw). - -7.2. Armor - - There are various sorts of armor lying around in the -dungeon. Some of it is enchanted, some is cursed, and some -is just normal. Different armor types have different armor -protection. The higher the armor protection, the more pro- -tection the armor affords against the blows of monsters. -Here is a list of the various armor types and their normal -armor protection: - - - +-----------------------------------------+ - | Type Protection | - |None 0 | - |Leather armor 2 | - |Studded leather / Ring mail 3 | - |Scale mail 4 | - |Chain mail 5 | - |Banded mail / Splint mail 6 | - |Plate mail 7 | - +-----------------------------------------+ - - -If a piece of armor is enchanted, its armor protection will -be higher than normal. If a suit of armor is cursed, its -armor protection will be lower, and you will not be able to -remove it. However, not all armor with a protection that is -lower than normal is cursed. - - The commands to use weapons are "W" (wear) and "T" -(take off). - - - - - - - - - - - - - -USD:33-10 A Guide to the Dungeons of Doom - - -7.3. Scrolls - - Scrolls come with titles in an unknown tongue3. After -you read a scroll, it disappears from your pack. The com- -mand to use a scroll is "r" (read). - -7.4. Potions - - Potions are labeled by the color of the liquid inside -the flask. They disappear after being quaffed. The command -to use a scroll is "q" (quaff). - -7.5. Staves and Wands - - Staves and wands do the same kinds of things. Staves -are identified by a type of wood; wands by a type of metal -or bone. They are generally things you want to do to some- -thing over a long distance, so you must point them at what -you wish to affect to use them. Some staves are not -affected by the direction they are pointed, though. Staves -come with multiple magic charges, the number being random, -and when they are used up, the staff is just a piece of wood -or metal. - - The command to use a wand or staff is "z" (zap) - -7.6. Rings - - Rings are very useful items, since they are relatively -permanent magic, unlike the usually fleeting effects of -potions, scrolls, and staves. Of course, the bad rings are -also more powerful. Most rings also cause you to use up -food more rapidly, the rate varying with the type of ring. -Rings are differentiated by their stone settings. The com- -mands to use rings are "P" (put on) and "R" (remove). - -7.7. Food - - Food is necessary to keep you going. If you go too -long without eating you will faint, and eventually die of -starvation. The command to use food is "e" (eat). - -8. Options - - Due to variations in personal tastes and conceptions of -the way rogue should do things, there are a set of options -you can set that cause rogue to behave in various different -____________________ - 3 Actually, it's a dialect spoken only by the twenty-sev- -en members of a tribe in Outer Mongolia, but you're not sup- -posed to know that. - - - - - - - - - - - - -A Guide to the Dungeons of Doom USD:33-11 - - -ways. - -8.1. Setting the options - - There are two ways to set the options. The first is -with the "o" command of rogue; the second is with the -"ROGUEOPTS" environment variable4. - -8.1.1. Using the `o' command - - When you type "o" in rogue, it clears the screen and -displays the current settings for all the options. It then -places the cursor by the value of the first option and waits -for you to type. You can type a which means to go -to the next option, a "-" which means to go to the previous -option, an which means to return to the game, or -you can give the option a value. For boolean options this -merely involves typing "t" for true or "f" for false. For -string options, type the new value followed by a . - -8.1.2. Using the ROGUEOPTS variable - - The ROGUEOPTS variable is a string containing a comma -separated list of initial values for the various options. -Boolean variables can be turned on by listing their name or -turned off by putting a "no" in front of the name. Thus to -set up an environment variable so that jump is on, terse is -off, and the name is set to "Blue Meanie", use the command - % setenv ROGUEOPTS "jump,noterse,name=Blue Meanie"5 - -8.2. Option list - - Here is a list of the options and an explanation of -what each one is for. The default value for each is -enclosed in square brackets. For character string options, -input over fifty characters will be ignored. - -terse [noterse] - Useful for those who are tired of the sometimes lengthy - messages of rogue. This is a useful option for playing - on slow terminals, so this option defaults to terse if - you are on a slow (1200 baud or under) terminal. - - -____________________ - 4 On Version 6 systems, there is no equivalent of the -ROGUEOPTS feature. - 5 For those of you who use the Bourne shell sh (1), the -commands would be - $ ROGUEOPTS="jump,noterse,name=Blue Meanie" - $ export ROGUEOPTS - - - - - - - - - - - - -USD:33-12 A Guide to the Dungeons of Doom - - -jump [nojump] - If this option is set, running moves will not be dis- - played until you reach the end of the move. This saves - considerable cpu and display time. This option - defaults to jump if you are using a slow terminal. - -flush [noflush] - All typeahead is thrown away after each round of bat- - tle. This is useful for those who type far ahead and - then watch in dismay as a Bat kills them. - -seefloor [seefloor] - Display the floor around you on the screen as you move - through dark rooms. Due to the amount of characters - generated, this option defaults to noseefloor if you - are using a slow terminal. - -passgo [nopassgo] - Follow turnings in passageways. If you run in a pas- - sage and you run into stone or a wall, rogue will see - if it can turn to the right or left. If it can only - turn one way, it will turn that way. If it can turn - either or neither, it will stop. This algorithm can - sometimes lead to slightly confusing occurrences which - is why it defaults to nopassgo. - -tombstone [tombstone] - Print out the tombstone at the end if you get killed. - This is nice but slow, so you can turn it off if you - like. - -inven [overwrite] - Inventory type. This can have one of three values: - overwrite, slow, or clear. With overwrite the top - lines of the map are overwritten with the list when - inventory is requested or when "Which item do you wish - to . . .? " questions are answered with a "*". How- - ever, if the list is longer than a screenful, the - screen is cleared. With slow, lists are displayed one - item at a time on the top of the screen, and with - clear, the screen is cleared, the list is displayed, - and then the dungeon level is re-displayed. Due to - speed considerations, clear is the default for termi- - nals without clear-to-end-of-line capabilities. - -name [account name] - This is the name of your character. It is used if you - get on the top ten scorer's list. - -fruit [slime-mold] - This should hold the name of a fruit that you enjoy - eating. It is basically a whimsey that rogue uses in a - couple of places. - - - - - - - - - - -A Guide to the Dungeons of Doom USD:33-13 - - -file [~/rogue.save] - The default file name for saving the game. If your - phone is hung up by accident, rogue will automatically - save the game in this file. The file name may start - with the special character "~" which expands to be your - home directory. - -9. Scoring - - Rogue usually maintains a list of the top scoring peo- -ple or scores on your machine. Depending on how it is set -up, it can post either the top scores or the top players. -In the latter case, each account on the machine can post -only one non-winning score on this list. If you score -higher than someone else on this list, or better your previ- -ous score on the list, you will be inserted in the proper -place under your current name. How many scores are kept can -also be set up by whoever installs it on your machine. - - If you quit the game, you get out with all of your gold -intact. If, however, you get killed in the Dungeons of -Doom, your body is forwarded to your next-of-kin, along with -90% of your gold; ten percent of your gold is kept by the -Dungeons' wizard as a fee6. This should make you consider -whether you want to take one last hit at that monster and -possibly live, or quit and thus stop with whatever you have. -If you quit, you do get all your gold, but if you swing and -live, you might find more. - - If you just want to see what the current top play- -ers/games list is, you can type - % rogue -s - -10. Acknowledgements - - Rogue was originally conceived of by Glenn Wichman and -Michael Toy. Ken Arnold and Michael Toy then smoothed out -the user interface, and added jillions of new features. We -would like to thank Bob Arnold, Michelle Busch, Andy -Hatcher, Kipp Hickman, Mark Horton, Daniel Jensen, Bill Joy, -Joe Kalash, Steve Maurer, Marty McNary, Jan Miller, and -Scott Nelson for their ideas and assistance; and also the -teeming multitudes who graciously ignored work, school, and -social life to play rogue and send us bugs, complaints, sug- -gestions, and just plain flames. And also Mom. - - - -____________________ - 6 The Dungeon's wizard is named Wally the Wonder Badger. -Invocations should be accompanied by a sizable donation. - - - - - - - - diff --git a/src/cc/rogue/rogue.doc.in b/src/cc/rogue/rogue.doc.in deleted file mode 100644 index 3031d0d24..000000000 --- a/src/cc/rogue/rogue.doc.in +++ /dev/null @@ -1,858 +0,0 @@ - - - - - - - - A Guide to the Dungeons of Doom - - - Michael C. Toy - Kenneth C. R. C. Arnold - - - Computer Systems Research Group - Department of Electrical Engineering and Computer Science - University of California - Berkeley, California 94720 - - - - - ABSTRACT - - Rogue is a visual CRT based fantasy game which runs - under the UNIX timesharing system. This paper de- - scribes how to play rogue, and gives a few hints for - those who might otherwise get lost in the Dungeons - of Doom. - - - - -1. Introduction - - You have just finished your years as a student at the -local fighter's guild. After much practice and sweat you -have finally completed your training and are ready to embark -upon a perilous adventure. As a test of your skills, the -local guildmasters have sent you into the Dungeons of Doom. -Your task is to return with the Amulet of Yendor. Your -reward for the completion of this task will be a full mem- -bership in the local guild. In addition, you are allowed to -keep all the loot you bring back from the dungeons. - - In preparation for your journey, you are given an -enchanted mace, a bow, and a quiver of arrows taken from a -dragon's hoard in the far off Dark Mountains. You are also -outfitted with elf-crafted armor and given enough food to -reach the dungeons. You say goodbye to family and friends -for what may be the last time and head up the road. - - You set out on your way to the dungeons and after sev- -eral days of uneventful travel, you see the ancient ruins -that mark the entrance to the Dungeons of Doom. It is late -at night, so you make camp at the entrance and spend the -____________________ - UNIX is a trademark of Bell Laboratories - - - - - - - - - - - - -USD:33-2 A Guide to the Dungeons of Doom - - -night sleeping under the open skies. In the morning you -gather your weapons, put on your armor, eat what is almost -your last food, and enter the dungeons. - -2. What is going on here? - - You have just begun a game of rogue. Your goal is to -grab as much treasure as you can, find the Amulet of Yendor, -and get out of the Dungeons of Doom alive. On the screen, a -map of where you have been and what you have seen on the -current dungeon level is kept. As you explore more of the -level, it appears on the screen in front of you. - - Rogue differs from most computer fantasy games in that -it is screen oriented. Commands are all one or two -keystrokes1 and the results of your commands are displayed -graphically on the screen rather than being explained in -words.2 - - Another major difference between rogue and other com- -puter fantasy games is that once you have solved all the -puzzles in a standard fantasy game, it has lost most of its -excitement and it ceases to be fun. Rogue, on the other -hand, generates a new dungeon every time you play it and -even the author finds it an entertaining and exciting game. - -3. What do all those things on the screen mean? - - In order to understand what is going on in rogue you -have to first get some grasp of what rogue is doing with the -screen. The rogue screen is intended to replace the "You -can see ..." descriptions of standard fantasy games. Figure -1 is a sample of what a rogue screen might look like. - -3.1. The bottom line - - At the bottom line of the screen are a few pieces of -cryptic information describing your current status. Here is -an explanation of what these things mean: - -Level This number indicates how deep you have gone in the - dungeon. It starts at one and goes up as you go - deeper into the dungeon. - -Gold The number of gold pieces you have managed to find - and keep with you so far. -____________________ - 1 As opposed to pseudo English sentences. - 2 A minimum screen size of 24 lines by 80 columns is re- -quired. If the screen is larger, only the 24x80 section -will be used for the map. - - - - - - - - - - - - -A Guide to the Dungeons of Doom USD:33-3 - - - -____________________________________________________________ - - - ------------ - |..........+ - |..@....]..| - |....B.....| - |..........| - -----+------ - - - -Level: 1 Gold: 0 Hp: 12(12) Str: 16(16) Arm: 4 Exp: 1/0 - - Figure 1 -____________________________________________________________ - - -Hp Your current and maximum health points. Health - points indicate how much damage you can take before - you die. The more you get hit in a fight, the lower - they get. You can regain health points by resting. - The number in parentheses is the maximum number your - health points can reach. - -Str Your current strength and maximum ever strength. - This can be any integer less than or equal to 31, or - greater than or equal to three. The higher the num- - ber, the stronger you are. The number in the paren- - theses is the maximum strength you have attained so - far this game. - -Arm Your current armor protection. This number indicates - how effective your armor is in stopping blows from - unfriendly creatures. The higher this number is, the - more effective the armor. - -Exp These two numbers give your current experience level - and experience points. As you do things, you gain - experience points. At certain experience point - totals, you gain an experience level. The more expe- - rienced you are, the better you are able to fight and - to withstand magical attacks. - -3.2. The top line - - The top line of the screen is reserved for printing -messages that describe things that are impossible to repre- -sent visually. If you see a "--More--" on the top line, -this means that rogue wants to print another message on the -screen, but it wants to make certain that you have read the -one that is there first. To read the next message, just - - - - - - - - - - -USD:33-4 A Guide to the Dungeons of Doom - - -type a space. - -3.3. The rest of the screen - - The rest of the screen is the map of the level as you -have explored it so far. Each symbol on the screen repre- -sents something. Here is a list of what the various symbols -mean: - -@ This symbol represents you, the adventurer. - --| These symbols represent the walls of rooms. - -+ A door to/from a room. - -. The floor of a room. - -# The floor of a passage between rooms. - -* A pile or pot of gold. - -) A weapon of some sort. - -] A piece of armor. - -! A flask containing a magic potion. - -? A piece of paper, usually a magic scroll. - -= A ring with magic properties - -/ A magical staff or wand - -^ A trap, watch out for these. - -% A staircase to other levels - -: A piece of food. - -A-Z The uppercase letters represent the various inhabitants - of the Dungeons of Doom. Watch out, they can be nasty - and vicious. - -4. Commands - - Commands are given to rogue by typing one or two char- -acters. Most commands can be preceded by a count to repeat -them (e.g. typing "10s" will do ten searches). Commands for -which counts make no sense have the count ignored. To can- -cel a count or a prefix, type . The list of com- -mands is rather long, but it can be read at any time during -the game with the "?" command. Here it is for reference, -with a short explanation of each command. - - - - - - - - - - -A Guide to the Dungeons of Doom USD:33-5 - - -? The help command. Asks for a character to give help - on. If you type a "*", it will list all the commands, - otherwise it will explain what the character you typed - does. - -/ This is the "What is that on the screen?" command. A - "/" followed by any character that you see on the - level, will tell you what that character is. For - instance, typing "/@" will tell you that the "@" symbol - represents you, the player. - -h, H, ^H - Move left. You move one space to the left. If you use - upper case "h", you will continue to move left until - you run into something. This works for all movement - commands (e.g. "L" means run in direction "l") If you - use the "control" "h", you will continue moving in the - specified direction until you pass something interest- - ing or run into a wall. You should experiment with - this, since it is a very useful command, but very dif- - ficult to describe. This also works for all movement - commands. - -j Move down. - -k Move up. - -l Move right. - -y Move diagonally up and left. - -u Move diagonally up and right. - -b Move diagonally down and left. - -n Move diagonally down and right. - -t Throw an object. This is a prefix command. When fol- - lowed with a direction it throws an object in the spec- - ified direction. (e.g. type "th" to throw something to - the left.) - -f Fight until someone dies. When followed with a direc- - tion this will force you to fight the creature in that - direction until either you or it bites the big one. - -m Move onto something without picking it up. This will - move you one space in the direction you specify and, if - there is an object there you can pick up, it won't do - it. - -z Zap prefix. Point a staff or wand in a given direction - and fire it. Even non-directional staves must be - - - - - - - - - - -USD:33-6 A Guide to the Dungeons of Doom - - - pointed in some direction to be used. - -^ Identify trap command. If a trap is on your map and - you can't remember what type it is, you can get rogue - to remind you by getting next to it and typing "^" fol- - lowed by the direction that would move you on top of - it. - -s Search for traps and secret doors. Examine each space - immediately adjacent to you for the existence of a trap - or secret door. There is a large chance that even if - there is something there, you won't find it, so you - might have to search a while before you find something. - -> Climb down a staircase to the next level. Not surpris- - ingly, this can only be done if you are standing on - staircase. - -< Climb up a staircase to the level above. This can't be - done without the Amulet of Yendor in your possession. - -. Rest. This is the "do nothing" command. This is good - for waiting and healing. - -, Pick up something. This picks up whatever you are cur- - rently standing on, if you are standing on anything at - all. - -i Inventory. List what you are carrying in your pack. - -I Selective inventory. Tells you what a single item in - your pack is. - -q Quaff one of the potions you are carrying. - -r Read one of the scrolls in your pack. - -e Eat food from your pack. - -w Wield a weapon. Take a weapon out of your pack and - carry it for use in combat, replacing the one you are - currently using (if any). - -W Wear armor. You can only wear one suit of armor at a - time. This takes extra time. - -T Take armor off. You can't remove armor that is cursed. - This takes extra time. - -P Put on a ring. You can wear only two rings at a time - (one on each hand). If you aren't wearing any rings, - this command will ask you which hand you want to wear - it on, otherwise, it will place it on the unused hand. - - - - - - - - - - -A Guide to the Dungeons of Doom USD:33-7 - - - The program assumes that you wield your sword in your - right hand. - -R Remove a ring. If you are only wearing one ring, this - command takes it off. If you are wearing two, it will - ask you which one you wish to remove, - -d Drop an object. Take something out of your pack and - leave it lying on the floor. Only one object can - occupy each space. You cannot drop a cursed object at - all if you are wielding or wearing it. - -c Call an object something. If you have a type of object - in your pack which you wish to remember something - about, you can use the call command to give a name to - that type of object. This is usually used when you - figure out what a potion, scroll, ring, or staff is - after you pick it up, or when you want to remember - which of those swords in your pack you were wielding. - -D Print out which things you've discovered something - about. This command will ask you what type of thing - you are interested in. If you type the character for a - given type of object (e.g. "!" for potion) it will - tell you which kinds of that type of object you've dis- - covered (i.e., figured out what they are). This com- - mand works for potions, scrolls, rings, and staves and - wands. - -o Examine and set options. This command is further - explained in the section on options. - -^R Redraws the screen. Useful if spurious messages or - transmission errors have messed up the display. - -^P Print last message. Useful when a message disappears - before you can read it. This only repeats the last - message that was not a mistyped command so that you - don't loose anything by accidentally typing the wrong - character instead of ^P. - - - Cancel a command, prefix, or count. - -! Escape to a shell for some commands. - -Q Quit. Leave the game. - -S Save the current game in a file. It will ask you - whether you wish to use the default save file. Caveat: - Rogue won't let you start up a copy of a saved game, - and it removes the save file as soon as you start up a - restored game. This is to prevent people from saving a - - - - - - - - - - -USD:33-8 A Guide to the Dungeons of Doom - - - game just before a dangerous position and then restart- - ing it if they die. To restore a saved game, give the - file name as an argument to rogue. As in - % rogue save_file - - To restart from the default save file (see below), run - % rogue -r - -v Prints the program version number. - -) Print the weapon you are currently wielding - -] Print the armor you are currently wearing - -= Print the rings you are currently wearing - -@ Reprint the status line on the message line - -5. Rooms - - Rooms in the dungeons are either lit or dark. If you -walk into a lit room, the entire room will be drawn on the -screen as soon as you enter. If you walk into a dark room, -it will only be displayed as you explore it. Upon leaving a -room, all monsters inside the room are erased from the -screen. In the darkness you can only see one space in all -directions around you. A corridor is always dark. - -6. Fighting - - If you see a monster and you wish to fight it, just -attempt to run into it. Many times a monster you find will -mind its own business unless you attack it. It is often the -case that discretion is the better part of valor. - -7. Objects you can find - - When you find something in the dungeon, it is common to -want to pick the object up. This is accomplished in rogue -by walking over the object (unless you use the "m" prefix, -see above). If you are carrying too many things, the pro- -gram will tell you and it won't pick up the object, other- -wise it will add it to your pack and tell you what you just -picked up. - - Many of the commands that operate on objects must -prompt you to find out which object you want to use. If you -change your mind and don't want to do that command after -all, just type an and the command will be aborted. - - Some objects, like armor and weapons, are easily dif- -ferentiated. Others, like scrolls and potions, are given -labels which vary according to type. During a game, any two - - - - - - - - - - -A Guide to the Dungeons of Doom USD:33-9 - - -of the same kind of object with the same label are the same -type. However, the labels will vary from game to game. - - When you use one of these labeled objects, if its -effect is obvious, rogue will remember what it is for you. -If it's effect isn't extremely obvious you will be asked -what you want to scribble on it so you will recognize it -later, or you can use the "call" command (see above). - -7.1. Weapons - - Some weapons, like arrows, come in bunches, but most -come one at a time. In order to use a weapon, you must -wield it. To fire an arrow out of a bow, you must first -wield the bow, then throw the arrow. You can only wield one -weapon at a time, but you can't change weapons if the one -you are currently wielding is cursed. The commands to use -weapons are "w" (wield) and "t" (throw). - -7.2. Armor - - There are various sorts of armor lying around in the -dungeon. Some of it is enchanted, some is cursed, and some -is just normal. Different armor types have different armor -protection. The higher the armor protection, the more pro- -tection the armor affords against the blows of monsters. -Here is a list of the various armor types and their normal -armor protection: - - - +-----------------------------------------+ - | Type Protection | - |None 0 | - |Leather armor 2 | - |Studded leather / Ring mail 3 | - |Scale mail 4 | - |Chain mail 5 | - |Banded mail / Splint mail 6 | - |Plate mail 7 | - +-----------------------------------------+ - - -If a piece of armor is enchanted, its armor protection will -be higher than normal. If a suit of armor is cursed, its -armor protection will be lower, and you will not be able to -remove it. However, not all armor with a protection that is -lower than normal is cursed. - - The commands to use weapons are "W" (wear) and "T" -(take off). - - - - - - - - - - - - - -USD:33-10 A Guide to the Dungeons of Doom - - -7.3. Scrolls - - Scrolls come with titles in an unknown tongue3. After -you read a scroll, it disappears from your pack. The com- -mand to use a scroll is "r" (read). - -7.4. Potions - - Potions are labeled by the color of the liquid inside -the flask. They disappear after being quaffed. The command -to use a scroll is "q" (quaff). - -7.5. Staves and Wands - - Staves and wands do the same kinds of things. Staves -are identified by a type of wood; wands by a type of metal -or bone. They are generally things you want to do to some- -thing over a long distance, so you must point them at what -you wish to affect to use them. Some staves are not -affected by the direction they are pointed, though. Staves -come with multiple magic charges, the number being random, -and when they are used up, the staff is just a piece of wood -or metal. - - The command to use a wand or staff is "z" (zap) - -7.6. Rings - - Rings are very useful items, since they are relatively -permanent magic, unlike the usually fleeting effects of -potions, scrolls, and staves. Of course, the bad rings are -also more powerful. Most rings also cause you to use up -food more rapidly, the rate varying with the type of ring. -Rings are differentiated by their stone settings. The com- -mands to use rings are "P" (put on) and "R" (remove). - -7.7. Food - - Food is necessary to keep you going. If you go too -long without eating you will faint, and eventually die of -starvation. The command to use food is "e" (eat). - -8. Options - - Due to variations in personal tastes and conceptions of -the way rogue should do things, there are a set of options -you can set that cause rogue to behave in various different -____________________ - 3 Actually, it's a dialect spoken only by the twenty-sev- -en members of a tribe in Outer Mongolia, but you're not sup- -posed to know that. - - - - - - - - - - - - -A Guide to the Dungeons of Doom USD:33-11 - - -ways. - -8.1. Setting the options - - There are two ways to set the options. The first is -with the "o" command of rogue; the second is with the -"ROGUEOPTS" environment variable4. - -8.1.1. Using the `o' command - - When you type "o" in rogue, it clears the screen and -displays the current settings for all the options. It then -places the cursor by the value of the first option and waits -for you to type. You can type a which means to go -to the next option, a "-" which means to go to the previous -option, an which means to return to the game, or -you can give the option a value. For boolean options this -merely involves typing "t" for true or "f" for false. For -string options, type the new value followed by a . - -8.1.2. Using the ROGUEOPTS variable - - The ROGUEOPTS variable is a string containing a comma -separated list of initial values for the various options. -Boolean variables can be turned on by listing their name or -turned off by putting a "no" in front of the name. Thus to -set up an environment variable so that jump is on, terse is -off, and the name is set to "Blue Meanie", use the command - % setenv ROGUEOPTS "jump,noterse,name=Blue Meanie"5 - -8.2. Option list - - Here is a list of the options and an explanation of -what each one is for. The default value for each is -enclosed in square brackets. For character string options, -input over fifty characters will be ignored. - -terse [noterse] - Useful for those who are tired of the sometimes lengthy - messages of rogue. This is a useful option for playing - on slow terminals, so this option defaults to terse if - you are on a slow (1200 baud or under) terminal. - - -____________________ - 4 On Version 6 systems, there is no equivalent of the -ROGUEOPTS feature. - 5 For those of you who use the Bourne shell sh (1), the -commands would be - $ ROGUEOPTS="jump,noterse,name=Blue Meanie" - $ export ROGUEOPTS - - - - - - - - - - - - -USD:33-12 A Guide to the Dungeons of Doom - - -jump [nojump] - If this option is set, running moves will not be dis- - played until you reach the end of the move. This saves - considerable cpu and display time. This option - defaults to jump if you are using a slow terminal. - -flush [noflush] - All typeahead is thrown away after each round of bat- - tle. This is useful for those who type far ahead and - then watch in dismay as a Bat kills them. - -seefloor [seefloor] - Display the floor around you on the screen as you move - through dark rooms. Due to the amount of characters - generated, this option defaults to noseefloor if you - are using a slow terminal. - -passgo [nopassgo] - Follow turnings in passageways. If you run in a pas- - sage and you run into stone or a wall, rogue will see - if it can turn to the right or left. If it can only - turn one way, it will turn that way. If it can turn - either or neither, it will stop. This algorithm can - sometimes lead to slightly confusing occurrences which - is why it defaults to nopassgo. - -tombstone [tombstone] - Print out the tombstone at the end if you get killed. - This is nice but slow, so you can turn it off if you - like. - -inven [overwrite] - Inventory type. This can have one of three values: - overwrite, slow, or clear. With overwrite the top - lines of the map are overwritten with the list when - inventory is requested or when "Which item do you wish - to . . .? " questions are answered with a "*". How- - ever, if the list is longer than a screenful, the - screen is cleared. With slow, lists are displayed one - item at a time on the top of the screen, and with - clear, the screen is cleared, the list is displayed, - and then the dungeon level is re-displayed. Due to - speed considerations, clear is the default for termi- - nals without clear-to-end-of-line capabilities. - -name [account name] - This is the name of your character. It is used if you - get on the top ten scorer's list. - -fruit [slime-mold] - This should hold the name of a fruit that you enjoy - eating. It is basically a whimsey that rogue uses in a - couple of places. - - - - - - - - - - -A Guide to the Dungeons of Doom USD:33-13 - - -file [~/rogue.save] - The default file name for saving the game. If your - phone is hung up by accident, rogue will automatically - save the game in this file. The file name may start - with the special character "~" which expands to be your - home directory. - -9. Scoring - - Rogue usually maintains a list of the top scoring peo- -ple or scores on your machine. Depending on how it is set -up, it can post either the top scores or the top players. -In the latter case, each account on the machine can post -only one non-winning score on this list. If you score -higher than someone else on this list, or better your previ- -ous score on the list, you will be inserted in the proper -place under your current name. How many scores are kept can -also be set up by whoever installs it on your machine. - - If you quit the game, you get out with all of your gold -intact. If, however, you get killed in the Dungeons of -Doom, your body is forwarded to your next-of-kin, along with -90% of your gold; ten percent of your gold is kept by the -Dungeons' wizard as a fee6. This should make you consider -whether you want to take one last hit at that monster and -possibly live, or quit and thus stop with whatever you have. -If you quit, you do get all your gold, but if you swing and -live, you might find more. - - If you just want to see what the current top play- -ers/games list is, you can type - % @PROGRAM@ -s - -10. Acknowledgements - - Rogue was originally conceived of by Glenn Wichman and -Michael Toy. Ken Arnold and Michael Toy then smoothed out -the user interface, and added jillions of new features. We -would like to thank Bob Arnold, Michelle Busch, Andy -Hatcher, Kipp Hickman, Mark Horton, Daniel Jensen, Bill Joy, -Joe Kalash, Steve Maurer, Marty McNary, Jan Miller, and -Scott Nelson for their ideas and assistance; and also the -teeming multitudes who graciously ignored work, school, and -social life to play rogue and send us bugs, complaints, sug- -gestions, and just plain flames. And also Mom. - - - -____________________ - 6 The Dungeon's wizard is named Wally the Wonder Badger. -Invocations should be accompanied by a sizable donation. - - - - - - - - diff --git a/src/cc/rogue/rogue.h b/src/cc/rogue/rogue.h deleted file mode 100644 index 522da8421..000000000 --- a/src/cc/rogue/rogue.h +++ /dev/null @@ -1,863 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * Rogue definitions and variable declarations - * - * @(#)rogue.h 5.42 (Berkeley) 08/06/83 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -#ifndef H_ROGUE_H -#define H_ROGUE_H -#include -#include -#include -#include -#include -#include -#include /* we need va_list */ -#include /* we want wchar_t */ -#include -#include - -#include -#include -#include -#include -#include - -#ifndef BUILD_ROGUE -#include -#else -#include "cursesd.h" -#endif - -#ifdef LINES -#undef LINES -#endif -#ifdef COLS -#undef COLS -#endif - -#define LINES 24 -#define COLS 80 - -#include "extern.h" - - -#undef lines - -#define NOOP(x) (x += 0) -#define CCHAR(x) ( (char) (x & A_CHARTEXT) ) -/* - * Maximum number of different things - */ -#define MAXROOMS 9 -#define MAXTHINGS 9 -#define MAXOBJ 9 -#define MAXPACK 23 -#define MAXTRAPS 10 -#define AMULETLEVEL 26 -#define NUMTHINGS 7 /* number of types of things */ -#define MAXPASS 13 /* upper limit on number of passages */ -#define NUMLINES 24 -#define NUMCOLS 80 -#define STATLINE (NUMLINES - 1) -#define BORE_LEVEL 50 - -/* - * return values for get functions - */ -#define NORM 0 /* normal exit */ -#define QUIT 1 /* quit option setting */ -#define MINUS 2 /* back up one option */ - -/* - * inventory types - */ -#define INV_OVER 0 -#define INV_SLOW 1 -#define INV_CLEAR 2 - -/* - * All the fun defines - */ -#define when break;case -#define otherwise break;default -#define until(expr) while(!(expr)) -#define next(ptr) (*ptr).l_next -#define prev(ptr) (*ptr).l_prev -#define winat(y,x) (moat(y,x) != NULL ? moat(y,x)->t_disguise : chat(y,x)) -#define ce(a,b) ((a).x == (b).x && (a).y == (b).y) -#define hero player.t_pos -#define pstats player.t_stats -#define pack player.t_pack -#define proom player.t_room -#define max_hp player.t_stats.s_maxhp -#define attach(a,b) _attach(&a,b) -#define detach(a,b) _detach(&a,b) -#define free_list(a) _free_list(&a) -#undef max -#define max(a,b) ((a) > (b) ? (a) : (b)) -#define on(thing,flag) ((bool)(((thing).t_flags & (flag)) != 0)) -#define GOLDCALC (rnd(50 + 10 * level) + 2) -#define ISRING(h,r) (cur_ring[h] != NULL && cur_ring[h]->o_which == r) -#define ISWEARING(r) (ISRING(LEFT, r) || ISRING(RIGHT, r)) -#define ISMULT(type) (type == POTION || type == SCROLL || type == FOOD) -#define INDEX(y,x) (&places[((x) << 5) + (y)]) -#define chat(y,x) (places[((x) << 5) + (y)].p_ch) -#define flat(y,x) (places[((x) << 5) + (y)].p_flags) -#define moat(y,x) (places[((x) << 5) + (y)].p_monst) -#define unc(cp) (cp).y, (cp).x -#ifdef MASTER -#define debug if (wizard) msg -#endif - -/* - * things that appear on the screens - */ -#define PASSAGE '#' -#define DOOR '+' -#define FLOOR '.' -#define PLAYER '@' -#define TRAP '^' -#define STAIRS '%' -#define GOLD '*' -#define POTION '!' -#define SCROLL '?' -#define MAGIC '$' -#define FOOD ':' -#define WEAPON ')' -#define ARMOR ']' -#define AMULET ',' -#define RING '=' -#define STICK '/' -#define CALLABLE -1 -#define R_OR_S -2 - -/* - * Various constants - */ -#define BEARTIME spread(3) -#define SLEEPTIME spread(5) -#define HOLDTIME spread(2) -#define WANDERTIME spread(70) -#define BEFORE spread(1) -#define AFTER spread(2) -#define HEALTIME 30 -#define HUHDURATION 20 -#define SEEDURATION 850 -#define HUNGERTIME 1300 -#define MORETIME 150 -#define STOMACHSIZE 2000 -#define STARVETIME 850 -#define ESCAPE 27 -#define LEFT 0 -#define RIGHT 1 -#define BOLT_LENGTH 6 -#define LAMPDIST 3 -#ifdef MASTER -#ifndef PASSWD -#define PASSWD "mTBellIQOsLNA" -#endif -#endif - -/* - * Save against things - */ -#define VS_POISON 00 -#define VS_PARALYZATION 00 -#define VS_DEATH 00 -#define VS_BREATH 02 -#define VS_MAGIC 03 - -/* - * Various flag bits - */ -/* flags for rooms */ -#define ISDARK 0000001 /* room is dark */ -#define ISGONE 0000002 /* room is gone (a corridor) */ -#define ISMAZE 0000004 /* room is gone (a corridor) */ - -/* flags for objects */ -#define ISCURSED 000001 /* object is cursed */ -#define ISKNOW 0000002 /* player knows details about the object */ -#define ISMISL 0000004 /* object is a missile type */ -#define ISMANY 0000010 /* object comes in groups */ -/* ISFOUND 0000020 ...is used for both objects and creatures */ -#define ISPROT 0000040 /* armor is permanently protected */ - -/* flags for creatures */ -#define CANHUH 0000001 /* creature can confuse */ -#define CANSEE 0000002 /* creature can see invisible creatures */ -#define ISBLIND 0000004 /* creature is blind */ -#define ISCANC 0000010 /* creature has special qualities cancelled */ -#define ISLEVIT 0000010 /* hero is levitating */ -#define ISFOUND 0000020 /* creature has been seen (used for objects) */ -#define ISGREED 0000040 /* creature runs to protect gold */ -#define ISHASTE 0000100 /* creature has been hastened */ -#define ISTARGET 000200 /* creature is the target of an 'f' command */ -#define ISHELD 0000400 /* creature has been held */ -#define ISHUH 0001000 /* creature is confused */ -#define ISINVIS 0002000 /* creature is invisible */ -#define ISMEAN 0004000 /* creature can wake when player enters room */ -#define ISHALU 0004000 /* hero is on acid trip */ -#define ISREGEN 0010000 /* creature can regenerate */ -#define ISRUN 0020000 /* creature is running at the player */ -#define SEEMONST 040000 /* hero can detect unseen monsters */ -#define ISFLY 0040000 /* creature can fly */ -#define ISSLOW 0100000 /* creature has been slowed */ - -/* - * Flags for level map - */ -#define F_PASS 0x80 /* is a passageway */ -#define F_SEEN 0x40 /* have seen this spot before */ -#define F_DROPPED 0x20 /* object was dropped here */ -#define F_LOCKED 0x20 /* door is locked */ -#define F_REAL 0x10 /* what you see is what you get */ -#define F_PNUM 0x0f /* passage number mask */ -#define F_TMASK 0x07 /* trap number mask */ - -/* - * Trap types - */ -#define T_DOOR 00 -#define T_ARROW 01 -#define T_SLEEP 02 -#define T_BEAR 03 -#define T_TELEP 04 -#define T_DART 05 -#define T_RUST 06 -#define T_MYST 07 -#define NTRAPS 8 - -/* - * Potion types - */ -#define P_CONFUSE 0 -#define P_LSD 1 -#define P_POISON 2 -#define P_STRENGTH 3 -#define P_SEEINVIS 4 -#define P_HEALING 5 -#define P_MFIND 6 -#define P_TFIND 7 -#define P_RAISE 8 -#define P_XHEAL 9 -#define P_HASTE 10 -#define P_RESTORE 11 -#define P_BLIND 12 -#define P_LEVIT 13 -#define MAXPOTIONS 14 - -/* - * Scroll types - */ -#define S_CONFUSE 0 -#define S_MAP 1 -#define S_HOLD 2 -#define S_SLEEP 3 -#define S_ARMOR 4 -#define S_ID_POTION 5 -#define S_ID_SCROLL 6 -#define S_ID_WEAPON 7 -#define S_ID_ARMOR 8 -#define S_ID_R_OR_S 9 -#define S_SCARE 10 -#define S_FDET 11 -#define S_TELEP 12 -#define S_ENCH 13 -#define S_CREATE 14 -#define S_REMOVE 15 -#define S_AGGR 16 -#define S_PROTECT 17 -#define MAXSCROLLS 18 - -/* - * Weapon types - */ -#define MACE 0 -#define SWORD 1 -#define BOW 2 -#define ARROW 3 -#define DAGGER 4 -#define TWOSWORD 5 -#define DART 6 -#define SHIRAKEN 7 -#define SPEAR 8 -#define FLAME 9 /* fake entry for dragon breath (ick) */ -#define MAXWEAPONS 9 /* this should equal FLAME */ - -/* - * Armor types - */ -#define LEATHER 0 -#define RING_MAIL 1 -#define STUDDED_LEATHER 2 -#define SCALE_MAIL 3 -#define CHAIN_MAIL 4 -#define SPLINT_MAIL 5 -#define BANDED_MAIL 6 -#define PLATE_MAIL 7 -#define MAXARMORS 8 - -/* - * Ring types - */ -#define R_PROTECT 0 -#define R_ADDSTR 1 -#define R_SUSTSTR 2 -#define R_SEARCH 3 -#define R_SEEINVIS 4 -#define R_NOP 5 -#define R_AGGR 6 -#define R_ADDHIT 7 -#define R_ADDDAM 8 -#define R_REGEN 9 -#define R_DIGEST 10 -#define R_TELEPORT 11 -#define R_STEALTH 12 -#define R_SUSTARM 13 -#define MAXRINGS 14 - -/* - * Rod/Wand/Staff types - */ -#define WS_LIGHT 0 -#define WS_INVIS 1 -#define WS_ELECT 2 -#define WS_FIRE 3 -#define WS_COLD 4 -#define WS_POLYMORPH 5 -#define WS_MISSILE 6 -#define WS_HASTE_M 7 -#define WS_SLOW_M 8 -#define WS_DRAIN 9 -#define WS_NOP 10 -#define WS_TELAWAY 11 -#define WS_TELTO 12 -#define WS_CANCEL 13 -#define MAXSTICKS 14 - -/* - * Now we define the structures and types - */ - -#define SMALLVAL 0.000000000000001 -#define SATOSHIDEN ((uint64_t)100000000L) -#define dstr(x) ((double)(x) / SATOSHIDEN) - -#ifndef _BITS256 -#define _BITS256 -union _bits256 { uint8_t bytes[32]; uint16_t ushorts[16]; uint32_t uints[8]; uint64_t ulongs[4]; uint64_t txid; }; -typedef union _bits256 bits256; -#endif - -#include "rogue_player.h" // interface to rpc - -struct rogue_state -{ - uint64_t seed; - char *keystrokes,*keystrokeshex; - uint32_t needflush,replaydone; - int32_t numkeys,ind,num,guiflag,counter,sleeptime,playersize,restoring,lastnum; - FILE *logfp; - struct rogue_player P; - char buffered[10000]; - uint8_t playerdata[10000]; -}; -extern struct rogue_state globalR; - -int rogue(int argc, char **argv, char **envp); -void rogueiterate(struct rogue_state *rs); -int32_t roguefname(char *fname,uint64_t seed,int32_t counter); -int32_t flushkeystrokes(struct rogue_state *rs,int32_t waitflag); -int32_t rogue_restorepack(struct rogue_state *rs); -void restore_player(struct rogue_state *rs); -int32_t rogue_replay2(uint8_t *newdata,uint64_t seed,char *keystrokes,int32_t num,struct rogue_player *player,int32_t sleepmillis); -void rogue_bailout(struct rogue_state *rs); -int32_t rogue_progress(struct rogue_state *rs,int32_t waitflag,uint64_t seed,char *keystrokes,int32_t num); -int32_t rogue_setplayerdata(struct rogue_state *rs,char *gametxidstr); - -#define ROGUE_MAXTOTAL (pstats.s_str*2) - -/* - * Help list - */ -struct h_list { - char h_ch; - char *h_desc; - bool h_print; -}; - -/* - * Coordinate data type - */ -typedef struct { - int x; - int y; -} coord; - -typedef unsigned int str_t; - -/* - * Stuff about objects - */ -struct obj_info { - char *oi_name; - int oi_prob; - int oi_worth; - char *oi_guess; - bool oi_know; -}; - -/* - * Room structure - */ -struct room { - coord r_pos; /* Upper left corner */ - coord r_max; /* Size of room */ - coord r_gold; /* Where the gold is */ - int r_goldval; /* How much the gold is worth */ - short r_flags; /* info about the room */ - int r_nexits; /* Number of exits */ - coord r_exit[12]; /* Where the exits are */ -}; - -/* - * Structure describing a fighting being - */ -struct stats { - str_t s_str; /* Strength */ - int s_exp; /* Experience */ - int s_lvl; /* level of mastery */ - int s_arm; /* Armor class */ - int s_hpt; /* Hit points */ - char s_dmg[13]; /* String describing damage done */ - int s_maxhp; /* Max hit points */ -}; - -/* - * Structure for monsters and player - */ -union thing { - struct { - union thing *_l_next, *_l_prev; /* Next pointer in link */ - coord _t_pos; /* Position */ - bool _t_turn; /* If slowed, is it a turn to move */ - char _t_type; /* What it is */ - char _t_disguise; /* What mimic looks like */ - char _t_oldch; /* Character that was where it was */ - coord *_t_dest; /* Where it is running to */ - short _t_flags; /* State word */ - struct stats _t_stats; /* Physical description */ - struct room *_t_room; /* Current room for thing */ - union thing *_t_pack; /* What the thing is carrying */ - int _t_reserved; - } _t; - struct { - union thing *_l_next, *_l_prev; /* Next pointer in link */ - int _o_type; /* What kind of object it is */ - coord _o_pos; /* Where it lives on the screen */ - char *_o_text; /* What it says if you read it */ - int _o_launch; /* What you need to launch it */ - char _o_packch; /* What character it is in the pack */ - char _o_damage[8]; /* Damage if used like sword */ - char _o_hurldmg[8]; /* Damage if thrown */ - int _o_count; /* count for plural objects */ - int _o_which; /* Which object of a type it is */ - int _o_hplus; /* Plusses to hit */ - int _o_dplus; /* Plusses to damage */ - int _o_arm; /* Armor protection */ - int _o_flags; /* information about objects */ - int _o_group; /* group number for this object */ - char *_o_label; /* Label for object */ - } _o; -}; - -typedef union thing THING; - -#define l_next _t._l_next -#define l_prev _t._l_prev -#define t_pos _t._t_pos -#define t_turn _t._t_turn -#define t_type _t._t_type -#define t_disguise _t._t_disguise -#define t_oldch _t._t_oldch -#define t_dest _t._t_dest -#define t_flags _t._t_flags -#define t_stats _t._t_stats -#define t_pack _t._t_pack -#define t_room _t._t_room -#define t_reserved _t._t_reserved -#define o_type _o._o_type -#define o_pos _o._o_pos -#define o_text _o._o_text -#define o_launch _o._o_launch -#define o_packch _o._o_packch -#define o_damage _o._o_damage -#define o_hurldmg _o._o_hurldmg -#define o_count _o._o_count -#define o_which _o._o_which -#define o_hplus _o._o_hplus -#define o_dplus _o._o_dplus -#define o_arm _o._o_arm -#define o_charges o_arm -#define o_goldval o_arm -#define o_flags _o._o_flags -#define o_group _o._o_group -#define o_label _o._o_label - -/* - * describe a place on the level map - */ -typedef struct { - char p_ch; - char p_flags; - THING *p_monst; -} PLACE; - -/* - * Array containing information on all the various types of monsters - */ -struct monster { - char *m_name; /* What to call the monster */ - int m_carry; /* Probability of carrying something */ - short m_flags; /* things about the monster */ - struct stats m_stats; /* Initial stats */ -}; - -/* - * External variables - */ -extern const char *tr_name[],*inv_t_name[]; -extern const int32_t a_class[], e_levels[]; -extern const struct h_list helpstr[]; -extern const char *h_names[],*m_names[]; - - -extern const struct monster origmonsters[26]; -extern const struct room origpassages[MAXPASS]; -extern const struct obj_info origthings[NUMTHINGS],origring_info[MAXRINGS],origpot_info[MAXPOTIONS],origarm_info[MAXARMORS],origscr_info[MAXSCROLLS],origws_info[MAXSTICKS],origweap_info[MAXWEAPONS + 1]; -extern struct monster monsters[26]; -extern struct room passages[MAXPASS]; -extern struct obj_info things[NUMTHINGS],ring_info[MAXRINGS],pot_info[MAXPOTIONS],arm_info[MAXARMORS],scr_info[MAXSCROLLS],weap_info[MAXWEAPONS + 1],ws_info[MAXSTICKS]; - -extern bool after, again, allscore, amulet, door_stop, fight_flush, - firstmove, has_hit, inv_describe, jump, kamikaze, - lower_msg, move_on, msg_esc, pack_used[], - passgo, playing, q_comm, running, save_msg, see_floor, - seenstairs, stat_msg, terse, to_death, tombstone; - -extern char dir_ch, file_name[], home[], huh[], - l_last_comm, l_last_dir, last_comm, last_dir, *Numname, - outbuf[], *release, *s_names[], runch, take; -extern const char *ws_made[], *r_stones[], *p_colors[], *ws_type[]; - -extern int count, food_left, hungry_state, inpack, - inv_type, lastscore, level, max_hit, max_level, mpos, - n_objs, no_command, no_food, no_move, noscore, ntraps, purse, - quiet, vf_hit; - -extern unsigned int numscores; - -extern uint64_t seed; - -extern WINDOW *hw; - -extern coord delta, oldpos, stairs; - -extern PLACE places[]; - -extern THING *cur_armor, *cur_ring[], *cur_weapon, *l_last_pick, - *last_pick, *lvl_obj, *mlist, player; - - -extern struct room *oldrp, rooms[]; - -extern struct stats max_stats; - - -/* - * Function types - */ -void _attach(THING **list, THING *item); -void _detach(THING **list, THING *item); -void _free_list(THING **ptr); -void addmsg(struct rogue_state *rs,char *fmt, ...); -bool add_haste(struct rogue_state *rs,bool potion); -char add_line(struct rogue_state *rs,char *fmt, char *arg); -void add_pack(struct rogue_state *rs,THING *obj, bool silent); -void add_pass(void); -void add_str(str_t *sp, int amt); -void accnt_maze(int y, int x, int ny, int nx); -void aggravate(struct rogue_state *rs); -int attack(struct rogue_state *rs,THING *mp); -void badcheck(char *name, struct obj_info *info, int bound); -void bounce(struct rogue_state *rs,THING *weap, char *mname, bool noend); -void call(struct rogue_state *rs); -void call_it(struct rogue_state *rs,struct obj_info *info); -bool cansee(struct rogue_state *rs,int y, int x); -int center(char *str); -void chg_str(int amt); -void check_level(struct rogue_state *rs); -void conn(struct rogue_state *rs,int r1, int r2); -void command(struct rogue_state *rs); -void create_obj(struct rogue_state *rs); - -void current(struct rogue_state *rs,THING *cur, char *how, char *where); -void d_level(struct rogue_state *rs); -void death(struct rogue_state *rs,char monst); -char death_monst(void); -void dig(struct rogue_state *rs,int y, int x); -void discard(THING *item); -void discovered(struct rogue_state *rs); -int dist(int y1, int x1, int y2, int x2); -int dist_cp(coord *c1, coord *c2); -int do_chase(struct rogue_state *rs,THING *th); -void do_daemons(struct rogue_state *rs,int flag); -void do_fuses(struct rogue_state *rs,int flag); -void do_maze(struct rogue_state *rs,struct room *rp); -void do_motion(struct rogue_state *rs,THING *obj, int ydelta, int xdelta); -void do_move(struct rogue_state *rs,int dy, int dx); -void do_passages(struct rogue_state *rs); -void do_pot(struct rogue_state *rs,int type, bool knowit); -void do_rooms(struct rogue_state *rs); -void do_run(char ch); -void do_zap(struct rogue_state *rs); -void doadd(struct rogue_state *rs,char *fmt, va_list args); -void door(struct room *rm, coord *cp); -void door_open(struct rogue_state *rs,struct room *rp); -void drain(struct rogue_state *rs); -void draw_room(struct rogue_state *rs,struct room *rp); -void drop(struct rogue_state *rs); -void eat(struct rogue_state *rs); -size_t encread(char *start, size_t size, FILE *inf); -size_t encwrite(char *start, size_t size, FILE *outf); -int endmsg(struct rogue_state *rs); -void enter_room(struct rogue_state *rs,coord *cp); -void erase_lamp(coord *pos, struct room *rp); -int exp_add(THING *tp); -void extinguish(void (*func)(struct rogue_state *rs,int)); -void fall(struct rogue_state *rs,THING *obj, bool pr); -void fire_bolt(struct rogue_state *rs,coord *start, coord *dir, char *name); -char floor_at(void); -void flush_type(void); -int fight(struct rogue_state *rs,coord *mp, THING *weap, bool thrown); -void fix_stick(THING *cur); -void fuse(void (*func)(struct rogue_state *rs,int), int arg, int time, int type); -bool get_dir(struct rogue_state *rs); -int gethand(struct rogue_state *rs); -void give_pack(struct rogue_state *rs,THING *tp); -void help(struct rogue_state *rs); -void hit(struct rogue_state *rs,char *er, char *ee, bool noend); -void horiz(struct room *rp, int starty); -void leave_room(struct rogue_state *rs,coord *cp); -void lengthen(void (*func)(struct rogue_state *rs,int), int xtime); -void look(struct rogue_state *rs,bool wakeup); -int hit_monster(struct rogue_state *rs,int y, int x, THING *obj); -void identify(struct rogue_state *rs); -void illcom(struct rogue_state *rs,int ch); -void init_check(void); -void init_colors(void); -void init_materials(void); -void init_names(void); -void init_player(struct rogue_state *rs); -void init_probs(void); -void init_stones(void); -void init_weapon(THING *weap, int which); -bool inventory(struct rogue_state *rs,THING *list, int type); -void invis_on(void); -void killed(struct rogue_state *rs,THING *tp, bool pr); -void kill_daemon(void (*func)(struct rogue_state *rs,int)); -bool lock_sc(void); -void miss(struct rogue_state *rs,char *er, char *ee, bool noend); -void missile(struct rogue_state *rs,int ydelta, int xdelta); -void money(struct rogue_state *rs,int value); -int move_monst(struct rogue_state *rs,THING *tp); -void move_msg(struct rogue_state *rs,THING *obj); -int msg(struct rogue_state *rs,char *fmt, ...); -void nameit(THING *obj, const char *type, const char *which, struct obj_info *op, char *(*prfunc)(THING *)); -void new_level(struct rogue_state *rs); -void new_monster(struct rogue_state *rs,THING *tp, char type, coord *cp); -void numpass(int y, int x); -void option(struct rogue_state *rs); -void open_score(void); -void parse_opts(char *str); -void passnum(void); -char *pick_color(char *col); -int pick_one(struct rogue_state *rs,struct obj_info *info, int nitems); -void pick_up(struct rogue_state *rs,char ch); -void picky_inven(struct rogue_state *rs); -void pr_spec(struct obj_info *info, int nitems); -void pr_list(void); -void put_bool(void *b); -void put_inv_t(void *ip); -void put_str(void *str); -void put_things(struct rogue_state *rs); -void putpass(coord *cp); -void print_disc(struct rogue_state *rs,char); -void quaff(struct rogue_state *rs); -void raise_level(struct rogue_state *rs); -char randmonster(bool wander); -void read_scroll(struct rogue_state *rs); -void relocate(struct rogue_state *rs,THING *th, coord *new_loc); -void remove_mon(struct rogue_state *rs,coord *mp, THING *tp, bool waskill); -void reset_last(void); -bool restore(struct rogue_state *rs,char *file, char **envp); -int ring_eat(int hand); -void ring_on(struct rogue_state *rs); -void ring_off(struct rogue_state *rs); -int rnd(int range); -int rnd_room(void); -int roll(int number, int sides); -int rs_save_file(struct rogue_state *rs,FILE *savef); -int rs_restore_file(FILE *inf); -void runto(struct rogue_state *rs,coord *runner); -void rust_armor(struct rogue_state *rs,THING *arm); -int save(int which); -void save_file(struct rogue_state *rs,FILE *savef,int32_t guiflag); -void save_game(struct rogue_state *rs); -int save_throw(int which, THING *tp); -void score(struct rogue_state *rs,int amount, int flags, char monst); -void search(struct rogue_state *rs); -void set_know(THING *obj, struct obj_info *info); -void set_oldch(THING *tp, coord *cp); -void setup(void); -void shell(struct rogue_state *rs); -bool show_floor(void); -void show_map(void); -void show_win(struct rogue_state *rs,char *message); -int sign(int nm); -int spread(int nm); -void start_daemon(void (*func)(struct rogue_state *rs,int), int arg, int type); -void start_score(void); -void status(struct rogue_state *rs); -int step_ok(int ch); -void strucpy(char *s1, char *s2, int len); -int swing(int at_lvl, int op_arm, int wplus); -void take_off(struct rogue_state *rs); -void teleport(struct rogue_state *rs); -void total_winner(struct rogue_state *rs); -void thunk(struct rogue_state *rs,THING *weap, char *mname, bool noend); -void treas_room(struct rogue_state *rs); -void turnref(void); -void u_level(struct rogue_state *rs); -void uncurse(THING *obj); -void unlock_sc(void); -void vert(struct room *rp, int startx); -void wait_for(struct rogue_state *rs,int ch); -THING *wake_monster(struct rogue_state *rs,int y, int x); -void wanderer(struct rogue_state *rs); -void waste_time(struct rogue_state *rs); -void wear(struct rogue_state *rs); -void whatis(struct rogue_state *rs,bool insist, int type); -void wield(struct rogue_state *rs); - -bool chase(THING *tp, coord *ee); -bool diag_ok(coord *sp, coord *ep); -bool dropcheck(struct rogue_state *rs,THING *obj); -bool fallpos(coord *pos, coord *newpos); -bool find_floor(struct rogue_state *rs,struct room *rp, coord *cp, int limit, bool monst); -bool is_magic(THING *obj); -bool is_symlink(char *sp); -bool levit_check(struct rogue_state *rs); -bool pack_room(struct rogue_state *rs,bool from_floor, THING *obj); -bool roll_em(THING *thatt, THING *thdef, THING *weap, bool hurl); -bool see_monst(THING *mp); -bool seen_stairs(void); -bool turn_ok(int y, int x); -bool turn_see(struct rogue_state *rs,bool turn_off); -bool is_current(struct rogue_state *rs,THING *obj); -int passwd(void); - -char be_trapped(struct rogue_state *rs,coord *tc); -char floor_ch(void); -char pack_char(void); -char readchar(struct rogue_state *rs); -char rnd_thing(void); - -char *charge_str(THING *obj); -char *choose_str(char *ts, char *ns); -char *inv_name(THING *obj, bool drop); -char *nullstr(THING *ignored); -char *num(int n1, int n2, char type); -char *ring_num(THING *obj); -char *set_mname(THING *tp); -char *vowelstr(char *str); - -int get_bool(struct rogue_state *rs,void *vp, WINDOW *win); -int get_inv_t(struct rogue_state *rs,void *vp, WINDOW *win); -int get_num(struct rogue_state *rs,void *vp, WINDOW *win); -int get_sf(struct rogue_state *rs,void *vp, WINDOW *win); -int get_str(struct rogue_state *rs,void *vopt, WINDOW *win); -int trip_ch(int y, int x, int ch); - -coord *find_dest(struct rogue_state *rs,THING *tp); -coord *rndmove(THING *who); - -THING *find_obj(struct rogue_state *rs,int y, int x); -THING *get_item(struct rogue_state *rs,char *purpose, int type); -THING *leave_pack(struct rogue_state *rs,THING *obj, bool newobj, bool all); -THING *new_item(void); -THING *new_thing(struct rogue_state *rs); -void end_line(struct rogue_state *rs); -int32_t num_packitems(struct rogue_state *rs); -int32_t rogue_total(THING *o); - -void runners(struct rogue_state *rs,int); -void land(struct rogue_state *rs,int); -void visuals(struct rogue_state *rs,int); -void come_down(struct rogue_state *rs,int); -void stomach(struct rogue_state *rs,int); -void nohaste(struct rogue_state *rs,int); -void sight(struct rogue_state *rs,int); -void unconfuse(struct rogue_state *rs,int); -void rollwand(struct rogue_state *rs,int); -void unsee(struct rogue_state *rs,int); -void swander(struct rogue_state *rs,int); -void doctor(struct rogue_state *rs,int); - -void playit(struct rogue_state *rs); - -struct room *roomin(struct rogue_state *rs,coord *cp); -int32_t thing_find(THING *ptr); - -#define MAXDAEMONS 20 - -extern struct delayed_action { - int d_type; - void (*d_func)(struct rogue_state *rs,int); - int d_arg; - int d_time; -} d_list[MAXDAEMONS]; - -typedef struct { - char *st_name; - int st_value; -} STONE; - -extern int total; -extern int between; -extern int group; -extern coord nh; -extern const char *rainbow[]; -extern int cNCOLORS; -extern const STONE stones[]; -extern int cNSTONES; -extern const char *wood[]; -extern int cNWOOD; -extern const char *metal[]; -extern int cNMETAL; - -//extern WINDOW *stdscr,*curscr; - -#endif - diff --git a/src/cc/rogue/rogue.html b/src/cc/rogue/rogue.html deleted file mode 100644 index 00dab46bf..000000000 --- a/src/cc/rogue/rogue.html +++ /dev/null @@ -1,1060 +0,0 @@ - - - - - - - - - - -

A Guide to the Dungeons of Doom

- -

Michael C. Toy
-Kenneth C. R. C. Arnold

- -

Computer Systems Research -Group
-Department of Electrical Engineering and Computer -Science
-University of California
-Berkeley, California 94720

- - -

ABSTRACT

- -
-
-

Rogue is a visual CRT based fantasy game which runs under the - UNIX† timesharing system. This paper describes how - to play rogue, and gives a few hints for those who might otherwise get - lost in the Dungeons of Doom.

-
-
- -

1. Introduction

- -

You have just finished your years as a -student at the local fighter’s guild. After much -practice and sweat you have finally completed your training -and are ready to embark upon a perilous adventure. As a test -of your skills, the local guildmasters have sent you into -the Dungeons of Doom. Your task is to return with the Amulet -of Yendor. Your reward for the completion of this task will -be a full membership in the local guild. In addition, you -are allowed to keep all the loot you bring back from the -dungeons.

- -

In preparation for your journey, you are -given an enchanted mace, a bow, and a quiver of arrows taken -from a dragon’s hoard in the far off Dark Mountains. -You are also outfitted with elf-crafted armor and given -enough food to reach the dungeons. You say goodbye to family -and friends for what may be the last time and head up the -road.

- -

You set out on your way to the dungeons and -after several days of uneventful travel, you see the -ancient ruins that mark the entrance to the Dungeons of -Doom. It is late at night, so you make camp at the entrance -and spend the night sleeping under the open skies. In the -morning you gather your weapons, put on your armor, eat what -is almost your last food, and enter the -dungeons.

- -

2. What is going on here?

-

You have just begun a game of rogue. Your -goal is to grab as much treasure as you can, find the Amulet -of Yendor, and get out of the Dungeons of Doom alive. On the -screen, a map of where you have been and what you have seen -on the current dungeon level is kept. As you explore more of -the level, it appears on the screen in front of -you.

-

Rogue differs from most computer fantasy -games in that it is screen oriented. Commands are all one or -two keystrokes1 and the -results of your commands are displayed graphically on the -screen rather than being explained in words2.

-

Another major difference between rogue and other computer fantasy games is that once you have solved -all the puzzles in a standard fantasy game, it has lost most -of its excitement and it ceases to be fun. Rogue, on the -other hand, generates a new dungeon every time you play it -and even the author finds it an entertaining and exciting -game.

- -

3. What do all those things on the screen mean?

-

In order to understand what is going on in -rogue you have to first get some grasp of what rogue is -doing with the screen. The rogue screen is intended to -replace the “You can see ...” descriptions of -standard fantasy games. Figure 1 is a sample of what a -rogue screen might look like.

- -
- -
-
-____________________________________________________________
-
-
-                        ------------
-                        |..........+
-                        |..@....]..|
-                        |....B.....|
-                        |..........|
-                        -----+------
-
-
-
-Level: 1  Gold: 0      Hp: 12(12)  Str: 16(16)  Arm: 4  Exp: 1/0
-
-                          Figure 1
-____________________________________________________________
-
-
-
-

3.1. The bottom line

-

At the bottom line of the screen are a few -pieces of cryptic information describing your current -status. Here is an explanation of what these things -mean:

- - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Level

-

This number indicates how deep you -have gone in the dungeon. It starts at one and goes up as -you go deeper into the dungeon.

-

Gold

-

The number of gold pieces you have managed to find and keep with you - so far.

-

Hp

-

Your current and maximum health points. -Health points indicate how much damage you can take before -you die. The more you get hit in a fight, the lower they -get. You can regain health points by resting. The number in -parentheses is the maximum number your health points can -reach.

- -
-

Str

- -

Your current strength and maximum ever -strength. This can be any integer less than or equal to 31, -or greater than or equal to three. The higher the num- ber, -the stronger you are. The number in the parentheses is the -maximum strength you have attained so far this -game.

- -
-

Arm

-

Your current armor protection. This -number indicates how effective your armor is in stopping -blows from unfriendly creatures. The higher this number is, -the more effective the armor.

- -
-

Exp

-

These two numbers give your current -experience level and experience points. As you do things, -you gain experience points. At certain experience point -totals, you gain an experience level. The more experienced -you are, the better you are able to fight and to withstand -magical attacks.

- -
- -

 

- -

3.2. The top line

-

The top line of the screen is reserved for -printing messages that describe things that are impossible -to represent visually. If you see a “--More--” -on the top line, this means that rogue wants to print -another message on the screen, but it wants to make certain -that you have read the one that is there first. To read the -next message, just type a space.

- - -

3.3. The rest of the screen

-

The rest of the screen is the map of the -level as you have explored it so far. Each symbol on the -screen repre- sents something. Here is a list of what the -various symbols mean:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

@

-

This symbol represents you, the adventurer.

-

- |

-

These symbols represent the walls of rooms.

-

+

-

A door to/from a room.

-

.

-

The floor of a room.

-

#

-

The floor of a passage between rooms.

-

*

-

A pile or pot of gold.

-

)

-

A weapon of some sort.

-

]

-

A piece of armor.

-

!

-

A flask containing a magic potion.

-

?

-

A piece of paper, usually a magic scroll.

-

=

-

A ring with magic properties

-

/

-

A magical staff or wand

-

^

-

A trap, watch out for these.

-

%

-

A staircase to other levels

-

:

-

A piece of food.

-

A-Z

-

The uppercase letters represent the various - inhabitants of the Dungeons of Doom. Watch out, they can be nasty and - vicious.

- - -

4. Commands

-

Commands are given to rogue by typing one or two characters. -Most commands can be preceded by a count to repeat them (e.g. typing “10s” will -do ten searches). Commands for which counts make no sense have the count -ignored. To cancel a count or a prefix, type <ESCAPE> . The list of commands is -rather long, but it can be read at any time during the game -with the “?” command. Here it is for reference, -with a short explanation of each -command.

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

?

-

The help command. Asks for a character to give help - on. If you type a “*”, it will list all the commands, otherwise it will - explain what the character you typed does.

-

/

-

This is the “What is that on the screen?” command. A - “/” followed by any character that you see on the level, will tell you - what that character is. For instance, typing “/@” will tell you that the - “@” symbol represents you, the player.

-

h, H, ^H

-   -

Move left. You move one space to the left. If you use - upper case “h”, you will continue to move left until you run into - something. This works for all movement commands (e.g. “L” means run in - direction “l”) If you use the “control” “h”, you will continue moving in - the specified direction until you pass something interesting or run into - a wall. You should experiment with this, since it is a very useful - command, but very difficult to describe. This also works for all movement -commands.

-

j

-

Move down.

-

k

-

Move up.

-

l

-

Move right.

-

y

-

Move diagonally up and left.

-

u

-

Move diagonally up and right.

-

b

-

Move diagonally down and left.

-

n

-

Move diagonally down and right.

-

t

-

Throw an object. This is a prefix command. When followed with a - direction it throws an object in the specified direction. (e.g. type -“th” to throw something to the -left.)

-

f

-

Fight until someone dies. When followed with a direction this will force you to fight the creature -in that direction until either you or it bites the big -one.

-

m

-

Move onto something without picking it up. This will move you one - space in the direction you specify and, if there is an object there you - can pick up, it won’t do it.

-

z

-

Zap prefix. Point a staff or wand in a given direction and fire it. - Even non-directional staves must be pointed in some direction to be - used.

-

^

-

Identify trap command. If a trap is on your map and you can’t - remember what type it is, you can get rogue to remind you by getting - next to it and typing “^” followed by the direction that would move -you on top of it.

-

s

-

Search for traps and secret doors. Examine each space immediately - adjacent to you for the existence of a trap or secret door. There is a - large chance that even if there is something there, you won’t find it, - so you might have to search a while before you find something.

-

>

-

Climb down a staircase to the next level. Not surprisingly, this can only be done if you are -standing on staircase.

-

<

-

Climb up a staircase to the level above. This can’t be done without - the Amulet of Yendor -in your possession.

-

.

-

Rest. This is the “do nothing” command. This is good for waiting and - healing.

-

,

-

Pick up something. This picks up whatever you are currently standing on, if you are -standing on anything at all.

-

i

-

Inventory. List what you are carrying in -your pack.

-

I

-

Selective inventory. Tells you what a single item in your pack is.

-

q

-

Quaff one of the potions you are carrying.

-

r

-

Read one of the scrolls in your pack.

-

e

-

Eat food from your pack.

-

w

-

Wield a weapon. Take a weapon out of your pack and carry it for use - in combat, replacing the one you are currently using (if any).

-

W

-

Wear armor. You can only wear one suit of armor at a time. This - takes extra time.

-

T

-

Take armor off. You can’t remove armor that is cursed. This takes - extra time.

-

P

-

Put on a ring. You can wear only two rings at a time (one on each - hand). If you aren’t wearing any rings, this command will ask you which - hand you want to wear it on, otherwise, it will place it on the unused - hand. The program assumes that you wield your sword in your right hand.

-

R

-

Remove a ring. If you are only wearing one ring, this command takes - it off. If you are wearing two, it will ask you which one you wish to - remove,

-

d

-

Drop an object. Take something out of your pack and leave it lying - on the floor. Only one object can occupy each space. You cannot drop a - cursed object at all if you are wielding or wearing it.

-

c

-

Call an object something. If you have a type of object in your pack - which you wish to remember something about, you can use the call command - to give a name to that type of object. This is usually used when you - figure out what a potion, scroll, ring, or staff is after you pick it - up, or when you want to remember which of those swords in your pack you - were wielding.

-

D

-

Print out which things you’ve discovered something about. This - command will ask you what type of thing you are interested in. If you - type the character for a given type of object (e.g. -“!” for potion) it will tell you which kinds of -that type of object you’ve discovered (i.e., figured out what they - are). This command works for -potions, scrolls, rings, and staves and -wands.

-

o

-

Examine and set options. This command is further explained in the - section on options.

-

^R

-

Redraws the screen. Useful if spurious messages or transmission - errors have messed up the display.

-

^P

-

Print last message. Useful when a message disappears before you can - read it. This only repeats the last message that was not a mistyped - command so that you don’t loose anything by accidentally typing the - wrong character instead of ^P.

-

<ESCAPE>

-   - Cancel a command, prefix, or count.
-

!

-

Escape to a shell for some commands.

-

Q

-

Quit. Leave the game.

-

S

-

Save the current game in a file. It will ask you whether you wish to - use the default save file. -Caveat: Rogue won’t let you start up a copy of -a saved game, and it removes the save file as soon as you -start up a restored game. This is to prevent people from -saving a game just before a dangerous position and then -restart- ing it if they die. To restore a saved game, give -the file name as an argument to rogue. As -in

-

% rogue -save_file

-

To restart from the default save file (see below), run

-

% rogue -r

-

v

-

Prints the program version number.

-

)

-

Print the weapon you are currently wielding

-

]

-

Print the armor you are currently wearing

-

=

-

Print the rings you are currently wearing

-

@

-

Reprint the status line on the message line

- -
- -

5. Rooms

-

Rooms in the dungeons are either lit or -dark. If you walk into a lit room, the entire room will be -drawn on the screen as soon as you enter. If you walk into a -dark room, it will only be displayed as you explore it. Upon -leaving a room, all monsters inside the room are erased from -the screen. In the darkness you can only see one space in -all directions around you. A corridor is always -dark.

- -

6. Fighting

-

If you see a monster and you wish to fight -it, just attempt to run into it. Many times a monster you -find will mind its own business unless you attack it. It is -often the case that discretion is the better part of -valor.

- -

7. Objects you can find

-

When you find something in the dungeon, it -is common to want to pick the object up. This is -accomplished in rogue by walking over the object (unless you -use the “m” prefix, see above). If you are -carrying too many things, the pro- gram will tell you and it -won’t pick up the object, other- wise it will add it -to your pack and tell you what you just picked -up.

- -

Many of the commands that operate on -objects must prompt you to find out which object you want to -use. If you change your mind and don’t want to do that -command after all, just type an -<ESCAPE> and the command will be -aborted.

- -

Some objects, like armor and weapons, are -easily dif- ferentiated. Others, like scrolls and potions, -are given labels which vary according to type. During a -game, any two of the same kind of object with the same label -are the same type. However, the labels will vary from game -to game.

- -

When you use one of these labeled objects, -if its effect is obvious, rogue will remember what it is for -you. If it’s effect isn’t extremely obvious you -will be asked what you want to scribble on it so you will -recognize it later, or you can use the “call” -command (see above).

- -

7.1. Weapons

-

Some weapons, like arrows, come in bunches, -but most come one at a time. In order to use a weapon, you -must wield it. To fire an arrow out of a bow, you must first -wield the bow, then throw the arrow. You can only wield one -weapon at a time, but you can’t change weapons if the -one you are currently wielding is cursed. The commands to -use weapons are “w” (wield) and “t” -(throw).

- -

7.2. Armor

- -

There are various sorts of armor lying around in the dungeon. Some of it is -enchanted, some is cursed, and some is just normal. Different armor types have -different armor protection. The higher the armor protection, the more protection the armor affords against the blows of -monsters. Here is a list of the various armor types and -their normal armor protection:

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TypeProtection
None0
Leather armor2
Studded leather / Ring mail3
Scale mail 4
Chain mail  5
Banded mail / Splint mail6
Plate mail     7
-

 

-

-If a piece of armor is enchanted, its -armor protection will be higher than normal. If a suit of -armor is cursed, its armor protection will be lower, and you -will not be able to remove it. However, not all armor with a -protection that is lower than normal is -cursed. - -

- -

The commands to use weapons are -“W” (wear) and “T” (take -off).

- -

- -7.3. Scrolls

-

Scrolls come with titles in an unknown tongue3. After you read a scroll, it -disappears from your pack. The com mand to use a -scroll is “r” (read).

- -

- -7.4. Potions - -

- -

Potions are labeled by the color of the -liquid inside the flask. They disappear after being quaffed. -The command to use a scroll is “q” -(quaff).

- -

7.5. Staves and Wands

-

Staves and wands do the same kinds of -things. Staves are identified by a type of wood; wands by a -type of metal or bone. They are generally things you want to -do to some- thing over a long distance, so you must point -them at what you wish to affect to use them. Some staves are -not affected by the direction they are pointed, though. -Staves come with multiple magic charges, the number being -random, and when they are used up, the staff is just a piece -of wood or metal.

- -

The command to use a wand or staff is -“z” (zap)

- -

7.6. Rings

- -

Rings are very useful items, since they are -relatively permanent magic, unlike the usually fleeting -effects of potions, scrolls, and staves. Of course, the bad -rings are also more powerful. Most rings also cause you to -use up food more rapidly, the rate varying with the type of -ring. Rings are differentiated by their stone settings. The -com- mands to use rings are “P” (put on) and -“R” (remove).

- -

7.7. Food

- -

Food is necessary to keep you going. If you -go too long without eating you will faint, and eventually -die of starvation. The command to use food is -“e” (eat).

- -

8. Options

-

Due to variations in personal tastes and -conceptions of the way rogue should do things, there are a -set of options you can set that cause rogue to behave in -various different ways.

- -

8.1 Setting the options

- -

There are two ways to set the options. The -first is with the “o” command of rogue; the -second is with the “ROGUEOPTS” environment -variable.

- -

8.1.1. Using the ‘o’ command

- -

When you type “o” in rogue, it -clears the screen and displays the current settings for all -the options. It then places the cursor by the value of the -first option and waits for you to type. You can type a -<RETURN> which means to go to the next -option, a “−” which means to go to the -previous option, an <ESCAPE> which -means to return to the game, or you can give the option a -value. For boolean options this merely involves typing -“t” for true or “f” for false. For -string options, type the new value followed by a -<RETURN> .

- -

8.1.2. Using the ROGUEOPTS variable

- -

The ROGUEOPTS variable is a string -containing a comma separated list of initial values for the -various options. Boolean variables can be turned on by -listing their name or turned off by putting a -“no” in front of the name. Thus to set up an -environment variable so that jump is on, terse -is off, and the name is set to “Blue -Meanie”, use the command

- -

% setenv ROGUEOPTS -"jump,noterse,name=Blue Meanie"4

- -

8.2. Option list

- -

Here is a list of the options and an -explanation of what each one is for. The default value for -each is enclosed in square brackets. For character string -options, input over fifty characters will be -ignored.

- -

terse -[noterse]

-
-

- Useful for those who are tired of the -sometimes lengthy messages of rogue. This is a useful option -for playing on slow terminals, so this option defaults to -terse if you are on a slow (1200 baud or under) -terminal.

-
- -

jump -[nojump]

-
-

If this option is set, running moves will -not be displayed until you reach the end of the move. This -saves considerable cpu and display time. This option -defaults to jump if you are using a slow -terminal.

-
-

flush -[noflush]

-
-

All typeahead is thrown away after each round of battle. This is useful for those who type far -ahead and then watch in dismay as a Bat kills -them.

-
-

seefloor -[seefloor]

-
-

Display the floor around you on the screen -as you move through dark rooms. Due to the amount of -characters generated, this option defaults to -noseefloor if you are using a slow -terminal.

-
-

passgo -[nopassgo]

-
-

Follow turnings in passageways. If you run -in a pas- sage and you run into stone or a wall, rogue will -see if it can turn to the right or left. If it can only turn -one way, it will turn that way. If it can turn either or -neither, it will stop. This algorithm can sometimes lead to -slightly confusing occurrences which is why it defaults to -nopassgo.

-
-

tombstone -[tombstone]

-
-

Print out the tombstone at the end if you -get killed. This is nice but slow, so you can turn it off if -you like.

-
-

inven -[overwrite]

-
-

Inventory type. This can have one of three -values: overwrite, slow, or clear. With -overwrite the top lines of the map are overwritten -with the list when inventory is requested or when -“Which item do you wish to . . .? ” -questions are answered with a “*”. How- ever, if -the list is longer than a screenful, the screen is cleared. -With slow, lists are displayed one item at a time on -the top of the screen, and with clear, the screen is -cleared, the list is displayed, and then the dungeon level -is re-displayed. Due to speed considerations, clear -is the default for terminals without clear-to-end-of-line -capabilities.

-
-

name [account -name]

-
-

This is the name of your character. It is -used if you get on the top ten scorer’s -list.

-
-

fruit -[slime-mold]

-
-

This should hold the name of a fruit that -you enjoy eating. It is basically a whimsy that rogue uses -in a couple of places.

-
-

file -[~/rogue.save]

-
-

The default file name for saving the game. -If your phone is hung up by accident, rogue will -automatically save the game in this file. The file name may -start with the special character “~” which -expands to be your home directory.

-
-

9. Scoring

- -

Rogue usually maintains a list of the top -scoring people or scores on your machine. Depending on how -it is set up, it can post either the top scores or the top -players. In the latter case, each account on the machine can -post only one non-winning score on this list. If you score -higher than someone else on this list, or better your previous score on the list, you will be inserted in the proper -place under your current name. How many scores are kept can -also be set up by whoever installs it on your -machine.

- -

If you quit the game, you get out with all -of your gold intact. If, however, you get killed in the -Dungeons of Doom, your body is forwarded to your -next-of-kin, along with 90% of your gold; ten percent of -your gold is kept by the Dungeons’ wizard as a fee5. This should make you -consider whether you want to take one last hit at that -monster and possibly live, or quit and thus stop with -whatever you have. If you quit, you do get all your gold, -but if you swing and live, you might find -more.

- -

If you just want to see what the current top players/games list is, you can -type

-

% rogue −s

- -

10. Acknowledgements

- -

Rogue was originally conceived of by Glenn -Wichman and Michael Toy. Ken Arnold and Michael Toy then -smoothed out the user interface, and added jillions of new -features. We would like to thank Bob Arnold, Michelle Busch, -Andy Hatcher, Kipp Hickman, Mark Horton, Daniel Jensen, Bill -Joy, Joe Kalash, Steve Maurer, Marty McNary, Jan Miller, and -Scott Nelson for their ideas and assistance; and also the -teeming multitudes who graciously ignored work, school, and -social life to play rogue and send us bugs, complaints, suggestions, and just plain flames. And also -Mom.

- - - - - - - - - - - - - - - - - - - - - - - - - -
UNIX is a registered trademark of The Open Group
1As opposed to pseudo English sentences.
2A minimum screen size of 24 lines by 80 columns is required. If the - screen is larger, only the 24x80 section -will be used for the map.
3Actually, it's a dialect spoken only by the twenty-seven members of - a tribe in Outer Mongolia, but you're not supposed to know that.
4For those of you who use the Bourne shell sh (1), the commands would be

$ ROGUEOPTS="jump,noterse,name=Blue Meanie"
-$ export ROGUEOPTS

5The Dungeon's wizard is named Wally the Wonder Badger. Invocations - should be accompanied by a sizable donation.
- - diff --git a/src/cc/rogue/rogue.html.in b/src/cc/rogue/rogue.html.in deleted file mode 100644 index 260cb7a4d..000000000 --- a/src/cc/rogue/rogue.html.in +++ /dev/null @@ -1,1060 +0,0 @@ - - - - - - - - - - -

A Guide to the Dungeons of Doom

- -

Michael C. Toy
-Kenneth C. R. C. Arnold

- -

Computer Systems Research -Group
-Department of Electrical Engineering and Computer -Science
-University of California
-Berkeley, California 94720

- - -

ABSTRACT

- -
-
-

Rogue is a visual CRT based fantasy game which runs under the - UNIX† timesharing system. This paper describes how - to play rogue, and gives a few hints for those who might otherwise get - lost in the Dungeons of Doom.

-
-
- -

1. Introduction

- -

You have just finished your years as a -student at the local fighter’s guild. After much -practice and sweat you have finally completed your training -and are ready to embark upon a perilous adventure. As a test -of your skills, the local guildmasters have sent you into -the Dungeons of Doom. Your task is to return with the Amulet -of Yendor. Your reward for the completion of this task will -be a full membership in the local guild. In addition, you -are allowed to keep all the loot you bring back from the -dungeons.

- -

In preparation for your journey, you are -given an enchanted mace, a bow, and a quiver of arrows taken -from a dragon’s hoard in the far off Dark Mountains. -You are also outfitted with elf-crafted armor and given -enough food to reach the dungeons. You say goodbye to family -and friends for what may be the last time and head up the -road.

- -

You set out on your way to the dungeons and -after several days of uneventful travel, you see the -ancient ruins that mark the entrance to the Dungeons of -Doom. It is late at night, so you make camp at the entrance -and spend the night sleeping under the open skies. In the -morning you gather your weapons, put on your armor, eat what -is almost your last food, and enter the -dungeons.

- -

2. What is going on here?

-

You have just begun a game of rogue. Your -goal is to grab as much treasure as you can, find the Amulet -of Yendor, and get out of the Dungeons of Doom alive. On the -screen, a map of where you have been and what you have seen -on the current dungeon level is kept. As you explore more of -the level, it appears on the screen in front of -you.

-

Rogue differs from most computer fantasy -games in that it is screen oriented. Commands are all one or -two keystrokes1 and the -results of your commands are displayed graphically on the -screen rather than being explained in words2.

-

Another major difference between rogue and other computer fantasy games is that once you have solved -all the puzzles in a standard fantasy game, it has lost most -of its excitement and it ceases to be fun. Rogue, on the -other hand, generates a new dungeon every time you play it -and even the author finds it an entertaining and exciting -game.

- -

3. What do all those things on the screen mean?

-

In order to understand what is going on in -rogue you have to first get some grasp of what rogue is -doing with the screen. The rogue screen is intended to -replace the “You can see ...” descriptions of -standard fantasy games. Figure 1 is a sample of what a -rogue screen might look like.

- -
- -
-
-____________________________________________________________
-
-
-                        ------------
-                        |..........+
-                        |..@....]..|
-                        |....B.....|
-                        |..........|
-                        -----+------
-
-
-
-Level: 1  Gold: 0      Hp: 12(12)  Str: 16(16)  Arm: 4  Exp: 1/0
-
-                          Figure 1
-____________________________________________________________
-
-
-
-

3.1. The bottom line

-

At the bottom line of the screen are a few -pieces of cryptic information describing your current -status. Here is an explanation of what these things -mean:

- - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Level

-

This number indicates how deep you -have gone in the dungeon. It starts at one and goes up as -you go deeper into the dungeon.

-

Gold

-

The number of gold pieces you have managed to find and keep with you - so far.

-

Hp

-

Your current and maximum health points. -Health points indicate how much damage you can take before -you die. The more you get hit in a fight, the lower they -get. You can regain health points by resting. The number in -parentheses is the maximum number your health points can -reach.

- -
-

Str

- -

Your current strength and maximum ever -strength. This can be any integer less than or equal to 31, -or greater than or equal to three. The higher the num- ber, -the stronger you are. The number in the parentheses is the -maximum strength you have attained so far this -game.

- -
-

Arm

-

Your current armor protection. This -number indicates how effective your armor is in stopping -blows from unfriendly creatures. The higher this number is, -the more effective the armor.

- -
-

Exp

-

These two numbers give your current -experience level and experience points. As you do things, -you gain experience points. At certain experience point -totals, you gain an experience level. The more experienced -you are, the better you are able to fight and to withstand -magical attacks.

- -
- -

 

- -

3.2. The top line

-

The top line of the screen is reserved for -printing messages that describe things that are impossible -to represent visually. If you see a “--More--” -on the top line, this means that rogue wants to print -another message on the screen, but it wants to make certain -that you have read the one that is there first. To read the -next message, just type a space.

- - -

3.3. The rest of the screen

-

The rest of the screen is the map of the -level as you have explored it so far. Each symbol on the -screen repre- sents something. Here is a list of what the -various symbols mean:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

@

-

This symbol represents you, the adventurer.

-

- |

-

These symbols represent the walls of rooms.

-

+

-

A door to/from a room.

-

.

-

The floor of a room.

-

#

-

The floor of a passage between rooms.

-

*

-

A pile or pot of gold.

-

)

-

A weapon of some sort.

-

]

-

A piece of armor.

-

!

-

A flask containing a magic potion.

-

?

-

A piece of paper, usually a magic scroll.

-

=

-

A ring with magic properties

-

/

-

A magical staff or wand

-

^

-

A trap, watch out for these.

-

%

-

A staircase to other levels

-

:

-

A piece of food.

-

A-Z

-

The uppercase letters represent the various - inhabitants of the Dungeons of Doom. Watch out, they can be nasty and - vicious.

- - -

4. Commands

-

Commands are given to rogue by typing one or two characters. -Most commands can be preceded by a count to repeat them (e.g. typing “10s” will -do ten searches). Commands for which counts make no sense have the count -ignored. To cancel a count or a prefix, type <ESCAPE> . The list of commands is -rather long, but it can be read at any time during the game -with the “?” command. Here it is for reference, -with a short explanation of each -command.

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

?

-

The help command. Asks for a character to give help - on. If you type a “*”, it will list all the commands, otherwise it will - explain what the character you typed does.

-

/

-

This is the “What is that on the screen?” command. A - “/” followed by any character that you see on the level, will tell you - what that character is. For instance, typing “/@” will tell you that the - “@” symbol represents you, the player.

-

h, H, ^H

-   -

Move left. You move one space to the left. If you use - upper case “h”, you will continue to move left until you run into - something. This works for all movement commands (e.g. “L” means run in - direction “l”) If you use the “control” “h”, you will continue moving in - the specified direction until you pass something interesting or run into - a wall. You should experiment with this, since it is a very useful - command, but very difficult to describe. This also works for all movement -commands.

-

j

-

Move down.

-

k

-

Move up.

-

l

-

Move right.

-

y

-

Move diagonally up and left.

-

u

-

Move diagonally up and right.

-

b

-

Move diagonally down and left.

-

n

-

Move diagonally down and right.

-

t

-

Throw an object. This is a prefix command. When followed with a - direction it throws an object in the specified direction. (e.g. type -“th” to throw something to the -left.)

-

f

-

Fight until someone dies. When followed with a direction this will force you to fight the creature -in that direction until either you or it bites the big -one.

-

m

-

Move onto something without picking it up. This will move you one - space in the direction you specify and, if there is an object there you - can pick up, it won’t do it.

-

z

-

Zap prefix. Point a staff or wand in a given direction and fire it. - Even non-directional staves must be pointed in some direction to be - used.

-

^

-

Identify trap command. If a trap is on your map and you can’t - remember what type it is, you can get rogue to remind you by getting - next to it and typing “^” followed by the direction that would move -you on top of it.

-

s

-

Search for traps and secret doors. Examine each space immediately - adjacent to you for the existence of a trap or secret door. There is a - large chance that even if there is something there, you won’t find it, - so you might have to search a while before you find something.

-

>

-

Climb down a staircase to the next level. Not surprisingly, this can only be done if you are -standing on staircase.

-

<

-

Climb up a staircase to the level above. This can’t be done without - the Amulet of Yendor -in your possession.

-

.

-

Rest. This is the “do nothing” command. This is good for waiting and - healing.

-

,

-

Pick up something. This picks up whatever you are currently standing on, if you are -standing on anything at all.

-

i

-

Inventory. List what you are carrying in -your pack.

-

I

-

Selective inventory. Tells you what a single item in your pack is.

-

q

-

Quaff one of the potions you are carrying.

-

r

-

Read one of the scrolls in your pack.

-

e

-

Eat food from your pack.

-

w

-

Wield a weapon. Take a weapon out of your pack and carry it for use - in combat, replacing the one you are currently using (if any).

-

W

-

Wear armor. You can only wear one suit of armor at a time. This - takes extra time.

-

T

-

Take armor off. You can’t remove armor that is cursed. This takes - extra time.

-

P

-

Put on a ring. You can wear only two rings at a time (one on each - hand). If you aren’t wearing any rings, this command will ask you which - hand you want to wear it on, otherwise, it will place it on the unused - hand. The program assumes that you wield your sword in your right hand.

-

R

-

Remove a ring. If you are only wearing one ring, this command takes - it off. If you are wearing two, it will ask you which one you wish to - remove,

-

d

-

Drop an object. Take something out of your pack and leave it lying - on the floor. Only one object can occupy each space. You cannot drop a - cursed object at all if you are wielding or wearing it.

-

c

-

Call an object something. If you have a type of object in your pack - which you wish to remember something about, you can use the call command - to give a name to that type of object. This is usually used when you - figure out what a potion, scroll, ring, or staff is after you pick it - up, or when you want to remember which of those swords in your pack you - were wielding.

-

D

-

Print out which things you’ve discovered something about. This - command will ask you what type of thing you are interested in. If you - type the character for a given type of object (e.g. -“!” for potion) it will tell you which kinds of -that type of object you’ve discovered (i.e., figured out what they - are). This command works for -potions, scrolls, rings, and staves and -wands.

-

o

-

Examine and set options. This command is further explained in the - section on options.

-

^R

-

Redraws the screen. Useful if spurious messages or transmission - errors have messed up the display.

-

^P

-

Print last message. Useful when a message disappears before you can - read it. This only repeats the last message that was not a mistyped - command so that you don’t loose anything by accidentally typing the - wrong character instead of ^P.

-

<ESCAPE>

-   - Cancel a command, prefix, or count.
-

!

-

Escape to a shell for some commands.

-

Q

-

Quit. Leave the game.

-

S

-

Save the current game in a file. It will ask you whether you wish to - use the default save file. -Caveat: Rogue won’t let you start up a copy of -a saved game, and it removes the save file as soon as you -start up a restored game. This is to prevent people from -saving a game just before a dangerous position and then -restart- ing it if they die. To restore a saved game, give -the file name as an argument to rogue. As -in

-

% rogue -save_file

-

To restart from the default save file (see below), run

-

% rogue -r

-

v

-

Prints the program version number.

-

)

-

Print the weapon you are currently wielding

-

]

-

Print the armor you are currently wearing

-

=

-

Print the rings you are currently wearing

-

@

-

Reprint the status line on the message line

- -
- -

5. Rooms

-

Rooms in the dungeons are either lit or -dark. If you walk into a lit room, the entire room will be -drawn on the screen as soon as you enter. If you walk into a -dark room, it will only be displayed as you explore it. Upon -leaving a room, all monsters inside the room are erased from -the screen. In the darkness you can only see one space in -all directions around you. A corridor is always -dark.

- -

6. Fighting

-

If you see a monster and you wish to fight -it, just attempt to run into it. Many times a monster you -find will mind its own business unless you attack it. It is -often the case that discretion is the better part of -valor.

- -

7. Objects you can find

-

When you find something in the dungeon, it -is common to want to pick the object up. This is -accomplished in rogue by walking over the object (unless you -use the “m” prefix, see above). If you are -carrying too many things, the pro- gram will tell you and it -won’t pick up the object, other- wise it will add it -to your pack and tell you what you just picked -up.

- -

Many of the commands that operate on -objects must prompt you to find out which object you want to -use. If you change your mind and don’t want to do that -command after all, just type an -<ESCAPE> and the command will be -aborted.

- -

Some objects, like armor and weapons, are -easily dif- ferentiated. Others, like scrolls and potions, -are given labels which vary according to type. During a -game, any two of the same kind of object with the same label -are the same type. However, the labels will vary from game -to game.

- -

When you use one of these labeled objects, -if its effect is obvious, rogue will remember what it is for -you. If it’s effect isn’t extremely obvious you -will be asked what you want to scribble on it so you will -recognize it later, or you can use the “call” -command (see above).

- -

7.1. Weapons

-

Some weapons, like arrows, come in bunches, -but most come one at a time. In order to use a weapon, you -must wield it. To fire an arrow out of a bow, you must first -wield the bow, then throw the arrow. You can only wield one -weapon at a time, but you can’t change weapons if the -one you are currently wielding is cursed. The commands to -use weapons are “w” (wield) and “t” -(throw).

- -

7.2. Armor

- -

There are various sorts of armor lying around in the dungeon. Some of it is -enchanted, some is cursed, and some is just normal. Different armor types have -different armor protection. The higher the armor protection, the more protection the armor affords against the blows of -monsters. Here is a list of the various armor types and -their normal armor protection:

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TypeProtection
None0
Leather armor2
Studded leather / Ring mail3
Scale mail 4
Chain mail  5
Banded mail / Splint mail6
Plate mail     7
-

 

-

-If a piece of armor is enchanted, its -armor protection will be higher than normal. If a suit of -armor is cursed, its armor protection will be lower, and you -will not be able to remove it. However, not all armor with a -protection that is lower than normal is -cursed. - -

- -

The commands to use weapons are -“W” (wear) and “T” (take -off).

- -

- -7.3. Scrolls

-

Scrolls come with titles in an unknown tongue3. After you read a scroll, it -disappears from your pack. The com mand to use a -scroll is “r” (read).

- -

- -7.4. Potions - -

- -

Potions are labeled by the color of the -liquid inside the flask. They disappear after being quaffed. -The command to use a scroll is “q” -(quaff).

- -

7.5. Staves and Wands

-

Staves and wands do the same kinds of -things. Staves are identified by a type of wood; wands by a -type of metal or bone. They are generally things you want to -do to some- thing over a long distance, so you must point -them at what you wish to affect to use them. Some staves are -not affected by the direction they are pointed, though. -Staves come with multiple magic charges, the number being -random, and when they are used up, the staff is just a piece -of wood or metal.

- -

The command to use a wand or staff is -“z” (zap)

- -

7.6. Rings

- -

Rings are very useful items, since they are -relatively permanent magic, unlike the usually fleeting -effects of potions, scrolls, and staves. Of course, the bad -rings are also more powerful. Most rings also cause you to -use up food more rapidly, the rate varying with the type of -ring. Rings are differentiated by their stone settings. The -com- mands to use rings are “P” (put on) and -“R” (remove).

- -

7.7. Food

- -

Food is necessary to keep you going. If you -go too long without eating you will faint, and eventually -die of starvation. The command to use food is -“e” (eat).

- -

8. Options

-

Due to variations in personal tastes and -conceptions of the way rogue should do things, there are a -set of options you can set that cause rogue to behave in -various different ways.

- -

8.1 Setting the options

- -

There are two ways to set the options. The -first is with the “o” command of rogue; the -second is with the “ROGUEOPTS” environment -variable.

- -

8.1.1. Using the ‘o’ command

- -

When you type “o” in rogue, it -clears the screen and displays the current settings for all -the options. It then places the cursor by the value of the -first option and waits for you to type. You can type a -<RETURN> which means to go to the next -option, a “−” which means to go to the -previous option, an <ESCAPE> which -means to return to the game, or you can give the option a -value. For boolean options this merely involves typing -“t” for true or “f” for false. For -string options, type the new value followed by a -<RETURN> .

- -

8.1.2. Using the ROGUEOPTS variable

- -

The ROGUEOPTS variable is a string -containing a comma separated list of initial values for the -various options. Boolean variables can be turned on by -listing their name or turned off by putting a -“no” in front of the name. Thus to set up an -environment variable so that jump is on, terse -is off, and the name is set to “Blue -Meanie”, use the command

- -

% setenv ROGUEOPTS -"jump,noterse,name=Blue Meanie"4

- -

8.2. Option list

- -

Here is a list of the options and an -explanation of what each one is for. The default value for -each is enclosed in square brackets. For character string -options, input over fifty characters will be -ignored.

- -

terse -[noterse]

-
-

- Useful for those who are tired of the -sometimes lengthy messages of rogue. This is a useful option -for playing on slow terminals, so this option defaults to -terse if you are on a slow (1200 baud or under) -terminal.

-
- -

jump -[nojump]

-
-

If this option is set, running moves will -not be displayed until you reach the end of the move. This -saves considerable cpu and display time. This option -defaults to jump if you are using a slow -terminal.

-
-

flush -[noflush]

-
-

All typeahead is thrown away after each round of battle. This is useful for those who type far -ahead and then watch in dismay as a Bat kills -them.

-
-

seefloor -[seefloor]

-
-

Display the floor around you on the screen -as you move through dark rooms. Due to the amount of -characters generated, this option defaults to -noseefloor if you are using a slow -terminal.

-
-

passgo -[nopassgo]

-
-

Follow turnings in passageways. If you run -in a pas- sage and you run into stone or a wall, rogue will -see if it can turn to the right or left. If it can only turn -one way, it will turn that way. If it can turn either or -neither, it will stop. This algorithm can sometimes lead to -slightly confusing occurrences which is why it defaults to -nopassgo.

-
-

tombstone -[tombstone]

-
-

Print out the tombstone at the end if you -get killed. This is nice but slow, so you can turn it off if -you like.

-
-

inven -[overwrite]

-
-

Inventory type. This can have one of three -values: overwrite, slow, or clear. With -overwrite the top lines of the map are overwritten -with the list when inventory is requested or when -“Which item do you wish to . . .? ” -questions are answered with a “*”. How- ever, if -the list is longer than a screenful, the screen is cleared. -With slow, lists are displayed one item at a time on -the top of the screen, and with clear, the screen is -cleared, the list is displayed, and then the dungeon level -is re-displayed. Due to speed considerations, clear -is the default for terminals without clear-to-end-of-line -capabilities.

-
-

name [account -name]

-
-

This is the name of your character. It is -used if you get on the top ten scorer’s -list.

-
-

fruit -[slime-mold]

-
-

This should hold the name of a fruit that -you enjoy eating. It is basically a whimsy that rogue uses -in a couple of places.

-
-

file -[~/rogue.save]

-
-

The default file name for saving the game. -If your phone is hung up by accident, rogue will -automatically save the game in this file. The file name may -start with the special character “~” which -expands to be your home directory.

-
-

9. Scoring

- -

Rogue usually maintains a list of the top -scoring people or scores on your machine. Depending on how -it is set up, it can post either the top scores or the top -players. In the latter case, each account on the machine can -post only one non-winning score on this list. If you score -higher than someone else on this list, or better your previous score on the list, you will be inserted in the proper -place under your current name. How many scores are kept can -also be set up by whoever installs it on your -machine.

- -

If you quit the game, you get out with all -of your gold intact. If, however, you get killed in the -Dungeons of Doom, your body is forwarded to your -next-of-kin, along with 90% of your gold; ten percent of -your gold is kept by the Dungeons’ wizard as a fee5. This should make you -consider whether you want to take one last hit at that -monster and possibly live, or quit and thus stop with -whatever you have. If you quit, you do get all your gold, -but if you swing and live, you might find -more.

- -

If you just want to see what the current top players/games list is, you can -type

-

% @PROGRAM@ −s

- -

10. Acknowledgements

- -

Rogue was originally conceived of by Glenn -Wichman and Michael Toy. Ken Arnold and Michael Toy then -smoothed out the user interface, and added jillions of new -features. We would like to thank Bob Arnold, Michelle Busch, -Andy Hatcher, Kipp Hickman, Mark Horton, Daniel Jensen, Bill -Joy, Joe Kalash, Steve Maurer, Marty McNary, Jan Miller, and -Scott Nelson for their ideas and assistance; and also the -teeming multitudes who graciously ignored work, school, and -social life to play rogue and send us bugs, complaints, suggestions, and just plain flames. And also -Mom.

- - - - - - - - - - - - - - - - - - - - - - - - - -
UNIX is a registered trademark of The Open Group
1As opposed to pseudo English sentences.
2A minimum screen size of 24 lines by 80 columns is required. If the - screen is larger, only the 24x80 section -will be used for the map.
3Actually, it's a dialect spoken only by the twenty-seven members of - a tribe in Outer Mongolia, but you're not supposed to know that.
4For those of you who use the Bourne shell sh (1), the commands would be

$ ROGUEOPTS="jump,noterse,name=Blue Meanie"
-$ export ROGUEOPTS

5The Dungeon's wizard is named Wally the Wonder Badger. Invocations - should be accompanied by a sizable donation.
- - diff --git a/src/cc/rogue/rogue.me b/src/cc/rogue/rogue.me deleted file mode 100644 index 1a2568477..000000000 --- a/src/cc/rogue/rogue.me +++ /dev/null @@ -1,892 +0,0 @@ -.\" -.\" @(#)rogue.me 6.2 (Berkeley) 4/28/86 -.\" -.\" Rogue: Exploring the Dungeons of Doom -.\" Copyright (C) 1980-1983, 1985, 1986 Michael Toy, Ken Arnold and Glenn Wichman -.\" All rights reserved. -.\" -.\" See the file LICENSE.TXT for full copyright and licensing information. -.\" -.ds E \s-2\s0 -.ds R \s-2\s0 -.ds U \s-2UNIX\s0 -.ie t .ds _ \d\(mi\u -.el .ds _ _ -.de Cs -\&\\$3\*(lq\\$1\*(rq\\$2 -.. -.sp 5 -.ce 1000 -.ps +4 -.vs +4p -.b -A Guide to the Dungeons of Doom -.r -.vs -.ps -.sp 2 -.i -Michael C. Toy -Kenneth C. R. C. Arnold -.r -.sp 2 -Computer Systems Research Group -Department of Electrical Engineering and Computer Science -University of California -Berkeley, California 94720 -.sp 4 -.i ABSTRACT -.ce 0 -.(b I F -.bi Rogue -is a visual CRT based fantasy game -which runs under the \*U\(dg timesharing system. -.(f -\fR\(dg\*U is a trademark of Bell Laboratories\fP -.)f -This paper describes how to play rogue, -and gives a few hints -for those who might otherwise get lost in the Dungeons of Doom. -.)b -\".he '''\fBA Guide to the Dungeons of Doom\fP' -\" .fo ''- % -'' -.eh 'USD:33-%''A Guide to the Dungeons of Doom' -.oh 'A Guide to the Dungeons of Doom''USD:33-%' -.sh 1 Introduction -.pp -You have just finished your years as a student at the local fighter's guild. -After much practice and sweat you have finally completed your training -and are ready to embark upon a perilous adventure. -As a test of your skills, -the local guildmasters have sent you into the Dungeons of Doom. -Your task is to return with the Amulet of Yendor. -Your reward for the completion of this task -will be a full membership in the local guild. -In addition, -you are allowed to keep all the loot you bring back from the dungeons. -.pp -In preparation for your journey, -you are given an enchanted mace, -a bow, and a quiver of arrows -taken from a dragon's hoard in the far off Dark Mountains. -You are also outfitted with elf-crafted armor -and given enough food to reach the dungeons. -You say goodbye to family and friends for what may be the last time -and head up the road. -.pp -You set out on your way to the dungeons -and after several days of uneventful travel, -you see the ancient ruins -that mark the entrance to the Dungeons of Doom. -It is late at night, -so you make camp at the entrance -and spend the night sleeping under the open skies. -In the morning you gather your weapons, -put on your armor, -eat what is almost your last food, -and enter the dungeons. -.sh 1 "What is going on here?" -.pp -You have just begun a game of rogue. -Your goal is to grab as much treasure as you can, -find the Amulet of Yendor, -and get out of the Dungeons of Doom alive. -On the screen, -a map of where you have been -and what you have seen on the current dungeon level is kept. -As you explore more of the level, -it appears on the screen in front of you. -.pp -Rogue differs from most computer fantasy games in that it is screen oriented. -Commands are all one or two keystrokes\** -.(f -\** As opposed to pseudo English sentences. -.)f -and the results of your commands -are displayed graphically on the screen rather -than being explained in words.\** -.(f -\** A minimum screen size of 24 lines by 80 columns is required. -If the screen is larger, only the 24x80 section will be used -for the map. -.)f -.pp -Another major difference between rogue and other computer fantasy games -is that once you have solved all the puzzles in a standard fantasy game, -it has lost most of its excitement and it ceases to be fun. -Rogue, -on the other hand, -generates a new dungeon every time you play it -and even the author finds it an entertaining and exciting game. -.sh 1 "What do all those things on the screen mean?" -.pp -In order to understand what is going on in rogue -you have to first get some grasp of what rogue is doing with the screen. -The rogue screen is intended -to replace the \*(lqYou can see ...\*(rq descriptions -of standard fantasy games. -Figure 1 is a sample of what a rogue screen might look like. -.(z -.hl -.nf -.TS -center; -ce0 ce0 ce0 ce0 ce0 ce0 ce0 ce0 ce0 ce0 ce0 ce. -- - - - - - - - - - - - -| . . . . . . . . . . + -| . . @ . . . . ] . . | -| . . . . B . . . . . | -| . . . . . . . . . . | -- - - - - + - - - - - - -.TE - - -.ce 1000 -Level: 1 Gold: 0 Hp: 12(12) Str: 16(16) Arm: 4 Exp: 1/0 - -Figure 1 -.ce -.hl -.)z -.sh 2 "The bottom line" -.pp -At the bottom line of the screen -are a few pieces of cryptic information -describing your current status. -Here is an explanation of what these things mean: -.ip Level \w'Level\ \ 'u -This number indicates how deep you have gone in the dungeon. -It starts at one and goes up as you go deeper into the dungeon. -.ip Gold \w'Level\ \ 'u -The number of gold pieces you have managed to find -and keep with you so far. -.ip Hp \w'Level\ \ 'u -Your current and maximum health points. -Health points indicate how much damage you can take before you die. -The more you get hit in a fight, -the lower they get. -You can regain health points by resting. -The number in parentheses -is the maximum number your health points can reach. -.ip Str \w'Level\ \ 'u -Your current strength and maximum ever strength. -This can be any integer less than or equal to 31, -or greater than or equal to three. -The higher the number, -the stronger you are. -The number in the parentheses -is the maximum strength you have attained so far this game. -.ip Arm \w'Level\ \ 'u -Your current armor protection. -This number indicates how effective your armor is -in stopping blows from unfriendly creatures. -The higher this number is, -the more effective the armor. -.ip Exp \w'Level\ \ 'u -These two numbers give your current experience level -and experience points. -As you do things, -you gain experience points. -At certain experience point totals, -you gain an experience level. -The more experienced you are, -the better you are able to fight and to withstand magical attacks. -.sh 2 "The top line" -.pp -The top line of the screen is reserved -for printing messages that describe things -that are impossible to represent visually. -If you see a \*(lq--More--\*(rq on the top line, -this means that rogue wants to print another message on the screen, -but it wants to make certain -that you have read the one that is there first. -To read the next message, -just type a space. -.sh 2 "The rest of the screen" -.pp -The rest of the screen is the map of the level -as you have explored it so far. -Each symbol on the screen represents something. -Here is a list of what the various symbols mean: -.ip @ -This symbol represents you, the adventurer. -.ip "-\^|" -These symbols represent the walls of rooms. -.ip + -A door to/from a room. -.ip . -The floor of a room. -.ip # -The floor of a passage between rooms. -.ip * -A pile or pot of gold. -.ip ) -A weapon of some sort. -.ip ] -A piece of armor. -.ip ! -A flask containing a magic potion. -.ip ? -A piece of paper, usually a magic scroll. -.ip = -A ring with magic properties -.ip / -A magical staff or wand -.ip ^ -A trap, watch out for these. -.ip % -A staircase to other levels -.ip : -A piece of food. -.ip A-Z -The uppercase letters -represent the various inhabitants of the Dungeons of Doom. -Watch out, they can be nasty and vicious. -.sh 1 Commands -.pp -Commands are given to rogue by typing one or two characters. -Most commands can be preceded by a count to repeat them -(e.g. typing -.Cs 10s -will do ten searches). -Commands for which counts make no sense -have the count ignored. -To cancel a count or a prefix, -type \*E. -The list of commands is rather long, -but it can be read at any time during the game with the -.Cs ? -command. -Here it is for reference, -with a short explanation of each command. -.ip ? -The help command. -Asks for a character to give help on. -If you type a -.Cs * , -it will list all the commands, -otherwise it will explain what the character you typed does. -.ip / -This is the \*(lqWhat is that on the screen?\*(rq command. -A -.Cs / -followed by any character that you see on the level, -will tell you what that character is. -For instance, -typing -.Cs /@ -will tell you that the -.Cs @ -symbol represents you, the player. -.ip "h, H, ^H" -Move left. -You move one space to the left. -If you use upper case -.Cs h , -you will continue to move left until you run into something. -This works for all movement commands -(e.g. -.Cs L -means run in direction -.Cs l ) -If you use the \*(lqcontrol\*(rq -.Cs h , -you will continue moving in the specified direction -until you pass something interesting or run into a wall. -You should experiment with this, -since it is a very useful command, -but very difficult to describe. -This also works for all movement commands. -.ip j -Move down. -.ip k -Move up. -.ip l -Move right. -.ip y -Move diagonally up and left. -.ip u -Move diagonally up and right. -.ip b -Move diagonally down and left. -.ip n -Move diagonally down and right. -.ip t -Throw an object. -This is a prefix command. -When followed with a direction -it throws an object in the specified direction. -(e.g. type -.Cs th -to throw -something to the left.) -.ip f -Fight until someone dies. -When followed with a direction -this will force you to fight the creature in that direction -until either you or it bites the big one. -.ip m -Move onto something without picking it up. -This will move you one space in the direction you specify and, -if there is an object there you can pick up, -it won't do it. -.ip z -Zap prefix. -Point a staff or wand in a given direction -and fire it. -Even non-directional staves must be pointed in some direction -to be used. -.ip ^ -Identify trap command. -If a trap is on your map -and you can't remember what type it is, -you can get rogue to remind you -by getting next to it and typing -.Cs ^ -followed by the direction that would move you on top of it. -.ip s -Search for traps and secret doors. -Examine each space immediately adjacent to you -for the existence of a trap or secret door. -There is a large chance that even if there is something there, -you won't find it, -so you might have to search a while before you find something. -.ip > -Climb down a staircase to the next level. -Not surprisingly, this can only be done if you are standing on staircase. -.ip < -Climb up a staircase to the level above. -This can't be done without the Amulet of Yendor in your possession. -.ip "." -Rest. -This is the \*(lqdo nothing\*(rq command. -This is good for waiting and healing. -.ip , -Pick up something. -This picks up whatever you are currently standing on, -if you are standing on anything at all. -.ip i -Inventory. -List what you are carrying in your pack. -.ip I -Selective inventory. -Tells you what a single item in your pack is. -.ip q -Quaff one of the potions you are carrying. -.ip r -Read one of the scrolls in your pack. -.ip e -Eat food from your pack. -.ip w -Wield a weapon. -Take a weapon out of your pack and carry it for use in combat, -replacing the one you are currently using (if any). -.ip W -Wear armor. -You can only wear one suit of armor at a time. -This takes extra time. -.ip T -Take armor off. -You can't remove armor that is cursed. -This takes extra time. -.ip P -Put on a ring. -You can wear only two rings at a time -(one on each hand). -If you aren't wearing any rings, -this command will ask you which hand you want to wear it on, -otherwise, it will place it on the unused hand. -The program assumes that you wield your sword in your right hand. -.ip R -Remove a ring. -If you are only wearing one ring, -this command takes it off. -If you are wearing two, -it will ask you which one you wish to remove, -.ip d -Drop an object. -Take something out of your pack and leave it lying on the floor. -Only one object can occupy each space. -You cannot drop a cursed object at all -if you are wielding or wearing it. -.ip c -Call an object something. -If you have a type of object in your pack -which you wish to remember something about, -you can use the call command to give a name to that type of object. -This is usually used when you figure out what a -potion, scroll, ring, or staff is -after you pick it up, -or when you want to remember -which of those swords in your pack you were wielding. -.ip D -Print out which things you've discovered something about. -This command will ask you what type of thing you are interested in. -If you type the character for a given type of object -(\fIe.g.\fP -.Cs ! -for potion) -it will tell you which kinds of that type of object you've discovered -(\fIi.e.\fP, figured out what they are). -This command works for potions, scrolls, rings, and staves and wands. -.ip o -Examine and set options. -This command is further explained in the section on options. -.ip ^R -Redraws the screen. -Useful if spurious messages or transmission errors -have messed up the display. -.ip ^P -Print last message. -Useful when a message disappears before you can read it. -This only repeats the last message -that was not a mistyped command -so that you don't loose anything by accidentally typing -the wrong character instead of ^P. -.ip \*E -Cancel a command, prefix, or count. -.ip ! -Escape to a shell for some commands. -.ip Q -Quit. -Leave the game. -.ip S -Save the current game in a file. -It will ask you whether you wish to use the default save file. -.i Caveat : -Rogue won't let you start up a copy of a saved game, -and it removes the save file as soon as you start up a restored game. -This is to prevent people from saving a game just before a dangerous position -and then restarting it if they die. -To restore a saved game, -give the file name as an argument to rogue. -As in -.ti +1i -.nf -% rogue \fIsave\*_file\fP -.ip -To restart from the default save file (see below), -run -.ti +1i -.nf -% rogue \-r -.ip v -Prints the program version number. -.ip ) -Print the weapon you are currently wielding -.ip ] -Print the armor you are currently wearing -.ip = -Print the rings you are currently wearing -.ip @ -Reprint the status line on the message line -.sh 1 Rooms -.pp -Rooms in the dungeons are either lit or dark. -If you walk into a lit room, -the entire room will be drawn on the screen as soon as you enter. -If you walk into a dark room, -it will only be displayed as you explore it. -Upon leaving a room, -all monsters inside the room -are erased from the screen. -In the darkness you can only see one space -in all directions around you. -A corridor is always dark. -.sh 1 Fighting -.pp -If you see a monster and you wish to fight it, -just attempt to run into it. -Many times a monster you find will mind its own business -unless you attack it. -It is often the case that discretion is the better part of valor. -.sh 1 "Objects you can find" -.pp -When you find something in the dungeon, -it is common to want to pick the object up. -This is accomplished in rogue by walking over the object -(unless you use the -.Cs m -prefix, see above). -If you are carrying too many things, -the program will tell you and it won't pick up the object, -otherwise it will add it to your pack -and tell you what you just picked up. -.pp -Many of the commands that operate on objects must prompt you -to find out which object you want to use. -If you change your mind and don't want to do that command after all, -just type an \*E and the command will be aborted. -.pp -Some objects, like armor and weapons, -are easily differentiated. -Others, like scrolls and potions, -are given labels which vary according to type. -During a game, -any two of the same kind of object -with the same label -are the same type. -However, -the labels will vary from game to game. -.pp -When you use one of these labeled objects, -if its effect is obvious, -rogue will remember what it is for you. -If it's effect isn't extremely obvious -you will be asked what you want to scribble on it -so you will recognize it later, -or you can use the -.Cs call -command -(see above). -.sh 2 Weapons -.pp -Some weapons, -like arrows, -come in bunches, -but most come one at a time. -In order to use a weapon, -you must wield it. -To fire an arrow out of a bow, -you must first wield the bow, -then throw the arrow. -You can only wield one weapon at a time, -but you can't change weapons if the one -you are currently wielding is cursed. -The commands to use weapons are -.Cs w -(wield) -and -.Cs t -(throw). -.sh 2 Armor -.pp -There are various sorts of armor lying around in the dungeon. -Some of it is enchanted, -some is cursed, -and some is just normal. -Different armor types have different armor protection. -The higher the armor protection, -the more protection the armor affords against the blows of monsters. -Here is a list of the various armor types and their normal armor protection: -.(b -.TS -box center; -l r. -\ \ \fIType Protection\fP -None 0 -Leather armor 2 -Studded leather / Ring mail 3 -Scale mail 4 -Chain mail 5 -Banded mail / Splint mail 6 -Plate mail 7 -.TE -.)b -.lp -If a piece of armor is enchanted, -its armor protection will be higher than normal. -If a suit of armor is cursed, -its armor protection will be lower, -and you will not be able to remove it. -However, not all armor with a protection that is lower than normal is cursed. -.pp -The commands to use weapons are -.Cs W -(wear) -and -.Cs T -(take off). -.sh 2 Scrolls -.pp -Scrolls come with titles in an unknown tongue\**. -.(f -\** Actually, it's a dialect spoken only by the twenty-seven members -of a tribe in Outer Mongolia, -but you're not supposed to -.i know -that. -.)f -After you read a scroll, -it disappears from your pack. -The command to use a scroll is -.Cs r -(read). -.sh 2 Potions -.pp -Potions are labeled by the color of the liquid inside the flask. -They disappear after being quaffed. -The command to use a scroll is -.Cs q -(quaff). -.sh 2 "Staves and Wands" -.pp -Staves and wands do the same kinds of things. -Staves are identified by a type of wood; -wands by a type of metal or bone. -They are generally things you want to do to something -over a long distance, -so you must point them at what you wish to affect -to use them. -Some staves are not affected by the direction they are pointed, though. -Staves come with multiple magic charges, -the number being random, -and when they are used up, -the staff is just a piece of wood or metal. -.pp -The command to use a wand or staff is -.Cs z -(zap) -.sh 2 Rings -.pp -Rings are very useful items, -since they are relatively permanent magic, -unlike the usually fleeting effects of potions, scrolls, and staves. -Of course, -the bad rings are also more powerful. -Most rings also cause you to use up food more rapidly, -the rate varying with the type of ring. -Rings are differentiated by their stone settings. -The commands to use rings are -.Cs P -(put on) -and -.Cs R -(remove). -.sh 2 Food -.pp -Food is necessary to keep you going. -If you go too long without eating you will faint, -and eventually die of starvation. -The command to use food is -.Cs e -(eat). -.sh 1 Options -.pp -Due to variations in personal tastes -and conceptions of the way rogue should do things, -there are a set of options you can set -that cause rogue to behave in various different ways. -.sh 2 "Setting the options" -.pp -There are two ways to set the options. -The first is with the -.Cs o -command of rogue; -the second is with the -.Cs ROGUEOPTS -environment variable\**. -.(f -\** On Version 6 systems, -there is no equivalent of the ROGUEOPTS feature. -.br -.)f -.br -.sh 3 "Using the `o' command" -.pp -When you type -.Cs o -in rogue, -it clears the screen -and displays the current settings for all the options. -It then places the cursor by the value of the first option -and waits for you to type. -You can type a \*R -which means to go to the next option, -a -.Cs \- -which means to go to the previous option, -an \*E -which means to return to the game, -or you can give the option a value. -For boolean options this merely involves typing -.Cs t -for true or -.Cs f -for false. -For string options, -type the new value followed by a \*R. -.sh 3 "Using the ROGUEOPTS variable" -.pp -The ROGUEOPTS variable is a string -containing a comma separated list of initial values -for the various options. -Boolean variables can be turned on by listing their name -or turned off by putting a -.Cs no -in front of the name. -Thus to set up an environment variable so that -.b jump -is on, -.b terse -is off, -and the -.b name -is set to \*(lqBlue Meanie\*(rq, -use the command -.nf -.ti +3n -% setenv ROGUEOPTS "jump,noterse,name=Blue Meanie"\** -.fi -.(f -\** -For those of you who use the Bourne shell sh (1), the commands would be -.in +3 -.nf -$ ROGUEOPTS="jump,noterse,name=Blue Meanie" -$ export ROGUEOPTS -.fi -.in +0 -.)f -.sh 2 "Option list" -.pp -Here is a list of the options -and an explanation of what each one is for. -The default value for each is enclosed in square brackets. -For character string options, -input over fifty characters will be ignored. -.ip "\fBterse\fP [\fI\^noterse\^\fP]" -Useful for those who are tired of the sometimes lengthy messages of rogue. -This is a useful option for playing on slow terminals, -so this option defaults to -.i terse -if you -are on a slow (1200 baud or under) terminal. -.ip "\fBjump\fP [\fI\^nojump\^\fP]" -If this option is set, -running moves will not be displayed -until you reach the end of the move. -This saves considerable cpu and display time. -This option defaults to -.i jump -if you are using a slow terminal. -.ip "\fBflush\fP [\fI\^noflush\^\fP]" -All typeahead is thrown away after each round of battle. -This is useful for those who type far ahead -and then watch in dismay as a Bat kills them. -.ip "\fBseefloor\fP [\fI\^seefloor\^\fP]" -Display the floor around you on the screen -as you move through dark rooms. -Due to the amount of characters generated, -this option defaults to -.i noseefloor -if you are using a slow terminal. -.ip "\fBpassgo\fP [\fI\^nopassgo\^\fP]" -Follow turnings in passageways. -If you run in a passage -and you run into stone or a wall, -rogue will see if it can turn to the right or left. -If it can only turn one way, -it will turn that way. -If it can turn either or neither, -it will stop. -This algorithm can sometimes lead to slightly confusing occurrences -which is why it defaults to \fInopassgo\fP. -.ip "\fBtombstone\fP [\fI\^tombstone\^\fP]" -Print out the tombstone at the end if you get killed. -This is nice but slow, so you can turn it off if you like. -.ip "\fBinven\fP [\fI\^overwrite\^\fP]" -Inventory type. -This can have one of three values: -.i overwrite , -.i slow , -or -.i clear . -With -.i overwrite -the top lines of the map are overwritten -with the list -when inventory is requested -or when -\*(lqWhich item do you wish to \fB. . .\fP? \*(rq questions -are answered with a -.Cs * . -However, if the list is longer than a screenful, -the screen is cleared. -With -.i slow , -lists are displayed one item at a time on the top of the screen, -and with -.i clear , -the screen is cleared, -the list is displayed, -and then the dungeon level is re-displayed. -Due to speed considerations, -.i clear -is the default for terminals without -clear-to-end-of-line capabilities. -.ip "\fBname\fP [account name]" -This is the name of your character. -It is used if you get on the top ten scorer's list. -.ip "\fBfruit\fP [\fI\^slime-mold\^\fP]" -This should hold the name of a fruit that you enjoy eating. -It is basically a whimsey that rogue uses in a couple of places. -.ip "\fBfile\fP [\fI\^~/rogue.save\^\fP]" -The default file name for saving the game. -If your phone is hung up by accident, -rogue will automatically save the game in this file. -The file name may start with the special character -.Cs ~ -which expands to be your home directory. -.sh 1 Scoring -.pp -Rogue usually maintains a list -of the top scoring people or scores on your machine. -Depending on how it is set up, -it can post either the top scores -or the top players. -In the latter case, -each account on the machine -can post only one non-winning score on this list. -If you score higher than someone else on this list, -or better your previous score on the list, -you will be inserted in the proper place -under your current name. -How many scores are kept -can also be set up by whoever installs it on your machine. -.pp -If you quit the game, you get out with all of your gold intact. -If, however, you get killed in the Dungeons of Doom, -your body is forwarded to your next-of-kin, -along with 90% of your gold; -ten percent of your gold is kept by the Dungeons' wizard as a fee\**. -.(f -\** The Dungeon's wizard is named Wally the Wonder Badger. -Invocations should be accompanied by a sizable donation. -.)f -This should make you consider whether you want to take one last hit -at that monster and possibly live, -or quit and thus stop with whatever you have. -If you quit, you do get all your gold, -but if you swing and live, you might find more. -.pp -If you just want to see what the current top players/games list is, -you can type -.ti +1i -.nf -% rogue \-s -.br -.sh 1 Acknowledgements -.pp -Rogue was originally conceived of by Glenn Wichman and Michael Toy. -Ken Arnold and Michael Toy then smoothed out the user interface, -and added jillions of new features. -We would like to thank -Bob Arnold, -Michelle Busch, -Andy Hatcher, -Kipp Hickman, -Mark Horton, -Daniel Jensen, -Bill Joy, -Joe Kalash, -Steve Maurer, -Marty McNary, -Jan Miller, -and -Scott Nelson -for their ideas and assistance; -and also the teeming multitudes -who graciously ignored work, school, and social life to play rogue -and send us bugs, complaints, suggestions, and just plain flames. -And also Mom. diff --git a/src/cc/rogue/rogue.me.in b/src/cc/rogue/rogue.me.in deleted file mode 100644 index a73d1504e..000000000 --- a/src/cc/rogue/rogue.me.in +++ /dev/null @@ -1,892 +0,0 @@ -.\" -.\" @(#)rogue.me 6.2 (Berkeley) 4/28/86 -.\" -.\" Rogue: Exploring the Dungeons of Doom -.\" Copyright (C) 1980-1983, 1985, 1986 Michael Toy, Ken Arnold and Glenn Wichman -.\" All rights reserved. -.\" -.\" See the file LICENSE.TXT for full copyright and licensing information. -.\" -.ds E \s-2\s0 -.ds R \s-2\s0 -.ds U \s-2UNIX\s0 -.ie t .ds _ \d\(mi\u -.el .ds _ _ -.de Cs -\&\\$3\*(lq\\$1\*(rq\\$2 -.. -.sp 5 -.ce 1000 -.ps +4 -.vs +4p -.b -A Guide to the Dungeons of Doom -.r -.vs -.ps -.sp 2 -.i -Michael C. Toy -Kenneth C. R. C. Arnold -.r -.sp 2 -Computer Systems Research Group -Department of Electrical Engineering and Computer Science -University of California -Berkeley, California 94720 -.sp 4 -.i ABSTRACT -.ce 0 -.(b I F -.bi Rogue -is a visual CRT based fantasy game -which runs under the \*U\(dg timesharing system. -.(f -\fR\(dg\*U is a trademark of Bell Laboratories\fP -.)f -This paper describes how to play rogue, -and gives a few hints -for those who might otherwise get lost in the Dungeons of Doom. -.)b -\".he '''\fBA Guide to the Dungeons of Doom\fP' -\" .fo ''- % -'' -.eh 'USD:33-%''A Guide to the Dungeons of Doom' -.oh 'A Guide to the Dungeons of Doom''USD:33-%' -.sh 1 Introduction -.pp -You have just finished your years as a student at the local fighter's guild. -After much practice and sweat you have finally completed your training -and are ready to embark upon a perilous adventure. -As a test of your skills, -the local guildmasters have sent you into the Dungeons of Doom. -Your task is to return with the Amulet of Yendor. -Your reward for the completion of this task -will be a full membership in the local guild. -In addition, -you are allowed to keep all the loot you bring back from the dungeons. -.pp -In preparation for your journey, -you are given an enchanted mace, -a bow, and a quiver of arrows -taken from a dragon's hoard in the far off Dark Mountains. -You are also outfitted with elf-crafted armor -and given enough food to reach the dungeons. -You say goodbye to family and friends for what may be the last time -and head up the road. -.pp -You set out on your way to the dungeons -and after several days of uneventful travel, -you see the ancient ruins -that mark the entrance to the Dungeons of Doom. -It is late at night, -so you make camp at the entrance -and spend the night sleeping under the open skies. -In the morning you gather your weapons, -put on your armor, -eat what is almost your last food, -and enter the dungeons. -.sh 1 "What is going on here?" -.pp -You have just begun a game of rogue. -Your goal is to grab as much treasure as you can, -find the Amulet of Yendor, -and get out of the Dungeons of Doom alive. -On the screen, -a map of where you have been -and what you have seen on the current dungeon level is kept. -As you explore more of the level, -it appears on the screen in front of you. -.pp -Rogue differs from most computer fantasy games in that it is screen oriented. -Commands are all one or two keystrokes\** -.(f -\** As opposed to pseudo English sentences. -.)f -and the results of your commands -are displayed graphically on the screen rather -than being explained in words.\** -.(f -\** A minimum screen size of 24 lines by 80 columns is required. -If the screen is larger, only the 24x80 section will be used -for the map. -.)f -.pp -Another major difference between rogue and other computer fantasy games -is that once you have solved all the puzzles in a standard fantasy game, -it has lost most of its excitement and it ceases to be fun. -Rogue, -on the other hand, -generates a new dungeon every time you play it -and even the author finds it an entertaining and exciting game. -.sh 1 "What do all those things on the screen mean?" -.pp -In order to understand what is going on in rogue -you have to first get some grasp of what rogue is doing with the screen. -The rogue screen is intended -to replace the \*(lqYou can see ...\*(rq descriptions -of standard fantasy games. -Figure 1 is a sample of what a rogue screen might look like. -.(z -.hl -.nf -.TS -center; -ce0 ce0 ce0 ce0 ce0 ce0 ce0 ce0 ce0 ce0 ce0 ce. -- - - - - - - - - - - - -| . . . . . . . . . . + -| . . @ . . . . ] . . | -| . . . . B . . . . . | -| . . . . . . . . . . | -- - - - - + - - - - - - -.TE - - -.ce 1000 -Level: 1 Gold: 0 Hp: 12(12) Str: 16(16) Arm: 4 Exp: 1/0 - -Figure 1 -.ce -.hl -.)z -.sh 2 "The bottom line" -.pp -At the bottom line of the screen -are a few pieces of cryptic information -describing your current status. -Here is an explanation of what these things mean: -.ip Level \w'Level\ \ 'u -This number indicates how deep you have gone in the dungeon. -It starts at one and goes up as you go deeper into the dungeon. -.ip Gold \w'Level\ \ 'u -The number of gold pieces you have managed to find -and keep with you so far. -.ip Hp \w'Level\ \ 'u -Your current and maximum health points. -Health points indicate how much damage you can take before you die. -The more you get hit in a fight, -the lower they get. -You can regain health points by resting. -The number in parentheses -is the maximum number your health points can reach. -.ip Str \w'Level\ \ 'u -Your current strength and maximum ever strength. -This can be any integer less than or equal to 31, -or greater than or equal to three. -The higher the number, -the stronger you are. -The number in the parentheses -is the maximum strength you have attained so far this game. -.ip Arm \w'Level\ \ 'u -Your current armor protection. -This number indicates how effective your armor is -in stopping blows from unfriendly creatures. -The higher this number is, -the more effective the armor. -.ip Exp \w'Level\ \ 'u -These two numbers give your current experience level -and experience points. -As you do things, -you gain experience points. -At certain experience point totals, -you gain an experience level. -The more experienced you are, -the better you are able to fight and to withstand magical attacks. -.sh 2 "The top line" -.pp -The top line of the screen is reserved -for printing messages that describe things -that are impossible to represent visually. -If you see a \*(lq--More--\*(rq on the top line, -this means that rogue wants to print another message on the screen, -but it wants to make certain -that you have read the one that is there first. -To read the next message, -just type a space. -.sh 2 "The rest of the screen" -.pp -The rest of the screen is the map of the level -as you have explored it so far. -Each symbol on the screen represents something. -Here is a list of what the various symbols mean: -.ip @ -This symbol represents you, the adventurer. -.ip "-\^|" -These symbols represent the walls of rooms. -.ip + -A door to/from a room. -.ip . -The floor of a room. -.ip # -The floor of a passage between rooms. -.ip * -A pile or pot of gold. -.ip ) -A weapon of some sort. -.ip ] -A piece of armor. -.ip ! -A flask containing a magic potion. -.ip ? -A piece of paper, usually a magic scroll. -.ip = -A ring with magic properties -.ip / -A magical staff or wand -.ip ^ -A trap, watch out for these. -.ip % -A staircase to other levels -.ip : -A piece of food. -.ip A-Z -The uppercase letters -represent the various inhabitants of the Dungeons of Doom. -Watch out, they can be nasty and vicious. -.sh 1 Commands -.pp -Commands are given to rogue by typing one or two characters. -Most commands can be preceded by a count to repeat them -(e.g. typing -.Cs 10s -will do ten searches). -Commands for which counts make no sense -have the count ignored. -To cancel a count or a prefix, -type \*E. -The list of commands is rather long, -but it can be read at any time during the game with the -.Cs ? -command. -Here it is for reference, -with a short explanation of each command. -.ip ? -The help command. -Asks for a character to give help on. -If you type a -.Cs * , -it will list all the commands, -otherwise it will explain what the character you typed does. -.ip / -This is the \*(lqWhat is that on the screen?\*(rq command. -A -.Cs / -followed by any character that you see on the level, -will tell you what that character is. -For instance, -typing -.Cs /@ -will tell you that the -.Cs @ -symbol represents you, the player. -.ip "h, H, ^H" -Move left. -You move one space to the left. -If you use upper case -.Cs h , -you will continue to move left until you run into something. -This works for all movement commands -(e.g. -.Cs L -means run in direction -.Cs l ) -If you use the \*(lqcontrol\*(rq -.Cs h , -you will continue moving in the specified direction -until you pass something interesting or run into a wall. -You should experiment with this, -since it is a very useful command, -but very difficult to describe. -This also works for all movement commands. -.ip j -Move down. -.ip k -Move up. -.ip l -Move right. -.ip y -Move diagonally up and left. -.ip u -Move diagonally up and right. -.ip b -Move diagonally down and left. -.ip n -Move diagonally down and right. -.ip t -Throw an object. -This is a prefix command. -When followed with a direction -it throws an object in the specified direction. -(e.g. type -.Cs th -to throw -something to the left.) -.ip f -Fight until someone dies. -When followed with a direction -this will force you to fight the creature in that direction -until either you or it bites the big one. -.ip m -Move onto something without picking it up. -This will move you one space in the direction you specify and, -if there is an object there you can pick up, -it won't do it. -.ip z -Zap prefix. -Point a staff or wand in a given direction -and fire it. -Even non-directional staves must be pointed in some direction -to be used. -.ip ^ -Identify trap command. -If a trap is on your map -and you can't remember what type it is, -you can get rogue to remind you -by getting next to it and typing -.Cs ^ -followed by the direction that would move you on top of it. -.ip s -Search for traps and secret doors. -Examine each space immediately adjacent to you -for the existence of a trap or secret door. -There is a large chance that even if there is something there, -you won't find it, -so you might have to search a while before you find something. -.ip > -Climb down a staircase to the next level. -Not surprisingly, this can only be done if you are standing on staircase. -.ip < -Climb up a staircase to the level above. -This can't be done without the Amulet of Yendor in your possession. -.ip "." -Rest. -This is the \*(lqdo nothing\*(rq command. -This is good for waiting and healing. -.ip , -Pick up something. -This picks up whatever you are currently standing on, -if you are standing on anything at all. -.ip i -Inventory. -List what you are carrying in your pack. -.ip I -Selective inventory. -Tells you what a single item in your pack is. -.ip q -Quaff one of the potions you are carrying. -.ip r -Read one of the scrolls in your pack. -.ip e -Eat food from your pack. -.ip w -Wield a weapon. -Take a weapon out of your pack and carry it for use in combat, -replacing the one you are currently using (if any). -.ip W -Wear armor. -You can only wear one suit of armor at a time. -This takes extra time. -.ip T -Take armor off. -You can't remove armor that is cursed. -This takes extra time. -.ip P -Put on a ring. -You can wear only two rings at a time -(one on each hand). -If you aren't wearing any rings, -this command will ask you which hand you want to wear it on, -otherwise, it will place it on the unused hand. -The program assumes that you wield your sword in your right hand. -.ip R -Remove a ring. -If you are only wearing one ring, -this command takes it off. -If you are wearing two, -it will ask you which one you wish to remove, -.ip d -Drop an object. -Take something out of your pack and leave it lying on the floor. -Only one object can occupy each space. -You cannot drop a cursed object at all -if you are wielding or wearing it. -.ip c -Call an object something. -If you have a type of object in your pack -which you wish to remember something about, -you can use the call command to give a name to that type of object. -This is usually used when you figure out what a -potion, scroll, ring, or staff is -after you pick it up, -or when you want to remember -which of those swords in your pack you were wielding. -.ip D -Print out which things you've discovered something about. -This command will ask you what type of thing you are interested in. -If you type the character for a given type of object -(\fIe.g.\fP -.Cs ! -for potion) -it will tell you which kinds of that type of object you've discovered -(\fIi.e.\fP, figured out what they are). -This command works for potions, scrolls, rings, and staves and wands. -.ip o -Examine and set options. -This command is further explained in the section on options. -.ip ^R -Redraws the screen. -Useful if spurious messages or transmission errors -have messed up the display. -.ip ^P -Print last message. -Useful when a message disappears before you can read it. -This only repeats the last message -that was not a mistyped command -so that you don't loose anything by accidentally typing -the wrong character instead of ^P. -.ip \*E -Cancel a command, prefix, or count. -.ip ! -Escape to a shell for some commands. -.ip Q -Quit. -Leave the game. -.ip S -Save the current game in a file. -It will ask you whether you wish to use the default save file. -.i Caveat : -Rogue won't let you start up a copy of a saved game, -and it removes the save file as soon as you start up a restored game. -This is to prevent people from saving a game just before a dangerous position -and then restarting it if they die. -To restore a saved game, -give the file name as an argument to rogue. -As in -.ti +1i -.nf -% rogue \fIsave\*_file\fP -.ip -To restart from the default save file (see below), -run -.ti +1i -.nf -% rogue \-r -.ip v -Prints the program version number. -.ip ) -Print the weapon you are currently wielding -.ip ] -Print the armor you are currently wearing -.ip = -Print the rings you are currently wearing -.ip @ -Reprint the status line on the message line -.sh 1 Rooms -.pp -Rooms in the dungeons are either lit or dark. -If you walk into a lit room, -the entire room will be drawn on the screen as soon as you enter. -If you walk into a dark room, -it will only be displayed as you explore it. -Upon leaving a room, -all monsters inside the room -are erased from the screen. -In the darkness you can only see one space -in all directions around you. -A corridor is always dark. -.sh 1 Fighting -.pp -If you see a monster and you wish to fight it, -just attempt to run into it. -Many times a monster you find will mind its own business -unless you attack it. -It is often the case that discretion is the better part of valor. -.sh 1 "Objects you can find" -.pp -When you find something in the dungeon, -it is common to want to pick the object up. -This is accomplished in rogue by walking over the object -(unless you use the -.Cs m -prefix, see above). -If you are carrying too many things, -the program will tell you and it won't pick up the object, -otherwise it will add it to your pack -and tell you what you just picked up. -.pp -Many of the commands that operate on objects must prompt you -to find out which object you want to use. -If you change your mind and don't want to do that command after all, -just type an \*E and the command will be aborted. -.pp -Some objects, like armor and weapons, -are easily differentiated. -Others, like scrolls and potions, -are given labels which vary according to type. -During a game, -any two of the same kind of object -with the same label -are the same type. -However, -the labels will vary from game to game. -.pp -When you use one of these labeled objects, -if its effect is obvious, -rogue will remember what it is for you. -If it's effect isn't extremely obvious -you will be asked what you want to scribble on it -so you will recognize it later, -or you can use the -.Cs call -command -(see above). -.sh 2 Weapons -.pp -Some weapons, -like arrows, -come in bunches, -but most come one at a time. -In order to use a weapon, -you must wield it. -To fire an arrow out of a bow, -you must first wield the bow, -then throw the arrow. -You can only wield one weapon at a time, -but you can't change weapons if the one -you are currently wielding is cursed. -The commands to use weapons are -.Cs w -(wield) -and -.Cs t -(throw). -.sh 2 Armor -.pp -There are various sorts of armor lying around in the dungeon. -Some of it is enchanted, -some is cursed, -and some is just normal. -Different armor types have different armor protection. -The higher the armor protection, -the more protection the armor affords against the blows of monsters. -Here is a list of the various armor types and their normal armor protection: -.(b -.TS -box center; -l r. -\ \ \fIType Protection\fP -None 0 -Leather armor 2 -Studded leather / Ring mail 3 -Scale mail 4 -Chain mail 5 -Banded mail / Splint mail 6 -Plate mail 7 -.TE -.)b -.lp -If a piece of armor is enchanted, -its armor protection will be higher than normal. -If a suit of armor is cursed, -its armor protection will be lower, -and you will not be able to remove it. -However, not all armor with a protection that is lower than normal is cursed. -.pp -The commands to use weapons are -.Cs W -(wear) -and -.Cs T -(take off). -.sh 2 Scrolls -.pp -Scrolls come with titles in an unknown tongue\**. -.(f -\** Actually, it's a dialect spoken only by the twenty-seven members -of a tribe in Outer Mongolia, -but you're not supposed to -.i know -that. -.)f -After you read a scroll, -it disappears from your pack. -The command to use a scroll is -.Cs r -(read). -.sh 2 Potions -.pp -Potions are labeled by the color of the liquid inside the flask. -They disappear after being quaffed. -The command to use a scroll is -.Cs q -(quaff). -.sh 2 "Staves and Wands" -.pp -Staves and wands do the same kinds of things. -Staves are identified by a type of wood; -wands by a type of metal or bone. -They are generally things you want to do to something -over a long distance, -so you must point them at what you wish to affect -to use them. -Some staves are not affected by the direction they are pointed, though. -Staves come with multiple magic charges, -the number being random, -and when they are used up, -the staff is just a piece of wood or metal. -.pp -The command to use a wand or staff is -.Cs z -(zap) -.sh 2 Rings -.pp -Rings are very useful items, -since they are relatively permanent magic, -unlike the usually fleeting effects of potions, scrolls, and staves. -Of course, -the bad rings are also more powerful. -Most rings also cause you to use up food more rapidly, -the rate varying with the type of ring. -Rings are differentiated by their stone settings. -The commands to use rings are -.Cs P -(put on) -and -.Cs R -(remove). -.sh 2 Food -.pp -Food is necessary to keep you going. -If you go too long without eating you will faint, -and eventually die of starvation. -The command to use food is -.Cs e -(eat). -.sh 1 Options -.pp -Due to variations in personal tastes -and conceptions of the way rogue should do things, -there are a set of options you can set -that cause rogue to behave in various different ways. -.sh 2 "Setting the options" -.pp -There are two ways to set the options. -The first is with the -.Cs o -command of rogue; -the second is with the -.Cs ROGUEOPTS -environment variable\**. -.(f -\** On Version 6 systems, -there is no equivalent of the ROGUEOPTS feature. -.br -.)f -.br -.sh 3 "Using the `o' command" -.pp -When you type -.Cs o -in rogue, -it clears the screen -and displays the current settings for all the options. -It then places the cursor by the value of the first option -and waits for you to type. -You can type a \*R -which means to go to the next option, -a -.Cs \- -which means to go to the previous option, -an \*E -which means to return to the game, -or you can give the option a value. -For boolean options this merely involves typing -.Cs t -for true or -.Cs f -for false. -For string options, -type the new value followed by a \*R. -.sh 3 "Using the ROGUEOPTS variable" -.pp -The ROGUEOPTS variable is a string -containing a comma separated list of initial values -for the various options. -Boolean variables can be turned on by listing their name -or turned off by putting a -.Cs no -in front of the name. -Thus to set up an environment variable so that -.b jump -is on, -.b terse -is off, -and the -.b name -is set to \*(lqBlue Meanie\*(rq, -use the command -.nf -.ti +3n -% setenv ROGUEOPTS "jump,noterse,name=Blue Meanie"\** -.fi -.(f -\** -For those of you who use the Bourne shell sh (1), the commands would be -.in +3 -.nf -$ ROGUEOPTS="jump,noterse,name=Blue Meanie" -$ export ROGUEOPTS -.fi -.in +0 -.)f -.sh 2 "Option list" -.pp -Here is a list of the options -and an explanation of what each one is for. -The default value for each is enclosed in square brackets. -For character string options, -input over fifty characters will be ignored. -.ip "\fBterse\fP [\fI\^noterse\^\fP]" -Useful for those who are tired of the sometimes lengthy messages of rogue. -This is a useful option for playing on slow terminals, -so this option defaults to -.i terse -if you -are on a slow (1200 baud or under) terminal. -.ip "\fBjump\fP [\fI\^nojump\^\fP]" -If this option is set, -running moves will not be displayed -until you reach the end of the move. -This saves considerable cpu and display time. -This option defaults to -.i jump -if you are using a slow terminal. -.ip "\fBflush\fP [\fI\^noflush\^\fP]" -All typeahead is thrown away after each round of battle. -This is useful for those who type far ahead -and then watch in dismay as a Bat kills them. -.ip "\fBseefloor\fP [\fI\^seefloor\^\fP]" -Display the floor around you on the screen -as you move through dark rooms. -Due to the amount of characters generated, -this option defaults to -.i noseefloor -if you are using a slow terminal. -.ip "\fBpassgo\fP [\fI\^nopassgo\^\fP]" -Follow turnings in passageways. -If you run in a passage -and you run into stone or a wall, -rogue will see if it can turn to the right or left. -If it can only turn one way, -it will turn that way. -If it can turn either or neither, -it will stop. -This algorithm can sometimes lead to slightly confusing occurrences -which is why it defaults to \fInopassgo\fP. -.ip "\fBtombstone\fP [\fI\^tombstone\^\fP]" -Print out the tombstone at the end if you get killed. -This is nice but slow, so you can turn it off if you like. -.ip "\fBinven\fP [\fI\^overwrite\^\fP]" -Inventory type. -This can have one of three values: -.i overwrite , -.i slow , -or -.i clear . -With -.i overwrite -the top lines of the map are overwritten -with the list -when inventory is requested -or when -\*(lqWhich item do you wish to \fB. . .\fP? \*(rq questions -are answered with a -.Cs * . -However, if the list is longer than a screenful, -the screen is cleared. -With -.i slow , -lists are displayed one item at a time on the top of the screen, -and with -.i clear , -the screen is cleared, -the list is displayed, -and then the dungeon level is re-displayed. -Due to speed considerations, -.i clear -is the default for terminals without -clear-to-end-of-line capabilities. -.ip "\fBname\fP [account name]" -This is the name of your character. -It is used if you get on the top ten scorer's list. -.ip "\fBfruit\fP [\fI\^slime-mold\^\fP]" -This should hold the name of a fruit that you enjoy eating. -It is basically a whimsey that rogue uses in a couple of places. -.ip "\fBfile\fP [\fI\^~/rogue.save\^\fP]" -The default file name for saving the game. -If your phone is hung up by accident, -rogue will automatically save the game in this file. -The file name may start with the special character -.Cs ~ -which expands to be your home directory. -.sh 1 Scoring -.pp -Rogue usually maintains a list -of the top scoring people or scores on your machine. -Depending on how it is set up, -it can post either the top scores -or the top players. -In the latter case, -each account on the machine -can post only one non-winning score on this list. -If you score higher than someone else on this list, -or better your previous score on the list, -you will be inserted in the proper place -under your current name. -How many scores are kept -can also be set up by whoever installs it on your machine. -.pp -If you quit the game, you get out with all of your gold intact. -If, however, you get killed in the Dungeons of Doom, -your body is forwarded to your next-of-kin, -along with 90% of your gold; -ten percent of your gold is kept by the Dungeons' wizard as a fee\**. -.(f -\** The Dungeon's wizard is named Wally the Wonder Badger. -Invocations should be accompanied by a sizable donation. -.)f -This should make you consider whether you want to take one last hit -at that monster and possibly live, -or quit and thus stop with whatever you have. -If you quit, you do get all your gold, -but if you swing and live, you might find more. -.pp -If you just want to see what the current top players/games list is, -you can type -.ti +1i -.nf -% @PROGRAM@ \-s -.br -.sh 1 Acknowledgements -.pp -Rogue was originally conceived of by Glenn Wichman and Michael Toy. -Ken Arnold and Michael Toy then smoothed out the user interface, -and added jillions of new features. -We would like to thank -Bob Arnold, -Michelle Busch, -Andy Hatcher, -Kipp Hickman, -Mark Horton, -Daniel Jensen, -Bill Joy, -Joe Kalash, -Steve Maurer, -Marty McNary, -Jan Miller, -and -Scott Nelson -for their ideas and assistance; -and also the teeming multitudes -who graciously ignored work, school, and social life to play rogue -and send us bugs, complaints, suggestions, and just plain flames. -And also Mom. diff --git a/src/cc/rogue/rogue.png b/src/cc/rogue/rogue.png deleted file mode 100644 index fc3779e83223dbb46ec33f8c1d936e6db202eb86..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1005 zcmVWFU8GbZ8({Xk{QrNlj4iWF>9@00U7;L_t(o!`0VYjGa>y z2k_rGt+py1)hR8ZqY@&nbx+ZVh>{5LU|uwR5FrvTgb00*z7V8O8YD#GiMU4*f+q=? zc6dPyQW`bN(90M#opOek^~uW4cg}n>m56_`bJqU$UVE>-?uY*vJ+t6B0_Wgj^kYe! zGlm~9h#~CxHwB%CtMMd$#b48mNj#4mLf}KfaoB{>1{arOAD+O9*_hxkoR8o;2)+xi ze-US5b(m;v>{*Vt(s|oDoc9kl6l%M%##vY6i(+3JA7V%3gs~71u1))X!}Z;w;;XcI zYt5c(;?>iI;Qn+`557!mo4dt)e%0N@`uv*6*c@7$D!vcnti=0NVb)pFP- zU}IW;rx4&}EJ*8jq_v-NvdQRA^sX2cPQZ0(J`}I2@O^RCUKW^L9AurSdR#S1RO;Yqmn3f?mkJ%X=`^iyj0E25;|p60{&q*ESPlVWwe2)iw5 z?b~?O`yI02XSf;nM{AbT_4;mgpce-c!=|)$YZRSMsduVDdVZ}iWi4JUTB_x#v_4*Q z(PR{%%ke@7LB``TeNAfk`f!wr`N0$oOYv}+U^1GPyHW@qAKlP!M8jUZf}4sQ(-lkc zMiO8Qch)#;Q!Ky*cr40tBV18b#oggl^Jj2z3+Lk5&{$Ok8~+!%r)VtOkzfX*%r1^_ z>xth!oD!YTy^(C%g)g*mWz)92H&p*X@qHp1lAY0X{1HB~DBAKB!CRg^il?K0*fkRy zuB&N6nvMgZwT+>%S)qkf!@GAhym(L8ejQHC<@ZqkoVKE>t-@)M8|Fl190_L|j8c5i b{{epk<~&Tog&~z@00000NkvXXu0mjfa>>^0 diff --git a/src/cc/rogue/rogue.spec b/src/cc/rogue/rogue.spec deleted file mode 100644 index 6c8770fdc..000000000 --- a/src/cc/rogue/rogue.spec +++ /dev/null @@ -1,107 +0,0 @@ -Name: rogue -Version: 5.4.4 -Release: 1%{?dist} -Summary: The original graphical adventure game - -Group: Amusements/Games -License: BSD -URL: http://rogue.rogueforge.net/ -Source0: http://rogue.rogueforge.net/files/rogue5.4/rogue5.4.4-src.tar.gz -Source1: rogue.desktop -Source2: rogue.png -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) - -BuildRequires: desktop-file-utils -BuildRequires: ncurses-devel - -%description -The one, the only, the original graphical adventure game that spawned -an entire genre. - -%prep -%setup -q -n %{name}%{version} - - -%build -%configure --enable-setgid=games --enable-scorefile=%{_var}/games/roguelike/rogue54.scr --enable-lockfile=%{_var}/games/roguelike/rogue54.lck -make %{_smp_mflags} - - -%install -rm -rf $RPM_BUILD_ROOT - -make install DESTDIR=$RPM_BUILD_ROOT - -desktop-file-install --vendor fedora \ - --dir ${RPM_BUILD_ROOT}%{_datadir}/applications \ - %{SOURCE1} -mkdir -p $RPM_BUILD_ROOT/%{_datadir}/icons/hicolor/32x32/apps/ -install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT/%{_datadir}/icons/hicolor/32x32/apps/ - - -%clean -rm -rf $RPM_BUILD_ROOT - -%post -touch --no-create %{_datadir}/icons/hicolor || : -if [ -x %{_bindir}/gtk-update-icon-cache ]; then - %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || : -fi - -%postun -touch --no-create %{_datadir}/icons/hicolor || : -if [ -x %{_bindir}/gtk-update-icon-cache ]; then - %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || : -fi - - -%files -%defattr(-,root,root,-) -%attr(2755,games,games) %{_bindir}/rogue -%{_mandir}/man6/rogue.6.gz -%{_datadir}/applications/fedora-%{name}.desktop -%{_datadir}/icons/hicolor/32x32/apps/rogue.png -%dir %attr(0775,games,games) %{_var}/games/roguelike -%config(noreplace) %attr(0664,games,games) %{_var}/games/roguelike/rogue54.scr -%doc %{_docdir}/%{name}-%{version} - - -%changelog -* Sun Sep 2 2007 Wart 5.4.4-1 -- Update to 5.4.4 - -* Mon Aug 20 2007 Wart 5.4.3-1 -- Update to 5.4.3 - -* Sun Jul 15 2007 Wart 5.4.2-9 -- New upstream home page and download URL -- Add patch when reading long values from the save file on 64-bit arch - (BZ #248283) -- Add patch removing many compiler warnings -- Use proper version in the .desktop file - -* Sat Mar 3 2007 Wart 5.4.2-8 -- Use better sourceforge download url -- Use more precise desktop file categories - -* Mon Aug 28 2006 Wart 5.4.2-7 -- Rebuild for Fedora Extras - -* Tue May 16 2006 Wart 5.4.2-6 -- Added empty initial scoreboard file. - -* Mon May 15 2006 Wart 5.4.2-5 -- Better setuid/setgid handling (again) (BZ #187392) - -* Thu Mar 30 2006 Wart 5.4.2-4 -- Better setuid/setgid handling (BZ #187392) -- Resize desktop icon to match directory name - -* Mon Mar 13 2006 Wart 5.4.2-3 -- Added icon for .desktop file. - -* Sun Mar 12 2006 Wart 5.4.2-2 -- Added missing BR: ncurses-devel, desktop-file-utils - -* Sat Feb 25 2006 Wart 5.4.2-1 -- Initial spec file. diff --git a/src/cc/rogue/rogue54.sln b/src/cc/rogue/rogue54.sln deleted file mode 100644 index 751959465..000000000 --- a/src/cc/rogue/rogue54.sln +++ /dev/null @@ -1,27 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rogue54", "rogue54.vcxproj", "{9EA0D326-8097-4ADA-82EA-4DB1F5CAA8F6}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {9EA0D326-8097-4ADA-82EA-4DB1F5CAA8F6}.Debug|Win32.ActiveCfg = Debug|Win32 - {9EA0D326-8097-4ADA-82EA-4DB1F5CAA8F6}.Debug|Win32.Build.0 = Debug|Win32 - {9EA0D326-8097-4ADA-82EA-4DB1F5CAA8F6}.Debug|x64.ActiveCfg = Debug|x64 - {9EA0D326-8097-4ADA-82EA-4DB1F5CAA8F6}.Debug|x64.Build.0 = Debug|x64 - {9EA0D326-8097-4ADA-82EA-4DB1F5CAA8F6}.Release|Win32.ActiveCfg = Release|Win32 - {9EA0D326-8097-4ADA-82EA-4DB1F5CAA8F6}.Release|Win32.Build.0 = Release|Win32 - {9EA0D326-8097-4ADA-82EA-4DB1F5CAA8F6}.Release|x64.ActiveCfg = Release|x64 - {9EA0D326-8097-4ADA-82EA-4DB1F5CAA8F6}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/cc/rogue/rogue54.vcproj b/src/cc/rogue/rogue54.vcproj deleted file mode 100644 index 7e39b98dd..000000000 --- a/src/cc/rogue/rogue54.vcproj +++ /dev/null @@ -1,396 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/cc/rogue/rogue54.vcxproj b/src/cc/rogue/rogue54.vcxproj deleted file mode 100644 index 344598dd8..000000000 --- a/src/cc/rogue/rogue54.vcxproj +++ /dev/null @@ -1,257 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {9EA0D326-8097-4ADA-82EA-4DB1F5CAA8F6} - Win32Proj - 8.1 - - - - Application - v140 - MultiByte - - - Application - v140 - MultiByte - false - - - Application - v140 - MultiByte - - - Application - v140 - MultiByte - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>14.0.25431.1 - - - Debug\ - Debug\ - true - - - true - - - Release\ - Release\ - false - - - false - - - - Disabled - Default - ../pdcurses;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;ALLSCORES;MASTER;SCOREFILE="rogue54.scr";LOCKFILE="rogue54.lck";%(PreprocessorDefinitions) - true - false - - EnableFastChecks - MultiThreaded - true - true - false - true - - - Level4 - EditAndContinue - CompileAsC - - - Ws2_32.lib;pdcurses.lib;advapi32.lib;shfolder.lib;user32.lib;%(AdditionalDependencies) - $(OutDir)rogue54.exe - ..\pdcurses;%(AdditionalLibraryDirectories) - false - true - $(OutDir)rogue54.pdb - Console - MachineX86 - - - - - Disabled - Default - $(ProjectDir)x86_64-w64-msvc\deps\install\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;PDC_DLL_BUILD;PDC_WIDE;PDCDEBUG;_CRT_SECURE_NO_DEPRECATE;ALLSCORES;SCOREFILE="rogue54.scr";LOCKFILE="rogue54.lck";%(PreprocessorDefinitions) - true - false - - - EnableFastChecks - MultiThreaded - true - true - false - true - - - - - Level4 - ProgramDatabase - CompileAsC - - - Ws2_32.lib;wincon\pdcurses.lib;libcurl_imp.lib;advapi32.lib;shfolder.lib;user32.lib;%(AdditionalDependencies) - $(OutDir)rogue54.exe - $(ProjectDir)x86_64-w64-msvc\deps\install\lib;$(ProjectDir)x86_64-w64-msvc\deps\install\Release\lib;%(AdditionalLibraryDirectories) - false - true - $(OutDir)rogue54.pdb - Console - - - - - MaxSpeed - OnlyExplicitInline - true - WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - MultiThreaded - true - NotUsing - Level3 - ProgramDatabase - $(ProjectDir)\x86_64-w64-msvc\include\ncursesw;$(ProjectDir)\x86_64-w64-msvc\include;%(AdditionalIncludeDirectories) - - - $(OutDir)rogue54.exe - true - Windows - true - true - MachineX86 - %(AdditionalLibraryDirectories) - %(AdditionalDependencies) - - - - - MaxSpeed - OnlyExplicitInline - true - WIN32;_WINDOWS;NDEBUG;PDC_DLL_BUILD;PDC_WIDE;PDCDEBUG;_CRT_SECURE_NO_DEPRECATE;ALLSCORES;SCOREFILE="rogue54.scr";LOCKFILE="rogue54.lck";%(PreprocessorDefinitions) - true - MultiThreaded - true - - - Level3 - ProgramDatabase - $(ProjectDir)x86_64-w64-msvc\deps\install\include;%(AdditionalIncludeDirectories) - stdafx.h - CompileAsC - - - - - $(OutDir)rogue54.exe - true - Console - true - true - $(ProjectDir)x86_64-w64-msvc\deps\install\lib;$(ProjectDir)x86_64-w64-msvc\deps\install\Release\lib;%(AdditionalLibraryDirectories) - Ws2_32.lib;wincon\pdcurses.lib;libcurl_imp.lib;advapi32.lib;shfolder.lib;user32.lib;%(AdditionalDependencies) - %(IgnoreSpecificDefaultLibraries) - false - %(ForceSymbolReferences) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/cc/rogue/rogue_build_msvc.cmd b/src/cc/rogue/rogue_build_msvc.cmd deleted file mode 100644 index 77e7cd852..000000000 --- a/src/cc/rogue/rogue_build_msvc.cmd +++ /dev/null @@ -1,64 +0,0 @@ -@echo off -echo Rogue Build Script by Decker (c) 2019 - -@REM Check for Visual Studio -call set "VSPATH=" -if defined VS140COMNTOOLS ( if not defined VSPATH ( - call set "VSPATH=%%VS140COMNTOOLS%%" -) ) - -@REM check if we already have the tools in the environment -if exist "%VCINSTALLDIR%" ( - goto compile -) - -if not defined VSPATH ( - echo You need Microsoft Visual Studio 15 installed - pause - exit -) - -@REM set up the environment -if exist "%VSPATH%..\..\vc\vcvarsall.bat" ( - call "%%VSPATH%%..\..\vc\vcvarsall.bat" amd64 - goto compile -) - -echo Unable to set up the environment -pause -exit - -:compile - -mkdir x86_64-w64-msvc\deps -mkdir x86_64-w64-msvc\deps\install - -pushd x86_64-w64-msvc\deps - -:compile_pdcurses -rem git clone https://github.com/wmcbrine/PDCurses PDCurses.org -git clone https://github.com/Bill-Gray/PDCurses - -set PREFIX_DIR=%CD%\install - -pushd PDCurses -mkdir build64 & pushd build64 -rem cmake -G"Visual Studio 14 2015 Win64" -DPDC_WIDE=ON -DCMAKE_INSTALL_PREFIX=%PREFIX_DIR% -DCMAKE_BUILD_TYPE=Debug -DPDCDEBUG=ON .. -cmake -G"Visual Studio 14 2015 Win64" -DPDC_WIDE=ON -DCMAKE_INSTALL_PREFIX=%PREFIX_DIR% -DCMAKE_BUILD_TYPE=Release .. -popd -rem cmake --build build64 --config Debug --target install -cmake --build build64 --config Release --target install -popd - -:compile_curl - -git clone https://github.com/curl/curl -pushd curl - -mkdir build64 & pushd build64 -cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX=%PREFIX_DIR% -DCMAKE_USE_WINSSL:BOOL=ON .. -cmake --build . --config Release --target libcurl -cmake --build . --config Release --target install -popd -popd - diff --git a/src/cc/rogue/rogue_player.h b/src/cc/rogue/rogue_player.h deleted file mode 100644 index 82003237c..000000000 --- a/src/cc/rogue/rogue_player.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/****************************************************************************** - * Copyright © 2014-2019 The SuperNET Developers. * - * * - * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * - * the top-level directory of this distribution for the individual copyright * - * holder information and the developer policies on copyright and licensing. * - * * - * Unless otherwise agreed in a custom licensing agreement, no part of the * - * SuperNET software, including this file may be copied, modified, propagated * - * or distributed except according to the terms contained in the LICENSE file * - * * - * Removal or modification of this copyright notice is prohibited. * - * * - ******************************************************************************/ - -#ifndef ROGUE_DECLARED_PACK -#define ROGUE_DECLARED_PACK - - -#define MAXPACK 23 -struct rogue_packitem -{ - int32_t type,launch,count,which,hplus,dplus,arm,flags,group; - char damage[8],hurldmg[8]; -}; -struct rogue_player -{ - int32_t gold,hitpoints,strength,level,experience,packsize,dungeonlevel,amulet; - struct rogue_packitem roguepack[MAXPACK]; -}; -int32_t rogue_replay2(uint8_t *newdata,uint64_t seed,char *keystrokes,int32_t num,struct rogue_player *player,int32_t sleepmillis); -void rogue_packitemstr(char *packitemstr,struct rogue_packitem *item); - -#endif - diff --git a/src/cc/rogue/rooms.c b/src/cc/rogue/rooms.c deleted file mode 100644 index b5109f466..000000000 --- a/src/cc/rogue/rooms.c +++ /dev/null @@ -1,479 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * Create the layout for the new level - * - * @(#)rooms.c 4.45 (Berkeley) 02/05/99 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -//#include -//#include -#include "rogue.h" - -typedef struct spot { /* position matrix for maze positions */ - int nexits; - coord exits[4]; - int used; -} SPOT; - -#define GOLDGRP 1 - -/* - * do_rooms: - * Create rooms and corridors with a connectivity graph - */ - -void -do_rooms(struct rogue_state *rs) -{ - int i; - struct room *rp; - THING *tp; - int left_out; - static coord top; - coord bsze; /* maximum room size */ - coord mp; - - bsze.x = NUMCOLS / 3; - bsze.y = NUMLINES / 3; - /* - * Clear things for a new level - */ - for (rp = rooms; rp < &rooms[MAXROOMS]; rp++) - { - rp->r_goldval = 0; - rp->r_nexits = 0; - rp->r_flags = 0; - } - /* - * Put the gone rooms, if any, on the level - */ - left_out = rnd(4); - for (i = 0; i < left_out; i++) - rooms[rnd_room()].r_flags |= ISGONE; - /* - * dig and populate all the rooms on the level - */ - for (i = 0, rp = rooms; i < MAXROOMS; rp++, i++) - { - /* - * Find upper left corner of box that this room goes in - */ - top.x = (i % 3) * bsze.x + 1; - top.y = (i / 3) * bsze.y; - if (rp->r_flags & ISGONE) - { - /* - * Place a gone room. Make certain that there is a blank line - * for passage drawing. - */ - do - { - rp->r_pos.x = top.x + rnd(bsze.x - 2) + 1; - rp->r_pos.y = top.y + rnd(bsze.y - 2) + 1; - rp->r_max.x = -NUMCOLS; - rp->r_max.y = -NUMLINES; - } until (rp->r_pos.y > 0 && rp->r_pos.y < NUMLINES-1); - continue; - } - /* - * set room type - */ - if (rnd(10) < level - 1) - { - rp->r_flags |= ISDARK; /* dark room */ - if (rnd(15) == 0) - rp->r_flags = ISMAZE; /* maze room */ - } - /* - * Find a place and size for a random room - */ - if (rp->r_flags & ISMAZE) - { - rp->r_max.x = bsze.x - 1; - rp->r_max.y = bsze.y - 1; - if ((rp->r_pos.x = top.x) == 1) - rp->r_pos.x = 0; - if ((rp->r_pos.y = top.y) == 0) - { - rp->r_pos.y++; - rp->r_max.y--; - } - } - else - do - { - rp->r_max.x = rnd(bsze.x - 4) + 4; - rp->r_max.y = rnd(bsze.y - 4) + 4; - rp->r_pos.x = top.x + rnd(bsze.x - rp->r_max.x); - rp->r_pos.y = top.y + rnd(bsze.y - rp->r_max.y); - } until (rp->r_pos.y != 0); - draw_room(rs,rp); - /* - * Put the gold in - */ - if (rnd(2) == 0 && (!amulet || level >= max_level)) - { - THING *gold; - - gold = new_item(); - gold->o_goldval = rp->r_goldval = GOLDCALC; - find_floor(rs,rp, &rp->r_gold, FALSE, FALSE); - gold->o_pos = rp->r_gold; - chat(rp->r_gold.y, rp->r_gold.x) = GOLD; - gold->o_flags = ISMANY; - gold->o_group = GOLDGRP; - gold->o_type = GOLD; - attach(lvl_obj, gold); - } - /* - * Put the monster in - */ - if (rnd(100) < (rp->r_goldval > 0 ? 80 : 25)) - { - tp = new_item(); - find_floor(rs,rp, &mp, FALSE, TRUE); - new_monster(rs,tp, randmonster(FALSE), &mp); - give_pack(rs,tp); - } - } -} - -/* - * draw_room: - * Draw a box around a room and lay down the floor for normal - * rooms; for maze rooms, draw maze. - */ - -void -draw_room(struct rogue_state *rs,struct room *rp) -{ - int y, x; - - if (rp->r_flags & ISMAZE) - do_maze(rs,rp); - else - { - vert(rp, rp->r_pos.x); /* Draw left side */ - vert(rp, rp->r_pos.x + rp->r_max.x - 1); /* Draw right side */ - horiz(rp, rp->r_pos.y); /* Draw top */ - horiz(rp, rp->r_pos.y + rp->r_max.y - 1); /* Draw bottom */ - - /* - * Put the floor down - */ - for (y = rp->r_pos.y + 1; y < rp->r_pos.y + rp->r_max.y - 1; y++) - for (x = rp->r_pos.x + 1; x < rp->r_pos.x + rp->r_max.x - 1; x++) - chat(y, x) = FLOOR; - } -} - -/* - * vert: - * Draw a vertical line - */ - -void -vert(struct room *rp, int startx) -{ - int y; - - for (y = rp->r_pos.y + 1; y <= rp->r_max.y + rp->r_pos.y - 1; y++) - chat(y, startx) = '|'; -} - -/* - * horiz: - * Draw a horizontal line - */ - -void -horiz(struct room *rp, int starty) -{ - int x; - - for (x = rp->r_pos.x; x <= rp->r_pos.x + rp->r_max.x - 1; x++) - chat(starty, x) = '-'; -} - -/* - * do_maze: - * Dig a maze - */ - -static int Maxy, Maxx, Starty, Startx; - -static SPOT maze[NUMLINES/3+1][NUMCOLS/3+1]; - - -void -do_maze(struct rogue_state *rs,struct room *rp) -{ - SPOT *sp; - int starty, startx; - static coord pos; - - for (sp = &maze[0][0]; sp <= &maze[NUMLINES / 3][NUMCOLS / 3]; sp++) - { - sp->used = FALSE; - sp->nexits = 0; - } - - Maxy = rp->r_max.y; - Maxx = rp->r_max.x; - Starty = rp->r_pos.y; - Startx = rp->r_pos.x; - starty = (rnd(rp->r_max.y) / 2) * 2; - startx = (rnd(rp->r_max.x) / 2) * 2; - pos.y = starty + Starty; - pos.x = startx + Startx; - putpass(&pos); - dig(rs,starty, startx); -} - -/* - * dig: - * Dig out from around where we are now, if possible - */ - -void -dig(struct rogue_state *rs,int y, int x) -{ - coord *cp; - int cnt, newy, newx, nexty = 0, nextx = 0; - static coord pos; - static coord del[4] = { - {2, 0}, {-2, 0}, {0, 2}, {0, -2} - }; - - for (;;) - { - if ( rs->replaydone != 0 ) - return; - cnt = 0; - for (cp = del; cp <= &del[3]; cp++) - { - newy = y + cp->y; - newx = x + cp->x; - if (newy < 0 || newy > Maxy || newx < 0 || newx > Maxx) - continue; - if (flat(newy + Starty, newx + Startx) & F_PASS) - continue; - if (rnd(++cnt) == 0) - { - nexty = newy; - nextx = newx; - } - } - if (cnt == 0) - return; - accnt_maze(y, x, nexty, nextx); - accnt_maze(nexty, nextx, y, x); - if (nexty == y) - { - pos.y = y + Starty; - if (nextx - x < 0) - pos.x = nextx + Startx + 1; - else - pos.x = nextx + Startx - 1; - } - else - { - pos.x = x + Startx; - if (nexty - y < 0) - pos.y = nexty + Starty + 1; - else - pos.y = nexty + Starty - 1; - } - putpass(&pos); - pos.y = nexty + Starty; - pos.x = nextx + Startx; - putpass(&pos); - dig(rs,nexty, nextx); - } -} - -/* - * accnt_maze: - * Account for maze exits - */ - -void -accnt_maze(int y, int x, int ny, int nx) -{ - SPOT *sp; - coord *cp; - - sp = &maze[y][x]; - for (cp = sp->exits; cp < &sp->exits[sp->nexits]; cp++) - if (cp->y == ny && cp->x == nx) - return; - cp->y = ny; - cp->x = nx; -} - -/* - * rnd_pos: - * Pick a random spot in a room - */ - -void -rnd_pos(struct room *rp, coord *cp) -{ - cp->x = rp->r_pos.x + rnd(rp->r_max.x - 2) + 1; - cp->y = rp->r_pos.y + rnd(rp->r_max.y - 2) + 1; -} - -/* - * find_floor: - * Find a valid floor spot in this room. If rp is NULL, then - * pick a new room each time around the loop. - */ -bool -find_floor(struct rogue_state *rs,struct room *rp, coord *cp, int limit, bool monst) -{ - PLACE *pp; - int cnt; - char compchar = 0; - bool pickroom; - - pickroom = (bool)(rp == NULL); - - if (!pickroom) - compchar = ((rp->r_flags & ISMAZE) ? PASSAGE : FLOOR); - cnt = limit; - for (;;) - { - if ( rs->replaydone != 0 ) - return(FALSE); - if (limit && cnt-- == 0) - return FALSE; - if (pickroom) - { - rp = &rooms[rnd_room()]; - compchar = ((rp->r_flags & ISMAZE) ? PASSAGE : FLOOR); - } - rnd_pos(rp, cp); - pp = INDEX(cp->y, cp->x); - if (monst) - { - if (pp->p_monst == NULL && step_ok(pp->p_ch)) - return TRUE; - } - else if (pp->p_ch == compchar) - return TRUE; - } -} - -/* - * enter_room: - * Code that is executed whenver you appear in a room - */ - -void -enter_room(struct rogue_state *rs,coord *cp) -{ - struct room *rp; - THING *tp; - int y, x; - char ch; - - rp = proom = roomin(rs,cp); - door_open(rs,rp); - if (!(rp->r_flags & ISDARK) && !on(player, ISBLIND)) - for (y = rp->r_pos.y; y < rp->r_max.y + rp->r_pos.y; y++) - { - move(y, rp->r_pos.x); - for (x = rp->r_pos.x; x < rp->r_max.x + rp->r_pos.x; x++) - { - tp = moat(y, x); - ch = chat(y, x); - if (tp == NULL) - if (CCHAR(inch()) != ch) - addch(ch); - else - move(y, x + 1); - else - { - tp->t_oldch = ch; - if (!see_monst(tp)) - if (on(player, SEEMONST)) - { - standout(); - addch(tp->t_disguise); - standend(); - } - else - addch(ch); - else - addch(tp->t_disguise); - } - } - } -} - -/* - * leave_room: - * Code for when we exit a room - */ - -void -leave_room(struct rogue_state *rs,coord *cp) -{ - PLACE *pp; - struct room *rp; - int y, x; - char floor; - char ch; - - rp = proom; - - if (rp->r_flags & ISMAZE) - return; - - if (rp->r_flags & ISGONE) - floor = PASSAGE; - else if (!(rp->r_flags & ISDARK) || on(player, ISBLIND)) - floor = FLOOR; - else - floor = ' '; - - proom = &passages[flat(cp->y, cp->x) & F_PNUM]; - for (y = rp->r_pos.y; y < rp->r_max.y + rp->r_pos.y; y++) - for (x = rp->r_pos.x; x < rp->r_max.x + rp->r_pos.x; x++) - { - move(y, x); - switch ( ch = CCHAR(inch()) ) - { - case FLOOR: - if (floor == ' ' && ch != ' ') - addch(' '); - break; - default: - /* - * to check for monster, we have to strip out - * standout bit - */ - if (isupper(toascii(ch))) - { - if (on(player, SEEMONST)) - { - standout(); - addch(ch); - standend(); - break; - } - pp = INDEX(y,x); - addch(pp->p_ch == DOOR ? DOOR : floor); - } - } - } - door_open(rs,rp); -} diff --git a/src/cc/rogue/save.c b/src/cc/rogue/save.c deleted file mode 100644 index cd11d9d54..000000000 --- a/src/cc/rogue/save.c +++ /dev/null @@ -1,465 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * save and restore routines - * - * @(#)save.c 4.33 (Berkeley) 06/01/83 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -//#include -//#include -//#include -//#include -//#include -//#include -//#include -#include "rogue.h" -#include "score.h" - -typedef struct stat STAT; - -extern char *version, *encstr; - -static STAT sbuf; - -/* - * save_game: - * Implement the "save game" command - */ - -void -save_game(struct rogue_state *rs) -{ - FILE *savef; - int c; - //auto - char buf[MAXSTR]; - - /* - * get file name - */ - mpos = 0; -over: - if (file_name[0] != '\0') - { - for (;;) - { - msg(rs,"save file (%s)? ", file_name); - c = readchar(rs); - mpos = 0; - if (c == ESCAPE) - { - msg(rs,""); - return; - } - else if (c == 'n' || c == 'N' || c == 'y' || c == 'Y') - break; - else - msg(rs,"please answer Y or N"); - } - if (c == 'y' || c == 'Y') - { - addstr("Yes\n"); - if ( rs->sleeptime != 0 ) - refresh(); - strcpy(buf, file_name); - goto gotfile; - } - } - - do - { - mpos = 0; - msg(rs,"file name: "); - buf[0] = '\0'; - if (get_str(rs,buf, stdscr) == QUIT) - { -quit_it: - msg(rs,""); - return; - } - mpos = 0; -gotfile: - /* - * test to see if the file exists - */ - if (stat(buf, &sbuf) >= 0) - { - for (;;) - { - msg(rs,"File exists. Do you wish to overwrite it?"); - mpos = 0; - if ((c = readchar(rs)) == ESCAPE) - goto quit_it; - if (c == 'y' || c == 'Y') - break; - else if (c == 'n' || c == 'N') - goto over; - else - msg(rs,"Please answer Y or N"); - } - msg(rs,"file name: %s", buf); - md_unlink(file_name); - } - strcpy(file_name, buf); - if ((savef = fopen(file_name, "w")) == NULL) - msg(rs,strerror(errno)); - } while (savef == NULL); - - save_file(rs,savef,1); - /* NOTREACHED */ -} - -/* - * auto_save: - * Automatically save a file. This is used if a HUP signal is - * recieved - */ - -void -auto_save(int sig) -{ - FILE *savef; - NOOP(sig); - - md_ignoreallsignals(); - if (file_name[0] != '\0' && ((savef = fopen(file_name, "w")) != NULL || - (md_unlink_open_file(file_name, savef) >= 0 && (savef = fopen(file_name, "w")) != NULL))) - save_file(&globalR,savef,1); - my_exit(0); -} - -/* - * save_file: - * Write the saved game on the file - */ - -char *rogue_packfname(struct rogue_state *rs,char *fname) -{ - sprintf(fname,"rogue.%llu.pack",(long long)rs->seed); - return(fname); -} - -void -save_file(struct rogue_state *rs,FILE *savef,int32_t guiflag) -{ - char buf[80],fname[512]; int32_t i,n,nonz,histo[0x100]; FILE *fp; - if ( rs->guiflag != 0 ) - { - mvcur(0, COLS - 1, LINES - 1, 0); - putchar('\n'); - endwin(); - resetltchars(); - md_chmod(file_name, 0400); - if ( guiflag != 0 ) - { - encwrite(version, strlen(version)+1, savef); - sprintf(buf,"%d x %d\n", LINES, COLS); - encwrite(buf,80,savef); - } - } - memset(&rs->P,0,sizeof(rs->P)); - rs_save_file(rs,savef); // sets rs->P - //fprintf(stderr,"gold.%d hp.%d strength.%d level.%d exp.%d %d\n",rs->P.gold,rs->P.hitpoints,rs->P.strength,rs->P.level,rs->P.experience,rs->P.dungeonlevel); - - n = sizeof(rs->P) - sizeof(rs->P.roguepack) + sizeof(rs->P.roguepack[0])*rs->P.packsize; - memset(histo,0,sizeof(histo)); - for (i=0; iP)[i]); - histo[((uint8_t *)&rs->P)[i]]++; - rs->playerdata[i] = ((uint8_t *)&rs->P)[i]; - } - rs->playersize = n; - //fprintf(stderr," packsize.%d playersize.%d\n",rs->P.packsize,n); - if ( (fp= fopen(rogue_packfname(rs,fname),"wb")) != 0 ) - { - fwrite(&rs->P,1,n,fp); - fclose(fp); - } - if ( 0 ) - { - for (i=nonz=0; i<0x100; i++) - if ( histo[i] != 0 ) - fprintf(stderr,"(%d %d) ",i,histo[i]), nonz++; - fprintf(stderr,"nonz.%d\n",nonz); - } - fflush(savef); - fclose(savef); - if ( guiflag != 0 ) - my_exit(0); -} - -int32_t rogue_restorepack(struct rogue_state *rs) -{ - FILE *fp; char fname[512]; int32_t retflag = -1; - memset(&rs->P,0,sizeof(rs->P)); - if ( (fp= fopen(rogue_packfname(rs,fname),"rb")) != 0 ) - { - if ( fread(&rs->P,1,sizeof(rs->P) - sizeof(rs->P.roguepack),fp) == sizeof(rs->P) - sizeof(rs->P.roguepack) ) - { - if ( rs->P.packsize > 0 && rs->P.packsize <= MAXPACK ) - { - if ( fread(&rs->P.roguepack,1,rs->P.packsize*sizeof(rs->P.roguepack[0]),fp) == rs->P.packsize*sizeof(rs->P.roguepack[0]) ) - { - fprintf(stderr,"roguepack[%d] restored\n",rs->P.packsize); - retflag = 0; - } - } - } - } - if ( retflag < 0 ) - memset(&rs->P,0,sizeof(rs->P)); - return(retflag); -} - -/* - * restore: - * Restore a saved game from a file with elaborate checks for file - * integrity from cheaters - */ -bool -restore(struct rogue_state *rs,char *file, char **envp) -{ - FILE *inf; - int syml,l, cols; - extern char **environ; - //auto - char buf[MAXSTR]; - //auto - STAT sbuf2; - if ( rs->guiflag == 0 ) - return(0); - - if (strcmp(file, "-r") == 0) - file = file_name; - - md_tstphold(); - - if ((inf = fopen(file,"r")) == NULL) - { - perror(file); - return FALSE; - } - stat(file, &sbuf2); - syml = is_symlink(file); - - fflush(stdout); - encread(buf, (unsigned) strlen(version) + 1, inf); - if (strcmp(buf, version) != 0) - { - printf("Sorry, saved game is out of date.\n"); - return FALSE; - } - encread(buf,80,inf); - sscanf(buf,"%d x %d\n", &l, &cols); - - initscr(); /* Start up cursor package */ - keypad(stdscr, 1); - - if (l > LINES) - { - endwin(); - printf("Sorry, original game was played on a screen with %d lines.\n",l); - printf("Current screen only has %d lines. Unable to restore game\n",LINES); - return(FALSE); - } - if (cols > COLS) - { - endwin(); - printf("Sorry, original game was played on a screen with %d columns.\n",cols); - printf("Current screen only has %d columns. Unable to restore game\n",COLS); - return(FALSE); - } - - hw = newwin(LINES, COLS, 0, 0); - setup(); - - rs_restore_file(inf); - /* - * we do not close the file so that we will have a hold of the - * inode for as long as possible - */ - - if ( -#ifdef MASTER - !wizard && -#endif - md_unlink_open_file(file, inf) < 0) - { - printf("Cannot unlink file\n"); - return FALSE; - } - mpos = 0; -/* printw(0, 0, "%s: %s", file, ctime(&sbuf2.st_mtime)); */ -/* - printw("%s: %s", file, ctime(&sbuf2.st_mtime)); -*/ - clearok(stdscr,TRUE); - /* - * defeat multiple restarting from the same place - */ -#ifdef MASTER - if (!wizard) -#endif - if (sbuf2.st_nlink != 1 || syml) - { - endwin(); - printf("\nCannot restore from a linked file\n"); - return FALSE; - } - - if (pstats.s_hpt <= 0) - { - endwin(); - printf("\n\"He's dead, Jim\"\n"); - return FALSE; - } - - md_tstpresume(); - - environ = envp; - strcpy(file_name, file); - clearok(curscr, TRUE); - srand((int32_t)rs->seed);//md_getpid()); - msg(rs,"file name: %s", file); - playit(rs); - /*NOTREACHED*/ - return(0); -} - -/* - * encwrite: - * Perform an encrypted write - */ -#define CRYPT_ENABLE 0 - -size_t -encwrite(char *start, size_t size, FILE *outf) -{ - char *e1, *e2, fb; - int temp; - extern char *statlist; - size_t o_size = size; - e1 = encstr; - e2 = statlist; - fb = 0; - - while(size) - { - if ( CRYPT_ENABLE ) - { - if (putc(*start++ ^ *e1 ^ *e2 ^ fb, outf) == EOF) - break; - - temp = *e1++; - fb = fb + ((char) (temp * *e2++)); - if (*e1 == '\0') - e1 = encstr; - if (*e2 == '\0') - e2 = statlist; - } - else if ( putc(*start++,outf) == EOF ) - break; - size--; - } - - return(o_size - size); -} - -/* - * encread: - * Perform an encrypted read - */ -size_t -encread(char *start, size_t size, FILE *inf) -{ - char *e1, *e2, fb; - int temp; - size_t read_size; - extern char *statlist; - - fb = 0; - - if ((read_size = fread(start,1,size,inf)) == 0 || read_size == -1) - return(read_size); - if ( CRYPT_ENABLE ) - { - e1 = encstr; - e2 = statlist; - while (size--) - { - *start++ ^= *e1 ^ *e2 ^ fb; - temp = *e1++; - fb = fb + (char)(temp * *e2++); - if (*e1 == '\0') - e1 = encstr; - if (*e2 == '\0') - e2 = statlist; - } - } - return(read_size); -} - -static char scoreline[100]; -/* - * read_scrore - * Read in the score file - */ -void -rd_score(SCORE *top_ten) -{ - unsigned int i; - - if (scoreboard == NULL) - return; - - rewind(scoreboard); - - for(i = 0; i < numscores; i++) - { - encread(top_ten[i].sc_name, MAXSTR, scoreboard); - encread(scoreline, 100, scoreboard); - sscanf(scoreline, " %u %d %u %hu %d %x \n", - &top_ten[i].sc_uid, &top_ten[i].sc_score, - &top_ten[i].sc_flags, &top_ten[i].sc_monster, - &top_ten[i].sc_level, &top_ten[i].sc_time); - } - - rewind(scoreboard); -} - -/* - * write_scrore - * Read in the score file - */ -void -wr_score(SCORE *top_ten) -{ - unsigned int i; - - if (scoreboard == NULL) - return; - - rewind(scoreboard); - - for(i = 0; i < numscores; i++) - { - memset(scoreline,0,100); - encwrite(top_ten[i].sc_name, MAXSTR, scoreboard); - sprintf(scoreline, " %u %d %u %hu %d %x \n", - top_ten[i].sc_uid, top_ten[i].sc_score, - top_ten[i].sc_flags, top_ten[i].sc_monster, - top_ten[i].sc_level, top_ten[i].sc_time); - encwrite(scoreline,100,scoreboard); - } - - rewind(scoreboard); -} diff --git a/src/cc/rogue/score.h b/src/cc/rogue/score.h deleted file mode 100644 index 8b3aa9cd1..000000000 --- a/src/cc/rogue/score.h +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * Score file structure - * - * @(#)score.h 4.6 (Berkeley) 02/05/99 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ -#ifndef H_SCORE_H -#define H_SCORE_H - -struct sc_ent { - unsigned int sc_uid; - int sc_score; - unsigned int sc_flags; - unsigned short sc_monster; - char sc_name[MAXSTR]; - int sc_level; - unsigned int sc_time; -}; - -typedef struct sc_ent SCORE; - -void rd_score(SCORE *top_ten); -void wr_score(SCORE *top_ten); -#endif diff --git a/src/cc/rogue/scrolls.c b/src/cc/rogue/scrolls.c deleted file mode 100644 index a06d4bb1e..000000000 --- a/src/cc/rogue/scrolls.c +++ /dev/null @@ -1,332 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * Read a scroll and let it happen - * - * @(#)scrolls.c 4.44 (Berkeley) 02/05/99 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -//#include -//#include -#include "rogue.h" - -/* - * read_scroll: - * Read a scroll from the pack and do the appropriate thing - */ - -void -read_scroll(struct rogue_state *rs) -{ - THING *obj; - PLACE *pp; - int y, x; - char ch; - int i; - bool discardit = FALSE; - struct room *cur_room; - THING *orig_obj; - static coord mp; - - obj = get_item(rs,"read", SCROLL); - if (obj == NULL) - return; - if (obj->o_type != SCROLL) - { - if (!terse) - msg(rs,"there is nothing on it to read"); - else - msg(rs,"nothing to read"); - return; - } - /* - * Calculate the effect it has on the poor guy. - */ - if (obj == cur_weapon) - cur_weapon = NULL; - /* - * Get rid of the thing - */ - discardit = (bool)(obj->o_count == 1); - leave_pack(rs,obj, FALSE, FALSE); - orig_obj = obj; - - switch (obj->o_which) - { - case S_CONFUSE: - /* - * Scroll of monster confusion. Give him that power. - */ - player.t_flags |= CANHUH; - msg(rs,"your hands begin to glow %s", pick_color("red")); - when S_ARMOR: - if (cur_armor != NULL) - { - cur_armor->o_arm--; - cur_armor->o_flags &= ~ISCURSED; - msg(rs,"your armor glows %s for a moment", pick_color("silver")); - } - when S_HOLD: - /* - * Hold monster scroll. Stop all monsters within two spaces - * from chasing after the hero. - */ - - ch = 0; - for (x = hero.x - 2; x <= hero.x + 2; x++) - if (x >= 0 && x < NUMCOLS) - for (y = hero.y - 2; y <= hero.y + 2; y++) - if (y >= 0 && y <= NUMLINES - 1) - if ((obj = moat(y, x)) != NULL && on(*obj, ISRUN)) - { - obj->t_flags &= ~ISRUN; - obj->t_flags |= ISHELD; - ch++; - } - if (ch) - { - addmsg(rs,"the monster"); - if (ch > 1) - addmsg(rs,"s around you"); - addmsg(rs," freeze"); - if (ch == 1) - addmsg(rs,"s"); - endmsg(rs); - scr_info[S_HOLD].oi_know = TRUE; - } - else - msg(rs,"you feel a strange sense of loss"); - when S_SLEEP: - /* - * Scroll which makes you fall asleep - */ - scr_info[S_SLEEP].oi_know = TRUE; - no_command += rnd(SLEEPTIME) + 4; - player.t_flags &= ~ISRUN; - msg(rs,"you fall asleep"); - when S_CREATE: - /* - * Create a monster: - * First look in a circle around him, next try his room - * otherwise give up - */ - i = 0; - for (y = hero.y - 1; y <= hero.y + 1; y++) - for (x = hero.x - 1; x <= hero.x + 1; x++) - /* - * Don't put a monster in top of the player. - */ - if (y == hero.y && x == hero.x) - continue; - /* - * Or anything else nasty - */ - else if (step_ok(ch = winat(y, x))) - { - if (ch == SCROLL - && find_obj(rs,y, x)->o_which == S_SCARE) - continue; - else if (rnd(++i) == 0) - { - mp.y = y; - mp.x = x; - } - } - if (i == 0) - msg(rs,"you hear a faint cry of anguish in the distance"); - else - { - obj = new_item(); - new_monster(rs,obj, randmonster(FALSE), &mp); - } - when S_ID_POTION: - case S_ID_SCROLL: - case S_ID_WEAPON: - case S_ID_ARMOR: - case S_ID_R_OR_S: - { - static char id_type[S_ID_R_OR_S + 1] = - { 0, 0, 0, 0, 0, POTION, SCROLL, WEAPON, ARMOR, R_OR_S }; - /* - * Identify, let him figure something out - */ - scr_info[obj->o_which].oi_know = TRUE; - msg(rs,"this scroll is an %s scroll", scr_info[obj->o_which].oi_name); - whatis(rs,TRUE, id_type[obj->o_which]); - } - when S_MAP: - /* - * Scroll of magic mapping. - */ - scr_info[S_MAP].oi_know = TRUE; - msg(rs,"oh, now this scroll has a map on it"); - /* - * take all the things we want to keep hidden out of the window - */ - for (y = 1; y < NUMLINES - 1; y++) - for (x = 0; x < NUMCOLS; x++) - { - pp = INDEX(y, x); - switch (ch = pp->p_ch) - { - case DOOR: - case STAIRS: - break; - - case '-': - case '|': - if (!(pp->p_flags & F_REAL)) - { - ch = pp->p_ch = DOOR; - pp->p_flags |= F_REAL; - } - break; - - case ' ': - if (pp->p_flags & F_REAL) - goto def; - pp->p_flags |= F_REAL; - ch = pp->p_ch = PASSAGE; - /* FALLTHROUGH */ - - case PASSAGE: -pass: - if (!(pp->p_flags & F_REAL)) - pp->p_ch = PASSAGE; - pp->p_flags |= (F_SEEN|F_REAL); - ch = PASSAGE; - break; - - case FLOOR: - if (pp->p_flags & F_REAL) - ch = ' '; - else - { - ch = TRAP; - pp->p_ch = TRAP; - pp->p_flags |= (F_SEEN|F_REAL); - } - break; - - default: -def: - if (pp->p_flags & F_PASS) - goto pass; - ch = ' '; - break; - } - if (ch != ' ') - { - if ((obj = pp->p_monst) != NULL) - obj->t_oldch = ch; - if (obj == NULL || !on(player, SEEMONST)) - mvaddch(y, x, ch); - } - } - when S_FDET: - /* - * Potion of gold detection - */ - ch = FALSE; - wclear(hw); - for (obj = lvl_obj; obj != NULL; obj = next(obj)) - if (obj->o_type == FOOD) - { - ch = TRUE; - wmove(hw, obj->o_pos.y, obj->o_pos.x); - waddch(hw, FOOD); - } - if (ch) - { - scr_info[S_FDET].oi_know = TRUE; - show_win(rs,"Your nose tingles and you smell food.--More--"); - } - else - msg(rs,"your nose tingles"); - when S_TELEP: - /* - * Scroll of teleportation: - * Make him dissapear and reappear - */ - { - cur_room = proom; - teleport(rs); - if (cur_room != proom) - scr_info[S_TELEP].oi_know = TRUE; - } - when S_ENCH: - if (cur_weapon == NULL || cur_weapon->o_type != WEAPON) - msg(rs,"you feel a strange sense of loss"); - else - { - cur_weapon->o_flags &= ~ISCURSED; - if (rnd(2) == 0) - cur_weapon->o_hplus++; - else - cur_weapon->o_dplus++; - msg(rs,"your %s glows %s for a moment", - weap_info[cur_weapon->o_which].oi_name, pick_color("blue")); - } - when S_SCARE: - /* - * Reading it is a mistake and produces laughter at her - * poor boo boo. - */ - msg(rs,"you hear maniacal laughter in the distance"); - when S_REMOVE: - uncurse(cur_armor); - uncurse(cur_weapon); - uncurse(cur_ring[LEFT]); - uncurse(cur_ring[RIGHT]); - msg(rs,choose_str("you feel in touch with the Universal Onenes", - "you feel as if somebody is watching over you")); - when S_AGGR: - /* - * This scroll aggravates all the monsters on the current - * level and sets them running towards the hero - */ - aggravate(rs); - msg(rs,"you hear a high pitched humming noise"); - when S_PROTECT: - if (cur_armor != NULL) - { - cur_armor->o_flags |= ISPROT; - msg(rs,"your armor is covered by a shimmering %s shield", - pick_color("gold")); - } - else - msg(rs,"you feel a strange sense of loss"); -#ifdef MASTER - otherwise: - msg(rs,"what a puzzling scroll!"); - return; -#endif - } - obj = orig_obj; - look(rs,TRUE); /* put the result of the scroll on the screen */ - status(rs); - - call_it(rs,&scr_info[obj->o_which]); - - if (discardit) - discard(obj); -} - -/* - * uncurse: - * Uncurse an item - */ - -void -uncurse(THING *obj) -{ - if (obj != NULL) - obj->o_flags &= ~ISCURSED; -} diff --git a/src/cc/rogue/state.c b/src/cc/rogue/state.c deleted file mode 100644 index c2753145f..000000000 --- a/src/cc/rogue/state.c +++ /dev/null @@ -1,2278 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - state.c - Portable Rogue Save State Code - - Copyright (C) 1999, 2000, 2005 Nicholas J. Kisseberth - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. Neither the name(s) of the author(s) nor the names of other contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE. -*/ - -//#include -//#include -//#include -#include "rogue.h" - -/************************************************************************/ -/* Save State Code */ -/************************************************************************/ - -#define RSID_STATS 0xABCD0001 -#define RSID_THING 0xABCD0002 -#define RSID_THING_NULL 0xDEAD0002 -#define RSID_OBJECT 0xABCD0003 -#define RSID_MAGICITEMS 0xABCD0004 -#define RSID_KNOWS 0xABCD0005 -#define RSID_GUESSES 0xABCD0006 -#define RSID_OBJECTLIST 0xABCD0007 -#define RSID_BAGOBJECT 0xABCD0008 -#define RSID_MONSTERLIST 0xABCD0009 -#define RSID_MONSTERSTATS 0xABCD000A -#define RSID_MONSTERS 0xABCD000B -#define RSID_TRAP 0xABCD000C -#define RSID_WINDOW 0xABCD000D -#define RSID_DAEMONS 0xABCD000E -#define RSID_IWEAPS 0xABCD000F -#define RSID_IARMOR 0xABCD0010 -#define RSID_SPELLS 0xABCD0011 -#define RSID_ILIST 0xABCD0012 -#define RSID_HLIST 0xABCD0013 -#define RSID_DEATHTYPE 0xABCD0014 -#define RSID_CTYPES 0XABCD0015 -#define RSID_COORDLIST 0XABCD0016 -#define RSID_ROOMS 0XABCD0017 - -#define READSTAT (format_error || read_error ) -#define WRITESTAT (write_error) - -static int read_error = FALSE; -static int write_error = FALSE; -static int format_error = FALSE; -static int endian = 0x01020304; -#define big_endian ( *((char *)&endian) == 0x01 ) - -int -rs_write(FILE *savef, void *ptr, size_t size) -{ - if (write_error) - return(WRITESTAT); - - if (encwrite((char *)ptr, size, savef) != size) - write_error = 1; - - return(WRITESTAT); -} - -int -rs_read(FILE *inf, void *ptr, size_t size) -{ - if (read_error || format_error) - return(READSTAT); - - if (encread((char *)ptr, size, inf) != size) - read_error = 1; - - return(READSTAT); -} - -int -rs_write_int(FILE *savef, int32_t c) -{ - unsigned char bytes[4]; - unsigned char *buf = (unsigned char *) &c; - - if (write_error) - return(WRITESTAT); - - if (big_endian) - { - bytes[3] = buf[0]; - bytes[2] = buf[1]; - bytes[1] = buf[2]; - bytes[0] = buf[3]; - buf = bytes; - } - - rs_write(savef, buf, 4); - - return(WRITESTAT); -} - -int -rs_read_int(FILE *inf, int32_t *i) -{ - unsigned char bytes[4]; - int input = 0; - unsigned char *buf = (unsigned char *)&input; - - if (read_error || format_error) - return(READSTAT); - - rs_read(inf, &input, 4); - - if (big_endian) - { - bytes[3] = buf[0]; - bytes[2] = buf[1]; - bytes[1] = buf[2]; - bytes[0] = buf[3]; - buf = bytes; - } - - *i = *((int *) buf); - - return(READSTAT); -} - -int -rs_write_char(FILE *savef, char c) -{ - if (write_error) - return(WRITESTAT); - - rs_write(savef, &c, 1); - - return(WRITESTAT); -} - -int -rs_read_char(FILE *inf, char *c) -{ - if (read_error || format_error) - return(READSTAT); - - rs_read(inf, c, 1); - - return(READSTAT); -} - -int -rs_write_chars(FILE *savef, char *c, int count) -{ - if (write_error) - return(WRITESTAT); - - rs_write_int(savef, count); - rs_write(savef, c, count); - - return(WRITESTAT); -} - -int -rs_read_chars(FILE *inf, char *i, int count) -{ - int value = 0; - - if (read_error || format_error) - return(READSTAT); - - rs_read_int(inf, &value); - - if (value != count) - format_error = TRUE; - - rs_read(inf, i, count); - - return(READSTAT); -} - -int -rs_write_ints(FILE *savef, int32_t *c, int count) -{ - int n = 0; - - if (write_error) - return(WRITESTAT); - - rs_write_int(savef, count); - - for(n = 0; n < count; n++) - if( rs_write_int(savef,c[n]) != 0) - break; - - return(WRITESTAT); -} - -int -rs_read_ints(FILE *inf, int32_t *i, int count) -{ - int n, value; - - if (read_error || format_error) - return(READSTAT); - - rs_read_int(inf,&value); - - if (value != count) - format_error = TRUE; - - for(n = 0; n < count; n++) - if (rs_read_int(inf, &i[n]) != 0) - break; - - return(READSTAT); -} - -int -rs_write_boolean(FILE *savef, int c) -{ - unsigned char buf = (c == 0) ? 0 : 1; - - if (write_error) - return(WRITESTAT); - - rs_write(savef, &buf, 1); - - return(WRITESTAT); -} - -int -rs_read_boolean(FILE *inf, bool *i) -{ - unsigned char buf = 0; - - if (read_error || format_error) - return(READSTAT); - - rs_read(inf, &buf, 1); - - *i = (buf != 0); - - return(READSTAT); -} - -int -rs_write_booleans(FILE *savef, bool *c, int count) -{ - int n = 0; - - if (write_error) - return(WRITESTAT); - - rs_write_int(savef, count); - - for(n = 0; n < count; n++) - if (rs_write_boolean(savef, c[n]) != 0) - break; - - return(WRITESTAT); -} - -int -rs_read_booleans(FILE *inf, bool *i, int count) -{ - int n = 0, value = 0; - - if (read_error || format_error) - return(READSTAT); - - rs_read_int(inf,&value); - - if (value != count) - format_error = TRUE; - - for(n = 0; n < count; n++) - if (rs_read_boolean(inf, &i[n]) != 0) - break; - - return(READSTAT); -} - -int -rs_write_short(FILE *savef, int16_t c) -{ - unsigned char bytes[2]; - unsigned char *buf = (unsigned char *) &c; - - if (write_error) - return(WRITESTAT); - - if (big_endian) - { - bytes[1] = buf[0]; - bytes[0] = buf[1]; - buf = bytes; - } - - rs_write(savef, buf, 2); - - return(WRITESTAT); -} - -int -rs_read_short(FILE *inf, int16_t *i) -{ - unsigned char bytes[2]; - short input; - unsigned char *buf = (unsigned char *)&input; - - if (read_error || format_error) - return(READSTAT); - - rs_read(inf, &input, 2); - - if (big_endian) - { - bytes[1] = buf[0]; - bytes[0] = buf[1]; - buf = bytes; - } - - *i = *((short *) buf); - - return(READSTAT); -} - -int -rs_write_shorts(FILE *savef, int16_t *c, int count) -{ - int n = 0; - - if (write_error) - return(WRITESTAT); - - rs_write_int(savef, count); - - for(n = 0; n < count; n++) - if (rs_write_short(savef, c[n]) != 0) - break; - - return(WRITESTAT); -} - -int -rs_read_shorts(FILE *inf, int16_t *i, int count) -{ - int n = 0, value = 0; - - if (read_error || format_error) - return(READSTAT); - - rs_read_int(inf,&value); - - if (value != count) - format_error = TRUE; - - for(n = 0; n < value; n++) - if (rs_read_short(inf, &i[n]) != 0) - break; - - return(READSTAT); -} - -int -rs_write_ushort(FILE *savef, uint16_t c) -{ - unsigned char bytes[2]; - unsigned char *buf = (unsigned char *) &c; - - if (write_error) - return(WRITESTAT); - - if (big_endian) - { - bytes[1] = buf[0]; - bytes[0] = buf[1]; - buf = bytes; - } - - rs_write(savef, buf, 2); - - return(WRITESTAT); -} - -int -rs_read_ushort(FILE *inf, uint16_t *i) -{ - unsigned char bytes[2]; - unsigned short input; - unsigned char *buf = (unsigned char *)&input; - - if (read_error || format_error) - return(READSTAT); - - rs_read(inf, &input, 2); - - if (big_endian) - { - bytes[1] = buf[0]; - bytes[0] = buf[1]; - buf = bytes; - } - - *i = *((unsigned short *) buf); - - return(READSTAT); -} - -int -rs_write_uint(FILE *savef, uint32_t c) -{ - unsigned char bytes[4]; - unsigned char *buf = (unsigned char *) &c; - - if (write_error) - return(WRITESTAT); - - if (big_endian) - { - bytes[3] = buf[0]; - bytes[2] = buf[1]; - bytes[1] = buf[2]; - bytes[0] = buf[3]; - buf = bytes; - } - - rs_write(savef, buf, 4); - - return(WRITESTAT); -} - -int -rs_read_uint(FILE *inf, uint32_t *i) -{ - unsigned char bytes[4]; - int input; - unsigned char *buf = (unsigned char *)&input; - - if (read_error || format_error) - return(READSTAT); - - rs_read(inf, &input, 4); - - if (big_endian) - { - bytes[3] = buf[0]; - bytes[2] = buf[1]; - bytes[1] = buf[2]; - bytes[0] = buf[3]; - buf = bytes; - } - - *i = *((unsigned int *) buf); - - return(READSTAT); -} - -int -rs_write_marker(FILE *savef, int32_t id) -{ - if (write_error) - return(WRITESTAT); - - rs_write_int(savef, id); - - return(WRITESTAT); -} - -int -rs_read_marker(FILE *inf, int32_t id) -{ - int nid; - - if (read_error || format_error) - return(READSTAT); - - if (rs_read_int(inf, &nid) == 0) - if (id != nid) - format_error = 1; - - return(READSTAT); -} - - - -/******************************************************************************/ - -int -rs_write_string(FILE *savef, char *s) -{ - int len = 0; - - if (write_error) - return(WRITESTAT); - - len = (s == NULL) ? 0 : (int) strlen(s) + 1; - - rs_write_int(savef, len); - rs_write_chars(savef, s, len); - - return(WRITESTAT); -} - -int -rs_read_string(FILE *inf, char *s, int max) -{ - int len = 0; - - if (read_error || format_error) - return(READSTAT); - - rs_read_int(inf, &len); - - if (len > max) - format_error = TRUE; - - rs_read_chars(inf, s, len); - - return(READSTAT); -} - -int -rs_read_new_string(FILE *inf, char **s) -{ - int len=0; - char *buf=0; - - if (read_error || format_error) - return(READSTAT); - - rs_read_int(inf, &len); - - if (len == 0) - buf = NULL; - else - { - buf = (char *)malloc(len); - - if (buf == NULL) - read_error = TRUE; - } - - rs_read_chars(inf, buf, len); - - *s = buf; - - return(READSTAT); -} - -int -rs_write_strings(FILE *savef, char *s[], int count) -{ - int n = 0; - - if (write_error) - return(WRITESTAT); - - rs_write_int(savef, count); - - for(n = 0; n < count; n++) - if (rs_write_string(savef, s[n]) != 0) - break; - - return(WRITESTAT); -} - -int -rs_read_strings(FILE *inf, char **s, int count, int max) -{ - int n = 0; - int value = 0; - - if (read_error || format_error) - return(READSTAT); - - rs_read_int(inf, &value); - - if (value != count) - format_error = TRUE; - - for(n = 0; n < count; n++) - if (rs_read_string(inf, s[n], max) != 0) - break; - - return(READSTAT); -} - -int -rs_read_new_strings(FILE *inf, char **s, int count) -{ - int n = 0; - int value = 0; - - if (read_error || format_error) - return(READSTAT); - - rs_read_int(inf, &value); - - if (value != count) - format_error = TRUE; - - for(n = 0; n < count; n++) - if (rs_read_new_string(inf, &s[n]) != 0) - break; - - return(READSTAT); -} - -int -rs_write_string_index(FILE *savef, char *master[], int max, const char *str) -{ - int i; - - if (write_error) - return(WRITESTAT); - - for(i = 0; i < max; i++) - if (str == master[i]) - return( rs_write_int(savef, i) ); - - return( rs_write_int(savef,-1) ); -} - -int -rs_read_string_index(FILE *inf, char *master[], int maxindex, char **str) -{ - int i; - - if (read_error || format_error) - return(READSTAT); - - rs_read_int(inf, &i); - - if (i > maxindex) - format_error = TRUE; - else if (i >= 0) - *str = master[i]; - else - *str = NULL; - - return(READSTAT); -} - -int -rs_write_str_t(FILE *savef, str_t st) -{ - if (write_error) - return(WRITESTAT); - - rs_write_uint(savef, st); - - return( WRITESTAT ); -} - -int -rs_read_str_t(FILE *inf, str_t *st) -{ - if (read_error || format_error) - return(READSTAT); - - rs_read_uint(inf, st); - - return(READSTAT); -} - -int -rs_write_coord(FILE *savef, coord c) -{ - if (write_error) - return(WRITESTAT); - - rs_write_int(savef, c.x); - rs_write_int(savef, c.y); - - return(WRITESTAT); -} - -int -rs_read_coord(FILE *inf, coord *c) -{ - coord in; - - if (read_error || format_error) - return(READSTAT); - - rs_read_int(inf,&in.x); - rs_read_int(inf,&in.y); - - if (READSTAT == 0) - { - c->x = in.x; - c->y = in.y; - } - - return(READSTAT); -} - -int -rs_write_window(FILE *savef, WINDOW *win) -{ - int row,col,height,width; - - if (write_error) - return(WRITESTAT); - - width = getmaxx(win); - height = getmaxy(win); - - rs_write_marker(savef,RSID_WINDOW); - rs_write_int(savef,height); - rs_write_int(savef,width); - - for(row=0;rowl_next) - if (count == i) - return(l); - - return(NULL); -} - -int -find_list_ptr(THING *l, void *ptr) -{ - int count; - - for(count = 0; l != NULL; count++, l = l->l_next) - if (l == ptr) - return(count); - - return(-1); -} - -int -list_size(THING *l) -{ - int count; - - for(count = 0; l != NULL; count++, l = l->l_next) - ; - - return(count); -} - -/******************************************************************************/ - -int -rs_write_stats(FILE *savef, struct stats *s) -{ - if (write_error) - return(WRITESTAT); - - rs_write_marker(savef, RSID_STATS); - rs_write_str_t(savef, s->s_str); - rs_write_int(savef, s->s_exp); - rs_write_int(savef, s->s_lvl); - rs_write_int(savef, s->s_arm); - rs_write_int(savef, s->s_hpt); - rs_write_chars(savef, s->s_dmg, sizeof(s->s_dmg)); - rs_write_int(savef,s->s_maxhp); - - return(WRITESTAT); -} - -int -rs_read_stats(FILE *inf, struct stats *s) -{ - if (read_error || format_error) - return(READSTAT); - - rs_read_marker(inf, RSID_STATS); - rs_read_str_t(inf,&s->s_str); - rs_read_int(inf,&s->s_exp); - rs_read_int(inf,&s->s_lvl); - rs_read_int(inf,&s->s_arm); - rs_read_int(inf,&s->s_hpt); - rs_read_chars(inf,s->s_dmg,sizeof(s->s_dmg)); - rs_read_int(inf,&s->s_maxhp); - - return(READSTAT); -} - -int -rs_write_stone_index(FILE *savef, STONE master[], int max, const char *str) -{ - int i; - - if (write_error) - return(WRITESTAT); - - for(i = 0; i < max; i++) - if (str == master[i].st_name) - { - rs_write_int(savef,i); - return(WRITESTAT); - } - - rs_write_int(savef,-1); - - return(WRITESTAT); -} - -int -rs_read_stone_index(FILE *inf, STONE master[], int maxindex, char **str) -{ - int i = 0; - - if (read_error || format_error) - return(READSTAT); - - rs_read_int(inf,&i); - - if (i > maxindex) - format_error = TRUE; - else if (i >= 0) - *str = master[i].st_name; - else - *str = NULL; - - return(READSTAT); -} - -int -rs_write_scrolls(FILE *savef) -{ - int i; - - if (write_error) - return(WRITESTAT); - - for(i = 0; i < MAXSCROLLS; i++) - rs_write_string(savef, (char *)s_names[i]); - - return(READSTAT); -} - -int -rs_read_scrolls(FILE *inf) -{ - int i; - - if (read_error || format_error) - return(READSTAT); - - for(i = 0; i < MAXSCROLLS; i++) - rs_read_new_string(inf, (char **)&s_names[i]); - - return(READSTAT); -} - -int -rs_write_potions(FILE *savef) -{ - int i; - - if (write_error) - return(WRITESTAT); - - for(i = 0; i < MAXPOTIONS; i++) - rs_write_string_index(savef, (char **)rainbow, cNCOLORS, (char *)p_colors[i]); - - return(WRITESTAT); -} - -int -rs_read_potions(FILE *inf) -{ - int i; - - if (read_error || format_error) - return(READSTAT); - - for(i = 0; i < MAXPOTIONS; i++) - rs_read_string_index(inf, (char **)rainbow, cNCOLORS, (char **)&p_colors[i]); - - return(READSTAT); -} - -int -rs_write_rings(FILE *savef) -{ - int i; - - if (write_error) - return(WRITESTAT); - - for(i = 0; i < MAXRINGS; i++) - rs_write_stone_index(savef, (STONE *)stones, cNSTONES, (char *)r_stones[i]); - - return(WRITESTAT); -} - -int -rs_read_rings(FILE *inf) -{ - int i; - - if (read_error || format_error) - return(READSTAT); - - for(i = 0; i < MAXRINGS; i++) - rs_read_stone_index(inf, (STONE *)stones, cNSTONES, (char **)&r_stones[i]); - - return(READSTAT); -} - -int -rs_write_sticks(FILE *savef) -{ - int i; - - if (write_error) - return(WRITESTAT); - - for (i = 0; i < MAXSTICKS; i++) - { - if (strcmp(ws_type[i],"staff") == 0) - { - rs_write_int(savef,0); - rs_write_string_index(savef, (char **)wood, cNWOOD, (char *)ws_made[i]); - } - else - { - rs_write_int(savef,1); - rs_write_string_index(savef, (char **)metal, cNMETAL, (char *)ws_made[i]); - } - } - - return(WRITESTAT); -} - -int -rs_read_sticks(FILE *inf) -{ - int i = 0, list = 0; - - if (read_error || format_error) - return(READSTAT); - - for(i = 0; i < MAXSTICKS; i++) - { - rs_read_int(inf,&list); - - if (list == 0) - { - rs_read_string_index(inf, (char **)wood, cNWOOD, (char **)&ws_made[i]); - ws_type[i] = "staff"; - } - else - { - rs_read_string_index(inf, (char **)metal, cNMETAL, (char **)&ws_made[i]); - ws_type[i] = "wand"; - } - } - - return(READSTAT); -} - -int -rs_write_daemons(FILE *savef, struct delayed_action *d_list, int count) -{ - int i = 0; - int func = 0; - - if (write_error) - return(WRITESTAT); - - rs_write_marker(savef, RSID_DAEMONS); - rs_write_int(savef, count); - - for(i = 0; i < count; i++) - { - if (d_list[i].d_func == rollwand) - func = 1; - else if (d_list[i].d_func == doctor) - func = 2; - else if (d_list[i].d_func == stomach) - func = 3; - else if (d_list[i].d_func == runners) - func = 4; - else if (d_list[i].d_func == swander) - func = 5; - else if (d_list[i].d_func == nohaste) - func = 6; - else if (d_list[i].d_func == unconfuse) - func = 7; - else if (d_list[i].d_func == unsee) - func = 8; - else if (d_list[i].d_func == sight) - func = 9; - else if (d_list[i].d_func == NULL) - func = 0; - else - func = -1; - - rs_write_int(savef, d_list[i].d_type); - rs_write_int(savef, func); - rs_write_int(savef, d_list[i].d_arg); - rs_write_int(savef, d_list[i].d_time); - } - - return(WRITESTAT); -} - -int -rs_read_daemons(FILE *inf, struct delayed_action *d_list, int count) -{ - int i = 0; - int func = 0; - int value = 0; - - if (read_error || format_error) - return(READSTAT); - - rs_read_marker(inf, RSID_DAEMONS); - rs_read_int(inf, &value); - - if (value > count) - format_error = TRUE; - - for(i=0; i < count; i++) - { - func = 0; - rs_read_int(inf, &d_list[i].d_type); - rs_read_int(inf, &func); - rs_read_int(inf, &d_list[i].d_arg); - rs_read_int(inf, &d_list[i].d_time); - - switch(func) - { - case 1: d_list[i].d_func = rollwand; - break; - case 2: d_list[i].d_func = doctor; - break; - case 3: d_list[i].d_func = stomach; - break; - case 4: d_list[i].d_func = runners; - break; - case 5: d_list[i].d_func = swander; - break; - case 6: d_list[i].d_func = nohaste; - break; - case 7: d_list[i].d_func = unconfuse; - break; - case 8: d_list[i].d_func = unsee; - break; - case 9: d_list[i].d_func = sight; - break; - default:d_list[i].d_func = NULL; - break; - } - } - - if (d_list[i].d_func == NULL) - { - d_list[i].d_type = 0; - d_list[i].d_arg = 0; - d_list[i].d_time = 0; - } - - return(READSTAT); -} - -int -rs_write_obj_info(FILE *savef, struct obj_info *i, int count) -{ - int n; - - if (write_error) - return(WRITESTAT); - - rs_write_marker(savef, RSID_MAGICITEMS); - rs_write_int(savef, count); - - for(n = 0; n < count; n++) - { - /* mi_name is constant, defined at compile time in all cases */ - rs_write_int(savef,i[n].oi_prob); - rs_write_int(savef,i[n].oi_worth); - rs_write_string(savef,i[n].oi_guess); - rs_write_boolean(savef,i[n].oi_know); - } - - return(WRITESTAT); -} - -int -rs_read_obj_info(FILE *inf, struct obj_info *mi, int count) -{ - int n; - int value; - - if (read_error || format_error) - return(READSTAT); - - rs_read_marker(inf, RSID_MAGICITEMS); - - rs_read_int(inf, &value); - - if (value > count) - format_error = TRUE; - - for(n = 0; n < value; n++) - { - /* mi_name is const, defined at compile time in all cases */ - rs_read_int(inf,&mi[n].oi_prob); - rs_read_int(inf,&mi[n].oi_worth); - rs_read_new_string(inf,&mi[n].oi_guess); - rs_read_boolean(inf,&mi[n].oi_know); - } - - return(READSTAT); -} - -int -rs_write_room(FILE *savef, struct room *r) -{ - if (write_error) - return(WRITESTAT); - - rs_write_coord(savef, r->r_pos); - rs_write_coord(savef, r->r_max); - rs_write_coord(savef, r->r_gold); - rs_write_int(savef, r->r_goldval); - rs_write_short(savef, r->r_flags); - rs_write_int(savef, r->r_nexits); - rs_write_coord(savef, r->r_exit[0]); - rs_write_coord(savef, r->r_exit[1]); - rs_write_coord(savef, r->r_exit[2]); - rs_write_coord(savef, r->r_exit[3]); - rs_write_coord(savef, r->r_exit[4]); - rs_write_coord(savef, r->r_exit[5]); - rs_write_coord(savef, r->r_exit[6]); - rs_write_coord(savef, r->r_exit[7]); - rs_write_coord(savef, r->r_exit[8]); - rs_write_coord(savef, r->r_exit[9]); - rs_write_coord(savef, r->r_exit[10]); - rs_write_coord(savef, r->r_exit[11]); - - return(WRITESTAT); -} - -int -rs_read_room(FILE *inf, struct room *r) -{ - if (read_error || format_error) - return(READSTAT); - - rs_read_coord(inf,&r->r_pos); - rs_read_coord(inf,&r->r_max); - rs_read_coord(inf,&r->r_gold); - rs_read_int(inf,&r->r_goldval); - rs_read_short(inf,&r->r_flags); - rs_read_int(inf,&r->r_nexits); - rs_read_coord(inf,&r->r_exit[0]); - rs_read_coord(inf,&r->r_exit[1]); - rs_read_coord(inf,&r->r_exit[2]); - rs_read_coord(inf,&r->r_exit[3]); - rs_read_coord(inf,&r->r_exit[4]); - rs_read_coord(inf,&r->r_exit[5]); - rs_read_coord(inf,&r->r_exit[6]); - rs_read_coord(inf,&r->r_exit[7]); - rs_read_coord(inf,&r->r_exit[8]); - rs_read_coord(inf,&r->r_exit[9]); - rs_read_coord(inf,&r->r_exit[10]); - rs_read_coord(inf,&r->r_exit[11]); - - return(READSTAT); -} - -int -rs_write_rooms(FILE *savef, struct room r[], int count) -{ - int n = 0; - - if (write_error) - return(WRITESTAT); - //fprintf(stderr,"rooms %ld -> ",ftell(savef)); - rs_write_int(savef, count); - - for(n = 0; n < count; n++) - rs_write_room(savef, &r[n]); - //fprintf(stderr,"%ld\n",ftell(savef)); - - return(WRITESTAT); -} - -int -rs_read_rooms(FILE *inf, struct room *r, int count) -{ - int value = 0, n = 0; - - if (read_error || format_error) - return(READSTAT); - - rs_read_int(inf,&value); - - if (value > count) - format_error = TRUE; - - for(n = 0; n < value; n++) - rs_read_room(inf,&r[n]); - - return(READSTAT); -} - -int -rs_write_room_reference(FILE *savef, struct room *rp) -{ - int i, room = -1; - - if (write_error) - return(WRITESTAT); - - for (i = 0; i < MAXROOMS; i++) - if (&rooms[i] == rp) - room = i; - - rs_write_int(savef, room); - - return(WRITESTAT); -} - -int -rs_read_room_reference(FILE *inf, struct room **rp) -{ - int i; - - if (read_error || format_error) - return(READSTAT); - - rs_read_int(inf, &i); - - *rp = &rooms[i]; - - return(READSTAT); -} - -int -rs_write_monsters(FILE *savef, struct monster *m, int count) -{ - int n; - - if (write_error) - return(WRITESTAT); - - rs_write_marker(savef, RSID_MONSTERS); - rs_write_int(savef, count); - - for(n=0;ntype != AMULET ) - { - o->_o._o_type = item->type; - o->_o._o_launch = item->launch; - memcpy(o->_o._o_damage,item->damage,sizeof(item->damage)); - memcpy(o->_o._o_hurldmg,item->hurldmg,sizeof(item->hurldmg)); - o->_o._o_count = item->count; - o->_o._o_which = item->which; - o->_o._o_hplus = item->hplus; - o->_o._o_dplus = item->dplus; - o->_o._o_arm = item->arm; - o->_o._o_flags = item->flags; - o->_o._o_group = item->group; - o->o_flags |= ISKNOW; - o->o_flags &= ~ISFOUND; - switch ( item->type ) - { - case SCROLL: - if ( item->which < MAXSCROLLS ) - scr_info[item->which].oi_know = TRUE; - break; - case POTION: - if ( item->which < MAXPOTIONS ) - pot_info[item->which].oi_know = TRUE; - break; - case RING: - if ( item->which < MAXRINGS ) - ring_info[item->which].oi_know = TRUE; - break; - case STICK: - if ( item->which < MAXSTICKS ) - ws_info[item->which].oi_know = TRUE; - break; - // cur_armor and cur_weapon should be set - } - //char packitemstr[256]; - //strcpy(packitemstr,inv_name(o,FALSE)); - //fprintf(stderr,"packitem.(%s)\n",packitemstr); - } -} - -void rogue_packitemstr(char *packitemstr,struct rogue_packitem *item) -{ - static int32_t didinit; int32_t i; - if ( didinit == 0 ) - { - struct rogue_state R; char keystrokes[3]; - memset(&R,0,sizeof(R)); - keystrokes[0] = 'Q'; - keystrokes[1] = 'y'; - keystrokes[2] = 0; - R.keystrokes = keystrokes; - R.numkeys = 2; - rogueiterate(&R); - didinit = 1; - } - THING *obj = new_item(); - rogue_restoreobject(obj,item); - strcpy(packitemstr,inv_name(obj,FALSE)); - //fprintf(stderr,"packitem.(%s)\n",packitemstr); - free(obj); -} - -int32_t packsave(struct rogue_packitem *item,int32_t type,int32_t launch,char *damage,int32_t damagesize,char *hurldmg,int32_t hurlsize,int32_t count,int32_t which,int32_t hplus,int32_t dplus,int32_t arm,int32_t flags,int32_t group) -{ - if ( damagesize != 8 || hurlsize != 8 ) - { - fprintf(stderr,"unexpected damagesize.%d or hurlsize.%d != 8\n",damagesize,hurlsize); - return(-1); - } - item->type = type; - item->launch = launch; - memcpy(item->damage,damage,damagesize); - memcpy(item->hurldmg,hurldmg,hurlsize); - item->count = count; - item->which = which; - item->hplus = hplus; - item->dplus = dplus; - item->arm = arm; - item->flags = flags; - item->group = group; - return(0); -} - -int -rs_write_object(struct rogue_state *rs,FILE *savef, THING *o) -{ - struct rogue_packitem *item; - if (write_error) - return(WRITESTAT); - if ( thing_find(o) < 0 ) - { - fprintf(stderr,"cant find thing.%p (%s) in list\n",o,inv_name(o,FALSE)); //sleep(3); - return(0); - } - if ( o->_o._o_packch != 0 ) - { - item = &rs->P.roguepack[rs->P.packsize]; - if ( 1 && pstats.s_hpt <= 0 ) - { - //fprintf(stderr,"KILLED\n"); - rs->P.gold = -1; - rs->P.hitpoints = -1; - rs->P.strength = 0; - rs->P.level = -1; - rs->P.experience = -1; - rs->P.dungeonlevel = -1; - } - else - { - if ( rs->P.packsize == 0 ) - { - rs->P.gold = purse; - rs->P.hitpoints = max_hp; - rs->P.strength = (pstats.s_str & 0xffff) | (max_stats.s_str << 16); - rs->P.level = pstats.s_lvl; - rs->P.experience = pstats.s_exp; - rs->P.dungeonlevel = level; - rs->P.amulet = amulet; - //fprintf(stderr,"%ld gold.%d hp.%d strength.%d/%d level.%d exp.%d %d\n",ftell(savef),purse,max_hp,pstats.s_str,max_stats.s_str,pstats.s_lvl,pstats.s_exp,level); - } - //fprintf(stderr,"object (%s) x.%d y.%d type.%d pack.(%c:%d)\n",inv_name(o,FALSE),o->_o._o_pos.x,o->_o._o_pos.y,o->_o._o_type,o->_o._o_packch,o->_o._o_packch); - if ( rs->P.packsize < MAXPACK && o->o_type != AMULET ) - { - packsave(item,o->_o._o_type,o->_o._o_launch,o->_o._o_damage,sizeof(o->_o._o_damage),o->_o._o_hurldmg,sizeof(o->_o._o_hurldmg),o->_o._o_count,o->_o._o_which,o->_o._o_hplus,o->_o._o_dplus,o->_o._o_arm,o->_o._o_flags,o->_o._o_group); - rs->P.packsize++; - } - } - } - rs_write_marker(savef, RSID_OBJECT); - rs_write_int(savef, o->_o._o_type); - rs_write_coord(savef, o->_o._o_pos); - rs_write_int(savef, o->_o._o_launch); - rs_write_char(savef, o->_o._o_packch); - rs_write_chars(savef, o->_o._o_damage, sizeof(o->_o._o_damage)); - rs_write_chars(savef, o->_o._o_hurldmg, sizeof(o->_o._o_hurldmg)); - rs_write_int(savef, o->_o._o_count); - rs_write_int(savef, o->_o._o_which); - rs_write_int(savef, o->_o._o_hplus); - rs_write_int(savef, o->_o._o_dplus); - rs_write_int(savef, o->_o._o_arm); - rs_write_int(savef, o->_o._o_flags); - rs_write_int(savef, o->_o._o_group); - rs_write_string(savef, o->_o._o_label); - return(WRITESTAT); -} - -int -rs_read_object(FILE *inf, THING *o) -{ - if (read_error || format_error) - return(READSTAT); - - rs_read_marker(inf, RSID_OBJECT); - rs_read_int(inf, &o->_o._o_type); - rs_read_coord(inf, &o->_o._o_pos); - rs_read_int(inf, &o->_o._o_launch); - rs_read_char(inf, &o->_o._o_packch); - rs_read_chars(inf, o->_o._o_damage, sizeof(o->_o._o_damage)); - rs_read_chars(inf, o->_o._o_hurldmg, sizeof(o->_o._o_hurldmg)); - rs_read_int(inf, &o->_o._o_count); - rs_read_int(inf, &o->_o._o_which); - rs_read_int(inf, &o->_o._o_hplus); - rs_read_int(inf, &o->_o._o_dplus); - rs_read_int(inf, &o->_o._o_arm); - rs_read_int(inf, &o->_o._o_flags); - rs_read_int(inf, &o->_o._o_group); - rs_read_new_string(inf, &o->_o._o_label); - - return(READSTAT); -} - -int -rs_write_object_list(struct rogue_state *rs,FILE *savef, THING *l) -{ - if (write_error) - return(WRITESTAT); - //fprintf(stderr,"list %ld -> ",ftell(savef)); - - rs_write_marker(savef, RSID_OBJECTLIST); - rs_write_int(savef, list_size(l)); - - for( ;l != NULL; l = l->l_next) - rs_write_object(rs,savef, l); - //fprintf(stderr,"%ld\n",ftell(savef)); - - return(WRITESTAT); -} - -int -rs_read_object_list(FILE *inf, THING **list) -{ - int i, cnt; - THING *l = NULL, *previous = NULL, *head = NULL; - - if (read_error || format_error) - return(READSTAT); - - rs_read_marker(inf, RSID_OBJECTLIST); - rs_read_int(inf, &cnt); - - for (i = 0; i < cnt; i++) - { - l = new_item();//,sizeof(THING)); - - memset(l,0,sizeof(THING)); - - l->l_prev = previous; - - if (previous != NULL) - previous->l_next = l; - - rs_read_object(inf,l); - - if (previous == NULL) - head = l; - - previous = l; - } - - if (l != NULL) - l->l_next = NULL; - - *list = head; - - return(READSTAT); -} - -int -rs_write_object_reference(FILE *savef, THING *list, THING *item) -{ - int i; - - if (write_error) - return(WRITESTAT); - - i = find_list_ptr(list, item); - - rs_write_int(savef, i); - - return(WRITESTAT); -} - -int -rs_read_object_reference(FILE *inf, THING *list, THING **item) -{ - int i; - - if (read_error || format_error) - return(READSTAT); - - rs_read_int(inf, &i); - - *item = (THING *)get_list_item(list,i); - - return(READSTAT); -} - -int -find_room_coord(struct room *rmlist, coord *c, int n) -{ - int i = 0; - - for(i = 0; i < n; i++) - if(&rmlist[i].r_gold == c) - return(i); - - return(-1); -} - -int -find_thing_coord(THING *monlist, coord *c) -{ - THING *mitem; - THING *tp; - int i = 0; - - for(mitem = monlist; mitem != NULL; mitem = mitem->l_next) - { - tp = mitem; - - if (c == &tp->t_pos) - return(i); - - i++; - } - - return(-1); -} - -int -find_object_coord(THING *objlist, coord *c) -{ - THING *oitem; - THING *obj; - int i = 0; - - for(oitem = objlist; oitem != NULL; oitem = oitem->l_next) - { - obj = oitem; - - if (c == &obj->o_pos) - return(i); - - i++; - } - - return(-1); -} - -int -rs_write_thing(struct rogue_state *rs,FILE *savef, THING *t) -{ - int i = -1; - - if (write_error) - return(WRITESTAT); - //fprintf(stderr,"thing %ld -> ",ftell(savef)); - - rs_write_marker(savef, RSID_THING); - - if (t == NULL) - { - rs_write_int(savef, 0); - return(WRITESTAT); - } - - rs_write_int(savef, 1); - rs_write_coord(savef, t->_t._t_pos); - rs_write_boolean(savef, t->_t._t_turn); - rs_write_char(savef, t->_t._t_type); - rs_write_char(savef, t->_t._t_disguise); - rs_write_char(savef, t->_t._t_oldch); - - /* - t_dest can be: - 0,0: NULL - 0,1: location of hero - 1,i: location of a thing (monster) - 2,i: location of an object - 3,i: location of gold in a room - - We need to remember what we are chasing rather than - the current location of what we are chasing. - */ - - if (t->t_dest == &hero) - { - rs_write_int(savef,0); - rs_write_int(savef,1); - } - else if (t->t_dest != NULL) - { - i = find_thing_coord(mlist, t->t_dest); - - if (i >=0 ) - { - rs_write_int(savef,1); - rs_write_int(savef,i); - } - else - { - i = find_object_coord(lvl_obj, t->t_dest); - - if (i >= 0) - { - rs_write_int(savef,2); - rs_write_int(savef,i); - } - else - { - i = find_room_coord(rooms, t->t_dest, MAXROOMS); - - if (i >= 0) - { - rs_write_int(savef,3); - rs_write_int(savef,i); - } - else - { - rs_write_int(savef, 0); - rs_write_int(savef,1); /* chase the hero anyway */ - } - } - } - } - else - { - rs_write_int(savef,0); - rs_write_int(savef,0); - } - - rs_write_short(savef, t->_t._t_flags); - rs_write_stats(savef, &t->_t._t_stats); - rs_write_room_reference(savef, t->_t._t_room); - rs_write_object_list(rs,savef, t->_t._t_pack); - //fprintf(stderr,"%ld\n",ftell(savef)); - - return(WRITESTAT); -} - -int -rs_read_thing(FILE *inf, THING *t) -{ - int listid = 0, index = -1; - THING *item; - - if (read_error || format_error) - return(READSTAT); - - rs_read_marker(inf, RSID_THING); - - rs_read_int(inf, &index); - - if (index == 0) - return(READSTAT); - - rs_read_coord(inf,&t->_t._t_pos); - rs_read_boolean(inf,&t->_t._t_turn); - rs_read_char(inf,&t->_t._t_type); - rs_read_char(inf,&t->_t._t_disguise); - rs_read_char(inf,&t->_t._t_oldch); - - /* - t_dest can be (listid,index): - 0,0: NULL - 0,1: location of hero - 1,i: location of a thing (monster) - 2,i: location of an object - 3,i: location of gold in a room - - We need to remember what we are chasing rather than - the current location of what we are chasing. - */ - - rs_read_int(inf, &listid); - rs_read_int(inf, &index); - t->_t._t_reserved = -1; - - if (listid == 0) /* hero or NULL */ - { - if (index == 1) - t->_t._t_dest = &hero; - else - t->_t._t_dest = NULL; - } - else if (listid == 1) /* monster/thing */ - { - t->_t._t_dest = NULL; - t->_t._t_reserved = index; - } - else if (listid == 2) /* object */ - { - THING *obj; - - item = (THING *)get_list_item(lvl_obj, index); - - if (item != NULL) - { - obj = item; - t->_t._t_dest = &obj->o_pos; - } - } - else if (listid == 3) /* gold */ - { - t->_t._t_dest = &rooms[index].r_gold; - } - else - t->_t._t_dest = NULL; - - rs_read_short(inf,&t->_t._t_flags); - rs_read_stats(inf,&t->_t._t_stats); - rs_read_room_reference(inf, &t->_t._t_room); - rs_read_object_list(inf,&t->_t._t_pack); - - return(READSTAT); -} - -void -rs_fix_thing(THING *t) -{ - THING *item; - THING *tp; - - if (t->t_reserved < 0) - return; - - item = (THING *)get_list_item(mlist,t->t_reserved); - - if (item != NULL) - { - tp = item; - t->t_dest = &tp->t_pos; - } -} - -int -rs_write_thing_list(struct rogue_state *rs,FILE *savef, THING *l) -{ - int cnt = 0; - - if (write_error) - return(WRITESTAT); - - rs_write_marker(savef, RSID_MONSTERLIST); - - cnt = list_size(l); - - rs_write_int(savef, cnt); - - if (cnt < 1) - return(WRITESTAT); - - while (l != NULL) { - rs_write_thing(rs,savef, l); - l = l->l_next; - } - - return(WRITESTAT); -} - -int -rs_read_thing_list(FILE *inf, THING **list) -{ - int i, cnt; - THING *l = NULL, *previous = NULL, *head = NULL; - - if (read_error || format_error) - return(READSTAT); - - rs_read_marker(inf, RSID_MONSTERLIST); - - rs_read_int(inf, &cnt); - - for (i = 0; i < cnt; i++) - { - l = new_item(); - - l->l_prev = previous; - - if (previous != NULL) - previous->l_next = l; - - rs_read_thing(inf,l); - - if (previous == NULL) - head = l; - - previous = l; - } - - if (l != NULL) - l->l_next = NULL; - - *list = head; - - return(READSTAT); -} - -void -rs_fix_thing_list(THING *list) -{ - THING *item; - - for(item = list; item != NULL; item = item->l_next) - rs_fix_thing(item); -} - -int -rs_write_thing_reference(FILE *savef, THING *list, THING *item) -{ - int i; - - if (write_error) - return(WRITESTAT); - - if (item == NULL) - rs_write_int(savef,-1); - else - { - i = find_list_ptr(list, item); - - rs_write_int(savef, i); - } - - return(WRITESTAT); -} - -int -rs_read_thing_reference(FILE *inf, THING *list, THING **item) -{ - int i; - - if (read_error || format_error) - return(READSTAT); - - rs_read_int(inf, &i); - - if (i == -1) - *item = NULL; - else - *item = (THING *)get_list_item(list,i); - - return(READSTAT); -} - -int -rs_write_thing_references(FILE *savef, THING *list, THING *items[], int count) -{ - int i; - - if (write_error) - return(WRITESTAT); - - for(i = 0; i < count; i++) - rs_write_thing_reference(savef,list,items[i]); - - return(WRITESTAT); -} - -int -rs_read_thing_references(FILE *inf, THING *list, THING *items[], int count) -{ - int i; - - if (read_error || format_error) - return(READSTAT); - - for(i = 0; i < count; i++) - rs_read_thing_reference(inf,list,&items[i]); - - return(WRITESTAT); -} - -int -rs_write_places(FILE *savef, PLACE *places, int count) -{ - int i = 0; - //fprintf(stderr,"places %ld -> ",ftell(savef)); - - if (write_error) - return(WRITESTAT); - - for(i = 0; i < count; i++) - { - rs_write_char(savef, places[i].p_ch); - rs_write_char(savef, places[i].p_flags); - rs_write_thing_reference(savef, mlist, places[i].p_monst); - } - //fprintf(stderr,"%ld\n",ftell(savef)); - - return(WRITESTAT); -} - -int -rs_read_places(FILE *inf, PLACE *places, int count) -{ - int i = 0; - - if (read_error || format_error) - return(READSTAT); - - for(i = 0; i < count; i++) - { - rs_read_char(inf,&places[i].p_ch); - rs_read_char(inf,&places[i].p_flags); - rs_read_thing_reference(inf, mlist, &places[i].p_monst); - } - - return(READSTAT); -} - -int -rs_save_file(struct rogue_state *rs,FILE *savef) -{ - if (write_error) - { - fprintf(stderr,"write error\n"); - return(WRITESTAT); - } - - rs_write_boolean(savef, after); /* 1 */ /* extern.c */ - rs_write_boolean(savef, again); /* 2 */ - rs_write_int(savef, noscore); /* 3 */ - rs_write_boolean(savef, seenstairs); /* 4 */ - rs_write_boolean(savef, amulet); /* 5 */ - rs_write_boolean(savef, door_stop); /* 6 */ - rs_write_boolean(savef, fight_flush); /* 7 */ - rs_write_boolean(savef, firstmove); /* 8 */ - rs_write_boolean(savef, got_ltc); /* 9 */ - rs_write_boolean(savef, has_hit); /* 10 */ - rs_write_boolean(savef, in_shell); /* 11 */ - rs_write_boolean(savef, inv_describe); /* 12 */ - rs_write_boolean(savef, jump); /* 13 */ - rs_write_boolean(savef, kamikaze); /* 14 */ - rs_write_boolean(savef, lower_msg); /* 15 */ - rs_write_boolean(savef, move_on); /* 16 */ - rs_write_boolean(savef, msg_esc); /* 17 */ - rs_write_boolean(savef, passgo); /* 18 */ - rs_write_boolean(savef, playing); /* 19 */ - rs_write_boolean(savef, q_comm); /* 20 */ - rs_write_boolean(savef, running); /* 21 */ - rs_write_boolean(savef, save_msg); /* 22 */ - rs_write_boolean(savef, see_floor); /* 23 */ - rs_write_boolean(savef, stat_msg); /* 24 */ - rs_write_boolean(savef, terse); /* 25 */ - rs_write_boolean(savef, to_death); /* 26 */ - rs_write_boolean(savef, tombstone); /* 27 */ -#ifdef MASTER - rs_write_int(savef, wizard); /* 28 */ -#else - rs_write_int(savef, 0); /* 28 */ -#endif - rs_write_booleans(savef, pack_used, 26); /* 29 */ - rs_write_char(savef, dir_ch); - //rs_write_chars(savef, file_name, MAXSTR); - //rs_write_chars(savef, huh, MAXSTR); - rs_write_potions(savef); - //rs_write_chars(savef,prbuf,2*MAXSTR); - rs_write_rings(savef); - rs_write_string(savef,release); - rs_write_char(savef, runch); - rs_write_scrolls(savef); - rs_write_char(savef, take); - //rs_write_chars(savef, whoami, MAXSTR); - rs_write_sticks(savef); - rs_write_int(savef,orig_dsusp); - rs_write_chars(savef, fruit, MAXSTR); - //rs_write_chars(savef, home, MAXSTR); - rs_write_strings(savef,(char **)inv_t_name,3); - rs_write_char(savef,l_last_comm); - rs_write_char(savef,l_last_dir); - rs_write_char(savef,last_comm); - rs_write_char(savef,last_dir); - rs_write_strings(savef,(char **)tr_name,8); - rs_write_int(savef,n_objs); - rs_write_int(savef, ntraps); - rs_write_int(savef, hungry_state); - rs_write_int(savef, inpack); - rs_write_int(savef, inv_type); - rs_write_int(savef, level); - rs_write_int(savef, max_level); - rs_write_int(savef, mpos); - rs_write_int(savef, no_food); - rs_write_ints(savef,(int32_t *)a_class,MAXARMORS); - rs_write_int(savef, count); - rs_write_int(savef, food_left); - rs_write_int(savef, lastscore); - rs_write_int(savef, no_command); - rs_write_int(savef, no_move); - rs_write_int(savef, purse); - rs_write_int(savef, quiet); - rs_write_int(savef, vf_hit); - //rs_write_int(savef, dnum); - rs_write_int(savef, (int32_t)(seed&0xffffffff)); - rs_write_int(savef, (int32_t)((seed>>32)&0xffffffff)); - rs_write_ints(savef, (int32_t *)e_levels, 21); - rs_write_coord(savef, delta); - rs_write_coord(savef, oldpos); - rs_write_coord(savef, stairs); - rs_write_thing(rs,savef, &player); - rs_write_object_reference(savef, player.t_pack, cur_armor); - rs_write_object_reference(savef, player.t_pack, cur_ring[0]); - rs_write_object_reference(savef, player.t_pack, cur_ring[1]); - rs_write_object_reference(savef, player.t_pack, cur_weapon); - rs_write_object_reference(savef, player.t_pack, l_last_pick); - rs_write_object_reference(savef, player.t_pack, last_pick); - - rs_write_object_list(rs,savef, lvl_obj); - rs_write_thing_list(rs,savef, mlist); - - rs_write_places(savef,places,MAXLINES*MAXCOLS); - - rs_write_stats(savef,&max_stats); - rs_write_rooms(savef, rooms, MAXROOMS); - rs_write_room_reference(savef, oldrp); - rs_write_rooms(savef, passages, MAXPASS); - - rs_write_monsters(savef,monsters,26); - rs_write_obj_info(savef, things, NUMTHINGS); - rs_write_obj_info(savef, arm_info, MAXARMORS); - rs_write_obj_info(savef, pot_info, MAXPOTIONS); - rs_write_obj_info(savef, ring_info, MAXRINGS); - rs_write_obj_info(savef, scr_info, MAXSCROLLS); - rs_write_obj_info(savef, weap_info, MAXWEAPONS+1); - rs_write_obj_info(savef, ws_info, MAXSTICKS); - - - rs_write_daemons(savef, &d_list[0], 20); /* 5.4-daemon.c */ -#ifdef MASTER - rs_write_int(savef,total); /* 5.4-list.c */ -#else - rs_write_int(savef, 0); -#endif - rs_write_int(savef,between); /* 5.4-daemons.c*/ - rs_write_coord(savef, nh); /* 5.4-move.c */ - rs_write_int(savef, group); /* 5.4-weapons.c */ - //fprintf(stderr,"fifth %ld\n",ftell(savef)); - - rs_write_window(savef,stdscr); - //fprintf(stderr,"done %ld\n",ftell(savef)); - - return(WRITESTAT); -} - -int -rs_restore_file(FILE *inf) -{ - int dummyint; - - if (read_error || format_error) - return(READSTAT); - - rs_read_boolean(inf, &after); /* 1 */ /* extern.c */ - rs_read_boolean(inf, &again); /* 2 */ - rs_read_int(inf, &noscore); /* 3 */ - rs_read_boolean(inf, &seenstairs); /* 4 */ - rs_read_boolean(inf, &amulet); /* 5 */ - rs_read_boolean(inf, &door_stop); /* 6 */ - rs_read_boolean(inf, &fight_flush); /* 7 */ - rs_read_boolean(inf, &firstmove); /* 8 */ - rs_read_boolean(inf, &got_ltc); /* 9 */ - rs_read_boolean(inf, &has_hit); /* 10 */ - rs_read_boolean(inf, &in_shell); /* 11 */ - rs_read_boolean(inf, &inv_describe); /* 12 */ - rs_read_boolean(inf, &jump); /* 13 */ - rs_read_boolean(inf, &kamikaze); /* 14 */ - rs_read_boolean(inf, &lower_msg); /* 15 */ - rs_read_boolean(inf, &move_on); /* 16 */ - rs_read_boolean(inf, &msg_esc); /* 17 */ - rs_read_boolean(inf, &passgo); /* 18 */ - rs_read_boolean(inf, &playing); /* 19 */ - rs_read_boolean(inf, &q_comm); /* 20 */ - rs_read_boolean(inf, &running); /* 21 */ - rs_read_boolean(inf, &save_msg); /* 22 */ - rs_read_boolean(inf, &see_floor); /* 23 */ - rs_read_boolean(inf, &stat_msg); /* 24 */ - rs_read_boolean(inf, &terse); /* 25 */ - rs_read_boolean(inf, &to_death); /* 26 */ - rs_read_boolean(inf, &tombstone); /* 27 */ -#ifdef MASTER - rs_read_int(inf, &wizard); /* 28 */ -#else - rs_read_int(inf, &dummyint); /* 28 */ -#endif - rs_read_booleans(inf, pack_used, 26); /* 29 */ - rs_read_char(inf, &dir_ch); - //rs_read_chars(inf, file_name, MAXSTR); - //rs_read_chars(inf, huh, MAXSTR); - rs_read_potions(inf); - //rs_read_chars(inf, prbuf, 2*MAXSTR); - rs_read_rings(inf); - rs_read_new_string(inf,&release); - rs_read_char(inf, &runch); - rs_read_scrolls(inf); - rs_read_char(inf, &take); - //rs_read_chars(inf, whoami, MAXSTR); - rs_read_sticks(inf); - rs_read_int(inf,&orig_dsusp); - rs_read_chars(inf, fruit, MAXSTR); - //rs_read_chars(inf, home, MAXSTR); - rs_read_new_strings(inf,(char **)inv_t_name,3); - rs_read_char(inf, &l_last_comm); - rs_read_char(inf, &l_last_dir); - rs_read_char(inf, &last_comm); - rs_read_char(inf, &last_dir); - rs_read_new_strings(inf,(char **)tr_name,8); - rs_read_int(inf, &n_objs); - rs_read_int(inf, &ntraps); - rs_read_int(inf, &hungry_state); - rs_read_int(inf, &inpack); - rs_read_int(inf, &inv_type); - rs_read_int(inf, &level); - rs_read_int(inf, &max_level); - rs_read_int(inf, &mpos); - rs_read_int(inf, &no_food); - rs_read_ints(inf,(int32_t *)a_class,MAXARMORS); - rs_read_int(inf, &count); - rs_read_int(inf, &food_left); - rs_read_int(inf, &lastscore); - rs_read_int(inf, &no_command); - rs_read_int(inf, &no_move); - rs_read_int(inf, &purse); - rs_read_int(inf, &quiet); - rs_read_int(inf, &vf_hit); - //rs_read_int(inf, &dnum); - int32_t lownum,highnum; - rs_read_int(inf, &lownum); - rs_read_int(inf, &highnum); - seed = ((uint64_t)highnum<<32) | (lownum&0xffffffff); - rs_read_ints(inf,(int32_t *)e_levels,21); - rs_read_coord(inf, &delta); - rs_read_coord(inf, &oldpos); - rs_read_coord(inf, &stairs); - - rs_read_thing(inf, &player); - rs_read_object_reference(inf, player.t_pack, &cur_armor); - rs_read_object_reference(inf, player.t_pack, &cur_ring[0]); - rs_read_object_reference(inf, player.t_pack, &cur_ring[1]); - rs_read_object_reference(inf, player.t_pack, &cur_weapon); - rs_read_object_reference(inf, player.t_pack, &l_last_pick); - rs_read_object_reference(inf, player.t_pack, &last_pick); - - rs_read_object_list(inf, &lvl_obj); - rs_read_thing_list(inf, &mlist); - rs_fix_thing(&player); - rs_fix_thing_list(mlist); - - rs_read_places(inf,places,MAXLINES*MAXCOLS); - - rs_read_stats(inf, &max_stats); - rs_read_rooms(inf, rooms, MAXROOMS); - rs_read_room_reference(inf, &oldrp); - rs_read_rooms(inf, passages, MAXPASS); - - rs_read_monsters(inf,monsters,26); - rs_read_obj_info(inf, things, NUMTHINGS); - rs_read_obj_info(inf, arm_info, MAXARMORS); - rs_read_obj_info(inf, pot_info, MAXPOTIONS); - rs_read_obj_info(inf, ring_info, MAXRINGS); - rs_read_obj_info(inf, scr_info, MAXSCROLLS); - rs_read_obj_info(inf, weap_info, MAXWEAPONS+1); - rs_read_obj_info(inf, ws_info, MAXSTICKS); - - rs_read_daemons(inf, d_list, 20); /* 5.4-daemon.c */ - rs_read_int(inf,&dummyint); /* total */ /* 5.4-list.c */ - rs_read_int(inf,&between); /* 5.4-daemons.c */ - rs_read_coord(inf, &nh); /* 5.4-move.c */ - rs_read_int(inf,&group); /* 5.4-weapons.c */ - - rs_read_window(inf,stdscr); - - return(READSTAT); -} diff --git a/src/cc/rogue/sticks.c b/src/cc/rogue/sticks.c deleted file mode 100644 index 254f0c404..000000000 --- a/src/cc/rogue/sticks.c +++ /dev/null @@ -1,435 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * Functions to implement the various sticks one might find - * while wandering around the dungeon. - * - * @(#)sticks.c 4.39 (Berkeley) 02/05/99 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -//#include -//#include -//#include -#include "rogue.h" - -/* - * fix_stick: - * Set up a new stick - */ - -void -fix_stick(THING *cur) -{ - if (strcmp(ws_type[cur->o_which], "staff") == 0) - strncpy(cur->o_damage,"2x3",sizeof(cur->o_damage)); - else - strncpy(cur->o_damage,"1x1",sizeof(cur->o_damage)); - strncpy(cur->o_hurldmg,"1x1",sizeof(cur->o_hurldmg)); - - switch (cur->o_which) - { - case WS_LIGHT: - cur->o_charges = rnd(10) + 10; - otherwise: - cur->o_charges = rnd(5) + 3; - } -} - -/* - * do_zap: - * Perform a zap with a wand - */ - -void -do_zap(struct rogue_state *rs) -{ - THING *obj, *tp; - int y, x; - char *name; - char monster, oldch; - static THING bolt; - - if ((obj = get_item(rs,"zap with", STICK)) == NULL) - return; - if (obj->o_type != STICK) - { - after = FALSE; - msg(rs,"you can't zap with that!"); - return; - } - if (obj->o_charges == 0) - { - msg(rs,"nothing happens"); - return; - } - switch (obj->o_which) - { - case WS_LIGHT: - /* - * Reddy Kilowat wand. Light up the room - */ - ws_info[WS_LIGHT].oi_know = TRUE; - if (proom->r_flags & ISGONE) - msg(rs,"the corridor glows and then fades"); - else - { - proom->r_flags &= ~ISDARK; - /* - * Light the room and put the player back up - */ - enter_room(rs,&hero); - addmsg(rs,"the room is lit"); - if (!terse) - addmsg(rs," by a shimmering %s light", pick_color("blue")); - endmsg(rs); - } - when WS_DRAIN: - /* - * take away 1/2 of hero's hit points, then take it away - * evenly from the monsters in the room (or next to hero - * if he is in a passage) - */ - if (pstats.s_hpt < 2) - { - msg(rs,"you are too weak to use it"); - return; - } - else - drain(rs); - when WS_INVIS: - case WS_POLYMORPH: - case WS_TELAWAY: - case WS_TELTO: - case WS_CANCEL: - y = hero.y; - x = hero.x; - while (step_ok(winat(y, x))) - { - y += delta.y; - x += delta.x; - } - if ((tp = moat(y, x)) != NULL) - { - monster = tp->t_type; - if (monster == 'F') - player.t_flags &= ~ISHELD; - switch (obj->o_which) { - case WS_INVIS: - tp->t_flags |= ISINVIS; - if (cansee(rs,y, x)) - mvaddch(y, x, tp->t_oldch); - break; - case WS_POLYMORPH: - { - THING *pp; - - pp = tp->t_pack; - detach(mlist, tp); - if (see_monst(tp)) - mvaddch(y, x, chat(y, x)); - oldch = tp->t_oldch; - delta.y = y; - delta.x = x; - new_monster(rs,tp, monster = (char)(rnd(26) + 'A'), &delta); - if (see_monst(tp)) - mvaddch(y, x, monster); - tp->t_oldch = oldch; - tp->t_pack = pp; - ws_info[WS_POLYMORPH].oi_know |= see_monst(tp); - break; - } - case WS_CANCEL: - tp->t_flags |= ISCANC; - tp->t_flags &= ~(ISINVIS|CANHUH); - tp->t_disguise = tp->t_type; - if (see_monst(tp)) - mvaddch(y, x, tp->t_disguise); - break; - case WS_TELAWAY: - case WS_TELTO: - { - coord new_pos; - - if (obj->o_which == WS_TELAWAY) - { - do - { - find_floor(rs,NULL, &new_pos, FALSE, TRUE); - } while (ce(new_pos, hero)); - } - else - { - new_pos.y = hero.y + delta.y; - new_pos.x = hero.x + delta.x; - } - tp->t_dest = &hero; - tp->t_flags |= ISRUN; - relocate(rs,tp, &new_pos); - } - } - } - when WS_MISSILE: - ws_info[WS_MISSILE].oi_know = TRUE; - bolt.o_type = '*'; - strncpy(bolt.o_hurldmg,"1x4",sizeof(bolt.o_hurldmg)); - bolt.o_hplus = 100; - bolt.o_dplus = 1; - bolt.o_flags = ISMISL; - if (cur_weapon != NULL) - bolt.o_launch = cur_weapon->o_which; - do_motion(rs,&bolt, delta.y, delta.x); - if ((tp = moat(bolt.o_pos.y, bolt.o_pos.x)) != NULL - && !save_throw(VS_MAGIC, tp)) - hit_monster(rs,unc(bolt.o_pos), &bolt); - else if (terse) - msg(rs,"missle vanishes"); - else - msg(rs,"the missle vanishes with a puff of smoke"); - when WS_HASTE_M: - case WS_SLOW_M: - y = hero.y; - x = hero.x; - while (step_ok(winat(y, x))) - { - y += delta.y; - x += delta.x; - } - if ((tp = moat(y, x)) != NULL) - { - if (obj->o_which == WS_HASTE_M) - { - if (on(*tp, ISSLOW)) - tp->t_flags &= ~ISSLOW; - else - tp->t_flags |= ISHASTE; - } - else - { - if (on(*tp, ISHASTE)) - tp->t_flags &= ~ISHASTE; - else - tp->t_flags |= ISSLOW; - tp->t_turn = TRUE; - } - delta.y = y; - delta.x = x; - runto(rs,&delta); - } - when WS_ELECT: - case WS_FIRE: - case WS_COLD: - if (obj->o_which == WS_ELECT) - name = "bolt"; - else if (obj->o_which == WS_FIRE) - name = "flame"; - else - name = "ice"; - fire_bolt(rs,&hero, &delta, name); - ws_info[obj->o_which].oi_know = TRUE; - when WS_NOP: - break; -#ifdef MASTER - otherwise: - msg(rs,"what a bizarre schtick!"); -#endif - } - obj->o_charges--; -} - -/* - * drain: - * Do drain hit points from player shtick - */ - -void -drain(struct rogue_state *rs) -{ - THING *mp; - struct room *corp; - THING **dp; - int cnt; - bool inpass; - static THING *drainee[40]; - - /* - * First cnt how many things we need to spread the hit points among - */ - cnt = 0; - if (chat(hero.y, hero.x) == DOOR) - corp = &passages[flat(hero.y, hero.x) & F_PNUM]; - else - corp = NULL; - inpass = (bool)(proom->r_flags & ISGONE); - dp = drainee; - for (mp = mlist; mp != NULL; mp = next(mp)) - if (mp->t_room == proom || mp->t_room == corp || - (inpass && chat(mp->t_pos.y, mp->t_pos.x) == DOOR && - &passages[flat(mp->t_pos.y, mp->t_pos.x) & F_PNUM] == proom)) - *dp++ = mp; - if ((cnt = (int)(dp - drainee)) == 0) - { - msg(rs,"you have a tingling feeling"); - return; - } - *dp = NULL; - pstats.s_hpt /= 2; - cnt = pstats.s_hpt / cnt; - /* - * Now zot all of the monsters - */ - for (dp = drainee; *dp; dp++) - { - mp = *dp; - if ((mp->t_stats.s_hpt -= cnt) <= 0) - killed(rs,mp, see_monst(mp)); - else - runto(rs,&mp->t_pos); - } -} - -/* - * fire_bolt: - * Fire a bolt in a given direction from a specific starting place - */ - -void -fire_bolt(struct rogue_state *rs,coord *start, coord *dir, char *name) -{ - coord *c1, *c2; - THING *tp; - char dirch = 0, ch; - bool hit_hero, used, changed; - static coord pos; - static coord spotpos[BOLT_LENGTH]; - THING bolt; - - bolt.o_type = WEAPON; - bolt.o_which = FLAME; - strncpy(bolt.o_hurldmg,"6x6",sizeof(bolt.o_hurldmg)); - bolt.o_hplus = 100; - bolt.o_dplus = 0; - weap_info[FLAME].oi_name = name; - switch (dir->y + dir->x) - { - case 0: dirch = '/'; - when 1: case -1: dirch = (dir->y == 0 ? '-' : '|'); - when 2: case -2: dirch = '\\'; - } - pos = *start; - hit_hero = (bool)(start != &hero); - used = FALSE; - changed = FALSE; - for (c1 = spotpos; c1 <= &spotpos[BOLT_LENGTH-1] && !used; c1++) - { - pos.y += dir->y; - pos.x += dir->x; - *c1 = pos; - ch = winat(pos.y, pos.x); - switch (ch) - { - case DOOR: - /* - * this code is necessary if the hero is on a door - * and he fires at the wall the door is in, it would - * otherwise loop infinitely - */ - if (ce(hero, pos)) - goto def; - /* FALLTHROUGH */ - case '|': - case '-': - case ' ': - if (!changed) - hit_hero = !hit_hero; - changed = FALSE; - dir->y = -dir->y; - dir->x = -dir->x; - c1--; - msg(rs,"the %s bounces", name); - break; - default: -def: - if (!hit_hero && (tp = moat(pos.y, pos.x)) != NULL) - { - hit_hero = TRUE; - changed = !changed; - tp->t_oldch = chat(pos.y, pos.x); - if (!save_throw(VS_MAGIC, tp)) - { - bolt.o_pos = pos; - used = TRUE; - if (tp->t_type == 'D' && strcmp(name, "flame") == 0) - { - addmsg(rs,"the flame bounces"); - if (!terse) - addmsg(rs," off the dragon"); - endmsg(rs); - } - else - hit_monster(rs,unc(pos), &bolt); - } - else if (ch != 'M' || tp->t_disguise == 'M') - { - if (start == &hero) - runto(rs,&pos); - if (terse) - msg(rs,"%s misses", name); - else - msg(rs,"the %s whizzes past %s", name, set_mname(tp)); - } - } - else if (hit_hero && ce(pos, hero)) - { - hit_hero = FALSE; - changed = !changed; - if (!save(VS_MAGIC)) - { - if ((pstats.s_hpt -= roll(6, 6)) <= 0) - { - if (start == &hero) - death(rs,'b'); - else - death(rs,moat(start->y, start->x)->t_type); - } - used = TRUE; - if (terse) - msg(rs,"the %s hits", name); - else - msg(rs,"you are hit by the %s", name); - } - else - msg(rs,"the %s whizzes by you", name); - } - mvaddch(pos.y, pos.x, dirch); - if ( rs->sleeptime != 0 ) - refresh(); - } - } - for (c2 = spotpos; c2 < c1; c2++) - mvaddch(c2->y, c2->x, chat(c2->y, c2->x)); -} - -/* - * charge_str: - * Return an appropriate string for a wand charge - */ -char * -charge_str(THING *obj) -{ - static char buf[20]; - - if (!(obj->o_flags & ISKNOW)) - buf[0] = '\0'; - else if (terse) - sprintf(buf, " [%d]", obj->o_charges); - else - sprintf(buf, " [%d charges]", obj->o_charges); - return buf; -} diff --git a/src/cc/rogue/things.c b/src/cc/rogue/things.c deleted file mode 100644 index 166eb32d2..000000000 --- a/src/cc/rogue/things.c +++ /dev/null @@ -1,741 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * Contains functions for dealing with things like potions, scrolls, - * and other items. - * - * @(#)things.c 4.53 (Berkeley) 02/05/99 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -//#include -//#include -//#include -#include "rogue.h" - -/* - * inv_name: - * Return the name of something as it would appear in an - * inventory. - */ -char * -inv_name(THING *obj, bool drop) -{ - char *pb; - struct obj_info *op; - char *sp; - int which; - - pb = prbuf; - which = obj->o_which; - switch (obj->o_type) - { - case POTION: - nameit(obj, "potion", p_colors[which], &pot_info[which], nullstr); - when RING: - nameit(obj, "ring", r_stones[which], &ring_info[which], ring_num); - when STICK: - nameit(obj, ws_type[which], ws_made[which], &ws_info[which], charge_str); - when SCROLL: - if (obj->o_count == 1) - { - strcpy(pb, "A scroll "); - pb = &prbuf[9]; - } - else - { - sprintf(pb, "%d scrolls ", obj->o_count); - pb = &prbuf[strlen(prbuf)]; - } - op = &scr_info[which]; - if (op->oi_know) - sprintf(pb, "of %s", op->oi_name); - else if (op->oi_guess) - sprintf(pb, "called %s", op->oi_guess); - else - sprintf(pb, "titled '%s'", s_names[which]); - when FOOD: - if (which == 1) - if (obj->o_count == 1) - sprintf(pb, "A%s %s", vowelstr(fruit), fruit); - else - sprintf(pb, "%d %ss", obj->o_count, fruit); - else - if (obj->o_count == 1) - strcpy(pb, "Some food"); - else - sprintf(pb, "%d rations of food", obj->o_count); - when WEAPON: - sp = weap_info[which].oi_name; - if (obj->o_count > 1) - sprintf(pb, "%d ", obj->o_count); - else - sprintf(pb, "A%s ", vowelstr(sp)); - pb = &prbuf[strlen(prbuf)]; - if (obj->o_flags & ISKNOW) - sprintf(pb, "%s %s", num(obj->o_hplus,obj->o_dplus,WEAPON), sp); - else - sprintf(pb, "%s", sp); - if (obj->o_count > 1) - strcat(pb, "s"); - if (obj->o_label != NULL) - { - pb = &prbuf[strlen(prbuf)]; - sprintf(pb, " called %s", obj->o_label); - } - when ARMOR: - sp = arm_info[which].oi_name; - if (obj->o_flags & ISKNOW) - { - sprintf(pb, "%s %s [", - num(a_class[which] - obj->o_arm, 0, ARMOR), sp); - if (!terse) - strcat(pb, "protection "); - pb = &prbuf[strlen(prbuf)]; - sprintf(pb, "%d]", 10 - obj->o_arm); - } - else - sprintf(pb, "%s", sp); - if (obj->o_label != NULL) - { - pb = &prbuf[strlen(prbuf)]; - sprintf(pb, " called %s", obj->o_label); - } - when AMULET: - strcpy(pb, "The Amulet of Yendor"); - when GOLD: - sprintf(prbuf, "%d Gold pieces", obj->o_goldval); -#ifdef MASTER - otherwise: - debug("Picked up something funny %s", unctrl(obj->o_type)); - sprintf(pb, "Something bizarre %s", unctrl(obj->o_type)); -#endif - } - if (inv_describe) - { - if (obj == cur_armor) - strcat(pb, " (being worn)"); - if (obj == cur_weapon) - strcat(pb, " (weapon in hand)"); - if (obj == cur_ring[LEFT]) - strcat(pb, " (on left hand)"); - else if (obj == cur_ring[RIGHT]) - strcat(pb, " (on right hand)"); - } - if (drop && isupper(prbuf[0])) - prbuf[0] = (char) tolower(prbuf[0]); - else if (!drop && islower(*prbuf)) - *prbuf = (char) toupper(*prbuf); - prbuf[MAXSTR-1] = '\0'; - return prbuf; -} - -/* - * drop: - * Put something down - */ - -void -drop(struct rogue_state *rs) -{ - char ch; - THING *obj; - - ch = chat(hero.y, hero.x); - if (ch != FLOOR && ch != PASSAGE) - { - after = FALSE; - msg(rs,"there is something there already"); - return; - } - if ((obj = get_item(rs,"drop", 0)) == NULL) - return; - if (!dropcheck(rs,obj)) - return; - obj = leave_pack(rs,obj, TRUE, (bool)!ISMULT(obj->o_type)); - /* - * Link it into the level object list - */ - attach(lvl_obj, obj); - chat(hero.y, hero.x) = (char) obj->o_type; - flat(hero.y, hero.x) |= F_DROPPED; - obj->o_pos = hero; - if (obj->o_type == AMULET) - amulet = FALSE; - msg(rs,"dropped %s", inv_name(obj, TRUE)); -} - -/* - * dropcheck: - * Do special checks for dropping or unweilding|unwearing|unringing - */ -bool -dropcheck(struct rogue_state *rs,THING *obj) -{ - if (obj == NULL) - return TRUE; - if (obj != cur_armor && obj != cur_weapon - && obj != cur_ring[LEFT] && obj != cur_ring[RIGHT]) - return TRUE; - if (obj->o_flags & ISCURSED) - { - msg(rs,"you can't. It appears to be cursed"); - return FALSE; - } - if (obj == cur_weapon) - cur_weapon = NULL; - else if (obj == cur_armor) - { - waste_time(rs); - cur_armor = NULL; - } - else - { - cur_ring[obj == cur_ring[LEFT] ? LEFT : RIGHT] = NULL; - switch (obj->o_which) - { - case R_ADDSTR: - chg_str(-obj->o_arm); - break; - case R_SEEINVIS: - unsee(rs,0); - extinguish(unsee); - break; - } - } - return TRUE; -} - -/* - * new_thing: - * Return a new thing - */ -THING * -new_thing(struct rogue_state *rs) -{ - THING *cur; - int r; - - cur = new_item(); - // 7th new_thing orphaned fprintf(stderr,"new_thing.%p\n",cur); - cur->o_hplus = 0; - cur->o_dplus = 0; - strncpy(cur->o_damage, "0x0", sizeof(cur->o_damage)); - strncpy(cur->o_hurldmg, "0x0", sizeof(cur->o_hurldmg)); - cur->o_arm = 11; - cur->o_count = 1; - cur->o_group = 0; - cur->o_flags = 0; - /* - * Decide what kind of object it will be - * If we haven't had food for a while, let it be food. - */ - switch (no_food > 3 ? 2 : pick_one(rs,things, NUMTHINGS)) - { - case 0: - cur->o_type = POTION; - cur->o_which = pick_one(rs,pot_info, MAXPOTIONS); - when 1: - cur->o_type = SCROLL; - cur->o_which = pick_one(rs,scr_info, MAXSCROLLS); - when 2: - cur->o_type = FOOD; - no_food = 0; - if (rnd(10) != 0) - cur->o_which = 0; - else - cur->o_which = 1; - when 3: - init_weapon(cur, pick_one(rs,weap_info, MAXWEAPONS)); - if ((r = rnd(100)) < 10) - { - cur->o_flags |= ISCURSED; - cur->o_hplus -= rnd(3) + 1; - } - else if (r < 15) - cur->o_hplus += rnd(3) + 1; - when 4: - cur->o_type = ARMOR; - cur->o_which = pick_one(rs,arm_info, MAXARMORS); - cur->o_arm = a_class[cur->o_which]; - if ((r = rnd(100)) < 20) - { - cur->o_flags |= ISCURSED; - cur->o_arm += rnd(3) + 1; - } - else if (r < 28) - cur->o_arm -= rnd(3) + 1; - when 5: - cur->o_type = RING; - cur->o_which = pick_one(rs,ring_info, MAXRINGS); - switch (cur->o_which) - { - case R_ADDSTR: - case R_PROTECT: - case R_ADDHIT: - case R_ADDDAM: - if ((cur->o_arm = rnd(3)) == 0) - { - cur->o_arm = -1; - cur->o_flags |= ISCURSED; - } - when R_AGGR: - case R_TELEPORT: - cur->o_flags |= ISCURSED; - } - when 6: - cur->o_type = STICK; - cur->o_which = pick_one(rs,ws_info, MAXSTICKS); - fix_stick(cur); -#ifdef MASTER - otherwise: - debug("Picked a bad kind of object"); - wait_for(rs,' '); -#endif - } - return cur; -} - -/* - * pick_one: - * Pick an item out of a list of nitems possible objects - */ -int -pick_one(struct rogue_state *rs,struct obj_info *info, int nitems) -{ - struct obj_info *end; - struct obj_info *start; - int i; - - start = info; - for (end = &info[nitems], i = rnd(100); info < end; info++) - if (i < info->oi_prob) - break; - if (info == end) - { -#ifdef MASTER - if (wizard) - { - msg(rs,"bad pick_one: %d from %d items", i, nitems); - for (info = start; info < end; info++) - msg(rs,"%s: %d%%", info->oi_name, info->oi_prob); - } -#endif - info = start; - } - return (int)(info - start); -} - -/* - * discovered: - * list what the player has discovered in this game of a certain type - */ -static int line_cnt = 0; - -static bool newpage = FALSE; - -static char *lastfmt, *lastarg; - - -void -discovered(struct rogue_state *rs) -{ - char ch; - bool disc_list; - - do { - disc_list = FALSE; - if (!terse) - addmsg(rs,"for "); - addmsg(rs,"what type"); - if (!terse) - addmsg(rs," of object do you want a list"); - msg(rs,"? (* for all)"); - ch = readchar(rs); - switch (ch) - { - case ESCAPE: - msg(rs,""); - return; - case POTION: - case SCROLL: - case RING: - case STICK: - case '*': - disc_list = TRUE; - break; - default: - if (terse) - msg(rs,"Not a type"); - else - msg(rs,"Please type one of %c%c%c%c (ESCAPE to quit)", POTION, SCROLL, RING, STICK); - } - } while (!disc_list); - if (ch == '*') - { - print_disc(rs,POTION); - add_line(rs,"", NULL); - print_disc(rs,SCROLL); - add_line(rs,"", NULL); - print_disc(rs,RING); - add_line(rs,"", NULL); - print_disc(rs,STICK); - end_line(rs); - } - else - { - print_disc(rs,ch); - end_line(rs); - } -} - -/* - * print_disc: - * Print what we've discovered of type 'type' - */ - -#define MAX4(a,b,c,d) (a > b ? (a > c ? (a > d ? a : d) : (c > d ? c : d)) : (b > c ? (b > d ? b : d) : (c > d ? c : d))) - - -void -print_disc(struct rogue_state *rs,char type) -{ - struct obj_info *info = NULL; - int i, maxnum = 0, num_found; - static THING obj; - static int order[MAX4(MAXSCROLLS, MAXPOTIONS, MAXRINGS, MAXSTICKS)]; - - switch (type) - { - case SCROLL: - maxnum = MAXSCROLLS; - info = scr_info; - break; - case POTION: - maxnum = MAXPOTIONS; - info = pot_info; - break; - case RING: - maxnum = MAXRINGS; - info = ring_info; - break; - case STICK: - maxnum = MAXSTICKS; - info = ws_info; - break; - } - set_order(order, maxnum); - obj.o_count = 1; - obj.o_flags = 0; - num_found = 0; - for (i = 0; i < maxnum; i++) - if (info[order[i]].oi_know || info[order[i]].oi_guess) - { - obj.o_type = type; - obj.o_which = order[i]; - add_line(rs,"%s", inv_name(&obj, FALSE)); - num_found++; - } - if (num_found == 0) - add_line(rs,nothing(type), NULL); -} - -/* - * set_order: - * Set up order for list - */ - -void -set_order(int *order, int numthings) -{ - int i, r, t; - - for (i = 0; i< numthings; i++) - order[i] = i; - - for (i = numthings; i > 0; i--) - { - r = rnd(i); - t = order[i - 1]; - order[i - 1] = order[r]; - order[r] = t; - } -} - -/* - * add_line: - * Add a line to the list of discoveries - */ -/* VARARGS1 */ -char -add_line(struct rogue_state *rs,char *fmt, char *arg) -{ - WINDOW *tw, *sw; - int x, y; - char *prompt = "--Press space to continue--"; - static int maxlen = -1; - - if (line_cnt == 0) - { - wclear(hw); - if (inv_type == INV_SLOW) - mpos = 0; - } - if (inv_type == INV_SLOW) - { - if (*fmt != '\0') - if (msg(rs,fmt, arg) == ESCAPE) - return ESCAPE; - line_cnt++; - } - else - { - if (maxlen < 0) - maxlen = (int) strlen(prompt); - if (line_cnt >= LINES - 1 || fmt == NULL) - { - if (inv_type == INV_OVER && fmt == NULL && !newpage) - { - msg(rs,""); - if ( rs->sleeptime != 0 ) - refresh(); - if ( rs->guiflag != 0 ) - { - tw = newwin(line_cnt + 1, maxlen + 2, 0, COLS - maxlen - 3); - sw = subwin(tw, line_cnt + 1, maxlen + 1, 0, COLS - maxlen - 2); - for (y = 0; y <= line_cnt; y++) - { - wmove(sw, y, 0); - for (x = 0; x <= maxlen; x++) - waddch(sw, mvwinch(hw, y, x)); - } - wmove(tw, line_cnt, 1); - waddstr(tw, prompt); - /* - * if there are lines below, use 'em - */ - if (LINES > NUMLINES) - { - if (NUMLINES + line_cnt > LINES) - mvwin(tw, LINES - (line_cnt + 1), COLS - maxlen - 3); - else - mvwin(tw, NUMLINES, 0); - } - touchwin(tw); - wrefresh(tw); - wait_for(rs,' '); - - if (md_hasclreol()) - { - werase(tw); - leaveok(tw, TRUE); - wrefresh(tw); - } - delwin(tw); - touchwin(stdscr); - } - else - { - wait_for(rs,' '); - } - } - else - { - char *promptex = "--Wait 5 sec.--"; - wmove(hw, LINES - 1, 0); - waddstr(hw, newpage ? promptex : prompt); - wrefresh(hw); - - if (newpage) { - - #ifdef _WIN32 - #ifdef _MSC_VER - #define sleep(x) Sleep(1000*(x)) - #endif - #endif - sleep(5); - - } else - wait_for(rs, ' '); - - clearok(curscr, TRUE); - wclear(hw); - - touchwin(stdscr); - } - newpage = TRUE; - line_cnt = 0; - - maxlen = (int) strlen(prompt); - } - if (fmt != NULL && !(line_cnt == 0 && *fmt == '\0')) - { - mvwprintw(hw, line_cnt++, 0, fmt, arg); - getyx(hw, y, x); - if (maxlen < x) - maxlen = x; - lastfmt = fmt; - lastarg = arg; - } - } - return ~ESCAPE; -} - -/* - * end_line: - * End the list of lines - */ - -void -end_line(struct rogue_state *rs) -{ - if (inv_type != INV_SLOW) - { - if (line_cnt == 1 && !newpage) - { - mpos = 0; - msg(rs,lastfmt, lastarg); - } - else - add_line(rs,(char *) NULL, NULL); - } - line_cnt = 0; - newpage = FALSE; -} - -/* - * nothing: - * Set up prbuf so that message for "nothing found" is there - */ -char * -nothing(char type) -{ - char *sp, *tystr = NULL; - - if (terse) - sprintf(prbuf, "Nothing"); - else - sprintf(prbuf, "Haven't discovered anything"); - if (type != '*') - { - sp = &prbuf[strlen(prbuf)]; - switch (type) - { - case POTION: tystr = "potion"; - when SCROLL: tystr = "scroll"; - when RING: tystr = "ring"; - when STICK: tystr = "stick"; - } - sprintf(sp, " about any %ss", tystr); - } - return prbuf; -} - -/* - * nameit: - * Give the proper name to a potion, stick, or ring - */ - -void -nameit(THING *obj, const char *type,const char *which, struct obj_info *op, - char *(*prfunc)(THING *)) -{ - char *pb; - - if (op->oi_know || op->oi_guess) - { - if (obj->o_count == 1) - sprintf(prbuf, "A %s ", type); - else - sprintf(prbuf, "%d %ss ", obj->o_count, type); - pb = &prbuf[strlen(prbuf)]; - if (op->oi_know) - sprintf(pb, "of %s%s(%s)", op->oi_name, (*prfunc)(obj), which); - else if (op->oi_guess) - sprintf(pb, "called %s%s(%s)", op->oi_guess, (*prfunc)(obj), which); - } - else if (obj->o_count == 1) - sprintf(prbuf, "A%s %s %s", vowelstr((char *)which), which, type); - else - sprintf(prbuf, "%d %s %ss", obj->o_count, which, type); -} - -/* - * nullstr: - * Return a pointer to a null-length string - */ -char * -nullstr(THING *ignored) -{ - NOOP(ignored); - return ""; -} - -# ifdef MASTER -/* - * pr_list: - * List possible potions, scrolls, etc. for wizard. - */ - -void -pr_list(struct rogue_state *rs) -{ - int ch; - - if (!terse) - addmsg(rs,"for "); - addmsg(rs,"what type"); - if (!terse) - addmsg(rs," of object do you want a list"); - msg(rs,"? "); - ch = readchar(rs); - switch (ch) - { - case POTION: - pr_spec(pot_info, MAXPOTIONS); - when SCROLL: - pr_spec(scr_info, MAXSCROLLS); - when RING: - pr_spec(ring_info, MAXRINGS); - when STICK: - pr_spec(ws_info, MAXSTICKS); - when ARMOR: - pr_spec(arm_info, MAXARMORS); - when WEAPON: - pr_spec(weap_info, MAXWEAPONS); - otherwise: - return; - } -} - -/* - * pr_spec: - * Print specific list of possible items to choose from - */ - -void -pr_spec(struct rogue_state *rs,struct obj_info *info, int nitems) -{ - struct obj_info *endp; - int i, lastprob; - - endp = &info[nitems]; - lastprob = 0; - for (i = '0'; info < endp; i++) - { - if (i == '9' + 1) - i = 'a'; - sprintf(prbuf, "%c: %%s (%d%%%%)", i, info->oi_prob - lastprob); - lastprob = info->oi_prob; - add_line(rs,prbuf, info->oi_name); - info++; - } - end_line(rs); -} -# endif /* MASTER */ diff --git a/src/cc/rogue/vers.c b/src/cc/rogue/vers.c deleted file mode 100644 index bcaf9bb8a..000000000 --- a/src/cc/rogue/vers.c +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * Version number. Whenever a new version number is desired, use sccs(!) - * to get vers.c. encstr is declared here to force it to be loaded - * before the version number, and therefore not to be written in saved - * games. - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -char *release = "5.4.4"; -char *encstr = "\300k||`\251Y.'\305\321\201+\277~r\"]\240_\223=1\341)\222\212\241t;\t$\270\314/<#\201\254"; -char *statlist = "\355kl{+\204\255\313idJ\361\214=4:\311\271\341wK<\312\321\213,,7\271/Rk%\b\312\f\246"; -char *version = "rogue (rogueforge) 09/05/07"; diff --git a/src/cc/rogue/weapons.c b/src/cc/rogue/weapons.c deleted file mode 100644 index 530a4302f..000000000 --- a/src/cc/rogue/weapons.c +++ /dev/null @@ -1,293 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * Functions for dealing with problems brought about by weapons - * - * @(#)weapons.c 4.34 (Berkeley) 02/05/99 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -//#include -//#include -//#include -#include "rogue.h" - -#define NO_WEAPON -1 - -int group = 2; - -static struct init_weaps { - char *iw_dam; /* Damage when wielded */ - char *iw_hrl; /* Damage when thrown */ - char iw_launch; /* Launching weapon */ - int iw_flags; /* Miscellaneous flags */ -} init_dam[MAXWEAPONS] = { - { "2x4", "1x3", NO_WEAPON, 0, }, /* Mace */ - { "3x4", "1x2", NO_WEAPON, 0, }, /* Long sword */ - { "1x1", "1x1", NO_WEAPON, 0, }, /* Bow */ - { "1x1", "2x3", BOW, ISMANY|ISMISL, }, /* Arrow */ - { "1x6", "1x4", NO_WEAPON, ISMISL|ISMISL, }, /* Dagger */ - { "4x4", "1x2", NO_WEAPON, 0, }, /* 2h sword */ - { "1x1", "1x3", NO_WEAPON, ISMANY|ISMISL, }, /* Dart */ - { "1x2", "2x4", NO_WEAPON, ISMANY|ISMISL, }, /* Shuriken */ - { "2x3", "1x6", NO_WEAPON, ISMISL, }, /* Spear */ -}; - -/* - * missile: - * Fire a missile in a given direction - */ - -void -missile(struct rogue_state *rs,int ydelta, int xdelta) -{ - THING *obj; - - /* - * Get which thing we are hurling - */ - if ((obj = get_item(rs,"throw", WEAPON)) == NULL) - return; - if (!dropcheck(rs,obj) || is_current(rs,obj)) - return; - obj = leave_pack(rs,obj, TRUE, FALSE); - do_motion(rs,obj, ydelta, xdelta); - /* - * AHA! Here it has hit something. If it is a wall or a door, - * or if it misses (combat) the monster, put it on the floor - */ - if (moat(obj->o_pos.y, obj->o_pos.x) == NULL || - !hit_monster(rs,unc(obj->o_pos), obj)) - fall(rs,obj, TRUE); -} - -/* - * do_motion: - * Do the actual motion on the screen done by an object traveling - * across the room - */ - -void -do_motion(struct rogue_state *rs,THING *obj, int ydelta, int xdelta) -{ - int ch; - - /* - * Come fly with us ... - */ - obj->o_pos = hero; - for (;;) - { - if ( rs->replaydone != 0 ) - return; - /* - * Erase the old one - */ - if (!ce(obj->o_pos, hero) && cansee(rs,unc(obj->o_pos)) && !terse) - { - ch = chat(obj->o_pos.y, obj->o_pos.x); - if (ch == FLOOR && !show_floor()) - ch = ' '; - mvaddch(obj->o_pos.y, obj->o_pos.x, ch); - } - /* - * Get the new position - */ - obj->o_pos.y += ydelta; - obj->o_pos.x += xdelta; - if (step_ok(ch = winat(obj->o_pos.y, obj->o_pos.x)) && ch != DOOR) - { - /* - * It hasn't hit anything yet, so display it - * If it alright. - */ - if (cansee(rs,unc(obj->o_pos)) && !terse) - { - mvaddch(obj->o_pos.y, obj->o_pos.x, obj->o_type); - if ( rs->sleeptime != 0 ) - refresh(); - } - continue; - } - break; - } -} - -/* - * fall: - * Drop an item someplace around here. - */ - -void -fall(struct rogue_state *rs,THING *obj, bool pr) -{ - PLACE *pp; - static coord fpos; - - if (fallpos(&obj->o_pos, &fpos)) - { - pp = INDEX(fpos.y, fpos.x); - pp->p_ch = (char) obj->o_type; - obj->o_pos = fpos; - if (cansee(rs,fpos.y, fpos.x)) - { - if (pp->p_monst != NULL) - pp->p_monst->t_oldch = (char) obj->o_type; - else - mvaddch(fpos.y, fpos.x, obj->o_type); - } - attach(lvl_obj, obj); - return; - } - if (pr) - { - if (has_hit) - { - endmsg(rs); - has_hit = FALSE; - } - msg(rs,"the %s vanishes as it hits the ground", - weap_info[obj->o_which].oi_name); - } - discard(obj); -} - -/* - * init_weapon: - * Set up the initial goodies for a weapon - */ - -void -init_weapon(THING *weap, int which) -{ - struct init_weaps *iwp; - weap->o_type = WEAPON; - weap->o_which = which; - iwp = &init_dam[which]; - strncpy(weap->o_damage, iwp->iw_dam, sizeof(weap->o_damage)); - strncpy(weap->o_hurldmg,iwp->iw_hrl, sizeof(weap->o_hurldmg)); - weap->o_launch = iwp->iw_launch; - weap->o_flags = iwp->iw_flags; - weap->o_hplus = 0; - weap->o_dplus = 0; - if (which == DAGGER) - { - weap->o_count = rnd(4) + 2; - weap->o_group = group++; - } - else if (weap->o_flags & ISMANY) - { - weap->o_count = rnd(8) + 8; - weap->o_group = group++; - } - else - { - weap->o_count = 1; - weap->o_group = 0; - } -} - -/* - * hit_monster: - * Does the missile hit the monster? - */ -int -hit_monster(struct rogue_state *rs,int y, int x, THING *obj) -{ - static coord mp; - - mp.y = y; - mp.x = x; - return fight(rs,&mp, obj, TRUE); -} - -/* - * num: - * Figure out the plus number for armor/weapons - */ -char * -num(int n1, int n2, char type) -{ - static char numbuf[10]; - - sprintf(numbuf, n1 < 0 ? "%d" : "+%d", n1); - if (type == WEAPON) - sprintf(&numbuf[strlen(numbuf)], n2 < 0 ? ",%d" : ",+%d", n2); - return numbuf; -} - -/* - * wield: - * Pull out a certain weapon - */ - -void -wield(struct rogue_state *rs) -{ - THING *obj, *oweapon; - char *sp; - - oweapon = cur_weapon; - if (!dropcheck(rs,cur_weapon)) - { - cur_weapon = oweapon; - return; - } - cur_weapon = oweapon; - if ((obj = get_item(rs,"wield", WEAPON)) == NULL) - { -bad: - after = FALSE; - return; - } - - if (obj->o_type == ARMOR) - { - msg(rs,"you can't wield armor"); - goto bad; - } - if (is_current(rs,obj)) - goto bad; - - sp = inv_name(obj, TRUE); - cur_weapon = obj; - if (!terse) - addmsg(rs,"you are now "); - msg(rs,"wielding %s (%c)", sp, obj->o_packch); -} - -/* - * fallpos: - * Pick a random position around the give (y, x) coordinates - */ -bool -fallpos(coord *pos, coord *newpos) -{ - int y, x, cnt, ch; - - cnt = 0; - for (y = pos->y - 1; y <= pos->y + 1; y++) - for (x = pos->x - 1; x <= pos->x + 1; x++) - { - /* - * check to make certain the spot is empty, if it is, - * put the object there, set it in the level list - * and re-draw the room if he can see it - */ - if (y == hero.y && x == hero.x) - continue; - if (((ch = chat(y, x)) == FLOOR || ch == PASSAGE) - && rnd(++cnt) == 0) - { - newpos->y = y; - newpos->x = x; - } - } - return (bool)(cnt != 0); -} diff --git a/src/cc/rogue/wizard.c b/src/cc/rogue/wizard.c deleted file mode 100644 index a1721ec73..000000000 --- a/src/cc/rogue/wizard.c +++ /dev/null @@ -1,289 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * Special wizard commands (some of which are also non-wizard commands - * under strange circumstances) - * - * @(#)wizard.c 4.30 (Berkeley) 02/05/99 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ - -//#include -//#include -//#include -//#include -#include "rogue.h" - -/* - * whatis: - * What a certin object is - */ - -void -whatis(struct rogue_state *rs,bool insist, int type) -{ - THING *obj; - - if (pack == NULL) - { - msg(rs,"you don't have anything in your pack to identify"); - return; - } - - for (;;) - { - if ( rs->replaydone != 0 ) - return; - obj = get_item(rs,"identify", type); - if (insist) - { - if (n_objs == 0) - return; - else if (obj == NULL) - msg(rs,"you must identify something"); - else if (type && obj->o_type != type && - !(type == R_OR_S && (obj->o_type == RING || obj->o_type == STICK)) ) - msg(rs,"you must identify a %s", type_name(type)); - else - break; - } - else - break; - } - - if (obj == NULL) - return; - - switch (obj->o_type) - { - case SCROLL: - set_know(obj, scr_info); - when POTION: - set_know(obj, pot_info); - when STICK: - set_know(obj, ws_info); - when WEAPON: - case ARMOR: - obj->o_flags |= ISKNOW; - when RING: - set_know(obj, ring_info); - } - msg(rs,inv_name(obj, FALSE)); -} - -/* - * set_know: - * Set things up when we really know what a thing is - */ - -void -set_know(THING *obj, struct obj_info *info) -{ - char **guess; - - info[obj->o_which].oi_know = TRUE; - obj->o_flags |= ISKNOW; - guess = &info[obj->o_which].oi_guess; - if (*guess) - { - free(*guess); - *guess = NULL; - } -} - -/* - * type_name: - * Return a pointer to the name of the type - */ -char * -type_name(int type) -{ - struct h_list *hp; - static struct h_list tlist[] = { - {POTION, "potion", FALSE}, - {SCROLL, "scroll", FALSE}, - {FOOD, "food", FALSE}, - {R_OR_S, "ring, wand or staff", FALSE}, - {RING, "ring", FALSE}, - {STICK, "wand or staff", FALSE}, - {WEAPON, "weapon", FALSE}, - {ARMOR, "suit of armor", FALSE}, - }; - - for (hp = tlist; hp->h_ch; hp++) - if (type == hp->h_ch) - return hp->h_desc; - /* NOTREACHED */ - return(0); -} - -#ifdef MASTER -/* - * create_obj: - * wizard command for getting anything he wants - */ - -void -create_obj(struct rogue_state *rs) -{ - THING *obj; - char ch, bless; - - obj = new_item(); - msg(rs,"type of item: "); - obj->o_type = readchar(rs); - mpos = 0; - msg(rs,"which %c do you want? (0-f)", obj->o_type); - obj->o_which = (isdigit((ch = readchar(rs))) ? ch - '0' : ch - 'a' + 10); - obj->o_group = 0; - obj->o_count = 1; - mpos = 0; - if (obj->o_type == WEAPON || obj->o_type == ARMOR) - { - msg(rs,"blessing? (+,-,n)"); - bless = readchar(rs); - mpos = 0; - if (bless == '-') - obj->o_flags |= ISCURSED; - if (obj->o_type == WEAPON) - { - init_weapon(obj, obj->o_which); - if (bless == '-') - obj->o_hplus -= rnd(3)+1; - if (bless == '+') - obj->o_hplus += rnd(3)+1; - } - else - { - obj->o_arm = a_class[obj->o_which]; - if (bless == '-') - obj->o_arm += rnd(3)+1; - if (bless == '+') - obj->o_arm -= rnd(3)+1; - } - } - else if (obj->o_type == RING) - switch (obj->o_which) - { - case R_PROTECT: - case R_ADDSTR: - case R_ADDHIT: - case R_ADDDAM: - msg(rs,"blessing? (+,-,n)"); - bless = readchar(rs); - mpos = 0; - if (bless == '-') - obj->o_flags |= ISCURSED; - obj->o_arm = (bless == '-' ? -1 : rnd(2) + 1); - when R_AGGR: - case R_TELEPORT: - obj->o_flags |= ISCURSED; - } - else if (obj->o_type == STICK) - fix_stick(obj); - else if (obj->o_type == GOLD) - { - msg(rs,"how much?"); - get_num(&obj->o_goldval, stdscr); - } - add_pack(rs,obj, FALSE); -} -#endif - -/* - * telport: - * Bamf the hero someplace else - */ - -void -teleport(struct rogue_state *rs) -{ - static coord c; - - mvaddch(hero.y, hero.x, floor_at()); - find_floor(rs,(struct room *) NULL, &c, FALSE, TRUE); - if (roomin(rs,&c) != proom) - { - leave_room(rs,&hero); - hero = c; - enter_room(rs,&hero); - } - else - { - hero = c; - look(rs,TRUE); - } - mvaddch(hero.y, hero.x, PLAYER); - /* - * turn off ISHELD in case teleportation was done while fighting - * a Flytrap - */ - if (on(player, ISHELD)) { - player.t_flags &= ~ISHELD; - vf_hit = 0; - strcpy(monsters['F'-'A'].m_stats.s_dmg, "000x0"); - } - no_move = 0; - count = 0; - running = FALSE; - flush_type(); -} - -#ifdef MASTER -/* - * passwd: - * See if user knows password - */ -int -passwd(struct rogue_state *rs) -{ - char *sp, c; - static char buf[MAXSTR]; - - msg(rs,"wizard's Password:"); - mpos = 0; - sp = buf; - while ((c = readchar(rs)) != '\n' && c != '\r' && c != ESCAPE) - if (c == md_killchar()) - sp = buf; - else if (c == md_erasechar() && sp > buf) - sp--; - else - *sp++ = c; - if (sp == buf) - return FALSE; - *sp = '\0'; - return (strcmp(PASSWD, md_crypt(buf, "mT")) == 0); -} - -/* - * show_map: - * Print out the map for the wizard - */ - -void -show_map(struct rogue_state *rs) -{ - int y, x, real; - - wclear(hw); - for (y = 1; y < NUMLINES - 1; y++) - for (x = 0; x < NUMCOLS; x++) - { - real = flat(y, x); - if (!(real & F_REAL)) - wstandout(hw); - wmove(hw, y, x); - waddch(hw, chat(y, x)); - if (!real) - wstandend(hw); - } - show_win(rs,"---More (level map)---"); -} -#endif diff --git a/src/cc/rogue/x86_64-w64-msvc/deps/install/include/acs_defs.h b/src/cc/rogue/x86_64-w64-msvc/deps/install/include/acs_defs.h deleted file mode 100644 index c8c02a737..000000000 --- a/src/cc/rogue/x86_64-w64-msvc/deps/install/include/acs_defs.h +++ /dev/null @@ -1,265 +0,0 @@ -/* Many of the following #defines are completely unused for the -nonce. For each character, its code point in code page 437, -Unicode, and page 8859-1 are given. The first is used for -non-wide builds in Win32 console, DOS, SDL, and OS/2. -Unicode is used for all wide builds, and for the non-wide -build of WinGUI. Code page 8859-1 is used for non-wide X11. - - All of these characters exist in CP437 and Unicode. Some -don't exist in 8859-1, in which case the last column is 'TBD'. -Only 32 are used in ncurses. So caution is advised. */ - -#ifdef USE_ISO8859_CHARSET - #define CHOOSE( A, B, C) (C) - #define TBD '!' -#else - #define CHOOSE( A, B, C) (USE_UNICODE_ACS_CHARS ? B : A) -#endif - -/* Codes found from https://en.wikipedia.org/wiki/Code_page_437 */ - -#define SMILE CHOOSE( 0x01, 0x263a, 'O') -#define REV_SMILE CHOOSE( 0x02, 0x263b, 'O') -#define HEART CHOOSE( 0x03, 0x2665, 'H') -#define DIAMOND CHOOSE( 0x04, 0x2666, 0x01) -#define CLUB CHOOSE( 0x05, 0x2663, 'C') -#define SPADE CHOOSE( 0x06, 0x2660, 'S') -#define MEDIUM_BULLET CHOOSE( 0x07, 0x2022, 0xb7) -#define REV_BULLET CHOOSE( 0x08, 0x2508, 0xb7) -#define WHITE_BULLET CHOOSE( 0x09, 0x25cb, 7) -#define REV_WHITE_BULLET CHOOSE( 0x0a, 0x25D9, 7) -#define MALE_SYM CHOOSE( 0x0b, 0x2642, 'm') -#define FEMALE_SYM CHOOSE( 0x0c, 0x2640, 'f') -#define QTR_NOTE CHOOSE( 0x0d, 0x266a, 0xbc) -#define EIGHTH_NOTE CHOOSE( 0x0e, 0x266b, 0xbd) -#define SPLAT CHOOSE( 0x0f, 0xa4 , 0xa4) -#define RIGHT_TRIANGLE CHOOSE( 0x10, 0x25b6, '>') -#define LEFT_TRIANGLE CHOOSE( 0x11, 0x25c0, '<') -#define UP_DOWN_ARROW CHOOSE( 0x12, 0x2195, 0x19) -#define DBL_BANG CHOOSE( 0x13, 0x203c, '!') -#define PILCROW CHOOSE( 0x14, 0xb6 , 0xb6) -#define SECTION_SIGN CHOOSE( 0x15, 0xa7 , 0xa7) -#define LOW_QTR_BLOCK CHOOSE( 0x16, 0x25b2, '_') -#define UP_DOWN_ARROW_UNDERSCORED CHOOSE( 0x17, 0x21ab, 0x19) -#define UP_ARROW CHOOSE( 0x18, 0x2191, '^') -#define DOWN_ARROW CHOOSE( 0x19, 0x2193, 'v') -#define RIGHT_ARROW CHOOSE( 0x1a, 0x2192, '>') -#define LEFT_ARROW CHOOSE( 0x1b, 0x2190, '<') -#define RIGHT_ANGLE CHOOSE( 0x1c, 0x221f, 0xe) -#define LEFT_RIGHT_ARROW CHOOSE( 0x1d, 0x2194, '-') -#define UP_TRIANGLE CHOOSE( 0x1e, 0x25b2, '^') -#define DOWN_TRIANGLE CHOOSE( 0x1f, 0x25bc, 'v') - -#define UPPERCASE_C_CEDILLA CHOOSE( 0x80, 0xc7 , 0xc7) -#define LOWERCASE_U_UMLAUT CHOOSE( 0x81, 0xfc , 0xfc) -#define LOWERCASE_E_ACUTE CHOOSE( 0x82, 0xe9 , 0xe9) -#define LOWERCASE_A_CIRCUMFLEX CHOOSE( 0x83, 0xe2 , 0xe2) -#define LOWERCASE_A_UMLAUT CHOOSE( 0x84, 0xe4 , 0xe4) -#define LOWERCASE_A_GRAVE CHOOSE( 0x85, 0xe0 , 0xea) -#define LOWERCASE_A_RING CHOOSE( 0x86, 0xe5 , 0xe5) -#define LOWERCASE_C_CEDILLA CHOOSE( 0x87, 0xe7 , 0xe7) -#define LOWERCASE_E_CIRCUMFLEX CHOOSE( 0x88, 0xea , 0xea) -#define LOWERCASE_E_UMLAUT CHOOSE( 0x89, 0xeb , 0xeb) -#define LOWERCASE_E_GRAVE CHOOSE( 0x8a, 0xe8 , 0xe8) -#define LOWERCASE_I_UMLAUT CHOOSE( 0x8b, 0xef , 0xef) -#define LOWERCASE_I_CIRCUMFLEX CHOOSE( 0x8c, 0xee , 0xee) -#define LOWERCASE_I_GRAVE CHOOSE( 0x8d, 0xec , 0xce) -#define UPPERCASE_A_UMLAUT CHOOSE( 0x8e, 0xc4 , 0xc4) -#define UPPERCASE_A_RING CHOOSE( 0x8f, 0xc5 , 0xc5) - -#define UPPERCASE_E_ACUTE CHOOSE( 0x90, 0xc9 , 0xc9) -#define LOWERCASE_AE_LIGATURE CHOOSE( 0x91, 0xe6 , 0xe6) -#define UPPERCASE_AE_LIGATURE CHOOSE( 0x92, 0xc6 , 0xc6) -#define LOWERCASE_O_CIRCUMFLEX CHOOSE( 0x93, 0xf4 , 0xf4) -#define LOWERCASE_O_UMLAUT CHOOSE( 0x94, 0xf6 , 0xf6) -#define LOWERCASE_O_GRAVE CHOOSE( 0x95, 0xf2 , 0xf2) -#define LOWERCASE_U_CIRCUMFLEX CHOOSE( 0x96, 0xfb , 0xfb) -#define LOWERCASE_U_GRAVE CHOOSE( 0x97, 0xf9 , 0xf9) -#define LOWERCASE_Y_UMLAUT CHOOSE( 0x98, 0xff , 0xff) -#define UPPERCASE_O_UMLAUT CHOOSE( 0x99, 0xd6 , 0xd6) -#define UPPERCASE_U_UMLAUT CHOOSE( 0x9a, 0xdc , 0xdc) -#define CENT_SIGN CHOOSE( 0x9b, 0xa2 , 0xa2) -#define STERLING_SIGN CHOOSE( 0x9c, 0xa3 , 30) -#define YEN_SIGN CHOOSE( 0x9d, 0xa5 , 0xa5) -#define PESETA_SIGN CHOOSE( 0x9e, 0x20a7, TBD) -#define F_WITH_HOOK CHOOSE( 0x9f, 0x0192, TBD) - -#define LOWERCASE_A_ACUTE CHOOSE( 0xa0, 0xe1 , 0xe1) -#define LOWERCASE_I_ACUTE CHOOSE( 0xa1, 0xed , 0xed) -#define LOWERCASE_O_ACUTE CHOOSE( 0xa2, 0xf3 , 0xf3) -#define LOWERCASE_U_ACUTE CHOOSE( 0xa3, 0xfa , 0xfa) -#define LOWERCASE_N_TILDE CHOOSE( 0xa4, 0xf1 , 0xf1) -#define UPPERCASE_N_TILDE CHOOSE( 0xa5, 0xd1 , 0xd1) -#define A_ORDINAL CHOOSE( 0xa6, 0xaa , 0xaa) -#define O_ORDINAL CHOOSE( 0xa7, 0xba , 0xba) -#define INVERTED_QUESTION_MARK CHOOSE( 0xa8, 0xbf , 0xbf) -#define REVERSED_NOT_SIGN CHOOSE( 0xa9, 0x2310, TBD) -#define NOT_SIGN CHOOSE( 0xaa, 0xac , 0xac) -#define VULGAR_HALF CHOOSE( 0xab, 0xbd , 0xbd) -#define VULGAR_QUARTER CHOOSE( 0xac, 0xbc , 0xbc) -#define INVERTED_EXCLAMATION_MARK CHOOSE( 0xad, 0xa1 , 0xa1) -#define LEFT_ANGLE_QUOTE_MARK CHOOSE( 0xae, 0xab , 0xab) -#define RIGHT_ANGLE_QUOTE_MARK CHOOSE( 0xaf, 0xbb , 0xbb) - -#define LIGHT_SHADE CHOOSE( 0xb0, 0x2591, '#' ) -#define MEDIUM_SHADE CHOOSE( 0xb1, 0x2592, 2) -#define DARK_SHADE CHOOSE( 0xb2, 0x2593, TBD) -#define BOX_VLINE CHOOSE( 0xb3, 0x2502, 25) -#define BOX_RTEE CHOOSE( 0xb4, 0x2524, 22) -#define BOX_SD_RTEE CHOOSE( 0xb5, 0x2561, 22) -#define BOX_DS_RTEE CHOOSE( 0xb6, 0x2562, 22) -#define BOX_DS_URCORNER CHOOSE( 0xb7, 0x2556, 12) -#define BOX_SD_URCORNER CHOOSE( 0xb8, 0x2555, 12) -#define BOX_D_RTEE CHOOSE( 0xb9, 0x2563, 22) -#define BOX_D_VLINE CHOOSE( 0xba, 0x2551, 25) -#define BOX_D_URCORNER CHOOSE( 0xbb, 0x2557, 12) -#define BOX_D_LRCORNER CHOOSE( 0xbc, 0x255D, 11) -#define BOX_DS_LRCORNER CHOOSE( 0xbd, 0x255c, 11) -#define BOX_SD_LRCORNER CHOOSE( 0xbe, 0x255b, 11) -#define BOX_URCORNER CHOOSE( 0xbf, 0x2510, 12) - -#define BOX_LLCORNER CHOOSE( 0xc0, 0x2514, 14) -#define BOX_BTEE CHOOSE( 0xc1, 0x2534, 23) -#define BOX_TTEE CHOOSE( 0xc2, 0x252c, 24) -#define BOX_LTEE CHOOSE( 0xc3, 0x251c, 21) -#define BOX_HLINE CHOOSE( 0xc4, 0x2500, 18) -#define BOX_PLUS CHOOSE( 0xc5, 0x253c, 15) -#define BOX_SD_LTEE CHOOSE( 0xc6, 0x255e, 21) -#define BOX_DS_LTEE CHOOSE( 0xc7, 0x255f, 21) -#define BOX_D_LLCORNER CHOOSE( 0xc8, 0x255A, 14) -#define BOX_D_ULCORNER CHOOSE( 0xc9, 0x2554, 13) -#define BOX_D_BTEE CHOOSE( 0xca, 0x2569, 23) -#define BOX_D_TTEE CHOOSE( 0xcb, 0x2566, 24) -#define BOX_D_LTEE CHOOSE( 0xcc, 0x2560, 21) -#define BOX_D_HLINE CHOOSE( 0xcd, 0x2550, 18) -#define BOX_D_PLUS CHOOSE( 0xce, 0x256C, 15) -#define BOX_SD_BTEE CHOOSE( 0xcf, 0x2567, 23) - -#define BOX_DS_BTEE CHOOSE( 0xd0, 0x2568, 23) -#define BOX_SD_TTEE CHOOSE( 0xd1, 0x2564, 24) -#define BOX_DS_TTEE CHOOSE( 0xd2, 0x2565, 24) -#define BOX_DS_LLCORNER CHOOSE( 0xd3, 0x2559, 14) -#define BOX_SD_LLCORNER CHOOSE( 0xd4, 0x2558, 14) -#define BOX_SD_ULCORNER CHOOSE( 0xd5, 0x2552, 13) -#define BOX_DS_ULCORNER CHOOSE( 0xd6, 0x2553, 13) -#define BOX_DS_PLUS CHOOSE( 0xd7, 0x256b, 15) -#define BOX_SD_PLUS CHOOSE( 0xd8, 0x256a, 15) -#define BOX_LRCORNER CHOOSE( 0xd9, 0x2518, 11) -#define BOX_ULCORNER CHOOSE( 0xda, 0x250c, 13) -#define FULL_BLOCK CHOOSE( 0xdb, 0x2588, 0) -#define LOWER_HALF_BLOCK CHOOSE( 0xdc, 0x2584, TBD) -#define LEFT_HALF_BLOCK CHOOSE( 0xdd, 0x258c, TBD) -#define RIGHT_HALF_BLOCK CHOOSE( 0xde, 0x2590, TBD) -#define UPPER_HALF_BLOCK CHOOSE( 0xdf, 0x2580, TBD) - -#define ALPHA CHOOSE( 0xe0, 0x03b1, TBD) -#define BETA CHOOSE( 0xe1, 0x00df, TBD) -#define GAMMA CHOOSE( 0xe2, 0x0393, TBD) -#define PI CHOOSE( 0xe3, 0x03c0, 28) -#define UPPERCASE_SIGMA CHOOSE( 0xe4, 0x03a3, TBD) -#define LOWERCASE_SIGMA CHOOSE( 0xe5, 0x03c3, TBD) -#define MU CHOOSE( 0xe6, 0x00b5, 0xb5) -#define TAU CHOOSE( 0xe7, 0x03c4, TBD) -#define UPPERCASE_PHI CHOOSE( 0xe8, 0x03a6, TBD) -#define THETA CHOOSE( 0xe9, 0x0398, TBD) -#define OMEGA CHOOSE( 0xea, 0x03a9, TBD) -#define DELTA CHOOSE( 0xeb, 0x03b4, TBD) -#define INFINITY_SIGN CHOOSE( 0xec, 0x221e, TBD) -#define LOWERCASE_PHI CHOOSE( 0xed, 0x03c6, TBD) -#define EPSILON CHOOSE( 0xee, 0x03b5, TBD) -#define INTERSECTION CHOOSE( 0xef, 0x2229, TBD) - -#define TRIPLE_BAR CHOOSE( 0xf0, 0x2261, TBD) -#define PLUS_OR_MINUS CHOOSE( 0xf1, 0x00b1, 8) -#define GREATER_THAN_OR_EQUAL_TO CHOOSE( 0xf2, 0x2265, 27) -#define LESSER_THAN_OR_EQUAL_TO CHOOSE( 0xf3, 0x2264, 26) -#define UPPER_HALF_INTEGRAL_SIGN CHOOSE( 0xf4, 0x2320, TBD) -#define LOWER_HALF_INTEGRAL_SIGN CHOOSE( 0xf5, 0x2321, TBD) -#define DIVISION_SIGN CHOOSE( 0xf6, 0x00f7, 0xf7) -#define APPROXIMATELY_EQUALS_SIGN CHOOSE( 0xf7, 0x2248, TBD) -#define DEGREE_SIGN CHOOSE( 0xf8, 0x00b0, 0xb0) -#define LARGE_BULLET CHOOSE( 0xf9, 0x2219, 7) -#define SMALL_BULLET CHOOSE( 0xfa, 0x00b7, 0xb7) -#define SQUARE_ROOT CHOOSE( 0xfb, 0x221a, TBD) -#define SUPERSCRIPT_N CHOOSE( 0xfc, 0x207f, TBD) -#define SUPERSCRIPT_2 CHOOSE( 0xfd, 0x00b2, 0xb2) -#define CENTERED_SQUARE CHOOSE( 0xfe, 0x25a0, TBD) -#define NON_BREAKING_SPACE CHOOSE( 0xff, 0x00a0, TBD) - - - - /* It says at http://unicode.org/charts/PDF/U2300.pdf */ - /* that '...the scan line numbers here refer to old, */ - /* low-resolution technology for terminals, with only */ - /* nine scan lines per fixed-size character glyph. */ - /* Even-numbered scan lines are unified with box */ - /* drawing graphics." */ - /* The utility of these is questionable; they'd */ - /* work Just Fine in wingdi (_if_ the appropriate */ - /* glyphs are available), but not elsewhere. */ -#define HORIZ_SCAN_LINE_1 CHOOSE( 0x2d, 0x23ba, 16) -#define HORIZ_SCAN_LINE_3 CHOOSE( 0x2d, 0x23bb, 17) -#define HORIZ_SCAN_LINE_7 CHOOSE( 0x2d, 0x23bc, 19) -#define HORIZ_SCAN_LINE_9 CHOOSE( '_', 0x23bd, 20) - - /* Code page 437 lacks a 'for real' not-equals, so for that, */ - /* we use the double-horizontal single-vertical box drawing : */ -#define NOT_EQUALS_SIGN CHOOSE( 0xd8, 0x2260, 29) - -# define A(x) ((chtype)x | A_ALTCHARSET) - -chtype acs_map[128] = -{ - A(0), A(1), A(2), A(3), A(4), A(5), A(6), A(7), A(8), - A(9), A(10), - CLUB, HEART, SPADE, SMILE, REV_SMILE, /* 11 12 13 14 15 */ - MEDIUM_BULLET, WHITE_BULLET, PILCROW, SECTION_SIGN, /* 16 17 18 19 */ - A_ORDINAL, O_ORDINAL, LOWERCASE_PHI, /* 20 21 22 */ - INVERTED_EXCLAMATION_MARK, INVERTED_QUESTION_MARK, /* 23 24 */ - REVERSED_NOT_SIGN, NOT_SIGN, /* 25 26 */ - UPPER_HALF_INTEGRAL_SIGN, LOWER_HALF_INTEGRAL_SIGN, /* 27 28 */ - SUPERSCRIPT_N, CENTERED_SQUARE, F_WITH_HOOK, /* 29 30 31 */ - - RIGHT_ARROW, LEFT_ARROW, UP_ARROW, DOWN_ARROW, /* 32 !"# */ - - PI, NOT_EQUALS_SIGN, VULGAR_HALF, VULGAR_QUARTER, /* $%&' */ - '(', - LEFT_ANGLE_QUOTE_MARK, RIGHT_ANGLE_QUOTE_MARK, /* )* */ - DARK_SHADE, SUPERSCRIPT_2, INFINITY_SIGN, /* +,- */ - ALPHA, BETA, GAMMA, UPPERCASE_SIGMA, LOWERCASE_SIGMA, /* ./012 */ - '3', - MU, TAU, UPPERCASE_PHI, THETA, OMEGA, DELTA, EPSILON, /* 456789: */ - - BOX_SD_LRCORNER, BOX_SD_URCORNER, BOX_SD_ULCORNER, /* ;<= */ - BOX_SD_LLCORNER, BOX_SD_PLUS, /* >? */ - BOX_SD_LTEE, BOX_SD_RTEE, BOX_SD_BTEE, BOX_SD_TTEE, /* @ABC */ - - BOX_D_LRCORNER, BOX_D_URCORNER, BOX_D_ULCORNER, /* DEF */ - BOX_D_LLCORNER, BOX_D_PLUS, /* GH */ - BOX_D_LTEE, BOX_D_RTEE, BOX_D_BTEE, BOX_D_TTEE, /* IJKL */ - - BOX_DS_LRCORNER, BOX_DS_URCORNER, BOX_DS_ULCORNER, /* MNO */ - BOX_DS_LLCORNER, BOX_DS_PLUS, /* PQ */ - BOX_DS_LTEE, BOX_DS_RTEE, BOX_DS_BTEE, BOX_DS_TTEE, /* RSTU */ - - BOX_LRCORNER, BOX_URCORNER, BOX_ULCORNER, /* VWX */ - BOX_LLCORNER, BOX_PLUS, /* YZ */ - BOX_LTEE, BOX_RTEE, BOX_BTEE, BOX_TTEE, /* [\]^ */ - - BOX_HLINE, BOX_VLINE, BOX_D_HLINE, BOX_D_VLINE, /* _`ab */ - - DIVISION_SIGN, APPROXIMATELY_EQUALS_SIGN, /* cd */ - INTERSECTION, TRIPLE_BAR, /* ef */ - SMALL_BULLET, LARGE_BULLET, SQUARE_ROOT, /* ghi */ - DIAMOND, MEDIUM_SHADE, /* jk */ - HORIZ_SCAN_LINE_1, HORIZ_SCAN_LINE_3, /* lm */ - HORIZ_SCAN_LINE_7, HORIZ_SCAN_LINE_9, /* no */ - UPPER_HALF_BLOCK, LOWER_HALF_BLOCK, /* pq */ - LEFT_HALF_BLOCK, RIGHT_HALF_BLOCK, FULL_BLOCK, /* rst */ - LESSER_THAN_OR_EQUAL_TO, GREATER_THAN_OR_EQUAL_TO, /* uv */ - DEGREE_SIGN, PLUS_OR_MINUS, LIGHT_SHADE, SPLAT, /* wxyz */ - CENT_SIGN, YEN_SIGN, PESETA_SIGN, STERLING_SIGN, /* {|}~ */ - A(127) -}; - -# undef A diff --git a/src/cc/rogue/x86_64-w64-msvc/deps/install/include/curses.h b/src/cc/rogue/x86_64-w64-msvc/deps/install/include/curses.h deleted file mode 100644 index 9ee3f08a6..000000000 --- a/src/cc/rogue/x86_64-w64-msvc/deps/install/include/curses.h +++ /dev/null @@ -1,1846 +0,0 @@ -/* Public Domain Curses */ - -/*----------------------------------------------------------------------* - * PDCurses * - *----------------------------------------------------------------------*/ - -#ifndef __PDCURSES__ -#define __PDCURSES__ 1 - -/*man-start************************************************************** - -PDCurses definitions list: (Only define those needed) - - XCURSES True if compiling for X11. - PDC_RGB True if you want to use RGB color definitions - (Red = 1, Green = 2, Blue = 4) instead of BGR. - PDC_WIDE True if building wide-character support. - PDC_DLL_BUILD True if building a Windows DLL. - PDC_NCMOUSE Use the ncurses mouse API instead - of PDCurses' traditional mouse API. - -PDCurses portable platform definitions list: - - PDC_BUILD Defines API build version. - PDCURSES Enables access to PDCurses-only routines. - XOPEN Always true. - SYSVcurses True if you are compiling for SYSV portability. - BSDcurses True if you are compiling for BSD portability. - -**man-end****************************************************************/ - -#define PDCURSES 1 /* PDCurses-only routines */ -#define XOPEN 1 /* X/Open Curses routines */ -#define SYSVcurses 1 /* System V Curses routines */ -#define BSDcurses 1 /* BSD Curses routines */ -#if defined( CHTYPE_32) - #define CHTYPE_LONG 1 /* chtypes will be 32 bits */ -#elif !defined( CHTYPE_16) - #define CHTYPE_LONG 2 /* chtypes will be (default) 64 bits */ -#endif - -/*----------------------------------------------------------------------*/ - -#ifdef NO_STDINT_H - #define uint64_t unsigned long long - #define uint32_t unsigned long - #define uint16_t unsigned short -#else - #include -#endif -#include -#include -#include /* Required by X/Open usage below */ - -#ifdef PDC_WIDE -# include -#endif - -#if defined(__STDC_VERSION__) && __STDC_VERSION >= 199901L && \ - !defined(__bool_true_false_are_defined) -# include -#endif - -#ifdef __cplusplus -extern "C" -{ -# define bool _bool -#endif - -/*---------------------------------------------------------------------- - * - * Constants and Types - * - */ - -#undef FALSE -#undef TRUE - -#ifdef __bool_true_false_are_defined - -# define FALSE false -# define TRUE true - -#else - -typedef unsigned char bool; - -# define FALSE 0 -# define TRUE 1 - -#endif - -#undef ERR -#define ERR (-1) - -#undef OK -#define OK 0 - -#ifdef CHTYPE_LONG - #if(CHTYPE_LONG >= 2) /* "non-standard" 64-bit chtypes */ - typedef uint64_t chtype; - #else /* "Standard" CHTYPE_LONG case, 32-bit: */ - typedef uint32_t chtype; - # endif -#else -typedef uint16_t chtype; /* 8-bit attr + 8-bit char */ -#endif - -#ifdef PDC_WIDE -typedef chtype cchar_t; -#endif - -typedef chtype attr_t; - -/* Version constants, available as of version 4.0 : */ -/* Don't forget to update 'version.mif' if MAJOR/MINOR changes! */ - -#define PDC_VER_MAJOR 4 -#define PDC_VER_MINOR 0 -#define PDC_VER_CHANGE 4 -#define PDC_VER_YEAR 2019 -#define PDC_VER_MONTH 1 -#define PDC_VER_DAY 20 - -#define PDC_BUILD (PDC_VER_MAJOR*1000 + PDC_VER_MINOR *100 + PDC_VER_CHANGE) - -/* When using PDCurses as a DLL (Windows) or shared library (BSD or *nix), -it's possible to switch the DLL or shared library. One may therefore want -to inquire of the DLL/shared library the port, version numbers, and -chtype_size used, and make sure they're what one was expecting. The -'PDC_version' structure lets you do just that. */ - -enum PDC_port -{ - PDC_PORT_X11 = 0, - PDC_PORT_WIN32 = 1, - PDC_PORT_WINGUI = 2, - PDC_PORT_DOS = 3, - PDC_PORT_OS2 = 4, - PDC_PORT_SDL1 = 5, - PDC_PORT_SDL2 = 6, - PDC_PORT_VT = 7 -}; - -/* Detailed PDC version information */ -#define PDC_HAS_VERSION_INFO 1 -typedef struct -{ - const enum PDC_port port; - const int ver_major; - const int ver_minor; - const int ver_change; - const size_t chtype_size; - const bool is_wide; - const bool is_forced_utf8; -} PDC_version_info; - -/*---------------------------------------------------------------------- - * - * Mouse Interface -- SYSVR4, with extensions - * - */ - -/* Most flavors of PDCurses support three buttons. WinGUI supports */ -/* these plus two "extended" buttons. But we'll set this macro to */ -/* six, allowing future versions to support up to nine total buttons. */ -/* (The button states are broken up into two arrays to allow for the */ -/* possibility of backward compatibility to DLLs compiled with only */ -/* three mouse buttons.) */ - -#define PDC_MAX_MOUSE_BUTTONS 9 -#define PDC_N_EXTENDED_MOUSE_BUTTONS 6 - -typedef struct -{ - int x; /* absolute column, 0 based, measured in characters */ - int y; /* absolute row, 0 based, measured in characters */ - short button[3]; /* state of three "normal" buttons */ - int changes; /* flags indicating what has changed with the mouse */ - short xbutton[PDC_N_EXTENDED_MOUSE_BUTTONS]; /* state of ext buttons */ -} MOUSE_STATUS; - -#define BUTTON_RELEASED 0x0000 -#define BUTTON_PRESSED 0x0001 -#define BUTTON_CLICKED 0x0002 -#define BUTTON_DOUBLE_CLICKED 0x0003 -#define BUTTON_TRIPLE_CLICKED 0x0004 -#define BUTTON_MOVED 0x0005 /* PDCurses */ -#define WHEEL_SCROLLED 0x0006 /* PDCurses */ -#define BUTTON_ACTION_MASK 0x0007 /* PDCurses */ - -#define PDC_BUTTON_SHIFT 0x0008 /* PDCurses */ -#define PDC_BUTTON_CONTROL 0x0010 /* PDCurses */ -#define PDC_BUTTON_ALT 0x0020 /* PDCurses */ -#define BUTTON_MODIFIER_MASK 0x0038 /* PDCurses */ - -#define MOUSE_X_POS (Mouse_status.x) -#define MOUSE_Y_POS (Mouse_status.y) - -/* - * Bits associated with the .changes field: - * 3 2 1 0 - * 210987654321098765432109876543210 - * 1 <- button 1 has changed 0 - * 10 <- button 2 has changed 1 - * 100 <- button 3 has changed 2 - * 1000 <- mouse has moved 3 - * 10000 <- mouse position report 4 - * 100000 <- mouse wheel up 5 - * 1000000 <- mouse wheel down 6 - * 10000000 <- mouse wheel left 7 - * 100000000 <- mouse wheel right 8 - * 1000000000 <- button 4 has changed 9 - * (NOTE: buttons 6 to 10000000000 <- button 5 has changed 10 - * 9 aren't implemented 100000000000 <- button 6 has changed 11 - * in any flavor of 1000000000000 <- button 7 has changed 12 - * PDCurses yet!) 10000000000000 <- button 8 has changed 13 - * 100000000000000 <- button 9 has changed 14 - */ - -#define PDC_MOUSE_MOVED 0x0008 -#define PDC_MOUSE_POSITION 0x0010 -#define PDC_MOUSE_WHEEL_UP 0x0020 -#define PDC_MOUSE_WHEEL_DOWN 0x0040 -#define PDC_MOUSE_WHEEL_LEFT 0x0080 -#define PDC_MOUSE_WHEEL_RIGHT 0x0100 - -#define A_BUTTON_CHANGED (Mouse_status.changes & 7) -#define MOUSE_MOVED (Mouse_status.changes & PDC_MOUSE_MOVED) -#define MOUSE_POS_REPORT (Mouse_status.changes & PDC_MOUSE_POSITION) -#define BUTTON_CHANGED(x) (Mouse_status.changes & (1 << ((x) - ((x)<4 ? 1 : -5)))) -#define BUTTON_STATUS(x) (Mouse_status.button[(x) - 1]) -#define MOUSE_WHEEL_UP (Mouse_status.changes & PDC_MOUSE_WHEEL_UP) -#define MOUSE_WHEEL_DOWN (Mouse_status.changes & PDC_MOUSE_WHEEL_DOWN) -#define MOUSE_WHEEL_LEFT (Mouse_status.changes & PDC_MOUSE_WHEEL_LEFT) -#define MOUSE_WHEEL_RIGHT (Mouse_status.changes & PDC_MOUSE_WHEEL_RIGHT) - -/* mouse bit-masks */ - -#define BUTTON1_RELEASED 0x00000001L -#define BUTTON1_PRESSED 0x00000002L -#define BUTTON1_CLICKED 0x00000004L -#define BUTTON1_DOUBLE_CLICKED 0x00000008L -#define BUTTON1_TRIPLE_CLICKED 0x00000010L -#define BUTTON1_MOVED 0x00000010L /* PDCurses */ - -#define BUTTON2_RELEASED 0x00000020L -#define BUTTON2_PRESSED 0x00000040L -#define BUTTON2_CLICKED 0x00000080L -#define BUTTON2_DOUBLE_CLICKED 0x00000100L -#define BUTTON2_TRIPLE_CLICKED 0x00000200L -#define BUTTON2_MOVED 0x00000200L /* PDCurses */ - -#define BUTTON3_RELEASED 0x00000400L -#define BUTTON3_PRESSED 0x00000800L -#define BUTTON3_CLICKED 0x00001000L -#define BUTTON3_DOUBLE_CLICKED 0x00002000L -#define BUTTON3_TRIPLE_CLICKED 0x00004000L -#define BUTTON3_MOVED 0x00004000L /* PDCurses */ - -/* For the ncurses-compatible functions only, BUTTON4_PRESSED and - BUTTON5_PRESSED are returned for mouse scroll wheel up and down; - otherwise PDCurses doesn't support buttons 4 and 5... except - as described above for WinGUI, and perhaps to be extended to - other PDCurses flavors */ - -#define BUTTON4_RELEASED 0x00008000L -#define BUTTON4_PRESSED 0x00010000L -#define BUTTON4_CLICKED 0x00020000L -#define BUTTON4_DOUBLE_CLICKED 0x00040000L -#define BUTTON4_TRIPLE_CLICKED 0x00080000L - -#define BUTTON5_RELEASED 0x00100000L -#define BUTTON5_PRESSED 0x00200000L -#define BUTTON5_CLICKED 0x00400000L -#define BUTTON5_DOUBLE_CLICKED 0x00800000L -#define BUTTON5_TRIPLE_CLICKED 0x01000000L - -#define MOUSE_WHEEL_SCROLL 0x02000000L /* PDCurses */ -#define BUTTON_MODIFIER_SHIFT 0x04000000L /* PDCurses */ -#define BUTTON_MODIFIER_CONTROL 0x08000000L /* PDCurses */ -#define BUTTON_MODIFIER_ALT 0x10000000L /* PDCurses */ - -#define ALL_MOUSE_EVENTS 0x1fffffffL -#define REPORT_MOUSE_POSITION 0x20000000L - -/* ncurses mouse interface */ - -typedef unsigned long mmask_t; - -typedef struct -{ - short id; /* unused, always 0 */ - int x, y, z; /* x, y same as MOUSE_STATUS; z unused */ - mmask_t bstate; /* equivalent to changes + button[], but - in the same format as used for mousemask() */ -} MEVENT; - -#if defined(PDC_NCMOUSE) && !defined(NCURSES_MOUSE_VERSION) -# define NCURSES_MOUSE_VERSION 2 -#endif - -#ifdef NCURSES_MOUSE_VERSION -# define BUTTON_SHIFT BUTTON_MODIFIER_SHIFT -# define BUTTON_CONTROL BUTTON_MODIFIER_CONTROL -# define BUTTON_CTRL BUTTON_MODIFIER_CONTROL -# define BUTTON_ALT BUTTON_MODIFIER_ALT -#else -# define BUTTON_SHIFT PDC_BUTTON_SHIFT -# define BUTTON_CONTROL PDC_BUTTON_CONTROL -# define BUTTON_ALT PDC_BUTTON_ALT -#endif - -/*---------------------------------------------------------------------- - * - * Window and Screen Structures - * - */ - -typedef struct _win /* definition of a window */ -{ - int _cury; /* current pseudo-cursor */ - int _curx; - int _maxy; /* max window coordinates */ - int _maxx; - int _begy; /* origin on screen */ - int _begx; - int _flags; /* window properties */ - chtype _attrs; /* standard attributes and colors */ - chtype _bkgd; /* background, normally blank */ - bool _clear; /* causes clear at next refresh */ - bool _leaveit; /* leaves cursor where it is */ - bool _scroll; /* allows window scrolling */ - bool _nodelay; /* input character wait flag */ - bool _immed; /* immediate update flag */ - bool _sync; /* synchronise window ancestors */ - bool _use_keypad; /* flags keypad key mode active */ - chtype **_y; /* pointer to line pointer array */ - int *_firstch; /* first changed character in line */ - int *_lastch; /* last changed character in line */ - int _tmarg; /* top of scrolling region */ - int _bmarg; /* bottom of scrolling region */ - int _delayms; /* milliseconds of delay for getch() */ - int _parx, _pary; /* coords relative to parent (0,0) */ - struct _win *_parent; /* subwin's pointer to parent win */ -} WINDOW; - -/* Avoid using the SCREEN struct directly -- use the corresponding - functions if possible. This struct may eventually be made private. */ - -typedef struct -{ - bool alive; /* if initscr() called, and not endwin() */ - bool autocr; /* if cr -> lf */ - bool cbreak; /* if terminal unbuffered */ - bool echo; /* if terminal echo */ - bool raw_inp; /* raw input mode (v. cooked input) */ - bool raw_out; /* raw output mode (7 v. 8 bits) */ - bool audible; /* FALSE if the bell is visual */ - bool mono; /* TRUE if current screen is mono */ - bool resized; /* TRUE if TERM has been resized */ - bool orig_attr; /* TRUE if we have the original colors */ - short orig_fore; /* original screen foreground color */ - short orig_back; /* original screen foreground color */ - int cursrow; /* position of physical cursor */ - int curscol; /* position of physical cursor */ - int visibility; /* visibility of cursor */ - int orig_cursor; /* original cursor size */ - int lines; /* new value for LINES */ - int cols; /* new value for COLS */ - unsigned long _trap_mbe; /* trap these mouse button events */ - unsigned long _map_mbe_to_key; /* map mouse buttons to slk */ - int mouse_wait; /* time to wait (in ms) for a - button release after a press, in - order to count it as a click */ - int slklines; /* lines in use by slk_init() */ - WINDOW *slk_winptr; /* window for slk */ - int linesrippedoff; /* lines ripped off via ripoffline() */ - int linesrippedoffontop; /* lines ripped off on - top via ripoffline() */ - int delaytenths; /* 1/10ths second to wait block - getch() for */ - bool _preserve; /* TRUE if screen background - to be preserved */ - int _restore; /* specifies if screen background - to be restored, and how */ - bool save_key_modifiers; /* TRUE if each key modifiers saved - with each key press */ - bool return_key_modifiers; /* TRUE if modifier keys are - returned as "real" keys */ - bool key_code; /* TRUE if last key is a special key; - used internally by get_wch() */ -#ifdef XCURSES - int XcurscrSize; /* size of Xcurscr shared memory block */ - bool sb_on; - int sb_viewport_y; - int sb_viewport_x; - int sb_total_y; - int sb_total_x; - int sb_cur_y; - int sb_cur_x; - int exit_key; -#endif - short line_color; /* color of line attributes - default -1 */ -} SCREEN; - -/*---------------------------------------------------------------------- - * - * External Variables - * - */ - -#ifdef PDC_DLL_BUILD -# ifdef CURSES_LIBRARY -# define PDCEX __declspec(dllexport) extern -# else -# define PDCEX __declspec(dllimport) -# endif -#else -# define PDCEX extern -#endif - -PDCEX int LINES; /* terminal height */ -PDCEX int COLS; /* terminal width */ -PDCEX WINDOW *stdscr; /* the default screen window */ -PDCEX WINDOW *curscr; /* the current screen image */ -PDCEX SCREEN *SP; /* curses variables */ -PDCEX MOUSE_STATUS Mouse_status; -PDCEX int COLORS; -PDCEX int COLOR_PAIRS; -PDCEX int TABSIZE; -PDCEX chtype acs_map[]; /* alternate character set map */ -PDCEX char ttytype[]; /* terminal name/description */ -PDCEX PDC_version_info PDC_version; - -/*man-start************************************************************** - -Text Attributes -=============== - -Originally, PDCurses used a short (16 bits) for its chtype. To include -color, a number of things had to be sacrificed from the strict Unix and -System V support. The main problem was fitting all character attributes -and color into an unsigned char (all 8 bits!). - -Today, PDCurses by default uses a long (32 bits) for its chtype, as in -System V. The short chtype is still available, by undefining CHTYPE_LONG -and rebuilding the library. - -The following is the structure of a win->_attrs chtype: - -short form: - - +-----------------------------------------------+ - |15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0| - +-----------------------------------------------+ - color number | attrs | character eg 'a' - -The available non-color attributes are bold, reverse and blink. Others -have no effect. The high order char is an index into an array of -physical colors (defined in color.c) -- 32 foreground/background color -pairs (5 bits) plus 3 bits for other attributes. - -long form: - - +--------------------------------------------------------------------+ - |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|..| 2| 1| 0| - +--------------------------------------------------------------------+ - color number | modifiers | character eg 'a' - -The available non-color attributes are bold, underline, invisible, -right-line, left-line, protect, reverse and blink. 256 color pairs (8 -bits), 8 bits for other attributes, and 16 bits for character data. - - Note that there is now a "super-long" 64-bit form, available by -defining CHTYPE_LONG to be 2: - -------------------------------------------------------------------------------- -|63|62|61|60|59|..|34|33|32|31|30|29|28|..|22|21|20|19|18|17|16|..| 3| 2| 1| 0| -------------------------------------------------------------------------------- - color number | modifiers | character eg 'a' - - - We take five more bits for the character (thus allowing Unicode values -past 64K; UTF-16 can go up to 0x10ffff, requiring 21 bits total), and -four more bits for attributes. Three are currently used as A_OVERLINE, A_DIM, -and A_STRIKEOUT; one more is reserved for future use. 31 bits are then used -for color. These are usually just treated as the usual palette -indices, and range from 0 to 255. However, if bit 63 is -set, the remaining 30 bits are interpreted as foreground RGB (first -fifteen bits, five bits for each of the three channels) and background RGB -(same scheme using the remaining 15 bits.) - -**man-end****************************************************************/ - -/*** Video attribute macros ***/ - -#define A_NORMAL (chtype)0 - -#ifdef CHTYPE_LONG - -# if(CHTYPE_LONG >= 2) /* 64-bit chtypes */ - # define PDC_CHARTEXT_BITS 21 - # define A_CHARTEXT (chtype)( ((chtype)0x1 << PDC_CHARTEXT_BITS) - 1) - # define A_ALTCHARSET ((chtype)0x001 << PDC_CHARTEXT_BITS) - # define A_RIGHTLINE ((chtype)0x002 << PDC_CHARTEXT_BITS) - # define A_LEFTLINE ((chtype)0x004 << PDC_CHARTEXT_BITS) - # define A_INVIS ((chtype)0x008 << PDC_CHARTEXT_BITS) - # define A_UNDERLINE ((chtype)0x010 << PDC_CHARTEXT_BITS) - # define A_REVERSE ((chtype)0x020 << PDC_CHARTEXT_BITS) - # define A_BLINK ((chtype)0x040 << PDC_CHARTEXT_BITS) - # define A_BOLD ((chtype)0x080 << PDC_CHARTEXT_BITS) - # define A_OVERLINE ((chtype)0x100 << PDC_CHARTEXT_BITS) - # define A_STRIKEOUT ((chtype)0x200 << PDC_CHARTEXT_BITS) - # define A_DIM ((chtype)0x400 << PDC_CHARTEXT_BITS) -#if 0 - /* May come up with a use for this bit */ - /* someday; reserved for the future: */ - # define A_FUTURE_2 ((chtype)0x800 << PDC_CHARTEXT_BITS) -#endif - # define PDC_COLOR_SHIFT (PDC_CHARTEXT_BITS + 12) - # define A_COLOR ((chtype)0x7fffffff << PDC_COLOR_SHIFT) - # define A_RGB_COLOR ((chtype)0x40000000 << PDC_COLOR_SHIFT) - # define A_ATTRIBUTES (((chtype)0xfff << PDC_CHARTEXT_BITS) | A_COLOR) - # define A_RGB( rfore, gfore, bfore, rback, gback, bback) \ - (( (((chtype)(bfore) << 25) \ - | ((chtype)(gfore) << 20) \ - | ((chtype)(rfore) << 15) \ - | ((chtype)(bback) << 10) \ - | ((chtype)(gback) << 5) \ - | ((chtype)(rback) )) << PDC_COLOR_SHIFT) | A_RGB_COLOR) -# else /* plain ol' 32-bit chtypes */ - # define A_ALTCHARSET (chtype)0x00010000 - # define A_RIGHTLINE (chtype)0x00020000 - # define A_LEFTLINE (chtype)0x00040000 - # define A_INVIS (chtype)0x00080000 - # define A_UNDERLINE (chtype)0x00100000 - # define A_REVERSE (chtype)0x00200000 - # define A_BLINK (chtype)0x00400000 - # define A_BOLD (chtype)0x00800000 - # define A_COLOR (chtype)0xff000000 - # define A_RGB_COLOR A_NORMAL -#ifdef PDC_WIDE - # define A_CHARTEXT (chtype)0x0000ffff - # define A_ATTRIBUTES (chtype)0xffff0000 - # define A_DIM A_NORMAL - # define A_OVERLINE A_NORMAL - # define A_STRIKEOUT A_NORMAL -#else /* with 8-bit chars, we have bits for these attribs : */ - # define A_CHARTEXT (chtype)0x000000ff - # define A_ATTRIBUTES (chtype)0xffffe000 - # define A_DIM (chtype)0x00008000 - # define A_OVERLINE (chtype)0x00004000 - # define A_STRIKEOUT (chtype)0x00002000 -#endif - # define PDC_COLOR_SHIFT 24 -#endif - - -# define A_ITALIC A_INVIS -# define A_PROTECT (A_UNDERLINE | A_LEFTLINE | A_RIGHTLINE) - -#else /* 16-bit chtypes */ -# define A_BOLD (chtype)0x0100 /* X/Open */ -# define A_REVERSE (chtype)0x0200 /* X/Open */ -# define A_BLINK (chtype)0x0400 /* X/Open */ - -# define A_ATTRIBUTES (chtype)0xff00 /* X/Open */ -# define A_CHARTEXT (chtype)0x00ff /* X/Open */ -# define A_COLOR (chtype)0xf800 /* System V */ - -# define A_ALTCHARSET A_NORMAL /* X/Open */ -# define A_PROTECT A_NORMAL /* X/Open */ -# define A_UNDERLINE A_NORMAL /* X/Open */ -# define A_OVERLINE A_NORMAL /* X/Open */ -# define A_STRIKEOUT A_NORMAL /* X/Open */ - -# define A_LEFTLINE A_NORMAL -# define A_RIGHTLINE A_NORMAL -# define A_ITALIC A_NORMAL -# define A_INVIS A_NORMAL -# define A_RGB_COLOR A_NORMAL -# define A_DIM A_NORMAL - -# define PDC_COLOR_SHIFT 11 -#endif - -#define A_STANDOUT (A_REVERSE | A_BOLD) /* X/Open */ - -#define CHR_MSK A_CHARTEXT /* Obsolete */ -#define ATR_MSK A_ATTRIBUTES /* Obsolete */ -#define ATR_NRM A_NORMAL /* Obsolete */ - -/* For use with attr_t -- X/Open says, "these shall be distinct", so - this is a non-conforming implementation. */ - -#define WA_NORMAL A_NORMAL - -#define WA_ALTCHARSET A_ALTCHARSET -#define WA_BLINK A_BLINK -#define WA_BOLD A_BOLD -#define WA_DIM A_DIM -#define WA_INVIS A_INVIS -#define WA_LEFT A_LEFTLINE -#define WA_PROTECT A_PROTECT -#define WA_REVERSE A_REVERSE -#define WA_RIGHT A_RIGHTLINE -#define WA_STANDOUT A_STANDOUT -#define WA_UNDERLINE A_UNDERLINE - -#define WA_HORIZONTAL A_NORMAL -#define WA_LOW A_NORMAL -#define WA_TOP A_NORMAL -#define WA_VERTICAL A_NORMAL - -#define WA_ATTRIBUTES A_ATTRIBUTES - -/*** Alternate character set macros ***/ - -/* 'w' = 32-bit chtype; acs_map[] index | A_ALTCHARSET - 'n' = 16-bit chtype; it gets the fallback set because no bit is - available for A_ALTCHARSET */ - -#ifdef CHTYPE_LONG -# define PDC_ACS(w, n) ((chtype)w | A_ALTCHARSET) -#else -# define PDC_ACS(w, n) ((chtype)n) -#endif - -/* VT100-compatible symbols -- box chars */ - -#define ACS_LRCORNER PDC_ACS('V', '+') -#define ACS_URCORNER PDC_ACS('W', '+') -#define ACS_ULCORNER PDC_ACS('X', '+') -#define ACS_LLCORNER PDC_ACS('Y', '+') -#define ACS_PLUS PDC_ACS('Z', '+') -#define ACS_LTEE PDC_ACS('[', '+') -#define ACS_RTEE PDC_ACS('\\', '+') -#define ACS_BTEE PDC_ACS(']', '+') -#define ACS_TTEE PDC_ACS('^', '+') -#define ACS_HLINE PDC_ACS('_', '-') -#define ACS_VLINE PDC_ACS('`', '|') - -/* PDCurses-only ACS chars. Don't use if ncurses compatibility matters. -Some won't work in non-wide X11 builds (see 'acs_defs.h' for details). */ - -#define ACS_CENT PDC_ACS('{', 'c') -#define ACS_YEN PDC_ACS('|', 'y') -#define ACS_PESETA PDC_ACS('}', 'p') -#define ACS_HALF PDC_ACS('&', '/') -#define ACS_QUARTER PDC_ACS('\'', '/') -#define ACS_LEFT_ANG_QU PDC_ACS(')', '<') -#define ACS_RIGHT_ANG_QU PDC_ACS('*', '>') -#define ACS_D_HLINE PDC_ACS('a', '-') -#define ACS_D_VLINE PDC_ACS('b', '|') -#define ACS_CLUB PDC_ACS( 11, 'C') -#define ACS_HEART PDC_ACS( 12, 'H') -#define ACS_SPADE PDC_ACS( 13, 'S') -#define ACS_SMILE PDC_ACS( 14, 'O') -#define ACS_REV_SMILE PDC_ACS( 15, 'O') -#define ACS_MED_BULLET PDC_ACS( 16, '.') -#define ACS_WHITE_BULLET PDC_ACS( 17, 'O') -#define ACS_PILCROW PDC_ACS( 18, 'O') -#define ACS_SECTION PDC_ACS( 19, 'O') - -#define ACS_SUP2 PDC_ACS(',', '2') -#define ACS_ALPHA PDC_ACS('.', 'a') -#define ACS_BETA PDC_ACS('/', 'b') -#define ACS_GAMMA PDC_ACS('0', 'y') -#define ACS_UP_SIGMA PDC_ACS('1', 'S') -#define ACS_LO_SIGMA PDC_ACS('2', 's') -#define ACS_MU PDC_ACS('4', 'u') -#define ACS_TAU PDC_ACS('5', 't') -#define ACS_UP_PHI PDC_ACS('6', 'F') -#define ACS_THETA PDC_ACS('7', 't') -#define ACS_OMEGA PDC_ACS('8', 'w') -#define ACS_DELTA PDC_ACS('9', 'd') -#define ACS_INFINITY PDC_ACS('-', 'i') -#define ACS_LO_PHI PDC_ACS( 22, 'f') -#define ACS_EPSILON PDC_ACS(':', 'e') -#define ACS_INTERSECT PDC_ACS('e', 'u') -#define ACS_TRIPLE_BAR PDC_ACS('f', '=') -#define ACS_DIVISION PDC_ACS('c', '/') -#define ACS_APPROX_EQ PDC_ACS('d', '~') -#define ACS_SM_BULLET PDC_ACS('g', '.') -#define ACS_SQUARE_ROOT PDC_ACS('i', '!') -#define ACS_UBLOCK PDC_ACS('p', '^') -#define ACS_BBLOCK PDC_ACS('q', '_') -#define ACS_LBLOCK PDC_ACS('r', '<') -#define ACS_RBLOCK PDC_ACS('s', '>') - -#define ACS_A_ORDINAL PDC_ACS(20, 'a') -#define ACS_O_ORDINAL PDC_ACS(21, 'o') -#define ACS_INV_QUERY PDC_ACS(24, '?') -#define ACS_REV_NOT PDC_ACS(25, '!') -#define ACS_NOT PDC_ACS(26, '!') -#define ACS_INV_BANG PDC_ACS(23, '!') -#define ACS_UP_INTEGRAL PDC_ACS(27, '|') -#define ACS_LO_INTEGRAL PDC_ACS(28, '|') -#define ACS_SUP_N PDC_ACS(29, 'n') -#define ACS_CENTER_SQU PDC_ACS(30, 'x') -#define ACS_F_WITH_HOOK PDC_ACS(31, 'f') - -#define ACS_SD_LRCORNER PDC_ACS(';', '+') -#define ACS_SD_URCORNER PDC_ACS('<', '+') -#define ACS_SD_ULCORNER PDC_ACS('=', '+') -#define ACS_SD_LLCORNER PDC_ACS('>', '+') -#define ACS_SD_PLUS PDC_ACS('?', '+') -#define ACS_SD_LTEE PDC_ACS('@', '+') -#define ACS_SD_RTEE PDC_ACS('A', '+') -#define ACS_SD_BTEE PDC_ACS('B', '+') -#define ACS_SD_TTEE PDC_ACS('C', '+') - -#define ACS_D_LRCORNER PDC_ACS('D', '+') -#define ACS_D_URCORNER PDC_ACS('E', '+') -#define ACS_D_ULCORNER PDC_ACS('F', '+') -#define ACS_D_LLCORNER PDC_ACS('G', '+') -#define ACS_D_PLUS PDC_ACS('H', '+') -#define ACS_D_LTEE PDC_ACS('I', '+') -#define ACS_D_RTEE PDC_ACS('J', '+') -#define ACS_D_BTEE PDC_ACS('K', '+') -#define ACS_D_TTEE PDC_ACS('L', '+') - -#define ACS_DS_LRCORNER PDC_ACS('M', '+') -#define ACS_DS_URCORNER PDC_ACS('N', '+') -#define ACS_DS_ULCORNER PDC_ACS('O', '+') -#define ACS_DS_LLCORNER PDC_ACS('P', '+') -#define ACS_DS_PLUS PDC_ACS('Q', '+') -#define ACS_DS_LTEE PDC_ACS('R', '+') -#define ACS_DS_RTEE PDC_ACS('S', '+') -#define ACS_DS_BTEE PDC_ACS('T', '+') -#define ACS_DS_TTEE PDC_ACS('U', '+') - -/* VT100-compatible symbols -- other */ - -#define ACS_S1 PDC_ACS('l', '-') -#define ACS_S9 PDC_ACS('o', '_') -#define ACS_DIAMOND PDC_ACS('j', '+') -#define ACS_CKBOARD PDC_ACS('k', ':') -#define ACS_DEGREE PDC_ACS('w', '\'') -#define ACS_PLMINUS PDC_ACS('x', '#') -#define ACS_BULLET PDC_ACS('h', 'o') - -/* Teletype 5410v1 symbols -- these are defined in SysV curses, but - are not well-supported by most terminals. Stick to VT100 characters - for optimum portability. */ - -#define ACS_LARROW PDC_ACS('!', '<') -#define ACS_RARROW PDC_ACS(' ', '>') -#define ACS_DARROW PDC_ACS('#', 'v') -#define ACS_UARROW PDC_ACS('"', '^') -#define ACS_BOARD PDC_ACS('+', '#') -#define ACS_LTBOARD PDC_ACS('y', '#') -#define ACS_LANTERN PDC_ACS('z', '*') -#define ACS_BLOCK PDC_ACS('t', '#') - -/* That goes double for these -- undocumented SysV symbols. Don't use - them. */ - -#define ACS_S3 PDC_ACS('m', '-') -#define ACS_S7 PDC_ACS('n', '-') -#define ACS_LEQUAL PDC_ACS('u', '<') -#define ACS_GEQUAL PDC_ACS('v', '>') -#define ACS_PI PDC_ACS('$', 'n') -#define ACS_NEQUAL PDC_ACS('%', '+') -#define ACS_STERLING PDC_ACS('~', 'L') - -/* Box char aliases */ - -#define ACS_BSSB ACS_ULCORNER -#define ACS_SSBB ACS_LLCORNER -#define ACS_BBSS ACS_URCORNER -#define ACS_SBBS ACS_LRCORNER -#define ACS_SBSS ACS_RTEE -#define ACS_SSSB ACS_LTEE -#define ACS_SSBS ACS_BTEE -#define ACS_BSSS ACS_TTEE -#define ACS_BSBS ACS_HLINE -#define ACS_SBSB ACS_VLINE -#define ACS_SSSS ACS_PLUS - -/* cchar_t aliases */ - -#ifdef PDC_WIDE -# define WACS_LRCORNER (&(acs_map['V'])) -# define WACS_URCORNER (&(acs_map['W'])) -# define WACS_ULCORNER (&(acs_map['X'])) -# define WACS_LLCORNER (&(acs_map['Y'])) -# define WACS_PLUS (&(acs_map['Z'])) -# define WACS_LTEE (&(acs_map['['])) -# define WACS_RTEE (&(acs_map['\\'])) -# define WACS_BTEE (&(acs_map[']'])) -# define WACS_TTEE (&(acs_map['^'])) -# define WACS_HLINE (&(acs_map['_'])) -# define WACS_VLINE (&(acs_map['`'])) - -# define WACS_CENT (&(acs_map['{'])) -# define WACS_YEN (&(acs_map['|'])) -# define WACS_PESETA (&(acs_map['}'])) -# define WACS_HALF (&(acs_map['&'])) -# define WACS_QUARTER (&(acs_map['\''])) -# define WACS_LEFT_ANG_QU (&(acs_map[')'])) -# define WACS_RIGHT_ANG_QU (&(acs_map['*'])) -# define WACS_D_HLINE (&(acs_map['a'])) -# define WACS_D_VLINE (&(acs_map['b'])) -# define WACS_CLUB (&(acs_map[ 11])) -# define WACS_HEART (&(acs_map[ 12])) -# define WACS_SPADE (&(acs_map[ 13])) -# define WACS_SMILE (&(acs_map[ 14])) -# define WACS_REV_SMILE (&(acs_map[ 15])) -# define WACS_MED_BULLET (&(acs_map[ 16])) -# define WACS_WHITE_BULLET (&(acs_map[ 17])) -# define WACS_PILCROW (&(acs_map[ 18])) -# define WACS_SECTION (&(acs_map[ 19])) - -# define WACS_SUP2 (&(acs_map[','])) -# define WACS_ALPHA (&(acs_map['.'])) -# define WACS_BETA (&(acs_map['/'])) -# define WACS_GAMMA (&(acs_map['0'])) -# define WACS_UP_SIGMA (&(acs_map['1'])) -# define WACS_LO_SIGMA (&(acs_map['2'])) -# define WACS_MU (&(acs_map['4'])) -# define WACS_TAU (&(acs_map['5'])) -# define WACS_UP_PHI (&(acs_map['6'])) -# define WACS_THETA (&(acs_map['7'])) -# define WACS_OMEGA (&(acs_map['8'])) -# define WACS_DELTA (&(acs_map['9'])) -# define WACS_INFINITY (&(acs_map['-'])) -# define WACS_LO_PHI (&(acs_map[ 22])) -# define WACS_EPSILON (&(acs_map[':'])) -# define WACS_INTERSECT (&(acs_map['e'])) -# define WACS_TRIPLE_BAR (&(acs_map['f'])) -# define WACS_DIVISION (&(acs_map['c'])) -# define WACS_APPROX_EQ (&(acs_map['d'])) -# define WACS_SM_BULLET (&(acs_map['g'])) -# define WACS_SQUARE_ROOT (&(acs_map['i'])) -# define WACS_UBLOCK (&(acs_map['p'])) -# define WACS_BBLOCK (&(acs_map['q'])) -# define WACS_LBLOCK (&(acs_map['r'])) -# define WACS_RBLOCK (&(acs_map['s'])) - -# define WACS_A_ORDINAL (&(acs_map[20])) -# define WACS_O_ORDINAL (&(acs_map[21])) -# define WACS_INV_QUERY (&(acs_map[24])) -# define WACS_REV_NOT (&(acs_map[25])) -# define WACS_NOT (&(acs_map[26])) -# define WACS_INV_BANG (&(acs_map[23])) -# define WACS_UP_INTEGRAL (&(acs_map[27])) -# define WACS_LO_INTEGRAL (&(acs_map[28])) -# define WACS_SUP_N (&(acs_map[29])) -# define WACS_CENTER_SQU (&(acs_map[30])) -# define WACS_F_WITH_HOOK (&(acs_map[31])) - -# define WACS_SD_LRCORNER (&(acs_map[';'])) -# define WACS_SD_URCORNER (&(acs_map['<'])) -# define WACS_SD_ULCORNER (&(acs_map['='])) -# define WACS_SD_LLCORNER (&(acs_map['>'])) -# define WACS_SD_PLUS (&(acs_map['?'])) -# define WACS_SD_LTEE (&(acs_map['@'])) -# define WACS_SD_RTEE (&(acs_map['A'])) -# define WACS_SD_BTEE (&(acs_map['B'])) -# define WACS_SD_TTEE (&(acs_map['C'])) - -# define WACS_D_LRCORNER (&(acs_map['D'])) -# define WACS_D_URCORNER (&(acs_map['E'])) -# define WACS_D_ULCORNER (&(acs_map['F'])) -# define WACS_D_LLCORNER (&(acs_map['G'])) -# define WACS_D_PLUS (&(acs_map['H'])) -# define WACS_D_LTEE (&(acs_map['I'])) -# define WACS_D_RTEE (&(acs_map['J'])) -# define WACS_D_BTEE (&(acs_map['K'])) -# define WACS_D_TTEE (&(acs_map['L'])) - -# define WACS_DS_LRCORNER (&(acs_map['M'])) -# define WACS_DS_URCORNER (&(acs_map['N'])) -# define WACS_DS_ULCORNER (&(acs_map['O'])) -# define WACS_DS_LLCORNER (&(acs_map['P'])) -# define WACS_DS_PLUS (&(acs_map['Q'])) -# define WACS_DS_LTEE (&(acs_map['R'])) -# define WACS_DS_RTEE (&(acs_map['S'])) -# define WACS_DS_BTEE (&(acs_map['T'])) -# define WACS_DS_TTEE (&(acs_map['U'])) - -# define WACS_S1 (&(acs_map['l'])) -# define WACS_S9 (&(acs_map['o'])) -# define WACS_DIAMOND (&(acs_map['j'])) -# define WACS_CKBOARD (&(acs_map['k'])) -# define WACS_DEGREE (&(acs_map['w'])) -# define WACS_PLMINUS (&(acs_map['x'])) -# define WACS_BULLET (&(acs_map['h'])) - - -# define WACS_LARROW (&(acs_map['!'])) -# define WACS_RARROW (&(acs_map[' '])) -# define WACS_DARROW (&(acs_map['#'])) -# define WACS_UARROW (&(acs_map['"'])) -# define WACS_BOARD (&(acs_map['+'])) -# define WACS_LTBOARD (&(acs_map['y'])) -# define WACS_LANTERN (&(acs_map['z'])) -# define WACS_BLOCK (&(acs_map['t'])) - -# define WACS_S3 (&(acs_map['m'])) -# define WACS_S7 (&(acs_map['n'])) -# define WACS_LEQUAL (&(acs_map['u'])) -# define WACS_GEQUAL (&(acs_map['v'])) -# define WACS_PI (&(acs_map['$'])) -# define WACS_NEQUAL (&(acs_map['%'])) -# define WACS_STERLING (&(acs_map['~'])) - -# define WACS_BSSB WACS_ULCORNER -# define WACS_SSBB WACS_LLCORNER -# define WACS_BBSS WACS_URCORNER -# define WACS_SBBS WACS_LRCORNER -# define WACS_SBSS WACS_RTEE -# define WACS_SSSB WACS_LTEE -# define WACS_SSBS WACS_BTEE -# define WACS_BSSS WACS_TTEE -# define WACS_BSBS WACS_HLINE -# define WACS_SBSB WACS_VLINE -# define WACS_SSSS WACS_PLUS -#endif - -/*** Color macros ***/ - -#define COLOR_BLACK 0 - -#ifdef PDC_RGB /* RGB */ -# define COLOR_RED 1 -# define COLOR_GREEN 2 -# define COLOR_BLUE 4 -#else /* BGR */ -# define COLOR_BLUE 1 -# define COLOR_GREEN 2 -# define COLOR_RED 4 -#endif - -#define COLOR_CYAN (COLOR_BLUE | COLOR_GREEN) -#define COLOR_MAGENTA (COLOR_RED | COLOR_BLUE) -#define COLOR_YELLOW (COLOR_RED | COLOR_GREEN) - -#define COLOR_WHITE 7 - -/*---------------------------------------------------------------------- - * - * Function and Keypad Key Definitions - * Many are just for compatibility - * - */ - -#ifdef PDC_WIDE - #define KEY_OFFSET 0xec00 -#else - #define KEY_OFFSET 0x100 -#endif - -#define KEY_CODE_YES (KEY_OFFSET + 0x00) /* If get_wch() gives a key code */ - -#define KEY_BREAK (KEY_OFFSET + 0x01) /* Not on PC KBD */ -#define KEY_DOWN (KEY_OFFSET + 0x02) /* Down arrow key */ -#define KEY_UP (KEY_OFFSET + 0x03) /* Up arrow key */ -#define KEY_LEFT (KEY_OFFSET + 0x04) /* Left arrow key */ -#define KEY_RIGHT (KEY_OFFSET + 0x05) /* Right arrow key */ -#define KEY_HOME (KEY_OFFSET + 0x06) /* home key */ -#define KEY_BACKSPACE (KEY_OFFSET + 0x07) /* not on pc */ -#define KEY_F0 (KEY_OFFSET + 0x08) /* function keys; 64 reserved */ - -#define KEY_DL (KEY_OFFSET + 0x48) /* delete line */ -#define KEY_IL (KEY_OFFSET + 0x49) /* insert line */ -#define KEY_DC (KEY_OFFSET + 0x4a) /* delete character */ -#define KEY_IC (KEY_OFFSET + 0x4b) /* insert char or enter ins mode */ -#define KEY_EIC (KEY_OFFSET + 0x4c) /* exit insert char mode */ -#define KEY_CLEAR (KEY_OFFSET + 0x4d) /* clear screen */ -#define KEY_EOS (KEY_OFFSET + 0x4e) /* clear to end of screen */ -#define KEY_EOL (KEY_OFFSET + 0x4f) /* clear to end of line */ -#define KEY_SF (KEY_OFFSET + 0x50) /* scroll 1 line forward */ -#define KEY_SR (KEY_OFFSET + 0x51) /* scroll 1 line back (reverse) */ -#define KEY_NPAGE (KEY_OFFSET + 0x52) /* next page */ -#define KEY_PPAGE (KEY_OFFSET + 0x53) /* previous page */ -#define KEY_STAB (KEY_OFFSET + 0x54) /* set tab */ -#define KEY_CTAB (KEY_OFFSET + 0x55) /* clear tab */ -#define KEY_CATAB (KEY_OFFSET + 0x56) /* clear all tabs */ -#define KEY_ENTER (KEY_OFFSET + 0x57) /* enter or send (unreliable) */ -#define KEY_SRESET (KEY_OFFSET + 0x58) /* soft/reset (partial/unreliable) */ -#define KEY_RESET (KEY_OFFSET + 0x59) /* reset/hard reset (unreliable) */ -#define KEY_PRINT (KEY_OFFSET + 0x5a) /* print/copy */ -#define KEY_LL (KEY_OFFSET + 0x5b) /* home down/bottom (lower left) */ -#define KEY_ABORT (KEY_OFFSET + 0x5c) /* abort/terminate key (any) */ -#define KEY_SHELP (KEY_OFFSET + 0x5d) /* short help */ -#define KEY_LHELP (KEY_OFFSET + 0x5e) /* long help */ -#define KEY_BTAB (KEY_OFFSET + 0x5f) /* Back tab key */ -#define KEY_BEG (KEY_OFFSET + 0x60) /* beg(inning) key */ -#define KEY_CANCEL (KEY_OFFSET + 0x61) /* cancel key */ -#define KEY_CLOSE (KEY_OFFSET + 0x62) /* close key */ -#define KEY_COMMAND (KEY_OFFSET + 0x63) /* cmd (command) key */ -#define KEY_COPY (KEY_OFFSET + 0x64) /* copy key */ -#define KEY_CREATE (KEY_OFFSET + 0x65) /* create key */ -#define KEY_END (KEY_OFFSET + 0x66) /* end key */ -#define KEY_EXIT (KEY_OFFSET + 0x67) /* exit key */ -#define KEY_FIND (KEY_OFFSET + 0x68) /* find key */ -#define KEY_HELP (KEY_OFFSET + 0x69) /* help key */ -#define KEY_MARK (KEY_OFFSET + 0x6a) /* mark key */ -#define KEY_MESSAGE (KEY_OFFSET + 0x6b) /* message key */ -#define KEY_MOVE (KEY_OFFSET + 0x6c) /* move key */ -#define KEY_NEXT (KEY_OFFSET + 0x6d) /* next object key */ -#define KEY_OPEN (KEY_OFFSET + 0x6e) /* open key */ -#define KEY_OPTIONS (KEY_OFFSET + 0x6f) /* options key */ -#define KEY_PREVIOUS (KEY_OFFSET + 0x70) /* previous object key */ -#define KEY_REDO (KEY_OFFSET + 0x71) /* redo key */ -#define KEY_REFERENCE (KEY_OFFSET + 0x72) /* ref(erence) key */ -#define KEY_REFRESH (KEY_OFFSET + 0x73) /* refresh key */ -#define KEY_REPLACE (KEY_OFFSET + 0x74) /* replace key */ -#define KEY_RESTART (KEY_OFFSET + 0x75) /* restart key */ -#define KEY_RESUME (KEY_OFFSET + 0x76) /* resume key */ -#define KEY_SAVE (KEY_OFFSET + 0x77) /* save key */ -#define KEY_SBEG (KEY_OFFSET + 0x78) /* shifted beginning key */ -#define KEY_SCANCEL (KEY_OFFSET + 0x79) /* shifted cancel key */ -#define KEY_SCOMMAND (KEY_OFFSET + 0x7a) /* shifted command key */ -#define KEY_SCOPY (KEY_OFFSET + 0x7b) /* shifted copy key */ -#define KEY_SCREATE (KEY_OFFSET + 0x7c) /* shifted create key */ -#define KEY_SDC (KEY_OFFSET + 0x7d) /* shifted delete char key */ -#define KEY_SDL (KEY_OFFSET + 0x7e) /* shifted delete line key */ -#define KEY_SELECT (KEY_OFFSET + 0x7f) /* select key */ -#define KEY_SEND (KEY_OFFSET + 0x80) /* shifted end key */ -#define KEY_SEOL (KEY_OFFSET + 0x81) /* shifted clear line key */ -#define KEY_SEXIT (KEY_OFFSET + 0x82) /* shifted exit key */ -#define KEY_SFIND (KEY_OFFSET + 0x83) /* shifted find key */ -#define KEY_SHOME (KEY_OFFSET + 0x84) /* shifted home key */ -#define KEY_SIC (KEY_OFFSET + 0x85) /* shifted input key */ - -#define KEY_SLEFT (KEY_OFFSET + 0x87) /* shifted left arrow key */ -#define KEY_SMESSAGE (KEY_OFFSET + 0x88) /* shifted message key */ -#define KEY_SMOVE (KEY_OFFSET + 0x89) /* shifted move key */ -#define KEY_SNEXT (KEY_OFFSET + 0x8a) /* shifted next key */ -#define KEY_SOPTIONS (KEY_OFFSET + 0x8b) /* shifted options key */ -#define KEY_SPREVIOUS (KEY_OFFSET + 0x8c) /* shifted prev key */ -#define KEY_SPRINT (KEY_OFFSET + 0x8d) /* shifted print key */ -#define KEY_SREDO (KEY_OFFSET + 0x8e) /* shifted redo key */ -#define KEY_SREPLACE (KEY_OFFSET + 0x8f) /* shifted replace key */ -#define KEY_SRIGHT (KEY_OFFSET + 0x90) /* shifted right arrow */ -#define KEY_SRSUME (KEY_OFFSET + 0x91) /* shifted resume key */ -#define KEY_SSAVE (KEY_OFFSET + 0x92) /* shifted save key */ -#define KEY_SSUSPEND (KEY_OFFSET + 0x93) /* shifted suspend key */ -#define KEY_SUNDO (KEY_OFFSET + 0x94) /* shifted undo key */ -#define KEY_SUSPEND (KEY_OFFSET + 0x95) /* suspend key */ -#define KEY_UNDO (KEY_OFFSET + 0x96) /* undo key */ - -/* PDCurses-specific key definitions -- PC only */ - -#define ALT_0 (KEY_OFFSET + 0x97) -#define ALT_1 (KEY_OFFSET + 0x98) -#define ALT_2 (KEY_OFFSET + 0x99) -#define ALT_3 (KEY_OFFSET + 0x9a) -#define ALT_4 (KEY_OFFSET + 0x9b) -#define ALT_5 (KEY_OFFSET + 0x9c) -#define ALT_6 (KEY_OFFSET + 0x9d) -#define ALT_7 (KEY_OFFSET + 0x9e) -#define ALT_8 (KEY_OFFSET + 0x9f) -#define ALT_9 (KEY_OFFSET + 0xa0) -#define ALT_A (KEY_OFFSET + 0xa1) -#define ALT_B (KEY_OFFSET + 0xa2) -#define ALT_C (KEY_OFFSET + 0xa3) -#define ALT_D (KEY_OFFSET + 0xa4) -#define ALT_E (KEY_OFFSET + 0xa5) -#define ALT_F (KEY_OFFSET + 0xa6) -#define ALT_G (KEY_OFFSET + 0xa7) -#define ALT_H (KEY_OFFSET + 0xa8) -#define ALT_I (KEY_OFFSET + 0xa9) -#define ALT_J (KEY_OFFSET + 0xaa) -#define ALT_K (KEY_OFFSET + 0xab) -#define ALT_L (KEY_OFFSET + 0xac) -#define ALT_M (KEY_OFFSET + 0xad) -#define ALT_N (KEY_OFFSET + 0xae) -#define ALT_O (KEY_OFFSET + 0xaf) -#define ALT_P (KEY_OFFSET + 0xb0) -#define ALT_Q (KEY_OFFSET + 0xb1) -#define ALT_R (KEY_OFFSET + 0xb2) -#define ALT_S (KEY_OFFSET + 0xb3) -#define ALT_T (KEY_OFFSET + 0xb4) -#define ALT_U (KEY_OFFSET + 0xb5) -#define ALT_V (KEY_OFFSET + 0xb6) -#define ALT_W (KEY_OFFSET + 0xb7) -#define ALT_X (KEY_OFFSET + 0xb8) -#define ALT_Y (KEY_OFFSET + 0xb9) -#define ALT_Z (KEY_OFFSET + 0xba) - -#define CTL_LEFT (KEY_OFFSET + 0xbb) /* Control-Left-Arrow */ -#define CTL_RIGHT (KEY_OFFSET + 0xbc) -#define CTL_PGUP (KEY_OFFSET + 0xbd) -#define CTL_PGDN (KEY_OFFSET + 0xbe) -#define CTL_HOME (KEY_OFFSET + 0xbf) -#define CTL_END (KEY_OFFSET + 0xc0) - -#define KEY_A1 (KEY_OFFSET + 0xc1) /* upper left on Virtual keypad */ -#define KEY_A2 (KEY_OFFSET + 0xc2) /* upper middle on Virt. keypad */ -#define KEY_A3 (KEY_OFFSET + 0xc3) /* upper right on Vir. keypad */ -#define KEY_B1 (KEY_OFFSET + 0xc4) /* middle left on Virt. keypad */ -#define KEY_B2 (KEY_OFFSET + 0xc5) /* center on Virt. keypad */ -#define KEY_B3 (KEY_OFFSET + 0xc6) /* middle right on Vir. keypad */ -#define KEY_C1 (KEY_OFFSET + 0xc7) /* lower left on Virt. keypad */ -#define KEY_C2 (KEY_OFFSET + 0xc8) /* lower middle on Virt. keypad */ -#define KEY_C3 (KEY_OFFSET + 0xc9) /* lower right on Vir. keypad */ - -#define PADSLASH (KEY_OFFSET + 0xca) /* slash on keypad */ -#define PADENTER (KEY_OFFSET + 0xcb) /* enter on keypad */ -#define CTL_PADENTER (KEY_OFFSET + 0xcc) /* ctl-enter on keypad */ -#define ALT_PADENTER (KEY_OFFSET + 0xcd) /* alt-enter on keypad */ -#define PADSTOP (KEY_OFFSET + 0xce) /* stop on keypad */ -#define PADSTAR (KEY_OFFSET + 0xcf) /* star on keypad */ -#define PADMINUS (KEY_OFFSET + 0xd0) /* minus on keypad */ -#define PADPLUS (KEY_OFFSET + 0xd1) /* plus on keypad */ -#define CTL_PADSTOP (KEY_OFFSET + 0xd2) /* ctl-stop on keypad */ -#define CTL_PADCENTER (KEY_OFFSET + 0xd3) /* ctl-enter on keypad */ -#define CTL_PADPLUS (KEY_OFFSET + 0xd4) /* ctl-plus on keypad */ -#define CTL_PADMINUS (KEY_OFFSET + 0xd5) /* ctl-minus on keypad */ -#define CTL_PADSLASH (KEY_OFFSET + 0xd6) /* ctl-slash on keypad */ -#define CTL_PADSTAR (KEY_OFFSET + 0xd7) /* ctl-star on keypad */ -#define ALT_PADPLUS (KEY_OFFSET + 0xd8) /* alt-plus on keypad */ -#define ALT_PADMINUS (KEY_OFFSET + 0xd9) /* alt-minus on keypad */ -#define ALT_PADSLASH (KEY_OFFSET + 0xda) /* alt-slash on keypad */ -#define ALT_PADSTAR (KEY_OFFSET + 0xdb) /* alt-star on keypad */ -#define ALT_PADSTOP (KEY_OFFSET + 0xdc) /* alt-stop on keypad */ -#define CTL_INS (KEY_OFFSET + 0xdd) /* ctl-insert */ -#define ALT_DEL (KEY_OFFSET + 0xde) /* alt-delete */ -#define ALT_INS (KEY_OFFSET + 0xdf) /* alt-insert */ -#define CTL_UP (KEY_OFFSET + 0xe0) /* ctl-up arrow */ -#define CTL_DOWN (KEY_OFFSET + 0xe1) /* ctl-down arrow */ -#define CTL_TAB (KEY_OFFSET + 0xe2) /* ctl-tab */ -#define ALT_TAB (KEY_OFFSET + 0xe3) -#define ALT_MINUS (KEY_OFFSET + 0xe4) -#define ALT_EQUAL (KEY_OFFSET + 0xe5) -#define ALT_HOME (KEY_OFFSET + 0xe6) -#define ALT_PGUP (KEY_OFFSET + 0xe7) -#define ALT_PGDN (KEY_OFFSET + 0xe8) -#define ALT_END (KEY_OFFSET + 0xe9) -#define ALT_UP (KEY_OFFSET + 0xea) /* alt-up arrow */ -#define ALT_DOWN (KEY_OFFSET + 0xeb) /* alt-down arrow */ -#define ALT_RIGHT (KEY_OFFSET + 0xec) /* alt-right arrow */ -#define ALT_LEFT (KEY_OFFSET + 0xed) /* alt-left arrow */ -#define ALT_ENTER (KEY_OFFSET + 0xee) /* alt-enter */ -#define ALT_ESC (KEY_OFFSET + 0xef) /* alt-escape */ -#define ALT_BQUOTE (KEY_OFFSET + 0xf0) /* alt-back quote */ -#define ALT_LBRACKET (KEY_OFFSET + 0xf1) /* alt-left bracket */ -#define ALT_RBRACKET (KEY_OFFSET + 0xf2) /* alt-right bracket */ -#define ALT_SEMICOLON (KEY_OFFSET + 0xf3) /* alt-semi-colon */ -#define ALT_FQUOTE (KEY_OFFSET + 0xf4) /* alt-forward quote */ -#define ALT_COMMA (KEY_OFFSET + 0xf5) /* alt-comma */ -#define ALT_STOP (KEY_OFFSET + 0xf6) /* alt-stop */ -#define ALT_FSLASH (KEY_OFFSET + 0xf7) /* alt-forward slash */ -#define ALT_BKSP (KEY_OFFSET + 0xf8) /* alt-backspace */ -#define CTL_BKSP (KEY_OFFSET + 0xf9) /* ctl-backspace */ -#define PAD0 (KEY_OFFSET + 0xfa) /* keypad 0 */ - -#define CTL_PAD0 (KEY_OFFSET + 0xfb) /* ctl-keypad 0 */ -#define CTL_PAD1 (KEY_OFFSET + 0xfc) -#define CTL_PAD2 (KEY_OFFSET + 0xfd) -#define CTL_PAD3 (KEY_OFFSET + 0xfe) -#define CTL_PAD4 (KEY_OFFSET + 0xff) -#define CTL_PAD5 (KEY_OFFSET + 0x100) -#define CTL_PAD6 (KEY_OFFSET + 0x101) -#define CTL_PAD7 (KEY_OFFSET + 0x102) -#define CTL_PAD8 (KEY_OFFSET + 0x103) -#define CTL_PAD9 (KEY_OFFSET + 0x104) - -#define ALT_PAD0 (KEY_OFFSET + 0x105) /* alt-keypad 0 */ -#define ALT_PAD1 (KEY_OFFSET + 0x106) -#define ALT_PAD2 (KEY_OFFSET + 0x107) -#define ALT_PAD3 (KEY_OFFSET + 0x108) -#define ALT_PAD4 (KEY_OFFSET + 0x109) -#define ALT_PAD5 (KEY_OFFSET + 0x10a) -#define ALT_PAD6 (KEY_OFFSET + 0x10b) -#define ALT_PAD7 (KEY_OFFSET + 0x10c) -#define ALT_PAD8 (KEY_OFFSET + 0x10d) -#define ALT_PAD9 (KEY_OFFSET + 0x10e) - -#define CTL_DEL (KEY_OFFSET + 0x10f) /* clt-delete */ -#define ALT_BSLASH (KEY_OFFSET + 0x110) /* alt-back slash */ -#define CTL_ENTER (KEY_OFFSET + 0x111) /* ctl-enter */ - -#define SHF_PADENTER (KEY_OFFSET + 0x112) /* shift-enter on keypad */ -#define SHF_PADSLASH (KEY_OFFSET + 0x113) /* shift-slash on keypad */ -#define SHF_PADSTAR (KEY_OFFSET + 0x114) /* shift-star on keypad */ -#define SHF_PADPLUS (KEY_OFFSET + 0x115) /* shift-plus on keypad */ -#define SHF_PADMINUS (KEY_OFFSET + 0x116) /* shift-minus on keypad */ -#define SHF_UP (KEY_OFFSET + 0x117) /* shift-up on keypad */ -#define SHF_DOWN (KEY_OFFSET + 0x118) /* shift-down on keypad */ -#define SHF_IC (KEY_OFFSET + 0x119) /* shift-insert on keypad */ -#define SHF_DC (KEY_OFFSET + 0x11a) /* shift-delete on keypad */ - -#define KEY_MOUSE (KEY_OFFSET + 0x11b) /* "mouse" key */ -#define KEY_SHIFT_L (KEY_OFFSET + 0x11c) /* Left-shift */ -#define KEY_SHIFT_R (KEY_OFFSET + 0x11d) /* Right-shift */ -#define KEY_CONTROL_L (KEY_OFFSET + 0x11e) /* Left-control */ -#define KEY_CONTROL_R (KEY_OFFSET + 0x11f) /* Right-control */ -#define KEY_ALT_L (KEY_OFFSET + 0x120) /* Left-alt */ -#define KEY_ALT_R (KEY_OFFSET + 0x121) /* Right-alt */ -#define KEY_RESIZE (KEY_OFFSET + 0x122) /* Window resize */ -#define KEY_SUP (KEY_OFFSET + 0x123) /* Shifted up arrow */ -#define KEY_SDOWN (KEY_OFFSET + 0x124) /* Shifted down arrow */ - - /* The following were added 2011 Sep 14, and are */ - /* not returned by most flavors of PDCurses: */ - -#define CTL_SEMICOLON (KEY_OFFSET + 0x125) -#define CTL_EQUAL (KEY_OFFSET + 0x126) -#define CTL_COMMA (KEY_OFFSET + 0x127) -#define CTL_MINUS (KEY_OFFSET + 0x128) -#define CTL_STOP (KEY_OFFSET + 0x129) -#define CTL_FSLASH (KEY_OFFSET + 0x12a) -#define CTL_BQUOTE (KEY_OFFSET + 0x12b) - -#define KEY_APPS (KEY_OFFSET + 0x12c) -#define KEY_SAPPS (KEY_OFFSET + 0x12d) -#define CTL_APPS (KEY_OFFSET + 0x12e) -#define ALT_APPS (KEY_OFFSET + 0x12f) - -#define KEY_PAUSE (KEY_OFFSET + 0x130) -#define KEY_SPAUSE (KEY_OFFSET + 0x131) -#define CTL_PAUSE (KEY_OFFSET + 0x132) - -#define KEY_PRINTSCREEN (KEY_OFFSET + 0x133) -#define ALT_PRINTSCREEN (KEY_OFFSET + 0x134) -#define KEY_SCROLLLOCK (KEY_OFFSET + 0x135) -#define ALT_SCROLLLOCK (KEY_OFFSET + 0x136) - -#define CTL_0 (KEY_OFFSET + 0x137) -#define CTL_1 (KEY_OFFSET + 0x138) -#define CTL_2 (KEY_OFFSET + 0x139) -#define CTL_3 (KEY_OFFSET + 0x13a) -#define CTL_4 (KEY_OFFSET + 0x13b) -#define CTL_5 (KEY_OFFSET + 0x13c) -#define CTL_6 (KEY_OFFSET + 0x13d) -#define CTL_7 (KEY_OFFSET + 0x13e) -#define CTL_8 (KEY_OFFSET + 0x13f) -#define CTL_9 (KEY_OFFSET + 0x140) - -#define KEY_BROWSER_BACK (KEY_OFFSET + 0x141) -#define KEY_SBROWSER_BACK (KEY_OFFSET + 0x142) -#define KEY_CBROWSER_BACK (KEY_OFFSET + 0x143) -#define KEY_ABROWSER_BACK (KEY_OFFSET + 0x144) -#define KEY_BROWSER_FWD (KEY_OFFSET + 0x145) -#define KEY_SBROWSER_FWD (KEY_OFFSET + 0x146) -#define KEY_CBROWSER_FWD (KEY_OFFSET + 0x147) -#define KEY_ABROWSER_FWD (KEY_OFFSET + 0x148) -#define KEY_BROWSER_REF (KEY_OFFSET + 0x149) -#define KEY_SBROWSER_REF (KEY_OFFSET + 0x14A) -#define KEY_CBROWSER_REF (KEY_OFFSET + 0x14B) -#define KEY_ABROWSER_REF (KEY_OFFSET + 0x14C) -#define KEY_BROWSER_STOP (KEY_OFFSET + 0x14D) -#define KEY_SBROWSER_STOP (KEY_OFFSET + 0x14E) -#define KEY_CBROWSER_STOP (KEY_OFFSET + 0x14F) -#define KEY_ABROWSER_STOP (KEY_OFFSET + 0x150) -#define KEY_SEARCH (KEY_OFFSET + 0x151) -#define KEY_SSEARCH (KEY_OFFSET + 0x152) -#define KEY_CSEARCH (KEY_OFFSET + 0x153) -#define KEY_ASEARCH (KEY_OFFSET + 0x154) -#define KEY_FAVORITES (KEY_OFFSET + 0x155) -#define KEY_SFAVORITES (KEY_OFFSET + 0x156) -#define KEY_CFAVORITES (KEY_OFFSET + 0x157) -#define KEY_AFAVORITES (KEY_OFFSET + 0x158) -#define KEY_BROWSER_HOME (KEY_OFFSET + 0x159) -#define KEY_SBROWSER_HOME (KEY_OFFSET + 0x15A) -#define KEY_CBROWSER_HOME (KEY_OFFSET + 0x15B) -#define KEY_ABROWSER_HOME (KEY_OFFSET + 0x15C) -#define KEY_VOLUME_MUTE (KEY_OFFSET + 0x15D) -#define KEY_SVOLUME_MUTE (KEY_OFFSET + 0x15E) -#define KEY_CVOLUME_MUTE (KEY_OFFSET + 0x15F) -#define KEY_AVOLUME_MUTE (KEY_OFFSET + 0x160) -#define KEY_VOLUME_DOWN (KEY_OFFSET + 0x161) -#define KEY_SVOLUME_DOWN (KEY_OFFSET + 0x162) -#define KEY_CVOLUME_DOWN (KEY_OFFSET + 0x163) -#define KEY_AVOLUME_DOWN (KEY_OFFSET + 0x164) -#define KEY_VOLUME_UP (KEY_OFFSET + 0x165) -#define KEY_SVOLUME_UP (KEY_OFFSET + 0x166) -#define KEY_CVOLUME_UP (KEY_OFFSET + 0x167) -#define KEY_AVOLUME_UP (KEY_OFFSET + 0x168) -#define KEY_NEXT_TRACK (KEY_OFFSET + 0x169) -#define KEY_SNEXT_TRACK (KEY_OFFSET + 0x16A) -#define KEY_CNEXT_TRACK (KEY_OFFSET + 0x16B) -#define KEY_ANEXT_TRACK (KEY_OFFSET + 0x16C) -#define KEY_PREV_TRACK (KEY_OFFSET + 0x16D) -#define KEY_SPREV_TRACK (KEY_OFFSET + 0x16E) -#define KEY_CPREV_TRACK (KEY_OFFSET + 0x16F) -#define KEY_APREV_TRACK (KEY_OFFSET + 0x170) -#define KEY_MEDIA_STOP (KEY_OFFSET + 0x171) -#define KEY_SMEDIA_STOP (KEY_OFFSET + 0x172) -#define KEY_CMEDIA_STOP (KEY_OFFSET + 0x173) -#define KEY_AMEDIA_STOP (KEY_OFFSET + 0x174) -#define KEY_PLAY_PAUSE (KEY_OFFSET + 0x175) -#define KEY_SPLAY_PAUSE (KEY_OFFSET + 0x176) -#define KEY_CPLAY_PAUSE (KEY_OFFSET + 0x177) -#define KEY_APLAY_PAUSE (KEY_OFFSET + 0x178) -#define KEY_LAUNCH_MAIL (KEY_OFFSET + 0x179) -#define KEY_SLAUNCH_MAIL (KEY_OFFSET + 0x17A) -#define KEY_CLAUNCH_MAIL (KEY_OFFSET + 0x17B) -#define KEY_ALAUNCH_MAIL (KEY_OFFSET + 0x17C) -#define KEY_MEDIA_SELECT (KEY_OFFSET + 0x17D) -#define KEY_SMEDIA_SELECT (KEY_OFFSET + 0x17E) -#define KEY_CMEDIA_SELECT (KEY_OFFSET + 0x17F) -#define KEY_AMEDIA_SELECT (KEY_OFFSET + 0x180) -#define KEY_LAUNCH_APP1 (KEY_OFFSET + 0x181) -#define KEY_SLAUNCH_APP1 (KEY_OFFSET + 0x182) -#define KEY_CLAUNCH_APP1 (KEY_OFFSET + 0x183) -#define KEY_ALAUNCH_APP1 (KEY_OFFSET + 0x184) -#define KEY_LAUNCH_APP2 (KEY_OFFSET + 0x185) -#define KEY_SLAUNCH_APP2 (KEY_OFFSET + 0x186) -#define KEY_CLAUNCH_APP2 (KEY_OFFSET + 0x187) -#define KEY_ALAUNCH_APP2 (KEY_OFFSET + 0x188) - -#define KEY_MIN KEY_BREAK /* Minimum curses key value */ -#define KEY_MAX KEY_ALAUNCH_APP2 /* Maximum curses key */ - -#define KEY_F(n) (KEY_F0 + (n)) - -/*---------------------------------------------------------------------- - * - * PDCurses Function Declarations - * - */ - -/* Standard */ - -PDCEX int addch(const chtype); -PDCEX int addchnstr(const chtype *, int); -PDCEX int addchstr(const chtype *); -PDCEX int addnstr(const char *, int); -PDCEX int addstr(const char *); -PDCEX int attroff(chtype); -PDCEX int attron(chtype); -PDCEX int attrset(chtype); -PDCEX int attr_get(attr_t *, short *, void *); -PDCEX int attr_off(attr_t, void *); -PDCEX int attr_on(attr_t, void *); -PDCEX int attr_set(attr_t, short, void *); -PDCEX int baudrate(void); -PDCEX int beep(void); -PDCEX int bkgd(chtype); -PDCEX void bkgdset(chtype); -PDCEX int border(chtype, chtype, chtype, chtype, - chtype, chtype, chtype, chtype); -PDCEX int box(WINDOW *, chtype, chtype); -PDCEX bool can_change_color(void); -PDCEX int cbreak(void); -PDCEX int chgat(int, attr_t, short, const void *); -PDCEX int clearok(WINDOW *, bool); -PDCEX int clear(void); -PDCEX int clrtobot(void); -PDCEX int clrtoeol(void); -PDCEX int color_content(short, short *, short *, short *); -PDCEX int color_set(short, void *); -PDCEX int copywin(const WINDOW *, WINDOW *, int, int, int, - int, int, int, int); -PDCEX int curs_set(int); -PDCEX int def_prog_mode(void); -PDCEX int def_shell_mode(void); -PDCEX int delay_output(int); -PDCEX int delch(void); -PDCEX int deleteln(void); -PDCEX void delscreen(SCREEN *); -PDCEX int delwin(WINDOW *); -PDCEX WINDOW *derwin(WINDOW *, int, int, int, int); -PDCEX int doupdate(void); -PDCEX WINDOW *dupwin(WINDOW *); -PDCEX int echochar(const chtype); -PDCEX int echo(void); -PDCEX int endwin(void); -PDCEX char erasechar(void); -PDCEX int erase(void); -PDCEX void filter(void); -PDCEX int flash(void); -PDCEX int flushinp(void); -PDCEX chtype getbkgd(WINDOW *); -PDCEX int getnstr(char *, int); -PDCEX int getstr(char *); -PDCEX WINDOW *getwin(FILE *); -PDCEX int halfdelay(int); -PDCEX bool has_colors(void); -PDCEX bool has_ic(void); -PDCEX bool has_il(void); -PDCEX int hline(chtype, int); -PDCEX void idcok(WINDOW *, bool); -PDCEX int idlok(WINDOW *, bool); -PDCEX void immedok(WINDOW *, bool); -PDCEX int inchnstr(chtype *, int); -PDCEX int inchstr(chtype *); -PDCEX chtype inch(void); -PDCEX int init_color(short, short, short, short); -PDCEX int init_pair(short, short, short); -PDCEX WINDOW *initscr(void); -PDCEX int innstr(char *, int); -PDCEX int insch(chtype); -PDCEX int insdelln(int); -PDCEX int insertln(void); -PDCEX int insnstr(const char *, int); -PDCEX int insstr(const char *); -PDCEX int instr(char *); -PDCEX int intrflush(WINDOW *, bool); -PDCEX bool isendwin(void); -PDCEX bool is_linetouched(WINDOW *, int); -PDCEX bool is_wintouched(WINDOW *); -PDCEX char *keyname(int); -PDCEX int keypad(WINDOW *, bool); -PDCEX char killchar(void); -PDCEX int leaveok(WINDOW *, bool); -PDCEX char *longname(void); -PDCEX int meta(WINDOW *, bool); -PDCEX int move(int, int); -PDCEX int mvaddch(int, int, const chtype); -PDCEX int mvaddchnstr(int, int, const chtype *, int); -PDCEX int mvaddchstr(int, int, const chtype *); -PDCEX int mvaddnstr(int, int, const char *, int); -PDCEX int mvaddstr(int, int, const char *); -PDCEX int mvchgat(int, int, int, attr_t, short, const void *); -PDCEX int mvcur(int, int, int, int); -PDCEX int mvdelch(int, int); -PDCEX int mvderwin(WINDOW *, int, int); -PDCEX int mvgetch(int, int); -PDCEX int mvgetnstr(int, int, char *, int); -PDCEX int mvgetstr(int, int, char *); -PDCEX int mvhline(int, int, chtype, int); -PDCEX chtype mvinch(int, int); -PDCEX int mvinchnstr(int, int, chtype *, int); -PDCEX int mvinchstr(int, int, chtype *); -PDCEX int mvinnstr(int, int, char *, int); -PDCEX int mvinsch(int, int, chtype); -PDCEX int mvinsnstr(int, int, const char *, int); -PDCEX int mvinsstr(int, int, const char *); -PDCEX int mvinstr(int, int, char *); -PDCEX int mvprintw(int, int, const char *, ...); -PDCEX int mvscanw(int, int, const char *, ...); -PDCEX int mvvline(int, int, chtype, int); -PDCEX int mvwaddchnstr(WINDOW *, int, int, const chtype *, int); -PDCEX int mvwaddchstr(WINDOW *, int, int, const chtype *); -PDCEX int mvwaddch(WINDOW *, int, int, const chtype); -PDCEX int mvwaddnstr(WINDOW *, int, int, const char *, int); -PDCEX int mvwaddstr(WINDOW *, int, int, const char *); -PDCEX int mvwchgat(WINDOW *, int, int, int, attr_t, short, const void *); -PDCEX int mvwdelch(WINDOW *, int, int); -PDCEX int mvwgetch(WINDOW *, int, int); -PDCEX int mvwgetnstr(WINDOW *, int, int, char *, int); -PDCEX int mvwgetstr(WINDOW *, int, int, char *); -PDCEX int mvwhline(WINDOW *, int, int, chtype, int); -PDCEX int mvwinchnstr(WINDOW *, int, int, chtype *, int); -PDCEX int mvwinchstr(WINDOW *, int, int, chtype *); -PDCEX chtype mvwinch(WINDOW *, int, int); -PDCEX int mvwinnstr(WINDOW *, int, int, char *, int); -PDCEX int mvwinsch(WINDOW *, int, int, chtype); -PDCEX int mvwinsnstr(WINDOW *, int, int, const char *, int); -PDCEX int mvwinsstr(WINDOW *, int, int, const char *); -PDCEX int mvwinstr(WINDOW *, int, int, char *); -PDCEX int mvwin(WINDOW *, int, int); -PDCEX int mvwprintw(WINDOW *, int, int, const char *, ...); -PDCEX int mvwscanw(WINDOW *, int, int, const char *, ...); -PDCEX int mvwvline(WINDOW *, int, int, chtype, int); -PDCEX int napms(int); -PDCEX WINDOW *newpad(int, int); -PDCEX SCREEN *newterm(const char *, FILE *, FILE *); -PDCEX WINDOW *newwin(int, int, int, int); -PDCEX int nl(void); -PDCEX int nocbreak(void); -PDCEX int nodelay(WINDOW *, bool); -PDCEX int noecho(void); -PDCEX int nonl(void); -PDCEX void noqiflush(void); -PDCEX int noraw(void); -PDCEX int notimeout(WINDOW *, bool); -PDCEX int overlay(const WINDOW *, WINDOW *); -PDCEX int overwrite(const WINDOW *, WINDOW *); -PDCEX int pair_content(short, short *, short *); -PDCEX int pechochar(WINDOW *, chtype); -PDCEX int pnoutrefresh(WINDOW *, int, int, int, int, int, int); -PDCEX int prefresh(WINDOW *, int, int, int, int, int, int); -PDCEX int printw(const char *, ...); -PDCEX int putwin(WINDOW *, FILE *); -PDCEX void qiflush(void); -PDCEX int raw(void); -PDCEX int redrawwin(WINDOW *); -PDCEX int refresh(void); -PDCEX int reset_prog_mode(void); -PDCEX int reset_shell_mode(void); -PDCEX int resetty(void); -PDCEX int ripoffline(int, int (*)(WINDOW *, int)); -PDCEX int savetty(void); -PDCEX int scanw(const char *, ...); -PDCEX int scr_dump(const char *); -PDCEX int scr_init(const char *); -PDCEX int scr_restore(const char *); -PDCEX int scr_set(const char *); -PDCEX int scrl(int); -PDCEX int scroll(WINDOW *); -PDCEX int scrollok(WINDOW *, bool); -PDCEX SCREEN *set_term(SCREEN *); -PDCEX int setscrreg(int, int); -PDCEX int slk_attroff(const chtype); -PDCEX int slk_attr_off(const attr_t, void *); -PDCEX int slk_attron(const chtype); -PDCEX int slk_attr_on(const attr_t, void *); -PDCEX int slk_attrset(const chtype); -PDCEX int slk_attr_set(const attr_t, short, void *); -PDCEX int slk_clear(void); -PDCEX int slk_color(short); -PDCEX int slk_init(int); -PDCEX char *slk_label(int); -PDCEX int slk_noutrefresh(void); -PDCEX int slk_refresh(void); -PDCEX int slk_restore(void); -PDCEX int slk_set(int, const char *, int); -PDCEX int slk_touch(void); -PDCEX int standend(void); -PDCEX int standout(void); -PDCEX int start_color(void); -PDCEX WINDOW *subpad(WINDOW *, int, int, int, int); -PDCEX WINDOW *subwin(WINDOW *, int, int, int, int); -PDCEX int syncok(WINDOW *, bool); -PDCEX chtype termattrs(void); -PDCEX attr_t term_attrs(void); -PDCEX char *termname(void); -PDCEX void timeout(int); -PDCEX int touchline(WINDOW *, int, int); -PDCEX int touchwin(WINDOW *); -PDCEX int typeahead(int); -PDCEX int untouchwin(WINDOW *); -PDCEX void use_env(bool); -PDCEX int vidattr(chtype); -PDCEX int vid_attr(attr_t, short, void *); -PDCEX int vidputs(chtype, int (*)(int)); -PDCEX int vid_puts(attr_t, short, void *, int (*)(int)); -PDCEX int vline(chtype, int); -PDCEX int vw_printw(WINDOW *, const char *, va_list); -PDCEX int vwprintw(WINDOW *, const char *, va_list); -PDCEX int vw_scanw(WINDOW *, const char *, va_list); -PDCEX int vwscanw(WINDOW *, const char *, va_list); -PDCEX int waddchnstr(WINDOW *, const chtype *, int); -PDCEX int waddchstr(WINDOW *, const chtype *); -PDCEX int waddch(WINDOW *, const chtype); -PDCEX int waddnstr(WINDOW *, const char *, int); -PDCEX int waddstr(WINDOW *, const char *); -PDCEX int wattroff(WINDOW *, chtype); -PDCEX int wattron(WINDOW *, chtype); -PDCEX int wattrset(WINDOW *, chtype); -PDCEX int wattr_get(WINDOW *, attr_t *, short *, void *); -PDCEX int wattr_off(WINDOW *, attr_t, void *); -PDCEX int wattr_on(WINDOW *, attr_t, void *); -PDCEX int wattr_set(WINDOW *, attr_t, short, void *); -PDCEX void wbkgdset(WINDOW *, chtype); -PDCEX int wbkgd(WINDOW *, chtype); -PDCEX int wborder(WINDOW *, chtype, chtype, chtype, chtype, - chtype, chtype, chtype, chtype); -PDCEX int wchgat(WINDOW *, int, attr_t, short, const void *); -PDCEX int wclear(WINDOW *); -PDCEX int wclrtobot(WINDOW *); -PDCEX int wclrtoeol(WINDOW *); -PDCEX int wcolor_set(WINDOW *, short, void *); -PDCEX void wcursyncup(WINDOW *); -PDCEX int wdelch(WINDOW *); -PDCEX int wdeleteln(WINDOW *); -PDCEX int wechochar(WINDOW *, const chtype); -PDCEX int werase(WINDOW *); -PDCEX int wgetch(WINDOW *); -PDCEX int wgetnstr(WINDOW *, char *, int); -PDCEX int wgetstr(WINDOW *, char *); -PDCEX int whline(WINDOW *, chtype, int); -PDCEX int winchnstr(WINDOW *, chtype *, int); -PDCEX int winchstr(WINDOW *, chtype *); -PDCEX chtype winch(WINDOW *); -PDCEX int winnstr(WINDOW *, char *, int); -PDCEX int winsch(WINDOW *, chtype); -PDCEX int winsdelln(WINDOW *, int); -PDCEX int winsertln(WINDOW *); -PDCEX int winsnstr(WINDOW *, const char *, int); -PDCEX int winsstr(WINDOW *, const char *); -PDCEX int winstr(WINDOW *, char *); -PDCEX int wmove(WINDOW *, int, int); -PDCEX int wnoutrefresh(WINDOW *); -PDCEX int wprintw(WINDOW *, const char *, ...); -PDCEX int wredrawln(WINDOW *, int, int); -PDCEX int wrefresh(WINDOW *); -PDCEX int wscanw(WINDOW *, const char *, ...); -PDCEX int wscrl(WINDOW *, int); -PDCEX int wsetscrreg(WINDOW *, int, int); -PDCEX int wstandend(WINDOW *); -PDCEX int wstandout(WINDOW *); -PDCEX void wsyncdown(WINDOW *); -PDCEX void wsyncup(WINDOW *); -PDCEX void wtimeout(WINDOW *, int); -PDCEX int wtouchln(WINDOW *, int, int, int); -PDCEX int wvline(WINDOW *, chtype, int); - -/* Wide-character functions */ - -#ifdef PDC_WIDE -PDCEX int addnwstr(const wchar_t *, int); -PDCEX int addwstr(const wchar_t *); -PDCEX int add_wch(const cchar_t *); -PDCEX int add_wchnstr(const cchar_t *, int); -PDCEX int add_wchstr(const cchar_t *); -PDCEX int border_set(const cchar_t *, const cchar_t *, const cchar_t *, - const cchar_t *, const cchar_t *, const cchar_t *, - const cchar_t *, const cchar_t *); -PDCEX int box_set(WINDOW *, const cchar_t *, const cchar_t *); -PDCEX int echo_wchar(const cchar_t *); -PDCEX int erasewchar(wchar_t *); -PDCEX int getbkgrnd(cchar_t *); -PDCEX int getcchar(const cchar_t *, wchar_t *, attr_t *, short *, void *); -PDCEX int getn_wstr(wint_t *, int); -PDCEX int get_wch(wint_t *); -PDCEX int get_wstr(wint_t *); -PDCEX int hline_set(const cchar_t *, int); -PDCEX int innwstr(wchar_t *, int); -PDCEX int ins_nwstr(const wchar_t *, int); -PDCEX int ins_wch(const cchar_t *); -PDCEX int ins_wstr(const wchar_t *); -PDCEX int inwstr(wchar_t *); -PDCEX int in_wch(cchar_t *); -PDCEX int in_wchnstr(cchar_t *, int); -PDCEX int in_wchstr(cchar_t *); -PDCEX char *key_name(wchar_t); -PDCEX int killwchar(wchar_t *); -PDCEX int mvaddnwstr(int, int, const wchar_t *, int); -PDCEX int mvaddwstr(int, int, const wchar_t *); -PDCEX int mvadd_wch(int, int, const cchar_t *); -PDCEX int mvadd_wchnstr(int, int, const cchar_t *, int); -PDCEX int mvadd_wchstr(int, int, const cchar_t *); -PDCEX int mvgetn_wstr(int, int, wint_t *, int); -PDCEX int mvget_wch(int, int, wint_t *); -PDCEX int mvget_wstr(int, int, wint_t *); -PDCEX int mvhline_set(int, int, const cchar_t *, int); -PDCEX int mvinnwstr(int, int, wchar_t *, int); -PDCEX int mvins_nwstr(int, int, const wchar_t *, int); -PDCEX int mvins_wch(int, int, const cchar_t *); -PDCEX int mvins_wstr(int, int, const wchar_t *); -PDCEX int mvinwstr(int, int, wchar_t *); -PDCEX int mvin_wch(int, int, cchar_t *); -PDCEX int mvin_wchnstr(int, int, cchar_t *, int); -PDCEX int mvin_wchstr(int, int, cchar_t *); -PDCEX int mvvline_set(int, int, const cchar_t *, int); -PDCEX int mvwaddnwstr(WINDOW *, int, int, const wchar_t *, int); -PDCEX int mvwaddwstr(WINDOW *, int, int, const wchar_t *); -PDCEX int mvwadd_wch(WINDOW *, int, int, const cchar_t *); -PDCEX int mvwadd_wchnstr(WINDOW *, int, int, const cchar_t *, int); -PDCEX int mvwadd_wchstr(WINDOW *, int, int, const cchar_t *); -PDCEX int mvwgetn_wstr(WINDOW *, int, int, wint_t *, int); -PDCEX int mvwget_wch(WINDOW *, int, int, wint_t *); -PDCEX int mvwget_wstr(WINDOW *, int, int, wint_t *); -PDCEX int mvwhline_set(WINDOW *, int, int, const cchar_t *, int); -PDCEX int mvwinnwstr(WINDOW *, int, int, wchar_t *, int); -PDCEX int mvwins_nwstr(WINDOW *, int, int, const wchar_t *, int); -PDCEX int mvwins_wch(WINDOW *, int, int, const cchar_t *); -PDCEX int mvwins_wstr(WINDOW *, int, int, const wchar_t *); -PDCEX int mvwin_wch(WINDOW *, int, int, cchar_t *); -PDCEX int mvwin_wchnstr(WINDOW *, int, int, cchar_t *, int); -PDCEX int mvwin_wchstr(WINDOW *, int, int, cchar_t *); -PDCEX int mvwinwstr(WINDOW *, int, int, wchar_t *); -PDCEX int mvwvline_set(WINDOW *, int, int, const cchar_t *, int); -PDCEX int pecho_wchar(WINDOW *, const cchar_t*); -PDCEX int setcchar(cchar_t*, const wchar_t*, const attr_t, - short, const void*); -PDCEX int slk_wset(int, const wchar_t *, int); -PDCEX int unget_wch(const wchar_t); -PDCEX int vline_set(const cchar_t *, int); -PDCEX int waddnwstr(WINDOW *, const wchar_t *, int); -PDCEX int waddwstr(WINDOW *, const wchar_t *); -PDCEX int wadd_wch(WINDOW *, const cchar_t *); -PDCEX int wadd_wchnstr(WINDOW *, const cchar_t *, int); -PDCEX int wadd_wchstr(WINDOW *, const cchar_t *); -PDCEX int wbkgrnd(WINDOW *, const cchar_t *); -PDCEX void wbkgrndset(WINDOW *, const cchar_t *); -PDCEX int wborder_set(WINDOW *, const cchar_t *, const cchar_t *, - const cchar_t *, const cchar_t *, const cchar_t *, - const cchar_t *, const cchar_t *, const cchar_t *); -PDCEX int wecho_wchar(WINDOW *, const cchar_t *); -PDCEX int wgetbkgrnd(WINDOW *, cchar_t *); -PDCEX int wgetn_wstr(WINDOW *, wint_t *, int); -PDCEX int wget_wch(WINDOW *, wint_t *); -PDCEX int wget_wstr(WINDOW *, wint_t *); -PDCEX int whline_set(WINDOW *, const cchar_t *, int); -PDCEX int winnwstr(WINDOW *, wchar_t *, int); -PDCEX int wins_nwstr(WINDOW *, const wchar_t *, int); -PDCEX int wins_wch(WINDOW *, const cchar_t *); -PDCEX int wins_wstr(WINDOW *, const wchar_t *); -PDCEX int winwstr(WINDOW *, wchar_t *); -PDCEX int win_wch(WINDOW *, cchar_t *); -PDCEX int win_wchnstr(WINDOW *, cchar_t *, int); -PDCEX int win_wchstr(WINDOW *, cchar_t *); -PDCEX wchar_t *wunctrl(cchar_t *); -PDCEX int wvline_set(WINDOW *, const cchar_t *, int); -#endif - -/* Quasi-standard */ - -PDCEX chtype getattrs(WINDOW *); -PDCEX int getbegx(WINDOW *); -PDCEX int getbegy(WINDOW *); -PDCEX int getmaxx(WINDOW *); -PDCEX int getmaxy(WINDOW *); -PDCEX int getparx(WINDOW *); -PDCEX int getpary(WINDOW *); -PDCEX int getcurx(WINDOW *); -PDCEX int getcury(WINDOW *); -PDCEX void traceoff(void); -PDCEX void traceon(void); -PDCEX char *unctrl(chtype); - -PDCEX int crmode(void); -PDCEX int nocrmode(void); -PDCEX int draino(int); -PDCEX int resetterm(void); -PDCEX int fixterm(void); -PDCEX int saveterm(void); -PDCEX void setsyx(int, int); - -PDCEX int mouse_set(unsigned long); -PDCEX int mouse_on(unsigned long); -PDCEX int mouse_off(unsigned long); -PDCEX int request_mouse_pos(void); -PDCEX int map_button(unsigned long); -PDCEX void wmouse_position(WINDOW *, int *, int *); -PDCEX unsigned long getmouse(void); -PDCEX unsigned long getbmap(void); - -/* ncurses */ - -PDCEX int assume_default_colors(int, int); -PDCEX const char *curses_version(void); -PDCEX bool has_key(int); -PDCEX int use_default_colors(void); -PDCEX int wresize(WINDOW *, int, int); - -PDCEX int mouseinterval(int); -PDCEX mmask_t mousemask(mmask_t, mmask_t *); -PDCEX bool mouse_trafo(int *, int *, bool); -PDCEX int nc_getmouse(MEVENT *); -PDCEX int ungetmouse(MEVENT *); -PDCEX bool wenclose(const WINDOW *, int, int); -PDCEX bool wmouse_trafo(const WINDOW *, int *, int *, bool); - -/* PDCurses */ - -PDCEX int addrawch(chtype); -PDCEX int insrawch(chtype); -PDCEX bool is_termresized(void); -PDCEX int mvaddrawch(int, int, chtype); -PDCEX int mvdeleteln(int, int); -PDCEX int mvinsertln(int, int); -PDCEX int mvinsrawch(int, int, chtype); -PDCEX int mvwaddrawch(WINDOW *, int, int, chtype); -PDCEX int mvwdeleteln(WINDOW *, int, int); -PDCEX int mvwinsertln(WINDOW *, int, int); -PDCEX int mvwinsrawch(WINDOW *, int, int, chtype); -PDCEX int raw_output(bool); -PDCEX int resize_term(int, int); -PDCEX WINDOW *resize_window(WINDOW *, int, int); -PDCEX int waddrawch(WINDOW *, chtype); -PDCEX int winsrawch(WINDOW *, chtype); -PDCEX char wordchar(void); - -#ifdef PDC_WIDE -PDCEX wchar_t *slk_wlabel(int); -#endif - -PDCEX void PDC_debug(const char *, ...); -PDCEX int PDC_ungetch(int); -PDCEX int PDC_set_blink(bool); -PDCEX int PDC_set_line_color(short); -PDCEX void PDC_set_title(const char *); - -PDCEX int PDC_clearclipboard(void); -PDCEX int PDC_freeclipboard(char *); -PDCEX int PDC_getclipboard(char **, long *); -PDCEX int PDC_setclipboard(const char *, long); - -PDCEX unsigned long PDC_get_input_fd(void); -PDCEX unsigned long PDC_get_key_modifiers(void); -PDCEX int PDC_return_key_modifiers(bool); -PDCEX int PDC_save_key_modifiers(bool); -PDCEX void PDC_set_resize_limits( const int new_min_lines, - const int new_max_lines, - const int new_min_cols, - const int new_max_cols); - -#define FUNCTION_KEY_SHUT_DOWN 0 -#define FUNCTION_KEY_PASTE 1 -#define FUNCTION_KEY_ENLARGE_FONT 2 -#define FUNCTION_KEY_SHRINK_FONT 3 -#define FUNCTION_KEY_CHOOSE_FONT 4 -#define FUNCTION_KEY_ABORT 5 -#define PDC_MAX_FUNCTION_KEYS 6 - -PDCEX int PDC_set_function_key( const unsigned function, - const int new_key); - -PDCEX WINDOW *Xinitscr(int, char **); -#ifdef XCURSES -PDCEX void XCursesExit(void); -PDCEX int sb_init(void); -PDCEX int sb_set_horz(int, int, int); -PDCEX int sb_set_vert(int, int, int); -PDCEX int sb_get_horz(int *, int *, int *); -PDCEX int sb_get_vert(int *, int *, int *); -PDCEX int sb_refresh(void); - #endif - -/*** Functions defined as macros ***/ - -/* getch() and ungetch() conflict with some DOS libraries */ - -#define getch() wgetch(stdscr) -#define ungetch(ch) PDC_ungetch(ch) - -#define COLOR_PAIR(n) (((chtype)(n) << PDC_COLOR_SHIFT) & A_COLOR) -#define PAIR_NUMBER(n) ((((n) & A_COLOR) >> PDC_COLOR_SHIFT) & 0xff) - -/* These will _only_ work as macros */ - -#define getbegyx(w, y, x) (y = getbegy(w), x = getbegx(w)) -#define getmaxyx(w, y, x) (y = getmaxy(w), x = getmaxx(w)) -#define getparyx(w, y, x) (y = getpary(w), x = getparx(w)) -#define getyx(w, y, x) (y = getcury(w), x = getcurx(w)) - -#define getsyx(y, x) { if (curscr->_leaveit) (y)=(x)=-1; \ - else getyx(curscr,(y),(x)); } - -#ifdef NCURSES_MOUSE_VERSION -# define getmouse(x) nc_getmouse(x) -#endif - -/* return codes from PDC_getclipboard() and PDC_setclipboard() calls */ - -#define PDC_CLIP_SUCCESS 0 -#define PDC_CLIP_ACCESS_ERROR 1 -#define PDC_CLIP_EMPTY 2 -#define PDC_CLIP_MEMORY_ERROR 3 - -/* PDCurses key modifier masks */ - -#define PDC_KEY_MODIFIER_SHIFT 1 -#define PDC_KEY_MODIFIER_CONTROL 2 -#define PDC_KEY_MODIFIER_ALT 4 -#define PDC_KEY_MODIFIER_NUMLOCK 8 -#define PDC_KEY_MODIFIER_REPEAT 16 - -#ifdef __cplusplus -# undef bool -} -#endif - -#endif /* __PDCURSES__ */ diff --git a/src/cc/rogue/x86_64-w64-msvc/deps/install/include/curspriv.h b/src/cc/rogue/x86_64-w64-msvc/deps/install/include/curspriv.h deleted file mode 100644 index b5edcc173..000000000 --- a/src/cc/rogue/x86_64-w64-msvc/deps/install/include/curspriv.h +++ /dev/null @@ -1,134 +0,0 @@ -/* Public Domain Curses */ - -/* Private definitions and declarations for use within PDCurses. - These should generally not be referenced by applications. */ - -#ifndef __CURSES_INTERNALS__ -#define __CURSES_INTERNALS__ 1 - -#define CURSES_LIBRARY -#include - -#if defined(__TURBOC__) || defined(__EMX__) || defined(__DJGPP__) || \ - defined(__CYGWIN__) || defined(__MINGW32__) || \ - defined(__WATCOMC__) || defined(__PACIFIC__) -# ifndef HAVE_VSSCANF -# define HAVE_VSSCANF /* have vsscanf() */ -# endif -#endif - -#if defined(__CYGWIN__) || defined(__MINGW32__) || \ - defined(__LCC__) || defined(__WATCOMC__) -# ifndef HAVE_VSNPRINTF -# define HAVE_VSNPRINTF /* have vsnprintf() */ -# endif -#endif - -#if defined(_MSC_VER) && defined(_WIN32) && !defined(_CRT_SECURE_NO_DEPRECATE) -# define _CRT_SECURE_NO_DEPRECATE 1 /* kill nonsense warnings */ -#endif - -/*----------------------------------------------------------------------*/ - -typedef struct /* structure for ripped off lines */ -{ - int line; - int (*init)(WINDOW *, int); -} RIPPEDOFFLINE; - -/* Window properties */ - -#define _SUBWIN 0x01 /* window is a subwindow */ -#define _PAD 0x10 /* X/Open Pad. */ -#define _SUBPAD 0x20 /* X/Open subpad. */ - -/* Miscellaneous */ - -#define _NO_CHANGE -1 /* flags line edge unchanged */ - -#define _ECHAR 0x08 /* Erase char (^H) */ -#define _DWCHAR 0x17 /* Delete Word char (^W) */ -#define _DLCHAR 0x15 /* Delete Line char (^U) */ - -extern WINDOW *pdc_lastscr; -extern FILE *pdc_dbfp; /* tracing file pointer (NULL = off) */ -extern bool pdc_color_started; -extern unsigned long pdc_key_modifiers; -extern MOUSE_STATUS pdc_mouse_status; - -/*----------------------------------------------------------------------*/ - -/* Platform implementation functions */ - -void PDC_beep(void); -bool PDC_can_change_color(void); -int PDC_color_content(short, short *, short *, short *); -bool PDC_check_key(void); -int PDC_curs_set(int); -void PDC_flushinp(void); -int PDC_get_columns(void); -int PDC_get_cursor_mode(void); -int PDC_get_key(void); -int PDC_get_rows(void); -void PDC_gotoyx(int, int); -int PDC_init_color(short, short, short, short); -void PDC_init_pair(short, short, short); -int PDC_modifiers_set(void); -int PDC_mouse_set(void); -void PDC_napms(int); -int PDC_pair_content(short, short *, short *); -void PDC_reset_prog_mode(void); -void PDC_reset_shell_mode(void); -int PDC_resize_screen(int, int); -void PDC_restore_screen_mode(int); -void PDC_save_screen_mode(int); -void PDC_scr_close(void); -void PDC_scr_free(void); -int PDC_scr_open(int, char **); -void PDC_set_keyboard_binary(bool); -void PDC_transform_line(int, int, int, const chtype *); -const char *PDC_sysname(void); - -/* Internal cross-module functions */ - -void PDC_init_atrtab(void); -WINDOW *PDC_makelines(WINDOW *); -WINDOW *PDC_makenew(int, int, int, int); -int PDC_mouse_in_slk(int, int); -void PDC_slk_free(void); -void PDC_slk_initialize(void); -void PDC_sync(WINDOW *); - -#ifdef PDC_WIDE -int PDC_mbtowc(wchar_t *, const char *, size_t); -size_t PDC_mbstowcs(wchar_t *, const char *, size_t); -size_t PDC_wcstombs(char *, const wchar_t *, size_t); -#endif - -#ifdef PDCDEBUG -# define PDC_LOG(x) if (pdc_dbfp) PDC_debug x -#else -# define PDC_LOG(x) -#endif - -/* Internal macros for attributes */ - -#ifdef CHTYPE_LONG -# define PDC_COLOR_PAIRS 256 -#else -# define PDC_COLOR_PAIRS 32 -#endif - -#ifndef max -# define max(a,b) (((a) > (b)) ? (a) : (b)) -#endif -#ifndef min -# define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif - -#define DIVROUND(num, divisor) (((num) + ((divisor) >> 1)) / (divisor)) - -#define PDC_CLICK_PERIOD 150 /* time to wait for a click, if - not set by mouseinterval() */ - -#endif /* __CURSES_INTERNALS__*/ diff --git a/src/cc/rogue/x86_64-w64-msvc/deps/install/include/getopt.h b/src/cc/rogue/x86_64-w64-msvc/deps/install/include/getopt.h deleted file mode 100644 index 4de6e853e..000000000 --- a/src/cc/rogue/x86_64-w64-msvc/deps/install/include/getopt.h +++ /dev/null @@ -1,93 +0,0 @@ -/* $Id: getopt.h,v 1.1 2009/10/16 19:50:28 rodney Exp rodney $ */ -/* $OpenBSD: getopt.h,v 1.1 2002/12/03 20:24:29 millert Exp $ */ -/* $NetBSD: getopt.h,v 1.4 2000/07/07 10:43:54 ad Exp $ */ - -/*- - * Copyright (c) 2000 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Dieter Baron and Thomas Klausner. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _GETOPT_H_ -#define _GETOPT_H_ - -#if 0 -#include -#endif - -/* - * GNU-like getopt_long() and 4.4BSD getsubopt()/optreset extensions - */ -#define no_argument 0 -#define required_argument 1 -#define optional_argument 2 - -struct option { - /* name of long option */ - const char *name; - /* - * one of no_argument, required_argument, and optional_argument: - * whether option takes an argument - */ - int has_arg; - /* if not NULL, set *flag to val when option found */ - int *flag; - /* if flag not NULL, value to set *flag to; else return value */ - int val; -}; - -#ifdef __cplusplus -extern "C" { -#endif - -int getopt_long(int, char * const *, const char *, - const struct option *, int *); -int getopt_long_only(int, char * const *, const char *, - const struct option *, int *); -#ifndef _GETOPT_DEFINED -#define _GETOPT_DEFINED -int getopt(int, char * const *, const char *); -int getsubopt(char **, char * const *, char **); - -extern char *optarg; /* getopt(3) external variables */ -extern int opterr; -extern int optind; -extern int optopt; -extern int optreset; -extern char *suboptarg; /* getsubopt(3) external variable */ -#endif /* _GETOPT_DEFINED */ - -#ifdef __cplusplus -} -#endif -#endif /* !_GETOPT_H_ */ diff --git a/src/cc/rogue/x86_64-w64-msvc/deps/install/include/panel.h b/src/cc/rogue/x86_64-w64-msvc/deps/install/include/panel.h deleted file mode 100644 index 7f1fb1f17..000000000 --- a/src/cc/rogue/x86_64-w64-msvc/deps/install/include/panel.h +++ /dev/null @@ -1,56 +0,0 @@ -/* Public Domain Curses */ - -/*----------------------------------------------------------------------* - * Panels for PDCurses * - *----------------------------------------------------------------------*/ - -#ifndef __PDCURSES_PANEL_H__ -#define __PDCURSES_PANEL_H__ 1 - -#include - -#if defined(__cplusplus) || defined(__cplusplus__) || defined(__CPLUSPLUS) -extern "C" -{ -#endif - -typedef struct panelobs -{ - struct panelobs *above; - struct panel *pan; -} PANELOBS; - -typedef struct panel -{ - WINDOW *win; - int wstarty; - int wendy; - int wstartx; - int wendx; - struct panel *below; - struct panel *above; - const void *user; - struct panelobs *obscure; -} PANEL; - -PDCEX int bottom_panel(PANEL *pan); -PDCEX int del_panel(PANEL *pan); -PDCEX int hide_panel(PANEL *pan); -PDCEX int move_panel(PANEL *pan, int starty, int startx); -PDCEX PANEL *new_panel(WINDOW *win); -PDCEX PANEL *panel_above(const PANEL *pan); -PDCEX PANEL *panel_below(const PANEL *pan); -PDCEX int panel_hidden(const PANEL *pan); -PDCEX const void *panel_userptr(const PANEL *pan); -PDCEX WINDOW *panel_window(const PANEL *pan); -PDCEX int replace_panel(PANEL *pan, WINDOW *win); -PDCEX int set_panel_userptr(PANEL *pan, const void *uptr); -PDCEX int show_panel(PANEL *pan); -PDCEX int top_panel(PANEL *pan); -PDCEX void update_panels(void); - -#if defined(__cplusplus) || defined(__cplusplus__) || defined(__CPLUSPLUS) -} -#endif - -#endif /* __PDCURSES_PANEL_H__ */ diff --git a/src/cc/rogue/x86_64-w64-msvc/deps/install/include/term.h b/src/cc/rogue/x86_64-w64-msvc/deps/install/include/term.h deleted file mode 100644 index 0ba0b7a7f..000000000 --- a/src/cc/rogue/x86_64-w64-msvc/deps/install/include/term.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Public Domain Curses */ - -/* PDCurses doesn't operate with terminfo, but we need these functions for - compatibility, to allow some things (notably, interface libraries for - other languages) to be compiled. Anyone who tries to actually _use_ - them will be disappointed, since they only return ERR. */ - -#ifndef __PDCURSES_TERM_H__ -#define __PDCURSES_TERM_H__ 1 - -#include - -#if defined(__cplusplus) || defined(__cplusplus__) || defined(__CPLUSPLUS) -extern "C" -{ -#endif - -typedef struct -{ - const char *_termname; -} TERMINAL; - -/* PDCEX is defined in curses.h */ -PDCEX TERMINAL *cur_term; - -int del_curterm(TERMINAL *); -int putp(const char *); -int restartterm(const char *, int, int *); -TERMINAL *set_curterm(TERMINAL *); -int setterm(const char *); -int setupterm(const char *, int, int *); -int tgetent(char *, const char *); -int tgetflag(const char *); -int tgetnum(const char *); -char *tgetstr(const char *, char **); -char *tgoto(const char *, int, int); -int tigetflag(const char *); -int tigetnum(const char *); -char *tigetstr(const char *); -char *tparm(const char *, long, long, long, long, long, - long, long, long, long); -int tputs(const char *, int, int (*)(int)); - -#if defined(__cplusplus) || defined(__cplusplus__) || defined(__CPLUSPLUS) -} -#endif - -#endif /* __PDCURSES_TERM_H__ */ diff --git a/src/cc/rogue/x86_64-w64-msvc/deps/install/include/unistd.h b/src/cc/rogue/x86_64-w64-msvc/deps/install/include/unistd.h deleted file mode 100644 index 5d2440309..000000000 --- a/src/cc/rogue/x86_64-w64-msvc/deps/install/include/unistd.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef _UNISTD_H -#define _UNISTD_H 1 - -/* This is intended as a drop-in replacement for unistd.h on Windows. - * Please add functionality as neeeded. - * https://stackoverflow.com/a/826027/1202830 - */ - -#include -#include -#include /* getopt at: https://gist.github.com/ashelly/7776712 */ -#include /* for getpid() and the exec..() family */ -#include /* for _getcwd() and _chdir() */ - -#define srandom srand -#define random rand - -/* Values for the second argument to access. - These may be OR'd together. */ -#define R_OK 4 /* Test for read permission. */ -#define W_OK 2 /* Test for write permission. */ -//#define X_OK 1 /* execute permission - unsupported in windows*/ -#define F_OK 0 /* Test for existence. */ - -#define access _access -#define dup2 _dup2 -#define execve _execve -#define ftruncate _chsize -#define unlink _unlink -#define fileno _fileno -#define getcwd _getcwd -#define chdir _chdir -#define isatty _isatty -#define lseek _lseek -/* read, write, and close are NOT being #defined here, because while there are file handle specific versions for Windows, they probably don't work for sockets. You need to look at your app and consider whether to call e.g. closesocket(). */ - -#ifdef _WIN64 -#define ssize_t __int64 -#else -#define ssize_t long -#endif - -#define STDIN_FILENO 0 -#define STDOUT_FILENO 1 -#define STDERR_FILENO 2 -/* should be in some equivalent to */ -typedef __int8 int8_t; -typedef __int16 int16_t; -typedef __int32 int32_t; -typedef __int64 int64_t; -typedef unsigned __int8 uint8_t; -typedef unsigned __int16 uint16_t; -typedef unsigned __int32 uint32_t; -typedef unsigned __int64 uint64_t; - -#endif /* unistd.h */ \ No newline at end of file diff --git a/src/cc/rogue/xcrypt.c b/src/cc/rogue/xcrypt.c deleted file mode 100644 index 6effe3b57..000000000 --- a/src/cc/rogue/xcrypt.c +++ /dev/null @@ -1,711 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html -/* - * FreeSec: libcrypt - * - * Copyright (C) 1994 David Burren - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name(s) of the author(s) nor the names of other contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * - * This is an original implementation of the DES and the crypt(3) interfaces - * by David Burren . - * - * An excellent reference on the underlying algorithm (and related - * algorithms) is: - * - * B. Schneier, Applied Cryptography: protocols, algorithms, - * and source code in C, John Wiley & Sons, 1994. - * - * Note that in that book's description of DES the lookups for the initial, - * pbox, and final permutations are inverted (this has been brought to the - * attention of the author). A list of errata for this book has been - * posted to the sci.crypt newsgroup by the author and is available for FTP. - * - * NOTE: - * This file has a static version of des_setkey() so that crypt.o exports - * only the crypt() interface. This is required to make binaries linked - * against crypt.o exportable or re-exportable from the USA. - * NOTE2: Math is freedom of speech. -- Duke Leto - */ - -#include -#include - -unsigned int md_endian = 0x01020304; - -unsigned int -xntohl(unsigned int x) -{ - if ( *((char *)&md_endian) == 0x01 ) - return(x); - else - return( ((x & 0x000000ffU) << 24) | - ((x & 0x0000ff00U) << 8) | - ((x & 0x00ff0000U) >> 8) | - ((x & 0xff000000U) >> 24) ); -} - -unsigned -xhtonl(unsigned int x) -{ - if ( *((char *)&md_endian) == 0x01 ) - return(x); - else - return( ((x & 0x000000ffU) << 24) | - ((x & 0x0000ff00U) << 8) | - ((x & 0x00ff0000U) >> 8) | - ((x & 0xff000000U) >> 24) ); -} - -#define _PASSWORD_EFMT1 '_' - -static unsigned char IP[64] = { - 58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4, - 62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8, - 57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3, - 61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7 -}; - -static unsigned char inv_key_perm[64]; -static unsigned char key_perm[56] = { - 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, - 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, - 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, - 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4 -}; - -static unsigned char key_shifts[16] = { - 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1 -}; - -static unsigned char inv_comp_perm[56]; -static unsigned char comp_perm[48] = { - 14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, - 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, - 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, - 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32 -}; - -/* - * No E box is used, as it's replaced by some ANDs, shifts, and ORs. - */ - -static unsigned char u_sbox[8][64]; -static unsigned char sbox[8][64] = { - { - 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7, - 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8, - 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0, - 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13 - }, - { - 15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10, - 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5, - 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15, - 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9 - }, - { - 10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8, - 13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1, - 13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7, - 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12 - }, - { - 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15, - 13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9, - 10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4, - 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14 - }, - { - 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9, - 14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6, - 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14, - 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3 - }, - { - 12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11, - 10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8, - 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6, - 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13 - }, - { - 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1, - 13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6, - 1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2, - 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12 - }, - { - 13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7, - 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2, - 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8, - 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11 - } -}; - -static unsigned char un_pbox[32]; -static unsigned char pbox[32] = { - 16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, 5, 18, 31, 10, - 2, 8, 24, 14, 32, 27, 3, 9, 19, 13, 30, 6, 22, 11, 4, 25 -}; - -static unsigned int bits32[32] = -{ - 0x80000000, 0x40000000, 0x20000000, 0x10000000, - 0x08000000, 0x04000000, 0x02000000, 0x01000000, - 0x00800000, 0x00400000, 0x00200000, 0x00100000, - 0x00080000, 0x00040000, 0x00020000, 0x00010000, - 0x00008000, 0x00004000, 0x00002000, 0x00001000, - 0x00000800, 0x00000400, 0x00000200, 0x00000100, - 0x00000080, 0x00000040, 0x00000020, 0x00000010, - 0x00000008, 0x00000004, 0x00000002, 0x00000001 -}; - -static unsigned char bits8[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; - -static unsigned int saltbits; -static int old_salt; -static unsigned int *bits28, *bits24; -static unsigned char init_perm[64], final_perm[64]; -static unsigned int en_keysl[16], en_keysr[16]; -static unsigned int de_keysl[16], de_keysr[16]; -static int des_initialised = 0; -static unsigned char m_sbox[4][4096]; -static unsigned int psbox[4][256]; -static unsigned int ip_maskl[8][256], ip_maskr[8][256]; -static unsigned int fp_maskl[8][256], fp_maskr[8][256]; -static unsigned int key_perm_maskl[8][128], key_perm_maskr[8][128]; -static unsigned int comp_maskl[8][128], comp_maskr[8][128]; -static unsigned int old_rawkey0, old_rawkey1; - -static unsigned char ascii64[] = - "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; -/* 0000000000111111111122222222223333333333444444444455555555556666 */ -/* 0123456789012345678901234567890123456789012345678901234567890123 */ - -static __inline int -ascii_to_bin(char ch) -{ - if (ch > 'z') - return(0); - if (ch >= 'a') - return(ch - 'a' + 38); - if (ch > 'Z') - return(0); - if (ch >= 'A') - return(ch - 'A' + 12); - if (ch > '9') - return(0); - if (ch >= '.') - return(ch - '.'); - return(0); -} - -static void -des_init() -{ - int i, j, b, k, inbit, obit; - unsigned int *p, *il, *ir, *fl, *fr; - - old_rawkey0 = old_rawkey1 = 0; - saltbits = 0; - old_salt = 0; - bits24 = (bits28 = bits32 + 4) + 4; - - /* - * Invert the S-boxes, reordering the input bits. - */ - for (i = 0; i < 8; i++) - for (j = 0; j < 64; j++) { - b = (j & 0x20) | ((j & 1) << 4) | ((j >> 1) & 0xf); - u_sbox[i][j] = sbox[i][b]; - } - - /* - * Convert the inverted S-boxes into 4 arrays of 8 bits. - * Each will handle 12 bits of the S-box input. - */ - for (b = 0; b < 4; b++) - for (i = 0; i < 64; i++) - for (j = 0; j < 64; j++) - m_sbox[b][(i << 6) | j] = - (u_sbox[(b << 1)][i] << 4) | - u_sbox[(b << 1) + 1][j]; - - /* - * Set up the initial & final permutations into a useful form, and - * initialise the inverted key permutation. - */ - for (i = 0; i < 64; i++) { - init_perm[final_perm[i] = IP[i] - 1] = (unsigned char) i; - inv_key_perm[i] = 255; - } - - /* - * Invert the key permutation and initialise the inverted key - * compression permutation. - */ - for (i = 0; i < 56; i++) { - inv_key_perm[key_perm[i] - 1] = (unsigned char) i; - inv_comp_perm[i] = 255; - } - - /* - * Invert the key compression permutation. - */ - for (i = 0; i < 48; i++) { - inv_comp_perm[comp_perm[i] - 1] = (unsigned char) i; - } - - /* - * Set up the OR-mask arrays for the initial and final permutations, - * and for the key initial and compression permutations. - */ - for (k = 0; k < 8; k++) { - for (i = 0; i < 256; i++) { - *(il = &ip_maskl[k][i]) = 0; - *(ir = &ip_maskr[k][i]) = 0; - *(fl = &fp_maskl[k][i]) = 0; - *(fr = &fp_maskr[k][i]) = 0; - for (j = 0; j < 8; j++) { - inbit = 8 * k + j; - if (i & bits8[j]) { - if ((obit = init_perm[inbit]) < 32) - *il |= bits32[obit]; - else - *ir |= bits32[obit-32]; - if ((obit = final_perm[inbit]) < 32) - *fl |= bits32[obit]; - else - *fr |= bits32[obit - 32]; - } - } - } - for (i = 0; i < 128; i++) { - *(il = &key_perm_maskl[k][i]) = 0; - *(ir = &key_perm_maskr[k][i]) = 0; - for (j = 0; j < 7; j++) { - inbit = 8 * k + j; - if (i & bits8[j + 1]) { - if ((obit = inv_key_perm[inbit]) == 255) - continue; - if (obit < 28) - *il |= bits28[obit]; - else - *ir |= bits28[obit - 28]; - } - } - *(il = &comp_maskl[k][i]) = 0; - *(ir = &comp_maskr[k][i]) = 0; - for (j = 0; j < 7; j++) { - inbit = 7 * k + j; - if (i & bits8[j + 1]) { - if ((obit=inv_comp_perm[inbit]) == 255) - continue; - if (obit < 24) - *il |= bits24[obit]; - else - *ir |= bits24[obit - 24]; - } - } - } - } - - /* - * Invert the P-box permutation, and convert into OR-masks for - * handling the output of the S-box arrays setup above. - */ - for (i = 0; i < 32; i++) - un_pbox[pbox[i] - 1] = (unsigned char) i; - - for (b = 0; b < 4; b++) - for (i = 0; i < 256; i++) { - *(p = &psbox[b][i]) = 0; - for (j = 0; j < 8; j++) { - if (i & bits8[j]) - *p |= bits32[un_pbox[8 * b + j]]; - } - } - - des_initialised = 1; -} - -static void -setup_salt(int salt) -{ - unsigned int obit, saltbit; - int i; - - if (salt == old_salt) - return; - old_salt = salt; - - saltbits = 0; - saltbit = 1; - obit = 0x800000; - for (i = 0; i < 24; i++) { - if (salt & saltbit) - saltbits |= obit; - saltbit <<= 1; - obit >>= 1; - } -} - -static int -des_setkey(const char *key) -{ - unsigned int k0, k1, rawkey0, rawkey1; - int shifts, round; - - if (!des_initialised) - des_init(); - - rawkey0 = xntohl(*(unsigned int *) key); - rawkey1 = xntohl(*(unsigned int *) (key + 4)); - - if ((rawkey0 | rawkey1) - && rawkey0 == old_rawkey0 - && rawkey1 == old_rawkey1) { - /* - * Already setup for this key. - * This optimisation fails on a zero key (which is weak and - * has bad parity anyway) in order to simplify the starting - * conditions. - */ - return(0); - } - old_rawkey0 = rawkey0; - old_rawkey1 = rawkey1; - - /* - * Do key permutation and split into two 28-bit subkeys. - */ - k0 = key_perm_maskl[0][rawkey0 >> 25] - | key_perm_maskl[1][(rawkey0 >> 17) & 0x7f] - | key_perm_maskl[2][(rawkey0 >> 9) & 0x7f] - | key_perm_maskl[3][(rawkey0 >> 1) & 0x7f] - | key_perm_maskl[4][rawkey1 >> 25] - | key_perm_maskl[5][(rawkey1 >> 17) & 0x7f] - | key_perm_maskl[6][(rawkey1 >> 9) & 0x7f] - | key_perm_maskl[7][(rawkey1 >> 1) & 0x7f]; - k1 = key_perm_maskr[0][rawkey0 >> 25] - | key_perm_maskr[1][(rawkey0 >> 17) & 0x7f] - | key_perm_maskr[2][(rawkey0 >> 9) & 0x7f] - | key_perm_maskr[3][(rawkey0 >> 1) & 0x7f] - | key_perm_maskr[4][rawkey1 >> 25] - | key_perm_maskr[5][(rawkey1 >> 17) & 0x7f] - | key_perm_maskr[6][(rawkey1 >> 9) & 0x7f] - | key_perm_maskr[7][(rawkey1 >> 1) & 0x7f]; - /* - * Rotate subkeys and do compression permutation. - */ - shifts = 0; - for (round = 0; round < 16; round++) { - unsigned int t0, t1; - - shifts += key_shifts[round]; - - t0 = (k0 << shifts) | (k0 >> (28 - shifts)); - t1 = (k1 << shifts) | (k1 >> (28 - shifts)); - - de_keysl[15 - round] = - en_keysl[round] = comp_maskl[0][(t0 >> 21) & 0x7f] - | comp_maskl[1][(t0 >> 14) & 0x7f] - | comp_maskl[2][(t0 >> 7) & 0x7f] - | comp_maskl[3][t0 & 0x7f] - | comp_maskl[4][(t1 >> 21) & 0x7f] - | comp_maskl[5][(t1 >> 14) & 0x7f] - | comp_maskl[6][(t1 >> 7) & 0x7f] - | comp_maskl[7][t1 & 0x7f]; - - de_keysr[15 - round] = - en_keysr[round] = comp_maskr[0][(t0 >> 21) & 0x7f] - | comp_maskr[1][(t0 >> 14) & 0x7f] - | comp_maskr[2][(t0 >> 7) & 0x7f] - | comp_maskr[3][t0 & 0x7f] - | comp_maskr[4][(t1 >> 21) & 0x7f] - | comp_maskr[5][(t1 >> 14) & 0x7f] - | comp_maskr[6][(t1 >> 7) & 0x7f] - | comp_maskr[7][t1 & 0x7f]; - } - return(0); -} - -static int -do_des(unsigned int l_in, unsigned int r_in, unsigned int *l_out, - unsigned int *r_out, int count) -{ - /* - * l_in, r_in, l_out, and r_out are in pseudo-"big-endian" format. - */ - unsigned int l, r, *kl, *kr, *kl1, *kr1; - unsigned int f = 0, r48l, r48r; - int round; - - if (count == 0) { - return(1); - } else if (count > 0) { - /* - * Encrypting - */ - kl1 = en_keysl; - kr1 = en_keysr; - } else { - /* - * Decrypting - */ - count = -count; - kl1 = de_keysl; - kr1 = de_keysr; - } - - /* - * Do initial permutation (IP). - */ - l = ip_maskl[0][l_in >> 24] - | ip_maskl[1][(l_in >> 16) & 0xff] - | ip_maskl[2][(l_in >> 8) & 0xff] - | ip_maskl[3][l_in & 0xff] - | ip_maskl[4][r_in >> 24] - | ip_maskl[5][(r_in >> 16) & 0xff] - | ip_maskl[6][(r_in >> 8) & 0xff] - | ip_maskl[7][r_in & 0xff]; - r = ip_maskr[0][l_in >> 24] - | ip_maskr[1][(l_in >> 16) & 0xff] - | ip_maskr[2][(l_in >> 8) & 0xff] - | ip_maskr[3][l_in & 0xff] - | ip_maskr[4][r_in >> 24] - | ip_maskr[5][(r_in >> 16) & 0xff] - | ip_maskr[6][(r_in >> 8) & 0xff] - | ip_maskr[7][r_in & 0xff]; - - while (count--) { - /* - * Do each round. - */ - kl = kl1; - kr = kr1; - round = 16; - while (round--) { - /* - * Expand R to 48 bits (simulate the E-box). - */ - r48l = ((r & 0x00000001) << 23) - | ((r & 0xf8000000) >> 9) - | ((r & 0x1f800000) >> 11) - | ((r & 0x01f80000) >> 13) - | ((r & 0x001f8000) >> 15); - - r48r = ((r & 0x0001f800) << 7) - | ((r & 0x00001f80) << 5) - | ((r & 0x000001f8) << 3) - | ((r & 0x0000001f) << 1) - | ((r & 0x80000000) >> 31); - /* - * Do salting for crypt() and friends, and - * XOR with the permuted key. - */ - f = (r48l ^ r48r) & saltbits; - r48l ^= f ^ *kl++; - r48r ^= f ^ *kr++; - /* - * Do sbox lookups (which shrink it back to 32 bits) - * and do the pbox permutation at the same time. - */ - f = psbox[0][m_sbox[0][r48l >> 12]] - | psbox[1][m_sbox[1][r48l & 0xfff]] - | psbox[2][m_sbox[2][r48r >> 12]] - | psbox[3][m_sbox[3][r48r & 0xfff]]; - /* - * Now that we've permuted things, complete f(). - */ - f ^= l; - l = r; - r = f; - } - r = l; - l = f; - } - /* - * Do final permutation (inverse of IP). - */ - *l_out = fp_maskl[0][l >> 24] - | fp_maskl[1][(l >> 16) & 0xff] - | fp_maskl[2][(l >> 8) & 0xff] - | fp_maskl[3][l & 0xff] - | fp_maskl[4][r >> 24] - | fp_maskl[5][(r >> 16) & 0xff] - | fp_maskl[6][(r >> 8) & 0xff] - | fp_maskl[7][r & 0xff]; - *r_out = fp_maskr[0][l >> 24] - | fp_maskr[1][(l >> 16) & 0xff] - | fp_maskr[2][(l >> 8) & 0xff] - | fp_maskr[3][l & 0xff] - | fp_maskr[4][r >> 24] - | fp_maskr[5][(r >> 16) & 0xff] - | fp_maskr[6][(r >> 8) & 0xff] - | fp_maskr[7][r & 0xff]; - return(0); -} - -static int -des_cipher(const char *in, char *out, int salt, int count) -{ - unsigned int l_out, r_out, rawl, rawr; - unsigned int x[2]; - int retval; - - if (!des_initialised) - des_init(); - - setup_salt(salt); - - memcpy(x, in, sizeof x); - rawl = xntohl(x[0]); - rawr = xntohl(x[1]); - retval = do_des(rawl, rawr, &l_out, &r_out, count); - - x[0] = xhtonl(l_out); - x[1] = xhtonl(r_out); - memcpy(out, x, sizeof x); - return(retval); -} - -char * -xcrypt( char *key, char *setting) -{ - int i; - unsigned int count, salt, l, r0, r1, keybuf[2]; - unsigned char *p, *q; - static unsigned char output[21]; - - if (!des_initialised) - des_init(); - - /* - * Copy the key, shifting each character up by one bit - * and padding with zeros. - */ - q = (unsigned char *) keybuf; - while ((q - (unsigned char *) keybuf) < sizeof(keybuf)) { - if ((*q++ = *key << 1)) - key++; - } - if (des_setkey((const char *) keybuf)) - return(NULL); - - if (*setting == _PASSWORD_EFMT1) { - /* - * "new"-style: - * setting - underscore, 4 bytes of count, 4 bytes of salt - * key - unlimited characters - */ - for (i = 1, count = 0; i < 5; i++) - count |= ascii_to_bin(setting[i]) << (i - 1) * 6; - - for (i = 5, salt = 0; i < 9; i++) - salt |= ascii_to_bin(setting[i]) << (i - 5) * 6; - - while (*key) { - /* - * Encrypt the key with itself. - */ - if (des_cipher((const char*)keybuf, (char*)keybuf, 0, 1)) - return(NULL); - /* - * And XOR with the next 8 characters of the key. - */ - q = (unsigned char *) keybuf; - while (((q - (unsigned char *) keybuf) < sizeof(keybuf)) && - *key) - *q++ ^= *key++ << 1; - - if (des_setkey((const char *) keybuf)) - return(NULL); - } - strncpy((char *)output, setting, 9); - - /* - * Double check that we weren't given a short setting. - * If we were, the above code will probably have created - * wierd values for count and salt, but we don't really care. - * Just make sure the output string doesn't have an extra - * NUL in it. - */ - output[9] = '\0'; - p = output + strlen((const char *)output); - } else { - /* - * "old"-style: - * setting - 2 bytes of salt - * key - up to 8 characters - */ - count = 25; - - salt = (ascii_to_bin(setting[1]) << 6) - | ascii_to_bin(setting[0]); - - output[0] = setting[0]; - /* - * If the encrypted password that the salt was extracted from - * is only 1 character long, the salt will be corrupted. We - * need to ensure that the output string doesn't have an extra - * NUL in it! - */ - output[1] = setting[1] ? setting[1] : output[0]; - - p = output + 2; - } - setup_salt(salt); - /* - * Do it. - */ - if (do_des(0, 0, &r0, &r1, count)) - return(NULL); - /* - * Now encode the result... - */ - l = (r0 >> 8); - *p++ = ascii64[(l >> 18) & 0x3f]; - *p++ = ascii64[(l >> 12) & 0x3f]; - *p++ = ascii64[(l >> 6) & 0x3f]; - *p++ = ascii64[l & 0x3f]; - - l = (r0 << 16) | ((r1 >> 16) & 0xffff); - *p++ = ascii64[(l >> 18) & 0x3f]; - *p++ = ascii64[(l >> 12) & 0x3f]; - *p++ = ascii64[(l >> 6) & 0x3f]; - *p++ = ascii64[l & 0x3f]; - - l = r1 << 2; - *p++ = ascii64[(l >> 12) & 0x3f]; - *p++ = ascii64[(l >> 6) & 0x3f]; - *p++ = ascii64[l & 0x3f]; - *p = 0; - - return((char *)output); -} diff --git a/src/cc/rogue_rpc.cpp b/src/cc/rogue_rpc.cpp deleted file mode 100644 index 88d18b620..000000000 --- a/src/cc/rogue_rpc.cpp +++ /dev/null @@ -1,1657 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html - -/****************************************************************************** - * Copyright © 2014-2019 The SuperNET Developers. * - * * - * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * - * the top-level directory of this distribution for the individual copyright * - * holder information and the developer policies on copyright and licensing. * - * * - * Unless otherwise agreed in a custom licensing agreement, no part of the * - * SuperNET software, including this file may be copied, modified, propagated * - * or distributed except according to the terms contained in the LICENSE file * - * * - * Removal or modification of this copyright notice is prohibited. * - * * - ******************************************************************************/ - -#include "cJSON.h" -#include "CCinclude.h" - -#define ROGUE_REGISTRATION 5 -#define ROGUE_REGISTRATIONSIZE (100 * 10000) -#define ROGUE_MAXPLAYERS 64 // need to send unused fees back to globalCC address to prevent leeching -#define ROGUE_MAXKEYSTROKESGAP 60 -#define ROGUE_MAXITERATIONS 777 -#define ROGUE_MAXCASHOUT (777 * COIN) - -#include "rogue/rogue_player.h" - -std::string Rogue_pname = ""; - -/* - Roguelander - using highlander competition between rogue players - - anybody can create a game by specifying maxplayers and buyin. Buyin of 0.00 ROGUE is for newbies and a good way to get experience. All players will start in the identical level, but each level after that will be unique to each player. - - There are two different modes that is based on the maxplayers. If maxplayers is one, then it is basically a practice/farming game where there are no time limits. Also, the gold -> ROGUE conversion rate is cut in half. You can start a single player game as soon as the newgame tx is confirmed. - - If maxplayers is more than one, then it goes into highlander mode. There can only be one winner. Additionally, multiplayer mode adds a timelimit of ROGUE_MAXKEYSTROKESGAP (60) blocks between keystrokes updates. That is approx. one hour and every level it does an automatic update, so as long as you are actively playing, it wont be a problem. The is ROGUE_REGISTRATION blocks waiting period before any of the players can start. The random seed for the game is based on the future blockhash so that way, nobody is able to start before the others. - - rogue is not an easy game to win, so it could be that the winner for a specific group is simply the last one standing. If you bailout of a game you cant win, but you can convert all the ingame gold you gathered at 0.001 ROGUE each. [In the event that there arent enough globally locked funds to payout the ROGUE, you will have to wait until there is. Since 10% of all economic activity creates more globally locked funds, it is just a matter of time before there will be enough funds to payout. Also, you can help speed this up by encouraging others to transact in ROGUE] - - Of course, the most direct way to win, is to get the amulet and come back out of the dungeon. The winner will get all of the buyins from all the players in addition to 0.01 ROGUE for every ingame gold. - - The above alone is enough to make the timeless classic solitaire game into a captivating multiplayer game, where real coins are at stake. However, there is an even better aspect to ROGUE! Whenever your player survives a game, even when you bailout, the entire player and his pack is preserved on the blockchain and becomes a nonfungible asset that you can trade for ROGUE. - - Additionally, instead of just being a collectors item with unique characteristics, the rogue playerdata can be used in any ROGUE game. Just specify the txid that created your character when you register and your character is restored. The better your characteristics your playerdata has, the more likely you are to win in multiplayer mode to win all the buyins. So there is definite economic value to a strong playerdata. - - You can farm characters in single player mode to earn ROGUE or to make competitive playerdata sets. You can purchase existing playerdata for collecting, or for using in battle. - - Here is how to play: - - ./hush-cli -ac_name=ROGUE cclib newgame 17 \"[3,10]\" -> this will create a hex transaction that when broadcast with sendrawtransaction will get a gametxid onto the blockchain. This specific command was for 3 players and a buyin of 10 ROGUE. Lets assume the gametxid is 4fd6f5cad0fac455e5989ca6eef111b00292845447075a802e9335879146ad5a, most all the other commands will need the gametxid. - - you can always find all the existing games with: - - ./hush-cli -ac_name=ROGUE cclib pending 17 - - and info about a specific game with: - - ./hush-cli -ac_name=ROGUE cclib gameinfo 17 \"[%224fd6f5cad0fac455e5989ca6eef111b00292845447075a802e9335879146ad5a%22]\" - - due to quirks of various parsing at the shell, rpc and internal level, the above convention is used where %22 is added where " should be. also all fields are separated by , without any space. - - When you do a gameinfo command it will show a "run" field and that will tell you if you are registered for the game or not. If not, the "run" field shows the register syntax you need to do, if you are registered, it will show the command line to start the rogue game that is playing the registered game. - -./hush-cli -ac_name=ROGUE cclib register 17 \"[%224fd6f5cad0fac455e5989ca6eef111b00292845447075a802e9335879146ad5a%22,%22playerdata_txid%22]\" - - If you want to cash in your ingame gold and preserve your character for another battle, do the bailout: - -./hush-cli -ac_name=ROGUE cclib bailout 17 \"[%224fd6f5cad0fac455e5989ca6eef111b00292845447075a802e9335879146ad5a%22]\" - - If you won your game before anybody else did or if you are the last one left who didnt bailout, you can claim the prize: - - ./hush-cli -ac_name=ROGUE cclib highlander 17 \"[%224fd6f5cad0fac455e5989ca6eef111b00292845447075a802e9335879146ad5a%22]\" - - The txid you get from the bailout or highlander transactions is the "playerdata_txid" that you can use in future games. - - - Transaction details - creategame - vout0 -> txfee highlander vout TCBOO creation - vout1 to vout.maxplayers+1 -> 1of2 registration ROGUE_REGISTRATIONSIZE batons - vout2+maxplayers to vout.2*maxplayers+1 -> 1of2 registration txfee batons for game completion - - register - vin0 -> ROGUE_REGISTRATIONSIZE 1of2 registration baton from creategame - vin1 -> optional nonfungible character vout @ - vin2 -> original creation TCBOO playerdata used - vin3+ -> buyin - vout0 -> keystrokes/completion baton - - keystrokes - vin0 -> txfee 1of2 baton from registration or previous keystrokes - opret -> user input chars - - bailout: must be within ROGUE_MAXKEYSTROKESGAP blocks of last keystrokes - vin0 -> keystrokes baton of completed game with Q - vout0 -> 1% ingame gold - - highlander - vin0 -> txfee highlander vout from creategame TCBOO creation - vin1 -> keystrokes baton of completed game, must be last to quit or first to win, only spent registration batons matter. If more than ROGUE_MAXKEYSTROKESGAP blocks since last keystrokes, it is forfeit - vins -> rest of unspent registration utxo so all newgame vouts are spent - vout0 -> nonfungible character with pack @ - vout1 -> 1% ingame gold and all the buyins - - - then to register you need to spend one of the vouts and also provide the buyin - once you register the gui mode is making automatic keystrokes tx with the raw chars in opreturn. - if during the registration, you provide a character as an input, your gameplay starts with that character instead of the default - - each keystrokes tx spends a baton vout that you had in your register tx - - so from the creategame tx, you can trace the maxplayers vouts to find all the registrations and all the keystrokes to get the keyboard events - - If you quit out of the game, then the in game gold that you earned can be converted to ROGUE coins, but unless you are the last one remaining, any character you input, is permanently spent - - so you can win a multiplayer by being the last player to quit or the first one to win. In either case, you would need to spend a special highlander vout in the original creategame tx. having this as an input allows to create a tx that has the character as the nonfungible token, collect all the buyin and of course the ingame gold - - once you have a non-fungible token, ownership of it can be transferred or traded or spent in a game - */ - -// todo: -// add some more conditions to multiplayer -// how does it work with playertxid instead of pubkey -// keystrokes retry - -//////////////////////// start of CClib interface -//./hushd -ac_name=ROGUE -ac_supply=1000000 -pubkey=03951a6f7967ad784453116bc55cd30c54f91ea8a5b1e9b04d6b29cfd6b395ba6c -addnode=5.9.102.210 -ac_cclib=rogue -ac_perc=10000000 -ac_reward=100000000 -ac_cc=60001 -ac_script=2ea22c80203d1579313abe7d8ea85f48c65ea66fc512c878c0d0e6f6d54036669de940febf8103120c008203000401cc > /dev/null & - -// cclib newgame 17 \"[3,10]\" -// cclib pending 17 -// ./c cclib gameinfo 17 \"[%226d3243c6e5ab383898b28a87e01f6c00b5bdd9687020f17f5caacc8a61febd19%22]\" -// cclib register 17 \"[%22aa81321d8889f881fe3d7c68c905b7447d9143832b0abbef6c2cab49dff8b0cc%22]\" -// ./rogue gui -> creates keystroke files -// ./c cclib register 17 \"[%226d3243c6e5ab383898b28a87e01f6c00b5bdd9687020f17f5caacc8a61febd19%22,%222475182f9d5169d8a3249d17640e4eccd90f4ee43ab04791129b0fa3f177b14a%22]\" -// ./c cclib bailout 17 \"[%226d3243c6e5ab383898b28a87e01f6c00b5bdd9687020f17f5caacc8a61febd19%22]\" -// ./hush-cli -ac_name=ROGUE cclib register 17 \"[%22a898f4ceef7647ba113b9f3c24ef045f5d134935a3b09bdd1a997b9d474f4c1b%22,%22f11d0cb4e2e4c21f029a1146f8e5926f11456885b7ab7d665096f5efedec8ea0%22]\" - - -CScript rogue_newgameopret(int64_t buyin,int32_t maxplayers) -{ - CScript opret; uint8_t evalcode = EVAL_ROGUE; - opret << OP_RETURN << E_MARSHAL(ss << evalcode << 'G' << buyin << maxplayers); - return(opret); -} - -CScript rogue_registeropret(uint256 gametxid,uint256 playertxid) -{ - CScript opret; uint8_t evalcode = EVAL_ROGUE; - //fprintf(stderr,"opret.(%s %s).R\n",gametxid.GetHex().c_str(),playertxid.GetHex().c_str()); - opret << OP_RETURN << E_MARSHAL(ss << evalcode << 'R' << gametxid << playertxid); - return(opret); -} - -CScript rogue_keystrokesopret(uint256 gametxid,uint256 batontxid,CPubKey pk,std::vectorkeystrokes) -{ - CScript opret; uint8_t evalcode = EVAL_ROGUE; - opret << OP_RETURN << E_MARSHAL(ss << evalcode << 'K' << gametxid << batontxid << pk << keystrokes); - return(opret); -} - -CScript rogue_highlanderopret(uint8_t funcid,uint256 gametxid,int32_t regslot,CPubKey pk,std::vectorplayerdata,std::string pname) -{ - CScript opret; uint8_t evalcode = EVAL_ROGUE; std::string symbol(SMART_CHAIN_SYMBOL); - opret << OP_RETURN << E_MARSHAL(ss << evalcode << funcid << gametxid << symbol << pname << regslot << pk << playerdata ); - return(opret); -} - -uint8_t rogue_highlanderopretdecode(uint256 &gametxid, uint256 &tokenid, int32_t ®slot, CPubKey &pk, std::vector &playerdata, std::string &symbol, std::string &pname,CScript scriptPubKey) -{ - std::string name, description; std::vector vorigPubkey; - std::vector> oprets, opretsDummy; - std::vector vopretNonfungible, vopret, vopretDummy,origpubkey; - uint8_t e, f,*script; std::vector voutPubkeys; - tokenid = zeroid; - GetOpReturnData(scriptPubKey, vopret); - script = (uint8_t *)vopret.data(); - if ( script[1] == 'c' && (f= DecodeTokenCreateOpRet(scriptPubKey,origpubkey,name,description, oprets)) == 'c' ) - { - GetOpretBlob(oprets, OPRETID_NONFUNGIBLEDATA, vopretNonfungible); - vopret = vopretNonfungible; - } - else if ( script[1] != 'H' && script[1] != 'Q' && (f= DecodeTokenOpRet(scriptPubKey, e, tokenid, voutPubkeys, opretsDummy)) != 0 ) - { - //fprintf(stderr,"decode opret %c tokenid.%s\n",script[1],tokenid.GetHex().c_str()); - GetNonfungibleData(tokenid, vopretNonfungible); //load nonfungible data from the 'tokenbase' tx - vopret = vopretNonfungible; - } - if ( vopret.size() > 2 && E_UNMARSHAL(vopret, ss >> e; ss >> f; ss >> gametxid; ss >> symbol; ss >> pname; ss >> regslot; ss >> pk; ss >> playerdata) != 0 && e == EVAL_ROGUE && (f == 'H' || f == 'Q') ) - { - return(f); - } - fprintf(stderr,"SKIP obsolete: e.%d f.%c game.%s regslot.%d psize.%d\n",e,f,gametxid.GetHex().c_str(),regslot,(int32_t)playerdata.size()); - return(0); -} - -uint8_t rogue_keystrokesopretdecode(uint256 &gametxid,uint256 &batontxid,CPubKey &pk,std::vector &keystrokes,CScript scriptPubKey) -{ - std::vector vopret; uint8_t e,f; - GetOpReturnData(scriptPubKey,vopret); - if ( vopret.size() > 2 && E_UNMARSHAL(vopret,ss >> e; ss >> f; ss >> gametxid; ss >> batontxid; ss >> pk; ss >> keystrokes) != 0 && e == EVAL_ROGUE && f == 'K' ) - { - return(f); - } - return(0); -} - -uint8_t rogue_registeropretdecode(uint256 &gametxid,uint256 &tokenid,uint256 &playertxid,CScript scriptPubKey) -{ - std::string name, description; std::vector vorigPubkey; - std::vector> oprets; - std::vector vopretNonfungible, vopret, vopretDummy,origpubkey; - uint8_t e, f,*script; std::vector voutPubkeys; - tokenid = zeroid; - GetOpReturnData(scriptPubKey, vopret); - script = (uint8_t *)vopret.data(); - if ( script[1] == 'c' && (f= DecodeTokenCreateOpRet(scriptPubKey,origpubkey,name,description,oprets)) == 'c' ) - { - GetOpretBlob(oprets, OPRETID_NONFUNGIBLEDATA, vopretNonfungible); - vopret = vopretNonfungible; - } - else if ( script[1] != 'R' && (f= DecodeTokenOpRet(scriptPubKey, e, tokenid, voutPubkeys, oprets)) != 0 ) - { - GetOpretBlob(oprets, OPRETID_ROGUEGAMEDATA, vopretDummy); // blob from non-creation tx opret - vopret = vopretDummy; - } - if ( vopret.size() > 2 && E_UNMARSHAL(vopret,ss >> e; ss >> f; ss >> gametxid; ss >> playertxid) != 0 && e == EVAL_ROGUE && f == 'R' ) - { - return(f); - } - //fprintf(stderr,"e.%d f.%c game.%s playertxid.%s\n",e,f,gametxid.GetHex().c_str(),playertxid.GetHex().c_str()); - return(0); -} - -uint8_t rogue_newgameopreturndecode(int64_t &buyin,int32_t &maxplayers,CScript scriptPubKey) -{ - std::vector vopret; uint8_t e,f; - GetOpReturnData(scriptPubKey,vopret); - if ( vopret.size() > 2 && E_UNMARSHAL(vopret,ss >> e; ss >> f; ss >> buyin; ss >> maxplayers) != 0 && e == EVAL_ROGUE && f == 'G' ) - { - return(f); - } - return(0); -} - -void rogue_univalue(UniValue &result,const char *method,int64_t maxplayers,int64_t buyin) -{ - if ( method != 0 ) - { - result.push_back(Pair("name","rogue")); - result.push_back(Pair("method",method)); - } - if ( maxplayers > 0 ) - result.push_back(Pair("maxplayers",maxplayers)); - if ( buyin >= 0 ) - { - result.push_back(Pair("buyin",ValueFromAmount(buyin))); - if ( buyin == 0 ) - result.push_back(Pair("type","newbie")); - else result.push_back(Pair("type","buyin")); - } -} - -int32_t rogue_iamregistered(int32_t maxplayers,uint256 gametxid,CTransaction tx,char *myrogueaddr) -{ - int32_t i,vout; uint256 spenttxid,hashBlock; CTransaction spenttx; char destaddr[64]; - for (i=0; i= 0 ) - { - if ( myGetTransaction(spenttxid,spenttx,hashBlock) != 0 && spenttx.vout.size() > 0 ) - { - Getscriptaddress(destaddr,spenttx.vout[0].scriptPubKey); - if ( strcmp(myrogueaddr,destaddr) == 0 ) - return(1); - //else fprintf(stderr,"myaddr.%s vs %s\n",myrogueaddr,destaddr); - } //else fprintf(stderr,"cant find spenttxid.%s\n",spenttxid.GetHex().c_str()); - } //else fprintf(stderr,"vout %d is unspent\n",vout); - } - return(0); -} - -int64_t rogue_buyins(uint256 gametxid,int32_t maxplayers) -{ - int32_t i,vout; uint256 spenttxid,hashBlock; CTransaction spenttx; int64_t buyins = 0; - for (i=0; i= 0 ) - { - if ( myGetTransaction(spenttxid,spenttx,hashBlock) != 0 && spenttx.vout.size() > 0 ) - { - if ( spenttx.vout[0].nValue > ROGUE_REGISTRATIONSIZE ) - buyins += (spenttx.vout[0].nValue - ROGUE_REGISTRATIONSIZE); - } //else fprintf(stderr,"cant find spenttxid.%s\n",spenttxid.GetHex().c_str()); - } //else fprintf(stderr,"vout %d is unspent\n",vout); - } - return(buyins); -} - -int32_t rogue_isvalidgame(struct CCcontract_info *cp,int32_t &gameheight,CTransaction &tx,int64_t &buyin,int32_t &maxplayers,uint256 txid,int32_t unspentv0) -{ - uint256 hashBlock; int32_t i,numvouts; char coinaddr[64]; CPubKey roguepk; uint64_t txfee = 10000; - buyin = maxplayers = 0; - if ( (txid == zeroid || myGetTransaction(txid,tx,hashBlock) != 0) && (numvouts= tx.vout.size()) > 1 ) - { - if ( txid != zeroid ) - gameheight = hush_blockheight(hashBlock); - else - { - txid = tx.GetHash(); - //fprintf(stderr,"set txid %s %llu\n",txid.GetHex().c_str(),(long long)CCgettxout(txid,0,1)); - } - if ( IsCClibvout(cp,tx,0,cp->unspendableCCaddr) == txfee && (unspentv0 == 0 || CCgettxout(txid,0,1,0) == txfee) ) - { - if ( rogue_newgameopreturndecode(buyin,maxplayers,tx.vout[numvouts-1].scriptPubKey) == 'G' ) - { - if ( maxplayers < 1 || maxplayers > ROGUE_MAXPLAYERS || buyin < 0 ) - return(-6); - if ( numvouts > 2*maxplayers+1 ) - { - for (i=0; i playerdata) -{ - struct rogue_player P; int32_t i; char packitemstr[512]; - if ( playerdata.size() > 0 ) - { - for (i=0; i>16,P.level,P.experience,P.dungeonlevel); - for (i=0; i playerdata,uint256 playertxid,uint256 tokenid,std::string symbol,std::string pname,uint256 gametxid) -{ - int32_t i,vout,spentvini,numvouts,n=0; uint256 txid,spenttxid,hashBlock; struct rogue_player P; char packitemstr[512],*datastr=0; UniValue obj(UniValue::VOBJ),a(UniValue::VARR); CTransaction tx; - memset(&P,0,sizeof(P)); - if ( playerdata.size() > 0 ) - { - datastr = (char *)malloc(playerdata.size()*2+1); - for (i=0; i= 0 ) - txid = spenttxid; - else if ( myIsutxo_spentinmempool(spenttxid,spentvini,txid,vout) == 0 || spenttxid == zeroid ) - { - fprintf(stderr,"mempool tracking error %s/v0\n",txid.ToString().c_str()); - break; - } - txid = spenttxid; - vout = 0; - if ( myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 1 ) - { - for (i=0; i ROGUE_MAXITERATIONS ) - break; - } - obj.push_back(Pair("gametxid",gametxid.GetHex())); - if ( txid != playertxid ) - obj.push_back(Pair("batontxid",txid.GetHex())); - obj.push_back(Pair("playertxid",playertxid.GetHex())); - if ( tokenid != zeroid ) - obj.push_back(Pair("tokenid",tokenid.GetHex())); - else obj.push_back(Pair("tokenid",playertxid.GetHex())); - if ( datastr != 0 ) - { - obj.push_back(Pair("data",datastr)); - free(datastr); - } - obj.push_back(Pair("pack",a)); - obj.push_back(Pair("packsize",(int64_t)P.packsize)); - obj.push_back(Pair("hitpoints",(int64_t)P.hitpoints)); - obj.push_back(Pair("strength",(int64_t)(P.strength&0xffff))); - obj.push_back(Pair("maxstrength",(int64_t)(P.strength>>16))); - obj.push_back(Pair("level",(int64_t)P.level)); - obj.push_back(Pair("experience",(int64_t)P.experience)); - obj.push_back(Pair("dungeonlevel",(int64_t)P.dungeonlevel)); - obj.push_back(Pair("chain",symbol)); - obj.push_back(Pair("pname",pname)); - return(obj); -} - -int32_t rogue_iterateplayer(uint256 ®istertxid,uint256 firsttxid,int32_t firstvout,uint256 lasttxid) // retrace playertxid vins to reach highlander <- this verifies player is valid and rogue_playerdataspend makes sure it can only be used once -{ - uint256 spenttxid,txid = firsttxid; int32_t spentvini,n,vout = firstvout; - registertxid = zeroid; - if ( vout < 0 ) - return(-1); - n = 0; - while ( (spentvini= myIsutxo_spent(spenttxid,txid,vout)) == 0 ) - { - txid = spenttxid; - vout = spentvini; - if ( registertxid == zeroid ) - registertxid = txid; - if ( ++n >= ROGUE_MAXITERATIONS ) - { - fprintf(stderr,"rogue_iterateplayer n.%d, seems something is wrong\n",n); - return(-2); - } - } - if ( txid == lasttxid ) - return(0); - else - { - fprintf(stderr,"firsttxid.%s/v%d -> %s != last.%s\n",firsttxid.ToString().c_str(),firstvout,txid.ToString().c_str(),lasttxid.ToString().c_str()); - return(-1); - } -} - -/* - playertxid is whoever owns the nonfungible satoshi and it might have been bought and sold many times. - highlander is the game winning tx with the player data and is the only place where the unique player data exists - origplayergame is the gametxid that ends up being won by the highlander and they are linked directly as the highlander tx spends gametxid.vout0 - */ - -int32_t rogue_playerdata(struct CCcontract_info *cp,uint256 &origplayergame,uint256 &tokenid,CPubKey &pk,std::vector &playerdata,std::string &symbol,std::string &pname,uint256 playertxid) -{ - uint256 origplayertxid,hashBlock,gametxid,registertxid; CTransaction gametx,playertx,highlandertx; std::vector vopret; uint8_t *script,e,f; int32_t i,regslot,gameheight,numvouts,maxplayers; int64_t buyin; - if ( myGetTransaction(playertxid,playertx,hashBlock) != 0 && (numvouts= playertx.vout.size()) > 0 ) - { - if ( (f= rogue_highlanderopretdecode(gametxid,tokenid,regslot,pk,playerdata,symbol,pname,playertx.vout[numvouts-1].scriptPubKey)) == 'H' || f == 'Q' ) - { - origplayergame = gametxid; - if ( tokenid != zeroid ) - { - playertxid = tokenid; - if ( myGetTransaction(playertxid,playertx,hashBlock) == 0 || (numvouts= playertx.vout.size()) <= 0 ) - { - fprintf(stderr,"couldnt get tokenid.%s\n",playertxid.GetHex().c_str()); - return(-2); - } - } - if ( rogue_isvalidgame(cp,gameheight,gametx,buyin,maxplayers,gametxid,0) == 0 ) - { - //fprintf(stderr,"playertxid.%s got vin.%s/v%d gametxid.%s iterate.%d\n",playertxid.ToString().c_str(),playertx.vin[1].prevout.hash.ToString().c_str(),(int32_t)playertx.vin[1].prevout.n-maxplayers,gametxid.ToString().c_str(),rogue_iterateplayer(registertxid,gametxid,playertx.vin[1].prevout.n-maxplayers,playertxid)); - if ( (tokenid != zeroid || playertx.vin[1].prevout.hash == gametxid) && rogue_iterateplayer(registertxid,gametxid,playertx.vin[1].prevout.n-maxplayers,playertxid) == 0 ) - { - // if registertxid has vin from pk, it can be used - return(0); - } else fprintf(stderr,"hash mismatch or illegal gametxid\n"); - } else fprintf(stderr,"invalid game %s\n",gametxid.GetHex().c_str()); - } //else fprintf(stderr,"invalid player funcid.%c\n",f); - } else fprintf(stderr,"couldnt get playertxid.%s\n",playertxid.GetHex().c_str()); - return(-1); -} - -int32_t rogue_playerdataspend(CMutableTransaction &mtx,uint256 playertxid,int32_t vout,uint256 origplayergame) -{ - int64_t txfee = 10000; CTransaction tx; uint256 hashBlock; - if ( CCgettxout(playertxid,vout,1,0) == 1 ) // not sure if this is enough validation - { - mtx.vin.push_back(CTxIn(playertxid,vout,CScript())); - return(0); - } - else - { - vout = 0; - if ( myGetTransaction(playertxid,tx,hashBlock) != 0 && tx.vout[vout].nValue == 1 && tx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 ) - { - if ( CCgettxout(playertxid,vout,1,0) == 1 ) // not sure if this is enough validation - { - mtx.vin.push_back(CTxIn(playertxid,vout,CScript())); - return(0); - } - } - return(-1); - } -} - -int32_t rogue_findbaton(struct CCcontract_info *cp,uint256 &playertxid,char **keystrokesp,int32_t &numkeys,int32_t ®slot,std::vector &playerdata,uint256 &batontxid,int32_t &batonvout,int64_t &batonvalue,int32_t &batonht,uint256 gametxid,CTransaction gametx,int32_t maxplayers,char *destaddr,int32_t &numplayers,std::string &symbol,std::string &pname) -{ - int32_t i,numvouts,spentvini,n,matches = 0; CPubKey pk; uint256 tid,active,spenttxid,tokenid,hashBlock,txid,origplayergame; CTransaction spenttx,matchtx,batontx; std::vector checkdata; CBlockIndex *pindex; char ccaddr[64],*keystrokes=0; - batonvalue = numkeys = numplayers = batonht = 0; - playertxid = batontxid = zeroid; - if ( keystrokesp != 0 ) - *keystrokesp = 0; - for (i=0; i= 0 ) - { - if ( myGetTransaction(spenttxid,spenttx,hashBlock) != 0 && spenttx.vout.size() > 0 ) - { - numplayers++; - Getscriptaddress(ccaddr,spenttx.vout[0].scriptPubKey); - if ( strcmp(destaddr,ccaddr) == 0 ) - { - matches++; - regslot = i; - matchtx = spenttx; - } //else fprintf(stderr,"%d+1 doesnt match %s vs %s\n",i,ccaddr,destaddr); - } //else fprintf(stderr,"%d+1 couldnt find spenttx.%s\n",i,spenttxid.GetHex().c_str()); - } //else fprintf(stderr,"%d+1 unspent\n",i); - } - if ( matches == 1 ) - { - numvouts = matchtx.vout.size(); - //fprintf(stderr,"matchtxid.%s matches.%d numvouts.%d\n",matchtx.GetHash().GetHex().c_str(),matches,numvouts); - if ( rogue_registeropretdecode(txid,tokenid,playertxid,matchtx.vout[numvouts-1].scriptPubKey) == 'R' )//&& txid == gametxid ) - { - //fprintf(stderr,"tokenid.%s txid.%s vs gametxid.%s player.%s\n",tokenid.GetHex().c_str(),txid.GetHex().c_str(),gametxid.GetHex().c_str(),playertxid.GetHex().c_str()); - if ( tokenid != zeroid ) - active = tokenid; - else active = playertxid; - if ( active == zeroid || rogue_playerdata(cp,origplayergame,tid,pk,playerdata,symbol,pname,active) == 0 ) - { - txid = matchtx.GetHash(); - //fprintf(stderr,"scan forward active.%s spenttxid.%s\n",active.GetHex().c_str(),txid.GetHex().c_str()); - n = 0; - while ( CCgettxout(txid,0,1,0) < 0 ) - { - spenttxid = zeroid; - spentvini = -1; - if ( (spentvini= myIsutxo_spent(spenttxid,txid,0)) >= 0 ) - txid = spenttxid; - else - { - if ( myIsutxo_spentinmempool(spenttxid,spentvini,txid,0) == 0 || spenttxid == zeroid ) - { - fprintf(stderr,"mempool tracking error %s/v0\n",txid.ToString().c_str()); - return(-2); - } - } - txid = spenttxid; - //fprintf(stderr,"n.%d next txid.%s/v%d\n",n,txid.GetHex().c_str(),spentvini); - if ( spentvini != 0 ) // game is over? - { - return(0); - } - if ( keystrokesp != 0 && myGetTransaction(spenttxid,spenttx,hashBlock) != 0 && spenttx.vout.size() >= 2 ) - { - uint256 g,b; CPubKey p; std::vector k; - if ( rogue_keystrokesopretdecode(g,b,p,k,spenttx.vout[spenttx.vout.size()-1].scriptPubKey) == 'K' ) - { - keystrokes = (char *)realloc(keystrokes,numkeys + (int32_t)k.size()); - for (i=0; i= ROGUE_MAXITERATIONS ) - { - fprintf(stderr,"rogue_findbaton n.%d, seems something is wrong\n",n); - return(-5); - } - } - //fprintf(stderr,"set baton %s\n",txid.GetHex().c_str()); - batontxid = txid; - batonvout = 0; // not vini - // how to detect timeout, bailedout, highlander - hashBlock = zeroid; - if ( myGetTransaction(batontxid,batontx,hashBlock) != 0 && batontx.vout.size() > 0 ) - { - if ( hashBlock == zeroid ) - batonht = hush_nextheight(); - else if ( (pindex= hush_blockindex(hashBlock)) == 0 ) - return(-4); - else batonht = pindex->GetHeight(); - batonvalue = batontx.vout[0].nValue; - //printf("batonht.%d keystrokes[%d]\n",batonht,numkeys); - return(0); - } else fprintf(stderr,"couldnt find baton\n"); - } else fprintf(stderr,"error with playerdata\n"); - } else fprintf(stderr,"findbaton opret error\n"); - } - return(-1); -} - -int32_t rogue_playersalive(int32_t &openslots,int32_t &numplayers,uint256 gametxid,int32_t maxplayers,int32_t gameht,CTransaction gametx) -{ - int32_t i,n,vout,spentvini,registration_open = 0,alive = 0; CTransaction tx; uint256 txid,spenttxid,hashBlock; CBlockIndex *pindex; uint64_t txfee = 10000; - numplayers = openslots = 0; - if ( hush_nextheight() <= gameht+ROGUE_MAXKEYSTROKESGAP ) - registration_open = 1; - for (i=0; i= 0 ) - txid = spenttxid; - else if ( myIsutxo_spentinmempool(spenttxid,spentvini,txid,vout) == 0 || spenttxid == zeroid ) - { - fprintf(stderr,"mempool tracking error %s/v0\n",txid.ToString().c_str()); - break; - } - txid = spenttxid; - vout = 0; - //fprintf(stderr,"n.%d next txid.%s/v%d\n",n,txid.GetHex().c_str(),spentvini); - if ( spentvini != 0 ) - break; - if ( n++ > ROGUE_MAXITERATIONS ) - break; - } - if ( txid != zeroid ) - { - if ( myGetTransaction(txid,tx,hashBlock) != 0 ) - { - if ( (pindex= hush_blockindex(hashBlock)) != 0 ) - { - if ( pindex->GetHeight() <= gameht+ROGUE_MAXKEYSTROKESGAP ) - alive++; - } - } - } - } - } - else if ( registration_open != 0 ) - openslots++; - } - //fprintf(stderr,"numalive.%d openslots.%d\n",alive,openslots); - return(alive); -} - -uint64_t rogue_gamefields(UniValue &obj,int64_t maxplayers,int64_t buyin,uint256 gametxid,char *myrogueaddr) -{ - CBlockIndex *pindex; int32_t ht,openslots,delay,numplayers; uint256 hashBlock; uint64_t seed=0; char cmd[512]; CTransaction tx; - if ( myGetTransaction(gametxid,tx,hashBlock) != 0 && (pindex= hush_blockindex(hashBlock)) != 0 ) - { - ht = pindex->GetHeight(); - delay = ROGUE_REGISTRATION * (maxplayers > 1); - obj.push_back(Pair("height",ht)); - obj.push_back(Pair("start",ht+delay)); - if ( hush_nextheight() > ht+delay ) - { - if ( (pindex= hush_chainactive(ht+delay)) != 0 ) - { - hashBlock = pindex->GetBlockHash(); - obj.push_back(Pair("starthash",hashBlock.ToString())); - memcpy(&seed,&hashBlock,sizeof(seed)); - seed &= (1LL << 62) - 1; - obj.push_back(Pair("seed",(int64_t)seed)); - if ( rogue_iamregistered(maxplayers,gametxid,tx,myrogueaddr) > 0 ) - sprintf(cmd,"cc/rogue/rogue %llu %s",(long long)seed,gametxid.ToString().c_str()); - else sprintf(cmd,"./hush-cli -ac_name=%s cclib register %d \"[%%22%s%%22]\"",SMART_CHAIN_SYMBOL,EVAL_ROGUE,gametxid.ToString().c_str()); - obj.push_back(Pair("run",cmd)); - } - } - obj.push_back(Pair("alive",rogue_playersalive(openslots,numplayers,gametxid,maxplayers,ht,tx))); - obj.push_back(Pair("openslots",openslots)); - obj.push_back(Pair("numplayers",numplayers)); - obj.push_back(Pair("buyins",ValueFromAmount(rogue_buyins(gametxid,maxplayers)))); - } - obj.push_back(Pair("maxplayers",maxplayers)); - obj.push_back(Pair("buyin",ValueFromAmount(buyin))); - return(seed); -} - -void rogue_gameplayerinfo(struct CCcontract_info *cp,UniValue &obj,uint256 gametxid,CTransaction gametx,int32_t vout,int32_t maxplayers,char *myrogueaddr) -{ - // identify if bailout or quit or timed out - uint256 batontxid,spenttxid,gtxid,ptxid,tokenid,hashBlock,playertxid; CTransaction spenttx,batontx; int32_t numplayers,regslot,numkeys,batonvout,batonht,retval; int64_t batonvalue; std::vector playerdata; char destaddr[64]; std::string symbol,pname; - destaddr[0] = 0; - if ( myIsutxo_spent(spenttxid,gametxid,vout) >= 0 ) - { - if ( myGetTransaction(spenttxid,spenttx,hashBlock) != 0 && spenttx.vout.size() > 0 ) - Getscriptaddress(destaddr,spenttx.vout[0].scriptPubKey); - } - obj.push_back(Pair("slot",(int64_t)vout-1)); - if ( (retval= rogue_findbaton(cp,playertxid,0,numkeys,regslot,playerdata,batontxid,batonvout,batonvalue,batonht,gametxid,gametx,maxplayers,destaddr,numplayers,symbol,pname)) == 0 ) - { - if ( CCgettxout(gametxid,maxplayers+vout,1,0) == 10000 ) - { - if ( myGetTransaction(batontxid,batontx,hashBlock) != 0 && batontx.vout.size() > 1 ) - { - if ( rogue_registeropretdecode(gtxid,tokenid,ptxid,batontx.vout[batontx.vout.size()-1].scriptPubKey) == 'R' && ptxid == playertxid && gtxid == gametxid ) - obj.push_back(Pair("status","registered")); - else obj.push_back(Pair("status","alive")); - } else obj.push_back(Pair("status","error")); - } else obj.push_back(Pair("status","finished")); - obj.push_back(Pair("baton",batontxid.ToString())); - obj.push_back(Pair("tokenid",tokenid.ToString())); - obj.push_back(Pair("batonaddr",destaddr)); - obj.push_back(Pair("ismine",strcmp(myrogueaddr,destaddr)==0)); - obj.push_back(Pair("batonvout",(int64_t)batonvout)); - obj.push_back(Pair("batonvalue",ValueFromAmount(batonvalue))); - obj.push_back(Pair("batonht",(int64_t)batonht)); - if ( playerdata.size() > 0 ) - obj.push_back(Pair("player",rogue_playerobj(playerdata,playertxid,tokenid,symbol,pname,gametxid))); - } else fprintf(stderr,"findbaton err.%d\n",retval); -} - -int64_t rogue_registrationbaton(CMutableTransaction &mtx,uint256 gametxid,CTransaction gametx,int32_t maxplayers) -{ - int32_t vout,j,r; int64_t nValue; - if ( gametx.vout.size() > maxplayers+1 ) - { - r = rand() % maxplayers; - for (j=0; j 0 ) - { - result.push_back(Pair("hex",rawtx)); - if ( DecodeHexTx(tx,rawtx) != 0 ) - { - if ( broadcastflag != 0 && myAddtomempool(tx) != 0 ) - RelayTransaction(tx); - result.push_back(Pair("txid",tx.GetHash().ToString())); - result.push_back(Pair("result","success")); - } else result.push_back(Pair("error","decode hex")); - } else result.push_back(Pair("error","couldnt finalize CCtx")); - return(result); -} - -UniValue rogue_newgame(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) -{ - CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight()); - UniValue result(UniValue::VOBJ); std::string rawtx; CPubKey roguepk,mypk; char *jsonstr; uint64_t inputsum,change,required,buyin=0; int32_t i,n,maxplayers = 1; - if ( txfee == 0 ) - txfee = 10000; - if ( params != 0 && (n= cJSON_GetArraySize(params)) > 0 ) - { - if ( n > 0 ) - { - maxplayers = juint(jitem(params,0),0); - if ( n > 1 ) - buyin = jdouble(jitem(params,1),0) * COIN + 0.0000000049; - } - } - if ( maxplayers < 1 || maxplayers > ROGUE_MAXPLAYERS ) - return(cclib_error(result,"illegal maxplayers")); - mypk = pubkey2pk(Mypubkey()); - roguepk = GetUnspendable(cp,0); - rogue_univalue(result,"newgame",maxplayers,buyin); - required = (3*txfee + maxplayers*(ROGUE_REGISTRATIONSIZE+txfee)); - if ( (inputsum= AddCClibInputs(cp,mtx,roguepk,required,16,cp->unspendableCCaddr,1)) >= required ) - { - mtx.vout.push_back(MakeCC1vout(cp->evalcode,txfee,roguepk)); // for highlander TCBOO creation - for (i=0; ievalcode,ROGUE_REGISTRATIONSIZE,roguepk,roguepk)); - for (i=0; ievalcode,txfee,roguepk,roguepk)); - if ( (change= inputsum - required) >= txfee ) - mtx.vout.push_back(MakeCC1vout(cp->evalcode,change,roguepk)); - rawtx = FinalizeCCTx(0,cp,mtx,mypk,txfee,rogue_newgameopret(buyin,maxplayers)); - return(rogue_rawtxresult(result,rawtx,1)); - } - else return(cclib_error(result,"illegal maxplayers")); - return(result); -} - -UniValue rogue_playerinfo(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) -{ - UniValue result(UniValue::VOBJ); std::vector playerdata; uint256 playertxid,tokenid,origplayergame;int32_t n; CPubKey pk; bits256 t; std::string symbol,pname; - result.push_back(Pair("result","success")); - rogue_univalue(result,"playerinfo",-1,-1); - if ( params != 0 && (n= cJSON_GetArraySize(params)) > 0 ) - { - if ( n > 0 ) - { - playertxid = juint256(jitem(params,0)); - if ( rogue_playerdata(cp,origplayergame,tokenid,pk,playerdata,symbol,pname,playertxid) < 0 ) - return(cclib_error(result,"invalid playerdata")); - result.push_back(Pair("player",rogue_playerobj(playerdata,playertxid,tokenid,symbol,pname,origplayergame))); - } else return(cclib_error(result,"no playertxid")); - return(result); - } else return(cclib_error(result,"couldnt reparse params")); -} - -UniValue rogue_register(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) -{ - // vin0 -> ROGUE_REGISTRATIONSIZE 1of2 registration baton from creategame - // vin1 -> optional nonfungible character vout @ - // vin2 -> original creation TCBOO playerdata used - // vin3+ -> buyin - // vout0 -> keystrokes/completion baton - CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight()); - UniValue result(UniValue::VOBJ); char destaddr[64],coinaddr[64]; uint256 tokenid,gametxid,origplayergame,playertxid,hashBlock; int32_t err,maxplayers,gameheight,n,numvouts,vout=1; int64_t inputsum,buyin,CCchange=0; CPubKey pk,mypk,roguepk,burnpk; CTransaction tx,playertx; std::vector playerdata; std::string rawtx,symbol,pname; bits256 t; - - if ( txfee == 0 ) - txfee = 10000; - mypk = pubkey2pk(Mypubkey()); - burnpk = pubkey2pk(ParseHex(CC_BURNPUBKEY)); - roguepk = GetUnspendable(cp,0); - rogue_univalue(result,"register",-1,-1); - playertxid = tokenid = zeroid; - if ( params != 0 && (n= cJSON_GetArraySize(params)) > 0 ) - { - if ( n > 0 ) - { - gametxid = juint256(jitem(params,0)); - if ( (err= rogue_isvalidgame(cp,gameheight,tx,buyin,maxplayers,gametxid,1)) == 0 ) - { - if ( n > 1 ) - { - playertxid = juint256(jitem(params,1)); - if ( rogue_playerdata(cp,origplayergame,tokenid,pk,playerdata,symbol,pname,playertxid) < 0 ) - return(cclib_error(result,"couldnt extract valid playerdata")); - if ( tokenid != zeroid ) // if it is tokentransfer this will be 0 - vout = 1; - } - if ( hush_nextheight() > gameheight + ROGUE_MAXKEYSTROKESGAP ) - return(cclib_error(result,"didnt register in time, ROGUE_MAXKEYSTROKESGAP")); - rogue_univalue(result,0,maxplayers,buyin); - GetCCaddress1of2(cp,coinaddr,roguepk,mypk); - if ( rogue_iamregistered(maxplayers,gametxid,tx,coinaddr) > 0 ) - return(cclib_error(result,"already registered")); - if ( (inputsum= rogue_registrationbaton(mtx,gametxid,tx,maxplayers)) != ROGUE_REGISTRATIONSIZE ) - return(cclib_error(result,"couldnt find available registration baton")); - else if ( playertxid != zeroid && rogue_playerdataspend(mtx,playertxid,vout,origplayergame) < 0 ) - return(cclib_error(result,"couldnt find playerdata to spend")); - else if ( buyin > 0 && AddNormalinputs(mtx,mypk,buyin,64) < buyin ) - return(cclib_error(result,"couldnt find enough normal funds for buyin")); - if ( tokenid != zeroid ) - { - mtx.vin.push_back(CTxIn(tokenid,0)); // spending cc marker as token is burned - char unspendableTokenAddr[64]; uint8_t tokenpriv[32]; struct CCcontract_info *cpTokens, tokensC; - cpTokens = CCinit(&tokensC, EVAL_TOKENS); - CPubKey unspPk = GetUnspendable(cpTokens, tokenpriv); - GetCCaddress(cpTokens, unspendableTokenAddr, unspPk); - CCaddr2set(cp, EVAL_TOKENS, unspPk, tokenpriv, unspendableTokenAddr); - } - mtx.vout.push_back(MakeCC1of2vout(cp->evalcode,buyin + inputsum - txfee,roguepk,mypk)); - GetCCaddress1of2(cp,destaddr,roguepk,roguepk); - CCaddr1of2set(cp,roguepk,roguepk,cp->CCpriv,destaddr); - mtx.vout.push_back(MakeTokensCC1vout(cp->evalcode, 1, burnpk)); - - uint8_t e, funcid; uint256 tid; std::vector voutPubkeys, voutPubkeysEmpty; int32_t didtx = 0; - CScript opretRegister = rogue_registeropret(gametxid, playertxid); - if ( playertxid != zeroid ) - { - voutPubkeysEmpty.push_back(burnpk); - if ( myGetTransaction(playertxid,playertx,hashBlock) != 0 ) - { - std::vector> oprets; - if ( (funcid= DecodeTokenOpRet(playertx.vout.back().scriptPubKey, e, tid, voutPubkeys, oprets)) != 0) - { // if token in the opret - didtx = 1; - if ( funcid == 'c' ) - tid = tokenid == zeroid ? playertxid : tokenid; - vscript_t vopretRegister; - GetOpReturnData(opretRegister, vopretRegister); - rawtx = FinalizeCCTx(0, cp, mtx, mypk, txfee, - EncodeTokenOpRet(tid, voutPubkeysEmpty /*=never spent*/, std::make_pair(OPRETID_ROGUEGAMEDATA, vopretRegister))); - } - } - } - if ( didtx == 0 ) - rawtx = FinalizeCCTx(0, cp, mtx, mypk, txfee, opretRegister); - - return(rogue_rawtxresult(result,rawtx,1)); - } else return(cclib_error(result,"invalid gametxid")); - } else return(cclib_error(result,"no gametxid")); - } else return(cclib_error(result,"couldnt reparse params")); -} - -UniValue rogue_keystrokes(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) -{ - // vin0 -> baton from registration or previous keystrokes - // vout0 -> new baton - // opret -> user input chars - // being killed should auto broadcast (possible to be suppressed?) - // respawn to be prevented by including timestamps - int32_t nextheight = hush_nextheight(); - CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(),nextheight); - UniValue result(UniValue::VOBJ); CPubKey roguepk,mypk; uint256 gametxid,playertxid,batontxid; int64_t batonvalue,buyin; std::vector keystrokes,playerdata; int32_t numplayers,regslot,numkeys,batonht,batonvout,n,elapsed,gameheight,maxplayers; CTransaction tx; CTxOut txout; char *keystrokestr,destaddr[64]; std::string rawtx,symbol,pname; bits256 t; uint8_t mypriv[32]; - // if ( txfee == 0 ) - txfee = 1000; // smaller than normal on purpose - rogue_univalue(result,"keystrokes",-1,-1); - if ( params != 0 && (n= cJSON_GetArraySize(params)) == 2 && (keystrokestr= jstr(jitem(params,1),0)) != 0 ) - { - gametxid = juint256(jitem(params,0)); - result.push_back(Pair("gametxid",gametxid.GetHex())); - result.push_back(Pair("keystrokes",keystrokestr)); - keystrokes = ParseHex(keystrokestr); - mypk = pubkey2pk(Mypubkey()); - roguepk = GetUnspendable(cp,0); - GetCCaddress1of2(cp,destaddr,roguepk,mypk); - if ( rogue_isvalidgame(cp,gameheight,tx,buyin,maxplayers,gametxid,1) == 0 ) - { - if ( rogue_findbaton(cp,playertxid,0,numkeys,regslot,playerdata,batontxid,batonvout,batonvalue,batonht,gametxid,tx,maxplayers,destaddr,numplayers,symbol,pname) == 0 ) - { - result.push_back(Pair("batontxid",batontxid.GetHex())); - result.push_back(Pair("playertxid",playertxid.GetHex())); - if ( maxplayers == 1 || nextheight <= batonht+ROGUE_MAXKEYSTROKESGAP ) - { - mtx.vin.push_back(CTxIn(batontxid,batonvout,CScript())); //this validates user if pk - mtx.vout.push_back(MakeCC1of2vout(cp->evalcode,batonvalue-txfee,roguepk,mypk)); - Myprivkey(mypriv); - CCaddr1of2set(cp,roguepk,mypk,mypriv,destaddr); - rawtx = FinalizeCCTx(0,cp,mtx,mypk,txfee,rogue_keystrokesopret(gametxid,batontxid,mypk,keystrokes)); - //fprintf(stderr,"KEYSTROKES.(%s)\n",rawtx.c_str()); - memset(mypriv,0,32); - return(rogue_rawtxresult(result,rawtx,1)); - } else return(cclib_error(result,"keystrokes tx was too late")); - } else return(cclib_error(result,"couldnt find batontxid")); - } else return(cclib_error(result,"invalid gametxid")); - } else return(cclib_error(result,"couldnt reparse params")); -} - -char *rogue_extractgame(int32_t makefiles,char *str,int32_t *numkeysp,std::vector &newdata,uint64_t &seed,uint256 &playertxid,struct CCcontract_info *cp,uint256 gametxid,char *rogueaddr) -{ - CPubKey roguepk; int32_t i,num,retval,maxplayers,gameheight,batonht,batonvout,numplayers,regslot,numkeys,err; std::string symbol,pname; CTransaction gametx; int64_t buyin,batonvalue; char fname[64],*keystrokes = 0; std::vector playerdata; uint256 batontxid; FILE *fp; uint8_t newplayer[10000]; struct rogue_player P,endP; - roguepk = GetUnspendable(cp,0); - *numkeysp = 0; - seed = 0; - num = numkeys = 0; - playertxid = zeroid; - str[0] = 0; - if ( (err= rogue_isvalidgame(cp,gameheight,gametx,buyin,maxplayers,gametxid,0)) == 0 ) - { - if ( (retval= rogue_findbaton(cp,playertxid,&keystrokes,numkeys,regslot,playerdata,batontxid,batonvout,batonvalue,batonht,gametxid,gametx,maxplayers,rogueaddr,numplayers,symbol,pname)) == 0 ) - { - UniValue obj; - seed = rogue_gamefields(obj,maxplayers,buyin,gametxid,rogueaddr); -//fprintf(stderr,"(%s) found baton %s numkeys.%d seed.%llu playerdata.%d playertxid.%s\n",pname.size()!=0?pname.c_str():Rogue_pname.c_str(),batontxid.ToString().c_str(),numkeys,(long long)seed,(int32_t)playerdata.size(),playertxid.GetHex().c_str()); - memset(&P,0,sizeof(P)); - if ( playerdata.size() > 0 ) - { - for (i=0; i no playerdata\n"); - newdata.resize(0); - *numkeysp = numkeys; - return(keystrokes); - /* P.gold = (P.gold * 8) / 10; - if ( keystrokes != 0 ) - { - free(keystrokes); - keystrokes = 0; - *numkeysp = 0; - return(keystrokes); - }*/ - } - else - { - sprintf(str,"$$$gold.%d hp.%d strength.%d/%d level.%d exp.%d dl.%d",endP.gold,endP.hitpoints,endP.strength&0xffff,endP.strength>>16,endP.level,endP.experience,endP.dungeonlevel); - //fprintf(stderr,"%s\n",str); - *numkeysp = numkeys; - return(keystrokes); - } - } else num = 0; - } - else - { - fprintf(stderr,"extractgame: couldnt find baton keystrokes.%p retval.%d\n",keystrokes,retval); - if ( keystrokes != 0 ) - free(keystrokes), keystrokes = 0; - } - } else fprintf(stderr,"extractgame: invalid game\n"); - //fprintf(stderr,"extract %s\n",gametxid.GetHex().c_str()); - return(0); -} - -UniValue rogue_extract(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) -{ - UniValue result(UniValue::VOBJ); CPubKey pk,roguepk; int32_t i,n,numkeys,flag = 0; uint64_t seed; char str[512],rogueaddr[64],*pubstr,*hexstr,*keystrokes = 0; std::vector newdata; uint256 gametxid,playertxid; FILE *fp; uint8_t pub33[33]; - pk = pubkey2pk(Mypubkey()); - roguepk = GetUnspendable(cp,0); - result.push_back(Pair("name","rogue")); - result.push_back(Pair("method","extract")); - rogueaddr[0] = 0; - if ( params != 0 && (n= cJSON_GetArraySize(params)) > 0 ) - { - if ( n > 0 ) - { - gametxid = juint256(jitem(params,0)); - result.push_back(Pair("gametxid",gametxid.GetHex())); - if ( n == 2 ) - { - if ( (pubstr= jstr(jitem(params,1),0)) != 0 ) - { - if (strlen(pubstr) == 66 ) - { - decode_hex(pub33,33,pubstr); - pk = buf2pk(pub33); - } - else if ( strlen(pubstr) < 36 ) - strcpy(rogueaddr,pubstr); - } - //fprintf(stderr,"gametxid.%s %s\n",gametxid.GetHex().c_str(),pubstr); - } - if ( rogueaddr[0] == 0 ) - GetCCaddress1of2(cp,rogueaddr,roguepk,pk); - result.push_back(Pair("rogueaddr",rogueaddr)); - str[0] = 0; - if ( (keystrokes= rogue_extractgame(1,str,&numkeys,newdata,seed,playertxid,cp,gametxid,rogueaddr)) != 0 ) - { - result.push_back(Pair("status","success")); - flag = 1; - hexstr = (char *)malloc(numkeys*2 + 1); - for (i=0; iamulet != 0 ) - mult *= 5; - dungeonlevel = P->dungeonlevel; - if ( P->amulet != 0 && dungeonlevel < 26 ) - dungeonlevel = 26; - if ( dungeonlevel > 42 ) - dungeonlevel = 42; - cashout = (uint64_t)P->gold * P->gold * mult * dungeonlevel; - return(cashout); -} - -int32_t rogue_playerdata_validate(int64_t *cashoutp,uint256 &playertxid,struct CCcontract_info *cp,std::vector playerdata,uint256 gametxid,CPubKey pk) -{ - static uint32_t good,bad; static uint256 prevgame; - char str[512],*keystrokes,rogueaddr[64],str2[67],fname[64]; int32_t i,dungeonlevel,numkeys; std::vector newdata; uint64_t seed,mult = 10; CPubKey roguepk; struct rogue_player P; - *cashoutp = 0; - roguepk = GetUnspendable(cp,0); - GetCCaddress1of2(cp,rogueaddr,roguepk,pk); - if ( (keystrokes= rogue_extractgame(0,str,&numkeys,newdata,seed,playertxid,cp,gametxid,rogueaddr)) != 0 ) - { - free(keystrokes); - sprintf(fname,"rogue.%llu.pack",(long long)seed); - remove(fname); - for (i=0; i no playerdata, good.%d bad.%d\n",good,bad); - } - *cashoutp = 0; - return(0); - } - } - if ( gametxid != prevgame ) - { - prevgame = gametxid; - bad++; - disp_playerdata(newdata); - disp_playerdata(playerdata); - fprintf(stderr,"%s playerdata: gold.%d hp.%d strength.%d/%d level.%d exp.%d dl.%d\n",gametxid.GetHex().c_str(),P.gold,P.hitpoints,P.strength&0xffff,P.strength>>16,P.level,P.experience,P.dungeonlevel); - fprintf(stderr,"newdata[%d] != playerdata[%d], numkeys.%d %s pub.%s playertxid.%s good.%d bad.%d\n",(int32_t)newdata.size(),(int32_t)playerdata.size(),numkeys,rogueaddr,pubkey33_str(str2,(uint8_t *)&pk),playertxid.GetHex().c_str(),good,bad); - } - } - sprintf(fname,"rogue.%llu.pack",(long long)seed); - remove(fname); - //fprintf(stderr,"no keys rogue_extractgame %s\n",gametxid.GetHex().c_str()); - return(-1); -} - -UniValue rogue_finishgame(uint64_t txfee,struct CCcontract_info *cp,cJSON *params,char *method) -{ - //vin0 -> highlander vout from creategame TCBOO - //vin1 -> keystrokes baton of completed game, must be last to quit or first to win, only spent registration batons matter. If more than 60 blocks since last keystrokes, it is forfeit - //vins2+ -> rest of unspent registration utxo so all newgame vouts are spent - //vout0 -> nonfungible character with pack @ - //vout1 -> 1% ingame gold and all the buyins - - // detect if last to bailout - // vin0 -> kestrokes baton of completed game with Q - // vout0 -> playerdata marker - // vout0 -> 1% ingame gold - // get any playerdata, get all keystrokes, replay game and compare final state - CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight()); - UniValue result(UniValue::VOBJ); std::string rawtx,symbol,pname; CTransaction gametx; uint64_t seed,mult; int64_t buyin,batonvalue,inputsum,cashout=0,CCchange=0; int32_t i,err,gameheight,tmp,numplayers,regslot,n,num,dungeonlevel,numkeys,maxplayers,batonht,batonvout; char myrogueaddr[64],*keystrokes = 0; std::vector playerdata,newdata,nodata; uint256 batontxid,playertxid,gametxid; CPubKey mypk,roguepk; uint8_t player[10000],mypriv[32],funcid; - struct CCcontract_info *cpTokens, tokensC; - - if ( txfee == 0 ) - txfee = 10000; - mypk = pubkey2pk(Mypubkey()); - roguepk = GetUnspendable(cp,0); - GetCCaddress1of2(cp,myrogueaddr,roguepk,mypk); - result.push_back(Pair("name","rogue")); - result.push_back(Pair("method",method)); - result.push_back(Pair("myrogueaddr",myrogueaddr)); - mult = 10; //100000; - if ( strcmp(method,"bailout") == 0 ) - funcid = 'Q'; - else funcid = 'H'; - if ( params != 0 && (n= cJSON_GetArraySize(params)) > 0 ) - { - if ( n > 0 ) - { - gametxid = juint256(jitem(params,0)); - result.push_back(Pair("gametxid",gametxid.GetHex())); - if ( (err= rogue_isvalidgame(cp,gameheight,gametx,buyin,maxplayers,gametxid,1)) == 0 ) - { - if ( rogue_findbaton(cp,playertxid,&keystrokes,numkeys,regslot,playerdata,batontxid,batonvout,batonvalue,batonht,gametxid,gametx,maxplayers,myrogueaddr,numplayers,symbol,pname) == 0 ) - { - UniValue obj; struct rogue_player P; - seed = rogue_gamefields(obj,maxplayers,buyin,gametxid,myrogueaddr); - fprintf(stderr,"(%s) found baton %s numkeys.%d seed.%llu playerdata.%d\n",pname.size()!=0?pname.c_str():Rogue_pname.c_str(),batontxid.ToString().c_str(),numkeys,(long long)seed,(int32_t)playerdata.size()); - memset(&P,0,sizeof(P)); - if ( playerdata.size() > 0 ) - { - for (i=0; i 0 ) - { - newdata.resize(num); - for (i=0; i no playerdata\n"); - newdata.resize(0); - //P.gold = (P.gold * 8) / 10; - } - else - { - cpTokens = CCinit(&tokensC, EVAL_TOKENS); - mtx.vout.push_back(MakeCC1vout(EVAL_TOKENS, txfee, GetUnspendable(cpTokens,NULL))); // marker to token cc addr, burnable and validated - mtx.vout.push_back(MakeTokensCC1vout(cp->evalcode,1,mypk)); - cashout = rogue_cashout(&P); - fprintf(stderr,"\nextracted $$$gold.%d -> %.8f ROGUE hp.%d strength.%d/%d level.%d exp.%d dl.%d n.%d amulet.%d\n",P.gold,(double)cashout/COIN,P.hitpoints,P.strength&0xffff,P.strength>>16,P.level,P.experience,P.dungeonlevel,n,P.amulet); - if ( hush_nextheight() > 77777 && cashout > ROGUE_MAXCASHOUT ) - cashout = ROGUE_MAXCASHOUT; - if ( funcid == 'H' && maxplayers > 1 ) - { - if ( P.amulet == 0 ) - { - if ( numplayers != maxplayers ) - return(cclib_error(result,"numplayers != maxplayers")); - else if ( rogue_playersalive(tmp,tmp,gametxid,maxplayers,gameheight,gametx) > 1 ) - return(cclib_error(result,"highlander must be a winner or last one standing")); - } - cashout *= 2; - cashout += numplayers * buyin; - } - if ( cashout > 0 ) - { - if ( (inputsum= AddCClibInputs(cp,mtx,roguepk,cashout,60,cp->unspendableCCaddr,1)) > cashout ) - CCchange = (inputsum - cashout); - else fprintf(stderr,"couldnt find enough utxos\n"); - } - mtx.vout.push_back(CTxOut(cashout,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG)); - } - } - if ( CCchange + (batonvalue-3*txfee) >= txfee ) - mtx.vout.push_back(MakeCC1vout(cp->evalcode,CCchange + (batonvalue-3*txfee),roguepk)); - Myprivkey(mypriv); - CCaddr1of2set(cp,roguepk,mypk,mypriv,myrogueaddr); - CScript opret; - if ( pname.size() == 0 ) - pname = Rogue_pname; - if ( newdata.size() == 0 ) - { - opret = rogue_highlanderopret(funcid, gametxid, regslot, mypk, nodata,pname); - rawtx = FinalizeCCTx(0,cp,mtx,mypk,txfee,opret); - //fprintf(stderr,"nodata finalizetx.(%s)\n",rawtx.c_str()); - } - else - { - opret = rogue_highlanderopret(funcid, gametxid, regslot, mypk, newdata,pname); - char seedstr[32]; - sprintf(seedstr,"%llu",(long long)seed); - std::vector vopretNonfungible; - GetOpReturnData(opret, vopretNonfungible); - rawtx = FinalizeCCTx(0, cp, mtx, mypk, txfee, EncodeTokenCreateOpRet('c', Mypubkey(), std::string(seedstr), gametxid.GetHex(), vopretNonfungible)); - } - memset(mypriv,0,32); - return(rogue_rawtxresult(result,rawtx,1)); - } - result.push_back(Pair("result","success")); - } else fprintf(stderr,"illegal game err.%d\n",err); - } else fprintf(stderr,"parameters only n.%d\n",n); - } - return(result); -} - -UniValue rogue_bailout(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) -{ - return(rogue_finishgame(txfee,cp,params,(char *)"bailout")); -} - -UniValue rogue_highlander(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) -{ - return(rogue_finishgame(txfee,cp,params,(char *)"highlander")); -} - -UniValue rogue_gameinfo(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) -{ - UniValue result(UniValue::VOBJ),a(UniValue::VARR); int32_t i,n,gameheight,maxplayers,numvouts; uint256 txid; CTransaction tx; int64_t buyin; uint64_t seed; bits256 t; char myrogueaddr[64],str[64]; CPubKey mypk,roguepk; - result.push_back(Pair("name","rogue")); - result.push_back(Pair("method","gameinfo")); - if ( params != 0 && (n= cJSON_GetArraySize(params)) > 0 ) - { - if ( n > 0 ) - { - txid = juint256(jitem(params,0)); - result.push_back(Pair("gametxid",txid.GetHex())); - if ( rogue_isvalidgame(cp,gameheight,tx,buyin,maxplayers,txid,0) == 0 ) - { - result.push_back(Pair("result","success")); - result.push_back(Pair("gameheight",(int64_t)gameheight)); - mypk = pubkey2pk(Mypubkey()); - roguepk = GetUnspendable(cp,0); - GetCCaddress1of2(cp,myrogueaddr,roguepk,mypk); - //fprintf(stderr,"myrogueaddr.%s\n",myrogueaddr); - seed = rogue_gamefields(result,maxplayers,buyin,txid,myrogueaddr); - result.push_back(Pair("seed",(int64_t)seed)); - for (i=0; i > unspentOutputs; - roguepk = GetUnspendable(cp,0); - GetCCaddress(cp,coinaddr,roguepk); - SetCCunspents(unspentOutputs,coinaddr,true); - nextheight = hush_nextheight(); - for (std::vector >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++) - { - txid = it->first.txhash; - vout = (int32_t)it->first.index; - //char str[65]; fprintf(stderr,"%s check %s/v%d %.8f\n",coinaddr,uint256_str(str,txid),vout,(double)it->second.satoshis/COIN); - if ( it->second.satoshis != txfee || vout != 0 ) // reject any that are not highlander markers - continue; - if ( rogue_isvalidgame(cp,gameheight,tx,buyin,maxplayers,txid,1) == 0 && nextheight <= gameheight+ROGUE_MAXKEYSTROKESGAP ) - { - rogue_playersalive(openslots,numplayers,txid,maxplayers,gameheight,tx); - if ( openslots > 0 ) - a.push_back(txid.GetHex()); - } - } - result.push_back(Pair("result","success")); - rogue_univalue(result,"pending",-1,-1); - result.push_back(Pair("pending",a)); - result.push_back(Pair("numpending",(int64_t)a.size())); - return(result); -} - -UniValue rogue_players(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) -{ - UniValue result(UniValue::VOBJ),a(UniValue::VARR); int64_t buyin; uint256 tokenid,gametxid,txid,hashBlock; CTransaction playertx,tx; int32_t maxplayers,vout,numvouts; std::vector playerdata; CPubKey roguepk,mypk,pk; std::string symbol,pname; char coinaddr[64]; - std::vector > unspentOutputs; - roguepk = GetUnspendable(cp,0); - mypk = pubkey2pk(Mypubkey()); - GetTokensCCaddress(cp,coinaddr,mypk); - SetCCunspents(unspentOutputs,coinaddr,true); - rogue_univalue(result,"players",-1,-1); - for (std::vector >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++) - { - txid = it->first.txhash; - vout = (int32_t)it->first.index; - //char str[65]; fprintf(stderr,"%s check %s/v%d %.8f\n",coinaddr,uint256_str(str,txid),vout,(double)it->second.satoshis/COIN); - if ( it->second.satoshis != 1 || vout > 1 ) - continue; - if ( rogue_playerdata(cp,gametxid,tokenid,pk,playerdata,symbol,pname,txid) == 0 )//&& pk == mypk ) - { - a.push_back(txid.GetHex()); - //a.push_back(Pair("playerdata",rogue_playerobj(playerdata))); - } - } - result.push_back(Pair("playerdata",a)); - result.push_back(Pair("numplayerdata",(int64_t)a.size())); - return(result); -} - -UniValue rogue_games(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) -{ - UniValue result(UniValue::VOBJ),a(UniValue::VARR),b(UniValue::VARR); uint256 txid,hashBlock,gametxid,tokenid,playertxid; int32_t vout,maxplayers,gameheight,numvouts; CPubKey roguepk,mypk; char coinaddr[64]; CTransaction tx,gametx; int64_t buyin; - std::vector txids; - //std::vector > unspentOutputs; - roguepk = GetUnspendable(cp,0); - mypk = pubkey2pk(Mypubkey()); - GetCCaddress1of2(cp,coinaddr,roguepk,mypk); - //SetCCunspents(unspentOutputs,coinaddr); - SetCCtxids(txids,coinaddr,true,cp->evalcode,zeroid,'R'); - rogue_univalue(result,"games",-1,-1); - for (std::vector::const_iterator it=txids.begin(); it!=txids.end(); it++) - //for (std::vector >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++) - { - txid = it->first.txhash; - vout = (int32_t)it->first.index; - //char str[65]; fprintf(stderr,"%s check %s/v%d %.8f\n",coinaddr,uint256_str(str,txid),vout,(double)it->second.satoshis/COIN); - if ( vout == 0 ) - { - if ( myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 1 ) - { - if ( rogue_registeropretdecode(gametxid,tokenid,playertxid,tx.vout[numvouts-1].scriptPubKey) == 'R' ) - { - if ( rogue_isvalidgame(cp,gameheight,gametx,buyin,maxplayers,gametxid,0) == 0 ) - { - if ( CCgettxout(txid,vout,1,0) < 0 ) - b.push_back(gametxid.GetHex()); - else a.push_back(gametxid.GetHex()); - } - } - } - } - } - result.push_back(Pair("pastgames",b)); - result.push_back(Pair("games",a)); - result.push_back(Pair("numgames",(int64_t)(a.size()+b.size()))); - return(result); -} - -UniValue rogue_setname(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) -{ - UniValue result(UniValue::VOBJ); int32_t n; char *namestr = 0; - rogue_univalue(result,"setname",-1,-1); - if ( params != 0 && (n= cJSON_GetArraySize(params)) > 0 ) - { - if ( n > 0 ) - { - if ( (namestr= jstri(params,0)) != 0 ) - { - result.push_back(Pair("result","success")); - result.push_back(Pair("pname",namestr)); - Rogue_pname = namestr; - return(result); - } - } - } - result.push_back(Pair("result","error")); - result.push_back(Pair("error","couldnt get name")); - return(result); -} - -bool rogue_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const CTransaction tx) -{ - CScript scriptPubKey; std::vector vopret; uint8_t *script,e,f,funcid,tokentx=0; int32_t i,maxplayers,enabled = 0,decoded=0,regslot,ind,err,dispflag,gameheight,score,numvouts; CTransaction vintx,gametx; CPubKey pk; uint256 hashBlock,gametxid,txid,tokenid,batontxid,playertxid,ptxid; int64_t buyin,cashout; std::vector playerdata,keystrokes; std::string symbol,pname; - if ( strcmp(SMART_CHAIN_SYMBOL,"ROGUE") == 0 ) - { - if (height < 21274 ) - return(true); - else if ( height > 50000 ) - enabled = 1; - } else enabled = 1; - if ( (numvouts= tx.vout.size()) > 1 ) - { - txid = tx.GetHash(); - if ( txid == Parseuint256("1ae04dc0c5f2fca2053819a3a1b2efe5d355c34f58d6f16d59e5e2573e7baf7f") || txid == Parseuint256("2a34b36cc1292aecfaabdad79b42cab9989fa6dcc87ac8ca88aa6162dab1e2c4") ) // osx rogue chain ht.50902, 69522 - enabled = 0; - scriptPubKey = tx.vout[numvouts-1].scriptPubKey; - GetOpReturnData(scriptPubKey,vopret); - if ( vopret.size() > 2 ) - { - script = (uint8_t *)vopret.data(); - funcid = script[1]; - if ( (e= script[0]) == EVAL_TOKENS ) - { - tokentx = funcid; - if ( (funcid= rogue_highlanderopretdecode(gametxid,tokenid,regslot,pk,playerdata,symbol,pname,scriptPubKey)) == 0 ) - { - if ( (funcid= rogue_registeropretdecode(gametxid,tokenid,playertxid,scriptPubKey)) == 0 ) - { - fprintf(stderr,"ht.%d couldnt decode tokens opret (%c)\n",height,script[1]); - } else e = EVAL_ROGUE, decoded = 1; - } else e = EVAL_ROGUE, decoded = 1; - } - if ( e == EVAL_ROGUE ) - { - //fprintf(stderr,"ht.%d rogue.(%c)\n",height,script[1]); - if ( decoded == 0 ) - { - switch ( funcid ) - { - case 'G': // seems just need to make sure no vout abuse is left to do - gametx = tx; - gametxid = tx.GetHash(); - gameheight = height; - if ( (err= rogue_isvalidgame(cp,gameheight,gametx,buyin,maxplayers,zeroid,0)) != 0 ) - { - fprintf(stderr,"height.%d %s rogue_isvalidgame error.%d\n",height,gametxid.GetHex().c_str(),err); - return eval->Invalid("invalid gametxid"); - } - //fprintf(stderr,"height.%d %s rogue_isvalidgame\n",height,gametxid.GetHex().c_str()); - return(true); - break; - case 'R': - if ( (funcid= rogue_registeropretdecode(gametxid,tokenid,playertxid,scriptPubKey)) != 'R' ) - { - return eval->Invalid("couldnt decode register opret"); - } - // baton is created - // validation is done below - break; - case 'K': - if ( (funcid= rogue_keystrokesopretdecode(gametxid,batontxid,pk,keystrokes,scriptPubKey)) != 'K' ) - { - return eval->Invalid("couldnt decode keystrokes opret"); - } - // spending the baton proves it is the user if the pk is the signer - return(true); - break; - case 'H': case 'Q': - // done in the next switch statement as there are some H/Q tx with playerdata which would skip this section - break; - default: - return eval->Invalid("illegal rogue non-decoded funcid"); - break; - } - } - switch ( funcid ) - { - case 'R': // register - // verify vout amounts are as they should be and no vins that shouldnt be - return(true); - case 'H': // win - case 'Q': // bailout - if ( (f= rogue_highlanderopretdecode(gametxid,tokenid,regslot,pk,playerdata,symbol,pname,scriptPubKey)) != funcid ) - { - //fprintf(stderr,"height.%d couldnt decode H/Q opret\n",height); - //if ( height > 20000 ) - return eval->Invalid("couldnt decode H/Q opret"); - } - // verify pk belongs to this tx - if ( tokentx == 'c' ) - { - if ( playerdata.size() > 0 ) - { - static char laststr[512]; char cashstr[512]; - if ( rogue_playerdata_validate(&cashout,ptxid,cp,playerdata,gametxid,pk) < 0 ) - { - sprintf(cashstr,"tokentx.(%c) decoded.%d ht.%d gametxid.%s player.%s invalid playerdata[%d]\n",tokentx,decoded,height,gametxid.GetHex().c_str(),ptxid.GetHex().c_str(),(int32_t)playerdata.size()); - if ( strcmp(laststr,cashstr) != 0 ) - { - strcpy(laststr,cashstr); - fprintf(stderr,"%s\n",cashstr); - } - if ( enabled != 0 ) - return eval->Invalid("mismatched playerdata"); - } - if ( height > 777777 && cashout > ROGUE_MAXCASHOUT ) - cashout = ROGUE_MAXCASHOUT; - if ( funcid == 'H' ) - { - cashout *= 2; - cashout += rogue_buyins(gametxid,maxplayers); - } - sprintf(cashstr,"tokentx.(%c) decoded.%d ht.%d txid.%s %.8f vs vout2 %.8f",tokentx,decoded,height,txid.GetHex().c_str(),(double)cashout/COIN,(double)tx.vout[2].nValue/COIN); - if ( strcmp(laststr,cashstr) != 0 ) - { - strcpy(laststr,cashstr); - fprintf(stderr,"%s\n",cashstr); - } - } else cashout = 10000; - if ( enabled != 0 && tx.vout[2].nValue > cashout ) - return eval->Invalid("mismatched cashout amount"); - } - if ( funcid == 'Q' ) - { - // verify vin/vout - } - else // 'H' - { - // verify vin/vout and proper payouts - } - return(true); - break; - default: - return eval->Invalid("illegal rogue funcid"); - break; - } - } else return eval->Invalid("illegal evalcode"); - } else return eval->Invalid("opret too small"); - } else return eval->Invalid("not enough vouts"); - return(true); -} -