Automatically remove trailing whitespace

This commit is contained in:
Robert Clausecker
2013-03-10 01:59:42 +01:00
parent 62396c5250
commit 1446c97470
256 changed files with 6539 additions and 6539 deletions

View File

@@ -1,7 +1,7 @@
/* Ben Fried deserves credit for writing the code that upon which
* this source is based. ADC
* this source is based. ADC
*/
#include "../config.h"
#include "../config.h"
#if defined(KRB4) || defined(KRB5)
@@ -122,7 +122,7 @@ int scheme_login(scheme)
* Returns 1 if pipe open fails
* Returns 0 otherwise (even if klog fails!)
***************************************************************************/
int AFSgetTGT(username, password, err_string)
int AFSgetTGT(username, password, err_string)
char *err_string, *username, *password;
{
char reason[256];
@@ -222,7 +222,7 @@ int k4getTGT(username, password, err_string)
#endif /* KRB4 */
#ifdef KRB5
/****************************************************************************
* k5getTGT() -- calls K5 libraries to get TGT (non-AFS)
* k5getTGT() -- calls K5 libraries to get TGT (non-AFS)
* most of this was copied from the Krb5 kinit.c
*
* Returns 0 on success (err_string = "")
@@ -279,7 +279,7 @@ int k5getTGT(username, password, err_string)
}
my_creds.server = server;
my_creds.times.starttime = 0;
my_creds.times.starttime = 0;
my_creds.times.endtime = 0; /* now + KRB5_DEFAULT_LIFE; */
my_creds.times.renew_till = 0;
@@ -292,9 +292,9 @@ int k5getTGT(username, password, err_string)
if (code) {
sprintf(err_string,"krb5_get_in_tkt error: %s", error_message(code));
return 1;
}
}
else {
return 0;
return 0;
}
}
#endif
@@ -354,7 +354,7 @@ int str_to_kdata(in_str, out_str)
/****************************************************************************
* compose_kerberos_auth_string
* compose_kerberos_auth_string
*
* Accepts: scheme (one of the HTAA_KERBEROS values)
* hostname
@@ -426,7 +426,7 @@ char *compose_kerberos_auth_string(scheme, hostname)
if (!k5context) {
krb5_init_context(&k5context);
if (code) {
sprintf(krb_err_str,"Error initializing Kerb5 context: %s\n",error_message(code));
sprintf(krb_err_str,"Error initializing Kerb5 context: %s\n",error_message(code));
application_user_info_wait(krb_err_str);
return (char *) NULL;
}
@@ -441,11 +441,11 @@ char *compose_kerberos_auth_string(scheme, hostname)
}
}
code = krb5_mk_req(k5context, &k5auth_context, AP_OPTS_USE_SESSION_KEY,
"khttp", hostname, NULL, k5ccache, &k5ap_req);
if (!code) {
if (!code) {
/* get username from credentials cache */
@@ -467,7 +467,7 @@ char *compose_kerberos_auth_string(scheme, hostname)
return (char *) NULL;
}
krb5_sname_to_principal(k5context, hostname, "khttp",
krb5_sname_to_principal(k5context, hostname, "khttp",
KRB5_NT_SRV_HST, &k5serverp);
memset((char *)&k5in_creds, 0, sizeof(k5in_creds));
@@ -480,7 +480,7 @@ char *compose_kerberos_auth_string(scheme, hostname)
code = krb5_get_credentials(k5context,KRB5_GC_CACHED,k5ccache,&k5in_creds,&k5out_creds);
if ((code == KRB5_CC_NOTFOUND) || (now >= k5out_creds->times.endtime)) {
if ((code == KRB5_CC_NOTFOUND) || (now >= k5out_creds->times.endtime)) {
/* replace "Matching creds not found" */
sprintf(krb_err_str,"Kerberos ticket expired\n");
code = 666;
@@ -497,7 +497,7 @@ char *compose_kerberos_auth_string(scheme, hostname)
sprintf(krb_err_str,"krb5_mk_req: %s\n",error_message(code));
}
}
else {
else {
pass = kdata_to_str(k5ap_req.data, k5ap_req.length);
}
}
@@ -548,7 +548,7 @@ char *compose_kerberos_auth_string(scheme, hostname)
* validate_kerberos_server_auth
* Accepts: scheme (one of the HTAA_KERBEROS values)
* the Authorization line from the request
* Returns: NIL on success, T on failure
* Returns: NIL on success, T on failure
(currently return value not used)
************************************************************************/
int validate_kerberos_server_auth(scheme, str)
@@ -587,7 +587,7 @@ int validate_kerberos_server_auth(scheme, str)
else if (scheme == HTAA_KERBEROS_V4) {
retval = k4validate_kerberos_server_auth(str);
}
#endif
#endif
#ifdef KRB5
else if (scheme == HTAA_KERBEROS_V5) {
retval = k5validate_kerberos_server_auth(str);
@@ -644,9 +644,9 @@ int k4validate_kerberos_server_auth(str)
if (ntohl(*(long *)k4authent.dat) != k4checksum + 1) {
fprintf(stderr,"\n\nchecksum just doesn't check out\n\n");
return 1;
return 1;
}
return 0;
}
#endif
@@ -663,7 +663,7 @@ int k5validate_kerberos_server_auth(instr)
k5ap_rep.length = str_to_kdata(instr, tmpstr);
if (k5ap_rep.length == 0)
if (k5ap_rep.length == 0)
return 1;
k5ap_rep.data = tmpstr;
@@ -672,7 +672,7 @@ int k5validate_kerberos_server_auth(instr)
krb5_free_ap_rep_enc_part(k5context, k5ap_rep_result);
if (code)
if (code)
return 1;
return 0;

View File

@@ -167,20 +167,20 @@ PUBLIC void HTAASetup_clearall (HTList *s)
** On Exit: password information is gone.
**
** May 1996 PLB Created.
**
**
*/
PUBLIC void HTAAServer_clear ()
{
HTList *n, *nn;
HTAAServer *s;
n = server_table;
while (n) {
nn = n->next;
s = (HTAAServer *)n->object;
if (s) {
#ifndef DISABLE_TRACE
if (www2Trace)
if (www2Trace)
fprintf(stderr, "Clearing passwd info for %s\n", s->hostname?s->hostname:"NULL");
#endif
HTAARealm_clearall (s->realms);
@@ -192,9 +192,9 @@ PUBLIC void HTAAServer_clear ()
n = nn;
}
server_table = NULL;
secret_key = NULL;
current_setup = NULL;
current_hostname = NULL;
secret_key = NULL;
current_setup = NULL;
current_hostname = NULL;
current_docname = NULL;
}
@@ -231,7 +231,7 @@ PRIVATE HTAAServer *HTAAServer_new ARGS2(WWW_CONST char*, hostname,
if (hostname) StrAllocCopy(server->hostname, hostname);
if (!server_table) server_table = HTList_new();
HTList_addObject(server_table, (void*)server);
return server;
@@ -284,7 +284,7 @@ PRIVATE HTAAServer *HTAAServer_lookup ARGS2(WWW_CONST char *, hostname,
/*************************** HTAASetup *******************************/
/*************************** HTAASetup *******************************/
/* PRIVATE HTAASetup_lookup()
@@ -306,7 +306,7 @@ PRIVATE HTAAServer *HTAAServer_lookup ARGS2(WWW_CONST char *, hostname,
** Otherwise, a HTAASetup structure representing
** the protected server setup on the corresponding
** document tree.
**
**
*/
PRIVATE HTAASetup *HTAASetup_lookup ARGS3(WWW_CONST char *, hostname,
int, portnumber,
@@ -453,7 +453,7 @@ PRIVATE void HTAASetup_updateSpecifics ARGS2(HTAASetup *, setup,
** On Entry:
** realm_table a list of realm objects
**
** On Exit:
** On Exit:
** returns: Nothing. realm_table is no longer valid.
*/
PUBLIC void HTAARealm_clearall ARGS1(HTList *, realm_table)
@@ -468,10 +468,10 @@ PUBLIC void HTAARealm_clearall ARGS1(HTList *, realm_table)
if (r) {
#ifdef PAUL_IS_A_GIMP
if (www2Trace)
if (www2Trace)
fprintf(stderr, "Clearing %s %s:%s\n",
r->realmname?r->realmname:"NULL",
r->realmname?r->username:"NULL",
r->realmname?r->realmname:"NULL",
r->realmname?r->username:"NULL",
r->realmname?r->password:"NULL");
#endif
@@ -504,7 +504,7 @@ PRIVATE HTAARealm *HTAARealm_lookup ARGS2(HTList *, realm_table,
if (realm_table && realmname) {
HTList *cur = realm_table;
HTAARealm *realm;
while (NULL != (realm = (HTAARealm*)HTList_nextObject(cur))) {
if (0==strcmp(realm->realmname, realmname))
return realm;
@@ -624,11 +624,11 @@ PRIVATE char *compose_auth_string ARGS2(HTAAScheme, scheme,
/* for MD5 -- DXP */
char * nonce; /* Server specified integer value */
char * opaque; /* more random MD5 junk... */
FREE(result); /* From previous call */
if ((scheme != HTAA_BASIC && scheme != HTAA_PUBKEY && scheme != HTAA_MD5)
if ((scheme != HTAA_BASIC && scheme != HTAA_PUBKEY && scheme != HTAA_MD5)
|| !setup ||
!setup->scheme_specifics || !setup->scheme_specifics[scheme] ||
!setup->server || !setup->server->realms)
@@ -675,7 +675,7 @@ PRIVATE char *compose_auth_string ARGS2(HTAAScheme, scheme,
if (!realm->password)
return "";
}
len = strlen(realm->username ? realm->username : "") +
strlen(realm->password ? realm->password : "") + 3;
@@ -740,13 +740,13 @@ PRIVATE char *compose_auth_string ARGS2(HTAAScheme, scheme,
if (!opaque)
return "";
if (!(A1 = (unsigned char*)malloc(strlen(realm->username) +
strlen(realm->realmname) +
if (!(A1 = (unsigned char*)malloc(strlen(realm->username) +
strlen(realm->realmname) +
strlen(realm->password) + 3 + 1)))
outofmem(__FILE__, "compose_auth_string");
if (!(A2 = (unsigned char*)malloc(4 + strlen(current_docname) + 1 + 1 )))
outofmem(__FILE__, "compose_auth_string");
outofmem(__FILE__, "compose_auth_string");
/* make A1 */
*A1 = (unsigned char)0;
@@ -768,18 +768,18 @@ PRIVATE char *compose_auth_string ARGS2(HTAAScheme, scheme,
strcat((char*)A2, "\0");
if (!(md5_cleartext = (unsigned char*)malloc(100 + 1)))
outofmem(__FILE__, "compose_auth_string");
outofmem(__FILE__, "compose_auth_string");
if (!(md5_ciphertext = (unsigned char*)malloc(100 + 1)))
outofmem(__FILE__, "compose_auth_string");
outofmem(__FILE__, "compose_auth_string");
if (!(hex1 = (unsigned char*)malloc(32 + 1)))
outofmem(__FILE__, "compose_auth_string");
outofmem(__FILE__, "compose_auth_string");
if (!(hex2 = (unsigned char*)malloc(32 + 1)))
outofmem(__FILE__, "compose_auth_string");
outofmem(__FILE__, "compose_auth_string");
if (!(digest1 = (unsigned char*)malloc(16)))
outofmem(__FILE__, "compose_auth_string");
outofmem(__FILE__, "compose_auth_string");
if (!(digest2 = (unsigned char*)malloc(16)))
outofmem(__FILE__, "compose_auth_string");
outofmem(__FILE__, "compose_auth_string");
MD5Mem(A1, strlen((char*)A1), digest1);
MD5Mem(A2, strlen((char*)A2), digest2);
@@ -886,7 +886,7 @@ PUBLIC char *HTAA_composeAuth ARGS3(WWW_CONST char *, hostname,
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf(stderr,
fprintf(stderr,
"Composing Authorization for %s:%d/%s\n",
hostname, portnumber, docname);
#endif
@@ -900,7 +900,7 @@ PUBLIC char *HTAA_composeAuth ARGS3(WWW_CONST char *, hostname,
retry = NO;
current_portnumber = portnumber;
if (hostname) StrAllocCopy(current_hostname, hostname);
else FREE(current_hostname);
@@ -908,7 +908,7 @@ PUBLIC char *HTAA_composeAuth ARGS3(WWW_CONST char *, hostname,
else FREE(current_docname);
}
else retry = YES;
if (!current_setup || !retry)
current_setup = HTAASetup_lookup(hostname, portnumber, docname);
@@ -974,7 +974,7 @@ PUBLIC char *HTAA_composeAuth ARGS3(WWW_CONST char *, hostname,
/* BROWSER PUBLIC HTAA_shouldRetryWithAuth()
**
** DETERMINES IF WE SHOULD RETRY THE SERVER
@@ -1034,7 +1034,7 @@ PUBLIC BOOL HTAA_shouldRetryWithAuth ARGS3(char *, start_of_headers,
char *fieldname = HTNextField(&p);
char *arg1 = HTNextField(&p);
char *args = p;
if (0==my_strcasecmp(fieldname, "WWW-Authenticate:")) {
if (HTAA_UNKNOWN != (scheme = HTAAScheme_enum(arg1))) {
HTList_addObject(valid_schemes, (void*)scheme);
@@ -1087,7 +1087,7 @@ PUBLIC BOOL HTAA_shouldRetryWithAuth ARGS3(char *, start_of_headers,
/* So we have already tried with authorization. */
/* Either we don't have access or username or */
/* password was misspelled. */
/* Update scheme-specific parameters */
/* (in case they have expired by chance). */
HTAASetup_updateSpecifics(current_setup, scheme_specifics);
@@ -1115,7 +1115,7 @@ PUBLIC BOOL HTAA_shouldRetryWithAuth ARGS3(char *, start_of_headers,
}
if (!template)
template = HTAA_makeProtectionTemplate(current_docname);
current_setup = HTAASetup_new(server,
current_setup = HTAASetup_new(server,
template,
valid_schemes,
scheme_specifics);

View File

@@ -1,31 +1,31 @@
/* BROWSER SIDE ACCESS AUTHORIZATION MODULE
This module is the browser side interface to Access Authorization (AA) package. It
contains code only for browser.
Important to know about memory allocation:
Routines in this module use dynamic allocation, but free automatically all the memory
reserved by them.
Therefore the caller never has to (and never should) free() any object returned by
these functions.
Therefore also all the strings returned by this package are only valid until the next
call to the same function is made. This approach is selected, because of the nature of
access authorization: no string returned by the package needs to be valid longer than
until the next call.
This also makes it easy to plug the AA package in: you don't have to ponder whether to
free()something here or is it done somewhere else (because it is always done somewhere
else).
The strings that the package needs to store are copied so the original strings given as
parameters to AA functions may be freed or modified with no side effects.
Also note:The AA package does not free() anything else than what it has itself
allocated.
*/
#ifndef HTAABROW_H
@@ -48,19 +48,19 @@ Routines for Browser Side Recording of AA Info
Most of the browser-side AA is done by the following two functions (which are called
from file HTTP.c so the browsers using libwww only need to be linked with the new
library and not be changed at all):
HTAA_composeAuth() composes the Authorization: line contents, if the AA package
thinks that the given document is protected. Otherwise this function returns NULL.
This function also calls the functions HTPrompt(),HTPromptPassword() and HTConfirm()
to get the username, password and some confirmation from the user.
HTAA_shouldRetryWithAuth() determines whether to retry the request with AA or with a
new AA (in case username or password was misspelled).
HTAA_TryWithAuth() sets up everything for an automatic first try with authentication.
HTAA_ClearAuth() clears the currently allocated authentication record.
*/
/* PUBLIC HTAA_composeAuth()
@@ -156,19 +156,19 @@ PUBLIC void HTAA_ClearAuth NOPARAMS;
#ifdef PEM_AUTH
/*
* PUBLIC HTAA_makecommand()
*
*
* ENCRYPT AN HTTP REQUEST, AND ENCAPSULATE IT IN
* A NEW HTTP PEM AUTHORIZED REQUEST
*
*
* ON ENTRY:
* command the HTTP request
*
*
* ON EXIT:
* returns the new HTTP request with PEM
*
* Do not free this string. This function *requires* that the
*
* Do not free this string. This function *requires* that the
* HTAA_composeAuth function has been called prior to it.
*
*
*/
PUBLIC char *HTAA_makecommand PARAMS((char * command, char **body, int *bl));
#endif /* PEM_AUTH */

View File

@@ -129,7 +129,7 @@ PRIVATE int read_item ARGS4(FILE *, fp,
** READ A FIELD FROM A PASSWORD, GROUP
** OR ACCESS CONTROL LIST FILE
** i.e. an item terminated by colon,
** end-of-line, or end-of-file.
** end-of-line, or end-of-file.
** ON ENTRY:
** fp is the file to read the characters from
** contents is the character array to put the characters

View File

@@ -1,14 +1,14 @@
/* FILE ROUTINES FOR ACCESS AUTHORIZATION PACKAGE
This module implements the routines used for accessing (and parsing) the files used in
the access authorization:
password file
group file
access control list (ACL) file
*/
@@ -37,23 +37,23 @@
Naming conventions
Record is an entire line in file.
Field is an entity separated by colons and/or by end-of-line.
List is a field in which there are items separated by commas.
Record-oriented Read Routines
Password, group and ACL are internally read in by the following functions:
HTAAFile_nextRec() skips to the beginning of the next record (must be called even
after the last field of a record is read to proceed to the next
record).
HTAAFile_readField() reads a field (separated by colons).
HTAAFile_readList() reads a field containing a comma-separated list of items.
*/
/* PUBLIC HTAAFile_nextRec()

View File

@@ -81,14 +81,14 @@ PUBLIC int HTAA_getUid NOARGS
if (isNumber(current_prot->uid_name)) {
if (NULL != (pw = getpwuid(atoi(current_prot->uid_name)))) {
#ifndef DISABLE_TRACE
if (www2Trace) fprintf(stderr,
if (www2Trace) fprintf(stderr,
"%s(%s) returned (%s:%s:%d:%d:...)\n",
"HTAA_getUid: getpwuid",
current_prot->uid_name,
pw->pw_name, pw->pw_passwd,
pw->pw_uid, pw->pw_gid);
#endif
return pw->pw_uid;
return pw->pw_uid;
}
}
else { /* User name (not a number) */
@@ -118,9 +118,9 @@ PUBLIC int HTAA_getUid NOARGS
** Default is 65534 (nogroup).
*/
PUBLIC int HTAA_getGid NOARGS
{
{
struct group *gr = NULL;
if (current_prot && current_prot->gid_name) {
if (isNumber(current_prot->gid_name)) {
if (NULL != (gr = getgrgid(atoi(current_prot->gid_name)))) {
@@ -137,7 +137,7 @@ PUBLIC int HTAA_getGid NOARGS
else { /* Group name (not number) */
if (NULL != (gr = getgrnam(current_prot->gid_name))) {
#ifndef DISABLE_TRACE
if (www2Trace) fprintf(stderr,
if (www2Trace) fprintf(stderr,
"%s(\"%s\") returned (%s:%s:%d:...)\n",
"HTAA_getGid: getgrnam",
current_prot->gid_name,
@@ -216,9 +216,9 @@ PRIVATE void HTAA_parseProtFile ARGS2(HTAAProt *, prot,
break;
if (lex_item == LEX_ALPH_STR) { /* Valid setup record */
StrAllocCopy(fieldname, lex_buffer);
if (LEX_FIELD_SEP != (lex_item = lex(fp)))
unlex(lex_item); /* If someone wants to use colon */
/* after field name it's ok, but */
@@ -245,7 +245,7 @@ PRIVATE void HTAA_parseProtFile ARGS2(HTAAProt *, prot,
"authentication scheme:",
lex_buffer);
#endif
if (LEX_ITEM_SEP != (lex_item = lex(fp)))
break;
/*
@@ -282,7 +282,7 @@ PRIVATE void HTAA_parseProtFile ARGS2(HTAAProt *, prot,
HTAssocList_add(prot->values, fieldname, lex_buffer);
lex_item = lex(fp); /* Read record separator */
#ifndef DISABLE_TRACE
if (www2Trace) fprintf(stderr,
if (www2Trace) fprintf(stderr,
"%s `%s' bound to value `%s'\n",
"HTAA_parseProtFile: Name",
fieldname, lex_buffer);
@@ -347,7 +347,7 @@ PRIVATE HTAAProt *HTAAProt_new ARGS3(WWW_CONST char *, cur_docname,
if (!prot_cache)
prot_cache = HTList_new();
while (NULL != (cache_item = (HTAAProtCache*)HTList_nextObject(cur))) {
if (!strcmp(cache_item->prot_filename, prot_filename))
break;
@@ -536,7 +536,7 @@ PUBLIC HTAAProt *HTAA_getDefaultProtection NOARGS
if (!current_prot) {
current_prot = default_prot;
default_prot = NULL;
}
}
return current_prot;
}

View File

@@ -1,5 +1,5 @@
/* PROTECTION SETUP FILE
*/
#ifndef HTAAPROT_H
@@ -39,15 +39,15 @@ typedef struct {
Callbacks for rule system
The following three functioncs are called by the rule system:
HTAA_clearProtections() when starting to translate a filename
HTAA_setDefaultProtection() when "defprot" rule is matched
HTAA_setCurrentProtection() when "protect" rule is matched
Protection setup files are cached by these functions.
*/
/* PUBLIC HTAA_setDefaultProtection()
@@ -117,11 +117,11 @@ Getting Protection Settings
HTAA_getCurrentProtection() returns the current protection mode (if there was a
"protect" rule). NULL, if no "protect" rule has been matched.
HTAA_getDefaultProtection() sets the current protection mode to what it was set to
by "defprot" rule and also returns it (therefore after this call also
HTAA_getCurrentProtection() returns the same structure.
*/
/* PUBLIC HTAA_getCurrentProtection()

View File

@@ -119,7 +119,7 @@ PUBLIC char *HTAA_statusMessage NOARGS
/* Success */
case HTAA_OK:
return "AA: Access should be ok but something went wrong";
return "AA: Access should be ok but something went wrong";
break;
/* Others */
@@ -176,7 +176,7 @@ PRIVATE char *status_name ARGS1(HTAAFailReasonType, reason)
} /* switch */
}
@@ -272,7 +272,7 @@ PRIVATE HTAAFailReasonType check_authorization ARGS4(WWW_CONST char *, pathname
"host", HTClientHost);
else fprintf(stderr, "%s %s %s %s\n",
"HTAA_checkAuthorization: request from",
HTClientHost,
HTClientHost,
"accepted by only mask match (no ACL, only",
"Protect rule, and only mask enabled)");
}
@@ -338,7 +338,7 @@ PRIVATE HTAAFailReasonType check_authorization ARGS4(WWW_CONST char *, pathname
? htaa_user->username : "NOT-AUTHENTICATED"));
#endif
}
/*
/*
** Check mask group
*/
if (prot->mask_group) {
@@ -358,7 +358,7 @@ PRIVATE HTAAFailReasonType check_authorization ARGS4(WWW_CONST char *, pathname
#ifndef DISABLE_TRACE
else if (www2Trace) fprintf(stderr, "%s %s %s %s %s\n",
"HTAA_checkAuthorization: request from",
HTClientHost,
HTClientHost,
"accepted by just mask group match",
"(no ACL, only Protect rule, and only",
"mask enabled)");
@@ -436,7 +436,7 @@ PUBLIC int HTAA_checkAuthorization ARGS4(WWW_CONST char *, url,
char *local_copy = NULL;
HTAAMethod method = HTAAMethod_enum(method_name);
HTAAScheme scheme = HTAAScheme_enum(scheme_name);
/*
** Translate into absolute pathname, and
** check for "protect" and "defprot" rules.
@@ -453,7 +453,7 @@ PUBLIC int HTAA_checkAuthorization ARGS4(WWW_CONST char *, url,
char *localname = HTLocalName(pathname);
free(pathname);
pathname = localname;
}
}
FREE(local_copy);
HTAAFailReason = check_authorization(pathname, method,
@@ -621,7 +621,7 @@ PUBLIC char *HTAA_composeAuthHeaders NOARGS
#endif
} /* scheme valid for requested document */
} /* for every scheme */
return result;
}

View File

@@ -1,31 +1,31 @@
/* SERVER SIDE ACCESS AUTHORIZATION MODULE
This module is the server side interface to Access Authorization (AA) package. It
contains code only for server.
Important to know about memory allocation:
Routines in this module use dynamic allocation, but free automatically all the memory
reserved by them.
Therefore the caller never has to (and never should) free() any object returned by
these functions.
Therefore also all the strings returned by this package are only valid until the next
call to the same function is made. This approach is selected, because of the nature of
access authorization: no string returned by the package needs to be valid longer than
until the next call.
This also makes it easy to plug the AA package in: you don't have to ponder whether to
free()something here or is it done somewhere else (because it is always done somewhere
else).
The strings that the package needs to store are copied so the original strings given as
parameters to AA functions may be freed or modified with no side effects.
Also note:The AA package does not free() anything else than what it has itself
allocated.
*/
#ifndef HTAASERV_H
@@ -50,7 +50,7 @@
Check Access Authorization
HTAA_checkAuthorization() is the main access authorization function.
*/
/* PUBLIC HTAA_checkAuthorization()

View File

@@ -76,7 +76,7 @@ PUBLIC HTAAScheme HTAAScheme_enum ARGS1(WWW_CONST char*, name)
*cur = TOUPPER(*cur);
cur++;
}
if (!strncmp(upcased, "NONE", 4))
return HTAA_NONE;
else if (!strncmp(upcased, "BASIC", 5))
@@ -112,7 +112,7 @@ PUBLIC char *HTAAScheme_name ARGS1(HTAAScheme, scheme)
case HTAA_PUBKEY: return "Pubkey"; break;
case HTAA_KERBEROS_V4: return "KerberosV4"; break;
case HTAA_KERBEROS_V5: return "KerberosV5"; break;
case HTAA_MD5: return "Digest"; break;
case HTAA_MD5: return "Digest"; break;
case HTAA_UNKNOWN: return "UNKNOWN"; break;
default: return "THIS-IS-A-BUG";
}
@@ -227,7 +227,7 @@ PUBLIC BOOL HTAAMethod_inList ARGS2(HTAAMethod, method,
** returns YES, if filename matches the template.
** NO, otherwise.
*/
PUBLIC BOOL HTAA_templateMatch ARGS2(WWW_CONST char *, template,
PUBLIC BOOL HTAA_templateMatch ARGS2(WWW_CONST char *, template,
WWW_CONST char *, filename)
{
WWW_CONST char *p = template;
@@ -236,7 +236,7 @@ PUBLIC BOOL HTAA_templateMatch ARGS2(WWW_CONST char *, template,
for( ; *p && *q && *p == *q; p++, q++) /* Find first mismatch */
; /* do nothing else */
if (!*p && !*q) return YES; /* Equally long equal strings */
else if ('*' == *p) { /* Wildcard */
p++; /* Skip wildcard character */
@@ -376,7 +376,7 @@ PUBLIC HTAssocList *HTAA_parseArgList ARGS1(char *, str)
}
}
else { /* No name, just a value */
if (*cur == ',')
if (*cur == ',')
*(cur++) = (char)0; /* Terminate value */
/* else last value on line (already terminated by NULL) */
StrAllocCopy(name, "nnn"); /* Room for item order number */
@@ -497,7 +497,7 @@ PUBLIC char *HTAA_getUnfoldedLine NOARGS
/* Unfolding */
if (peek_for_folding) {
if (*cur != ' ' && *cur != '\t')
return line; /* Ok, no continuation line */
@@ -511,7 +511,7 @@ PUBLIC char *HTAA_getUnfoldedLine NOARGS
while (cur < end_pointer && *cur != '\n') /* Find the end-of-line */
cur++; /* (or end-of-buffer). */
/* Terminating line */
if (cur < end_pointer) { /* So *cur==LF, terminate line */

View File

@@ -1,30 +1,30 @@
/* Utilities for the Authorization parts of libwww
COMMON PARTS OF AUTHORIZATION MODULE TO BOTH SERVER AND BROWSER
This module is the interface to the common parts of Access Authorization (AA) package
for both server and browser. Important to know about memory allocation:
Routines in this module use dynamic allocation, but free automatically all the memory
reserved by them.
Therefore the caller never has to (and never should) free() any object returned by
these functions.
Therefore also all the strings returned by this package are only valid until the next
call to the same function is made. This approach is selected, because of the nature of
access authorization: no string returned by the package needs to be valid longer than
until the next call.
This also makes it easy to plug the AA package in: you don't have to ponder whether to
free() something here or is it done somewhere else (because it is always done somewhere
else).
The strings that the package needs to store are copied so the original strings given as
parameters to AA functions may be freed or modified with no side effects.
Also note: The AA package does not free() anything else than what it has itself
allocated.
*/
#ifndef HTAAUTIL_H
@@ -88,10 +88,10 @@ Default filenames
Datatype definitions
HTAASCHEME
The enumeration HTAAScheme represents the possible authentication schemes used by the
WWW Access Authorization.
*/
typedef enum {
@@ -110,7 +110,7 @@ typedef enum {
/*
ENUMERATION TO REPRESENT HTTP METHODS
*/
typedef enum {

View File

@@ -61,7 +61,7 @@ PUBLIC char *HTAA_getAclFilename ARGS1(WWW_CONST char *, pathname)
*filename = '\0'; /* Truncate filename off from directory path */
filename++; /* and the filename begins from the next character */
}
StrAllocCopy(acl_path, directory); /* Also frees acl_path */
/* from previous call. */
StrAllocCat(acl_path, "/");
@@ -156,7 +156,7 @@ PUBLIC GroupDef *HTAA_getAclEntry ARGS3(FILE *, acl_file,
char *buf;
if (!acl_file) return NULL; /* ACL doesn't exist */
if (group_def) {
GroupDef_delete(group_def); /* From previous call */
group_def = NULL;
@@ -170,7 +170,7 @@ PUBLIC GroupDef *HTAA_getAclEntry ARGS3(FILE *, acl_file,
if (!(buf = (char*)malloc((strlen(filename)+2)*sizeof(char))))
outofmem(__FILE__, "HTAA_getAuthorizedGroups");
while (EOF != HTAAFile_readField(acl_file, buf, len+1)) {
if (HTAA_templateMatch(buf, filename)) {
HTList *methods = HTList_new();
@@ -180,7 +180,7 @@ PUBLIC GroupDef *HTAA_getAclEntry ARGS3(FILE *, acl_file,
fprintf(stderr,
"Filename '%s' matched template '%s', allowed methods:",
filename, buf);
}
}
#endif
if (HTAAMethod_inList(method, methods)) { /* right method? */
#ifndef DISABLE_TRACE

View File

@@ -1,5 +1,5 @@
/* ACCESS CONTROL LIST ROUTINES
*/
#ifndef HTACL_H

View File

@@ -66,7 +66,7 @@ PUBLIC char * HTClientHost = 0; /* Name of remote login host if any */
*/
PUBLIC HTFormat HTOutputFormat = NULL;
PUBLIC HTStream* HTOutputStream = NULL; /* For non-interactive, set this */
PUBLIC HTStream* HTOutputStream = NULL; /* For non-interactive, set this */
PUBLIC BOOL using_gateway = NO; /* are we using a gateway? */
PUBLIC BOOL using_proxy = NO; /* are we using a proxy gateway? */
@@ -142,7 +142,7 @@ PRIVATE int get_physical ARGS3(
char * host = NULL;
struct Proxy *GetNoProxy();
extern int useKeepAlive;
HTAnchor_setPhysical(anchor, addr);
access = HTParse(HTAnchor_physical(anchor),
@@ -348,7 +348,7 @@ PRIVATE int HTLoad ARGS4(
while (1) {
if (status < 0) return status; /* Can't resolve or forbidden */
retry=5;
retry_proxy:
@@ -428,9 +428,9 @@ PUBLIC HTStream *HTSaveStream ARGS1(HTParentAnchor *, anchor)
{
HTProtocol * p = HTAnchor_protocol(anchor);
if (!p) return NULL;
return (*p->saveStream)(anchor);
}
@@ -449,7 +449,7 @@ PUBLIC HTStream *HTSaveStream ARGS1(HTParentAnchor *, anchor)
**
** On Exit,
** returns 1 Success in opening document
** 0 Failure
** 0 Failure
** -1 Interrupted
**
*/
@@ -468,7 +468,7 @@ PRIVATE int HTLoadDocument ARGS4(
use_this_url_instead = NULL;
/* We LOVE goto's!
/* We LOVE goto's!
*
* Let's rephrase this..._You_ love goto's...we _abhore_ goto's. People who
* LOVE goto's should be shot.
@@ -480,7 +480,7 @@ PRIVATE int HTLoadDocument ARGS4(
#endif
status = HTLoad(full_address, anchor, format_out, sink);
if (status == HT_LOADED) {
#ifndef DISABLE_TRACE
if (www2Trace) {
@@ -498,9 +498,9 @@ PRIVATE int HTLoadDocument ARGS4(
#ifndef DISABLE_TRACE
if (www2Trace)
{
fprintf (stderr, "HTAccess: '%s' is a redirection URL.\n",
fprintf (stderr, "HTAccess: '%s' is a redirection URL.\n",
full_address);
fprintf (stderr, "HTAccess: Redirecting to '%s'\n",
fprintf (stderr, "HTAccess: Redirecting to '%s'\n",
redirecting_url);
}
#endif
@@ -518,26 +518,26 @@ PRIVATE int HTLoadDocument ARGS4(
#endif
return -1;
}
if (status == HT_NO_DATA) {
#ifndef DISABLE_TRACE
if (www2Trace) {
fprintf(stderr,
fprintf(stderr,
"HTAccess: `%s' has been accessed, No data left.\n",
full_address);
}
#endif
return 0;
}
if (status<0) { /* Failure in accessing a document */
#ifndef DISABLE_TRACE
if (www2Trace) fprintf(stderr,
if (www2Trace) fprintf(stderr,
"HTAccess: Can't access `%s'\n", full_address);
#endif
return 0;
}
/* If you get this, then please find which routine is returning
a positive unrecognised error code! */
@@ -561,7 +561,7 @@ PRIVATE int HTLoadDocument ARGS4(
**
** On Exit,
** returns 1 Success in opening document
** 0 Failure
** 0 Failure
** -1 Interrupted
**
**
@@ -591,7 +591,7 @@ PUBLIC int HTLoadAbsolute ARGS1(WWW_CONST char *,addr)
**
** On Exit,
** returns YES Success in opening document
** NO Failure
** NO Failure
**
**
*/
@@ -619,7 +619,7 @@ PUBLIC BOOL HTLoadToStream ARGS3(
**
** On Exit,
** returns YES Success in opening document
** NO Failure
** NO Failure
**
**
*/

View File

@@ -1,13 +1,13 @@
/* HTAccess: Access manager for libwww
ACCESS MANAGER
This module keeps a list of valid protocol (naming scheme)
specifiers with associated access code. It allows documents to be
loaded given various combinations of parameters. New access
protocols may be registered at any time.
Part of the libwww library .
*/
#ifndef HTACCESS_H
#define HTACCESS_H
@@ -54,17 +54,17 @@ extern HTFormat HTOutputFormat; /* To convert on load, set this */
Load a document from relative name
ON ENTRY,
relative_name The relative address of the file to be accessed.
here The anchor of the object being searched
ON EXIT,
returns YES Success in opening file
NO Failure
*/
extern BOOL HTLoadRelative PARAMS((
WWW_CONST char * relative_name,
@@ -76,25 +76,25 @@ extern BOOL HTLoadRelative PARAMS((
Load a document from absolute name
ON ENTRY,
addr The absolute address of the document to be accessed.
filter if YES, treat document as HTML
*/
/*
ON EXIT,
*/
/*
returns YES Success in opening document
NO Failure
*/
extern int HTLoadAbsolute PARAMS((WWW_CONST char * addr));
@@ -104,19 +104,19 @@ extern int HTLoadAbsolute PARAMS((WWW_CONST char * addr));
Load a document from absolute name to a stream
ON ENTRY,
addr The absolute address of the document to be accessed.
filter if YES, treat document as HTML
ON EXIT,
returns YES Success in opening document
NO Failure
Note: This is equivalent to HTLoadDocument
*/
extern BOOL HTLoadToStream PARAMS((WWW_CONST char * addr, BOOL filter,
HTStream * sink));
@@ -127,13 +127,13 @@ extern BOOL HTLoadToStream PARAMS((WWW_CONST char * addr, BOOL filter,
Make a stream for Saving object back
ON ENTRY,
anchor is valid anchor which has previously beeing loaded
ON EXIT,
returns 0 if error else a stream to save the object to.
*/
@@ -148,13 +148,13 @@ Register an access method
typedef struct _HTProtocol {
char * name;
int (*load)PARAMS((
WWW_CONST char * full_address,
HTParentAnchor * anchor,
HTFormat format_out,
HTStream* sink));
HTStream* (*saveStream)PARAMS((HTParentAnchor * anchor));
} HTProtocol;

View File

@@ -7,7 +7,7 @@
** History
**
** Nov 1990 Written in Objective-C for the NeXT browser (TBL)
** 24-Oct-1991 (JFG), written in C, browser-independant
** 24-Oct-1991 (JFG), written in C, browser-independant
** 21-Nov-1991 (JFG), first complete version
**
** (c) Copyright CERN 1991 - See Copyright.html
@@ -40,7 +40,7 @@ PRIVATE HTList **adult_table=0; /* Point to table of lists of all parents */
PRIVATE HTParentAnchor * HTParentAnchor_new
NOARGS
{
HTParentAnchor *newAnchor =
HTParentAnchor *newAnchor =
(HTParentAnchor *) calloc (1, sizeof (HTParentAnchor)); /* zero-filled */
newAnchor->parent = newAnchor;
return newAnchor;
@@ -168,7 +168,7 @@ HTAnchor * HTAnchor_findAddress
/* If the address represents a sub-anchor, we recursively load its parent,
then we create a child anchor within that document. */
if (tag && *tag)
if (tag && *tag)
{
char *docAddress = HTParse(address, "", PARSE_ACCESS | PARSE_HOST |
PARSE_PATH | PARSE_PUNCTUATION);
@@ -179,8 +179,8 @@ HTAnchor * HTAnchor_findAddress
free (tag);
return (HTAnchor *) foundAnchor;
}
else { /* If the address has no anchor tag,
else { /* If the address has no anchor tag,
check whether we have this node */
int hash;
WWW_CONST char *p;
@@ -189,7 +189,7 @@ HTAnchor * HTAnchor_findAddress
HTParentAnchor * foundAnchor;
free (tag);
/* Select list from hash table */
for(p=address, hash=0; *p; p++)
hash = (hash * 3 + (*(unsigned char*)p))
@@ -210,7 +210,7 @@ HTAnchor * HTAnchor_findAddress
return (HTAnchor *) foundAnchor;
}
}
/* Node not found : create new anchor */
foundAnchor = HTParentAnchor_new ();
#ifndef DISABLE_TRACE

View File

@@ -1,7 +1,7 @@
/* ASSOCIATION LIST FOR STORING NAME-VALUE PAIRS
Lookups from assosiation list are not case-sensitive.
*/
#ifndef HTASSOC_H

View File

@@ -41,7 +41,7 @@ PUBLIC HTAtom * HTAtom_for(string)
/* Bug hack. */
if (!string || !*string)
string = strdup ("blargh");
/* First time around, clear hash table
*/
if (!initialised) {
@@ -50,13 +50,13 @@ PUBLIC HTAtom * HTAtom_for(string)
hash_table[i] = (HTAtom *) 0;
initialised = YES;
}
/* Generate hash function
*/
for(p=string, hash=0; *p; p++) {
hash = (hash * 3 + *p) % HASH_SIZE;
}
/* Search for the string in the list
*/
for (a=hash_table[hash]; a; a=a->next) {
@@ -68,7 +68,7 @@ PUBLIC HTAtom * HTAtom_for(string)
return a; /* Found: return it */
}
}
/* Generate a new entry
*/
a = (HTAtom *)malloc(sizeof(*a));
@@ -95,17 +95,17 @@ PUBLIC HTAtom * HTAtom_exists(string)
int hash;
WWW_CONST char * p;
HTAtom * a;
if (!initialised) {
return NULL;
}
/* Generate hash function
*/
for(p=string, hash=0; *p; p++) {
hash = (hash * 3 + *p) % HASH_SIZE;
}
/* Search for the string in the list
*/
for (a=hash_table[hash]; a; a=a->next) {
@@ -113,6 +113,6 @@ PUBLIC HTAtom * HTAtom_exists(string)
return a; /* Found: return it */
}
}
return NULL;
}

View File

@@ -65,7 +65,7 @@ PRIVATE HTAAUser *decompose_auth_string ARGS2(char *, authstring,
/* this also frees all the strings pointed to */
/* by the static 'user'. */
if (!authstring || !*authstring ||
if (!authstring || !*authstring ||
scheme != HTAA_BASIC || scheme == HTAA_PUBKEY)
return NULL;
@@ -88,7 +88,7 @@ PRIVATE HTAAUser *decompose_auth_string ARGS2(char *, authstring,
else { /* Just uudecode */
int bytes_decoded;
int len = strlen(authstring) + 1;
if (!(cleartext = (char*)malloc(len)))
outofmem(__FILE__, "decompose_auth_string");
bytes_decoded = HTUU_decode(authstring, cleartext, len);
@@ -115,7 +115,7 @@ PRIVATE HTAAUser *decompose_auth_string ARGS2(char *, authstring,
** Extract rest of the fields
*/
if (scheme == HTAA_PUBKEY) {
if ( !(inet_addr =strchr(password, ':')) ||
if ( !(inet_addr =strchr(password, ':')) ||
(*(inet_addr++) ='\0'), !(timestamp =strchr(inet_addr,':')) ||
(*(timestamp++) ='\0'), !(browsers_key=strchr(timestamp,':')) ||
(*(browsers_key++)='\0')) {
@@ -162,7 +162,7 @@ PRIVATE HTAAUser *decompose_auth_string ARGS2(char *, authstring,
username, password, inet_addr, timestamp, browsers_key);
}
#endif
return user;
}

View File

@@ -1,8 +1,8 @@
/* AUTHENTICATION MODULE
This is the authentication module. By modifying the function HTAA_authenticate() it can
be made to support external authentication methods.
*/
#ifndef HTAUTH_H

View File

@@ -1,11 +1,11 @@
/* /Net/dxcern/userd/timbl/hypertext/WWW/Library/Implementation/HTChunk.html
CHUNK HANDLING:
FLEXIBLE ARRAYS
This module implements a flexible array. It is a general utility module. A chunk is a
structure which may be extended. These routines create and append data to chunks,
automatically reallocating them as necessary.
*/
typedef struct {
int size; /* In bytes */
@@ -30,15 +30,15 @@ typedef struct {
Create new chunk
ON ENTRY,
growby The number of bytes to allocate at a time when the chunk is
later extended. Arbitrary but normally a trade-off time vs.
memory
ON EXIT,
returns A chunk pointer to the new chunk,
*/
extern HTChunk * HTChunkCreate PARAMS((int growby));
@@ -49,13 +49,13 @@ extern HTChunk * HTChunkCreate PARAMS((int growby));
Free a chunk
ON ENTRY,
ch A valid chunk pointer made by HTChunkCreate()
ON EXIT,
ch is invalid and may not be used.
*/
extern void HTChunkFree PARAMS((HTChunk * ch));
@@ -66,13 +66,13 @@ extern void HTChunkFree PARAMS((HTChunk * ch));
Clear a chunk
ON ENTRY,
ch A valid chunk pointer made by HTChunkCreate()
ON EXIT,
*ch The size of the chunk is zero.
*/
extern void HTChunkClear PARAMS((HTChunk * ch));
@@ -83,15 +83,15 @@ extern void HTChunkClear PARAMS((HTChunk * ch));
Ensure a chunk has a certain space in
ON ENTRY,
ch A valid chunk pointer made by HTChunkCreate()
s The size required
ON EXIT,
*ch Has size at least s
*/
extern void HTChunkEnsure PARAMS((HTChunk * ch, int s));
@@ -102,15 +102,15 @@ extern void HTChunkEnsure PARAMS((HTChunk * ch, int s));
Append a character to a chunk
ON ENTRY,
ch A valid chunk pointer made by HTChunkCreate()
c The character to be appended
ON EXIT,
*ch Is one character bigger
*/
extern void HTChunkPutc PARAMS((HTChunk * ch, char c));
@@ -119,15 +119,15 @@ extern void HTChunkPutc PARAMS((HTChunk * ch, char c));
Append a string to a chunk
ON ENTRY,
ch A valid chunk pointer made by HTChunkCreate()
str Tpoints to a zero-terminated string to be appended
ON EXIT,
*ch Is bigger by strlen(str)
*/
@@ -143,13 +143,13 @@ Append a zero character to a chunk
/*
ON ENTRY,
ch A valid chunk pointer made by HTChunkCreate()
ON EXIT,
*ch Is one character bigger
*/

View File

@@ -28,7 +28,7 @@
extern int www2Trace;
#endif
struct _HTStream
struct _HTStream
{
WWW_CONST HTStreamClass* isa;
/* ... */
@@ -55,7 +55,7 @@ void HTCompressedFileToFile (char *fnam, int compressed)
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf
fprintf
(stderr, "[HTCompressedFileToFile] Entered; fnam '%s', compressed %d\n",
fnam, compressed);
#endif
@@ -65,7 +65,7 @@ void HTCompressedFileToFile (char *fnam, int compressed)
return;
HTProgress ("Preparing to uncompress data.");
znam = (char *)malloc (sizeof (char) * (strlen (fnam) + 8));
/* Either compressed or gzipped. */
@@ -161,11 +161,11 @@ void HTCompressedFileToFile (char *fnam, int compressed)
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf
fprintf
(stderr, "[HTCompressedFileToFile] Uncompressed '%s' with command '%s'\n",
znam, cmd);
#endif
free (cmd);
free (znam);
@@ -178,10 +178,10 @@ void HTCompressedHText (HText *text, int compressed, int plain)
char *fnam;
FILE *fp;
int rv, size_of_data;
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf
fprintf
(stderr, "[HTCompressedHText] Entered; compressed %d\n",
compressed);
#endif
@@ -199,7 +199,7 @@ void HTCompressedHText (HText *text, int compressed, int plain)
fprintf (stderr, "[HTCompressedHText] size_of_data 0; punting\n");
return;
}
fnam = mo_tmpnam ((char *) 0);
fp = fopen (fnam, "w");
if (!fp)
@@ -240,7 +240,7 @@ void HTCompressedHText (HText *text, int compressed, int plain)
HText_clearOutForNewContents (text);
HText_beginAppend (text);
if (plain)
{
#ifndef DISABLE_TRACE
@@ -277,6 +277,6 @@ void HTCompressedHText (HText *text, int compressed, int plain)
free (cmd);
*/
unlink(fnam);
return;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +1,12 @@
/* FTP access module for libwww
FTP ACCESS FUNCTIONS
This isn't really a valid protocol module -- it is lumped together
with HTFile . That could be changed easily.
Author: Tim Berners-Lee. Public Domain. Please mail changes to
timbl@info.cern.ch
*/
#ifndef HTFTP_H
#define HTFTP_H
@@ -21,9 +21,9 @@
Retrieve File from Server
ON EXIT,
returns Socket number for file if good.<0 if bad.
*/
extern int HTFTPLoad PARAMS
((

View File

@@ -40,7 +40,7 @@ extern int www2Trace;
struct _HTStream {
WWW_CONST HTStreamClass * isa;
FILE * fp;
char * fnam;
char * end_command;
@@ -121,7 +121,7 @@ PRIVATE void HTFWriter_write ARGS3(HTStream *, me, WWW_CONST char*, s, int, l)
if (me->write_error)
return;
rv = fwrite(s, 1, l, me->fp);
rv = fwrite(s, 1, l, me->fp);
if (rv != l)
{
HTProgress ("Error writing to temporary file.");
@@ -194,7 +194,7 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me)
free (cmd);
*/
/*ddt*/unlink(me->fnam);
HTProgress ("Insufficient temporary disk space; could not transfer data.");
free (me->fnam);
@@ -397,7 +397,7 @@ PRIVATE void HTFWriter_handle_interrupt ARGS1(HTStream *, me)
if (www2Trace)
fprintf (stderr, "*** HTFWriter interrupted; killed '%s'\n", me->fnam);
#endif
outtahere:
me->interrupted = 1;
@@ -409,14 +409,14 @@ PRIVATE void HTFWriter_handle_interrupt ARGS1(HTStream *, me)
** -----------------------
*/
PRIVATE WWW_CONST HTStreamClass HTFWriter = /* As opposed to print etc */
{
{
"FileWriter",
HTFWriter_free,
HTFWriter_end_document,
HTFWriter_put_character, HTFWriter_put_string,
HTFWriter_write,
HTFWriter_handle_interrupt
};
};
/* Take action using a system command
@@ -439,11 +439,11 @@ PUBLIC HTStream* HTSaveAndExecute ARGS5(
{
char *command;
WWW_CONST char * suffix;
HTStream* me;
me = (HTStream*)malloc(sizeof(*me));
me->isa = &HTFWriter;
me->isa = &HTFWriter;
me->interrupted = 0;
me->write_error = 0;
me->fnam = NULL;
@@ -466,20 +466,20 @@ PUBLIC HTStream* HTSaveAndExecute ARGS5(
fprintf (stderr, "[HTSaveAndExecute] me->compressed is '%d'\n",
me->compressed);
#endif
/* Save the file under a suitably suffixed name */
if (!force_dump_to_file)
{
extern char *mo_tmpnam (char *);
suffix = HTFileSuffix(pres->rep);
me->fnam = mo_tmpnam(anchor->address);
if (suffix)
if (suffix)
{
char *freeme = me->fnam;
me->fnam = (char *)malloc (strlen (me->fnam) + strlen (suffix) + 8);
strcpy(me->fnam, freeme);
strcat(me->fnam, suffix);
@@ -492,7 +492,7 @@ PUBLIC HTStream* HTSaveAndExecute ARGS5(
}
me->fp = fopen (me->fnam, "w");
if (!me->fp)
if (!me->fp)
{
HTProgress("Can't open temporary file -- serious problem.");
me->write_error = 1;
@@ -515,15 +515,15 @@ PUBLIC HTStream* HTSaveAndExecute ARGS5(
strstr (pres->command, "mosaic-internal"))
{
/* Make command to process file */
command = (char *)malloc
((strlen (pres->command) + 10 + 3*strlen(me->fnam)) *
command = (char *)malloc
((strlen (pres->command) + 10 + 3*strlen(me->fnam)) *
sizeof (char));
/* Cute. pres->command will be something like "xv %s"; me->fnam
gets filled in as many times as appropriate. */
sprintf (command, pres->command, me->fnam, me->fnam, me->fnam);
me->end_command = (char *)malloc
me->end_command = (char *)malloc
((strlen (command) + 32 + strlen(me->fnam)) * sizeof (char));
sprintf (me->end_command, "(%s ; /bin/rm -f %s) &",
command, me->fnam);
@@ -534,8 +534,8 @@ PUBLIC HTStream* HTSaveAndExecute ARGS5(
{
/* Make command to process file -- but we have to cat
to the viewer's stdin. */
me->end_command = (char *)malloc
((strlen (pres->command) + 64 + (2 * strlen(me->fnam))) *
me->end_command = (char *)malloc
((strlen (pres->command) + 64 + (2 * strlen(me->fnam))) *
sizeof (char));
sprintf (me->end_command, "((cat %s | %s); /bin/rm -f %s) &",
me->fnam, pres->command, me->fnam);
@@ -550,6 +550,6 @@ PUBLIC HTStream* HTSaveAndExecute ARGS5(
sprintf (me->end_command, "<%s \"%s\">\n", "mosaic-internal-reference", me->fnam);
}
}
return me;
}

View File

@@ -1,9 +1,9 @@
/*
C FILE WRITER
It is useful to have both FWriter and Writer for environments in
which fdopen() doesn't exist for example.
*/
#ifndef HTFWRITE_H
#define HTFWRITE_H

View File

@@ -159,7 +159,7 @@ PRIVATE char * vms_name(WWW_CONST char * nn, WWW_CONST char * fn)
/* We try converting the filename into Files-11 syntax. That is, we assume
** first that the file is, like us, on a VMS node. We try remote
** (or local) DECnet access. Files-11, VMS, VAX and DECnet
** are trademarks of Digital Equipment Corporation.
** are trademarks of Digital Equipment Corporation.
** The node is assumed to be local if the hostname WITHOUT DOMAIN
** matches the local one. @@@
*/
@@ -266,7 +266,7 @@ PUBLIC char * HTLocalName ARGS1(WWW_CONST char *,name)
HTUnEscape(path); /* Interpret % signs */
if (0==strcmp(access, "file"))
if (0==strcmp(access, "file"))
{
free(access);
if (!host || !*host || (0==my_strcasecmp(host, HTHostName())) ||
@@ -275,7 +275,7 @@ PUBLIC char * HTLocalName ARGS1(WWW_CONST char *,name)
if (host)
free(host);
#ifndef DISABLE_TRACE
if (www2Trace)
if (www2Trace)
fprintf(stderr, "Node `%s' means path `%s'\n", name, path);
#endif
return(path);
@@ -288,7 +288,7 @@ PUBLIC char * HTLocalName ARGS1(WWW_CONST char *,name)
return NULL;
}
}
/* not file */
if (host)
free (host);
@@ -425,55 +425,55 @@ PUBLIC HTFormat HTFileFormat ARGS4 (
lf = strlen (filename);
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf (stderr,
fprintf (stderr,
"[HTFileFormat] Got hit on .gz; filename '%s'\n",
filename);
#endif
goto ok_ready;
}
}
}
}
}
ok_ready:
if (!HTSuffixes)
if (!HTSuffixes)
HTFileInit();
*pencoding = NULL;
n = HTList_count(HTSuffixes);
for(i=0; i<n; i++)
for(i=0; i<n; i++)
{
int ls;
suff = HTList_objectAt(HTSuffixes, i);
ls = strlen(suff->suffix);
if ((ls <= lf) && 0==my_strcasecmp(suff->suffix, filename + lf - ls))
if ((ls <= lf) && 0==my_strcasecmp(suff->suffix, filename + lf - ls))
{
int j;
*pencoding = suff->encoding;
if (suff->rep)
if (suff->rep)
goto done;
for(j=0; j<n; j++)
for(j=0; j<n; j++)
{ /* Got encoding, need representation */
int ls2;
suff = HTList_objectAt(HTSuffixes, j);
ls2 = strlen(suff->suffix);
if ((ls <= lf) &&
0==my_strncasecmp(suff->suffix, filename + lf - ls -ls2, ls2))
if (suff->rep)
if ((ls <= lf) &&
0==my_strncasecmp(suff->suffix, filename + lf - ls -ls2, ls2))
if (suff->rep)
goto done;
}
}
}
suff = strchr(filename, '.') ? /* Unknown suffix */
( unknown_suffix.rep ? &unknown_suffix : &no_suffix)
: &no_suffix;
/* For now, assuming default is 8bit text/plain.
We also want default 8bit text/html for http connections. */
/* set default encoding unless found with suffix already */
if (!*pencoding) *pencoding = suff->encoding ? suff->encoding
: HTAtom_for("8bit");
@@ -541,7 +541,7 @@ char *HTDescribeURL (char *url)
}
}
got_subtype:
access = HTParse (url, "", PARSE_ACCESS);
if (strcmp (access, "http") == 0)
{
@@ -578,7 +578,7 @@ char *HTDescribeURL (char *url)
if (host[i] == ':')
host[i] = '\0';
#endif
if (st)
{
/* Uppercase type, to start sentence. */
@@ -588,15 +588,15 @@ char *HTDescribeURL (char *url)
st = &(st[2]);
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf (stderr,
fprintf (stderr,
"DESCRIBE: in if (st); pasting together %s %s %s %s %s\n",
t,
(strcmp (t, "Application") == 0 ? " data" : ""),
t,
(strcmp (t, "Application") == 0 ? " data" : ""),
st, host, access);
#endif
sprintf (line, "%s%s, type %s, on host %s, via %s.",
t,
(strcmp (t, "Application") == 0 ? " data" : ""),
sprintf (line, "%s%s, type %s, on host %s, via %s.",
t,
(strcmp (t, "Application") == 0 ? " data" : ""),
st, host, access);
#ifndef DISABLE_TRACE
if (www2Trace)
@@ -682,12 +682,12 @@ PUBLIC BOOL HTEditable ARGS1 (WWW_CONST char *,filename)
#ifdef NO_GROUPS
return NO; /* Safe answer till we find the correct algorithm */
#else
gid_t groups[NGROUPS];
gid_t groups[NGROUPS];
uid_t myUid;
int ngroups; /* The number of groups */
struct stat fileStatus;
int i;
if (stat(filename, &fileStatus)) /* Get details of filename */
return NO; /* Can't even access file! */
@@ -698,7 +698,7 @@ PUBLIC BOOL HTEditable ARGS1 (WWW_CONST char *,filename)
#ifndef DISABLE_TRACE
if (www2Trace) {
int i;
fprintf(stderr,
fprintf(stderr,
"File mode is 0%o, uid=%d, gid=%d. My uid=%d, %d groups (",
(unsigned int) fileStatus.st_mode, fileStatus.st_uid,
fileStatus.st_gid,
@@ -707,10 +707,10 @@ PUBLIC BOOL HTEditable ARGS1 (WWW_CONST char *,filename)
fprintf(stderr, ")\n");
}
#endif
if (fileStatus.st_mode & 0002) /* I can write anyway? */
return YES;
if ((fileStatus.st_mode & 0200) /* I can write my own file? */
&& (fileStatus.st_uid == myUid))
return YES;
@@ -752,7 +752,7 @@ PUBLIC void HTDirEntry ARGS3(HTStructured *, target,
PUTS(entry);
PUTS("</A>");
}
/* Output parent directory entry
**
** This gives the TITLE and H1 header, and also a link
@@ -776,8 +776,8 @@ PUBLIC void HTDirTitles ARGS2(HTStructured *, target,
START(HTML_TITLE);
PUTS(*printable ? printable : "Welcome ");
PUTS(" directory");
END(HTML_TITLE);
END(HTML_TITLE);
START(HTML_H1);
PUTS(*printable ? printable : "Welcome");
END(HTML_H1);
@@ -881,7 +881,7 @@ PUBLIC int HTLoadFile ARGS4 (
fd = open(ultrixname, O_RDONLY, 0);
if (fd<0) {
#ifndef DISABLE_TRACE
if (www2Trace) fprintf(stderr,
if (www2Trace) fprintf(stderr,
"HTFile: Can't open as %s\n", ultrixname);
#endif
}
@@ -1036,7 +1036,7 @@ forget_multi:
struct stat statbuf;
STRUCT_DIRENT * dp;
DIR *dfp;
int cmpr;
int count;
@@ -1119,7 +1119,7 @@ forget_multi:
/* We dont want to see . */
if(strcmp(dataptr,".") == 0) continue;
/* If its .. *and* the current directory is / dont show anything, otherwise
* print out a nice Parent Directory entry.
* */
@@ -1150,18 +1150,18 @@ forget_multi:
continue;
}
}
/* Get the filesize information from a stat, if we cant stat it, we probably */
/* cant read it either, so ignore it. */
sprintf(filepath,"%s/%s",localname, dataptr);
if(stat(filepath, &statbuf) == -1) continue;
HText_appendText(HT,"<DD><A HREF=\"");
HText_appendText (HT, localname);
if(localname[strlen(localname)-1] != '/')
if(localname[strlen(localname)-1] != '/')
{
HText_appendText (HT, "/");
}
@@ -1183,10 +1183,10 @@ forget_multi:
}
else
{
sprintf(buffer,"%s (%ld bytes)",
sprintf(buffer,"%s (%ld bytes)",
dataptr, (long)statbuf.st_size);
format = HTFileFormat(dataptr, &pencoding,
format = HTFileFormat(dataptr, &pencoding,
WWW_SOURCE, &cmpr);
/* If its executable then call it application, else it might as well be text */
@@ -1195,15 +1195,15 @@ forget_multi:
{
HText_appendText(HT, "<IMG SRC=\"");
if((statbuf.st_mode & S_IXUSR) ||
(statbuf.st_mode & S_IXGRP) ||
(statbuf.st_mode & S_IXGRP) ||
(statbuf.st_mode & S_IXOTH))
{
HText_appendText(HT,
HText_appendText(HT,
HTgeticonname(format, "application"));
}
else
{
HText_appendText(HT,
HText_appendText(HT,
HTgeticonname(format, "text"));
}
HText_appendText(HT, "\"> ");
@@ -1229,9 +1229,9 @@ forget_multi:
free(localname);
return HT_LOADED;
} /* end if localname is directory */
} /* end if file stat worked */
/* End of directory reading section
*/
#endif
@@ -1259,7 +1259,7 @@ This is closed elsewhere...SWP
return HT_LOADED;
} /* If succesfull open */
} /* scope of fp */
} /* local unix file system */
} /* local unix file system */
#endif
#endif

View File

@@ -1,12 +1,12 @@
/* File access in libwww
FILE ACCESS
These are routines for local file access used by WWW browsers and
servers. Implemented by HTFile.c.
If the file is not a local file, then we pass it on to HTFTP in
case it can be reached by FTP.
*/
#ifndef HTFILE_H
#define HTFILE_H
@@ -24,7 +24,7 @@ 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 */
@@ -75,7 +75,7 @@ Output directory titles
This is (like the next one) used by HTFTP. It is common code to
generate the title and heading 1 and the parent directory link for
any anchor.
*/
extern void HTDirTitles PARAMS((
HTStructured * target,
@@ -87,7 +87,7 @@ Output a directory entry
This is used by HTFTP.c for example -- it is a common routine for
generating a linked directory entry.
*/
extern void HTDirEntry PARAMS((
HTStructured * target, /* in which to put the linked text */
@@ -100,18 +100,18 @@ HTSetSuffix: Define the representation for a file suffix
This defines a mapping between local file suffixes and file content
types and encodings.
ON ENTRY,
suffix includes the "." if that is important (normally, yes!)
representation is MIME-style content-type
encoding is MIME-style content-transfer-encoding (8bit, 7bit, etc)
quality an a priori judgement of the quality of such files
(0.0..1.0)
*/
/* Example: HTSetSuffix(".ps", "application/postscript", "8bit", 1.0);
**
@@ -122,18 +122,18 @@ extern void HTSetSuffix PARAMS((
WWW_CONST char * representation,
WWW_CONST char * encoding,
float quality));
/*
HTFileFormat: Get Representation and Encoding from file name
ON EXIT,
return The represntation it imagines the file is in
*pEncoding The encoding (binary, 7bit, etc). See HTSetSuffix.
*/
#define COMPRESSED_NOT 0
@@ -166,17 +166,17 @@ extern float HTFileValue PARAMS((
Determine write access to a file
ON EXIT,
return value YES if file can be accessed and can be written to.
*/
/*
BUGS
Isn't there a quicker way?
*/
@@ -188,14 +188,14 @@ extern BOOL HTEditable PARAMS((WWW_CONST char * filename));
Determine a suitable suffix, given the representation
ON ENTRY,
rep is the atomized MIME style representation
ON EXIT,
returns a pointer to a suitable suffix string if one has been found,
else NULL.
*/
extern WWW_CONST char * HTFileSuffix PARAMS((
HTAtom* rep));

View File

@@ -66,12 +66,12 @@ PUBLIC void HTSetPresentation ARGS5(
WWW_CONST char *, representation,
WWW_CONST char *, command,
float, quality,
float, secs,
float, secs,
float, secs_per_byte
){
HTPresentation * pres = (HTPresentation *)malloc(sizeof(HTPresentation));
pres->rep = HTAtom_for(representation);
pres->rep_out = WWW_PRESENT; /* Fixed for now ... :-) */
pres->converter = HTSaveAndExecute; /* Fixed for now ... */
@@ -81,9 +81,9 @@ PUBLIC void HTSetPresentation ARGS5(
pres->rep = HTAtom_for(representation);
pres->command = 0;
StrAllocCopy(pres->command, command);
if (!HTPresentations) HTPresentations = HTList_new();
if (strcmp(representation, "*")==0) {
if (default_presentation) free(default_presentation);
default_presentation = pres;
@@ -101,12 +101,12 @@ PUBLIC void HTSetConversion ARGS6(
WWW_CONST char *, representation_out,
HTConverter*, converter,
float, quality,
float, secs,
float, secs,
float, secs_per_byte
){
HTPresentation * pres = (HTPresentation *)malloc(sizeof(HTPresentation));
pres->rep = HTAtom_for(representation_in);
pres->rep_out = HTAtom_for(representation_out);
pres->converter = converter;
@@ -115,9 +115,9 @@ PUBLIC void HTSetConversion ARGS6(
pres->secs = secs;
pres->secs_per_byte = secs_per_byte;
pres->command = 0;
if (!HTPresentations) HTPresentations = HTList_new();
if (strcmp(representation_in, "*")==0) {
if (default_presentation) free(default_presentation);
default_presentation = pres;
@@ -137,7 +137,7 @@ PUBLIC void HTRemoveConversion ARGS3(
WWW_CONST char *, representation_out,
HTConverter*, converter
){
int numberOfPresentations;
int numberOfPresentations;
HTPresentation * pres;
HTAtom *rep_in, *rep_out;
int x;
@@ -157,7 +157,7 @@ int x;
HTList_removeObject(HTPresentations,pres);
}
}
}
}
@@ -196,15 +196,15 @@ PUBLIC char HTGetCharacter NOARGS
{
char ch;
interrupted_in_htgetcharacter = 0;
do
do
{
if (input_pointer >= input_limit)
if (input_pointer >= input_limit)
{
int status =
int status =
NETREAD(input_file_number, input_buffer, INPUT_BUFFER_SIZE);
if (status <= 0)
if (status <= 0)
{
if (status == 0)
if (status == 0)
return (char)EOF;
if (status == HT_INTERRUPTED)
{
@@ -216,7 +216,7 @@ PUBLIC char HTGetCharacter NOARGS
return (char)EOF;
}
#ifndef DISABLE_TRACE
if (www2Trace)
if (www2Trace)
fprintf(stderr,
"HTFormat: File read error %d\n", status);
#endif
@@ -228,7 +228,7 @@ PUBLIC char HTGetCharacter NOARGS
ch = *input_pointer++;
}
while (ch == (char) 13); /* Ignore ASCII carriage return */
return ch;
}
@@ -237,12 +237,12 @@ PUBLIC char HTGetCharacter NOARGS
PUBLIC int HTOutputBinary ARGS2( int, input,
FILE *, output)
{
do
do
{
int status = NETREAD(input, input_buffer, INPUT_BUFFER_SIZE);
if (status <= 0)
if (status <= 0)
{
if (status == 0)
if (status == 0)
return 0;
#ifndef DISABLE_TRACE
if (www2Trace) fprintf(stderr,
@@ -267,7 +267,7 @@ static int partial_wildcard_matches (HTFormat r1, HTFormat r2)
if (!s1 || !s2)
return 0;
s1 = strdup (s1);
s2 = strdup (s2);
@@ -284,7 +284,7 @@ static int partial_wildcard_matches (HTFormat r1, HTFormat r2)
done1:
if (!subtype1)
goto nope;
/* Bail if we don't have a wildcard possibility. */
if (subtype1[0] != '*')
goto nope;
@@ -319,7 +319,7 @@ static int partial_wildcard_matches (HTFormat r1, HTFormat r2)
free (s2);
return 0;
}
/* Create a filter stack
** ---------------------
@@ -344,10 +344,10 @@ PUBLIC HTStream * HTStreamStack ARGS5(
extern int force_dump_to_file;
#ifndef DISABLE_TRACE
if (www2Trace)
if (www2Trace)
fprintf(stderr,
"[HTStreamStack] Constructing stream stack for %s to %s\n",
HTAtom_name(format_in),
HTAtom_name(format_in),
HTAtom_name(rep_out));
#endif
#ifndef DISABLE_TRACE
@@ -355,9 +355,9 @@ PUBLIC HTStream * HTStreamStack ARGS5(
fprintf (stderr,
" Compressed is %d\n", compressed);
#endif
if (rep_out == WWW_SOURCE ||
rep_out == format_in)
rep_out == format_in)
{
#ifndef DISABLE_TRACE
if (www2Trace)
@@ -366,20 +366,20 @@ PUBLIC HTStream * HTStreamStack ARGS5(
#endif
return sink;
}
if (!HTPresentations)
if (!HTPresentations)
HTFormatInit(); /* set up the list */
if (force_dump_to_file && format_in != WWW_MIME)
{
return HTSaveAndExecute (NULL, anchor, sink, format_in, compressed);
}
{
int n = HTList_count(HTPresentations);
int i;
HTPresentation * pres;
for(i=0; i<n; i++)
for(i=0; i<n; i++)
{
pres = HTList_objectAt(HTPresentations, i);
#ifndef DISABLE_TRACE
@@ -414,7 +414,7 @@ PUBLIC HTStream * HTStreamStack ARGS5(
#endif
return (*pres->converter)(pres, anchor, sink, format_in, compressed);
}
if (pres->rep_out == wildcard)
if (pres->rep_out == wildcard)
{
#ifndef DISABLE_TRACE
if (www2Trace)
@@ -435,10 +435,10 @@ PUBLIC HTStream * HTStreamStack ARGS5(
fprintf (stderr, "[HTStreamStack] Returning NULL at bottom.\n");
}
#endif
return NULL;
}
/* Find the cost of a filter stack
** -------------------------------
@@ -462,12 +462,12 @@ PUBLIC float HTStackValue ARGS4(
HTAtom_name(format_in), initial_value,
HTAtom_name(rep_out));
#endif
if (rep_out == WWW_SOURCE ||
rep_out == format_in) return 0.0;
if (!HTPresentations) HTFormatInit(); /* set up the list */
{
int n = HTList_count(HTPresentations);
int i;
@@ -485,11 +485,11 @@ PUBLIC float HTStackValue ARGS4(
}
}
}
return -1e30; /* Really bad */
}
/* Push data from a socket down a stream
** -------------------------------------
@@ -509,7 +509,7 @@ PUBLIC int HTCopy ARGS3(int, file_number,
HTStream*, sink,
int, bytes_already_read)
{
HTStreamClass targetClass;
HTStreamClass targetClass;
char line[256];
char *msg;
int bytes = bytes_already_read;
@@ -527,11 +527,11 @@ PUBLIC int HTCopy ARGS3(int, file_number,
**
*/
targetClass = *(sink->isa); /* Copy pointers to procedures */
hdr_len = HTMIME_get_header_length(sink);
/* Push binary from socket down sink */
for(;;)
for(;;)
{
int status, intr;
@@ -557,13 +557,13 @@ PUBLIC int HTCopy ARGS3(int, file_number,
rv = -1;
goto ready_to_leave;
}
if(loading_length == -1) {
left = -1;
status = NETREAD(file_number, input_buffer, INPUT_BUFFER_SIZE);
} else {
left = (loading_length+hdr_len)-total_read;
if(left>0) status = NETREAD(file_number, input_buffer,
if(left>0) status = NETREAD(file_number, input_buffer,
(left>INPUT_BUFFER_SIZE?
INPUT_BUFFER_SIZE:left));
else status=0;
@@ -571,17 +571,17 @@ PUBLIC int HTCopy ARGS3(int, file_number,
if (status > 0)
total_read += status;
/* fprintf(stderr,"ll = %d status = %d left = %d hdr = %d tr = %d\n",
loading_length,status,left,hdr_len,total_read);
*/
*/
/*
status = NETREAD(file_number, input_buffer, INPUT_BUFFER_SIZE);
*/
if (status <= 0)
if (status <= 0)
{
if (status == 0)
if (status == 0)
break;
if (status == HT_INTERRUPTED)
{
@@ -625,14 +625,14 @@ PUBLIC int HTCopy ARGS3(int, file_number,
/* moved msg stuff here as loading_length may change midstream -bjs*/
if (loading_length == -1){
msg = (loading_inlined_images ?
"Read %d bytes of inlined image data." :
msg = (loading_inlined_images ?
"Read %d bytes of inlined image data." :
"Read %d bytes of data.");
sprintf (line, msg, bytes);
/* HTMeter(0,NULL);*/
}else{
msg = (loading_inlined_images ?
"Read %d of %d bytes of inlined image data." :
msg = (loading_inlined_images ?
"Read %d of %d bytes of inlined image data." :
"Read %d of %d bytes of data.");
sprintf (line, msg, bytes, loading_length+hdr_len);
HTMeter((bytes*100)/(loading_length+hdr_len),NULL);
@@ -643,10 +643,10 @@ PUBLIC int HTCopy ARGS3(int, file_number,
break;
}
} /* next bufferload */
/*
HTProgress (loading_inlined_images ?
"Data transfer complete." : "Data transfer complete.");
"Data transfer complete." : "Data transfer complete.");
*/
HTProgress("Data transfer complete.");
noLength=0;
@@ -682,10 +682,10 @@ PUBLIC void HTFileCopy ARGS2(
FILE *, fp,
HTStream*, sink)
{
HTStreamClass targetClass;
HTStreamClass targetClass;
targetClass = *(sink->isa); /* Copy pointers to procedures */
for(;;) {
int status = fread(input_buffer, 1, INPUT_BUFFER_SIZE, fp);
if (status == 0) { /* EOF or error */
@@ -708,10 +708,10 @@ PUBLIC void HTFileCopyToText ARGS2(
FILE *, fp,
HText *, text)
{
for(;;)
for(;;)
{
int status = fread(input_buffer, 1, INPUT_BUFFER_SIZE, fp);
if (status == 0)
if (status == 0)
{ /* EOF or error */
if (ferror(fp) == 0) break;
#ifndef DISABLE_TRACE
@@ -722,7 +722,7 @@ PUBLIC void HTFileCopyToText ARGS2(
}
HText_appendBlock (text, input_buffer, status);
} /* next bufferload */
fclose (fp);
return;
}
@@ -747,15 +747,15 @@ PUBLIC int HTParseSocket ARGS6(
int, compressed)
{
HTStream * stream;
HTStreamClass targetClass;
HTStreamClass targetClass;
int rv;
stream = HTStreamStack(format_in,
format_out,
compressed,
sink, anchor);
if (!stream)
if (!stream)
{
char buffer[1024]; /* @@@@@@@@ */
sprintf(buffer, "Sorry, can't convert from %s to %s.",
@@ -765,7 +765,7 @@ PUBLIC int HTParseSocket ARGS6(
#endif
return HTLoadError(sink, 501, buffer);
}
targetClass = *(stream->isa); /* Copy pointers to procedures */
rv = HTCopy(file_number, stream, 0);
if (rv == -1)
@@ -784,7 +784,7 @@ PUBLIC int HTParseSocket ARGS6(
NETCLOSE (file_number);
(*targetClass.free)(stream);
return HT_LOADED;
}
@@ -809,13 +809,13 @@ PUBLIC int HTParseFile ARGS6(
int, compressed)
{
HTStream * stream;
HTStreamClass targetClass;
HTStreamClass targetClass;
stream = HTStreamStack(format_in,
format_out,
compressed,
sink , anchor);
if (!stream) {
char buffer[1024]; /* @@@@@@@@ */
sprintf(buffer, "Sorry, can't convert from %s to %s.",
@@ -825,11 +825,11 @@ PUBLIC int HTParseFile ARGS6(
#endif
return HTLoadError(sink, 501, buffer);
}
targetClass = *(stream->isa); /* Copy pointers to procedures */
HTFileCopy(fp, stream);
(*targetClass.end_document)(stream);
(*targetClass.free)(stream);
return HT_LOADED;
}

View File

@@ -1,13 +1,13 @@
/* HTFormat: The format manager in the WWW Library
MANAGE DIFFERENT DOCUMENT FORMATS
Here we describe the functions of the HTFormat module which handles conversion between
different data representations. (In MIME parlance, a representation is known as a
content-type. In WWW the term "format" is often used as it is shorter).
This module is implemented by HTFormat.c . This hypertext document is used to generate
the HTFormat.h inlude file. Part of the WWW library.
Preamble
*/
@@ -30,18 +30,18 @@ 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;
/*
These macros (which used to be constants) define some basic internally referenced
representations. The www/xxx ones are of course not MIME standard.
www/source is an output format which leaves the input untouched. It is 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*/
@@ -50,7 +50,7 @@ typedef HTAtom * HTFormat;
www/present represents the user's perception of the document. If you convert to
www/present, you present the material to the user.
*/
#define WWW_PRESENT HTAtom_for("www/present") /* The user's perception */
@@ -58,13 +58,13 @@ typedef HTAtom * HTFormat;
The message/rfc822 format means a MIME message or a plain text message with no MIME
header. This is what is returned by an HTTP server.
*/
#define WWW_MIME HTAtom_for("www/mime") /* A MIME message */
/*
www/print is like www/present except it represents a printed copy.
*/
#define WWW_PRINT HTAtom_for("www/print") /* A printed copy */
@@ -78,21 +78,21 @@ typedef HTAtom * HTFormat;
We must include the following file after defining HTFormat, to which it makes
reference.
The HTEncoding type
typedef HTAtom* HTEncoding;
The following are values for the MIME types:
#define WWW_ENC_7BIT
#define WWW_ENC_8BIT
#define WWW_ENC_BINARY
We also add
*/
#include "HTAnchor.h"
@@ -106,7 +106,7 @@ The HTPresentation and HTConverter types
which data should be fed. See also HTStreamStack which scans the
list of registered converters and calls one. See the initialisation
module for a list of conversion routines.
*/
typedef struct _HTPresentation HTPresentation;
@@ -116,7 +116,7 @@ typedef HTStream * HTConverter PARAMS((
HTStream * sink,
HTFormat format_in,
int compressed));
struct _HTPresentation {
HTAtom* rep; /* representation name atmoized */
HTAtom* rep_out; /* resulting representation */
@@ -131,7 +131,7 @@ struct _HTPresentation {
The list of presentations is kept by this module. It is also scanned by modules which
want to know the set of formats supported. for example.
*/
extern HTList * HTPresentations;
@@ -140,17 +140,17 @@ extern HTList * HTPresentations;
HTSetPresentation: Register a system command to present a format
ON ENTRY,
rep is the MIME - style format name
command is the MAILCAP - style command template
quality A degradation faction 0..1
maxbytes A limit on the length acceptable as input (0 infinite)
maxsecs A limit on the time user will wait (0 for infinity)
*/
extern void HTSetPresentation PARAMS((
WWW_CONST char * representation,
@@ -166,13 +166,13 @@ extern void HTSetPresentation PARAMS((
HTSetConversion: Register a converstion routine
ON ENTRY,
rep_in is the content-type input
rep_out is the resulting content-type
converter is the routine to make the stream to do it
*/
extern void HTSetConversion PARAMS((
@@ -196,7 +196,7 @@ HTStreamStack: Create a stack of streams
and returns a stream into which the data in the input format should
be fed. The anchor is passed because hypertxet objects load
information into the anchor object which represents them.
*/
extern HTStream * HTStreamStack PARAMS((
HTFormat format_in,
@@ -210,18 +210,18 @@ extern HTStream * HTStreamStack PARAMS((
HTStackValue: Find the cost of a filter stack
Must return the cost of the same stack which HTStreamStack would set up.
ON ENTRY,
format_in The fomat of the data to be converted
format_out The format required
initial_value The intrinsic "value" of the data before conversion on a scale
from 0 to 1
length The number of bytes expected in the input format
*/
extern float HTStackValue PARAMS((
HTFormat format_in,
@@ -237,14 +237,14 @@ HTCopy: Copy a socket to a stream
This is used by the protocol engines to send data down a stream,
typically one which has been generated by HTStreamStack.
*/
extern int HTCopy PARAMS((
int file_number,
HTStream* sink,
int bytes_already_read));
/*
HTFileCopy: Copy a file to a stream
@@ -252,7 +252,7 @@ HTFileCopy: Copy a file to a stream
This is used by the protocol engines to send data down a stream,
typically one which has been generated by HTStreamStack. It is
currently called by HTParseFile
*/
extern void HTFileCopy PARAMS((
FILE* fp,
@@ -262,7 +262,7 @@ extern void HTFileCopyToText PARAMS((
FILE* fp,
HText* text));
#endif
/*
Clear input buffer and set file number
@@ -270,7 +270,7 @@ Clear input buffer and set file number
This routine and the one below provide simple character input from sockets. (They are
left over from the older architecure and may not be used very much.) The existence of
a common routine and buffer saves memory space in small implementations.
*/
extern void HTInitInput PARAMS((int file_number));
@@ -289,7 +289,7 @@ HTParseSocket: Parse a socket given its format
This routine is called by protocol modules to load an object. uses
HTStreamStack and the copy routines above. Returns HT_LOADED if
succesful, <0 if not.
*/
extern int HTParseSocket PARAMS((
HTFormat format_in,
@@ -306,7 +306,7 @@ HTParseFile: Parse a File through a file pointer
This routine is called by protocols modules to load an object. uses
HTStreamStack and HTFileCopy . Returns HT_LOADED if succesful, <0
if not.
*/
extern int HTParseFile PARAMS((
HTFormat format_in,

View File

@@ -173,7 +173,7 @@ PRIVATE int parse_menu ARGS2 (
PUTS("<H1>Gopher Menu</H1>\n");
START(HTML_DL);
while ((ch=HTGetCharacter ()) != (char)EOF)
while ((ch=HTGetCharacter ()) != (char)EOF)
{
if (interrupted_in_htgetcharacter)
{
@@ -184,45 +184,45 @@ PRIVATE int parse_menu ARGS2 (
(*targetClass.handle_interrupt)(target);
return HT_INTERRUPTED;
}
if (ch != LF)
if (ch != LF)
{
*p = ch; /* Put character in line */
if (p< &line[BIG-1]) p++;
}
else
}
else
{
*p++ = 0; /* Terminate line */
p = line; /* Scan it to parse it */
port = 0; /* Flag "not parsed" */
#ifndef DISABLE_TRACE
if (www2Trace)
if (www2Trace)
fprintf(stderr, "HTGopher: Menu item: %s\n", line);
#endif
gtype = *p++;
/* Break on line with a dot by itself */
if ((gtype=='.') && ((*p=='\r') || (*p==0)))
if ((gtype=='.') && ((*p=='\r') || (*p==0)))
break;
if (gtype && *p)
if (gtype && *p)
{
name = p;
selector = strchr(name, TAB);
START(HTML_DD);
if (selector)
if (selector)
{
*selector++ = 0; /* Terminate name */
host = strchr(selector, TAB);
if (host)
if (host)
{
*host++ = 0; /* Terminate selector */
port = strchr(host, TAB);
if (port)
if (port)
{
char *junk;
port[0] = ':'; /* delimit host a la W3 */
junk = strchr(port, TAB);
if (junk)
if (junk)
*junk++ = 0; /* Chop port */
if ((port[1]=='0') && (!port[2]))
port[0] = 0; /* 0 means none */
@@ -230,39 +230,39 @@ PRIVATE int parse_menu ARGS2 (
} /* host ok */
} /* selector ok */
} /* gtype and name ok */
if (gtype == GOPHER_WWW)
if (gtype == GOPHER_WWW)
{ /* Gopher pointer to W3 */
write_anchor(name, selector, "internal-gopher-text");
}
else if (port)
}
else if (port)
{ /* Other types need port */
if (gtype == GOPHER_TELNET)
if (gtype == GOPHER_TELNET)
{
if (*selector)
if (*selector)
sprintf(address, "telnet://%s@%s/",
selector, host);
else
else
sprintf(address, "telnet://%s/", host);
}
else if (gtype == GOPHER_TN3270)
}
else if (gtype == GOPHER_TN3270)
{
if (*selector)
if (*selector)
sprintf(address, "tn3270://%s@%s/",
selector, host);
else
else
sprintf(address, "tn3270://%s/", host);
}
else
else
{ /* If parsed ok */
char *q;
unsigned char *p;
sprintf(address, "//%s/%c", host, gtype);
q = address+ strlen(address);
for(p=(unsigned char *)selector; *p; p++)
for(p=(unsigned char *)selector; *p; p++)
{ /* Encode selector string */
if (acceptable[*p]) *q++ = *p;
else
else
{
*q++ = HEX_ESCAPE; /* Means hex coming */
*q++ = hex[(*p) >> 4];
@@ -325,8 +325,8 @@ PRIVATE int parse_menu ARGS2 (
/* Good error handling??? */
PUTS(line);
}
}
else
}
else
{ /* parse error */
#ifndef DISABLE_TRACE
if (www2Trace) fprintf(stderr,
@@ -346,13 +346,13 @@ PRIVATE int parse_menu ARGS2 (
(*targetClass.handle_interrupt)(target);
return HT_INTERRUPTED;
}
END(HTML_DL);
END_TARGET;
FREE_TARGET;
HTProgress ("Retrieved Gopher menu.");
return 1;
}
@@ -414,7 +414,7 @@ PRIVATE int parse_cso ARGS2 (WWW_CONST char *, arg,
PUTS("<H1>CSO Search Results</H1>\n<PRE>");
/* start grabbing chars from the network */
while ((ch=HTGetCharacter ()) != (char)EOF)
while ((ch=HTGetCharacter ()) != (char)EOF)
{
if (interrupted_in_htgetcharacter)
{
@@ -425,25 +425,25 @@ PRIVATE int parse_cso ARGS2 (WWW_CONST char *, arg,
(*targetClass.handle_interrupt)(target);
return HT_INTERRUPTED;
}
if (ch != '\n')
if (ch != '\n')
{
*p = ch; /* Put character in line */
if (p< &line[BIG-1]) p++;
}
else
}
else
{
*p++ = 0; /* Terminate line */
p = line; /* Scan it to parse it */
/* OK we now have a line in 'p' lets parse it and print it */
/* Break on line that begins with a 2. It's the end of
* data.
*/
if (*p == '2')
break;
/* lines beginning with 5 are errors,
/* lines beginning with 5 are errors,
* print them and quit
*/
if (*p == '5') {
@@ -455,11 +455,11 @@ PRIVATE int parse_cso ARGS2 (WWW_CONST char *, arg,
if(*p == '-') {
/* data lines look like -200:#:
* where # is the search result number and can be multiple
* where # is the search result number and can be multiple
* digits (infinate?)
* find the second colon and check the digit to the
* left of it to see if they are diferent
* if they are then a different person is starting.
* if they are then a different person is starting.
* make this line an <h2>
*/
@@ -504,7 +504,7 @@ PRIVATE int parse_cso ARGS2 (WWW_CONST char *, arg,
} /* end if second_colon */
} /* end if *p == '-' */
} /* if end of line */
} /* Loop over characters */
if (interrupted_in_htgetcharacter)
{
@@ -515,7 +515,7 @@ PRIVATE int parse_cso ARGS2 (WWW_CONST char *, arg,
(*targetClass.handle_interrupt)(target);
return HT_INTERRUPTED;
}
/* end the text block */
PUTS("\n<PRE>");
END_TARGET;
@@ -544,7 +544,7 @@ PRIVATE void de_escape ARGS2(char *, command, WWW_CONST char *, selector)
p = strdup (selector);
HTUnEscape (p);
strcpy (command, p);
free (p);
@@ -576,33 +576,33 @@ PUBLIC int HTLoadGopher ARGS4(
char gtype; /* Gopher Node type */
char * selector; /* Selector string */
int rv = 0;
if (!acceptable_inited) init_acceptable();
if (!arg)
if (!arg)
return -3; /* Bad if no name sepcified */
if (!*arg)
if (!*arg)
return -2; /* Bad if name had zero length */
#ifndef DISABLE_TRACE
if (www2Trace) fprintf(stderr, "HTGopher: Looking for %s\n", arg);
#endif
/* Get entity type, and selector string.
*/
*/
{
char * p1 = HTParse(arg, "", PARSE_PATH|PARSE_PUNCTUATION);
gtype = '1'; /* Default = menu */
selector = p1;
if ((*selector++=='/') && (*selector))
if ((*selector++=='/') && (*selector))
{ /* Skip first slash */
gtype = *selector++; /* Pick up gtype */
}
if (gtype == GOPHER_INDEX)
if (gtype == GOPHER_INDEX)
{
char * query;
query = strchr(selector, '?'); /* Look for search string */
if (!query || !query[1])
if (!query || !query[1])
{ /* No search required */
target = HTML_new(anAnchor, format_out, sink);
targetClass = *target->isa;
@@ -612,17 +612,17 @@ PUBLIC int HTLoadGopher ARGS4(
*query++ = 0; /* Skip '?' */
HTUnEscape (query);
command = malloc(strlen(selector)+ 1 + strlen(query)+ 2 + 1);
de_escape(command, selector);
strcat(command, "\t");
strcat(command, query);
}
else if (gtype == GOPHER_CSO)
}
else if (gtype == GOPHER_CSO)
{
char * query;
query = strchr(selector, '?'); /* Look for search string */
if (!query || !query[1])
if (!query || !query[1])
{ /* No search required */
target = HTML_new(anAnchor, format_out, sink);
targetClass = *target->isa;
@@ -632,20 +632,20 @@ PUBLIC int HTLoadGopher ARGS4(
*query++ = 0; /* Skip '?' */
HTUnEscape (query);
command = malloc(strlen("query")+ 1 + strlen(query)+ 2 + 1);
de_escape(command, selector);
strcpy(command, "query ");
strcat(command, query);
}
else
}
else
{ /* Not index */
command = malloc(strlen(selector)+2+1);
de_escape(command, selector);
}
free(p1);
}
/* Patch security hole. */
{
char *tmp;
@@ -680,24 +680,24 @@ PUBLIC int HTLoadGopher ARGS4(
if (status<0)
{
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf(stderr,
if (www2Trace)
fprintf(stderr,
"HTTPAccess: Unable to connect to remote host for `%s'.\n",
arg);
#endif
free(command);
return HT_NOT_LOADED;
}
HTInitInput(s); /* Set up input buffering */
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf(stderr,
"HTGopher: Connected, writing command `%s' to socket %d\n",
if (www2Trace)
fprintf(stderr,
"HTGopher: Connected, writing command `%s' to socket %d\n",
command, s);
#endif
status = NETWRITE(s, command, (int)strlen(command));
free(command);
if (status<0)
@@ -708,14 +708,14 @@ PUBLIC int HTLoadGopher ARGS4(
NETCLOSE (s);
return HT_NOT_LOADED;
}
/* Now read the data from the socket: */
switch (gtype)
/* Now read the data from the socket: */
switch (gtype)
{
int compressed;
HTAtom *enc;
extern int tweak_gopher_types;
case GOPHER_MENU:
case GOPHER_INDEX:
target = HTML_new(anAnchor, format_out, sink);
@@ -728,7 +728,7 @@ PUBLIC int HTLoadGopher ARGS4(
targetClass = *target->isa;
rv = parse_cso(arg, anAnchor);
break;
case GOPHER_MACBINHEX:
case GOPHER_PCBINHEX:
case GOPHER_UUENCODED:
@@ -744,10 +744,10 @@ PUBLIC int HTLoadGopher ARGS4(
case GOPHER_IMAGE:
case GOPHER_PLUS_IMAGE:
if (!tweak_gopher_types)
rv = HTParseSocket(HTAtom_for ("image/gif"),
rv = HTParseSocket(HTAtom_for ("image/gif"),
format_out, anAnchor, s, sink, 0);
else
rv = HTParseSocket(HTFileFormat (arg, &enc, HTAtom_for ("image/gif"),
rv = HTParseSocket(HTFileFormat (arg, &enc, HTAtom_for ("image/gif"),
&compressed),
format_out, anAnchor, s, sink, 0);
break;
@@ -755,11 +755,11 @@ PUBLIC int HTLoadGopher ARGS4(
case GOPHER_SOUND:
case GOPHER_PLUS_SOUND:
if (!tweak_gopher_types)
rv = HTParseSocket(HTAtom_for ("audio/basic"),
rv = HTParseSocket(HTAtom_for ("audio/basic"),
format_out, anAnchor, s, sink, 0);
else
rv = HTParseSocket(HTFileFormat (arg, &enc,
HTAtom_for ("audio/basic"),
rv = HTParseSocket(HTFileFormat (arg, &enc,
HTAtom_for ("audio/basic"),
&compressed),
format_out, anAnchor, s, sink, 0);
break;
@@ -767,11 +767,11 @@ PUBLIC int HTLoadGopher ARGS4(
case GOPHER_PLUS_MOVIE:
/* Sigh..... */
if (!tweak_gopher_types)
rv = HTParseSocket(HTAtom_for ("video/mpeg"),
rv = HTParseSocket(HTAtom_for ("video/mpeg"),
format_out, anAnchor, s, sink, 0);
else
rv = HTParseSocket(HTFileFormat (arg, &enc,
HTAtom_for ("video/mpeg"),
rv = HTParseSocket(HTFileFormat (arg, &enc,
HTAtom_for ("video/mpeg"),
&compressed),
format_out, anAnchor, s, sink, 0);
break;
@@ -783,7 +783,7 @@ PUBLIC int HTLoadGopher ARGS4(
rv = HTParseSocket(HTFileFormat (arg, &enc, WWW_HTML, &compressed),
format_out, anAnchor, s, sink, 0);
break;
case GOPHER_TEXT:
default: /* @@ parse as plain text */
if (!tweak_gopher_types)
@@ -794,7 +794,7 @@ PUBLIC int HTLoadGopher ARGS4(
format_out, anAnchor, s, sink, 0);
break;
} /* switch(gtype) */
NETCLOSE(s);
if (rv == HT_INTERRUPTED)
{

View File

@@ -71,7 +71,7 @@ typedef struct {
GroupDef * translation;
} Ref;
PRIVATE void syntax_error ARGS3(FILE *, fp,
char *, msg,
@@ -118,7 +118,7 @@ PRIVATE AddressDefList *parse_address_part ARGS1(FILE *, fp)
ref->name = NULL;
ref->translation = NULL;
StrAllocCopy(ref->name, lex_buffer);
HTList_addObject(address_def_list, (void*)ref);
if (only_one || (lex_item = lex(fp)) != LEX_ITEM_SEP)
@@ -172,7 +172,7 @@ PRIVATE UserDefList *parse_user_part ARGS1(FILE *, fp)
StrAllocCopy(ref->name, lex_buffer);
HTList_addObject(user_def_list, (void*)ref);
if (only_one || (lex_item = lex(fp)) != LEX_ITEM_SEP)
break;
/*
@@ -287,9 +287,9 @@ PUBLIC GroupDef *HTAA_parseGroupDef ARGS1(FILE *, fp)
if ((lex_item = lex(fp)) != LEX_REC_SEP) {
syntax_error(fp, "Garbage after group definition", lex_item);
}
return group_def;
}
}
PRIVATE GroupDef *parse_group_decl ARGS1(FILE *, fp)
@@ -323,7 +323,7 @@ PRIVATE GroupDef *parse_group_decl ARGS1(FILE *, fp)
return group_def;
}
/*
@@ -379,10 +379,10 @@ PRIVATE GroupDefList *parse_group_file ARGS1(FILE *, fp)
{
GroupDefList *group_def_list = HTList_new();
GroupDef *group_def;
while (NULL != (group_def = parse_group_decl(fp)))
add_group_def(group_def_list, group_def);
return group_def_list;
}
@@ -451,7 +451,7 @@ PRIVATE void print_group_def_list ARGS1(GroupDefList *, group_list)
{
GroupDefList *cur = group_list;
GroupDef *group_def;
while (NULL != (group_def = (GroupDef*)HTList_nextObject(cur)))
HTAA_printGroupDef(group_def);
}
@@ -524,7 +524,7 @@ PRIVATE BOOL ip_number_match ARGS2(WWW_CONST char *, template,
WWW_CONST char *tcur = template;
WWW_CONST char *icur = inet_addr;
int cnt;
for (cnt=0; cnt<4; cnt++) {
if (!tcur || !icur || !part_match(tcur, icur))
return NO;
@@ -571,7 +571,7 @@ PRIVATE BOOL is_domain_mask ARGS1(WWW_CONST char *, mask)
/* PRIVATE ip_mask_match()
** MATCH AN IP NUMBER MASK OR IP NAME MASK
** AGAINST ACTUAL IP NUMBER OR IP NAME
**
**
** ON ENTRY:
** mask mask. Mask may be either an inet number
** mask or a domain name mask,
@@ -729,7 +729,7 @@ PUBLIC HTAAFailReasonType HTAA_userAndInetInGroup ARGS4(GroupDef *, group,
while (NULL != (item = (Item*)HTList_nextObject(cur1))) {
if (!item->address_def_list || /* Any address allowed */
ip_in_def_list(item->address_def_list, ip_number, ip_name)) {
if (!item->user_def_list) /* Any user allowed */
return HTAA_OK;
else {
@@ -737,7 +737,7 @@ PUBLIC HTAAFailReasonType HTAA_userAndInetInGroup ARGS4(GroupDef *, group,
Ref *ref;
while (NULL != (ref = (Ref*)HTList_nextObject(cur2))) {
if (ref->translation) { /* Group, check recursively */
reason = HTAA_userAndInetInGroup(ref->translation,
username,
@@ -758,7 +758,7 @@ PUBLIC HTAAFailReasonType HTAA_userAndInetInGroup ARGS4(GroupDef *, group,
}
} /* while items in group */
} /* valid parameters */
return reason; /* No match, or invalid parameters */
}

View File

@@ -1,5 +1,5 @@
/* GROUP FILE ROUTINES
*/
#ifndef HTGROUP_H
@@ -46,63 +46,63 @@ Group definition grammar
string
"sequence of alphanumeric characters"
user_name
string
group_name
string
group_ref
group_name
user_def
user_name | group_ref
user_def_list
user_def { ',' user_def }
user_part
user_def | '(' user_def_list ')'
templ
"sequence of alphanumeric characters and '*'s"
ip_number_mask
templ '.' templ '.' templ '.' templ
domain_name_mask
templ { '.' templ }
address
ip_number_mask | domain_name_mask
address_def
address
address_def_list
address_def { ',' address_def }
address_part
address_def | '(' address_def_list ')'
item
[user_part] ['@' address_part]
item_list
item { ',' item }
group_def
item_list
group_decl
group_name ':' group_def
PARSE GROUP DEFINITION
*/
PUBLIC GroupDef *HTAA_parseGroupDef PARAMS((FILE * fp));
@@ -112,7 +112,7 @@ Fill in Pointers to referenced Group Definitions in a Group Definition
References to groups (by their name) are resolved from group_def_list and pointers to
those structures are added to group_def.
*/
PUBLIC void HTAA_resolveGroupReferences PARAMS((GroupDef * group_def,
@@ -123,7 +123,7 @@ Read Group File (and do caching)
If group file is already in cache returns a pointer to previously read group definition
list.
*/
PUBLIC GroupDefList *HTAA_readGroupFile PARAMS((WWW_CONST char * filename));
@@ -133,7 +133,7 @@ Delete Group Definition
Groups in cache should never be freed by this function. This should only be used to
free group definitions read by HTAA_parseGroupDef.
*/
PUBLIC void GroupDef_delete PARAMS((GroupDef * group_def));
@@ -149,7 +149,7 @@ PUBLIC void HTAA_printGroupDef PARAMS((GroupDef * group_def));
Does a User Belong to a Given Set of Groups
This function checks both the username and the internet address.
*/
/* PUBLIC HTAA_userAndInetInGroup()

View File

@@ -7,7 +7,7 @@
** the format or from the default, then the unknown icon is returned.
**
** Note: This routine gurantee's to return something!
**
**
*/
#include "../config.h"
#include "HTFile.h"
@@ -37,34 +37,34 @@ char *HTgeticonname(HTFormat format, char *defaultformat)
int count;
char *ptr;
char subtype[128];
if(format != NULL)
{
strcpy(subtype, format->name);
ptr=strchr(subtype,'/');
if(ptr != NULL)
if(ptr != NULL)
*ptr = '\0';
}
else
{
subtype[0] = '\0';
}
ptr = NULL;
for(count = 0;strcmp(type_map[count].image,"EOFEOF") != 0; count++)
{
if(strcmp(type_map[count].format, subtype) == 0)
return type_map[count].image;
if(strcmp(type_map[count].format, defaultformat) == 0)
ptr = type_map[count].image;
}
if(ptr != NULL)
if(ptr != NULL)
return ptr;
return "internal-gopher-unknown";
}

View File

@@ -68,17 +68,17 @@ PUBLIC void HTFormatInit NOARGS
can be overridden by users. */
if (have_hdf)
{
HTSetPresentation("application/x-hdf", "mosaic-internal-reference",
HTSetPresentation("application/x-hdf", "mosaic-internal-reference",
1.0, 3.0, 0.0);
HTSetPresentation("application/x-netcdf", "mosaic-internal-reference",
HTSetPresentation("application/x-netcdf", "mosaic-internal-reference",
1.0, 3.0, 0.0);
/* Jumping the gun, but still... */
HTSetPresentation("application/hdf", "mosaic-internal-reference",
HTSetPresentation("application/hdf", "mosaic-internal-reference",
1.0, 3.0, 0.0);
HTSetPresentation("application/netcdf", "mosaic-internal-reference",
HTSetPresentation("application/netcdf", "mosaic-internal-reference",
1.0, 3.0, 0.0);
}
if (use_default_type_map)
{
#if defined(__sgi)
@@ -121,7 +121,7 @@ PUBLIC void HTFormatInit NOARGS
HTSetPresentation("application/postscript", "ghostview %s", 1.0, 3.0, 0.0);
HTSetPresentation("application/x-dvi", "xdvi %s", 1.0, 3.0, 0.0);
HTSetPresentation("message/rfc822",
HTSetPresentation("message/rfc822",
"xterm -e metamail %s", 1.0, 3.0, 0.0);
HTSetPresentation("application/x-latex", "mosaic-internal-present", 1.0, 3.0, 0.0);
@@ -149,19 +149,19 @@ PUBLIC void HTFormatInit NOARGS
/*
Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
Permission to use, copy, modify, and distribute this material
for any purpose and without fee is hereby granted, provided
that the above copyright notice and this permission notice
appear in all copies, and that the name of Bellcore not be
used in advertising or publicity pertaining to this
material without the specific, prior written permission
of an authorized representative of Bellcore. BELLCORE
MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
OF THIS MATERIAL FOR ANY PURPOSE. IT IS PROVIDED "AS IS",
Permission to use, copy, modify, and distribute this material
for any purpose and without fee is hereby granted, provided
that the above copyright notice and this permission notice
appear in all copies, and that the name of Bellcore not be
used in advertising or publicity pertaining to this
material without the specific, prior written permission
of an authorized representative of Bellcore. BELLCORE
MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
OF THIS MATERIAL FOR ANY PURPOSE. IT IS PROVIDED "AS IS",
WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
*/
/******************************************************
Metamail -- A tool to help diverse mail readers
/******************************************************
Metamail -- A tool to help diverse mail readers
cope with diverse multimedia mail formats.
Author: Nathaniel S. Borenstein, Bellcore
@@ -204,12 +204,12 @@ static char *GetCommand(char *s, char **t)
}
*s2 = 0;
return(NULL);
}
}
static char *Cleanse(char *s) /* no leading or trailing space, all lower case */
{
char *tmp, *news;
/* strip leading white space */
while (*s && isspace((unsigned char) *s)) ++s;
news = s;
@@ -374,20 +374,20 @@ PUBLIC void HTFileInit NOARGS
HTSetSuffix(".eps", "application/postscript", "binary", 1.0);
HTSetSuffix(".ai", "application/postscript", "binary", 1.0);
HTSetSuffix(".ps", "application/postscript", "binary", 1.0);
HTSetSuffix(".rtf", "application/rtf", "binary", 1.0);
HTSetSuffix(".dvi","application/x-dvi", "binary", 1.0);
HTSetSuffix(".hdf","application/x-hdf", "binary", 1.0);
HTSetSuffix(".latex", "application/x-latex", "binary", 1.0);
HTSetSuffix(".cdf","application/x-netcdf", "binary", 1.0);
HTSetSuffix(".nc","application/x-netcdf", "binary", 1.0);
HTSetSuffix(".tex", "application/x-tex", "binary", 1.0);
HTSetSuffix(".texinfo", "application/x-texinfo", "binary", 1.0);
HTSetSuffix(".texi", "application/x-texinfo", "binary", 1.0);
@@ -419,7 +419,7 @@ PUBLIC void HTFileInit NOARGS
HTSetSuffix(".aif", "audio/x-aiff", "binary", 1.0);
HTSetSuffix(".aiff", "audio/x-aiff", "binary", 1.0);
HTSetSuffix(".wav", "audio/x-wav", "binary", 1.0);
HTSetSuffix(".gif", "image/gif", "binary", 1.0);
HTSetSuffix(".png", "image/png", "binary", 1.0);
@@ -431,10 +431,10 @@ PUBLIC void HTFileInit NOARGS
HTSetSuffix(".jpe", "image/jpeg", "binary", 1.0);
HTSetSuffix(".jpg", "image/jpeg", "binary", 1.0);
HTSetSuffix(".jpeg","image/jpeg", "binary", 1.0);
HTSetSuffix(".tif", "image/tiff", "binary", 1.0);
HTSetSuffix(".tiff","image/tiff", "binary", 1.0);
HTSetSuffix(".ras", "image/x-cmu-rast", "binary", 1.0);
HTSetSuffix(".pnm", "image/x-portable-anymap", "binary", 1.0);
HTSetSuffix(".pbm", "image/x-portable-bitmap", "binary", 1.0);
@@ -455,7 +455,7 @@ PUBLIC void HTFileInit NOARGS
HTSetSuffix(".h", "text/plain", "binary", 1.0);
HTSetSuffix(".pl", "text/plain", "binary", 1.0);
HTSetSuffix(".txt", "text/plain", "binary", 1.0);
HTSetSuffix(".rtx", "text/richtext", "binary", 1.0); /* MIME richtext */
HTSetSuffix(".tsv", "text/tab-separated-values", "binary", 1.0);
HTSetSuffix(".etx", "text/x-setext", "binary", 1.0);
@@ -477,7 +477,7 @@ PUBLIC void HTFileInit NOARGS
/* These should override the default extensions as necessary. */
HTLoadExtensionsConfigFile (global_extension_map);
/* These should override everything else. */
HTLoadExtensionsConfigFile (personal_extension_map);
}
@@ -513,7 +513,7 @@ PUBLIC void HTFileInit NOARGS
/**//* NOTREACHED */
/*}*/
static void getword(char *word, char *line, char stop, char stop2)
static void getword(char *word, char *line, char stop, char stop2)
{
int x = 0, y;
@@ -521,9 +521,9 @@ static void getword(char *word, char *line, char stop, char stop2)
{
word[x] = line[x];
}
word[x] = '\0';
if (line[x])
if (line[x])
++x;
y=0;
@@ -545,8 +545,8 @@ int HTLoadExtensionsConfigFile (char *fn)
fprintf (stderr, "Loading extensions config file '%s'\n",
fn);
#endif
if(!(f = fopen(fn,"r")))
if(!(f = fopen(fn,"r")))
{
#ifndef DISABLE_TRACE
if (www2Trace)
@@ -556,7 +556,7 @@ int HTLoadExtensionsConfigFile (char *fn)
return -1;
}
while(!(getline((char**)&l,&len,f)))
while(!(getline((char**)&l,&len,f)))
{
/* always get rid of leading white space for "line" -- SWP */
for (ptr=l; *ptr && isspace(*ptr); ptr++);
@@ -566,11 +566,11 @@ int HTLoadExtensionsConfigFile (char *fn)
continue;
ct = (char *)malloc(sizeof(char) * (strlen(w) + 1));
strcpy(ct,w);
while(ptr[0])
while(ptr[0])
{
getword(w,ptr,' ','\t');
if(w[0] && (w[0] != ' '))
if(w[0] && (w[0] != ' '))
{
char *ext = (char *)malloc(sizeof(char) * (strlen(w)+1+1));
@@ -586,13 +586,13 @@ int HTLoadExtensionsConfigFile (char *fn)
HTSetSuffix (ext, ct, "binary", 1.0);
count++;
free (ext);
}
}
free(ct);
}
fclose(f);
return count;

View File

@@ -1,5 +1,5 @@
/* LEXICAL ANALYSOR (MAINLY FOR CONFIG FILES)
*/
#ifndef HTLEX_H
@@ -34,7 +34,7 @@ extern int lex_line; /* Line number in source file */
Get Next Lexical Item
If returns LEX_ALPH_STR or LEX_TMPL_STR the string is in global buffer lex_buffer.
*/
PUBLIC LexItem lex PARAMS((FILE * fp));

View File

@@ -51,13 +51,13 @@ void HTList_addObject ARGS2(HTList *,me, void *,newObject)
void HTList_addObjectAtEnd ARGS2(HTList *,me, void *,newObject)
{
if (me)
if (me)
{
HTList *newNode = (HTList *)malloc (sizeof (HTList));
if (newNode == NULL) outofmem(__FILE__, "HTList_addObject");
newNode->object = newObject;
newNode->next = NULL;
while (me->next)
while (me->next)
me = me->next;
me->next = newNode;
}

View File

@@ -43,7 +43,7 @@ char *HTTP_expires;
/* MIME Object
** -----------
*/
typedef enum _MIME_state
typedef enum _MIME_state
{
BEGINNING_OF_LINE,
CONTENT_,
@@ -73,24 +73,24 @@ typedef enum _MIME_state
} MIME_state;
#define VALUE_SIZE 8192 /* @@@@@@@ Arbitrary? */
struct _HTStream
struct _HTStream
{
WWW_CONST HTStreamClass * isa;
MIME_state state; /* current state */
MIME_state if_ok; /* got this state if match */
MIME_state field; /* remember which field */
MIME_state fold_state; /* state on a fold */
WWW_CONST char * check_pointer; /* checking input */
char * value_pointer; /* storing values */
char value[VALUE_SIZE];
HTParentAnchor * anchor; /* Given on creation */
HTStream * sink; /* Given on creation */
char * boundary; /* For multipart */
HTFormat encoding; /* Content-Transfer-Encoding */
char * compression_encoding;
int content_length;
@@ -98,9 +98,9 @@ struct _HTStream
HTFormat format; /* Content-Type */
HTStream * target; /* While writing out */
HTStreamClass targetClass;
HTAtom * targetRep; /* Converting into? */
char * location;
char * expires;
char * last_modified;
@@ -138,7 +138,7 @@ PRIVATE void HTMIME_put_character ARGS2(HTStream *, me, char, c)
me->header_length ++; /* bjs - update this first */
}
switch(me->state)
switch(me->state)
{
case MIME_IGNORE:
#ifndef DISABLE_TRACE
@@ -146,20 +146,20 @@ PRIVATE void HTMIME_put_character ARGS2(HTStream *, me, char, c)
fprintf (stderr, "[HTMIME_put_character] Got MIME_IGNORE; returning...\n");
#endif
return;
/* case MIME_TRANSPARENT:*/
case NEWLINE:
if (c != '\n' && WHITE(c))
if (c != '\n' && WHITE(c))
{
/* Folded line */
me->state = me->fold_state; /* pop state before newline */
break;
}
/* else Falls through */
case BEGINNING_OF_LINE:
switch(c)
switch(c)
{
case 'c':
case 'C':
@@ -168,7 +168,7 @@ PRIVATE void HTMIME_put_character ARGS2(HTStream *, me, char, c)
me->state = CHECK;
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf (stderr,
fprintf (stderr,
"[MIME] Got C at beginning of line; checking for 'ontent-'\n");
#endif
break;
@@ -180,7 +180,7 @@ PRIVATE void HTMIME_put_character ARGS2(HTStream *, me, char, c)
me->state = E;
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf (stderr,
fprintf (stderr,
"[MIME] Got E at beginning of line; checking for 'X'\n");
#endif
}
@@ -214,7 +214,7 @@ PRIVATE void HTMIME_put_character ARGS2(HTStream *, me, char, c)
{
int compressed = COMPRESSED_NOT;
#ifndef DISABLE_TRACE
if (www2Trace)
if (www2Trace)
fprintf (stderr,
"HTMIME: DOING STREAMSTACK: MIME content type is %s, converting to %s\n",
HTAtom_name(me->format), HTAtom_name(me->targetRep));
@@ -251,10 +251,10 @@ PRIVATE void HTMIME_put_character ARGS2(HTStream *, me, char, c)
#endif
me->target = HTStreamStack(me->format, me->targetRep, compressed,
me->sink, me->anchor);
if (!me->target)
if (!me->target)
{
#ifndef DISABLE_TRACE
if (www2Trace)
if (www2Trace)
{
fprintf(stderr, "MIME: Can't translate! ** \n");
fprintf(stderr, "HTMIME: Defaulting to HTML.\n");
@@ -267,7 +267,7 @@ PRIVATE void HTMIME_put_character ARGS2(HTStream *, me, char, c)
me->sink,
me->anchor);
}
if (me->target)
if (me->target)
{
me->targetClass = *me->target->isa;
/* Check for encoding and select state from there @@ */
@@ -276,17 +276,17 @@ PRIVATE void HTMIME_put_character ARGS2(HTStream *, me, char, c)
if (www2Trace)
fprintf (stderr, "[MIME] Entering MIME_TRANSPARENT\n");
#endif
me->state = MIME_TRANSPARENT;
me->state = MIME_TRANSPARENT;
/* bjs note: header is now completely read */
}
else
}
else
{
/* This is HIGHLY EVIL -- the browser WILL BREAK
if it ever reaches here. Thus the default to
HTML above, which should always happen... */
#ifndef DISABLE_TRACE
if (www2Trace)
if (www2Trace)
fprintf (stderr, "MIME: HIT HIGHLY EVIL!!! ***\n");
#endif
me->state = MIME_IGNORE; /* What else to do? */
@@ -301,20 +301,20 @@ PRIVATE void HTMIME_put_character ARGS2(HTStream *, me, char, c)
#endif
goto bad_field_name;
break;
} /* switch on character */
break;
case CHECK: /* Check against string */
if (TOLOWER(c) == *(me->check_pointer)++)
if (TOLOWER(c) == *(me->check_pointer)++)
{
if (!*me->check_pointer)
if (!*me->check_pointer)
me->state = me->if_ok;
}
else
}
else
{ /* Error */
#ifndef DISABLE_TRACE
if (www2Trace)
if (www2Trace)
fprintf(stderr,
"HTMIME: Bad character `%c' found where `%s' expected\n",
c, me->check_pointer - 1);
@@ -326,21 +326,21 @@ PRIVATE void HTMIME_put_character ARGS2(HTStream *, me, char, c)
case CONTENT_:
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf (stderr,
fprintf (stderr,
"[MIME] in case CONTENT_\n");
#endif
switch(c)
switch(c)
{
case 't':
case 'T':
me->state = CONTENT_T;
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf (stderr,
fprintf (stderr,
"[MIME] Was CONTENT_, found T, state now CONTENT_T\n");
#endif
break;
case 'e':
case 'E':
me->check_pointer = "ncoding:";
@@ -348,11 +348,11 @@ PRIVATE void HTMIME_put_character ARGS2(HTStream *, me, char, c)
me->state = CHECK;
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf (stderr,
fprintf (stderr,
"[MIME] Was CONTENT_, found E, checking for 'ncoding:'\n");
#endif
break;
case 'l':
case 'L':
me->check_pointer = "ength:";
@@ -360,29 +360,29 @@ PRIVATE void HTMIME_put_character ARGS2(HTStream *, me, char, c)
me->state = CHECK;
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf (stderr,
fprintf (stderr,
"[MIME] Was CONTENT_, found L, checking for 'ength:'\n");
#endif
break;
default:
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf (stderr,
fprintf (stderr,
"[MIME] Was CONTENT_, found nothing; bleah\n");
#endif
goto bad_field_name;
} /* switch on character */
break;
case CONTENT_T:
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf (stderr,
fprintf (stderr,
"[MIME] in case CONTENT_T\n");
#endif
switch(c)
switch(c)
{
case 'r':
case 'R':
@@ -391,11 +391,11 @@ PRIVATE void HTMIME_put_character ARGS2(HTStream *, me, char, c)
me->state = CHECK;
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf (stderr,
fprintf (stderr,
"[MIME] Was CONTENT_T; going to check for ansfer-encoding:\n");
#endif
break;
case 'y':
case 'Y':
me->check_pointer = "pe:";
@@ -406,7 +406,7 @@ PRIVATE void HTMIME_put_character ARGS2(HTStream *, me, char, c)
fprintf (stderr, "[MIME] Was CONTENT_T; going to check for pe:\n");
#endif
break;
default:
#ifndef DISABLE_TRACE
if (www2Trace)
@@ -544,25 +544,25 @@ PRIVATE void HTMIME_put_character ARGS2(HTStream *, me, char, c)
me->state = SKIP_GET_VALUE;
/* Fall through! (no break!) */
case SKIP_GET_VALUE:
if (c == '\n')
if (c == '\n')
{
me->fold_state = me->state;
me->state = NEWLINE;
break;
}
if (WHITE(c))
if (WHITE(c))
break; /* Skip white space */
me->value_pointer = me->value;
me->state = GET_VALUE;
me->state = GET_VALUE;
/* Fall through to store first character */
case GET_VALUE:
if (WHITE(c))
if (WHITE(c))
{
/* End of field */
*me->value_pointer = 0;
switch (me->field)
switch (me->field)
{
case CONTENT_TYPE:
#ifndef DISABLE_TRACE
@@ -593,7 +593,7 @@ PRIVATE void HTMIME_put_character ARGS2(HTStream *, me, char, c)
me->encoding = HTAtom_for(me->value);
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf (stderr,
fprintf (stderr,
"[MIME_put_char] Picked up transfer_encoding '%s'\n",
(char*)me->encoding);
#endif
@@ -602,8 +602,8 @@ PRIVATE void HTMIME_put_character ARGS2(HTStream *, me, char, c)
me->compression_encoding = strdup (me->value);
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf (stderr,
"[MIME_put_char] Picked up compression encoding '%s'\n",
fprintf (stderr,
"[MIME_put_char] Picked up compression encoding '%s'\n",
me->compression_encoding);
#endif
break;
@@ -614,8 +614,8 @@ PRIVATE void HTMIME_put_character ARGS2(HTStream *, me, char, c)
noLength=0;
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf (stderr,
"[MIME_put_char] Picked up content length '%d'\n",
fprintf (stderr,
"[MIME_put_char] Picked up content length '%d'\n",
me->content_length);
#endif
break;
@@ -755,7 +755,7 @@ PRIVATE void HTMIME_put_character ARGS2(HTStream *, me, char, c)
}
else
{
if (me->value_pointer < me->value + VALUE_SIZE - 1)
if (me->value_pointer < me->value + VALUE_SIZE - 1)
{
*me->value_pointer++ = c;
break;
@@ -766,25 +766,25 @@ PRIVATE void HTMIME_put_character ARGS2(HTStream *, me, char, c)
}
}
/* Fall through */
case JUNK_LINE:
if (c == '\n')
if (c == '\n')
{
me->state = NEWLINE;
me->fold_state = me->state;
}
break;
} /* switch on state*/
return;
value_too_long:
#ifndef DISABLE_TRACE
if (www2Trace) fprintf(stderr,
"HTMIME: *** Syntax error. (string too long)\n");
#endif
bad_field_name: /* Ignore it */
me->state = JUNK_LINE;
return;
@@ -818,7 +818,7 @@ PRIVATE void HTMIME_put_string ARGS2(HTStream *, me, WWW_CONST char*, s)
if (www2Trace)
fprintf (stderr, "[HTMIME_put_string] Doing char-by-char put_character\n");
#endif
for (p=s; *p; p++)
for (p=s; *p; p++)
HTMIME_put_character(me, *p);
}
else
@@ -857,7 +857,7 @@ PRIVATE void HTMIME_write ARGS3(HTStream *, me, WWW_CONST char*, s, int, l)
fprintf (stderr, "[HTMIME_write] Doing char-by-char put_character\n");
#endif
for (p=s; p < s+l; p++)
for (p=s; p < s+l; p++)
HTMIME_put_character(me, *p);
}
else
@@ -903,10 +903,10 @@ PRIVATE void HTMIME_free ARGS1(HTStream *, me)
me->targetClass = *me->target->isa;
(*me->targetClass.put_string) (me->target, "<H1>ERROR IN HTTP/1.0 RESPONSE</H1> The remote server returned a HTTP/1.0 response that Mosaic's MIME parser could not understand. Please contact the server maintainer.<P> Sorry for the inconvenience,<P> <ADDRESS>The Management</ADDRESS>");
securityType=HTAA_UNKNOWN;
}
if (me->target)
}
if (me->target)
(*me->targetClass.free)(me->target);
if (me->expires)
{
char *p;
@@ -947,7 +947,7 @@ PRIVATE void HTMIME_free ARGS1(HTStream *, me)
PRIVATE void HTMIME_end_document ARGS1(HTStream *, me)
{
if (me->target)
if (me->target)
(*me->targetClass.end_document)(me->target);
}
@@ -968,14 +968,14 @@ PRIVATE void HTMIME_handle_interrupt ARGS1(HTStream *, me)
** -----------------------
*/
PUBLIC WWW_CONST HTStreamClass HTMIME =
{
{
"MIMEParser",
HTMIME_free,
HTMIME_end_document,
HTMIME_put_character, HTMIME_put_string,
HTMIME_write,
HTMIME_handle_interrupt
};
};
/* Subclass-specific Methods
@@ -990,9 +990,9 @@ PUBLIC HTStream* HTMIMEConvert ARGS5(
int, compressed)
{
HTStream* me;
me = malloc(sizeof(*me));
me->isa = &HTMIME;
me->isa = &HTMIME;
#ifndef DISABLE_TRACE
if (www2Trace)
@@ -1021,6 +1021,6 @@ PUBLIC HTStream* HTMIMEConvert ARGS5(
/* bjs - a kludge for HTFormat.c */
int HTMIME_get_header_length(HTStream *me)
{
if(me->isa != &HTMIME) return 0; /* in case we screw up */
if(me->isa != &HTMIME) return 0; /* in case we screw up */
return me->header_length;
}

View File

@@ -47,71 +47,71 @@ struct _HTStream {
** This MUST match exactly the table referred to in the DTD!
*/
static char * ISO_Latin1[] = {
"\306", /* capital AE diphthong (ligature) */
"\301", /* capital A, acute accent */
"\302", /* capital A, circumflex accent */
"\300", /* capital A, grave accent */
"\305", /* capital A, ring */
"\303", /* capital A, tilde */
"\304", /* capital A, dieresis or umlaut mark */
"\307", /* capital C, cedilla */
"\320", /* capital Eth, Icelandic */
"\311", /* capital E, acute accent */
"\312", /* capital E, circumflex accent */
"\310", /* capital E, grave accent */
"\313", /* capital E, dieresis or umlaut mark */
"\315", /* capital I, acute accent */
"\316", /* capital I, circumflex accent */
"\314", /* capital I, grave accent */
"\317", /* capital I, dieresis or umlaut mark */
"\321", /* capital N, tilde */
"\323", /* capital O, acute accent */
"\324", /* capital O, circumflex accent */
"\322", /* capital O, grave accent */
"\330", /* capital O, slash */
"\325", /* capital O, tilde */
"\326", /* capital O, dieresis or umlaut mark */
"\336", /* capital THORN, Icelandic */
"\332", /* capital U, acute accent */
"\333", /* capital U, circumflex accent */
"\331", /* capital U, grave accent */
"\334", /* capital U, dieresis or umlaut mark */
"\335", /* capital Y, acute accent */
"\341", /* small a, acute accent */
"\342", /* small a, circumflex accent */
"\346", /* small ae diphthong (ligature) */
"\340", /* small a, grave accent */
"\046", /* ampersand */
"\345", /* small a, ring */
"\343", /* small a, tilde */
"\344", /* small a, dieresis or umlaut mark */
"\347", /* small c, cedilla */
"\351", /* small e, acute accent */
"\352", /* small e, circumflex accent */
"\350", /* small e, grave accent */
"\360", /* small eth, Icelandic */
"\353", /* small e, dieresis or umlaut mark */
"\076", /* greater than */
"\355", /* small i, acute accent */
"\356", /* small i, circumflex accent */
"\354", /* small i, grave accent */
"\357", /* small i, dieresis or umlaut mark */
"\074", /* less than */
"\361", /* small n, tilde */
"\363", /* small o, acute accent */
"\364", /* small o, circumflex accent */
"\362", /* small o, grave accent */
"\370", /* small o, slash */
"\365", /* small o, tilde */
"\366", /* small o, dieresis or umlaut mark */
"\337", /* small sharp s, German (sz ligature) */
"\376", /* small thorn, Icelandic */
"\372", /* small u, acute accent */
"\373", /* small u, circumflex accent */
"\371", /* small u, grave accent */
"\374", /* small u, dieresis or umlaut mark */
"\375", /* small y, acute accent */
"\377", /* small y, dieresis or umlaut mark */
"\306", /* capital AE diphthong (ligature) */
"\301", /* capital A, acute accent */
"\302", /* capital A, circumflex accent */
"\300", /* capital A, grave accent */
"\305", /* capital A, ring */
"\303", /* capital A, tilde */
"\304", /* capital A, dieresis or umlaut mark */
"\307", /* capital C, cedilla */
"\320", /* capital Eth, Icelandic */
"\311", /* capital E, acute accent */
"\312", /* capital E, circumflex accent */
"\310", /* capital E, grave accent */
"\313", /* capital E, dieresis or umlaut mark */
"\315", /* capital I, acute accent */
"\316", /* capital I, circumflex accent */
"\314", /* capital I, grave accent */
"\317", /* capital I, dieresis or umlaut mark */
"\321", /* capital N, tilde */
"\323", /* capital O, acute accent */
"\324", /* capital O, circumflex accent */
"\322", /* capital O, grave accent */
"\330", /* capital O, slash */
"\325", /* capital O, tilde */
"\326", /* capital O, dieresis or umlaut mark */
"\336", /* capital THORN, Icelandic */
"\332", /* capital U, acute accent */
"\333", /* capital U, circumflex accent */
"\331", /* capital U, grave accent */
"\334", /* capital U, dieresis or umlaut mark */
"\335", /* capital Y, acute accent */
"\341", /* small a, acute accent */
"\342", /* small a, circumflex accent */
"\346", /* small ae diphthong (ligature) */
"\340", /* small a, grave accent */
"\046", /* ampersand */
"\345", /* small a, ring */
"\343", /* small a, tilde */
"\344", /* small a, dieresis or umlaut mark */
"\347", /* small c, cedilla */
"\351", /* small e, acute accent */
"\352", /* small e, circumflex accent */
"\350", /* small e, grave accent */
"\360", /* small eth, Icelandic */
"\353", /* small e, dieresis or umlaut mark */
"\076", /* greater than */
"\355", /* small i, acute accent */
"\356", /* small i, circumflex accent */
"\354", /* small i, grave accent */
"\357", /* small i, dieresis or umlaut mark */
"\074", /* less than */
"\361", /* small n, tilde */
"\363", /* small o, acute accent */
"\364", /* small o, circumflex accent */
"\362", /* small o, grave accent */
"\370", /* small o, slash */
"\365", /* small o, tilde */
"\366", /* small o, dieresis or umlaut mark */
"\337", /* small sharp s, German (sz ligature) */
"\376", /* small thorn, Icelandic */
"\372", /* small u, acute accent */
"\373", /* small u, circumflex accent */
"\371", /* small u, grave accent */
"\374", /* small u, dieresis or umlaut mark */
"\375", /* small y, acute accent */
"\377", /* small y, dieresis or umlaut mark */
};
@@ -138,7 +138,7 @@ PUBLIC void HTMLUseCharacterSet ARGS1(HTMLCharacterSet, i)
*/
PRIVATE void HTML_put_character ARGS2(HTStructured *, me, char, c)
{
if (!me->text)
if (!me->text)
{
me->text = HText_new();
HText_beginAppend(me->text);
@@ -156,7 +156,7 @@ PRIVATE void HTML_put_character ARGS2(HTStructured *, me, char, c)
*/
PRIVATE void HTML_put_string ARGS2(HTStructured *, me, WWW_CONST char*, s)
{
if (!me->text)
if (!me->text)
{
me->text = HText_new();
HText_beginAppend(me->text);
@@ -185,17 +185,17 @@ PRIVATE void HTML_start_element ARGS4(
WWW_CONST BOOL*, present,
WWW_CONST char **, value)
{
if (!me->text)
if (!me->text)
{
me->text = HText_new();
HText_beginAppend(me->text);
}
switch (element_number)
switch (element_number)
{
case HTML_A:
{
char *href = NULL;
if (present[HTML_A_HREF])
if (present[HTML_A_HREF])
{
StrAllocCopy(href, value[HTML_A_HREF]);
HTSimplify(href);
@@ -204,7 +204,7 @@ PRIVATE void HTML_start_element ARGS4(
free (href);
}
break;
case HTML_TITLE:
HText_appendText(me->text, "<TITLE>");
break;
@@ -253,7 +253,7 @@ PRIVATE void HTML_start_element ARGS4(
case HTML_IMG:
{
char *href = NULL;
if (present[HTML_A_HREF])
if (present[HTML_A_HREF])
{
StrAllocCopy(href, value[HTML_A_HREF]);
HTSimplify(href);
@@ -291,7 +291,7 @@ PRIVATE void HTML_start_element ARGS4(
case HTML_BLOCKQUOTE:
HText_appendText(me->text, "<BLOCKQUOTE>");
break;
case HTML_TT: /* Physical character highlighting */
case HTML_B: /* Currently ignored */
case HTML_I:
@@ -308,7 +308,7 @@ PRIVATE void HTML_start_element ARGS4(
default:
break;
} /* end switch */
}
@@ -319,7 +319,7 @@ PRIVATE void HTML_start_element ARGS4(
*/
PRIVATE void HTML_end_element ARGS2(HTStructured *, me, int , element_number)
{
switch(element_number)
switch(element_number)
{
case HTML_A:
HText_endAnchor(me->text);
@@ -403,14 +403,14 @@ PRIVATE void HTML_put_entity ARGS2(HTStructured *, me, int, entity_number)
of document, so we don't.
**
** If non-interactive, everything is freed off. No: crashes -listrefs
** Otherwise, the interactive object is left.
** Otherwise, the interactive object is left.
*/
PUBLIC void HTML_free ARGS1(HTStructured *, me)
{
if (me->text)
HText_endAppend(me->text);
if (me->target)
if (me->target)
{
(*me->targetClass.end_document)(me->target);
(*me->targetClass.free)(me->target);
@@ -423,8 +423,8 @@ PUBLIC void HTML_handle_interrupt ARGS1(HTStructured *, me)
{
if (me->text)
HText_doAbort (me->text);
if (me->target)
if (me->target)
{
(*me->targetClass.handle_interrupt)(me->target);
}
@@ -442,14 +442,14 @@ PRIVATE void HTML_end_document ARGS1(HTStructured *, me)
** -----------------------
*/
PUBLIC WWW_CONST HTStructuredClass HTMLPresentation = /* As opposed to print etc */
{
{
"text/html",
HTML_free,
HTML_end_document, HTML_handle_interrupt,
HTML_put_character, HTML_put_string, HTML_write,
HTML_start_element, HTML_end_element,
HTML_put_entity
};
};
/* New Structured Text object
@@ -465,7 +465,7 @@ PUBLIC HTStructured* HTML_new ARGS3(
{
HTStructured * me;
#if 0
if (format_out != WWW_PLAINTEXT && format_out != WWW_PRESENT) {
HTStream * intermediate = HTStreamStack(WWW_HTML, format_out, 0,
@@ -485,9 +485,9 @@ PUBLIC HTStructured* HTML_new ARGS3(
me->node_anchor = anchor;
me->text = 0;
me->target = stream;
if (stream)
if (stream)
me->targetClass = *stream->isa; /* Copy pointers */
return (HTStructured*) me;
}
@@ -521,5 +521,5 @@ PUBLIC int HTLoadError ARGS3(
return -number;
#endif
return -1;
}
}

View File

@@ -33,7 +33,7 @@ Record error message as a hypertext object
The error message should be marked as an error so that it can be
reloaded later. This implementation just throws up an error message
and leaves the document unloaded.
*/
/* On entry,
** sink is a stream to the output device if any

View File

@@ -13,71 +13,71 @@
** This table must be matched exactly with ALL the translation tables
*/
static WWW_CONST char* entities[] = {
"AElig", /* capital AE diphthong (ligature) */
"Aacute", /* capital A, acute accent */
"Acirc", /* capital A, circumflex accent */
"Agrave", /* capital A, grave accent */
"Aring", /* capital A, ring */
"Atilde", /* capital A, tilde */
"Auml", /* capital A, dieresis or umlaut mark */
"Ccedil", /* capital C, cedilla */
"ETH", /* capital Eth, Icelandic */
"Eacute", /* capital E, acute accent */
"Ecirc", /* capital E, circumflex accent */
"Egrave", /* capital E, grave accent */
"Euml", /* capital E, dieresis or umlaut mark */
"Iacute", /* capital I, acute accent */
"Icirc", /* capital I, circumflex accent */
"Igrave", /* capital I, grave accent */
"Iuml", /* capital I, dieresis or umlaut mark */
"Ntilde", /* capital N, tilde */
"Oacute", /* capital O, acute accent */
"Ocirc", /* capital O, circumflex accent */
"Ograve", /* capital O, grave accent */
"Oslash", /* capital O, slash */
"Otilde", /* capital O, tilde */
"Ouml", /* capital O, dieresis or umlaut mark */
"THORN", /* capital THORN, Icelandic */
"Uacute", /* capital U, acute accent */
"Ucirc", /* capital U, circumflex accent */
"Ugrave", /* capital U, grave accent */
"Uuml", /* capital U, dieresis or umlaut mark */
"Yacute", /* capital Y, acute accent */
"aacute", /* small a, acute accent */
"acirc", /* small a, circumflex accent */
"aelig", /* small ae diphthong (ligature) */
"agrave", /* small a, grave accent */
"amp", /* ampersand */
"aring", /* small a, ring */
"atilde", /* small a, tilde */
"auml", /* small a, dieresis or umlaut mark */
"ccedil", /* small c, cedilla */
"eacute", /* small e, acute accent */
"ecirc", /* small e, circumflex accent */
"egrave", /* small e, grave accent */
"eth", /* small eth, Icelandic */
"euml", /* small e, dieresis or umlaut mark */
"gt", /* greater than */
"iacute", /* small i, acute accent */
"icirc", /* small i, circumflex accent */
"igrave", /* small i, grave accent */
"iuml", /* small i, dieresis or umlaut mark */
"lt", /* less than */
"ntilde", /* small n, tilde */
"oacute", /* small o, acute accent */
"ocirc", /* small o, circumflex accent */
"ograve", /* small o, grave accent */
"oslash", /* small o, slash */
"otilde", /* small o, tilde */
"ouml", /* small o, dieresis or umlaut mark */
"szlig", /* small sharp s, German (sz ligature) */
"thorn", /* small thorn, Icelandic */
"uacute", /* small u, acute accent */
"ucirc", /* small u, circumflex accent */
"ugrave", /* small u, grave accent */
"uuml", /* small u, dieresis or umlaut mark */
"yacute", /* small y, acute accent */
"yuml", /* small y, dieresis or umlaut mark */
"AElig", /* capital AE diphthong (ligature) */
"Aacute", /* capital A, acute accent */
"Acirc", /* capital A, circumflex accent */
"Agrave", /* capital A, grave accent */
"Aring", /* capital A, ring */
"Atilde", /* capital A, tilde */
"Auml", /* capital A, dieresis or umlaut mark */
"Ccedil", /* capital C, cedilla */
"ETH", /* capital Eth, Icelandic */
"Eacute", /* capital E, acute accent */
"Ecirc", /* capital E, circumflex accent */
"Egrave", /* capital E, grave accent */
"Euml", /* capital E, dieresis or umlaut mark */
"Iacute", /* capital I, acute accent */
"Icirc", /* capital I, circumflex accent */
"Igrave", /* capital I, grave accent */
"Iuml", /* capital I, dieresis or umlaut mark */
"Ntilde", /* capital N, tilde */
"Oacute", /* capital O, acute accent */
"Ocirc", /* capital O, circumflex accent */
"Ograve", /* capital O, grave accent */
"Oslash", /* capital O, slash */
"Otilde", /* capital O, tilde */
"Ouml", /* capital O, dieresis or umlaut mark */
"THORN", /* capital THORN, Icelandic */
"Uacute", /* capital U, acute accent */
"Ucirc", /* capital U, circumflex accent */
"Ugrave", /* capital U, grave accent */
"Uuml", /* capital U, dieresis or umlaut mark */
"Yacute", /* capital Y, acute accent */
"aacute", /* small a, acute accent */
"acirc", /* small a, circumflex accent */
"aelig", /* small ae diphthong (ligature) */
"agrave", /* small a, grave accent */
"amp", /* ampersand */
"aring", /* small a, ring */
"atilde", /* small a, tilde */
"auml", /* small a, dieresis or umlaut mark */
"ccedil", /* small c, cedilla */
"eacute", /* small e, acute accent */
"ecirc", /* small e, circumflex accent */
"egrave", /* small e, grave accent */
"eth", /* small eth, Icelandic */
"euml", /* small e, dieresis or umlaut mark */
"gt", /* greater than */
"iacute", /* small i, acute accent */
"icirc", /* small i, circumflex accent */
"igrave", /* small i, grave accent */
"iuml", /* small i, dieresis or umlaut mark */
"lt", /* less than */
"ntilde", /* small n, tilde */
"oacute", /* small o, acute accent */
"ocirc", /* small o, circumflex accent */
"ograve", /* small o, grave accent */
"oslash", /* small o, slash */
"otilde", /* small o, tilde */
"ouml", /* small o, dieresis or umlaut mark */
"szlig", /* small sharp s, German (sz ligature) */
"thorn", /* small thorn, Icelandic */
"uacute", /* small u, acute accent */
"ucirc", /* small u, circumflex accent */
"ugrave", /* small u, grave accent */
"uuml", /* small u, dieresis or umlaut mark */
"yacute", /* small y, acute accent */
"yuml", /* small y, dieresis or umlaut mark */
};
#define HTML_ENTITIES 65
@@ -89,7 +89,7 @@ static WWW_CONST char* entities[] = {
** Lists must be in alphatbetical order by attribute name
** The tag elements contain the number of attributes
*/
static attr no_attr[] =
static attr no_attr[] =
{{ 0 }};
static attr a_attr[] = { /* Anchor attributes */
@@ -99,12 +99,12 @@ static attr a_attr[] = { /* Anchor attributes */
{ "TYPE" },
{ "URN" },
{ 0 } /* Terminate list */
};
};
static attr img_attr[] = { /* Anchor attributes */
{ "SRC"},
{ 0 } /* Terminate list */
};
};
static attr list_attr[] = {
{ "COMPACT"},

View File

@@ -1,12 +1,12 @@
/* The HTML DTD -- software interface in libwww
HTML DTD - SOFTWARE INTERFACE
SGML purists should excuse the use of the term "DTD" in this file to represent
DTD-related information which is not exactly a DTD itself.
The C modular structure doesn't work very well here, as the dtd is partly in the .h and
partly in the .c which are not very independent. Tant pis.
*/
#ifndef HTMLDTD_H
#define HTMLDTD_H
@@ -24,7 +24,7 @@ Element Numbers
Must Match all tables by element! These include tables in HTMLDTD.c and code in HTML.c
.
*/
typedef enum _HTMLElement {
HTML_A, HTML_ADDRESS,
@@ -58,7 +58,7 @@ Attribute numbers
/*
Identifier is HTML_<element>_<attribute>. These must match the tables in HTML.c!
*/
#define HTML_A_HREF 0
#define HTML_A_NAME 1

View File

@@ -31,7 +31,7 @@
*/
struct _HTStream {
WWW_CONST HTStreamClass * isa;
WWW_CONST HTStreamClass * isa;
HTStream * target;
HTStreamClass targetClass; /* COPY for speed */
};
@@ -169,14 +169,14 @@ PRIVATE void PlainToHTML_end_document ARGS1(HTStructured *, me)
** -----------------------
*/
PRIVATE WWW_CONST HTStructuredClass HTMLGeneration = /* As opposed to print etc */
{
{
"text/html",
HTMLGen_free,
HTMLGen_end_document, HTMLGen_handle_interrupt,
HTMLGen_put_character, HTMLGen_put_string, HTMLGen_write,
HTMLGen_start_element, HTMLGen_end_element,
HTMLGen_put_entity
};
};
/* Subclass-specific Methods
@@ -187,7 +187,7 @@ PUBLIC HTStructured * HTMLGenerator ARGS1(HTStream *, output)
{
HTStructured* me = (HTStructured*)malloc(sizeof(*me));
if (me == NULL) outofmem(__FILE__, "HTMLGenerator");
me->isa = &HTMLGeneration;
me->isa = &HTMLGeneration;
me->target = output;
me->targetClass = *me->target->isa; /* Copy pointers to routines for speed*/
@@ -203,10 +203,10 @@ PUBLIC HTStructured * HTMLGenerator ARGS1(HTStream *, output)
** This is just the easiest way of typecasting all the routines.
*/
PRIVATE WWW_CONST HTStructuredClass PlainToHTMLConversion =
{
{
"plaintexttoHTML",
HTMLGen_free,
PlainToHTML_end_document,
HTMLGen_free,
PlainToHTML_end_document,
HTMLGen_handle_interrupt,
HTMLGen_put_character,
HTMLGen_put_string,
@@ -214,7 +214,7 @@ PRIVATE WWW_CONST HTStructuredClass PlainToHTMLConversion =
NULL, /* Structured stuff */
NULL,
NULL
};
};
/* HTConverter from plain text to HTML Stream
@@ -223,18 +223,18 @@ PRIVATE WWW_CONST HTStructuredClass PlainToHTMLConversion =
PUBLIC HTStream* HTPlainToHTML ARGS5(
HTPresentation *, pres,
HTParentAnchor *, anchor,
HTParentAnchor *, anchor,
HTStream *, sink,
HTFormat, format_in,
int, compressed)
{
HTStream* me = (HTStream*)malloc(sizeof(*me));
me->isa = (HTStreamClass*) &PlainToHTMLConversion;
me->isa = (HTStreamClass*) &PlainToHTMLConversion;
me->target = sink;
me->targetClass = *me->target->isa;
/* Copy pointers to routines for speed*/
PUTS("<BODY>\n<PRE>\n");
return me;
}

View File

@@ -23,7 +23,7 @@
extern int www2Trace;
#endif
struct _HTStructured
struct _HTStructured
{
WWW_CONST HTStructuredClass * isa;
/* ... */
@@ -58,13 +58,13 @@ PUBLIC int HTSendMailTo ARGS4(
char *mailtoSubject;
#ifndef DISABLE_TRACE
if (www2Trace)
if (www2Trace)
fprintf(stderr, "HTMailto: Mailing to %s\n", arg);
#endif
if (!initialized)
if (!initialized)
initialized = initialize();
if (!initialized)
if (!initialized)
{
HTProgress ((char *) 0);
return HT_NOT_LOADED;
@@ -72,16 +72,16 @@ PUBLIC int HTSendMailTo ARGS4(
{
WWW_CONST char * p1=arg;
/* We will ask for the document, omitting the host name & anchor.
**
** Syntax of address is
** xxx@yyy User xxx at site yyy (xxx is optional).
*/
*/
if (!my_strncasecmp (arg, "mailto:", 7))
p1 = arg + 7; /* Skip "mailto:" prefix */
if (!*arg)
if (!*arg)
{
HTProgress ("Could not find email address");
return HT_NOT_LOADED; /* Ignore if no name */

View File

@@ -83,8 +83,8 @@ PRIVATE void HTMosaicHTML_free ARGS1(HTStream *, me)
{
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf
(stderr,
fprintf
(stderr,
"[HTMosaicHTMLFree] OK, we're going to decompress HText\n");
#endif
HTCompressedHText (me->text, me->compressed, 0);
@@ -113,14 +113,14 @@ PRIVATE void HTMosaicHTML_handle_interrupt ARGS1(HTStream *, me)
** -----------------------
*/
PUBLIC WWW_CONST HTStreamClass HTMosaicHTML =
{
{
"SocketWriter",
HTMosaicHTML_free,
HTMosaicHTML_end_document,
HTMosaicHTML_put_character, HTMosaicHTML_put_string,
HTMosaicHTML_put_character, HTMosaicHTML_put_string,
HTMosaicHTML_write,
HTMosaicHTML_handle_interrupt
};
};
/* New object
@@ -128,7 +128,7 @@ PUBLIC WWW_CONST HTStreamClass HTMosaicHTML =
*/
PUBLIC HTStream* HTMosaicHTMLPresent ARGS5(
HTPresentation *, pres,
HTParentAnchor *, anchor,
HTParentAnchor *, anchor,
HTStream *, sink,
HTFormat, format_in,
int, compressed)
@@ -137,15 +137,15 @@ PUBLIC HTStream* HTMosaicHTMLPresent ARGS5(
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf (stderr, "[HTMosaicHTMLPresent] Hi there! Compressed is %d\n",
fprintf (stderr, "[HTMosaicHTMLPresent] Hi there! Compressed is %d\n",
compressed);
#endif
me->isa = &HTMosaicHTML;
me->isa = &HTMosaicHTML;
me->text = HText_new();
me->interrupted = 0;
me->compressed = compressed;
HText_beginAppend(me->text);
return (HTStream*) me;
}

View File

@@ -13,7 +13,7 @@
extern HTStream* HTMosaicHTMLPresent PARAMS((
HTPresentation * pres,
HTParentAnchor * anchor,
HTStream * sink,
HTStream * sink,
HTFormat format_in,
int compressed));

View File

@@ -19,7 +19,7 @@
*
*
* - fixed &gt and &lt's with ;'s
* - added xhdr patch by MH
* - added xhdr patch by MH
*
*/
#include "../config.h"
@@ -62,7 +62,7 @@ char *mo_tmpnam(char *url);
extern int www2Trace;
#endif
struct _HTStructured
struct _HTStructured
{
WWW_CONST HTStructuredClass * isa;
/* ... */
@@ -105,8 +105,8 @@ int newsShowAllGroups = 0;
int newsShowReadGroups = 0;
int newsShowAllArticles = 0;
int newsNoThreadJumping = 0;
int newsGotList = 0;
int newsUseNewsRC = 1;
int newsGotList = 0;
int newsUseNewsRC = 1;
int newsNextIsUnread = 0;
int newsPrevIsUnread = 0;
extern int newsNoNewsRC;
@@ -129,23 +129,23 @@ int newsAuthWidth = 30;
*/
void escapeString (char *str, char *buf)
{
while (str && *str) {
switch (*str) {
case '<':
*buf = '&'; buf++; *buf = 'l'; buf++;
*buf = '&'; buf++; *buf = 'l'; buf++;
*buf = 't'; buf++; *buf = ';'; buf++;
break;
case '>':
*buf = '&'; buf++; *buf = 'g'; buf++;
*buf = '&'; buf++; *buf = 'g'; buf++;
*buf = 't'; buf++; *buf = ';'; buf++;
break;
case '&':
*buf = '&'; buf++; *buf = 'a'; buf++;
*buf = '&'; buf++; *buf = 'a'; buf++;
*buf = 'm'; buf++; *buf = 'p'; buf++;
*buf = ';'; buf++;
break;
@@ -158,27 +158,27 @@ void escapeString (char *str, char *buf)
}
*buf = 0;
}
/* HTSetNewsConfig ()
Expects: artView -- Article View configuration: 0 = Article View,
Expects: artView -- Article View configuration: 0 = Article View,
1 = Thread View
artAll -- Show All Articles? 0 = No, non zero = yes
grpAll -- Show All Groups? 0 = no, non zero = yes
grpRead -- Show Read Groups? 0 = no, non zero = yes
noThrJmp -- Don't jump threads? 0 = no, non zero = yes
newsRC -- Use the newsrc? 0 = no, non zero = yes
nxtUnread -- Next thread should be the next unread?
nxtUnread -- Next thread should be the next unread?
0 = no, non zero = yes
prevUnread -- Prev thread should be the prev unread?
prevUnread -- Prev thread should be the prev unread?
0 = no, non zero = yes
Returns: Nothing
Sets the current news config.
*/
void HTSetNewsConfig (int artView, int artAll, int grpAll, int grpRead,
void HTSetNewsConfig (int artView, int artAll, int grpAll, int grpRead,
int noThrJmp, int newsRC, int nxtUnread, int prevUnread)
{
if (artView != NO_CHANGE) {
@@ -332,7 +332,7 @@ int uudecodeline(FILE *fp, char *buf)
fclose(fp);
return 1;
}
p = buf;
/* N is used to avoid writing out all the characters at the end of
the file. */
@@ -556,9 +556,9 @@ PRIVATE void AddArtTop ARGS1(WWW_CONST NewsArt *, add)
/* If threaded, try to find some more of me ... */
if(add->FirstRef){
for(temp = LastArt; temp; temp = temp->prevt)
if( strmatch(add->FirstRef,temp->FirstRef)
if( strmatch(add->FirstRef,temp->FirstRef)
|| strmatch(add->FirstRef,temp->ID) ) break;
} else {
} else {
for(temp = LastArt; temp; temp = temp->prevt)
if(strmatch(add->ID,temp->FirstRef)) break;
}
@@ -604,7 +604,7 @@ PRIVATE void start_anchor ARGS1(WWW_CONST char *, href)
** HT has a selection of zero length at the end.
** text points to the text to be put into the file, 0 terminated.
** addr points to the hypertext refernce address,
** terminated by white space, comma, NULL or '>'
** terminated by white space, comma, NULL or '>'
*/
PRIVATE void write_anchor ARGS2(WWW_CONST char *,text, WWW_CONST char *,addr)
{
@@ -714,14 +714,14 @@ PRIVATE BOOL initialize NOARGS
fclose(fp);
}
}
if (!HTNewsHost)
if (!HTNewsHost)
HTNewsHost = DEFAULT_NEWS_HOST;
#ifndef DISABLE_TRACE
if (www2Trace) fprintf(stderr, "HTNews: initialising newsrc for host\n");
#endif
s = -1; /* Disconnected */
return YES;
}
@@ -744,7 +744,7 @@ PRIVATE int newswrite ARGS1(WWW_CONST char *, msg)
int status;
if( (status = NETWRITE(s, msg, strlen(msg))) <0){
#ifndef DISABLE_TRACE
if (www2Trace)
if (www2Trace)
fprintf(stderr, "HTNews: Unable to send command. Disconnecting.\n");
#endif
NETCLOSE(s);
@@ -756,13 +756,13 @@ PRIVATE int newswrite ARGS1(WWW_CONST char *, msg)
PRIVATE int response ARGS1(WWW_CONST char *,command)
{
int result;
int result;
char * p = response_text;
if (command) {
int status;
int length = strlen(command);
#ifndef DISABLE_TRACE
if (www2Trace)
if (www2Trace)
fprintf(stderr, "NNTP command to be sent: %s", command);
#endif
status = NETWRITE(s, command, length);
@@ -776,17 +776,17 @@ PRIVATE int response ARGS1(WWW_CONST char *,command)
return status;
} /* if bad status */
} /* if command to be sent */
for(;;) {
for(;;) {
if (((*p++=HTGetCharacter ()) == LF) || (p == &response_text[LINE_LENGTH])) {
*p++=0; /* Terminate the string */
#ifndef DISABLE_TRACE
if (www2Trace) fprintf(stderr, "NNTP Response: %s\n", response_text);
#endif
sscanf(response_text, "%d", &result);
return result;
return result;
} /* if end of line */
if (*(p-1) < 0) {
#ifndef DISABLE_TRACE
if (www2Trace) fprintf(stderr,
@@ -800,7 +800,7 @@ PRIVATE int response ARGS1(WWW_CONST char *,command)
/* Setup our networking */
PRIVATE int OpenNNTP NOARGS
PRIVATE int OpenNNTP NOARGS
{
/* CONNECTING to news host */
char url[1024];
@@ -829,14 +829,14 @@ PRIVATE int OpenNNTP NOARGS
NETCLOSE(s);
s = -1;
#ifndef DISABLE_TRACE
if (www2Trace)
if (www2Trace)
fprintf(stderr, "HTNews: Unable to connect to news host.\n");
#endif
return 2;
} else {
#ifndef DISABLE_TRACE
if (www2Trace)
if (www2Trace)
fprintf(stderr, "HTNews: Connected to news host %s.\n",HTNewsHost);
#endif
HTInitInput(s); /* set up buffering */
@@ -915,11 +915,11 @@ char *NNTPgetquoteline(char *art)
break;
}
}
if(qline[2]=='.' && qline[3] < ' ') return NULL;
return qline;
}
int NNTPgetarthdrs(char *art,char **ref, char **grp, char **subj, char **from)
{
int status, done;
@@ -928,7 +928,7 @@ int NNTPgetarthdrs(char *art,char **ref, char **grp, char **subj, char **from)
char buffer[LINE_LENGTH+1];
*ref = *grp = *subj = *from = NULL;
if (!initialized)
initialized = initialize();
if (!initialized){
@@ -938,7 +938,7 @@ int NNTPgetarthdrs(char *art,char **ref, char **grp, char **subj, char **from)
HTProgress ("Could not set up news connection.");
return HT_NOT_LOADED; /* FAIL */
}
if(s < 0) {
HTProgress("Attempting to connect to news server");
if(OpenNNTP()){
@@ -1404,13 +1404,13 @@ char *makespaces (char *str, int len)
p++;
}
*p = 0;
} else if (l > len) {
} else if (l > len) {
spaces[0] = 0;
}
return spaces;
}
/* Read in an Article read_article
** ------------------
**
@@ -1422,7 +1422,7 @@ char *makespaces (char *str, int len)
** On entry,
** s Global socket number is OK
** HT Global hypertext object is ready for appending text
*/
*/
PRIVATE void read_article ARGS1 (char *, artID)
{
int i;
@@ -1487,17 +1487,17 @@ PRIVATE void read_article ARGS1 (char *, artID)
} else {
switch(line[0]) {
case '.':
if (line[1]<' ')
if (line[1]<' ')
done = 1;
break;
case 'S':
case 's':
if(match(line, "SUBJECT:"))
if(match(line, "SUBJECT:"))
subj = strdup(&line[8]);
break;
case 'D':
case 'd':
if(match(line, "DATE:"))
if(match(line, "DATE:"))
date = strdup(&line[5]);
break;
case 'L':
@@ -1507,22 +1507,22 @@ PRIVATE void read_article ARGS1 (char *, artID)
break;
case 'F':
case 'f':
if(match(line, "FROM:"))
if(match(line, "FROM:"))
from = strdup(&line[5]);
break;
case 'O':
case 'o':
if(match(line, "ORGANIZATION:"))
if(match(line, "ORGANIZATION:"))
org = strdup(&line[13]);
break;
case 'N':
case 'n':
if(match(line, "NEWSGROUPS:"))
if(match(line, "NEWSGROUPS:"))
newsgroups = strdup(&line[11]);
break;
case 'R':
case 'r':
if(match(line, "REFERENCES:"))
if(match(line, "REFERENCES:"))
references = strdup(&line[11]);
break;
default:
@@ -1700,12 +1700,12 @@ PRIVATE void read_article ARGS1 (char *, artID)
continue;
}
break;
case 5: /* possible mime encap encoding crud */
if(match(line,"CONTENT-TYPE: IMAGE")) {
decode = 3;
break;
} else {
} else {
decode = 0;
}
break;
@@ -1716,7 +1716,7 @@ PRIVATE void read_article ARGS1 (char *, artID)
decode = 3;
break;
}
if(!strncmp(line,"begin",5)){
if(!strncmp(line,"begin",5)){
decode=1;
fp = startuudecode(filename = mo_tmpnam(NULL));
HTProgress("uudecoding image data...");
@@ -1724,9 +1724,9 @@ PRIVATE void read_article ARGS1 (char *, artID)
continue;
}
}
/* HTTP, FTP, MAILTO, GOPHER, */
for(f=0, l=pp=line;*pp;pp++) {
for(f=0, l=pp=line;*pp;pp++) {
if(f) {
if(isspace(*pp) || (*pp=='"') || (*pp=='<') || (*pp=='>')){
ll = *pp;
@@ -1740,7 +1740,7 @@ PRIVATE void read_article ARGS1 (char *, artID)
l = pp;
f=0;
}
}
}
if(*pp=='<') {
*pp=0;
PUTS(l);
@@ -1777,10 +1777,10 @@ PRIVATE void read_article ARGS1 (char *, artID)
}
}
continue;
}
}
}
PUTS(l);
#ifdef OLD
#ifdef OLD
for(f=1,l=pp=line;*pp;pp++){
if(*pp == '<'){
if(strchr(pp,'>')){
@@ -1909,7 +1909,7 @@ PRIVATE void read_list NOARGS
} else {
intr = HTCheckActiveIcon(0);
}
if (intr) {
HTProgress ("Transfer Interrupted");
return;
@@ -1921,7 +1921,7 @@ PRIVATE void read_list NOARGS
/* Attempt to estimate where we are at in the big list */
if ((m*100/5000) < 100)
HTMeter (m*100/8000,NULL);
else
else
HTMeter (99, "99%");
}
@@ -1943,7 +1943,7 @@ PRIVATE void read_list NOARGS
n = findgroup (group);
if (!LastGroup)
LastGroup = n;
if (n) {
if (n) {
if (LastGroup == n)
lastg = 1;
@@ -1955,9 +1955,9 @@ PRIVATE void read_list NOARGS
}
if (postable == 'y')
n->attribs |= naPOST;
if (n->attribs&naSUBSCRIBED &&
(newsShowAllGroups || n->unread>0
if (n->attribs&naSUBSCRIBED &&
(newsShowAllGroups || n->unread>0
|| newsShowReadGroups)) {
sprintf(line,"%s % 7ld S <A HREF=\"news:%s\">%s</A> \n",
(lastg==1)?"<b>&gt;&gt;&gt;</b>":" ",
@@ -1965,7 +1965,7 @@ PRIVATE void read_list NOARGS
PUTS (line);
if (lastg==1)
lastg=2;
}
}
} else {
sprintf(line," % 7d U <A HREF=\"news:%s\">%s</A> \n",
last<first?0:last-first, group, elgroup);
@@ -2013,8 +2013,8 @@ PRIVATE void read_list NOARGS
n->attribs |= naSEQUENCED;
}
if (LastGroup == n && (n->unread>0 || newsShowAllGroups))
if (LastGroup == n && (n->unread>0 || newsShowAllGroups))
lastg = 1;
else if (LastGroup == n)
lastg = 2;
@@ -2023,14 +2023,14 @@ PRIVATE void read_list NOARGS
if (newsShowAllGroups || n->unread>0 || newsShowReadGroups) {
sprintf(line,"%s % 7ld %s <A HREF=\"news:%s\">%s</A> \n",
(lastg==1)? "<b>&gt;&gt;&gt;</b>":" ",
n->unread, n->attribs&naSUBSCRIBED?"S":"U",
n->unread, n->attribs&naSUBSCRIBED?"S":"U",
n->name, elgroup);
PUTS(line);
l++;
if (lastg == 1)
mark = 1;
lastg--;
}
}
n = nextgroup (n);
}
}
@@ -2081,7 +2081,7 @@ int parsexover(char *x, char **num, char **title, char **from,
*x = 0; /* terminate */
x++; /* bump to start of next field */
*ref = x;
while(*x && *x != '\t') x++; /* step to next tab */
if(!*x) return 0; /* early end of string - bad record */
*x = 0; /* terminate */
@@ -2141,12 +2141,12 @@ PRIVATE void XBuildArtList ARGS3(
}
GroupFirst = first;
GroupLast = last;
GroupLast = last;
ReadLast = last;
if (first_required<GroupFirst)
first_required = GroupFirst;
if ((last_required==0) || (last_required > GroupLast))
if (first_required<GroupFirst)
first_required = GroupFirst;
if ((last_required==0) || (last_required > GroupLast))
last_required = GroupLast;
if(first_required > last_required) return;
@@ -2155,19 +2155,19 @@ PRIVATE void XBuildArtList ARGS3(
HTInitInput(s);
sprintf(buf, "XOVER %d-%d\r\n", first_required, last_required);
if(response(buf) != 224) return;
if(response(buf) != 224) return;
HTProgress("Threading Articles");
lineinc = count/100;
if(lineinc < 1) lineinc = 1;
for(;;){
if(!(Count%lineinc) && count) {
HTMeter((Count*100)/(count),NULL);
HTMeter((Count*100)/(count),NULL);
}
/* EOS test needed */
for(p = buf;*p = HTGetCharacter();p++){
if(*p=='\r' || *p=='\n'){
@@ -2188,9 +2188,9 @@ PRIVATE void XBuildArtList ARGS3(
art->num = atoi(num);
Count++;
StrAllocCopy(art->SUBJ, title);
if(ref[0]){
p = ref;
aref = p;
@@ -2213,7 +2213,7 @@ PRIVATE void XBuildArtList ARGS3(
p--;
}
}
msgid++; /* Chop < */
msgid[strlen(msgid)-1]=0; /* Chop > */
StrAllocCopy(art->ID, msgid);
@@ -2232,7 +2232,7 @@ PRIVATE void XBuildArtList ARGS3(
}
HTMeter(100,NULL);
HTProgress("Done Threading Articles");
}
@@ -2274,29 +2274,29 @@ PRIVATE void BuildArtList ARGS3(
}
if (first_required<GroupFirst)
if (first_required<GroupFirst)
first_required = GroupFirst; /* clip */
if ((last_required==0) || (last_required > GroupLast))
if ((last_required==0) || (last_required > GroupLast))
last_required = GroupLast;
/* Read newsgroup using individual fields:
*/
c = 0;
c = 0;
artlist = NULL;
if(count){
if(!(artlist = (int *) malloc(sizeof(int) * (count+2))))
outofmem(__FILE__, "BuildArtList");
if(response("listgroup\r\n") != 211){
/* try XHDR if LISTGROUP fails */
/* thanks to Martin Hamilton for this bit 'o code...
his choice of header, not mine
his choice of header, not mine
*/
sprintf(buffer, "xhdr anarchy-in-the-uk %d-%d\r\n", first, last);
if(response(buffer) != 221) {
HTProgress("Cannot get article list from news server");
HTProgress("Cannot get article list from news server");
return;
}
}
@@ -2305,7 +2305,7 @@ PRIVATE void BuildArtList ARGS3(
artlist[0]=0;
while(c<(count+2)){
char ch = HTGetCharacter ();
if (ch==(char)EOF) {
abort_socket(); /* End of file, close socket */
return; /* End of file on response */
@@ -2319,8 +2319,8 @@ PRIVATE void BuildArtList ARGS3(
artlist[c]=0;
} else {
if (isdigit(ch))
artlist[c] = artlist[c]*10 + ch-'0';
}
artlist[c] = artlist[c]*10 + ch-'0';
}
} /* Loop over characters */
}
@@ -2328,29 +2328,29 @@ PRIVATE void BuildArtList ARGS3(
for(i=0;i<c;i++){
artno = artlist[i];
if(artno <= GroupLast)
if(artno <= GroupLast)
continue;
/* FLUSH!!! */
HTInitInput(s);
sprintf(buffer, "HEAD %d%c%c", artno, CR, LF);
status = response(buffer);
/* fprintf(stderr,"%d:[%d]:%s\n",artno,status,buffer);*/
if (status == 221) { /* Head follows - parse it:*/
art = NewArt();
art->num = artno;
Count++;
if(!(Count % 25) ) {
sprintf(buffer, "Threading Article %d of %d",Count,count);
HTProgress (buffer);
}
if(!ReadFirst || artno<ReadFirst) ReadFirst = artno;
if(!ReadLast || artno>ReadLast) ReadLast = artno;
p = line; /* Write pointer */
done = NO;
while(!done){
@@ -2359,26 +2359,26 @@ PRIVATE void BuildArtList ARGS3(
abort_socket(); /* End of file, close socket */
return; /* End of file on response */
}
if ((ch == LF) || (p == &line[LINE_LENGTH]) ) {
*--p=0; /* Terminate & chop LF*/
p = line; /* Restart at beginning */
#ifndef DISABLE_TRACE
if (www2Trace) fprintf(stderr, "G %s\n", line);
#endif
switch(line[0]) {
case '.':
done = (line[1]<' '); /* End of article? */
break;
case 'S':
case 's':
if (match(line, "SUBJECT:"))
StrAllocCopy(art->SUBJ, line+9);/* Save subject */
break;
case 'R':
case 'r':
if (match(line, "REFERENCES:")) {
@@ -2404,7 +2404,7 @@ PRIVATE void BuildArtList ARGS3(
}
}
break;
case 'M':
case 'm':
if (match(line, "MESSAGE-ID:")) {
@@ -2413,7 +2413,7 @@ PRIVATE void BuildArtList ARGS3(
StrAllocCopy(art->ID, addr);
}
break;
case 'f':
case 'F':
if (match(line, "FROM:")) {
@@ -2431,9 +2431,9 @@ PRIVATE void BuildArtList ARGS3(
}
}
break;
} /* end switch on first character */
p = line; /* Restart at beginning */
} /* if end of line */
} /* Loop over characters */
@@ -2441,15 +2441,15 @@ PRIVATE void BuildArtList ARGS3(
/* indicate progress! @@@@@@
*/
} /* If good response */
} /* Loop over article */
} /* Loop over article */
if(artlist) free(artlist);
GroupLast = last;
GroupFirst = first;
HTProgress("Done Threading Articles");
}
@@ -2482,7 +2482,7 @@ PRIVATE void read_group ARGS3(
return;
}
NewsGroupS->attribs |= naUPDATE;
}
}
if (NewsGroup) {
free (NewsGroup);
@@ -2490,19 +2490,19 @@ PRIVATE void read_group ARGS3(
}
if ((f = firstUnreadThread (FirstArt)) == NULL) {
sprintf (buffer, "\nNo %sarticles in this group.\n",
sprintf (buffer, "\nNo %sarticles in this group.\n",
newsShowAllArticles?"":"unread ");
markrangeread (NewsGroupS, NewsGroupS->minart, NewsGroupS->maxart);
PUTS (buffer);
return;
}
/* Set window title */
START (HTML_TITLE);
sprintf (buffer, "Newsgroup: %s", groupName);
PUTS (buffer);
END (HTML_TITLE);
/* If !ConfigView then the format is:
@@ -2516,7 +2516,7 @@ PRIVATE void read_group ARGS3(
*/
/* nextUnreadThread determines the next thread to go to.
it returns the next article in the next thread
it returns the next article in the next thread
It looks at a whole bunch of globals to see what the next article
should be ...
*/
@@ -2540,12 +2540,12 @@ PRIVATE void read_group ARGS3(
continue;
i++;
}
if (!i && !newsShowAllArticles)
if (!i && !newsShowAllArticles)
continue;
/* Write summary */
sprintf (buffer, "%s % 4d <A HREF=\"news:%s\">%s</A>%s %s\n",
(mark==1)?"<b>&gt;&gt;&gt;</b>":" ", i, art->ID, esubj,
makespaces(subj,newsSubjWidth),
sprintf (buffer, "%s % 4d <A HREF=\"news:%s\">%s</A>%s %s\n",
(mark==1)?"<b>&gt;&gt;&gt;</b>":" ", i, art->ID, esubj,
makespaces(subj,newsSubjWidth),
efrom);
PUTS (buffer);
if (mark==1)
@@ -2561,9 +2561,9 @@ PRIVATE void read_group ARGS3(
compact_string (art2->FROM, from, newsAuthWidth, 3,3);
escapeString (subj, esubj);
escapeString (from, efrom);
sprintf (buffer, "%s <A HREF=\"news:%s\">%s</A>%s %s\n",
(mark==1)?"<b>&gt;&gt;&gt;</b>":" ", art2->ID, esubj,
makespaces(subj,newsSubjWidth),
sprintf (buffer, "%s <A HREF=\"news:%s\">%s</A>%s %s\n",
(mark==1)?"<b>&gt;&gt;&gt;</b>":" ", art2->ID, esubj,
makespaces(subj,newsSubjWidth),
efrom);
PUTS (buffer);
if (mark==1)
@@ -2594,21 +2594,21 @@ PUBLIC int HTLoadNews ARGS4(
char groupName[GROUP_NAME_LENGTH]; /* Just the group name */
char buf[LINE_LENGTH+1], *p1;
int status; /* tcp return */
int retries; /* A count of how hard we have tried */
int retries; /* A count of how hard we have tried */
BOOL group_wanted; /* Flag: group was asked for, not article */
BOOL list_wanted; /* Flag: group was asked for, not article */
long first, last; /* First and last articles asked for */
int has_xover;
diagnostic = (format_out == WWW_SOURCE); /* set global flag */
#ifndef DISABLE_TRACE
if (www2Trace)
if (www2Trace)
fprintf(stderr, "HTNews: Looking for %s\n", arg);
#endif
if (!initialized)
if (!initialized)
initialized = initialize();
if (!initialized) {
HTProgress ("Could not set up news connection.");
@@ -2616,10 +2616,10 @@ PUBLIC int HTLoadNews ARGS4(
}
/* Pull in the newsrc data if necessary */
if (newsrc_init (HTNewsHost) != 0) {
if (newsrc_init (HTNewsHost) != 0) {
HTProgress ("Not using newsrc data...");
}
/* Update the preferences so we don't have to make a function call for
every newsShow** resource access.
*/
@@ -2729,9 +2729,9 @@ PUBLIC int HTLoadNews ARGS4(
}
status = response("XOVER\r\n");
if(status != 500)
has_xover = 1;
else
if(status != 500)
has_xover = 1;
else
has_xover = 0;
/* FLUSH!!! */
@@ -2741,7 +2741,7 @@ PUBLIC int HTLoadNews ARGS4(
if (!list_wanted) {
status = response(command);
strcpy (buf, response_text);
} else {
} else {
status = 211;
}
@@ -2749,7 +2749,7 @@ PUBLIC int HTLoadNews ARGS4(
if (www2Trace)
fprintf (stderr, "News: Sent '%s', status %d\n", command, status);
#endif
if (status < 0)
if (status < 0)
break;
if ((status/100) != 2) {
PUTS(response_text);
@@ -2759,12 +2759,12 @@ PUBLIC int HTLoadNews ARGS4(
s = -1;
continue; /* Try again */
}
/* Load a group, article, etc */
if (list_wanted) {
/* Destroy all the article stuff */
ClearArtList ();
if (NewsGroupS)
if (NewsGroupS)
NewsGroupS = NULL;
if (NewsGroup)
free (NewsGroup);
@@ -2774,21 +2774,21 @@ PUBLIC int HTLoadNews ARGS4(
HTMeter (100,NULL);
HTDoneWithIcon ();
HTProgress ("Rendering newsgroup listing... one moment please");
} else if (group_wanted){
} else if (group_wanted){
int l,h,j;
if(has_xover)
if(has_xover)
XBuildArtList(groupName, first, last);
else
else
BuildArtList(groupName, first, last);
if (sscanf (buf, "%d %d %d %d", &j, &j, &l, &h) == 4)
if (sscanf (buf, "%d %d %d %d", &j, &j, &l, &h) == 4)
read_group(groupName, l, h);
else
else
read_group(groupName, 0, -1);
HTMeter (100,NULL);
HTDoneWithIcon ();
} else {
} else {
read_article(&command[9]);
HTMeter (100,NULL);
HTDoneWithIcon ();

View File

@@ -1,6 +1,6 @@
/* Network News Transfer protocol module for the WWW library
HTNEWS
*/
/* History:
** 26 Sep 90 Written TBL in Objective-C

View File

@@ -35,7 +35,7 @@ char * HTStrip(s)
char *s;
#endif
{
#define SPACE(c) ((c==' ')||(c=='\t')||(c=='\n'))
#define SPACE(c) ((c==' ')||(c=='\t')||(c=='\n'))
char * p=s;
for(p=s;*p;p++); /* Find end of string */
for(p--;p>=s;p--) {
@@ -73,7 +73,7 @@ PRIVATE void scan(name, parts)
length = strlen(name);
else
length = 0;
parts->access = 0;
parts->host = 0;
parts->absolute = 0;
@@ -83,7 +83,7 @@ PRIVATE void scan(name, parts)
/* Argh. */
if (!length)
return;
after_access = name;
for(p=name; *p; p++) {
if (*p==':') {
@@ -94,7 +94,7 @@ PRIVATE void scan(name, parts)
if (*p=='/') break;
if (*p=='#') break;
}
for(p=name+length-1; p>=name; p--) {
if (*p =='#') {
parts->anchor=p+1;
@@ -113,7 +113,7 @@ PRIVATE void scan(name, parts)
}
} else {
parts->absolute = p+1; /* Root found but no host */
}
}
} else {
parts->relative = (*after_access) ? after_access : 0; /* zero for "" */
}
@@ -125,7 +125,7 @@ PRIVATE void scan(name, parts)
parts->anchor = 0;
}
} /*scan */
} /*scan */
/* Parse a Name relative to another name
@@ -160,22 +160,22 @@ char * HTParse(aName, relatedName, wanted)
char * p;
char *access;
struct struct_parts given, related;
if (!aName)
aName = strdup ("\0");
if (!relatedName)
relatedName = strdup ("\0");
/* Make working copies of input strings to cut up:
*/
len = strlen(aName)+strlen(relatedName)+10;
result=(char *)malloc(len); /* Lots of space: more than enough */
StrAllocCopy(name, aName);
StrAllocCopy(rel, relatedName);
scan(name, &given);
scan(rel, &related);
scan(rel, &related);
result[0]=0; /* Clear string */
access = given.access ? given.access : related.access;
if (wanted & PARSE_ACCESS)
@@ -183,7 +183,7 @@ char * HTParse(aName, relatedName, wanted)
strcat(result, access);
if(wanted & PARSE_PUNCTUATION) strcat(result, ":");
}
if (given.access && related.access) /* If different, inherit nothing. */
if (strcmp(given.access, related.access)!=0) {
related.host=0;
@@ -191,10 +191,10 @@ char * HTParse(aName, relatedName, wanted)
related.relative=0;
related.anchor=0;
}
if (wanted & PARSE_HOST)
if(given.host || related.host) {
char * tail = result + strlen(result);
char * tail = result + strlen(result);
if(wanted & PARSE_PUNCTUATION) strcat(result, "//");
strcat(result, given.host ? given.host : related.host);
#define CLEAN_URLS
@@ -204,27 +204,27 @@ char * HTParse(aName, relatedName, wanted)
{
char * p;
p = strchr(tail, ':');
if (p && access)
if (p && access)
{ /* Port specified */
if ((strcmp(access, "http") == 0 && strcmp(p, ":80") == 0) ||
(strcmp(access, "gopher") == 0 &&
(strcmp(access, "gopher") == 0 &&
(strcmp(p, ":70") == 0 ||
strcmp(p, ":70+") == 0)))
*p = (char)0; /* It is the default: ignore it */
else if (p && *p && p[strlen(p)-1] == '+')
p[strlen(p)-1] = 0;
}
if (!p)
if (!p)
p = tail + strlen(tail); /* After hostname */
p--; /* End of hostname */
if (strlen (tail) > 3 && (*p == '.'))
if (strlen (tail) > 3 && (*p == '.'))
{
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf (stderr, "[Parse] tail '%s' p '%s'\n", tail, p);
#endif
*p = (char)0; /* chop final . */
/* OK, at this point we know that *(p+1) exists,
else we would not be here.
@@ -238,7 +238,7 @@ char * HTParse(aName, relatedName, wanted)
{
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf (stderr, "[Parse] Copying '%s' to '%s', %zu bytes\n",
fprintf (stderr, "[Parse] Copying '%s' to '%s', %zu bytes\n",
p+1, p, strlen (p+1));
#endif
/*
@@ -268,14 +268,14 @@ char * HTParse(aName, relatedName, wanted)
}
#endif
}
if (given.host && related.host) /* If different hosts, inherit no path. */
if (strcmp(given.host, related.host)!=0) {
related.absolute=0;
related.relative=0;
related.anchor=0;
}
if (wanted & PARSE_PATH) {
if(given.absolute) { /* All is given */
if(wanted & PARSE_PUNCTUATION) strcat(result, "/");
@@ -299,7 +299,7 @@ char * HTParse(aName, relatedName, wanted)
strcat(result, "/");
}
}
if (wanted & PARSE_ANCHOR)
if(given.anchor || related.anchor) {
if(wanted & PARSE_PUNCTUATION) strcat(result, "#");
@@ -309,7 +309,7 @@ char * HTParse(aName, relatedName, wanted)
free(rel);
if (name)
free(name);
StrAllocCopy(return_value, result);
free(result);
return return_value; /* exactly the right length */
@@ -343,25 +343,25 @@ void HTSimplify(filename)
char * q;
if (filename[0] && filename[1])
{
for(p=filename+2; *p; p++)
for(p=filename+2; *p; p++)
{
if (*p=='/')
if (*p=='/')
{
if ((p[1]=='.') && (p[2]=='.') && (p[3]=='/' || !p[3] ))
if ((p[1]=='.') && (p[2]=='.') && (p[3]=='/' || !p[3] ))
{
/* Changed clause below to (q>filename) due to attempted
read to q = filename-1 below. */
for (q = p-1; (q>filename) && (*q!='/'); q--)
; /* prev slash */
if (q[0]=='/' && 0!=strncmp(q, "/../", 4)
&& !(q-1>filename && q[-1]=='/'))
&& !(q-1>filename && q[-1]=='/'))
{
strcpy(q, p+3); /* Remove /xxx/.. */
if (!*filename) strcpy(filename, "/");
p = q-1; /* Start again with prev slash */
}
}
else if ((p[1]=='.') && (p[2]=='/' || !p[2]))
}
}
else if ((p[1]=='.') && (p[2]=='/' || !p[2]))
{
strcpy(p, p+2); /* Remove a slash and a dot */
}
@@ -369,7 +369,7 @@ void HTSimplify(filename)
}
}
}
/* Make Relative Name
** ------------------
@@ -403,7 +403,7 @@ char * HTRelative(aName, relatedName)
WWW_CONST char * path = 0;
WWW_CONST char * last_slash = 0;
int slashes = 0;
for(;*p; p++, q++) { /* Find extent of match */
if (*p!=*q) break;
if (*p==':') after_access = p+1;
@@ -413,9 +413,9 @@ char * HTRelative(aName, relatedName)
if (slashes==3) path=p;
}
}
/* q, p point to the first non-matching character or zero */
if (!after_access) { /* Different access */
StrAllocCopy(result, aName);
} else if (slashes<3){ /* Different nodes */
@@ -431,7 +431,7 @@ char * HTRelative(aName, relatedName)
strcat(result, last_slash+1);
}
#ifndef DISABLE_TRACE
if (www2Trace)
if (www2Trace)
fprintf(stderr, "HT: `%s' expressed relative to\n `%s' is\n `%s'.",
aName, relatedName, result);
#endif
@@ -461,7 +461,7 @@ char *HTEscape (char *part)
return NULL;
escaped = (char *)malloc (strlen (part) * 3 + 1);
for (q = escaped, p = part; *p != '\0'; p++)
{
int c = (int)((unsigned char)(*p));
@@ -476,9 +476,9 @@ char *HTEscape (char *part)
*q++ = HT_HEX(c % 16);
}
}
*q=0;
return escaped;
}
@@ -496,7 +496,7 @@ char *HTEscape (char *part)
PRIVATE char from_hex ARGS1(char, c)
{
return c >= '0' && c <= '9' ? c - '0'
return c >= '0' && c <= '9' ? c - '0'
: c >= 'A' && c <= 'F'? c - 'A' + 10
: c - 'a' + 10; /* accept small letters just in case */
}
@@ -516,11 +516,11 @@ PUBLIC char * HTUnEscape ARGS1( char *, str)
p++;
*q++ = ' ';
} else {
*q++ = *p++;
*q++ = *p++;
}
}
*q++ = 0;
return str;
} /* HTUnEscape */

View File

@@ -1,9 +1,9 @@
/* HTParse: URL parsing in the WWW Library
HTPARSE
This module of the WWW library contains code to parse URLs and various related things.
Implemented by HTParse.c .
*/
#ifndef HTPARSE_H
#define HTPARSE_H
@@ -13,7 +13,7 @@
The following are flag bits which may be ORed together to form a number to give the
'wanted' argument to HTParse.
*/
#define PARSE_ACCESS 16
#define PARSE_HOST 8
@@ -29,19 +29,19 @@ HTParse: Parse a URL relative to another URL
This returns those parts of a name which are given (and requested) substituting bits
from the related name where necessary.
ON ENTRY
aName A filename given
relatedName A name relative to which aName is to be parsed
wanted A mask for the bits which are wanted.
ON EXIT,
returns A pointer to a malloc'd string which MUST BE FREED
*/
extern char * HTParse PARAMS((char * aName, char * relatedName, int wanted));
@@ -52,11 +52,11 @@ extern char * HTParse PARAMS((char * aName, char * relatedName, int wanted));
HTStrip: Strip white space off a string
ON EXIT
Return value points to first non-white character, or to 0 if none.
All trailing white space is OVERWRITTEN with zero.
*/
#ifdef __STDC__
extern char * HTStrip(char * s);
@@ -72,7 +72,7 @@ HTSimplify: Simplify a UTL
seqeunce "/./" which may be replaced by "/". Simplification helps us recognize
duplicate filenames. It doesn't deal with soft links, though. The new (shorter)
filename overwrites the old.
*/
/*
** Thus, /etc/junk/../fred becomes /etc/fred
@@ -91,17 +91,17 @@ HTRelative: Make Relative (Partial) URL
This function creates and returns a string which gives an expression of one address as
related to another. Where there is no relation, an absolute address is retured.
ON ENTRY,
Both names must be absolute, fully qualified names of nodes (no anchor bits)
ON EXIT,
The return result points to a newly allocated name which, if parsed by HTParse relative
to relatedName, will yield aName. The caller is responsible for freeing the resulting
name later.
*/
#ifdef __STDC__
extern char * HTRelative(char * aName, char *relatedName);
@@ -117,7 +117,7 @@ HTEscape: Encode unacceptable characters in string
This funtion takes a string containing any sequence of ASCII characters, and returns a
malloced string containing the same infromation but with all "unacceptable" characters
represented in the form %xy where X and Y are two hex digits.
*/
extern char * HTEscape PARAMS((char * str));
@@ -129,7 +129,7 @@ HTUnEscape: Decode %xx escaped characters
This function takes a pointer to a string in which character smay have been encoded in
%xy form, where xy is the acsii hex code for character 16x+y. The string is converted
in place, as it will never grow.
*/
extern char * HTUnEscape PARAMS(( char * str));
@@ -140,5 +140,5 @@ extern char * HTUnEscape PARAMS(( char * str));
/*
end of HTParse
*/

View File

@@ -187,7 +187,7 @@ PUBLIC int HTAAFile_readPasswdRec ARGS3(FILE *, fp,
char *, out_password)
{
char terminator;
terminator = HTAAFile_readField(fp, out_username, MAX_USERNAME_LEN);
if (terminator == EOF) { /* End of file */
@@ -229,7 +229,7 @@ PUBLIC BOOL HTAA_checkPassword ARGS3(WWW_CONST char *, username,
char user[MAX_USERNAME_LEN+1];
char pw[MAX_PASSWORD_LEN+1];
int status;
if (filename && *filename) fp = fopen(filename,"r");
else fp = fopen(PASSWD_FILE,"r");
@@ -263,7 +263,7 @@ PUBLIC BOOL HTAA_checkPassword ARGS3(WWW_CONST char *, username,
} while (status != EOF);
fclose(fp);
#ifndef DISABLE_TRACE
if (www2Trace) fprintf(stderr, "HTAAFile_checkPassword: (%s,%s) %scorrect\n",
username, password, ((status != EOF) ? "" : "in"));

View File

@@ -1,5 +1,5 @@
/* PASSWORD FILE ROUTINES
*/
#ifndef HTPASSWD_H
@@ -22,10 +22,10 @@ User Authentication
HTAA_checkPassword(username,password,passwdfile)opens the password file, and checks if
the username-password pair is correct. Return value is YES, if and only if they are
correct. Otherwise, and also if the open fails, returns NO.
If the given password file name is NULL or an empty string, the default password file
name is used (macro PASSWD_FILE).
*/
/* PUBLIC HTAA_checkPassword()

View File

@@ -74,8 +74,8 @@ PRIVATE void HTPlain_free ARGS1(HTStream *, me)
{
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf
(stderr,
fprintf
(stderr,
"[HTPlain_free] OK, we're going to decompress HText\n");
#endif
HTCompressedHText (me->text, me->compressed, 1);
@@ -103,13 +103,13 @@ PRIVATE void HTPlain_handle_interrupt ARGS1(HTStream *, me)
** -----------------------
*/
PUBLIC WWW_CONST HTStreamClass HTPlain =
{
{
"SocketWriter",
HTPlain_free,
HTPlain_end_document,
HTPlain_put_character, HTPlain_put_string, HTPlain_write,
HTPlain_handle_interrupt
};
};
/* New object
@@ -117,18 +117,18 @@ PUBLIC WWW_CONST HTStreamClass HTPlain =
*/
PUBLIC HTStream* HTPlainPresent ARGS5(
HTPresentation *, pres,
HTParentAnchor *, anchor,
HTParentAnchor *, anchor,
HTStream *, sink,
HTFormat, format_in,
int, compressed)
{
HTStream* me = (HTStream*)malloc(sizeof(*me));
me->isa = &HTPlain;
me->isa = &HTPlain;
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf (stderr, "[HTPlainPresent] here we are; format_in is '%s' and compressed is %d\n", HTAtom_name (format_in), compressed);
#endif
#endif
me->text = HText_new();
me->compressed = compressed;

View File

@@ -13,7 +13,7 @@
extern HTStream* HTPlainPresent PARAMS((
HTPresentation * pres,
HTParentAnchor * anchor,
HTStream * sink,
HTStream * sink,
HTFormat format_in,
int compressed));

View File

@@ -18,7 +18,7 @@ void HTSortInit (void)
size_of_hunk = SIZE_OF_HUNK;
hunk = (char **)malloc (sizeof (char *) * size_of_hunk);
}
return;
}
@@ -38,7 +38,7 @@ void HTSortAdd (char *str)
expand_hunk ();
hunk[count++] = str;
return;
}
@@ -49,9 +49,9 @@ static int dsortf (char **s1, char **s2)
void HTSortSort (void)
{
qsort ((void *)hunk,
count,
sizeof (char *),
qsort ((void *)hunk,
count,
sizeof (char *),
(void *)dsortf);
return;

View File

@@ -1,11 +1,11 @@
/* The Stream class definition -- libwww
STREAM OBJECT DEFINITION
A Stream object is something which accepts a stream of text.
The creation methods will vary on the type of Stream Object, but
the methods used to write to it and close it are common.
*/
#ifndef HTSTREAM_H
#define HTSTREAM_H
@@ -20,37 +20,37 @@ typedef struct _HTStream HTStream;
self-explanatory, except for end_document which must be called
before free. It should be merged with free in fact: it should be
dummy for new streams.
The put_block method was write, but this upset systems whiuch had
macros for write().
*/
typedef struct _HTStreamClass {
char* name; /* Just for diagnostics */
void (*free) PARAMS((
HTStream* me));
void (*end_document) PARAMS((
HTStream* me));
void (*put_character) PARAMS((
HTStream* me,
char ch));
void (*put_string) PARAMS((
HTStream* me,
char * str));
void (*put_block) PARAMS((
HTStream* me,
char * str,
int len));
void (*handle_interrupt) PARAMS((
HTStream* me));
}HTStreamClass;
#endif /* HTSTREAM_H */

View File

@@ -43,7 +43,7 @@ PUBLIC int strncasecomp ARGS3(WWW_CONST char*,a, WWW_CONST char *,b, int,n)
{
WWW_CONST char *p =a;
WWW_CONST char *q =b;
for(p=a, q=b;; p++, q++) {
int diff;
if (p == a+n) return 0; /* Match up to n characters */
@@ -111,7 +111,7 @@ PUBLIC char * HTNextField ARGS1(char **, pstr)
{
char * p = *pstr;
char * start; /* start of field */
while(*p && WHITE(*p)) p++; /* Strip white space */
if (!*p) {
*pstr = p;

View File

@@ -1,8 +1,8 @@
/* String handling for libwww
STRINGS
Case-independent string comparison and allocations with copies etc
*/
#ifndef HTSTRING_H
#define HTSTRING_H
@@ -18,7 +18,7 @@ extern WWW_CONST char * HTLibraryVersion; /* String for help screen etc */
Case-insensitive string comparison
The usual routines (comp instead of cmp) had some problem.
*/
extern int strcasecomp PARAMS((WWW_CONST char *a, WWW_CONST char *b));
extern int strncasecomp PARAMS((WWW_CONST char *a, WWW_CONST char *b, int n));
@@ -45,5 +45,5 @@ extern char * HTNextField PARAMS ((char** pstr));
/*
end
*/

View File

@@ -169,24 +169,24 @@ PUBLIC int HTParseInet ARGS2(SockA *,sin, WWW_CONST char *,str)
struct hostent *phost; /* Pointer to host - See netdb.h */
int numeric_addr;
char *tmp;
static char *cached_host = NULL;
static char *cached_phost_h_addr = NULL;
static int cached_phost_h_length = 0;
strcpy(host, str); /* Take a copy we can mutilate */
/* Parse port number if present */
if (port=strchr(host, ':'))
/* Parse port number if present */
if (port=strchr(host, ':'))
{
*port++ = 0; /* Chop off port */
if (port[0]>='0' && port[0]<='9')
if (port[0]>='0' && port[0]<='9')
{
sin->sin_port = htons(atol(port));
}
}
/* Parse host number if present. */
/* Parse host number if present. */
numeric_addr = 1;
for (tmp = host; *tmp; tmp++)
{
@@ -197,13 +197,13 @@ PUBLIC int HTParseInet ARGS2(SockA *,sin, WWW_CONST char *,str)
goto found_non_numeric_or_done;
}
}
found_non_numeric_or_done:
if (numeric_addr)
if (numeric_addr)
{ /* Numeric node address: */
sin->sin_addr.s_addr = inet_addr(host); /* See arpa/inet.h */
}
else
}
else
{ /* Alphanumeric node name: */
if (cached_host && (strcmp (cached_host, host) == 0))
{
@@ -220,12 +220,12 @@ PUBLIC int HTParseInet ARGS2(SockA *,sin, WWW_CONST char *,str)
fprintf (stderr, "=+= Fetching on '%s'\n", host);
#endif
phost = gethostbyname (host);
if (!phost)
if (!phost)
{
#ifndef DISABLE_TRACE
if (www2Trace)
if (www2Trace)
fprintf
(stderr,
(stderr,
"HTTPAccess: Can't find internet node name `%s'.\n",host);
#endif
return -1; /* Fail? */
@@ -253,10 +253,10 @@ PUBLIC int HTParseInet ARGS2(SockA *,sin, WWW_CONST char *,str)
memcpy(&sin->sin_addr, phost->h_addr, phost->h_length);
}
}
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf(stderr,
if (www2Trace)
fprintf(stderr,
"TCP: Parsed address as port %d, IP address %d.%d.%d.%d\n",
(int)ntohs(sin->sin_port),
(int)*((unsigned char *)(&sin->sin_addr)+0),
@@ -264,7 +264,7 @@ PUBLIC int HTParseInet ARGS2(SockA *,sin, WWW_CONST char *,str)
(int)*((unsigned char *)(&sin->sin_addr)+2),
(int)*((unsigned char *)(&sin->sin_addr)+3));
#endif
return 0; /* OK */
}
@@ -289,7 +289,7 @@ PRIVATE void get_host_details()
struct hostent * phost; /* Pointer to host -- See netdb.h */
#endif
int namelength = sizeof(name);
if (hostname) return; /* Already done */
gethostname(name, namelength); /* Without domain */
@@ -305,7 +305,7 @@ PRIVATE void get_host_details()
phost=gethostbyname(name); /* See netdb.h */
if (!phost) {
#ifndef DISABLE_TRACE
if (www2Trace) fprintf(stderr,
if (www2Trace) fprintf(stderr,
"TCP: Can't find my own internet node address for `%s'!!\n",
name);
#endif
@@ -344,7 +344,7 @@ PUBLIC int HTDoConnect (char *url, char *protocol, int default_port, int *s)
/* Set up defaults: */
sin->sin_family = AF_INET;
sin->sin_port = htons(default_port);
/* Get node name and optional port number: */
{
char line[256];
@@ -355,7 +355,7 @@ PUBLIC int HTDoConnect (char *url, char *protocol, int default_port, int *s)
HTProgress (line);
status = HTParseInet(sin, p1);
if (status)
if (status)
{
sprintf (line, "Unable to locate remote host %s.", p1);
HTProgress(line);
@@ -368,7 +368,7 @@ PUBLIC int HTDoConnect (char *url, char *protocol, int default_port, int *s)
free (p1);
}
/* Now, let's get a socket set up from the server for the data: */
/* Now, let's get a socket set up from the server for the data: */
*s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
#ifdef SOCKS
@@ -403,7 +403,7 @@ PUBLIC int HTDoConnect (char *url, char *protocol, int default_port, int *s)
int ret;
int val = 1;
char line[256];
ret = ioctl(*s, FIONBIO, &val);
if (ret == -1)
{
@@ -452,11 +452,11 @@ PUBLIC int HTDoConnect (char *url, char *protocol, int default_port, int *s)
{
fd_set writefds;
int intr;
FD_ZERO(&writefds);
FD_SET(*s, &writefds);
/* linux (and some other os's, I think) clear timeout...
/* linux (and some other os's, I think) clear timeout...
let's reset it every time. bjs */
timeout.tv_sec = 0;
timeout.tv_usec = 100000;
@@ -539,7 +539,7 @@ PUBLIC int HTDoConnect (char *url, char *protocol, int default_port, int *s)
int ret;
int val = 0;
char line[256];
ret = ioctl(*s, FIONBIO, &val);
if (ret == -1)
{
@@ -574,7 +574,7 @@ int HTDoRead (int fildes, void *buf, unsigned nbyte)
FD_ZERO(&readfds);
FD_SET(fildes, &readfds);
/* linux (and some other os's, I think) clear timeout...
/* linux (and some other os's, I think) clear timeout...
let's reset it every time. bjs */
timeout.tv_sec = 0;
timeout.tv_usec = 100000;

View File

@@ -1,8 +1,8 @@
/* /Net/dxcern/userd/timbl/hypertext/WWW/Library/src/HTTCP.html
GENERIC TCP/IP COMMUNICATION
This module has the common code for handling TCP/IP connections etc.
*/
#ifndef HTTCP_H
#define HTTCP_H

View File

@@ -46,7 +46,7 @@ char **extra_headers=NULL;
#define _LIBWWW2
#include "../src/kcms.h"
struct _HTStream
struct _HTStream
{
HTStreamClass * isa;
};
@@ -121,7 +121,7 @@ PUBLIC int HTLoadHTTP ARGS4 (
BOOL extensions; /* Assume good HTTP server */
int compressed;
char line[2048]; /* bumped up to cover Kerb huge headers */
int length, doing_redirect, rv;
int already_retrying = 0;
int return_nothing;
@@ -139,13 +139,13 @@ PUBLIC int HTLoadHTTP ARGS4 (
HTProgress ("Bad request.");
goto done;
}
if (!*arg)
if (!*arg)
{
status = -2;
HTProgress ("Bad request.");
goto done;
}
sprintf(crlf, "%c%c", CR, LF);
/* At this point, we're talking HTTP/1.0. */
@@ -164,20 +164,20 @@ PUBLIC int HTLoadHTTP ARGS4 (
line_kept_clean = NULL;
return_nothing = 0;
/* okay... addr looks like http://hagbard.ncsa.uiuc.edu/blah/etc.html
/* okay... addr looks like http://hagbard.ncsa.uiuc.edu/blah/etc.html
lets crop it at the 3rd '/' */
for(p = arg,i=0;*p && i!=3;p++)
for(p = arg,i=0;*p && i!=3;p++)
if(*p=='/') i++;
if(i==3)
if(i==3)
i = p-arg; /* i = length not counting last '/' */
else
else
i = 0;
if((lsocket != -1) && i && addr && !strncmp(addr,arg,i)){
/* keepalive is active and addresses match -- try the old socket */
s = lsocket;
keepingalive = 1; /* flag in case of network error due to server timeout*/
keepingalive = 1; /* flag in case of network error due to server timeout*/
lsocket = -1; /* prevent looping on failure */
#ifndef DISABLE_TRACE
if (www2Trace)
@@ -229,18 +229,18 @@ PUBLIC int HTLoadHTTP ARGS4 (
}
if (status < 0) {
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf(stderr,
if (www2Trace)
fprintf(stderr,
"HTTP: Unable to connect to remote host for `%s' (errno = %d).\n", arg, errno);
#endif
HTProgress ("Unable to connect to remote host.");
status = HT_NO_DATA;
goto done;
}
}
}
/* Ask that node for the document,
** omitting the host name & anchor
*/
*/
{
char * p1 = HTParse(arg, "", PARSE_PATH|PARSE_PUNCTUATION);
command = malloc(5 + strlen(p1)+ 2 + 31);
@@ -267,15 +267,15 @@ PUBLIC int HTLoadHTTP ARGS4 (
strcat(command, p1);
free(p1);
}
if (extensions)
if (extensions)
{
strcat(command, " ");
strcat(command, HTTP_VERSION);
}
strcat(command, crlf); /* CR LF, as in rfc 977 */
if (extensions)
if (extensions)
{
#ifdef SAM_NOT_YET
/* SAM This produces an absolutely huge Accept: line. While
@@ -311,10 +311,10 @@ PUBLIC int HTLoadHTTP ARGS4 (
env_length+=strlen(line);
}
for(i=0; i<n; i++)
for(i=0; i<n; i++)
{
HTPresentation * pres = HTList_objectAt(HTPresentations, i);
if (pres->rep_out == WWW_PRESENT)
if (pres->rep_out == WWW_PRESENT)
{
sprintf(line, " %s,",HTAtom_name(pres->rep));
env_length+=strlen(line);
@@ -353,7 +353,7 @@ PUBLIC int HTLoadHTTP ARGS4 (
}
/*This is just used for "not" sending this header on a proxy request*/
if (useKeepAlive) {
if (useKeepAlive) {
sprintf(line, "Connection: keep-alive%c%c", CR, LF);
StrAllocCat(command, line);
}
@@ -435,24 +435,24 @@ PUBLIC int HTLoadHTTP ARGS4 (
char *colon;
int portnumber;
char *auth;
docname = HTParse(arg, "", PARSE_PATH);
hostname = HTParse(arg, "", PARSE_HOST);
if (hostname &&
NULL != (colon = strchr(hostname, ':')))
NULL != (colon = strchr(hostname, ':')))
{
*(colon++) = '\0'; /* Chop off port number */
portnumber = atoi(colon);
}
else portnumber = 80;
if (NULL!=(auth=HTAA_composeAuth(hostname, portnumber, docname)))
if (NULL!=(auth=HTAA_composeAuth(hostname, portnumber, docname)))
{
sprintf(line, "%s%c%c", auth, CR, LF);
StrAllocCat(command, line);
}
#ifndef DISABLE_TRACE
if (www2Trace)
if (www2Trace)
{
if (auth)
fprintf(stderr, "HTTP: Sending authorization: %s\n", auth);
@@ -485,9 +485,9 @@ PUBLIC int HTLoadHTTP ARGS4 (
content_length, CR, LF);
StrAllocCat(command, line);
}
StrAllocCat(command, crlf); /* Blank line means "end" */
if (post_data)
StrAllocCat(command, post_data);
else
@@ -551,7 +551,7 @@ PUBLIC int HTLoadHTTP ARGS4 (
#endif
free (command);
if (status <= 0)
if (status <= 0)
{
if (status == 0)
{
@@ -561,7 +561,7 @@ PUBLIC int HTLoadHTTP ARGS4 (
#endif
/* Do nothing. */
}
else if
else if
((errno == ENOTCONN || errno == ECONNRESET || errno == EPIPE) &&
!already_retrying &&
/* Don't retry if we're posting. */ !do_post)
@@ -569,8 +569,8 @@ PUBLIC int HTLoadHTTP ARGS4 (
/* Arrrrgh, HTTP 0/1 compability problem, maybe. */
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf
(stderr,
fprintf
(stderr,
"HTTP: BONZO ON WRITE Trying again with HTTP0 request.\n");
#endif
/*
@@ -601,7 +601,7 @@ PUBLIC int HTLoadHTTP ARGS4 (
goto done;
}
}
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf (stderr, "HTTP: WRITE delivered OK\n");
@@ -616,15 +616,15 @@ PUBLIC int HTLoadHTTP ARGS4 (
/* Get numeric status etc */
BOOL end_of_file = NO;
int buffer_length = INIT_LINE_SIZE;
line_buffer = (char *) malloc(buffer_length * sizeof(char));
do {
/* Loop to read in the first line */
/* Extend line buffer if necessary for those crazy WAIS URLs ;-) */
if (buffer_length - length < LINE_EXTEND_THRESH) {
buffer_length = buffer_length + buffer_length;
line_buffer =
line_buffer =
(char *) realloc(line_buffer, buffer_length * sizeof(char));
}
#ifndef DISABLE_TRACE
@@ -639,7 +639,7 @@ PUBLIC int HTLoadHTTP ARGS4 (
fprintf (stderr, "HTTP: Read %d\n", status);
#endif
if (status <= 0) {
/* Retry if we get nothing back too;
/* Retry if we get nothing back too;
bomb out if we get nothing twice. */
if (status == HT_INTERRUPTED) {
#ifndef DISABLE_TRACE
@@ -650,8 +650,8 @@ PUBLIC int HTLoadHTTP ARGS4 (
status = HT_INTERRUPTED;
NETCLOSE (s);
goto clean_up;
} else
if
} else
if
(status < 0 &&
(errno == ENOTCONN || errno == ECONNRESET || errno == EPIPE)
&& !already_retrying && !do_post)
@@ -662,11 +662,11 @@ PUBLIC int HTLoadHTTP ARGS4 (
fprintf (stderr, "HTTP: BONZO Trying again with HTTP0 request.\n");
#endif
NETCLOSE(s);
if (line_buffer)
if (line_buffer)
free(line_buffer);
if (line_kept_clean)
if (line_kept_clean)
free(line_kept_clean);
extensions = NO;
already_retrying = 1;
HTProgress ("Retrying as HTTP0 request.");
@@ -684,9 +684,9 @@ PUBLIC int HTLoadHTTP ARGS4 (
if (www2Trace)
fprintf (stderr, "HTTP: Hit unexpected network read error; aborting connection; status %d.\n", status);
#endif
HTProgress
HTProgress
("Unexpected network read error; connection aborted.");
NETCLOSE (s);
status = -1;
goto clean_up;
@@ -699,13 +699,13 @@ PUBLIC int HTLoadHTTP ARGS4 (
sprintf (line, "Read %d bytes of data.", bytes_already_read);
HTProgress (line);
}
if (status == 0) {
end_of_file = YES;
break;
}
line_buffer[length+status] = 0;
if (line_buffer) {
if (line_kept_clean)
free (line_kept_clean);
@@ -715,16 +715,16 @@ PUBLIC int HTLoadHTTP ARGS4 (
*/
memcpy (line_kept_clean, line_buffer, buffer_length);
}
eol = strchr(line_buffer + length, LF);
/* Do we *really* want to do this? */
if (eol && eol != line_buffer && *(eol-1) == CR)
*(eol-1) = ' ';
if (eol && eol != line_buffer && *(eol-1) == CR)
*(eol-1) = ' ';
length = length + status;
/* Do we really want to do *this*? */
if (eol)
if (eol)
*eol = 0; /* Terminate the line */
/* All we need is the first line of the response. If it's a HTTP/1.0
response, then the first line will be absurdly short and therefore
@@ -733,8 +733,8 @@ PUBLIC int HTLoadHTTP ARGS4 (
/* Well, let's try 100. */
} while (!eol && !end_of_file && bytes_already_read < 100);
} /* Scope of loop variables */
/* We now have a terminated unfolded line. Parse it.
** -------------------------------------------------
*/
@@ -742,7 +742,7 @@ PUBLIC int HTLoadHTTP ARGS4 (
if (www2Trace)
fprintf(stderr, "HTTP: Rx: %s\n", line_buffer);
#endif
{
int fields;
char server_version[VERSION_LENGTH+1];
@@ -752,11 +752,11 @@ PUBLIC int HTLoadHTTP ARGS4 (
statusError=0;
server_version[0] = 0;
fields = sscanf(line_buffer, "%20s %d",
server_version,
&server_status);
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf (stderr, "HTTP: Scanned %d fields from line_buffer\n", fields);
@@ -765,13 +765,13 @@ PUBLIC int HTLoadHTTP ARGS4 (
if (www2Trace)
fprintf (stderr, "HTTP: line_buffer '%s'\n", line_buffer);
#endif
/* Rule out HTTP/1.0 reply as best we can. */
if (fields < 2 || !server_version[0] || server_version[0] != 'H' ||
server_version[1] != 'T' || server_version[2] != 'T' ||
server_version[3] != 'P' || server_version[4] != '/' ||
server_version[6] != '.')
{
server_version[6] != '.')
{
/* HTTP0 reply */
HTAtom * encoding;
@@ -779,11 +779,11 @@ PUBLIC int HTLoadHTTP ARGS4 (
if (www2Trace)
fprintf (stderr, "--- Talking HTTP0.\n");
#endif
format_in = HTFileFormat(arg, &encoding, WWW_HTML, &compressed);
start_of_data = line_kept_clean;
}
else
}
else
{
/* Decode full HTTP response */
format_in = HTAtom_for("www/mime");
@@ -793,21 +793,21 @@ PUBLIC int HTLoadHTTP ARGS4 (
length or anything else in this situation. */
start_of_data = eol ? eol + 1 : "";
length = eol ? length - (start_of_data - line_buffer) : 0;
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf (stderr, "--- Talking HTTP1.\n");
#endif
switch (server_status / 100)
switch (server_status / 100)
{
case 3: /* Various forms of redirection */
/* We now support this in the parser, at least. */
doing_redirect = 1;
break;
case 4: /* "I think I goofed" */
switch (server_status)
switch (server_status)
{
case 403:
statusError=1;
@@ -816,27 +816,27 @@ PUBLIC int HTLoadHTTP ARGS4 (
case 401:
/* length -= start_of_data - text_buffer; */
if (HTAA_shouldRetryWithAuth(start_of_data, length, s))
if (HTAA_shouldRetryWithAuth(start_of_data, length, s))
{
(void)NETCLOSE(s);
lsocket = -1;
if (line_buffer)
if (line_buffer)
free(line_buffer);
if (line_kept_clean)
if (line_kept_clean)
free(line_kept_clean);
#ifndef DISABLE_TRACE
if (www2Trace)
if (www2Trace)
fprintf(stderr, "%s %d %s\n",
"HTTP: close socket", s,
"to retry with Access Authorization");
#endif
HTProgress ("Retrying with access authorization information.");
goto try_again;
break;
}
else
else
{
statusError=1;
/* Fall through. */
@@ -851,7 +851,7 @@ PUBLIC int HTLoadHTTP ARGS4 (
case 5: /* I think you goofed */
statusError=1;
break;
case 2: /* Good: Got MIME object */
switch (server_status)
{
@@ -877,13 +877,13 @@ PUBLIC int HTLoadHTTP ARGS4 (
break;
}
break;
default: /* bad number */
statusError=1;
HTAlert("Unknown status reply from server!");
break;
} /* Switch on server_status/100 */
} /* Full HTTP reply */
} /* scope of fields */
@@ -892,8 +892,8 @@ PUBLIC int HTLoadHTTP ARGS4 (
format_out,
compressed,
sink, anAnchor);
if (!target)
if (!target)
{
char buffer[1024]; /* @@@@@@@@ */
sprintf(buffer, "Sorry, no known way of converting %s to %s.",
@@ -943,9 +943,9 @@ PUBLIC int HTLoadHTTP ARGS4 (
#endif
/* Recycle the first chunk of data, in all cases. */
(*target->isa->put_block)(target, start_of_data, length);
/* Go pull the bulk of the data down. */
/* if we dont use length, header length is wrong due to the
/* if we dont use length, header length is wrong due to the
discarded first line - bjs*/
rv = HTCopy(s, target, length /*bytes_already_read*/);
if (rv == -1)
@@ -966,11 +966,11 @@ PUBLIC int HTLoadHTTP ARGS4 (
/* May as well consider it an interrupt -- right? */
(*target->isa->handle_interrupt) (target);
NETCLOSE(s);
if (line_buffer)
if (line_buffer)
free(line_buffer);
if (line_kept_clean)
if (line_kept_clean)
free(line_kept_clean);
extensions = NO;
already_retrying = 1;
HTProgress ("Retrying as HTTP0 request.");
@@ -1027,11 +1027,11 @@ PUBLIC int HTLoadHTTP ARGS4 (
/* Clean up
*/
clean_up:
if (line_buffer)
clean_up:
if (line_buffer)
free(line_buffer);
if (line_kept_clean)
if (line_kept_clean)
free(line_kept_clean);
done:

View File

@@ -163,14 +163,14 @@ PRIVATE int remote_session ARGS2(char *, access, char *, host)
if (!access || !host)
{
application_user_feedback
application_user_feedback
("Cannot open remote session, because\nURL is malformed.\0");
return HT_NO_DATA;
}
login_protocol =
strcmp(access, "rlogin") == 0 ? rlogin :
strcmp(access, "tn3270") == 0 ? tn3270 :
strcmp(access, "tn3270") == 0 ? tn3270 :
telnet;
/* Make sure we won't overrun the size of command with a huge host string */
@@ -178,21 +178,21 @@ PRIVATE int remote_session ARGS2(char *, access, char *, host)
{
host[200] = '\0';
}
user = host;
hostname = strchr(host, '@');
port = strchr(host, ':');
if (hostname)
if (hostname)
{
*hostname++ = 0; /* Split */
}
else
}
else
{
hostname = host;
user = 0; /* No user specified */
}
if (port)
if (port)
{
*port++ = 0; /* Split */
portnum = atoi(port);
@@ -204,9 +204,9 @@ PRIVATE int remote_session ARGS2(char *, access, char *, host)
*/
make_system_secure(user);
make_system_secure(hostname);
xterm_str = global_xterm_str;
if (login_protocol == rlogin)
{
/* For rlogin, we should use -l user. */
@@ -241,12 +241,12 @@ PRIVATE int remote_session ARGS2(char *, access, char *, host)
hostname);
}
}
#ifndef DISABLE_TRACE
if (www2Trace) fprintf(stderr, "HTaccess: Command is: %s\n", command);
#endif
run_a_command(command);
/* No need for application feedback if we're rlogging directly
in... */
if (user && login_protocol != rlogin)
@@ -258,7 +258,7 @@ PRIVATE int remote_session ARGS2(char *, access, char *, host)
sprintf (str, "When you are connected, log in as '%s'.", user);
application_user_feedback (str);
}
return HT_NO_DATA; /* Ok - it was done but no data */
}
@@ -286,21 +286,21 @@ ARGS4
)
{
char * access;
char * host;
int status;
if (sink)
if (sink)
{
HTAlert("Can't output a live session -- it has to be interactive");
return HT_NO_ACCESS;
}
access = HTParse(addr, "file:", PARSE_ACCESS);
host = HTParse(addr, "", PARSE_HOST);
status = remote_session(access, host);
free(host);
free(host);
free(access);
return status;
}

View File

@@ -1,6 +1,6 @@
/* /Net/dxcern/userd/timbl/hypertext/WWW/Library/Implementation/HTTelnet.html
TELNET AND SIMILAR ACCESS METHODS
*/
#ifndef HTTELNET_H

View File

@@ -109,7 +109,7 @@ PUBLIC int HTUU_encode ARGS3(unsigned char *, bufin,
*
* Decode an ASCII-encoded buffer back to its original binary form.
*
* Entry bufcoded points to a uuencoded string. It is
* Entry bufcoded points to a uuencoded string. It is
* terminated by any character not in
* the printable character table six2pr, but
* leading whitespace is stripped.
@@ -184,7 +184,7 @@ PUBLIC int HTUU_decode ARGS3(char *, bufcoded,
}
bufin = (unsigned char *) bufcoded;
while (nprbytes > 0) {
*(bufout++) = (unsigned char) (DEC(*bufin) << 2 | DEC(bufin[1]) >> 4);
*(bufout++) = (unsigned char) (DEC(bufin[1]) << 4 | DEC(bufin[2]) >> 2);
@@ -192,7 +192,7 @@ PUBLIC int HTUU_decode ARGS3(char *, bufcoded,
bufin += 4;
nprbytes -= 4;
}
if(nprbytes & 03) {
if(pr2six[bufin[-2]] > MAXVAL) {
nbytesdecoded -= 2;

View File

@@ -1,11 +1,11 @@
/* ENCODING TO PRINTABLE CHARACTERS
File module provides functions HTUU_encode() and HTUU_decode() which convert a buffer
of bytes to/from RFC 1113 printable encoding format. This technique is similar to the
familiar Unix uuencode format in that it maps 6 binary bits to one ASCII character (or
more aptly, 3 binary bytes to 4 ASCII characters). However, RFC 1113 does not use the
same mapping to printable characters as uuencode.
*/
#ifndef HTUU_H

View File

@@ -1,16 +1,16 @@
/* Utitlity macros for the W3 code library
MACROS FOR GENERAL USE
Generates: HTUtils.h
See also: the system dependent file "tcp.h"
*/
#ifndef DEBUG
#define DEBUG /* Noone ever turns this off as trace is too important */
#endif /* Keeep option for really small memory applications tho */
#ifndef HTUTILS_H
#define HTUTILS_H
@@ -154,8 +154,8 @@ Macros for declarations
t a; u b; v c; w d; x e; y f; z g; s h; r i;
#define ARGS10(t,a,u,b,v,c,w,d,x,e,y,f,z,g,s,h,r,i,q,j) (a,b,c,d,e,f,g,h,i,j) \
t a; u b; v c; w d; x e; y f; z g; s h; r i; q j;
#endif /* __STDC__ (ANSI) */
#ifndef NULL
@@ -248,7 +248,7 @@ Upper- and Lowercase macros
The problem here is that toupper(x) is not defined officially unless isupper(x) is.
These macros are CERTAINLY needed on #if defined(pyr) || define(mips) or BDSI
platforms. For safefy, we make them mandatory.
*/
#include <ctype.h>

View File

@@ -14,8 +14,8 @@
** History
** Sep 91 TBL adapted shell-ui.c (BK) with HTRetrieve.c from WWW.
** Feb 91 TBL Generated HTML cleaned up a bit (quotes, escaping)
** Refers to lists of sources.
** Mar 93 TBL Lib 2.0 compatible module made.
** Refers to lists of sources.
** Mar 93 TBL Lib 2.0 compatible module made.
**
** Bugs
** Uses C stream i/o to read and write sockets, which won't work
@@ -69,7 +69,7 @@
#include "HTML.h" /* The object we will generate */
#include "HTFile.h"
#include "HTAlert.h"
/* #include "ParseWSRC.h" */
#ifndef DISABLE_TRACE
@@ -143,7 +143,7 @@ PRIVATE BOOL acceptable_inited = NO;
PRIVATE void init_acceptable NOARGS
{
unsigned int i;
char * good =
char * good =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./-_$";
for(i=0; i<256; i++) acceptable[i] = NO;
for(;*good; good++) acceptable[(unsigned int)*good] = YES;
@@ -196,11 +196,11 @@ PRIVATE char * WWW_from_WAIS ARGS1(any *, docid)
char * p = (docid->bytes);
int i, l;
#ifndef DISABLE_TRACE
if (www2Trace)
if (www2Trace)
{
char *p;
fprintf(stderr, "WAIS id (%d bytes) is ", (int)docid->size);
for (p = docid->bytes; p < docid->bytes + docid->size; p++)
for (p = docid->bytes; p < docid->bytes + docid->size; p++)
{
if ((*p >= ' ') && (*p<= '~')) /* Assume ASCII! */
fprintf(stderr, "%c", *p);
@@ -208,12 +208,12 @@ PRIVATE char * WWW_from_WAIS ARGS1(any *, docid)
fprintf(stderr, "<%x>", (unsigned)*p);
}
fprintf(stderr, "\n");
}
}
#endif
for (p = docid->bytes;
(p < docid->bytes+docid->size) &&
(q < &buf[BIG]);)
for (p = docid->bytes;
(p < docid->bytes+docid->size) &&
(q < &buf[BIG]);)
{
#ifndef DISABLE_TRACE
if (www2Trace) fprintf(stderr, " Record type %d, length %d\n",
@@ -235,10 +235,10 @@ PRIVATE char * WWW_from_WAIS ARGS1(any *, docid)
l = l + (int)((unsigned char)*p);
p++;
}
for (i = 0; i < l; i++, p++)
{
if (!acceptable[(unsigned char)*p])
if (!acceptable[(unsigned char)*p])
{
*q++ = HEX_ESCAPE;
*q++ = hex[((unsigned char)*p) >> 4];
@@ -250,8 +250,8 @@ PRIVATE char * WWW_from_WAIS ARGS1(any *, docid)
}
*q++ = 0; /* Terminate string */
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf(stderr, "WWW form of id: %s\n", buf);
if (www2Trace)
fprintf(stderr, "WWW form of id: %s\n", buf);
#endif
{
@@ -282,40 +282,40 @@ PRIVATE any * WAIS_from_WWW ARGS2 (any *, docid, char *, docname)
int n; /* size */
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf(stderr, "WWW id (to become WAIS id): %s\n", docname);
if (www2Trace)
fprintf(stderr, "WWW id (to become WAIS id): %s\n", docname);
#endif
for(n=0, p = docname; *p; p++)
for(n=0, p = docname; *p; p++)
{ /* Count sizes of strings */
n++;
if (*p == ';') n--; /* Not converted */
else if (*p == HEX_ESCAPE) n=n-2; /* Save two bytes */
docid->size = n;
}
docid->bytes = (char *) malloc(docid->size + 32); /* result record */
z = docid->bytes;
for(p = docname; *p; )
for(p = docname; *p; )
{
q = strchr(p, '=');
if (!q)
if (!q)
return 0;
*q = '\0';
*z++ = atoi(p);
*q = '=';
s = strchr(q, ';'); /* (Check only) */
if (!s)
if (!s)
return 0; /* Bad! No ';'; */
sor = z; /* Remember where the size field was */
z++; /* Skip record size for now */
{
int len;
int tmp;
for(p=q+1; *p!=';' ; )
for(p=q+1; *p!=';' ; )
{
if (*p == HEX_ESCAPE)
if (*p == HEX_ESCAPE)
{
char c;
unsigned int b;
@@ -323,17 +323,17 @@ PRIVATE any * WAIS_from_WWW ARGS2 (any *, docid, char *, docname)
c = *p++;
b = from_hex(c);
c = *p++;
if (!c)
if (!c)
break; /* Odd number of chars! */
*z++ = (b<<4) + from_hex(c);
}
else
}
else
{
*z++ = *p++; /* Record */
}
}
len = (z-sor-1);
z = sor;
if (len > 127)
{
@@ -349,10 +349,10 @@ PRIVATE any * WAIS_from_WWW ARGS2 (any *, docid, char *, docname)
}
z++;
}
for(p=q+1; *p!=';' ; )
for(p=q+1; *p!=';' ; )
{
if (*p == HEX_ESCAPE)
if (*p == HEX_ESCAPE)
{
char c;
unsigned int b;
@@ -360,20 +360,20 @@ PRIVATE any * WAIS_from_WWW ARGS2 (any *, docid, char *, docname)
c = *p++;
b = from_hex(c);
c = *p++;
if (!c)
if (!c)
break; /* Odd number of chars! */
*z++ = (b<<4) + from_hex(c);
}
else
}
else
{
*z++ = *p++; /* Record */
}
}
p++; /* After semicolon: start of next record */
}
#ifndef DISABLE_TRACE
if (www2Trace)
if (www2Trace)
{
char *p;
fprintf(stderr, "WAIS id (%d bytes) is ", (int)docid->size);
@@ -384,10 +384,10 @@ PRIVATE any * WAIS_from_WWW ARGS2 (any *, docid, char *, docname)
fprintf(stderr, "<%x>", (unsigned)*p);
}
fprintf(stderr, "\n");
}
}
#endif
return docid; /* Ok */
} /* WAIS_from_WWW */
@@ -406,7 +406,7 @@ PRIVATE void output_text_record ARGS3(
on unsigned char from the start. What was he thinking??? */
PUTBLOCK((unsigned char *)record->DocumentText->bytes,
record->DocumentText->size);
}
}
} /* output text record */
@@ -435,9 +435,9 @@ display_search_response ARGS4(
}
archie = strstr(database, "archie")!=0; /* Specical handling */
#ifndef DISABLE_TRACE
if (www2Trace)
if (www2Trace)
fprintf(stderr, "HTWAIS: Displaying search response\n");
#endif
#ifndef DISABLE_TRACE
@@ -463,7 +463,7 @@ display_search_response ARGS4(
if ( response->DatabaseDiagnosticRecords != 0 ) {
info = (WAISSearchResponse *)response->DatabaseDiagnosticRecords;
i =0;
i =0;
if (info->Diagnostics != NULL)
showDiags((HTStream*)target, info->Diagnostics);
@@ -479,8 +479,8 @@ display_search_response ARGS4(
/* Make a printable string out of the document id.
*/
#ifndef DISABLE_TRACE
if (www2Trace) fprintf(stderr,
"HTWAIS: %2ld: Score: %4ld, lines:%4ld '%s'\n",
if (www2Trace) fprintf(stderr,
"HTWAIS: %2ld: Score: %4ld, lines:%4ld '%s'\n",
i,
(long int)(info->DocHeaders[k]->Score),
(long int)(info->DocHeaders[k]->Lines),
@@ -539,7 +539,7 @@ display_search_response ARGS4(
{
strcat (types_array, "TEXT");
}
sprintf(line, "%s/%s/%d/%s",
dbname,
types_array,
@@ -547,7 +547,7 @@ display_search_response ARGS4(
docname);
PUTS ("<A HREF=\"");
if (head->Types && head->Types[0] &&
if (head->Types && head->Types[0] &&
strcmp (head->Types[0], "URL") == 0)
{
/* The real URL, maybe? */
@@ -574,7 +574,7 @@ display_search_response ARGS4(
}
} /* next document header */
} /* if there were any document headers */
if ( info->ShortHeaders != 0 ) {
k =0;
while (info->ShortHeaders[k] != 0 ) {
@@ -653,9 +653,9 @@ static int mosaic_connect_to_server(char *host_name, long port, FILE **fp)
FILE* file;
long fd;
int rv;
rv = fd_mosaic_connect_to_server (host_name, port, &fd);
if(rv == 0)
if(rv == 0)
{
HTProgress ("Could not connect to WAIS server.");
return 0;
@@ -666,7 +666,7 @@ static int mosaic_connect_to_server(char *host_name, long port, FILE **fp)
return -1;
}
if ((file = fdopen(fd,"r+")) == NULL)
if ((file = fdopen(fd,"r+")) == NULL)
{
HTProgress ("Could not open WAIS connection for reading.");
return 0;
@@ -679,7 +679,7 @@ static int mosaic_connect_to_server(char *host_name, long port, FILE **fp)
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
/* Pulled in from gui.c; corresponds to Rdata.max_wais_responses. */
extern int max_wais_responses;
@@ -706,7 +706,7 @@ PUBLIC int HTLoadWAIS ARGS4(
long request_buffer_length; /* how of the request is left */
SearchResponseAPDU *retrieval_response = 0;
char keywords[MAX_KEYWORDS_LENGTH + 1];
char *server_name;
char *server_name;
char *wais_database = NULL; /* name of current database */
char *www_database; /* Same name escaped */
char *service;
@@ -719,57 +719,57 @@ PUBLIC int HTLoadWAIS ARGS4(
BOOL ok = NO;
WAISSearchResponse *response;
diagnosticRecord **diag;
if (!acceptable_inited)
if (!acceptable_inited)
init_acceptable();
/* Decipher and check syntax of WWW address:
** ----------------------------------------
**
** First we remove the "wais:" if it was spcified. 920110
*/
*/
names = HTParse(arg, "", PARSE_HOST | PARSE_PATH | PARSE_PUNCTUATION);
key = strchr(names, '?');
if (key)
if (key)
{
char * p;
*key++ = 0; /* Split off keywords */
for (p=key; *p; p++) if (*p == '+') *p = ' ';
HTUnEscape(key);
}
if (names[0]== '/')
if (names[0]== '/')
{
server_name = names+1;
if (*server_name == '/')
server_name++; /* Accept one or two */
www_database = strchr(server_name,'/');
if (www_database)
if (www_database)
{
*www_database++ = 0; /* Separate database name */
doctype = strchr(www_database, '/');
if (key)
if (key)
ok = YES; /* Don't need doc details */
else if (doctype)
else if (doctype)
{ /* If not search parse doc details */
*doctype++ = 0; /* Separate rest of doc address */
doclength = strchr(doctype, '/');
if(doclength)
if(doclength)
{
*doclength++ = 0;
/* OK, now doclength should be the rest of the URL,
right??? */
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf (stderr,
fprintf (stderr,
"WAIS: doctype '%s', doclength\n~~~~\n%s\n~~~~\n",
doctype, doclength);
#endif
/* Multitype! */
if (strchr (doctype, ','))
{
HTStructured *target =
HTStructured *target =
HTML_new(anAnchor, format_out, sink);
char *t, *oldt, *newt, *revised;
int first;
@@ -787,7 +787,7 @@ PUBLIC int HTLoadWAIS ARGS4(
START(HTML_TITLE);
PUTS("Multiple Format Opportunity");
END(HTML_TITLE);
START(HTML_H1);
PUTS("Multiple Format Opportunity");
END(HTML_H1);
@@ -801,7 +801,7 @@ PUBLIC int HTLoadWAIS ARGS4(
with leading period. */
oldt = (char *)malloc (strlen (t) + 16);
sprintf (oldt, ".%s", t);
first = 1;
while (t && *t)
@@ -816,7 +816,7 @@ PUBLIC int HTLoadWAIS ARGS4(
PUTS("/");
PUTS(doclength);
PUTS("\">");
/* Unescape t in place; we don't need it anymore
after this anyway. */
HTUnEscape (t);
@@ -826,37 +826,37 @@ PUBLIC int HTLoadWAIS ARGS4(
}
free (oldt);
PUTS("</ul>");
END_TARGET;
FREE_TARGET;
/* Hey, WE'RE DONE! */
free (names);
return HT_LOADED;
}
document_length = atol(doclength);
if (document_length)
if (document_length)
{
docname=strchr(doclength, '/');
if (docname)
if (docname)
{
*docname++ = 0;
ok = YES; /* To avoid a goto! */
} /* if docname */
} /* if document_length valid */
} /* if doclength */
}
else
}
else
{ /* no doctype? Assume index required */
if (!key) key = "";
ok = YES;
} /* if doctype */
} /* if database */
}
if (!ok)
{
free (names);
@@ -864,16 +864,16 @@ PUBLIC int HTLoadWAIS ARGS4(
}
#ifndef DISABLE_TRACE
if (www2Trace)
if (www2Trace)
fprintf(stderr, "HTWAIS: Parsed OK; type is '%s'\n", doctype);
#endif
service = strchr(names, ':');
if (service)
if (service)
*service++ = 0;
else
else
service = "210";
if (server_name[0] == 0)
connection = NULL;
else if (!(key && !*key))
@@ -907,94 +907,94 @@ PUBLIC int HTLoadWAIS ARGS4(
StrAllocCopy(wais_database,www_database);
HTUnEscape(wais_database);
/* This below fixed size stuff is terrible */
request_message = (char*)s_malloc((size_t)MAX_MESSAGE_LEN * sizeof(char));
response_message = (char*)s_malloc((size_t)MAX_MESSAGE_LEN * sizeof(char));
/* If keyword search is performed but there are no keywords,
** the user has followed a link to the index itself. It would be
** appropriate at this point to send him the .SRC file - how?
*/
if (key && !*key)
if (key && !*key)
{ /* I N D E X */
HTStructured * target = HTML_new(anAnchor, format_out, sink);
START(HTML_TITLE);
PUTS(wais_database);
PUTS(" index");
END(HTML_TITLE);
START(HTML_H1);
PUTS(wais_database);
END(HTML_H1);
START(HTML_ISINDEX);
START(HTML_P);
END_TARGET;
if (connection)
if (connection)
FW_close_connection(connection);
FREE_TARGET;
}
else if (key)
}
else if (key)
{ /* S E A R C H */
char *p;
HTStructured * target;
strncpy(keywords, key, MAX_KEYWORDS_LENGTH);
while(p=strchr(keywords, '+'))
while(p=strchr(keywords, '+'))
*p = ' ';
/* Send advance title to get something fast to the other end */
target = HTML_new(anAnchor, format_out, sink);
START(HTML_TITLE);
PUTS(keywords);
PUTS(" (in ");
PUTS(wais_database);
PUTS(")");
END(HTML_TITLE);
START(HTML_H1);
PUTS(keywords);
END(HTML_H1);
START(HTML_ISINDEX);
request_buffer_length = MAX_MESSAGE_LEN; /* Amount left */
#ifndef DISABLE_TRACE
if (www2Trace) fprintf(stderr, "HTWAIS: Search for `%s' in `%s'\n",
keywords, wais_database);
#endif
if(NULL == generate_search_apdu(request_message + HEADER_LENGTH,
&request_buffer_length,
if(NULL == generate_search_apdu(request_message + HEADER_LENGTH,
&request_buffer_length,
keywords, wais_database, NULL, MAXDOCS))
{
HTProgress ("WAIS request too large; something went wrong.");
}
if(!interpret_message(request_message,
MAX_MESSAGE_LEN - request_buffer_length,
if(!interpret_message(request_message,
MAX_MESSAGE_LEN - request_buffer_length,
response_message,
MAX_MESSAGE_LEN,
connection,
false /* true verbose */
))
))
{
HTProgress ("WAIS returned message too large; something went wrong.");
}
else
}
else
{ /* returned message ok */
SearchResponseAPDU *query_response = 0;
readSearchResponseAPDU(&query_response,
response_message + HEADER_LENGTH);
/* We do want this to be called if !query_response, to
get our cute error message. */
display_search_response(target,
display_search_response(target,
query_response, wais_database, keywords);
if (query_response)
{
@@ -1003,13 +1003,13 @@ PUBLIC int HTLoadWAIS ARGS4(
freeSearchResponseAPDU( query_response);
}
} /* returned message not too large */
END_TARGET;
if (connection)
if (connection)
FW_close_connection(connection);
FREE_TARGET;
}
else
}
else
{ /* D O C U M E N T F E T C H */
HTFormat format_in;
HTStream * target;
@@ -1025,7 +1025,7 @@ PUBLIC int HTLoadWAIS ARGS4(
fprintf(stderr,
"===WAIS=== Retrieve document id `%s' type `%s' length %ld\n",
docname, doctype, document_length);
#endif
#endif
{
char *tmp_doctype = strdup (doctype);
char *tmp;
@@ -1044,59 +1044,59 @@ PUBLIC int HTLoadWAIS ARGS4(
char dummy[256];
HTAtom *pencoding;
int compressed;
sprintf (dummy, "foo.%s", doctype);
format_in = HTFileFormat (dummy, &pencoding,
WWW_PLAINTEXT, &compressed);
/* Assume it will always be at *least* WWW_PLAINTEXT. */
}
target = HTStreamStack(format_in, format_out, 0, sink, anAnchor);
if (!target)
if (!target)
{
free (names);
if (connection)
if (connection)
FW_close_connection(connection);
return HT_NOT_LOADED;
}
/* Decode hex or literal format for document ID
*/
*/
WAIS_from_WWW(docid, docname);
/* Loop over slices of the document
*/
*/
{
int bytes = 0, intr;
char line[256];
HTClearActiveIcon ();
count = 0;
while (1)
{
char *type = s_strdup(doctype); /* Gets freed I guess */
request_buffer_length = MAX_MESSAGE_LEN; /* Amount left */
#ifndef DISABLE_TRACE
if (www2Trace)
if (www2Trace)
fprintf(stderr, "HTWAIS: Slice number %ld\n", count);
#endif
intr = HTCheckActiveIcon (1);
if (intr)
{
HTProgress ("Data transfer interrupted.");
(*target->isa->handle_interrupt)(target);
free (names);
if (connection)
if (connection)
FW_close_connection(connection);
return HT_INTERRUPTED;
}
if(generate_retrieval_apdu
(request_message + HEADER_LENGTH,
&request_buffer_length,
docid,
&request_buffer_length,
docid,
CT_byte,
count * CHARS_PER_PAGE,
(count + 1) * CHARS_PER_PAGE,
@@ -1104,33 +1104,33 @@ PUBLIC int HTLoadWAIS ARGS4(
wais_database
) == 0)
{
HTProgress
HTProgress
("WAIS error condition; retrieval may be unsuccessful.");
}
free (type);
/* Actually do the transaction given by request_message */
/* Actually do the transaction given by request_message */
if(0 ==
interpret_message
(request_message,
MAX_MESSAGE_LEN - request_buffer_length,
(request_message,
MAX_MESSAGE_LEN - request_buffer_length,
response_message,
MAX_MESSAGE_LEN,
connection,
false /* true verbose */
false /* true verbose */
))
{
HTProgress ("WAIS error condition; retrieval may be unsuccessful.");
goto no_more_data;
}
/* Parse the result which came back into memory.
*/
readSearchResponseAPDU(&retrieval_response,
readSearchResponseAPDU(&retrieval_response,
response_message + HEADER_LENGTH);
response =
response =
(WAISSearchResponse *)retrieval_response->DatabaseDiagnosticRecords;
diag = response->Diagnostics;
@@ -1141,11 +1141,11 @@ PUBLIC int HTLoadWAIS ARGS4(
fprintf (stderr, "WAIS: no more data (NULL response->Text)\n");
#endif
if (retrieval_response->DatabaseDiagnosticRecords)
freeWAISSearchResponse
freeWAISSearchResponse
(retrieval_response->DatabaseDiagnosticRecords);
freeSearchResponseAPDU (retrieval_response);
goto no_more_data;
}
}
else if
(((WAISSearchResponse *)
retrieval_response->DatabaseDiagnosticRecords)->Text[0]->DocumentText->size)
@@ -1163,7 +1163,7 @@ PUBLIC int HTLoadWAIS ARGS4(
fprintf (stderr, "WAIS: no more data (fell through)\n");
#endif
if (retrieval_response->DatabaseDiagnosticRecords)
freeWAISSearchResponse
freeWAISSearchResponse
(retrieval_response->DatabaseDiagnosticRecords);
freeSearchResponseAPDU (retrieval_response);
goto no_more_data;
@@ -1184,39 +1184,39 @@ PUBLIC int HTLoadWAIS ARGS4(
fprintf (stderr, "WAIS: no more data (diag)\n");
#endif
if (retrieval_response->DatabaseDiagnosticRecords)
freeWAISSearchResponse
freeWAISSearchResponse
(retrieval_response->DatabaseDiagnosticRecords);
freeSearchResponseAPDU (retrieval_response);
goto no_more_data;
}
if (retrieval_response->DatabaseDiagnosticRecords)
freeWAISSearchResponse
freeWAISSearchResponse
(retrieval_response->DatabaseDiagnosticRecords);
freeSearchResponseAPDU (retrieval_response);
count++;
} /* Loop over slices */
} /* local variables */
no_more_data:
END_TARGET;
/* Close the connection BEFORE calling system(), which can
happen in the free method. */
if (connection)
if (connection)
FW_close_connection(connection);
FREE_TARGET;
free (docid->bytes);
} /* If document rather than search */
if (wais_database)
if (wais_database)
free (wais_database);
s_free (request_message);
s_free(response_message);
free(names);
return HT_LOADED;
}

View File

@@ -1,26 +1,26 @@
/* WAIS protocol module for the W3 library
WAIS PROTOCOL INTERFACE
This module does not actually perform the WAIS protocol directly, but it does using one
or more library of the freeWAIS distribution. The ui.a library came with the old free
WAIS from TMC, the client.a and wais.a libraries are needed from the freeWAIS from
CNIDR.
If you include this module in the library, you must also
Register the HTWAIS protocol at initialisation (e.g. HTInit or HTSInit) by compiling
it with -DDIRECT_WAIS
Link with the libraries
The wais source files are parsed by a separate and independent module, HTWSRC. You
can include HTWSRC without including direct wais using this module, and your WWW code
will be able to read source files, and access WAIS indexes through a gateway.
A WAIS-WWW gateway is just a normal W3 server with a libwww compiled with this module.
Anyways, this interface won't change much:
*/
#ifndef HTWAIS_H
#define HTWAIS_H

View File

@@ -38,25 +38,25 @@ struct _HTStructured {
/* Here are the parameters which can be specified in a source file
*/
PRIVATE WWW_CONST char* par_name[] = {
"version",
"version",
"ip-address",
#define PAR_IP_NAME 2
"ip-name",
"ip-name",
#define PAR_TCP_PORT 3
"tcp-port",
"tcp-port",
#define PAR_DATABASE_NAME 4
"database-name",
#define PAR_COST 5
"cost",
"cost",
#define PAR_COST_UNIT 6
"cost-unit",
"cost-unit",
#define PAR_FREE 7
"free",
"free",
#define PAR_MAINTAINER 8
"maintainer",
"maintainer",
#define PAR_DESCRIPTION 9
"description",
"keyword-list",
"keyword-list",
"source",
#define PAR_UNKNOWN 12
"unknown",
@@ -127,7 +127,7 @@ PRIVATE void WSRCParser_put_character ARGS2(HTStream*, me, char, c)
case beginning:
if (c=='(') me->state = before_tag;
break;
case before_tag:
if (c==')') {
me->state = done;
@@ -161,7 +161,7 @@ PRIVATE void WSRCParser_put_character ARGS2(HTStream*, me, char, c)
if (me->param_count < PARAM_MAX) me->param[me->param_count++] = c;
}
break;
case before_value:
if (c==')') {
me->state = done;
@@ -173,7 +173,7 @@ PRIVATE void WSRCParser_put_character ARGS2(HTStream*, me, char, c)
me->state = quoted_value;
break;
}
me->state = (c=='"') ? quoted_value :
me->state = (c=='"') ? quoted_value :
(c=='(') ? bracketed_value : value;
me->param[me->param_count++] = c; /* Don't miss first character */
break;
@@ -197,7 +197,7 @@ PRIVATE void WSRCParser_put_character ARGS2(HTStream*, me, char, c)
}
if (me->param_count < PARAM_MAX) me->param[me->param_count++] = c;
break;
case quoted_value:
if (c=='"') {
me->param[me->param_count] = 0;
@@ -205,7 +205,7 @@ PRIVATE void WSRCParser_put_character ARGS2(HTStream*, me, char, c)
me->state = before_tag;
break;
}
if (c=='\\') { /* Ignore escape but switch state */
me->state = escape_in_quoted;
break;
@@ -217,7 +217,7 @@ PRIVATE void WSRCParser_put_character ARGS2(HTStream*, me, char, c)
if (me->param_count < PARAM_MAX) me->param[me->param_count++] = c;
me->state = quoted_value;
break;
case done: /* Ignore anything after EOF */
return;
@@ -257,27 +257,27 @@ PRIVATE void WSRC_gen_html ARGS2(HTStream *, me, BOOL, source_file)
if ( l > 4 && !strcasecomp(shortname + l -4, ".src")) {
shortname[l-4] = 0; /* Chop of .src -- boring! */
}
START(HTML_TITLE);
PUTS(shortname);
PUTS(source_file ? " WAIS source file" : " index");
END(HTML_TITLE);
START(HTML_H1);
PUTS(shortname);
PUTS(source_file ? " description" : " index");
END(HTML_H1);
}
START(HTML_DL); /* Definition list of details */
if (source_file) {
START(HTML_DT);
PUTS("Access links");
START(HTML_DD);
if (me->par_value[PAR_IP_NAME] &&
me->par_value[PAR_DATABASE_NAME]) {
char WSRC_address[256];
char * www_database;
www_database = HTEscape(me->par_value[PAR_DATABASE_NAME]);
@@ -286,15 +286,15 @@ PRIVATE void WSRC_gen_html ARGS2(HTStream *, me, BOOL, source_file)
me->par_value[PAR_TCP_PORT] ? me->par_value[PAR_TCP_PORT]
: "210",
www_database);
PUTS ("<A HREF=\"");
PUTS (WSRC_address);
PUTS ("\">");
PUTS("Direct access");
PUTS("</A>");
PUTS(" or ");
sprintf(WSRC_address, "http://www.ncsa.uiuc.edu:8001/%s:%s/%s",
me->par_value[PAR_IP_NAME],
me->par_value[PAR_TCP_PORT] ? me->par_value[PAR_TCP_PORT]
@@ -305,16 +305,16 @@ PRIVATE void WSRC_gen_html ARGS2(HTStream *, me, BOOL, source_file)
PUTS ("\">");
PUTS("through NCSA gateway");
PUTS("</A>");
free(www_database);
} else {
give_parameter(me, PAR_IP_NAME);
give_parameter(me, PAR_IP_NAME);
}
} /* end if source_file */
if (me->par_value[PAR_MAINTAINER]) {
START(HTML_DT);
PUTS("Maintainer");
@@ -333,10 +333,10 @@ PRIVATE void WSRC_gen_html ARGS2(HTStream *, me, BOOL, source_file)
PUTS(me->par_value[PAR_DESCRIPTION]);
END(HTML_PRE);
}
(*me->target->isa->end_document)(me->target);
(*me->target->isa->free)(me->target);
return;
} /* generate html */
@@ -407,7 +407,7 @@ HTStreamClass WSRCParserClass = {
*/
PUBLIC HTStream* HTWSRCConvert ARGS5(
HTPresentation *, pres,
HTParentAnchor *, anchor,
HTParentAnchor *, anchor,
HTStream *, sink,
HTFormat, format_in,
int, compressed)

View File

@@ -1,12 +1,12 @@
/* A parser for WAIS source files
WAIS SOURCE FILE PARSER
This converter returns a stream object into which a WAIS source file can be written.
The result is put via a structured stream into whatever format was required for the
output stream.
See also: HTWAIS protocol interface module
*/
#ifndef HTWSRC_H
#define HTWSRC_H
@@ -27,10 +27,10 @@ Escaping Strings
HTDeSlash takes out the invlaid characters in a URL path ELEMENT by converting them
into hex-escaped characters. HTEnSlash does the reverse.
Each returns a pointer to a newly allocated string which must eventually be freed by
the caller.
*/
extern char * HTDeSlash PARAMS((WWW_CONST char * str));
@@ -41,5 +41,5 @@ extern char * HTEnSlash PARAMS((WWW_CONST char * str));
/*
Tim BL
*/

View File

@@ -102,7 +102,7 @@ PRIVATE void HTWriter_put_string ARGS2(HTStream *, me, WWW_CONST char*, s)
*/
PRIVATE void HTWriter_write ARGS3(HTStream *, me, WWW_CONST char*, s, int, l)
{
WWW_CONST char *read_pointer = s;
WWW_CONST char *write_pointer = s+l;
@@ -165,14 +165,14 @@ PRIVATE void HTWriter_handle_interrupt ARGS1(HTStream *, me)
** -----------------------
*/
PRIVATE WWW_CONST HTStreamClass HTWriter = /* As opposed to print etc */
{
{
"SocketWriter",
HTWriter_free,
HTWriter_end_document,
HTWriter_put_character, HTWriter_put_string,
HTWriter_write,
HTWriter_handle_interrupt
};
};
/* Subclass-specific Methods
@@ -183,8 +183,8 @@ PUBLIC HTStream* HTWriter_new ARGS1(int, soc)
{
HTStream* me = (HTStream*)malloc(sizeof(*me));
if (me == NULL) outofmem(__FILE__, "HTWriter_new");
me->isa = &HTWriter;
me->isa = &HTWriter;
me->soc = soc;
me->write_pointer = me->buffer;
return me;
@@ -198,7 +198,7 @@ PUBLIC HTStream* HTASCIIWriter ARGS1(int, soc)
{
HTStream* me = (HTStream*)malloc(sizeof(*me));
if (me == NULL) outofmem(__FILE__, "HTASCIIWriter");
me->isa = &HTWriter;
me->isa = &HTWriter;
me->soc = soc;
me->write_pointer = me->buffer;

View File

@@ -1,12 +1,12 @@
/* Rich Hypertext object for libWWW
RICH HYPERTEXT OBJECT
*/
/*
This is the C interface to the Objective-C (or whatever) HyperText class.
*/
#ifndef HTEXT_H
#define HTEXT_H

View File

@@ -1,7 +1,7 @@
# @configure_output@
# This file is used by Autoconf to make the real Makefile.
# DO NOT EDIT THIS FILE!
# If you want to change something do it to the Makefile autoconf
# If you want to change something do it to the Makefile autoconf
# creates. You should never have to edit this file.
CC= @CC@
@@ -60,7 +60,7 @@ HTMailto.c
# HTACL.c \
# HTAAProt.c \
# HTAAServ.c \
# HTAAFile.c
# HTAAFile.c
OBJS = $(CFILES:.c=.o)

View File

@@ -5,7 +5,7 @@
** SGML file, create this object which is a parser. The object
** is (currently) created by being passed a DTD structure,
** and a target HTStructured oject at which to throw the parsed stuff.
**
**
** 6 Feb 93 Binary seraches used. Intreface modified.
*/
#include "../config.h"
@@ -31,7 +31,7 @@ extern int www2Trace;
#define MAX_ATTRIBUTES 20 /* Max number of attributes per element */
/* Element Stack
** -------------
** This allows us to return down the stack reselcting styles.
@@ -50,7 +50,7 @@ struct _HTElement {
struct _HTStream {
WWW_CONST HTStreamClass * isa; /* inherited from HTStream */
WWW_CONST SGML_dtd *dtd;
HTStructuredClass *actions; /* target class */
HTStructured *target; /* target object */
@@ -59,11 +59,11 @@ struct _HTStream {
int current_attribute_number;
HTChunk *string;
HTElement *element_stack;
enum sgml_state { S_text, S_litteral, S_tag, S_tag_gap,
enum sgml_state { S_text, S_litteral, S_tag, S_tag_gap,
S_attr, S_attr_gap, S_equals, S_value,
S_ero, S_cro,
S_squoted, S_dquoted, S_end, S_entity, S_junk_tag} state;
#ifdef CALLERDATA
#ifdef CALLERDATA
void * callerData;
#endif
BOOL present[MAX_ATTRIBUTES]; /* Flags: attribute is present? */
@@ -107,9 +107,9 @@ PRIVATE void handle_attribute_name(context, s)
}
return;
} /* if */
} /* for */
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf(stderr, "SGML: Unknown attribute %s for tag %s\n",
@@ -161,7 +161,7 @@ PRIVATE void handle_entity(context, term)
WWW_CONST char ** entities = context->dtd->entity_names;
WWW_CONST char *s = context->string->data;
int high, low, i, diff;
for(low=0, high = context->dtd->number_of_entities;
high > low ;
@@ -176,7 +176,7 @@ PRIVATE void handle_entity(context, term)
/* If entity string not found, display as text */
#ifndef DISABLE_TRACE
if (www2Trace)
fprintf(stderr, "SGML: Unknown entity %s\n", s);
fprintf(stderr, "SGML: Unknown entity %s\n", s);
#endif
PUTC('&');
{
@@ -213,7 +213,7 @@ PRIVATE void end_element(context, old_tag)
while (context->element_stack) {/* Loop is error path only */
HTElement * N = context->element_stack;
HTTag * t = N->tag;
if (old_tag != t) { /* Mismatch: syntax error */
if (context->element_stack->next) { /* This is not the last level */
#ifndef DISABLE_TRACE
@@ -230,15 +230,15 @@ PRIVATE void end_element(context, old_tag)
return; /* Ignore */
}
}
context->element_stack = N->next; /* Remove from stack */
free(N);
(*context->actions->end_element)(context->target,
t - context->dtd->tags);
if (old_tag == t) return; /* Correct sequence */
/* Syntax error path only */
}
#ifndef DISABLE_TRACE
if (www2Trace) fprintf(stderr,
@@ -257,7 +257,7 @@ PRIVATE void start_element(context)
#endif
{
HTTag * new_tag = context->current_tag;
#ifndef DISABLE_TRACE
if (www2Trace) fprintf(stderr, "SGML: Start <%s>\n", new_tag->name);
#endif
@@ -332,7 +332,7 @@ PUBLIC void SGML_free ARGS1(HTStream *, context)
** particular SGML context.
*/
#ifdef CALLERDATA
#ifdef CALLERDATA
PUBLIC void* SGML_callerData ARGS1(HTStream *, context)
{
return context->callerData;
@@ -360,7 +360,7 @@ PUBLIC void SGML_character ARGS2(HTStream *, context, char,c)
))) {
string->size = 0;
context->state = S_ero;
} else if (c=='<') {
string->size = 0;
context->state = (context->element_stack &&
@@ -378,7 +378,7 @@ PUBLIC void SGML_character ARGS2(HTStream *, context, char,c)
if ( TOUPPER(c) != ((string->size ==1) ? '/'
: context->element_stack->tag->name[string->size-2])) {
int i;
/* If complete match, end litteral */
if ((c=='>') && (!context->element_stack->tag->name[string->size-2])) {
end_element(context, context->element_stack->tag);
@@ -391,20 +391,20 @@ PUBLIC void SGML_character ARGS2(HTStream *, context, char,c)
for (i=0; i<string->size; i++) /* recover */
PUTC(
string->data[i]);
context->state = S_text;
context->state = S_text;
}
break;
/* Character reference or Entity
*/
case S_ero:
if (c=='#') {
context->state = S_cro; /* &# is Char Ref Open */
context->state = S_cro; /* &# is Char Ref Open */
break;
}
context->state = S_entity; /* Fall through! */
/* Handle Entities
*/
case S_entity:
@@ -432,7 +432,7 @@ PUBLIC void SGML_character ARGS2(HTStream *, context, char,c)
break;
/* Tag
*/
*/
case S_tag: /* new tag */
if (isalnum(c))
HTChunkPutc(string, c);
@@ -458,10 +458,10 @@ PUBLIC void SGML_character ARGS2(HTStream *, context, char,c)
break;
}
context->current_tag = t;
/* Clear out attributes
*/
{
int i;
for (i=0; i< context->current_tag->number_of_attributes; i++)
@@ -469,7 +469,7 @@ PUBLIC void SGML_character ARGS2(HTStream *, context, char,c)
}
string->size = 0;
context->current_attribute_number = INVALID;
if (c=='>') {
if (context->current_tag->name) start_element(context);
context->state = S_text;
@@ -479,7 +479,7 @@ PUBLIC void SGML_character ARGS2(HTStream *, context, char,c)
}
break;
case S_tag_gap: /* Expecting attribute or > */
if (WHITE(c)) break; /* Gap between attributes */
if (c=='>') { /* End of tag */
@@ -490,7 +490,7 @@ PUBLIC void SGML_character ARGS2(HTStream *, context, char,c)
HTChunkPutc(string, c);
context->state = S_attr; /* Get attribute */
break;
/* accumulating value */
case S_attr:
if (WHITE(c) || (c=='>') || (c=='=')) { /* End of word */
@@ -507,7 +507,7 @@ PUBLIC void SGML_character ARGS2(HTStream *, context, char,c)
HTChunkPutc(string, c);
}
break;
case S_attr_gap: /* Expecting attribute or = or > */
if (WHITE(c)) break; /* Gap after attribute */
if (c=='>') { /* End of tag */
@@ -521,8 +521,8 @@ PUBLIC void SGML_character ARGS2(HTStream *, context, char,c)
HTChunkPutc(string, c);
context->state = S_attr; /* Get next attribute */
break;
case S_equals: /* After attr = */
case S_equals: /* After attr = */
if (WHITE(c)) break; /* Before attribute value */
if (c=='>') { /* End of tag */
#ifndef DISABLE_TRACE
@@ -531,7 +531,7 @@ PUBLIC void SGML_character ARGS2(HTStream *, context, char,c)
if (context->current_tag->name) start_element(context);
context->state = S_text;
break;
} else if (c=='\'') {
context->state = S_squoted;
break;
@@ -543,7 +543,7 @@ PUBLIC void SGML_character ARGS2(HTStream *, context, char,c)
HTChunkPutc(string, c);
context->state = S_value;
break;
case S_value:
if (WHITE(c) || (c=='>')) { /* End of word */
HTChunkTerminate(string) ;
@@ -559,7 +559,7 @@ PUBLIC void SGML_character ARGS2(HTStream *, context, char,c)
HTChunkPutc(string, c);
}
break;
case S_squoted: /* Quoted attribute value */
if (c=='\'') { /* End of attribute value */
HTChunkTerminate(string) ;
@@ -570,7 +570,7 @@ PUBLIC void SGML_character ARGS2(HTStream *, context, char,c)
HTChunkPutc(string, c);
}
break;
case S_dquoted: /* Quoted attribute value */
if (c=='"') { /* End of attribute value */
HTChunkTerminate(string) ;
@@ -581,7 +581,7 @@ PUBLIC void SGML_character ARGS2(HTStream *, context, char,c)
HTChunkPutc(string, c);
}
break;
case S_end: /* </ */
if (isalnum(c))
HTChunkPutc(string, c);
@@ -596,7 +596,7 @@ PUBLIC void SGML_character ARGS2(HTStream *, context, char,c)
if (!t) {
#ifndef DISABLE_TRACE
if(www2Trace) fprintf(stderr,
"Unknown end tag </%s>\n", string->data);
"Unknown end tag </%s>\n", string->data);
#endif
} else {
context->current_tag = t;
@@ -618,12 +618,12 @@ PUBLIC void SGML_character ARGS2(HTStream *, context, char,c)
}
break;
case S_junk_tag:
if (c=='>') {
context->state = S_text;
}
} /* switch on context->state */
} /* SGML_character */
@@ -655,14 +655,14 @@ PRIVATE void SGML_handle_interrupt ARGS1(HTStream *, context)
/* Structured Object Class
** -----------------------
*/
PUBLIC WWW_CONST HTStreamClass SGMLParser =
{
PUBLIC WWW_CONST HTStreamClass SGMLParser =
{
"SGMLParser",
SGML_free,
SGML_end,
SGML_character, SGML_string, SGML_write,
SGML_handle_interrupt
};
};
/* Create SGML Engine
** ------------------
@@ -689,9 +689,9 @@ PUBLIC HTStream* SGML_new ARGS2(
/* Ugh: no OO */
context->state = S_text;
context->element_stack = 0; /* empty */
#ifdef CALLERDATA
#ifdef CALLERDATA
context->callerData = (void*) callerData;
#endif
#endif
for(i=0; i<MAX_ATTRIBUTES; i++) context->value[i] = 0;
return context;

View File

@@ -1,6 +1,6 @@
/* /Net/dxcern/userd/timbl/hypertext/WWW/Library/Implementation/SGML.html
SGML AND STRUCTURED STREAMS
The SGML parser is a state machine. It is called for every
character of the input stream. The DTD data structure contains
pointers to functions which are called to implement the actual
@@ -9,12 +9,12 @@
function is passed a pointer to the curent tag structure, and an
"element stack" which represents the state of nesting within SGML
elements.
The following aspects are from Dan Connolly's suggestions: Binary
search, Strcutured object scheme basically, SGML content enum type.
(c) Copyright CERN 1991 - See Copyright.html
*/
#ifndef SGML_H
#define SGML_H
@@ -124,29 +124,29 @@ typedef struct _HTStructuredClass{
void (*end_document) PARAMS((
HTStructured* me));
void (*handle_interrupt) PARAMS((
HTStructured* me));
void (*put_character) PARAMS((
HTStructured* me,
char ch));
void (*put_string) PARAMS((
HTStructured* me,
WWW_CONST char * str));
void (*write) PARAMS((
HTStructured* me,
WWW_CONST char * str,
int len));
void (*start_element) PARAMS((
HTStructured* me,
int element_number,
WWW_CONST BOOL* attribute_present,
WWW_CONST char** attribute_value));
void (*end_element) PARAMS((
HTStructured* me,
int element_number));
@@ -154,7 +154,7 @@ typedef struct _HTStructuredClass{
void (*put_entity) PARAMS((
HTStructured* me,
int entity_number));
}HTStructuredClass;

View File

@@ -1,18 +1,18 @@
/* System dependencies in the W3 library
SYSTEM DEPENDENCIES
System-system differences for TCP include files and macros. This
file includes for each system the files necessary for network and
file I/O.
AUTHORS
TBL Tim Berners-Lee, W3 project, CERN, <timbl@info.cern.ch>
EvA Eelco van Asperen <evas@cs.few.eur.nl>
MA Marc Andreessen NCSA
AT Aleksandar Totic <atotic@ncsa.uiuc.edu>
SCW Susan C. Weber <sweber@kyle.eitech.com>
HISTORY:
22 Feb 91 Written (TBL) as part of the WWW library.
16 Jan 92 PC code from EvA
@@ -37,7 +37,7 @@ Default values
These values may be reset and altered by system-specific sections
later on. there are also a bunch of defaults at the end .
*/
/* Default values of those: */
#define NETCLOSE close /* Routine to close a TCP-IP socket */
@@ -102,19 +102,19 @@ VAX/VMS
Under VMS, there are many versions of TCP-IP. Define one if you do
not use Digital's UCX product:
UCX DEC's "Ultrix connection" (default)
WIN_TCP From Wollongong, now GEC software.
MULTINET From SRI, now from TGV Inv.
DECNET Cern's TCP socket emulation over DECnet
The last three do not interfere with the
unix i/o library, and so they need special calls to read, write and
close sockets. In these cases the socket number is a VMS channel
number, so we make the @@@ HORRIBLE @@@ assumption that a channel
number will be greater than 10 but a unix file descriptor less than
10. It works.
*/
#ifdef vms
#ifdef WIN_TCP
@@ -221,7 +221,7 @@ extern int errno;
Regular BSD unix versions
These are a default unix where not already defined specifically.
*/
#ifndef INCLUDES_DONE
#include <sys/types.h>
@@ -257,7 +257,7 @@ Regular BSD unix versions
Defaults
INCLUDE FILES FOR TCP
*/
#ifndef TCP_INCLUDES_DONE
#include <sys/ioctl.h> /* EJB */
@@ -273,7 +273,7 @@ Defaults
/*
MACROS FOR MANIPULATING MASKS FOR SELECT()
*/
#ifdef SELECT
#ifndef FD_SET