"Fossies" - the Fresh Open Source Software Archive

Member "nss_ldap-265/snprintf.h" (6 Nov 2009, 1643 Bytes) of package /linux/privat/old/nss_ldap-265.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /**************************************************************
    2  * Original:
    3  * Patrick Powell Tue Apr 11 09:48:21 PDT 1995
    4  * A bombproof version of doprnt (dopr) included.
    5  * Sigh. This sort of thing is always nasty do deal with. Note that
    6  * the version here does not include floating point...
    7  *
    8  * snprintf() is used instead of sprintf() as it does limit checks
    9  * for string length. This covers a nasty loophole.
   10  *
   11  * The other functions are there to prevent NULL pointers from
   12  * causing nast effects.
   13  **************************************************************/
   14 
   15 /* keep namespace tidy */
   16 #define vsnprintf   _nss_ldap_vsnprintf
   17 #define snprintf    _nss_ldap_snprintf
   18 
   19 #define HAVE_STDARG_H
   20 #include <sys/types.h>
   21 /* varargs declarations: */
   22 /* you might have to hand force this by doing #define HAVE_STDARG_H */
   23 
   24 #if defined(HAVE_STDARG_H)
   25 #include <stdarg.h>
   26 #define HAVE_STDARGS        /* let's hope that works everywhere (mj) */
   27 #define VA_LOCAL_DECL va_list ap;
   28 #define VA_START(f) va_start(ap, f)
   29 #define VA_SHIFT(v,t) ;     /* no-op for ANSI */
   30 #define VA_END va_end(ap)
   31 #else
   32 #if defined(HAVE_VARARGS_H)
   33 #include <varargs.h>
   34 #undef HAVE_STDARGS
   35 #define VA_LOCAL_DECL va_list ap;
   36 #define VA_START(f) va_start(ap)    /* f is ignored! */
   37 #define VA_SHIFT(v,t) v = va_arg(ap,t)
   38 #define VA_END va_end(ap)
   39 #else
   40 XX **NO VARARGS ** XX
   41 #endif
   42 #endif
   43 /* you can have ANSI C definitions */
   44 #ifdef HAVE_STDARGS
   45 int snprintf (char *str, size_t count, const char *fmt, ...);
   46 int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);
   47 void setproctitle (char *fmt, ...);
   48 #else
   49 int snprintf ();
   50 int vsnprintf ();
   51 void setproctitle ();
   52 #endif