diff options
Diffstat (limited to 'WWW')
-rw-r--r-- | WWW/Library/Implementation/HTAccess.c | 2 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTFormat.c | 61 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTFormat.h | 39 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTMIME.c | 7 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTNews.c | 86 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTRules.c | 3 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTString.c | 11 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTString.h | 1 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTTP.c | 72 | ||||
-rw-r--r-- | WWW/Library/Implementation/SGML.c | 17 | ||||
-rw-r--r-- | WWW/Library/Implementation/makefile.in | 3 | ||||
-rw-r--r-- | WWW/Library/Implementation/www_tcp.h | 7 |
12 files changed, 196 insertions, 113 deletions
diff --git a/WWW/Library/Implementation/HTAccess.c b/WWW/Library/Implementation/HTAccess.c index 9fb3f1de..f2618ef2 100644 --- a/WWW/Library/Implementation/HTAccess.c +++ b/WWW/Library/Implementation/HTAccess.c @@ -1075,7 +1075,7 @@ static BOOL HTLoadDocument(const char *full_address, /* may include #fragment */ fprintf(stderr, gettext("**** HTAccess: socket or file number returned by obsolete load routine!\n")); fprintf(stderr, - gettext("**** HTAccess: Internal software error. Please mail lynx-dev@sig.net!\n")); + gettext("**** HTAccess: Internal software error. Please mail lynx-dev@nongnu.org!\n")); fprintf(stderr, gettext("**** HTAccess: Status returned was: %d\n"), status); exit(EXIT_FAILURE); } diff --git a/WWW/Library/Implementation/HTFormat.c b/WWW/Library/Implementation/HTFormat.c index 7e7c4e11..855d1dc0 100644 --- a/WWW/Library/Implementation/HTFormat.c +++ b/WWW/Library/Implementation/HTFormat.c @@ -91,7 +91,8 @@ void HTSetPresentation(const char *representation, double quality, double secs, double secs_per_byte, - long int maxbytes) + long int maxbytes, + AcceptMedia media) { HTPresentation *pres = typecalloc(HTPresentation); @@ -105,6 +106,9 @@ void HTSetPresentation(const char *representation, pres->secs = (float) secs; pres->secs_per_byte = (float) secs_per_byte; pres->maxbytes = maxbytes; + pres->get_accept = 0; + pres->accept_opt = media; + pres->command = NULL; StrAllocCopy(pres->command, command); @@ -136,7 +140,8 @@ void HTSetConversion(const char *representation_in, float quality, float secs, float secs_per_byte, - long int maxbytes) + long int maxbytes, + AcceptMedia media) { HTPresentation *pres = typecalloc(HTPresentation); @@ -152,6 +157,8 @@ void HTSetConversion(const char *representation_in, pres->secs_per_byte = secs_per_byte; pres->maxbytes = maxbytes; pres->command = NULL; + pres->get_accept = TRUE; + pres->accept_opt = media; /* * Memory Leak fixed. @@ -508,41 +515,32 @@ void HTFilterPresentations(void) int n = HTList_count(HTPresentations); HTPresentation *p, *q; BOOL matched; - char *s, *t, *x, *y; + char *s, *t; + CTRACE((tfp, "HTFilterPresentations (AcceptMedia %#x)\n", LYAcceptMedia)); for (i = 0; i < n; i++) { p = (HTPresentation *) HTList_objectAt(HTPresentations, i); s = HTAtom_name(p->rep); - if (p->rep_out == WWW_PRESENT) { - if (p->rep != WWW_SOURCE - && strcasecomp(s, "www/mime") - && strcasecomp(s, "www/compressed") - && p->quality <= 1.0 && p->quality >= 0.0) { - for (j = 0, matched = FALSE; j < i; j++) { - q = (HTPresentation *) HTList_objectAt(HTPresentations, j); - t = HTAtom_name(q->rep); - - if (!strcasecomp(s, t)) { - matched = TRUE; - break; - } - if ((x = strchr(s, '/')) != 0 - && (y = strchr(t, '/')) != 0) { - int len1 = x++ - s; - int len2 = y++ - t; - int lens = (len1 > len2) ? len1 : len2; - - if ((*t == '*' || !strncasecomp(s, t, lens)) - && (*y == '*' || !strcasecomp(x, y))) { - matched = TRUE; - break; - } - } + p->get_accept = FALSE; + if (LYAcceptMedia & p->accept_opt + && p->rep_out == WWW_PRESENT + && p->rep != WWW_SOURCE + && strcasecomp(s, "www/mime") + && strcasecomp(s, "www/compressed") + && p->quality <= 1.0 && p->quality >= 0.0) { + matched = TRUE; + for (j = 0; j < i; j++) { + q = (HTPresentation *) HTList_objectAt(HTPresentations, j); + t = HTAtom_name(q->rep); + + if (!strcasecomp(s, t)) { + matched = FALSE; + CTRACE((tfp, " match %s %s\n", s, t)); + break; } - if (!matched) - p->get_accept = TRUE; } + p->get_accept = matched; } } } @@ -568,9 +566,6 @@ float HTStackValue(HTFormat rep_in, if (rep_out == WWW_SOURCE || rep_out == rep_in) return 0.0; - /* don't do anymore do it in the Lynx code at startup LJM */ -/* if (!HTPresentations) HTFormatInit(); *//* set up the list */ - { int n = HTList_count(HTPresentations); int i; diff --git a/WWW/Library/Implementation/HTFormat.h b/WWW/Library/Implementation/HTFormat.h index 51fb0c23..b94cc413 100644 --- a/WWW/Library/Implementation/HTFormat.h +++ b/WWW/Library/Implementation/HTFormat.h @@ -174,6 +174,7 @@ struct _HTPresentation { float secs_per_byte; long int maxbytes; BOOL get_accept; /* list in "Accept:" for GET */ + int accept_opt; /* matches against LYAcceptMedia */ }; /* @@ -192,6 +193,36 @@ extern HTList *HTPresentations; extern HTPresentation *default_presentation; /* + * Options used for "Accept:" string + */ +typedef enum { + /* make the components powers of two so we can add them */ + mediaINT = 1 /* internal types predefined in HTInit.c */ + ,mediaEXT = 2 /* external types predefined in HTInit.c */ + ,mediaCFG = 4 /* types, e.g., viewers, from lynx.cfg */ + ,mediaUSR = 8 /* user's mime-types, etc. */ + ,mediaSYS = 16 /* system's mime-types, etc. */ + /* these are useful flavors for the options menu */ + ,mediaOpt1 = mediaINT + ,mediaOpt2 = mediaINT + mediaCFG + ,mediaOpt3 = mediaINT + mediaCFG + mediaUSR + ,mediaOpt4 = mediaINT + mediaCFG + mediaUSR + mediaSYS + /* this is the flavor from pre-2.8.6 */ + ,mediaALL = mediaINT + mediaEXT + mediaCFG + mediaUSR + mediaSYS +} AcceptMedia; + +/* + * Options used for "Accept-Encoding:" string + */ +typedef enum { + encodingNONE = 0 + ,encodingGZIP = 1 + ,encodingCOMPRESS = 2 + ,encodingBZIP2 = 4 + ,encodingALL = encodingGZIP + encodingCOMPRESS + encodingBZIP2 +} AcceptEncoding; + +/* HTSetPresentation: Register a system command to present a format @@ -208,13 +239,16 @@ HTSetPresentation: Register a system command to present a format maxbytes A limit on the length acceptable as input (0 infinite) + media Used in filtering presentation types for "Accept:" + */ extern void HTSetPresentation(const char *representation, const char *command, double quality, double secs, double secs_per_byte, - long int maxbytes + long int maxbytes, + AcceptMedia media ); /* @@ -237,7 +271,8 @@ extern void HTSetConversion(const char *rep_in, float quality, float secs, float secs_per_byte, - long int maxbytes + long int maxbytes, + AcceptMedia media ); /* diff --git a/WWW/Library/Implementation/HTMIME.c b/WWW/Library/Implementation/HTMIME.c index d7a7923f..259bab89 100644 --- a/WWW/Library/Implementation/HTMIME.c +++ b/WWW/Library/Implementation/HTMIME.c @@ -292,7 +292,12 @@ static int pumpData(HTStream *me) UCT_STAGE_HTEXT, UCT_SETBY_DEFAULT); } - if (p_in->enc != UCT_ENC_CJK) { + if ((p_in->enc != UCT_ENC_CJK) +#ifndef EXP_JAPANESEUTF8_SUPPORT + && ((p_in->enc != UCT_ENC_UTF8) + || (p_out->enc != UCT_ENC_CJK)) +#endif + ) { HTCJK = NOCJK; if (!(p_in->codepoints & UCT_CP_SUBSETOF_LAT1) && diff --git a/WWW/Library/Implementation/HTNews.c b/WWW/Library/Implementation/HTNews.c index 791aee92..bb8dd812 100644 --- a/WWW/Library/Implementation/HTNews.c +++ b/WWW/Library/Implementation/HTNews.c @@ -31,9 +31,14 @@ int HTNewsMaxChunk = 40; /* Largest number of articles in one window */ #ifndef DEFAULT_NEWS_HOST #define DEFAULT_NEWS_HOST "news" #endif /* DEFAULT_NEWS_HOST */ -#ifndef SERVER_FILE -#define SERVER_FILE "/usr/local/lib/rn/server" -#endif /* SERVER_FILE */ + +#ifndef NEWS_SERVER_FILE +#define NEWS_SERVER_FILE "/usr/local/lib/rn/server" +#endif /* NEWS_SERVER_FILE */ + +#ifndef NEWS_AUTH_FILE +#define NEWS_AUTH_FILE ".newsauth" +#endif /* NEWS_AUTH_FILE */ #ifdef USE_SSL extern SSL_CTX *ssl_ctx; @@ -43,7 +48,7 @@ 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; } + { (void)NETCLOSE(sock); if (Handle) { SSL_free(Handle); Handle = NULL; } } static char HTNewsGetCharacter(void); #define NEXT_CHAR HTNewsGetCharacter() @@ -153,6 +158,44 @@ static void free_NNTP_AuthInfo(void) return; } +/* + * Initialize the authentication list by loading the user's $HOME/.newsauth + * file. That file is part of tin's configuration and is used by a few other + * programs. + */ +static void load_NNTP_AuthInfo(void) +{ + FILE *fp; + char fname[LY_MAXPATH]; + char buffer[LINE_LENGTH + 1]; + + LYAddPathToHome(fname, sizeof(fname), NEWS_AUTH_FILE); + + if ((fp = fopen(fname, "r")) != 0) { + while (fgets(buffer, sizeof(buffer), fp) != 0) { + char the_host[LINE_LENGTH + 1]; + char the_pass[LINE_LENGTH + 1]; + char the_user[LINE_LENGTH + 1]; + + if (sscanf(buffer, "%s%s%s", the_host, the_pass, the_user) == 3 + && strlen(the_host) != 0 + && strlen(the_pass) != 0 + && strlen(the_user) != 0) { + NNTPAuth *auth = typecalloc(NNTPAuth); + + if (auth == NULL) + break; + StrAllocCopy(auth->host, the_host); + StrAllocCopy(auth->pass, the_pass); + StrAllocCopy(auth->user, the_user); + + HTList_appendObject(NNTP_AuthInfo, auth); + } + } + fclose(fp); + } +} + const char *HTGetNewsHost(void) { return HTNewsHost; @@ -169,7 +212,7 @@ void HTSetNewsHost(const char *value) * Except on the NeXT, we pick up the NewsHost name from * * 1. Environment variable NNTPSERVER - * 2. File SERVER_FILE + * 2. File NEWS_SERVER_FILE * 3. Compilation time macro DEFAULT_NEWS_HOST * 4. Default to "news" * @@ -207,7 +250,7 @@ static BOOL initialize(void) CTRACE((tfp, "HTNews: NNTPSERVER defined as `%s'\n", HTNewsHost)); } else { - FILE *fp = fopen(SERVER_FILE, TXT_R); + FILE *fp = fopen(NEWS_SERVER_FILE, TXT_R); if (fp) { char server_name[MAXHOSTNAMELEN + 1]; @@ -219,7 +262,7 @@ static BOOL initialize(void) *p = '\0'; StrAllocCopy(HTNewsHost, server_name); CTRACE((tfp, "HTNews: File %s defines news host as `%s'\n", - SERVER_FILE, HTNewsHost)); + NEWS_SERVER_FILE, HTNewsHost)); } fclose(fp); } @@ -258,12 +301,12 @@ static int response(char *command) CTRACE((tfp, "NNTP command to be sent: %s", command)); #ifdef NOT_ASCII { - const char *p; + const char *p2; char *q; char ascii[LINE_LENGTH + 1]; - for (p = command, q = ascii; *p; p++, q++) { - *q = TOASCII(*p); + for (p2 = command, q = ascii; *p2; p2++, q++) { + *q = TOASCII(*p2); } status = NEWS_NETWRITE(s, ascii, length); } @@ -313,7 +356,7 @@ static int response(char *command) * ----------------------------------- * * On entry, - * template must be already un upper case. + * template must be already in upper case. * unknown may be in upper or lower or mixed case to match. */ static BOOL match(const char *unknown, const char *template) @@ -353,22 +396,23 @@ static NNTPAuthResult HTHandleAuthInfo(char *host) /* * Check for an existing authorization entry. - FM */ - if (NNTP_AuthInfo != NULL) { - cur = NNTP_AuthInfo; - while (NULL != (auth = (NNTPAuth *) HTList_nextObject(cur))) { - if (!strcmp(auth->host, host)) { - UserName = auth->user; - PassWord = auth->pass; - break; - } - } - } else { + if (NNTP_AuthInfo == NULL) { NNTP_AuthInfo = HTList_new(); + load_NNTP_AuthInfo(); #ifdef LY_FIND_LEAKS atexit(free_NNTP_AuthInfo); #endif } + cur = NNTP_AuthInfo; + while (NULL != (auth = (NNTPAuth *) HTList_nextObject(cur))) { + if (!strcmp(auth->host, host)) { + UserName = auth->user; + PassWord = auth->pass; + break; + } + } + /* * Handle the username. - FM */ diff --git a/WWW/Library/Implementation/HTRules.c b/WWW/Library/Implementation/HTRules.c index 8b1d8248..34675104 100644 --- a/WWW/Library/Implementation/HTRules.c +++ b/WWW/Library/Implementation/HTRules.c @@ -501,7 +501,8 @@ int HTSetConfiguration(char *config) status >= 1 ? quality : 1.0, status >= 2 ? secs : 0.0, status >= 3 ? secs_per_byte : 0.0, - status >= 4 ? maxbytes : 0); + status >= 4 ? maxbytes : 0, + mediaCFG); } else if (0 == strncasecomp(word1, "htbin", 5) || 0 == strncasecomp(word1, "bindir", 6)) { diff --git a/WWW/Library/Implementation/HTString.c b/WWW/Library/Implementation/HTString.c index 487513d9..e7b3e2c0 100644 --- a/WWW/Library/Implementation/HTString.c +++ b/WWW/Library/Implementation/HTString.c @@ -238,7 +238,7 @@ int AS_ncmp(const char *p, const char *a = p; int diff; - for (; (p - a) < n; p++, q++) { + for (; (unsigned) (p - a) < n; p++, q++) { if (!(*p && *q)) return (UCH(*p) - UCH(*q)); diff = TOASCII(*p) @@ -248,15 +248,6 @@ int AS_ncmp(const char *p, } return 0; /* Match up to n characters */ } - -/* With ASCII collating sequence - * ---------------- - */ -int AS_cmp(const char *p, - const char *q) -{ - return (AS_ncmp(p, q, -1)); -} #endif /* NOT_ASCII */ /* Allocate a new copy of a string, and returns it diff --git a/WWW/Library/Implementation/HTString.h b/WWW/Library/Implementation/HTString.h index cee80d57..6e5bcc2c 100644 --- a/WWW/Library/Implementation/HTString.h +++ b/WWW/Library/Implementation/HTString.h @@ -21,7 +21,6 @@ extern int AS_casecomp(const char *a, const char *b); extern int AS_ncmp(const char *a, const char *b, unsigned int n); #define AS_cmp( a, b ) ( AS_ncmp( ( a ), ( b ), -1 ) ) -extern int AS_cmp(const char *a, const char *b); #else #define AS_casecomp( a, b ) ( strcasecomp( ( a ), ( b ) ) ) diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c index 1b987374..0328b319 100644 --- a/WWW/Library/Implementation/HTTP.c +++ b/WWW/Library/Implementation/HTTP.c @@ -39,6 +39,7 @@ #include <LYGlobalDefs.h> #include <GridText.h> #include <LYStrings.h> +#include <LYrcFile.h> #include <LYLeaks.h> struct _HTStream { @@ -332,7 +333,6 @@ int ws_netread(int fd, char *buf, int len) /* * Strip any username from the given string so we retain only the host. - * If the */ static void strip_userid(char *host) { @@ -526,17 +526,10 @@ static int HTLoadHTTP(const char *arg, status = HT_NOT_LOADED; goto done; } - -/* *sob* All this needs to be converted to handle binary strings - * if we're going to be able to handle binary form uploads... - * This is a nice long function as well. *sigh* -RJP - */ - #ifdef USE_SSL use_tunnel: /* - * If this is an https document - * then do the SSL stuff here + * If this is an https document, then do the SSL stuff here. */ if (did_connect || !strncmp(url, "https", 5)) { SSL_handle = handle = HTGetSSLHandle(); @@ -632,8 +625,7 @@ static int HTLoadHTTP(const char *arg, } #endif /* USE_SSL */ - /* Ask that node for the document, - * omitting the host name & anchor + /* Ask that node for the document, omitting the host name & anchor */ { char *p1 = (HTParse(url, "", PARSE_PATH | PARSE_PUNCTUATION)); @@ -739,29 +731,35 @@ static int HTLoadHTTP(const char *arg, len = 0; /* - * FIXME: suppressing the "Accept-Encoding" in this case is done to work - * around limitations of the presentation logic used for the command-line - * "-base" option. The remote site may transmit the document gzip'd, but - * the ensuing logic in HTSaveToFile() would see the mime-type as gzip - * rather than text/html, and not prepend the base URL. This is less - * efficient than accepting the compressed data and uncompressing it, - * adding the base URL but is simpler than augmenting the dump's - * presentation logic -TD + * FIXME: suppressing the "Accept-Encoding" in this case is done to + * work around limitations of the presentation logic used for the + * command-line "-base" option. The remote site may transmit the + * document gzip'd, but the ensuing logic in HTSaveToFile() would see + * the mime-type as gzip rather than text/html, and not prepend the + * base URL. This is less efficient than accepting the compressed data + * and uncompressing it, adding the base URL but is simpler than + * augmenting the dump's presentation logic -TD */ if (LYPrependBaseToSource && dump_output_immediately) { CTRACE((tfp, "omit Accept-Encoding to work-around interaction with -source\n")); } else { char *list = 0; + int j, k; + + for (j = 1; j < encodingALL; j <<= 1) { + if ((j & LYAcceptEncoding) != 0) { + for (k = 0; tbl_preferred_encoding[k].name != 0; ++k) { + if (tbl_preferred_encoding[k].value == j) { + if (list != 0) + StrAllocCat(list, ", "); + StrAllocCat(list, tbl_preferred_encoding[k].name); + break; + } + } + } + } -#if defined(USE_ZLIB) || defined(GZIP_PATH) - StrAllocCopy(list, "gzip"); -#endif -#if defined(USE_ZLIB) || defined(COMPRESS_PATH) - if (list != 0) - StrAllocCat(list, ", "); - StrAllocCat(list, "compress"); -#endif if (list != 0) { HTBprintf(&command, "Accept-Encoding: %s%c%c", list, CR, LF); free(list); @@ -1092,12 +1090,12 @@ static int HTLoadHTTP(const char *arg, #ifdef NOT_ASCII /* S/390 -- gil -- 0548 */ { - char *p; + char *p2; - for (p = BStrData(command); - p < BStrData(command) + BStrLen(command); - p++) - *p = TOASCII(*p); + for (p2 = BStrData(command); + p2 < BStrData(command) + BStrLen(command); + p2++) + *p2 = TOASCII(*p2); } #endif /* NOT_ASCII */ status = HTTP_NETWRITE(s, BStrData(command), BStrLen(command), handle); @@ -1209,12 +1207,12 @@ static int HTLoadHTTP(const char *arg, } #ifdef NOT_ASCII /* S/390 -- gil -- 0564 */ { - char *p; + char *p2; - for (p = line_buffer + length; - p < line_buffer + length + status; - p++) - *p = FROMASCII(*p); + for (p2 = line_buffer + length; + p2 < line_buffer + length + status; + p2++) + *p2 = FROMASCII(*p2); } #endif /* NOT_ASCII */ diff --git a/WWW/Library/Implementation/SGML.c b/WWW/Library/Implementation/SGML.c index 0a32f58f..0d498bad 100644 --- a/WWW/Library/Implementation/SGML.c +++ b/WWW/Library/Implementation/SGML.c @@ -389,9 +389,12 @@ static void set_chartrans_handling(HTStream *context, HTParentAnchor *anchor, * would be better to call a Lynx_HTML_parser function to set an element in * its HTStructured object, itself, if this were needed. - FM */ +#ifndef EXP_JAPANESEUTF8_SUPPORT if (HTCJK != NOCJK) { context->current_tag_charset = -1; - } else if (context->T.transp) { + } else +#endif + if (context->T.transp) { context->current_tag_charset = context->inUCLYhndl; } else if (context->T.decode_utf8) { context->current_tag_charset = context->inUCLYhndl; @@ -1729,7 +1732,11 @@ static void SGML_character(HTStream *context, char c_in) * we have to care them here. -- TH */ if ((HTCJK == JAPANESE) && (context->state == S_in_kanji) && - !IS_JAPANESE_2BYTE(context->kanji_buf, UCH(c))) { + !IS_JAPANESE_2BYTE(context->kanji_buf, UCH(c)) +#ifdef EXP_JAPANESEUTF8_SUPPORT + && !context->T.decode_utf8 +#endif + ) { #ifdef CONV_JISX0201KANA_JISX0208KANA if (IS_SJIS_X0201KANA(context->kanji_buf)) { unsigned char sjis_hi, sjis_lo; @@ -1780,7 +1787,11 @@ static void SGML_character(HTStream *context, char c_in) } /* fall through in any case! */ case S_text: - if (HTCJK != NOCJK && (TOASCII(c) & 0200) != 0) { /* S/390 -- gil -- 0864 */ + if ((HTCJK != NOCJK) && ((TOASCII(c) & 0200) != 0) +#ifdef EXP_JAPANESEUTF8_SUPPORT + && !context->T.decode_utf8 +#endif + ) { /* S/390 -- gil -- 0864 */ /* * Setting up for Kanji multibyte handling (based on Takuya ASADA's * (asada@three-a.co.jp) CJK Lynx). Note that if the input is not diff --git a/WWW/Library/Implementation/makefile.in b/WWW/Library/Implementation/makefile.in index e3d47eab..ad4d99d8 100644 --- a/WWW/Library/Implementation/makefile.in +++ b/WWW/Library/Implementation/makefile.in @@ -18,6 +18,7 @@ LYFLAGS = # FIXME: set in parent makefile CC = @CC@ DEFS = @DEFS@ +EXTRA_CPPFLAGS = @EXTRA_CPPFLAGS@ CPPFLAGS = @CPPFLAGS@ o = .@OBJEXT@ @@ -25,7 +26,7 @@ o = .@OBJEXT@ INTLDIR_CPPFLAGS= @INTLDIR_CPPFLAGS@ -I$(top_srcdir)/intl CPP = @CPP@ -CPPOPTS = $(DEFS) $(CPPFLAGS) $(LYFLAGS) \ +CPPOPTS = $(DEFS) $(EXTRA_CPPFLAGS) $(CPPFLAGS) $(LYFLAGS) \ -I../../.. \ -I../../../src \ -I$(top_srcdir) \ diff --git a/WWW/Library/Implementation/www_tcp.h b/WWW/Library/Implementation/www_tcp.h index 31b5acde..750239b7 100644 --- a/WWW/Library/Implementation/www_tcp.h +++ b/WWW/Library/Implementation/www_tcp.h @@ -836,8 +836,11 @@ typedef struct sockaddr_in SockA; /* See netinet/in.h */ #define SOCKADDR_LEN(soc_address) ((struct sockaddr *)&soc_address)->sa_len #else #ifndef SA_LEN -#define SA_LEN(x) (((x)->sa_family == AF_INET6)?sizeof(struct sockaddr_in6): \ - (((x)->sa_family == AF_INET)?sizeof(struct sockaddr_in):sizeof(struct sockaddr))) +#define SA_LEN(x) (((x)->sa_family == AF_INET6) \ + ? sizeof(struct sockaddr_in6) \ + : (((x)->sa_family == AF_INET) \ + ? sizeof(struct sockaddr_in) \ + : sizeof(struct sockaddr))) #endif #define SOCKADDR_LEN(soc_address) SA_LEN((struct sockaddr *)&soc_address) #endif /* SIN6_LEN */ |