1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
/*
This file is part of SUPPL - the supplemental library for DOS
Copyright (C) 1996-2000 Steffen Kaiser
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: GETOPT.H 1.1 2001/02/27 01:29:33 ska Exp ska $
$Locker: ska $ $Name: $ $State: Exp $
Declarations of the GETOPT subsystem.
If macro GETOPT_LONG_NO_FLAG_MEMBER is defined before #including this
header, the 'options' structure does not contain the 'flag'
member.
*/
#ifndef __GETOPT_H
#define __GETOPT_H
#include <portable.h>
struct option {
const char *name;
int has_arg;
#ifndef GETOPT_LONG_NO_FLAG_MEMBER
int *flag;
#endif
int val;
};
struct getopt_save_t {
int gs_optind, gs_opterr;
const char *gs_optcur;
};
extern int optind, /* index into argv[] array */
optopt, /* unmodified last-read character */
opterr; /* if non-zero, visually displays errors */
extern char *optarg; /* address of argument of an argumented option */
extern const char *optcur; /* address of next character to parse as
option; if NULL, uses argv[optind] */
int getopt(int argc, const char * const * const argv, const char * const options);
int getopt_long(int argc, const char * const * const argv
, const char * const optstring
, const struct option * const longopts, int * const longindex);
int getopt_long_only(int argc, const char * const * const argv
, const char * const optstring
, const struct option * const longopts, int * const longindex);
int getopt_long_noFlag(int argc, const char * const * const argv
, const char * const optstring
, const struct option * const longopts, int * const longindex);
int getopt_long_only_noFlag(int argc, const char * const * const argv
, const char * const optstring
, const struct option * const longopts, int * const longindex);
#ifdef GETOPT_LONG_NO_FLAG_MEMBER
#define getopt_long getopt_long_noFlag
#define getopt_long_only getopt_long_only_noFlag
#endif
#define getopt_save(s) getopt_save_(aS(s))
void getopt_save_(struct getopt_save_t * const sbuf);
#define getopt_restore(s) getopt_restore_(aS(s))
void getopt_restore_(struct getopt_save_t * const sbuf);
void getopt_init(void);
#endif
|