diff --git a/Src/Main.c b/Src/Main.c index 87486f6..2bf3680 100644 --- a/Src/Main.c +++ b/Src/Main.c @@ -104,6 +104,8 @@ int main(int argc, char *argv[]) return(2); param->verbose = verbose; + int exit_code = 0; + /** Actions **/ if(param->action == ACTION_CATALOG) { @@ -149,7 +151,7 @@ int main(int argc, char *argv[]) return(3); /** Extrait le fichier sur disque **/ - ExtractOneFile( + exit_code = ExtractOneFile( current_image, param->prodos_file_path, param->output_directory_path, @@ -381,7 +383,7 @@ int main(int argc, char *argv[]) printf(" - Add file '%s' :\n",param->file_path); /** Ajoute le fichier dans l'archive **/ - AddFile(current_image,param->file_path,param->prodos_folder_path,1); + exit_code = AddFile(current_image,param->file_path,param->prodos_folder_path,1); /* Libération mémoire */ mem_free_image(current_image); @@ -436,7 +438,7 @@ int main(int argc, char *argv[]) printf(" - Replacing file '%s' :\n",prodos_file_name); DeleteProdosFile(current_image, prodos_file_name); - AddFile(current_image, param->file_path, param->prodos_folder_path,1); + exit_code = AddFile(current_image, param->file_path, param->prodos_folder_path,1); free(prodos_file_name); mem_free_image(current_image); @@ -450,7 +452,9 @@ int main(int argc, char *argv[]) for(i=0; ientry = current_entry; @@ -58,8 +58,9 @@ void ExtractOneFile(struct prodos_image *current_image, char *prodos_file_path, if(error) { printf(" Error : Can't get file from Image : Memory Allocation impossible.\n"); + current_image->nb_extract_error++; mem_free_file(current_file); - return; + return(error); } /** Création du fichier sur disque **/ @@ -67,6 +68,8 @@ void ExtractOneFile(struct prodos_image *current_image, char *prodos_file_path, /* Libération mémoire */ mem_free_file(current_file); + + return (error); } diff --git a/Src/Prodos_Extract.h b/Src/Prodos_Extract.h index 883d9ba..df6eb4c 100644 --- a/Src/Prodos_Extract.h +++ b/Src/Prodos_Extract.h @@ -8,7 +8,7 @@ #include -void ExtractOneFile(struct prodos_image *, char *, char *, bool); +int ExtractOneFile(struct prodos_image *, char *, char *, bool); void ExtractFolderFiles(struct prodos_image *, struct file_descriptive_entry *, char *, bool); void ExtractVolumeFiles(struct prodos_image *, char *, bool);