diff options
Diffstat (limited to 'src/Thorns.c')
-rw-r--r-- | src/Thorns.c | 99 |
1 files changed, 47 insertions, 52 deletions
diff --git a/src/Thorns.c b/src/Thorns.c index 5b10a8c..91a1a07 100644 --- a/src/Thorns.c +++ b/src/Thorns.c @@ -9,15 +9,13 @@ @@*/ #include <stdio.h> -#include <string.h> #include "cctk.h" #include "util_String.h" -#include "http_Request.h" -#include "http_Content.h" -#include "http_SString.h" +#include "httpRequest.h" +#include "Content.h" #include "SString_Namespace.h" #include "SStringHTML_Namespace.h" @@ -69,9 +67,7 @@ int HTTPi_RegisterThornPages(void); int HTTPi_RegisterThornPages(void) { int i; - char pagename[THORN_NAME_MAXLENGTH]; - char *namecopy; - const char *thorn; + char pagename[THORN_NAME_MAXLENGTH] = { '\0' }; /* Register the group info page. */ HTTP_RegisterPage("/Thorns", ThornMainPage, NULL); @@ -82,11 +78,11 @@ int HTTPi_RegisterThornPages(void) for (i = 0; i < CCTK_NumCompiledThorns (); i++) { - thorn = CCTK_CompiledThorn(i); + const char *thorn = CCTK_CompiledThorn(i); sprintf(pagename,"/Thorns/%s", thorn); - namecopy = Util_Strdup(thorn); /*SW isn't this a memory leak?*/ + char *namecopy = Util_Strdup(thorn); /*SW isn't this a memory leak?*/ HTTP_RegisterPage(pagename, ThornPage, namecopy); } @@ -117,38 +113,36 @@ static int ThornMainPage(const cGH *cctkGH, httpRequest *request, void *data) { int i; int retval = -1; - int foundone; + int foundone = 0; const char *thorn; String *message = String_New(); /* avoid compiler warning about unused parameter */ data = data; - SendHTTP_OK_Header( request ); + HTTP_Send_OK_Header( request ); - SetHTML_Doctype( message ); - Send_HTTP_String(request, message); + HTTP_SetDoctype( message ); + HTTP_SendString(request, message); /* Start the page */ - Send_HTTP(request,"<html><head><title>Cactus Thorns</title>\n"); + HTTP_Send(request, "<html><head><title>Cactus Thorns</title>\n"); - SetHTML_HeadHeader( message); - Send_HTTP_String(request, message ); + HTTP_SetHeadInfo( message); + HTTP_SendString(request, message ); - Send_HTTP(request,"</head>\n<body>\n"); + HTTP_Send(request,"</head>\n<body>\n"); - /* Send_HTTP_String out the header part. */ + /* HTTP_SendString out the header part. */ - SetHTML_ContentHeader(cctkGH,0,message,NULL); + HTTP_SetContentHeaderString(cctkGH,0,message,NULL); - retval = Send_HTTP_String(request, message); + retval = HTTP_SendString(request, message); - retval = Send_HTTP(request, "<h1>Thorns</h1>\n" + retval = HTTP_Send(request, "<h1>Thorns</h1>\n" "<p>These pages describe the thorns used in this simulation.</p>\n"); + retval = HTTP_Send(request, "<table><tr><td>\n"); - retval = Send_HTTP(request,"<table><tr><td>\n"); - - foundone = 0; for (i = 0; i < CCTK_NumCompiledThorns (); i++) { thorn = CCTK_CompiledThorn (i); @@ -156,7 +150,7 @@ static int ThornMainPage(const cGH *cctkGH, httpRequest *request, void *data) { if (!foundone) { - Send_HTTP(request, + HTTP_Send(request, "<h2>Active Thorns</h2>\n" "<div class=\"center\">\n" "<table class=\"thorns\" cellspacing=\"0\" cellpadding=\"5\">\n" @@ -173,16 +167,16 @@ static int ThornMainPage(const cGH *cctkGH, httpRequest *request, void *data) ConcatCString(message, "</a></td>\n<td>"); ConcatCString(message, CCTK_ThornImplementation(thorn)); ConcatCString(message, "</td>\n</tr>\n"); - Send_HTTP_String(request, message); + HTTP_SendString(request, message); } } if (foundone) { - Send_HTTP(request,"</table></div>\n"); + HTTP_Send(request,"</table></div>\n"); } - retval = Send_HTTP(request,"</td><td>"); + retval = HTTP_Send(request,"</td><td>"); foundone = 0; for (i = 0; i < CCTK_NumCompiledThorns (); i++) @@ -193,7 +187,7 @@ static int ThornMainPage(const cGH *cctkGH, httpRequest *request, void *data) if (!foundone) { - Send_HTTP(request, + HTTP_Send(request, "<h2>Dormant Thorns</h2>\n" "<div class=\"centered\">\n" "<table class=\"thorns\" cellspacing=\"0\" cellpadding=\"5\">\n" @@ -209,22 +203,22 @@ static int ThornMainPage(const cGH *cctkGH, httpRequest *request, void *data) ConcatCString(message, "</td>\n<td>"); ConcatCString(message, CCTK_ThornImplementation(thorn)); ConcatCString(message, "</td>\n</tr>\n"); - Send_HTTP_String(request, message); + HTTP_SendString(request, message); } } if (foundone) { - Send_HTTP(request,"</table>\n</div>\n"); + HTTP_Send(request,"</table>\n</div>\n"); } - retval = Send_HTTP(request,"</td>\n</tr>\n</table>\n"); + retval = HTTP_Send(request,"</td>\n</tr>\n</table>\n"); /* Write out the footer part. */ - SetHTML_ContentFooter(cctkGH,0,message); - retval = Send_HTTP_String(request, message); + HTTP_SetContentFooterString(cctkGH,0,message); + retval = HTTP_SendString(request, message); String_Delete( message ); return retval; @@ -252,48 +246,49 @@ static int ThornPage(const cGH *cctkGH, httpRequest *request, void *data) String *message = String_New(); const char *thorn = (const char *)data; - SendHTTP_OK_Header(request); + HTTP_Send_OK_Header(request); - SetHTML_Doctype( message ); - Send_HTTP_String(request, message); + HTTP_SetDoctype( message ); + HTTP_SendString(request, message); /* Start the page */ SetToCString(message, "<html>\n<head>\n<title>Thorn Page : "); ConcatCString(message, thorn); ConcatCString(message, "</title>\n"); - Send_HTTP_String(request, message); - SetHTML_HeadHeader( message); - Send_HTTP_String(request, message ); + HTTP_SendString(request, message); + HTTP_SetHeadInfo( message); + HTTP_SendString(request, message ); - Send_HTTP(request,"</head>\n<body>\n"); + HTTP_Send(request,"</head>\n<body>\n"); - SetHTML_ContentHeader(cctkGH,0,message,NULL); + HTTP_SetContentHeaderString(cctkGH,0,message,NULL); - Send_HTTP_String(request, message); + HTTP_SendString(request, message); SetToCString(message, "<h1>Thorn "); ConcatCString(message, thorn); ConcatCString(message, "</h1>\n"); - Send_HTTP_String(request, message); + HTTP_SendString(request, message); - SetToCString(message,"<p>This page will include all the information about thorn \'"); + SetToCString(message,"<p>This page will include all the information about " + "thorn \'"); ConcatCString(message, thorn); - ConcatCString(message, - "\'.\n For now, only information about the parameters is given.</p>\n"); + ConcatCString(message, "\'.\n For now, only information about the parameters" + " is given.</p>\n"); ConcatCString(message, "<ul>\n" - "<li><a href=\"/Parameters/"); + "<li><a href=\"/Parameters/"); ConcatCString(message, thorn ); ConcatCString(message, "\">Parameters</a></li>\n" - "</ul>\n"); - Send_HTTP_String(request, message); + "</ul>\n"); + HTTP_SendString(request, message); /* Write out the footer part. */ - SetHTML_ContentFooter(cctkGH, 0, message); - retval = Send_HTTP_String(request, message); + HTTP_SetContentFooterString(cctkGH, 0, message); + retval = HTTP_SendString(request, message); String_Delete( message ); return retval; |