version 1.29, 2005/10/17 19:08:46 |
version 1.30, 2005/10/31 10:38:04 |
|
|
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); |
/* |
|
* 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) |
if (e_sectp == NULL) |
/* save first added, to-be the new top */ |
TAILQ_INSERT_HEAD(&defp->list, ep, q); |
e_sectp = ep; |
else |
|
TAILQ_INSERT_AFTER(&defp->list, e_sectp, |
|
ep, q); |
|
e_sectp = ep; |
} |
} |
} |
|
if (e_sectp != NULL) { /* entries added, fix order */ |
|
/* save original head */ |
|
TAILQ_NEXT(ep, q) = TAILQ_FIRST(&defp->list); |
|
/* first added entry, new top */ |
|
TAILQ_FIRST(&defp->list) = e_sectp; |
|
/* terminate list */ |
|
*e_sectp->q.tqe_prev = NULL; |
|
} |
} |
} |
} |
/* |
/* |