]>
Commit | Line | Data |
---|---|---|
9153c417 | 1 | /* |
997fbfa7 | 2 | * "$Id: html.c,v 1.8 2002/12/17 18:56:36 swdev Exp $" |
9153c417 | 3 | * |
4 | * CGI HTML functions. | |
5 | * | |
997fbfa7 | 6 | * Copyright 1997-2003 by Easy Software Products. |
4a409eae | 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. | |
a548a235 | 21 | * |
22 | * Contents: | |
23 | * | |
24 | * cgiStartHTML() - Start an HTML document stream. | |
25 | * cgiEndHTML() - End an HTML document stream. | |
9153c417 | 26 | */ |
27 | ||
28 | #include "cgi.h" | |
a548a235 | 29 | #include <stdarg.h> |
30 | ||
31 | ||
32 | /* | |
33 | * 'cgiStartHTML()' - Start an HTML document stream. | |
34 | */ | |
9153c417 | 35 | |
a548a235 | 36 | void |
90beaed3 | 37 | cgiStartHTML(FILE *out, /* I - Output file to use */ |
38 | const char *stylesheet, /* I - Stylesheet to use */ | |
39 | const char *author, /* I - Author name */ | |
40 | const char *keywords, /* I - Search keywords */ | |
41 | const char *description, /* I - Description of document */ | |
42 | const char *title, /* I - Title for page */ | |
43 | ...) /* I - Any addition args for title */ | |
a548a235 | 44 | { |
90beaed3 | 45 | va_list ap; /* Argument pointer */ |
a548a235 | 46 | |
47 | ||
48 | fputs("Content-type: text/html\n\n", out); | |
90beaed3 | 49 | fputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" " |
50 | "\"http://www.w3.org/TR/REC-html40/loose.dtd\">\n", out); | |
a548a235 | 51 | fputs("<HTML>\n", out); |
90beaed3 | 52 | fputs("<HEAD>\n", out); |
53 | ||
54 | fputs("\t<TITLE>\n", out); | |
55 | va_start(ap, title); | |
56 | vfprintf(out, title, ap); | |
57 | va_end(ap); | |
58 | fputs("</TITLE>\n", out); | |
a548a235 | 59 | |
90beaed3 | 60 | if (stylesheet) |
61 | fprintf(out, "\t<LINK REL=\"STYLESHEET\" TYPE=\"text/css\" HREF=\"%s\">\n", | |
62 | stylesheet); | |
63 | if (author) | |
64 | fprintf(out, "\t<META NAME=\"AUTHOR\" CONTENT=\"%s\">\n", author); | |
65 | if (keywords) | |
4a409eae | 66 | fprintf(out, "\t<META NAME=\"KEYWORDS\" CONTENT=\"%s\">\n", keywords); |
90beaed3 | 67 | if (description) |
4a409eae | 68 | fprintf(out, "\t<META NAME=\"DESCRIPTION\" CONTENT=\"%s\">\n", description); |
a548a235 | 69 | |
90beaed3 | 70 | fputs("</HEAD>\n", out); |
71 | fputs("<BODY>\n", out); | |
a548a235 | 72 | } |
73 | ||
74 | ||
75 | /* | |
76 | * 'cgiEndHTML()' - End an HTML document stream. | |
77 | */ | |
9153c417 | 78 | |
a548a235 | 79 | void |
80 | cgiEndHTML(FILE *out) /* I - Output file to use */ | |
81 | { | |
90beaed3 | 82 | fputs("</BODY>\n", out); |
a548a235 | 83 | fputs("</HTML>\n", out); |
84 | } | |
9153c417 | 85 | |
86 | ||
87 | /* | |
997fbfa7 | 88 | * End of "$Id: html.c,v 1.8 2002/12/17 18:56:36 swdev Exp $". |
9153c417 | 89 | */ |