/*
 *      dnsutl - utilities to make DNS easier to configure
 *      Copyright (C) 1991-1993, 1995, 1999, 2006, 2007 Peter Miller
 *
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 3 of the License, or
 *      (at your option) any later version.
 *
 *      This program 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 General Public License for more details.
 *
 *      You should have received a copy of the GNU General Public License
 *      along with this program. If not, see
 *      <http://www.gnu.org/licenses/>.
 */

#ifndef ARGLEX_H
#define ARGLEX_H

#include <main.h>

typedef enum arglex_token_ty arglex_token_ty;
enum arglex_token_ty
{
    arglex_token_eoln = -20,
    arglex_token_help,
    arglex_token_number,
    arglex_token_option,
    arglex_token_stdio,
    arglex_token_string,
    arglex_token_version,
};

typedef struct arglex_value_ty arglex_value_ty;
struct arglex_value_ty
{
    const char      *alv_string;
    long            alv_number;
    double          alv_double;
};

typedef struct arglex_table_ty arglex_table_ty;
struct arglex_table_ty
{
    const char      *name;
    int             token;
};

#define ARGLEX_TERMINATOR {0, 0}

extern arglex_token_ty arglex_token;
extern arglex_value_ty arglex_value;
extern char *progname;

void arglex_init(int argc, char **argv, arglex_table_ty *table);
arglex_token_ty arglex(void);
int argcmp(const char *formal, const char *actual);
void arglex_init_from_env(char *argv0, arglex_table_ty *table);
void arglex_set_progname(char *argv0);

#endif /* ARGLEX_H */


syntax highlighted by Code2HTML, v. 0.9.1