예제 #1
0
/*-------------------------------------------------------------------------
 * Function:    out_puts
 *
 * Purpose:     Prints string S to the specified file.  If S fits on the
 *              current line then S is printed on the current line. Otherwise
 *              S is printed on the next line.
 *
 * Return:      void
 *
 * Programmer:  Robb Matzke
 *              [email protected]
 *              Dec 11 1996
 *
 * Modifications:
 *              Robb Matzke, 17 Dec 1996
 *              If literal mode is on, then no linefeeds are inserted to
 *              break up long lines.
 *
 *              Robb Matzke, 2000-06-27
 *              If the file handle right margin is zero then no linefeeds
 *              are inserted to break up long lines.
 *-------------------------------------------------------------------------
 */
void
out_puts (out_t *f, const char *s) {

   int          n = strlen (s);

   if (isatty (fileno (f->f))) out_progress (NULL);
   if (!f->literal && f->rtmargin && n+f->col>OUT_NCOLS-f->rtmargin) {
       out_nl (f);
   }
   
   if (out_brokenpipe(f)) return;
   if (s && *s) {
      if (!f->literal && 0==f->col) {
         while (*s && isspace(*s)) s++;
      }
      out_prefix (f);
      fputs (s, f->f);
      f->col += n;
   }
}
예제 #2
0
 void message_va(const char* format, va_list args)
 {
     out_prefix(0, "", format, args);
 }
예제 #3
0
 void message_va(const char* format, va_list args)
 {
     char tm[16];
     safe_sprintf(tm, "%03d", getTime());
     out_prefix(0, tm, format, args);
 }