Split test sims and fun sims into separate directories

New trickcomm test sim was not compiling on the Mac because of
linux only define.

refs #191
This commit is contained in:
Alex Lin 2016-02-25 09:28:25 -06:00
parent 51715a0650
commit b4ad77840e
2 changed files with 9 additions and 3 deletions

View File

@ -4,7 +4,7 @@ TRICK_CXXFLAGS += -I.
S_main: tc_server
tc_server: tc_server.c
${TRICK_CC} ${TRICK_CFLAGS} ${TRICK_SYSTEM_CFLAGS} -I${TRICK_HOME}/trick_source -o $@ $< -L${TRICK_LIB_DIR} -ltrick_comm ${TRICK_EXEC_LINK_LIBS}
${TRICK_CC} -o $@ $<
clean: clean_tc_apps
spotless: clean_tc_apps

View File

@ -7,6 +7,12 @@
#include "test_struct.h"
#if (__linux)
# define TC_NOSIGNAL MSG_NOSIGNAL
#else
# define TC_NOSIGNAL 0
#endif
int main () {
int nbytes ;
TEST_DATA_STRUCT tds ;
@ -34,12 +40,12 @@ int main () {
nbytes = 1 ;
while( nbytes > 0 ) {
nbytes = recvfrom(connection, &tds, sizeof(TEST_DATA_STRUCT),
MSG_NOSIGNAL, (struct sockaddr *) &cliAddr, &cliLen) ;
TC_NOSIGNAL, (struct sockaddr *) &cliAddr, &cliLen) ;
fprintf(stderr, "nbytes = %d\n", nbytes ) ;
fprintf(stderr, "tc_server int1 =%x int2 =%x\n", tds.int1 , tds.int2 ) ;
fprintf(stderr, "tc_server long1=%lx long2=%lx\n", tds.long1 , tds.long2 ) ;
if ( nbytes == sizeof(TEST_DATA_STRUCT)) {
sendto(connection, &tds, sizeof(TEST_DATA_STRUCT), MSG_NOSIGNAL,
sendto(connection, &tds, sizeof(TEST_DATA_STRUCT), TC_NOSIGNAL,
(struct sockaddr *) &remoteServAddr,
(socklen_t) sizeof(struct sockaddr_in)) ;
}