/* * add_library() * * checks that a library can be opened and is in the correct format, * then adds it to the linked list of libraries. */ void add_library(const char *name) { if (rdl_verify(name)) { rdl_perror("ldrdf", name); errorcount++; return; } if (!libraries) { lastlib = libraries = malloc(sizeof(*libraries)); if (!libraries) { fprintf(stderr, "ldrdf: out of memory\n"); exit(1); } } else { lastlib->next = malloc(sizeof(*libraries)); if (!lastlib->next) { fprintf(stderr, "ldrdf: out of memory\n"); exit(1); } lastlib = lastlib->next; } lastlib->next = NULL; if (rdl_open(lastlib, name)) { rdl_perror("ldrdf", name); errorcount++; return; } }
int rd_left(t_system *sys) { int checkout; t_cmd *tmp; tmp = sys->cmd->prev; reset_pipe(sys); checkout = rdl_open(sys); if (checkout > 0) checkout = rdl_checkout(sys); sys->cmd = tmp; return (checkout); }