fish: Improve output of guestfish -h cmd
[libguestfs.git] / fish / fish.h
1 /* libguestfs - guestfish shell
2  * Copyright (C) 2009 Red Hat Inc.
3  *
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.
8  *
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.
13  *
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.
17  */
18
19 #ifndef FISH_H
20 #define FISH_H
21
22 #include <guestfs.h>
23
24 #ifdef HAVE_GETTEXT
25 #include "gettext.h"
26 #define _(str) dgettext(PACKAGE, (str))
27 #define N_(str) dgettext(PACKAGE, (str))
28 #else
29 #define _(str) str
30 #define N_(str) str
31 #endif
32
33 #define STREQ(a,b) (strcmp((a),(b)) == 0)
34 #define STRCASEEQ(a,b) (strcasecmp((a),(b)) == 0)
35 #define STRNEQ(a,b) (strcmp((a),(b)) != 0)
36 #define STRCASENEQ(a,b) (strcasecmp((a),(b)) != 0)
37 #define STREQLEN(a,b,n) (strncmp((a),(b),(n)) == 0)
38 #define STRCASEEQLEN(a,b,n) (strncasecmp((a),(b),(n)) == 0)
39 #define STRNEQLEN(a,b,n) (strncmp((a),(b),(n)) != 0)
40 #define STRCASENEQLEN(a,b,n) (strncasecmp((a),(b),(n)) != 0)
41 #define STRPREFIX(a,b) (strncmp((a),(b),strlen((b))) == 0)
42
43 /* in fish.c */
44 extern guestfs_h *g;
45 extern int quit;
46 extern int verbose;
47 extern int issue_command (const char *cmd, char *argv[], const char *pipe);
48 extern void pod2text (const char *name, const char *shortdesc, const char *body);
49 extern void list_builtin_commands (void);
50 extern void display_builtin_command (const char *cmd);
51 extern void free_strings (char **argv);
52 extern int count_strings (char *const *argv);
53 extern void print_strings (char *const *argv);
54 extern void print_table (char *const *argv);
55 extern int launch (guestfs_h *);
56 extern int is_true (const char *str);
57 extern char **parse_string_list (const char *str);
58 extern int xwrite (int fd, const void *buf, size_t len);
59 extern char *resolve_win_path (const char *path);
60
61 /* in cmds.c (auto-generated) */
62 extern void list_commands (void);
63 extern void display_command (const char *cmd);
64 extern int run_action (const char *cmd, int argc, char *argv[]);
65
66 /* in completion.c (auto-generated) */
67 extern char **do_completion (const char *text, int start, int end);
68
69 /* in destpaths.c */
70 extern int complete_dest_paths;
71 extern char *complete_dest_paths_generator (const char *text, int state);
72
73 /* in alloc.c */
74 extern int do_alloc (const char *cmd, int argc, char *argv[]);
75 extern int do_sparse (const char *cmd, int argc, char *argv[]);
76
77 /* in echo.c */
78 extern int do_echo (const char *cmd, int argc, char *argv[]);
79
80 /* in edit.c */
81 extern int do_edit (const char *cmd, int argc, char *argv[]);
82
83 /* in lcd.c */
84 extern int do_lcd (const char *cmd, int argc, char *argv[]);
85
86 /* in glob.c */
87 extern int do_glob (const char *cmd, int argc, char *argv[]);
88
89 /* in more.c */
90 extern int do_more (const char *cmd, int argc, char *argv[]);
91
92 /* in rc.c (remote control) */
93 extern void rc_listen (void) __attribute__((noreturn));
94 extern int rc_remote (int pid, const char *cmd, int argc, char *argv[],
95                       int exit_on_error);
96
97 /* in reopen.c */
98 extern int do_reopen (const char *cmd, int argc, char *argv[]);
99
100 /* in time.c */
101 extern int do_time (const char *cmd, int argc, char *argv[]);
102
103 /* in tilde.c */
104 extern char *try_tilde_expansion (char *path);
105
106 /* This should just list all the built-in commands so they can
107  * be added to the generated auto-completion code.
108  */
109 #define BUILTIN_COMMANDS_FOR_COMPLETION \
110   "help",                               \
111   "quit", "exit", "q",                  \
112   "alloc", "allocate",                  \
113   "echo",                               \
114   "edit", "vi", "emacs",                \
115   "lcd",                                \
116   "glob",                               \
117   "more", "less",                       \
118   "reopen",                             \
119   "time"
120
121 static inline char *
122 bad_cast (char const *s)
123 {
124   return (char *) s;
125 }
126
127 #endif /* FISH_H */