tools/udpTools/udpClientEtherInfo.c
/*
 * Convert a token value to a string; use "fmt" if not found.
 */
Convert a token value to a string; use "fmt" if not found.
Convert a token value to a string ; use " fmt " if not found .
const char *tok2strbuf(register const struct tok *lp, register const char *fmt, register u_int v, char *buf, size_t bufsize) {
  if (lp != NULL) {
    while (lp->s != NULL) {
      if (lp->v == v) {
        return (lp->s);
      }
      ++lp;
    }
  }
  if (fmt == NULL)
    fmt = "#%d";
  (void)snprintf(buf, bufsize, fmt, v);
  return (const char *)buf;
}
const char * tok2strbuf ( register const struct tok * lp , register const char * fmt , register u_int v , char * buf , size_t bufsize ) { if ( lp != NULL ) { while ( lp -> s != NULL ) { if ( lp -> v == v ) { return ( lp -> s ) ; } ++ lp ; } } if ( fmt == NULL ) fmt = " " ; ( void ) snprintf ( buf , bufsize , fmt , v ) ; return ( const char * ) buf ; }
Convert a token value to a string; use "fmt" if not found.
Convert a token value to a string ; use " fmt " if not found .