コード例 #1
0
ファイル: mapio.c プロジェクト: GI-Santana/mapserver
void msIO_setHeader (const char *header, const char* value, ...)
{
  va_list args;
  va_start( args, value );
#ifdef MOD_WMS_ENABLED
  msIOContext *ioctx = msIO_getHandler (stdout);
  if(ioctx && !strcmp(ioctx->label,"apache")) {

    request_rec *r = (request_rec*) (ioctx->cbData);
    char *fullvalue = apr_pvsprintf(r->pool, value,args);
    if (strcasecmp (header, "Content-Type") == 0) {
      r->content_type = fullvalue;
    } else if (strcasecmp (header, "Status") == 0) {
      r->status = atoi (fullvalue);
    } else {
      apr_table_setn (r->headers_out,
                      apr_pstrdup (r->pool, header),
                      fullvalue
                     );
    }
  } else {
#endif // MOD_WMS_ENABLED
    msIO_fprintf(stdout,"%s: ",header);
    msIO_vfprintf(stdout,value,args);
    msIO_fprintf(stdout,"\r\n");
#ifdef MOD_WMS_ENABLED
  }
#endif
}
コード例 #2
0
ファイル: mapio.c プロジェクト: GI-Santana/mapserver
int msIO_fprintf( FILE *fp, const char *format, ... )

{
  va_list args;
  int ret;
  va_start( args, format );
  ret = msIO_vfprintf(fp,format,args);
  va_end(args);
  return ret;
}
コード例 #3
0
ファイル: mapio.c プロジェクト: GI-Santana/mapserver
int msIO_printf( const char *format, ... )

{
  va_list args;
  int ret;
  va_start( args, format );
  ret = msIO_vfprintf(stdout,format,args);
  va_end(args);
  return ret;
}
コード例 #4
0
ファイル: mapdebug.c プロジェクト: bb1ackwe11/mapserver
/* msDebug()
**
** Outputs/logs messages to the MS_ERRORFILE if one is set 
** (see msSetErrorFile())
**
*/
void msDebug( const char * pszFormat, ... )
{
    va_list args;
    debugInfoObj *debuginfo = msGetDebugInfoObj();

    if (debuginfo == NULL || debuginfo->debug_mode == MS_DEBUGMODE_OFF)
        return;  /* Don't waste time here! */

    if (debuginfo->fp)
    {
        /* Writing to a stdio file handle */

#if defined(USE_FASTCGI)
        /* It seems the FastCGI stuff inserts a timestamp anyways, so  */
        /* we might as well skip this one if writing to stderr w/ FastCGI. */
        if (debuginfo->debug_mode != MS_DEBUGMODE_STDERR)
#endif
        {
            struct mstimeval tv;
            time_t t;
            msGettimeofday(&tv, NULL);
            t = tv.tv_sec;
            msIO_fprintf(debuginfo->fp, "[%s].%ld ", 
                         msStringChop(ctime(&t)), (long)tv.tv_usec);
        }

        va_start(args, pszFormat);
        msIO_vfprintf(debuginfo->fp, pszFormat, args);
        va_end(args);
    }
#ifdef _WIN32
    else if (debuginfo->debug_mode == MS_DEBUGMODE_WINDOWSDEBUG)
    {
        /* Writing to Windows Debug Console */

        char szMessage[MESSAGELENGTH];

        va_start(args, pszFormat);
        vsnprintf( szMessage, MESSAGELENGTH, pszFormat, args );
        va_end(args);

        szMessage[MESSAGELENGTH-1] = '\0';
        OutputDebugStringA(szMessage);
    }
#endif

}