Mercurial > hg > early-roguelike
changeset 118:8d1dfc5a912c
srogue: add a complete mdport.c.
srogue/mdport.c is copied from rogue5/mdport.c, with slight changes.
| author | John "Elwin" Edwards |
|---|---|
| date | Sun, 27 Apr 2014 08:29:14 -0700 |
| parents | 2c62bd925c17 |
| children | 458df24e973d |
| files | srogue/configure.ac srogue/mdport.c srogue/rogue.h |
| diffstat | 3 files changed, 908 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/srogue/configure.ac Sat Apr 26 08:52:26 2014 -0700 +++ b/srogue/configure.ac Sun Apr 27 08:29:14 2014 -0700 @@ -12,7 +12,7 @@ MP_WITH_CURSES # Checks for header files. AC_HEADER_STDC -#AC_CHECK_HEADERS([arpa/inet.h pwd.h errno.h fcntl.h limits.h nlist.h stdlib.h string.h sys/ioctl.h termios.h unistd.h utmp.h utmpx.h term.h ncurses/term.h process.h]) +AC_CHECK_HEADERS([arpa/inet.h pwd.h errno.h fcntl.h limits.h nlist.h stdlib.h string.h sys/ioctl.h termios.h unistd.h term.h ncurses/term.h process.h]) # Checks for typedefs, structures, and compiler characteristics. AC_TYPE_SIZE_T @@ -23,7 +23,7 @@ AC_TYPE_SIGNAL AC_FUNC_STAT AC_FUNC_VPRINTF -#AC_CHECK_FUNCS([erasechar killchar alarm getpass memset setenv strchr nlist _spawnl spawnl getpwuid loadav getloadavg strerror setgid setuid getuid getgid]) +AC_CHECK_FUNCS([erasechar killchar alarm getpass memset setenv strchr nlist _spawnl spawnl getpwuid loadav getloadavg strerror setgid setuid getuid getgid]) AC_PROG_INSTALL AC_ARG_WITH(program-name, AC_HELP_STRING([--with-program-name=NAME],[alternate executable name]),[progname="$withval" ], [progname="srogue"] )
--- a/srogue/mdport.c Sat Apr 26 08:52:26 2014 -0700 +++ b/srogue/mdport.c Sun Apr 27 08:29:14 2014 -0700 @@ -29,11 +29,6 @@ SUCH DAMAGE. */ -/* This is a temporary stub version of rogue5's mdport.c. It is only to make - * md_readchar() available until srogue is ported to autoconf. Then the - * whole file should work. - */ - #include <stdlib.h> #include <string.h> @@ -49,12 +44,758 @@ #undef MOUSE_MOVED #endif +#include <curses.h> +#include "rogue.h" + +#if defined(HAVE_SYS_TYPES) #include <sys/types.h> +#endif + +#if defined(HAVE_PROCESS_H) +#include <process.h> +#endif + +#if defined(HAVE_PWD_H) +#include <pwd.h> +#endif + +#if defined(HAVE_SYS_UTSNAME) +#include <sys/utsname.h> +#endif + +#if defined(HAVE_ARPA_INET_H) +#include <arpa/inet.h> /* Solaris 2.8 required this for htonl() and ntohl() */ +#endif + +#if defined(HAVE_TERMIOS_H) +#include <termios.h> +#endif + +#if defined(HAVE_UNISTD_H) +#ifndef __USE_GNU +#define __USE_GNU +#include <unistd.h> +#undef __USE_GNU +#else +#include <unistd.h> +#endif +#endif #include <curses.h> /* AIX requires curses.h be included before term.h */ +#if defined(HAVE_TERM_H) +#include <term.h> +#elif defined(HAVE_NCURSES_TERM_H) +#include <ncurses/term.h> +#endif + +#if defined(HAVE_WORKING_FORK) +#include <sys/wait.h> +#endif + #include <ctype.h> -#include "rogue.h" +#include <fcntl.h> +#include <limits.h> +#include <sys/stat.h> +#include <signal.h> + +#if !defined(PATH_MAX) && defined(_MAX_PATH) +#define PATH_MAX _MAX_PATH +#endif + +#if !defined(PATH_MAX) && defined(_PATH_MAX) +#define PATH_MAX _PATH_MAX +#endif + +#define NOOP(x) (x += 0) + +void +md_init(void) +{ +#if defined(__INTERIX) + char *term; + + term = getenv("TERM"); + + if (term == NULL) + setenv("TERM","interix"); +#elif defined(__DJGPP__) + _fmode = _O_BINARY; +#elif defined(_WIN32) + _fmode = _O_BINARY; +#endif + +#if defined(HAVE_ESCDELAY) || defined(NCURSES_VERSION) + ESCDELAY=64; +#endif + +#if defined(DUMP) + md_onsignal_default(); +#else + md_onsignal_exit(); +#endif
