mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-15 10:17:20 +00:00
brandelf: fix style nits
No functional change intended. Reviewed by: emaste, markj Differential Revision: https://reviews.freebsd.org/D17966
This commit is contained in:
parent
fd253945ac
commit
d72ba183ff
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=340567
@ -32,11 +32,13 @@
|
|||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__FBSDID("$FreeBSD$");
|
__FBSDID("$FreeBSD$");
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/param.h>
|
||||||
#include <sys/elf_common.h>
|
#include <sys/elf_common.h>
|
||||||
#include <sys/errno.h>
|
#include <sys/errno.h>
|
||||||
|
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -64,16 +66,21 @@ main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
|
|
||||||
const char *strtype = "FreeBSD";
|
const char *strtype = "FreeBSD";
|
||||||
int type = ELFOSABI_FREEBSD;
|
int ch, retval, type;
|
||||||
int retval = 0;
|
bool change, force, listed;
|
||||||
int ch, change = 0, force = 0, listed = 0;
|
|
||||||
|
type = ELFOSABI_FREEBSD;
|
||||||
|
retval = 0;
|
||||||
|
change = false;
|
||||||
|
force = false;
|
||||||
|
listed = false;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "f:lt:v")) != -1)
|
while ((ch = getopt(argc, argv, "f:lt:v")) != -1)
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'f':
|
case 'f':
|
||||||
if (change)
|
if (change)
|
||||||
errx(1, "f option incompatible with t option");
|
errx(1, "f option incompatible with t option");
|
||||||
force = 1;
|
force = true;
|
||||||
type = atoi(optarg);
|
type = atoi(optarg);
|
||||||
if (errno == ERANGE || type < 0 || type > 255) {
|
if (errno == ERANGE || type < 0 || type > 255) {
|
||||||
warnx("invalid argument to option f: %s",
|
warnx("invalid argument to option f: %s",
|
||||||
@ -83,7 +90,7 @@ main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
printelftypes();
|
printelftypes();
|
||||||
listed = 1;
|
listed = true;
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
/* does nothing */
|
/* does nothing */
|
||||||
@ -91,7 +98,7 @@ main(int argc, char **argv)
|
|||||||
case 't':
|
case 't':
|
||||||
if (force)
|
if (force)
|
||||||
errx(1, "t option incompatible with f option");
|
errx(1, "t option incompatible with f option");
|
||||||
change = 1;
|
change = true;
|
||||||
strtype = optarg;
|
strtype = optarg;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -99,7 +106,7 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
argc -= optind;
|
argc -= optind;
|
||||||
argv += optind;
|
argv += optind;
|
||||||
if (!argc) {
|
if (argc == 0) {
|
||||||
if (listed)
|
if (listed)
|
||||||
exit(0);
|
exit(0);
|
||||||
else {
|
else {
|
||||||
@ -114,7 +121,7 @@ main(int argc, char **argv)
|
|||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
while (argc) {
|
while (argc != 0) {
|
||||||
int fd;
|
int fd;
|
||||||
char buffer[EI_NIDENT];
|
char buffer[EI_NIDENT];
|
||||||
|
|
||||||
@ -160,7 +167,7 @@ main(int argc, char **argv)
|
|||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return (retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -176,12 +183,10 @@ iselftype(int etype)
|
|||||||
{
|
{
|
||||||
size_t elfwalk;
|
size_t elfwalk;
|
||||||
|
|
||||||
for (elfwalk = 0;
|
for (elfwalk = 0; elfwalk < nitems(elftypes); elfwalk++)
|
||||||
elfwalk < sizeof(elftypes)/sizeof(elftypes[0]);
|
|
||||||
elfwalk++)
|
|
||||||
if (etype == elftypes[elfwalk].value)
|
if (etype == elftypes[elfwalk].value)
|
||||||
return elftypes[elfwalk].str;
|
return (elftypes[elfwalk].str);
|
||||||
return 0;
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -189,12 +194,10 @@ elftype(const char *elfstrtype)
|
|||||||
{
|
{
|
||||||
size_t elfwalk;
|
size_t elfwalk;
|
||||||
|
|
||||||
for (elfwalk = 0;
|
for (elfwalk = 0; elfwalk < nitems(elftypes); elfwalk++)
|
||||||
elfwalk < sizeof(elftypes)/sizeof(elftypes[0]);
|
|
||||||
elfwalk++)
|
|
||||||
if (strcasecmp(elfstrtype, elftypes[elfwalk].str) == 0)
|
if (strcasecmp(elfstrtype, elftypes[elfwalk].str) == 0)
|
||||||
return elftypes[elfwalk].value;
|
return (elftypes[elfwalk].value);
|
||||||
return -1;
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -203,10 +206,8 @@ printelftypes(void)
|
|||||||
size_t elfwalk;
|
size_t elfwalk;
|
||||||
|
|
||||||
fprintf(stderr, "known ELF types are: ");
|
fprintf(stderr, "known ELF types are: ");
|
||||||
for (elfwalk = 0;
|
for (elfwalk = 0; elfwalk < nitems(elftypes); elfwalk++)
|
||||||
elfwalk < sizeof(elftypes)/sizeof(elftypes[0]);
|
fprintf(stderr, "%s(%u) ", elftypes[elfwalk].str,
|
||||||
elfwalk++)
|
elftypes[elfwalk].value);
|
||||||
fprintf(stderr, "%s(%u) ", elftypes[elfwalk].str,
|
|
||||||
elftypes[elfwalk].value);
|
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user