X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Ffmtdump.c;h=a590a0063529bdff1b52c222a3d06a7d076a48a2;hp=89e70ef666bc679f404fee0e20d3644013de63ef;hb=d8916ff5d389de5ab225cd6f40aeda1b285d0f28;hpb=1691e80890e5d8ba258c51c214a3e91880e1db2b diff --git a/uip/fmtdump.c b/uip/fmtdump.c index 89e70ef..a590a00 100644 --- a/uip/fmtdump.c +++ b/uip/fmtdump.c @@ -3,6 +3,10 @@ * fmtdump.c -- compile format file and dump out instructions * * $Id$ + * + * This code is Copyright (c) 2002, by the authors of nmh. See the + * COPYRIGHT file in the root directory of the nmh distribution for + * complete copyright information. */ #include @@ -18,13 +22,13 @@ static struct swit switches[] = { #define VERSIONSW 2 { "version", 0 }, #define HELPSW 3 - { "help", 4 }, + { "help", 0 }, { NULL, 0 } }; /* for assignlabel */ static struct format *lvec[128]; -static lused = 0; +static int lused = 0; /* * static prototypes @@ -35,6 +39,7 @@ static int findlabel(struct format *); static void assignlabel(struct format *); static char *f_typestr(int); static char *c_typestr(int); +static char *c_flagsstr(int); static void litputs(char *); static void litputc(char); @@ -102,6 +107,7 @@ main (int argc, char **argv) fmt_dump(fmt); done(0); + return 1; } static void @@ -159,7 +165,7 @@ dumpone(struct format *fmt) if (fmt->f_comp->c_type) printf(", c_type %s", c_typestr(fmt->f_comp->c_type)); if (fmt->f_comp->c_flags) - printf(", c_flags %d", fmt->f_comp->c_flags); + printf(", c_flags %s", c_flagsstr(fmt->f_comp->c_flags)); break; case FT_LV_SEC: @@ -191,7 +197,7 @@ dumpone(struct format *fmt) if (fmt->f_comp->c_type) printf(", c_type %s", c_typestr(fmt->f_comp->c_type)); if (fmt->f_comp->c_flags) - printf(", c_flags %d", fmt->f_comp->c_flags); + printf(", c_flags %s", c_flagsstr(fmt->f_comp->c_flags)); break; case FT_LS_ADDR: @@ -213,7 +219,7 @@ dumpone(struct format *fmt) if (fmt->f_comp->c_type) printf(", c_type %s", c_typestr(fmt->f_comp->c_type)); if (fmt->f_comp->c_flags) - printf(", c_flags %d", fmt->f_comp->c_flags); + printf(", c_flags %s", c_flagsstr(fmt->f_comp->c_flags)); break; case FT_COMPF: @@ -224,7 +230,7 @@ dumpone(struct format *fmt) if (fmt->f_comp->c_type) printf(", c_type %s", c_typestr(fmt->f_comp->c_type)); if (fmt->f_comp->c_flags) - printf(", c_flags %d", fmt->f_comp->c_flags); + printf(", c_flags %s", c_flagsstr(fmt->f_comp->c_flags)); break; case FT_STRF: @@ -448,19 +454,35 @@ c_typestr(int t) static char buf[64]; buf[0] = '\0'; - if (t & ~(CT_ADDR|CT_DATE|CT_MYMBOX|CT_ADDRPARSE)) + if (t & ~(CT_ADDR|CT_DATE)) printf(buf, "0x%x ", t); strcat(buf, "<"); i = 0; FNORD(CT_ADDR, "ADDR"); FNORD(CT_DATE, "DATE"); - FNORD(CT_MYMBOX, "MYMBOX"); - FNORD(CT_ADDRPARSE, "ADDRPARSE"); strcat(buf, ">"); return(buf); -#undef FNORD } +static char * +c_flagsstr(int t) +{ + register int i; + static char buf[64]; + + buf[0] = '\0'; + if (t & ~(CF_TRUE|CF_PARSED|CF_DATEFAB)) + printf(buf, "0x%x ", t); + strcat(buf, "<"); + i = 0; + FNORD(CF_TRUE, "TRUE"); + FNORD(CF_PARSED, "PARSED"); + FNORD(CF_DATEFAB, "DATEFAB"); + strcat(buf, ">"); + return(buf); +} +#undef FNORD + static void litputs(char *s) {