Often, the number currently being displayed has more than 10 digits.
However, when clearing the display, only the first 10 digits were cleared.
When a new number was entered, it would be prepended to any digits that
weren't cleared. This behavior was invisible to the user, causing
incorrect calculations, e.g., Debian bug #564173:
1814 / 720 * 300 -> 7568.41111
But the correct answer is 755.833333.
The problem was that when the display was cleared, the string that stores
this number was not null-terminated. Indeed, 1814 / 720 gives us
2.519444444 (6 4's), but only 2.51944444 (5 4's) is displayed. When we
begin to multiply by 300, the final 4 remained, and so we really were
multiplying by 3004.
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.