//#ifndef WIN_IE void EstEID_logMap_real(const char *func, const char *file, int line, EstEID_Map map) { FILE *log; if (access(EstEID_getLogFilename(), W_OK) == -1) return; log = EstEID_openLog(func, file, line); fprintf(log, "entries:\n"); EstEID_mapPrint(log, map); fclose(log); }
void EstEID_printCerts() { if (!EstEID_loadCerts()) { printf("%s\n", EstEID_error); return; } for (unsigned int i = 0; i < certs->count; i++) { EstEID_Map cert = certs->certs[i]; fprintf(stdout, "Slot: %lu\n", certs->slotIDs[i]); EstEID_mapPrint(stdout, cert); } }
int main(void) { EstEID_Map map = NULL; assertIntEquals(0, EstEID_mapSize(map)); map = EstEID_mapPut(map, "foo", "bar"); assertNotNull(map); assertIntEquals(1, EstEID_mapSize(map)); map = EstEID_mapPut(map, "foo", "FOO"); assertIntEquals(1, EstEID_mapSize(map)); char *k = strdup("key"); char *v = strdup("value"); map = EstEID_mapPut(map, k, v); free(k); free(v); assertIntEquals(2, EstEID_mapSize(map)); assertStringEquals("value", EstEID_mapGet(map, "key")); assertNull(EstEID_mapGet(map, "xyz")); EstEID_mapFree(map); EstEID_Map m = EstEID_mapPut(NULL, "a", "A"); EstEID_mapPut(m, "b", "B"); EstEID_mapPut(m, "c", "C"); printf("map:\n"); EstEID_mapPrint(stdout, m); EstEID_Map c = EstEID_mapClone(m); EstEID_mapFree(m); printf("clone:\n"); EstEID_mapPrint(stdout, c); EstEID_mapFree(c); }
void EstEID_mapPrint(FILE *stream, EstEID_Map map) { if (!map) return; fprintf(stream, "\t%s = %s\n", map->key, map->value); EstEID_mapPrint(stream, map->next); }