This commit is contained in:
R. Eric Wheeler 2015-07-13 18:03:01 -07:00
parent d4a0670998
commit b111582596
4 changed files with 9 additions and 5 deletions

Binary file not shown.

View File

@ -8,7 +8,7 @@ int main(void) {
int num = 5; int num = 5;
const char* str = "My number is"; const char* str = "My number is";
pcprintf("|01%s |41|09%d|39\n", str, num); int len = pcprintf("|01%s |41|09%d|39\n", str, num);
pcprintf("|10Length of String is : |15|30%d\n", len);
return 0; return 0;
} }

View File

@ -82,7 +82,7 @@ namespace pipecolors {
start = s.begin(); start = s.begin();
end = s.end(); end = s.end();
std::string len(s); std::string len(s);
int reallen;
colors = getColors(); colors = getColors();
while(regex_search(start, end, match, re, flags)) while(regex_search(start, end, match, re, flags))
@ -102,7 +102,8 @@ namespace pipecolors {
start = match[0].second; start = match[0].second;
flags |= boost::match_prev_avail | boost::match_not_bob; flags |= boost::match_prev_avail | boost::match_not_bob;
} }
return std::make_pair(s, len.length());
return std::make_pair(s, len.find("\n") ? len.length() - 1 : len.length());
} }
@ -129,4 +130,7 @@ namespace pipecolors {
return(result.second); return(result.second);
} }
int pcsprintf(char **strp, const char *fmt, va_list ap) {
return true;
}
} // namespace } // namespace

View File

@ -11,7 +11,7 @@ extern "C" {
#endif #endif
int pcprintf( const char * format, ... ); int pcprintf( const char * format, ... );
//int pcsprintf(char **strp, const char *fmt, va_list ap); int pcsprintf(char **strp, const char *fmt, va_list ap);
#ifdef __cplusplus #ifdef __cplusplus
} }