Re: scanf(3) return value

2013-03-05 Thread Ted Unangst
On Tue, Mar 05, 2013 at 15:06, Otto Moerbeek wrote:

>> Probably just my English comprehension,
>> but "conversion such as end-of-file" bugs me.
> 
> How about:
> 
> The value EOF is returned if an input failure such as an end-of-file occurs
> before any conversion.

Yes.



Re: scanf(3) return value

2013-03-05 Thread Jason McIntyre
On Tue, Mar 05, 2013 at 04:03:10PM +0100, Otto Moerbeek wrote:
> > 
> > better than mine, but better still with commas after "failure" and
> > "end-of-file".
> > 
> > jmc
> 
> Like this?
> 

yes. ok me.
jmc

>   -Otto
> 
> Index: scanf.3
> ===
> RCS file: /cvs/src/lib/libc/stdio/scanf.3,v
> retrieving revision 1.20
> diff -u -p -r1.20 scanf.3
> --- scanf.3   18 Jan 2012 14:01:38 -  1.20
> +++ scanf.3   5 Mar 2013 15:02:52 -
> @@ -423,8 +423,9 @@ such as an alphabetic character for a
>  conversion.
>  The value
>  .Dv EOF
> -is returned if an input failure occurs before any conversion such as an
> -end-of-file occurs.
> +is returned if an input failure,
> +such as an end-of-file,
> +occurs before any conversion.
>  If an error or end-of-file occurs after conversion has begun,
>  the number of conversions which were successfully completed is returned.
>  .Sh SEE ALSO



Re: scanf(3) return value

2013-03-05 Thread Otto Moerbeek
On Tue, Mar 05, 2013 at 02:12:05PM +, Jason McIntyre wrote:

> On Tue, Mar 05, 2013 at 03:06:34PM +0100, Otto Moerbeek wrote:
> > On Tue, Mar 05, 2013 at 03:00:01PM +0100, Jan Stary wrote:
> > 
> > > On Mar 05 13:30:53, j...@kerhand.co.uk wrote:
> > > > On Sun, Mar 03, 2013 at 11:40:52AM +0100, Jan Stary wrote:
> > > > > The following part of the scanf(3) manpage
> > > > > probably needs to be reworded:
> > > > > 
> > > > >   The value
> > > > >   .Dv EOF
> > > > >   is returned if an input failure occurs before any conversion such 
> > > > > as an
> > > > >   end-of-file occurs.
> > > > > 
> > > > > (I won't even attempt it, as I am not sure
> > > > > what the behaviour actually is.)
> > > > > 
> > > > 
> > > > what is wrong with it?
> > > 
> > > Probably just my English comprehension,
> > > but "conversion such as end-of-file" bugs me.
> > 
> > How about:
> > 
> > The value EOF is returned if an input failure such as an end-of-file occurs
> > before any conversion.
> > 
> > -Otto
> > 
> 
> better than mine, but better still with commas after "failure" and
> "end-of-file".
> 
> jmc

Like this?

-Otto

Index: scanf.3
===
RCS file: /cvs/src/lib/libc/stdio/scanf.3,v
retrieving revision 1.20
diff -u -p -r1.20 scanf.3
--- scanf.3 18 Jan 2012 14:01:38 -  1.20
+++ scanf.3 5 Mar 2013 15:02:52 -
@@ -423,8 +423,9 @@ such as an alphabetic character for a
 conversion.
 The value
 .Dv EOF
-is returned if an input failure occurs before any conversion such as an
-end-of-file occurs.
+is returned if an input failure,
+such as an end-of-file,
+occurs before any conversion.
 If an error or end-of-file occurs after conversion has begun,
 the number of conversions which were successfully completed is returned.
 .Sh SEE ALSO



Re: scanf(3) return value

2013-03-05 Thread Otto Moerbeek
On Tue, Mar 05, 2013 at 03:45:22PM +0100, Matthias Appel wrote:

> Am 05.03.2013 15:12, schrieb Jason McIntyre:
> >On Tue, Mar 05, 2013 at 03:06:34PM +0100, Otto Moerbeek wrote:
> >>On Tue, Mar 05, 2013 at 03:00:01PM +0100, Jan Stary wrote:
> >>
> >>>On Mar 05 13:30:53, j...@kerhand.co.uk wrote:
> On Sun, Mar 03, 2013 at 11:40:52AM +0100, Jan Stary wrote:
> >The following part of the scanf(3) manpage
> >probably needs to be reworded:
> >
> >   The value
> >   .Dv EOF
> >   is returned if an input failure occurs before any conversion such as 
> > an
> >   end-of-file occurs.
> >
> >(I won't even attempt it, as I am not sure
> >what the behaviour actually is.)
> >
> what is wrong with it?
> >>>Probably just my English comprehension,
> >>>but "conversion such as end-of-file" bugs me.
> >>How about:
> >>
> >>The value EOF is returned if an input failure such as an end-of-file occurs
> >>before any conversion.
> >>
> >>-Otto
> >>
> >better than mine, but better still with commas after "failure" and
> >"end-of-file".
> >
> >jmc
> >
> 
> How about:
> 
> If an input failure, like end-of-file, occures, the value EOF is
> returned, before attempting any conversion.
> 
> Maybe change _before_ to _instead_, i think this describes the
> process more detailed (AFAIK in case of error, there is no
> conversion at all)

The point is, that if the error occurred after some conversions were
done, no EOF is returned but the number of succesful conversions. I
don't think your version makes that clear. 

-Otto



Re: scanf(3) return value

2013-03-05 Thread Matthias Appel

Am 05.03.2013 15:12, schrieb Jason McIntyre:

On Tue, Mar 05, 2013 at 03:06:34PM +0100, Otto Moerbeek wrote:

On Tue, Mar 05, 2013 at 03:00:01PM +0100, Jan Stary wrote:


On Mar 05 13:30:53, j...@kerhand.co.uk wrote:

On Sun, Mar 03, 2013 at 11:40:52AM +0100, Jan Stary wrote:

The following part of the scanf(3) manpage
probably needs to be reworded:

   The value
   .Dv EOF
   is returned if an input failure occurs before any conversion such as an
   end-of-file occurs.

(I won't even attempt it, as I am not sure
what the behaviour actually is.)


what is wrong with it?

Probably just my English comprehension,
but "conversion such as end-of-file" bugs me.

How about:

The value EOF is returned if an input failure such as an end-of-file occurs
before any conversion.

-Otto


better than mine, but better still with commas after "failure" and
"end-of-file".

jmc



How about:

If an input failure, like end-of-file, occures, the value EOF is 
returned, before attempting any conversion.


Maybe change _before_ to _instead_, i think this describes the process 
more detailed (AFAIK in case of error, there is no conversion at all)


Regards,

Matthias



Re: scanf(3) return value

2013-03-05 Thread Jason McIntyre
On Tue, Mar 05, 2013 at 03:06:34PM +0100, Otto Moerbeek wrote:
> On Tue, Mar 05, 2013 at 03:00:01PM +0100, Jan Stary wrote:
> 
> > On Mar 05 13:30:53, j...@kerhand.co.uk wrote:
> > > On Sun, Mar 03, 2013 at 11:40:52AM +0100, Jan Stary wrote:
> > > > The following part of the scanf(3) manpage
> > > > probably needs to be reworded:
> > > > 
> > > >   The value
> > > >   .Dv EOF
> > > >   is returned if an input failure occurs before any conversion such as 
> > > > an
> > > >   end-of-file occurs.
> > > > 
> > > > (I won't even attempt it, as I am not sure
> > > > what the behaviour actually is.)
> > > > 
> > > 
> > > what is wrong with it?
> > 
> > Probably just my English comprehension,
> > but "conversion such as end-of-file" bugs me.
> 
> How about:
> 
> The value EOF is returned if an input failure such as an end-of-file occurs
> before any conversion.
> 
>   -Otto
> 

better than mine, but better still with commas after "failure" and
"end-of-file".

jmc



Re: scanf(3) return value

2013-03-05 Thread Jason McIntyre
On Tue, Mar 05, 2013 at 03:00:01PM +0100, Jan Stary wrote:
> On Mar 05 13:30:53, j...@kerhand.co.uk wrote:
> > On Sun, Mar 03, 2013 at 11:40:52AM +0100, Jan Stary wrote:
> > > The following part of the scanf(3) manpage
> > > probably needs to be reworded:
> > > 
> > >   The value
> > >   .Dv EOF
> > >   is returned if an input failure occurs before any conversion such as an
> > >   end-of-file occurs.
> > > 
> > > (I won't even attempt it, as I am not sure
> > > what the behaviour actually is.)
> > > 
> > 
> > what is wrong with it?
> 
> Probably just my English comprehension,
> but "conversion such as end-of-file" bugs me.
> 

i think the intent is:

The value EOF is returned if an input failure occurs
before any conversion, such as an end-of-file occuring.

too much occuring! if a developer wants to check that that is the
intent, i can fix it.

jmc



Re: scanf(3) return value

2013-03-05 Thread Otto Moerbeek
On Tue, Mar 05, 2013 at 03:00:01PM +0100, Jan Stary wrote:

> On Mar 05 13:30:53, j...@kerhand.co.uk wrote:
> > On Sun, Mar 03, 2013 at 11:40:52AM +0100, Jan Stary wrote:
> > > The following part of the scanf(3) manpage
> > > probably needs to be reworded:
> > > 
> > >   The value
> > >   .Dv EOF
> > >   is returned if an input failure occurs before any conversion such as an
> > >   end-of-file occurs.
> > > 
> > > (I won't even attempt it, as I am not sure
> > > what the behaviour actually is.)
> > > 
> > 
> > what is wrong with it?
> 
> Probably just my English comprehension,
> but "conversion such as end-of-file" bugs me.

How about:

The value EOF is returned if an input failure such as an end-of-file occurs
before any conversion.

-Otto



Re: scanf(3) return value

2013-03-05 Thread Jan Stary
On Mar 05 13:30:53, j...@kerhand.co.uk wrote:
> On Sun, Mar 03, 2013 at 11:40:52AM +0100, Jan Stary wrote:
> > The following part of the scanf(3) manpage
> > probably needs to be reworded:
> > 
> >   The value
> >   .Dv EOF
> >   is returned if an input failure occurs before any conversion such as an
> >   end-of-file occurs.
> > 
> > (I won't even attempt it, as I am not sure
> > what the behaviour actually is.)
> > 
> 
> what is wrong with it?

Probably just my English comprehension,
but "conversion such as end-of-file" bugs me.



Re: scanf(3) return value

2013-03-05 Thread Jason McIntyre
On Sun, Mar 03, 2013 at 11:40:52AM +0100, Jan Stary wrote:
> The following part of the scanf(3) manpage
> probably needs to be reworded:
> 
>   The value
>   .Dv EOF
>   is returned if an input failure occurs before any conversion such as an
>   end-of-file occurs.
> 
> (I won't even attempt it, as I am not sure
> what the behaviour actually is.)
> 

what is wrong with it?
jmc



scanf(3) return value

2013-03-03 Thread Jan Stary
The following part of the scanf(3) manpage
probably needs to be reworded:

  The value
  .Dv EOF
  is returned if an input failure occurs before any conversion such as an
  end-of-file occurs.

(I won't even attempt it, as I am not sure
what the behaviour actually is.)