int main(int argc, const char **argv) { xfatelf_init(argc, argv); if (argc != 4) // this could stand to use getopt(), later. xfail("USAGE: %s <out> <in> <newelf>", argv[0]); return fatelf_replace(argv[1], argv[2], argv[3]); } // main
static enum NTDB_ERROR parse(NTDB_DATA key, NTDB_DATA data, NTDB_DATA *expected) { NTDB_DATA add = ntdb_mkdata("another", strlen("another")); if (!ntdb_deq(data, *expected)) { return NTDB_ERR_EINVAL; } /* These should all fail.*/ if (!xfail(ntdb_store(ntdb, add, add, NTDB_INSERT))) { return NTDB_ERR_EINVAL; } tap_log_messages--; if (!xfail(ntdb_append(ntdb, key, add))) { return NTDB_ERR_EINVAL; } tap_log_messages--; if (!xfail(ntdb_delete(ntdb, key))) { return NTDB_ERR_EINVAL; } tap_log_messages--; if (!xfail(ntdb_transaction_start(ntdb))) { return NTDB_ERR_EINVAL; } tap_log_messages--; if (!xfail(ntdb_chainlock(ntdb, key))) { return NTDB_ERR_EINVAL; } tap_log_messages--; if (!xfail(ntdb_lockall(ntdb))) { return NTDB_ERR_EINVAL; } tap_log_messages--; if (!xfail(ntdb_wipe_all(ntdb))) { return NTDB_ERR_EINVAL; } tap_log_messages--; if (!xfail(ntdb_repack(ntdb))) { return NTDB_ERR_EINVAL; } tap_log_messages--; /* Access the record one more time. */ if (!ntdb_deq(data, *expected)) { return NTDB_ERR_EINVAL; } return NTDB_SUCCESS; }
static int xfind_fatelf_record_by_elf(const char *fname, const int fd, const char *fatfname, const FATELF_header *header) { FATELF_record record; int i; xread_elf_header(fname, fd, 0, &record); for (i = 0; i < ((int)header->num_records); i++) { if (fatelf_record_matches(&header->records[i], &record)) return i; } // for xfail("No record matches '%s' in FatELF file '%s'", fname, fatfname); return -1; } // xfind_fatelf_record_by_elf