Thursday, January 18, 2007

GNU Gengetopt 2.19.1

Although I released 2.19 of GNU Gengetopt few weeks ago, I had to release a fixed version: 2.19.1,

This release basically fixes some bugs such as:

  • fixed compilation problem that can make 'make check' fail on some systems
    lacking getopt_long.
  • fixed a test problem when not using GNU sed
  • in strings # comments are not considered
The first problem was quite interesting, since it was due to not passing to the C compiler the right command line switches, in particular the switch specifying the paths where to look for header files. In systems where getopt_long is not provided (or it is provided in a not too up to date version), the configure script provides the right version of sources with getopt_long functions. However, you must make sure to include the right version of the header file containing the prototype for getopt_long, otherwise, the C compiler will use the header file of the C library (this, of course, happens only in the case where the C library provides this function, but configure detected that it does not behave correctly - this is accomplished by using GNU Gnulib) and links to the customized version of getopt_long. Of course, the results will be unpredictable!

The second problem was due to a usage of sed with a regular expression which seems to work with GNU sed, but not with BSD sed (actually I don't know which version misbehaves). The solution was provided by Bob White (thanks again Bob!) and it is also online here.

The problem was that I was using this sed command line:
sed -e "s/^\(\([^\/]*\)\/\)\+//g"
in order to remove the directories of a path, while it was sufficient to use this simpler command line:
sed -e "s/^.*\///g"
since the * is greedy and will match the last /. Well done Bob! :-)

No comments: