tFixes so that things compile with --disable-networking again. - vaccinewars - be a doctor and try to vaccinate the world
 (HTM) git clone git://src.adamsgaard.dk/vaccinewars
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 7cc115b833d05c9317307d467d49e96f7f9a5ae0
 (DIR) parent 7b2ffa7e8e6934a5832640e0202acce9240f8738
 (HTM) Author: Ben Webb <ben@salilab.org>
       Date:   Wed, 16 Jun 2004 20:38:19 +0000
       
       Fixes so that things compile with --disable-networking again.
       
       
       Diffstat:
         M src/AIPlayer.c                      |       2 +-
         M src/admin.c                         |       2 +-
         M src/admin.h                         |       2 +-
         M src/dopewars.c                      |       9 +++++++++
         M src/serverside.c                    |      38 ++++++++++++++++----------------
       
       5 files changed, 31 insertions(+), 22 deletions(-)
       ---
 (DIR) diff --git a/src/AIPlayer.c b/src/AIPlayer.c
       t@@ -685,7 +685,7 @@ void AISendRandomMessage(Player *AIPlay)
         * Whoops - the user asked that we run an AI player, but the binary was
         * built without that compiled in.
         */
       -void AIPlayerLoop()
       +void AIPlayerLoop(struct CMDLINE *cmdline)
        {
          g_print(_("This binary has been compiled without networking support, "
                    "and thus cannot act as an AI player.\nRecompile passing "
 (DIR) diff --git a/src/admin.c b/src/admin.c
       t@@ -24,7 +24,7 @@
        #include <config.h>
        #endif
        
       -#ifndef CYGWIN
       +#if !defined(CYGWIN) && defined(NETWORKING)
        #include <sys/types.h>
        #include <sys/socket.h>
        #include <sys/un.h>
 (DIR) diff --git a/src/admin.h b/src/admin.h
       t@@ -27,7 +27,7 @@
        #include <config.h>
        #endif
        
       -#ifndef CYGWIN
       +#if !defined(CYGWIN) && defined(NETWORKING)
        
        struct CMDLINE;
        void AdminServer(struct CMDLINE *cmdline);
 (DIR) diff --git a/src/dopewars.c b/src/dopewars.c
       t@@ -2848,9 +2848,11 @@ void InitConfiguration(struct CMDLINE *cmdline)
          if (cmdline->setport) {
            Port = cmdline->port;
          }
       +#ifdef NETWORKING
          if (cmdline->server) {
            MetaServer.Active = cmdline->notifymeta;
          }
       +#endif
          WantAntique = cmdline->antique;
        
          if (!cmdline->version && !cmdline->help && !cmdline->ai
       t@@ -2976,7 +2978,14 @@ int main(int argc, char *argv[])
          if (cmdline->version || cmdline->help) {
            HandleHelpTexts(cmdline->help);
          } else if (cmdline->admin) {
       +#ifdef NETWORKING
            AdminServer(cmdline);
       +#else
       +    g_print(_("This binary has been compiled without networking "
       +              "support, and thus cannot run\nin admin mode. "
       +              "Recompile passing --enable-networking to the "
       +              "configure script.\n"));
       +#endif
          } else if (cmdline->convert) {
            ConvertHighScoreFile(cmdline->convertfile);
          } else {
 (DIR) diff --git a/src/serverside.c b/src/serverside.c
       t@@ -741,25 +741,6 @@ void PrintHelpTo(FILE *fp)
          g_string_free(VarName, TRUE);
        }
        
       -static NetworkBuffer *reply_netbuf;
       -static void ServerReply(const gchar *msg)
       -{
       -  int msglen;
       -  gchar *msgcp;
       -
       -  if (reply_netbuf) {
       -    msglen = strlen(msg);
       -    while (msglen > 0 && msg[msglen - 1] == '\n')
       -      msglen--;
       -    if (msglen > 0) {
       -      msgcp = g_strndup(msg, msglen);
       -      QueueMessageForSend(reply_netbuf, msgcp);
       -      g_free(msgcp);
       -    }
       -  } else
       -    g_print(msg);
       -}
       -
        /* 
         * Displays a simple help screen listing the server commands and options.
         */
       t@@ -784,6 +765,25 @@ void ServerHelp(void)
        }
        
        #if NETWORKING
       +static NetworkBuffer *reply_netbuf;
       +static void ServerReply(const gchar *msg)
       +{
       +  int msglen;
       +  gchar *msgcp;
       +
       +  if (reply_netbuf) {
       +    msglen = strlen(msg);
       +    while (msglen > 0 && msg[msglen - 1] == '\n')
       +      msglen--;
       +    if (msglen > 0) {
       +      msgcp = g_strndup(msg, msglen);
       +      QueueMessageForSend(reply_netbuf, msgcp);
       +      g_free(msgcp);
       +    }
       +  } else
       +    g_print(msg);
       +}
       +
        /* 
         * Creates a pid file (if "PidFile" is non-NULL) and writes the process
         * ID into it.