aoc.c (471B)
1#include "aoc.h" 2#include "util.h" 3 4#include <string.h> 5#include <stdarg.h> 6#include <stdio.h> 7 8void 9aoc_check(const char *sol, const char *fmtstr, ...) 10{ 11 char buf[256]; 12 va_list ap; 13 14 va_start(ap, fmtstr); 15 vsnprintf(buf, 256, fmtstr, ap); 16 va_end(ap); 17 18 if (strcmp(sol, buf)) 19 die("aoc: solution check failed"); 20} 21 22void 23aoc_debug(const char *fmtstr, ...) 24{ 25 va_list ap; 26 27 if (!aoc.debug) return; 28 29 va_start(ap, fmtstr); 30 vfprintf(stderr, fmtstr, ap); 31 va_end(ap); 32} 33