scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 4995bc432f0c35f3402464faa319986c8f0c1747
parent 766d33988c138f65264f4688c289ecc04e58cd1a
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date:   Thu, 19 Mar 2026 12:50:08 +0100

dump: Remove the dump utility

This utility was just a binary dumper that can be done just
using od.

Diffstat:
Mdoc/man1/scc.man | 5-----
Mscripts/proto.all | 1-
Msrc/cmd/Makefile | 1-
Msrc/cmd/scc-cc/posix/scc.sh | 2+-
Dsrc/cmd/scc-dump.c | 84-------------------------------------------------------------------------------
Mtests/as/execute/test.sh | 20++++++++------------
6 files changed, 9 insertions(+), 104 deletions(-)

diff --git a/doc/man1/scc.man b/doc/man1/scc.man @@ -68,11 +68,6 @@ Invoke .BR scc\-objcopy (1), the object file copy and translate utility. .TP -.B dump -Invoke -.BR scc\-dump (1), -the object file dump utility. -.TP .B objdump Invoke .BR scc\-objdump (1), diff --git a/scripts/proto.all b/scripts/proto.all @@ -6,7 +6,6 @@ f 755 bin/scc-ar f 755 bin/scc-as f 755 bin/scc-cc f 755 bin/scc-cpp -f 755 bin/scc-dump f 755 bin/scc-ld f 755 bin/scc-make f 755 bin/scc-nm diff --git a/src/cmd/Makefile b/src/cmd/Makefile @@ -16,7 +16,6 @@ TARGET =\ scc-strip\ scc-size\ scc-ranlib\ - scc-dump\ scc-objcopy\ scc-addr2line\ diff --git a/src/cmd/scc-cc/posix/scc.sh b/src/cmd/scc-cc/posix/scc.sh @@ -13,7 +13,7 @@ then fi case $1 in -cc|cpp|as|ar|addr2line|ld|make|nm|objcopy|dump|size|strip) +cc|cpp|as|ar|addr2line|ld|make|nm|objcopy|objdump|size|strip) tool=$1 shift exec $SCCPREFIX/bin/scc-$tool "$@" diff --git a/src/cmd/scc-dump.c b/src/cmd/scc-dump.c @@ -1,84 +0,0 @@ -#include <errno.h> -#include <stdarg.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include <scc/arg.h> -#include <scc/mach.h> - -char *argv0; -static char *filename; -static int status; - -static void -error(char *fmt, ...) -{ - va_list va; - - va_start(va, fmt); - fprintf(stderr, "objdump: %s: ", filename); - vfprintf(stderr, fmt, va); - putc('\n', stderr); - va_end(va); - - status = EXIT_FAILURE; -} - -/* - * TODO: Dummy implementation used only in the assembler tests - */ -static void -dump(char *fname) -{ - int c, n; - FILE *fp; - - filename = fname; - if ((fp = fopen(fname, "rb")) == NULL) { - error("%s", strerror(errno)); - return; - } - - puts("data:"); - for (n = 1; (c = getc(fp)) != EOF; n++) - printf("%02X%c", c, (n%16 == 0) ? '\n' : ' '); - if (n%16 != 0) - putchar('\n'); - - if (ferror(fp)) - error("%s", strerror(errno)); - - fclose(fp); -} - -static void -usage(void) -{ - fputs("usage: objdump file ...\n", stderr); - exit(1); -} - -int -main(int argc, char *argv[]) -{ - ARGBEGIN { - default: - usage(); - } ARGEND - - if (argc == 0) - dump("a.out"); - else while (*argv) { - dump(*argv++); - } - - if (fclose(stdout) == EOF) { - fprintf(stderr, - "objdump: writing output: %s\n", - strerror(errno)); - return EXIT_FAILURE; - } - - return status; -} diff --git a/tests/as/execute/test.sh b/tests/as/execute/test.sh @@ -26,19 +26,15 @@ sed -n '/^\#/ ! { }' $file | nl -b a > $tmp1 - -$EXEC scc dump | -sed -n '/^data:/,$ { - /^data:/ ! { - s%.*:%% - s%^[ ]*%% - s%[ ]*$%% - /^$/d - s%[ ][ ]*%\ +od -An -t x1 a.out | +tr 'a-z' 'A-Z' | +sed -n 's%.*:%% + s%^[ ]*%% + s%[ ]*$%% + /^$/d + s%[ ][ ]*%\ %g - p - } -}' | + p' | nl -b a > $tmp2 diff -u $tmp1 $tmp2