Changeset 212 in Main for trunk/Server/main.c


Ignore:
Timestamp:
Oct 3, 2024, 2:44:55 AM (6 weeks ago)
Author:
Nishi
Message:

compiles on vc6

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Server/main.c

    r209 r212  
    55#include "../config.h"
    66
     7#ifndef _MSC_VER
    78#include <unistd.h>
     9#endif
    810#include <stdio.h>
    911#include <stdbool.h>
     
    2325#include "tw_version.h"
    2426
    25 #ifdef __MINGW32__
     27#if defined(__MINGW32__) || defined(_MSC_VER)
    2628#include <windows.h>
    2729#endif
     
    6062#define printf(...) tt_printf(__VA_ARGS__)
    6163#define STDERR_LOG(...) tt_printf(__VA_ARGS__)
     64#elif defined(_MSC_VER)
     65void STDERR_LOG(const char* format, ...){
     66        va_list args;
     67        va_start(args, format);
     68        vfprintf(stderr, format, args);
     69        va_end(args);
     70}
    6271#else
    6372#define STDERR_LOG(...) fprintf(stderr, __VA_ARGS__)
     
    7281int startup(int argc, char** argv);
    7382
    74 #ifdef __MINGW32__
     83#if defined(__MINGW32__) || defined(_MSC_VER)
    7584char* get_registry(const char* main, const char* sub) {
    7685        DWORD bufsize = 512;
     
    511520
    512521int main(int argc, char** argv) {
     522        int st;
    513523        logfile = stderr;
    514524#ifdef SERVICE
     
    667677        SleepThread();
    668678#endif
    669         int st = startup(argc, argv);
     679        st = startup(argc, argv);
    670680        if(st != -1) {
    671681#ifdef _PSP
     
    692702int startup(int argc, char** argv) {
    693703        int i;
    694 #ifdef __MINGW32__
     704        char* r;
     705#if defined(__MINGW32__) || defined(_MSC_VER)
    695706        char* confpath = cm_strdup(PREFIX "/etc/tewi.conf");
    696707        char* regpath = get_registry("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Tewi HTTPd", "InstallDir");
     
    770781        }
    771782        sprintf(tw_server, "Tewi/%s (%s)%s", tw_get_version(), tw_get_platform(), config.extension == NULL ? "" : config.extension);
    772         char* r = cm_strcat(tw_server, " running...");
     783        r = cm_strcat(tw_server, " running...");
    773784        cm_force_log(r);
    774785        free(r);
    775 #ifndef __MINGW32__
     786#if !defined(__MINGW32__) && !defined(_MSC_VER)
    776787        signal(SIGCHLD, SIG_IGN);
    777788        signal(SIGPIPE, SIG_IGN);
Note: See TracChangeset for help on using the changeset viewer.