From 389bf63f6282359f8528f32fcbc093a103b26ff5 Mon Sep 17 00:00:00 2001 From: "Alexander S. Aganichev" Date: Sun, 12 May 2002 13:07:37 +0000 Subject: [PATCH] Fix numerical groups, packed feature --- docs/notework.txt | 7 +++++++ goldlib/gcfg/gxcrash.cpp | 10 +++++++--- goldlib/gcfg/gxhpt.cpp | 6 ++++-- goldlib/gcfg/gxqecho.cpp | 8 ++++++-- goldlib/gcfg/gxspace.cpp | 7 +++++-- goldlib/gcfg/gxsquish.cpp | 8 ++++++-- goldlib/gmb3/gmoezyc2.cpp | 9 +++++++++ goldlib/gmb3/gmofido1.cpp | 4 ++-- goldlib/gmb3/gmofido2.cpp | 24 +++++++++++++++++++++--- goldlib/gmb3/gmofido5.cpp | 6 +++--- goldlib/gmb3/gmojamm2.cpp | 20 ++++++++++++++------ goldlib/gmb3/gmojamm4.cpp | 6 +++--- goldlib/gmb3/gmojamm5.cpp | 2 +- goldlib/gmb3/gmopcbd2.cpp | 13 +++++++++++-- goldlib/gmb3/gmopcbd4.cpp | 4 ++-- goldlib/gmb3/gmopcbd5.cpp | 2 +- goldlib/gmb3/gmosmb1.cpp | 10 +++++----- goldlib/gmb3/gmosmb2.cpp | 15 +++++++++++++-- goldlib/gmb3/gmosqsh2.cpp | 17 ++++++++++++++++- goldlib/gmb3/gmosqsh5.cpp | 2 +- goldlib/gmb3/gmowcat1.cpp | 6 +++--- goldlib/gmb3/gmowcat2.cpp | 21 ++++++++++++++++++--- goldlib/gmb3/gmowcat4.cpp | 4 ++-- goldlib/gmb3/gmowcat5.cpp | 2 +- goldlib/gmb3/gmoxbbs1.cpp | 8 ++++---- goldlib/gmb3/gmoxbbs2.cpp | 21 ++++++++++++++++++--- goldlib/gmb3/gmoxbbs4.cpp | 4 ++-- goldlib/gmb3/gmoxbbs5.cpp | 2 +- 28 files changed, 186 insertions(+), 62 deletions(-) diff --git a/docs/notework.txt b/docs/notework.txt index c82588f..425237f 100644 --- a/docs/notework.txt +++ b/docs/notework.txt @@ -12,6 +12,13 @@ ______________________________________________________________________ Notes for GoldED+ 1.1.5, /snapshot/ ______________________________________________________________________ +- Fixed packed messagebase operation. The feature was only implemented + for the Squish messagebase and even there scan was improperly + implemented. + +- Fixed numerical group parsing for Crashmail/CrashEcho, HPT, + SpaceToss, QEcho and Partoss. + - Fixed reverse order sorting in 'M' criteria of AREALISTSORT (broken in previous snapshots). diff --git a/goldlib/gcfg/gxcrash.cpp b/goldlib/gcfg/gxcrash.cpp index a22660a..db4b69a 100644 --- a/goldlib/gcfg/gxcrash.cpp +++ b/goldlib/gcfg/gxcrash.cpp @@ -2,7 +2,7 @@ // ------------------------------------------------------------------ // The Goldware Library -// Copyright (C) 1999-2000 Alexander S. Aganichev +// Copyright (C) 1999-2002 Alexander S. Aganichev // ------------------------------------------------------------------ // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public @@ -217,8 +217,12 @@ void gareafile::ReadCrashmailCfg(const char* file) { unconfirmed = true; break; case CRC_GROUP: - if(jbstrcpy(tmp, buf, 100, &jbcpos)) - aa.groupid = toupper(tmp[0]); + if(jbstrcpy(tmp, buf, 100, &jbcpos)) { + if(isdigit(tmp[0])) + aa.groupid = 0x8000+atoi(tmp); + else if(isalpha(tmp[0])) + aa.groupid = toupper(tmp[0]); + } break; } } diff --git a/goldlib/gcfg/gxhpt.cpp b/goldlib/gcfg/gxhpt.cpp index 7d18c1a..61cd277 100644 --- a/goldlib/gcfg/gxhpt.cpp +++ b/goldlib/gcfg/gxhpt.cpp @@ -2,7 +2,7 @@ // ------------------------------------------------------------------ // The Goldware Library -// Copyright (C) 1999-2000 Alexander S. Aganichev +// Copyright (C) 1999-2002 Alexander S. Aganichev // ------------------------------------------------------------------ // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public @@ -301,7 +301,9 @@ void gareafile::ReadHPTFile(char* path, char* file, char* options, char* origin, gettok(&key, &val); - if(isalpha(*key)) + if(isdigit(*key)) + aa.groupid = 0x8000+atoi(key); + else if(isalpha(*key)) aa.groupid = toupper(*key); } else if (strieql(opt, "d")) { diff --git a/goldlib/gcfg/gxqecho.cpp b/goldlib/gcfg/gxqecho.cpp index 0526289..483fc34 100644 --- a/goldlib/gcfg/gxqecho.cpp +++ b/goldlib/gcfg/gxqecho.cpp @@ -2,7 +2,7 @@ // ------------------------------------------------------------------ // The Goldware Library -// Copyright (C) 1999 Alexander S. Aganichev +// Copyright (C) 1999, 2002 Alexander S. Aganichev // ------------------------------------------------------------------ // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public @@ -49,7 +49,11 @@ void gareafile::ReadQEchoFile(char* file, char* options, char* origin) { char* ptr = strtok(buf, " \t"); aa.reset(); - aa.groupid = atoi(ptr); + + if(isdigit(*ptr)) + aa.groupid = 0x8000+atoi(ptr); + else if(isalpha(*ptr)) + aa.groupid = toupper(*ptr); if((ptr = strtok(NULL, " \t")) != NULL) { if(*ptr == '*') { diff --git a/goldlib/gcfg/gxspace.cpp b/goldlib/gcfg/gxspace.cpp index 56c847d..435403a 100644 --- a/goldlib/gcfg/gxspace.cpp +++ b/goldlib/gcfg/gxspace.cpp @@ -2,7 +2,7 @@ // ------------------------------------------------------------------ // The Goldware Library -// Copyright (C) 1999-2000 Alexander S. Aganichev +// Copyright (C) 1999-2002 Alexander S. Aganichev // ------------------------------------------------------------------ // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public @@ -139,7 +139,10 @@ void gareafile::ReadSpaceAr(const char* file) { break; } case CRC_GROUP: - aa.groupid = toupper(*val); + if(isdigit(*val)) + aa.groupid = 0x8000+atoi(val); + else if(isalpha(*val)) + aa.groupid = toupper(*val); break; case CRC_ENDAREA: if(aa.msgbase) diff --git a/goldlib/gcfg/gxsquish.cpp b/goldlib/gcfg/gxsquish.cpp index a17d5a1..18486ac 100644 --- a/goldlib/gcfg/gxsquish.cpp +++ b/goldlib/gcfg/gxsquish.cpp @@ -118,8 +118,12 @@ void gareafile::ReadSquishFile(char* path, char* file, char* options, char* orig if(strnieql(p, "-$", 2)) { aa.msgbase = GMB_SQUISH; p += 2; - if((tolower(*p) == 'g') and isalpha(p[1])) - aa.groupid = toupper(p[1]); + if((tolower(*p) == 'g') and isalpha(p[1])) { + if(isdigit(p[1])) + aa.groupid = 0x8000+atoi(p+1); + else if(isalpha(p[1])) + aa.groupid = toupper(p[1]); + } else if(tolower(*p) == 'n') { key = ++p; getkeyval(&key, &p); diff --git a/goldlib/gmb3/gmoezyc2.cpp b/goldlib/gmb3/gmoezyc2.cpp index e79b4a8..ef675f1 100644 --- a/goldlib/gmb3/gmoezyc2.cpp +++ b/goldlib/gmb3/gmoezyc2.cpp @@ -36,6 +36,12 @@ void EzycomArea::raw_scan(int __keep_index) { int _wasopen = isopen; if(not _wasopen) { + if(ispacked()) { + const char* newpath = Unpack(path()); + if(newpath == NULL) + packed(false); + set_real_path(newpath ? newpath : path()); + } isopen++; data_open(); test_raw_open(__LINE__); @@ -107,6 +113,9 @@ void EzycomArea::raw_scan(int __keep_index) { if(not _wasopen) { raw_close(); data_close(); + if(ispacked()) { + CleanUnpacked(real_path()); + } isopen--; } diff --git a/goldlib/gmb3/gmofido1.cpp b/goldlib/gmb3/gmofido1.cpp index 0b664a1..90dcd84 100644 --- a/goldlib/gmb3/gmofido1.cpp +++ b/goldlib/gmb3/gmofido1.cpp @@ -61,7 +61,7 @@ void FidoArea::data_close() { char* FidoArea::build_msgname(char* __buf, ulong __msgno) { - sprintf(__buf, "%s%lu.msg", path(), __msgno); + sprintf(__buf, "%s%lu.msg", real_path(), __msgno); return __buf; } @@ -192,7 +192,7 @@ void FidoArea::save_lastread() { GFTRK("FidoSaveLastread"); - int _fh = ::sopen(AddPath(path(), wide->fidolastread), O_RDWR|O_CREAT|O_BINARY, WideSharemode, S_STDRW); + int _fh = ::sopen(AddPath(real_path(), wide->fidolastread), O_RDWR|O_CREAT|O_BINARY, WideSharemode, S_STDRW); if(_fh != -1) { word _lastread = (word)Msgn->CvtReln(lastread); lseekset(_fh, wide->userno, sizeof(word)); diff --git a/goldlib/gmb3/gmofido2.cpp b/goldlib/gmb3/gmofido2.cpp index d66ebcb..9941185 100644 --- a/goldlib/gmb3/gmofido2.cpp +++ b/goldlib/gmb3/gmofido2.cpp @@ -37,11 +37,22 @@ void FidoArea::raw_scan(bool __scanpm) { GFTRK("FidoArea::raw_scan"); + int _wasopen = isopen; + if(not _wasopen) { + isopen++; + if(ispacked()) { + const char* newpath = Unpack(path()); + if(newpath == NULL) + packed(false); + set_real_path(newpath ? newpath : path()); + } + } + register uint _active = 0; register ulong* _msgnoptr = NULL; register ulong* _msgndx = Msgn->tag; - gposixdir d(path()); + gposixdir d(real_path()); if(WideDebug) WideLog->printf("- %s/*.msg", d.fullpath()); const gdirentry *de; @@ -65,7 +76,7 @@ void FidoArea::raw_scan(bool __scanpm) { // Get the lastread msgno word _lastread = 0; - int _fh = ::sopen(AddPath(path(), wide->fidolastread), O_RDONLY|O_BINARY, WideSharemode, S_STDRD); + int _fh = ::sopen(AddPath(real_path(), wide->fidolastread), O_RDONLY|O_BINARY, WideSharemode, S_STDRD); if(_fh != -1) { lseekset(_fh, wide->userno, sizeof(word)); read(_fh, &_lastread, sizeof(word)); @@ -113,7 +124,7 @@ void FidoArea::raw_scan(bool __scanpm) { // Read highwater mark data->highwatermark = 0; if(isecho() and wide->fidohwmarks) { - _fh = test_open(AddPath(path(), "1.msg"), O_RDONLY|O_BINARY, WideSharemode); + _fh = test_open(AddPath(real_path(), "1.msg"), O_RDONLY|O_BINARY, WideSharemode); if(_fh != -1) { read(_fh, &_hdr, sizeof(FidoHdr)); data->highwatermark = _hdr.replyto; @@ -175,6 +186,13 @@ void FidoArea::raw_scan(bool __scanpm) { ); } + if(not _wasopen) { + if(ispacked()) { + CleanUnpacked(real_path()); + } + isopen--; + } + GFTRK(NULL); } diff --git a/goldlib/gmb3/gmofido5.cpp b/goldlib/gmb3/gmofido5.cpp index 2626adc..06268ce 100644 --- a/goldlib/gmb3/gmofido5.cpp +++ b/goldlib/gmb3/gmofido5.cpp @@ -75,8 +75,8 @@ int FidoArea::renumber() { if(_msgno != Msgn->at(_count)) { Path _oldname, _newname; - sprintf(_oldname, "%s%lu.msg", path(), Msgn->at(_count)); - sprintf(_newname, "%s%lu.msg", path(), _msgno); + sprintf(_oldname, "%s%lu.msg", real_path(), Msgn->at(_count)); + sprintf(_newname, "%s%lu.msg", real_path(), _msgno); // Get the file attribute of the message struct stat st; @@ -152,7 +152,7 @@ Line* FidoArea::make_dump_msg(Line*& lin, gmsg* msg, char* lng_head) { AddLine (NULL, "Hexdump of Fido/Opus-style message header and text"); AddLineF(line, "------------------------------------------------------------------------------"); line = AddLine(line, ""); - AddLineF(line, "File : %s%lu.msg", path(), msg->msgno); + AddLineF(line, "File : %s%lu.msg", real_path(), msg->msgno); AddLineF(line, "From : %-35.35s", _hdr.by); AddLineF(line, "To : %-35.35s", _hdr.to); AddLineF(line, "Subject : %-72.72s", _hdr.re); diff --git a/goldlib/gmb3/gmojamm2.cpp b/goldlib/gmb3/gmojamm2.cpp index 487c7da..92f5cc4 100644 --- a/goldlib/gmb3/gmojamm2.cpp +++ b/goldlib/gmb3/gmojamm2.cpp @@ -97,13 +97,13 @@ void JamArea::raw_open() { GFTRK("JamArea::raw_open"); Path file; - sprintf(file, "%s.jhr", path()); data->fhjhr = test_open(file); - sprintf(file, "%s.jdx", path()); data->fhjdx = test_open(file); - sprintf(file, "%s.jlr", path()); data->fhjlr = test_open(file); + sprintf(file, "%s.jhr", real_path()); data->fhjhr = test_open(file); + sprintf(file, "%s.jdx", real_path()); data->fhjdx = test_open(file); + sprintf(file, "%s.jlr", real_path()); data->fhjlr = test_open(file); if(not just_scanning) { - sprintf(file, "%s.jdt", path()); data->fhjdt = test_open(file); + sprintf(file, "%s.jdt", real_path()); data->fhjdt = test_open(file); if(not jamwide->smapihw) { - sprintf(file, "%s.cmhw", path()); data->fhjhw = ::sopen(file, O_RDWR|O_BINARY, WideSharemode, S_STDRW); + sprintf(file, "%s.cmhw", real_path()); data->fhjhw = ::sopen(file, O_RDWR|O_BINARY, WideSharemode, S_STDRW); } } @@ -208,6 +208,12 @@ void JamArea::raw_scan(int __keep_index, int __scanpm) { if(not _was_open) { if(not __keep_index or __scanpm) just_scanning = true; + if(ispacked()) { + const char* newpath = Unpack(path()); + if(newpath == NULL) + packed(false); + set_real_path(newpath ? newpath : path()); + } isopen++; data_open(); open_area(); @@ -325,7 +331,6 @@ void JamArea::raw_scan(int __keep_index, int __scanpm) { ); } - // Free the .JDX buffer throw_free(_jdxbuf); @@ -333,6 +338,9 @@ void JamArea::raw_scan(int __keep_index, int __scanpm) { if(not _was_open) { raw_close(); data_close(); + if(ispacked()) { + CleanUnpacked(real_path()); + } isopen--; } diff --git a/goldlib/gmb3/gmojamm4.cpp b/goldlib/gmb3/gmojamm4.cpp index 2e90ab4..7e0b1b1 100644 --- a/goldlib/gmb3/gmojamm4.cpp +++ b/goldlib/gmb3/gmojamm4.cpp @@ -48,11 +48,11 @@ void JamArea::lock() { while(::lock(data->fhjhr, 0, 1) == -1) { // Tell the world - if(PopupLocked(++_tries, true, path()) == false) { + if(PopupLocked(++_tries, true, real_path()) == false) { WideLog->ErrLock(); raw_close(); WideLog->printf("! A JAM msgbase file could not be locked."); - WideLog->printf(": %s.JHR.", path()); + WideLog->printf(": %s.jhr.", real_path()); WideLog->ErrOSInfo(); LockErrorExit(); } @@ -72,7 +72,7 @@ void JamArea::lock() { if(not jamwide->smapihw) { if(data->fhjhw == -1) { Path file; - sprintf(file, "%s.cmhw", path()); data->fhjhw = ::sopen(file, O_RDWR|O_BINARY, WideSharemode, S_STDRW); + sprintf(file, "%s.cmhw", real_path()); data->fhjhw = ::sopen(file, O_RDWR|O_BINARY, WideSharemode, S_STDRW); } if(data->fhjhw != -1) { lseek(data->fhjhw, 0, SEEK_SET); diff --git a/goldlib/gmb3/gmojamm5.cpp b/goldlib/gmb3/gmojamm5.cpp index b3e4300..0b53e7a 100644 --- a/goldlib/gmb3/gmojamm5.cpp +++ b/goldlib/gmb3/gmojamm5.cpp @@ -93,7 +93,7 @@ Line* JamArea::make_dump_msg(Line*& lin, gmsg* __msg, char* lng_head) { AddLine (NULL, "Hexdump of JAM message header, subfields and text"); AddLineF(line, "------------------------------------------------------------------------------"); line = AddLine(line, ""); - AddLineF(line, "Msgbase : %s", path()); + AddLineF(line, "Msgbase : %s", real_path()); AddLineF(line, "Signature : %s", _hdr->signature); AddLineF(line, "Revision : %u", _hdr->revision); AddLineF(line, "ReservedWord : %u", _hdr->reservedword); diff --git a/goldlib/gmb3/gmopcbd2.cpp b/goldlib/gmb3/gmopcbd2.cpp index 612a3f1..00350ff 100644 --- a/goldlib/gmb3/gmopcbd2.cpp +++ b/goldlib/gmb3/gmopcbd2.cpp @@ -202,8 +202,8 @@ void PcbArea::raw_open() { GFTRK("PcbRawOpen"); if(not just_scanning) - data->fhmsg = test_open(path()); - data->fhidx = test_open(AddPath(path(), ".idx")); + data->fhmsg = test_open(real_path()); + data->fhidx = test_open(AddPath(real_path(), ".idx")); GFTRK(NULL); } @@ -220,6 +220,12 @@ void PcbArea::raw_scan(int __keep_index, int __scanpm) { if(not _was_open) { if(not __keep_index) just_scanning = true; + if(ispacked()) { + const char* newpath = Unpack(path()); + if(newpath == NULL) + packed(false); + set_real_path(newpath ? newpath : path()); + } isopen++; data_open(); raw_open(); @@ -345,6 +351,9 @@ void PcbArea::raw_scan(int __keep_index, int __scanpm) { if(not _was_open) { raw_close(); data_close(); + if(ispacked()) { + CleanUnpacked(real_path()); + } isopen--; } diff --git a/goldlib/gmb3/gmopcbd4.cpp b/goldlib/gmb3/gmopcbd4.cpp index 4589718..e745e26 100644 --- a/goldlib/gmb3/gmopcbd4.cpp +++ b/goldlib/gmb3/gmopcbd4.cpp @@ -45,11 +45,11 @@ void PcbArea::lock() { if(WideCanLock) { long _tries = 0; while(::lock(data->fhmsg, 16, 6) == -1) { - if(PopupLocked(++_tries, true, path()) == false) { + if(PopupLocked(++_tries, true, real_path()) == false) { WideLog->ErrLock(); raw_close(); WideLog->printf("! A PCBoard msgbase file could not be locked."); - WideLog->printf(": %s.", path()); + WideLog->printf(": %s.", real_path()); WideLog->ErrOSInfo(); LockErrorExit(); } diff --git a/goldlib/gmb3/gmopcbd5.cpp b/goldlib/gmb3/gmopcbd5.cpp index e448635..fdf5750 100644 --- a/goldlib/gmb3/gmopcbd5.cpp +++ b/goldlib/gmb3/gmopcbd5.cpp @@ -107,7 +107,7 @@ Line* PcbArea::make_dump_msg(Line*& lin, gmsg* __msg, char* lng_head) { AddLine (NULL, "Hexdump of PCBoard message header and text"); AddLineF(line, "------------------------------------------------------------------------------"); line = AddLine(line, ""); - AddLineF(line, "Msgbase : %s", path()); + AddLineF(line, "Msgbase : %s", real_path()); AddLineF(line, "BoardNo : %u", board()); AddLineF(line, "MsgOffset : %li", _idx.offset); AddLineF(line, "Status : \'%c\'", _hdr.status); diff --git a/goldlib/gmb3/gmosmb1.cpp b/goldlib/gmb3/gmosmb1.cpp index 3cc20eb..20f9f82 100644 --- a/goldlib/gmb3/gmosmb1.cpp +++ b/goldlib/gmb3/gmosmb1.cpp @@ -60,7 +60,7 @@ void SMBInit() { void SMBArea::data_open() { data = smbdata + (smbdatano++); - strxcpy(data->file, path(), sizeof(data->file) - 3); + strxcpy(data->file, real_path(), sizeof(data->file) - 3); data->sdt_fp = data->shd_fp = data->sid_fp = data->sda_fp = data->sha_fp = NULL; data->retry_time = 1; data->last_error[0] = NUL; @@ -113,7 +113,7 @@ void SMBArea::open() { // User requested to exit WideLog->ErrOpen(); WideLog->printf("! Synchronet message base could not be opened (%s).", data->last_error); - WideLog->printf(": %s", path()); + WideLog->printf(": %s", real_path()); WideLog->ErrOSInfo(); OpenErrorExit(); } @@ -136,7 +136,7 @@ void SMBArea::open() { WideLog->ErrOpen(); WideLog->printf("! Synchronet message base could not be created (%s).", data->last_error); - WideLog->printf(": %s", path()); + WideLog->printf(": %s", real_path()); WideLog->ErrOSInfo(); OpenErrorExit(); } @@ -199,7 +199,7 @@ void SMBArea::resume() // User requested to exit WideLog->ErrOpen(); WideLog->printf("! Synchronet message base could not be opened (%s).", data->last_error); - WideLog->printf(": %s", path()); + WideLog->printf(": %s", real_path()); WideLog->ErrOSInfo(); OpenErrorExit(); } @@ -222,7 +222,7 @@ void SMBArea::resume() WideLog->ErrOpen(); WideLog->printf("! Synchronet message base could not be created (%s).", data->last_error); - WideLog->printf(": %s", path()); + WideLog->printf(": %s", real_path()); WideLog->ErrOSInfo(); OpenErrorExit(); } diff --git a/goldlib/gmb3/gmosmb2.cpp b/goldlib/gmb3/gmosmb2.cpp index 6aaa257..0973cba 100644 --- a/goldlib/gmb3/gmosmb2.cpp +++ b/goldlib/gmb3/gmosmb2.cpp @@ -36,8 +36,15 @@ void SMBArea::raw_scan(bool keep_index, bool scanpm) GFTRK("SMBArea::raw_scan"); smb_t *_was_data = data; - if(_was_data == NULL) + if(_was_data == NULL) { + if(ispacked()) { + const char* newpath = Unpack(path()); + if(newpath == NULL) + packed(false); + set_real_path(newpath ? newpath : path()); + } data_open(); + } ulong firstmsgno = 0; ulong lastmsgno = 0; Msgn->Reset(); @@ -105,8 +112,12 @@ void SMBArea::raw_scan(bool keep_index, bool scanpm) scanpm ? (int)PMrk->Count() : -1 ); } - if(_was_data == NULL) + if(_was_data == NULL) { data_close(); + if(ispacked()) { + CleanUnpacked(real_path()); + } + } GFTRK(NULL); } diff --git a/goldlib/gmb3/gmosqsh2.cpp b/goldlib/gmb3/gmosqsh2.cpp index 247eeca..91fa7a7 100644 --- a/goldlib/gmb3/gmosqsh2.cpp +++ b/goldlib/gmb3/gmosqsh2.cpp @@ -83,6 +83,17 @@ void SquishArea::raw_scan(int __keep_index, int __scanpm) { wide = squishwide; } + int _wasopen = isopen; + if(not _wasopen) { + if(ispacked()) { + const char* newpath = Unpack(path()); + if(newpath == NULL) + packed(false); + set_real_path(newpath ? newpath : path()); + } + isopen++; + } + // Load the lastread dword _lastread = 0; int _fh = ::sopen(AddPath(real_path(), ".sql"), O_RDONLY|O_BINARY, WideSharemode, S_STDRD); @@ -93,7 +104,7 @@ void SquishArea::raw_scan(int __keep_index, int __scanpm) { } // Open Squish files for scanning unless they are already open - if(not isopen) { + if(not _wasopen) { data->idx = NULL; data->base.totalmsgs = 0; @@ -129,6 +140,10 @@ void SquishArea::raw_scan(int __keep_index, int __scanpm) { ::close(data->fhsqi); data->fhsqi = -1; } + if(ispacked()) { + CleanUnpacked(real_path()); + } + isopen--; } register ulong _msgno; diff --git a/goldlib/gmb3/gmosqsh5.cpp b/goldlib/gmb3/gmosqsh5.cpp index 4b9f892..4c2cb20 100644 --- a/goldlib/gmb3/gmosqsh5.cpp +++ b/goldlib/gmb3/gmosqsh5.cpp @@ -88,7 +88,7 @@ Line* SquishArea::make_dump_msg(Line*& lin, gmsg* msg, char* lng_head) { AddLine (NULL, "Hexdump of Squish-style message header and text"); AddLineF(line, "------------------------------------------------------------------------------"); line = AddLine(line, ""); - AddLineF(line, "Msgbase : %s", path()); + AddLineF(line, "Msgbase : %s", real_path()); AddLineF(line, "From : %-36.36s", _hdr.from); AddLineF(line, "To : %-36.36s", _hdr.to); AddLineF(line, "Subject : %-72.72s", _hdr.subj); diff --git a/goldlib/gmb3/gmowcat1.cpp b/goldlib/gmb3/gmowcat1.cpp index d033d75..109319b 100644 --- a/goldlib/gmb3/gmowcat1.cpp +++ b/goldlib/gmb3/gmowcat1.cpp @@ -111,8 +111,8 @@ void WCatArea::raw_open() { GFTRK("WCatRawOpen"); - data->fhix = test_open(AddPath(path(), ".ix")); - data->fhdat = test_open(AddPath(path(), ".dat")); + data->fhix = test_open(AddPath(real_path(), ".ix")); + data->fhdat = test_open(AddPath(real_path(), ".dat")); GFTRK(NULL); } @@ -178,7 +178,7 @@ void WCatArea::save_lastread() { GFTRK("WCatSaveLastread"); - int _fh = ::sopen(AddPath(path(), ".lrd"), O_RDWR|O_CREAT|O_BINARY, WideSharemode, S_STDRW); + int _fh = ::sopen(AddPath(real_path(), ".lrd"), O_RDWR|O_CREAT|O_BINARY, WideSharemode, S_STDRW); if(_fh != -1) { word _lastread = (word)Msgn->CvtReln(lastread); lseekset(_fh, wcatwide->userno, sizeof(word)); diff --git a/goldlib/gmb3/gmowcat2.cpp b/goldlib/gmb3/gmowcat2.cpp index c045161..ce018c0 100644 --- a/goldlib/gmb3/gmowcat2.cpp +++ b/goldlib/gmb3/gmowcat2.cpp @@ -78,9 +78,20 @@ void WCatArea::raw_scan(int __keep_index, int __scanpm) { wide = wcatwide; } + int _wasopen = isopen; + if(not _wasopen) { + if(ispacked()) { + const char* newpath = Unpack(path()); + if(newpath == NULL) + packed(false); + set_real_path(newpath ? newpath : path()); + } + isopen++; + } + // Load the lastread dword _lastread = 0; - int _fh = ::sopen(AddPath(path(), ".lrd"), O_RDONLY|O_BINARY, WideSharemode, S_STDRD); + int _fh = ::sopen(AddPath(real_path(), ".lrd"), O_RDONLY|O_BINARY, WideSharemode, S_STDRD); if(_fh != -1) { lseekset(_fh, wide->userno, sizeof(dword)); read(_fh, &_lastread, sizeof(dword)); @@ -88,7 +99,7 @@ void WCatArea::raw_scan(int __keep_index, int __scanpm) { } // Open WildCat! files for scanning unless they are already open - if(not isopen) { + if(not _wasopen) { data->idx = NULL; data->base.recsize = 0; @@ -96,7 +107,7 @@ void WCatArea::raw_scan(int __keep_index, int __scanpm) { data->base.nextmsgno = 0; // Open index file - data->fhix = ::sopen(AddPath(path(), ".ix"), O_RDONLY|O_BINARY, WideSharemode, S_STDRD); + data->fhix = ::sopen(AddPath(real_path(), ".ix"), O_RDONLY|O_BINARY, WideSharemode, S_STDRD); if(data->fhix != -1) { // Allocate index buffer and read from file @@ -106,6 +117,10 @@ void WCatArea::raw_scan(int __keep_index, int __scanpm) { ::close(data->fhix); data->fhix = -1; } + if(ispacked()) { + CleanUnpacked(real_path()); + } + isopen--; } register uint _active = 0; diff --git a/goldlib/gmb3/gmowcat4.cpp b/goldlib/gmb3/gmowcat4.cpp index 08be8e2..931ecb3 100644 --- a/goldlib/gmb3/gmowcat4.cpp +++ b/goldlib/gmb3/gmowcat4.cpp @@ -45,11 +45,11 @@ void WCatArea::lock() { if(WideCanLock) { long _tries = 0; while(::lock(data->fhix, 0, 1) == -1) { - if(PopupLocked(++_tries, true, path()) == false) { + if(PopupLocked(++_tries, true, real_path()) == false) { WideLog->ErrLock(); raw_close(); WideLog->printf("! A WildCat! msgbase file could not be locked."); - WideLog->printf(": %s.IX.", path()); + WideLog->printf(": %s.ix.", real_path()); WideLog->ErrOSInfo(); LockErrorExit(); } diff --git a/goldlib/gmb3/gmowcat5.cpp b/goldlib/gmb3/gmowcat5.cpp index 0f074d5..1ad95e5 100644 --- a/goldlib/gmb3/gmowcat5.cpp +++ b/goldlib/gmb3/gmowcat5.cpp @@ -66,7 +66,7 @@ Line* WCatArea::make_dump_msg(Line*& lin, gmsg* msg, char* lng_head) { AddLine (NULL, "Hexdump of WildCat! message header and text"); AddLineF(line, "------------------------------------------------------------------------------"); line = AddLine(line, ""); - AddLineF(line, "Path : %s", path()); + AddLineF(line, "Path : %s", real_path()); AddLineF(line, "MagicNumber: %08lXh", _hdr.magicnumber); AddLineF(line, "MsgNumber : %u", _hdr.msgno); AddLineF(line, "Orig : %s", STRNP2C(_hdr.from)); diff --git a/goldlib/gmb3/gmoxbbs1.cpp b/goldlib/gmb3/gmoxbbs1.cpp index 9e81d1f..254d451 100644 --- a/goldlib/gmb3/gmoxbbs1.cpp +++ b/goldlib/gmb3/gmoxbbs1.cpp @@ -124,9 +124,9 @@ void XbbsArea::raw_open() { GFTRK("XbbsRawOpen"); - data->fhdata = test_open(AddPath(path(), ".Data")); - data->fhindex = test_open(AddPath(path(), ".Index")); - data->fhtext = test_open(AddPath(path(), ".Text")); + data->fhdata = test_open(AddPath(real_path(), ".Data")); + data->fhindex = test_open(AddPath(real_path(), ".Index")); + data->fhtext = test_open(AddPath(real_path(), ".Text")); wide->isopen++; if(wide->isopen == 1) wide->user->fh = ::sopen(AddPath(wide->path, "Users"), O_RDONLY|O_BINARY, WideSharemode, S_STDRW); @@ -222,7 +222,7 @@ void XbbsArea::save_lastread() { GFTRK("XbbsSaveLastread"); - int _fh = ::sopen(AddPath(path(), ".lmr"), O_RDWR|O_CREAT|O_BINARY, WideSharemode, S_STDRW); + int _fh = ::sopen(AddPath(real_path(), ".lmr"), O_RDWR|O_CREAT|O_BINARY, WideSharemode, S_STDRW); if(_fh != -1) { ulong _lastread = Msgn->CvtReln(lastread); lseekset(_fh, wide->userno+1, sizeof(ulong)); diff --git a/goldlib/gmb3/gmoxbbs2.cpp b/goldlib/gmb3/gmoxbbs2.cpp index 9b21150..e6481c0 100644 --- a/goldlib/gmb3/gmoxbbs2.cpp +++ b/goldlib/gmb3/gmoxbbs2.cpp @@ -88,9 +88,20 @@ void XbbsArea::raw_scan(int __keep_index, int __scanpm) { wide = xbbswide; } + int _wasopen = isopen; + if(not _wasopen) { + if(ispacked()) { + const char* newpath = Unpack(path()); + if(newpath == NULL) + packed(false); + set_real_path(newpath ? newpath : path()); + } + isopen++; + } + // Load the lastread ulong _lastread = 0; - int _fh = ::sopen(AddPath(path(), ".lmr"), O_RDONLY|O_BINARY, WideSharemode, S_STDRD); + int _fh = ::sopen(AddPath(real_path(), ".lmr"), O_RDONLY|O_BINARY, WideSharemode, S_STDRD); if(_fh != -1) { lseekset(_fh, wide->userno+1, sizeof(ulong)); read(_fh, &_lastread, sizeof(ulong)); @@ -98,13 +109,13 @@ void XbbsArea::raw_scan(int __keep_index, int __scanpm) { } // Open AdeptXBBS files for scanning unless they are already open - if(not isopen) { + if(not _wasopen) { data->idx = NULL; data->idx_size = 0; // Open index file - data->fhindex = ::sopen(AddPath(path(), ".Index"), O_RDONLY|O_BINARY, WideSharemode, S_STDRD); + data->fhindex = ::sopen(AddPath(real_path(), ".Index"), O_RDONLY|O_BINARY, WideSharemode, S_STDRD); if(data->fhindex != -1) { // Allocate index buffer and read from file @@ -114,6 +125,10 @@ void XbbsArea::raw_scan(int __keep_index, int __scanpm) { ::close(data->fhindex); data->fhindex = -1; } + if(ispacked()) { + CleanUnpacked(real_path()); + } + isopen--; } register uint _active = 0; diff --git a/goldlib/gmb3/gmoxbbs4.cpp b/goldlib/gmb3/gmoxbbs4.cpp index a5cf397..2cd104c 100644 --- a/goldlib/gmb3/gmoxbbs4.cpp +++ b/goldlib/gmb3/gmoxbbs4.cpp @@ -61,11 +61,11 @@ void XbbsArea::lock_file(int handle, long position, long length) { long tries = 0; while(::lock(handle, position, length) == -1) { - if(PopupLocked(++tries, true, path()) == false) { + if(PopupLocked(++tries, true, real_path()) == false) { WideLog->ErrLock(); raw_close(); Path file; - strcpy(file, path()); + strcpy(file, real_path()); if(handle == data->fhdata) strcat(file, ".Data"); else if(handle == data->fhtext) diff --git a/goldlib/gmb3/gmoxbbs5.cpp b/goldlib/gmb3/gmoxbbs5.cpp index 290f489..1436fb3 100644 --- a/goldlib/gmb3/gmoxbbs5.cpp +++ b/goldlib/gmb3/gmoxbbs5.cpp @@ -70,7 +70,7 @@ Line* XbbsArea::make_dump_msg(Line*& lin, gmsg* msg, char* lng_head) { AddLine (NULL, "Hexdump of AdeptXBBS message header and text"); AddLineF(line, "------------------------------------------------------------------------------"); line = AddLine(line, ""); - AddLineF(line, "Path : %s", path()); + AddLineF(line, "Path : %s", real_path()); AddLineF(line, "UserRecno : %u (%s)", wide->userno, WideUsername[0]); line = AddLine(line, ""); AddLineF(line, "Header Record:");