void add_job(const char *cat, size_t cat_len, const char *dir, size_t dir_len) { char *location; location = xasprintf("%.*s/%.*s", (int)cat_len, cat, (int)dir_len, dir); add_job_full(location); free(location); }
static void parse_full_tree(char *data) { char *eol; while (*data) { eol = strchr(data, '\n'); if (eol == NULL) err(1, "Incomplete line in full tree list"); if (data == eol) continue; *eol = '\0'; add_job_full(data); data = eol + 1; } }
static void read_limited_list(void) { char location[PATH_MAX], *eos; while (fgets(location, PATH_MAX, stdin) != NULL) { eos = strchr(location, '\n'); if (eos == NULL) err(1, "Incomplete or too long input line"); if (location == eos) continue; if (*location == '#') continue; *eos = '\0'; add_job_full(location); } }