#include #include struct exec { u_long a_midmag; /* htonl(flags<<26 | mid<<16 | magic) */ u_long a_text; /* text segment size */ u_long a_data; /* initialized data size */ u_long a_bss; /* uninitialized data size */ u_long a_syms; /* symbol table size */ u_long a_entry; /* entry point */ u_long a_trsize; /* text relocation size */ u_long a_drsize; /* data relocation size */ }; /* genaout */ int main(int argc, char *argv[]) { struct exec ex; unsigned long text = atol(argv[1]); unsigned long bss = atol(argv[2]); memset(&ex, 0, sizeof(ex)); ex.a_midmag = ntohl(0410); ex.a_text = ntohl(text); ex.a_bss = ntohl(bss); fwrite(&ex, sizeof(ex), 1, stdout); }