]> git.ipfire.org Git - thirdparty/cups.git/blob - cgi-bin/cgi.h
Import cups.org releases
[thirdparty/cups.git] / cgi-bin / cgi.h
1 /*
2 * "$Id$"
3 *
4 * CGI support library definitions.
5 *
6 * Copyright 1997-2000 by Easy Software Products.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 * for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 */
22
23 #ifndef _CGI_H_
24 # define _CGI_H_
25
26 # include <stdio.h>
27 # include <stdlib.h>
28 # include <string.h>
29 # include <ctype.h>
30
31 # ifdef WIN32
32 # include <direct.h>
33 # include <io.h>
34 # include <malloc.h>
35 # define strcasecmp(s,t) stricmp((s),(t))
36 # define strncasecmp(s,t,n) strnicmp((s),(t),(n))
37 # else
38 # include <unistd.h>
39 # endif /* WIN32 */
40
41
42 /*
43 * Prototypes...
44 */
45
46 extern int cgiInitialize(void);
47 extern void cgiAbort(const char *title, const char *stylesheet,
48 const char *format, ...);
49 extern int cgiCheckVariables(const char *names);
50 extern const char *cgiGetArray(const char *name, int element);
51 extern int cgiGetSize(const char *name);
52 extern void cgiSetSize(const char *name, int size);
53 extern const char *cgiGetVariable(const char *name);
54 extern void cgiSetArray(const char *name, int element,
55 const char *value);
56 extern void cgiSetVariable(const char *name, const char *value);
57 extern void cgiCopyTemplateFile(FILE *out, const char *tmpl);
58 extern void cgiCopyTemplateLang(FILE *out, const char *directory,
59 const char *tmpl, const char *lang);
60
61 extern void cgiStartHTML(FILE *out, const char *author,
62 const char *stylesheet,
63 const char *keywords,
64 const char *description,
65 const char *title, ...);
66 extern void cgiEndHTML(FILE *out);
67
68 extern FILE *cgiEMailOpen(const char *from, const char *to,
69 const char *cc, const char *subject,
70 int multipart);
71 extern void cgiEMailPart(FILE *mail, const char *type,
72 const char *charset, const char *encoding);
73 extern void cgiEMailClose(FILE *mail);
74
75 extern char *cgiGetCookie(const char *name, char *buf, int buflen);
76 extern void cgiSetCookie(const char *name, const char *value,
77 const char *path, const char *domain,
78 time_t expires, int secure);
79
80 # define cgiGetUser() getenv("REMOTE_USER")
81 # define cgiGetHost() (getenv("REMOTE_HOST") == NULL ? getenv("REMOTE_ADDR") : getenv("REMOTE_HOST"))
82
83 #endif /* !_CGI_H_ */
84
85 /*
86 * End of "$Id$".
87 */