gcgi  0.9.5
About: GCGI implements NCSA's Common Gateway Interface along with the extensions to that interface defined in RFC2388.
  Fossies Dox: gcgi-0.9.5.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

common.h
Go to the documentation of this file.
1 /* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
2 /*
3  * GCGI Library, implementing NCSA'a Common Gateway Interface and RFC2338.
4  * Copyright (C) 2001-2002 Julian Catchen, julian@catchen.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */
20 
21 #ifndef __COMMON_H__
22 #define __COMMON_H__
23 
24 #ifdef __cplusplus
25 # define BEGIN_C_DECLS extern "C" {
26 # define END_C_DECLS }
27 #else
28 # define BEGIN_C_DECLS
29 # define END_C_DECLS
30 #endif
31 
32 #if HAVE_CONFIG_H
33 # include <config.h>
34 #endif
35 
36 #include <stdio.h>
37 #include <sys/types.h>
38 
39 #if STDC_HEADERS
40 # include <stdlib.h>
41 # include <string.h>
42 #elif HAVE_STRINGS_H
43 # include <strings.h>
44 #endif /* STDC_HEADERS */
45 
46 #if HAVE_UNISTD_H
47 # include <unistd.h> /* unlink() function */
48 #endif
49 
50 #if HAVE_ERRNO_H
51 # include <errno.h>
52 #endif
53 #ifndef errno
54 extern int errno; /* Some systems #define this */
55 #endif
56 
57 #include <regex.h> /* Regular Expression Library */
58 #include <ctype.h> /* isspace() function */
59 #include <math.h> /* floor() function */
60 #include <sys/stat.h> /* umask() function */
61 
62 
64 
65 /*------ Memory Allocation Functions/Macros ------*/
66 #define XMALLOC(type, num) \
67  ((type *) xmalloc ((num) * sizeof(type)))
68 #define XREALLOC(type, p, num) \
69  ((type *) xrealloc ((p), (num) * sizeof(type)))
70 #define XFREE(stale) do { \
71  if (stale) { free (stale); stale = 0; } \
72  } while (0)
73 
74 void *xmalloc (size_t num);
75 void *xrealloc (void *p, size_t num);
76 FILE *tempFile (char *prefix, char **filename, int *fd);
77 char *readQueryFromStream(FILE *stream, int clen);
78 
80 
81 #endif /* __COMMON_H__ */
errno
int errno
END_C_DECLS
#define END_C_DECLS
Definition: common.h:29
tempFile
FILE * tempFile(char *prefix, char **filename, int *fd)
Definition: common.c:24
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: common.h:28
xmalloc
void * xmalloc(size_t num)
Definition: common.c:90
xrealloc
void * xrealloc(void *p, size_t num)
Definition: common.c:102
readQueryFromStream
char * readQueryFromStream(FILE *stream, int clen)
Definition: common.c:64