Beispiel #1
0
void fatal(const char *s, ...)    // failure exit
{
    if(++errors <= 2) // print up to one extra recursive error
    {
        defvformatbigstring(msg, s, s);
        if(logfile) logoutf("%s", msg);
        #ifndef WIN32
        fprintf(stderr, "%s\n", msg);
        #endif
        if(errors <= 1) // avoid recursion
        {
            if(SDL_WasInit(SDL_INIT_VIDEO))
            {
                showcursor(true);
                SDL_WM_GrabInput(SDL_GRAB_OFF);
                cleargamma();
            }
            #ifdef WIN32
            defformatstring(cap, "%s: Error", VERSION_NAME);
            MessageBox(NULL, msg, cap, MB_OK|MB_SYSTEMMODAL);
            #endif
            SDL_Quit();
        }
    }
    exit(EXIT_FAILURE);
}
Beispiel #2
0
void fatal(const char *s, ...)    // failure exit
{
    static int errors = 0;
    errors++;

    if(errors <= 2) // print up to one extra recursive error
    {
        defvformatstring(msg,s,s);
        logoutf("%s", msg);

        if(errors <= 1) // avoid recursion
        {
            if(SDL_WasInit(SDL_INIT_VIDEO))
            {
                SDL_ShowCursor(1);
                SDL_WM_GrabInput(SDL_GRAB_OFF);
                cleargamma();
            }
            #ifdef WIN32
                MessageBox(NULL, msg, "Cube 2: Sauerbraten fatal error", MB_OK|MB_SYSTEMMODAL);
            #endif
            SDL_Quit();
        }
    }

    exit(EXIT_FAILURE);
}
Beispiel #3
0
void conoutfv(int type, const char *fmt, va_list args)
{
    string sf, sp;
    vformatstring(sf, fmt, args);
    filtertext(sp, sf);
    logoutf("%s", sp);
}
Beispiel #4
0
char* get_request_line(char* buffer, http_request* request){

    char method[10];
    char path[1024];
    char version[20];
    char *query;

    strcpy(method, strsep(&buffer, " "));
    strcpy(path, strsep(&buffer, " "));
    strcpy(version, strsep(&buffer, "\r\n"));
    query = index(path, '?');
    if(query != NULL){
        *query = '\0';
        query++;
        request->query = strdup(query);
    }

    logoutf("%s %s %s\r\n",method, path, version);

    request->path = strdup(path);

    if (strcmp(method, "GET") == 0) {
        request->method = METHOD_GET;
    } else if (strcmp(method, "POST") == 0) {
        request->method = METHOD_POST;
    }
    request->version = get_http_version(version);

    return buffer + 1;  //  skip the \n at last
}
Beispiel #5
0
/// failure crash
void fatal(const char *s, ...)   
{
    static int errors = 0;
    errors++;
    if(errors <= 2) /// print up to one extra recursive error
    {
        defvformatstring(msg,s,s);
        logoutf("%s", msg);

        if(errors <= 1) /// avoid recursion
        {
            if(SDL_WasInit(SDL_INIT_VIDEO))
            {
                /// free SDL context
                if(screen) SDL_SetWindowGrab(screen, SDL_FALSE);
                SDL_SetRelativeMouseMode(SDL_FALSE);
                SDL_ShowCursor(SDL_TRUE);
                cleargamma();
            }
            #ifdef WIN32
                MessageBox(NULL, msg, "Inexor fatal error", MB_OK|MB_SYSTEMMODAL);
            #endif
            SDL_Quit();
        }
    }
    exit(EXIT_FAILURE);
}
Beispiel #6
0
void conoutfv(int type, const char *fmt, va_list args)
{
    //remod
    //logoutfv(fmt, args);

    // remod
    static char buf[LOGSTRLEN];
    vformatstring(buf, fmt, args, sizeof(buf));
    logoutf("%s", buf);
    filtertext(buf, buf);
    remod::rcon::sendmsg(buf);
}
Beispiel #7
0
void fatal(const char *fmt, ...)
{
    void cleanupserver();
    cleanupserver();
	defvformatstring(msg,fmt,fmt);
	if(logfile) logoutf("%s", msg);
#ifdef WIN32
	MessageBox(NULL, msg, "Cube 2: Sauerbraten fatal error", MB_OK|MB_SYSTEMMODAL);
#else
    fprintf(stderr, "server error: %s\n", msg);
#endif
    closelogfile();
    exit(EXIT_FAILURE);
}