]>
Commit | Line | Data |
---|---|---|
260a06f6 | 1 | /* $Header$ */ |
2 | ||
e66cf6a1 | 3 | #define MAX_ARGC 16 /* Maximum argument count per line */ |
4 | #define MAX_ARGLEN 128 /* Maximum length of an argument */ | |
5 | #define MAX_LINES 16 /* Maximum number of lines per menu */ | |
6 | ||
7 | #define MAX_TITLE 1 /* Maximum length of title, in lines */ | |
8 | ||
9 | /* Maximum depth to which submenus will be searched when looking for commands */ | |
10 | #define MAX_MENU_DEPTH 8 | |
11 | ||
12 | typedef struct menu_arg { | |
13 | char *ma_doc; /* Short doc for completion */ | |
14 | char *ma_prompt; /* For prompting in menu */ | |
15 | } Menu_Arg; | |
16 | ||
17 | typedef struct menu_line { | |
18 | int (*ml_function) (); | |
19 | struct menu *ml_submenu; | |
20 | int ml_argc; | |
21 | struct menu_arg ml_args[MAX_ARGC]; | |
22 | } Menu_Line; | |
23 | ||
24 | #define ml_doc ml_args[0].ma_prompt | |
25 | #define ml_command ml_args[0].ma_doc | |
26 | ||
27 | typedef struct menu { | |
28 | int (*m_entry) (); | |
29 | int (*m_exit) (); | |
30 | char *m_title; | |
31 | int m_length; | |
32 | struct menu_line m_lines[MAX_LINES]; | |
33 | } Menu; | |
34 | ||
35 | /* Return codes for Do_menu */ | |
36 | /* These should also be used by functions called from Do_menu */ | |
37 | #define DM_NORMAL 0 /* Normal return */ | |
38 | #define DM_QUIT 1 /* Quit; ^C or q command received */ | |
39 | ||
40 | /* Macros for initializing menu lines */ | |
41 | #define NULLFUNC ((int (*)()) 0) | |
42 | #define NULLMENU ((struct menu *) 0) | |
43 | #define SUBMENU(cmd, doc, menu) { NULLFUNC, menu, 1, { { cmd, doc } } } | |
44 | #define SIMPLEFUNC(cmd, doc, func) { func, NULLMENU, 1, { { cmd, doc } } } | |
260a06f6 | 45 | |
46 | /* Unused words found on parsed command line */ | |
47 | extern int parsed_argc; | |
48 | extern char **parsed_argv; |