<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:arial,sans-serif">On Thu, Apr 7, 2016 at 5:14 AM, Eric Sandeen </span><span dir="ltr" style="font-family:arial,sans-serif"><<a href="mailto:sandeen@sandeen.net" target="_blank">sandeen@sandeen.net</a>></span><span style="font-family:arial,sans-serif"> wrote:</span><br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class=""><br>
> + * minval, maxval OPTIONAL<br>
> + * These options are used for automatic range check and they have to be<br>
> + * always used together in pair. If you don't want to limit the max value,<br>
> + * use something like UINT_MAX. If no value is given, then you either has<br>
<br>
</span>then you must either supply your own validation, or ...<br>
<span class=""><br>
> + * to supply your own validation, or refuse any value in the 'case<br>
> + * X_SOMETHING' block. If you forget to pass a min or max value here, but<br>
<br>
</span>forget to define a min and max value (?)<br>
<span class=""><br>
> + * call a standard function for validating user's value, it will cause an<br>
> + * error message notifying you about this issue.<br>
> + *<br>
> + * (Said in another way, you can't have minval and maxval both equal<br>
> + * to zero. But if one value is different: minval=0 and maxval=1,<br>
> + * then it is OK.)<br>
<br>
</span>I think that makes sense ... by the time I got to the end of this I was a<br>
little confused. ;)<br>
<br>
So you don't have to define min/max, but if you call getnum_checked(), then<br>
min & max are required, and they can't both be zero - is that correct?<br></blockquote><div><br></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;display:inline">Yes. I couldn't find any usecase, where an option would accept only single hardcoded value (0, in this case) as an argument, and nothing else, because then it doesn't need the argument at all...</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;display:inline"> </div></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;display:inline"><br></div></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;display:inline">And because forgetting the min/maxval is easy (I know it first hand :-) ), I added the check for minval==0 && maxval == 0 to raise an error if you call getnum_checked() for this option.</div></div></div><div><br></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Cheers,</div><br></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Jan</div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Jan Tulak<br></div><a href="mailto:jtulak@redhat.com" target="_blank">jtulak@redhat.com</a> / <a href="mailto:jan@tulak.me" target="_blank">jan@tulak.me</a></div></div></div></div>
</div></div>