int main(int argc, char* argv[]) { drs_t drs; config_t config; size_t dirEntries; char *contents = argv[0]; // temporary int rc = 0; if (parseParams(argc, argv, &config)) { usage(); return 1; } if (config.extract) { rc = drs_load(config.filePath, &drs); if (rc) { printf("RETURNED %d\n", rc); } else { drs_print_header(&drs, stdout); drs_extract_archive(&drs, "drsFiles"); //drs_create_archive(&drs, "../generated.drs"); drs_free(&drs); } } else { drs_init_empty(&drs); rc = directory_scan(config.filePath, contents, &dirEntries); } return rc; }
static void mainloop_inetd(void) { ServerConnection *connection = NULL; DataReadySelector *drs; if( ! config_switchToTargetUser() ) exit(1); drs_setNonBlockingCloExecFlags(0); drs = drs_new(); connection = conn_new(0); while( conn_processDataReady(connection, drs, false) != CONN_TO_CLOSE ) drs_select(drs); conn_free(connection); drs_free(drs); }