Added verbose option

This commit is contained in:
ceriel 1990-03-15 10:44:14 +00:00
parent d3208e42ca
commit 0b95807664
5 changed files with 28 additions and 4 deletions

View file

@ -110,7 +110,7 @@ arch()
seek(ran->ran_pos); seek(ran->ran_pos);
get_archive_header(&arhdr); get_archive_header(&arhdr);
modulname = arhdr.ar_name; modulname = arhdr.ar_name;
debug("%s defines %s\n", modulname, string, 0, 0); verbose("defines %s", string, 0, 0, 0);
resolved = TRUE; resolved = TRUE;
/* /*
* This archive member is going to be linked, * This archive member is going to be linked,

View file

@ -14,3 +14,6 @@ extern int DEB;
#define debug(s, a1, a2, a3, a4) (DEB && printf(s, a1, a2, a3, a4)) #define debug(s, a1, a2, a3, a4) (DEB && printf(s, a1, a2, a3, a4))
#endif #endif
extern int Verbose;
#define verbose(s, a1, a2, a3, a4) (Verbose && do_verbose(s, a1, a2, a3, a4))

View file

@ -50,6 +50,13 @@ error(format, a1, a2, a3, a4)
diag("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 static
diag(tail, format, a1, a2, a3, a4) diag(tail, format, a1, a2, a3, a4)
char *tail; char *tail;
@ -58,10 +65,13 @@ diag(tail, format, a1, a2, a3, a4)
extern char *progname, *archname, *modulname; extern char *progname, *archname, *modulname;
fprintf(stderr, "%s: ", progname); fprintf(stderr, "%s: ", progname);
if (archname) if (archname && modulname)
fprintf(stderr, "%s(%s): ", archname, modulname);
else if (archname)
fprintf(stderr, "%s: ", archname); fprintf(stderr, "%s: ", archname);
if (modulname) else if (modulname)
fprintf(stderr, "%s: ", modulname); fprintf(stderr, "%s: ", modulname);
fprintf(stderr, format, a1, a2, a3, a4); fprintf(stderr, format, a1, a2, a3, a4);
fprintf(stderr, " (%s)\n", tail); if (tail) fprintf(stderr, " (%s)\n", tail);
else putc('\n', stderr);
} }

View file

@ -114,6 +114,13 @@ This is useful for loading wholly from a library,
since initially the name table is empty since initially the name table is empty
and an unresolved reference is needed and an unresolved reference is needed
to force the loading of the first routine. 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 .SH FILES
~em/lib/em_led ~em/lib/em_led
a.out output file a.out output file

View file

@ -25,6 +25,7 @@ int statistics;
#ifndef NDEBUG #ifndef NDEBUG
int DEB = 0; int DEB = 0;
#endif #endif
int Verbose = 0;
static initializations(); static initializations();
static first_pass(); static first_pass();
@ -221,6 +222,9 @@ first_pass(argv)
if (searchname(*argv, h) == (struct outname *)0) if (searchname(*argv, h) == (struct outname *)0)
entername(makename(*argv), h); entername(makename(*argv), h);
break; break;
case 'v':
Verbose = 1;
break;
case 'S': case 'S':
statistics = 1; statistics = 1;
break; break;