Hi Tobias, Tobias Stoeckmann wrote on Tue, Mar 27, 2018 at 11:51:29PM +0200: > On Tue, Mar 27, 2018 at 11:47:27PM +0200, Ingo Schwarze wrote:
>> See inline for one optional suggestion. >>> if (!stop || !start) >>> errx(1, "[-bcf] list: values may not include zero"); >> Consider deleting these two lines, too. >> >> You new function read_number() already makes sure that neither stop >> nor start can be 0 at this point. > Beware that you can actually reach that point if you call cut with an > empty list argument, like: > > $ cut -c '' - > cut: [-bcf] list: values may not include zero > > It's therefore still required. Ouch, you are right. But then, the code feels counter-intuitive and the error message confusing. Would it make sense to change the error message to: errx(1, "[-bcf] list: empty list value"); schwarze@isnote $ cut -c '2,-,4' cut: [-bcf] list: empty list value schwarze@isnote $ cut -c '2,--,4' cut: [-bcf] list: empty list value schwarze@isnote $ cut -c '2,---,4' cut: [-bcf] list: illegal list value > Thinking about it, this might be a good regression candidate as well. Sounds reasonable. Yours, Ingo