version 1.2, 1996/06/26 05:37:01 |
version 1.3, 1996/07/18 22:52:58 |
|
|
/* |
/* |
* 3: If the user set the -m option, insert the user's list before |
* 3: If the user set the -m option, insert the user's list before |
* whatever list we have, again appending the _subdir list and |
* whatever list we have, again appending the _subdir list and |
* the machine. |
* the machine. |
*/ |
*/ |
if (p_add != NULL) |
if (p_add != NULL) { |
|
e_sectp = NULL; |
for (p = strtok(p_add, ":"); p != NULL; p = strtok(NULL, ":")) { |
for (p = strtok(p_add, ":"); p != NULL; p = strtok(NULL, ":")) { |
slashp = p[strlen(p) - 1] == '/' ? "" : "/"; |
slashp = p[strlen(p) - 1] == '/' ? "" : "/"; |
e_subp = (subp = getlist("_subdir")) == NULL ? |
e_subp = (subp = getlist("_subdir")) == NULL ? |
|
|
if ((ep = malloc(sizeof(ENTRY))) == NULL || |
if ((ep = malloc(sizeof(ENTRY))) == NULL || |
(ep->s = strdup(buf)) == NULL) |
(ep->s = strdup(buf)) == NULL) |
err(1, NULL); |
err(1, NULL); |
TAILQ_INSERT_HEAD(&defp->list, ep, q); |
/* puts it at the end, should be at the top, but then the added |
|
entries would be in reverse order, fix later when all are added*/ |
|
TAILQ_INSERT_TAIL(&defp->list, ep, q); |
|
if (e_sectp == NULL) /* save first added, to-be the new top */ |
|
e_sectp = ep; |
} |
} |
} |
} |
|
if (e_sectp != NULL) { /* entries added, fix order */ |
|
ep->q.tqe_next = defp->list.tqh_first; /* save original head */ |
|
defp->list.tqh_first = e_sectp; /* first added entry, new top */ |
|
*e_sectp->q.tqe_prev = NULL; /* terminate list */ |
|
} |
|
} |
/* |
/* |
* 4: If no -m was specified, and a section was, rewrite the section's |
* 4: If no -m was specified, and a section was, rewrite the section's |
* paths (if they have a trailing slash) to append the _subdir list |
* paths (if they have a trailing slash) to append the _subdir list |