Browse Source

Added verbose option

ceriel 34 years ago
parent
commit
0b95807664
5 changed files with 28 additions and 4 deletions
  1. 1 1
      util/led/archive.c
  2. 3 0
      util/led/debug.h
  3. 13 3
      util/led/error.c
  4. 7 0
      util/led/led.6
  5. 4 0
      util/led/main.c

+ 1 - 1
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,

+ 3 - 0
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))

+ 13 - 3
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);
 }

+ 7 - 0
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

+ 4 - 0
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;