From xaa@dohd.cx  Sun Jul 23 01:31:33 2000
Return-Path: <xaa@dohd.cx>
Received: from eeyore.local.dohd.org (d0030.dtk.chello.nl [213.46.0.30])
	by hub.freebsd.org (Postfix) with ESMTP id B096137BB60
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 23 Jul 2000 01:31:31 -0700 (PDT)
	(envelope-from xaa@dohd.cx)
Received: from tiggr.local.dohd.org (tiggr.local.dohd.org [::ffff:10.0.0.10])
	by eeyore.local.dohd.org (Postfix+IPv6) with ESMTP id 474AFBA9F
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 23 Jul 2000 10:31:29 +0200 (MET DST)
Received: by tiggr.local.dohd.org (Postfix, from userid 1002)
	id 268EB5D75; Sun, 23 Jul 2000 10:31:25 +0200 (CEST)
Message-Id: <20000723083125.268EB5D75@tiggr.local.dohd.org>
Date: Sun, 23 Jul 2000 10:31:25 +0200 (CEST)
From: xaa@dohd.org
Sender: xaa@dohd.cx
Reply-To: xaa@dohd.org
To: FreeBSD-gnats-submit@freebsd.org
Subject: *printf manpage doesn't document %n
X-Send-Pr-Version: 3.2

>Number:         20117
>Category:       docs
>Synopsis:       *printf manpage doesn't document %n
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-doc
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jul 23 01:40:00 PDT 2000
>Closed-Date:    Sun Feb 11 09:27:26 PST 2001
>Last-Modified:  Sun Feb 11 09:28:39 PST 2001
>Originator:     Mark Huizer
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:


>Description:

	I tried to look up the actions of printf("%n"), but it wasn't
	in the manpage, only in the code

>How-To-Repeat:

	

>Fix:
	This is a lousy bit of description for what it does, but well,
	it's better than nothing.

(Before Format:)
Result type:
	An optional character that indicates the type of the value for
	use with format characters n, i, o, u and x. 'q' (or 'll') stands
	for a quad int, 'l' for a long int, 'h' for a short int. Int is
	default.

In the format characters:
n	Returns the amount of characters output so far, including
	formating actions. Requires a pointer value to write the value
	to. Beware: this changes your parameter!


>Release-Note:
>Audit-Trail:

From: Sheldon Hearn <sheldonh@uunet.co.za>
To: xaa@dohd.org
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: docs/20117: *printf manpage doesn't document %n 
Date: Sun, 23 Jul 2000 11:36:06 +0200

 On Sun, 23 Jul 2000 10:31:25 +0200, xaa@dohd.org wrote:
 
 > 	I tried to look up the actions of printf("%n"), but it wasn't
 > 	in the manpage, only in the code
 
 I would urge anyone looking into this to examine the C standard before
 coming up with his own (possibly inferior) explanation.
 
 Ciao,
 Sheldon.
 

From: Mark Huizer <xaa@timewasters.nl>
To: FreeBSD-gnats-submit@FreeBSD.ORG
Cc:  
Subject: Re: docs/20117: *printf manpage doesn't document %n
Date: Sun, 23 Jul 2000 18:55:00 +0200

 The wise Sheldon Hearn produced the following lines:
 > On Sun, 23 Jul 2000 10:31:25 +0200, xaa@dohd.org wrote:
 > 
 > > 	I tried to look up the actions of printf("%n"), but it wasn't
 > > 	in the manpage, only in the code
 > 
 > I would urge anyone looking into this to examine the C standard before
 > coming up with his own (possibly inferior) explanation.
 > 
 None around :-)
 But well, I felt guilty not giving at least some attempt to fix it when
 I PR'ed it
 -- 
  Mark Huizer     -  xaa@timewasters.nl  -  xaa@dohd.cx  -  xaa@iae.nl
 
  If you're not in my dictionary, you're not in my universe.
  What would you like to be replaced with? (Clippy, the helpful
  paperclip)
 

From: "Jason M. Taylor" <jtaylor@precisioncs.net>
To: <freebsd-gnats-submit@FreeBSD.org>, <xaa@dohd.org>
Cc:  
Subject: Re: docs/20117: *printf manpage doesn't document %n
Date: Tue, 5 Dec 2000 10:25:58 -0500

 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
 After some looking, I found this documentation from the GNU libc
 manual. Would this be acceptable?
 
 	The `%n' conversion is unlike any of the other output conversions.
     It uses an argument which must be a pointer to an `int', but
 instead of
     printing anything it stores the number of characters printed so
 far by
     this call at that location.  The `h' and `l' type modifiers are
     permitted to specify that the argument is of type `short int *'
 or
     `long int *' instead of `int *', but no flags, field width, or
     precision are permitted.
 
        For example,
 
 int nchar;
 printf ("%d %s%n\n", 3, "bears", &nchar);
 
     prints:
 
 3 bears
 
     and sets `nchar' to `7', because `3 bears' is seven characters
 
 
 - -Jason
 
 -----BEGIN PGP SIGNATURE-----
 Version: PGPfreeware 6.5.8 for non-commercial use <http://www.pgp.com>
 
 iQA/AwUBOi0JBnGfX7CR8SmVEQLdhACfSerXAubqxVCEQR+XSrs5amYFEwoAoNiO
 4xvs5xthFEgh/PQ+A9Dffkdp
 =ZcL/
 -----END PGP SIGNATURE-----
 
 
 

From: Mark Huizer <xaa@timewasters.nl>
To: "Jason M. Taylor" <jtaylor@precisioncs.net>
Cc: freebsd-gnats-submit@FreeBSD.org, xaa@dohd.org
Subject: Re: docs/20117: *printf manpage doesn't document %n
Date: Tue, 5 Dec 2000 16:30:08 +0100

 The wise Jason M. Taylor produced the following lines:
 > -----BEGIN PGP SIGNED MESSAGE-----
 > Hash: SHA1
 > 
 > After some looking, I found this documentation from the GNU libc
 > manual. Would this be acceptable?
 > 
 > 	The `%n' conversion is unlike any of the other output conversions.
 >     It uses an argument which must be a pointer to an `int', but
 > instead of
 >     printing anything it stores the number of characters printed so
 > far by
 >     this call at that location.  The `h' and `l' type modifiers are
 >     permitted to specify that the argument is of type `short int *'
 > or
 >     `long int *' instead of `int *', but no flags, field width, or
 >     precision are permitted.
 > 
 >        For example,
 > 
 > int nchar;
 > printf ("%d %s%n\n", 3, "bears", &nchar);
 > 
 >     prints:
 > 
 > 3 bears
 > 
 >     and sets `nchar' to `7', because `3 bears' is seven characters
 > 
 Fine with me, as long as something is in the man pages :-)
 
 Mark
 
State-Changed-From-To: open->closed 
State-Changed-By: nik 
State-Changed-When: Sun Feb 11 09:27:26 PST 2001 
State-Changed-Why:  
iMy -current system has this in printf(3) 

n       The number of characters written so far is stored into the inte- 
ger indicated by the ``int *'' (or variant) pointer argument.  No 
argument is converted. 

As far as I can see, it's been there forever. 

The text is not quite as verbose as some of the suggested replacements, 
but I'm wary of lifting text directly from GPLd man pages and putting it 
in our base system. 

If you think the text isn't clear enough, please suggest a replacement 
(ideally, as a patch :-) ), and PR it.  Thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=20117 
>Unformatted:
