free(updatefnbuf);
}
+struct pipef *status_pipes= NULL;
+
void modstatdb_note(struct pkginfo *pkg) {
assert(cstatus >= msdbrw_write);
onerr_abort++;
+ if (status_pipes) {
+ static struct varbuf *status= NULL;
+ struct pipef *pipef= status_pipes;
+ int r;
+ if (status == NULL) {
+ status = nfmalloc(sizeof(struct varbuf));
+ varbufinit(status);
+ } else
+ varbufreset(status);
+ r= varbufprintf(status, "status: %s: %s\n", pkg->name, statusinfos[pkg->status]);
+ while (pipef) {
+ write(pipef->fd, status->buf, r);
+ pipef= pipef->next;
+ }
+ }
varbufreset(&uvb);
varbufrecord(&uvb, pkg, &pkg->installed);
if (fwrite(uvb.buf, 1, uvb.used, importanttmp) != uvb.used)
--largemem | --smallmem Optimise for large (>4Mb) or small (<4Mb) RAM use\n\
--no-act Just say what we would do - don't do it\n\
-D|--debug=<octal> Enable debugging - see -Dhelp or --debug=help\n\
+ --status-pipe <n> Send status change updates to file descriptor <n>\n\
--ignore-depends=<package>,... Ignore dependencies involving <package>\n\
--force-... Override problems - see --force-help\n\
--no-force-...|--refuse-... Stop when problems encountered\n\
*cip->iassignto= v;
}
+
+static void setstatuspipe(const struct cmdinfo *cip, const char *value) {
+ static struct pipef *lastpipe= NULL;
+ unsigned long v;
+ char *ep;
+
+ if (lastpipe) {
+ lastpipe->next= nfmalloc(sizeof(struct pipef));
+ lastpipe= lastpipe->next;
+ } else {
+ lastpipe= status_pipes= nfmalloc(sizeof(struct pipef));
+ }
+ v= strtoul(value,&ep,0);
+ if (*ep || v > INT_MAX)
+ badusage(_("invalid integer for --%s: `%.250s'"),cip->olong,value);
+ lastpipe->fd= v;
+}
+
void setforce(const struct cmdinfo *cip, const char *value) {
const char *comma;
int l;
static const char passshortopts[]= "bceIfxX";
static const char okpassshortopts[]= "D";
+void commandpipe(const char *const *argv);
static const struct cmdinfo cmdinfos[]= {
/* This table has both the action entries in it and the normal options.
* The action entries are made with the ACTION macro, as they all
ACTION( "predep-package", 0, act_predeppackage, predeppackage ),
ACTION( "compare-versions", 0, act_cmpversions, cmpversions ),
+ { "status-pipe", 0, 1, 0, 0, setstatuspipe },
{ "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 },