Re: [patch] have rtprio check that arguments are numeric; change atoi to strtol

2011-01-04 Thread Garrett Cooper
On Jan 4, 2011, at 10:12 AM, Giorgos Keramidas wrote: > On Tue, 4 Jan 2011 08:58:48 -0800, Garrett Cooper wrote: > + errno = 0; > + res = strtol(str, &endp, 10); > + if (errno != 0 || endp == str || *endp != '\0') > + err(1, "%s shall be a number", errname); Sma

Re: [patch] have rtprio check that arguments are numeric; change atoi to strtol

2011-01-04 Thread Giorgos Keramidas
On Tue, 4 Jan 2011 08:58:48 -0800, Garrett Cooper wrote: + errno = 0; + res = strtol(str, &endp, 10); + if (errno != 0 || endp == str || *endp != '\0') + err(1, "%s shall be a number", errname); >>> >>> Small nit, maybe use 'must' instead of 'shall'. >> >> it seems

Re: [patch] have rtprio check that arguments are numeric; change atoi to strtol

2011-01-04 Thread Garrett Cooper
On Jan 4, 2011, at 5:49 AM, Alexander Best wrote: > On Tue Jan 4 11, John Baldwin wrote: >> On Tuesday, January 04, 2011 6:25:02 am Kostik Belousov wrote: >>> On Tue, Jan 04, 2011 at 11:40:45AM +0100, Giorgos Keramidas wrote: >>> @@ -123,12 +121,28 @@ main(argc, argv) >>> } >>>

Re: [patch] have rtprio check that arguments are numeric; change atoi to strtol

2011-01-04 Thread Alexander Best
On Tue Jan 4 11, John Baldwin wrote: > On Tuesday, January 04, 2011 6:25:02 am Kostik Belousov wrote: > > On Tue, Jan 04, 2011 at 11:40:45AM +0100, Giorgos Keramidas wrote: > > @@ -123,12 +121,28 @@ main(argc, argv) > > } > > exit(0); > > } > > - exit (1); > > + exi

Re: [patch] have rtprio check that arguments are numeric; change atoi to strtol

2011-01-04 Thread John Baldwin
On Tuesday, January 04, 2011 6:25:02 am Kostik Belousov wrote: > On Tue, Jan 04, 2011 at 11:40:45AM +0100, Giorgos Keramidas wrote: > @@ -123,12 +121,28 @@ main(argc, argv) > } > exit(0); > } > - exit (1); > + exit(1); > +} > + > +static int > +parseint(con

Re: [patch] have rtprio check that arguments are numeric; change atoi to strtol

2011-01-04 Thread Giorgos Keramidas
On Tue, 4 Jan 2011 13:25:02 +0200, Kostik Belousov wrote: >On Tue, Jan 04, 2011 at 11:40:45AM +0100, Giorgos Keramidas wrote: >>On Tue, 04 Jan 2011 11:36:38 +0100, Giorgos Keramidas >>wrote: >>> Since the pattern of converting strings to int-derivative values appears >>> multiple times, I'd prob

Re: [patch] have rtprio check that arguments are numeric; change atoi to strtol

2011-01-04 Thread Kostik Belousov
On Tue, Jan 04, 2011 at 11:40:45AM +0100, Giorgos Keramidas wrote: > On Tue, 04 Jan 2011 11:36:38 +0100, Giorgos Keramidas > wrote: > > On Sun, 2 Jan 2011 18:46:47 -0500, Eitan Adler wrote: > >> What about this patch? I incorporated your feedback so I am not going > >> to reply inline. > > > >

Re: [patch] have rtprio check that arguments are numeric; change atoi to strtol

2011-01-04 Thread Giorgos Keramidas
On Tue, 04 Jan 2011 11:36:38 +0100, Giorgos Keramidas wrote: > On Sun, 2 Jan 2011 18:46:47 -0500, Eitan Adler wrote: >> What about this patch? I incorporated your feedback so I am not going >> to reply inline. > > Since the pattern of converting strings to int-derivative values appears > multip

Re: [patch] have rtprio check that arguments are numeric; change atoi to strtol

2011-01-04 Thread Giorgos Keramidas
On Sun, 2 Jan 2011 18:46:47 -0500, Eitan Adler wrote: > What about this patch? I incorporated your feedback so I am not going > to reply inline. Since the pattern of converting strings to int-derivative values appears multiple times, I'd probably prefer something like a new function that does th

Re: [patch] have rtprio check that arguments are numeric; change atoi to strtol

2011-01-03 Thread Kostik Belousov
On Sun, Jan 02, 2011 at 06:46:47PM -0500, Eitan Adler wrote: > What about this patch? I incorporated your feedback so I am not going > to reply inline. > > > The syntax of the prio commands is weird, there is an obvious corner > > (or wrongly handled) case, where the command name starts with a di

Re: [patch] have rtprio check that arguments are numeric; change atoi to strtol

2011-01-02 Thread Eitan Adler
What about this patch? I incorporated your feedback so I am not going to reply inline. > The syntax of the prio commands is weird, there is an obvious corner > (or wrongly handled) case, where the command name starts with a digit. > Command name starting with dash is even harder. > I agree - and

Re: [patch] have rtprio check that arguments are numeric; change atoi to strtol

2011-01-02 Thread Giorgos Keramidas
On Sun, 2 Jan 2011 12:18:45 +0200, Kostik Belousov wrote: > On Sun, Jan 02, 2011 at 02:41:10AM -0500, Eitan Adler wrote: >> > Just set the second argument to strtol to something non-NULL and then check >> > the value returned; that will help provide the error handling with >> > simplicity that you

Re: [patch] have rtprio check that arguments are numeric; change atoi to strtol

2011-01-02 Thread Kostik Belousov
On Sun, Jan 02, 2011 at 02:41:10AM -0500, Eitan Adler wrote: > > Just set the second argument to strtol to something non-NULL and then check > > the value returned; that will help provide the error handling with > > simplicity that you desire :). > > How about this version? It also corrects a copy

[patch] have rtprio check that arguments are numeric; change atoi to strtol

2011-01-01 Thread Eitan Adler
> Just set the second argument to strtol to something non-NULL and then check > the value returned; that will help provide the error handling with > simplicity that you desire :). How about this version? It also corrects a copy/paste error I have above Index: rtprio.c

[patch] have rtprio check that arguments are numeric; change atoi to strtol

2011-01-01 Thread Eitan Adler
When looking at the rtprio(1) source I noticed that the dg in revision 3291 has indicated that he wanted to check to ensure that the user provided priority was numeric. Also the man page for atoi says the function is deprecated - so I replaced those functions as well. Index: rtprio.c =