1
0
mirror of https://github.com/cclassic/model-ghdl synced 2024-11-14 07:29:52 +01:00

Syntax change to finally use a switch case somewhere :)

This commit is contained in:
Markus Koch 2016-05-21 22:17:55 +02:00
parent f304d611a8
commit b3171fbbb7

19
main.c
View File

@ -485,24 +485,21 @@ char* append_string(char **dest, const char *src) {
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int app;
printf ("model-ghdl revision %s, compiled on %s.\n", PROGRAM_REVISION, __DATE__); printf ("model-ghdl revision %s, compiled on %s.\n", PROGRAM_REVISION, __DATE__);
app = get_application(argv[0]); switch (get_application(argv[0])) {
case PROG_VCOM:
if (app == PROG_VCOM) {
return vcom(argc, argv); return vcom(argc, argv);
} case PROG_VSIM:
else if (app == PROG_VSIM) {
return vsim(argc, argv); return vsim(argc, argv);
} case PROG_VMAP:
else if (app == PROG_VMAP || app == PROG_VLIB || app == PROG_VDEL) { case PROG_VLIB:
case PROG_VDEL:
return 0; return 0;
} default:
return 255; return 255;
} }
}
// Detects which function to call depending on the program name in argv[0] // Detects which function to call depending on the program name in argv[0]
int get_application(const char *call) { int get_application(const char *call) {