Cool! Some observations from a glance:
- Use the great arg.h from 20h: http://git.suckless.org/sbase/tree/arg.h instead of getopt. - Use sigaction(), not signal(), it's behaviour is more clear. - Use tabs for indenting, align with spaces (it seems to have mixed tabs / whitespace). - Don't use C++ style comments (//). - Do variable declarations at the top of a function. - Use the suckless Makefile style (respect PREFIX, DESTDIR etc). - Remove leftover config.h ? - Add the LEN() macro and use it for contructs like: (sizeof(prefixes) / sizeof(const char*)) - Handle ferror() for FILE *dev ? - Handle error case of: fgets(buf, sizeof(buf), dev); - ... etc.. :) Kind regards, Hiltjo On Thu, Nov 6, 2014 at 4:33 AM, Calvin Morrison <[email protected]> wrote: > On 31 October 2014 17:23, Calvin Morrison <[email protected]> wrote: >> Exactly, >> >> a C rewrite will be done, I just didn't have any more time. (time to >> go trick or treating!) [0] >> >> It reeks of stupid OOP when it doesn't need it at all >> >> Calvin >> >> [0] http://imgur.com/k0zhqNv >> >> On 31 October 2014 17:21, Dimitris Papastamos <[email protected]> wrote: >>> On Fri, Oct 31, 2014 at 04:53:28PM -0400, Calvin Morrison wrote: >>>> hi, >>>> >>>> I just released fsbm [0] a small bandwidth monitor >>>> >>>> i rewrote cbm, a bandwidth meter to output to stdout instead of >>>> writing out to curses. I find this to be more more palatable and I can >>>> use it with i3 or whatever status bar system I want. the code still >>>> sucks, but i only just hacked out the curses part, i now just need to >>>> rewrite the statistics function. >>>> >>>> overall, code is sucky, but better than before. >>> >>> I think you are missing a MetaVirtualBandwidthFactoryInterface. >>> > > Hidey Ho Neighbors, > > A rewrite to C has been done [0] Please check it out the code is > pretty reeky and I want some advice on how to make it suck less. I was > avoiding doing extra mallocs so there's a lot of ugly printfs, plus > there's still always an extra tabulator on the end field. > > Also, on an related note, someone dropeed a tiling wm in Rust:[1] > > Sincerely, > Calvin > [0] https://github.com/mutantturkey/fsbm/ > [1] https://github.com/Kintaro/wtftw >
