Added verbose option
authorceriel <none@none>
Thu, 15 Mar 1990 10:44:14 +0000 (10:44 +0000)
committerceriel <none@none>
Thu, 15 Mar 1990 10:44:14 +0000 (10:44 +0000)
util/led/archive.c
util/led/debug.h
util/led/error.c
util/led/led.6
util/led/main.c

index fe76203..5117cfe 100644 (file)
@@ -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,
index 6ffb019..e98d198 100644 (file)
@@ -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))
index b2fde4a..3aa38c8 100644 (file)
@@ -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);
 }
index 3bfa19e..ab1e726 100644 (file)
@@ -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
index 85ecd62..684c44e 100644 (file)
@@ -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;