1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
|
diff -r a50076297212 src/IO/dpi.c
--- a/src/IO/dpi.c Fri Apr 26 16:42:23 2013 +0000
+++ b/src/IO/dpi.c Fri Apr 26 22:17:38 2013 +0000
@@ -356,9 +356,9 @@
if (execl(path1, "dpid", (char*)NULL) == -1) {
dFree(path1);
if (execlp("dpid", "dpid", (char*)NULL) == -1) {
- MSG("Dpi_start_dpid (child): %s\n", dStrerror(errno));
+ MSG_WARN("Dpi_start_dpid (child): %s\n", dStrerror(errno));
if (Dpi_blocking_write(st_pipe[1], "ERROR", 5) == -1) {
- MSG("Dpi_start_dpid (child): can't write to pipe.\n");
+ MSG_WARN("Dpi_start_dpid (child): can't write to pipe.\n");
}
dClose(st_pipe[1]);
_exit (EXIT_FAILURE);
@@ -367,7 +367,7 @@
}
} else if (pid < 0) {
/* The fork failed. Report failure. */
- MSG("Dpi_start_dpid: %s\n", dStrerror(errno));
+ MSG_WARN("Dpi_start_dpid: %s\n", dStrerror(errno));
/* close the unused pipe */
dClose(st_pipe[0]);
dClose(st_pipe[1]);
@@ -375,7 +375,7 @@
/* This is the parent process, check our child status... */
dClose(st_pipe[1]);
if ((answer = Dpi_blocking_read(st_pipe[0])) != NULL) {
- MSG("Dpi_start_dpid: can't start dpid\n");
+ MSG_WARN("Dpi_start_dpid: can't start dpid\n");
dFree(answer);
} else {
ret = 0;
@@ -449,9 +449,10 @@
if (Dpi_read_comm_keys(&dpid_port) != -1) {
sin.sin_port = htons(dpid_port);
if ((sock_fd = Dpi_make_socket_fd()) == -1) {
- MSG("Dpi_check_dpid_ids: sock_fd=%d %s\n", sock_fd, dStrerror(errno));
+ MSG_INFO("Dpi_check_dpid_ids: sock_fd=%d %s\n", sock_fd,
+ dStrerror(errno));
} else if (connect(sock_fd, (struct sockaddr *)&sin, sin_sz) == -1) {
- MSG("Dpi_check_dpid_ids: %s\n", dStrerror(errno));
+ MSG_INFO("Dpi_check_dpid_ids: %s\n", dStrerror(errno));
} else {
dClose(sock_fd);
ret = 1;
@@ -547,7 +548,7 @@
sin.sin_port = htons(dpid_port);
if ((sock_fd = Dpi_make_socket_fd()) == -1 ||
connect(sock_fd, (struct sockaddr *)&sin, sin_sz) == -1) {
- MSG("Dpi_get_server_port: %s\n", dStrerror(errno));
+ MSG_WARN("Dpi_get_server_port: %s\n", dStrerror(errno));
} else {
ok = 1;
}
@@ -559,7 +560,7 @@
_MSG("[%s]\n", request);
if (Dpi_blocking_write(sock_fd, request, strlen(request)) == -1) {
- MSG("Dpi_get_server_port: %s\n", dStrerror(errno));
+ MSG_WARN("Dpi_get_server_port: %s\n", dStrerror(errno));
} else {
ok = 1;
}
@@ -569,7 +570,7 @@
/* Get the reply */
ok = 0;
if ((rply = Dpi_blocking_read(sock_fd)) == NULL) {
- MSG("Dpi_get_server_port: can't read server port from dpid.\n");
+ MSG_WARN("Dpi_get_server_port: can't read server port from dpid.\n");
} else {
ok = 1;
}
@@ -622,7 +623,7 @@
if ((sock_fd = Dpi_make_socket_fd()) == -1) {
perror("[dpi::socket]");
} else if (connect(sock_fd, (void*)&sin, sizeof(sin)) == -1) {
- MSG("[dpi::connect] errno:%d %s\n", errno, dStrerror(errno));
+ MSG_WARN("[dpi::connect] errno:%d %s\n", errno, dStrerror(errno));
/* send authentication Key (the server closes sock_fd on auth error) */
} else if (!(cmd = a_Dpip_build_cmd("cmd=%s msg=%s", "auth", SharedKey))) {
diff -r a50076297212 src/IO/http.c
--- a/src/IO/http.c Fri Apr 26 16:42:23 2013 +0000
+++ b/src/IO/http.c Fri Apr 26 22:17:38 2013 +0000
@@ -393,7 +393,7 @@
for (i = 0; (dh = dList_nth_data(S->addr_list, i)); ++i) {
if ((S->SockFD = socket(dh->af, SOCK_STREAM, IPPROTO_TCP)) < 0) {
S->Err = errno;
- MSG("Http_connect_socket ERROR: %s\n", dStrerror(errno));
+ MSG_WARN("Http_connect_socket ERROR: %s\n", dStrerror(errno));
continue;
}
/* set NONBLOCKING and close on exec. */
@@ -438,7 +438,7 @@
if (status == -1 && errno != EINPROGRESS) {
S->Err = errno;
dClose(S->SockFD);
- MSG("Http_connect_socket ERROR: %s\n", dStrerror(S->Err));
+ MSG_WARN("Http_connect_socket ERROR: %s\n", dStrerror(S->Err));
} else {
a_Chain_bcb(OpSend, Info, &S->SockFD, "FD");
a_Chain_fcb(OpSend, Info, &S->SockFD, "FD");
diff -r a50076297212 src/auth.c
--- a/src/auth.c Fri Apr 26 16:42:23 2013 +0000
+++ b/src/auth.c Fri Apr 26 22:17:38 2013 +0000
@@ -180,7 +180,7 @@
token_size++;
}
if (token_size == 0) {
- MSG("Auth_parse_token_value: missing auth token\n");
+ MSG_WARN("Auth_parse_token_value: missing auth token\n");
return 0;
}
beyond_token = *auth;
@@ -195,11 +195,11 @@
break;
case '\0':
case ',':
- MSG("Auth_parse_token_value: missing auth token value\n");
+ MSG_WARN("Auth_parse_token_value: missing auth token value\n");
return 0;
break;
default:
- MSG("Auth_parse_token_value: garbage after auth token\n");
+ MSG_WARN("Auth_parse_token_value: garbage after auth token\n");
return 0;
break;
}
@@ -233,8 +233,8 @@
auth_parse->realm = strdup(value);
return 0; /* end parsing */
} else
- MSG("Auth_parse_basic_challenge_cb: Ignoring unknown parameter: %s = "
- "'%s'\n", token, value);
+ MSG_WARN("Auth_parse_basic_challenge_cb: Ignoring unknown parameter: "
+ "%s = '%s'\n", token, value);
return 1;
}
@@ -257,7 +257,7 @@
else if (dStrAsciiCasecmp("false", value) == 0)
auth_parse->stale = 0;
else {
- MSG("%s: Invalid stale value: %s\n", fn, value);
+ MSG_WARN("%s: Invalid stale value: %s\n", fn, value);
return 0;
}
} else if (strcmp("algorithm", token) == 0) {
@@ -265,11 +265,11 @@
auth_parse->algorithm = MD5;
else if (strcmp("MD5-sess", value) == 0) {
/* auth_parse->algorithm = MD5SESS; */
- MSG("%s: MD5-sess algorithm disabled (not tested because 'not "
- "correctly implemented yet' in Apache 2.2)\n", fn);
+ MSG_WARN("%s: MD5-sess algorithm disabled (not tested because 'not "
+ "correctly implemented yet' in Apache 2.2)\n", fn);
return 0;
} else {
- MSG("%s: Unknown algorithm: %s\n", fn, value);
+ MSG_WARN("%s: Unknown algorithm: %s\n", fn, value);
return 0;
}
} else if (strcmp("qop", token) == 0) {
@@ -282,10 +282,10 @@
if (len == 8 && strncmp("auth-int", value, 8) == 0) {
/* auth_parse->qop = AUTHINT; */
/* Keep searching; maybe we'll find an "auth" yet. */
- MSG("%s: auth-int qop disabled (not tested because 'not "
- "implemented yet' in Apache 2.2)\n", fn);
+ MSG_WARN("%s: auth-int qop disabled (not tested because 'not "
+ "implemented yet' in Apache 2.2)\n", fn);
} else {
- MSG("%s: Unknown qop value in %s\n", fn, value);
+ MSG_WARN("%s: Unknown qop value in %s\n", fn, value);
}
value += len;
while (*value == ' ' || *value == '\t')
@@ -296,7 +296,7 @@
value++;
}
} else {
- MSG("%s: Ignoring unknown parameter: %s = '%s'\n", fn, token, value);
+ MSG_WARN("%s: Ignoring unknown parameter: %s = '%s'\n", fn, token,value);
}
return 1;
}
@@ -322,14 +322,14 @@
if (auth_parse->realm) {
auth_parse->ok = 1;
} else {
- MSG("Auth_parse_challenge_args: missing Basic auth realm\n");
+ MSG_WARN("Auth_parse_challenge_args: missing Basic auth realm\n");
return;
}
} else if (auth_parse->type == DIGEST) {
if (auth_parse->realm && auth_parse->nonce) {
auth_parse->ok = 1;
} else {
- MSG("Auth_parse_challenge_args: Digest challenge incomplete\n");
+ MSG_WARN("Auth_parse_challenge_args: Digest challenge incomplete\n");
return;
}
}
@@ -481,7 +481,7 @@
else if (realm->type == DIGEST)
ret = a_Digest_authorization_hdr(realm, url, request_uri);
else
- MSG("a_Auth_get_auth_str() got an unknown realm type: %i.\n",
+ MSG_WARN("a_Auth_get_auth_str() got an unknown realm type: %i.\n",
realm->type);
}
return ret;
@@ -600,12 +600,12 @@
if (realm->qop != QOPNOTSET)
realm->cnonce = a_Digest_create_cnonce();
if (!a_Digest_compute_digest(realm, user, password)) {
- MSG("Auth_do_auth_dialog_cb: a_Digest_compute_digest failed.\n");
+ MSG_WARN("Auth_do_auth_dialog_cb: a_Digest_compute_digest failed.\n");
dList_remove_fast(host->realms, realm);
Auth_realm_delete(realm);
}
} else {
- MSG("Auth_do_auth_dialog_cb: Unknown auth type: %i\n",
+ MSG_WARN("Auth_do_auth_dialog_cb: Unknown auth type: %i\n",
realm->type);
}
dStrshred((char *)password);
diff -r a50076297212 src/bw.c
--- a/src/bw.c Fri Apr 26 16:42:23 2013 +0000
+++ b/src/bw.c Fri Apr 26 22:17:38 2013 +0000
@@ -231,7 +231,7 @@
if (len == 1)
doc = dList_nth_data(bw->Docs, 0);
else if (len > 1)
- MSG("a_Bw_get_current_doc() multiple docs not implemented\n");
+ MSG_WARN("a_Bw_get_current_doc() multiple docs not implemented\n");
return doc;
}
diff -r a50076297212 src/cache.c
--- a/src/cache.c Fri Apr 26 16:42:23 2013 +0000
+++ b/src/cache.c Fri Apr 26 22:17:38 2013 +0000
@@ -678,8 +678,8 @@
if (!a_Domain_permit(entry->Url, location_url)) {
/* don't redirect; just show body like usual (if any) */
- MSG("Redirection not followed from %s to %s\n",
- URL_HOST(entry->Url), URL_STR(location_url));
+ MSG_INFO("Redirection not followed from %s to %s\n",
+ URL_HOST(entry->Url), URL_STR(location_url));
a_Url_free(location_url);
} else {
entry->Flags |= CA_Redirect;
@@ -692,8 +692,8 @@
dStrAsciiCasecmp(URL_SCHEME(location_url), "dpi") == 0 &&
dStrAsciiCasecmp(URL_SCHEME(entry->Url), "dpi") != 0) {
/* Forbid dpi GET and POST from non dpi-generated urls */
- MSG("Redirection Denied! '%s' -> '%s'\n",
- URL_STR(entry->Url), URL_STR(location_url));
+ MSG_INFO("Redirection Denied! '%s' -> '%s'\n",
+ URL_STR(entry->Url), URL_STR(location_url));
a_Url_free(location_url);
} else {
entry->Location = location_url;
@@ -760,7 +760,8 @@
}
}
if (i >= dList_length(ClientQueue)) {
- MSG("Cache: cookies not accepted from '%s'\n", URL_STR(entry->Url));
+ MSG_INFO("Cache: cookies not accepted from '%s'\n",
+ URL_STR(entry->Url));
}
for (i = 0; (data = dList_nth_data(Cookies, i)); ++i)
@@ -907,8 +908,8 @@
(entry->ExpectedSize != entry->TransferSize)) {
MSG_HTTP("Content-Length does NOT match message body at\n"
"%s\n", URL_STR_(entry->Url));
- MSG("Expected size: %d, Transfer size: %d\n",
- entry->ExpectedSize, entry->TransferSize);
+ MSG_WARN("Expected size: %d, Transfer size: %d\n",
+ entry->ExpectedSize, entry->TransferSize);
}
if (!entry->TransferSize && !(entry->Flags & CA_Redirect) &&
(entry->Flags & WEB_RootUrl)) {
@@ -939,7 +940,7 @@
}
} else if (Op == IOAbort) {
/* unused */
- MSG("a_Cache_process_dbuf Op = IOAbort; not implemented!\n");
+ MSG_WARN("a_Cache_process_dbuf Op = IOAbort; not implemented!\n");
}
}
@@ -1181,7 +1182,7 @@
if (st == -1) {
/* MIME type is not viewable */
if (ClientWeb->flags & WEB_RootUrl) {
- MSG("Content-Type '%s' not viewable.\n", curr_type);
+ MSG_WARN("Content-Type '%s' not viewable.\n", curr_type);
/* prepare a download offer... */
AbortEntry = OfferDownload = TRUE;
} else {
diff -r a50076297212 src/capi.c
--- a/src/capi.c Fri Apr 26 16:42:23 2013 +0000
+++ b/src/capi.c Fri Apr 26 22:17:38 2013 +0000
@@ -250,10 +250,10 @@
}
if (!allow) {
- MSG("a_Capi_dpi_verify_request: Permission Denied!\n");
- MSG(" URL_STR : %s\n", URL_STR(url));
+ MSG_INFO("a_Capi_dpi_verify_request: Permission Denied!\n");
+ MSG_INFO(" URL_STR : %s\n", URL_STR(url));
if (URL_FLAGS(url) & URL_Post) {
- MSG(" URL_DATA: %s\n", dStr_printable(URL_DATA(url), 1024));
+ MSG_INFO(" URL_DATA: %s\n", dStr_printable(URL_DATA(url), 1024));
}
}
return allow;
@@ -576,7 +576,7 @@
a_Capi_ccc(OpSend, 1, BCK, conn->InfoSend, dbuf, NULL);
dFree(dbuf);
} else {
- MSG(" ERROR: [a_Capi_dpi_send_data] No open connection found\n");
+ MSG_ERR("[a_Capi_dpi_send_data] No open connection found\n");
}
}
diff -r a50076297212 src/cookies.c
--- a/src/cookies.c Fri Apr 26 16:42:23 2013 +0000
+++ b/src/cookies.c Fri Apr 26 22:17:38 2013 +0000
@@ -86,16 +86,16 @@
if (init_str) {
rc = write(fd, init_str, strlen(init_str));
if (rc == -1) {
- MSG("Cookies: Could not write initial string to file %s: %s\n",
- filename, dStrerror(errno));
+ MSG_WARN("Cookies: Could not write initial string to file %s: "
+ "%s\n", filename, dStrerror(errno));
}
}
dClose(fd);
- MSG("Cookies: Created file: %s\n", filename);
+ MSG_INFO("Cookies: Created file: %s\n", filename);
F_in = fopen(filename, "r");
} else {
- MSG("Cookies: Could not create file: %s!\n", filename);
+ MSG_WARN("Cookies: Could not create file: %s!\n", filename);
}
}
@@ -258,8 +258,8 @@
line[0] = '\0';
rc = fgets(line, LINE_MAXLEN, stream);
if (!rc && ferror(stream)) {
- MSG("Cookies1: Error while reading rule from cookiesrc: %s\n",
- dStrerror(errno));
+ MSG_WARN("Cookies1: Error while reading rule from cookiesrc: %s\n",
+ dStrerror(errno));
fclose(stream);
return 2; /* bail out */
}
@@ -292,8 +292,8 @@
else if (dStrAsciiCasecmp(rule, "DENY") == 0)
cc.action = COOKIE_DENY;
else {
- MSG("Cookies: rule '%s' for domain '%s' is not recognised.\n",
- rule, domain);
+ MSG_WARN("Cookies: rule '%s' for domain '%s' is not recognised.\n",
+ rule, domain);
continue;
}
diff -r a50076297212 src/css.cc
--- a/src/css.cc Fri Apr 26 16:42:23 2013 +0000
+++ b/src/css.cc Fri Apr 26 22:17:38 2013 +0000
@@ -539,7 +539,8 @@
if ((order == CSS_PRIMARY_AUTHOR ||
order == CSS_PRIMARY_AUTHOR_IMPORTANT) &&
!rule->isSafe ()) {
- MSG_WARN ("Ignoring unsafe author style that might reveal browsing history\n");
+ MSG_INFO("Ignoring unsafe author style that might reveal browsing "
+ "history\n");
delete rule;
} else {
sheet[order].addRule (rule);
diff -r a50076297212 src/cssparser.cc
--- a/src/cssparser.cc Fri Apr 26 16:42:23 2013 +0000
+++ b/src/cssparser.cc Fri Apr 26 22:17:38 2013 +0000
@@ -28,7 +28,7 @@
using namespace dw::core::style;
#define DEBUG_MSG(A, B, ...) _MSG(B, __VA_ARGS__)
-#define MSG_CSS(A, ...) MSG(A, __VA_ARGS__)
+#define MSG_CSS(A, ...) MSG_WARN(A, __VA_ARGS__)
#define DEBUG_TOKEN_LEVEL 0
#define DEBUG_PARSE_LEVEL 0
#define DEBUG_CREATE_LEVEL 0
diff -r a50076297212 src/decode.c
--- a/src/decode.c Fri Apr 26 16:42:23 2013 +0000
+++ b/src/decode.c Fri Apr 26 22:17:38 2013 +0000
@@ -116,7 +116,7 @@
zs->total_out = 0;
zs->total_in = 0;
} else if (rc == Z_DATA_ERROR) {
- MSG_ERR("gzip decompression error\n");
+ MSG_WARN("gzip decompression error\n");
}
}
return output;
@@ -235,7 +235,7 @@
dc->free = Decode_gzip_free;
dc->leftover = NULL; /* not used */
} else {
- MSG("Content-Encoding '%s' not recognized.\n", format);
+ MSG_WARN("Content-Encoding '%s' not recognized.\n", format);
}
}
return dc;
diff -r a50076297212 src/dicache.c
--- a/src/dicache.c Fri Apr 26 16:42:23 2013 +0000
+++ b/src/dicache.c Fri Apr 26 22:17:38 2013 +0000
@@ -323,7 +323,7 @@
DicEntry = a_Dicache_get_entry(url, version);
dReturn_if_fail ( DicEntry != NULL );
if (DicEntry->State < DIC_SetParms) {
- MSG("a_Dicache_new_scan before DIC_SetParms\n");
+ MSG_ERR("a_Dicache_new_scan before DIC_SetParms\n");
exit(1);
}
a_Bitvec_clear(DicEntry->BitVec);
diff -r a50076297212 src/digest.c
--- a/src/digest.c Fri Apr 26 16:42:23 2013 +0000
+++ b/src/digest.c Fri Apr 26 22:17:38 2013 +0000
@@ -74,7 +74,7 @@
dStr_free(a0, 1);
dStr_free(ha0, 1);
} else {
- MSG("a_Digest_create_auth: Unknown algorithm.\n");
+ MSG_WARN("a_Digest_create_auth: Unknown algorithm.\n");
return 0;
}
@@ -111,7 +111,7 @@
dStr_free(hentity, 1);
dStr_free(a2, 1);
} else {
- MSG("a_Digest_create_auth: Unknown qop value.\n");
+ MSG_WARN("a_Digest_create_auth: Unknown qop value.\n");
return NULL;
}
result = dStr_new(NULL);
diff -r a50076297212 src/dns.c
--- a/src/dns.c Fri Apr 26 16:42:23 2013 +0000
+++ b/src/dns.c Fri Apr 26 22:17:38 2013 +0000
@@ -300,16 +300,16 @@
if (error != 0) {
dns_server[channel].status = error;
if (error == EAI_NONAME)
- MSG("DNS error: HOST_NOT_FOUND\n");
+ MSG_INFO("DNS error: HOST_NOT_FOUND\n");
else if (error == EAI_AGAIN)
- MSG("DNS error: TRY_AGAIN\n");
+ MSG_INFO("DNS error: TRY_AGAIN\n");
#ifdef EAI_NODATA
/* Some FreeBSD don't have this anymore */
else if (error == EAI_NODATA)
- MSG("DNS error: NO_ADDRESS\n");
+ MSG_INFO("DNS error: NO_ADDRESS\n");
#endif
else if (h_errno == EAI_FAIL)
- MSG("DNS error: NO_RECOVERY\n");
+ MSG_WARN("DNS error: NO_RECOVERY\n");
} else {
Dns_note_hosts(hosts, res0);
dns_server[channel].status = 0;
diff -r a50076297212 src/domain.c
--- a/src/domain.c Fri Apr 26 16:42:23 2013 +0000
+++ b/src/domain.c Fri Apr 26 22:17:38 2013 +0000
@@ -47,11 +47,11 @@
char *tok2 = strtok(NULL, delim);
if (strtok(NULL, delim) != NULL) {
- MSG("Domain: Ignoring extraneous text at end of line %u.\n",
+ MSG_WARN("Domain: Ignoring extraneous text at end of line %u.\n",
lineno);
}
if (!tok2) {
- MSG("Domain: Not enough fields in line %u.\n", lineno);
+ MSG_WARN("Domain: Not enough fields in line %u.\n", lineno);
} else {
if (dStrAsciiCasecmp(tok1, "default") == 0) {
if (dStrAsciiCasecmp(tok2, "deny") == 0) {
@@ -61,7 +61,8 @@
default_deny = FALSE;
MSG("Domain: Default accept.\n");
} else {
- MSG("Domain: Default action \"%s\" not recognised.\n", tok2);
+ MSG_WARN("Domain: Default action \"%s\" not recognised.\n",
+ tok2);
}
} else {
a_List_add(exceptions, num_exceptions, num_exceptions_max);
@@ -145,7 +146,7 @@
}
if (ret == FALSE)
- MSG("Domain: DENIED from %s to %s.\n", source_host, dest_host);
+ MSG_INFO("Domain: DENIED from %s to %s.\n", source_host, dest_host);
return ret;
}
diff -r a50076297212 src/form.cc
--- a/src/form.cc Fri Apr 26 16:42:23 2013 +0000
+++ b/src/form.cc Fri Apr 26 22:17:38 2013 +0000
@@ -507,13 +507,14 @@
if (form->method != DILLO_HTML_METHOD_POST) {
valid = false;
BUG_MSG("Forms with file input MUST use HTTP POST method\n");
- MSG("File input ignored in form not using HTTP POST method\n");
+ MSG_INFO("File input ignored in form not using HTTP POST "
+ "method\n");
} else if (form->content_type != DILLO_HTML_ENC_MULTIPART) {
valid = false;
BUG_MSG("Forms with file input MUST use multipart/form-data"
" encoding\n");
- MSG("File input ignored in form not using multipart/form-data"
- " encoding\n");
+ MSG_INFO("File input ignored in form not using multipart/form-data"
+ " encoding\n");
}
}
if (valid) {
@@ -588,7 +589,7 @@
const char *attrbuf;
if (html->InFlags & IN_FORM) {
- MSG("<isindex> inside <form> not handled.\n");
+ MSG_WARN("<isindex> inside <form> not handled.\n");
return;
}
@@ -1040,7 +1041,7 @@
if (input) {
input->activate (this, num_entry_fields, event);
} else {
- MSG("DilloHtmlForm::eventHandler: ERROR, input not found!\n");
+ MSG_ERR("DilloHtmlForm::eventHandler: input not found!\n");
}
}
}
@@ -1120,7 +1121,7 @@
dFree(action_str);
}
} else {
- MSG("DilloHtmlForm::buildQueryUrl: Method unknown\n");
+ MSG_ERR("DilloHtmlForm::buildQueryUrl: Method unknown\n");
}
return new_url;
@@ -1811,7 +1812,7 @@
dStr_append_l(file, file_data->str, file_data->len);
dList_append(values, file);
} else {
- MSG("FORM file input \"%s\" not loaded.\n", filename);
+ MSG_WARN("FORM file input \"%s\" not loaded.\n", filename);
}
}
}
@@ -2031,7 +2032,7 @@
HT2TB(html)->addWidget (button, html->styleEngine->style ());
}
if (!button)
- MSG("Html_input_image: unable to create image submit.\n");
+ MSG_WARN("Html_input_image: unable to create image submit.\n");
return button;
}
diff -r a50076297212 src/gif.c
--- a/src/gif.c Fri Apr 26 16:42:23 2013 +0000
+++ b/src/gif.c Fri Apr 26 22:17:38 2013 +0000
@@ -681,7 +681,7 @@
case 2: /* End code... consume remaining data chunks..? */
goto error; /* Could clean up better? */
default:
- MSG("Gif_decode: error!\n");
+ MSG_WARN("Gif_decode: error!\n");
goto error;
}
}
@@ -808,8 +808,8 @@
/* check max image size */
if (gif->Width <= 0 || gif->Height <= 0 ||
gif->Width > IMAGE_MAX_AREA / gif->Height) {
- MSG("Gif_do_img_desc: suspicious image size request %u x %u\n",
- gif->Width, gif->Height);
+ MSG_WARN("Gif_do_img_desc: suspicious image size request %u x %u\n",
+ gif->Width, gif->Height);
gif->state = 999;
return 0;
}
@@ -935,7 +935,7 @@
default: /* Unknown */
/* gripe and complain */
- MSG ("gif.c::GIF_Block: Error, 0x%x found\n", *(buf-1));
+ MSG_WARN ("gif.c::GIF_Block: Error, 0x%x found\n", *(buf-1));
gif->state = 999;
return Size + 1;
}
diff -r a50076297212 src/html.cc
--- a/src/html.cc Fri Apr 26 16:42:23 2013 +0000
+++ b/src/html.cc Fri Apr 26 22:17:38 2013 +0000
@@ -2003,7 +2003,8 @@
dFree(width_ptr);
dFree(height_ptr);
width_ptr = height_ptr = NULL;
- MSG("a_Html_image_attrs: suspicious image size request %d x %d\n", w, h);
+ MSG_WARN("a_Html_image_attrs: suspicious image size request %d x %d\n",
+ w, h);
} else {
if (CSS_LENGTH_TYPE(l_w) != CSS_LENGTH_TYPE_AUTO)
html->styleEngine->setNonCssHint (CSS_PROPERTY_WIDTH,
diff -r a50076297212 src/jpeg.c
--- a/src/jpeg.c Fri Apr 26 16:42:23 2013 +0000
+++ b/src/jpeg.c Fri Apr 26 22:17:38 2013 +0000
@@ -292,9 +292,9 @@
if (jpeg->cinfo.image_width <= 0 || jpeg->cinfo.image_height <= 0 ||
jpeg->cinfo.image_width >
IMAGE_MAX_AREA / jpeg->cinfo.image_height) {
- MSG("Jpeg_write: suspicious image size request %u x %u\n",
- (uint_t)jpeg->cinfo.image_width,
- (uint_t)jpeg->cinfo.image_height);
+ MSG_WARN("Jpeg_write: suspicious image size request %u x %u\n",
+ (uint_t)jpeg->cinfo.image_width,
+ (uint_t)jpeg->cinfo.image_height);
jpeg->state = DILLO_JPEG_ERROR;
return;
}
diff -r a50076297212 src/keys.cc
--- a/src/keys.cc Fri Apr 26 16:42:23 2013 +0000
+++ b/src/keys.cc Fri Apr 26 22:17:38 2013 +0000
@@ -315,7 +315,7 @@
// Get command code
if ((symcode = getCmdCode(commandName)) == KEYS_INVALID) {
- MSG("Keys::parseKey: Invalid command name: '%s'\n", commandName);
+ MSG_WARN("Keys::parseKey: Invalid command name: '%s'\n", commandName);
return;
}
@@ -326,7 +326,7 @@
++key;
modstr = dStrndup(key, p - key);
if ((st = getModifier(modstr)) == -1) {
- MSG("Keys::parseKey unknown modifier: %s\n", modstr);
+ MSG_WARN("Keys::parseKey unknown modifier: %s\n", modstr);
} else {
keymod |= st;
}
@@ -346,7 +346,7 @@
/* keysym */
keycode = strtol(key, NULL, 0x10);
} else if ((st = getKeyCode(keystr)) == -1) {
- MSG("Keys::parseKey unknown keyname: %s\n", keystr);
+ MSG_WARN("Keys::parseKey unknown keyname: %s\n", keystr);
} else {
keycode = st;
}
@@ -383,8 +383,8 @@
_MSG("Keys::parse: keycomb=%s, command=%s\n", keycomb, command);
parseKey(keycomb, command);
} else if (st < 0) {
- MSG("Keys::parse: Syntax error in keysrc line %d: "
- "keycomb=\"%s\" command=\"%s\"\n", lineno, keycomb, command);
+ MSG_WARN("Keys::parse: Syntax error in keysrc line %d: "
+ "keycomb=\"%s\" command=\"%s\"\n", lineno, keycomb, command);
}
dFree(line);
diff -r a50076297212 src/misc.c
--- a/src/misc.c Fri Apr 26 16:42:23 2013 +0000
+++ b/src/misc.c Fri Apr 26 22:17:38 2013 +0000
@@ -413,7 +413,7 @@
}
*label = buf;
if (ret == -1)
- MSG("Invalid search_url: \"%s\"\n", source);
+ MSG_WARN("Invalid search_url: \"%s\"\n", source);
return ret;
}
diff -r a50076297212 src/msg.h
--- a/src/msg.h Fri Apr 26 16:42:23 2013 +0000
+++ b/src/msg.h Fri Apr 26 22:17:38 2013 +0000
@@ -8,20 +8,22 @@
* You can disable any MSG* macro by adding the '_' prefix.
*/
#define _MSG(...)
+#define _MSG_INFO(...)
#define _MSG_WARN(...)
#define _MSG_HTTP(...)
-#define MSG_INNARDS(prefix, ...) \
- D_STMT_START { \
- if (prefs.show_msg){ \
- printf(prefix __VA_ARGS__); \
- fflush (stdout); \
- } \
+#define MSG_INNARDS(level, prefix, ...) \
+ D_STMT_START { \
+ if (prefs.show_msg && level >= prefs.msg_level_min){ \
+ printf(prefix __VA_ARGS__); \
+ fflush (stdout); \
+ } \
} D_STMT_END
-#define MSG(...) MSG_INNARDS("", __VA_ARGS__)
-#define MSG_WARN(...) MSG_INNARDS("** WARNING **: ", __VA_ARGS__)
-#define MSG_ERR(...) MSG_INNARDS("** ERROR **: ", __VA_ARGS__)
-#define MSG_HTTP(...) MSG_INNARDS("HTTP warning: ", __VA_ARGS__)
+#define MSG(...) MSG_INNARDS(1, "", __VA_ARGS__)
+#define MSG_INFO(...) MSG_INNARDS(2, "", __VA_ARGS__)
+#define MSG_WARN(...) MSG_INNARDS(3, "** WARNING **: ", __VA_ARGS__)
+#define MSG_ERR(...) MSG_INNARDS(4, "** ERROR **: ", __VA_ARGS__)
+#define MSG_HTTP(...) MSG_INNARDS(3, "HTTP warning: ", __VA_ARGS__)
#endif /* __MSG_H__ */
diff -r a50076297212 src/paths.cc
--- a/src/paths.cc Fri Apr 26 16:42:23 2013 +0000
+++ b/src/paths.cc Fri Apr 26 22:17:38 2013 +0000
@@ -38,20 +38,20 @@
oldWorkingDir = dGetcwd();
rc = chdir("/tmp");
if (rc == -1) {
- MSG("paths: error changing directory to /tmp: %s\n",
- dStrerror(errno));
+ MSG_WARN("paths: error changing directory to /tmp: %s\n",
+ dStrerror(errno));
}
path = dStrconcat(dGethomedir(), "/.dillo", NULL);
if (stat(path, &st) == -1) {
if (errno == ENOENT) {
- MSG("paths: creating directory %s.\n", path);
+ MSG_INFO("paths: creating directory %s.\n", path);
if (mkdir(path, 0700) < 0) {
- MSG("paths: error creating directory %s: %s\n",
- path, dStrerror(errno));
+ MSG_WARN("paths: error creating directory %s: %s\n",
+ path, dStrerror(errno));
}
} else {
- MSG("Dillo: error reading %s: %s\n", path, dStrerror(errno));
+ MSG_WARN("Dillo: error reading %s: %s\n", path, dStrerror(errno));
}
}
@@ -83,14 +83,14 @@
char *path = dStrconcat(dGethomedir(), "/.dillo/", rcFile, NULL);
if (!(fp = fopen(path, "r"))) {
- MSG("paths: Cannot open file '%s': %s\n", path, dStrerror(errno));
+ MSG_INFO("paths: Cannot open file '%s': %s\n", path, dStrerror(errno));
char *path2 = dStrconcat(DILLO_SYSCONF, rcFile, NULL);
if (!(fp = fopen(path2, "r"))) {
- MSG("paths: Cannot open file '%s': %s\n", path2, dStrerror(errno));
- MSG("paths: Using internal defaults...\n");
+ MSG_INFO("paths: Cannot open file '%s': %s\n",path2,dStrerror(errno));
+ MSG_INFO("paths: Using internal defaults...\n");
} else {
- MSG("paths: Using %s\n", path2);
+ MSG_INFO("paths: Using %s\n", path2);
}
dFree(path2);
}
diff -r a50076297212 src/png.c
--- a/src/png.c Fri Apr 26 16:42:23 2013 +0000
+++ b/src/png.c Fri Apr 26 22:17:38 2013 +0000
@@ -102,7 +102,7 @@
{
DilloPng *png;
- MSG("Png_error_handling: %s\n", msg);
+ MSG_WARN("Png_error_handling: %s\n", msg);
png = png_get_error_ptr(png_ptr);
png->error = 1;
@@ -132,8 +132,8 @@
/* check max image size */
if (png->width == 0 || png->height == 0 ||
png->width > IMAGE_MAX_AREA / png->height) {
- MSG("Png_datainfo_callback: suspicious image size request %lu x %lu\n",
- (ulong_t) png->width, (ulong_t) png->height);
+ MSG_WARN("Png_datainfo_callback: suspicious image size request "
+ "%lu x %lu\n", (ulong_t) png->width, (ulong_t) png->height);
Png_error_handling(png_ptr, "Aborting...");
return; /* not reached */
}
@@ -272,8 +272,8 @@
break;
}
default:
- MSG("Png_datarow_callback: unexpected number of channels=%d pass=%d\n",
- png->channels, pass);
+ MSG_ERR("Png_datarow_callback: unexpected number of channels=%d "
+ "pass=%d\n", png->channels, pass);
abort();
}
}
@@ -284,7 +284,7 @@
_MSG("Png_dataend_callback:\n");
if (!info_ptr)
- MSG("Png_dataend_callback: info_ptr = NULL\n");
+ MSG_WARN("Png_dataend_callback: info_ptr = NULL\n");
png = png_get_progressive_ptr(png_ptr);
png->state = IS_finished;
diff -r a50076297212 src/prefs.c
--- a/src/prefs.c Fri Apr 26 16:42:23 2013 +0000
+++ b/src/prefs.c Fri Apr 26 22:17:38 2013 +0000
@@ -68,6 +68,7 @@
prefs.limit_text_width = FALSE;
prefs.load_images=TRUE;
prefs.load_stylesheets=TRUE;
+ prefs.msg_level_min = 2;
prefs.middle_click_drags_page = TRUE;
prefs.middle_click_opens_new_tab = TRUE;
prefs.right_click_closes_tab = FALSE;
diff -r a50076297212 src/prefs.h
--- a/src/prefs.h Fri Apr 26 16:42:23 2013 +0000
+++ b/src/prefs.h Fri Apr 26 22:17:38 2013 +0000
@@ -99,6 +99,7 @@
bool_t search_url_idx;
Dlist *search_urls;
char *save_dir;
+ int msg_level_min;
bool_t show_msg;
bool_t show_extra_warnings;
bool_t middle_click_drags_page;
diff -r a50076297212 src/prefsparser.cc
--- a/src/prefsparser.cc Fri Apr 26 16:42:23 2013 +0000
+++ b/src/prefsparser.cc Fri Apr 26 22:17:38 2013 +0000
@@ -83,6 +83,7 @@
PREFS_BOOL },
{ "middle_click_opens_new_tab", &prefs.middle_click_opens_new_tab,
PREFS_BOOL },
+ { "msg_level_min", &prefs.msg_level_min, PREFS_INT32 },
{ "right_click_closes_tab", &prefs.right_click_closes_tab, PREFS_BOOL },
{ "no_proxy", &prefs.no_proxy, PREFS_STRING },
{ "panel_size", &prefs.panel_size, PREFS_PANEL_SIZE },
@@ -139,7 +140,7 @@
}
if (!node) {
- MSG("prefs: {%s} is not a recognized token.\n", name);
+ MSG_WARN("prefs: {%s} is not a recognized token.\n", name);
return -1;
}
@@ -151,7 +152,7 @@
case PREFS_COLOR:
*(int32_t *)node->pref = a_Color_parse(value, *(int32_t*)node->pref,&st);
if (st == 1)
- MSG("prefs: Color '%s' not recognized.\n", value);
+ MSG_WARN("prefs: Color '%s' not recognized.\n", value);
break;
case PREFS_STRING:
dFree(*(char **)node->pref);
@@ -232,8 +233,8 @@
_MSG("prefsparser: name=%s, value=%s\n", name, value);
parseOption(name, value);
} else if (st < 0) {
- MSG_ERR("prefsparser: Syntax error in dillorc:"
- " name=\"%s\" value=\"%s\"\n", name, value);
+ MSG_WARN("prefsparser: Syntax error in dillorc:"
+ " name=\"%s\" value=\"%s\"\n", name, value);
}
dFree(line);
diff -r a50076297212 src/ui.cc
--- a/src/ui.cc Fri Apr 26 16:42:23 2013 +0000
+++ b/src/ui.cc Fri Apr 26 22:17:38 2013 +0000
@@ -243,8 +243,8 @@
a_UIcmd_open_urlstr(bw, urlstr);
dFree(urlstr);
} else {
- MSG("Can't read local help file at \"%s\"."
- " Getting remote help...\n", path);
+ MSG_INFO("Can't read local help file at \"%s\"."
+ " Getting remote help...\n", path);
a_UIcmd_open_urlstr(bw, "http://www.dillo.org/dillo3-help.html");
}
dFree(path);
|