diff options
Diffstat (limited to 'src/simul.c')
-rw-r--r-- | src/simul.c | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/src/simul.c b/src/simul.c index 19de608..3701ea1 100644 --- a/src/simul.c +++ b/src/simul.c @@ -13,106 +13,106 @@ typedef void (*sighandler_t) (int); void invite(void) { - fprintf(stderr, _("Simul v1.0\n\n")); + fprintf(stderr, _("Simul v1.0\n\n")); } void usage(void) { - fprintf(stderr, _("Usage: linker [-s] [-d] binary\n")); - exit(0); + fprintf(stderr, _("Usage: linker [-s] [-d] binary\n")); + exit(0); } void init_all(void) { - fprintf(stderr, _(" o Initialising the simulator... ")); + fprintf(stderr, _(" o Initialising the simulator... ")); - Initialisation(); - fprintf(stderr, _(" Done!\n")); + Initialisation(); + fprintf(stderr, _(" Done!\n")); } void flush_all(void) { - Flush(); + Flush(); } void segfaulthand(int i) { - exception(1, _("Signal received: segfault")); + exception(1, _("Signal received: segfault")); } void ctrlbreakhand(int i) { - debug = 1; + debug = 1; } char *readargs(int argc, char **argv) { - char *r = NULL; - - argc--; - argv++; - - Rapide = 1; - - while (argc) { - if (**argv == '-') { - switch ((*argv)[1]) { - case 's': - Rapide = 0; - break; - case 'd': - debug = 1; - break; - default: - usage(); - } - } else { - if (r) { - usage(); - } - r = *argv; - } - argv++; - argc--; - } - - if (!r) { + char *r = NULL; + + argc--; + argv++; + + Rapide = 1; + + while (argc) { + if (**argv == '-') { + switch ((*argv)[1]) { + case 's': + Rapide = 0; + break; + case 'd': + debug = 1; + break; + default: + usage(); + } + } else { + if (r) { usage(); + } + r = *argv; } - return r; + argv++; + argc--; + } + + if (!r) { + usage(); + } + return r; } int main(int argc, char **argv) { - int i; - char *nom; + int i; + char *nom; - invite(); + invite(); - nom = readargs(argc, argv); + nom = readargs(argc, argv); - signal(SIGSEGV, segfaulthand); - signal(SIGINT, ctrlbreakhand); + signal(SIGSEGV, segfaulthand); + signal(SIGINT, ctrlbreakhand); - fprintf(stderr, _("\nPerforming initialisation...\n\n")); - init_all(); + fprintf(stderr, _("\nPerforming initialisation...\n\n")); + init_all(); - pushcontext(_("Beginning simulation")); + pushcontext(_("Beginning simulation")); - openterm(); - initterm(); - clearterm(); - ChargeBinaire(nom); - clearterm(); + openterm(); + initterm(); + clearterm(); + ChargeBinaire(nom); + clearterm(); - popcontext(); + popcontext(); - fprintf(stderr, _("\nPerforming shutdown...\n\n")); - flush_all(); + fprintf(stderr, _("\nPerforming shutdown...\n\n")); + flush_all(); - signal(SIGSEGV, NULL); - signal(SIGINT, NULL); + signal(SIGSEGV, NULL); + signal(SIGINT, NULL); - fprintf(stderr, _("Exitting, bye!\n")); - return 0; + fprintf(stderr, _("Exitting, bye!\n")); + return 0; } |