script: minor style improvements

Fix some nits pointed out by checkstyle9.pl in advance of functional
changes to script(1).

Reviewed by:	des
Sponsored by:	Modirum MDPay
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D44167
This commit is contained in:
Xavier Beaudouin 2024-04-26 11:10:15 -05:00 committed by Kyle Evans
parent 7b390cb636
commit 4459abe334

View file

@ -40,6 +40,7 @@
#include <sys/endian.h> #include <sys/endian.h>
#include <dev/filemon/filemon.h> #include <dev/filemon/filemon.h>
#include <assert.h>
#include <err.h> #include <err.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
@ -114,8 +115,7 @@ main(int argc, char *argv[])
usesleep = 1; usesleep = 1;
rawout = 0; rawout = 0;
flushtime = 30; flushtime = 30;
fm_fd = -1; /* Shut up stupid "may be used uninitialized" GCC fm_fd = -1;
warning. (not needed w/clang) */
showexit = 0; showexit = 0;
while ((ch = getopt(argc, argv, "adeFfkpqrT:t:")) != -1) while ((ch = getopt(argc, argv, "adeFfkpqrT:t:")) != -1)
@ -126,7 +126,8 @@ main(int argc, char *argv[])
case 'd': case 'd':
usesleep = 0; usesleep = 0;
break; break;
case 'e': /* Default behavior, accepted for linux compat */ case 'e':
/* Default behavior, accepted for linux compat. */
break; break;
case 'F': case 'F':
Fflg = 1; Fflg = 1;
@ -239,6 +240,8 @@ main(int argc, char *argv[])
(void)tcsetattr(STDIN_FILENO, TCSAFLUSH, &rtt); (void)tcsetattr(STDIN_FILENO, TCSAFLUSH, &rtt);
} }
assert(fflg ? fm_fd >= 0 : fm_fd < 0);
child = fork(); child = fork();
if (child < 0) { if (child < 0) {
warn("fork"); warn("fork");
@ -459,8 +462,7 @@ consume(FILE *fp, off_t len, char *buf, int reg)
if (reg) { if (reg) {
if (fseeko(fp, len, SEEK_CUR) == -1) if (fseeko(fp, len, SEEK_CUR) == -1)
err(1, NULL); err(1, NULL);
} } else {
else {
while (len > 0) { while (len > 0) {
l = MIN(DEF_BUF, len); l = MIN(DEF_BUF, len);
if (fread(buf, sizeof(char), l, fp) != l) if (fread(buf, sizeof(char), l, fp) != l)