1 /* libguestfs - guestfish shell
2 * Copyright (C) 2009 Red Hat Inc.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
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 along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #define _(str) dgettext(PACKAGE, (str))
27 #define N_(str) dgettext(PACKAGE, (str))
35 #define textdomain(Domainname) /* empty */
37 #define bindtextdomain(Domainname, Dirname) /* empty */
40 #define STREQ(a,b) (strcmp((a),(b)) == 0)
41 #define STRCASEEQ(a,b) (strcasecmp((a),(b)) == 0)
42 #define STRNEQ(a,b) (strcmp((a),(b)) != 0)
43 #define STRCASENEQ(a,b) (strcasecmp((a),(b)) != 0)
44 #define STREQLEN(a,b,n) (strncmp((a),(b),(n)) == 0)
45 #define STRCASEEQLEN(a,b,n) (strncasecmp((a),(b),(n)) == 0)
46 #define STRNEQLEN(a,b,n) (strncmp((a),(b),(n)) != 0)
47 #define STRCASENEQLEN(a,b,n) (strncasecmp((a),(b),(n)) != 0)
48 #define STRPREFIX(a,b) (strncmp((a),(b),strlen((b))) == 0)
54 extern int command_num;
55 extern int issue_command (const char *cmd, char *argv[], const char *pipe);
56 extern void pod2text (const char *name, const char *shortdesc, const char *body);
57 extern void list_builtin_commands (void);
58 extern void display_builtin_command (const char *cmd);
59 extern void free_strings (char **argv);
60 extern int count_strings (char *const *argv);
61 extern void print_strings (char *const *argv);
62 extern void print_table (char *const *argv);
63 extern int launch (guestfs_h *);
64 extern int is_true (const char *str);
65 extern char **parse_string_list (const char *str);
66 extern int xwrite (int fd, const void *buf, size_t len);
67 extern char *resolve_win_path (const char *path);
68 extern void extended_help_message (void);
70 /* in cmds.c (auto-generated) */
71 extern void list_commands (void);
72 extern void display_command (const char *cmd);
73 extern int run_action (const char *cmd, int argc, char *argv[]);
75 /* in completion.c (auto-generated) */
76 extern char **do_completion (const char *text, int start, int end);
79 extern int complete_dest_paths;
80 extern char *complete_dest_paths_generator (const char *text, int state);
83 extern int do_alloc (const char *cmd, int argc, char *argv[]);
84 extern int do_sparse (const char *cmd, int argc, char *argv[]);
87 extern int do_echo (const char *cmd, int argc, char *argv[]);
90 extern int do_edit (const char *cmd, int argc, char *argv[]);
93 extern int do_lcd (const char *cmd, int argc, char *argv[]);
96 extern int do_glob (const char *cmd, int argc, char *argv[]);
99 extern int do_more (const char *cmd, int argc, char *argv[]);
101 /* in rc.c (remote control) */
102 extern void rc_listen (void) __attribute__((noreturn));
103 extern int rc_remote (int pid, const char *cmd, int argc, char *argv[],
107 extern int do_reopen (const char *cmd, int argc, char *argv[]);
110 extern int do_time (const char *cmd, int argc, char *argv[]);
113 extern char *try_tilde_expansion (char *path);
115 /* This should just list all the built-in commands so they can
116 * be added to the generated auto-completion code.
118 #define BUILTIN_COMMANDS_FOR_COMPLETION \
120 "quit", "exit", "q", \
121 "alloc", "allocate", \
123 "edit", "vi", "emacs", \
132 bad_cast (char const *s)