Re: systat(1): improve parsing of delay value

2021-01-28 Thread Alexander Bluhm
On Thu, Jan 28, 2021 at 09:06:51PM +0100, Martijn van Duren wrote: > Thanks for checking. Should be fixed below. OK bluhm@ > Index: main.c > === > RCS file: /cvs/src/usr.bin/systat/main.c,v > retrieving revision 1.72 > diff -u -p -r1

Re: systat(1): improve parsing of delay value

2021-01-28 Thread Martijn van Duren
On Tue, 2021-01-26 at 16:40 +0100, Alexander Bluhm wrote: > On Mon, Jan 25, 2021 at 11:17:04AM +0100, Martijn van Duren wrote: > > if (argc == 1) { > > -   double del = atof(argv[0]); > > -   if (del == 0) > > +   delay = strtodnum(argv[0], 0, UINT32_MAX

Re: systat(1): improve parsing of delay value

2021-01-26 Thread Alexander Bluhm
On Mon, Jan 25, 2021 at 11:17:04AM +0100, Martijn van Duren wrote: > if (argc == 1) { > - double del = atof(argv[0]); > - if (del == 0) > + delay = strtodnum(argv[0], 0, UINT32_MAX / 100, &errstr); > + if (errstr != NULL) >

Re: systat(1): improve parsing of delay value

2021-01-25 Thread Martijn van Duren
On Mon, 2021-01-25 at 10:50 +0100, Martijn van Duren wrote: > On Mon, 2021-01-25 at 08:15 +, Nick Gasson wrote: > > Hi, > > > > I incorrectly ran "systat netstat -N" instead of "systat -N netstat" and > > got confused why it wasn't resolving host names. The -N gets parsed with > > atof to a 0s

Re: systat(1): improve parsing of delay value

2021-01-25 Thread Martijn van Duren
On Mon, 2021-01-25 at 08:15 +, Nick Gasson wrote: > Hi, > > I incorrectly ran "systat netstat -N" instead of "systat -N netstat" and > got confused why it wasn't resolving host names. The -N gets parsed with > atof to a 0s delay that is then clamped to 5s. The patch below instead > prints an e

systat(1): improve parsing of delay value

2021-01-25 Thread Nick Gasson
Hi, I incorrectly ran "systat netstat -N" instead of "systat -N netstat" and got confused why it wasn't resolving host names. The -N gets parsed with atof to a 0s delay that is then clamped to 5s. The patch below instead prints an error if the delay cannot be parsed. I think the <= 0 case should a