Re: [hackers] [sbase] Rewrite foldline() in fold(1) || FRIGN

2015-03-17 Thread FRIGN
On Tue, 17 Mar 2015 11:35:33 +0100 Roberto E. Vargas Caballero k...@shike2.com wrote: Hey Roberto, It's a bit strange this fwrite, why don't you use putchar there? Look again, we write 'off' bytes, not 1. and why you check the return value of fwrite, but not the return value of putchar or

Re: [hackers] [sbase] Rewrite foldline() in fold(1) || FRIGN

2015-03-17 Thread Dimitris Papastamos
On Tue, Mar 17, 2015 at 11:35:33AM +0100, Roberto E. Vargas Caballero wrote: Hi, + for (p = str, col = 0; *p *p != '\n'; p++) { + if (!UTF8_POINT(*p) !bflag) + continue; + if (col = width) { + off = (sflag spacesect) ?

[hackers] [sbase] Add estrlcat() and estrlcpy() || FRIGN

2015-03-17 Thread git
commit 8729b6ba39a21229cf7de8ebc40960079c4bb1bf Author: FRIGN d...@frign.de Date: Tue Mar 17 11:24:49 2015 +0100 Add estrlcat() and estrlcpy() It has become a common idiom in sbase to check strlcat() and strlcpy() using if (strl{cat, cpy}(dst, src, siz) = siz)

Re: [hackers] [sbase] Rewrite foldline() in fold(1) || FRIGN

2015-03-17 Thread Roberto E. Vargas Caballero
Hi, + for (p = str, col = 0; *p *p != '\n'; p++) { + if (!UTF8_POINT(*p) !bflag) + continue; + if (col = width) { + off = (sflag spacesect) ? spacesect - str : p - str; + if (fwrite(str, 1, off,

[hackers] [sbase] Audit mktemp(1) || FRIGN

2015-03-17 Thread git
commit f724e87cc51c58404983439650f03851c897172f Author: FRIGN d...@frign.de Date: Tue Mar 17 11:01:33 2015 +0100 Audit mktemp(1) 1) Unglobalize variables. 2) Sort local variables. 3) Use return instead of exit() in main(). 4) Add empty line before return. diff --git

[hackers] [sbase] Rewrite foldline() in fold(1) || FRIGN

2015-03-17 Thread git
commit 9d151741258d6e2f7eb415b8783a2c2a9efbda04 Author: FRIGN d...@frign.de Date: Mon Mar 16 19:26:42 2015 +0100 Rewrite foldline() in fold(1) After the audit, I had this noted down as a TODO-item, but considered the function to be tested enough to hold the line until I