char *xvmprintf(const char *fmt, va_list ap){ marg mp; mp.size = 0; mp.buf = mp.next = 0; vxprintf(mout,(void*)&mp,fmt,ap); return mp.buf; }
/* ** Do printf-style string rendering and append the results to a blob. */ void blob_appendf(Blob *pBlob, const char *zFormat, ...){ if( pBlob ){ va_list ap; va_start(ap, zFormat); vxprintf(pBlob, zFormat, ap); va_end(ap); } }
Int32 xsnprintf(char *buf, Int32 n, const char *fmt, ...){ va_list ap; sarg arg; va_start(ap,fmt); arg.next = buf; arg.last = &buf[n-1]; return vxprintf(sout,(void*)&arg,fmt,ap); }
char *xmprintf(const char *fmt, ...){ va_list ap; marg mp; va_start(ap,fmt); mp.size = 0; mp.buf = mp.next = 0; vxprintf(mout,(void*)&mp,fmt,ap); return mp.buf; }
static void _log_iterator_vprintf_nl(_log_iterator *it, int level, struct __sourceloc whence, const char *fmt, va_list ap) { _log_iterator_rewind(it); while (_log_iterator_next(it, level)) { _log_prefix_whence(it, whence); va_list ap1; va_copy(ap1, ap); vxprintf(it->xpf, fmt, ap1); va_end(ap1); } }
ssize_t kprintf(const char *format, ...) { // Start the argument list __builtin_va_list args; __builtin_va_start(args, format); // Call the real printf ssize_t r = vxprintf(kputc, kputs, format, args); // Finish the argument list __builtin_va_end(args); // Return the Number of Printed Characters return r; }
void vlogMessage(int level, struct __sourceloc whence, const char *fmt, va_list ap) { if (level != LOG_LEVEL_SILENT) { _log_iterator it; _log_iterator_start(&it); _rotate_log_file(&it); while (_log_iterator_next(&it, level)) { _log_prefix_whence(&it, whence); va_list ap1; va_copy(ap1, ap); vxprintf(it.xpf, fmt, ap1); va_end(ap1); } } }
void BoardConsoleVPrintf(const char * fmt, va_list ap) { vxprintf(xprintfCallback, NULL, fmt, ap); }
static void _log_vprintf_nl(_log_iterator *it, int level, const char *fmt, va_list ap) { _log_prefix(it, level); vxprintf(it->xpf, fmt, ap); _log_end_line(it, level); }
void blob_vappendf(Blob *pBlob, const char *zFormat, va_list ap){ if( pBlob ) vxprintf(pBlob, zFormat, ap); }
static void vaccinePrint(struct section *section, struct sqlConnection *conn, char *subjId) /* Print out Vaccine section. */ { char *immunStatus = NULL; char *daysInfectF = NULL; char *daysInfectL = NULL; char *injections = NULL; char *startDate = NULL; char *lastSeroNegDay = NULL; char *firstSeroPosDay = NULL; char *firstRNAPosDay = NULL; char *ESDBasis = NULL; char *seqDay = NULL; char *art_daei = NULL; char *art_sequencing = NULL; char query[256]; struct sqlResult *sr; char **row; printf("<TABLE>"); safef(query, sizeof(query), "select art_daei, art_sequencing from hgFixed.artDaei where subjId='%s'", subjId); sr = sqlMustGetResult(conn, query); row = sqlNextRow(sr); if (row != NULL) { art_daei = cloneString(row[0]); art_sequencing = cloneString(row[1]); } sqlFreeResult(&sr); safef(query, sizeof(query), "select immunStatus, daysInfectF, daysInfectL, injections from gsidSubjInfo where subjId='%s'", subjId); sr = sqlMustGetResult(conn, query); row = sqlNextRow(sr); if (row != NULL) { immunStatus = cloneString(row[0]); daysInfectF = cloneString(row[1]); daysInfectL = cloneString(row[2]); injections = cloneString(row[3]); } sqlFreeResult(&sr); safef(query, sizeof(query), "select startDate,lastSeroNegDay,firstSeroPosDay,firstRNAPosDay,ESDBasis,seqDay from hgFixed.testDates where subjId='%s'", subjId); sr = sqlMustGetResult(conn, query); row = sqlNextRow(sr); if (row != NULL) { startDate = cloneString(row[0]); lastSeroNegDay = cloneString(row[1]); firstSeroPosDay = cloneString(row[2]); firstRNAPosDay = cloneString(row[3]); ESDBasis = cloneString(row[4]); seqDay = cloneString(row[5]); } sqlFreeResult(&sr); printf("<TR>"); printf("<TD>"); printf("<B>Vaccine/Placebo:</B> %s%s", immunStatus, GSBLANKS); printf("</TD>"); printf("<TD>"); vxprintf("<B>ART at Sequencing?</B> %s", art_sequencing); printf("</TD>"); printf("</TR>"); printf("<TR>"); printf("<TD>"); /* !!! currently all subjects in the database are infected. */ /* update this when non-infected subjects addded into DB */ printf("<B>HIV Status:</B> %s%s", "Infected", GSBLANKS); printf("</TD>"); printf("<TD>"); vxprintf("<B>DAEI for ART Start:</B> %s", art_daei); printf("</TD>"); printf("</TR>"); /* removed the following item per GSID user feedback */ /*printf("<TD>"); printf("<B>Days of infection relative to last negative date:</B> %s\n", daysInfectL); printf("</TD>"); */ printf("<TR>"); printf("<TD>"); printf("<B>Injections:</B> %s%s", injections, GSBLANKS); printf("</TD>"); printf("<TD>"); if (sameWord(lastSeroNegDay, "-1")) printf("<B>Study Day of Last Serology-Negative HIV Test: </B> %s\n", "N/A"); else vxprintf("<B>Study Day of Last Serology-Negative HIV Test: </B> %s\n", lastSeroNegDay); printf("</TD>"); printf("</TR>"); printf("<TR>"); printf("<TD>"); vxprintf("<B>Date of Study Start:</B> %s\n", startDate); printf("</TD>"); printf("<TD>"); vxprintf("<B>Study Day of First Serology-Positive HIV Test:</B> %s\n", firstSeroPosDay); printf("</TD>"); printf("</TR>"); printf("<TR>"); printf("<TD>"); vxprintf("<B>Estimated Study Day of Infection (ESDI)*:</B> %s\n", daysInfectF); printf("</TD>"); printf("<TD>"); vxprintf("<B>Study Day of First RNA-positive HIV Test (NAT):</B> %s\n", firstRNAPosDay); printf("</TD>"); printf("</TR>"); printf("<TR>"); printf("<TD>"); if (sameWord(seqDay, "-1")) printf("<B>Study Day of Sequencing:</B> N/A\n"); else vxprintf("<B>Study Day of Sequencing:</B> %s\n", seqDay); printf("</TD>"); printf("<TD>"); vxprintf("<B>Basis for ESDI:</B> %s\n", ESDBasis); printf("</TD>"); printf("</TR>"); printf("</TABLE>"); return; }
int testprintf(char *fmt, ...){ va_list ap; va_start(ap,fmt); return vxprintf((void(*)(char*,int,void*))fout,0,fmt,ap); }
Int32 xvsnprintf(char *buf, Int32 n, const char *fmt, va_list ap){ sarg arg; arg.next = buf; arg.last = &buf[n-1]; return vxprintf(sout,(void*)&arg,fmt,ap); }
Int32 xprintf(const char *fmt, ...){ va_list ap; va_start(ap,fmt); /* return vxprintf(p_fout,(void*)stdout,fmt,ap); */ return vxprintf(p_fout,NULL,fmt,ap); }