删除除linux平台和windows平台外的其他宏定义

This commit is contained in:
Helly Guo 2016-04-09 17:14:46 +08:00
parent 4dd0094304
commit 01ce64093b
3 changed files with 0 additions and 135 deletions

View File

@ -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

View File

@ -46,11 +46,7 @@
#ifdef _WIN32
#include <winsock2.h>
#ifndef _WINCE
#include <io.h>
#else
#include <sys/unistd.h>
#endif
#include <process.h>
#define SASIZETYPE int
#define SHUT_RDWR SD_BOTH
@ -67,38 +63,6 @@
#include <errno.h>
#endif
#ifdef __CYGWIN__
#include <windows.h>
#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 <pthread.h>
#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

View File

@ -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);