diff options
author | markm <markm@FreeBSD.org> | 2002-04-28 12:55:35 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 2002-04-28 12:55:35 +0000 |
commit | 2f918abe2e1548bd71fae31eb0fda40c5b8d3e4b (patch) | |
tree | 1ab8eb853c04557bddc2e49b42f043bbbb16b1ef /usr.bin/ldd/ldd.c | |
parent | 432896d29d32116f6416d576c3c566bf2058bbca (diff) | |
download | FreeBSD-src-2f918abe2e1548bd71fae31eb0fda40c5b8d3e4b.zip FreeBSD-src-2f918abe2e1548bd71fae31eb0fda40c5b8d3e4b.tar.gz |
Warns; ANSIfy, constify and move declarations into a common header.
Diffstat (limited to 'usr.bin/ldd/ldd.c')
-rw-r--r-- | usr.bin/ldd/ldd.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/usr.bin/ldd/ldd.c b/usr.bin/ldd/ldd.c index 4ef8f4d..8e5e5d2 100644 --- a/usr.bin/ldd/ldd.c +++ b/usr.bin/ldd/ldd.c @@ -28,14 +28,15 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); #include <sys/wait.h> + #include <machine/elf.h> + #include <arpa/inet.h> + #include <a.out.h> #include <dlfcn.h> #include <err.h> @@ -44,20 +45,17 @@ static const char rcsid[] = #include <stdlib.h> #include <unistd.h> -extern void dump_file(const char *); -extern int error_count; +#include "extern.h" -void -usage() +static void +usage(void) { fprintf(stderr, "usage: ldd [-a] [-v] [-f format] program ...\n"); exit(1); } int -main(argc, argv) -int argc; -char *argv[]; +main(int argc, char *argv[]) { char *fmt1 = NULL, *fmt2 = NULL; int rval; @@ -139,7 +137,7 @@ char *argv[]; file_ok = 1; is_shlib = 0; - if (n >= sizeof hdr.aout && !N_BADMAG(hdr.aout)) { + if ((size_t)n >= sizeof hdr.aout && !N_BADMAG(hdr.aout)) { /* a.out file */ if ((N_GETFLAG(hdr.aout) & EX_DPMASK) != EX_DYNAMIC #if 1 /* Compatibility */ @@ -149,7 +147,7 @@ char *argv[]; warnx("%s: not a dynamic executable", *argv); file_ok = 0; } - } else if (n >= sizeof hdr.elf && IS_ELF(hdr.elf)) { + } else if ((size_t)n >= sizeof hdr.elf && IS_ELF(hdr.elf)) { Elf_Ehdr ehdr; Elf_Phdr phdr; int dynamic = 0, i; |