Mercurial > hg > nnchat
comparison nnchat.c @ 58:5455d078bedd
Misc. fixes.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 11 Nov 2008 21:29:37 +0200 |
parents | e93532b9dca1 |
children | d57a8acf92bf |
comparison
equal
deleted
inserted
replaced
57:e93532b9dca1 | 58:5455d078bedd |
---|---|
24 #define SET_MAX_HISTORY (16) | 24 #define SET_MAX_HISTORY (16) |
25 #define SET_BUFSIZE (4096) | 25 #define SET_BUFSIZE (4096) |
26 #define SET_ALLOC_SIZE (128) | 26 #define SET_ALLOC_SIZE (128) |
27 #define SET_DELAY (15) | 27 #define SET_DELAY (15) |
28 #define SET_DELAY_USEC (SET_DELAY * 1000) | 28 #define SET_DELAY_USEC (SET_DELAY * 1000) |
29 | |
30 | |
31 typedef struct { | |
32 char c; | |
33 char *ent; | |
34 } html_entity_t; | |
35 | |
36 | |
37 html_entity_t HTMLEntities[] = { | |
38 { '<', "<" }, | |
39 { '>', ">" }, | |
40 }; | |
41 | |
42 const int numHTMLEntities = (sizeof(HTMLEntities) / sizeof(HTMLEntities[0])); | |
29 | 43 |
30 | 44 |
31 /* Options | 45 /* Options |
32 */ | 46 */ |
33 int optPort = 8005; | 47 int optPort = 8005; |
464 | 478 |
465 while (*s) { | 479 while (*s) { |
466 if (*s == '½') { | 480 if (*s == '½') { |
467 s++; | 481 s++; |
468 if (*s == '½') { | 482 if (*s == '½') { |
483 fputc((unsigned char) *s, outFile); | |
469 s++; | 484 s++; |
470 } else { | 485 } else { |
471 while (*s && isdigit(*s)) s++; | 486 while (*s && isdigit(*s)) s++; |
472 if (*s != '½') return -1; | 487 if (*s != '½') return -1; |
473 s++; | 488 s++; |
474 } | 489 } |
475 } else { | 490 } else { |
476 fputc(*s, outFile); | 491 fputc((unsigned char) *s, outFile); |
477 s++; | 492 s++; |
478 } | 493 } |
479 } | 494 } |
480 | 495 |
481 return 0; | 496 return 0; |
794 | 809 |
795 return result; | 810 return result; |
796 } | 811 } |
797 | 812 |
798 | 813 |
799 typedef struct { | |
800 char c; | |
801 char *ent; | |
802 } html_entity_t; | |
803 | |
804 | |
805 html_entity_t HTMLEntities[] = { | |
806 { '<', "<" }, | |
807 { '>', ">" }, | |
808 }; | |
809 | |
810 const int numHTMLEntities = (sizeof(HTMLEntities) / sizeof(HTMLEntities[0])); | |
811 | |
812 | |
813 char *encodeStr2(char *str) | 814 char *encodeStr2(char *str) |
814 { | 815 { |
815 char *result, *s = str; | 816 char *result, *s = str; |
816 size_t resSize, resPos = 0; | 817 size_t resSize, resPos = 0; |
817 | 818 |