[BACK]Return to cmenu.h CVS log [TXT][DIR] Up to [Development] / xfs-cmds / xfsdump / invutil

File: [Development] / xfs-cmds / xfsdump / invutil / cmenu.h (download)

Revision 1.1, Mon Jul 29 06:04:12 2002 UTC (15 years, 3 months ago) by nathans
Branch: MAIN

bump version, document changes for xfsinvutil interactive mode port from IRIX.

#ifndef CMENU_H
#define CMENU_H

#include "types.h"
#include "mlog.h"
#include "inv_priv.h"
#include "list.h"

/* number of lines for info window */
#define INFO_SIZE 4

#define put_header(m,a)		put_line(stdscr, 0, m, A_REVERSE | A_BOLD, a)
#define put_footer(m,a)		put_line(stdscr, LINES - 1, m, A_REVERSE | A_BOLD, a)
#define put_error(m)		put_line(stdscr, LINES - 1, m, A_REVERSE | A_BOLD, ALIGN_LEFT);\
					beep();\
					wrefresh(stdscr);\
					sleep(2)
#define put_info_header(m)	put_line(infowin, 0, m, A_REVERSE|A_BOLD, ALIGN_LEFT)
#define put_info_line(l,m)	put_line(infowin, l, m, 0, ALIGN_LEFT)
#define put_option(w,l,t,a)	put_line(w, l, t, a, ALIGN_LEFT)
#define clear_line(w,l)		wmove(w, l, 0); wclrtoeol(w);

typedef enum {
    ALIGN_LEFT,
    ALIGN_CENTRE,
    ALIGN_RIGHT
} alignment_t;

typedef struct menu_ops_s {
    int (* op_delete		) (WINDOW *win, node_t *current, node_t *list);
    int (* op_undelete		) (WINDOW *win, node_t *current, node_t *list);
    int (* op_saveexit		) (WINDOW *win, node_t *current, node_t *list);
    int (* op_select		) (WINDOW *win, node_t *current, node_t *list);
    int (* op_collapse		) (WINDOW *win, node_t *current, node_t *list);
    int (* op_expand		) (WINDOW *win, node_t *current, node_t *list);
    int (* op_collapseall	) (WINDOW *win, node_t *current, node_t *list);
    int (* op_expandall		) (WINDOW *win, node_t *current, node_t *list);
    int (* op_highlight		) (WINDOW *win, node_t *current, node_t *list);
    int (* op_unhighlight	) (WINDOW *win, node_t *current, node_t *list);
    int (* op_commit		) (WINDOW *win, node_t *current, node_t *list);
    int (* op_prune		) (char *mountpt, uuid_t *uuidp, time_t prunetime, node_t *node, node_t *list);
} menu_ops_t;

typedef struct {
    int key;
    char *text;
    int (*fn)(WINDOW *win, node_t *current, node_t *list);
} menukey_t;

typedef struct {
    invt_seshdr_t *header;
    invt_session_t *session;
} stobjsess_t;

typedef struct {
    char		*name;
    int			fd;
    int			nEntries;
    char		*mapaddr;
    invt_counter_t	*counter;
    invt_entry_t	**data;
    int			numrecords;
} invidx_fileinfo_t;

typedef struct {
    char		*name;
    int			fd;
    off_t		size;
    char		*mapaddr;
    invt_sescounter_t	*counter;
    void		**data;
    int			numrecords;
} stobj_fileinfo_t;

typedef struct {
    char		*name;
    int			fd;
    int			nEntries;
    char		*mapaddr;
    invt_counter_t	*counter;
    invt_fstab_t	**data;
    int			numrecords;
} fstab_fileinfo_t;


extern int redraw_screen;
extern int redraw_options;
extern WINDOW *mainmenu;
extern WINDOW *infowin;


/* cmenu.c */
void hitanykey(void);
int put_line(WINDOW *win, int line, char *msg, int attr, alignment_t alignment);
int create_windows(void);
int get_string(WINDOW *win, char *prompt, char *response, int len);

void list_undelete(node_t *current, node_t *list);
int list_delete(node_t *current, node_t *list);

int menu_import(WINDOW *win, node_t *current, node_t *list);
int menu_unhighlight(WINDOW *win, node_t *current, node_t *list);
int menu_expand(WINDOW *win, node_t *current, node_t *list);
int menu_expandall(WINDOW *win, node_t *current, node_t *list);
int menu_collapse(WINDOW *win, node_t *current, node_t *list);
int menu_collapseall(WINDOW *win, node_t *current, node_t *list);
int menu_select(WINDOW *win, node_t *current, node_t *list);
int menu_delete(WINDOW *win, node_t *current, node_t *list);
int menu_undelete(WINDOW *win, node_t *current, node_t *list);
int menu_saveexit(WINDOW *win, node_t *current, node_t *list);
int menu_commit(WINDOW *win, node_t *current, node_t *list);
int menu_quit(WINDOW *win, node_t *current, node_t *list);

/* menu.c */
int menu(WINDOW *win, int line, int col, node_t *list, int keyc, menukey_t *keyv);
node_t *generate_menu(char *inv_path);

#endif /* CMENU_H */