|
|
1.1 root 1:
2: /* This file contains code for X-CHESS.
3: Copyright (C) 1986 Free Software Foundation, Inc.
4:
5: This file is part of X-CHESS.
6:
7: X-CHESS is distributed in the hope that it will be useful,
8: but WITHOUT ANY WARRANTY. No author or distributor
9: accepts responsibility to anyone for the consequences of using it
10: or for whether it serves any particular purpose or works at all,
11: unless he says so in writing. Refer to the X-CHESS General Public
12: License for full details.
13:
14: Everyone is granted permission to copy, modify and redistribute
15: X-CHESS, but only under the conditions described in the
16: X-CHESS General Public License. A copy of this license is
17: supposed to have been given to you along with X-CHESS so you
18: can know your rights and responsibilities. It should be in a
19: file named COPYING. Among other things, the copyright notice
20: and this notice must be preserved on all copies. */
21:
22:
23: /* RCS Info: $Revision: 1.2 $ on $Date: 86/11/23 17:18:32 $
24: * $Source: /users/faustus/xchess/RCS/std.h,v $
25: * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
26: *
27: * Standard definitions.
28: */
29:
30: #define UNIX
31: #define BSD
32:
33: #ifndef FILE
34: #include <stdio.h>
35: #endif
36: #ifndef isalpha
37: #include <ctype.h>
38: #endif
39: #ifndef HUGE
40: #include <math.h>
41: #endif
42: #include <strings.h>
43:
44: typedef int bool;
45:
46: #define false 0
47: #define true 1
48:
49: /* Externs defined in std.c */
50:
51: extern char *tmalloc();
52: extern char *trealloc();
53: extern char *copy();
54: extern char *datestring();
55: extern char *getusername();
56: extern char *gethome();
57: extern char *gettok();
58: extern char *tildexpand();
59: extern void fatal();
60: extern void setenv();
61: extern void appendc();
62: extern int scannum();
63: extern int seconds();
64: extern bool prefix();
65: extern bool ciprefix();
66: extern bool cieq();
67: extern bool substring();
68:
69: /* Externs from libc */
70:
71: extern char *getenv();
72: extern int errno;
73: extern char *sys_errlist[];
74:
75: /* Should use BSIZE instead of BUFSIZ... */
76:
77: #define BSIZE 512
78:
79: /* Some standard macros. */
80:
81: #define eq(a,b) (!strcmp((a), (b)))
82: #define isalphanum(c) (isalpha(c) || isdigit(c))
83: #define alloc(strname) ((struct strname *) tmalloc(sizeof(struct strname)))
84: #define tfree(ptr) { if (ptr) free((char *) ptr); ptr = 0; }
85: #define hexnum(c) ((((c) >= '0') && ((c) <= '9')) ? ((c) - '0') : ((((c) >= \
86: 'a') && ((c) <= 'f')) ? ((c) - 'a' + 10) : ((((c) >= 'A') && \
87: ((c) <= 'F')) ? ((c) - 'A' + 10) : 0)))
88:
89: #ifndef BSD
90: #define random rand
91: #define srandom srand
92: #endif BSD
93:
94: #ifdef VMS
95:
96: #define EXIT_NORMAL 1
97: #define EXIT_BAD 0
98:
99: #else VMS
100:
101: #define EXIT_NORMAL 0
102: #define EXIT_BAD 1
103:
104: #endif VMS
105:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.