int rcfileParse (char *cfg, RcFile * data) { FILE *conf_file; #define buf_size 2048 char *temp; int rv = 0; int ctr = 0; if ((!data) || (!cfg)) return 1; if (NULL == (conf_file = fopen (cfg, "r"))) return 1; memset (data, 0, sizeof (RcFile)); if (NULL != (temp = utlCalloc (1, buf_size + 1))) { ctr = count_sections (conf_file, temp, buf_size); data->sections = NULL; data->section_count = 0; rv = 0; if (ctr != 0) { rv = parse_sections (ctr, data, conf_file, temp, buf_size); if (rv) rcfileClear (data); } free (temp); } else rv = 1; fclose (conf_file); return rv; }
void parse_elf (char* file_name) { init_elf_parser (file_name); if (architecture == ELFCLASS32) { get_num_sections (); get_section_names (); parse_sections (); find_main (); } else { get_num_sections64 (); get_section_names64 (); parse_sections64 (); find_main64 (); } }