]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Remove more old-compiler compensation.
authorGuy Harris <[email protected]>
Fri, 9 Aug 2019 05:39:54 +0000 (22:39 -0700)
committerGuy Harris <[email protected]>
Fri, 9 Aug 2019 06:21:35 +0000 (23:21 -0700)
We require an environment with a C99-compatible snprintf(), so we don't
need to work around older implementations.  Make the configuration
process fail if we don't have snprintf() and vsnprintf().

We require at least VS 2015, so we don't have to check for _MSC_VER >=
1400.  Make the build fail if we don't have at least VS 2015.

We apparently do, however, have to use __inline, as the VS 2015
documentation doesn't meaning plain old "inline".  Update a comment.

40 files changed:
CMakeLists.txt
addrtoname.c
addrtostr.c
cmakeconfig.h.in
config.h.in
configure
configure.ac
funcattrs.h
missing/getservent.c
missing/snprintf.c
missing/win_ether_ntohost.c
netdissect-stdinc.h
netdissect.c
netdissect.h
parsenfsfh.c
print-ascii.c
print-atalk.c
print-babel.c
print-bgp.c
print-cnfp.c
print-decnet.c
print-fr.c
print-hncp.c
print-icmp.c
print-icmp6.c
print-ipx.c
print-isakmp.c
print-isoclns.c
print-lldp.c
print-nfs.c
print-openflow-1.0.c
print-rx.c
print-snmp.c
print-stp.c
print-sunrpc.c
print-telnet.c
print-zephyr.c
smbutil.c
tcpdump.c
util-print.c

index 08d2d249ce71aef7b094b107e08f57865c1a8020..1c5f80da4bea556220bd570d15f538ff7135fc31 100644 (file)
@@ -278,37 +278,28 @@ else(STDLIBS_HAVE_GETSERVENT)
 endif(STDLIBS_HAVE_GETSERVENT)
 cmake_pop_check_state()
 
-check_function_exists(getopt_long HAVE_GETOPT_LONG)
-#
-# For Windows, either
-#
-#   1) we're using VS 2015, in which case we have both snprintf()
-#      and vsnprintf(), and they behave in a C99-compliant fashion,
-#      so we use them
-#
-# or
 #
-#   2) we're not, and we don't have snprintf(), and we either don't
-#      have vsnprintf() or we have one that *doesn't* behave in a
-#      C99-compliant fashion, but we *do* have _snprintf_s() and
-#      _vsnprintf_s(), so we wrap them with #defines
+# Make sure we have vsnprintf() and snprintf(); we require them.
 #
-# and we test for both of them at compile time, so we don't need to
-# check for snprintf() or vsnprintf() here.
-#
-# XXX - do we need to care about UN*Xes that don't have snprintf()
-# or vsnprintf() any more?
+check_function_exists(vsnprintf HAVE_VSNPRINTF)
+if(NOT HAVE_VSNPRINTF)
+    message(FATAL_ERROR "vsnprintf() is required but wasn't found")
+endif(NOT HAVE_VSNPRINTF)
+check_function_exists(snprintf HAVE_SNPRINTF)
+if(NOT HAVE_SNPRINTF)
+    message(FATAL_ERROR "snprintf() is required but wasn't found")
+endif()
+
+check_function_exists(getopt_long HAVE_GETOPT_LONG)
+check_function_exists(strftime HAVE_STRFTIME)
+check_function_exists(setlinebuf HAVE_SETLINEBUF)
 #
-# We also don't need to waste time checking for fork() or vfork().
+# For Windows,  don't need to waste time checking for fork() or vfork().
 #
 if(NOT WIN32)
-  check_function_exists(vsnprintf HAVE_VSNPRINTF)
-  check_function_exists(snprintf HAVE_SNPRINTF)
   check_function_exists(fork HAVE_FORK)
   check_function_exists(vfork HAVE_VFORK)
 endif(NOT WIN32)
-check_function_exists(strftime HAVE_STRFTIME)
-check_function_exists(setlinebuf HAVE_SETLINEBUF)
 
 #
 # Some platforms may need -lnsl for getrpcbynumber.
@@ -1116,11 +1107,6 @@ foreach(FUNC strlcat strlcpy strdup strsep getservent getopt_long)
         set(NETDISSECT_SOURCE_LIST_C ${NETDISSECT_SOURCE_LIST_C} missing/${FUNC}.c)
     endif()
 endforeach()
-if(NOT WIN32)
-    if(NOT HAVE_VSNPRINTF OR NOT HAVE_SNPRINTF)
-        set(NETDISSECT_SOURCE_LIST_C ${NETDISSECT_SOURCE_LIST_C} missing/snprintf.c)
-    endif(NOT HAVE_VSNPRINTF OR NOT HAVE_SNPRINTF)
-endif(NOT WIN32)
 
 add_library(netdissect STATIC
     ${NETDISSECT_SOURCE_LIST_C}
index 1ba7e506dc399baf368654c732d80bca72fb6747..aa43be768c1efa8270842707405ac8ae701e812e 100644 (file)
@@ -628,7 +628,7 @@ etheraddr_string(netdissect_options *ndo, const uint8_t *ep)
        }
 
        if (!ndo->ndo_nflag) {
-               nd_snprintf(cp, BUFSIZE - (2 + 5*3), " (oui %s)",
+               snprintf(cp, BUFSIZE - (2 + 5*3), " (oui %s)",
                    tok2str(oui_values, "Unknown", oui));
        } else
                *cp = '\0';
@@ -749,7 +749,7 @@ tcpport_string(netdissect_options *ndo, u_short port)
        tp->addr = i;
        tp->nxt = newhnamemem(ndo);
 
-       (void)nd_snprintf(buf, sizeof(buf), "%u", i);
+       (void)snprintf(buf, sizeof(buf), "%u", i);
        tp->name = strdup(buf);
        if (tp->name == NULL)
                (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
@@ -771,7 +771,7 @@ udpport_string(netdissect_options *ndo, u_short port)
        tp->addr = i;
        tp->nxt = newhnamemem(ndo);
 
-       (void)nd_snprintf(buf, sizeof(buf), "%u", i);
+       (void)snprintf(buf, sizeof(buf), "%u", i);
        tp->name = strdup(buf);
        if (tp->name == NULL)
                (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
@@ -829,7 +829,7 @@ init_servarray(netdissect_options *ndo)
                while (table->name)
                        table = table->nxt;
                if (ndo->ndo_nflag) {
-                       (void)nd_snprintf(buf, sizeof(buf), "%d", port);
+                       (void)snprintf(buf, sizeof(buf), "%d", port);
                        table->name = strdup(buf);
                } else
                        table->name = strdup(sv->s_name);
@@ -1333,7 +1333,7 @@ const char *
 ieee8021q_tci_string(const uint16_t tci)
 {
        static char buf[128];
-       nd_snprintf(buf, sizeof(buf), "vlan %u, p %u%s",
+       snprintf(buf, sizeof(buf), "vlan %u, p %u%s",
                 tci & 0xfff,
                 tci >> 13,
                 (tci & 0x1000) ? ", DEI" : "");
index 3b5735291d8cda12a9f6d3849dbf75e62ff1815e..62cc298ae28a0aaa7b501dd0bb71ca00fb8d123c 100644 (file)
@@ -191,7 +191,7 @@ addrtostr6 (const void *src, char *dst, size_t size)
       space_left -= added_space;
       break;
     }
-    snprintfed = nd_snprintf (dp, space_left, "%x", words[i]);
+    snprintfed = snprintf (dp, space_left, "%x", words[i]);
     if (snprintfed < 0)
         return (NULL);
     if ((size_t) snprintfed >= space_left)
index 9e2c0268dc0a3e34a3e671b8b6ce9cc076639a8c..5c7532847ece40a70e2ba2f90673ad6317085a18 100644 (file)
 /* Define to 1 if you have the `setlinebuf' function. */
 #cmakedefine HAVE_SETLINEBUF 1
 
-/* Define to 1 if you have the `snprintf' function. */
-#cmakedefine HAVE_SNPRINTF 1
-
 /* Define to 1 if you have the <stdint.h> header file. */
 #cmakedefine HAVE_STDINT_H 1
 
 /* Define to 1 if you have the `vfork' function. */
 #cmakedefine HAVE_VFORK 1
 
-/* Define to 1 if you have the `vsnprintf' function. */
-#cmakedefine HAVE_VSNPRINTF 1
-
 /* Define to 1 if you have the `wsockinit' function. */
 #cmakedefine HAVE_WSOCKINIT 1
 
index f032227a2e8a016763df454c432fcfdbc9d4d545..e40e1089eb23cc2021cbd0c0a7da2f7ab468a942 100644 (file)
 /* Define to 1 if you have the `setlinebuf' function. */
 #undef HAVE_SETLINEBUF
 
-/* Define to 1 if you have the `snprintf' function. */
-#undef HAVE_SNPRINTF
-
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 
 /* Define to 1 if you have the `vfork' function. */
 #undef HAVE_VFORK
 
-/* Define to 1 if you have the `vsnprintf' function. */
-#undef HAVE_VSNPRINTF
-
 /* define if libpcap has yydebug */
 #undef HAVE_YYDEBUG
 
index da1bffd05cc0e4e0974f707afaced1bcf3765053..0660441f108487bf6b7e239a03fec31d50362ef6 100755 (executable)
--- a/configure
+++ b/configure
@@ -676,7 +676,6 @@ infodir
 docdir
 oldincludedir
 includedir
-runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -757,7 +756,6 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
-runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1010,15 +1008,6 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
-  -runstatedir | --runstatedir | --runstatedi | --runstated \
-  | --runstate | --runstat | --runsta | --runst | --runs \
-  | --run | --ru | --r)
-    ac_prev=runstatedir ;;
-  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
-  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
-  | --run=* | --ru=* | --r=*)
-    runstatedir=$ac_optarg ;;
-
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1156,7 +1145,7 @@ fi
 for ac_var in  exec_prefix prefix bindir sbindir libexecdir datarootdir \
                datadir sysconfdir sharedstatedir localstatedir includedir \
                oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-               libdir localedir mandir runstatedir
+               libdir localedir mandir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1309,7 +1298,6 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
-  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -5171,30 +5159,24 @@ fi
 done
 
 
-needsnprintf=no
-for ac_func in vsnprintf snprintf
-do :
-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
+#
+# Make sure we have vsnprintf() and snprintf(); we require them.
+#
+ac_fn_c_check_func "$LINENO" "vsnprintf" "ac_cv_func_vsnprintf"
+if test "x$ac_cv_func_vsnprintf" = xyes; then :
 
 else
-  needsnprintf=yes
+  as_fn_error $? "vsnprintf() is required but wasn't found" "$LINENO" 5
 fi
-done
 
-if test $needsnprintf = yes; then
-       case " $LIBOBJS " in
-  *" snprintf.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS snprintf.$ac_objext"
- ;;
-esac
+ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf"
+if test "x$ac_cv_func_snprintf" = xyes; then :
 
+else
+  as_fn_error $? "snprintf() is required but wasn't found" "$LINENO" 5
 fi
 
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lrpc" >&5
 $as_echo_n "checking for main in -lrpc... " >&6; }
 if ${ac_cv_lib_rpc_main+:} false; then :
index cef1d6b708a6ae15cf331439809f23bf9a670b0a..ed3e14e375881f3f8e48471e6d37484fb748db66 100644 (file)
@@ -428,12 +428,13 @@ AC_REPLACE_FUNCS(strlcat strlcpy strdup strsep getservent getopt_long)
 AC_CHECK_FUNCS(fork vfork strftime)
 AC_CHECK_FUNCS(setlinebuf)
 
-needsnprintf=no
-AC_CHECK_FUNCS(vsnprintf snprintf,,
-       [needsnprintf=yes])
-if test $needsnprintf = yes; then
-       AC_LIBOBJ(snprintf)
-fi
+#
+# Make sure we have vsnprintf() and snprintf(); we require them.
+#
+AC_CHECK_FUNC(vsnprintf,,
+    AC_MSG_ERROR([vsnprintf() is required but wasn't found]))
+AC_CHECK_FUNC(snprintf,,
+    AC_MSG_ERROR([snprintf() is required but wasn't found]))
 
 AC_CHECK_LIB(rpc, main)                dnl It's unclear why we might need -lrpc
 
index 7fdbf9253932652a0194509b5ba881275e2d7a6e..8ac08c4458db7c9adf83b3c4009439564cee6cae 100644 (file)
 /*
  * For flagging arguments as format strings in MSVC.
  */
-#if _MSC_VER >= 1400
+#ifdef _MSC_VER
  #include <sal.h>
- #if _MSC_VER > 1400
-  #define FORMAT_STRING(p) _Printf_format_string_ p
- #else
-  #define FORMAT_STRING(p) __format_string p
- #endif
+ #define FORMAT_STRING(p) _Printf_format_string_ p
 #else
  #define FORMAT_STRING(p) p
 #endif
index 198644f244036cdc18ade9b027f156eeca9673c1..39cee068a69bb6d1e00a72d2d9b6a0c3adde57b7 100644 (file)
@@ -65,9 +65,9 @@ const char *etc_path(const char *file)
         return (file);
     else
 #ifdef _WIN32
-    nd_snprintf(path, sizeof(path), "%s%s%s", env, __PATH_ETC_INET, file);
+    snprintf(path, sizeof(path), "%s%s%s", env, __PATH_ETC_INET, file);
 #else
-    nd_snprintf(path, sizeof(path), "%s%s", env, file);
+    snprintf(path, sizeof(path), "%s%s", env, file);
 #endif
     return (path);
 }
index 3b21f31fbf053970292cb60cf9540ffba0cafb99..2f12cf1635e9b066bbe3eb621c9c2f9f7181573b 100644 (file)
@@ -67,25 +67,6 @@ struct state {
   /* XXX - methods */
 };
 
-#ifndef HAVE_VSNPRINTF
-static int
-sn_reserve (struct state *state, size_t n)
-{
-  return state->s + n > state->theend;
-}
-
-static int
-sn_append_char (struct state *state, unsigned char c)
-{
-  if (sn_reserve (state, 1)) {
-    return 1;
-  } else {
-    *state->s++ = c;
-    return 0;
-  }
-}
-#endif
-
 #if 0
 static int
 as_reserve (struct state *state, size_t n)
@@ -454,37 +435,6 @@ xyzprintf (struct state *state, const char *char_format, va_list ap)
   return 0;
 }
 
-#ifndef HAVE_SNPRINTF
-int
-nd_snprintf (char *str, size_t sz, const char *format, ...)
-{
-  va_list args;
-  int ret;
-
-  va_start(args, format);
-  ret = nd_vsnprintf (str, sz, format, args);
-
-#ifdef PARANOIA
-  {
-    int ret2;
-    char *tmp;
-
-    tmp = malloc (sz);
-    if (tmp == NULL)
-      abort ();
-
-    ret2 = vsprintf (tmp, format, args);
-    if (ret != ret2 || strcmp(str, tmp))
-      abort ();
-    free (tmp);
-  }
-#endif
-
-  va_end(args);
-  return ret;
-}
-#endif
-
 #if 0
 #ifndef HAVE_ASPRINTF
 int
@@ -516,45 +466,6 @@ asprintf (char **ret, const char *format, ...)
 }
 #endif
 
-#ifndef HAVE_ASNPRINTF
-int
-nd_asnprintf (char **ret, size_t max_sz, const char *format, ...)
-{
-  va_list args;
-  int val;
-
-  va_start(args, format);
-  val = nd_vasnprintf (ret, max_sz, format, args);
-
-#ifdef PARANOIA
-  {
-    int ret2;
-    char *tmp;
-    tmp = malloc (val + 1);
-    if (tmp == NULL)
-      abort ();
-
-    ret2 = vsprintf (tmp, format, args);
-    if (val != ret2 || strcmp(*ret, tmp))
-      abort ();
-    free (tmp);
-  }
-#endif
-
-  va_end(args);
-  return val;
-}
-#endif
-
-#ifndef HAVE_VASPRINTF
-int
-vasprintf (char **ret, const char *format, va_list args)
-{
-  return nd_vasnprintf (ret, 0, format, args);
-}
-#endif
-
-
 #ifndef HAVE_VASNPRINTF
 int
 nd_vasnprintf (char **ret, size_t max_sz, const char *format, va_list args)
@@ -597,29 +508,3 @@ nd_vasnprintf (char **ret, size_t max_sz, const char *format, va_list args)
 }
 #endif
 #endif
-
-#ifndef HAVE_VSNPRINTF
-int
-nd_vsnprintf (char *str, size_t sz, const char *format, va_list args)
-{
-  struct state state;
-  int ret;
-  unsigned char *ustr = (unsigned char *)str;
-
-  state.max_sz = 0;
-  state.sz     = sz;
-  state.str    = ustr;
-  state.s      = ustr;
-  state.theend = ustr + sz - 1;
-  state.append_char = sn_append_char;
-  state.reserve     = sn_reserve;
-
-  ret = xyzprintf (&state, format, args);
-  *state.s = '\0';
-  if (ret)
-    return sz;
-  else
-    return state.s - state.str;
-}
-#endif
-
index 6ac26b7c06152792acc65b1e9a89fe12a5fae585..05930923af83612ab303e9aa7c68eff78726c53b 100644 (file)
@@ -85,9 +85,9 @@ const char *etc_path (const char *file)
     return (file);
 
   if (win9x)
-    nd_snprintf (path, sizeof(path), "%s\\etc\\%s", env, file);
+    snprintf (path, sizeof(path), "%s\\etc\\%s", env, file);
   else
-    nd_snprintf (path, sizeof(path), "%s\\system32\\drivers\\etc\\%s", env, file);
+    snprintf (path, sizeof(path), "%s\\system32\\drivers\\etc\\%s", env, file);
 
   return (path);
 }
index c52e72a9d04551cb70ff7c19f6c08af013711090..aed38b31c49935a4b0245682bde3e21422e706ef 100644 (file)
   #define strtoint64_t strtoll
 
   /*
-   * Microsoft's documentation doesn't speak of LL as a valid
-   * suffix for 64-bit integers, so we'll just use i64.
-   *
-   * XXX - is that still the case as of VS 2015?
+   * And we have LL as a suffix for constants, so use that.
    */
-  #define INT64_T_CONSTANT(constant)   (constant##i64)
+  #define INT64_T_CONSTANT(constant)   (constant##LL)
 #else
   /*
    * Non-Microsoft compiler.
@@ -295,62 +292,6 @@ typedef char* caddr_t;
  */
 #include "funcattrs.h"
 
-/*
- * On Windows, snprintf(), with that name and with C99 behavior - i.e.,
- * guaranteeing that the formatted string is null-terminated - didn't
- * appear until Visual Studio 2015.  Prior to that, the C runtime had
- * only _snprintf(), which *doesn't* guarantee that the string is
- * null-terminated if it is truncated due to the buffer being too
- * small.  We therefore can't just define snprintf to be _snprintf
- * and define vsnprintf to be _vsnprintf, as we're relying on null-
- * termination of strings in all cases.
- *
- * Furthermore, some versions of Visual Studio prior to Visual
- * Studio 2015 had vsnprintf() (but not snprintf()!), but those
- * versions don't guarantee null termination, either.
- *
- * We assume all UN*Xes that have snprintf() and vsnprintf() provide
- * C99 behavior.
- */
-#if defined(_MSC_VER) || defined(__MINGW32__)
-  #if defined(_MSC_VER) && _MSC_VER >= 1900
-    /*
-     * VS 2015 or newer; just use the C runtime's snprintf() and
-     * vsnprintf().
-     */
-    #define nd_snprintf                snprintf
-    #define nd_vsnprintf       vsnprintf
-  #else /* defined(_MSC_VER) && _MSC_VER >= 1900 */
-    /*
-     * VS prior to 2015, or MingGW; assume we have _snprintf_s() and
-     * _vsnprintf_s(), which guarantee null termination.
-     */
-    #define nd_snprintf(buf, buflen, ...) \
-        _snprintf_s(buf, buflen, _TRUNCATE, __VA_ARGS__)
-    #define nd_vsnprintf(buf, buflen, fmt, ap) \
-        _vsnprintf_s(buf, buflen, _TRUNCATE, fmt, ap)
-  #endif /* defined(_MSC_VER) && _MSC_VER >= 1900 */
-#else /* defined(_MSC_VER) || defined(__MINGW32__) */
-  /*
-   * Some other compiler, which we assume to be a UN*X compiler.
-   * Use the system's snprintf() if we have it, otherwise use
-   * our own implementation
-   */
-  #ifdef HAVE_SNPRINTF
-    #define nd_snprintf                snprintf
-  #else /* HAVE_SNPRINTF */
-    int nd_snprintf (char *str, size_t sz, FORMAT_STRING(const char *format), ...)
-        PRINTFLIKE(3, 4);
-  #endif /* HAVE_SNPRINTF */
-
-  #ifdef HAVE_VSNPRINTF
-    #define nd_vsnprintf       vsnprintf
-  #else /* HAVE_VSNPRINTF */
-    int nd_vsnprintf (char *str, size_t sz, FORMAT_STRING(const char *format),
-        va_list ap) PRINTFLIKE(3, 0);
-  #endif /* HAVE_VSNPRINTF */
-#endif /* defined(_MSC_VER) || defined(__MINGW32__) */
-
 /*
  * fopen() read and write modes for text files and binary files.
  */
index 4d4a4a59149cf5bed98364045dd5a8cd63929a85..7e46d6aa3d3176ede396fefee8c788d7a053db03 100644 (file)
@@ -123,14 +123,14 @@ nd_load_smi_module(const char *module, char *errbuf, size_t errbuf_size)
 {
 #ifdef USE_LIBSMI
        if (smiLoadModule(module) == 0) {
-               nd_snprintf(errbuf, errbuf_size, "could not load MIB module %s",
+               snprintf(errbuf, errbuf_size, "could not load MIB module %s",
                    module);
                return (-1);
        }
        nd_smi_module_loaded = 1;
        return (0);
 #else
-       nd_snprintf(errbuf, errbuf_size, "MIB module %s not loaded: no libsmi support",
+       snprintf(errbuf, errbuf_size, "MIB module %s not loaded: no libsmi support",
            module);
        return (-1);
 #endif
index c3621ffaf8a51deee8e7d58f3af9748147b2abb9..66ae4fad97031d5748b5739f37815f2e5537b008 100644 (file)
@@ -112,8 +112,6 @@ typedef unsigned char nd_byte;
 #define        roundup2(x, y)  (((x)+((y)-1))&(~((y)-1)))
 #endif
 
-/* nd_snprintf et al */
-
 #include <stdarg.h>
 #include <pcap.h>
 
index fa3e545a17d85e6c33f4b45da2da8db3580951f9..b3f54900cc0527424fa86da47512a3f1bdd14c46 100644 (file)
@@ -400,7 +400,7 @@ Parse_fh(netdissect_options *ndo, const unsigned char *fh, u_int len,
 #endif
            /* Save the actual handle, so it can be display with -u */
            for (i = 0; i < len*4 && i*2 < sizeof(fsidp->Opaque_Handle) - 1; i++)
-               (void)nd_snprintf(&(fsidp->Opaque_Handle[i*2]), 3, "%.2X",
+               (void)snprintf(&(fsidp->Opaque_Handle[i*2]), 3, "%.2X",
                               GET_U_1(fhp + i));
            fsidp->Opaque_Handle[i*2] = '\0';
 
index 63f15f0f14215fe6708188a4b479494597dc7b88..56efc84af18c22873d946ae8e5162c0b9d6be3c3 100644 (file)
@@ -117,7 +117,7 @@ hex_and_ascii_print_with_offset(netdissect_options *ndo, const char *ident,
                cp++;
                s2 = GET_U_1(cp);
                cp++;
-               (void)nd_snprintf(hsp, sizeof(hexstuff) - (hsp - hexstuff),
+               (void)snprintf(hsp, sizeof(hexstuff) - (hsp - hexstuff),
                    " %02x%02x", s1, s2);
                hsp += HEXDUMP_HEXSTUFF_PER_SHORT;
                *(asp++) = (char)(ND_ISGRAPH(s1) ? s1 : '.');
@@ -136,7 +136,7 @@ hex_and_ascii_print_with_offset(netdissect_options *ndo, const char *ident,
        if (length & 1) {
                s1 = GET_U_1(cp);
                cp++;
-               (void)nd_snprintf(hsp, sizeof(hexstuff) - (hsp - hexstuff),
+               (void)snprintf(hsp, sizeof(hexstuff) - (hsp - hexstuff),
                    " %02x", s1);
                hsp += 3;
                *(asp++) = (char)(ND_ISGRAPH(s1) ? s1 : '.');
index 99cd850e3d1d992bd27cf794bce66fc4b7373bf7..57bd140fc49e06a6438f49bd5c131eeb9dab0667 100644 (file)
@@ -655,7 +655,7 @@ ataddr_string(netdissect_options *ndo,
                if (tp2->addr == i) {
                        tp->addr = (atnet << 8) | athost;
                        tp->nxt = newhnamemem(ndo);
-                       (void)nd_snprintf(nambuf, sizeof(nambuf), "%s.%u",
+                       (void)snprintf(nambuf, sizeof(nambuf), "%s.%u",
                            tp2->name, athost);
                        tp->name = strdup(nambuf);
                        if (tp->name == NULL)
@@ -667,9 +667,9 @@ ataddr_string(netdissect_options *ndo,
        tp->addr = (atnet << 8) | athost;
        tp->nxt = newhnamemem(ndo);
        if (athost != 255)
-               (void)nd_snprintf(nambuf, sizeof(nambuf), "%u.%u", atnet, athost);
+               (void)snprintf(nambuf, sizeof(nambuf), "%u.%u", atnet, athost);
        else
-               (void)nd_snprintf(nambuf, sizeof(nambuf), "%u", atnet);
+               (void)snprintf(nambuf, sizeof(nambuf), "%u", atnet);
        tp->name = strdup(nambuf);
        if (tp->name == NULL)
                (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
@@ -693,7 +693,7 @@ ddpskt_string(netdissect_options *ndo,
        static char buf[8];
 
        if (ndo->ndo_nflag) {
-               (void)nd_snprintf(buf, sizeof(buf), "%u", skt);
+               (void)snprintf(buf, sizeof(buf), "%u", skt);
                return (buf);
        }
        return (tok2str(skt2str, "%u", skt));
index f01fbc33941b777091338f67633498d3dfe4da2c..5f1d90f06f57a5dd4021ce8b4d24164d1e6df35e 100644 (file)
@@ -111,7 +111,7 @@ static const char *
 format_id(netdissect_options *ndo, const u_char *id)
 {
     static char buf[25];
-    nd_snprintf(buf, 25, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
+    snprintf(buf, 25, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
              GET_U_1(id), GET_U_1(id + 1), GET_U_1(id + 2),
              GET_U_1(id + 3), GET_U_1(id + 4), GET_U_1(id + 5),
              GET_U_1(id + 6), GET_U_1(id + 7));
@@ -127,9 +127,9 @@ format_prefix(netdissect_options *ndo, const u_char *prefix, unsigned char plen)
 {
     static char buf[50];
     if(plen >= 96 && memcmp(prefix, v4prefix, 12) == 0)
-        nd_snprintf(buf, 50, "%s/%u", ipaddr_string(ndo, prefix + 12), plen - 96);
+        snprintf(buf, 50, "%s/%u", ipaddr_string(ndo, prefix + 12), plen - 96);
     else
-        nd_snprintf(buf, 50, "%s/%u", ip6addr_string(ndo, prefix), plen);
+        snprintf(buf, 50, "%s/%u", ip6addr_string(ndo, prefix), plen);
     buf[49] = '\0';
     return buf;
 }
@@ -150,7 +150,7 @@ format_interval(const uint16_t i)
 
     if (i == 0)
         return "0.0s (bogus)";
-    nd_snprintf(buf, sizeof(buf), "%u.%02us", i / 100, i % 100);
+    snprintf(buf, sizeof(buf), "%u.%02us", i / 100, i % 100);
     return buf;
 }
 
@@ -164,7 +164,7 @@ static const char *
 format_timestamp(const uint32_t i)
 {
     static char buf[sizeof("0000.000000s")];
-    nd_snprintf(buf, sizeof(buf), "%u.%06us", i / 1000000, i % 1000000);
+    snprintf(buf, sizeof(buf), "%u.%06us", i / 1000000, i % 1000000);
     return buf;
 }
 
index 572f1ff5a623652f440ee67eff77783d28104d56..301d24f88bad32081ade94c313f3d1b9935e6378 100644 (file)
@@ -526,9 +526,9 @@ as_printf(netdissect_options *ndo,
           char *str, size_t size, u_int asnum)
 {
     if (!ndo->ndo_bflag || asnum <= 0xFFFF) {
-        nd_snprintf(str, size, "%u", asnum);
+        snprintf(str, size, "%u", asnum);
     } else {
-        nd_snprintf(str, size, "%u.%u", asnum >> 16, asnum & 0xFFFF);
+        snprintf(str, size, "%u.%u", asnum >> 16, asnum & 0xFFFF);
     }
     return str;
 }
@@ -557,7 +557,7 @@ decode_prefix4(netdissect_options *ndo,
     if (plen % 8) {
         ((u_char *)&addr)[plenbytes - 1] &= ((0xff00 >> (plen % 8)) & 0xff);
     }
-    nd_snprintf(buf, buflen, "%s/%u", ipaddr_string(ndo, (const u_char *)&addr), plen);
+    snprintf(buf, buflen, "%s/%u", ipaddr_string(ndo, (const u_char *)&addr), plen);
     return 1 + plenbytes;
 
 trunc:
@@ -606,7 +606,7 @@ decode_labeled_prefix4(netdissect_options *ndo,
         ((u_char *)&addr)[plenbytes - 1] &= ((0xff00 >> (plen % 8)) & 0xff);
     }
     /* the label may get offsetted by 4 bits so lets shift it right */
-    nd_snprintf(buf, buflen, "%s/%u, label:%u %s",
+    snprintf(buf, buflen, "%s/%u, label:%u %s",
              ipaddr_string(ndo, (const u_char *)&addr),
              plen,
              GET_BE_U_3(pptr + 1)>>4,
@@ -638,14 +638,14 @@ bgp_vpn_ip_print(netdissect_options *ndo,
     switch(addr_length) {
     case (sizeof(nd_ipv4) << 3): /* 32 */
         ND_TCHECK_LEN(pptr, sizeof(nd_ipv4));
-        nd_snprintf(pos, sizeof(addr), "%s", ipaddr_string(ndo, pptr));
+        snprintf(pos, sizeof(addr), "%s", ipaddr_string(ndo, pptr));
         break;
     case (sizeof(nd_ipv6) << 3): /* 128 */
         ND_TCHECK_LEN(pptr, sizeof(nd_ipv6));
-        nd_snprintf(pos, sizeof(addr), "%s", ip6addr_string(ndo, pptr));
+        snprintf(pos, sizeof(addr), "%s", ip6addr_string(ndo, pptr));
         break;
     default:
-        nd_snprintf(pos, sizeof(addr), "bogus address length %u", addr_length);
+        snprintf(pos, sizeof(addr), "bogus address length %u", addr_length);
         break;
     }
     pos += strlen(pos);
@@ -692,7 +692,7 @@ bgp_vpn_sg_print(netdissect_options *ndo,
     total_length += (addr_length >> 3) + 1;
     offset = (u_int)strlen(buf);
     if (addr_length) {
-        nd_snprintf(buf + offset, buflen - offset, ", Source %s",
+        snprintf(buf + offset, buflen - offset, ", Source %s",
              bgp_vpn_ip_print(ndo, pptr, addr_length));
         pptr += (addr_length >> 3);
     }
@@ -707,7 +707,7 @@ bgp_vpn_sg_print(netdissect_options *ndo,
     total_length += (addr_length >> 3) + 1;
     offset = (u_int)strlen(buf);
     if (addr_length) {
-        nd_snprintf(buf + offset, buflen - offset, ", Group %s",
+        snprintf(buf + offset, buflen - offset, ", Group %s",
              bgp_vpn_ip_print(ndo, pptr, addr_length));
         pptr += (addr_length >> 3);
     }
@@ -730,7 +730,7 @@ bgp_vpn_rd_print(netdissect_options *ndo,
 
     case 0:
         /* 2-byte-AS:number fmt */
-        nd_snprintf(pos, sizeof(rd) - (pos - rd), "%u:%u (= %u.%u.%u.%u)",
+        snprintf(pos, sizeof(rd) - (pos - rd), "%u:%u (= %u.%u.%u.%u)",
                     GET_BE_U_2(pptr + 2),
                     GET_BE_U_4(pptr + 4),
                     GET_U_1(pptr + 4), GET_U_1(pptr + 5),
@@ -739,7 +739,7 @@ bgp_vpn_rd_print(netdissect_options *ndo,
 
     case 1:
         /* IP-address:AS fmt */
-        nd_snprintf(pos, sizeof(rd) - (pos - rd), "%u.%u.%u.%u:%u",
+        snprintf(pos, sizeof(rd) - (pos - rd), "%u.%u.%u.%u:%u",
                     GET_U_1(pptr + 2), GET_U_1(pptr + 3),
                     GET_U_1(pptr + 4), GET_U_1(pptr + 5),
                     GET_BE_U_2(pptr + 6));
@@ -747,14 +747,14 @@ bgp_vpn_rd_print(netdissect_options *ndo,
 
     case 2:
         /* 4-byte-AS:number fmt */
-        nd_snprintf(pos, sizeof(rd) - (pos - rd), "%s:%u (%u.%u.%u.%u:%u)",
+        snprintf(pos, sizeof(rd) - (pos - rd), "%s:%u (%u.%u.%u.%u:%u)",
                     as_printf(ndo, astostr, sizeof(astostr), GET_BE_U_4(pptr + 2)),
                     GET_BE_U_2(pptr + 6), GET_U_1(pptr + 2),
                     GET_U_1(pptr + 3), GET_U_1(pptr + 4),
                     GET_U_1(pptr + 5), GET_BE_U_2(pptr + 6));
         break;
     default:
-        nd_snprintf(pos, sizeof(rd) - (pos - rd), "unknown RD format");
+        snprintf(pos, sizeof(rd) - (pos - rd), "unknown RD format");
         break;
     }
     pos += strlen(pos);
@@ -928,7 +928,7 @@ decode_labeled_vpn_prefix4(netdissect_options *ndo,
             ((0xff00 >> (plen % 8)) & 0xff);
     }
     /* the label may get offsetted by 4 bits so lets shift it right */
-    nd_snprintf(buf, buflen, "RD: %s, %s/%u, label:%u %s",
+    snprintf(buf, buflen, "RD: %s, %s/%u, label:%u %s",
                 bgp_vpn_rd_print(ndo, pptr+4),
                 ipaddr_string(ndo, (const u_char *)&addr),
                 plen,
@@ -980,7 +980,7 @@ decode_mdt_vpn_nlri(netdissect_options *ndo,
     /* MDT Group Address */
     ND_TCHECK_LEN(pptr, sizeof(nd_ipv4));
 
-    nd_snprintf(buf, buflen, "RD: %s, VPN IP Address: %s, MC Group Address: %s",
+    snprintf(buf, buflen, "RD: %s, VPN IP Address: %s, MC Group Address: %s",
                 bgp_vpn_rd_print(ndo, rd), ipaddr_string(ndo, vpn_ip), ipaddr_string(ndo, pptr));
 
     return MDT_VPN_NLRI_LEN + 1;
@@ -1022,7 +1022,7 @@ decode_multicast_vpn(netdissect_options *ndo,
     route_length = GET_U_1(pptr);
     pptr++;
 
-    nd_snprintf(buf, buflen, "Route-Type: %s (%u), length: %u",
+    snprintf(buf, buflen, "Route-Type: %s (%u), length: %u",
          tok2str(bgp_multicast_vpn_route_type_values,
                  "Unknown", route_type),
          route_type, route_length);
@@ -1031,7 +1031,7 @@ decode_multicast_vpn(netdissect_options *ndo,
     case BGP_MULTICAST_VPN_ROUTE_TYPE_INTRA_AS_I_PMSI:
         ND_TCHECK_LEN(pptr, BGP_VPN_RD_LEN);
         offset = (u_int)strlen(buf);
-        nd_snprintf(buf + offset, buflen - offset, ", RD: %s, Originator %s",
+        snprintf(buf + offset, buflen - offset, ", RD: %s, Originator %s",
                     bgp_vpn_rd_print(ndo, pptr),
                     bgp_vpn_ip_print(ndo, pptr + BGP_VPN_RD_LEN,
                                      (route_length - BGP_VPN_RD_LEN) << 3));
@@ -1039,7 +1039,7 @@ decode_multicast_vpn(netdissect_options *ndo,
     case BGP_MULTICAST_VPN_ROUTE_TYPE_INTER_AS_I_PMSI:
         ND_TCHECK_LEN(pptr, BGP_VPN_RD_LEN + 4);
         offset = (u_int)strlen(buf);
-        nd_snprintf(buf + offset, buflen - offset, ", RD: %s, Source-AS %s",
+        snprintf(buf + offset, buflen - offset, ", RD: %s, Source-AS %s",
         bgp_vpn_rd_print(ndo, pptr),
         as_printf(ndo, astostr, sizeof(astostr),
         GET_BE_U_4(pptr + BGP_VPN_RD_LEN)));
@@ -1048,7 +1048,7 @@ decode_multicast_vpn(netdissect_options *ndo,
     case BGP_MULTICAST_VPN_ROUTE_TYPE_S_PMSI:
         ND_TCHECK_LEN(pptr, BGP_VPN_RD_LEN);
         offset = (u_int)strlen(buf);
-        nd_snprintf(buf + offset, buflen - offset, ", RD: %s",
+        snprintf(buf + offset, buflen - offset, ", RD: %s",
                     bgp_vpn_rd_print(ndo, pptr));
         pptr += BGP_VPN_RD_LEN;
 
@@ -1057,14 +1057,14 @@ decode_multicast_vpn(netdissect_options *ndo,
 
         ND_TCHECK_LEN(pptr, addr_length);
         offset = (u_int)strlen(buf);
-        nd_snprintf(buf + offset, buflen - offset, ", Originator %s",
+        snprintf(buf + offset, buflen - offset, ", Originator %s",
                     bgp_vpn_ip_print(ndo, pptr, addr_length << 3));
         break;
 
     case BGP_MULTICAST_VPN_ROUTE_TYPE_SOURCE_ACTIVE:
         ND_TCHECK_LEN(pptr, BGP_VPN_RD_LEN);
         offset = (u_int)strlen(buf);
-        nd_snprintf(buf + offset, buflen - offset, ", RD: %s",
+        snprintf(buf + offset, buflen - offset, ", RD: %s",
                     bgp_vpn_rd_print(ndo, pptr));
         pptr += BGP_VPN_RD_LEN;
 
@@ -1075,7 +1075,7 @@ decode_multicast_vpn(netdissect_options *ndo,
     case BGP_MULTICAST_VPN_ROUTE_TYPE_SOURCE_TREE_JOIN:
         ND_TCHECK_LEN(pptr, BGP_VPN_RD_LEN + 4);
         offset = (u_int)strlen(buf);
-        nd_snprintf(buf + offset, buflen - offset, ", RD: %s, Source-AS %s",
+        snprintf(buf + offset, buflen - offset, ", RD: %s, Source-AS %s",
                     bgp_vpn_rd_print(ndo, pptr),
                     as_printf(ndo, astostr, sizeof(astostr),
                     GET_BE_U_4(pptr + BGP_VPN_RD_LEN)));
@@ -1137,7 +1137,7 @@ decode_labeled_vpn_l2(netdissect_options *ndo,
         /* assume AD-only with RD, BGPNH */
         ND_TCHECK_LEN(pptr, 12);
         buf[0] = '\0';
-        stringlen = nd_snprintf(buf, buflen, "RD: %s, BGPNH: %s",
+        stringlen = snprintf(buf, buflen, "RD: %s, BGPNH: %s",
                                 bgp_vpn_rd_print(ndo, pptr),
                                 ipaddr_string(ndo, pptr+8));
         UPDATE_BUF_BUFLEN(buf, buflen, stringlen);
@@ -1150,7 +1150,7 @@ decode_labeled_vpn_l2(netdissect_options *ndo,
 
         ND_TCHECK_LEN(pptr, 15);
         buf[0] = '\0';
-        stringlen = nd_snprintf(buf, buflen, "RD: %s, CE-ID: %u, Label-Block Offset: %u, Label Base %u",
+        stringlen = snprintf(buf, buflen, "RD: %s, CE-ID: %u, Label-Block Offset: %u, Label Base %u",
                                 bgp_vpn_rd_print(ndo, pptr),
                                 GET_BE_U_2(pptr + 8),
                                 GET_BE_U_2(pptr + 10),
@@ -1163,7 +1163,7 @@ decode_labeled_vpn_l2(netdissect_options *ndo,
         while (tlen != 0) {
             if (tlen < 3) {
                 if (buflen != 0) {
-                    stringlen=nd_snprintf(buf,buflen, "\n\t\tran past the end");
+                    stringlen=snprintf(buf,buflen, "\n\t\tran past the end");
                     UPDATE_BUF_BUFLEN(buf, buflen, stringlen);
                 }
                 return plen + 2;
@@ -1178,7 +1178,7 @@ decode_labeled_vpn_l2(netdissect_options *ndo,
             switch(tlv_type) {
             case 1:
                 if (buflen != 0) {
-                    stringlen=nd_snprintf(buf,buflen, "\n\t\tcircuit status vector (%u) length: %u: 0x",
+                    stringlen=snprintf(buf,buflen, "\n\t\tcircuit status vector (%u) length: %u: 0x",
                                           tlv_type,
                                           tlv_len);
                     UPDATE_BUF_BUFLEN(buf, buflen, stringlen);
@@ -1186,14 +1186,14 @@ decode_labeled_vpn_l2(netdissect_options *ndo,
                 while (ttlv_len != 0) {
                     if (tlen < 1) {
                         if (buflen != 0) {
-                            stringlen=nd_snprintf(buf,buflen, " (ran past the end)");
+                            stringlen=snprintf(buf,buflen, " (ran past the end)");
                             UPDATE_BUF_BUFLEN(buf, buflen, stringlen);
                         }
                         return plen + 2;
                     }
                     ND_TCHECK_1(pptr);
                     if (buflen != 0) {
-                        stringlen=nd_snprintf(buf,buflen, "%02x",
+                        stringlen=snprintf(buf,buflen, "%02x",
                                               GET_U_1(pptr));
                         pptr++;
                         UPDATE_BUF_BUFLEN(buf, buflen, stringlen);
@@ -1204,14 +1204,14 @@ decode_labeled_vpn_l2(netdissect_options *ndo,
                 break;
             default:
                 if (buflen != 0) {
-                    stringlen=nd_snprintf(buf,buflen, "\n\t\tunknown TLV #%u, length: %u",
+                    stringlen=snprintf(buf,buflen, "\n\t\tunknown TLV #%u, length: %u",
                                           tlv_type,
                                           tlv_len);
                     UPDATE_BUF_BUFLEN(buf, buflen, stringlen);
                 }
                 if (tlen < ttlv_len) {
                     if (buflen != 0) {
-                        stringlen=nd_snprintf(buf,buflen, " (ran past the end)");
+                        stringlen=snprintf(buf,buflen, " (ran past the end)");
                         UPDATE_BUF_BUFLEN(buf, buflen, stringlen);
                     }
                     return plen + 2;
@@ -1254,7 +1254,7 @@ decode_prefix6(netdissect_options *ndo,
         addr[plenbytes - 1] &=
             ((0xff00 >> (plen % 8)) & 0xff);
     }
-    nd_snprintf(buf, buflen, "%s/%u", ip6addr_string(ndo, (const u_char *)&addr), plen);
+    snprintf(buf, buflen, "%s/%u", ip6addr_string(ndo, (const u_char *)&addr), plen);
     return 1 + plenbytes;
 
 trunc:
@@ -1294,7 +1294,7 @@ decode_labeled_prefix6(netdissect_options *ndo,
             ((0xff00 >> (plen % 8)) & 0xff);
     }
     /* the label may get offsetted by 4 bits so lets shift it right */
-    nd_snprintf(buf, buflen, "%s/%u, label:%u %s",
+    snprintf(buf, buflen, "%s/%u, label:%u %s",
                 ip6addr_string(ndo, (const u_char *)&addr),
                 plen,
                 GET_BE_U_3(pptr + 1)>>4,
@@ -1335,7 +1335,7 @@ decode_labeled_vpn_prefix6(netdissect_options *ndo,
             ((0xff00 >> (plen % 8)) & 0xff);
     }
     /* the label may get offsetted by 4 bits so lets shift it right */
-    nd_snprintf(buf, buflen, "RD: %s, %s/%u, label:%u %s",
+    snprintf(buf, buflen, "RD: %s, %s/%u, label:%u %s",
                 bgp_vpn_rd_print(ndo, pptr+4),
                 ip6addr_string(ndo, (const u_char *)&addr),
                 plen,
@@ -1368,7 +1368,7 @@ decode_clnp_prefix(netdissect_options *ndo,
         addr[(plen + 7) / 8 - 1] &=
             ((0xff00 >> (plen % 8)) & 0xff);
     }
-    nd_snprintf(buf, buflen, "%s/%u",
+    snprintf(buf, buflen, "%s/%u",
                 isonsap_string(ndo, addr,(plen + 7) / 8),
                 plen);
 
@@ -1403,7 +1403,7 @@ decode_labeled_vpn_clnp_prefix(netdissect_options *ndo,
         addr[(plen + 7) / 8 - 1] &= ((0xff00 >> (plen % 8)) & 0xff);
     }
     /* the label may get offsetted by 4 bits so lets shift it right */
-    nd_snprintf(buf, buflen, "RD: %s, %s/%u, label:%u %s",
+    snprintf(buf, buflen, "RD: %s, %s/%u, label:%u %s",
                 bgp_vpn_rd_print(ndo, pptr+4),
                 isonsap_string(ndo, addr,(plen + 7) / 8),
                 plen,
index 0ce51144c6e8ed473deb0910a6d07a83a179c56f..1e4e1ae1bbf431b0f156dbef8e5bfbd21ade5da1 100644 (file)
@@ -301,16 +301,16 @@ cnfp_v5_print(netdissect_options *ndo, const u_char *cp)
                       GET_BE_U_4(nr->last_time)%1000);
 
                asbuf[0] = buf[0] = '\0';
-               nd_snprintf(buf, sizeof(buf), "/%u", GET_U_1(nr->src_mask));
-               nd_snprintf(asbuf, sizeof(asbuf), ":%u",
+               snprintf(buf, sizeof(buf), "/%u", GET_U_1(nr->src_mask));
+               snprintf(asbuf, sizeof(asbuf), ":%u",
                        GET_BE_U_2(nr->src_as));
                ND_PRINT("\n    %s%s%s:%u ",
                        intoa(GET_IPV4_TO_NETWORK_ORDER(nr->src_ina)),
                        buf, asbuf,
                        GET_BE_U_2(nr->srcport));
 
-               nd_snprintf(buf, sizeof(buf), "/%u", GET_U_1(nr->dst_mask));
-               nd_snprintf(asbuf, sizeof(asbuf), ":%u",
+               snprintf(buf, sizeof(buf), "/%u", GET_U_1(nr->dst_mask));
+               snprintf(asbuf, sizeof(asbuf), ":%u",
                         GET_BE_U_2(nr->dst_as));
                ND_PRINT("> %s%s%s:%u ",
                        intoa(GET_IPV4_TO_NETWORK_ORDER(nr->dst_ina)),
@@ -404,16 +404,16 @@ cnfp_v6_print(netdissect_options *ndo, const u_char *cp)
                       GET_BE_U_4(nr->last_time)%1000);
 
                asbuf[0] = buf[0] = '\0';
-               nd_snprintf(buf, sizeof(buf), "/%u", GET_U_1(nr->src_mask));
-               nd_snprintf(asbuf, sizeof(asbuf), ":%u",
+               snprintf(buf, sizeof(buf), "/%u", GET_U_1(nr->src_mask));
+               snprintf(asbuf, sizeof(asbuf), ":%u",
                        GET_BE_U_2(nr->src_as));
                ND_PRINT("\n    %s%s%s:%u ",
                        intoa(GET_IPV4_TO_NETWORK_ORDER(nr->src_ina)),
                        buf, asbuf,
                        GET_BE_U_2(nr->srcport));
 
-               nd_snprintf(buf, sizeof(buf), "/%u", GET_U_1(nr->dst_mask));
-               nd_snprintf(asbuf, sizeof(asbuf), ":%u",
+               snprintf(buf, sizeof(buf), "/%u", GET_U_1(nr->dst_mask));
+               snprintf(asbuf, sizeof(asbuf), ":%u",
                         GET_BE_U_2(nr->dst_as));
                ND_PRINT("> %s%s%s:%u ",
                        intoa(GET_IPV4_TO_NETWORK_ORDER(nr->dst_ina)),
@@ -444,7 +444,7 @@ cnfp_v6_print(netdissect_options *ndo, const u_char *cp)
                }
 
                buf[0]='\0';
-               nd_snprintf(buf, sizeof(buf), "(%u<>%u encaps)",
+               snprintf(buf, sizeof(buf), "(%u<>%u encaps)",
                         (GET_BE_U_2(nr->flags) >> 8) & 0xff,
                         (GET_BE_U_2(nr->flags)) & 0xff);
                ND_PRINT("tos %u, %u (%u octets) %s",
index e595067bb50521ec7155fcde126b4151c4f6d4c4..31166e3f31df60d09924d7563a332da562642760 100644 (file)
@@ -1245,7 +1245,7 @@ dnnum_string(netdissect_options *ndo, u_short dnaddr)
        str = (char *)malloc(siz = sizeof("00.0000"));
        if (str == NULL)
                (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC, "dnnum_string: malloc");
-       nd_snprintf(str, siz, "%u.%u", area, node);
+       snprintf(str, siz, "%u.%u", area, node);
        return(str);
 }
 
index 9a9273ec02dac2922772c897e6f973979a74f857..22561a23a62a0e72bf9f424a29cc5939a4ecbe97 100644 (file)
@@ -152,7 +152,7 @@ q922_string(netdissect_options *ndo, const u_char *p, u_int length)
     memset(buffer, 0, sizeof(buffer));
 
     if (parse_q922_header(ndo, p, &dlci, &addr_len, &flags, length) == 1){
-        nd_snprintf(buffer, sizeof(buffer), "DLCI %u", dlci);
+        snprintf(buffer, sizeof(buffer), "DLCI %u", dlci);
     }
 
     return buffer;
index 60a7ca9bd2de0b6171040b3d02d1e22dda4b6535..0593b65b9d2795e15dc43eb821de5efb9dd84a0b 100644 (file)
@@ -162,7 +162,7 @@ format_nid(netdissect_options *ndo, const u_char *data)
     static char buf[4][sizeof("01:01:01:01")];
     static int i = 0;
     i = (i + 1) % 4;
-    nd_snprintf(buf[i], sizeof(buf[i]), "%02x:%02x:%02x:%02x",
+    snprintf(buf[i], sizeof(buf[i]), "%02x:%02x:%02x:%02x",
              GET_U_1(data), GET_U_1(data + 1), GET_U_1(data + 2),
              GET_U_1(data + 3));
     return buf[i];
@@ -174,7 +174,7 @@ format_256(netdissect_options *ndo, const u_char *data)
     static char buf[4][sizeof("0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef")];
     static int i = 0;
     i = (i + 1) % 4;
-    nd_snprintf(buf[i], sizeof(buf[i]), "%016" PRIx64 "%016" PRIx64 "%016" PRIx64 "%016" PRIx64,
+    snprintf(buf[i], sizeof(buf[i]), "%016" PRIx64 "%016" PRIx64 "%016" PRIx64 "%016" PRIx64,
          GET_BE_U_8(data),
          GET_BE_U_8(data + 8),
          GET_BE_U_8(data + 16),
@@ -189,7 +189,7 @@ format_interval(const uint32_t n)
     static char buf[4][sizeof("0000000.000s")];
     static int i = 0;
     i = (i + 1) % 4;
-    nd_snprintf(buf[i], sizeof(buf[i]), "%u.%03us", n / 1000, n % 1000);
+    snprintf(buf[i], sizeof(buf[i]), "%u.%03us", n / 1000, n % 1000);
     return buf[i];
 }
 
@@ -227,7 +227,7 @@ print_prefix(netdissect_options *ndo, const u_char *prefix, u_int max_length)
                ((u_char *)&addr)[plenbytes - 1] &=
                        ((0xff00 >> (plen % 8)) & 0xff);
        }
-       nd_snprintf(buf, sizeof(buf), "%s/%u", ipaddr_string(ndo, (const u_char *)&addr), plen);
+       snprintf(buf, sizeof(buf), "%s/%u", ipaddr_string(ndo, (const u_char *)&addr), plen);
         plenbytes += 1 + IPV4_MAPPED_HEADING_LEN;
     } else {
         plenbytes = decode_prefix6(ndo, prefix, max_length, buf, sizeof(buf));
index c83c809d93cff867a418005e961c6ac426438fe2..8d7c3636799447b6c552721076a3acbe3503e880 100644 (file)
@@ -286,7 +286,7 @@ icmp_tstamp_print(u_int tstamp)
     sec = tstamp / 1000;
     min = sec / 60; sec -= min * 60;
     hrs = min / 60; min -= hrs * 60;
-    nd_snprintf(buf, sizeof(buf), "%02u:%02u:%02u.%03u",hrs,min,sec,msec);
+    snprintf(buf, sizeof(buf), "%02u:%02u:%02u.%03u",hrs,min,sec,msec);
     return buf;
 }
 
@@ -326,7 +326,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
        case ICMP_ECHO:
        case ICMP_ECHOREPLY:
                ND_TCHECK_2(dp->icmp_seq);
-               (void)nd_snprintf(buf, sizeof(buf), "echo %s, id %u, seq %u",
+               (void)snprintf(buf, sizeof(buf), "echo %s, id %u, seq %u",
                                icmp_type == ICMP_ECHO ?
                                "request" : "reply",
                                GET_BE_U_2(dp->icmp_id),
@@ -338,20 +338,20 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
                switch (icmp_code) {
 
                case ICMP_UNREACH_NET:
-                       (void)nd_snprintf(buf, sizeof(buf),
+                       (void)snprintf(buf, sizeof(buf),
                            "net %s unreachable",
                            ipaddr_string(ndo, dp->icmp_ip.ip_dst));
                        break;
 
                case ICMP_UNREACH_HOST:
-                       (void)nd_snprintf(buf, sizeof(buf),
+                       (void)snprintf(buf, sizeof(buf),
                            "host %s unreachable",
                            ipaddr_string(ndo, dp->icmp_ip.ip_dst));
                        break;
 
                case ICMP_UNREACH_PROTOCOL:
                        ND_TCHECK_1(dp->icmp_ip.ip_p);
-                       (void)nd_snprintf(buf, sizeof(buf),
+                       (void)snprintf(buf, sizeof(buf),
                            "%s protocol %u unreachable",
                            ipaddr_string(ndo, dp->icmp_ip.ip_dst),
                            GET_U_1(dp->icmp_ip.ip_p));
@@ -368,21 +368,21 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
                        switch (ip_proto) {
 
                        case IPPROTO_TCP:
-                               (void)nd_snprintf(buf, sizeof(buf),
+                               (void)snprintf(buf, sizeof(buf),
                                        "%s tcp port %s unreachable",
                                        ipaddr_string(ndo, oip->ip_dst),
                                        tcpport_string(ndo, dport));
                                break;
 
                        case IPPROTO_UDP:
-                               (void)nd_snprintf(buf, sizeof(buf),
+                               (void)snprintf(buf, sizeof(buf),
                                        "%s udp port %s unreachable",
                                        ipaddr_string(ndo, oip->ip_dst),
                                        udpport_string(ndo, dport));
                                break;
 
                        default:
-                               (void)nd_snprintf(buf, sizeof(buf),
+                               (void)snprintf(buf, sizeof(buf),
                                        "%s protocol %u port %u unreachable",
                                        ipaddr_string(ndo, oip->ip_dst),
                                        ip_proto, dport);
@@ -396,11 +396,11 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
                        mp = (const struct mtu_discovery *)(const u_char *)&dp->icmp_void;
                        mtu = GET_BE_U_2(mp->nexthopmtu);
                        if (mtu) {
-                               (void)nd_snprintf(buf, sizeof(buf),
+                               (void)snprintf(buf, sizeof(buf),
                                    "%s unreachable - need to frag (mtu %u)",
                                    ipaddr_string(ndo, dp->icmp_ip.ip_dst), mtu);
                        } else {
-                               (void)nd_snprintf(buf, sizeof(buf),
+                               (void)snprintf(buf, sizeof(buf),
                                    "%s unreachable - need to frag",
                                    ipaddr_string(ndo, dp->icmp_ip.ip_dst));
                        }
@@ -408,73 +408,73 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
                        break;
 
                case ICMP_UNREACH_SRCFAIL:
-                       (void)nd_snprintf(buf, sizeof(buf),
+                       (void)snprintf(buf, sizeof(buf),
                            "%s unreachable - source route failed",
                            ipaddr_string(ndo, dp->icmp_ip.ip_dst));
                        break;
 
                case ICMP_UNREACH_NET_UNKNOWN:
-                       (void)nd_snprintf(buf, sizeof(buf),
+                       (void)snprintf(buf, sizeof(buf),
                            "net %s unreachable - unknown",
                            ipaddr_string(ndo, dp->icmp_ip.ip_dst));
                        break;
 
                case ICMP_UNREACH_HOST_UNKNOWN:
-                       (void)nd_snprintf(buf, sizeof(buf),
+                       (void)snprintf(buf, sizeof(buf),
                            "host %s unreachable - unknown",
                            ipaddr_string(ndo, dp->icmp_ip.ip_dst));
                        break;
 
                case ICMP_UNREACH_ISOLATED:
-                       (void)nd_snprintf(buf, sizeof(buf),
+                       (void)snprintf(buf, sizeof(buf),
                            "%s unreachable - source host isolated",
                            ipaddr_string(ndo, dp->icmp_ip.ip_dst));
                        break;
 
                case ICMP_UNREACH_NET_PROHIB:
-                       (void)nd_snprintf(buf, sizeof(buf),
+                       (void)snprintf(buf, sizeof(buf),
                            "net %s unreachable - admin prohibited",
                            ipaddr_string(ndo, dp->icmp_ip.ip_dst));
                        break;
 
                case ICMP_UNREACH_HOST_PROHIB:
-                       (void)nd_snprintf(buf, sizeof(buf),
+                       (void)snprintf(buf, sizeof(buf),
                            "host %s unreachable - admin prohibited",
                            ipaddr_string(ndo, dp->icmp_ip.ip_dst));
                        break;
 
                case ICMP_UNREACH_TOSNET:
-                       (void)nd_snprintf(buf, sizeof(buf),
+                       (void)snprintf(buf, sizeof(buf),
                            "net %s unreachable - tos prohibited",
                            ipaddr_string(ndo, dp->icmp_ip.ip_dst));
                        break;
 
                case ICMP_UNREACH_TOSHOST:
-                       (void)nd_snprintf(buf, sizeof(buf),
+                       (void)snprintf(buf, sizeof(buf),
                            "host %s unreachable - tos prohibited",
                            ipaddr_string(ndo, dp->icmp_ip.ip_dst));
                        break;
 
                case ICMP_UNREACH_FILTER_PROHIB:
-                       (void)nd_snprintf(buf, sizeof(buf),
+                       (void)snprintf(buf, sizeof(buf),
                            "host %s unreachable - admin prohibited filter",
                            ipaddr_string(ndo, dp->icmp_ip.ip_dst));
                        break;
 
                case ICMP_UNREACH_HOST_PRECEDENCE:
-                       (void)nd_snprintf(buf, sizeof(buf),
+                       (void)snprintf(buf, sizeof(buf),
                            "host %s unreachable - host precedence violation",
                            ipaddr_string(ndo, dp->icmp_ip.ip_dst));
                        break;
 
                case ICMP_UNREACH_PRECEDENCE_CUTOFF:
-                       (void)nd_snprintf(buf, sizeof(buf),
+                       (void)snprintf(buf, sizeof(buf),
                            "host %s unreachable - precedence cutoff",
                            ipaddr_string(ndo, dp->icmp_ip.ip_dst));
                        break;
 
                default:
-                       (void)nd_snprintf(buf, sizeof(buf),
+                       (void)snprintf(buf, sizeof(buf),
                            "%s unreachable - #%u",
                            ipaddr_string(ndo, dp->icmp_ip.ip_dst),
                            icmp_code);
@@ -487,35 +487,35 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
                switch (icmp_code) {
 
                case ICMP_REDIRECT_NET:
-                       (void)nd_snprintf(buf, sizeof(buf),
+                       (void)snprintf(buf, sizeof(buf),
                            "redirect %s to net %s",
                            ipaddr_string(ndo, dp->icmp_ip.ip_dst),
                            ipaddr_string(ndo, dp->icmp_gwaddr));
                        break;
 
                case ICMP_REDIRECT_HOST:
-                       (void)nd_snprintf(buf, sizeof(buf),
+                       (void)snprintf(buf, sizeof(buf),
                            "redirect %s to host %s",
                            ipaddr_string(ndo, dp->icmp_ip.ip_dst),
                            ipaddr_string(ndo, dp->icmp_gwaddr));
                        break;
 
                case ICMP_REDIRECT_TOSNET:
-                       (void)nd_snprintf(buf, sizeof(buf),
+                       (void)snprintf(buf, sizeof(buf),
                            "redirect-tos %s to net %s",
                            ipaddr_string(ndo, dp->icmp_ip.ip_dst),
                            ipaddr_string(ndo, dp->icmp_gwaddr));
                        break;
 
                case ICMP_REDIRECT_TOSHOST:
-                       (void)nd_snprintf(buf, sizeof(buf),
+                       (void)snprintf(buf, sizeof(buf),
                            "redirect-tos %s to host %s",
                            ipaddr_string(ndo, dp->icmp_ip.ip_dst),
                            ipaddr_string(ndo, dp->icmp_gwaddr));
                        break;
 
                default:
-                       (void)nd_snprintf(buf, sizeof(buf),
+                       (void)snprintf(buf, sizeof(buf),
                            "redirect-#%u %s to %s", icmp_code,
                            ipaddr_string(ndo, dp->icmp_ip.ip_dst),
                            ipaddr_string(ndo, dp->icmp_gwaddr));
@@ -529,7 +529,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
                const struct id_rdiscovery *idp;
                u_int lifetime, num, size;
 
-               (void)nd_snprintf(buf, sizeof(buf), "router advertisement");
+               (void)snprintf(buf, sizeof(buf), "router advertisement");
                cp = buf + strlen(buf);
 
                ihp = (const struct ih_rdiscovery *)&dp->icmp_void;
@@ -538,13 +538,13 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
                cp = buf + strlen(buf);
                lifetime = GET_BE_U_2(ihp->ird_lifetime);
                if (lifetime < 60) {
-                       (void)nd_snprintf(cp, sizeof(buf) - (cp - buf), "%u",
+                       (void)snprintf(cp, sizeof(buf) - (cp - buf), "%u",
                            lifetime);
                } else if (lifetime < 60 * 60) {
-                       (void)nd_snprintf(cp, sizeof(buf) - (cp - buf), "%u:%02u",
+                       (void)snprintf(cp, sizeof(buf) - (cp - buf), "%u:%02u",
                            lifetime / 60, lifetime % 60);
                } else {
-                       (void)nd_snprintf(cp, sizeof(buf) - (cp - buf),
+                       (void)snprintf(cp, sizeof(buf) - (cp - buf),
                            "%u:%02u:%02u",
                            lifetime / 3600,
                            (lifetime % 3600) / 60,
@@ -553,19 +553,19 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
                cp = buf + strlen(buf);
 
                num = GET_U_1(ihp->ird_addrnum);
-               (void)nd_snprintf(cp, sizeof(buf) - (cp - buf), " %u:", num);
+               (void)snprintf(cp, sizeof(buf) - (cp - buf), " %u:", num);
                cp = buf + strlen(buf);
 
                size = GET_U_1(ihp->ird_addrsiz);
                if (size != 2) {
-                       (void)nd_snprintf(cp, sizeof(buf) - (cp - buf),
+                       (void)snprintf(cp, sizeof(buf) - (cp - buf),
                            " [size %u]", size);
                        break;
                }
                idp = (const struct id_rdiscovery *)&dp->icmp_data;
                while (num > 0) {
                        ND_TCHECK_SIZE(idp);
-                       (void)nd_snprintf(cp, sizeof(buf) - (cp - buf), " {%s %u}",
+                       (void)snprintf(cp, sizeof(buf) - (cp - buf), " {%s %u}",
                            ipaddr_string(ndo, idp->ird_addr),
                            GET_BE_U_4(idp->ird_pref));
                        cp = buf + strlen(buf);
@@ -588,7 +588,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
                        break;
 
                default:
-                       (void)nd_snprintf(buf, sizeof(buf), "time exceeded-#%u",
+                       (void)snprintf(buf, sizeof(buf), "time exceeded-#%u",
                            icmp_code);
                        break;
                }
@@ -596,11 +596,11 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
 
        case ICMP_PARAMPROB:
                if (icmp_code)
-                       (void)nd_snprintf(buf, sizeof(buf),
+                       (void)snprintf(buf, sizeof(buf),
                            "parameter problem - code %u", icmp_code);
                else {
                        ND_TCHECK_1(dp->icmp_pptr);
-                       (void)nd_snprintf(buf, sizeof(buf),
+                       (void)snprintf(buf, sizeof(buf),
                            "parameter problem - octet %u",
                            GET_U_1(dp->icmp_pptr));
                }
@@ -608,13 +608,13 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
 
        case ICMP_MASKREPLY:
                ND_TCHECK_4(dp->icmp_mask);
-               (void)nd_snprintf(buf, sizeof(buf), "address mask is 0x%08x",
+               (void)snprintf(buf, sizeof(buf), "address mask is 0x%08x",
                    GET_BE_U_4(dp->icmp_mask));
                break;
 
        case ICMP_TSTAMP:
                ND_TCHECK_2(dp->icmp_seq);
-               (void)nd_snprintf(buf, sizeof(buf),
+               (void)snprintf(buf, sizeof(buf),
                    "time stamp query id %u seq %u",
                    GET_BE_U_2(dp->icmp_id),
                    GET_BE_U_2(dp->icmp_seq));
@@ -622,15 +622,15 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
 
        case ICMP_TSTAMPREPLY:
                ND_TCHECK_4(dp->icmp_ttime);
-               (void)nd_snprintf(buf, sizeof(buf),
+               (void)snprintf(buf, sizeof(buf),
                    "time stamp reply id %u seq %u: org %s",
                                GET_BE_U_2(dp->icmp_id),
                                GET_BE_U_2(dp->icmp_seq),
                                icmp_tstamp_print(GET_BE_U_4(dp->icmp_otime)));
 
-                (void)nd_snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),", recv %s",
+                (void)snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),", recv %s",
                          icmp_tstamp_print(GET_BE_U_4(dp->icmp_rtime)));
-                (void)nd_snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),", xmit %s",
+                (void)snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),", xmit %s",
                          icmp_tstamp_print(GET_BE_U_4(dp->icmp_ttime)));
                 break;
 
index 1f0c24ba1b0ef6c96650a2f2a6a6dba718ed70d2..0178a3558213fc6373070aacebc1bb9898f06636 100644 (file)
@@ -758,7 +758,7 @@ get_lifetime(uint32_t v)
        if (v == (uint32_t)~0UL)
                return "infinity";
        else {
-               nd_snprintf(buf, sizeof(buf), "%us", v);
+               snprintf(buf, sizeof(buf), "%us", v);
                return buf;
        }
 }
index 4f4e30593bbe5d5c22bf757ac7c26e1f7f8536cb..24d92096a51e8ae7aec9b3c75fd64feea3157b26 100644 (file)
@@ -106,7 +106,7 @@ ipxaddr_string(netdissect_options *ndo, uint32_t net, const u_char *node)
 {
     static char line[256];
 
-    nd_snprintf(line, sizeof(line), "%08x.%02x:%02x:%02x:%02x:%02x:%02x",
+    snprintf(line, sizeof(line), "%08x.%02x:%02x:%02x:%02x:%02x:%02x",
            net, GET_U_1(node), GET_U_1(node + 1),
            GET_U_1(node + 2), GET_U_1(node + 3),
            GET_U_1(node + 4), GET_U_1(node + 5));
index 8c46bce4c894329d7a98eb3c2942fc4d96dc4537..b7b05116d08ce304936349e6def529ce4869cff1 100644 (file)
@@ -2820,7 +2820,7 @@ static char *
 numstr(u_int x)
 {
        static char buf[20];
-       nd_snprintf(buf, sizeof(buf), "#%u", x);
+       snprintf(buf, sizeof(buf), "#%u", x);
        return buf;
 }
 
index 96a16bc3155b84aa38520895eedf31175547eeae..6bbe75c39ed219bc0dcc94f3d37e9dccd28b2318 100644 (file)
@@ -1712,19 +1712,19 @@ isis_print_id(netdissect_options *ndo, const uint8_t *cp, u_int id_len)
     if (sysid_len > id_len)
         sysid_len = id_len;
     for (i = 1; i <= sysid_len; i++) {
-        nd_snprintf(pos, sizeof(id) - (pos - id), "%02x", GET_U_1(cp));
+        snprintf(pos, sizeof(id) - (pos - id), "%02x", GET_U_1(cp));
        cp++;
        pos += strlen(pos);
        if (i == 2 || i == 4)
            *pos++ = '.';
        }
     if (id_len >= NODE_ID_LEN) {
-        nd_snprintf(pos, sizeof(id) - (pos - id), ".%02x", GET_U_1(cp));
+        snprintf(pos, sizeof(id) - (pos - id), ".%02x", GET_U_1(cp));
        cp++;
        pos += strlen(pos);
     }
     if (id_len == LSP_ID_LEN)
-        nd_snprintf(pos, sizeof(id) - (pos - id), "-%02x", GET_U_1(cp));
+        snprintf(pos, sizeof(id) - (pos - id), "-%02x", GET_U_1(cp));
     return (id);
 }
 
@@ -1913,7 +1913,7 @@ isis_print_ext_is_reach(netdissect_options *ndo,
     if (subtlv_sum_len) {
         ND_PRINT(" (%u)", subtlv_sum_len);
         /* prepend the indent string */
-        nd_snprintf(ident_buffer, sizeof(ident_buffer), "%s  ",ident);
+        snprintf(ident_buffer, sizeof(ident_buffer), "%s  ",ident);
         ident = ident_buffer;
         while (subtlv_sum_len != 0) {
             ND_TCHECK_2(tptr);
@@ -2246,7 +2246,7 @@ isis_print_extd_ip_reach(netdissect_options *ndo,
             subtlvlen=GET_U_1(tptr + 1);
             tptr+=2;
             /* prepend the indent string */
-            nd_snprintf(ident_buffer, sizeof(ident_buffer), "%s  ",ident);
+            snprintf(ident_buffer, sizeof(ident_buffer), "%s  ",ident);
             if (!isis_print_ip_reach_subtlv(ndo, tptr, subtlvtype, subtlvlen, ident_buffer))
                 return(0);
             tptr+=subtlvlen;
index 9445f702f84868f3c8e185638230399f4f774e04..a578f4ea133b7fdebf6bc886acb1b55d53bcc219 100644 (file)
@@ -1360,10 +1360,10 @@ lldp_network_addr_print(netdissect_options *ndo, const u_char *tptr, u_int len)
     }
 
     if (!pfunc) {
-        nd_snprintf(buf, sizeof(buf), "AFI %s (%u), no AF printer !",
+        snprintf(buf, sizeof(buf), "AFI %s (%u), no AF printer !",
                  tok2str(af_values, "Unknown", af), af);
     } else {
-        nd_snprintf(buf, sizeof(buf), "AFI %s (%u): %s",
+        snprintf(buf, sizeof(buf), "AFI %s (%u): %s",
                  tok2str(af_values, "Unknown", af), af, (*pfunc)(ndo, tptr+1));
     }
 
index 76bbfd3e9914113e16b981ab564e84463d51a381..e660a706168c91eae3b8eba3f0cdc0ab1843f08c 100644 (file)
@@ -357,11 +357,11 @@ nfsreply_print(netdissect_options *ndo,
        ND_TCHECK_4(rp->rm_xid);
        if (!ndo->ndo_nflag) {
                strlcpy(srcid, "nfs", sizeof(srcid));
-               nd_snprintf(dstid, sizeof(dstid), "%u",
+               snprintf(dstid, sizeof(dstid), "%u",
                    GET_BE_U_4(rp->rm_xid));
        } else {
-               nd_snprintf(srcid, sizeof(srcid), "%u", NFS_PORT);
-               nd_snprintf(dstid, sizeof(dstid), "%u",
+               snprintf(srcid, sizeof(srcid), "%u", NFS_PORT);
+               snprintf(dstid, sizeof(dstid), "%u",
                    GET_BE_U_4(rp->rm_xid));
        }
        print_nfsaddr(ndo, bp2, srcid, dstid);
index 048031aa9b9e1221d22b9291c3428cd34c1358dc..4cf766bc6cb6f14c615be0d47626a8fb09e6f516 100644 (file)
@@ -700,7 +700,7 @@ vlan_str(const uint16_t vid)
 
        if (vid == OFP_VLAN_NONE)
                return "NONE";
-       nd_snprintf(buf, sizeof(buf), "%u%s", vid,
+       snprintf(buf, sizeof(buf), "%u%s", vid,
            (vid > 0 && vid < 0x0fff) ? "" : " (bogus)");
        return buf;
 }
@@ -709,7 +709,7 @@ static const char *
 pcp_str(const uint8_t pcp)
 {
        static char buf[sizeof("255 (bogus)")];
-       nd_snprintf(buf, sizeof(buf), "%u%s", pcp,
+       snprintf(buf, sizeof(buf), "%u%s", pcp,
            pcp <= 7 ? "" : " (bogus)");
        return buf;
 }
index 49e7a8cb87c04b99e01448ecee09b4eb298fa999..903b26f057c50fdd0e8bf0983c146c47574eb0a7 100644 (file)
@@ -1186,7 +1186,7 @@ acl_print(netdissect_options *ndo,
                  acl & PRSFS_ADMINISTER ? "a" : "");
 
        for (i = 0; i < pos; i++) {
-               nd_snprintf(fmt, sizeof(fmt), "%%%ds %%d\n%%n", maxsize - 1);
+               snprintf(fmt, sizeof(fmt), "%%%ds %%d\n%%n", maxsize - 1);
                if (sscanf((char *) s, fmt, user, &acl, &n) != 2)
                        goto finish;
                s += n;
@@ -1200,7 +1200,7 @@ acl_print(netdissect_options *ndo,
        }
 
        for (i = 0; i < neg; i++) {
-               nd_snprintf(fmt, sizeof(fmt), "%%%ds %%d\n%%n", maxsize - 1);
+               snprintf(fmt, sizeof(fmt), "%%%ds %%d\n%%n", maxsize - 1);
                if (sscanf((char *) s, fmt, user, &acl, &n) != 2)
                        goto finish;
                s += n;
index aa2974cc04ad8e1faa13afeb422c4673634b470f..6058294b59759138f1fe0075eedb082f956d13c2 100644 (file)
@@ -197,7 +197,7 @@ static const char *ErrorStatus[] = {
 #define DECODE_ErrorStatus(e) \
        ( e >= 0 && (size_t)e < sizeof(ErrorStatus)/sizeof(ErrorStatus[0]) \
                ? ErrorStatus[e] \
-               : (nd_snprintf(errbuf, sizeof(errbuf), "err=%u", e), errbuf))
+               : (snprintf(errbuf, sizeof(errbuf), "err=%u", e), errbuf))
 
 /*
  * generic-trap values in the SNMP Trap-PDU
@@ -215,7 +215,7 @@ static const char *GenericTrap[] = {
 #define DECODE_GenericTrap(t) \
        ( t >= 0 && (size_t)t < sizeof(GenericTrap)/sizeof(GenericTrap[0]) \
                ? GenericTrap[t] \
-               : (nd_snprintf(buf, sizeof(buf), "gt=%d", t), buf))
+               : (snprintf(buf, sizeof(buf), "gt=%d", t), buf))
 
 /*
  * ASN.1 type class table
index f87529f37d2217e834b682159be27fdbd40c408d..ce606d943b4ac49c2bf47a66fc517b4af9af9ed4 100644 (file)
@@ -91,7 +91,7 @@ stp_print_bridge_id(netdissect_options *ndo, const u_char *p)
 {
     static char bridge_id_str[sizeof("pppp.aa:bb:cc:dd:ee:ff")];
 
-    nd_snprintf(bridge_id_str, sizeof(bridge_id_str),
+    snprintf(bridge_id_str, sizeof(bridge_id_str),
              "%.2x%.2x.%.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
              GET_U_1(p), GET_U_1(p + 1), GET_U_1(p + 2),
              GET_U_1(p + 3), GET_U_1(p + 4), GET_U_1(p + 5),
index 773e8b563dd2d0f446e8e0c002ec322d1c53fa0b..94b867075b543d6ef7ca4a37a4270efbae6f2536 100644 (file)
@@ -172,13 +172,13 @@ sunrpc_print(netdissect_options *ndo, const u_char *bp,
        ND_TCHECK_SIZE(rp);
 
        if (!ndo->ndo_nflag) {
-               nd_snprintf(srcid, sizeof(srcid), "0x%x",
+               snprintf(srcid, sizeof(srcid), "0x%x",
                    GET_BE_U_4(rp->rm_xid));
                strlcpy(dstid, "sunrpc", sizeof(dstid));
        } else {
-               nd_snprintf(srcid, sizeof(srcid), "0x%x",
+               snprintf(srcid, sizeof(srcid), "0x%x",
                    GET_BE_U_4(rp->rm_xid));
-               nd_snprintf(dstid, sizeof(dstid), "0x%x", SUNRPC_PMAPPORT);
+               snprintf(dstid, sizeof(dstid), "0x%x", SUNRPC_PMAPPORT);
        }
 
        switch (IP_V((const struct ip *)bp2)) {
@@ -240,7 +240,7 @@ progstr(uint32_t prog)
        rp = getrpcbynumber(prog);
        if (rp == NULL)
 #endif
-               (void) nd_snprintf(buf, sizeof(buf), "#%u", prog);
+               (void) snprintf(buf, sizeof(buf), "#%u", prog);
 #if defined(HAVE_GETRPCBYNUMBER) && defined(HAVE_RPC_RPC_H)
        else
                strlcpy(buf, rp->r_name, sizeof(buf));
index f2ff1389f17d4b0a6e326cf16050655502caa481..8dd5f2d62ca7b053863879467388a2da6ec6524d 100644 (file)
@@ -381,7 +381,7 @@ numstr(int x)
 {
        static char buf[20];
 
-       nd_snprintf(buf, sizeof(buf), "%#x", x);
+       snprintf(buf, sizeof(buf), "%#x", x);
        return buf;
 }
 
index d2fbf4d05346d471d9276fc591f141f28099548b..10aaf2166ce99aaa269bfcaee187096775c44c4c 100644 (file)
@@ -119,7 +119,7 @@ z_triple(const char *class, const char *inst, const char *recipient)
 {
     if (!*recipient)
        recipient = "*";
-    nd_snprintf(z_buf, sizeof(z_buf), "<%s,%s,%s>", class, inst, recipient);
+    snprintf(z_buf, sizeof(z_buf), "<%s,%s,%s>", class, inst, recipient);
     z_buf[sizeof(z_buf)-1] = '\0';
     return z_buf;
 }
index 527f31a47874cf4ed32157262becf00ec2874f76..63a36860ded0e011a0dcfdc701e0b7a7dc435a52 100644 (file)
--- a/smbutil.c
+++ b/smbutil.c
@@ -1074,17 +1074,17 @@ smb_errstr(int class, int num)
                const err_code_struct *err = err_classes[i].err_msgs;
                for (j = 0; err[j].name; j++)
                    if (num == err[j].code) {
-                       nd_snprintf(ret, sizeof(ret), "%s - %s (%s)",
+                       snprintf(ret, sizeof(ret), "%s - %s (%s)",
                            err_classes[i].class, err[j].name, err[j].message);
                        return ret;
                    }
            }
 
-           nd_snprintf(ret, sizeof(ret), "%s - %d", err_classes[i].class, num);
+           snprintf(ret, sizeof(ret), "%s - %d", err_classes[i].class, num);
            return ret;
        }
 
-    nd_snprintf(ret, sizeof(ret), "ERROR: Unknown error (%d,%d)", class, num);
+    snprintf(ret, sizeof(ret), "ERROR: Unknown error (%d,%d)", class, num);
     return(ret);
 }
 
@@ -1965,6 +1965,6 @@ nt_errstr(uint32_t err)
            return nt_errors[i].name;
     }
 
-    nd_snprintf(ret, sizeof(ret), "0x%08x", err);
+    snprintf(ret, sizeof(ret), "0x%08x", err);
     return ret;
 }
index e8394c0ba1bb0c808dc53314a30f6790ca4b29da..b0779a7cff45bd326818886d7bcaf3f1b71655cd 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -844,7 +844,7 @@ MakeFilename(char *buffer, char *orig_name, int cnt, int max_chars)
        if (cnt == 0 && max_chars == 0)
                strncpy(buffer, filename, PATH_MAX + 1);
        else
-               if (nd_snprintf(buffer, PATH_MAX + 1, "%s%0*d", filename, max_chars, cnt) > PATH_MAX)
+               if (snprintf(buffer, PATH_MAX + 1, "%s%0*d", filename, max_chars, cnt) > PATH_MAX)
                   /* Report an error if the filename is too large */
                   error("too many output files or filename is too long (> %d)", PATH_MAX);
         free(filename);
@@ -1343,7 +1343,7 @@ open_interface(const char *device, netdissect_options *ndo, char *ebuf)
                        /*
                         * Return an error for our caller to handle.
                         */
-                       nd_snprintf(ebuf, PCAP_ERRBUF_SIZE, "%s: %s\n(%s)",
+                       snprintf(ebuf, PCAP_ERRBUF_SIZE, "%s: %s\n(%s)",
                            device, pcap_statustostr(status), cp);
                        pcap_close(pc);
                        return (NULL);
@@ -1357,7 +1357,7 @@ open_interface(const char *device, netdissect_options *ndo, char *ebuf)
                        char sysctl[32];
                        size_t s = sizeof(parent);
 
-                       nd_snprintf(sysctl, sizeof(sysctl),
+                       snprintf(sysctl, sizeof(sysctl),
                            "net.wlan.%d.%%parent", atoi(device + 4));
                        sysctlbyname(sysctl, parent, &s, NULL, 0);
                        strlcpy(newdev, device, sizeof(newdev));
index e896a2df77784cbe45e85cf01cfbbfbfdd5230d5..c60cc93b263165609256473d947fa539ee42fcd8 100644 (file)
@@ -507,7 +507,7 @@ tok2strbuf(const struct tok *lp, const char *fmt,
        if (fmt == NULL)
                fmt = "#%d";
 
-       (void)nd_snprintf(buf, bufsize, fmt, v);
+       (void)snprintf(buf, bufsize, fmt, v);
        return (const char *)buf;
 }
 
@@ -579,7 +579,7 @@ bittok2str_internal(const struct tok *lp, const char *fmt,
 
         if (bufp == buf)
             /* bummer - lets print the "unknown" message as advised in the fmt string if we got one */
-            (void)nd_snprintf(buf, sizeof(buf), fmt == NULL ? "#%08x" : fmt, v);
+            (void)snprintf(buf, sizeof(buf), fmt == NULL ? "#%08x" : fmt, v);
         return (buf);
 }
 
@@ -621,7 +621,7 @@ tok2strary_internal(const char **lp, int n, const char *fmt,
                return lp[v];
        if (fmt == NULL)
                fmt = "#%d";
-       (void)nd_snprintf(buf, sizeof(buf), fmt, v);
+       (void)snprintf(buf, sizeof(buf), fmt, v);
        return (buf);
 }