static int get_log_last_index(const char *file_path) { char last_line[256] = {0}; /*Get the last index of current log file*/ get_last_line(file_path, last_line); return get_seqid(last_line, 256 - 1); }
int createpipe(t_lid *data) { t_pip *pipe; char **tab; char *line; if (data == NULL || (line = get_last_line(data->file)) == NULL) return (FALSE); if (line[0] == '#') return (TRUE); if ((tab = my_strtok(line, "-")) == NULL || tab_length(tab) != 2 || (pipe = create_pipe(tab[0], tab[1])) == NULL || data->existPipe(data, pipe)) return (FALSE); data->addPipe(data, pipe); gbgc_free(NULL, line); free_strtab(tab); return (TRUE); }