diff options
Diffstat (limited to 'WWW/Library/Implementation')
59 files changed, 2322 insertions, 2039 deletions
diff --git a/WWW/Library/Implementation/HTAABrow.c b/WWW/Library/Implementation/HTAABrow.c index 1f39a2ac..73853301 100644 --- a/WWW/Library/Implementation/HTAABrow.c +++ b/WWW/Library/Implementation/HTAABrow.c @@ -88,7 +88,7 @@ typedef struct { */ typedef struct { HTAAServer *server; /* Which server serves this tree */ - char *template; /* Template for this tree */ + char *ctemplate; /* Template for this tree */ HTList *valid_schemes; /* Valid authentic.schemes */ HTAssocList **scheme_specifics; /* Scheme specific params */ BOOL retry; /* Failed last time -- reprompt (or whatever) */ @@ -340,15 +340,15 @@ static HTAASetup *HTAASetup_lookup(const char *hostname, hostname, portnumber, docname)); while (NULL != (setup = (HTAASetup *) HTList_nextObject(cur))) { - if (HTAA_templateMatch(setup->template, docname)) { + if (HTAA_templateMatch(setup->ctemplate, docname)) { CTRACE((tfp, "%s `%s' %s `%s'\n", "HTAASetup_lookup:", docname, - "matched template", setup->template)); + "matched template", setup->ctemplate)); return setup; } else { CTRACE((tfp, "%s `%s' %s `%s'\n", "HTAASetup_lookup:", docname, - "did NOT match template", setup->template)); + "did NOT match template", setup->ctemplate)); } } /* while setups remain */ } @@ -366,7 +366,7 @@ static HTAASetup *HTAASetup_lookup(const char *hostname, * ON ENTRY: * server is a pointer to a HTAAServer structure * to which this setup belongs. - * template documents matching this template + * ctemplate documents matching this template * are protected according to this setup. * valid_schemes a list containing all valid authentication * schemes for this setup. @@ -380,13 +380,13 @@ static HTAASetup *HTAASetup_lookup(const char *hostname, * returns a new HTAASetup node, and also adds it as * part of the HTAAServer given as parameter. */ -static HTAASetup *HTAASetup_new(HTAAServer *server, char *template, +static HTAASetup *HTAASetup_new(HTAAServer *server, char *ctemplate, HTList *valid_schemes, HTAssocList **scheme_specifics) { HTAASetup *setup; - if (!server || isEmpty(template)) + if (!server || isEmpty(ctemplate)) return NULL; if ((setup = typecalloc(HTAASetup)) == 0) @@ -394,9 +394,9 @@ static HTAASetup *HTAASetup_new(HTAAServer *server, char *template, setup->retry = NO; setup->server = server; - setup->template = NULL; - if (template) - StrAllocCopy(setup->template, template); + setup->ctemplate = NULL; + if (ctemplate) + StrAllocCopy(setup->ctemplate, ctemplate); setup->valid_schemes = valid_schemes; setup->scheme_specifics = scheme_specifics; @@ -418,7 +418,7 @@ static void HTAASetup_delete(HTAASetup * killme) int scheme; if (killme) { - FREE(killme->template); + FREE(killme->ctemplate); if (killme->valid_schemes) { HTList_delete(killme->valid_schemes); killme->valid_schemes = NULL; @@ -598,8 +598,8 @@ static char *compose_auth_string(HTAAScheme scheme, HTAASetup * setup, BOOL IsPr * absolute URL instead of a path. If we do get a host from this, it * will include the port. - FM */ - if ((!IsProxy) && using_proxy && setup->template) { - proxiedHost = HTParse(setup->template, "", PARSE_HOST); + if ((!IsProxy) && using_proxy && setup->ctemplate) { + proxiedHost = HTParse(setup->ctemplate, "", PARSE_HOST); if (proxiedHost && *proxiedHost != '\0') { theHost = proxiedHost; } @@ -733,12 +733,12 @@ static char *compose_auth_string(HTAAScheme scheme, HTAASetup * setup, BOOL IsPr */ static HTAAScheme HTAA_selectScheme(HTAASetup * setup) { - HTAAScheme scheme; + int scheme; if (setup && setup->valid_schemes) { for (scheme = HTAA_BASIC; scheme < HTAA_MAX_SCHEMES; scheme++) if (-1 < HTList_indexOf(setup->valid_schemes, (void *) scheme)) - return scheme; + return (HTAAScheme) scheme; } return HTAA_BASIC; } @@ -1039,7 +1039,7 @@ BOOL HTAA_shouldRetryWithAuth(char *start_of_headers, int num_schemes = 0; HTList *valid_schemes = HTList_new(); HTAssocList **scheme_specifics = NULL; - char *template = NULL; + char *ctemplate = NULL; char *temp = NULL; /* @@ -1074,10 +1074,10 @@ BOOL HTAA_shouldRetryWithAuth(char *start_of_headers, 0 == strcasecomp(fieldname, "WWW-Authenticate:"))) { if (!(arg1 && *arg1 && args && *args)) { HTSprintf0(&temp, gettext("Invalid header '%s%s%s%s%s'"), line, - ((arg1 && *arg1) ? " " : ""), - ((arg1 && *arg1) ? arg1 : ""), - ((args && *args) ? " " : ""), - ((args && *args) ? args : "")); + (!isEmpty(arg1) ? " " : ""), + (!isEmpty(arg1) ? arg1 : ""), + (!isEmpty(args) ? " " : ""), + (!isEmpty(args) ? args : "")); HTAlert(temp); FREE(temp); } else if (HTAA_UNKNOWN != (scheme = HTAAScheme_enum(arg1))) { @@ -1107,7 +1107,7 @@ BOOL HTAA_shouldRetryWithAuth(char *start_of_headers, else if (!IsProxy && 0 == strcasecomp(fieldname, "WWW-Protection-Template:")) { CTRACE((tfp, "Protection template set to `%s'\n", arg1)); - StrAllocCopy(template, arg1); + StrAllocCopy(ctemplate, arg1); } } else { @@ -1167,13 +1167,13 @@ BOOL HTAA_shouldRetryWithAuth(char *start_of_headers, proxy_portnumber, IsProxy); } - if (!template) /* Proxy matches everything -AJL */ - StrAllocCopy(template, "*"); + if (!ctemplate) /* Proxy matches everything -AJL */ + StrAllocCopy(ctemplate, "*"); proxy_setup = HTAASetup_new(server, - template, + ctemplate, valid_schemes, scheme_specifics); - FREE(template); + FREE(ctemplate); HTAlert(gettext("Proxy authorization required -- retrying")); return YES; @@ -1225,13 +1225,13 @@ BOOL HTAA_shouldRetryWithAuth(char *start_of_headers, current_portnumber, IsProxy); } - if (!template) - template = HTAA_makeProtectionTemplate(current_docname); + if (!ctemplate) + ctemplate = HTAA_makeProtectionTemplate(current_docname); current_setup = HTAASetup_new(server, - template, + ctemplate, valid_schemes, scheme_specifics); - FREE(template); + FREE(ctemplate); HTAlert(gettext("Access without authorization denied -- retrying")); return YES; diff --git a/WWW/Library/Implementation/HTAABrow.h b/WWW/Library/Implementation/HTAABrow.h index f7570ae3..774a1f73 100644 --- a/WWW/Library/Implementation/HTAABrow.h +++ b/WWW/Library/Implementation/HTAABrow.h @@ -33,6 +33,9 @@ #include <HTAAUtil.h> /* Common parts of AA */ +#ifdef __cplusplus +extern "C" { +#endif /* Routines for Browser Side Recording of AA Info @@ -49,30 +52,27 @@ Routines for Browser Side Recording of AA Info HTAA_shouldRetryWithAuth() determines whether to retry the request with AA or with a new AA (in case username or password was misspelled). - */ - -/* PUBLIC HTAA_composeAuth() - * - * COMPOSE THE ENTIRE AUTHORIZATION HEADER LINE IF WE - * ALREADY KNOW, THAT THE HOST MIGHT REQUIRE AUTHORIZATION - * - * ON ENTRY: - * hostname is the hostname of the server. - * portnumber is the portnumber in which the server runs. - * docname is the pathname of the document (as in URL) - * - * ON EXIT: - * returns NULL, if no authorization seems to be needed, or - * if it is the entire Authorization: line, e.g. - * - * "Authorization: basic username:password" - * - * As usual, this string is automatically freed. - */ -extern char *HTAA_composeAuth(const char *hostname, - const int portnumber, - const char *docname, - BOOL IsProxy); + *//* PUBLIC HTAA_composeAuth() + * + * COMPOSE THE ENTIRE AUTHORIZATION HEADER LINE IF WE + * ALREADY KNOW, THAT THE HOST MIGHT REQUIRE AUTHORIZATION + * + * ON ENTRY: + * hostname is the hostname of the server. + * portnumber is the portnumber in which the server runs. + * docname is the pathname of the document (as in URL) + * + * ON EXIT: + * returns NULL, if no authorization seems to be needed, or + * if it is the entire Authorization: line, e.g. + * + * "Authorization: basic username:password" + * + * As usual, this string is automatically freed. + */ extern char *HTAA_composeAuth(const char *hostname, + const int portnumber, + const char *docname, + BOOL IsProxy); /* BROWSER PUBLIC HTAA_shouldRetryWithAuth() * @@ -101,16 +101,16 @@ extern char *HTAA_composeAuth(const char *hostname, * field (in function HTAA_composeAuth()). * NO, otherwise. */ -extern BOOL HTAA_shouldRetryWithAuth(char *start_of_headers, - int length, - int soc, - BOOL IsProxy); + extern BOOL HTAA_shouldRetryWithAuth(char *start_of_headers, + int length, + int soc, + BOOL IsProxy); /* * Function to allow clearing of all Authorization info * via a browser command. - FM */ -extern void HTClearHTTPAuthInfo(void); + extern void HTClearHTTPAuthInfo(void); /* @@ -123,8 +123,11 @@ Enabling Gateway httpds to Forward Authorization */ -extern void HTAAForwardAuth_set(const char *scheme_name, - const char *scheme_specifics); -extern void HTAAForwardAuth_reset(void); + extern void HTAAForwardAuth_set(const char *scheme_name, + const char *scheme_specifics); + extern void HTAAForwardAuth_reset(void); -#endif /* NOT HTAABROW_H */ +#ifdef __cplusplus +} +#endif +#endif /* NOT HTAABROW_H */ diff --git a/WWW/Library/Implementation/HTAAProt.c b/WWW/Library/Implementation/HTAAProt.c index f4bc2e87..9e8a06d5 100644 --- a/WWW/Library/Implementation/HTAAProt.c +++ b/WWW/Library/Implementation/HTAAProt.c @@ -382,7 +382,7 @@ static HTAAProt *HTAAProt_new(const char *cur_docname, if ((prot = typecalloc(HTAAProt)) == 0) outofmem(__FILE__, "HTAAProt_new"); - prot->template = NULL; + prot->ctemplate = NULL; prot->filename = NULL; prot->uid_name = NULL; prot->gid_name = NULL; diff --git a/WWW/Library/Implementation/HTAAProt.h b/WWW/Library/Implementation/HTAAProt.h index 4bdd1964..8595ca66 100644 --- a/WWW/Library/Implementation/HTAAProt.h +++ b/WWW/Library/Implementation/HTAAProt.h @@ -8,22 +8,23 @@ #include <HTGroup.h> #include <HTAssoc.h> +#ifdef __cplusplus +extern "C" { +#endif /* Server's Representation of Document (Tree) Protections - */ - -typedef struct { - char *template; /* Template for this protection */ - char *filename; /* Current document file */ - char *uid_name; /* Effective uid (name of it) */ - char *gid_name; /* Effective gid (name of it) */ - GroupDef *mask_group; /* Allowed users and IP addresses */ - HTList *valid_schemes; /* Valid authentication schemes */ - HTAssocList *values; /* Association list for scheme specific */ - /* parameters. */ -} HTAAProt; + */ typedef struct { + char *ctemplate; /* Template for this protection */ + char *filename; /* Current document file */ + char *uid_name; /* Effective uid (name of it) */ + char *gid_name; /* Effective gid (name of it) */ + GroupDef *mask_group; /* Allowed users and IP addresses */ + HTList *valid_schemes; /* Valid authentication schemes */ + HTAssocList *values; /* Association list for scheme specific */ + /* parameters. */ + } HTAAProt; /* @@ -60,9 +61,9 @@ Callbacks for rule system * returns nothing. * Sets the module-wide variable default_prot. */ -extern void HTAA_setDefaultProtection(const char *cur_docname, - const char *prot_filename, - const char *eff_ids); + extern void HTAA_setDefaultProtection(const char *cur_docname, + const char *prot_filename, + const char *eff_ids); /* PUBLIC HTAA_setCurrentProtection() * SET THE CURRENT PROTECTION MODE @@ -83,9 +84,9 @@ extern void HTAA_setDefaultProtection(const char *cur_docname, * returns nothing. * Sets the module-wide variable current_prot. */ -extern void HTAA_setCurrentProtection(const char *cur_docname, - const char *prot_filename, - const char *eff_ids); + extern void HTAA_setCurrentProtection(const char *cur_docname, + const char *prot_filename, + const char *eff_ids); /* SERVER INTERNAL HTAA_clearProtections() * CLEAR DOCUMENT PROTECTION MODE @@ -98,7 +99,7 @@ extern void HTAA_setCurrentProtection(const char *cur_docname, * returns nothing. * Frees the memory used by protection information. */ -extern void HTAA_clearProtections(void); + extern void HTAA_clearProtections(void); /* @@ -127,7 +128,7 @@ Getting Protection Settings * protection setup of the HTTranslate()'d file. * This must not be free()'d. */ -extern HTAAProt *HTAA_getCurrentProtection(void); + extern HTAAProt *HTAA_getCurrentProtection(void); /* PUBLIC HTAA_getDefaultProtection() * GET DEFAULT PROTECTION SETUP STRUCTURE @@ -147,7 +148,7 @@ extern HTAAProt *HTAA_getCurrentProtection(void); * protection settings). * This must not be free()'d. */ -extern HTAAProt *HTAA_getDefaultProtection(void); + extern HTAAProt *HTAA_getDefaultProtection(void); /* @@ -165,7 +166,7 @@ Get User and Group IDs to Which Set to * returns the uid number to give to setuid() system call. * Default is 65534 (nobody). */ -extern int HTAA_getUid(void); + extern int HTAA_getUid(void); /* PUBLIC HTAA_getGid() * GET THE GROUP ID TO CHANGE THE PROCESS GID TO @@ -176,8 +177,8 @@ extern int HTAA_getUid(void); * returns the uid number to give to setgid() system call. * Default is 65534 (nogroup). */ -extern int HTAA_getGid(void); -#endif /* not VMS */ + extern int HTAA_getGid(void); +#endif /* not VMS */ /* For VMS: @@ -194,7 +195,7 @@ extern int HTAA_getGid(void); * returns the user name * Default is "" (nobody). */ -extern const char *HTAA_getUidName(void); + extern const char *HTAA_getUidName(void); /* PUBLIC HTAA_getFileName * GET THE FILENAME (VMS ONLY) @@ -204,8 +205,8 @@ extern const char *HTAA_getUidName(void); * ON EXIT: * returns the filename */ -extern const char *HTAA_getFileName(void); -#endif /* VMS */ + extern const char *HTAA_getFileName(void); +#endif /* VMS */ /* PUBLIC HTAA_UidToName * GET THE USER NAME @@ -215,7 +216,7 @@ extern const char *HTAA_getFileName(void); * ON EXIT: * returns the user name */ -extern const char *HTAA_UidToName(int uid); + extern const char *HTAA_UidToName(int uid); /* PUBLIC HTAA_NameToUid * GET THE USER ID @@ -225,7 +226,7 @@ extern const char *HTAA_UidToName(int uid); * ON EXIT: * returns the user id */ -extern int HTAA_NameToUid(const char *name); + extern int HTAA_NameToUid(const char *name); /* PUBLIC HTAA_GidToName * GET THE GROUP NAME @@ -235,7 +236,7 @@ extern int HTAA_NameToUid(const char *name); * ON EXIT: * returns the group name */ -extern const char *HTAA_GidToName(int gid); + extern const char *HTAA_GidToName(int gid); /* PUBLIC HTAA_NameToGid * GET THE GROUP ID @@ -245,6 +246,9 @@ extern const char *HTAA_GidToName(int gid); * ON EXIT: * returns the group id */ -extern int HTAA_NameToGid(const char *name); + extern int HTAA_NameToGid(const char *name); -#endif /* not HTAAPROT_H */ +#ifdef __cplusplus +} +#endif +#endif /* not HTAAPROT_H */ diff --git a/WWW/Library/Implementation/HTAAUtil.c b/WWW/Library/Implementation/HTAAUtil.c index a5651d16..6270338a 100644 --- a/WWW/Library/Implementation/HTAAUtil.c +++ b/WWW/Library/Implementation/HTAAUtil.c @@ -205,7 +205,7 @@ BOOL HTAAMethod_inList(HTAAMethod method, HTList *list) * sometimes so hard...) * * ON ENTRY: - * template is a template string to match the file name + * ctemplate is a template string to match the file name * against, may contain a single wildcard * character * which matches zero or more * arbitrary characters. @@ -216,10 +216,10 @@ BOOL HTAAMethod_inList(HTAAMethod method, HTList *list) * returns YES, if filename matches the template. * NO, otherwise. */ -BOOL HTAA_templateMatch(const char *template, +BOOL HTAA_templateMatch(const char *ctemplate, const char *filename) { - const char *p = template; + const char *p = ctemplate; const char *q = filename; int m; @@ -266,10 +266,10 @@ BOOL HTAA_templateMatch(const char *template, * returns YES, if filename matches the template. * NO, otherwise. */ -BOOL HTAA_templateCaseMatch(const char *template, +BOOL HTAA_templateCaseMatch(const char *ctemplate, const char *filename) { - const char *p = template; + const char *p = ctemplate; const char *q = filename; int m; @@ -315,25 +315,25 @@ BOOL HTAA_templateCaseMatch(const char *template, */ char *HTAA_makeProtectionTemplate(const char *docname) { - char *template = NULL; + char *ctemplate = NULL; char *slash = NULL; if (docname) { - StrAllocCopy(template, docname); - slash = strrchr(template, '/'); + StrAllocCopy(ctemplate, docname); + slash = strrchr(ctemplate, '/'); if (slash) slash++; else - slash = template; + slash = ctemplate; *slash = '\0'; - StrAllocCat(template, "*"); + StrAllocCat(ctemplate, "*"); } else - StrAllocCopy(template, "*"); + StrAllocCopy(ctemplate, "*"); CTRACE((tfp, "make_template: made template `%s' for file `%s'\n", - template, docname)); + ctemplate, docname)); - return template; + return ctemplate; } /* diff --git a/WWW/Library/Implementation/HTAAUtil.h b/WWW/Library/Implementation/HTAAUtil.h index 488b9859..e5044498 100644 --- a/WWW/Library/Implementation/HTAAUtil.h +++ b/WWW/Library/Implementation/HTAAUtil.h @@ -32,38 +32,37 @@ #include <HTList.h> +#ifdef __cplusplus +extern "C" { +#endif /* * Numeric constants */ #define MAX_USERNAME_LEN 16 /* @@ Longest allowed username */ #define MAX_PASSWORD_LEN 3*13 /* @@ Longest allowed password */ - /* (encrypted, so really only 3*8) */ + /* (encrypted, so really only 3*8) */ #define MAX_METHODNAME_LEN 12 /* @@ Longest allowed method name */ #define MAX_FIELDNAME_LEN 16 /* @@ Longest field name in */ - /* protection setup file */ + /* protection setup file */ #define MAX_PATHNAME_LEN 80 /* @@ Longest passwd/group file */ - /* pathname to allow */ +/* pathname to allow *//* -/* - -Datatype definitions + Datatype definitions - HTAASCHEME + HTAASCHEME The enumeration HTAAScheme represents the possible authentication schemes used by the WWW Access Authorization. - */ - -typedef enum { - HTAA_UNKNOWN, - HTAA_NONE, - HTAA_BASIC, - HTAA_PUBKEY, - HTAA_KERBEROS_V4, - HTAA_KERBEROS_V5, - HTAA_MAX_SCHEMES /* THIS MUST ALWAYS BE LAST! Number of schemes */ -} HTAAScheme; + */ typedef enum { + HTAA_UNKNOWN, + HTAA_NONE, + HTAA_BASIC, + HTAA_PUBKEY, + HTAA_KERBEROS_V4, + HTAA_KERBEROS_V5, + HTAA_MAX_SCHEMES /* THIS MUST ALWAYS BE LAST! Number of schemes */ + } HTAAScheme; /* @@ -71,11 +70,11 @@ typedef enum { */ -typedef enum { - METHOD_UNKNOWN, - METHOD_GET, - METHOD_PUT -} HTAAMethod; + typedef enum { + METHOD_UNKNOWN, + METHOD_GET, + METHOD_PUT + } HTAAMethod; /* @@ -91,7 +90,7 @@ Authentication Schemes * ON EXIT: * returns the enumerated constant for that scheme. */ -extern HTAAScheme HTAAScheme_enum(const char *name); + extern HTAAScheme HTAAScheme_enum(const char *name); /* PUBLIC HTAAScheme_name() * GET THE NAME OF A GIVEN SCHEME @@ -103,7 +102,7 @@ extern HTAAScheme HTAAScheme_enum(const char *name); * returns the name of the scheme, i.e. * "none", "basic", "pubkey", ... */ -extern const char *HTAAScheme_name(HTAAScheme scheme); + extern const char *HTAAScheme_name(HTAAScheme scheme); /* @@ -120,7 +119,7 @@ Methods * returns HTAAMethod enumerated value corresponding * to the given name. */ -extern HTAAMethod HTAAMethod_enum(const char *name); + extern HTAAMethod HTAAMethod_enum(const char *name); /* PUBLIC HTAAMethod_name() * GET THE NAME OF A GIVEN METHOD @@ -132,7 +131,7 @@ extern HTAAMethod HTAAMethod_enum(const char *name); * returns the name of the scheme, i.e. * "GET", "PUT", ... */ -extern const char *HTAAMethod_name(HTAAMethod method); + extern const char *HTAAMethod_name(HTAAMethod method); /* PUBLIC HTAAMethod_inList() * IS A METHOD IN A LIST OF METHOD NAMES @@ -144,7 +143,7 @@ extern const char *HTAAMethod_name(HTAAMethod method); * returns YES, if method was found. * NO, if not found. */ -extern BOOL HTAAMethod_inList(HTAAMethod method, HTList *list); + extern BOOL HTAAMethod_inList(HTAAMethod method, HTList *list); /* @@ -163,7 +162,7 @@ Match Template Against Filename * sometimes so hard...) * * ON ENTRY: - * template is a template string to match the file name + * ctemplate is a template string to match the file name * against, may contain a single wildcard * character * which matches zero or more * arbitrary characters. @@ -174,8 +173,8 @@ Match Template Against Filename * returns YES, if filename matches the template. * NO, otherwise. */ -extern BOOL HTAA_templateMatch(const char *template, - const char *filename); + extern BOOL HTAA_templateMatch(const char *ctemplate, + const char *filename); /* PUBLIC HTAA_templateCaseMatch() * STRING COMPARISON FUNCTION FOR FILE NAMES @@ -188,7 +187,7 @@ extern BOOL HTAA_templateMatch(const char *template, * change the HTAA_templateMatch routine for VMS. * * ON ENTRY: - * template is a template string to match the file name + * ctemplate is a template string to match the file name * against, may contain a single wildcard * character * which matches zero or more * arbitrary characters. @@ -199,8 +198,8 @@ extern BOOL HTAA_templateMatch(const char *template, * returns YES, if filename matches the template. * NO, otherwise. */ -extern BOOL HTAA_templateCaseMatch(const char *template, - const char *filename); + extern BOOL HTAA_templateCaseMatch(const char *ctemplate, + const char *filename); /* PUBLIC HTAA_makeProtectionTemplate() * CREATE A PROTECTION TEMPLATE FOR THE FILES @@ -221,7 +220,7 @@ extern BOOL HTAA_templateCaseMatch(const char *template, * being a comment marker here, * there really isn't any space. */ -extern char *HTAA_makeProtectionTemplate(const char *docname); + extern char *HTAA_makeProtectionTemplate(const char *docname); /* @@ -255,7 +254,7 @@ MIME Argument List Parser * the number of order number of that item. E.g. * "1" for the first, etc. */ -extern HTList *HTAA_parseArgList(char *str); + extern HTList *HTAA_parseArgList(char *str); /* @@ -282,9 +281,9 @@ Header Line Reader * will use this buffer first and then * proceed to read from socket. */ -extern void HTAA_setupReader(char *start_of_headers, - int length, - int soc); + extern void HTAA_setupReader(char *start_of_headers, + int length, + int soc); /* PUBLIC HTAA_getUnfoldedLine() * READ AN UNFOLDED HEADER LINE FROM SOCKET @@ -307,6 +306,9 @@ extern void HTAA_setupReader(char *start_of_headers, * Field-Name: Blaa-Blaa This-Is-A-Continuation-Line Here-Is_Another * */ -extern char *HTAA_getUnfoldedLine(void); + extern char *HTAA_getUnfoldedLine(void); -#endif /* NOT HTAAUTIL_H */ +#ifdef __cplusplus +} +#endif +#endif /* NOT HTAAUTIL_H */ diff --git a/WWW/Library/Implementation/HTAccess.h b/WWW/Library/Implementation/HTAccess.h index b3cff533..81e8f3c7 100644 --- a/WWW/Library/Implementation/HTAccess.h +++ b/WWW/Library/Implementation/HTAccess.h @@ -11,15 +11,18 @@ #ifndef HTACCESS_H #define HTACCESS_H -extern char *use_this_url_instead; - -extern int redirection_attempts; - /* Definition uses: */ #include <HTAnchor.h> #include <HTFormat.h> +#ifdef __cplusplus +extern "C" { +#endif + extern char *use_this_url_instead; + + extern int redirection_attempts; + /* Return codes from load routines: * * These codes may be returned by the protocol modules, @@ -71,14 +74,14 @@ Flags which may be set to control this module */ #ifdef NOT -extern int HTDiag; /* Flag: load source as plain text */ -#endif /* NOT */ -extern char *HTClientHost; /* Name or number of telnetting host */ -extern FILE *HTlogfile; /* File to output one-liners to */ -extern BOOL HTSecure; /* Disable security holes? */ -extern BOOL HTPermitRedir; /* Special flag for getfile() */ -extern HTStream *HTOutputStream; /* For non-interactive, set this */ -extern HTFormat HTOutputFormat; /* To convert on load, set this */ + extern int HTDiag; /* Flag: load source as plain text */ +#endif /* NOT */ + extern char *HTClientHost; /* Name or number of telnetting host */ + extern FILE *HTlogfile; /* File to output one-liners to */ + extern BOOL HTSecure; /* Disable security holes? */ + extern BOOL HTPermitRedir; /* Special flag for getfile() */ + extern HTStream *HTOutputStream; /* For non-interactive, set this */ + extern HTFormat HTOutputFormat; /* To convert on load, set this */ /* Check for proxy override. override_proxy() * @@ -95,7 +98,7 @@ extern HTFormat HTOutputFormat; /* To convert on load, set this */ * Use "*" to override all proxy service: * no_proxy="*" */ -extern BOOL override_proxy(const char *addr); + extern BOOL override_proxy(const char *addr); /* @@ -110,8 +113,8 @@ Load a document from relative name NO Failure */ -extern BOOL HTLoadRelative(const char *relative_name, - HTParentAnchor *here); + extern BOOL HTLoadRelative(const char *relative_name, + HTParentAnchor *here); /* @@ -126,7 +129,7 @@ Load a document from absolute name NO Failure */ -extern BOOL HTLoadAbsolute(const DocAddress *addr); + extern BOOL HTLoadAbsolute(const DocAddress *addr); /* @@ -143,8 +146,8 @@ Load a document from absolute name to a stream Note: This is equivalent to HTLoadDocument */ -extern BOOL HTLoadToStream(const char *addr, BOOL filter_it, - HTStream *sink); + extern BOOL HTLoadToStream(const char *addr, BOOL filter_it, + HTStream *sink); /* @@ -158,7 +161,7 @@ Load if necessary, and select an anchor returns NO Failure */ -extern BOOL HTLoadAnchor(HTAnchor * destination); + extern BOOL HTLoadAnchor(HTAnchor * destination); /* @@ -171,7 +174,7 @@ Make a stream for Saving object back returns 0 if error else a stream to save the object to. */ -extern HTStream *HTSaveStream(HTParentAnchor *anchor); + extern HTStream *HTSaveStream(HTParentAnchor *anchor); /* @@ -185,7 +188,7 @@ Search here The anchor of the object being searched */ -extern BOOL HTSearch(const char *keywords, HTParentAnchor *here); + extern BOOL HTSearch(const char *keywords, HTParentAnchor *here); /* @@ -199,8 +202,8 @@ Search Given Indexname *indexname is name of object search is to be done on. */ -extern BOOL HTSearchAbsolute(const char *keywords, - char *indexname); + extern BOOL HTSearchAbsolute(const char *keywords, + char *indexname); /* @@ -208,19 +211,19 @@ Register an access method */ -typedef struct _HTProtocol { - const char *name; + typedef struct _HTProtocol { + const char *name; - int (*load) (const char *full_address, - HTParentAnchor *anchor, - HTFormat format_out, - HTStream *sink); + int (*load) (const char *full_address, + HTParentAnchor *anchor, + HTFormat format_out, + HTStream *sink); - HTStream *(*saveStream) (HTParentAnchor *anchor); + HTStream *(*saveStream) (HTParentAnchor *anchor); -} HTProtocol; + } HTProtocol; -extern BOOL HTRegisterProtocol(HTProtocol * protocol); + extern BOOL HTRegisterProtocol(HTProtocol * protocol); /* @@ -234,25 +237,28 @@ Generate the anchor for the home page This is a default algorithm -- browser don't HAVE to use this. */ -extern HTParentAnchor *HTHomeAnchor(void); + extern HTParentAnchor *HTHomeAnchor(void); /* Return Host Name */ -extern const char *HTHostName(void); + extern const char *HTHostName(void); /* For registering protocols supported by Lynx */ -extern void LYRegisterLynxProtocols(void); + extern void LYRegisterLynxProtocols(void); -extern void LYUCPushAssumed(HTParentAnchor *anchor); -extern int LYUCPopAssumed(void); + extern void LYUCPushAssumed(HTParentAnchor *anchor); + extern int LYUCPopAssumed(void); -extern BOOL using_proxy; /* Are we using an NNTP proxy? */ + extern BOOL using_proxy; /* Are we using an NNTP proxy? */ -#endif /* HTACCESS_H */ +#ifdef __cplusplus +} +#endif +#endif /* HTACCESS_H */ diff --git a/WWW/Library/Implementation/HTAnchor.h b/WWW/Library/Implementation/HTAnchor.h index b7d4f760..2cbe0d4a 100644 --- a/WWW/Library/Implementation/HTAnchor.h +++ b/WWW/Library/Implementation/HTAnchor.h @@ -20,38 +20,39 @@ #include <HTAtom.h> #include <UCDefs.h> -/* Main definition of anchor - * ========================= - */ - typedef struct _HyperDoc HyperDoc; /* Ready for forward references */ typedef struct _HTAnchor HTAnchor; typedef struct _HTParentAnchor HTParentAnchor; typedef struct _HTParentAnchor0 HTParentAnchor0; -/* After definition of HTFormat: */ #include <HTFormat.h> -struct _HTAnchor { /* Generic anchor */ - HTParentAnchor0 *parent; /* Parent of this anchor (self for adults) */ -}; +#ifdef __cplusplus +extern "C" { +#endif +/* Main definition of anchor + * ========================= + */ struct _HTAnchor { + /* Generic anchor */ + HTParentAnchor0 *parent; /* Parent of this anchor (self for adults) */ + }; -struct _HTParentAnchor0 { /* One for adult_table, + struct _HTParentAnchor0 { /* One for adult_table, * generally not used outside HTAnchor.c */ - /* Common part from the generic anchor structure */ - HTParentAnchor0 *parent; /* (self) */ + /* Common part from the generic anchor structure */ + HTParentAnchor0 *parent; /* (self) */ - /* ParentAnchor0-specific information */ - char *address; /* Absolute address of this node */ - HTParentAnchor *info; /* additional info, allocated on demand */ + /* ParentAnchor0-specific information */ + char *address; /* Absolute address of this node */ + HTParentAnchor *info; /* additional info, allocated on demand */ - HTBTree *children; /* Subanchors <a name="tag">, sorted by tag */ - HTList sources; /* List of anchors pointing to this, if any */ + HTBTree *children; /* Subanchors <a name="tag">, sorted by tag */ + HTList sources; /* List of anchors pointing to this, if any */ - HTList _add_adult; /* - just a memory for list entry:) */ - short adult_hash; /* adult list number */ - BOOL underway; /* Document about to be attached to it */ -}; + HTList _add_adult; /* - just a memory for list entry:) */ + short adult_hash; /* adult list number */ + BOOL underway; /* Document about to be attached to it */ + }; /* * Separated from the above to save memory: allocated on demand, @@ -60,100 +61,100 @@ struct _HTParentAnchor0 { /* One for adult_table, * [being precise, we currently allocate it before HTLoadDocument(), * in HTAnchor_findAddress() and HTAnchor_parent()]. */ -struct _HTParentAnchor { - /* Common part from the generic anchor structure */ - HTParentAnchor0 *parent; /* Parent of this anchor */ - - /* ParentAnchor-specific information */ - HTList children_notag; /* Subanchors <a href=...>, tag is NULL */ - HyperDoc *document; /* The document within which this is an anchor */ - - char *address; /* parent->address, a pointer */ - bstring *post_data; /* Posting data */ - char *post_content_type; /* Type of post data */ - char *bookmark; /* Bookmark filename */ - 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 */ - char *citehost; /* Citehost from REL="citehost" LINK */ + struct _HTParentAnchor { + /* Common part from the generic anchor structure */ + HTParentAnchor0 *parent; /* Parent of this anchor */ + + /* ParentAnchor-specific information */ + HTList children_notag; /* Subanchors <a href=...>, tag is NULL */ + HyperDoc *document; /* The document within which this is an anchor */ + + char *address; /* parent->address, a pointer */ + bstring *post_data; /* Posting data */ + char *post_content_type; /* Type of post data */ + char *bookmark; /* Bookmark filename */ + 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 */ + char *citehost; /* Citehost from REL="citehost" LINK */ #ifdef USE_COLOR_STYLE - char *style; + char *style; #endif - HTList *methods; /* Methods available as HTAtoms */ - void *protocol; /* Protocol object */ - char *physical; /* Physical address */ - BOOL isISMAPScript; /* Script for clickable image map */ - BOOL isHEAD; /* Document is headers from a HEAD request */ - BOOL safe; /* Safe */ + HTList *methods; /* Methods available as HTAtoms */ + void *protocol; /* Protocol object */ + char *physical; /* Physical address */ + BOOL isISMAPScript; /* Script for clickable image map */ + BOOL isHEAD; /* Document is headers from a HEAD request */ + BOOL safe; /* Safe */ #ifdef USE_SOURCE_CACHE - char *source_cache_file; - HTChunk *source_cache_chunk; + char *source_cache_file; + HTChunk *source_cache_chunk; #endif - char *FileCache; /* Path to a disk-cached copy (see src/HTFWriter.c) */ - char *SugFname; /* Suggested filename */ - char *cache_control; /* Cache-Control */ - BOOL no_cache; /* Cache-Control, Pragma or META "no-cache"? */ - BOOL inBASE; /* duplicated from HTStructured (HTML.c/h) */ + char *FileCache; /* Path to a disk-cached copy (see src/HTFWriter.c) */ + char *SugFname; /* Suggested filename */ + char *cache_control; /* Cache-Control */ + BOOL no_cache; /* Cache-Control, Pragma or META "no-cache"? */ + BOOL inBASE; /* duplicated from HTStructured (HTML.c/h) */ #ifdef EXP_HTTP_HEADERS - HTChunk http_headers; + HTChunk http_headers; #endif - char *content_type_params; /* Content-Type (with parameters if any) */ - char *content_type; /* Content-Type */ - char *content_language; /* Content-Language */ - char *content_encoding; /* Compression algorithm */ - char *content_base; /* Content-Base */ - char *content_disposition; /* Content-Disposition */ - char *content_location; /* Content-Location */ - char *content_md5; /* Content-MD5 */ - char *message_id; /* Message-ID */ - char *subject; /* Subject */ - int content_length; /* Content-Length */ - char *date; /* Date */ - char *expires; /* Expires */ - char *last_modified; /* Last-Modified */ - char *ETag; /* ETag (HTTP1.1 cache validator) */ - char *server; /* Server */ - UCAnchorInfo *UCStages; /* chartrans stages */ - HTList *imaps; /* client side image maps */ -}; - -typedef HTAtom HTLinkType; - -typedef struct { - /* Common part from the generic anchor structure */ - HTParentAnchor0 *parent; /* Parent of this anchor */ - - /* ChildAnchor-specific information */ - char *tag; /* #fragment, relative to the parent */ - - HTAnchor *dest; /* The anchor to which this leads */ - HTLinkType *type; /* Semantics of this link */ - - HTList _add_children_notag; /* - just a memory for list entry:) */ - HTList _add_sources; /* - just a memory for list entry:) */ -} HTChildAnchor; + char *content_type_params; /* Content-Type (with parameters if any) */ + char *content_type; /* Content-Type */ + char *content_language; /* Content-Language */ + char *content_encoding; /* Compression algorithm */ + char *content_base; /* Content-Base */ + char *content_disposition; /* Content-Disposition */ + char *content_location; /* Content-Location */ + char *content_md5; /* Content-MD5 */ + char *message_id; /* Message-ID */ + char *subject; /* Subject */ + int content_length; /* Content-Length */ + char *date; /* Date */ + char *expires; /* Expires */ + char *last_modified; /* Last-Modified */ + char *ETag; /* ETag (HTTP1.1 cache validator) */ + char *server; /* Server */ + UCAnchorInfo *UCStages; /* chartrans stages */ + HTList *imaps; /* client side image maps */ + }; + + typedef HTAtom HTLinkType; + + typedef struct { + /* Common part from the generic anchor structure */ + HTParentAnchor0 *parent; /* Parent of this anchor */ + + /* ChildAnchor-specific information */ + char *tag; /* #fragment, relative to the parent */ + + HTAnchor *dest; /* The anchor to which this leads */ + HTLinkType *type; /* Semantics of this link */ + + HTList _add_children_notag; /* - just a memory for list entry:) */ + HTList _add_sources; /* - just a memory for list entry:) */ + } HTChildAnchor; /* * DocAddress structure is used for loading an absolute anchor with all * needed information including posting data and post content type. */ -typedef struct _DocAddress { - char *address; - bstring *post_data; - char *post_content_type; - char *bookmark; - BOOL isHEAD; - BOOL safe; -} DocAddress; + typedef struct _DocAddress { + char *address; + bstring *post_data; + char *post_content_type; + char *bookmark; + BOOL isHEAD; + BOOL safe; + } DocAddress; /* "internal" means "within the same document, with certainty". */ -extern HTLinkType *HTInternalLink; + extern HTLinkType *HTInternalLink; /* Create or find a child anchor with a possible link * -------------------------------------------------- @@ -162,10 +163,10 @@ extern HTLinkType *HTInternalLink; * a name, and possibly a link to a _relatively_ named anchor. * (Code originally in ParseHTML.h) */ -extern HTChildAnchor *HTAnchor_findChildAndLink(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 */ + extern HTChildAnchor *HTAnchor_findChildAndLink(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 */ /* Create new or find old parent anchor * ------------------------------------ @@ -175,7 +176,7 @@ extern HTChildAnchor *HTAnchor_findChildAndLink(HTParentAnchor *parent, /* May * Note: You are not guaranteed a new anchor -- you might get an old one, * like with fonts. */ -extern HTParentAnchor *HTAnchor_findAddress(const DocAddress *address); + extern HTParentAnchor *HTAnchor_findAddress(const DocAddress *address); /* Create new or find old named anchor - simple form * ------------------------------------------------- @@ -183,7 +184,7 @@ extern HTParentAnchor *HTAnchor_findAddress(const DocAddress *address); * Like the previous one, but simpler to use for simple cases. * No post data etc. can be supplied. - kw */ -extern HTParentAnchor *HTAnchor_findSimpleAddress(const char *url); + extern HTParentAnchor *HTAnchor_findSimpleAddress(const char *url); /* Delete an anchor and possibly related things (auto garbage collection) * -------------------------------------------- @@ -194,211 +195,214 @@ extern HTParentAnchor *HTAnchor_findSimpleAddress(const char *url); * We also try to delete the targets whose documents are not loaded. * If this anchor's sources list is empty, we delete it and its children. */ -extern BOOL HTAnchor_delete(HTParentAnchor0 *me); + extern BOOL HTAnchor_delete(HTParentAnchor0 *me); /* * Unnamed children (children_notag) have no sense without HText - * delete them and their links if we are about to free HText. * Document currently exists. Called within HText_free(). */ -extern void HTAnchor_delete_links(HTParentAnchor *me); + extern void HTAnchor_delete_links(HTParentAnchor *me); #ifdef USE_SOURCE_CACHE -extern void HTAnchor_clearSourceCache(HTParentAnchor *me); + extern void HTAnchor_clearSourceCache(HTParentAnchor *me); #endif /* Data access functions * --------------------- */ -extern HTParentAnchor *HTAnchor_parent(HTAnchor * me); + extern HTParentAnchor *HTAnchor_parent(HTAnchor * me); -extern void HTAnchor_setDocument(HTParentAnchor *me, - HyperDoc *doc); + extern void HTAnchor_setDocument(HTParentAnchor *me, + HyperDoc *doc); -extern HyperDoc *HTAnchor_document(HTParentAnchor *me); + extern HyperDoc *HTAnchor_document(HTParentAnchor *me); /* 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(HTAnchor * me); + extern char *HTAnchor_address(HTAnchor * me); -extern void HTAnchor_setFormat(HTParentAnchor *me, - HTFormat form); + extern void HTAnchor_setFormat(HTParentAnchor *me, + HTFormat form); -extern HTFormat HTAnchor_format(HTParentAnchor *me); + extern HTFormat HTAnchor_format(HTParentAnchor *me); -extern void HTAnchor_setIndex(HTParentAnchor *me, - const char *address); + extern void HTAnchor_setIndex(HTParentAnchor *me, + const char *address); -extern void HTAnchor_setPrompt(HTParentAnchor *me, - const char *prompt); + extern void HTAnchor_setPrompt(HTParentAnchor *me, + const char *prompt); -extern BOOL HTAnchor_isIndex(HTParentAnchor *me); + extern BOOL HTAnchor_isIndex(HTParentAnchor *me); -extern BOOL HTAnchor_isISMAPScript(HTAnchor * me); + extern BOOL HTAnchor_isISMAPScript(HTAnchor * me); #if defined(USE_COLOR_STYLE) -extern const char *HTAnchor_style(HTParentAnchor *me); + extern const char *HTAnchor_style(HTParentAnchor *me); -extern void HTAnchor_setStyle(HTParentAnchor *me, - const char *style); + extern void HTAnchor_setStyle(HTParentAnchor *me, + const char *style); #endif /* Title handling. */ -extern const char *HTAnchor_title(HTParentAnchor *me); + extern const char *HTAnchor_title(HTParentAnchor *me); -extern void HTAnchor_setTitle(HTParentAnchor *me, - const char *title); + extern void HTAnchor_setTitle(HTParentAnchor *me, + const char *title); -extern void HTAnchor_appendTitle(HTParentAnchor *me, - const char *title); + extern void HTAnchor_appendTitle(HTParentAnchor *me, + const char *title); /* Bookmark handling. */ -extern const char *HTAnchor_bookmark(HTParentAnchor *me); + extern const char *HTAnchor_bookmark(HTParentAnchor *me); -extern void HTAnchor_setBookmark(HTParentAnchor *me, - const char *bookmark); + extern void HTAnchor_setBookmark(HTParentAnchor *me, + const char *bookmark); /* Owner handling. */ -extern const char *HTAnchor_owner(HTParentAnchor *me); + extern const char *HTAnchor_owner(HTParentAnchor *me); -extern void HTAnchor_setOwner(HTParentAnchor *me, - const char *owner); + extern void HTAnchor_setOwner(HTParentAnchor *me, + const char *owner); /* TITLE handling in LINKs with REV="made" or REV="owner". - FM */ -extern const char *HTAnchor_RevTitle(HTParentAnchor *me); + extern const char *HTAnchor_RevTitle(HTParentAnchor *me); -extern void HTAnchor_setRevTitle(HTParentAnchor *me, - const char *title); + extern void HTAnchor_setRevTitle(HTParentAnchor *me, + const char *title); /* Citehost for bibp links from LINKs with REL="citehost". - RDC */ -extern const char *HTAnchor_citehost(HTParentAnchor *me); + extern const char *HTAnchor_citehost(HTParentAnchor *me); -extern void HTAnchor_setCitehost(HTParentAnchor *me, - const char *citehost); + extern void HTAnchor_setCitehost(HTParentAnchor *me, + const char *citehost); /* Suggested filename handling. - FM * (will be loaded if we had a Content-Disposition * header or META element with filename=name.suffix) */ -extern const char *HTAnchor_SugFname(HTParentAnchor *me); + extern const char *HTAnchor_SugFname(HTParentAnchor *me); /* HTTP Headers. */ -extern const char *HTAnchor_http_headers(HTParentAnchor *me); + extern const char *HTAnchor_http_headers(HTParentAnchor *me); /* Content-Type handling (parameter list). */ -extern const char *HTAnchor_content_type_params(HTParentAnchor *me); + extern const char *HTAnchor_content_type_params(HTParentAnchor *me); /* Content-Type handling. - FM */ -extern const char *HTAnchor_content_type(HTParentAnchor *me); + extern const char *HTAnchor_content_type(HTParentAnchor *me); /* Content-Encoding handling. - FM * (will be loaded if we had a Content-Encoding * header.) */ -extern const char *HTAnchor_content_encoding(HTParentAnchor *me); + extern const char *HTAnchor_content_encoding(HTParentAnchor *me); /* Last-Modified header handling. - FM */ -extern const char *HTAnchor_last_modified(HTParentAnchor *me); + extern const char *HTAnchor_last_modified(HTParentAnchor *me); /* Date header handling. - FM */ -extern const char *HTAnchor_date(HTParentAnchor *me); + extern const char *HTAnchor_date(HTParentAnchor *me); /* Server header handling. - FM */ -extern const char *HTAnchor_server(HTParentAnchor *me); + extern const char *HTAnchor_server(HTParentAnchor *me); /* Safe header handling. - FM */ -extern BOOL HTAnchor_safe(HTParentAnchor *me); + extern BOOL HTAnchor_safe(HTParentAnchor *me); /* Content-Base header handling. - FM */ -extern const char *HTAnchor_content_base(HTParentAnchor *me); + extern const char *HTAnchor_content_base(HTParentAnchor *me); /* Content-Location header handling. - FM */ -extern const char *HTAnchor_content_location(HTParentAnchor *me); + extern const char *HTAnchor_content_location(HTParentAnchor *me); /* Message-ID, used for mail replies - kw */ -extern const char *HTAnchor_messageID(HTParentAnchor *me); + extern const char *HTAnchor_messageID(HTParentAnchor *me); -extern BOOL HTAnchor_setMessageID(HTParentAnchor *me, - const char *messageid); + extern BOOL HTAnchor_setMessageID(HTParentAnchor *me, + const char *messageid); /* Subject, used for mail replies - kw */ -extern const char *HTAnchor_subject(HTParentAnchor *me); + extern const char *HTAnchor_subject(HTParentAnchor *me); -extern BOOL HTAnchor_setSubject(HTParentAnchor *me, - const char *subject); + extern BOOL HTAnchor_setSubject(HTParentAnchor *me, + const char *subject); /* Manipulation of links * --------------------- */ -extern HTAnchor *HTAnchor_followLink(HTChildAnchor *me); + extern HTAnchor *HTAnchor_followLink(HTChildAnchor *me); -extern HTAnchor *HTAnchor_followTypedLink(HTChildAnchor *me, - HTLinkType *type); + extern HTAnchor *HTAnchor_followTypedLink(HTChildAnchor *me, + HTLinkType *type); /* Read and write methods * ---------------------- */ -extern HTList *HTAnchor_methods(HTParentAnchor *me); + extern HTList *HTAnchor_methods(HTParentAnchor *me); /* Protocol * -------- */ -extern void *HTAnchor_protocol(HTParentAnchor *me); + extern void *HTAnchor_protocol(HTParentAnchor *me); -extern void HTAnchor_setProtocol(HTParentAnchor *me, - void *protocol); + extern void HTAnchor_setProtocol(HTParentAnchor *me, + void *protocol); /* Physical address * ---------------- */ -extern char *HTAnchor_physical(HTParentAnchor *me); + extern char *HTAnchor_physical(HTParentAnchor *me); -extern void HTAnchor_setPhysical(HTParentAnchor *me, - char *protocol); + extern void HTAnchor_setPhysical(HTParentAnchor *me, + char *protocol); -extern LYUCcharset *HTAnchor_getUCInfoStage(HTParentAnchor *me, - int which_stage); + extern LYUCcharset *HTAnchor_getUCInfoStage(HTParentAnchor *me, + int which_stage); -extern int HTAnchor_getUCLYhndl(HTParentAnchor *me, - int which_stage); + extern int HTAnchor_getUCLYhndl(HTParentAnchor *me, + int which_stage); -extern LYUCcharset *HTAnchor_setUCInfoStage(HTParentAnchor *me, - int LYhndl, - int which_stage, - int set_by); + extern LYUCcharset *HTAnchor_setUCInfoStage(HTParentAnchor *me, + int LYhndl, + int which_stage, + int set_by); -extern LYUCcharset *HTAnchor_setUCInfoStage(HTParentAnchor *me, - int LYhndl, - int which_stage, - int set_by); + extern LYUCcharset *HTAnchor_setUCInfoStage(HTParentAnchor *me, + int LYhndl, + int which_stage, + int set_by); -extern LYUCcharset *HTAnchor_resetUCInfoStage(HTParentAnchor *me, - int LYhndl, - int which_stage, - int set_by); + extern LYUCcharset *HTAnchor_resetUCInfoStage(HTParentAnchor *me, + int LYhndl, + int which_stage, + int set_by); -extern LYUCcharset *HTAnchor_copyUCInfoStage(HTParentAnchor *me, - int to_stage, - int from_stage, - int set_by); + extern LYUCcharset *HTAnchor_copyUCInfoStage(HTParentAnchor *me, + int to_stage, + int from_stage, + int set_by); -extern void ImageMapList_free(HTList *list); + extern void ImageMapList_free(HTList *list); -#endif /* HTANCHOR_H */ +#ifdef __cplusplus +} +#endif +#endif /* HTANCHOR_H */ diff --git a/WWW/Library/Implementation/HTAssoc.h b/WWW/Library/Implementation/HTAssoc.h index c1117ffa..327809c2 100644 --- a/WWW/Library/Implementation/HTAssoc.h +++ b/WWW/Library/Implementation/HTAssoc.h @@ -9,21 +9,27 @@ #include <HTList.h> -typedef HTList HTAssocList; - -typedef struct { - char *name; - char *value; -} HTAssoc; - -extern HTAssocList *HTAssocList_new(void); -extern void HTAssocList_delete(HTAssocList *alist); - -extern void HTAssocList_add(HTAssocList *alist, - const char *name, - const char *value); - -extern char *HTAssocList_lookup(HTAssocList *alist, - const char *name); - -#endif /* not HTASSOC_H */ +#ifdef __cplusplus +extern "C" { +#endif + typedef HTList HTAssocList; + + typedef struct { + char *name; + char *value; + } HTAssoc; + + extern HTAssocList *HTAssocList_new(void); + extern void HTAssocList_delete(HTAssocList *alist); + + extern void HTAssocList_add(HTAssocList *alist, + const char *name, + const char *value); + + extern char *HTAssocList_lookup(HTAssocList *alist, + const char *name); + +#ifdef __cplusplus +} +#endif +#endif /* not HTASSOC_H */ diff --git a/WWW/Library/Implementation/HTAtom.h b/WWW/Library/Implementation/HTAtom.h index e0843c28..4125d31b 100644 --- a/WWW/Library/Implementation/HTAtom.h +++ b/WWW/Library/Implementation/HTAtom.h @@ -23,16 +23,32 @@ #include <HTList.h> -typedef struct _HTAtom HTAtom; +#ifdef __cplusplus +extern "C" { +#endif + typedef struct _HTAtom HTAtom; -struct _HTAtom { - HTAtom *next; - char *name; -}; /* struct _HTAtom */ + struct _HTAtom { + HTAtom *next; + char *name; + }; /* struct _HTAtom */ -extern HTAtom *HTAtom_for(const char *string); -extern HTList *HTAtom_templateMatches(const char *templ); + extern HTAtom *HTAtom_for(const char *string); + extern HTList *HTAtom_templateMatches(const char *templ); #define HTAtom_name(a) ((a)->name) -#endif /* HTATOM_H */ +/* + +The HTFormat type + + We use the HTAtom object for holding representations. This allows faster manipulation + (comparison and copying) that if we stayed with strings. + + */ + typedef HTAtom *HTFormat; + +#ifdef __cplusplus +} +#endif +#endif /* HTATOM_H */ diff --git a/WWW/Library/Implementation/HTBTree.h b/WWW/Library/Implementation/HTBTree.h index dc1cbc3e..a4f78f94 100644 --- a/WWW/Library/Implementation/HTBTree.h +++ b/WWW/Library/Implementation/HTBTree.h @@ -16,47 +16,49 @@ #include <HTUtils.h> #endif +#ifdef __cplusplus +extern "C" { +#endif /* Data structures - */ -typedef struct _HTBTree_element { - void *object; /* User object */ - struct _HTBTree_element *up; - struct _HTBTree_element *left; - int left_depth; - struct _HTBTree_element *right; - int right_depth; -} HTBTElement; - -typedef int (*HTComparer) (void *a, void *b); - -typedef struct _HTBTree_top { - HTComparer compare; - struct _HTBTree_element *top; -} HTBTree; + */ typedef struct _HTBTree_element { + void *object; /* User object */ + struct _HTBTree_element *up; + struct _HTBTree_element *left; + int left_depth; + struct _HTBTree_element *right; + int right_depth; + } HTBTElement; + + typedef int (*HTComparer) (void *a, void *b); + + typedef struct _HTBTree_top { + HTComparer compare; + struct _HTBTree_element *top; + } HTBTree; /* Create a binary tree given its discrimination routine */ -extern HTBTree *HTBTree_new(HTComparer comp); + extern HTBTree *HTBTree_new(HTComparer comp); /* Free storage of the tree but not of the objects */ -extern void HTBTree_free(HTBTree *tree); + extern void HTBTree_free(HTBTree *tree); /* Free storage of the tree and of the objects */ -extern void HTBTreeAndObject_free(HTBTree *tree); + extern void HTBTreeAndObject_free(HTBTree *tree); /* @@ -64,7 +66,7 @@ Add an object to a binary tree */ -extern void HTBTree_add(HTBTree *tree, void *object); + extern void HTBTree_add(HTBTree *tree, void *object); /* @@ -73,7 +75,7 @@ Search an object in a binary tree returns Pointer to equivalent object in a tree or NULL if none. */ -extern void *HTBTree_search(HTBTree *tree, void *object); + extern void *HTBTree_search(HTBTree *tree, void *object); /* @@ -94,6 +96,9 @@ Find next element in depth-first order returns Pointer to element or NULL if none left. */ -extern HTBTElement *HTBTree_next(HTBTree *tree, HTBTElement *ele); + extern HTBTElement *HTBTree_next(HTBTree *tree, HTBTElement *ele); -#endif /* HTBTREE_H */ +#ifdef __cplusplus +} +#endif +#endif /* HTBTREE_H */ diff --git a/WWW/Library/Implementation/HTCJK.h b/WWW/Library/Implementation/HTCJK.h index 28b98e76..6bdc41c4 100644 --- a/WWW/Library/Implementation/HTCJK.h +++ b/WWW/Library/Implementation/HTCJK.h @@ -15,100 +15,99 @@ #include <HTUtils.h> #endif +#ifdef __cplusplus +extern "C" { +#endif /* * STATUS CHANGE CODES */ #ifdef ESC #undef ESC -#endif /* ESC */ +#endif /* ESC */ #define ESC CH_ESC /* S/390 -- gil -- 0098 */ #define TO_2BCODE '$' #define TO_1BCODE '(' - #define TO_KANA '\016' #define TO_KANAOUT '\017' - #define TO_KANJI "\033$B" #define TO_HANJI "\033$A" #define TO_HANGUL "\033$(C" #define TO_ASCII "\033(B" - #define IS_SJIS_LO(lo) ((0x40<=lo)&&(lo!=0x7F)&&(lo<=0xFC)) #define IS_SJIS_HI1(hi) ((0x81<=hi)&&(hi<=0x9F)) /* 1st lev. */ #define IS_SJIS_HI2(hi) ((0xE0<=hi)&&(hi<=0xEF)) /* 2nd lev. */ #define IS_SJIS(hi,lo,in_sjis) (!IS_SJIS_LO(lo)?0:IS_SJIS_HI1(hi)?(in_sjis=1):in_sjis&&IS_SJIS_HI2(hi)) #define IS_SJIS_2BYTE(hi,lo) (IS_SJIS_LO(lo)&&(IS_SJIS_HI1(hi)||IS_SJIS_HI2(hi))) #define IS_SJIS_X0201KANA(lo) ((0xA1<=lo)&&(lo<=0xDF)) - #define IS_EUC_LOX(lo) ((0xA1<=lo)&&(lo<=0xFE)) /* extended */ #define IS_EUC_HI(hi) ((0xA1<=hi)&&(hi<=0xFE)) #define IS_EUC_X0201KANA(hi,lo) ((hi==0x8E)&&(0xA1<=lo)&&(lo<=0xDF)) #define IS_EUC(hi,lo) ((IS_EUC_HI(hi) && IS_EUC_LOX(lo))||IS_EUC_X0201KANA(hi,lo)) - #define IS_JAPANESE_2BYTE(hi,lo) (IS_SJIS_2BYTE(hi,lo) || IS_EUC(hi,lo)) - #define IS_BIG5_LOS(lo) ((0x40<=lo)&&(lo<=0x7E)) /* standard */ #define IS_BIG5_LOX(lo) ((0xA1<=lo)&&(lo<=0xFE)) /* extended */ #define IS_BIG5_HI(hi) ((0xA1<=hi)&&(hi<=0xFE)) #define IS_BIG5(hi,lo) (IS_BIG5_HI(hi) && (IS_BIG5_LOS(lo) || IS_BIG5_LOX(lo))) + typedef enum { + NOKANJI = 0, EUC, SJIS, JIS + } HTkcode; + typedef enum { + NOCJK = 0, JAPANESE, CHINESE, KOREAN, TAIPEI + } HTCJKlang; -typedef enum { - NOKANJI, EUC, SJIS, JIS -} HTkcode; -typedef enum { - NOCJK, JAPANESE, CHINESE, KOREAN, TAIPEI -} HTCJKlang; - -extern HTCJKlang HTCJK; + extern HTCJKlang HTCJK; /* * Function prototypes. */ -extern void JISx0201TO0208_EUC(register unsigned char IHI, - register unsigned char ILO, - register unsigned char *OHI, - register unsigned char *OLO); + extern void JISx0201TO0208_EUC(register unsigned char IHI, + register unsigned char ILO, + register unsigned char *OHI, + register unsigned char *OLO); -extern unsigned char *SJIS_TO_JIS1(register unsigned char HI, - register unsigned char LO, - register unsigned char *JCODE); + extern unsigned char *SJIS_TO_JIS1(register unsigned char HI, + register unsigned char LO, + register unsigned char *JCODE); -extern unsigned char *JIS_TO_SJIS1(register unsigned char HI, - register unsigned char LO, - register unsigned char *SJCODE); + extern unsigned char *JIS_TO_SJIS1(register unsigned char HI, + register unsigned char LO, + register unsigned char *SJCODE); -extern unsigned char *EUC_TO_SJIS1(unsigned char HI, - unsigned char LO, - register unsigned char *SJCODE); + extern unsigned char *EUC_TO_SJIS1(unsigned char HI, + unsigned char LO, + register unsigned char *SJCODE); -extern void JISx0201TO0208_SJIS(register unsigned char I, - register unsigned char *OHI, - register unsigned char *OLO); + extern void JISx0201TO0208_SJIS(register unsigned char I, + register unsigned char *OHI, + register unsigned char *OLO); -extern unsigned char *SJIS_TO_EUC1(unsigned char HI, - unsigned char LO, - unsigned char *EUCp); + extern unsigned char *SJIS_TO_EUC1(unsigned char HI, + unsigned char LO, + unsigned char *EUCp); -extern unsigned char *SJIS_TO_EUC(unsigned char *src, - unsigned char *dst); + extern unsigned char *SJIS_TO_EUC(unsigned char *src, + unsigned char *dst); -extern unsigned char *EUC_TO_SJIS(unsigned char *src, - unsigned char *dst); + extern unsigned char *EUC_TO_SJIS(unsigned char *src, + unsigned char *dst); -extern unsigned char *EUC_TO_JIS(unsigned char *src, - unsigned char *dst, - const char *toK, - const char *toA); + extern unsigned char *EUC_TO_JIS(unsigned char *src, + unsigned char *dst, + const char *toK, + const char *toA); -extern unsigned char *TO_EUC(const unsigned char *jis, - unsigned char *euc); + extern unsigned char *TO_EUC(const unsigned char *jis, + unsigned char *euc); -extern void TO_SJIS(const unsigned char *any, - unsigned char *sjis); + extern void TO_SJIS(const unsigned char *any, + unsigned char *sjis); -extern void TO_JIS(const unsigned char *any, - unsigned char *jis); + extern void TO_JIS(const unsigned char *any, + unsigned char *jis); -extern char *str_kcode(HTkcode code); + extern char *str_kcode(HTkcode code); -#endif /* HTCJK_H */ +#ifdef __cplusplus +} +#endif +#endif /* HTCJK_H */ diff --git a/WWW/Library/Implementation/HTChunk.h b/WWW/Library/Implementation/HTChunk.h index ba28c422..8a5ade18 100644 --- a/WWW/Library/Implementation/HTChunk.h +++ b/WWW/Library/Implementation/HTChunk.h @@ -16,18 +16,21 @@ #include <UCMap.h> -typedef struct { - int size; /* In bytes */ - int growby; /* Allocation unit in bytes */ - int allocated; /* Current size of *data */ - char *data; /* Pointer to malloc'd area or 0 */ - int failok; /* allowed to fail without exiting program? */ -} HTChunk; +#ifdef __cplusplus +extern "C" { +#endif + typedef struct { + int size; /* In bytes */ + int growby; /* Allocation unit in bytes */ + int allocated; /* Current size of *data */ + char *data; /* Pointer to malloc'd area or 0 */ + int failok; /* allowed to fail without exiting program? */ + } HTChunk; /* * Initialize a chunk's allocation data and allocation-increment. */ -extern void HTChunkInit(HTChunk *ch, int grow); + extern void HTChunkInit(HTChunk *ch, int grow); /* * @@ -45,7 +48,7 @@ extern void HTChunkInit(HTChunk *ch, int grow); * */ -extern HTChunk *HTChunkCreate(int growby); + extern HTChunk *HTChunkCreate(int growby); /* * Create a chunk for which an allocation error is not a fatal application @@ -54,13 +57,13 @@ extern HTChunk *HTChunkCreate(int growby); * are ok each time after data have been appended. * The create call may also fail and will reurn NULL in that case. - kw */ -extern HTChunk *HTChunkCreateMayFail(int growby, int failok); + extern HTChunk *HTChunkCreateMayFail(int growby, int failok); /* * Like HTChunkCreate but with initial allocation - kw * */ -extern HTChunk *HTChunkCreate2(int growby, size_t needed); + extern HTChunk *HTChunkCreate2(int growby, size_t needed); /* * @@ -76,7 +79,7 @@ extern HTChunk *HTChunkCreate2(int growby, size_t needed); * */ -extern void HTChunkFree(HTChunk *ch); + extern void HTChunkFree(HTChunk *ch); /* * @@ -92,7 +95,7 @@ extern void HTChunkFree(HTChunk *ch); * */ -extern void HTChunkClear(HTChunk *ch); + extern void HTChunkClear(HTChunk *ch); /* * @@ -110,7 +113,7 @@ extern void HTChunkClear(HTChunk *ch); * */ -extern BOOL HTChunkRealloc(HTChunk *ch, int growby); + extern BOOL HTChunkRealloc(HTChunk *ch, int growby); /* * @@ -128,7 +131,7 @@ extern BOOL HTChunkRealloc(HTChunk *ch, int growby); * */ -extern void HTChunkEnsure(HTChunk *ch, int s); + extern void HTChunkEnsure(HTChunk *ch, int s); /* * @@ -145,11 +148,11 @@ extern void HTChunkEnsure(HTChunk *ch, int s); * *ch Is one character bigger * */ -extern void HTChunkPutc(HTChunk *ch, char c); + extern void HTChunkPutc(HTChunk *ch, char c); -extern void HTChunkPutb(HTChunk *ch, const char *b, int l); + extern void HTChunkPutb(HTChunk *ch, const char *b, int l); -extern void HTChunkPutUtf8Char(HTChunk *ch, UCode_t code); + extern void HTChunkPutUtf8Char(HTChunk *ch, UCode_t code); /* * Append a string to a chunk @@ -166,7 +169,7 @@ extern void HTChunkPutUtf8Char(HTChunk *ch, UCode_t code); * */ -extern void HTChunkPuts(HTChunk *ch, const char *str); + extern void HTChunkPuts(HTChunk *ch, const char *str); /* * @@ -186,6 +189,9 @@ extern void HTChunkPuts(HTChunk *ch, const char *str); * */ -extern void HTChunkTerminate(HTChunk *ch); + extern void HTChunkTerminate(HTChunk *ch); -#endif /* HTCHUNK_H */ +#ifdef __cplusplus +} +#endif +#endif /* HTCHUNK_H */ diff --git a/WWW/Library/Implementation/HTFTP.c b/WWW/Library/Implementation/HTFTP.c index 1cb75232..a6242d42 100644 --- a/WWW/Library/Implementation/HTFTP.c +++ b/WWW/Library/Implementation/HTFTP.c @@ -102,6 +102,49 @@ typedef struct _connection { */ #include <HTML.h> +/* + * socklen_t is the standard, but there are many pre-standard variants. + * This ifdef works around a few of those cases. + * + * Information was obtained from header files on these platforms: + * AIX 4.3.2, 5.1 + * HPUX 10.20, 11.00, 11.11 + * IRIX64 6.5 + * Tru64 4.0G, 4.0D, 5.1 + */ +#if defined(SYS_IRIX64) + /* IRIX64 6.5 socket.h may use socklen_t if SGI_SOURCE is not defined */ +# if _NO_XOPEN4 && _NO_XOPEN5 +# define LY_SOCKLEN socklen_t +# elif _ABIAPI +# define LY_SOCKLEN int +# elif _XOPEN5 +# if (_MIPS_SIM != _ABIO32) +# define LY_SOCKLEN socklen_t +# else +# define LY_SOCKLEN int +# endif +# else +# define LY_SOCKLEN size_t +# endif +#elif defined(SYS_HPUX) +# if defined(_XOPEN_SOURCE_EXTENDED) && defined(SO_PROTOTYPE) +# define LY_SOCKLEN socklen_t +# else /* HPUX 10.20, etc. */ +# define LY_SOCKLEN int +# endif +#elif defined(SYS_TRU64) +# if defined(_POSIX_PII_SOCKET) +# define LY_SOCKLEN socklen_t +# elif defined(_XOPEN_SOURCE_EXTENDED) +# define LY_SOCKLEN size_t +# else +# define LY_SOCKLEN int +# endif +#else +# define LY_SOCKLEN socklen_t +#endif + #define PUTC(c) (*targetClass.put_character) (target, c) #define PUTS(s) (*targetClass.put_string) (target, s) #define START(e) (*targetClass.start_element) (target, e, 0, 0, -1, 0) @@ -1096,7 +1139,7 @@ static int get_listen_socket(void) struct sockaddr_storage soc_address; /* Binary network address */ struct sockaddr_in *soc_in = (struct sockaddr_in *) &soc_address; int af; - int slen; + LY_SOCKLEN slen; #else struct sockaddr_in soc_address; /* Binary network address */ @@ -1203,18 +1246,18 @@ static int get_listen_socket(void) #else { int status; - int address_length = sizeof(soc_address); + LY_SOCKLEN address_length = sizeof(soc_address); #ifdef SOCKS if (socks_flag) status = Rgetsockname(control->socket, (struct sockaddr *) &soc_address, - (void *) &address_length); + &address_length); else #endif /* SOCKS */ status = getsockname(control->socket, (struct sockaddr *) &soc_address, - (void *) &address_length); + &address_length); if (status < 0) return HTInetStatus("getsockname"); #ifdef INET6 @@ -1257,12 +1300,12 @@ static int get_listen_socket(void) if (socks_flag) status = Rgetsockname(new_socket, (struct sockaddr *) &soc_address, - (void *) &address_length); + &address_length); else #endif /* SOCKS */ status = getsockname(new_socket, (struct sockaddr *) &soc_address, - (void *) &address_length); + &address_length); if (status < 0) return HTInetStatus("getsockname"); } @@ -2935,7 +2978,7 @@ static int setup_connection(const char *name, HTParentAnchor *anchor) { int retry; /* How many times tried? */ - int status; + int status = HT_NO_CONNECTION; CTRACE((tfp, "setup_connection(%s)\n", name)); @@ -3038,7 +3081,7 @@ static int setup_connection(const char *name, } else if (strcmp(p, "EPSV") == 0) { char c0, c1, c2, c3; struct sockaddr_storage ss; - int sslen; + LY_SOCKLEN sslen; /* * EPSV bla (|||port|) @@ -3672,18 +3715,18 @@ int HTFTPLoad(const char *name, #else struct sockaddr_in soc_address; #endif /* INET6 */ - int soc_addrlen = sizeof(soc_address); + LY_SOCKLEN soc_addrlen = sizeof(soc_address); #ifdef SOCKS if (socks_flag) status = Raccept(master_socket, (struct sockaddr *) &soc_address, - (void *) &soc_addrlen); + &soc_addrlen); else #endif /* SOCKS */ status = accept(master_socket, (struct sockaddr *) &soc_address, - (void *) &soc_addrlen); + &soc_addrlen); if (status < 0) { init_help_message_cache(); /* to free memory */ return HTInetStatus("accept"); diff --git a/WWW/Library/Implementation/HTFTP.h b/WWW/Library/Implementation/HTFTP.h index 75e60aaf..a903bbb8 100644 --- a/WWW/Library/Implementation/HTFTP.h +++ b/WWW/Library/Implementation/HTFTP.h @@ -14,12 +14,14 @@ #include <HTStream.h> #include <HTParse.h> +#ifdef __cplusplus +extern "C" { +#endif #define FILE_BY_NAME 0 #define FILE_BY_TYPE 1 #define FILE_BY_SIZE 2 #define FILE_BY_DATE 3 - -extern int HTfileSortMethod; /* specifies the method of sorting */ + extern int HTfileSortMethod; /* specifies the method of sorting */ /* PUBLIC HTVMS_name() * CONVERTS WWW name into a VMS name @@ -32,8 +34,8 @@ extern int HTfileSortMethod; /* specifies the method of sorting */ * * Bug: Returns pointer to static -- non-reentrant */ -extern char *HTVMS_name(const char *nn, - const char *fn); + extern char *HTVMS_name(const char *nn, + const char *fn); /* @@ -44,22 +46,25 @@ Retrieve File from Server returns Socket number for file if good.<0 if bad. */ -extern int HTFTPLoad(const char *name, - HTParentAnchor *anchor, - HTFormat format_out, - HTStream *sink); + extern int HTFTPLoad(const char *name, + HTParentAnchor *anchor, + HTFormat format_out, + HTStream *sink); /* * This function frees any user entered password, so that * it must be entered again for a future request. - FM */ -extern void HTClearFTPPassword(void); + extern void HTClearFTPPassword(void); /* Return Host Name */ -extern const char *HTHostName(void); + extern const char *HTHostName(void); +#ifdef __cplusplus +} +#endif #endif diff --git a/WWW/Library/Implementation/HTFWriter.h b/WWW/Library/Implementation/HTFWriter.h index 615e6341..015ea15f 100644 --- a/WWW/Library/Implementation/HTFWriter.h +++ b/WWW/Library/Implementation/HTFWriter.h @@ -11,14 +11,20 @@ #include <HTStream.h> #include <HTFormat.h> -extern HTStream *HTFWriter_new(FILE *fp); +#ifdef __cplusplus +extern "C" { +#endif + extern HTStream *HTFWriter_new(FILE *fp); -extern HTStream *HTSaveAndExecute(HTPresentation *pres, - HTParentAnchor *anchor, /* Not used */ - HTStream *sink); + extern HTStream *HTSaveAndExecute(HTPresentation *pres, + HTParentAnchor *anchor, /* Not used */ + HTStream *sink); -extern HTStream *HTSaveLocally(HTPresentation *pres, - HTParentAnchor *anchor, /* Not used */ - HTStream *sink); + extern HTStream *HTSaveLocally(HTPresentation *pres, + HTParentAnchor *anchor, /* Not used */ + HTStream *sink); -#endif /* HTFWRITE_H */ +#ifdef __cplusplus +} +#endif +#endif /* HTFWRITE_H */ diff --git a/WWW/Library/Implementation/HTFile.h b/WWW/Library/Implementation/HTFile.h index c9aacc2d..4541fb49 100644 --- a/WWW/Library/Implementation/HTFile.h +++ b/WWW/Library/Implementation/HTFile.h @@ -12,18 +12,22 @@ #include <HTFormat.h> #include <HTAccess.h> + #ifndef HTML_H #include <HTML.h> /* SCW */ #endif /* HTML_H */ +#ifdef __cplusplus +extern "C" { +#endif /* * Controlling globals * * These flags control how directories and files are represented as * hypertext, and are typically set by the application from command * line options, etc. - */ -extern int HTDirAccess; /* Directory access level */ + */ extern int HTDirAccess; + /* Directory access level */ #define HT_DIR_FORBID 0 /* Altogether forbidden */ #define HT_DIR_SELECTIVE 1 /* If HT_DIR_ENABLE_FILE exists */ @@ -31,9 +35,9 @@ extern int HTDirAccess; /* Directory access level */ #define HT_DIR_ENABLE_FILE ".www_browsable" /* If exists, can browse */ -extern int HTDirReadme; /* Include readme files in listing? */ + extern int HTDirReadme; /* Include readme files in listing? */ - /* Values: */ + /* Values: */ #define HT_DIR_README_NONE 0 /* No */ #define HT_DIR_README_TOP 1 /* Yes, first */ #define HT_DIR_README_BOTTOM 2 /* Yes, at the end */ @@ -43,8 +47,8 @@ extern int HTDirReadme; /* Include readme files in listing? */ /* * Convert filenames between local and WWW formats */ -extern char *HTURLPath_toFile(const char *name, BOOL expand_all, BOOL is_remote); -extern char *HTnameOfFile_WWW(const char *name, BOOL WWW_prefix, BOOL expand_all); + extern char *HTURLPath_toFile(const char *name, BOOL expand_all, BOOL is_remote); + extern char *HTnameOfFile_WWW(const char *name, BOOL WWW_prefix, BOOL expand_all); #define HTLocalName(name) HTnameOfFile_WWW(name,TRUE,TRUE) #define HTfullURL_toFile(name) HTnameOfFile_WWW(name,FALSE,TRUE) @@ -53,12 +57,12 @@ extern char *HTnameOfFile_WWW(const char *name, BOOL WWW_prefix, BOOL expand_all /* * Make a WWW name from a full local path name */ -extern char *WWW_nameOfFile(const char *name); + extern char *WWW_nameOfFile(const char *name); /* * Generate the name of a cache file */ -extern char *HTCacheFileName(const char *name); + extern char *HTCacheFileName(const char *name); /* * Output directory titles @@ -69,22 +73,22 @@ extern char *HTCacheFileName(const char *name); * changed to return TRUE if parent directory link was generated, * FALSE otherwise - KW */ -extern BOOL HTDirTitles(HTStructured * target, HTParentAnchor *anchor, - BOOL tildeIsTop); + extern BOOL HTDirTitles(HTStructured * target, HTParentAnchor *anchor, + BOOL tildeIsTop); /* * Check existence. */ -extern int HTStat(const char *filename, - struct stat *data); + extern int HTStat(const char *filename, + struct stat *data); /* Load a document. * ---------------- */ -extern int HTLoadFile(const char *addr, - HTParentAnchor *anchor, - HTFormat format_out, - HTStream *sink); + extern int HTLoadFile(const char *addr, + HTParentAnchor *anchor, + HTFormat format_out, + HTStream *sink); /* * Output a directory entry @@ -92,8 +96,8 @@ extern int HTLoadFile(const char *addr, * This is used by HTFTP.c for example -- it is a common routine for * generating a linked directory entry. */ -extern void HTDirEntry(HTStructured * target, /* in which to put the linked text */ const char *tail, /* last part of directory name */ - const char *entry); /* name of this entry */ + extern void HTDirEntry(HTStructured * target, /* in which to put the linked text */ const char *tail, /* last part of directory name */ + const char *entry); /* name of this entry */ /* * HTSetSuffix: Define the representation for a file suffix @@ -125,11 +129,11 @@ extern void HTDirEntry(HTStructured * target, /* in which to put the linked text * ("application/x-compressed-tar"), but in that case don't use enconding * to also indicate it but use "binary" etc. */ -extern void HTSetSuffix5(const char *suffix, - const char *representation, - const char *encoding, - const char *desc, - double quality); + extern void HTSetSuffix5(const char *suffix, + const char *representation, + const char *encoding, + const char *desc, + double quality); #define HTSetSuffix(suff,rep,enc,q) HTSetSuffix5(suff, rep, enc, NULL, q) @@ -142,9 +146,9 @@ extern void HTSetSuffix5(const char *suffix, * * *pEncoding The encoding (binary, 7bit, etc). See HTSetSuffix. */ -extern HTFormat HTFileFormat(const char *filename, - HTAtom **pEncoding, - const char **pDesc); + extern HTFormat HTFileFormat(const char *filename, + HTAtom **pEncoding, + const char **pDesc); /* * HTCharsetFormat: Revise the file format in relation to the Lynx charset. @@ -154,9 +158,9 @@ extern HTFormat HTFileFormat(const char *filename, * indicated, sets Lynx up for proper handling in relation * to the currently selected character set. - FM */ -extern HTFormat HTCharsetFormat(HTFormat format, - HTParentAnchor *anchor, - int default_LYhndl); + extern HTFormat HTCharsetFormat(HTFormat format, + HTParentAnchor *anchor, + int default_LYhndl); /* Get various pieces of meta info from file name. * ----------------------------------------------- @@ -178,46 +182,46 @@ extern HTFormat HTCharsetFormat(HTFormat format, * through HTuncache_current_document or at the next document load. * - kw */ -extern void LYGetFileInfo(const char *filename, - HTParentAnchor **pfile_anchor, - HTFormat *pformat, - HTAtom **pencoding, - const char **pdesc, - const char **pcharset, - int *pfile_cs); + extern void LYGetFileInfo(const char *filename, + HTParentAnchor **pfile_anchor, + HTFormat *pformat, + HTAtom **pencoding, + const char **pdesc, + const char **pcharset, + int *pfile_cs); /* * Determine file value from file name. */ -extern float HTFileValue(const char *filename); + extern float HTFileValue(const char *filename); /* * Known compression types. */ -typedef enum { - cftNone - ,cftCompress - ,cftGzip - ,cftBzip2 - ,cftDeflate -} CompressFileType; + typedef enum { + cftNone + ,cftCompress + ,cftGzip + ,cftBzip2 + ,cftDeflate + } CompressFileType; /* * Determine compression type from file name, by looking at its suffix. */ -extern CompressFileType HTCompressFileType(const char *filename, - const char *dots, - int *rootlen); + extern CompressFileType HTCompressFileType(const char *filename, + const char *dots, + int *rootlen); /* * Determine compression type from the content-type. */ -extern CompressFileType HTContentToCompressType(const char *encoding); + extern CompressFileType HTContentToCompressType(const char *encoding); /* * Determine compression type from the content-encoding. */ -extern CompressFileType HTEncodingToCompressType(const char *encoding); + extern CompressFileType HTEncodingToCompressType(const char *encoding); /* * Determine write access to a file. @@ -241,25 +245,25 @@ extern CompressFileType HTEncodingToCompressType(const char *encoding); #ifdef VMS #define NO_GROUPS -#endif /* VMS */ +#endif /* VMS */ #ifdef NO_UNIX_IO #define NO_GROUPS -#endif /* NO_UNIX_IO */ +#endif /* NO_UNIX_IO */ #ifdef PCNFS #define NO_GROUPS -#endif /* PCNFS */ +#endif /* PCNFS */ #ifdef NOUSERS #define NO_GROUPS -#endif /* PCNFS */ +#endif /* PCNFS */ -#endif /* HAVE_CONFIG_H */ +#endif /* HAVE_CONFIG_H */ -extern BOOL HTEditable(const char *filename); + extern BOOL HTEditable(const char *filename); /* Make a save stream. * ------------------- */ -extern HTStream *HTFileSaveStream(HTParentAnchor *anchor); + extern HTStream *HTFileSaveStream(HTParentAnchor *anchor); /* * Determine a suitable suffix, given the representation. @@ -274,66 +278,69 @@ extern HTStream *HTFileSaveStream(HTParentAnchor *anchor); * returns a pointer to a suitable suffix string if one has * been found, else NULL. */ -extern const char *HTFileSuffix(HTAtom *rep, - const char *enc); + extern const char *HTFileSuffix(HTAtom *rep, + const char *enc); /* * Enumerate external programs that lynx may assume exists. Unlike those * given in download scripts, etc., lynx would really like to know their * absolute paths, for better security. */ -typedef enum { - ppUnknown = 0 - ,ppBZIP2 - ,ppCHMOD - ,ppCOMPRESS - ,ppCOPY - ,ppCSWING - ,ppGZIP - ,ppINFLATE - ,ppINSTALL - ,ppMKDIR - ,ppMV - ,ppRLOGIN - ,ppRM - ,ppRMDIR - ,ppTAR - ,ppTELNET - ,ppTN3270 - ,ppTOUCH - ,ppUNCOMPRESS - ,ppUNZIP - ,ppUUDECODE - ,ppZCAT - ,ppZIP - ,pp_Last -} ProgramPaths; + typedef enum { + ppUnknown = 0 + ,ppBZIP2 + ,ppCHMOD + ,ppCOMPRESS + ,ppCOPY + ,ppCSWING + ,ppGZIP + ,ppINFLATE + ,ppINSTALL + ,ppMKDIR + ,ppMV + ,ppRLOGIN + ,ppRM + ,ppRMDIR + ,ppTAR + ,ppTELNET + ,ppTN3270 + ,ppTOUCH + ,ppUNCOMPRESS + ,ppUNZIP + ,ppUUDECODE + ,ppZCAT + ,ppZIP + ,pp_Last + } ProgramPaths; /* * Given a program number, return its path */ -extern const char *HTGetProgramPath(ProgramPaths code); + extern const char *HTGetProgramPath(ProgramPaths code); /* * Store a program's path */ -extern void HTSetProgramPath(ProgramPaths code, - const char *path); + extern void HTSetProgramPath(ProgramPaths code, + const char *path); /* * Reset the list of known program paths to the ones that are compiled-in */ -extern void HTInitProgramPaths(void); + extern void HTInitProgramPaths(void); /* * The Protocols */ #ifdef GLOBALREF_IS_MACRO -extern GLOBALREF (HTProtocol, HTFTP); -extern GLOBALREF (HTProtocol, HTFile); + extern GLOBALREF (HTProtocol, HTFTP); + extern GLOBALREF (HTProtocol, HTFile); #else -GLOBALREF HTProtocol HTFTP, HTFile; -#endif /* GLOBALREF_IS_MACRO */ + GLOBALREF HTProtocol HTFTP, HTFile; +#endif /* GLOBALREF_IS_MACRO */ -#endif /* HTFILE_H */ +#ifdef __cplusplus +} +#endif +#endif /* HTFILE_H */ diff --git a/WWW/Library/Implementation/HTFinger.h b/WWW/Library/Implementation/HTFinger.h index bda272ad..071d43bc 100644 --- a/WWW/Library/Implementation/HTFinger.h +++ b/WWW/Library/Implementation/HTFinger.h @@ -9,16 +9,22 @@ #include <HTAccess.h> #include <HTAnchor.h> +#ifdef __cplusplus +extern "C" { +#endif #ifdef GLOBALREF_IS_MACRO -extern GLOBALREF (HTProtocol, HTFinger); + extern GLOBALREF (HTProtocol, HTFinger); #else -GLOBALREF HTProtocol HTFinger; -#endif /* GLOBALREF_IS_MACRO */ + GLOBALREF HTProtocol HTFinger; +#endif /* GLOBALREF_IS_MACRO */ -extern int HTLoadFinger(const char *arg, - HTParentAnchor *anAnchor, - HTFormat format_out, - HTStream *stream); + extern int HTLoadFinger(const char *arg, + HTParentAnchor *anAnchor, + HTFormat format_out, + HTStream *stream); -#endif /* HTFINGER_H */ +#ifdef __cplusplus +} +#endif +#endif /* HTFINGER_H */ diff --git a/WWW/Library/Implementation/HTFormat.c b/WWW/Library/Implementation/HTFormat.c index 43c7892a..85bca424 100644 --- a/WWW/Library/Implementation/HTFormat.c +++ b/WWW/Library/Implementation/HTFormat.c @@ -552,7 +552,7 @@ void HTFilterPresentations(void) s = HTAtom_name(p->rep); p->get_accept = FALSE; - if (LYAcceptMedia & p->accept_opt + if ((LYAcceptMedia & p->accept_opt) != 0 && p->rep_out == WWW_PRESENT && p->rep != WWW_SOURCE && strcasecomp(s, "www/mime") diff --git a/WWW/Library/Implementation/HTFormat.h b/WWW/Library/Implementation/HTFormat.h index ad3df250..903462bb 100644 --- a/WWW/Library/Implementation/HTFormat.h +++ b/WWW/Library/Implementation/HTFormat.h @@ -17,17 +17,23 @@ Preamble #include <HTStream.h> #include <HTAtom.h> #include <HTList.h> +#include <HTAnchor.h> -/* - -The HTFormat type +#ifdef USE_SOURCE_CACHE +#include <HTChunk.h> +#endif - We use the HTAtom object for holding representations. This allows faster manipulation - (comparison and copying) that if we stayed with strings. +#ifdef USE_BZLIB +#include <bzlib.h> +#endif - */ -typedef HTAtom *HTFormat; +#ifdef USE_ZLIB +#include <zlib.h> +#endif +#ifdef __cplusplus +extern "C" { +#endif /* These macros (which used to be constants) define some basic internally @@ -38,10 +44,8 @@ typedef HTAtom *HTFormat; useful for diagnostics, and for users who want to see the original, whatever it is. - */ - /* Internal ones */ -/* #define WWW_SOURCE HTAtom_for("www/source") *//* Whatever it was originally */ -extern HTAtom *WWW_SOURCE; /* calculated once, heavy used */ + *//* Internal ones *//* #define WWW_SOURCE HTAtom_for("www/source") *//* Whatever it was originally */ extern HTAtom *WWW_SOURCE; + /* calculated once, heavy used */ /* @@ -107,36 +111,24 @@ extern HTAtom *WWW_SOURCE; /* calculated once, heavy used */ #define WWW_HTML HTAtom_for("text/html") #define WWW_BINARY HTAtom_for("application/octet-stream") -/* - - We must include the following file after defining HTFormat, to which it - makes reference. - -The HTEncoding type - - */ -typedef HTAtom *HTEncoding; + typedef HTAtom *HTEncoding; /* - - The following are values for the MIME types: - + * The following are values for the MIME types: */ #define WWW_ENC_7BIT HTAtom_for("7bit") #define WWW_ENC_8BIT HTAtom_for("8bit") #define WWW_ENC_BINARY HTAtom_for("binary") /* - - We also add - + * We also add */ #define WWW_ENC_COMPRESS HTAtom_for("compress") /* - Does a string designate a real encoding, or is it just - a "dummy" as for example 7bit, 8bit, and binary? - */ + * Does a string designate a real encoding, or is it just + * a "dummy" as for example 7bit, 8bit, and binary? + */ #define IsUnityEncStr(senc) \ ((senc)==NULL || *(senc)=='\0' || !strcmp(senc,"identity") ||\ !strcmp(senc,"8bit") || !strcmp(senc,"binary") || !strcmp(senc,"7bit")) @@ -145,8 +137,6 @@ typedef HTAtom *HTEncoding; ((enc)==NULL || (enc)==HTAtom_for("identity") ||\ (enc)==WWW_ENC_8BIT || (enc)==WWW_ENC_BINARY || (enc)==WWW_ENC_7BIT) -#include <HTAnchor.h> - /* The HTPresentation and HTConverter types @@ -158,25 +148,25 @@ The HTPresentation and HTConverter types one. See the initialisation module for a list of conversion routines. */ -typedef struct _HTPresentation HTPresentation; + typedef struct _HTPresentation HTPresentation; -typedef HTStream *HTConverter (HTPresentation *pres, - HTParentAnchor *anchor, - HTStream *sink); + typedef HTStream *HTConverter (HTPresentation *pres, + HTParentAnchor *anchor, + HTStream *sink); -struct _HTPresentation { - HTAtom *rep; /* representation name atomized */ - HTAtom *rep_out; /* resulting representation */ - HTConverter *converter; /* routine to gen the stream stack */ - char *command; /* MIME-format command string */ - char *testcommand; /* MIME-format test string */ - float quality; /* Between 0 (bad) and 1 (good) */ - float secs; - float secs_per_byte; - long int maxbytes; - BOOL get_accept; /* list in "Accept:" for GET */ - int accept_opt; /* matches against LYAcceptMedia */ -}; + struct _HTPresentation { + HTAtom *rep; /* representation name atomized */ + HTAtom *rep_out; /* resulting representation */ + HTConverter *converter; /* routine to gen the stream stack */ + char *command; /* MIME-format command string */ + char *testcommand; /* MIME-format test string */ + float quality; /* Between 0 (bad) and 1 (good) */ + float secs; + float secs_per_byte; + long int maxbytes; + BOOL get_accept; /* list in "Accept:" for GET */ + int accept_opt; /* matches against LYAcceptMedia */ + }; /* @@ -184,48 +174,48 @@ struct _HTPresentation { modules which want to know the set of formats supported. for example. */ -extern HTList *HTPresentations; + extern HTList *HTPresentations; /* The default presentation is used when no other is appropriate */ -extern HTPresentation *default_presentation; + extern HTPresentation *default_presentation; /* * Options used for "Accept:" string */ -typedef enum { - /* make the components powers of two so we can add them */ - mediaINT = 1 /* internal types predefined in HTInit.c */ - ,mediaEXT = 2 /* external types predefined in HTInit.c */ - ,mediaCFG = 4 /* types, e.g., viewers, from lynx.cfg */ - ,mediaUSR = 8 /* user's mime-types, etc. */ - ,mediaSYS = 16 /* system's mime-types, etc. */ - /* these are useful flavors for the options menu */ - ,mediaOpt1 = mediaINT - ,mediaOpt2 = mediaINT + mediaCFG - ,mediaOpt3 = mediaINT + mediaCFG + mediaUSR - ,mediaOpt4 = mediaINT + mediaCFG + mediaUSR + mediaSYS - /* this is the flavor from pre-2.8.6 */ - ,mediaALL = mediaINT + mediaEXT + mediaCFG + mediaUSR + mediaSYS -} AcceptMedia; + typedef enum { + /* make the components powers of two so we can add them */ + mediaINT = 1 /* internal types predefined in HTInit.c */ + ,mediaEXT = 2 /* external types predefined in HTInit.c */ + ,mediaCFG = 4 /* types, e.g., viewers, from lynx.cfg */ + ,mediaUSR = 8 /* user's mime-types, etc. */ + ,mediaSYS = 16 /* system's mime-types, etc. */ + /* these are useful flavors for the options menu */ + ,mediaOpt1 = mediaINT + ,mediaOpt2 = mediaINT + mediaCFG + ,mediaOpt3 = mediaINT + mediaCFG + mediaUSR + ,mediaOpt4 = mediaINT + mediaCFG + mediaUSR + mediaSYS + /* this is the flavor from pre-2.8.6 */ + ,mediaALL = mediaINT + mediaEXT + mediaCFG + mediaUSR + mediaSYS + } AcceptMedia; /* * Options used for "Accept-Encoding:" string */ -typedef enum { - encodingNONE = 0 - ,encodingGZIP = 1 - ,encodingDEFLATE = 2 - ,encodingCOMPRESS = 4 - ,encodingBZIP2 = 8 - ,encodingALL = (encodingGZIP - + encodingDEFLATE - + encodingCOMPRESS - + encodingBZIP2) -} AcceptEncoding; + typedef enum { + encodingNONE = 0 + ,encodingGZIP = 1 + ,encodingDEFLATE = 2 + ,encodingCOMPRESS = 4 + ,encodingBZIP2 = 8 + ,encodingALL = (encodingGZIP + + encodingDEFLATE + + encodingCOMPRESS + + encodingBZIP2) + } AcceptEncoding; /* @@ -249,15 +239,15 @@ HTSetPresentation: Register a system command to present a format media Used in filtering presentation types for "Accept:" */ -extern void HTSetPresentation(const char *representation, - const char *command, - const char *testcommand, - double quality, - double secs, - double secs_per_byte, - long int maxbytes, - AcceptMedia media -); + extern void HTSetPresentation(const char *representation, + const char *command, + const char *testcommand, + double quality, + double secs, + double secs_per_byte, + long int maxbytes, + AcceptMedia media + ); /* @@ -273,15 +263,15 @@ HTSetConversion: Register a converstion routine */ -extern void HTSetConversion(const char *rep_in, - const char *rep_out, - HTConverter *converter, - float quality, - float secs, - float secs_per_byte, - long int maxbytes, - AcceptMedia media -); + extern void HTSetConversion(const char *rep_in, + const char *rep_out, + HTConverter *converter, + float quality, + float secs, + float secs_per_byte, + long int maxbytes, + AcceptMedia media + ); /* @@ -295,10 +285,10 @@ HTStreamStack: Create a stack of streams load information into the anchor object which represents them. */ -extern HTStream *HTStreamStack(HTFormat format_in, - HTFormat format_out, - HTStream *stream_out, - HTParentAnchor *anchor); + extern HTStream *HTStreamStack(HTFormat format_in, + HTFormat format_out, + HTStream *stream_out, + HTParentAnchor *anchor); /* HTReorderPresentation: put presentation near head of list @@ -307,14 +297,14 @@ HTReorderPresentation: put presentation near head of list start of the HTPresentations list. - kw */ -extern void HTReorderPresentation(HTFormat format_in, - HTFormat format_out); + extern void HTReorderPresentation(HTFormat format_in, + HTFormat format_out); /* * Setup 'get_accept' flag to denote presentations that are not redundant, * and will be listed in "Accept:" header. */ -extern void HTFilterPresentations(void); + extern void HTFilterPresentations(void); /* @@ -334,10 +324,10 @@ HTStackValue: Find the cost of a filter stack length The number of bytes expected in the input format */ -extern float HTStackValue(HTFormat format_in, - HTFormat rep_out, - float initial_value, - long int length); + extern float HTStackValue(HTFormat format_in, + HTFormat rep_out, + float initial_value, + long int length); #define NO_VALUE_FOUND -1e20 /* returned if none found */ @@ -348,9 +338,9 @@ extern float HTStackValue(HTFormat format_in, * This is a traverse call for HText_pageDispaly() - it works!. * */ -extern void HTDisplayPartial(void); + extern void HTDisplayPartial(void); -extern void HTFinishDisplayPartial(void); + extern void HTFinishDisplayPartial(void); /* @@ -360,10 +350,10 @@ HTCopy: Copy a socket to a stream one which has been generated by HTStreamStack. */ -extern int HTCopy(HTParentAnchor *anchor, - int file_number, - void *handle, - HTStream *sink); + extern int HTCopy(HTParentAnchor *anchor, + int file_number, + void *handle, + HTStream *sink); /* @@ -374,11 +364,10 @@ HTFileCopy: Copy a file to a stream HTParseFile */ -extern int HTFileCopy(FILE *fp, - HTStream *sink); + extern int HTFileCopy(FILE *fp, + HTStream *sink); #ifdef USE_SOURCE_CACHE -#include <HTChunk.h> /* HTMemCopy: Copy a memory chunk to a stream @@ -388,8 +377,8 @@ HTMemCopy: Copy a memory chunk to a stream HTParseMem */ -extern int HTMemCopy(HTChunk *chunk, - HTStream *sink); + extern int HTMemCopy(HTChunk *chunk, + HTStream *sink); #endif /* @@ -400,9 +389,9 @@ HTCopyNoCR: Copy a socket to a stream, stripping CR characters. */ -extern void HTCopyNoCR(HTParentAnchor *anchor, - int file_number, - HTStream *sink); + extern void HTCopyNoCR(HTParentAnchor *anchor, + int file_number, + HTStream *sink); /* @@ -414,15 +403,15 @@ Clear input buffer and set file number small implementations. */ -extern void HTInitInput(int file_number); + extern void HTInitInput(int file_number); /* Get next character from buffer */ -extern int interrupted_in_htgetcharacter; -extern int HTGetCharacter(void); + extern int interrupted_in_htgetcharacter; + extern int HTGetCharacter(void); /* @@ -433,11 +422,11 @@ HTParseSocket: Parse a socket given its format <0 if not. */ -extern int HTParseSocket(HTFormat format_in, - HTFormat format_out, - HTParentAnchor *anchor, - int file_number, - HTStream *sink); + extern int HTParseSocket(HTFormat format_in, + HTFormat format_out, + HTParentAnchor *anchor, + int file_number, + HTStream *sink); /* @@ -448,11 +437,11 @@ HTParseFile: Parse a File through a file pointer return HT_PARTIAL_CONTENT, HT_NO_DATA, or other <0 for failure. */ -extern int HTParseFile(HTFormat format_in, - HTFormat format_out, - HTParentAnchor *anchor, - FILE *fp, - HTStream *sink); + extern int HTParseFile(HTFormat format_in, + HTFormat format_out, + HTParentAnchor *anchor, + FILE *fp, + HTStream *sink); #ifdef USE_SOURCE_CACHE /* @@ -464,15 +453,14 @@ HTParseMem: Parse a document in memory return <0 for failure. */ -extern int HTParseMem(HTFormat format_in, - HTFormat format_out, - HTParentAnchor *anchor, - HTChunk *chunk, - HTStream *sink); + extern int HTParseMem(HTFormat format_in, + HTFormat format_out, + HTParentAnchor *anchor, + HTChunk *chunk, + HTStream *sink); #endif #ifdef USE_ZLIB -#include <zlib.h> /* HTParseGzFile: Parse a gzip'ed File through a file pointer @@ -480,11 +468,11 @@ HTParseGzFile: Parse a gzip'ed File through a file pointer HTStreamStack and HTGzFileCopy. Returns HT_LOADED if successful, can also return HT_PARTIAL_CONTENT, HT_NO_DATA, or other <0 for failure. */ -extern int HTParseGzFile(HTFormat format_in, - HTFormat format_out, - HTParentAnchor *anchor, - gzFile gzfp, - HTStream *sink); + extern int HTParseGzFile(HTFormat format_in, + HTFormat format_out, + HTParentAnchor *anchor, + gzFile gzfp, + HTStream *sink); /* HTParseZzFile: Parse a deflate'd File through a file pointer @@ -493,16 +481,15 @@ HTParseZzFile: Parse a deflate'd File through a file pointer HTStreamStack and HTZzFileCopy. Returns HT_LOADED if successful, can also return HT_PARTIAL_CONTENT, HT_NO_DATA, or other <0 for failure. */ -extern int HTParseZzFile(HTFormat format_in, - HTFormat format_out, - HTParentAnchor *anchor, - FILE *zzfp, - HTStream *sink); + extern int HTParseZzFile(HTFormat format_in, + HTFormat format_out, + HTParentAnchor *anchor, + FILE *zzfp, + HTStream *sink); -#endif /* USE_ZLIB */ +#endif /* USE_ZLIB */ #ifdef USE_BZLIB -#include <bzlib.h> /* HTParseBzFile: Parse a bzip2'ed File through a file pointer @@ -510,13 +497,13 @@ HTParseBzFile: Parse a bzip2'ed File through a file pointer HTStreamStack and HTGzFileCopy. Returns HT_LOADED if successful, can also return HT_PARTIAL_CONTENT, HT_NO_DATA, or other <0 for failure. */ -extern int HTParseBzFile(HTFormat format_in, - HTFormat format_out, - HTParentAnchor *anchor, - BZFILE * bzfp, - HTStream *sink); + extern int HTParseBzFile(HTFormat format_in, + HTFormat format_out, + HTParentAnchor *anchor, + BZFILE * bzfp, + HTStream *sink); -#endif /* USE_BZLIB */ +#endif /* USE_BZLIB */ /* @@ -528,7 +515,7 @@ HTNetToText: Convert Net ASCII to local representation creating it. */ -extern HTStream *HTNetToText(HTStream *sink); + extern HTStream *HTNetToText(HTStream *sink); /* @@ -542,13 +529,16 @@ HTFormatInit: Set up default presentations and conversions defaults as well. */ -extern void HTFormatInit(void); + extern void HTFormatInit(void); /* Epilogue */ -extern BOOL HTOutputSource; /* Flag: shortcut parser */ + extern BOOL HTOutputSource; /* Flag: shortcut parser */ -#endif /* HTFORMAT_H */ +#ifdef __cplusplus +} +#endif +#endif /* HTFORMAT_H */ diff --git a/WWW/Library/Implementation/HTGopher.c b/WWW/Library/Implementation/HTGopher.c index d45c8bcf..49a8ce83 100644 --- a/WWW/Library/Implementation/HTGopher.c +++ b/WWW/Library/Implementation/HTGopher.c @@ -109,7 +109,7 @@ typedef struct _CSOfield_info { /* For form-based CSO gateway - FM */ int defreturn; int explicit_return; int reserved; - int public; + int gpublic; 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 */ @@ -773,7 +773,7 @@ static void interpret_cso_key(const char *key, * 'Query' fields, public and lookup attributes. */ for (; fld; fld = fld->next) - if (fld->public && (fld->lookup == 1)) + if (fld->gpublic && (fld->lookup == 1)) break; break; case 1: @@ -789,7 +789,7 @@ static void interpret_cso_key(const char *key, * 'Return' fields, public only. */ for (; fld; fld = fld->next) - if (fld->public) + if (fld->gpublic) break; break; case 3: @@ -867,7 +867,7 @@ static int parse_cso_field_info(CSOfield_info *blk) * 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; + blk->defreturn = blk->explicit_return = blk->gpublic = 0; /* * Search for keywords in info string and set values. Attributes are @@ -880,7 +880,7 @@ static int parse_cso_field_info(CSOfield_info *blk) if (strstr(info, "default ")) blk->defreturn = 1; if (strstr(info, "public ")) - blk->public = 1; + blk->gpublic = 1; if (strstr(info, "lookup ")) blk->lookup = 1; if (strstr(info, "url ")) { @@ -908,7 +908,7 @@ static int parse_cso_fields(char *buf, int i, code = 0, prev_code; size_t alen; char *indx, *name; - CSOfield_info *last, *new; + CSOfield_info *last, *newf; last = CSOfields = (CSOfield_info *) 0; prev_code = -2555; @@ -1008,43 +1008,43 @@ static int parse_cso_fields(char *buf, * Initialize new block, append to end of list to * preserve order. */ - new = typecalloc(CSOfield_info); + newf = typecalloc(CSOfield_info); - if (!new) { + if (!newf) { outofmem(__FILE__, "HTLoadCSO"); } if (last) - last->next = new; + last->next = newf; else - CSOfields = new; - last = new; + CSOfields = newf; + last = newf; - new->next = (CSOfield_info *) 0; - new->name = new->name_buf; + newf->next = (CSOfield_info *) 0; + newf->name = newf->name_buf; alen = strlen(name) + 1; - if (alen > sizeof(new->name_buf)) { - if (!(new->name = (char *) malloc(alen))) { + if (alen > sizeof(newf->name_buf)) { + if (!(newf->name = (char *) malloc(alen))) { outofmem(__FILE__, "HTLoadCSO"); } } - strcpy(new->name, name); + strcpy(newf->name, name); - new->attributes = new->attr_buf; + newf->attributes = newf->attr_buf; alen = strlen((char *) &p[i]) + 2; - if (alen > sizeof(new->attr_buf)) { - if (!(new->attributes = (char *) malloc(alen))) { + if (alen > sizeof(newf->attr_buf)) { + if (!(newf->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); + strcpy(newf->attributes, (char *) &p[i]); + strcpy((char *) &newf->attributes[alen - 2], " "); + newf->description = newf->desc_buf; + newf->desc_buf[0] = '\0'; + newf->id = atoi(indx); /* * Scan for keywords. */ - parse_cso_field_info(new); + parse_cso_field_info(newf); } prev_code = code; } else @@ -1077,7 +1077,7 @@ static int generate_cso_form(char *host, const char *key; const char *line; CSOformgen_context ctx; - static const char *template[] = + static const char *ctemplate[] = { "<HTML>\n<HEAD>\n<TITLE>CSO/PH Query Form for $(HOST)</TITLE>\n</HEAD>\n<BODY>", "<H2><I>CSO/PH Query Form</I> for <EM>$(HOST)</EM></H2>", @@ -1119,12 +1119,12 @@ static int generate_cso_form(char *host, out = 0; buf[out] = '\0'; for (i = full_flag ? /***1***/ 0 : 0; - template[i]; + ctemplate[i]; i++) { /* * Search the current string for substitution, flagged by $( */ - for (line = template[i], j = 0; line[j]; j++) { + for (line = ctemplate[i], j = 0; line[j]; j++) { if ((line[j] == '$') && (line[j + 1] == '(')) { /* * Command detected, flush output buffer and find closing ')' @@ -1143,7 +1143,7 @@ static int generate_cso_form(char *host, interpret_cso_key(key, buf, &length, &ctx, Target); i = ctx.cur_line; j = ctx.cur_off; - line = template[i]; + line = ctemplate[i]; out = length; if (ctx.seek) { @@ -1153,15 +1153,15 @@ static int generate_cso_form(char *host, */ int slen = strlen(ctx.seek); - for (; template[i]; i++) { - for (line = template[i]; line[j]; j++) { + for (; ctemplate[i]; i++) { + for (line = ctemplate[i]; line[j]; j++) { if (line[j] == '$') if (0 == strncmp(ctx.seek, &line[j], slen)) { if (j == 0) - j = strlen(template[--i]) - 1; + j = strlen(ctemplate[--i]) - 1; else --j; - line = template[i]; + line = ctemplate[i]; ctx.seek = (char *) 0; break; } diff --git a/WWW/Library/Implementation/HTGopher.h b/WWW/Library/Implementation/HTGopher.h index c0207fb4..667fc24e 100644 --- a/WWW/Library/Implementation/HTGopher.h +++ b/WWW/Library/Implementation/HTGopher.h @@ -13,11 +13,17 @@ #include <HTAccess.h> #include <HTAnchor.h> +#ifdef __cplusplus +extern "C" { +#endif #ifdef GLOBALREF_IS_MACRO -extern GLOBALREF (HTProtocol, HTGopher); + extern GLOBALREF (HTProtocol, HTGopher); #else -GLOBALREF HTProtocol HTGopher; -#endif /* GLOBALREF_IS_MACRO */ + GLOBALREF HTProtocol HTGopher; +#endif /* GLOBALREF_IS_MACRO */ -#endif /* HTGOPHER_H */ +#ifdef __cplusplus +} +#endif +#endif /* HTGOPHER_H */ diff --git a/WWW/Library/Implementation/HTGroup.c b/WWW/Library/Implementation/HTGroup.c index c56127bb..3bbec6d1 100644 --- a/WWW/Library/Implementation/HTGroup.c +++ b/WWW/Library/Implementation/HTGroup.c @@ -506,10 +506,10 @@ static BOOL part_match(const char *tcur, * ON EXIT: * returns YES, if match; NO, if not. */ -static BOOL ip_number_match(const char *template, +static BOOL ip_number_match(const char *ctemplate, const char *the_inet_addr) { - const char *tcur = template; + const char *tcur = ctemplate; const char *icur = the_inet_addr; int cnt; diff --git a/WWW/Library/Implementation/HTGroup.h b/WWW/Library/Implementation/HTGroup.h index cf9cbb19..78745656 100644 --- a/WWW/Library/Implementation/HTGroup.h +++ b/WWW/Library/Implementation/HTGroup.h @@ -7,31 +7,34 @@ #include <HTList.h> -typedef HTList GroupDefList; -typedef HTList ItemList; +#ifdef __cplusplus +extern "C" { +#endif + typedef HTList GroupDefList; + typedef HTList ItemList; -typedef struct { - char *group_name; - ItemList *item_list; -} GroupDef; + typedef struct { + char *group_name; + ItemList *item_list; + } GroupDef; /* * Access Authorization failure reasons */ -typedef enum { - HTAA_OK, /* 200 OK */ - HTAA_OK_GATEWAY, /* 200 OK, acting as a gateway */ - HTAA_NO_AUTH, /* 401 Unauthorized, not authenticated */ - HTAA_NOT_MEMBER, /* 401 Unauthorized, not authorized */ - HTAA_IP_MASK, /* 403 Forbidden by IP mask */ - HTAA_BY_RULE, /* 403 Forbidden by rule */ - HTAA_NO_ACL, /* 403 Forbidden, ACL non-existent */ - HTAA_NO_ENTRY, /* 403 Forbidden, no ACL entry */ - HTAA_SETUP_ERROR, /* 403 Forbidden, server setup error */ - HTAA_DOTDOT, /* 403 Forbidden, URL with /../ illegal */ - HTAA_HTBIN, /* 403 Forbidden, /htbin not enabled */ - HTAA_NOT_FOUND /* 404 Not found, or read protected */ -} HTAAFailReasonType; + typedef enum { + HTAA_OK, /* 200 OK */ + HTAA_OK_GATEWAY, /* 200 OK, acting as a gateway */ + HTAA_NO_AUTH, /* 401 Unauthorized, not authenticated */ + HTAA_NOT_MEMBER, /* 401 Unauthorized, not authorized */ + HTAA_IP_MASK, /* 403 Forbidden by IP mask */ + HTAA_BY_RULE, /* 403 Forbidden by rule */ + HTAA_NO_ACL, /* 403 Forbidden, ACL non-existent */ + HTAA_NO_ENTRY, /* 403 Forbidden, no ACL entry */ + HTAA_SETUP_ERROR, /* 403 Forbidden, server setup error */ + HTAA_DOTDOT, /* 403 Forbidden, URL with /../ illegal */ + HTAA_HTBIN, /* 403 Forbidden, /htbin not enabled */ + HTAA_NOT_FOUND /* 404 Not found, or read protected */ + } HTAAFailReasonType; /* @@ -98,7 +101,7 @@ Group definition grammar */ -extern GroupDef *HTAA_parseGroupDef(FILE *fp); + extern GroupDef *HTAA_parseGroupDef(FILE *fp); /* @@ -109,8 +112,8 @@ Fill in Pointers to referenced Group Definitions in a Group Definition */ -extern void HTAA_resolveGroupReferences(GroupDef *group_def, - GroupDefList *group_def_list); + extern void HTAA_resolveGroupReferences(GroupDef *group_def, + GroupDefList *group_def_list); /* @@ -121,7 +124,7 @@ Read Group File (and do caching) */ -extern GroupDefList *HTAA_readGroupFile(const char *filename); + extern GroupDefList *HTAA_readGroupFile(const char *filename); /* @@ -132,7 +135,7 @@ Delete Group Definition */ -extern void GroupDef_delete(GroupDef *group_def); + extern void GroupDef_delete(GroupDef *group_def); /* @@ -140,7 +143,7 @@ Print Out Group Definition (for trace purposes) */ -extern void HTAA_printGroupDef(GroupDef *group_def); + extern void HTAA_printGroupDef(GroupDef *group_def); /* @@ -168,9 +171,12 @@ Does a User Belong to a Given Set of Groups * to the group. * HTAA_OK if both IP address and user are ok. */ -extern HTAAFailReasonType HTAA_userAndInetInGroup(GroupDef *group, - char *username, - char *ip_number, - char *ip_name); - -#endif /* not HTGROUP_H */ + extern HTAAFailReasonType HTAA_userAndInetInGroup(GroupDef *group, + char *username, + char *ip_number, + char *ip_name); + +#ifdef __cplusplus +} +#endif +#endif /* not HTGROUP_H */ diff --git a/WWW/Library/Implementation/HTInit.h b/WWW/Library/Implementation/HTInit.h index 81441421..4fc70003 100644 --- a/WWW/Library/Implementation/HTInit.h +++ b/WWW/Library/Implementation/HTInit.h @@ -18,11 +18,17 @@ #include <HTUtils.h> #endif -extern void HTFormatInit(void); -extern void HTPreparsedFormatInit(void); -extern void HTFileInit(void); -extern int LYTestMailcapCommand(const char *testcommand, const char *params); -extern BOOL LYMailcapUsesPctS(const char *controlstring); -extern char *LYMakeMailcapCommand(const char *command, const char *params, const char *filename); +#ifdef __cplusplus +extern "C" { +#endif + extern void HTFormatInit(void); + extern void HTPreparsedFormatInit(void); + extern void HTFileInit(void); + extern int LYTestMailcapCommand(const char *testcommand, const char *params); + extern BOOL LYMailcapUsesPctS(const char *controlstring); + extern char *LYMakeMailcapCommand(const char *command, const char *params, const char *filename); -#endif /* HTINIT_H */ +#ifdef __cplusplus +} +#endif +#endif /* HTINIT_H */ diff --git a/WWW/Library/Implementation/HTLex.h b/WWW/Library/Implementation/HTLex.h index c647b61f..fde90348 100644 --- a/WWW/Library/Implementation/HTLex.h +++ b/WWW/Library/Implementation/HTLex.h @@ -9,21 +9,24 @@ #include <HTUtils.h> #endif -typedef enum { - LEX_NONE, /* Internally used */ - LEX_EOF, /* End of file */ - LEX_REC_SEP, /* Record separator */ - LEX_FIELD_SEP, /* Field separator */ - LEX_ITEM_SEP, /* List item separator */ - LEX_OPEN_PAREN, /* Group start tag */ - LEX_CLOSE_PAREN, /* Group end tag */ - LEX_AT_SIGN, /* Address qualifier */ - LEX_ALPH_STR, /* Alphanumeric string */ - LEX_TMPL_STR /* Template string */ -} LexItem; - -extern char HTlex_buffer[]; /* Read lexical string */ -extern int HTlex_line; /* Line number in source file */ +#ifdef __cplusplus +extern "C" { +#endif + typedef enum { + LEX_NONE, /* Internally used */ + LEX_EOF, /* End of file */ + LEX_REC_SEP, /* Record separator */ + LEX_FIELD_SEP, /* Field separator */ + LEX_ITEM_SEP, /* List item separator */ + LEX_OPEN_PAREN, /* Group start tag */ + LEX_CLOSE_PAREN, /* Group end tag */ + LEX_AT_SIGN, /* Address qualifier */ + LEX_ALPH_STR, /* Alphanumeric string */ + LEX_TMPL_STR /* Template string */ + } LexItem; + + extern char HTlex_buffer[]; /* Read lexical string */ + extern int HTlex_line; /* Line number in source file */ /* @@ -33,7 +36,7 @@ Get Next Lexical Item */ -extern LexItem lex(FILE *fp); + extern LexItem lex(FILE *fp); /* @@ -41,7 +44,7 @@ Push Back Latest Item */ -extern void unlex(LexItem lex_item); + extern void unlex(LexItem lex_item); /* @@ -49,10 +52,13 @@ Get the Name for Lexical Item */ -extern const char *lex_verbose(LexItem lex_item); + extern const char *lex_verbose(LexItem lex_item); /* */ -#endif /* not HTLEX_H */ +#ifdef __cplusplus +} +#endif +#endif /* not HTLEX_H */ diff --git a/WWW/Library/Implementation/HTList.h b/WWW/Library/Implementation/HTList.h index 8a5ed0f2..93f91473 100644 --- a/WWW/Library/Implementation/HTList.h +++ b/WWW/Library/Implementation/HTList.h @@ -11,12 +11,15 @@ #include <HTUtils.h> #endif -typedef struct _HTList HTList; +#ifdef __cplusplus +extern "C" { +#endif + typedef struct _HTList HTList; -struct _HTList { - void *object; - HTList *next; -}; + struct _HTList { + void *object; + HTList *next; + }; /* Fast macro to traverse a list. Call it first with copy of the list * header. It returns the first object and increments the passed list @@ -37,79 +40,79 @@ struct _HTList { /* Create list. */ -extern HTList *HTList_new(void); + extern HTList *HTList_new(void); /* Delete list. */ -extern void HTList_delete(HTList *me); + extern void HTList_delete(HTList *me); /* Reverse a list. */ -extern HTList *HTList_reverse(HTList *start); + extern HTList *HTList_reverse(HTList *start); /* Append two lists, making second list empty. */ -extern HTList *HTList_appendList(HTList *start, - HTList *tail); + extern HTList *HTList_appendList(HTList *start, + HTList *tail); /* Add object to START of list (so it is pointed to by the head). */ -extern void HTList_addObject(HTList *me, - void *newObject); + extern void HTList_addObject(HTList *me, + void *newObject); /* Append object to END of list (furthest from the head). */ -extern void HTList_appendObject(HTList *me, - void *newObject); + extern void HTList_appendObject(HTList *me, + void *newObject); /* Insert an object into the list at a specified position. * If position is 0, this places the object at the head of the list * and is equivalent to HTList_addObject(). */ -extern void HTList_insertObjectAt(HTList *me, - void *newObject, - int pos); + extern void HTList_insertObjectAt(HTList *me, + void *newObject, + int pos); /* Remove specified object from list. */ -extern BOOL HTList_removeObject(HTList *me, - void *oldObject); + extern BOOL HTList_removeObject(HTList *me, + void *oldObject); /* Remove object at a given position in the list, where 0 is the * object pointed to by the head (returns a pointer to the element * (->object) for the object, and NULL if the list is empty, or * if it doesn't exist - Yuk!). */ -extern void *HTList_removeObjectAt(HTList *me, - int position); + extern void *HTList_removeObjectAt(HTList *me, + int position); /* Remove object from START of list (the Last one inserted * via HTList_addObject(), and pointed to by the head). */ -extern void *HTList_removeLastObject(HTList *me); + extern void *HTList_removeLastObject(HTList *me); /* Remove object from END of list (the First one inserted * via HTList_addObject(), and furthest from the head). */ -extern void *HTList_removeFirstObject(HTList *me); + extern void *HTList_removeFirstObject(HTList *me); /* Determine total number of objects in the list, * not counting the head. */ -extern int HTList_count(HTList *me); + extern int HTList_count(HTList *me); /* Determine position of an object in the list (a value of 0 * means it is pointed to by the head; returns -1 if not found). */ -extern int HTList_indexOf(HTList *me, - void *object); + extern int HTList_indexOf(HTList *me, + void *object); /* Return pointer to the object at a specified position in the list, * where 0 is the object pointed to by the head (returns NULL if * the list is empty, or if it doesn't exist - Yuk!). */ -extern void *HTList_objectAt(HTList *me, - int position); + extern void *HTList_objectAt(HTList *me, + int position); /* Link object to START of list (so it is pointed to by the head). * @@ -117,20 +120,23 @@ extern void *HTList_objectAt(HTList *me, * it use already allocated memory which should not be free'd by any * list operations (optimization). */ -extern void HTList_linkObject(HTList *me, - void *newObject, - HTList *newNode); + extern void HTList_linkObject(HTList *me, + void *newObject, + HTList *newNode); /* Unlink object from START of list (the Last one inserted * via HTList_linkObject(), and pointed to by the head). * It does not free memory. */ -extern void *HTList_unlinkLastObject(HTList *me); + extern void *HTList_unlinkLastObject(HTList *me); /* Unlink specified object from list. * It does not free memory. */ -extern BOOL HTList_unlinkObject(HTList *me, - void *oldObject); + extern BOOL HTList_unlinkObject(HTList *me, + void *oldObject); -#endif /* HTLIST_H */ +#ifdef __cplusplus +} +#endif +#endif /* HTLIST_H */ diff --git a/WWW/Library/Implementation/HTMIME.h b/WWW/Library/Implementation/HTMIME.h index a7650a98..e8ecb3b4 100644 --- a/WWW/Library/Implementation/HTMIME.h +++ b/WWW/Library/Implementation/HTMIME.h @@ -26,60 +26,65 @@ #include <HTStream.h> #include <HTAnchor.h> +#ifdef __cplusplus +extern "C" { +#endif /* * This function is for trimming off any paired * open- and close-double quotes from header values. * It does not parse the string for embedded quotes, * and will not modify the string unless both the * first and last characters are double-quotes. - FM - */ -extern void HTMIME_TrimDoubleQuotes(char *value); + */ extern void HTMIME_TrimDoubleQuotes(char *value); /* INPUT: LOCAL TEXT */ -extern HTStream *HTMIMEConvert(HTPresentation *pres, - HTParentAnchor *anchor, - HTStream *sink); + extern HTStream *HTMIMEConvert(HTPresentation *pres, + HTParentAnchor *anchor, + HTStream *sink); /* INPUT: NET ASCII */ -extern HTStream *HTNetMIME(HTPresentation *pres, - HTParentAnchor *anchor, - HTStream *sink); + extern HTStream *HTNetMIME(HTPresentation *pres, + HTParentAnchor *anchor, + HTStream *sink); /* INPUT: Redirection message, parse headers only for Location if present */ -extern HTStream *HTMIMERedirect(HTPresentation *pres, - HTParentAnchor *anchor, - HTStream *sink); + extern HTStream *HTMIMERedirect(HTPresentation *pres, + HTParentAnchor *anchor, + HTStream *sink); /* For handling Japanese headers. */ -extern void HTmmdec_base64(char *t, - char *s); + extern void HTmmdec_base64(char *t, + char *s); -extern void HTmmdec_quote(char *t, - char *s); + extern void HTmmdec_quote(char *t, + char *s); -extern void HTmmdecode(char *trg, - char *str); + extern void HTmmdecode(char *trg, + char *str); -extern int HTrjis(char *t, - char *s); + extern int HTrjis(char *t, + char *s); -extern int HTmaybekanji(int c1, - int c2); + extern int HTmaybekanji(int c1, + int c2); -#endif /* !HTMIME_H */ +#ifdef __cplusplus +} +#endif +#endif /* !HTMIME_H */ diff --git a/WWW/Library/Implementation/HTMLDTD.h b/WWW/Library/Implementation/HTMLDTD.h index c1245d3b..248760fc 100644 --- a/WWW/Library/Implementation/HTMLDTD.h +++ b/WWW/Library/Implementation/HTMLDTD.h @@ -15,151 +15,149 @@ #include <SGML.h> #include <HTFont.h> +#ifdef __cplusplus +extern "C" { +#endif /* * Valid name chars for tag parsing. */ #define IsNmStart(c) (isalpha(UCH(c))) #define IsNmChar(c) (isalnum(UCH(c)) || \ c == '_' || c=='-' || c == '.' || c==':') - #define ReallyEmptyTagNum(e) ((HTML_dtd.tags[e].contents == SGML_EMPTY) && \ !(HTML_dtd.tags[e].flags & Tgf_nreie)) #define ReallyEmptyTag(t) ((t->contents == SGML_EMPTY) && \ !(t->flags & Tgf_nreie)) - /* Element Numbers - */ - -/* + *//* Must Match all tables by element! These include tables in HTMLDTD.c and code in HTML.c. - */ -typedef enum { - HTML_A, - HTML_ABBREV, - HTML_ACRONYM, - HTML_ADDRESS, - HTML_APPLET, - HTML_AREA, - HTML_AU, - HTML_AUTHOR, - HTML_B, - HTML_BANNER, - HTML_BASE, - HTML_BASEFONT, - HTML_BDO, - HTML_BGSOUND, - HTML_BIG, - HTML_BLINK, - HTML_BLOCKQUOTE, - HTML_BODY, - HTML_BODYTEXT, - HTML_BQ, - HTML_BR, - HTML_BUTTON, - HTML_CAPTION, - HTML_CENTER, - HTML_CITE, - HTML_CODE, - HTML_COL, - HTML_COLGROUP, - HTML_COMMENT, - HTML_CREDIT, - HTML_DD, - HTML_DEL, - HTML_DFN, - HTML_DIR, - HTML_DIV, - HTML_DL, - HTML_DLC, - HTML_DT, - HTML_EM, - HTML_EMBED, - HTML_FIELDSET, - HTML_FIG, - HTML_FN, - HTML_FONT, - HTML_FORM, - HTML_FRAME, - HTML_FRAMESET, - HTML_H1, - HTML_H2, - HTML_H3, - HTML_H4, - HTML_H5, - HTML_H6, - HTML_HEAD, - HTML_HR, - HTML_HTML, - HTML_HY, - HTML_I, - HTML_IFRAME, - HTML_IMG, - HTML_INPUT, - HTML_INS, - HTML_ISINDEX, - HTML_KBD, - HTML_KEYGEN, - HTML_LABEL, - HTML_LEGEND, - HTML_LH, - HTML_LI, - HTML_LINK, - HTML_LISTING, - HTML_MAP, - HTML_MARQUEE, - HTML_MATH, - HTML_MENU, - HTML_META, - HTML_NEXTID, - HTML_NOFRAMES, - HTML_NOTE, - HTML_OBJECT, - HTML_OL, - HTML_OPTION, - HTML_OVERLAY, - HTML_P, - HTML_PARAM, - HTML_PLAINTEXT, - HTML_PRE, - HTML_Q, - HTML_S, - HTML_SAMP, - HTML_SCRIPT, - HTML_SELECT, - HTML_SHY, - HTML_SMALL, - HTML_SPAN, - HTML_SPOT, - HTML_STRIKE, - HTML_STRONG, - HTML_STYLE, - HTML_SUB, - HTML_SUP, - HTML_TAB, - HTML_TABLE, - HTML_TBODY, - HTML_TD, - HTML_TEXTAREA, - HTML_TEXTFLOW, - HTML_TFOOT, - HTML_TH, - HTML_THEAD, - HTML_TITLE, - HTML_TR, - HTML_TT, - HTML_U, - HTML_UL, - HTML_VAR, - HTML_WBR, - HTML_XMP, - HTML_ALT_OBJECT -} HTMLElement; + */ typedef enum { + HTML_A, + HTML_ABBREV, + HTML_ACRONYM, + HTML_ADDRESS, + HTML_APPLET, + HTML_AREA, + HTML_AU, + HTML_AUTHOR, + HTML_B, + HTML_BANNER, + HTML_BASE, + HTML_BASEFONT, + HTML_BDO, + HTML_BGSOUND, + HTML_BIG, + HTML_BLINK, + HTML_BLOCKQUOTE, + HTML_BODY, + HTML_BODYTEXT, + HTML_BQ, + HTML_BR, + HTML_BUTTON, + HTML_CAPTION, + HTML_CENTER, + HTML_CITE, + HTML_CODE, + HTML_COL, + HTML_COLGROUP, + HTML_COMMENT, + HTML_CREDIT, + HTML_DD, + HTML_DEL, + HTML_DFN, + HTML_DIR, + HTML_DIV, + HTML_DL, + HTML_DLC, + HTML_DT, + HTML_EM, + HTML_EMBED, + HTML_FIELDSET, + HTML_FIG, + HTML_FN, + HTML_FONT, + HTML_FORM, + HTML_FRAME, + HTML_FRAMESET, + HTML_H1, + HTML_H2, + HTML_H3, + HTML_H4, + HTML_H5, + HTML_H6, + HTML_HEAD, + HTML_HR, + HTML_HTML, + HTML_HY, + HTML_I, + HTML_IFRAME, + HTML_IMG, + HTML_INPUT, + HTML_INS, + HTML_ISINDEX, + HTML_KBD, + HTML_KEYGEN, + HTML_LABEL, + HTML_LEGEND, + HTML_LH, + HTML_LI, + HTML_LINK, + HTML_LISTING, + HTML_MAP, + HTML_MARQUEE, + HTML_MATH, + HTML_MENU, + HTML_META, + HTML_NEXTID, + HTML_NOFRAMES, + HTML_NOTE, + HTML_OBJECT, + HTML_OL, + HTML_OPTION, + HTML_OVERLAY, + HTML_P, + HTML_PARAM, + HTML_PLAINTEXT, + HTML_PRE, + HTML_Q, + HTML_S, + HTML_SAMP, + HTML_SCRIPT, + HTML_SELECT, + HTML_SHY, + HTML_SMALL, + HTML_SPAN, + HTML_SPOT, + HTML_STRIKE, + HTML_STRONG, + HTML_STYLE, + HTML_SUB, + HTML_SUP, + HTML_TAB, + HTML_TABLE, + HTML_TBODY, + HTML_TD, + HTML_TEXTAREA, + HTML_TEXTFLOW, + HTML_TFOOT, + HTML_TH, + HTML_THEAD, + HTML_TITLE, + HTML_TR, + HTML_TT, + HTML_U, + HTML_UL, + HTML_VAR, + HTML_WBR, + HTML_XMP, + HTML_ALT_OBJECT + } HTMLElement; /* Notes: HTML.c uses a different extension of the HTML_ELEMENTS space privately, see HTNestedList.h. */ @@ -979,12 +977,12 @@ Attribute numbers #define HTMLA_AUXCLASS 8 /* attribute, the value of which also designates a class name */ #endif -extern const SGML_dtd HTML_dtd; + extern const SGML_dtd HTML_dtd; -extern void HTSwitchDTD(int new_flag); + extern void HTSwitchDTD(int new_flag); -extern HTTag HTTag_unrecognized; -extern HTTag HTTag_mixedObject; + extern HTTag HTTag_unrecognized; + extern HTTag HTTag_mixedObject; /* @@ -1001,13 +999,13 @@ Start anchor element to be omitted. */ -extern void HTStartAnchor(HTStructured * targetstream, const char *name, - const char *href); + extern void HTStartAnchor(HTStructured * targetstream, const char *name, + const char *href); -extern void HTStartAnchor5(HTStructured * targetstream, const char *name, - const char *href, - const char *linktype, - int tag_charset); + extern void HTStartAnchor5(HTStructured * targetstream, const char *name, + const char *href, + const char *linktype, + int tag_charset); /* @@ -1024,7 +1022,10 @@ Start IsIndex element - FM to be omitted. */ -extern void HTStartIsIndex(HTStructured * targetstream, const char *prompt, - const char *href); + extern void HTStartIsIndex(HTStructured * targetstream, const char *prompt, + const char *href); -#endif /* HTMLDTD_H */ +#ifdef __cplusplus +} +#endif +#endif /* HTMLDTD_H */ diff --git a/WWW/Library/Implementation/HTMLGen.h b/WWW/Library/Implementation/HTMLGen.h index e1144f79..9e8b84b7 100644 --- a/WWW/Library/Implementation/HTMLGen.h +++ b/WWW/Library/Implementation/HTMLGen.h @@ -11,16 +11,18 @@ #include <HTML.h> #include <HTStream.h> +#ifdef __cplusplus +extern "C" { +#endif /* Subclass: -*/ -/* extern const HTStructuredClass HTMLGeneration; */ +*//* extern const HTStructuredClass HTMLGeneration; *//* Special Creation: + */ extern HTStructured *HTMLGenerator(HTStream *output); -/* Special Creation: -*/ -extern HTStructured *HTMLGenerator(HTStream *output); + extern HTStream *HTPlainToHTML(HTPresentation *pres, + HTParentAnchor *anchor, + HTStream *sink); -extern HTStream *HTPlainToHTML(HTPresentation *pres, - HTParentAnchor *anchor, - HTStream *sink); - -#endif /* HTMLGEN_H */ +#ifdef __cplusplus +} +#endif +#endif /* HTMLGEN_H */ diff --git a/WWW/Library/Implementation/HTNews.c b/WWW/Library/Implementation/HTNews.c index 2b0f2bec..6163fdee 100644 --- a/WWW/Library/Implementation/HTNews.c +++ b/WWW/Library/Implementation/HTNews.c @@ -358,10 +358,10 @@ static int response(char *command) * template must be already in upper case. * unknown may be in upper or lower or mixed case to match. */ -static BOOL match(const char *unknown, const char *template) +static BOOL match(const char *unknown, const char *ctemplate) { const char *u = unknown; - const char *t = template; + const char *t = ctemplate; for (; *u && *t && (TOUPPER(*u) == *t); u++, t++) ; /* Find mismatch or end */ return (BOOL) (*t == 0); /* OK if end of template */ diff --git a/WWW/Library/Implementation/HTNews.h b/WWW/Library/Implementation/HTNews.h index 4fb7ac63..ef9a6e49 100644 --- a/WWW/Library/Implementation/HTNews.h +++ b/WWW/Library/Implementation/HTNews.h @@ -13,42 +13,48 @@ #include <HTAccess.h> #include <HTAnchor.h> -extern int HTNewsChunkSize; -extern int HTNewsMaxChunk; +#ifdef __cplusplus +extern "C" { +#endif + extern int HTNewsChunkSize; + extern int HTNewsMaxChunk; #ifdef GLOBALREF_IS_MACRO -extern GLOBALREF (HTProtocol, HTNews); -extern GLOBALREF (HTProtocol, HTNNTP); -extern GLOBALREF (HTProtocol, HTNewsPost); -extern GLOBALREF (HTProtocol, HTNewsReply); -extern GLOBALREF (HTProtocol, HTSNews); -extern GLOBALREF (HTProtocol, HTSNewsPost); -extern GLOBALREF (HTProtocol, HTSNewsReply); + extern GLOBALREF (HTProtocol, HTNews); + extern GLOBALREF (HTProtocol, HTNNTP); + extern GLOBALREF (HTProtocol, HTNewsPost); + extern GLOBALREF (HTProtocol, HTNewsReply); + extern GLOBALREF (HTProtocol, HTSNews); + extern GLOBALREF (HTProtocol, HTSNewsPost); + extern GLOBALREF (HTProtocol, HTSNewsReply); #else -GLOBALREF HTProtocol HTNews; -GLOBALREF HTProtocol HTNNTP; -GLOBALREF HTProtocol HTNewsPost; -GLOBALREF HTProtocol HTNewsReply; -GLOBALREF HTProtocol HTSNews; -GLOBALREF HTProtocol HTSNewsPost; -GLOBALREF HTProtocol HTSNewsReply; -#endif /* GLOBALREF_IS_MACRO */ + GLOBALREF HTProtocol HTNews; + GLOBALREF HTProtocol HTNNTP; + GLOBALREF HTProtocol HTNewsPost; + GLOBALREF HTProtocol HTNewsReply; + GLOBALREF HTProtocol HTSNews; + GLOBALREF HTProtocol HTSNewsPost; + GLOBALREF HTProtocol HTSNewsReply; +#endif /* GLOBALREF_IS_MACRO */ -extern void HTSetNewsHost(const char *value); -extern const char *HTGetNewsHost(void); -extern char *HTNewsHost; + extern void HTSetNewsHost(const char *value); + extern const char *HTGetNewsHost(void); + extern char *HTNewsHost; -extern void HTClearNNTPAuthInfo(void); + extern void HTClearNNTPAuthInfo(void); #ifdef USE_SSL -extern SSL_CTX *ssl_ctx; + extern SSL_CTX *ssl_ctx; -extern int HTNewsProxyConnect(int sock, - const char *url, - HTParentAnchor *anAnchor, - HTFormat format_out, - HTStream *sink); + extern int HTNewsProxyConnect(int sock, + const char *url, + HTParentAnchor *anAnchor, + HTFormat format_out, + HTStream *sink); #endif -#endif /* HTNEWS_H */ +#ifdef __cplusplus +} +#endif +#endif /* HTNEWS_H */ diff --git a/WWW/Library/Implementation/HTParse.h b/WWW/Library/Implementation/HTParse.h index 342c61a3..cb95d722 100644 --- a/WWW/Library/Implementation/HTParse.h +++ b/WWW/Library/Implementation/HTParse.h @@ -12,6 +12,9 @@ #include <HTUtils.h> #endif +#ifdef __cplusplus +extern "C" { +#endif /* * The following are flag bits which may be ORed together to form * a number to give the 'wanted' argument to HTParse. @@ -21,10 +24,8 @@ #define PARSE_PATH 4 #define PARSE_ANCHOR 2 #define PARSE_PUNCTUATION 1 - #define PARSE_ALL 31 #define PARSE_ALL_WITHOUT_ANCHOR (PARSE_ALL ^ PARSE_ANCHOR) - /* * Additional flag bits for more details on components already * covered by the above. The PARSE_PATH above doesn't really @@ -34,7 +35,6 @@ */ #define PARSE_STRICTPATH 32 #define PARSE_QUERY 64 - /* * The following are valid mask values. The terms are the BNF names * in the URL document. @@ -42,15 +42,13 @@ #define URL_XALPHAS UCH(1) #define URL_XPALPHAS UCH(2) #define URL_PATH UCH(4) - /* Strip white space off a string. HTStrip() * ------------------------------- * * On exit, * Return value points to first non-white character, or to 0 if none. * All trailing white space is OVERWRITTEN with zero. - */ -extern char *HTStrip(char *s); + */ extern char *HTStrip(char *s); /* Parse a Name relative to another name. HTParse() * -------------------------------------- @@ -66,9 +64,9 @@ extern char *HTStrip(char *s); * On exit, * returns A pointer to a malloc'd string which MUST BE FREED */ -extern char *HTParse(const char *aName, - const char *relatedName, - int wanted); + extern char *HTParse(const char *aName, + const char *relatedName, + int wanted); /* HTParseAnchor(), fast HTParse() specialization * ---------------------------------------------- @@ -76,7 +74,7 @@ extern char *HTParse(const char *aName, * On exit, * returns A pointer within input string (probably to its end '\0') */ -extern const char *HTParseAnchor(const char *aName); + extern const char *HTParseAnchor(const char *aName); /* Simplify a filename. HTSimplify() * -------------------- @@ -93,7 +91,7 @@ extern const char *HTParseAnchor(const char *aName); * * or ../../albert.html */ -extern void HTSimplify(char *filename); + extern void HTSimplify(char *filename); /* Make Relative Name. HTRelative() * ------------------- @@ -112,8 +110,8 @@ extern void HTSimplify(char *filename); * The caller is responsible for freeing the resulting name later. * */ -extern char *HTRelative(const char *aName, - const char *relatedName); + extern char *HTRelative(const char *aName, + const char *relatedName); /* Escape undesirable characters using % HTEscape() * ------------------------------------- @@ -125,8 +123,8 @@ extern char *HTRelative(const char *aName, * * Unlike HTUnEscape(), this routine returns a malloc'd string. */ -extern char *HTEscape(const char *str, - unsigned char mask); + extern char *HTEscape(const char *str, + unsigned char mask); /* Escape unsafe characters using % HTEscapeUnsafe() * -------------------------------- @@ -138,7 +136,7 @@ extern char *HTEscape(const char *str, * * Unlike HTUnEscape(), this routine returns a malloc'd string. */ -extern char *HTEscapeUnsafe(const char *str); + extern char *HTEscapeUnsafe(const char *str); /* Escape undesirable characters using % but space to +. HTEscapeSP() * ----------------------------------------------------- @@ -151,8 +149,8 @@ extern char *HTEscapeUnsafe(const char *str); * * Unlike HTUnEscape(), this routine returns a malloc'd string. */ -extern char *HTEscapeSP(const char *str, - unsigned char mask); + extern char *HTEscapeSP(const char *str, + unsigned char mask); /* Decode %xx escaped characters. HTUnEscape() * ------------------------------ @@ -162,7 +160,7 @@ extern char *HTEscapeSP(const char *str, * the acsii hex code for character 16x+y. * The string is converted in place, as it will never grow. */ -extern char *HTUnEscape(char *str); + extern char *HTUnEscape(char *str); /* Decode some %xx escaped characters. HTUnEscapeSome() * ----------------------------------- Klaus Weide @@ -174,13 +172,16 @@ extern char *HTUnEscape(char *str); * should be unescaped if escaped in the first string. * The first string is converted in place, as it will never grow. */ -extern char *HTUnEscapeSome(char *str, - const char *do_trans); + extern char *HTUnEscapeSome(char *str, + const char *do_trans); /* * Turn a string which is not a RFC 822 token into a quoted-string. - KW */ -extern void HTMake822Word(char **str, - int quoted); + extern void HTMake822Word(char **str, + int quoted); -#endif /* HTPARSE_H */ +#ifdef __cplusplus +} +#endif +#endif /* HTPARSE_H */ diff --git a/WWW/Library/Implementation/HTPlain.h b/WWW/Library/Implementation/HTPlain.h index 92dcc061..24fd6691 100644 --- a/WWW/Library/Implementation/HTPlain.h +++ b/WWW/Library/Implementation/HTPlain.h @@ -8,8 +8,14 @@ #include <HTStream.h> #include <HTAnchor.h> -extern HTStream *HTPlainPresent(HTPresentation *pres, - HTParentAnchor *anchor, - HTStream *sink); +#ifdef __cplusplus +extern "C" { +#endif + extern HTStream *HTPlainPresent(HTPresentation *pres, + HTParentAnchor *anchor, + HTStream *sink); -#endif /* HTPLAIN_H */ +#ifdef __cplusplus +} +#endif +#endif /* HTPLAIN_H */ diff --git a/WWW/Library/Implementation/HTRules.h b/WWW/Library/Implementation/HTRules.h index 5c14aed9..ccf838c0 100644 --- a/WWW/Library/Implementation/HTRules.h +++ b/WWW/Library/Implementation/HTRules.h @@ -22,23 +22,26 @@ #include <HTUtils.h> #endif -typedef enum { - HT_Invalid, - HT_Map, - HT_Pass, - HT_Fail, - HT_DefProt, - HT_Protect, - HT_Progress, - HT_InfoMsg, - HT_UserMsg, - HT_Alert, - HT_AlwaysAlert, - HT_Redirect, - HT_RedirectPerm, - HT_PermitRedir, - HT_UseProxy -} HTRuleOp; +#ifdef __cplusplus +extern "C" { +#endif + typedef enum { + HT_Invalid, + HT_Map, + HT_Pass, + HT_Fail, + HT_DefProt, + HT_Protect, + HT_Progress, + HT_InfoMsg, + HT_UserMsg, + HT_Alert, + HT_AlwaysAlert, + HT_Redirect, + HT_RedirectPerm, + HT_PermitRedir, + HT_UseProxy + } HTRuleOp; #ifndef NO_RULES @@ -54,8 +57,8 @@ Server Side Script Execution */ -extern char *HTBinDir; /* Physical /htbin location */ -extern char *HTSearchScript; /* Search script name */ + extern char *HTBinDir; /* Physical /htbin location */ + extern char *HTSearchScript; /* Search script name */ /* @@ -84,10 +87,10 @@ HTAddRule: Add rule to the list large. */ -extern int HTAddRule(HTRuleOp op, const char *pattern, - const char *equiv, - const char *cond_op, - const char *cond); + extern int HTAddRule(HTRuleOp op, const char *pattern, + const char *equiv, + const char *cond_op, + const char *cond); /* @@ -99,7 +102,7 @@ HTClearRules: Clear all rules */ -extern void HTClearRules(void); + extern void HTClearRules(void); /* @@ -120,7 +123,7 @@ HTTranslate: Translate by rules a copy of the original. */ -extern char *HTTranslate(const char *required); + extern char *HTTranslate(const char *required); /* @@ -134,7 +137,7 @@ HTSetConfiguration: Load one line of configuration information the rule file, for example INI files for X resources. */ -extern int HTSetConfiguration(char *config); + extern int HTSetConfiguration(char *config); /* @@ -153,11 +156,14 @@ HtLoadRules: Load the rules from a file */ -extern int HTLoadRules(const char *filename); + extern int HTLoadRules(const char *filename); /* */ -#endif /* NO_RULES */ -#endif /* HTRULE_H */ +#endif /* NO_RULES */ +#ifdef __cplusplus +} +#endif +#endif /* HTRULE_H */ diff --git a/WWW/Library/Implementation/HTStream.h b/WWW/Library/Implementation/HTStream.h index c5f6a67a..43ce9725 100644 --- a/WWW/Library/Implementation/HTStream.h +++ b/WWW/Library/Implementation/HTStream.h @@ -17,7 +17,10 @@ #include <HTUtils.h> #endif -typedef struct _HTStream HTStream; +#ifdef __cplusplus +extern "C" { +#endif + typedef struct _HTStream HTStream; /* @@ -29,26 +32,26 @@ typedef struct _HTStream HTStream; write(). */ -typedef struct _HTStreamClass { + typedef struct _HTStreamClass { - const char *name; /* Just for diagnostics */ + const char *name; /* Just for diagnostics */ - void (*_free) (HTStream *me); + void (*_free) (HTStream *me); - void (*_abort) (HTStream *me, - HTError e); + void (*_abort) (HTStream *me, + HTError e); - void (*put_character) (HTStream *me, - char ch); + void (*put_character) (HTStream *me, + char ch); - void (*put_string) (HTStream *me, - const char *str); + void (*put_string) (HTStream *me, + const char *str); - void (*put_block) (HTStream *me, - const char *str, - int len); + void (*put_block) (HTStream *me, + const char *str, + int len); -} HTStreamClass; + } HTStreamClass; /* @@ -59,6 +62,9 @@ typedef struct _HTStreamClass { example from the network. */ -extern HTStream *HTErrorStream(void); + extern HTStream *HTErrorStream(void); -#endif /* HTSTREAM_H */ +#ifdef __cplusplus +} +#endif +#endif /* HTSTREAM_H */ diff --git a/WWW/Library/Implementation/HTString.c b/WWW/Library/Implementation/HTString.c index bc4abf68..59dea861 100644 --- a/WWW/Library/Implementation/HTString.c +++ b/WWW/Library/Implementation/HTString.c @@ -566,7 +566,7 @@ typedef enum { #define VA_INTGR(type) ival = va_arg((*ap), type) #define VA_FLOAT(type) fval = va_arg((*ap), type) -#define VA_POINT(type) pval = (void *)va_arg((*ap), type) +#define VA_POINT(type) pval = (char *)va_arg((*ap), type) #define NUM_WIDTH 10 /* allow for width substituted for "*" in "%*s" */ /* also number of chars assumed to be needed in addition diff --git a/WWW/Library/Implementation/HTString.h b/WWW/Library/Implementation/HTString.h index 63b193ae..e9d0a4df 100644 --- a/WWW/Library/Implementation/HTString.h +++ b/WWW/Library/Implementation/HTString.h @@ -11,14 +11,17 @@ #include <HTUtils.h> #endif /* HTUTILS_H */ -extern const char *HTLibraryVersion; /* String for help screen etc */ +#ifdef __cplusplus +extern "C" { +#endif + extern const char *HTLibraryVersion; /* String for help screen etc */ /* EBCDIC string comparison using ASCII collating sequence */ #ifdef NOT_ASCII -extern int AS_casecomp(const char *a, const char *b); -extern int AS_ncmp(const char *a, const char *b, unsigned int n); + extern int AS_casecomp(const char *a, const char *b); + extern int AS_ncmp(const char *a, const char *b, unsigned int n); #define AS_cmp( a, b ) ( AS_ncmp( ( a ), ( b ), -1 ) ) @@ -27,7 +30,7 @@ extern int AS_ncmp(const char *a, const char *b, unsigned int n); #define AS_ncmp( a, b, c ) ( strncmp( ( a ), ( b ), ( c ) ) ) #define AS_cmp strcmp -#endif /* NOT_ASCII */ +#endif /* NOT_ASCII */ /* @@ -36,17 +39,17 @@ Case-insensitive string comparison The usual routines (comp instead of cmp) had some problem. */ -extern int strcasecomp(const char *a, const char *b); -extern int strncasecomp(const char *a, const char *b, int n); + extern int strcasecomp(const char *a, const char *b); + extern int strncasecomp(const char *a, const char *b, int n); -extern int strcasecomp8(const char *a, const char *b); -extern int strncasecomp8(const char *a, const char *b, int n); + extern int strcasecomp8(const char *a, const char *b); + extern int strncasecomp8(const char *a, const char *b, int n); - /* - * strcasecomp8 and strncasecomp8 are variants of strcasecomp and - * strncasecomp, but use 8bit upper/lower case information from the - * current display charset - */ + /* + * strcasecomp8 and strncasecomp8 are variants of strcasecomp and + * strncasecomp, but use 8bit upper/lower case information from the + * current display charset + */ /* @@ -55,8 +58,8 @@ Malloced string manipulation */ #define StrAllocCopy(dest, src) HTSACopy (&(dest), src) #define StrAllocCat(dest, src) HTSACat (&(dest), src) -extern char *HTSACopy(char **dest, const char *src); -extern char *HTSACat(char **dest, const char *src); + extern char *HTSACopy(char **dest, const char *src); + extern char *HTSACat(char **dest, const char *src); /* optimized for heavily realloc'd strings in temp objects @@ -64,28 +67,28 @@ optimized for heavily realloc'd strings in temp objects #define StrAllocCopy_extra(dest, src) HTSACopy_extra (&(dest), src) #define FREE_extra(x) {if (x != NULL) {HTSAFree_extra(x); x = NULL;}} #define Clear_extra(x) {if (x != NULL) {*x = '\0';}} -extern char *HTSACopy_extra(char **dest, const char *src); -extern void HTSAFree_extra(char *s); + extern char *HTSACopy_extra(char **dest, const char *src); + extern void HTSAFree_extra(char *s); /* Next word or quoted string */ -extern char *HTNextField(char **pstr); + extern char *HTNextField(char **pstr); /* A more general parser - kw */ -extern char *HTNextTok(char **pstr, - const char *delims, const char *bracks, char *found); + extern char *HTNextTok(char **pstr, + const char *delims, const char *bracks, char *found); -extern char *HTSprintf(char **pstr, const char *fmt,...) GCC_PRINTFLIKE(2,3); -extern char *HTSprintf0(char **pstr, const char *fmt,...) GCC_PRINTFLIKE(2,3); + extern char *HTSprintf(char **pstr, const char *fmt,...) GCC_PRINTFLIKE(2,3); + extern char *HTSprintf0(char **pstr, const char *fmt,...) GCC_PRINTFLIKE(2,3); #if defined(LY_FIND_LEAKS) /* private otherwise */ -extern char *StrAllocVsprintf(char **pstr, - size_t len, - const char *fmt, - va_list * ap); + extern char *StrAllocVsprintf(char **pstr, + size_t len, + const char *fmt, + va_list * ap); #endif #if (defined(VMS) || defined(DOSPATH) || defined(__EMX__)) && !defined(__CYGWIN__) @@ -95,34 +98,34 @@ extern char *StrAllocVsprintf(char **pstr, #endif #if USE_QUOTED_PARAMETER -extern char *HTQuoteParameter(const char *parameter); -extern void HTAddXpand(char **result, const char *command, int number, const char *parameter); + extern char *HTQuoteParameter(const char *parameter); + extern void HTAddXpand(char **result, const char *command, int number, const char *parameter); #else #define HTQuoteParameter(parameter) parameter /* simplify ifdef'ing */ #define HTAddXpand(result,command,number,parameter) HTAddParam(result,command,number,parameter) #endif -extern int HTCountCommandArgs(const char *command); -extern void HTAddToCmd(char **result, const char *command, int number, const char *string); -extern void HTAddParam(char **result, const char *command, int number, const char *parameter); -extern void HTEndParam(char **result, const char *command, int number); + extern int HTCountCommandArgs(const char *command); + extern void HTAddToCmd(char **result, const char *command, int number, const char *string); + extern void HTAddParam(char **result, const char *command, int number, const char *parameter); + extern void HTEndParam(char **result, const char *command, int number); /* Force an option, with leading blanks, to be appended without quoting them */ #define HTOptParam(result, command, number, parameter) HTSACat(result, parameter) /* Binary copy and concat */ -typedef struct { - char *str; - int len; -} bstring; - -extern void HTSABCopy(bstring **dest, const char *src, int len); -extern void HTSABCopy0(bstring **dest, const char *src); -extern void HTSABCat(bstring **dest, const char *src, int len); -extern void HTSABCat0(bstring **dest, const char *src); -extern BOOL HTSABEql(bstring *a, bstring *b); -extern void HTSABFree(bstring **ptr); + typedef struct { + char *str; + int len; + } bstring; + + extern void HTSABCopy(bstring **dest, const char *src, int len); + extern void HTSABCopy0(bstring **dest, const char *src); + extern void HTSABCat(bstring **dest, const char *src, int len); + extern void HTSABCat0(bstring **dest, const char *src); + extern BOOL HTSABEql(bstring *a, bstring *b); + extern void HTSABFree(bstring **ptr); #define BStrLen(s) (((s) != 0) ? (s)->len : 0) #define BStrData(s) (((s) != 0) ? (s)->str : 0) @@ -137,9 +140,12 @@ extern void HTSABFree(bstring **ptr); #define BStrCat0(d,s) HTSABCat0( &(d), s) #define BStrFree(d) HTSABFree( &(d)) -extern bstring *HTBprintf(bstring **pstr, const char *fmt,...) GCC_PRINTFLIKE(2,3); + extern bstring *HTBprintf(bstring **pstr, const char *fmt,...) GCC_PRINTFLIKE(2,3); -extern void trace_bstring(bstring *data); -extern void trace_bstring2(const char *text, int size); + extern void trace_bstring(bstring *data); + extern void trace_bstring2(const char *text, int size); -#endif /* HTSTRING_H */ +#ifdef __cplusplus +} +#endif +#endif /* HTSTRING_H */ diff --git a/WWW/Library/Implementation/HTStyle.h b/WWW/Library/Implementation/HTStyle.h index 790ad126..550a7a06 100644 --- a/WWW/Library/Implementation/HTStyle.h +++ b/WWW/Library/Implementation/HTStyle.h @@ -62,51 +62,53 @@ typedef int HTColor; /* Sorry about the US spelling! */ #endif +#ifdef __cplusplus +extern "C" { +#endif #define STYLE_NAME_LENGTH 80 /* @@@@@@@@@@@ */ - -typedef struct { - short kind; /* only NX_LEFTTAB implemented */ - HTCoord position; /* x coordinate for stop */ -} HTTabStop; + typedef struct { + short kind; /* only NX_LEFTTAB implemented */ + HTCoord position; /* x coordinate for stop */ + } HTTabStop; /* The Style Structure * ------------------- */ -typedef struct _HTStyle { + typedef struct _HTStyle { /* Style management information */ - struct _HTStyle *next; /* Link for putting into stylesheet */ - char *name; /* Style name */ - int id; /* equivalent of name, for speed */ - char *SGMLTag; /* Tag name to start */ + struct _HTStyle *next; /* Link for putting into stylesheet */ + char *name; /* Style name */ + int id; /* equivalent of name, for speed */ + char *SGMLTag; /* Tag name to start */ /* Character attributes (a la NXRun) */ - HTFont font; /* Font id */ - HTCoord fontSize; /* The size of font, not independent */ - HTColor color; /* text gray of current run */ - int superscript; /* superscript (-sub) in points */ + HTFont font; /* Font id */ + HTCoord fontSize; /* The size of font, not independent */ + HTColor color; /* text gray of current run */ + int superscript; /* superscript (-sub) in points */ - HTAnchor *anchor; /* Anchor id if any, else zero */ + HTAnchor *anchor; /* Anchor id if any, else zero */ /* Paragraph Attribtes (a la NXTextStyle) */ - HTCoord indent1st; /* how far first line in paragraph is + HTCoord indent1st; /* how far first line in paragraph is * indented */ - HTCoord leftIndent; /* how far second line is indented */ - HTCoord rightIndent; /* (Missing from NeXT version */ - short alignment; /* quad justification */ - HTCoord lineHt; /* line height */ - HTCoord descentLine; /* descender bottom from baseline */ - const HTTabStop *tabs; /* array of tab stops, 0 terminated */ - - BOOL wordWrap; /* Yes means wrap at space not char */ - BOOL freeFormat; /* Yes means \n is just white space */ - HTCoord spaceBefore; /* Omissions from NXTextStyle */ - HTCoord spaceAfter; - int paraFlags; /* Paragraph flags, bits as follows: */ + HTCoord leftIndent; /* how far second line is indented */ + HTCoord rightIndent; /* (Missing from NeXT version */ + short alignment; /* quad justification */ + HTCoord lineHt; /* line height */ + HTCoord descentLine; /* descender bottom from baseline */ + const HTTabStop *tabs; /* array of tab stops, 0 terminated */ + + BOOL wordWrap; /* Yes means wrap at space not char */ + BOOL freeFormat; /* Yes means \n is just white space */ + HTCoord spaceBefore; /* Omissions from NXTextStyle */ + HTCoord spaceAfter; + int paraFlags; /* Paragraph flags, bits as follows: */ #define PARA_KEEP 1 /* Do not break page within this paragraph */ #define PARA_WITH_NEXT 2 /* Do not break page after this paragraph */ @@ -116,101 +118,104 @@ typedef struct _HTStyle { #define HT_RIGHT 2 #define HT_CENTER 3 -} HTStyle; + } HTStyle; #define HT_ALIGN_NONE (-1) /* Style functions: */ -extern HTStyle *HTStyleNew(void); -extern HTStyle *HTStyleNewNamed(const char *name); -extern HTStyle *HTStyleFree(HTStyle *self); + extern HTStyle *HTStyleNew(void); + extern HTStyle *HTStyleNewNamed(const char *name); + extern HTStyle *HTStyleFree(HTStyle *self); #ifdef SUPRESS -extern HTStyle *HTStyleRead(HTStyle *self, HTStream *stream); -extern HTStyle *HTStyleWrite(HTStyle *self, HTStream *stream); + extern HTStyle *HTStyleRead(HTStyle *self, HTStream *stream); + extern HTStyle *HTStyleWrite(HTStyle *self, HTStream *stream); #endif /* Style Sheet * ----------- */ -typedef struct _HTStyleSheet { - char *name; - HTStyle *styles; -} HTStyleSheet; + typedef struct _HTStyleSheet { + char *name; + HTStyle *styles; + } HTStyleSheet; /* Stylesheet functions: */ -extern HTStyleSheet *HTStyleSheetNew(void); -extern HTStyleSheet *HTStyleSheetFree(HTStyleSheet *self); -extern HTStyle *HTStyleNamed(HTStyleSheet *self, const char *name); -extern HTStyle *HTStyleForParagraph(HTStyleSheet *self, HTParagraphStyle * paraStyle); -extern HTStyle *HTStyleMatching(HTStyleSheet *self, HTStyle *style); + extern HTStyleSheet *HTStyleSheetNew(void); + extern HTStyleSheet *HTStyleSheetFree(HTStyleSheet *self); + extern HTStyle *HTStyleNamed(HTStyleSheet *self, const char *name); + extern HTStyle *HTStyleForParagraph(HTStyleSheet *self, HTParagraphStyle * paraStyle); + extern HTStyle *HTStyleMatching(HTStyleSheet *self, HTStyle *style); /* extern HTStyle * HTStyleForRun (HTStyleSheet *self, NXRun * run); */ -extern HTStyleSheet *HTStyleSheetAddStyle(HTStyleSheet *self, HTStyle *style); -extern HTStyleSheet *HTStyleSheetRemoveStyle(HTStyleSheet *self, HTStyle *style); + extern HTStyleSheet *HTStyleSheetAddStyle(HTStyleSheet *self, HTStyle *style); + extern HTStyleSheet *HTStyleSheetRemoveStyle(HTStyleSheet *self, HTStyle *style); #ifdef SUPPRESS -extern HTStyleSheet *HTStyleSheetRead(HTStyleSheet *self, HTStream *stream); -extern HTStyleSheet *HTStyleSheetWrite(HTStyleSheet *self, HTStream *stream); + extern HTStyleSheet *HTStyleSheetRead(HTStyleSheet *self, HTStream *stream); + extern HTStyleSheet *HTStyleSheetWrite(HTStyleSheet *self, HTStream *stream); #endif #define CLEAR_POINTER ((void *)-1) /* Pointer value means "clear me" */ /* DefaultStyle.c */ -extern HTStyleSheet *DefaultStyle(HTStyle ***result_array); + extern HTStyleSheet *DefaultStyle(HTStyle ***result_array); /* enum, use this instead of HTStyle name comparisons */ -enum HTStyle_Enum { - ST_Normal = 0, - ST_DivCenter, - ST_DivLeft, - ST_DivRight, - ST_Banner, - ST_Blockquote, - ST_Bq, - ST_Footnote, - ST_List, - ST_List1, - ST_List2, - ST_List3, - ST_List4, - ST_List5, - ST_List6, - ST_Menu, - ST_Menu1, - ST_Menu2, - ST_Menu3, - ST_Menu4, - ST_Menu5, - ST_Menu6, - ST_Glossary, - ST_Glossary1, - ST_Glossary2, - ST_Glossary3, - ST_Glossary4, - ST_Glossary5, - ST_Glossary6, - ST_GlossaryCompact, - ST_GlossaryCompact1, - ST_GlossaryCompact2, - ST_GlossaryCompact3, - ST_GlossaryCompact4, - ST_GlossaryCompact5, - ST_GlossaryCompact6, - ST_Example, - ST_Preformatted, - ST_Listing, - ST_Address, - ST_Note, - ST_Heading1, - ST_Heading2, - ST_Heading3, - ST_Heading4, - ST_Heading5, - ST_Heading6, - ST_HeadingCenter, - ST_HeadingLeft, - ST_HeadingRight -}; - -#endif /* HTStyle_H */ + enum HTStyle_Enum { + ST_Normal = 0, + ST_DivCenter, + ST_DivLeft, + ST_DivRight, + ST_Banner, + ST_Blockquote, + ST_Bq, + ST_Footnote, + ST_List, + ST_List1, + ST_List2, + ST_List3, + ST_List4, + ST_List5, + ST_List6, + ST_Menu, + ST_Menu1, + ST_Menu2, + ST_Menu3, + ST_Menu4, + ST_Menu5, + ST_Menu6, + ST_Glossary, + ST_Glossary1, + ST_Glossary2, + ST_Glossary3, + ST_Glossary4, + ST_Glossary5, + ST_Glossary6, + ST_GlossaryCompact, + ST_GlossaryCompact1, + ST_GlossaryCompact2, + ST_GlossaryCompact3, + ST_GlossaryCompact4, + ST_GlossaryCompact5, + ST_GlossaryCompact6, + ST_Example, + ST_Preformatted, + ST_Listing, + ST_Address, + ST_Note, + ST_Heading1, + ST_Heading2, + ST_Heading3, + ST_Heading4, + ST_Heading5, + ST_Heading6, + ST_HeadingCenter, + ST_HeadingLeft, + ST_HeadingRight + }; + +#ifdef __cplusplus +} +#endif +#endif /* HTStyle_H */ diff --git a/WWW/Library/Implementation/HTTCP.c b/WWW/Library/Implementation/HTTCP.c index fb55e185..5b938571 100644 --- a/WWW/Library/Implementation/HTTCP.c +++ b/WWW/Library/Implementation/HTTCP.c @@ -943,10 +943,10 @@ LYNX_HOSTENT *LYGetHostByName(char *str) */ #ifdef SOCKS if (socks_flag) - selret = Rselect(pfd[0] + 1, (void *) &readfds, NULL, NULL, &one_second); + selret = Rselect(pfd[0] + 1, &readfds, NULL, NULL, &one_second); else #endif /* SOCKS */ - selret = select(pfd[0] + 1, (void *) &readfds, NULL, NULL, &one_second); + selret = select(pfd[0] + 1, &readfds, NULL, NULL, &one_second); if ((selret > 0) && FD_ISSET(pfd[0], &readfds)) { /* @@ -1359,11 +1359,11 @@ static LYNX_ADDRINFO *HTGetAddrInfo(const char *str, LYNX_ADDRINFO hints, *res; int error; char *p; - char *s; + char *s = NULL; char *host, *port; char pbuf[80]; - s = strdup(str); + StrAllocCopy(s, str); if (s[0] == '[' && (p = strchr(s, ']')) != NULL) { *p++ = '\0'; @@ -1715,12 +1715,12 @@ int HTDoConnect(const char *url, #ifdef SOCKS if (socks_flag) ret = Rselect((unsigned) *s + 1, NULL, - (void *) &writefds, NULL, &select_timeout); + &writefds, NULL, &select_timeout); else #endif /* SOCKS */ ret = select((unsigned) *s + 1, NULL, - (void *) &writefds, + &writefds, NULL, &select_timeout); @@ -1992,11 +1992,11 @@ int HTDoRead(int fildes, #ifdef SOCKS if (socks_flag) ret = Rselect((unsigned) fildes + 1, - (void *) &readfds, NULL, NULL, &select_timeout); + &readfds, NULL, NULL, &select_timeout); else #endif /* SOCKS */ ret = select((unsigned) fildes + 1, - (void *) &readfds, NULL, NULL, &select_timeout); + &readfds, NULL, NULL, &select_timeout); } while ((ret == -1) && (errno == EINTR)); if (ret < 0) { diff --git a/WWW/Library/Implementation/HTTCP.h b/WWW/Library/Implementation/HTTCP.h index eae20aa5..abbc956f 100644 --- a/WWW/Library/Implementation/HTTCP.h +++ b/WWW/Library/Implementation/HTTCP.h @@ -11,6 +11,9 @@ #include <HTUtils.h> #endif +#ifdef __cplusplus +extern "C" { +#endif /* Produce a string for an internet address * --------------------------------------- * @@ -19,11 +22,11 @@ * it is to be kept. */ #ifdef INET6 -extern const char *HTInetString(SockA * mysin); + extern const char *HTInetString(SockA * mysin); #else -extern const char *HTInetString(struct sockaddr_in *mysin); -#endif /* INET6 */ + extern const char *HTInetString(struct sockaddr_in *mysin); +#endif /* INET6 */ /* Encode INET status (as in sys/errno.h) inet_status() * ------------------ @@ -35,13 +38,13 @@ extern const char *HTInetString(struct sockaddr_in *mysin); * On return: * returns a negative status in the unix way. */ -extern int HTInetStatus(const char *where); + extern int HTInetStatus(const char *where); /* Publicly accessible variables */ /* extern struct sockaddr_in HTHostAddress; */ - /* The internet address of the host */ - /* Valid after call to HTHostName() */ + /* The internet address of the host */ + /* Valid after call to HTHostName() */ /* Parse a cardinal value parse_cardinal() * ---------------------- @@ -57,15 +60,15 @@ extern int HTInetStatus(const char *where); * *pstatus points to status updated iff bad */ -extern unsigned int HTCardinal(int *pstatus, - char **pp, - unsigned int max_value); + extern unsigned int HTCardinal(int *pstatus, + char **pp, + unsigned int max_value); /* Check whether string is a valid Internet hostname * ------------------------------------------------- */ -extern BOOL valid_hostname(char *name); + extern BOOL valid_hostname(char *name); /* Resolve an internet hostname, like gethostbyname * ------------------------------------------------ @@ -81,24 +84,27 @@ extern BOOL valid_hostname(char *name); * The interface is intended to be the same as for gethostbyname(), * but additional status is returned in lynx_nsl_status. */ -extern int lynx_nsl_status; + extern int lynx_nsl_status; -extern struct hostent *LYGetHostByName(char *str); + extern struct hostent *LYGetHostByName(char *str); /* Get Name of This Machine * ------------------------ * */ -extern const char *HTHostName(void); + extern const char *HTHostName(void); -extern int HTDoConnect(const char *url, - const char *protocol, - int default_port, - int *s); + extern int HTDoConnect(const char *url, + const char *protocol, + int default_port, + int *s); -extern int HTDoRead(int fildes, - void *buf, - unsigned nbyte); + extern int HTDoRead(int fildes, + void *buf, + unsigned nbyte); -#endif /* HTTCP_H */ +#ifdef __cplusplus +} +#endif +#endif /* HTTCP_H */ diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c index 2204e651..27c0dcc0 100644 --- a/WWW/Library/Implementation/HTTP.c +++ b/WWW/Library/Implementation/HTTP.c @@ -411,6 +411,7 @@ static int HTLoadHTTP(const char *arg, HTFormat format_out, HTStream *sink) { + static char *empty = ""; int s; /* Socket number for returned data */ const char *url = arg; /* The URL which get_physical() returned */ bstring *command = NULL; /* The whole command */ @@ -1402,7 +1403,7 @@ static int HTLoadHTTP(const char *arg, * anything else) when !eol. Otherwise, set the value of length to * what we have beyond eol (i.e., beyond the status line). - FM */ - start_of_data = eol ? eol + 1 : ""; + start_of_data = eol ? eol + 1 : empty; length = eol ? length - (start_of_data - line_buffer) : 0; /* diff --git a/WWW/Library/Implementation/HTTP.h b/WWW/Library/Implementation/HTTP.h index 43ef29e1..1d570322 100644 --- a/WWW/Library/Implementation/HTTP.h +++ b/WWW/Library/Implementation/HTTP.h @@ -7,27 +7,33 @@ #include <HTAccess.h> +#ifdef __cplusplus +extern "C" { +#endif #ifdef GLOBALREF_IS_MACRO -extern GLOBALREF (HTProtocol, HTTP); -extern GLOBALREF (HTProtocol, HTTPS); + extern GLOBALREF (HTProtocol, HTTP); + extern GLOBALREF (HTProtocol, HTTPS); #else -GLOBALREF HTProtocol HTTP; -GLOBALREF HTProtocol HTTPS; -#endif /* GLOBALREF_IS_MACRO */ + GLOBALREF HTProtocol HTTP; + GLOBALREF HTProtocol HTTPS; +#endif /* GLOBALREF_IS_MACRO */ #define URL_GET_METHOD 1 #define URL_POST_METHOD 2 #define URL_MAIL_METHOD 3 -extern int ws_read_per_sec; -extern BOOL reloading; -extern char *redirecting_url; -extern BOOL permanent_redirection; -extern BOOL redirect_post_content; + extern int ws_read_per_sec; + extern BOOL reloading; + extern char *redirecting_url; + extern BOOL permanent_redirection; + extern BOOL redirect_post_content; #ifdef USE_SSL -extern SSL *SSL_handle; + extern SSL *SSL_handle; #endif -#endif /* HTTP_H */ +#ifdef __cplusplus +} +#endif +#endif /* HTTP_H */ diff --git a/WWW/Library/Implementation/HTTelnet.h b/WWW/Library/Implementation/HTTelnet.h index 2f84bd8d..f2208d88 100644 --- a/WWW/Library/Implementation/HTTelnet.h +++ b/WWW/Library/Implementation/HTTelnet.h @@ -8,15 +8,21 @@ #include <HTAccess.h> +#ifdef __cplusplus +extern "C" { +#endif #ifdef GLOBALREF_IS_MACRO -extern GLOBALREF (HTProtocol, HTTelnet); -extern GLOBALREF (HTProtocol, HTRlogin); -extern GLOBALREF (HTProtocol, HTTn3270); + extern GLOBALREF (HTProtocol, HTTelnet); + extern GLOBALREF (HTProtocol, HTRlogin); + extern GLOBALREF (HTProtocol, HTTn3270); #else -GLOBALREF HTProtocol HTTelnet; -GLOBALREF HTProtocol HTRlogin; -GLOBALREF HTProtocol HTTn3270; -#endif /* GLOBALREF_IS_MACRO */ + GLOBALREF HTProtocol HTTelnet; + GLOBALREF HTProtocol HTRlogin; + GLOBALREF HTProtocol HTTn3270; +#endif /* GLOBALREF_IS_MACRO */ -#endif /* HTTELNET_H */ +#ifdef __cplusplus +} +#endif +#endif /* HTTELNET_H */ diff --git a/WWW/Library/Implementation/HTUU.h b/WWW/Library/Implementation/HTUU.h index 6a0d4a7c..1bd5e6e6 100644 --- a/WWW/Library/Implementation/HTUU.h +++ b/WWW/Library/Implementation/HTUU.h @@ -16,12 +16,18 @@ #include <HTUtils.h> #endif -extern int HTUU_encode(unsigned char *bufin, - unsigned int nbytes, - char *bufcoded); +#ifdef __cplusplus +extern "C" { +#endif + extern int HTUU_encode(unsigned char *bufin, + unsigned int nbytes, + char *bufcoded); -extern int HTUU_decode(char *bufcoded, - unsigned char *bufplain, - int outbufsize); + extern int HTUU_decode(char *bufcoded, + unsigned char *bufplain, + int outbufsize); -#endif /* HTUU_H */ +#ifdef __cplusplus +} +#endif +#endif /* HTUU_H */ diff --git a/WWW/Library/Implementation/HTUtils.h b/WWW/Library/Implementation/HTUtils.h index ef2ac732..0a049577 100644 --- a/WWW/Library/Implementation/HTUtils.h +++ b/WWW/Library/Implementation/HTUtils.h @@ -188,6 +188,11 @@ typedef unsigned short mode_t; #endif /* _WINDOWS */ +#if defined(USE_DEFAULT_COLORS) && !defined(HAVE_USE_DEFAULT_COLORS) + /* if we don't have use_default_colors() */ +# undef USE_DEFAULT_COLORS +#endif + #ifndef USE_COLOR_STYLE /* it's useless for such setup */ # define NO_EMPTY_HREFLESS_A @@ -294,8 +299,10 @@ Standard C library for malloc() etc #define typecalloc(cast) (cast *)calloc(1,sizeof(cast)) #define typecallocn(cast,ntypes) (cast *)calloc(ntypes,sizeof(cast)) +#define typeRealloc(cast,ptr,ntypes) (cast *)realloc(ptr, (ntypes)*sizeof(cast)) + #define typeMalloc(cast) (cast *)malloc(sizeof(cast)) -#define typeMallocn(cast,ntypes) (cast *)malloc(ntypes*sizeof(cast)) +#define typeMallocn(cast,ntypes) (cast *)malloc((ntypes)*sizeof(cast)) /* @@ -430,8 +437,6 @@ Out Of Memory checking for malloc() return: #include <LYexit.h> -extern void outofmem(const char *fname, const char *func); - /* * Upper- and Lowercase macros * @@ -452,10 +457,6 @@ extern void outofmem(const char *fname, const char *func); #define TOUPPER(c) ascii_toupper(UCH(c)) #define ISUPPER(c) ascii_isupper(UCH(c)) -extern int ascii_toupper(int); -extern int ascii_tolower(int); -extern int ascii_isupper(int); - #else #define TOLOWER(c) (isupper(UCH(c)) ? tolower(UCH(c)) : UCH(c)) @@ -516,8 +517,6 @@ extern int WWW_TraceMask; #define CTRACE_SLEEP(secs) if (TRACE && LYTraceLogFP == 0) sleep(secs) #define CTRACE_FLUSH(fp) if (TRACE) fflush(fp) -extern FILE *TraceFP(void); - #include <www_tcp.h> /* @@ -599,10 +598,6 @@ extern FILE *TraceFP(void); #undef free_func -extern SSL *HTGetSSLHandle(void); -extern void HTSSLInitPRNG(void); -extern char HTGetSSLCharacter(void *handle); - #endif /* USE_SSL */ #ifdef HAVE_LIBDMALLOC @@ -621,4 +616,26 @@ extern char HTGetSSLCharacter(void *handle); #include <userdefs.h> -#endif /* HTUTILS_H */ +#ifdef __cplusplus +extern "C" { +#endif +#ifndef TOLOWER +#ifdef EXP_ASCII_CTYPES + extern int ascii_toupper(int); + extern int ascii_tolower(int); + extern int ascii_isupper(int); +#endif +#endif + + extern FILE *TraceFP(void); + +#ifdef USE_SSL + extern SSL *HTGetSSLHandle(void); + extern void HTSSLInitPRNG(void); + extern char HTGetSSLCharacter(void *handle); +#endif /* USE_SSL */ + +#ifdef __cplusplus +} +#endif +#endif /* HTUTILS_H */ diff --git a/WWW/Library/Implementation/HTVMSUtils.h b/WWW/Library/Implementation/HTVMSUtils.h index d7e61de3..d7efe8c4 100644 --- a/WWW/Library/Implementation/HTVMSUtils.h +++ b/WWW/Library/Implementation/HTVMSUtils.h @@ -11,7 +11,10 @@ #include <HTAnchor.h> -extern BOOL HTVMSFileVersions; /* Include version numbers in listing? */ +#ifdef __cplusplus +extern "C" { +#endif + extern BOOL HTVMSFileVersions; /* Include version numbers in listing? */ /* PUBLIC HTVMS_authSysPrv() * CHECKS IF THIS PROCESS IS AUTHORIZED TO ENABLE SYSPRV @@ -21,7 +24,7 @@ extern BOOL HTVMSFileVersions; /* Include version numbers in listing? */ * ON EXIT: * returns YES if SYSPRV is authorized */ -extern BOOL HTVMS_authSysPrv(void); + extern BOOL HTVMS_authSysPrv(void); /* PUBLIC HTVMS_enableSysPrv() * ENABLES SYSPRV @@ -31,7 +34,7 @@ extern BOOL HTVMS_authSysPrv(void); * ON EXIT: * */ -extern void HTVMS_enableSysPrv(void); + extern void HTVMS_enableSysPrv(void); /* PUBLIC HTVMS_disableSysPrv() * DISABLES SYSPRV @@ -41,7 +44,7 @@ extern void HTVMS_enableSysPrv(void); * ON EXIT: * */ -extern void HTVMS_disableSysPrv(void); + extern void HTVMS_disableSysPrv(void); /* PUBLIC HTVMS_checkAccess() * CHECKS ACCESS TO FILE FOR CERTAIN USER @@ -53,9 +56,9 @@ extern void HTVMS_disableSysPrv(void); * returns YES if access is allowed * */ -extern BOOL HTVMS_checkAccess(const char *FileName, - const char *UserName, - const char *Method); + extern BOOL HTVMS_checkAccess(const char *FileName, + const char *UserName, + const char *Method); /* PUBLIC HTVMS_wwwName() * CONVERTS VMS Name into WWW Name @@ -82,14 +85,17 @@ extern BOOL HTVMS_checkAccess(const char *FileName, * * */ -const extern char *HTVMS_wwwName(const char *vmsname); + const extern char *HTVMS_wwwName(const char *vmsname); -extern int HTVMSBrowseDir(const char *address, - HTParentAnchor *anchor, - HTFormat format_out, - HTStream *sink); + extern int HTVMSBrowseDir(const char *address, + HTParentAnchor *anchor, + HTFormat format_out, + HTStream *sink); -extern int HTVMS_remove(char *filename); -extern void HTVMS_purge(char *filename); + extern int HTVMS_remove(char *filename); + extern void HTVMS_purge(char *filename); -#endif /* not HTVMSUTIL_H */ +#ifdef __cplusplus +} +#endif +#endif /* not HTVMSUTIL_H */ diff --git a/WWW/Library/Implementation/HTVMS_WaisUI.h b/WWW/Library/Implementation/HTVMS_WaisUI.h index aaa0495a..4f072a51 100644 --- a/WWW/Library/Implementation/HTVMS_WaisUI.h +++ b/WWW/Library/Implementation/HTVMS_WaisUI.h @@ -12,14 +12,17 @@ #include <HTUtils.h> #endif -void log_write(char *); +#ifdef __cplusplus +extern "C" { +#endif + void log_write(char *); /* * Routines originally from Panic.h -- FM * *----------------------------------------------------------------------*/ -void panic(char *format,...); + void panic(char *format,...); /*----------------------------------------------------------------------*/ @@ -32,35 +35,35 @@ void panic(char *format,...); #ifndef boolean #define boolean unsigned long -#endif /* boolean */ +#endif /* boolean */ #ifndef true #define true (boolean)1L -#endif /* true */ +#endif /* true */ #ifndef false #define false (boolean)0L /* used to be (!true), but broke some compilers */ -#endif /* false */ +#endif /* false */ #ifndef TRUE #define TRUE true -#endif /* TRUE */ +#endif /* TRUE */ #ifndef FALSE #define FALSE false -#endif /* FALSE */ +#endif /* FALSE */ /*----------------------------------------------------------------------*/ /* functions */ /* enhanced memory handling functions - don't call them directly, use the macros below */ -void fs_checkPtr(void *ptr); -void *fs_malloc(size_t size); -void *fs_realloc(void *ptr, size_t size); -void fs_free(void *ptr); -char *fs_strncat(char *dst, char *src, size_t maxToAdd, size_t maxTotal); + void fs_checkPtr(void *ptr); + void *fs_malloc(size_t size); + void *fs_realloc(void *ptr, size_t size); + void fs_free(void *ptr); + char *fs_strncat(char *dst, char *src, size_t maxToAdd, size_t maxTotal); /* macros for memory functions. call these in your program. */ #define s_checkPtr(ptr) fs_checkPtr(ptr) @@ -69,13 +72,13 @@ char *fs_strncat(char *dst, char *src, size_t maxToAdd, size_t maxTotal); #define s_free(ptr) { fs_free((char*)ptr); ptr = NULL; } #define s_strncat(dst,src,maxToAdd,maxTotal) fs_strncat((dst),(src),(maxToAdd),(maxTotal)) -char *s_strdup(char *s); + char *s_strdup(char *s); #define IS_DELIMITER 1 #define NOT_DELIMITER !IS_DELIMITER -char char_downcase(unsigned long ch); -char *string_downcase(char *word); + char char_downcase(unsigned long ch); + char *string_downcase(char *word); /*----------------------------------------------------------------------*/ @@ -89,7 +92,7 @@ char *string_downcase(char *word); /* bytes to leave for the header size info */ #define HEADER_LEN (size_t)2 -typedef long pdu_type; + typedef long pdu_type; #define initAPDU (pdu_type)20 #define initResponseAPDU (pdu_type)21 @@ -104,14 +107,14 @@ typedef long pdu_type; #define resourceControlAPDU (pdu_type)30 #define resourceControlResponseAPDU (pdu_type)31 -typedef struct any { /* an any is a non-ascii string of characters */ - unsigned long size; - char *bytes; -} any; + typedef struct any { /* an any is a non-ascii string of characters */ + unsigned long size; + char *bytes; + } any; -typedef any bit_map; /* a bit_map is a group of packed bits */ + typedef any bit_map; /* a bit_map is a group of packed bits */ -typedef unsigned long data_tag; + typedef unsigned long data_tag; #define DT_PDUType (data_tag)1 #define DT_ReferenceID (data_tag)2 @@ -200,11 +203,11 @@ typedef unsigned long data_tag; #define DIAGNOSTIC_CODE_SIZE (size_t)3 -typedef struct diagnosticRecord { - boolean SURROGATE; - char DIAG[DIAGNOSTIC_CODE_SIZE]; - char *ADDINFO; -} diagnosticRecord; + typedef struct diagnosticRecord { + boolean SURROGATE; + char DIAG[DIAGNOSTIC_CODE_SIZE]; + char *ADDINFO; + } diagnosticRecord; #define D_PermanentSystemError "S1" #define D_TemporarySystemError "S2" @@ -248,7 +251,7 @@ typedef struct diagnosticRecord { /* for internal error handling */ -extern char *readErrorPosition; /* pos where buf stoped making sense */ + extern char *readErrorPosition; /* pos where buf stoped making sense */ /* the following are macros so that they can return OUT of the function which calls them @@ -274,71 +277,71 @@ extern char *readErrorPosition; /* pos where buf stoped making sense */ /*----------------------------------------------------------------------*/ -diagnosticRecord *makeDiag(boolean surrogate, char *code, char *addInfo); -void freeDiag(diagnosticRecord * diag); -char *writeDiag(diagnosticRecord * diag, char *buffer, long *len); -char *readDiag(diagnosticRecord ** diag, char *buffer); + diagnosticRecord *makeDiag(boolean surrogate, char *code, char *addInfo); + void freeDiag(diagnosticRecord * diag); + char *writeDiag(diagnosticRecord * diag, char *buffer, long *len); + char *readDiag(diagnosticRecord ** diag, char *buffer); -char *writeCompressedInteger(unsigned long num, char *buf, long *len); -char *readCompressedInteger(unsigned long *num, char *buf); -char *writeCompressedIntWithPadding(unsigned long num, unsigned long size, - char *buffer, long *len); -unsigned long writtenCompressedIntSize(unsigned long num); + char *writeCompressedInteger(unsigned long num, char *buf, long *len); + char *readCompressedInteger(unsigned long *num, char *buf); + char *writeCompressedIntWithPadding(unsigned long num, unsigned long size, + char *buffer, long *len); + unsigned long writtenCompressedIntSize(unsigned long num); -char *writeTag(data_tag tag, char *buf, long *len); -char *readTag(data_tag *tag, char *buf); -data_tag peekTag(char *buf); -unsigned long writtenTagSize(data_tag tag); + char *writeTag(data_tag tag, char *buf, long *len); + char *readTag(data_tag *tag, char *buf); + data_tag peekTag(char *buf); + unsigned long writtenTagSize(data_tag tag); -any *makeAny(unsigned long size, char *data); -void freeAny(any *a); -any *duplicateAny(any *a); -char *writeAny(any *a, data_tag tag, char *buffer, long *len); -char *readAny(any **anAny, char *buffer); -unsigned long writtenAnySize(data_tag tag, any *a); + any *makeAny(unsigned long size, char *data); + void freeAny(any *a); + any *duplicateAny(any *a); + char *writeAny(any *a, data_tag tag, char *buffer, long *len); + char *readAny(any **anAny, char *buffer); + unsigned long writtenAnySize(data_tag tag, any *a); -any *stringToAny(char *s); -char *anyToString(any *a); -unsigned long writtenStringSize(data_tag tag, char *s); + any *stringToAny(char *s); + char *anyToString(any *a); + unsigned long writtenStringSize(data_tag tag, char *s); -any *longToAny(long Num); -long anyToLong(any *a); + any *longToAny(long Num); + long anyToLong(any *a); -char *writeString(char *s, data_tag tag, char *buffer, long *len); -char *readString(char **s, char *buffer); + char *writeString(char *s, data_tag tag, char *buffer, long *len); + char *readString(char **s, char *buffer); -bit_map *makeBitMap(unsigned long numBits,...); + bit_map *makeBitMap(unsigned long numBits,...); -void freeBitMap(bit_map *bm); -boolean bitAtPos(unsigned long pos, bit_map *bm); -char *writeBitMap(bit_map *bm, data_tag tag, char *buffer, long *len); -char *readBitMap(bit_map **bm, char *buffer); + void freeBitMap(bit_map *bm); + boolean bitAtPos(unsigned long pos, bit_map *bm); + char *writeBitMap(bit_map *bm, data_tag tag, char *buffer, long *len); + char *readBitMap(bit_map **bm, char *buffer); -char *writeByte(unsigned long byte, char *buf, long *len); -char *readByte(unsigned char *byte, char *buf); + char *writeByte(unsigned long byte, char *buf, long *len); + char *readByte(unsigned char *byte, char *buf); -char *writeBoolean(boolean flag, char *buf, long *len); -char *readBoolean(boolean *flag, char *buf); + char *writeBoolean(boolean flag, char *buf, long *len); + char *readBoolean(boolean *flag, char *buf); -char *writePDUType(pdu_type pduType, char *buf, long *len); -char *readPDUType(pdu_type *pduType, char *buf); -pdu_type peekPDUType(char *buf); + char *writePDUType(pdu_type pduType, char *buf, long *len); + char *readPDUType(pdu_type *pduType, char *buf); + pdu_type peekPDUType(char *buf); -char *writeBinaryInteger(long num, unsigned long size, - char *buf, long *len); -char *readBinaryInteger(long *num, unsigned long size, char *buf); -unsigned long writtenCompressedBinIntSize(long num); + char *writeBinaryInteger(long num, unsigned long size, + char *buf, long *len); + char *readBinaryInteger(long *num, unsigned long size, char *buf); + unsigned long writtenCompressedBinIntSize(long num); -char *writeNum(long num, data_tag tag, char *buffer, long *len); -char *readNum(long *num, char *buffer); -unsigned long writtenNumSize(data_tag tag, long num); + char *writeNum(long num, data_tag tag, char *buffer, long *len); + char *readNum(long *num, char *buffer); + unsigned long writtenNumSize(data_tag tag, long num); -void doList(void **list, void (*func) (void *)); + void doList(void **list, void (*func) (void *)); -char *writeProtocolVersion(char *buf, long *len); -char *defaultImplementationID(void); -char *defaultImplementationName(void); -char *defaultImplementationVersion(void); + char *writeProtocolVersion(char *buf, long *len); + char *defaultImplementationID(void); + char *defaultImplementationName(void); + char *defaultImplementationVersion(void); /*----------------------------------------------------------------------*/ @@ -362,62 +365,62 @@ char *defaultImplementationVersion(void); #define QT_BooleanQuery "1" /* standard boolean query */ /* general attribute code - use in place of any attribute */ -#define IGNORE "ig" +#define IGNORE "ig" /* use value codes */ -#define UV_ISBN "ub" -#define CORPORATE_NAME "uc" -#define ISSN "us" -#define PERSONAL_NAME "up" -#define SUBJECT "uj" -#define TITLE "ut" -#define GEOGRAPHIC_NAME "ug" -#define CODEN "ud" +#define UV_ISBN "ub" +#define CORPORATE_NAME "uc" +#define ISSN "us" +#define PERSONAL_NAME "up" +#define SUBJECT "uj" +#define TITLE "ut" +#define GEOGRAPHIC_NAME "ug" +#define CODEN "ud" #define SUBJECT_SUBDIVISION "ue" -#define SERIES_TITLE "uf" +#define SERIES_TITLE "uf" #define MICROFORM_GENERATION "uh" #define PLACE_OF_PUBLICATION "ui" -#define NUC_CODE "uk" -#define LANGUAGE "ul" +#define NUC_CODE "uk" +#define LANGUAGE "ul" #define COMBINATION_OF_USE_VALUES "um" #define SYSTEM_CONTROL_NUMBER "un" -#define DATE "uo" +#define DATE "uo" #define LC_CONTROL_NUMBER "ur" #define MUSIC_PUBLISHERS_NUMBER "uu" #define GOVERNMENT_DOCUMENTS_NUMBER "uv" #define SUBJECT_CLASSIFICATION "uw" -#define RECORD_TYPE "uy" +#define RECORD_TYPE "uy" /* relation value codes */ -#define EQUAL "re" -#define GREATER_THAN "rg" +#define EQUAL "re" +#define GREATER_THAN "rg" #define GREATER_THAN_OR_EQUAL "ro" -#define LESS_THAN "rl" +#define LESS_THAN "rl" #define LESS_THAN_OR_EQUAL "rp" -#define NOT_EQUAL "rn" +#define NOT_EQUAL "rn" /* position value codes */ -#define FIRST_IN_FIELD "pf" +#define FIRST_IN_FIELD "pf" #define FIRST_IN_SUBFIELD "ps" #define FIRST_IN_A_SUBFIELD "pa" #define FIRST_IN_NOT_A_SUBFIELD "pt" #define ANY_POSITION_IN_FIELD "py" /* structure value codes */ -#define PHRASE "sp" -#define WORD "sw" -#define KEY "sk" -#define WORD_LIST "sl" +#define PHRASE "sp" +#define WORD "sw" +#define KEY "sk" +#define WORD_LIST "sl" /* truncation value codes */ -#define NO_TRUNCATION "tn" +#define NO_TRUNCATION "tn" #define RIGHT_TRUNCATION "tr" #define PROC_NUM_INCLUDED_IN_SEARCH_ARG "ti" /* completeness value codes */ #define INCOMPLETE_SUBFIELD "ci" #define COMPLETE_SUBFIELD "cs" -#define COMPLETEFIELD "cf" +#define COMPLETEFIELD "cf" /* operator codes */ #define AND "a" @@ -427,40 +430,40 @@ char *defaultImplementationVersion(void); /* term types */ #define TT_Attribute 1 #define TT_ResultSetID 2 -#define TT_Operator 3 +#define TT_Operator 3 #define ATTRIBUTE_SIZE 3 #define OPERATOR_SIZE 2 -typedef struct query_term { - /* type */ - long TermType; - /* for term */ - char Use[ATTRIBUTE_SIZE]; - char Relation[ATTRIBUTE_SIZE]; - char Position[ATTRIBUTE_SIZE]; - char Structure[ATTRIBUTE_SIZE]; - char Truncation[ATTRIBUTE_SIZE]; - char Completeness[ATTRIBUTE_SIZE]; - any *Term; - /* for result set */ - any *ResultSetID; - /* for operator */ - char Operator[OPERATOR_SIZE]; -} query_term; + typedef struct query_term { + /* type */ + long TermType; + /* for term */ + char Use[ATTRIBUTE_SIZE]; + char Relation[ATTRIBUTE_SIZE]; + char Position[ATTRIBUTE_SIZE]; + char Structure[ATTRIBUTE_SIZE]; + char Truncation[ATTRIBUTE_SIZE]; + char Completeness[ATTRIBUTE_SIZE]; + any *Term; + /* for result set */ + any *ResultSetID; + /* for operator */ + char Operator[OPERATOR_SIZE]; + } query_term; /*----------------------------------------------------------------------*/ /* functions */ -query_term *makeAttributeTerm(char *use, char *relation, char *position, char *structure, - char *truncation, char *completeness, any *term); -query_term *makeResultSetTerm(any *resultSet); -query_term *makeOperatorTerm(char *operatorCode); -void freeTerm(void *qt); -char *writeQueryTerm(query_term *qt, char *buffer, long *len); -char *readQueryTerm(query_term **qt, char *buffer); -any *writeQuery(query_term **terms); -query_term **readQuery(any *info); + query_term *makeAttributeTerm(char *use, char *relation, char *position, char *structure, + char *truncation, char *completeness, any *term); + query_term *makeResultSetTerm(any *resultSet); + query_term *makeOperatorTerm(char *operatorCode); + void freeTerm(void *qt); + char *writeQueryTerm(query_term *qt, char *buffer, long *len); + char *readQueryTerm(query_term **qt, char *buffer); + any *writeQuery(query_term **terms); + query_term **readQuery(any *info); /*----------------------------------------------------------------------*/ @@ -469,22 +472,22 @@ query_term **readQuery(any *info); * *----------------------------------------------------------------------*/ -char *generate_retrieval_apdu(char *buff, - long *buff_len, - any *docID, - long chunk_type, - long start_line, long end_line, - char *type, - char *database_name); + char *generate_retrieval_apdu(char *buff, + long *buff_len, + any *docID, + long chunk_type, + long start_line, long end_line, + char *type, + char *database_name); -long interpret_message(char *request_message, - long request_length, - char *response_message, - long response_buffer_length, /* length of the buffer (modified) */ - long connection, - boolean verbose); + long interpret_message(char *request_message, + long request_length, + char *response_message, + long response_buffer_length, /* length of the buffer (modified) */ + long connection, + boolean verbose); -char *trim_junk(char *headline); + char *trim_junk(char *headline); /* * Routines originally from ZProt.c -- FM @@ -493,163 +496,169 @@ char *trim_junk(char *headline); /* APDU types */ -typedef struct InitAPDU { - pdu_type PDUType; - boolean willSearch, willPresent, willDelete; - boolean supportAccessControl, supportResourceControl; - long PreferredMessageSize; - long MaximumRecordSize; - char *IDAuthentication; - char *ImplementationID; - char *ImplementationName; - char *ImplementationVersion; - any *ReferenceID; - void *UserInformationField; -} InitAPDU; - -typedef struct InitResponseAPDU { - pdu_type PDUType; - boolean Result; - boolean willSearch, willPresent, willDelete; - boolean supportAccessControl, supportResourceControl; - long PreferredMessageSize; - long MaximumRecordSize; - char *IDAuthentication; - char *ImplementationID; - char *ImplementationName; - char *ImplementationVersion; - any *ReferenceID; - void *UserInformationField; -} InitResponseAPDU; - -typedef struct SearchAPDU { - pdu_type PDUType; - long SmallSetUpperBound; - long LargeSetLowerBound; - long MediumSetPresentNumber; - boolean ReplaceIndicator; - char *ResultSetName; - char **DatabaseNames; - char *QueryType; - char **ElementSetNames; - any *ReferenceID; - void *Query; -} SearchAPDU; - -typedef struct SearchResponseAPDU { - pdu_type PDUType; - long SearchStatus; - long ResultCount; - long NumberOfRecordsReturned; - long NextResultSetPosition; - long ResultSetStatus; - long PresentStatus; - any *ReferenceID; - void *DatabaseDiagnosticRecords; -} SearchResponseAPDU; - -typedef struct PresentAPDU { - pdu_type PDUType; - long NumberOfRecordsRequested; - long ResultSetStartPosition; - char *ResultSetID; - char *ElementSetNames; - any *ReferenceID; - void *PresentInfo; -} PresentAPDU; - -typedef struct PresentResponseAPDU { - pdu_type PDUType; - boolean PresentStatus; - long NumberOfRecordsReturned; - long NextResultSetPosition; - any *ReferenceID; - void *DatabaseDiagnosticRecords; -} PresentResponseAPDU; + typedef struct InitAPDU { + pdu_type PDUType; + boolean willSearch, willPresent, willDelete; + boolean supportAccessControl, supportResourceControl; + long PreferredMessageSize; + long MaximumRecordSize; + char *IDAuthentication; + char *ImplementationID; + char *ImplementationName; + char *ImplementationVersion; + any *ReferenceID; + void *UserInformationField; + } InitAPDU; + + typedef struct InitResponseAPDU { + pdu_type PDUType; + boolean Result; + boolean willSearch, willPresent, willDelete; + boolean supportAccessControl, supportResourceControl; + long PreferredMessageSize; + long MaximumRecordSize; + char *IDAuthentication; + char *ImplementationID; + char *ImplementationName; + char *ImplementationVersion; + any *ReferenceID; + void *UserInformationField; + } InitResponseAPDU; + + typedef struct SearchAPDU { + pdu_type PDUType; + long SmallSetUpperBound; + long LargeSetLowerBound; + long MediumSetPresentNumber; + boolean ReplaceIndicator; + char *ResultSetName; + char **DatabaseNames; + char *QueryType; + char **ElementSetNames; + any *ReferenceID; + void *Query; + } SearchAPDU; + + typedef struct SearchResponseAPDU { + pdu_type PDUType; + long SearchStatus; + long ResultCount; + long NumberOfRecordsReturned; + long NextResultSetPosition; + long ResultSetStatus; + long PresentStatus; + any *ReferenceID; + void *DatabaseDiagnosticRecords; + } SearchResponseAPDU; + + typedef struct PresentAPDU { + pdu_type PDUType; + long NumberOfRecordsRequested; + long ResultSetStartPosition; + char *ResultSetID; + char *ElementSetNames; + any *ReferenceID; + void *PresentInfo; + } PresentAPDU; + + typedef struct PresentResponseAPDU { + pdu_type PDUType; + boolean PresentStatus; + long NumberOfRecordsReturned; + long NextResultSetPosition; + any *ReferenceID; + void *DatabaseDiagnosticRecords; + } PresentResponseAPDU; /*----------------------------------------------------------------------*/ /* Functions */ -InitAPDU *makeInitAPDU(boolean search, boolean present, boolean deleteIt, - boolean accessControl, boolean resourceControl, long prefMsgSize, - long maxMsgSize, - char *auth, - char *id, - char *name, - char *version, - any *refID, - void *userInfo); -void freeInitAPDU(InitAPDU * init); -char *writeInitAPDU(InitAPDU * init, char *buffer, long *len); -char *readInitAPDU(InitAPDU ** init, char *buffer); - -InitResponseAPDU *makeInitResponseAPDU(boolean result, - boolean search, - boolean present, - boolean deleteIt, - boolean accessControl, - boolean resourceControl, - long prefMsgSize, - long maxMsgSize, - char *auth, - char *id, - char *name, - char *version, - any *refID, - void *userInfo); -void freeInitResponseAPDU(InitResponseAPDU *init); -char *writeInitResponseAPDU(InitResponseAPDU *init, char *buffer, long *len); -char *readInitResponseAPDU(InitResponseAPDU **init, char *buffer); -InitResponseAPDU *replyToInitAPDU(InitAPDU * init, boolean result, void *userInfo); - -SearchAPDU *makeSearchAPDU(long small, long large, long medium, - boolean replace, char *name, char **databases, - char *type, char **elements, any *refID, void *queryInfo); -void freeSearchAPDU(SearchAPDU *query); -char *writeSearchAPDU(SearchAPDU *query, char *buffer, long *len); -char *readSearchAPDU(SearchAPDU **query, char *buffer); - -SearchResponseAPDU *makeSearchResponseAPDU(long result, long count, - long recordsReturned, long nextPos, - long resultStatus, long presentStatus, - any *refID, void *records); -void freeSearchResponseAPDU(SearchResponseAPDU *queryResponse); -char *writeSearchResponseAPDU(SearchResponseAPDU *queryResponse, char *buffer, long *len); -char *readSearchResponseAPDU(SearchResponseAPDU **queryResponse, char *buffer); - -PresentAPDU *makePresentAPDU(long recsReq, long startPos, - char *resultID, any *refID, void *info); -void freePresentAPDU(PresentAPDU * present); -char *writePresentAPDU(PresentAPDU * present, char *buffer, long *len); -char *readPresentAPDU(PresentAPDU ** present, char *buffer); - -PresentResponseAPDU *makePresentResponseAPDU(boolean status, long recsRet, - long nextPos, any *refID, - void *records); -void freePresentResponseAPDU(PresentResponseAPDU * present); -char *writePresentResponseAPDU(PresentResponseAPDU * present, char *buffer, long *len); -char *readPresentResponseAPDU(PresentResponseAPDU ** present, char *buffer); + InitAPDU *makeInitAPDU(boolean search, boolean present, boolean deleteIt, + boolean accessControl, boolean resourceControl, long prefMsgSize, + long maxMsgSize, + char *auth, + char *id, + char *name, + char *version, + any *refID, + void *userInfo); + void freeInitAPDU(InitAPDU * init); + char *writeInitAPDU(InitAPDU * init, char *buffer, long *len); + char *readInitAPDU(InitAPDU ** init, char *buffer); + + InitResponseAPDU *makeInitResponseAPDU(boolean result, + boolean search, + boolean present, + boolean deleteIt, + boolean accessControl, + boolean resourceControl, + long prefMsgSize, + long maxMsgSize, + char *auth, + char *id, + char *name, + char *version, + any *refID, + void *userInfo); + void freeInitResponseAPDU(InitResponseAPDU *init); + char *writeInitResponseAPDU(InitResponseAPDU *init, char *buffer, long *len); + char *readInitResponseAPDU(InitResponseAPDU **init, char *buffer); + InitResponseAPDU *replyToInitAPDU(InitAPDU * init, boolean result, void *userInfo); + + SearchAPDU *makeSearchAPDU(long small, long large, long medium, + boolean replace, char *name, char **databases, + char *type, char **elements, any *refID, void *queryInfo); + void freeSearchAPDU(SearchAPDU *query); + char *writeSearchAPDU(SearchAPDU *query, char *buffer, long *len); + char *readSearchAPDU(SearchAPDU **query, char *buffer); + + SearchResponseAPDU *makeSearchResponseAPDU(long result, long count, + long recordsReturned, long nextPos, + long resultStatus, long presentStatus, + any *refID, void *records); + void freeSearchResponseAPDU(SearchResponseAPDU *queryResponse); + char *writeSearchResponseAPDU(SearchResponseAPDU *queryResponse, char + *buffer, long *len); + char *readSearchResponseAPDU(SearchResponseAPDU **queryResponse, char *buffer); + + PresentAPDU *makePresentAPDU(long recsReq, long startPos, + char *resultID, any *refID, void *info); + void freePresentAPDU(PresentAPDU * present); + char *writePresentAPDU(PresentAPDU * present, char *buffer, long *len); + char *readPresentAPDU(PresentAPDU ** present, char *buffer); + + PresentResponseAPDU *makePresentResponseAPDU(boolean status, long recsRet, + long nextPos, any *refID, + void *records); + void freePresentResponseAPDU(PresentResponseAPDU * present); + char *writePresentResponseAPDU(PresentResponseAPDU * present, char + *buffer, long *len); + char *readPresentResponseAPDU(PresentResponseAPDU ** present, char *buffer); /*----------------------------------------------------------------------*/ /* user extension hooks: */ -extern char *writeInitInfo(InitAPDU * init, char *buffer, long *len); -extern char *readInitInfo(void **info, char *buffer); + extern char *writeInitInfo(InitAPDU * init, char *buffer, long *len); + extern char *readInitInfo(void **info, char *buffer); -extern char *writeInitResponseInfo(InitResponseAPDU *init, char *buffer, long *len); -extern char *readInitResponseInfo(void **info, char *buffer); + extern char *writeInitResponseInfo(InitResponseAPDU *init, char *buffer, long *len); + extern char *readInitResponseInfo(void **info, char *buffer); -extern char *writeSearchInfo(SearchAPDU *query, char *buffer, long *len); -extern char *readSearchInfo(void **info, char *buffer); + extern char *writeSearchInfo(SearchAPDU *query, char *buffer, long *len); + extern char *readSearchInfo(void **info, char *buffer); -extern char *writeSearchResponseInfo(SearchResponseAPDU *query, char *buffer, long *len); -extern char *readSearchResponseInfo(void **info, char *buffer); + extern char *writeSearchResponseInfo(SearchResponseAPDU *query, char + *buffer, long *len); + extern char *readSearchResponseInfo(void **info, char *buffer); -extern char *writePresentInfo(PresentAPDU * present, char *buffer, long *len); -extern char *readPresentInfo(void **info, char *buffer); + extern char *writePresentInfo(PresentAPDU * present, char *buffer, long *len); + extern char *readPresentInfo(void **info, char *buffer); -extern char *writePresentResponseInfo(PresentResponseAPDU * present, char - *buffer, long *len); -extern char *readPresentResponseInfo(void **info, char *buffer); + extern char *writePresentResponseInfo(PresentResponseAPDU * present, char + *buffer, long *len); + extern char *readPresentResponseInfo(void **info, char *buffer); -#endif /* HTVMSWAIS_H */ +#ifdef __cplusplus +} +#endif +#endif /* HTVMSWAIS_H */ diff --git a/WWW/Library/Implementation/HTWAIS.h b/WWW/Library/Implementation/HTWAIS.h index 5f7af9f1..4ba6f678 100644 --- a/WWW/Library/Implementation/HTWAIS.h +++ b/WWW/Library/Implementation/HTWAIS.h @@ -27,11 +27,17 @@ #include <HTAccess.h> +#ifdef __cplusplus +extern "C" { +#endif #ifdef GLOBALREF_IS_MACRO -extern GLOBALREF (HTProtocol, HTWAIS); + extern GLOBALREF (HTProtocol, HTWAIS); #else -GLOBALREF HTProtocol HTWAIS; -#endif /* GLOBALDEF_IS_MACRO */ + GLOBALREF HTProtocol HTWAIS; +#endif /* GLOBALDEF_IS_MACRO */ -#endif /* HTWAIS_H */ +#ifdef __cplusplus +} +#endif +#endif /* HTWAIS_H */ diff --git a/WWW/Library/Implementation/HTWSRC.h b/WWW/Library/Implementation/HTWSRC.h index c8b27bcc..152d27ab 100644 --- a/WWW/Library/Implementation/HTWSRC.h +++ b/WWW/Library/Implementation/HTWSRC.h @@ -13,11 +13,14 @@ #include <HTFormat.h> -extern char from_hex(char c); +#ifdef __cplusplus +extern "C" { +#endif + extern char from_hex(char c); -extern HTStream *HTWSRCConvert(HTPresentation *pres, - HTParentAnchor *anchor, - HTStream *sink); + extern HTStream *HTWSRCConvert(HTPresentation *pres, + HTParentAnchor *anchor, + HTStream *sink); /* @@ -30,8 +33,11 @@ Escaping Strings freed by the caller. */ -extern char *HTDeSlash(const char *str); + extern char *HTDeSlash(const char *str); -extern char *HTEnSlash(const char *str); + extern char *HTEnSlash(const char *str); -#endif /* HTWSRC_H */ +#ifdef __cplusplus +} +#endif +#endif /* HTWSRC_H */ diff --git a/WWW/Library/Implementation/HText.h b/WWW/Library/Implementation/HText.h index 4c7b1dce..f0b44e52 100644 --- a/WWW/Library/Implementation/HText.h +++ b/WWW/Library/Implementation/HText.h @@ -12,25 +12,29 @@ */ #ifndef HTEXT_H #define HTEXT_H + #include <HTAnchor.h> #include <HTStyle.h> #include <HTStream.h> #include <SGML.h> +#ifdef __cplusplus +extern "C" { +#endif #ifndef THINK_C #ifndef HyperText /* Objective C version defined HyperText */ -typedef struct _HText HText; /* Normal Library */ + typedef struct _HText HText; /* Normal Library */ #endif #else -class CHyperText; /* Mac Think-C browser hook */ -typedef CHyperText HText; + class CHyperText; /* Mac Think-C browser hook */ + typedef CHyperText HText; #endif -extern HText *HTMainText; /* Pointer to current main text */ -extern HTParentAnchor *HTMainAnchor; /* Pointer to current text's anchor */ + extern HText *HTMainText; /* Pointer to current main text */ + extern HTParentAnchor *HTMainAnchor; /* Pointer to current text's anchor */ -extern const char *HTAppName; /* Application name */ -extern const char *HTAppVersion; /* Application version */ + extern const char *HTAppName; /* Application name */ + extern const char *HTAppVersion; /* Application version */ /* @@ -44,21 +48,21 @@ Creation and deletion which is kep by the creating stream. */ -extern HText *HText_new(HTParentAnchor *anchor); + extern HText *HText_new(HTParentAnchor *anchor); -extern HText *HText_new2(HTParentAnchor *anchor, - HTStream *output_stream); + extern HText *HText_new2(HTParentAnchor *anchor, + HTStream *output_stream); -extern HText *HText_new3(HTParentAnchor *anchor, - HTStream *output_stream, - HTStructured * structure); + extern HText *HText_new3(HTParentAnchor *anchor, + HTStream *output_stream, + HTStructured * structure); /* FREE HYPERTEXT OBJECT */ -extern void HText_free(HText *me); + extern void HText_free(HText *me); /* @@ -70,9 +74,9 @@ Object Building methods which are flushed at the end. */ -extern void HText_beginAppend(HText *text); + extern void HText_beginAppend(HText *text); -extern void HText_endAppend(HText *text); + extern void HText_endAppend(HText *text); /* @@ -80,14 +84,14 @@ extern void HText_endAppend(HText *text); */ -extern void HText_setStyle(HText *text, HTStyle *style); + extern void HText_setStyle(HText *text, HTStyle *style); /* ADD ONE CHARACTER */ -extern void HText_appendCharacter(HText *text, int ch); + extern void HText_appendCharacter(HText *text, int ch); /* @@ -95,7 +99,7 @@ extern void HText_appendCharacter(HText *text, int ch); */ -extern void HText_appendText(HText *text, const char *str); + extern void HText_appendText(HText *text, const char *str); /* @@ -104,11 +108,11 @@ extern void HText_appendText(HText *text, const char *str); and similar things */ -extern void HText_appendParagraph(HText *text); + extern void HText_appendParagraph(HText *text); -extern void HText_appendLineBreak(HText *text); + extern void HText_appendLineBreak(HText *text); -extern void HText_appendHorizontalRule(HText *text); + extern void HText_appendHorizontalRule(HText *text); /* @@ -123,10 +127,10 @@ extern void HText_appendHorizontalRule(HText *text); Anchors may not be nested. */ -extern int HText_beginAnchor(HText *text, BOOL underline, - HTChildAnchor *anc); -extern void HText_endAnchor(HText *text, int number); -extern BOOL HText_isAnchorBlank(HText *text, int number); + extern int HText_beginAnchor(HText *text, BOOL underline, + HTChildAnchor *anc); + extern void HText_endAnchor(HText *text, int number); + extern BOOL HText_isAnchorBlank(HText *text, int number); /* @@ -141,17 +145,17 @@ extern BOOL HText_isAnchorBlank(HText *text, int number); simply generate some text linked to the image itself as a separate document. */ -extern void HText_appendImage(HText *text, HTChildAnchor *anc, - const char *alternative_text, - int alignment, - BOOL isMap); + extern void HText_appendImage(HText *text, HTChildAnchor *anc, + const char *alternative_text, + int alignment, + BOOL isMap); /* RETURN THE ANCHOR ASSOCIATED WITH THIS NODE */ -extern HTParentAnchor *HText_nodeAnchor(HText *me); + extern HTParentAnchor *HText_nodeAnchor(HText *me); /* @@ -165,8 +169,8 @@ Browsing functions */ -extern BOOL HText_select(HText *text); -extern BOOL HText_selectAnchor(HText *text, HTChildAnchor *anchor); + extern BOOL HText_select(HText *text); + extern BOOL HText_selectAnchor(HText *text, HTChildAnchor *anchor); /* @@ -181,35 +185,38 @@ Editing functions */ /* Apply this style to the selection */ -extern void HText_applyStyle(HText *me, HTStyle *style); + extern void HText_applyStyle(HText *me, HTStyle *style); /* Update all text with changed style. */ -extern void HText_updateStyle(HText *me, HTStyle *style); + extern void HText_updateStyle(HText *me, HTStyle *style); /* Return style of selection */ -extern HTStyle *HText_selectionStyle(HText *me, HTStyleSheet *sheet); + extern HTStyle *HText_selectionStyle(HText *me, HTStyleSheet *sheet); /* Paste in styled text */ -extern void HText_replaceSel(HText *me, const char *aString, - HTStyle *aStyle); + extern void HText_replaceSel(HText *me, const char *aString, + HTStyle *aStyle); /* Apply this style to the selection and all similarly formatted text * (style recovery only) */ -extern void HTextApplyToSimilar(HText *me, HTStyle *style); + extern void HTextApplyToSimilar(HText *me, HTStyle *style); /* Select the first unstyled run. * (style recovery only) */ -extern void HTextSelectUnstyled(HText *me, HTStyleSheet *sheet); + extern void HTextSelectUnstyled(HText *me, HTStyleSheet *sheet); /* Anchor handling: */ -extern void HText_unlinkSelection(HText *me); -extern HTAnchor *HText_referenceSelected(HText *me); -extern HTAnchor *HText_linkSelTo(HText *me, HTAnchor * anchor); + extern void HText_unlinkSelection(HText *me); + extern HTAnchor *HText_referenceSelected(HText *me); + extern HTAnchor *HText_linkSelTo(HText *me, HTAnchor * anchor); -#endif /* HTEXT_H */ +#ifdef __cplusplus +} +#endif +#endif /* HTEXT_H */ diff --git a/WWW/Library/Implementation/LYLeaks.h b/WWW/Library/Implementation/LYLeaks.h index 81abd551..69ccd4f4 100644 --- a/WWW/Library/Implementation/LYLeaks.h +++ b/WWW/Library/Implementation/LYLeaks.h @@ -57,6 +57,9 @@ #include <HTUtils.h> #endif +#ifdef __cplusplus +extern "C" { +#endif /* * Constant defines */ @@ -65,49 +68,47 @@ #define LEAKAGE_SINK "sys$login:Lynx.leaks" #else #define LEAKAGE_SINK "Lynx.leaks" -#endif /* VMS */ - +#endif /* VMS */ /* * Data structures - */ -typedef struct SourceLocation_tag { - /* - * The file name and line number of where an event took place. - */ - const char *cp_FileName; - short ssi_LineNumber; -} SourceLocation; - -typedef struct AllocationList_tag { - /* - * A singly linked list. - */ - struct AllocationList_tag *ALp_Next; - - /* - * Count the number of mallocs. - */ - long st_Sequence; - - /* - * The memory pointer allocated. If set to NULL, then an invalid request - * was made. The invalid pointer also. - */ - void *vp_Alloced; - void *vp_BadRequest; - - /* - * The size in bytes of the allocated memory. - */ - size_t st_Bytes; - - /* - * The source location of specific event (calloc, malloc, free). realloc - * kept separate since will track last realloc on pointer. - */ - SourceLocation SL_memory; - SourceLocation SL_realloc; -} AllocationList; + */ typedef struct SourceLocation_tag { + /* + * The file name and line number of where an event took place. + */ + const char *cp_FileName; + short ssi_LineNumber; + } SourceLocation; + + typedef struct AllocationList_tag { + /* + * A singly linked list. + */ + struct AllocationList_tag *ALp_Next; + + /* + * Count the number of mallocs. + */ + long st_Sequence; + + /* + * The memory pointer allocated. If set to NULL, then an invalid request + * was made. The invalid pointer also. + */ + void *vp_Alloced; + void *vp_BadRequest; + + /* + * The size in bytes of the allocated memory. + */ + size_t st_Bytes; + + /* + * The source location of specific event (calloc, malloc, free). realloc + * kept separate since will track last realloc on pointer. + */ + SourceLocation SL_memory; + SourceLocation SL_realloc; + } AllocationList; /* * Global variable declarations @@ -126,24 +127,24 @@ typedef struct AllocationList_tag { */ #ifdef malloc #undef malloc -#endif /* malloc */ +#endif /* malloc */ #define malloc(st_bytes) LYLeakMalloc(st_bytes, __FILE__, __LINE__) #ifdef calloc #undef calloc -#endif /* calloc */ +#endif /* calloc */ #define calloc(st_number, st_bytes) LYLeakCalloc(st_number, st_bytes, \ __FILE__, __LINE__) #ifdef realloc #undef realloc -#endif /* realloc */ +#endif /* realloc */ #define realloc(vp_alloced, st_newbytes) LYLeakRealloc(vp_alloced, \ st_newbytes, __FILE__, __LINE__) #ifdef free #undef free -#endif /* free */ +#endif /* free */ #define free(vp_alloced) LYLeakFree(vp_alloced, __FILE__, __LINE__) /* @@ -152,12 +153,12 @@ typedef struct AllocationList_tag { */ #ifdef StrAllocCopy #undef StrAllocCopy -#endif /* StrAllocCopy */ +#endif /* StrAllocCopy */ #define StrAllocCopy(dest, src) LYLeakSACopy(&(dest), src, __FILE__, __LINE__) #ifdef StrAllocCat #undef StrAllocCat -#endif /* StrAllocCat */ +#endif /* StrAllocCat */ #define StrAllocCat(dest, src) LYLeakSACat(&(dest), src, __FILE__, __LINE__) #define mark_malloced(a,size) LYLeak_mark_malloced(a,size, __FILE__, __LINE__) @@ -166,22 +167,22 @@ typedef struct AllocationList_tag { #ifdef HTSprintf0 #undef HTSprintf0 -#endif /* HTSprintf0 */ +#endif /* HTSprintf0 */ #define HTSprintf0 (Get_htsprintf0_fn(__FILE__,__LINE__)) #ifdef HTSprintf #undef HTSprintf -#endif /* HTSprintf */ +#endif /* HTSprintf */ #define HTSprintf (Get_htsprintf_fn(__FILE__,__LINE__)) -#endif /* LY_FIND_LEAKS_EXTENDED and not NO_EXTENDED_MEMORY_TRACKING */ +#endif /* LY_FIND_LEAKS_EXTENDED and not NO_EXTENDED_MEMORY_TRACKING */ -#else /* LY_FIND_LEAKS && !NO_MEMORY_TRACKING */ +#else /* LY_FIND_LEAKS && !NO_MEMORY_TRACKING */ #define mark_malloced(a,size) /* no-op */ #define LYLeakSequence() (-1) -#endif /* LY_FIND_LEAKS && !NO_MEMORY_TRACKING */ +#endif /* LY_FIND_LEAKS && !NO_MEMORY_TRACKING */ #if defined(LY_FIND_LEAKS) #define PUBLIC_IF_FIND_LEAKS /* nothing */ @@ -194,46 +195,49 @@ typedef struct AllocationList_tag { * See the appropriate source file for usage. */ #ifndef LYLeakSequence -extern long LYLeakSequence(void); + extern long LYLeakSequence(void); #endif -extern void LYLeaks(void); + extern void LYLeaks(void); #ifdef LY_FIND_LEAKS_EXTENDED -extern AllocationList *LYLeak_mark_malloced(void *vp_alloced, - size_t st_bytes, - const char *cp_File, - const short ssi_Line); -#endif /* LY_FIND_LEAKS_EXTENDED */ -extern void *LYLeakMalloc(size_t st_bytes, const char *cp_File, - const short ssi_Line); -extern void *LYLeakCalloc(size_t st_number, size_t st_bytes, const char *cp_File, - const short ssi_Line); -extern void *LYLeakRealloc(void *vp_alloced, - size_t st_newbytes, + extern AllocationList *LYLeak_mark_malloced(void *vp_alloced, + size_t st_bytes, + const char *cp_File, + const short ssi_Line); +#endif /* LY_FIND_LEAKS_EXTENDED */ + extern void *LYLeakMalloc(size_t st_bytes, const char *cp_File, + const short ssi_Line); + extern void *LYLeakCalloc(size_t st_number, size_t st_bytes, const char *cp_File, + const short ssi_Line); + extern void *LYLeakRealloc(void *vp_alloced, + size_t st_newbytes, + const char *cp_File, + const short ssi_Line); + extern void LYLeakFree(void *vp_alloced, const char *cp_File, const short ssi_Line); -extern void LYLeakFree(void *vp_alloced, - const char *cp_File, - const short ssi_Line); -extern char *LYLeakSACopy(char **dest, - const char *src, - const char *cp_File, - const short ssi_Line); -extern char *LYLeakSACat(char **dest, - const char *src, - const char *cp_File, - const short ssi_Line); + extern char *LYLeakSACopy(char **dest, + const char *src, + const char *cp_File, + const short ssi_Line); + extern char *LYLeakSACat(char **dest, + const char *src, + const char *cp_File, + const short ssi_Line); #ifdef LY_FIND_LEAKS_EXTENDED /* * Trick to get tracking of var arg functions without relying on var arg * preprocessor macros: */ -typedef char *HTSprintflike(char **, const char *,...); -extern HTSprintflike *Get_htsprintf_fn(const char *cp_File, - const short ssi_Line); -extern HTSprintflike *Get_htsprintf0_fn(const char *cp_File, - const short ssi_Line); -#endif /* LY_FIND_LEAKS_EXTENDED */ - -#endif /* __LYLEAKS_H */ + typedef char *HTSprintflike(char **, const char *,...); + extern HTSprintflike *Get_htsprintf_fn(const char *cp_File, + const short ssi_Line); + extern HTSprintflike *Get_htsprintf0_fn(const char *cp_File, + const short ssi_Line); +#endif /* LY_FIND_LEAKS_EXTENDED */ + +#ifdef __cplusplus +} +#endif +#endif /* __LYLEAKS_H */ diff --git a/WWW/Library/Implementation/LYexit.h b/WWW/Library/Implementation/LYexit.h index 7f134d83..09414880 100644 --- a/WWW/Library/Implementation/LYexit.h +++ b/WWW/Library/Implementation/LYexit.h @@ -27,36 +27,33 @@ #include <HTUtils.h> #endif +#ifdef __cplusplus +extern "C" { +#endif /* * Constant defines */ #ifdef exit #undef exit #endif - #define exit(code) LYexit(code) - #define atexit LYatexit #define ATEXITSIZE 50 - /* * Data structures - */ - -/* - * Global variable declarations - */ - -/* - * Macros - */ - -/* - * Function declarations - */ -extern void reset_signals(void); -extern void exit_immediately(int status) GCC_NORETURN; -extern void LYexit(int status) GCC_NORETURN; -extern int LYatexit(void (*function) (void)); - -#endif /* __LYEXIT_H */ + *//* + * Global variable declarations + *//* + * Macros + *//* + * Function declarations + */ extern void outofmem(const char *fname, const char *func); + extern void reset_signals(void); + extern void exit_immediately(int status) GCC_NORETURN; + extern void LYexit(int status) GCC_NORETURN; + extern int LYatexit(void (*function) (void)); + +#ifdef __cplusplus +} +#endif +#endif /* __LYEXIT_H */ diff --git a/WWW/Library/Implementation/SGML.c b/WWW/Library/Implementation/SGML.c index 988c8d6f..eae3db3d 100644 --- a/WWW/Library/Implementation/SGML.c +++ b/WWW/Library/Implementation/SGML.c @@ -26,6 +26,7 @@ #include <UCAux.h> #include <HTChunk.h> +#include <HTUtils.h> #include <LYCharSets.h> #include <LYCharVals.h> /* S/390 -- gil -- 0635 */ @@ -901,7 +902,7 @@ static void handle_sgmlatt(HTStream *context) * Convenience macros - tags (elements) are identified sometimes by an int or * enum value ('TAGNUM'), sometimes by a pointer to HTTag ('TAGP'). - kw */ -#define TAGNUM_OF_TAGP(t) (t - context->dtd->tags) +#define TAGNUM_OF_TAGP(t) (HTMLElement) (t - context->dtd->tags) #define TAGP_OF_TAGNUM(e) (context->dtd->tags + e) /* @@ -916,7 +917,7 @@ static void handle_sgmlatt(HTStream *context) #define ALT_TAGNUM(e) ((e == HTML_OBJECT) ? HTML_ALT_OBJECT : e) /* return 'TAGNUM' of the normal mode for 'TAGNUM' e which may be alt. */ -#define NORMAL_TAGNUM(e) (((int)(e) >= HTML_ELEMENTS) ? HTML_OBJECT : e) +#define NORMAL_TAGNUM(e) (((int)(e) >= HTML_ELEMENTS) ? HTML_OBJECT : (HTMLElement)e) /* More convenience stuff. - kw */ #define ALT_TAGP_OF_TAGNUM(e) TAGP_OF_TAGNUM(ALT_TAGNUM(e)) @@ -4909,7 +4910,8 @@ void TO_SJIS(const unsigned char *arg, { unsigned char *euc; - euc = malloc(strlen((const char *) arg) + 1); + euc = typeMallocn(unsigned char, strlen((const char *) arg) + 1); + #ifdef CJK_EX if (!euc) outofmem(__FILE__, "TO_SJIS"); @@ -4931,7 +4933,7 @@ void TO_JIS(const unsigned char *arg, jis[0] = 0; return; } - euc = malloc(strlen((const char *) arg) + 1); + euc = typeMallocn(unsigned char, strlen((const char *)arg) + 1); #ifdef CJK_EX if (!euc) outofmem(__FILE__, "TO_JIS"); diff --git a/WWW/Library/Implementation/SGML.h b/WWW/Library/Implementation/SGML.h index 2c75b088..c595dc91 100644 --- a/WWW/Library/Implementation/SGML.h +++ b/WWW/Library/Implementation/SGML.h @@ -21,39 +21,41 @@ #include <HTAnchor.h> #include <LYJustify.h> +#ifdef __cplusplus +extern "C" { +#endif /* SGML content types - */ -typedef enum { - SGML_EMPTY, /* No content. */ - SGML_LITTERAL, /* Literal character data. Recognize exact close tag only. + */ typedef enum { + SGML_EMPTY, /* No content. */ + SGML_LITTERAL, /* Literal character data. Recognize exact close tag only. Old www server compatibility only! Not SGML */ - SGML_CDATA, /* Character data. Recognize </ only. + SGML_CDATA, /* Character data. Recognize </ only. (But we treat it just as SGML_LITTERAL.) */ - SGML_SCRIPT, /* Like CDATA, but allow it to be a comment */ - SGML_RCDATA, /* Replaceable character data. Should recognize </ and &ref; + SGML_SCRIPT, /* Like CDATA, but allow it to be a comment */ + SGML_RCDATA, /* Replaceable character data. Should recognize </ and &ref; (but we treat it like SGML_MIXED for old times' sake). */ - SGML_MIXED, /* Elements and parsed character data. + SGML_MIXED, /* Elements and parsed character data. Recognize all markup. */ - SGML_ELEMENT, /* Any data found should be regarded as an error. + SGML_ELEMENT, /* Any data found should be regarded as an error. (But we treat it just like SGML_MIXED.) */ - SGML_PCDATA /* Should contain no elements but &ref; is parsed. + SGML_PCDATA /* Should contain no elements but &ref; is parsed. (We treat it like SGML_CDATA wrt. contained tags i.e. pass them on literally, i.e. like we should treat SGML_RCDATA) (added by KW). */ -} SGMLContent; + } SGMLContent; -typedef struct { - const char *name; /* The name of the attribute */ + typedef struct { + const char *name; /* The name of the attribute */ #ifdef USE_PRETTYSRC - char type; /* code of the type of the attribute. Code + char type; /* code of the type of the attribute. Code values are in HTMLDTD.h */ #endif -} attr; + } attr; -typedef int TagClass; + typedef int TagClass; /* textflow */ #define Tgc_FONTlike 0x00001 /* S,STRIKE,I,B,TT,U,BIG,SMALL,STYLE,BLINK;BR,TAB */ @@ -91,7 +93,7 @@ typedef int TagClass; /* Some more properties of tags (or rather, elements) and rules how to deal with them. - kw */ -typedef int TagFlags; + typedef int TagFlags; #define Tgf_endO 0x00001 /* end tag can be Omitted */ #define Tgf_startO 0x00002 /* start tag can be Omitted */ @@ -124,46 +126,46 @@ typedef int TagFlags; * except for that which opens a matching closing tag. * */ -typedef struct _tag HTTag; -struct _tag { - const char *name; /* The name of the tag */ + typedef struct _tag HTTag; + struct _tag { + const char *name; /* The name of the tag */ #ifdef USE_COLOR_STYLE - int name_len; /* The length of the name */ + int name_len; /* The length of the name */ #endif #ifdef EXP_JUSTIFY_ELTS - BOOL can_justify; /* justification allowed? */ + BOOL can_justify; /* justification allowed? */ #endif - attr *attributes; /* The list of acceptable attributes */ - int number_of_attributes; /* Number of possible attributes */ - SGMLContent contents; /* End only on end tag @@ */ - TagClass tagclass; - TagClass contains; /* which classes of elements this one can contain directly */ - TagClass icontains; /* which classes of elements this one can contain indirectly */ - TagClass contained; /* in which classes can this tag be contained ? */ - TagClass icontained; /* in which classes can this tag be indirectly contained ? */ - TagClass canclose; /* which classes of elements can this one close + attr *attributes; /* The list of acceptable attributes */ + int number_of_attributes; /* Number of possible attributes */ + SGMLContent contents; /* End only on end tag @@ */ + TagClass tagclass; + TagClass contains; /* which classes of elements this one can contain directly */ + TagClass icontains; /* which classes of elements this one can contain indirectly */ + TagClass contained; /* in which classes can this tag be contained ? */ + TagClass icontained; /* in which classes can this tag be indirectly contained ? */ + TagClass canclose; /* which classes of elements can this one close if something looks wrong ? */ - TagFlags flags; -}; + TagFlags flags; + }; /* DTD Information * --------------- * * Not the whole DTD, but all this parser uses of it. */ -typedef struct { - HTTag *tags; /* Must be in strcmp order by name */ - int number_of_tags; - const char **entity_names; /* Must be in strcmp order by name */ - size_t number_of_entities; - /* "entity_names" table probably unused, - * see comments in HTMLDTD.c near the top - */ -} SGML_dtd; + typedef struct { + HTTag *tags; /* Must be in strcmp order by name */ + int number_of_tags; + const char **entity_names; /* Must be in strcmp order by name */ + size_t number_of_entities; + /* "entity_names" table probably unused, + * see comments in HTMLDTD.c near the top + */ + } SGML_dtd; /* SGML context passed to parsers */ -typedef struct _HTSGMLContext *HTSGMLContext; /* Hidden */ + typedef struct _HTSGMLContext *HTSGMLContext; /* Hidden */ /*__________________________________________________________________________ */ @@ -187,44 +189,44 @@ Structured Object definition Maybe the callerData is enough info to pass along. */ -typedef struct _HTStructured HTStructured; + typedef struct _HTStructured HTStructured; -typedef struct _HTStructuredClass { + typedef struct _HTStructuredClass { - const char *name; /* Just for diagnostics */ + const char *name; /* Just for diagnostics */ - void (*_free) (HTStructured * me); + void (*_free) (HTStructured * me); - void (*_abort) (HTStructured * me, HTError e); + void (*_abort) (HTStructured * me, HTError e); - void (*put_character) (HTStructured * me, char ch); + void (*put_character) (HTStructured * me, char ch); - void (*put_string) (HTStructured * me, const char *str); + void (*put_string) (HTStructured * me, const char *str); - void (*_write) (HTStructured * me, const char *str, - int len); + void (*_write) (HTStructured * me, const char *str, + int len); - int (*start_element) (HTStructured * me, int element_number, - const BOOL *attribute_present, - const char **attribute_value, - int charset, - char **include); + int (*start_element) (HTStructured * me, int element_number, + const BOOL *attribute_present, + const char **attribute_value, + int charset, + char **include); - int (*end_element) (HTStructured * me, int element_number, - char **include); + int (*end_element) (HTStructured * me, int element_number, + char **include); - int (*put_entity) (HTStructured * me, int entity_number); + int (*put_entity) (HTStructured * me, int entity_number); -} HTStructuredClass; + } HTStructuredClass; /* Equivalents to the following functions possibly could be generalised into additional HTStructuredClass members. For now they don't do anything target-specific. - kw */ -extern BOOLEAN LYCheckForCSI(HTParentAnchor *anchor, char **url); -extern void LYDoCSI(char *url, const char *comment, char **csi); -extern BOOLEAN LYCommentHacks(HTParentAnchor *anchor, const char *comment); + extern BOOLEAN LYCheckForCSI(HTParentAnchor *anchor, char **url); + extern void LYDoCSI(char *url, const char *comment, char **csi); + extern BOOLEAN LYCommentHacks(HTParentAnchor *anchor, const char *comment); /* @@ -233,8 +235,8 @@ Find a Tag by Name Returns a pointer to the tag within the DTD. */ -extern HTTag *SGMLFindTag(const SGML_dtd * dtd, - const char *string); + extern HTTag *SGMLFindTag(const SGML_dtd * dtd, + const char *string); /* @@ -249,10 +251,13 @@ Create an SGML parser * On exit, * The default tag starter has been processed. */ -extern HTStream *SGML_new(const SGML_dtd * dtd, - HTParentAnchor *anchor, - HTStructured * target); + extern HTStream *SGML_new(const SGML_dtd * dtd, + HTParentAnchor *anchor, + HTStructured * target); -extern const HTStreamClass SGMLParser; + extern const HTStreamClass SGMLParser; -#endif /* SGML_H */ +#ifdef __cplusplus +} +#endif +#endif /* SGML_H */ diff --git a/WWW/Library/Implementation/UCAux.h b/WWW/Library/Implementation/UCAux.h index 06db09b6..c962095e 100644 --- a/WWW/Library/Implementation/UCAux.h +++ b/WWW/Library/Implementation/UCAux.h @@ -5,63 +5,69 @@ #include <HTUtils.h> #endif -extern BOOL UCCanUniTranslateFrom(int from); -extern BOOL UCCanTranslateUniTo(int to); -extern BOOL UCCanTranslateFromTo(int from, int to); -extern BOOL UCNeedNotTranslate(int from, - int to); - -struct _UCTransParams { - BOOL transp; - BOOL do_cjk; - BOOL decode_utf8; - BOOL output_utf8; - BOOL use_raw_char_in; - BOOL strip_raw_char_in; - BOOL pass_160_173_raw; - BOOL do_8bitraw; - BOOL trans_to_uni; - BOOL trans_C0_to_uni; - BOOL repl_translated_C0; - BOOL trans_from_uni; -}; -typedef struct _UCTransParams UCTransParams; - #ifndef UCDEFS_H #include <UCDefs.h> #endif /* UCDEFS_H */ -extern void UCSetTransParams(UCTransParams * pT, int cs_in, - const LYUCcharset *p_in, - int cs_out, - const LYUCcharset *p_out); - -extern void UCTransParams_clear(UCTransParams * pT); - -extern void UCSetBoxChars(int cset, - int *pvert_out, - int *phori_out, - int vert_in, - int hori_in); - #ifndef HTSTREAM_H #include <HTStream.h> #endif /* HTSTREAM_H */ -typedef void putc_func_t(HTStream *me, - char ch); - #ifndef UCMAP_H #include <UCMap.h> #endif /* UCMAP_H */ -extern BOOL UCPutUtf8_charstring(HTStream *target, - putc_func_t * actions, - UCode_t code); +#ifdef __cplusplus +extern "C" { +#endif + extern BOOL UCCanUniTranslateFrom(int from); + extern BOOL UCCanTranslateUniTo(int to); + extern BOOL UCCanTranslateFromTo(int from, int to); + extern BOOL UCNeedNotTranslate(int from, + int to); + + struct _UCTransParams { + BOOL transp; + BOOL do_cjk; + BOOL decode_utf8; + BOOL output_utf8; + BOOL use_raw_char_in; + BOOL strip_raw_char_in; + BOOL pass_160_173_raw; + BOOL do_8bitraw; + BOOL trans_to_uni; + BOOL trans_C0_to_uni; + BOOL repl_translated_C0; + BOOL trans_from_uni; + }; + typedef struct _UCTransParams UCTransParams; + + extern void UCSetTransParams(UCTransParams * pT, int cs_in, + const LYUCcharset *p_in, + int cs_out, + const LYUCcharset *p_out); + + extern void UCTransParams_clear(UCTransParams * pT); + + extern void UCSetBoxChars(int cset, + int *pvert_out, + int *phori_out, + int vert_in, + int hori_in); -extern BOOL UCConvertUniToUtf8(UCode_t code, - char *buffer); + typedef void putc_func_t(HTStream *me, + char ch); -extern UCode_t UCGetUniFromUtf8String(char **ppuni); + extern BOOL UCPutUtf8_charstring(HTStream *target, + putc_func_t * actions, + UCode_t code); -#endif /* UCAUX_H */ + extern BOOL UCConvertUniToUtf8(UCode_t code, + char *buffer); + + extern UCode_t UCGetUniFromUtf8String(char **ppuni); + +#ifdef __cplusplus +} +#endif +#endif /* UCAUX_H */ diff --git a/WWW/Library/Implementation/UCMap.h b/WWW/Library/Implementation/UCMap.h index b45e99cc..7f074d3c 100644 --- a/WWW/Library/Implementation/UCMap.h +++ b/WWW/Library/Implementation/UCMap.h @@ -5,49 +5,52 @@ #include <HTUtils.h> #endif -typedef long UCode_t; - -extern int UCTransUniChar(UCode_t unicode, - int charset_out); -extern int UCTransUniCharStr(char *outbuf, - int buflen, - UCode_t unicode, - int charset_out, - int chk_single_flag); -extern int UCTransChar(char ch_in, - int charset_in, - int charset_out); -extern int UCReverseTransChar(char ch_out, - int charset_in, +#ifdef __cplusplus +extern "C" { +#endif + typedef long UCode_t; + + extern int UCTransUniChar(UCode_t unicode, int charset_out); -extern int UCTransCharStr(char *outbuf, - int buflen, - char ch_in, - int charset_in, - int charset_out, - int chk_single_flag); -extern UCode_t UCTransToUni(char ch_in, - int charset_in); -extern int UCGetRawUniMode_byLYhndl(int i); -extern int UCGetLYhndl_byMIME(const char *p); /* returns -1 if name not recognized */ -extern int safeUCGetLYhndl_byMIME(const char *p); /* returns LATIN1 if name not recognized */ + extern int UCTransUniCharStr(char *outbuf, + int buflen, + UCode_t unicode, + int charset_out, + int chk_single_flag); + extern int UCTransChar(char ch_in, + int charset_in, + int charset_out); + extern int UCReverseTransChar(char ch_out, + int charset_in, + int charset_out); + extern int UCTransCharStr(char *outbuf, + int buflen, + char ch_in, + int charset_in, + int charset_out, + int chk_single_flag); + extern UCode_t UCTransToUni(char ch_in, + int charset_in); + extern int UCGetRawUniMode_byLYhndl(int i); + extern int UCGetLYhndl_byMIME(const char *p); /* returns -1 if name not recognized */ + extern int safeUCGetLYhndl_byMIME(const char *p); /* returns LATIN1 if name not recognized */ #ifdef EXP_LOCALE_CHARSET -extern void LYFindLocaleCharset(void); + extern void LYFindLocaleCharset(void); #endif -extern int UCLYhndl_for_unspec; -extern int UCLYhndl_for_unrec; -extern int UCLYhndl_HTFile_for_unspec; -extern int UCLYhndl_HTFile_for_unrec; + extern int UCLYhndl_for_unspec; + extern int UCLYhndl_for_unrec; + extern int UCLYhndl_HTFile_for_unspec; + extern int UCLYhndl_HTFile_for_unrec; /* easy to type: */ -extern int LATIN1; /* UCGetLYhndl_byMIME("iso-8859-1") */ -extern int US_ASCII; /* UCGetLYhndl_byMIME("us-ascii") */ -extern int UTF8_handle; /* UCGetLYhndl_byMIME("utf-8") */ + extern int LATIN1; /* UCGetLYhndl_byMIME("iso-8859-1") */ + extern int US_ASCII; /* UCGetLYhndl_byMIME("us-ascii") */ + extern int UTF8_handle; /* UCGetLYhndl_byMIME("utf-8") */ #undef TRANSPARENT /* defined on Solaris in <sys/stream.h> */ -extern int TRANSPARENT; /* UCGetLYhndl_byMIME("x-transparent") */ + extern int TRANSPARENT; /* UCGetLYhndl_byMIME("x-transparent") */ /* In general, Lynx translates letters from document charset to display charset. @@ -79,4 +82,7 @@ those unrecognized MIME names are assumed as LATIN1 (via safeUCGetLYhndl...). #define UCTRANS_NOTFOUND (-4) -#endif /* UCMAP_H */ +#ifdef __cplusplus +} +#endif +#endif /* UCMAP_H */ diff --git a/WWW/Library/Implementation/makefile.in b/WWW/Library/Implementation/makefile.in index ad4d99d8..37e0b4d3 100644 --- a/WWW/Library/Implementation/makefile.in +++ b/WWW/Library/Implementation/makefile.in @@ -176,6 +176,9 @@ clean : rm -f core *.core *.leaks *.[oi] *.bak tags TAGS rm -f $(LOB)/*$o +tags: + ctags *.[ch] + # Common code # ----------- diff --git a/WWW/Library/Implementation/www_tcp.h b/WWW/Library/Implementation/www_tcp.h index 25a48776..bf99ce76 100644 --- a/WWW/Library/Implementation/www_tcp.h +++ b/WWW/Library/Implementation/www_tcp.h @@ -696,6 +696,8 @@ typedef unsigned short mode_t; #define DECL_SYS_ERRLIST 1 #endif +#define socklen_t int /* used for default LY_SOCKLEN definition */ + #endif /* !HAVE_CONFIG_H */ #ifdef HAVE_LIBINTL_H |