4 #include <sys/select.h>
7 #define MAX_ARRAY(x) (x ? x : 20000)
8 #define CHECK(x) if (!x) {fprintf(stderr,"xdr failed"); exit(1);}
13 xdrstdio_create(&xdrs
, stdin
, XDR_DECODE
);
23 xdrstdio_create(&xdrs
, stdin
, XDR_DECODE
);
25 CHECK(xdr_array(&xdrs
,&t
,&t_length
, MAX_ARRAY(t_length
),
26 sizeof(double),xdr_double
));
27 CHECK(xdr_int(&xdrs
,&ldt
));
28 CHECK(xdr_int(&xdrs
,&n
));
29 CHECK(xdr_array(&xdrs
,&det
,&det_length
, MAX_ARRAY(det_length
),
30 sizeof(double),xdr_double
));
31 if (det_length
!= 2)fprintf(stderr
,"Wrong length for det ");
32 CHECK(xdr_int(&xdrs
,&job
));
33 CHECK(xdr_int(&xdrs
,&info
));
34 /* invoke the function */
36 dtrdi_(t
,&ldt
,&n
,det
,&job
,&info
);
38 /* write the results out */
39 xdrstdio_create(&xdrs
, stdout
, XDR_ENCODE
);
40 CHECK(xdr_array(&xdrs
,&t
,&t_length
, MAX_ARRAY(t_length
),
41 sizeof(double),xdr_double
));
42 CHECK(xdr_array(&xdrs
,&det
,&det_length
, MAX_ARRAY(det_length
),
43 sizeof(double),xdr_double
));
44 CHECK(xdr_int(&xdrs
,&info
));