Source:NetHack 3.6.1/include/unixconf.h

From NetHackWiki
(Redirected from Source:Unixconf.h)
Jump to: navigation, search

Below is the full text to unixconf.h from the source code of NetHack 3.6.1. To link to a particular line, write [[Source:NetHack 3.6.1/include/unixconf.h#line123]], for example.

The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

  1.  /* NetHack 3.6	unixconf.h	$NHDT-Date: 1520099325 2018/03/03 17:48:45 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.30 $ */
  2.  /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  3.  /*-Copyright (c) Pasi Kallinen, 2018. */
  4.  /* NetHack may be freely redistributed.  See license for details. */
  5.  
  6.  #ifdef UNIX
  7.  #ifndef UNIXCONF_H
  8.  #define UNIXCONF_H
  9.  
  10.  /*
  11.   * Some include files are in a different place under SYSV
  12.   *      BSD                SYSV
  13.   * <sys/time.h>         <time.h>
  14.   * <sgtty.h>            <termio.h>
  15.   *
  16.   * Some routines are called differently
  17.   * index                strchr
  18.   * rindex               strrchr
  19.   *
  20.   */
  21.  
  22.  /* define exactly one of the following four choices */
  23.  /* #define BSD 1 */  /* define for 4.n/Free/Open/Net BSD  */
  24.                       /* also for relatives like SunOS 4.x, DG/UX, and */
  25.                       /* older versions of Linux */
  26.  /* #define ULTRIX */ /* define for Ultrix v3.0 or higher (but not lower) */
  27.                       /* Use BSD for < v3.0 */
  28.                       /* "ULTRIX" not to be confused with "ultrix" */
  29.  #define SYSV         /* define for System V, Solaris 2.x, newer versions */
  30.                       /* of Linux */
  31.  /* #define HPUX */   /* Hewlett-Packard's Unix, version 6.5 or higher */
  32.                       /* use SYSV for < v6.5 */
  33.  
  34.  /* define any of the following that are appropriate */
  35.  #define SVR4           /* use in addition to SYSV for System V Release 4 */
  36.                         /* including Solaris 2+ */
  37.  #define NETWORK        /* if running on a networked system */
  38.                         /* e.g. Suns sharing a playground through NFS */
  39.  /* #define SUNOS4 */   /* SunOS 4.x */
  40.  #ifdef __linux__
  41.  #define LINUX    /* Another Unix clone */
  42.  #endif
  43.  /* #define CYGWIN32 */ /* Unix on Win32 -- use with case sensitive defines */
  44.  /* #define GENIX */    /* Yet Another Unix Clone */
  45.  /* #define HISX */     /* Bull Unix for XPS Machines */
  46.  /* #define BOS */      /* Bull Open Software - Unix for DPX/2 Machines */
  47.  /* #define UNIXPC */   /* use in addition to SYSV for AT&T 7300/3B1 */
  48.  /* #define AIX_31 */   /* In AIX 3.1 (IBM RS/6000) use BSD ioctl's to gain
  49.                          * job control (note that AIX is SYSV otherwise)
  50.                          * Also define this for AIX 3.2 */
  51.  
  52.  #define TERMINFO       /* uses terminfo rather than termcap */
  53.                         /* Should be defined for most SYSV, SVR4 (including
  54.                          * Solaris 2+), HPUX, and Linux systems.  In
  55.                          * particular, it should NOT be defined for the UNIXPC
  56.                          * unless you remove the use of the shared library in
  57.                          * the Makefile */
  58.  #define TEXTCOLOR      /* Use System V r3.2 terminfo color support
  59.                          * and/or ANSI color support on termcap systems
  60.                          * and/or X11 color */
  61.  #define POSIX_JOB_CONTROL /* use System V / Solaris 2.x / POSIX job control
  62.                             * (e.g., VSUSP) */
  63.  #define POSIX_TYPES /* use POSIX types for system calls and termios */
  64.                      /* Define for many recent OS releases, including
  65.                       * those with specific defines (since types are
  66.                       * changing toward the standard from earlier chaos).
  67.                       * For example, platforms using the GNU libraries,
  68.                       * Linux, Solaris 2.x
  69.                       */
  70.  
  71.  /* #define OPENWINBUG */  /* avoid a problem using OpenWindows 3.0 for
  72.                               X11 on SunOS 4.1.x, x>= 2.  Do not define
  73.                               for other X11 implementations. */
  74.  /* #define PYRAMID_BUG */ /* avoid a bug on the Pyramid */
  75.  /* #define BSD_43_BUG */  /* for real 4.3BSD cc's without schain botch fix */
  76.  /* #define MICROPORT_BUG */     /* problems with large arrays in structs */
  77.  /* #define MICROPORT_286_BUG */ /* changes needed in termcap.c to get it to
  78.                                     run with Microport Sys V/AT version 2.4.
  79.                                     By Jay Maynard */
  80.  /* #define AIXPS_2BUG */ /* avoid a problem with little_to_big() optimization
  81.                              */
  82.  
  83.  /* #define RANDOM */ /* if neither random/srandom nor lrand48/srand48
  84.                          is available from your system */
  85.  
  86.  /* see sys/unix/snd86unx.shr for more information on these */
  87.  /* #define UNIX386MUSIC */ /* play real music through speaker on systems
  88.                                with music driver installed */
  89.  /* #define VPIX_MUSIC */   /* play real music through speaker on systems
  90.                                with built-in VPIX support */
  91.  
  92.  /*
  93.   * The next two defines are intended mainly for the Andrew File System,
  94.   * which does not allow hard links.  If NO_FILE_LINKS is defined, lock files
  95.   * will be created in LOCKDIR using open() instead of in the playground using
  96.   * link().
  97.   *              Ralf Brown, 7/26/89 (from v2.3 hack of 10/10/88)
  98.   */
  99.  
  100.  /* #define NO_FILE_LINKS */                       /* if no hard links */
  101.  /* #define LOCKDIR "/usr/games/lib/nethackdir" */ /* where to put locks */
  102.  
  103.  /*
  104.   * If you want the static parts of your playground on a read-only file
  105.   * system, define VAR_PLAYGROUND to be where the variable parts are kept.
  106.   */
  107.  /* #define VAR_PLAYGROUND "/var/lib/games/nethack" */
  108.  
  109.  /*
  110.   * Define DEF_PAGER as your default pager, e.g. "/bin/cat" or "/usr/ucb/more"
  111.   * If defined, it can be overridden by the environment variable PAGER.
  112.   * Hack will use its internal pager if DEF_PAGER is not defined.
  113.   * (This might be preferable for security reasons.)
  114.   */
  115.  /* #define DEF_PAGER ".../mydir/mypager" */
  116.  
  117.  /*
  118.   * Define PORT_HELP to be the name of the port-specfic help file.
  119.   * This file is found in HACKDIR.
  120.   * Normally, you shouldn't need to change this.
  121.   * There is currently no port-specific help for Unix systems.
  122.   */
  123.  /* #define PORT_HELP "Unixhelp" */
  124.  
  125.  #ifdef TTY_GRAPHICS
  126.  /*
  127.   * To enable the `timed_delay' option for using a timer rather than extra
  128.   * screen output when pausing for display effect.  Requires that `msleep'
  129.   * function be available (with time argument specified in milliseconds).
  130.   * Various output devices can produce wildly varying delays when the
  131.   * "extra output" method is used, but not all systems provide access to
  132.   * a fine-grained timer.
  133.   */
  134.  /* #define TIMED_DELAY */ /* usleep() */
  135.  #endif
  136.  #if defined(MACOSX) && !defined(TIMED_DELAY)
  137.  #define TIMED_DELAY
  138.  #endif
  139.  
  140.  /* #define AVOID_WIN_IOCTL */ /* ensure USE_WIN_IOCTL remains undefined */
  141.  
  142.  /*
  143.   * If you define MAIL, then the player will be notified of new mail
  144.   * when it arrives.  If you also define DEF_MAILREADER then this will
  145.   * be the default mail reader, and can be overridden by the environment
  146.   * variable MAILREADER; otherwise an internal pager will be used.
  147.   * A stat system call is done on the mailbox every MAILCKFREQ moves.
  148.   */
  149.  #if !defined(NOMAIL)
  150.  #define MAIL /* Deliver mail during the game */
  151.  #endif
  152.  
  153.  /* The Andrew Message System does mail a little differently from normal
  154.   * UNIX.  Mail is deposited in the user's own directory in ~/Mailbox
  155.   * (another directory).  MAILBOX is the element that will be added on to
  156.   * the user's home directory path to generate the Mailbox path - just in
  157.   * case other Andrew sites do it differently from CMU.
  158.   *              dan lovinger
  159.   *              dl2n+@andrew.cmu.edu (dec 19 1989)
  160.   */
  161.  
  162.  /* #define AMS */ /* use Andrew message system for mail */
  163.  
  164.  /* NO_MAILREADER is for kerberos authenticating filesystems where it is
  165.   * essentially impossible to securely exec child processes, like mail
  166.   * readers, when the game is running under a special token.
  167.   *              dan
  168.   */
  169.  
  170.  /* #define NO_MAILREADER */ /* have mail daemon just tell player of mail */
  171.  
  172.  #ifdef MAIL
  173.  #if defined(BSD) || defined(ULTRIX)
  174.  #ifdef AMS
  175.  #define AMS_MAILBOX "/Mailbox"
  176.  #else
  177.  #if defined(__FreeBSD__) || defined(__OpenBSD__)
  178.  #define DEF_MAILREADER "/usr/bin/mail"
  179.  #else
  180.  #define DEF_MAILREADER "/usr/ucb/Mail"
  181.  #endif
  182.  #endif
  183.  #else
  184.  #if (defined(SYSV) || defined(DGUX) || defined(HPUX)) && !defined(LINUX)
  185.  #if defined(M_XENIX)
  186.  #define DEF_MAILREADER "/usr/bin/mail"
  187.  #else
  188.  #ifdef __sgi
  189.  #define DEF_MAILREADER "/usr/sbin/Mail"
  190.  #else
  191.  #define DEF_MAILREADER "/usr/bin/mailx"
  192.  #endif
  193.  #endif
  194.  #else
  195.  #define DEF_MAILREADER "/bin/mail"
  196.  #endif
  197.  #endif
  198.  
  199.  /* If SIMPLE_MAIL is defined, the mail spool file format is
  200.     "sender:message", one mail per line, and mails are
  201.     read within game, from demon-delivered mail scrolls.
  202.     The mail spool file will be deleted once the player
  203.     has read the message. */
  204.  /* #define SIMPLE_MAIL */
  205.  
  206.  #ifndef MAILCKFREQ
  207.  /* How often mail spool file is checked for new messages, in turns */
  208.  #define MAILCKFREQ 50
  209.  #endif
  210.  
  211.  #endif /* MAIL */
  212.  
  213.  /* If SERVER_ADMIN_MSG is defined and the file exists, players get
  214.     a message from the user defined in the file.  The file format
  215.     is "sender:message" all in one line. */
  216.  /* #define SERVER_ADMIN_MSG "adminmsg" */
  217.  #ifndef SERVER_ADMIN_MSG_CKFREQ
  218.  /* How often admin message file is checked for new messages, in turns */
  219.  #define SERVER_ADMIN_MSG_CKFREQ 25
  220.  #endif
  221.  
  222.  
  223.  /*
  224.   * Some terminals or terminal emulators send two character sequence "ESC c"
  225.   * when Alt+c is pressed.  The altmeta run-time option allows the user to
  226.   * request that "ESC c" be treated as M-c.
  227.   */
  228.  #define ALTMETA /* support altmeta run-time option */
  229.  
  230.  #ifdef COMPRESS
  231.  /* Some implementations of compress need a 'quiet' option.
  232.   * If you've got one of these versions, put -q here.
  233.   * You can also include any other strange options your compress needs.
  234.   * If you have a normal compress, just leave it commented out.
  235.   */
  236.  /* #define COMPRESS_OPTIONS "-q" */
  237.  #endif
  238.  
  239.  #ifndef FCMASK
  240.  #define FCMASK 0660 /* file creation mask */
  241.  #endif
  242.  
  243.  /* fcntl(2) is a POSIX-portable call for manipulating file descriptors.
  244.   * Comment out the USE_FCNTL if for some reason you have a strange
  245.   * OS/filesystem combination for which fcntl(2) does not work. */
  246.  #ifdef POSIX_TYPES
  247.  #define USE_FCNTL
  248.  #endif
  249.  
  250.  /*
  251.   * The remainder of the file should not need to be changed.
  252.   */
  253.  
  254.  #ifdef _AUX_SOURCE
  255.  #ifdef AUX /* gcc ? */
  256.  #define _SYSV_SOURCE
  257.  #define _BSD_SOURCE
  258.  #else
  259.  #define AUX
  260.  #endif
  261.  #endif /* _AUX_SOURCE */
  262.  
  263.  #if defined(LINUX) || defined(bsdi)
  264.  #ifndef POSIX_TYPES
  265.  #define POSIX_TYPES
  266.  #endif
  267.  #ifndef POSIX_JOB_CONTROL
  268.  #define POSIX_JOB_CONTROL
  269.  #endif
  270.  #endif
  271.  
  272.  /*
  273.   * BSD/ULTRIX systems are normally the only ones that can suspend processes.
  274.   * Suspending NetHack processes cleanly should be easy to add to other systems
  275.   * that have SIGTSTP in the Berkeley sense.  Currently the only such systems
  276.   * known to work are HPUX and AIX 3.1; other systems will probably require
  277.   * tweaks to unixtty.c and ioctl.c.
  278.   *
  279.   * POSIX defines a slightly different type of job control, which should be
  280.   * equivalent for NetHack's purposes.  POSIX_JOB_CONTROL should work on
  281.   * various recent SYSV versions (with possibly tweaks to unixtty.c again).
  282.   */
  283.  #ifndef POSIX_JOB_CONTROL
  284.  #if defined(BSD) || defined(ULTRIX) || defined(HPUX) || defined(AIX_31)
  285.  #define BSD_JOB_CONTROL
  286.  #else
  287.  #if defined(SVR4)
  288.  #define POSIX_JOB_CONTROL
  289.  #endif
  290.  #endif
  291.  #endif
  292.  #if defined(BSD_JOB_CONTROL) || defined(POSIX_JOB_CONTROL) || defined(AUX)
  293.  #define SUSPEND /* let ^Z suspend the game */
  294.  #endif
  295.  
  296.  /*
  297.   * Define SAFERHANGUP to delay hangup processing until the main command
  298.   * loop. 'safer' because it avoids certain cheats and also avoids losing
  299.   * objects being thrown when the hangup occurs.  All unix windowports
  300.   * support SAFERHANGUP (couldn't define it here otherwise).
  301.   */
  302.  #define SAFERHANGUP
  303.  
  304.  #if defined(BSD) || defined(ULTRIX)
  305.  #include <sys/time.h>
  306.  #else
  307.  #include <time.h>
  308.  #endif
  309.  
  310.  #define HLOCK "perm" /* an empty file used for locking purposes */
  311.  
  312.  #define tgetch getchar
  313.  
  314.  #ifndef NOSHELL
  315.  #define SHELL /* do not delete the '!' command */
  316.  #endif
  317.  
  318.  #include "system.h"
  319.  
  320.  #if defined(POSIX_TYPES) || defined(__GNUC__)
  321.  #include <stdlib.h>
  322.  #include <unistd.h>
  323.  #endif
  324.  
  325.  #if defined(POSIX_TYPES) || defined(__GNUC__) || defined(BSD) \
  326.      || defined(ULTRIX)
  327.  #include <sys/wait.h>
  328.  #endif
  329.  
  330.  #if defined(BSD) || defined(ULTRIX)
  331.  #if !defined(DGUX) && !defined(SUNOS4)
  332.  #define memcpy(d, s, n) bcopy(s, d, n)
  333.  #define memcmp(s1, s2, n) bcmp(s2, s1, n)
  334.  #endif
  335.  #ifdef SUNOS4
  336.  #include <memory.h>
  337.  #endif
  338.  #else         /* therefore SYSV */
  339.  #ifndef index /* some systems seem to do this for you */
  340.  #define index strchr
  341.  #endif
  342.  #ifndef rindex
  343.  #define rindex strrchr
  344.  #endif
  345.  #endif
  346.  
  347.  /* Use the high quality random number routines. */
  348.  #if defined(BSD) || defined(LINUX) || defined(ULTRIX) || defined(CYGWIN32) \
  349.      || defined(RANDOM) || defined(__APPLE__)
  350.  #define Rand() random()
  351.  #else
  352.  #define Rand() lrand48()
  353.  #endif
  354.  
  355.  #ifdef TIMED_DELAY
  356.  #if defined(SUNOS4) || defined(LINUX) || (defined(BSD) && !defined(ULTRIX))
  357.  #define msleep(k) usleep((k) *1000)
  358.  #endif
  359.  #ifdef ULTRIX
  360.  #define msleep(k) napms(k)
  361.  #endif
  362.  #endif
  363.  
  364.  #ifdef hc /* older versions of the MetaWare High-C compiler define this */
  365.  #ifdef __HC__
  366.  #undef __HC__
  367.  #endif
  368.  #define __HC__ hc
  369.  #undef hc
  370.  #endif
  371.  
  372.  #if defined(GNOME_GRAPHICS)
  373.  #if defined(LINUX)
  374.  #include <linux/unistd.h>
  375.  #if defined(__NR_getresuid) && defined(__NR_getresgid) /* ie., >= v2.1.44 */
  376.  #define GETRES_SUPPORT
  377.  #endif
  378.  #else
  379.  #if defined(BSD) || defined(SVR4)
  380.  /*
  381.   * [ALI] We assume that SVR4 means we can safely include syscall.h
  382.   * (although it's really a BSDism). This is certainly true for Solaris 2.5,
  383.   * Solaris 7, Solaris 8 and Compaq Tru64 5.1
  384.   * Later BSD systems will have the getresid system calls.
  385.   */
  386.  #include <sys/syscall.h>
  387.  #if (defined(SYS_getuid) || defined(SYS_getresuid)) \
  388.      && (defined(SYS_getgid) || defined(SYS_getresgid))
  389.  #define GETRES_SUPPORT
  390.  #endif
  391.  #endif /* BSD || SVR4 */
  392.  #endif /* LINUX */
  393.  #endif /* GNOME_GRAPHICS */
  394.  
  395.  #ifdef __APPLE__
  396.  # define RUNTIME_PASTEBUF_SUPPORT
  397.  #endif
  398.  
  399.  #endif /* UNIXCONF_H */
  400.  #endif /* UNIX */