1 #ifndef UTILS__H 2 #define UTILS__H 3 4 #include <stdio.h> 5 #include <stdlib.h> 6 #include <string.h> 7 #include <stdbool.h> 8 9 #include "cla.h" 10 #include "user.h" 11 #include "status.h" 12 #include "vector.h" 13 14 #define _XOPEN_SOURCE 15 #define __USE_XOPEN 16 #include <time.h> 17 18 #define IN_FILE_MAX_LEN 100 19 #define IN_FILE_DELIM "," 20 #define IN_FILE_FIELDS 6 21 #define IN_FILE_FIELDS_MAX_LEN 50 22 23 #define STR_FMT_CSV "csv" 24 #define STR_FMT_XML "xml" 25 26 #define CARD_NO_VALID_LEN 16 27 28 #define XML_STR_HEADER "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" 29 #define XML_STR_ROOT "root" 30 #define XML_STR_ROW "row" 31 #define XML_STR_ID "user" 32 #define XML_STR_CREDIT "credits" 33 #define XML_STR_DEBIT "debits" 34 35 status_t string_split(char *, char **, char *); 36 void clean_array(char **); 37 void clean_buffer(char *); 38 39 status_t create_2darray(char ***, size_t, size_t); 40 status_t destroy_2darray(char **, size_t); 41 42 status_t get_date(time_t *, char *); 43 44 bool is_valid_card(char *); 45 46 #endif