9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] srprint...
@ 2004-01-26 18:11 steve-simon
  2004-01-26 18:53 ` rog
  0 siblings, 1 reply; 3+ messages in thread
From: steve-simon @ 2004-01-26 18:11 UTC (permalink / raw)
  To: 9fans

Hi,

I copied and modified the standard libraries smprint()
producing a mutant srprint(Fmt *f, char *fmt, ...);

The idea is that you can call it with a zero'ed Fmt pointer
and then keep srprint()ing into an growing buffer.

I have a filesystem which generates largeish virtual files
(<= 10 Kbytes) which is generated when the file is opened,
This seemed to be the best way to do it but I cannot beleive
noone has had this problem before.

The srprint() returns a pointer to the buffer like smprint()
for disposition and eventual free()ing.

If there is a cleaner way to do this I would like to know.
If people think its nice I could submit it.

Not sure if I'am proud or ashamed...

-Steve


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] srprint...
  2004-01-26 18:11 [9fans] srprint steve-simon
@ 2004-01-26 18:53 ` rog
  2004-01-27 10:15   ` Steve Simon
  0 siblings, 1 reply; 3+ messages in thread
From: rog @ 2004-01-26 18:53 UTC (permalink / raw)
  To: 9fans

> The idea is that you can call it with a zero'ed Fmt pointer
> and then keep srprint()ing into an growing buffer.

you can use fmtprint(2) to do this, if i understand your problem correctly.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] srprint...
  2004-01-26 18:53 ` rog
@ 2004-01-27 10:15   ` Steve Simon
  0 siblings, 0 replies; 3+ messages in thread
From: Steve Simon @ 2004-01-27 10:15 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 254 bytes --]

You are quite right,

Thanks.

-Steve

I must not mess with the source until I understand what I'am doing
I must not mess with the source until I understand what I'am doing
I must not mess with the source until I understand what I'am doing
...

[-- Attachment #2: Type: message/rfc822, Size: 2055 bytes --]

From: rog@vitanuova.com
To: 9fans@cse.psu.edu
Subject: Re: [9fans] srprint...
Date: Mon, 26 Jan 2004 18:53:11 0000
Message-ID: <4bc1cee93ce0bc4d4e24030b8b5f5a9d@vitanuova.com>

> The idea is that you can call it with a zero'ed Fmt pointer
> and then keep srprint()ing into an growing buffer.

you can use fmtprint(2) to do this, if i understand your problem correctly.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-01-27 10:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-26 18:11 [9fans] srprint steve-simon
2004-01-26 18:53 ` rog
2004-01-27 10:15   ` Steve Simon

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).