Commit 088db3cf authored by Cedric Roux's avatar Cedric Roux

new function PUTX2 to display an int as an 8 bits hexadecimal

parent bbcfd004
...@@ -190,6 +190,13 @@ void PUTI(OBUF *o, int i) ...@@ -190,6 +190,13 @@ void PUTI(OBUF *o, int i)
PUTS(o, s); PUTS(o, s);
} }
void PUTX2(OBUF *o, int i)
{
char s[64];
sprintf(s, "%2.2x", i);
PUTS(o, s);
}
void PUTUL(OBUF *o, unsigned long l) void PUTUL(OBUF *o, unsigned long l)
{ {
char s[128]; char s[128];
......
...@@ -44,6 +44,7 @@ void PUTC(OBUF *o, char c); ...@@ -44,6 +44,7 @@ void PUTC(OBUF *o, char c);
void PUTS(OBUF *o, char *s); void PUTS(OBUF *o, char *s);
void PUTS_CLEAN(OBUF *o, char *s); void PUTS_CLEAN(OBUF *o, char *s);
void PUTI(OBUF *o, int i); void PUTI(OBUF *o, int i);
void PUTX2(OBUF *o, int i);
void PUTUL(OBUF *o, unsigned long i); void PUTUL(OBUF *o, unsigned long i);
#endif /* _UTILS_H_ */ #endif /* _UTILS_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment