[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pic anomalies
From: |
Ingo Schwarze |
Subject: |
Re: pic anomalies |
Date: |
Sat, 28 Dec 2019 14:09:11 +0100 |
User-agent: |
Mutt/1.12.2 (2019-09-21) |
Hi Ralph,
Ralph Corderoy wrote on Sat, Dec 28, 2019 at 11:48:19AM +0000:
> Ingo Schwarze wrote:
>> +Only the flags
>> +.RB ' # ',
>> +.RB ' \- ',
>> +.RB ' + ',
> Why use an ASCII quote on both sides?
My bad, i'm no longer used to writing with the 1979 UNIX v7 man(7)
macros; but now that you ask, i realize that in mdoc(7), i would
have used .Ql, which doesn't result in straight ASCII quotes either,
except in -T ascii output mode.
> pic(1) uses Unicode's [SINGLE QUOTATION MARKs] in similar context.
Good point, thanks, amended in my tree.
I'm appending the full patch again for convenience.
Before commit, i'm still waiting for a code review that Larry McVoy
was kind enough to offer (of course, anyone else is also welcome
to check the code change). Regarding the documentation parts of
the patch, i already have an OK from esr@, which i consider
authoritative.
Yours,
Ingo
commit 450be054c0e3c25251f2a62ca09cf0b93c97dfc2
Author: Ingo Schwarze <address@hidden>
Date: Fri Dec 27 21:09:24 2019 +0100
Fix code and documentation in pic(1) regarding printf.
* src/preproc/pic/pic.ypp:
Let the "%%" conversion specification print "%" rather than "%%".
* src/preproc/pic/pic.1.man:
Document which conversion specifications are supported.
* doc/pic.ms:
Correct the list of supported conversion specifications.
All three bugs were reported by
Doug McIlroy <doug at cs dot dartmouth dot edu>.
diff --git a/ChangeLog b/ChangeLog
index 727c3673..6fcb45e3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2019-12-27 Ingo Schwarze <address@hidden>
+
+ Fix code and documentation in pic(1) regarding printf.
+
+ * src/preproc/pic/pic.ypp:
+ Let the "%%" conversion specification print "%" rather than "%%".
+ * src/preproc/pic/pic.1.man:
+ Document which conversion specifications are supported.
+ * doc/pic.ms:
+ Correct the list of supported conversion specifications.
+
+ All three bugs were reported by
+ Doug McIlroy <doug at cs dot dartmouth dot edu>.
+
2019-12-21 Ingo Schwarze <address@hidden>
Update NetBSD, OpenBSD, FreeBSD, Darwin, and DragonFly version strings.
diff --git a/doc/pic.ms b/doc/pic.ms
index 6d581ba3..b7dfe32f 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 %%, %e, %E, %f, %g, and %G conversion
+specifications.
.
.
.NH 1
diff --git a/src/preproc/pic/pic.1.man b/src/preproc/pic/pic.1.man
index ae4c205c..4fadf174 100644
--- a/src/preproc/pic/pic.1.man
+++ b/src/preproc/pic/pic.1.man
@@ -906,6 +906,20 @@ 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
+.RB \(oq # \(cq,
+.RB \(oq \- \(cq,
+.RB \(oq + \(cq,
+and \(oq\ \(cq (space), a minimum field width, an optional precision,
+and the conversion specifications
+.BR %e ,
+.BR %E ,
+.BR %f ,
+.BR %g ,
+.BR %G ,
+and
+.B %%
+are supported.
.
.
.LP
diff --git a/src/preproc/pic/pic.ypp b/src/preproc/pic/pic.ypp
index 6afa2ab3..b6a6b241 100644
--- a/src/preproc/pic/pic.ypp
+++ b/src/preproc/pic/pic.ypp
@@ -1905,7 +1905,7 @@ char *do_sprintf(const char *form, const double *v, int
nv)
break;
}
if (*form == '%') {
- one_format += *form++;
+ form++;
one_format += '\0';
snprintf(sprintf_buf, sizeof(sprintf_buf),
"%s", one_format.contents());