[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.2, Mon Aug 5 08:54:23 2002 UTC (15 years, 2 months ago) by nathans
Branch: MAIN
CVS Tags: XFS-1_3_0pre1
Changes since 1.1: +31 -0 lines

Bump version, document changes:
  - xfsinvutil -m option added (merge from IRIX).
  - add missing GPL/copyright headers to several xfsinvutil files.
  - correct several uses of uuid_compare in xfsinvutil.

/*
 * Copyright (c) 2002 Silicon Graphics, Inc.  All Rights Reserved.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it would be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * Further, this software is distributed without any warranty that it is
 * free of the rightful claim of any third person regarding infringement
 * or the like.  Any license provided herein, whether implied or
 * otherwise, applies only to this software file.  Patent licenses, if
 * any, provided herein do not apply to combinations of this program with
 * other software, or any other product whatsoever.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write the Free Software Foundation, Inc., 59
 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
 *
 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
 * Mountain View, CA  94043, or:
 *
 * http://www.sgi.com
 *
 * For further information regarding this notice, see:
 *
 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
 */
#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 */