diff --git a/src/libCom/Makefile b/src/libCom/Makefile index a1f2927c2..5d33ea7ee 100644 --- a/src/libCom/Makefile +++ b/src/libCom/Makefile @@ -225,6 +225,9 @@ INC_vxWorks += iocClock.h SRCS_vxWorks += iocClock.c SRCS_vxWorks += epicsStdio.c +# For hpux only the Stdio stuff +SRCS_hpux += epicsStdio.c + # Library to build: # lib$(LIBRARY).a or ..dll/..exp/..lib # diff --git a/src/libCom/osi/os/hpux/epicsStdio.c b/src/libCom/osi/os/hpux/epicsStdio.c new file mode 100644 index 000000000..db8f08685 --- /dev/null +++ b/src/libCom/osi/os/hpux/epicsStdio.c @@ -0,0 +1,54 @@ +/* epicsStdio.c */ +/*************************************************************************\ +* Copyright (c) 2002 The University of Chicago, as Operator of Argonne +* National Laboratory. +* Copyright (c) 2002 The Regents of the University of California, as +* Operator of Los Alamos National Laboratory. +* EPICS BASE Versions 3.13.7 +* and higher are distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#include "epicsStdio.h" + +int epicsVsnprintf ( + char * str, size_t size, const char *format, va_list ap ) +{ + int rtn; + + rtn = vsnprintf ( str, size, format, ap ); + if ( rtn >= 0 ) { + size_t sizeReturned = (size_t) rtn; + if ( sizeReturned < size ) { + return rtn; + } + } + if ( rtn == -1 ) { + str[size-1] = 0; + return (int) size; + } + return rtn; +} + +int epicsSnprintf ( + char *str, size_t size, const char *pFormat, ... ) +{ + int rtn; + va_list pvar; + + va_start ( pvar, pFormat ); + rtn = epicsVsnprintf ( str, size, pFormat, pvar ); + va_end ( pvar ); + return ( rtn ); +} + +#ifdef __cplusplus +} +#endif diff --git a/src/libCom/osi/os/hpux/epicsStdio.h b/src/libCom/osi/os/hpux/epicsStdio.h new file mode 100644 index 000000000..71639792d --- /dev/null +++ b/src/libCom/osi/os/hpux/epicsStdio.h @@ -0,0 +1,28 @@ +/* epicsStdio.h */ +/*************************************************************************\ +* Copyright (c) 2002 The University of Chicago, as Operator of Argonne +* National Laboratory. +* Copyright (c) 2002 The Regents of the University of California, as +* Operator of Los Alamos National Laboratory. +* EPICS BASE Versions 3.13.7 +* and higher are distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ +#ifndef epicsStdioh +#define epicsStdioh + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +int epicsSnprintf ( char *str, size_t size, const char *format, ...); +int epicsVsnprintf ( char *str, size_t size, const char *format, va_list ap); + +#ifdef __cplusplus +} +#endif + +#endif /* epicsStdioh */