[Freeciv-Dev] Revised patch supporting BeOS for freeciv (PR#122)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Okay, friends, I've taken Dave Pfitzner's kind advice and produced
a better patch off the top of the CVS tree. The patch follows, as straight
output from `cvs -z3 diff -c`, minus the diffs for the top-level configure.
The responsible party will need to regenerate configure for me -- I've only
got a mid-June GeekGadgets autoconf, and it generates several thousand lines
of differences for configure. (The patch shows the proper revision numbers
for the 'source' files.)
I hit some real weirdnesses while doing this, though. PACKAGE and
VERSION got defined to 1, prompting the aclocal.m4 change. config.h.in and
configure.in changed to handle the new indicator SOCKET_ZERO_ISNT_STDIN.
configure.in also got some other BeOS-specific changes that I figured out
how to make happen there; it's a little gross, so don't look at it hard. :-)
And, of course, server/sernet.c which actually uses SOCKET_ZERO_ISNT_STDIN
to operate correctly when socket zero isn't stdin. Works, too. :-o :-D
(BeOS R4 x86)
Someone please trash my earlier patch, still in incoming as bug#121.
(Maybe Martin?) I'm not able to do that right now.
I fully expect to provide a native BeOS client in the coming weeks.
<plug>You can speed this up by sponsoring my proposal at Cosource (request 11,
under BeOS category).</plug> Patches will trickle out to help set the stage,
then to check-point at each milestone, so that BeOS people can kibitz.
Joseph
principal, Be Do Have Software
----
Joseph Beckenbach III, CCP +1.408.452.0721
Be Do Have Software http://www.jrb3.com/bdh/
===== 8< ===== 8< ===== 8< ===== 8< ===== 8< ===== 8< ===== 8< ===== 8< =====
Index: aclocal.m4
===================================================================
RCS file: /home/freeciv/CVS/freeciv/aclocal.m4,v
retrieving revision 1.11
diff -c -r1.11 aclocal.m4
*** aclocal.m4 1999/08/27 11:21:35 1.11
--- aclocal.m4 1999/09/02 03:04:37
***************
*** 202,209 ****
AC_MSG_ERROR([source directory already configured; run "make distclean"
there first])
fi
ifelse([$3],,
! AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
! AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
AC_REQUIRE([AM_SANITY_CHECK])
AC_REQUIRE([AC_ARG_PROGRAM])
dnl FIXME This is truly gross.
--- 202,209 ----
AC_MSG_ERROR([source directory already configured; run "make distclean"
there first])
fi
ifelse([$3],,
! AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
! AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
AC_REQUIRE([AM_SANITY_CHECK])
AC_REQUIRE([AC_ARG_PROGRAM])
dnl FIXME This is truly gross.
Index: config.h.in
===================================================================
RCS file: /home/freeciv/CVS/freeciv/config.h.in,v
retrieving revision 1.25
diff -c -r1.25 config.h.in
*** config.h.in 1999/08/27 12:17:17 1.25
--- config.h.in 1999/09/02 03:04:38
***************
*** 91,96 ****
--- 91,97 ----
#undef GENERATING_MAC
#undef HAVE_OPENTRANSPORT
#undef PATH_SEPARATOR
+ #undef SOCKET_ZERO_ISNT_STDIN
/* Define if you have the __argz_count function. */
#undef HAVE___ARGZ_COUNT
Index: configure.in
===================================================================
RCS file: /home/freeciv/CVS/freeciv/configure.in,v
retrieving revision 1.71
diff -c -r1.71 configure.in
*** configure.in 1999/08/27 12:17:18 1.71
--- configure.in 1999/09/02 03:04:59
***************
*** 263,268 ****
--- 263,278 ----
CPPFLAGS="$fc_save_CPPFLAGS"
fi
+ dnl BeOS-specific overrides
+ AC_CHECK_PROG(UNAME,uname,uname,:)
+ if test x`$UNAME -s` = xBeOS ; then
+ AC_DEFINE(ALWAYS_ROOT)
+ AC_DEFINE(HAVE_USLEEP)
+ AC_OUTPUT_COMMANDS([echo '#define usleep(us) snooze(us)' >> config.h])
+ AC_DEFINE(SOCKET_ZERO_ISNT_STDIN)
+ AC_OUTPUT_COMMANDS([echo '#undef HAVE_SYS_UIO_H' >> config.h])
+ fi
+
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_HEADER_TIME
cvs server: Diffing ai
cvs server: Diffing client
cvs server: Diffing client/gui-gtk
cvs server: Diffing client/gui-xaw
cvs server: Diffing client/include
cvs server: Diffing common
cvs server: Diffing data
cvs server: Diffing data/civ1
cvs server: Diffing data/civ2
cvs server: Diffing data/classic
cvs server: Diffing data/default
cvs server: Diffing data/trident
cvs server: Diffing debian
cvs server: Diffing gclient
cvs server: Diffing intl
cvs server: Diffing po
cvs server: Diffing server
Index: server/sernet.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/sernet.c,v
retrieving revision 1.27
diff -c -r1.27 sernet.c
*** sernet.c 1999/08/27 22:03:51 1.27
--- sernet.c 1999/09/02 03:05:02
***************
*** 129,134 ****
--- 129,138 ----
struct timeval tv;
static time_t time_at_turn_end;
static int year;
+ #ifdef SOCKET_ZERO_ISNT_STDIN
+ char buf[BUF_SIZE+1];
+ char *bufptr = buf;
+ #endif
if(year!=game.year) {
time_at_turn_end = time(NULL) + game.timeout;
***************
*** 167,172 ****
--- 171,179 ----
con_prompt_off();
return 0;
}
+ #ifdef SOCKET_ZERO_ISNT_STDIN
+ if (feof(stdin))
+ #endif
continue;
}
***************
*** 175,180 ****
--- 182,188 ----
if(server_accept_connection(sock)==-1)
freelog(LOG_NORMAL, "failed accepting connection");
}
+ #ifndef SOCKET_ZERO_ISNT_STDIN
else if(FD_ISSET(0, &readfs)) { /* input from server operator */
int didget;
char buf[BUF_SIZE+1];
***************
*** 187,192 ****
--- 195,215 ----
con_prompt_enter(); /* will need a new prompt, regardless */
handle_stdin_input((struct player *)NULL, buf);
}
+ #else
+ else if(!feof(stdin)) { /* input from server operator */
+ /* fetch chars until \n or run out of space in buffer */
+ while ((*bufptr=fgetc(stdin)) != EOF) {
+ if (*bufptr == '\n') *bufptr = '\0';
+ if (*bufptr == '\0') {
+ bufptr = buf;
+ con_prompt_enter(); /* will need a new prompt, regardless */
+ handle_stdin_input((struct player *)NULL, buf);
+ break;
+ }
+ if ((bufptr-buf) <= BUF_SIZE) bufptr++; /* prevent overrun */
+ }
+ }
+ #endif
else { /* input from a player */
for(i=0; i<MAX_NUM_CONNECTIONS; i++)
if(connections[i].used && FD_ISSET(connections[i].sock, &readfs)) {
- [Freeciv-Dev] Revised patch supporting BeOS for freeciv (PR#122),
jrb3 <=
|
|