diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-03-10 23:25:11 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-03-10 23:26:52 +0200 |
commit | 39a97e438dde837ada9a99cceea93a1cf97db19e (patch) | |
tree | efc492dcfcdc2c21bfdec5c31692b348601cd94a /src | |
parent | 87602f5492b842f734dffe22f4e2f85dbc6ce713 (diff) | |
download | wydawca-39a97e438dde837ada9a99cceea93a1cf97db19e.tar.gz wydawca-39a97e438dde837ada9a99cceea93a1cf97db19e.tar.bz2 |
Provide a convenient debugging macro.
Rename logmsg to wy_log.
Diffstat (limited to 'src')
-rw-r--r-- | src/builtin.c | 4 | ||||
-rw-r--r-- | src/dictionary.c | 26 | ||||
-rw-r--r-- | src/directive.c | 88 | ||||
-rw-r--r-- | src/diskio.c | 107 | ||||
-rw-r--r-- | src/exec.c | 34 | ||||
-rw-r--r-- | src/gpg.c | 62 | ||||
-rw-r--r-- | src/job.c | 53 | ||||
-rw-r--r-- | src/lock.c | 10 | ||||
-rw-r--r-- | src/module.c | 18 | ||||
-rw-r--r-- | src/net.c | 24 | ||||
-rw-r--r-- | src/null.c | 22 | ||||
-rw-r--r-- | src/pidfile.c | 12 | ||||
-rw-r--r-- | src/process.c | 36 | ||||
-rw-r--r-- | src/sql.c | 18 | ||||
-rw-r--r-- | src/triplet.c | 58 | ||||
-rw-r--r-- | src/userprivs.c | 22 | ||||
-rw-r--r-- | src/verify.c | 42 | ||||
-rw-r--r-- | src/watcher.c | 60 | ||||
-rw-r--r-- | src/wydawca.c | 41 | ||||
-rw-r--r-- | src/wydawca.h | 12 |
20 files changed, 350 insertions, 399 deletions
diff --git a/src/builtin.c b/src/builtin.c index 72b73cd..b812236 100644 --- a/src/builtin.c +++ b/src/builtin.c | |||
@@ -80,7 +80,7 @@ cmp_regex(const char *pat, const char *str, int flags) | |||
80 | char errbuf[512]; | 80 | char errbuf[512]; |
81 | 81 | ||
82 | regerror(rc, ®ex, errbuf, sizeof(errbuf)); | 82 | regerror(rc, ®ex, errbuf, sizeof(errbuf)); |
83 | logmsg(LOG_ERR, _("%s: cannot compile regexp: %s"), pat, | 83 | wy_log(LOG_ERR, _("%s: cannot compile regexp: %s"), pat, |
84 | errbuf); | 84 | errbuf); |
85 | return 0; | 85 | return 0; |
86 | } | 86 | } |
@@ -119,7 +119,7 @@ parse_cmp_type(const char *pat, strcmp_fn * cmpfn, int *rf) | |||
119 | break; | 119 | break; |
120 | 120 | ||
121 | default: | 121 | default: |
122 | logmsg(LOG_NOTICE, | 122 | wy_log(LOG_NOTICE, |
123 | _("unrecognized comparison flag: %c"), | 123 | _("unrecognized comparison flag: %c"), |
124 | *pat); | 124 | *pat); |
125 | } | 125 | } |
diff --git a/src/dictionary.c b/src/dictionary.c index f46dd81..4f18267 100644 --- a/src/dictionary.c +++ b/src/dictionary.c | |||
@@ -65,10 +65,10 @@ dictionary_init(struct dictionary *dict) | |||
65 | return 0; | 65 | return 0; |
66 | if (wy_debug_level > 1) { | 66 | if (wy_debug_level > 1) { |
67 | int i; | 67 | int i; |
68 | logmsg(LOG_DEBUG, _("initializing dictionary: %s \"%s\""), | 68 | wy_log(LOG_DEBUG, _("initializing dictionary: %s \"%s\""), |
69 | mp->name, SP(dict->query)); | 69 | mp->name, SP(dict->query)); |
70 | for (i = 0; i < dict->parmc; i++) | 70 | for (i = 0; i < dict->parmc; i++) |
71 | logmsg(LOG_DEBUG, " parmv[%d]=%s", i, dict->parmv[i]); | 71 | wy_log(LOG_DEBUG, " parmv[%d]=%s", i, dict->parmv[i]); |
72 | } | 72 | } |
73 | if (mp->init) | 73 | if (mp->init) |
74 | rc = mp->init(dict); | 74 | rc = mp->init(dict); |
@@ -110,10 +110,10 @@ dictionary_done(struct dictionary *dict) | |||
110 | return 0; | 110 | return 0; |
111 | if (wy_debug_level > 1) { | 111 | if (wy_debug_level > 1) { |
112 | int i; | 112 | int i; |
113 | logmsg(LOG_DEBUG, _("closing dictionary: %s \"%s\""), | 113 | wy_log(LOG_DEBUG, _("closing dictionary: %s \"%s\""), |
114 | mp->name, SP(dict->query)); | 114 | mp->name, SP(dict->query)); |
115 | for (i = 0; i < dict->parmc; i++) | 115 | for (i = 0; i < dict->parmc; i++) |
116 | logmsg(LOG_DEBUG, " parmv[%d]=%s", i, dict->parmv[i]); | 116 | wy_log(LOG_DEBUG, " parmv[%d]=%s", i, dict->parmv[i]); |
117 | } | 117 | } |
118 | if (mp->done) | 118 | if (mp->done) |
119 | rc = mp->done(dict); | 119 | rc = mp->done(dict); |
@@ -128,24 +128,22 @@ dictionary_lookup(struct dictionary *dict, void *handle, const char *cmd) | |||
128 | { | 128 | { |
129 | struct dictionary_descr *mp = dictionary_tab + dict->type; | 129 | struct dictionary_descr *mp = dictionary_tab + dict->type; |
130 | 130 | ||
131 | if (wy_debug_level > 1) { | 131 | if (cmd) |
132 | if (cmd) | 132 | wy_debug(1, (_("dictionary lookup: %s \"%s\""), |
133 | logmsg(LOG_DEBUG, _("dictionary lookup: %s \"%s\""), | 133 | mp->name, cmd)); |
134 | mp->name, cmd); | 134 | else |
135 | else | 135 | wy_debug(1, (_("dictionary lookup: %s"), |
136 | logmsg(LOG_DEBUG, _("dictionary lookup: %s"), | 136 | mp->name)); |
137 | mp->name); | ||
138 | } | ||
139 | 137 | ||
140 | if (!dict->init_passed) { | 138 | if (!dict->init_passed) { |
141 | logmsg(LOG_CRIT, | 139 | wy_log(LOG_CRIT, |
142 | _("INTERNAL ERROR: " | 140 | _("INTERNAL ERROR: " |
143 | "dictionary %s \"%s\" not initialized"), | 141 | "dictionary %s \"%s\" not initialized"), |
144 | mp->name, SP(dict->query)); | 142 | mp->name, SP(dict->query)); |
145 | return 1; | 143 | return 1; |
146 | } | 144 | } |
147 | if (!mp->lookup) { | 145 | if (!mp->lookup) { |
148 | logmsg(LOG_CRIT, | 146 | wy_log(LOG_CRIT, |
149 | _("INTERNAL ERROR: " | 147 | _("INTERNAL ERROR: " |
150 | "no lookup function for dictionary %s \"%s\""), | 148 | "no lookup function for dictionary %s \"%s\""), |
151 | mp->name, SP(dict->query)); | 149 | mp->name, SP(dict->query)); |
diff --git a/src/directive.c b/src/directive.c index cc43c16..481e267 100644 --- a/src/directive.c +++ b/src/directive.c | |||
@@ -25,9 +25,8 @@ directive_parse(struct file_triplet *trp) | |||
25 | size_t dcount, i, j; | 25 | size_t dcount, i, j; |
26 | char *p; | 26 | char *p; |
27 | 27 | ||
28 | if (wy_debug_level > 2) | 28 | wy_debug(3, (_("%s: parsing directive blurb: %s"), |
29 | logmsg(LOG_DEBUG, _("%s: parsing directive blurb: %s"), | 29 | trp->file[file_directive].name, trp->blurb)); |
30 | trp->file[file_directive].name, trp->blurb); | ||
31 | 30 | ||
32 | dcount = 0; | 31 | dcount = 0; |
33 | for (p = trp->blurb; *p; p++) | 32 | for (p = trp->blurb; *p; p++) |
@@ -44,7 +43,7 @@ directive_parse(struct file_triplet *trp) | |||
44 | if (trim(trp->directive[j]) == 0) /* ignore empty lines */ | 43 | if (trim(trp->directive[j]) == 0) /* ignore empty lines */ |
45 | continue; | 44 | continue; |
46 | if (strchr(trp->directive[j], ':') == NULL) { | 45 | if (strchr(trp->directive[j], ':') == NULL) { |
47 | logmsg(LOG_ERR, _("%s: invalid line: %s"), | 46 | wy_log(LOG_ERR, _("%s: invalid line: %s"), |
48 | trp->file[file_directive].name, | 47 | trp->file[file_directive].name, |
49 | trp->directive[j]); | 48 | trp->directive[j]); |
50 | free(trp->directive); | 49 | free(trp->directive); |
@@ -174,17 +173,17 @@ directive_version_in_range_p(struct file_triplet *trp, | |||
174 | unsigned version; | 173 | unsigned version; |
175 | 174 | ||
176 | if (directive_get_value(trp, "version", &val)) { | 175 | if (directive_get_value(trp, "version", &val)) { |
177 | logmsg(LOG_ERR, _("%s: missing `version' directive"), | 176 | wy_log(LOG_ERR, _("%s: missing `version' directive"), |
178 | trp->file[file_directive].name); | 177 | trp->file[file_directive].name); |
179 | return 0; | 178 | return 0; |
180 | } | 179 | } |
181 | 180 | ||
182 | if (directive_pack_version(val, &version)) { | 181 | if (directive_pack_version(val, &version)) { |
183 | logmsg(LOG_ERR, _("%s: unparsable version: %s"), | 182 | wy_log(LOG_ERR, _("%s: unparsable version: %s"), |
184 | trp->file[file_directive].name, val); | 183 | trp->file[file_directive].name, val); |
185 | return 0; | 184 | return 0; |
186 | } | 185 | } |
187 | logmsg(LOG_NOTICE, _("%s: VERSION: %s"), | 186 | wy_log(LOG_NOTICE, _("%s: VERSION: %s"), |
188 | trp->file[file_directive].name, val); | 187 | trp->file[file_directive].name, val); |
189 | 188 | ||
190 | trp->version = version; | 189 | trp->version = version; |
@@ -192,7 +191,7 @@ directive_version_in_range_p(struct file_triplet *trp, | |||
192 | if (from <= version && version <= to) | 191 | if (from <= version && version <= to) |
193 | return 1; | 192 | return 1; |
194 | 193 | ||
195 | logmsg(LOG_ERR, _("%s: version %s is not in the allowed range"), | 194 | wy_log(LOG_ERR, _("%s: version %s is not in the allowed range"), |
196 | trp->file[file_directive].name, val); | 195 | trp->file[file_directive].name, val); |
197 | return 0; | 196 | return 0; |
198 | } | 197 | } |
@@ -257,7 +256,7 @@ verify_directive_format(struct file_triplet *trp) | |||
257 | switch (dnum) { | 256 | switch (dnum) { |
258 | case 1: | 257 | case 1: |
259 | if (strcmp(key, "version")) { | 258 | if (strcmp(key, "version")) { |
260 | logmsg(LOG_ERR, | 259 | wy_log(LOG_ERR, |
261 | _("%s:%d: expected `%s' but found `%s'"), | 260 | _("%s:%d: expected `%s' but found `%s'"), |
262 | trp->file[file_directive].name, n, | 261 | trp->file[file_directive].name, n, |
263 | "version", key); | 262 | "version", key); |
@@ -267,7 +266,7 @@ verify_directive_format(struct file_triplet *trp) | |||
267 | 266 | ||
268 | case 2: | 267 | case 2: |
269 | if (strcmp(key, "directory")) { | 268 | if (strcmp(key, "directory")) { |
270 | logmsg(LOG_ERR, | 269 | wy_log(LOG_ERR, |
271 | _("%s:%d: expected `%s' but found `%s'"), | 270 | _("%s:%d: expected `%s' but found `%s'"), |
272 | trp->file[file_directive].name, n, | 271 | trp->file[file_directive].name, n, |
273 | "directory", key); | 272 | "directory", key); |
@@ -277,7 +276,7 @@ verify_directive_format(struct file_triplet *trp) | |||
277 | 276 | ||
278 | default: | 277 | default: |
279 | if (find_directive(key) == unknown_dir) { | 278 | if (find_directive(key) == unknown_dir) { |
280 | logmsg(LOG_ERR, | 279 | wy_log(LOG_ERR, |
281 | _("%s:%d: unknown directive `%s'"), | 280 | _("%s:%d: unknown directive `%s'"), |
282 | trp->file[file_directive].name, n, key); | 281 | trp->file[file_directive].name, n, key); |
283 | return 1; | 282 | return 1; |
@@ -288,12 +287,12 @@ verify_directive_format(struct file_triplet *trp) | |||
288 | if (trp->file[file_dist].name && trp->file[file_signature].name) { | 287 | if (trp->file[file_dist].name &&a |