Esempio n. 1
0
void glp_printf(const char *fmt, ...)
{
#ifdef HAVE_ENV
      ENV *env = get_env_ptr();
      va_list arg;
      /* if terminal output is disabled, do nothing */
      if (!env->term_out)
         goto skip;
      /* format the output */
      va_start(arg, fmt);
      vsprintf(env->term_buf, fmt, arg);
      /* (do not use xassert) */
      assert(strlen(env->term_buf) < TBUF_SIZE);
      va_end(arg);
      /* write the formatted output on the terminal */
      glp_puts(env->term_buf);
skip: return;
#else
    char term_buf[TBUF_SIZE];
    va_list arg;
    // if terminal output is disabled, do nothing
    if (!_term_hook_) return;
    // format the output
    va_start(arg, fmt);
    vsprintf(term_buf, fmt, arg);
    // (do not use xassert)
    assert(strlen(term_buf) < TBUF_SIZE);
    va_end(arg);
    // write the formatted output on the terminal
    glp_puts(term_buf);
#endif
}
Esempio n. 2
0
void glp_vprintf(const char *fmt, va_list arg)
{     ENV *env = get_env_ptr();
      /* if terminal output is disabled, do nothing */
      if (!env->term_out)
         goto skip;
      /* format the output */
      vsprintf(env->term_buf, fmt, arg);
      /* (do not use xassert) */
      assert(strlen(env->term_buf) < TBUF_SIZE);
      /* write the formatted output on the terminal */
      glp_puts(env->term_buf);
skip: return;
}