]> andersk Git - moira.git/blame - clients/moira/menu.h
Code style cleanup. (No functional changes)
[moira.git] / clients / moira / menu.h
CommitLineData
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
12typedef struct menu_arg {
5eaef520 13 char *ma_doc; /* Short doc for completion */
14 char *ma_prompt; /* For prompting in menu */
15} Menu_Arg;
e66cf6a1 16
17typedef struct menu_line {
5eaef520 18 int (*ml_function)();
19 struct menu *ml_submenu;
20 int ml_argc;
21 struct menu_arg ml_args[MAX_ARGC];
22} Menu_Line;
e66cf6a1 23
24#define ml_doc ml_args[0].ma_prompt
25#define ml_command ml_args[0].ma_doc
26
27typedef struct menu {
5eaef520 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;
e66cf6a1 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)
5eaef520 42#define NULLMENU NULL
e66cf6a1 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 */
47extern int parsed_argc;
48extern char **parsed_argv;
This page took 0.0805 seconds and 5 git commands to generate.