From 0b9580766402f4fc2a14be506fa9ef7928d5a227 Mon Sep 17 00:00:00 2001 From: ceriel Date: Thu, 15 Mar 1990 10:44:14 +0000 Subject: [PATCH] Added verbose option --- util/led/archive.c | 2 +- util/led/debug.h | 3 +++ util/led/error.c | 16 +++++++++++++--- util/led/led.6 | 7 +++++++ util/led/main.c | 4 ++++ 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/util/led/archive.c b/util/led/archive.c index fe762036e..5117cfef7 100644 --- a/util/led/archive.c +++ b/util/led/archive.c @@ -110,7 +110,7 @@ arch() seek(ran->ran_pos); get_archive_header(&arhdr); modulname = arhdr.ar_name; - debug("%s defines %s\n", modulname, string, 0, 0); + verbose("defines %s", string, 0, 0, 0); resolved = TRUE; /* * This archive member is going to be linked, diff --git a/util/led/debug.h b/util/led/debug.h index 6ffb0194d..e98d19841 100644 --- a/util/led/debug.h +++ b/util/led/debug.h @@ -14,3 +14,6 @@ extern int DEB; #define debug(s, a1, a2, a3, a4) (DEB && printf(s, a1, a2, a3, a4)) #endif + +extern int Verbose; +#define verbose(s, a1, a2, a3, a4) (Verbose && do_verbose(s, a1, a2, a3, a4)) diff --git a/util/led/error.c b/util/led/error.c index b2fde4a3f..3aa38c88c 100644 --- a/util/led/error.c +++ b/util/led/error.c @@ -50,6 +50,13 @@ error(format, a1, a2, a3, a4) diag("error", format, a1, a2, a3, a4); } +/* VARARGS1 */ +do_verbose(format, a1, a2, a3, a4) + char *format; +{ + diag((char *) 0, format, a1, a2, a3, a4); +} + static diag(tail, format, a1, a2, a3, a4) char *tail; @@ -58,10 +65,13 @@ diag(tail, format, a1, a2, a3, a4) extern char *progname, *archname, *modulname; fprintf(stderr, "%s: ", progname); - if (archname) + if (archname && modulname) + fprintf(stderr, "%s(%s): ", archname, modulname); + else if (archname) fprintf(stderr, "%s: ", archname); - if (modulname) + else if (modulname) fprintf(stderr, "%s: ", modulname); fprintf(stderr, format, a1, a2, a3, a4); - fprintf(stderr, " (%s)\n", tail); + if (tail) fprintf(stderr, " (%s)\n", tail); + else putc('\n', stderr); } diff --git a/util/led/led.6 b/util/led/led.6 index 3bfa19e6c..ab1e72652 100644 --- a/util/led/led.6 +++ b/util/led/led.6 @@ -114,6 +114,13 @@ This is useful for loading wholly from a library, since initially the name table is empty and an unresolved reference is needed to force the loading of the first routine. +.TP +.B \-v +For each member of a library that is linked, give a message on standard +error telling why +.I led +chose to link it (which unresolved reference it resolves). +This option is useful if you have 'multiply defined' problems. .SH FILES ~em/lib/em_led a.out output file diff --git a/util/led/main.c b/util/led/main.c index 85ecd6297..684c44eac 100644 --- a/util/led/main.c +++ b/util/led/main.c @@ -25,6 +25,7 @@ int statistics; #ifndef NDEBUG int DEB = 0; #endif +int Verbose = 0; static initializations(); static first_pass(); @@ -221,6 +222,9 @@ first_pass(argv) if (searchname(*argv, h) == (struct outname *)0) entername(makename(*argv), h); break; + case 'v': + Verbose = 1; + break; case 'S': statistics = 1; break; -- 2.34.1