#include <h/fmt_compile.h>
#include <h/scansbr.h>
-static struct swit switches[] = {
-#define FORMSW 0
- { "form formatfile", 0 },
-#define FMTSW 1
- { "format string", 5 },
-#define VERSIONSW 2
- { "version", 0 },
-#define HELPSW 3
- { "help", 0 },
- { NULL, 0 }
-};
+#define FMTDUMP_SWITCHES \
+ X("form formatfile", 0, FORMSW) \
+ X("format string", 5, FMTSW) \
+ X("version", 0, VERSIONSW) \
+ X("help", 0, HELPSW) \
+
+#define X(sw, minchars, id) id,
+DEFINE_SWITCH_ENUM(FMTDUMP);
+#undef X
+
+#define X(sw, minchars, id) { sw, minchars, id },
+DEFINE_SWITCH_ARRAY(FMTDUMP, switches);
+#undef X
/* for assignlabel */
static struct format *lvec[128];
char buf[BUFSIZ], *nfs, **argp, **arguments;
struct format *fmt;
-#ifdef LOCALE
- setlocale(LC_ALL, "");
-#endif
- invo_name = r1bindex (argv[0], '/');
-
- /* read user profile/context */
- context_read();
+ if (nmh_init(argv[0], 2)) { return 1; }
arguments = getarguments (invo_name, argc, argv, 1);
argp = arguments;
fmt_dump(fmt);
- fmt_free(fmt);
+ fmt_free(fmt, 1);
done(0);
return 1;
fmt_dump (struct format *fmth)
{
int i;
- register struct format *fmt, *addr;
+ struct format *fmt, *addr;
/* Assign labels */
for (fmt = fmth; fmt; ++fmt) {
static void
dumpone(struct format *fmt)
{
- register int i;
+ int i;
if ((i = findlabel(fmt)) >= 0)
printf("L%d:", i);
case FT_LS_FRIENDLY:
case FT_PARSEADDR:
case FT_MYMBOX:
+ case FT_GETMYMBOX:
+ case FT_GETMYADDR:
printf(", c_name ");
litputs(fmt->f_comp->c_name);
if (fmt->f_comp->c_type)
case FT_LV_LIT:
case FT_LV_PLUS_L:
case FT_LV_MINUS_L:
+ case FT_LV_MULTIPLY_L:
case FT_LV_DIVIDE_L:
case FT_LV_MODULO_L:
printf(" value %d", fmt->f_value);
static int
findlabel(struct format *addr)
{
- register int i;
+ int i;
for (i = 0; i < lused; ++i)
if (addr == lvec[i])
case FT_LV_STRLEN: return("LV_STRLEN");
case FT_LV_PLUS_L: return("LV_PLUS_L");
case FT_LV_MINUS_L: return("LV_MINUS_L");
+ case FT_LV_MULTIPLY_L: return("LV_MULTIPLY_L");
case FT_LV_DIVIDE_L: return("LV_DIVIDE_L");
case FT_LV_MODULO_L: return("LV_MODULO_L");
case FT_LV_CHAR_LEFT: return("LV_CHAR_LEFT");
+ case FT_LS_KILO: return("LS_KILO");
+ case FT_LS_KIBI: return("LS_KIBI");
case FT_LS_MONTH: return("LS_MONTH");
case FT_LS_LMONTH: return("LS_LMONTH");
case FT_LS_ZONE: return("LS_ZONE");
case FT_FORMATADDR: return("FORMATADDR");
case FT_CONCATADDR: return("CONCATADDR");
case FT_MYMBOX: return("MYMBOX");
-#ifdef FT_ADDTOSEQ
- case FT_ADDTOSEQ: return("ADDTOSEQ");
-#endif
+ case FT_GETMYMBOX: return("GETMYMBOX");
+ case FT_GETMYADDR: return("GETMYADDR");
case FT_SAVESTR: return("SAVESTR");
#ifdef FT_PAUSE
case FT_PAUSE: return ("PAUSE");
static char *
c_typestr(int t)
{
- register int i;
+ int i;
static char buf[64];
buf[0] = '\0';
static char *
c_flagsstr(int t)
{
- register int i;
+ int i;
static char buf[64];
buf[0] = '\0';