|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T m
Length: 1286 (0x506) Types: TextFile Names: »main.c«
└─⟦9ae75bfbd⟧ Bits:30007242 EUUGD3: Starter Kit └─⟦3f75c1919⟧ »EurOpenD3/utils/decomp.tar.Z« └─⟦510c4d5ee⟧ └─⟦this⟧ »decomp/main.c«
/* * Module: main.c * * Author: J. Reuter * * This module contains the main program. */ #include "defs.h" #include "main.h" FILE *objfile; long offset; struct exec obj_header; /* * The main program. * * It takes one argument, which is the name of the object or a.out * file to decompile. */ main(argc, argv) int argc; char *argv[]; { /* Open the file */ if ( (objfile = fopen( argv[1], "r" )) == NULL ) { printf( "Can't open %s\n", argv[1] ); exit( 1 ); } /* Read the object header */ fread( &obj_header, sizeof( obj_header ), 1, objfile ); if ( N_BADMAG( obj_header ) ) { printf( "Bad magic number\n" ); exit( 1 ); } #ifdef debug printf( " Magic Text Data Bss Entry\n" ); printf( "%6o %6d %6d %6d %6d\n", obj_header.a_magic, obj_header.a_text, obj_header.a_data, obj_header.a_bss, obj_header.a_entry ); #endif /* read the various parts of the symbol table */ sym_read(); offset = N_TXTOFF( obj_header ); /* now decompile the code */ decomp( obj_header.a_text ); #ifdef debug printf( "\n" ); symdump(); printf( "\nText relocation\n" ); reldump( 0, obj_header.a_trsize ); printf( "\nData relocation\n" ); reldump( obj_header.a_trsize, obj_header.a_drsize ); #endif }