static void rpmfc_dtor(JSContext *cx, JSObject *obj) { void * ptr = JS_GetInstancePrivate(cx, obj, &rpmfcClass, NULL); rpmfc fc = ptr; _DTOR_DEBUG_ENTRY(_debug); if (fc) (void) rpmfcFree(fc); }
int main(int argc, char *argv[]) { poptContext optCon = NULL; ARGV_t av = NULL; rpmfc fc = NULL; int ec = 1; char buf[BUFSIZ]; xsetprogname(argv[0]); /* Portability call -- see system.h */ optCon = rpmcliInit(argc, argv, optionsTable); if (optCon == NULL) goto exit; /* normally files get passed through stdin but also accept files as args */ if (poptPeekArg(optCon)) { const char *arg; while ((arg = poptGetArg(optCon)) != NULL) { argvAdd(&av, arg); } } else { while (fgets(buf, sizeof(buf), stdin) != NULL) { char *be = buf + strlen(buf) - 1; while (strchr("\r\n", *be) != NULL) *be-- = '\0'; argvAdd(&av, buf); } } /* Make sure file names are sorted. */ argvSort(av, NULL); /* Build file/package class and dependency dictionaries. */ fc = rpmfcCreate(getenv("RPM_BUILD_ROOT"), 0); if (rpmfcClassify(fc, av, NULL) || rpmfcApply(fc)) goto exit; if (_rpmfc_debug) rpmfcPrint(buf, fc, NULL); if (print_provides) rpmdsPrint(NULL, rpmfcProvides(fc), stdout); if (print_requires) rpmdsPrint(NULL, rpmfcRequires(fc), stdout); if (print_recommends) rpmdsPrint(NULL, rpmfcRecommends(fc), stdout); if (print_suggests) rpmdsPrint(NULL, rpmfcSuggests(fc), stdout); if (print_supplements) rpmdsPrint(NULL, rpmfcSupplements(fc), stdout); if (print_enhances) rpmdsPrint(NULL, rpmfcEnhances(fc), stdout); if (print_conflicts) rpmdsPrint(NULL, rpmfcConflicts(fc), stdout); if (print_obsoletes) rpmdsPrint(NULL, rpmfcObsoletes(fc), stdout); ec = 0; exit: argvFree(av); rpmfcFree(fc); rpmcliFini(optCon); return ec; }