//打印所在区域 void PrintRegion(){ if( reg != g_ai->sRegion || sub != g_ai->sSubReg ){ printf( "reg:%s,sub:%s\n",ansi(g_ai->sRegion).c_str(),ansi(g_ai->sSubReg).c_str() ); reg = g_ai->sRegion; sub = g_ai->sSubReg; } }
/*++ Routine Name: DbgDOMDoc Routine Description: This routine outputs an XML DOM document to the debug output stream Arguments: pszMessage - Debug message pDomDoc - DOM document to be output Return Value: None. --*/ VOID DbgDOMDoc( __in PCSTR pszMessage, __in IXMLDOMDocument2* pDomDoc ) { try { CComBSTR xml; if (pDomDoc != NULL && SUCCEEDED(pDomDoc->get_xml(&xml))) { CStringXDA ansi(xml); if (pszMessage != NULL) { DbgPrint("%s%s\n", pszMessage, ansi.GetBuffer()); } else { DbgPrint("%s\n", ansi.GetBuffer()); } } } catch (CXDException&) { } }
otError Joiner::Start(const char * aPSKd, const char * aProvisioningUrl, const char * aVendorName, const char * aVendorModel, const char * aVendorSwVersion, const char * aVendorData, otJoinerCallback aCallback, void * aContext) { ThreadNetif & netif = GetNetif(); otError error; Mac::ExtAddress joinerId; Crc16 ccitt(Crc16::kCcitt); Crc16 ansi(Crc16::kAnsi); VerifyOrExit(mState == OT_JOINER_STATE_IDLE, error = OT_ERROR_BUSY); GetNotifier().Signal(OT_CHANGED_JOINER_STATE); // use extended address based on factory-assigned IEEE EUI-64 GetJoinerId(joinerId); netif.GetMac().SetExtAddress(joinerId); netif.GetMle().UpdateLinkLocalAddress(); for (size_t i = 0; i < sizeof(joinerId); i++) { ccitt.Update(joinerId.m8[i]); ansi.Update(joinerId.m8[i]); } mCcitt = ccitt.Get(); mAnsi = ansi.Get(); error = netif.GetCoapSecure().Start(OPENTHREAD_CONFIG_JOINER_UDP_PORT); SuccessOrExit(error); error = netif.GetCoapSecure().SetPsk(reinterpret_cast<const uint8_t *>(aPSKd), static_cast<uint8_t>(strlen(aPSKd))); SuccessOrExit(error); error = netif.GetCoapSecure().GetDtls().mProvisioningUrl.SetProvisioningUrl(aProvisioningUrl); SuccessOrExit(error); memset(mJoinerRouters, 0, sizeof(mJoinerRouters)); SuccessOrExit(error = netif.GetMle().Discover(0, netif.GetMac().GetPanId(), true, false, HandleDiscoverResult, this)); mVendorName = aVendorName; mVendorModel = aVendorModel; mVendorSwVersion = aVendorSwVersion; mVendorData = aVendorData; mCallback = aCallback; mContext = aContext; mState = OT_JOINER_STATE_DISCOVER; exit: return error; }
void sbbs_t::attr(int atr) { char str[16]; if(!term_supports(ANSI)) return; rputs(ansi(atr,curatr,str)); curatr=atr; }
void FunctionResolver::loadPointerType(ULONG64 modBase, ULONG typeIndex, ULONG type, ResolvedType& resolvedType) { // This function does exactly the same as LoadType does except // that it adds a * to the type name enum SymTagEnum tag = (enum SymTagEnum)0; SymGetTypeInfo(m_hProcess, modBase, type, TI_GET_SYMTAG, &tag); switch (tag) { case SymTagBaseType: { BasicType bt = (BasicType)0; SymGetTypeInfo(m_hProcess, modBase, type, TI_GET_BASETYPE, &bt); ULONG64 length = 0; SymGetTypeInfo(m_hProcess, modBase, type, TI_GET_LENGTH, &length); loadBasicType(bt, length, resolvedType); resolvedType.Name += '*'; return; } case SymTagPointerType: { ULONG subType; SymGetTypeInfo(m_hProcess, modBase, type, TI_GET_TYPE, &subType); // We recursively call ourselfs until we dont have a PointerType anymore // for example in char*** we need to call it 3 times loadPointerType(modBase, typeIndex, subType, resolvedType); resolvedType.Name += '*'; return; } case SymTagUDT: { // TODO: Resolve user defined type. return; } default: { LPWSTR symName = NULL; BOOL ret = SymGetTypeInfo(m_hProcess, modBase, typeIndex, TI_GET_SYMNAME, &symName); if (ret == TRUE) { std::vector<char> ansi(wcslen(symName) + 1); WideCharToMultiByte(CP_ACP, 0, symName, ansi.size(), &ansi[0], ansi.size(), NULL, NULL); resolvedType.Name = &ansi[0]; resolvedType.Name += '*'; LocalFree(symName); } break; } } }
//打印单元信息 void PrintUnit( Unit* p ){ printf("[%s,%s,%s] %.0f (%.0f,%.0f,%.0f)\n", ansi(p->sName).c_str(),Race(p->iRace),Class(p->iClass), sqrt(p->distance),p->pos[0],p->pos[1],p->pos[2] ); printf(" lv%d hp%d/%d mp%d/%d ", p->iLevel,p->iHealth,p->iMaxHealth,p->iMana,p->iMaxMana ); if( p->sTarget.empty() ) printf("TARGET[None] "); else printf("TARGET[%s] ",ansi(p->sTarget).c_str() ); printf("CA[%s]\n",p->bCanAttack?"Yes":"No"); printf(" CASTING[%s] %f - %f\n",ansi(p->sSpell).c_str(),p->SpellBegin,p->SpellEnd ); printf(" BUFF:"); for( int i = 0;i < p->iBuff;i++ ){ printf("%s,%d,%f->%f|",ansi(p->Buff[i].name).c_str(),p->Buff[i].count,p->Buff[i].timeLeft,p->Buff[i].duration ); } printf("\n DEBUFF:"); for( i = 0;i < p->iDebuff;i++ ){ printf("%s,%d,%f->%f|",ansi(p->Debuff[i].name).c_str(),p->Debuff[i].count,p->Debuff[i].timeLeft,p->Debuff[i].duration ); } printf("\n"); }
void SteeringDataTlv::ComputeBloomFilter(const otExtAddress &aJoinerId) { Crc16 ccitt(Crc16::kCcitt); Crc16 ansi(Crc16::kAnsi); for (size_t j = 0; j < sizeof(otExtAddress); j++) { uint8_t byte = aJoinerId.m8[j]; ccitt.Update(byte); ansi.Update(byte); } SetBit(ccitt.Get() % GetNumBits()); SetBit(ansi.Get() % GetNumBits()); }
Rcpp::List reTrms::condVar(double scale) { if (scale < 0 || !R_finite(scale)) throw runtime_error("scale must be non-negative and finite"); int nf = d_flist.size(); IntegerVector nc = ncols(), nl = nlevs(), nct = nctot(), off = offsets(); List ans(nf); CharacterVector nms = d_flist.names(); ans.names() = clone(nms); for (int i = 0; i < nf; i++) { int ncti = nct[i], nli = nl[i]; IntegerVector trms = terms(i); int *cset = new int[ncti], nct2 = ncti * ncti; NumericVector ansi(Dimension(ncti, ncti, nli)); ans[i] = ansi; double *ai = ansi.begin(); for (int j = 0; j < nli; j++) { int kk = 0; for (int jj = 0; jj < trms.size(); jj++) { int tjj = trms[jj]; for (int k = 0; k < nc[tjj]; k++) cset[kk++] = off[tjj] + j * nc[tjj] + k; } CHM_SP cols = M_cholmod_submatrix(&d_Lambda, (int*)NULL, -1, cset, ncti, 1/*values*/, 1/*sorted*/, &c); CHM_SP sol = d_L.spsolve(CHOLMOD_A, cols); CHM_SP tcols = M_cholmod_transpose(cols, 1/*values*/, &c); M_cholmod_free_sparse(&cols, &c); CHM_SP var = M_cholmod_ssmult(tcols, sol, 0/*stype*/, 1/*values*/, 1/*sorted*/, &c); M_cholmod_free_sparse(&sol, &c); M_cholmod_free_sparse(&tcols, &c); CHM_DN dvar = M_cholmod_sparse_to_dense(var, &c); M_cholmod_free_sparse(&var, &c); Memcpy(ai + j * nct2, (double*)dvar->x, nct2); M_cholmod_free_dense(&dvar, &c); } delete[] cset; transform(ansi.begin(), ansi.end(), ansi.begin(), bind2nd(multiplies<double>(), scale * scale)); } return ans; }
/* -------------------------------------------------------------------- */ void outCon(char c) { unsigned char row, col; static char escape = FALSE; if (!console) return; if (c == 7 /* BELL */ && cfg.noBells) return; if (c == 27 || escape) /* ESC || ANSI sequence */ { escape = ansi(c); return; } if (c == 26) /* CT-Z */ return; if (!anyEcho) return; /* if we dont have carrier then count what goes to console */ if (!gotCarrier()) transmitted++; if (c == '\n') doccr(); else if (c == '\r') { putch(c); } else { readpos(&row, &col); if (c == '\b' || c == 7) { if (c == '\b' && col == 0 && prevChar != 10) position(row-1,80); putch(c); } else { (*charattr)(c, ansiattr); if (col == 79) { position(row,col); doccr(); } } } }
int CppSQLite3DB::execDML(const wchar_t* szSQL) { /*int nLen = sizeof(char)*wcslen(szSQL)*2+3; char *chSQL = (char*)malloc(nLen); int result; if (wcstombs(chSQL, szSQL, nLen)==-1) { free(chSQL); throw CppSQLite3Exception(0, "Failed to convert query to multi-byte charset."); } else { try { result = execDML(chSQL); free(chSQL); return result; } catch (CppSQLite3Exception &e) { free(chSQL); throw e; } }*/ CStringA ansi(szSQL); return execDML(ansi.GetBuffer()); }
void cdecl TERMWINDOWMEMBER cOutput(const char *fmt) { // for screenblanker if (!oPhys) { kb_hit(); } const Bool oldcolor = TermCap->IsColor(); TermCap->SetColor(TRUE); outSpeech(FALSE, fmt); register const char *buf = fmt; while (*buf) { if (*buf == CTRL_A) { uchar wordBuf[MAXWORDLEN + 8]; int i; i = getWord(wordBuf, (uchar *) buf, 0, MAXWORDLEN); const Bool oldmodem = OC.Modem; OC.Modem = FALSE; termCap(buf + 1); OC.Modem = oldmodem; buf += i; } else { outCon(*buf++); } } TermCap->SetColor(oldcolor); ansi(14); OC.MCI_goto = FALSE; }
CString CPBXClientApp::DecodePassword(CString in) { //char *chIn; std::string encoded; std::string decoded; #ifdef _UNICODE /*chIn = ConvertFromUnicodeToMB(in); if (chIn==NULL) return _T("");*/ CStringA ansi(in); encoded = ansi.GetBuffer(); //free(chIn); #else encoded = in; #endif decoded = base64_decode(encoded); int length = decoded.length(); for (int i=0; i<decoded.length(); i++) decoded[i]-=10; return CString(decoded.c_str()); }
CString CPBXClientApp::EncodePassword(CString in) { std::string encoded; unsigned char *chInBuf; #ifdef _UNICODE /*chIn = ConvertFromUnicodeToMB(in); if (chIn==NULL) return _T("");*/ CStringA ansi(in); chInBuf = (unsigned char *)ansi.GetBuffer(); //free(chIn); #else chInBuf = (unsigned char *)in.GetBuffer(); #endif int length = strlen((char*)chInBuf); for (int i=0; i<length; i++) { chInBuf[i]+=10; } encoded = base64_encode(chInBuf, length); return CString(encoded.c_str()); }
const std::string StringUtil::WideToAnsi(const std::wstring& str) { ATL::CW2A cw2a(str.data()); std::string ansi(cw2a); return ansi; }
void FunctionResolver::loadType(ULONG64 modBase, ULONG typeIndex, ResolvedType& resolvedType) { // Sadly loading the actual name of the type must be done in several different // ways for different types. To see which one we need to follow we first take // the tag of the symbol. std::string typeName = "Unknown"; enum SymTagEnum tag = (enum SymTagEnum)0; SymGetTypeInfo(m_hProcess, modBase, typeIndex, TI_GET_SYMTAG, &tag); if (tag == SymTagFunctionType) { ULONG subType1; SymGetTypeInfo(this->m_hProcess, modBase, typeIndex, TI_GET_TYPE, &subType1); SymGetTypeInfo(m_hProcess, modBase, subType1, TI_GET_SYMTAG, &tag); } switch (tag) { // Base types are types like int, float, void, char, ... // They are not stored directly in the PDB because there aren't any big information // that need to be stored for them. We can use TI_GET_BASETYPE to fill a BasicType // which will describe the basic type and were done! case SymTagBaseType: { BasicType bt = (BasicType)0; SymGetTypeInfo(m_hProcess, modBase, typeIndex, TI_GET_BASETYPE, &bt); ULONG64 length = 0; SymGetTypeInfo(m_hProcess, modBase, typeIndex, TI_GET_LENGTH, &length); resolvedType.SymbolTag = SymTagBaseType; loadBasicType(bt, length, resolvedType); return; } // For pointer types we just need to take the type it points to and then load that type case SymTagPointerType: { ULONG subType; SymGetTypeInfo(m_hProcess, modBase, typeIndex, TI_GET_TYPE, &subType); resolvedType.SymbolTag = SymTagPointerType; loadPointerType(modBase, typeIndex, subType, resolvedType); // We need to override the possible type set by LoadPointerType because it should // only take an address when we evaluate it. m_value.vt = VT_BLOB; return; } // Now most of the rest can be simply parsed by getting the SYMNAME because they are complex // types and therefore have an entry in the PDB. default: { // we don't want to evaluate complex types m_value.vt = VT_UNKNOWN; LPWSTR symName = NULL; BOOL ret = SymGetTypeInfo(m_hProcess, modBase, typeIndex, TI_GET_SYMNAME, &symName); if (ret == TRUE) { std::vector<char> ansi(wcslen(symName) + 1); WideCharToMultiByte(CP_ACP, 0, symName, ansi.size(), &ansi[0], ansi.size(), NULL, NULL); resolvedType.Name = &ansi[0]; resolvedType.SymbolTag = tag; LocalFree(symName); } break; } } }
void TERMWINDOWMEMBER getFmtString(const char *prompt, char *buf, Bool premature, Bool inclPrompt) { char c; int errors = 0; int entered, parsed = 0; const EchoType oldEcho = OC.Echo; const dowhattype oldDowhat = DoWhat; ansi(14); // shut off music if (!HaveConnectionToUser()) { *buf = 0; OC.MCI_goto = FALSE; return; } char *parsestr = new char[strlen(prompt) + 1]; // parsed characters char *notparsestr = new char[strlen(prompt) + 1]; // literal characters if (notparsestr && parsestr) { OC.SetOutFlag(IMPERVIOUS); SetDoWhat(PROMPT); for (int infmt = 0, i = 0; prompt[i]; i++) { if (prompt[i] == FT) { infmt = !infmt; } else if (infmt) { notparsestr[parsed] = prompt[i]; parsestr[parsed] = FT; parsed++; } else if (strchr(getmsg(672), prompt[i])) { notparsestr[parsed] = FT; parsestr[parsed] = prompt[i]; parsed++; } } notparsestr[parsed] = parsestr[parsed] = 0; // tie off for (parsed = 0; parsestr[parsed] && FT == parsestr[parsed]; parsed++) { oChar(notparsestr[parsed]); if (inclPrompt) { buf[parsed] = notparsestr[parsed]; } } OC.Echo = NEITHER; OC.setio(); for (entered = 0, c = (char) iChar(); HaveConnectionToUser(); c = (char) iChar()) { OC.SetOutFlag(OUTOK); OC.Echo = oldEcho; OC.setio(); if (c == 0) { if (HaveConnectionToUser()) { continue; } else { entered = parsed = 0; break; } } else if (c == '\b' && entered) { for ( ; parsestr[parsed - 1] == FT; parsed--) { doBS(); } doBS(); parsed--; entered--; } else if (c == '\n' && (premature || !parsestr[parsed])) { break; } else if (parsestr[parsed] && Isfunction(c, parsestr[parsed])) { oChar(c); buf[inclPrompt ? parsed : entered] = c; entered++; parsed++; for (; parsestr[parsed] && (FT == parsestr[parsed]); parsed++) { oChar(notparsestr[parsed]); if (inclPrompt) { buf[parsed] = notparsestr[parsed]; } } } else { oChar(BELL); if ('\b' != c && parsestr[parsed]) { errors++; if (errors > cfg.maxerror && !onConsole) { CITWINDOW *w = ScreenSaver.IsOn() ? NULL : CitWindowsMsg(NULL, getmsg(685), getmsg(79)); Hangup(); if (w) { destroyCitWindow(w, FALSE); } } } } OC.Echo = NEITHER; OC.setio(); } OC.Echo = oldEcho; OC.setio(); buf[inclPrompt ? parsed : entered] = 0; OC.EchoChar = 0; SetDoWhat(oldDowhat); doCR(); OC.MCI_goto = FALSE; } else { OutOfMemory(81); *buf = 0; } delete [] notparsestr; delete [] parsestr; }
Bool TERMWINDOWMEMBER getString(const char *prompt, char *buf, int lim, Bool QuestIsSpecial, Bool doEcho, const char *dfault) { char c; int errors = 0; int i; const EchoType oldEcho = OC.Echo; const dowhattype oldDowhat = DoWhat; int termPos = 0; label tempTerm; Bool useDefault = (dfault && *dfault); ansi(14); if (!HaveConnectionToUser()) { buf[0] = 0; OC.MCI_goto = FALSE; return (FALSE); } Bool ToReturn = TRUE; OC.SetOutFlag(IMPERVIOUS); if (*prompt) { if (useDefault) { sprintf(gprompt, getmsg(493), prompt, hasansi(prompt) ? getmsg(214) : ns, hasansi(dfault) ? getmsg(213) : ns, dfault, hasansi(dfault) ? getmsg(214) : ns); } else { sprintf(gprompt, getmsg(489), prompt); } CRmPrintf(pcts, gprompt); SetDoWhat(PROMPT); } tempTerm[0] = 0; OC.Echo = NEITHER; OC.setio(); if (!doEcho) { if (!cfg.nopwecho) { OC.EchoChar = 1; } else if (cfg.nopwecho == 1) { OC.EchoChar = 0; } else { OC.EchoChar = cfg.nopwecho; } } i = 0; for (c = (char) iChar(); c != '\n' && HaveConnectionToUser(); c = (char) iChar()) { OC.SetOutFlag(OUTOK); if (c == 0 || c == CTRL_D) { if (!HaveConnectionToUser()) { break; } } else if (c == ESC) { i = 0; useDefault = FALSE; ToReturn = FALSE; break; } else if (termPos) { if (c == '\b') { if (termPos > 2) { termPos -= 1; } else { termPos = 0; } } else { tempTerm[termPos++] = c; tempTerm[termPos] = 0; if (c == 'X') { if (i + termPos >= lim) { oChar(BELL); } else { buf[i] = 0; strcat(buf, tempTerm); i += termPos; termCap(tempTerm + 1); OC.MCI_goto = FALSE; } termPos = 0; } else if (termPos >= LABELSIZE) { oChar(BELL); termPos = 0; } } } else if (c == '\b') { if (i != 0) { OC.Echo = oldEcho; OC.setio(); doBS(); OC.Echo = NEITHER; OC.setio(); i--; if ((OC.EchoChar >= '0') && (OC.EchoChar <= '9')) { OC.EchoChar--; if (OC.EchoChar < '0') OC.EchoChar = '9'; } } else { OC.Echo = oldEcho; OC.setio(); oChar(BELL); OC.Echo = NEITHER; OC.setio(); } } else { if (c == CTRL_A && (i < lim - 1) && cfg.colors) { // Control+A(nsi) const int d = iCharNE(); if (d == '?') { OC.Echo = oldEcho; OC.setio(); dispHlp(H_ANSI); OC.SetOutFlag(IMPERVIOUS); CRmPrintf(pcts, gprompt); buf[i] = 0; mPrintf(pcts, buf); SetDoWhat(PROMPT); OC.Echo = NEITHER; OC.setio(); } else if (d == 'X') { tempTerm[0] = CTRL_A; tempTerm[1] = 'X'; tempTerm[2] = 0; termPos = 2; } else if ((d >= '0' && d <= '8') || (d >= 'a' && d <= 'h') || (d == TERM_DATE[0]) || (d == TERM_TIME[0]) || (d == TERM_USERNAME[0]) || (d == TERM_FIRSTNAME[0])|| (d == TERM_POOP[0]) || (d == TERM_RND_BACK[0]) || (d == TERM_RND_FORE[0]) || (d >= 'A' && d <= 'H')) { OC.Echo = oldEcho; OC.setio(); tempTerm[0] = (char) d; tempTerm[1] = 0; termCap(tempTerm); OC.Echo = NEITHER; OC.setio(); buf[i++] = CTRL_A; buf[i++] = (char) d; } else { OC.Echo = oldEcho; OC.setio(); oChar(BELL); OC.Echo = NEITHER; OC.setio(); } } else if (i < lim && c != '\t' && c != CTRL_A) { if ((OC.EchoChar >= '0') && (OC.EchoChar <= '9')) { OC.EchoChar++; if (OC.EchoChar > '9') OC.EchoChar = '0'; } buf[i] = c; if (doEcho) { OC.Echo = oldEcho; OC.setio(); oChar(c); OC.Echo = NEITHER; OC.setio(); } else { if (cfg.nopwecho == 0) { OC.Echo = CALLER; OC.setio(); oChar(c); } else { OC.Echo = oldEcho; OC.setio(); oChar((char) OC.EchoChar); } OC.Echo = NEITHER; OC.setio(); } i++; } else { OC.Echo = oldEcho; OC.setio(); oChar(BELL); OC.Echo = NEITHER; OC.setio(); errors++; if (errors > cfg.maxerror && !onConsole) { CITWINDOW *w = ScreenSaver.IsOn() ? NULL : CitWindowsMsg(NULL, getmsg(685), getmsg(79)); Hangup(); if (w) { destroyCitWindow(w, FALSE); } } } } // kludge to return immediately on single '?' if (QuestIsSpecial && *buf == '?') { break; } } if (!HaveConnectionToUser()) { i = 0; useDefault = FALSE; ToReturn = FALSE; } OC.Echo = oldEcho; OC.setio(); while (i && buf[i - 1] == CTRL_A) { buf[--i] = 0; } buf[i] = 0; OC.EchoChar = 0; if (useDefault && !*buf) { strcpy(buf, dfault); } SetDoWhat(oldDowhat); doCR(); OC.MCI_goto = FALSE; return (ToReturn); }
//打印技能 void PrintSkill( Skill* p ){ printf("%s %s %s\n",ansi(p->name).c_str(),ansi(p->rank).c_str(),ansi(p->icon).c_str() ); printf(" ID[%d] Cost[%d,%d] Range[%d,%d]\n",p->id,p->powerCost,p->castingTime, p->minRang,p->maxRang ); }
void TERMWINDOWMEMBER GiveRoomPrompt(Bool JustDisplayedEvent) { static int roomCounter; label rn, gn, np, ex, hn; char rd[81]; char tm[128], dt[128]; int i; CommPort->FlushInput(); OC.User.Reset(); OC.Echo = BOTH; OC.setio(); OC.ansiattr = cfg.attr; doEvent(EVT_ROOMPROMPT); if (CurrentUser->IsYouAreHere()) { youAreHere(); } #ifdef WINCIT // if (!PendingSystemEvents) // { OC.SetOutFlag(PendingSystemEvents ? NOSTOP : IMPERVIOUS); // } // if (IdlePrompt) // { // return; // } if (!(CurrentUser->IsErasePrompt() && JustDisplayedEvent)) { doCR(); } if (JustDisplayedEvent) { numLines = 0; } #endif OC.Formatting = FALSE; roomCounter++; RoomTab[thisRoom].GetName(rn, sizeof(rn)); *gn = 0; if (RoomTab[thisRoom].IsGroupOnly()) { if (RoomTab[thisRoom].IsBooleanGroup()) { CopyStringToBuffer(gn, getmsg(471)); } else { GroupData[RoomTab[thisRoom].GetGroupNumber()].GetName(gn, sizeof(gn)); } } *np = 0; if (RoomTab[thisRoom].IsShared()) { label Buffer; CopyStringToBuffer(np, loggedIn ? CurrentUser->GetNetPrefix(Buffer, sizeof(Buffer)) : cfg.netPrefix); } *ex = 0; i = 0; if (RoomTab[thisRoom].IsMsDOSdir()) { if (CurrentUser->IsIBMRoom() && TermCap->IsIBMExtended()) { ex[i++] = roomCounter == 6969 ? '\xcc' : '\xb9'; } else { ex[i++] = roomCounter == 6969 ? '[' : ']'; } } if (RoomTab[thisRoom].IsGroupOnly()) { if (CurrentUser->IsIBMRoom() && TermCap->IsIBMExtended()) { ex[i++] = roomCounter == 6969 ? '\xba' : '\xb3'; } else { ex[i++] = roomCounter == 6969 ? ';' : ':'; } } if (RoomTab[thisRoom].IsHidden()) { ex[i++] = roomCounter == 6969 ? '(' : ')'; } if (RoomTab[thisRoom].IsBIO()) { ex[i++] = roomCounter == 6969 ? '{' : '}'; } else if (!RoomTab[thisRoom].IsGroupOnly() && !RoomTab[thisRoom].IsMsDOSdir() && !RoomTab[thisRoom].IsHidden()) { if (!(iswindow(thisRoom) && CurrentUser->IsIBMRoom() && TermCap->IsIBMExtended())) { ex[i++] = roomCounter == 6969 ? '<' : '>'; } } if (iswindow(thisRoom)) { if (CurrentUser->IsIBMRoom() && TermCap->IsIBMExtended()) { ex[i++] = roomCounter == 6969 ? '\xae' : '\xaf'; } else { ex[i++] = roomCounter == 6969 ? '<' : '>'; } } ex[i] = 0; HallData[thisHall].GetName(hn, sizeof(hn)); CurrentRoom->GetInfoLine(rd, sizeof(rd)); char Buffer[64]; strftime(tm, 127, (loggedIn) ? special_deansi(CurrentUser->GetDateStamp(Buffer, sizeof(Buffer)), TERM_TIME) : special_deansi(cfg.datestamp, TERM_TIME), 0l); strftime(dt, 127, (loggedIn) ? special_deansi(CurrentUser->GetVerboseDateStamp(Buffer, sizeof(Buffer)), TERM_DATE) : special_deansi(cfg.vdatestamp, TERM_DATE), 0l); Andy(loggedIn ? CurrentUser->GetPromptFormat(Buffer, sizeof(Buffer)) : cfg.prompt, getmsg(638), rn, gn, np, ex, hn, rd, tm, dt); OC.Formatting = TRUE; ansi(14); OC.MCI_goto = FALSE; termCap(TERM_NORMAL); mPrintf(spc); CursorIsAtPrompt = TRUE; OC.SetOutFlag(OUTOK); if (roomCounter == 6969) { roomCounter = 0; } }
int main( int argc, const char** argv ) { std::signal(SIGINT, aqsisSignalHandler); std::signal(SIGABRT, aqsisSignalHandler); RtInt returnCode = 0; StartMemoryDebugging(); { ArgParse ap; ap.usageHeader( ArgParse::apstring( "Aqsis command line renderer\nUsage: " ) + argv[ 0 ] + " [options] [RIB file...]" ); ap.argFlag( "help", "\aPrint this help and exit", &g_cl_help ); ap.alias( "help" , "h" ); ap.argFlag( "version", "\aPrint version information and exit", &g_cl_version ); ap.argFlag( "pause", "\aWait for a keypress on completion", &g_cl_pause ); ap.argFlag( "progress", "\aPrint progress information", &g_cl_progress ); ap.argFlag( "Progress", "\aPrint PRMan-compatible progress information (ignores -progressformat)", &g_cl_Progress ); ap.argString( "progressformat", "=string\aprintf-style format string for -progress", &g_cl_strprogress ); ap.argInt( "endofframe", "=integer\aEquivalent to \"endofframe\" RIB option", &g_cl_endofframe ); ap.argInt( "verbose", "=integer\aSet log output level\n" "\a0 = errors\n" "\a1 = warnings (default)\n" "\a2 = information\n" "\a3 = debug", &g_cl_verbose ); ap.alias( "verbose", "v" ); ap.argFlag( "echoapi", "\aEcho all RI API calls to the log output (experimental)", &g_cl_echoapi); ap.argInt( "priority", "=integer\aControl the priority class of aqsis.\n" "\a0 = idle\n" "\a1 = normal\n" "\a2 = high\n" "\a3 = RT", &g_cl_priority); ap.alias( "priority", "z"); ap.argString( "type", "=string\aSpecify a display device type to use", &g_cl_type ); ap.argString( "addtype", "=string\aSpecify a display device type to add", &g_cl_addtype ); ap.argString( "mode", "=string\aSpecify a display device mode to use", &g_cl_mode ); ap.argFlag( "fb", "\aSame as --type=\"framebuffer\" --mode=\"rgb\"", &g_cl_fb ); ap.alias( "fb", "d" ); ap.argFloats( "crop", " x1 x2 y1 y2\aSpecify a crop window, values are in screen space.", &g_cl_cropWindow, ArgParse::SEP_ARGV, 4); ap.argFlag( "nocolor", "\aDisable colored output", &g_cl_no_color ); ap.argFlag( "beep", "\aBeep on completion of all ribs", &g_cl_beep ); ap.alias( "nocolor", "nc" ); ap.argInts( "res", " x y\aSpecify the resolution of the render.", &g_cl_res, ArgParse::SEP_ARGV, 2); ap.argStrings( "option", "=string\aA valid RIB Option string, can be specified multiple times.", &g_cl_options); # ifdef AQSIS_SYSTEM_POSIX ap.argFlag( "syslog", "\aLog messages to syslog", &g_cl_syslog ); # endif // AQSIS_SYSTEM_POSIX # if ENABLE_MPDUMP ap.argFlag( "mpdump", "\aOutput MP list to a custom 'dump' file", &g_cl_mpdump ); # endif // ENABLE_MPDUMP ap.argString( "shaders", "=string\aOverride the default shader searchpath(s)", &g_cl_shader_path ); ap.argString( "archives", "=string\aOverride the default archive searchpath(s)", &g_cl_archive_path ); ap.argString( "textures", "=string\aOverride the default texture searchpath(s)", &g_cl_texture_path ); ap.argString( "displays", "=string\aOverride the default display searchpath(s)", &g_cl_display_path ); ap.argString( "procedurals", "=string\aOverride the default procedural searchpath(s)", &g_cl_procedural_path ); ap.allowUnrecognizedOptions(); if ( argc > 1 && !ap.parse( argc - 1, argv + 1 ) ) { Aqsis::log() << ap.errmsg() << std::endl << ap.usagemsg(); return( 1 ); } // Check that the number of arguments to crop are valid if specified. if ( g_cl_cropWindow.size() > 0 && g_cl_cropWindow.size() != 4 ) { Aqsis::log() << Aqsis::error << "Invalid number of arguments to -crop, expected 4, got " << g_cl_cropWindow.size() << std::endl; g_cl_help = true; } if ( g_cl_help ) { std::cout << ap.usagemsg(); return( 0 ); } if ( g_cl_version ) { std::cout << "aqsis version " << AQSIS_VERSION_STR_FULL # ifdef _DEBUG << " (debug build)" # endif << "\n" << "compiled " << __DATE__ << " " << __TIME__ << "\n"; return( 0 ); } # ifdef AQSIS_SYSTEM_WIN32 std::auto_ptr<std::streambuf> ansi( new Aqsis::ansi_buf(Aqsis::log()) ); # endif std::auto_ptr<std::streambuf> reset_level( new Aqsis::reset_level_buf(Aqsis::log()) ); std::auto_ptr<std::streambuf> show_timestamps( new Aqsis::timestamp_buf(Aqsis::log()) ); std::auto_ptr<std::streambuf> fold_duplicates( new Aqsis::fold_duplicates_buf(Aqsis::log()) ); std::auto_ptr<std::streambuf> color_level; if(!g_cl_no_color) { std::auto_ptr<std::streambuf> temp_color_level( new Aqsis::color_level_buf(Aqsis::log()) ); color_level = temp_color_level; } std::auto_ptr<std::streambuf> show_level( new Aqsis::show_level_buf(Aqsis::log()) ); Aqsis::log_level_t level = Aqsis::ERROR; if( g_cl_verbose > 0 ) level = Aqsis::WARNING; if( g_cl_verbose > 1 ) level = Aqsis::INFO; if( g_cl_verbose > 2 ) level = Aqsis::DEBUG; std::auto_ptr<std::streambuf> filter_level( new Aqsis::filter_by_level_buf(level, Aqsis::log()) ); # ifdef AQSIS_SYSTEM_POSIX if( g_cl_syslog ) std::auto_ptr<std::streambuf> use_syslog( new Aqsis::syslog_buf(Aqsis::log()) ); # endif // AQSIS_SYSTEM_POSIX if (g_cl_priority != 1) { // Set the priority on the main thread setPriority(g_cl_priority); } RiBegin(RI_NULL); setupOptions(); try { if ( ap.leftovers().size() == 0 ) { // If no files specified, take input from stdin. // // TODO: We'd like to turn off stdio synchronisation to allow fast // buffering... unfortunately this causes very odd problems with // the aqsis logging facility as of svn r2804 // //std::ios_base::sync_with_stdio(false); Aqsis::QGetRenderContextI()->parseRibStream(std::cin, "stdin"); } else { for(ArgParse::apstringvec::const_iterator fileName = ap.leftovers().begin(); fileName != ap.leftovers().end(); fileName++) { std::ifstream inFile(fileName->c_str()); if(inFile) { Aqsis::QGetRenderContextI()->parseRibStream(inFile, *fileName); returnCode = RiLastError; } else { Aqsis::log() << Aqsis::error << "Cannot open file \"" << *fileName << "\"\n"; returnCode = RIE_NOFILE; } } } } catch(const std::exception& e) { Aqsis::log() << Aqsis::error << e.what() << std::endl; returnCode = RIE_BUG; } catch(...) { Aqsis::log() << Aqsis::error << "unknown exception has been encountered\n"; returnCode = RIE_BUG; } RiEnd(); } StopMemoryDebugging(); if(g_cl_beep) std::cout << "\a" << std::ends; if(g_cl_pause) { std::cout << "Press any key..." << std::ends; std::cin.ignore(std::cin.rdbuf()->in_avail() + 1); } return returnCode; }
ulong sbbs_t::msgtoqwk(smbmsg_t* msg, FILE *qwk_fp, long mode, uint subnum , int conf, FILE* hdrs) { char str[512],from[512],to[512],ch=0,tear=0,tearwatch=0,*buf,*p; char asc; char msgid[256]; char tmp[512]; long l,size=0,offset; int i; ushort hfield_type; struct tm tm; smbmsg_t remsg; time_t tt; offset=(long)ftell(qwk_fp); if(hdrs!=NULL) { fprintf(hdrs,"[%lx]\n",offset); /* Message-IDs */ fprintf(hdrs,"Message-ID: %s\n",get_msgid(&cfg,subnum,msg,msgid,sizeof(msgid))); if(msg->reply_id!=NULL) fprintf(hdrs,"In-Reply-To: %s\n",msg->reply_id); /* Time/Date/Zone info */ fprintf(hdrs,"WhenWritten: %-20s %04hx\n" ,xpDateTime_to_isoDateTimeStr( time_to_xpDateTime(msg->hdr.when_written.time,smb_tzutc(msg->hdr.when_written.zone)) ,/* separators: */"","","", /* precision: */0 ,str,sizeof(str)) ,msg->hdr.when_written.zone ); fprintf(hdrs,"WhenImported: %-20s %04hx\n" ,xpDateTime_to_isoDateTimeStr( time_to_xpDateTime(msg->hdr.when_imported.time,smb_tzutc(msg->hdr.when_imported.zone)) ,/* separators: */"","","", /* precision: */0 ,str,sizeof(str)) ,msg->hdr.when_imported.zone ); fprintf(hdrs,"WhenExported: %-20s %04hx\n" ,xpDateTime_to_isoDateTimeStr( xpDateTime_now() ,/* separators: */"","","", /* precision: */0 ,str,sizeof(str)) ,sys_timezone(&cfg) ); fprintf(hdrs,"ExportedFrom: %s %s %"PRIu32"\n" ,cfg.sys_id ,subnum==INVALID_SUB ? "mail":cfg.sub[subnum]->code ,msg->hdr.number ); /* SENDER */ fprintf(hdrs,"%s: %s\n",smb_hfieldtype(SENDER),msg->from); if(msg->from_net.type) fprintf(hdrs,"%s: %s\n",smb_hfieldtype(SENDERNETADDR),smb_netaddrstr(&msg->from_net,tmp)); if((p=(char*)smb_get_hfield(msg,hfield_type=SENDERIPADDR,NULL))!=NULL) fprintf(hdrs,"%s: %s\n",smb_hfieldtype(hfield_type),p); if((p=(char*)smb_get_hfield(msg,hfield_type=SENDERHOSTNAME,NULL))!=NULL) fprintf(hdrs,"%s: %s\n",smb_hfieldtype(hfield_type),p); if((p=(char*)smb_get_hfield(msg,hfield_type=SENDERPROTOCOL,NULL))!=NULL) fprintf(hdrs,"%s: %s\n",smb_hfieldtype(hfield_type),p); if(msg->from_org!=NULL) fprintf(hdrs,"Organization: %s\n",msg->from_org); else if(msg->from_net.type==NET_NONE) fprintf(hdrs,"Organization: %s\n",cfg.sys_name); /* Reply-To */ if((p=(char*)smb_get_hfield(msg,RFC822REPLYTO,NULL))==NULL) { if(msg->replyto_net.type==NET_INTERNET) p=(char*)msg->replyto_net.addr; else if(msg->replyto!=NULL) p=msg->replyto; } if(p!=NULL) fprintf(hdrs,"Reply-To: %s\n",p); /* use original RFC822 header field */ /* SUBJECT */ fprintf(hdrs,"%s: %s\n",smb_hfieldtype(SUBJECT),msg->subj); /* RECIPIENT */ fprintf(hdrs,"%s: %s\n",smb_hfieldtype(RECIPIENT),msg->to); if(msg->to_net.type) fprintf(hdrs,"%s: %s\n",smb_hfieldtype(RECIPIENTNETADDR),smb_netaddrstr(&msg->to_net,tmp)); /* FidoNet */ if((p=(char*)smb_get_hfield(msg,hfield_type=FIDOAREA,NULL))!=NULL) fprintf(hdrs,"%s: %s\n", smb_hfieldtype(hfield_type), p); if((p=(char*)smb_get_hfield(msg,hfield_type=FIDOSEENBY,NULL))!=NULL) fprintf(hdrs,"%s: %s\n", smb_hfieldtype(hfield_type), p); if((p=(char*)smb_get_hfield(msg,hfield_type=FIDOPATH,NULL))!=NULL) fprintf(hdrs,"%s: %s\n", smb_hfieldtype(hfield_type), p); if((p=(char*)smb_get_hfield(msg,hfield_type=FIDOMSGID,NULL))!=NULL) fprintf(hdrs,"%s: %s\n", smb_hfieldtype(hfield_type), p); if((p=(char*)smb_get_hfield(msg,hfield_type=FIDOREPLYID,NULL))!=NULL) fprintf(hdrs,"%s: %s\n", smb_hfieldtype(hfield_type), p); if((p=(char*)smb_get_hfield(msg,hfield_type=FIDOPID,NULL))!=NULL) fprintf(hdrs,"%s: %s\n", smb_hfieldtype(hfield_type), p); if((p=(char*)smb_get_hfield(msg,hfield_type=FIDOFLAGS,NULL))!=NULL) fprintf(hdrs,"%s: %s\n", smb_hfieldtype(hfield_type), p); if((p=(char*)smb_get_hfield(msg,hfield_type=FIDOTID,NULL))!=NULL) fprintf(hdrs,"%s: %s\n", smb_hfieldtype(hfield_type), p); /* Synchronet */ if((p=(char*)smb_get_hfield(msg,hfield_type=SMB_EDITOR,NULL))!=NULL) fprintf(hdrs,"%s: %s\n", smb_hfieldtype(hfield_type), p); /* USENET */ if((p=(char*)smb_get_hfield(msg,hfield_type=USENETPATH,NULL))!=NULL) fprintf(hdrs,"%s: %s\n", smb_hfieldtype(hfield_type), p); if((p=(char*)smb_get_hfield(msg,hfield_type=USENETNEWSGROUPS,NULL))!=NULL) fprintf(hdrs,"%s: %s\n", smb_hfieldtype(hfield_type), p); /* RFC822 header fields: */ for(i=0;i<msg->total_hfields;i++) if(msg->hfield[i].type==RFC822HEADER) fprintf(hdrs,"%s\n",truncsp_lines((char*)msg->hfield_dat[i])); /* Blank line: */ fprintf(hdrs,"\n"); } fprintf(qwk_fp,"%*s",QWK_BLOCK_LEN,""); /* Init header to space */ /* QWKE compatible kludges */ SAFECOPY(from,msg->from); if(msg->from_net.addr && (uint)subnum==INVALID_SUB && !(mode&QM_TO_QNET)) { if(msg->from_net.type==NET_FIDO) sprintf(from,"%.128s@%.128s" ,msg->from,smb_faddrtoa((faddr_t *)msg->from_net.addr,tmp)); else if(msg->from_net.type==NET_INTERNET || strchr((char*)msg->from_net.addr,'@')!=NULL) sprintf(from,"%.128s",(char*)msg->from_net.addr); else sprintf(from,"%.128s@%.128s",msg->from,(char*)msg->from_net.addr); } if(msg->hdr.attr&MSG_ANONYMOUS && !SYSOP) SAFECOPY(from,text[Anonymous]); else if((subnum==INVALID_SUB || (useron.qwk&QWK_EXT)) && strlen(from) > QWK_HFIELD_LEN) { size+=fprintf(qwk_fp,"From: %.128s%c", from, QWK_NEWLINE); SAFECOPY(from,msg->from); } SAFECOPY(to,msg->to); if(msg->to_net.addr && (uint)subnum==INVALID_SUB) { if(msg->to_net.type==NET_FIDO) sprintf(to,"%.128s@%s",msg->to,smb_faddrtoa((faddr_t *)msg->to_net.addr,tmp)); else if(msg->to_net.type==NET_INTERNET) sprintf(to,"%.128s",(char*)msg->to_net.addr); else if(msg->to_net.type==NET_QWK) { if(mode&QM_TO_QNET) { p=strchr((char *)msg->to_net.addr,'/'); if(p) { /* Another hop */ p++; SAFECOPY(to,"NETMAIL"); size+=fprintf(qwk_fp,"%.128s@%.128s%c",msg->to,p,QWK_NEWLINE); } else sprintf(to,"%.128s",msg->to); } else sprintf(to,"%.128s@%.128s",msg->to,(char*)msg->to_net.addr); } else sprintf(to,"%.128s@%.128s",msg->to,(char*)msg->to_net.addr); } if((subnum==INVALID_SUB || (useron.qwk&QWK_EXT)) && strlen(to) > QWK_HFIELD_LEN) { size+=fprintf(qwk_fp,"To: %.128s%c", to, QWK_NEWLINE); if(msg->to_net.type==NET_QWK) SAFECOPY(to,"NETMAIL"); else SAFECOPY(to,msg->to); } if((useron.qwk&QWK_EXT) && strlen(msg->subj) > QWK_HFIELD_LEN) size+=fprintf(qwk_fp,"Subject: %.128s%c", msg->subj, QWK_NEWLINE); if(msg->from_net.type==NET_QWK && mode&QM_VIA && !msg->forwarded) size+=fprintf(qwk_fp,"@VIA: %s%c" ,(char*)msg->from_net.addr,QWK_NEWLINE); if(mode&QM_MSGID && (uint)subnum!=INVALID_SUB) { size+=fprintf(qwk_fp,"@MSGID: %s%c" ,get_msgid(&cfg,subnum,msg,msgid,sizeof(msgid)),QWK_NEWLINE); if(msg->reply_id) { SAFECOPY(tmp,msg->reply_id); truncstr(tmp," "); size+=fprintf(qwk_fp,"@REPLY: %s%c" ,tmp,QWK_NEWLINE); } else if(msg->hdr.thread_back) { memset(&remsg,0,sizeof(remsg)); remsg.hdr.number=msg->hdr.thread_back; if(smb_getmsgidx(&smb, &remsg)) size+=fprintf(qwk_fp,"@REPLY: <%s>%c",smb.last_error,QWK_NEWLINE); else size+=fprintf(qwk_fp,"@REPLY: %s%c" ,get_msgid(&cfg,subnum,&remsg,msgid,sizeof(msgid)) ,QWK_NEWLINE); } } if(msg->hdr.when_written.zone && mode&QM_TZ) size+=fprintf(qwk_fp,"@TZ: %04hx%c",msg->hdr.when_written.zone,QWK_NEWLINE); if(msg->replyto!=NULL && mode&QM_REPLYTO) size+=fprintf(qwk_fp,"@REPLYTO: %s%c" ,msg->replyto,QWK_NEWLINE); p=0; for(i=0;i<msg->total_hfields;i++) { if(msg->hfield[i].type==SENDER) p=(char *)msg->hfield_dat[i]; if(msg->hfield[i].type==FORWARDED && p) { size+=fprintf(qwk_fp,"Forwarded from %s on %s%c",p ,timestr(*(time32_t *)msg->hfield_dat[i]) ,QWK_NEWLINE); } } buf=smb_getmsgtxt(&smb,msg,GETMSGTXT_ALL); if(!buf) return(0); for(l=0;buf[l];l++) { ch=buf[l]; if(ch=='\n') { if(tear) tear++; /* Count LFs after tearline */ if(tear>3) /* more than two LFs after the tear */ tear=0; if(tearwatch==4) { /* watch for LF---LF */ tear=1; tearwatch=0; } else if(!tearwatch) tearwatch=1; else tearwatch=0; if(l && buf[l-1]=='\r') /* Replace CRLF with funky char */ ch=QWK_NEWLINE; /* but leave sole LF (soft-NL) alone */ fputc(ch,qwk_fp); size++; continue; } if(ch=='\r') { /* Ignore CRs */ if(tearwatch<4) /* LF---CRLF is okay */ tearwatch=0; /* LF-CR- is not okay */ continue; } if(ch==' ' && tearwatch==4) { /* watch for "LF--- " */ tear=1; tearwatch=0; } if(ch=='-') { /* watch for "LF---" */ if(l==0 || (tearwatch && tearwatch<4)) tearwatch++; else tearwatch=0; } else tearwatch=0; if((uint)subnum!=INVALID_SUB && cfg.sub[subnum]->misc&SUB_ASCII) { if(ch<' ' && ch!=1) ch='.'; else if((uchar)ch>0x7f) ch=exascii_to_ascii_char(ch); } if(ch==QWK_NEWLINE) /* funky char */ ch='*'; if(ch==CTRL_A) { ch=buf[++l]; if(ch==0 || toupper(ch)=='Z') /* EOF */ break; if((asc=ctrl_a_to_ascii_char(ch)) != 0) { fputc(asc,qwk_fp); size++; continue; } if(mode&A_EXPAND) { str[0]=0; switch(toupper(ch)) { case 'W': SAFECOPY(str,ansi(LIGHTGRAY)); break; case 'K': SAFECOPY(str,ansi(BLACK)); break; case 'H': SAFECOPY(str,ansi(HIGH)); break; case 'I': SAFECOPY(str,ansi(BLINK)); break; case '-': case '_': case 'N': /* Normal */ SAFECOPY(str,ansi(ANSI_NORMAL)); break; case 'R': SAFECOPY(str,ansi(RED)); break; case 'G': SAFECOPY(str,ansi(GREEN)); break; case 'B': SAFECOPY(str,ansi(BLUE)); break; case 'C': SAFECOPY(str,ansi(CYAN)); break; case 'M': SAFECOPY(str,ansi(MAGENTA)); break; case 'Y': /* Yellow */ SAFECOPY(str,ansi(BROWN)); break; case '0': SAFECOPY(str,ansi(BG_BLACK)); break; case '1': SAFECOPY(str,ansi(BG_RED)); break; case '2': SAFECOPY(str,ansi(BG_GREEN)); break; case '3': SAFECOPY(str,ansi(BG_BROWN)); break; case '4': SAFECOPY(str,ansi(BG_BLUE)); break; case '5': SAFECOPY(str,ansi(BG_MAGENTA)); break; case '6': SAFECOPY(str,ansi(BG_CYAN)); break; case '7': SAFECOPY(str,ansi(BG_LIGHTGRAY)); break; } if(str[0]) size+=fwrite(str,sizeof(char),strlen(str),qwk_fp); continue; } /* End Expand */ if(mode&A_LEAVE && valid_ctrl_a_code(ch)) { fputc(CTRL_A,qwk_fp); fputc(ch,qwk_fp); size+=2L; } continue; } /* End of Ctrl-A shit */ fputc(ch,qwk_fp); size++; } free(buf); if(ch!=QWK_NEWLINE) { fputc(QWK_NEWLINE,qwk_fp); /* make sure it ends in CRLF */ size++; } if(mode&QM_TAGLINE && !(cfg.sub[subnum]->misc&SUB_NOTAG)) { if(!tear) /* no tear line */ SAFEPRINTF(str,"\1n---%c",QWK_NEWLINE); /* so add one */ else SAFECOPY(str,"\1n"); if(cfg.sub[subnum]->misc&SUB_ASCII) ch='*'; else ch='þ'; safe_snprintf(tmp,sizeof(tmp)," %c \1g%.10s\1n %c %.127s%c" ,ch,VERSION_NOTICE,ch,cfg.sub[subnum]->tagline,QWK_NEWLINE); strcat(str,tmp); if(!(mode&A_LEAVE)) remove_ctrl_a(str,str); size+=fwrite(str,sizeof(char),strlen(str),qwk_fp); } while(size%QWK_BLOCK_LEN) { /* Pad with spaces */ size++; fputc(' ',qwk_fp); } tt=msg->hdr.when_written.time; if(localtime_r(&tt,&tm)==NULL) memset(&tm,0,sizeof(tm)); safe_snprintf(tmp,sizeof(tmp),"%02u-%02u-%02u%02u:%02u" ,tm.tm_mon+1,tm.tm_mday,TM_YEAR(tm.tm_year) ,tm.tm_hour,tm.tm_min); if(msg->hdr.attr&MSG_PRIVATE) { if(msg->hdr.attr&MSG_READ) ch='*'; /* private, read */ else ch='+'; /* private, unread */ } else { if(msg->hdr.attr&MSG_READ) ch='-'; /* public, read */ else ch=' '; /* public, unread */ } safe_snprintf(str,sizeof(str),"%c%-7lu%-13.13s%-25.25s" "%-25.25s%-25.25s%12s%-8lu%-6lu\xe1%c%c%c%c%c" ,ch /* message status flag */ ,mode&QM_REP ? (ulong)conf /* conference or */ : msg->hdr.number&MAX_MSGNUM /* message number */ ,tmp /* date and time */ ,to /* To: */ ,from /* From: */ ,msg->subj /* Subject */ ,nulstr /* Password */ ,msg->hdr.thread_back&MAX_MSGNUM /* Message Re: Number */ ,(size/QWK_BLOCK_LEN)+1 /* Number of blocks */ ,(char)conf&0xff /* Conference number lo byte */ ,(ushort)conf>>8 /* hi byte */ ,' ' /* not used */ ,' ' /* not used */ ,useron.rest&FLAG('Q') ? '*' : ' ' /* Net tag line */ ); fseek(qwk_fp,offset,SEEK_SET); fwrite(str,QWK_BLOCK_LEN,1,qwk_fp); fseek(qwk_fp,size,SEEK_CUR); return(size); }