[Toybox] Style change for GLOBALS()
Rob Landley
rob at landley.net
Wed Aug 22 18:01:46 PDT 2018
I'm thinking of making it so argument variables populated by lib/args.c have the
same name as the option (so "a#" has a corresponding 'long a') and changing the
"one per line" to allow them to be grouped. Still a blank line between arguments
and non-argument globals.
Right now it's inconsistent, recent commands like ping have TT.w and older ones
like sort have TT.key_separator.
So ping would have:
GLOBALS(
long w, W;
char *i, *I;
long s, c, t, m;
struct sockaddr *sa;
int sock;
long i_ms;
unsigned long sent, recv, fugit, min, max;
)
sort would have:
GLOBALS(
char *t;
struct arg_list *k;
char *o, *T, S;
void *key_list;
int linecount;
char **lines;
)
And ps would start with:
union {
struct {
struct arg_list *G, *g, *U, *u, *t, *s, *p, *O, *o, *P, *k;
} ps;
struct {
long n, m;
char *d;
long s;
struct arg_list *u, *p, *o, *k, *O;
long d_ms;
} top;
struct {
char *L;
struct arg_list *G, *g, *P, *s, *t, *U, *u;
char *d;
void *regexes, *snapshot;
int signal;
pid_t self, match;
} pgrep;
};
(And yes, figuring out how to move enough ps infrastructure into lib/ to break
up ps.c into at least 3 different command files is on my todo list. I think I
need some sort of "struct proc_data" that all the shared TT stuff at the end of
globals could fit in, passed in as an argument...)
Rob
More information about the Toybox
mailing list