diff objgrep/dumpmatch.c @ 171:ddbfc1a1a811

objgrep: -s implemented
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Fri, 04 Jul 2014 03:07:09 +0000
parents
children 452baa748747
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/objgrep/dumpmatch.c	Fri Jul 04 03:07:09 2014 +0000
@@ -0,0 +1,40 @@
+/*
+ * objgrep: output on matches
+ */
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+#include "intstruct.h"
+#include "coffconst.h"
+#include "globals.h"
+
+extern unsigned get_u16(), get_u32();
+
+dump_symtab_on_match()
+{
+	unsigned n;
+	struct internal_syment *sym;
+
+	printf("\nThis source section's symbols:\n\n");
+	for (n = 0; n < nsymtab; n++) {
+		sym = symtab[n];
+		if (!sym)
+			continue;
+		if (sym->section != grep_section)
+			continue;
+		switch (sym->class) {
+		case C_EXT:
+			printf("%s = %08X\n", sym->name,
+				sym->value + match_offset);
+			continue;
+		case C_STAT:
+			printf("%s:%s = %08X\n", objfilename, sym->name,
+				sym->value + match_offset);
+			continue;
+		}
+	}
+}