]> git.proxmox.com Git - mirror_qemu.git/blame - cmd.h
Fix a few Sparse warnings
[mirror_qemu.git] / cmd.h
CommitLineData
e3aff4f6
AL
1/*
2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would 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
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18#ifndef __COMMAND_H__
19#define __COMMAND_H__
20
21#define CMD_FLAG_GLOBAL ((int)0x80000000) /* don't iterate "args" */
22
23typedef int (*cfunc_t)(int argc, char **argv);
24typedef void (*helpfunc_t)(void);
25
26typedef struct cmdinfo {
27 const char *name;
28 const char *altname;
29 cfunc_t cfunc;
30 int argmin;
31 int argmax;
32 int canpush;
33 int flags;
34 const char *args;
35 const char *oneline;
36 helpfunc_t help;
37} cmdinfo_t;
38
39extern cmdinfo_t *cmdtab;
40extern int ncmds;
41
42extern void help_init(void);
43extern void quit_init(void);
44
45typedef int (*argsfunc_t)(int index);
46typedef int (*checkfunc_t)(const cmdinfo_t *ci);
47
48extern void add_command(const cmdinfo_t *ci);
49extern void add_user_command(char *optarg);
50extern void add_args_command(argsfunc_t af);
51extern void add_check_command(checkfunc_t cf);
52
53extern const cmdinfo_t *find_command(const char *cmd);
54
55extern void command_loop(void);
56extern int command_usage(const cmdinfo_t *ci);
57extern int command(const cmdinfo_t *ci, int argc, char **argv);
58
59/* from input.h */
60extern char **breakline(char *input, int *count);
61extern void doneline(char *input, char **vec);
62extern char *fetchline(void);
63
64extern long long cvtnum(char *s);
65extern void cvtstr(double value, char *str, size_t sz);
66
67extern struct timeval tsub(struct timeval t1, struct timeval t2);
68extern double tdiv(double value, struct timeval tv);
69
70enum {
71 DEFAULT_TIME = 0x0,
72 TERSE_FIXED_TIME = 0x1,
73 VERBOSE_FIXED_TIME = 0x2
74};
75
76extern void timestr(struct timeval *tv, char *str, size_t sz, int flags);
77
856ae5c3
BS
78extern char *progname;
79
e3aff4f6 80#endif /* __COMMAND_H__ */