Refactoring!

This commit is contained in:
Ianos Gnatiuc 2006-05-14 17:17:32 +00:00
parent 8d829c2ed2
commit 717827510e
25 changed files with 297 additions and 224 deletions

View File

@ -272,9 +272,9 @@ void AreaList::WriteAreaDef(const char* file)
if(strchr((*aa)->path(), ' '))
tmp += 2;
maxpath = MaxV(maxpath, tmp);
if((*aa)->groupid() & 0x8000u)
sprintf(groupid, "#%u", (*aa)->groupid()&0x7FFF);
else if(g_isupper((*aa)->groupid()))
if ((*aa)->groupid() & 0x8000u)
gsprintf(PRINTF_DECLARE_BUFFER(groupid), "#%u", (*aa)->groupid()&0x7FFF);
else if (g_isupper((*aa)->groupid()))
*groupid = (char)(*aa)->groupid(), groupid[1] = NUL;
else
*groupid = '0', groupid[1] = NUL;
@ -290,11 +290,12 @@ void AreaList::WriteAreaDef(const char* file)
maxattr = MaxV(maxattr, tmp+2);
}
for(aa = idx.begin(); aa != idx.end(); aa++) {
sprintf(desc, "\"%s\"", (*aa)->desc());
if((*aa)->groupid() & 0x8000u)
sprintf(groupid, "#%u", (*aa)->groupid()&0x7FFF);
else if(g_isupper((*aa)->groupid()))
for (aa = idx.begin(); aa != idx.end(); aa++)
{
gsprintf(PRINTF_DECLARE_BUFFER(desc), "\"%s\"", (*aa)->desc());
if ((*aa)->groupid() & 0x8000u)
gsprintf(PRINTF_DECLARE_BUFFER(groupid), "#%u", (*aa)->groupid()&0x7FFF);
else if (g_isupper((*aa)->groupid()))
*groupid = (char)(*aa)->groupid(), groupid[1] = NUL;
else
*groupid = '0', groupid[1] = NUL;
@ -314,8 +315,8 @@ void AreaList::WriteAreaDef(const char* file)
else
#endif
strxcpy(msgbase, (*aa)->basetype(), sizeof(msgbase));
if(strchr((*aa)->echoid(), ' '))
sprintf(echoid, "\"%s\"", (*aa)->echoid());
if (strchr((*aa)->echoid(), ' '))
gsprintf(PRINTF_DECLARE_BUFFER(echoid), "\"%s\"", (*aa)->echoid());
else
strcpy(echoid, (*aa)->echoid());
if ((*aa)->isseparator())
@ -327,9 +328,10 @@ void AreaList::WriteAreaDef(const char* file)
strtrim(type)
);
}
else {
if(strchr((*aa)->path(), ' '))
sprintf(path, "\"%s\"", (*aa)->path());
else
{
if (strchr((*aa)->path(), ' '))
gsprintf(PRINTF_DECLARE_BUFFER(path), "\"%s\"", (*aa)->path());
else
strcpy(path, (*aa)->path());
if(memcmp(&(*aa)->aka(), &CFG->aka[0], sizeof(Addr)))
@ -339,8 +341,8 @@ void AreaList::WriteAreaDef(const char* file)
*attr = '('; /*)*/
MakeAttrStr(attr+1, sizeof(attr)-2, &(*aa)->attr());
strcat(attr, /*(*/ ")");
if((*aa)->originno())
sprintf(origin, " \"%.*s\"", (int)sizeof(origin)-4, CFG->origin[(*aa)->originno()].c_str());
if ((*aa)->originno())
gsprintf(PRINTF_DECLARE_BUFFER(origin), " \"%.*s\"", (int)sizeof(origin)-4, CFG->origin[(*aa)->originno()].c_str());
else
*origin = NUL;
fp.Printf("AREADEF %-*s %-*s %*s %s %s %-*s %-*s %-*s%s\n",
@ -404,4 +406,3 @@ void PcbAdjustArea(uint rec, const char* msgfile) {
// ------------------------------------------------------------------

View File

@ -174,25 +174,28 @@ void AreaList::AddNewArea(AreaCfg* aa)
strschg_environ(aa->path);
}
#ifndef GMB_NOHUDS
else if(streql(aa->basetype, "HUDSON")) {
if((aa->board < 1) or (aa->board > 200)) // Ignore areas with invalid numbers
else if (streql(aa->basetype, "HUDSON"))
{
if ((aa->board < 1) or (aa->board > 200)) // Ignore areas with invalid numbers
return;
sprintf(aa->path, "%u", aa->board);
gsprintf(PRINTF_DECLARE_BUFFER(aa->path), "%u", aa->board);
}
#endif
#ifndef GMB_NOGOLD
else if(streql(aa->basetype, "GOLDBASE")) {
if((aa->board < 1) or (aa->board > 500)) // Ignore areas with invalid numbers
else if (streql(aa->basetype, "GOLDBASE"))
{
if ((aa->board < 1) or (aa->board > 500)) // Ignore areas with invalid numbers
return;
sprintf(aa->path, "%u", aa->board);
gsprintf(PRINTF_DECLARE_BUFFER(aa->path), "%u", aa->board);
}
#endif
#ifndef GMB_NOEZY
else if(streql(aa->basetype, "EZYCOM")) {
else if (streql(aa->basetype, "EZYCOM"))
{
// Ignore areas with invalid numbers
if((aa->board < 1) or (aa->board > 1536))
if ((aa->board < 1) or (aa->board > 1536))
return;
sprintf(aa->path, "%u", aa->board);
gsprintf(PRINTF_DECLARE_BUFFER(aa->path), "%u", aa->board);
}
#endif
#ifndef GMB_NOWCAT

View File

@ -686,8 +686,8 @@ CfgGed::CfgGed() {
*searchfor = 0;
strcpy(stylecodepunct, " !?\"$%&()+,.:;<=>@[\\]^`{|}~\n\r\t");
*stylecodestops = 0;
sprintf(tasktitle, "%s%s%s%s", __gver_prename__, __gver_name__,
__gver_postname__, __gver_platform__);
gsprintf(PRINTF_DECLARE_BUFFER(tasktitle), "%s%s%s%s", __gver_prename__,
__gver_name__, __gver_postname__, __gver_platform__);
strcpy(tearline, "@longpid @version");
strcpy(whoto, "All");
strcpy(xlatlocalset, get_charset());

View File

@ -824,7 +824,7 @@ int ReadCfg(const char* cfgfile, int ignoreunknown)
if (veryverbose)
{
char buff[256];
sprintf(buff, " %c %04d: %s %s\n", cfgignore ? '-' : '+', line, key, val);
gsprintf(PRINTF_DECLARE_BUFFER(buff), " %c %04d: %s %s\n", cfgignore ? '-' : '+', line, key, val);
STD_PRINT(buff);
}

View File

@ -672,8 +672,11 @@ void ReadXlatTables()
strcpy(ChsTable.imp, strbtrim(ptr));
break;
case 5:
if(ChsTable.level)
sprintf(ChsTable.exp, "%s %d", strbtrim(ptr), ChsTable.level);
if (ChsTable.level)
{
gsprintf(PRINTF_DECLARE_BUFFER(ChsTable.exp), "%s %d",
strbtrim(ptr), ChsTable.level);
}
else
strcpy(ChsTable.exp, strbtrim(ptr));
break;
@ -848,4 +851,3 @@ void CookieIndex(char* textfile, char* indexfile)
// ------------------------------------------------------------------

View File

@ -152,7 +152,7 @@ void GPickArealist::dispbuf(char* buf, int areano) {
buf[MAXCOL-2] = NUL;
char areabuf[33];
sprintf(areabuf, "%u", CFG->switches.get(arealistnos) ? area->board() : areanumbers[areano]);
gsprintf(PRINTF_DECLARE_BUFFER(areabuf), "%u", CFG->switches.get(arealistnos) ? area->board() : areanumbers[areano]);
int areawidth = strlen(areabuf);
char markedbuf[2] = { " " };
@ -163,8 +163,8 @@ void GPickArealist::dispbuf(char* buf, int areano) {
int descwidth = strlen(strcpy(descbuf, area->desc()));
char countbuf[33];
if(area->isscanned)
sprintf(countbuf, "%u", (uint)area->Msgn.Count());
if (area->isscanned)
gsprintf(PRINTF_DECLARE_BUFFER(countbuf), "%u", (uint)area->Msgn.Count());
else
strcpy(countbuf, "-");
int countwidth = strlen(countbuf);
@ -174,8 +174,8 @@ void GPickArealist::dispbuf(char* buf, int areano) {
int pmarkwidth = 1;
char unreadbuf[33];
if(area->isscanned)
sprintf(unreadbuf, "%u", (uint)((CFG->arealisttype == AL_TOTNEW) ? area->unread : area->lastread()));
if (area->isscanned)
gsprintf(PRINTF_DECLARE_BUFFER(unreadbuf), "%u", (uint)((CFG->arealisttype == AL_TOTNEW) ? area->unread : area->lastread()));
else
strcpy(unreadbuf, "-");
int unreadwidth = strlen(unreadbuf);
@ -188,13 +188,15 @@ void GPickArealist::dispbuf(char* buf, int areano) {
int echoidwidth = strlen(strcpy(echoidbuf, area->echoid()));
char groupidbuf[10] = { "" };
if(groupid_width) {
if(area->groupid() & 0x8000u) {
if(groupid_width > 2)
sprintf(groupidbuf, "%u", area->groupid()&0x7FFF);
if (groupid_width)
{
if (area->groupid() & 0x8000u)
{
if (groupid_width > 2)
gsprintf(PRINTF_DECLARE_BUFFER(groupidbuf), "%u", area->groupid()&0x7FFF);
}
else if(g_isupper(area->groupid()))
sprintf(groupidbuf, "%c", (char)area->groupid());
else if (g_isupper(area->groupid()))
gsprintf(PRINTF_DECLARE_BUFFER(groupidbuf), "%c", (char)area->groupid());
}
int groupidwidth = strlen(groupidbuf);
@ -501,7 +503,7 @@ void GPickArealist::AreaDropMsgMarks(uint n) {
nummarks += (*AL.item)->Mark.Count();
char buf[256];
sprintf(buf, LNG->DropMarksInfo, longdotstr(nummarks));
gsprintf(PRINTF_DECLARE_BUFFER(buf), LNG->DropMarksInfo, longdotstr(nummarks));
w_info(buf);
int mode = MenuAreaDropMarks.Run();

View File

@ -209,27 +209,33 @@ int DoCarboncopy(GMsg* msg, GMsg** carbon) {
break;
case CC_HIDDEN:
ccline = msg->lin;
if(A == AA) {
sprintf(buf, "\001CC: %s %s", msg->To(), msg->dest.make_string(temp).c_str());
if (A == AA)
{
gsprintf(PRINTF_DECLARE_BUFFER(buf), "\001CC: %s %s", msg->To(), msg->dest.make_string(temp).c_str());
ccline = AddKludge(ccline, buf);
}
for(n=0; n<cc; n++) {
if((*carbon)[n].attr.tou()) {
sprintf(buf, "\001CC: %s %s", (*carbon)[n].To(), (*carbon)[n].dest.make_string(temp).c_str());
for (n=0; n<cc; n++)
{
if ((*carbon)[n].attr.tou())
{
gsprintf(PRINTF_DECLARE_BUFFER(buf), "\001CC: %s %s", (*carbon)[n].To(), (*carbon)[n].dest.make_string(temp).c_str());
ccline = AddKludge(ccline, buf);
(*carbon)[n].attr.tou0();
}
}
break;
case CC_VISIBLE:
sprintf(buf2, LNG->CCTo, LNG->ListCC);
if(A == AA) {
sprintf(buf, buf2, msg->To(), msg->dest.make_string(temp).c_str());
gsprintf(PRINTF_DECLARE_BUFFER(buf2), LNG->CCTo, LNG->ListCC);
if (A == AA)
{
gsprintf(PRINTF_DECLARE_BUFFER(buf), buf2, msg->To(), msg->dest.make_string(temp).c_str());
ccline = AddLine(ccline, buf);
}
for(n=0; n<cc; n++) {
if((*carbon)[n].attr.tou()) {
sprintf(buf, buf2, (*carbon)[n].To(), (*carbon)[n].dest.make_string(temp).c_str());
for (n = 0; n < cc; n++)
{
if ((*carbon)[n].attr.tou())
{
gsprintf(PRINTF_DECLARE_BUFFER(buf), buf2, (*carbon)[n].To(), (*carbon)[n].dest.make_string(temp).c_str());
ccline = AddLine(ccline, buf);
(*carbon)[n].attr.tou0();
}
@ -247,24 +253,28 @@ int DoCarboncopy(GMsg* msg, GMsg** carbon) {
hline += msg->To();
++line_items;
}
for(n=0; n < cc; n++) {
if((*carbon)[n].attr.tou()) {
for (n = 0; n < cc; n++)
{
if ((*carbon)[n].attr.tou())
{
const char *user = (*carbon)[n].To();
if((hline.length() + strlen(user) + 2 > margintext) and line_items) {
sprintf(buf, LNG->CCTo, hline.c_str());
if ((hline.length() + strlen(user) + 2 > margintext) and line_items)
{
gsprintf(PRINTF_DECLARE_BUFFER(buf), LNG->CCTo, hline.c_str());
ccline = AddLine(ccline, buf);
line_items = 0;
hline = "";
}
if(line_items != 0)
if (line_items != 0)
hline += ", ";
hline += user;
++line_items;
(*carbon)[n].attr.tou0();
}
}
if(line_items) {
sprintf(buf, LNG->CCTo, hline.c_str());
if (line_items)
{
gsprintf(PRINTF_DECLARE_BUFFER(buf), LNG->CCTo, hline.c_str());
ccline = AddLine(ccline, buf);
}
}
@ -427,8 +437,9 @@ void DoCrosspost(GMsg* msg, std::vector<int> &postareas) {
case CC_VISIBLE:
// Expand in line
{
if(not hideoriginal) {
sprintf(buf, LNG->Originallyin, AA->echoid());
if (not hideoriginal)
{
gsprintf(PRINTF_DECLARE_BUFFER(buf), LNG->Originallyin, AA->echoid());
xcline = AddLine(xcline, buf);
}
@ -439,8 +450,9 @@ void DoCrosspost(GMsg* msg, std::vector<int> &postareas) {
const char *echoid = AL[postareas[i]]->echoid();
if(postareas_attrs[i] or strieql(AA->echoid(), echoid))
continue;
if((hline.length() + strlen(echoid) + 2 > margintext) and line_items) {
sprintf(buf, LNG->Crosspostedin, hline.c_str());
if ((hline.length() + strlen(echoid) + 2 > margintext) and line_items)
{
gsprintf(PRINTF_DECLARE_BUFFER(buf), LNG->Crosspostedin, hline.c_str());
xcline = AddLine(xcline, buf);
line_items = 0;
hline = "";
@ -450,24 +462,27 @@ void DoCrosspost(GMsg* msg, std::vector<int> &postareas) {
hline += echoid;
++line_items;
}
if(line_items) {
sprintf(buf, LNG->Crosspostedin, hline.c_str());
if (line_items)
{
gsprintf(PRINTF_DECLARE_BUFFER(buf), LNG->Crosspostedin, hline.c_str());
xcline = AddLine(xcline, buf);
}
}
break;
case CC_NAMES:
// Expand in column
if(not hideoriginal) {
sprintf(buf, LNG->Originallyin, AA->echoid());
if (not hideoriginal)
{
gsprintf(PRINTF_DECLARE_BUFFER(buf), LNG->Originallyin, AA->echoid());
xcline = AddLine(xcline, buf);
}
for(int i=local_xps; i < postareas.size(); i++) {
for (int i = local_xps; i < postareas.size(); i++)
{
const char *echoid = AL[postareas[i]]->echoid();
if(postareas_attrs[i] or strieql(AA->echoid(), echoid))
if (postareas_attrs[i] or strieql(AA->echoid(), echoid))
continue;
sprintf(buf, LNG->Crosspostedin, echoid);
gsprintf(PRINTF_DECLARE_BUFFER(buf), LNG->Crosspostedin, echoid);
xcline = AddLine(xcline, buf);
}
break;

View File

@ -581,10 +581,11 @@ void CmfMsgs(GMsg* msg, bool torecycle)
if(need_netmail_kludges) {
char buf[256] = "";
if(not strstr(msg->txt, "\001INTL"))
if (not strstr(msg->txt, "\001INTL"))
// The INTL kludge for zone crossing
if(CFG->useintl and (CFG->useintl == YES or (msg->dest.zone != msg->orig.zone))) {
sprintf(buf, "\001INTL %u:%u/%u %u:%u/%u%c",
if (CFG->useintl and (CFG->useintl == YES or (msg->dest.zone != msg->orig.zone)))
{
gsprintf(PRINTF_DECLARE_BUFFER(buf), "\001INTL %u:%u/%u %u:%u/%u%c",
msg->dest.zone ? msg->dest.zone : AA->Aka().addr.zone,
msg->dest.net, msg->dest.node,
msg->orig.zone ? msg->orig.zone : AA->Aka().addr.zone,

View File

@ -73,7 +73,7 @@ char* MakeOrigin(GMsg* msg, const char* orig) {
if(*origin == '@')
GetRandomLine(origin, sizeof(origin), origin+1);
sprintf(msg->origin, "%.*s (%s)", (int)(79 - 11 - 2 - strlen(buf) - 1), origin, buf);
gsprintf(PRINTF_DECLARE_BUFFER(msg->origin), "%.*s (%s)", (int)(79 - 11 - 2 - strlen(buf) - 1), origin, buf);
return msg->origin;
}
@ -231,12 +231,16 @@ const char* get_informative_string(void) {
static char informative_string[356] = "";
if(informative_string[0] == NUL)
sprintf(informative_string, "%s%s%s%s %s%i.%i.%i%s (%s)",
if (informative_string[0] == NUL)
{
gsprintf(PRINTF_DECLARE_BUFFER(informative_string),
"%s%s%s%s %s%i.%i.%i%s (%s)",
__gver_prename__, __gver_name__, __gver_postname__,
__gver_platform__, __gver_preversion__, __gver_major__,
__gver_minor__, __gver_release__, __gver_postversion__,
ggetosstring());
}
return informative_string;
}
@ -351,9 +355,10 @@ void DoKludges(int mode, GMsg* msg, int kludges) {
CvtMessageIDtoMSGID(buf2, buf, AA->echoid(), "MSGID");
strcpy(msg->msgids, buf+8);
}
else {
else
{
msg->orig.make_string(buf2, msg->odom);
sprintf(msg->msgids, "%s %08x", buf2, getMsgId());
gsprintf(PRINTF_DECLARE_BUFFER(msg->msgids), "%s %08x", buf2, getMsgId());
}
if(CFG->switches.get(usemsgid) and strcmp(AA->basetype(), "PCBOARD")) {
sprintf(buf, "\001MSGID: %s", msg->msgids);
@ -796,8 +801,9 @@ void DoTearorig(int mode, GMsg* msg) {
TokenXlat(mode, msg->origin, sizeof(msg->origin), msg, msg, CurrArea);
// Add the tagline, tearline and origin as defined
if(AA->Taglinesupport() and *msg->tagline) {
sprintf(buf, "%c%c%c %s", AA->Taglinechar(), AA->Taglinechar(), AA->Taglinechar(), msg->tagline);
if (AA->Taglinesupport() and *msg->tagline)
{
gsprintf(PRINTF_DECLARE_BUFFER(buf), "%c%c%c %s", AA->Taglinechar(), AA->Taglinechar(), AA->Taglinechar(), msg->tagline);
strtrim(buf);
line = AddLine(line, buf);
line->type |= GLINE_TAGL;
@ -806,8 +812,9 @@ void DoTearorig(int mode, GMsg* msg) {
line = AddLine(line, MakeTearline(msg, buf));
line->type |= GLINE_TEAR;
}
if(ctrlinfo & CI_ORIG) {
sprintf(buf, " * Origin: %s", msg->origin);
if (ctrlinfo & CI_ORIG)
{
gsprintf(PRINTF_DECLARE_BUFFER(buf), " * Origin: %s", msg->origin);
line = AddLine(line, buf);
line->type |= GLINE_ORIG;
}

View File

@ -140,9 +140,10 @@ void SaveLines(int mode, const char* savefile, GMsg* msg, int margin, bool clip)
throw_release(msg->txt);
msg->txt = old_msg_txt;
}
else {
else
{
char buf[256];
sprintf(buf, LNG->CouldNotOpen, fnam);
gsprintf(PRINTF_DECLARE_BUFFER(buf), LNG->CouldNotOpen, fnam);
w_info(buf);
waitkeyt(10000);
w_info(NULL);
@ -288,7 +289,7 @@ static void WriteMsgs(GMsg* msg) {
continue;
}
}
sprintf(buf, LNG->WritingFile, AA->Outputfile());
gsprintf(PRINTF_DECLARE_BUFFER(buf), LNG->WritingFile, AA->Outputfile());
w_info(buf);
AA->LoadMsg(msg, msg->msgno, prnmargin);
SaveLines(overwrite ? MODE_WRITE : MODE_APPEND, AA->Outputfile(), msg, prnmargin);

View File

@ -267,10 +267,12 @@ int ShellToDos(const char* command, char* message, vattr cls, int cursor, int pa
}
#else
int envn = 0;
while(environ[envn] and *environ[envn]) {
if(strnieql(environ[envn], "PROMPT=", 7)) {
while (environ[envn] and *environ[envn])
{
if (strnieql(environ[envn], "PROMPT=", 7))
{
strcpy(oldprompt, environ[envn]);
sprintf(prompt, "PROMPT=%s%s", LNG->Prompt, *oldprompt ? oldprompt+7 : "");
gsprintf(PRINTF_DECLARE_BUFFER(prompt), "PROMPT=%s%s", LNG->Prompt, *oldprompt ? oldprompt+7 : "");
environ[envn] = prompt;
break;
}

View File

@ -1324,7 +1324,7 @@ void IEclass::SpellCheck()
strcpy(_buf2, AddPath(CFG->goldpath, EDIT->File()));
strchg(_buf2, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR);
strischg(_buf, "@file", _buf2);
sprintf(_buf2, LNG->SpellChecker, _buf);
gsprintf(PRINTF_DECLARE_BUFFER(_buf2), LNG->SpellChecker, _buf);
ShellToDos(_buf, _buf2, LGREY_|_BLACK, YES);
LoadFile();

View File

@ -125,14 +125,14 @@ void gfileselect::do_delayed() {
char buf[200];
char tmp[80];
sprintf(buf, "%s %10s", LNG->SelectedFiles, longdotstr(tmp, selfiles));
gsprintf(PRINTF_DECLARE_BUFFER(buf), "%s %10s", LNG->SelectedFiles, longdotstr(tmp, selfiles));
wprints(ylen-4, MAXCOL-34, wattr, buf);
sprintf(buf, "%s %10s", LNG->SelectedBytes, longdotstr(tmp, selbytes));
gsprintf(PRINTF_DECLARE_BUFFER(buf), "%s %10s", LNG->SelectedBytes, longdotstr(tmp, selbytes));
wprints(ylen-3, MAXCOL-34, wattr, buf);
sprintf(buf, "%s %10s", LNG->TotalFiles, longdotstr(tmp, totfiles));
gsprintf(PRINTF_DECLARE_BUFFER(buf), "%s %10s", LNG->TotalFiles, longdotstr(tmp, totfiles));
wprints(ylen-2, MAXCOL-34, wattr, buf);
sprintf(buf, "%s %10s", LNG->TotalBytes, longdotstr(tmp, totbytes));
gsprintf(PRINTF_DECLARE_BUFFER(buf), "%s %10s", LNG->TotalBytes, longdotstr(tmp, totbytes));
wprints(ylen-1, MAXCOL-34, wattr, buf);
if(CFG->switches.get(filelistpagebar))
@ -149,20 +149,24 @@ const char *gfileselect::gensize(uint32_t size) {
static char ret[16];
if(size >= 1048576000) {
if (size >= 1048576000)
{
size += 5242880;
sprintf(ret, "%3d.%02dG", (int) size/1073741824, KFIX((size%1073741824)/1024));
gsprintf(PRINTF_DECLARE_BUFFER(ret), "%3d.%02dG", (int) size/1073741824, KFIX((size%1073741824)/1024));
}
else if(size >= 1024000) {
else if (size >= 1024000)
{
size += 5120;
sprintf(ret, "%3d.%02dM", (int) size/1048576, KFIX((size%1048576)/1024));
gsprintf(PRINTF_DECLARE_BUFFER(ret), "%3d.%02dM", (int) size/1048576, KFIX((size%1048576)/1024));
}
else if(size >= 1000) {
else if (size >= 1000)
{
size += 5;
sprintf(ret, "%3d.%02dk", (int) size/1024, KFIX(size%1024));
gsprintf(PRINTF_DECLARE_BUFFER(ret), "%3d.%02dk", (int) size/1024, KFIX(size%1024));
}
else
sprintf(ret, "%d", (int) size);
gsprintf(PRINTF_DECLARE_BUFFER(ret), "%d", (int) size);
return ret;
}
@ -175,7 +179,7 @@ void gfileselect::print_line(uint idx, uint pos, bool isbar) {
FFblk& fb = fblk[idx];
sprintf(buf, "%c%-*.*s %8s %2d-%02d-%02d %2d:%02d ",
gsprintf(PRINTF_DECLARE_BUFFER(buf), "%c%-*.*s %8s %2d-%02d-%02d %2d:%02d ",
fb.selected ? MMRK_MARK : ' ',
MAXCOL-62, (int)MAXCOL-62,
fb.name,
@ -402,7 +406,7 @@ void FileSelect(GMsg* msg, char* title, FileSpec* fspec) {
wvline(0, MAXCOL-36, MAX_POS+1, W_BMENU, C_MENUB);
whline(MAX_POS-4, MAXCOL-36, 36, W_BMENU, C_MENUB);
sprintf(buf, " %s ", strtrim(fbuf));
gsprintf(PRINTF_DECLARE_BUFFER(buf), " %s ", strtrim(fbuf));
wmessage(buf, TP_BORD, 1, C_MENUT);
wmessage(title, TP_BORD, MAXCOL-34, C_MENUT);
@ -585,7 +589,8 @@ void CreateFileMsgs(int mode, GMsg* msg) {
msg->dest.zone, msg->dest.net, msg->dest.node, msg->dest.point
);
}
sprintf(subj, "%s%s%s%s%s ", fspec[x].delsent ? "^" : "", fspec[x].path, fspec[x].fblk ? (fspec[x].fblk[m].name ? fspec[x].fblk[m].name : "") : "", *fspec[x].password ? " " : "", fspec[x].password);
gsprintf(PRINTF_DECLARE_BUFFER(subj), "%s%s%s%s%s ", fspec[x].delsent ? "^" : "", fspec[x].path, fspec[x].fblk ? (fspec[x].fblk[m].name ? fspec[x].fblk[m].name : "") : "", *fspec[x].password ? " " : "", fspec[x].password);
#if !defined(__UNIX__) && !defined(__WIN32__)
strupr(subj);
#endif
@ -887,11 +892,11 @@ void FileRequest(GMsg* msg) {
}
// Do we have a complete announcement?
if(*file and *desc) {
if (*file and *desc)
{
// Yes, so add it to the list
freqfile = (char**)throw_realloc(freqfile, (freqfiles+3)*sizeof(char*));
sprintf(buf, " %-12s %8s %s", file, filesize, desc);
gsprintf(PRINTF_DECLARE_BUFFER(buf), " %-12s %8s %s", file, filesize, desc);
strsetsz(buf, 76);
freqfile[freqfiles] = throw_strdup(buf);
*desc = *file = *filesize = NUL;
@ -910,11 +915,12 @@ void FileRequest(GMsg* msg) {
}
// Add the filelist
if(not (CFG->frqoptions & FREQ_NOFILES)) {
if (not (CFG->frqoptions & FREQ_NOFILES))
{
strcpy(file, "FILES");
sprintf(desc, LNG->FilelistFrom, msg->By());
gsprintf(PRINTF_DECLARE_BUFFER(desc), LNG->FilelistFrom, msg->By());
freqfile = (char**)throw_realloc(freqfile, (freqfiles+3)*sizeof(char*));
sprintf(buf, " %-12.12s %-52.52s ", file, desc);
gsprintf(PRINTF_DECLARE_BUFFER(buf), " %-12.12s %-52.52s ", file, desc);
freqfile[freqfiles] = throw_strdup(buf);
*desc = *file = NUL;
freqfiles++;
@ -972,8 +978,9 @@ void FileRequest(GMsg* msg) {
if((strlen(msg->re) + strlen(tmpbuf)) < sizeof(ISub)) { // We can only fill one subject line in this version...
strcat(msg->re, tmpbuf);
strcat(msg->re, " ");
if(fh != -1) {
sprintf(buf, "%-12s %s\n", tmpbuf, ptr2);
if (fh != -1)
{
gsprintf(PRINTF_DECLARE_BUFFER(buf), "%-12s %s\n", tmpbuf, ptr2);
write(fh, buf, strlen(buf));
}
freqs++;
@ -995,8 +1002,9 @@ void FileRequest(GMsg* msg) {
if((strlen(msg->re) + strlen(tmpbuf)) < sizeof(ISub)) { // We can only fill one subject line in this version...
strcat(msg->re, tmpbuf);
strcat(msg->re, " ");
if(fh != -1) {
sprintf(buf, "%-12s %s\n", tmpbuf, ptr2);
if (fh != -1)
{
gsprintf(PRINTF_DECLARE_BUFFER(buf), "%-12s %s\n", tmpbuf, ptr2);
write(fh, buf, strlen(buf));
}
freqs++;

View File

@ -476,19 +476,21 @@ int EditHeaderinfo(int mode, GMsgHeaderView &view, bool doedithdr) {
strcpy(msg->to, "UUCP");
else
strcpy(msg->to, msg->idest);
if(*msg->realby and *msg->iorig) {
if (*msg->realby and *msg->iorig)
{
char quot[2] = "\"";
if((msg->realby[0] == '\"') or (strpbrk(msg->realby, " \t") == NULL))
if ((msg->realby[0] == '\"') or (strpbrk(msg->realby, " \t") == NULL))
quot[0] = NUL;
sprintf(msg->ifrom, "%s%s%s <%s>", quot, msg->realby, quot, msg->iorig);
gsprintf(PRINTF_DECLARE_BUFFER(msg->ifrom), "%s%s%s <%s>", quot, msg->realby, quot, msg->iorig);
}
else
strcpy(msg->ifrom, msg->iorig);
if(*msg->realto) {
if (*msg->realto)
{
char quot[2] = "\"";
if((msg->realto[0] == '\"') or (strpbrk(msg->realto, " \t") == NULL))
if ((msg->realto[0] == '\"') or (strpbrk(msg->realto, " \t") == NULL))
quot[0] = NUL;
sprintf(msg->ito, "%s%s%s <%s>", quot, msg->realto, quot, msg->idest);
gsprintf(PRINTF_DECLARE_BUFFER(msg->ito), "%s%s%s <%s>", quot, msg->realto, quot, msg->idest);
}
else
strcpy(msg->ito, msg->idest);
@ -531,14 +533,15 @@ int EditHeaderinfo(int mode, GMsgHeaderView &view, bool doedithdr) {
Name name;
strcpy(name, msg->To());
StripQuotes(name);
if(CFG->internetgateexp == ((RFCName << 2) | RFCAddress)) {
if (CFG->internetgateexp == ((RFCName << 2) | RFCAddress))
{
char quot[2] = "\"";
if((name[0] == '\"') or (strpbrk(name, " \t") == NULL))
if ((name[0] == '\"') or (strpbrk(name, " \t") == NULL))
quot[0] = NUL;
sprintf(msg->ito, "%s%s%s <%s>", quot, name, quot, msg->iaddr);
gsprintf(PRINTF_DECLARE_BUFFER(msg->ito), "%s%s%s <%s>", quot, name, quot, msg->iaddr);
}
else
sprintf(msg->ito, "%s (%s)", msg->iaddr, name);
gsprintf(PRINTF_DECLARE_BUFFER(msg->ito), "%s (%s)", msg->iaddr, name);
}
else
strcpy(msg->ito, msg->iaddr);

View File

@ -405,7 +405,7 @@ static void w_brag() {
whline(6, 0, MAXCOL-5, W_BBRAG, C_BRAGB);
wvline(0, 47, 7, W_BBRAG, C_BRAGB);
sprintf(buf, "---*-*-*** %s ***-*-*---", __gver_releasename__);
gsprintf(PRINTF_DECLARE_BUFFER(buf), "---*-*-*** %s ***-*-*---", __gver_releasename__);
wcenters(8, C_BRAGW, buf);
wcenters(10, C_BRAGW, "This program is free software; it is licensed under the");
@ -415,14 +415,18 @@ static void w_brag() {
wcenters(MAXROW-10, C_BRAGW, "This executable is distributed by");
if (*__gver_vendor_fido__)
sprintf(buf, "%s (Fido: %s) - <%s>", __gver_vendor_name__,
__gver_vendor_fido__,
__gver_vendor_email__);
{
gsprintf(PRINTF_DECLARE_BUFFER(buf), "%s (Fido: %s) - <%s>",
__gver_vendor_name__, __gver_vendor_fido__, __gver_vendor_email__);
}
else
sprintf(buf, "%s <%s>", __gver_vendor_name__,
__gver_vendor_email__);
{
gsprintf(PRINTF_DECLARE_BUFFER(buf), "%s <%s>",
__gver_vendor_name__, __gver_vendor_email__);
}
wcenters(MAXROW-9, C_BRAGW, buf);
sprintf(buf, "Compiled on %s %s", __gver_date__, __gver_time__);
gsprintf(PRINTF_DECLARE_BUFFER(buf), "Compiled on %s %s", __gver_date__, __gver_time__);
wcenters(MAXROW-8, C_BRAGW, buf);
}
@ -729,7 +733,7 @@ void Initialize(int argc, char* argv[]) {
// Start the log
static char buf[200];
sprintf(buf, "%s %s (%s %s)", __gver_longpid__, __gver_ver__, __gver_date__, __gver_time__);
gsprintf(PRINTF_DECLARE_BUFFER(buf), "%s %s (%s %s)", __gver_longpid__, __gver_ver__, __gver_date__, __gver_time__);
LOG.open(CFG->logfile, buf, __gver_shortlogname__, CFG->logformat);
// Read/compile various configs

View File

@ -637,12 +637,13 @@ static void KludgeBCC(GMsg* msg, const char* ptr) {
IAdr buf2;
mime_header_encode(buf2, _toname, msg);
char quot[2] = "\"";
if((buf2[0] == '\"') or (strpbrk(buf2, " \t") == NULL))
if ((buf2[0] == '\"') or (strpbrk(buf2, " \t") == NULL))
quot[0] = NUL;
sprintf(buf, "%s%s%s <%s>", quot, buf2, quot, _toaddr);
gsprintf(PRINTF_DECLARE_BUFFER(buf), "%s%s%s <%s>", quot, buf2, quot, _toaddr);
}
else
sprintf(buf, "%s", _toaddr);
gsprintf(PRINTF_DECLARE_BUFFER(buf), "%s", _toaddr);
strxcat(msg->ibcc, buf, sizeof(msg->ibcc));
}
}
@ -668,12 +669,13 @@ static void KludgeCC(GMsg* msg, const char* ptr) {
IAdr buf2;
mime_header_encode(buf2, _toname, msg);
char quot[2] = "\"";
if((buf[0] == '\"') or (strpbrk(buf2, " \t") == NULL))
if ((buf[0] == '\"') or (strpbrk(buf2, " \t") == NULL))
quot[0] = NUL;
sprintf(buf, "%s%s%s <%s>", quot, buf2, quot, _toaddr);
gsprintf(PRINTF_DECLARE_BUFFER(buf), "%s%s%s <%s>", quot, buf2, quot, _toaddr);
}
else
sprintf(buf, "%s", _toaddr);
gsprintf(PRINTF_DECLARE_BUFFER(buf), "%s", _toaddr);
strxcat(msg->icc, buf, sizeof(msg->icc));
}
}
@ -2069,8 +2071,9 @@ void MakeLineIndex(GMsg* msg, int margin, bool getvalue, bool header_recode) {
uint _size = strlen(msg->txt);
if(streql(AA->basetype(), "OPUS") or streql(AA->basetype(), "FTS1"))
idxadjust = 190;
for(idx=0; idx < _size; ptr+=16,idx+=16) {
sprintf(buf, "%04X ", idx+idxadjust);
for (idx=0; idx < _size; ptr+=16,idx+=16)
{
gsprintf(PRINTF_DECLARE_BUFFER(buf), "%04X ", idx+idxadjust);
HexDump16(buf+7, ptr, MinV((int)(_size-idx), 16), HEX_DUMP2);
line = AddLine(line, buf);
}
@ -3203,10 +3206,10 @@ Line* AddHexdump(Line*& line, void* data, size_t datalen) {
uint pos = 0;
char* ptr = (char*)data;
while(pos < datalen) {
while (pos < datalen)
{
uint dataleft = datalen - pos;
sprintf(buf, "%04X ", pos);
gsprintf(PRINTF_DECLARE_BUFFER(buf), "%04X ", pos);
HexDump16(buf+7, ptr, (dataleft < 16) ? dataleft : 16, HEX_DUMP2);
line = AddLine(line, buf);
ptr += 16;

View File

@ -772,9 +772,10 @@ int ChangeUsername() {
if(not CFG->username.empty()) {
Listi = (char**)throw_calloc(CFG->username.size()+1, sizeof(char*));
std::vector<Node>::iterator i;
for(n = 0, i = CFG->username.begin(); i != CFG->username.end(); n++, i++) {
for (n = 0, i = CFG->username.begin(); i != CFG->username.end(); n++, i++)
{
i->addr.make_string(adrs);
sprintf(buf, " %-35s %s ", i->name, adrs);
gsprintf(PRINTF_DECLARE_BUFFER(buf), " %-35s %s ", i->name, adrs);
Listi[n] = throw_strdup(buf);
}
n = MinV(n, (MAXROW-10));
@ -818,9 +819,10 @@ int ChangeTemplate() {
if(not CFG->tpl.empty()) {
Listi = (char**)throw_calloc(CFG->tpl.size()+1, sizeof(char*));
std::vector<Tpl>::iterator t;
for(n = 0, t = CFG->tpl.begin(); t != CFG->tpl.end(); n++, t++) {
for (n = 0, t = CFG->tpl.begin(); t != CFG->tpl.end(); n++, t++)
{
t->match.make_string(adrs);
sprintf(buf, " %-45s %s ", t->name, adrs);
gsprintf(PRINTF_DECLARE_BUFFER(buf), " %-45s %s ", t->name, adrs);
Listi[n] = throw_strdup(buf);
}
n = MinV(n, (MAXROW-10));
@ -858,9 +860,10 @@ int ChangeAka() {
if(CFG->aka.size() > 1) {
Listi = (char**)throw_calloc(CFG->aka.size()+1, sizeof(char*));
for(i = CFG->aka.begin(), n=0; i != CFG->aka.end(); n++, i++) {
for (i = CFG->aka.begin(), n=0; i != CFG->aka.end(); n++, i++)
{
i->addr.make_string(addr, i->domain);
sprintf(buf, " %s ", addr);
gsprintf(PRINTF_DECLARE_BUFFER(buf), " %s ", addr);
Listi[n] = throw_strdup(buf);
if(AA->Aka().addr.equals(i->addr))
startat = n;
@ -911,12 +914,12 @@ int ChangeXlatImport() {
}
Listi[0] = throw_strdup(LNG->CharsetAuto);
xlatimports = 1;
for(xlt = CFG->xlatcharset.begin(); xlt != CFG->xlatcharset.end(); xlt++) {
if(strieql(xlt->exp, CFG->xlatlocalset)) {
sprintf(buf, " %*.*s -> %-*.*s ",
maximport, maximport, xlt->imp,
maxexport, maxexport, xlt->exp
);
for (xlt = CFG->xlatcharset.begin(); xlt != CFG->xlatcharset.end(); xlt++)
{
if (strieql(xlt->exp, CFG->xlatlocalset))
{
gsprintf(PRINTF_DECLARE_BUFFER(buf), " %*.*s -> %-*.*s ",
maximport, maximport, xlt->imp, maxexport, maxexport, xlt->exp);
Listi[xlatimports++] = throw_strdup(buf);
}
}
@ -948,4 +951,3 @@ int ChangeXlatImport() {
// ------------------------------------------------------------------

View File

@ -359,8 +359,9 @@ void GMsgList::print_line(uint idx, uint pos, bool isbar) {
strsetsz(dbuf, 10);
else
*dbuf = NUL;
sprintf(nbuf, "%5u", (CFG->switches.get(disprealmsgno) ? ml->msgno : AA->Msgn.ToReln(ml->msgno)));
sprintf(buf, "%-5.5s%s%-*.*s %-*.*s%s%-*.*s %s",
gsprintf(PRINTF_DECLARE_BUFFER(nbuf), "%5u", (CFG->switches.get(disprealmsgno) ? ml->msgno : AA->Msgn.ToReln(ml->msgno)));
gsprintf(PRINTF_DECLARE_BUFFER(buf), "%-5.5s%s%-*.*s %-*.*s%s%-*.*s %s",
nbuf, ml->marks,
bysiz, bysiz, ml->by,
tosiz, tosiz, ml->to,
@ -939,7 +940,7 @@ void GThreadlist::print_line(uint idx, uint pos, bool isbar) {
marks[1] = MMRK_MARK;
}
sprintf(buf, "%6u %*c", (CFG->switches.get(disprealmsgno) ? t.msgno : AA->Msgn.ToReln(t.msgno)), tdlen, ' ');
gsprintf(PRINTF_DECLARE_BUFFER(buf), "%6u %*c", (CFG->switches.get(disprealmsgno) ? t.msgno : AA->Msgn.ToReln(t.msgno)), tdlen, ' ');
if(AA->Msglistdate() != MSGLISTDATE_NONE) {
char dbuf[11];

View File

@ -483,7 +483,7 @@ int GMenuEditfile::Run(GMsg* __msg) {
update_statuslinef(LNG->Quotepct, "ST_QUOTEPCT", __msg->quotepct, __msg->quotepct > 80 ? "!!!" : "");
char _title[80];
sprintf(_title, LNG->SaveMsg, __msg->lines);
gsprintf(PRINTF_DECLARE_BUFFER(_title), LNG->SaveMsg, __msg->lines);
AskInit(6, 0, _title, H_SaveMsg);
Begin();
@ -538,9 +538,11 @@ int GMenuEditfile::Run(GMsg* __msg) {
GetRandomLine(_buf, sizeof(_buf), _buf+1);
strcpy(__msg->tagline, _buf);
Line* _line = __msg->lin;
while(_line) {
if(_line->type & GLINE_TAGL) {
sprintf(_buf, "%c%c%c %s ", AA->Taglinechar(), AA->Taglinechar(), AA->Taglinechar(), __msg->tagline);
while (_line)
{
if (_line->type & GLINE_TAGL)
{
gsprintf(PRINTF_DECLARE_BUFFER(_buf), "%c%c%c %s ", AA->Taglinechar(), AA->Taglinechar(), AA->Taglinechar(), __msg->tagline);
strtrim(_buf);
_line->txt = _buf;
break;
@ -560,9 +562,11 @@ int GMenuEditfile::Run(GMsg* __msg) {
GetRandomLine(_buf, sizeof(_buf), _buf+1);
MakeOrigin(__msg, _buf);
Line* _line = __msg->lin;
while(_line) {
if(_line->type & GLINE_ORIG) {
sprintf(_buf, " * Origin: %s ", __msg->origin);
while (_line)
{
if (_line->type & GLINE_ORIG)
{
gsprintf(PRINTF_DECLARE_BUFFER(_buf), " * Origin: %s ", __msg->origin);
strtrim(_buf);
_line->txt = _buf;
break;
@ -1230,4 +1234,3 @@ int GMenuSChecker::Run(CSpellChecker &schecker, const char *word)
// ------------------------------------------------------------------

View File

@ -344,7 +344,7 @@ void MarkMsgs(GMsg* msg) {
// ---------------------------------------------------------------
case TAG_MARKYOURMAIL:
sprintf(markstring, "\"%s\"", AA->Username().name);
gsprintf(PRINTF_DECLARE_BUFFER(markstring), "\"%s\"", AA->Username().name);
// Drop through!
// ---------------------------------------------------------------

View File

@ -145,7 +145,7 @@ void TokenXlat(int mode, std::string &input, GMsg* msg, GMsg* oldmsg, int __orig
{
static char revbuf[5] = "";
if (revbuf[0] == NUL)
sprintf(revbuf, "%02d%02d", str2mon(__gver_date__), atoi(&__gver_date__[4]));
gsprintf(PRINTF_DECLARE_BUFFER(revbuf), "%02d%02d", str2mon(__gver_date__), atoi(&__gver_date__[4]));
char attr[80];
MakeAttrStr(attr, sizeof(attr), &msg->attr);
@ -175,10 +175,10 @@ void TokenXlat(int mode, std::string &input, GMsg* msg, GMsg* oldmsg, int __orig
char* modereptr = oldmsg->re;
char msgno[16];
sprintf(msgno, "%u", msg->attr.nwm() ? AA->Msgn.Count() + 1 : AA->Msgn.ToReln(msg->msgno));
gsprintf(PRINTF_DECLARE_BUFFER(msgno), "%u", msg->attr.nwm() ? AA->Msgn.Count() + 1 : AA->Msgn.ToReln(msg->msgno));
char msgs[16];
sprintf(msgs, "%u", AA->Msgn.Count() + (msg->attr.nwm() ? 1 : 0));
gsprintf(PRINTF_DECLARE_BUFFER(msgs), "%u", AA->Msgn.Count() + (msg->attr.nwm() ? 1 : 0));
if ((mode == MODE_QUOTE) or (mode == MODE_REPLYCOMMENT) or (mode == MODE_REPLY))
{
@ -231,7 +231,7 @@ void TokenXlat(int mode, std::string &input, GMsg* msg, GMsg* oldmsg, int __orig
if (tokenxchg(input, dst, "@odtime", odtime))
continue;
if (tokenxchg(input, dst, "@otzoffset", (oldmsg->tzutc == -32767) ? "" : (sprintf(buf, " %+05d", oldmsg->tzutc), buf)))
if (tokenxchg(input, dst, "@otzoffset", (oldmsg->tzutc == -32767) ? "" : (gsprintf(PRINTF_DECLARE_BUFFER(buf), " %+05d", oldmsg->tzutc), buf)))
continue;
if (tokenxchg(input, dst, "@ofrom", oldmsg->ifrom))
@ -384,7 +384,7 @@ void TokenXlat(int mode, std::string &input, GMsg* msg, GMsg* oldmsg, int __orig
if (tokenxchg(input, dst, "@cdtime", cdtime))
continue;
if (tokenxchg(input, dst, "@ctzoffset", AA->Usetzutc() ? (sprintf(buf, " %+05d", tzoffset()), buf) : ""))
if (tokenxchg(input, dst, "@ctzoffset", AA->Usetzutc() ? (gsprintf(PRINTF_DECLARE_BUFFER(buf), " %+05d", tzoffset()), buf) : ""))
continue;
if (tokenxchg(input, dst, "@fname", strbtrim(strtmp(msg->By())), 34))

View File

@ -176,22 +176,22 @@ void NodelistBrowser::AfterCursor() {
ftn_nodelist_entry* entryp = entries + (pos - 1);
sprintf(line1, " %s%s%s%s%s%s ",
gsprintf(PRINTF_DECLARE_BUFFER(line1), " %s%s%s%s%s%s ",
entryp->name,
(*entryp->system ? ", " : ""), entryp->system,
(*entryp->status ? " <" : ""), entryp->status,
(*entryp->status ? ">" : "")
);
sprintf(buf, "%s %s", LNG->Phone, *entryp->phone ? entryp->phone : "-Unpublished-");
gsprintf(PRINTF_DECLARE_BUFFER(buf), "%s %s", LNG->Phone, *entryp->phone ? entryp->phone : "-Unpublished-");
strrjust(strsetsz(buf, MAXCOL-strlen(line1)-1));
strcat(line1, buf);
strcat(line1, " ");
sprintf(line2, " %s%s%s",
gsprintf(PRINTF_DECLARE_BUFFER(line2), " %s%s%s",
entryp->location,
(*entryp->location ? ", " : ""), entryp->address
);
sprintf(buf, "%s%s%s%s",
gsprintf(PRINTF_DECLARE_BUFFER(buf), "%s%s%s%s",
entryp->baud,
(*entryp->baud ? " Bps" : ""),
((*entryp->baud and *entryp->flags) ? ", " : ""), entryp->flags
@ -204,20 +204,21 @@ void NodelistBrowser::AfterCursor() {
Path nlname;
*nlname = NUL;
if(NLP->index_name() and NLP->nodelist_name())
sprintf(nlname, " %s / %s ", NLP->index_name(), CleanFilename(NLP->nodelist_name()));
else if(NLP->index_name())
sprintf(nlname, " %s ", NLP->index_name());
if(*nlname)
if (NLP->index_name() and NLP->nodelist_name())
gsprintf(PRINTF_DECLARE_BUFFER(nlname), " %s / %s ", NLP->index_name(), CleanFilename(NLP->nodelist_name()));
else if (NLP->index_name())
gsprintf(PRINTF_DECLARE_BUFFER(nlname), " %s ", NLP->index_name());
if (*nlname)
listwin.title(nlname, tattr, TCENTER|TBOTTOM);
}
// ------------------------------------------------------------------
void NodelistBrowser::InitDisplay() {
sprintf(titlet, LNG->Lookup, user_maybe);
void NodelistBrowser::InitDisplay()
{
gsprintf(PRINTF_DECLARE_BUFFER(titlet), LNG->Lookup, user_maybe);
listwin.title(titlet, tattr, TCENTER);
Center();
@ -722,7 +723,7 @@ int NodelistBrowser::DoKey(gkey& keycode) {
else if(user_fuzidx)
user_maybe[--user_fuzidx] = 0;
user_maybe[user_fuzidx] = 0;
sprintf(titlet, LNG->Lookup, user_maybe);
gsprintf(PRINTF_DECLARE_BUFFER(titlet), LNG->Lookup, user_maybe);
listwin.title(titlet, tattr, TCENTER);
}
}

View File

@ -188,22 +188,27 @@ void CheckSubject(GMsg* msg, char* subj) {
}
// Generate the (first) processed subject line
if(specfiles) {
if (specfiles)
{
ISub buf;
*buf = NUL;
for(int x=0,n=0; x<fspecs; x++) {
for(int m=0; m<fspec[x].files; m++) {
for (int x = 0,n = 0; x < fspecs; x++)
{
for (int m = 0; m<fspec[x].files; m++)
{
ISub subject;
sprintf(subject, "%s%s%s%s%s ", fspec[x].delsent ? "^" : "", ReMapPath(fspec[x].path), fspec[x].fblk ? (fspec[x].fblk[m].name ? fspec[x].fblk[m].name : "") : "", *fspec[x].password ? " " : "", fspec[x].password);
if((strlen(buf) + strlen(subject)) > 71) {
gsprintf(PRINTF_DECLARE_BUFFER(subject), "%s%s%s%s%s ", fspec[x].delsent ? "^" : "", ReMapPath(fspec[x].path), fspec[x].fblk ? (fspec[x].fblk[m].name ? fspec[x].fblk[m].name : "") : "", *fspec[x].password ? " " : "", fspec[x].password);
if ((strlen(buf) + strlen(subject)) > 71)
{
n++;
break;
}
else
strcat(buf, subject);
}
if(n)
break;
if (n) break;
}
strtrim(strcpy(subj, buf));
}
@ -233,12 +238,13 @@ static void MakeMsg3(int& mode, GMsg* msg) {
std::vector<gaka>::iterator u;
msg->charsetlevel = 0;
if(*AA->Xlatexport()) {
if (*AA->Xlatexport())
{
msg->charsetlevel = LoadCharset(CFG->xlatlocalset, AA->Xlatexport());
if(msg->charsetlevel)
sprintf(msg->charset, "%s %d", AA->Xlatexport(), msg->charsetlevel);
if (msg->charsetlevel)
gsprintf(PRINTF_DECLARE_BUFFER(msg->charset), "%s %d", AA->Xlatexport(), msg->charsetlevel);
else
sprintf(msg->charset, "%s 2", CFG->xlatlocalset);
gsprintf(PRINTF_DECLARE_BUFFER(msg->charset), "%s 2", CFG->xlatlocalset);
}
// Do Timefields
@ -531,15 +537,16 @@ static void MakeMsg2(int& mode, int& status, int& forwstat, int& topline, GMsg*
}
if(mode == MODE_FORWARD)
status = MODE_SAVE;
if(*EDIT->External() and forwstat == NO and not EDIT->Internal()) {
if (*EDIT->External() and forwstat == NO and not EDIT->Internal())
{
strcpy(buf, EDIT->External());
sprintf(buf2, "%u", position);
gsprintf(PRINTF_DECLARE_BUFFER(buf2), "%u", position);
strischg(buf, "@line", buf2);
strcpy(buf2, AddPath(CFG->goldpath, EDIT->File()));
strchg(buf2, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR);
strischg(buf, "@file", buf2);
long ftbefore = GetFiletime(AddPath(CFG->goldpath, EDIT->File()));
sprintf(buf2, LNG->EditCmd, buf);
gsprintf(PRINTF_DECLARE_BUFFER(buf2), LNG->EditCmd, buf);
ShellToDos(buf, buf2, LGREY_|_BLACK, YES);
long ftafter = GetFiletime(AddPath(CFG->goldpath, EDIT->File()));
if(status != MODE_SAVE) {
@ -740,10 +747,10 @@ void MakeMsg(int mode, GMsg* omsg, bool ignore_replyto) {
msg->TextToLines(CFG->dispmargin-1);
msg->orig = AA->Aka().addr;
msg->charsetlevel = LoadCharset(CFG->xlatlocalset, AA->Xlatexport());
if(msg->charsetlevel)
sprintf(msg->charset, "%s %d", AA->Xlatexport(), msg->charsetlevel);
if (msg->charsetlevel)
gsprintf(PRINTF_DECLARE_BUFFER(msg->charset), "%s %d", AA->Xlatexport(), msg->charsetlevel);
else
sprintf(msg->charset, "%s 2", CFG->xlatlocalset);
gsprintf(PRINTF_DECLARE_BUFFER(msg->charset), "%s 2", CFG->xlatlocalset);
strcpy(msg->odom, CFG->aka[AkaMatch(&msg->orig, &AA->Aka().addr)].domain);
if(AA->isecho() or have_origin(msg))
DoTearorig(mode, msg);
@ -929,10 +936,12 @@ void MakeMsg(int mode, GMsg* omsg, bool ignore_replyto) {
uint32_t number;
const char* r = get_subject_re_info(msg->re, number);
if(r) {
if(AA->Replyre() == REPLYRE_NUMERIC and not AA->isinternet()) {
if (r)
{
if (AA->Replyre() == REPLYRE_NUMERIC and not AA->isinternet())
{
ISub subj;
sprintf(subj, "Re^%u:%s", (((number+1) > number) ? (number+1) : number), r);
gsprintf(PRINTF_DECLARE_BUFFER(subj), "Re^%u:%s", (((number+1) > number) ? (number+1) : number), r);
strcpy(msg->re, subj);
}
}

View File

@ -37,7 +37,7 @@ static void ReadGldFile() {
Path gldfile;
QWK->ResetConfNo();
sprintf(gldfile, "%s%s.GLD", CFG->goldpath, QWK->BbsID());
gsprintf(PRINTF_DECLARE_BUFFER(gldfile), "%s%s.GLD", CFG->goldpath, QWK->BbsID());
gfile fp(gldfile, "rt");
if (fp.isopen())
@ -97,9 +97,10 @@ int ImportQWK() {
}
else if(line == 5) {
char* ptr = strchr(buf, ',');
if(ptr) {
if (ptr)
{
strxcpy(bbsid, strskip_wht(ptr+1), 9);
sprintf(gldfile, "%s%s.GLD", CFG->goldpath, bbsid);
gsprintf(PRINTF_DECLARE_BUFFER(gldfile), "%s%s.GLD", CFG->goldpath, bbsid);
fpb.Fopen(gldfile, "wt");
}
}
@ -243,9 +244,11 @@ int ImportQWK() {
INam _fromname;
IAdr _fromaddr;
ParseInternetAddr(msg->ifrom, _fromname, _fromaddr);
if(AA->Internetgate().addr.valid()) {
if (AA->Internetgate().addr.valid())
{
char abuf[40];
sprintf(kbuf, "\x1""REPLYTO %s %s\r""\x1""REPLYADDR %s\r",
gsprintf(PRINTF_DECLARE_BUFFER(kbuf),
"\x1""REPLYTO %s %s\r""\x1""REPLYADDR %s\r",
AA->Internetgate().addr.make_string(abuf),
*AA->Internetgate().name ? AA->Internetgate().name : "UUCP",
_fromaddr
@ -337,9 +340,10 @@ int ImportQWK() {
}
}
if(imported and *QWK->ReplyLinker()) {
if (imported and *QWK->ReplyLinker())
{
char buf[256];
sprintf(buf, LNG->Replylinker, QWK->ReplyLinker());
gsprintf(PRINTF_DECLARE_BUFFER(buf), LNG->Replylinker, QWK->ReplyLinker());
ShellToDos(QWK->ReplyLinker(), buf, LGREY_|_BLACK, YES);
}
}
@ -357,8 +361,8 @@ int ExportQwkMsg(GMsg* msg, gfile& fp, int confno, int& pktmsgno) {
// Prepare for Return Receipt Request
char msg__re[26];
if(QWK->ReceiptAllowed() and msg->attr.rrq())
sprintf(msg__re, "RRR%-22.22s", msg->re);
if (QWK->ReceiptAllowed() and msg->attr.rrq())
gsprintf(PRINTF_DECLARE_BUFFER(msg__re), "RRR%-22.22s", msg->re);
else
strxcpy(msg__re, msg->re, 26);
@ -370,13 +374,13 @@ int ExportQwkMsg(GMsg* msg, gfile& fp, int confno, int& pktmsgno) {
int relen = strlen(msg__re); relen = MinV(25,relen);
memset(&hdr, ' ', sizeof(QWKHdr));
hdr.status = msg->attr.pvt() ? '*' : ' ';
sprintf(buf, "%u", confno);
gsprintf(PRINTF_DECLARE_BUFFER(buf), "%u", confno);
memcpy(hdr.msgno, buf, strlen(buf));
struct tm _tm; ggmtime(&_tm, &msg->written);
int _year = _tm.tm_year % 100;
sprintf(buf, "%02d-%02d-%02d", _tm.tm_mon+1, _tm.tm_mday, _year);
gsprintf(PRINTF_DECLARE_BUFFER(buf), "%02d-%02d-%02d", _tm.tm_mon+1, _tm.tm_mday, _year);
memcpy(hdr.date, buf, 8);
sprintf(buf, "%02d:%02d", _tm.tm_hour, _tm.tm_min);
gsprintf(PRINTF_DECLARE_BUFFER(buf), "%02d:%02d", _tm.tm_hour, _tm.tm_min);
memcpy(hdr.time, buf, 5);
strxcpy(buf, msg->to, tolen+1);
if(not QWK->MixCaseAllowed())
@ -460,7 +464,7 @@ int ExportQwkMsg(GMsg* msg, gfile& fp, int confno, int& pktmsgno) {
// Calculate blocks
uint endlen = msglen % 128;
uint blocks = 1+(msglen/128)+(endlen?1:0);
sprintf(buf, "%u", blocks);
gsprintf(PRINTF_DECLARE_BUFFER(buf), "%u", blocks);
memcpy(hdr.blocks, buf, strlen(buf));
// Write padding spaces at the end if necessary
@ -560,7 +564,7 @@ int ExportQWK() {
int pktmsgno = 0;
if (QWK->FirstConf())
{
sprintf(replyfile, "%s%s.MSG", QWK->ExportPath(), QWK->BbsID());
gsprintf(PRINTF_DECLARE_BUFFER(replyfile), "%s%s.MSG", QWK->ExportPath(), QWK->BbsID());
fp.Fopen(replyfile, "wb");
if (fp.isopen())
{

View File

@ -119,12 +119,13 @@ Line* _HudsArea<msgn_t, rec_t, attr_t, board_t, last_t, __HUDSON>::make_dump_msg
int _count = 0;
char* _ptr = (char*)&_hdr;
for(;_count < sizeof(HudsHdr); _ptr+=16,_count+=16) {
sprintf(buf, "%04X ", _count);
for (;_count < sizeof(HudsHdr); _ptr+=16,_count+=16)
{
gsprintf(PRINTF_DECLARE_BUFFER(buf), "%04X ", _count);
HexDump16(buf+7, _ptr, 16, HEX_DUMP2);
line = AddLine(line, buf);
}
sprintf(buf, "%04X ", _count);
gsprintf(PRINTF_DECLARE_BUFFER(buf), "%04X ", _count);
HexDump16(buf+7, _ptr, sizeof(HudsHdr)%16, HEX_DUMP2);
line = AddLine(line, buf);