Thu Jul 11 14:53:23 2024 by Mizuki |
a little patch to warn when new users double click the binary instead of vomiting characters onto the terminal. if (strcmp(cmdLine, strcat(av[0], " ")) == 0) { fprintf(stdout, "Note: you probably either double clicked the executable, or ran the program without any arguments.\n"); fprintf(stdout, "This will fill your terminal with random garbage for a while and possibly cause it to lag.\n"); fprintf(stdout, "Open a terminal window here and type '%s' along with some arguments instead.\n", av[0]); fprintf(stdout, "See Manual.pdf for help.\n"); fprintf(stdout, "Press ENTER to exit..."); getchar(); exit(0); } /* add this right above the readcolor function */ readcolors(colfile, colorsname, biocolorsname); |
Thu Jul 11 14:53:23 2024 by Mizuki |
a little patch to warn when new users double click the binary instead of vomiting characters onto the terminal. if (strcmp(cmdLine, strcat(av[0], " ")) == 0) { fprintf(stdout, "Note: you probably either double clicked the executable, or ran the program without any arguments.\n"); fprintf(stdout, "This will fill your terminal with random garbage for a while and possibly cause it to lag.\n"); fprintf(stdout, "Open a terminal window here and type '%s' along with some arguments instead.\n", av[0]); fprintf(stdout, "See Manual.pdf for help.\n"); fprintf(stdout, "Press ENTER to exit..."); getchar(); exit(0); } /* add this right above the readcolor function */ readcolors(colfile, colorsname, biocolorsname); |
Sat Jul 13 09:55:22 2024 by Mizuki |
Oh I actually really overly complicated the zero argument check...you just need if (ac ==1) instead of that jerry rigged strcmp contraption haha |
Sun Jul 14 00:03:03 2024 by Mizuki |
it seems using just av[0] will print the absolute path to the binary...so I wrote a little code that filters them out and give you just the binary name. if (ac == 1) { char *binname = strrchr(av[0], '\\'); if (binname == NULL) { binname = strrchr(av[0], '/'); if (binname == NULL) { binname = av[0]; } else { binname++; } } else { binname++; } fprintf(stdout, "Note: you probably either double clicked the executable, or ran the program without any arguments.\n"); fprintf(stdout, "This will fill your terminal with random garbage for a while and possibly cause it to lag.\n"); fprintf(stdout, "Open a terminal window here and type '%s' along with some arguments instead.\n", binname); fprintf(stdout, "You can access help with '%s -1'.\nPress ENTER to exit...", binname); getchar(); exit(0); } /* add this above the readcolors function call */ readcolors(colfile, colorsname, biocolorsname); |
Mon Jul 22 14:09:50 2024 by Torben |
It is deliberate that the data is output to the terminal when no output file is specified. This is so it can be piped into another program (which is standard practice on Unix/Linux). |
Tue Jul 23 12:10:26 2024 by Mizuki |
I do know that there is valid reasons for outputing to stdout - so this code only check if ac equals 1 - which will only happen when you either run planet without any arguments - or more commonly based on some questions in this forum - that users aren’t familiar with CLI executables and simply double clicked the binary. It will still allow outputing to stdout, you simply need to specify at least one argument. |