comparison urogue/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 d71e5e1f49cf
children 3b61f1dfcc91
comparison
equal deleted inserted replaced
283:d71e5e1f49cf 284:6376b514a30b
47 #elif defined(__DJGPP__) 47 #elif defined(__DJGPP__)
48 #include <process.h> 48 #include <process.h>
49 #else 49 #else
50 #include <pwd.h> 50 #include <pwd.h>
51 #include <sys/utsname.h> 51 #include <sys/utsname.h>
52 #include <sys/wait.h>
52 #include <unistd.h> 53 #include <unistd.h>
53 #include <utmpx.h> 54 #include <utmpx.h>
54 #endif 55 #endif
55 56
56 #include <ctype.h> 57 #include <ctype.h>
57 #include <stdlib.h> 58 #include <stdlib.h>
58 #include <string.h> 59 #include <string.h>
60
61 #ifdef HAVE_ARPA_INET_H
62 #include <arpa/inet.h>
63 #endif
59 64
60 #if defined(_WIN32) && !defined(__MINGW32__) 65 #if defined(_WIN32) && !defined(__MINGW32__)
61 #define PATH_MAX MAX_PATH 66 #define PATH_MAX MAX_PATH
62 #endif 67 #endif
63 68
542 int md_endian = 0x01020304; 547 int md_endian = 0x01020304;
543 548
544 unsigned long int 549 unsigned long int
545 md_ntohl(unsigned long int x) 550 md_ntohl(unsigned long int x)
546 { 551 {
547 #ifdef _WIN32 552 #ifndef HAVE_ARPA_INET_H
548 if ( *((char *)&md_endian) == 0x01 ) 553 if ( *((char *)&md_endian) == 0x01 )
549 return(x); 554 return(x);
550 else 555 else
551 return( ((x & 0x000000ffU) << 24) | 556 return( ((x & 0x000000ffU) << 24) |
552 ((x & 0x0000ff00U) << 8) | 557 ((x & 0x0000ff00U) << 8) |
558 } 563 }
559 564
560 unsigned long int 565 unsigned long int
561 md_htonl(unsigned long int x) 566 md_htonl(unsigned long int x)
562 { 567 {
563 #ifdef _WIN32 568 #ifndef HAVE_ARPA_INET_H
564 if ( *((char *)&md_endian) == 0x01 ) 569 if ( *((char *)&md_endian) == 0x01 )
565 return(x); 570 return(x);
566 else 571 else
567 return( ((x & 0x000000ffU) << 24) | 572 return( ((x & 0x000000ffU) << 24) |
568 ((x & 0x0000ff00U) << 8) | 573 ((x & 0x0000ff00U) << 8) |