diff --git a/Makefile.am b/Makefile.am index f4d9278..b500cd8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ pkgconfig_DATA = libpipecolors.pc -AM_CXXFLAGS = -std=c++11 + ACLOCAL_AMFLAGS = -I m4 -I config LIBTOOL_DEPS = @LIBTOOL_DEPS@ @@ -8,7 +8,7 @@ libtool: $(LIBTOOL_DEPS) lib_LTLIBRARIES = libpipecolors.la libpipecolors_la_SOURCES = libpipecolors.cpp -libpipecolors_la_LIBADD = -lboost_regex +libpipecolors_la_LIBS = -lboost_regex libpipecolors_la_CFLAGS = -fPIC -DPIC -pthread libpipecolors_la_LDFLAGS = -module \ -release ${PIPECOLORS_VERSION} diff --git a/configure.ac b/configure.ac index 8b402e3..f118746 100644 --- a/configure.ac +++ b/configure.ac @@ -44,7 +44,7 @@ LT_INIT AC_LANG_CPLUSPLUS AC_PREFIX_DEFAULT([/usr]) #AC_CHECK_LIB([pipecolors], [cprintf]) - +AC_CHECK_LIB([boost_regex], [main]) # Checks for programs. AC_CONFIG_MACRO_DIR([m4]) @@ -57,7 +57,7 @@ gcc_micro_vers=`echo ${gcc_full_vers} | cut -f3 -d.` # Checks for functions -AC_CHECK_CXX_ARGUMENT([-std=c++11], [], [AC_MSG_ERROR([C++11 support is required.])]) +#AC_CHECK_CXX_ARGUMENT([-std=c++11], [], [AC_MSG_ERROR([C++11 support is required.])]) AC_MSG_CHECKING([${CXX-c++} version]) if test "${gcc_minor_vers}" -lt 9; then @@ -69,7 +69,8 @@ fi # Checks for libraries. -AC_CHECK_HEADERS([stdarg.h stdlib.h unistd.h string iostream map boost/regex.hpp],[],[AC_MSG_ERROR([We couldn't find some of the headers.])]) +AC_CHECK_HEADERS([stdarg.h stdlib.h unistd.h string iostream map],[],[AC_MSG_ERROR([We couldn't find some of the headers.])]) +AC_CHECK_HEADER([boost/regex.hpp],[],[AC_MSG_ERROR([Please install the libboost-regex header library.])]) AC_CHECK_FUNCS([vprintf vsprintf vasprintf printf]) AC_CHECK_TYPE([size_t]) diff --git a/examples/test.c b/examples/test.c new file mode 100644 index 0000000..914e7e0 --- /dev/null +++ b/examples/test.c @@ -0,0 +1,15 @@ +#include +#include +#include +#include + +main() { + int a,b; + const char* str = "|0101|0202|0303|0404|0505|0606|0707|0808|0909|1010|1111|1212|1313|1414|1515|07"; + const char* name = "|01P|02i|03p|04e|05c|06ol|07o|08r|09s |10l|11i|12b|13r|14a|15r|14y |130|12.|111|07"; + + a = pcprintf("\n%s\n\n", name); + b = pcprintf("%s\n", str); + + +} diff --git a/examples/test.cpp b/examples/test.cpp new file mode 100644 index 0000000..0d1cec4 --- /dev/null +++ b/examples/test.cpp @@ -0,0 +1,19 @@ +#include +#include +#include +#include + +using namespace pipecolors; + +int main(void) { + + const char* str = "|0101|0202|0303|0404|0505|0606|0707|0808|0909|1010|1111|1212|1313|1414|1515|07"; + const char* name = "|01P|02i|03p|04e|05c|06ol|07o|08r|09s |10l|11i|12b|13r|14a|15r|14y |130|12.|111|07"; + + pcprintf("\n%s\n\n", name); + pcprintf("%s\n", str); + int size = pcprintf("%s", str); + std::cout << std::endl << "Size : " << size << std::endl; + return 0; + +} diff --git a/pcprintf.3 b/pcprintf.3 index c3c8931..17f9cb4 100644 --- a/pcprintf.3 +++ b/pcprintf.3 @@ -31,47 +31,18 @@ .\" 2000-07-26 jsm28@hermes.cam.ac.uk - three small fixes .\" 2000-10-16 jsm28@hermes.cam.ac.uk - more fixes .\" -.TH PRINTF 3 2014-07-08 "GNU" "Linux Programmer's Manual" +.TH CPPRINTF 3 2015-07-01 "GNU" "Linux Programmer's Manual" .SH NAME -printf, fprintf, sprintf, snprintf, vprintf, vfprintf, vsprintf, -vsnprintf \- formatted output conversion +cpprintf, +cpsprintf \- formatted output conversion .SH SYNOPSIS -.B #include +.B #include .sp -.BI "int printf(const char *" format ", ...);" +.BI "int cpprintf(const char *" format ", ...);" .br -.BI "int fprintf(FILE *" stream ", const char *" format ", ...);" -.br -.BI "int sprintf(char *" str ", const char *" format ", ...);" -.br -.BI "int snprintf(char *" str ", size_t " size ", const char *" format ", ...);" -.sp -.B #include -.sp -.BI "int vprintf(const char *" format ", va_list " ap ); -.br -.BI "int vfprintf(FILE *" stream ", const char *" format ", va_list " ap ); -.br -.BI "int vsprintf(char *" str ", const char *" format ", va_list " ap ); -.br -.BI "int vsnprintf(char *" str ", size_t " size ", const char *" format \ -", va_list " ap ); +.BI "int cpsprintf(char *" str ", const char *" format ", ...);" .sp .in -4n -Feature Test Macro Requirements for glibc (see -.BR feature_test_macros (7)): -.in -.sp -.ad l -.BR snprintf (), -.BR vsnprintf (): -.RS 4 -_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _ISOC99_SOURCE || -_POSIX_C_SOURCE\ >=\ 200112L; -.br -or -.I "cc -std=c99" -.RE .ad .SH DESCRIPTION The functions in the