| 607 | } |
| 608 | |
| 609 | void dump2(WINDOW *window, const void *dump_1, const void *dump_2, const unsigned int lng) |
| 610 | { |
| 611 | unsigned int nbr_line; |
| 612 | unsigned int pos=0; |
| 613 | int done=0; |
| 614 | unsigned int menu=2; /* default : quit */ |
| 615 | const char *options="PNQ"; |
| 616 | const struct MenuItem menuDump[]= |
| 617 | { |
| 618 | { 'P', "Previous",""}, |
| 619 | { 'N', "Next","" }, |
| 620 | { 'Q',"Quit","Quit dump section"}, |
| 621 | { 0, NULL, NULL } |
| 622 | }; |
| 623 | /* ncurses interface */ |
| 624 | nbr_line=(lng+0x08-1)/0x08; |
| 625 | if(nbr_line <= (unsigned)DUMP_MAX_LINES) |
| 626 | { |
| 627 | options="Q"; |
| 628 | } |
| 629 | do |
| 630 | { |
| 631 | unsigned int i,j; |
| 632 | for (i=pos; i<nbr_line && (i-pos) < (unsigned)DUMP_MAX_LINES; i++) |
| 633 | { |
| 634 | wmove(window,DUMP_Y+i-pos,DUMP_X); |
| 635 | wclrtoeol(window); |
| 636 | wprintw(window,"%04X ",i*0x08); |
| 637 | for(j=0; j<0x08;j++) |
| 638 | { |
| 639 | if(i*0x08+j<lng) |
| 640 | { |
| 641 | unsigned char car1=*((const unsigned char*)dump_1+i*0x08+j); |
| 642 | unsigned char car2=*((const unsigned char*)dump_2+i*0x08+j); |
| 643 | if(car1!=car2) |
| 644 | wattrset(window, A_REVERSE); |
| 645 | wprintw(window,"%02x", car1); |
| 646 | if(car1!=car2) |
| 647 | wattroff(window, A_REVERSE); |
| 648 | } |
| 649 | else |
| 650 | wprintw(window," "); |
| 651 | if(j%4==(4-1)) |
| 652 | wprintw(window," "); |
| 653 | } |
| 654 | wprintw(window," "); |
| 655 | for(j=0; j<0x08;j++) |
| 656 | { |
| 657 | if(i*0x08+j<lng) |
| 658 | { |
| 659 | unsigned char car1=*((const unsigned char*)dump_1+i*0x08+j); |
| 660 | unsigned char car2=*((const unsigned char*)dump_2+i*0x08+j); |
| 661 | if(car1!=car2) |
| 662 | wattrset(window, A_REVERSE); |
| 663 | if ((car1<32)||(car1 >= 127)) |
| 664 | wprintw(window,"."); |
| 665 | else |
| 666 | wprintw(window,"%c", car1); |
no test coverage detected