2 * lxc: linux Container library
4 * (C) Copyright IBM Corp. 2007, 2008
7 * Daniel Lezcano <dlezcano at fr.ibm.com>
8 * Michel Normand <normand at fr.ibm.com>
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 typedef int (*lxc_arguments_parser_t
) (struct lxc_arguments
*, int, char*);
32 typedef int (*lxc_arguments_checker_t
) (const struct lxc_arguments
*);
34 struct lxc_arguments
{
37 const struct option
* options
;
38 lxc_arguments_parser_t parser
;
39 lxc_arguments_checker_t checker
;
47 const char *statefile
;
49 /* for lxc-checkpoint */
58 /* remaining arguments */
63 #define LXC_COMMON_OPTIONS \
64 {"name", required_argument, 0, 'n'}, \
65 {"help", no_argument, 0, 'h'}, \
66 {"usage", no_argument, 0, OPT_USAGE}, \
67 {"quiet", no_argument, 0, 'q'}, \
68 {"logfile", required_argument, 0, 'o'}, \
69 {"logpriority", required_argument, 0, 'l'}, \
72 /* option keys for long only options */
73 #define OPT_USAGE 0x1000
75 extern int lxc_arguments_parse(struct lxc_arguments
*args
,
76 int argc
, char *const argv
[]);
78 extern char **lxc_arguments_dup(const char *file
, struct lxc_arguments
*args
);
80 extern const char *lxc_strerror(int errnum
);
82 #define lxc_error(arg, fmt, args...) if (!(arg)->quiet) \
83 fprintf(stderr, "%s: " fmt "\n", (arg)->progname, ## args)