void DECAF_vprintf(FILE* fp, const char *fmt, va_list ap) { if (fp == NULL) { //that means either use stdout or monitor /*if (pMon != NULL) { monitor_vprintf(pMon, fmt, ap); } else if (default_mon != NULL) { monitor_vprintf(default_mon, fmt, ap); } else { */vprintf(fmt, ap); //} } else { if ( (fp == DECAF_OUTPUT_MONITOR_FD) && (default_mon != NULL) ) { monitor_vprintf(default_mon, fmt, ap); } else { vfprintf(fp, fmt, ap); } } }
void monitor_printf(Monitor *mon, const char *fmt, ...) { va_list ap; va_start(ap, fmt); monitor_vprintf(mon, fmt, ap); va_end(ap); }
/* * Print to current monitor if we have one, else to stderr. * TODO should return int, so callers can calculate width, but that * requires surgery to monitor_vprintf(). Left for another day. */ void error_vprintf(const char *fmt, va_list ap) { if (cur_mon) { monitor_vprintf(cur_mon, fmt, ap); } else { vfprintf(stderr, fmt, ap); } }
void _MOCKABLE(agent_printf)( const char* fmt, ... ) { va_list args; if( ac->mon == NULL ) return; va_start( args, fmt ); monitor_vprintf( ac->mon, fmt, args ); va_end( args ); }
void DECAF_mprintf(Monitor* mon, const char* fmt, ...) { va_list ap; va_start(ap, fmt); if (mon != NULL) { monitor_vprintf(mon, fmt, ap); } else { DECAF_vprintf(NULL, fmt, ap); } va_end(ap); }