[PATCH v2] Complete example in error message documentation.
ricaljasan
ricaljasan@pacific.net
Sun Oct 26 07:19:00 GMT 2014
Previously unquoted #include at beginning of line caused it to disappear
from commit message. Diff unchanged.
----
The manual gives "an example showing how to handle failure to open a
file correctly." The example function, open_sesame, uses the
newly-introduced strerror function and errno and
program_invocation_short_name variables. It fails to specify GNU
extensions, however, so attempts to use it in the following way:
int main (void) {open_sesame ("badname");}
fail during compilation with "error: âprogram_invocation_short_nameâ
undeclared", indicating the example is incomplete. The presence of
"#include"s suggest everything neccesary for the function to work should
be present. For completeness, the example is lacking the following line:
#define _GNU_SOURCE
as the declarations of program_invocation_*name in errno.h are wrapped
in an "#ifdef __USE_GNU" conditional.
The documentation of the variables is also expanded, adding that their
definition lies in errno.h and noting specifically they are GNU
extensions.
manual/errno.texi: Complete example function and expand
documentation of program_invocation*_name variables.
2014-10-25 Rical Jasan <redacted>
* manual/errno.texi (Error Messages): Complete example function
by adding missing #define.
(program_invocation_name): Add statement indicating GNU
extension and reference which header file declares the variable.
(program_invocation_short_name): Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example.diff
Type: text/x-patch
Size: 2111 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20141026/0ea9be22/attachment.bin>
More information about the Libc-alpha
mailing list