r9322 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r9321‎ | r9322 | r9323 >
Date:04:19, 4 June 2005
Author:kateturner
Status:old
Tags:
Comment:
detect XTI automatically instead of relying on __SVR4
Modified paths:
  • /trunk/tools/trickle/Makefile (modified) (history)
  • /trunk/tools/trickle/rdcp.c (modified) (history)
  • /trunk/tools/trickle/rdcp.h (modified) (history)

Diff [purge]

Index: trunk/tools/trickle/rdcp.c
@@ -15,7 +15,10 @@
1616 #ifdef T_STDINT
1717 # include <stdint.h>
1818 #endif
19 -
 19+#include "t_xti.h"
 20+#ifdef T_XTI
 21+# include <xti.h>
 22+#endif
2023 #include "rdcp.h"
2124
2225 #define F_CLOSED 1
@@ -40,7 +43,7 @@
4144 return write(fd, data, size);
4245 }
4346
44 -#ifdef RDCP_SVR4
 47+#ifdef T_XTI
4548 static int
4649 rdcp_internal_send_xti(fd, data, size)
4750 const void *data;
@@ -58,7 +61,7 @@
5962 return read(fd, data, size);
6063 }
6164
62 -#ifdef RDCP_SVR4
 65+#ifdef T_XTI
6366 static int
6467 rdcp_internal_recv_xti(fd, data, size)
6568 void *data;
@@ -109,7 +112,7 @@
110113 if ((handle = malloc(sizeof(struct rdcp_handle))) == NULL)
111114 return NULL;
112115 memset(handle, 0, sizeof(*handle));
113 -#ifdef RDCP_SVR4
 116+#ifdef T_XTI
114117 handle->sendf = rdcp_internal_send_xti;
115118 handle->recvf = rdcp_internal_recv_xti;
116119 #endif
@@ -127,7 +130,7 @@
128131 if (type == ROPT_RDWR) {
129132 handle->sendf = rdcp_internal_send_rdwr;
130133 handle->recvf = rdcp_internal_recv_rdwr;
131 -#ifdef RDCP_SVR4
 134+#ifdef T_XTI
132135 } else if (type == ROPT_XTI) {
133136 handle->sendf = rdcp_internal_send_xti;
134137 handle->recvf = rdcp_internal_recv_xti;
Index: trunk/tools/trickle/Makefile
@@ -1,22 +1,23 @@
22 # @(#) $Header$
33
 4+CFGHDRS=t_stdint.h t_xti.h
45 trickle: trickle.o tar.o proto.o util.o rdcp.o ldflags
56 cc -O -g trickle.o tar.o proto.o util.o rdcp.o -o $@ `cat ldflags`
6 -%.o: %.c Makefile $< t_stdint.h
 7+%.o: %.c Makefile $< $(CFGHDRS)
78 cc -O -g -D_FILE_OFFSET_BITS=64 -c $<
89 clean:
9 - rm -f trickle trickle.o tar.o util.o rdcp.o proto.o ldflags t_stdint.h
 10+ rm -f trickle trickle.o tar.o util.o rdcp.o proto.o ldflags $(CFGHDRS)
1011 t_stdint.h:
11 - rm -f t_stdint.h
12 - touch t_stdint.h
1312 echo "#include <stdint.h>" >test.c
14 - -cc -c -o /dev/null test.c && echo "#define T_STDINT 1" >>t_stdint.h
 13+ -(cc -c -o /dev/null test.c && echo "#define T_STDINT 1") >t_stdint.h
1514 rm -f test.c
 15+t_xti.h:
 16+ echo "#include <xti.h>" >test.c
 17+ -(cc -c -o /dev/null test.c && echo "#define T_XTI 1") >t_xti.h
 18+ rm -f test.c
1619 ldflags:
17 - rm -f ldflags
18 - touch ldflags
19 - echo "main(){}" > test.c
20 - -cc test.c -lsocket -lnsl -o /dev/null && echo -lsocket -lnsl >>ldflags
 20+ echo "int main() { return 0; }" > test.c
 21+ -(cc test.c -lsocket -lnsl -o /dev/null && echo -lsocket -lnsl) >ldflags
2122 rm -f test.c
2223 dist:
2324 mkdir trickle-cvs1
Index: trunk/tools/trickle/rdcp.h
@@ -9,8 +9,7 @@
1010
1111 #include <sys/types.h>
1212
13 -#if defined(__SVR4) || defined(__svr4__)
14 -# define RDCP_SVR4
 13+#ifdef T_XTI
1514 # include <xti.h>
1615 #endif
1716
@@ -54,8 +53,8 @@
5554 * Options.
5655 */
5756 #define ROPT_RDWR 1
58 -#ifdef RDCP_SVR4
59 -#define ROPT_XTI 2
 57+#ifdef T_XTI
 58+# define ROPT_XTI 2
6059 #endif
6160
6261 /*

Status & tagging log