File: compatible.h

package info (click to toggle)
gopher 2.3-2
  • links: PTS
  • area: non-free
  • in suites: hamm
  • size: 2,364 kB
  • ctags: 2,030
  • sloc: ansic: 22,451; perl: 1,950; sh: 1,510; makefile: 397; asm: 1
file content (374 lines) | stat: -rw-r--r-- 9,478 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
/********************************************************************
 * $Author: lindner $
 * $Revision: 3.39 $
 * $Date: 1996/01/04 18:25:48 $
 * $Source: /home/arcwelder/GopherSrc/CVS/gopher+/object/compatible.h,v $
 * $State: Exp $
 *
 * Paul Lindner, University of Minnesota CIS.
 *
 * Copyright 1991, 1992 by the Regents of the University of Minnesota
 * see the file "Copyright" in the distribution for conditions of use.
 *********************************************************************
 * MODULE: compatible.h
 * Header file to make things compatible and define stuff in compatible.c
 *********************************************************************
 * Revision History:
 * $Log: compatible.h,v $
 * Revision 3.39  1996/01/04  18:25:48  lindner
 * Updates for autoconf
 *
 * Revision 3.38  1995/10/04  22:31:54  lindner
 * Add stdio for FILE* defs.
 *
 * Revision 3.37  1995/09/25  22:18:21  lindner
 * Next update
 *
 * Revision 3.36  1995/09/25  22:07:23  lindner
 * Ansification
 *
 * Revision 3.35  1995/05/01  05:41:45  lindner
 * compatibility fixes
 *
 * Revision 3.34  1995/02/01  21:46:25  lindner
 * Remove f from fgetpwent prototype
 *
 * Revision 3.33  1995/02/01  21:43:55  lindner
 * Add ultrix to machines that don't have fgetpwent
 *
 * Revision 3.32  1994/12/15  17:30:16  lindner
 * A replacement fgetpwent
 *
 * Revision 3.31  1994/11/24  08:09:53  lindner
 * Back to regular
 *
 * Revision 3.30  1994/11/18  22:04:33  lindner
 * Fix for FreeWAIS on NeXT machines
 *
 * Revision 3.29  1994/10/13  05:26:58  lindner
 * Add case for sequents
 *
 * Revision 3.28  1994/08/19  16:27:07  lindner
 * mktime() addition, sequent handling
 *
 * Revision 3.27  1994/07/22  17:19:08  lindner
 * AUX doesn't have strcoll
 *
 * Revision 3.26  1994/07/21  22:18:07  lindner
 * Add NO_PUTENV, NO_STRCOLL
 *
 * Revision 3.25  1994/07/06  02:59:12  lindner
 * DECC has strftime()
 *
 * Revision 3.24  1994/06/29  06:40:57  lindner
 * ifndef NO_UNISTD_H, include it so we can use POSIX stuff
 * use POSIX alternatives for getdtablesize()
 * ifdef _POSIX_SOURCE use POSIX functions like getcwd(), etc. (Coopersmith)
 *
 * Revision 3.23  1994/05/14  04:14:40  lindner
 * Fix for svr4.2 on unisys
 *
 * Revision 3.22  1994/05/11  02:41:57  lindner
 * Automagically define NO_VFORK for SCO
 *
 * Revision 3.21  1994/04/25  03:36:17  lindner
 * eliminate redefinition of open to open_vmsopt() for ALPHA (Fote)
 *
 * Revision 3.20  1994/04/08  20:05:56  lindner
 * gcc -Wall fixes
 *
 * Revision 3.19  1994/04/01  04:44:49  lindner
 * Fix for VMS
 *
 * Revision 3.18  1994/03/17  04:38:21  lindner
 * VMS weird directory routines
 *
 * Revision 3.17  1994/03/08  07:28:42  lindner
 * Fix for vfork on Aix
 *
 * Revision 3.16  1994/03/08  03:23:50  lindner
 * Waitpid for vms
 *
 * Revision 3.15  1994/03/07  04:43:54  lindner
 * Add pid_t, vfork
 *
 * Revision 3.14  1993/11/05  07:24:15  lindner
 * Fixes for NeXTs
 *
 * Revision 3.13  1993/10/27  18:51:12  lindner
 * Updates for VMS files/records
 *
 * Revision 3.12  1993/09/28  19:23:56  lindner
 * update for VMS getwd()
 *
 * Revision 3.11  1993/08/16  19:40:58  lindner
 * Fixes for Sequent Dynix
 *
 * Revision 3.10  1993/08/03  20:57:42  lindner
 * Really fix it for hocky pucks
 *
 * Revision 3.9  1993/08/03  06:43:48  lindner
 * Compatibility fix for hpux and seteguid
 *
 * Revision 3.8  1993/07/27  05:30:29  lindner
 * Mondo Debug overhaul from Mitra
 *
 * Revision 3.7  1993/07/20  23:33:27  lindner
 * Fix for NeXTs and pid_t
 *
 * Revision 3.6  1993/07/14  20:37:40  lindner
 * Fixes for VMS
 *
 * Revision 3.5  1993/07/07  19:29:19  lindner
 * Added LINGER compatibility option
 *
 * Revision 3.4  1993/06/22  05:53:19  lindner
 * Added getdtablesize() option
 *
 * Revision 3.3  1993/06/15  06:12:14  lindner
 * Updates for Solaris
 *
 * Revision 3.2  1993/04/15  21:36:33  lindner
 * Emulation of geteuid calls for HPs
 *
 * Revision 3.1.1.1  1993/02/11  18:03:05  lindner
 * Gopher+1.2beta release
 *
 * Revision 1.7  1993/01/14  21:58:02  lindner
 * Added #define that makes compatible compile fine under UCX
 *
 * Revision 1.6  1993/01/11  19:56:20  lindner
 * Fixed prototype for strcasecmp
 *
 * Revision 1.5  1993/01/09  02:25:57  lindner
 * Added definition for SIG_ERR for systems that don't have it.
 *
 * Revision 1.4  1993/01/08  23:17:20  lindner
 * Added more mods for VMS.
 *
 * Revision 1.3  1993/01/06  23:09:44  lindner
 * Added definition for AIX370 for strdup()
 *
 * Revision 1.2  1992/12/31  04:42:02  lindner
 * Changes for VMS, new switch NO_STRCASECMP
 *
 * Revision 1.1  1992/12/10  23:27:52  lindner
 * gopher 1.1 release
 *
 *
 *********************************************************************/
/*
 * Protoize a little 
 */

#ifndef compatible_h_
#define compatible_h_
#include <config.h>		/* Import autoconf variables */


/******************** get Unix standard definitions **/
#if defined(HAVE_UNISTD_H)
#  include <unistd.h> 
#endif

/******************** for SIG_ERR **/
#include <signal.h>

#if !defined(SIG_ERR) && defined(sequent) && defined(BADSIG)
#  define SIG_ERR  BADSIG
#endif

#ifndef SIG_ERR
#  if defined(sequent) && defined(BADSIG)
#    define SIG_ERR	    BADSIG
#  else
#    ifdef __STDC__
#      define SIG_ERR         ((void (*) (int))-1)
#    else
#      define SIG_ERR         ((void (*) ())-1)
#    endif        /* __STDC__ */
#  endif
#endif        /* SIG_ERR */



/******************** for strstr() **/

#if !defined(HAVE_STRSTR)
   char *Gopher_strstr(char *, char *);
#  define strstr Gopher_strstr
#endif

/******************** for tempnam() **/

#if !defined(HAVE_TEMPNAM)
   char *tempnam(char *dir, char *pfx);
#endif

/******************************** for strdup() **/

#if !defined(HAVE_STRDUP)
   char *goph_strdup(char *);
#  define strdup goph_strdup
#endif

/********************** For bzero()/bcopy() etc */

#if !defined(HAVE_BZERO)

#define bzero(a,b)   memset(a,'\0',b)
#define bcopy(a,b,c) memcpy(b,a,c)
     
#endif

/********************* For getwd() */

#if !defined(HAVE_GETWD)
# define getwd(a) getcwd(a,sizeof(a))
#endif

/********************* For tzset() */

#if !defined(HAVE_TZSET)
  void tzset();
#endif

/******************** For strcasecmp() */

#if defined(NO_STRCASECMP) || defined(VMS) || defined(__USLC__)
#  undef NO_STRCASECMP
#  define NO_STRCASECMP
   int strcasecmp(const char *, const char *);
   int strcasecmp(const char *, const char *, size_t);
#endif

/******************** For geteuid() */

#if !defined(HAVE_SETEUID)
#  if defined (__hpux)
#    define seteuid(x) setresuid(-1,x,-1)
#    define setegid(x) setresgid(-1,x,-1)  
#  endif
#  if defined(_SEQUENT_)
#    define seteuid(x) setreuid(-1,x)
#    define setegid(x) setregid(-1,x)
#  endif
#endif


/********************* For getdtablesize() **/
#if !defined(HAVE_GETDTABLESIZE)
# if defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE) || defined(HAVE_SYSCONF)

#   ifdef _SC_OPEN_MAX	/* prefered POSIX method */
#    define    getdtablesize()	sysconf(_SC_OPEN_MAX) 
#   else /* if !defined(systems_without_limits.h) */
#    include <limits.h>
#    ifdef _POSIX_OPEN_MAX    /* alternate POSIX method */
#     define   getdtablesize()	(_POSIX_OPEN_MAX)
#    else
#     define NEED_GETDTABLESIZE 1
      int getdtablesize();
#    endif
#   endif
#  endif
#else
# define NEED_GETDTABLESIZE 1
  int getdtablesize();
#endif
/********************* For VMS */

#if defined(VMS)
#  include <stdio.h>

#  define popen(a,b) fopen(a,b)
#  define pclose(a)  fclose(a)
#  define unlink delete

#  define fopen fopen_VMSopt
   FILE *fopen_VMSopt();
#ifndef __ALPHA
#  define open open_VMSopt
   int open_VMSopt();
#endif

#  if defined(UCX)
#    define closenet close
#  endif

   FILE *fopen_VAR();
   FILE *fopen_FIX();

#else
   /* non-VMS systems don't need a special netclose either */
#  define closenet close

#endif  /** VMS **/


/**********  For linger setsockopt() ***/

#if defined(linux) || defined(_SEQUENT_)
#  define NO_LINGER
#endif

/********** For NeXTs **************/
#ifdef NeXT
#  define ANSI_LIKE  /** freeWAIS bastards! **/
#endif

/********* Systems that can't set proctitles *******/
#if defined(_AUX_SOURCE) || defined(__svr4__) || defined(apollo)
#   undef SETPROCTITLE
#endif

/********* Fix for old stat.h stuff on bsd (I think) ******/
#if defined(NeXT) || defined(sequent) || defined(NO_NEWSTATDOTH)
#define S_IXUSR S_IEXEC
#endif

/*

Now fixed by autoconf... 

#if defined(VMS) || defined(NeXT) || defined(sequent) || defined(NO_PID_T)
  typedef int pid_t;
#endif
*/

/********* strftime() - should be present in ANSI C libraries ******/
#ifndef __DECC
#if defined(sequent) || defined(NO_STRFTIME) || defined(VMS)
#  undef HAVE_STRFTIME
   int strftime(char *buf, int bufsize, char *fmt, struct tm *tm);
#endif
#endif /* __DECC */

/********* mktime() - should be present in ANSI C libraries ******/
#if defined(NO_MKTIME) || defined(sequent)
#  undef NO_MKTIME
#  define NO_MKTIME
#endif


/********* strcoll - should be present in ANSI C libraries ******/
#include "String.h"  /* include this here for broken strcolls */
#if !defined(HAVE_STRCOLL)
#  define strcoll strcmp
#endif


/******** putenv, in most systems except old BSD... *********/
#if !defined(HAVE_PUTENV)
   int putenv(char *);
#endif

/******* fgetpwent(), sortof non-standard BSD derived fcn *******/
#if !defined(HAVE_FGETPWENT)
#  include <pwd.h>
#  include <stdio.h>

   struct passwd *fgetpwent(FILE *);
#endif

#endif  /* compatible_h_ */