(root)/
coreutils-9.4/
gnulib-tests/
test-getopt-gnu.c
       1  /* Test of command line argument processing.
       2     Copyright (C) 2009-2023 Free Software Foundation, Inc.
       3  
       4     This program is free software: you can redistribute it and/or modify
       5     it under the terms of the GNU General Public License as published by
       6     the Free Software Foundation, either version 3 of the License, or
       7     (at your option) any later version.
       8  
       9     This program is distributed in the hope that it will be useful,
      10     but WITHOUT ANY WARRANTY; without even the implied warranty of
      11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      12     GNU General Public License for more details.
      13  
      14     You should have received a copy of the GNU General Public License
      15     along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
      16  
      17  /* Written by Bruno Haible <bruno@clisp.org>, 2009.  */
      18  
      19  #include <config.h>
      20  
      21  /* None of the files accessed by this test are large, so disable the
      22     ftell link warning if we are not using the gnulib ftell module.  */
      23  #define _GL_NO_LARGE_FILES
      24  
      25  /* POSIX and glibc provide the getopt() function in <unistd.h>, see
      26     https://pubs.opengroup.org/onlinepubs/9699919799/functions/getopt.html
      27     https://www.gnu.org/software/libc/manual/html_node/Using-Getopt.html
      28     But gnulib provides the getopt() function in <getopt.h>, not in <unistd.h>.
      29     This is what we are testing here.  */
      30  #include <getopt.h>
      31  
      32  #ifndef __getopt_argv_const
      33  # define __getopt_argv_const const
      34  #endif
      35  #include "signature.h"
      36  SIGNATURE_CHECK (getopt_long, int, (int, char *__getopt_argv_const *,
      37                                      char const *, struct option const *,
      38                                      int *));
      39  SIGNATURE_CHECK (getopt_long_only, int, (int, char *__getopt_argv_const *,
      40                                           char const *, struct option const *,
      41                                           int *));
      42  
      43  #define TEST_GETOPT_GNU 1
      44  #define TEST_GETOPT_TMP_NAME "test-getopt-gnu.tmp"
      45  #include "test-getopt-main.h"