From 2e6d6bacc2f0a30f7dbebc977d52904d4a823c45 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 26 Feb 2009 01:22:06 +0000 Subject: * include/features.h: If no feature selection given and we select by default a POSIX mode, also define __USE_POSIX_IMPLICITLY. * posix/Versions: Export __posix_getopt. * posix/getopt.c (_getopt_initialize): Take additional parameter. Use it to alternatively initialize __posixly_correct. (_getopt_internal_r): Take addition parameter. Pass on to _getopt_initialize. (_getopt_internal): Take addition parameter. Pass on to _getopt_internal_r. (getopt): Pass additional zero to _getopt_internal. (__posix_getopt): New function. * posix/getopt.h: Add redirection for getopt. * posix/getopt1.c (getopt_long): Pass additional zero to _getopt_internal. (getopt_long_only): Likewise. (_getopt_long_r): Pass additional zero to _getopt_internal_r. (_getopt_long_only_r): Likewise. * posix/getopt_int.h: Adjust declarations of _getopt_internal and _getopt_internal_r. --- posix/getopt.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'posix/getopt.h') diff --git a/posix/getopt.h b/posix/getopt.h index b7a026c..ff0251d 100644 --- a/posix/getopt.h +++ b/posix/getopt.h @@ -1,5 +1,5 @@ /* Declarations for getopt. - Copyright (C) 1989-1994,1996-1999,2001,2003,2004 + Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2009 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -151,6 +151,22 @@ struct option errors, only prototype getopt for the GNU C library. */ extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) __THROW; + +# if defined __need_getopt && defined __USE_POSIX2 \ + && !defined __USE_POSIX_IMPLICITLY && !defined __USE_GNU +/* The GNU getopt has more functionality than the standard version. The + additional functionality can be disable at runtime. This redirection + helps to also do this at runtime. */ +# ifdef __REDIRECT + extern int __REDIRECT (getopt, (int ___argc, char *const *___argv, + const char *__shortopts), + __posix_getopt) __THROW; +# else +extern int __posix_getopt (int ___argc, char *const *___argv, + const char *__shortopts) __THROW; +# define getopt __posix_getopt +# endif +# endif #else /* not __GNU_LIBRARY__ */ extern int getopt (); #endif /* __GNU_LIBRARY__ */ -- cgit v1.1