#include #include #include "fixed-ctype.h" #include "format.h" typedef struct priv PRIV; struct priv { unsigned char *buf; int len; int buflen; } ; static void force(void **privvp) { PRIV *p; p = malloc(sizeof(PRIV)); p->len = 0; p->buflen = 64; p->buf = malloc(p->buflen); *privvp = p; } static int hdrtest(const char *line __attribute__((__unused__)), void **privvp __attribute__((__unused__))) { return(0); } static int getx(const char *l, PRIV *p, int maxn) { unsigned int v; int i; for (i=0;(maxn<1)||(ilen >= p->buflen) p->buf = realloc(p->buf,p->buflen=p->len+64); p->buf[p->len++] = v; l += 2; } return(i); } static void line(const char *l, void *pvp) { PRIV *p; p = pvp; if (!l || !getx(l,p,0)) { if (p->len > 0) dumpit(p->buf,p->len); p->len = 0; if (l) printf("%s\n",l); } } FORMAT format_raw = { "raw", hdrtest, force, line };