Wikihack
Advertisement

Below is the full text to system.h from the source code of NetHack 3.0.0. To link to a particular line, write [[NetHack 3.0.0/system.h#line123]], for example.

Warning! This is the source code from an old release. For the latest release, see Source code

The NetHack General Public License applies to screenshots, source code and other content from NetHack.
1.    /*	SCCS Id: @(#)system.h 3.0	88/10/10 */
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    /* NetHack may be freely redistributed.  See license for details. */
4.    
5.    #ifndef SYSTEM_H
6.    #define SYSTEM_H
7.    
8.    #define E extern
9.    
10.   #ifdef AMIGA
11.   #define _SIZE_T
12.   typedef unsigned int	size_t;
13.   #else
14.   # include <sys/types.h>
15.   #endif
16.   
17.   #ifdef ULTRIX
18.   /* The Ultrix v3.0 <sys/types.h> seems to be very wrong. */
19.   #define off_t long
20.   #define time_t long
21.   #endif
22.   
23.   /* some old <sys/types.h> may not define off_t and size_t; if your system is
24.    * one of these, define them here
25.    */
26.   #ifdef MSDOS
27.   # ifndef _SIZE_T
28.   #define _SIZE_T
29.   typedef unsigned int	size_t;
30.   # endif
31.   # ifdef __TURBOC__
32.   typedef long  off_t;
33.   # endif
34.   #endif
35.   
36.   /* You may want to change this to fit your system, as this is almost
37.    * impossible to get right automatically.
38.    * This is the type of signal handling functions.
39.    */
40.   #if defined(__STDC__) || defined(ULTRIX)
41.   	/* also SVR3 and later, Sun4.0 and later */
42.   #define SIG_RET_TYPE void (*)()
43.   #else
44.   	/* BSD, SIII, SVR2 and earlier, Sun3.5 and earlier */
45.   #define SIG_RET_TYPE int (*)()
46.   #endif
47.   
48.   #if defined(BSD) || defined(ULTRIX) || defined(RANDOM)
49.   E long random();
50.   E void srandom P((unsigned int));
51.   #else
52.   E long lrand48();
53.   E void srand48();
54.   #endif /* BSD || ULTRIX || RANDOM */
55.   
56.   #if !defined(BSD) || defined(ultrix)
57.   			/* real BSD wants all these to return int */
58.   # ifndef MSDOS
59.   E void exit P((int));
60.   # endif /* MSDOS */
61.   E void free P((genericptr_t));
62.   E void perror P((const char *));
63.   #endif
64.   
65.   #if defined(BSD) || defined(ULTRIX)
66.   E int qsort();
67.   #else
68.   E void qsort P((genericptr_t,size_t,size_t,int(*)(genericptr_t,genericptr_t)));
69.   #endif
70.   
71.   #ifdef ULTRIX
72.   E long lseek P((int,off_t,int));
73.     /* Ultrix 3.0 man page mistakenly says it returns an int. */
74.   E int write P((int,char *,int));
75.   #else
76.   E long lseek P((int,long,int));
77.   E int write P((int,genericptr_t,unsigned));
78.   #ifdef MSDOS
79.   E int close P((int));
80.   E int read P((int,genericptr_t,unsigned int));
81.   E int open P((const char *,int,...));
82.   E int dup2 P((int, int));
83.   E int setmode P((int,int));
84.   E int kbhit P((void));
85.   #endif
86.   #endif /* ULTRIX */
87.   
88.   #ifdef MSDOS
89.   E int chdir P((char *));
90.   E char *getcwd P((char *,int));
91.   #endif
92.   
93.   /* both old & new versions of Ultrix want these, but real BSD does not */
94.   #ifdef ultrix
95.   E void abort();
96.   E void bcopy();
97.   #endif
98.   #ifdef MSDOS
99.   E void abort P((void));
100.  E void _exit P((int));
101.  E int system P((const char *));
102.  #endif
103.  
104.  #ifdef SYSV
105.  E char *memcpy();
106.  #endif
107.  #ifdef MSDOS
108.  E int memcmp P((char *,char *,unsigned int));
109.  E char *memcpy P((char *,char *,unsigned int));
110.  E char *memset P((char*,int,int));
111.  #endif
112.  
113.  #if defined(BSD) && defined(ultrix)	/* i.e., old versions of Ultrix */
114.  E void sleep();
115.  #endif
116.  #if defined(ULTRIX) || defined(SYSV)
117.  E unsigned sleep();
118.  #endif
119.  
120.  E char *getenv P((const char *));
121.  E char *getlogin();
122.  E int getpid();
123.  
124.  /*# string(s).h #*/
125.  
126.  E char	*strcpy P((char *,const char *));
127.  E char	*strncpy P((char *,const char *,size_t));
128.  E char	*strcat P((char *,const char *));
129.  E char	*strncat P((char *,const char *,size_t));
130.  
131.  #if defined(SYSV) || defined(MSDOS)
132.  E char	*strchr P((const char *,int));
133.  E char	*strrchr P((const char *,int));
134.  #else /* BSD */
135.  E char	*index P((const char *,int));
136.  E char	*rindex P((const char *,int));
137.  #endif
138.  
139.  
140.  E int	strcmp P((const char *,const char *));
141.  E int	strncmp P((const char *,const char *,size_t));
142.  #ifdef MSDOS
143.  E size_t strlen P((const char *));
144.  #else
145.  E int	strlen();
146.  #endif
147.  
148.  /* Old varieties of BSD have char *sprintf().
149.   * Newer varieties of BSD have int sprintf() but allow for the old char *.
150.   * Several varieties of SYSV and PC systems also have int sprintf().
151.   * If your system doesn't agree with this breakdown, you may want to change
152.   * this declaration, especially if your machine treats the types differently.
153.   */
154.  #if defined(BSD) || defined(ULTRIX)
155.  #define OLD_SPRINTF
156.  E char *sprintf();
157.  #else
158.  E int sprintf P((char *,const char *,...));
159.  #endif
160.  
161.  #define Sprintf	(void) sprintf
162.  #define Strcat	(void) strcat
163.  #define Strcpy	(void) strcpy
164.  #define Printf  (void) printf
165.  
166.  E int tgetent P((char *,char *));
167.  E int tgetnum P((char *));
168.  E int tgetflag P((char *));
169.  E char *tgetstr P((char *,char **));
170.  E char *tgoto P((char *,int,int));
171.  E void tputs P((char *,int,int (*)()));
172.  
173.  E genericptr_t malloc P((size_t));
174.  
175.  /* time functions */
176.  
177.  E struct tm *localtime P((const time_t *));
178.  
179.  #if (defined(ULTRIX) || defined(SYSV) || defined(MSDOS)) && !defined(AMIGA)
180.  E time_t time P((time_t *));
181.  #else
182.  E long time P((time_t *));
183.  #endif /* ULTRIX */
184.  
185.  #ifdef MSDOS
186.  E int abs P((int));
187.  E int atoi P((char *));
188.  #endif
189.  
190.  #undef E
191.  
192.  #endif /* SYSTEM_H */
Advertisement