2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
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.
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.
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
21 #define CMD_FLAG_GLOBAL ((int)0x80000000) /* don't iterate "args" */
23 typedef int (*cfunc_t
)(int argc
, char **argv
);
24 typedef void (*helpfunc_t
)(void);
26 typedef struct cmdinfo
{
39 extern cmdinfo_t
*cmdtab
;
42 extern void help_init(void);
43 extern void quit_init(void);
45 typedef int (*argsfunc_t
)(int index
);
46 typedef int (*checkfunc_t
)(const cmdinfo_t
*ci
);
48 extern void add_command(const cmdinfo_t
*ci
);
49 extern void add_user_command(char *optarg
);
50 extern void add_args_command(argsfunc_t af
);
51 extern void add_check_command(checkfunc_t cf
);
53 extern const cmdinfo_t
*find_command(const char *cmd
);
55 extern void command_loop(void);
56 extern int command_usage(const cmdinfo_t
*ci
);
57 extern int command(const cmdinfo_t
*ci
, int argc
, char **argv
);
60 extern char **breakline(char *input
, int *count
);
61 extern void doneline(char *input
, char **vec
);
62 extern char *fetchline(void);
64 extern long long cvtnum(char *s
);
65 extern void cvtstr(double value
, char *str
, size_t sz
);
67 extern struct timeval
tsub(struct timeval t1
, struct timeval t2
);
68 extern double tdiv(double value
, struct timeval tv
);
72 TERSE_FIXED_TIME
= 0x1,
73 VERBOSE_FIXED_TIME
= 0x2
76 extern void timestr(struct timeval
*tv
, char *str
, size_t sz
, int flags
);
78 #endif /* __COMMAND_H__ */