diff options
author | Bardur Arantsson <bardur@scientician.net> | 2014-12-16 08:03:10 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2014-12-16 08:03:10 +0100 |
commit | 1317b79a18d283e5a953005cb4a57b600dedadc0 (patch) | |
tree | e26755772ec30a716d78150f1aa36c9639796b0e /src | |
parent | 63dc88888692fbeddb4c0a2ec99af3cd708276eb (diff) |
Remove lots of obsolete platform defines
Diffstat (limited to 'src')
-rw-r--r-- | src/config.h | 45 | ||||
-rw-r--r-- | src/externs.h | 1 | ||||
-rw-r--r-- | src/h-config.h | 124 | ||||
-rw-r--r-- | src/h-define.h | 19 | ||||
-rw-r--r-- | src/h-system.h | 29 | ||||
-rw-r--r-- | src/main-gcu.c | 81 | ||||
-rw-r--r-- | src/main-gtk2.c | 5 | ||||
-rw-r--r-- | src/main-win.c | 21 | ||||
-rw-r--r-- | src/main-x11.c | 5 | ||||
-rw-r--r-- | src/util.cc | 64 |
10 files changed, 5 insertions, 389 deletions
diff --git a/src/config.h b/src/config.h index ce9b2d4b..290ec624 100644 --- a/src/config.h +++ b/src/config.h @@ -36,9 +36,6 @@ * * Several other such options are available for non-unix machines, * such as "MACINTOSH", "WINDOWS". - * - * You may also need to specify the "system", using defines such as - * "SOLARIS" (for Solaris), etc, see "h-config.h" for more info. */ @@ -59,53 +56,11 @@ /* - * OPTION: Use "blocking getch() calls" in "main-gcu.c". - * Hack -- Note that this option will NOT work on many BSD machines - * Currently used whenever available, if you get a warning about - * "nodelay()" undefined, then make sure to undefine this. - */ -#if defined(SYS_V) -# define USE_GETCH -#endif - - -/* - * OPTION: Use the "curs_set()" call in "main-gcu.c". - * Hack -- This option will not work on most BSD machines - */ -#ifdef SYS_V -# define USE_CURS_SET -#endif - - -/* * OPTION: Include "ncurses.h" instead of "curses.h" in "main-gcu.c" */ /* #define USE_NCURSES */ -/* - * OPTION: for multi-user machines running the game setuid to some other - * user (like 'games') this SAFE_SETUID option allows the program to drop - * its privileges when saving files that allow for user specified pathnames. - * This lets the game be installed system wide without major security - * concerns. There should not be any side effects on any machines. - * - * This will handle "gids" correctly once the permissions are set right. - */ -#define SAFE_SETUID - - -/* - * This flag enables the "POSIX" methods for "SAFE_SETUID". - */ -#if defined(_POSIX_SAVED_IDS) && !(defined(SUNOS) && !defined(SOLARIS)) && !defined(__APPLE__) -# define SAFE_SETUID_POSIX -#endif - - - - /* * OPTION: Maximum flow depth diff --git a/src/externs.h b/src/externs.h index ef73fe82..d28ed541 100644 --- a/src/externs.h +++ b/src/externs.h @@ -1936,7 +1936,6 @@ extern errr fd_move(cptr file, cptr what); extern errr fd_copy(cptr file, cptr what); extern int fd_make(cptr file, int mode); extern int fd_open(cptr file, int flags); -extern errr fd_lock(int fd, int what); extern errr fd_seek(int fd, huge n); extern errr fd_read(int fd, char *buf, huge n); extern errr fd_write(int fd, cptr buf, huge n); diff --git a/src/h-config.h b/src/h-config.h index 66fa5c1b..6babdff9 100644 --- a/src/h-config.h +++ b/src/h-config.h @@ -33,93 +33,6 @@ extern "C" { /* #define WINDOWS */ #endif -/* - * OPTION: Compile on a SYS III version of UNIX - */ -#ifndef SYS_III -/* #define SYS_III */ -#endif - -/* - * OPTION: Compile on a SYS V version of UNIX (not Solaris) - */ -#ifndef SYS_V -/* #define SYS_V */ -#endif - -/* - * OPTION: Compile on a HPUX version of UNIX - */ -#ifndef HPUX -/* #define HPUX */ -#endif - -/* - * OPTION: Compile on an SGI running IRIX - */ -#ifndef SGI -/* #define SGI */ -#endif - -/* - * OPTION: Compile on a SunOS machine - */ -#ifndef SUNOS -/* #define SUNOS */ -#endif - -/* - * OPTION: Compile on a Solaris machine - */ -#ifndef SOLARIS -/* #define SOLARIS */ -#endif - -/* - * OPTION: Compile on an ultrix/4.2BSD/Dynix/etc. version of UNIX, - * Do not define this if you are on any kind of SunOS. - */ -#ifndef ULTRIX -/* #define ULTRIX */ -#endif - - - -/* - * Extract the "SUNOS" flag from the compiler - */ -#if defined(sun) -# ifndef SUNOS -# define SUNOS -# endif -#endif - -/* - * Extract the "ULTRIX" flag from the compiler - */ -#if defined(ultrix) || defined(Pyramid) -# ifndef ULTRIX -# define ULTRIX -# endif -#endif - -/* - * Extract the "ATARI" flag from the compiler [cjh] - */ -#if defined(__atarist) || defined(__atarist__) -# ifndef ATARI -# define ATARI -# endif -#endif - -/* - * Extract the "SGI" flag from the compiler - */ -#ifdef sgi -# ifndef SGI -# define SGI -# endif -#endif /* * Extract the "WINDOWS" flag from the compiler @@ -139,7 +52,7 @@ extern "C" { * The only such platform that angband is ported to is currently * DEC Alpha AXP running OSF/1 (OpenVMS uses 32-bit longs). */ -#if defined(__alpha) && defined(__osf__) || defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(__ia64) || defined(__ia64__) || defined(__mips64) || defined(__ppc64__) || defined(__PPC64__) || defined(__powerpc64__) || defined(__64BIT__) || defined(__sparc64__) || defined(__LP64__) +#if defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(__ia64) || defined(__ia64__) || defined(__mips64) || defined(__ppc64__) || defined(__PPC64__) || defined(__powerpc64__) || defined(__64BIT__) || defined(__sparc64__) || defined(__LP64__) # define L64 #endif @@ -152,9 +65,7 @@ extern "C" { * and of the "umask()" call for various reasons, and to guess if * the "kill()" function is available, and for permission to use * functions to extract user names and expand "tildes" in filenames. - * It is also used for "locking" and "unlocking" the score file. - * Basically, SET_UID should *only* be set for "Unix" machines, - * or for the "Atari" platform which is Unix-like, apparently + * Basically, SET_UID should *only* be set for "Unix" machines. */ #if !defined(MACINTOSH) && !defined(WINDOWS) # define SET_UID @@ -162,23 +73,6 @@ extern "C" { /* - * OPTION: Set "USG" for "System V" versions of Unix - * This is used to choose a "lock()" function, and to choose - * which header files ("string.h" vs "strings.h") to include. - * It is also used to allow certain other options, such as options - * involving userid's, or multiple users on a single machine, etc. - */ -#ifdef SET_UID -# if defined(SYS_III) || defined(SYS_V) || defined(SOLARIS) || \ - defined(HPUX) || defined(SGI) || defined(ATARI) -# ifndef USG -# define USG -# endif -# endif -#endif - - -/* * Every system seems to use its own symbol as a path separator. * Default to the standard Unix slash, but attempt to change this * for various other systems. Note that any system that uses the @@ -215,17 +109,6 @@ extern "C" { /* - * OPTION: Hack -- Make sure "strchr()" and "strrchr()" will work - */ -#if defined(SYS_III) || defined(SYS_V) -# if !defined(__TURBOC__) && !defined(__WATCOMC__) -# define strchr index -# define strrchr rindex -# endif -#endif - - -/* * OPTION: Define "HAS_STRICMP" only if "stricmp()" exists. * Note that "stricmp()" is not actually used by Angband. */ @@ -248,10 +131,7 @@ extern "C" { * Note that this is only relevant for "SET_UID" machines */ #ifdef SET_UID -# if !defined(HPUX) && !defined(ULTRIX) && !defined(SOLARIS) && \ - !defined(SGI) && !defined(ISC) # define HAS_USLEEP -# endif #endif #ifdef __cplusplus diff --git a/src/h-define.h b/src/h-define.h index cb36b189..76e7e339 100644 --- a/src/h-define.h +++ b/src/h-define.h @@ -33,19 +33,6 @@ # define SEEK_END 2 #endif -/* - * Hack -- force definitions -- see fd_lock() XXX XXX XXX - */ -#ifndef F_UNLCK -# define F_UNLCK 0 -#endif -#ifndef F_RDLCK -# define F_RDLCK 1 -#endif -#ifndef F_WRLCK -# define F_WRLCK 2 -#endif - /* * The constants "TRUE" and "FALSE" @@ -87,12 +74,6 @@ #undef ABS #define ABS(a) (((a) < 0) ? (-(a)) : (a)) -/* - * Non-typed sign extractor macro - */ -#undef SGN -#define SGN(a) (((a) < 0) ? (-1) : ((a) != 0)) - /* * Note that all "index" values must be "lowercase letters", while diff --git a/src/h-system.h b/src/h-system.h index 3c919099..f7759668 100644 --- a/src/h-system.h +++ b/src/h-system.h @@ -25,16 +25,11 @@ # include <sys/types.h> -# if defined(Pyramid) || defined(SUNOS) || \ - defined(NCR3K) || defined(SUNOS) || defined(ibm032) || \ - defined(__osf__) || defined(ISC) || defined(SGI) || \ - defined(linux) +# if defined(linux) # include <sys/time.h> # endif -# if !defined(SGI) && !defined(ULTRIX) # include <sys/timeb.h> -# endif #endif @@ -51,27 +46,18 @@ # include <io.h> #endif -#if !defined(MACINTOSH) && \ - !defined(__MWERKS__) -# if defined(__TURBOC__) || defined(__WATCOMC__) -# include <mem.h> -# else +#if !defined(MACINTOSH) # include <memory.h> -# endif #endif -#if !defined(__MWERKS__) # include <fcntl.h> -#endif #ifdef SET_UID -# ifndef USG # include <sys/param.h> # include <sys/file.h> -# endif # ifdef linux # include <sys/file.h> @@ -83,23 +69,12 @@ # include <sys/stat.h> -# if defined(SOLARIS) -# include <netdb.h> -# endif #endif -#ifdef __DJGPP__ -#include <unistd.h> -#endif /* __DJGPP__ */ - #ifdef SET_UID -#ifdef USG -# include <string.h> -#else # include <strings.h> -#endif #else diff --git a/src/main-gcu.c b/src/main-gcu.c index 8ba2c8ec..34589e85 100644 --- a/src/main-gcu.c +++ b/src/main-gcu.c @@ -82,7 +82,7 @@ # if defined(_POSIX_VERSION) # define USE_TPOSIX # else -# if defined(USG) || defined(linux) || defined(SOLARIS) +# if defined(linux) # define USE_TERMIO # else # define USE_TCHARS @@ -122,11 +122,6 @@ #include <unistd.h> #include <dirent.h> -/* /me pffts Solaris */ -#ifndef NAME_MAX -#define NAME_MAX _POSIX_NAME_MAX -#endif - /* @@ -561,60 +556,6 @@ static void Term_nuke_gcu(term *t) } - - -#ifdef USE_GETCH - -/* - * Process events, with optional wait - */ -static errr Term_xtra_gcu_event(int v) -{ - int i, k; - - /* Wait */ - if (v) - { - /* Paranoia -- Wait for it */ - nodelay(stdscr, FALSE); - - /* Get a keypress */ - i = getch(); - - /* Mega-Hack -- allow graceful "suspend" */ - for (k = 0; (k < 10) && (i == ERR); k++) i = getch(); - - /* Broken input is special */ - if (i == ERR) abort(); - if (i == EOF) abort(); - } - - /* Do not wait */ - else - { - /* Do not wait for it */ - nodelay(stdscr, TRUE); - - /* Check for keypresses */ - i = getch(); - - /* Wait for it next time */ - nodelay(stdscr, FALSE); - - /* None ready */ - if (i == ERR) return (1); - if (i == EOF) return (1); - } - - /* Enqueue the keypress */ - Term_keypress(i); - - /* Success */ - return (0); -} - -#else /* USE_GETCH */ - /* * Process events (with optional wait) */ @@ -663,7 +604,6 @@ static errr Term_xtra_gcu_event(int v) return (0); } -#endif /* USE_GETCH */ /* * React to changes @@ -721,14 +661,6 @@ static errr Term_xtra_gcu(int n, int v) (void)wrefresh(td->win); return (0); -#ifdef USE_CURS_SET - - /* Change the cursor visibility */ - case TERM_XTRA_SHAPE: - curs_set(v); - return (0); - -#endif /* Suspend/Resume curses */ case TERM_XTRA_ALIVE: @@ -926,13 +858,8 @@ errr init_gcu(int argc, char **argv) keymap_norm_prepare(); -#if defined(USG) - /* Initialize for USG Unix */ - if (initscr() == NULL) return ( -1); -#else /* Initialize for other systems */ if (initscr() == (WINDOW*)ERR) return ( -1); -#endif /* Activate hooks */ quit_aux = hook_quit; @@ -1022,12 +949,6 @@ errr init_gcu(int argc, char **argv) /*** Low level preparation ***/ -#ifdef USE_GETCH - - /* Paranoia -- Assume no waiting */ - nodelay(stdscr, FALSE); - -#endif /* Prepare */ raw(); diff --git a/src/main-gtk2.c b/src/main-gtk2.c index 5f6dae12..f5c89897 100644 --- a/src/main-gtk2.c +++ b/src/main-gtk2.c @@ -52,11 +52,6 @@ #include <unistd.h> #include <dirent.h> -/* /me pffts Solaris */ -#ifndef NAME_MAX -#define NAME_MAX _POSIX_NAME_MAX -#endif - /* * Number of pixels inserted between the menu bar and the main screen diff --git a/src/main-win.c b/src/main-win.c index 67fca325..26c55a8d 100644 --- a/src/main-win.c +++ b/src/main-win.c @@ -2457,15 +2457,8 @@ ofn.lStructSize = sizeof(OPENFILENAME); -#ifdef __MWERKS__ -LRESULT FAR PASCAL AngbandWndProc(HWND hWnd, UINT uMsg, - WPARAM wParam, LPARAM lParam); -LRESULT FAR PASCAL AngbandWndProc(HWND hWnd, UINT uMsg, - WPARAM wParam, LPARAM lParam) -#else /* __MWERKS__ */ LRESULT FAR PASCAL AngbandWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -#endif /* __MWERKS__ */ { PAINTSTRUCT ps; HDC hdc; @@ -2745,15 +2738,8 @@ LRESULT FAR PASCAL AngbandWndProc(HWND hWnd, UINT uMsg, } -#ifdef __MWERKS__ -LRESULT FAR PASCAL AngbandListProc(HWND hWnd, UINT uMsg, - WPARAM wParam, LPARAM lParam); LRESULT FAR PASCAL AngbandListProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -#else /* __MWERKS__ */ -LRESULT FAR PASCAL AngbandListProc(HWND hWnd, UINT uMsg, - WPARAM wParam, LPARAM lParam) -#endif /* __MWERKS__ */ { term_data *td; MINMAXINFO FAR *lpmmi; @@ -2957,15 +2943,8 @@ LRESULT FAR PASCAL AngbandListProc(HWND hWnd, UINT uMsg, #define MOUSE_SENS 40 -#ifdef __MWERKS__ -LRESULT FAR PASCAL AngbandSaverProc(HWND hWnd, UINT uMsg, - WPARAM wParam, LPARAM lParam); -LRESULT FAR PASCAL AngbandSaverProc(HWND hWnd, UINT uMsg, - WPARAM wParam, LPARAM lParam) -#else /* __MWERKS__ */ LRESULT FAR PASCAL AngbandSaverProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -#endif /* __MWERKS__ */ { static int iMouse = 0; static WORD xMouse = 0; diff --git a/src/main-x11.c b/src/main-x11.c index e4ea7455..30f67173 100644 --- a/src/main-x11.c +++ b/src/main-x11.c @@ -112,11 +112,6 @@ #include <sys/time.h> -/* /me pffts Solaris */ -#ifndef NAME_MAX -#define NAME_MAX _POSIX_NAME_MAX -#endif - /* * This file is designed to be "included" by "main-x11.c" or "main-xaw.c", diff --git a/src/util.cc b/src/util.cc index da94f171..57bc03de 100644 --- a/src/util.cc +++ b/src/util.cc @@ -566,70 +566,6 @@ return (open(buf, flags | O_BINARY, 0)); /* -* Hack -- attempt to lock a file descriptor -* -* Legal lock types -- F_UNLCK, F_RDLCK, F_WRLCK -*/ -errr fd_lock(int fd, int what) -{ - /* XXX XXX */ - what = what ? what : 0; - - /* Verify the fd */ - if (fd < 0) return ( -1); - -#ifdef SET_UID - -# ifdef USG - -# if defined(F_ULOCK) && defined(F_LOCK) - - /* Un-Lock */ - if (what == F_UNLCK) - { - /* Unlock it, Ignore errors */ - lockf(fd, F_ULOCK, 0); - } - - /* Lock */ - else - { - /* Lock the score file */ - if (lockf(fd, F_LOCK, 0) != 0) return (1); - } - -# endif - -# else - -# if defined(LOCK_UN) && defined(LOCK_EX) - - /* Un-Lock */ - if (what == F_UNLCK) - { - /* Unlock it, Ignore errors */ - (void)flock(fd, LOCK_UN); - } - - /* Lock */ - else - { - /* Lock the score file */ - if (flock(fd, LOCK_EX) != 0) return (1); - } - -# endif - -# endif - -#endif - - /* Success */ - return (0); -} - - -/* * Hack -- attempt to seek on a file descriptor */ errr fd_seek(int fd, huge n) |