From: "Amavect ." <amavect@gmail.com>
To: 9front@9front.org
Subject: print(2): document n verb and z flag
Date: Sun, 1 Dec 2019 16:17:14 -0600 [thread overview]
Message-ID: <CAGOW0YOssGUPmgSxX1PbJHS=hpaqk3gHbgTnRr+t_CsS1b9ctw@mail.gmail.com> (raw)
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).
reply other threads:[~2019-12-01 22:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAGOW0YOssGUPmgSxX1PbJHS=hpaqk3gHbgTnRr+t_CsS1b9ctw@mail.gmail.com' \
--to=amavect@gmail.com \
--cc=9front@9front.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).