From 1559091f3b33eb407850a3e2e1dae2eec96fee99 Mon Sep 17 00:00:00 2001 From: Gentoo Date: Fri, 27 May 2022 00:05:48 +1000 Subject: removed distros that are now infected with systemd, plus fixed most compile time errors aside from the gtk ones --- Game.c | 5 ++-- OS.c | 9 +++---- Scorelist.c | 14 ++++++---- UI.c | 3 ++- config.h | 68 ++++++++++++++++++++++++++++++++++++++++++++++ game-strings.h | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ gtk.c | 16 +++++------ pixmaps/arch.xpm | 41 ---------------------------- strings.h | 82 -------------------------------------------------------- x11-athena.c | 6 +++-- x11-motif.c | 6 +++-- 11 files changed, 183 insertions(+), 149 deletions(-) create mode 100644 config.h create mode 100644 game-strings.h delete mode 100644 pixmaps/arch.xpm delete mode 100644 strings.h diff --git a/Game.c b/Game.c index cb36fd1..b67f168 100644 --- a/Game.c +++ b/Game.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include "types.h" @@ -254,8 +255,8 @@ parse_args(int argc, char **argv) { char *endp; int i; - for (i = 1; i < argc; i++) { - if (strncasecmp(argv[i], "-l", 2) == 0) { + for (i = 1; i < argc; ++i) { + if (strncasecmp(argv[i], "-l", (size_t)2) == 0) { if (strlen(argv[i]) == 2 && i == argc - 1) fatal("-l takes an argument"); if (strlen(argv[i]) > 2) diff --git a/OS.c b/OS.c index ee824f4..5fdcdae 100644 --- a/OS.c +++ b/OS.c @@ -4,11 +4,10 @@ #include "OS.h" #include "UI.h" -#define MIN_PC 6 /* OS >= MIN_PC means the OS is a PC OS */ +#define MIN_PC 4 /* OS >= MIN_PC means the OS is a PC OS - now 4 instead of 6, as there are only 6 OS's */ -static const char *osname[] = { "initfail", "arch", "bsd", "centos", "debian", - "gentoo", "mandriva", "openbsd", "slackware", - "suse", "ubuntu"}; +static const char *osname[] = { "initfail", "bsd", + "gentoo", "mandriva", "openbsd", "slackware"}; #define NUM_OS (sizeof(osname) / sizeof(osname[0])) static Picture *os[NUM_OS]; /* array of OS pictures*/ @@ -18,7 +17,7 @@ static MCursor *cursor[NUM_OS]; /* array of OS cursors (drag/drop) */ void OS_load_pix() { unsigned int i; - for (i = 0; i < NUM_OS; i++) { + for (i = 0; i < NUM_OS; ++i) { UI_load_picture(osname[i], 1, &os[i]); if (i != 0) UI_load_cursor(osname[i], CURSOR_OWN_MASK, &cursor[i]); diff --git a/Scorelist.c b/Scorelist.c index 9c2afc6..dba1d6d 100644 --- a/Scorelist.c +++ b/Scorelist.c @@ -22,13 +22,17 @@ Scorelist_read() { int i; if (scorefile != NULL) { - for (i = 0; i < SCORES; i++) - fscanf(scorefile, "%20s%d%d\n", scores[i].name, - &scores[i].level, &scores[i].score); + for (i = 0; i < SCORES; ++i) { + int result = fscanf(scorefile, "%20s%d%d\n", scores[i].name, + &scores[i].level, &scores[i].score); + /* doesn't appear to be too much of an issue if can't read from scorefile */ + if (!result){fprintf(stderr, "Reading from scorefile %s failed!", SCOREFILE);} + } + fclose(scorefile); } else { - for (i = 0; i < SCORES; i++) { + for (i = 0; i < SCORES; ++i) { strcpy(scores[i].name, "Anonymous"); scores[i].level = 0; scores[i].score = 0; @@ -42,7 +46,7 @@ Scorelist_write() { int i; if (scorefile == NULL) return; - for (i = 0; i < SCORES; i++) + for (i = 0; i < SCORES; ++i) fprintf(scorefile, "%-*s %d %d\n", NAMELEN, scores[i].name, scores[i].level, scores[i].score); fclose(scorefile); diff --git a/UI.c b/UI.c index 78b1616..71e9600 100644 --- a/UI.c +++ b/UI.c @@ -1,8 +1,9 @@ #include #include #include +#include -#include "strings.h" +#include "game-strings.h" #include "types.h" #include "util.h" diff --git a/config.h b/config.h new file mode 100644 index 0000000..c1c4b01 --- /dev/null +++ b/config.h @@ -0,0 +1,68 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.in by autoheader. */ +/* Use athena widgets */ +#define USE_ATHENA 1 + +/* Use motif widgets */ +#define USE_MOTIF 1 + +/* Use gtk widgets */ +#define USE_GTK 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if the X Window System is missing or not being used. */ +/* #undef X_DISPLAY_MISSING */ + +/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a + `char[]'. */ +#define YYTEXT_POINTER 1 + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ diff --git a/game-strings.h b/game-strings.h new file mode 100644 index 0000000..a07d138 --- /dev/null +++ b/game-strings.h @@ -0,0 +1,82 @@ +#ifndef STRINGS_H +#define STRINGS_H + +/* + * Dialog boxes + */ + +#define newgame_dialog_str "New Game?" +#define pause_dialog_str "Game paused. Press Continue to continue." +#define warp_dialog_str "Warp to level?" +#define quit_dialog_str "Quit Game?" + +#define story_dialog_str \ +"The Story:\n\ +\n\ +Yet again, the fate of the world rests\n\ +in your hands! An evil computer hacker,\n\ +known only by his handle 'Lennart', has\n\ +created the ultimate computer virus. A\n\ +virus so powerful that it has the power\n\ +to transmute an ordinary computer into\n\ +a toaster oven. (oooh!) 'Lennart' has\n\ +cloned himself into a billion-jillion\n\ +micro-Lenns. Their sole purpose is to\n\ +deliver the nefarious virus, which has\n\ +been cleverly diguised as a popular\n\ +init system.\n\ +\n\ +As System Administrator/Exterminator,\n\ +your job is to keep Lennart from succeeding\n\ +at his task." + +#define rules_dialog_str \ +"The Rules:\n\ +\n\ +xBill was painstakingly designed and\n\ +researched in order to make it as easy to use\n\ +for the whole family as it is for little Sally.\n\ +Years - nay - days of beta testing and \n\ +consulting with the cheapest of human interface\n\ +designers have resulted in a game that is easy\n\ +to use, yet nothing at all like a Macintosh.\n\ +This is exactly like xBill so you get the idea.\n\ +\n\ +I. Whack the Lenns (click)\n\ +II. Restart the computer (click)\n\ +III. Pick up stolen Distros & return (drag)\n\ + them to their respective computers\n\ +IV. Drag the bucket to extinguish sparks\n\ +V. Scoring is based on total uptime,\n\ + with bonuses for killing Lenns.\n\ +\n\ +As for the rest, you can probably figure\n\ +it out. We did, so it can't be too hard." + +#define endgame_dialog_str \ +"Module XLennart has caused a segmentation fault\n\ +at memory address 097E:F1A0. Core dumped.\n\ +\n\ +We apologize for the inconvenience." + +#define entername_dialog_str "You earned a high score.\nEnter your name:" + + +/* + * Menus + */ +#define newgame_menu_str "New Game" +#define pause_menu_str "Pause Game" +#define warp_menu_str "Warp to level..." +#define highscore_menu_str "View High Scores" +#define quit_menu_str "Quit Game" + +#define story_menu_str "Story of XLennart" +#define rules_menu_str "Rules" +#define about_menu_str "About XLennart" + +#define score_menu_str "Score" +#define endgame_menu_str "End Game" +#define entername_menu_str "Enter Name" + +#endif diff --git a/gtk.c b/gtk.c index 88a8bf8..5aa0238 100644 --- a/gtk.c +++ b/gtk.c @@ -165,16 +165,16 @@ timer_tick(gpointer arg) { */ #include "bitmaps/initfail.xbm" -#include "bitmaps/arch.xbm" +//#include "bitmaps/arch.xbm" #include "bitmaps/bsd.xbm" -#include "bitmaps/centos.xbm" -#include "bitmaps/debian.xbm" +//#include "bitmaps/centos.xbm" +//#include "bitmaps/debian.xbm" #include "bitmaps/gentoo.xbm" #include "bitmaps/mandriva.xbm" #include "bitmaps/openbsd.xbm" #include "bitmaps/slackware.xbm" -#include "bitmaps/suse.xbm" -#include "bitmaps/ubuntu.xbm" +//#include "bitmaps/suse.xbm" +//#include "bitmaps/ubuntu.xbm" #include "bitmaps/bucket.xbm" #include "bitmaps/hand_down.xbm" #include "bitmaps/hand_down_mask.xbm" @@ -194,10 +194,8 @@ typedef struct cursormap { {#x, x ## _width, x ## _height, x ## _bits, x ## _mask_bits} static cursormap cursors[] = { - CURSOR_ADD(arch), CURSOR_ADD( bsd), CURSOR_ADD(centos), - CURSOR_ADD(debian), CURSOR_ADD(gentoo), CURSOR_ADD(mandriva), - CURSOR_ADD(openbsd), CURSOR_ADD(slackware), CURSOR_ADD(suse), - CURSOR_ADD(ubuntu), CURSOR_ADD(bucket), + CURSOR_ADD( bsd), CURSOR_ADD(gentoo), CURSOR_ADD(mandriva), + CURSOR_ADD(openbsd), CURSOR_ADD(slackware), CURSOR_ADD(bucket), CURSOR_ADD_MASKED(hand_up), CURSOR_ADD_MASKED(hand_down), {NULL, 0, 0, NULL, NULL}, }; diff --git a/pixmaps/arch.xpm b/pixmaps/arch.xpm deleted file mode 100644 index d1d990e..0000000 --- a/pixmaps/arch.xpm +++ /dev/null @@ -1,41 +0,0 @@ -/* XPM */ -static char * arch_xpm[] = { -"28 24 14 1", -" c None", -". c #FFFFFF", -"+ c #1692D1", -"@ c #1792D1", -"# c #1692D0", -"$ c #1793D1", -"% c #1592D0", -"& c #1693D1", -"* c #1D95D1", -"= c #1B94D1", -"- c #1894D0", -"; c #1E95D2", -"> c #1792CF", -", c #1693D0", -"............................", -".............+@.............", -".............##.............", -"............$$$$............", -"............$$$$............", -"...........$$$$$$...........", -"...........$$$$$$...........", -".............$$$$$..........", -"..........%&..$$$$..........", -".........$$$$+#$$$$.........", -".........$$$$$$$$$$.........", -"........*$$$$$$$$$$$........", -"........#$$$$$$$$$$$........", -".......=$$$$$$$$$$$$$.......", -".......$$$$$$..$$$$$#.......", -"......-$$$$$....$$..$;......", -"......#$$$#$....$$$$........", -".....>$$$$#......$$&$$......", -".....#$$$$#......$$$$$$.....", -"....,$$$$#........+$$$$$....", -"...$$$$&$...........%$$$$...", -"...$$$$..............$$#@...", -"..$$$..................$$$..", -"............................"}; diff --git a/strings.h b/strings.h deleted file mode 100644 index a07d138..0000000 --- a/strings.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef STRINGS_H -#define STRINGS_H - -/* - * Dialog boxes - */ - -#define newgame_dialog_str "New Game?" -#define pause_dialog_str "Game paused. Press Continue to continue." -#define warp_dialog_str "Warp to level?" -#define quit_dialog_str "Quit Game?" - -#define story_dialog_str \ -"The Story:\n\ -\n\ -Yet again, the fate of the world rests\n\ -in your hands! An evil computer hacker,\n\ -known only by his handle 'Lennart', has\n\ -created the ultimate computer virus. A\n\ -virus so powerful that it has the power\n\ -to transmute an ordinary computer into\n\ -a toaster oven. (oooh!) 'Lennart' has\n\ -cloned himself into a billion-jillion\n\ -micro-Lenns. Their sole purpose is to\n\ -deliver the nefarious virus, which has\n\ -been cleverly diguised as a popular\n\ -init system.\n\ -\n\ -As System Administrator/Exterminator,\n\ -your job is to keep Lennart from succeeding\n\ -at his task." - -#define rules_dialog_str \ -"The Rules:\n\ -\n\ -xBill was painstakingly designed and\n\ -researched in order to make it as easy to use\n\ -for the whole family as it is for little Sally.\n\ -Years - nay - days of beta testing and \n\ -consulting with the cheapest of human interface\n\ -designers have resulted in a game that is easy\n\ -to use, yet nothing at all like a Macintosh.\n\ -This is exactly like xBill so you get the idea.\n\ -\n\ -I. Whack the Lenns (click)\n\ -II. Restart the computer (click)\n\ -III. Pick up stolen Distros & return (drag)\n\ - them to their respective computers\n\ -IV. Drag the bucket to extinguish sparks\n\ -V. Scoring is based on total uptime,\n\ - with bonuses for killing Lenns.\n\ -\n\ -As for the rest, you can probably figure\n\ -it out. We did, so it can't be too hard." - -#define endgame_dialog_str \ -"Module XLennart has caused a segmentation fault\n\ -at memory address 097E:F1A0. Core dumped.\n\ -\n\ -We apologize for the inconvenience." - -#define entername_dialog_str "You earned a high score.\nEnter your name:" - - -/* - * Menus - */ -#define newgame_menu_str "New Game" -#define pause_menu_str "Pause Game" -#define warp_menu_str "Warp to level..." -#define highscore_menu_str "View High Scores" -#define quit_menu_str "Quit Game" - -#define story_menu_str "Story of XLennart" -#define rules_menu_str "Rules" -#define about_menu_str "About XLennart" - -#define score_menu_str "Score" -#define endgame_menu_str "End Game" -#define entername_menu_str "Enter Name" - -#endif diff --git a/x11-athena.c b/x11-athena.c index 49453b9..c3989d9 100644 --- a/x11-athena.c +++ b/x11-athena.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "util.h" @@ -31,7 +32,8 @@ static void popup(Widget w, XtPointer client_data, XtPointer call_data) { UNUSED(w); UNUSED(call_data); - x11_athena_popup_dialog((int)client_data); + /* int casted to needs to match size of pointer */ + x11_athena_popup_dialog((intptr_t)client_data); } static Widget @@ -39,7 +41,7 @@ new_menu_item(Widget pshell, int dialog) { Widget menu_item = XtCreateManagedWidget(UI_menu_string(dialog), smeBSBObjectClass, pshell, NULL, 0); - XtAddCallback(menu_item, XtNcallback, popup, (void *) dialog); + XtAddCallback(menu_item, XtNcallback, popup, (XtPointer)&dialog); return menu_item; } diff --git a/x11-motif.c b/x11-motif.c index b1af1b0..827f444 100644 --- a/x11-motif.c +++ b/x11-motif.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "util.h" @@ -32,7 +33,8 @@ static void popup(Widget w, XtPointer client_data, XtPointer call_data) { UNUSED(w); UNUSED(call_data); - x11_motif_popup_dialog((int)client_data); + /* it appears that a pointer needs to be casted to an int of the same size here */ + x11_motif_popup_dialog((intptr_t)client_data); } static Widget @@ -40,7 +42,7 @@ new_menu_item(Widget pulldown, int dialog) { Widget menu_item = XtCreateManagedWidget(UI_menu_string(dialog), xmPushButtonWidgetClass, pulldown, NULL, 0); - XtAddCallback(menu_item, XmNactivateCallback, popup, (void *) dialog); + XtAddCallback(menu_item, XmNactivateCallback, popup, (XtPointer)&dialog); return menu_item; } -- cgit v1.2.3