This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.21-159-g7e7af34


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  7e7af3496ee4b13366726546dd8b712a698fa5c4 (commit)
      from  4ca8ddfb05ea7d888347bb96cfa431e0eb7fcd9a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=7e7af3496ee4b13366726546dd8b712a698fa5c4

commit 7e7af3496ee4b13366726546dd8b712a698fa5c4
Author: Rical Jasan <ricaljasan@pacific.net>
Date:   Fri Mar 6 00:59:49 2015 -0500

    manual: complete example in error message documentation
    
    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.

diff --git a/ChangeLog b/ChangeLog
index cda9af2..c7873da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2015-03-06  Rical Jasan  <ricaljasan@pacific.net>
+
+	* 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.
+
 2015-03-06  Mike Frysinger  <vapier@gentoo.org>
 
 	* manual/errno.texi (Error Messages): Delete strerror ISO C89
diff --git a/manual/errno.texi b/manual/errno.texi
index 315320d..1068be3 100644
--- a/manual/errno.texi
+++ b/manual/errno.texi
@@ -1377,6 +1377,8 @@ This variable's value is the name that was used to invoke the program
 running in the current process.  It is the same as @code{argv[0]}.  Note
 that this is not necessarily a useful file name; often it contains no
 directory names.  @xref{Program Arguments}.
+
+This variable is a GNU extension and is declared in @file{errno.h}.
 @end deftypevar
 
 @comment errno.h
@@ -1386,17 +1388,19 @@ This variable's value is the name that was used to invoke the program
 running in the current process, with directory names removed.  (That is
 to say, it is the same as @code{program_invocation_name} minus
 everything up to the last slash, if any.)
+
+This variable is a GNU extension and is declared in @file{errno.h}.
 @end deftypevar
 
 The library initialization code sets up both of these variables before
 calling @code{main}.
 
-@strong{Portability Note:} These two variables are GNU extensions.  If
-you want your program to work with non-GNU libraries, you must save the
-value of @code{argv[0]} in @code{main}, and then strip off the directory
-names yourself.  We added these extensions to make it possible to write
-self-contained error-reporting subroutines that require no explicit
-cooperation from @code{main}.
+@strong{Portability Note:} If you want your program to work with
+non-GNU libraries, you must save the value of @code{argv[0]} in
+@code{main}, and then strip off the directory names yourself.  We
+added these extensions to make it possible to write self-contained
+error-reporting subroutines that require no explicit cooperation from
+@code{main}.
 
 Here is an example showing how to handle failure to open a file
 correctly.  The function @code{open_sesame} tries to open the named file
@@ -1410,6 +1414,8 @@ save it in a local variable instead, because those other library
 functions might overwrite @code{errno} in the meantime.
 
 @smallexample
+#define _GNU_SOURCE
+
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog         |    8 ++++++++
 manual/errno.texi |   18 ++++++++++++------
 2 files changed, 20 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]