diff --git a/doc/pic.ms b/doc/pic.ms index 6d581ba..a0a77c7 100644 --- a/doc/pic.ms +++ b/doc/pic.ms @@ -1722,7 +1722,8 @@ GNU \fBgpic\fP also documents a one-argument form or rand, version. .PP The function \fBsprintf()\fP behaves like a C \fIsprintf\/\fP(3) -function that only takes %, %e, %f, and %g format strings. +function that only takes the format strings %e, %E, %f, %g and %G, +as well as %% for printing a raw percent character. . . .NH 1 diff --git a/src/preproc/pic/pic.1.man b/src/preproc/pic/pic.1.man index 847bbe3..85af1e7 100644 --- a/src/preproc/pic/pic.1.man +++ b/src/preproc/pic/pic.1.man @@ -906,6 +906,11 @@ this will produce the arguments formatted according to which should be a string as described in .BR printf (3) appropriate for the number of arguments supplied. +Only the flags +.B #-+ 0123456789., +and the formats +.B eEfgG% +are supported. . . .LP diff --git a/src/preproc/pic/pic.ypp b/src/preproc/pic/pic.ypp index 6afa2ab..2e5562e 100644 --- a/src/preproc/pic/pic.ypp +++ b/src/preproc/pic/pic.ypp @@ -1895,6 +1895,11 @@ char *do_sprintf(const char *form, const double *v, int nv) string one_format; while (*form) { if (*form == '%') { + if(form[1] == '%'){ + result += '%'; + form += 2; + continue; + } one_format += *form++; for (; *form != '\0' && strchr("#-+ 0123456789.", *form) != 0; form++) one_format += *form;