Mercurial > hg > early-roguelike
annotate srogue/rogue.h @ 190:f4f6734771e0
srogue: add and use md_fdopen().
The implementation was copied from rogue4.  Using fdopen() is necessary
because the scorefile needs both encread() and encwrite().  For some
reason I have failed to discover, one of them uses FILE *'s and the
other uses file descriptors.
| author | John "Elwin" Edwards | 
|---|---|
| date | Mon, 03 Aug 2015 09:27:43 -0400 | 
| parents | 10c273a62228 | 
| children | fb25a62680c7 | 
| rev | line source | 
|---|---|
| 36 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 1 /* | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 2 * Rogue definitions and variable declarations | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 3 * | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 4 * @(#)rogue.h 9.0 (rdk) 7/17/84 | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 5 * | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 6 * Super-Rogue | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 7 * Copyright (C) 1984 Robert D. Kindelberger | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 8 * All rights reserved. | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 9 * | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 10 * Based on "Rogue: Exploring the Dungeons of Doom" | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 11 * Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 12 * All rights reserved. | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 13 * | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 14 * See the file LICENSE.TXT for full copyright and licensing information. | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 15 */ | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 16 | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 17 #ifdef BSD | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 18 #include "cx.h" | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 19 #endif | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 20 | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 21 | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 22 #include <ctype.h> | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 23 #include <curses.h> | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 24 | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 25 #ifdef ATT | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 26 #define CBREAK FALSE | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 27 #define _IOSTRG 01 | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 28 #endif | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 29 | 
| 101 | 30 #ifdef HAVE_CONFIG_H | 
| 31 #include "config.h" | |
| 32 #endif | |
| 33 | |
| 118 | 34 /* mdport functions */ | 
| 35 #ifdef HAVE_SYS_TYPES_H | |
| 36 #include <sys/types.h> | |
| 37 #endif | |
| 38 | |
| 39 int md_chmod(const char *filename, int mode); | |
| 40 char *md_crypt(const char *key, const char *salt); | |
| 41 int md_dsuspchar(void); | |
| 42 int md_erasechar(void); | |
| 190 | 43 FILE * md_fdopen(int fd, char *mode); | 
| 118 | 44 char *md_gethomedir(void); | 
| 45 char *md_getusername(void); | |
| 46 uid_t md_getuid(void); | |
| 120 
d6b7c3fb37ea
srogue: add and use more md_* portable functions.
 John "Elwin" Edwards parents: 
118diff
changeset | 47 gid_t md_getgid(void); | 
| 118 | 48 char *md_getpass(char *prompt); | 
| 49 pid_t md_getpid(void); | |
| 50 char *md_getrealname(uid_t uid); | |
| 51 void md_init(void); | |
| 52 int md_killchar(void); | |
| 53 void md_normaluser(void); | |
| 54 void md_raw_standout(void); | |
| 55 void md_raw_standend(void); | |
| 56 int md_readchar(WINDOW *win); | |
| 57 int md_setdsuspchar(int c); | |
| 58 int md_shellescape(void); | |
| 59 void md_sleep(int s); | |
| 60 int md_suspchar(void); | |
| 61 int md_hasclreol(void); | |
| 62 int md_unlink(char *file); | |
| 63 int md_unlink_open_file(const char *file, FILE *inf); | |
| 64 void md_tstpsignal(void); | |
| 65 void md_tstphold(void); | |
| 66 void md_tstpresume(void); | |
| 67 void md_ignoreallsignals(void); | |
| 68 void md_onsignal_autosave(void); | |
| 69 void md_onsignal_exit(void); | |
| 70 void md_onsignal_default(void); | |
| 71 int md_issymlink(char *sp); | |
| 120 
d6b7c3fb37ea
srogue: add and use more md_* portable functions.
 John "Elwin" Edwards parents: 
118diff
changeset | 72 long md_memused(void); | 
| 121 
e6c8652473fe
srogue: more compatibility improvements.
 John "Elwin" Edwards parents: 
120diff
changeset | 73 int md_random(void); | 
| 
e6c8652473fe
srogue: more compatibility improvements.
 John "Elwin" Edwards parents: 
120diff
changeset | 74 void md_srandom(unsigned int seed); | 
| 118 | 75 char *xcrypt(const char *key, const char *setting); | 
| 76 | |
| 36 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 77 #define reg register /* register abbr. */ | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 78 | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 79 /* | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 80 * Maximum number of different things | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 81 */ | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 82 | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 83 #define NCOLORS 32 | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 84 #define NSYLS 159 | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 85 #define NSTONES 35 | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 86 #define NWOOD 24 | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 87 #define NMETAL 15 | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 88 | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 89 #define MAXDAEMONS 20 | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 90 | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 91 #define TYPETRAPS 9 /* max types of traps */ | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 92 #define MAXROOMS 9 /* max rooms per level */ | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 93 #define MAXTHINGS 9 /* max things on each level */ | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 94 #define MAXOBJ 9 /* max goodies on each level */ | 
| 
2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
 elwin parents: diff
changeset | 95 #define MAXPACK 23 /* max things this hero can carry */ | 
