summaryrefslogtreecommitdiffstats
path: root/usr.bin/limits
diff options
context:
space:
mode:
authordwmalone <dwmalone@FreeBSD.org>2002-04-13 21:28:17 +0000
committerdwmalone <dwmalone@FreeBSD.org>2002-04-13 21:28:17 +0000
commitcad828b7af5a6c013a6486cef2a42da45d0650d0 (patch)
tree298c728f0f8fcbae522db3ddd83fde84004695e8 /usr.bin/limits
parentbca9d5731a14d99e218705fb68fc6fc6d3b0397d (diff)
downloadFreeBSD-src-cad828b7af5a6c013a6486cef2a42da45d0650d0.zip
FreeBSD-src-cad828b7af5a6c013a6486cef2a42da45d0650d0.tar.gz
Warns cleanups:
1) Add missing initialisers. 2) Avoid shadowing rcswhich. 3) Use intmax_t and %j for printing rather than quad_t and %q. 4) Don't modify a variable twice between sequence points.
Diffstat (limited to 'usr.bin/limits')
-rw-r--r--usr.bin/limits/limits.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/usr.bin/limits/limits.c b/usr.bin/limits/limits.c
index 642237c..21db848 100644
--- a/usr.bin/limits/limits.c
+++ b/usr.bin/limits/limits.c
@@ -32,6 +32,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>
+#include <stdint.h>
#include <ctype.h>
#include <errno.h>
#include <pwd.h>
@@ -184,7 +185,9 @@ static struct {
{ "limit%s sbsize %s", ";\n", 1 }
}
},
- { NULL }
+ { NULL, NULL, NULL, NULL, NULL, NULL,
+ { }
+ }
};
static struct {
@@ -283,7 +286,7 @@ main(int argc, char *argv[])
default:
case ':': /* Without arg */
if ((p = strchr(rcs_string, optopt)) != NULL) {
- int rcswhich = p - rcs_string;
+ int rcswhich1 = p - rcs_string;
if (optarg && *optarg == '-') { /* 'arg' is actually a switch */
--optind; /* back one arg, and make arg NULL */
optarg = NULL;
@@ -291,8 +294,8 @@ main(int argc, char *argv[])
todo = optarg == NULL ? RCSSEL : RCSSET;
if (type == ANY)
type = BOTH;
- which_limits[rcswhich] = optarg ? type : DISPLAYONLY;
- set_limits[rcswhich] = resource_num(rcswhich, optopt, optarg);
+ which_limits[rcswhich1] = optarg ? type : DISPLAYONLY;
+ set_limits[rcswhich1] = resource_num(rcswhich1, optopt, optarg);
num_limits++;
break;
}
@@ -468,7 +471,7 @@ print_limit(rlim_t limit, unsigned divisor, const char * inf, const char * pfx,
if (limit == RLIM_INFINITY)
strcpy(numbr, inf);
else
- sprintf(numbr, "%qd", (quad_t)((limit + divisor/2) / divisor));
+ sprintf(numbr, "%jd", (intmax_t)((limit + divisor/2) / divisor));
printf(pfx, which, numbr);
printf(sfx, which);
@@ -580,7 +583,7 @@ getshellbyname(const char * shell)
const char * q;
const char * p = strrchr(shell, '/');
- p = p ? ++p : shell;
+ p = p ? p+1 : shell;
for (i = 0; (q = shellparm[i].name) != NULL; i++) {
while (*q) {
int j = strcspn(q, "|");
OpenPOWER on IntegriCloud