summaryrefslogtreecommitdiffstats
path: root/src/phnc.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2012-01-27 08:43:56 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2012-01-27 08:43:56 +0100
commit71d5bddcff73d44c23245bec20eda5115c38fd02 (patch)
tree7cf2432737d2ba0d056f591dcd95434b1af580cb /src/phnc.c
parentd256adb14719ae0b31890da4bcad312021882022 (diff)
PhotoRec: if less than 10 file famillies are enabled, display the results even if zero file have been found yet.
Diffstat (limited to 'src/phnc.c')
-rw-r--r--src/phnc.c39
1 files changed, 27 insertions, 12 deletions
diff --git a/src/phnc.c b/src/phnc.c
index f13dd80..855c350 100644
--- a/src/phnc.c
+++ b/src/phnc.c
@@ -49,7 +49,6 @@ void photorec_info(WINDOW *window, const file_stat_t *file_stats)
{
unsigned int i;
unsigned int nbr;
- unsigned int others=0;
file_stat_t *new_file_stats;
for(i=0;file_stats[i].file_hint!=NULL;i++);
nbr=i;
@@ -58,25 +57,41 @@ void photorec_info(WINDOW *window, const file_stat_t *file_stats)
new_file_stats=(file_stat_t*)MALLOC(nbr*sizeof(file_stat_t));
memcpy(new_file_stats, file_stats, nbr*sizeof(file_stat_t));
qsort(new_file_stats, nbr, sizeof(file_stat_t), sorfile_stat_ts);
- for(i=0;i<nbr && new_file_stats[i].recovered>0;i++)
+ if(nbr<=10)
{
- if(i<10)
+ for(i=0; i<nbr; i++)
{
wmove(window,11+i,0);
wclrtoeol(window);
wprintw(window, "%s: %u recovered\n",
- (new_file_stats[i].file_hint->extension!=NULL?
- new_file_stats[i].file_hint->extension:""),
- new_file_stats[i].recovered);
+ (new_file_stats[i].file_hint->extension!=NULL?
+ new_file_stats[i].file_hint->extension:""),
+ new_file_stats[i].recovered);
}
- else
- others+=new_file_stats[i].recovered;
}
- if(others>0)
+ else
{
- wmove(window,11+10,0);
- wclrtoeol(window);
- wprintw(window, "others: %u recovered\n", others);
+ unsigned int others=0;
+ for(i=0;i<nbr && new_file_stats[i].recovered>0;i++)
+ {
+ if(i<10)
+ {
+ wmove(window,11+i,0);
+ wclrtoeol(window);
+ wprintw(window, "%s: %u recovered\n",
+ (new_file_stats[i].file_hint->extension!=NULL?
+ new_file_stats[i].file_hint->extension:""),
+ new_file_stats[i].recovered);
+ }
+ else
+ others+=new_file_stats[i].recovered;
+ }
+ if(others>0)
+ {
+ wmove(window,11+10,0);
+ wclrtoeol(window);
+ wprintw(window, "others: %u recovered\n", others);
+ }
}
free(new_file_stats);
}