/* This file is in the public domain. */ #include #include #include "repo.h" #include "time.h" #include "structs.h" #include "data.h" void data_record(LISTEN *l, char *name, char *stamp, char *data, void (*err)(const char *, ...)) { __label__ errjmp_common; __label__ errjmp_stamp; __label__ errjmp_lookup; __label__ errjmp_record; TIMESTAMP ts; REPO *r; void *errjmp; static char *errstr = 0; void suberr(const char *fmt, ...) { va_list ap; va_start(ap,fmt); vasprintf(&errstr,fmt,ap); va_end(ap); goto errjmp_common; } if (0) { errjmp_common:; goto *errjmp; } printf("data_record: name=%s stamp=%s data=%s\n",name,stamp,data); // debugging errjmp = &&errjmp_stamp; ts = timestamp_parse(stamp,&suberr); if (0) { errjmp_stamp:; printf("timestamp parse error [%s]\n",errstr); // debugging (*err)("%s",errstr); } free(errstr); errstr = 0; errjmp = &&errjmp_lookup; r = repo_lookup(l,name,&suberr); if (0) { errjmp_lookup:; printf("lookup error [%s]\n",errstr); // debugging (*err)("%s",errstr); } printf("recording\n"); // debugging errjmp = &&errjmp_record; repo_record(r,ts,data,&suberr); if (0) { errjmp_record:; printf("record error [%s]\n",errstr); // debugging (*err)("%s",errstr); } }