Commit Graph

17 Commits

Author SHA1 Message Date
FRIGN
f140403fca Audit cols(1)
1) Refactor manpage.
2) De-globalize local values.
3) update usage().
4) sort local variable declarations.
5) fix wrong argument in strtonum (3 -> 1).
6) argc-argv style, boolean style.
7) check bytes > 0 before accessing b.lines[i][bytes - 1]
   relying on len only makes sense but let's not push it.
7) don't break on maxlen > (chars - 1) / 2. This didn't even
   make sense.
8) _correctly_ calculate cols and rows in a readable way.
9) Rewrite loop over rows and cols in a readable way and
   using putchar in a loop instead of printf-magic or fputs
   where not necessary.
2015-03-08 19:49:59 +01:00
sin
9355d88aae Add COLUMNS support to cols(1)
First attempt to see if COLUMNS is set, if that fails an ioctl()
is issued to find the width of the output device.  If that fails
as well, we default to 65 chars per line.
2015-02-19 11:25:51 +00:00
FRIGN
31572c8b0e Clean up #includes 2015-02-14 21:12:23 +01:00
sin
71fb259d02 Remove evil and unused assert.h from cols(1) 2015-02-14 18:26:45 +00:00
FRIGN
27b770c02c Adjust some limits to more flexibility for strtonum 2015-02-01 01:24:03 +01:00
FRIGN
5a20d0e9d7 Finish up cols(1) 2015-02-01 00:55:22 +01:00
Jakob Kramer
4769b47dd7 Use size_t for number of lines in linebuf
.nlines and .capacity are used as array indices and
should therefore be of type size_t.
2015-01-31 22:49:43 +00:00
FRIGN
fd562481f3 Convert estrto{l, ul} to estrtonum
Enough with this insanity!
2015-01-30 16:52:44 +01:00
sin
909ffd5bf7 Update cols manpage 2014-12-08 15:14:08 +00:00
sin
45086e76f9 Remove old comment 2014-12-08 15:01:09 +00:00
Brandon Mulcahy
c4014b730e Use utflen in cols(1) 2014-12-05 21:41:36 +00:00
FRIGN
ec8246bbc6 Un-boolify sbase
It actually makes the binaries smaller, the code easier to read
(gems like "val == true", "val == false" are gone) and actually
predictable in the sense of that we actually know what we're
working with (one bitwise operator was quite adventurous and
should now be fixed).

This is also more consistent with the other suckless projects
around which don't use boolean types.
2014-11-14 10:54:20 +00:00
FRIGN
7d2683ddf2 Sort includes and more cleanup and fixes in util/ 2014-11-14 10:54:10 +00:00
FRIGN
eee98ed3a4 Fix coding style
It was about damn time. Consistency is very important in such a
big codebase.
2014-11-13 18:08:43 +00:00
sin
0c5b7b9155 Stop using EXIT_{SUCCESS,FAILURE} 2014-10-02 23:46:59 +01:00
Jakob Kramer
7f7e7dcbb9 cols: simplify filling with spaces
Use printf("%*s", n, "") instead of allocating
a string filled with spaces.
2014-06-05 11:19:34 +01:00
sin
bc0de5e7e5 Rename mc(1) to cols(1)
There is an obvious name collision with the popular file manager
midnight commander.
2014-03-12 14:47:38 +00:00