diff options
Diffstat (limited to 'fractal-gen.c')
-rw-r--r-- | fractal-gen.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fractal-gen.c b/fractal-gen.c index 6f3cb5f..13bd6ba 100644 --- a/fractal-gen.c +++ b/fractal-gen.c @@ -4,16 +4,20 @@ int main(int argc, char **argv) { unsigned int size, iterat, cores, i, x, y, s; double power; + char* bname; void *(*generator)(void *); // Select correct generator for the fractal type - // TO DO: use basename - if (strcmp(argv[0], "./mbrot-gen") == 0) + bname = basename(argv[0]); + if (strcmp(bname, "mbrot-gen") == 0) + { generator = &generate_mbrot_section; - else if (strcmp(argv[0], "./bship-gen") == 0) + } else if (strcmp(bname, "bship-gen") == 0) { generator = &generate_bship_section; - else + } else { fprintf(stderr, "Don't call this directly, call a symlink to me\n"); + return EXIT_FAILURE; + } if (argc != 4) { |