here is setterm and a gratituos question
Rob Landley
rob at landley.net
Mon Sep 5 04:13:06 UTC 2005
On Sunday 04 September 2005 22:06, Rob Landley wrote:
> Well, really simply:
>
> #define LOOKUP_STRING(x) bb_translatable_strings[x]
> const char *bb_translatable_strings[] = {
> "My hovercraft is full of eels\n",
> #define STR_HOVERCRAFT LOOKUP_STRING(0)
> "I vill not buy this tobacconist, eet is scratched.\n",
> #define STR_TOBACCONIST LOOKUP_STRING(1)
> "etc..."
> }
>
> There's probably a better way to do that, but you get the idea.
Possibly...
#define INCREMENT(x) x+1
const char *bb_translatable_strings[] = {
"My hovercraft is full of eels\n",
#define STR_HOVERCRAFT bb_translatable_strings
"I vill not buy this tobacconist, eet is scratched.\n",
#define STR_TOBACCONIST INCREMENT(STR_HOVERCRAFT)
0
#define STR_END INCREMENT(STR_TOBACCONIST)
}
#define CHECK_END bb_translatable_strings + \
sizeof(bb_translatable_strings)/sizeof(char *) - 1
#if STR_END != CHECK_END
#error bb_translatable_strings is horked.
#endif
Thingy?
Rob
More information about the busybox
mailing list