Author: kevans Date: Sat Nov 7 03:43:45 2020 New Revision: 367441 URL: https://svnweb.freebsd.org/changeset/base/367441
Log: binmiscctl(8): miscellaneous cleanup - Bad whitespace in Makefile. - Reordered headers, sys/ first. - Annotated fatal/usage __dead2 to help `make analyze` out a little bit. - Spell a couple of sizeof constructs as "nitems" and "howmany" instead. MFC after: 1 week Modified: head/usr.sbin/binmiscctl/Makefile head/usr.sbin/binmiscctl/binmiscctl.c Modified: head/usr.sbin/binmiscctl/Makefile ============================================================================== --- head/usr.sbin/binmiscctl/Makefile Sat Nov 7 03:29:04 2020 (r367440) +++ head/usr.sbin/binmiscctl/Makefile Sat Nov 7 03:43:45 2020 (r367441) @@ -3,7 +3,7 @@ # .include <bsd.own.mk> - + PROG= binmiscctl MAN= binmiscctl.8 Modified: head/usr.sbin/binmiscctl/binmiscctl.c ============================================================================== --- head/usr.sbin/binmiscctl/binmiscctl.c Sat Nov 7 03:29:04 2020 (r367440) +++ head/usr.sbin/binmiscctl/binmiscctl.c Sat Nov 7 03:43:45 2020 (r367441) @@ -28,6 +28,12 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include <sys/types.h> +#include <sys/imgact_binmisc.h> +#include <sys/linker.h> +#include <sys/module.h> +#include <sys/sysctl.h> + #include <ctype.h> #include <errno.h> #include <getopt.h> @@ -37,12 +43,6 @@ __FBSDID("$FreeBSD$"); #include <stdlib.h> #include <string.h> -#include <sys/types.h> -#include <sys/imgact_binmisc.h> -#include <sys/linker.h> -#include <sys/module.h> -#include <sys/sysctl.h> - enum cmd { CMD_ADD = 0, CMD_REMOVE, @@ -134,7 +134,7 @@ static char const *cmd_sysctl_name[] = { IBE_SYSCTL_NAME_LIST }; -static void +static void __dead2 usage(const char *format, ...) { va_list args; @@ -150,7 +150,7 @@ usage(const char *format, ...) fprintf(stderr, "\n"); fprintf(stderr, "usage: %s command [args...]\n\n", __progname); - for(i = 0; i < ( sizeof (cmds) / sizeof (cmds[0])); i++) { + for(i = 0; i < nitems(cmds); i++) { fprintf(stderr, "%s:\n", cmds[i].desc); fprintf(stderr, "\t%s %s %s\n\n", __progname, cmds[i].name, cmds[i].args); @@ -159,7 +159,7 @@ usage(const char *format, ...) exit (error); } -static void +static void __dead2 fatal(const char *format, ...) { va_list args; @@ -232,7 +232,7 @@ demux_cmd(__unused int argc, char *const argv[]) optind = 1; optreset = 1; - for(i = 0; i < ( sizeof (cmds) / sizeof (cmds[0])); i++) { + for(i = 0; i < nitems(cmds); i++) { if (!strcasecmp(cmds[i].name, argv[0])) { return (i); } @@ -505,7 +505,7 @@ main(int argc, char **argv) free(xbe_outp); fatal("Fatal: %s", strerror(errno)); } - for(i = 0; i < (xbe_out_sz / sizeof(xbe_out)); i++) + for(i = 0; i < howmany(xbe_out_sz, sizeof(xbe_out)); i++) printxbe(&xbe_outp[i]); } _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"