X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/7086ee95576e95aec1b54ad73c6fa6ead9186a3d..0860f098b5a13f4e8bedb2d2da9d2df94717b4a5:/sbr/fmt_compile.c diff --git a/sbr/fmt_compile.c b/sbr/fmt_compile.c index 75adc08e..200d738d 100644 --- a/sbr/fmt_compile.c +++ b/sbr/fmt_compile.c @@ -159,6 +159,7 @@ static struct ftable functable[] = { { "decodecomp", TF_COMP, FT_LS_DECODECOMP, 0, TFL_PUTS }, { "decode", TF_EXPR, FT_LS_DECODE, 0, TFL_PUTS }, { "trim", TF_EXPR, FT_LS_TRIM, 0, 0 }, + { "units", TF_EXPR, FT_LS_UNITS, 0, TFL_PUTS }, { "compval", TF_COMP, FT_LV_COMP, 0, TFL_PUTN }, { "compflag", TF_COMP, FT_LV_COMPFLAG, 0, TFL_PUTN }, { "num", TF_NUM, FT_LV_LIT, 0, TFL_PUTN }, @@ -364,11 +365,7 @@ compile_error(char *str, char *cp) usr_fstring[errpos] = '\0'; for (i = errpos-errctx; i < errpos; i++) { -#ifdef LOCALE if (iscntrl((unsigned char) usr_fstring[i])) -#else - if (usr_fstring[i] < 32) -#endif usr_fstring[i] = '_'; } @@ -1091,6 +1088,25 @@ fmt_appendcomp(int bucket, char *component, char *text) } } +/* + * Iterate over our component hash table + */ + +struct comp * +fmt_nextcomp(struct comp *comp, unsigned int *bucket) +{ + if (comp == NULL) + *bucket = 0; + else + comp = comp->c_next; + + while (comp == NULL && *bucket < sizeof(wantcomp)/sizeof(wantcomp[0])) { + comp = wantcomp[(*bucket)++]; + } + + return comp; +} + /* * Free and reset our component hash table */