diff --git a/src/libCom/Makefile.Unix b/src/libCom/Makefile.Unix index 0970846ea..1dc611fc0 100644 --- a/src/libCom/Makefile.Unix +++ b/src/libCom/Makefile.Unix @@ -12,7 +12,7 @@ SRCS.c = \ ../genTaskSubr.c ../gpHashLib.c ../helpSubr.c ../memDebugLib.c \ ../nextFieldSubr.c ../postfix.c ../sydSubr.c ../sydSubrCA.c \ ../sydSubrCF.c ../sydSubrSSF.c ../tsSubr.c errSymTbl.c ../errInc.c \ - ../realpath.c + ../realpath.c ../mprintf.c LIBOBJS = \ tsSubr.o arAccessLib.o arCSCheck.o arChanIO.o bfSubr.o bucketLib.o \ @@ -20,7 +20,7 @@ LIBOBJS = \ envSubr.o errMtst.o errSymLib.o errSymTbl.o ezsSockSubr.o fdmgr.o \ freeListLib.o genSubr.o genTaskSubr.o gpHashLib.o helpSubr.o \ memDebugLib.o nextFieldSubr.o postfix.o sydSubr.o sydSubrCA.o \ - sydSubrCF.o sydSubrSSF.o realpath.o + sydSubrCF.o sydSubrSSF.o realpath.o mprintf.o LIBNAME = libCom.a diff --git a/src/libCom/Makefile.Vx b/src/libCom/Makefile.Vx index 66ae7d573..dabc23328 100644 --- a/src/libCom/Makefile.Vx +++ b/src/libCom/Makefile.Vx @@ -9,13 +9,14 @@ SRCS.c = \ ../genTaskSubr.c ../helpSubr.c ../nextFieldSubr.c ../postfix.c \ ../sydSubr.c ../sydSubrCA.c ../sydSubrCF.c ../sydSubrSSF.c \ ../bucketLib.c ../memDebugLib.c ../tsSubr.c ../pal.c \ - ../paldef.c errSymTbl.c + ../paldef.c ../mprintf.c errSymTbl.c OBJS = \ calcPerform.o cvtBpt.o cvtFast.o ellLib.o envSubr.o errSymLib.o \ errSymTbl.o genSubr.o genTaskSubr.o nextFieldSubr.o postfix.o \ - bucketLib.o tsSubr.o gpHashLib.o freeListLib.o pal.o paldef.o + bucketLib.o tsSubr.o gpHashLib.o freeListLib.o pal.o paldef.o \ + mprintf.o OBJS1 = \ cmdSubr.o cvtNumbers.o cvtFast.o ezsSockSubr.o helpSubr.o diff --git a/src/libCom/bucketLib.c b/src/libCom/bucketLib.c index 23371bfb4..93d4ea380 100644 --- a/src/libCom/bucketLib.c +++ b/src/libCom/bucketLib.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -196,7 +197,7 @@ LOCAL ITEM **bucketUnsignedCompare (ITEM **ppi, const void *pId) /* * bucketPointerCompare() */ -ITEM **bucketPointerCompare (ITEM **ppi, const void *pId) +LOCAL ITEM **bucketPointerCompare (ITEM **ppi, const void *pId) { void *ptr; void **pItemId; @@ -219,7 +220,7 @@ ITEM **bucketPointerCompare (ITEM **ppi, const void *pId) /* * bucketStringCompare () */ -ITEM **bucketStringCompare (ITEM **ppi, const void *pId) +LOCAL ITEM **bucketStringCompare (ITEM **ppi, const void *pId) { const char *pStr = pId; ITEM *pi; @@ -241,7 +242,7 @@ ITEM **bucketStringCompare (ITEM **ppi, const void *pId) /* * bucketUnsignedHash () */ -BUCKETID bucketUnsignedHash (BUCKET *pb, const void *pId) +LOCAL BUCKETID bucketUnsignedHash (BUCKET *pb, const void *pId) { const unsigned *pUId = pId; unsigned src; @@ -262,11 +263,10 @@ BUCKETID bucketUnsignedHash (BUCKET *pb, const void *pId) /* * bucketPointerHash () - * */ -BUCKETID bucketPointerHash (BUCKET *pb, const void *pId) +LOCAL BUCKETID bucketPointerHash (BUCKET *pb, const void *pId) { - void * const *ppId = pId; + void * const *ppId = (void * const *) pId; unsigned long src; BUCKETID hashid; @@ -292,7 +292,7 @@ BUCKETID bucketPointerHash (BUCKET *pb, const void *pId) /* * bucketStringHash () */ -BUCKETID bucketStringHash (BUCKET *pb, const void *pId) +LOCAL BUCKETID bucketStringHash (BUCKET *pb, const void *pId) { const char *pStr = pId; BUCKETID hashid; diff --git a/src/libCom/bucketLib/bucketLib.c b/src/libCom/bucketLib/bucketLib.c index 23371bfb4..93d4ea380 100644 --- a/src/libCom/bucketLib/bucketLib.c +++ b/src/libCom/bucketLib/bucketLib.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -196,7 +197,7 @@ LOCAL ITEM **bucketUnsignedCompare (ITEM **ppi, const void *pId) /* * bucketPointerCompare() */ -ITEM **bucketPointerCompare (ITEM **ppi, const void *pId) +LOCAL ITEM **bucketPointerCompare (ITEM **ppi, const void *pId) { void *ptr; void **pItemId; @@ -219,7 +220,7 @@ ITEM **bucketPointerCompare (ITEM **ppi, const void *pId) /* * bucketStringCompare () */ -ITEM **bucketStringCompare (ITEM **ppi, const void *pId) +LOCAL ITEM **bucketStringCompare (ITEM **ppi, const void *pId) { const char *pStr = pId; ITEM *pi; @@ -241,7 +242,7 @@ ITEM **bucketStringCompare (ITEM **ppi, const void *pId) /* * bucketUnsignedHash () */ -BUCKETID bucketUnsignedHash (BUCKET *pb, const void *pId) +LOCAL BUCKETID bucketUnsignedHash (BUCKET *pb, const void *pId) { const unsigned *pUId = pId; unsigned src; @@ -262,11 +263,10 @@ BUCKETID bucketUnsignedHash (BUCKET *pb, const void *pId) /* * bucketPointerHash () - * */ -BUCKETID bucketPointerHash (BUCKET *pb, const void *pId) +LOCAL BUCKETID bucketPointerHash (BUCKET *pb, const void *pId) { - void * const *ppId = pId; + void * const *ppId = (void * const *) pId; unsigned long src; BUCKETID hashid; @@ -292,7 +292,7 @@ BUCKETID bucketPointerHash (BUCKET *pb, const void *pId) /* * bucketStringHash () */ -BUCKETID bucketStringHash (BUCKET *pb, const void *pId) +LOCAL BUCKETID bucketStringHash (BUCKET *pb, const void *pId) { const char *pStr = pId; BUCKETID hashid; diff --git a/src/libCom/ellLib.c b/src/libCom/ellLib.c index e233dc71d..aaa286d87 100644 --- a/src/libCom/ellLib.c +++ b/src/libCom/ellLib.c @@ -32,6 +32,8 @@ /* #define DEBUG_DRIVER */ +#include + #include #if !defined(NULL) diff --git a/src/libCom/ellLib/ellLib.c b/src/libCom/ellLib/ellLib.c index e233dc71d..aaa286d87 100644 --- a/src/libCom/ellLib/ellLib.c +++ b/src/libCom/ellLib/ellLib.c @@ -32,6 +32,8 @@ /* #define DEBUG_DRIVER */ +#include + #include #if !defined(NULL) diff --git a/src/libCom/env/envSubr.c b/src/libCom/env/envSubr.c index c9e803083..f7f2bc75d 100644 --- a/src/libCom/env/envSubr.c +++ b/src/libCom/env/envSubr.c @@ -28,6 +28,8 @@ * .01 07-20-91 rac initial version * .02 08-07-91 joh added config get for long and double C types * .03 08-07-91 joh added config get for struct in_addr type + * .04 01-11-95 joh use getenv()/putenv() to fetch/write env + * vars under vxWorks * * make options * -DvxWorks makes a version for VxWorks @@ -60,20 +62,21 @@ * *-***************************************************************************/ +#include +#include +#include +#include +#include + #ifdef vxWorks -# include -# include -# include -# include -#else -# include -# include -# include -# include +#include +#include +#include #endif #define ENV_PRIVATE_DATA #include +#include #include @@ -122,11 +125,8 @@ char *pBuf; /* I pointer to parameter buffer */ char *pEnv; /* pointer to environment string */ long i; -#ifndef vxWorks pEnv = getenv(pParam->name); -#else - pEnv = NULL; -#endif + if (pEnv == NULL) pEnv = pParam->dflt; if (strlen(pEnv) <= 0) @@ -363,26 +363,64 @@ ENV_PARAM *pParam; /* I pointer to config param structure */ * *-*/ long -envSetConfigParam(pParam, value) -ENV_PARAM *pParam; /* I pointer to config param structure */ -char *value; /* I pointer to value string */ +envSetConfigParam (pParam, value) +ENV_PARAM *pParam; /* I pointer to config param structure */ +char *value; /* I pointer to value string */ { #ifndef vxWorks - printf("envSetConfigParam can't be used in UNIX\n"); + printf("envSetConfigParam can only be used under vxWorks\n"); + return -1L; #else - if (strlen(value) < 80) - strcpy(pParam->dflt, value); - else { - strncpy(pParam->dflt, value, 79); - pParam->dflt[79] = '\0'; - } + long retCode = 0; + int status; + char *pEnv; + + /* + * space for two strings, an '=' character, + * and a null termination + */ + pEnv = malloc (strlen (pParam->name) + strlen (value) + 2); + if (!pEnv) { + errPrintf( + -1L, + __FILE__, + __LINE__, +"Failed to set environment parameter \"%s\" to \"%s\" because \"%s\"\n", + pParam->name, + value, + strerror (errnoGet())); + return -1L; + } + + strcpy (pEnv, pParam->name); + strcat (pEnv, "="); + strcat (pEnv, value); + status = putenv (pEnv); + if (status<0) { + errPrintf( + -1L, + __FILE__, + __LINE__, +"Failed to set environment parameter \"%s\" to \"%s\" because \"%s\"\n", + pParam->name, + value, + strerror (errnoGet())); + retCode = -1L; + } + /* + * vxWorks copies into a private buffer + * (this does not match UNIX behavior) + */ + free (pEnv); + + return retCode; #endif - return 0; } + /*parameters meant to be modified in epicsEnvParams.h*/ -epicsSetEnvParams() +int epicsSetEnvParams() { printf("setting EPICS environment parameters\n"); envSetConfigParam(&EPICS_TS_MIN_WEST, EPICS_TS_MIN_VALUE); @@ -393,7 +431,8 @@ epicsSetEnvParams() envSetConfigParam(&EPICS_IOC_LOG_FILE_NAME, EPICS_IOC_LOG_FILE_TXT); return 0; } -epicsPrtEnvParams() + +int epicsPrtEnvParams() { envPrtConfigParam(&EPICS_TS_MIN_WEST); envPrtConfigParam(&EPICS_CMD_PROTO_PORT); diff --git a/src/libCom/envSubr.c b/src/libCom/envSubr.c index c9e803083..f7f2bc75d 100644 --- a/src/libCom/envSubr.c +++ b/src/libCom/envSubr.c @@ -28,6 +28,8 @@ * .01 07-20-91 rac initial version * .02 08-07-91 joh added config get for long and double C types * .03 08-07-91 joh added config get for struct in_addr type + * .04 01-11-95 joh use getenv()/putenv() to fetch/write env + * vars under vxWorks * * make options * -DvxWorks makes a version for VxWorks @@ -60,20 +62,21 @@ * *-***************************************************************************/ +#include +#include +#include +#include +#include + #ifdef vxWorks -# include -# include -# include -# include -#else -# include -# include -# include -# include +#include +#include +#include #endif #define ENV_PRIVATE_DATA #include +#include #include @@ -122,11 +125,8 @@ char *pBuf; /* I pointer to parameter buffer */ char *pEnv; /* pointer to environment string */ long i; -#ifndef vxWorks pEnv = getenv(pParam->name); -#else - pEnv = NULL; -#endif + if (pEnv == NULL) pEnv = pParam->dflt; if (strlen(pEnv) <= 0) @@ -363,26 +363,64 @@ ENV_PARAM *pParam; /* I pointer to config param structure */ * *-*/ long -envSetConfigParam(pParam, value) -ENV_PARAM *pParam; /* I pointer to config param structure */ -char *value; /* I pointer to value string */ +envSetConfigParam (pParam, value) +ENV_PARAM *pParam; /* I pointer to config param structure */ +char *value; /* I pointer to value string */ { #ifndef vxWorks - printf("envSetConfigParam can't be used in UNIX\n"); + printf("envSetConfigParam can only be used under vxWorks\n"); + return -1L; #else - if (strlen(value) < 80) - strcpy(pParam->dflt, value); - else { - strncpy(pParam->dflt, value, 79); - pParam->dflt[79] = '\0'; - } + long retCode = 0; + int status; + char *pEnv; + + /* + * space for two strings, an '=' character, + * and a null termination + */ + pEnv = malloc (strlen (pParam->name) + strlen (value) + 2); + if (!pEnv) { + errPrintf( + -1L, + __FILE__, + __LINE__, +"Failed to set environment parameter \"%s\" to \"%s\" because \"%s\"\n", + pParam->name, + value, + strerror (errnoGet())); + return -1L; + } + + strcpy (pEnv, pParam->name); + strcat (pEnv, "="); + strcat (pEnv, value); + status = putenv (pEnv); + if (status<0) { + errPrintf( + -1L, + __FILE__, + __LINE__, +"Failed to set environment parameter \"%s\" to \"%s\" because \"%s\"\n", + pParam->name, + value, + strerror (errnoGet())); + retCode = -1L; + } + /* + * vxWorks copies into a private buffer + * (this does not match UNIX behavior) + */ + free (pEnv); + + return retCode; #endif - return 0; } + /*parameters meant to be modified in epicsEnvParams.h*/ -epicsSetEnvParams() +int epicsSetEnvParams() { printf("setting EPICS environment parameters\n"); envSetConfigParam(&EPICS_TS_MIN_WEST, EPICS_TS_MIN_VALUE); @@ -393,7 +431,8 @@ epicsSetEnvParams() envSetConfigParam(&EPICS_IOC_LOG_FILE_NAME, EPICS_IOC_LOG_FILE_TXT); return 0; } -epicsPrtEnvParams() + +int epicsPrtEnvParams() { envPrtConfigParam(&EPICS_TS_MIN_WEST); envPrtConfigParam(&EPICS_CMD_PROTO_PORT); diff --git a/src/libCom/errSymLib.c b/src/libCom/errSymLib.c index 767bc70ff..4f0edd11f 100644 --- a/src/libCom/errSymLib.c +++ b/src/libCom/errSymLib.c @@ -61,27 +61,32 @@ * .01 09-04-93 rcz Merged errMessage.c, errPrint.c, errSymFind.c * rcz into one file (errSymLib.c) and changed method * rcz of errSymTable lookup. + * .02 01-13-95 joh call mprintf() instead of logMsg() + * and eliminated errToLogMsg variable */ +#include +#include +#include + #include #include #include #include "errSymTbl.h" -#include #ifdef vxWorks #include #include -#include #include #include +#include + +#include extern SYMTAB_ID statSymTbl; #else -#include -extern int errno; -extern int sys_nerr; +extern int sys_nerr; extern char *sys_errlist[]; #endif @@ -108,14 +113,14 @@ static int initialized = FALSE; extern ERRSYMTAB_ID errSymTbl; -#ifdef vxWorks -int errToLogMsg = TRUE; -#endif - /*Declare storage for errVerbose( defined in errMdef.h)*/ int errVerbose=0; - +#ifdef __STDC__ +int verrPrintStatus(long status, char *pFormatString, va_list pvar); +#else +int verrPrintStatus(); +#endif /**************************************************************** @@ -213,11 +218,6 @@ va_dcl char *pFileName; int lineno; #endif -#ifdef vxWorks - int id; - static int saveid = -1; - char *pname; -#endif #ifdef __STDC__ va_start(pvar, pformat); @@ -229,29 +229,8 @@ va_dcl pformat = va_arg(pvar, char *); #endif -#ifdef vxWorks - if(!errToLogMsg) { - id = taskIdSelf(); - if (saveid != id) { - saveid = id; - pname = taskName(id); - printf("taskid=%x taskname=%s ", id, pname); - } - } -#endif - if(pFileName && errVerbose){ -#ifdef vxWorks - if(errToLogMsg) { - logMsg("filename=\"%s\" line number=%d\n", pFileName, lineno, - NULL, NULL, NULL, NULL); - } - else{ - printf("filename=\"%s\" line number=%d\n", pFileName, lineno); - } -#else - printf("filename=\"%s\" line number=%d\n", pFileName, lineno); -#endif + mprintf("filename=\"%s\" line number=%d\n", pFileName, lineno); } if (pformat != NULL) { @@ -273,12 +252,7 @@ va_dcl reformatSize = size; } else{ -#ifdef vxWorks - logMsg("%s: calloc error\n", __FILE__, - NULL, NULL, NULL, NULL, NULL); -#else - printf("%s: calloc error\n", __FILE__); -#endif + mprintf ("%s: calloc error\n", __FILE__); return; } } @@ -369,34 +343,11 @@ va_list pvar; strcat(name, ctxToLarge); } else{ - fprintf(stderr,ctxToLarge); + mprintf(ctxToLarge); } } -#ifdef vxWorks - if(errToLogMsg){ - int i; - int logMsgArgs[6]; - - for(i=0; i< NELEMENTS(logMsgArgs); i++){ - logMsgArgs[i] = va_arg(pvar, int); - } - - logMsg( - name, - logMsgArgs[0], - logMsgArgs[1], - logMsgArgs[2], - logMsgArgs[3], - logMsgArgs[4], - logMsgArgs[5]); - } - else{ - vprintf(name, pvar); - } -#else - vprintf(name, pvar); -#endif + vmprintf(name, pvar); return rtnval; } @@ -623,3 +574,5 @@ unsigned short endErrNum; errSymTestPrint(errNum); } } + + diff --git a/src/libCom/error/errSymLib.c b/src/libCom/error/errSymLib.c index 767bc70ff..4f0edd11f 100644 --- a/src/libCom/error/errSymLib.c +++ b/src/libCom/error/errSymLib.c @@ -61,27 +61,32 @@ * .01 09-04-93 rcz Merged errMessage.c, errPrint.c, errSymFind.c * rcz into one file (errSymLib.c) and changed method * rcz of errSymTable lookup. + * .02 01-13-95 joh call mprintf() instead of logMsg() + * and eliminated errToLogMsg variable */ +#include +#include +#include + #include #include #include #include "errSymTbl.h" -#include #ifdef vxWorks #include #include -#include #include #include +#include + +#include extern SYMTAB_ID statSymTbl; #else -#include -extern int errno; -extern int sys_nerr; +extern int sys_nerr; extern char *sys_errlist[]; #endif @@ -108,14 +113,14 @@ static int initialized = FALSE; extern ERRSYMTAB_ID errSymTbl; -#ifdef vxWorks -int errToLogMsg = TRUE; -#endif - /*Declare storage for errVerbose( defined in errMdef.h)*/ int errVerbose=0; - +#ifdef __STDC__ +int verrPrintStatus(long status, char *pFormatString, va_list pvar); +#else +int verrPrintStatus(); +#endif /**************************************************************** @@ -213,11 +218,6 @@ va_dcl char *pFileName; int lineno; #endif -#ifdef vxWorks - int id; - static int saveid = -1; - char *pname; -#endif #ifdef __STDC__ va_start(pvar, pformat); @@ -229,29 +229,8 @@ va_dcl pformat = va_arg(pvar, char *); #endif -#ifdef vxWorks - if(!errToLogMsg) { - id = taskIdSelf(); - if (saveid != id) { - saveid = id; - pname = taskName(id); - printf("taskid=%x taskname=%s ", id, pname); - } - } -#endif - if(pFileName && errVerbose){ -#ifdef vxWorks - if(errToLogMsg) { - logMsg("filename=\"%s\" line number=%d\n", pFileName, lineno, - NULL, NULL, NULL, NULL); - } - else{ - printf("filename=\"%s\" line number=%d\n", pFileName, lineno); - } -#else - printf("filename=\"%s\" line number=%d\n", pFileName, lineno); -#endif + mprintf("filename=\"%s\" line number=%d\n", pFileName, lineno); } if (pformat != NULL) { @@ -273,12 +252,7 @@ va_dcl reformatSize = size; } else{ -#ifdef vxWorks - logMsg("%s: calloc error\n", __FILE__, - NULL, NULL, NULL, NULL, NULL); -#else - printf("%s: calloc error\n", __FILE__); -#endif + mprintf ("%s: calloc error\n", __FILE__); return; } } @@ -369,34 +343,11 @@ va_list pvar; strcat(name, ctxToLarge); } else{ - fprintf(stderr,ctxToLarge); + mprintf(ctxToLarge); } } -#ifdef vxWorks - if(errToLogMsg){ - int i; - int logMsgArgs[6]; - - for(i=0; i< NELEMENTS(logMsgArgs); i++){ - logMsgArgs[i] = va_arg(pvar, int); - } - - logMsg( - name, - logMsgArgs[0], - logMsgArgs[1], - logMsgArgs[2], - logMsgArgs[3], - logMsgArgs[4], - logMsgArgs[5]); - } - else{ - vprintf(name, pvar); - } -#else - vprintf(name, pvar); -#endif + vmprintf(name, pvar); return rtnval; } @@ -623,3 +574,5 @@ unsigned short endErrNum; errSymTestPrint(errNum); } } + + diff --git a/src/libCom/genSubr.c b/src/libCom/genSubr.c index 6902b2239..3995b30b8 100644 --- a/src/libCom/genSubr.c +++ b/src/libCom/genSubr.c @@ -124,6 +124,8 @@ int lineNum; #else abort(); #endif + + return (0); } /*+/subr********************************************************************** diff --git a/src/libCom/tsSubr.c b/src/libCom/tsSubr.c index 6c733ee38..fa1a25771 100644 --- a/src/libCom/tsSubr.c +++ b/src/libCom/tsSubr.c @@ -37,6 +37,7 @@ * .09 02-09-94 jbk tsLocalTime() now calls TScurrentTimeStamp() vxWorks * for the EPOCH year * .10 05-04-94 pg HPUX cpp changes. (elif to else and if) + * .11 01-09-95 joh fixed ts min west out of range test * * make options * -DvxWorks makes a version for VxWorks @@ -107,19 +108,23 @@ * 4.2 BSD.) *-***************************************************************************/ +#include +#include +#include +#include + #ifdef vxWorks # include # include # include -# include #else #if VMS +# include #else # include -# include -# include +#if 0 # include -# include +#endif #endif #endif @@ -361,7 +366,7 @@ date() * *-*/ static -sunday(day, leap, dayYear, dayOfWeek) +int sunday(day, leap, dayYear, dayOfWeek) int day; /* I day of year to find closest Sunday */ int leap; /* I 0, 1 for not leap year, leap year, respectively */ int dayYear; /* I known day of year */ @@ -600,10 +605,6 @@ TS_STAMP *pStamp; /* O pointer to time stamp buffer */ return TScurrentTimeStamp((struct timespec*)pStamp); # endif #else -#if VMS - assert(0); /* not available on VMS */ - assert(pStamp != NULL); -#else /* SunOS */ struct timeval curtime; assert(pStamp != NULL); @@ -613,7 +614,6 @@ TS_STAMP *pStamp; /* O pointer to time stamp buffer */ pStamp->nsec = ( curtime.tv_usec/1000 ) * 1000000; pStamp->secPastEpoch = curtime.tv_sec - TS_EPOCH_SEC_PAST_1970; } -#endif #endif pStamp->nsec = pStamp->nsec - (pStamp->nsec % TS_TRUNC); @@ -874,7 +874,7 @@ tsInitMinWest() if (envGetLongConfigParam(&EPICS_TS_MIN_WEST, &tsMinWest) != 0) error = 1; else - if (tsMinWest > 1380 && tsMinWest < -1380) + if (tsMinWest > 1380 || tsMinWest < -1380) error = 1; if (error) { (void)printf( @@ -1373,10 +1373,8 @@ TS_STAMP *pStamp; /* O time stamp corresponding to text */ char **pText; /* IO ptr to ptr to string containing time and date */ { long retStat=S_ts_OK;/* status return to caller */ - long stat; /* status from calls */ struct tsDetail t; /* detailed breakdown of text */ TS_STAMP stamp; /* temp for building time stamp */ - char *pField; /* pointer to field */ char delim; /* delimiter character */ int count; /* count from scan of next field */ long nsec; /* temp for nano-seconds */