Re: [dev] fsbm (1) version 1.1 released

2016-02-11 Thread Alba Pompeo
So Calvin version works on Linux and Dimitris version works on OpenBSD and maybe NetBSD. Looks like everyone's covered :) On Thu, Feb 11, 2016 at 3:58 PM, Dimitris Papastamos wrote: > On Thu, Feb 11, 2016 at 12:55:34PM -0500, Calvin Morrison wrote: >> On 11 February 2016 at 12:53, Alba Pompeo

Re: [dev] fsbm (1) version 1.1 released

2016-02-11 Thread Dimitris Papastamos
On Thu, Feb 11, 2016 at 12:55:34PM -0500, Calvin Morrison wrote: > On 11 February 2016 at 12:53, Alba Pompeo wrote: > > It's not supposed to be used on Linux on the first place - right. > > My bad for missing this information. > > > > > > On Thu, Feb 11, 2016 at 3:51 PM, Dimitris Papastamos wrote

Re: [dev] fsbm (1) version 1.1 released

2016-02-11 Thread Calvin Morrison
On 11 February 2016 at 12:53, Alba Pompeo wrote: > It's not supposed to be used on Linux on the first place - right. > My bad for missing this information. > > > On Thu, Feb 11, 2016 at 3:51 PM, Dimitris Papastamos wrote: >> On Thu, Feb 11, 2016 at 03:48:34PM -0200, Alba Pompeo wrote: >>> Both ar

Re: [dev] fsbm (1) version 1.1 released

2016-02-11 Thread Alba Pompeo
It's not supposed to be used on Linux on the first place - right. My bad for missing this information. On Thu, Feb 11, 2016 at 3:51 PM, Dimitris Papastamos wrote: > On Thu, Feb 11, 2016 at 03:48:34PM -0200, Alba Pompeo wrote: >> Both are very cool! >> A nitpick is that Dimitri's version uses the

Re: [dev] fsbm (1) version 1.1 released

2016-02-11 Thread Dimitris Papastamos
On Thu, Feb 11, 2016 at 03:48:34PM -0200, Alba Pompeo wrote: > Both are very cool! > A nitpick is that Dimitri's version uses the nonstandard header sys/sysctl.h. > This prevents compilation on musl. Hm yes, it is only meant to work on OpenBSD. The sample() function is totally non-portable. (It

Re: [dev] fsbm (1) version 1.1 released

2016-02-11 Thread Alba Pompeo
Both are very cool! A nitpick is that Dimitri's version uses the nonstandard header sys/sysctl.h. This prevents compilation on musl. On Thu, Feb 11, 2016 at 3:41 PM, Dimitris Papastamos wrote: > On Thu, Feb 11, 2016 at 11:01:35AM -0500, Calvin Morrison wrote: >> Hi, >> >> I had time to commit my

Re: [dev] fsbm (1) version 1.1 released

2016-02-11 Thread Dimitris Papastamos
On Thu, Feb 11, 2016 at 11:01:35AM -0500, Calvin Morrison wrote: > Hi, > > I had time to commit my last changes into fsbm [0], the minimal > bandwidth meter. Notably the two features added are below: > > -r flag now accepted to show raw byte or bit counts, rather than > squashing into Kb/s Mb/s

[dev] fsbm (1) version 1.1 released

2016-02-11 Thread Calvin Morrison
Hi, I had time to commit my last changes into fsbm [0], the minimal bandwidth meter. Notably the two features added are below: -r flag now accepted to show raw byte or bit counts, rather than squashing into Kb/s Mb/s etc. -i flag now accepted to show a single interface that is requested For now

Re: [dev] fsbm

2014-11-08 Thread Dimitris Papastamos
On Sat, Nov 08, 2014 at 10:07:38AM -0500, random...@fastmail.us wrote: > On Fri, Nov 7, 2014, at 05:11, Dimitris Papastamos wrote: > > It is generally unlikely that the string has been validated to > > be an integer before getting to atoi(). With atoi() you cannot > > distinguish between an invali

Re: [dev] fsbm

2014-11-08 Thread random832
On Fri, Nov 7, 2014, at 05:11, Dimitris Papastamos wrote: > It is generally unlikely that the string has been validated to > be an integer before getting to atoi(). With atoi() you cannot > distinguish between an invalid integer and 0. > > Generally speaking, it should never be used. What if you

Re: [dev] fsbm

2014-11-08 Thread random832
On Fri, Nov 7, 2014, at 02:03, k...@shike2.com wrote: > I disagree, check the size before of calling strcpy. If you want to > avoid security risk you also have to check the output of strlcpy > to detect truncations, so you don't win anything. In both cases > you have to add a comparision, so it is

Re: [dev] fsbm

2014-11-07 Thread Calvin Morrison
If I fflush it, it works, but that seems hacky On 7 November 2014 13:28, Calvin Morrison wrote: > folks, > > I can't grep this program. I do not know why... Any ideas? > > On 7 November 2014 05:49, Dimitris Papastamos wrote: >> On Fri, Nov 07, 2014 at 11:40:03AM +0100, k...@shike2.com wrote: >>>

Re: [dev] fsbm

2014-11-07 Thread Calvin Morrison
folks, I can't grep this program. I do not know why... Any ideas? On 7 November 2014 05:49, Dimitris Papastamos wrote: > On Fri, Nov 07, 2014 at 11:40:03AM +0100, k...@shike2.com wrote: >> >> >> > * Use strtonum() or estrtol() from sbase instead of atoi(). >> >> >> >> I agree here if the string

Re: [dev] fsbm

2014-11-07 Thread Dimitris Papastamos
On Fri, Nov 07, 2014 at 11:40:03AM +0100, k...@shike2.com wrote: > > >> > * Use strtonum() or estrtol() from sbase instead of atoi(). > >> > >> I agree here if the string comes from the user. If the string > >> is an internal string then there is no problem with atoi. > > > > It is generally unl

Re: [dev] fsbm

2014-11-07 Thread Dimitris Papastamos
On Fri, Nov 07, 2014 at 11:27:35AM +0100, k...@shike2.com wrote: > >> I disagree, check the size before of calling strcpy. If you want to > >> avoid security risk you also have to check the output of strlcpy > >> to detect truncations, so you don't win anything. In both cases > >> you have to add a

Re: [dev] fsbm

2014-11-07 Thread k0ga
>> > * Use strtonum() or estrtol() from sbase instead of atoi(). >> >> I agree here if the string comes from the user. If the string >> is an internal string then there is no problem with atoi. > > It is generally unlikely that the string has been validated to > be an integer before getting to a

Re: [dev] fsbm

2014-11-07 Thread k0ga
>> I disagree, check the size before of calling strcpy. If you want to >> avoid security risk you also have to check the output of strlcpy >> to detect truncations, so you don't win anything. In both cases >> you have to add a comparision, so it is better to use strcpy that >> is standard. > > Goo

Re: [dev] fsbm

2014-11-07 Thread Dimitris Papastamos
On Fri, Nov 07, 2014 at 08:03:01AM +0100, k...@shike2.com wrote: > > > - Rename volatile bool q = false; to "isrunning". > > is.* is a reserved name space, it have not to be used in external scope. > > > > - Use the safer strlcpy or snprintf instead of strcpy(). > > I disagree, check the size

Re: [dev] fsbm

2014-11-07 Thread Dimitris Papastamos
On Fri, Nov 07, 2014 at 08:05:43AM +0100, k...@shike2.com wrote: > > > * Use strtonum() or estrtol() from sbase instead of atoi(). > > I agree here if the string comes from the user. If the string > is an internal string then there is no problem with atoi. It is generally unlikely that the strin

Re: [dev] fsbm

2014-11-07 Thread Hiltjo Posthuma
On Fri, Nov 7, 2014 at 8:03 AM, wrote: > >> - Rename volatile bool q = false; to "isrunning". > > is.* is a reserved name space, it have not to be used in external scope. > > >> - Use the safer strlcpy or snprintf instead of strcpy(). > > I disagree, check the size before of calling strcpy. If yo

Re: [dev] fsbm

2014-11-06 Thread k0ga
> * Use strtonum() or estrtol() from sbase instead of atoi(). I agree here if the string comes from the user. If the string is an internal string then there is no problem with atoi.

Re: [dev] fsbm

2014-11-06 Thread k0ga
> - Rename volatile bool q = false; to "isrunning". is.* is a reserved name space, it have not to be used in external scope. > - Use the safer strlcpy or snprintf instead of strcpy(). I disagree, check the size before of calling strcpy. If you want to avoid security risk you also have to check

Re: [dev] fsbm

2014-11-06 Thread Calvin Morrison
many of these issues have been fixed. some I did not fix, yet, some will not be fixed. Thank you for your input, may someone find this useful On 6 November 2014 12:05, Dimitris Papastamos wrote: > Some more feedback: > > * Use a more sensible formatting style (look at the suckless.org > projects

Re: [dev] fsbm

2014-11-06 Thread Dimitris Papastamos
Some more feedback: * Use a more sensible formatting style (look at the suckless.org projects or style(9) in OpenBSD.) * If a function is not intended to accept any arguments use void. Instead of: void foo(); Use: void foo(void); * Use BUFSIZ wherever possible instead of hardcoded

Re: [dev] fsbm

2014-11-06 Thread Hiltjo Posthuma
On Thu, Nov 6, 2014 at 4:33 AM, Calvin Morrison wrote: > On 31 October 2014 17:23, Calvin Morrison wrote: > > 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 o

Re: [dev] fsbm

2014-11-06 Thread Hiltjo Posthuma
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++

Re: [dev] fsbm

2014-11-05 Thread Calvin Morrison
On 31 October 2014 17:23, Calvin Morrison 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, Dimi

Re: [dev] fsbm

2014-10-31 Thread Calvin Morrison
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 wrote: > On Fri, Oct 31, 2014 at 04:53:28PM -0400, C

Re: [dev] fsbm

2014-10-31 Thread Dimitris Papastamos
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 s

Re: [dev] fsbm

2014-10-31 Thread FRIGN
On Fri, 31 Oct 2014 16:53:28 -0400 Calvin Morrison wrote: > 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 syst

[dev] fsbm

2014-10-31 Thread Calvin Morrison
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 c