9511_project01

project 1 for algorithms & programming I (9511) prof. Cardozo
Index Commits Files Refs README
commit 4cc4c38ce586b2a9d406a99c6073b1469c99c55b
parent 76e0005e9d6770a60627ad2c95e69e06f29bc47e
Author: klewer-martin <martin.cachari@gmail.com>
Date:   Wed,  3 Feb 2021 12:13:57 -0300

Deleted a function in arguments.c, merged with another one saving a few lines of codes

Diffstat:
Marguments.c | 12+++---------
Marguments.h | 4+---
Mmain.c | 9+--------
3 files changed, 5 insertions(+), 20 deletions(-)
diff --git a/arguments.c b/arguments.c
@@ -6,21 +6,15 @@
 #define INPUT_FILE_NAME_MSG     "\t -> Archivo de entrada: "
 #define OUTPUT_FILE_NAME_MSG     "\t -> Archivo de salida: "
 
-//    Checks if the arguments are right;
-status_t validate_arguments(int argc, char * argv[])
+//    Valida que los argumentos esten correctos y guarda los nombres de los 
+//    archivos de entrada y salida en src y dest respectivamente;
+status_t validate_arguments(int argc, char * argv[], char * src, char * dest)
 {
     if(argc == NO_CMD_ARGUMENTS)
         return ERROR_INVOCATING_PROGRAM;
     else if(argv == NULL)
         return ERROR_NULL_POINTER;
 
-    return OK;
-}
-
-//    Valida que los argumentos esten correctos y guardas los nombres de los 
-//    archivos de entrada y salida en src y dest respectivamente;
-status_t set_files_name(int argc, char * argv[], char * src, char * dest)
-{
     int i;
     status_t inputFile, outputFile;
     inputFile = outputFile = FILE_NOT_FOUND;
diff --git a/arguments.h b/arguments.h
@@ -6,8 +6,6 @@
 
 void print_error(status_t error);
 
-status_t validate_arguments(int argc, char * argv[]);
-
-status_t set_files_name(int argc, char * argv[], char * src, char * dest);
+status_t validate_arguments(int argc, char * argv[], char * src, char * dest);
 
 #endif
diff --git a/main.c b/main.c
@@ -41,19 +41,12 @@ int main(int argc, char * argv[])
 
 //    char **country_codes = (char**)malloc(COUNTRIES_NUMBER * ARRAYS_LENGTH * sizeof(char));
 
-    if((st = validate_arguments(argc, argv)) != OK) {
+    if((st = validate_arguments(argc, argv, src, dest)) != OK) {
         print_error(st);
         return st;
     }
     
 
-
-    if((st = set_files_name(argc, argv, src, dest)) != OK) {
-        print_error(st);
-        return st;
-    }
-
-
     if(load_country_codes(country_codes) != OK)
         return ERROR_LOADING_COUNTRY_CODES;