Added -v option to print version info

This commit is contained in:
Rob Pearce 2008-10-30 22:05:00 +00:00
parent 9000847ee3
commit 4dd2faad2b
1 changed files with 6 additions and 2 deletions

8
rc.c
View File

@ -177,12 +177,18 @@ int main (int argc, char **argv) {
sprintf(hiscoreserver, "ratcatcher.nethack.net"); sprintf(hiscoreserver, "ratcatcher.nethack.net");
hiscoreport = 80; hiscoreport = 80;
// set program name (including version string)
sprintf(progname, "Rat Catcher v0.%d", REV);
/* handle arguments */ /* handle arguments */
if (argc >= 2) { if (argc >= 2) {
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "-fs")) { if (!strcmp(argv[i], "-fs")) {
printf("Fullscreen mode enabled.\n"); printf("Fullscreen mode enabled.\n");
fullscreen = B_TRUE; fullscreen = B_TRUE;
} else if (!strcmp(argv[i], "-v")) {
printf("%s\n",progname);
exit(1);
} else if (!strcmp(argv[i], "-d")) { } else if (!strcmp(argv[i], "-d")) {
if (++i >= argc) { if (++i >= argc) {
printf("Missing data dir.\n"); printf("Missing data dir.\n");
@ -247,8 +253,6 @@ int main (int argc, char **argv) {
datadir = strdup("data"); datadir = strdup("data");
} }
// set program name (including version string)
sprintf(progname, "Rat Catcher v0.%d", REV);
initsdl(); initsdl();
if (TTF_Init()) { if (TTF_Init()) {