Replacement of the declaration for the variable "errno" by an include

The header "errno.h" defines the POSIX interface for the access to this
well-known information source for error codes.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Clarification of an if instruction

The compiler "g++ (GCC) 4.5.2" displayed the following message.

mkpar.c: In function 'unused_rules':
mkpar.c:179:8: warning: suggest explicit braces to avoid ambiguous 'else'

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Inclusion of <string.h>

The compiler "g++ (GCC) 4.5.2" displayed the following message.

mstring.c: In function 'msprintf':
mstring.c:23:5: warning: implicit declaration of function 'strlen'
mstring.c:23:11: warning: incompatible implicit declaration of built-in function 'strlen'
mstring.c:34:5: warning: implicit declaration of function 'memcpy'
mstring.c:34:5: warning: incompatible implicit declaration of built-in function 'memcpy'

This was fixed by use of the system header file "string.h".

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Addition of a type compatible comparison function for a binary search

The compiler "g++ (GCC) 4.5.2" displayed the following message.

reader.c: In function 'keyword':
reader.c:294:10: warning: passing argument 5 of 'bsearch' from incompatible pointer type

The function "search_strcmp" was added.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Replacement of the legacy function "mktemp" by the safer function "mkstemp"

The compiler "g++ (GCC) 4.5.2" displayed the following message.

main.o: In function `create_file_names':
main.c:298: warning: the use of `mktemp' is dangerous, better use `mkstemp'

This recommendation was applied.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Scope reduction for some functions by the mark "static"

Some functions were marked as "static" so that they will be only used
by their own module. The corresponding declarations were deleted from
the header file "defs.h".

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Adjustments for const-correctness

The key word "const" was added to the type specifiers for some function
parameters and variables.

See also:
http://en.wikipedia.org/wiki/Const-correctness

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Correction of signal handling implementation

The compiler "g++ (GCC) 4.5.2" displayed the following message.

main.c: In function 'set_signals':
main.c:89:2: warning: passing argument 2 of 'signal' from incompatible pointer type
/usr/include/signal.h:101:23: note: expected '__sighandler_t' but argument is of type 'void (*)(void)'
main.c:93:2: warning: passing argument 2 of 'signal' from incompatible pointer type
/usr/include/signal.h:101:23: note: expected '__sighandler_t' but argument is of type 'void (*)(void)'
main.c:97:2: warning: passing argument 2 of 'signal' from incompatible pointer type
/usr/include/signal.h:101:23: note: expected '__sighandler_t' but argument is of type 'void (*)(void)'

The reason was that a function "onintr" was used that did not have an integral
input parameter as expected. Its implementation called the function "done" which
is not async-signal-safe. This approach was corrected for a standard-compliant
signal handling.

See also:
The data type "sig_atomic_t" is the only type that can be safely used for
global write access in signal handlers.
https://www.securecoding.cert.org/confluence/display/seccode/SIG31-C.+Do+not+access+or+modify+shared+objects+in+signal+handlers

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Conversion of preprocessor definitions into enumerations

Some preprocessor definitions were converted into enumeration elements.
This refactoring stresses their relationships for the corresponding data type.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Deletion of duplicated function declarations

Four function declarations were deleted because they were duplicated.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Combination of six topics

* errno:
  Replacement of the declaration for the variable "errno" by an include

* braces:
  Clarification of an if instruction

* string:
  Inclusion of <string.h>

* binary_search:
  Addition of a type compatible comparison function for a binary search

* temporary_files:
  Replacement of the legacy function "mktemp" by the safer function "mkstemp"

* make_functions_static:
  Scope reduction for some functions by the mark "static"

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Adjustments for const-correctness
Correction of signal handling implementation

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Conversion of preprocessor definitions into enumerations
Deletion of duplicated function declarations

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Completion of error detection and corresponding exception handling

The detection of errors like the following was completed.
- Failed memory allocations
- Failed file output

Corresponding exception handling was added in some function implementations.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Mark functions that do not return.

A few functions were marked with function attributes to specify the fact
that their implementations do not return from a call.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Deletion of unneeded pointer checks

A few pointers were explicitly checked before they were passed to the function "free".
This was unnecessary.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Change some variables and functions to work with unsigned data types.

Some variables and functions should work with unsigned data types.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Consistent use of the pre-increment and pre-decrement operators

The use of pre-increment and pre-decrement operators is recommended at some places
in the source code. This recommendation was consistently applied.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>