From 01ce64093b83f209c0655ea467ea960d57612421 Mon Sep 17 00:00:00 2001 From: Helly Guo Date: Sat, 9 Apr 2016 17:14:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=99=A4linux=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E5=92=8Cwindows=E5=B9=B3=E5=8F=B0=E5=A4=96=E7=9A=84?= =?UTF-8?q?=E5=85=B6=E4=BB=96=E5=AE=8F=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common.c | 59 ------------------------------------------------- src/proxy.h | 47 --------------------------------------- src/proxymain.c | 29 ------------------------ 3 files changed, 135 deletions(-) diff --git a/src/common.c b/src/common.c index 8c0ba6c..60c09b0 100644 --- a/src/common.c +++ b/src/common.c @@ -58,11 +58,7 @@ struct extparam conf = { NULL, NULL, NULL, NULL, -#ifdef __FreeBSD__ - 8192, -#else 0, -#endif 0, -1, 0, 0, 0, 0, 0, 500, 0, 0, 0, 0, 0, 6, 600, 1048576, @@ -174,53 +170,6 @@ struct sockfuncs so = { #endif }; -#ifdef _WINCE - -static char cebuf[1024]; -static char ceargbuf[256]; -char * ceargv[32]; - -char * CEToUnicode (const char *str){ - int i; - - for(i=0; i<510 && str[i]; i++){ - cebuf[(i*2)] = str[i]; - cebuf[(i*2)+1] = 0; - } - cebuf[(i*2)] = 0; - cebuf[(i*2)+1] = 0; - return cebuf; -}; - -int cesystem(const char *str){ - STARTUPINFO startupInfo = {0}; - startupInfo.cb = sizeof(startupInfo); - - PROCESS_INFORMATION processInformation; - - return CreateProcessW((LPWSTR)CEToUnicode(str), NULL, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &startupInfo, &processInformation); -} - -int ceparseargs(const char *str){ - int argc = 0, i; - int space = 1; - - for(i=0; i<250 && argc<30 && str[2*i]; i++){ - ceargbuf[i] = str[2*i]; - if(space && ceargbuf[i]!=' '&& ceargbuf[i]!='\t'&& ceargbuf[i]!='\r'&& ceargbuf[i]!='\n'){ - ceargv[argc++] = ceargbuf + i; - space = 0; - } - else if(!space && (ceargbuf[i]==' ' || ceargbuf[i]=='\t' || ceargbuf[i]=='\r' || ceargbuf[i]=='\n')){ - ceargbuf[i] = 0; - space = 1; - } - } - return argc; -} - -#endif - void parsehost(int family, unsigned char *host, struct sockaddr *sa){ char *sp=NULL,*se=NULL; unsigned short port; @@ -367,11 +316,7 @@ int dobuf2(struct clientparam * param, unsigned char * buf, const unsigned char sec = (time_t)tv.tv_sec; msec = tv.tv_usec / 1000; -#ifdef _SOLARIS - timezone = -altzone / 60; -#else timezone = tm->tm_gmtoff / 60; -#endif #endif delay = param->time_start?((unsigned) ((sec - param->time_start))*1000 + msec) - param->msec_start : 0; @@ -723,13 +668,9 @@ struct hostent * my_gethostbyname(char *name, char *buf, struct hostent *hp){ struct hostent *result; int gherrno; -#ifdef _SOLARIS - return gethostbyname_r(name, hp, buf, 1024, &gherrno); -#else if(gethostbyname_r(name, hp, buf, 1024, &result, &gherrno) != 0) return NULL; return result; -#endif } #endif diff --git a/src/proxy.h b/src/proxy.h index 3c93658..0c538fc 100644 --- a/src/proxy.h +++ b/src/proxy.h @@ -46,11 +46,7 @@ #ifdef _WIN32 #include -#ifndef _WINCE #include -#else -#include -#endif #include #define SASIZETYPE int #define SHUT_RDWR SD_BOTH @@ -67,38 +63,6 @@ #include #endif -#ifdef __CYGWIN__ -#include -#define daemonize() FreeConsole() -#define SLEEPTIME 1000 -#undef _WIN32 -#elif _WIN32 -#ifdef errno -#undef errno -#endif -#define errno WSAGetLastError() -#ifdef EAGAIN -#undef EAGAIN -#endif -#define EAGAIN WSAEWOULDBLOCK -#ifdef EINTR -#undef EINTR -#endif -#define EINTR WSAEWOULDBLOCK -#define SLEEPTIME 1 -#define usleep Sleep -#define pthread_self GetCurrentThreadId -#define getpid GetCurrentProcessId -#define pthread_t unsigned -#ifndef _WINCE -#define daemonize() FreeConsole() -#else -#define daemonize() -#endif -#define socket(x, y, z) WSASocket(x, y, z, NULL, 0, 0) -#define accept(x, y, z) WSAAccept(x, y, z, NULL, 0) -#define ftruncate chsize -#else #include #ifndef PTHREAD_STACK_MIN #define PTHREAD_STACK_MIN 32768 @@ -109,7 +73,6 @@ #ifndef O_BINARY #define O_BINARY 0 #endif -#endif #ifndef NOODBC #ifndef _WIN32 @@ -318,16 +281,6 @@ extern struct datatype datatypes[64]; extern struct commands commandhandlers[]; -#ifdef _WINCE -char * CEToUnicode (const char *str); -int cesystem(const char *str); -int ceparseargs(const char *str); -extern char * ceargv[32]; - - -#define system(S) cesystem(S) -#endif - #define WEBBANNERS 35 #endif diff --git a/src/proxymain.c b/src/proxymain.c index d6c1a37..b5e5c06 100644 --- a/src/proxymain.c +++ b/src/proxymain.c @@ -66,20 +66,8 @@ void * threadfunc (void *p) { #define MODULEMAINFUNC main #define STDMAIN -#ifndef _WINCE - int main (int argc, char** argv){ -#else - -int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow){ - int argc; - char ** argv; - WNDCLASS wc; - HWND hwnd = 0; - -#endif - #else extern int linenum; extern int haveerror; @@ -150,23 +138,6 @@ int MODULEMAINFUNC (int argc, char** argv){ #endif #ifdef STDMAIN -#ifdef _WINCE - argc = ceparseargs((char *)lpCmdLine); - argv = ceargv; - if(FindWindow(lpCmdLine, lpCmdLine)) return 0; - ZeroMemory(&wc,sizeof(wc)); - wc.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH); - wc.hInstance=hInstance; - wc.hCursor=LoadCursor(NULL,IDC_ARROW); - wc.lpfnWndProc=DefWindowProc; - wc.style=CS_HREDRAW|CS_VREDRAW; - wc.lpszClassName=lpCmdLine; - RegisterClass(&wc); - - hwnd = CreateWindowEx(WS_EX_TOOLWINDOW,lpCmdLine,lpCmdLine,WS_VISIBLE|WS_POPUP,0,0,0,0,0,0,hInstance,0); -#endif - - #ifdef _WIN32 WSADATA wd; WSAStartup(MAKEWORD( 1, 1 ), &wd);