diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 1998-02-05 17:00:19 -0500 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 1998-02-05 17:00:19 -0500 |
commit | 4b034492d7e0a45781e340312e0570e5052c42d9 (patch) | |
tree | 52d01f4b7bf11032eeab99dbde240eff1b17d2dd /WWW | |
parent | b6d1143cba1a1910742924e8724f02585160f513 (diff) | |
download | lynx-snapshots-4b034492d7e0a45781e340312e0570e5052c42d9.tar.gz |
snapshot of project "lynx", label v2-7-1ac-0_113
Diffstat (limited to 'WWW')
30 files changed, 6366 insertions, 5165 deletions
diff --git a/WWW/Library/Implementation/HTACL.c b/WWW/Library/Implementation/HTACL.c index aeafcafd..2147e23f 100644 --- a/WWW/Library/Implementation/HTACL.c +++ b/WWW/Library/Implementation/HTACL.c @@ -4,7 +4,7 @@ ** ** AUTHORS: ** AL Ari Luotonen luotonen@dxcern.cern.ch -** MD Mark Donszelmann duns@vxdeop.cern.ch +** MD Mark Donszelmann duns@vxdeop.cern.ch ** ** HISTORY: ** 8 Nov 93 MD (VMS only) case insensitive compare reading acl entry, filename @@ -27,7 +27,7 @@ #include "LYLeaks.h" -/* PUBLIC HTAA_getAclFilename() +/* PRIVATE HTAA_getAclFilename() ** RESOLVE THE FULL PATHNAME OF ACL FILE FOR A GIVEN FILE ** ON ENTRY: ** path is the pathname of the file for which to @@ -38,19 +38,19 @@ ** (this is done to a local copy, of course). ** ** ON EXIT: -** returns the absolute pathname of ACL file +** returns the absolute pathname of ACL file ** (which is automatically freed next time ** this fuction is called). */ -PUBLIC char *HTAA_getAclFilename ARGS1(CONST char *, pathname) +PRIVATE char *HTAA_getAclFilename ARGS1(CONST char *, pathname) { static char * local_copy = NULL; static char * acl_path = NULL; char * directory = NULL; char * filename = NULL; - StrAllocCopy(local_copy, pathname); /* Also frees local_copy */ - /* from previous call. */ + StrAllocCopy(local_copy, pathname); /* Also frees local_copy */ + /* from previous call. */ directory = local_copy; filename = strrchr(directory, '/'); @@ -62,9 +62,9 @@ PUBLIC char *HTAA_getAclFilename ARGS1(CONST char *, pathname) *filename = '\0'; /* Truncate filename off from directory path */ filename++; /* and the filename begins from the next character */ } - + StrAllocCopy(acl_path, directory); /* Also frees acl_path */ - /* from previous call. */ + /* from previous call. */ StrAllocCat(acl_path, "/"); StrAllocCat(acl_path, ACL_FILE_NAME); @@ -79,7 +79,7 @@ PUBLIC char *HTAA_getAclFilename ARGS1(CONST char *, pathname) ** the file to be accessed. ** ** ON EXIT: -** returns the FILE* to open ACL. +** returns the FILE* to open ACL. ** NULL, if ACL not found. */ PUBLIC FILE *HTAA_openAcl ARGS1(CONST char *, pathname) @@ -94,7 +94,7 @@ PUBLIC FILE *HTAA_openAcl ARGS1(CONST char *, pathname) ** acl_file is Access Control List file to close. ** ** ON EXIT: -** returns nothing. +** returns nothing. */ PUBLIC void HTAA_closeAcl ARGS1(FILE *, acl_file) { @@ -124,7 +124,7 @@ PUBLIC void HTAA_closeAcl ARGS1(FILE *, acl_file) ** (user,group,...)@(address, address, ...) ** ** ON EXIT: -** returns NULL, if there is no entry for the file in the ACL, +** returns NULL, if there is no entry for the file in the ACL, ** or ACL doesn't exist. ** If there is, a GroupDef object containing the ** group and user names allowed to access the file @@ -147,7 +147,7 @@ PUBLIC void HTAA_closeAcl ARGS1(FILE *, acl_file) ** HTAA_readGroupFile()) and after that access authorization ** can be checked with function HTAA_userAndInetGroup(). */ -PUBLIC GroupDef *HTAA_getAclEntry ARGS3(FILE *, acl_file, +PUBLIC GroupDef *HTAA_getAclEntry ARGS3(FILE *, acl_file, CONST char *, pathname, HTAAMethod, method) { @@ -156,8 +156,8 @@ PUBLIC GroupDef *HTAA_getAclEntry ARGS3(FILE *, acl_file, int len; char *buf; - if (!acl_file) return NULL; /* ACL doesn't exist */ - + if (!acl_file) return NULL; /* ACL doesn't exist */ + if (group_def) { GroupDef_delete(group_def); /* From previous call */ group_def = NULL; @@ -171,7 +171,7 @@ PUBLIC GroupDef *HTAA_getAclEntry ARGS3(FILE *, acl_file, if (!(buf = (char*)malloc((strlen(filename)+2)*sizeof(char)))) outofmem(__FILE__, "HTAA_getAuthorizedGroups"); - + while (EOF != HTAAFile_readField(acl_file, buf, len+1)) { #ifdef VMS if (HTAA_templateCaseMatch(buf, filename)) { @@ -184,7 +184,7 @@ PUBLIC GroupDef *HTAA_getAclEntry ARGS3(FILE *, acl_file, fprintf(stderr, "Filename '%s' matched template '%s', allowed methods:", filename, buf); - } + } if (HTAAMethod_inList(method, methods)) { /* right method? */ if (TRACE) fprintf(stderr, " METHOD OK\n"); @@ -198,7 +198,7 @@ PUBLIC GroupDef *HTAA_getAclEntry ARGS3(FILE *, acl_file, */ return group_def; } else if (TRACE) { - fprintf(stderr, " METHOD NOT FOUND\n"); + fprintf(stderr, " METHOD NOT FOUND\n"); } HTList_delete(methods); methods = NULL; @@ -216,6 +216,6 @@ PUBLIC GroupDef *HTAA_getAclEntry ARGS3(FILE *, acl_file, FREE(buf); return NULL; /* No entry for requested file */ - /* (or an empty entry). */ + /* (or an empty entry). */ } diff --git a/WWW/Library/Implementation/HTACL.h b/WWW/Library/Implementation/HTACL.h index 6ae21a97..c0367c9d 100644 --- a/WWW/Library/Implementation/HTACL.h +++ b/WWW/Library/Implementation/HTACL.h @@ -1,5 +1,5 @@ -/* ACCESS CONTROL LIST ROUTINES - +/* ACCESS CONTROL LIST ROUTINES + */ #ifndef HTACL_H @@ -12,10 +12,9 @@ #include "HTGroup.h" #ifdef SHORT_NAMES -#define HTAAgAFn HTAA_getAclFilename -#define HTAAoACL HTAA_openAcl -#define HTAAcACL HTAA_closeAcl -#define HTAAgAEn HTAA_getAclEntry +#define HTAAoACL HTAA_openAcl +#define HTAAcACL HTAA_closeAcl +#define HTAAgAEn HTAA_getAclEntry #endif /* SHORT_NAMES */ /* @@ -24,43 +23,26 @@ Opening Access Control List File */ -/* PUBLIC HTAA_getAclFilename() -** RESOLVE THE FULL PATHNAME OF ACL FILE FOR A GIVEN FILE -** ON ENTRY: -** path is the pathname of the file for which to -** ACL file should be found. -** -** ACL filename is computed by replacing -** the filename by .www_acl in the pathname -** (this is done to a local copy, of course). -** -** ON EXIT: -** returns the absolute pathname of ACL file -** (which is automatically freed next time -** this fuction is called). -*/ -PUBLIC char *HTAA_getAclFilename PARAMS((CONST char * pathname)); - -/* PUBLIC HTAA_openAcl() -** OPEN THE ACL FILE FOR THE GIVEN DOCUMENT +/* PUBLIC HTAA_openAcl() +** OPEN THE ACL FILE FOR THE GIVEN DOCUMENT ** ON ENTRY: -** pathname is the absolute pathname of -** the file to be accessed. +** pathname is the absolute pathname of +** the file to be accessed. ** ** ON EXIT: -** returns the FILE* to open ACL. -** NULL, if ACL not found. +** returns the FILE* to open ACL. +** NULL, if ACL not found. */ PUBLIC FILE *HTAA_openAcl PARAMS((CONST char * pathname)); -/* PUBLIC HTAA_closeAcl() -** CLOSE ACL FILE +/* PUBLIC HTAA_closeAcl() +** CLOSE ACL FILE ** ON ENTRY: -** acl_file is Access Control List file to close. +** acl_file is Access Control List file to close. ** ** ON EXIT: -** returns nothing. +** returns nothing. */ PUBLIC void HTAA_closeAcl PARAMS((FILE * acl_file)); /* @@ -69,54 +51,54 @@ Getting ACL Entry */ -/* PUBLIC HTAA_getAclEntry() -** CONSULT THE ACCESS CONTROL LIST AND -** GIVE A LIST OF GROUPS (AND USERS) -** AUTHORIZED TO ACCESS A GIVEN FILE +/* PUBLIC HTAA_getAclEntry() +** CONSULT THE ACCESS CONTROL LIST AND +** GIVE A LIST OF GROUPS (AND USERS) +** AUTHORIZED TO ACCESS A GIVEN FILE ** ON ENTRY: -** acl_file is an open ACL file. -** pathname is the absolute pathname of -** the file to be accessed. -** method is the method for which access is wanted. +** acl_file is an open ACL file. +** pathname is the absolute pathname of +** the file to be accessed. +** method is the method for which access is wanted. ** ** ALC FILE FORMAT: ** -** template : method, method, ... : group@addr, user, group, ... +** template : method, method, ... : group@addr, user, group, ... ** -** The last item is in fact in exactly the same format as -** group definition in group file, i.e. everything that -** follows the 'groupname:' part, -** e.g. -** user, group, user@address, group@address, -** (user,group,...)@(address, address, ...) +** The last item is in fact in exactly the same format as +** group definition in group file, i.e. everything that +** follows the 'groupname:' part, +** e.g. +** user, group, user@address, group@address, +** (user,group,...)@(address, address, ...) ** ** ON EXIT: -** returns NULL, if there is no entry for the file in the ACL, -** or ACL doesn't exist. -** If there is, a GroupDef object containing the -** group and user names allowed to access the file -** is returned (this is automatically freed -** next time this function is called). +** returns NULL, if there is no entry for the file in the ACL, +** or ACL doesn't exist. +** If there is, a GroupDef object containing the +** group and user names allowed to access the file +** is returned (this is automatically freed +** next time this function is called). ** IMPORTANT: -** Returns the first entry with matching template and -** method. This function should be called multiple times -** to process all the valid entries (until it returns NULL). -** This is because there can be multiple entries like: +** Returns the first entry with matching template and +** method. This function should be called multiple times +** to process all the valid entries (until it returns NULL). +** This is because there can be multiple entries like: ** -** *.html : get,put : ari,timbl,robert -** *.html : get : jim,james,jonathan,jojo +** *.html : get,put : ari,timbl,robert +** *.html : get : jim,james,jonathan,jojo ** ** NOTE: -** The returned group definition may well contain references -** to groups defined in group file. Therefore these references -** must be resolved according to that rule file by function -** HTAA_resolveGroupReferences() (group file is read in by -** HTAA_readGroupFile()) and after that access authorization -** can be checked with function HTAA_userAndInetGroup(). +** The returned group definition may well contain references +** to groups defined in group file. Therefore these references +** must be resolved according to that rule file by function +** HTAA_resolveGroupReferences() (group file is read in by +** HTAA_readGroupFile()) and after that access authorization +** can be checked with function HTAA_userAndInetGroup(). */ -PUBLIC GroupDef *HTAA_getAclEntry PARAMS((FILE * acl_file, - CONST char * pathname, - HTAAMethod method)); +PUBLIC GroupDef *HTAA_getAclEntry PARAMS((FILE * acl_file, + CONST char * pathname, + HTAAMethod method)); /* */ diff --git a/WWW/Library/Implementation/HTAccess.c b/WWW/Library/Implementation/HTAccess.c index c2e75d41..edb91b51 100644 --- a/WWW/Library/Implementation/HTAccess.c +++ b/WWW/Library/Implementation/HTAccess.c @@ -6,10 +6,10 @@ ** JFG Jean-Francois Groff jfg@dxcern.cern.ch ** DD Denis DeLaRoca (310) 825-4580 <CSP1DWD@mvs.oac.ucla.edu> ** FM Foteos Macrides macrides@sci.wfeb.edu -** PDM Danny Mayer mayer@ljo.dec.com +** PDM Danny Mayer mayer@ljo.dec.com ** ** History -** 8 Jun 92 Telnet hopping prohibited as telnet is not secure TBL +** 8 Jun 92 Telnet hopping prohibited as telnet is not secure TBL ** 26 Jun 92 When over DECnet, suppressed FTP, Gopher and News. JFG ** 6 Oct 92 Moved HTClientHost and logfile into here. TBL ** 17 Dec 92 Tn3270 added, bug fix. DD @@ -17,12 +17,12 @@ ** PARAMETERS TO HTSEARCH AND HTLOADRELATIVE CHANGED ** 28 May 93 WAIS gateway explicit if no WAIS library linked in. ** 31 May 94 Added DIRECT_WAIS support for VMS. FM -** 27 Jan 95 Fixed proxy support to use NNTPSERVER for checking -** whether or not to use the proxy server. PDM -** 27 Jan 95 Ensured that proxy service will be overridden for files +** 27 Jan 95 Fixed proxy support to use NNTPSERVER for checking +** whether or not to use the proxy server. PDM +** 27 Jan 95 Ensured that proxy service will be overridden for files ** on the local host (because HTLoadFile() doesn't try ftp ** for those) and will substitute ftp for remote files. FM -** 28 Jan 95 Tweeked PDM's proxy override mods to handle port info +** 28 Jan 95 Tweeked PDM's proxy override mods to handle port info ** for news and wais URL's. FM ** ** Bugs @@ -70,7 +70,7 @@ extern HTCJKlang HTCJK; ** These flags may be set to modify the operation of this module */ PUBLIC char * HTClientHost = NULL; /* Name of remote login host if any */ -PUBLIC FILE * HTlogfile = NULL; /* File to which to output one-liners */ +PUBLIC FILE * HTlogfile = NULL; /* File to which to output one-liners */ PUBLIC BOOL HTSecure = NO; /* Disable access for telnet users? */ PUBLIC BOOL using_proxy = NO; /* are we using a proxy gateway? */ @@ -79,7 +79,7 @@ PUBLIC BOOL using_proxy = NO; /* are we using a proxy gateway? */ ** To generate other things, play with these: */ PUBLIC HTFormat HTOutputFormat = NULL; -PUBLIC HTStream* HTOutputStream = NULL; /* For non-interactive, set this */ +PUBLIC HTStream* HTOutputStream = NULL; /* For non-interactive, set this */ PRIVATE HTList * protocols = NULL; /* List of registered protocol descriptors */ @@ -102,7 +102,7 @@ PUBLIC BOOL HTRegisterProtocol ARGS1( HTProtocol *, protocol) { if (!protocols) { - protocols = HTList_new(); + protocols = HTList_new(); atexit(free_protocols); } HTList_addObject(protocols, protocol); @@ -116,7 +116,7 @@ PUBLIC BOOL HTRegisterProtocol ARGS1( ** Add to or subtract from this list if you add or remove protocol ** modules. This routine is called the first time the protocol list ** is needed, unless any protocols are already registered, in which -** case it is not called. Therefore the application can override +** case it is not called. Therefore the application can override ** this list. ** ** Compiling with NO_INIT prevents all known protocols from being @@ -197,7 +197,7 @@ PRIVATE void HTAccessInit NOARGS /* Call me once */ ** part is present, it applies to all ports on that domain. ** ** Example: -** no_proxy="cern.ch,some.domain:8001" +** no_proxy="cern.ch,some.domain:8001" ** ** Use "*" to override all proxy service: ** no_proxy="*" @@ -218,35 +218,35 @@ PUBLIC BOOL override_proxy ARGS1( * Check for global override. */ if (no_proxy) { - if (!strcmp(no_proxy, "*")) - return YES; + if (!strcmp(no_proxy, "*")) + return YES; } /* - * Never proxy file:// URLs if they are on the local host. - * HTLoadFile() will not attempt ftp for those if direct - * access fails. We'll check that first, in case no_proxy - * hasn't been defined. - FM + * Never proxy file:// URLs if they are on the local host. + * HTLoadFile() will not attempt ftp for those if direct + * access fails. We'll check that first, in case no_proxy + * hasn't been defined. - FM */ if (!addr) - return NO; + return NO; if (!(host = HTParse(addr, "", PARSE_HOST))) - return NO; + return NO; if (!*host) { - FREE(host); + FREE(host); return NO; } Host = (((at = strchr(host, '@')) != NULL) ? (at+1) : host); if ((acc_method = HTParse(addr, "", PARSE_ACCESS))) { - if (!strcmp("file", acc_method) && + if (!strcmp("file", acc_method) && (!strcmp(Host, "localhost") || #ifdef VMS - !strcasecomp(Host, HTHostName()) + !strcasecomp(Host, HTHostName()) #else - !strcmp(Host, HTHostName()) + !strcmp(Host, HTHostName()) #endif /* VMS */ - )) { + )) { FREE(host); FREE(acc_method); return YES; @@ -255,69 +255,69 @@ PUBLIC BOOL override_proxy ARGS1( } if (!no_proxy) { - FREE(host); - return NO; + FREE(host); + return NO; } if (NULL != (p = strrchr(Host, ':'))) { /* Port specified */ - *p++ = 0; /* Chop off port */ - port = atoi(p); + *p++ = 0; /* Chop off port */ + port = atoi(p); } else { /* Use default port */ - acc_method = HTParse(addr, "", PARSE_ACCESS); - if (acc_method != NULL) { - if (!strcmp(acc_method, "http")) port = 80; - else if (!strcmp(acc_method, "https")) port = 443; - else if (!strcmp(acc_method, "ftp")) port = 21; - else if (!strcmp(acc_method, "gopher")) port = 70; - else if (!strcmp(acc_method, "cso")) port = 105; + acc_method = HTParse(addr, "", PARSE_ACCESS); + if (acc_method != NULL) { + if (!strcmp(acc_method, "http")) port = 80; + else if (!strcmp(acc_method, "https")) port = 443; + else if (!strcmp(acc_method, "ftp")) port = 21; + else if (!strcmp(acc_method, "gopher")) port = 70; + else if (!strcmp(acc_method, "cso")) port = 105; else if (!strcmp(acc_method, "news")) port = 119; else if (!strcmp(acc_method, "nntp")) port = 119; else if (!strcmp(acc_method, "newspost")) port = 119; else if (!strcmp(acc_method, "newsreply")) port = 119; else if (!strcmp(acc_method, "snews")) port = 563; else if (!strcmp(acc_method, "snewspost")) port = 563; - else if (!strcmp(acc_method, "snewsreply")) port = 563; + else if (!strcmp(acc_method, "snewsreply")) port = 563; else if (!strcmp(acc_method, "wais")) port = 210; else if (!strcmp(acc_method, "finger")) port = 79; - FREE(acc_method); - } + FREE(acc_method); + } } if (!port) - port = 80; /* Default */ + port = 80; /* Default */ h_len = strlen(Host); while (*no_proxy) { - CONST char * end; - CONST char * colon = NULL; - int templ_port = 0; - int t_len; - - while (*no_proxy && (WHITE(*no_proxy) || *no_proxy == ',')) - no_proxy++; /* Skip whitespace and separators */ - - end = no_proxy; - while (*end && !WHITE(*end) && *end != ',') { /* Find separator */ - if (*end == ':') colon = end; /* Port number given */ - end++; - } - - if (colon) { - templ_port = atoi(colon+1); - t_len = colon - no_proxy; - } - else { - t_len = end - no_proxy; - } - - if ((!templ_port || templ_port == port) && - (t_len > 0 && t_len <= h_len && - !strncmp(Host + h_len - t_len, no_proxy, t_len))) { - FREE(host); - return YES; - } - if (*end) + CONST char * end; + CONST char * colon = NULL; + int templ_port = 0; + int t_len; + + while (*no_proxy && (WHITE(*no_proxy) || *no_proxy == ',')) + no_proxy++; /* Skip whitespace and separators */ + + end = no_proxy; + while (*end && !WHITE(*end) && *end != ',') { /* Find separator */ + if (*end == ':') colon = end; /* Port number given */ + end++; + } + + if (colon) { + templ_port = atoi(colon+1); + t_len = colon - no_proxy; + } + else { + t_len = end - no_proxy; + } + + if ((!templ_port || templ_port == port) && + (t_len > 0 && t_len <= h_len && + !strncmp(Host + h_len - t_len, no_proxy, t_len))) { + FREE(host); + return YES; + } + if (*end) no_proxy = (end + 1); - else + else break; } @@ -333,7 +333,7 @@ PUBLIC BOOL override_proxy ARGS1( ** anchor a pareent anchor with whose address is addr ** ** On exit, -** returns HT_NO_ACCESS Error has occured. +** returns HT_NO_ACCESS Error has occured. ** HT_OK Success */ PRIVATE int get_physical ARGS2( @@ -350,7 +350,7 @@ PRIVATE int get_physical ARGS2( return HT_FORBIDDEN; } if (anchor->isISMAPScript == TRUE) { - StrAllocCat(physical, "?0,0"); + StrAllocCat(physical, "?0,0"); if (TRACE) fprintf(stderr, "HTAccess: Appending '?0,0' coordinate pair.\n"); } @@ -358,24 +358,24 @@ PRIVATE int get_physical ARGS2( FREE(physical); /* free our copy */ #else if (anchor->isISMAPScript == TRUE) { - StrAllocCopy(physical, addr); + StrAllocCopy(physical, addr); StrAllocCat(physical, "?0,0"); if (TRACE) fprintf(stderr, "HTAccess: Appending '?0,0' coordinate pair.\n"); HTAnchor_setPhysical(anchor, physical); - FREE(physical); /* free our copy */ + FREE(physical); /* free our copy */ } else { - HTAnchor_setPhysical(anchor, addr); + HTAnchor_setPhysical(anchor, addr); } #endif /* NO_RULES */ acc_method = HTParse(HTAnchor_physical(anchor), - "file:", PARSE_ACCESS); + "file:", PARSE_ACCESS); /* - ** Check whether gateway access has been set up for this. + ** Check whether gateway access has been set up for this. ** - ** This function can be replaced by the rule system above. + ** This function can be replaced by the rule system above. */ #define USE_GATEWAYS #ifdef USE_GATEWAYS @@ -392,34 +392,34 @@ PRIVATE int get_physical ARGS2( char *host = NULL; if ((host = HTParse(addr, "", PARSE_HOST))) { if (strchr(host, ':') == NULL) { - StrAllocCopy(Server_addr, "news://"); - StrAllocCat(Server_addr, host); + StrAllocCopy(Server_addr, "news://"); + StrAllocCat(Server_addr, host); StrAllocCat(Server_addr, ":119/"); } FREE(host); - } else if (getenv("NNTPSERVER") != NULL) { - StrAllocCopy(Server_addr, "news://"); - StrAllocCat(Server_addr, (char *)getenv("NNTPSERVER")); - StrAllocCat(Server_addr, ":119/"); - } + } else if (getenv("NNTPSERVER") != NULL) { + StrAllocCopy(Server_addr, "news://"); + StrAllocCat(Server_addr, (char *)getenv("NNTPSERVER")); + StrAllocCat(Server_addr, ":119/"); + } } else if (!strcasecomp(acc_method, "wais")) { - /* + /* ** Wais also needs checking of the default port ** for selective exclusions. */ char *host = NULL; if ((host = HTParse(addr, "", PARSE_HOST))) { if (!(strchr(host, ':'))) { - StrAllocCopy(Server_addr, "wais://"); - StrAllocCat(Server_addr, host); + StrAllocCopy(Server_addr, "wais://"); + StrAllocCat(Server_addr, host); StrAllocCat(Server_addr, ":210/"); } FREE(host); } else - StrAllocCopy(Server_addr, addr); + StrAllocCopy(Server_addr, addr); } else { - StrAllocCopy(Server_addr, addr); + StrAllocCopy(Server_addr, addr); } if (!override_proxy(Server_addr)) { @@ -446,7 +446,7 @@ PRIVATE int get_physical ARGS2( strcpy(gateway_parameter, "ftp"); else strcpy(gateway_parameter, acc_method); - strcat(gateway_parameter, "_proxy"); + strcat(gateway_parameter, "_proxy"); proxy = (char *)getenv(gateway_parameter); FREE(gateway_parameter); @@ -454,55 +454,55 @@ PRIVATE int get_physical ARGS2( fprintf(stderr, "Gateway found: %s\n", gateway); if (TRACE && proxy) fprintf(stderr, "proxy server found: %s\n", proxy); - + /* ** Proxy servers have precedence over gateway servers. */ if (proxy) { char * gatewayed = NULL; - StrAllocCopy(gatewayed,proxy); + StrAllocCopy(gatewayed,proxy); /* ** Ensure that the proxy server uses ftp for file URLs. - FM */ if (!strncmp(addr, "file", 4)) { - StrAllocCat(gatewayed, "ftp"); - StrAllocCat(gatewayed, (addr + 4)); + StrAllocCat(gatewayed, "ftp"); + StrAllocCat(gatewayed, (addr + 4)); } else - StrAllocCat(gatewayed, addr); - using_proxy = YES; + StrAllocCat(gatewayed, addr); + using_proxy = YES; if (anchor->isISMAPScript == TRUE) - StrAllocCat(gatewayed, "?0,0"); - HTAnchor_setPhysical(anchor, gatewayed); + StrAllocCat(gatewayed, "?0,0"); + HTAnchor_setPhysical(anchor, gatewayed); FREE(gatewayed); FREE(acc_method); - acc_method = HTParse(HTAnchor_physical(anchor), - "http:", PARSE_ACCESS); + acc_method = HTParse(HTAnchor_physical(anchor), + "http:", PARSE_ACCESS); } else if (gateway) { char * path = HTParse(addr, "", - PARSE_HOST + PARSE_PATH + PARSE_PUNCTUATION); + PARSE_HOST + PARSE_PATH + PARSE_PUNCTUATION); /* Chop leading / off to make host into part of path */ char * gatewayed = HTParse(path+1, gateway, PARSE_ALL); FREE(path); - HTAnchor_setPhysical(anchor, gatewayed); + HTAnchor_setPhysical(anchor, gatewayed); FREE(gatewayed); FREE(acc_method); - - acc_method = HTParse(HTAnchor_physical(anchor), - "http:", PARSE_ACCESS); - } + + acc_method = HTParse(HTAnchor_physical(anchor), + "http:", PARSE_ACCESS); + } } FREE(Server_addr); #endif /* use gateways */ /* - ** Search registered protocols to find suitable one. + ** Search registered protocols to find suitable one. */ { int i, n; #ifndef NO_INIT - if (!protocols) HTAccessInit(); + if (!protocols) HTAccessInit(); #endif n = HTList_count(protocols); for (i = 0; i < n; i++) { @@ -526,7 +526,7 @@ PRIVATE int get_physical ARGS2( * values for later restoration. - kw * @@@ These functions may not really belong here, but where else? * I want the "pop" to occur as soon as possible after loading - * has finished. - kw @@@ + * has finished. - kw @@@ */ extern char*UCAssume_MIMEcharset; @@ -571,7 +571,7 @@ PRIVATE int LYUCPopAssumed NOARGS return -1; } -/* Load a document HTLoad() +/* Load a document HTLoad() ** --------------- ** ** This is an internal routine, which has an address AND a matching @@ -582,7 +582,7 @@ PRIVATE int LYUCPopAssumed NOARGS ** anchor a pareent anchor with whose address is addr ** ** On exit, -** returns <0 Error has occured. +** returns <0 Error has occured. ** HT_LOADED Success ** HT_NO_DATA Success, but no document loaded. ** (telnet sesssion started etc) @@ -596,15 +596,15 @@ PRIVATE int HTLoad ARGS4( HTProtocol *p; int status = get_physical(addr, anchor); if (status == HT_FORBIDDEN) { - return HTLoadError(sink, 500, "Access forbidden by rule"); + return HTLoadError(sink, 500, "Access forbidden by rule"); } if (status < 0) - return status; /* Can't resolve or forbidden */ - + return status; /* Can't resolve or forbidden */ + p = (HTProtocol *)HTAnchor_protocol(anchor); - anchor->underway = TRUE; /* Hack to deal with caching */ + anchor->underway = TRUE; /* Hack to deal with caching */ status= (*(p->load))(HTAnchor_physical(anchor), - anchor, format_out, sink); + anchor, format_out, sink); anchor->underway = FALSE; LYUCPopAssumed(); return status; @@ -618,8 +618,8 @@ PUBLIC HTStream *HTSaveStream ARGS1( { HTProtocol *p = (HTProtocol *)HTAnchor_protocol(anchor); if (!p) - return NULL; - + return NULL; + return (*p->saveStream)(anchor); } @@ -635,18 +635,18 @@ extern char LYinternal_flag; /* from LYMainLoop.c */ ** ** On Entry, ** anchor is the node_anchor for the document -** full_address The address of the document to be accessed. -** filter if YES, treat stdin as HTML +** full_address The address of the document to be accessed. +** filter if YES, treat stdin as HTML ** ** On Exit, -** returns YES Success in opening document -** NO Failure +** returns YES Success in opening document +** NO Failure */ -extern char LYforce_no_cache; /* from GridText.c */ +extern char LYforce_no_cache; /* from GridText.c */ extern char LYoverride_no_cache; /* from LYMainLoop.c */ extern char * HTLoadedDocumentURL NOPARAMS; /* in GridText.c */ -extern BOOL HText_hasNoCacheSet PARAMS((HText *text)); /* in GridText.c */ +extern BOOL HText_hasNoCacheSet PARAMS((HText *text)); /* in GridText.c */ extern BOOL reloading; extern BOOL permanent_redirection; #ifdef DIRED_SUPPORT @@ -659,7 +659,7 @@ PRIVATE BOOL HTLoadDocument ARGS4( HTFormat, format_out, HTStream*, sink) { - int status; + int status; HText * text; CONST char * address_to_load = full_address; char *cp; @@ -667,40 +667,40 @@ PRIVATE BOOL HTLoadDocument ARGS4( static int redirection_attempts = 0; if (TRACE) - fprintf (stderr, "HTAccess: loading document %s\n", address_to_load); + fprintf (stderr, "HTAccess: loading document %s\n", address_to_load); /* - ** Free use_this_url_instead and reset permanent_redirection - ** if not done elsewhere. - FM + ** Free use_this_url_instead and reset permanent_redirection + ** if not done elsewhere. - FM */ FREE(use_this_url_instead); permanent_redirection = FALSE; /* - ** Make sure some yoyo doesn't send us 'round in circles - ** with redirecting URLs that point back to themselves. - ** We'll set the original Lynx limit of 10 redirections - ** per requested URL from a user, because the HTTP/1.1 - ** will no longer specify a restriction to 5, but will - ** leave it up to the browser's discretion, in deference - ** to MicroSoft. - FM + ** Make sure some yoyo doesn't send us 'round in circles + ** with redirecting URLs that point back to themselves. + ** We'll set the original Lynx limit of 10 redirections + ** per requested URL from a user, because the HTTP/1.1 + ** will no longer specify a restriction to 5, but will + ** leave it up to the browser's discretion, in deference + ** to MicroSoft. - FM */ if (redirection_attempts > 10) { - redirection_attempts = 0; - HTAlert("Redirection limit of 10 URLs reached."); - return NO; + redirection_attempts = 0; + HTAlert("Redirection limit of 10 URL's reached."); + return NO; } /* - * If this is marked as an internal link but we don't have the - * document loaded any more, and we haven't explicitly flagged - * that we want to reload with LYforce_no_cache, then something - * has disappeared from the cache when we expected it to be still - * there. The user probably doesn't expect a new network access. - * So if we have POST data and safe is not set in the anchor, - * ask for confirmation, and fail if not granted. The exception - * are LYNXIMGMAP documents, for which we defer to LYLoadIMGmap - * for prompting if necessary. - kw + * If this is marked as an internal link but we don't have the + * document loaded any more, and we haven't explicitly flagged + * that we want to reload with LYforce_no_cache, then something + * has disappeared from the cache when we expected it to be still + * there. The user probably doesn't expect a new network access. + * So if we have POST data and safe is not set in the anchor, + * ask for confirmation, and fail if not granted. The exception + * are LYNXIMGMAP documents, for which we defer to LYLoadIMGmap + * for prompting if necessary. - kw */ if (LYinternal_flag && !LYforce_no_cache && anchor->post_data && !anchor->safe && @@ -712,14 +712,14 @@ PRIVATE BOOL HTLoadDocument ARGS4( } /* - ** If we don't have POST content, check whether this is a previous - ** redirecting URL, and keep re-checking until we get to the final - ** destination or redirection limit. If we do have POST content, - ** we didn't allow permanent redirection, and an interactive user - ** will be deciding whether to keep redirecting. - FM + ** If we don't have POST content, check whether this is a previous + ** redirecting URL, and keep re-checking until we get to the final + ** destination or redirection limit. If we do have POST content, + ** we didn't allow permanent redirection, and an interactive user + ** will be deciding whether to keep redirecting. - FM */ if (!anchor->post_data) { - while ((cp = HTAnchor_physical(anchor)) != NULL && + while ((cp = HTAnchor_physical(anchor)) != NULL && !strncmp(cp, "Location=", 9)) { DocAddress NewDoc; @@ -730,13 +730,13 @@ PRIVATE BOOL HTLoadDocument ARGS4( } /* - ** Don't exceed the redirection_attempts limit. - FM + ** Don't exceed the redirection_attempts limit. - FM */ if (++redirection_attempts > 10) { - HTAlert("Redirection limit of 10 URLs reached."); + HTAlert("Redirection limit of 10 URL's reached."); redirection_attempts = 0; FREE(use_this_url_instead); - return NO; + return NO; } /* @@ -753,31 +753,31 @@ PRIVATE BOOL HTLoadDocument ARGS4( } } /* - ** If we had previous redirection, go back and check out - ** that the URL under the current restrictions. - FM + ** If we had previous redirection, go back and check out + ** that the URL under the current restrictions. - FM */ if (use_this_url_instead) { FREE(redirecting_url); - return(NO); + return(NO); } /* - ** See if we can use an already loaded document. + ** See if we can use an already loaded document. */ - if (!LYforce_no_cache && (text = (HText *)HTAnchor_document(anchor))) { + if (!LYforce_no_cache && (text = (HText *)HTAnchor_document(anchor))) { /* ** We have a cached rendition of the target document. ** Check if it's OK to re-use it. We consider it OK if: ** (1) the anchor does not have the no_cache element set, or ** (2) we've overridden it, e.g., because we are acting on - ** a PREV_DOC command or a link in the History Page and - ** it's not a reply from a POST with the LYresubmit_posts - ** flag set, or + ** a PREV_DOC command or a link in the History Page and + ** it's not a reply from a POST with the LYresubmit_posts + ** flag set, or ** (3) we are repositioning within the currently loaded document - ** based on the target anchor's address (URL_Reference). + ** based on the target anchor's address (URL_Reference). * * If DONT_TRACK_INTERNAL_LINKS is defined, HText_AreDifferent() - * is used to determine whether (3) applies. If the target address + * is used to determine whether (3) applies. If the target address * differs from that of the current document only by a fragment * and the taget address has an appended fragment, repositioning * without reloading is always assumed. @@ -825,13 +825,13 @@ PRIVATE BOOL HTLoadDocument ARGS4( strncmp(full_address, "LYNXIMGMAP:", 11))) #endif /* TRACK_INTERNAL_LINKS */ { - if (TRACE) - fprintf(stderr, "HTAccess: Document already in memory.\n"); - HText_select(text); + if (TRACE) + fprintf(stderr, "HTAccess: Document already in memory.\n"); + HText_select(text); #ifdef DIRED_SUPPORT if (HTAnchor_format(anchor) == WWW_DIRED) - lynx_edit_mode = TRUE; + lynx_edit_mode = TRUE; #endif redirection_attempts = 0; return YES; @@ -843,17 +843,17 @@ PRIVATE BOOL HTLoadDocument ARGS4( reloading = TRUE; #endif ForcingNoCache = YES; - if (TRACE) { - fprintf(stderr, "HTAccess: Auto-reloading document.\n"); + if (TRACE) { + fprintf(stderr, "HTAccess: Auto-reloading document.\n"); } } } /* - ** Get the document from the net. If we are auto-reloading, - ** the mutable anchor elements from the previous rendition - ** should be freed in conjunction with loading of the new - ** rendition. - FM + ** Get the document from the net. If we are auto-reloading, + ** the mutable anchor elements from the previous rendition + ** should be freed in conjunction with loading of the new + ** rendition. - FM */ LYforce_no_cache = NO; /* reset after each time through */ if (ForcingNoCache) { @@ -863,9 +863,9 @@ PRIVATE BOOL HTLoadDocument ARGS4( if (TRACE) { fprintf(stderr, "HTAccess: status=%d\n", status); } - + /* - ** Log the access if necessary. + ** Log the access if necessary. */ if (HTlogfile) { time_t theTime; @@ -883,12 +883,12 @@ PRIVATE BOOL HTLoadDocument ARGS4( status < 0 ? "FAIL" : "GET", full_address); } - + /* - ** Check out what we received from the net. + ** Check out what we received from the net. */ if (status == HT_REDIRECTING) { - /* Exported from HTMIME.c, of all places. *//** NO!! - FM **/ + /* Exported from HTMIME.c, of all places. *//** NO!! - FM **/ /* ** Doing this via HTMIME.c meant that the redirection cover ** page was already loaded before we learned that we want a @@ -906,32 +906,32 @@ PRIVATE BOOL HTLoadDocument ARGS4( ** in LYGetFile.c when the status is HT_REDIRECTING. This may ** seem bizarre, but it works like a charm! - FM */ - if (TRACE) { - fprintf(stderr, "HTAccess: '%s' is a redirection URL.\n", + if (TRACE) { + fprintf(stderr, "HTAccess: '%s' is a redirection URL.\n", address_to_load); - fprintf(stderr, "HTAccess: Redirecting to '%s'\n", + fprintf(stderr, "HTAccess: Redirecting to '%s'\n", redirecting_url); - } + } /* - ** Prevent circular references. + ** Prevent circular references. */ if (strcmp(address_to_load, redirecting_url)) { /* if different */ /* - ** Load token and redirecting url into anchor->physical - ** if we had 301 Permanent redirection. HTTP.c does not - ** allow this if we have POST content. - FM + ** Load token and redirecting url into anchor->physical + ** if we had 301 Permanent redirection. HTTP.c does not + ** allow this if we have POST content. - FM */ if (permanent_redirection) { - StrAllocCopy(anchor->physical, "Location="); - StrAllocCat(anchor->physical, redirecting_url); + StrAllocCopy(anchor->physical, "Location="); + StrAllocCat(anchor->physical, redirecting_url); } - /* - ** Set up flags before return to getfile. - FM + /* + ** Set up flags before return to getfile. - FM */ - StrAllocCopy(use_this_url_instead, redirecting_url); + StrAllocCopy(use_this_url_instead, redirecting_url); if (ForcingNoCache) - LYforce_no_cache = YES; + LYforce_no_cache = YES; ++redirection_attempts; FREE(redirecting_url); permanent_redirection = FALSE; @@ -944,7 +944,7 @@ PRIVATE BOOL HTLoadDocument ARGS4( } /* - ** We did not receive a redirecting URL. - FM + ** We did not receive a redirecting URL. - FM */ redirection_attempts = 0; FREE(redirecting_url); @@ -968,25 +968,25 @@ PRIVATE BOOL HTLoadDocument ARGS4( if (status == HT_NO_DATA) { if (TRACE) { - fprintf(stderr, + fprintf(stderr, "HTAccess: `%s' has been accessed, No data left.\n", full_address); } return NO; } - + if (status == HT_NOT_LOADED) { if (TRACE) { - fprintf(stderr, + fprintf(stderr, "HTAccess: `%s' has been accessed, No data loaded.\n", full_address); } return NO; } - + if (status == HT_INTERRUPTED) { if (TRACE) { - fprintf(stderr, + fprintf(stderr, "HTAccess: `%s' has been accessed, transfer interrupted.\n", full_address); } @@ -1001,15 +1001,15 @@ PRIVATE BOOL HTLoadDocument ARGS4( StrAllocCat(temp, "'"); _HTProgress(temp); FREE(temp); - if (TRACE) fprintf(stderr, + if (TRACE) fprintf(stderr, "HTAccess: Can't access `%s'\n", full_address); HTLoadError(sink, 500, "Unable to access document."); return NO; } - + /* - ** If you get this, then please find which routine is returning - ** a positive unrecognised error code! + ** If you get this, then please find which routine is returning + ** a positive unrecognised error code! */ fprintf(stderr, "**** HTAccess: socket or file number returned by obsolete load routine!\n"); @@ -1024,12 +1024,12 @@ PRIVATE BOOL HTLoadDocument ARGS4( ** ----------------------------------- ** ** On Entry, -** addr The absolute address of the document to be accessed. -** filter if YES, treat document as HTML +** addr The absolute address of the document to be accessed. +** filter if YES, treat document as HTML ** ** On Exit, -** returns YES Success in opening document -** NO Failure +** returns YES Success in opening document +** NO Failure */ PUBLIC BOOL HTLoadAbsolute ARGS1( CONST DocAddress *, docaddr) @@ -1045,17 +1045,17 @@ PUBLIC BOOL HTLoadAbsolute ARGS1( ** --------------------------------------------- ** ** On Entry, -** addr The absolute address of the document to be accessed. -** sink if non-NULL, send data down this stream +** addr The absolute address of the document to be accessed. +** sink if non-NULL, send data down this stream ** ** On Exit, -** returns YES Success in opening document -** NO Failure +** returns YES Success in opening document +** NO Failure */ PUBLIC BOOL HTLoadToStream ARGS3( CONST char *, addr, - BOOL, filter, - HTStream *, sink) + BOOL, filter, + HTStream *, sink) { return HTLoadDocument(addr, HTAnchor_parent(HTAnchor_findAddress(addr)), @@ -1068,12 +1068,12 @@ PUBLIC BOOL HTLoadToStream ARGS3( ** ----------------------------------- ** ** On Entry, -** relative_name The relative address of the document -** to be accessed. +** relative_name The relative address of the document +** to be accessed. ** ** On Exit, -** returns YES Success in opening document -** NO Failure +** returns YES Success in opening document +** NO Failure */ PUBLIC BOOL HTLoadRelative ARGS2( CONST char *, relative_name, @@ -1096,14 +1096,14 @@ PUBLIC BOOL HTLoadRelative ARGS2( stripped = HTStrip(mycopy); full_address.address = - HTParse(stripped, + HTParse(stripped, current_address, PARSE_ACCESS|PARSE_HOST|PARSE_PATH|PARSE_PUNCTUATION); result = HTLoadAbsolute(&full_address); /* - ** If we got redirection, result will be NO, but use_this_url_instead - ** will be set. The calling routine should check both and do whatever - ** is appropriate. - FM + ** If we got redirection, result will be NO, but use_this_url_instead + ** will be set. The calling routine should check both and do whatever + ** is appropriate. - FM */ FREE(full_address.address); FREE(current_address); @@ -1115,11 +1115,11 @@ PUBLIC BOOL HTLoadRelative ARGS2( ** ---------------------------------------- ** ** On Entry, -** destination The child or parenet anchor to be loaded. +** destination The child or parenet anchor to be loaded. ** ** On Exit, -** returns YES Success -** NO Failure +** returns YES Success +** NO Failure */ PUBLIC BOOL HTLoadAnchor ARGS1( HTAnchor *, destination) @@ -1127,14 +1127,14 @@ PUBLIC BOOL HTLoadAnchor ARGS1( HTParentAnchor * parent; BOOL loaded = NO; if (!destination) - return NO; /* No link */ - + return NO; /* No link */ + parent = HTAnchor_parent(destination); - + if (HTAnchor_document(parent) == NULL) { /* If not alread loaded */ - /* TBL 921202 */ - BOOL result; - char * address = HTAnchor_address((HTAnchor*) parent); + /* TBL 921202 */ + BOOL result; + char * address = HTAnchor_address((HTAnchor*) parent); result = HTLoadDocument(address, parent, @@ -1145,23 +1145,23 @@ PUBLIC BOOL HTLoadAnchor ARGS1( if (!result) return NO; loaded = YES; } - + { HText *text = (HText*)HTAnchor_document(parent); if (destination != (HTAnchor *)parent) { /* If child anchor */ - HText_selectAnchor(text, /* Double display? @@ */ + HText_selectAnchor(text, /* Double display? @@ */ (HTChildAnchor*)destination); } else { if (!loaded) - HText_select(text); + HText_select(text); } } return YES; - + } /* HTLoadAnchor */ -/* Search. HTSearch() +/* Search. HTSearch() ** ------- ** ** Performs a keyword search on word given by the user. Adds the @@ -1169,7 +1169,7 @@ PUBLIC BOOL HTLoadAnchor ARGS1( ** the new address. ** ** On Entry, -** *keywords space-separated keyword list or similar search list +** *keywords space-separated keyword list or similar search list ** here is anchor search is to be done on. */ PRIVATE char hex ARGS1( @@ -1180,8 +1180,8 @@ PRIVATE char hex ARGS1( } PUBLIC BOOL HTSearch ARGS2( - CONST char *, keywords, - HTParentAnchor *, here) + CONST char *, keywords, + HTParentAnchor *, here) { #define acceptable \ "1234567890abcdefghijlkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-_" @@ -1193,29 +1193,29 @@ PUBLIC BOOL HTSearch ARGS2( char * escaped = (char *)calloc(1, ((strlen(keywords)*3) + 1)); static CONST BOOL isAcceptable[96] = - /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ - { 0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0, /* 2x !"#$%&'()*+,-./ */ - 1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, /* 3x 0123456789:;<=>? */ + /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ + { 0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0, /* 2x !"#$%&'()*+,-./ */ + 1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, /* 3x 0123456789:;<=>? */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 4x @ABCDEFGHIJKLMNO */ - 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, /* 5X PQRSTUVWXYZ[\]^_ */ - 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 6x `abcdefghijklmno */ + 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, /* 5X PQRSTUVWXYZ[\]^_ */ + 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 6x `abcdefghijklmno */ 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0 }; /* 7X pqrstuvwxyz{\}~ DEL */ if (escaped == NULL) - outofmem(__FILE__, "HTSearch"); - + outofmem(__FILE__, "HTSearch"); + StrAllocCopy(address, here->isIndexAction); /* - ** Convert spaces to + and hex escape unacceptable characters. + ** Convert spaces to + and hex escape unacceptable characters. */ for (s = keywords; *s && WHITE(*s); s++) /* Scan */ - ; /* Skip white space */ + ; /* Skip white space */ for (e = s + strlen(s); e > s && WHITE(*(e-1)); e--) /* Scan */ - ; /* Skip trailers */ + ; /* Skip trailers */ for (q = escaped, p = s; p < e; p++) { /* Scan stripped field */ - unsigned char c = (unsigned char)TOASCII(*p); - if (WHITE(*p)) { + unsigned char c = (unsigned char)TOASCII(*p); + if (WHITE(*p)) { *q++ = '+'; } else if (HTCJK != NOCJK) { *q++ = *p; @@ -1230,26 +1230,26 @@ PUBLIC BOOL HTSearch ARGS2( *q = '\0'; /* Terminate escaped string */ u = strchr(address, '?'); /* Find old search string */ if (u != NULL) - *u = '\0'; /* Chop old search off */ + *u = '\0'; /* Chop old search off */ StrAllocCat(address, "?"); StrAllocCat(address, escaped); FREE(escaped); result = HTLoadRelative(address, here); FREE(address); - + /* - ** If we got redirection, result will be NO, but use_this_url_instead - ** will be set. The calling routine should check both and do whatever - ** is appropriate. Only an http server (not a gopher or wais server) - ** could return redirection. Lynx will go all the way back to its - ** mainloop() and subject a redirecting URL to all of its security and - ** restrictions checks. - FM + ** If we got redirection, result will be NO, but use_this_url_instead + ** will be set. The calling routine should check both and do whatever + ** is appropriate. Only an http server (not a gopher or wais server) + ** could return redirection. Lynx will go all the way back to its + ** mainloop() and subject a redirecting URL to all of its security and + ** restrictions checks. - FM */ return result; } -/* Search Given Indexname. HTSearchAbsolute() +/* Search Given Indexname. HTSearchAbsolute() ** ----------------------- ** ** Performs a keyword search on word given by the user. Adds the @@ -1257,12 +1257,12 @@ PUBLIC BOOL HTSearch ARGS2( ** the new address. ** ** On Entry, -** *keywords space-separated keyword list or similar search list -** *addres is name of object search is to be done on. +** *keywords space-separated keyword list or similar search list +** *addres is name of object search is to be done on. */ PUBLIC BOOL HTSearchAbsolute ARGS2( - CONST char *, keywords, - CONST char *, indexname) + CONST char *, keywords, + CONST char *, indexname) { DocAddress abs_doc; HTParentAnchor * anchor; @@ -1298,23 +1298,23 @@ PUBLIC HTParentAnchor * HTHomeAnchor NOARGS char * home = (char *)getenv(LOGICAL_DEFAULT); char * ref; HTParentAnchor * anchor; - + if (home) { - StrAllocCopy(my_home_document, home); + StrAllocCopy(my_home_document, home); #define MAX_FILE_NAME 1024 /* @@@ */ } else if (HTClientHost) { /* Telnet server */ - /* + /* ** Someone telnets in, they get a special home. */ - FILE * fp = fopen(REMOTE_POINTER, "r"); + FILE * fp = fopen(REMOTE_POINTER, "r"); char * status; if (fp) { my_home_document = (char*)calloc(1, MAX_FILE_NAME); if (my_home_document == NULL) - outofmem(__FILE__, "HTHomeAnchor"); + outofmem(__FILE__, "HTHomeAnchor"); status = fgets(my_home_document, MAX_FILE_NAME, fp); if (!status) { - FREE(my_home_document); + FREE(my_home_document); } fclose(fp); } @@ -1326,15 +1326,15 @@ PUBLIC HTParentAnchor * HTHomeAnchor NOARGS if (my_home_document == NULL) { FILE * fp = NULL; CONST char * home = (CONST char*)getenv("HOME"); - if (home != null) { + if (home != null) { my_home_document = (char *)calloc(1, (strlen(home) + 1 + strlen(PERSONAL_DEFAULT) + 1)); if (my_home_document == NULL) - outofmem(__FILE__, "HTAnchorHome"); + outofmem(__FILE__, "HTAnchorHome"); sprintf(my_home_document, "%s/%s", home, PERSONAL_DEFAULT); fp = fopen(my_home_document, "r"); } - + if (!fp) { StrAllocCopy(my_home_document, LOCAL_DEFAULT_FILE); fp = fopen(my_home_document, "r"); @@ -1343,7 +1343,7 @@ PUBLIC HTParentAnchor * HTHomeAnchor NOARGS fclose(fp); } else { if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTBrowse: No local home document ~/%s or %s\n", PERSONAL_DEFAULT, LOCAL_DEFAULT_FILE); FREE(my_home_document); @@ -1351,8 +1351,8 @@ PUBLIC HTParentAnchor * HTHomeAnchor NOARGS } #endif /* unix */ ref = HTParse((my_home_document ? - my_home_document : (HTClientHost ? - REMOTE_ADDRESS : LAST_RESORT)), + my_home_document : (HTClientHost ? + REMOTE_ADDRESS : LAST_RESORT)), "file:", PARSE_ACCESS|PARSE_HOST|PARSE_PATH|PARSE_PUNCTUATION); if (my_home_document) { diff --git a/WWW/Library/Implementation/HTAnchor.c b/WWW/Library/Implementation/HTAnchor.c index b15d5e6b..6f8c0d3f 100644 --- a/WWW/Library/Implementation/HTAnchor.c +++ b/WWW/Library/Implementation/HTAnchor.c @@ -6,8 +6,8 @@ ** ** History ** -** Nov 1990 Written in Objective-C for the NeXT browser (TBL) -** 24-Oct-1991 (JFG), written in C, browser-independant +** Nov 1990 Written in Objective-C for the NeXT browser (TBL) +** 24-Oct-1991 (JFG), written in C, browser-independant ** 21-Nov-1991 (JFG), first complete version ** ** (c) Copyright CERN 1991 - See Copyright.html @@ -38,8 +38,8 @@ (unsigned short int)TOUPPER(*cp_address) % HASH_SIZE) #endif /* NOT_DEFINED */ /* - * This is the original function. We'll use it again. - FM - */ + * This is the original function. We'll use it again. - FM + */ PRIVATE int HASH_FUNCTION ARGS1( CONST char *, cp_address) { @@ -47,7 +47,7 @@ PRIVATE int HASH_FUNCTION ARGS1( unsigned char *p; for (p = (unsigned char *)cp_address, hash = 0; *p; p++) - hash = (int) (hash * 3 + (*(unsigned char *)p)) % HASH_SIZE; + hash = (int) (hash * 3 + (*(unsigned char *)p)) % HASH_SIZE; return hash; } @@ -70,24 +70,24 @@ PRIVATE HTList **adult_table = 0; /* Point to table of lists of all parents */ */ PRIVATE HTParentAnchor * HTParentAnchor_new NOARGS { - HTParentAnchor *newAnchor = + HTParentAnchor *newAnchor = (HTParentAnchor *)calloc(1, sizeof(HTParentAnchor)); /* zero-filled */ newAnchor->parent = newAnchor; - newAnchor->bookmark = NULL; /* Bookmark filename. - FM */ + newAnchor->bookmark = NULL; /* Bookmark filename. - FM */ newAnchor->isISMAPScript = FALSE; /* Lynx appends ?0,0 if TRUE. - FM */ newAnchor->isHEAD = FALSE; /* HEAD request if TRUE. - FM */ newAnchor->safe = FALSE; /* Safe. - FM */ newAnchor->FileCache = NULL; /* Path to a disk-cached copy. - FM */ - newAnchor->SugFname = NULL; /* Suggested filename. - FM */ - newAnchor->RevTitle = NULL; /* TITLE for a LINK with REV. - FM */ + newAnchor->SugFname = NULL; /* Suggested filename. - FM */ + newAnchor->RevTitle = NULL; /* TITLE for a LINK with REV. - FM */ newAnchor->cache_control = NULL; /* Cache-Control. - FM */ newAnchor->no_cache = FALSE; /* no-cache? - FM */ newAnchor->content_type = NULL; /* Content-Type. - FM */ - newAnchor->content_language = NULL; /* Content-Language. - FM */ - newAnchor->content_encoding = NULL; /* Compression algorith. - FM */ + newAnchor->content_language = NULL; /* Content-Language. - FM */ + newAnchor->content_encoding = NULL; /* Compression algorith. - FM */ newAnchor->content_base = NULL; /* Content-Base. - FM */ newAnchor->content_disposition = NULL; /* Content-Disposition. - FM */ - newAnchor->content_location = NULL; /* Content-Location. - FM */ + newAnchor->content_location = NULL; /* Content-Location. - FM */ newAnchor->content_md5 = NULL; /* Content-MD5. - FM */ newAnchor->content_length = 0; /* Content-Length. - FM */ newAnchor->date = NULL; /* Date. - FM */ @@ -110,22 +110,22 @@ PRIVATE HTChildAnchor * HTChildAnchor_new NOARGS ** s Points to one string, null terminated ** t points to the other. ** On exit, -** returns YES if the strings are equivalent ignoring case -** NO if they differ in more than their case. +** returns YES if the strings are equivalent ignoring case +** NO if they differ in more than their case. */ PRIVATE BOOL HTEquivalent ARGS2( CONST char *, s, CONST char *, t) { if (s && t) { /* Make sure they point to something */ - for (; *s && *t; s++, t++) { - if (TOUPPER(*s) != TOUPPER(*t)) { - return NO; + for (; *s && *t; s++, t++) { + if (TOUPPER(*s) != TOUPPER(*t)) { + return NO; } - } - return TOUPPER(*s) == TOUPPER(*t); + } + return TOUPPER(*s) == TOUPPER(*t); } else { - return s == t; /* Two NULLs are equivalent, aren't they ? */ + return s == t; /* Two NULLs are equivalent, aren't they ? */ } } @@ -137,7 +137,7 @@ PRIVATE BOOL HTEquivalent ARGS2( ** s Points to one string, null terminated ** t points to the other. ** On exit, -** returns YES if the strings are identical or both NULL +** returns YES if the strings are identical or both NULL ** NO if they differ. */ PRIVATE BOOL HTIdentical ARGS2( @@ -145,14 +145,14 @@ PRIVATE BOOL HTIdentical ARGS2( CONST char *, t) { if (s && t) { /* Make sure they point to something */ - for (; *s && *t; s++, t++) { - if (*s != *t) { - return NO; + for (; *s && *t; s++, t++) { + if (*s != *t) { + return NO; } - } - return *s == *t; + } + return *s == *t; } else { - return s == t; /* Two NULLs are identical, aren't they ? */ + return s == t; /* Two NULLs are identical, aren't they ? */ } } #endif /* CASE_INSENSITIVE_ANCHORS */ @@ -172,38 +172,38 @@ PUBLIC HTChildAnchor * HTAnchor_findChild ARGS2( HTList *kids; if (!parent) { - if (TRACE) + if (TRACE) fprintf(stderr, "HTAnchor_findChild called with NULL parent.\n"); - return NULL; + return NULL; } if ((kids = parent->children) != 0) { /* ** Parent has children. Search them. */ - if (tag && *tag) { /* TBL */ + if (tag && *tag) { /* TBL */ while (NULL != (child=(HTChildAnchor *)HTList_nextObject(kids))) { #ifdef CASE_INSENSITIVE_ANCHORS - if (HTEquivalent(child->tag, tag)) { /* Case insensitive */ + if (HTEquivalent(child->tag, tag)) { /* Case insensitive */ #else - if (HTIdentical(child->tag, tag)) { /* Case sensitive - FM */ + if (HTIdentical(child->tag, tag)) { /* Case sensitive - FM */ #endif /* CASE_INSENSITIVE_ANCHORS */ if (TRACE) - fprintf(stderr, + fprintf(stderr, "Child anchor %p of parent %p with name `%s' already exists.\n", - (void *)child, (void *)parent, tag); + (void *)child, (void *)parent, tag); return child; - } + } } - } /* end if tag is void */ + } /* end if tag is void */ } else { /* parent doesn't have any children yet : create family */ - parent->children = HTList_new(); + parent->children = HTList_new(); } child = HTChildAnchor_new(); if (TRACE) - fprintf(stderr, + fprintf(stderr, "new Anchor %p named `%s' is child of %p\n", - (void *)child, + (void *)child, tag ? tag : (CONST char *)"", (void *)parent); /* int for apollo */ HTList_addObject (parent->children, child); @@ -221,7 +221,7 @@ PUBLIC HTChildAnchor * HTAnchor_findChild ARGS2( ** (Code originally in ParseHTML.h) */ PUBLIC HTChildAnchor * HTAnchor_findChildAndLink ARGS4( - HTParentAnchor *, parent, /* May not be 0 */ + HTParentAnchor *, parent, /* May not be 0 */ CONST char *, tag, /* May be "" or 0 */ CONST char *, href, /* May be "" or 0 */ HTLinkType *, ltype) /* May be 0 */ @@ -229,14 +229,14 @@ PUBLIC HTChildAnchor * HTAnchor_findChildAndLink ARGS4( HTChildAnchor * child = HTAnchor_findChild(parent, tag); if (TRACE) - fprintf(stderr,"Entered HTAnchor_findChildAndLink\n"); + fprintf(stderr,"Entered HTAnchor_findChildAndLink\n"); if (href && *href) { - char *relative_to = HTAnchor_address((HTAnchor *)parent); - DocAddress parsed_doc; - HTAnchor * dest; + char *relative_to = HTAnchor_address((HTAnchor *)parent); + DocAddress parsed_doc; + HTAnchor * dest; - parsed_doc.address = HTParse(href, relative_to, PARSE_ALL); + parsed_doc.address = HTParse(href, relative_to, PARSE_ALL); #ifndef DONT_TRACK_INTERNAL_LINKS if (ltype && parent->post_data && ltype == LINK_INTERNAL) { /* for internal links, find a destination with the same @@ -252,11 +252,11 @@ PUBLIC HTChildAnchor * HTAnchor_findChildAndLink ARGS4( parsed_doc.bookmark = NULL; parsed_doc.isHEAD = FALSE; parsed_doc.safe = FALSE; - dest = HTAnchor_findAddress(&parsed_doc); + dest = HTAnchor_findAddress(&parsed_doc); - HTAnchor_link((HTAnchor *)child, dest, ltype); - FREE(parsed_doc.address); - FREE(relative_to); + HTAnchor_link((HTAnchor *)child, dest, ltype); + FREE(parsed_doc.address); + FREE(relative_to); } return child; } @@ -270,7 +270,7 @@ PRIVATE void free_adult_table NOARGS HTList * HTAp_freeme; HTParentAnchor * parent; /* - * Loop through all lists. + * Loop through all lists. */ for (i_counter = 0; i_counter < HASH_SIZE; i_counter++) { /* @@ -278,7 +278,7 @@ PRIVATE void free_adult_table NOARGS */ while (adult_table[i_counter] != NULL) { /* - ** Free off items - FM + ** Free off items - FM */ HTAp_freeme = adult_table[i_counter]; adult_table[i_counter] = HTAp_freeme->next; @@ -310,95 +310,95 @@ PUBLIC HTAnchor * HTAnchor_findAddress ARGS1( fprintf(stderr,"Entered HTAnchor_findAddress\n"); /* - ** If the address represents a sub-anchor, we recursively load its - ** parent, then we create a child anchor within that document. + ** If the address represents a sub-anchor, we recursively load its + ** parent, then we create a child anchor within that document. */ if (*tag) { - DocAddress parsed_doc; - HTParentAnchor * foundParent; - HTChildAnchor * foundAnchor; + DocAddress parsed_doc; + HTParentAnchor * foundParent; + HTChildAnchor * foundAnchor; - parsed_doc.address = HTParse(newdoc->address, "", + parsed_doc.address = HTParse(newdoc->address, "", PARSE_ACCESS | PARSE_HOST | PARSE_PATH | PARSE_PUNCTUATION); - parsed_doc.post_data = newdoc->post_data; - parsed_doc.post_content_type = newdoc->post_content_type; - parsed_doc.bookmark = newdoc->bookmark; - parsed_doc.isHEAD = newdoc->isHEAD; - parsed_doc.safe = newdoc->safe; - - foundParent = (HTParentAnchor *)HTAnchor_findAddress(&parsed_doc); - foundAnchor = HTAnchor_findChild (foundParent, tag); - FREE(parsed_doc.address); - FREE(tag); - return (HTAnchor *)foundAnchor; + parsed_doc.post_data = newdoc->post_data; + parsed_doc.post_content_type = newdoc->post_content_type; + parsed_doc.bookmark = newdoc->bookmark; + parsed_doc.isHEAD = newdoc->isHEAD; + parsed_doc.safe = newdoc->safe; + + foundParent = (HTParentAnchor *)HTAnchor_findAddress(&parsed_doc); + foundAnchor = HTAnchor_findChild (foundParent, tag); + FREE(parsed_doc.address); + FREE(tag); + return (HTAnchor *)foundAnchor; } else { - /* - ** If the address has no anchor tag, + /* + ** If the address has no anchor tag, ** check whether we have this node. */ - int hash; - HTList * adults; - HTList *grownups; - HTParentAnchor * foundAnchor; + int hash; + HTList * adults; + HTList *grownups; + HTParentAnchor * foundAnchor; - FREE(tag); + FREE(tag); - /* + /* ** Select list from hash table, */ - hash = HASH_FUNCTION(newdoc->address); - if (!adult_table) { - adult_table = (HTList **)calloc(HASH_SIZE, sizeof(HTList *)); + hash = HASH_FUNCTION(newdoc->address); + if (!adult_table) { + adult_table = (HTList **)calloc(HASH_SIZE, sizeof(HTList *)); atexit(free_adult_table); - } - if (!adult_table[hash]) - adult_table[hash] = HTList_new(); - adults = adult_table[hash]; + } + if (!adult_table[hash]) + adult_table[hash] = HTList_new(); + adults = adult_table[hash]; - /* + /* ** Search list for anchor. */ - grownups = adults; - while (NULL != (foundAnchor = + grownups = adults; + while (NULL != (foundAnchor = (HTParentAnchor *)HTList_nextObject(grownups))) { #ifdef CASE_INSENSITIVE_ANCHORS - if (HTEquivalent(foundAnchor->address, newdoc->address) && - HTEquivalent(foundAnchor->post_data, newdoc->post_data) && - foundAnchor->isHEAD == newdoc->isHEAD) + if (HTEquivalent(foundAnchor->address, newdoc->address) && + HTEquivalent(foundAnchor->post_data, newdoc->post_data) && + foundAnchor->isHEAD == newdoc->isHEAD) #else - if (HTIdentical(foundAnchor->address, newdoc->address) && - HTIdentical(foundAnchor->post_data, newdoc->post_data) && - foundAnchor->isHEAD == newdoc->isHEAD) + if (HTIdentical(foundAnchor->address, newdoc->address) && + HTIdentical(foundAnchor->post_data, newdoc->post_data) && + foundAnchor->isHEAD == newdoc->isHEAD) #endif /* CASE_INSENSITIVE_ANCHORS */ { - if (TRACE) + if (TRACE) fprintf(stderr, - "Anchor %p with address `%s' already exists.\n", + "Anchor %p with address `%s' already exists.\n", (void *)foundAnchor, newdoc->address); - return (HTAnchor *)foundAnchor; - } - } - - /* + return (HTAnchor *)foundAnchor; + } + } + + /* ** Node not found: create new anchor. */ - foundAnchor = HTParentAnchor_new(); - if (TRACE) + foundAnchor = HTParentAnchor_new(); + if (TRACE) fprintf(stderr, - "New anchor %p has hash %d and address `%s'\n", - (void *)foundAnchor, hash, newdoc->address); - StrAllocCopy(foundAnchor->address, newdoc->address); - if (newdoc->post_data) + "New anchor %p has hash %d and address `%s'\n", + (void *)foundAnchor, hash, newdoc->address); + StrAllocCopy(foundAnchor->address, newdoc->address); + if (newdoc->post_data) StrAllocCopy(foundAnchor->post_data, newdoc->post_data); - if (newdoc->post_content_type) + if (newdoc->post_content_type) StrAllocCopy(foundAnchor->post_content_type, - newdoc->post_content_type); - if (newdoc->bookmark) + newdoc->post_content_type); + if (newdoc->bookmark) StrAllocCopy(foundAnchor->bookmark, newdoc->bookmark); - foundAnchor->isHEAD = newdoc->isHEAD; - foundAnchor->safe = newdoc->safe; - HTList_addObject (adults, foundAnchor); - return (HTAnchor *)foundAnchor; + foundAnchor->isHEAD = newdoc->isHEAD; + foundAnchor->safe = newdoc->safe; + HTList_addObject (adults, foundAnchor); + return (HTAnchor *)foundAnchor; } } @@ -416,19 +416,19 @@ PRIVATE void deleteLinks ARGS1( HTAnchor *, me) { /* - * Memory leaks fixed. - * 05-27-94 Lynx 2-3-1 Garrett Arch Blythe + * Memory leaks fixed. + * 05-27-94 Lynx 2-3-1 Garrett Arch Blythe */ /* - * Anchor is NULL, do nothing. + * Anchor is NULL, do nothing. */ if (!me) { return; } /* - * Unregister me with our mainLink destination anchor's parent. + * Unregister me with our mainLink destination anchor's parent. */ if (me->mainLink.dest) { HTParentAnchor *parent = me->mainLink.dest->parent; @@ -439,7 +439,7 @@ PRIVATE void deleteLinks ARGS1( */ if (!HTList_isEmpty(parent->sources)) { /* - * Really should only need to deregister once. + * Really should only need to deregister once. */ HTList_removeObject(parent->sources, (void *)me); } @@ -470,7 +470,7 @@ PRIVATE void deleteLinks ARGS1( } /* - * Check for extra destinations in our links list. + * Check for extra destinations in our links list. */ if (!HTList_isEmpty(me->links)) { HTLink *target; @@ -484,48 +484,48 @@ PRIVATE void deleteLinks ARGS1( while ((target = (HTLink *)HTList_removeLastObject(me->links)) != 0) { parent = target->dest->parent; if (!HTList_isEmpty(parent->sources)) { - /* - * Only need to tell destination parent - * anchor once. - */ - HTList_removeObject(parent->sources, (void *)me); + /* + * Only need to tell destination parent + * anchor once. + */ + HTList_removeObject(parent->sources, (void *)me); } /* - * Avoid calling overhead. - * If the parent hasn't a loaded document, then - * we will attempt to have the parent - * delete itself. - * Don't call twice if this is the same anchor - * that we are trying to delete. - * Also, don't do this if we are trying to delete - * our parent. + * Avoid calling overhead. + * If the parent hasn't a loaded document, then + * we will attempt to have the parent + * delete itself. + * Don't call twice if this is the same anchor + * that we are trying to delete. + * Also, don't do this if we are trying to delete + * our parent. */ if (!parent->document && - (HTParentAnchor *)me != parent && - me->parent != parent) { - HTAnchor_delete(parent); + (HTParentAnchor *)me != parent && + me->parent != parent) { + HTAnchor_delete(parent); } /* - * The link structure has to be deleted, too! - * That was missing, but this code probably never - * got exercised by Lynx. - KW + * The link structure has to be deleted, too! + * That was missing, but this code probably never + * got exercised by Lynx. - KW */ FREE(target); - } + } - /* - * At this point, me no longer has any destination in - * the links list. Get rid of it. - */ - if (me->links) { + /* + * At this point, me no longer has any destination in + * the links list. Get rid of it. + */ + if (me->links) { HTList_delete(me->links); me->links = NULL; - } + } } /* - * Catch in case links list exists but nothing in it. + * Catch in case links list exists but nothing in it. */ if (me->links) { HTList_delete(me->links); @@ -537,46 +537,46 @@ PUBLIC BOOL HTAnchor_delete ARGS1( HTParentAnchor *, me) { /* - * Memory leaks fixed. + * Memory leaks fixed. * 05-27-94 Lynx 2-3-1 Garrett Arch Blythe */ HTList *cur; HTChildAnchor *child; /* - * Do nothing if nothing to do. + * Do nothing if nothing to do. */ if (!me) { return(NO); } /* - * Don't delete if document is loaded or being loaded. + * Don't delete if document is loaded or being loaded. */ if (me->document || me->underway) { return(NO); } /* - * Recursively try to delete destination anchors of this parent. - * In any event, this will tell all destination anchors that we - * no longer consider them a destination. + * Recursively try to delete destination anchors of this parent. + * In any event, this will tell all destination anchors that we + * no longer consider them a destination. */ deleteLinks((HTAnchor *)me); /* - * There are still incoming links to this one (we are the - * destination of another anchor). - * Don't actually delete this anchor, but children are OK to - * delete their links. + * There are still incoming links to this one (we are the + * destination of another anchor). + * Don't actually delete this anchor, but children are OK to + * delete their links. */ if (!HTList_isEmpty(me->sources)) { - /* + /* * Delete all outgoing links from children, do not * delete the children, though. */ if (!HTList_isEmpty(me->children)) { - cur = me->children; + cur = me->children; while ((child = (HTChildAnchor *)HTList_nextObject(cur)) != 0) { if (child != NULL) { deleteLinks((HTAnchor *)child); @@ -591,8 +591,8 @@ PUBLIC BOOL HTAnchor_delete ARGS1( } /* - * No more incoming links : kill everything - * First, recursively delete children and their links. + * No more incoming links : kill everything + * First, recursively delete children and their links. */ if (!HTList_isEmpty(me->children)) { while ((child = (HTChildAnchor *)HTList_removeLastObject( @@ -608,7 +608,7 @@ PUBLIC BOOL HTAnchor_delete ARGS1( } /* - * Delete our empty list of children. + * Delete our empty list of children. */ if (me->children) { HTList_delete(me->children); @@ -624,7 +624,7 @@ PUBLIC BOOL HTAnchor_delete ARGS1( } /* - * Delete the methods list. + * Delete the methods list. */ if (me->methods) { /* @@ -636,7 +636,7 @@ PUBLIC BOOL HTAnchor_delete ARGS1( } /* - * Free up all allocated members. + * Free up all allocated members. */ FREE(me->charset); FREE(me->isIndexAction); @@ -672,9 +672,9 @@ PUBLIC BOOL HTAnchor_delete ARGS1( #ifdef USE_HASH FREE(me->style); #endif - + /* - * Remove ourselves from the hash table's list. + * Remove ourselves from the hash table's list. */ if (adult_table) { unsigned short int usi_hash = HASH_FUNCTION(me->address); @@ -685,14 +685,14 @@ PUBLIC BOOL HTAnchor_delete ARGS1( } /* - * Original code wanted a way to clean out the HTFormat if no - * longer needed (ref count?). I'll leave it alone since - * those HTAtom objects are a little harder to know where - * they are being referenced all at one time. (near static) + * Original code wanted a way to clean out the HTFormat if no + * longer needed (ref count?). I'll leave it alone since + * those HTAtom objects are a little harder to know where + * they are being referenced all at one time. (near static) */ /* - * Free the address. + * Free the address. */ FREE(me->address); @@ -701,7 +701,7 @@ PUBLIC BOOL HTAnchor_delete ARGS1( /* - * Finally, kill the parent anchor passed in. + * Finally, kill the parent anchor passed in. */ FREE(me); @@ -719,7 +719,7 @@ PUBLIC void HTAnchor_makeLastChild ARGS1( HTChildAnchor *, me) { if (me->parent != (HTParentAnchor *)me) { /* Make sure it's a child */ - HTList * siblings = me->parent->children; + HTList * siblings = me->parent->children; HTList_removeObject (siblings, me); HTList_addObject (siblings, me); } @@ -739,7 +739,7 @@ PUBLIC void HTAnchor_setDocument ARGS2( HyperDoc *, doc) { if (me) - me->document = doc; + me->document = doc; } PUBLIC HyperDoc * HTAnchor_document ARGS1( @@ -752,10 +752,10 @@ PUBLIC HyperDoc * HTAnchor_document ARGS1( /* We don't want code to change an address after anchor creation... yet ? PUBLIC void HTAnchor_setAddress ARGS2( HTAnchor *, me, - char *, addr) + char *, addr) { if (me) - StrAllocCopy (me->parent->address, addr); + StrAllocCopy (me->parent->address, addr); } */ @@ -765,18 +765,18 @@ PUBLIC char * HTAnchor_address ARGS1( char *addr = NULL; if (me) { - if (((HTParentAnchor *)me == me->parent) || - !((HTChildAnchor *)me)->tag) { /* it's an adult or no tag */ - StrAllocCopy(addr, me->parent->address); - } else { /* it's a named child */ - addr = malloc(2 + - strlen(me->parent->address) + + if (((HTParentAnchor *)me == me->parent) || + !((HTChildAnchor *)me)->tag) { /* it's an adult or no tag */ + StrAllocCopy(addr, me->parent->address); + } else { /* it's a named child */ + addr = malloc(2 + + strlen(me->parent->address) + strlen(((HTChildAnchor *)me)->tag)); - if (addr == NULL) - outofmem(__FILE__, "HTAnchor_address"); - sprintf(addr, "%s#%s", - me->parent->address, ((HTChildAnchor *)me)->tag); - } + if (addr == NULL) + outofmem(__FILE__, "HTAnchor_address"); + sprintf(addr, "%s#%s", + me->parent->address, ((HTChildAnchor *)me)->tag); + } } return addr; } @@ -786,7 +786,7 @@ PUBLIC void HTAnchor_setFormat ARGS2( HTFormat, form) { if (me) - me->format = form; + me->format = form; } PUBLIC HTFormat HTAnchor_format ARGS1( @@ -797,20 +797,20 @@ PUBLIC HTFormat HTAnchor_format ARGS1( PUBLIC void HTAnchor_setIndex ARGS2( HTParentAnchor *, me, - char *, address) + char *, address) { if (me) { - me->isIndex = YES; + me->isIndex = YES; StrAllocCopy(me->isIndexAction, address); } } PUBLIC void HTAnchor_setPrompt ARGS2( HTParentAnchor *, me, - char *, prompt) + char *, prompt) { if (me) { - StrAllocCopy(me->isIndexPrompt, prompt); + StrAllocCopy(me->isIndexPrompt, prompt); } } @@ -836,20 +836,20 @@ PUBLIC BOOL HTAnchor_hasChildren ARGS1( } #if defined(USE_HASH) -/* Style handling. +/* Style handling. */ PUBLIC CONST char * HTAnchor_style ARGS1( - HTParentAnchor *, me) + HTParentAnchor *, me) { - return me ? me->style : NULL; + return me ? me->style : NULL; } PUBLIC void HTAnchor_setStyle ARGS2( - HTParentAnchor *, me, - CONST char *, style) + HTParentAnchor *, me, + CONST char *, style) { if (me) { - StrAllocCopy(me->style, style); + StrAllocCopy(me->style, style); } } #endif @@ -870,13 +870,13 @@ PUBLIC void HTAnchor_setTitle ARGS2( int i; if (me) { - StrAllocCopy(me->title, title); - for (i = 0; me->title[i]; i++) { - if ((unsigned char)me->title[i] == 1 || - (unsigned char)me->title[i] == 2) { - me->title[i] = ' '; + StrAllocCopy(me->title, title); + for (i = 0; me->title[i]; i++) { + if ((unsigned char)me->title[i] == 1 || + (unsigned char)me->title[i] == 2) { + me->title[i] = ' '; } - } + } } } @@ -887,13 +887,13 @@ PUBLIC void HTAnchor_appendTitle ARGS2( int i; if (me) { - StrAllocCat(me->title, title); - for (i = 0; me->title[i]; i++) { - if ((unsigned char)me->title[i] == 1 || - (unsigned char)me->title[i] == 2) { - me->title[i] = ' '; + StrAllocCat(me->title, title); + for (i = 0; me->title[i]; i++) { + if ((unsigned char)me->title[i] == 1 || + (unsigned char)me->title[i] == 2) { + me->title[i] = ' '; } - } + } } } @@ -910,7 +910,7 @@ PUBLIC void HTAnchor_setBookmark ARGS2( CONST char *, bookmark) { if (me) - StrAllocCopy(me->bookmark, bookmark); + StrAllocCopy(me->bookmark, bookmark); } /* Owner handling. @@ -926,11 +926,11 @@ PUBLIC void HTAnchor_setOwner ARGS2( CONST char *, owner) { if (me) { - StrAllocCopy(me->owner, owner); + StrAllocCopy(me->owner, owner); } } -/* TITLE handling in LINKs with REV="made" or REV="owner". - FM +/* TITLE handling in LINKs with REV="made" or REV="owner". - FM */ PUBLIC CONST char * HTAnchor_RevTitle ARGS1( HTParentAnchor *, me) @@ -945,13 +945,13 @@ PUBLIC void HTAnchor_setRevTitle ARGS2( int i; if (me) { - StrAllocCopy(me->RevTitle, title); - for (i = 0; me->RevTitle[i]; i++) { - if ((unsigned char)me->RevTitle[i] == 1 || - (unsigned char)me->RevTitle[i] == 2) { - me->RevTitle[i] = ' '; + StrAllocCopy(me->RevTitle, title); + for (i = 0; me->RevTitle[i]; i++) { + if ((unsigned char)me->RevTitle[i] == 1 || + (unsigned char)me->RevTitle[i] == 2) { + me->RevTitle[i] = ' '; } - } + } } } @@ -1040,25 +1040,25 @@ PUBLIC BOOL HTAnchor_link ARGS3( HTLinkType *, type) { if (!(source && destination)) - return NO; /* Can't link to/from non-existing anchor */ + return NO; /* Can't link to/from non-existing anchor */ if (TRACE) - fprintf(stderr, - "Linking anchor %p to anchor %p\n", source, destination); + fprintf(stderr, + "Linking anchor %p to anchor %p\n", source, destination); if (!source->mainLink.dest) { - source->mainLink.dest = destination; - source->mainLink.type = type; + source->mainLink.dest = destination; + source->mainLink.type = type; } else { - HTLink * newLink = (HTLink *)calloc (1, sizeof (HTLink)); - if (newLink == NULL) + HTLink * newLink = (HTLink *)calloc (1, sizeof (HTLink)); + if (newLink == NULL) outofmem(__FILE__, "HTAnchor_link"); - newLink->dest = destination; - newLink->type = type; - if (!source->links) - source->links = HTList_new(); - HTList_addObject (source->links, newLink); + newLink->dest = destination; + newLink->type = type; + if (!source->links) + source->links = HTList_new(); + HTList_addObject (source->links, newLink); } if (!destination->parent->sources) - destination->parent->sources = HTList_new(); + destination->parent->sources = HTList_new(); HTList_addObject (destination->parent->sources, source); return YES; /* Success */ } @@ -1078,13 +1078,13 @@ PUBLIC HTAnchor * HTAnchor_followTypedLink ARGS2( HTLinkType *, type) { if (me->mainLink.type == type) - return me->mainLink.dest; + return me->mainLink.dest; if (me->links) { - HTList *links = me->links; - HTLink *the_link; - while (NULL != (the_link=(HTLink *)HTList_nextObject(links))) { - if (the_link->type == type) { - return the_link->dest; + HTList *links = me->links; + HTLink *the_link; + while (NULL != (the_link=(HTLink *)HTList_nextObject(links))) { + if (the_link->type == type) { + return the_link->dest; } } } @@ -1100,21 +1100,21 @@ PUBLIC BOOL HTAnchor_makeMainLink ARGS2( { /* Check that everything's OK */ if (!(me && HTList_removeObject (me->links, movingLink))) { - return NO; /* link not found or NULL anchor */ + return NO; /* link not found or NULL anchor */ } else { - /* First push current main link onto top of links list */ - HTLink *newLink = (HTLink *)calloc (1, sizeof (HTLink)); - if (newLink == NULL) + /* First push current main link onto top of links list */ + HTLink *newLink = (HTLink *)calloc (1, sizeof (HTLink)); + if (newLink == NULL) outofmem(__FILE__, "HTAnchor_makeMainLink"); - memcpy((void *)newLink, + memcpy((void *)newLink, (CONST char *)&me->mainLink, sizeof (HTLink)); - HTList_addObject (me->links, newLink); + HTList_addObject (me->links, newLink); - /* Now make movingLink the new main link, and free it */ - memcpy((void *)&me->mainLink, + /* Now make movingLink the new main link, and free it */ + memcpy((void *)&me->mainLink, (CONST void *)movingLink, sizeof (HTLink)); - FREE(movingLink); - return YES; + FREE(movingLink); + return YES; } } @@ -1126,7 +1126,7 @@ PUBLIC HTList * HTAnchor_methods ARGS1( HTParentAnchor *, me) { if (!me->methods) { - me->methods = HTList_new(); + me->methods = HTList_new(); } return me->methods; } @@ -1158,10 +1158,10 @@ PUBLIC char * HTAnchor_physical ARGS1( PUBLIC void HTAnchor_setPhysical ARGS2( HTParentAnchor *, me, - char *, physical) + char *, physical) { if (me) { - StrAllocCopy(me->physical, physical); + StrAllocCopy(me->physical, physical); } } @@ -1169,16 +1169,16 @@ PUBLIC void HTAnchor_setPhysical ARGS2( ** We store charset info in the HTParentAnchor object, for several ** "stages". (See UCDefs.h) ** A stream method is supposed to know what stage in the model it is. -** -** General model MIME -> parser -> structured -> HText +** +** General model MIME -> parser -> structured -> HText ** e.g., text/html -** from HTTP: HTMIME.c -> SGML.c -> HTML.c -> GridText.c -** text/plain -** from file: HTFile.c -> HTPlain.c -> GridText.c +** from HTTP: HTMIME.c -> SGML.c -> HTML.c -> GridText.c +** text/plain +** from file: HTFile.c -> HTPlain.c -> GridText.c ** ** The lock/set_by is used to lock e.g. a charset set by an explicit -** HTTP MIME header against overriding by a HTML META tag - the MIME -** header has higher priority. Defaults (from -assume_.. options etc.) +** HTTP MIME header against overriding by a HTML META tag - the MIME +** header has higher priority. Defaults (from -assume_.. options etc.) ** will not override charset explicitly given by server. ** ** Some advantages of keeping this in the HTAnchor: @@ -1199,7 +1199,7 @@ PUBLIC LYUCcharset * HTAnchor_getUCInfoStage ARGS2( UCAnchorInfo * stages = (UCAnchorInfo*)calloc(1, sizeof(UCAnchorInfo)); if (stages == NULL) - outofmem(__FILE__, "HTAnchor_getUCInfoStage"); + outofmem(__FILE__, "HTAnchor_getUCInfoStage"); for (i = 0; i < UCT_STAGEMAX; i++) { stages->s[i].C.MIMEname = ""; stages->s[i].LYhndl = -1; @@ -1216,7 +1216,7 @@ PUBLIC LYUCcharset * HTAnchor_getUCInfoStage ARGS2( stages->s[UCT_STAGE_MIME].lock = UCT_SETBY_DEFAULT; } else { /* - * Should not happen... + * Should not happen... */ stages->s[UCT_STAGE_MIME].C.UChndl = -1; stages->s[UCT_STAGE_MIME].lock = UCT_SETBY_NONE; @@ -1232,12 +1232,12 @@ PUBLIC LYUCcharset * HTAnchor_getUCInfoStage ARGS2( PUBLIC int HTAnchor_getUCLYhndl ARGS2( HTParentAnchor *, me, - int, which_stage) + int, which_stage) { if (me) { if (!me->UCStages) { /* - * This will allocate and initialize, if not yet done. + * This will allocate and initialize, if not yet done. */ (void) HTAnchor_getUCInfoStage(me, which_stage); } diff --git a/WWW/Library/Implementation/HTAnchor.h b/WWW/Library/Implementation/HTAnchor.h index 4b751d03..e3847184 100644 --- a/WWW/Library/Implementation/HTAnchor.h +++ b/WWW/Library/Implementation/HTAnchor.h @@ -1,11 +1,11 @@ -/* /Net/dxcern/userd/timbl/hypertext/WWW/Library/Implementation/HTAnchor.html +/* /Net/dxcern/userd/timbl/hypertext/WWW/Library/Implementation/HTAnchor.html */ -/* Hypertext "Anchor" Object HTAnchor.h -** ========================== +/* Hypertext "Anchor" Object HTAnchor.h +** ========================== ** -** An anchor represents a region of a hypertext document which is linked -** to another anchor in the same or a different document. +** An anchor represents a region of a hypertext document which is linked +** to another anchor in the same or a different document. */ #ifndef HTANCHOR_H @@ -19,93 +19,93 @@ #include "UCDefs.h" #ifdef SHORT_NAMES -#define HTAnchor_findChild HTAnFiCh -#define HTAnchor_findChildAndLink HTAnFiLi -#define HTAnchor_findAddress HTAnFiAd -#define HTAnchor_delete HTAnDele -#define HTAnchor_makeLastChild HTAnMaLa -#define HTAnchor_parent HTAnPare -#define HTAnchor_setDocument HTAnSeDo -#define HTAnchor_document HTAnDocu -#define HTAnchor_setFormat HTAnSeFo -#define HTAnchor_format HTAnForm -#define HTAnchor_setIndex HTAnSeIn -#define HTAnchor_setPrompt HTAnSePr -#define HTAnchor_isIndex HTAnIsIn -#define HTAnchor_address HTAnAddr -#define HTAnchor_hasChildren HTAnHaCh -#define HTAnchor_title HTAnTitl -#define HTAnchor_setTitle HTAnSeTi -#define HTAnchor_appendTitle HTAnApTi -#define HTAnchor_link HTAnLink -#define HTAnchor_followMainLink HTAnFoMa -#define HTAnchor_followTypedLink HTAnFoTy -#define HTAnchor_makeMainLink HTAnMaMa -#define HTAnchor_setProtocol HTAnSePr -#define HTAnchor_protocol HTAnProt -#define HTAnchor_physical HTAnPhys -#define HTAnchor_setPhysical HTAnSePh -#define HTAnchor_methods HtAnMeth -#endif - -/* Main definition of anchor -** ========================= +#define HTAnchor_findChild HTAnFiCh +#define HTAnchor_findChildAndLink HTAnFiLi +#define HTAnchor_findAddress HTAnFiAd +#define HTAnchor_delete HTAnDele +#define HTAnchor_makeLastChild HTAnMaLa +#define HTAnchor_parent HTAnPare +#define HTAnchor_setDocument HTAnSeDo +#define HTAnchor_document HTAnDocu +#define HTAnchor_setFormat HTAnSeFo +#define HTAnchor_format HTAnForm +#define HTAnchor_setIndex HTAnSeIn +#define HTAnchor_setPrompt HTAnSePr +#define HTAnchor_isIndex HTAnIsIn +#define HTAnchor_address HTAnAddr +#define HTAnchor_hasChildren HTAnHaCh +#define HTAnchor_title HTAnTitl +#define HTAnchor_setTitle HTAnSeTi +#define HTAnchor_appendTitle HTAnApTi +#define HTAnchor_link HTAnLink +#define HTAnchor_followMainLink HTAnFoMa +#define HTAnchor_followTypedLink HTAnFoTy +#define HTAnchor_makeMainLink HTAnMaMa +#define HTAnchor_setProtocol HTAnSePr +#define HTAnchor_protocol HTAnProt +#define HTAnchor_physical HTAnPhys +#define HTAnchor_setPhysical HTAnSePh +#define HTAnchor_methods HtAnMeth +#endif /* SHORT_NAMES */ + +/* Main definition of anchor +** ========================= */ typedef struct _HyperDoc HyperDoc; /* Ready for forward references */ typedef struct _HTAnchor HTAnchor; typedef struct _HTParentAnchor HTParentAnchor; -/* After definition of HTFormat: */ +/* After definition of HTFormat: */ #include "HTFormat.h" typedef HTAtom HTLinkType; typedef struct { - HTAnchor * dest; /* The anchor to which this leads */ - HTLinkType * type; /* Semantics of this link */ + HTAnchor * dest; /* The anchor to which this leads */ + HTLinkType * type; /* Semantics of this link */ } HTLink; -struct _HTAnchor { /* Generic anchor : just links */ - HTLink mainLink; /* Main (or default) destination of this */ - HTList * links; /* List of extra links from this, if any */ +struct _HTAnchor { /* Generic anchor : just links */ + HTLink mainLink; /* Main (or default) destination of this */ + HTList * links; /* List of extra links from this, if any */ /* We separate the first link from the others to avoid too many small mallocs involved by a list creation. Most anchors only point to one place. */ - HTParentAnchor * parent; /* Parent of this anchor (self for adults) */ + HTParentAnchor * parent; /* Parent of this anchor (self for adults) */ }; struct _HTParentAnchor { /* Common part from the generic anchor structure */ - HTLink mainLink; /* Main (or default) destination of this */ - HTList * links; /* List of extra links from this, if any */ - HTParentAnchor * parent; /* Parent of this anchor (self) */ + HTLink mainLink; /* Main (or default) destination of this */ + HTList * links; /* List of extra links from this, if any */ + HTParentAnchor * parent; /* Parent of this anchor (self) */ /* ParentAnchor-specific information */ - HTList * children; /* Subanchors of this, if any */ - HTList * sources; /* List of anchors pointing to this, if any */ - HyperDoc * document; /* The document within which this is an anchor */ - char * address; /* Absolute address of this node */ - char * post_data; /* Posting data */ - char * post_content_type; /* Type of post data */ + HTList * children; /* Subanchors of this, if any */ + HTList * sources; /* List of anchors pointing to this, if any */ + HyperDoc * document; /* The document within which this is an anchor */ + char * address; /* Absolute address of this node */ + char * post_data; /* Posting data */ + char * post_content_type; /* Type of post data */ char * bookmark; /* Bookmark filname */ - HTFormat format; /* Pointer to node format descriptor */ + HTFormat format; /* Pointer to node format descriptor */ char * charset; /* Pointer to character set (kludge, for now */ - BOOL isIndex; /* Acceptance of a keyword search */ - char * isIndexAction; /* URL of isIndex server */ - char * isIndexPrompt; /* Prompt for isIndex query */ - char * title; /* Title of document */ - char * owner; /* Owner of document */ - char * RevTitle; /* TITLE in REV="made" or REV="owner" LINK */ + BOOL isIndex; /* Acceptance of a keyword search */ + char * isIndexAction; /* URL of isIndex server */ + char * isIndexPrompt; /* Prompt for isIndex query */ + char * title; /* Title of document */ + char * owner; /* Owner of document */ + char * RevTitle; /* TITLE in REV="made" or REV="owner" LINK */ #ifdef USE_HASH char * style; #endif - HTList* methods; /* Methods available as HTAtoms */ - void * protocol; /* Protocol object */ - char * physical; /* Physical address */ - BOOL underway; /* Document about to be attached to it */ + HTList* methods; /* Methods available as HTAtoms */ + void * protocol; /* Protocol object */ + char * physical; /* Physical address */ + BOOL underway; /* Document about to be attached to it */ BOOL isISMAPScript; /* Script for clickable image map */ - BOOL isHEAD; /* Document is headers from a HEAD request */ + BOOL isHEAD; /* Document is headers from a HEAD request */ BOOL safe; /* Safe */ char * FileCache; /* Path to a disk-cached copy */ char * SugFname; /* Suggested filename */ @@ -118,23 +118,23 @@ struct _HTParentAnchor { char * content_disposition; /* Content-Dispositon */ char * content_location; /* Content-Location */ char * content_md5; /* Content-MD5 */ - int content_length; /* Content-Length */ + int content_length; /* Content-Length */ char * date; /* Date */ char * expires; /* Expires */ char * last_modified; /* Last-Modified */ - char * server; /* Server */ - UCAnchorInfo * UCStages; /* chartrans stages */ + char * server; /* Server */ + UCAnchorInfo *UCStages; /* chartrans stages */ HTList * imaps; /* client side image maps */ }; typedef struct { /* Common part from the generic anchor structure */ - HTLink mainLink; /* Main (or default) destination of this */ - HTList * links; /* List of extra links from this, if any */ - HTParentAnchor * parent; /* Parent of this anchor */ + HTLink mainLink; /* Main (or default) destination of this */ + HTList * links; /* List of extra links from this, if any */ + HTParentAnchor * parent; /* Parent of this anchor */ /* ChildAnchor-specific information */ - char * tag; /* Address of this anchor relative to parent */ + char * tag; /* Address of this anchor relative to parent */ } HTChildAnchor; /* @@ -156,63 +156,63 @@ typedef struct _DocAddress { #define LINK_INTERNAL HTAtom_for("internal link") -/* Create new or find old sub-anchor -** --------------------------------- +/* Create new or find old sub-anchor +** --------------------------------- ** -** This one is for a new anchor being edited into an existing -** document. The parent anchor must already exist. +** This one is for a new anchor being edited into an existing +** document. The parent anchor must already exist. */ extern HTChildAnchor * HTAnchor_findChild PARAMS(( HTParentAnchor * parent, CONST char * tag)); -/* Create or find a child anchor with a possible link -** -------------------------------------------------- +/* Create or find a child anchor with a possible link +** -------------------------------------------------- ** -** Create new anchor with a given parent and possibly -** a name, and possibly a link to a _relatively_ named anchor. -** (Code originally in ParseHTML.h) +** Create new anchor with a given parent and possibly +** a name, and possibly a link to a _relatively_ named anchor. +** (Code originally in ParseHTML.h) */ extern HTChildAnchor * HTAnchor_findChildAndLink PARAMS(( HTParentAnchor * parent, /* May not be 0 */ - CONST char * tag, /* May be "" or 0 */ + CONST char * tag, /* May be "" or 0 */ CONST char * href, /* May be "" or 0 */ HTLinkType * ltype)); /* May be 0 */ -/* Create new or find old named anchor -** ----------------------------------- +/* Create new or find old named anchor +** ----------------------------------- ** -** This one is for a reference which is found in a document, and might -** not be already loaded. -** Note: You are not guaranteed a new anchor -- you might get an old one, -** like with fonts. +** This one is for a reference which is found in a document, and might +** not be already loaded. +** Note: You are not guaranteed a new anchor -- you might get an old one, +** like with fonts. */ extern HTAnchor * HTAnchor_findAddress PARAMS(( CONST DocAddress * address)); -/* Delete an anchor and possibly related things (auto garbage collection) -** -------------------------------------------- +/* Delete an anchor and possibly related things (auto garbage collection) +** -------------------------------------------- ** -** The anchor is only deleted if the corresponding document is not loaded. -** All outgoing links from parent and children are deleted, and this anchor -** is removed from the sources list of all its targets. -** We also try to delete the targets whose documents are not loaded. -** If this anchor's source list is empty, we delete it and its children. +** The anchor is only deleted if the corresponding document is not loaded. +** All outgoing links from parent and children are deleted, and this anchor +** is removed from the sources list of all its targets. +** We also try to delete the targets whose documents are not loaded. +** If this anchor's source list is empty, we delete it and its children. */ extern BOOL HTAnchor_delete PARAMS(( HTParentAnchor * me)); -/* Move an anchor to the head of the list of its siblings -** ------------------------------------------------------ +/* Move an anchor to the head of the list of its siblings +** ------------------------------------------------------ ** -** This is to ensure that an anchor which might have already existed -** is put in the correct order as we load the document. +** This is to ensure that an anchor which might have already existed +** is put in the correct order as we load the document. */ extern void HTAnchor_makeLastChild PARAMS(( - HTChildAnchor * me)); + HTChildAnchor * me)); -/* Data access functions -** --------------------- +/* Data access functions +** --------------------- */ extern HTParentAnchor * HTAnchor_parent PARAMS(( HTAnchor * me)); @@ -230,8 +230,8 @@ extern void HTAnchor_setAddress PARAMS(( char * addr)); */ -/* Returns the full URI of the anchor, child or parent -** as a malloc'd string to be freed by the caller. +/* Returns the full URI of the anchor, child or parent +** as a malloc'd string to be freed by the caller. */ extern char * HTAnchor_address PARAMS(( HTAnchor * me)); @@ -269,7 +269,7 @@ extern void HTAnchor_setStyle PARAMS(( CONST char * style)); #endif -/* Title handling. +/* Title handling. */ extern CONST char * HTAnchor_title PARAMS(( HTParentAnchor * me)); @@ -291,7 +291,7 @@ extern void HTAnchor_setBookmark PARAMS(( HTParentAnchor * me, CONST char * bookmark)); -/* Owner handling. +/* Owner handling. */ extern CONST char * HTAnchor_owner PARAMS(( HTParentAnchor * me)); @@ -300,7 +300,7 @@ extern void HTAnchor_setOwner PARAMS(( HTParentAnchor * me, CONST char * owner)); -/* TITLE handling in LINKs with REV="made" or REV="owner". - FM +/* TITLE handling in LINKs with REV="made" or REV="owner". - FM */ extern CONST char * HTAnchor_RevTitle PARAMS(( HTParentAnchor * me)); @@ -358,16 +358,16 @@ extern CONST char * HTAnchor_content_base PARAMS(( extern CONST char * HTAnchor_content_location PARAMS(( HTParentAnchor * me)); -/* Link this Anchor to another given one -** ------------------------------------- +/* Link this Anchor to another given one +** ------------------------------------- */ extern BOOL HTAnchor_link PARAMS(( HTAnchor * source, HTAnchor * destination, HTLinkType * type)); -/* Manipulation of links -** --------------------- +/* Manipulation of links +** --------------------- */ extern HTAnchor * HTAnchor_followMainLink PARAMS(( HTAnchor * me)); @@ -380,14 +380,14 @@ extern BOOL HTAnchor_makeMainLink PARAMS(( HTAnchor * me, HTLink * movingLink)); -/* Read and write methods -** ---------------------- +/* Read and write methods +** ---------------------- */ extern HTList * HTAnchor_methods PARAMS(( HTParentAnchor * me)); -/* Protocol -** -------- +/* Protocol +** -------- */ extern void * HTAnchor_protocol PARAMS(( HTParentAnchor * me)); @@ -396,8 +396,8 @@ extern void HTAnchor_setProtocol PARAMS(( HTParentAnchor * me, void * protocol)); -/* Physical address -** ---------------- +/* Physical address +** ---------------- */ extern char * HTAnchor_physical PARAMS(( HTParentAnchor * me)); @@ -406,31 +406,42 @@ extern void HTAnchor_setPhysical PARAMS(( HTParentAnchor * me, char * protocol)); -#endif /* HTANCHOR_H */ +extern LYUCcharset * HTAnchor_getUCInfoStage PARAMS(( + HTParentAnchor * me, + int which_stage)); +extern int HTAnchor_getUCLYhndl PARAMS(( + HTParentAnchor * me, + int which_stage)); + +extern LYUCcharset * HTAnchor_setUCInfoStage PARAMS(( + HTParentAnchor * me, + int LYhndl, + int which_stage, + int set_by)); -extern LYUCcharset * HTAnchor_getUCInfoStage PARAMS((HTParentAnchor * me, - int which_stage)); -extern int HTAnchor_getUCLYhndl PARAMS((HTParentAnchor * me, - int which_stage)); -extern LYUCcharset * HTAnchor_setUCInfoStage PARAMS((HTParentAnchor * me, - int LYhndl, - int which_stage, - int set_by)); -extern LYUCcharset * HTAnchor_setUCInfoStage PARAMS((HTParentAnchor * me, - int LYhndl, - int which_stage, - int set_by)); -extern LYUCcharset * HTAnchor_resetUCInfoStage PARAMS((HTParentAnchor * me, - int LYhndl, - int which_stage, - int set_by)); -extern LYUCcharset * HTAnchor_copyUCInfoStage PARAMS((HTParentAnchor * me, - int to_stage, - int from_stage, - int set_by)); +extern LYUCcharset * HTAnchor_setUCInfoStage PARAMS(( + HTParentAnchor * me, + int LYhndl, + int which_stage, + int set_by)); + +extern LYUCcharset * HTAnchor_resetUCInfoStage PARAMS(( + HTParentAnchor * me, + int LYhndl, + int which_stage, + int set_by)); + +extern LYUCcharset * HTAnchor_copyUCInfoStage PARAMS(( + HTParentAnchor * me, + int to_stage, + int from_stage, + int set_by)); extern void ImageMapList_free PARAMS((HTList * list)); + +#endif /* HTANCHOR_H */ + /* */ diff --git a/WWW/Library/Implementation/HTDOS.c b/WWW/Library/Implementation/HTDOS.c index 05e56194..94fa6d98 100644 --- a/WWW/Library/Implementation/HTDOS.c +++ b/WWW/Library/Implementation/HTDOS.c @@ -78,17 +78,17 @@ char * HTDOS_name(char *dosname) { if((cp_url[1] == '\\') || (cp_url[0] != '\\')) { -/* +#if 0 printf("\n\n%s = i%\n\n",cp_url,strlen(cp_url)); sleep(5); -/**/ +#endif strcpy(dosname, cp_url); return(dosname); /* return(cp_url); */ } else { -/* +#if 0 printf("\n\n%s = %i\n\n",cp_url+1,strlen(cp_url)); sleep(5); -/**/ +#endif strcpy(dosname, cp_url+1); return(dosname); /* return(cp_url+1); */ } diff --git a/WWW/Library/Implementation/HTFTP.c b/WWW/Library/Implementation/HTFTP.c index ac909d75..245e515a 100644 --- a/WWW/Library/Implementation/HTFTP.c +++ b/WWW/Library/Implementation/HTFTP.c @@ -186,7 +186,7 @@ PRIVATE int server_type = GENERIC_SERVER; /* the type of ftp host */ PRIVATE int unsure_type = FALSE; /* sure about the type? */ PRIVATE BOOLEAN use_list = FALSE; /* use the LIST command? */ -PRIVATE interrupted_in_next_data_char = FALSE; +PRIVATE int interrupted_in_next_data_char = FALSE; #ifdef POLL_PORTS PRIVATE unsigned short port_number = FIRST_TCP_PORT; @@ -213,15 +213,6 @@ PRIVATE int close_connection PARAMS(( connection * con)); -PRIVATE void cleanup_ftp NOARGS -{ - if (control) { - if (control->socket != -1) - close_connection(control); - FREE(control); - } -} - /* ** This function frees module globals. - FM */ @@ -229,7 +220,11 @@ PRIVATE void free_FTPGlobals NOARGS { FREE(user_entered_password); FREE(last_username_and_host); - cleanup_ftp(); + if (control) { + if (control->socket != -1) + close_connection(control); + FREE(control); + } } /* PUBLIC HTMake_VMS_name() @@ -540,7 +535,7 @@ PRIVATE int set_mac_binary ARGS1( if (ServerType == APPLESHARE_SERVER || ServerType == NETPRESENZ_SERVER) { /* - * Presumably E means "Enable" - kw + * Presumably E means "Enable". - KW */ return(2 == response("MACB E\r\n")); } else { @@ -660,7 +655,6 @@ PRIVATE int get_connection ARGS2( if (con == NULL) outofmem(__FILE__, "get_connection"); } - con->socket = -1; if (!arg) return -1; /* Bad if no name specified */ @@ -2633,7 +2627,7 @@ unload_btree: server_type == NETPRESENZ_SERVER) { /* * Without closing the data socket first, - * the response(NIL) below hangs... - kw + * the response(NIL) below hangs. - KW */ NETCLOSE(data_soc); } diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c index d3086008..0b0a830c 100644 --- a/WWW/Library/Implementation/HTFile.c +++ b/WWW/Library/Implementation/HTFile.c @@ -13,9 +13,9 @@ ** Apr 91 vms-vms access included using DECnet syntax ** 26 Jun 92 (JFG) When running over DECnet, suppressed FTP. ** Fixed access bug for relative names on VMS. -** Sep 93 (MD) Access to VMS files allows sharing. +** Sep 93 (MD) Access to VMS files allows sharing. ** 15 Nov 93 (MD) Moved HTVMSname to HTVMSUTILS.C -** 27 Dec 93 (FM) FTP now works with VMS hosts. +** 27 Dec 93 (FM) FTP now works with VMS hosts. ** FTP path must be Unix-style and cannot include ** the device or top directory. */ @@ -45,13 +45,13 @@ #include <grp.h> #endif /* LONG_LIST */ #endif /* !VMS */ - + #ifdef USE_ZLIB #include <GridText.h> #endif #define INFINITY 512 /* file name length @@ FIXME */ -#define MULTI_SUFFIX ".multi" /* Extension for scanning formats */ +#define MULTI_SUFFIX ".multi" /* Extension for scanning formats */ #define HT_EM_SPACE ((char)2) @@ -88,7 +88,7 @@ typedef struct _HTSuffix { char * suffix; HTAtom * rep; HTAtom * encoding; - char * desc; + char * desc; float quality; } HTSuffix; @@ -107,7 +107,7 @@ typedef struct _HTSuffix { #define START(e) (*target->isa->start_element)(target, e, 0, 0, -1, 0) #define END(e) (*target->isa->end_element)(target, e, 0) #define MAYBE_END(e) if (HTML_dtd.tags[e].contents != SGML_EMPTY) \ - (*target->isa->end_element)(target, e, 0) + (*target->isa->end_element)(target, e, 0) #define FREE_TARGET (*target->isa->_free)(target) struct _HTStructured { CONST HTStructuredClass * isa; @@ -140,7 +140,7 @@ PRIVATE char *HTCacheRoot = "/WWW$SCRATCH"; /* Where to cache things */ PRIVATE char *HTCacheRoot = "/tmp/W3_Cache_"; /* Where to cache things */ #endif /* VMS */ -/*PRIVATE char *HTSaveRoot = "$(HOME)/WWW/";*/ /* Where to save things */ +/*PRIVATE char *HTSaveRoot = "$(HOME)/WWW/";*/ /* Where to save things */ /* ** Suffix registration. @@ -165,11 +165,11 @@ PRIVATE void free_suffixes NOPARAMS; #ifdef LONG_LIST PRIVATE void LYListFmtParse ARGS5( - char *, fmtstr, - char *, file, - HTStructured *, target, - char *, entry, - char *, tail) + char *, fmtstr, + char *, file, + HTStructured *, target, + char *, entry, + char *, tail) { char c; char *s; @@ -195,7 +195,7 @@ PRIVATE void LYListFmtParse ARGS5( if (lstat(file, &st) < 0) fmtstr = "%a"; /* can't stat so just do anchor */ - + StrAllocCopy(str, fmtstr); s = str; end = str + strlen(str); @@ -221,13 +221,13 @@ PRIVATE void LYListFmtParse ARGS5( start = ++s; while (isdigit(*s) || *s == '.' || *s == '-') s++; - c = *s; /* the format char. or \0 */ + c = *s; /* the format char. or \0 */ *s = '\0'; switch (c) { case '\0': break; - + case 'A': case 'a': /* anchor */ HTDirEntry(target, tail, entry); @@ -288,7 +288,13 @@ PRIVATE void LYListFmtParse ARGS5( case S_IFREG: type = '-'; break; case S_IFLNK: type = 'l'; break; #ifdef S_IFSOCK +# ifdef S_IFIFO /* some older machines (e.g., apollo) have a conflict */ +# if S_IFIFO != S_IFSOCK + case S_IFSOCK: type = 's'; break; +# endif +# else case S_IFSOCK: type = 's'; break; +# endif #endif /* S_IFSOCK */ default: type = '?'; break; } @@ -307,7 +313,7 @@ PRIVATE void LYListFmtParse ARGS5( sprintf(fmt, "%%%ss", start); sprintf(buf, fmt, p->pw_name); } else { - + sprintf(fmt, "%%%sd", start); sprintf(buf, fmt, st.st_uid); } @@ -369,9 +375,9 @@ PUBLIC void HTSetSuffix5 ARGS5( BOOL trivial_enc = IsUnityEncStr(encoding); if (strcmp(suffix, "*") == 0) - suff = &no_suffix; + suff = &no_suffix; else if (strcmp(suffix, "*.*") == 0) - suff = &unknown_suffix; + suff = &unknown_suffix; else { HTList *cur = HTSuffixes; @@ -385,26 +391,26 @@ PUBLIC void HTSetSuffix5 ARGS5( if (!suff) { /* Not found -- create a new node */ suff = (HTSuffix *) calloc(1, sizeof(HTSuffix)); if (suff == NULL) - outofmem(__FILE__, "HTSetSuffix"); + outofmem(__FILE__, "HTSetSuffix"); /* - ** Memory leak fixed. + ** Memory leak fixed. ** 05-28-94 Lynx 2-3-1 Garrett Arch Blythe - */ + */ if (!HTSuffixes) { HTSuffixes = HTList_new(); atexit(free_suffixes); } HTList_addObject(HTSuffixes, suff); - + StrAllocCopy(suff->suffix, suffix); } } if (representation) suff->rep = HTAtom_for(representation); - + /* ** Memory leak fixed. ** 05-28-94 Lynx 2-3-1 Garrett Arch Blythe @@ -431,7 +437,7 @@ PRIVATE void free_suffixes NOARGS HTSuffix * suff = NULL; /* - ** Loop through all suffixes. + ** Loop through all suffixes. */ while (!HTList_isEmpty(HTSuffixes)) { /* @@ -443,7 +449,7 @@ PRIVATE void free_suffixes NOARGS FREE(suff); } /* - ** Free off the list itself. + ** Free off the list itself. */ HTList_delete(HTSuffixes); HTSuffixes = NULL; @@ -456,21 +462,21 @@ PRIVATE void free_suffixes NOARGS */ #ifdef HAVE_READDIR PRIVATE void do_readme ARGS2(HTStructured *, target, CONST char *, localname) -{ +{ FILE * fp; - char * readme_file_name = + char * readme_file_name = malloc(strlen(localname)+ 1 + strlen(HT_DIR_README_FILE) + 1); if (readme_file_name == NULL) - outofmem(__FILE__, "do_readme"); + outofmem(__FILE__, "do_readme"); strcpy(readme_file_name, localname); strcat(readme_file_name, "/"); strcat(readme_file_name, HT_DIR_README_FILE); - + fp = fopen(readme_file_name, "r"); - + if (fp) { HTStructuredClass targetClass; - + targetClass = *target->isa; /* (Can't init agregate in K&R) */ START(HTML_PRE); for (;;){ @@ -478,7 +484,7 @@ PRIVATE void do_readme ARGS2(HTStructured *, target, CONST char *, localname) if (c == (char)EOF) break; #ifdef NOTDEFINED switch (c) { - case '&': + case '&': case '<': case '>': PUTC('&'); @@ -487,9 +493,9 @@ PRIVATE void do_readme ARGS2(HTStructured *, target, CONST char *, localname) PUTC((char) (c % 10)); PUTC(';'); break; -/* case '\n': - PUTC('\r'); -Bug removed thanks to joe@athena.mit.edu */ +/* case '\n': + PUTC('\r'); +Bug removed thanks to joe@athena.mit.edu */ default: PUTC(c); } @@ -499,7 +505,7 @@ Bug removed thanks to joe@athena.mit.edu */ } END(HTML_PRE); fclose(fp); - } + } } #endif /* HAVE_READDIR */ @@ -511,7 +517,7 @@ Bug removed thanks to joe@athena.mit.edu */ ** /tmp/WWW_Cache_http/crnvmc/FIND/xx.xxx.xx ** ** On exit: -** Returns a malloc'ed string which must be freed by the caller. +** Returns a malloc'ed string which must be freed by the caller. */ PUBLIC char * HTCacheFileName ARGS1( CONST char *, name) @@ -519,13 +525,13 @@ PUBLIC char * HTCacheFileName ARGS1( char * acc_method = HTParse(name, "", PARSE_ACCESS); char * host = HTParse(name, "", PARSE_HOST); char * path = HTParse(name, "", PARSE_PATH+PARSE_PUNCTUATION); - + char * result; result = (char *)malloc( strlen(HTCacheRoot)+strlen(acc_method) +strlen(host)+strlen(path)+6+1); if (result == NULL) - outofmem(__FILE__, "HTCacheFileName"); + outofmem(__FILE__, "HTCacheFileName"); sprintf(result, "%s/WWW/%s/%s%s", HTCacheRoot, acc_method, host, path); FREE(path); FREE(acc_method); @@ -551,7 +557,7 @@ PRIVATE int HTCreatePath ARGS1(CONST char *,path) ** $(HOME)/WWW/http/crnvmc/FIND/xx.xxx.xx ** ** On exit: -** Returns a malloc'ed string which must be freed by the caller. +** Returns a malloc'ed string which must be freed by the caller. */ PUBLIC char * HTLocalName ARGS1( CONST char *, name) @@ -559,16 +565,16 @@ PUBLIC char * HTLocalName ARGS1( char * acc_method = HTParse(name, "", PARSE_ACCESS); char * host = HTParse(name, "", PARSE_HOST); char * path = HTParse(name, "", PARSE_PATH+PARSE_PUNCTUATION); - + HTUnEscape(path); /* Interpret % signs */ - + if (0 == strcmp(acc_method, "file")) { /* local file */ - FREE(acc_method); + FREE(acc_method); if ((0 == strcasecomp(host, HTHostName())) || (0 == strcasecomp(host, "localhost")) || !*host) { FREE(host); if (TRACE) - fprintf(stderr, "Node `%s' means path `%s'\n", name, path); + fprintf(stderr, "Node `%s' means path `%s'\n", name, path); #ifdef DOSPATH { char *ret_path = NULL; @@ -585,33 +591,33 @@ PUBLIC char * HTLocalName ARGS1( #endif /* DOSPATH */ } else { char * result = (char *)malloc( - strlen("/Net/")+strlen(host)+strlen(path)+1); - if (result == NULL) - outofmem(__FILE__, "HTLocalName"); + strlen("/Net/")+strlen(host)+strlen(path)+1); + if (result == NULL) + outofmem(__FILE__, "HTLocalName"); sprintf(result, "%s%s%s", "/Net/", host, path); FREE(host); FREE(path); if (TRACE) - fprintf(stderr, "Node `%s' means file `%s'\n", name, result); + fprintf(stderr, "Node `%s' means file `%s'\n", name, result); return result; } } else { /* other access */ char * result; #ifdef VMS - char * home = getenv("HOME"); - if (!home) - home = HTCacheRoot; + char * home = getenv("HOME"); + if (!home) + home = HTCacheRoot; else - home = HTVMS_wwwName(home); + home = HTVMS_wwwName(home); #else - CONST char * home = (CONST char*)getenv("HOME"); + CONST char * home = (CONST char*)getenv("HOME"); if (!home) - home = "/tmp"; + home = "/tmp"; #endif /* VMS */ result = (char *)malloc( strlen(home)+strlen(acc_method)+strlen(host)+strlen(path)+6+1); - if (result == NULL) - outofmem(__FILE__, "HTLocalName"); + if (result == NULL) + outofmem(__FILE__, "HTLocalName"); sprintf(result, "%s/WWW/%s/%s%s", home, acc_method, host, path); FREE(path); FREE(acc_method); @@ -646,14 +652,13 @@ PUBLIC char * WWW_nameOfFile ARGS1( outofmem(__FILE__, "WWW_nameOfFile"); sprintf(result, "file://%s", name+5); } else { - result = (char *)malloc(7+strlen(HTHostName())+strlen(name)+1); + result = (char *)malloc(7+strlen(HTHostName())+strlen(name)+1); if (result == NULL) outofmem(__FILE__, "WWW_nameOfFile"); sprintf(result, "file://%s%s", HTHostName(), name); } if (TRACE) - fprintf(stderr, "File `%s'\n\tmeans node `%s'\n", name, result); - + fprintf(stderr, "File `%s'\n\tmeans node `%s'\n", name, result); return result; } @@ -665,7 +670,7 @@ PUBLIC char * WWW_nameOfFile ARGS1( ** enc is an encoding, trivial (8bit, binary, etc.) or gzip etc. ** ** On exit: -** Returns a pointer to a suitable suffix string if one has been +** Returns a pointer to a suitable suffix string if one has been ** found, else "". */ PUBLIC CONST char * HTFileSuffix ARGS2( @@ -681,9 +686,9 @@ PUBLIC CONST char * HTFileSuffix ARGS2( int i; #define NO_INIT /* don't init anymore since I do it in Lynx at startup */ -#ifndef NO_INIT +#ifndef NO_INIT if (!HTSuffixes) - HTFileInit(); + HTFileInit(); #endif /* !NO_INIT */ trivial_enc = IsUnityEncStr(enc); @@ -692,7 +697,7 @@ PUBLIC CONST char * HTFileSuffix ARGS2( suff = (HTSuffix *)HTList_objectAt(HTSuffixes, i); if (suff->rep == rep && #if defined(VMS) || defined(FNAMES_8_3) - /* Don't return a suffix whose first char is a dot, and which + /* Don't return a suffix whose first char is a dot, and which has more dots or asterisks after that, for these systems - kw */ (!suff->suffix || !suff->suffix[0] || suff->suffix[0] != '.' || @@ -711,7 +716,7 @@ PUBLIC CONST char * HTFileSuffix ARGS2( */ return suff->suffix; } else if (!first_found) { - first_found = suff; /* remember this one */ + first_found = suff; /* remember this one */ } #else return suff->suffix; /* OK -- found */ @@ -721,7 +726,6 @@ PUBLIC CONST char * HTFileSuffix ARGS2( #ifdef FNAMES_8_3 if (first_found) return first_found->suffix; - else #endif return ""; /* Dunno */ } @@ -733,7 +737,7 @@ PUBLIC CONST char * HTFileSuffix ARGS2( ** a variable for the encoding. ** ** Encoding may be a unity encoding (binary, 8bit, etc.) or -** a content-coding like gzip, compress. +** a content-coding like gzip, compress. ** ** It will handle for example x.txt, x.txt,Z, x.Z */ @@ -757,27 +761,27 @@ PUBLIC HTFormat HTFileFormat ARGS3( if (LYforce_HTML_mode) { if (pencoding) *pencoding = WWW_ENC_8BIT; - return WWW_HTML; + return WWW_HTML; } #ifdef VMS /* - ** Trim at semicolon if a version number was - ** included, so it doesn't interfere with the - ** code for getting the MIME type. - FM + ** Trim at semicolon if a version number was + ** included, so it doesn't interfere with the + ** code for getting the MIME type. - FM */ if ((semicolon = strchr(filename, ';')) != NULL) - *semicolon = '\0'; + *semicolon = '\0'; #endif /* VMS */ -#ifndef NO_INIT +#ifndef NO_INIT if (!HTSuffixes) - HTFileInit(); + HTFileInit(); #endif /* !NO_INIT */ - lf = strlen(filename); + lf = strlen(filename); n = HTList_count(HTSuffixes); for (i = 0; i < n; i++) { - int ls; + int ls; suff = (HTSuffix *)HTList_objectAt(HTSuffixes, i); ls = strlen(suff->suffix); if ((ls <= lf) && 0 == strcasecomp(suff->suffix, filename + lf - ls)) { @@ -791,7 +795,7 @@ PUBLIC HTFormat HTFileFormat ARGS3( if (semicolon != NULL) *semicolon = ';'; #endif /* VMS */ - return suff->rep; /* OK -- found */ + return suff->rep; /* OK -- found */ } for (j = 0; j < n; j++) { /* Got encoding, need representation */ int ls2; @@ -806,29 +810,29 @@ PUBLIC HTFormat HTFileFormat ARGS3( if (semicolon != NULL) *semicolon = ';'; #endif /* VMS */ - return suff->rep; + return suff->rep; } } } - + } } - + /* defaults tree */ - - suff = strchr(filename, '.') ? /* Unknown suffix */ - ( unknown_suffix.rep ? &unknown_suffix : &no_suffix) + + suff = strchr(filename, '.') ? /* Unknown suffix */ + ( unknown_suffix.rep ? &unknown_suffix : &no_suffix) : &no_suffix; - + /* - ** Set default encoding unless found with suffix already. + ** Set default encoding unless found with suffix already. */ if (pencoding && !*pencoding) - *pencoding = suff->encoding ? suff->encoding + *pencoding = suff->encoding ? suff->encoding : HTAtom_for("binary"); #ifdef VMS if (semicolon != NULL) - *semicolon = ';'; + *semicolon = ';'; #endif /* VMS */ return suff->rep ? suff->rep : WWW_BINARY; } @@ -859,7 +863,7 @@ PUBLIC HTFormat HTCharsetFormat ARGS3( (cp2 = strstr(cp1, "charset")) != NULL) { if (TRACE) fprintf(stderr, - "HTCharsetFormat: Extended MIME Content-Type is %s\n", + "HTCharsetFormat: Extended MIME Content-Type is %s\n", format->name); cp2 += 7; while (*cp2 == ' ' || *cp2 == '=') @@ -883,7 +887,7 @@ PUBLIC HTFormat HTCharsetFormat ARGS3( UCT_SETBY_MIME); } else if (chndl < 0) { /* - ** Got something but we don't recognize it. + ** Got something but we don't recognize it. */ chndl = UCLYhndl_for_unrec; if (UCCanTranslateFromTo(chndl, current_char_set) != TQ_NO) { @@ -960,7 +964,7 @@ PUBLIC HTFormat HTCharsetFormat ARGS3( !strncmp(LYchar_set_names[current_char_set], "Other ISO Latin", 15)) { /* - ** Hope it's a match, for now. - FM + ** Hope it's a match, for now. - FM */ *cp1 = '\0'; format = HTAtom_for(cp); @@ -972,92 +976,6 @@ PUBLIC HTFormat HTCharsetFormat ARGS3( StrAllocCopy(anchor->charset, cp4); HTPassEightBitRaw = TRUE; HTAlert(anchor->charset); -#ifdef NOT_USED /* pre chartrans */ - } else if (!strncmp(cp2, "us-ascii", 8) || - !strncmp(cp2, "iso-8859-1", 10)) { - *cp1 = '\0'; - format = HTAtom_for(cp); - StrAllocCopy(anchor->charset, "iso-8859-1"); - HTCJK = NOCJK; - } else if (!strncmp(cp2, "iso-8859-2", 10) && - !strncmp(LYchar_set_names[current_char_set], - "ISO Latin 2", 11)) { - *cp1 = '\0'; - format = HTAtom_for(cp); - StrAllocCopy(anchor->charset, "iso-8859-2"); - HTPassEightBitRaw = TRUE; - } else if (!strncmp(cp2, "iso-8859-", 9) && - !strncmp(LYchar_set_names[current_char_set], - "Other ISO Latin", 15)) { - /* - ** Hope it's a match, for now. - FM - */ - *cp1 = '\0'; - format = HTAtom_for(cp); - StrAllocCopy(anchor->charset, "iso-8859- "); - anchor->charset[9] = cp2[9]; - HTPassEightBitRaw = TRUE; - HTAlert(anchor->charset); - } else if (!strncmp(cp2, "koi8-r", 6) && - !strncmp(LYchar_set_names[current_char_set], - "KOI8-R Cyrillic", 15)) { - *cp1 = '\0'; - format = HTAtom_for(cp); - StrAllocCopy(anchor->charset, "koi8-r"); - HTPassEightBitRaw = TRUE; - } else if (!strncmp(cp2, "euc-jp", 6) && - HTCJK == JAPANESE) { - *cp1 = '\0'; - format = HTAtom_for(cp); - StrAllocCopy(anchor->charset, "euc-jp"); - } else if (!strncmp(cp2, "shift_jis", 9) && - HTCJK == JAPANESE) { - *cp1 = '\0'; - format = HTAtom_for(cp); - StrAllocCopy(anchor->charset, "shift_jis"); - } else if (!strncmp(cp2, "iso-2022-jp", 11) && - HTCJK == JAPANESE) { - *cp1 = '\0'; - format = HTAtom_for(cp); - StrAllocCopy(anchor->charset, "iso-2022-jp"); - } else if (!strncmp(cp2, "iso-2022-jp-2", 13) && - HTCJK == JAPANESE) { - *cp1 = '\0'; - format = HTAtom_for(cp); - StrAllocCopy(anchor->charset, "iso-2022-jp-2"); - } else if (!strncmp(cp2, "euc-kr", 6) && - HTCJK == KOREAN) { - *cp1 = '\0'; - format = HTAtom_for(cp); - StrAllocCopy(anchor->charset, "euc-kr"); - } else if (!strncmp(cp2, "iso-2022-kr", 11) && - HTCJK == KOREAN) { - *cp1 = '\0'; - format = HTAtom_for(cp); - StrAllocCopy(anchor->charset, "iso-2022-kr"); - } else if ((!strncmp(cp2, "big5", 4) || - !strncmp(cp2, "cn-big5", 7)) && - HTCJK == TAIPEI) { - *cp1 = '\0'; - format = HTAtom_for(cp); - StrAllocCopy(anchor->charset, "big5"); - } else if (!strncmp(cp2, "euc-cn", 6) && - HTCJK == CHINESE) { - *cp1 = '\0'; - format = HTAtom_for(cp); - StrAllocCopy(anchor->charset, "euc-cn"); - } else if ((!strncmp(cp2, "gb2312", 6) || - !strncmp(cp2, "cn-gb", 5)) && - HTCJK == CHINESE) { - *cp1 = '\0'; - format = HTAtom_for(cp); - StrAllocCopy(anchor->charset, "gb2312"); - } else if (!strncmp(cp2, "iso-2022-cn", 11) && - HTCJK == CHINESE) { - *cp1 = '\0'; - format = HTAtom_for(cp); - StrAllocCopy(anchor->charset, "iso-2022-cn"); -#endif /* NOT_USED */ } FREE(cp3); } else if (cp1 != NULL) { @@ -1071,13 +989,17 @@ PUBLIC HTFormat HTCharsetFormat ARGS3( } FREE(cp); + /* + ** Set up defaults, if needed. - FM + */ if (!chartrans_ok && !anchor->charset && default_LYhndl >= 0) { HTAnchor_setUCInfoStage(anchor, default_LYhndl, UCT_STAGE_MIME, UCT_SETBY_DEFAULT); } HTAnchor_copyUCInfoStage(anchor, - UCT_STAGE_PARSER, UCT_STAGE_MIME, + UCT_STAGE_PARSER, + UCT_STAGE_MIME, -1); return format; @@ -1095,23 +1017,23 @@ PUBLIC float HTFileValue ARGS1( int i; int lf = strlen(filename); -#ifndef NO_INIT +#ifndef NO_INIT if (!HTSuffixes) - HTFileInit(); + HTFileInit(); #endif /* !NO_INIT */ n = HTList_count(HTSuffixes); for (i = 0; i < n; i++) { - int ls; + int ls; suff = (HTSuffix *)HTList_objectAt(HTSuffixes, i); ls = strlen(suff->suffix); if ((ls <= lf) && 0==strcmp(suff->suffix, filename + lf - ls)) { if (TRACE) - fprintf(stderr, "File: Value of %s is %.3f\n", - filename, suff->quality); + fprintf(stderr, "File: Value of %s is %.3f\n", + filename, suff->quality); return suff->quality; /* OK -- found */ } } - return 0.3; /* Dunno! */ + return 0.3; /* Dunno! */ } /* Determine write access to a file. @@ -1155,49 +1077,49 @@ PUBLIC BOOL HTEditable ARGS1( return NO; /* Safe answer till we find the correct algorithm */ #else #ifdef NeXT - int groups[NGROUPS]; + int groups[NGROUPS]; #else gid_t groups[NGROUPS]; #endif /* NeXT */ uid_t myUid; - int ngroups; /* The number of groups */ - struct stat fileStatus; - int i; - + int ngroups; /* The number of groups */ + struct stat fileStatus; + int i; + if (stat(filename, &fileStatus)) /* Get details of filename */ - return NO; /* Can't even access file! */ + return NO; /* Can't even access file! */ ngroups = getgroups(NGROUPS, groups); /* Groups to which I belong */ myUid = geteuid(); /* Get my user identifier */ if (TRACE) { - int i2; - fprintf(stderr, + int i2; + fprintf(stderr, "File mode is 0%o, uid=%d, gid=%d. My uid=%d, %d groups (", - (unsigned int) fileStatus.st_mode, fileStatus.st_uid, + (unsigned int) fileStatus.st_mode, fileStatus.st_uid, fileStatus.st_gid, myUid, ngroups); for (i2 = 0; i2 < ngroups; i2++) fprintf(stderr, " %d", groups[i2]); fprintf(stderr, ")\n"); } - + if (fileStatus.st_mode & 0002) /* I can write anyway? */ - return YES; - + return YES; + if ((fileStatus.st_mode & 0200) /* I can write my own file? */ && (fileStatus.st_uid == myUid)) - return YES; + return YES; if (fileStatus.st_mode & 0020) /* Group I am in can write? */ { - for (i = 0; i < ngroups; i++) { - if (groups[i] == fileStatus.st_gid) - return YES; + for (i = 0; i < ngroups; i++) { + if (groups[i] == fileStatus.st_gid) + return YES; } } if (TRACE) - fprintf(stderr, "\tFile is not editable.\n"); + fprintf(stderr, "\tFile is not editable.\n"); return NO; /* If no excuse, can't do */ #endif /* NO_GROUPS */ } @@ -1216,16 +1138,16 @@ PUBLIC HTStream * HTFileSaveStream ARGS1( FILE* fp = fopen(localname, "w"); if (!fp) - return NULL; + return NULL; return HTFWriter_new(fp); } -/* Output one directory entry. +/* Output one directory entry. ** --------------------------- */ PUBLIC void HTDirEntry ARGS3( - HTStructured *, target, + HTStructured *, target, CONST char *, tail, CONST char *, entry) { @@ -1234,7 +1156,7 @@ PUBLIC void HTDirEntry ARGS3( int len; if (0 == strcmp(entry,"../")) { - /* + /* ** Undo slash appending for anchor creation. */ StrAllocCopy(escaped,".."); @@ -1249,28 +1171,28 @@ PUBLIC void HTDirEntry ARGS3( } if (tail == NULL || *tail == '\0') { - /* + /* ** Handle extra slash at end of path. */ - HTStartAnchor(target, NULL, (escaped[0] != '\0' ? escaped : "/")); + HTStartAnchor(target, NULL, (escaped[0] != '\0' ? escaped : "/")); } else { - /* + /* ** If empty tail, gives absolute ref below. */ - relative = (char*)malloc(strlen(tail) + strlen(escaped)+2); - if (relative == NULL) + relative = (char*)malloc(strlen(tail) + strlen(escaped)+2); + if (relative == NULL) outofmem(__FILE__, "HTDirEntry"); - sprintf(relative, "%s%s%s", + sprintf(relative, "%s%s%s", tail, (*escaped != '\0' ? "/" : ""), escaped); - HTStartAnchor(target, NULL, relative); - FREE(relative); + HTStartAnchor(target, NULL, relative); + FREE(relative); } FREE(escaped); } - -/* Output parent directory entry. + +/* Output parent directory entry. ** ------------------------------ ** ** This gives the TITLE and H1 header, and also a link @@ -1284,7 +1206,7 @@ PUBLIC void HTDirEntry ARGS3( ** the parent directory. Otherwise, it returns FALSE. - FM */ PUBLIC BOOL HTDirTitles ARGS3( - HTStructured *, target, + HTStructured *, target, HTAnchor *, anchor, BOOL, tildeIsTop) { @@ -1296,26 +1218,26 @@ PUBLIC BOOL HTDirTitles ARGS3( int i; #ifdef DOSPATH - BOOL local_link = FALSE; - if (logical[18] == ':') local_link = TRUE; + BOOL local_link = FALSE; + if (logical[18] == ':') local_link = TRUE; #endif /* - ** Check tildeIsTop for treating home directory as Welcome - ** (assume the tilde is not followed by a username). - FM - */ + ** Check tildeIsTop for treating home directory as Welcome + ** (assume the tilde is not followed by a username). - FM + */ if (tildeIsTop && !strncmp(path, "/~", 2)) { - if (path[2] == '\0') { + if (path[2] == '\0') { path[1] = '\0'; } else { for (i = 0; path[(i + 2)]; i++) { - path[i] = path[(i + 2)]; + path[i] = path[(i + 2)]; } path[i] = '\0'; } } /* - ** Trim out the ;type= parameter, if present. - FM + ** Trim out the ;type= parameter, if present. - FM */ if ((cp = strrchr(path, ';')) != NULL) { if (!strncasecomp((cp+1), "type=", 5)) { @@ -1333,16 +1255,16 @@ PUBLIC BOOL HTDirTitles ARGS3( #ifdef DIRED_SUPPORT if (0 == strncasecomp(path, "/%2F", 4)) - StrAllocCopy(printable, (path+1)); + StrAllocCopy(printable, (path+1)); else - StrAllocCopy(printable, path); + StrAllocCopy(printable, path); if (0 == strncasecomp(printable, "/vmsysu%2b", 10) || - 0 == strncasecomp(printable, "/anonymou.", 10)) { - StrAllocCopy(cp, (printable+1)); + 0 == strncasecomp(printable, "/anonymou.", 10)) { + StrAllocCopy(cp, (printable+1)); StrAllocCopy(printable, cp); FREE(cp); } -#else +#else StrAllocCopy(printable, (current ? current + 1 : "")); #endif /* DIRED_SUPPORT */ @@ -1370,7 +1292,7 @@ PUBLIC BOOL HTDirTitles ARGS3( PUTS("\n"); #endif /* DIRED_SUPPORT */ if (((0 == strncasecomp(printable, "vmsysu:", 7)) && - (cp = strchr(printable, '.')) != NULL && + (cp = strchr(printable, '.')) != NULL && strchr(cp, '/') == NULL) || (0 == strncasecomp(printable, "anonymou.", 9) && strchr(printable, '/') == NULL)) { @@ -1384,14 +1306,14 @@ PUBLIC BOOL HTDirTitles ARGS3( #ifndef NO_PARENT_DIR_REFERENCE /* - ** Make link back to parent directory. + ** Make link back to parent directory. */ if (current && current[1]) { /* was a slash AND something else too */ - char * parent = NULL; + char * parent = NULL; char * relative = NULL; *current++ = '\0'; - parent = strrchr(path, '/'); /* penultimate slash */ + parent = strrchr(path, '/'); /* penultimate slash */ if ((parent && (!strcmp(parent, "/..") || @@ -1400,17 +1322,16 @@ PUBLIC BOOL HTDirTitles ARGS3( FREE(logical); FREE(path); return(need_parent_link); - } + } relative = (char*) malloc(strlen(current) + 4); if (relative == NULL) outofmem(__FILE__, "HTDirTitles"); - sprintf(relative, "%s/..", current); #ifdef DOSPATH - if(local_link) - if (strlen(parent) == 3 ) + if (local_link) + if (strlen(parent) == 3 ) StrAllocCat(relative, "/."); #endif @@ -1420,11 +1341,11 @@ PUBLIC BOOL HTDirTitles ARGS3( #endif { /* - ** On Unix, if it's not ftp and the directory cannot - ** be read, don't put out a link. + ** On Unix, if it's not ftp and the directory cannot + ** be read, don't put out a link. ** - ** On VMS, this problem is dealt with internally by - ** HTVMSBrowseDir(). + ** On VMS, this problem is dealt with internally by + ** HTVMSBrowseDir(). */ DIR * dp = NULL; @@ -1454,14 +1375,14 @@ PUBLIC BOOL HTDirTitles ARGS3( } HTUnEscape(fullparentpath); - if ((dp = opendir(fullparentpath)) == NULL) { - FREE(fullparentpath); - FREE(logical); - FREE(relative); - FREE(path); - return(need_parent_link); + if ((dp = opendir(fullparentpath)) == NULL) { + FREE(fullparentpath); + FREE(logical); + FREE(relative); + FREE(path); + return(need_parent_link); } - closedir(dp); + closedir(dp); FREE(fullparentpath); #ifdef LONG_LIST need_parent_link = TRUE; @@ -1479,7 +1400,7 @@ PUBLIC BOOL HTDirTitles ARGS3( PUTS("Up to "); if (parent) { if ((0 == strcmp(current,".")) || - (0 == strcmp(current,".."))) { + (0 == strcmp(current,".."))) { /* ** Should not happen, but if it does, ** at least avoid giving misleading info. - KW @@ -1503,7 +1424,7 @@ PUBLIC BOOL HTDirTitles ARGS3( FREE(path); return(need_parent_link); } - + /* Load a document. ** ---------------- ** @@ -1512,8 +1433,8 @@ PUBLIC BOOL HTDirTitles ARGS3( ** This is the physical address of the file ** ** On exit: -** returns <0 Error has occured. -** HTLOADED OK +** returns <0 Error has occured. +** HTLOADED OK ** */ PUBLIC int HTLoadFile ARGS4( @@ -1527,8 +1448,8 @@ PUBLIC int HTLoadFile ARGS4( HTFormat format; char * nodename = NULL; char * newname = NULL; /* Simplified name of file */ - HTAtom * encoding; /* @@ not used */ - HTAtom * myEncoding = NULL; /* enc of this file, may be gzip etc. */ + HTAtom * encoding; /* @@ not used yet */ + HTAtom * myEncoding = NULL; /* enc of this file, may be gzip etc. */ int status; #ifdef VMS struct stat stat_info; @@ -1539,39 +1460,39 @@ PUBLIC int HTLoadFile ARGS4( #endif /* USE_ZLIB */ /* - ** Reduce the filename to a basic form (hopefully unique!). + ** Reduce the filename to a basic form (hopefully unique!). */ StrAllocCopy(newname, addr); filename=HTParse(newname, "", PARSE_PATH|PARSE_PUNCTUATION); nodename=HTParse(newname, "", PARSE_HOST); - + /* - ** If access is ftp, or file is on another host, invoke ftp now. + ** If access is ftp, or file is on another host, invoke ftp now. */ acc_method = HTParse(newname, "", PARSE_ACCESS); if (strcmp("ftp", acc_method) == 0 || (strcmp("localhost", nodename) != 0 && #ifdef VMS - strcasecomp(nodename, HTHostName()) != 0 + strcasecomp(nodename, HTHostName()) != 0 #else - strcmp(nodename, HTHostName()) != 0 + strcmp(nodename, HTHostName()) != 0 #endif /* VMS */ )) { - FREE(newname); + FREE(newname); FREE(filename); FREE(nodename); - FREE(acc_method); - return HTFTPLoad(addr, anchor, format_out, sink); + FREE(acc_method); + return HTFTPLoad(addr, anchor, format_out, sink); } else { - FREE(newname); - FREE(acc_method); + FREE(newname); + FREE(acc_method); } #ifdef VMS HTUnEscape(filename); #endif /* VMS */ /* - ** Determine the format and encoding mapped to any suffix. + ** Determine the format and encoding mapped to any suffix. */ if (anchor->content_type && anchor->content_encoding) { /* @@ -1583,22 +1504,22 @@ PUBLIC int HTLoadFile ARGS4( myEncoding = HTAtom_for(anchor->content_encoding); } else { format = HTFileFormat(filename, &myEncoding, NULL); - + /* - ** Check the format for an extended MIME charset value, and - ** act on it if present. Otherwise, assume what is indicated - ** by the last parameter (fallback will effectively be - ** UCLYhndl_for_unspec, by default ISO-8859-1). - kw + ** Check the format for an extended MIME charset value, and + ** act on it if present. Otherwise, assume what is indicated + ** by the last parameter (fallback will effectively be + ** UCLYhndl_for_unspec, by default ISO-8859-1). - kw */ format = HTCharsetFormat(format, anchor, UCLYhndl_HTFile_for_unspec); } #ifdef VMS /* - ** Check to see if the 'filename' is in fact a directory. If it is - ** create a new hypertext object containing a list of files and - ** subdirectories contained in the directory. All of these are links - ** to the directories or files listed. + ** Check to see if the 'filename' is in fact a directory. If it is + ** create a new hypertext object containing a list of files and + ** subdirectories contained in the directory. All of these are links + ** to the directories or files listed. */ if (HTStat(filename, &stat_info) == -1) { if (TRACE) @@ -1613,7 +1534,7 @@ PUBLIC int HTLoadFile ARGS4( } if (HTDirAccess == HT_DIR_SELECTIVE) { - char * enable_file_name = + char * enable_file_name = malloc(strlen(filename)+ 1 + strlen(HT_DIR_ENABLE_FILE) + 1); if (enable_file_name == NULL) @@ -1636,31 +1557,31 @@ PUBLIC int HTLoadFile ARGS4( } /* - ** Assume that the file is in Unix-style syntax if it contains a '/' - ** after the leading one. @@ + ** Assume that the file is in Unix-style syntax if it contains a '/' + ** after the leading one. @@ */ { - FILE * fp; + FILE * fp; char * vmsname = strchr(filename + 1, '/') ? HTVMS_name(nodename, filename) : filename + 1; fp = fopen(vmsname, "r", "shr=put", "shr=upd"); - - /* + + /* ** If the file wasn't VMS syntax, then perhaps it is ultrix. */ if (!fp) { char ultrixname[INFINITY]; if (TRACE) - fprintf(stderr, "HTLoadFile: Can't open as %s\n", vmsname); + fprintf(stderr, "HTLoadFile: Can't open as %s\n", vmsname); sprintf(ultrixname, "%s::\"%s\"", nodename, filename); - fp = fopen(ultrixname, "r", "shr=put", "shr=upd"); + fp = fopen(ultrixname, "r", "shr=put", "shr=upd"); if (!fp) { if (TRACE) fprintf(stderr, "HTLoadFile: Can't open as %s\n", - ultrixname); + ultrixname); } } - if (fp) { + if (fp) { int len; char *cp = NULL; char *semicolon = NULL; @@ -1669,19 +1590,18 @@ PUBLIC int HTLoadFile ARGS4( HTAtom * put = HTAtom_for("PUT"); HTList * methods = HTAnchor_methods(anchor); if (HTList_indexOf(methods, put) == (-1)) { - HTList_addObject(methods, put); - } + HTList_addObject(methods, put); + } } - /* - ** Trim vmsname at semicolon if a version number was - ** included, so it doesn't interfere with the check - ** for a compressed file. - FM + ** Trim vmsname at semicolon if a version number was + ** included, so it doesn't interfere with the check + ** for a compressed file. - FM */ if ((semicolon = strchr(vmsname, ';')) != NULL) - *semicolon = '\0'; + *semicolon = '\0'; /* - ** Fake a Content-Encoding for compressed files. - FM + ** Fake a Content-Encoding for compressed files. - FM */ if (!IsUnityEnc(myEncoding)) { /* @@ -1704,14 +1624,14 @@ PUBLIC int HTLoadFile ARGS4( vmsname, (void*)gzfp); use_gzread = YES; } else -#endif /* USE_ZLIB */ +#endif /* USE_ZLIB */ { StrAllocCopy(anchor->content_type, format->name); StrAllocCopy(anchor->content_encoding, HTAtom_name(myEncoding)); format = HTAtom_for("www/compressed"); } } else if ((len = strlen(vmsname)) > 2) { - if ((vmsname[len - 1] == 'Z') && + if ((vmsname[len - 1] == 'Z') && (vmsname[len - 2] == '.' || vmsname[len - 2] == '-' || vmsname[len - 2] == '_') && @@ -1729,7 +1649,7 @@ PUBLIC int HTLoadFile ARGS4( } else if ((len > 3) && !strcasecomp((char *)&vmsname[len - 2], "gz")) { if (vmsname[len - 3] == '.' || - vmsname[len - 3] == '-' || + vmsname[len - 3] == '-' || vmsname[len - 3] == '_') { StrAllocCopy(cp, vmsname); cp[len - 3] = '\0'; @@ -1754,12 +1674,12 @@ PUBLIC int HTLoadFile ARGS4( } #else /* USE_ZLIB */ format = HTAtom_for("www/compressed"); -#endif /* USE_ZLIB */ +#endif /* USE_ZLIB */ } } } if (semicolon != NULL) - *semicolon = ';'; + *semicolon = ';'; FREE(filename); FREE(nodename); #ifdef USE_ZLIB @@ -1800,29 +1720,29 @@ PUBLIC int HTLoadFile ARGS4( fclose(fp); } return status; - } /* If successfull open */ + } /* If successfull open */ FREE(filename); } #else /* Unix: */ FREE(filename); - + /* - ** For unix, we try to translate the name into the name of a - ** transparently mounted file. + ** For unix, we try to translate the name into the name of a + ** transparently mounted file. ** - ** Not allowed in secure (HTClienntHost) situations. TBL 921019 + ** Not allowed in secure (HTClienntHost) situations. TBL 921019 */ #ifndef NO_UNIX_IO - /* Need protection here for telnet server but not httpd server. */ - + /* Need protection here for telnet server but not httpd server. */ + if (!HTSecure) { /* try local file system */ char * localname = HTLocalName(addr); struct stat dir_info; - + #ifdef HAVE_READDIR - /* + /* ** Multiformat handling. ** ** If needed, scan directory to find a good file. @@ -1830,7 +1750,7 @@ PUBLIC int HTLoadFile ARGS4( */ if ((strlen(localname) > strlen(MULTI_SUFFIX)) && (0 == strcmp(localname + strlen(localname) - strlen(MULTI_SUFFIX), - MULTI_SUFFIX))) { + MULTI_SUFFIX))) { DIR *dp; BOOL forget_multi = NO; @@ -1841,12 +1761,12 @@ PUBLIC int HTLoadFile ARGS4( char * best_name = NULL; /* Best dir entry so far */ char *base = strrchr(localname, '/'); - int baselen; + int baselen = 0; if (!base || base == localname) { - forget_multi = YES; + forget_multi = YES; } else { - *base++ = '\0'; /* Just got directory name */ + *base++ = '\0'; /* Just got directory name */ baselen = strlen(base)- strlen(MULTI_SUFFIX); base[baselen] = '\0'; /* Chop off suffix */ @@ -1858,7 +1778,7 @@ PUBLIC int HTLoadFile ARGS4( return HTLoadError(sink, 500, "Multiformat: directory scan failed."); } - + while ((dirbuf = readdir(dp)) != NULL) { /* ** While there are directory entries to be read... @@ -1867,19 +1787,19 @@ PUBLIC int HTLoadFile ARGS4( if (dirbuf->d_ino == 0) continue; /* if the entry is not being used, skip it */ #endif - if ((int)strlen(dirbuf->d_name) > baselen && /* Match? */ + if ((int)strlen(dirbuf->d_name) > baselen && /* Match? */ !strncmp(dirbuf->d_name, base, baselen)) { HTAtom * enc; HTFormat rep = HTFileFormat(dirbuf->d_name, &enc, NULL); float filevalue = HTFileValue(dirbuf->d_name); float value = HTStackValue(rep, format_out, - filevalue, + filevalue, 0L /* @@@@@@ */); if (value <= 0.0) { char * cp = NULL; int len = strlen(dirbuf->d_name); enc = NULL; - if (len > 2 && + if (len > 2 && dirbuf->d_name[len - 1] == 'Z' && dirbuf->d_name[len - 2] == '.') { StrAllocCopy(cp, dirbuf->d_name); @@ -1921,7 +1841,7 @@ PUBLIC int HTLoadFile ARGS4( } } if (value != NO_VALUE_FOUND) { - if (TRACE) + if (TRACE) fprintf(stderr, "HTLoadFile: value of presenting %s is %f\n", HTAtom_name(rep), value); @@ -1931,20 +1851,20 @@ PUBLIC int HTLoadFile ARGS4( best = value; StrAllocCopy(best_name, dirbuf->d_name); } - } /* if best so far */ - } /* if match */ - + } /* if best so far */ + } /* if match */ + } /* end while directory entries left to read */ closedir(dp); - + if (best_rep) { format = best_rep; myEncoding = best_enc; - base[-1] = '/'; /* Restore directory name */ + base[-1] = '/'; /* Restore directory name */ base[0] = '\0'; StrAllocCat(localname, best_name); FREE(best_name); - } else { /* If not found suitable file */ + } else { /* If not found suitable file */ FREE(localname); FREE(nodename); return HTLoadError(sink, 403, /* List formats? */ @@ -1955,8 +1875,8 @@ PUBLIC int HTLoadFile ARGS4( /* ** Check to see if the 'localname' is in fact a directory. If it - ** is create a new hypertext object containing a list of files and - ** subdirectories contained in the directory. All of these are + ** is create a new hypertext object containing a list of files and + ** subdirectories contained in the directory. All of these are ** links to the directories or files listed. ** NB This assumes the existance of a type 'STRUCT_DIRENT', which ** will hold the directory entry, and a type 'DIR' which is used @@ -1968,20 +1888,20 @@ PUBLIC int HTLoadFile ARGS4( if (stat(localname,&dir_info) == -1) /* get file information */ #endif { - /* if can't read file information */ + /* if can't read file information */ if (TRACE) - fprintf(stderr, "HTLoadFile: can't stat %s\n", localname); + fprintf(stderr, "HTLoadFile: can't stat %s\n", localname); } else { /* Stat was OK */ - + #ifdef _WINDOWS - if (stat(localname,&dir_info) == -1) dir_info.st_mode = S_IFDIR; + if (stat(localname,&dir_info) == -1) dir_info.st_mode = S_IFDIR; #endif if (((dir_info.st_mode) & S_IFMT) == S_IFDIR) { /* ** If localname is a directory. - */ + */ HTStructured *target; /* HTML object */ HTStructuredClass targetClass; DIR *dp; @@ -1991,12 +1911,12 @@ PUBLIC int HTLoadFile ARGS4( char *tail = NULL; BOOL present[HTML_A_ATTRIBUTES]; char * tmpfilename = NULL; - BOOL need_parent_link = FALSE; + BOOL need_parent_link = FALSE; struct stat file_info; - + if (TRACE) fprintf(stderr, "%s is a directory\n", localname); - + /* ** Check directory access. ** Selective access means only those directories containing @@ -2011,7 +1931,7 @@ PUBLIC int HTLoadFile ARGS4( if (HTDirAccess == HT_DIR_SELECTIVE) { - char * enable_file_name = + char * enable_file_name = malloc(strlen(localname)+ 1 + strlen(HT_DIR_ENABLE_FILE) + 1); if (enable_file_name == NULL) @@ -2031,23 +1951,23 @@ PUBLIC int HTLoadFile ARGS4( if (!dp) { FREE(localname); FREE(nodename); - return HTLoadError(sink, 403, - "This directory is not readable."); + return HTLoadError(sink, 403, + "This directory is not readable."); } /* ** Directory access is allowed and possible. */ logical = HTAnchor_address((HTAnchor*)anchor); - pathname = HTParse(logical, "", + pathname = HTParse(logical, "", PARSE_PATH + PARSE_PUNCTUATION); - if (!strcmp(pathname,"/")) { + if (!strcmp(pathname,"/")) { /* - ** Root path. + ** Root path. */ - StrAllocCopy (tail, "/foo/.."); - } else { + StrAllocCopy (tail, "/foo/.."); + } else { char *p = strrchr(pathname, '/'); /* find lastslash */ if (!p) { @@ -2062,9 +1982,9 @@ PUBLIC int HTLoadFile ARGS4( */ StrAllocCopy(tail, (p + 1)); } - } - FREE(pathname); - + } + FREE(pathname); + if (UCLYhndl_HTFile_for_unspec >= 0) { HTAnchor_setUCInfoStage(anchor, UCLYhndl_HTFile_for_unspec, @@ -2074,12 +1994,12 @@ PUBLIC int HTLoadFile ARGS4( target = HTML_new(anchor, format_out, sink); targetClass = *target->isa; /* Copy routine entry points */ - - { int i; + + { int i; for (i = 0; i < HTML_A_ATTRIBUTES; i++) present[i] = (i == HTML_A_HREF); } - + /* ** The need_parent_link flag will be set if an ** "Up to <parent>" link was not created for a @@ -2088,7 +2008,7 @@ PUBLIC int HTLoadFile ARGS4( ** is not defined so that need we to create the ** link via an LYListFmtParse() call. - FM */ - need_parent_link = HTDirTitles(target, + need_parent_link = HTDirTitles(target, (HTAnchor *)anchor, FALSE); #ifdef DIRED_SUPPORT @@ -2097,7 +2017,7 @@ PUBLIC int HTLoadFile ARGS4( lynx_edit_mode = TRUE; } #endif /* DIRED_SUPPORT */ - if (HTDirReadme == HT_DIR_README_TOP) + if (HTDirReadme == HT_DIR_README_TOP) do_readme(target, localname); { HTBTree * bt = HTBTree_new((HTComparer)strcmp); @@ -2106,12 +2026,12 @@ PUBLIC int HTLoadFile ARGS4( /* ** While there are directory entries to be read... */ - char * dirname = NULL; + char * dirname = NULL; #ifndef DOSPATH - if (dirbuf->d_ino == 0) + if (dirbuf->d_ino == 0) /* - ** If the entry is not being used, skip it. + ** If the entry is not being used, skip it. */ continue; #endif @@ -2135,27 +2055,27 @@ PUBLIC int HTLoadFile ARGS4( StrAllocCopy(tmpfilename, localname); if (strcmp(localname, "/")) /* - ** If filename is not root directory. + ** If filename is not root directory. */ - StrAllocCat(tmpfilename, "/"); + StrAllocCat(tmpfilename, "/"); StrAllocCat(tmpfilename, dirbuf->d_name); stat(tmpfilename, &file_info); if (((file_info.st_mode) & S_IFMT) == S_IFDIR) #ifndef DIRED_SUPPORT - sprintf((char *)dirname, "D%s",dirbuf->d_name); + sprintf((char *)dirname, "D%s",dirbuf->d_name); else sprintf((char *)dirname, "F%s",dirbuf->d_name); /* D & F to have first directories, then files */ #else if (dir_list_style == MIXED_STYLE) - sprintf((char *)dirname, + sprintf((char *)dirname, " %s/", dirbuf->d_name); else if (!strcmp(dirbuf->d_name, "..")) - sprintf((char *)dirname, + sprintf((char *)dirname, "A%s", dirbuf->d_name); else - sprintf((char *)dirname, + sprintf((char *)dirname, "D%s", dirbuf->d_name); else if (dir_list_style == MIXED_STYLE) sprintf((char *)dirname, " %s", dirbuf->d_name); @@ -2172,16 +2092,16 @@ PUBLIC int HTLoadFile ARGS4( } /* - ** Run through tree printing out in order. + ** Run through tree printing out in order. */ { - HTBTElement * next_element = HTBTree_next(bt,NULL); + HTBTElement * next_element = HTBTree_next(bt,NULL); /* pick up the first element of the list */ char state; /* I for initial (.. file), D for directory file, F for file */ - + #ifdef DIRED_SUPPORT char test; #endif /* DIRED_SUPPORT */ @@ -2191,47 +2111,47 @@ PUBLIC int HTLoadFile ARGS4( char *entry, *file_extra; StrAllocCopy(tmpfilename,localname); - if (strcmp(localname, "/")) + if (strcmp(localname, "/")) /* ** If filename is not root directory. */ - StrAllocCat(tmpfilename, "/"); + StrAllocCat(tmpfilename, "/"); StrAllocCat(tmpfilename, (char *)HTBTree_object(next_element)+1); /* - ** Append the current entry's filename - ** to the path. + ** Append the current entry's filename + ** to the path. */ HTSimplify(tmpfilename); /* - ** Output the directory entry. + ** Output the directory entry. */ if (strcmp((char *) (HTBTree_object(next_element)), "D..") && - strcmp((char *) + strcmp((char *) (HTBTree_object(next_element)), "A..")) - { + { #ifdef DIRED_SUPPORT - test = (*(char *)(HTBTree_object(next_element)) - == 'D' ? 'D' : 'F'); + test = (*(char *)(HTBTree_object(next_element)) + == 'D' ? 'D' : 'F'); if (state != test) { #ifndef LONG_LIST if (dir_list_style == FILES_FIRST) { if (state == 'F') - END(HTML_DIR); + END(HTML_DIR); } else if (dir_list_style != MIXED_STYLE) if (state == 'D') - END(HTML_DIR); + END(HTML_DIR); #endif /* !LONG_LIST */ - state = + state = (*(char *)(HTBTree_object(next_element)) - == 'D' ? 'D' : 'F'); + == 'D' ? 'D' : 'F'); START(HTML_H2); if (dir_list_style != MIXED_STYLE) { START(HTML_EM); PUTS(state == 'D' ? - "Subdirectories:" : "Files:"); + "Subdirectories:" : "Files:"); END(HTML_EM); } END(HTML_H2); @@ -2244,7 +2164,7 @@ PUBLIC int HTLoadFile ARGS4( next_element))) { #ifndef LONG_LIST if (state == 'D') - END(HTML_DIR); + END(HTML_DIR); #endif /* !LONG_LIST */ state = (*(char *)(HTBTree_object(next_element)) @@ -2261,7 +2181,7 @@ PUBLIC int HTLoadFile ARGS4( } #endif /* DIRED_SUPPORT */ #ifndef LONG_LIST - START(HTML_LI); + START(HTML_LI); #endif /* !LONG_LIST */ } entry = (char*)HTBTree_object(next_element)+1; @@ -2278,11 +2198,11 @@ PUBLIC int HTLoadFile ARGS4( PUTS(file_extra); FREE(file_extra); } - MAYBE_END(HTML_LI); + MAYBE_END(HTML_LI); #endif /* LONG_LIST */ next_element = HTBTree_next(bt, next_element); - /* pick up the next element of the list; + /* pick up the next element of the list; if none, return NULL*/ } if (state == 'I') { @@ -2294,7 +2214,7 @@ PUBLIC int HTLoadFile ARGS4( END(HTML_DIR); #endif /* !LONG_LIST */ } - /* end while directory entries left to read */ + /* end while directory entries left to read */ closedir(dp); FREE(logical); FREE(tmpfilename); @@ -2310,9 +2230,9 @@ PUBLIC int HTLoadFile ARGS4( } } /* end if localname is directory */ - + } /* end if file stat worked */ - + /* End of directory reading section */ #endif /* HAVE_READDIR */ @@ -2320,10 +2240,10 @@ PUBLIC int HTLoadFile ARGS4( FILE * fp = fopen(localname, "r"); if (TRACE) - fprintf (stderr, "HTLoadFile: Opening `%s' gives %p\n", + fprintf (stderr, "HTLoadFile: Opening `%s' gives %p\n", localname, (void*)fp); if (fp) { /* Good! */ - int len; + int len; char *cp = NULL; if (HTEditable(localname)) { @@ -2338,9 +2258,9 @@ PUBLIC int HTLoadFile ARGS4( */ if (!IsUnityEnc(myEncoding)) { /* - * We already know from the call to HTFileFormat above - * that this is a compressed file, no need to look at - * the filename again. - kw + * We already know from the call to HTFileFormat above + * that this is a compressed file, no need to look at + * the filename again. - kw */ #ifdef USE_ZLIB if (strcmp(format_out->name, "www/download") != 0 && @@ -2355,7 +2275,7 @@ PUBLIC int HTLoadFile ARGS4( localname, (void*)gzfp); use_gzread = YES; } else -#endif /* USE_ZLIB */ +#endif /* USE_ZLIB */ { StrAllocCopy(anchor->content_type, format->name); StrAllocCopy(anchor->content_encoding, HTAtom_name(myEncoding)); @@ -2363,7 +2283,7 @@ PUBLIC int HTLoadFile ARGS4( } } else if ((len = strlen(localname)) > 2) { if (localname[len - 1] == 'Z' && - localname[len - 2] == '.') { + localname[len - 2] == '.') { StrAllocCopy(cp, localname); cp[len - 2] = '\0'; format = HTFileFormat(cp, &encoding, NULL); @@ -2375,7 +2295,7 @@ PUBLIC int HTLoadFile ARGS4( format = HTAtom_for("www/compressed"); } else if ((len > 3) && !strcasecomp((char *)&localname[len - 2], - "gz") && + "gz") && localname[len - 3] == '.') { StrAllocCopy(cp, localname); cp[len - 3] = '\0'; @@ -2398,7 +2318,7 @@ PUBLIC int HTLoadFile ARGS4( } #else /* USE_ZLIB */ format = HTAtom_for("www/compressed"); -#endif /* USE_ZLIB */ +#endif /* USE_ZLIB */ } } FREE(localname); @@ -2444,31 +2364,31 @@ PUBLIC int HTLoadFile ARGS4( } /* If succesfull open */ FREE(localname); } /* scope of fp */ - } /* local unix file system */ + } /* local unix file system */ #endif /* !NO_UNIX_IO */ #endif /* VMS */ #ifndef DECNET /* - ** Now, as transparently mounted access has failed, we try FTP. + ** Now, as transparently mounted access has failed, we try FTP. */ { /* ** Deal with case-sensitivity differences on VMS verus Unix. */ #ifdef VMS - if (strcasecomp(nodename, HTHostName()) != 0) + if (strcasecomp(nodename, HTHostName()) != 0) #else if (strcmp(nodename, HTHostName()) != 0) #endif /* VMS */ { FREE(nodename); if (!strncmp(addr, "file://localhost", 16)) { - return -1; /* never go to ftp site when URL + return -1; /* never go to ftp site when URL * is file://localhost */ } else { - return HTFTPLoad(addr, anchor, format_out, sink); + return HTFTPLoad(addr, anchor, format_out, sink); } } FREE(nodename); @@ -2476,10 +2396,10 @@ PUBLIC int HTLoadFile ARGS4( #endif /* !DECNET */ /* - ** All attempts have failed. + ** All attempts have failed. */ { - if (TRACE) + if (TRACE) fprintf(stderr, "Can't open `%s', errno=%d\n", addr, SOCKET_ERRNO); return HTLoadError(sink, 403, "Can't access requested file."); diff --git a/WWW/Library/Implementation/HTFormat.c b/WWW/Library/Implementation/HTFormat.c index ee0e36c9..cf36c304 100644 --- a/WWW/Library/Implementation/HTFormat.c +++ b/WWW/Library/Implementation/HTFormat.c @@ -26,7 +26,7 @@ PUBLIC long int HTMaxBytes = 0; /* No effective limit */ #ifdef NeXT #define PRESENT_POSTSCRIPT "open %s; /bin/rm -f %s\n" #else -#define PRESENT_POSTSCRIPT "(ghostview %s ; /bin/rm -f %s)&\n" +#define PRESENT_POSTSCRIPT "(ghostview %s ; /bin/rm -f %s)&\n" /* Full pathname would be better! */ #endif /* NeXT */ #endif /* unix */ @@ -69,14 +69,14 @@ struct _HTStream { struct _HTStream { CONST HTStreamClass * isa; BOOL had_cr; - HTStream * sink; + HTStream * sink; }; /* Presentation methods ** -------------------- */ -PUBLIC HTList * HTPresentations = NULL; -PUBLIC HTPresentation * default_presentation = NULL; +PUBLIC HTList * HTPresentations = NULL; +PUBLIC HTPresentation * default_presentation = NULL; /* * To free off the presentation list. @@ -90,38 +90,38 @@ PUBLIC void HTSetPresentation ARGS6( CONST char *, representation, CONST char *, command, float, quality, - float, secs, + float, secs, float, secs_per_byte, long int, maxbytes) { HTPresentation * pres = (HTPresentation *)malloc(sizeof(HTPresentation)); if (pres == NULL) - outofmem(__FILE__, "HTSetPresentation"); - + outofmem(__FILE__, "HTSetPresentation"); + pres->rep = HTAtom_for(representation); pres->rep_out = WWW_PRESENT; /* Fixed for now ... :-) */ - pres->converter = HTSaveAndExecute; /* Fixed for now ... */ + pres->converter = HTSaveAndExecute; /* Fixed for now ... */ pres->quality = quality; pres->secs = secs; pres->secs_per_byte = secs_per_byte; pres->maxbytes = maxbytes; pres->command = NULL; StrAllocCopy(pres->command, command); - + /* * Memory leak fixed. - * 05-28-94 Lynx 2-3-1 Garrett Arch Blythe - */ + * 05-28-94 Lynx 2-3-1 Garrett Arch Blythe + */ if (!HTPresentations) { HTPresentations = HTList_new(); atexit(HTFreePresentations); } - + if (strcmp(representation, "*")==0) { FREE(default_presentation); default_presentation = pres; } else { - HTList_addObject(HTPresentations, pres); + HTList_addObject(HTPresentations, pres); } } @@ -133,14 +133,14 @@ PUBLIC void HTSetConversion ARGS7( CONST char *, representation_out, HTConverter*, converter, float, quality, - float, secs, + float, secs, float, secs_per_byte, long int, maxbytes) { HTPresentation * pres = (HTPresentation *)malloc(sizeof(HTPresentation)); if (pres == NULL) - outofmem(__FILE__, "HTSetConversion"); - + outofmem(__FILE__, "HTSetConversion"); + pres->rep = HTAtom_for(representation_in); pres->rep_out = HTAtom_for(representation_out); pres->converter = converter; @@ -150,16 +150,16 @@ PUBLIC void HTSetConversion ARGS7( pres->secs_per_byte = secs_per_byte; pres->maxbytes = maxbytes; pres->command = NULL; - + /* * Memory Leak fixed. * 05-28-94 Lynx 2-3-1 Garrett Arch Blythe - */ + */ if (!HTPresentations) { HTPresentations = HTList_new(); atexit(HTFreePresentations); } - + HTList_addObject(HTPresentations, pres); } @@ -177,7 +177,7 @@ PRIVATE void HTFreePresentations NOARGS HTPresentation * pres = NULL; /* - * Loop through the list. + * Loop through the list. */ while (!HTList_isEmpty(HTPresentations)) { /* @@ -230,17 +230,17 @@ PUBLIC char HTGetCharacter NOARGS do { if (input_pointer >= input_limit) { int status = NETREAD(input_file_number, - input_buffer, INPUT_BUFFER_SIZE); + input_buffer, INPUT_BUFFER_SIZE); if (status <= 0) { if (status == 0) return (char)EOF; if (status == HT_INTERRUPTED) { - if (TRACE) - fprintf(stderr, - "HTFormat: Interrupted in HTGetCharacter\n"); - interrupted_in_htgetcharacter = 1; - return (char)EOF; - } + if (TRACE) + fprintf(stderr, + "HTFormat: Interrupted in HTGetCharacter\n"); + interrupted_in_htgetcharacter = 1; + return (char)EOF; + } if (TRACE) fprintf(stderr, "HTFormat: File read error %d\n", status); return (char)EOF; /* -1 is returned by UCX @@ -251,29 +251,9 @@ PUBLIC char HTGetCharacter NOARGS } ch = *input_pointer++; } while (ch == (char) 13); /* Ignore ASCII carriage return */ - - return FROMASCII(ch); -} -#ifdef NOT_USED -/* Stream the data to an ouput file as binary -*/ -PUBLIC int HTOutputBinary ARGS2( int, input, - FILE *, output) -{ - do { - int status = NETREAD(input, input_buffer, INPUT_BUFFER_SIZE); - if (status <= 0) { - if (status == 0) - return 0; - if (TRACE) - fprintf(stderr, "HTFormat: File read error %d\n", status); - return 2; /* Error */ - } - fwrite(input_buffer, sizeof(char), status, output); - } while (YES); + return FROMASCII(ch); } -#endif /* NOT_USED */ /* Match maintype to any MIME type starting with maintype, * for example: image/gif should match image @@ -291,7 +271,7 @@ PRIVATE int half_match ARGS2(char *,trial_type, char *,target) trial_type, target); /* main type matches */ - if (!strncmp(trial_type, target, (cp-trial_type)-1)) + if (!strncmp(trial_type, target, (cp-trial_type)-1)) return 1; return 0; @@ -316,13 +296,13 @@ PRIVATE HTPresentation * HTFindPresentation ARGS3( HTAtom * wildcard = HTAtom_for("*"); if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTFormat: Looking up presentation for %s to %s\n", HTAtom_name(rep_in), HTAtom_name(rep_out)); - + /* don't do anymore do it in the Lynx code at startup LJM */ - /* if (!HTPresentations) HTFormatInit(); */ /* set up the list */ - + /* if (!HTPresentations) HTFormatInit(); */ /* set up the list */ + { int n = HTList_count(HTPresentations); int i; @@ -335,18 +315,18 @@ PRIVATE HTPresentation * HTFindPresentation ARGS3( for (i = 0; i < n; i++) { pres = (HTPresentation *)HTList_objectAt(HTPresentations, i); if (pres->rep == rep_in) { - if (pres->rep_out == rep_out) { + if (pres->rep_out == rep_out) { if (TRACE) fprintf(stderr, "FindPresentation: found exact match: %s\n", HTAtom_name(pres->rep)); - return pres; + return pres; } else if (!fill_in) { continue; } else if (pres->rep_out == wildcard) { if (!strong_wildcard_match) - strong_wildcard_match = pres; + strong_wildcard_match = pres; /* otherwise use the first one */ if (TRACE) fprintf(stderr, @@ -359,9 +339,9 @@ PRIVATE HTPresentation * HTFindPresentation ARGS3( } else if (half_match(HTAtom_name(pres->rep), HTAtom_name(rep_in))) { - if (pres->rep_out == rep_out) { + if (pres->rep_out == rep_out) { if (!strong_subtype_wildcard_match) - strong_subtype_wildcard_match = pres; + strong_subtype_wildcard_match = pres; /* otherwise use the first one */ if (TRACE) fprintf(stderr, @@ -373,7 +353,7 @@ PRIVATE HTPresentation * HTFindPresentation ARGS3( if (pres->rep == WWW_SOURCE) { if (pres->rep_out == rep_out) { if (!weak_wildcard_match) - weak_wildcard_match = pres; + weak_wildcard_match = pres; /* otherwise use the first one */ if (TRACE) fprintf(stderr, @@ -382,23 +362,23 @@ PRIVATE HTPresentation * HTFindPresentation ARGS3( } if (pres->rep_out == wildcard) { if (!last_default_match) - last_default_match = pres; + last_default_match = pres; /* otherwise use the first one */ } } } - + match = strong_subtype_wildcard_match ? strong_subtype_wildcard_match : - strong_wildcard_match ? strong_wildcard_match : - weak_wildcard_match ? weak_wildcard_match : + strong_wildcard_match ? strong_wildcard_match : + weak_wildcard_match ? weak_wildcard_match : last_default_match; - + if (match) { *fill_in = *match; /* Specific instance */ fill_in->rep = rep_in; /* yuk */ - fill_in->rep_out = rep_out; /* yuk */ + fill_in->rep_out = rep_out; /* yuk */ return fill_in; - } + } } return NULL; @@ -424,10 +404,10 @@ PUBLIC HTStream * HTStreamStack ARGS4( HTPresentation *match; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTFormat: Constructing stream stack for %s to %s\n", HTAtom_name(rep_in), HTAtom_name(rep_out)); - + /* don't return on WWW_SOURCE some people might like * to make use of the source!!!! LJM *//* @@ -435,7 +415,7 @@ PUBLIC HTStream * HTStreamStack ARGS4( return sink; LJM */ if (rep_out == rep_in) - return sink; + return sink; if ((match = HTFindPresentation(rep_in, rep_out, &temp))) { if (match == &temp) { @@ -469,7 +449,7 @@ PUBLIC void HTReorderPresentation ARGS2( HTList_removeObject(HTPresentations, match); HTList_addObject(HTPresentations, match); } -} +} /* Find the cost of a filter stack ** ------------------------------- ** @@ -487,16 +467,16 @@ PUBLIC float HTStackValue ARGS4( HTAtom * wildcard = HTAtom_for("*"); if (TRACE) - fprintf(stderr, - "HTFormat: Evaluating stream stack for %s worth %.3f to %s\n", + fprintf(stderr, + "HTFormat: Evaluating stream stack for %s worth %.3f to %s\n", HTAtom_name(rep_in), initial_value, HTAtom_name(rep_out)); - + if (rep_out == WWW_SOURCE || rep_out == rep_in) - return 0.0; + return 0.0; /* don't do anymore do it in the Lynx code at startup LJM */ - /* if (!HTPresentations) HTFormatInit(); */ /* set up the list */ - + /* if (!HTPresentations) HTFormatInit(); */ /* set up the list */ + { int n = HTList_count(HTPresentations); int i; @@ -504,20 +484,20 @@ PUBLIC float HTStackValue ARGS4( for (i = 0; i < n; i++) { pres = (HTPresentation *)HTList_objectAt(HTPresentations, i); if (pres->rep == rep_in && - (pres->rep_out == rep_out || pres->rep_out == wildcard)) { - float value = initial_value * pres->quality; + (pres->rep_out == rep_out || pres->rep_out == wildcard)) { + float value = initial_value * pres->quality; if (HTMaxSecs != 0.0) value = value - (length*pres->secs_per_byte + pres->secs) - /HTMaxSecs; + /HTMaxSecs; return value; } } } - + return -1e30; /* Really bad */ } - + /* Push data from a socket down a stream ** ------------------------------------- ** @@ -535,18 +515,18 @@ PUBLIC int HTCopy ARGS4( void*, handle, HTStream*, sink) { - HTStreamClass targetClass; + HTStreamClass targetClass; char line[256]; int bytes = 0; int rv = 0; - /* Push the data down the stream + /* Push the data down the stream */ - targetClass = *(sink->isa); /* Copy pointers to procedures */ + targetClass = *(sink->isa); /* Copy pointers to procedures */ /* Push binary from socket down sink ** - ** This operation could be put into a main event loop + ** This operation could be put into a main event loop */ for (;;) { int status; @@ -562,19 +542,19 @@ PUBLIC int HTCopy ARGS4( _HTProgress ("Data transfer interrupted."); (*targetClass._abort)(sink, NULL); if (bytes) - rv = HT_INTERRUPTED; + rv = HT_INTERRUPTED; else rv = -1; goto finished; - } + } - status = NETREAD(file_number, input_buffer, INPUT_BUFFER_SIZE); + status = NETREAD(file_number, input_buffer, INPUT_BUFFER_SIZE); if (status <= 0) { if (status == 0) { - break; + break; } else if (status == HT_INTERRUPTED) { - _HTProgress ("Data transfer interrupted."); + _HTProgress ("Data transfer interrupted."); (*targetClass._abort)(sink, NULL); if (bytes) rv = HT_INTERRUPTED; @@ -582,18 +562,18 @@ PUBLIC int HTCopy ARGS4( rv = -1; goto finished; } else if (SOCKET_ERRNO == ENOTCONN || - SOCKET_ERRNO == ECONNRESET || + SOCKET_ERRNO == ECONNRESET || SOCKET_ERRNO == EPIPE) { - /* + /* * Arrrrgh, HTTP 0/1 compability problem, maybe. */ if (bytes <= 0) { /* - * Don't have any data, so let the calling - * function decide what to do about it. - FM + * Don't have any data, so let the calling + * function decide what to do about it. - FM */ rv = -2; - goto finished; + goto finished; } else { /* * Treat what we've gotten already @@ -623,7 +603,7 @@ PUBLIC int HTCopy ARGS4( bytes += status; if (anchor && anchor->content_length > 0) sprintf(line, "Read %d of %d bytes of data.", - bytes, anchor->content_length); + bytes, anchor->content_length); else sprintf(line, "Read %d bytes of data.", bytes); HTProgress(line); @@ -647,17 +627,17 @@ finished: ** */ PUBLIC int HTFileCopy ARGS2( - FILE *, fp, + FILE *, fp, HTStream*, sink) { - HTStreamClass targetClass; + HTStreamClass targetClass; char line[256]; int status, bytes = 0, nreads = 0, nprogr = 0; int rv = HT_OK; - - /* Push the data down the stream + + /* Push the data down the stream */ - targetClass = *(sink->isa); /* Copy pointers to procedures */ + targetClass = *(sink->isa); /* Copy pointers to procedures */ /* Push binary from socket down sink */ @@ -667,10 +647,10 @@ PUBLIC int HTFileCopy ARGS2( if (status == 0) { /* EOF or error */ if (ferror(fp) == 0) { rv = HT_LOADED; - break; + break; } if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTFormat: Read error, read returns %d\n", ferror(fp)); if (bytes) { @@ -685,11 +665,11 @@ PUBLIC int HTFileCopy ARGS2( bytes += status; if (nreads >= 100) { /* - ** Show progress messages for local files, and check for - ** user interruption. Start doing so only after a certain - ** number of reads have been done, and don't update it on - ** every read (normally reading in a local file should be - ** speedy). - KW + ** Show progress messages for local files, and check for + ** user interruption. Start doing so only after a certain + ** number of reads have been done, and don't update it on + ** every read (normally reading in a local file should be + ** speedy). - KW */ if (nprogr == 0) { if (bytes < 1024000) { @@ -731,18 +711,18 @@ PUBLIC int HTFileCopy ARGS2( ** */ PRIVATE int HTGzFileCopy ARGS2( - gzFile, gzfp, + gzFile, gzfp, HTStream*, sink) { - HTStreamClass targetClass; + HTStreamClass targetClass; char line[256]; int status, bytes = 0, nreads = 0, nprogr = 0; int gzerrnum; int rv = HT_OK; - - /* Push the data down the stream + + /* Push the data down the stream */ - targetClass = *(sink->isa); /* Copy pointers to procedures */ + targetClass = *(sink->isa); /* Copy pointers to procedures */ /* read and inflate gzipped file, and push binary down sink */ @@ -752,13 +732,13 @@ PRIVATE int HTGzFileCopy ARGS2( if (status <= 0) { /* EOF or error */ if (status == 0) { rv = HT_LOADED; - break; + break; } if (TRACE) { - fprintf(stderr, + fprintf(stderr, "HTGzFileCopy: Read error, gzread returns %d\n", status); - fprintf(stderr, + fprintf(stderr, "gzerror : %s\n", gzerror(gzfp, &gzerrnum)); if (gzerrnum == Z_ERRNO) @@ -776,11 +756,11 @@ PRIVATE int HTGzFileCopy ARGS2( bytes += status; if (nreads >= 100) { /* - ** Show progress messages for local files, and check for - ** user interruption. Start doing so only after a certain - ** number of reads have been done, and don't update it on - ** every read (normally reading in a local file should be - ** speedy). - KW + ** Show progress messages for local files, and check for + ** user interruption. Start doing so only after a certain + ** number of reads have been done, and don't update it on + ** every read (normally reading in a local file should be + ** speedy). - KW */ if (nprogr == 0) { if (bytes < 1024000) { @@ -830,24 +810,24 @@ PUBLIC void HTCopyNoCR ARGS3( int, file_number, HTStream*, sink) { - HTStreamClass targetClass; + HTStreamClass targetClass; char character; - /* Push the data, ignoring CRLF, down the stream + /* Push the data, ignoring CRLF, down the stream */ - targetClass = *(sink->isa); /* Copy pointers to procedures */ + targetClass = *(sink->isa); /* Copy pointers to procedures */ - /* Push text from telnet socket down sink + /* Push text from telnet socket down sink ** - ** @@@@@ To push strings could be faster? (especially is we - ** cheat and don't ignore CR! :-} - */ + ** @@@@@ To push strings could be faster? (especially is we + ** cheat and don't ignore CR! :-} + */ HTInitInput(file_number); for (;;) { character = HTGetCharacter(); if (character == (char)EOF) break; - (*targetClass.put_character)(sink, character); + (*targetClass.put_character)(sink, character); } } @@ -873,28 +853,28 @@ PUBLIC int HTParseSocket ARGS5( int rv; stream = HTStreamStack(rep_in, format_out, sink, anchor); - + if (!stream) { - char buffer[1024]; /* @@@@@@@@ */ - if (LYCancelDownload) { + char buffer[1024]; /* @@@@@@@@ */ + if (LYCancelDownload) { LYCancelDownload = FALSE; return -1; } sprintf(buffer, "Sorry, can't convert from %s to %s.", - HTAtom_name(rep_in), HTAtom_name(format_out)); + HTAtom_name(rep_in), HTAtom_name(format_out)); if (TRACE) fprintf(stderr, "HTFormat: %s\n", buffer); - return HTLoadError(sink, 501, buffer); /* returns -501 */ + return HTLoadError(sink, 501, buffer); /* returns -501 */ } - + /* ** Push the data, don't worry about CRLF we can strip them later. */ targetClass = *(stream->isa); /* Copy pointers to procedures */ rv = HTCopy(anchor, file_number, NULL, stream); if (rv != -1 && rv != HT_INTERRUPTED) - (*targetClass._free)(stream); - + (*targetClass._free)(stream); + return rv; /* full: HT_LOADED; partial: HT_INTERRUPTED; no bytes: -1 */ } @@ -912,20 +892,20 @@ PUBLIC int HTParseFile ARGS5( HTFormat, rep_in, HTFormat, format_out, HTParentAnchor *, anchor, - FILE *, fp, + FILE *, fp, HTStream*, sink) { HTStream * stream; - HTStreamClass targetClass; + HTStreamClass targetClass; int rv; stream = HTStreamStack(rep_in, format_out, - sink , anchor); - + sink , anchor); + if (!stream) { - char buffer[1024]; /* @@@@@@@@ */ - if (LYCancelDownload) { + char buffer[1024]; /* @@@@@@@@ */ + if (LYCancelDownload) { LYCancelDownload = FALSE; return -1; } @@ -933,19 +913,19 @@ PUBLIC int HTParseFile ARGS5( HTAtom_name(rep_in), HTAtom_name(format_out)); if (TRACE) fprintf(stderr, "HTFormat(in HTParseFile): %s\n", buffer); - return HTLoadError(sink, 501, buffer); + return HTLoadError(sink, 501, buffer); } - - /* Push the data down the stream + + /* Push the data down the stream ** - ** @@ Bug: This decision ought to be made based on "encoding" - ** rather than on content-type. @@@ When we handle encoding. - ** The current method smells anyway. + ** @@ Bug: This decision ought to be made based on "encoding" + ** rather than on content-type. @@@ When we handle encoding. + ** The current method smells anyway. */ targetClass = *(stream->isa); /* Copy pointers to procedures */ rv = HTFileCopy(fp, stream); if (rv == -1 || rv == HT_INTERRUPTED) { - (*targetClass._abort)(stream, NULL); + (*targetClass._abort)(stream, NULL); } else { (*targetClass._free)(stream); } @@ -960,7 +940,7 @@ PUBLIC int HTParseFile ARGS5( #ifdef USE_ZLIB PRIVATE int HTCloseGzFile ARGS1( - gzFile, gzfp) + gzFile, gzfp) { int gzres; if (gzfp == NULL) @@ -975,27 +955,27 @@ PRIVATE int HTCloseGzFile ARGS1( } return(gzres); } - + PUBLIC int HTParseGzFile ARGS5( HTFormat, rep_in, HTFormat, format_out, HTParentAnchor *, anchor, - gzFile, gzfp, + gzFile, gzfp, HTStream*, sink) { HTStream * stream; - HTStreamClass targetClass; + HTStreamClass targetClass; int rv; stream = HTStreamStack(rep_in, format_out, - sink , anchor); - + sink , anchor); + if (!stream) { - char buffer[1024]; /* @@@@@@@@ */ + char buffer[1024]; /* @@@@@@@@ */ extern char LYCancelDownload; HTCloseGzFile(gzfp); - if (LYCancelDownload) { + if (LYCancelDownload) { LYCancelDownload = FALSE; return -1; } @@ -1003,19 +983,19 @@ PUBLIC int HTParseGzFile ARGS5( HTAtom_name(rep_in), HTAtom_name(format_out)); if (TRACE) fprintf(stderr, "HTFormat(in HTParseGzFile): %s\n", buffer); - return HTLoadError(sink, 501, buffer); + return HTLoadError(sink, 501, buffer); } - - /* Push the data down the stream + + /* Push the data down the stream ** - ** @@ Bug: This decision ought to be made based on "encoding" - ** rather than on content-type. @@@ When we handle encoding. - ** The current method smells anyway. + ** @@ Bug: This decision ought to be made based on "encoding" + ** rather than on content-type. @@@ When we handle encoding. + ** The current method smells anyway. */ targetClass = *(stream->isa); /* Copy pointers to procedures */ rv = HTGzFileCopy(gzfp, stream); if (rv == -1 || rv == HT_INTERRUPTED) { - (*targetClass._abort)(stream, NULL); + (*targetClass._abort)(stream, NULL); } else { (*targetClass._free)(stream); } @@ -1044,12 +1024,12 @@ PRIVATE void NetToText_put_character ARGS2(HTStream *, me, char, net_char) { char c = FROMASCII(net_char); if (me->had_cr) { - if (c == LF) { + if (c == LF) { me->sink->isa->put_character(me->sink, '\n'); /* Newline */ me->had_cr = NO; return; - } else { - me->sink->isa->put_character(me->sink, CR); /* leftover */ + } else { + me->sink->isa->put_character(me->sink, CR); /* leftover */ } } me->had_cr = (c == CR); @@ -1062,7 +1042,7 @@ PRIVATE void NetToText_put_string ARGS2(HTStream *, me, CONST char *, s) CONST char * p; for (p = s; *p; p++) - NetToText_put_character(me, *p); + NetToText_put_character(me, *p); } PRIVATE void NetToText_put_block ARGS3(HTStream *, me, CONST char*, s, int, l) @@ -1070,7 +1050,7 @@ PRIVATE void NetToText_put_block ARGS3(HTStream *, me, CONST char*, s, int, l) CONST char * p; for (p = s; p < (s+l); p++) - NetToText_put_character(me, *p); + NetToText_put_character(me, *p); } PRIVATE void NetToText_free ARGS1(HTStream *, me) @@ -1103,9 +1083,9 @@ PUBLIC HTStream * HTNetToText ARGS1(HTStream *, sink) HTStream* me = (HTStream*)malloc(sizeof(*me)); if (me == NULL) - outofmem(__FILE__, "NetToText"); + outofmem(__FILE__, "NetToText"); me->isa = &NetToTextClass; - + me->had_cr = NO; me->sink = sink; return me; diff --git a/WWW/Library/Implementation/HTGopher.c b/WWW/Library/Implementation/HTGopher.c index 449a355d..53e4149b 100644 --- a/WWW/Library/Implementation/HTGopher.c +++ b/WWW/Library/Implementation/HTGopher.c @@ -7,7 +7,7 @@ ** 10 Mar 96 Foteos Macrides (macrides@sci.wfbr.edu). Added a ** form-based CSO/PH gateway. Can be invoked via a ** "cso://host[:port]/" or "gopher://host:105/2" -** URL. If a gopher URL is used with a query token +** URL. If a gopher URL is used with a query token ** ('?'), the old ISINDEX procedure will be used ** instead of the form-based gateway. ** 15 Mar 96 Foteos Macrides (macrides@sci.wfbr.edu). Pass @@ -27,12 +27,12 @@ */ #include "HTGopher.h" -#define HT_EM_SPACE ((char)2) /* For now */ +#define HT_EM_SPACE ((char)2) /* For now */ #define GOPHER_PORT 70 /* See protocol spec */ #define CSO_PORT 105 /* See protocol spec */ #define BIG 1024 /* Bug */ -#define LINE_LENGTH 256 /* Bug */ +#define LINE_LENGTH 256 /* Bug */ /* ** Gopher entity types. @@ -42,24 +42,24 @@ #define GOPHER_CSO '2' #define GOPHER_ERROR '3' #define GOPHER_MACBINHEX '4' -#define GOPHER_PCBINARY '5' +#define GOPHER_PCBINARY '5' #define GOPHER_UUENCODED '6' #define GOPHER_INDEX '7' #define GOPHER_TELNET '8' -#define GOPHER_BINARY '9' -#define GOPHER_GIF 'g' -#define GOPHER_HTML 'h' /* HTML */ -#define GOPHER_CHTML 'H' /* HTML */ -#define GOPHER_SOUND 's' +#define GOPHER_BINARY '9' +#define GOPHER_GIF 'g' +#define GOPHER_HTML 'h' /* HTML */ +#define GOPHER_CHTML 'H' /* HTML */ +#define GOPHER_SOUND 's' #define GOPHER_WWW 'w' /* W3 address */ -#define GOPHER_IMAGE 'I' -#define GOPHER_TN3270 'T' -#define GOPHER_INFO 'i' +#define GOPHER_IMAGE 'I' +#define GOPHER_TN3270 'T' +#define GOPHER_INFO 'i' #define GOPHER_DUPLICATE '+' #define GOPHER_PLUS_IMAGE ':' /* Addition from Gopher Plus */ #define GOPHER_PLUS_MOVIE ';' #define GOPHER_PLUS_SOUND '<' -#define GOPHER_PLUS_PDF 'P' +#define GOPHER_PLUS_PDF 'P' #include <ctype.h> @@ -84,7 +84,7 @@ #define GOPHER_PROGRESS(foo) HTAlert(foo) -#define NEXT_CHAR HTGetCharacter() +#define NEXT_CHAR HTGetCharacter() /* ** Module-wide variables. @@ -99,25 +99,25 @@ struct _HTStructured { PRIVATE HTStructured *target; /* the new gopher hypertext */ PRIVATE HTStructuredClass targetClass; /* Its action routines */ -struct _HTStream +struct _HTStream { HTStreamClass * isa; /* For form-based CSO gateway - FM */ }; -typedef struct _CSOfield_info { /* For form-based CSO gateway - FM */ +typedef struct _CSOfield_info { /* For form-based CSO gateway - FM */ struct _CSOfield_info * next; char * name; char * attributes; char * description; int id; - int lookup; - int indexed; - int url; - int max_size; - int defreturn; - int explicit_return; - int reserved; - int public; + int lookup; + int indexed; + int url; + int max_size; + int defreturn; + int explicit_return; + int reserved; + int public; char name_buf[16]; /* Avoid malloc if we can */ char desc_buf[32]; /* Avoid malloc if we can */ char attr_buf[80]; /* Avoid malloc if we can */ @@ -129,13 +129,13 @@ typedef struct _CSOformgen_context { /* For form-based CSO gateway - FM */ char * host; char * seek; CSOfield_info * fld; - int port; - int cur_line; - int cur_off; - int rep_line; - int rep_off; - int public_override; - int field_select; + int port; + int cur_line; + int cur_off; + int rep_line; + int rep_off; + int public_override; + int field_select; } CSOformgen_context; /* Matrix of allowed characters in filenames @@ -147,12 +147,12 @@ PRIVATE BOOL acceptable_inited = NO; PRIVATE void init_acceptable NOARGS { unsigned int i; - char * good = + char * good = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./-_$"; for(i = 0; i < 256; i++) - acceptable[i] = NO; + acceptable[i] = NO; for(; *good; good++) - acceptable[(unsigned int)*good] = YES; + acceptable[(unsigned int)*good] = YES; acceptable_inited = YES; } @@ -163,7 +163,7 @@ PRIVATE CONST char hex[17] = "0123456789abcdef"; PRIVATE char from_hex ARGS1(char, c) { - return (c>='0')&&(c<='9') ? c-'0' + return (c>='0')&&(c<='9') ? c-'0' : (c>='A')&&(c<='F') ? c-'A'+10 : (c>='a')&&(c<='f') ? c-'a'+10 : 0; @@ -176,8 +176,8 @@ PRIVATE char from_hex ARGS1(char, c) ** of knowing what the title is when we arrive. ** ** On entry, -** HT is in append mode. -** text points to the text to be put into the file, 0 terminated. +** HT is in append mode. +** text points to the text to be put into the file, 0 terminated. ** addr points to the hypertext refernce address 0 terminated. */ PUBLIC BOOLEAN HT_Is_Gopher_URL=FALSE; @@ -186,11 +186,11 @@ PRIVATE void write_anchor ARGS2(CONST char *,text, CONST char *,addr) { BOOL present[HTML_A_ATTRIBUTES]; CONST char * value[HTML_A_ATTRIBUTES]; - + int i; - + for (i = 0; i < HTML_A_ATTRIBUTES; i++) - present[i] = 0; + present[i] = 0; present[HTML_A_HREF] = YES; ((CONST char **)value)[HTML_A_HREF] = addr; present[HTML_A_TITLE] = YES; @@ -198,11 +198,11 @@ PRIVATE void write_anchor ARGS2(CONST char *,text, CONST char *,addr) if(TRACE) fprintf(stderr,"HTGopher: adding URL: %s\n",addr); - + HT_Is_Gopher_URL = TRUE; /* tell HTML.c that this is a Gopher URL */ (*targetClass.start_element)(target, HTML_A, present, - (CONST char **)value, -1, 0); - + (CONST char **)value, -1, 0); + PUTS(text); END(HTML_A); } @@ -227,10 +227,10 @@ PRIVATE void parse_menu ARGS2( int BytesReported = 0; char buffer[128]; -#define TAB '\t' -#define HEX_ESCAPE '%' +#define TAB '\t' +#define HEX_ESCAPE '%' + - START(HTML_HTML); PUTS("\n"); START(HTML_HEAD); @@ -239,7 +239,7 @@ PRIVATE void parse_menu ARGS2( if ((title = HTAnchor_title(anAnchor))) PUTS(title); else - PUTS("Gopher Menu"); + PUTS("Gopher Menu"); END(HTML_TITLE); PUTS("\n"); END(HTML_HEAD); @@ -251,7 +251,7 @@ PRIVATE void parse_menu ARGS2( if ((title = HTAnchor_title(anAnchor))) PUTS(title); else - PUTS("Gopher Menu"); + PUTS("Gopher Menu"); END(HTML_H1); PUTS("\n"); START(HTML_PRE); @@ -259,39 +259,39 @@ PRIVATE void parse_menu ARGS2( if (interrupted_in_htgetcharacter) { if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTGopher: Interrupted in HTGetCharacter, apparently.\n"); goto end_html; - } + } - if (ch != LF) { + if (ch != LF) { *p = ch; /* Put character in line */ if (p< &line[BIG-1]) p++; - + } else { *p++ = '\0'; /* Terminate line */ - bytes += p-line; /* add size */ + bytes += p-line; /* add size */ p = line; /* Scan it to parse it */ port = 0; /* Flag "not parsed" */ if (TRACE) - fprintf(stderr, "HTGopher: Menu item: %s\n", line); + fprintf(stderr, "HTGopher: Menu item: %s\n", line); gtype = *p++; if (bytes > BytesReported + 1024) { - sprintf(buffer, "Transferred %d bytes", bytes); - HTProgress(buffer); + sprintf(buffer, "Transferred %d bytes", bytes); + HTProgress(buffer); BytesReported = bytes; } - + /* Break on line with a dot by itself */ if ((gtype=='.') && ((*p=='\r') || (*p==0))) - break; + break; if (gtype && *p) { - name = p; + name = p; selector = strchr(name, TAB); if (selector) { - *selector++ = '\0'; /* Terminate name */ + *selector++ = '\0'; /* Terminate name */ /* * Gopher+ Type=0+ objects can be binary, and will * have 9 or 5 beginning their selector. Make sure @@ -299,11 +299,11 @@ PRIVATE void parse_menu ARGS2( * text. - FM */ if (gtype == GOPHER_TEXT && (*selector == GOPHER_BINARY || - *selector == GOPHER_PCBINARY)) - gtype = *selector; + *selector == GOPHER_PCBINARY)) + gtype = *selector; host = strchr(selector, TAB); if (host) { - *host++ = '\0'; /* Terminate selector */ + *host++ = '\0'; /* Terminate selector */ port = strchr(host, TAB); if (port) { char *junk; @@ -311,15 +311,15 @@ PRIVATE void parse_menu ARGS2( junk = strchr(port, TAB); if (junk) *junk++ = '\0'; /* Chop port */ if ((port[1]=='0') && (!port[2])) - port[0] = '\0'; /* 0 means none */ + port[0] = '\0'; /* 0 means none */ } /* no port */ } /* host ok */ } /* selector ok */ } /* gtype and name ok */ - + /* Nameless files are a separator line */ if (gtype == GOPHER_TEXT) { - int i = strlen(name)-1; + int i = strlen(name)-1; while (name[i] == ' ' && i >= 0) name[i--] = '\0'; if (i < 0) @@ -342,13 +342,13 @@ PRIVATE void parse_menu ARGS2( selector, host); else sprintf(address, "telnet://%s/", host); } - else if (gtype == GOPHER_TN3270) + else if (gtype == GOPHER_TN3270) { PUTS("(3270) "); - if (*selector) + if (*selector) sprintf(address, "tn3270://%s@%s/", selector, host); - else + else sprintf(address, "tn3270://%s/", host); } else { /* If parsed ok */ @@ -356,55 +356,55 @@ PRIVATE void parse_menu ARGS2( char *r; switch(gtype) { - case GOPHER_TEXT: - PUTS("(FILE) "); - break; - case GOPHER_MENU: - PUTS(" (DIR) "); - break; - case GOPHER_CSO: - PUTS(" (CSO) "); - break; - case GOPHER_PCBINARY: - PUTS(" (BIN) "); - break; - case GOPHER_UUENCODED: - PUTS(" (UUE) "); - break; - case GOPHER_INDEX: - PUTS(" (?) "); - break; - case GOPHER_BINARY: - PUTS(" (BIN) "); - break; - case GOPHER_GIF: - case GOPHER_IMAGE: - case GOPHER_PLUS_IMAGE: - PUTS(" (IMG) "); - break; - case GOPHER_SOUND: - case GOPHER_PLUS_SOUND: - PUTS(" (SND) "); - break; - case GOPHER_MACBINHEX: - PUTS(" (HQX) "); - break; + case GOPHER_TEXT: + PUTS("(FILE) "); + break; + case GOPHER_MENU: + PUTS(" (DIR) "); + break; + case GOPHER_CSO: + PUTS(" (CSO) "); + break; + case GOPHER_PCBINARY: + PUTS(" (BIN) "); + break; + case GOPHER_UUENCODED: + PUTS(" (UUE) "); + break; + case GOPHER_INDEX: + PUTS(" (?) "); + break; + case GOPHER_BINARY: + PUTS(" (BIN) "); + break; + case GOPHER_GIF: + case GOPHER_IMAGE: + case GOPHER_PLUS_IMAGE: + PUTS(" (IMG) "); + break; + case GOPHER_SOUND: + case GOPHER_PLUS_SOUND: + PUTS(" (SND) "); + break; + case GOPHER_MACBINHEX: + PUTS(" (HQX) "); + break; case GOPHER_HTML: case GOPHER_CHTML: - PUTS("(HTML) "); - break; - case 'm': - PUTS("(MIME) "); - break; - case GOPHER_PLUS_MOVIE: - PUTS(" (MOV) "); - break; - case GOPHER_PLUS_PDF: - PUTS(" (PDF) "); - break; - default: - PUTS("(UNKN) "); - break; + PUTS("(HTML) "); + break; + case 'm': + PUTS("(MIME) "); + break; + case GOPHER_PLUS_MOVIE: + PUTS(" (MOV) "); + break; + case GOPHER_PLUS_PDF: + PUTS(" (PDF) "); + break; + default: + PUTS("(UNKN) "); + break; } sprintf(address, "//%s/%c", host, gtype); @@ -428,19 +428,19 @@ PRIVATE void parse_menu ARGS2( else PUTS(name); } else { /* parse error */ - if (TRACE) + if (TRACE) fprintf(stderr, "HTGopher: Bad menu item.\n"); PUTS(line); } /* parse error */ - + PUTS("\n"); p = line; /* Start again at beginning of line */ - + } /* if end of line */ - + } /* Loop over characters */ - + end_html: END(HTML_PRE); PUTS("\n"); @@ -449,7 +449,7 @@ end_html: END(HTML_HTML); PUTS("\n"); FREE_TARGET; - + return; } @@ -463,7 +463,7 @@ end_html: ** other source as well??? ** ** Taken from hacking by Lou Montulli@ukanaix.cc.ukans.edu -** on XMosaic-1.1, and put on libwww 2.11 by Arthur Secret, +** on XMosaic-1.1, and put on libwww 2.11 by Arthur Secret, ** secret@dxcern.cern.ch . */ PRIVATE void parse_cso ARGS2( @@ -475,58 +475,58 @@ PRIVATE void parse_cso ARGS2( char *p = line; char *second_colon, last_char='\0'; CONST char *title; - + START(HTML_HEAD); PUTS("\n"); START(HTML_TITLE); if ((title = HTAnchor_title(anAnchor))) - PUTS(title); + PUTS(title); else - PUTS("CSO Search Results"); + PUTS("CSO Search Results"); END(HTML_TITLE); PUTS("\n"); END(HTML_HEAD); PUTS("\n"); START(HTML_H1); if ((title = HTAnchor_title(anAnchor))) - PUTS(title); + PUTS(title); else { - PUTS(arg); - PUTS(" Search Results"); + PUTS(arg); + PUTS(" Search Results"); } END(HTML_H1); PUTS("\n"); START(HTML_PRE); /* - ** Start grabbing chars from the network. + ** Start grabbing chars from the network. */ - while ((ch=NEXT_CHAR) != (char)EOF) + while ((ch=NEXT_CHAR) != (char)EOF) { - if (ch != LF) + if (ch != LF) { *p = ch; /* Put character in line */ if (p< &line[BIG-1]) p++; - } - else + } + else { *p = '\0'; /* Terminate line */ p = line; /* Scan it to parse it */ /* - ** OK we now have a line in 'p'. - ** Lets parse it and print it. + ** OK we now have a line in 'p'. + ** Lets parse it and print it. */ - + /* - ** Break on line that begins with a 2. - ** It's the end of data. + ** Break on line that begins with a 2. + ** It's the end of data. */ if (*p == '2') break; - + /* - ** Lines beginning with 5 are errors. - ** Print them and quit. + ** Lines beginning with 5 are errors. + ** Print them and quit. */ if (*p == '5') { START(HTML_H2); @@ -534,73 +534,73 @@ PRIVATE void parse_cso ARGS2( END(HTML_H2); break; } - + if (*p == '-') { /* ** Data lines look like -200:#: - ** where # is the search result number and can be + ** where # is the search result number and can be ** multiple digits (infinite?). ** Find the second colon and check the digit to the ** left of it to see if they are diferent. - ** If they are then a different person is starting. + ** If they are then a different person is starting. ** Make this line an <h2>. */ - + /* ** Find the second_colon. */ second_colon = strchr( strchr(p,':')+1, ':'); - + if(second_colon != NULL) { /* error check */ - - if (*(second_colon-1) != last_char) + + if (*(second_colon-1) != last_char) /* print seperator */ { END(HTML_PRE); START(HTML_H2); } - - + + /* - ** Right now the record appears with the alias - ** (first line) as the header and the rest as - ** <pre> text. - ** It might look better with the name as the - ** header and the rest as a <ul> with <li> tags. - ** I'm not sure whether the name field comes in - ** any special order or if its even required in - ** a record, so for now the first line is the - ** header no matter what it is (it's almost - ** always the alias). - ** A <dl> with the first line as the <DT> and - ** the rest as some form of <DD> might good also? + ** Right now the record appears with the alias + ** (first line) as the header and the rest as + ** <pre> text. + ** It might look better with the name as the + ** header and the rest as a <ul> with <li> tags. + ** I'm not sure whether the name field comes in + ** any special order or if its even required in + ** a record, so for now the first line is the + ** header no matter what it is (it's almost + ** always the alias). + ** A <dl> with the first line as the <DT> and + ** the rest as some form of <DD> might good also? */ - + /* - ** Print data. + ** Print data. */ PUTS(second_colon+1); PUTS("\n"); - - if (*(second_colon-1) != last_char) + + if (*(second_colon-1) != last_char) /* end seperator */ { END(HTML_H2); START(HTML_PRE); } - + /* - ** Save the char before the second colon - ** for comparison on the next pass. + ** Save the char before the second colon + ** for comparison on the next pass. */ last_char = *(second_colon-1) ; - + } /* end if second_colon */ } /* end if *p == '-' */ } /* if end of line */ - + } /* Loop over characters */ - + /* end the text block */ PUTS("\n"); END(HTML_PRE); @@ -610,12 +610,12 @@ PRIVATE void parse_cso ARGS2( return; /* all done */ } /* end of procedure */ -/* Display a Gopher CSO ISINDEX cover page. +/* Display a Gopher CSO ISINDEX cover page. ** ======================================== */ PRIVATE void display_cso ARGS2( - CONST char *, arg, - HTParentAnchor *, anAnchor) + CONST char *, arg, + HTParentAnchor *, anAnchor) { CONST char * title; @@ -625,7 +625,7 @@ PRIVATE void display_cso ARGS2( if ((title = HTAnchor_title(anAnchor))) PUTS(title); else - PUTS("CSO index"); + PUTS("CSO index"); END(HTML_TITLE); PUTS("\n"); START(HTML_ISINDEX); @@ -642,14 +642,14 @@ PRIVATE void display_cso ARGS2( END(HTML_H1); PUTS("\nThis is a searchable index of a CSO database.\n"); START(HTML_P); - PUTS("\nPress the 's' key and enter search keywords.\n"); + PUTS("\nPress the 's' key and enter search keywords.\n"); START(HTML_P); PUTS("\nThe keywords that you enter will allow you to search on a"); PUTS(" person's name in the database.\n"); if (!HTAnchor_title(anAnchor)) - HTAnchor_setTitle(anAnchor, arg); - + HTAnchor_setTitle(anAnchor, arg); + FREE_TARGET; return; } @@ -658,11 +658,11 @@ PRIVATE void display_cso ARGS2( ** ================================ */ PRIVATE void display_index ARGS2( - CONST char *, arg, + CONST char *, arg, HTParentAnchor *,anAnchor) { CONST char * title; - + START(HTML_HEAD); PUTS("\n"); PUTS("\n"); @@ -670,7 +670,7 @@ PRIVATE void display_index ARGS2( if ((title = HTAnchor_title(anAnchor))) PUTS(title); else - PUTS("Gopher index"); + PUTS("Gopher index"); END(HTML_TITLE); PUTS("\n"); START(HTML_ISINDEX); @@ -688,10 +688,10 @@ PRIVATE void display_index ARGS2( PUTS("\nThis is a searchable Gopher index.\n"); START(HTML_P); PUTS("\nPlease enter search keywords.\n"); - + if (!HTAnchor_title(anAnchor)) - HTAnchor_setTitle(anAnchor, arg); - + HTAnchor_setTitle(anAnchor, arg); + FREE_TARGET; return; } @@ -734,7 +734,7 @@ PRIVATE void free_CSOfields NOPARAMS CSOfield_info *prev; while (cur) { - if (cur->name != cur->name_buf) + if (cur->name != cur->name_buf) FREE(cur->name); if (cur->attributes != cur->attr_buf) FREE(cur->attributes); @@ -752,11 +752,11 @@ PRIVATE void free_CSOfields NOPARAMS ** ========================================= */ PRIVATE int interpret_cso_key ARGS5( - char *, key, - char *, buf, + char *, key, + char *, buf, int *, length, CSOformgen_context *, ctx, - HTStream *, Target) + HTStream *, Target) { CSOfield_info *fld; @@ -766,22 +766,22 @@ PRIVATE int interpret_cso_key ARGS5( */ int error = 0; if (0 == strncmp(key, "$(FID)", 6)) { - sprintf(buf, "%d", fld->id); - } else if (0 == strncmp(key, "$(FDESC)", 8)) { + sprintf(buf, "%d", fld->id); + } else if (0 == strncmp(key, "$(FDESC)", 8)) { sprintf(buf, "%s%s%s", fld->description, ctx->public_override ? /***" "***/"" : "", - ctx->public_override ? /***fld->attributes***/"" : ""); - } else if (0 == strncmp(key, "$(FDEF)", 7)) { - strcpy(buf, fld->defreturn ? " checked" : ""); - } else if (0 == strncmp(key, "$(FNDX)", 7)) { + ctx->public_override ? /***fld->attributes***/"" : ""); + } else if (0 == strncmp(key, "$(FDEF)", 7)) { + strcpy(buf, fld->defreturn ? " checked" : ""); + } else if (0 == strncmp(key, "$(FNDX)", 7)) { strcpy(buf, fld->indexed ? "*" : ""); - } else if (0 == strncmp(key, "$(FSIZE)", 8)) { + } else if (0 == strncmp(key, "$(FSIZE)", 8)) { sprintf(buf, " size=%d maxlength=%d", fld->max_size > 55 ? 55 : fld->max_size, fld->max_size); - } else if (0 == strncmp(key, "$(FSIZE2)", 9)) { + } else if (0 == strncmp(key, "$(FSIZE2)", 9)) { sprintf(buf, " maxlength=%d", fld->max_size); - } else { + } else { error = 1; } if (!error) { @@ -798,7 +798,7 @@ PRIVATE int interpret_cso_key ARGS5( switch (ctx->field_select) { case 0: /* - ** 'Query' fields, public and lookup attributes. + ** 'Query' fields, public and lookup attributes. */ for (; fld; fld = fld->next) if (fld->public && (fld->lookup==1)) @@ -806,27 +806,27 @@ PRIVATE int interpret_cso_key ARGS5( break; case 1: /* - ** 'Query' fields, accept lookup attribute. + ** 'Query' fields, accept lookup attribute. */ for (; fld; fld = fld->next) - if (fld->lookup == 1) + if (fld->lookup == 1) break; break; case 2: /* - ** 'Return' fields, public only. + ** 'Return' fields, public only. */ for (; fld; fld = fld->next) - if (fld->public) + if (fld->public) break; break; case 3: /* - ** All fields. + ** All fields. */ break; } - if (fld) { + if (fld) { ctx->cur_line = ctx->rep_line; ctx->cur_off = ctx->rep_off; } @@ -851,16 +851,16 @@ PRIVATE int interpret_cso_key ARGS5( */ for (fld = CSOfields; fld; fld = fld->next) if (strcmp(fld->name, "name") == 0 || - strcmp(fld->name, "Name") == 0) { + strcmp(fld->name, "Name") == 0) { if (fld->lookup) - fld->lookup = 2; + fld->lookup = 2; break; } ctx->fld = fld; } else if (0 == strncmp (key, "$(HOST)", 7)) { - strcpy (buf, ctx->host); + strcpy (buf, ctx->host); } else if (0 == strncmp (key, "$(PORT)", 7)) { - sprintf(buf, "%d", ctx->port); + sprintf(buf, "%d", ctx->port); } else { /* ** No match, dump key to buffer so client sees it for debugging. @@ -869,7 +869,7 @@ PRIVATE int interpret_cso_key ARGS5( while (*key && (*key != ')')) { buf[out++] = (*key++); if (out > sizeof(buf)-2) { - buf[out] = '\0'; + buf[out] = '\0'; (*Target->isa->put_block)(Target, buf, strlen(buf)); out = 0; } @@ -893,35 +893,35 @@ PRIVATE int parse_cso_field_info ARGS1( char *info, *max_spec; /* - ** Initialize all fields to default values. + ** Initialize all fields to default values. */ blk->indexed = blk->lookup = blk->reserved = blk->max_size = blk->url = 0; blk->defreturn = blk->explicit_return = blk->public = 0; /* - ** Search for keywords in info string and set values. Attributes - ** are converted to all lower-case for comparison. + ** Search for keywords in info string and set values. Attributes + ** are converted to all lower-case for comparison. */ info = blk->attributes; for (i = 0; info[i]; i++) - info[i] = TOLOWER(info[i]); + info[i] = TOLOWER(info[i]); if (strstr(info, "indexed ")) - blk->indexed = 1; + blk->indexed = 1; if (strstr(info, "default ")) - blk->defreturn = 1; + blk->defreturn = 1; if (strstr(info, "public ")) - blk->public = 1; + blk->public = 1; if (strstr(info, "lookup ")) - blk->lookup = 1; + blk->lookup = 1; if (strstr(info, "url ")) { - blk->url = 1; + blk->url = 1; blk->defreturn = 1; } max_spec = strstr(info, "max "); if (max_spec) { sscanf(&max_spec[4], "%d", &blk->max_size); } else { - blk->max_size = 32; + blk->max_size = 32; } return 0; @@ -931,7 +931,7 @@ PRIVATE int parse_cso_field_info ARGS1( ** ================================================ */ PRIVATE int parse_cso_fields ARGS2( - char *, buf, + char *, buf, int, size) { char ch; @@ -945,23 +945,23 @@ PRIVATE int parse_cso_fields ARGS2( buf[0] = '\0'; /* - ** Start grabbing chars from the network. + ** Start grabbing chars from the network. */ while ((ch = NEXT_CHAR) != (char)EOF) { if (interrupted_in_htgetcharacter) { if (TRACE) { - fprintf(stderr, + fprintf(stderr, "HTLoadCSO: Interrupted in HTGetCharacter, apparently.\n"); } free_CSOfields(); buf[0] = '\0'; return HT_INTERRUPTED; - } + } if (ch != LF) { *p = ch; /* Put character in buffer */ if (p < &buf[size-1]) { - p++; + p++; } } else { *p = '\0'; /* Terminate line */ @@ -969,126 +969,126 @@ PRIVATE int parse_cso_fields ARGS2( /* OK we now have a line in 'p' lets parse it. */ - + /* - ** Break on line that begins with a 2. - ** It's the end of data. + ** Break on line that begins with a 2. + ** It's the end of data. */ if (*p == '2') break; /* - ** Lines beginning with 5 are errors. - ** Print them and quit. + ** Lines beginning with 5 are errors. + ** Print them and quit. */ if (*p == '5') { - strcpy (buf, p); + strcpy (buf, p); return 5; } if (*p == '-') { /* ** Data lines look like -200:#: - ** where # is the search result number and can be + ** where # is the search result number and can be ** multiple digits (infinite?). */ /* - ** Check status, ignore any non-success. - */ + ** Check status, ignore any non-success. + */ if (p[1] != '2' ) - continue; + continue; /* - ** Parse fields within returned line into status, ndx, name, data. + ** Parse fields within returned line into status, ndx, name, data. */ indx = NULL; name = NULL; for (i = 0; p[i]; i++) - if (p[i] == ':' ) { + if (p[i] == ':' ) { p[i] = '\0'; if (!indx) { - indx = (char *)&p[i+1]; + indx = (char *)&p[i+1]; code = atoi (indx); } else if (!name) { - name = (char *)&p[i+1]; + name = (char *)&p[i+1]; } else { i++; break; } - } - /* - ** Add data to field structure. - */ - if (name) { - if (code == prev_code) { - /* - ** Remaining data are description. + } + /* + ** Add data to field structure. + */ + if (name) { + if (code == prev_code) { + /* + ** Remaining data are description. ** Save in current info block. - */ - alen = strlen((char *)&p[i]) + 1; - if (alen > sizeof(last->desc_buf)) { + */ + alen = strlen((char *)&p[i]) + 1; + if (alen > sizeof(last->desc_buf)) { if (last->description != last->desc_buf) - FREE(last->description); - if (!(last->description = (char *)malloc(alen))) { - outofmem(__FILE__, "HTLoadCSO"); - } - } - strcpy(last->description, (char *)&p[i]); - } else { - /* - ** Initialize new block, append to end of list - ** to preserve order. - */ - new = (CSOfield_info *)calloc(1, sizeof(CSOfield_info)); - if (!new) { + FREE(last->description); + if (!(last->description = (char *)malloc(alen))) { + outofmem(__FILE__, "HTLoadCSO"); + } + } + strcpy(last->description, (char *)&p[i]); + } else { + /* + ** Initialize new block, append to end of list + ** to preserve order. + */ + new = (CSOfield_info *)calloc(1, sizeof(CSOfield_info)); + if (!new) { outofmem(__FILE__, "HTLoadCSO"); - } - if (last) - last->next = new; - else - CSOfields = new; - last = new; - - new->next = (CSOfield_info *) 0; - new->name = new->name_buf; - alen = strlen(name) + 1; - if (alen > sizeof(new->name_buf)) { - if (!(new->name = (char *)malloc(alen))) { - outofmem(__FILE__, "HTLoadCSO"); - } - } - strcpy (new->name, name); - - new->attributes = new->attr_buf; - alen = strlen((char *)&p[i]) + 2; - if (alen > sizeof(new->attr_buf)) { - if (!(new->attributes = (char *)malloc(alen))) { - outofmem(__FILE__, "HTLoadCSO"); - } - } - strcpy(new->attributes, (char *)&p[i]); - strcpy((char *)&new->attributes[alen-2], " "); - new->description = new->desc_buf; - new->desc_buf[0] = '\0'; - new->id = atoi(indx); - /* - ** Scan for keywords. - */ - parse_cso_field_info(new); - } - prev_code = code; - } else - break; + } + if (last) + last->next = new; + else + CSOfields = new; + last = new; + + new->next = (CSOfield_info *) 0; + new->name = new->name_buf; + alen = strlen(name) + 1; + if (alen > sizeof(new->name_buf)) { + if (!(new->name = (char *)malloc(alen))) { + outofmem(__FILE__, "HTLoadCSO"); + } + } + strcpy (new->name, name); + + new->attributes = new->attr_buf; + alen = strlen((char *)&p[i]) + 2; + if (alen > sizeof(new->attr_buf)) { + if (!(new->attributes = (char *)malloc(alen))) { + outofmem(__FILE__, "HTLoadCSO"); + } + } + strcpy(new->attributes, (char *)&p[i]); + strcpy((char *)&new->attributes[alen-2], " "); + new->description = new->desc_buf; + new->desc_buf[0] = '\0'; + new->id = atoi(indx); + /* + ** Scan for keywords. + */ + parse_cso_field_info(new); + } + prev_code = code; + } else + break; } /* end if *p == '-' */ } /* if end of line */ - + } /* Loop over characters */ - + /* end the text block */ if (buf[0] == '\0') { - return -1; /* no response */ + return -1; /* no response */ } buf[0] = '\0'; return 0; /* all done */ @@ -1098,10 +1098,10 @@ PRIVATE int parse_cso_fields ARGS2( ** ==================================================== */ PRIVATE int generate_cso_form ARGS4( - char *, host, + char *, host, int, port, - char *, buf, - HTStream *, Target) + char *, buf, + HTStream *, Target) { int i, j, length, out; int full_flag = 1; @@ -1141,8 +1141,8 @@ PRIVATE int generate_cso_form ARGS4( ctx.fld = (CSOfield_info *) 0; ctx.public_override = full_flag; /* - ** Parse the strings in the template array to produce HTML document - ** to send to client. First line is skipped for 'full' lists. + ** Parse the strings in the template array to produce HTML document + ** to send to client. First line is skipped for 'full' lists. */ out = 0; buf[out] = '\0'; @@ -1156,10 +1156,10 @@ PRIVATE int generate_cso_form ARGS4( ** Command detected, flush output buffer and find closing ')' ** that delimits the command. */ - buf[out] = '\0'; + buf[out] = '\0'; if (out > 0) (*Target->isa->put_block)(Target, buf, strlen(buf)); - out = 0; + out = 0; for (key = &line[j]; line[j+1] && (line[j] != ')'); j++) ; /* @@ -1175,35 +1175,35 @@ PRIVATE int generate_cso_form ARGS4( if (ctx.seek) { /* - ** Command wants us to skip (forward) to indicated token. - ** Start at current position. + ** Command wants us to skip (forward) to indicated token. + ** Start at current position. */ int slen = strlen(ctx.seek); for (; template[i]; i++) { for (line = template[i]; line[j]; j++) { - if (line[j] == '$') + if (line[j] == '$') if (0 == strncmp(ctx.seek, &line[j], slen)) { if (j == 0) - j = strlen(template[--i])-1; + j = strlen(template[--i])-1; else - --j; + --j; line = template[i]; ctx.seek = (char *) 0; break; - } + } } if (!ctx.seek) break; j = 0; } if (ctx.seek) { - char *temp = (char *)malloc(strlen(ctx.seek) + 20); + char *temp = (char *)malloc(strlen(ctx.seek) + 20); if (temp) { outofmem(__FILE__, "HTLoadCSO"); } sprintf(temp, "Seek fail on %s\n", ctx.seek); - (*Target->isa->put_block)(Target, temp, strlen(temp)); - FREE(temp); + (*Target->isa->put_block)(Target, temp, strlen(temp)); + FREE(temp); } } } else { @@ -1213,7 +1213,7 @@ PRIVATE int generate_cso_form ARGS4( buf[out++] = line[j]; if (out > (sizeof(buf)-3)) { buf[out] = '\0'; - (*Target->isa->put_block)(Target, buf, strlen(buf)); + (*Target->isa->put_block)(Target, buf, strlen(buf)); out = 0; } } @@ -1222,7 +1222,7 @@ PRIVATE int generate_cso_form ARGS4( buf[out] = '\0'; } if (out > 0) - (*Target->isa->put_block)(Target, buf, strlen(buf)); + (*Target->isa->put_block)(Target, buf, strlen(buf)); return 0; } @@ -1231,8 +1231,8 @@ PRIVATE int generate_cso_form ARGS4( ** ============================================================== */ PRIVATE int generate_cso_report ARGS2( - char *, buf, - HTStream *, Target) + char *, buf, + HTStream *, Target) { char ch; char line[BIG]; @@ -1240,85 +1240,85 @@ PRIVATE int generate_cso_report ARGS2( int len, i, prev_ndx, ndx; char *rcode, *ndx_str, *fname, *fvalue, *l; CSOfield_info *fld; - BOOL stop = FALSE; + BOOL stop = FALSE; /* - ** Read lines until non-negative status. + ** Read lines until non-negative status. */ prev_ndx = -100; /* - ** Start grabbing chars from the network. + ** Start grabbing chars from the network. */ while (!stop && (ch = NEXT_CHAR) != (char)EOF) { if (interrupted_in_htgetcharacter) { buf[0] = '\0'; if (TRACE) { - fprintf(stderr, + fprintf(stderr, "HTLoadCSO: Interrupted in HTGetCharacter, apparently.\n"); } _HTProgress ("Connection interrupted."); goto end_CSOreport; - } + } if (ch != LF) { *p = ch; /* Put character in line */ if (p < &line[BIG-1]) { - p++; + p++; } } else { *p = '\0'; /* Terminate line */ /* - ** OK we now have a line. - ** Load it as 'p' and parse it. + ** OK we now have a line. + ** Load it as 'p' and parse it. */ p = line; if (p[0] != '-' && p[0] != '1') { - stop = TRUE; + stop = TRUE; } rcode = (p[0] == '-') ? &p[1] : p; ndx_str = fname = NULL; len = strlen(p); for (i = 0; i < len; i++) { - if (p[i] == ':') { - p[i] = '\0'; - if (!ndx_str) { - fname = ndx_str = &p[i+1]; + if (p[i] == ':') { + p[i] = '\0'; + if (!ndx_str) { + fname = ndx_str = &p[i+1]; } else { - fname = &p[i+1]; + fname = &p[i+1]; break; } - } + } } if (ndx_str) { - ndx = atoi(ndx_str); - if (prev_ndx != ndx) { + ndx = atoi(ndx_str); + if (prev_ndx != ndx) { if (prev_ndx != -100) { - strcpy(buf, "</DL></DL>\n"); + strcpy(buf, "</DL></DL>\n"); (*Target->isa->put_block)(Target, buf, strlen(buf)); } if (ndx == 0) { - strcpy(buf, - "<HR><DL><DT>Information/status<DD><DL><DT>\n"); + strcpy(buf, + "<HR><DL><DT>Information/status<DD><DL><DT>\n"); (*Target->isa->put_block)(Target, buf, strlen(buf)); } else { - sprintf(buf, + sprintf(buf, "<HR><DL><DT>Entry %d:<DD><DL COMPACT><DT>\n", ndx); (*Target->isa->put_block)(Target, buf, strlen(buf)); } prev_ndx = ndx; - } + } } else { - sprintf(buf, "<DD>%s\n", rcode); + sprintf(buf, "<DD>%s\n", rcode); (*Target->isa->put_block)(Target, buf, strlen(buf)); continue; } if ((*rcode >= '2') && (*rcode <= '5') && (fname != ndx_str)) { - while (*fname == ' ') { + while (*fname == ' ') { fname++; /* trim leading spaces */ } - for (fvalue = fname; *fvalue; fvalue++) { + for (fvalue = fname; *fvalue; fvalue++) { if (*fvalue == ':') { - *fvalue++ = '\0'; + *fvalue++ = '\0'; i = strlen(fname) - 1; while (i >= 0 && fname[i] == ' ') { fname[i--] = '\0'; /* trim trailing */ @@ -1328,37 +1328,37 @@ PRIVATE int generate_cso_report ARGS2( } if (fvalue) { while (*fvalue == ' ') { - fvalue++; /* trim leading spaces */ + fvalue++; /* trim leading spaces */ } } - if (*fname) { + if (*fname) { for (fld = CSOfields; fld; fld = fld->next) { - if (!strcmp(fld->name, fname)) { + if (!strcmp(fld->name, fname)) { if (fld->description) { - fname = fld->description; + fname = fld->description; } break; - } + } } if (fld && fld->url) { - sprintf(buf, + sprintf(buf, "<DT><I>%s</I><DD><A HREF=\"%s\">%s</A>\n", fname, fvalue, fvalue); (*Target->isa->put_block)(Target, buf, strlen(buf)); } else { - sprintf(buf, "<DT><I>%s</I><DD>", fname); + sprintf(buf, "<DT><I>%s</I><DD>", fname); (*Target->isa->put_block)(Target, buf, strlen(buf)); i = 0; buf[i] = '\0'; l = fvalue; while (*l) { if (*l == '<') { - strcat(buf, "<"); + strcat(buf, "<"); l++; i += 4; buf[i] = '\0'; } else if (*l == '>') { - strcat(buf, ">"); + strcat(buf, ">"); l++; i += 4; buf[i] = '\0'; @@ -1378,13 +1378,13 @@ PRIVATE int generate_cso_report ARGS2( strncmp(l, "mailto:", 7) && strncmp(l, "cso://", 6) && strncmp(l, "gopher://", 9)) { - buf[i++] = *l++; + buf[i++] = *l++; buf[i] = '\0'; } else { - strcat(buf, "<a href=\""); + strcat(buf, "<a href=\""); i += 9; buf[i] = '\0'; - StrAllocCopy(href, l); + StrAllocCopy(href, l); strcat(buf, strtok(href, " \r\n\t,>)\"")); strcat(buf, "\">"); i = strlen(buf); @@ -1400,7 +1400,7 @@ PRIVATE int generate_cso_report ARGS2( strcat(buf, "\n"); (*Target->isa->put_block)(Target, buf, strlen(buf)); } - } else { + } else { sprintf(buf, "<DD>"); (*Target->isa->put_block)(Target, buf, strlen(buf)); i = 0; @@ -1456,10 +1456,10 @@ PRIVATE int generate_cso_report ARGS2( (*Target->isa->put_block)(Target, buf, strlen(buf)); } } else { - sprintf(buf, "<DD>%s\n", fname ? fname : rcode ); + sprintf(buf, "<DD>%s\n", fname ? fname : rcode ); (*Target->isa->put_block)(Target, buf, strlen(buf)); } - } + } } end_CSOreport: if (prev_ndx != -100) { @@ -1469,18 +1469,18 @@ end_CSOreport: return 0; } -/* CSO/PH form-based search gateway - FM HTLoadCSO +/* CSO/PH form-based search gateway - FM HTLoadCSO ** ===================================== */ PRIVATE int HTLoadCSO ARGS4( - CONST char *, arg, - HTParentAnchor *, anAnchor, + CONST char *, arg, + HTParentAnchor *, anAnchor, HTFormat, format_out, HTStream*, sink) { char *host, *cp; int port = CSO_PORT; - int status; /* tcp return */ + int status; /* tcp return */ char *command = NULL; char *content = NULL; int len, i, j, start, finish, flen, ndx, clen; @@ -1489,46 +1489,46 @@ PRIVATE int HTLoadCSO ARGS4( char buf[2048]; HTFormat format_in = WWW_HTML; HTStream *Target = NULL; - + if (!acceptable_inited) - init_acceptable(); + init_acceptable(); if (!arg) - return -3; /* Bad if no name sepcified */ + return -3; /* Bad if no name sepcified */ if (!*arg) - return -2; /* Bad if name had zero length */ + return -2; /* Bad if name had zero length */ if (TRACE) - fprintf(stderr, "HTLoadCSO: Looking for %s\n", arg); + fprintf(stderr, "HTLoadCSO: Looking for %s\n", arg); /* - ** Set up a socket to the server for the data. - */ + ** Set up a socket to the server for the data. + */ status = HTDoConnect (arg, "cso", CSO_PORT, &s); if (status == HT_INTERRUPTED) { - /* + /* ** Interrupt cleanly. */ if (TRACE) fprintf(stderr, - "HTLoadCSO: Interrupted on connect; recovering cleanly.\n"); + "HTLoadCSO: Interrupted on connect; recovering cleanly.\n"); _HTProgress ("Connection interrupted."); return HT_NOT_LOADED; } if (status < 0) { if (TRACE) fprintf(stderr, - "HTLoadCSO: Unable to connect to remote host for `%s'.\n", - arg); + "HTLoadCSO: Unable to connect to remote host for `%s'.\n", + arg); return HTInetStatus("connect"); } - + HTInitInput(s); /* Set up input buffering */ - + if ((command = (char *)malloc(12)) == NULL) - outofmem(__FILE__, "HTLoadCSO"); + outofmem(__FILE__, "HTLoadCSO"); sprintf(command, "fields%c%c", CR, LF); if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTLoadCSO: Connected, writing command `%s' to socket %d\n", command, s); _HTProgress ("Sending CSO/PH request."); @@ -1542,25 +1542,25 @@ PRIVATE int HTLoadCSO ARGS4( _HTProgress ("CSO/PH request sent; waiting for response."); /* - ** Now read the data from the socket. + ** Now read the data from the socket. */ status = parse_cso_fields(buf, sizeof(buf)); if (status) { - NETCLOSE(s); + NETCLOSE(s); if (status == HT_INTERRUPTED) { _HTProgress ("Connection interrupted."); } else if (buf[0] != '\0') { - HTAlert(buf); + HTAlert(buf); } else { HTAlert("No response from server!"); } return HT_NOT_LOADED; } - Target = HTStreamStack(format_in, + Target = HTStreamStack(format_in, format_out, sink, anAnchor); if (!Target || Target == NULL) { - char *temp = (char *)malloc(256); + char *temp = (char *)malloc(256); if (!temp) { outofmem(__FILE__, "HTLoadCSO"); } @@ -1576,13 +1576,13 @@ PRIVATE int HTLoadCSO ARGS4( if (cp[1] >= '0' && cp[1] <= '9') { port = atoi((cp+1)); if (port == CSO_PORT) { - *cp = '\0'; + *cp = '\0'; } } } anAnchor->safe = TRUE; if (!(anAnchor->post_data && *anAnchor->post_data)) { - generate_cso_form(host, port, buf, Target); + generate_cso_form(host, port, buf, Target); (*Target->isa->_free)(Target); FREE(host); NETCLOSE(s); @@ -1591,15 +1591,15 @@ PRIVATE int HTLoadCSO ARGS4( } sprintf(buf, "<HTML>\n<HEAD>\n<TITLE>CSO/PH Results on %s</TITLE>\n</HEAD>\n<BODY>\n", - host); + host); (*Target->isa->put_block)(Target, buf, strlen(buf)); FREE(host); StrAllocCopy(content, anAnchor->post_data); if (content[strlen(content)-1] != '&') - StrAllocCat(content, "&"); + StrAllocCat(content, "&"); len = strlen(content); for (i = 0; i < len; i++) { - if (content[i] == '+') { + if (content[i] == '+') { content[i] = ' '; } } @@ -1609,70 +1609,70 @@ PRIVATE int HTLoadCSO ARGS4( has_indexed = 0; start = finish = clen = 0; for (i = 0; i < len; i++) { - if (!content[i] || content[i] == '&') { + if (!content[i] || content[i] == '&') { /* - ** Value parsed. Unescape characters and look for first '=' - ** to delimit field name from value. + ** Value parsed. Unescape characters and look for first '=' + ** to delimit field name from value. */ flen = i - start; finish = start + flen; content[finish] = '\0'; for (j = start; j < finish; j++) { - if (content[j] == '=') { - /* - ** content[start..j-1] is field name, - ** [j+1..finish-1] is value. - */ - if ((content[start+1] == '_') && - ((content[start] == 'r') || (content[start] == 'q'))) { - /* - ** Decode fields number and lookup field info. - */ - sscanf (&content[start+2], "%d=", &ndx); - for (fld = CSOfields; fld; fld = fld->next) { - if (ndx==fld->id) { - if ((j+1) >= finish) + if (content[j] == '=') { + /* + ** content[start..j-1] is field name, + ** [j+1..finish-1] is value. + */ + if ((content[start+1] == '_') && + ((content[start] == 'r') || (content[start] == 'q'))) { + /* + ** Decode fields number and lookup field info. + */ + sscanf (&content[start+2], "%d=", &ndx); + for (fld = CSOfields; fld; fld = fld->next) { + if (ndx==fld->id) { + if ((j+1) >= finish) break; /* ignore nulls */ - if (content[start] == 'q') { - /* - * Append field to query line. - */ - if (fld->lookup) { - if (fld->indexed) + if (content[start] == 'q') { + /* + * Append field to query line. + */ + if (fld->lookup) { + if (fld->indexed) has_indexed = 1; - if (clen == 0) { - StrAllocCopy(command, "query "); + if (clen == 0) { + StrAllocCopy(command, "query "); clen = 6; - } else { + } else { StrAllocCat(command, " "); clen++; } sprintf(buf, "%s=\"%s\"", - fld->name, &content[j+1]); + fld->name, &content[j+1]); StrAllocCat(command, buf); - clen += strlen(buf); - } else { - strcpy(buf, + clen += strlen(buf); + } else { + strcpy(buf, "Warning: non-lookup field ignored<BR>\n"); - (*Target->isa->put_block)(Target, - buf, + (*Target->isa->put_block)(Target, + buf, strlen(buf)); - } - } else if (content[start] == 'r') { - fld->explicit_return = 1; - } - break; - } + } + } else if (content[start] == 'r') { + fld->explicit_return = 1; + } + break; + } } - } else if (!strncmp(&content[start],"return=",7)) { - if (!strcmp(&content[start+7],"all")) { + } else if (!strncmp(&content[start],"return=",7)) { + if (!strcmp(&content[start+7],"all")) { return_type = 1; - } else if (!strcmp(&content[start+7],"selected")) { - return_type = 2; - } - } - } - } + } else if (!strcmp(&content[start+7],"selected")) { + return_type = 2; + } + } + } + } start = i + 1; } } @@ -1689,7 +1689,7 @@ PRIVATE int HTLoadCSO ARGS4( return HT_LOADED; } /* - ** Append return fields. + ** Append return fields. */ if (return_type == 1) { StrAllocCat(command, " return all"); @@ -1699,9 +1699,9 @@ PRIVATE int HTLoadCSO ARGS4( clen += 7; for (fld = CSOfields; fld; fld = fld->next) { if (fld->explicit_return) { - sprintf(buf, " %s", fld->name); - StrAllocCat(command, buf); - clen += strlen(buf); + sprintf(buf, " %s", fld->name); + StrAllocCat(command, buf); + clen += strlen(buf); } } } @@ -1714,7 +1714,7 @@ PRIVATE int HTLoadCSO ARGS4( strcpy(buf, "</H2>\n"); (*Target->isa->put_block)(Target, buf, strlen(buf)); if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTLoadCSO: Writing command `%s' to socket %d\n", command, s); status = NETWRITE(s, command, clen); @@ -1748,53 +1748,53 @@ PRIVATE int HTLoadGopher ARGS4( HTStream*, sink) { char *command; /* The whole command */ - int status; /* tcp return */ - char gtype; /* Gopher Node type */ + int status; /* tcp return */ + char gtype; /* Gopher Node type */ char * selector; /* Selector string */ if (!acceptable_inited) - init_acceptable(); - + init_acceptable(); + if (!arg) - return -3; /* Bad if no name sepcified */ + return -3; /* Bad if no name sepcified */ if (!*arg) - return -2; /* Bad if name had zero length */ + return -2; /* Bad if name had zero length */ if (TRACE) - fprintf(stderr, "HTGopher: Looking for %s\n", arg); + fprintf(stderr, "HTGopher: Looking for %s\n", arg); /* - ** If it's a port 105 GOPHER_CSO gtype with no ISINDEX token ('?'), - ** use the form-based CSO gateway (otherwise, return an ISINDEX - ** cover page or do the ISINDEX search). - FM + ** If it's a port 105 GOPHER_CSO gtype with no ISINDEX token ('?'), + ** use the form-based CSO gateway (otherwise, return an ISINDEX + ** cover page or do the ISINDEX search). - FM */ { - int len; + int len; if ((len = strlen(arg)) > 5) { if (0 == strcmp((CONST char *)&arg[len-6], ":105/2")) { - /* Use CSO gateway. */ + /* Use CSO gateway. */ if (TRACE) fprintf(stderr, "HTGopher: Passing to CSO/PH gateway.\n"); - return HTLoadCSO(arg, anAnchor, format_out, sink); - } + return HTLoadCSO(arg, anAnchor, format_out, sink); + } } } /* - ** If it's a port 79/0[/...] URL, use the finger gateway. - FM + ** If it's a port 79/0[/...] URL, use the finger gateway. - FM */ if (strstr(arg, ":79/0") != NULL) { - if (TRACE) + if (TRACE) fprintf(stderr, "HTGopher: Passing to finger gateway.\n"); return HTLoadFinger(arg, anAnchor, format_out, sink); } - + /* - ** Get entity type, and selector string. - */ + ** Get entity type, and selector string. + */ { char * p1 = HTParse(arg, "", PARSE_PATH|PARSE_PUNCTUATION); - gtype = '1'; /* Default = menu */ + gtype = '1'; /* Default = menu */ selector = p1; if ((*selector++=='/') && (*selector)) { /* Skip first slash */ gtype = *selector++; /* Pick up gtype */ @@ -1802,9 +1802,9 @@ PRIVATE int HTLoadGopher ARGS4( if (gtype == GOPHER_INDEX) { char * query; /* - ** Search is allowed. + ** Search is allowed. */ - HTAnchor_setIndex(anAnchor, anAnchor->address); + HTAnchor_setIndex(anAnchor, anAnchor->address); query = strchr(selector, '?'); /* Look for search string */ if (!query || !query[1]) { /* No search required */ target = HTML_new(anAnchor, format_out, sink); @@ -1812,52 +1812,52 @@ PRIVATE int HTLoadGopher ARGS4( display_index(arg, anAnchor); /* Display "cover page" */ return HT_LOADED; /* Local function only */ } - *query++ = '\0'; /* Skip '?' */ + *query++ = '\0'; /* Skip '?' */ command = - (char *)malloc(strlen(selector)+ 1 + strlen(query)+ 2 + 1); - if (command == NULL) - outofmem(__FILE__, "HTLoadGopher"); - + (char *)malloc(strlen(selector)+ 1 + strlen(query)+ 2 + 1); + if (command == NULL) + outofmem(__FILE__, "HTLoadGopher"); + de_escape(command, selector); /* Bug fix TBL 921208 */ strcat(command, "\t"); - + { /* Remove plus signs 921006 */ - char *p; + char *p; for (p=query; *p; p++) { if (*p == '+') *p = ' '; } } de_escape(&command[strlen(command)], query);/* bug fix LJM 940415 */ - } else if (gtype == GOPHER_CSO) { - char * query; + } else if (gtype == GOPHER_CSO) { + char * query; /* - ** Search is allowed. + ** Search is allowed. */ - query = strchr(selector, '?'); /* Look for search string */ - if (!query || !query[1]) { /* No search required */ + query = strchr(selector, '?'); /* Look for search string */ + if (!query || !query[1]) { /* No search required */ target = HTML_new(anAnchor, format_out, sink); targetClass = *target->isa; - display_cso(arg, anAnchor); /* Display "cover page" */ - return HT_LOADED; /* Local function only */ - } - HTAnchor_setIndex(anAnchor, anAnchor->address); - *query++ = '\0'; /* Skip '?' */ - command = (char *)malloc(strlen("query")+1 + strlen(query)+2+1); - if (command == NULL) - outofmem(__FILE__, "HTLoadGopher"); - - de_escape(command, selector); /* Bug fix TBL 921208 */ - - strcpy(command, "query "); - - { /* Remove plus signs 921006 */ - char *p; - for (p=query; *p; p++) { - if (*p == '+') *p = ' '; - } - } + display_cso(arg, anAnchor); /* Display "cover page" */ + return HT_LOADED; /* Local function only */ + } + HTAnchor_setIndex(anAnchor, anAnchor->address); + *query++ = '\0'; /* Skip '?' */ + command = (char *)malloc(strlen("query")+1 + strlen(query)+2+1); + if (command == NULL) + outofmem(__FILE__, "HTLoadGopher"); + + de_escape(command, selector); /* Bug fix TBL 921208 */ + + strcpy(command, "query "); + + { /* Remove plus signs 921006 */ + char *p; + for (p=query; *p; p++) { + if (*p == '+') *p = ' '; + } + } de_escape(&command[strlen(command)], query);/* bug fix LJM 940415 */ } else { /* Not index */ @@ -1866,7 +1866,7 @@ PRIVATE int HTLoadGopher ARGS4( } FREE(p1); } - + { char * p = command + strlen(command); *p++ = CR; /* Macros to be correct on Mac */ @@ -1875,7 +1875,7 @@ PRIVATE int HTLoadGopher ARGS4( } /* - ** Set up a socket to the server for the data. + ** Set up a socket to the server for the data. */ status = HTDoConnect (arg, "gopher", GOPHER_PORT, &s); if (status == HT_INTERRUPTED) { @@ -1884,7 +1884,7 @@ PRIVATE int HTLoadGopher ARGS4( */ if (TRACE) fprintf(stderr, - "HTGopher: Interrupted on connect; recovering cleanly.\n"); + "HTGopher: Interrupted on connect; recovering cleanly.\n"); _HTProgress ("Connection interrupted."); FREE(command); return HT_NOT_LOADED; @@ -1892,22 +1892,22 @@ PRIVATE int HTLoadGopher ARGS4( if (status < 0) { if (TRACE) fprintf(stderr, - "HTGopher: Unable to connect to remote host for `%s'.\n", - arg); + "HTGopher: Unable to connect to remote host for `%s'.\n", + arg); FREE(command); return HTInetStatus("connect"); } - + HTInitInput(s); /* Set up input buffering */ - + if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTGopher: Connected, writing command `%s' to socket %d\n", - command, s); - + command, s); + #ifdef NOT_ASCII { - char * p; + char * p; for (p = command; *p; p++) { *p = TOASCII(*p); } @@ -1927,50 +1927,50 @@ PRIVATE int HTLoadGopher ARGS4( _HTProgress ("Gopher request sent; waiting for response."); /* - ** Now read the data from the socket. - */ + ** Now read the data from the socket. + */ switch (gtype) { - + case GOPHER_TEXT : - HTParseSocket(WWW_PLAINTEXT, format_out, anAnchor, s, sink); + HTParseSocket(WWW_PLAINTEXT, format_out, anAnchor, s, sink); break; case GOPHER_HTML : case GOPHER_CHTML : - HTParseSocket(WWW_HTML, format_out, anAnchor, s, sink); + HTParseSocket(WWW_HTML, format_out, anAnchor, s, sink); break; case GOPHER_GIF: case GOPHER_IMAGE: case GOPHER_PLUS_IMAGE: - HTParseSocket(HTAtom_for("image/gif"), + HTParseSocket(HTAtom_for("image/gif"), format_out, anAnchor, s, sink); - break; + break; case GOPHER_MENU : case GOPHER_INDEX : target = HTML_new(anAnchor, format_out, sink); targetClass = *target->isa; - parse_menu(arg, anAnchor); + parse_menu(arg, anAnchor); break; - + case GOPHER_CSO: target = HTML_new(anAnchor, format_out, sink); targetClass = *target->isa; - parse_cso(arg, anAnchor); + parse_cso(arg, anAnchor); break; - + case GOPHER_SOUND : case GOPHER_PLUS_SOUND : - HTParseSocket(WWW_AUDIO, format_out, anAnchor, s, sink); + HTParseSocket(WWW_AUDIO, format_out, anAnchor, s, sink); break; - + case GOPHER_PLUS_MOVIE: - HTParseSocket(HTAtom_for("video/mpeg"), format_out, anAnchor, s, sink); + HTParseSocket(HTAtom_for("video/mpeg"), format_out, anAnchor, s, sink); break; case GOPHER_PLUS_PDF: - HTParseSocket(HTAtom_for("application/pdf"), format_out, anAnchor, + HTParseSocket(HTAtom_for("application/pdf"), format_out, anAnchor, s, sink); break; @@ -1979,10 +1979,10 @@ PRIVATE int HTLoadGopher ARGS4( case GOPHER_UUENCODED: case GOPHER_BINARY: default: - /* + /* ** Specifying WWW_UNKNOWN forces dump to local disk. */ - HTParseSocket (WWW_UNKNOWN, format_out, anAnchor, s, sink); + HTParseSocket (WWW_UNKNOWN, format_out, anAnchor, s, sink); break; } /* switch(gtype) */ diff --git a/WWW/Library/Implementation/HTMIME.c b/WWW/Library/Implementation/HTMIME.c index e060d372..f165a6a2 100644 --- a/WWW/Library/Implementation/HTMIME.c +++ b/WWW/Library/Implementation/HTMIME.c @@ -108,38 +108,38 @@ typedef enum _MIME_state { miJUNK_LINE, /* Ignore the rest of this folded line */ miNEWLINE, /* Just found a LF .. maybe continuation */ miCHECK, /* check against check_pointer */ - MIME_NET_ASCII, /* Translate from net ascii */ + MIME_NET_ASCII, /* Translate from net ascii */ MIME_IGNORE /* Ignore entire file */ /* TRANSPARENT and IGNORE are defined as stg else in _WINDOWS */ } MIME_state; -#define VALUE_SIZE 1024 /* @@@@@@@ Arbitrary? */ +#define VALUE_SIZE 1024 /* @@@@@@@ Arbitrary? */ struct _HTStream { CONST HTStreamClass * isa; - + BOOL net_ascii; /* Is input net ascii? */ MIME_state state; /* current state */ MIME_state if_ok; /* got this state if match */ MIME_state field; /* remember which field */ MIME_state fold_state; /* state on a fold */ CONST char * check_pointer; /* checking input */ - + char * value_pointer; /* storing values */ - char value[VALUE_SIZE]; - - HTParentAnchor * anchor; /* Given on creation */ + char value[VALUE_SIZE]; + + HTParentAnchor * anchor; /* Given on creation */ HTStream * sink; /* Given on creation */ - + char * boundary; /* For multipart */ char * set_cookie; /* Set-Cookie */ char * set_cookie2; /* Set-Cookie2 */ - + HTFormat encoding; /* Content-Transfer-Encoding */ char * compression_encoding; - HTFormat format; /* Content-Type */ - HTStream * target; /* While writing out */ + HTFormat format; /* Content-Type */ + HTStream * target; /* While writing out */ HTStreamClass targetClass; - + HTAtom * targetRep; /* Converting into? */ }; @@ -151,34 +151,34 @@ struct _HTStream { ** first and last characters are double-quotes. - FM */ PUBLIC void HTMIME_TrimDoubleQuotes ARGS1( - char *, value) + char *, value) { int i; char *cp = value; if (!(cp && *cp) || *cp != '\"') - return; + return; i = strlen(cp); if (cp[(i - 1)] != '\"') - return; + return; else - cp[(i - 1)] = '\0'; + cp[(i - 1)] = '\0'; for (i = 0; value[i]; i++) - value[i] = cp[(i +1)]; + value[i] = cp[(i +1)]; } /*_________________________________________________________________________ ** -** A C T I O N R O U T I N E S +** A C T I O N R O U T I N E S */ /* Character handling ** ------------------ ** ** This is a FSM parser which is tolerant as it can be of all -** syntax errors. It ignores field names it does not understand, +** syntax errors. It ignores field names it does not understand, ** and resynchronises on line beginnings. */ PRIVATE void HTMIME_put_character ARGS2( @@ -188,17 +188,17 @@ PRIVATE void HTMIME_put_character ARGS2( int i, j; if (me->state == MIME_TRANSPARENT) { - (*me->targetClass.put_character)(me->target, c);/* MUST BE FAST */ + (*me->targetClass.put_character)(me->target, c);/* MUST BE FAST */ return; } /* - ** This slightly simple conversion just strips CR and turns LF to - ** newline. On unix LF is \n but on Mac \n is CR for example. - ** See NetToText for an implementation which preserves single CR or LF. + ** This slightly simple conversion just strips CR and turns LF to + ** newline. On unix LF is \n but on Mac \n is CR for example. + ** See NetToText for an implementation which preserves single CR or LF. */ if (me->net_ascii) { - c = FROMASCII(c); + c = FROMASCII(c); if (c == CR) return; else if (c == LF) @@ -208,32 +208,32 @@ PRIVATE void HTMIME_put_character ARGS2( switch(me->state) { case MIME_IGNORE: - return; + return; case MIME_TRANSPARENT: /* Not reached see above */ - (*me->targetClass.put_character)(me->target, c); + (*me->targetClass.put_character)(me->target, c); return; case MIME_NET_ASCII: - (*me->targetClass.put_character)(me->target, c); /* MUST BE FAST */ + (*me->targetClass.put_character)(me->target, c); /* MUST BE FAST */ return; case miNEWLINE: if (c != '\n' && WHITE(c)) { /* Folded line */ - me->state = me->fold_state; /* pop state before newline */ + me->state = me->fold_state; /* pop state before newline */ break; } /* else Falls through */ - + case miBEGINNING_OF_LINE: - me->net_ascii = YES; + me->net_ascii = YES; switch (c) { case 'a': case 'A': me->state = miA; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Got 'A' at beginning of line, state now A\n"); break; @@ -241,7 +241,7 @@ PRIVATE void HTMIME_put_character ARGS2( case 'C': me->state = miC; if (TRACE) - fprintf (stderr, + fprintf (stderr, "HTMIME: Got 'C' at beginning of line, state now C\n"); break; @@ -251,7 +251,7 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miDATE; me->state = miCHECK; if (TRACE) - fprintf (stderr, + fprintf (stderr, "HTMIME: Got 'D' at beginning of line, checking for 'ate:'\n"); break; @@ -259,7 +259,7 @@ PRIVATE void HTMIME_put_character ARGS2( case 'E': me->state = miE; if (TRACE) - fprintf (stderr, + fprintf (stderr, "HTMIME: Got 'E' at beginning of line, state now E\n"); break; @@ -269,7 +269,7 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miKEEP_ALIVE; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Got 'K' at beginning of line, checking for 'eep-alive:'\n"); break; @@ -277,7 +277,7 @@ PRIVATE void HTMIME_put_character ARGS2( case 'L': me->state = miL; if (TRACE) - fprintf (stderr, + fprintf (stderr, "HTMIME: Got 'L' at beginning of line, state now L\n"); break; @@ -285,7 +285,7 @@ PRIVATE void HTMIME_put_character ARGS2( case 'P': me->state = miP; if (TRACE) - fprintf (stderr, + fprintf (stderr, "HTMIME: Got 'P' at beginning of line, state now P\n"); break; @@ -295,7 +295,7 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miRETRY_AFTER; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Got 'R' at beginning of line, checking for 'etry-after'\n"); break; @@ -303,7 +303,7 @@ PRIVATE void HTMIME_put_character ARGS2( case 'S': me->state = miS; if (TRACE) - fprintf (stderr, + fprintf (stderr, "HTMIME: Got 'S' at beginning of line, state now S\n"); break; @@ -311,7 +311,7 @@ PRIVATE void HTMIME_put_character ARGS2( case 'T': me->state = miT; if (TRACE) - fprintf (stderr, + fprintf (stderr, "HTMIME: Got 'T' at beginning of line, state now T\n"); break; @@ -319,7 +319,7 @@ PRIVATE void HTMIME_put_character ARGS2( case 'U': me->state = miU; if (TRACE) - fprintf (stderr, + fprintf (stderr, "HTMIME: Got 'U' at beginning of line, state now U\n"); break; @@ -327,7 +327,7 @@ PRIVATE void HTMIME_put_character ARGS2( case 'V': me->state = miV; if (TRACE) - fprintf (stderr, + fprintf (stderr, "HTMIME: Got 'V' at beginning of line, state now V\n"); break; @@ -335,40 +335,40 @@ PRIVATE void HTMIME_put_character ARGS2( case 'W': me->state = miW; if (TRACE) - fprintf (stderr, + fprintf (stderr, "HTMIME: Got 'W' at beginning of line, state now W\n"); break; case '\n': /* Blank line: End of Header! */ { - me->net_ascii = NO; + me->net_ascii = NO; if (strchr(HTAtom_name(me->format), ';') != NULL) { char *cp = NULL, *cp1, *cp2, *cp3 = NULL, *cp4; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Extended MIME Content-Type is %s\n", HTAtom_name(me->format)); StrAllocCopy(cp, HTAtom_name(me->format)); /* - ** Note that the Content-Type value was converted - ** to lower case when we loaded into me->format, - ** but there may have been a mixed or upper-case - ** atom, so we'll force lower-casing again. We - ** also stripped spaces and double-quotes, but - ** we'll make sure they're still gone from any - ** charset parameter we check. - FM + ** Note that the Content-Type value was converted + ** to lower case when we loaded into me->format, + ** but there may have been a mixed or upper-case + ** atom, so we'll force lower-casing again. We + ** also stripped spaces and double-quotes, but + ** we'll make sure they're still gone from any + ** charset parameter we check. - FM */ for (i = 0; cp[i]; i++) - cp[i] = TOLOWER(cp[i]); + cp[i] = TOLOWER(cp[i]); if ((cp1 = strchr(cp, ';')) != NULL) { BOOL chartrans_ok = NO; - if ((cp2 = strstr(cp1, "charset")) != NULL) { + if ((cp2 = strstr(cp1, "charset")) != NULL) { int chndl; cp2 += 7; while (*cp2 == ' ' || *cp2 == '=' || *cp2 == '\"') - cp2++; + cp2++; StrAllocCopy(cp3, cp2); /* copy to mutilate more */ for (cp4 = cp3; (*cp4 != '\0' && *cp4 != '\"' && *cp4 != ';' && *cp4 != ':' && @@ -384,9 +384,10 @@ PRIVATE void HTMIME_put_character ARGS2( me->format = HTAtom_for(cp); StrAllocCopy(me->anchor->charset, cp4); HTAnchor_setUCInfoStage(me->anchor, chndl, - UCT_STAGE_MIME, UCT_SETBY_MIME); + UCT_STAGE_MIME, + UCT_SETBY_MIME); } - else if (chndl < 0) {/* got something but we don't + else if (chndl < 0) {/* got something but we don't recognize it */ chndl = UCLYhndl_for_unrec; if (UCCanTranslateFromTo(chndl, @@ -395,7 +396,8 @@ PRIVATE void HTMIME_put_character ARGS2( *cp1 = '\0'; me->format = HTAtom_for(cp); HTAnchor_setUCInfoStage(me->anchor, chndl, - UCT_STAGE_MIME, UCT_SETBY_DEFAULT); + UCT_STAGE_MIME, + UCT_SETBY_DEFAULT); } } FREE(cp3); @@ -406,11 +408,11 @@ PRIVATE void HTMIME_put_character ARGS2( LYUCcharset * p_out = HTAnchor_setUCInfoStage(me->anchor, current_char_set, - UCT_STAGE_HTEXT, + UCT_STAGE_HTEXT, UCT_SETBY_DEFAULT); if (!p_out) /* - ** Try again. + ** Try again. */ p_out = HTAnchor_getUCInfoStage(me->anchor, @@ -422,7 +424,8 @@ PRIVATE void HTMIME_put_character ARGS2( HTAnchor_setUCInfoStage(me->anchor, HTAnchor_getUCLYhndl(me->anchor, UCT_STAGE_HTEXT), - UCT_STAGE_MIME, UCT_SETBY_DEFAULT); + UCT_STAGE_MIME, + UCT_SETBY_DEFAULT); } if (!strcmp(p_out->MIMEname, "x-transparent")) { @@ -473,14 +476,17 @@ PRIVATE void HTMIME_put_character ARGS2( HTCJK = NOCJK; } } - } else if + /* + ** Check for an iso-8859-# we don't know. - FM + */ + } else if (!strncmp(cp4, "iso-8859-", 9) && isdigit((unsigned char)cp4[9]) && !strncmp(LYchar_set_names[current_char_set], - "Other ISO Latin", 15)) { - /* - ** Hope it's a match, for now. - FM - */ + "Other ISO Latin", 15)) { + /* + ** Hope it's a match, for now. - FM + */ *cp1 = '\0'; me->format = HTAtom_for(cp); cp1 = &cp4[10]; @@ -491,126 +497,13 @@ PRIVATE void HTMIME_put_character ARGS2( StrAllocCopy(me->anchor->charset, cp4); HTPassEightBitRaw = TRUE; HTAlert(me->anchor->charset); -#ifdef NOT_USED /* pre-chartrans */ - } else if (!strncmp(cp2, "us-ascii", 8) || - !strncmp(cp2, "iso-8859-1", 10)) { - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "iso-8859-1"); - HTCJK = NOCJK; - } else if - (!strncmp(cp2, "iso-8859-2", 10) && - !strncmp(LYchar_set_names[current_char_set], - "ISO Latin 2", 11)) { - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "iso-8859-2"); - HTPassEightBitRaw = TRUE; - } else if - (!strncmp(cp2, "iso-8859-", 9) && - !strncmp(LYchar_set_names[current_char_set], - "Other ISO Latin", 15)) { - /* - ** Hope it's a match, for now. - FM - */ - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "iso-8859- "); - me->anchor->charset[9] = cp2[9]; - HTPassEightBitRaw = TRUE; - HTAlert(me->anchor->charset); - } else if - (!strncmp(cp2, "koi8-r", 6) && - !strncmp(LYchar_set_names[current_char_set], - "KOI8-R Cyrillic", 15)) { - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "koi8-r"); - HTPassEightBitRaw = TRUE; - } else if - (!strncmp(cp2, "euc-jp", 6) && - HTCJK == JAPANESE) { - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "euc-jp"); - } else if - (!strncmp(cp2, "shift_jis", 9) && - HTCJK == JAPANESE) { - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "shift_jis"); - } else if - (!strncmp(cp2, "iso-2022-jp", 11) && - HTCJK == JAPANESE) { - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "iso-2022-jp"); - } else if - (!strncmp(cp2, "iso-2022-jp-2", 13) && - HTCJK == JAPANESE) { - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "iso-2022-jp-2"); - } else if - (!strncmp(cp2, "euc-kr", 6) && - HTCJK == KOREAN) { - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "euc-kr"); - } else if - (!strncmp(cp2, "iso-2022-kr", 11) && - HTCJK == KOREAN) { - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "iso-2022-kr"); - } else if - ((!strncmp(cp2, "big5", 4) || - !strncmp(cp2, "cn-big5", 7)) && - HTCJK == TAIPEI) { - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "big5"); - } else if - (!strncmp(cp2, "euc-cn", 6) && - HTCJK == CHINESE) { - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "euc-cn"); - } else if - ((!strncmp(cp2, "gb2312", 6) || - !strncmp(cp2, "cn-gb", 5)) && - HTCJK == CHINESE) { - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "gb2312"); - } else if - (!strncmp(cp2, "iso-2022-cn", 11) && - HTCJK == CHINESE) { - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "iso-2022-cn"); -#endif /* NOT_USED */ } FREE(cp3); } else { /* - ** No charset parameter is present. - ** Ignore all other parameters, as - ** we do when charset is present. - FM + ** No charset parameter is present. + ** Ignore all other parameters, as + ** we do when charset is present. - FM */ *cp1 = '\0'; me->format = HTAtom_for(cp); @@ -633,7 +526,7 @@ PRIVATE void HTMIME_put_character ARGS2( */ me->anchor->no_cache = TRUE; } else if (me->anchor->date != NULL) { - /* + /* ** We have a Date header, so check if ** the value is less than or equal to ** that. - FM @@ -643,7 +536,7 @@ PRIVATE void HTMIME_put_character ARGS2( me->anchor->no_cache = TRUE; } } else if (LYmktime(me->anchor->expires, FALSE) <= 0) { - /* + /* ** We don't have a Date header, and ** the value is in past for us. - FM */ @@ -653,23 +546,23 @@ PRIVATE void HTMIME_put_character ARGS2( StrAllocCopy(me->anchor->content_type, HTAtom_name(me->format)); if (!me->compression_encoding) { - if (TRACE) { - fprintf(stderr, + if (TRACE) { + fprintf(stderr, "HTMIME: MIME Content-Type is '%s', converting to '%s'\n", HTAtom_name(me->format), HTAtom_name(me->targetRep)); } } else { /* - ** Change the format to that for "www/compressed" - ** and set up a stream to deal with it. - FM + ** Change the format to that for "www/compressed" + ** and set up a stream to deal with it. - FM */ - if (TRACE) { - fprintf(stderr, + if (TRACE) { + fprintf(stderr, "HTMIME: MIME Content-Type is '%s',\n", HTAtom_name(me->format)); } me->format = HTAtom_for("www/compressed"); - if (TRACE) { - fprintf(stderr, + if (TRACE) { + fprintf(stderr, " Treating as '%s'. Converting to '%s'\n", HTAtom_name(me->format), HTAtom_name(me->targetRep)); } @@ -682,18 +575,18 @@ PRIVATE void HTMIME_put_character ARGS2( FREE(me->set_cookie2); } me->target = HTStreamStack(me->format, me->targetRep, - me->sink , me->anchor); + me->sink , me->anchor); if (!me->target) { if (TRACE) - fprintf(stderr, "HTMIME: Can't translate! ** \n"); + fprintf(stderr, "HTMIME: Can't translate! ** \n"); me->target = me->sink; /* Cheat */ } if (me->target) { me->targetClass = *me->target->isa; /* - ** Check for encoding and select state from there, - ** someday, but until we have the relevant code, - ** from now push straight through. - FM + ** Check for encoding and select state from there, + ** someday, but until we have the relevant code, + ** from now push straight through. - FM */ me->state = MIME_TRANSPARENT; } else { @@ -708,17 +601,17 @@ PRIVATE void HTMIME_put_character ARGS2( break; } /* switch on character */ - break; + break; case miA: /* Check for 'c','g' or 'l' */ - switch (c) { + switch (c) { case 'c': case 'C': me->check_pointer = "cept-ranges:"; me->if_ok = miACCEPT_RANGES; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was A, found C, checking for 'cept-ranges:'\n"); break; @@ -728,7 +621,7 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miAGE; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was A, found G, checking for 'e:'\n"); break; @@ -736,7 +629,7 @@ PRIVATE void HTMIME_put_character ARGS2( case 'L': me->state = miAL; if (TRACE) - fprintf(stderr, "HTMIME: Was A, found L, state now AL'\n"); + fprintf(stderr, "HTMIME: Was A, found L, state now AL'\n"); break; default: @@ -751,14 +644,14 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miAL: /* Check for 'l' or 't' */ - switch (c) { - case 'l': - case 'L': + switch (c) { + case 'l': + case 'L': me->check_pointer = "ow:"; me->if_ok = miALLOW; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was AL, found L, checking for 'ow:'\n"); break; @@ -768,7 +661,7 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miALTERNATES; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was AL, found T, checking for 'ernates:'\n"); break; @@ -784,14 +677,14 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miC: /* Check for 'a' or 'o' */ - switch (c) { - case 'a': + switch (c) { + case 'a': case 'A': me->check_pointer = "che-control:"; me->if_ok = miCACHE_CONTROL; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was C, found A, checking for 'che-control:'\n"); break; @@ -799,7 +692,7 @@ PRIVATE void HTMIME_put_character ARGS2( case 'O': me->state = miCO; if (TRACE) - fprintf(stderr, "HTMIME: Was C, found O, state now CO'\n"); + fprintf(stderr, "HTMIME: Was C, found O, state now CO'\n"); break; default: @@ -814,28 +707,28 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miCO: /* Check for 'n' or 'o' */ - switch (c) { - case 'n': - case 'N': + switch (c) { + case 'n': + case 'N': me->state = miCON; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was CO, found N, state now CON\n"); - break; + break; - case 'o': - case 'O': + case 'o': + case 'O': me->check_pointer = "kie:"; me->if_ok = miCOOKIE; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was CO, found O, checking for 'kie:'\n"); - break; + break; default: if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Bad character `%c' found where `%s' expected\n", c, "'n' or 'o'"); goto bad_field_name; @@ -844,15 +737,15 @@ PRIVATE void HTMIME_put_character ARGS2( } /* switch on character */ break; - case miCON: /* Check for 'n' or 't' */ - switch (c) { - case 'n': - case 'N': + case miCON: /* Check for 'n' or 't' */ + switch (c) { + case 'n': + case 'N': me->check_pointer = "ection:"; me->if_ok = miCONNECTION; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was CON, found N, checking for 'ection:'\n"); break; @@ -862,7 +755,7 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miCONTENT_; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was CON, found T, checking for 'ent-'\n"); break; @@ -878,14 +771,14 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miE: /* Check for 't' or 'x' */ - switch (c) { - case 't': + switch (c) { + case 't': case 'T': me->check_pointer = "ag:"; me->if_ok = miETAG; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was E, found T, checking for 'ag:'\n"); break; @@ -895,15 +788,15 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miEXPIRES; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was E, found X, checking for 'pires:'\n"); break; default: if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Bad character `%c' found where `%s' expected\n", - c, "'t' or 'x'"); + c, "'t' or 'x'"); goto bad_field_name; break; @@ -911,14 +804,14 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miL: /* Check for 'a', 'i' or 'o' */ - switch (c) { + switch (c) { case 'a': case 'A': me->check_pointer = "st-modified:"; me->if_ok = miLAST_MODIFIED; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was L, found A, checking for 'st-modified:'\n"); break; @@ -928,7 +821,7 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miLINK; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was L, found I, checking for 'nk:'\n"); break; @@ -938,15 +831,15 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miLOCATION; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was L, found O, checking for 'cation:'\n"); break; default: if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Bad character `%c' found where `%s' expected\n", - c, "'a', 'i' or 'o'"); + c, "'a', 'i' or 'o'"); goto bad_field_name; break; @@ -954,29 +847,29 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miP: /* Check for 'r' or 'u' */ - switch (c) { + switch (c) { case 'r': case 'R': me->state = miPR; if (TRACE) - fprintf(stderr, "HTMIME: Was P, found R, state now PR'\n"); + fprintf(stderr, "HTMIME: Was P, found R, state now PR'\n"); break; - case 'u': + case 'u': case 'U': me->check_pointer = "blic:"; me->if_ok = miPUBLIC; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was P, found U, checking for 'blic:'\n"); break; default: if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Bad character `%c' found where `%s' expected\n", - c, "'r' or 'u'"); + c, "'r' or 'u'"); goto bad_field_name; break; @@ -984,14 +877,14 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miPR: /* Check for 'a' or 'o' */ - switch (c) { + switch (c) { case 'a': case 'A': me->check_pointer = "gma:"; me->if_ok = miPRAGMA; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was PR, found A, checking for 'gma'\n"); break; @@ -1001,15 +894,15 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miPROXY_AUTHENTICATE; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was PR, found O, checking for 'xy-authenticate'\n"); break; default: if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Bad character `%c' found where `%s' expected\n", - c, "'a' or 'o'"); + c, "'a' or 'o'"); goto bad_field_name; break; @@ -1017,28 +910,28 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miS: /* Check for 'a' or 'e' */ - switch (c) { + switch (c) { case 'a': case 'A': me->check_pointer = "fe:"; me->if_ok = miSAFE; me->state = miCHECK; if (TRACE) - fprintf(stderr, "HTMIME: Was S, found A, checking for 'fe:'\n"); + fprintf(stderr, "HTMIME: Was S, found A, checking for 'fe:'\n"); break; case 'e': case 'E': me->state = miSE; if (TRACE) - fprintf(stderr, "HTMIME: Was S, found E, state now SE'\n"); + fprintf(stderr, "HTMIME: Was S, found E, state now SE'\n"); break; default: if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Bad character `%c' found where `%s' expected\n", - c, "'a' or 'e'"); + c, "'a' or 'e'"); goto bad_field_name; break; @@ -1046,14 +939,14 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miSE: /* Check for 'r' or 't' */ - switch (c) { + switch (c) { case 'r': case 'R': me->check_pointer = "ver:"; me->if_ok = miSERVER; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was SE, found R, checking for 'ver'\n"); break; @@ -1063,15 +956,15 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miSET_COOKIE; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was SE, found T, checking for '-cookie'\n"); break; default: if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Bad character `%c' found where `%s' expected\n", - c, "'r' or 't'"); + c, "'r' or 't'"); goto bad_field_name; break; @@ -1079,12 +972,12 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miSET_COOKIE: /* Check for ':' or '2' */ - switch (c) { + switch (c) { case ':': me->field = miSET_COOKIE1; /* remember it */ me->state = miSKIP_GET_VALUE; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was SET_COOKIE, found :, processing\n"); break; @@ -1093,15 +986,15 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miSET_COOKIE2; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was SET_COOKIE, found 2, checking for ':'\n"); break; default: if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Bad character `%c' found where `%s' expected\n", - c, "':' or '2'"); + c, "':' or '2'"); goto bad_field_name; break; @@ -1109,16 +1002,16 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miT: /* Check for 'i' or 'r' */ - switch (c) { - case 'i': + switch (c) { + case 'i': case 'I': me->check_pointer = "tle:"; me->if_ok = miTITLE; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was T, found I, checking for 'tle:'\n"); - break; + break; case 'r': case 'R': @@ -1126,15 +1019,15 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miTRANSFER_ENCODING; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was T, found R, checking for 'ansfer-encoding'\n"); break; default: if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Bad character `%c' found where `%s' expected\n", - c, "'i' or 'r'"); + c, "'i' or 'r'"); goto bad_field_name; break; @@ -1142,14 +1035,14 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miU: /* Check for 'p' or 'r' */ - switch (c) { - case 'p': + switch (c) { + case 'p': case 'P': me->check_pointer = "grade:"; me->if_ok = miUPGRADE; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was U, found P, checking for 'grade:'\n"); break; @@ -1159,15 +1052,15 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miURI; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was U, found R, checking for 'i:'\n"); - break; + break; default: if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Bad character `%c' found where `%s' expected\n", - c, "'p' or 'r'"); + c, "'p' or 'r'"); goto bad_field_name; break; @@ -1175,14 +1068,14 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miV: /* Check for 'a' or 'i' */ - switch (c) { - case 'a': + switch (c) { + case 'a': case 'A': me->check_pointer = "ry:"; me->if_ok = miVARY; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was V, found A, checking for 'ry:'\n"); break; @@ -1192,15 +1085,15 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miVIA; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was V, found I, checking for 'a:'\n"); - break; + break; default: if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Bad character `%c' found where `%s' expected\n", - c, "'a' or 'i'"); + c, "'a' or 'i'"); goto bad_field_name; break; @@ -1208,14 +1101,14 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miW: /* Check for 'a' or 'w' */ - switch (c) { - case 'a': + switch (c) { + case 'a': case 'A': me->check_pointer = "rning:"; me->if_ok = miWARNING; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was W, found A, checking for 'rning:'\n"); break; @@ -1225,15 +1118,15 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miWWW_AUTHENTICATE; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was W, found W, checking for 'w-authenticate:'\n"); - break; + break; default: if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Bad character `%c' found where `%s' expected\n", - c, "'a' or 'w'"); + c, "'a' or 'w'"); goto bad_field_name; break; @@ -1241,186 +1134,186 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miCHECK: /* Check against string */ - if (TOLOWER(c) == *(me->check_pointer)++) { + if (TOLOWER(c) == *(me->check_pointer)++) { if (!*me->check_pointer) - me->state = me->if_ok; + me->state = me->if_ok; } else { /* Error */ if (TRACE) - fprintf(stderr, - "HTMIME: Bad character `%c' found where `%s' expected\n", - c, me->check_pointer - 1); + fprintf(stderr, + "HTMIME: Bad character `%c' found where `%s' expected\n", + c, me->check_pointer - 1); goto bad_field_name; } break; case miCONTENT_: if (TRACE) - fprintf (stderr, - "HTMIME: in case CONTENT_\n"); - switch(c) { - case 'b': - case 'B': + fprintf (stderr, + "HTMIME: in case CONTENT_\n"); + switch(c) { + case 'b': + case 'B': me->check_pointer = "ase:"; me->if_ok = miCONTENT_BASE; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was CONTENT_, found B, checking for 'ase:'\n"); break; - case 'd': - case 'D': + case 'd': + case 'D': me->check_pointer = "isposition:"; me->if_ok = miCONTENT_DISPOSITION; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was CONTENT_, found D, checking for 'isposition:'\n"); break; - case 'e': - case 'E': + case 'e': + case 'E': me->check_pointer = "ncoding:"; me->if_ok = miCONTENT_ENCODING; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was CONTENT_, found E, checking for 'ncoding:'\n"); break; - case 'f': - case 'F': + case 'f': + case 'F': me->check_pointer = "eatures:"; me->if_ok = miCONTENT_FEATURES; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was CONTENT_, found F, checking for 'eatures:'\n"); break; - case 'l': - case 'L': + case 'l': + case 'L': me->state = miCONTENT_L; if (TRACE) - fprintf (stderr, + fprintf (stderr, "HTMIME: Was CONTENT_, found L, state now CONTENT_L\n"); break; - case 'm': - case 'M': + case 'm': + case 'M': me->check_pointer = "d5:"; me->if_ok = miCONTENT_MD5; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was CONTENT_, found M, checking for 'd5:'\n"); break; - case 'r': - case 'R': + case 'r': + case 'R': me->check_pointer = "ange:"; me->if_ok = miCONTENT_RANGE; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was CONTENT_, found R, checking for 'ange:'\n"); break; - case 't': - case 'T': + case 't': + case 'T': me->state = miCONTENT_T; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was CONTENT_, found T, state now CONTENT_T\n"); break; - default: + default: if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was CONTENT_, found nothing; bleah\n"); goto bad_field_name; break; - } /* switch on character */ + } /* switch on character */ break; case miCONTENT_L: if (TRACE) - fprintf (stderr, - "HTMIME: in case CONTENT_L\n"); + fprintf (stderr, + "HTMIME: in case CONTENT_L\n"); switch(c) { case 'a': case 'A': me->check_pointer = "nguage:"; me->if_ok = miCONTENT_LANGUAGE; me->state = miCHECK; - if (TRACE) - fprintf(stderr, - "HTMIME: Was CONTENT_L, found A, checking for 'nguage:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was CONTENT_L, found A, checking for 'nguage:'\n"); break; - + case 'e': case 'E': me->check_pointer = "ngth:"; me->if_ok = miCONTENT_LENGTH; me->state = miCHECK; - if (TRACE) - fprintf(stderr, - "HTMIME: Was CONTENT_L, found E, checking for 'ngth:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was CONTENT_L, found E, checking for 'ngth:'\n"); break; - + case 'o': case 'O': me->check_pointer = "cation:"; me->if_ok = miCONTENT_LOCATION; me->state = miCHECK; - if (TRACE) - fprintf(stderr, - "HTMIME: Was CONTENT_L, found O, checking for 'cation:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was CONTENT_L, found O, checking for 'cation:'\n"); break; - + default: - if (TRACE) - fprintf (stderr, - "HTMIME: Was CONTENT_L, found nothing; bleah\n"); + if (TRACE) + fprintf (stderr, + "HTMIME: Was CONTENT_L, found nothing; bleah\n"); goto bad_field_name; break; - + } /* switch on character */ break; case miCONTENT_T: if (TRACE) - fprintf (stderr, - "HTMIME: in case CONTENT_T\n"); + fprintf (stderr, + "HTMIME: in case CONTENT_T\n"); switch(c) { case 'r': case 'R': me->check_pointer = "ansfer-encoding:"; me->if_ok = miCONTENT_TRANSFER_ENCODING; me->state = miCHECK; - if (TRACE) - fprintf(stderr, - "HTMIME: Was CONTENT_T, found R, checking for 'ansfer-encoding:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was CONTENT_T, found R, checking for 'ansfer-encoding:'\n"); break; - + case 'y': case 'Y': me->check_pointer = "pe:"; me->if_ok = miCONTENT_TYPE; me->state = miCHECK; - if (TRACE) - fprintf(stderr, - "HTMIME: Was CONTENT_T, found Y, checking for 'pe:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was CONTENT_T, found Y, checking for 'pe:'\n"); break; - + default: - if (TRACE) - fprintf (stderr, - "HTMIME: Was CONTENT_T, found nothing; bleah\n"); + if (TRACE) + fprintf (stderr, + "HTMIME: Was CONTENT_T, found nothing; bleah\n"); goto bad_field_name; break; - + } /* switch on character */ break; @@ -1465,28 +1358,28 @@ PRIVATE void HTMIME_put_character ARGS2( case miVIA: case miWARNING: case miWWW_AUTHENTICATE: - me->field = me->state; /* remember it */ + me->field = me->state; /* remember it */ me->state = miSKIP_GET_VALUE; /* Fall through! */ case miSKIP_GET_VALUE: - if (c == '\n') { + if (c == '\n') { me->fold_state = me->state; me->state = miNEWLINE; break; } if (WHITE(c)) /* - ** Skip white space. + ** Skip white space. */ break; - + me->value_pointer = me->value; - me->state = miGET_VALUE; + me->state = miGET_VALUE; /* Fall through to store first character */ - + case miGET_VALUE: - if (WHITE(c) && c != 32) { /* End of field */ + if (WHITE(c) && c != 32) { /* End of field */ char *cp; *me->value_pointer = '\0'; cp = (me->value_pointer - 1); @@ -1494,41 +1387,41 @@ PRIVATE void HTMIME_put_character ARGS2( /* ** Trim trailing spaces. */ - *cp = '\0'; + *cp = '\0'; switch (me->field) { case miACCEPT_RANGES: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Accept-Ranges: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Accept-Ranges: '%s'\n", me->value); - break; + break; case miAGE: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Age: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Age: '%s'\n", me->value); - break; + break; case miALLOW: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Allow: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Allow: '%s'\n", me->value); - break; + break; case miALTERNATES: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Alternates: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Alternates: '%s'\n", me->value); - break; + break; case miCACHE_CONTROL: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Cache-Control: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Cache-Control: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1545,8 +1438,8 @@ PRIVATE void HTMIME_put_character ARGS2( char *cp1, *cp0 = me->value; while ((cp1 = strstr(cp0, "no-cache")) != NULL) { - cp1 += 8; - while (*cp1 != '\0' && WHITE(*cp1)) + cp1 += 8; + while (*cp1 != '\0' && WHITE(*cp1)) cp1++; if (*cp1 == '\0' || *cp1 == ';') { me->anchor->no_cache = TRUE; @@ -1555,22 +1448,22 @@ PRIVATE void HTMIME_put_character ARGS2( cp0 = cp1; } if (me->anchor->no_cache == TRUE) - break; + break; cp0 = me->value; while ((cp1 = strstr(cp0, "max-age")) != NULL) { - cp1 += 7; - while (*cp1 != '\0' && WHITE(*cp1)) + cp1 += 7; + while (*cp1 != '\0' && WHITE(*cp1)) cp1++; if (*cp1 == '=') { cp1++; while (*cp1 != '\0' && WHITE(*cp1)) - cp1++; + cp1++; if (isdigit((unsigned char)*cp1)) { - cp0 = cp1; + cp0 = cp1; while (isdigit((unsigned char)*cp1)) cp1++; - if (*cp0 == '0' && cp1 == (cp0 + 1)) { - me->anchor->no_cache = TRUE; + if (*cp0 == '0' && cp1 == (cp0 + 1)) { + me->anchor->no_cache = TRUE; break; } } @@ -1578,26 +1471,26 @@ PRIVATE void HTMIME_put_character ARGS2( cp0 = cp1; } } - break; + break; case miCOOKIE: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Cookie: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Cookie: '%s'\n", me->value); - break; + break; case miCONNECTION: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Connection: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Connection: '%s'\n", me->value); - break; + break; case miCONTENT_BASE: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Content-Base: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Base: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1605,12 +1498,12 @@ PRIVATE void HTMIME_put_character ARGS2( ** Indicate in anchor. - FM */ StrAllocCopy(me->anchor->content_base, me->value); - break; + break; case miCONTENT_DISPOSITION: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Content-Disposition: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Disposition: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1636,14 +1529,14 @@ PRIVATE void HTMIME_put_character ARGS2( cp++; if (*cp == '\0') break; - while (*cp != '\0' && WHITE(*cp)) + while (*cp != '\0' && WHITE(*cp)) cp++; if (*cp == '\0') break; StrAllocCopy(me->anchor->SugFname, cp); if (*me->anchor->SugFname == '\"') { if ((cp = strchr((me->anchor->SugFname + 1), - '\"')) != NULL) { + '\"')) != NULL) { *(cp + 1) = '\0'; HTMIME_TrimDoubleQuotes(me->anchor->SugFname); } else { @@ -1657,13 +1550,13 @@ PRIVATE void HTMIME_put_character ARGS2( *cp = '\0'; if (*me->anchor->SugFname == '\0') FREE(me->anchor->SugFname); - break; - case miCONTENT_ENCODING: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Content-Encoding: '%s'\n", - me->value); + break; + case miCONTENT_ENCODING: + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Encoding: '%s'\n", + me->value); if (!(me->value && *me->value) || !strcasecomp(me->value, "identity")) break; @@ -1678,32 +1571,32 @@ PRIVATE void HTMIME_put_character ARGS2( !strcmp(me->value, "7bit") || !strcmp(me->value, "binary")) { /* - ** Some server indicated "8bit", "7bit" or "binary" - ** inappropriately. We'll ignore it. - FM + ** Some server indicated "8bit", "7bit" or "binary" + ** inappropriately. We'll ignore it. - FM */ if (TRACE) fprintf(stderr, " Ignoring it!\n"); } else { /* - ** Save it to use as a flag for setting - ** up a "www/compressed" target. - FM + ** Save it to use as a flag for setting + ** up a "www/compressed" target. - FM */ StrAllocCopy(me->compression_encoding, me->value); } break; case miCONTENT_FEATURES: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Content-Features: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Features: '%s'\n", me->value); - break; + break; case miCONTENT_LANGUAGE: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Content-Language: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Language: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1713,31 +1606,31 @@ PRIVATE void HTMIME_put_character ARGS2( for (i = 0; me->value[i]; i++) me->value[i] = TOLOWER(me->value[i]); StrAllocCopy(me->anchor->content_language, me->value); - break; + break; case miCONTENT_LENGTH: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Content-Length: '%s'\n", - me->value); + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Length: '%s'\n", + me->value); if (!(me->value && *me->value)) break; /* ** Convert to integer and indicate in anchor. - FM */ - me->anchor->content_length = atoi(me->value); + me->anchor->content_length = atoi(me->value); if (me->anchor->content_length < 0) me->anchor->content_length = 0; - if (TRACE) - fprintf(stderr, - " Converted to integer: '%d'\n", - me->anchor->content_length); - break; + if (TRACE) + fprintf(stderr, + " Converted to integer: '%d'\n", + me->anchor->content_length); + break; case miCONTENT_LOCATION: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Content-Location: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Location: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1745,12 +1638,12 @@ PRIVATE void HTMIME_put_character ARGS2( ** Indicate in anchor. - FM */ StrAllocCopy(me->anchor->content_location, me->value); - break; + break; case miCONTENT_MD5: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Content-MD5: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-MD5: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1758,20 +1651,20 @@ PRIVATE void HTMIME_put_character ARGS2( ** Indicate in anchor. - FM */ StrAllocCopy(me->anchor->content_md5, me->value); - break; + break; case miCONTENT_RANGE: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Content-Range: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Range: '%s'\n", me->value); - break; + break; case miCONTENT_TRANSFER_ENCODING: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, "HTMIME: PICKED UP Content-Transfer-Encoding: '%s'\n", - me->value); + me->value); if (!(me->value && *me->value)) break; /* @@ -1780,13 +1673,13 @@ PRIVATE void HTMIME_put_character ARGS2( */ for (i = 0; me->value[i]; i++) me->value[i] = TOLOWER(me->value[i]); - me->encoding = HTAtom_for(me->value); + me->encoding = HTAtom_for(me->value); break; case miCONTENT_TYPE: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Content-Type: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Type: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1796,17 +1689,17 @@ PRIVATE void HTMIME_put_character ARGS2( */ for (i = 0, j = 0; me->value[i]; i++) { if (me->value[i] != ' ' && me->value[i] != '\"') { - me->value[j++] = TOLOWER(me->value[i]); + me->value[j++] = TOLOWER(me->value[i]); } } me->value[j] = '\0'; - me->format = HTAtom_for(me->value); + me->format = HTAtom_for(me->value); break; case miDATE: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Date: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Date: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1814,19 +1707,19 @@ PRIVATE void HTMIME_put_character ARGS2( ** Indicate in anchor. - FM */ StrAllocCopy(me->anchor->date, me->value); - break; + break; case miETAG: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP ETag: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP ETag: '%s'\n", me->value); - break; + break; case miEXPIRES: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Expires: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Expires: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1834,19 +1727,19 @@ PRIVATE void HTMIME_put_character ARGS2( ** Indicate in anchor. - FM */ StrAllocCopy(me->anchor->expires, me->value); - break; + break; case miKEEP_ALIVE: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Keep-Alive: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Keep-Alive: '%s'\n", me->value); - break; + break; case miLAST_MODIFIED: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Last-Modified: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Last-Modified: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1854,26 +1747,26 @@ PRIVATE void HTMIME_put_character ARGS2( ** Indicate in anchor. - FM */ StrAllocCopy(me->anchor->last_modified, me->value); - break; + break; case miLINK: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Link: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Link: '%s'\n", me->value); - break; + break; case miLOCATION: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Location: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Location: '%s'\n", me->value); - break; + break; case miPRAGMA: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Pragma: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Pragma: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1882,33 +1775,33 @@ PRIVATE void HTMIME_put_character ARGS2( */ if (!strcmp(me->value, "no-cache")) me->anchor->no_cache = TRUE; - break; + break; case miPROXY_AUTHENTICATE: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Proxy-Authenticate: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Proxy-Authenticate: '%s'\n", me->value); - break; + break; case miPUBLIC: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Public: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Public: '%s'\n", me->value); - break; + break; case miRETRY_AFTER: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Retry-After: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Retry-After: '%s'\n", me->value); - break; + break; case miSAFE: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Safe: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Safe: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1919,12 +1812,12 @@ PRIVATE void HTMIME_put_character ARGS2( !strcasecomp(me->value, "TRUE")) { me->anchor->safe = TRUE; } - break; + break; case miSERVER: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Server: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Server: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1932,12 +1825,12 @@ PRIVATE void HTMIME_put_character ARGS2( ** Indicate in anchor. - FM */ StrAllocCopy(me->anchor->server, me->value); - break; + break; case miSET_COOKIE1: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Set-Cookie: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Set-Cookie: '%s'\n", me->value); if (me->set_cookie == NULL) { StrAllocCopy(me->set_cookie, me->value); @@ -1945,12 +1838,12 @@ PRIVATE void HTMIME_put_character ARGS2( StrAllocCat(me->set_cookie, ", "); StrAllocCat(me->set_cookie, me->value); } - break; + break; case miSET_COOKIE2: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Set-Cookie2: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Set-Cookie2: '%s'\n", me->value); if (me->set_cookie2 == NULL) { StrAllocCopy(me->set_cookie2, me->value); @@ -1958,96 +1851,96 @@ PRIVATE void HTMIME_put_character ARGS2( StrAllocCat(me->set_cookie2, ", "); StrAllocCat(me->set_cookie2, me->value); } - break; + break; case miTITLE: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Title: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Title: '%s'\n", me->value); - break; + break; case miTRANSFER_ENCODING: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Transfer-Encoding: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Transfer-Encoding: '%s'\n", me->value); - break; + break; case miUPGRADE: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Upgrade: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Upgrade: '%s'\n", me->value); - break; + break; case miURI: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP URI: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP URI: '%s'\n", me->value); - break; + break; case miVARY: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Vary: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Vary: '%s'\n", me->value); - break; + break; case miVIA: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Via: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Via: '%s'\n", me->value); - break; + break; case miWARNING: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Warning: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Warning: '%s'\n", me->value); - break; + break; case miWWW_AUTHENTICATE: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP WWW-Authenticate: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP WWW-Authenticate: '%s'\n", me->value); - break; + break; default: /* Should never get here */ - break; + break; } } else { if (me->value_pointer < me->value + VALUE_SIZE - 1) { - *me->value_pointer++ = c; + *me->value_pointer++ = c; break; } else { - goto value_too_long; + goto value_too_long; } } /* Fall through */ - + case miJUNK_LINE: - if (c == '\n') { + if (c == '\n') { me->state = miNEWLINE; me->fold_state = me->state; } break; - - + + } /* switch on state*/ - + return; - + value_too_long: if (TRACE) - fprintf(stderr, "HTMIME: *** Syntax error. (string too long)\n"); - -bad_field_name: /* Ignore it */ + fprintf(stderr, "HTMIME: *** Syntax error. (string too long)\n"); + +bad_field_name: /* Ignore it */ me->state = miJUNK_LINE; return; - + } @@ -2064,13 +1957,13 @@ PRIVATE void HTMIME_put_string ARGS2( CONST char * p; if (me->state == MIME_TRANSPARENT) { /* Optimisation */ - (*me->targetClass.put_string)(me->target,s); + (*me->targetClass.put_string)(me->target,s); } else if (me->state != MIME_IGNORE) { - if (TRACE) + if (TRACE) fprintf(stderr, "HTMIME: %s\n", s); - for (p=s; *p; p++) + for (p=s; *p; p++) HTMIME_put_character(me, *p); } } @@ -2087,13 +1980,13 @@ PRIVATE void HTMIME_write ARGS3( CONST char * p; if (me->state == MIME_TRANSPARENT) { /* Optimisation */ - (*me->targetClass.put_block)(me->target, s, l); + (*me->targetClass.put_block)(me->target, s, l); } else { - if (TRACE) + if (TRACE) fprintf(stderr, "HTMIME: %.*s\n", l, s); - for (p = s; p < s+l; p++) + for (p = s; p < s+l; p++) HTMIME_put_character(me, *p); } } @@ -2107,7 +2000,7 @@ PRIVATE void HTMIME_free ARGS1( HTStream *, me) { if (me->target) - (*me->targetClass._free)(me->target); + (*me->targetClass._free)(me->target); FREE(me); } @@ -2118,7 +2011,7 @@ PRIVATE void HTMIME_abort ARGS2( HTError, e) { if (me->target) - (*me->targetClass._abort)(me->target, e); + (*me->targetClass._abort)(me->target, e); FREE(me); } @@ -2127,14 +2020,14 @@ PRIVATE void HTMIME_abort ARGS2( ** ----------------------- */ PRIVATE CONST HTStreamClass HTMIME = -{ +{ "MIMEParser", HTMIME_free, HTMIME_abort, HTMIME_put_character, HTMIME_put_string, HTMIME_write -}; +}; /* Subclass-specific Methods @@ -2146,11 +2039,11 @@ PUBLIC HTStream* HTMIMEConvert ARGS3( HTStream *, sink) { HTStream* me; - + me = (HTStream *)calloc(1, sizeof(*me)); if (me == NULL) - outofmem(__FILE__, "HTMIME_new"); - me->isa = &HTMIME; + outofmem(__FILE__, "HTMIMEConvert"); + me->isa = &HTMIME; me->sink = sink; me->anchor = anchor; me->anchor->safe = FALSE; @@ -2169,28 +2062,28 @@ PUBLIC HTStream* HTMIMEConvert ARGS3( FREE(me->anchor->expires); FREE(me->anchor->last_modified); FREE(me->anchor->server); - me->target = NULL; + me->target = NULL; me->state = miBEGINNING_OF_LINE; /* * Sadly enough, change this to always default to WWW_HTML * to parse all text as HTML for the users. - * GAB 06-30-94 + * GAB 06-30-94 * Thanks to Robert Rowland robert@cyclops.pei.edu * * After discussion of the correct handline, should be application/octet- * stream or unknown; causing servers to send a correct content * type. * - * The consequence of using WWW_UNKNOWN is that you end up downloading - * as a binary file what 99.9% of the time is an HTML file, which should - * have been rendered or displayed. So sadly enough, I'm changing it - * back to WWW_HTML, and it will handle the situation like Mosaic does, - * and as Robert Rowland suggested, because being functionally correct - * 99.9% of the time is better than being technically correct but - * functionally nonsensical. - FM + * The consequence of using WWW_UNKNOWN is that you end up downloading + * as a binary file what 99.9% of the time is an HTML file, which should + * have been rendered or displayed. So sadly enough, I'm changing it + * back to WWW_HTML, and it will handle the situation like Mosaic does, + * and as Robert Rowland suggested, because being functionally correct + * 99.9% of the time is better than being technically correct but + * functionally nonsensical. - FM *//*** me->format = WWW_UNKNOWN; - ***/ + ***/ me->format = WWW_HTML; me->targetRep = pres->rep_out; me->boundary = NULL; /* Not set yet */ @@ -2200,9 +2093,11 @@ PUBLIC HTStream* HTMIMEConvert ARGS3( me->compression_encoding = NULL; /* Not set yet */ me->net_ascii = NO; /* Local character set */ HTAnchor_setUCInfoStage(me->anchor, current_char_set, - UCT_STAGE_STRUCTURED, UCT_SETBY_DEFAULT); + UCT_STAGE_STRUCTURED, + UCT_SETBY_DEFAULT); HTAnchor_setUCInfoStage(me->anchor, current_char_set, - UCT_STAGE_HTEXT, UCT_SETBY_DEFAULT); + UCT_STAGE_HTEXT, + UCT_SETBY_DEFAULT); return me; } @@ -2213,8 +2108,8 @@ PUBLIC HTStream* HTNetMIME ARGS3( { HTStream* me = HTMIMEConvert(pres,anchor, sink); if (!me) - return NULL; - + return NULL; + me->net_ascii = YES; return me; } @@ -2259,7 +2154,7 @@ PUBLIC HTStream* HTNetMIME ARGS3( ** Written by S. Ichikawa, ** partially inspired by encdec.c of <jh@efd.lth.se>. */ -#define BUFLEN 1024 +#define BUFLEN 1024 #ifdef ESC #undef ESC #endif /* ESC */ @@ -2271,8 +2166,8 @@ PRIVATE char HTmmquote[] = "0123456789ABCDEF"; PRIVATE int HTmmcont = 0; PUBLIC void HTmmdec_base64 ARGS2( - char *, t, - char *, s) + char *, t, + char *, s) { int d, count, j, val; char buf[BUFLEN], *bp, nw[4], *p; @@ -2310,8 +2205,8 @@ PUBLIC void HTmmdec_base64 ARGS2( } PUBLIC void HTmmdec_quote ARGS2( - char *, t, - char *, s) + char *, t, + char *, s) { char buf[BUFLEN], cval, *bp, *p; @@ -2348,8 +2243,8 @@ PUBLIC void HTmmdec_quote ARGS2( ** Generalized HTmmdecode for chartrans - K. Weide 1997-03-06 */ PUBLIC void HTmmdecode ARGS2( - char *, trg, - char *, str) + char *, trg, + char *, str) { char buf[BUFLEN], mmbuf[BUFLEN]; char *s, *t, *u, *qm2; @@ -2358,7 +2253,7 @@ PUBLIC void HTmmdecode ARGS2( buf[0] = '\0'; /* - ** Encoded-words look like + ** Encoded-words look like ** =?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?= */ for (s = str, u = buf; *s; ) { @@ -2409,7 +2304,7 @@ PUBLIC void HTmmdecode ARGS2( } } for (s = qm2 + 3, t = mmbuf; *s; ) { - if (s[0] == '?' && s[1] == '=') { + if (s[0] == '?' && s[1] == '=') { break; } else { *t++ = *s++; @@ -2422,17 +2317,17 @@ PUBLIC void HTmmdecode ARGS2( *t = '\0'; } if (base64) - HTmmdec_base64(mmbuf, mmbuf); + HTmmdec_base64(mmbuf, mmbuf); if (quote) - HTmmdec_quote(mmbuf, mmbuf); + HTmmdec_quote(mmbuf, mmbuf); for (t = mmbuf; *t; ) - *u++ = *t++; + *u++ = *t++; HTmmcont = 1; /* if (*s == ' ' || *s == '\t') *u++ = *s; */ /* for ( ; *s == ' ' || *s == '\t'; s++) ; */ } else { if (*s != ' ' && *s != '\t') - HTmmcont = 0; + HTmmcont = 0; *u++ = *s++; } } @@ -2445,8 +2340,8 @@ end: ** HTmmdecode for ISO-2022-JP - FM */ PUBLIC void HTmmdecode ARGS2( - char *, trg, - char *, str) + char *, trg, + char *, str) { char buf[BUFLEN], mmbuf[BUFLEN]; char *s, *t, *u; @@ -2473,7 +2368,7 @@ PUBLIC void HTmmdecode ARGS2( } } for (s += 16, t = mmbuf; *s; ) { - if (s[0] == '?' && s[1] == '=') { + if (s[0] == '?' && s[1] == '=') { break; } else { *t++ = *s++; @@ -2486,17 +2381,17 @@ PUBLIC void HTmmdecode ARGS2( *t = '\0'; } if (base64) - HTmmdec_base64(mmbuf, mmbuf); + HTmmdec_base64(mmbuf, mmbuf); if (quote) - HTmmdec_quote(mmbuf, mmbuf); + HTmmdec_quote(mmbuf, mmbuf); for (t = mmbuf; *t; ) - *u++ = *t++; + *u++ = *t++; HTmmcont = 1; /* if (*s == ' ' || *s == '\t') *u++ = *s; */ /* for ( ; *s == ' ' || *s == '\t'; s++) ; */ } else { if (*s != ' ' && *s != '\t') - HTmmcont = 0; + HTmmcont = 0; *u++ = *s++; } } @@ -2506,12 +2401,12 @@ end: } #endif /* NOTDEFINED */ -/* +/* ** Modified for Lynx-jp by Takuya ASADA (and K&Rized by FM). */ #if NOTDEFINED PUBLIC int main ARGS2( - int, ac, + int, ac, char **, av) { FILE *fp; @@ -2566,8 +2461,8 @@ PUBLIC int main ARGS2( ** (The author of this function "rjis" is S. Ichikawa.) */ PUBLIC int HTrjis ARGS2( - char *, t, - char *, s) + char *, t, + char *, s) { char *p, buf[BUFLEN]; int kanji = 0; @@ -2600,7 +2495,7 @@ PUBLIC int HTrjis ARGS2( } *p++ = *s++; } - *p = *s; /* terminate string */ + *p = *s; /* terminate string */ strcpy(t, buf); return 0; @@ -2639,9 +2534,9 @@ PUBLIC int HTmaybekanji ARGS2( { if ((c2 < 33) || (c2 > 126)) - return 0; + return 0; if ((c1 < 33) || ((40 < c1) && (c1 < 48)) || (116 < c1)) - return 0; + return 0; c2 -= 32; switch(c1-32) { case 2: diff --git a/WWW/Library/Implementation/HTML.h b/WWW/Library/Implementation/HTML.h index bca7c41b..be492b28 100644 --- a/WWW/Library/Implementation/HTML.h +++ b/WWW/Library/Implementation/HTML.h @@ -7,18 +7,17 @@ #ifndef HTML_H #define HTML_H -#include "UCDefs.h" -#include "UCAux.h" - #ifndef HTUTILS_H #include "HTUtils.h" #endif /* HTUTILS_H */ +#include "UCDefs.h" +#include "UCAux.h" #include "HTAnchor.h" #include "HTMLDTD.h" #ifdef SHORT_NAMES -#define HTMLPresentation HTMLPren -#define HTMLPresent HTMLPres +#define HTMLPresentation HTMLPren +#define HTMLPresent HTMLPres #endif /* SHORT_NAMES */ extern CONST HTStructuredClass HTMLPresentation; @@ -30,30 +29,30 @@ extern CONST HTStructuredClass HTMLPresentation; */ typedef struct _stack_element { - HTStyle * style; + HTStyle * style; int tag_number; } stack_element; /* HTML Object ** ----------- */ -#define MAX_NESTING 800 /* Should be checked by parser */ +#define MAX_NESTING 800 /* Should be checked by parser */ struct _HTStructured { - CONST HTStructuredClass * isa; - HTParentAnchor * node_anchor; - HText * text; + CONST HTStructuredClass * isa; + HTParentAnchor * node_anchor; + HText * text; - HTStream* target; /* Output stream */ + HTStream* target; /* Output stream */ HTStreamClass targetClass; /* Output routines */ HTChildAnchor * CurrentA; /* current HTML_A anchor */ - int CurrentANum; /* current HTML_A number */ + int CurrentANum; /* current HTML_A number */ char * base_href; /* current HTML_BASE href */ char * map_address; /* current HTML_MAP address */ - HTChunk title; /* Grow by 128 */ - HTChunk object; /* Grow by 128 */ + HTChunk title; /* Grow by 128 */ + HTChunk object; /* Grow by 128 */ BOOL object_started; BOOL object_declare; BOOL object_shapes; @@ -67,40 +66,40 @@ struct _HTStructured { char * object_codebase; char * object_codetype; char * object_name; - HTChunk option; /* Grow by 128 */ + HTChunk option; /* Grow by 128 */ BOOL first_option; /* First OPTION in SELECT? */ char * LastOptionValue; BOOL LastOptionChecked; BOOL select_disabled; HTChunk textarea; /* Grow by 128 */ char * textarea_name; - int textarea_name_cs; + int textarea_name_cs; char * textarea_accept_cs; char * textarea_cols; int textarea_rows; - int textarea_disabled; + int textarea_disabled; char * textarea_id; HTChunk math; /* Grow by 128 */ HTChunk style_block; /* Grow by 128 */ - HTChunk script; /* Grow by 128 */ + HTChunk script; /* Grow by 128 */ /* - * Used for nested lists. - FM + * Used for nested lists. - FM */ - int List_Nesting_Level; /* counter for list nesting level */ - int OL_Counter[12]; /* counter for ordered lists */ - char OL_Type[12]; /* types for ordered lists */ + int List_Nesting_Level; /* counter for list nesting level */ + int OL_Counter[12]; /* counter for ordered lists */ + char OL_Type[12]; /* types for ordered lists */ int Last_OL_Count; /* last count in ordered lists */ - char Last_OL_Type; /* last type in ordered lists */ + char Last_OL_Type; /* last type in ordered lists */ - int Division_Level; + int Division_Level; short DivisionAlignments[MAX_NESTING]; - int Underline_Level; - int Quote_Level; + int Underline_Level; + int Quote_Level; BOOL UsePlainSpace; BOOL HiddenValue; - int lastraw; + int lastraw; char * comment_start; /* for literate programming */ char * comment_end; @@ -109,15 +108,15 @@ struct _HTStructured { BOOL style_change; HTStyle * new_style; HTStyle * old_style; - int current_default_alignment; + int current_default_alignment; BOOL in_word; /* Have just had a non-white char */ - stack_element stack[MAX_NESTING]; - stack_element *sp; /* Style stack pointer */ + stack_element stack[MAX_NESTING]; + stack_element *sp; /* Style stack pointer */ BOOL stack_overrun; /* Was MAX_NESTING exceeded? */ - int skip_stack; /* flag to skip next style stack operation */ + int skip_stack; /* flag to skip next style stack operation */ /* - ** Track if we are in an anchor, paragraph, address, base, etc. + ** Track if we are in an anchor, paragraph, address, base, etc. */ BOOL inA; BOOL inAPPLET; @@ -145,41 +144,41 @@ struct _HTStructured { BOOL needBoldH; /* - ** UCI and UCLYhndl give the UCInfo and charset registered for - ** the HTML parser in the node_anchor's UCStages structure. It - ** indicates what is fed to the HTML parser as the stream of character - ** data (not necessarily tags and attributes). It should currently - ** always be set to be the same as UCI and UCLhndl for the HTEXT stage - ** in the node_anchor's UCStages structure, since the HTML parser sends - ** its input character data to the output without further charset - ** translation. + ** UCI and UCLYhndl give the UCInfo and charset registered for + ** the HTML parser in the node_anchor's UCStages structure. It + ** indicates what is fed to the HTML parser as the stream of character + ** data (not necessarily tags and attributes). It should currently + ** always be set to be the same as UCI and UCLhndl for the HTEXT stage + ** in the node_anchor's UCStages structure, since the HTML parser sends + ** its input character data to the output without further charset + ** translation. */ - LYUCcharset * UCI; - int UCLYhndl; + LYUCcharset * UCI; + int UCLYhndl; /* - ** inUCI and inUCLYhndl indicate the UCInfo and charset which the - ** HTML parser treats at the input charset. It is normally set - ** to the UCI and UCLhndl for the SGML parser in the node_anchor's - ** UCStages structure (which may be a dummy, based on the MIME - ** parser's UCI and UCLhndl in that structure, when we are handling - ** a local file or non-http(s) gateway). It could be changed - ** temporarily by the HTML parser, for conversions of attribute - ** strings, but should be reset once done. - FM + ** inUCI and inUCLYhndl indicate the UCInfo and charset which the + ** HTML parser treats at the input charset. It is normally set + ** to the UCI and UCLhndl for the SGML parser in the node_anchor's + ** UCStages structure (which may be a dummy, based on the MIME + ** parser's UCI and UCLhndl in that structure, when we are handling + ** a local file or non-http(s) gateway). It could be changed + ** temporarily by the HTML parser, for conversions of attribute + ** strings, but should be reset once done. - FM */ - LYUCcharset * inUCI; - int inUCLYhndl; + LYUCcharset * inUCI; + int inUCLYhndl; /* - ** outUCI and outUCLYhndl indicate the UCInfo and charset which - ** the HTML parser treats as the output charset. It is normally - ** set to its own UCI and UCLhndl. It could be changed for - ** conversions of attribute strings, but should be reset once - ** done. - FM + ** outUCI and outUCLYhndl indicate the UCInfo and charset which + ** the HTML parser treats as the output charset. It is normally + ** set to its own UCI and UCLhndl. It could be changed for + ** conversions of attribute strings, but should be reset once + ** done. - FM */ - LYUCcharset * outUCI; - int outUCLYhndl; + LYUCcharset * outUCI; + int outUCLYhndl; /* - ** T holds the transformation rules for conversions of strings - ** between the input and output charsets by the HTML parser. - FM + ** T holds the transformation rules for conversions of strings + ** between the input and output charsets by the HTML parser. - FM */ UCTransParams T; @@ -207,32 +206,32 @@ extern int HTML_put_entity PARAMS((HTStructured *me, int entity_number)); ** HTConverter to present HTML */ extern HTStream* HTMLToPlain PARAMS(( - HTPresentation * pres, - HTParentAnchor * anchor, - HTStream * sink)); + HTPresentation * pres, + HTParentAnchor * anchor, + HTStream * sink)); extern HTStream* HTMLToC PARAMS(( - HTPresentation * pres, - HTParentAnchor * anchor, - HTStream * sink)); + HTPresentation * pres, + HTParentAnchor * anchor, + HTStream * sink)); extern HTStream* HTMLPresent PARAMS(( - HTPresentation * pres, - HTParentAnchor * anchor, - HTStream * sink)); + HTPresentation * pres, + HTParentAnchor * anchor, + HTStream * sink)); extern HTStructured* HTML_new PARAMS(( - HTParentAnchor * anchor, - HTFormat format_out, - HTStream * target)); + HTParentAnchor * anchor, + HTFormat format_out, + HTStream * target)); /* ** Names for selected internal representations. */ typedef enum _HTMLCharacterSet { - HTML_ISO_LATIN1, - HTML_NEXT_CHARS, - HTML_PC_CP950 + HTML_ISO_LATIN1, + HTML_NEXT_CHARS, + HTML_PC_CP950 } HTMLCharacterSet; /* @@ -243,11 +242,11 @@ typedef enum _HTMLCharacterSet { ** and leaves the document unloaded. ** ** On entry, -** sink is a stream to the output device if any -** number is the HTTP error number -** message is the human readable message. +** sink is a stream to the output device if any +** number is the HTTP error number +** message is the human readable message. ** On exit, -** a retrun code like HT_LOADED if object exists else 60; 0 +** a retrun code like HT_LOADED if object exists else 60; 0 */ extern int HTLoadError PARAMS(( HTStream * sink, diff --git a/WWW/Library/Implementation/HTMLDTD.c b/WWW/Library/Implementation/HTMLDTD.c index c8356523..58326ed7 100644 --- a/WWW/Library/Implementation/HTMLDTD.c +++ b/WWW/Library/Implementation/HTMLDTD.c @@ -9,55 +9,55 @@ #include "HTMLDTD.h" #include "LYLeaks.h" -/* Entity Names +/* Entity Names ** ------------ ** ** This table must be matched exactly with ALL the translation tables */ static CONST char* entities[] = { - "AElig", /* capital AE diphthong (ligature) */ - "Aacute", /* capital A, acute accent */ - "Acirc", /* capital A, circumflex accent */ - "Agrave", /* capital A, grave accent */ - "Aring", /* capital A, ring */ - "Atilde", /* capital A, tilde */ - "Auml", /* capital A, dieresis or umlaut mark */ - "Ccedil", /* capital C, cedilla */ - "Dstrok", /* capital Eth, Icelandic */ - "ETH", /* capital Eth, Icelandic */ - "Eacute", /* capital E, acute accent */ - "Ecirc", /* capital E, circumflex accent */ - "Egrave", /* capital E, grave accent */ - "Euml", /* capital E, dieresis or umlaut mark */ - "Iacute", /* capital I, acute accent */ - "Icirc", /* capital I, circumflex accent */ - "Igrave", /* capital I, grave accent */ - "Iuml", /* capital I, dieresis or umlaut mark */ - "Ntilde", /* capital N, tilde */ - "Oacute", /* capital O, acute accent */ - "Ocirc", /* capital O, circumflex accent */ - "Ograve", /* capital O, grave accent */ - "Oslash", /* capital O, slash */ - "Otilde", /* capital O, tilde */ - "Ouml", /* capital O, dieresis or umlaut mark */ - "THORN", /* capital THORN, Icelandic */ - "Uacute", /* capital U, acute accent */ - "Ucirc", /* capital U, circumflex accent */ - "Ugrave", /* capital U, grave accent */ - "Uuml", /* capital U, dieresis or umlaut mark */ - "Yacute", /* capital Y, acute accent */ - "aacute", /* small a, acute accent */ - "acirc", /* small a, circumflex accent */ + "AElig", /* capital AE diphthong (ligature) */ + "Aacute", /* capital A, acute accent */ + "Acirc", /* capital A, circumflex accent */ + "Agrave", /* capital A, grave accent */ + "Aring", /* capital A, ring */ + "Atilde", /* capital A, tilde */ + "Auml", /* capital A, dieresis or umlaut mark */ + "Ccedil", /* capital C, cedilla */ + "Dstrok", /* capital Eth, Icelandic */ + "ETH", /* capital Eth, Icelandic */ + "Eacute", /* capital E, acute accent */ + "Ecirc", /* capital E, circumflex accent */ + "Egrave", /* capital E, grave accent */ + "Euml", /* capital E, dieresis or umlaut mark */ + "Iacute", /* capital I, acute accent */ + "Icirc", /* capital I, circumflex accent */ + "Igrave", /* capital I, grave accent */ + "Iuml", /* capital I, dieresis or umlaut mark */ + "Ntilde", /* capital N, tilde */ + "Oacute", /* capital O, acute accent */ + "Ocirc", /* capital O, circumflex accent */ + "Ograve", /* capital O, grave accent */ + "Oslash", /* capital O, slash */ + "Otilde", /* capital O, tilde */ + "Ouml", /* capital O, dieresis or umlaut mark */ + "THORN", /* capital THORN, Icelandic */ + "Uacute", /* capital U, acute accent */ + "Ucirc", /* capital U, circumflex accent */ + "Ugrave", /* capital U, grave accent */ + "Uuml", /* capital U, dieresis or umlaut mark */ + "Yacute", /* capital Y, acute accent */ + "aacute", /* small a, acute accent */ + "acirc", /* small a, circumflex accent */ "acute", /* spacing acute */ - "aelig", /* small ae diphthong (ligature) */ - "agrave", /* small a, grave accent */ - "amp", /* ampersand */ - "aring", /* small a, ring */ - "atilde", /* small a, tilde */ - "auml", /* small a, dieresis or umlaut mark */ + "aelig", /* small ae diphthong (ligature) */ + "agrave", /* small a, grave accent */ + "amp", /* ampersand */ + "aring", /* small a, ring */ + "atilde", /* small a, tilde */ + "auml", /* small a, dieresis or umlaut mark */ "brkbar", /* broken vertical bar */ "brvbar", /* broken vertical bar */ - "ccedil", /* small c, cedilla */ + "ccedil", /* small c, cedilla */ "cedil", /* spacing cedilla */ "cent", /* cent sign */ "copy", /* copyright sign */ @@ -65,44 +65,44 @@ static CONST char* entities[] = { "deg", /* degree sign */ "die", /* spacing diaresis */ "divide", /* division sign */ - "eacute", /* small e, acute accent */ - "ecirc", /* small e, circumflex accent */ - "egrave", /* small e, grave accent */ + "eacute", /* small e, acute accent */ + "ecirc", /* small e, circumflex accent */ + "egrave", /* small e, grave accent */ "emdash", /* dash the width of emsp */ "emsp", /* em space - not collapsed */ "endash", /* dash the width of ensp */ "ensp", /* en space - not collapsed */ - "eth", /* small eth, Icelandic */ - "euml", /* small e, dieresis or umlaut mark */ + "eth", /* small eth, Icelandic */ + "euml", /* small e, dieresis or umlaut mark */ "frac12", /* fraction 1/2 */ "frac14", /* fraction 1/4 */ "frac34", /* fraction 3/4 */ - "gt", /* greater than */ + "gt", /* greater than */ "hibar", /* spacing macron */ - "iacute", /* small i, acute accent */ - "icirc", /* small i, circumflex accent */ + "iacute", /* small i, acute accent */ + "icirc", /* small i, circumflex accent */ "iexcl", /* inverted exclamation mark */ - "igrave", /* small i, grave accent */ + "igrave", /* small i, grave accent */ "iquest", /* inverted question mark */ - "iuml", /* small i, dieresis or umlaut mark */ + "iuml", /* small i, dieresis or umlaut mark */ "laquo", /* angle quotation mark, left */ - "lt", /* less than */ + "lt", /* less than */ "macr", /* spacing macron */ "mdash", /* dash the width of emsp */ "micro", /* micro sign */ "middot", /* middle dot */ - "nbsp", /* non breaking space */ + "nbsp", /* non breaking space */ "ndash", /* dash the width of ensp */ "not", /* negation sign */ - "ntilde", /* small n, tilde */ - "oacute", /* small o, acute accent */ - "ocirc", /* small o, circumflex accent */ - "ograve", /* small o, grave accent */ + "ntilde", /* small n, tilde */ + "oacute", /* small o, acute accent */ + "ocirc", /* small o, circumflex accent */ + "ograve", /* small o, grave accent */ "ordf", /* feminine ordinal indicator */ "ordm", /* masculine ordinal indicator */ - "oslash", /* small o, slash */ - "otilde", /* small o, tilde */ - "ouml", /* small o, dieresis or umlaut mark */ + "oslash", /* small o, slash */ + "otilde", /* small o, tilde */ + "ouml", /* small o, dieresis or umlaut mark */ "para", /* paragraph sign */ "plusmn", /* plus-or-minus sign */ "pound", /* pound sign */ @@ -114,31 +114,31 @@ static CONST char* entities[] = { "sup1", /* superscript 1 */ "sup2", /* superscript 2 */ "sup3", /* superscript 3 */ - "szlig", /* small sharp s, German (sz ligature) */ - "thinsp", /* thin space (not collapsed) */ - "thorn", /* small thorn, Icelandic */ - "times", /* multiplication sign */ - "trade", /* trade mark sign (U+2122) */ - "uacute", /* small u, acute accent */ - "ucirc", /* small u, circumflex accent */ - "ugrave", /* small u, grave accent */ + "szlig", /* small sharp s, German (sz ligature) */ + "thinsp", /* thin space (not collapsed) */ + "thorn", /* small thorn, Icelandic */ + "times", /* multiplication sign */ + "trade", /* trade mark sign (U+2122) */ + "uacute", /* small u, acute accent */ + "ucirc", /* small u, circumflex accent */ + "ugrave", /* small u, grave accent */ "uml", /* spacing diaresis */ - "uuml", /* small u, dieresis or umlaut mark */ - "yacute", /* small y, acute accent */ + "uuml", /* small u, dieresis or umlaut mark */ + "yacute", /* small y, acute accent */ "yen", /* yen sign */ - "yuml", /* small y, dieresis or umlaut mark */ + "yuml", /* small y, dieresis or umlaut mark */ }; #define HTML_ENTITIES 112 -/* Extra Entity Names +/* Extra Entity Names ** ------------------ ** -** This table contains Unicodes in addition to the Names. - kw +** This table contains Unicodes in addition to the Names. ** * -* I think in the future the whole entities[] thing above could migrate -* to this kind of structure. The structured streams to which +* Whole entities[] thing above (and much more) now present +* in this kind of structure. The structured streams to which * the SGML modules sends its output could then easily have access * to both entity names and unicode values for each (special) * character. Probably the whole translation to display characters @@ -147,302 +147,1075 @@ static CONST char* entities[] = { * to SGML whether the entity could be displayed or not. * (like between SGML_character() and handle_entity() via FoundEntity.) * Well, trying to do that now. -* Why keep two structures for entities? Backward compatibility.. +* Why keep two structures for entities? Backward compatibility.. */ /* UC_entity_info structure is defined in SGML.h. */ -/* This has to be sorted alphabetically, - bear this in mind when you add some more entities.. - - Now we have here: - all ISO-8859-2 entites - - lrm, rlm, zwnj and zwj +/* This has to be sorted alphabetically (case-sensitive), + bear this in mind when you add some more entities.. + +This table available from ftp://ftp.unicode.org/MAPPINGS/ +original comment follows: + + +# Author: John Cowan <cowan@ccil.org> +# Date: 25 July 1997 +# +# The following table maps SGML character entities from various +# public sets (namely, ISOamsa, ISOamsb, ISOamsc, ISOamsn, ISOamso, +# ISOamsr, ISObox, ISOcyr1, ISOcyr2, ISOdia, ISOgrk1, ISOgrk2, +# ISOgrk3, ISOgrk4, ISOlat1, ISOlat2, ISOnum, ISOpub, ISOtech, +# HTMLspecial, HTMLsymbol) to corresponding Unicode characters. +# +# The table has four tab-separated columns: +# Column 1: SGML character entity name +# Column 2: SGML public entity set +# Column 3: Unicode 2.0 character code +# Column 4: Unicode 2.0 character name (UPPER CASE) +# Entries which don't have Unicode equivalents have "0x????" +# in Column 3 and a lower case description (from the public entity +# set DTD) in Column 4. The mapping is not reversible, because many +# distinctions are unified away in Unicode, particularly between +# mathematical symbols. +# +# The table is sorted case-blind by SGML character entity name. +# +# The contents of this table are drawn from various sources, and +# are in the public domain. +# */ + +/* We just sort it and move column 2 away (line too long, sorry). + Also we add a few synonyms (obsolete): + "brkbar" for "brvbar" 0x00A6 + "emdash" for "mdash" 0x2014 + "endash" for "ndash" 0x2013 + "hibar" for "macr" 0x00AF + for exact compatibility with entities[] and previous bevavior. + BTW, lots of synonyms found in this table, we shouldn't worry about... +*/ + static CONST UC_entity_info extra_entities[] = { - {"Aacute", 0x00c1}, /* A with acute */ - {"Abreve", 0x0102}, /* A with breve */ - {"Acirc", 0x00c2}, /* capital A, circumflex accent */ - {"Alpha", 0x0391}, /* greek capital letter alpha, u+0391 */ - {"Aogon", 0x0104}, /* A with ogonek */ - {"Auml", 0x00c4}, /* capital A, dieresis or umlaut mark */ - {"Beta", 0x0392}, /* greek capital letter beta, u+0392 */ - {"Cacute", 0x0106}, /* C with acute */ - {"Ccaron", 0x010c}, /* C with caron */ - {"Ccedil", 0x00c7}, /* capital C, cedilla */ - {"Chi", 0x03a7}, /* greek capital letter chi, u+03A7 */ - {"Dagger", 0x2021}, /* double dagger, u+2021 ISOpub */ - {"Dcaron", 0x010e}, /* D with caron */ - {"Delta", 0x0394}, /* greek capital letter delta, u+0394 ISOgrk3 */ - {"Dstrok", 0x0110}, /* D with stroke */ - {"Eacute", 0x00c9}, /* E with acute */ - {"Ecaron", 0x011a}, /* E with caron */ - {"Eogon", 0x0118}, /* E with ogonek */ - {"Epsilon", 0x0395}, /* greek capital letter epsilon, u+0395 */ - {"Eta", 0x0397}, /* greek capital letter eta, u+0397 */ - {"Euml", 0x00cb}, /* capital E, dieresis or umlaut mark */ - {"Gamma", 0x0393}, /* greek capital letter gamma, u+0393 ISOgrk3 */ - {"Iacute", 0x00cd}, /* I with acute */ - {"Icirc", 0x00ce}, /* capital I, circumflex accent */ - {"Iota", 0x0399}, /* greek capital letter iota, u+0399 */ - {"Kappa", 0x039a}, /* greek capital letter kappa, u+039A */ - {"Lacute", 0x0139}, /* L with acute */ - {"Lambda", 0x039b}, /* greek capital letter lambda, u+039B ISOgrk */ - {"Lcaron", 0x013d}, /* L with caron */ - {"Lstrok", 0x0141}, /* L with stroke */ - {"Mu", 0x039c}, /* greek capital letter mu, u+039C */ - {"Nacute", 0x0143}, /* N with acute */ - {"Ncaron", 0x0147}, /* N with caron */ - {"Ntilde", 0x00d1}, /* capital N, tilde */ - {"Nu", 0x039d}, /* greek capital letter nu, u+039D */ - {"OElig", 0x0152}, /* latin capital ligature oe, u+0152 ISOlat2 - */ - {"Oacute", 0x00d3}, /* O with acute */ - {"Ocirc", 0x00d4}, /* O with circumflex */ - {"Odblac", 0x0150}, /* O with double acute */ - {"Ograve", 0x00d2}, /* capital O, grave accent */ - {"Omega", 0x03a9}, /* greek capital letter omega, u+03A9 ISOgrk3 */ - {"Omicron", 0x039f}, /* greek capital letter omicron, u+039F */ - {"Ouml", 0x00d6}, /* O with diaeresis */ - {"Phi", 0x03a6}, /* greek capital letter phi, u+03A6 ISOgrk3 - */ - {"Pi", 0x03a0}, /* greek capital letter pi, u+03A0 ISOgrk3 -- */ - {"Prime", 0x2033}, /* double prime, =seconds, =inches, u+2033 IS */ - {"Psi", 0x03a8}, /* greek capital letter psi, u+03A8 ISOgrk3 - */ - {"Racute", 0x0154}, /* R with acute */ - {"Rcaron", 0x0158}, /* R with caron */ - {"Rho", 0x03a1}, /* greek capital letter rho, u+03A1 */ - {"Sacute", 0x015a}, /* S with acute */ - {"Scaron", 0x0160}, /* S with caron */ - {"Scedil", 0x015e}, /* S with cedilla */ - {"Sigma", 0x03a3}, /* greek capital letter sigma, u+03A3 ISOgrk3 */ - {"Tau", 0x03a4}, /* greek capital letter tau, u+03A4 */ - {"Tcaron", 0x0164}, /* T with caron */ - {"Tcedil", 0x0162}, /* T with cedilla */ - {"Theta", 0x0398}, /* greek capital letter theta, u+0398 ISOgrk3 */ - {"Uacute", 0x00da}, /* U with acute */ - {"Udblac", 0x0170}, /* U with double acute */ - {"Ugrave", 0x00d9}, /* capital U, grave accent */ - {"Upsilon", 0x03a5}, /* greek capital letter upsilon, u+03A5 IS */ - {"Uring", 0x016e}, /* U with ring above */ - {"Uuml", 0x00dc}, /* capital U, dieresis or umlaut mark */ - {"Xi", 0x039e}, /* greek capital letter xi, u+039E ISOgrk3 -- */ - {"Yacute", 0x00dd}, /* capital Y, acute accent */ - {"Yuml", 0x0178}, /* latin capital letter y with diaeresis, u+01 */ - {"Zacute", 0x0179}, /* Z with acute */ - {"Zcaron", 0x017d}, /* Z with caron */ - {"Zdot", 0x017b}, /* Z with dot above */ - {"Zeta", 0x0396}, /* greek capital letter zeta, u+0396 */ - {"aacute", 0x00e1}, /* a with acute */ - {"abreve", 0x0103}, /* a with breve */ - {"acirc", 0x00e2}, /* a with circumflex */ - {"acute", 0x00b4}, /* acuteaccent */ - {"alefsym", 0x2135}, /* alef symbol, =first transfinite cardinal, */ - {"alpha", 0x03b1}, /* greek small letter alpha, u+03B1 ISOgrk3 -- */ - {"amp", 0x0026}, /* ampersand, u+0026 ISOnum */ - {"and", 0x2227}, /* logical and, =wedge, u+2227 ISOtech */ - {"ang", 0x2220}, /* angle, u+2220 ISOamso */ - {"aogon", 0x0105}, /* a with ogonek */ - {"apos", 0x0027}, /* apostrophe */ - {"ast", 0x002a}, /* asterisk */ - {"asymp", 0x2248}, /* almost equal to, =asymptotic to, u+2248 IS */ - {"auml", 0x00e4}, /* small a, dieresis or umlaut mark */ - {"bdquo", 0x201e}, /* double low-9 quotation mark, u+201E NEW -- */ - {"beta", 0x03b2}, /* greek small letter beta, u+03B2 ISOgrk3 -- */ - {"breve", 0x02d8}, /* breve */ - {"bsol", 0x005c}, /* reversesolidus */ - {"bull", 0x2022}, /* bullet, =black small circle, u+2022 ISOpub */ - {"cacute", 0x0107}, /* c with acute */ - {"cap", 0x2229}, /* intersection, =cap, u+2229 ISOtech */ - {"caron", 0x02c7}, /* caron */ - {"ccaron", 0x010d}, /* c with caron */ - {"ccedil", 0x00e7}, /* c with cedilla */ - {"cedil", 0x00b8}, /* cedilla */ - {"cent", 0x00a2}, /* cent sign */ - {"chi", 0x03c7}, /* greek small letter chi, u+03C7 ISOgrk3 */ - {"circ", 0x02c6}, /* modifier letter circumflex accent, u+02C6 */ - {"clubs", 0x2663}, /* black club suit, =shamrock, u+2663 ISOpub */ - {"colon", 0x003a}, /* colon */ - {"comma", 0x002c}, /* comma */ - {"commat", 0x0040}, /* commercialat */ - {"cong", 0x2245}, /* approximately equal to, u+2245 ISOtech */ - {"crarr", 0x21b5}, /* downwards arrow with corner leftwards, =ca */ - {"cup", 0x222a}, /* union, =cup, u+222A ISOtech */ - {"curren", 0x00a4}, /* general currency sign */ - {"dArr", 0x21d3}, /* downwards double arrow, u+21D3 ISOamsa */ - {"dagger", 0x2020}, /* dagger, u+2020 ISOpub */ - {"darr", 0x2193}, /* downwards arrow, u+2193 ISOnum */ - {"dblac", 0x02dd}, /* doubleacuteaccent */ - {"dcaron", 0x010f}, /* d with caron */ - {"deg", 0x00b0}, /* degreesign */ - {"delta", 0x03b4}, /* greek small letter delta, u+03B4 ISOgrk3 - */ - {"diams", 0x2666}, /* black diamond suit, u+2666 ISOpub */ - {"divide", 0x00f7}, /* divisionsign */ - {"dollar", 0x0024}, /* dollarsign */ - {"dot", 0x02d9}, /* dotabove */ - {"dstrok", 0x0111}, /* d with stroke */ - {"eacute", 0x00e9}, /* e with acute */ - {"ecaron", 0x011b}, /* e with caron */ - {"ecirc", 0x00ea}, /* small e, circumflex accent */ - {"empty", 0x2205}, /* empty set, =null set, =diameter, u+2205 IS */ - {"emsp", 0x2003}, /* em space, u+2003 ISOpub */ - {"ensp", 0x2002}, /* en space, u+2002 ISOpub */ - {"eogon", 0x0119}, /* e with ogonek */ - {"epsilon", 0x03b5}, /* greek small letter epsilon, u+03B5 ISOg */ - {"equals", 0x003d}, /* equalssign */ - {"equiv", 0x2261}, /* identical to, u+2261 ISOtech */ - {"eta", 0x03b7}, /* greek small letter eta, u+03B7 ISOgrk3 */ - {"euml", 0x00eb}, /* e with diaeresis */ - {"excl", 0x0021}, /* exclamationmark */ - {"exist", 0x2203}, /* there exists, u+2203 ISOtech */ - {"fnof", 0x0192}, /* latin small f with hook, =function, =flori */ - {"forall", 0x2200}, /* for all, u+2200 ISOtech */ - {"frasl", 0x2044}, /* fraction slash, u+2044 NEW */ - {"gamma", 0x03b3}, /* greek small letter gamma, u+03B3 ISOgrk3 - */ - {"ge", 0x2265}, /* greater-than or equal to, u+2265 ISOtech - */ - {"grave", 0x0060}, /* graveaccent */ - {"gt", 0x003e}, /* greater-thansign */ - {"hArr", 0x21d4}, /* left right double arrow, u+21D4 ISOamsa -- */ - {"harr", 0x2194}, /* left right arrow, u+2194 ISOamsa */ - {"hearts", 0x2665}, /* black heart suit, =valentine, u+2665 ISOpu */ - {"hellip", 0x2026}, /* horizontal ellipsis, =three dot leader, u+ */ - {"hyphen", 0x002d}, /* hyphen-minus */ - {"iacute", 0x00ed}, /* i with acute */ - {"icirc", 0x00ee}, /* small i, circumflex accent */ - {"image", 0x2111}, /* blackletter capital I, =imaginary part, u+ */ - {"infin", 0x221e}, /* infinity, u+221E ISOtech */ - {"int", 0x222b}, /* integral, u+222B ISOtech */ - {"iota", 0x03b9}, /* greek small letter iota, u+03B9 ISOgrk3 -- */ - {"isin", 0x2208}, /* element of, u+2208 ISOtech */ - {"kappa", 0x03ba}, /* greek small letter kappa, u+03BA ISOgrk3 - */ - {"lArr", 0x21d0}, /* leftwards double arrow, u+21D0 ISOtech */ - {"lacute", 0x013a}, /* l with acute */ - {"lambda", 0x03bb}, /* greek small letter lambda, u+03BB ISOgrk3 */ - {"lang", 0x2329}, /* left-pointing angle bracket, =bra, u+2329 */ - {"larr", 0x2190}, /* leftwards arrow, u+2190 ISOnum */ - {"lcaron", 0x013e}, /* l with caron */ - {"lceil", 0x2308}, /* left ceiling, =apl upstile, u+2308, ISOams */ - {"lcub", 0x007b}, /* leftcurlybracket */ - {"ldquo", 0x201c}, /* left double quotation mark, u+201C ISOnum */ - {"le", 0x2264}, /* less-than or equal to, u+2264 ISOtech */ - {"lfloor", 0x230a}, /* left floor, =apl downstile, u+230A, ISOams */ - {"lowast", 0x2217}, /* asterisk operator, u+2217 ISOtech */ - {"lowbar", 0x005f}, /* lowline */ - {"loz", 0x25ca}, /* lozenge, u+25CA ISOpub */ - {"lpar", 0x0028}, /* leftparenthesis */ - {"lrm", 0x200e}, /* left-to-right mark, u+200E NEW RFC 2070 -- */ - {"lsaquo", 0x2039}, /* single left-pointing angle quotation mark, */ - {"lsqb", 0x005b}, /* leftsquarebracket */ - {"lsquo", 0x2018}, /* left single quotation mark, u+2018 ISOnum */ - {"lstrok", 0x0142}, /* l with stroke */ - {"lt", 0x003c}, /* less-thansign */ - {"macr", 0x00af}, /* macron */ - {"mdash", 0x2014}, /* em dash, u+2014 ISOpub */ - {"minus", 0x2212}, /* minus sign, u+2212 ISOtech */ - {"mu", 0x03bc}, /* greek small letter mu, u+03BC ISOgrk3 */ - {"nabla", 0x2207}, /* nabla, =backward difference, u+2207 ISOtec */ - {"nacute", 0x0144}, /* n with acute */ - {"nbsp", 0x00a0}, /* no-break space */ - {"ncaron", 0x0148}, /* n with caron */ - {"ndash", 0x2013}, /* en dash, u+2013 ISOpub */ - {"ne", 0x2260}, /* not equal to, u+2260 ISOtech */ - {"ni", 0x220b}, /* contains as member, u+220B ISOtech */ - {"notin", 0x2209}, /* not an element of, u+2209 ISOtech */ - {"nsub", 0x2284}, /* not a subset of, u+2284 ISOamsn */ - {"nu", 0x03bd}, /* greek small letter nu, u+03BD ISOgrk3 */ - {"num", 0x0023}, /* numbersign */ - {"oacute", 0x00f3}, /* o with acute */ - {"ocirc", 0x00f4}, /* o with circumflex */ - {"odblac", 0x0151}, /* o with double acute */ - {"oelig", 0x0153}, /* latin small ligature oe, u+0153 ISOlat2 */ - {"ogon", 0x02db}, /* ogonek */ - {"ograve", 0x00f2}, /* small o, grave accent */ - {"oline", 0x203e}, /* overline, =spacing overscore, u+203E NEW - */ - {"omega", 0x03c9}, /* greek small letter omega, u+03C9 ISOgrk3 - */ - {"omicron", 0x03bf}, /* greek small letter omicron, u+03BF NEW */ - {"oplus", 0x2295}, /* circled plus, =direct sum, u+2295 ISOamsb */ - {"or", 0x2228}, /* logical or, =vee, u+2228 ISOtech */ - {"oslash", 0x00f8}, /* small o, slash */ - {"otimes", 0x2297}, /* circled times, =vector product, u+2297 ISO */ - {"ouml", 0x00f6}, /* small o, dieresis or umlaut mark */ - {"part", 0x2202}, /* partial differential, u+2202 ISOtech */ - {"percnt", 0x0025}, /* percentsign */ - {"period", 0x002e}, /* fullstop */ - {"permil", 0x2030}, /* per mille sign, u+2030 ISOtech */ - {"perp", 0x22a5}, /* up tack, =orthogonal to, =perpendicular, u */ - {"phi", 0x03c6}, /* greek small letter phi, u+03C6 ISOgrk3 */ - {"pi", 0x03c0}, /* greek small letter pi, u+03C0 ISOgrk3 */ - {"piv", 0x03d6}, /* greek pi symbol, u+03D6 ISOgrk3 */ - {"plus", 0x002b}, /* plussign */ - {"plusmn", 0x00b1}, /* plus-or-minus sign */ - {"prime", 0x2032}, /* prime, =minutes, =feet, u+2032 ISOtech */ - {"prod", 0x220f}, /* n-ary product, =product sign, u+220F ISOam */ - {"prop", 0x221d}, /* proportional to, u+221D ISOtech */ - {"psi", 0x03c8}, /* greek small letter psi, u+03C8 ISOgrk3 */ - {"quest", 0x003f}, /* questionmark */ - {"quot", 0x0022}, /* quotationmark */ - {"rArr", 0x21d2}, /* rightwards double arrow, u+21D2 ISOtech -- */ - {"racute", 0x0155}, /* r with acute */ - {"radic", 0x221a}, /* square root, =radical sign, u+221A ISOtech */ - {"rang", 0x232a}, /* right-pointing angle bracket, =ket, u+232A */ - {"rarr", 0x2192}, /* rightwards arrow, u+2192 ISOnum */ - {"rcaron", 0x0159}, /* r with caron */ - {"rceil", 0x2309}, /* right ceiling, u+2309, ISOamsc */ - {"rcub", 0x007d}, /* rightcurlybracket */ - {"rdquo", 0x201d}, /* right double quotation mark, u+201D ISOnum */ - {"real", 0x211c}, /* blackletter capital R, =real part symbol, */ - {"rfloor", 0x230b}, /* right floor, u+230B, ISOamsc */ - {"rho", 0x03c1}, /* greek small letter rho, u+03C1 ISOgrk3 */ - {"rlm", 8207}, /* right-to-left mark */ - {"rpar", 0x0029}, /* rightparenthesis */ - {"rsaquo", 0x203a}, /* single right-pointing angle quotation mark */ - {"rsqb", 0x005d}, /* rightsquarebracket */ - {"rsquo", 0x2019}, /* right single quotation mark, u+2019 ISOnum */ - {"sacute", 0x015b}, /* s with acute */ - {"sbquo", 0x201a}, /* single low-9 quotation mark, u+201A NEW -- */ - {"scaron", 0x0161}, /* latin small letter s with caron, u+0161 ISO */ - {"scedil", 0x015f}, /* s with cedilla */ - {"sdot", 0x22c5}, /* dot operator, u+22C5 ISOamsb */ - {"sect", 0x00a7}, /* section sign */ - {"semi", 0x003b}, /* semicolon */ - {"shy", 0x00ad}, /* soft hyphen */ - {"sigma", 0x03c3}, /* greek small letter sigma, u+03C3 ISOgrk3 - */ - {"sigmaf", 0x03c2}, /* greek small letter final sigma, u+03C2 ISO */ - {"sim", 0x223c}, /* tilde operator, =varies with, =similar to, */ - {"sol", 0x002f}, /* solidus */ - {"spades", 0x2660}, /* black spade suit, u+2660 ISOpub */ - {"sub", 0x2282}, /* subset of, u+2282 ISOtech */ - {"sube", 0x2286}, /* subset of or equal to, u+2286 ISOtech */ - {"sum", 0x2211}, /* n-ary sumation, u+2211 ISOamsb */ - {"sup", 0x2283}, /* superset of, u+2283 ISOtech */ - {"supe", 0x2287}, /* superset of or equal to, u+2287 ISOtech -- */ - {"tau", 0x03c4}, /* greek small letter tau, u+03C4 ISOgrk3 */ - {"tcaron", 0x0165}, /* t with caron */ - {"tcedil", 0x0163}, /* t with cedilla */ - {"there4", 0x2234}, /* therefore, u+2234 ISOtech */ - {"theta", 0x03b8}, /* greek small letter theta, u+03B8 ISOgrk3 - */ - {"thetasym", 0x03d1}, /* greek small letter theta symbol, u+03D1 */ - {"thinsp", 0x2009}, /* thin space, u+2009 ISOpub */ - {"tilde", 0x02dc}, /* small tilde, u+02DC ISOdia */ - {"times", 0x00d7}, /* multiply sign */ - {"trade", 0x2122}, /* trade mark sign, u+2122 ISOnum */ - {"uArr", 0x21d1}, /* upwards double arrow, u+21D1 ISOamsa */ - {"uacute", 0x00fa}, /* u with acute */ - {"uarr", 0x2191}, /* upwards arrow, u+2191 ISOnum--> */ - {"udblac", 0x0171}, /* u with double acute */ - {"uml", 0x00a8}, /* umlaut (dieresis) */ - {"upsih", 0x03d2}, /* greek upsilon with hook symbol, u+03D2 NEW */ - {"upsilon", 0x03c5}, /* greek small letter upsilon, u+03C5 ISOg */ - {"uring", 0x016f}, /* u with ring above */ - {"uuml", 0x00fc}, /* u with diaeresis */ - {"verbar", 0x007c}, /* verticalline */ - {"weierp", 0x2118}, /* script capital P, =power set, =Weierstrass */ - {"xi", 0x03be}, /* greek small letter xi, u+03BE ISOgrk3 */ - {"yacute", 0x00fd}, /* y with acute */ - {"zacute", 0x017a}, /* z with acute */ - {"zcaron", 0x017e}, /* z with caron */ - {"zdot", 0x017c}, /* z with dot above */ - {"zeta", 0x03b6}, /* greek small letter zeta, u+03B6 ISOgrk3 -- */ - {"zwj", 8205}, /* zero width joiner */ - {"zwnj", 8204}, /* zero width non-joiner */ + {"AElig", 0x00C6}, /* LATIN CAPITAL LETTER AE */ + {"Aacgr", 0x0386}, /* GREEK CAPITAL LETTER ALPHA WITH TONOS */ + {"Aacute", 0x00C1}, /* LATIN CAPITAL LETTER A WITH ACUTE */ + {"Abreve", 0x0102}, /* LATIN CAPITAL LETTER A WITH BREVE */ + {"Acirc", 0x00C2}, /* LATIN CAPITAL LETTER A WITH CIRCUMFLEX */ + {"Acy", 0x0410}, /* CYRILLIC CAPITAL LETTER A */ + {"Agr", 0x0391}, /* GREEK CAPITAL LETTER ALPHA */ + {"Agrave", 0x00C0}, /* LATIN CAPITAL LETTER A WITH GRAVE */ + {"Alpha", 0x0391}, /* GREEK CAPITAL LETTER ALPHA */ + {"Amacr", 0x0100}, /* LATIN CAPITAL LETTER A WITH MACRON */ + {"Aogon", 0x0104}, /* LATIN CAPITAL LETTER A WITH OGONEK */ + {"Aring", 0x00C5}, /* LATIN CAPITAL LETTER A WITH RING ABOVE */ + {"Atilde", 0x00C3}, /* LATIN CAPITAL LETTER A WITH TILDE */ + {"Auml", 0x00C4}, /* LATIN CAPITAL LETTER A WITH DIAERESIS */ + {"Barwed", 0x2306}, /* PERSPECTIVE */ + {"Bcy", 0x0411}, /* CYRILLIC CAPITAL LETTER BE */ + {"Beta", 0x0392}, /* GREEK CAPITAL LETTER BETA */ + {"Bgr", 0x0392}, /* GREEK CAPITAL LETTER BETA */ + {"CHcy", 0x0427}, /* CYRILLIC CAPITAL LETTER CHE */ + {"Cacute", 0x0106}, /* LATIN CAPITAL LETTER C WITH ACUTE */ + {"Cap", 0x22D2}, /* DOUBLE INTERSECTION */ + {"Ccaron", 0x010C}, /* LATIN CAPITAL LETTER C WITH CARON */ + {"Ccedil", 0x00C7}, /* LATIN CAPITAL LETTER C WITH CEDILLA */ + {"Ccirc", 0x0108}, /* LATIN CAPITAL LETTER C WITH CIRCUMFLEX */ + {"Cdot", 0x010A}, /* LATIN CAPITAL LETTER C WITH DOT ABOVE */ + {"Chi", 0x03A7}, /* GREEK CAPITAL LETTER CHI */ + {"Cup", 0x22D3}, /* DOUBLE UNION */ + {"DJcy", 0x0402}, /* CYRILLIC CAPITAL LETTER DJE */ + {"DScy", 0x0405}, /* CYRILLIC CAPITAL LETTER DZE */ + {"DZcy", 0x040F}, /* CYRILLIC CAPITAL LETTER DZHE */ + {"Dagger", 0x2021}, /* DOUBLE DAGGER */ + {"Dcaron", 0x010E}, /* LATIN CAPITAL LETTER D WITH CARON */ + {"Dcy", 0x0414}, /* CYRILLIC CAPITAL LETTER DE */ + {"Delta", 0x0394}, /* GREEK CAPITAL LETTER DELTA */ + {"Dgr", 0x0394}, /* GREEK CAPITAL LETTER DELTA */ + {"Dot", 0x00A8}, /* DIAERESIS */ + {"DotDot", 0x20DC}, /* COMBINING FOUR DOTS ABOVE */ + {"Dstrok", 0x0110}, /* LATIN CAPITAL LETTER D WITH STROKE */ + {"EEacgr", 0x0389}, /* GREEK CAPITAL LETTER ETA WITH TONOS */ + {"EEgr", 0x0397}, /* GREEK CAPITAL LETTER ETA */ + {"ENG", 0x014A}, /* LATIN CAPITAL LETTER ENG */ + {"ETH", 0x00D0}, /* LATIN CAPITAL LETTER ETH */ + {"Eacgr", 0x0388}, /* GREEK CAPITAL LETTER EPSILON WITH TONOS */ + {"Eacute", 0x00C9}, /* LATIN CAPITAL LETTER E WITH ACUTE */ + {"Ecaron", 0x011A}, /* LATIN CAPITAL LETTER E WITH CARON */ + {"Ecirc", 0x00CA}, /* LATIN CAPITAL LETTER E WITH CIRCUMFLEX */ + {"Ecy", 0x042D}, /* CYRILLIC CAPITAL LETTER E */ + {"Edot", 0x0116}, /* LATIN CAPITAL LETTER E WITH DOT ABOVE */ + {"Egr", 0x0395}, /* GREEK CAPITAL LETTER EPSILON */ + {"Egrave", 0x00C8}, /* LATIN CAPITAL LETTER E WITH GRAVE */ + {"Emacr", 0x0112}, /* LATIN CAPITAL LETTER E WITH MACRON */ + {"Eogon", 0x0118}, /* LATIN CAPITAL LETTER E WITH OGONEK */ + {"Epsilon", 0x0395}, /* GREEK CAPITAL LETTER EPSILON */ + {"Eta", 0x0397}, /* GREEK CAPITAL LETTER ETA */ + {"Euml", 0x00CB}, /* LATIN CAPITAL LETTER E WITH DIAERESIS */ + {"Fcy", 0x0424}, /* CYRILLIC CAPITAL LETTER EF */ + {"GJcy", 0x0403}, /* CYRILLIC CAPITAL LETTER GJE */ + {"Gamma", 0x0393}, /* GREEK CAPITAL LETTER GAMMA */ + {"Gbreve", 0x011E}, /* LATIN CAPITAL LETTER G WITH BREVE */ + {"Gcedil", 0x0122}, /* LATIN CAPITAL LETTER G WITH CEDILLA */ + {"Gcirc", 0x011C}, /* LATIN CAPITAL LETTER G WITH CIRCUMFLEX */ + {"Gcy", 0x0413}, /* CYRILLIC CAPITAL LETTER GHE */ + {"Gdot", 0x0120}, /* LATIN CAPITAL LETTER G WITH DOT ABOVE */ + {"Gg", 0x22D9}, /* VERY MUCH GREATER-THAN */ + {"Ggr", 0x0393}, /* GREEK CAPITAL LETTER GAMMA */ + {"Gt", 0x226B}, /* MUCH GREATER-THAN */ + {"HARDcy", 0x042A}, /* CYRILLIC CAPITAL LETTER HARD SIGN */ + {"Hcirc", 0x0124}, /* LATIN CAPITAL LETTER H WITH CIRCUMFLEX */ + {"Hstrok", 0x0126}, /* LATIN CAPITAL LETTER H WITH STROKE */ + {"IEcy", 0x0415}, /* CYRILLIC CAPITAL LETTER IE */ + {"IJlig", 0x0132}, /* LATIN CAPITAL LIGATURE IJ */ + {"IOcy", 0x0401}, /* CYRILLIC CAPITAL LETTER IO */ + {"Iacgr", 0x038A}, /* GREEK CAPITAL LETTER IOTA WITH TONOS */ + {"Iacute", 0x00CD}, /* LATIN CAPITAL LETTER I WITH ACUTE */ + {"Icirc", 0x00CE}, /* LATIN CAPITAL LETTER I WITH CIRCUMFLEX */ + {"Icy", 0x0418}, /* CYRILLIC CAPITAL LETTER I */ + {"Idigr", 0x03AA}, /* GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */ + {"Idot", 0x0130}, /* LATIN CAPITAL LETTER I WITH DOT ABOVE */ + {"Igr", 0x0399}, /* GREEK CAPITAL LETTER IOTA */ + {"Igrave", 0x00CC}, /* LATIN CAPITAL LETTER I WITH GRAVE */ + {"Imacr", 0x012A}, /* LATIN CAPITAL LETTER I WITH MACRON */ + {"Iogon", 0x012E}, /* LATIN CAPITAL LETTER I WITH OGONEK */ + {"Iota", 0x0399}, /* GREEK CAPITAL LETTER IOTA */ + {"Itilde", 0x0128}, /* LATIN CAPITAL LETTER I WITH TILDE */ + {"Iukcy", 0x0406}, /* CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN*/ + {"Iuml", 0x00CF}, /* LATIN CAPITAL LETTER I WITH DIAERESIS */ + {"Jcirc", 0x0134}, /* LATIN CAPITAL LETTER J WITH CIRCUMFLEX */ + {"Jcy", 0x0419}, /* CYRILLIC CAPITAL LETTER SHORT I */ + {"Jsercy", 0x0408}, /* CYRILLIC CAPITAL LETTER JE */ + {"Jukcy", 0x0404}, /* CYRILLIC CAPITAL LETTER UKRAINIAN IE */ + {"KHcy", 0x0425}, /* CYRILLIC CAPITAL LETTER HA */ + {"KHgr", 0x03A7}, /* GREEK CAPITAL LETTER CHI */ + {"KJcy", 0x040C}, /* CYRILLIC CAPITAL LETTER KJE */ + {"Kappa", 0x039A}, /* GREEK CAPITAL LETTER KAPPA */ + {"Kcedil", 0x0136}, /* LATIN CAPITAL LETTER K WITH CEDILLA */ + {"Kcy", 0x041A}, /* CYRILLIC CAPITAL LETTER KA */ + {"Kgr", 0x039A}, /* GREEK CAPITAL LETTER KAPPA */ + {"LJcy", 0x0409}, /* CYRILLIC CAPITAL LETTER LJE */ + {"Lacute", 0x0139}, /* LATIN CAPITAL LETTER L WITH ACUTE */ + {"Lambda", 0x039B}, /* GREEK CAPITAL LETTER LAMDA */ + {"Larr", 0x219E}, /* LEFTWARDS TWO HEADED ARROW */ + {"Lcaron", 0x013D}, /* LATIN CAPITAL LETTER L WITH CARON */ + {"Lcedil", 0x013B}, /* LATIN CAPITAL LETTER L WITH CEDILLA */ + {"Lcy", 0x041B}, /* CYRILLIC CAPITAL LETTER EL */ + {"Lgr", 0x039B}, /* GREEK CAPITAL LETTER LAMDA */ + {"Ll", 0x22D8}, /* VERY MUCH LESS-THAN */ + {"Lmidot", 0x013F}, /* LATIN CAPITAL LETTER L WITH MIDDLE DOT */ + {"Lstrok", 0x0141}, /* LATIN CAPITAL LETTER L WITH STROKE */ + {"Lt", 0x226A}, /* MUCH LESS-THAN */ + {"Mcy", 0x041C}, /* CYRILLIC CAPITAL LETTER EM */ + {"Mgr", 0x039C}, /* GREEK CAPITAL LETTER MU */ + {"Mu", 0x039C}, /* GREEK CAPITAL LETTER MU */ + {"NJcy", 0x040A}, /* CYRILLIC CAPITAL LETTER NJE */ + {"Nacute", 0x0143}, /* LATIN CAPITAL LETTER N WITH ACUTE */ + {"Ncaron", 0x0147}, /* LATIN CAPITAL LETTER N WITH CARON */ + {"Ncedil", 0x0145}, /* LATIN CAPITAL LETTER N WITH CEDILLA */ + {"Ncy", 0x041D}, /* CYRILLIC CAPITAL LETTER EN */ + {"Ngr", 0x039D}, /* GREEK CAPITAL LETTER NU */ + {"Ntilde", 0x00D1}, /* LATIN CAPITAL LETTER N WITH TILDE */ + {"Nu", 0x039D}, /* GREEK CAPITAL LETTER NU */ + {"OElig", 0x0152}, /* LATIN CAPITAL LIGATURE OE */ + {"OHacgr", 0x038F}, /* GREEK CAPITAL LETTER OMEGA WITH TONOS */ + {"OHgr", 0x03A9}, /* GREEK CAPITAL LETTER OMEGA */ + {"Oacgr", 0x038C}, /* GREEK CAPITAL LETTER OMICRON WITH TONOS */ + {"Oacute", 0x00D3}, /* LATIN CAPITAL LETTER O WITH ACUTE */ + {"Ocirc", 0x00D4}, /* LATIN CAPITAL LETTER O WITH CIRCUMFLEX */ + {"Ocy", 0x041E}, /* CYRILLIC CAPITAL LETTER O */ + {"Odblac", 0x0150}, /* LATIN CAPITAL LETTER O WITH DOUBLE ACUTE */ + {"Ogr", 0x039F}, /* GREEK CAPITAL LETTER OMICRON */ + {"Ograve", 0x00D2}, /* LATIN CAPITAL LETTER O WITH GRAVE */ + {"Omacr", 0x014C}, /* LATIN CAPITAL LETTER O WITH MACRON */ + {"Omega", 0x03A9}, /* GREEK CAPITAL LETTER OMEGA */ + {"Omicron", 0x039F}, /* GREEK CAPITAL LETTER OMICRON */ + {"Oslash", 0x00D8}, /* LATIN CAPITAL LETTER O WITH STROKE */ + {"Otilde", 0x00D5}, /* LATIN CAPITAL LETTER O WITH TILDE */ + {"Ouml", 0x00D6}, /* LATIN CAPITAL LETTER O WITH DIAERESIS */ + {"PHgr", 0x03A6}, /* GREEK CAPITAL LETTER PHI */ + {"PSgr", 0x03A8}, /* GREEK CAPITAL LETTER PSI */ + {"Pcy", 0x041F}, /* CYRILLIC CAPITAL LETTER PE */ + {"Pgr", 0x03A0}, /* GREEK CAPITAL LETTER PI */ + {"Phi", 0x03A6}, /* GREEK CAPITAL LETTER PHI */ + {"Pi", 0x03A0}, /* GREEK CAPITAL LETTER PI */ + {"Prime", 0x2033}, /* DOUBLE PRIME */ + {"Psi", 0x03A8}, /* GREEK CAPITAL LETTER PSI */ + {"Racute", 0x0154}, /* LATIN CAPITAL LETTER R WITH ACUTE */ + {"Rarr", 0x21A0}, /* RIGHTWARDS TWO HEADED ARROW */ + {"Rcaron", 0x0158}, /* LATIN CAPITAL LETTER R WITH CARON */ + {"Rcedil", 0x0156}, /* LATIN CAPITAL LETTER R WITH CEDILLA */ + {"Rcy", 0x0420}, /* CYRILLIC CAPITAL LETTER ER */ + {"Rgr", 0x03A1}, /* GREEK CAPITAL LETTER RHO */ + {"Rho", 0x03A1}, /* GREEK CAPITAL LETTER RHO */ + {"SHCHcy", 0x0429}, /* CYRILLIC CAPITAL LETTER SHCHA */ + {"SHcy", 0x0428}, /* CYRILLIC CAPITAL LETTER SHA */ + {"SOFTcy", 0x042C}, /* CYRILLIC CAPITAL LETTER SOFT SIGN */ + {"Sacute", 0x015A}, /* LATIN CAPITAL LETTER S WITH ACUTE */ + {"Scaron", 0x0160}, /* LATIN CAPITAL LETTER S WITH CARON */ + {"Scedil", 0x015E}, /* LATIN CAPITAL LETTER S WITH CEDILLA */ + {"Scirc", 0x015C}, /* LATIN CAPITAL LETTER S WITH CIRCUMFLEX */ + {"Scy", 0x0421}, /* CYRILLIC CAPITAL LETTER ES */ + {"Sgr", 0x03A3}, /* GREEK CAPITAL LETTER SIGMA */ + {"Sigma", 0x03A3}, /* GREEK CAPITAL LETTER SIGMA */ + {"Sub", 0x22D0}, /* DOUBLE SUBSET */ + {"Sup", 0x22D1}, /* DOUBLE SUPERSET */ + {"THORN", 0x00DE}, /* LATIN CAPITAL LETTER THORN */ + {"THgr", 0x0398}, /* GREEK CAPITAL LETTER THETA */ + {"TSHcy", 0x040B}, /* CYRILLIC CAPITAL LETTER TSHE */ + {"TScy", 0x0426}, /* CYRILLIC CAPITAL LETTER TSE */ + {"Tau", 0x03A4}, /* GREEK CAPITAL LETTER TAU */ + {"Tcaron", 0x0164}, /* LATIN CAPITAL LETTER T WITH CARON */ + {"Tcedil", 0x0162}, /* LATIN CAPITAL LETTER T WITH CEDILLA */ + {"Tcy", 0x0422}, /* CYRILLIC CAPITAL LETTER TE */ + {"Tgr", 0x03A4}, /* GREEK CAPITAL LETTER TAU */ + {"Theta", 0x0398}, /* GREEK CAPITAL LETTER THETA */ + {"Tstrok", 0x0166}, /* LATIN CAPITAL LETTER T WITH STROKE */ + {"Uacgr", 0x038E}, /* GREEK CAPITAL LETTER UPSILON WITH TONOS */ + {"Uacute", 0x00DA}, /* LATIN CAPITAL LETTER U WITH ACUTE */ + {"Ubrcy", 0x040E}, /* CYRILLIC CAPITAL LETTER SHORT U */ + {"Ubreve", 0x016C}, /* LATIN CAPITAL LETTER U WITH BREVE */ + {"Ucirc", 0x00DB}, /* LATIN CAPITAL LETTER U WITH CIRCUMFLEX */ + {"Ucy", 0x0423}, /* CYRILLIC CAPITAL LETTER U */ + {"Udblac", 0x0170}, /* LATIN CAPITAL LETTER U WITH DOUBLE ACUTE */ + {"Udigr", 0x03AB}, /* GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA */ + {"Ugr", 0x03A5}, /* GREEK CAPITAL LETTER UPSILON */ + {"Ugrave", 0x00D9}, /* LATIN CAPITAL LETTER U WITH GRAVE */ + {"Umacr", 0x016A}, /* LATIN CAPITAL LETTER U WITH MACRON */ + {"Uogon", 0x0172}, /* LATIN CAPITAL LETTER U WITH OGONEK */ + {"Upsi", 0x03A5}, /* GREEK CAPITAL LETTER UPSILON */ + {"Upsilon", 0x03A5}, /* GREEK CAPITAL LETTER UPSILON */ + {"Uring", 0x016E}, /* LATIN CAPITAL LETTER U WITH RING ABOVE */ + {"Utilde", 0x0168}, /* LATIN CAPITAL LETTER U WITH TILDE */ + {"Uuml", 0x00DC}, /* LATIN CAPITAL LETTER U WITH DIAERESIS */ + {"Vcy", 0x0412}, /* CYRILLIC CAPITAL LETTER VE */ + {"Vdash", 0x22A9}, /* FORCES */ + {"Verbar", 0x2016}, /* DOUBLE VERTICAL LINE */ + {"Vvdash", 0x22AA}, /* TRIPLE VERTICAL BAR RIGHT TURNSTILE */ + {"Wcirc", 0x0174}, /* LATIN CAPITAL LETTER W WITH CIRCUMFLEX */ + {"Xgr", 0x039E}, /* GREEK CAPITAL LETTER XI */ + {"Xi", 0x039E}, /* GREEK CAPITAL LETTER XI */ + {"YAcy", 0x042F}, /* CYRILLIC CAPITAL LETTER YA */ + {"YIcy", 0x0407}, /* CYRILLIC CAPITAL LETTER YI */ + {"YUcy", 0x042E}, /* CYRILLIC CAPITAL LETTER YU */ + {"Yacute", 0x00DD}, /* LATIN CAPITAL LETTER Y WITH ACUTE */ + {"Ycirc", 0x0176}, /* LATIN CAPITAL LETTER Y WITH CIRCUMFLEX */ + {"Ycy", 0x042B}, /* CYRILLIC CAPITAL LETTER YERU */ + {"Yuml", 0x0178}, /* LATIN CAPITAL LETTER Y WITH DIAERESIS */ + {"ZHcy", 0x0416}, /* CYRILLIC CAPITAL LETTER ZHE */ + {"Zacute", 0x0179}, /* LATIN CAPITAL LETTER Z WITH ACUTE */ + {"Zcaron", 0x017D}, /* LATIN CAPITAL LETTER Z WITH CARON */ + {"Zcy", 0x0417}, /* CYRILLIC CAPITAL LETTER ZE */ + {"Zdot", 0x017B}, /* LATIN CAPITAL LETTER Z WITH DOT ABOVE */ + {"Zeta", 0x0396}, /* GREEK CAPITAL LETTER ZETA */ + {"Zgr", 0x0396}, /* GREEK CAPITAL LETTER ZETA */ + {"aacgr", 0x03AC}, /* GREEK SMALL LETTER ALPHA WITH TONOS */ + {"aacute", 0x00E1}, /* LATIN SMALL LETTER A WITH ACUTE */ + {"abreve", 0x0103}, /* LATIN SMALL LETTER A WITH BREVE */ + {"acirc", 0x00E2}, /* LATIN SMALL LETTER A WITH CIRCUMFLEX */ + {"acute", 0x00B4}, /* ACUTE ACCENT */ + {"acy", 0x0430}, /* CYRILLIC SMALL LETTER A */ + {"aelig", 0x00E6}, /* LATIN SMALL LETTER AE */ + {"agr", 0x03B1}, /* GREEK SMALL LETTER ALPHA */ + {"agrave", 0x00E0}, /* LATIN SMALL LETTER A WITH GRAVE */ + {"alefsym", 0x2135}, /* ALEF SYMBOL */ + {"aleph", 0x2135}, /* ALEF SYMBOL */ + {"alpha", 0x03B1}, /* GREEK SMALL LETTER ALPHA */ + {"amacr", 0x0101}, /* LATIN SMALL LETTER A WITH MACRON */ + {"amalg", 0x2210}, /* N-ARY COPRODUCT */ + {"amp", 0x0026}, /* AMPERSAND */ + {"and", 0x2227}, /* LOGICAL AND */ + {"ang", 0x2220}, /* ANGLE */ + {"ang90", 0x221F}, /* RIGHT ANGLE */ + {"angmsd", 0x2221}, /* MEASURED ANGLE */ + {"angsph", 0x2222}, /* SPHERICAL ANGLE */ + {"angst", 0x212B}, /* ANGSTROM SIGN */ + {"aogon", 0x0105}, /* LATIN SMALL LETTER A WITH OGONEK */ + {"ap", 0x2248}, /* ALMOST EQUAL TO */ + {"ape", 0x224A}, /* ALMOST EQUAL OR EQUAL TO */ + {"apos", 0x02BC}, /* MODIFIER LETTER APOSTROPHE */ + {"aring", 0x00E5}, /* LATIN SMALL LETTER A WITH RING ABOVE */ + {"ast", 0x002A}, /* ASTERISK */ + {"asymp", 0x2248}, /* ALMOST EQUAL TO */ + {"atilde", 0x00E3}, /* LATIN SMALL LETTER A WITH TILDE */ + {"auml", 0x00E4}, /* LATIN SMALL LETTER A WITH DIAERESIS */ + {"b.Delta", 0x0394}, /* GREEK CAPITAL LETTER DELTA */ + {"b.Gamma", 0x0393}, /* GREEK CAPITAL LETTER GAMMA */ + {"b.Lambda", 0x039B}, /* GREEK CAPITAL LETTER LAMDA */ + {"b.Omega", 0x03A9}, /* GREEK CAPITAL LETTER OMEGA */ + {"b.Phi", 0x03A6}, /* GREEK CAPITAL LETTER PHI */ + {"b.Pi", 0x03A0}, /* GREEK CAPITAL LETTER PI */ + {"b.Psi", 0x03A8}, /* GREEK CAPITAL LETTER PSI */ + {"b.Sigma", 0x03A3}, /* GREEK CAPITAL LETTER SIGMA */ + {"b.Theta", 0x0398}, /* GREEK CAPITAL LETTER THETA */ + {"b.Upsi", 0x03A5}, /* GREEK CAPITAL LETTER UPSILON */ + {"b.Xi", 0x039E}, /* GREEK CAPITAL LETTER XI */ + {"b.alpha", 0x03B1}, /* GREEK SMALL LETTER ALPHA */ + {"b.beta", 0x03B2}, /* GREEK SMALL LETTER BETA */ + {"b.chi", 0x03C7}, /* GREEK SMALL LETTER CHI */ + {"b.delta", 0x03B3}, /* GREEK SMALL LETTER GAMMA */ + {"b.epsi", 0x03B5}, /* GREEK SMALL LETTER EPSILON */ + {"b.epsis", 0x03B5}, /* GREEK SMALL LETTER EPSILON */ + {"b.epsiv", 0x03B5}, /* GREEK SMALL LETTER EPSILON */ + {"b.eta", 0x03B7}, /* GREEK SMALL LETTER ETA */ + {"b.gamma", 0x03B3}, /* GREEK SMALL LETTER GAMMA */ + {"b.gammad", 0x03DC}, /* GREEK LETTER DIGAMMA */ + {"b.iota", 0x03B9}, /* GREEK SMALL LETTER IOTA */ + {"b.kappa", 0x03BA}, /* GREEK SMALL LETTER KAPPA */ + {"b.kappav", 0x03F0}, /* GREEK KAPPA SYMBOL */ + {"b.lambda", 0x03BB}, /* GREEK SMALL LETTER LAMDA */ + {"b.mu", 0x03BC}, /* GREEK SMALL LETTER MU */ + {"b.nu", 0x03BD}, /* GREEK SMALL LETTER NU */ + {"b.omega", 0x03CE}, /* GREEK SMALL LETTER OMEGA WITH TONOS */ + {"b.phis", 0x03C6}, /* GREEK SMALL LETTER PHI */ + {"b.phiv", 0x03D5}, /* GREEK PHI SYMBOL */ + {"b.pi", 0x03C0}, /* GREEK SMALL LETTER PI */ + {"b.piv", 0x03D6}, /* GREEK PI SYMBOL */ + {"b.psi", 0x03C8}, /* GREEK SMALL LETTER PSI */ + {"b.rho", 0x03C1}, /* GREEK SMALL LETTER RHO */ + {"b.rhov", 0x03F1}, /* GREEK RHO SYMBOL */ + {"b.sigma", 0x03C3}, /* GREEK SMALL LETTER SIGMA */ + {"b.sigmav", 0x03C2}, /* GREEK SMALL LETTER FINAL SIGMA */ + {"b.tau", 0x03C4}, /* GREEK SMALL LETTER TAU */ + {"b.thetas", 0x03B8}, /* GREEK SMALL LETTER THETA */ + {"b.thetav", 0x03D1}, /* GREEK THETA SYMBOL */ + {"b.upsi", 0x03C5}, /* GREEK SMALL LETTER UPSILON */ + {"b.xi", 0x03BE}, /* GREEK SMALL LETTER XI */ + {"b.zeta", 0x03B6}, /* GREEK SMALL LETTER ZETA */ + {"barwed", 0x22BC}, /* NAND */ + {"bcong", 0x224C}, /* ALL EQUAL TO */ + {"bcy", 0x0431}, /* CYRILLIC SMALL LETTER BE */ + {"bdquo", 0x201E}, /* DOUBLE LOW-9 QUOTATION MARK */ + {"becaus", 0x2235}, /* BECAUSE */ + {"bepsi", 0x220D}, /* SMALL CONTAINS AS MEMBER */ + {"bernou", 0x212C}, /* SCRIPT CAPITAL B */ + {"beta", 0x03B2}, /* GREEK SMALL LETTER BETA */ + {"beth", 0x2136}, /* BET SYMBOL */ + {"bgr", 0x03B2}, /* GREEK SMALL LETTER BETA */ + {"blank", 0x2423}, /* OPEN BOX */ + {"blk12", 0x2592}, /* MEDIUM SHADE */ + {"blk14", 0x2591}, /* LIGHT SHADE */ + {"blk34", 0x2593}, /* DARK SHADE */ + {"block", 0x2588}, /* FULL BLOCK */ + {"bottom", 0x22A5}, /* UP TACK */ + {"bowtie", 0x22C8}, /* BOWTIE */ + {"boxDL", 0x2557}, /* BOX DRAWINGS DOUBLE DOWN AND LEFT */ + {"boxDR", 0x2554}, /* BOX DRAWINGS DOUBLE DOWN AND RIGHT */ + {"boxDl", 0x2556}, /* BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE */ + {"boxDr", 0x2553}, /* BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE */ + {"boxH", 0x2550}, /* BOX DRAWINGS DOUBLE HORIZONTAL */ + {"boxHD", 0x2566}, /* BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL */ + {"boxHU", 0x2569}, /* BOX DRAWINGS DOUBLE UP AND HORIZONTAL */ + {"boxHd", 0x2564}, /* BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE*/ + {"boxHu", 0x2567}, /* BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE */ + {"boxUL", 0x255D}, /* BOX DRAWINGS DOUBLE UP AND LEFT */ + {"boxUR", 0x255A}, /* BOX DRAWINGS DOUBLE UP AND RIGHT */ + {"boxUl", 0x255C}, /* BOX DRAWINGS UP DOUBLE AND LEFT SINGLE */ + {"boxUr", 0x2559}, /* BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE */ + {"boxV", 0x2551}, /* BOX DRAWINGS DOUBLE VERTICAL */ + {"boxVH", 0x256C}, /* BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL */ + {"boxVL", 0x2563}, /* BOX DRAWINGS DOUBLE VERTICAL AND LEFT */ + {"boxVR", 0x2560}, /* BOX DRAWINGS DOUBLE VERTICAL AND RIGHT */ + {"boxVh", 0x256B}, /* BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SI*/ + {"boxVl", 0x2562}, /* BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE */ + {"boxVr", 0x255F}, /* BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE */ + {"boxdL", 0x2555}, /* BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE */ + {"boxdR", 0x2552}, /* BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE */ + {"boxdl", 0x2510}, /* BOX DRAWINGS LIGHT DOWN AND LEFT */ + {"boxdr", 0x250C}, /* BOX DRAWINGS LIGHT DOWN AND RIGHT */ + {"boxh", 0x2500}, /* BOX DRAWINGS LIGHT HORIZONTAL */ + {"boxhD", 0x2565}, /* BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE*/ + {"boxhU", 0x2568}, /* BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE */ + {"boxhd", 0x252C}, /* BOX DRAWINGS LIGHT DOWN AND HORIZONTAL */ + {"boxhu", 0x2534}, /* BOX DRAWINGS LIGHT UP AND HORIZONTAL */ + {"boxuL", 0x255B}, /* BOX DRAWINGS UP SINGLE AND LEFT DOUBLE */ + {"boxuR", 0x2558}, /* BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE */ + {"boxul", 0x2518}, /* BOX DRAWINGS LIGHT UP AND LEFT */ + {"boxur", 0x2514}, /* BOX DRAWINGS LIGHT UP AND RIGHT */ + {"boxv", 0x2502}, /* BOX DRAWINGS LIGHT VERTICAL */ + {"boxvH", 0x256A}, /* BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DO*/ + {"boxvL", 0x2561}, /* BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE */ + {"boxvR", 0x255E}, /* BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE */ + {"boxvh", 0x253C}, /* BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL */ + {"boxvl", 0x2524}, /* BOX DRAWINGS LIGHT VERTICAL AND LEFT */ + {"boxvr", 0x251C}, /* BOX DRAWINGS LIGHT VERTICAL AND RIGHT */ + {"bprime", 0x2035}, /* REVERSED PRIME */ + {"breve", 0x02D8}, /* BREVE */ + {"brkbar", 0x00A6}, /* obsolete synonym for "brvbar" 0x00A6 */ + {"brvbar", 0x00A6}, /* BROKEN BAR */ + {"bsim", 0x223D}, /* REVERSED TILDE */ + {"bsime", 0x22CD}, /* REVERSED TILDE EQUALS */ + {"bsol", 0x005C}, /* REVERSE SOLIDUS */ + {"bull", 0x2022}, /* BULLET */ + {"bump", 0x224E}, /* GEOMETRICALLY EQUIVALENT TO */ + {"bumpe", 0x224F}, /* DIFFERENCE BETWEEN */ + {"cacute", 0x0107}, /* LATIN SMALL LETTER C WITH ACUTE */ + {"cap", 0x2229}, /* INTERSECTION */ + {"caret", 0x2041}, /* CARET INSERTION POINT */ + {"caron", 0x02C7}, /* CARON */ + {"ccaron", 0x010D}, /* LATIN SMALL LETTER C WITH CARON */ + {"ccedil", 0x00E7}, /* LATIN SMALL LETTER C WITH CEDILLA */ + {"ccirc", 0x0109}, /* LATIN SMALL LETTER C WITH CIRCUMFLEX */ + {"cdot", 0x010B}, /* LATIN SMALL LETTER C WITH DOT ABOVE */ + {"cedil", 0x00B8}, /* CEDILLA */ + {"cent", 0x00A2}, /* CENT SIGN */ + {"chcy", 0x0447}, /* CYRILLIC SMALL LETTER CHE */ + {"check", 0x2713}, /* CHECK MARK */ + {"chi", 0x03C7}, /* GREEK SMALL LETTER CHI */ + {"cir", 0x25CB}, /* WHITE CIRCLE */ + {"circ", 0x02C6}, /* MODIFIER LETTER CIRCUMFLEX ACCENT */ + {"cire", 0x2257}, /* RING EQUAL TO */ + {"clubs", 0x2663}, /* BLACK CLUB SUIT */ + {"colon", 0x003A}, /* COLON */ + {"colone", 0x2254}, /* COLON EQUALS */ + {"comma", 0x002C}, /* COMMA */ + {"commat", 0x0040}, /* COMMERCIAL AT */ + {"comp", 0x2201}, /* COMPLEMENT */ + {"compfn", 0x2218}, /* RING OPERATOR */ + {"cong", 0x2245}, /* APPROXIMATELY EQUAL TO */ + {"conint", 0x222E}, /* CONTOUR INTEGRAL */ + {"coprod", 0x2210}, /* N-ARY COPRODUCT */ + {"copy", 0x00A9}, /* COPYRIGHT SIGN */ + {"copysr", 0x2117}, /* SOUND RECORDING COPYRIGHT */ + {"crarr", 0x21B5}, /* DOWNWARDS ARROW WITH CORNER LEFTWARDS */ + {"cross", 0x2717}, /* BALLOT X */ + {"cuepr", 0x22DE}, /* EQUAL TO OR PRECEDES */ + {"cuesc", 0x22DF}, /* EQUAL TO OR SUCCEEDS */ + {"cularr", 0x21B6}, /* ANTICLOCKWISE TOP SEMICIRCLE ARROW */ + {"cup", 0x222A}, /* UNION */ + {"cupre", 0x227C}, /* PRECEDES OR EQUAL TO */ + {"curarr", 0x21B7}, /* CLOCKWISE TOP SEMICIRCLE ARROW */ + {"curren", 0x00A4}, /* CURRENCY SIGN */ + {"cuvee", 0x22CE}, /* CURLY LOGICAL OR */ + {"cuwed", 0x22CF}, /* CURLY LOGICAL AND */ + {"dArr", 0x21D3}, /* DOWNWARDS DOUBLE ARROW */ + {"dagger", 0x2020}, /* DAGGER */ + {"daleth", 0x2138}, /* DALET SYMBOL */ + {"darr", 0x2193}, /* DOWNWARDS ARROW */ + {"darr2", 0x21CA}, /* DOWNWARDS PAIRED ARROWS */ + {"dash", 0x2010}, /* HYPHEN */ + {"dashv", 0x22A3}, /* LEFT TACK */ + {"dblac", 0x02DD}, /* DOUBLE ACUTE ACCENT */ + {"dcaron", 0x010F}, /* LATIN SMALL LETTER D WITH CARON */ + {"dcy", 0x0434}, /* CYRILLIC SMALL LETTER DE */ + {"deg", 0x00B0}, /* DEGREE SIGN */ + {"delta", 0x03B4}, /* GREEK SMALL LETTER DELTA */ + {"dgr", 0x03B4}, /* GREEK SMALL LETTER DELTA */ + {"dharl", 0x21C3}, /* DOWNWARDS HARPOON WITH BARB LEFTWARDS */ + {"dharr", 0x21C2}, /* DOWNWARDS HARPOON WITH BARB RIGHTWARDS */ + {"diam", 0x22C4}, /* DIAMOND OPERATOR */ + {"diams", 0x2666}, /* BLACK DIAMOND SUIT */ + {"die", 0x00A8}, /* DIAERESIS */ + {"divide", 0x00F7}, /* DIVISION SIGN */ + {"divonx", 0x22C7}, /* DIVISION TIMES */ + {"djcy", 0x0452}, /* CYRILLIC SMALL LETTER DJE */ + {"dlarr", 0x2199}, /* SOUTH WEST ARROW */ + {"dlcorn", 0x231E}, /* BOTTOM LEFT CORNER */ + {"dlcrop", 0x230D}, /* BOTTOM LEFT CROP */ + {"dollar", 0x0024}, /* DOLLAR SIGN */ + {"dot", 0x02D9}, /* DOT ABOVE */ + {"drarr", 0x2198}, /* SOUTH EAST ARROW */ + {"drcorn", 0x231F}, /* BOTTOM RIGHT CORNER */ + {"drcrop", 0x230C}, /* BOTTOM RIGHT CROP */ + {"dscy", 0x0455}, /* CYRILLIC SMALL LETTER DZE */ + {"dstrok", 0x0111}, /* LATIN SMALL LETTER D WITH STROKE */ + {"dtri", 0x25BF}, /* WHITE DOWN-POINTING SMALL TRIANGLE */ + {"dtrif", 0x25BE}, /* BLACK DOWN-POINTING SMALL TRIANGLE */ + {"dzcy", 0x045F}, /* CYRILLIC SMALL LETTER DZHE */ + {"eDot", 0x2251}, /* GEOMETRICALLY EQUAL TO */ + {"eacgr", 0x03AD}, /* GREEK SMALL LETTER EPSILON WITH TONOS */ + {"eacute", 0x00E9}, /* LATIN SMALL LETTER E WITH ACUTE */ + {"ecaron", 0x011B}, /* LATIN SMALL LETTER E WITH CARON */ + {"ecir", 0x2256}, /* RING IN EQUAL TO */ + {"ecirc", 0x00EA}, /* LATIN SMALL LETTER E WITH CIRCUMFLEX */ + {"ecolon", 0x2255}, /* EQUALS COLON */ + {"ecy", 0x044D}, /* CYRILLIC SMALL LETTER E */ + {"edot", 0x0117}, /* LATIN SMALL LETTER E WITH DOT ABOVE */ + {"eeacgr", 0x03AE}, /* GREEK SMALL LETTER ETA WITH TONOS */ + {"eegr", 0x03B7}, /* GREEK SMALL LETTER ETA */ + {"efDot", 0x2252}, /* APPROXIMATELY EQUAL TO OR THE IMAGE OF */ + {"egr", 0x03B5}, /* GREEK SMALL LETTER EPSILON */ + {"egrave", 0x00E8}, /* LATIN SMALL LETTER E WITH GRAVE */ + {"egs", 0x22DD}, /* EQUAL TO OR GREATER-THAN */ + {"ell", 0x2113}, /* SCRIPT SMALL L */ + {"els", 0x22DC}, /* EQUAL TO OR LESS-THAN */ + {"emacr", 0x0113}, /* LATIN SMALL LETTER E WITH MACRON */ + {"emdash", 0x2014}, /* obsolete synonym for "mdash" 0x2014 */ + {"empty", 0x2205}, /* EMPTY SET */ + {"emsp", 0x2003}, /* EM SPACE */ + {"emsp13", 0x2004}, /* THREE-PER-EM SPACE */ + {"emsp14", 0x2005}, /* FOUR-PER-EM SPACE */ + {"endash", 0x2013}, /* obsolete synonym for "ndash" 0x2013 */ + {"eng", 0x014B}, /* LATIN SMALL LETTER ENG */ + {"ensp", 0x2002}, /* EN SPACE */ + {"eogon", 0x0119}, /* LATIN SMALL LETTER E WITH OGONEK */ + {"epsi", 0x03B5}, /* GREEK SMALL LETTER EPSILON */ + {"epsilon", 0x03B5}, /* GREEK SMALL LETTER EPSILON */ + {"epsis", 0x220A}, /* SMALL ELEMENT OF */ + {"equals", 0x003D}, /* EQUALS SIGN */ + {"equiv", 0x2261}, /* IDENTICAL TO */ + {"erDot", 0x2253}, /* IMAGE OF OR APPROXIMATELY EQUAL TO */ + {"esdot", 0x2250}, /* APPROACHES THE LIMIT */ + {"eta", 0x03B7}, /* GREEK SMALL LETTER ETA */ + {"eth", 0x00F0}, /* LATIN SMALL LETTER ETH */ + {"euml", 0x00EB}, /* LATIN SMALL LETTER E WITH DIAERESIS */ + {"excl", 0x0021}, /* EXCLAMATION MARK */ + {"exist", 0x2203}, /* THERE EXISTS */ + {"fcy", 0x0444}, /* CYRILLIC SMALL LETTER EF */ + {"female", 0x2640}, /* FEMALE SIGN */ + {"ffilig", 0xFB03}, /* LATIN SMALL LIGATURE FFI */ + {"fflig", 0xFB00}, /* LATIN SMALL LIGATURE FF */ + {"ffllig", 0xFB04}, /* LATIN SMALL LIGATURE FFL */ + {"filig", 0xFB01}, /* LATIN SMALL LIGATURE FI */ + {"flat", 0x266D}, /* MUSIC FLAT SIGN */ + {"fllig", 0xFB02}, /* LATIN SMALL LIGATURE FL */ + {"fnof", 0x0192}, /* LATIN SMALL LETTER F WITH HOOK */ + {"forall", 0x2200}, /* FOR ALL */ + {"fork", 0x22D4}, /* PITCHFORK */ + {"frac12", 0x00BD}, /* VULGAR FRACTION ONE HALF */ + {"frac13", 0x2153}, /* VULGAR FRACTION ONE THIRD */ + {"frac14", 0x00BC}, /* VULGAR FRACTION ONE QUARTER */ + {"frac15", 0x2155}, /* VULGAR FRACTION ONE FIFTH */ + {"frac16", 0x2159}, /* VULGAR FRACTION ONE SIXTH */ + {"frac18", 0x215B}, /* VULGAR FRACTION ONE EIGHTH */ + {"frac23", 0x2154}, /* VULGAR FRACTION TWO THIRDS */ + {"frac25", 0x2156}, /* VULGAR FRACTION TWO FIFTHS */ + {"frac34", 0x00BE}, /* VULGAR FRACTION THREE QUARTERS */ + {"frac35", 0x2157}, /* VULGAR FRACTION THREE FIFTHS */ + {"frac38", 0x215C}, /* VULGAR FRACTION THREE EIGHTHS */ + {"frac45", 0x2158}, /* VULGAR FRACTION FOUR FIFTHS */ + {"frac56", 0x215A}, /* VULGAR FRACTION FIVE SIXTHS */ + {"frac58", 0x215D}, /* VULGAR FRACTION FIVE EIGHTHS */ + {"frac78", 0x215E}, /* VULGAR FRACTION SEVEN EIGHTHS */ + {"frasl", 0x2044}, /* FRACTION SLASH */ + {"frown", 0x2322}, /* FROWN */ + {"gE", 0x2267}, /* GREATER-THAN OVER EQUAL TO */ + {"gacute", 0x01F5}, /* LATIN SMALL LETTER G WITH ACUTE */ + {"gamma", 0x03B3}, /* GREEK SMALL LETTER GAMMA */ + {"gammad", 0x03DC}, /* GREEK LETTER DIGAMMA */ + {"gbreve", 0x011F}, /* LATIN SMALL LETTER G WITH BREVE */ + {"gcedil", 0x0123}, /* LATIN SMALL LETTER G WITH CEDILLA */ + {"gcirc", 0x011D}, /* LATIN SMALL LETTER G WITH CIRCUMFLEX */ + {"gcy", 0x0433}, /* CYRILLIC SMALL LETTER GHE */ + {"gdot", 0x0121}, /* LATIN SMALL LETTER G WITH DOT ABOVE */ + {"ge", 0x2265}, /* GREATER-THAN OR EQUAL TO */ + {"gel", 0x22DB}, /* GREATER-THAN EQUAL TO OR LESS-THAN */ + {"ges", 0x2265}, /* GREATER-THAN OR EQUAL TO */ + {"ggr", 0x03B3}, /* GREEK SMALL LETTER GAMMA */ + {"gimel", 0x2137}, /* GIMEL SYMBOL */ + {"gjcy", 0x0453}, /* CYRILLIC SMALL LETTER GJE */ + {"gl", 0x2277}, /* GREATER-THAN OR LESS-THAN */ + {"gnE", 0x2269}, /* GREATER-THAN BUT NOT EQUAL TO */ + {"gne", 0x2269}, /* GREATER-THAN BUT NOT EQUAL TO */ + {"gnsim", 0x22E7}, /* GREATER-THAN BUT NOT EQUIVALENT TO */ + {"grave", 0x0060}, /* GRAVE ACCENT */ + {"gsdot", 0x22D7}, /* GREATER-THAN WITH DOT */ + {"gsim", 0x2273}, /* GREATER-THAN OR EQUIVALENT TO */ + {"gt", 0x003E}, /* GREATER-THAN SIGN */ + {"gvnE", 0x2269}, /* GREATER-THAN BUT NOT EQUAL TO */ + {"hArr", 0x21D4}, /* LEFT RIGHT DOUBLE ARROW */ + {"hairsp", 0x200A}, /* HAIR SPACE */ + {"half", 0x00BD}, /* VULGAR FRACTION ONE HALF */ + {"hamilt", 0x210B}, /* SCRIPT CAPITAL H */ + {"hardcy", 0x044A}, /* CYRILLIC SMALL LETTER HARD SIGN */ + {"harr", 0x2194}, /* LEFT RIGHT ARROW */ + {"harrw", 0x21AD}, /* LEFT RIGHT WAVE ARROW */ + {"hcirc", 0x0125}, /* LATIN SMALL LETTER H WITH CIRCUMFLEX */ + {"hearts", 0x2665}, /* BLACK HEART SUIT */ + {"hellip", 0x2026}, /* HORIZONTAL ELLIPSIS */ + {"hibar", 0x00AF}, /* obsolete synonym for "macr" 0x00AF */ + {"horbar", 0x2015}, /* HORIZONTAL BAR */ + {"hstrok", 0x0127}, /* LATIN SMALL LETTER H WITH STROKE */ + {"hybull", 0x2043}, /* HYPHEN BULLET */ + {"hyphen", 0x002D}, /* HYPHEN-MINUS */ + {"iacgr", 0x03AF}, /* GREEK SMALL LETTER IOTA WITH TONOS */ + {"iacute", 0x00ED}, /* LATIN SMALL LETTER I WITH ACUTE */ + {"icirc", 0x00EE}, /* LATIN SMALL LETTER I WITH CIRCUMFLEX */ + {"icy", 0x0438}, /* CYRILLIC SMALL LETTER I */ + {"idiagr", 0x0390}, /* GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TON*/ + {"idigr", 0x03CA}, /* GREEK SMALL LETTER IOTA WITH DIALYTIKA */ + {"iecy", 0x0435}, /* CYRILLIC SMALL LETTER IE */ + {"iexcl", 0x00A1}, /* INVERTED EXCLAMATION MARK */ + {"iff", 0x21D4}, /* LEFT RIGHT DOUBLE ARROW */ + {"igr", 0x03B9}, /* GREEK SMALL LETTER IOTA */ + {"igrave", 0x00EC}, /* LATIN SMALL LETTER I WITH GRAVE */ + {"ijlig", 0x0133}, /* LATIN SMALL LIGATURE IJ */ + {"imacr", 0x012B}, /* LATIN SMALL LETTER I WITH MACRON */ + {"image", 0x2111}, /* BLACK-LETTER CAPITAL I */ + {"incare", 0x2105}, /* CARE OF */ + {"infin", 0x221E}, /* INFINITY */ + {"inodot", 0x0131}, /* LATIN SMALL LETTER DOTLESS I */ + {"int", 0x222B}, /* INTEGRAL */ + {"intcal", 0x22BA}, /* INTERCALATE */ + {"iocy", 0x0451}, /* CYRILLIC SMALL LETTER IO */ + {"iogon", 0x012F}, /* LATIN SMALL LETTER I WITH OGONEK */ + {"iota", 0x03B9}, /* GREEK SMALL LETTER IOTA */ + {"iquest", 0x00BF}, /* INVERTED QUESTION MARK */ + {"isin", 0x2208}, /* ELEMENT OF */ + {"itilde", 0x0129}, /* LATIN SMALL LETTER I WITH TILDE */ + {"iukcy", 0x0456}, /* CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I*/ + {"iuml", 0x00EF}, /* LATIN SMALL LETTER I WITH DIAERESIS */ + {"jcirc", 0x0135}, /* LATIN SMALL LETTER J WITH CIRCUMFLEX */ + {"jcy", 0x0439}, /* CYRILLIC SMALL LETTER SHORT I */ + {"jsercy", 0x0458}, /* CYRILLIC SMALL LETTER JE */ + {"jukcy", 0x0454}, /* CYRILLIC SMALL LETTER UKRAINIAN IE */ + {"kappa", 0x03BA}, /* GREEK SMALL LETTER KAPPA */ + {"kappav", 0x03F0}, /* GREEK KAPPA SYMBOL */ + {"kcedil", 0x0137}, /* LATIN SMALL LETTER K WITH CEDILLA */ + {"kcy", 0x043A}, /* CYRILLIC SMALL LETTER KA */ + {"kgr", 0x03BA}, /* GREEK SMALL LETTER KAPPA */ + {"kgreen", 0x0138}, /* LATIN SMALL LETTER KRA */ + {"khcy", 0x0445}, /* CYRILLIC SMALL LETTER HA */ + {"khgr", 0x03C7}, /* GREEK SMALL LETTER CHI */ + {"kjcy", 0x045C}, /* CYRILLIC SMALL LETTER KJE */ + {"lAarr", 0x21DA}, /* LEFTWARDS TRIPLE ARROW */ + {"lArr", 0x21D0}, /* LEFTWARDS DOUBLE ARROW */ + {"lE", 0x2266}, /* LESS-THAN OVER EQUAL TO */ + {"lacute", 0x013A}, /* LATIN SMALL LETTER L WITH ACUTE */ + {"lagran", 0x2112}, /* SCRIPT CAPITAL L */ + {"lambda", 0x03BB}, /* GREEK SMALL LETTER LAMDA */ + {"lang", 0x2329}, /* LEFT-POINTING ANGLE BRACKET */ + {"laquo", 0x00AB}, /* LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */ + {"larr", 0x2190}, /* LEFTWARDS ARROW */ + {"larr2", 0x21C7}, /* LEFTWARDS PAIRED ARROWS */ + {"larrhk", 0x21A9}, /* LEFTWARDS ARROW WITH HOOK */ + {"larrlp", 0x21AB}, /* LEFTWARDS ARROW WITH LOOP */ + {"larrtl", 0x21A2}, /* LEFTWARDS ARROW WITH TAIL */ + {"lcaron", 0x013E}, /* LATIN SMALL LETTER L WITH CARON */ + {"lcedil", 0x013C}, /* LATIN SMALL LETTER L WITH CEDILLA */ + {"lceil", 0x2308}, /* LEFT CEILING */ + {"lcub", 0x007B}, /* LEFT CURLY BRACKET */ + {"lcy", 0x043B}, /* CYRILLIC SMALL LETTER EL */ + {"ldot", 0x22D6}, /* LESS-THAN WITH DOT */ + {"ldquo", 0x201C}, /* LEFT DOUBLE QUOTATION MARK */ + {"ldquor", 0x201E}, /* DOUBLE LOW-9 QUOTATION MARK */ + {"le", 0x2264}, /* LESS-THAN OR EQUAL TO */ + {"leg", 0x22DA}, /* LESS-THAN EQUAL TO OR GREATER-THAN */ + {"les", 0x2264}, /* LESS-THAN OR EQUAL TO */ + {"lfloor", 0x230A}, /* LEFT FLOOR */ + {"lg", 0x2276}, /* LESS-THAN OR GREATER-THAN */ + {"lgr", 0x03BB}, /* GREEK SMALL LETTER LAMDA */ + {"lhard", 0x21BD}, /* LEFTWARDS HARPOON WITH BARB DOWNWARDS */ + {"lharu", 0x21BC}, /* LEFTWARDS HARPOON WITH BARB UPWARDS */ + {"lhblk", 0x2584}, /* LOWER HALF BLOCK */ + {"ljcy", 0x0459}, /* CYRILLIC SMALL LETTER LJE */ + {"lmidot", 0x0140}, /* LATIN SMALL LETTER L WITH MIDDLE DOT */ + {"lnE", 0x2268}, /* LESS-THAN BUT NOT EQUAL TO */ + {"lne", 0x2268}, /* LESS-THAN BUT NOT EQUAL TO */ + {"lnsim", 0x22E6}, /* LESS-THAN BUT NOT EQUIVALENT TO */ + {"lowast", 0x2217}, /* ASTERISK OPERATOR */ + {"lowbar", 0x005F}, /* LOW LINE */ + {"loz", 0x25CA}, /* LOZENGE */ + {"loz", 0x2727}, /* WHITE FOUR POINTED STAR */ + {"lozf", 0x2726}, /* BLACK FOUR POINTED STAR */ + {"lpar", 0x0028}, /* LEFT PARENTHESIS */ + {"lrarr2", 0x21C6}, /* LEFTWARDS ARROW OVER RIGHTWARDS ARROW */ + {"lrhar2", 0x21CB}, /* LEFTWARDS HARPOON OVER RIGHTWARDS HARPOON */ + {"lrm", 0x200E}, /* LEFT-TO-RIGHT MARK */ + {"lsaquo", 0x2039}, /* SINGLE LEFT-POINTING ANGLE QUOTATION MARK */ + {"lsh", 0x21B0}, /* UPWARDS ARROW WITH TIP LEFTWARDS */ + {"lsim", 0x2272}, /* LESS-THAN OR EQUIVALENT TO */ + {"lsqb", 0x005B}, /* LEFT SQUARE BRACKET */ + {"lsquo", 0x2018}, /* LEFT SINGLE QUOTATION MARK */ + {"lsquor", 0x201A}, /* SINGLE LOW-9 QUOTATION MARK */ + {"lstrok", 0x0142}, /* LATIN SMALL LETTER L WITH STROKE */ + {"lt", 0x003C}, /* LESS-THAN SIGN */ + {"lthree", 0x22CB}, /* LEFT SEMIDIRECT PRODUCT */ + {"ltimes", 0x22C9}, /* LEFT NORMAL FACTOR SEMIDIRECT PRODUCT */ + {"ltri", 0x25C3}, /* WHITE LEFT-POINTING SMALL TRIANGLE */ + {"ltrie", 0x22B4}, /* NORMAL SUBGROUP OF OR EQUAL TO */ + {"ltrif", 0x25C2}, /* BLACK LEFT-POINTING SMALL TRIANGLE */ + {"lvnE", 0x2268}, /* LESS-THAN BUT NOT EQUAL TO */ + {"macr", 0x00AF}, /* MACRON */ + {"male", 0x2642}, /* MALE SIGN */ + {"malt", 0x2720}, /* MALTESE CROSS */ + {"map", 0x21A6}, /* RIGHTWARDS ARROW FROM BAR */ + {"marker", 0x25AE}, /* BLACK VERTICAL RECTANGLE */ + {"mcy", 0x043C}, /* CYRILLIC SMALL LETTER EM */ + {"mdash", 0x2014}, /* EM DASH */ + {"mgr", 0x03BC}, /* GREEK SMALL LETTER MU */ + {"micro", 0x00B5}, /* MICRO SIGN */ + {"mid", 0x2223}, /* DIVIDES */ + {"middot", 0x00B7}, /* MIDDLE DOT */ + {"minus", 0x2212}, /* MINUS SIGN */ + {"minusb", 0x229F}, /* SQUARED MINUS */ + {"mldr", 0x2026}, /* HORIZONTAL ELLIPSIS */ + {"mnplus", 0x2213}, /* MINUS-OR-PLUS SIGN */ + {"models", 0x22A7}, /* MODELS */ + {"mu", 0x03BC}, /* GREEK SMALL LETTER MU */ + {"mumap", 0x22B8}, /* MULTIMAP */ + {"nVDash", 0x22AF}, /* NEGATED DOUBLE VERTICAL BAR DOUBLE RIGHT TURNS*/ + {"nVdash", 0x22AE}, /* DOES NOT FORCE */ + {"nabla", 0x2207}, /* NABLA */ + {"nacute", 0x0144}, /* LATIN SMALL LETTER N WITH ACUTE */ + {"nap", 0x2249}, /* NOT ALMOST EQUAL TO */ + {"napos", 0x0149}, /* LATIN SMALL LETTER N PRECEDED BY APOSTROPHE */ + {"natur", 0x266E}, /* MUSIC NATURAL SIGN */ + {"nbsp", 0x00A0}, /* NO-BREAK SPACE */ + {"ncaron", 0x0148}, /* LATIN SMALL LETTER N WITH CARON */ + {"ncedil", 0x0146}, /* LATIN SMALL LETTER N WITH CEDILLA */ + {"ncong", 0x2247}, /* NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO */ + {"ncy", 0x043D}, /* CYRILLIC SMALL LETTER EN */ + {"ndash", 0x2013}, /* EN DASH */ + {"ne", 0x2260}, /* NOT EQUAL TO */ + {"nearr", 0x2197}, /* NORTH EAST ARROW */ + {"nequiv", 0x2262}, /* NOT IDENTICAL TO */ + {"nexist", 0x2204}, /* THERE DOES NOT EXIST */ + {"nge", 0x2271}, /* NEITHER GREATER-THAN NOR EQUAL TO */ + {"nges", 0x2271}, /* NEITHER GREATER-THAN NOR EQUAL TO */ + {"ngr", 0x03BD}, /* GREEK SMALL LETTER NU */ + {"ngt", 0x226F}, /* NOT GREATER-THAN */ + {"nhArr", 0x21CE}, /* LEFT RIGHT DOUBLE ARROW WITH STROKE */ + {"nharr", 0x21AE}, /* LEFT RIGHT ARROW WITH STROKE */ + {"ni", 0x220B}, /* CONTAINS AS MEMBER */ + {"njcy", 0x045A}, /* CYRILLIC SMALL LETTER NJE */ + {"nlArr", 0x21CD}, /* LEFTWARDS DOUBLE ARROW WITH STROKE */ + {"nlarr", 0x219A}, /* LEFTWARDS ARROW WITH STROKE */ + {"nldr", 0x2025}, /* TWO DOT LEADER */ + {"nle", 0x2270}, /* NEITHER LESS-THAN NOR EQUAL TO */ + {"nles", 0x2270}, /* NEITHER LESS-THAN NOR EQUAL TO */ + {"nlt", 0x226E}, /* NOT LESS-THAN */ + {"nltri", 0x22EA}, /* NOT NORMAL SUBGROUP OF */ + {"nltrie", 0x22EC}, /* NOT NORMAL SUBGROUP OF OR EQUAL TO */ + {"nmid", 0x2224}, /* DOES NOT DIVIDE */ + {"not", 0x00AC}, /* NOT SIGN */ + {"notin", 0x2209}, /* NOT AN ELEMENT OF */ + {"npar", 0x2226}, /* NOT PARALLEL TO */ + {"npr", 0x2280}, /* DOES NOT PRECEDE */ + {"npre", 0x22E0}, /* DOES NOT PRECEDE OR EQUAL */ + {"nrArr", 0x21CF}, /* RIGHTWARDS DOUBLE ARROW WITH STROKE */ + {"nrarr", 0x219B}, /* RIGHTWARDS ARROW WITH STROKE */ + {"nrtri", 0x22EB}, /* DOES NOT CONTAIN AS NORMAL SUBGROUP */ + {"nrtrie", 0x22ED}, /* DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL */ + {"nsc", 0x2281}, /* DOES NOT SUCCEED */ + {"nsce", 0x22E1}, /* DOES NOT SUCCEED OR EQUAL */ + {"nsim", 0x2241}, /* NOT TILDE */ + {"nsime", 0x2244}, /* NOT ASYMPTOTICALLY EQUAL TO */ + {"nspar", 0x2226}, /* NOT PARALLEL TO */ + {"nsub", 0x2284}, /* NOT A SUBSET OF */ + {"nsubE", 0x2288}, /* NEITHER A SUBSET OF NOR EQUAL TO */ + {"nsube", 0x2288}, /* NEITHER A SUBSET OF NOR EQUAL TO */ + {"nsup", 0x2285}, /* NOT A SUPERSET OF */ + {"nsupE", 0x2289}, /* NEITHER A SUPERSET OF NOR EQUAL TO */ + {"nsupe", 0x2289}, /* NEITHER A SUPERSET OF NOR EQUAL TO */ + {"ntilde", 0x00F1}, /* LATIN SMALL LETTER N WITH TILDE */ + {"nu", 0x03BD}, /* GREEK SMALL LETTER NU */ + {"num", 0x0023}, /* NUMBER SIGN */ + {"numero", 0x2116}, /* NUMERO SIGN */ + {"numsp", 0x2007}, /* FIGURE SPACE */ + {"nvDash", 0x22AD}, /* NOT TRUE */ + {"nvdash", 0x22AC}, /* DOES NOT PROVE */ + {"nwarr", 0x2196}, /* NORTH WEST ARROW */ + {"oS", 0x24C8}, /* CIRCLED LATIN CAPITAL LETTER S */ + {"oacgr", 0x03CC}, /* GREEK SMALL LETTER OMICRON WITH TONOS */ + {"oacute", 0x00F3}, /* LATIN SMALL LETTER O WITH ACUTE */ + {"oast", 0x229B}, /* CIRCLED ASTERISK OPERATOR */ + {"ocir", 0x229A}, /* CIRCLED RING OPERATOR */ + {"ocirc", 0x00F4}, /* LATIN SMALL LETTER O WITH CIRCUMFLEX */ + {"ocy", 0x043E}, /* CYRILLIC SMALL LETTER O */ + {"odash", 0x229D}, /* CIRCLED DASH */ + {"odblac", 0x0151}, /* LATIN SMALL LETTER O WITH DOUBLE ACUTE */ + {"odot", 0x2299}, /* CIRCLED DOT OPERATOR */ + {"oelig", 0x0153}, /* LATIN SMALL LIGATURE OE */ + {"ogon", 0x02DB}, /* OGONEK */ + {"ogr", 0x03BF}, /* GREEK SMALL LETTER OMICRON */ + {"ograve", 0x00F2}, /* LATIN SMALL LETTER O WITH GRAVE */ + {"ohacgr", 0x03CE}, /* GREEK SMALL LETTER OMEGA WITH TONOS */ + {"ohgr", 0x03C9}, /* GREEK SMALL LETTER OMEGA */ + {"ohm", 0x2126}, /* OHM SIGN */ + {"olarr", 0x21BA}, /* ANTICLOCKWISE OPEN CIRCLE ARROW */ + {"oline", 0x203E}, /* OVERLINE */ + {"omacr", 0x014D}, /* LATIN SMALL LETTER O WITH MACRON */ + {"omega", 0x03C9}, /* GREEK SMALL LETTER OMEGA */ + {"omicron", 0x03BF}, /* GREEK SMALL LETTER OMICRON */ + {"ominus", 0x2296}, /* CIRCLED MINUS */ + {"oplus", 0x2295}, /* CIRCLED PLUS */ + {"or", 0x2228}, /* LOGICAL OR */ + {"orarr", 0x21BB}, /* CLOCKWISE OPEN CIRCLE ARROW */ + {"order", 0x2134}, /* SCRIPT SMALL O */ + {"ordf", 0x00AA}, /* FEMININE ORDINAL INDICATOR */ + {"ordm", 0x00BA}, /* MASCULINE ORDINAL INDICATOR */ + {"oslash", 0x00F8}, /* LATIN SMALL LETTER O WITH STROKE */ + {"osol", 0x2298}, /* CIRCLED DIVISION SLASH */ + {"otilde", 0x00F5}, /* LATIN SMALL LETTER O WITH TILDE */ + {"otimes", 0x2297}, /* CIRCLED TIMES */ + {"ouml", 0x00F6}, /* LATIN SMALL LETTER O WITH DIAERESIS */ + {"par", 0x2225}, /* PARALLEL TO */ + {"para", 0x00B6}, /* PILCROW SIGN */ + {"part", 0x2202}, /* PARTIAL DIFFERENTIAL */ + {"pcy", 0x043F}, /* CYRILLIC SMALL LETTER PE */ + {"percnt", 0x0025}, /* PERCENT SIGN */ + {"period", 0x002E}, /* FULL STOP */ + {"permil", 0x2030}, /* PER MILLE SIGN */ + {"perp", 0x22A5}, /* UP TACK */ + {"pgr", 0x03C0}, /* GREEK SMALL LETTER PI */ + {"phgr", 0x03C6}, /* GREEK SMALL LETTER PHI */ + {"phi", 0x03C6}, /* GREEK SMALL LETTER PHI */ + {"phis", 0x03C6}, /* GREEK SMALL LETTER PHI */ + {"phiv", 0x03D5}, /* GREEK PHI SYMBOL */ + {"phmmat", 0x2133}, /* SCRIPT CAPITAL M */ + {"phone", 0x260E}, /* BLACK TELEPHONE */ + {"pi", 0x03C0}, /* GREEK SMALL LETTER PI */ + {"piv", 0x03D6}, /* GREEK PI SYMBOL */ + {"planck", 0x210F}, /* PLANCK CONSTANT OVER TWO PI */ + {"plus", 0x002B}, /* PLUS SIGN */ + {"plusb", 0x229E}, /* SQUARED PLUS */ + {"plusdo", 0x2214}, /* DOT PLUS */ + {"plusmn", 0x00B1}, /* PLUS-MINUS SIGN */ + {"pound", 0x00A3}, /* POUND SIGN */ + {"pr", 0x227A}, /* PRECEDES */ + {"pre", 0x227C}, /* PRECEDES OR EQUAL TO */ + {"prime", 0x2032}, /* PRIME */ + {"prnsim", 0x22E8}, /* PRECEDES BUT NOT EQUIVALENT TO */ + {"prod", 0x220F}, /* N-ARY PRODUCT */ + {"prop", 0x221D}, /* PROPORTIONAL TO */ + {"prsim", 0x227E}, /* PRECEDES OR EQUIVALENT TO */ + {"psgr", 0x03C8}, /* GREEK SMALL LETTER PSI */ + {"psi", 0x03C8}, /* GREEK SMALL LETTER PSI */ + {"puncsp", 0x2008}, /* PUNCTUATION SPACE */ + {"quest", 0x003F}, /* QUESTION MARK */ + {"quot", 0x0022}, /* QUOTATION MARK */ + {"rAarr", 0x21DB}, /* RIGHTWARDS TRIPLE ARROW */ + {"rArr", 0x21D2}, /* RIGHTWARDS DOUBLE ARROW */ + {"racute", 0x0155}, /* LATIN SMALL LETTER R WITH ACUTE */ + {"radic", 0x221A}, /* SQUARE ROOT */ + {"rang", 0x232A}, /* RIGHT-POINTING ANGLE BRACKET */ + {"raquo", 0x00BB}, /* RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */ + {"rarr", 0x2192}, /* RIGHTWARDS ARROW */ + {"rarr2", 0x21C9}, /* RIGHTWARDS PAIRED ARROWS */ + {"rarrhk", 0x21AA}, /* RIGHTWARDS ARROW WITH HOOK */ + {"rarrlp", 0x21AC}, /* RIGHTWARDS ARROW WITH LOOP */ + {"rarrtl", 0x21A3}, /* RIGHTWARDS ARROW WITH TAIL */ + {"rarrw", 0x219D}, /* RIGHTWARDS WAVE ARROW */ + {"rcaron", 0x0159}, /* LATIN SMALL LETTER R WITH CARON */ + {"rcedil", 0x0157}, /* LATIN SMALL LETTER R WITH CEDILLA */ + {"rceil", 0x2309}, /* RIGHT CEILING */ + {"rcub", 0x007D}, /* RIGHT CURLY BRACKET */ + {"rcy", 0x0440}, /* CYRILLIC SMALL LETTER ER */ + {"rdquo", 0x201D}, /* RIGHT DOUBLE QUOTATION MARK */ + {"rdquor", 0x201C}, /* LEFT DOUBLE QUOTATION MARK */ + {"real", 0x211C}, /* BLACK-LETTER CAPITAL R */ + {"rect", 0x25AD}, /* WHITE RECTANGLE */ + {"reg", 0x00AE}, /* REGISTERED SIGN */ + {"rfloor", 0x230B}, /* RIGHT FLOOR */ + {"rgr", 0x03C1}, /* GREEK SMALL LETTER RHO */ + {"rhard", 0x21C1}, /* RIGHTWARDS HARPOON WITH BARB DOWNWARDS */ + {"rharu", 0x21C0}, /* RIGHTWARDS HARPOON WITH BARB UPWARDS */ + {"rho", 0x03C1}, /* GREEK SMALL LETTER RHO */ + {"rhov", 0x03F1}, /* GREEK RHO SYMBOL */ + {"ring", 0x02DA}, /* RING ABOVE */ + {"rlarr2", 0x21C4}, /* RIGHTWARDS ARROW OVER LEFTWARDS ARROW */ + {"rlhar2", 0x21CC}, /* RIGHTWARDS HARPOON OVER LEFTWARDS HARPOON */ + {"rlm", 0x200F}, /* RIGHT-TO-LEFT MARK */ + {"rpar", 0x0029}, /* RIGHT PARENTHESIS */ + {"rsaquo", 0x203A}, /* SINGLE RIGHT-POINTING ANGLE QUOTATION MARK */ + {"rsh", 0x21B1}, /* UPWARDS ARROW WITH TIP RIGHTWARDS */ + {"rsqb", 0x005D}, /* RIGHT SQUARE BRACKET */ + {"rsquo", 0x2019}, /* RIGHT SINGLE QUOTATION MARK */ + {"rsquor", 0x2018}, /* LEFT SINGLE QUOTATION MARK */ + {"rthree", 0x22CC}, /* RIGHT SEMIDIRECT PRODUCT */ + {"rtimes", 0x22CA}, /* RIGHT NORMAL FACTOR SEMIDIRECT PRODUCT */ + {"rtri", 0x25B9}, /* WHITE RIGHT-POINTING SMALL TRIANGLE */ + {"rtrie", 0x22B5}, /* CONTAINS AS NORMAL SUBGROUP OR EQUAL TO */ + {"rtrif", 0x25B8}, /* BLACK RIGHT-POINTING SMALL TRIANGLE */ + {"rx", 0x211E}, /* PRESCRIPTION TAKE */ + {"sacute", 0x015B}, /* LATIN SMALL LETTER S WITH ACUTE */ + {"samalg", 0x2210}, /* N-ARY COPRODUCT */ + {"sbquo", 0x201A}, /* SINGLE LOW-9 QUOTATION MARK */ + {"sbsol", 0x005C}, /* REVERSE SOLIDUS */ + {"sc", 0x227B}, /* SUCCEEDS */ + {"scaron", 0x0161}, /* LATIN SMALL LETTER S WITH CARON */ + {"sccue", 0x227D}, /* SUCCEEDS OR EQUAL TO */ + {"sce", 0x227D}, /* SUCCEEDS OR EQUAL TO */ + {"scedil", 0x015F}, /* LATIN SMALL LETTER S WITH CEDILLA */ + {"scirc", 0x015D}, /* LATIN SMALL LETTER S WITH CIRCUMFLEX */ + {"scnsim", 0x22E9}, /* SUCCEEDS BUT NOT EQUIVALENT TO */ + {"scsim", 0x227F}, /* SUCCEEDS OR EQUIVALENT TO */ + {"scy", 0x0441}, /* CYRILLIC SMALL LETTER ES */ + {"sdot", 0x22C5}, /* DOT OPERATOR */ + {"sdotb", 0x22A1}, /* SQUARED DOT OPERATOR */ + {"sect", 0x00A7}, /* SECTION SIGN */ + {"semi", 0x003B}, /* SEMICOLON */ + {"setmn", 0x2216}, /* SET MINUS */ + {"sext", 0x2736}, /* SIX POINTED BLACK STAR */ + {"sfgr", 0x03C2}, /* GREEK SMALL LETTER FINAL SIGMA */ + {"sfrown", 0x2322}, /* FROWN */ + {"sgr", 0x03C3}, /* GREEK SMALL LETTER SIGMA */ + {"sharp", 0x266F}, /* MUSIC SHARP SIGN */ + {"shchcy", 0x0449}, /* CYRILLIC SMALL LETTER SHCHA */ + {"shcy", 0x0448}, /* CYRILLIC SMALL LETTER SHA */ + {"shy", 0x00AD}, /* SOFT HYPHEN */ + {"sigma", 0x03C3}, /* GREEK SMALL LETTER SIGMA */ + {"sigmaf", 0x03C2}, /* GREEK SMALL LETTER FINAL SIGMA */ + {"sigmav", 0x03C2}, /* GREEK SMALL LETTER FINAL SIGMA */ + {"sim", 0x223C}, /* TILDE OPERATOR */ + {"sime", 0x2243}, /* ASYMPTOTICALLY EQUAL TO */ + {"smile", 0x2323}, /* SMILE */ + {"softcy", 0x044C}, /* CYRILLIC SMALL LETTER SOFT SIGN */ + {"sol", 0x002F}, /* SOLIDUS */ + {"spades", 0x2660}, /* BLACK SPADE SUIT */ + {"spar", 0x2225}, /* PARALLEL TO */ + {"sqcap", 0x2293}, /* SQUARE CAP */ + {"sqcup", 0x2294}, /* SQUARE CUP */ + {"sqsub", 0x228F}, /* SQUARE IMAGE OF */ + {"sqsube", 0x2291}, /* SQUARE IMAGE OF OR EQUAL TO */ + {"sqsup", 0x2290}, /* SQUARE ORIGINAL OF */ + {"sqsupe", 0x2292}, /* SQUARE ORIGINAL OF OR EQUAL TO */ + {"squ", 0x25A1}, /* WHITE SQUARE */ + {"square", 0x25A1}, /* WHITE SQUARE */ + {"squf", 0x25AA}, /* BLACK SMALL SQUARE */ + {"ssetmn", 0x2216}, /* SET MINUS */ + {"ssmile", 0x2323}, /* SMILE */ + {"sstarf", 0x22C6}, /* STAR OPERATOR */ + {"star", 0x2606}, /* WHITE STAR */ + {"starf", 0x2605}, /* BLACK STAR */ + {"sub", 0x2282}, /* SUBSET OF */ + {"subE", 0x2286}, /* SUBSET OF OR EQUAL TO */ + {"sube", 0x2286}, /* SUBSET OF OR EQUAL TO */ + {"subnE", 0x228A}, /* SUBSET OF WITH NOT EQUAL TO */ + {"subne", 0x228A}, /* SUBSET OF WITH NOT EQUAL TO */ + {"sum", 0x2211}, /* N-ARY SUMMATION */ + {"sung", 0x266A}, /* EIGHTH NOTE */ + {"sup", 0x2283}, /* SUPERSET OF */ + {"sup1", 0x00B9}, /* SUPERSCRIPT ONE */ + {"sup2", 0x00B2}, /* SUPERSCRIPT TWO */ + {"sup3", 0x00B3}, /* SUPERSCRIPT THREE */ + {"supE", 0x2287}, /* SUPERSET OF OR EQUAL TO */ + {"supe", 0x2287}, /* SUPERSET OF OR EQUAL TO */ + {"supnE", 0x228B}, /* SUPERSET OF WITH NOT EQUAL TO */ + {"supne", 0x228B}, /* SUPERSET OF WITH NOT EQUAL TO */ + {"szlig", 0x00DF}, /* LATIN SMALL LETTER SHARP S */ + {"target", 0x2316}, /* POSITION INDICATOR */ + {"tau", 0x03C4}, /* GREEK SMALL LETTER TAU */ + {"tcaron", 0x0165}, /* LATIN SMALL LETTER T WITH CARON */ + {"tcedil", 0x0163}, /* LATIN SMALL LETTER T WITH CEDILLA */ + {"tcy", 0x0442}, /* CYRILLIC SMALL LETTER TE */ + {"tdot", 0x20DB}, /* COMBINING THREE DOTS ABOVE */ + {"telrec", 0x2315}, /* TELEPHONE RECORDER */ + {"tgr", 0x03C4}, /* GREEK SMALL LETTER TAU */ + {"there4", 0x2234}, /* THEREFORE */ + {"theta", 0x03B8}, /* GREEK SMALL LETTER THETA */ + {"thetas", 0x03B8}, /* GREEK SMALL LETTER THETA */ + {"thetasym", 0x03D1}, /* GREEK THETA SYMBOL */ + {"thetav", 0x03D1}, /* GREEK THETA SYMBOL */ + {"thgr", 0x03B8}, /* GREEK SMALL LETTER THETA */ + {"thinsp", 0x2009}, /* THIN SPACE */ + {"thkap", 0x2248}, /* ALMOST EQUAL TO */ + {"thksim", 0x223C}, /* TILDE OPERATOR */ + {"thorn", 0x00FE}, /* LATIN SMALL LETTER THORN */ + {"tilde", 0x02DC}, /* SMALL TILDE */ + {"times", 0x00D7}, /* MULTIPLICATION SIGN */ + {"timesb", 0x22A0}, /* SQUARED TIMES */ + {"top", 0x22A4}, /* DOWN TACK */ + {"tprime", 0x2034}, /* TRIPLE PRIME */ + {"trade", 0x2122}, /* TRADE MARK SIGN */ + {"trie", 0x225C}, /* DELTA EQUAL TO */ + {"tscy", 0x0446}, /* CYRILLIC SMALL LETTER TSE */ + {"tshcy", 0x045B}, /* CYRILLIC SMALL LETTER TSHE */ + {"tstrok", 0x0167}, /* LATIN SMALL LETTER T WITH STROKE */ + {"twixt", 0x226C}, /* BETWEEN */ + {"uArr", 0x21D1}, /* UPWARDS DOUBLE ARROW */ + {"uacgr", 0x03CD}, /* GREEK SMALL LETTER UPSILON WITH TONOS */ + {"uacute", 0x00FA}, /* LATIN SMALL LETTER U WITH ACUTE */ + {"uarr", 0x2191}, /* UPWARDS ARROW */ + {"uarr2", 0x21C8}, /* UPWARDS PAIRED ARROWS */ + {"ubrcy", 0x045E}, /* CYRILLIC SMALL LETTER SHORT U */ + {"ubreve", 0x016D}, /* LATIN SMALL LETTER U WITH BREVE */ + {"ucirc", 0x00FB}, /* LATIN SMALL LETTER U WITH CIRCUMFLEX */ + {"ucy", 0x0443}, /* CYRILLIC SMALL LETTER U */ + {"udblac", 0x0171}, /* LATIN SMALL LETTER U WITH DOUBLE ACUTE */ + {"udiagr", 0x03B0}, /* GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND */ + {"udigr", 0x03CB}, /* GREEK SMALL LETTER UPSILON WITH DIALYTIKA */ + {"ugr", 0x03C5}, /* GREEK SMALL LETTER UPSILON */ + {"ugrave", 0x00F9}, /* LATIN SMALL LETTER U WITH GRAVE */ + {"uharl", 0x21BF}, /* UPWARDS HARPOON WITH BARB LEFTWARDS */ + {"uharr", 0x21BE}, /* UPWARDS HARPOON WITH BARB RIGHTWARDS */ + {"uhblk", 0x2580}, /* UPPER HALF BLOCK */ + {"ulcorn", 0x231C}, /* TOP LEFT CORNER */ + {"ulcrop", 0x230F}, /* TOP LEFT CROP */ + {"umacr", 0x016B}, /* LATIN SMALL LETTER U WITH MACRON */ + {"uml", 0x00A8}, /* DIAERESIS */ + {"uogon", 0x0173}, /* LATIN SMALL LETTER U WITH OGONEK */ + {"uplus", 0x228E}, /* MULTISET UNION */ + {"upsi", 0x03C5}, /* GREEK SMALL LETTER UPSILON */ + {"upsih", 0x03D2}, /* GREEK UPSILON WITH HOOK SYMBOL */ + {"upsilon", 0x03C5}, /* GREEK SMALL LETTER UPSILON */ + {"urcorn", 0x231D}, /* TOP RIGHT CORNER */ + {"urcrop", 0x230E}, /* TOP RIGHT CROP */ + {"uring", 0x016F}, /* LATIN SMALL LETTER U WITH RING ABOVE */ + {"utilde", 0x0169}, /* LATIN SMALL LETTER U WITH TILDE */ + {"utri", 0x25B5}, /* WHITE UP-POINTING SMALL TRIANGLE */ + {"utrif", 0x25B4}, /* BLACK UP-POINTING SMALL TRIANGLE */ + {"uuml", 0x00FC}, /* LATIN SMALL LETTER U WITH DIAERESIS */ + {"vArr", 0x21D5}, /* UP DOWN DOUBLE ARROW */ + {"vDash", 0x22A8}, /* TRUE */ + {"varr", 0x2195}, /* UP DOWN ARROW */ + {"vcy", 0x0432}, /* CYRILLIC SMALL LETTER VE */ + {"vdash", 0x22A2}, /* RIGHT TACK */ + {"veebar", 0x22BB}, /* XOR */ + {"vellip", 0x22EE}, /* VERTICAL ELLIPSIS */ + {"verbar", 0x007C}, /* VERTICAL LINE */ + {"vltri", 0x22B2}, /* NORMAL SUBGROUP OF */ + {"vprime", 0x2032}, /* PRIME */ + {"vprop", 0x221D}, /* PROPORTIONAL TO */ + {"vrtri", 0x22B3}, /* CONTAINS AS NORMAL SUBGROUP */ + {"vsubnE", 0x228A}, /* SUBSET OF WITH NOT EQUAL TO */ + {"vsubne", 0x228A}, /* SUBSET OF WITH NOT EQUAL TO */ + {"vsupnE", 0x228B}, /* SUPERSET OF WITH NOT EQUAL TO */ + {"vsupne", 0x228B}, /* SUPERSET OF WITH NOT EQUAL TO */ + {"wcirc", 0x0175}, /* LATIN SMALL LETTER W WITH CIRCUMFLEX */ + {"wedgeq", 0x2259}, /* ESTIMATES */ + {"weierp", 0x2118}, /* SCRIPT CAPITAL P */ + {"wreath", 0x2240}, /* WREATH PRODUCT */ + {"xcirc", 0x25CB}, /* WHITE CIRCLE */ + {"xdtri", 0x25BD}, /* WHITE DOWN-POINTING TRIANGLE */ + {"xgr", 0x03BE}, /* GREEK SMALL LETTER XI */ + {"xhArr", 0x2194}, /* LEFT RIGHT ARROW */ + {"xharr", 0x2194}, /* LEFT RIGHT ARROW */ + {"xi", 0x03BE}, /* GREEK SMALL LETTER XI */ + {"xlArr", 0x21D0}, /* LEFTWARDS DOUBLE ARROW */ + {"xrArr", 0x21D2}, /* RIGHTWARDS DOUBLE ARROW */ + {"xutri", 0x25B3}, /* WHITE UP-POINTING TRIANGLE */ + {"yacute", 0x00FD}, /* LATIN SMALL LETTER Y WITH ACUTE */ + {"yacy", 0x044F}, /* CYRILLIC SMALL LETTER YA */ + {"ycirc", 0x0177}, /* LATIN SMALL LETTER Y WITH CIRCUMFLEX */ + {"ycy", 0x044B}, /* CYRILLIC SMALL LETTER YERU */ + {"yen", 0x00A5}, /* YEN SIGN */ + {"yicy", 0x0457}, /* CYRILLIC SMALL LETTER YI */ + {"yucy", 0x044E}, /* CYRILLIC SMALL LETTER YU */ + {"yuml", 0x00FF}, /* LATIN SMALL LETTER Y WITH DIAERESIS */ + {"zacute", 0x017A}, /* LATIN SMALL LETTER Z WITH ACUTE */ + {"zcaron", 0x017E}, /* LATIN SMALL LETTER Z WITH CARON */ + {"zcy", 0x0437}, /* CYRILLIC SMALL LETTER ZE */ + {"zdot", 0x017C}, /* LATIN SMALL LETTER Z WITH DOT ABOVE */ + {"zeta", 0x03B6}, /* GREEK SMALL LETTER ZETA */ + {"zgr", 0x03B6}, /* GREEK SMALL LETTER ZETA */ + {"zhcy", 0x0436}, /* CYRILLIC SMALL LETTER ZHE */ + {"zwj", 0x200D}, /* ZERO WIDTH JOINER */ + {"zwnj", 0x200C}, /* ZERO WIDTH NON-JOINER */ +/* {"epsiv", 0x????}, variant epsilon # ISOgrk3 */ +/* {"fjlig", 0x????}, fj ligature # ISOpub */ +/* {"gEl", 0x????}, greater-than, double equals, less-than # ISOamsr */ +/* {"gap", 0x????}, greater-than, approximately equal to # ISOamsr */ +/* {"gnap", 0x????}, greater-than, not approximately equal t# ISOamsn */ +/* {"jnodot", 0x????}, latin small letter dotless j # ISOamso */ +/* {"lEg", 0x????}, less-than, double equals, greater-than # ISOamsr */ +/* {"lap", 0x????}, less-than, approximately equal to # ISOamsr */ +/* {"lnap", 0x????}, less-than, not approximately equal to # ISOamsn */ +/* {"lpargt", 0x????}, left parenthesis, greater-than # ISOamsc */ +/* {"ngE", 0x????}, not greater-than, double equals # ISOamsn */ +/* {"nlE", 0x????}, not less-than, double equals # ISOamsn */ +/* {"nsmid", 0x????}, nshortmid # ISOamsn */ +/* {"prap", 0x????}, precedes, approximately equal to # ISOamsr */ +/* {"prnE", 0x????}, precedes, not double equal # ISOamsn */ +/* {"prnap", 0x????}, precedes, not approximately equal to # ISOamsn */ +/* {"rpargt", 0x????}, right parenthesis, greater-than # ISOamsc */ +/* {"scap", 0x????}, succeeds, approximately equal to # ISOamsr */ +/* {"scnE", 0x????}, succeeds, not double equals # ISOamsn */ +/* {"scnap", 0x????}, succeeds, not approximately equal to # ISOamsn */ +/* {"smid", 0x????}, shortmid # ISOamsr */ }; + /* Attribute Lists ** --------------- ** @@ -476,7 +1249,7 @@ static attr a_attr[] = { /* Anchor attributes */ { "TYPE" }, { "URN" }, { 0 } /* Terminate list */ -}; +}; static attr address_attr[] = { /* ADDRESS attributes */ { "CLASS" }, @@ -538,7 +1311,7 @@ static attr base_attr[] = { /* BASE attributes */ { "TARGET" }, { "TITLE" }, { 0 } /* Terminate list */ -}; +}; static attr bgsound_attr[] = { /* BGSOUND attributes */ { "CLASS" }, @@ -572,7 +1345,7 @@ static attr body_attr[] = { /* BODY attributes */ { 0 } /* Terminate list */ }; -static attr bodytext_attr[] = { /* BODYTEXT attributes */ +static attr bodytext_attr[] = { /* BODYTEXT attributes */ { "CLASS" }, { "CLEAR" }, { "DATA" }, @@ -719,7 +1492,7 @@ static attr fig_attr[] = { /* FIG attributes */ { 0 } /* Terminate list */ }; -static attr fieldset_attr[] = { /* FIELDSET attributes */ +static attr fieldset_attr[] = { /* FIELDSET attributes */ { "CLASS" }, { "CLEAR" }, { "DIR" }, @@ -785,7 +1558,7 @@ static attr frame_attr[] = { /* FRAME attributes */ { 0 } /* Terminate list */ }; -static attr frameset_attr[] = { /* FRAMESET attributes */ +static attr frameset_attr[] = { /* FRAMESET attributes */ { "COLS"}, { "ROWS" }, { 0 } /* Terminate list */ @@ -802,7 +1575,7 @@ static attr gen_attr[] = { /* Minimum HTML 3.0 */ { 0 } /* Terminate list */ }; -static attr glossary_attr[] = { /* DL (and DLC) attributes */ +static attr glossary_attr[] = { /* DL (and DLC) attributes */ { "CLASS" }, { "CLEAR" }, { "COMPACT" }, @@ -883,7 +1656,7 @@ static attr img_attr[] = { /* IMG attributes */ { "USEMAP" }, { "WIDTH" }, { 0 } /* Terminate list */ -}; +}; static attr input_attr[] = { /* INPUT attributes */ { "ACCEPT" }, @@ -924,13 +1697,13 @@ static attr input_attr[] = { /* INPUT attributes */ static attr isindex_attr[] = { /* ISINDEX attributes */ { "ACTION" }, /* Not in spec. Lynx treats it as HREF. - FM */ { "DIR" }, - { "HREF" }, /* HTML 3.0 attritute for search action. - FM */ + { "HREF" }, /* HTML 3.0 attritute for search action. - FM */ { "ID" }, { "LANG" }, { "PROMPT" }, /* HTML 3.0 attribute for prompt string. - FM */ { "TITLE" }, { 0 } /* Terminate list */ -}; +}; static attr keygen_attr[] = { /* KEYGEN attributes */ { "CHALLENGE" }, @@ -1038,7 +1811,7 @@ static attr nextid_attr[] = { /* NEXTID attribures */ { "N" } }; -static attr note_attr[] = { /* NOTE attributes */ +static attr note_attr[] = { /* NOTE attributes */ { "CLASS" }, { "CLEAR" }, { "DIR" }, @@ -1276,7 +2049,7 @@ static attr td_attr[] = { /* TD and TH attributes */ { 0 } /* Terminate list */ }; -static attr textarea_attr[] = { /* TEXTAREA attributes */ +static attr textarea_attr[] = { /* TEXTAREA attributes */ { "ACCEPT-CHARSET" }, /* RFC 2070 HTML i18n - kw */ { "ALIGN" }, { "CLASS" }, @@ -1340,37 +2113,37 @@ static attr ulist_attr[] = { /* UL attributes */ %structure; DIV, CENTER, H1 to H6, P, UL, OL, DL, DIR, MENU, PRE, XMP, LISTING, BLOCKQUOTE, BQ, - 2 1 2 2 1 8 8 8 8 8 8 8 8 4 4 + 2 1 2 2 1 8 8 8 8 8 8 8 8 4 4 MULTICOL,?NOBR, FORM, TABLE, ADDRESS, FIG, BDO, NOTE, and FN; plus?WBR, LI, and LH - 8 n ?1 n 8 8 2 2 2 2 2 ?1 nE 4 4 + 8 n ?1 n 8 8 2 2 2 2 2 ?1 nE 4 4 %insertions; Elements which usually contain special-purpose material, or no text material at all. BASEFONT, APPLET, OBJECT, EMBED, SCRIPT, MAP, MARQUEE, HR, ISINDEX, BGSOUND, TAB,?IMG, - 1 e? 2 2 l 1 e 2 l 8 4 4 E 1? E 1 E ! E ?1 E + 1 e? 2 2 l 1 e 2 l 8 4 4 E 1? E 1 E ! E ?1 E IMAGE, BR, plus NOEMBED, SERVER, SPACER, AUDIOSCOPE, and SIDEBAR; ?area - 1 n 1 E n n n n n 8 E + 1 n 1 E n n n n n 8 E %text; Elements within the %structure; which directly contain running text. Descriptive or analytic markup: EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, Q, LANG, AU, - 2 2 2 2 2 2 2 2 2 2 n 2 + 2 2 2 2 2 2 2 2 2 2 n 2 AUTHOR, PERSON, ACRONYM, ABBREV, INS, DEL, and SPAN - 2 2 n 2 2 2 2 2 + 2 2 n 2 2 2 2 2 Visual markup:S, STRIKE, I, B, TT, U,?NOBR,?WBR, BR, BIG, SMALL, FONT, STYLE, BLINK, TAB, - 1 1 1 1 1 1 ?1 n ?1nE? 1 E 1 1 1 1 l 1 1 E? + 1 1 1 1 1 1 ?1 n ?1nE? 1 E 1 1 1 1 l 1 1 E? BLACKFACE, LIMITTEXT, NOSMARTQUOTES, and SHADOW - 1 n 1 n 1 n 1 n + 1 n 1 n 1 n 1 n Hypertext and graphics: A and?IMG - 8 ?8 E + 8 ?8 E Mathematical: SUB, SUP, and MATH - 4 4 4 l + 4 4 4 l Documentary: COMMENT, ENTITY, ELEMENT, and ATTRIB - 4 4 n 4 n 4 n + 4 4 n 4 n 4 n %formula; */ @@ -1388,22 +2161,22 @@ static attr ulist_attr[] = { /* UL attributes */ ** one 80 character screen line :). The price to pay is that it's ** a bit cryptic, to say the least... - kw */ -/* 1 2 3 4 5 6 7 8 */ +/* 1 2 3 4 5 6 7 8 */ /*345678901234567890123456789012345678901234567890123456789012345678901234567890 */ -/* self contain icont'n contn'd icont'd canclos omit */ +/* self contain icont'n contn'd icont'd canclos omit */ /* { "A" , a_attr, HTML_A_ATTRIBUTES, SGML_MIXED }, */ -#define T_A 0x0008, 0x0B007,0x0FF17,0x37787,0x77BA7,0x8604F,0x00004 +#define T_A 0x0008, 0x0B007,0x0FF17,0x37787,0x77BA7,0x8604F,0x00004 /* { "ABBREV" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ #define T_ABBREV 0x0002, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00003,0x00000 - /* { "ACRONYM" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ + /* { "ACRONYM" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ #define T_ACRONYM 0x0002, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00003,0x00000 - /* { "ADDRESS" , address_attr, HTML_ADDRESS_ATTRIBUTES, SGML_MIXED }, */ -#define T_ADDRESS 0x0200, 0x0F14F,0x8FFFF,0x36680,0xB6FAF,0x80317,0x00000 + /* { "ADDRESS" , address_attr, HTML_ADDRESS_ATTRIBUTES, SGML_MIXED }, */ +#define T_ADDRESS 0x0200, 0x0F14F,0x8FFFF,0x36680,0xB6FAF,0x80317,0x00000 /* { "APPLET" , applet_attr, HTML_APPLET_ATTRIBUTES, SGML_MIXED }, */ -#define T_APPLET 0x2000, 0x0B0CF,0x8FFFF,0x37F9F,0xB7FBF,0x8300F,0x00000 - /* { "AREA" , area_attr, HTML_AREA_ATTRIBUTES, SGML_EMPTY }, */ -#define T_AREA 0x8000, 0x00000,0x00000,0x08000,0x3FFFF,0x00F1F,0x00001 +#define T_APPLET 0x2000, 0x0B0CF,0x8FFFF,0x37F9F,0xB7FBF,0x8300F,0x00000 + /* { "AREA" , area_attr, HTML_AREA_ATTRIBUTES, SGML_EMPTY }, */ +#define T_AREA 0x8000, 0x00000,0x00000,0x08000,0x3FFFF,0x00F1F,0x00001 /* { "AU" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ #define T_AU 0x0002, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00003,0x00000 /* { "AUTHOR" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ @@ -1411,34 +2184,34 @@ static attr ulist_attr[] = { /* UL attributes */ /* { "B" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ #define T_B 0x0001, 0x8B04F,0xAFFFF,0xA778F,0xF7FBF,0x00001,0x00004 /* { "BANNER" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ -#define T_BANNER 0x0200, 0x0FB8F,0x0FFFF,0x30000,0x30000,0x8031F,0x00000 +#define T_BANNER 0x0200, 0x0FB8F,0x0FFFF,0x30000,0x30000,0x8031F,0x00000 /* { "BASE" , base_attr, HTML_BASE_ATTRIBUTES, SGML_EMPTY }, */ #define T_BASE 0x40000,0x00000,0x00000,0x50000,0x50000,0x8000F,0x00001 /* { "BASEFONT", font_attr, HTML_FONT_ATTRIBUTES, SGML_EMPTY }, */ -#define T_BASEFONT 0x1000, 0x00000,0x00000,0x377AF,0x37FAF,0x8F000,0x00001 +#define T_BASEFONT 0x1000, 0x00000,0x00000,0x377AF,0x37FAF,0x8F000,0x00001 /* { "BDO" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ -#define T_BDO 0x0100, 0x0B04F,0x8FFFF,0x36680,0xB6FAF,0x0033F,0x00000 - /* { "BGSOUND" , bgsound_attr, HTML_BGSOUND_ATTRIBUTES, SGML_EMPTY }, */ -#define T_BGSOUND 0x1000, 0x00000,0x00000,0x777AF,0x77FAF,0x8730F,0x00001 +#define T_BDO 0x0100, 0x0B04F,0x8FFFF,0x36680,0xB6FAF,0x0033F,0x00000 + /* { "BGSOUND" , bgsound_attr, HTML_BGSOUND_ATTRIBUTES, SGML_EMPTY }, */ +#define T_BGSOUND 0x1000, 0x00000,0x00000,0x777AF,0x77FAF,0x8730F,0x00001 /* { "BIG" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ #define T_BIG 0x0001, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00001,0x00004 /* { "BLINK" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ -#define T_BLINK 0x0001, 0x8B04F,0x8FFFF,0xA778F,0xF7FAF,0x00001,0x00004 +#define T_BLINK 0x0001, 0x8B04F,0x8FFFF,0xA778F,0xF7FAF,0x00001,0x00004 /* { "BLOCKQUOTE", bq_attr, HTML_BQ_ATTRIBUTES, SGML_MIXED }, */ -#define T_BLOCKQUOTE 0x0200, 0xAFBCF,0xAFFFF,0xB6680,0xB6FAF,0x8031F,0x00000 +#define T_BLOCKQUOTE 0x0200, 0xAFBCF,0xAFFFF,0xB6680,0xB6FAF,0x8031F,0x00000 /* { "BODY" , body_attr, HTML_BODY_ATTRIBUTES, SGML_MIXED }, */ -#define T_BODY 0x20000,0x2FB8F,0x2FFFF,0x30000,0x30000,0xDFF7F,0x00003 +#define T_BODY 0x20000,0x2FB8F,0x2FFFF,0x30000,0x30000,0xDFF7F,0x00003 /* { "BODYTEXT", bodytext_attr,HTML_BODYTEXT_ATTRIBUTES, SGML_MIXED }, */ #define T_BODYTEXT 0x20000,0x0FB8F,0xAFFFF,0x30200,0xB7FAF,0x8F17F,0x00003 /* { "BQ" , bq_attr, HTML_BQ_ATTRIBUTES, SGML_MIXED }, */ -#define T_BQ 0x0200, 0xAFBCF,0xAFFFF,0xB6680,0xB6FAF,0x8031F,0x00000 +#define T_BQ 0x0200, 0xAFBCF,0xAFFFF,0xB6680,0xB6FAF,0x8031F,0x00000 /* { "BR" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_EMPTY }, */ #define T_BR 0x1000, 0x00000,0x00000,0x377BF,0x77FBF,0x8101F,0x00001 #define T_BUTTON 0x0200, 0x0BB0B,0x0FF3B,0x0378F,0x37FAF,0x8035F,0x00000 - /* { "CAPTION" , caption_attr, HTML_CAPTION_ATTRIBUTES, SGML_MIXED }, */ -#define T_CAPTION 0x0100, 0x0B04F,0x8FFFF,0x06A00,0xB6FA7,0x8035F,0x00000 + /* { "CAPTION" , caption_attr, HTML_CAPTION_ATTRIBUTES, SGML_MIXED }, */ +#define T_CAPTION 0x0100, 0x0B04F,0x8FFFF,0x06A00,0xB6FA7,0x8035F,0x00000 /* { "CENTER" , div_attr, HTML_DIV_ATTRIBUTES, SGML_MIXED }, */ -#define T_CENTER 0x0200, 0x8FBCF,0x8FFFF,0xB6680,0xB6FA7,0x8071F,0x00000 +#define T_CENTER 0x0200, 0x8FBCF,0x8FFFF,0xB6680,0xB6FA7,0x8071F,0x00000 /* { "CITE" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ #define T_CITE 0x0002, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00002,0x00000 /* { "CODE" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ @@ -1447,12 +2220,12 @@ static attr ulist_attr[] = { /* UL attributes */ #define T_COL 0x4000, 0x00000,0x00000,0x00820,0x36FA7,0x88F5F,0x00001 /* { "COLGROUP", col_attr, HTML_COL_ATTRIBUTES, SGML_EMPTY }, */ #define T_COLGROUP 0x0020, 0x04000,0x04000,0x00800,0x36FA7,0x8875F,0x00001 - /* { "COMMENT" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ -#define T_COMMENT 0x0004, 0x00000,0x00000,0xA77AF,0x7FFFF,0x00003,0x00000 - /* { "CREDIT" , credit_attr, HTML_CREDIT_ATTRIBUTES, SGML_MIXED }, */ + /* { "COMMENT" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ +#define T_COMMENT 0x0004, 0x00000,0x00000,0xA77AF,0x7FFFF,0x00003,0x00000 + /* { "CREDIT" , credit_attr, HTML_CREDIT_ATTRIBUTES, SGML_MIXED }, */ #define T_CREDIT 0x0100, 0x0B04F,0x8FFFF,0x06A00,0xB7FBF,0x8030F,0x00000 /* { "DD" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_EMPTY }, */ -#define T_DD 0x0400, 0x0FBCF,0x8FFFF,0x00800,0xB6FFF,0x8071F,0x00001 +#define T_DD 0x0400, 0x0FBCF,0x8FFFF,0x00800,0xB6FFF,0x8071F,0x00001 /* { "DEL" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ #define T_DEL 0x0002, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00003,0x00000 /* { "DFN" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ @@ -1460,19 +2233,19 @@ static attr ulist_attr[] = { /* UL attributes */ /* { "DIR" , ulist_attr, HTML_UL_ATTRIBUTES, SGML_MIXED }, */ #define T_DIR 0x0800, 0x0B400,0x0F75F,0x37680,0x36FB7,0x84F7F,0x00000 /* { "DIV" , div_attr, HTML_DIV_ATTRIBUTES, SGML_MIXED }, */ -#define T_DIV 0x0200, 0x8FB8F,0x8FFFF,0xB66A0,0xB7FFF,0x8031F,0x00004 +#define T_DIV 0x0200, 0x8FB8F,0x8FFFF,0xB66A0,0xB7FFF,0x8031F,0x00004 /* { "DL" , glossary_attr, HTML_DL_ATTRIBUTES, SGML_MIXED }, */ -#define T_DL 0x0800, 0x0C480,0x8FFFF,0x36680,0xB7FB7,0x0075F,0x00000 +#define T_DL 0x0800, 0x0C480,0x8FFFF,0x36680,0xB7FB7,0x0075F,0x00000 /* { "DLC" , glossary_attr, HTML_DL_ATTRIBUTES, SGML_MIXED }, */ -#define T_DLC 0x0800, 0x0C480,0x8FFFF,0x36680,0xB7FB7,0x0075F,0x00000 +#define T_DLC 0x0800, 0x0C480,0x8FFFF,0x36680,0xB7FB7,0x0075F,0x00000 /* { "DT" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_EMPTY }, */ -#define T_DT 0x0400, 0x0B04F,0x0B1FF,0x00800,0x17FFF,0x8071F,0x00001 +#define T_DT 0x0400, 0x0B04F,0x0B1FF,0x00800,0x17FFF,0x8071F,0x00001 /* { "EM" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ #define T_EM 0x0002, 0x8B04F,0x8FFFF,0xA778F,0xF7FAF,0x00003,0x00000 /* { "EMBED" , embed_attr, HTML_EMBED_ATTRIBUTES, SGML_EMPTY }, */ -#define T_EMBED 0x2000, 0x8F107,0x8FFF7,0xB6FBF,0xB7FBF,0x1FF7F,0x00001 +#define T_EMBED 0x2000, 0x8F107,0x8FFF7,0xB6FBF,0xB7FBF,0x1FF7F,0x00001 /* { "FIELDSET", fieldset_attr,HTML_FIELDSET_ATTRIBUTES, SGML_MIXED }, */ -#define T_FIELDSET 0x0200, 0x0FB42,0x0FF5F,0x07787,0x37FF7,0x8805F,0x00000 +#define T_FIELDSET 0x0200, 0x0FB42,0x0FF5F,0x07787,0x37FF7,0x8805F,0x00000 /* { "FIG" , fig_attr, HTML_FIG_ATTRIBUTES, SGML_MIXED }, */ #define T_FIG 0x0200, 0x0FB00,0x8FFFF,0x36680,0xB6FBF,0x8834F,0x00000 /* { "FN" , fn_attr, HTML_FN_ATTRIBUTES, SGML_MIXED }, */ @@ -1480,143 +2253,143 @@ static attr ulist_attr[] = { /* UL attributes */ /* { "FONT" , font_attr, HTML_FONT_ATTRIBUTES, SGML_EMPTY }, */ #define T_FONT 0x0001, 0x8B04F,0x8FFFF,0xB778F,0xF7FBF,0x00001,0x00004 /* { "FORM" , form_attr, HTML_FORM_ATTRIBUTES, SGML_EMPTY }, */ -#define T_FORM 0x0080, 0x0FF6F,0x0FF7F,0x36E07,0x33F07,0x88DFF,0x00000 +#define T_FORM 0x0080, 0x0FF6F,0x0FF7F,0x36E07,0x33F07,0x88DFF,0x00000 /* { "FRAME" , frame_attr, HTML_FRAME_ATTRIBUTES, SGML_EMPTY }, */ -#define T_FRAME 0x10000,0x00000,0x00000,0x10000,0x10000,0x9FFFF,0x00001 +#define T_FRAME 0x10000,0x00000,0x00000,0x10000,0x10000,0x9FFFF,0x00001 /* { "FRAMESET", frameset_attr,HTML_FRAMESET_ATTRIBUTES, SGML_MIXED }, */ -#define T_FRAMESET 0x10000,0x90000,0x90000,0x90000,0x93000,0x9FFFF,0x00000 +#define T_FRAMESET 0x10000,0x90000,0x90000,0x90000,0x93000,0x9FFFF,0x00000 /* { "H1" , h_attr, HTML_H_ATTRIBUTES, SGML_MIXED }, */ -#define T_H1 0x0100, 0x0B04F,0x0B05F,0x36680,0x37FAF,0x80317,0x00000 +#define T_H1 0x0100, 0x0B04F,0x0B05F,0x36680,0x37FAF,0x80317,0x00000 /* { "H2" , h_attr, HTML_H_ATTRIBUTES, SGML_MIXED }, */ -#define T_H2 0x0100, 0x0B04F,0x0B05F,0x36680,0x37FAF,0x80317,0x00000 +#define T_H2 0x0100, 0x0B04F,0x0B05F,0x36680,0x37FAF,0x80317,0x00000 /* { "H3" , h_attr, HTML_H_ATTRIBUTES, SGML_MIXED }, */ -#define T_H3 0x0100, 0x0B04F,0x0B05F,0x36680,0x37FAF,0x80317,0x00000 +#define T_H3 0x0100, 0x0B04F,0x0B05F,0x36680,0x37FAF,0x80317,0x00000 /* { "H4" , h_attr, HTML_H_ATTRIBUTES, SGML_MIXED }, */ -#define T_H4 0x0100, 0x0B04F,0x0B05F,0x36680,0x37FAF,0x80317,0x00000 +#define T_H4 0x0100, 0x0B04F,0x0B05F,0x36680,0x37FAF,0x80317,0x00000 /* { "H5" , h_attr, HTML_H_ATTRIBUTES, SGML_MIXED }, */ -#define T_H5 0x0100, 0x0B04F,0x0B05F,0x36680,0x37FAF,0x80317,0x00000 +#define T_H5 0x0100, 0x0B04F,0x0B05F,0x36680,0x37FAF,0x80317,0x00000 /* { "H6" , h_attr, HTML_H_ATTRIBUTES, SGML_MIXED }, */ -#define T_H6 0x0100, 0x0B04F,0x0B05F,0x36680,0x37FAF,0x80317,0x00000 +#define T_H6 0x0100, 0x0B04F,0x0B05F,0x36680,0x37FAF,0x80317,0x00000 /* { "HEAD" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ #define T_HEAD 0x40000,0x4F000,0x47000,0x10000,0x10000,0x9FF7F,0x00006 /* { "HR" , hr_attr, HTML_HR_ATTRIBUTES, SGML_EMPTY }, */ -#define T_HR 0x4000, 0x00000,0x00000,0x3FE80,0x3FFBF,0x87F37,0x00001 +#define T_HR 0x4000, 0x00000,0x00000,0x3FE80,0x3FFBF,0x87F37,0x00001 /* { "HTML" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ #define T_HTML 0x10000,0x7FB8F,0x7FFFF,0x00000,0x00000,0x1FFFF,0x00003 #define T_HY 0x1000, 0x00000,0x00000,0x3779F,0x77FBF,0x8101F,0x00001 /* { "I" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ #define T_I 0x0001, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00001,0x00004 -#define T_IFRAME 0x2000, 0x8FBCF,0x8FFFF,0xB679F,0xB6FBF,0xD335F,0x00000 - /* { "IMG" , img_attr, HTML_IMG_ATTRIBUTES, SGML_EMPTY }, */ -#define T_IMG 0x1000, 0x00000,0x00000,0x3779F,0x37FBF,0x80000,0x00001 - /* { "INPUT" , input_attr, HTML_INPUT_ATTRIBUTES, SGML_EMPTY }, */ -#define T_INPUT 0x0040, 0x00000,0x00000,0x03F87,0x37F87,0x8904F,0x00001 +#define T_IFRAME 0x2000, 0x8FBCF,0x8FFFF,0xB679F,0xB6FBF,0xD335F,0x00000 + /* { "IMG" , img_attr, HTML_IMG_ATTRIBUTES, SGML_EMPTY }, */ +#define T_IMG 0x1000, 0x00000,0x00000,0x3779F,0x37FBF,0x80000,0x00001 + /* { "INPUT" , input_attr, HTML_INPUT_ATTRIBUTES, SGML_EMPTY }, */ +#define T_INPUT 0x0040, 0x00000,0x00000,0x03F87,0x37F87,0x8904F,0x00001 /* { "INS" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ #define T_INS 0x0002, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00003,0x00000 - /* { "ISINDEX" , isindex_attr, HTML_ISINDEX_ATTRIBUTES,SGML_EMPTY }, */ + /* { "ISINDEX" , isindex_attr, HTML_ISINDEX_ATTRIBUTES,SGML_EMPTY }, */ #define T_ISINDEX 0x8000, 0x00000,0x00000,0x7778F,0x7FFAF,0x80007,0x00001 /* { "KBD" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ #define T_KBD 0x0002, 0x00000,0x00000,0x2778F,0x77FBF,0x00003,0x00000 - /* { "KEYGEN" , keygen_attr, HTML_KEYGEN_ATTRIBUTES, SGML_EMPTY }, */ -#define T_KEYGEN 0x0040, 0x00000,0x00000,0x07FB7,0x37FB7,0x80070,0x00001 + /* { "KEYGEN" , keygen_attr, HTML_KEYGEN_ATTRIBUTES, SGML_EMPTY }, */ +#define T_KEYGEN 0x0040, 0x00000,0x00000,0x07FB7,0x37FB7,0x80070,0x00001 /* { "LABEL" , label_attr, HTML_LABEL_ATTRIBUTES, SGML_MIXED }, */ -#define T_LABEL 0x0020, 0x9FFFF,0x9FFFF,0x9FFFF,0x9FFFF,0x00007,0x00000 +#define T_LABEL 0x0020, 0x9FFFF,0x9FFFF,0x9FFFF,0x9FFFF,0x00007,0x00000 #define T_LEGEND 0x0002, 0x0B04F,0x0FF7F,0x00200,0x37FA7,0x00003,0x00000 /* { "LH" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_EMPTY }, */ -#define T_LH 0x0400, 0x0BB7F,0x8FFFF,0x00800,0x97FFF,0x8071F,0x00001 +#define T_LH 0x0400, 0x0BB7F,0x8FFFF,0x00800,0x97FFF,0x8071F,0x00001 /* { "LI" , list_attr, HTML_LI_ATTRIBUTES, SGML_EMPTY }, */ -#define T_LI 0x0400, 0x0BBFF,0x8FFFF,0x00800,0x97FFF,0x8071F,0x00001 +#define T_LI 0x0400, 0x0BBFF,0x8FFFF,0x00800,0x97FFF,0x8071F,0x00001 /* { "LINK" , link_attr, HTML_LINK_ATTRIBUTES, SGML_EMPTY }, */ #define T_LINK 0x8000, 0x00000,0x00000,0x50000,0x50000,0x0FF7F,0x00001 - /* { "LISTING" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_LITTERAL }, */ + /* { "LISTING" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_LITTERAL }, */ #define T_LISTING 0x0800, 0x00000,0x00000,0x36600,0x36F00,0x80F1F,0x00000 /* { "MAP" , map_attr, HTML_MAP_ATTRIBUTES, SGML_MIXED }, */ -#define T_MAP 0x8000, 0x08000,0x08000,0x37FCF,0x37FBF,0x0071F,0x00000 - /* { "MARQUEE" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ +#define T_MAP 0x8000, 0x08000,0x08000,0x37FCF,0x37FBF,0x0071F,0x00000 + /* { "MARQUEE" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ #define T_MARQUEE 0x4000, 0x0000F,0x8F01F,0x37787,0xB7FA7,0x8301C,0x00000 /* { "MATH" , math_attr, HTML_MATH_ATTRIBUTES, SGML_LITTERAL }, */ -#define T_MATH 0x0004, 0x0B05F,0x8FFFF,0x2778F,0xF7FBF,0x0001F,0x00000 +#define T_MATH 0x0004, 0x0B05F,0x8FFFF,0x2778F,0xF7FBF,0x0001F,0x00000 /* { "MENU" , ulist_attr, HTML_UL_ATTRIBUTES, SGML_MIXED }, */ #define T_MENU 0x0800, 0x0B400,0x0F75F,0x17680,0x36FB7,0x88F7F,0x00000 /* { "META" , meta_attr, HTML_META_ATTRIBUTES, SGML_EMPTY }, */ #define T_META 0x8000, 0x00000,0x00000,0x50000,0x50000,0x0FF7F,0x00001 - /* { "NEXTID" , nextid_attr, 1, SGML_EMPTY }, */ + /* { "NEXTID" , nextid_attr, 1, SGML_EMPTY }, */ #define T_NEXTID 0x1000, 0x00000,0x00000,0x50000,0x1FFF7,0x00001,0x00001 /* { "NOFRAMES", gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ -#define T_NOFRAMES 0x20000,0x2FB8F,0x0FFFF,0x17000,0x17000,0x0CF5F,0x00000 +#define T_NOFRAMES 0x20000,0x2FB8F,0x0FFFF,0x17000,0x17000,0x0CF5F,0x00000 /* { "NOTE" , note_attr, HTML_NOTE_ATTRIBUTES, SGML_MIXED }, */ -#define T_NOTE 0x0200, 0x0BBAF,0x8FFFF,0x376B0,0xB7FFF,0x8031F,0x00000 - /* { "OBJECT" , object_attr, HTML_OBJECT_ATTRIBUTES, SGML_LITTERAL }, */ -#define T_OBJECT 0x2000, 0x8FBCF,0x8FFFF,0xB679F,0xB6FBF,0x83F5F,0x00000 +#define T_NOTE 0x0200, 0x0BBAF,0x8FFFF,0x376B0,0xB7FFF,0x8031F,0x00000 + /* { "OBJECT" , object_attr, HTML_OBJECT_ATTRIBUTES, SGML_LITTERAL }, */ +#define T_OBJECT 0x2000, 0x8FBCF,0x8FFFF,0xB679F,0xB6FBF,0x83F5F,0x00000 /* { "OL" , olist_attr, HTML_OL_ATTRIBUTES, SGML_MIXED }, */ #define T_OL 0x0800, 0x0C400,0x8FFFF,0x37680,0xB7FB7,0x88F7F,0x00000 - /* { "OPTION" , option_attr, HTML_OPTION_ATTRIBUTES, SGML_EMPTY }, */ -#define T_OPTION 0x8000, 0x00000,0x00000,0x00040,0x37FFF,0x8031F,0x00001 - /* { "OVERLAY" , overlay_attr, HTML_OVERLAY_ATTRIBUTES, SGML_EMPTY }, */ + /* { "OPTION" , option_attr, HTML_OPTION_ATTRIBUTES, SGML_EMPTY }, */ +#define T_OPTION 0x8000, 0x00000,0x00000,0x00040,0x37FFF,0x8031F,0x00001 + /* { "OVERLAY" , overlay_attr, HTML_OVERLAY_ATTRIBUTES, SGML_EMPTY }, */ #define T_OVERLAY 0x4000, 0x00000,0x00000,0x00200,0x37FBF,0x83F7F,0x00001 /* { "P" , p_attr, HTML_P_ATTRIBUTES, SGML_EMPTY }, */ -#define T_P 0x0100, 0x0B04F,0x8FFFF,0x36680,0xB6FA7,0x80117,0x00001 +#define T_P 0x0100, 0x0B04F,0x8FFFF,0x36680,0xB6FA7,0x80117,0x00001 /* { "PARAM" , param_attr, HTML_PARAM_ATTRIBUTES, SGML_EMPTY }, */ -#define T_PARAM 0x1000, 0x00000,0x00000,0x03000,0x17FFF,0x81777,0x00001 +#define T_PARAM 0x1000, 0x00000,0x00000,0x03000,0x17FFF,0x81777,0x00001 /* { "PLAINTEXT", gen_attr, HTML_GEN_ATTRIBUTES, SGML_LITTERAL }, */ #define T_PLAINTEXT 0x10000,0xFFFFF,0xFFFFF,0x90000,0x90000,0x3FFFF,0x00001 /* { "PRE" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ -#define T_PRE 0x0200, 0x0F04F,0x0F05E,0x36680,0x36FF0,0x8071E,0x00000 +#define T_PRE 0x0200, 0x0F04F,0x0F05E,0x36680,0x36FF0,0x8071E,0x00000 /* { "Q" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ #define T_Q 0x0002, 0x8B04F,0x8FFFF,0xA778F,0xF7FAF,0x00003,0x00000 /* { "S" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ #define T_S 0x0001, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00001,0x00000 /* { "SAMP" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ #define T_SAMP 0x0002, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00002,0x00000 - /* { "SCRIPT" , script_attr, HTML_SCRIPT_ATTRIBUTES, SGML_LITTERAL }, */ -#define T_SCRIPT 0x2000, 0x00000,0x00000,0x77F9F,0x77FFF,0x87F5F,0x00000 - /* { "SELECT" , select_attr, HTML_SELECT_ATTRIBUTES, SGML_MIXED }, */ -#define T_SELECT 0x0040, 0x08000,0x08000,0x03FAF,0x13FBF,0x80F5F,0x00008 + /* { "SCRIPT" , script_attr, HTML_SCRIPT_ATTRIBUTES, SGML_LITTERAL }, */ +#define T_SCRIPT 0x2000, 0x00000,0x00000,0x77F9F,0x77FFF,0x87F5F,0x00000 + /* { "SELECT" , select_attr, HTML_SELECT_ATTRIBUTES, SGML_MIXED }, */ +#define T_SELECT 0x0040, 0x08000,0x08000,0x03FAF,0x13FBF,0x80F5F,0x00008 #define T_SHY 0x1000, 0x00000,0x00000,0x3779F,0x77FBF,0x8101F,0x00001 /* { "SMALL" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ -#define T_SMALL 0x0001, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00001,0x00004 +#define T_SMALL 0x0001, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00001,0x00004 /* { "SPAN" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ #define T_SPAN 0x0002, 0x0B04F,0x0FFFF,0x2778F,0x77FBF,0x80003,0x00000 /* { "SPOT" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_EMPTY }, */ -#define T_SPOT 0x0008, 0x00000,0x00000,0x3FFF7,0x3FFF7,0x00008,0x00001 +#define T_SPOT 0x0008, 0x00000,0x00000,0x3FFF7,0x3FFF7,0x00008,0x00001 /* { "STRIKE" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ #define T_STRIKE 0x0001, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00001,0x00000 /* { "STRONG" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ #define T_STRONG 0x0002, 0x8B04F,0x8FFFF,0xA778F,0xF7FAF,0x00003,0x00000 /* { "STYLE" , style_attr, HTML_STYLE_ATTRIBUTES, SGML_LITTERAL }, */ -#define T_STYLE 0x40000,0x00000,0x00000,0x7638F,0x76FAF,0x8001F,0x00000 +#define T_STYLE 0x40000,0x00000,0x00000,0x7638F,0x76FAF,0x8001F,0x00000 /* { "SUB" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ -#define T_SUB 0x0004, 0x8B05F,0x8FFFF,0x8779F,0xF7FBF,0x00007,0x00000 +#define T_SUB 0x0004, 0x8B05F,0x8FFFF,0x8779F,0xF7FBF,0x00007,0x00000 /* { "SUP" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ #define T_SUP 0x0004, 0x8B05F,0x8FFFF,0x8779F,0xF7FBF,0x00007,0x00000 /* { "TAB" , tab_attr, HTML_TAB_ATTRIBUTES, SGML_EMPTY }, */ -#define T_TAB 0x1000, 0x00000,0x00000,0x3778F,0x57FAF,0x00001,0x00001 +#define T_TAB 0x1000, 0x00000,0x00000,0x3778F,0x57FAF,0x00001,0x00001 /* { "TABLE" , table_attr, HTML_TABLE_ATTRIBUTES, SGML_MIXED }, */ -#define T_TABLE 0x0800, 0x0F1E0,0x8FFFF,0x36680,0xB6FA7,0x8C57F,0x00000 +#define T_TABLE 0x0800, 0x0F1E0,0x8FFFF,0x36680,0xB6FA7,0x8C57F,0x00000 /* { "TBODY" , tr_attr, HTML_TR_ATTRIBUTES, SGML_EMPTY }, */ -#define T_TBODY 0x0020, 0x00020,0x8FFFF,0x00880,0xB7FB7,0x8C75F,0x00003 +#define T_TBODY 0x0020, 0x00020,0x8FFFF,0x00880,0xB7FB7,0x8C75F,0x00003 /* { "TD" , td_attr, HTML_TD_ATTRIBUTES, SGML_EMPTY }, */ #define T_TD 0x0400, 0x0FBCF,0x8FFFF,0x00020,0xB7FB7,0x8C75F,0x00001 /* { "TEXTAREA", textarea_attr,HTML_TEXTAREA_ATTRIBUTES, SGML_LITTERAL }, */ -#define T_TEXTAREA 0x0040, 0x00000,0x00000,0x07F8F,0x33FBF,0x80F5F,0x00000 +#define T_TEXTAREA 0x0040, 0x00000,0x00000,0x07F8F,0x33FBF,0x80F5F,0x00000 /* { "TEXTFLOW", bodytext_attr,HTML_BODYTEXT_ATTRIBUTES, SGML_MIXED }, */ #define T_TEXTFLOW 0x20000,0x8FBFF,0x9FFFF,0x977B0,0xB7FB7,0x9B00F,0x00003 /* { "TFOOT" , tr_attr, HTML_TR_ATTRIBUTES, SGML_EMPTY }, */ -#define T_TFOOT 0x0020, 0x00020,0x8FFFF,0x00800,0xB7FB7,0x8CF5F,0x00001 +#define T_TFOOT 0x0020, 0x00020,0x8FFFF,0x00800,0xB7FB7,0x8CF5F,0x00001 /* { "TH" , td_attr, HTML_TD_ATTRIBUTES, SGML_EMPTY }, */ -#define T_TH 0x0400, 0x0FBCF,0x0FFFF,0x00020,0xB7FB7,0x8CF5F,0x00001 +#define T_TH 0x0400, 0x0FBCF,0x0FFFF,0x00020,0xB7FB7,0x8CF5F,0x00001 /* { "THEAD" , tr_attr, HTML_TR_ATTRIBUTES, SGML_EMPTY }, */ -#define T_THEAD 0x0020, 0x00020,0x8FFFF,0x00880,0xB7FB7,0x8CF5F,0x00001 - /* { "TITLE", gen_attr, HTML_GEN_ATTRIBUTES, SGML_RCDATA }, */ -#define T_TITLE 0x40000,0x00000,0x00000,0x50000,0x50000,0x0031F,0x00004 +#define T_THEAD 0x0020, 0x00020,0x8FFFF,0x00880,0xB7FB7,0x8CF5F,0x00001 + /* { "TITLE", gen_attr, HTML_GEN_ATTRIBUTES, SGML_RCDATA }, */ +#define T_TITLE 0x40000,0x00000,0x00000,0x50000,0x50000,0x0031F,0x00004 /* { "TR" , tr_attr, HTML_TR_ATTRIBUTES, SGML_EMPTY }, */ #define T_TR 0x0020, 0x00400,0x8FFFF,0x00820,0xB7FB7,0x8C75F,0x00001 /* { "TT" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ -#define T_TT 0x0001, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00001,0x00000 +#define T_TT 0x0001, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00001,0x00000 /* { "U" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ -#define T_U 0x0001, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00001,0x00004 +#define T_U 0x0001, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00001,0x00004 /* { "UL" , ulist_attr, HTML_UL_ATTRIBUTES, SGML_MIXED }, */ -#define T_UL 0x0800, 0x0C480,0x8FFFF,0x36680,0xB7FFF,0x8075F,0x00000 +#define T_UL 0x0800, 0x0C480,0x8FFFF,0x36680,0xB7FFF,0x8075F,0x00000 /* { "VAR" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, */ #define T_VAR 0x0002, 0x8B04F,0x8FFFF,0xA778F,0xF7FBF,0x00001,0x00000 #define T_WBR 0x0001, 0x00000,0x00000,0x3778F,0x77FBF,0x8101F,0x00001 @@ -1636,15 +2409,15 @@ static attr ulist_attr[] = { /* UL attributes */ ** of the tags_old[] table (otherwise unchanged from original Lynx treatment) ** with the tags_new[] table below. - kw ** -** Name, Attributes, No. of attributes, content, extra info... +** Name, Attributes, No. of attributes, content, extra info... */ static HTTag tags_old[HTML_ELEMENTS] = { { "A" , a_attr, HTML_A_ATTRIBUTES, SGML_EMPTY,T_A}, { "ABBREV" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_ABBREV}, - { "ACRONYM" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_ACRONYM}, - { "ADDRESS" , address_attr, HTML_ADDRESS_ATTRIBUTES, SGML_MIXED,T_ADDRESS}, + { "ACRONYM" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_ACRONYM}, + { "ADDRESS" , address_attr, HTML_ADDRESS_ATTRIBUTES, SGML_MIXED,T_ADDRESS}, { "APPLET" , applet_attr, HTML_APPLET_ATTRIBUTES, SGML_MIXED,T_APPLET}, - { "AREA" , area_attr, HTML_AREA_ATTRIBUTES, SGML_EMPTY,T_AREA}, + { "AREA" , area_attr, HTML_AREA_ATTRIBUTES, SGML_EMPTY,T_AREA}, { "AU" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_AU}, { "AUTHOR" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_AUTHOR}, { "B" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_EMPTY,T_B}, @@ -1652,7 +2425,7 @@ static HTTag tags_old[HTML_ELEMENTS] = { { "BASE" , base_attr, HTML_BASE_ATTRIBUTES, SGML_EMPTY,T_BASE}, { "BASEFONT", font_attr, HTML_FONT_ATTRIBUTES, SGML_EMPTY,T_BASEFONT}, { "BDO" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_BDO}, - { "BGSOUND" , bgsound_attr, HTML_BGSOUND_ATTRIBUTES, SGML_EMPTY,T_BGSOUND}, + { "BGSOUND" , bgsound_attr, HTML_BGSOUND_ATTRIBUTES, SGML_EMPTY,T_BGSOUND}, { "BIG" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_BIG}, { "BLINK" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_EMPTY,T_BLINK}, { "BLOCKQUOTE", bq_attr, HTML_BQ_ATTRIBUTES, SGML_MIXED,T_BLOCKQUOTE}, @@ -1660,15 +2433,15 @@ static HTTag tags_old[HTML_ELEMENTS] = { { "BODYTEXT", bodytext_attr,HTML_BODYTEXT_ATTRIBUTES, SGML_MIXED,T_BODYTEXT}, { "BQ" , bq_attr, HTML_BQ_ATTRIBUTES, SGML_MIXED,T_BQ}, { "BR" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_EMPTY,T_BR}, - { "BUTTON" , button_attr, HTML_BUTTON_ATTRIBUTES, SGML_MIXED,T_BUTTON}, - { "CAPTION" , caption_attr, HTML_CAPTION_ATTRIBUTES, SGML_MIXED,T_CAPTION}, + { "BUTTON" , button_attr, HTML_BUTTON_ATTRIBUTES, SGML_MIXED,T_BUTTON}, + { "CAPTION" , caption_attr, HTML_CAPTION_ATTRIBUTES, SGML_MIXED,T_CAPTION}, { "CENTER" , div_attr, HTML_DIV_ATTRIBUTES, SGML_MIXED,T_CENTER}, { "CITE" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_EMPTY,T_CITE}, { "CODE" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_CODE}, { "COL" , col_attr, HTML_COL_ATTRIBUTES, SGML_EMPTY,T_COL}, { "COLGROUP", col_attr, HTML_COL_ATTRIBUTES, SGML_EMPTY,T_COLGROUP}, - { "COMMENT" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_COMMENT}, - { "CREDIT" , credit_attr, HTML_CREDIT_ATTRIBUTES, SGML_MIXED,T_CREDIT}, + { "COMMENT" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_COMMENT}, + { "CREDIT" , credit_attr, HTML_CREDIT_ATTRIBUTES, SGML_MIXED,T_CREDIT}, { "DD" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_EMPTY,T_DD}, { "DEL" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_DEL}, { "DFN" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_DFN}, @@ -1697,31 +2470,31 @@ static HTTag tags_old[HTML_ELEMENTS] = { { "HTML" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_HTML}, { "HY" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_EMPTY,T_HY}, { "I" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_EMPTY,T_I}, - { "IFRAME" , iframe_attr, HTML_IFRAME_ATTRIBUTES, SGML_MIXED,T_IFRAME}, - { "IMG" , img_attr, HTML_IMG_ATTRIBUTES, SGML_EMPTY,T_IMG}, - { "INPUT" , input_attr, HTML_INPUT_ATTRIBUTES, SGML_EMPTY,T_INPUT}, + { "IFRAME" , iframe_attr, HTML_IFRAME_ATTRIBUTES, SGML_MIXED,T_IFRAME}, + { "IMG" , img_attr, HTML_IMG_ATTRIBUTES, SGML_EMPTY,T_IMG}, + { "INPUT" , input_attr, HTML_INPUT_ATTRIBUTES, SGML_EMPTY,T_INPUT}, { "INS" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_INS}, - { "ISINDEX" , isindex_attr, HTML_ISINDEX_ATTRIBUTES,SGML_EMPTY,T_ISINDEX}, + { "ISINDEX" , isindex_attr, HTML_ISINDEX_ATTRIBUTES,SGML_EMPTY,T_ISINDEX}, { "KBD" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_KBD}, - { "KEYGEN" , keygen_attr, HTML_KEYGEN_ATTRIBUTES, SGML_EMPTY,T_KEYGEN}, + { "KEYGEN" , keygen_attr, HTML_KEYGEN_ATTRIBUTES, SGML_EMPTY,T_KEYGEN}, { "LABEL" , label_attr, HTML_LABEL_ATTRIBUTES, SGML_MIXED,T_LABEL}, - { "LEGEND" , legend_attr, HTML_LEGEND_ATTRIBUTES, SGML_MIXED,T_LEGEND}, + { "LEGEND" , legend_attr, HTML_LEGEND_ATTRIBUTES, SGML_MIXED,T_LEGEND}, { "LH" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_EMPTY,T_LH}, { "LI" , list_attr, HTML_LI_ATTRIBUTES, SGML_EMPTY,T_LI}, { "LINK" , link_attr, HTML_LINK_ATTRIBUTES, SGML_EMPTY,T_LINK}, - { "LISTING" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_LITTERAL,T_LISTING}, + { "LISTING" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_LITTERAL,T_LISTING}, { "MAP" , map_attr, HTML_MAP_ATTRIBUTES, SGML_MIXED,T_MAP}, - { "MARQUEE" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_MARQUEE}, + { "MARQUEE" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_MARQUEE}, { "MATH" , math_attr, HTML_MATH_ATTRIBUTES, SGML_LITTERAL,T_MATH}, { "MENU" , ulist_attr, HTML_UL_ATTRIBUTES, SGML_MIXED,T_MENU}, { "META" , meta_attr, HTML_META_ATTRIBUTES, SGML_EMPTY,T_META}, - { "NEXTID" , nextid_attr, 1, SGML_EMPTY,T_NEXTID}, + { "NEXTID" , nextid_attr, 1, SGML_EMPTY,T_NEXTID}, { "NOFRAMES", gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_NOFRAMES}, { "NOTE" , note_attr, HTML_NOTE_ATTRIBUTES, SGML_MIXED,T_NOTE}, - { "OBJECT" , object_attr, HTML_OBJECT_ATTRIBUTES, SGML_LITTERAL,T_OBJECT}, + { "OBJECT" , object_attr, HTML_OBJECT_ATTRIBUTES, SGML_LITTERAL,T_OBJECT}, { "OL" , olist_attr, HTML_OL_ATTRIBUTES, SGML_MIXED,T_OL}, - { "OPTION" , option_attr, HTML_OPTION_ATTRIBUTES, SGML_EMPTY,T_OPTION}, - { "OVERLAY" , overlay_attr, HTML_OVERLAY_ATTRIBUTES, SGML_EMPTY,T_OVERLAY}, + { "OPTION" , option_attr, HTML_OPTION_ATTRIBUTES, SGML_EMPTY,T_OPTION}, + { "OVERLAY" , overlay_attr, HTML_OVERLAY_ATTRIBUTES, SGML_EMPTY,T_OVERLAY}, { "P" , p_attr, HTML_P_ATTRIBUTES, SGML_EMPTY,T_P}, { "PARAM" , param_attr, HTML_PARAM_ATTRIBUTES, SGML_EMPTY,T_PARAM}, { "PLAINTEXT", gen_attr, HTML_GEN_ATTRIBUTES, SGML_LITTERAL,T_PLAINTEXT}, @@ -1729,8 +2502,8 @@ static HTTag tags_old[HTML_ELEMENTS] = { { "Q" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_Q}, { "S" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_S}, { "SAMP" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_SAMP}, - { "SCRIPT" , script_attr, HTML_SCRIPT_ATTRIBUTES, SGML_LITTERAL,T_SCRIPT}, - { "SELECT" , select_attr, HTML_SELECT_ATTRIBUTES, SGML_MIXED,T_SELECT}, + { "SCRIPT" , script_attr, HTML_SCRIPT_ATTRIBUTES, SGML_LITTERAL,T_SCRIPT}, + { "SELECT" , select_attr, HTML_SELECT_ATTRIBUTES, SGML_MIXED,T_SELECT}, { "SHY" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_EMPTY,T_SHY}, { "SMALL" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_SMALL}, { "SPAN" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_SPAN}, @@ -1749,7 +2522,7 @@ static HTTag tags_old[HTML_ELEMENTS] = { { "TFOOT" , tr_attr, HTML_TR_ATTRIBUTES, SGML_EMPTY,T_TFOOT}, { "TH" , td_attr, HTML_TD_ATTRIBUTES, SGML_EMPTY,T_TH}, { "THEAD" , tr_attr, HTML_TR_ATTRIBUTES, SGML_EMPTY,T_THEAD}, - { "TITLE", gen_attr, HTML_GEN_ATTRIBUTES, SGML_RCDATA,T_TITLE}, + { "TITLE", gen_attr, HTML_GEN_ATTRIBUTES, SGML_RCDATA,T_TITLE}, { "TR" , tr_attr, HTML_TR_ATTRIBUTES, SGML_EMPTY,T_TR}, { "TT" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_EMPTY,T_TT}, { "U" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_EMPTY,T_U}, @@ -1762,10 +2535,10 @@ static HTTag tags_old[HTML_ELEMENTS] = { static HTTag tags_new[HTML_ELEMENTS] = { { "A" , a_attr, HTML_A_ATTRIBUTES, SGML_MIXED,T_A}, { "ABBREV" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_ABBREV}, - { "ACRONYM" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_ACRONYM}, - { "ADDRESS" , address_attr, HTML_ADDRESS_ATTRIBUTES, SGML_MIXED,T_ADDRESS}, + { "ACRONYM" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_ACRONYM}, + { "ADDRESS" , address_attr, HTML_ADDRESS_ATTRIBUTES, SGML_MIXED,T_ADDRESS}, { "APPLET" , applet_attr, HTML_APPLET_ATTRIBUTES, SGML_MIXED,T_APPLET}, - { "AREA" , area_attr, HTML_AREA_ATTRIBUTES, SGML_EMPTY,T_AREA}, + { "AREA" , area_attr, HTML_AREA_ATTRIBUTES, SGML_EMPTY,T_AREA}, { "AU" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_AU}, { "AUTHOR" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_AUTHOR}, { "B" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_B}, @@ -1773,7 +2546,7 @@ static HTTag tags_new[HTML_ELEMENTS] = { { "BASE" , base_attr, HTML_BASE_ATTRIBUTES, SGML_EMPTY,T_BASE}, { "BASEFONT", font_attr, HTML_FONT_ATTRIBUTES, SGML_EMPTY,T_BASEFONT}, { "BDO" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_BDO}, - { "BGSOUND" , bgsound_attr, HTML_BGSOUND_ATTRIBUTES, SGML_EMPTY,T_BGSOUND}, + { "BGSOUND" , bgsound_attr, HTML_BGSOUND_ATTRIBUTES, SGML_EMPTY,T_BGSOUND}, { "BIG" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_BIG}, { "BLINK" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_BLINK}, { "BLOCKQUOTE", bq_attr, HTML_BQ_ATTRIBUTES, SGML_MIXED,T_BLOCKQUOTE}, @@ -1781,15 +2554,15 @@ static HTTag tags_new[HTML_ELEMENTS] = { { "BODYTEXT", bodytext_attr,HTML_BODYTEXT_ATTRIBUTES, SGML_MIXED,T_BODYTEXT}, { "BQ" , bq_attr, HTML_BQ_ATTRIBUTES, SGML_MIXED,T_BQ}, { "BR" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_EMPTY,T_BR}, - { "BUTTON" , button_attr, HTML_BUTTON_ATTRIBUTES, SGML_MIXED,T_BUTTON}, - { "CAPTION" , caption_attr, HTML_CAPTION_ATTRIBUTES, SGML_MIXED,T_CAPTION}, + { "BUTTON" , button_attr, HTML_BUTTON_ATTRIBUTES, SGML_MIXED,T_BUTTON}, + { "CAPTION" , caption_attr, HTML_CAPTION_ATTRIBUTES, SGML_MIXED,T_CAPTION}, { "CENTER" , div_attr, HTML_DIV_ATTRIBUTES, SGML_MIXED,T_CENTER}, { "CITE" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_CITE}, { "CODE" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_CODE}, { "COL" , col_attr, HTML_COL_ATTRIBUTES, SGML_EMPTY,T_COL}, { "COLGROUP", col_attr, HTML_COL_ATTRIBUTES, SGML_ELEMENT,T_COLGROUP}, - { "COMMENT" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_PCDATA,T_COMMENT}, - { "CREDIT" , credit_attr, HTML_CREDIT_ATTRIBUTES, SGML_MIXED,T_CREDIT}, + { "COMMENT" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_PCDATA,T_COMMENT}, + { "CREDIT" , credit_attr, HTML_CREDIT_ATTRIBUTES, SGML_MIXED,T_CREDIT}, { "DD" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_DD}, { "DEL" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_DEL}, { "DFN" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_DFN}, @@ -1818,31 +2591,31 @@ static HTTag tags_new[HTML_ELEMENTS] = { { "HTML" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_HTML}, { "HY" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_EMPTY,T_HY}, { "I" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_I}, - { "IFRAME" , iframe_attr, HTML_IFRAME_ATTRIBUTES, SGML_MIXED,T_IFRAME}, - { "IMG" , img_attr, HTML_IMG_ATTRIBUTES, SGML_EMPTY,T_IMG}, - { "INPUT" , input_attr, HTML_INPUT_ATTRIBUTES, SGML_EMPTY,T_INPUT}, + { "IFRAME" , iframe_attr, HTML_IFRAME_ATTRIBUTES, SGML_MIXED,T_IFRAME}, + { "IMG" , img_attr, HTML_IMG_ATTRIBUTES, SGML_EMPTY,T_IMG}, + { "INPUT" , input_attr, HTML_INPUT_ATTRIBUTES, SGML_EMPTY,T_INPUT}, { "INS" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_INS}, - { "ISINDEX" , isindex_attr, HTML_ISINDEX_ATTRIBUTES,SGML_EMPTY,T_ISINDEX}, + { "ISINDEX" , isindex_attr, HTML_ISINDEX_ATTRIBUTES,SGML_EMPTY,T_ISINDEX}, { "KBD" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_KBD}, - { "KEYGEN" , keygen_attr, HTML_KEYGEN_ATTRIBUTES, SGML_EMPTY,T_KEYGEN}, + { "KEYGEN" , keygen_attr, HTML_KEYGEN_ATTRIBUTES, SGML_EMPTY,T_KEYGEN}, { "LABEL" , label_attr, HTML_LABEL_ATTRIBUTES, SGML_MIXED,T_LABEL}, - { "LEGEND" , legend_attr, HTML_LEGEND_ATTRIBUTES, SGML_MIXED,T_LEGEND}, + { "LEGEND" , legend_attr, HTML_LEGEND_ATTRIBUTES, SGML_MIXED,T_LEGEND}, { "LH" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_LH}, { "LI" , list_attr, HTML_LI_ATTRIBUTES, SGML_MIXED,T_LI}, { "LINK" , link_attr, HTML_LINK_ATTRIBUTES, SGML_EMPTY,T_LINK}, - { "LISTING" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_LITTERAL,T_LISTING}, + { "LISTING" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_LITTERAL,T_LISTING}, { "MAP" , map_attr, HTML_MAP_ATTRIBUTES, SGML_ELEMENT,T_MAP}, - { "MARQUEE" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_MARQUEE}, + { "MARQUEE" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_MARQUEE}, { "MATH" , math_attr, HTML_MATH_ATTRIBUTES, SGML_LITTERAL,T_MATH}, { "MENU" , ulist_attr, HTML_UL_ATTRIBUTES, SGML_MIXED,T_MENU}, { "META" , meta_attr, HTML_META_ATTRIBUTES, SGML_EMPTY,T_META}, - { "NEXTID" , nextid_attr, 1, SGML_EMPTY,T_NEXTID}, + { "NEXTID" , nextid_attr, 1, SGML_EMPTY,T_NEXTID}, { "NOFRAMES", gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_NOFRAMES}, { "NOTE" , note_attr, HTML_NOTE_ATTRIBUTES, SGML_MIXED,T_NOTE}, - { "OBJECT" , object_attr, HTML_OBJECT_ATTRIBUTES, SGML_LITTERAL,T_OBJECT}, + { "OBJECT" , object_attr, HTML_OBJECT_ATTRIBUTES, SGML_LITTERAL,T_OBJECT}, { "OL" , olist_attr, HTML_OL_ATTRIBUTES, SGML_MIXED,T_OL}, - { "OPTION" , option_attr, HTML_OPTION_ATTRIBUTES, SGML_PCDATA,T_OPTION}, - { "OVERLAY" , overlay_attr, HTML_OVERLAY_ATTRIBUTES, SGML_PCDATA,T_OVERLAY}, + { "OPTION" , option_attr, HTML_OPTION_ATTRIBUTES, SGML_PCDATA,T_OPTION}, + { "OVERLAY" , overlay_attr, HTML_OVERLAY_ATTRIBUTES, SGML_PCDATA,T_OVERLAY}, { "P" , p_attr, HTML_P_ATTRIBUTES, SGML_MIXED,T_P}, { "PARAM" , param_attr, HTML_PARAM_ATTRIBUTES, SGML_EMPTY,T_PARAM}, { "PLAINTEXT", gen_attr, HTML_GEN_ATTRIBUTES, SGML_LITTERAL,T_PLAINTEXT}, @@ -1850,8 +2623,8 @@ static HTTag tags_new[HTML_ELEMENTS] = { { "Q" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_Q}, { "S" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_S}, { "SAMP" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_SAMP}, - { "SCRIPT" , script_attr, HTML_SCRIPT_ATTRIBUTES, SGML_LITTERAL,T_SCRIPT}, - { "SELECT" , select_attr, HTML_SELECT_ATTRIBUTES, SGML_ELEMENT,T_SELECT}, + { "SCRIPT" , script_attr, HTML_SCRIPT_ATTRIBUTES, SGML_LITTERAL,T_SCRIPT}, + { "SELECT" , select_attr, HTML_SELECT_ATTRIBUTES, SGML_ELEMENT,T_SELECT}, { "SHY" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_EMPTY,T_SHY}, { "SMALL" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_SMALL}, { "SPAN" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_SPAN}, @@ -1870,7 +2643,7 @@ static HTTag tags_new[HTML_ELEMENTS] = { { "TFOOT" , tr_attr, HTML_TR_ATTRIBUTES, SGML_ELEMENT,T_TFOOT}, { "TH" , td_attr, HTML_TD_ATTRIBUTES, SGML_MIXED,T_TH}, { "THEAD" , tr_attr, HTML_TR_ATTRIBUTES, SGML_ELEMENT,T_THEAD}, - { "TITLE", gen_attr, HTML_GEN_ATTRIBUTES, SGML_PCDATA,T_TITLE}, + { "TITLE" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_PCDATA,T_TITLE}, { "TR" , tr_attr, HTML_TR_ATTRIBUTES, SGML_MIXED,T_TR}, { "TT" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_TT}, { "U" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED,T_U}, @@ -1934,48 +2707,48 @@ struct _HTStructured { }; PUBLIC void HTStartAnchor ARGS3( - HTStructured *, obj, + HTStructured *, obj, CONST char *, name, 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++) present[i] = NO; if (name && *name) { - present[HTML_A_NAME] = YES; + present[HTML_A_NAME] = YES; value[HTML_A_NAME] = (CONST char *)name; } if (href) { - present[HTML_A_HREF] = YES; - value[HTML_A_HREF] = (CONST char *)href; + present[HTML_A_HREF] = YES; + value[HTML_A_HREF] = (CONST char *)href; } (*obj->isa->start_element)(obj, HTML_A, present, value, -1, 0); } PUBLIC void HTStartIsIndex ARGS3( - HTStructured *, obj, + HTStructured *, obj, CONST char *, prompt, CONST char *, href) { BOOL present[HTML_ISINDEX_ATTRIBUTES]; - CONST char * value[HTML_ISINDEX_ATTRIBUTES]; + CONST char * value[HTML_ISINDEX_ATTRIBUTES]; int i; for (i = 0; i < HTML_ISINDEX_ATTRIBUTES; i++) present[i] = NO; if (prompt && *prompt) { - present[HTML_ISINDEX_PROMPT] = YES; + present[HTML_ISINDEX_PROMPT] = YES; value[HTML_ISINDEX_PROMPT] = (CONST char *)prompt; } if (href) { - present[HTML_ISINDEX_HREF] = YES; - value[HTML_ISINDEX_HREF] = (CONST char *)href; + present[HTML_ISINDEX_HREF] = YES; + value[HTML_ISINDEX_HREF] = (CONST char *)href; } (*obj->isa->start_element)(obj, HTML_ISINDEX , present, value, -1, 0); diff --git a/WWW/Library/Implementation/HTMLDTD.h b/WWW/Library/Implementation/HTMLDTD.h index 1e5646fd..15004a1d 100644 --- a/WWW/Library/Implementation/HTMLDTD.h +++ b/WWW/Library/Implementation/HTMLDTD.h @@ -1,15 +1,14 @@ -/* The HTML DTD -- software interface in libwww - HTML DTD - SOFTWARE INTERFACE - +/* The HTML DTD -- software interface in libwww + HTML DTD - SOFTWARE INTERFACE + SGML purists should excuse the use of the term "DTD" in this file to represent DTD-related information which is not exactly a DTD itself. - + The C modular structure doesn't work very well here, as the dtd is partly in the .h and partly in the .c which are not very independent. Tant pis. - - */ + */ #ifndef HTMLDTD_H #define HTMLDTD_H @@ -41,24 +40,24 @@ Element Numbers Must Match all tables by element! These include tables in HTMLDTD.c and code in HTML.c. - + */ typedef enum _HTMLElement { - HTML_A, - HTML_ABBREV, - HTML_ACRONYM, - HTML_ADDRESS, + HTML_A, + HTML_ABBREV, + HTML_ACRONYM, + HTML_ADDRESS, HTML_APPLET, HTML_AREA, - HTML_AU, - HTML_AUTHOR, - HTML_B, + HTML_AU, + HTML_AUTHOR, + HTML_B, HTML_BANNER, HTML_BASE, HTML_BASEFONT, - HTML_BDO, + HTML_BDO, HTML_BGSOUND, - HTML_BIG, + HTML_BIG, HTML_BLINK, HTML_BLOCKQUOTE, HTML_BODY, @@ -66,7 +65,7 @@ typedef enum _HTMLElement { HTML_BQ, HTML_BR, HTML_BUTTON, - HTML_CAPTION, + HTML_CAPTION, HTML_CENTER, HTML_CITE, HTML_CODE, @@ -74,15 +73,15 @@ typedef enum _HTMLElement { HTML_COLGROUP, HTML_COMMENT, HTML_CREDIT, - HTML_DD, - HTML_DEL, + HTML_DD, + HTML_DEL, HTML_DFN, HTML_DIR, HTML_DIV, - HTML_DL, + HTML_DL, HTML_DLC, HTML_DT, - HTML_EM, + HTML_EM, HTML_EMBED, HTML_FIELDSET, HTML_FIG, @@ -91,7 +90,7 @@ typedef enum _HTMLElement { HTML_FORM, HTML_FRAME, HTML_FRAMESET, - HTML_H1, + HTML_H1, HTML_H2, HTML_H3, HTML_H4, @@ -101,21 +100,21 @@ typedef enum _HTMLElement { HTML_HR, HTML_HTML, HTML_HY, - HTML_I, - HTML_IFRAME, + HTML_I, + HTML_IFRAME, HTML_IMG, HTML_INPUT, - HTML_INS, + HTML_INS, HTML_ISINDEX, - HTML_KBD, - HTML_KEYGEN, + HTML_KBD, + HTML_KEYGEN, HTML_LABEL, HTML_LEGEND, HTML_LH, HTML_LI, HTML_LINK, HTML_LISTING, - HTML_MAP, + HTML_MAP, HTML_MARQUEE, HTML_MATH, HTML_MENU, @@ -123,8 +122,8 @@ typedef enum _HTMLElement { HTML_NEXTID, HTML_NOFRAMES, HTML_NOTE, - HTML_OBJECT, - HTML_OL, + HTML_OBJECT, + HTML_OL, HTML_OPTION, HTML_OVERLAY, HTML_P, @@ -132,19 +131,19 @@ typedef enum _HTMLElement { HTML_PLAINTEXT, HTML_PRE, HTML_Q, - HTML_S, - HTML_SAMP, + HTML_S, + HTML_SAMP, HTML_SCRIPT, HTML_SELECT, HTML_SHY, - HTML_SMALL, + HTML_SMALL, HTML_SPAN, HTML_SPOT, HTML_STRIKE, HTML_STRONG, HTML_STYLE, - HTML_SUB, - HTML_SUP, + HTML_SUB, + HTML_SUP, HTML_TAB, HTML_TABLE, HTML_TBODY, @@ -157,10 +156,10 @@ typedef enum _HTMLElement { HTML_TITLE, HTML_TR, HTML_TT, - HTML_U, + HTML_U, HTML_UL, - HTML_VAR, - HTML_WBR, + HTML_VAR, + HTML_WBR, HTML_XMP } HTMLElement; #define HTML_ELEMENTS 118 @@ -175,10 +174,10 @@ Attribute numbers Identifier is HTML_<element>_<attribute>. These must match the tables in HTML.c! - + */ #define HTML_A_ACCESSKEY 0 -#define HTML_A_CHARSET 1 /* RFC 2070 HTML i18n - kw */ +#define HTML_A_CHARSET 1 /* i18n draft, added tentatively - KW */ #define HTML_A_CLASS 2 #define HTML_A_CLEAR 3 #define HTML_A_COORDS 4 @@ -214,47 +213,47 @@ Attribute numbers #define HTML_ADDRESS_TITLE 7 #define HTML_ADDRESS_ATTRIBUTES 8 -#define HTML_APPLET_ALIGN 0 -#define HTML_APPLET_ALT 1 -#define HTML_APPLET_CLASS 2 -#define HTML_APPLET_CLEAR 3 -#define HTML_APPLET_CODE 4 -#define HTML_APPLET_CODEBASE 5 -#define HTML_APPLET_DIR 6 -#define HTML_APPLET_DOWNLOAD 7 -#define HTML_APPLET_HEIGHT 8 -#define HTML_APPLET_HSPACE 9 -#define HTML_APPLET_ID 10 -#define HTML_APPLET_LANG 11 -#define HTML_APPLET_NAME 12 -#define HTML_APPLET_STYLE 13 -#define HTML_APPLET_TITLE 14 -#define HTML_APPLET_VSPACE 15 -#define HTML_APPLET_WIDTH 16 -#define HTML_APPLET_ATTRIBUTES 17 - -#define HTML_AREA_ALT 0 -#define HTML_AREA_CLASS 1 -#define HTML_AREA_CLEAR 2 -#define HTML_AREA_COORDS 3 -#define HTML_AREA_DIR 4 -#define HTML_AREA_HREF 5 -#define HTML_AREA_ID 6 -#define HTML_AREA_LANG 7 -#define HTML_AREA_NOHREF 8 -#define HTML_AREA_NONOTAB 9 -#define HTML_AREA_ONCLICK 10 -#define HTML_AREA_ONMOUSEOUT 11 -#define HTML_AREA_ONMOUSEOVER 12 -#define HTML_AREA_SHAPE 13 -#define HTML_AREA_STYLE 14 -#define HTML_AREA_TABINDEX 15 -#define HTML_AREA_TARGET 16 -#define HTML_AREA_TITLE 17 -#define HTML_AREA_ATTRIBUTES 18 +#define HTML_APPLET_ALIGN 0 +#define HTML_APPLET_ALT 1 +#define HTML_APPLET_CLASS 2 +#define HTML_APPLET_CLEAR 3 +#define HTML_APPLET_CODE 4 +#define HTML_APPLET_CODEBASE 5 +#define HTML_APPLET_DIR 6 +#define HTML_APPLET_DOWNLOAD 7 +#define HTML_APPLET_HEIGHT 8 +#define HTML_APPLET_HSPACE 9 +#define HTML_APPLET_ID 10 +#define HTML_APPLET_LANG 11 +#define HTML_APPLET_NAME 12 +#define HTML_APPLET_STYLE 13 +#define HTML_APPLET_TITLE 14 +#define HTML_APPLET_VSPACE 15 +#define HTML_APPLET_WIDTH 16 +#define HTML_APPLET_ATTRIBUTES 17 + +#define HTML_AREA_ALT 0 +#define HTML_AREA_CLASS 1 +#define HTML_AREA_CLEAR 2 +#define HTML_AREA_COORDS 3 +#define HTML_AREA_DIR 4 +#define HTML_AREA_HREF 5 +#define HTML_AREA_ID 6 +#define HTML_AREA_LANG 7 +#define HTML_AREA_NOHREF 8 +#define HTML_AREA_NONOTAB 9 +#define HTML_AREA_ONCLICK 10 +#define HTML_AREA_ONMOUSEOUT 11 +#define HTML_AREA_ONMOUSEOVER 12 +#define HTML_AREA_SHAPE 13 +#define HTML_AREA_STYLE 14 +#define HTML_AREA_TABINDEX 15 +#define HTML_AREA_TARGET 16 +#define HTML_AREA_TITLE 17 +#define HTML_AREA_ATTRIBUTES 18 #define HTML_BASE_HREF 0 -#define HTML_BASE_TARGET 1 +#define HTML_BASE_TARGET 1 #define HTML_BASE_TITLE 2 #define HTML_BASE_ATTRIBUTES 3 @@ -312,20 +311,20 @@ Attribute numbers #define HTML_BQ_TITLE 7 #define HTML_BQ_ATTRIBUTES 8 -#define HTML_BUTTON_CLASS 0 -#define HTML_BUTTON_CLEAR 1 -#define HTML_BUTTON_DIR 2 -#define HTML_BUTTON_DISABLED 3 -#define HTML_BUTTON_ID 4 -#define HTML_BUTTON_LANG 5 -#define HTML_BUTTON_NAME 6 -#define HTML_BUTTON_ONFOCUS 7 -#define HTML_BUTTON_ONBLUR 8 -#define HTML_BUTTON_STYLE 9 -#define HTML_BUTTON_TABINDEX 10 -#define HTML_BUTTON_TITLE 11 -#define HTML_BUTTON_TYPE 12 -#define HTML_BUTTON_VALUE 13 +#define HTML_BUTTON_CLASS 0 +#define HTML_BUTTON_CLEAR 1 +#define HTML_BUTTON_DIR 2 +#define HTML_BUTTON_DISABLED 3 +#define HTML_BUTTON_ID 4 +#define HTML_BUTTON_LANG 5 +#define HTML_BUTTON_NAME 6 +#define HTML_BUTTON_ONFOCUS 7 +#define HTML_BUTTON_ONBLUR 8 +#define HTML_BUTTON_STYLE 9 +#define HTML_BUTTON_TABINDEX 10 +#define HTML_BUTTON_TITLE 11 +#define HTML_BUTTON_TYPE 12 +#define HTML_BUTTON_VALUE 13 #define HTML_BUTTON_ATTRIBUTES 14 #define HTML_CAPTION_ACCESSKEY 0 @@ -447,13 +446,12 @@ Attribute numbers #define HTML_FONT_CLEAR 1 #define HTML_FONT_COLOR 2 #define HTML_FONT_DIR 3 -#define HTML_FONT_END 4 -#define HTML_FONT_FACE 5 -#define HTML_FONT_ID 6 -#define HTML_FONT_LANG 7 -#define HTML_FONT_SIZE 8 -#define HTML_FONT_STYLE 9 -#define HTML_FONT_ATTRIBUTES 10 +#define HTML_FONT_FACE 4 +#define HTML_FONT_ID 5 +#define HTML_FONT_LANG 6 +#define HTML_FONT_SIZE 7 +#define HTML_FONT_STYLE 8 +#define HTML_FONT_ATTRIBUTES 9 #define HTML_FORM_ACCEPT_CHARSET 0 /* HTML 4.0 draft - kw */ #define HTML_FORM_ACTION 1 @@ -468,7 +466,7 @@ Attribute numbers #define HTML_FORM_SCRIPT 10 #define HTML_FORM_STYLE 11 #define HTML_FORM_SUBJECT 12 -#define HTML_FORM_TARGET 13 +#define HTML_FORM_TARGET 13 #define HTML_FORM_TITLE 14 #define HTML_FORM_ATTRIBUTES 15 @@ -656,7 +654,7 @@ Attribute numbers #define HTML_LINK_REL 5 #define HTML_LINK_REV 6 #define HTML_LINK_STYLE 7 -#define HTML_LINK_TARGET 8 +#define HTML_LINK_TARGET 8 #define HTML_LINK_TITLE 9 #define HTML_LINK_TYPE 10 #define HTML_LINK_ATTRIBUTES 11 @@ -686,7 +684,7 @@ Attribute numbers #define HTML_META_NAME 2 #define HTML_META_ATTRIBUTES 3 -#define NEXTID_N 0 +#define NEXTID_N 0 #define HTML_NOTE_CLASS 0 #define HTML_NOTE_CLEAR 1 @@ -966,19 +964,19 @@ Start anchor element It is kinda convenient to have a particular routine for starting an anchor element, as everything else for HTML is simple anyway. - + ON ENTRY - + targetstream points to a structured stream object. - + name and href point to attribute strings or are NULL if the attribute is to be omitted. - + */ extern void HTStartAnchor PARAMS(( - HTStructured * targetstream, - CONST char * name, - CONST char * href)); + HTStructured * targetstream, + CONST char * name, + CONST char * href)); /* @@ -986,19 +984,19 @@ Start IsIndex element - FM It is kinda convenient to have a particular routine for starting an IsIndex element with the prompt and/or href (action) attributes specified. - + ON ENTRY - + targetstream points to a structured stream object. - + prompt and href point to attribute strings or are NULL if the attribute is to be omitted. - + */ extern void HTStartIsIndex PARAMS(( - HTStructured * targetstream, - CONST char * prompt, - CONST char * href)); + HTStructured * targetstream, + CONST char * prompt, + CONST char * href)); #endif /* HTMLDTD_H */ diff --git a/WWW/Library/Implementation/HTMLGen.c b/WWW/Library/Implementation/HTMLGen.c index 375b619c..a20ad2ad 100644 --- a/WWW/Library/Implementation/HTMLGen.c +++ b/WWW/Library/Implementation/HTMLGen.c @@ -8,7 +8,7 @@ ** Should convert old XMP, LISTING and PLAINTEXT to PRE. ** ** It is not obvious to me right now whether the HEAD should be generated -** from the incomming data or the anchor. Currently it is from the former +** from the incomming data or the anchor. Currently it is from the former ** which is cleanest. */ @@ -40,23 +40,23 @@ ** ----------- */ struct _HTStream { - CONST HTStreamClass * isa; - HTStream * target; + CONST HTStreamClass * isa; + HTStream * target; HTStreamClass targetClass; /* COPY for speed */ }; struct _HTStructured { CONST HTStructuredClass * isa; - HTStream * target; + HTStream * target; HTStreamClass targetClass; /* COPY for speed */ - + char buffer[BUFFER_SIZE+1]; /* 1for NL */ - int buffer_maxchars; + int buffer_maxchars; char * write_pointer; - char * line_break [MAX_CLEANNESS+1]; + char * line_break [MAX_CLEANNESS+1]; int cleanness; BOOL overflowed; - BOOL delete_line_break_char[MAX_CLEANNESS+1]; + BOOL delete_line_break_char[MAX_CLEANNESS+1]; BOOL preformatted; BOOL escape_specials; BOOL in_attrval; @@ -67,18 +67,18 @@ struct _HTStructured { */ PRIVATE void flush_breaks ARGS1( - HTStructured *, me) + HTStructured *, me) { int i; for (i=0; i<= MAX_CLEANNESS; i++) { - me->line_break[i] = NULL; + me->line_break[i] = NULL; } } PRIVATE void HTMLGen_flush ARGS1( - HTStructured *, me) + HTStructured *, me) { - (*me->targetClass.put_block)(me->target, + (*me->targetClass.put_block)(me->target, me->buffer, me->write_pointer - me->buffer); me->write_pointer = me->buffer; @@ -93,12 +93,12 @@ PRIVATE void HTMLGen_flush ARGS1( */ PRIVATE void allow_break ARGS3( - HTStructured *, me, + HTStructured *, me, int, new_cleanness, BOOL, dlbc) { if (dlbc && me->write_pointer == me->buffer) dlbc = NO; - me->line_break[new_cleanness] = + me->line_break[new_cleanness] = dlbc ? me->write_pointer - 1 /* Point to space */ : me->write_pointer ; /* point to gap */ me->delete_line_break_char[new_cleanness] = dlbc; @@ -121,7 +121,7 @@ PRIVATE void allow_break ARGS3( ** by hand, too, though this is not a primary design consideration. TBL */ PRIVATE void HTMLGen_put_character ARGS2( - HTStructured *, me, + HTStructured *, me, char, c) { if (me->escape_specials && (unsigned char)c < 32) { @@ -149,18 +149,18 @@ PRIVATE void HTMLGen_put_character ARGS2( c = ';'; } } - + *me->write_pointer++ = c; - + if (c == '\n') { - HTMLGen_flush(me); + HTMLGen_flush(me); return; } - + /* Figure our whether we can break at this point */ if ((!me->preformatted && (c == ' ' || c == '\t'))) { - int new_cleanness = 3; + int new_cleanness = 3; if (me->write_pointer > (me->buffer + 1)) { char delims[5]; char * p; @@ -171,25 +171,25 @@ PRIVATE void HTMLGen_put_character ARGS2( } allow_break(me, new_cleanness, YES); } - + /* - * Flush buffer out when full, or whenever the line is over - * the nominal maximum and we can break at all + * Flush buffer out when full, or whenever the line is over + * the nominal maximum and we can break at all */ if (me->write_pointer >= me->buffer + me->buffer_maxchars || (me->overflowed && me->cleanness)) { - if (me->cleanness) { + if (me->cleanness) { char line_break_char = me->line_break[me->cleanness][0]; char * saved = me->line_break[me->cleanness]; - - if (me->delete_line_break_char[me->cleanness]) saved++; - me->line_break[me->cleanness][0] = '\n'; + + if (me->delete_line_break_char[me->cleanness]) saved++; + me->line_break[me->cleanness][0] = '\n'; (*me->targetClass.put_block)(me->target, - me->buffer, + me->buffer, me->line_break[me->cleanness] - me->buffer + 1); me->line_break[me->cleanness][0] = line_break_char; { /* move next line in */ - char * p = saved; + char * p = saved; char *q; for (q = me->buffer; p < me->write_pointer; ) *q++ = *p++; @@ -197,18 +197,18 @@ PRIVATE void HTMLGen_put_character ARGS2( me->cleanness = 0; /* Now we have to check whether ther are any perfectly good breaks ** which weren't good enough for the last line but may be - ** good enough for the next + ** good enough for the next */ { - int i; + int i; for(i=0; i <= MAX_CLEANNESS; i++) { if (me->line_break[i] != NULL && me->line_break[i] > saved) { - me->line_break[i] = me->line_break[i] - + me->line_break[i] = me->line_break[i] - (saved-me->buffer); me->cleanness = i; } else { - me->line_break[i] = NULL; + me->line_break[i] = NULL; } } } @@ -232,7 +232,7 @@ PRIVATE void HTMLGen_put_character ARGS2( ** --------------- */ PRIVATE void HTMLGen_put_string ARGS2( - HTStructured *, me, + HTStructured *, me, CONST char *, s) { CONST char * p; @@ -242,7 +242,7 @@ PRIVATE void HTMLGen_put_string ARGS2( } PRIVATE void HTMLGen_write ARGS3( - HTStructured *, me, + HTStructured *, me, CONST char *, s, int, l) { @@ -261,7 +261,7 @@ PRIVATE void HTMLGen_write ARGS3( PRIVATE void HTMLGen_start_element ARGS6( HTStructured *, me, int, element_number, - CONST BOOL*, present, + CONST BOOL*, present, CONST char **, value, int, charset, char **, insert) @@ -313,16 +313,16 @@ PRIVATE void HTMLGen_start_element ARGS6( allow_break(me, 12, NO); } HTMLGen_put_string(me, ">"); /* got rid of \n LJM */ - + /* - * Make very specific HTML assumption that PRE can't be nested! + * Make very specific HTML assumption that PRE can't be nested! */ me->preformatted = (element_number == HTML_PRE) ? YES : was_preformatted; /* - * Can break after element start. - */ - if (!me->preformatted && tag->contents != SGML_EMPTY) { + * Can break after element start. + */ + if (!me->preformatted && tag->contents != SGML_EMPTY) { if (HTML_dtd.tags[element_number].contents == SGML_ELEMENT) allow_break(me, 15, NO); else @@ -335,22 +335,22 @@ PRIVATE void HTMLGen_start_element ARGS6( ** */ /* When we end an element, the style must be returned to that -** in effect before that element. Note that anchors (etc?) +** in effect before that element. Note that anchors (etc?) ** don't have an associated style, so that we must scan down the ** stack for an element with a defined style. (In fact, the styles ** should be linked to the whole stack not just the top one.) ** TBL 921119 */ PRIVATE void HTMLGen_end_element ARGS3( - HTStructured *, me, + HTStructured *, me, int, element_number, char **, insert) { - if (!me->preformatted && + if (!me->preformatted && HTML_dtd.tags[element_number].contents != SGML_EMPTY) { - /* + /* * Can break before element end. - */ + */ if (HTML_dtd.tags[element_number].contents == SGML_ELEMENT) allow_break(me, 14, NO); else @@ -369,17 +369,19 @@ PRIVATE void HTMLGen_end_element ARGS3( ** */ PRIVATE int HTMLGen_put_entity ARGS2( - HTStructured *, me, + HTStructured *, me, int, entity_number) { int nent = HTML_dtd.number_of_entities; - + HTMLGen_put_character(me, '&'); - if (entity_number < nent) + if (entity_number < nent) { HTMLGen_put_string(me, HTML_dtd.entity_names[entity_number]); - else + } else { HTMLGen_put_string(me, - HTML_dtd.extra_entity_info[entity_number-nent].name); + HTML_dtd.extra_entity_info[entity_number-nent].name + ); + } HTMLGen_put_character(me, ';'); return HT_OK; } @@ -389,7 +391,7 @@ PRIVATE int HTMLGen_put_entity ARGS2( ** */ PRIVATE void HTMLGen_free ARGS1( - HTStructured *, me) + HTStructured *, me) { (*me->targetClass.put_character)(me->target, '\n'); HTMLGen_flush(me); @@ -398,21 +400,21 @@ PRIVATE void HTMLGen_free ARGS1( } PRIVATE void PlainToHTML_free ARGS1( - HTStructured *, me) + HTStructured *, me) { HTMLGen_end_element(me, HTML_PRE, 0); HTMLGen_free(me); } PRIVATE void HTMLGen_abort ARGS2( - HTStructured *, me, + HTStructured *, me, HTError, e) { HTMLGen_free(me); } PRIVATE void PlainToHTML_abort ARGS2( - HTStructured *, me, + HTStructured *, me, HTError, e) { PlainToHTML_free(me); @@ -422,21 +424,21 @@ PRIVATE void PlainToHTML_abort ARGS2( ** ----------------------- */ PRIVATE CONST HTStructuredClass HTMLGeneration = /* As opposed to print etc */ -{ +{ "HTMLGen", HTMLGen_free, HTMLGen_abort, - HTMLGen_put_character, HTMLGen_put_string, HTMLGen_write, - HTMLGen_start_element, HTMLGen_end_element, + HTMLGen_put_character, HTMLGen_put_string, HTMLGen_write, + HTMLGen_start_element, HTMLGen_end_element, HTMLGen_put_entity -}; +}; /* Subclass-specific Methods ** ------------------------- */ extern int LYcols; /* LYCurses.h, set in LYMain.c */ -extern BOOL dump_output_immediately; /* TRUE if no interactive user */ -extern int dump_output_width; /* -width instead of 80 */ +extern BOOL dump_output_immediately; /* TRUE if no interactive user */ +extern int dump_output_width; /* -width instead of 80 */ extern BOOLEAN LYPreparsedSource; /* Show source as preparsed? */ PUBLIC HTStructured * HTMLGenerator ARGS1( @@ -444,23 +446,23 @@ PUBLIC HTStructured * HTMLGenerator ARGS1( { HTStructured* me = (HTStructured*)malloc(sizeof(*me)); if (me == NULL) - outofmem(__FILE__, "HTMLGenerator"); - me->isa = &HTMLGeneration; + outofmem(__FILE__, "HTMLGenerator"); + me->isa = &HTMLGeneration; me->target = output; me->targetClass = *me->target->isa; /* Copy pointers to routines for speed*/ - + me->write_pointer = me->buffer; flush_breaks(me); me->line_break[0] = me->buffer; - me->cleanness = 0; + me->cleanness = 0; me->overflowed = NO; me->delete_line_break_char[0] = NO; - me->preformatted = NO; + me->preformatted = NO; me->in_attrval = NO; /* - * For what line length should we attempt to wrap ? - kw + * For what line length should we attempt to wrap ? - kw */ if (!LYPreparsedSource) { me->buffer_maxchars = 80; /* work as before - kw */ @@ -480,14 +482,14 @@ PUBLIC HTStructured * HTMLGenerator ARGS1( /* * If dump_output_immediately is set, there likely isn't anything - * after this stream to interpret the Lynx special chars. Also - * if they get displayed via HTPlain, that will probably make + * after this stream to interpret the Lynx special chars. Also + * if they get displayed via HTPlain, that will probably make * non-breaking space chars etc. invisible. So let's translate - * them to numerical character references. For debugging - * purposes we'll use the new hex format. + * them to numerical character references. For debugging + * purposes we'll use the new hex format. */ me->escape_specials = LYPreparsedSource; - + return me; } @@ -499,39 +501,39 @@ PUBLIC HTStructured * HTMLGenerator ARGS1( ** This is just the easiest way of typecasting all the routines. */ PRIVATE CONST HTStructuredClass PlainToHTMLConversion = -{ +{ "plaintexttoHTML", - HTMLGen_free, - PlainToHTML_abort, + HTMLGen_free, + PlainToHTML_abort, HTMLGen_put_character, HTMLGen_put_string, HTMLGen_write, NULL, /* Structured stuff */ NULL, NULL -}; +}; /* HTConverter from plain text to HTML Stream ** ------------------------------------------ */ PUBLIC HTStream* HTPlainToHTML ARGS3( HTPresentation *, pres, - HTParentAnchor *, anchor, + HTParentAnchor *, anchor, HTStream *, sink) { HTStructured *me = (HTStructured *)malloc(sizeof(*me)); if (me == NULL) - outofmem(__FILE__, "PlainToHTML"); - me->isa = (CONST HTStructuredClass *)&PlainToHTMLConversion; + outofmem(__FILE__, "PlainToHTML"); + me->isa = (CONST HTStructuredClass *)&PlainToHTMLConversion; /* - * Copy pointers to routines for speed. + * Copy pointers to routines for speed. */ me->target = sink; me->targetClass = *me->target->isa; me->write_pointer = me->buffer; flush_breaks(me); - me->cleanness = 0; + me->cleanness = 0; me->overflowed = NO; me->delete_line_break_char[0] = NO; /* try to honor -width - kw */ diff --git a/WWW/Library/Implementation/HTNews.c b/WWW/Library/Implementation/HTNews.c index d8d958d7..2094df68 100644 --- a/WWW/Library/Implementation/HTNews.c +++ b/WWW/Library/Implementation/HTNews.c @@ -26,7 +26,7 @@ #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 */ +PUBLIC int HTNewsMaxChunk = 40; /* Largest number of articles in one window */ #ifndef DEFAULT_NEWS_HOST #define DEFAULT_NEWS_HOST "news" @@ -38,7 +38,7 @@ PUBLIC int HTNewsMaxChunk = 40; /* Largest number of articles in one window */ #define NEWS_NETWRITE NETWRITE #define NEWS_NETCLOSE NETCLOSE #define NEXT_CHAR HTGetCharacter() - + #include <ctype.h> #include "HTML.h" @@ -56,29 +56,29 @@ struct _HTStructured { CONST HTStructuredClass * isa; /* ... */ }; -struct _HTStream +struct _HTStream { HTStreamClass * isa; }; -#define LINE_LENGTH 512 /* Maximum length of line of ARTICLE etc */ +#define LINE_LENGTH 512 /* Maximum length of line of ARTICLE etc */ #define GROUP_NAME_LENGTH 256 /* Maximum length of group name */ extern BOOLEAN scan_for_buried_news_references; extern BOOLEAN LYListNewsNumbers; extern BOOLEAN LYListNewsDates; extern HTCJKlang HTCJK; extern int interrupted_in_htgetcharacter; -extern BOOL keep_mime_headers; /* Include mime headers and force raw text */ +extern BOOL keep_mime_headers; /* Include mime headers and force raw text */ extern BOOL using_proxy; /* Are we using an NNTP proxy? */ /* ** Module-wide variables. */ -PUBLIC char * HTNewsHost = NULL; /* Default host */ -PRIVATE char * NewsHost = NULL; /* Current host */ -PRIVATE char * NewsHREF = NULL; /* Current HREF prefix */ +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 HTCanPost = FALSE; /* Current POST permission */ +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 */ @@ -96,11 +96,11 @@ PRIVATE HTList *NNTP_AuthInfo = NULL; /* AUTHINFO database */ #define START(e) (*targetClass.start_element)(target, e, 0, 0, -1, 0) #define END(e) (*targetClass.end_element)(target, e, 0) #define MAYBE_END(e) if (HTML_dtd.tags[e].contents != SGML_EMPTY) \ - (*targetClass.end_element)(target, e, 0) + (*targetClass.end_element)(target, e, 0) #define FREE_TARGET if (rawtext) (*rawtargetClass._free)(rawtarget); \ - else (*targetClass._free)(target) + else (*targetClass._free)(target) #define ABORT_TARGET if (rawtext) (*rawtargetClass._abort)(rawtarget, NULL); \ - else (*targetClass._abort)(target, NULL) + else (*targetClass._abort)(target, NULL) typedef struct _NNTPAuth { char * host; @@ -125,10 +125,10 @@ PRIVATE void free_NNTP_AuthInfo NOARGS NNTPAuth *auth = NULL; if (!cur) - return; + return; while (NULL != (auth = (NNTPAuth *)HTList_nextObject(cur))) { - FREE(auth->host); + FREE(auth->host); FREE(auth->user); FREE(auth->pass); FREE(auth); @@ -174,38 +174,38 @@ PRIVATE BOOL initialize NOARGS #endif /* - ** Get name of Host. + ** Get name of Host. */ #ifdef NeXTStep if ((cp = NXGetDefaultValue("WorldWideWeb","NewsHost"))==0) { - if ((cp = NXGetDefaultValue("News","NewsHost")) == 0) { + if ((cp = NXGetDefaultValue("News","NewsHost")) == 0) { StrAllocCopy(HTNewsHost, DEFAULT_NEWS_HOST); } } if (cp) { - StrAllocCopy(HTNewsHost, cp); + StrAllocCopy(HTNewsHost, cp); cp = NULL; } #else if (getenv("NNTPSERVER")) { - StrAllocCopy(HTNewsHost, (char *)getenv("NNTPSERVER")); + StrAllocCopy(HTNewsHost, (char *)getenv("NNTPSERVER")); if (TRACE) fprintf(stderr, "HTNews: NNTPSERVER defined as `%s'\n", HTNewsHost); } else { - char server_name[256]; - FILE* fp = fopen(SERVER_FILE, "r"); - if (fp) { + char server_name[256]; + FILE* fp = fopen(SERVER_FILE, "r"); + if (fp) { if (fscanf(fp, "%s", server_name)==1) { - StrAllocCopy(HTNewsHost, server_name); + StrAllocCopy(HTNewsHost, server_name); if (TRACE) fprintf(stderr, "HTNews: File %s defines news host as `%s'\n", - SERVER_FILE, HTNewsHost); + SERVER_FILE, HTNewsHost); } fclose(fp); } } if (!HTNewsHost) - StrAllocCopy(HTNewsHost, DEFAULT_NEWS_HOST); + StrAllocCopy(HTNewsHost, DEFAULT_NEWS_HOST); #endif /* NeXTStep */ s = -1; /* Disconnected */ @@ -217,7 +217,7 @@ PRIVATE BOOL initialize NOARGS ** ------------------------------------------------------ ** ** On entry, -** command points to the command to be sent, including CRLF, or is null +** command points to the command to be sent, including CRLF, or is null ** pointer if no command to be sent. ** On exit, ** Negative status indicates transmission error, socket closed. @@ -225,30 +225,30 @@ PRIVATE BOOL initialize NOARGS */ PRIVATE int response ARGS1(CONST char *,command) { - int result; + int result; char * p = response_text; char ch; if (command) { - int status; + int status; int length = strlen(command); if (TRACE) fprintf(stderr, "NNTP command to be sent: %s", command); #ifdef NOT_ASCII { - CONST char * p; - char * q; + CONST char * p; + char * q; char ascii[LINE_LENGTH+1]; for(p = command, q=ascii; *p; p++, q++) { *q = TOASCII(*p); } - status = NEWS_NETWRITE(s, ascii, length); + status = NEWS_NETWRITE(s, ascii, length); } #else - status = NEWS_NETWRITE(s, (char *)command, length); + status = NEWS_NETWRITE(s, (char *)command, length); #endif /* NOT_ASCII */ if (status < 0){ if (TRACE) fprintf(stderr, - "HTNews: Unable to send command. Disconnecting.\n"); + "HTNews: Unable to send command. Disconnecting.\n"); NEWS_NETCLOSE(s); s = -1; return status; @@ -260,7 +260,7 @@ PRIVATE int response ARGS1(CONST char *,command) (p == &response_text[LINE_LENGTH])) { *--p = '\0'; /* Terminate the string */ if (TRACE) - fprintf(stderr, "NNTP Response: %s\n", response_text); + fprintf(stderr, "NNTP Response: %s\n", response_text); sscanf(response_text, "%d", &result); return result; } /* if end of line */ @@ -271,17 +271,17 @@ PRIVATE int response ARGS1(CONST char *,command) if (interrupted_in_htgetcharacter) { fprintf(stderr, "HTNews: Interrupted on read, closing socket %d\n", - s); + s); } else { fprintf(stderr, "HTNews: EOF on read, closing socket %d\n", - s); + s); } } NEWS_NETCLOSE(s); /* End of file, close socket */ s = -1; if (interrupted_in_htgetcharacter) { - interrupted_in_htgetcharacter = 0; + interrupted_in_htgetcharacter = 0; return(HT_INTERRUPTED); } return((int)EOF); /* End of file on response */ @@ -301,7 +301,7 @@ PRIVATE BOOL match ARGS2 (CONST char *,unknown, CONST char *,template) CONST char * u = unknown; CONST char * t = template; for (; *u && *t && (TOUPPER(*u) == *t); u++, t++) - ; /* Find mismatch or end */ + ; /* Find mismatch or end */ return (BOOL)(*t == 0); /* OK if end of template */ } @@ -314,7 +314,7 @@ typedef enum { ** This function handles nntp authentication. - FM */ PRIVATE NNTPAuthResult HTHandleAuthInfo ARGS1( - char *, host) + char *, host) { HTList *cur = NULL; NNTPAuth *auth = NULL; @@ -325,16 +325,16 @@ PRIVATE NNTPAuthResult HTHandleAuthInfo ARGS1( int status, tries; /* - ** Make sure we have an interactive user and a host. - FM + ** Make sure we have an interactive user and a host. - FM */ if (dump_output_immediately || !(host && *host)) - return NNTPAUTH_ERROR; + return NNTPAUTH_ERROR; /* - ** Check for an existing authorization entry. - FM + ** Check for an existing authorization entry. - FM */ if (NNTP_AuthInfo != NULL) { - cur = NNTP_AuthInfo; + cur = NNTP_AuthInfo; while (NULL != (auth = (NNTPAuth *)HTList_nextObject(cur))) { if (!strcmp(auth->host, host)) { UserName = auth->user; @@ -348,7 +348,7 @@ PRIVATE NNTPAuthResult HTHandleAuthInfo ARGS1( } /* - ** Handle the username. - FM + ** Handle the username. - FM */ buffer[511] = '\0'; tries = 3; @@ -384,7 +384,7 @@ PRIVATE NNTPAuthResult HTHandleAuthInfo ARGS1( } if (status == 281) { /* - ** Username is OK and no Password is required. - FM + ** Username is accepted and no password is required. - FM */ if (auth) { if (auth->user != UserName) { @@ -392,6 +392,9 @@ PRIVATE NNTPAuthResult HTHandleAuthInfo ARGS1( auth->user = UserName; } } else { + /* + ** Store the accepted username and no password. - FM + */ if ((auth = (NNTPAuth *)calloc(1, sizeof(NNTPAuth))) != NULL) { StrAllocCopy(auth->host, host); @@ -403,7 +406,8 @@ PRIVATE NNTPAuthResult HTHandleAuthInfo ARGS1( } if (status != 381) { /* - ** Not a request for the password, so it must be an error. - FM + ** Not success, nor a request for the password, + ** so it must be an error. - FM */ HTAlert(response_text); tries--; @@ -430,7 +434,7 @@ PRIVATE NNTPAuthResult HTHandleAuthInfo ARGS1( if (status == 381) { /* - ** Username is OK, and a password is required. - FM + ** Handle the password. - FM */ tries = 3; while (tries) { @@ -487,9 +491,10 @@ PRIVATE NNTPAuthResult HTHandleAuthInfo ARGS1( return NNTPAUTH_CLOSE; } if (status == 281) { - /* - ** Password is OK. - FM - */ + /* + ** Password also is accepted, and everything + ** has been stored. - FM + */ if (auth) { if (auth->user != UserName) { FREE(auth->user); @@ -511,7 +516,7 @@ PRIVATE NNTPAuthResult HTHandleAuthInfo ARGS1( return NNTPAUTH_OK; } /* - ** Show the error message and see if we should try again. - FM + ** Not success, so it must be an error. - FM */ HTAlert(response_text); if (!auth || auth->pass != PassWord) { @@ -553,30 +558,30 @@ PRIVATE char * author_name ARGS1 (char *,email) { static char *name = NULL; char *p, *e; - + StrAllocCopy(name, email); if (TRACE) - fprintf(stderr,"Trying to find name in: %s\n",name); + fprintf(stderr,"Trying to find name in: %s\n",name); if ((p = strchr(name, '(')) && (e = strchr(name, ')'))) { - if (e > p) { + if (e > p) { *e = '\0'; /* Chop off everything after the ')' */ return HTStrip(p+1); /* Remove leading and trailing spaces */ } } - + if ((p = strchr(name, '<')) && (e = strchr(name, '>'))) { - if (e > p) { + if (e > p) { strcpy(p, e+1); /* Remove <...> */ return HTStrip(name); /* Remove leading and trailing spaces */ } } - + return HTStrip(name); /* Default to the whole thing */ } -/* Find Author's mail address -** -------------------------- +/* Find Author's mail address +** -------------------------- ** ** On exit, ** Returns allocated string which cannot be freed by the @@ -584,8 +589,8 @@ PRIVATE char * author_name ARGS1 (char *,email) ** to this function. ** ** For example, returns "montulli@spaced.out.galaxy.net" if given any of -** " Lou Montulli <montulli@spaced.out.galaxy.net> " -** or " montulli@spaced.out.galaxy.net ( Lou "The Stud" Montulli ) " +** " Lou Montulli <montulli@spaced.out.galaxy.net> " +** or " montulli@spaced.out.galaxy.net ( Lou "The Stud" Montulli ) " */ PRIVATE char * author_address ARGS1(char *,email) { @@ -594,29 +599,29 @@ PRIVATE char * author_address ARGS1(char *,email) StrAllocCopy(address, email); if (TRACE) - fprintf(stderr,"Trying to find address in: %s\n",address); + fprintf(stderr,"Trying to find address in: %s\n",address); if ((p = strchr(address, '<'))) { - if ((e = strchr(p, '>')) && (at = strchr(p, '@'))) { + if ((e = strchr(p, '>')) && (at = strchr(p, '@'))) { if (at < e) { - *e = '\0'; /* Remove > */ - return HTStrip(p+1); /* Remove leading and trailing spaces */ + *e = '\0'; /* Remove > */ + return HTStrip(p+1); /* Remove leading and trailing spaces */ } } } if ((p = strchr(address, '(')) && - (e = strchr(address, ')')) && (at = strchr(address, '@'))) { - if (e > p && at < e) { - *p = '\0'; /* Chop off everything after the ')' */ - return HTStrip(address); /* Remove leading and trailing spaces */ - } + (e = strchr(address, ')')) && (at = strchr(address, '@'))) { + if (e > p && at < e) { + *p = '\0'; /* Chop off everything after the ')' */ + return HTStrip(address); /* Remove leading and trailing spaces */ + } } if ((at = strchr(address, '@')) && at > address) { - p = (at - 1); + p = (at - 1); e = (at + 1); - while (p > address && !isspace((unsigned char)*p)) + while (p > address && !isspace((unsigned char)*p)) p--; while (*e && !isspace((unsigned char)*e)) e++; @@ -625,14 +630,14 @@ PRIVATE char * author_address ARGS1(char *,email) } /* - ** Default to the first word. + ** Default to the first word. */ p = address; while (isspace((unsigned char)*p)) - p++; /* find first non-space */ + p++; /* find first non-space */ e = p; while (!isspace((unsigned char)*e) && *e != '\0') - e++; /* find next space or end */ + e++; /* find next space or end */ *e = '\0'; /* terminate space */ return(p); @@ -644,30 +649,30 @@ PRIVATE char * author_address ARGS1(char *,email) PRIVATE void start_anchor ARGS1(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++) + int i; + for(i=0; i < HTML_A_ATTRIBUTES; i++) present[i] = (i == HTML_A_HREF); } ((CONST char **)value)[HTML_A_HREF] = href; (*targetClass.start_element)(target, HTML_A , present, - (CONST char **)value, -1, 0); + (CONST char **)value, -1, 0); } -/* Start link element -** ------------------ +/* Start link element +** ------------------ */ PRIVATE void start_link ARGS2(CONST char *, href, CONST char *, rev) { - BOOL present[HTML_LINK_ATTRIBUTES]; - CONST char* value[HTML_LINK_ATTRIBUTES]; - + BOOL present[HTML_LINK_ATTRIBUTES]; + CONST char* value[HTML_LINK_ATTRIBUTES]; + { - int i; - for(i=0; i < HTML_LINK_ATTRIBUTES; i++) - present[i] = (i == HTML_LINK_HREF || i == HTML_LINK_REV); + int i; + for(i=0; i < HTML_LINK_ATTRIBUTES; i++) + present[i] = (i == HTML_LINK_HREF || i == HTML_LINK_REV); } ((CONST char **)value)[HTML_LINK_HREF] = href; ((CONST char **)value)[HTML_LINK_REV] = rev; @@ -675,18 +680,18 @@ PRIVATE void start_link ARGS2(CONST char *, href, CONST char *, rev) (CONST char **)value, -1, 0); } -/* Start list element -** ------------------ +/* Start list element +** ------------------ */ PRIVATE void start_list ARGS1(int, seqnum) { - BOOL present[HTML_OL_ATTRIBUTES]; - CONST char* value[HTML_OL_ATTRIBUTES]; + BOOL present[HTML_OL_ATTRIBUTES]; + CONST char* value[HTML_OL_ATTRIBUTES]; char SeqNum[20]; int i; - + for (i = 0; i < HTML_OL_ATTRIBUTES; i++) - present[i] = (i == HTML_OL_SEQNUM || i == HTML_OL_START); + present[i] = (i == HTML_OL_SEQNUM || i == HTML_OL_START); sprintf(SeqNum, "%d", seqnum); ((CONST char **)value)[HTML_OL_SEQNUM] = SeqNum; ((CONST char **)value)[HTML_OL_START] = SeqNum; @@ -699,23 +704,23 @@ PRIVATE void start_list ARGS1(int, seqnum) ** ** ** On entry, -** HT has a selection of zero length at the end. -** text points to the text to be put into the file, 0 terminated. +** HT has a selection of zero length at the end. +** text points to the text to be put into the file, 0 terminated. ** addr points to the hypertext reference address, -** terminated by white space, comma, NULL or '>' +** terminated by white space, comma, NULL or '>' */ PRIVATE void write_anchor ARGS2(CONST char *,text, CONST char *,addr) { char href[LINE_LENGTH+1]; - + { - CONST char * p; + CONST char * p; strcpy(href, NewsHREF); for (p = addr; *p && (*p != '>') && !WHITE(*p) && (*p!=','); p++) ; - strncat(href, addr, p-addr); /* Make complete hypertext reference */ + strncat(href, addr, p-addr); /* Make complete hypertext reference */ } - + start_anchor(href); PUTS(text); END(HTML_A); @@ -728,8 +733,8 @@ PRIVATE void write_anchor ARGS2(CONST char *,text, CONST char *,addr) ** generating an anchor for each. ** ** On entry, -** HT has a selection of zero length at the end. -** text points to a comma or space separated list of addresses. +** HT has a selection of zero length at the end. +** text points to a comma or space separated list of addresses. ** On exit, ** *text is NOT any more chopped up into substrings. */ @@ -739,11 +744,11 @@ PRIVATE void write_anchors ARGS1 (char *,text) char * end; char c; for (;;) { - for (; *start && (WHITE(*start)); start++) + for (; *start && (WHITE(*start)); start++) ; /* Find start */ if (!*start) return; /* (Done) */ - for (end = start; + for (end = start; *end && (*end != ' ') && (*end != ','); end++) ;/* Find end */ if (*end) @@ -766,8 +771,8 @@ PRIVATE void write_anchors ARGS1 (char *,text) PRIVATE void abort_socket NOARGS { if (TRACE) - fprintf(stderr, - "HTNews: EOF on read, closing socket %d\n", s); + fprintf(stderr, + "HTNews: EOF on read, closing socket %d\n", s); NEWS_NETCLOSE(s); /* End of file, close socket */ PUTS("Network Error: connection lost"); PUTC('\n'); @@ -775,48 +780,48 @@ PRIVATE void abort_socket NOARGS } /* -** Determine if a line is a valid header line. valid_header +** Determine if a line is a valid header line. valid_header ** ------------------------------------------- */ PRIVATE BOOLEAN valid_header ARGS1( - char *, line) + char *, line) { char *colon, *space; /* - ** Blank or tab in first position implies - ** this is a continuation header. + ** Blank or tab in first position implies + ** this is a continuation header. */ if (line[0] == ' ' || line[0] == '\t') return(TRUE); /* - ** Just check for initial letter, colon, and space to make - ** sure we discard only invalid headers. + ** Just check for initial letter, colon, and space to make + ** sure we discard only invalid headers. */ colon = strchr(line, ':'); space = strchr(line, ' '); if (isalpha(line[0]) && colon && space == colon + 1) - return(TRUE); + return(TRUE); /* - ** Anything else is a bad header -- it should be ignored. + ** Anything else is a bad header -- it should be ignored. */ return(FALSE); } /* post in an Article post_article ** ------------------ -** (added by FM, modeled on Lynx's previous mini inews) +** (added by FM, modeled on Lynx's previous mini inews) ** ** Note the termination condition of a single dot on a line by itself. ** ** On entry, ** s Global socket number is OK ** postfile file with header and article to post. -*/ +*/ PRIVATE void post_article ARGS1( - char *, postfile) + char *, postfile) { char line[512]; char buf[512]; @@ -829,8 +834,8 @@ PRIVATE void post_article ARGS1( /* - ** Open the temporary file with the - ** nntp headers and message body. - FM + ** Open the temporary file with the + ** nntp headers and message body. - FM */ if ((fd = fopen((postfile ? postfile : ""), "r")) == NULL) { HTAlert("Cannot open temporary file for news POST."); @@ -838,8 +843,8 @@ PRIVATE void post_article ARGS1( } /* - ** Read the temporary file and post - ** in maximum 512 byte chunks. - FM + ** Read the temporary file and post + ** in maximum 512 byte chunks. - FM */ buf[0] = '\0'; sprintf(crlf, "%c%c", CR, LF); @@ -848,16 +853,16 @@ PRIVATE void post_article ARGS1( *cp = '\0'; if (line[0] == '.') { /* - ** A single '.' means end of transmission - ** for nntp. Lead dots on lines normally - ** are trimmed and the EOF is not registered - ** if the dot was not followed by CRLF. - ** We prepend an extra dot for any line - ** beginning with one, to retain the one - ** intended, as well as avoid a false EOF - ** signal. We know we have room for it in - ** the buffer, because we normally send when - ** it would exceed 510. - FM + ** A single '.' means end of transmission + ** for nntp. Lead dots on lines normally + ** are trimmed and the EOF is not registered + ** if the dot was not followed by CRLF. + ** We prepend an extra dot for any line + ** beginning with one, to retain the one + ** intended, as well as avoid a false EOF + ** signal. We know we have room for it in + ** the buffer, because we normally send when + ** it would exceed 510. - FM */ strcat(buf, "."); blen++; @@ -872,7 +877,7 @@ PRIVATE void post_article ARGS1( in_header = 0; if (!seen_fromline) { if (blen < 475) { - strcat(buf, "From: anonymous@nowhere.you.know"); + strcat(buf, "From: anonymous@nowhere.you.know"); strcat(buf, crlf); blen += 34; } else { @@ -912,30 +917,30 @@ PRIVATE void post_article ARGS1( #endif /* VMS */ /* - ** Send the nntp EOF and get the server's response. - FM + ** Send the nntp EOF and get the server's response. - FM */ if (blen < 508) { - strcat(buf, "."); + strcat(buf, "."); strcat(buf, crlf); blen += 3; NEWS_NETWRITE(s, buf, blen); } else { - NEWS_NETWRITE(s, buf, blen); + NEWS_NETWRITE(s, buf, blen); sprintf(buf, ".%s", crlf); blen = 3; NEWS_NETWRITE(s, buf, blen); } status = response(NULL); if (status == 240) { - /* + /* ** Successful post. - FM */ - HTProgress(response_text); + HTProgress(response_text); } else { - /* + /* ** Shucks, something went wrong. - FM */ - HTAlert(response_text); + HTAlert(response_text); } } @@ -949,7 +954,7 @@ PRIVATE void post_article ARGS1( ** On entry, ** s Global socket number is OK ** HT Global hypertext object is ready for appending text -*/ +*/ PRIVATE int read_article NOARGS { char line[LINE_LENGTH+1]; @@ -967,27 +972,27 @@ PRIVATE int read_article NOARGS BOOL done = NO; /* - ** Read in the HEADer of the article. + ** Read in the HEADer of the article. ** - ** The header fields are either ignored, - ** or formatted and put into the text. + ** The header fields are either ignored, + ** or formatted and put into the text. */ if (!diagnostic && !rawtext) { while (!done) { char ch = *p++ = NEXT_CHAR; if (ch == (char)EOF) { - if (interrupted_in_htgetcharacter) { + if (interrupted_in_htgetcharacter) { interrupted_in_htgetcharacter = 0; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTNews: Interrupted on read, closing socket %d\n", s); NEWS_NETCLOSE(s); s = -1; return(HT_INTERRUPTED); } - abort_socket(); /* End of file, close socket */ - return(HT_LOADED); /* End of file on response */ + abort_socket(); /* End of file, close socket */ + return(HT_LOADED); /* End of file on response */ } if ((ch == LF) || (p == &line[LINE_LENGTH])) { *--p = '\0'; /* Terminate the string */ @@ -997,14 +1002,14 @@ PRIVATE int read_article NOARGS if (line[0] == '\t' || line[0] == ' ') { int i = 0; while (line[i]) { - if (line[i] == '\t') + if (line[i] == '\t') line[i] = ' '; i++; } if (full_line == NULL) { - StrAllocCopy(full_line, line); + StrAllocCopy(full_line, line); } else { - StrAllocCat(full_line, line); + StrAllocCat(full_line, line); } } else { StrAllocCopy(full_line, line); @@ -1012,7 +1017,7 @@ PRIVATE int read_article NOARGS if (full_line[0] == '.') { /* - ** End of article? + ** End of article? */ if ((unsigned char)full_line[1] < ' ') { done = YES; @@ -1024,46 +1029,34 @@ PRIVATE int read_article NOARGS } else if (match(full_line, "SUBJECT:")) { StrAllocCopy(subject, HTStrip(strchr(full_line,':')+1)); if (HTCJK == JAPANESE) { - HTmmdecode(subject, subject); + HTmmdecode(subject, subject); HTrjis(subject, subject); } -#ifdef NOTUSED_CHARTRANS - else HTmmdecode(subject, subject); -#endif } else if (match(full_line, "DATE:")) { StrAllocCopy(date, HTStrip(strchr(full_line,':')+1)); } else if (match(full_line, "ORGANIZATION:")) { StrAllocCopy(organization, - HTStrip(strchr(full_line,':')+1)); + HTStrip(strchr(full_line,':')+1)); if (HTCJK == JAPANESE) { - HTmmdecode(organization, organization); + HTmmdecode(organization, organization); HTrjis(organization, organization); } -#ifdef NOTUSED_CHARTRANS - else HTmmdecode(organization, organization); -#endif } else if (match(full_line, "FROM:")) { StrAllocCopy(from, HTStrip(strchr(full_line,':')+1)); if (HTCJK == JAPANESE) { - HTmmdecode(from, from); + HTmmdecode(from, from); HTrjis(from, from); } -#ifdef NOTUSED_CHARTRANS - else HTmmdecode(from, from); -#endif } else if (match(full_line, "REPLY-TO:")) { StrAllocCopy(replyto, HTStrip(strchr(full_line,':')+1)); if (HTCJK == JAPANESE) { - HTmmdecode(replyto, replyto); + HTmmdecode(replyto, replyto); HTrjis(replyto, replyto); } -#ifdef NOTUSED_CHARTRANS - else HTmmdecode(replyto, replyto); -#endif } else if (match(full_line, "NEWSGROUPS:")) { StrAllocCopy(newsgroups, HTStrip(strchr(full_line,':')+1)); @@ -1137,19 +1130,19 @@ PRIVATE int read_article NOARGS START(HTML_B); PUTS("Reply to:"); END(HTML_B); - PUTC(' '); + PUTC(' '); start_anchor(href); if (*replyto != '<') - PUTS(author_name(replyto)); + PUTS(author_name(replyto)); else - PUTS(author_address(replyto)); - END(HTML_A); + PUTS(author_address(replyto)); + END(HTML_A); START(HTML_BR); MAYBE_END(HTML_DT); PUTC('\n'); FREE(from); - FREE(replyto); + FREE(replyto); } if (date) { @@ -1157,7 +1150,7 @@ PRIVATE int read_article NOARGS START(HTML_B); PUTS("Date:"); END(HTML_B); - PUTC(' '); + PUTC(' '); PUTS(date); MAYBE_END(HTML_DT); PUTC('\n'); @@ -1169,7 +1162,7 @@ PRIVATE int read_article NOARGS START(HTML_B); PUTS("Organization:"); END(HTML_B); - PUTC(' '); + PUTC(' '); PUTS(organization); MAYBE_END(HTML_DT); PUTC('\n'); @@ -1178,14 +1171,14 @@ PRIVATE int read_article NOARGS if (newsgroups && HTCanPost) { /* - ** We have permission to POST to this host, - ** so add a link for posting followups for - ** this article. - FM + ** We have permission to POST to this host, + ** so add a link for posting followups for + ** this article. - FM */ if (!strncasecomp(NewsHREF, "snews:", 6)) - StrAllocCopy(href,"snewsreply://"); + StrAllocCopy(href,"snewsreply://"); else - StrAllocCopy(href,"newsreply://"); + StrAllocCopy(href,"newsreply://"); StrAllocCat(href, NewsHost); StrAllocCat(href, "/"); StrAllocCat(href, (followupto ? followupto : newsgroups)); @@ -1203,18 +1196,18 @@ PRIVATE int read_article NOARGS START(HTML_DT); START(HTML_B); - PUTS("Followup to:"); + PUTS("Followup to:"); END(HTML_B); - PUTC(' '); - start_anchor(href); - PUTS("newsgroup(s)"); - END(HTML_A); + PUTC(' '); + start_anchor(href); + PUTS("newsgroup(s)"); + END(HTML_A); MAYBE_END(HTML_DT); PUTC('\n'); } FREE(newsgroups); FREE(followupto); - + if (references) { START(HTML_DT); START(HTML_B); @@ -1240,20 +1233,19 @@ PRIVATE int read_article NOARGS */ ; } else if (diagnostic) { - /* + /* ** Read in the HEAD and BODY of the Article ** as XMP formatted text. - FM */ START(HTML_XMP); - PUTC('\n'); } else { - /* + /* ** Read in the BODY of the Article ** as PRE formatted text. - FM */ START(HTML_PRE); - PUTC('\n'); } + PUTC('\n'); p = line; while (!done) { @@ -1275,7 +1267,7 @@ PRIVATE int read_article NOARGS if ((ch == LF) || (p == &line[LINE_LENGTH])) { *p++ = '\0'; /* Terminate the string */ if (TRACE) - fprintf(stderr, "B %s", line); + fprintf(stderr, "B %s", line); if (line[0] == '.') { /* ** End of article? @@ -1287,42 +1279,42 @@ PRIVATE int read_article NOARGS if (rawtext) RAW_PUTS(&line[1]); else - PUTS(&line[1]); /* Ignore first dot */ + PUTS(&line[1]); /* Ignore first dot */ } } else { if (rawtext) { RAW_PUTS(line); - } else if (diagnostic || !scan_for_buried_news_references) { + } else if (diagnostic || !scan_for_buried_news_references) { /* - ** All lines are passed as unmodified source. - FM + ** All lines are passed as unmodified source. - FM */ - PUTS(line); - } else { + PUTS(line); + } else { /* - ** Normal lines are scanned for buried references - ** to other articles. Unfortunately, it could pick - ** up mail addresses as well! It also can corrupt - ** uuencoded messages! So we don't do this when - ** fetching articles as WWW_SOURCE or when downloading - ** (diagnostic is TRUE) or if the client has set - ** scan_for_buried_news_references to FALSE. - ** Otherwise, we convert all "<...@...>" strings - ** preceded by "rticle " to "news:...@..." links, - ** and any strings that look like URLs to links. - FM + ** Normal lines are scanned for buried references + ** to other articles. Unfortunately, it could pick + ** up mail addresses as well! It also can corrupt + ** uuencoded messages! So we don't do this when + ** fetching articles as WWW_SOURCE or when downloading + ** (diagnostic is TRUE) or if the client has set + ** scan_for_buried_news_references to FALSE. + ** Otherwise, we convert all "<...@...>" strings + ** preceded by "rticle " to "news:...@..." links, + ** and any strings that look like URLs to links. - FM */ char *l = line; char *p2; while ((p2 = strstr(l, "rticle <")) != NULL) { - char *q = strchr(p2,'>'); - char *at = strchr(p2, '@'); - if (q && at && at<q) { - char c = q[1]; + char *q = strchr(p2,'>'); + char *at = strchr(p2, '@'); + if (q && at && at<q) { + char c = q[1]; q[1] = 0; /* chop up */ p2 += 7; *p2 = 0; while (*l) { - if (strncmp(l, "news:", 5) && + if (strncmp(l, "news:", 5) && strncmp(l, "snews://", 8) && strncmp(l, "nntp://", 7) && strncmp(l, "snewspost:", 10) && @@ -1337,26 +1329,26 @@ PRIVATE int read_article NOARGS strncmp(l, "wais://", 7) && strncmp(l, "mailto:", 7) && strncmp(l, "cso://", 6) && - strncmp(l, "gopher://", 9)) + strncmp(l, "gopher://", 9)) PUTC (*l++); else { StrAllocCopy(href, l); start_anchor(strtok(href, " \r\n\t,>)\"")); while (*l && !strchr(" \r\n\t,>)\"", *l)) - PUTC(*l++); + PUTC(*l++); END(HTML_A); FREE(href); } } - *p2 = '<'; /* again */ + *p2 = '<'; /* again */ *q = 0; start_anchor(p2+1); - *q = '>'; /* again */ + *q = '>'; /* again */ PUTS(p2); END(HTML_A); q[1] = c; /* again */ l=q+1; - } else { + } else { break; /* line has unmatched <> */ } } @@ -1376,18 +1368,18 @@ PRIVATE int read_article NOARGS strncmp(l, "wais://", 7) && strncmp(l, "mailto:", 7) && strncmp(l, "cso://", 6) && - strncmp(l, "gopher://", 9)) + strncmp(l, "gopher://", 9)) PUTC (*l++); else { StrAllocCopy(href, l); start_anchor(strtok(href, " \r\n\t,>)\"")); while (*l && !strchr(" \r\n\t,>)\"", *l)) - PUTC(*l++); + PUTC(*l++); END(HTML_A); FREE(href); } } - } /* if diagnostic or not scan_for_buried_news_references */ + } /* if diagnostic or not scan_for_buried_news_references */ } /* if not dot */ p = line; /* Restart at beginning */ } /* if end of line */ @@ -1410,7 +1402,7 @@ PRIVATE int read_article NOARGS ** Note the termination condition of a single dot on a line by itself. ** 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) { char line[LINE_LENGTH+1]; @@ -1418,34 +1410,35 @@ PRIVATE int read_list ARGS1(char *, arg) BOOL done = NO; BOOL head = NO; BOOL tail = NO; - BOOL skip_this_line = NO, skip_rest_of_line = NO; + BOOL skip_this_line = NO; + BOOL skip_rest_of_line = NO; int listing = 0; char *pattern = NULL; int len = 0; - + /* - ** Support head or tail matches for groups to list. - FM + ** Support head or tail matches for groups to list. - FM */ if (arg && strlen(arg) > 1) { - if (*arg == '*') { - tail = YES; + if (*arg == '*') { + tail = YES; StrAllocCopy(pattern, (arg+1)); - } else if (arg[strlen(arg)-1] == '*') { - head = YES; + } else if (arg[strlen(arg)-1] == '*') { + head = YES; StrAllocCopy(pattern, arg); pattern[strlen(pattern)-1] = '\0'; - } - if (tail || head) { - len = strlen(pattern); + } + if (tail || head) { + len = strlen(pattern); } } /* - ** Read the server's reply. + ** Read the server's reply. ** - ** The lines are scanned for newsgroup - ** names and descriptions. + ** The lines are scanned for newsgroup + ** names and descriptions. */ START(HTML_HEAD); PUTC('\n'); @@ -1490,7 +1483,7 @@ PRIVATE int read_list ARGS1(char *, arg) } } else if (p == &line[LINE_LENGTH]) { if (TRACE) { - fprintf(stderr, "b %.*s%c[...]\n", (LINE_LENGTH), line, ch); + fprintf(stderr, "b %.*s%c[...]\n", (LINE_LENGTH), line, ch); } *p = '\0'; if (ch == LF) { @@ -1516,9 +1509,12 @@ PRIVATE int read_list ARGS1(char *, arg) skip_rest_of_line = NO; /* done, reset flag */ *p = '\0'; /* Terminate the string */ if (TRACE) - fprintf(stderr, "B %s", line); + fprintf(stderr, "B %s", line); if (line[0] == '.') { - if ((unsigned char)line[1] < ' ') { /* End of list? */ + /* + ** End of article? + */ + if ((unsigned char)line[1] < ' ') { done = YES; break; } else { /* Line starts with dot */ @@ -1527,8 +1523,8 @@ PRIVATE int read_list ARGS1(char *, arg) MAYBE_END(HTML_DT); } } else if (line[0] == '#') { /* Comment? */ - p = line; /* Restart at beginning */ - continue; + p = line; /* Restart at beginning */ + continue; } else { /* ** Normal lines are scanned for references to newsgroups. @@ -1538,13 +1534,13 @@ PRIVATE int read_list ARGS1(char *, arg) /* find whitespace if it exits */ for (; line[i] != '\0' && !WHITE(line[i]); i++) ; /* null body */ - + if (line[i] != '\0') { line[i] = '\0'; if ((head && strncasecomp(line, pattern, len)) || - (tail && (i < len || + (tail && (i < len || strcasecomp((line + (i - len)), pattern)))) { - p = line; /* Restart at beginning */ + p = line; /* Restart at beginning */ continue; } START(HTML_DT); @@ -1552,14 +1548,14 @@ PRIVATE int read_list ARGS1(char *, arg) listing++; MAYBE_END(HTML_DT); PUTC('\n'); - START(HTML_DD); + START(HTML_DD); PUTS(&line[i+1]); /* put description */ MAYBE_END(HTML_DD); } else { if ((head && strncasecomp(line, pattern, len)) || - (tail && (i < len || + (tail && (i < len || strcasecomp((line + (i - len)), pattern)))) { - p = line; /* Restart at beginning */ + p = line; /* Restart at beginning */ continue; } START(HTML_DT); @@ -1572,7 +1568,7 @@ PRIVATE int read_list ARGS1(char *, arg) } /* if end of line */ } /* Loop over characters */ if (!listing) { - START(HTML_DT); + START(HTML_DT); sprintf(line, "No matches for: %s", arg); PUTS(line); MAYBE_END(HTML_DT); @@ -1622,54 +1618,54 @@ PRIVATE int read_group ARGS3( sscanf(response_text, " %d %d %d %d", &status, &count, &first, &last); if (TRACE) - fprintf(stderr, - "Newsgroup status=%d, count=%d, (%d-%d) required:(%d-%d)\n", + fprintf(stderr, + "Newsgroup status=%d, count=%d, (%d-%d) required:(%d-%d)\n", status, count, first, last, first_required, last_required); if (last == 0) { - PUTS("\nNo articles in this group.\n"); + PUTS("\nNo articles in this group.\n"); goto add_post; } - + #define FAST_THRESHOLD 100 /* Above this, read IDs fast */ #define CHOP_THRESHOLD 50 /* Above this, chop off the rest */ if (first_required < first) - first_required = first; /* clip */ + first_required = first; /* clip */ if ((last_required == 0) || (last_required > last)) - last_required = last; - + last_required = last; + if (last_required < first_required) { - PUTS("\nNo articles in this range.\n"); + PUTS("\nNo articles in this range.\n"); goto add_post; } if (last_required-first_required+1 > HTNewsMaxChunk) { /* Trim this block */ - first_required = last_required-HTNewsChunkSize+1; + first_required = last_required-HTNewsChunkSize+1; } if (TRACE) - fprintf(stderr, " Chunk will be (%d-%d)\n", - first_required, last_required); + fprintf(stderr, " Chunk will be (%d-%d)\n", + first_required, last_required); /* - ** Set window title. + ** Set window title. */ sprintf(buffer, "%s, Articles %d-%d", - groupName, first_required, last_required); + groupName, first_required, last_required); START(HTML_H1); PUTS(buffer); END(HTML_H1); PUTC('\n'); /* - ** Link to earlier articles. + ** Link to earlier articles. */ if (first_required > first) { - int before; /* Start of one before */ + int before; /* Start of one before */ if (first_required-HTNewsMaxChunk <= first) before = first; else before = first_required-HTNewsChunkSize; - sprintf(buffer, "%s%s/%d-%d", NewsHREF, groupName, + sprintf(buffer, "%s%s/%d-%d", NewsHREF, groupName, before, first_required-1); if (TRACE) fprintf(stderr, " Block before is %s\n", buffer); @@ -1681,17 +1677,17 @@ PRIVATE int read_group ARGS3( START(HTML_P); PUTC('\n'); } - + done = NO; /*#define USE_XHDR*/ #ifdef USE_XHDR if (count > FAST_THRESHOLD) { - sprintf(buffer, + sprintf(buffer, "\nThere are about %d articles currently available in %s, IDs as follows:\n\n", - count, groupName); - PUTS(buffer); - sprintf(buffer, "XHDR Message-ID %d-%d%c%c", first, last, CR, LF); + count, groupName); + PUTS(buffer); + sprintf(buffer, "XHDR Message-ID %d-%d%c%c", first, last, CR, LF); status = response(buffer); if (status == 221) { p = line; @@ -1699,7 +1695,7 @@ PRIVATE int read_group ARGS3( char ch = *p++ = NEXT_CHAR; if (ch == (char)EOF) { if (interrupted_in_htgetcharacter) { - interrupted_in_htgetcharacter = 0; + interrupted_in_htgetcharacter = 0; if (TRACE) fprintf(stderr, "HTNews: Interrupted on read, closing socket %d\n", @@ -1714,16 +1710,16 @@ PRIVATE int read_group ARGS3( if ((ch == '\n') || (p == &line[LINE_LENGTH])) { *p = '\0'; /* Terminate the string */ if (TRACE) - fprintf(stderr, "X %s", line); + fprintf(stderr, "X %s", line); if (line[0] == '.') { /* - ** End of response? + ** End of article? */ if ((unsigned char)line[1] < ' ') { done = YES; break; } else { /* Line starts with dot */ - /* Ignore strange line */ + /* Ignore strange line */ } } else { /* @@ -1744,13 +1740,13 @@ PRIVATE int read_group ARGS3( #endif /* USE_XHDR */ /* - ** Read newsgroup using individual fields. + ** Read newsgroup using individual fields. */ if (!done) { - START(HTML_B); - if (first == first_required && last == last_required) + START(HTML_B); + if (first == first_required && last == last_required) PUTS("All available articles in "); - else + else PUTS("Articles in "); PUTS(groupName); END(HTML_B); @@ -1763,17 +1759,17 @@ PRIVATE int read_group ARGS3( /*#define OVERLAP*/ #ifdef OVERLAP /* - ** With this code we try to keep the server running flat out - ** by queuing just one extra command ahead of time. - ** We assume (1) that the server won't abort if it gets input - ** during output, and (2) that TCP buffering is enough for the - ** two commands. Both these assumptions seem very reasonable. - ** However, we HAVE had a hangup with a loaded server. + ** With this code we try to keep the server running flat out + ** by queuing just one extra command ahead of time. + ** We assume (1) that the server won't abort if it gets input + ** during output, and (2) that TCP buffering is enough for the + ** two commands. Both these assumptions seem very reasonable. + ** However, we HAVE had a hangup with a loaded server. */ if (art == first_required) { if (art == last_required) { /* Only one */ sprintf(buffer, "HEAD %d%c%c", - art, CR, LF); + art, CR, LF); status = response(buffer); } else { /* First of many */ sprintf(buffer, "HEAD %d%c%cHEAD %d%c%c", @@ -1791,12 +1787,12 @@ PRIVATE int read_group ARGS3( status = response(buffer); #endif /* OVERLAP */ /* - ** Check for a good response (221) for the HEAD request, - ** and if so, parse it. Otherwise, indicate the error - ** so that the number of listings corresponds to what's - ** claimed for the range, and if we are listing numbers - ** via an ordered list, they stay in synchrony with the - ** article numbers. - FM + ** Check for a good response (221) for the HEAD request, + ** and if so, parse it. Otherwise, indicate the error + ** so that the number of listings corresponds to what's + ** claimed for the range, and if we are listing numbers + ** via an ordered list, they stay in synchrony with the + ** article numbers. - FM */ if (status == 221) { /* Head follows - parse it:*/ p = line; /* Write pointer */ @@ -1814,12 +1810,12 @@ PRIVATE int read_group ARGS3( s = -1; return(HT_INTERRUPTED); } - abort_socket(); /* End of file, close socket */ + abort_socket(); /* End of file, close socket */ return(HT_LOADED); /* End of file on response */ } if ((ch == LF) || - (p == &line[LINE_LENGTH])) { - + (p == &line[LINE_LENGTH])) { + *--p = '\0'; /* Terminate & chop LF*/ p = line; /* Restart at beginning */ if (TRACE) @@ -1828,7 +1824,7 @@ PRIVATE int read_group ARGS3( case '.': /* - ** End of response? + ** End of article? */ done = ((unsigned char)line[1] < ' '); break; @@ -1837,12 +1833,7 @@ PRIVATE int read_group ARGS3( case 's': if (match(line, "SUBJECT:")) { strcpy(subject, line+9);/* Save subject */ -#ifdef NOTUSED_CHARTRANS - HTmmdecode(subject, subject); - if (HTCJK == JAPANESE) - HTrjis(subject, subject); -#endif - if (HTCJK == JAPANESE) { + if (HTCJK == JAPANESE) { HTmmdecode(subject, subject); HTrjis(subject, subject); } @@ -1864,25 +1855,20 @@ PRIVATE int read_group ARGS3( char * p2; strcpy(author, author_name(strchr(line,':')+1)); -#ifdef NOTUSED_CHARTRANS - HTmmdecode(author, author); - if (HTCJK == JAPANESE) - HTrjis(author, author); -#endif if (HTCJK == JAPANESE) { HTmmdecode(author, author); HTrjis(author, author); } p2 = author + strlen(author) - 1; if (*p2==LF) - *p2 = '\0'; /* Chop off newline */ + *p2 = '\0'; /* Chop off newline */ } break; case 'd': case 'D': if (LYListNewsDates && match(line, "DATE:")) { - StrAllocCopy(date, + StrAllocCopy(date, HTStrip(strchr(line,':')+1)); } break; @@ -1903,17 +1889,17 @@ PRIVATE int read_group ARGS3( if (author[0] != '\0') { PUTS(" - "); if (LYListNewsDates) - START(HTML_I); + START(HTML_I); PUTS(author); if (LYListNewsDates) - END(HTML_I); + END(HTML_I); author[0] = '\0'; } if (date) { if (!diagnostic) { - for (i = 0; date[i]; i++) { + for (i = 0; date[i]; i++) { if (date[i] == ' ') { - date[i] = HT_NON_BREAK_SPACE; + date[i] = HT_NON_BREAK_SPACE; } } } @@ -1923,7 +1909,7 @@ PRIVATE int read_group ARGS3( } MAYBE_END(HTML_LI); /* - ** Indicate progress! @@@@@@ + ** Indicate progress! @@@@@@ */ } else if (status == HT_INTERRUPTED) { interrupted_in_htgetcharacter = 0; @@ -1935,7 +1921,7 @@ PRIVATE int read_group ARGS3( s = -1; return(HT_INTERRUPTED); } else { - /* + /* ** Use the response text on error. - FM */ PUTC('\n'); @@ -1951,26 +1937,26 @@ PRIVATE int read_group ARGS3( PUTS(response_text); MAYBE_END(HTML_LI); } /* Handle response to HEAD request */ - } /* Loop over article */ + } /* Loop over article */ } /* If read headers */ PUTC('\n'); if (LYListNewsNumbers) - END(HTML_OL); + END(HTML_OL); else - END(HTML_UL); + END(HTML_UL); PUTC('\n'); - + /* - ** Link to later articles. + ** Link to later articles. */ if (last_required < last) { - int after; /* End of article after */ + int after; /* End of article after */ after = last_required+HTNewsChunkSize; - if (after == last) + if (after == last) sprintf(buffer, "%s%s", NewsHREF, groupName); /* original group */ - else + else sprintf(buffer, "%s%s/%d-%d", NewsHREF, groupName, - last_required+1, after); + last_required+1, after); if (TRACE) fprintf(stderr, " Block after is %s\n", buffer); PUTC('('); @@ -2020,16 +2006,16 @@ PRIVATE int HTLoadNews ARGS4( HTStream*, stream) { char command[260]; /* The whole command */ - char proxycmd[260]; /* The proxy command */ + char proxycmd[260]; /* The proxy command */ char groupName[GROUP_NAME_LENGTH]; /* Just the group name */ - int status; /* tcp return */ - int retries; /* A count of how hard we have tried */ + int status; /* tcp return */ + int retries; /* A count of how hard we have tried */ BOOL group_wanted; /* Flag: group was asked for, not article */ BOOL list_wanted; /* Flag: list was asked for, not article */ BOOL post_wanted; /* Flag: new post to group was asked for */ BOOL reply_wanted; /* Flag: followup post was asked for */ BOOL spost_wanted; /* Flag: new SSL post to group was asked for */ - BOOL sreply_wanted; /* Flag: followup SSL post was asked for */ + BOOL sreply_wanted; /* Flag: followup SSL post was asked for */ BOOL head_wanted = NO; /* Flag: want HEAD of single article */ int first, last; /* First and last articles asked for */ char *cp = 0; @@ -2039,17 +2025,17 @@ PRIVATE int HTLoadNews ARGS4( char *postfile = NULL; diagnostic = (format_out == WWW_SOURCE || /* set global flag */ - format_out == HTAtom_for("www/download") || + format_out == HTAtom_for("www/download") || format_out == HTAtom_for("www/dump")); rawtext = NO; - + if (TRACE) fprintf(stderr, "HTNews: Looking for %s\n", arg); - + if (!initialized) initialized = initialize(); if (!initialized) return -1; /* FAIL */ - + FREE(NewsHREF); command[0] = '\0'; command[259] = '\0'; @@ -2057,16 +2043,16 @@ PRIVATE int HTLoadNews ARGS4( proxycmd[259] = '\0'; { - CONST char * p1 = arg; + CONST char * p1 = arg; /* ** We will ask for the document, omitting the host name & anchor. ** ** Syntax of address is - ** xxx@yyy Article - ** <xxx@yyy> Same article - ** xxxxx News group (no "@") - ** group/n1-n2 Articles n1 to n2 in group + ** xxx@yyy Article + ** <xxx@yyy> Same article + ** xxxxx News group (no "@") + ** group/n1-n2 Articles n1 to n2 in group */ spost_wanted = (strstr(arg, "snewspost:") != NULL); sreply_wanted = (!(spost_wanted) && @@ -2092,15 +2078,15 @@ PRIVATE int HTLoadNews ARGS4( } if (post_wanted || reply_wanted || spost_wanted || sreply_wanted) { /* - ** Make sure we have a non-zero path for the newsgroup(s). - FM + ** Make sure we have a non-zero path for the newsgroup(s). - FM */ if ((p1 = strrchr(arg, '/')) != NULL) { - p1++; + p1++; } else if ((p1 = strrchr(arg, ':')) != NULL) { - p1++; + p1++; } if (!(p1 && *p1)) { - HTAlert("Invalid URL!"); + HTAlert("Invalid URL!"); return(HT_NO_DATA); } if (!(cp = HTParse(arg, "", PARSE_HOST)) || *cp == '\0') { @@ -2118,7 +2104,7 @@ PRIVATE int HTLoadNews ARGS4( } FREE(cp); sprintf(command, "%s://%.245s/", - (post_wanted ? + (post_wanted ? "newspost" : (reply_wanted ? "newreply" : @@ -2127,14 +2113,14 @@ PRIVATE int HTLoadNews ARGS4( StrAllocCopy(NewsHREF, command); /* - ** If the SSL daemon is being used as a proxy, - ** reset p1 to the start of the proxied URL - ** rather than to the start of the newsgroup(s). - FM + ** If the SSL daemon is being used as a proxy, + ** reset p1 to the start of the proxied URL + ** rather than to the start of the newsgroup(s). - FM */ if (spost_wanted && strncasecomp(arg, "snewspost:", 10)) - p1 = strstr(arg, "snewspost:"); + p1 = strstr(arg, "snewspost:"); if (sreply_wanted && strncasecomp(arg, "snewsreply:", 11)) - p1 = strstr(arg, "snewsreply:"); + p1 = strstr(arg, "snewsreply:"); /* p1 = HTParse(arg, "", PARSE_PATH | PARSE_PUNCTUATION); */ /* @@ -2142,20 +2128,20 @@ PRIVATE int HTLoadNews ARGS4( ** rules. For instance, if the article reference contains a '#', ** the rest of it is lost -- JFG 10/7/92, from a bug report */ - } else if (!strncasecomp (arg, "nntp:", 5)) { + } else if (!strncasecomp (arg, "nntp:", 5)) { if (((*(arg + 5) == '\0') || - (!strcmp((arg + 5), "/") || + (!strcmp((arg + 5), "/") || !strcmp((arg + 5), "//") || !strcmp((arg + 5), "///"))) || ((!strncmp((arg + 5), "//", 2)) && - (!(cp = strchr((arg + 7), '/')) || *(cp + 1) == '\0'))) { + (!(cp = strchr((arg + 7), '/')) || *(cp + 1) == '\0'))) { p1 = "*"; group_wanted = FALSE; list_wanted = TRUE; } else if (*(arg + 5) != '/') { - p1 = (arg + 5); + p1 = (arg + 5); } else if (*(arg + 5) == '/' && *(arg + 6) != '/') { - p1 = (arg + 6); + p1 = (arg + 6); } else { p1 = (cp + 1); } @@ -2180,17 +2166,17 @@ PRIVATE int HTLoadNews ARGS4( HTAlert("This client does not contain support for SNEWS URLs."); return HT_NOT_LOADED; } - else if (!strncasecomp (arg, "news:/", 6)) { + else if (!strncasecomp (arg, "news:/", 6)) { if (((*(arg + 6) == '\0') || - !strcmp((arg + 6), "/") || + !strcmp((arg + 6), "/") || !strcmp((arg + 6), "//")) || - ((*(arg + 6) == '/') && + ((*(arg + 6) == '/') && (!(cp = strchr((arg + 7), '/')) || *(cp + 1) == '\0'))) { p1 = "*"; group_wanted = FALSE; list_wanted = TRUE; } else if (*(arg + 6) != '/') { - p1 = (arg + 6); + p1 = (arg + 6); } else { p1 = (cp + 1); } @@ -2231,7 +2217,7 @@ PRIVATE int HTLoadNews ARGS4( ** doing the conversion itself, and for handling posts ** or followups. - TZ & FM */ - if (!strncasecomp(p1, "snews:", 6) || + if (!strncasecomp(p1, "snews:", 6) || !strncasecomp(p1, "snewspost:", 10) || !strncasecomp(p1, "snewsreply:", 11)) { StrAllocCopy(ProxyHost, NewsHost); @@ -2246,13 +2232,13 @@ PRIVATE int HTLoadNews ARGS4( sprintf(proxycmd, "GET %.251s%c%c%c%c", command, CR, LF, CR, LF); if (TRACE) fprintf(stderr, - "HTNews: Proxy command is '%.*s'\n", + "HTNews: Proxy command is '%.*s'\n", (int)(strlen(proxycmd) - 4), proxycmd); strcat(command, "/"); StrAllocCopy(ProxyHREF, NewsHREF); StrAllocCopy(NewsHREF, command); if (spost_wanted || sreply_wanted) { - /* + /* ** Reset p1 so that it points to the newsgroup(s). */ if ((p1 = strrchr(arg, '/')) != NULL) { @@ -2261,7 +2247,7 @@ PRIVATE int HTLoadNews ARGS4( p1 = (strrchr(arg, ':') + 1); } } else { - /* + /* ** Reset p1 so that it points to the newgroup ** (or a wildcard), or the article. */ @@ -2295,12 +2281,12 @@ PRIVATE int HTLoadNews ARGS4( if ((first > 0) && (isdigit(*(slash+1))) && (strchr(slash+1, '-') == NULL || first == last)) { /* - ** We got a number greater than 0, which will be - ** loaded as first, and either no range or the - ** range computes to zero, so make last negative, - ** as a flag to select the group and then fetch - ** an article by number (first) instead of by - ** messageID. - FM + ** We got a number greater than 0, which will be + ** loaded as first, and either no range or the + ** range computes to zero, so make last negative, + ** as a flag to select the group and then fetch + ** an article by number (first) instead of by + ** messageID. - FM */ last = -1; } @@ -2311,16 +2297,16 @@ PRIVATE int HTLoadNews ARGS4( } else { strcpy(command, "ARTICLE "); if (strchr(p1, '<') == 0) - strcat(command,"<"); + strcat(command,"<"); strcat(command, p1); if (strchr(p1, '>') == 0) - strcat(command,">"); + strcat(command,">"); } - { + { char * p = command + strlen(command); /* - ** Terminate command with CRLF, as in RFC 977. + ** Terminate command with CRLF, as in RFC 977. */ *p++ = CR; /* Macros to be correct on Mac */ *p++ = LF; @@ -2328,13 +2314,13 @@ PRIVATE int HTLoadNews ARGS4( } StrAllocCopy(ListArg, p1); } /* scope of p1 */ - + if (!*arg) { - FREE(NewsHREF); + FREE(NewsHREF); FREE(ProxyHost); FREE(ProxyHREF); FREE(ListArg); - return NO; /* Ignore if no name */ + return NO; /* Ignore if no name */ } if (!(post_wanted || reply_wanted || spost_wanted || sreply_wanted || @@ -2350,7 +2336,7 @@ PRIVATE int HTLoadNews ARGS4( rawtext = (head_wanted || keep_mime_headers); } if (rawtext) { - node_anchor = anAnchor; + node_anchor = anAnchor; rawtarget = HTStreamStack(WWW_PLAINTEXT, format_out, stream, anAnchor); @@ -2366,36 +2352,36 @@ PRIVATE int HTLoadNews ARGS4( rawtargetClass = *rawtarget->isa; } else /* - ** Make a hypertext object with an anchor list. + ** Make a hypertext object with an anchor list. */ if (!(post_wanted || reply_wanted || spost_wanted || sreply_wanted)) { - node_anchor = anAnchor; + node_anchor = anAnchor; target = HTML_new(anAnchor, format_out, stream); targetClass = *target->isa; /* Copy routine entry points */ } /* - ** Now, let's get a stream setup up from the NewsHost. - */ + ** Now, let's get a stream setup up from the NewsHost. + */ for (retries = 0; retries < 2; retries++) { - if (s < 0) { + if (s < 0) { /* CONNECTING to news host */ - char url[260]; + char url[260]; if (!strcmp(NewsHREF, "news:")) { - sprintf (url, "lose://%.251s/", NewsHost); + sprintf (url, "lose://%.251s/", NewsHost); } else if (ProxyHREF) { - sprintf (url, "%.259s", ProxyHREF); + sprintf (url, "%.259s", ProxyHREF); } else { - sprintf (url, "%.259s", NewsHREF); + sprintf (url, "%.259s", NewsHREF); } - if (TRACE) - fprintf (stderr, "News: doing HTDoConnect on '%s'\n", url); + if (TRACE) + fprintf (stderr, "News: doing HTDoConnect on '%s'\n", url); - _HTProgress("Connecting to NewsHost ..."); + _HTProgress("Connecting to NewsHost ..."); status = HTDoConnect (url, "NNTP", NEWS_PORT, &s); - if (status == HT_INTERRUPTED) { - /* + if (status == HT_INTERRUPTED) { + /* ** Interrupt cleanly. */ if (TRACE) @@ -2420,15 +2406,15 @@ PRIVATE int HTLoadNews ARGS4( #endif /* VMS */ FREE(postfile); } - return HT_NOT_LOADED; - } + return HT_NOT_LOADED; + } if (status < 0) { char message[256]; - NEWS_NETCLOSE(s); + NEWS_NETCLOSE(s); s = -1; if (TRACE) fprintf(stderr, - "HTNews: Unable to connect to news host.\n"); + "HTNews: Unable to connect to news host.\n"); if (retries < 1) continue; sprintf(message, "Could not access %s.", NewsHost); @@ -2451,11 +2437,11 @@ PRIVATE int HTLoadNews ARGS4( if (TRACE) fprintf(stderr, "HTNews: Connected to news host %s.\n", NewsHost); - HTInitInput(s); /* set up buffering */ + HTInitInput(s); /* set up buffering */ if (proxycmd[0]) { status = NEWS_NETWRITE(s, proxycmd, strlen(proxycmd)); if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTNews: Proxy command returned status '%d'.\n", status); } @@ -2467,7 +2453,7 @@ PRIVATE int HTLoadNews ARGS4( _HTProgress("Connection interrupted."); if (!(post_wanted || reply_wanted || spost_wanted || sreply_wanted)) { - ABORT_TARGET; + ABORT_TARGET; } FREE(NewsHost); FREE(NewsHREF); @@ -2476,28 +2462,28 @@ PRIVATE int HTLoadNews ARGS4( FREE(ListArg); if (postfile) { #ifdef VMS - while (remove(postfile) == 0) + while (remove(postfile) == 0) ; /* loop through all versions */ #else - remove(postfile); + remove(postfile); #endif /* VMS */ - FREE(postfile); + FREE(postfile); } return(HT_NOT_LOADED); } if (retries < 1) continue; - sprintf(message, + sprintf(message, "Can't read news info. News host %.20s responded: %.200s", - NewsHost, response_text); - return HTLoadError(stream, 500, message); + NewsHost, response_text); + return HTLoadError(stream, 500, message); } if (status == 200) { HTCanPost = TRUE; } else { HTCanPost = FALSE; if (post_wanted || reply_wanted || - spost_wanted || sreply_wanted) { + spost_wanted || sreply_wanted) { HTAlert("Cannot POST to this host."); FREE(NewsHREF); if (ProxyHREF) { @@ -2520,7 +2506,7 @@ PRIVATE int HTLoadNews ARGS4( } } } /* If needed opening */ - + if (post_wanted || reply_wanted || spost_wanted || sreply_wanted) { if (!HTCanPost) { @@ -2557,13 +2543,13 @@ PRIVATE int HTLoadNews ARGS4( FREE(ListArg); return(HT_NOT_LOADED); } - } else { + } else { /* - ** Ensure reader mode, but don't bother checking the - ** status for anything but HT_INTERRUPTED or a 480 - ** Authorization request, because if the reader mode - ** command is not needed, the server probably returned - ** a 500, which is irrelevant at this point. - FM + ** Ensure reader mode, but don't bother checking the + ** status for anything but HT_INTERRUPTED or a 480 + ** Authorization request, because if the reader mode + ** command is not needed, the server probably returned + ** a 500, which is irrelevant at this point. - FM */ char buffer[20]; @@ -2580,9 +2566,9 @@ PRIVATE int HTLoadNews ARGS4( s = -1; } } - if (auth_result != NNTPAUTH_OK) { + if (auth_result != NNTPAUTH_OK) { break; - } + } if ((status = response(buffer)) == HT_INTERRUPTED) { _HTProgress("Connection interrupted."); break; @@ -2597,9 +2583,9 @@ Send_NNTP_command: } if (status < 0) { if (retries < 1) { - continue; + continue; } else { - break; + break; } } /* @@ -2633,36 +2619,36 @@ Send_NNTP_command: sprintf(command, "LIST NEWSGROUPS%c%c", CR, LF); goto Send_NNTP_command; } - HTAlert(response_text); + HTAlert(response_text); } else { - _HTProgress(response_text); + _HTProgress(response_text); } NEWS_NETCLOSE(s); s = -1; /* - ** Message might be a leftover "Timeout-disconnected", - ** so try again if the retries maximum has not been - ** reached. + ** Message might be a leftover "Timeout-disconnected", + ** so try again if the retries maximum has not been + ** reached. */ continue; } - + /* ** Post or load a group, article, etc */ if (status == 480) { NNTPAuthResult auth_result; /* - * Some servers return 480 for a failed XGTITLE. - FM + * Some servers return 480 for a failed XGTITLE. - FM */ if (list_wanted && !strncmp(command, "XGTITLE", 7) && - strstr(response_text, "uthenticat") == NULL && - strstr(response_text, "uthor") == NULL) { + strstr(response_text, "uthenticat") == NULL && + strstr(response_text, "uthor") == NULL) { sprintf(command, "LIST NEWSGROUPS%c%c", CR, LF); goto Send_NNTP_command; } /* - ** Handle Authorization. - FM + ** Handle Authorization. - FM */ if ((auth_result = HTHandleAuthInfo(NewsHost)) == NNTPAUTH_OK) { goto Send_NNTP_command; @@ -2678,7 +2664,7 @@ Send_NNTP_command: } else if (post_wanted || reply_wanted || spost_wanted || sreply_wanted) { /* - ** Handle posting of an article. - FM + ** Handle posting of an article. - FM */ if (status != 340) { HTAlert("Cannot POST to this host."); @@ -2691,22 +2677,22 @@ Send_NNTP_command: #endif /* VMS */ } } else { - post_article(postfile); + post_article(postfile); } FREE(postfile); status = HT_NOT_LOADED; } else if (list_wanted) { /* - ** List available newsgroups. - FM + ** List available newsgroups. - FM */ _HTProgress("Reading list of available newsgroups."); status = read_list(ListArg); } else if (group_wanted) { /* - ** List articles in a news group. - FM + ** List articles in a news group. - FM */ if (last < 0) { - /* + /* ** We got one article number rather than a range ** following the slash which followed the group ** name, or the range was zero, so now that we @@ -2723,9 +2709,9 @@ Send_NNTP_command: } _HTProgress("Reading list of articles in newsgroup."); status = read_group(groupName, first, last); - } else { + } else { /* - ** Get an article from a news group. - FM + ** Get an article from a news group. - FM */ _HTProgress("Reading news article."); status = read_article(); @@ -2760,15 +2746,15 @@ Send_NNTP_command: } return status; } /* Retry loop */ - + /* HTAlert("Sorry, could not load requested news."); */ - + /* NXRunAlertPanel(NULL, "Sorry, could not load `%s'.", NULL,NULL,NULL, arg);No -- message earlier wil have covered it */ if (!(post_wanted || reply_wanted || spost_wanted || sreply_wanted)) { - ABORT_TARGET; + ABORT_TARGET; } FREE(NewsHREF); if (ProxyHREF) { @@ -2800,14 +2786,14 @@ Send_NNTP_command: PUBLIC void HTClearNNTPAuthInfo NOARGS { /* - ** Need code to check cached documents and do - ** something to ensure that any protected - ** documents no longer can be accessed without - ** a new retrieval. - FM + ** Need code to check cached documents and do + ** something to ensure that any protected + ** documents no longer can be accessed without + ** a new retrieval. - FM */ /* - ** Now free all of the authorization info. - FM + ** Now free all of the authorization info. - FM */ free_NNTP_AuthInfo(); } diff --git a/WWW/Library/Implementation/HTParse.c b/WWW/Library/Implementation/HTParse.c index 2aaed746..655801fa 100644 --- a/WWW/Library/Implementation/HTParse.c +++ b/WWW/Library/Implementation/HTParse.c @@ -22,7 +22,7 @@ struct struct_parts { }; -/* Strip white space off a string. HTStrip() +/* Strip white space off a string. HTStrip() ** ------------------------------- ** ** On exit, @@ -30,20 +30,20 @@ struct struct_parts { ** All trailing white space is OVERWRITTEN with zero. */ PUBLIC char * HTStrip ARGS1( - char *, s) + char *, s) { -#define SPACE(c) ((c == ' ') || (c == '\t') || (c == '\n')) +#define SPACE(c) ((c == ' ') || (c == '\t') || (c == '\n')) char * p = s; for (p = s; *p; p++) - ; /* Find end of string */ + ; /* Find end of string */ for (p--; p >= s; p--) { - if (SPACE(*p)) + if (SPACE(*p)) *p = '\0'; /* Zap trailing blanks */ else break; } while (SPACE(*s)) - s++; /* Strip leading blanks */ + s++; /* Strip leading blanks */ return s; } @@ -53,12 +53,12 @@ PUBLIC char * HTStrip ARGS1( ** On entry, ** name points to a document name which may be incomplete. ** On exit, -** absolute or relative may be nonzero (but not both). +** absolute or relative may be nonzero (but not both). ** host, anchor and access may be nonzero if they were specified. ** Any which are nonzero point to zero terminated strings. */ PRIVATE void scan ARGS2( - char *, name, + char *, name, struct struct_parts *, parts) { char * after_access; @@ -66,15 +66,15 @@ PRIVATE void scan ARGS2( #ifdef NOTDEFINED int length = strlen(name); #endif /* NOTDEFINED */ - + parts->access = NULL; parts->host = NULL; parts->absolute = NULL; parts->relative = NULL; parts->anchor = NULL; - + /* - ** Scan left-to-right for a scheme (access). + ** Scan left-to-right for a scheme (access). */ after_access = name; for (p = name; *p; p++) { @@ -87,12 +87,12 @@ PRIVATE void scan ARGS2( if (*p == '/' || *p == '#' || *p == ';' || *p == '?') break; } - + #ifdef NOTDEFINED for (p = (name + length-1); p >= name; p--) {} #endif /* NOTDEFINED */ /* - ** Scan left-to-right for a fragment (anchor). + ** Scan left-to-right for a fragment (anchor). */ for (p = after_access; *p; p++) { if (*p =='#') { @@ -103,40 +103,40 @@ PRIVATE void scan ARGS2( } /* - ** Scan left-to-right for a host or absolute path. + ** Scan left-to-right for a host or absolute path. */ p = after_access; if (*p == '/') { if (p[1] == '/') { - parts->host = (p + 2); /* host has been specified */ - *p = '\0'; /* Terminate access */ + parts->host = (p + 2); /* host has been specified */ + *p = '\0'; /* Terminate access */ p = strchr(parts->host, '/'); /* look for end of host name if any */ if (p != NULL) { - *p = '\0'; /* Terminate host */ - parts->absolute = (p + 1); /* Root has been found */ + *p = '\0'; /* Terminate host */ + parts->absolute = (p + 1); /* Root has been found */ } } else { parts->absolute = (p + 1); /* Root found but no host */ - } + } } else { - parts->relative = (*after_access) ? + parts->relative = (*after_access) ? after_access : NULL; /* NULL for "" */ } /* - ** Check schemes that commonly have unescaped hashes. + ** Check schemes that commonly have unescaped hashes. */ if (parts->access && parts->anchor) { - if ((!parts->host && strcasecomp(parts->access, "lynxcgi")) || + if ((!parts->host && strcasecomp(parts->access, "lynxcgi")) || !strcasecomp(parts->access, "nntp") || !strcasecomp(parts->access, "snews") || !strcasecomp(parts->access, "news") || !strcasecomp(parts->access, "data")) { - /* - * Access specified but no host and not a lynxcgi URL, so the - * anchor may not really be one, e.g., news:j462#36487@foo.bar, - * or it's an nntp or snews URL, or news URL with a host. - * Restore the '#' in the address. + /* + * Access specified but no host and not a lynxcgi URL, so the + * anchor may not really be one, e.g., news:j462#36487@foo.bar, + * or it's an nntp or snews URL, or news URL with a host. + * Restore the '#' in the address. */ /* but only if we have found a path component of which this will * become part. - kw */ @@ -149,17 +149,17 @@ PRIVATE void scan ARGS2( #ifdef NOT_DEFINED /* search is just treated as part of path */ { - char *p = (relative ? relative : absolute); + char *p = (relative ? relative : absolute); if (p != NULL) { char *q = strchr(p, '?'); /* Any search string? */ if (q != NULL) { - *q = '\0'; /* If so, chop that off. */ + *q = '\0'; /* If so, chop that off. */ parts->search = (q + 1); } } } #endif /* NOT_DEFINED */ -} /*scan */ +} /*scan */ /* Parse a Name relative to another name. HTParse() @@ -170,11 +170,11 @@ PRIVATE void scan ARGS2( ** ** On entry, ** aName A filename given -** relatedName A name relative to which aName is to be parsed -** wanted A mask for the bits which are wanted. +** relatedName A name relative to which aName is to be parsed +** wanted A mask for the bits which are wanted. ** ** On exit, -** returns A pointer to a calloc'd string which MUST BE FREED +** returns A pointer to a calloc'd string which MUST BE FREED */ PUBLIC char * HTParse ARGS3( CONST char *, aName, @@ -195,66 +195,66 @@ PUBLIC char * HTParse ARGS3( "HTParse: aName:%s relatedName:%s\n", aName, relatedName); /* - ** Allocate the output string. + ** Allocate the output string. */ len = strlen(aName) + strlen(relatedName) + 10; result = (char *)calloc(1, len); /* Lots of space: more than enough */ if (result == NULL) { - outofmem(__FILE__, "HTParse"); + outofmem(__FILE__, "HTParse"); } /* - ** Make working copies of the input strings to cut up. + ** Make working copies of the input strings to cut up. */ StrAllocCopy(name, aName); StrAllocCopy(rel, relatedName); /* - ** Cut up the strings into URL fields. + ** Cut up the strings into URL fields. */ scan(name, &given); - scan(rel, &related); + scan(rel, &related); /* - ** Handle the scheme (access) field. + ** Handle the scheme (access) field. */ if (given.access && given.host && !given.relative && !given.absolute) { - if (!strcmp(given.access, "http") || + if (!strcmp(given.access, "http") || !strcmp(given.access, "https") || !strcmp(given.access, "ftp")) /* - ** Assume root. + ** Assume root. */ given.absolute = ""; } acc_method = given.access ? given.access : related.access; if (wanted & PARSE_ACCESS) { - if (acc_method) { + if (acc_method) { strcat(result, acc_method); if (wanted & PARSE_PUNCTUATION) - strcat(result, ":"); + strcat(result, ":"); } } /* - ** If different schemes, inherit nothing. + ** If different schemes, inherit nothing. ** - ** We'll try complying with RFC 1808 and - ** the Fielding draft, and inherit nothing - ** if both schemes are given, rather than - ** only when they differ, except for - ** file URLs - FM + ** We'll try complying with RFC 1808 and + ** the Fielding draft, and inherit nothing + ** if both schemes are given, rather than + ** only when they differ, except for + ** file URLs - FM ** - ** After trying it for a while, it's still - ** premature, IHMO, to go along with it, so - ** this is back to inheriting for identical - ** schemes whether or not they are "file". - ** If you want to try it again yourself, - ** uncomment the strncasecomp() below. - FM + ** After trying it for a while, it's still + ** premature, IHMO, to go along with it, so + ** this is back to inheriting for identical + ** schemes whether or not they are "file". + ** If you want to try it again yourself, + ** uncomment the strncasecomp() below. - FM */ if ((given.access && related.access) && - (/* strcasecomp(given.access, "file") || */ - strcmp(given.access, related.access))) { + (/* strcasecomp(given.access, "file") || */ + strcmp(given.access, related.access))) { related.host = NULL; related.absolute = NULL; related.relative = NULL; @@ -262,69 +262,69 @@ PUBLIC char * HTParse ARGS3( } /* - ** Handle the host field. + ** Handle the host field. */ if (wanted & PARSE_HOST) - if (given.host || related.host) { + if (given.host || related.host) { char *tail = result + strlen(result); if (wanted & PARSE_PUNCTUATION) - strcat(result, "//"); + strcat(result, "//"); strcat(result, given.host ? given.host : related.host); #define CLEAN_URLS #ifdef CLEAN_URLS /* - ** Ignore default port numbers, and trailing dots on FQDNs, - ** which will only cause identical addresses to look different. + ** Ignore default port numbers, and trailing dots on FQDNs, + ** which will only cause identical addresses to look different. */ { - char *p2, *h; + char *p2, *h; if ((p2 = strchr(result, '@')) != NULL) tail = (p2 + 1); p2 = strchr(tail, ':'); if (p2 != NULL && !isdigit((unsigned char)p2[1])) /* - ** Colon not followed by a port number. + ** Colon not followed by a port number. */ *p2 = '\0'; if (p2 != NULL && *p2 != '\0' && acc_method != NULL) { /* - ** Port specified. + ** Port specified. */ - if ((!strcmp(acc_method, "http" ) && !strcmp(p2, ":80" )) || - (!strcmp(acc_method, "https" ) && !strcmp(p2, ":443")) || - (!strcmp(acc_method, "gopher" ) && !strcmp(p2, ":70" )) || - (!strcmp(acc_method, "ftp" ) && !strcmp(p2, ":21" )) || - (!strcmp(acc_method, "wais" ) && !strcmp(p2, ":210")) || - (!strcmp(acc_method, "nntp" ) && !strcmp(p2, ":119")) || - (!strcmp(acc_method, "news" ) && !strcmp(p2, ":119")) || + if ((!strcmp(acc_method, "http" ) && !strcmp(p2, ":80" )) || + (!strcmp(acc_method, "https" ) && !strcmp(p2, ":443")) || + (!strcmp(acc_method, "gopher" ) && !strcmp(p2, ":70" )) || + (!strcmp(acc_method, "ftp" ) && !strcmp(p2, ":21" )) || + (!strcmp(acc_method, "wais" ) && !strcmp(p2, ":210")) || + (!strcmp(acc_method, "nntp" ) && !strcmp(p2, ":119")) || + (!strcmp(acc_method, "news" ) && !strcmp(p2, ":119")) || (!strcmp(acc_method, "newspost" ) && !strcmp(p2, ":119")) || (!strcmp(acc_method, "newsreply" ) && !strcmp(p2, ":119")) || - (!strcmp(acc_method, "snews" ) && !strcmp(p2, ":563")) || - (!strcmp(acc_method, "snewspost" ) && !strcmp(p2, ":563")) || - (!strcmp(acc_method, "snewsreply") && !strcmp(p2, ":563")) || - (!strcmp(acc_method, "finger" ) && !strcmp(p2, ":79" )) || - (!strcmp(acc_method, "telnet" ) && !strcmp(p2, ":23" )) || - (!strcmp(acc_method, "tn3270" ) && !strcmp(p2, ":23" )) || - (!strcmp(acc_method, "rlogin" ) && !strcmp(p2, ":513")) || - (!strcmp(acc_method, "cso" ) && !strcmp(p2, ":105"))) - *p2 = '\0'; /* It is the default: ignore it */ + (!strcmp(acc_method, "snews" ) && !strcmp(p2, ":563")) || + (!strcmp(acc_method, "snewspost" ) && !strcmp(p2, ":563")) || + (!strcmp(acc_method, "snewsreply") && !strcmp(p2, ":563")) || + (!strcmp(acc_method, "finger" ) && !strcmp(p2, ":79" )) || + (!strcmp(acc_method, "telnet" ) && !strcmp(p2, ":23" )) || + (!strcmp(acc_method, "tn3270" ) && !strcmp(p2, ":23" )) || + (!strcmp(acc_method, "rlogin" ) && !strcmp(p2, ":513")) || + (!strcmp(acc_method, "cso" ) && !strcmp(p2, ":105"))) + *p2 = '\0'; /* It is the default: ignore it */ } if (p2 == NULL) { int len2 = strlen(tail); if (len2 > 0) { - h = tail + len2 - 1; /* last char of hostname */ - if (*h == '.') - *h = '\0'; /* chop final . */ + h = tail + len2 - 1; /* last char of hostname */ + if (*h == '.') + *h = '\0'; /* chop final . */ } - } else { + } else { h = p2; h--; /* End of hostname */ if (*h == '.') { - /* + /* ** Slide p2 over h. */ - while (*p2 != '\0') + while (*p2 != '\0') *h++ = *p2++; *h = '\0'; /* terminate */ } @@ -334,22 +334,22 @@ PUBLIC char * HTParse ARGS3( } /* - ** If different hosts, inherit no path. + ** If different hosts, inherit no path. */ if (given.host && related.host) - if (strcmp(given.host, related.host) != 0) { + if (strcmp(given.host, related.host) != 0) { related.absolute = NULL; related.relative = NULL; related.anchor = NULL; } /* - ** Handle the path. + ** Handle the path. */ if (wanted & PARSE_PATH) { - if (acc_method && !given.absolute && given.relative) { + if (acc_method && !given.absolute && given.relative) { if (!strcasecomp(acc_method, "nntp") || - !strcasecomp(acc_method, "snews") || + !strcasecomp(acc_method, "snews") || (!strcasecomp(acc_method, "news") && !strncasecomp(result, "news://", 7))) { /* @@ -361,12 +361,12 @@ PUBLIC char * HTParse ARGS3( given.relative = NULL; } } - if (given.absolute) { /* All is given */ + if (given.absolute) { /* All is given */ if (wanted & PARSE_PUNCTUATION) - strcat(result, "/"); + strcat(result, "/"); strcat(result, given.absolute); if (TRACE) - fprintf(stderr, "1\n"); + fprintf(stderr, "1\n"); } else if (related.absolute) { /* Adopt path not name */ strcat(result, "/"); strcat(result, related.absolute); @@ -377,42 +377,42 @@ PUBLIC char * HTParse ARGS3( for (; *p != '/'; p--) ; /* last / */ p[1] = '\0'; /* Remove filename */ - strcat(result, given.relative); /* Add given one */ + strcat(result, given.relative); /* Add given one */ HTSimplify (result); } if (TRACE) - fprintf(stderr, "2\n"); + fprintf(stderr, "2\n"); } else if (given.relative) { strcat(result, given.relative); /* what we've got */ if (TRACE) - fprintf(stderr, "3\n"); + fprintf(stderr, "3\n"); } else if (related.relative) { strcat(result, related.relative); if (TRACE) - fprintf(stderr, "4\n"); + fprintf(stderr, "4\n"); } else { /* No inheritance */ if (strncasecomp(aName, "lynxcgi:", 8) && - strncasecomp(aName, "lynxexec:", 9) && + strncasecomp(aName, "lynxexec:", 9) && strncasecomp(aName, "lynxprog:", 9)) { strcat(result, "/"); } if (!strcmp(result, "news:/")) - result[5] = '*'; + result[5] = '*'; if (TRACE) - fprintf(stderr, "5\n"); + fprintf(stderr, "5\n"); } } /* - ** Handle the fragment (anchor). + ** Handle the fragment (anchor). */ if (wanted & PARSE_ANCHOR) - if ((given.anchor && *given.anchor) || + if ((given.anchor && *given.anchor) || (!given.anchor && related.anchor)) { if (wanted & PARSE_PUNCTUATION) - strcat(result, "#"); + strcat(result, "#"); strcat(result, (given.anchor) ? - given.anchor : related.anchor); + given.anchor : related.anchor); } if (TRACE) fprintf(stderr, "HTParse: result:%s\n", result); @@ -432,16 +432,16 @@ PUBLIC char * HTParse ARGS3( ** be replaced by "" , and the seqeunce "/./" which may be replaced by "/". ** Simplification helps us recognize duplicate filenames. ** -** Thus, /etc/junk/../fred becomes /etc/fred -** /etc/junk/./fred becomes /etc/junk/fred +** Thus, /etc/junk/../fred becomes /etc/fred +** /etc/junk/./fred becomes /etc/junk/fred ** -** but we should NOT change +** but we should NOT change ** http://fred.xxx.edu/../.. ** ** or ../../albert.html */ PUBLIC void HTSimplify ARGS1( - char *, filename) + char *, filename) { char *p; char *q, *q1; @@ -454,13 +454,13 @@ PUBLIC void HTSimplify ARGS1( return; if (strchr(filename, '/') != NULL) { - for (p = (filename + 2); *p; p++) { + for (p = (filename + 2); *p; p++) { if (*p == '?') { - /* + /* ** We're still treating a ?searchpart as part of ** the path in HTParse() and scan(), but if we ** encounter a '?' here, assume it's the delimiter - ** and break. We also could check for a parameter + ** and break. We also could check for a parameter ** delimiter (';') here, but the current Fielding ** draft (wisely or ill-advisedly :) says that it ** should be ignored and collapsing be allowed in @@ -477,17 +477,17 @@ PUBLIC void HTSimplify ARGS1( if ((p[1] == '.') && (p[2] == '.') && (p[3] == '/' || p[3] == '?' || p[3] == '\0')) { /* - ** Handle "../", "..?" or "..". + ** Handle "../", "..?" or "..". */ for (q = (p - 1); (q >= filename) && (*q != '/'); q--) /* ** Back up to previous slash or beginning of string. */ - ; + ; if ((q[0] == '/') && - (strncmp(q, "/../", 4) && + (strncmp(q, "/../", 4) && strncmp(q, "/..?", 4)) && - !((q - 1) > filename && q[-1] == '/')) { + !((q - 1) > filename && q[-1] == '/')) { /* ** Not at beginning of string or in a ** host field, so remove the "/xxx/..". @@ -513,7 +513,7 @@ PUBLIC void HTSimplify ARGS1( } } else if (p[1] == '.' && p[2] == '/') { /* - ** Handle "./" by removing both characters. + ** Handle "./" by removing both characters. */ q = p; q1 = (p + 2); @@ -523,7 +523,7 @@ PUBLIC void HTSimplify ARGS1( p--; } else if (p[1] == '.' && p[2] == '?') { /* - ** Handle ".?" by removing the dot. + ** Handle ".?" by removing the dot. */ q = (p + 1); q1 = (p + 2); @@ -533,7 +533,7 @@ PUBLIC void HTSimplify ARGS1( p--; } else if (p[1] == '.' && p[2] == '\0') { /* - ** Handle terminal "." by removing the character. + ** Handle terminal "." by removing the character. */ p[1] = '\0'; } @@ -554,7 +554,7 @@ PUBLIC void HTSimplify ARGS1( (*(p-4) != '/' || (p > filename + 4 && *(p-5) != ':'))) { /* - ** Handle "xxx/..?" + ** Handle "xxx/..?" */ for (q = (p - 4); (q > filename) && (*q != '/'); q--) /* @@ -612,9 +612,9 @@ PUBLIC char * HTRelative ARGS2( CONST char * path = NULL; CONST char * last_slash = NULL; int slashes = 0; - + for (; *p; p++, q++) { /* Find extent of match */ - if (*p != *q) + if (*p != *q) break; if (*p == ':') after_access = p+1; @@ -622,25 +622,25 @@ PUBLIC char * HTRelative ARGS2( last_slash = p; slashes++; if (slashes == 3) - path=p; + path=p; } } - + /* q, p point to the first non-matching character or zero */ - + if (!after_access) { /* Different access */ - StrAllocCopy(result, aName); + StrAllocCopy(result, aName); } else if (slashes < 3){ /* Different nodes */ - StrAllocCopy(result, after_access); + StrAllocCopy(result, after_access); } else if (slashes == 3){ /* Same node, different path */ - StrAllocCopy(result, path); + StrAllocCopy(result, path); } else { /* Some path in common */ - int levels = 0; - for (; *q && (*q != '#'); q++) + int levels = 0; + for (; *q && (*q != '#'); q++) if (*q == '/') - levels++; + levels++; result = (char *)calloc(1, (3*levels + strlen(last_slash) + 1)); - if (result == NULL) + if (result == NULL) outofmem(__FILE__, "HTRelative"); result[0] = '\0'; for (; levels; levels--) @@ -648,8 +648,8 @@ PUBLIC char * HTRelative ARGS2( strcat(result, last_slash+1); } if (TRACE) - fprintf(stderr, "HT: `%s' expressed relative to\n `%s' is\n `%s'.", - aName, relatedName, result); + fprintf(stderr, "HT: `%s' expressed relative to\n `%s' is\n `%s'.", + aName, relatedName, result); return result; } @@ -666,15 +666,15 @@ PUBLIC char * HTRelative ARGS2( PRIVATE CONST unsigned char isAcceptable[96] = /* Bit 0 xalpha -- see HTFile.h -** Bit 1 xpalpha -- as xalpha but with plus. +** Bit 1 xpalpha -- as xalpha but with plus. ** Bit 3 ... path -- as xpalphas but with / */ - /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ - { 0,0,0,0,0,0,0,0,0,0,7,6,0,7,7,4, /* 2x !"#$%&'()*+,-./ */ - 7,7,7,7,7,7,7,7,7,7,0,0,0,0,0,0, /* 3x 0123456789:;<=>? */ + /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ + { 0,0,0,0,0,0,0,0,0,0,7,6,0,7,7,4, /* 2x !"#$%&'()*+,-./ */ + 7,7,7,7,7,7,7,7,7,7,0,0,0,0,0,0, /* 3x 0123456789:;<=>? */ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, /* 4x @ABCDEFGHIJKLMNO */ - 7,7,7,7,7,7,7,7,7,7,7,0,0,0,0,7, /* 5X PQRSTUVWXYZ[\]^_ */ - 0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, /* 6x `abcdefghijklmno */ + 7,7,7,7,7,7,7,7,7,7,7,0,0,0,0,7, /* 5X PQRSTUVWXYZ[\]^_ */ + 0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, /* 6x `abcdefghijklmno */ 7,7,7,7,7,7,7,7,7,7,7,0,0,0,0,0 }; /* 7X pqrstuvwxyz{|}~ DEL */ PRIVATE char *hex = "0123456789ABCDEF"; @@ -689,13 +689,13 @@ PUBLIC char * HTEscape ARGS2( char * result; int unacceptable = 0; for (p = str; *p; p++) - if (!ACCEPTABLE((unsigned char)TOASCII(*p))) + if (!ACCEPTABLE((unsigned char)TOASCII(*p))) unacceptable++; result = (char *)calloc(1, (p-str + unacceptable + unacceptable + 1)); if (result == NULL) - outofmem(__FILE__, "HTEscape"); + outofmem(__FILE__, "HTEscape"); for (q = result, p = str; *p; p++) { - unsigned char a = TOASCII(*p); + unsigned char a = TOASCII(*p); if (!ACCEPTABLE(a)) { *q++ = HEX_ESCAPE; /* Means hex commming */ *q++ = hex[a >> 4]; @@ -727,13 +727,13 @@ PUBLIC char * HTEscapeSP ARGS2( char * result; int unacceptable = 0; for (p = str; *p; p++) - if (!(*p == ' ' || ACCEPTABLE((unsigned char)TOASCII(*p)))) + if (!(*p == ' ' || ACCEPTABLE((unsigned char)TOASCII(*p)))) unacceptable++; result = (char *)calloc(1, (p-str + unacceptable + unacceptable + 1)); if (result == NULL) - outofmem(__FILE__, "HTEscape"); + outofmem(__FILE__, "HTEscape"); for (q = result, p = str; *p; p++) { - unsigned char a = TOASCII(*p); + unsigned char a = TOASCII(*p); if (a == 32) { *q++ = '+'; } else if (!ACCEPTABLE(a)) { @@ -759,40 +759,42 @@ PUBLIC char * HTEscapeSP ARGS2( PRIVATE char from_hex ARGS1( char, c) { - return c >= '0' && c <= '9' ? c - '0' - : c >= 'A' && c <= 'F'? c - 'A' + 10 - : c - 'a' + 10; /* accept small letters just in case */ + return c >= '0' && c <= '9' ? c - '0' + : c >= 'A' && c <= 'F'? c - 'A' + 10 + : c - 'a' + 10; /* accept small letters just in case */ } PUBLIC char * HTUnEscape ARGS1( - char *, str) + char *, str) { char * p = str; char * q = str; if (!(p && *p)) - return str; + return str; while (*p != '\0') { - if (*p == HEX_ESCAPE && + if (*p == HEX_ESCAPE && /* - * Tests shouldn't be needed, but better safe than sorry. + * Tests shouldn't be needed, but better safe than sorry. */ p[1] && p[2] && isxdigit((unsigned char)p[1]) && isxdigit((unsigned char)p[2])) { p++; - *q = from_hex(*p++) * 16; - *q = FROMASCII(*q + from_hex(*p++)); + if (*p) + *q = from_hex(*p++) * 16; + if (*p) + *q = FROMASCII(*q + from_hex(*p++)); q++; } else { - *q++ = *p++; + *q++ = *p++; } } - + *q++ = '\0'; return str; - + } /* HTUnEscape */ /* Decode some %xx escaped characters. HTUnEscapeSome() @@ -806,48 +808,51 @@ PUBLIC char * HTUnEscape ARGS1( ** The first string is converted in place, as it will never grow. */ PUBLIC char * HTUnEscapeSome ARGS2( - char *, str, - CONST char *, do_trans) + char *, str, + CONST char *, do_trans) { char * p = str; char * q = str; char testcode; if (p == NULL || *p == '\0' || do_trans == NULL || *do_trans == '\0') - return str; + return str; while (*p != '\0') { - if (*p == HEX_ESCAPE && + if (*p == HEX_ESCAPE && p[1] && p[2] && /* tests shouldn't be needed, but.. */ isxdigit((unsigned char)p[1]) && isxdigit((unsigned char)p[2]) && (testcode = from_hex(p[1])*16 + from_hex(p[2])) && /* %00 no good*/ strchr(do_trans, testcode)) { /* it's one of the ones we want */ - *q++ = FROMASCII(testcode); + *q++ = FROMASCII(testcode); p += 3; } else { - *q++ = *p++; + *q++ = *p++; } } - + *q++ = '\0'; return str; - + } /* HTUnEscapeSome */ PRIVATE CONST unsigned char crfc[96] = /* Bit 0 xalpha -- need "quoting" -** Bit 1 xpalpha -- need \escape if quoted +** Bit 1 xpalpha -- need \escape if quoted */ - /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ - { 1,0,3,0,0,0,0,0,1,1,0,0,1,0,1,0, /* 2x !"#$%&'()*+,-./ */ - 0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0, /* 3x 0123456789:;<=>? */ + /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ + { 1,0,3,0,0,0,0,0,1,1,0,0,1,0,1,0, /* 2x !"#$%&'()*+,-./ */ + 0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0, /* 3x 0123456789:;<=>? */ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4x @ABCDEFGHIJKLMNO */ - 0,0,0,0,0,0,0,0,0,0,0,1,2,1,0,0, /* 5X PQRSTUVWXYZ[\]^_ */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 6x `abcdefghijklmno */ + 0,0,0,0,0,0,0,0,0,0,0,1,2,1,0,0, /* 5X PQRSTUVWXYZ[\]^_ */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 6x `abcdefghijklmno */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3 }; /* 7X pqrstuvwxyz{|}~ DEL */ +/* +** Turn a string which is not a RFC 822 token into a quoted-string. - KW +*/ PUBLIC void HTMake822Word ARGS1( char **, str) { @@ -862,7 +867,7 @@ PUBLIC void HTMake822Word ARGS1( } for (p = *str; *p; p++) { a = *p; - if (a < 32 || a >= 128 || + if (a < 32 || a >= 128 || ((crfc[a-32]) & 1)) { if (!added) added = 2; @@ -878,10 +883,10 @@ PUBLIC void HTMake822Word ARGS1( return; result = (char *)calloc(1, (p-(*str) + added + 1)); if (result == NULL) - outofmem(__FILE__, "HTMake822Word"); + outofmem(__FILE__, "HTMake822Word"); result[0] = '"'; for (q = result + 1, p = *str; *p; p++) { - a = TOASCII(*p); + a = TOASCII(*p); if ((a != '\t') && ((a & 127) < 32 || ( a < 128 && ((crfc[a-32]) & 2)))) *q++ = '\\'; diff --git a/WWW/Library/Implementation/HTPlain.c b/WWW/Library/Implementation/HTPlain.c index 78f027ea..cc121ce6 100644 --- a/WWW/Library/Implementation/HTPlain.c +++ b/WWW/Library/Implementation/HTPlain.c @@ -42,28 +42,40 @@ PUBLIC int HTPlain_lastraw = -1; struct _HTStream { CONST HTStreamClass * isa; HText * text; - LYUCcharset * UCI; /* pointer to node_anchor's UCInfo */ - int in_char_set; /* tells us what charset we are fed */ - int htext_char_set; /* what charset we feed to HText */ + /* + ** The node_anchor UCInfo and handle for the input (PARSER) stage. - FM + */ + LYUCcharset * inUCI; + int inUCLYhndl; + /* + ** The node_anchor UCInfo and handle for the output (HTEXT) stage. - FM + */ + int outUCLYhndl; + /* + ** Counter, value, buffer and pointer for UTF-8 handling. - FM + */ char utf_count; UCode_t utf_char; - char utf_buf[8]; + char utf_buf[8]; char * utf_buf_p; + /* + ** The charset transformation structure. - FM + */ UCTransParams T; }; -PRIVATE char replace_buf [64]; /* buffer for replacement strings */ +PRIVATE char replace_buf [64]; /* buffer for replacement strings */ PRIVATE void HTPlain_getChartransInfo ARGS2( HTStream *, me, HTParentAnchor *, anchor) { - if (me->in_char_set < 0) { + if (me->inUCLYhndl < 0) { HTAnchor_copyUCInfoStage(anchor, UCT_STAGE_PARSER, UCT_STAGE_MIME, - UCT_SETBY_PARSER); - me->in_char_set = HTAnchor_getUCLYhndl(anchor, UCT_STAGE_PARSER); + UCT_SETBY_PARSER); + me->inUCLYhndl = HTAnchor_getUCLYhndl(anchor, UCT_STAGE_PARSER); } - if (me->htext_char_set < 0) { + if (me->outUCLYhndl < 0) { int chndl = HTAnchor_getUCLYhndl(anchor, UCT_STAGE_HTEXT); if (chndl < 0) { chndl = current_char_set; @@ -72,9 +84,9 @@ PRIVATE void HTPlain_getChartransInfo ARGS2( } HTAnchor_setUCInfoStage(anchor, chndl, UCT_STAGE_HTEXT, UCT_SETBY_DEFAULT); - me->htext_char_set = HTAnchor_getUCLYhndl(anchor, UCT_STAGE_HTEXT); + me->outUCLYhndl = HTAnchor_getUCLYhndl(anchor, UCT_STAGE_HTEXT); } - me->UCI = HTAnchor_getUCInfoStage(anchor, UCT_STAGE_PARSER); + me->inUCI = HTAnchor_getUCInfoStage(anchor, UCT_STAGE_PARSER); } /* Write the buffer out to the socket @@ -83,18 +95,13 @@ PRIVATE void HTPlain_getChartransInfo ARGS2( /*_________________________________________________________________________ ** -** A C T I O N R O U T I N E S +** A C T I O N R O U T I N E S */ - /* for forward reference to HTPlain_write - kw */ -#ifdef _WINDOWS -PRIVATE void HTPlain_write (HTStream * me, CONST char* s, int l); -#else PRIVATE void HTPlain_write PARAMS(( HTStream * me, CONST char * s, int l)); -#endif /* _WINDOWS */ /* Character handling ** ------------------ @@ -105,18 +112,18 @@ PRIVATE void HTPlain_put_character ARGS2( { #ifdef REMOVE_CR_ONLY /* - ** Throw away \r's. + ** Throw away \r's. */ if (c != '\r') { HText_appendCharacter(me->text, c); } #else /* - ** See HTPlain_write() for explanations of the following code - ** (we've been called via HTPlain_put_string() to do for each - ** character of a terminated string what HTPlain_write() does - ** via a while loop for each character in a stream of given - ** length). - FM + ** See HTPlain_write() for explanations of the following code + ** (we've been called via HTPlain_put_string() to do for each + ** character of a terminated string what HTPlain_write() does + ** via a while loop for each character in a stream of given + ** length). - FM */ if ((HTPlain_lastraw == '\r') && c == '\n') { HTPlain_lastraw = -1; @@ -134,12 +141,12 @@ PRIVATE void HTPlain_put_character ARGS2( */ HTPlain_write(me, &c, 1); } else if ((unsigned char)c >= 127 && (unsigned char)c < 161 && - HTPassHighCtrlRaw) { + HTPassHighCtrlRaw) { HText_appendCharacter(me->text, c); } else if ((unsigned char)c == 160) { HText_appendCharacter(me->text, ' '); } else if ((unsigned char)c == 173) { - return; + return; } else if (((unsigned char)c >= 32 && (unsigned char)c < 127) || c == '\n' || c == '\t') { HText_appendCharacter(me->text, c); @@ -148,7 +155,7 @@ PRIVATE void HTPlain_put_character ARGS2( current_char_set != 0) { int len, high, low, i, diff = 1; CONST char * name; - int value = (int)((unsigned char)c - 160); + UCode_t value = (UCode_t)((unsigned char)c - 160); name = HTMLGetEntityName(value); len = strlen(name); @@ -160,7 +167,7 @@ PRIVATE void HTPlain_put_character ARGS2( diff = strncmp(HTML_dtd.entity_names[i], name, len); if (diff == 0) { HText_appendText(me->text, - LYCharSets[current_char_set][i]); + LYCharSets[current_char_set][i]); break; } } @@ -189,7 +196,7 @@ PRIVATE void HTPlain_put_string ARGS2(HTStream *, me, CONST char*, s) if (s == NULL) return; for (p = s; *p; p++) { - HTPlain_put_character(me, *p); + HTPlain_put_character(me, *p); } #endif /* REMOVE_CR_ONLY */ } @@ -203,14 +210,15 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) { CONST char * p; CONST char * e = s+l; + char c; + unsigned char c_unsign; BOOL chk; UCode_t code; - long uck; - char c_p; + long uck = 0; for (p = s; p < e; p++) { #ifdef REMOVE_CR_ONLY - /* + /* ** Append the whole string, but remove any \r's. - FM */ if (*p != '\r') { @@ -232,82 +240,108 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) HText_appendCharacter(me->text, '\n'); continue; } - code = (unsigned char)*p; - c_p = *p; - + /* + ** Make sure the character is handled as Unicode + ** whenever that's appropriate. - FM + */ + c = *p; + c_unsign = (unsigned char)c; + code = (UCode_t)c_unsign; + /* + ** Combine any UTF-8 multibytes into Unicode + ** to check for special characters. - FM + */ if (me->T.decode_utf8) { /* - ** Combine UTF-8 into Unicode. - ** Incomplete characters silently ignored. - ** from Linux kernel's console.c + ** Combine UTF-8 into Unicode. + ** Incomplete characters silently ignored. + ** from Linux kernel's console.c - KW */ - if ((unsigned char)(*p) > 127) { - if (me->utf_count > 0 && (*p & 0xc0) == 0x80) { - me->utf_char = (me->utf_char << 6) | (*p & 0x3f); + if (c_unsign > 127) { + /* + ** We have an octet from a multibyte character. - FM + */ + if (me->utf_count > 0 && (c & 0xc0) == 0x80) { + /* + ** Adjust the UCode_t value, add the octet + ** to the buffer, and decrement the byte + ** count. - FM + */ + me->utf_char = (me->utf_char << 6) | (c & 0x3f); me->utf_count--; - *(me->utf_buf_p) = *p; + *(me->utf_buf_p) = c; (me->utf_buf_p)++; if (me->utf_count == 0) { - /* + /* ** Got a complete multibyte character. */ *(me->utf_buf_p) = '\0'; code = me->utf_char; if (code < 256) { - c_p = FROMASCII((char)code); + c = FROMASCII((char)code); } } else { - continue; /* iterate for more */ + /* + ** Get the next byte. - FM + */ + continue; } } else { /* - ** Accumulate a multibyte character. + ** Start handling a new multibyte character. - FM */ me->utf_buf_p = me->utf_buf; - *(me->utf_buf_p) = *p; + me->utf_buf_p[0] = c; (me->utf_buf_p)++; if ((*p & 0xe0) == 0xc0) { me->utf_count = 1; - me->utf_char = (*p & 0x1f); + me->utf_char = (c & 0x1f); } else if ((*p & 0xf0) == 0xe0) { me->utf_count = 2; - me->utf_char = (*p & 0x0f); + me->utf_char = (c & 0x0f); } else if ((*p & 0xf8) == 0xf0) { me->utf_count = 3; - me->utf_char = (*p & 0x07); + me->utf_char = (c & 0x07); } else if ((*p & 0xfc) == 0xf8) { me->utf_count = 4; - me->utf_char = (*p & 0x03); + me->utf_char = (c & 0x03); } else if ((*p & 0xfe) == 0xfc) { me->utf_count = 5; - me->utf_char = (*p & 0x01); + me->utf_char = (c & 0x01); } else { /* - * Garbage. + * We got garbage, so ignore it. - FM */ me->utf_count = 0; me->utf_buf_p = me->utf_buf; - *(me->utf_buf_p) = '\0'; + me->utf_buf_p[0] = '\0'; } - continue; /* iterate for more */ + /* + ** Get the next byte. - FM + */ + continue; } } else { - /* + /* ** Got an ASCII character. */ me->utf_count = 0; + me->utf_buf[0] = '\0'; me->utf_buf_p = me->utf_buf; - *(me->utf_buf_p) = '\0'; } } - + if (me->T.trans_to_uni && (code >= 127 || - (code < 32 && code != 0 && me->T.trans_C0_to_uni))) { - code = UCTransToUni(c_p, me->in_char_set); + (code < 32 && code != 0 && + me->T.trans_C0_to_uni))) { + /* + ** Convert the octet to Unicode. - FM + */ + code = (UCode_t)UCTransToUni(c, me->inUCLYhndl); if (code > 0) { if (code < 256) { - c_p = FROMASCII((char)code); + c = FROMASCII((char)code); } } } @@ -323,14 +357,13 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) ** user should toggle off raw/CJK mode to reload. - FM */ if (HTCJK != NOCJK) { - HText_appendCharacter(me->text, c_p); + HText_appendCharacter(me->text, c); #define PASSHICTRL (me->T.transp || \ - code >= LYlowest_eightbit[me->in_char_set]) + code >= LYlowest_eightbit[me->inUCLYhndl]) #define PASS8859SPECL me->T.pass_160_173_raw #define PASSHI8BIT (HTPassEightBitRaw || \ (me->T.do_8bitraw && !me->T.trans_from_uni)) - /* ** If HTPassHighCtrlRaw is set (e.g., for KOI8-R) assume the ** document matches and pass 127-160 8-bit characters. If it @@ -338,9 +371,9 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) */ } else if (code >= 127 && code < 161 && PASSHICTRL && PASS8859SPECL) { - HText_appendCharacter(me->text, *p); + HText_appendCharacter(me->text, c); } else if (code == 173 && PASS8859SPECL) { - HText_appendCharacter(me->text, *p); + HText_appendCharacter(me->text, c); /* ** If neither HTPassHighCtrlRaw nor CJK is set, play it safe ** and treat 160 (nbsp) as an ASCII space (32). - FM @@ -358,15 +391,15 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) */ } else if ((code >= 32 && code < 127) || (PASSHI8BIT && - c_p >= LYlowest_eightbit[me->htext_char_set]) || + c >= LYlowest_eightbit[me->outUCLYhndl]) || *p == '\n' || *p == '\t') { - HText_appendCharacter(me->text, c_p); + HText_appendCharacter(me->text, c); } else if (me->T.use_raw_char_in) { HText_appendCharacter(me->text, *p); -#ifdef NOTUSED_FOTEMODS +#ifdef NOTDEFINED /* - ** Use an ASCII space (32) for ensp, emsp or thinsp. - FM + ** Use an ASCII space (32) for ensp, emsp or thinsp. - FM */ } else if (code == 8194 || code == 8195 || code == 8201) { HText_appendCharacter(me->text, ' '); @@ -376,21 +409,21 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) */ } else if (code == 8211 || code == 8212) { HText_appendCharacter(me->text, '-'); -#endif /* NOTUSED_FOTEMODS */ +#endif /* NOTDEFINED */ /****************************************************************** * I. LATIN-1 OR UCS2 TO DISPLAY CHARSET - ******************************************************************/ + ******************************************************************/ } else if ((chk = (me->T.trans_from_uni && code >= 160)) && (uck = UCTransUniChar(code, - me->htext_char_set)) >= 32 && + me->outUCLYhndl)) >= 32 && uck < 256) { if (TRACE) { fprintf(stderr, "UCTransUniChar returned 0x%.2lX:'%c'.\n", uck, FROMASCII((char)uck)); } - HText_appendCharacter(me->text, (char)(uck & 0xff)); + HText_appendCharacter(me->text, ((char)(uck & 0xff))); } else if (chk && (uck == -4 || (me->T.repl_translated_C0 && uck > 0 && uck < 32)) && @@ -398,48 +431,48 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) ** Not found; look for replacement string. */ (uck = UCTransUniCharStr(replace_buf, 60, code, - me->htext_char_set, 0) >= 0)) { + me->outUCLYhndl, 0) >= 0)) { /* - ** No further tests for valididy - assume that whoever - ** defined replacement strings knew what she was doing. + ** No further tests for valididy - assume that whoever + ** defined replacement strings knew what she was doing. */ HText_appendText(me->text, replace_buf); /* ** If we get to here, and should have translated, - ** translation has failed so far. + ** translation has failed so far. */ } else if (chk && code > 127 && me->T.output_utf8) { /* - ** We want UTF-8 output, so do it now. - FM + ** We want UTF-8 output, so do it now. - FM */ if (*me->utf_buf) { HText_appendText(me->text, me->utf_buf); + me->utf_buf[0] = '\0'; me->utf_buf_p = me->utf_buf; - *(me->utf_buf_p) = '\0'; } else if (UCConvertUniToUtf8(code, replace_buf)) { HText_appendText(me->text, replace_buf); } else { sprintf(replace_buf, "U%.2lX", code); HText_appendText(me->text, replace_buf); } -#ifdef NOTUSED_FOTEMODS +#ifdef NOTDEFINED } else if (me->T.strip_raw_char_in && - (unsigned char)*p >= 0xc0 && + (unsigned char)*p >= 192 && (unsigned char)*p < 255) { /* - ** KOI special: strip high bit, gives - ** (somewhat) readable ASCII. + ** KOI special: strip high bit, gives + ** (somewhat) readable ASCII. */ HText_appendCharacter(me->text, (char)(*p & 0x7f)); /* - ** If we do not have the "7-bit approximations" as our - ** output character set (in which case we did it already) - ** seek a translation for that. Otherwise, or if the - ** translation fails, use UHHH notation. - FM + ** If we do not have the "7-bit approximations" as our + ** output character set (in which case we did it already) + ** seek a translation for that. Otherwise, or if the + ** translation fails, use UHHH notation. - FM */ } else if (chk && (chk = (!HTPassEightBitRaw && - (me->htext_char_set != + (me->outUCLYhndl != UCGetLYhndl_byMIME("us-ascii")))) && (uck = UCTransUniChar(code, UCGetLYhndl_byMIME("us-ascii"))) @@ -460,7 +493,7 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) HText_appendText(me->text, replace_buf); } else if (code == 8204 || code == 8205) { /* - ** Ignore 8204 (zwnj) or 8205 (zwj), if we get to here. - FM + ** Ignore 8204 (zwnj) or 8205 (zwj), if we get to here. - FM */ if (TRACE) { fprintf(stderr, @@ -468,16 +501,16 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) } } else if (code == 8206 || code == 8207) { /* - ** Ignore 8206 (lrm) or 8207 (rlm), if we get to here. - FM + ** Ignore 8206 (lrm) or 8207 (rlm), if we get to here. - FM */ if (TRACE) { fprintf(stderr, "HTPlain_write: Ignoring '%ld'.\n", code); } -#endif /* NOTUSED_FOTEMODS */ +#endif /* NOTDEFINED */ } else if (me->T.trans_from_uni && code > 255) { if (PASSHI8BIT && PASSHICTRL && LYRawMode && - (unsigned char)*p >= LYlowest_eightbit[me->htext_char_set]) { + (unsigned char)*p >= LYlowest_eightbit[me->outUCLYhndl]) { HText_appendCharacter(me->text, *p); } else { sprintf(replace_buf, "U%.2lX", code); @@ -491,9 +524,9 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) */ } else if (code > 160) { if (!HTPassEightBitRaw && code <= 255 && - me->htext_char_set != 0) { + me->outUCLYhndl != 0) { /* - ** Attempt to translate. - FM + ** Out of luck, so use the UHHH notation (ugh). - FM */ int len, high, low, i, diff=1; CONST char * name; @@ -509,18 +542,18 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) diff = strncmp(HTML_dtd.entity_names[i], name, len); if (diff == 0) { HText_appendText(me->text, - LYCharSets[me->htext_char_set][i]); + LYCharSets[me->outUCLYhndl][i]); break; } } if (diff) { /* - ** Something went wrong in the translation, so - ** either output as UTF8 or a hex representation or - ** pass the raw character and hope it's OK. + ** Something went wrong in the translation, so + ** either output as UTF8 or a hex representation or + ** pass the raw character and hope it's OK. */ if (!PASSHI8BIT) - c_p = FROMASCII((char)code); + c = FROMASCII((char)code); if (me->T.output_utf8 && *me->utf_buf) { HText_appendText(me->text, me->utf_buf); @@ -531,33 +564,33 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) sprintf(replace_buf, "U%.2lX", code); HText_appendText(me->text, replace_buf); } else - HText_appendCharacter(me->text, c_p); + HText_appendCharacter(me->text, c); } } else { - /* + /* ** Didn't attempt a translation. - FM */ /* Either output as UTF8 or a hex representation or ** pass the raw character and hope it's OK. */ if (code <= 255 && !PASSHI8BIT) - c_p = FROMASCII((char)code); + c = FROMASCII((char)code); if (code > 127 && me->T.output_utf8 && *me->utf_buf) { HText_appendText(me->text, me->utf_buf); me->utf_buf_p = me->utf_buf; *(me->utf_buf_p) = '\0'; } else if (LYRawMode && - me->in_char_set != me->htext_char_set && + me->inUCLYhndl != me->outUCLYhndl && (PASSHI8BIT || PASSHICTRL) && - (unsigned char)c_p >= - LYlowest_eightbit[me->htext_char_set]) { - HText_appendCharacter(me->text, c_p); + (unsigned char)c >= + LYlowest_eightbit[me->outUCLYhndl]) { + HText_appendCharacter(me->text, c); } else if (me->T.trans_from_uni && code >= 127) { sprintf(replace_buf, "U%.2lX", code); HText_appendText(me->text, replace_buf); } else - HText_appendCharacter(me->text, c_p); + HText_appendCharacter(me->text, c); } } #endif /* REMOVE_CR_ONLY */ @@ -589,25 +622,25 @@ PRIVATE void HTPlain_abort ARGS2( ** ----------------------- */ PUBLIC CONST HTStreamClass HTPlain = -{ +{ "PlainPresenter", HTPlain_free, HTPlain_abort, - HTPlain_put_character, HTPlain_put_string, HTPlain_write, -}; + HTPlain_put_character, HTPlain_put_string, HTPlain_write, +}; /* New object ** ---------- */ PUBLIC HTStream* HTPlainPresent ARGS3( HTPresentation *, pres, - HTParentAnchor *, anchor, + HTParentAnchor *, anchor, HTStream *, sink) { HTStream* me = (HTStream*)malloc(sizeof(*me)); if (me == NULL) - outofmem(__FILE__, "HTPlain_new"); + outofmem(__FILE__, "HTPlain_new"); me->isa = &HTPlain; HTPlain_lastraw = -1; @@ -616,18 +649,17 @@ PUBLIC HTStream* HTPlainPresent ARGS3( me->utf_char = 0; me->utf_buf[0] = me->utf_buf[6] =me->utf_buf[7] = '\0'; me->utf_buf_p = me->utf_buf; - me->htext_char_set = - HTAnchor_getUCLYhndl(anchor,UCT_STAGE_HTEXT); - me->in_char_set = HTAnchor_getUCLYhndl(anchor,UCT_STAGE_PARSER); + me->outUCLYhndl = HTAnchor_getUCLYhndl(anchor,UCT_STAGE_HTEXT); + me->inUCLYhndl = HTAnchor_getUCLYhndl(anchor,UCT_STAGE_PARSER); HTPlain_getChartransInfo(me, anchor); UCSetTransParams(&me->T, - me->in_char_set, me->UCI, - me->htext_char_set, + me->inUCLYhndl, me->inUCI, + me->outUCLYhndl, HTAnchor_getUCInfoStage(anchor,UCT_STAGE_HTEXT)); + me->text = HText_new(anchor); HText_setStyle(me->text, HTStyleNamed(styleSheet, "Example")); HText_beginAppend(me->text); return (HTStream*) me; } - diff --git a/WWW/Library/Implementation/HTString.c b/WWW/Library/Implementation/HTString.c index 2ffa3e51..bc3c3334 100644 --- a/WWW/Library/Implementation/HTString.c +++ b/WWW/Library/Implementation/HTString.c @@ -23,7 +23,7 @@ PUBLIC int WWW_TraceFlag = 0; /* Global trace flag for ALL W3 code */ PUBLIC CONST char * HTLibraryVersion = VC; /* String for help screen etc */ #ifndef VM /* VM has these already it seems */ - + /* Strings of any length ** --------------------- */ @@ -35,13 +35,13 @@ PUBLIC int strcasecomp ARGS2( CONST char *q = b; for (p = a, q = b; *p && *q; p++, q++) { - int diff = TOLOWER(*p) - TOLOWER(*q); + int diff = TOLOWER(*p) - TOLOWER(*q); if (diff) return diff; } if (*p) - return 1; /* p was longer than q */ + return 1; /* p was longer than q */ if (*q) - return -1; /* p was shorter than q */ + return -1; /* p was shorter than q */ return 0; /* Exact match */ } @@ -58,7 +58,7 @@ PUBLIC int strncasecomp ARGS3( CONST char *q = b; for (p = a, q = b; ; p++, q++) { - int diff; + int diff; if (p == (a+n)) return 0; /* Match up to n characters */ if (!(*p && *q)) @@ -79,7 +79,7 @@ PUBLIC char * HTSACopy ARGS2( { FREE(*dest); if (src) { - *dest = (char *) malloc (strlen(src) + 1); + *dest = (char *) malloc (strlen(src) + 1); if (*dest == NULL) outofmem(__FILE__, "HTSACopy"); strcpy (*dest, src); @@ -94,16 +94,16 @@ PUBLIC char * HTSACat ARGS2( CONST char *, src) { if (src && *src) { - if (*dest) { + if (*dest) { int length = strlen(*dest); *dest = (char *)realloc(*dest, length + strlen(src) + 1); if (*dest == NULL) - outofmem(__FILE__, "HTSACat"); + outofmem(__FILE__, "HTSACat"); strcpy (*dest + length, src); } else { *dest = (char *)malloc(strlen(src) + 1); if (*dest == NULL) - outofmem(__FILE__, "HTSACat"); + outofmem(__FILE__, "HTSACat"); strcpy (*dest, src); } } @@ -123,26 +123,26 @@ PUBLIC char * HTSACat ARGS2( ** field ** THE STRING HAS BEEN MUTILATED by a 0 terminator ** -** returns a pointer to the first field +** returns a pointer to the first field */ PUBLIC char * HTNextField ARGS1( char **, pstr) { char * p = *pstr; char * start; /* start of field */ - + while (*p && WHITE(*p)) - p++; /* Strip white space */ + p++; /* Strip white space */ if (!*p) { *pstr = p; - return NULL; /* No first field */ + return NULL; /* No first field */ } if (*p == '"') { /* quoted field */ - p++; + p++; start = p; for (; *p && *p!='"'; p++) { if (*p == '\\' && p[1]) - p++; /* Skip escaped chars */ + p++; /* Skip escaped chars */ } } else { start = p; @@ -150,7 +150,7 @@ PUBLIC char * HTNextField ARGS1( p++; /* Skip first field */ } if (*p) - *p++ = '\0'; + *p++ = '\0'; *pstr = p; return start; } @@ -160,31 +160,31 @@ PUBLIC char * HTNextField ARGS1( ** Finds the next token in a string ** On entry, ** *pstr points to a string to be parsed. -** delims lists characters to be recognized as delimiters. -** If NULL default is white white space "," ";" or "=". -** The word can optionally be quoted or enclosed with +** delims lists characters to be recognized as delimiters. +** If NULL default is white white space "," ";" or "=". +** The word can optionally be quoted or enclosed with ** chars from bracks. ** Comments surrrounded by '(' ')' are filtered out ** unless they are specifically reqested by including ** ' ' or '(' in delims or bracks. -** bracks lists bracketing chars. Some are recognized as -** special, for those give the opening char. +** bracks lists bracketing chars. Some are recognized as +** special, for those give the opening char. ** If NULL defaults to <"> and "<" ">". -** found points to location to fill with the ending delimiter -** found, or is NULL. +** found points to location to fill with the ending delimiter +** found, or is NULL. ** -** On exit, +** On exit, ** *pstr has been moved to the first delimiter past the ** field ** THE STRING HAS BEEN MUTILATED by a 0 terminator -** found points to the delimiter found unless it was NULL. -** Returns a pointer to the first word or NULL on error +** found points to the delimiter found unless it was NULL. +** Returns a pointer to the first word or NULL on error */ PUBLIC char * HTNextTok ARGS4( char **, pstr, const char *, delims, const char *, bracks, - char *, found) + char *, found) { char * p = *pstr; char * start = NULL; @@ -198,15 +198,15 @@ PUBLIC char * HTNextTok ARGS4( get_blanks = (!strchr(delims,' ') && !strchr(bracks,' ')); get_comments = (strchr(bracks,'(') != NULL); - skip_comments = (!get_comments && !strchr(delims,'(') && !get_blanks); + skip_comments = (!get_comments && !strchr(delims,'(') && !get_blanks); #define skipWHITE(c) (!get_blanks && WHITE(c)) while (*p && skipWHITE(*p)) - p++; /* Strip white space */ + p++; /* Strip white space */ if (!*p) { *pstr = p; if (found) *found = '\0'; - return NULL; /* No first field */ + return NULL; /* No first field */ } while (1) { /* Strip white space and other delimiters */ @@ -214,7 +214,7 @@ PUBLIC char * HTNextTok ARGS4( if (!*p) { *pstr = p; if (found) *found = *(p-1); - return NULL; /* No field */ + return NULL; /* No field */ } if (*p == '(' && (skip_comments || get_comments)) { /* Comment */ @@ -238,13 +238,13 @@ PUBLIC char * HTNextTok ARGS4( } else get_closing_char_too = (strchr(bracks,*p) != NULL); } - } else if (strchr(bracks,*p)) { /* quoted or bracketted field */ + } else if (strchr(bracks,*p)) { /* quoted or bracketted field */ switch (*p) { case '<': closer = '>'; break; case '[': closer = ']'; break; case '{': closer = '}'; break; case ':': closer = ';'; break; - default: closer = *p; + default: closer = *p; } if (!start) start = ++p; for(;*p && *p!=closer; p++) @@ -258,7 +258,7 @@ PUBLIC char * HTNextTok ARGS4( } else break; /* kr95-10-9: needs to stop here */ #if 0 - } else if (*p == '<') { /* quoted field */ + } else if (*p == '<') { /* quoted field */ if (!start) start = ++p; for(;*p && *p!='>'; p++) if (*p == '\\' && *(p+1)) p++; /* Skip escaped chars */ @@ -267,14 +267,14 @@ PUBLIC char * HTNextTok ARGS4( } else { /* Spool field */ if (!start) start = p; while(*p && !skipWHITE(*p) && !strchr(bracks,*p) && - !strchr(delims,*p)) + !strchr(delims,*p)) p++; if (*p && strchr(bracks,*p)) { get_closing_char_too = TRUE; } else { if (*p=='(' && skip_comments) { *pstr = p; - HTNextTok(pstr, NULL, "(", found); /* Advance pstr */ + HTNextTok(pstr, NULL, "(", found); /* Advance pstr */ *p = '\0'; if (*pstr && **pstr) (*pstr)++; return start; @@ -284,7 +284,7 @@ PUBLIC char * HTNextTok ARGS4( } } if (found) *found = *p; - + if (*p) *p++ = '\0'; *pstr = p; return start; diff --git a/WWW/Library/Implementation/HTStyle.c b/WWW/Library/Implementation/HTStyle.c index 480719ea..a5e24205 100644 --- a/WWW/Library/Implementation/HTStyle.c +++ b/WWW/Library/Implementation/HTStyle.c @@ -62,9 +62,9 @@ HTStyle * HTStyleRead (HTStyle * style, HTStream * stream) char myTag[STYLE_NAME_LENGTH]; char fontName[STYLE_NAME_LENGTH]; NXTextStyle *p; - int tab; + int tab; int gotpara; /* flag: have we got a paragraph definition? */ - + NXScanf(stream, "%s%s%f%d", myTag, fontName, @@ -93,13 +93,13 @@ HTStyle * HTStyleRead (HTStyle * style, HTStream * stream) &p->tabs[tab].x); } } else { /* No paragraph */ - FREE(style->paragraph); + FREE(style->paragraph); } /* if no paragraph */ StrAllocCopy(style->SGMLTag, myTag); if (strcmp(fontName, NONE_STRING)==0) - style->font = 0; + style->font = 0; else - style->font = [Font newFont:fontName size:style->fontSize]; + style->font = [Font newFont:fontName size:style->fontSize]; return NULL; } @@ -126,7 +126,7 @@ HTStyle * HTStyleWrite (HTStyle * style, NXStream * stream) style->spaceBefore, style->spaceAfter, p->numTabs); - + for (tab=0; tab < p->numTabs; tab++) NXPrintf(stream, "\t%d %f\n", p->tabs[tab].kind, @@ -143,14 +143,14 @@ HTStyle * HTStyleDump (HTStyle * style) int tab; NXTextStyle *p = style->paragraph; printf("Style %d `%s' SGML:%s. Font %s %.1f point.\n", - style, + style, style->name, style->SGMLTag, [style->font name], style->fontSize); if (p) { - printf( - "\tIndents: first=%.0f others=%.0f, Height=%.1f Desc=%.1f\n" + printf( + "\tIndents: first=%.0f others=%.0f, Height=%.1f Desc=%.1f\n" "\tAlign=%d, %d tabs. (%.0f before, %.0f after)\n", p->indent1st, p->indent2nd, @@ -160,12 +160,12 @@ HTStyle * HTStyleDump (HTStyle * style) p->numTabs, style->spaceBefore, style->spaceAfter); - + for (tab=0; tab < p->numTabs; tab++) { printf("\t\tTab kind=%d at %.0f\n", p->tabs[tab].kind, p->tabs[tab].x); - } + } printf("\n"); } /* if paragraph */ return style; @@ -183,7 +183,7 @@ HTStyle * HTStyleNamed ARGS2 (HTStyleSheet *,self, CONST char *,name) { HTStyle * scan; for (scan=self->styles; scan; scan=scan->next) - if (0==strcmp(scan->name, name)) return scan; + if (0==strcmp(scan->name, name)) return scan; if (TRACE) fprintf(stderr, "StyleSheet: No style named `%s'\n", name); return NULL; } @@ -194,7 +194,7 @@ HTStyle * HTStyleMatching (HTStyleSheet * self, HTStyle *style) { HTStyle * scan; for (scan=self->styles; scan; scan=scan->next) - if (scan->paragraph == para) return scan; + if (scan->paragraph == para) return scan; return NULL; } @@ -214,14 +214,14 @@ HTStyle * HTStyleForRun (HTStyleSheet *self, NXRun *run) { HTStyle * scan; HTStyle * best = 0; - int bestMatch = 0; + int bestMatch = 0; NXTextStyle * rp = run->paraStyle; for (scan=self->styles; scan; scan=scan->next) - if (scan->paragraph == run->paraStyle) return scan; /* Exact */ + if (scan->paragraph == run->paraStyle) return scan; /* Exact */ for (scan=self->styles; scan; scan=scan->next){ - NXTextStyle * sp = scan->paragraph; - if (sp) { + NXTextStyle * sp = scan->paragraph; + if (sp) { int match = 0; if (sp->indent1st == rp->indent1st) match = match+1; if (sp->indent2nd == rp->indent2nd) match = match+2; @@ -236,7 +236,7 @@ HTStyle * HTStyleForRun (HTStyleSheet *self, NXRun *run) } } if (TRACE) fprintf(stderr, "HTStyleForRun: Best match for style is %d out of 18\n", - bestMatch); + bestMatch); return best; } #endif /* NEXT_SUPRESS */ @@ -250,10 +250,10 @@ HTStyleSheet * HTStyleSheetAddStyle ARGS2 { style->next = 0; /* The style will go on the end */ if (!self->styles) { - self->styles = style; + self->styles = style; } else { - HTStyle * scan; - for(scan=self->styles; scan->next; scan=scan->next); /* Find end */ + HTStyle * scan; + for(scan=self->styles; scan->next; scan=scan->next); /* Find end */ scan->next=style; } return self; @@ -266,13 +266,13 @@ HTStyleSheet * HTStyleSheetRemoveStyle ARGS2 (HTStyleSheet *,self, HTStyle *,style) { if (self->styles == style) { - self->styles = style->next; + self->styles = style->next; return self; } else { - HTStyle * scan; + HTStyle * scan; for(scan = self->styles; scan; scan = scan->next) { if (scan->next == style) { - scan->next = style->next; + scan->next = style->next; return self; } } @@ -290,7 +290,7 @@ HTStyleSheet * HTStyleSheetNew NOARGS memset((void*)self, 0, sizeof(*self)); /* ANSI */ /* Harbison c ref man says (char*)self but k&r ansii and abc books and Think_C say (void*) */ - + /* bzero(self, sizeof(*self)); */ /* BSD */ return self; } @@ -302,7 +302,7 @@ HTStyleSheet * HTStyleSheetFree ARGS1 (HTStyleSheet *,self) { HTStyle * style; while((style=self->styles)!=0) { - self->styles = style->next; + self->styles = style->next; HTStyleFree(style); } FREE(self); @@ -327,8 +327,8 @@ HTStyleSheet * HTStyleSheetRead(HTStyleSheet * self, NXStream * stream) NXScanf(stream, " %d ", &numStyles); if (TRACE) fprintf(stderr, "Stylesheet: Reading %d styles\n", numStyles); for (i=0; i<numStyles; i++) { - NXScanf(stream, "%s", styleName); - style = HTStyleNamed(self, styleName); + NXScanf(stream, "%s", styleName); + style = HTStyleNamed(self, styleName); if (!style) { style = HTStyleNewNamed(styleName); (void) HTStyleSheetAddStyle(self, style); @@ -349,13 +349,13 @@ HTStyleSheet * HTStyleSheetWrite(HTStyleSheet * self, NXStream * stream) { int numStyles = 0; HTStyle * style; - + for(style=self->styles; style; style=style->next) numStyles++; NXPrintf(stream, "%d\n", numStyles); - + if (TRACE) fprintf(stderr, "StyleSheet: Writing %d styles\n", numStyles); for (style=self->styles; style; style=style->next) { - NXPrintf(stream, "%s ", style->name); + NXPrintf(stream, "%s ", style->name); (void) HTStyleWrite(style, stream); } return self; diff --git a/WWW/Library/Implementation/HTTelnet.c b/WWW/Library/Implementation/HTTelnet.c index 50bc1fcd..2459d1b1 100644 --- a/WWW/Library/Implementation/HTTelnet.c +++ b/WWW/Library/Implementation/HTTelnet.c @@ -6,7 +6,7 @@ ** JFG Jean-Francois Groff jgh@next.com ** DD Denis DeLaRoca (310) 825-4580 <CSP1DWD@mvs.oac.ucla.edu> ** History -** 8 Jun 92 Telnet hopping prohibited as telnet is not secure (TBL) +** 8 Jun 92 Telnet hopping prohibited as telnet is not secure (TBL) ** 26 Jun 92 When over DECnet, suppressed FTP, Gopher and News. (JFG) ** 6 Oct 92 Moved HTClientHost and logfile into here. (TBL) ** 17 Dec 92 Tn3270 added, bug fix. (DD) @@ -32,7 +32,7 @@ #include "HTAccess.h" #include "HTAlert.h" #if !defined (VMS) && !defined (_WINDOWS) -#include "../../../userdefs.h" /* for TELNET_COMMAND and RLOGIN_COMMAND */ +#include "../../../userdefs.h" /* for TELNET_COMMAND and RLOGIN_COMMAND */ #endif /* not VMS */ #ifdef _WINDOWS /* ../../.. doesn't work for me */ @@ -53,7 +53,7 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) { char * user = host; char * password = NULL; - char * cp; + char * cp; char * hostname; char * port; char command[256]; @@ -69,23 +69,23 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) * Modified to allow for odd chars in a username only if exists. * 05-28-94 Lynx 2-3-1 Garrett Arch Blythe */ - /* prevent telnet://hostname;rm -rf * URL's (VERY BAD) + /* prevent telnet://hostname;rm -rf * URL's (VERY BAD) * *cp=0; / * terminate at any ;,<,>,`,|,",' or space or return - * or tab to prevent security whole + * or tab to prevent security whole */ for(cp = (strchr(host, '@') ? strchr(host, '@') : host); *cp != '\0'; cp++) { if(!isalnum(*cp) && *cp != '_' && *cp != '-' && *cp != ':' && *cp != '.' && *cp != '@') { - *cp = '\0'; - break; + *cp = '\0'; + break; } } hostname = strchr(host, '@'); if (hostname) { - *hostname++ = '\0'; /* Split */ + *hostname++ = '\0'; /* Split */ } else { hostname = host; user = NULL; /* No user specified */ @@ -96,13 +96,13 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) *port++ = '\0'; /* Split */ if (!hostname || *hostname == '\0') { - if (TRACE) + if (TRACE) fprintf(stderr, "HTTelnet: No host specified!\n"); return HT_NO_DATA; } if (user) { - password = strchr(user, ':'); + password = strchr(user, ':'); if (password) { *password++ = '\0'; } @@ -114,7 +114,7 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) if (HTSecure) { #ifdef TELNETHOPPER_MAIL - sprintf(command, + sprintf(command, "finger @%s | mail -s \"**telnethopper %s\" tbl@dxcern.cern.ch", HTClientHost, HTClientHost); system(command); @@ -138,16 +138,16 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) /* Not all telnet servers get it even if user name is specified ** so we always tell the guy what to log in as */ - if (user && login_protocol != rlogin) + if (user && login_protocol != rlogin) printf("When you are connected, log in as: %s\n", user); - if (password && login_protocol != rlogin) + if (password && login_protocol != rlogin) printf(" The password is: %s\n", password); /* * NeXTSTEP is the implied version of the NeXT operating system. * You may need to define this yourself. */ -#if defined(NeXT) && defined(NeXTSTEP) && NeXTSTEP<=20100 +#if defined(NeXT) && defined(NeXTSTEP) && NeXTSTEP<=20100 sprintf(command, "%s%s%s %s %s", TELNET_COMMAND, user ? " -l " : "", user ? user : "", @@ -229,59 +229,59 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) #endif /* MULTINET */ #if defined(WIN_TCP) - { - char *cp; - + { + char *cp; + if ((cp=getenv("WINTCP_COMMAND_STYLE")) != NULL && - 0==strncasecomp(cp, "VMS", 3)) { /* VMS command syntax */ - if (login_protocol == rlogin) { - sprintf(command, "RLOGIN%s%s%s%s%s %s", /*lm 930713 */ - user ? "/USERNAME=\"" : "", - user ? user : "", + 0==strncasecomp(cp, "VMS", 3)) { /* VMS command syntax */ + if (login_protocol == rlogin) { + sprintf(command, "RLOGIN%s%s%s%s%s %s", /*lm 930713 */ + user ? "/USERNAME=\"" : "", + user ? user : "", user ? "\"" : "", - port ? "/PORT=" : "", - port ? port : "", - hostname); - - } else if (login_protocol == tn3270) { - sprintf(command, "TELNET/TN3270 %s%s %s", - port ? "/PORT=" : "", - port ? port : "", - hostname); - - } else { /* TELNET */ - sprintf(command, "TELNET %s%s %s", - port ? "/PORT=" : "", - port ? port : "", - hostname); - } - - } else { /* UNIX command syntax */ + port ? "/PORT=" : "", + port ? port : "", + hostname); + + } else if (login_protocol == tn3270) { + sprintf(command, "TELNET/TN3270 %s%s %s", + port ? "/PORT=" : "", + port ? port : "", + hostname); + + } else { /* TELNET */ + sprintf(command, "TELNET %s%s %s", + port ? "/PORT=" : "", + port ? port : "", + hostname); + } + + } else { /* UNIX command syntax */ if (login_protocol == rlogin) { - sprintf(command, "RLOGIN %s%s%s%s%s", + sprintf(command, "RLOGIN %s%s%s%s%s", hostname, user ? " -l " : "", user ? "\"" : "", user ? user : "", user ? "\"" : ""); - } else if (login_protocol == tn3270) { - sprintf(command, "TN3270 %s %s", - hostname, - port ? port : ""); + } else if (login_protocol == tn3270) { + sprintf(command, "TN3270 %s %s", + hostname, + port ? port : ""); - } else { /* TELNET */ - sprintf(command, "TELNET %s %s", - hostname, - port ? port : ""); - } - } + } else { /* TELNET */ + sprintf(command, "TELNET %s %s", + hostname, + port ? port : ""); + } + } if (TRACE) - fprintf(stderr, "HTTelnet: Command is: %s\n\n", command); + fprintf(stderr, "HTTelnet: Command is: %s\n\n", command); system(command); return HT_NO_DATA; /* Ok - it was done but no data */ - } + } #define TELNET_DONE #endif /* WIN_TCP */ @@ -319,7 +319,7 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) port ? port : "", hostname); if (TRACE) - fprintf(stderr, "HTTelnet: Command is: %s\n\n", command); + fprintf(stderr, "HTTelnet: Command is: %s\n\n", command); system(command); } else { @@ -369,41 +369,41 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) return HT_NO_DATA; /* Ok - it was done but no data */ } else if ((cp=getenv("WINTCP_COMMAND_STYLE")) != NULL) { - if (0==strncasecomp(cp, "VMS", 3)) { /* VMS command syntax */ + if (0==strncasecomp(cp, "VMS", 3)) { /* VMS command syntax */ if (login_protocol == rlogin) { - sprintf(command, "RLOGIN%s%s%s%s %s", /*lm 930713 */ + sprintf(command, "RLOGIN%s%s%s%s %s", /*lm 930713 */ user ? "/USERNAME=" : "", user ? user : "", port ? "/PORT=" : "", port ? port : "", hostname); } else if (login_protocol == tn3270) { - sprintf(command, "TELNET/TN3270 %s%s %s", + sprintf(command, "TELNET/TN3270 %s%s %s", port ? "/PORT=" : "", port ? port : "", hostname); } else { /* TELNET */ - sprintf(command, "TELNET %s%s %s", + sprintf(command, "TELNET %s%s %s", port ? "/PORT=" : "", port ? port : "", hostname); } - } else { /* UNIX command syntax */ + } else { /* UNIX command syntax */ if (login_protocol == rlogin) { - sprintf(command, "RLOGIN %s%s%s", + sprintf(command, "RLOGIN %s%s%s", hostname, user ? " -l " : "", user ? user : ""); } else if (login_protocol == tn3270) { - sprintf(command, "TN3270 %s %s", + sprintf(command, "TN3270 %s %s", hostname, port ? port : ""); } else { /* TELNET */ - sprintf(command, "TELNET %s %s", + sprintf(command, "TELNET %s %s", hostname, port ? port : ""); } - } + } if (TRACE) fprintf(stderr, "HTTelnet: Command is: %s\n\n", command); @@ -435,27 +435,27 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) return HT_NO_DATA; /* Ok - it was done but no data */ } else if (getenv("CMUTEK_ROOT") != NULL) { - if (login_protocol == telnet) { - sprintf(command, "TELNET %s%s %s", - port ? "/PORT=" : "", - port ? port : "", - hostname); - if (TRACE) - fprintf(stderr, "HTTelnet: Command is: %s\n\n", command); - system(command); - } - else { - extern int LYgetch NOPARAMS; + if (login_protocol == telnet) { + sprintf(command, "TELNET %s%s %s", + port ? "/PORT=" : "", + port ? port : "", + hostname); + if (TRACE) + fprintf(stderr, "HTTelnet: Command is: %s\n\n", command); + system(command); + } + else { + extern int LYgetch NOPARAMS; extern BOOLEAN HadVMSInterrupt; printf( "\nSorry, this browser was compiled without the %s access option.\n", - acc_method); - printf("\nPress <return> to return to Lynx."); - LYgetch(); + acc_method); + printf("\nPress <return> to return to Lynx."); + LYgetch(); HadVMSInterrupt = FALSE; - } - return HT_NO_DATA; /* Ok - it was done but no data */ + } + return HT_NO_DATA; /* Ok - it was done but no data */ } else { if (login_protocol == telnet) { @@ -464,7 +464,7 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) port ? port : "", hostname); if (TRACE) - fprintf(stderr, "HTTelnet: Command is: %s\n\n", command); + fprintf(stderr, "HTTelnet: Command is: %s\n\n", command); system(command); } else { @@ -488,11 +488,11 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) #define SIMPLE_TELNET #endif #ifdef SIMPLE_TELNET - if (login_protocol == telnet) { /* telnet only */ + if (login_protocol == telnet) { /* telnet only */ sprintf(command, "TELNET %s", /* @@ Bug: port ignored */ hostname); if (TRACE) - fprintf(stderr, "HTTelnet: Command is: %s\n\n", command); + fprintf(stderr, "HTTelnet: Command is: %s\n\n", command); system(command); return HT_NO_DATA; /* Ok - it was done but no data */ } @@ -521,7 +521,7 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) HadVMSInterrupt = FALSE; } #endif /* VMS */ - } + } return HT_NO_DATA; #endif /* !TELNET_DONE */ } @@ -533,7 +533,7 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host) ** addr must point to the fully qualified hypertext reference. ** ** On exit, -** returns <0 Error has occured. +** returns <0 Error has occured. ** >=0 Value of file descriptor or socket to be used ** to read data. ** *pFormat Set to the format of the file, if known. @@ -549,28 +549,28 @@ ARGS4 HTStream *, sink /* Ignored */ ) { - char * acc_method; + char * acc_method; char * host; int status; - + if (sink) { - if (TRACE) + if (TRACE) fprintf(stderr, "HTTelnet: Can't output a live session -- must be interactive!\n"); return HT_NO_DATA; } acc_method = HTParse(addr, "file:", PARSE_ACCESS); - + host = HTParse(addr, "", PARSE_HOST); if (!host || *host == '\0') { status = HT_NO_DATA; - if (TRACE) + if (TRACE) fprintf(stderr, "HTTelnet: No host specified!\n"); } else { - status = remote_session(acc_method, host); + status = remote_session(acc_method, host); } - FREE(host); + FREE(host); FREE(acc_method); return status; } diff --git a/WWW/Library/Implementation/HTVMS_WaisUI.c b/WWW/Library/Implementation/HTVMS_WaisUI.c index 39f2bd0b..81c09707 100644 --- a/WWW/Library/Implementation/HTVMS_WaisUI.c +++ b/WWW/Library/Implementation/HTVMS_WaisUI.c @@ -4,7 +4,7 @@ ** ** 30-May-1994 FM Initial version. ** -/*----------------------------------------------------------------------*/ +**----------------------------------------------------------------------*/ /* ** Routines originally from UI.c -- FM diff --git a/WWW/Library/Implementation/HTWAIS.c b/WWW/Library/Implementation/HTWAIS.c index 0aab515c..b4a668ce 100644 --- a/WWW/Library/Implementation/HTWAIS.c +++ b/WWW/Library/Implementation/HTWAIS.c @@ -2,7 +2,7 @@ ** ================================================== ** ** This module allows a WWW server or client to read data from a -** remote WAIS +** remote WAIS ** server, and provide that data to a WWW client in hypertext form. ** Source files, once retrieved, are stored and used to provide ** information about the index when that is acessed. @@ -15,7 +15,7 @@ ** History ** Sep 91 TBL adapted shell-ui.c (BK) with HTRetrieve.c from WWW. ** Feb 91 TBL Generated HTML cleaned up a bit (quotes, escaping) -** Refers to lists of sources. +** Refers to lists of sources. ** Mar 93 TBL Lib 2.0 compatible module made. ** May 94 FM Added DIRECT_WAIS support for VMS. ** @@ -28,7 +28,7 @@ ** ANSI C only as written ** ** Bugs fixed -** NT Nathan Torkington (Nathan.Torkington@vuw.ac.nz) +** NT Nathan Torkington (Nathan.Torkington@vuw.ac.nz) ** ** WAIS comments: ** @@ -106,7 +106,7 @@ PRIVATE char line[2048]; /* For building strings to display */ #define START(e) (*target->isa->start_element)(target, e, 0, 0, -1, 0) #define END(e) (*target->isa->end_element)(target, e, 0) #define MAYBE_END(e) if (HTML_dtd.tags[e].contents != SGML_EMPTY) \ - (*target->isa->end_element)(target, e, 0) + (*target->isa->end_element)(target, e, 0) #define FREE_TARGET (*target->isa->_free)(target) struct _HTStructured { @@ -124,12 +124,12 @@ struct _HTStream { /* ------------------------------------------------------------------------ */ /* Returns 1 on success, 0 on fail, -1 on interrupt. */ PRIVATE int fd_mosaic_connect_to_server ARGS3( - char *, host_name, + char *, host_name, long, port, - long *, fd) + long *, fd) { /* - ** New version. + ** New version. */ char dummy[256]; int status; @@ -138,22 +138,22 @@ PRIVATE int fd_mosaic_connect_to_server ARGS3( status = HTDoConnect (dummy, "WAIS", 210, (int *)fd); if (status == HT_INTERRUPTED) { - return -1; + return -1; } if (status < 0) - return 0; + return 0; return 1; } /* Returns 1 on success, 0 on fail, -1 on interrupt. */ #ifdef VMS PRIVATE int mosaic_connect_to_server ARGS3( - char *, host_name, + char *, host_name, long, port, - long *, fdp) + long *, fdp) #else PRIVATE int mosaic_connect_to_server ARGS3( - char *, host_name, + char *, host_name, long, port, FILE **, fp) #endif /* VMS */ @@ -163,20 +163,20 @@ PRIVATE int mosaic_connect_to_server ARGS3( #endif /* VMS */ long fd; int rv; - + rv = fd_mosaic_connect_to_server (host_name, port, &fd); if (rv == 0) { - HTAlert ("Could not connect to WAIS server."); - return 0; + HTAlert ("Could not connect to WAIS server."); + return 0; } else if (rv == -1) { - HTAlert ("Connection interrupted."); - return -1; + HTAlert ("Connection interrupted."); + return -1; } #ifndef VMS if ((file = fdopen(fd,"r+")) == NULL) { - HTAlert ("Could not open WAIS connection for reading."); - return 0; + HTAlert ("Could not open WAIS connection for reading."); + return 0; } *fp = file; @@ -192,19 +192,19 @@ PRIVATE int mosaic_connect_to_server ARGS3( */ /* modified from Jonny G's version in ui/question.c */ PRIVATE void showDiags ARGS2( - HTStream *, target, - diagnosticRecord **, d) + HTStream *, target, + diagnosticRecord **, d) { long i; for (i = 0; d[i] != NULL; i++) { - if (d[i]->ADDINFO != NULL) { - PUTS("Diagnostic code is "); - PUTS(d[i]->DIAG); - PUTC(' '); - PUTS(d[i]->ADDINFO); - PUTC('\n'); ; - } + if (d[i]->ADDINFO != NULL) { + PUTS("Diagnostic code is "); + PUTS(d[i]->DIAG); + PUTC(' '); + PUTS(d[i]->ADDINFO); + PUTC('\n'); ; + } } } @@ -218,7 +218,7 @@ PRIVATE BOOL acceptable_inited = NO; PRIVATE void init_acceptable NOARGS { unsigned int i; - char * good = + char * good = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./-_$"; for(i=0; i<256; i++) acceptable[i] = NO; for(;*good; good++) acceptable[(unsigned int)*good] = YES; @@ -230,18 +230,18 @@ PRIVATE void init_acceptable NOARGS ** ** ** On exit, -** returns nil if error +** returns nil if error ** pointer to malloced string (must be freed) if ok */ PRIVATE char * WWW_from_archie ARGS1( - char *, file) + char *, file) { char * end; char * result; char * colon; for(end=file; *end > ' '; end++); /* assumes ASCII encoding*/ result = (char *)malloc(10 + (end-file)); - if (!result) return result; /* Malloc error */ + if (!result) return result; /* Malloc error */ strcpy(result, "file://"); strncat(result, file, end-file); colon = strchr(result+7, ':'); /* Expect colon after host */ @@ -258,7 +258,7 @@ PRIVATE char * WWW_from_archie ARGS1( ** The format of the docid MUST be good! ** ** On exit, -** returns nil if error +** returns nil if error ** pointer to malloced string (must be freed) if ok */ PRIVATE char hex [17] = "0123456789ABCDEF"; @@ -280,19 +280,19 @@ PRIVATE char * WWW_from_WAIS ARGS1( fprintf(stderr, "<%x>", (unsigned)*p); } fprintf(stderr, "\n"); - } + } for (p = docid->bytes; - (p < docid->bytes+docid->size) && (q < &buf[BIG]);) { + (p < docid->bytes+docid->size) && (q < &buf[BIG]);) { if (TRACE) fprintf(stderr, " Record type %d, length %d\n", p[0], p[1]); - if (*p > 10) { + if (*p > 10) { if (TRACE) - fprintf(stderr, "Eh? DOCID record type of %d!\n", *p); + fprintf(stderr, "Eh? DOCID record type of %d!\n", *p); return 0; } { /* Bug fix -- allow any byte value 15 Apr 93 */ unsigned int i = (unsigned) *p++; - + if (i > 99) { *q++ = (i/100) + '0'; i = i % 100; @@ -317,9 +317,9 @@ PRIVATE char * WWW_from_WAIS ARGS1( } *q++ = 0; /* Terminate string */ if (TRACE) - fprintf(stderr, "WWW form of id: %s\n", buf); + fprintf(stderr, "WWW form of id: %s\n", buf); { - char * result = (char *)malloc(strlen(buf)+1); + char * result = (char *)malloc(strlen(buf)+1); if (!result) outofmem(__FILE__, "WWW_from_WAIS"); strcpy(result, buf); @@ -331,7 +331,7 @@ PRIVATE char * WWW_from_WAIS ARGS1( ** ------------------------------------------- ** ** On entry, -** docname points to valid name produced originally by +** docname points to valid name produced originally by ** WWW_from_WAIS ** On exit, ** docid->size is valid @@ -339,33 +339,33 @@ PRIVATE char * WWW_from_WAIS ARGS1( */ PRIVATE any * WAIS_from_WWW ARGS2( any *, docid, - char *, docname) + char *, docname) { - char *z; /* Output pointer */ + char *z; /* Output pointer */ char *sor; /* Start of record - points to size field. */ - char *p; /* Input pointer */ - char *q; /* Poisition of "=" */ - char *s; /* Position of semicolon */ + char *p; /* Input pointer */ + char *q; /* Poisition of "=" */ + char *s; /* Position of semicolon */ int n; /* size */ if (TRACE) - fprintf(stderr, "WWW id (to become WAIS id): %s\n", docname); - for (n = 0, p = docname; *p; p++) { /* Count sizes of strings */ - n++; + fprintf(stderr, "WWW id (to become WAIS id): %s\n", docname); + for (n = 0, p = docname; *p; p++) { /* Count sizes of strings */ + n++; if (*p == ';') n--; /* Not converted */ else if (*p == HEX_ESCAPE) n = n-2; /* Save two bytes */ - docid->size = n; + docid->size = n; } - + if (!(docid->bytes = (char *) malloc(docid->size))) /* result record */ outofmem(__FILE__, "WAIS_from_WWW"); z = docid->bytes; - + for (p = docname; *p; ) { /* Convert of strings */ - /* Record type */ - - *z = 0; /* Initialize record type */ + /* Record type */ + + *z = 0; /* Initialize record type */ while (*p >= '0' && *p <= '9') { *z = *z*10 + (*p++ - '0'); /* Decode decimal record type */ } @@ -373,35 +373,35 @@ PRIVATE any * WAIS_from_WWW ARGS2( if (*p != '=') return 0; q = p; - -/* *z++ = *p++ - '0'; + +/* *z++ = *p++ - '0'; q = strchr(p , '='); if (!q) return 0; */ s = strchr(q, ';'); /* (Check only) */ if (!s) - return 0; /* Bad! No ';'; */ - sor = z; /* Remember where the size field was */ + return 0; /* Bad! No ';'; */ + sor = z; /* Remember where the size field was */ z++; /* Skip record size for now */ for (p = q+1; *p != ';';) { if (*p == HEX_ESCAPE) { - char c; + char c; unsigned int b; p++; - c = *p++; + c = *p++; b = from_hex(c); c = *p++; if (!c) break; /* Odd number of chars! */ *z++ = (b<<4) + from_hex(c); } else { - *z++ = *p++; /* Record */ + *z++ = *p++; /* Record */ } } *sor = (z-sor-1); /* Fill in size -- not counting size itself */ p++; /* After semicolon: start of next record */ } - + if (TRACE) { char *p; fprintf(stderr, "WAIS id (%d bytes) is ", (int)docid->size); @@ -412,24 +412,24 @@ PRIVATE any * WAIS_from_WWW ARGS2( fprintf(stderr, "<%x>", (unsigned)*p); } fprintf(stderr, "\n"); - } + } return docid; /* Ok */ - + } /* WAIS_from_WWW */ /* Send a plain text record to the client output_text_record() ** -------------------------------------- */ PRIVATE void output_text_record ARGS4( - HTStream *, target, - WAISDocumentText *, record, + HTStream *, target, + WAISDocumentText *, record, boolean, quote_string_quotes, - boolean, binary) + boolean, binary) { long count; /* printf(" Text\n"); print_any(" DocumentID: ", record->DocumentID); - printf(" VersionNumber: %d\n", record->VersionNumber); + printf(" VersionNumber: %d\n", record->VersionNumber); */ if (binary) { @@ -446,17 +446,17 @@ PRIVATE void output_text_record ARGS4( /* if the next letter is '(' or ')', then ignore two letters */ if ('(' == record->DocumentText->bytes[count + 1] || ')' == record->DocumentText->bytes[count + 1]) - count += 1; /* it is a term marker */ + count += 1; /* it is a term marker */ else count += 4; /* it is a paragraph marker */ } else if (ch == '\n' || ch == '\r') { PUTC('\n'); } else if (HTCJK != NOCJK || ch == '\t' || isprint(ch)){ PUTC(ch); - } + } } } /* output text record */ -/* Format A Search response for the client display_search_response +/* Format A Search response for the client display_search_response ** --------------------------------------- */ /* modified from tracy shen's version in wutil.c @@ -466,15 +466,15 @@ PRIVATE void display_search_response ARGS4( HTStructured *, target, SearchResponseAPDU *, response, char *, database, - char *, keywords) + char *, keywords) { - WAISSearchResponse *info; + WAISSearchResponse *info; long i, k; - + BOOL archie = strstr(database, "archie")!=0; /* Specical handling */ - + if (TRACE) - fprintf(stderr, "HTWAIS: Displaying search response\n"); + fprintf(stderr, "HTWAIS: Displaying search response\n"); PUTS("Index "); START(HTML_EM); PUTS(database); @@ -495,115 +495,115 @@ PRIVATE void display_search_response ARGS4( START(HTML_OL); if (response->DatabaseDiagnosticRecords != 0) { - info = (WAISSearchResponse *)response->DatabaseDiagnosticRecords; - i =0; - - if (info->Diagnostics != NULL) - showDiags((HTStream*)target, info->Diagnostics); - - if (info->DocHeaders != 0) { - for (k = 0; info->DocHeaders[k] != 0; k++ ) { - WAISDocumentHeader* head = info->DocHeaders[k]; - char * headline = trim_junk(head->Headline); - any * docid = head->DocumentID; - char * docname; /* printable version of docid */ - - i++; - /* - ** Make a printable string out of the document id. - */ - if (TRACE) - fprintf(stderr, - "HTWAIS: %2ld: Score: %4ld, lines:%4ld '%s'\n", - i, - (long int)(info->DocHeaders[k]->Score), - (long int)(info->DocHeaders[k]->Lines), - headline); - - START(HTML_LI); - - if (archie) { - char * www_name = WWW_from_archie(headline); - if (www_name) { - HTStartAnchor(target, NULL, www_name); - PUTS(headline); - END(HTML_A); - FREE(www_name); - } else { - PUTS(headline); - PUTS(" (bad file name)"); - } - } else { /* Not archie */ - docname = WWW_from_WAIS(docid); - if (docname) { - char * dbname = HTEscape(database, URL_XPALPHAS); - sprintf(line, - "/%s/%s/%d/%s", /* W3 address */ + info = (WAISSearchResponse *)response->DatabaseDiagnosticRecords; + i =0; + + if (info->Diagnostics != NULL) + showDiags((HTStream*)target, info->Diagnostics); + + if (info->DocHeaders != 0) { + for (k = 0; info->DocHeaders[k] != 0; k++ ) { + WAISDocumentHeader* head = info->DocHeaders[k]; + char * headline = trim_junk(head->Headline); + any * docid = head->DocumentID; + char * docname; /* printable version of docid */ + + i++; + /* + ** Make a printable string out of the document id. + */ + if (TRACE) + fprintf(stderr, + "HTWAIS: %2ld: Score: %4ld, lines:%4ld '%s'\n", + i, + (long int)(info->DocHeaders[k]->Score), + (long int)(info->DocHeaders[k]->Lines), + headline); + + START(HTML_LI); + + if (archie) { + char * www_name = WWW_from_archie(headline); + if (www_name) { + HTStartAnchor(target, NULL, www_name); + PUTS(headline); + END(HTML_A); + FREE(www_name); + } else { + PUTS(headline); + PUTS(" (bad file name)"); + } + } else { /* Not archie */ + docname = WWW_from_WAIS(docid); + if (docname) { + char * dbname = HTEscape(database, URL_XPALPHAS); + sprintf(line, + "/%s/%s/%d/%s", /* W3 address */ dbname, - head->Types ? head->Types[0] : "TEXT", - (int)(head->DocumentLength), - docname); + head->Types ? head->Types[0] : "TEXT", + (int)(head->DocumentLength), + docname); HTStartAnchor(target, NULL, ((head->Types) && (!strcmp(head->Types[0], "URL"))) - ? - headline : line); /* NT, Sep 93 */ + ? + headline : line); /* NT, Sep 93 */ PUTS(headline); END(HTML_A); FREE(dbname); FREE(docname); - } else { - PUTS("(bad doc id)"); - } - } + } else { + PUTS("(bad doc id)"); + } + } sprintf(line, "%5ld %5ld ", - head->Score, - head->Lines); + head->Score, + head->Lines); PUTS( line); - MAYBE_END(HTML_LI); - } /* next document header */ - } /* if there were any document headers */ - - if (info->ShortHeaders != 0) { - k = 0; - while (info->ShortHeaders[k] != 0) { - i++; - PUTS( "(Short Header record, can't display)"); - } - } - if (info->LongHeaders != 0) { - k = 0; - while (info->LongHeaders[k] != 0) { - i++; - PUTS( "\nLong Header record, can't display\n"); - } - } - if (info->Text != 0) { - k = 0; - while (info->Text[k] != 0) { - i++; + MAYBE_END(HTML_LI); + } /* next document header */ + } /* if there were any document headers */ + + if (info->ShortHeaders != 0) { + k = 0; + while (info->ShortHeaders[k] != 0) { + i++; + PUTS( "(Short Header record, can't display)"); + } + } + if (info->LongHeaders != 0) { + k = 0; + while (info->LongHeaders[k] != 0) { + i++; + PUTS( "\nLong Header record, can't display\n"); + } + } + if (info->Text != 0) { + k = 0; + while (info->Text[k] != 0) { + i++; PUTS( "\nText record\n"); output_text_record((HTStream*)target, info->Text[k++], false, false); - } - } - if (info->Headlines != 0) { - k = 0; - while (info->Headlines[k] != 0) { - i++; + } + } + if (info->Headlines != 0) { + k = 0; + while (info->Headlines[k] != 0) { + i++; PUTS( "\nHeadline record, can't display\n"); /* dsply_headline_record( info->Headlines[k++]); */ - } - } - if (info->Codes != 0) { - k = 0; - while (info->Codes[k] != 0) { + } + } + if (info->Codes != 0) { + k = 0; + while (info->Codes[k] != 0) { i++; PUTS( "\nCode record, can't display\n"); /* dsply_code_record( info->Codes[k++]); */ - } - } + } + } } /* Loop: display user info */ END(HTML_OL); PUTC('\n'); ; @@ -629,15 +629,15 @@ PUBLIC int HTLoadWAIS ARGS4( { static CONST char * error_header = "<h1>Access error</h1>\nThe following error occured in accesing a WAIS server:<P>\n"; - char * key; /* pointer to keywords in URL */ + char * key; /* pointer to keywords in URL */ char* request_message = NULL; /* arbitrary message limit */ char* response_message = NULL; /* arbitrary message limit */ - long request_buffer_length; /* how of the request is left */ - SearchResponseAPDU *retrieval_response = 0; + long request_buffer_length; /* how of the request is left */ + SearchResponseAPDU *retrieval_response = 0; char keywords[MAX_KEYWORDS_LENGTH + 1]; - char *server_name; - char *wais_database = NULL; /* name of current database */ - char *www_database; /* Same name escaped */ + char *server_name; + char *wais_database = NULL; /* name of current database */ + char *www_database; /* Same name escaped */ char *service; char *doctype; char *doclength; @@ -652,22 +652,22 @@ PUBLIC int HTLoadWAIS ARGS4( BOOL ok = NO; int return_status = HT_LOADED; int rv; - + extern FILE * connect_to_server(); - + if (!acceptable_inited) - init_acceptable(); + init_acceptable(); /* Decipher and check syntax of WWW address: ** ---------------------------------------- ** ** First we remove the "wais:" if it was spcified. 920110 - */ + */ names = HTParse(arg, "", PARSE_HOST | PARSE_PATH | PARSE_PUNCTUATION); key = strchr(names, '?'); - + if (key) { - char * p; + char * p; *key++ = 0; /* Split off keywords */ for (p=key; *p; p++) if (*p == '+') *p = ' '; HTUnEscape(key); @@ -681,8 +681,8 @@ PUBLIC int HTLoadWAIS ARGS4( *www_database++ = 0; /* Separate database name */ doctype = strchr(www_database, '/'); if (key) ok = YES; /* Don't need doc details */ - else if (doctype) { /* If not search parse doc details */ - *doctype++ = 0; /* Separate rest of doc address */ + else if (doctype) { /* If not search parse doc details */ + *doctype++ = 0; /* Separate rest of doc address */ doclength = strchr(doctype, '/'); if (doclength) { *doclength++ = 0; @@ -696,64 +696,64 @@ PUBLIC int HTLoadWAIS ARGS4( } /* if document_length valid */ } /* if doclength */ } else { /* no doctype? Assume index required */ - if (!key) + if (!key) key = ""; ok = YES; } /* if doctype */ } /* if database */ } - + if (!ok) return HTLoadError(sink, 500, "Syntax error in WAIS URL"); if (TRACE) - fprintf(stderr, "HTWAIS: Parsed OK\n"); - + fprintf(stderr, "HTWAIS: Parsed OK\n"); + service = strchr(names, ':'); if (service) - *service++ = 0; + *service++ = 0; else - service = "210"; - + service = "210"; + if (server_name[0] == 0) { #ifdef VMS - connection = 0; + connection = 0; #else - connection = NULL; + connection = NULL; #endif /* VMS */ } else if (!(key && !*key)) { - int status; - if (TRACE) - fprintf (stderr, "===WAIS=== calling mosaic_connect_to_server\n"); - status = mosaic_connect_to_server(server_name, + int status; + if (TRACE) + fprintf (stderr, "===WAIS=== calling mosaic_connect_to_server\n"); + status = mosaic_connect_to_server(server_name, atoi(service), &connection); - if (status == 0) { - if (TRACE) - fprintf (stderr, "===WAIS=== connection failed\n"); - FREE(names); - return HT_NOT_LOADED; - } else if (status == -1) { - if (TRACE) - fprintf (stderr, "===WAIS=== connection interrupted\n"); - FREE(names); - return HT_NOT_LOADED; - } + if (status == 0) { + if (TRACE) + fprintf (stderr, "===WAIS=== connection failed\n"); + FREE(names); + return HT_NOT_LOADED; + } else if (status == -1) { + if (TRACE) + fprintf (stderr, "===WAIS=== connection interrupted\n"); + FREE(names); + return HT_NOT_LOADED; + } } StrAllocCopy(wais_database,www_database); HTUnEscape(wais_database); - + /* - ** This below fixed size stuff is terrible. + ** This below fixed size stuff is terrible. */ #ifdef VMS if (!(request_message = - (char*)calloc((size_t)MAX_MESSAGE_LEN*sizeof(char),1))) + (char*)calloc((size_t)MAX_MESSAGE_LEN*sizeof(char),1))) outofmem(__FILE__, "HTLoadWAIS"); if (!(response_message = - (char*)calloc((size_t)MAX_MESSAGE_LEN*sizeof(char),1))) + (char*)calloc((size_t)MAX_MESSAGE_LEN*sizeof(char),1))) outofmem(__FILE__, "HTLoadWAIS"); #else request_message = (char*)s_malloc((size_t)MAX_MESSAGE_LEN * sizeof(char)); @@ -761,17 +761,17 @@ PUBLIC int HTLoadWAIS ARGS4( #endif /* VMS */ /* - ** If keyword search is performed but there are no keywords, - ** the user has followed a link to the index itself. It would be - ** appropriate at this point to send him the .SRC file - how? + ** If keyword search is performed but there are no keywords, + ** the user has followed a link to the index itself. It would be + ** appropriate at this point to send him the .SRC file - how? */ - if (key && !*key) { /* I N D E X */ + if (key && !*key) { /* I N D E X */ #ifdef CACHE_FILE_PREFIX char filename[256]; FILE * fp; #endif HTStructured * target = HTML_new(anAnchor, format_out, sink); - + START(HTML_HEAD); PUTS("\n"); HTStartIsIndex(target, "Enter WAIS query: ", NULL); @@ -785,7 +785,7 @@ PUBLIC int HTLoadWAIS ARGS4( PUTS("\n"); END(HTML_HEAD); PUTS("\n"); - + START(HTML_H1); PUTS("WAIS Index: "); START(HTML_EM); @@ -797,8 +797,8 @@ PUBLIC int HTLoadWAIS ARGS4( START(HTML_EM); PUTS(wais_database); END(HTML_EM); - PUTS(" WAIS Index.\n"); - + PUTS(" WAIS Index.\n"); + } /* ** If we have seen a source file for this database, use that. @@ -824,20 +824,20 @@ PUBLIC int HTLoadWAIS ARGS4( #endif START(HTML_P); PUTS("\nEnter the 's'earch command and then specify search words.\n"); - + FREE_TARGET; } else if (key) { /* S E A R C H */ char *p; HTStructured * target; - + strncpy(keywords, key, MAX_KEYWORDS_LENGTH); while(p=strchr(keywords, '+')) *p = ' '; - - /* + + /* ** Send advance title to get something fast to the other end. */ target = HTML_new(anAnchor, format_out, sink); - + START(HTML_HEAD); PUTS("\n"); HTStartIsIndex(target, "Enter WAIS query: ", NULL); @@ -851,7 +851,7 @@ PUBLIC int HTLoadWAIS ARGS4( PUTS("\n"); END(HTML_HEAD); PUTS("\n"); - + START(HTML_H1); PUTS("WAIS Search of \""); START(HTML_EM); @@ -868,8 +868,8 @@ PUBLIC int HTLoadWAIS ARGS4( if (TRACE) fprintf(stderr, "HTWAIS: Search for `%s' in `%s'\n", keywords, wais_database); if(NULL == - generate_search_apdu(request_message + HEADER_LENGTH, - &request_buffer_length, + generate_search_apdu(request_message + HEADER_LENGTH, + &request_buffer_length, keywords, wais_database, NULL, MAXDOCS)) { #ifdef VMS HTAlert ("HTWAIS: Request too large."); @@ -879,11 +879,11 @@ PUBLIC int HTLoadWAIS ARGS4( #else panic("request too large"); #endif /* VMS */ - } - + } + HTProgress("Searching WAIS database..."); - rv = interpret_message (request_message, - MAX_MESSAGE_LEN - request_buffer_length, + rv = interpret_message (request_message, + MAX_MESSAGE_LEN - request_buffer_length, response_message, MAX_MESSAGE_LEN, connection, @@ -904,15 +904,15 @@ PUBLIC int HTLoadWAIS ARGS4( #else panic("returned message too large"); #endif /* VMS */ - } else { /* returned message ok */ - SearchResponseAPDU *query_response = 0; + } else { /* returned message ok */ + SearchResponseAPDU *query_response = 0; readSearchResponseAPDU(&query_response, - response_message + HEADER_LENGTH); - display_search_response(target, - query_response, wais_database, keywords); + response_message + HEADER_LENGTH); + display_search_response(target, + query_response, wais_database, keywords); if (query_response->DatabaseDiagnosticRecords) freeWAISSearchResponse( - query_response->DatabaseDiagnosticRecords); + query_response->DatabaseDiagnosticRecords); freeSearchResponseAPDU( query_response); } /* returned message not too large */ FREE_TARGET; @@ -927,14 +927,14 @@ PUBLIC int HTLoadWAIS ARGS4( if (TRACE) fprintf(stderr, "HTWAIS: Retrieve document id `%s' type `%s' length %ld\n", docname, doctype, document_length); - - format_in = + + format_in = !strcmp(doctype, "WSRC") ? HTAtom_for("application/x-wais-source") : !strcmp(doctype, "TEXT") ? HTAtom_for("text/plain") : !strcmp(doctype, "HTML") ? HTAtom_for("text/html") : !strcmp(doctype, "GIF") ? HTAtom_for("image/gif") : - HTAtom_for("application/octet-stream"); - binary = + HTAtom_for("application/octet-stream"); + binary = 0 != strcmp(doctype, "WSRC") && 0 != strcmp(doctype, "TEXT") && 0 != strcmp(doctype, "HTML") ; @@ -945,47 +945,47 @@ PUBLIC int HTLoadWAIS ARGS4( "Can't convert format of WAIS document"); /* ** Decode hex or litteral format for document ID. - */ + */ WAIS_from_WWW(docid, docname); /* ** Loop over slices of the document. - */ - for (count = 0; + */ + for (count = 0; count * CHARS_PER_PAGE < document_length; count++) { #ifdef VMS - char *type = NULL; - + char *type = NULL; + StrAllocCopy(type, doctype); #else char *type = s_strdup(doctype); /* Gets freed I guess */ #endif /* VMS */ request_buffer_length = MAX_MESSAGE_LEN; /* Amount left */ if (TRACE) - fprintf(stderr, "HTWAIS: Slice number %ld\n", count); + fprintf(stderr, "HTWAIS: Slice number %ld\n", count); - if (HTCheckForInterrupt()) { - HTAlert ("Data transfer interrupted."); - (*target->isa->_abort)(target, NULL); + if (HTCheckForInterrupt()) { + HTAlert ("Data transfer interrupted."); + (*target->isa->_abort)(target, NULL); #ifdef VMS FREE(type); #endif /* VMS */ return_status = HT_NOT_LOADED; goto CleanUp; - } + } if (0 == - generate_retrieval_apdu(request_message + HEADER_LENGTH, - &request_buffer_length, - docid, - CT_byte, - count * CHARS_PER_PAGE, + generate_retrieval_apdu(request_message + HEADER_LENGTH, + &request_buffer_length, + docid, + CT_byte, + count * CHARS_PER_PAGE, ((count + 1) * CHARS_PER_PAGE <= document_length ? - (count + 1) * CHARS_PER_PAGE : - document_length), - type, - wais_database)) { + (count + 1) * CHARS_PER_PAGE : + document_length), + type, + wais_database)) { #ifdef VMS HTAlert ("HTWAIS: Request too long."); return_status = HT_NOT_LOADED; @@ -997,18 +997,18 @@ PUBLIC int HTLoadWAIS ARGS4( panic("request too long"); #endif /* VMS */ } - + /* - ** Actually do the transaction given by request_message. + ** Actually do the transaction given by request_message. */ HTProgress("Fetching WAIS document..."); - rv = interpret_message(request_message, - MAX_MESSAGE_LEN - request_buffer_length, + rv = interpret_message(request_message, + MAX_MESSAGE_LEN - request_buffer_length, response_message, MAX_MESSAGE_LEN, connection, - false /* true verbose */ - ); + false /* true verbose */ + ); if (rv == HT_INTERRUPTED) { HTAlert ("Data transfer interrupted."); return_status = HT_INTERRUPTED; @@ -1025,30 +1025,30 @@ PUBLIC int HTLoadWAIS ARGS4( FREE(docid->bytes); goto CleanUp; #else - panic("Returned message too large"); + panic("Returned message too large"); #endif /* VMS */ } /* - ** Parse the result which came back into memory. + ** Parse the result which came back into memory. */ - readSearchResponseAPDU(&retrieval_response, + readSearchResponseAPDU(&retrieval_response, response_message + HEADER_LENGTH); if (NULL == - ((WAISSearchResponse *) - retrieval_response->DatabaseDiagnosticRecords)->Text) { + ((WAISSearchResponse *) + retrieval_response->DatabaseDiagnosticRecords)->Text) { /* display_search_response(target, retrieval_response, wais_database, keywords); */ PUTS("No text was returned!\n"); /* panic("No text was returned"); */ } else { output_text_record(target, - ((WAISSearchResponse *) + ((WAISSearchResponse *) retrieval_response->DatabaseDiagnosticRecords)->Text[0], false, binary); } /* If text existed */ - + #ifdef VMS FREE(type); #endif /* VMS */ @@ -1057,21 +1057,21 @@ PUBLIC int HTLoadWAIS ARGS4( FREE_TARGET; FREE(docid->bytes); - freeWAISSearchResponse( retrieval_response->DatabaseDiagnosticRecords); + freeWAISSearchResponse( retrieval_response->DatabaseDiagnosticRecords); freeSearchResponseAPDU( retrieval_response); } /* If document rather than search */ CleanUp: /* - ** (This postponed until later, after a timeout:) + ** (This postponed until later, after a timeout:) */ #ifdef VMS if (connection) - NETCLOSE((int)connection); + NETCLOSE((int)connection); #else if (connection) - fclose(connection); + fclose(connection); #endif /* VMS */ FREE(wais_database); #ifdef VMS diff --git a/WWW/Library/Implementation/HTWSRC.c b/WWW/Library/Implementation/HTWSRC.c index d26a86ac..56608ac3 100644 --- a/WWW/Library/Implementation/HTWSRC.c +++ b/WWW/Library/Implementation/HTWSRC.c @@ -15,7 +15,7 @@ /* #include <sys/types.h> already in tcp.h */ -/* #include <sys/stat.h> this too */ +/* #include <sys/stat.h> this too */ /* #include <stdio.h> included in HTUtils.h -- FM */ #include "HTML.h" #include "HTParse.h" @@ -40,31 +40,31 @@ struct _HTStructured { #define START(e) (*me->target->isa->start_element)(me->target, e, 0, 0, -1, 0) #define END(e) (*me->target->isa->end_element)(me->target, e, 0) #define MAYBE_END(e) if (HTML_dtd.tags[e].contents != SGML_EMPTY) \ - (*me->target->isa->end_element)(me->target, e, 0) + (*me->target->isa->end_element)(me->target, e, 0) /* Here are the parameters which can be specified in a source file */ PRIVATE CONST char* par_name[] = { - "version", + "version", "ip-address", #define PAR_IP_NAME 2 - "ip-name", + "ip-name", #define PAR_TCP_PORT 3 - "tcp-port", + "tcp-port", #define PAR_DATABASE_NAME 4 "database-name", #define PAR_COST 5 - "cost", + "cost", #define PAR_COST_UNIT 6 - "cost-unit", + "cost-unit", #define PAR_FREE 7 - "free", + "free", #define PAR_MAINTAINER 8 - "maintainer", + "maintainer", #define PAR_DESCRIPTION 9 "description", - "keyword-list", + "keyword-list", "source", "window-geometry", "configuration", @@ -101,7 +101,7 @@ struct _HTStream { HTStructured * target; char * par_value[PAR_COUNT]; enum tokenstate state; - char param[BIG+1]; + char param[BIG+1]; int param_number; int param_count; }; @@ -116,7 +116,7 @@ PUBLIC CONST char * hex = "0123456789ABCDEF"; PUBLIC char from_hex ARGS1(char, c) { - return (c>='0')&&(c<='9') ? c-'0' + return (c>='0')&&(c<='9') ? c-'0' : (c>='A')&&(c<='F') ? c-'A'+10 : (c>='a')&&(c<='f') ? c-'a'+10 : 0; @@ -130,7 +130,7 @@ PUBLIC char from_hex ARGS1(char, c) ** me->state is a valid state (see WSRC_init) ** c is the next character ** On exit, -** returns 1 Done with file +** returns 1 Done with file ** 0 Continue. me->state is updated if necessary. ** -1 Syntax error error */ @@ -143,11 +143,11 @@ PRIVATE void WSRCParser_put_character ARGS2(HTStream*, me, char, c) { switch (me->state) { case beginning: - if (c=='(') me->state = before_tag; + if (c=='(') me->state = before_tag; break; - + case before_tag: - if (c==')') { + if (c==')') { me->state = done; return; /* Done with input file */ } else if (c==':') { @@ -157,7 +157,7 @@ PRIVATE void WSRCParser_put_character ARGS2(HTStream*, me, char, c) break; case colon: - if (WHITE(c)) { + if (WHITE(c)) { me->param[me->param_count++] = 0; /* Terminate */ for(me->param_number = 0; par_name[me->param_number]; me->param_number++) { if (0==strcmp(par_name[me->param_number], me->param)) { @@ -165,7 +165,7 @@ PRIVATE void WSRCParser_put_character ARGS2(HTStream*, me, char, c) } } if (!par_name[me->param_number]) { /* Unknown field */ - if (TRACE) fprintf(stderr, + if (TRACE) fprintf(stderr, "HTWSRC: Unknown field `%s' in source file\n", me->param); me->param_number = PAR_UNKNOWN; @@ -177,9 +177,9 @@ PRIVATE void WSRCParser_put_character ARGS2(HTStream*, me, char, c) if (me->param_count < PARAM_MAX) me->param[me->param_count++] = c; } break; - + case before_value: - if (c==')') { + if (c==')') { me->state = done; return; /* Done with input file */ } @@ -189,13 +189,13 @@ PRIVATE void WSRCParser_put_character ARGS2(HTStream*, me, char, c) me->state = quoted_value; break; } - me->state = (c=='"') ? quoted_value : + me->state = (c=='"') ? quoted_value : (c=='(') ? bracketed_value : value; me->param[me->param_count++] = c; /* Don't miss first character */ break; case value: - if (WHITE(c)) { + if (WHITE(c)) { me->param[me->param_count] = 0; StrAllocCopy(me->par_value[me->param_number], me->param); me->state = before_tag; @@ -205,23 +205,23 @@ PRIVATE void WSRCParser_put_character ARGS2(HTStream*, me, char, c) break; case bracketed_value: - if (c==')') { + if (c==')') { me->param[me->param_count] = 0; StrAllocCopy(me->par_value[me->param_number], me->param); me->state = before_tag; break; } - if (me->param_count < PARAM_MAX) me->param[me->param_count++] = c; + if (me->param_count < PARAM_MAX) me->param[me->param_count++] = c; break; - + case quoted_value: - if (c=='"') { + if (c=='"') { me->param[me->param_count] = 0; StrAllocCopy(me->par_value[me->param_number], me->param); me->state = before_tag; break; } - + if (c=='\\') { /* Ignore escape but switch state */ me->state = escape_in_quoted; break; @@ -229,10 +229,10 @@ PRIVATE void WSRCParser_put_character ARGS2(HTStream*, me, char, c) /* Fall through! */ case escape_in_quoted: - if (me->param_count < PARAM_MAX) me->param[me->param_count++] = c; + if (me->param_count < PARAM_MAX) me->param[me->param_count++] = c; me->state = quoted_value; break; - + case done: /* Ignore anything after EOF */ return; @@ -254,23 +254,23 @@ PRIVATE BOOL write_cache ARGS1(HTStream *, me) char cache_file_name[256]; char * www_database; if (!me->par_value[PAR_DATABASE_NAME] - || !me->par_value[PAR_IP_NAME] + || !me->par_value[PAR_IP_NAME] ) return NO; - + www_database = HTEscape(me->par_value[PAR_DATABASE_NAME], URL_XALPHAS); sprintf(cache_file_name, "%sWSRC-%s:%s:%.100s.txt", - CACHE_FILE_PREFIX, + CACHE_FILE_PREFIX, me->par_value[PAR_IP_NAME], me->par_value[PAR_TCP_PORT] ? me->par_value[PAR_TCP_PORT] : "210", www_database); FREE(www_database); fp = fopen(cache_file_name, "w"); if (!fp) return NO; - + if (me->par_value[PAR_DESCRIPTION]) - fputs(me->par_value[PAR_DESCRIPTION], fp); - else - fputs("Description not available\n", fp); + fputs(me->par_value[PAR_DESCRIPTION], fp); + else + fputs("Description not available\n", fp); fclose(fp); return YES; } @@ -289,7 +289,7 @@ PRIVATE void give_parameter ARGS2(HTStream *, me, int, p) PUTS(me->par_value[p]); PUTS("; "); } else { - PUTS(" NOT GIVEN in source file; "); + PUTS(" NOT GIVEN in source file; "); } } @@ -306,9 +306,9 @@ PRIVATE void WSRC_gen_html ARGS2(HTStream *, me, BOOL, source_file) StrAllocCopy(shortname, me->par_value[PAR_DATABASE_NAME]); l = strlen(shortname); if ( l > 4 && !strcasecomp(shortname + l -4, ".src")) { - shortname[l-4] = 0; /* Chop of .src -- boring! */ + shortname[l-4] = 0; /* Chop of .src -- boring! */ } - + START(HTML_HEAD); PUTS("\n"); START(HTML_TITLE); @@ -317,7 +317,7 @@ PRIVATE void WSRC_gen_html ARGS2(HTStream *, me, BOOL, source_file) END(HTML_TITLE); PUTS("\n"); END(HTML_HEAD); - + START(HTML_H1); PUTS(shortname); PUTS(source_file ? " description" : " index"); @@ -325,9 +325,9 @@ PRIVATE void WSRC_gen_html ARGS2(HTStream *, me, BOOL, source_file) PUTS("\n"); FREE(shortname); } - + START(HTML_DL); /* Definition list of details */ - + if (source_file) { START(HTML_DT); PUTS("Access links"); @@ -335,17 +335,17 @@ PRIVATE void WSRC_gen_html ARGS2(HTStream *, me, BOOL, source_file) START(HTML_DD); if (me->par_value[PAR_IP_NAME] && me->par_value[PAR_DATABASE_NAME]) { - + char WSRC_address[256]; char * www_database; www_database = HTEscape(me->par_value[PAR_DATABASE_NAME], - URL_XALPHAS); + URL_XALPHAS); sprintf(WSRC_address, "wais://%s%s%s/%s", me->par_value[PAR_IP_NAME], me->par_value[PAR_TCP_PORT] ? ":" : "", me->par_value[PAR_TCP_PORT] ? me->par_value[PAR_TCP_PORT] :"", www_database); - + HTStartAnchor(me->target, NULL, WSRC_address); PUTS("Direct access"); END(HTML_A); @@ -353,15 +353,15 @@ PRIVATE void WSRC_gen_html ARGS2(HTStream *, me, BOOL, source_file) PUTS(" (or via proxy server, if defined)"); FREE(www_database); - + } else { give_parameter(me, PAR_IP_NAME); give_parameter(me, PAR_DATABASE_NAME); } MAYBE_END(HTML_DD); - + } /* end if source_file */ - + if (me->par_value[PAR_MAINTAINER]) { START(HTML_DT); PUTS("Maintainer"); @@ -371,11 +371,11 @@ PRIVATE void WSRC_gen_html ARGS2(HTStream *, me, BOOL, source_file) MAYBE_END(HTML_DD); } if (me->par_value[PAR_IP_NAME]) { - START(HTML_DT); - PUTS("Host"); + START(HTML_DT); + PUTS("Host"); MAYBE_END(HTML_DT); - START(HTML_DD); - PUTS(me->par_value[PAR_IP_NAME]); + START(HTML_DD); + PUTS(me->par_value[PAR_IP_NAME]); MAYBE_END(HTML_DD); } @@ -386,9 +386,9 @@ PRIVATE void WSRC_gen_html ARGS2(HTStream *, me, BOOL, source_file) PUTS(me->par_value[PAR_DESCRIPTION]); END(HTML_PRE); } - + (*me->target->isa->_free)(me->target); - + return; } /* generate html */ @@ -397,19 +397,19 @@ PRIVATE void WSRCParser_put_string ARGS2(HTStream *, context, CONST char*, str) { CONST char *p; for(p=str; *p; p++) - WSRCParser_put_character(context, *p); + WSRCParser_put_character(context, *p); } PRIVATE void WSRCParser_write ARGS3( - HTStream *, context, - CONST char*, str, - int, l) + HTStream *, context, + CONST char*, str, + int, l) { CONST char *p; CONST char *e = str+l; for(p=str; p<e; p++) - WSRCParser_put_character(context, *p); + WSRCParser_put_character(context, *p); } @@ -421,7 +421,7 @@ PRIVATE void WSRCParser_free ARGS1(HTStream *, me) #endif { int p; - for (p = 0; par_name[p]; p++) { /* Clear out old values */ + for (p = 0; par_name[p]; p++) { /* Clear out old values */ FREE(me->par_value[p]); } } @@ -434,7 +434,7 @@ PRIVATE void WSRCParser_abort ARGS2(HTStream *, me, HTError, e) } -/* Stream subclass -- method routines +/* Stream subclass -- method routines ** --------------- */ @@ -443,7 +443,7 @@ HTStreamClass WSRCParserClass = { WSRCParser_free, WSRCParser_abort, WSRCParser_put_character, - WSRCParser_put_string, + WSRCParser_put_string, WSRCParser_write }; @@ -454,7 +454,7 @@ HTStreamClass WSRCParserClass = { */ PUBLIC HTStream* HTWSRCConvert ARGS3( HTPresentation *, pres, - HTParentAnchor *, anchor, + HTParentAnchor *, anchor, HTStream *, sink) { HTStream * me = (HTStream*) malloc(sizeof(*me)); diff --git a/WWW/Library/Implementation/LYLeaks.h b/WWW/Library/Implementation/LYLeaks.h index d7d47a01..b181cb7f 100644 --- a/WWW/Library/Implementation/LYLeaks.h +++ b/WWW/Library/Implementation/LYLeaks.h @@ -6,45 +6,47 @@ #define __LYLEAKS_H /* - * Copyright (c) 1994, University of Kansas, All Rights Reserved - * - * Include File: LYLeaks.h - * Purpose: Header to convert requests for allocation to Lynx - * custom functions to track memory leaks. - * Remarks/Portability/Dependencies/Restrictions: - * For the stdlib.h allocation functions to be overriden by the - * Lynx memory tracking functions all modules allocating, - * freeing, or resizing memory must have LY_FIND_LEAKS - * defined before including this file. - * This header file should be included in every source file which - * does any memory manipulation through use of the - * stdlib.h memory functions. - * For proper reporting of memory leaks, the function LYLeaks - * should be registered for execution by atexit as the - * very first executable statement in main. - * This code is slow and should not be used except in debugging - * circumstances (don't define LY_FIND_LEAKS). - * If you are using LY_FIND_LEAKS and don't want the LYLeak* - * memory functions to be used in a certain file, - * define NO_MEMORY_TRACKING before including this file. - * The only safe way to call the LYLeak* functions is to use - * the below macros because they depend on the static - * string created by __FILE__ to not be dynamic in - * nature (don't free it and assume will exist at all - * times during execution). - * Revision History: - * 05-26-94 created for Lynx 2-3-1, Garrett Arch Blythe - */ +** Copyright (c) 1994, University of Kansas, All Rights Reserved +** +** Include File: LYLeaks.h +** Purpose: Header to convert requests for allocation to Lynx +** custom functions to track memory leaks. +** Remarks/Portability/Dependencies/Restrictions: +** For the stdlib.h allocation functions to be overriden by the +** Lynx memory tracking functions all modules allocating, +** freeing, or resizing memory must have LY_FIND_LEAKS +** defined before including this file. +** This header file should be included in every source file which +** does any memory manipulation through use of the +** stdlib.h memory functions. +** For proper reporting of memory leaks, the function LYLeaks +** should be registered for execution by atexit as the +** very first executable statement in main. +** This code is slow and should not be used except in debugging +** circumstances (don't define LY_FIND_LEAKS). +** If you are using LY_FIND_LEAKS and don't want the LYLeak* +** memory functions to be used in a certain file, +** define NO_MEMORY_TRACKING before including this file. +** The only safe way to call the LYLeak* functions is to use +** the below macros because they depend on the static +** string created by __FILE__ to not be dynamic in +** nature (don't free it and assume will exist at all +** times during execution). +** Revision History: +** 05-26-94 created for Lynx 2-3-1, Garrett Arch Blythe +** 10-30-97 modified to handle StrAllocCopy() and +** StrAllocCat(). - KW & FM +*/ /* - * Required includes - */ +** Required includes +*/ #include <stdlib.h> #include "HTUtils.h" /* - * Constant defines - */ +** Constant defines +*/ #define MAX_CONTENT_LENGTH 50 #ifdef VMS #define LEAKAGE_SINK "sys$login:Lynx.leaks" @@ -53,8 +55,8 @@ #endif /* VMS */ /* - * Data structures - */ +** Data structures +*/ typedef struct SourceLocation_tag { /* * The file name and line number of where an event took place. @@ -89,25 +91,24 @@ typedef struct AllocationList_tag { */ SourceLocation SL_memory; SourceLocation SL_realloc; -} -AllocationList; +} AllocationList; /* - * Global variable declarations - */ +** Global variable declarations +*/ /* - * Macros - */ +** Macros +*/ #if defined(LY_FIND_LEAKS) && !defined(NO_MEMORY_TRACKING) /* - * Only use these macros if we are to track memory allocations. - * The reason for using a macro instead of a define is that we want - * to track where the initial allocation took place or where - * the last reallocation took place. - * Track where the allocation took place by the __FILE__ and __LINE__ - * defines which are automatic to the compiler. - */ +** Only use these macros if we are to track memory allocations. +** The reason for using a macro instead of a define is that we want +** to track where the initial allocation took place or where +** the last reallocation took place. +** Track where the allocation took place by the __FILE__ and __LINE__ +** defines which are automatic to the compiler. +*/ #ifdef malloc #undef malloc #endif /* malloc */ @@ -131,34 +132,52 @@ AllocationList; #define free(vp_alloced) LYLeakFree(vp_alloced, __FILE__, __LINE__) /* - * Added the following two defines to track Lynx's frequent use - * of those macros. - kw 1997-10-12 - */ +** Added the following two defines to track Lynx's frequent use +** of those macros. - KW 1997-10-12 +*/ #ifdef StrAllocCopy #undef StrAllocCopy +#endif /* StrAllocCopy */ +#define StrAllocCopy(dest, src) LYLeakSACopy(&(dest), src, __FILE__, __LINE__) +#ifdef StrAllocCat #undef StrAllocCat -#endif -#define StrAllocCopy(dest, src) LYLeakSACopy (&(dest), src, __FILE__, __LINE__) -#define StrAllocCat(dest, src) LYLeakSACat (&(dest), src, __FILE__, __LINE__) +#endif /* StrAllocCat */ +#define StrAllocCat(dest, src) LYLeakSACat(&(dest), src, __FILE__, __LINE__) #endif /* LY_FIND_LEAKS && !NO_MEMORY_TRACKING */ /* - * Function declarations - * See the appropriate source file for usage. - */ -PUBLIC void LYLeaks NOPARAMS; -PUBLIC void *LYLeakMalloc PARAMS((size_t st_bytes, CONST char *cp_File, CONST - short ssi_Line)); -PUBLIC void *LYLeakCalloc PARAMS((size_t st_number, size_t st_bytes, CONST char - *cp_File, CONST short ssi_Line)); -PUBLIC void *LYLeakRealloc PARAMS((void *vp_alloced, size_t st_newbytes, CONST - char *cp_File, CONST short ssi_Line)); -PUBLIC void LYLeakFree PARAMS((void *vp_alloced, CONST char *cp_File, CONST - short ssi_Line)); -extern char * LYLeakSACopy PARAMS ((char **dest, CONST char *src, CONST char - *cp_File, CONST short ssi_Line)); -extern char * LYLeakSACat PARAMS ((char **dest, CONST char *src, CONST char - *cp_File, CONST short ssi_Line)); +** Function declarations +** See the appropriate source file for usage. +*/ +extern void LYLeaks NOPARAMS; +extern void *LYLeakMalloc PARAMS(( + size_t st_bytes, + CONST char * cp_File, + CONST short ssi_Line)); +extern void *LYLeakCalloc PARAMS(( + size_t st_number, + size_t st_bytes, + CONST char * cp_File, + CONST short ssi_Line)); +extern void *LYLeakRealloc PARAMS(( + void * vp_alloced, + size_t st_newbytes, + CONST char * cp_File, + CONST short ssi_Line)); +extern void LYLeakFree PARAMS(( + void * vp_alloced, + CONST char * cp_File, + CONST short ssi_Line)); +extern char * LYLeakSACopy PARAMS(( + char ** dest, + CONST char * src, + CONST char * cp_File, + CONST short ssi_Line)); +extern char * LYLeakSACat PARAMS(( + char ** dest, + CONST char * src, + CONST char * cp_File, + CONST short ssi_Line)); #endif /* __LYLEAKS_H */ diff --git a/WWW/Library/Implementation/Makefile b/WWW/Library/Implementation/Makefile new file mode 100644 index 00000000..7f028976 --- /dev/null +++ b/WWW/Library/Implementation/Makefile @@ -0,0 +1,489 @@ +# Makefile generated by imake - do not edit! +# $XConsortium: imake.c,v 1.51 89/12/12 12:37:30 jim Exp $ +# +# The cpp used on this machine replaces all newlines and multiple tabs and +# spaces in a macro expansion with a single space. Imake tries to compensate +# for this, but is not always successful. +# + +########################################################################### +# Makefile generated from "Imake.tmpl" and </tmp/IIf.a00214> +# $XConsortium: Imake.tmpl,v 1.77 89/12/18 17:01:37 jim Exp $ +# +# Platform-specific parameters may be set in the appropriate .cf +# configuration files. Site-wide parameters may be set in the file +# site.def. Full rebuilds are recommended if any parameters are changed. +# +# If your C preprocessor doesn't define any unique symbols, you'll need +# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing +# "make Makefile", "make Makefiles", or "make World"). +# +# If you absolutely can't get imake to work, you'll need to set the +# variables at the top of each Makefile as well as the dependencies at the +# bottom (makedepend will do this automatically). +# + +########################################################################### +# platform-specific configuration parameters - edit sun.cf to change + +# platform: $XConsortium: sun.cf,v 1.38 89/12/23 16:10:10 jim Exp $ +# operating system: SunOS 4.0.3 + +########################################################################### +# site-specific configuration parameters - edit site.def to change + + SHELL = /bin/sh + + TOP = . + CURRENT_DIR = . + + AR = ar clq + BOOTSTRAPCFLAGS = + CC = cc + + COMPRESS = compress + CPP = /lib/cpp $(STD_CPP_DEFINES) + PREPROCESSCMD = cc -E $(STD_CPP_DEFINES) + INSTALL = install + LD = ld + LINT = lint + LINTLIBFLAG = -C + LINTOPTS = -axz + LN = ln -s + MAKE = make + MV = mv + CP = cp + RANLIB = ranlib + RANLIBINSTFLAGS = + RM = rm -f + STD_INCLUDES = + STD_CPP_DEFINES = + STD_DEFINES = + EXTRA_LOAD_FLAGS = + EXTRA_LIBRARIES = + TAGS = ctags + + SHAREDCODEDEF = -DSHAREDCODE + SHLIBDEF = -DSUNSHLIB + + PROTO_DEFINES = + + INSTPGMFLAGS = + + INSTBINFLAGS = -m 0755 + INSTUIDFLAGS = -m 4755 + INSTLIBFLAGS = -m 0664 + INSTINCFLAGS = -m 0444 + INSTMANFLAGS = -m 0444 + INSTDATFLAGS = -m 0444 + INSTKMEMFLAGS = -m 4755 + + DESTDIR = + + TOP_INCLUDES = -I$(INCROOT) + + CDEBUGFLAGS = -O + CCOPTIONS = + COMPATFLAGS = + + ALLINCLUDES = $(STD_INCLUDES) $(TOP_INCLUDES) $(INCLUDES) $(EXTRA_INCLUDES) + ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES) $(DEFINES) $(COMPATFLAGS) + CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES) + LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) + LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) + LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) + LDCOMBINEFLAGS = -X -r + + MACROFILE = sun.cf + RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut + + IMAKE_DEFINES = + + IRULESRC = $(CONFIGDIR) + IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES) + + ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \ + $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \ + $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES) + +########################################################################### +# X Window System Build Parameters +# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $ + +########################################################################### +# X Window System make variables; this need to be coordinated with rules +# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $ + + PATHSEP = / + USRLIBDIR = $(DESTDIR)/usr/lib + BINDIR = $(DESTDIR)/usr/bin/X11 + INCROOT = $(DESTDIR)/usr/include + BUILDINCROOT = $(TOP) + BUILDINCDIR = $(BUILDINCROOT)/X11 + BUILDINCTOP = .. + INCDIR = $(INCROOT)/X11 + ADMDIR = $(DESTDIR)/usr/adm + LIBDIR = $(USRLIBDIR)/X11 + CONFIGDIR = $(LIBDIR)/config + LINTLIBDIR = $(USRLIBDIR)/lint + + FONTDIR = $(LIBDIR)/fonts + XINITDIR = $(LIBDIR)/xinit + XDMDIR = $(LIBDIR)/xdm + AWMDIR = $(LIBDIR)/awm + TWMDIR = $(LIBDIR)/twm + GWMDIR = $(LIBDIR)/gwm + MANPATH = $(DESTDIR)/usr/man + MANSOURCEPATH = $(MANPATH)/man + MANDIR = $(MANSOURCEPATH)n + LIBMANDIR = $(MANSOURCEPATH)3 + XAPPLOADDIR = $(LIBDIR)/app-defaults + + SOXLIBREV = 4.2 + SOXTREV = 4.0 + SOXAWREV = 4.0 + SOOLDXREV = 4.0 + SOXMUREV = 4.0 + SOXEXTREV = 4.0 + + FONTCFLAGS = -t + + INSTAPPFLAGS = $(INSTDATFLAGS) + + IMAKE = imake + DEPEND = makedepend + RGB = rgb + FONTC = bdftosnf + MKFONTDIR = mkfontdir + MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier.sh + + CONFIGSRC = $(TOP)/config + CLIENTSRC = $(TOP)/clients + DEMOSRC = $(TOP)/demos + LIBSRC = $(TOP)/lib + FONTSRC = $(TOP)/fonts + INCLUDESRC = $(TOP)/X11 + SERVERSRC = $(TOP)/server + UTILSRC = $(TOP)/util + SCRIPTSRC = $(UTILSRC)/scripts + EXAMPLESRC = $(TOP)/examples + CONTRIBSRC = $(TOP)/../contrib + DOCSRC = $(TOP)/doc + RGBSRC = $(TOP)/rgb + DEPENDSRC = $(UTILSRC)/makedepend + IMAKESRC = $(CONFIGSRC) + XAUTHSRC = $(LIBSRC)/Xau + XLIBSRC = $(LIBSRC)/X + XMUSRC = $(LIBSRC)/Xmu + TOOLKITSRC = $(LIBSRC)/Xt + AWIDGETSRC = $(LIBSRC)/Xaw + OLDXLIBSRC = $(LIBSRC)/oldX + XDMCPLIBSRC = $(LIBSRC)/Xdmcp + BDFTOSNFSRC = $(FONTSRC)/bdftosnf + MKFONTDIRSRC = $(FONTSRC)/mkfontdir + EXTENSIONSRC = $(TOP)/extensions + + DEPEXTENSIONLIB = + EXTENSIONLIB = -lXext + + DEPXLIB = $(DEPEXTENSIONLIB) + XLIB = $(EXTENSIONLIB) -lX11 + + DEPXAUTHLIB = $(USRLIBDIR)/libXau.a + XAUTHLIB = -lXau + + DEPXMULIB = + XMULIB = -lXmu + + DEPOLDXLIB = + OLDXLIB = -loldX + + DEPXTOOLLIB = + XTOOLLIB = -lXt + + DEPXAWLIB = + XAWLIB = -lXaw + + LINTEXTENSIONLIB = $(USRLIBDIR)/llib-lXext.ln + LINTXLIB = $(USRLIBDIR)/llib-lX11.ln + LINTXMU = $(USRLIBDIR)/llib-lXmu.ln + LINTXTOOL = $(USRLIBDIR)/llib-lXt.ln + LINTXAW = $(USRLIBDIR)/llib-lXaw.ln + + DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) + + DEPLIBS1 = $(DEPLIBS) + DEPLIBS2 = $(DEPLIBS) + DEPLIBS3 = $(DEPLIBS) + +########################################################################### +# Imake rules for building libraries, programs, scripts, and data files +# rules: $XConsortium: Imake.rules,v 1.67 89/12/18 17:14:15 jim Exp $ + +########################################################################### +# start of Imakefile + +# Make WWW under unix for a.n.other unix system (bsd) +# Use this as a template + +TK_WWW_SOURCE_PATH=/a/dxcern/userd/tbl/hypertext/WWW/TkWWW/Tcl + +TK_WWW_INSTALL_PATH=/a/dxcern/userd/tbl/hypertext/WWW/TkWWW/$(WWW_MACH) + +TK_WWW_HOME_PAGE=http://www.w3.org/default.html +TK_WWW_START_PAGE=$(TK_WWW_HOME_PAGE) + +CC = gcc -fno-builtin -Wall + +CDEBUGFLAGS = -O3 -pipe + +COMPATFLAGS = -I/afs/athena.mit.edu/course/other/cdsdev/www-compat +CCOPTIONS = + +BINDIR = $(TK_WWW_INSTALL_PATH) + +# For W3 distribution, machine type for subdirectories +WWW_MACH = unix_x + +# The ASIS repository's name for the machine we are on +ASIS_MACH = hardware/os + +#_________________ OK if normal W3 distribution +# Where is the WWW source root? +WWW = ../.. + +# Where should temporary (object) files go? +WTMP = /tmp + +# Common Makefile for W3 Library Code +# ----------------------------------- +# +# (c) CERN 1990, 1991 -- see Copyright.html for conditions +# +# This file should be invariant between systems. +# DEPENDENCIES NOT COMPLETE + +# +# make Compile and link the software (private version) +# make clean Remove intermediate files + +WC = $(WWW)/Library +CMN = $(WWW)/Library/Implementation/ + +# Where shall we put the objects and built library? + +LOB = $(WTMP)/Library/$(WWW_MACH) + +# Bug: This path, if relative, is taken relative to the directory +# in which this makefile is, not the pwd. This screws up the +# recursive invocation + +VC = 2.14 + +CFLAGS2 = $(CFLAGS) -I$(CMN) + +CERNLIBBIN = $(WWW)/bin + +COMMON = $(LOB)/HTParse.o $(LOB)/HTAccess.o $(LOB)/HTTP.o \ + $(LOB)/HTFile.o $(LOB)/HTFTP.o $(LOB)/HTTCP.o \ + $(LOB)/SGML.o $(LOB)/HTMLDTD.o $(LOB)/HTChunk.o \ + $(LOB)/HTPlain.o $(LOB)/HTWriter.o $(LOB)/HTFWriter.o \ + $(LOB)/HTMLGen.o \ + $(LOB)/HTAtom.o $(LOB)/HTAnchor.o $(LOB)/HTStyle.o \ + $(LOB)/HTList.o $(LOB)/HTString.o $(LOB)/HTAlert.o \ + $(LOB)/HTRules.o $(LOB)/HTFormat.o $(LOB)/HTInit.o $(LOB)/HTMIME.o \ + $(LOB)/HTHistory.o $(LOB)/HTNews.o $(LOB)/HTGopher.o \ + $(LOB)/HTTelnet.o $(LOB)/HTWSRC.o $(HTWAIS) + +CFILES = $(CMN)HTParse.c $(CMN)HTAccess.c $(CMN)HTTP.c $(CMN)HTFile.c \ + $(CMN)HTFTP.c $(CMN)HTTCP.c $(CMN)SGML.c \ + $(CMN)HTMLDTD.c \ + $(CMN)HTPlain.c $(CMN)HTWriter.c $(CMN)HTFWriter.c $(CMN)HTMLGen.c \ + $(CMN)HTChunk.c $(CMN)HTAtom.c $(CMN)HTAnchor.c $(CMN)HTStyle.c \ + $(CMN)HTList.c $(CMN)HTString.c $(CMN)HTAlert.c $(CMN)HTRules.c \ + $(CMN)HTFormat.c $(CMN)HTInit.c $(CMN)HTMIME.c $(CMN)HTHistory.c \ + $(CMN)HTNews.c $(CMN)HTGopher.c $(CMN)HTTelnet.c \ + $(CMN)HTWAIS.c $(CMN)HTWSRC.c + +HFILES = $(CMN)HTParse.h $(CMN)HTAccess.h $(CMN)HTTP.h $(CMN)HTFile.h \ + $(CMN)HTFTP.h $(CMN)HTTCP.h \ + $(CMN)SGML.h $(CMN)HTML.h $(CMN)HTMLDTD.h $(CMN)HTChunk.h \ + $(CMN)HTPlain.h $(CMN)HTWriter.h \ + $(CMN)HTFWriter.h $(CMN)HTMLGen.h \ + $(CMN)HTStream.h \ + $(CMN)HTAtom.h $(CMN)HTAnchor.h $(CMN)HTStyle.h \ + $(CMN)HTList.h \ + $(CMN)HTString.h $(CMN)HTAlert.h $(CMN)HTRules.h \ + $(CMN)HTFormat.h $(CMN)HTInit.h \ + $(CMN)HTMIME.h $(CMN)HTHistory.h $(CMN)HTNews.h \ + $(CMN)HTGopher.h \ + $(CMN)HTUtils.h $(CMN)tcp.h $(CMN)WWW.h $(CMN)HText.h \ + $(CMN)HTTelnet.h \ + $(CMN)HTWAIS.h $(CMN)HTWSRC.h + +SOURCES = $(CFILES) $(HFILES) $(CMN)Version.make $(CMN)CommonMakefile \ + $(WWW)/README.txt $(WWW)/Copyright.txt $(WWW)/BUILD +SPECIFIC = $(WWW)/All + +# Library +# +# On SGI, ranlib is unnecessary and does not exist so we ignore errors +# for that step +all: $(LOB)/libwww.a + $(MV) $(LOB)/libwww.a $(WC)/$(WWW_MACH) + +$(LOB)/libwww.a : $(COMMON) + ar r $(LOB)/libwww.a $(COMMON) + -ranlib $(LOB)/libwww.a + +# Clean up everything generatable except final products +clean :: + $(RM) $(LOB) + +# Clean up everything generatable including final products + +cleanall :: clean + $(RM) $(LOB)/libwww.a + +# Common code +# ----------- + +# Directory for object files - .created checks it exists + +OE = $(LOB)/.created +$(OE) : + -mkdir $(WTMP) + -mkdir $(WTMP)/Library + -mkdir $(WTMP)/Library/$(WWW_MACH) + touch $@ + +$(LOB)/HTList.o : $(OE) $(CMN)HTList.c $(CMN)HTUtils.h $(CMN)HTList.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTList.c + +$(LOB)/HTAnchor.o : $(OE) $(CMN)HTAnchor.c $(CMN)HTUtils.h $(CMN)HTList.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTAnchor.c + +$(LOB)/HTFormat.o : $(OE) $(CMN)HTFormat.c $(CMN)HTUtils.h $(CMN)HTList.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTFormat.c + +$(LOB)/HTInit.o : $(OE) $(CMN)HTInit.c $(CMN)HTUtils.h $(CMN)HTList.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTInit.c + +$(LOB)/HTMIME.o : $(OE) $(CMN)HTMIME.c $(CMN)HTUtils.h $(CMN)HTList.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTMIME.c + +$(LOB)/HTHistory.o : $(OE) $(CMN)HTHistory.c $(CMN)HTUtils.h $(CMN)HTList.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTHistory.c + +$(LOB)/HTNews.o : $(OE) $(CMN)HTNews.c $(CMN)HTUtils.h $(CMN)HTList.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTNews.c + +$(LOB)/HTGopher.o : $(OE) $(CMN)HTGopher.c $(CMN)HTUtils.h $(CMN)HTList.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTGopher.c + +$(LOB)/HTTelnet.o : $(OE) $(CMN)HTTelnet.c $(CMN)HTUtils.h $(CMN)HTTelnet.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTTelnet.c + +$(LOB)/HTStyle.o : $(OE) $(CMN)HTStyle.c $(CMN)HTUtils.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTStyle.c + +$(LOB)/HTAtom.o : $(OE) $(CMN)HTAtom.c $(CMN)HTUtils.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTAtom.c + +$(LOB)/HTChunk.o : $(OE) $(CMN)HTChunk.c $(CMN)HTUtils.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTChunk.c + +$(LOB)/HTString.o : $(OE) $(CMN)HTString.c $(CMN)HTUtils.h $(CMN)Version.make + $(CC) -c -o $@ $(CFLAGS2) -DVC=\"$(VC)\" $(CMN)HTString.c + +$(LOB)/HTAlert.o : $(OE) $(CMN)HTAlert.c $(CMN)HTUtils.h $(CMN)Version.make + $(CC) -c -o $@ $(CFLAGS2) -DVC=\"$(VC)\" $(CMN)HTAlert.c + +$(LOB)/HTRules.o : $(OE) $(CMN)HTRules.c $(CMN)HTUtils.h $(CMN)Version.make + $(CC) -c -o $@ $(CFLAGS2) -DVC=\"$(VC)\" $(CMN)HTRules.c + +$(LOB)/SGML.o : $(OE) $(CMN)SGML.c $(CMN)HTUtils.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)SGML.c + +$(LOB)/HTMLGen.o : $(OE) $(CMN)HTMLGen.c $(CMN)HTUtils.h $(CMN)HTMLDTD.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTMLGen.c + +$(LOB)/HTMLDTD.o : $(OE) $(CMN)HTMLDTD.c $(CMN)SGML.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTMLDTD.c + +$(LOB)/HTPlain.o : $(OE) $(CMN)HTPlain.c $(CMN)HTPlain.h $(CMN)HTStream.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTPlain.c + +$(LOB)/HTWAIS.o : $(OE) $(CMN)HTWAIS.c $(CMN)HTUtils.h $(CMN)HTList.h + $(CC) -c -o $@ $(CFLAGS2) $(WAISINC) $(CMN)HTWAIS.c + +$(LOB)/HTWSRC.o : $(OE) $(CMN)HTWSRC.c $(CMN)HTUtils.h $(CMN)HTList.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTWSRC.c + +$(LOB)/HTWriter.o : $(OE) $(CMN)HTWriter.c $(CMN)HTWriter.h $(CMN)HTStream.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTWriter.c + +$(LOB)/HTFWriter.o : $(OE) $(CMN)HTFWriter.c $(CMN)HTFWriter.h $(CMN)HTStream.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTFWriter.c + +# Communications & Files + +$(LOB)/HTTP.o : $(OE) $(CMN)HTTP.c $(CMN)HTUtils.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTTP.c + +$(LOB)/HTTCP.o : $(OE) $(CMN)HTTCP.c $(CMN)HTUtils.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTTCP.c + +$(LOB)/HTFile.o : $(OE) $(CMN)HTFile.c $(CMN)HTUtils.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTFile.c + +$(LOB)/HTFTP.o : $(OE) $(CMN)HTFTP.c $(CMN)HTUtils.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTFTP.c + +$(LOB)/HTAccess.o : $(OE) $(CMN)HTAccess.c $(CMN)HTUtils.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTAccess.c + +$(LOB)/HTParse.o : $(OE) $(CMN)HTParse.c $(CMN)HTUtils.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTParse.c + +########################################################################### +# common rules for all Makefiles - do not edit + +emptyrule:: + +clean:: + $(RM_CMD) \#* + +Makefile:: + -@if [ -f Makefile ]; then \ + echo " $(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \ + $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ + else exit 0; fi + $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) + +tags:: + $(TAGS) -w *.[ch] + $(TAGS) -xw *.[ch] > TAGS + +saber: + #load $(ALLDEFINES) $(SRCS) + +osaber: + #load $(ALLDEFINES) $(OBJS) + +########################################################################### +# empty rules for directories that do not have SUBDIRS - do not edit + +install:: + @echo "install in $(CURRENT_DIR) done" + +install.man:: + @echo "install.man in $(CURRENT_DIR) done" + +Makefiles:: + +includes:: + +########################################################################### +# dependencies generated by makedepend + diff --git a/WWW/Library/Implementation/SGML.c b/WWW/Library/Implementation/SGML.c index c18e0680..fedd0f40 100644 --- a/WWW/Library/Implementation/SGML.c +++ b/WWW/Library/Implementation/SGML.c @@ -36,10 +36,10 @@ #define FREE(x) if (x) {free(x); x = NULL;} -PUBLIC HTCJKlang HTCJK = NOCJK; /* CJK enum value. */ +PUBLIC HTCJKlang HTCJK = NOCJK; /* CJK enum value. */ PUBLIC BOOL HTPassEightBitRaw = FALSE; /* Pass 161-172,174-255 raw. */ -PUBLIC BOOL HTPassEightBitNum = FALSE; /* Pass ^ numeric entities raw. */ -PUBLIC BOOL HTPassHighCtrlRaw = FALSE; /* Pass 127-160,173, raw. */ +PUBLIC BOOL HTPassEightBitNum = FALSE; /* Pass ^ numeric entities raw. */ +PUBLIC BOOL HTPassHighCtrlRaw = FALSE; /* Pass 127-160,173, raw. */ PUBLIC BOOL HTPassHighCtrlNum = FALSE; /* Pass €-Ÿ raw. */ extern int LYlowest_eightbit[]; @@ -72,23 +72,23 @@ struct _HTStream { CONST HTStreamClass * isa; /* inherited from HTStream */ - CONST SGML_dtd *dtd; + CONST SGML_dtd *dtd; HTStructuredClass *actions; /* target class */ HTStructured *target; /* target object */ - HTTag *current_tag; + HTTag *current_tag; CONST HTTag *unknown_tag; BOOL inSELECT; int current_attribute_number; HTChunk *string; HTElement *element_stack; enum sgml_state { S_text, S_litteral, - S_tag, S_tag_gap, S_attr, S_attr_gap, S_equals, S_value, + S_tag, S_tag_gap, S_attr, S_attr_gap, S_equals, S_value, S_ero, S_cro, S_incro, S_exclamation, S_comment, S_doctype, S_marked, S_sgmlent, S_sgmlele, S_sgmlatt, S_squoted, S_dquoted, S_end, S_entity, - S_esc, S_dollar, S_paren, S_nonascii_text, + S_esc, S_dollar, S_paren, S_nonascii_text, S_dollar_paren, S_esc_sq, S_dollar_sq, S_paren_sq, S_nonascii_text_sq, S_dollar_paren_sq, @@ -110,61 +110,93 @@ struct _HTStream { BOOL isHex; HTParentAnchor * node_anchor; - LYUCcharset * UCI; /* pointer to anchor UCInfo */ - int in_char_set; /* charset we are fed */ - LYUCcharset * htmlUCI; /* anchor UCInfo for target */ - int html_char_set; /* feed it to target stream */ + LYUCcharset * inUCI; /* pointer to anchor UCInfo */ + int inUCLYhndl; /* charset we are fed */ + LYUCcharset * outUCI; /* anchor UCInfo for target */ + int outUCLYhndl; /* charset for target */ char utf_count; UCode_t utf_char; - char utf_buf[8]; + char utf_buf[8]; char * utf_buf_p; UCTransParams T; - int current_tag_charset; /* charset to pass attributes */ + int current_tag_charset; /* charset to pass attributes */ char * recover; - int recover_index; + int recover_index; char * include; - int include_index; + int include_index; char * url; char * csi; - int csi_index; + int csi_index; } ; - PRIVATE void set_chartrans_handling ARGS3( HTStream *, context, HTParentAnchor *, anchor, int, chndl) { if (chndl < 0) { + /* + ** Nothing was set for the parser in earlier stages, + ** so the HTML parser's UCLYhndl should still be it's + ** default. - FM + */ chndl = HTAnchor_getUCLYhndl(anchor, UCT_STAGE_STRUCTURED); if (chndl < 0) + /* + ** That wasn't set either, so seek the HText default. - FM + */ chndl = HTAnchor_getUCLYhndl(anchor, UCT_STAGE_HTEXT); if (chndl < 0) + /* + ** That wasn't set either, so assume the current display + ** character set. - FM + */ chndl = current_char_set; - HTAnchor_setUCInfoStage(anchor, chndl, UCT_STAGE_HTEXT, + /* + ** Try to set the HText and HTML stages' chartrans info + ** with the default lock level (will not be changed if + ** it was set previously with a higher lock level). - FM + */ + HTAnchor_setUCInfoStage(anchor, chndl, + UCT_STAGE_HTEXT, UCT_SETBY_DEFAULT); - HTAnchor_setUCInfoStage(anchor, chndl, UCT_STAGE_STRUCTURED, + HTAnchor_setUCInfoStage(anchor, chndl, + UCT_STAGE_STRUCTURED, UCT_SETBY_DEFAULT); - context->htmlUCI = HTAnchor_getUCInfoStage(anchor, + /* + ** Get the chartrans info for output to the HTML parser. - FM + */ + context->outUCI = HTAnchor_getUCInfoStage(anchor, UCT_STAGE_STRUCTURED); - context->html_char_set = HTAnchor_getUCLYhndl(context->node_anchor, + context->outUCLYhndl = HTAnchor_getUCLYhndl(context->node_anchor, UCT_STAGE_STRUCTURED); } + /* + ** Set the in->out transformation parameters. - FM + */ UCSetTransParams(&context->T, - context->in_char_set, context->UCI, - context->html_char_set, context->htmlUCI); + context->inUCLYhndl, context->inUCI, + context->outUCLYhndl, context->outUCI); + /* + ** This is intended for passing the SGML parser's input + ** charset as an argument in each call to the HTML + ** parser's start tag function, but it would be better + ** to call a Lynx_HTML_parser function to set an element + ** in its HTStructured object, itself, if this were + ** needed. - FM + */ if (HTCJK != NOCJK) { context->current_tag_charset = -1; } else if (context->T.transp) { - context->current_tag_charset = context->in_char_set; + context->current_tag_charset = context->inUCLYhndl; } else if (context->T.decode_utf8) { - context->current_tag_charset = context->in_char_set; + context->current_tag_charset = context->inUCLYhndl; } else if (context->T.do_8bitraw || context->T.use_raw_char_in) { - context->current_tag_charset = context->in_char_set; + context->current_tag_charset = context->inUCLYhndl; } else if (context->T.output_utf8 || - context->T.trans_from_uni) { + context->T.trans_from_uni) { context->current_tag_charset = UCGetLYhndl_byMIME("unicode-1-1-utf-8"); } else { context->current_tag_charset = 0; @@ -176,7 +208,7 @@ PRIVATE void change_chartrans_handling ARGS1( { int new_LYhndl = HTAnchor_getUCLYhndl(context->node_anchor, UCT_STAGE_PARSER); - if (new_LYhndl != context->in_char_set && + if (new_LYhndl != context->inUCLYhndl && new_LYhndl >= 0) { /* * Something changed. but ignore if a META wants an unknown charset. @@ -184,23 +216,22 @@ PRIVATE void change_chartrans_handling ARGS1( LYUCcharset * new_UCI = HTAnchor_getUCInfoStage(context->node_anchor, UCT_STAGE_PARSER); if (new_UCI) { - LYUCcharset * next_UCI = HTAnchor_getUCInfoStage( + LYUCcharset * next_UCI = HTAnchor_getUCInfoStage( context->node_anchor, UCT_STAGE_STRUCTURED ); int next_LYhndl = HTAnchor_getUCLYhndl( context->node_anchor, UCT_STAGE_STRUCTURED ); - context->UCI = new_UCI; - context->in_char_set = new_LYhndl; - context->htmlUCI = next_UCI; - context->html_char_set = next_LYhndl; + context->inUCI = new_UCI; + context->inUCLYhndl = new_LYhndl; + context->outUCI = next_UCI; + context->outUCLYhndl = next_LYhndl; set_chartrans_handling(context, context->node_anchor, next_LYhndl); } } } - #define PUTC(ch) ((*context->actions->put_character)(context->target, ch)) #define PUTUTF8(code) (UCPutUtf8_charstring((HTStream *)context->target, \ (putc_func_t*)(context->actions->put_character), code)) @@ -227,24 +258,30 @@ PRIVATE void handle_attribute_name ARGS2( HTTag * tag = context->current_tag; attr * attributes = tag->attributes; + int high, low, i, diff; - int high, low, i, diff; /* Binary search for attribute name */ + /* + ** Ignore unknown tag. - KW + */ if (tag == context->unknown_tag) { return; } + /* + ** Binary search for attribute name. + */ for (low = 0, high = tag->number_of_attributes; - high > low; + high > low; diff < 0 ? (low = i+1) : (high = i)) { i = (low + (high-low)/2); diff = strcasecomp(attributes[i].name, s); if (diff == 0) { /* success: found it */ - context->current_attribute_number = i; + context->current_attribute_number = i; context->present[i] = YES; FREE(context->value[i]); #ifdef USE_COLOR_STYLE - current_is_class=(!strcasecomp("class", s)); - if (TRACE) + current_is_class=(!strcasecomp("class", s)); + if (TRACE) fprintf(stderr, "SGML: found attribute %s, %d\n", s, current_is_class); #endif return; @@ -269,26 +306,29 @@ PRIVATE void handle_attribute_value ARGS2( if (context->current_attribute_number != INVALID) { StrAllocCopy(context->value[context->current_attribute_number], s); #ifdef USE_COLOR_STYLE - if (current_is_class) - { - strncpy (class_string, s, TEMPSTRINGSIZE); - if (TRACE) - fprintf(stderr, "SGML: class is '%s'\n", s); - } - else - { - if (TRACE) - fprintf(stderr, "SGML: attribute value is '%s'\n", s); - } + if (current_is_class) + { + strncpy (class_string, s, TEMPSTRINGSIZE); + if (TRACE) + fprintf(stderr, "SGML: class is '%s'\n", s); + } + else + { + if (TRACE) + fprintf(stderr, "SGML: attribute value is '%s'\n", s); + } #endif } else { - if (TRACE) + if (TRACE) fprintf(stderr, "SGML: Attribute value %s ignored\n", s); } context->current_attribute_number = INVALID; /* can't have two assignments! */ } -/* translate some Unicodes to Lynx special codes and output them. */ + +/* +** translate some Unicodes to Lynx special codes and output them. +*/ PRIVATE BOOL put_special_unicodes ARGS2( HTStream *, context, UCode_t, code) @@ -320,7 +360,7 @@ PRIVATE BOOL put_special_unicodes ARGS2( return NO; } /* - ** We have handled it. + ** We have handled it. */ return YES; } @@ -339,52 +379,48 @@ PRIVATE BOOL put_special_unicodes ARGS2( ** ** Modified more (for use with Lynx character translation code): */ -PRIVATE char replace_buf [64]; /* buffer for replacement strings */ +PRIVATE char replace_buf [64]; /* buffer for replacement strings */ PRIVATE BOOL FoundEntity = FALSE; #define IncludesLatin1Enc(cs) \ (cs == 0 || \ - (context->htmlUCI && \ - (context->htmlUCI->enc & (UCT_CP_SUPERSETOF_LAT1)))) + (context->outUCI && \ + (context->outUCI->enc & (UCT_CP_SUPERSETOF_LAT1)))) PRIVATE void handle_entity ARGS2( HTStream *, context, char, term) { CONST char ** entities = context->dtd->entity_names; -#ifdef NOTDEFINED - CONST UC_entity_info * extra_entities = context->dtd->extra_entity_info; - int rc; -#endif /* NOTDEFINED */ UCode_t code; long uck; CONST char *s = context->string->data; int high, low, i, diff; /* - ** Use Lynx special characters for nbsp (160), ensp (8194), - ** emsp (8195), thinsp (8201), and shy (173). - FM + ** Use Lynx special characters for nbsp (160), ensp (8194), + ** emsp (8195), thinsp (8201), and shy (173). - FM */ if (!strcmp(s, "nbsp")) { - PUTC(HT_NON_BREAK_SPACE); + PUTC(HT_NON_BREAK_SPACE); FoundEntity = TRUE; return; } if (!strcmp(s, "ensp") || !strcmp(s, "emsp") || !strcmp(s, "thinsp")) { - PUTC(HT_EM_SPACE); + PUTC(HT_EM_SPACE); FoundEntity = TRUE; return; } if (!strcmp(s, "shy")) { - PUTC(LY_SOFT_HYPHEN); + PUTC(LY_SOFT_HYPHEN); FoundEntity = TRUE; return; } #ifdef NOTUSED_FOTEMODS /* - ** For ndash or endash (8211), and mdash or emdash (8212), - ** use an ASCII hyphen (32). - FM + ** For ndash or endash (8211), and mdash or emdash (8212), + ** use an ASCII hyphen (32). - FM */ if (!strcmp(s, "ndash") || !strcmp(s, "endash") || @@ -397,11 +433,11 @@ PRIVATE void handle_entity ARGS2( #endif /* NOTUSED_FOTEMODS */ /* - ** Handle all other entities normally. - FM + ** Handle all other entities normally. - FM */ FoundEntity = FALSE; if ((code = HTMLGetEntityUCValue(s)) != 0) { - /* + /* ** We got a Unicode value for the entity name. ** Check for special Unicodes. - FM */ @@ -412,17 +448,17 @@ PRIVATE void handle_entity ARGS2( /* ** Seek a translation from the chartrans tables. */ - if ((uck = UCTransUniChar(code, context->html_char_set)) >= 32 && + if ((uck = UCTransUniChar(code, context->outUCLYhndl)) >= 32 && uck < 256 && (uck < 127 || - uck >= LYlowest_eightbit[context->html_char_set])) { - if (uck == 160 && IncludesLatin1Enc(context->html_char_set)) { + uck >= LYlowest_eightbit[context->outUCLYhndl])) { + if (uck == 160 && IncludesLatin1Enc(context->outUCLYhndl)) { /* ** Would only happen if some other Unicode ** is mapped to Latin-1 160. */ PUTC(HT_NON_BREAK_SPACE); - } else if (uck == 173 && IncludesLatin1Enc(context->html_char_set)) { + } else if (uck == 173 && IncludesLatin1Enc(context->outUCLYhndl)) { /* ** Would only happen if some other Unicode ** is mapped to Latin-1 173. @@ -440,7 +476,7 @@ PRIVATE void handle_entity ARGS2( ** Not found; look for replacement string. */ (uck = UCTransUniCharStr(replace_buf, 60, code, - context->html_char_set, 0) >= 0)) { + context->outUCLYhndl, 0) >= 0)) { CONST char *p; for (p = replace_buf; *p; p++) PUTC(*p); @@ -457,7 +493,7 @@ PRIVATE void handle_entity ARGS2( /* ** If it's safe ASCII, use it. - FM */ - if (code >= 32 && code < 127) { + if (code >= 32 && code < 127) { PUTC(FROMASCII((char)code)); FoundEntity = TRUE; return; @@ -465,9 +501,9 @@ PRIVATE void handle_entity ARGS2( } #ifdef NOTUSED_FOTEMODS /* - ** Ignore zwnj (8204) and zwj (8205), if we get to here. - ** Note that zwnj may have been handled as <WBR> - ** by the calling function. - FM + ** Ignore zwnj (8204) and zwj (8205), if we get to here. + ** Note that zwnj may have been handled as <WBR> + ** by the calling function. - FM */ if (!strcmp(s, "zwnj") || !strcmp(s, "zwj")) { @@ -479,7 +515,7 @@ PRIVATE void handle_entity ARGS2( } /* - ** Ignore lrm (8206), and rlm (8207), if we get to here. - FM + ** Ignore lrm (8206), and rln (8207), if we get to here. - FM */ if (!strcmp(s, "lrm") || !strcmp(s, "rlm")) { @@ -492,11 +528,11 @@ PRIVATE void handle_entity ARGS2( #endif /* NOTUSED_FOTEMODS */ /* - ** We haven't succeeded yet, so try the old LYCharSets - ** arrays for translation strings. - FM + ** We haven't succeeded yet, so try the old LYCharSets + ** arrays for translation strings. - FM */ for (low = 0, high = context->dtd->number_of_entities; - high > low; + high > low; diff < 0 ? (low = i+1) : (high = i)) { /* Binary search */ i = (low + (high-low)/2); diff = strcmp(entities[i], s); /* Case sensitive! */ @@ -507,60 +543,8 @@ PRIVATE void handle_entity ARGS2( } } -#ifdef NOTDEFINED - /* repeat for extra entities if not found... hack... -kw */ - if (TRACE) - fprintf(stderr, - "SGML: Unknown entity %s so far, checking extra...\n", s); - for (low = 0, high = context->dtd->number_of_extra_entities; - high > low; - diff < 0 ? (low = i+1) : (high = i)) { /* Binary search */ - i = (low + (high - low)/2); - diff = strcmp(extra_entities[i].name, s); /* Case sensitive! */ - if (diff == 0) { /* success: found it */ - if (put_special_unicodes(context, extra_entities[i].code)) { - FoundEntity = TRUE; - return; - } else if (context->T.output_utf8 && - PUTUTF8(extra_entities[i].code)) { - FoundEntity = TRUE; - return; - } - if ((rc = UCTransUniChar(extra_entities[i].code, - context->html_char_set)) > 0 && - rc < 256) { - /* - ** Could do further checks here... - KW - */ - PUTC(FROMASCII((char)rc)); - FoundEntity = TRUE; - return; - } else if ((rc == -4) && - /* - ** Not found; look for replacement string. - */ - (rc = UCTransUniCharStr(replace_buf, 60, - extra_entities[i].code, - context->html_char_set, - 0) >= 0)) { - CONST char *p; - for (p = replace_buf; *p; p++) - PUTC(*p); - FoundEntity = TRUE; - return; - } - rc = (*context->actions->put_entity)(context->target, - i+context->dtd->number_of_entities); - if (rc != HT_CANNOT_TRANSLATE) { - FoundEntity = TRUE; - return; - } - } - } -#endif /* NOTDEFINED */ - /* - ** If entity string not found, display as text. + ** If entity string not found, display as text. */ if (TRACE) fprintf(stderr, "SGML: Unknown entity '%s'\n", s); @@ -572,7 +556,7 @@ PRIVATE void handle_entity ARGS2( } } if (term != '\0') - PUTC(term); + PUTC(term); } @@ -588,8 +572,8 @@ PRIVATE void handle_comment ARGS1( fprintf(stderr, "SGML Comment:\n<%s>\n", s); if (context->csi == NULL && - strncmp(s, "!--#", 4) == 0 && - LYCheckForCSI(context->node_anchor, (char **)&context->url) == TRUE) { + strncmp(s, "!--#", 4) == 0 && + LYCheckForCSI(context->node_anchor, (char **)&context->url) == TRUE) { LYDoCSI(context->url, s, (char **)&context->csi); } @@ -688,7 +672,7 @@ PRIVATE void handle_sgmlatt ARGS1( PRIVATE BOOL element_valid_within ARGS3( - HTTag *, new_tag, + HTTag *, new_tag, HTTag *, stacked_tag, BOOL, direct) { @@ -712,11 +696,11 @@ extern BOOL New_DTD; typedef enum { close_NO = 0, close_error = 1, - close_valid = 2 + close_valid = 2 } canclose_t; PRIVATE canclose_t can_close ARGS2( - HTTag *, new_tag, + HTTag *, new_tag, HTTag *, stacked_tag) { if (!stacked_tag) @@ -730,18 +714,18 @@ PRIVATE canclose_t can_close ARGS2( close_error : close_NO); } PRIVATE void do_close_stacked ARGS1( - HTStream *, context) + HTStream *, context) { HTElement * stacked = context->element_stack; if (!stacked) - return; /* stack was empty */ + return; /* stack was empty */ if (context->inSELECT && !strcasecomp(stacked->tag->name, "SELECT")) { context->inSELECT = FALSE; } (*context->actions->end_element)( - context->target, - stacked->tag - context->dtd->tags, - (char **)&context->include); + context->target, + stacked->tag - context->dtd->tags, + (char **)&context->include); context->element_stack = stacked->next; FREE(stacked); } @@ -818,37 +802,36 @@ PRIVATE void end_element ARGS2( #endif /* EXTENDED_HTMLDTD */ /* - ** If we are in a SELECT block, ignore anything - ** but a SELECT end tag. - FM + ** If we are in a SELECT block, ignore anything + ** but a SELECT end tag. - FM */ if (context->inSELECT) { if (!strcasecomp(old_tag->name, "SELECT")) { /* - ** Turn off the inSELECT flag and fall through. - FM + ** Turn off the inSELECT flag and fall through. - FM */ context->inSELECT = FALSE; } else { /* - ** Ignore the end tag. - FM + ** Ignore the end tag. - FM */ if (TRACE) { fprintf(stderr, "SGML: Ignoring end tag </%s> in SELECT block.\n", - old_tag->name); + old_tag->name); } return; } } - /* - ** Handle the end tag. - FM + ** Handle the end tag. - FM */ if (TRACE) - fprintf(stderr, "SGML: End </%s>\n", old_tag->name); + fprintf(stderr, "SGML: End </%s>\n", old_tag->name); if (old_tag->contents == SGML_EMPTY) { - if (TRACE) + if (TRACE) fprintf(stderr, "SGML: Illegal end tag </%s> found.\n", - old_tag->name); + old_tag->name); return; } #ifdef WIND_DOWN_STACK @@ -860,15 +843,15 @@ PRIVATE void end_element ARGS2( HTTag * t = N->tag; if (old_tag != t) { /* Mismatch: syntax error */ - if (context->element_stack->next) { /* This is not the last level */ + if (context->element_stack->next) { /* This is not the last level */ if (TRACE) fprintf(stderr, - "SGML: Found </%s> when expecting </%s>. </%s> assumed.\n", + "SGML: Found </%s> when expecting </%s>. </%s> assumed.\n", old_tag->name, t->name, t->name); } else { /* last level */ if (TRACE) fprintf(stderr, - "SGML: Found </%s> when expecting </%s>. </%s> Ignored.\n", + "SGML: Found </%s> when expecting </%s>. </%s> Ignored.\n", old_tag->name, t->name, old_tag->name); - return; /* Ignore */ + return; /* Ignore */ } } @@ -887,7 +870,7 @@ PRIVATE void end_element ARGS2( } if (TRACE) - fprintf(stderr, "SGML: Extra end tag </%s> found and ignored.\n", + fprintf(stderr, "SGML: Extra end tag </%s> found and ignored.\n", old_tag->name); } @@ -976,32 +959,32 @@ PRIVATE void start_element ARGS1( #endif /* EXTENDED_HTMLDTD */ /* - ** If we are not in a SELECT block, check if this is - ** a SELECT start tag. Otherwise (i.e., we are in a - ** SELECT block) accept only OPTION as valid, terminate - ** the SELECT block if it is any other form-related - ** element, and otherwise ignore it. - FM + ** If we are not in a SELECT block, check if this is + ** a SELECT start tag. Otherwise (i.e., we are in a + ** SELECT block) accept only OPTION as valid, terminate + ** the SELECT block if it is any other form-related + ** element, and otherwise ignore it. - FM */ if (!context->inSELECT) { - /* + /* ** We are not in a SELECT block, so check if this starts one. - FM */ if (!strcasecomp(new_tag->name, "SELECT")) { /* - ** Set the inSELECT flag and fall through. - FM + ** Set the inSELECT flag and fall through. - FM */ context->inSELECT = TRUE; } } else { - /* + /* ** We are in a SELECT block. - FM */ - if (strcasecomp(new_tag->name, "OPTION")) { + if (strcasecomp(new_tag->name, "OPTION")) { /* - ** Ugh, it is not an OPTION. - FM + ** Ugh, it is not an OPTION. - FM */ if (!strcasecomp(new_tag->name, "INPUT") || - !strcasecomp(new_tag->name, "TEXTAREA") || + !strcasecomp(new_tag->name, "TEXTAREA") || !strcasecomp(new_tag->name, "SELECT") || !strcasecomp(new_tag->name, "BUTTON") || !strcasecomp(new_tag->name, "FIELDSET") || @@ -1018,7 +1001,7 @@ PRIVATE void start_element ARGS1( new_tag->name); end_element(context, SGMLFindTag(context->dtd, "SELECT")); } else { - /* + /* ** Ignore the start tag. - FM */ if (TRACE) @@ -1030,26 +1013,25 @@ PRIVATE void start_element ARGS1( } } /* - ** Handle the start tag. - FM + ** Handle the start tag. - FM */ if (TRACE) - fprintf(stderr, "SGML: Start <%s>\n", new_tag->name); + fprintf(stderr, "SGML: Start <%s>\n", new_tag->name); (*context->actions->start_element)( - context->target, + context->target, new_tag - context->dtd->tags, context->present, - (CONST char**) context->value, /* coerce type for think c */ + (CONST char**) context->value, /* coerce type for think c */ context->current_tag_charset, (char **)&context->include); if (new_tag->contents != SGML_EMPTY) { /* i.e. tag not empty */ HTElement * N = (HTElement *)malloc(sizeof(HTElement)); - if (N == NULL) + if (N == NULL) outofmem(__FILE__, "start_element"); N->next = context->element_stack; N->tag = new_tag; context->element_stack = N; - } - else if (!strcasecomp(new_tag->name, "META")) { + } else if (!strcasecomp(new_tag->name, "META")) { /* ** Check for result of META tag. - KW & FM */ @@ -1076,7 +1058,7 @@ PUBLIC HTTag * SGMLFindTag ARGS2( { int high, low, i, diff; for (low = 0, high=dtd->number_of_tags; - high > low; + high > low; diff < 0 ? (low = i+1) : (high = i)) { /* Binary search */ i = (low + (high-low)/2); diff = strcasecomp(dtd->tags[i].name, string); /* Case insensitive */ @@ -1085,7 +1067,9 @@ PUBLIC HTTag * SGMLFindTag ARGS2( } } if (isalpha((unsigned char)string[0])) { - /* unrecognized, but may be valid - kw */ + /* + ** Unrecognized, but may be valid. - KW + */ return (HTTag *)&HTTag_unrecognized; } return NULL; @@ -1097,9 +1081,9 @@ PUBLIC HTTag * SGMLFindTag ARGS2( /* Could check that we are back to bottom of stack! @@ */ -/* Do check! - FM */ +/* Do check! - FM */ /* */ -PRIVATE void SGML_free ARGS1( +PRIVATE void SGML_free ARGS1( HTStream *, context) { int i; @@ -1107,7 +1091,7 @@ PRIVATE void SGML_free ARGS1( HTTag * t; /* - ** Free the buffers. - FM + ** Free the buffers. - FM */ FREE(context->recover); FREE(context->url); @@ -1115,10 +1099,10 @@ PRIVATE void SGML_free ARGS1( FREE(context->include); /* - ** Wind down stack if any elements are open. - FM + ** Wind down stack if any elements are open. - FM */ while (context->element_stack) { - cur = context->element_stack; + cur = context->element_stack; t = cur->tag; context->element_stack = cur->next; /* Remove from stack */ FREE(cur); @@ -1128,12 +1112,12 @@ PRIVATE void SGML_free ARGS1( } /* - ** Finish off the target. - FM + ** Finish off the target. - FM */ (*context->actions->_free)(context->target); /* - ** Free the strings and context structure. - FM + ** Free the strings and context structure. - FM */ HTChunkFree(context->string); for (i = 0; i < MAX_ATTRIBUTES; i++) @@ -1143,18 +1127,18 @@ PRIVATE void SGML_free ARGS1( PRIVATE void SGML_abort ARGS2( HTStream *, context, - HTError, e) + HTError, e) { int i; HTElement * cur; /* - ** Abort the target. - FM + ** Abort the target. - FM */ (*context->actions->_abort)(context->target, e); /* - ** Free the buffers. - FM + ** Free the buffers. - FM */ FREE(context->recover); FREE(context->include); @@ -1162,16 +1146,16 @@ PRIVATE void SGML_abort ARGS2( FREE(context->csi); /* - ** Free stack memory if any elements were left open. - KW + ** Free stack memory if any elements were left open. - KW */ while (context->element_stack) { - cur = context->element_stack; + cur = context->element_stack; context->element_stack = cur->next; /* Remove from stack */ FREE(cur); } /* - ** Free the strings and context structure. - FM + ** Free the strings and context structure. - FM */ HTChunkFree(context->string); for (i = 0; i < MAX_ATTRIBUTES; i++) @@ -1207,18 +1191,19 @@ PRIVATE void SGML_character ARGS2( HTStream *, context, char, c_in) { - CONST SGML_dtd *dtd = context->dtd; - HTChunk *string = context->string; + CONST SGML_dtd *dtd = context->dtd; + HTChunk *string = context->string; CONST char * EntityName; char * p; BOOLEAN chk; /* Helps (?) walk through all the else ifs... */ - UCode_t clong, uck; /* Enough bits for UCS4 ... */ + UCode_t clong, uck; /* Enough bits for UCS4 ... */ char c; char saved_char_in = '\0'; + /* - ** Now some fun with the preprocessor. - ** Use copies for c and unsign_c == clong, so that - ** we can revert back to the unchanged c_in. - KW + ** Now some fun with the preprocessor. + ** Use copies for c and unsign_c == clong, so that + ** we can revert back to the unchanged c_in. - KW */ #define unsign_c clong @@ -1232,11 +1217,20 @@ PRIVATE void SGML_character ARGS2( ** From Linux kernel's console.c. - KW */ if ((unsigned char)c > 127) { + /* + ** We have an octet from a multibyte character. - FM + */ if (context->utf_count > 0 && (c & 0xc0) == 0x80) { context->utf_char = (context->utf_char << 6) | (c & 0x3f); context->utf_count--; - *(context->utf_buf_p++) = c; + *(context->utf_buf_p) = c; + (context->utf_buf_p)++; if (context->utf_count == 0) { + /* + ** We have all of the bytes, so terminate + ** the buffer and set 'clong' to the UCode_t + ** value. - FM + */ *(context->utf_buf_p) = '\0'; clong = context->utf_char; if (clong < 256) { @@ -1245,13 +1239,17 @@ PRIVATE void SGML_character ARGS2( goto top1; } else { /* - ** Wait for more. - KW + ** Wait for more. - KW */ return; } } else { + /* + ** Start handling a new multibyte character. - FM + */ context->utf_buf_p = context->utf_buf; - *(context->utf_buf_p++) = c; + *(context->utf_buf_p) = c; + (context->utf_buf_p)++; if ((c & 0xe0) == 0xc0) { context->utf_count = 1; context->utf_char = (c & 0x1f); @@ -1269,7 +1267,7 @@ PRIVATE void SGML_character ARGS2( context->utf_char = (c & 0x01); } else { /* - ** Garbage. - KW + ** Garbage. - KW */ context->utf_count = 0; context->utf_buf_p = context->utf_buf; @@ -1282,25 +1280,38 @@ PRIVATE void SGML_character ARGS2( } } else { /* - ** Got an ASCII char. - KW + ** Got an ASCII char. - KW */ context->utf_count = 0; context->utf_buf_p = context->utf_buf; *(context->utf_buf_p) = '\0'; - /* goto top; */ + /* goto top; */ } } -#ifdef NOTUSED_FOTEMODS +#ifdef NOTDEFINED + /* + ** If we have a koi8-r input and do not have + ** koi8-r as the output, save the raw input + ** in saved_char_in before we potentially + ** convert it to Unicode. - FM + */ if (context->T.strip_raw_char_in) saved_char_in = c; -#endif +#endif /* NOTDEFINED */ + /* + ** If we want the raw input converted + ** to Unicode, try that now. - FM + */ if (context->T.trans_to_uni && ((unsign_c >= 127) || (unsign_c < 32 && unsign_c != 0 && context->T.trans_C0_to_uni))) { - clong = UCTransToUni(c, context->in_char_set); + /* + ** Convert the octet to Unicode. - FM + */ + clong = UCTransToUni(c, context->inUCLYhndl); if (clong > 0) { saved_char_in = c; if (clong < 256) { @@ -1314,9 +1325,9 @@ PRIVATE void SGML_character ARGS2( ** This else if may be too ugly to keep. - KW */ if (context->T.trans_from_uni && - (((clong = UCTransToUni(c, context->in_char_set)) >= 32) || + (((clong = UCTransToUni(c, context->inUCLYhndl)) >= 32) || (context->T.transp && - (clong = UCTransToUni(c, context->in_char_set)) > 0))) { + (clong = UCTransToUni(c, context->inUCLYhndl)) > 0))) { saved_char_in = c; if (clong < 256) { c = FROMASCII((char)clong); @@ -1326,13 +1337,13 @@ PRIVATE void SGML_character ARGS2( uck = -1; if (context->T.transp) { uck = UCTransCharStr(replace_buf, 60, c, - context->in_char_set, - context->in_char_set, NO); + context->inUCLYhndl, + context->inUCLYhndl, NO); } if (!context->T.transp || uck < 0) { uck = UCTransCharStr(replace_buf, 60, c, - context->in_char_set, - context->html_char_set, YES); + context->inUCLYhndl, + context->outUCLYhndl, YES); } if (uck == 0) { return; @@ -1355,48 +1366,87 @@ PRIVATE void SGML_character ARGS2( } /* - ** At this point we have either unsign_c a.k.a. clong in - ** Unicode (and c in latin1 if clong is in the latin1 range), - ** or unsign_c and c will have to be passed raw. - KW + ** At this point we have either unsign_c a.k.a. clong in + ** Unicode (and c in latin1 if clong is in the latin1 range), + ** or unsign_c and c will have to be passed raw. - KW */ +/* +** We jump up to here from below if we have +** stuff in the recover, insert, or csi buffers +** to process. We zero saved_char_in, in effect +** as a flag that the octet in not that of the +** actual call to this function. This may be OK +** for now, for the stuff this function adds to +** its recover buffer, but it might not be for +** stuff other functions added to the insert or +** csi buffer, so bear that in mind. - FM +*/ top: saved_char_in = '\0'; +/* +** We jump to here from above when we don't have +** UTF-8 input, haven't converted to Unicode, and +** want clong set to the input octet (unsigned) +** without zeroing its saved_char_in copy (which +** is signed). - FM +*/ top0a: *(context->utf_buf) = '\0'; clong = (unsigned char)c; +/* +** We jump to here from above if we have converted +** the input, or a multibyte sequence across calls, +** to a Unicode value and loaded it into clong (to +** which unsign_c has been defined), and from below +** when we are recycling a character (e.g., because +** it terminated an entity but is not the standard +** semi-colon). The chararcter will already have +** been put through the Unicode conversions. - FM +*/ top1: /* - ** Ignore low ISO 646 7-bit control characters - ** if HTCJK is not set. - FM + ** Ignore low ISO 646 7-bit control characters + ** if HTCJK is not set. - FM */ if (unsign_c < 32 && c != 9 && c != 10 && c != 13 && HTCJK == NOCJK) - return; + return; /* - ** Ignore 127 if we don't have HTPassHighCtrlRaw - ** or HTCJK set. - FM + ** Ignore 127 if we don't have HTPassHighCtrlRaw + ** or HTCJK set. - FM */ -#define PASSHICTRL (context->T.transp || unsign_c >= LYlowest_eightbit[context->in_char_set]) +#define PASSHICTRL (context->T.transp || \ + unsign_c >= LYlowest_eightbit[context->inUCLYhndl]) if (c == 127 && - !(PASSHICTRL || HTCJK != NOCJK)) - return; + !(PASSHICTRL || HTCJK != NOCJK)) + return; /* - ** Ignore 8-bit control characters 128 - 159 if - ** neither HTPassHighCtrlRaw nor HTCJK is set. - FM + ** Ignore 8-bit control characters 128 - 159 if + ** neither HTPassHighCtrlRaw nor HTCJK is set. - FM */ if (unsign_c > 127 && unsign_c < 160 && !(PASSHICTRL || HTCJK != NOCJK)) - return; + return; /* - ** Handle character based on context->state. + ** Handle character based on context->state. */ switch(context->state) { case S_in_kanji: + /* + ** Note that if we don't have a CJK input, then this + ** is not the second byte of a CJK di-byte, and we're + ** trashing the input. That's why 8-bit characters + ** followed by, for example, '<' can cause the tag to + ** be treated as text, not markup. We could try to deal + ** with it by holding each first byte and then checking + ** byte pairs, but that doesn't seem worth the overhead + ** (see below). - FM + */ context->state = S_text; PUTC(c); break; @@ -1404,42 +1454,48 @@ top1: case S_text: if (HTCJK != NOCJK && (c & 0200) != 0) { /* - ** Setting up for Kanji multibyte handling (based on - ** Takuya ASADA's (asada@three-a.co.jp) CJK Lynx). - FM + ** 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 in fact CJK, the + ** next byte also will be mishandled, as explained + ** above. Toggle raw mode off in such cases, or + ** select the "7 bit approximations" display + ** character set, which is largely equivalent + ** to having raw mode off with CJK. - FM */ context->state = S_in_kanji; PUTC(c); break; } else if (HTCJK != NOCJK && c == '\033') { /* - ** Setting up for CJK escape sequence handling (based on - ** Takuya ASADA's (asada@three-a.co.jp) CJK Lynx). - FM + ** Setting up for CJK escape sequence handling (based on + ** Takuya ASADA's (asada@three-a.co.jp) CJK Lynx). - FM */ context->state = S_esc; PUTC(c); break; } - if (c == '&' && unsign_c < 127 && + if (c == '&' && unsign_c < 127 && (!context->element_stack || (context->element_stack->tag && (context->element_stack->tag->contents == SGML_MIXED || context->element_stack->tag->contents == SGML_PCDATA || context->element_stack->tag->contents == SGML_RCDATA)))) { /* - ** Setting up for possible entity, without the leading '&'. - FM + ** Setting up for possible entity, without the leading '&'. - FM */ string->size = 0; context->state = S_ero; } else if (c == '<' && unsign_c < 127) { /* - ** Setting up for possible tag. - FM + ** Setting up for possible tag. - FM */ string->size = 0; context->state = (context->element_stack && - context->element_stack->tag && + context->element_stack->tag && context->element_stack->tag->contents == SGML_LITTERAL) - ? - S_litteral : S_tag; + ? + S_litteral : S_tag; #define PASS8859SPECL context->T.pass_160_173_raw /* ** Convert 160 (nbsp) to Lynx special character if @@ -1447,19 +1503,23 @@ top1: */ } else if (unsign_c == 160 && !(PASS8859SPECL || HTCJK != NOCJK)) { - PUTC(HT_NON_BREAK_SPACE); + PUTC(HT_NON_BREAK_SPACE); /* ** Convert 173 (shy) to Lynx special character if ** neither HTPassHighCtrlRaw nor HTCJK is set. - FM */ } else if (unsign_c == 173 && !(PASS8859SPECL || HTCJK != NOCJK)) { - PUTC(LY_SOFT_HYPHEN); - + PUTC(LY_SOFT_HYPHEN); + /* + ** Handle the case in which we think we have a character + ** which doesn't need further processing (e.g., a koi8-r + ** input for a koi8-r output). - FM + */ } else if (context->T.use_raw_char_in && saved_char_in) { /* - ** Only if the original character is still in saved_char_in, - ** otherwise we may be iterating from a goto top. - KW + ** Only if the original character is still in saved_char_in, + ** otherwise we may be iterating from a goto top. - KW */ PUTC(saved_char_in); saved_char_in = '\0'; @@ -1468,27 +1528,31 @@ top1: ******************************************************************/ } else if ((chk = (context->T.trans_from_uni && unsign_c >= 160)) && (uck = UCTransUniChar(unsign_c, - context->html_char_set)) >= 32 && + context->outUCLYhndl)) >= 32 && uck < 256) { if (TRACE) { fprintf(stderr, "UCTransUniChar returned 0x%.2lX:'%c'.\n", uck, FROMASCII((char)uck)); } - c = (char)(uck & 0xff); - PUTC(c); - } else if (chk && ((uck == -4 || - (context->T.repl_translated_C0 && - uck > 0 && uck < 32))) && + /* + ** We got one octet from the conversions, so use it. - FM + */ + PUTC(FROMASCII((char)uck)); + } else if (chk && + ((uck == -4 || + (context->T.repl_translated_C0 && + uck > 0 && uck < 32))) && /* ** Not found; look for replacement string. - KW */ (uck = UCTransUniCharStr(replace_buf, 60, clong, - context->html_char_set, + context->outUCLYhndl, 0) >= 0)) { /* - ** No further tests for valididy - assume that whoever - ** defined replacement strings knew what she was doing. - KW + ** Got a replacement string. + ** No further tests for valididy - assume that whoever + ** defined replacement strings knew what she was doing. - KW */ for (p = replace_buf; *p; p++) PUTC(*p); @@ -1503,10 +1567,11 @@ top1: ** have the "ISO Latin 1" character set selected, ** back translate for our character set. - FM */ -#define PASSHI8BIT (HTPassEightBitRaw || (context->T.do_8bitraw && !context->T.trans_from_uni)) +#define PASSHI8BIT (HTPassEightBitRaw || \ + (context->T.do_8bitraw && !context->T.trans_from_uni)) } else if (unsign_c > 160 && unsign_c < 256 && !(PASSHI8BIT || HTCJK != NOCJK) && - !IncludesLatin1Enc(context->html_char_set)) { + !IncludesLatin1Enc(context->outUCLYhndl)) { int i; int value; @@ -1514,44 +1579,55 @@ top1: value = (int)(unsign_c - 160); EntityName = HTMLGetEntityName(value); for (i = 0; EntityName[i]; i++) - HTChunkPutc(string, EntityName[i]); + HTChunkPutc(string, EntityName[i]); HTChunkTerminate(string); handle_entity(context, '\0'); string->size = 0; if (!FoundEntity) - PUTC(';'); + PUTC(';'); /* - ** If we get to here and have an ASCII char, pass the character. + ** If we get to here and have an ASCII char, + ** pass the character. - KW */ } else if (unsign_c < 127 && unsign_c > 0) { PUTC(c); /* ** If we get to here, and should have translated, ** translation has failed so far. - KW + ** + ** We should have sent UTF-8 output to the parser + ** already, but what the heck, try again. - FM */ } else if (context->T.output_utf8 && *context->utf_buf) { for (p = context->utf_buf; *p; p++) PUTC(*p); context->utf_buf_p = context->utf_buf; *(context->utf_buf_p) = '\0'; - -#ifdef NOTUSED_FOTEMODS +#ifdef NOTDEFINED + /* + ** Check for a strippable koi8-r 8-bit character. - FM + */ } else if (context->T.strip_raw_char_in && saved_char_in && ((unsigned char)saved_char_in >= 0xc0) && ((unsigned char)saved_char_in < 255)) { /* - ** KOI8 special: strip high bit, gives (somewhat) readable - ** ASCII or KOI7 - it was constructed that way! - KW + ** KOI8 special: strip high bit, gives (somewhat) readable + ** ASCII or KOI7 - it was constructed that way! - KW */ - PUTC((char)(saved_char_in & 0x7f)); + PUTC(((char)(saved_char_in & 0x7f))); saved_char_in = '\0'; -#endif /* NOTUSED_FOTEMODS */ +#endif /* NOTDEFINED */ + /* + ** If we don't actually want the character, + ** make it safe and output that now. - FM + */ } else if ((unsigned char)c < - LYlowest_eightbit[context->html_char_set] || + LYlowest_eightbit[context->outUCLYhndl] || (context->T.trans_from_uni && !HTPassEightBitRaw)) { sprintf(replace_buf, "U%.2lX", unsign_c); - for (p = replace_buf; *p; p++) + for (p = replace_buf; *p; p++) { PUTC(*p); + } /* ** If we get to here, pass the character. - FM */ @@ -1561,8 +1637,8 @@ top1: break; /* - ** In litteral mode, waits only for specific end tag (for - ** compatibility with old servers, and for Lynx). - FM + ** In litteral mode, waits only for specific end tag (for + ** compatibility with old servers, and for Lynx). - FM */ case S_litteral: HTChunkPutc(string, c); @@ -1572,10 +1648,10 @@ top1: int i; /* - ** If complete match, end litteral. + ** If complete match, end litteral. */ if ((c == '>') && - (!context->element_stack->tag->name[string->size-2])) { + (!context->element_stack->tag->name[string->size-2])) { end_element(context, context->element_stack->tag); string->size = 0; context->current_attribute_number = INVALID; @@ -1583,7 +1659,7 @@ top1: break; } /* - ** If Mismatch: recover string. + ** If Mismatch: recover string. */ PUTC('<'); for (i = 0; i < string->size; i++) /* recover */ @@ -1591,15 +1667,15 @@ top1: string->size = 0; context->state = S_text; } - break; + break; /* - ** Character reference (numeric entity) or named entity. + ** Character reference (numeric entity) or named entity. */ case S_ero: - if (c == '#') { + if (c == '#') { /* - ** Setting up for possible numeric entity. + ** Setting up for possible numeric entity. */ context->state = S_cro; /* &# is Char Ref Open */ break; @@ -1607,26 +1683,26 @@ top1: context->state = S_entity; /* Fall through! */ /* - ** Handle possible named entity. + ** Handle possible named entity. */ case S_entity: if (unsign_c < 127 && (string->size ? isalnum((unsigned char)c) : isalpha((unsigned char)c))) { /* - ** Accept valid ASCII character. - FM + ** Accept valid ASCII character. - FM */ HTChunkPutc(string, c); } else if (string->size == 0) { /* - ** It was an ampersand that's just text, so output - ** the ampersand and recycle this character. - FM + ** It was an ampersand that's just text, so output + ** the ampersand and recycle this character. - FM */ PUTC('&'); context->state = S_text; goto top1; } else { /* - ** Terminate entity name and try to handle it. - FM + ** Terminate entity name and try to handle it. - FM */ HTChunkTerminate(string); if (!strcmp(string->data, "zwnj") && @@ -1662,18 +1738,18 @@ top1: string->size = 0; context->state = S_text; /* - ** Don't eat the terminator if we didn't find the - ** entity name and therefore sent the raw string - ** via handle_entity(), or if the terminator is - ** not the "standard" semi-colon for HTML. - FM + ** Don't eat the terminator if we didn't find the + ** entity name and therefore sent the raw string + ** via handle_entity(), or if the terminator is + ** not the "standard" semi-colon for HTML. - FM */ if (!FoundEntity || c != ';') - goto top1; + goto top1; } break; /* - ** Check for a numeric entity. + ** Check for a numeric entity. */ case S_cro: if (unsign_c < 127 && TOLOWER((unsigned char)c) == 'x') { @@ -1681,15 +1757,15 @@ top1: context->state = S_incro; } else if (unsign_c < 127 && isdigit((unsigned char)c)) { /* - ** Accept only valid ASCII digits. - FM + ** Accept only valid ASCII digits. - FM */ HTChunkPutc(string, c); /* accumulate a character NUMBER */ context->isHex = FALSE; context->state = S_incro; } else if (string->size == 0) { /* - ** No 'x' or digit following the "&#" so recover - ** them and recycle the character. - FM + ** No 'x' or digit following the "&#" so recover + ** them and recycle the character. - FM */ PUTC('&'); PUTC('#'); @@ -1699,20 +1775,20 @@ top1: break; /* - ** Handle a numeric entity. + ** Handle a numeric entity. */ case S_incro: if ((unsign_c < 127) && (context->isHex ? isxdigit((unsigned char)c) : isdigit((unsigned char)c))) { /* - ** Accept only valid hex or ASCII digits. - FM + ** Accept only valid hex or ASCII digits. - FM */ HTChunkPutc(string, c); /* accumulate a character NUMBER */ } else if (string->size == 0) { /* - ** No hex digit following the "&#x" so recover - ** them and recycle the character. - FM + ** No hex digit following the "&#x" so recover + ** them and recycle the character. - FM */ PUTC('&'); PUTC('#'); @@ -1722,134 +1798,135 @@ top1: goto top1; } else { /* - ** Terminate the numeric entity and try to handle it. - FM + ** Terminate the numeric entity and try to handle it. - FM */ - int value, i; + UCode_t code; + int i; HTChunkTerminate(string); - if ((context->isHex ? sscanf(string->data, "%x", &value) : - sscanf(string->data, "%d", &value)) == 1) { + if ((context->isHex ? sscanf(string->data, "%lx", &code) : + sscanf(string->data, "%ld", &code)) == 1) { #ifdef NOTUSED_FOTEMODS if ((code == 1) || (code > 129 && code < 156)) { /* - ** Assume these are MicroSoft code points, - ** inflicted on us by FrontPage. - FM + ** Assume these are MicroSoft code points, + ** inflicted on us by FrontPage. - FM */ switch (code) { case 1: /* - ** WHITE SMILING FACE + ** WHITE SMILING FACE */ code = 0x263a; break; case 130: /* - ** SINGLE LOW-9 QUOTATION MARK (sbquo) + ** SINGLE LOW-9 QUOTATION MARK (sbquo) */ code = 0x201a; break; case 132: /* - ** DOUBLE LOW-9 QUOTATION MARK (bdquo) + ** DOUBLE LOW-9 QUOTATION MARK (bdquo) */ code = 0x201e; break; case 133: /* - ** HORIZONTAL ELLIPSIS (hellip) + ** HORIZONTAL ELLIPSIS (hellip) */ code = 0x2026; break; case 134: /* - ** DAGGER (dagger) + ** DAGGER (dagger) */ code = 0x2020; break; case 135: /* - ** DOUBLE DAGGER (Dagger) + ** DOUBLE DAGGER (Dagger) */ code = 0x2021; break; case 137: /* - ** PER MILLE SIGN (permil) + ** PER MILLE SIGN (permil) */ code = 0x2030; break; case 139: /* - ** SINGLE LEFT-POINTING ANGLE QUOTATION MARK - ** (lsaquo) + ** SINGLE LEFT-POINTING ANGLE QUOTATION MARK + ** (lsaquo) */ code = 0x2039; break; case 145: /* - ** LEFT SINGLE QUOTATION MARK (lsquo) + ** LEFT SINGLE QUOTATION MARK (lsquo) */ code = 0x2018; break; case 146: /* - ** RIGHT SINGLE QUOTATION MARK (rsquo) + ** RIGHT SINGLE QUOTATION MARK (rsquo) */ code = 0x2019; break; case 147: /* - ** LEFT DOUBLE QUOTATION MARK (ldquo) + ** LEFT DOUBLE QUOTATION MARK (ldquo) */ code = 0x201c; break; case 148: /* - ** RIGHT DOUBLE QUOTATION MARK (rdquo) + ** RIGHT DOUBLE QUOTATION MARK (rdquo) */ code = 0x201d; break; case 149: /* - ** BULLET (bull) + ** BULLET (bull) */ code = 0x2022; break; case 150: /* - ** EN DASH (ndash) + ** EN DASH (ndash) */ code = 0x2013; break; case 151: /* - ** EM DASH (mdash) + ** EM DASH (mdash) */ code = 0x2014; break; case 152: /* - ** SMALL TILDE (tilde) + ** SMALL TILDE (tilde) */ code = 0x02dc; break; case 153: /* - ** TRADE MARK SIGN (trade) + ** TRADE MARK SIGN (trade) */ code = 0x2122; break; case 155: /* - ** SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - ** (rsaquo) + ** SINGLE RIGHT-POINTING ANGLE QUOTATION MARK + ** (rsaquo) */ code = 0x203a; break; default: /* - ** Do not attempt a conversion - ** to valid Unicode values. + ** Do not attempt a conversion + ** to valid Unicode values. */ break; } @@ -1858,22 +1935,22 @@ top1: /* ** Check for special values. - FM */ - if ((value == 8204) && + if ((code == 8204) && (!context->element_stack || (context->element_stack->tag && context->element_stack->tag->contents == SGML_MIXED))) { /* - ** Handle zwnj (8204) as <WBR>. - FM + ** Handle zwnj (8204) as <WBR>. - FM */ char temp[8]; if (TRACE) { - fprintf(stderr, + fprintf(stderr, "SGML_character: Handling '8204' (zwnj) reference as 'WBR' element.\n"); } /* - ** Include the terminator if it is not - ** the standard semi-colon. - FM + ** Include the terminator if it is not + ** the standard semi-colon. - FM */ if (c != ';') { sprintf(temp, "<WBR>%c", c); @@ -1881,8 +1958,8 @@ top1: sprintf(temp, "<WBR>"); } /* - ** Add the replacement string to the - ** recover buffer for processing. - FM + ** Add the replacement string to the + ** recover buffer for processing. - FM */ if (context->recover == NULL) { StrAllocCopy(context->recover, temp); @@ -1895,13 +1972,13 @@ top1: context->state = S_text; break; } - if (value == 160 || value == 173) { + if (code == 160 || code == 173) { /* - ** We *always* should interpret these as Latin1 here! - ** Output the Lynx special character for nbsp and - ** then recycle the terminator or break. - FM + ** We *always* should interpret these as Latin1 here! + ** Output the Lynx special character for nbsp and + ** then recycle the terminator or break. - FM */ - if (value == 160) { + if (code == 160) { PUTC(HT_NON_BREAK_SPACE); } else { PUTC(LY_SOFT_HYPHEN); @@ -1914,22 +1991,22 @@ top1: break; } /* - * Seek a translation from the chartrans tables. - */ - if ((uck = UCTransUniChar(value, - context->html_char_set)) >= 32 && + ** Seek a translation from the chartrans tables. + */ + if ((uck = UCTransUniChar(code, + context->outUCLYhndl)) >= 32 && uck < 256 && (uck < 127 || - uck >= LYlowest_eightbit[context->html_char_set])) { + uck >= LYlowest_eightbit[context->outUCLYhndl])) { if (uck == 160 && - IncludesLatin1Enc(context->html_char_set)) { + IncludesLatin1Enc(context->outUCLYhndl)) { /* ** Would only happen if some other Unicode ** is mapped to Latin-1 160. */ PUTC(HT_NON_BREAK_SPACE); } else if (uck == 173 && - IncludesLatin1Enc(context->html_char_set)) { + IncludesLatin1Enc(context->outUCLYhndl)) { /* ** Would only happen if some other Unicode ** is mapped to Latin-1 173. @@ -1944,26 +2021,23 @@ top1: /* ** Not found; look for replacement string. */ - (uck = UCTransUniCharStr(replace_buf, 60, value, - context->html_char_set, + (uck = UCTransUniCharStr(replace_buf, 60, code, + context->outUCLYhndl, 0) >= 0)) { for (p = replace_buf; *p; p++) { PUTC(*p); } - } else if (context->T.output_utf8 && - PUTUTF8(value)) { - /* do nothing more */ ; - } else - if (value == 8482) { - /* - ** trade Handle as named entity. - FM - */ + /* + ** If we're displaying UTF-8, try that now. - FM + */ + } else if (context->T.output_utf8 && PUTUTF8(code)) { + ; /* do nothing more */ + /* + ** Handle trade as named entity. - FM + */ + } else if (code == 8482) { string->size = 0; - HTChunkPutc(string, 't'); - HTChunkPutc(string, 'r'); - HTChunkPutc(string, 'a'); - HTChunkPutc(string, 'd'); - HTChunkPutc(string, 'e'); + HTChunkPuts(string, "trade"); context->isHex = FALSE; context->state = S_entity; goto top1; @@ -1975,13 +2049,13 @@ top1: ** seek a translation for that. - FM */ } else if ((chk = ((code > 255) && - context->html_char_set != + context->outUCLYhndl != UCGetLYhndl_byMIME("us-ascii"))) && (uck = UCTransUniChar(code, UCGetLYhndl_byMIME("us-ascii"))) >= 32 && uck < 127) { /* - ** Got an ASCII character (yippey). - FM + ** Got an ASCII character (yippey). - FM */ PUTC(((char)(uck & 0xff))); } else if ((chk && uck == -4) && @@ -1990,7 +2064,7 @@ top1: UCGetLYhndl_byMIME("us-ascii"), 0) >= 0)) { /* - ** Got a replacement string (yippey). - FM + ** Got a replacement string (yippey). - FM */ for (p = replace_buf; *p; p++) PUTC(*p); @@ -2014,7 +2088,7 @@ top1: goto top1; break; #endif /* NOTUSED_FOTEMODS */ - /* + /* ** Show the numeric entity if we get to here ** and the value: ** (1) Is greater than 255 (but use ASCII characters @@ -2027,21 +2101,21 @@ top1: ** set. ** - FM */ - } else if ((value > 255) || - (value < 32 && - value != 9 && value != 10 && value != 13 && + } else if ((code > 255) || + (code < 32 && + code != 9 && code != 10 && code != 13 && HTCJK == NOCJK) || - (value == 127 && + (code == 127 && !(HTPassHighCtrlRaw || HTCJK != NOCJK)) || - (value > 127 && value < 160 && + (code > 127 && code < 160 && !HTPassHighCtrlNum)) { - if (value == 8194 || value == 8195 || value == 8201) { - /* + if (code == 8194 || code == 8195 || code == 8201) { + /* ** ensp, emsp or thinsp. - FM */ PUTC(HT_EM_SPACE); - } else if (value == 8211 || value == 8212) { - /* + } else if (code == 8211 || code == 8212) { + /* ** ndash or mdash. - FM */ PUTC('-'); @@ -2065,18 +2139,19 @@ top1: context->state = S_text; goto top1; } - } else if (value < 161 || HTPassEightBitNum || - IncludesLatin1Enc(context->html_char_set)) { + } else if (code < 161 || + HTPassEightBitNum || + IncludesLatin1Enc(context->outUCLYhndl)) { /* - ** No conversion needed. - FM + ** No conversion needed. - FM */ - PUTC(FROMASCII((char)value)); + PUTC(FROMASCII((char)code)); } else { /* - ** Convert and handle as named entity. - FM + ** Handle as named entity. - FM */ - value -= 160; - EntityName = HTMLGetEntityName(value); + code -= 160; + EntityName = HTMLGetEntityName(code); if (EntityName && EntityName[0] != '\0') { string->size = 0; for (i = 0; EntityName[i]; i++) @@ -2091,7 +2166,7 @@ top1: PUTC(';'); } } else { - /* + /* ** Our conversion failed, so recover the "&#" ** and digit(s), and recycle the terminator. - FM */ @@ -2120,11 +2195,11 @@ top1: ** Don't eat the terminator if it's not ** the "standard" semi-colon for HTML. - FM */ - if (c != ';') - + if (c != ';') { goto top1; + } } else { - /* + /* ** Not an entity, and don't know why not, so add ** the terminator to the string, output the "&#" ** or "&#x", and process the string via the recover @@ -2133,8 +2208,8 @@ top1: string->size--; HTChunkPutc(string, c); HTChunkTerminate(string); - PUTC('&'); - PUTC('#'); + PUTC('&'); + PUTC('#'); if (context->isHex) { PUTC('x'); context->isHex = FALSE; @@ -2154,19 +2229,19 @@ top1: break; /* - ** Tag + ** Tag */ - case S_tag: /* new tag */ + case S_tag: /* new tag */ if (unsign_c < 127 && (string->size ? isalnum((unsigned char)c) : isalpha((unsigned char)c))) { /* - ** Add valid ASCII character. - FM + ** Add valid ASCII character. - FM */ HTChunkPutc(string, c); - } else if (c == '!' && !string->size) { /* <! */ + } else if (c == '!' && !string->size) { /* <! */ /* - ** Terminate and set up for possible comment, - ** identifier, declaration, or marked section. - FM + ** Terminate and set up for possible comment, + ** identifier, declaration, or marked section. - FM */ context->state = S_exclamation; context->lead_exclamation = TRUE; @@ -2174,29 +2249,29 @@ top1: context->first_bracket = FALSE; HTChunkPutc(string, c); break; - } else if (!string->size && + } else if (!string->size && (unsign_c <= 160 && (c != '/' && c != '?' && c != '_' && c != ':'))) { /* - ** '<' must be followed by an ASCII letter to be a valid - ** start tag. Here it isn't, nor do we have a '/' for an - ** end tag, nor one of some other characters with a - ** special meaning for SGML or which are likely to be legal - ** Name Start characters in XML or some other extension. - ** So recover the '<' and following character as data. - FM & KW + ** '<' must be followed by an ASCII letter to be a valid + ** start tag. Here it isn't, nor do we have a '/' for an + ** end tag, nor one of some other characters with a + ** special meaning for SGML or which are likely to be legal + ** Name Start characters in XML or some other extension. + ** So recover the '<' and following character as data. - FM & KW */ context->state = S_text; PUTC('<'); goto top1; } else { /* End of tag name */ /* - ** Try to handle tag. - FM + ** Try to handle tag. - FM */ HTTag * t; if (c == '/') { if (TRACE) if (string->size!=0) - fprintf(stderr,"SGML: `<%s/' found!\n", string->data); + fprintf(stderr,"SGML: `<%s/' found!\n", string->data); context->state = S_end; break; } @@ -2211,7 +2286,7 @@ top1: */ int i; PUTC('<'); - for (i = 0; i < 3; i++) /* recover */ + for (i = 0; i < 3; i++) /* recover */ PUTC(string->data[i]); PUTC(c); if (TRACE) @@ -2230,18 +2305,20 @@ top1: if (TRACE) fprintf(stderr, "SGML: *** Unknown element %s\n", string->data); - /* Fall through and treat like valid tag for attribute - parsing - kw */ + /* + ** Fall through and treat like valid + ** tag for attribute parsing. - KW + */ } context->current_tag = t; /* - ** Clear out attributes. + ** Clear out attributes. */ { - int i; - for (i = 0; i < context->current_tag->number_of_attributes; i++) - context->present[i] = NO; + int i; + for (i = 0; i < context->current_tag->number_of_attributes; i++) + context->present[i] = NO; } string->size = 0; context->current_attribute_number = INVALID; @@ -2251,15 +2328,15 @@ top1: start_element(context); context->state = S_text; } else { - context->state = S_tag_gap; + context->state = S_tag_gap; } } break; case S_exclamation: - if (context->lead_exclamation && c == '-') { + if (context->lead_exclamation && c == '-') { /* - ** Set up for possible comment. - FM + ** Set up for possible comment. - FM */ context->lead_exclamation = FALSE; context->first_dash = TRUE; @@ -2268,7 +2345,7 @@ top1: } if (context->lead_exclamation && c == '[') { /* - ** Set up for possible marked section. - FM + ** Set up for possible marked section. - FM */ context->lead_exclamation = FALSE; context->first_bracket = TRUE; @@ -2279,7 +2356,7 @@ top1: } if (context->first_dash && c == '-') { /* - ** Set up to handle comment. - FM + ** Set up to handle comment. - FM */ context->lead_exclamation = FALSE; context->first_dash = FALSE; @@ -2292,7 +2369,7 @@ top1: context->first_dash = FALSE; if (c == '>') { /* - ** Try to handle identifier. - FM + ** Try to handle identifier. - FM */ HTChunkTerminate(string); handle_identifier(context); @@ -2302,17 +2379,17 @@ top1: } if (WHITE(c)) { if (string->size == 8 && - !strncasecomp(string->data, "!DOCTYPE", 8)) { + !strncasecomp(string->data, "!DOCTYPE", 8)) { /* ** Set up for DOCTYPE declaration. - FM */ HTChunkPutc(string, c); context->doctype_bracket = FALSE; context->state = S_doctype; - break; + break; } if (string->size == 7 && - !strncasecomp(string->data, "!ENTITY", 7)) { + !strncasecomp(string->data, "!ENTITY", 7)) { /* ** Set up for ENTITY declaration. - FM */ @@ -2323,7 +2400,7 @@ top1: break; } if (string->size == 8 && - !strncasecomp(string->data, "!ELEMENT", 8)) { + !strncasecomp(string->data, "!ELEMENT", 8)) { /* ** Set up for ELEMENT declaration. - FM */ @@ -2334,7 +2411,7 @@ top1: break; } if (string->size == 8 && - !strncasecomp(string->data, "!ATTLIST", 8)) { + !strncasecomp(string->data, "!ATTLIST", 8)) { /* ** Set up for ATTLIST declaration. - FM */ @@ -2349,12 +2426,12 @@ top1: break; case S_comment: /* Expecting comment. - FM */ - if (historical_comments) { + if (historical_comments) { /* - ** Any '>' terminates. - FM + ** Any '>' terminates. - FM */ if (c == '>') { - HTChunkTerminate(string); + HTChunkTerminate(string); handle_comment(context); string->size = 0; context->end_comment = FALSE; @@ -2365,7 +2442,7 @@ top1: HTChunkPutc(string, c); break; } - if (!context->first_dash && c == '-') { + if (!context->first_dash && c == '-') { HTChunkPutc(string, c); context->first_dash = TRUE; break; @@ -2374,18 +2451,18 @@ top1: HTChunkPutc(string, c); context->first_dash = FALSE; if (!context->end_comment) - context->end_comment = TRUE; + context->end_comment = TRUE; else if (!minimal_comments) - /* + /* ** Validly treat '--' pairs as successive comments ** (for minimal, any "--WHITE>" terminates). - FM */ - context->end_comment = FALSE; + context->end_comment = FALSE; break; } if (context->end_comment && c == '>') { /* - ** Terminate and handle the comment. - FM + ** Terminate and handle the comment. - FM */ HTChunkTerminate(string); handle_comment(context); @@ -2402,10 +2479,10 @@ top1: break; case S_doctype: /* Expecting DOCTYPE. - FM */ - if (context->doctype_bracket) { + if (context->doctype_bracket) { HTChunkPutc(string, c); if (c == ']') - context->doctype_bracket = FALSE; + context->doctype_bracket = FALSE; break; } if (c == '[' && WHITE(string->data[string->size - 1])) { @@ -2424,7 +2501,7 @@ top1: break; case S_marked: /* Expecting marked section. - FM */ - if (context->first_bracket && c == '[') { + if (context->first_bracket && c == '[') { HTChunkPutc(string, c); context->first_bracket = FALSE; context->second_bracket = TRUE; @@ -2447,7 +2524,7 @@ top1: break; case S_sgmlent: /* Expecting ENTITY. - FM */ - if (!context->first_dash && c == '-') { + if (!context->first_dash && c == '-') { HTChunkPutc(string, c); context->first_dash = TRUE; break; @@ -2456,9 +2533,9 @@ top1: HTChunkPutc(string, c); context->first_dash = FALSE; if (!context->end_comment) - context->end_comment = TRUE; + context->end_comment = TRUE; else - context->end_comment = FALSE; + context->end_comment = FALSE; break; } if (context->end_comment && c == '>') { @@ -2475,7 +2552,7 @@ top1: break; case S_sgmlele: /* Expecting ELEMENT. - FM */ - if (!context->first_dash && c == '-') { + if (!context->first_dash && c == '-') { HTChunkPutc(string, c); context->first_dash = TRUE; break; @@ -2484,9 +2561,9 @@ top1: HTChunkPutc(string, c); context->first_dash = FALSE; if (!context->end_comment) - context->end_comment = TRUE; + context->end_comment = TRUE; else - context->end_comment = FALSE; + context->end_comment = FALSE; break; } if (context->end_comment && c == '>') { @@ -2503,7 +2580,7 @@ top1: break; case S_sgmlatt: /* Expecting ATTLIST. - FM */ - if (!context->first_dash && c == '-') { + if (!context->first_dash && c == '-') { HTChunkPutc(string, c); context->first_dash = TRUE; break; @@ -2512,9 +2589,9 @@ top1: HTChunkPutc(string, c); context->first_dash = FALSE; if (!context->end_comment) - context->end_comment = TRUE; + context->end_comment = TRUE; else - context->end_comment = FALSE; + context->end_comment = FALSE; break; } if (context->end_comment && c == '>') { @@ -2533,9 +2610,9 @@ top1: case S_tag_gap: /* Expecting attribute or '>' */ if (WHITE(c)) break; /* Gap between attributes */ - if (c == '>') { /* End of tag */ + if (c == '>') { /* End of tag */ if (context->current_tag->name) - start_element(context); + start_element(context); context->state = S_text; break; } @@ -2543,7 +2620,7 @@ top1: context->state = S_attr; /* Get attribute */ break; - /* accumulating value */ + /* accumulating value */ case S_attr: if (WHITE(c) || (c == '>') || (c == '=')) { /* End of word */ HTChunkTerminate(string); @@ -2564,9 +2641,9 @@ top1: case S_attr_gap: /* Expecting attribute or '=' or '>' */ if (WHITE(c)) break; /* Gap after attribute */ - if (c == '>') { /* End of tag */ + if (c == '>') { /* End of tag */ if (context->current_tag->name) - start_element(context); + start_element(context); context->state = S_text; break; } else if (c == '=') { @@ -2580,11 +2657,11 @@ top1: case S_equals: /* After attr = */ if (WHITE(c)) break; /* Before attribute value */ - if (c == '>') { /* End of tag */ + if (c == '>') { /* End of tag */ if (TRACE) - fprintf(stderr, "SGML: found = but no value\n"); + fprintf(stderr, "SGML: found = but no value\n"); if (context->current_tag->name) - start_element(context); + start_element(context); context->state = S_text; break; @@ -2617,11 +2694,13 @@ top1: HTChunkPuts(string, context->utf_buf); context->utf_buf_p = context->utf_buf; *(context->utf_buf_p) = '\0'; - } else if (HTCJK == NOCJK && (context->T.output_utf8 || - context->T.trans_from_uni)) { - if (clong == 0xfffd && saved_char_in && HTPassEightBitRaw && + } else if (HTCJK == NOCJK && + (context->T.output_utf8 || + context->T.trans_from_uni)) { + if (clong == 0xfffd && saved_char_in && + HTPassEightBitRaw && (unsigned char)saved_char_in >= - LYlowest_eightbit[context->html_char_set]) { + LYlowest_eightbit[context->outUCLYhndl]) { HTChunkPutUtf8Char(string, (0xf000 | (unsigned char)saved_char_in)); } else { @@ -2642,8 +2721,8 @@ top1: context->state = S_tag_gap; } else if (c == '\033') { /* - ** Setting up for possible single quotes in CJK escape - ** sequences. - Takuya ASADA (asada@three-a.co.jp) + ** Setting up for possible single quotes in CJK escape + ** sequences. - Takuya ASADA (asada@three-a.co.jp) */ context->state = S_esc_sq; HTChunkPutc(string, c); @@ -2652,11 +2731,13 @@ top1: HTChunkPuts(string, context->utf_buf); context->utf_buf_p = context->utf_buf; *(context->utf_buf_p) = '\0'; - } else if (HTCJK == NOCJK && (context->T.output_utf8 || - context->T.trans_from_uni)) { - if (clong == 0xfffd && saved_char_in && HTPassEightBitRaw && + } else if (HTCJK == NOCJK && + (context->T.output_utf8 || + context->T.trans_from_uni)) { + if (clong == 0xfffd && saved_char_in && + HTPassEightBitRaw && (unsigned char)saved_char_in >= - LYlowest_eightbit[context->html_char_set]) { + LYlowest_eightbit[context->outUCLYhndl]) { HTChunkPutUtf8Char(string, (0xf000 | (unsigned char)saved_char_in)); } else { @@ -2670,7 +2751,7 @@ top1: break; case S_dquoted: /* Quoted attribute value */ - if (c == '"' || /* Valid end of attribute value */ + if (c == '"' || /* Valid end of attribute value */ (soft_dquotes && /* If emulating old Netscape bug, treat '>' */ c == '>')) { /* as a co-terminator of dquoted and tag */ HTChunkTerminate(string) ; @@ -2678,11 +2759,11 @@ top1: string->size = 0; context->state = S_tag_gap; if (c == '>') /* We emulated the Netscape bug, so we go */ - goto top1; /* back and treat it as the tag terminator */ + goto top1; /* back and treat it as the tag terminator */ } else if (c == '\033') { /* - ** Setting up for possible double quotes in CJK escape - ** sequences. - Takuya ASADA (asada@three-a.co.jp) + ** Setting up for possible double quotes in CJK escape + ** sequences. - Takuya ASADA (asada@three-a.co.jp) */ context->state = S_esc_dq; HTChunkPutc(string, c); @@ -2691,11 +2772,13 @@ top1: HTChunkPuts(string, context->utf_buf); context->utf_buf_p = context->utf_buf; *(context->utf_buf_p) = '\0'; - } else if (HTCJK == NOCJK && (context->T.output_utf8 || - context->T.trans_from_uni)) { - if (clong == 0xfffd && saved_char_in && HTPassEightBitRaw && + } else if (HTCJK == NOCJK && + (context->T.output_utf8 || + context->T.trans_from_uni)) { + if (clong == 0xfffd && saved_char_in && + HTPassEightBitRaw && (unsigned char)saved_char_in >= - LYlowest_eightbit[context->html_char_set]) { + LYlowest_eightbit[context->outUCLYhndl]) { HTChunkPutUtf8Char(string, (0xf000 | (unsigned char)saved_char_in)); } else { @@ -2708,15 +2791,16 @@ top1: } break; - case S_end: /* </ */ - if (unsign_c < 127 && isalnum((unsigned char)c)) + case S_end: /* </ */ + if (unsign_c < 127 && isalnum((unsigned char)c)) { HTChunkPutc(string, c); - else { /* End of end tag name */ - HTTag * t=0; - HTChunkTerminate(string) ; - if (!*string->data) { /* Empty end tag */ + } else { /* End of end tag name */ + HTTag * t = 0; + + HTChunkTerminate(string); + if (!*string->data) { /* Empty end tag */ if (context->element_stack) - t = context->element_stack->tag; + t = context->element_stack->tag; } else { t = SGMLFindTag(dtd, string->data); } @@ -2725,7 +2809,7 @@ top1: fprintf(stderr, "Unknown end tag </%s>\n", string->data); } else { BOOL tag_OK = (c == '>' || WHITE(c)); - context->current_tag = t; + context->current_tag = t; #ifdef EXTENDED_HTMLDTD /* ** Just handle ALL end tags normally :-) - kw @@ -2747,11 +2831,11 @@ top1: !strcasecomp(string->data, "TBODY") || !strcasecomp(string->data, "COLGROUP"))) { /* - ** Don't treat these end tags as invalid, - ** nor act on them. - FM + ** Don't treat these end tags as invalid, + ** nor act on them. - FM */ if (TRACE) - fprintf(stderr, + fprintf(stderr, "SGML: `</%s%c' found! Ignoring it.\n", string->data, c); string->size = 0; @@ -2776,29 +2860,29 @@ top1: !strcasecomp(string->data, "TT") || !strcasecomp(string->data, "U"))) { /* - ** Handle end tags for container elements declared - ** as SGML_EMPTY to prevent "expected tag substitution" - ** but still processed via HTML_end_element() in HTML.c - ** with checks there to avoid throwing the HTML.c stack - ** out of whack (Ugh, what a hack! 8-). - FM + ** Handle end tags for container elements declared + ** as SGML_EMPTY to prevent "expected tag substitution" + ** but still processed via HTML_end_element() in HTML.c + ** with checks there to avoid throwing the HTML.c stack + ** out of whack (Ugh, what a hack! 8-). - FM */ if (context->inSELECT) { - /* + /* ** We are in a SELECT block. - FM */ if (strcasecomp(string->data, "FORM")) { /* - ** It is not at FORM end tag, so ignore it. - FM + ** It is not at FORM end tag, so ignore it. - FM */ if (TRACE) { fprintf(stderr, "SGML: Ignoring end tag </%s> in SELECT block.\n", - string->data); + string->data); } } else { /* - ** End the SELECT block and then - ** handle the FORM end tag. - FM + ** End the SELECT block and then + ** handle the FORM end tag. - FM */ if (TRACE) { fprintf(stderr, @@ -2806,14 +2890,14 @@ top1: string->data); } end_element(context, - SGMLFindTag(context->dtd, "SELECT")); + SGMLFindTag(context->dtd, "SELECT")); if (TRACE) { fprintf(stderr, "SGML: End </%s>\n", string->data); } (*context->actions->end_element) (context->target, - (context->current_tag - context->dtd->tags), + (context->current_tag - context->dtd->tags), (char **)&context->include); } } else if (!strcasecomp(string->data, "P")) { @@ -2855,7 +2939,7 @@ top1: break; } else { /* - ** Handle all other end tags normally. - FM + ** Handle all other end tags normally. - FM */ end_element( context, context->current_tag); } @@ -2868,13 +2952,13 @@ top1: fprintf(stderr,"SGML: `</%s%c' found!\n", string->data, c); context->state = S_junk_tag; } else { - context->state = S_text; + context->state = S_text; } } break; - case S_esc: /* Expecting '$'or '(' following CJK ESC. */ + case S_esc: /* Expecting '$'or '(' following CJK ESC. */ if (c == '$') { context->state = S_dollar; } else if (c == '(') { @@ -3022,10 +3106,10 @@ top1: } /* switch on context->state */ /* - ** Check whether we've added anything to the recover buffer. - FM + ** Check whether we've added anything to the recover buffer. - FM */ if (context->recover != NULL) { - if (context->recover[context->recover_index] == '\0') { + if (context->recover[context->recover_index] == '\0') { FREE(context->recover); context->recover_index = 0; } else { @@ -3036,11 +3120,11 @@ top1: } /* - ** Check whether an external function has added - ** anything to the include buffer. - FM + ** Check whether an external function has added + ** anything to the include buffer. - FM */ if (context->include != NULL) { - if (context->include[context->include_index] == '\0') { + if (context->include[context->include_index] == '\0') { FREE(context->include); context->include_index = 0; } else { @@ -3051,11 +3135,11 @@ top1: } /* - ** Check whether an external function has added - ** anything to the csi buffer. - FM + ** Check whether an external function has added + ** anything to the csi buffer. - FM */ if (context->csi != NULL) { - if (context->csi[context->csi_index] == '\0') { + if (context->csi[context->csi_index] == '\0') { FREE(context->csi); context->csi_index = 0; } else { @@ -3073,7 +3157,7 @@ PRIVATE void SGML_string ARGS2( { CONST char *p; for (p = str; *p; p++) - SGML_character(context, *p); + SGML_character(context, *p); } @@ -3085,7 +3169,7 @@ PRIVATE void SGML_write ARGS3( CONST char *p; CONST char *e = str+l; for (p = str; p < e; p++) - SGML_character(context, *p); + SGML_character(context, *p); } /*_______________________________________________________________________ @@ -3109,35 +3193,35 @@ PUBLIC CONST HTStreamClass SGMLParser = ** ** On entry, ** dtd represents the DTD, along with -** actions is the sink for the data as a set of routines. +** actions is the sink for the data as a set of routines. ** */ PUBLIC HTStream* SGML_new ARGS3( CONST SGML_dtd *, dtd, HTParentAnchor *, anchor, - HTStructured *, target) + HTStructured *, target) { int i; HTStream* context = (HTStream *) malloc(sizeof(*context)); if (!context) - outofmem(__FILE__, "SGML_begin"); + outofmem(__FILE__, "SGML_begin"); context->isa = &SGMLParser; context->string = HTChunkCreate(128); /* Grow by this much */ context->dtd = dtd; context->target = target; context->actions = (HTStructuredClass*)(((HTStream*)target)->isa); - /* Ugh: no OO */ + /* Ugh: no OO */ context->unknown_tag = &HTTag_unrecognized; context->state = S_text; - context->element_stack = 0; /* empty */ + context->element_stack = 0; /* empty */ context->inSELECT = FALSE; #ifdef CALLERDATA context->callerData = (void*) callerData; #endif /* CALLERDATA */ for (i = 0; i < MAX_ATTRIBUTES; i++) - context->value[i] = 0; + context->value[i] = 0; context->lead_exclamation = FALSE; context->first_dash = FALSE; @@ -3147,21 +3231,24 @@ PUBLIC HTStream* SGML_new ARGS3( context->second_bracket = FALSE; context->isHex = FALSE; - context->node_anchor = anchor; /*only for chartrans info. could be NULL? */ - + context->node_anchor = anchor; /* Could be NULL? */ context->utf_count = 0; context->utf_char = 0; context->utf_buf[0] = context->utf_buf[6] = '\0'; context->utf_buf_p = context->utf_buf; - UCTransParams_clear(&context->T); - context->in_char_set = HTAnchor_getUCLYhndl(anchor, UCT_STAGE_PARSER); - if (context->in_char_set < 0) { + context->inUCLYhndl = HTAnchor_getUCLYhndl(anchor, + UCT_STAGE_PARSER); + if (context->inUCLYhndl < 0) { HTAnchor_copyUCInfoStage(anchor, - UCT_STAGE_PARSER, UCT_STAGE_MIME, -1); - context->in_char_set = HTAnchor_getUCLYhndl(anchor, UCT_STAGE_PARSER); + UCT_STAGE_PARSER, + UCT_STAGE_MIME, + -1); + context->inUCLYhndl = HTAnchor_getUCLYhndl(anchor, + UCT_STAGE_PARSER); } - context->UCI=HTAnchor_getUCInfoStage(anchor, UCT_STAGE_PARSER); + context->inUCI = HTAnchor_getUCInfoStage(anchor, + UCT_STAGE_PARSER); set_chartrans_handling(context, anchor, -1); context->recover = NULL; @@ -3196,7 +3283,7 @@ WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. ///////////////////////////////////////////////////////////////////////// Content-Type: program/C; charset=US-ASCII Program: SJIS.c -Author: Yutaka Sato <ysato@etl.go.jp> +Author: Yutaka Sato <ysato@etl.go.jp> Description: History: 930923 extracted from codeconv.c of cosmos @@ -3206,8 +3293,8 @@ History: PUBLIC int TREAT_SJIS = 1; PUBLIC void JISx0201TO0208_EUC ARGS4( - register unsigned char, IHI, - register unsigned char, ILO, + register unsigned char, IHI, + register unsigned char, ILO, register unsigned char *, OHI, register unsigned char *, OLO) { @@ -3237,8 +3324,8 @@ PUBLIC void JISx0201TO0208_EUC ARGS4( } PUBLIC unsigned char * SJIS_TO_JIS1 ARGS3( - register unsigned char, HI, - register unsigned char, LO, + register unsigned char, HI, + register unsigned char, LO, register unsigned char *, JCODE) { HI -= (HI <= 0x9F) ? 0x71 : 0xB1; @@ -3249,7 +3336,7 @@ PUBLIC unsigned char * SJIS_TO_JIS1 ARGS3( LO -= 0x7D; HI++; } else { - LO -= 0x1F; + LO -= 0x1F; } JCODE[0] = HI; JCODE[1] = LO; @@ -3257,8 +3344,8 @@ PUBLIC unsigned char * SJIS_TO_JIS1 ARGS3( } PUBLIC unsigned char * JIS_TO_SJIS1 ARGS3( - register unsigned char, HI, - register unsigned char, LO, + register unsigned char, HI, + register unsigned char, LO, register unsigned char *, SJCODE) { if (HI & 1) @@ -3287,7 +3374,7 @@ PUBLIC unsigned char * EUC_TO_SJIS1 ARGS3( } PUBLIC void JISx0201TO0208_SJIS ARGS3( - register unsigned char, I, + register unsigned char, I, register unsigned char *, OHI, register unsigned char *, OLO) { @@ -3346,7 +3433,7 @@ PUBLIC unsigned char * EUC_TO_SJIS ARGS2( dp += 2; sp += 2; } else { - sp++; + sp++; } } else { *dp++ = *sp++; @@ -3398,7 +3485,7 @@ PUBLIC unsigned char * EUC_TO_JIS ARGS4( } if (dp) - *dp = 0; + *dp = 0; return dst; } @@ -3407,7 +3494,7 @@ PUBLIC unsigned char * TO_EUC ARGS2( unsigned char *, euc) { register unsigned char *s, *d, c, jis_stat; - register to1B, to2B; + register int to1B, to2B; register int in_sjis = 0; s = jis; @@ -3447,7 +3534,7 @@ PUBLIC unsigned char * TO_EUC ARGS2( if (jis_stat && (0x20 < c)) { *d++ = jis_stat | c; } else { - *d++ = c; + *d++ = c; } } } diff --git a/WWW/Library/Implementation/UCDefs.h b/WWW/Library/Implementation/UCDefs.h index 876fc075..ac2dc3bc 100644 --- a/WWW/Library/Implementation/UCDefs.h +++ b/WWW/Library/Implementation/UCDefs.h @@ -1,4 +1,4 @@ -/* Definitions for EXP_CHARTRANS */ +/* Definitions for Unicode character-translations */ #ifndef UCDEFS_H #define UCDEFS_H @@ -53,7 +53,6 @@ typedef struct _LYUCcharset { #define UCT_R_ASCII UCT_R_7BITINV | UCT_R_7BITNAT /*displayable US-ASCII*/ #define UCT_R_LAT1 UCT_R_ASCII | UCT_R_8859SPECL | UCT_R_HIGH8BIT -#define UCT_R_8859S UCT_R_ASCII | UCT_R_8859SPECL #define UCT_R_8BIT UCT_R_LAT1 | UCT_R_HIGHCTRL /* full 8bit range */ /* diff --git a/WWW/Library/djgpp/makefile b/WWW/Library/djgpp/makefile index 103b4c04..d7272e45 100644 --- a/WWW/Library/djgpp/makefile +++ b/WWW/Library/djgpp/makefile @@ -7,7 +7,7 @@ WWW_MACH = djgpp # The ASIS repository's name for the machine we are on #ASIS_MACH = hardware/os -CFLAGS = -O3 -DUSE_ZLIB -DEXP_CHARTRANS -DDOSPATH -DNOUSERS -DDEBUG -I../../../djgpp/tcplib/include -I../../../djgpp/tcplib/include/tcp \ +CFLAGS = -O3 -DUSE_ZLIB -DDOSPATH -DNOUSERS -DDEBUG -I../../../djgpp/tcplib/include -I../../../djgpp/tcplib/include/tcp \ -I../../../src -I../../.. LFLAGS = CC = gcc diff --git a/WWW/Library/unix/Makefile b/WWW/Library/unix/Makefile new file mode 100644 index 00000000..5fea7dd7 --- /dev/null +++ b/WWW/Library/unix/Makefile @@ -0,0 +1,30 @@ +# Make WWW under unix for a.n.other unix system (bsd) +# Use this as a template + +# For W3 distribution, machine type for subdirectories +WWW_MACH = unix + +# The ASIS repository's name for the machine we are on +ASIS_MACH = hardware/os + + +CFLAGS = -g -DDEBUG +LFLAGS = +CC = cc + +# Directory for installed binary: +BINDIR = /usr/local/bin + +# Where is the W3 object library to be installed (not normally done)? +LIBDIR = $(WWW)/Library/Implementation/$(WWW_MACH) + +#_________________ OK if normal W3 distribution +# Where is the WWW source root? +WWW = ../.. + +# Where should temporary (object) files go? +WTMP = ../.. + + +include $(WWW)/Library/Implementation/Version.make +include $(WWW)/Library/Implementation/CommonMakefile |