Various fixes, mostly for win32 console

This commit is contained in:
Alexander S. Aganichev
2000-11-06 14:26:34 +00:00
parent c3374170a9
commit f0b3dea792
25 changed files with 473 additions and 625 deletions

View File

@@ -176,10 +176,15 @@ void Cleanup(void) {
int smax = MinV((int)GLOG_STORELINES, LOG.storelines);
for(int s=0; s<smax; s++)
cout << LOG.storeline[s] << endl;
if(LOG.storelines > GLOG_STORELINES)
cout << "(See also " << CFG->logfile << ")" << endl;
if(errorlevel > EXIT_NONAME)
MakeNoise(SND_S_O_S);
if(CFG) {
if(LOG.storelines > GLOG_STORELINES)
cout << "(See also " << CFG->logfile << ")" << endl;
if(errorlevel > EXIT_NONAME)
MakeNoise(SND_S_O_S);
CfgReset();
}
#if defined(GUTLOS_FUNCS)
g_deinit_os();
@@ -256,7 +261,7 @@ int ShellToDos(char* command, char* message, int cls, int cursor, int swap, int
#endif
// Store the screen
vatch* scrnbuf = vsave();
vsavebuf* scrnbuf = vsave();
// Store current drive/dir
Path orgdir;

View File

@@ -86,7 +86,7 @@ bool ignore = false;
int cfgerrors = 0;
bool veryverbose = false;
bool shellvid = true;
word* oldscreen = NULL;
vsavebuf* oldscreen = NULL;
bool disablesound = false;
@@ -170,7 +170,7 @@ Win gold_mono1[16] = {
// ------------------------------------------------------------------
// Deallocate CFG at exit
static void CfgReset(void) {
void CfgReset(void) {
throw_delete(QWK);
throw_delete(EDIT);
@@ -188,8 +188,6 @@ static void CfgReset(void) {
void CfgInit() {
atexit(CfgReset);
CFG = new CfgGed;
throw_new(CFG);

View File

@@ -133,7 +133,7 @@ extern bool ignore;
extern int cfgerrors;
extern bool veryverbose;
extern bool shellvid;
extern word* oldscreen;
extern vsavebuf* oldscreen;
extern int keysread;

View File

@@ -374,51 +374,12 @@ static void w_brag() {
char buf[200];
char* logo[6];
#if defined(__USE_NCURSES__)
logo[0] = throw_strdup(" 88 88 88 ");
logo[1] = throw_strdup(" oooooo oooooo 88 oooo88 oooooo oooo88 o ");
logo[2] = throw_strdup(" 88 88 88 88 88 88 88 88oo88 88 88 o8o ");
logo[3] = throw_strdup(" 88oo88 88oo88 88 88oo88 88oooo 88oo88 8 ");
logo[4] = throw_strdup(" oo 88 ");
logo[5] = throw_strdup(" 88oooooo88 ");
#else
if(W_BBRAG == 7) {
logo[0] = throw_strdup(" ** ** ** ");
logo[1] = throw_strdup(" ****** ****** ** ****** ****** ****** * ");
logo[2] = throw_strdup(" ** ** ** ** ** ** ** ****** ** ** *** ");
logo[3] = throw_strdup(" ****** ****** ** ****** ****** ****** * ");
logo[4] = throw_strdup(" ** ** ");
logo[5] = throw_strdup(" ********** ");
}
else {
#if defined(__UNIX__)
if(gvid_xterm) {
logo[0] = throw_strdup(" ڿ ڿ ڿ ");
logo[1] = throw_strdup(" <20><><EFBFBD><EFBFBD>¿ <20><><EFBFBD><EFBFBD>¿ <20><> <20><><EFBFBD>Ĵ<EFBFBD> <20><><EFBFBD><EFBFBD>¿ <20><><EFBFBD>Ĵ<EFBFBD> <20> ");
logo[2] = throw_strdup(" <20><> <20><> <20><> <20><> <20><> <20><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><> <20>Ŵ ");
logo[3] = throw_strdup(" <20><><EFBFBD>Ĵ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> ");
logo[4] = throw_strdup(" ڿ <20><> ");
logo[5] = throw_strdup(" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ");
}
else {
#endif
logo[0] = throw_strdup(" ɻ ɻ ɻ ");
logo[1] = throw_strdup(" <20><><EFBFBD><EFBFBD>˻ <20><><EFBFBD><EFBFBD>˻ <20><> <20><><EFBFBD>͹<EFBFBD> <20><><EFBFBD><EFBFBD>˻ <20><><EFBFBD>͹<EFBFBD> <20> ");
logo[2] = throw_strdup(" <20><> <20><> <20><> <20><> <20><> <20><> <20><> <20><><EFBFBD><EFBFBD>ʼ <20><> <20><> <20>ι ");
logo[3] = throw_strdup(" <20><><EFBFBD>͹<EFBFBD> <20><><EFBFBD><EFBFBD>ʼ ȼ <20><><EFBFBD><EFBFBD>ʼ <20><><EFBFBD><EFBFBD>ʼ <20><><EFBFBD><EFBFBD>ʼ <20> ");
logo[4] = throw_strdup(" ɻ <20><> ");
logo[5] = throw_strdup(" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ ");
#if defined(__UNIX__)
}
gvid_boxcvt(logo[0]);
gvid_boxcvt(logo[1]);
gvid_boxcvt(logo[2]);
gvid_boxcvt(logo[3]);
gvid_boxcvt(logo[4]);
gvid_boxcvt(logo[5]);
#endif
}
#endif
W_READ = wopen_(1, 2, MAXROW-4, MAXCOL-5, W_BBRAG, C_BRAGB, C_BRAGW);
w_shadow();
@@ -844,6 +805,13 @@ void Initialize(int argc, char* argv[]) {
inforow = ((MAXROW-1)/2)+6;
if(CFG->aka.empty()) {
LOG.ErrConfig();
LOG.printf("! There do not seem to be any ADDRESS's defined.");
LOG.printf("+ Advice: Check your setup of ADDRESS's.");
ConfigErrorExit();
}
bool areasdefined = false;
// Do checking for an area and unknown aka's in area

View File

@@ -573,14 +573,16 @@ static void KludgeREPLYTO(GMsg* msg, const char* ptr) {
static void KludgeFROM(GMsg* msg, const char* ptr) {
INam fromname;
IAdr fromaddr;
strxmimecpy(msg->ifrom, ptr, msg->charsetlevel, sizeof(INam));
ParseInternetAddr(msg->ifrom, fromname, fromaddr);
if(*fromaddr)
strcpy(msg->iorig, fromaddr);
if(*fromname)
strxcpy(msg->realby, fromname, sizeof(msg->realby));
INam _fromname;
IAdr _fromaddr;
char* buf = throw_strdup(ptr);
strxcpy(msg->ifrom, buf, sizeof(msg->ifrom));
ParseInternetAddr(buf, _fromname, _fromaddr);
throw_free(buf);
if(*_fromaddr)
strcpy(msg->iorig, _fromaddr);
if(*_fromname)
strxcpy(msg->realby, _fromname, sizeof(msg->realby));
}
@@ -2533,13 +2535,13 @@ void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
// Charset translate header fields
if(header_recode) {
strxmimecpy(msg->realby, msg->realby, level, sizeof(INam));
strxmimecpy(msg->realto, msg->realto, level, sizeof(INam));
strxmimecpy(msg->by , msg->by , level, sizeof(INam));
strxmimecpy(msg->to , msg->to , level, sizeof(INam));
strxmimecpy(msg->realby, msg->realby, 0, sizeof(INam));
strxmimecpy(msg->realto, msg->realto, 0, sizeof(INam));
strxmimecpy(msg->by, msg->by, level, sizeof(INam));
strxmimecpy(msg->to, msg->to, level, sizeof(INam));
if(not (msg->attr.frq() or msg->attr.att() or msg->attr.urq()))
strxmimecpy(msg->re , msg->re , level, sizeof(ISub), true);
strxmimecpy(msg->re, msg->re, level, sizeof(ISub), true);
}
}
}

View File

@@ -59,8 +59,8 @@ int Area::LoadHdr(GMsg* msg, ulong msgno, bool enable_recode) {
if(retval and enable_recode) {
// Use default translation by default
int table = LoadCharset(NULL, NULL, 1);
if (table == -1)
msg->charsetlevel = LoadCharset(CFG->xlatimport, CFG->xlatlocalset);
if((table == -1) or not CFG->ignorecharset)
msg->charsetlevel = LoadCharset(AA->Xlatimport(), CFG->xlatlocalset);
else
msg->charsetlevel = LoadCharset(CFG->xlatcharset[table].imp, CFG->xlatcharset[table].exp);

View File

@@ -826,6 +826,7 @@ int ChangeXlatImport() {
CFG->ignorecharset = true;
AA->SetXlatimport(strtok(Listi[n], " "));
}
LoadCharset(AA->Xlatimport(), CFG->xlatlocalset);
for(n=0; n<xlatimports; n++)
throw_free(Listi[n]);
throw_free(Listi);

View File

@@ -42,16 +42,16 @@ gsound* snd = NULL;
// ------------------------------------------------------------------
#if defined(__MSDOS__)
#define Beep(A,B) { sound(A); usleep(B*CFG->beepfactor+1); }
#define Sleep(A) { usleep(A*CFG->beepfactor+1); }
#define Beep(A,B) { sound(A); usleep(CFG ? B*CFG->beepfactor+1 : B*1000); }
#define Sleep(A) { usleep(CFG ? A*CFG->beepfactor+1 : A*1000); }
#define NoSound() { nosound(); }
#elif defined(__OS2__)
#define Beep(A,B) { DosBeep(A, B*CFG->beepfactor/1000+1); }
#define Sleep(A) { usleep(A*CFG->beepfactor+1); }
#define Beep(A,B) { DosBeep(A, CFG ? B*CFG->beepfactor/1000+1 : B); }
#define Sleep(A) { usleep(CFG ? A*CFG->beepfactor+1 : A*1000); }
#define NoSound() { }
#elif defined(__WIN32__)
#define Beep(A,B) { (Beep)(A, B*CFG->beepfactor/1000+1); }
#define Sleep(A) { usleep(A*CFG->beepfactor+1); }
#define Beep(A,B) { (Beep)(A, CFG ? B*CFG->beepfactor/1000+1 : B); }
#define Sleep(A) { usleep(CFG ? A*CFG->beepfactor+1 : A*1000); }
#define NoSound() { }
#else
#define Beep(A,B) { }
@@ -93,12 +93,12 @@ void InitSound() {
snd = new gsound;
if(snd->is_installed()) {
if(not quiet)
printf("\n* Soundcard support was successfully initialized.");
cout << "* Soundcard support was successfully initialized." << endl;
atexit(ResetSound);
}
else {
if(not quiet)
printf("\n* Soundcard support could NOT be initialized!");
cout << "* Soundcard support could NOT be initialized!" << endl;
ResetSound();
}
break;

View File

@@ -149,6 +149,7 @@ void AdvancedSearch(GMsg* msg, int& topline, int& keyok);
void CfgInit();
void CfgInit2();
void CfgReset(void);
int PlayMacro(gkey key, int type);
int IsMacro(gkey key, int type);

View File

@@ -927,7 +927,7 @@ int LoadMessage(GMsg* msg, int margin) {
msg->orig_timesread = msg->timesread++;
if(reader_rcv_noise > 1) {
GMsg* tmsg = throw_calloc(1, sizeof(GMsg));
GMsg* tmsg = (GMsg*) throw_calloc(1, sizeof(GMsg));
AA->LoadHdr(tmsg, msg->msgno, false);
tmsg->attr = msg->attr;
tmsg->orig_timesread = msg->orig_timesread;

View File

@@ -395,41 +395,31 @@ bool guserbase::edit_entry(uint idx) {
bool guserbase::find_entry(char* name, bool lookup) {
gusrbaseentry ent;
if(not strblank(name)) {
string tmpaddr;
gusrbaseentry old_entry = entry;
uint old_index = index;
refresh_maximum_index();
usrbase.lseek(sizeof(gusrbaseheader), SEEK_SET);
for(uint i=0; i<=maximum_index; i++) {
read_entry(i, &ent);
for(index=0; index<=maximum_index; index++) {
read_entry(index, &entry);
if(strieql(name, ent.name) or (lookup and strieql(name, ent.macro))) {
strcpy(entry.macro, ent.macro);
strcpy(entry.name, ent.name);
entry.fidoaddr = ent.fidoaddr;
strcpy(entry.iaddr, ent.iaddr);
entry.prefer_internet = ent.prefer_internet;
entry.is_deleted = ent.is_deleted;
strcpy(entry.pseudo, ent.pseudo);
strcpy(entry.organisation, ent.organisation);
strcpy(entry.snail1, ent.snail1);
strcpy(entry.snail2, ent.snail2);
strcpy(entry.snail3, ent.snail3);
strcpy(entry.dataphone, ent.dataphone);
strcpy(entry.voicephone, ent.voicephone);
strcpy(entry.faxphone, ent.faxphone);
entry.firstdate = ent.firstdate;
entry.lastdate = ent.lastdate;
entry.times = ent.times;
strcpy(entry.homepage, ent.homepage);
entry.group = ent.group;
strcpy(entry.comment1, ent.comment1);
strcpy(entry.comment2, ent.comment1);
strcpy(entry.comment3, ent.comment1);
index = i;
if(strieql(name, entry.name))
return true;
else if(lookup) {
if(strieql(name, entry.macro) or streql(name, entry.iaddr))
return true;
else {
entry.fidoaddr.make_string(tmpaddr);
if (streql(name, tmpaddr.c_str()))
return true;
}
}
}
index = old_index;
entry = old_entry;
}
return false;