Here are some new fixes to angband-2.9.6-alpha2. You didn't think you could wait for a month without new bugs cropping up, did you?:-) Each patch can be applied independently of the others. *.dif file Summary help-hlp.dif Bugfix: help.hlp is still wrong. gcu-8bit.dif Bugfix: GCU 8bit chars got red background & blink. main-sla.dif Bugfix: main-sla.c (S-Lang) fixes. quit-msg.dif Bugfix: init_angband_aux() did not display whole message. conf-unused.dif Cleanup/Portability: Remove unused symbols from configure. gcu-win.dif Possible bugfix: Synchronize WINDOWS in main-gcu with main-cap. options.dif Feature: angband --opt / - ==> usage message. One other note which seems to fit the pre-version-3 changes: This comment in h-type.h is obsolete: /* Note that "signed char" is not always "defined" */ /* So always use "s16b" to hold small signed values */ /* A signed byte of memory */ /* typedef signed char syte; */ `signed char' exists in ANSI C. Actually it was not just `signed char' but the keyword `signed' itself which did not exist in K&R. `signed' is already used in the definitions of s16b and s32b. I guess you ought to save memory and start using `syte' and/or change the comment to talk about historical reasons. -- Hallvard B. Furuseth Comments copied from the top of each patch: ====== help-hlp.dif ====== Bugfix: help.hlp is still wrong. This time the newline at the last line is missing. As a result, my_gets() does not see the last line. (I don't know how you apply patches, but: Have you considered to just apply the patches more or less unthinkingly and then compare with the original to see if there is anything you dislike, e.g. using Emacs ediff - see Info node (ediff)Introduction - or just compare-windows? It can lead you to often delete the source tree and and recreate a fresh one, of course, but a simple script takes care of that.) ====== gcu-8bit.dif ====== Bugfix: GCU 8bit chars got red background & blink. waddch() takes `unsigned long' character arguments, not `char'. Some bits apparently mean colour and blinking: Signed 8-bit `char's became 0xFFFFFFUL and got both colour and blink. To reproduce: Compile on a host where `char' is signed or with `gcc -fsigned-char', run `angband -mgcu' on a colour terminal, `Interact with visuals', 8, CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC. ====== main-sla.dif ====== Bugfix: main-sla.c (S-Lang) fixes. This patch fixes various problems with main-sla.c. Look at at least main-sla.c hunk #3 ("main-sla.c broke main-gcu.c"). It comes in 2 parts: First the "basic" patch, then a separate patch which replaces signal() with SLsignal() by adding variable signal_aux. I wasn't sure you'd want that one, since it does a bit of surgery to files.c. Angband seems to survive fine without the 2nd patch, but sigaction is how it Really Ought To Be Done. SLsignal() tries to use sigaction instead of signal, to get more controlled behaviour. It sets up BSD semantics by using SA_RESTART if #defined, i.e. it sets up some system calls to restart after signals. There is a similar routine SLsignal_intr() for those who prefer the opposite. Note: Hunks 8-9 can quit() if S-Lang fails to reinitialize after being suspended. Should it panic save first? Or is that worse, since IIRC it overwrites the "safe" savefile, and can scramble it if the interrupt came at a time when the program's state is inconsistent? Note: Arrow keys do not work with main-sla.c. S-Lang has a read-key function which returns values > 255 for arrow/function keys, but I do not know how to map these to Angband keys. I looked at the gcu & xaw code but did not understand it. main-xxx.c could use some documenta- tion about that. I'll make an arrow key patch if you document how, including what to do with "unknown" keys. Note: You might add a note somewhere (h-system.h or main-xxx.c?) that a VMS port can begin with main-sla.c. S-Lang works with VMS. OTOH, h-system.h says Angband is unlikely to work on VMS since VMS uses non-ASCII. On the gripping hand, maybe that comment is obsolete: main.c has an #ifdef VMS, and h-define.h uses an alphatoindex() function which looks nice. Changes in 1st patch: Makefile.std: Remove the comment about S-Lang being untested. I've used it for a while now on a RedHat Linux xterm. main-sla.c hunk number : description -- 3: main-sla.c broke main-gcu.c. When USE_GCU && USE_SLA, the init_pair()-calls in main-gcu.c called main-sla:init_pair() instead of curses:init_pair(), and segfaulted. Made it static. 4-5: Use unreversed text in monochrome mode, since only part of the background was reversed in that mode. Oh well. At least this way the background is uniform. 6-7: Kill `unused parameter' warnings. 8-9: Handle SIGTSTP properly. S-Lang was not reinitialized after Angband was suspended, and segfaulted when it continued. 10: Cast away const; slang.h isn't constified. 13,16: The S-Lang manual recommends to block signals while S-Lang is initialized. 14: a) Make the suspend key (on Unix, ^Z) suspend Angband. b) init_sla() exited if SLsmg_init_smg() succeeded instead of if it failed. Which means either the module never worked, or the return value has changed between S-Lang versions. c) At failure, clean up after SLang_init_tty() before quitting. Otherwise echo is lost so one must do `stty sane'. 15: At failure, clean up after SLsmg_init_smg() and SLang_init_tty() before quitting. ====== quit-msg.dif ====== Bugfix: init_angband_aux() did not display whole message. `./angband -mgcu' from the src/ directory just says `Fatal error'. The mention that it is because `lib' is missing is lost, because init_angband_aux() prints the explanation to Curses via plog(), but then quit() immediately terminates Curses and clears the screen. Fix: Put the whole explanation in the quit() argument. I put two line feeds after `why' since `why' is prefixed with the program name but the rest of the message no longer is. I removed the `Fatal error' line, it looks a bit lost without the `./angband:' prefix and is implicit from the context anyway. Also, the reference to 'README' should be 'readme.txt'. ====== conf-unused.dif ====== Cleanup/Portability: Remove unused symbols from configure. The following symbols are set by configure but never used: * STDC_HEADERS from AC_HEADER_STDC. The ANSI headers are used unconditionally e.g. in h-system.h. * HAVE_*_H from AC_CHECK_HEADERS. The various headers are used unconditionally or #if . * TM_IN_SYS_TIME from AC_STRUCT_TM. * gcc -traditional. It doesn't work since the source uses prototypes. * If AC_FUNC_MEMCMP hits, it only adds memcmp.o to $LIBOBJS which is not used, and Angband has no matching memcmp.c source file anyway. memcmp() is used in z-virt.h. * RETSIGTYPE from AC_TYPE_SIGNAL. files.c's signal handlers return void. * HAVE_STRFTIME. strftime() is used unconditionally in Lua and main-acn.c, and if !defined(HIGHSCORE_DATE_HACK) in files.c. * HAVE_VPRINTF/HAVE_DOPRNT from AC_FUNC_VPRINTF. main-acn.c uses vsprintf() unconditionally, otherwise the functions are not used. * Most HAVE_s from AC_CHECK_FUNCS. They are used unconditionally (e.g. strtol()) or #if . So: The 1st configure.in patch removes these, except some header tests, and inserts some new header tests. The h-config.h patch removes an obsolete comment about string*.h. (USG is still used to decide if sys/params.h should be #included, so the comment is right except that the the example string*.h is wrong.) Then the h-system.h patch adds C code to use the remaining header tests. If you don't want the h-system.h patch (yet), you can instead delete the entire AC_CHECK_HEADERS() and AC_HEADER_TIME statements from configure.in. The h-system.h patch will be back in a later patch set from me, unless you tell me you are not interested:-) Finally, another configure.in patch removes AC_TYPE_SIZE_T and AC_C_CONST, since (a) ANSI C has size_t & const and (b) Lua uses them without autoconf.h. I put that in an optional patch since I don't know where you are going with portability. ====== gcu-win.dif ====== Possible bugfix: Synchronize WINDOWS in main-gcu with main-cap. Angband 2.9.3 added '|| defined(WINDOWS)' in main-cap.c, but not in the matching code in main-gcu.c. I expect that's a bug. Um. Except I have a vague feeling I may have said that before, so maybe not... ====== options.dif ====== Feature: angband --opt / - ==> usage message. Changes: - After the switch, goto usage if argv[i][2] != '\0'. - Therefore, replace break with continue in switch(opt with args). - Change &argv[i][2] to a new variable arg, since `--' changes argv[i]. Actually I just wanted --help to give help:-)