[1] | 1 | /***************************************************************************
|
---|
| 2 | mondo-rstr-newt.h - description
|
---|
| 3 | -------------------
|
---|
| 4 | begin : Sat Apr 20 2002
|
---|
| 5 | copyright : (C) 2002 by Stan Benoit
|
---|
| 6 | email : troff@nakedsoul.org
|
---|
[128] | 7 | cvsid : $Id: mondo-rstr-newt.h 3864 2024-03-07 10:54:29Z bruno $
|
---|
[1] | 8 | ***************************************************************************/
|
---|
| 9 |
|
---|
| 10 | /***************************************************************************
|
---|
| 11 | * *
|
---|
| 12 | * This program is free software; you can redistribute it and/or modify *
|
---|
| 13 | * it under the terms of the GNU General Public License as published by *
|
---|
| 14 | * the Free Software Foundation; either version 2 of the License, or *
|
---|
| 15 | * (at your option) any later version. *
|
---|
| 16 | * *
|
---|
| 17 | ***************************************************************************/
|
---|
| 18 |
|
---|
| 19 |
|
---|
[1930] | 20 | #include "my-stuff.h"
|
---|
[1] | 21 | #include "../common/mondostructures.h"
|
---|
| 22 | #include "../common/libmondo.h"
|
---|
| 23 | #ifdef __FreeBSD__
|
---|
| 24 | #define raid_device_record vinum_volume
|
---|
| 25 | #endif /*__FreeBSD__*/
|
---|
| 26 |
|
---|
[541] | 27 | #define NO_FLAWS_DETECTED "No flaws detected in mountlist at this time. Hit 'OK' to proceed."
|
---|
[1] | 28 |
|
---|
| 29 |
|
---|
| 30 | /** I found this in the code :) *******************************************/
|
---|
| 31 | char g_strings_of_flist_window[ARBITRARY_MAXIMUM][MAX_STR_LEN];
|
---|
| 32 | bool g_is_path_selected[ARBITRARY_MAXIMUM];
|
---|
| 33 | bool g_is_path_expanded[ARBITRARY_MAXIMUM];
|
---|
| 34 | char tmpnopath[MAX_STR_LEN + 2];
|
---|
| 35 | char tmpprevpath[MAX_STR_LEN + 2];
|
---|
| 36 |
|
---|
| 37 | /* external subroutines and global vars */
|
---|
| 38 |
|
---|
[128] | 39 | extern long get_time(void);
|
---|
| 40 | extern char *last_line_of_file(char *);
|
---|
[3861] | 41 | extern bool does_file_exist(const char *);
|
---|
[128] | 42 | extern void finish(int);
|
---|
| 43 | extern long get_phys_size_of_drive(char *);
|
---|
| 44 | extern bool is_this_device_mounted(char *);
|
---|
| 45 | extern void strip_spaces(char *);
|
---|
| 46 | extern void initialize_raidrec(struct raid_device_record *);
|
---|
| 47 | extern int make_list_of_drives(struct mountlist_itself *,
|
---|
| 48 | char[ARBITRARY_MAXIMUM][MAX_STR_LEN]);
|
---|
| 49 | char *number_to_text(int);
|
---|
| 50 | extern void reload_filelist(struct s_node *);
|
---|
| 51 | extern void toggle_all_root_dirs_on(struct s_node *);
|
---|
| 52 | extern void toggle_path_expandability(struct s_node *, char *, bool);
|
---|
| 53 | extern void toggle_path_selection(struct s_node *, char *, bool);
|
---|
| 54 | extern void toggle_node_selection(struct s_node *, bool);
|
---|
| 55 | extern struct s_node *find_node_in_filelist(struct s_node *,
|
---|
| 56 | char *filename);
|
---|
[1647] | 57 | extern int what_number_cd_is_this();
|
---|
[128] | 58 | extern void sort_mountlist_by_device(struct mountlist_itself *);
|
---|
| 59 | extern int load_mountlist(struct mountlist_itself *a, char *b);
|
---|
[1] | 60 | extern bool g_text_mode;
|
---|
| 61 |
|
---|
| 62 |
|
---|
| 63 | /* hacks */
|
---|
[128] | 64 | extern int load_raidtab_into_raidlist(struct raidlist_itself *a, char *b);
|
---|
[1] | 65 |
|
---|
| 66 |
|
---|
| 67 |
|
---|
| 68 | extern long g_start_time, g_minimum_progress, g_maximum_progress,
|
---|
[128] | 69 | g_current_progress, g_currentY;
|
---|
[1] | 70 | extern bool g_ISO_restore_mode;
|
---|
| 71 |
|
---|
| 72 |
|
---|
| 73 | /* my global variables */
|
---|
| 74 |
|
---|
| 75 | //extern newtComponent g_progressForm, g_blurb1, g_blurb2, g_blurb3, g_label,
|
---|
| 76 | // g_timeline, g_percentline, g_scale;
|
---|
| 77 | //extern char err_log_lines[NOOF_ERR_LINES][MAX_STR_LEN], g_blurb_str_1[MAX_STR_LEN] =
|
---|
| 78 | // "", g_blurb_str_2[MAX_STR_LEN] = "", g_blurb_str_3[MAX_STR_LEN] = "";
|
---|
| 79 | //newtComponent g_isoform_main =
|
---|
| 80 | // NULL, g_isoform_header, g_isoform_scale, g_isoform_timeline,
|
---|
| 81 | // g_isoform_pcline;
|
---|
| 82 | //long g_isoform_starttime;
|
---|
| 83 | //int g_isoform_old_progress = -1;
|
---|
| 84 | //char g_isoform_header_str[MAX_STR_LEN];
|
---|
| 85 | //int g_mysterious_dot_counter;
|
---|
| 86 |
|
---|
| 87 |
|
---|
| 88 |
|
---|
| 89 |
|
---|
| 90 |
|
---|
| 91 | /* my subroutines */
|
---|
| 92 |
|
---|
[128] | 93 | void add_disklist_entry(struct list_of_disks *, char *,
|
---|
| 94 | struct mountlist_itself *);
|
---|
| 95 | void add_mountlist_entry(struct mountlist_itself *,
|
---|
| 96 | struct raidlist_itself *, newtComponent, int,
|
---|
| 97 | void *keylist[]);
|
---|
| 98 | void add_varslist_entry(struct raid_device_record *);
|
---|
| 99 | bool ask_me_yes_or_no(char *);
|
---|
| 100 | bool ask_me_OK_or_cancel(char *);
|
---|
| 101 | long calculate_raid_device_size(struct mountlist_itself *,
|
---|
| 102 | struct raidlist_itself *, char *);
|
---|
| 103 | void choose_raid_level(struct
|
---|
[1] | 104 | #ifdef __FreeBSD__
|
---|
[128] | 105 | vinum_plex
|
---|
[1] | 106 | #else
|
---|
[128] | 107 | raid_device_record
|
---|
[1] | 108 | #endif
|
---|
[128] | 109 | *);
|
---|
| 110 | void close_evalcall_form(void);
|
---|
| 111 | void close_progress_form(void);
|
---|
| 112 | void del_partns_listed_in_disklist(struct mountlist_itself *,
|
---|
| 113 | struct raidlist_itself *,
|
---|
| 114 | struct list_of_disks *);
|
---|
| 115 | void delete_disklist_entry(struct list_of_disks *, char *, int);
|
---|
| 116 | void delete_mountlist_entry(struct mountlist_itself *,
|
---|
| 117 | struct raidlist_itself *, newtComponent, int,
|
---|
| 118 | void *keylist[]);
|
---|
| 119 | void delete_raidlist_entry(struct mountlist_itself *,
|
---|
| 120 | struct raidlist_itself *, char *);
|
---|
| 121 | void delete_varslist_entry(struct raid_device_record *, int);
|
---|
| 122 | char *disklist_entry_to_string(struct list_of_disks *, int);
|
---|
| 123 | int edit_filelist(struct s_node *);
|
---|
| 124 | void edit_mountlist_entry(struct mountlist_itself *,
|
---|
| 125 | struct raidlist_itself *, newtComponent, int,
|
---|
| 126 | void *keylist[]);
|
---|
| 127 | void edit_raidlist_entry(struct mountlist_itself *,
|
---|
| 128 | struct raidlist_itself *,
|
---|
| 129 | struct raid_device_record *, int);
|
---|
| 130 | void edit_varslist_entry(struct raid_device_record *, int);
|
---|
| 131 | int edit_mountlist_in_newt(char *mountlist_fname,
|
---|
| 132 | struct mountlist_itself *,
|
---|
| 133 | struct raidlist_itself *);
|
---|
| 134 | int edit_mountlist(char *mountlist_fname, struct mountlist_itself *,
|
---|
| 135 | struct raidlist_itself *);
|
---|
| 136 | void edit_raidrec_additional_vars(struct raid_device_record *);
|
---|
[2394] | 137 | char *evaluate_mountlist(struct mountlist_itself *);
|
---|
[128] | 138 | int find_device_in_mountlist(struct mountlist_itself *, char *);
|
---|
| 139 | int find_next_free_index_in_disklist(struct list_of_disks *);
|
---|
| 140 | int find_raid_device_in_raidlist(struct raidlist_itself *, char *);
|
---|
| 141 | void initiate_new_raidlist_entry(struct raidlist_itself *,
|
---|
| 142 | struct mountlist_itself *, int, char *);
|
---|
| 143 | void insert_essential_additionalvars(struct raid_device_record *);
|
---|
| 144 | bool is_this_raid_personality_registered(int);
|
---|
| 145 | void log_file_end_to_screen(char *, char *);
|
---|
| 146 | void log_to_screen(const char *fmt, ...);
|
---|
| 147 | void make_list_of_unallocated_raid_partitions(struct mountlist_itself *,
|
---|
| 148 | struct mountlist_itself *,
|
---|
| 149 | struct raidlist_itself *);
|
---|
| 150 | char *mountlist_entry_to_string(struct mountlist_itself *, int);
|
---|
| 151 | void nuke_mode_dummy();
|
---|
| 152 | char *number_of_disks_as_string(int, char *);
|
---|
| 153 | void open_evalcall_form(char *);
|
---|
| 154 | void open_progress_form(char *, char *, char *, char *, long);
|
---|
| 155 | bool popup_and_get_string(char *, char *, char *, int);
|
---|
| 156 | bool popup_with_buttons(char *, char *, char *);
|
---|
| 157 | void redraw_disklist(struct list_of_disks *, void *keylist[],
|
---|
| 158 | newtComponent);
|
---|
| 159 | void redraw_mountlist(struct mountlist_itself *, void *keylist[],
|
---|
| 160 | newtComponent);
|
---|
| 161 | void redraw_unallocpartnslist(struct mountlist_itself *, void *keylist[],
|
---|
| 162 | newtComponent);
|
---|
| 163 | void redraw_varslist(struct additional_raid_variables *, void *keylist[],
|
---|
| 164 | newtComponent);
|
---|
| 165 | int read_variableINT_and_remove_from_raidvars(struct raid_device_record *,
|
---|
| 166 | char *);
|
---|
| 167 | void refresh_log_screen(void);
|
---|
| 168 | void rejig_partition_name_in_raidlist_if_necessary(struct raidlist_itself
|
---|
| 169 | *, char *, char *);
|
---|
| 170 | void remove_essential_additionalvars(struct raid_device_record *);
|
---|
| 171 | void select_raid_disks(struct mountlist_itself *, struct raidlist_itself *,
|
---|
| 172 | struct raid_device_record *, char *,
|
---|
| 173 | struct list_of_disks *);
|
---|
| 174 | void setup_newt_stuff(void);
|
---|
| 175 | long size_of_specific_device(struct mountlist_itself *, char *);
|
---|
| 176 | char *turn_raid_level_number_to_string(int);
|
---|
| 177 | void update_evalcall_form(int);
|
---|
| 178 | void update_progress_form(char *);
|
---|
| 179 | char which_restore_mode(void);
|
---|
| 180 | void write_variableINT_to_raid_var_line(struct raid_device_record *, int,
|
---|
| 181 | char *, int);
|
---|
| 182 | int where_in_drivelist_is_drive(struct list_of_disks *, char *);
|
---|
[1] | 183 | char *strip_path(char *);
|
---|
| 184 |
|
---|
| 185 |
|
---|
| 186 |
|
---|
| 187 |
|
---|
| 188 | /* -------------------------------------------------------------------- */
|
---|
| 189 |
|
---|
| 190 |
|
---|
| 191 |
|
---|
| 192 |
|
---|
| 193 | char tmpnopath[MAX_STR_LEN + 2];
|
---|
| 194 | char tmpprevpath[MAX_STR_LEN + 2];
|
---|
| 195 |
|
---|
| 196 | #ifdef __FreeBSD__
|
---|
| 197 | #undef raid_device_record
|
---|
| 198 | #endif
|
---|