[Fedora-directory-commits] adminserver/admserv/cgi-src40 help.c, 1.9, 1.10
Nathan Kinder (nkinder)
fedora-directory-commits at redhat.com
Wed Aug 8 22:23:21 UTC 2007
- Previous message (by thread): [Fedora-directory-commits] ldapserver Makefile.am, 1.53, 1.54 Makefile.in, 1.62, 1.63 ltmain.sh, 1.16, 1.17
- Next message (by thread): [Fedora-directory-commits] ldapserver Makefile.in, 1.63, 1.64 aclocal.m4, 1.45, 1.46 autogen.sh, 1.2, 1.3 config.guess, 1.34, 1.35 config.h.in, 1.7, 1.8 config.sub, 1.34, 1.35 configure, 1.56, 1.57 depcomp, 1.35, 1.36 install-sh, 1.35, 1.36 ltmain.sh, 1.17, 1.18 missing, 1.35, 1.36
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: nkinder
Update of /cvs/dirsec/adminserver/admserv/cgi-src40
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv714
Modified Files:
help.c
Log Message:
Resolves: 251418
Summary: Added header and footer support to help.cgi.
Index: help.c
===================================================================
RCS file: /cvs/dirsec/adminserver/admserv/cgi-src40/help.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- help.c 22 Jun 2007 01:34:19 -0000 1.9
+++ help.c 8 Aug 2007 22:23:18 -0000 1.10
@@ -74,6 +74,8 @@
#define DIR_VAR "HelpDirectory"
#define HELPWIN_VAR "HelpWindow"
#define TOKEN_FILE "index.map"
+#define HEADER_FILE "header.htm"
+#define FOOTER_FILE "footer.htm"
#define HEAD_BLOCK "<head>"
#define FRAME_BLOCK "<frame "
#define TITLE_BLOCK "<title>"
@@ -279,7 +281,6 @@
{
char path[PATH_LENGTH];
char base[PATH_LENGTH];
- char *dirp;
FILE *file = NULL;
if (debugPrintout)
@@ -287,8 +288,33 @@
printf( "New help<P>\n" );
}
- /* Open the target file and return the contents */
+ /* read and flush the header to stdout */
+ safe_snprintf(path, sizeof(path), "%s%c%s%c%s%c%s", MANUALDIR, FILE_SEP, locale, FILE_SEP,
+ product, FILE_SEP, HEADER_FILE);
+ if (!(file = fopen(path, "r")))
+ {
+ safe_snprintf(base, sizeof(base), "unable to open file: %s", path);
+ if (debugPrintout)
+ {
+ printf("%s<P>\n", base);
+ fflush( stdout );
+ }
+ return error_exit(base);
+ }
+ if (debugPrintout)
+ {
+ printf("reading file: %s<P>\n", path);
+ }
+ if (!didContentHeader)
+ {
+ printf("Content-type: text/html\n\n");
+ }
+ while (fgets(path, PATH_LENGTH, file))
+ {
+ fputs(path, stdout);
+ }
+ /* Open the target file and return the contents */
safe_snprintf(path, sizeof(path), "%s%c%s%c%s%c%s", MANUALDIR, FILE_SEP, locale, FILE_SEP,
product, FILE_SEP, content);
if (!(file = fopen(path, "r")))
@@ -305,22 +331,31 @@
{
printf("reading file: %s<P>\n", path);
}
+ while (fgets(path, PATH_LENGTH, file))
+ {
+ fputs(path, stdout);
+ }
- /* spit out the output, inserting a BASE tag into the HEAD block */
- if (dirp = strchr(content, FILE_SEP)) {
- safe_snprintf(base, sizeof(base), "<base href=\"/%s/%s/%s/help/%.*s/\">", "manual", locale, product,
- (dirp-content), content);
- } else {
- safe_snprintf(base, sizeof(base), "<base href=\"/%s/%s/%s/help/\">", "manual", locale, product);
+ /* read and flush the footer to stdout */
+ safe_snprintf(path, sizeof(path), "%s%c%s%c%s%c%s", MANUALDIR, FILE_SEP, locale, FILE_SEP,
+ product, FILE_SEP, FOOTER_FILE);
+ if (!(file = fopen(path, "r")))
+ {
+ safe_snprintf(base, sizeof(base), "unable to open file: %s", path);
+ if (debugPrintout)
+ {
+ printf("%s<P>\n", base);
+ fflush( stdout );
+ }
+ return error_exit(base);
}
- if (!didContentHeader)
+ if (debugPrintout)
{
- printf("Content-type: text/html\n\n");
+ printf("reading file: %s<P>\n", path);
}
-
while (fgets(path, PATH_LENGTH, file))
{
- fputs(path, stdout);
+ fputs(path, stdout);
}
/* finished */
- Previous message (by thread): [Fedora-directory-commits] ldapserver Makefile.am, 1.53, 1.54 Makefile.in, 1.62, 1.63 ltmain.sh, 1.16, 1.17
- Next message (by thread): [Fedora-directory-commits] ldapserver Makefile.in, 1.63, 1.64 aclocal.m4, 1.45, 1.46 autogen.sh, 1.2, 1.3 config.guess, 1.34, 1.35 config.h.in, 1.7, 1.8 config.sub, 1.34, 1.35 configure, 1.56, 1.57 depcomp, 1.35, 1.36 install-sh, 1.35, 1.36 ltmain.sh, 1.17, 1.18 missing, 1.35, 1.36
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Fedora-directory-commits
mailing list