| 154 | #endif |
| 155 | |
| 156 | int main( int argc, char **argv ) |
| 157 | { |
| 158 | list_disk_t *list_disk=NULL; |
| 159 | /*@ assert list_disk == \null; */ |
| 160 | /*@ assert valid_list_disk(list_disk); */ |
| 161 | int i; |
| 162 | #ifdef DISABLED_FOR_FRAMAC |
| 163 | char *argv_framac[]={ "photorec", "/cmd", "file.dd", "search", NULL }; |
| 164 | #endif |
| 165 | #ifdef SUDO_BIN |
| 166 | int use_sudo=0; |
| 167 | #endif |
| 168 | int create_log=TD_LOG_NONE; |
| 169 | int run_setlocale=1; |
| 170 | int testdisk_mode=TESTDISK_O_RDONLY|TESTDISK_O_READAHEAD_32K; |
| 171 | list_disk_t *element_disk; |
| 172 | const char *logfile="photorec.log"; |
| 173 | int log_opened=0; |
| 174 | int log_errno=0; |
| 175 | struct ph_options options={ |
| 176 | .paranoid=1, |
| 177 | .keep_corrupted_file=0, |
| 178 | .mode_ext2=0, |
| 179 | .expert=0, |
| 180 | .lowmem=0, |
| 181 | .verbose=0, |
| 182 | .list_file_format=array_file_enable |
| 183 | }; |
| 184 | struct ph_param params; |
| 185 | if(argc <= 0) |
| 186 | return 1; |
| 187 | /*@ assert valid_list_disk(list_disk); */ ; |
| 188 | params.recup_dir=NULL; |
| 189 | params.cmd_device=NULL; |
| 190 | params.cmd_run=NULL; |
| 191 | params.carve_free_space_only=0; |
| 192 | params.disk=NULL; |
| 193 | /*@ assert valid_ph_param(¶ms); */ |
| 194 | /* random (weak is ok) is needed for GPT */ |
| 195 | srand(time(NULL)& (long)0xffffffff); |
| 196 | /*@ assert valid_list_disk(list_disk); */ ; |
| 197 | #ifdef HAVE_SIGACTION |
| 198 | /* set up the signal handler for SIGINT & SIGHUP */ |
| 199 | sigemptyset(&action.sa_mask); |
| 200 | sigaddset(&action.sa_mask, SIGINT); |
| 201 | sigaddset(&action.sa_mask, SIGHUP); |
| 202 | sigaddset(&action.sa_mask, SIGTERM); |
| 203 | action.sa_handler = &sighup_hdlr; |
| 204 | action.sa_flags = 0; |
| 205 | if(sigaction(SIGINT, &action, NULL)==-1) |
| 206 | { |
| 207 | printf("Error on SIGACTION call\n"); |
| 208 | return -1; |
| 209 | } |
| 210 | if(sigaction(SIGHUP, &action, NULL)==-1) |
| 211 | { |
| 212 | printf("Error on SIGACTION call\n"); |
| 213 | return -1; |
nothing calls this directly
no test coverage detected