* print(2): document n verb and z flag
@ 2019-12-01 22:17 Amavect .
0 siblings, 0 replies; only message in thread
From: Amavect . @ 2019-12-01 22:17 UTC (permalink / raw)
To: 9front
Heyo,
print(2): document n verb and z flag
libc.h: add varargck pragmas for n flags
The source for the n flag can take the usual int size flags.
/sys/src/libc/fmt/dofmt.c:/_countfmt/:
In order for the compiler to not complain about these flags,
/sys/include/libc.h needs varargck pragmas.
Thanks,
Amavect
---------
diff -r 94226ee6784b sys/include/libc.h
--- a/sys/include/libc.h Sun Dec 01 17:57:14 2019 +0100
+++ b/sys/include/libc.h Sun Dec 01 16:10:29 2019 -0600
@@ -223,6 +223,10 @@
#pragma varargck type "r" void
#pragma varargck type "%" void
#pragma varargck type "n" int*
+#pragma varargck type "hn" short*
+#pragma varargck type "hhn" char*
+#pragma varargck type "ln" long*
+#pragma varargck type "lln" vlong*
#pragma varargck type "p" uintptr
#pragma varargck type "p" void*
#pragma varargck flag ','
diff -r 94226ee6784b sys/man/2/print
--- a/sys/man/2/print Sun Dec 01 17:57:14 2019 +0100
+++ b/sys/man/2/print Sun Dec 01 16:10:29 2019 -0600
@@ -200,13 +200,15 @@
.BR l ,
.BR ll ,
.BR u ,
+.BR z ,
.BR + ,
.BR - ,
.BR , ,
and
.B #
to mean pad with zeros,
-short, byte, long, vlong, unsigned, always print a sign, left
justified, commas every three digits,
+short, byte, long, vlong, unsigned, intptr/uintptr,
+always print a sign, left justified, commas every three digits,
and alternate format.
Also, a space character in the flag
position is like
@@ -374,6 +376,17 @@
in hexadecimal.
.PP
The
+.B n
+verb takes the number of bytes written so far and copies it to the
+.B int*
+pointer argument. The flags h, hh, l, ll are interpret the argument type as
+.BR short* ,
+.BR byte* ,
+.BR long* ,
+and
+.BR vlong* .
+.PP
+The
.B r
verb takes no arguments; it copies the error string returned by a call to
.IR errstr (2).
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-12-01 22:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-01 22:17 print(2): document n verb and z flag Amavect .
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).