From mboxrd@z Thu Jan 1 00:00:00 1970 From: list at eworm.de (Christian Hesse) Date: Mon, 7 Jan 2019 16:34:49 +0100 Subject: [PATCH 1/1] cgitrc: handle value "0" for max-repo-count In-Reply-To: <20181123170831.4904c09f@leda> References: <20180716143850.1726-1-list@eworm.de> <20180716164115.4ac02916@leda> <20180911085646.3cf9c469@leda> <20181123170831.4904c09f@leda> Message-ID: <20190107163449.51f869a5@leda> Christian Hesse on Fri, 2018/11/23 17:08: > "Jason A. Donenfeld" on Fri, 2018/10/19 00:52: > > Hey Christian, > > > > We should indeed introduce some sanitation helpers to deal with these > > in the general case. API suggestion: > > > > type_t parse_int(const char *str, type_t min, type_t max, type_t > > fallback_if_invalid); > > > > What would you think of that? > > My intention was to add a special value 0. How about this? > > type_t parse_int(const char *str, type_t min, type_t max, type_t > default_if_zero, type_t fallback_if_invalid); As atoi() does not return error there is no "invalid"... Looks like we have to go with: type_t parse_int(const char *str, type_t min, type_t max, type_t default_if_zero); -- main(a){char*c=/* Schoene Gruesse */"B?IJj;MEH" "CX:;",b;for(a/* Best regards my address: */=0;b=c[a++];) putchar(b-1/(/* Chris cc -ox -xc - && ./x */b/42*2-3)*42);} -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: