home *** CD-ROM | disk | FTP | other *** search
/ ftp.ncftp.com / ftp.ncftp.com.zip / ftp.ncftp.com / ncftp / older_versions / ncftp-3.2.2-src.tar.bz2 / ncftp-3.2.2-src.tar / ncftp-3.2.2 / libncftp / u_printf.c < prev    next >
C/C++ Source or Header  |  2008-07-13  |  690b  |  38 lines

  1. /* u_printf.c
  2.  *
  3.  * Copyright (c) 1996-2005 Mike Gleason, NcFTP Software.
  4.  * All rights reserved.
  5.  *
  6.  */
  7.  
  8. #include "syshdrs.h"
  9. #ifdef PRAGMA_HDRSTOP
  10. #    pragma hdrstop
  11. #endif
  12.  
  13. #define _CRT_SECURE_NO_WARNINGS 1
  14.  
  15. /*VARARGS*/
  16. void
  17. PrintF(const FTPCIPtr cip, const char *const fmt, ...)
  18. {
  19.     va_list ap;
  20.     char buf[256];
  21.  
  22.     va_start(ap, fmt);
  23.     if (cip->debugLog != NULL) {
  24.         (void) vfprintf(cip->debugLog, fmt, ap);
  25.         (void) fflush(cip->debugLog);
  26.     }
  27.     if (cip->debugLogProc != NULL) {
  28. #ifdef HAVE_VSNPRINTF
  29.         (void) vsnprintf(buf, sizeof(buf) - 1, fmt, ap);
  30.         buf[sizeof(buf) - 1] = '\0';
  31. #else
  32.         (void) vsprintf(buf, fmt, ap);
  33. #endif
  34.         (*cip->debugLogProc)(cip, buf);
  35.     }
  36.     va_end(ap);
  37. }    /* PrintF */
  38.