MCPcopy Create free account
hub / github.com/cgsecurity/testdisk / ask_structure_ncurses

Function ask_structure_ncurses

src/intrface.c:108–417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106#ifdef HAVE_NCURSES
107#define INTER_STRUCTURE (LINES-12)
108static list_part_t *ask_structure_ncurses(disk_t *disk_car,list_part_t *list_part, const int verbose)
109{
110 int offset=0;
111 int pos_num=0;
112 list_part_t *pos=list_part;
113 int rewrite=1;
114 int old_LINES=LINES;
115 while(1)
116 {
117 int i;
118 int command;
119 list_part_t *parts;
120 int structure_status;
121 if(old_LINES!=LINES)
122 {
123 rewrite=1;
124 old_LINES=LINES;
125 }
126 if(rewrite)
127 {
128 aff_copy(stdscr);
129 wmove(stdscr,4,0);
130 wprintw(stdscr,"%s",disk_car->description(disk_car));
131 mvwaddstr(stdscr,5,0,msg_PART_HEADER);
132 rewrite=0;
133 }
134 structure_status=disk_car->arch->test_structure(list_part);
135 for(i=0,parts=list_part;
136 parts!=NULL && i<offset+INTER_STRUCTURE;
137 i++, parts=parts->next)
138 {
139 if(i<offset)
140 continue;
141 wmove(stdscr,6+i-offset,0);
142 wclrtoeol(stdscr); /* before addstr for BSD compatibility */
143 if(parts==pos)
144 wattrset(stdscr, A_REVERSE);
145 if(structure_status==0 && parts->part->status!=STATUS_DELETED && has_colors())
146 wbkgdset(stdscr,' ' | COLOR_PAIR(2));
147 if(parts==pos)
148 waddstr(stdscr, ">");
149 else
150 waddstr(stdscr, " ");
151 aff_part(stdscr, AFF_PART_STATUS, disk_car, parts->part);
152 if(structure_status==0 && parts->part->status!=STATUS_DELETED && has_colors())
153 wbkgdset(stdscr,' ' | COLOR_PAIR(0));
154 if(parts==pos)
155 {
156 char buffer_part_size[100];
157 wattroff(stdscr, A_REVERSE);
158 wmove(stdscr,LINES-1,0);
159 wclrtoeol(stdscr); /* before addstr for BSD compatibility */
160 if(parts->part->info[0]!='\0')
161 {
162 wprintw(stdscr,"%s, ",parts->part->info);
163 }
164 size_to_unit(parts->part->part_size, buffer_part_size);
165 wprintw(stdscr,"%s", buffer_part_size);

Callers 1

ask_structureFunction · 0.85

Calls 12

aff_partFunction · 0.85
size_to_unitFunction · 0.85
only_one_bootableFunction · 0.85
add_partition_ncursesFunction · 0.85
change_part_type_ncursesFunction · 0.85
dir_partitionFunction · 0.85
io_redir_add_redirFunction · 0.85
io_redir_del_redirFunction · 0.85
partition_saveFunction · 0.85
display_messageFunction · 0.85
interface_loadFunction · 0.85
aff_copyFunction · 0.70

Tested by

no test coverage detected