Add test case from a recent glibc bug.
[gnulib.git] / tests / test-getopt-posix.c
blobb13f987deed0d4998a1350de98ae717b663e4880
1 /* Test of command line argument processing.
2 Copyright (C) 2009-2018 Free Software Foundation, Inc.
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.
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.
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/>. */
17 /* Written by Bruno Haible <bruno@clisp.org>, 2009. */
19 #include <config.h>
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
25 /* POSIX and glibc provide the getopt() function in <unistd.h>, see
26 http://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 Nevertheless the getopt() function should also be found in <unistd.h>. */
30 #include <unistd.h>
32 #define TEST_GETOPT_GNU 0
33 #define TEST_GETOPT_TMP_NAME "test-getopt-posix.tmp"
34 #include "test-getopt-main.h"