Major overhaul of rootmenu's file handling.
commit883600748ec1c74b055925fd4a51d103f2e86a79
authorTobias Stoeckmann <tobias@openbsd.org>
Sat, 5 May 2012 17:32:21 +0000 (5 19:32 +0200)
committerCarlos R. Mafra <crmafra@gmail.com>
Mon, 7 May 2012 23:49:15 +0000 (7 20:49 -0300)
treee68764b9c400583ffdb29d8008adaa986258602c
parent9e2d1b3ecf70839c8a56c4b720d2d184910b627c
Major overhaul of rootmenu's file handling.

This diff fixes a huge amount of issues that could be triggered by using
the old-fashioned configuration files, i.e menu.  They can be activated
by using a line like "/path/to/menu".  On most systems, this file will be
parsed with cpp and the result sent through a pipe to WindowMaker.

Anyway, in the code path, memory leaks and buffer overruns await. I have
tried to fix these parts, but in the end it is more or less a rewrite,
whereas I used WINGs whenever possible.

Difference to previous implementation, beside of bugfixes:
- You are free to use single quotes and double quotes in configuration
- Linewrapping is allowed for other pipe'd data, too
- In general, line reading is unified throughout that file

Bugfixes:
- Avoid buffer overrun on lines which have line wrappings, that will happen
  ALWAYS, because wtrimspace-usage was erroneously.
- Avoid memory leak, also happened through wtrimspace usage.
- Avoid buffer overrun in separateline if a line ending happens early.
- Actually handle ferror() instead of only feof(), that would result in
  endless spinning
- A line wrapping at the end of a file is an error.
src/rootmenu.c