From: Adam Heath Date: Tue, 9 Oct 2001 00:52:40 +0000 (+0000) Subject: Turn setstatuspipe into a generic setpipe, in preparation for --result-fd. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a832d2a73626a203c3ae52b346ce00242e87c400;p=dpkg Turn setstatuspipe into a generic setpipe, in preparation for --result-fd. --- diff --git a/ChangeLog b/ChangeLog index 4f417f1f..651f0aca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Oct 8 19:51:36 CDT 2001 Adam Heath + + * main/main.c: Turn setstatuspipe into a generic setpipe, in preparation + for --result-fd. + Mon Oct 8 19:48:28 CDT 2001 Adam Heath * main/main.c: Make sure the integer passed to --result-fd is correct diff --git a/main/main.c b/main/main.c index 872d8006..d0f1edab 100644 --- a/main/main.c +++ b/main/main.c @@ -264,22 +264,23 @@ static void setinteger(const struct cmdinfo *cip, const char *value) { *cip->iassignto= v; } - -static void setstatuspipe(const struct cmdinfo *cip, const char *value) { - static struct pipef *lastpipe= NULL; +static void setpipe(const struct cmdinfo *cip, const char *value) { + static struct pipef **lastpipe; unsigned long v; char *ep; v= strtoul(value,&ep,0); if (*ep || v > INT_MAX) badusage(_("invalid integer for --%s: `%.250s'"),cip->olong,value); - if (lastpipe) { - lastpipe->next= nfmalloc(sizeof(struct pipef)); - lastpipe= lastpipe->next; + + lastpipe= cip->parg; + if (*lastpipe) { + (*lastpipe)->next= nfmalloc(sizeof(struct pipef)); + *lastpipe= (*lastpipe)->next; } else { - lastpipe= status_pipes= nfmalloc(sizeof(struct pipef)); + *lastpipe= nfmalloc(sizeof(struct pipef)); } - lastpipe->fd= v; + (*lastpipe)->fd= v; } void setforce(const struct cmdinfo *cip, const char *value) { @@ -389,7 +390,7 @@ static const struct cmdinfo cmdinfos[]= { ACTION( "command-fd", 'c', act_commandfd, commandfd ), */ - { "status-fd", 0, 1, 0, 0, setstatuspipe }, + { "status-fd", 0, 1, 0, 0, setpipe, 0, &status_pipes }, { "pending", 'a', 0, &f_pending, 0, 0, 1 }, { "recursive", 'R', 0, &f_recursive, 0, 0, 1 }, { "no-act", 0, 0, &f_noact, 0, 0, 1 },