* Applied a patch from Igor Khavkine <i_khavki@alcor.concordia.ca> to

make the package build on the Hurd. Closes: #98562


git-svn-id: file:///srv/svn/joey/bsdgames-trunk@5150 a4a2c43b-8ac3-0310-8836-e0e880c912e2
This commit is contained in:
joey
2001-05-24 03:22:47 +00:00
parent 7ce310d047
commit 831647efe0
5 changed files with 110 additions and 10 deletions

7
debian/changelog vendored
View File

@@ -1,3 +1,10 @@
bsdgames (2.12-8) unstable; urgency=low
* Applied a patch from Igor Khavkine <i_khavki@alcor.concordia.ca> to
make the package build on the Hurd. Closes: #98562
-- Joey Hess <joeyh@debian.org> Wed, 23 May 2001 22:49:26 -0400
bsdgames (2.12-7) unstable; urgency=low bsdgames (2.12-7) unstable; urgency=low
* Modified all the rest of the menu items that need a pause after * Modified all the rest of the menu items that need a pause after

View File

@@ -393,7 +393,11 @@ list_drivers()
static SOCKET test; static SOCKET test;
int test_socket; int test_socket;
int namelen; int namelen;
# ifdef MAXHOSTNAMELEN
char local_name[MAXHOSTNAMELEN + 1]; char local_name[MAXHOSTNAMELEN + 1];
# else
char local_name[] = "127.0.0.1";
# endif
static int initial = TRUE; static int initial = TRUE;
static struct in_addr local_address; static struct in_addr local_address;
struct hostent *hp; struct hostent *hp;
@@ -414,11 +418,13 @@ list_drivers()
# ifndef BROADCAST # ifndef BROADCAST
sethostent(1); /* don't bother to close host file */ sethostent(1); /* don't bother to close host file */
# endif # endif
# ifdef MAXHOSTNAMELEN
if (gethostname(local_name, sizeof local_name) < 0) { if (gethostname(local_name, sizeof local_name) < 0) {
leave(1, "Sorry, I have no name."); leave(1, "Sorry, I have no name.");
/* NOTREACHED */ /* NOTREACHED */
} }
local_name[sizeof(local_name) - 1] = '\0'; local_name[sizeof(local_name) - 1] = '\0';
# endif
if ((hp = gethostbyname(local_name)) == NULL) { if ((hp = gethostbyname(local_name)) == NULL) {
leave(1, "Can't find myself."); leave(1, "Can't find myself.");
/* NOTREACHED */ /* NOTREACHED */

View File

@@ -1,4 +1,4 @@
/* $NetBSD: get_names.c,v 1.3 1998/07/06 07:00:31 mrg Exp $ */ /* $NetBSD: get_names.c,v 1.4 2000/07/03 03:57:41 matt Exp $ */
/* /*
* Copyright (c) 1983 Regents of the University of California. * Copyright (c) 1983 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement * All rights reserved. The Berkeley software License Agreement
@@ -7,7 +7,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: get_names.c,v 1.3 1998/07/06 07:00:31 mrg Exp $"); __RCSID("$NetBSD: get_names.c,v 1.4 2000/07/03 03:57:41 matt Exp $");
#endif /* not lint */ #endif /* not lint */
#include "bsd.h" #include "bsd.h"
@@ -17,6 +17,7 @@ __RCSID("$NetBSD: get_names.c,v 1.3 1998/07/06 07:00:31 mrg Exp $");
# include <sys/param.h> # include <sys/param.h>
# include <netdb.h> # include <netdb.h>
# include <stdio.h> # include <stdio.h>
# include <stdlib.h>
# include <string.h> # include <string.h>
# include <unistd.h> # include <unistd.h>
# include "hunt.h" # include "hunt.h"
@@ -24,6 +25,9 @@ __RCSID("$NetBSD: get_names.c,v 1.3 1998/07/06 07:00:31 mrg Exp $");
extern CTL_MSG msg; extern CTL_MSG msg;
/* according to SUSv2, hostnames can't be longer then 256 characters */
#define MAXHOSTNAMELEN 256
static char hostname[MAXHOSTNAMELEN + 1]; static char hostname[MAXHOSTNAMELEN + 1];
char *my_machine_name; char *my_machine_name;

View File

@@ -1,7 +1,34 @@
# Makefrag - makefile fragment for phantasia # Makefrag - makefile fragment for phantasia
#
# Copyright (c) 1997, 1998 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
phantasia_DIRS := $(GAMESDIR) $(MAN6DIR) $(PHANTASIA_DIR) phantasia_DIRS := $(GAMESDIR) $(MAN6DIR) $(PHANTASIA_DIR)
phantasia_VFILES := gold lastdead mess monsters motd characs scoreboard void phantasia_VFILES := gold lastdead mess monsters motd scoreboard void
phantasia_DEFS := -D_GNU_SOURCE
phantasia_all: phantasia/phantasia phantasia/setup phantasia/monsters.asc phantasia/phantasia.6 phantasia_all: phantasia/phantasia phantasia/setup phantasia/monsters.asc phantasia/phantasia.6
@@ -10,5 +37,6 @@ phantasia_install: phantasia_all
$(HIDE_GAME) phantasia $(HIDE_GAME) phantasia
DESTDIR=$(INSTALL_PREFIX) phantasia/setup -m phantasia/monsters.asc DESTDIR=$(INSTALL_PREFIX) phantasia/setup -m phantasia/monsters.asc
(set -e; for f in $(phantasia_VFILES); do $(INSTALL_SCORE_FILE) \ (set -e; for f in $(phantasia_VFILES); do $(INSTALL_SCORE_FILE) \
$(PHANTASIA_DIR)/$$f; done) $(PHANTASIA_DIR)/$$f; done; \
$(INSTALL_SCORE_FILE) -p $(PHANTASIA_DIR)/characs)
$(INSTALL_MANUAL) phantasia/phantasia.6 $(INSTALL_MANUAL) phantasia/phantasia.6

View File

@@ -1,15 +1,16 @@
/* $NetBSD: setup.c,v 1.8 1997/11/24 01:47:26 mrg Exp $ */ /* $NetBSD: setup.c,v 1.10 1999/09/19 18:14:52 jsm Exp $ */
/* /*
* setup.c - set up all files for Phantasia * setup.c - set up all files for Phantasia
*/ */
#include <stdio.h>
#include <sys/param.h> #include <sys/param.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include "include.h" #include "include.h"
int main __P((int, char *[])); int main __P((int, char *[]));
void Error __P((char *, char *)); void Error __P((const char *, const char *)) __attribute__((__noreturn__));
double drandom __P((void)); double drandom __P((void));
/* */ /* */
@@ -44,7 +45,7 @@ double drandom __P((void));
/ /
/ ************************************************************************/ / ************************************************************************/
static char *files[] = { /* all files to create */ static const char *const files[] = { /* all files to create */
_PATH_MONST, _PATH_MONST,
_PATH_PEOPLE, _PATH_PEOPLE,
_PATH_MESS, _PATH_MESS,
@@ -56,19 +57,23 @@ static char *files[] = { /* all files to create */
NULL, NULL,
}; };
char *monsterfile="monsters.asc"; const char *monsterfile = "monsters.asc";
int int
main(argc, argv) main(argc, argv)
int argc; int argc;
char *argv[]; char *argv[];
{ {
register char **filename; /* for pointing to file names */ register const char *const *filename; /* for pointing to file names */
register int fd; /* file descriptor */ register int fd; /* file descriptor */
FILE *fp; /* for opening files */ FILE *fp; /* for opening files */
struct stat fbuf; /* for getting files statistics */ struct stat fbuf; /* for getting files statistics */
int ch; int ch;
#if defined(__GLIBC__)
char *path, *prefix;
#else
char path[MAXPATHLEN], *prefix; char path[MAXPATHLEN], *prefix;
#endif
while ((ch = getopt(argc, argv, "m:")) != -1) while ((ch = getopt(argc, argv, "m:")) != -1)
switch(ch) { switch(ch) {
@@ -93,7 +98,15 @@ main(argc, argv)
while (*filename != NULL) while (*filename != NULL)
/* create each file */ /* create each file */
{ {
#if defined(__GLIBC__)
path = NULL;
asprintf(&path, "%s%s", prefix?prefix:"", *filename);
if (!path)
Error ("Not enough memory to store filename.", "");
/*NOTREACHED*/
#else
snprintf(path, sizeof(path), "%s%s", prefix?prefix:"", *filename); snprintf(path, sizeof(path), "%s%s", prefix?prefix:"", *filename);
#endif
if (stat(path, &fbuf) == 0) if (stat(path, &fbuf) == 0)
/* file exists; remove it */ /* file exists; remove it */
{ {
@@ -123,23 +136,48 @@ main(argc, argv)
close(fd); /* close newly created file */ close(fd); /* close newly created file */
++filename; /* process next file */ ++filename; /* process next file */
#if defined(__GLIBC__)
free (path);
#endif
} }
/* put holy grail info into energy void file */ /* put holy grail info into energy void file */
Enrgyvoid.ev_active = TRUE; Enrgyvoid.ev_active = TRUE;
Enrgyvoid.ev_x = ROLL(-1.0e6, 2.0e6); Enrgyvoid.ev_x = ROLL(-1.0e6, 2.0e6);
Enrgyvoid.ev_y = ROLL(-1.0e6, 2.0e6); Enrgyvoid.ev_y = ROLL(-1.0e6, 2.0e6);
#if defined(__GLIBC__)
path = NULL;
asprintf (&path, "%s%s", prefix?prefix:"", _PATH_VOID);
if (!path)
Error ("Not enough memory to store filename.", "");
/*NOTREACHED*/
#else
snprintf(path, sizeof(path), "%s%s", prefix?prefix:"", _PATH_VOID); snprintf(path, sizeof(path), "%s%s", prefix?prefix:"", _PATH_VOID);
#endif
if ((fp = fopen(path, "w")) == NULL) if ((fp = fopen(path, "w")) == NULL)
Error("Cannot update %s.\n", path); Error("Cannot update %s.\n", path);
else else
{ {
fwrite(&Enrgyvoid, SZ_VOIDSTRUCT, 1, fp); fwrite(&Enrgyvoid, SZ_VOIDSTRUCT, 1, fp);
fflush(fp);
if (ferror(fp))
Error("Writing %s.\n", path);
fclose(fp); fclose(fp);
} }
#if defined(__GLIBC__)
free (path);
#endif
/* create binary monster data base */ /* create binary monster data base */
#if defined(__GLIBC__)
path = NULL;
asprintf (&path, "%s%s", prefix?prefix:"", _PATH_MONST);
if (!path)
Error ("Not enough memory to store filename.", "");
/*NOTREACHED*/
#else
snprintf(path, sizeof(path), "%s%s", prefix?prefix:"", _PATH_MONST); snprintf(path, sizeof(path), "%s%s", prefix?prefix:"", _PATH_MONST);
#endif
if ((Monstfp = fopen(path, "w")) == NULL) if ((Monstfp = fopen(path, "w")) == NULL)
Error("Cannot update %s.\n", path); Error("Cannot update %s.\n", path);
else else
@@ -171,16 +209,30 @@ main(argc, argv)
fwrite((char *) &Curmonster, SZ_MONSTERSTRUCT, 1, Monstfp); fwrite((char *) &Curmonster, SZ_MONSTERSTRUCT, 1, Monstfp);
} }
fclose(fp); fclose(fp);
fflush(Monstfp);
if (ferror(Monstfp))
Error("Writing %s.\n", path);
fclose(Monstfp); fclose(Monstfp);
} }
} }
#if defined(__GLIBC__)
free (path);
#endif
#ifdef MAKE_INSTALLS_THIS_AND_DOESNT_WANT_TO_HEAR_ABOUT_IT #ifdef MAKE_INSTALLS_THIS_AND_DOESNT_WANT_TO_HEAR_ABOUT_IT
/* write to motd file */ /* write to motd file */
printf("One line 'motd' ? "); printf("One line 'motd' ? ");
if (fgets(Databuf, SZ_DATABUF, stdin) == NULL) if (fgets(Databuf, SZ_DATABUF, stdin) == NULL)
Databuf[0] = '\0'; Databuf[0] = '\0';
#if defined(__GLIBC__)
path = NULL;
asprintf (&path, "%s%s", prefix?prefix:"", _PATH_MOTD);
if (!path)
Error ("Not enough memory to store filename.", "");
/*NOTREACHED*/
#else
snprintf(path, sizeof(path), "%s%s", prefix?prefix:"", _PATH_MOTD); snprintf(path, sizeof(path), "%s%s", prefix?prefix:"", _PATH_MOTD);
#endif
if ((fp = fopen(path, "w")) == NULL) if ((fp = fopen(path, "w")) == NULL)
Error("Cannot update %s.\n", path); Error("Cannot update %s.\n", path);
else else
@@ -188,6 +240,9 @@ main(argc, argv)
fwrite(Databuf, sizeof(char), strlen(Databuf), fp); fwrite(Databuf, sizeof(char), strlen(Databuf), fp);
fclose(fp); fclose(fp);
} }
#if defined(__GLIBC__)
free (path);
#endif
/* report compile-time options */ /* report compile-time options */
printf("Compiled options:\n\n"); printf("Compiled options:\n\n");
@@ -242,7 +297,7 @@ main(argc, argv)
void void
Error(str, file) Error(str, file)
char *str, *file; const char *str, *file;
{ {
fprintf(stderr, "Error: "); fprintf(stderr, "Error: ");
fprintf(stderr, str, file); fprintf(stderr, str, file);