-/* NetHack 3.6 unixtty.c $NHDT-Date: 1450916700 2015/12/24 00:25:00 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.21 $ */
+/* NetHack 3.6 unixtty.c $NHDT-Date: 1548372343 2019/01/24 23:25:43 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.25 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */
#endif /* V7 */
+/*
+ * Old curses.h relied on implicit declaration of has_colors().
+ * Modern compilers tend to warn about implicit declarations and
+ * modern curses.h declares has_colors() explicitly. However, the
+ * declaration it uses is not one we can simply clone (requires
+ * <stdbool.h>). This simpler declaration suffices but can't be
+ * used unconditionally because it conflicts with the 'bool' one.
+ */
+#ifdef NEED_HAS_COLORS_DECL
+int has_colors();
+#endif
+
#if defined(TTY_GRAPHICS) && ((!defined(SYSV) && !defined(HPUX)) \
|| defined(UNIXPC) || defined(SVR4))
#ifndef LINT
{
#ifdef TTY_GRAPHICS
/* Ugly hack to keep from changing tty modes for non-tty games -dlc */
- if (!strcmp(windowprocs.name, "tty") && intr_char != nonesuch
+ if (WINDOWPORT("tty") && intr_char != nonesuch
&& curttyb2.intr_sym != '\003') {
curttyb2.intr_sym = '\003';
setctty();
{
#ifdef TTY_GRAPHICS
/* Ugly hack to keep from changing tty modes for non-tty games -dlc */
- if (!strcmp(windowprocs.name, "tty") && curttyb2.intr_sym != nonesuch) {
+ if (WINDOWPORT("tty") && curttyb2.intr_sym != nonesuch) {
curttyb2.intr_sym = nonesuch;
setctty();
}
sco_mapon()
{
#ifdef TTY_GRAPHICS
- if (!strcmp(windowprocs.name, "tty") && sco_flag_console) {
+ if (WINDOWPORT("tty") && sco_flag_console) {
if (sco_map_valid != -1) {
ioctl(0, LDSMAP, sco_chanmap_buf);
}
sco_mapoff()
{
#ifdef TTY_GRAPHICS
- if (!strcmp(windowprocs.name, "tty") && sco_flag_console) {
+ if (WINDOWPORT("tty") && sco_flag_console) {
sco_map_valid = ioctl(0, LDGMAP, sco_chanmap_buf);
if (sco_map_valid != -1) {
ioctl(0, LDNMAP, (char *) 0);
init_sco_cons()
{
#ifdef TTY_GRAPHICS
- if (!strcmp(windowprocs.name, "tty") && sco_flag_console) {
+ if (WINDOWPORT("tty") && sco_flag_console) {
atexit(sco_mapon);
sco_mapoff();
load_symset("IBMGraphics", PRIMARY);
linux_mapon()
{
#ifdef TTY_GRAPHICS
- if (!strcmp(windowprocs.name, "tty") && linux_flag_console) {
-_pragma_ignore(-Wunused-result)
+ if (WINDOWPORT("tty") && linux_flag_console) {
write(1, "\033(B", 3);
-_pragma_pop
}
#endif
}
linux_mapoff()
{
#ifdef TTY_GRAPHICS
- if (!strcmp(windowprocs.name, "tty") && linux_flag_console) {
-_pragma_ignore(-Wunused-result)
+ if (WINDOWPORT("tty") && linux_flag_console) {
write(1, "\033(U", 3);
-_pragma_pop
}
#endif
}
init_linux_cons()
{
#ifdef TTY_GRAPHICS
- if (!strcmp(windowprocs.name, "tty") && linux_flag_console) {
+ if (WINDOWPORT("tty") && linux_flag_console) {
atexit(linux_mapon);
linux_mapoff();
#ifdef TEXTCOLOR