added examples
This commit is contained in:
parent
68aaadeb45
commit
4513387026
|
@ -1,5 +1,5 @@
|
||||||
pkgconfig_DATA = libpipecolors.pc
|
pkgconfig_DATA = libpipecolors.pc
|
||||||
AM_CXXFLAGS = -std=c++11
|
|
||||||
ACLOCAL_AMFLAGS = -I m4 -I config
|
ACLOCAL_AMFLAGS = -I m4 -I config
|
||||||
LIBTOOL_DEPS = @LIBTOOL_DEPS@
|
LIBTOOL_DEPS = @LIBTOOL_DEPS@
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ libtool: $(LIBTOOL_DEPS)
|
||||||
|
|
||||||
lib_LTLIBRARIES = libpipecolors.la
|
lib_LTLIBRARIES = libpipecolors.la
|
||||||
libpipecolors_la_SOURCES = libpipecolors.cpp
|
libpipecolors_la_SOURCES = libpipecolors.cpp
|
||||||
libpipecolors_la_LIBADD = -lboost_regex
|
libpipecolors_la_LIBS = -lboost_regex
|
||||||
libpipecolors_la_CFLAGS = -fPIC -DPIC -pthread
|
libpipecolors_la_CFLAGS = -fPIC -DPIC -pthread
|
||||||
libpipecolors_la_LDFLAGS = -module \
|
libpipecolors_la_LDFLAGS = -module \
|
||||||
-release ${PIPECOLORS_VERSION}
|
-release ${PIPECOLORS_VERSION}
|
||||||
|
|
|
@ -44,7 +44,7 @@ LT_INIT
|
||||||
AC_LANG_CPLUSPLUS
|
AC_LANG_CPLUSPLUS
|
||||||
AC_PREFIX_DEFAULT([/usr])
|
AC_PREFIX_DEFAULT([/usr])
|
||||||
#AC_CHECK_LIB([pipecolors], [cprintf])
|
#AC_CHECK_LIB([pipecolors], [cprintf])
|
||||||
|
AC_CHECK_LIB([boost_regex], [main])
|
||||||
# Checks for programs.
|
# Checks for programs.
|
||||||
|
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
|
@ -57,7 +57,7 @@ gcc_micro_vers=`echo ${gcc_full_vers} | cut -f3 -d.`
|
||||||
|
|
||||||
# Checks for functions
|
# 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])
|
AC_MSG_CHECKING([${CXX-c++} version])
|
||||||
if test "${gcc_minor_vers}" -lt 9; then
|
if test "${gcc_minor_vers}" -lt 9; then
|
||||||
|
@ -69,7 +69,8 @@ fi
|
||||||
|
|
||||||
|
|
||||||
# Checks for libraries.
|
# 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_FUNCS([vprintf vsprintf vasprintf printf])
|
||||||
AC_CHECK_TYPE([size_t])
|
AC_CHECK_TYPE([size_t])
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <pipecolors.h>
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <iostream>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <pipecolors.h>
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
}
|
41
pcprintf.3
41
pcprintf.3
|
@ -31,47 +31,18 @@
|
||||||
.\" 2000-07-26 jsm28@hermes.cam.ac.uk - three small fixes
|
.\" 2000-07-26 jsm28@hermes.cam.ac.uk - three small fixes
|
||||||
.\" 2000-10-16 jsm28@hermes.cam.ac.uk - more 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
|
.SH NAME
|
||||||
printf, fprintf, sprintf, snprintf, vprintf, vfprintf, vsprintf,
|
cpprintf,
|
||||||
vsnprintf \- formatted output conversion
|
cpsprintf \- formatted output conversion
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B #include <stdio.h>
|
.B #include <pipecolors.h>
|
||||||
.sp
|
.sp
|
||||||
.BI "int printf(const char *" format ", ...);"
|
.BI "int cpprintf(const char *" format ", ...);"
|
||||||
.br
|
.br
|
||||||
.BI "int fprintf(FILE *" stream ", const char *" format ", ...);"
|
.BI "int cpsprintf(char *" str ", 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 <stdarg.h>
|
|
||||||
.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 );
|
|
||||||
.sp
|
.sp
|
||||||
.in -4n
|
.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
|
.ad
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
The functions in the
|
The functions in the
|
||||||
|
|
Loading…
Reference in New Issue