Properly fix the LP64 issue in the application resource handling rather
than praying that globals end up in the lower 32-bit address space. Add a number of missing includes, missing prototypes, etc.
This commit is contained in:
parent
45411f154f
commit
b3bf4f319f
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=397338
@ -3,7 +3,7 @@
|
||||
|
||||
PORTNAME= xpipeman
|
||||
PORTVERSION= 1.0
|
||||
PORTREVISION= 3
|
||||
PORTREVISION= 4
|
||||
CATEGORIES= games
|
||||
MASTER_SITES= SUNSITE/games/strategy
|
||||
DISTNAME= ${PORTNAME}
|
||||
@ -11,9 +11,6 @@ DISTNAME= ${PORTNAME}
|
||||
MAINTAINER= ports@FreeBSD.org
|
||||
COMMENT= Connect the pipes to stop the leaks
|
||||
|
||||
# LP64 issues
|
||||
ONLY_FOR_ARCHS= i386 amd64
|
||||
|
||||
USES= imake tar:Z
|
||||
USE_XORG= x11 xaw xext xmu xt sm ice
|
||||
CFLAGS+= -Wno-error=return-type
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ./Imakefile.orig 1992-07-28 23:56:27.000000000 +0000
|
||||
+++ ./Imakefile 2013-05-31 12:26:22.000000000 +0000
|
||||
--- Imakefile.orig 1992-07-28 23:56:27 UTC
|
||||
+++ Imakefile
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
- SCORE_FILE = -DSCORE_FILE=\"/usr/games/lib/xpipescores\"
|
||||
@ -20,7 +20,7 @@
|
||||
all:: xpipeman
|
||||
|
||||
ComplexProgramTarget(xpipeman)
|
||||
@@ -19,4 +22,3 @@
|
||||
@@ -19,4 +22,3 @@ ComplexProgramTarget(xpipeman)
|
||||
* InstallManPage(xpipeman,$(MANDIR))
|
||||
* InstallProgram(xpipeman,$(BINDIR))
|
||||
*/
|
||||
|
62
games/xpipeman/files/patch-game.c
Normal file
62
games/xpipeman/files/patch-game.c
Normal file
@ -0,0 +1,62 @@
|
||||
--- game.c.orig 1991-09-13 20:32:11 UTC
|
||||
+++ game.c
|
||||
@@ -35,6 +35,7 @@
|
||||
*/
|
||||
|
||||
#include <X11/Intrinsic.h>
|
||||
+#include <stdlib.h>
|
||||
#include "xpipeman.h"
|
||||
|
||||
/* some of these are global */
|
||||
@@ -442,7 +443,7 @@ new_level()
|
||||
blkrstart=0;
|
||||
blkfull = STARTFULL;
|
||||
|
||||
- if (current_callback != NULL)
|
||||
+ if (current_callback != 0)
|
||||
XtRemoveTimeOut(current_callback);
|
||||
current_callback = XtAddTimeOut(flow_time_start,show_when_flow,NULL);
|
||||
|
||||
@@ -458,7 +459,7 @@ new_level()
|
||||
void
|
||||
speed_up_flow()
|
||||
{ int i;
|
||||
- if (current_callback != NULL)
|
||||
+ if (current_callback != 0)
|
||||
XtRemoveTimeOut(current_callback);
|
||||
flow_time = FASTFLOW;
|
||||
current_callback= XtAddTimeOut(flow_time,draw_flow,NULL);
|
||||
@@ -515,13 +516,13 @@ XtIntervalId *id;
|
||||
}
|
||||
if (start_flowing)
|
||||
{
|
||||
- if (current_callback != NULL)
|
||||
+ if (current_callback != 0)
|
||||
XtRemoveTimeOut(current_callback);
|
||||
current_callback = XtAddTimeOut(flow_time_start,draw_flow,NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
- if (current_callback != NULL)
|
||||
+ if (current_callback != 0)
|
||||
XtRemoveTimeOut(current_callback);
|
||||
current_callback = XtAddTimeOut(flow_time_start,show_when_flow,NULL);
|
||||
}
|
||||
@@ -533,7 +534,7 @@ draw_flow(data,id)
|
||||
caddr_t data;
|
||||
XtIntervalId *id;
|
||||
{
|
||||
- current_callback = NULL;
|
||||
+ current_callback = 0;
|
||||
if (blktime < 2)
|
||||
{
|
||||
pipe_board[flow_x][flow_y] = blkrstart++;
|
||||
@@ -584,7 +585,7 @@ increment_flow()
|
||||
|
||||
if (failed) {
|
||||
buttons_disabled = 1;
|
||||
- if (current_callback != NULL)
|
||||
+ if (current_callback != 0)
|
||||
XtRemoveTimeOut(current_callback);
|
||||
current_callback = XtAddTimeOut(3000,level_over,NULL);
|
||||
}
|
22
games/xpipeman/files/patch-graphics.c
Normal file
22
games/xpipeman/files/patch-graphics.c
Normal file
@ -0,0 +1,22 @@
|
||||
--- graphics.c.orig 1991-09-13 20:32:11 UTC
|
||||
+++ graphics.c
|
||||
@@ -63,8 +63,8 @@ init_pixmaps(top_shell)
|
||||
|
||||
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
|
||||
|
||||
- fgcolor.pixel = fg;
|
||||
- bgcolor.pixel = bg;
|
||||
+ fgcolor.pixel = app_data.fg;
|
||||
+ bgcolor.pixel = app_data.bg;
|
||||
fgcolor.flags = DoRed | DoGreen | DoBlue;
|
||||
bgcolor.flags = DoRed | DoGreen | DoBlue;
|
||||
XQueryColor(display,DefaultColormapOfScreen(XtScreen(playfield_widget)), &fgcolor);
|
||||
@@ -444,7 +444,7 @@ void free_pixmaps()
|
||||
{
|
||||
int i;
|
||||
|
||||
- for(i=0;i++;i<NUM_TMP_CURSOR_PIXMAPS)
|
||||
+ for(i=0;i<NUM_TMP_CURSOR_PIXMAPS;i++)
|
||||
XFreePixmap(display,tmp_pixmap[i]);
|
||||
|
||||
}
|
@ -1,43 +1,100 @@
|
||||
--- ./main.c.orig 1991-09-13 20:32:10.000000000 +0000
|
||||
+++ ./main.c 2013-05-31 10:39:59.000000000 +0000
|
||||
@@ -146,21 +146,11 @@
|
||||
{"-scorefile","scorefile",XrmoptionSepArg, NULL },
|
||||
--- main.c.orig 1991-09-13 20:32:10 UTC
|
||||
+++ main.c
|
||||
@@ -53,6 +53,9 @@
|
||||
#endif
|
||||
|
||||
|
||||
+#include <stdlib.h>
|
||||
+#include <stdio.h>
|
||||
+#include <unistd.h>
|
||||
#include "xpipeman.h"
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
@@ -138,9 +141,7 @@ static XtActionsRec actions[] = {
|
||||
{"do_nothing",(XtActionProc)do_nothing_action},
|
||||
};
|
||||
|
||||
-static XtResource application_resources[] = {
|
||||
- {"foreground", "Foreground", XtRPixel, sizeof(Pixel),
|
||||
-Pixel fg, bg;
|
||||
-
|
||||
-XtTranslations translations;
|
||||
+AppData app_data;
|
||||
|
||||
static XrmOptionDescRec options[] = {
|
||||
{"-scorefile","scorefile",XrmoptionSepArg, NULL },
|
||||
@@ -148,19 +149,20 @@ static XrmOptionDescRec options[] = {
|
||||
|
||||
static XtResource application_resources[] = {
|
||||
{"foreground", "Foreground", XtRPixel, sizeof(Pixel),
|
||||
- (Cardinal)&fg, XtRString, (caddr_t) "Black"},
|
||||
- {"background", "Background", XtRPixel, sizeof(Pixel),
|
||||
+ XtOffsetOf(AppData, fg), XtRString, (caddr_t) "Black"},
|
||||
{"background", "Background", XtRPixel, sizeof(Pixel),
|
||||
- (Cardinal)&bg, XtRString, (caddr_t) "White"},
|
||||
- {"translations","Translations", XtRTranslationTable, sizeof(XtTranslations),
|
||||
+ XtOffsetOf(AppData, bg), XtRString, (caddr_t) "White"},
|
||||
{"translations","Translations", XtRTranslationTable, sizeof(XtTranslations),
|
||||
- (Cardinal)&translations, XtRString, (caddr_t)translations_str},
|
||||
- {"scorefile","Scorefile", XtRString, sizeof(String),
|
||||
+ XtOffsetOf(AppData, translations), XtRString, (caddr_t)translations_str},
|
||||
{"scorefile","Scorefile", XtRString, sizeof(String),
|
||||
- (Cardinal)&score_filename, XtRString, (caddr_t)SCORE_FILE},
|
||||
-};
|
||||
+ XtOffsetOf(AppData, score_filename), XtRString, (caddr_t)SCORE_FILE},
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
+int
|
||||
main(argc, argv)
|
||||
- unsigned int argc;
|
||||
+ int argc;
|
||||
char **argv;
|
||||
{
|
||||
Arg args[1];
|
||||
@@ -168,6 +158,17 @@
|
||||
Widget quit_command,
|
||||
new_game_command;
|
||||
@@ -170,14 +172,14 @@ main(argc, argv)
|
||||
|
||||
+XtResource application_resources[] = {
|
||||
+ {"foreground", "Foreground", XtRPixel, sizeof(Pixel),
|
||||
+ (Cardinal)&fg, XtRString, (caddr_t) "Black"},
|
||||
+ {"background", "Background", XtRPixel, sizeof(Pixel),
|
||||
+ (Cardinal)&bg, XtRString, (caddr_t) "White"},
|
||||
+ {"translations","Translations", XtRTranslationTable, sizeof(XtTranslations),
|
||||
+ (Cardinal)&translations, XtRString, (caddr_t)translations_str},
|
||||
+ {"scorefile","Scorefile", XtRString, sizeof(String),
|
||||
+ (Cardinal)&score_filename, XtRString, (caddr_t)SCORE_FILE},
|
||||
+};
|
||||
+
|
||||
srandom(getpid());
|
||||
current_block = 0;
|
||||
current_callback = NULL;
|
||||
- current_callback = NULL;
|
||||
+ current_callback = 0;
|
||||
|
||||
top_shell = XtInitialize(argv[0], "xpipeman", options, XtNumber(options), &argc, argv);
|
||||
XtSetValues(top_shell, arglisttop_shell, XtNumber(arglisttop_shell));
|
||||
|
||||
XtAddActions(actions,XtNumber(actions));
|
||||
|
||||
- XtGetApplicationResources(top_shell, 0, application_resources,
|
||||
+ XtGetApplicationResources(top_shell, &app_data, application_resources,
|
||||
XtNumber(application_resources), NULL, 0 );
|
||||
|
||||
top_widget = XtCreateManagedWidget(
|
||||
@@ -193,7 +195,7 @@ main(argc, argv)
|
||||
arglistplayfield,
|
||||
XtNumber(arglistplayfield));
|
||||
|
||||
- XtAugmentTranslations(playfield_widget,translations);
|
||||
+ XtAugmentTranslations(playfield_widget,app_data.translations);
|
||||
|
||||
quit_command = XtCreateManagedWidget(
|
||||
"quit_button",
|
||||
@@ -263,12 +265,12 @@ main(argc, argv)
|
||||
|
||||
display = XtDisplay(playfield_widget);
|
||||
playfield = XtWindow(playfield_widget);
|
||||
- gcv.foreground = fg;
|
||||
- gcv.background = bg;
|
||||
+ gcv.foreground = app_data.fg;
|
||||
+ gcv.background = app_data.bg;
|
||||
gcv.function = GXcopy;
|
||||
gc = XCreateGC(display, playfield,
|
||||
GCForeground | GCBackground | GCFunction, &gcv);
|
||||
- gcv.foreground = bg;
|
||||
+ gcv.foreground = app_data.bg;
|
||||
cleargc = XCreateGC(display, playfield,
|
||||
GCForeground | GCBackground | GCFunction, &gcv);
|
||||
|
||||
@@ -318,7 +320,7 @@ void
|
||||
update_remain(score)
|
||||
int score;
|
||||
{
|
||||
- char text[13];
|
||||
+ char text[16];
|
||||
(void)sprintf(text,"Remaining: %4d",score);
|
||||
XtSetArg(arglistremain_command[0],XtNlabel,text);
|
||||
XtSetValues(remain_command,arglistremain_command,1);
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- score.c.orig 1991-09-13 22:32:12.000000000 +0200
|
||||
+++ score.c 2011-02-02 19:34:46.908945354 +0100
|
||||
--- score.c.orig 1991-09-13 20:32:12 UTC
|
||||
+++ score.c
|
||||
@@ -50,8 +50,9 @@
|
||||
#include <X11/Xaw/Label.h>
|
||||
#endif
|
||||
@ -11,7 +11,7 @@
|
||||
#include "xpipeman.h"
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
@@ -64,7 +65,7 @@
|
||||
@@ -64,13 +65,12 @@ typedef struct {
|
||||
|
||||
static SCORE scores[MAXSCORES];
|
||||
|
||||
@ -20,7 +20,24 @@
|
||||
new_high_score(),
|
||||
load_scores(),
|
||||
write_out_scores();
|
||||
@@ -198,7 +199,7 @@
|
||||
|
||||
static FILE *scorefile = 0;
|
||||
-char *score_filename;
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
@@ -100,8 +100,8 @@ load_scores()
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
- if( !(scorefile = fopen(score_filename,"r+")) ) {
|
||||
- scorefile = fopen(score_filename, "w");
|
||||
+ if( !(scorefile = fopen(app_data.score_filename,"r+")) ) {
|
||||
+ scorefile = fopen(app_data.score_filename, "w");
|
||||
return;
|
||||
}
|
||||
#ifndef SYSV
|
||||
@@ -198,7 +198,7 @@ static Arg arglist_popdown[] = {
|
||||
|
||||
|
||||
/*ARGSUSED*/
|
||||
|
44
games/xpipeman/files/patch-xpipeman.h
Normal file
44
games/xpipeman/files/patch-xpipeman.h
Normal file
@ -0,0 +1,44 @@
|
||||
--- xpipeman.h.orig 1991-09-13 20:32:14 UTC
|
||||
+++ xpipeman.h
|
||||
@@ -31,6 +31,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
+typedef struct {
|
||||
+ Pixel fg;
|
||||
+ Pixel bg;
|
||||
+ XtTranslations translations;
|
||||
+ char *score_filename;
|
||||
+} AppData;
|
||||
+
|
||||
/*
|
||||
* from main.c
|
||||
*/
|
||||
@@ -39,8 +46,8 @@ extern Window playfield;
|
||||
extern Widget playfield_widget;
|
||||
extern GC gc,
|
||||
cleargc;
|
||||
-extern Pixel fg,
|
||||
- bg;
|
||||
+
|
||||
+extern AppData app_data;
|
||||
|
||||
extern void update_score();
|
||||
extern void update_level();
|
||||
@@ -118,8 +125,6 @@ extern void check_score(),
|
||||
|
||||
extern void show_scores_callback();
|
||||
|
||||
-extern char *score_filename;
|
||||
-
|
||||
/*
|
||||
* from game.c
|
||||
*/
|
||||
@@ -188,4 +193,7 @@ extern void show_level_over_popup(),
|
||||
show_game_over_popup(),
|
||||
level_over_popdown(),
|
||||
game_over_popdown(),
|
||||
+ show_nomore_popup(),
|
||||
+ nomore_popdown(),
|
||||
+ all_popdown(),
|
||||
create_general_popups();
|
Loading…
Reference in New Issue
Block a user