diff --git a/funcs.c b/funcs.c index 70edb1b..bd0124a 100644 --- a/funcs.c +++ b/funcs.c @@ -38,7 +38,7 @@ #endif #endif -__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.271 2015/04/29 20:44:34 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.272 2015/05/01 23:16:29 tg Exp $"); #if HAVE_KILLPG /* @@ -3424,7 +3424,27 @@ ptest_error(Test_env *te, int ofs, const char *msg) # error nonsensical v ulimit #endif +struct limits { + /* limit resource */ + int resource; + /* multiply by to get rlim_{cur,max} values */ + unsigned int factor; + /* getopts char */ + char optchar; + /* limit name */ + char name[1]; +}; + #define RLIMITS_DEFNS +#define FN(lname,lid,lfac,lopt) \ + static const struct { \ + int resource; \ + unsigned int factor; \ + char optchar; \ + char name[sizeof(lname)]; \ + } rlimits_ ## lid = { \ + lid, lfac, lopt, lname \ + }; #include "rlimits.gen" static void print_ulimit(const struct limits *, int); diff --git a/misc.c b/misc.c index 4a8d31e..82f57ee 100644 --- a/misc.c +++ b/misc.c @@ -30,7 +30,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.231 2015/04/29 20:21:35 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.232 2015/05/01 23:16:30 tg Exp $"); #define KSH_CHVT_FLAG #ifdef MKSH_SMALL @@ -122,6 +122,17 @@ Xcheck_grow(XString *xsp, const char *xp, size_t more) #define SHFLAGS_DEFNS +#define FN(sname,cname,flags,ochar) \ + static const struct { \ + /* character flag (if any) */ \ + char c; \ + /* OF_* */ \ + unsigned char optflags; \ + /* long name of option */ \ + char name[sizeof(sname)]; \ + } shoptione_ ## cname = { \ + ochar, flags, sname \ + }; #include "sh_flags.gen" #define OFC(i) (options[i][-2]) diff --git a/rlimits.opt b/rlimits.opt index d8042ba..3759da8 100644 --- a/rlimits.opt +++ b/rlimits.opt @@ -1,27 +1,7 @@ @RLIMITS_DEFNS -__RCSID("$MirOS: src/bin/mksh/rlimits.opt,v 1.1 2013/11/17 22:21:18 tg Exp $"); -struct limits { - /* limit resource */ - int resource; - /* multiply by to get rlim_{cur,max} values */ - unsigned int factor; - /* getopts char */ - char optchar; - /* limit name */ - char name[1]; -}; -#define FN(lname,lid,lfac,lopt) \ - static const struct { \ - int resource; \ - unsigned int factor; \ - char optchar; \ - char name[sizeof(lname)]; \ - } rlimits_ ## lid = { \ - lid, lfac, lopt, lname \ - }; +__RCSID("$MirOS: src/bin/mksh/rlimits.opt,v 1.2 2015/05/01 23:16:31 tg Exp $"); @RLIMITS_ITEMS -#define FN(lname,lid,lfac,lopt) \ - (const struct limits *)(&rlimits_ ## lid), +#define FN(lname,lid,lfac,lopt) (const struct limits *)(&rlimits_ ## lid), @@ /* generic options for the ulimit builtin */ diff --git a/sh_flags.opt b/sh_flags.opt index ef64580..1d592c5 100644 --- a/sh_flags.opt +++ b/sh_flags.opt @@ -1,22 +1,10 @@ @SHFLAGS_DEFNS -__RCSID("$MirOS: src/bin/mksh/sh_flags.opt,v 1.2 2014/06/09 12:28:19 tg Exp $"); -#define FN(sname,cname,flags,ochar) \ - static const struct { \ - /* character flag (if any) */ \ - char c; \ - /* OF_* */ \ - unsigned char optflags; \ - /* long name of option */ \ - char name[sizeof(sname)]; \ - } shoptione_ ## cname = { \ - ochar, flags, sname \ - }; +__RCSID("$MirOS: src/bin/mksh/sh_flags.opt,v 1.3 2015/05/01 23:16:31 tg Exp $"); @SHFLAGS_ENUMS #define FN(sname,cname,flags,ochar) cname, #define F0(sname,cname,flags,ochar) cname = 0, @SHFLAGS_ITEMS -#define FN(sname,cname,flags,ochar) \ - ((const char *)(&shoptione_ ## cname)) + 2, +#define FN(sname,cname,flags,ochar) ((const char *)(&shoptione_ ## cname)) + 2, @@ /* special cases */