~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to storage/ndb/test/include/getarg.h

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
Import upstream version 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2003 MySQL AB
 
2
 
 
3
   This program is free software; you can redistribute it and/or modify
 
4
   it under the terms of the GNU General Public License as published by
 
5
   the Free Software Foundation; version 2 of the License.
 
6
 
 
7
   This program is distributed in the hope that it will be useful,
 
8
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
   GNU General Public License for more details.
 
11
 
 
12
   You should have received a copy of the GNU General Public License
 
13
   along with this program; if not, write to the Free Software
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
15
 
 
16
/*
 
17
 * Copyright (c) 1997, 1999 Kungliga Tekniska H�gskolan
 
18
 * (Royal Institute of Technology, Stockholm, Sweden). 
 
19
 * All rights reserved. 
 
20
 *
 
21
 * Redistribution and use in source and binary forms, with or without 
 
22
 * modification, are permitted provided that the following conditions 
 
23
 * are met: 
 
24
 *
 
25
 * 1. Redistributions of source code must retain the above copyright 
 
26
 *    notice, this list of conditions and the following disclaimer. 
 
27
 *
 
28
 * 2. Redistributions in binary form must reproduce the above copyright 
 
29
 *    notice, this list of conditions and the following disclaimer in the 
 
30
 *    documentation and/or other materials provided with the distribution. 
 
31
 *
 
32
 * 3. Neither the name of the Institute nor the names of its contributors 
 
33
 *    may be used to endorse or promote products derived from this software 
 
34
 *    without specific prior written permission. 
 
35
 *
 
36
 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 
 
37
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
 
38
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
 
39
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 
 
40
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
 
41
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 
 
42
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
 
43
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
 
44
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 
 
45
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
 
46
 * SUCH DAMAGE. 
 
47
 */
 
48
 
 
49
/* $KTH: getarg.h,v 1.9 2000/09/01 21:25:55 lha Exp $ */
 
50
 
 
51
#ifndef __GETARG_H__
 
52
#define __GETARG_H__
 
53
 
 
54
#include <ndb_global.h>
 
55
 
 
56
#ifdef __cplusplus
 
57
extern "C" {
 
58
#endif
 
59
 
 
60
typedef enum { 
 
61
    arg_integer, 
 
62
    arg_string, 
 
63
    arg_flag, 
 
64
    arg_negative_flag, 
 
65
    arg_strings,
 
66
    arg_double,
 
67
    arg_collect,
 
68
    arg_counter
 
69
} arg_type;
 
70
 
 
71
struct getargs{
 
72
    const char *long_name;
 
73
    char short_name;
 
74
    arg_type type;
 
75
    void *value;
 
76
    const char *help;
 
77
    const char *arg_help;
 
78
};
 
79
 
 
80
enum {
 
81
    ARG_ERR_NO_MATCH  = 1,
 
82
    ARG_ERR_BAD_ARG,
 
83
    ARG_ERR_NO_ARG
 
84
};
 
85
 
 
86
typedef struct getarg_strings {
 
87
    int num_strings;
 
88
    char **strings;
 
89
} getarg_strings;
 
90
 
 
91
typedef int (*getarg_collect_func)(int short_opt,
 
92
                                   int argc,
 
93
                                   const char **argv,
 
94
                                   int *optind,
 
95
                                   int *optarg,
 
96
                                   void *data);
 
97
 
 
98
typedef struct getarg_collect_info {
 
99
    getarg_collect_func func;
 
100
    void *data;
 
101
} getarg_collect_info;
 
102
 
 
103
int getarg(struct getargs *args, size_t num_args, 
 
104
           int argc, const char **argv, int *optind);
 
105
 
 
106
void arg_printusage (struct getargs *args,
 
107
                     size_t num_args,
 
108
                     const char *progname,
 
109
                     const char *extra_string);
 
110
#ifdef __cplusplus
 
111
}
 
112
#endif
 
113
 
 
114
#endif /* __GETARG_H__ */