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

Function dump

src/intrfn.c:500–607  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

498#define INTER_DUMP_Y (LINES+23-25)
499
500void dump(WINDOW *window, const void *nom_dump,unsigned int lng)
501{
502 unsigned int nbr_line;
503 unsigned int pos=0;
504 int done=0;
505 unsigned int menu=2; /* default : quit */
506 const char *options="PNQ";
507 const struct MenuItem menuDump[]=
508 {
509 { 'P', "Previous",""},
510 { 'N', "Next","" },
511 { 'Q',"Quit","Quit dump section"},
512 { 0, NULL, NULL }
513 };
514 nbr_line=(lng+0x10-1)/0x10;
515 if(nbr_line <= (unsigned)DUMP_MAX_LINES)
516 {
517 options="Q";
518 }
519 /* ncurses interface */
520 mvwaddstr(window,DUMP_Y,DUMP_X,msg_DUMP_HEXA);
521 /* On pourrait utiliser wscrl */
522 do
523 {
524 unsigned char car;
525 unsigned int i,j;
526 for (i=pos; i<nbr_line && (i-pos) < (unsigned)DUMP_MAX_LINES; i++)
527 {
528 wmove(window,DUMP_Y+i-pos,DUMP_X);
529 wclrtoeol(window);
530 wprintw(window,"%04X ",i*0x10);
531 for(j=0; j< 0x10;j++)
532 {
533 if(i*0x10+j<lng)
534 {
535 car=*((const unsigned char*)nom_dump+i*0x10+j);
536 wprintw(window,"%02x", car);
537 }
538 else
539 wprintw(window," ");
540 if(j%4==(4-1))
541 wprintw(window," ");
542 }
543 wprintw(window," ");
544 for(j=0; j< 0x10;j++)
545 {
546 if(i*0x10+j<lng)
547 {
548 car=*((const unsigned char*)nom_dump+i*0x10+j);
549 if ((car<32)||(car >= 127))
550 wprintw(window,".");
551 else
552 wprintw(window,"%c", car);
553 }
554 else
555 wprintw(window," ");
556 }
557 }

Callers 2

dump_ncursesFunction · 0.85
dump_fat1x_ncursesFunction · 0.85

Calls 1

wmenuSelectFunction · 0.85

Tested by

no test coverage detected