sometimes, I feel pretty stupid

separate the backslash+newline things out of the *.opt files,
logically not 100% clean, but better as it is not generated
content anyway (keeping the one-liners in there for now, even
though more consistent would be shifting them out as well)
This commit is contained in:
tg 2015-05-01 23:16:31 +00:00
parent a9e1101145
commit 7f48503c66
4 changed files with 37 additions and 38 deletions

22
funcs.c
View File

@ -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);

13
misc.c
View File

@ -30,7 +30,7 @@
#include <grp.h>
#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])

View File

@ -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 */

View File

@ -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 */