Commit Graph

21 Commits

Author SHA1 Message Date
drkhsh 0696635bcb radical re-formatting 0/3: Alphabetic headers
Except stated otherwise in comment.

Fixes coding style. Formatting commits suck, incoherent coding style
sucks more.
https://suckless.org/coding_style/
2022-10-28 01:03:20 +02:00
drkhsh 69b2487650 various: Put paths into defines to avoid line wraps
Long, wrapped, multi-line if statements suck to read.
This fixes readability in the worst places by packing format strings for
paths into defines.
2022-10-28 01:01:10 +02:00
NRK 28ef0b242c components/*.c: include slstatus.h
this gives the compiler a chance to check weather the prototype and
definiton matches or not, which would catch issues like 3c47701.
2022-10-26 23:32:07 +02:00
Michael Buch 86849d295b Add FreeBSD support for netspeeds, entropy and ip components 2019-02-07 12:23:01 +01:00
Aaron Marcher acfa1f50c2 Simplify format specifiers for uintmax_t 2018-07-07 11:08:26 +02:00
Aaron Marcher 43a12832a3 Change uint64_t to uintmax_t 2018-07-07 10:50:25 +02:00
Aaron Marcher 825f637e20 netspeeds: Fix indentation 2018-05-22 12:42:31 +02:00
Aaron Marcher cbbf59fd3d Change to fmt_human in netspeeds on OpenBSD
Thanks to Hiltjo
2018-05-22 12:21:52 +02:00
Aaron Marcher 10dbc9543e Merge fmt_human_2 and fmt_human_10 to one function
Now only one function, fmt_human, takes an additional argument "base".
2018-05-21 14:44:21 +02:00
Aaron Marcher ec5c35ec9f Remove units from numbers
This is a first step to decouple formatting from information because of
two reasons:

 1. The components should only gather and return the values by design
 2. Fine grained user control should be a focus

Scaling will be implemented in a different way in a later commit.
2018-05-21 00:16:54 +02:00
Aaron Marcher 3f45a5f7ca Remove initialization to 0 for static vars 2018-05-20 00:17:35 +02:00
Laslo Hunhold 46c4540dd2 Implement fmt_human_2() and fmt_human_10()
These functions take the raw number and a unit and automatically
print it out "scaled down" to a proper SI-prefix, for powers of 2
and 10 respectively.

Apply them to the 2-power cases and keep the 10-power for a later
commit.
2018-05-19 22:58:21 +02:00
Laslo Hunhold 68a3902dc5 Increase precision in netspeeds.c
First dividing by interval before multiplying with 1000 decreases the
precision by +-(interval - 1) * 1000, as interval arithmetic always
applies the Gauß-function to the result.

This is not necessary and simply reordering the operations mitigates
this.
2018-05-19 20:14:09 +02:00
Laslo Hunhold 422cadfd5f Implement esnprintf() and make formatted calls more efficient
Within the components, snprintf() was unchecked and had inefficient
calls in some places.
We implement esnprintf() that does all the dirty laundry for us
and use it exclusively now.
2018-05-19 19:44:02 +02:00
Aaron Marcher d47d78255e Use `int` for flags 2018-05-19 13:29:21 +02:00
Aaron Marcher 06d4447f03 Set {r,t}xbytes 0 before incrementing them on OBSD 2018-05-19 13:19:53 +02:00
Aaron Marcher a37224bf7b Missing assignment for last commit 2018-05-19 13:12:06 +02:00
Aaron Marcher e3ccac3298 Unify and simplify netspeed logic and types 2018-05-19 13:07:05 +02:00
Tobias Tschinkowitz 2321aecff0 netspeeds: added error condition for openbsd
implemented additional error condition for openbsd netstat in case the
interface could not be found in the interface list or if_data is not
readable.
2018-05-19 12:20:25 +02:00
Tobias Tschinkowitz 22175f0d57 implemented openbsd netspeed functions
implemented the netspeed functionality for openbsd.
furthermore the static keyword was removed of the interval variable in
config.def.h for usage as extern variable.
2018-05-19 01:44:36 +02:00
Aaron Marcher 0d05b3d13d Add network speed functions 2018-05-19 00:31:33 +02:00