9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Why doesn't bio have bscanf?
@ 2005-09-23 15:39 Paul Lalonde
  2005-09-23 15:46 ` andrey mirtchovski
  2005-09-23 15:51 ` Russ Cox
  0 siblings, 2 replies; 4+ messages in thread
From: Paul Lalonde @ 2005-09-23 15:39 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

I'm having to write (yet another) a buffered IO library (I hate  
hardware that comes with broken buffered IO libs....grrr) and was  
thinking of cribbing bio, but some of the code we need to run is  
quite dependent on (yuck) fscanf-style processing.    Why doesn't bio  
have one?  Given the right argument I can get the fscanf-dependent  
parts reworked...

Thanks,
     Paul



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

* Re: [9fans] Why doesn't bio have bscanf?
  2005-09-23 15:39 [9fans] Why doesn't bio have bscanf? Paul Lalonde
@ 2005-09-23 15:46 ` andrey mirtchovski
  2005-09-23 15:59   ` Paul Lalonde
  2005-09-23 15:51 ` Russ Cox
  1 sibling, 1 reply; 4+ messages in thread
From: andrey mirtchovski @ 2005-09-23 15:46 UTC (permalink / raw)
  To: 9fans

> I'm having to write (yet another) a buffered IO library (I hate  
> hardware that comes with broken buffered IO libs....grrr) and was  
> thinking of cribbing bio, but some of the code we need to run is  
> quite dependent on (yuck) fscanf-style processing.    Why doesn't bio  
> have one?  Given the right argument I can get the fscanf-dependent  
> parts reworked...
> 
> Thanks,
>      Paul

how about just Brdstr() followed by sscanf()?



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

* Re: [9fans] Why doesn't bio have bscanf?
  2005-09-23 15:39 [9fans] Why doesn't bio have bscanf? Paul Lalonde
  2005-09-23 15:46 ` andrey mirtchovski
@ 2005-09-23 15:51 ` Russ Cox
  1 sibling, 0 replies; 4+ messages in thread
From: Russ Cox @ 2005-09-23 15:51 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> I'm having to write (yet another) a buffered IO library (I hate
> hardware that comes with broken buffered IO libs....grrr) and was
> thinking of cribbing bio, but some of the code we need to run is
> quite dependent on (yuck) fscanf-style processing.

Starting with bio and writing bscanf on top seems
preferable to starting from scratch.

> Why doesn't bio have one?  Given the right argument
> I can get the fscanf-dependent parts reworked...

I don't know, but the usual answer is that no one actually
wanted to use it.  I know that even when it's available
and appropriate I don't use it because it makes it harder
to give good error messages about what didn't parse right.
For example, you have no idea which line you're on after
you've scanned " ".

Russ


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

* Re: [9fans] Why doesn't bio have bscanf?
  2005-09-23 15:46 ` andrey mirtchovski
@ 2005-09-23 15:59   ` Paul Lalonde
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Lalonde @ 2005-09-23 15:59 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs


On 23-Sep-05, at 8:46 AM, andrey mirtchovski wrote:
>
> how about just Brdstr() followed by sscanf()?
>
>

Because the sscanf pattern may run out of buffer - a scanf call can  
read multiple lines, for example.
It's really just plain ugly.

The correct argument against it, credit to Russ, is error checking  
and recovery - we should be using real parsers for the ugly little  
files that are currently being munged with fscanf.

Paul



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

end of thread, other threads:[~2005-09-23 15:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-23 15:39 [9fans] Why doesn't bio have bscanf? Paul Lalonde
2005-09-23 15:46 ` andrey mirtchovski
2005-09-23 15:59   ` Paul Lalonde
2005-09-23 15:51 ` Russ Cox

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