Fixed locale on MSVCRT compilation, e-mail fixes.

This commit is contained in:
Alexander S. Aganichev 2001-05-20 19:19:52 +00:00
parent a49b93dc74
commit 13b1a4fd12
8 changed files with 53 additions and 45 deletions

View File

@ -3,6 +3,7 @@
ifeq ($(findstring EMX, $(PATH)), EMX) ifeq ($(findstring EMX, $(PATH)), EMX)
CC=gcc CC=gcc
AR=ar AR=ar
RANLIB=ranlib
PLATFORM=emx PLATFORM=emx
SHELL=bash SHELL=bash
EXEEXT=.exe EXEEXT=.exe
@ -10,6 +11,7 @@ OBJEXT=.o
LIBEXT=.a LIBEXT=.a
#CC=gcc -Zomf #CC=gcc -Zomf
#AR=emxomfar #AR=emxomfar
#RANLIB=ranlib
#PLATFORM=emx #PLATFORM=emx
#SHELL=bash #SHELL=bash
#EXEEXT=.exe #EXEEXT=.exe
@ -21,6 +23,7 @@ ifneq ($(DJGPP),)
CC=gcc CC=gcc
CXX=gpp CXX=gpp
AR=ar AR=ar
RANLIB=ranlib
PLATFORM=djg PLATFORM=djg
SHELL=bash SHELL=bash
EXEEXT=.exe EXEEXT=.exe
@ -31,6 +34,8 @@ ifeq ($(TERM),cygwin)
CC=gcc -mno-cygwin CC=gcc -mno-cygwin
CXX=g++ -mno-cygwin CXX=g++ -mno-cygwin
AR=ar AR=ar
RANLIB=ranlib
WINDRES=windres
PLATFORM=cyg PLATFORM=cyg
SHELL=bash SHELL=bash
EXEEXT=.exe EXEEXT=.exe
@ -40,6 +45,7 @@ else
CC=gcc CC=gcc
CXX=g++ CXX=g++
AR=ar AR=ar
RANLIB=ranlib
PLATFORM=lnx PLATFORM=lnx
EXEEXT= EXEEXT=
OBJEXT=.o OBJEXT=.o

View File

@ -46,7 +46,7 @@ $(FOBJPATH)/%$(OBJEXT): %.c
ifeq ($(PLATFORM),cyg) ifeq ($(PLATFORM),cyg)
$(FOBJPATH)/%$(OBJEXT): %.rc $(FOBJPATH)/%$(OBJEXT): %.rc
@echo creating resources @echo creating resources
@windres -o $@ $< @$(WINDRES) -o $@ $<
endif endif
ifeq ($(PLATFORM),emx) ifeq ($(PLATFORM),emx)

View File

@ -7,5 +7,5 @@ $(TARGET): $(FLIBPATH)/lib$(TARGET)$(LIBEXT)
$(FLIBPATH)/lib$(TARGET)$(LIBEXT): $(OBJS) $(FLIBPATH)/lib$(TARGET)$(LIBEXT): $(OBJS)
@echo -n Creating library $(TARGET)... @echo -n Creating library $(TARGET)...
@$(AR) cru $@ $(FOBJPATH)/*$(OBJEXT) @$(AR) cru $@ $(FOBJPATH)/*$(OBJEXT)
@ranlib $@ @$(RANLIB) $@
@echo done @echo done

View File

@ -12,6 +12,11 @@ ______________________________________________________________________
Notes for GoldED+ 1.1.5, /snapshot/ Notes for GoldED+ 1.1.5, /snapshot/
______________________________________________________________________ ______________________________________________________________________
! A lot of manipulations with Internet addressing was done.
! GoldED+ now produce Internet addresses in RFC preferable form
"name" <email@address> instead of email@address (name).
+ Added ShowDeleted indicator to status line. + Added ShowDeleted indicator to status line.
- Fixed few bugs in Undo feature. - Fixed few bugs in Undo feature.
@ -105,12 +110,6 @@ ______________________________________________________________________
+ You can explicitly select built-in template by defining "built-in". + You can explicitly select built-in template by defining "built-in".
! A lot of manipulations with Internet addressing was done. If at
least one person will be able to send message to expected
destination I'll be happy :-) If you'll find a bug please write me
a detailed guide (functional requirements specification :)) on how
everything should work.
! Fixed filelocking in UNIX version. ! Fixed filelocking in UNIX version.
- Fixed "Via" kludge handling in JAM areas. - Fixed "Via" kludge handling in JAM areas.

View File

@ -439,7 +439,7 @@ void DoKludges(int mode, GMsg* msg, bool attronly) {
if(*msg->iorig) { if(*msg->iorig) {
mime_header_encode(buf2, msg->By(), msg); mime_header_encode(buf2, msg->By(), msg);
sprintf(buf, "%sFrom: %s (%s)", rfc, msg->iorig, buf2); sprintf(buf, "%sFrom: \"%s\" <%s>", rfc, buf2, msg->iorig);
line = AddKludge(line, buf); line = AddKludge(line, buf);
line->kludge = GKLUD_RFC; line->kludge = GKLUD_RFC;
} }
@ -512,7 +512,7 @@ void DoKludges(int mode, GMsg* msg, bool attronly) {
if(*msg->iorig) { if(*msg->iorig) {
mime_header_encode(buf2, msg->By(), msg); mime_header_encode(buf2, msg->By(), msg);
sprintf(buf, "%sSender: %s (%s)", rfc, msg->iorig, buf2); sprintf(buf, "%sSender: \"%s\" <%s>", rfc, buf2, msg->iorig);
line = AddKludge(line, buf); line = AddKludge(line, buf);
line->kludge = GKLUD_RFC; line->kludge = GKLUD_RFC;
} }

View File

@ -147,32 +147,23 @@ bool set_to_address(GMsg* msg, gsetaddr* toname, gsetaddr* toaddr, gsetaddr* fro
ptr = strchr(buf1, '/'); ptr = strchr(buf1, '/');
if(ptr) { if(ptr) {
*ptr++ = NUL; *ptr++ = NUL;
strcpy(msg->idest, ptr); ParseInternetAddr(ptr, buf2, buf);
strcpy(msg->realto, buf1+1);
if(*AA->Internetgate().name) {
strcpy(msg->iaddr, ptr);
ptr = strcpy(buf1, AA->Internetgate().name);
}
else
strcpy(buf1, ptr);
} }
else { else {
strcpy(msg->idest, buf1+1); ParseInternetAddr(buf1+1, buf2, buf);
if(*AA->Internetgate().name) {
strcpy(msg->iaddr, buf1+1);
ptr = strcpy(buf1, AA->Internetgate().name);
}
else {
strcpy(buf2, buf1+1);
ptr = strcpy(buf1, buf2);
}
} }
strcpy(msg->realto, buf2);
strcpy(msg->idest, buf);
strcpy(msg->iaddr, buf);
if(ptr)
strcpy(buf2, buf1+1);
ptr = strcpy(buf1, ptr and *buf2 ? buf2 : *buf ? buf : buf2);
} }
else if(AA->isinternet()) { else if(AA->isinternet()) {
ParseInternetAddr(buf1, buf2, buf); ParseInternetAddr(buf1, buf2, buf);
ptr = buf2; strcpy(msg->realto, buf2);
strcpy(buf1, buf2);
strcpy(msg->idest, buf); strcpy(msg->idest, buf);
ptr = strcpy(buf1, *buf2 ? buf2 : buf);
} }
else { else {
*msg->iaddr = NUL; *msg->iaddr = NUL;
@ -453,17 +444,18 @@ int EditHeaderinfo(int mode, GMsgHeaderView &view) {
to_name = tmp_to_name; to_name = tmp_to_name;
if(AA->isinternet()) { if(AA->isinternet()) {
strcpy(msg->to, *AA->Internetgate().name ? AA->Internetgate().name : to_name.c_str()); strcpy(msg->to, *AA->Internetgate().name ? AA->Internetgate().name : msg->idest);
strcpy(msg->realby, msg->by); strcpy(msg->realby, msg->by);
strcpy(msg->realto, msg->to); if(not *msg->realto and not strchr(msg->to, '@'))
strcpy(msg->realto, msg->to);
strcpy(msg->iorig, from_addr.c_str()); strcpy(msg->iorig, from_addr.c_str());
strcpy(msg->idest, to_addr.c_str()); strcpy(msg->idest, to_addr.c_str());
if(*msg->by) if(*msg->realby)
sprintf(msg->ifrom, "%s (%s)", msg->iorig, msg->by); sprintf(msg->ifrom, "\"%s\" <%s>", msg->realby, msg->iorig);
else else
sprintf(msg->ifrom, "%s", msg->iorig); sprintf(msg->ifrom, "%s", msg->iorig);
if(*msg->to) if(*msg->realto)
sprintf(msg->ito, "%s (%s)", msg->idest, msg->to); sprintf(msg->ito, "\"%s\" %s", msg->realto, msg->idest);
else else
sprintf(msg->ito, "%s", msg->idest); sprintf(msg->ito, "%s", msg->idest);
if(msg->orig.net == 0) if(msg->orig.net == 0)
@ -474,6 +466,7 @@ int EditHeaderinfo(int mode, GMsgHeaderView &view) {
else { else {
if(strchr(to_name.c_str(), '@')) { if(strchr(to_name.c_str(), '@')) {
if(*AA->Internetgate().name) { if(*AA->Internetgate().name) {
strcpy(msg->to, AA->Internetgate().name);
strcpy(msg->iaddr, to_name.c_str()); strcpy(msg->iaddr, to_name.c_str());
} }
else { else {
@ -484,6 +477,8 @@ int EditHeaderinfo(int mode, GMsgHeaderView &view) {
else else
strcpy(msg->to, to_name.c_str()); strcpy(msg->to, to_name.c_str());
} }
if(AA->Internetgate().addr.net)
msg->dest = AA->Internetgate().addr;
} }
else else
strcpy(msg->to, to_name.c_str()); strcpy(msg->to, to_name.c_str());

View File

@ -49,16 +49,10 @@ extern "C" {
extern char tl[256], tu[256]; extern char tl[256], tu[256];
inline int _nls_tolower(int c) { return tl[c]; } inline int _nls_tolower(int c) { return tl[c]; }
inline int _nls_toupper(int c) { return tu[c]; } inline int _nls_toupper(int c) { return tu[c]; }
#ifdef __MSVCRT__
inline int _nls_isspace(int c) { return (iscntrl(c) or (c == ' ')); }
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#define tolower(a) _nls_tolower((unsigned char)(a)) #define tolower(a) _nls_tolower((unsigned char)(a))
#define toupper(a) _nls_toupper((unsigned char)(a)) #define toupper(a) _nls_toupper((unsigned char)(a))
#ifdef __MSVCRT__
#define isspace(a) _nls_isspace((unsigned char)(a))
#endif
#endif #endif
#endif #endif

View File

@ -26,6 +26,8 @@
// Clipboard handling donated by Eugene Roshal // Clipboard handling donated by Eugene Roshal
// ------------------------------------------------------------------ // ------------------------------------------------------------------
#include <clocale>
#include <cstdio>
#include <gstrall.h> #include <gstrall.h>
#include <gmemdbg.h> #include <gmemdbg.h>
#include <gutlos.h> #include <gutlos.h>
@ -133,20 +135,32 @@ int g_init_os(int flags) {
SetFileApisToOEM(); SetFileApisToOEM();
GetConsoleTitle(ge_win_coldtitle, sizeof(ge_win_coldtitle)); GetConsoleTitle(ge_win_coldtitle, sizeof(ge_win_coldtitle));
if(WinVer.dwPlatformId == VER_PLATFORM_WIN32_NT) { if(WinVer.dwPlatformId == VER_PLATFORM_WIN32_NT) {
#ifdef __MSVCRT__
char locale[256] = "";
char *lc = setlocale(LC_CTYPE, "");
if(lc) {
strxcpy(locale, lc, 256);
lc = strchr(locale, '.');
if(lc) {
sprintf(lc+1, "%u", GetOEMCP());
}
}
setlocale(LC_CTYPE, locale);
#endif
for(i = 0; i < 256; i++) { for(i = 0; i < 256; i++) {
#ifndef __MSVCRT__
tu[i] = (toupper)(i); tu[i] = (toupper)(i);
tl[i] = (tolower)(i); tl[i] = (tolower)(i);
#endif
if(i >= ' ') { if(i >= ' ') {
CHAR chr = (CHAR)i; CHAR chr = (CHAR)i;
MultiByteToWideChar(CP_OEMCP, 0, &chr, 1, oem2unicode+i, 1); MultiByteToWideChar(CP_OEMCP, 0, &chr, 1, oem2unicode+i, 1);
} }
} }
#ifndef __MSVCRT__
return 0; return 0;
#endif
} }
#ifdef __MSVCRT__
else
setlocale(LC_CTYPE, "C");
#endif
// Due to Win9x doesn't have proper locale support we should rebuild // Due to Win9x doesn't have proper locale support we should rebuild
// tolower/toupper tables // tolower/toupper tables
char src[2], dst[2]; char src[2], dst[2];