Mercurial > ~dholland > hg > tradcpp > index.cgi
comparison place.c @ 142:26ee741196d1
Allow complain(NULL, format, ...)
author | David A. Holland |
---|---|
date | Sat, 13 Jul 2013 12:38:54 -0400 |
parents | 05d67dd74e1f |
children | 95fbb216e23f |
comparison
equal
deleted
inserted
replaced
141:63414cddf09c | 142:26ee741196d1 |
---|---|
48 DEFARRAY(placefile, static); | 48 DEFARRAY(placefile, static); |
49 | 49 |
50 static struct placefilearray placefiles; | 50 static struct placefilearray placefiles; |
51 static bool overall_failure; | 51 static bool overall_failure; |
52 | 52 |
53 static const char *myprogname; | |
54 | |
53 //////////////////////////////////////////////////////////// | 55 //////////////////////////////////////////////////////////// |
54 // seenfiles | 56 // seenfiles |
55 | 57 |
56 static | 58 static |
57 struct placefile * | 59 struct placefile * |
185 | 187 |
186 //////////////////////////////////////////////////////////// | 188 //////////////////////////////////////////////////////////// |
187 // complaints | 189 // complaints |
188 | 190 |
189 void | 191 void |
192 complain_init(const char *pn) | |
193 { | |
194 myprogname = pn; | |
195 } | |
196 | |
197 void | |
190 complain(const struct place *p, const char *fmt, ...) | 198 complain(const struct place *p, const char *fmt, ...) |
191 { | 199 { |
192 va_list ap; | 200 va_list ap; |
193 | 201 |
194 place_printfrom(p); | 202 if (p != NULL) { |
195 fprintf(stderr, "%s:%u:%u: ", place_getname(p), p->line, p->column); | 203 place_printfrom(p); |
204 fprintf(stderr, "%s:%u:%u: ", place_getname(p), | |
205 p->line, p->column); | |
206 } else { | |
207 fprintf(stderr, "%s: ", myprogname); | |
208 } | |
196 va_start(ap, fmt); | 209 va_start(ap, fmt); |
197 vfprintf(stderr, fmt, ap); | 210 vfprintf(stderr, fmt, ap); |
198 va_end(ap); | 211 va_end(ap); |
199 fprintf(stderr, "\n"); | 212 fprintf(stderr, "\n"); |
200 } | 213 } |