From 2cd8e80bfe2792ce8999a26b34384598f58e3889 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Tue, 27 Apr 2004 20:26:05 -0400 Subject: snapshot of project "lynx", label v2-8-6dev_2 --- WWW/Library/Implementation/HTNews.c | 168 ++++++++++++++++++------------------ 1 file changed, 84 insertions(+), 84 deletions(-) (limited to 'WWW/Library/Implementation/HTNews.c') diff --git a/WWW/Library/Implementation/HTNews.c b/WWW/Library/Implementation/HTNews.c index 651e66ad..e214596e 100644 --- a/WWW/Library/Implementation/HTNews.c +++ b/WWW/Library/Implementation/HTNews.c @@ -25,8 +25,8 @@ #define NEWS_PORT 119 /* See rfc977 */ #define SNEWS_PORT 563 /* See Lou Montulli */ #define APPEND /* Use append methods */ -PUBLIC int HTNewsChunkSize = 30;/* Number of articles for quick display */ -PUBLIC int HTNewsMaxChunk = 40; /* Largest number of articles in one window */ +int HTNewsChunkSize = 30;/* Number of articles for quick display */ +int HTNewsMaxChunk = 40; /* Largest number of articles in one window */ #ifndef DEFAULT_NEWS_HOST #define DEFAULT_NEWS_HOST "news" @@ -37,13 +37,13 @@ PUBLIC int HTNewsMaxChunk = 40; /* Largest number of articles in one window */ #ifdef USE_SSL extern SSL_CTX * ssl_ctx; -PRIVATE SSL * Handle = NULL; -PRIVATE int channel_s = 1; +static SSL * Handle = NULL; +static int channel_s = 1; #define NEWS_NETWRITE(sock, buff, size) \ (Handle ? SSL_write(Handle, buff, size) : NETWRITE(sock, buff, size)) #define NEWS_NETCLOSE(sock) \ { (void)NETCLOSE(sock); if (Handle) SSL_free(Handle); Handle = NULL; } -PRIVATE char HTNewsGetCharacter NOPARAMS; +static char HTNewsGetCharacter (void); #define NEXT_CHAR HTNewsGetCharacter() #else #define NEWS_NETWRITE NETWRITE @@ -65,7 +65,7 @@ PRIVATE char HTNewsGetCharacter NOPARAMS; #define SnipIn2(d,fmt,tag,len,s) sprintf(d, fmt, tag, (int)sizeof(d)-len, s) struct _HTStructured { - CONST HTStructuredClass * isa; + const HTStructuredClass * isa; /* ... */ }; struct _HTStream @@ -79,24 +79,24 @@ struct _HTStream /* ** Module-wide variables. */ -PUBLIC char * HTNewsHost = NULL; /* Default host */ -PRIVATE char * NewsHost = NULL; /* Current host */ -PRIVATE char * NewsHREF = NULL; /* Current HREF prefix */ -PRIVATE int s; /* Socket for NewsHost */ -PRIVATE int HTCanPost = FALSE; /* Current POST permission */ -PRIVATE char response_text[LINE_LENGTH+1]; /* Last response */ -/* PRIVATE HText * HT; */ /* the new hypertext */ -PRIVATE HTStructured * target; /* The output sink */ -PRIVATE HTStructuredClass targetClass; /* Copy of fn addresses */ -PRIVATE HTStream * rawtarget = NULL; /* The output sink for rawtext */ -PRIVATE HTStreamClass rawtargetClass; /* Copy of fn addresses */ -PRIVATE HTParentAnchor *node_anchor; /* Its anchor */ -PRIVATE int diagnostic; /* level: 0=none 2=source */ -PRIVATE BOOL rawtext = NO; /* Flag: HEAD or -mime_headers */ -PRIVATE HTList *NNTP_AuthInfo = NULL; /* AUTHINFO database */ -PRIVATE char *name = NULL; -PRIVATE char *address = NULL; -PRIVATE char *dbuf = NULL; /* dynamic buffer for long messages etc. */ +char * HTNewsHost = NULL; /* Default host */ +static char * NewsHost = NULL; /* Current host */ +static char * NewsHREF = NULL; /* Current HREF prefix */ +static int s; /* Socket for NewsHost */ +static int HTCanPost = FALSE; /* Current POST permission */ +static char response_text[LINE_LENGTH+1]; /* Last response */ +/* static HText * HT; */ /* the new hypertext */ +static HTStructured * target; /* The output sink */ +static HTStructuredClass targetClass; /* Copy of fn addresses */ +static HTStream * rawtarget = NULL; /* The output sink for rawtext */ +static HTStreamClass rawtargetClass; /* Copy of fn addresses */ +static HTParentAnchor *node_anchor; /* Its anchor */ +static int diagnostic; /* level: 0=none 2=source */ +static BOOL rawtext = NO; /* Flag: HEAD or -mime_headers */ +static HTList *NNTP_AuthInfo = NULL; /* AUTHINFO database */ +static char *name = NULL; +static char *address = NULL; +static char *dbuf = NULL; /* dynamic buffer for long messages etc. */ #define PUTC(c) (*targetClass.put_character)(target, c) #define PUTS(s) (*targetClass.put_string)(target, s) @@ -117,7 +117,7 @@ typedef struct _NNTPAuth { } NNTPAuth; #ifdef LY_FIND_LEAKS -PRIVATE void free_news_globals NOARGS +static void free_news_globals (void) { if (s >= 0) { NEWS_NETCLOSE(s); @@ -132,7 +132,7 @@ PRIVATE void free_news_globals NOARGS } #endif /* LY_FIND_LEAKS */ -PRIVATE void free_NNTP_AuthInfo NOARGS +static void free_NNTP_AuthInfo (void) { HTList *cur = NNTP_AuthInfo; NNTPAuth *auth = NULL; @@ -151,12 +151,12 @@ PRIVATE void free_NNTP_AuthInfo NOARGS return; } -PUBLIC CONST char * HTGetNewsHost NOARGS +const char * HTGetNewsHost (void) { return HTNewsHost; } -PUBLIC void HTSetNewsHost ARGS1(CONST char *, value) +void HTSetNewsHost (const char * value) { StrAllocCopy(HTNewsHost, value); } @@ -179,8 +179,8 @@ PUBLIC void HTSetNewsHost ARGS1(CONST char *, value) ** 4. Compilation time macro DEFAULT_NEWS_HOST ** 5. Default to "news" */ -PRIVATE BOOL initialized = NO; -PRIVATE BOOL initialize NOARGS +static BOOL initialized = NO; +static BOOL initialize (void) { #ifdef NeXTStep char *cp = NULL; @@ -240,7 +240,7 @@ PRIVATE BOOL initialize NOARGS ** Negative status indicates transmission error, socket closed. ** Positive status is an NNTP status. */ -PRIVATE int response ARGS1(char *,command) +static int response (char * command) { int result; char * p = response_text; @@ -252,7 +252,7 @@ PRIVATE int response ARGS1(char *,command) CTRACE((tfp, "NNTP command to be sent: %s", command)); #ifdef NOT_ASCII { - CONST char * p; + const char * p; char * q; char ascii[LINE_LENGTH+1]; for(p = command, q=ascii; *p; p++, q++) { @@ -308,10 +308,10 @@ PRIVATE int response ARGS1(char *,command) ** template must be already un upper case. ** unknown may be in upper or lower or mixed case to match. */ -PRIVATE BOOL match ARGS2 (CONST char *,unknown, CONST char *,template) +static BOOL match (const char * unknown, const char * template) { - CONST char * u = unknown; - CONST char * t = template; + const char * u = unknown; + const char * t = template; for (; *u && *t && (TOUPPER(*u) == *t); u++, t++) ; /* Find mismatch or end */ return (BOOL)(*t == 0); /* OK if end of template */ @@ -325,8 +325,8 @@ typedef enum { /* ** This function handles nntp authentication. - FM */ -PRIVATE NNTPAuthResult HTHandleAuthInfo ARGS1( - char *, host) +static NNTPAuthResult HTHandleAuthInfo ( + char * host) { HTList *cur = NULL; NNTPAuth *auth = NULL; @@ -562,7 +562,7 @@ PRIVATE NNTPAuthResult HTHandleAuthInfo ARGS1( ** " Tim Berners-Lee " ** or " tim@online.cern.ch ( Tim Berners-Lee ) " */ -PRIVATE char * author_name ARGS1 (char *,email) +static char * author_name (char * email) { char *p, *e; @@ -599,7 +599,7 @@ PRIVATE char * author_name ARGS1 (char *,email) ** " Lou Montulli " ** or " montulli@spaced.out.galaxy.net ( Lou "The Stud" Montulli ) " */ -PRIVATE char * author_address ARGS1(char *,email) +static char * author_address (char * email) { char *p, *at, *e; @@ -651,10 +651,10 @@ PRIVATE char * author_address ARGS1(char *,email) /* Start anchor element ** -------------------- */ -PRIVATE void start_anchor ARGS1(CONST char *, href) +static void start_anchor (const char * href) { BOOL present[HTML_A_ATTRIBUTES]; - CONST char* value[HTML_A_ATTRIBUTES]; + const char* value[HTML_A_ATTRIBUTES]; int i; for(i=0; i < HTML_A_ATTRIBUTES; i++) @@ -666,10 +666,10 @@ PRIVATE void start_anchor ARGS1(CONST char *, href) /* Start link element ** ------------------ */ -PRIVATE void start_link ARGS2(CONST char *, href, CONST char *, rev) +static void start_link (const char * href, const char * rev) { BOOL present[HTML_LINK_ATTRIBUTES]; - CONST char* value[HTML_LINK_ATTRIBUTES]; + const char* value[HTML_LINK_ATTRIBUTES]; int i; for(i=0; i < HTML_LINK_ATTRIBUTES; i++) @@ -682,10 +682,10 @@ PRIVATE void start_link ARGS2(CONST char *, href, CONST char *, rev) /* Start list element ** ------------------ */ -PRIVATE void start_list ARGS1(int, seqnum) +static void start_list (int seqnum) { BOOL present[HTML_OL_ATTRIBUTES]; - CONST char* value[HTML_OL_ATTRIBUTES]; + const char* value[HTML_OL_ATTRIBUTES]; char SeqNum[20]; int i; @@ -707,10 +707,10 @@ PRIVATE void start_list ARGS1(int, seqnum) ** addr points to the hypertext reference address, ** terminated by white space, comma, NULL or '>' */ -PRIVATE void write_anchor ARGS2(CONST char *,text, CONST char *,addr) +static void write_anchor (const char * text, const char * addr) { char href[LINE_LENGTH+1]; - CONST char * p; + const char * p; char *q; for (p = addr; *p && (*p != '>') && !WHITE(*p) && (*p!=','); p++) @@ -744,7 +744,7 @@ PRIVATE void write_anchor ARGS2(CONST char *,text, CONST char *,addr) ** On exit, ** *text is NOT any more chopped up into substrings. */ -PRIVATE void write_anchors ARGS1 (char *,text) +static void write_anchors (char * text) { char * start = text; char * end; @@ -774,7 +774,7 @@ PRIVATE void write_anchors ARGS1 (char *,text) /* Abort the connection abort_socket ** -------------------- */ -PRIVATE void abort_socket NOARGS +static void abort_socket (void) { CTRACE((tfp, "HTNews: EOF on read, closing socket %d\n", s)); NEWS_NETCLOSE(s); /* End of file, close socket */ @@ -791,8 +791,8 @@ PRIVATE void abort_socket NOARGS ** Determine if a line is a valid header line. valid_header ** ------------------------------------------- */ -PRIVATE BOOLEAN valid_header ARGS1( - char *, line) +static BOOLEAN valid_header ( + char * line) { char *colon, *space; @@ -828,8 +828,8 @@ PRIVATE BOOLEAN valid_header ARGS1( ** s Global socket number is OK ** postfile file with header and article to post. */ -PRIVATE void post_article ARGS1( - char *, postfile) +static void post_article ( + char * postfile) { char line[512]; char buf[512]; @@ -993,7 +993,7 @@ static char *decode_mime(char *str) return str; } #else /* !SH_EX */ -static char *decode_mime ARGS1(char *, str) +static char *decode_mime (char * str) { HTmmdecode(str, str); HTrjis(str, str); @@ -1013,8 +1013,8 @@ static char *decode_mime ARGS1(char *, str) ** s Global socket number is OK ** HT Global hypertext object is ready for appending text */ -PRIVATE int read_article ARGS1( - HTParentAnchor *, thisanchor) +static int read_article ( + HTParentAnchor * thisanchor) { char line[LINE_LENGTH+1]; char *full_line = NULL; @@ -1029,7 +1029,7 @@ PRIVATE int read_article ARGS1( char *href = NULL; char *p = line; char *cp; - CONST char *ccp; + const char *ccp; BOOL done = NO; /* @@ -1526,7 +1526,7 @@ PRIVATE int read_article ARGS1( ** RFC 977 specifies that the line "folding" of RFC850 is not used, ** so we do not handle it here. */ -PRIVATE int read_list ARGS1(char *, arg) +static int read_list (char * arg) { char line[LINE_LENGTH+1]; char *p; @@ -1705,10 +1705,10 @@ PRIVATE int read_list ARGS1(char *, arg) ** want more than one field. ** */ -PRIVATE int read_group ARGS3( - CONST char *, groupName, - int, first_required, - int, last_required) +static int read_group ( + const char * groupName, + int first_required, + int last_required) { char line[LINE_LENGTH+1]; char author[LINE_LENGTH+1]; @@ -2115,11 +2115,11 @@ add_post: /* Load by name. HTLoadNews ** ============= */ -PRIVATE int HTLoadNews ARGS4( - CONST char *, arg, - HTParentAnchor *, anAnchor, - HTFormat, format_out, - HTStream*, stream) +static int HTLoadNews ( + const char * arg, + HTParentAnchor * anAnchor, + HTFormat format_out, + HTStream* stream) { char command[262]; /* The whole command */ char proxycmd[260]; /* The proxy command */ @@ -2163,7 +2163,7 @@ PRIVATE int HTLoadNews ARGS4( proxycmd[sizeof(proxycmd)-1] = '\0'; { - CONST char * p1 = arg; + const char * p1 = arg; /* ** We will ask for the document, omitting the host name & anchor. @@ -3005,7 +3005,7 @@ Send_NNTP_command: ** the terminal for a period of time, but does not want ** to end the current session. - FM */ -PUBLIC void HTClearNNTPAuthInfo NOARGS +void HTClearNNTPAuthInfo (void) { /* ** Need code to check cached documents and do @@ -3021,7 +3021,7 @@ PUBLIC void HTClearNNTPAuthInfo NOARGS } #ifdef USE_SSL -PRIVATE char HTNewsGetCharacter NOARGS +static char HTNewsGetCharacter (void) { if (!Handle) return HTGetCharacter(); @@ -3029,15 +3029,15 @@ PRIVATE char HTNewsGetCharacter NOARGS return HTGetSSLCharacter((void *)Handle); } -PUBLIC int HTNewsProxyConnect ARGS5 ( - int, sock, - CONST char *, url, - HTParentAnchor *, anAnchor, - HTFormat, format_out, - HTStream *, sink) +int HTNewsProxyConnect ( + int sock, + const char * url, + HTParentAnchor * anAnchor, + HTFormat format_out, + HTStream * sink) { int status; - CONST char * arg = url; + const char * arg = url; char SSLprogress[256]; s = channel_s = sock; @@ -3086,13 +3086,13 @@ GLOBALDEF (HTProtocol,HTSNewsPost,_HTNEWS_C_6_INIT); #define _HTNEWS_C_7_INIT { "snewsreply", HTLoadNews, NULL } GLOBALDEF (HTProtocol,HTSNewsReply,_HTNEWS_C_7_INIT); #else -GLOBALDEF PUBLIC HTProtocol HTNews = { "news", HTLoadNews, NULL }; -GLOBALDEF PUBLIC HTProtocol HTNNTP = { "nntp", HTLoadNews, NULL }; -GLOBALDEF PUBLIC HTProtocol HTNewsPost = { "newspost", HTLoadNews, NULL }; -GLOBALDEF PUBLIC HTProtocol HTNewsReply = { "newsreply", HTLoadNews, NULL }; -GLOBALDEF PUBLIC HTProtocol HTSNews = { "snews", HTLoadNews, NULL }; -GLOBALDEF PUBLIC HTProtocol HTSNewsPost = { "snewspost", HTLoadNews, NULL }; -GLOBALDEF PUBLIC HTProtocol HTSNewsReply = { "snewsreply", HTLoadNews, NULL }; +GLOBALDEF HTProtocol HTNews = { "news", HTLoadNews, NULL }; +GLOBALDEF HTProtocol HTNNTP = { "nntp", HTLoadNews, NULL }; +GLOBALDEF HTProtocol HTNewsPost = { "newspost", HTLoadNews, NULL }; +GLOBALDEF HTProtocol HTNewsReply = { "newsreply", HTLoadNews, NULL }; +GLOBALDEF HTProtocol HTSNews = { "snews", HTLoadNews, NULL }; +GLOBALDEF HTProtocol HTSNewsPost = { "snewspost", HTLoadNews, NULL }; +GLOBALDEF HTProtocol HTSNewsReply = { "snewsreply", HTLoadNews, NULL }; #endif /* GLOBALDEF_IS_MACRO */ #endif /* not DISABLE_NEWS */ -- cgit 1.4.1-2-gfad0 a id='n356' href='#n356'>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 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196