comparison rogue4/mdport.c @ 284:6376b514a30b

Fix more header-related warnings. This fixes all current default warnings with GCC7 on Linux. That does not mean the code is anywhere close to clean.
author John "Elwin" Edwards
date Fri, 22 Sep 2017 16:24:40 -0400
parents 8b6aba552f6f
children 5b6855d5d089
comparison
equal deleted inserted replaced
283:d71e5e1f49cf 284:6376b514a30b
41 #include <io.h> 41 #include <io.h>
42 #include <conio.h> 42 #include <conio.h>
43 #undef MOUSE_MOVED 43 #undef MOUSE_MOVED
44 #elif defined(__DJGPP__) 44 #elif defined(__DJGPP__)
45 #include <process.h> 45 #include <process.h>
46 #else
47 #include <sys/wait.h>
46 #endif 48 #endif
47 49
48 #ifdef HAVE_PWD_H 50 #ifdef HAVE_PWD_H
49 #include <pwd.h> 51 #include <pwd.h>
50 #endif 52 #endif
51 #ifdef HAVE_UNISTD_H 53 #ifdef HAVE_UNISTD_H
52 #include <unistd.h> 54 #include <unistd.h>
53 #endif 55 #endif
54 #ifdef HAVE_UTMPX_H 56 #ifdef HAVE_UTMPX_H
55 #include <utmpx.h> 57 #include <utmpx.h>
58 #endif
59 #ifdef HAVE_ARPA_INET_H
60 #include <arpa/inet.h>
56 #endif 61 #endif
57 62
58 #ifdef __INTERIX 63 #ifdef __INTERIX
59 char *strdup(const char *s); 64 char *strdup(const char *s);
60 #endif 65 #endif
533 int md_endian = 0x01020304; 538 int md_endian = 0x01020304;
534 539
535 unsigned long int 540 unsigned long int
536 md_ntohl(unsigned long int x) 541 md_ntohl(unsigned long int x)
537 { 542 {
538 #ifdef _WIN32 543 #ifndef HAVE_ARPA_INET_H
539 if ( *((char *)&md_endian) == 0x01 ) 544 if ( *((char *)&md_endian) == 0x01 )
540 return(x); 545 return(x);
541 else 546 else
542 return( ((x & 0x000000ffU) << 24) | 547 return( ((x & 0x000000ffU) << 24) |
543 ((x & 0x0000ff00U) << 8) | 548 ((x & 0x0000ff00U) << 8) |
549 } 554 }
550 555
551 unsigned long int 556 unsigned long int
552 md_htonl(unsigned long int x) 557 md_htonl(unsigned long int x)
553 { 558 {
554 #ifdef _WIN32 559 #ifndef HAVE_ARPA_INET_H
555 if ( *((char *)&md_endian) == 0x01 ) 560 if ( *((char *)&md_endian) == 0x01 )
556 return(x); 561 return(x);
557 else 562 else
558 return( ((x & 0x000000ffU) << 24) | 563 return( ((x & 0x000000ffU) << 24) |
559 ((x & 0x0000ff00U) << 8) | 564 ((x & 0x0000ff00U) << 8) |