ref: f720bc2dfbfa81e8125ee35696f264baf161259d
parent: 1c58d7b01da37935bf4a4d6c6144b0ab03d5df77
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Jan 4 09:14:28 EST 2019
[nm] Print name of the object file Nm must print the name of the file when there are multiple object files in the command line.
--- a/src/nm/nm.c
+++ b/src/nm/nm.c
@@ -12,7 +12,7 @@
#include <scc/mach.h>
char *argv0;
-static int status;
+static int status, multi;
static int radix = 16;
static int Pflag;
static int Aflag;
@@ -72,6 +72,9 @@
qsort(sym, nsym, sizeof(*sym), cmp);
+ if (multi)
+ printf("%s:\n", (membname) ? membname : filename);
+
for (sym = obj->symtbl; nsym--; sym++) {
int type = sym->type;
char *fmt;
@@ -151,6 +154,7 @@
{
int t;
+ multi = 1;
membname = name;
if ((t = objtest(fp, NULL)) != -1)
newobject(fp, t);
@@ -231,6 +235,8 @@
if (argc == 0) {
nm("a.out");
} else {
+ if (argc > 1)
+ multi = 1;
for ( ; *argv; ++argv)
nm(*argv);
}