diff options
author | Pixel <> | 2001-04-16 14:25:48 +0000 |
---|---|---|
committer | Pixel <> | 2001-04-16 14:25:48 +0000 |
commit | 47f363829678a02111423cd5d374e6739d8ea500 (patch) | |
tree | 5c288a8902492e1a91d87ba4ab1cca658e39cbfa /src/linker.c | |
parent | 27f796ab6a9f455bbd2a1c85088db5304cece75a (diff) |
Linker + bugfixes
Diffstat (limited to 'src/linker.c')
-rw-r--r-- | src/linker.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/linker.c b/src/linker.c new file mode 100644 index 0000000..61301de --- /dev/null +++ b/src/linker.c @@ -0,0 +1,61 @@ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <signal.h> +#include "config.h" +#include "exceptions.h" +#include "linker.h" + +typedef void (*sighandler_t)(int); + +void invite(void) { + fprintf(stderr, _("Linker v1.0\n\n")); +} + +void usage(void) { + fprintf(stderr, _("Usage: linker obj1 [obj2 [obj3 [...]]] binary\n")); + exit(0); +} + +void init_all(int n) { + fprintf(stderr, _(" o Initialising the linker... ")); + + init(n); + fprintf(stderr, _(" Done!\n")); +} + +void flush_all(void) { + flush(); +} + +void segfaulthand(int i) { + exception(1, _("Signal received: segfault")); +} + +int main(int argc, char ** argv) { + int i; + + invite(); + + signal(SIGSEGV, segfaulthand); + + if (argc < 3) usage(); + + fprintf(stderr, _("\nPerforming initialisation...\n\n")); + init_all(argc - 2); + + fprintf(stderr, _("Linking files...\n")); + + for (i = 1; i < argc - 1; i++) { + addfile(argv[i]); + } + + fprintf(stderr, _("Generating output file...\n")); + dumpfile(argv[i]); + + fprintf(stderr, _("\nPerforming shutdown...\n\n")); + flush_all(); + + fprintf(stderr, _("Exitting, bye!\n")); + return 0; +} |