In particular,
- Add new --version command line option. (This was already documented in
the manpage.) Remove this information from the --help text. Also took
the opportunity to properly align the --fire line in the --help text.
- Remove WMFSM_VERSION macro in favor of PACKAGE_VERSION from autconf.
- Remove hard-coded version number at top of source file for
maintainability.
In particular,
- Apply, with some modification, a patch by Jari Aalto
<jari.aalto@poboxes.com> to clarify the format of the configuration file.
See [1].
- Escape minus signs to avoid hyphen-used-as-minus-sign Lintian warning in
the Debian package.
- Remove docbook-to-man comments to avoid manpage-has-errors-from-man
Lintian warning in the Debian package.
- Add commas between short and long options for readability.
[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?archive=yes&bug=226274
The individual patches no longer seem to exist, so I submit them together.
According to debian/changelog entries by Arthur Korn <arthur@debian.org>,
these patches include:
* fixed memleak introduced in 0.34-2 with the patch by Timo Benk.
global char *mp[] was assigned the result of stdup() repeatedly
without free. My ugly fix is to free it all up at the beginning of
readFileSystems(). Now I'm a proud Perl coder ... closes: #196057
* memleak news: avoid it if there are more than 9 filesystems too.
* Fixed filesystem name corruption, thanks to Ralf Horstmann and Cristian
Ionescu-Idbohrn for the patch.
In particular,
- Update AM_INIT_AUTOMAKE to silence "two- and three-arguments forms are
deprecated" warnings.
- Update AC_DEFINEs to silence "missing template" warnings.
There is no need to have a variable holding the interface name and
doing the exercise of stripping the trailing colon. It is enough
to just compare the line to check whether it contains the device
name. And only if it does we sscanf() its contents.
After a recent change in the kernel (their commit 6e094bd) my
wireless interface name is 8 characters long, wlp3s0b1. But
the wmnet code to read the received bytes
totalbytes_in = strtoul(&buffer[7], NULL, 10);
assumed that the interface name in /proc/net/dev would be 6 characters
long (and would start reading at position 7).
In the linux kernel mailing list I reported the regression and none
other than Al Viro replied,
> I am not sure if 'wmnet' could do this better (any suggestions?),
*snort*
well, yes - it's called scanf(). And if one is really, really nervous
about the overhead of <gasp> parsing a bunch of integers (as if fopen/
fgets/fclose alone won't cost enough to make constantly calling that
sucker a bad idea), just use ptr + <something> - 6 instead of
&buffer[<something>] in there. That thing has just found where the
colon was (and replaced it with NUL), so dealing with "the first field
turned out to be too long and shifted everything past it" isn't hard.
******
I also took the oportunity to remove the unused variables diffpackets_{in,out}
Drop "-p -o root -g root" from the INSTALL_* Makefile variables and honor
the CONF Makefile variable for accessing the global config file instead of
hardcoding it as /etc.
These changes allow users without root access to install wmcalc in their home
directory.
In particular,
- Drop INCLUDES and LIBINC variables; referenced deprecated X11R6 directories
and INCLUDES unnecessarily included the default path.
- Switch hard-coded gcc for CC variable.
- Move hard-coded -02 and -Wall flags to new CFLAGS variable.
- Switch ${} to $() for consistency.
- Add new INSTALL_DIR variable for creating installation directories.
- Respect CPPFLAGS and LDFLAGS.
To simplify maintenace, all references to the current version number outside
of the appropriate macro in in wmtime.c have been removed. Note that this
macro had been WMMON_VERSION, likely a copy/paste error, and has been
renamed to WMTIME_VERSION.
In particular,
- Remove reference to deprecated X11R6 directory.
- Honor PREFIX and INSTALL variables.
- Change definition of CFLAGS from += to =; perhaps users don't want to
append -O2. Also move -Wall to CFLAGS.
- Use C*FLAGS only when compiling and LDFLAGS only when linking.
- Create directories if needed during install.
- Install manpage.