www.pudn.com > testdisk-6.6.rar > DIRPART.C
/*
File: dirpart.c
Copyright (C) 1998-2006 Christophe GRENIER
This software is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write the Free Software Foundation, Inc., 51
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifdef HAVE_CONFIG_H
#include
#endif
#ifdef HAVE_STRING_H
#include
#endif
#ifdef HAVE_STDLIB_H
#include
#endif
#ifdef HAVE_TIME_H
#include
#endif
#ifdef HAVE_SYS_STAT_H
#include
#endif
#include "types.h"
#include "common.h"
#include "fat.h"
#include "lang.h"
#include "fnctdsk.h"
#include "testdisk.h"
#include "intrf.h"
#include "dir.h"
#include "ext2_dir.h"
#include "fat_dir.h"
#include "ntfs_dir.h"
#include "rfs_dir.h"
#include "dirpart.h"
int dir_partition(t_param_disk *disk_car, const t_partition *partition, const int debug, char **current_cmd)
{
t_dir_data dir_data;
WINDOW *window;
int res=-3;
switch(partition->upart_type)
{
case UP_FAT12:
case UP_FAT16:
case UP_FAT32:
res=dir_partition_fat_init(disk_car,partition,&dir_data,debug);
break;
case UP_EXT3:
case UP_EXT2:
res=dir_partition_ext2_init(disk_car,partition,&dir_data,debug);
break;
case UP_RFS:
case UP_RFS2:
case UP_RFS3:
res=dir_partition_reiser_init(disk_car,partition,&dir_data,debug);
break;
case UP_NTFS:
res=dir_partition_ntfs_init(disk_car,partition,&dir_data,debug);
break;
default:
return res;
}
window=newwin(0,0,0,0); /* full screen */
dir_data.window=window;
aff_copy(window);
ecrit_rapport("\n");
switch(res)
{
case -2:
aff_buffer(BUFFER_RESET,"Q");
aff_copy(window);
wmove(window,4,0);
aff_part(window,AFF_PART_ORDER,disk_car,partition);
aff_part_rapport(disk_car,partition);
aff_buffer(BUFFER_ADD,"Support for this filesystem hasn't been enable during compilation.\n");
if(*current_cmd!=NULL)
screen_buffer_to_log();
else
screen_buffer_display(window,"",NULL);
break;
case -1:
aff_buffer(BUFFER_RESET,"Q");
aff_copy(window);
wmove(window,4,0);
aff_part(window,AFF_PART_ORDER,disk_car,partition);
aff_part_rapport(disk_car,partition);
aff_buffer(BUFFER_ADD,"Can't open filesystem. Filesystem seems damaged.\n");
screen_buffer_display(window,"",NULL);
break;
default:
dir_partition_aff(disk_car,partition,&dir_data,dir_data.current_inode,current_cmd);
dir_data.close(&dir_data);
break;
}
delwin(window);
(void) clearok(stdscr, TRUE);
#ifdef HAVE_TOUCHWIN
touchwin(stdscr);
#endif
return res;
}