2 * Include file for client cmdline interface control functions for libcaptive
3 * Copyright (C) 2003 Jan Kratochvil <project-captive@jankratochvil.net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; exactly version 2 of June 1991 is required
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #ifndef _CAPTIVE_CLIENT_CMDLINE_MAIN_H
21 #define _CAPTIVE_CLIENT_CMDLINE_MAIN_H 1
24 #include <glib/gtypes.h>
25 #include <libgnomevfs/gnome-vfs-result.h>
26 #include <captive/client-vfs.h>
29 #define CMDLINE_POPT(longname,shortname,argInfoP,argP,descripP,argDescripP) \
31 longName: (longname), \
32 shortName: (shortname), \
33 argInfo: (argInfoP), \
36 descrip: (descripP), \
37 argDescrip: (argDescripP), \
39 extern const struct poptOption cmdline_poptHelpOptions[];
40 #define CMDLINE_POPT_AUTOHELP \
41 { NULL,'\0',POPT_ARG_INCLUDE_TABLE,(struct poptOption *)cmdline_poptHelpOptions,0,"Help options:",NULL },
44 #define CMDLINE_MAIN_ERROR (cmdline_main_error_quark())
45 GQuark cmdline_main_error_quark(void);
48 CMDLINE_MAIN_ERROR_UNKNOWN_COMMAND,
49 CMDLINE_MAIN_ERROR_INVALID_COMMAND_ARGUMENTS,
50 CMDLINE_MAIN_ERROR_READING_COMMAND_CONFIG,
51 CMDLINE_MAIN_ERROR_EXCEEDING_COMMAND_OPTION,
52 CMDLINE_MAIN_ERROR_INVALID_COMMAND_ARGUMENT_COUNT,
53 CMDLINE_MAIN_ERROR_GENERIC_ERROR
57 struct cmdline_command {
58 const gchar *name,*description;
59 const struct poptOption *table;
60 void (*func)(const char **cmd_argv,GError **errp);
61 gint argsn_min,argsn_max;
64 extern const struct cmdline_command cmdline_command_table[];
67 extern CaptiveVfsObject *cmdline_captive_vfs_object;
70 void invoke_cmd(int cmd_argc,const char **cmd_argv);
71 void err_cleanup(GError **errp);
72 gboolean errvfsresult_to_gerr(GError **errp,GnomeVFSResult errvfsresult);
76 #endif /* _CAPTIVE_CLIENT_CMDLINE_MAIN_H */