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