From 85e899484d1c12fc388dcf76967c2832f1defbc5 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Mon, 13 Feb 1995 03:56:18 +0000 Subject: [PATCH] made ca_test.c (more) portable --- src/util/ca_test.c | 79 +++++++++++++++++++++++++++++++--------------- 1 file changed, 53 insertions(+), 26 deletions(-) diff --git a/src/util/ca_test.c b/src/util/ca_test.c index fa76984d1..adc95021f 100644 --- a/src/util/ca_test.c +++ b/src/util/ca_test.c @@ -31,11 +31,18 @@ * to a long * .04 01-14-91 joh documentation * .05 09-14-93 jba added def of print_returned + * .06 01-05-94 joh ANSI C * * make options * -DvxWorks makes a version for VxWorks */ +/* + * ANSI + */ +#include +#include + #ifdef vxWorks #include #endif @@ -43,16 +50,23 @@ #ifndef ERROR #define ERROR -1 #endif + #ifndef OK #define OK 0 #endif -#include -#include +#ifndef LOCAL +#define LOCAL static +#endif -static void printit(); -static void verify(); -static void print_returned(); +#include + +LOCAL int ca_test(char *pname, char *pvalue); +LOCAL int cagft(char *pname); +LOCAL void printit(struct event_handler_args args); +LOCAL int capft(char *pname, char *pvalue); +LOCAL void verify(chid chan_id, int type); +LOCAL void print_returned(short type, char *pbuffer, short count); static long outstanding; @@ -64,9 +78,10 @@ static long outstanding; * parse command line arguments */ #ifndef vxWorks -main(argc,argv) -int argc; -char **argv; +main( +int argc, +char **argv +) { /* @@ -112,9 +127,10 @@ char **argv; * read back the current value * */ -int ca_test(pname, pvalue ) -char *pname; -char *pvalue; +LOCAL int ca_test( +char *pname, +char *pvalue +) { if(pvalue){ @@ -134,8 +150,7 @@ char *pvalue; * * test ca get over the range of CA data types */ -int cagft(pname) -char *pname; +LOCAL int cagft(char *pname) { chid chan_id; int status; @@ -202,10 +217,8 @@ char *pname; /* * PRINTIT() */ -static void printit(args) -struct event_handler_args args; +LOCAL void printit(struct event_handler_args args) { - int i; print_returned( args.type, @@ -224,9 +237,10 @@ struct event_handler_args args; * test ca_put() over a range of data types * */ -int capft(pname,pvalue) -char *pname; -char *pvalue; +LOCAL int capft( +char *pname, +char *pvalue +) { short shortvalue; long longvalue; @@ -354,9 +368,7 @@ skip_rest: * * initiate print out the values in a database access interface structure */ -static void verify(chan_id, type) -chid chan_id; -int type; +LOCAL void verify(chid chan_id, int type) { int status; @@ -374,6 +386,7 @@ int type; outstanding++; } + /* * PRINT_RETURNED @@ -382,10 +395,7 @@ int type; * * switches over the range of CA data types and reports the value */ -static void print_returned(type,pbuffer,count) - short type; - char *pbuffer; - short count; +LOCAL void print_returned(short type, char *pbuffer, short count) { short i; @@ -523,7 +533,12 @@ static void print_returned(type,pbuffer,count) { struct dbr_sts_long *pvalue = (struct dbr_sts_long *)pbuffer; +<<<<<<< ca_test.c + int *plong = &pvalue->value; + +======= dbr_long_t *plong = &pvalue->value; +>>>>>>> 1.11 printf("%2d %2d",pvalue->status,pvalue->severity); if(count==1) printf("\tValue: "); for (i = 0; i < count; i++,plong++){ @@ -620,7 +635,11 @@ static void print_returned(type,pbuffer,count) { struct dbr_time_long *pvalue = (struct dbr_time_long *)pbuffer; +<<<<<<< ca_test.c + int *plong = &pvalue->value; +======= dbr_long_t *plong = &pvalue->value; +>>>>>>> 1.11 printf("%2d %2d",pvalue->status,pvalue->severity); printf("\tTimeStamp: %lx %lx", pvalue->stamp.secPastEpoch, pvalue->stamp.nsec); @@ -720,7 +739,11 @@ static void print_returned(type,pbuffer,count) { struct dbr_gr_long *pvalue = (struct dbr_gr_long *)pbuffer; +<<<<<<< ca_test.c + int *plong = &pvalue->value; +======= dbr_long_t *plong = &pvalue->value; +>>>>>>> 1.11 printf("%2d %2d %.8s",pvalue->status,pvalue->severity, pvalue->units); printf("\n\t%8d %8d %8d %8d %8d %8d", @@ -821,7 +844,11 @@ static void print_returned(type,pbuffer,count) { struct dbr_ctrl_long *pvalue = (struct dbr_ctrl_long *)pbuffer; +<<<<<<< ca_test.c + int *plong = &pvalue->value; +======= dbr_long_t *plong = &pvalue->value; +>>>>>>> 1.11 printf("%2d %2d %.8s",pvalue->status,pvalue->severity, pvalue->units); printf("\n\t%8d %8d %8d %8d %8d %8d",