Use nitems() from sys/param.h.
Sponsored by: gandi.net (BSD Day Taiwan)
This commit is contained in:
parent
131cac80e1
commit
02c8c1182b
@ -898,7 +898,7 @@ CMDFUNCSTART(newtype)
|
|||||||
return 1;
|
return 1;
|
||||||
type = DIP(curinode, di_mode) & IFMT;
|
type = DIP(curinode, di_mode) & IFMT;
|
||||||
for (tp = typenamemap;
|
for (tp = typenamemap;
|
||||||
tp < &typenamemap[sizeof(typenamemap)/sizeof(*typenamemap)];
|
tp < &typenamemap[nitems(typenamemap)];
|
||||||
tp++) {
|
tp++) {
|
||||||
if (!strcmp(argv[1], tp->typename)) {
|
if (!strcmp(argv[1], tp->typename)) {
|
||||||
printf("setting type to %s\n", tp->typename);
|
printf("setting type to %s\n", tp->typename);
|
||||||
@ -906,7 +906,7 @@ CMDFUNCSTART(newtype)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tp == &typenamemap[sizeof(typenamemap)/sizeof(*typenamemap)]) {
|
if (tp == &typenamemap[nitems(typenamemap)]) {
|
||||||
warnx("type `%s' not known", argv[1]);
|
warnx("type `%s' not known", argv[1]);
|
||||||
warnx("try one of `file', `dir', `socket', `fifo'");
|
warnx("try one of `file', `dir', `socket', `fifo'");
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user