Diff for /Amaya/amaya/AHTURLTools.c between versions 1.182 and 1.183

version 1.182, 2004/07/06 15:22:28 version 1.183, 2004/09/06 14:19:58
Line 508  char *DocImageMimeType (Document doc) Line 508  char *DocImageMimeType (Document doc)
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 ThotBool IsHTMLName (const char *path)  ThotBool IsHTMLName (const char *path)
 {  {
   char      temppath[MAX_LENGTH];    char      *temppath;
   char      suffix[MAX_LENGTH];    char      *suffix;
   char      nsuffix[MAX_LENGTH];    char      nsuffix[MAX_LENGTH];
   int       i;     int       i; 
   
   if (!path)    if (!path)
     return (FALSE);      return (FALSE);
   
   strcpy (temppath, path);    temppath = TtaStrdup ((char *)path);
     suffix = (char *)TtaGetMemory (strlen (path) + 1);
   TtaExtractSuffix (temppath, suffix);    TtaExtractSuffix (temppath, suffix);
   i = 0;    i = 0;
   while (suffix[i] != EOS)    while (suffix[i] != EOS)
Line 538  ThotBool IsHTMLName (const char *path) Line 539  ThotBool IsHTMLName (const char *path)
           !strcmp (nsuffix, "xhtm") ||            !strcmp (nsuffix, "xhtm") ||
           !strcmp (nsuffix, "lhtml") ||            !strcmp (nsuffix, "lhtml") ||
           !strcmp (nsuffix, "xhtml"))            !strcmp (nsuffix, "xhtml"))
         return (TRUE);          {
             TtaFreeMemory (temppath);
             TtaFreeMemory (suffix);
             return (TRUE);
           }
       else if (!strcmp (nsuffix, "gz"))        else if (!strcmp (nsuffix, "gz"))
         {          {
           /* take into account compressed files */            /* take into account compressed files */
Line 551  ThotBool IsHTMLName (const char *path) Line 556  ThotBool IsHTMLName (const char *path)
               i++;                i++;
             }              }
           nsuffix[i] = EOS;            nsuffix[i] = EOS;
             TtaFreeMemory (temppath);
             TtaFreeMemory (suffix);
           if (!strcmp (nsuffix, "html") ||            if (!strcmp (nsuffix, "html") ||
               !strcmp (nsuffix, "htm") ||                !strcmp (nsuffix, "htm") ||
               !strcmp (nsuffix, "shtml") ||                !strcmp (nsuffix, "shtml") ||
Line 568  ThotBool IsHTMLName (const char *path) Line 575  ThotBool IsHTMLName (const char *path)
         /* check if there is another suffix */          /* check if there is another suffix */
         TtaExtractSuffix (temppath, suffix);          TtaExtractSuffix (temppath, suffix);
     }      }
    return (FALSE);    TtaFreeMemory (temppath);
     TtaFreeMemory (suffix);
     return (FALSE);
 }  }
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
Line 577  ThotBool IsHTMLName (const char *path) Line 586  ThotBool IsHTMLName (const char *path)
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 ThotBool IsMathMLName (const char *path)  ThotBool IsMathMLName (const char *path)
 {  {
    char        temppath[MAX_LENGTH];     char        *temppath;
    char        suffix[MAX_LENGTH];     char        *suffix;
      ThotBool    ret;
   
    if (!path)     if (!path)
       return (FALSE);       return (FALSE);
   
    strcpy (temppath, path);     temppath = TtaStrdup ((char *)path);
      suffix = (char *)TtaGetMemory (strlen (path) + 1);
    TtaExtractSuffix (temppath, suffix);     TtaExtractSuffix (temppath, suffix);
   
    if (!strcasecmp (suffix, "mml"))     if (!strcasecmp (suffix, "mml"))
      return (TRUE);       ret = TRUE;
    else if (!strcmp (suffix, "gz"))     else if (!strcmp (suffix, "gz"))
      {       {
        /* take into account compressed files */         /* take into account compressed files */
        TtaExtractSuffix (temppath, suffix);                TtaExtractSuffix (temppath, suffix);       
        if (!strcasecmp (suffix, "mml"))         if (!strcasecmp (suffix, "mml"))
          return (TRUE);           ret = TRUE;
        else         else
          return (FALSE);           ret = FALSE;
      }       }
    else     else
      return (FALSE);       ret = FALSE;
   
     TtaFreeMemory (temppath);
     TtaFreeMemory (suffix);
     return (ret);
 }  }
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
Line 607  ThotBool IsMathMLName (const char *path) Line 622  ThotBool IsMathMLName (const char *path)
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 ThotBool IsSVGName (const char *path)  ThotBool IsSVGName (const char *path)
 {  {
    char        temppath[MAX_LENGTH];     char        *temppath;
    char        suffix[MAX_LENGTH];     char        *suffix;
      ThotBool    ret;
   
    if (!path)     if (!path)
       return (FALSE);        return (FALSE);
   
    strcpy (temppath, path);     temppath = TtaStrdup ((char *)path);
      suffix = (char *)TtaGetMemory (strlen (path) + 1);
    TtaExtractSuffix (temppath, suffix);     TtaExtractSuffix (temppath, suffix);
   
    if (!strcasecmp (suffix, "svg") || !strcasecmp (suffix, "svgz"))     if (!strcasecmp (suffix, "svg") || !strcasecmp (suffix, "svgz"))
      return (TRUE);       ret = TRUE;
    else if (!strcmp (suffix, "gz"))     else if (!strcmp (suffix, "gz"))
      {       {
        /* take into account compressed files */         /* take into account compressed files */
        TtaExtractSuffix (temppath, suffix);                TtaExtractSuffix (temppath, suffix);       
        if (!strcasecmp (suffix, "svg"))         if (!strcasecmp (suffix, "svg"))
          return (TRUE);           ret = TRUE;
        else         else
          return (FALSE);           ret = FALSE;
      }       }
    else     else
      return (FALSE);       ret = FALSE;
   
     TtaFreeMemory (temppath);
     TtaFreeMemory (suffix);
     return (ret);
 }  }
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
Line 637  ThotBool IsSVGName (const char *path) Line 658  ThotBool IsSVGName (const char *path)
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 ThotBool IsXMLName (const char *path)  ThotBool IsXMLName (const char *path)
 {  {
    char        temppath[MAX_LENGTH];     char        *temppath;
    char        suffix[MAX_LENGTH];     char        *suffix;
      ThotBool    ret;
   
    if (!path)     if (!path)
       return (FALSE);        return (FALSE);
   
    strcpy (temppath, path);     temppath = TtaStrdup ((char *)path);
      suffix = (char *)TtaGetMemory (strlen (path) + 1);
    TtaExtractSuffix (temppath, suffix);     TtaExtractSuffix (temppath, suffix);
   
    if (!strcasecmp (suffix, "xml") ||     if (!strcasecmp (suffix, "xml") ||
Line 652  ThotBool IsXMLName (const char *path) Line 675  ThotBool IsXMLName (const char *path)
        !strcmp (suffix, "xhtml") ||         !strcmp (suffix, "xhtml") ||
        !strcmp (suffix, "smi") ||         !strcmp (suffix, "smi") ||
        !strcmp (suffix, "zsl"))         !strcmp (suffix, "zsl"))
      return (TRUE);       ret = TRUE;
    else if (!strcmp (suffix, "gz"))     else if (!strcmp (suffix, "gz"))
      {       {
        /* take into account compressed files */         /* take into account compressed files */
Line 663  ThotBool IsXMLName (const char *path) Line 686  ThotBool IsXMLName (const char *path)
            !strcmp (suffix, "xhtml") ||             !strcmp (suffix, "xhtml") ||
            !strcmp (suffix, "smi") |             !strcmp (suffix, "smi") |
            !strcmp (suffix, "xsl"))             !strcmp (suffix, "xsl"))
          return (TRUE);           ret = TRUE;
        else         else
          return (FALSE);           ret = FALSE;
      }       }
    else     else
      return (FALSE);       ret = FALSE;
   
     TtaFreeMemory (temppath);
     TtaFreeMemory (suffix);
     return (ret);
 }  }
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
Line 677  ThotBool IsXMLName (const char *path) Line 704  ThotBool IsXMLName (const char *path)
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 ThotBool IsUndisplayedName (const char *path)  ThotBool IsUndisplayedName (const char *path)
 {  {
    char                temppath[MAX_LENGTH];     char                *temppath;
    char                suffix[MAX_LENGTH];     char                *suffix;
      ThotBool            ret;
   
    if (!path)     if (!path)
       return (FALSE);        return (FALSE);
   
    strcpy (temppath, path);     temppath = TtaStrdup ((char *)path);
      suffix = (char *)TtaGetMemory (strlen (path) + 1);
    TtaExtractSuffix (temppath, suffix);     TtaExtractSuffix (temppath, suffix);
   
    if (!strcasecmp (suffix, "exe") ||     if (!strcasecmp (suffix, "exe") ||
Line 696  ThotBool IsUndisplayedName (const char * Line 725  ThotBool IsUndisplayedName (const char *
        !strcasecmp (suffix, "tgz") ||         !strcasecmp (suffix, "tgz") ||
        !strcasecmp (suffix, "ddl") ||         !strcasecmp (suffix, "ddl") ||
        !strcasecmp (suffix, "o"))         !strcasecmp (suffix, "o"))
      return (TRUE);       ret = TRUE;
    else if (!strcmp (suffix, "gz"))     else if (!strcmp (suffix, "gz"))
      {       {
        /* take into account compressed files */         /* take into account compressed files */
Line 710  ThotBool IsUndisplayedName (const char * Line 739  ThotBool IsUndisplayedName (const char *
            !strcasecmp (suffix, "tar") ||             !strcasecmp (suffix, "tar") ||
            !strcasecmp (suffix, "ddl") ||             !strcasecmp (suffix, "ddl") ||
            !strcasecmp (suffix, "o"))             !strcasecmp (suffix, "o"))
          return (TRUE);           ret = TRUE;
        else         else
          return (FALSE);           ret = FALSE;
      }       }
    else     else
      return (FALSE);       ret = FALSE;
   
      TtaFreeMemory (temppath);
      TtaFreeMemory (suffix);
      return (ret);
 }  }
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
Line 724  ThotBool IsUndisplayedName (const char * Line 757  ThotBool IsUndisplayedName (const char *
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 ThotBool IsCSSName (const char *path)  ThotBool IsCSSName (const char *path)
 {  {
    char                temppath[MAX_LENGTH];     char                *temppath;
    char                suffix[MAX_LENGTH];     char                *suffix;
      ThotBool            ret;
   
    if (!path)     if (!path)
       return (FALSE);       return (FALSE);
   
    strcpy (temppath, path);     temppath = TtaStrdup ((char *)path);
      suffix = (char *)TtaGetMemory (strlen (path) + 1);
    TtaExtractSuffix (temppath, suffix);     TtaExtractSuffix (temppath, suffix);
   
    if (!strcasecmp (suffix, "css"))     if (!strcasecmp (suffix, "css"))
      return (TRUE);       ret = TRUE;
    else if (!strcmp (suffix, "gz"))     else if (!strcmp (suffix, "gz"))
      {       {
        /* take into account compressed files */         /* take into account compressed files */
        TtaExtractSuffix (temppath, suffix);                TtaExtractSuffix (temppath, suffix);       
        if (!strcasecmp (suffix, "css"))         if (!strcasecmp (suffix, "css"))
          return (TRUE);           ret = TRUE;
        else         else
          return (FALSE);           ret = FALSE;
      }       }
    else     else
      return (FALSE);       ret = FALSE;
   
      TtaFreeMemory (temppath);
      TtaFreeMemory (suffix);
      return (ret);
 }  }
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
Line 768  ThotBool MultipleBookmarks (void) Line 807  ThotBool MultipleBookmarks (void)
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 ThotBool IsRDFName (const char *path)  ThotBool IsRDFName (const char *path)
 {  {
    char                temppath[MAX_LENGTH];     char                *temppath;
    char                suffix[MAX_LENGTH];     char                *suffix;
      ThotBool            ret;
   
    /* temporarily disabling this function */     /* temporarily disabling this function */
    if (!MultipleBookmarks ())     if (!MultipleBookmarks ())
      return FALSE;       return (FALSE);
   
    if (!path)     if (!path)
       return (FALSE);       return (FALSE);
   
    strcpy (temppath, path);     temppath = TtaStrdup ((char *)path);
      suffix = (char *)TtaGetMemory (strlen (path) + 1);
    TtaExtractSuffix (temppath, suffix);     TtaExtractSuffix (temppath, suffix);
   
    if (!strcasecmp (suffix, "rdf"))     if (!strcasecmp (suffix, "rdf"))
      return (TRUE);       ret = TRUE;
    else if (!strcmp (suffix, "gz"))     else if (!strcmp (suffix, "gz"))
      {       {
        /* take into account compressed files */         /* take into account compressed files */
        TtaExtractSuffix (temppath, suffix);                TtaExtractSuffix (temppath, suffix);       
        if (!strcasecmp (suffix, "rdf"))         if (!strcasecmp (suffix, "rdf"))
          return (TRUE);           ret = TRUE;
        else         else
          return (FALSE);           ret = FALSE;
      }       }
    else     else
      return (FALSE);       ret = FALSE;
      
      TtaFreeMemory (temppath);
      TtaFreeMemory (suffix);
      return (ret);
 }  }
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
Line 802  ThotBool IsRDFName (const char *path) Line 847  ThotBool IsRDFName (const char *path)
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 ThotBool IsImageName (const char *path)  ThotBool IsImageName (const char *path)
 {  {
    char                temppath[MAX_LENGTH];     char                *temppath;
    char                suffix[MAX_LENGTH];     char                *suffix;
    char                nsuffix[MAX_LENGTH];     char                nsuffix[MAX_LENGTH];
    int                 i;     int                 i;
      ThotBool            ret;
   
    if (!path)     if (!path)
       return (FALSE);        return (FALSE);
   
    strcpy (temppath, path);     temppath = TtaStrdup ((char *)path);
      suffix = (char *)TtaGetMemory (strlen (path) + 1);
    TtaExtractSuffix (temppath, suffix);     TtaExtractSuffix (temppath, suffix);
   
    /* Normalize the suffix */     /* Normalize the suffix */
Line 824  ThotBool IsImageName (const char *path) Line 871  ThotBool IsImageName (const char *path)
    if ((!strcmp (nsuffix, "gif")) || (!strcmp (nsuffix, "xbm")) ||     if ((!strcmp (nsuffix, "gif")) || (!strcmp (nsuffix, "xbm")) ||
        (!strcmp (nsuffix, "xpm")) || (!strcmp (nsuffix, "jpg")) ||         (!strcmp (nsuffix, "xpm")) || (!strcmp (nsuffix, "jpg")) ||
        (!strcmp (nsuffix, "png")) || (!strcmp (nsuffix, "au")))         (!strcmp (nsuffix, "png")) || (!strcmp (nsuffix, "au")))
       return (TRUE);        ret = TRUE;
    return (FALSE);     else
         ret = FALSE;
   
      TtaFreeMemory (temppath);
      TtaFreeMemory (suffix);
      return (ret);
 }  }
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
Line 834  ThotBool IsImageName (const char *path) Line 886  ThotBool IsImageName (const char *path)
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 ThotBool IsImageType (const char *type)  ThotBool IsImageType (const char *type)
 {  {
    char                temptype[MAX_LENGTH];     char                *temptype;
    int                 i;     int                 i;
      ThotBool            ret;
   
    if (!type)     if (!type)
       return (FALSE);        return (FALSE);
   
    strcpy (temptype, type);     temptype = TtaStrdup ((char *)type);
    /* Normalize the type */     /* Normalize the type */
    i = 0;     i = 0;
    while (temptype[i] != EOS)     while (temptype[i] != EOS)
Line 855  ThotBool IsImageType (const char *type) Line 908  ThotBool IsImageType (const char *type)
    if (!strcmp (&temptype[i], "gif") || !strcmp (&temptype[i], "x-xbitmap") ||     if (!strcmp (&temptype[i], "gif") || !strcmp (&temptype[i], "x-xbitmap") ||
        !strcmp (&temptype[i], "x-xpixmap") || !strcmp (&temptype[i], "jpeg") ||         !strcmp (&temptype[i], "x-xpixmap") || !strcmp (&temptype[i], "jpeg") ||
        !strcmp (&temptype[i], "png"))         !strcmp (&temptype[i], "png"))
       return (TRUE);       ret = TRUE;
    return (FALSE);     else
        ret = FALSE;
      TtaFreeMemory (temptype);
      return (ret);
 }  }
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
Line 864  ThotBool IsImageType (const char *type) Line 920  ThotBool IsImageType (const char *type)
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 ThotBool IsTextName (const char *path)  ThotBool IsTextName (const char *path)
 {  {
    char                temppath[MAX_LENGTH];     char                *temppath;
    char                suffix[MAX_LENGTH];     char                *suffix;
    char                nsuffix[MAX_LENGTH];     char                nsuffix[MAX_LENGTH];
    int                 i;     int                 i;
      ThotBool            ret;
   
    if (!path)     if (!path)
      return (FALSE);       return (FALSE);
   
    strcpy (temppath, path);     temppath = TtaStrdup ((char *)path);
      suffix = (char *)TtaGetMemory (strlen (path) + 1);
    TtaExtractSuffix (temppath, suffix);     TtaExtractSuffix (temppath, suffix);
   
    /* Normalize the suffix */     /* Normalize the suffix */
Line 885  ThotBool IsTextName (const char *path) Line 943  ThotBool IsTextName (const char *path)
    nsuffix[i] = EOS;     nsuffix[i] = EOS;
   
    if (!strcmp (nsuffix, "txt") || !strcmp (nsuffix, "dtd"))     if (!strcmp (nsuffix, "txt") || !strcmp (nsuffix, "dtd"))
       return (TRUE);        ret = TRUE;
    else if (!strcmp (nsuffix, "gz"))     else if (!strcmp (nsuffix, "gz"))
      {       {
        /* take into account compressed files */         /* take into account compressed files */
Line 899  ThotBool IsTextName (const char *path) Line 957  ThotBool IsTextName (const char *path)
          }           }
        nsuffix[i] = EOS;         nsuffix[i] = EOS;
        if (!strcmp (nsuffix, "txt") || !strcmp (nsuffix, "dtd"))         if (!strcmp (nsuffix, "txt") || !strcmp (nsuffix, "dtd"))
          return (TRUE);           ret = TRUE;
        else         else
          return (FALSE);           ret = FALSE;
      }       }
    else     else
      return (FALSE);       ret = FALSE;
   
      TtaFreeMemory (temppath);
      TtaFreeMemory (suffix);
      return (ret);
 }  }
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------

Removed from v.1.182  
changed lines
  Added in v.1.183


Webmaster