Diff for /Amaya/amaya/AHTURLTools.c between versions 1.86 and 1.87

version 1.86, 2000/02/25 17:05:40 version 1.87, 2000/03/02 14:33:07
Line 11 Line 11
  * URL parsing functions.   * URL parsing functions.
  *   *
  * Authors: J. Kahan, I. Vatton   * Authors: J. Kahan, I. Vatton
  *          R. Guetari (Stuff related to Windows).   *          R. Guetari: Windows & Unicode.
  *   *
  */   */
     
Line 48  STRING       string; Line 48  STRING       string;
  if (!string)   if (!string)
    return;     return;
   
  for (i = 0; string[i] != EOS; i++)   for (i = 0; string[i] != WC_EOS; i++)
    string[i] = utolower (string[i]);     string[i] = utolower (string[i]);
 }  }
   
Line 123  STRING url; Line 123  STRING url;
               else {                else {
                 /* @@ maybe we should do some other behavior here, like                  /* @@ maybe we should do some other behavior here, like
                    freeing the buffer and return a void thing */                     freeing the buffer and return a void thing */
                 buffer[buffer_len] = EOS;                  buffer[buffer_len] = WC_EOS;
                 break;                  break;
               }                }
             }              }
Line 142  STRING url; Line 142  STRING url;
           /* examine the next char */            /* examine the next char */
           ptr++;            ptr++;
         }          }
       buffer[buffer_len] = EOS;        buffer[buffer_len] = WC_EOS;
     }      }
   else    else
     buffer = NULL;      buffer = NULL;
Line 293  STRING              aSuffix; Line 293  STRING              aSuffix;
      /* bad suffix */       /* bad suffix */
      return;       return;
   
    aSuffix[0] = EOS;     aSuffix[0] = WC_EOS;
    lg = ustrlen (aName);     lg = ustrlen (aName);
    if (lg)     if (lg)
      {       {
Line 310  STRING              aSuffix; Line 310  STRING              aSuffix;
         i = (int) (oldptr) - (int) (aName);     /* name length */          i = (int) (oldptr) - (int) (aName);     /* name length */
         if (i > 1)          if (i > 1)
           {            {
              aName[i - 1] = EOS;               aName[i - 1] = WC_EOS;
              if (i != lg)               if (i != lg)
                 ustrcpy (aSuffix, oldptr);                  ustrcpy (aSuffix, oldptr);
           }            }
Line 483  const STRING        path; Line 483  const STRING        path;
   
    /* Normalize the suffix */     /* Normalize the suffix */
    i = 0;     i = 0;
    while (suffix[i] != EOS && i < MAX_LENGTH -1)     while (suffix[i] != WC_EOS && i < MAX_LENGTH -1)
      {       {
        nsuffix[i] = utolower (suffix[i]);         nsuffix[i] = utolower (suffix[i]);
        i++;         i++;
      }       }
    nsuffix[i] = EOS;     nsuffix[i] = WC_EOS;
    if ((!ustrcmp (nsuffix, TEXT("gif"))) || (!ustrcmp (nsuffix, TEXT("xbm"))) ||     if ((!ustrcmp (nsuffix, TEXT("gif"))) || (!ustrcmp (nsuffix, TEXT("xbm"))) ||
        (!ustrcmp (nsuffix, TEXT("xpm"))) || (!ustrcmp (nsuffix, TEXT("jpg"))) ||         (!ustrcmp (nsuffix, TEXT("xpm"))) || (!ustrcmp (nsuffix, TEXT("jpg"))) ||
        (!ustrcmp (nsuffix, TEXT("png"))) || (!ustrcmp (nsuffix, TEXT("au"))))         (!ustrcmp (nsuffix, TEXT("png"))) || (!ustrcmp (nsuffix, TEXT("au"))))
Line 516  const STRING     type; Line 516  const STRING     type;
    ustrcpy (temptype, type);     ustrcpy (temptype, type);
    /* Normalize the type */     /* Normalize the type */
    i = 0;     i = 0;
    while (temptype[i] != EOS)     while (temptype[i] != WC_EOS)
      {       {
        temptype[i] = tolower (temptype[i]);         temptype[i] = tolower (temptype[i]);
        i++;         i++;
Line 552  const STRING        path; Line 552  const STRING        path;
   
    /* Normalize the suffix */     /* Normalize the suffix */
    i = 0;     i = 0;
    while (suffix[i] != EOS && i < MAX_LENGTH -1)     while (suffix[i] != WC_EOS && i < MAX_LENGTH -1)
      {       {
         nsuffix[i] = tolower (suffix[i]);          nsuffix[i] = tolower (suffix[i]);
         i++;          i++;
      }       }
    nsuffix[i] = EOS;     nsuffix[i] = WC_EOS;
   
    if ((!ustrcmp (nsuffix, TEXT("txt"))) || (!ustrcmp (nsuffix, TEXT("dtd"))))     if ((!ustrcmp (nsuffix, TEXT("txt"))) || (!ustrcmp (nsuffix, TEXT("dtd"))))
       return (TRUE);        return (TRUE);
Line 567  const STRING        path; Line 567  const STRING        path;
        ExtractSuffix (temppath, suffix);                ExtractSuffix (temppath, suffix);       
        /* Normalize the suffix */         /* Normalize the suffix */
        i = 0;         i = 0;
        while (suffix[i] != EOS && i < MAX_LENGTH -1)         while (suffix[i] != WC_EOS && i < MAX_LENGTH -1)
          {           {
            nsuffix[i] = tolower (suffix[i]);             nsuffix[i] = tolower (suffix[i]);
            i++;             i++;
          }           }
        nsuffix[i] = EOS;         nsuffix[i] = WC_EOS;
        if ((!ustrcmp (nsuffix, TEXT("txt"))) || (!ustrcmp (nsuffix, TEXT("dtd"))))         if ((!ustrcmp (nsuffix, TEXT("txt"))) || (!ustrcmp (nsuffix, TEXT("dtd"))))
          return (TRUE);           return (TRUE);
        else         else
Line 1109  const STRING    path; Line 1109  const STRING    path;
    CHAR_T      temppath[MAX_LENGTH];     CHAR_T      temppath[MAX_LENGTH];
    CHAR_T      suffix[MAX_LENGTH];     CHAR_T      suffix[MAX_LENGTH];
   
    if (!path || path[0] == EOS || path[ustrlen(path)] == DIR_SEP)     if (!path || path[0] == WC_EOS || path[ustrlen(path)] == WC_DIR_SEP)
      return (FALSE);       return (FALSE);
   
    root = AmayaParseUrl(path, TEXT(""), AMAYA_PARSE_PATH | AMAYA_PARSE_PUNCTUATION);     root = AmayaParseUrl(path, TEXT(""), AMAYA_PARSE_PATH | AMAYA_PARSE_PUNCTUATION);
Line 1121  const STRING    path; Line 1121  const STRING    path;
        /* Get the suffix */         /* Get the suffix */
        ExtractSuffix (temppath, suffix);          ExtractSuffix (temppath, suffix); 
   
        if( suffix[0] == EOS)         if( suffix[0] == WC_EOS)
          /* no suffix */           /* no suffix */
          return (FALSE);           return (FALSE);
   
Line 1132  const STRING    path; Line 1132  const STRING    path;
          /* skip the compressed suffix */           /* skip the compressed suffix */
          {           {
          ExtractSuffix (temppath, suffix);           ExtractSuffix (temppath, suffix);
          if(suffix[0] == EOS)           if(suffix[0] == WC_EOS)
            /* no suffix */             /* no suffix */
            return (FALSE);             return (FALSE);
          /* Normalize the suffix */           /* Normalize the suffix */
Line 1272  HTURI       *parts; Line 1272  HTURI       *parts;
             p = ustrchr (parts->host, URL_SEP);              p = ustrchr (parts->host, URL_SEP);
             if (p)              if (p)
               {                {
                 *p = EOS;                       /* Terminate host */                  *p = WC_EOS;                    /* Terminate host */
                 parts->absolute = p+1;          /* Root has been found */                  parts->absolute = p+1;          /* Root has been found */
               }                }
           }            }
Line 1720  CHAR_T**     url; Line 1720  CHAR_T**     url;
     */      */
     if (*path == used_sep && *(path+1) == TEXT('.') && *(path+2) == TEXT('.')       if (*path == used_sep && *(path+1) == TEXT('.') && *(path+2) == TEXT('.') 
         && (!*(path+3) || *(path+3) == used_sep))          && (!*(path+3) || *(path+3) == used_sep))
         *(path+1) = EOS;          *(path+1) = WC_EOS;
   
   return;    return;
 }  }
Line 1806  STRING           aName; Line 1806  STRING           aName;
 STRING           relatedName;  STRING           relatedName;
 #endif  /* __STDC__ */  #endif  /* __STDC__ */
 {  {
   STRING         return_value;    CHAR_T*        return_value;
   CHAR_T         result[MAX_LENGTH];    CHAR_T         result[MAX_LENGTH];
   STRING         p;    CHAR_T*        p;
   STRING         q;    CHAR_T*        q;
   STRING         after_access;    CHAR_T*        after_access;
   STRING         last_slash = NULL;    CHAR_T*        last_slash = NULL;
   int            slashes, levels, len;    int            slashes, levels, len;
   
 # ifdef _WINDOWS  # ifdef _WINDOWS
Line 1839  STRING           relatedName; Line 1839  STRING           relatedName;
     }      }
           
   /* q, p point to the first non-matching character or zero */    /* q, p point to the first non-matching character or zero */
   if (*q == EOS)    if (*q == WC_EOS)
     {      {
       /* New name is a subset of the related name */        /* New name is a subset of the related name */
       /* exactly the right length */        /* exactly the right length */
Line 1869  STRING           relatedName; Line 1869  STRING           relatedName;
             if (*q == DIR_SEP)              if (*q == DIR_SEP)
               levels++;                levels++;
                       
           result[0] = EOS;            result[0] = WC_EOS;
           for (;levels; levels--)            for (;levels; levels--)
             ustrcat (result, TEXT("../"));              ustrcat (result, TEXT("../"));
           ustrcat (result, last_slash+1);            ustrcat (result, last_slash+1);

Removed from v.1.86  
changed lines
  Added in v.1.87


Webmaster