Compatibility with OSX

This commit is contained in:
Christopher Ramey 2015-03-05 20:54:45 +00:00 committed by cdramey
parent 6ccbbdcb5e
commit da47258fa6

View File

@ -41,7 +41,8 @@ int main(int argc, char *argv[])
{ "help", no_argument, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{ NULL, 0, NULL, 0 } { NULL, 0, NULL, 0 }
}; };
int sockfd = 0;
int port = 10800; // Default port int port = 10800; // Default port
uint32_t address = INADDR_ANY; // Default listen address uint32_t address = INADDR_ANY; // Default listen address
@ -92,7 +93,7 @@ int main(int argc, char *argv[])
} }
// Establish the socket // Establish the socket
int sockfd = socket(AF_INET, SOCK_STREAM, 0); sockfd = socket(AF_INET, SOCK_STREAM, 0);
if(sockfd == -1){ if(sockfd == -1){
fprintf(stderr, "%s: cannot open socket - %s\n", fprintf(stderr, "%s: cannot open socket - %s\n",
exec_name, strerror(errno) exec_name, strerror(errno)
@ -191,7 +192,7 @@ int main(int argc, char *argv[])
// to create a filename // to create a filename
char fnbuff[50]; char fnbuff[50];
snprintf(&fnbuff[0], 50, "%s.%ld-%s.dat", snprintf(&fnbuff[0], 50, "%s.%ld-%s.dat",
timebuff, tvtime.tv_usec, timebuff, (long)tvtime.tv_usec,
inet_ntoa(client.sin_addr) inet_ntoa(client.sin_addr)
); );