Complete.Org: Mailing Lists: Archives: freeciv-dev: July 1999:
[Freeciv-Dev] MFC diffs v2 resend
Home

[Freeciv-Dev] MFC diffs v2 resend

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv developers mailing list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] MFC diffs v2 resend
From: Andy Black <ablack@xxxxxxxxxxxxxx>
Date: Fri, 2 Jul 1999 18:29:47 -0600 (MDT)

Hi

Attached are the unified difs generated by the CVS program I use.

Andy
Index: sernet.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/sernet.c,v
retrieving revision 1.15
diff -u -2 -r1.15 sernet.c
--- sernet.c    1999/06/12 07:42:02     1.15
+++ sernet.c    1999/07/02 00:55:08
@@ -18,8 +18,10 @@
 
 #include <unistd.h>
+#if !(defined(GENERATING68K) || defined(GENERATINGPPC)) /* non mac header(s) */
 #include <sys/signal.h>
 #include <sys/types.h>
 #include <sys/time.h>
 #include <pwd.h>
+#endif
 
 #if defined(AIX) || defined(__EMX__)
@@ -29,4 +31,5 @@
 #include <signal.h>
 
+#if !(defined(GENERATING68K) || defined(GENERATINGPPC)) /* non mac header(s) */
 #include <sys/socket.h>
 #include <netdb.h>
@@ -34,4 +37,5 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#endif
 
 #include "log.h"
@@ -48,7 +52,13 @@
 
 struct connection connections[MAX_CONNECTIONS];
+
+#if (defined(GENERATING68K) || defined(GENERATINGPPC)) /* mac network globals 
*/
+TEndpointInfo serv_info;
+EndpointRef serv_ep;
+#else
 int sock;
 extern int errno;
 extern int port;
+#endif
 extern int force_end_of_sniff;
 
Index: shared.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/shared.h,v
retrieving revision 1.53
diff -u -2 -r1.53 shared.h
--- shared.h    1999/06/17 13:07:55     1.53
+++ shared.h    1999/07/02 00:56:37
@@ -66,3 +66,9 @@
 char *datafilename_required(char *filename);
 
+/*Mac constants-resource IDs*/
+enum DITL_ids{
+  kChatDITL=133,
+  kCityDITL=140
+};
+
 #endif  /* FC__SHARED_H */
Index: shared.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/shared.c,v
retrieving revision 1.19
diff -u -2 -r1.19 shared.c
--- shared.c    1999/06/17 12:11:53     1.19
+++ shared.c    1999/07/02 00:56:37
@@ -21,6 +21,10 @@
 #include <assert.h>
 
+#if (defined(GENERATING68K) || defined(GENERATINGPPC)) /* mac header(s) */
+#include <events.h> /* for WaitNextEvent() */
+#else
 #include <sys/time.h>
 #include <sys/types.h>
+#endif
 #include <unistd.h>
 
@@ -283,4 +287,9 @@
 void myusleep(unsigned long usec)
 {
+#if (defined(GENERATING68K) || defined(GENERATINGPPC)) /* mac timeshare 
function */
+  EventRecord the_event;  /* dummy var for timesharing */
+  WaitNextEvent(0, &the_event, GetCaretTime(), nil); /* this is suposed to
+     give other application procseor time for the mac*/
+#else
 #ifndef HAVE_USLEEP
   struct timeval tv;
@@ -291,4 +300,5 @@
 #else
   usleep(usec);
+#endif
 #endif
 }
Index: packets.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.c,v
retrieving revision 1.43
diff -u -2 -r1.43 packets.c
--- packets.c   1999/06/12 07:41:56     1.43
+++ packets.c   1999/07/02 00:56:49
@@ -17,7 +17,9 @@
 #include <unistd.h>
 
+#if !(defined(GENERATING68K) || defined(GENERATINGPPC)) /* non mac header(s) */
 #include <sys/types.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#endif
 
 #include "capability.h"
@@ -1883,5 +1885,5 @@
   if(pc) {
     if(pc->send_buffer.ndata) {
-      if(write(pc->sock, pc->send_buffer.data, pc->send_buffer.ndata)!=
+      if(write(pc->sock, (const char *)pc->send_buffer.data, 
pc->send_buffer.ndata)!=
         pc->send_buffer.ndata) {
        freelog(LOG_NORMAL, "failed writing data to socket");
@@ -1911,5 +1913,5 @@
     }
     else {
-      if(write(pc->sock, data, len)!=len) {
+      if(write(pc->sock, (const char *)data, len)!=len) {
        freelog(LOG_NORMAL, "failed writing data to socket");
        return -1;
@@ -1934,5 +1936,5 @@
   int didget;
 
-  if((didget=read(sock, buffer->data+buffer->ndata, 
+  if((didget=read(sock, (char *)(buffer->data+buffer->ndata), 
                  MAX_PACKET_SIZE-buffer->ndata))<=0)
     return -1;
Index: meta.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/meta.c,v
retrieving revision 1.7
diff -u -2 -r1.7 meta.c
--- meta.c      1999/06/12 07:42:02     1.7
+++ meta.c      1999/07/02 00:54:49
@@ -18,6 +18,9 @@
 #include <string.h>
 #include <time.h>
-
 #include <unistd.h>
+
+#if (defined(GENERATING68K) || defined(GENERATINGPPC)) /* mac network headers 
*/
+#include <OpenTransport.h>
+#else /*LINUX network headers*/
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -25,4 +28,5 @@
 #include <arpa/inet.h>
 #include <netdb.h>
+#endif /*end network header selection*/
 
 #include "packets.h"
@@ -34,23 +38,37 @@
 #endif
 
+#if (defined(GENERATING68K) || defined(GENERATINGPPC)) /* mac network globals 
*/
+TEndpointInfo meta_info;
+EndpointRef meta_ep;
+InetAddress serv_addr;
+#else /*LINUX network globals*/
 extern int errno;
 static int                     sockfd,n,in_size;
 static struct sockaddr_in      cli_addr,serv_addr;
+#endif /*end network global selector*/
 
 int send_to_metaserver(char *desc, char *info)
 {
   unsigned char buffer[MAX_PACKET_SIZE], *cptr;
-  
+#if (defined(GENERATING68K) || defined(GENERATINGPPC)) /* mac alternate 
networking */
+  struct TUnitData xmit;
+  OSStatus err;
+  xmit.udata.maxlen = MAX_PACKET_SIZE;
+  xmit.udata.buf=&buffer;
+#else  
   if(sockfd==0)
     return 0;
-
+#endif
   cptr=put_int16(buffer+2,  PACKET_UDP_PCKT);
   cptr=put_string(cptr, desc);
   cptr=put_string(cptr, info);
   put_int16(buffer, cptr-buffer);
-  
-  n=sendto(sockfd, (const void*)buffer, cptr-buffer,0, 
+#if (defined(GENERATING68K) || defined(GENERATINGPPC)) /* mac alternate 
networking */
+  xmit.udata.len=strlen(buffer);
+  err=OTSndUData(meta_ep, &xmit);
+#else
+  n=sendto(sockfd, buffer, cptr-buffer,0, 
           (struct sockaddr *) &serv_addr, sizeof(serv_addr) );
-  
+#endif
   return 1;
 }
@@ -58,5 +76,9 @@
 void server_close_udp(void)
 {
+#if (defined(GENERATING68K) || defined(GENERATINGPPC)) /* mac alternate 
networking */
+  OTUnbind(meta_ep);
+#else
   close(sockfd);
+#endif
 }
 
@@ -64,7 +86,14 @@
 {
   char servername[]=METASERVER_ADDR;
+#if (defined(GENERATING68K) || defined(GENERATINGPPC)) /* mac alternate 
networking */
+  OSStatus err1;
+  OSErr err2;
+  MapperRef ref=OTOpenMapper(OTCreateConfiguration("dnr"), 0, &err1);
+  TLookupRequest request, reply;
+#else
   struct hostent *hp;
   u_int bin;
-      
+#endif
+  
   /*
    * Fill in the structure "serv_addr" with the address of the
@@ -72,4 +101,12 @@
    * is valid, both decimal-dotted and name.
    */
+#if (defined(GENERATING68K) || defined(GENERATINGPPC)) /* mac alternate 
networking */
+  request.udata.len=strlen(servername);
+  request.udata.buf=&servername;
+  err2=OTLookupName(ref, 1, &request, &reply);
+  serv_adr=reply.udata.buf;
+  if((serv_adr.fHost == 0) || (err2 != 0) || (reply.respcount==0)) {
+    {
+#else
   in_size = sizeof(inet_addr(servername));
   bin = inet_addr(servername);
@@ -77,4 +114,5 @@
     {
       if((hp = gethostbyname(servername)) ==NULL) {
+#endif
        perror("Metaserver: address error");
        con_puts(C_METAERROR,"Not reporting to the metaserver in this game.");
@@ -83,14 +121,17 @@
       }
     }
+  /*
+   * Open a UDP socket (an Internet datagram socket).
+   */
+#if (defined(GENERATING68K) || defined(GENERATINGPPC)) /* mac alternate 
networking */
+  meta_ep=OTOpenEndpoint(OTCreateConfiguration(kUDPName), 0, &meta_info, 
&err1);
+  if (err1 != 0) {
+#else  
   memset(&serv_addr, 0, sizeof(serv_addr));
   serv_addr.sin_family      = AF_INET;
   serv_addr.sin_port        = htons(METASERVER_PORT);
   memcpy(&serv_addr.sin_addr, hp->h_addr, hp->h_length); 
-  
-  /*
-   * Open a UDP socket (an Internet datagram socket).
-   */
-  
   if((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+#endif
     perror("metaserver: can't open datagram socket");
     con_puts(C_METAERROR, "Not reporting to the metaserver in this game.");
@@ -102,4 +143,8 @@
    */
   
+#if (defined(GENERATING68K) || defined(GENERATINGPPC)) /* mac alternate 
networking */
+  err=OTBind(meta_ep, NULL, NULL);
+  if (err1 != 0) {
+#else
   memset( &cli_addr, 0, sizeof(cli_addr));     /* zero out */
   cli_addr.sin_family      = AF_INET;
@@ -107,4 +152,5 @@
   cli_addr.sin_port        = htons(0);
   if(bind(sockfd, (struct sockaddr *) &cli_addr, sizeof(cli_addr)) < 0) {
+#endif
     perror("metaserver: can't bind local address");
     con_puts(C_METAERROR, "Not reporting to the metaserver in this game.");
@@ -112,5 +158,4 @@
     return;
   }
-
 }
 
Index: mapgen.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/mapgen.c,v
retrieving revision 1.36
diff -u -2 -r1.36 mapgen.c
--- mapgen.c    1999/06/15 11:47:31     1.36
+++ mapgen.c    1999/07/02 00:55:08
@@ -17,5 +17,4 @@
 
 #include <time.h>
-#include <sys/time.h>
 
 #include "game.h"
Index: civserver.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/civserver.c,v
retrieving revision 1.98
diff -u -2 -r1.98 civserver.c
--- civserver.c 1999/06/22 10:45:48     1.98
+++ civserver.c 1999/07/02 00:55:04
@@ -23,5 +23,9 @@
 
 #include <unistd.h>
+#if (defined(GENERATING68K) || defined(GENERATINGPPC)) /* mac header(s) */
+#include <bool.h> /*from STL, but works w/ c*/
+#else
 #include <sys/types.h>
+#endif
 
 #ifdef __EMX__
@@ -132,5 +136,9 @@
 ...
 **************************************************************************/
+#if (defined(GENERATING68K) || defined(GENERATINGPPC)) /* mac doesn't have 
comand line */
+int main(void)
+#else /*LINUX does*/
 int main(int argc, char *argv[])
+#endif /* end main def selector*/
 {
   int h=0, v=0, n=1;
@@ -142,5 +150,10 @@
   int save_counter=0;
   int loglevel=LOG_NORMAL;
-
+#if (defined(GENERATING68K) || defined(GENERATINGPPC)) /* Mac vars */
+  OSErr err;
+  DialogPtr  optptr;
+  bool done;
+#endif
+#if !(defined(GENERATING68K) || defined(GENERATINGPPC)) /* non mac code */
   if (!getuid() || !geteuid()) {
     fprintf(stderr, "%s: Fatal error: you're trying to run me as superuser!\n",
@@ -149,4 +162,5 @@
     exit(1);
   }
+#endif
 
   strcpy(metaserver_info_line, DEFAULT_META_SERVER_INFO_STRING);
@@ -154,5 +168,75 @@
   /* no  we don't use GNU's getopt or even the "standard" getopt */
   /* yes we do have reasons ;)                                   */
-  
+#if (defined(GENERATING68K) || defined(GENERATINGPPC)) /* Mac Options */
+  optptr=GetNewDialog(128,nil,(WindowPtr)-1);
+  err=SetDialogDefaultItem(optptr, 2);
+  if (err != 0)
+  {
+    exit(1); /*we don't have an error log yet so I just bomb.  Is this 
corect?*/
+  }
+  err=SetDialogTracksCursor(optptr, true);
+  if (err != 0)
+  {
+    exit(1);
+  }
+    
+  while(!done)
+  {
+    Str255 the_string;
+    short the_item, the_type;
+    Handle the_handle;
+    Rect the_rect;
+    OSErr  err;
+    long temp;
+    ModalDialog(0, &the_item);
+    switch (the_item)
+    {
+      case 1:
+        done = true;
+      break;
+      case 2:
+        exit(0);
+      break;
+      case 4:
+        GetDItem( optptr, 4, &the_type, &the_handle, &the_rect);
+        GetIText( the_handle, (unsigned char *)load_filename);
+      break;
+      case 6:
+        GetDItem( optptr, 6, &the_type, &the_handle, &the_rect);
+        GetIText( the_handle, (unsigned char *)gamelog_filename);
+      break;
+      case 8:
+        GetDItem( optptr, 8, &the_type, &the_handle, &the_rect);
+        GetIText( the_handle, (unsigned char *)log_filename);
+      break;
+      case 10:
+        GetDItem( optptr, 10, &the_type, &the_handle, &the_rect);
+        GetIText( the_handle, (unsigned char *)script_filename);
+      break;
+      case 12:
+        GetDItem( optptr, 12, &the_type, &the_handle, &the_rect);
+        GetIText( the_handle, the_string);
+        StringToNum( the_string, &temp);
+        if (temp>0)
+          port=temp;
+      break;
+      case 13:
+        GetDItem(optptr, 13, &the_type, &the_handle, &the_rect);
+        n=GetCtlValue((ControlHandle)the_handle);
+        SetCtlValue((ControlHandle)the_handle, !n);
+      break;
+      case 15:
+      case 16:
+      case 17:
+        GetDItem(optptr, (loglevel+15), &the_type, &the_handle, &the_rect);
+        SetCtlValue((ControlHandle)the_handle, false);
+        loglevel=the_item-15;
+        GetDItem(optptr, the_item, &the_type, &the_handle, &the_rect);
+        SetCtlValue((ControlHandle)the_handle, true);
+      break;
+    }
+  }
+  DisposeDialog(optptr);
+#else  /*non mac options*/  
   i=1;
   while(i<argc) {
@@ -247,5 +331,5 @@
     i++;
   }
-    
+#endif /*end option selector*/
   if(v && !h) {
     fprintf(stderr, FREECIV_NAME_VERSION "\n");
@@ -282,8 +366,19 @@
   gamelog(GAMELOG_NORMAL,"Starting new log");
   
-#if IS_BETA_VERSION
+#if (defined(GENERATING68K) || defined(GENERATINGPPC)) /* mac alternate beta */
+  #if IS_BETA_VERSION
+    con_write(C_COMMENT,"This is an alpha/beta version of MacFreeciv. "
+            " This is based on the 1.8.0 Version of the Freeciv code. "
+            " Send error/bug reports to :%s"
+            " Visit 
http://www.geocities.com/SiliconValley/Orchard/8738/MFC/index.html\n";
+            "for new versions of this project",MAILING_LIST);
+  #endif
+#else
+  #if IS_BETA_VERSION
   con_write(C_COMMENT, "Freeciv 1.8 will be released "
            "third week of March at %s", WEBSITE_URL);
+  #endif
 #endif
+  
   con_flush();
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] MFC diffs v2 resend, Andy Black <=