4e4f5951fed8f4d923dcbbc313b3596c62374091
tdreszer
Mon Jun 25 12:13:22 2012 -0700
Next batch of many checkins as dictated by Jim. Formatting space after if and limiting lines to 100 chars. Changes limited to lines last touched by tdreszer (git blame) so as not to ruin history. None of these changes should affect executables in any way. Only affect is to my sanity and Jim's.
diff --git src/lib/htmshell.c src/lib/htmshell.c
index fd08ee8..2bfbadb 100644
--- src/lib/htmshell.c
+++ src/lib/htmshell.c
@@ -193,31 +193,32 @@
}
size += countChars(s,'"' ) * 6;
size += countChars(s,'\'') * 5;
char *cleanQuote = needMem(size);
safecpy(cleanQuote,size,s);
// NOTE: While some internal HTML should work, a single quote (') will will screw it up!
if(tagsOkay)
strSwapStrs(cleanQuote, size,"\n"," " ); // new lines also break the html
else
{
strSwapStrs(cleanQuote, size,"&" ,"&" ); // '&' is not the start of a control char
strSwapStrs(cleanQuote, size,">" ,">" ); // '>' is not the close of a tag
strSwapStrs(cleanQuote, size,"<" ,"<" ); // '<' is not the open of a tag
if(cgiClientBrowser(NULL,NULL,NULL) == btFF)
- strSwapStrs(cleanQuote, size,"\n","|"); // FF does not support! Use "|" for '|' instead
+ strSwapStrs(cleanQuote, size,"\n","|"); // FF does not support! Use "|" for '|'
+ // instead
else
strSwapStrs(cleanQuote, size,"\n","
"); // '\n' is supported on some browsers
}
strSwapStrs(cleanQuote, size,"\"","""); // Shield double quotes
strSwapStrs(cleanQuote, size,"'" ,"'" ); // Shield single quotes
return cleanQuote;
}
char *attributeEncode(char *str)
{
// encode double and single quotes in a string to be used as an element attribute
return replaceChars(replaceChars(str, "\"", """), "'", "'");
}
@@ -238,69 +239,72 @@
* and then made visible. */
{
// Only set this up once per page
static boolean htmlWarnBoxSetUpAlready=FALSE;
if(htmlWarnBoxSetUpAlready)
return;
htmlWarnBoxSetUpAlready=TRUE;
// NOTE: Making both IE and FF work is almost impossible. Currently, in IE, if the message
// is forced to the top (calling this routine after
then the box is not resizable
// (dynamically adjusting to its contents). But if this setup is done later in the page
// (at first warning), then IE does resize it. Why?
// FF3.0 (but not FF2.0) was resizable with the following, but it took some experimentation.
// Remember what worked nicely on FF3.0:
// "var app=navigator.appName.substr(0,9); "
-// "if(app == 'Microsoft') {warnBox.style.display='';} else {warnBox.style.display=''; warnBox.style.width='auto';}"
+// "if(app == 'Microsoft') {warnBox.style.display='';}
+// else {warnBox.style.display=''; warnBox.style.width='auto';}"
fprintf(f, "\n");
}
void htmlVaWarn(char *format, va_list args)
/* Write an error message. */
{
va_list argscp;
va_copy(argscp, args);
htmlWarnBoxSetup(stdout); // sets up the warnBox if it hasn't already been done.
char warning[1024];
vsnprintf(warning,sizeof(warning),format, args);
-char *encodedMessage = htmlEncodeText(warning,TRUE); // NOTE: While some internal HTML should work, a single quote (') will will screw it all up!
+char *encodedMessage = htmlEncodeText(warning,TRUE); // NOTE: While some internal HTML should work,
+ // a single quote (') will will screw it up!
printf("\n",encodedMessage); // NOTE that "--ERROR --" is needed at the end of this print!!
+ "warnList.innerHTML += '
%s
';}\n",encodedMessage);
+ // NOTE that "--ERROR --" is needed at the end of this print!!
freeMem(encodedMessage);
/* Log useful CGI info to stderr */
logCgiToStderr();
/* write warning/error message to stderr so they get logged. */
vfprintf(stderr, format, argscp);
va_end(argscp);
fflush(stderr);
}
void htmlAbort()
/* Terminate HTML file. */
{
longjmp(htmlRecover, -1);
@@ -441,43 +445,42 @@
void _htmStartWithHead(FILE *f, char *head, char *title, boolean printDocType, int dirDepth)
/* Write out bits of header that both stand-alone .htmls
* and CGI returned .htmls need, including optional head info */
{
if (printDocType)
{
//#define TOO_TIMID_FOR_CURRENT_HTML_STANDARDS
#ifdef TOO_TIMID_FOR_CURRENT_HTML_STANDARDS
fputs("\n", f);
#else///ifndef TOO_TIMID_FOR_CURRENT_HTML_STANDARDS
char *browserVersion;
if (btIE == cgiClientBrowser(&browserVersion, NULL, NULL) && *browserVersion < '8')
fputs("\n", f);
else
- fputs("",f);
+ fputs("",f);
// Strict would be nice since it fixes atleast one IE problem (use of :hover CSS pseudoclass)
- //fputs("\n",f);
#endif///ndef TOO_TIMID_FOR_CURRENT_HTML_STANDARDS
}
fputs("", f);
fprintf(f,"\n%s%s\n", head, title);
fprintf(f, "\t\n");
if (htmlStyle != NULL)
fputs(htmlStyle, f);
if (htmlStyleSheet != NULL)
- fprintf(f,"\n"
- , htmlStyleSheet);
+ fprintf(f,"\n", htmlStyleSheet);
if (htmlStyleTheme != NULL)
fputs(htmlStyleTheme, f);
fputs("\n\n",f);
fputs("\n",f);
htmlWarnBoxSetup(f);
}