Work with MINGW compiler. No need to have cygwin1.dll.
This commit is contained in:
parent
b9768afbbd
commit
0ca44d6688
@ -2,15 +2,15 @@
|
|||||||
# Makefile
|
# Makefile
|
||||||
#-------------------------------------------------------------------#
|
#-------------------------------------------------------------------#
|
||||||
# 1.0 Laurent Destailleur Creation
|
# 1.0 Laurent Destailleur Creation
|
||||||
# 1.1 Works with VC++ and gcc, Windows and Unix
|
# 1.1 Works with VC++ and GCC, Windows and Unix
|
||||||
#-------------------------------------------------------------------#
|
#-------------------------------------------------------------------#
|
||||||
|
|
||||||
|
|
||||||
# Project options
|
# Project options
|
||||||
#-----------------
|
#-----------------
|
||||||
|
|
||||||
# "GCC" to use GNU C++ compiler, "VC" to use Microsoft Visual C+
|
# "GCC" to use GCC GNU C++ (Cygwin or Linux), "MINGW" to use MINGW, "VC" to use Microsoft Visual C+
|
||||||
COMP=GCC
|
COMP=MINGW
|
||||||
# DEBUG=1 for debug
|
# DEBUG=1 for debug
|
||||||
DEBUG=0
|
DEBUG=0
|
||||||
|
|
||||||
@ -27,6 +27,7 @@ PROGRAM = $(RUNDIR)UsedPort
|
|||||||
# Object files to build (Ex: $(LIBDIR)yyy.o $(LIBDIR)zzz.o ...)
|
# Object files to build (Ex: $(LIBDIR)yyy.o $(LIBDIR)zzz.o ...)
|
||||||
OBJLIST = $(LIBDIR)UsedPort.o$(BJ)
|
OBJLIST = $(LIBDIR)UsedPort.o$(BJ)
|
||||||
|
|
||||||
|
|
||||||
# Archive file for o files (Ex: $(LIBDIR)libxxx.a)
|
# Archive file for o files (Ex: $(LIBDIR)libxxx.a)
|
||||||
ifeq "$(OS)" "Windows_NT"
|
ifeq "$(OS)" "Windows_NT"
|
||||||
ARCHIVE = "mylib.a"
|
ARCHIVE = "mylib.a"
|
||||||
@ -34,9 +35,8 @@ else
|
|||||||
ARCHIVE = "mylib.a"
|
ARCHIVE = "mylib.a"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Compiler options
|
# Compilation/Link by GCC
|
||||||
#-----------------
|
#------------------------
|
||||||
# Compilation par gcc
|
|
||||||
ifeq "$(COMP)" "GCC"
|
ifeq "$(COMP)" "GCC"
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CPP = g++
|
CPP = g++
|
||||||
@ -49,17 +49,40 @@ else
|
|||||||
COPTIONS=-O3
|
COPTIONS=-O3
|
||||||
endif
|
endif
|
||||||
ifeq "$(OS)" "Windows_NT"
|
ifeq "$(OS)" "Windows_NT"
|
||||||
LOPTIONS=-lwsock32
|
# wsock32 required only if _WIN32 defined in source code and use WSA* functions
|
||||||
|
# wsock32 of CYGWIN need cygwin1.dll to work
|
||||||
|
#LOPTIONS=-lwsock32 -Bstatic
|
||||||
|
LOPTIONS=-Bstatic
|
||||||
endif
|
endif
|
||||||
ifeq "$(MACHTYPE)" "sparc"
|
ifeq "$(MACHTYPE)" "sparc"
|
||||||
LOPTIONS=-lsocket
|
LOPTIONS=-lsocket -Bstatic
|
||||||
endif
|
endif
|
||||||
ifeq "$(PROCESSOR_ARCHITECTURE)" "x86"
|
ifeq "$(PROCESSOR_ARCHITECTURE)" "x86"
|
||||||
LOPTIONS2=-m486
|
LOPTIONS2=-m486
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Compilation par vc
|
# Compilation/Link by MINGW
|
||||||
|
#--------------------------
|
||||||
|
ifeq "$(COMP)" "MINGW"
|
||||||
|
CC = mingw32-gcc.exe
|
||||||
|
CPP = mingw32-g++.exe
|
||||||
|
RSC = mingw32-g++.exe
|
||||||
|
AR = ar r
|
||||||
|
OUT=-o
|
||||||
|
ifeq "$(DEBUG)" "1"
|
||||||
|
COPTIONS=-Wall -g -DDEBUG
|
||||||
|
else
|
||||||
|
COPTIONS=-O3
|
||||||
|
endif
|
||||||
|
LOPTIONS=-lwsock32 -Bstatic
|
||||||
|
ifeq "$(PROCESSOR_ARCHITECTURE)" "x86"
|
||||||
|
LOPTIONS2=-m486
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Compilation/Link by VC
|
||||||
|
#-----------------------
|
||||||
ifeq "$(COMP)" "VC"
|
ifeq "$(COMP)" "VC"
|
||||||
CC = cl.exe
|
CC = cl.exe
|
||||||
CPP = cl.exe
|
CPP = cl.exe
|
||||||
@ -90,25 +113,33 @@ endif
|
|||||||
LDFLAGS = $(LOPTIONS) $(LOPTIONS2) $(LIBS)
|
LDFLAGS = $(LOPTIONS) $(LOPTIONS2) $(LIBS)
|
||||||
|
|
||||||
$(LIBDIR)%.o: %.cpp
|
$(LIBDIR)%.o: %.cpp
|
||||||
@echo ----- Compilation C++ par $(COMP) - $@
|
@echo ----- Compilation C++ by $(COMP) $(CPP) - $@
|
||||||
|
@echo CPP=$(CPP)
|
||||||
|
@echo CFLAGS=$(CFLAGS)
|
||||||
$(CPP) -c $(CFLAGS) $(SRC)$< $(OUT)$@
|
$(CPP) -c $(CFLAGS) $(SRC)$< $(OUT)$@
|
||||||
# @echo ----- Archivage en $(ARCHIVE)
|
# @echo ----- Archivage en $(ARCHIVE)
|
||||||
# $(AR) $(ARCHIVE) $@
|
# $(AR) $(ARCHIVE) $@
|
||||||
|
|
||||||
$(LIBDIR)%.obj: %.cpp
|
$(LIBDIR)%.obj: %.cpp
|
||||||
@echo ----- Compilation C++ par $(COMP) - $@
|
@echo ----- Compilation C++ by $(COMP) $(CPP) - $@
|
||||||
|
@echo CPP=$(CPP)
|
||||||
|
@echo CFLAGS=$(CFLAGS)
|
||||||
$(CPP) -c $(CFLAGS) $(SRC)$< $(OUT)$@
|
$(CPP) -c $(CFLAGS) $(SRC)$< $(OUT)$@
|
||||||
# @echo ----- Archivage en $(ARCHIVE)
|
# @echo ----- Archivage en $(ARCHIVE)
|
||||||
# $(AR) $(ARCHIVE) $@
|
# $(AR) $(ARCHIVE) $@
|
||||||
|
|
||||||
$(LIBDIR)%.o: %.c
|
$(LIBDIR)%.o: %.c
|
||||||
@echo ----- Compilation C par $(COMP) - $@
|
@echo ----- Compilation C by $(COMP) $(CC) - $@
|
||||||
|
@echo CC=$(CC)
|
||||||
|
@echo CFLAGS=$(CFLAGS)
|
||||||
$(CC) -c $(CFLAGS) $(SRC)$< $(OUT)$@
|
$(CC) -c $(CFLAGS) $(SRC)$< $(OUT)$@
|
||||||
# @echo ----- Archivage en $(ARCHIVE)
|
# @echo ----- Archivage en $(ARCHIVE)
|
||||||
# $(AR) $(ARCHIVE) $@
|
# $(AR) $(ARCHIVE) $@
|
||||||
|
|
||||||
$(LIBDIR)%.obj: %.c
|
$(LIBDIR)%.obj: %.c
|
||||||
@echo ----- Compilation C par $(COMP) - $@
|
@echo ----- Compilation C by $(COMP) $(CC) - $@
|
||||||
|
@echo CPP=$(CPP)
|
||||||
|
@echo CFLAGS=$(CFLAGS)
|
||||||
$(CC) -c $(CFLAGS) $(SRC)$< $(OUT)$@
|
$(CC) -c $(CFLAGS) $(SRC)$< $(OUT)$@
|
||||||
# @echo ----- Archivage en $(ARCHIVE)
|
# @echo ----- Archivage en $(ARCHIVE)
|
||||||
# $(AR) $(ARCHIVE) $@
|
# $(AR) $(ARCHIVE) $@
|
||||||
@ -123,13 +154,15 @@ all: $(PROGRAM)
|
|||||||
|
|
||||||
# Program (if PROGRAM is just one exe)
|
# Program (if PROGRAM is just one exe)
|
||||||
#$(PROGRAM1): $(OBJLIST1)
|
#$(PROGRAM1): $(OBJLIST1)
|
||||||
# @echo ----- Link - $@
|
# @echo ----- Link by $(COMP) $(CC) - $@
|
||||||
# rm -f $(RUNDIR)$@
|
# rm -f $(RUNDIR)$@
|
||||||
# $(CC) -o $(RUNDIR)$@ $(OBJLIST) $(LDFLAGS) $(ARCHIVE)
|
# $(CC) -o $(RUNDIR)$@ $(OBJLIST) $(LDFLAGS) $(ARCHIVE)
|
||||||
|
|
||||||
# Program (if PROGRAM are several exe)
|
# Program (if PROGRAM are several exe)
|
||||||
$(PROGRAM): $(OBJLIST)
|
$(PROGRAM): $(OBJLIST)
|
||||||
@echo ----- Link - $@
|
@echo ----- Link by $(COMP) $(CC) - $@
|
||||||
|
@echo LIBDIR=$(LIBDIR)
|
||||||
|
@echo LDFLAGS=$(LDFLAGS)
|
||||||
rm -f $(RUNDIR)$@
|
rm -f $(RUNDIR)$@
|
||||||
# $(CC) -o $(RUNDIR)$@ $(LIBDIR)$@.o$(BJ) $(LDFLAGS) $(ARCHIVE)
|
# $(CC) -o $(RUNDIR)$@ $(LIBDIR)$@.o$(BJ) $(LDFLAGS) $(ARCHIVE)
|
||||||
$(CC) -o $(RUNDIR)$@ $(LIBDIR)$@.o$(BJ) $(LDFLAGS)
|
$(CC) -o $(RUNDIR)$@ $(LIBDIR)$@.o$(BJ) $(LDFLAGS)
|
||||||
@ -137,9 +170,8 @@ $(PROGRAM): $(OBJLIST)
|
|||||||
# Clean
|
# Clean
|
||||||
clean:
|
clean:
|
||||||
@echo ----- Clean
|
@echo ----- Clean
|
||||||
$(RM) $(LIBDIR)*.a $(LIBDIR)*.o $(LIBDIR)*.obj $(RUNDIR)core $(OBJLIST)
|
$(RM) $(LIBDIR)*.a $(LIBDIR)*.o $(LIBDIR)*.obj $(RUNDIR)UsedPort.exe $(RUNDIR)core $(OBJLIST)
|
||||||
|
|
||||||
|
|
||||||
# Dependencies xxx.o: xxx.c xxxa.h xxxb.h
|
# Dependencies xxx.o: xxx.c xxxa.h xxxb.h
|
||||||
#$(LIBDIR)UsedPort.o: $(SRCDIR)UsedPort.cpp
|
#$(LIBDIR)UsedPort.o: $(SRCDIR)UsedPort.cpp
|
||||||
#$(LIBDIR)SendMess.o: $(SRCDIR)SendMess.cpp
|
|
||||||
|
|||||||
@ -1,39 +1,28 @@
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// GetMess
|
// UsedPort
|
||||||
//
|
//---------------------------------------------------------------------------
|
||||||
// Get mails of POP3 account from command line or from a HTTP form (use CGI GET or POST method)
|
|
||||||
// It applies to the RFC 821 and RFC 822 specs
|
|
||||||
// It supports MIME 1.0 encoding of European national characters.
|
|
||||||
//
|
|
||||||
// Tested with :
|
// Tested with :
|
||||||
// VC++ 4.0 (WIN32)
|
// VC++ 4.0
|
||||||
// GCC 2.8.1 (WIN32)
|
// GCC 3.4.4 CYGWIN (CYGWIN need cygwin1.dll)
|
||||||
// GCC 2.7.3 (Aix 4.x)
|
// MINGW 3.4.5
|
||||||
// GCC 2.9 (Linux 2.0.x)
|
// Not tested with:
|
||||||
|
// GCC 3.4.4 Linux
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// 08/01/99 1.1 Laurent Destailleur Creation
|
// 08/08/09 1.1 Laurent Destailleur Creation
|
||||||
// 15/10/99 1.2 Allow to delete several messages in action command
|
|
||||||
// 29/12/99 1.8 Use now good fonctions base64_decode and quoted_decode
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
// Required field if used as a CGI-BIN application:
|
|
||||||
// HOST = POP3 Server name
|
|
||||||
// USER = EMail POP3 account
|
|
||||||
// PASSWD = EMail POP3 password
|
|
||||||
//
|
|
||||||
// Optionnal fields if used as a CGI-BIN application:
|
|
||||||
// ACTION = Action to do (l,g,d)
|
|
||||||
// LANG = Language of messages
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
#define PROG "UsedPort"
|
#define PROG "UsedPort"
|
||||||
#define VERSION "1.0"
|
#define VERSION "1.0"
|
||||||
|
|
||||||
|
// If GNU GCC CYGWIN: _WIN32 to defined manually, __GNUC__ is defined, _MSC_VER not defined
|
||||||
|
// If GNU GCC MINGW: _WIN32 automaticaly defined, __GNUC__ is defined, _MSC_VER not defined
|
||||||
|
// If VC: _WIN32 automaticaly defined, __GNUC__ is not defined, _MSC_VER defined
|
||||||
|
|
||||||
|
// If on Windows and Cygwin, we can use _WIN32 WSA pre function, if we want or not with Cygwin.
|
||||||
|
//#define _WIN32
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
|
||||||
#include <malloc.h>
|
|
||||||
#include <memory.h>
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
// Pour Unix
|
// Pour Unix
|
||||||
@ -47,6 +36,7 @@
|
|||||||
#define LPHOSTENT struct hostent * // Non defini sous Unix
|
#define LPHOSTENT struct hostent * // Non defini sous Unix
|
||||||
#define MAXHOSTNAMELEN 256
|
#define MAXHOSTNAMELEN 256
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
// Pour VC++
|
// Pour VC++
|
||||||
@ -55,14 +45,14 @@
|
|||||||
#define MAXHOSTNAMELEN 256
|
#define MAXHOSTNAMELEN 256
|
||||||
#endif
|
#endif
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
|
#define MAXHOSTNAMELEN 256
|
||||||
// Pour GCC WIN32 CYGWIN
|
// Pour GCC WIN32 CYGWIN
|
||||||
#include <winsock.h>
|
#include <winsock.h>
|
||||||
#include <mingw32/dir.h>
|
|
||||||
// Pour GCC WIN32 EGCS
|
// Pour GCC WIN32 EGCS
|
||||||
//#include <base.h>
|
//#include <base.h>
|
||||||
//#include <defines.h>
|
//#include <defines.h>
|
||||||
//#include <structures.h>
|
//#include <structures.h>
|
||||||
//#include <sockets.h> // Fichier a modifier sous GCC WIN32 pour contourner bug !!!
|
//#include <sockets.h>
|
||||||
//#include <functions.h>
|
//#include <functions.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -71,7 +61,6 @@
|
|||||||
|
|
||||||
#define MAX_ENTRIES 10 // SUBJECT, HOST, USER, PASSWD
|
#define MAX_ENTRIES 10 // SUBJECT, HOST, USER, PASSWD
|
||||||
#define MAX_MAILS 100 // Nb max of mails managed
|
#define MAX_MAILS 100 // Nb max of mails managed
|
||||||
#define FILEINI "awmess.conf"
|
|
||||||
#define SIZE_RECEIVE_BUFFER 4096 // Ko
|
#define SIZE_RECEIVE_BUFFER 4096 // Ko
|
||||||
#define SIZE_BLOCK_FILELIST 256 // Size of block used to extend by alloc/realloc files list string
|
#define SIZE_BLOCK_FILELIST 256 // Size of block used to extend by alloc/realloc files list string
|
||||||
|
|
||||||
@ -146,7 +135,6 @@ int Ack(SOCKET sc);
|
|||||||
int Ack_Stat(SOCKET sc,int *iNbUnread,unsigned long int *lSizeUnread);
|
int Ack_Stat(SOCKET sc,int *iNbUnread,unsigned long int *lSizeUnread);
|
||||||
int Ack_Mail(SOCKET sc,int mailcpt,const unsigned long int liMailSize);
|
int Ack_Mail(SOCKET sc,int mailcpt,const unsigned long int liMailSize);
|
||||||
int DoQuit(int iRet);
|
int DoQuit(int iRet);
|
||||||
char *cgiLookup(char *tag,char *default_tag);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -204,11 +192,9 @@ int testConnect()
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
SOCKET sc;
|
SOCKET sc;
|
||||||
char bold[4],unbold[5];
|
|
||||||
char s[2048],t[256];
|
char s[2048],t[256];
|
||||||
int i,firstmail,lastmail,mailcpt;
|
int i,firstmail,lastmail,mailcpt;
|
||||||
|
|
||||||
strcpy(bold,"");strcpy(unbold,"");
|
|
||||||
|
|
||||||
startgetmess:
|
startgetmess:
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user