1 /* 2 * GetOpt functions 3 * 4 * Copyright (C) 2010-2021, Joachim Metz <joachim.metz@gmail.com> 5 * 6 * Refer to AUTHORS for acknowledgements. 7 * 8 * This program is free software: you can redistribute it and/or modify 9 * it under the terms of the GNU Lesser General Public License as published by 10 * the Free Software Foundation, either version 3 of the License, or 11 * (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public License 19 * along with this program. If not, see <https://www.gnu.org/licenses/>. 20 */ 21 22 #if !defined( _QCOW_TEST_GETOPT_H ) 23 #define _QCOW_TEST_GETOPT_H 24 25 #include <common.h> 26 #include <types.h> 27 28 /* unistd.h is included here to export getopt, optarg, optind and optopt 29 */ 30 #if defined( HAVE_UNISTD_H ) 31 #include <unistd.h> 32 #endif 33 34 #if defined( __cplusplus ) 35 extern "C" { 36 #endif 37 38 #if defined( HAVE_GETOPT ) 39 #define qcow_test_getopt( argument_count, argument_values, options_string ) \ 40 getopt( argument_count, argument_values, options_string ) 41 42 #else 43 44 #if !defined( __CYGWIN__ ) 45 extern int optind; 46 extern system_character_t *optarg; 47 extern system_integer_t optopt; 48 49 #else 50 int optind; 51 system_character_t *optarg; 52 system_integer_t optopt; 53 54 #endif /* !defined( __CYGWIN__ ) */ 55 56 system_integer_t qcow_test_getopt( 57 int argument_count, 58 system_character_t * const argument_values[], 59 const system_character_t *options_string ); 60 61 #endif /* defined( HAVE_GETOPT ) */ 62 63 #if defined( __cplusplus ) 64 } 65 #endif 66 67 #endif /* !defined( _QCOW_TEST_GETOPT_H ) */ 68 69