char *buf, size_t bufsize);
/* tok2str is deprecated */
-extern const char *tok2str(const struct tok *, const char *, int);
-extern char *bittok2str(const struct tok *, const char *, int);
-extern char *bittok2str_nosep(const struct tok *, const char *, int);
+extern const char *tok2str(const struct tok *, const char *, u_int);
+extern char *bittok2str(const struct tok *, const char *, u_int);
+extern char *bittok2str_nosep(const struct tok *, const char *, u_int);
typedef struct netdissect_options netdissect_options;
extern int fn_print(netdissect_options *, const u_char *, const u_char *);
extern int fn_printn(netdissect_options *, const u_char *, u_int, const u_char *);
extern int fn_printzp(netdissect_options *, const u_char *, u_int, const u_char *);
-extern const char *tok2str(const struct tok *, const char *, int);
/*
* Flags for txtproto_print().
*/
const char *
tok2str(register const struct tok *lp, register const char *fmt,
- register int v)
+ register u_int v)
{
static char buf[4][128];
static int idx = 0;
*/
static char *
bittok2str_internal(register const struct tok *lp, register const char *fmt,
- register int v, register int sep)
+ register u_int v, const char *sep)
{
static char buf[256]; /* our stringbuffer */
int buflen=0;
- register int rotbit; /* this is the bit we rotate through all bitpositions */
- register int tokval;
+ register u_int rotbit; /* this is the bit we rotate through all bitpositions */
+ register u_int tokval;
const char * sepstr = "";
while (lp != NULL && lp->s != NULL) {
/* ok we have found something */
buflen+=snprintf(buf+buflen, sizeof(buf)-buflen, "%s%s",
sepstr, lp->s);
- sepstr = sep ? ", " : "";
+ sepstr = sep;
break;
}
rotbit=rotbit<<1; /* no match - lets shift and try again */
if (buflen == 0)
/* bummer - lets print the "unknown" message as advised in the fmt string if we got one */
- (void)snprintf(buf, sizeof(buf), fmt == NULL ? "#%d" : fmt, v);
+ (void)snprintf(buf, sizeof(buf), fmt == NULL ? "#%08x" : fmt, v);
return (buf);
}
*/
char *
bittok2str_nosep(register const struct tok *lp, register const char *fmt,
- register int v)
+ register u_int v)
{
- return (bittok2str_internal(lp, fmt, v, 0));
+ return (bittok2str_internal(lp, fmt, v, ""));
}
/*
*/
char *
bittok2str(register const struct tok *lp, register const char *fmt,
- register int v)
+ register u_int v)
{
- return (bittok2str_internal(lp, fmt, v, 1));
+ return (bittok2str_internal(lp, fmt, v, ", "));
}
/*