aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/ulimit.c
diff options
context:
space:
mode:
Diffstat (limited to 'toys/posix/ulimit.c')
-rw-r--r--toys/posix/ulimit.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/toys/posix/ulimit.c b/toys/posix/ulimit.c
index 4fa01618..da7f2ead 100644
--- a/toys/posix/ulimit.c
+++ b/toys/posix/ulimit.c
@@ -68,10 +68,10 @@ void ulimit_main(void)
RLIMIT_CPU, RLIMIT_NPROC, RLIMIT_AS};
if (!(toys.optflags&(FLAG_H-1))) toys.optflags |= FLAG_f;
- if ((toys.optflags&(FLAG_a|FLAG_p)) && toys.optc) error_exit("can't set -ap");
+ if ((FLAG(a)||FLAG(p)) && toys.optc) error_exit("can't set -ap");
// Fetch data
- if (!(toys.optflags&FLAG_P)) TT.P = getppid();
+ if (!FLAG(P)) TT.P = getppid();
for (i=0; i<sizeof(map); i++) {
char *flags="cdefilmnpqRrstuv";
@@ -80,10 +80,10 @@ void ulimit_main(void)
if (get && prlimit(TT.P, map[i], 0, &rr)) perror_exit("-%c", flags[i]);
if (!toys.optc) {
- if (toys.optflags&FLAG_a) printf("-%c: ", flags[i]);
+ if (FLAG(a)) printf("-%c: ", flags[i]);
if (get) {
if ((1<<i)&FLAG_p) {
- if (toys.optflags&FLAG_H)
+ if (FLAG(H))
xreadfile("/proc/sys/fs/pipe-max-size", toybuf, sizeof(toybuf));
else {
int pp[2];
@@ -93,7 +93,7 @@ void ulimit_main(void)
}
printf("%s", toybuf);
} else {
- rlim_t rl = (toys.optflags&FLAG_H) ? rr.rlim_max : rr.rlim_cur;
+ rlim_t rl = FLAG(H) ? rr.rlim_max : rr.rlim_cur;
if (rl == RLIM_INFINITY) printf("unlimited\n");
else printf("%ld\n", (long)rl);
@@ -103,7 +103,7 @@ void ulimit_main(void)
if (toys.optflags&(1<<i)) break;
}
- if (toys.optflags&(FLAG_a|FLAG_p)) return;
+ if (FLAG(a)||FLAG(p)) return;
if (toys.optc) {
rlim_t val;
@@ -111,7 +111,7 @@ void ulimit_main(void)
if (tolower(**toys.optargs) == 'u') val = RLIM_INFINITY;
else val = atolx_range(*toys.optargs, 0, LONG_MAX);
- if (toys.optflags&FLAG_H) rr.rlim_max = val;
+ if (FLAG(H)) rr.rlim_max = val;
else rr.rlim_cur = val;
if (prlimit(TT.P, map[i], &rr, 0)) perror_exit(0);
}