From e66cf6a1e5298d21398aa448fe052ba4d54d0a8f Mon Sep 17 00:00:00 2001 From: mar Date: Tue, 27 Dec 1988 18:48:57 +0000 Subject: [PATCH] Initial revision --- clients/moira/menu.h | 42 ++++++++++++++++++++++++++++++++++++++++++ include/Makefile | 19 +++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 clients/moira/menu.h create mode 100644 include/Makefile diff --git a/clients/moira/menu.h b/clients/moira/menu.h new file mode 100644 index 00000000..db0a6a96 --- /dev/null +++ b/clients/moira/menu.h @@ -0,0 +1,42 @@ +#define MAX_ARGC 16 /* Maximum argument count per line */ +#define MAX_ARGLEN 128 /* Maximum length of an argument */ +#define MAX_LINES 16 /* Maximum number of lines per menu */ + +#define MAX_TITLE 1 /* Maximum length of title, in lines */ + +/* Maximum depth to which submenus will be searched when looking for commands */ +#define MAX_MENU_DEPTH 8 + +typedef struct menu_arg { + char *ma_doc; /* Short doc for completion */ + char *ma_prompt; /* For prompting in menu */ +} Menu_Arg; + +typedef struct menu_line { + int (*ml_function) (); + struct menu *ml_submenu; + int ml_argc; + struct menu_arg ml_args[MAX_ARGC]; +} Menu_Line; + +#define ml_doc ml_args[0].ma_prompt +#define ml_command ml_args[0].ma_doc + +typedef struct menu { + int (*m_entry) (); + int (*m_exit) (); + char *m_title; + int m_length; + struct menu_line m_lines[MAX_LINES]; +} Menu; + +/* Return codes for Do_menu */ +/* These should also be used by functions called from Do_menu */ +#define DM_NORMAL 0 /* Normal return */ +#define DM_QUIT 1 /* Quit; ^C or q command received */ + +/* Macros for initializing menu lines */ +#define NULLFUNC ((int (*)()) 0) +#define NULLMENU ((struct menu *) 0) +#define SUBMENU(cmd, doc, menu) { NULLFUNC, menu, 1, { { cmd, doc } } } +#define SIMPLEFUNC(cmd, doc, func) { func, NULLMENU, 1, { { cmd, doc } } } diff --git a/include/Makefile b/include/Makefile new file mode 100644 index 00000000..d556ed27 --- /dev/null +++ b/include/Makefile @@ -0,0 +1,19 @@ +# Makefile for SMS 2.0 include files +# +# $Source$ +# $Header$ +# $Author$ +# +# (c) Copyright 1988 by the Massachusetts Institute of Technology. +# For copying and distribution information, please see the file +# . + +DESTDIR= +FILES= sms.h sms_app.h sms_et.h + +all: + +install: ${FILES} + install -m 644 sms.h ${DESTDIR}/usr/include/sms.h + install -m 644 sms_app.h ${DESTDIR}/usr/include/sms_app.h + install -m 644 sms_et.h ${DESTDIR}/usr/include/sms_et.h -- 2.45.1