Skip to content
Snippets Groups Projects
Select Git revision
  • cmac-layout
  • master default
  • wip-slh-dsa-sha2-128s
  • master-updates
  • release-3.10-fixes
  • getopt-prototype
  • fix-bcrypt-warning
  • refactor-hmac
  • wip-use-alignas
  • trim-sha3-context
  • fix-gitlab-ci
  • check-fat-emulate
  • delete-digest_func-size
  • slh-dsa-shake-128f-nettle
  • slh-dsa-shake-128s-nettle
  • slh-dsa-shake-128s
  • delete-openpgp
  • ppc64-sha512
  • delete-md5-compat
  • cleanup-hmac-tests
  • ppc64-sha256
  • nettle_3.10.2_release_20250626
  • nettle_3.10.1_release_20241230
  • nettle_3.10_release_20240616
  • nettle_3.10rc2
  • nettle_3.10rc1
  • nettle_3.9.1_release_20230601
  • nettle_3.9_release_20230514
  • nettle_3.8.1_release_20220727
  • nettle_3.8_release_20220602
  • nettle_3.7.3_release_20210606
  • nettle_3.7.2_release_20210321
  • nettle_3.7.1_release_20210217
  • nettle_3.7_release_20210104
  • nettle_3.7rc1
  • nettle_3.6_release_20200429
  • nettle_3.6rc3
  • nettle_3.6rc2
  • nettle_3.6rc1
  • nettle_3.5.1_release_20190627
  • nettle_3.5_release_20190626
41 results

getopt.c

Blame
  • getopt.c 33.10 KiB
    /* Getopt for GNU.
       NOTE: getopt is part of the C library, so if you don't know what
       "Keep this file name-space clean" means, talk to drepper@gnu.org
       before changing it!
       Copyright (C) 1987-2014 Free Software Foundation, Inc.
       This file is part of the GNU C Library.
    
       The GNU C Library is free software; you can redistribute it and/or
       modify it under the terms of the GNU Lesser General Public
       License as published by the Free Software Foundation; either
       version 2.1 of the License, or (at your option) any later version.
    
       The GNU C Library is distributed in the hope that it will be useful,
       but WITHOUT ANY WARRANTY; without even the implied warranty of
       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       Lesser General Public License for more details.
    
       You should have received a copy of the GNU Lesser General Public
       License along with the GNU C Library; if not, see
       <http://www.gnu.org/licenses/>.  */
    
    /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
       Ditto for AIX 3.2 and <stdlib.h>.  */
    #ifndef _NO_PROTO
    # define _NO_PROTO
    #endif
    
    #ifdef HAVE_CONFIG_H
    # include <config.h>
    #endif
    
    #include <stdio.h>
    
    /* Comment out all this code if we are using the GNU C Library, and are not
       actually compiling the library itself.  This code is part of the GNU C
       Library, but also included in many other GNU distributions.  Compiling
       and linking in this code is a waste when using the GNU C library
       (especially if it is a shared library).  Rather than having every GNU
       program understand `configure --with-gnu-libc' and omit the object files,
       it is simpler to just do this in the source for each such file.  */
    
    #define GETOPT_INTERFACE_VERSION 2
    #if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
    # include <gnu-versions.h>
    # if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
    #  define ELIDE_CODE
    # endif
    #endif
    
    #ifndef ELIDE_CODE
    
    
    /* This needs to come after some library #include
       to get __GNU_LIBRARY__ defined.  */
    #ifdef	__GNU_LIBRARY__
    /* Don't include stdlib.h for non-GNU C libraries because some of them
       contain conflicting prototypes for getopt.  */
    # include <stdlib.h>
    # include <unistd.h>
    #endif	/* GNU C library.  */
    
    #include <string.h>
    
    #ifdef VMS
    # include <unixlib.h>
    #endif
    
    #ifdef _LIBC
    # include <libintl.h>
    #else