version 1.42, 1997/10/13 11:47:24
|
version 1.43, 1997/11/05 17:27:12
|
Line 424 Document doc;
|
Line 424 Document doc;
|
ElementType elType; |
ElementType elType; |
AttributeType attrType; |
AttributeType attrType; |
Attribute attr; |
Attribute attr; |
char used_sep = URL_SEP; |
|
char *used_str; |
|
char *ptr, *basename; |
char *ptr, *basename; |
int length; |
int length; |
|
|
Line 451 Document doc;
|
Line 449 Document doc;
|
TtaGiveTextAttributeValue (attr, basename, &length); |
TtaGiveTextAttributeValue (attr, basename, &length); |
/* base and orgName have to be separated by a DIR_SEP */ |
/* base and orgName have to be separated by a DIR_SEP */ |
length--; |
length--; |
|
if (basename[0] != EOS && basename[length] != URL_SEP && basename[length] != DIR_SEP) |
if (basename [0] != EOS && strchr (basename, URL_SEP)) |
|
{ |
|
used_str = URL_STR; |
|
used_sep = URL_SEP; |
|
} |
|
else |
|
{ |
|
used_str = DIR_STR; |
|
used_sep = DIR_SEP; |
|
} |
|
|
|
if (basename[0] != EOS && basename[length] != used_sep) |
|
/* verify if the base has the form "protocol://server:port" */ |
/* verify if the base has the form "protocol://server:port" */ |
{ |
{ |
ptr = AmayaParseUrl (basename, "", AMAYA_PARSE_ACCESS | |
ptr = AmayaParseUrl (basename, "", AMAYA_PARSE_ACCESS | |
Line 471 Document doc;
|
Line 457 Document doc;
|
AMAYA_PARSE_PUNCTUATION); |
AMAYA_PARSE_PUNCTUATION); |
if (ptr && !strcmp (ptr, basename)) |
if (ptr && !strcmp (ptr, basename)) |
{ |
{ |
/* it has this form, we complete it by adding a DIR_STR */ |
/* it has this form, we complete it by adding a URL_STR */ |
strcat (basename, used_str); |
if (strchr (basename, DIR_SEP)) |
|
strcat (basename, DIR_STR); |
|
else |
|
strcat (basename, URL_STR); |
length++; |
length++; |
} |
} |
if (ptr) |
if (ptr) |
Line 480 Document doc;
|
Line 469 Document doc;
|
} |
} |
} |
} |
} |
} |
else |
|
{ |
|
if (basename [0] != EOS && strchr (basename, URL_SEP)) |
|
{ |
|
used_str = URL_STR; |
|
used_sep = URL_SEP; |
|
} |
|
else |
|
{ |
|
used_str = DIR_STR; |
|
used_sep = DIR_SEP; |
|
} |
|
} |
|
|
|
/* Remove anything after the last DIR_SEP char. If no such char is found, |
/* Remove anything after the last DIR_SEP char. If no such char is found, |
* then search for the first ":" char, hoping that what's before that is a |
* then search for the first ":" char, hoping that what's before that is a |
Line 501 Document doc;
|
Line 477 Document doc;
|
*/ |
*/ |
length = strlen (basename) - 1; |
length = strlen (basename) - 1; |
/* search for the last DIR_SEP char */ |
/* search for the last DIR_SEP char */ |
while (length >= 0 && basename[length] != used_sep) |
while (length >= 0 && basename[length] != URL_SEP && basename[length] != DIR_SEP) |
length--; |
length--; |
if (length >= 0) |
if (length >= 0) |
/* found the last DIR_SEP char, end the string there */ |
/* found the last DIR_SEP char, end the string there */ |
Line 593 char *docName;
|
Line 569 char *docName;
|
char tempOrgName[MAX_LENGTH]; |
char tempOrgName[MAX_LENGTH]; |
char *ptr; |
char *ptr; |
int length; |
int length; |
char used_sep; |
|
char *used_str; |
|
|
|
if (!newName || !docName) |
if (!newName || !docName) |
return; |
return; |
Line 604 char *docName;
|
Line 578 char *docName;
|
else |
else |
basename = (char *) NULL; |
basename = (char *) NULL; |
|
|
/*if (strchr (orgName, URL_SEP) || (basename && strchr (basename, URL_SEP))) {*/ |
|
if (strchr (orgName, DIR_SEP)) { |
|
used_str = DIR_STR; |
|
used_sep = DIR_SEP; |
|
} else { |
|
used_str = URL_STR; |
|
used_sep = URL_SEP; |
|
} |
|
|
|
/* |
/* |
* Clean orgName |
* Clean orgName |
* Make sure we have a complete orgName, without any leading or trailing |
* Make sure we have a complete orgName, without any leading or trailing |
* white spaces, or trailinbg new lines |
* white spaces, or trailinbg new lines |
*/ |
*/ |
|
|
ptr = orgName; |
ptr = orgName; |
/* skip leading white space and new line characters */ |
/* skip leading white space and new line characters */ |
while ((*ptr == ' ' || *ptr == EOL) && *ptr++ != EOS); |
while ((*ptr == ' ' || *ptr == EOL) && *ptr++ != EOS); |
Line 652 char *docName;
|
Line 616 char *docName;
|
ptr = AmayaParseUrl (newName, "", AMAYA_PARSE_ACCESS | AMAYA_PARSE_HOST | |
ptr = AmayaParseUrl (newName, "", AMAYA_PARSE_ACCESS | AMAYA_PARSE_HOST | |
AMAYA_PARSE_PUNCTUATION); |
AMAYA_PARSE_PUNCTUATION); |
if (ptr && !strcmp (ptr, newName)) |
if (ptr && !strcmp (ptr, newName)) |
{ |
/* it has this form, we complete it by adding a DIR_STR */ |
/* it has this form, we complete it by adding a DIR_STR */ |
strcat (newName, URL_STR); |
strcat (newName, used_str); |
|
} |
|
if (ptr) |
if (ptr) |
TtaFreeMemory (ptr); |
TtaFreeMemory (ptr); |
} |
} |
Line 664 char *docName;
|
Line 627 char *docName;
|
strcpy (newName, tempOrgName); |
strcpy (newName, tempOrgName); |
else |
else |
{ |
{ |
|
|
/* Calculate the absolute URL, using the base or document URL */ |
/* Calculate the absolute URL, using the base or document URL */ |
|
|
ptr = AmayaParseUrl (tempOrgName, basename, AMAYA_PARSE_ALL); |
ptr = AmayaParseUrl (tempOrgName, basename, AMAYA_PARSE_ALL); |
if (ptr) |
if (ptr) |
{ |
{ |
Line 679 char *docName;
|
Line 640 char *docName;
|
} |
} |
|
|
TtaFreeMemory (basename); |
TtaFreeMemory (basename); |
|
|
/* |
/* |
* Prepare the docname that will refer to this ressource in the |
* Prepare the docname that will refer to this ressource in the |
* .amaya directory. If the new URL finishes on DIR_SEP, then use |
* .amaya directory. If the new URL finishes on DIR_SEP, then use |
Line 688 char *docName;
|
Line 648 char *docName;
|
if (newName[0] != EOS) |
if (newName[0] != EOS) |
{ |
{ |
length = strlen (newName) - 1; |
length = strlen (newName) - 1; |
if (newName[length] == used_sep) |
if (newName[length] == URL_SEP || newName[length] == DIR_SEP) |
{ |
{ |
/* docname was not comprised inside the URL, so let's */ |
/* docname was not comprised inside the URL, so let's */ |
/* assign the default ressource name */ |
/* assign the default ressource name */ |
Line 699 char *docName;
|
Line 659 char *docName;
|
else |
else |
{ |
{ |
/* docname is comprised inside the URL */ |
/* docname is comprised inside the URL */ |
while (length >= 0 && newName[length] != used_sep) |
while (length >= 0 && newName[length] != URL_SEP && newName[length] != DIR_SEP) |
length--; |
length--; |
if (length < 0) |
if (length < 0) |
strcpy (docName, newName); |
strcpy (docName, newName); |
else |
else |
strcpy (docName, &newName[length+1]); |
strcpy (docName, &newName[length+1]); |
} |
} |
|
|
} |
} |
else |
else |
docName[0] = EOS; |
docName[0] = EOS; |
Line 860 HTURI *parts;
|
Line 819 HTURI *parts;
|
|
|
#endif /* __STDC__ */ |
#endif /* __STDC__ */ |
{ |
{ |
char * p; |
char *p; |
char * after_access = name; |
char *after_access = name; |
char used_sep; |
|
|
|
if (name && strchr (name, URL_SEP)) |
|
{ |
|
used_sep = URL_SEP; |
|
} |
|
else |
|
{ |
|
used_sep = DIR_SEP; |
|
} |
|
|
|
memset(parts, '\0', sizeof(HTURI)); |
memset (parts, '\0', sizeof (HTURI)); |
/* Look for fragment identifier */ |
/* Look for fragment identifier */ |
if ((p = strrchr(name, '#')) != NULL) |
if ((p = strrchr(name, '#')) != NULL) |
{ |
{ |
Line 883 HTURI *parts;
|
Line 832 HTURI *parts;
|
|
|
for (p=name; *p; p++) |
for (p=name; *p; p++) |
{ |
{ |
if (*p==used_sep || *p=='#' || *p=='?') |
if (*p == URL_SEP || *p == DIR_SEP || *p=='#' || *p=='?') |
break; |
break; |
if (*p==':') |
if (*p==':') |
{ |
{ |
Line 898 HTURI *parts;
|
Line 847 HTURI *parts;
|
/* while (*after_access == 0)*/ |
/* while (*after_access == 0)*/ |
/* after_access++;*/ |
/* after_access++;*/ |
after_access = p+1; |
after_access = p+1; |
if (0==strcasecmp("URL", parts->access)) |
if (!strcasecmp("URL", parts->access)) |
/* Ignore IETF's URL: pre-prefix */ |
/* Ignore IETF's URL: pre-prefix */ |
parts->access = NULL; |
parts->access = NULL; |
else |
else |
Line 907 HTURI *parts;
|
Line 856 HTURI *parts;
|
} |
} |
|
|
p = after_access; |
p = after_access; |
if (*p==used_sep) |
if (*p == URL_SEP || *p == DIR_SEP) |
{ |
{ |
if (p[1]==used_sep) |
if (p[1] == URL_SEP) |
{ |
{ |
parts->host = p+2; /* host has been specified */ |
parts->host = p+2; /* host has been specified */ |
*p = 0; /* Terminate access */ |
*p = 0; /* Terminate access */ |
/* look for end of host name if any */ |
/* look for end of host name if any */ |
p = strchr(parts->host,used_sep); |
p = strchr (parts->host, URL_SEP); |
if (p) |
if (p) |
{ |
{ |
*p=0; /* Terminate host */ |
*p = EOS; /* Terminate host */ |
parts->absolute = p+1; /* Root has been found */ |
parts->absolute = p+1; /* Root has been found */ |
} |
} |
} |
} |
Line 967 int wanted;
|
Line 916 int wanted;
|
char used_sep; |
char used_sep; |
char *used_str; |
char *used_str; |
|
|
/*if (strchr (aName, URL_SEP) || strchr (relatedName, URL_SEP) )*/ |
if (strchr (aName, DIR_SEP) || strchr (relatedName, DIR_SEP)) |
if (strchr (aName, DIR_SEP)) |
|
{ |
{ |
used_str = DIR_STR; |
used_str = DIR_STR; |
used_sep = DIR_SEP; |
used_sep = DIR_SEP; |