From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-il1-f179.google.com ([209.85.166.179]) by ewsd; Sun Dec 1 17:17:29 EST 2019 Received: by mail-il1-f179.google.com with SMTP id t17so4625225ilm.13 for <9front@9front.org>; Sun, 01 Dec 2019 14:17:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=hvyNnnW3Ud+0Wz9h37lj0kk7U0NlK97GICHtpHRyLSw=; b=DvgmrdbQlztWn5n8lmEjTVH4zI3Fz0/hw1ebHRmx90pzY2vafPx531Zp3IWDS8xkl2 xGNAQQ8Niy3WkerW1vuwr6dwjkvzZAuTriomlDhnmaY5cLci9k88DqJRJhbkr4C7vA8l lrA+yoRC7kw/upUBVTZC66wXLQWd0F6f4RvlIp/07BLHdFVsLvQEBc+fFZwv9iaVSuWQ AuN89N+cVenxlI3G4MaOi93AQ8OZQFIUuOrE1LVqMsiTSV/uSS0P+/Kq/kTnRp9RY1AI bNiFcKyDIlmQuioj+D8cpvJqu5P4ypHcLGa18qrdDiuDVq8BdTqtUkKGPAnj7sVlrbPi Y4rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=hvyNnnW3Ud+0Wz9h37lj0kk7U0NlK97GICHtpHRyLSw=; b=RW3Kh4x09olDnvi+42tUlnIRpVaFUoEGchsYl3Wu4dKgAKH6a2W1WSRFOFlV17qA14 pADRd0JHvf7T1awzLK+mlzLkS+WnKX+6qH/bGWBS3CZzJYiyezVsZFdwWdMoAwJgfXbD fbT+jylCTuIkbZH/BmdfEGOu3NZrxzh77IB5Ciualy3JbmMvXjddswGIDjrd/CUbAU+t Dlji/INQhm+EuYXTONAq+wu9TnjwlibehkP5hfuqekeI4bC/LRoCC1AkXcuB9wqDvD1O lmWN0C9BBGeApDejpTrdaYSTSQAgjruMtaqqdz++xr+7UdO7QZzzBTD+6FFVlXeoPFig +2cw== X-Gm-Message-State: APjAAAVupHDsc2elaw4fWJIi5/wQMd6+IyAvxrjGaoBYH2veP726h11g b4LUL7VGY0bzfB2KWTFodBmChNS4sgbLUFRHQJNtM1BY X-Google-Smtp-Source: APXvYqxFgPGTYO7aSF+mtFobDVDHYB8pqe3qu7gzxRUOac/3SP8r30jlS+7vIE1jNttKSmMUULCKTFYa/zmvzs1RtR8= X-Received: by 2002:a92:994d:: with SMTP id p74mr21881200ili.30.1575238645608; Sun, 01 Dec 2019 14:17:25 -0800 (PST) MIME-Version: 1.0 From: "Amavect ." Date: Sun, 1 Dec 2019 16:17:14 -0600 Message-ID: Subject: print(2): document n verb and z flag To: 9front@9front.org Content-Type: text/plain; charset="UTF-8" List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: object-oriented interface descriptor hypervisor 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).