From cacd8ef4102ec88f542da09acd44d0d0a0b28070 Mon Sep 17 00:00:00 2001 From: swhite Date: Tue, 1 Jun 2004 13:43:16 +0000 Subject: Concerning bug 1699: Except for a few places where fprintf(stderr... is explicitly #ifdef'ed out as debug code, replaced calls with CCTK_WARN with appropriate warning levels. git-svn-id: http://svn.cactuscode.org/arrangements/CactusConnect/HTTPD/trunk@210 1faa4e14-9dd3-4be0-9f0e-ffe519881164 --- src/Authorisation.c | 5 +++-- src/Content.c | 3 ++- src/Parameters.c | 8 +++++--- src/Server.c | 5 +++-- src/Sockets.c | 2 +- src/http.c | 13 +++++++------ 6 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/Authorisation.c b/src/Authorisation.c index 571118e..42529be 100644 --- a/src/Authorisation.c +++ b/src/Authorisation.c @@ -342,12 +342,13 @@ static int VerifyPassword(const char *database, retcode = 1; } #else - fprintf(stderr, "Sorry, crypt(3) not supported in this configuration.\n"); + CCTK_WARN( 1, "Sorry, crypt(3) not supported in this configuration.\n" ) #endif } else { - fprintf(stderr, "Unknown encryption algorithm '%s'\n", data->encryption_scheme); + CCTK_WARN( 1, "Unknown encryption algorithm: " ); + CCTK_WARN( 1, data->encryption_scheme ); } } } diff --git a/src/Content.c b/src/Content.c index cbb4279..77e6578 100644 --- a/src/Content.c +++ b/src/Content.c @@ -1030,7 +1030,8 @@ static int ControlSet(const cGH *cctkGH, httpRequest *request) case 'R' : HTTP_SteerQueue(CCTK_THORNSTRING, "pause", "no"); break; default : - fprintf(stderr, "Unknown runstate '%s'\n", value); + CCTK_WARN(1, "Unknown runstate: \n\t" ); + CCTK_WARN(1, value ); } } diff --git a/src/Parameters.c b/src/Parameters.c index 55f0e98..f5150c4 100644 --- a/src/Parameters.c +++ b/src/Parameters.c @@ -312,9 +312,11 @@ static int ThornParameterPage(const cGH *cctkGH, httpRequest *request, void *dat while((argument = HTTP_ArgumentWalk(request, first)) != NULL) { first = 0; - fprintf(stderr, "Setting %s::%s to %s\n", thorn, - HTTP_ArgName( argument), - HTTP_ArgValue( argument )); + CCTK_WARN( 5, "Setting " ); + CCTK_WARN( 5, thorn ); + CCTK_WARN( 5, "::" ); + CCTK_WARN( 5, HTTP_ArgName( argument) ); + CCTK_WARN( 5, HTTP_ArgValue( argument ) ); HTTP_SteerQueue(thorn, HTTP_ArgName( argument), HTTP_ArgValue( argument )); } diff --git a/src/Server.c b/src/Server.c index 19ca3f5..ad44ba9 100644 --- a/src/Server.c +++ b/src/Server.c @@ -169,7 +169,8 @@ int HTTP_RegisterPage(const char *path, int (*function)(const cGH *, httpRequest if(Util_HashData(pages, strlen(path), path, 0)) { - fprintf(stderr, "Page %s already exists\n", path); + CCTK_WARN( 1, "Page already exists:\n" ); + CCTK_WARN( 1, path ); } else { @@ -533,7 +534,7 @@ static double evaluator(const char *expression, void *data) retval = *((CCTK_REAL *)pointer); break; default : - fprintf(stderr, "Unsupported variable type %d\n", vartype); + CCTK_WARN( 0, "Unsupported variable type" ); retval = 0.0; } } diff --git a/src/Sockets.c b/src/Sockets.c index 42b06d1..a029363 100644 --- a/src/Sockets.c +++ b/src/Sockets.c @@ -390,7 +390,7 @@ int HTTP_Write(httpRequest *request, const char *buffer, size_t count) /* The socket is marked non-blocking and the requested operation would block. */ #endif default : - fprintf(stderr, "Error: this should never happen - %s %d", __FILE__, __LINE__); + CCTK_WARN (1, "Error: unknown errno "); } } else diff --git a/src/http.c b/src/http.c index 36fcc5f..74b44fc 100644 --- a/src/http.c +++ b/src/http.c @@ -627,7 +627,8 @@ static int AddHeader(httpRequest *request, const char *line) } else { - fprintf(stderr, "Invalid header line '%s'\n", line); + CCTK_WARN( 1, "Invalid header line:\n" ); + CCTK_WARN( 1, line ); } if(value) @@ -654,7 +655,7 @@ static int AddHeader(httpRequest *request, const char *line) } else { - fprintf(stderr, "Out of memory !\n"); + CCTK_WARN( 0, "Out of memory!\n" ); } } else @@ -773,14 +774,14 @@ static int StripArgs(httpRequest *request, char *request_uri) } else { -#ifdef HTTP_DEBUG - fprintf(stderr, "Out of memory\n"); -#endif + CCTK_WARN( 0, "Out of memory!\n" ); } } else { - fprintf(stderr, "Argument '%s' has no value !\n", token); + CCTK_WARN( 1, "Argument " ); + CCTK_WARN( 1, token ); + CCTK_WARN( 1, " has no value!\n" ); } token=strtok(NULL, "&"); } -- cgit v1.2.3