Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Friday, October 16, 2026

Diff for libplaton/utils/makelynx/makelynx.c between version 1.1 and 1.2

version 1.1, 2002/09/24 16:53:57 version 1.2, 2002/10/07 13:38:18
Line 11 
Line 11 
  **************************************************************************/   **************************************************************************/
   
 #ifndef __PRGVERSION__  #ifndef __PRGVERSION__
 #define __PRGVERSION__  "1.3"  #  define __PRGVERSION__        "1.3"
 #endif  #endif
   
 #define BUFSIZE 500U  #define BUFSIZE 500U
Line 31 
Line 31 
 #include <platon/str/strconv.h>  #include <platon/str/strconv.h>
   
 #include <platon/html/read.h>  #include <platon/html/read.h>
 #include <platon/html/tag.h>  #include <platon/html/Tag.h>
   
 void write_header(FILE*f);  void write_header(FILE*f);
   
Line 40  int main(int argc,char*argv[])
Line 40  int main(int argc,char*argv[])
         FILE*fin,*fout;          FILE*fin,*fout;
         int i,f_script=0,f_body=0;          int i,f_script=0,f_body=0;
         char buf[BUFSIZE+1];          char buf[BUFSIZE+1];
         html_tag*tag;          htmlTag*tag;
   
         /* Program information and help print. */          /* Program information and help print. */
         if (argc < 3) {          if (argc < 3) {
Line 88  int main(int argc,char*argv[])
Line 88  int main(int argc,char*argv[])
   
                 if(i==HTML_TAG){                  if(i==HTML_TAG){
   
                         if((tag=new html_tag)==NULL)printf("new html_tag Error!\n");                          if((tag=new htmlTag)==NULL)printf("new htmlTag Error!\n");
                         else{                          else{
                                 if(!tag->Init(buf)<0)printf("Init() Error!\n");                                  if(!tag->init(buf)<0)printf("init() Error!\n");
   
                                 if(!strcmp(tag->GetName(),"script"))f_script=1;                                  if(!strcmp(tag->getName(),"script"))f_script=1;
                                 if(!f_script){                                  if(!f_script){
                                         if(tag->IsName("a")||tag->IsName("img")){                                          if(tag->isName("a")||tag->isName("img")){
                                                 int index;                                                  int index;
                                                 if((index=tag->GetIndexParam("href"))<0)                                                  if((index=tag->getIndexParam("href"))<0)
                                                         index=tag->GetIndexParam("src");                                                          index=tag->getIndexParam("src");
                                                 if(index>=0){                                                  if(index>=0){
                                                         char value[151];                                                          char value[151];
                                                         strncpy(value+4,tag->GetValue(index),146);                                                          strncpy(value+4,tag->getValue(index),146);
                                                         value[146]='\0';                                                          value[146]='\0';
                                                         if((value+4)[0]=='"')strdel(value+4);                                                          if((value+4)[0]=='"')strdel(value+4);
                                                         if(strchr(value+4,':')==NULL&&                                                          if(strchr(value+4,':')==NULL&&
                                                                         (strchr(value+4,'/')!=NULL||                                                                          (strchr(value+4,'/')!=NULL||
                                                                          strstr(value+4,".htm")==NULL)){                                                                           strstr(value+4,".htm")==NULL)){
                                                                 strncpy(value,"\"../",4);                                                                  strncpy(value,"\"../",4);
                                                                 tag->RemoveParam(index);                                                                  tag->removeParam(index);
                                                                 tag->AddParam(tag->IsName("a")?"href":"src",                                                                  tag->addParam(tag->isName("a")?"href":"src",
                                                                                 (strchr(value,'\0')-1)[0]=='"'                                                                                  (strchr(value,'\0')-1)[0]=='"'
                                                                                 ?value:value+1);                                                                                  ?value:value+1);
                                                         }                                                          }
                                                 }                                                  }
                                         }                                          }
   
                                         tag->RemoveParam("onmouseover");                                          tag->removeParam("onmouseover");
                                         tag->RemoveParam("onmouseout");                                          tag->removeParam("onmouseout");
                                         tag->RemoveParam("onload");                                          tag->removeParam("onload");
                                         tag->RemoveParam("bgcolor");                                          tag->removeParam("bgcolor");
                                         tag->RemoveParam("color");                                          tag->removeParam("color");
                                         tag->RemoveParam("background");                                          tag->removeParam("background");
                                         tag->RemoveParam("size");                                          tag->removeParam("size");
                                         tag->RemoveParam("face");                                          tag->removeParam("face");
   
                                         if(tag->IsName("body")){                                          if(tag->isName("body")){
                                                 f_body=1;                                                  f_body=1;
                                                 tag->RemoveParam("nosave");                                                  tag->removeParam("nosave");
                                                 tag->RemoveParam("text");                                                  tag->removeParam("text");
                                                 tag->RemoveParam("link");                                                  tag->removeParam("link");
                                                 tag->RemoveParam("alink");                                                  tag->removeParam("alink");
                                                 tag->RemoveParam("vlink");                                                  tag->removeParam("vlink");
                                         }                                          }
                                         if(tag->IsName("meta")&&tag->IsParam("name",                                          if(tag->isName("meta")&&tag->isParam("name",
                                                                 "\"GENERATOR\"")){                                                                  "\"GENERATOR\"")){
                                                 tag->RemoveParam("content");                                                  tag->removeParam("content");
                                                 if(tag->AddParam("content",                                                  if(tag->addParam("content",
                                                                         "\"MAKELYNX v" __PRGVERSION__                                                                          "\"MAKELYNX v" __PRGVERSION__
                                                                         " by Ondrej Jombik, "                                                                          " by Ondrej Jombik, "
                                                                         "(c) Copyright 1999-2002 "                                                                          "(c) Copyright 1999-2002 "
                                                                         "Condy software inc.\"")<0)                                                                          "Condy software inc.\"")<0)
                                                         exit(1);                                                          exit(1);
                                         }                                          }
   
                                         if(tag->IsName("/title"))fputs(" (LYNX version)",fout);                                          if(tag->isName("/title"))fputs(" (LYNX version)",fout);
                                         if(!strcmp(tag->GetName(),"table"))fputs("<table>",fout);                                          if(!strcmp(tag->getName(),"table"))fputs("<table>",fout);
                                         if(!strcmp(tag->GetName(),"tr"))fputs("<tr>",fout);                                          if(!strcmp(tag->getName(),"tr"))fputs("<tr>",fout);
                                         if(!strcmp(tag->GetName(),"td"))fputs("<td>",fout);                                          if(!strcmp(tag->getName(),"td"))fputs("<td>",fout);
                                         if(!strcmp(tag->GetName(),"th"))fputs("<th>",fout);                                          if(!strcmp(tag->getName(),"th"))fputs("<th>",fout);
   
                                         if(strcmp(tag->GetName(),"i")&&                                          if(strcmp(tag->getName(),"i")&&
                                                         strcmp(tag->GetName(),"/i")&&                                                          strcmp(tag->getName(),"/i")&&
                                                         strcmp(tag->GetName(),"b")&&                                                          strcmp(tag->getName(),"b")&&
                                                         strcmp(tag->GetName(),"/b")&&                                                          strcmp(tag->getName(),"/b")&&
                                                         strcmp(tag->GetName(),"center")&&                                                          strcmp(tag->getName(),"center")&&
                                                         strcmp(tag->GetName(),"/center")&&                                                          strcmp(tag->getName(),"/center")&&
                                                         strcmp(tag->GetName(),"tr")&&                                                          strcmp(tag->getName(),"tr")&&
                                                         strcmp(tag->GetName(),"td")&&                                                          strcmp(tag->getName(),"td")&&
                                                         strcmp(tag->GetName(),"th")&&                                                          strcmp(tag->getName(),"th")&&
                                                         strcmp(tag->GetName(),"table")&&                                                          strcmp(tag->getName(),"table")&&
                                                         strcmp(tag->GetName(),"link"))                                                          strcmp(tag->getName(),"link"))
   
                                                 tag->WriteToFile(fout);                                                  tag->writeToFile(fout);
                                         fflush(fout);                                          fflush(fout);
                                         if(!strcmp(tag->GetName(),"/table"))                                          if(!strcmp(tag->getName(),"/table"))
                                                 fputs("<br>",fout);                                                  fputs("<br>",fout);
                                         fflush(fout);                                          fflush(fout);
                                 } /* if(f_script) */                                  } /* if(f_script) */
                                 if(!strcmp(tag->GetName(),"/script"))                                  if(!strcmp(tag->getName(),"/script"))
                                         f_script=0;                                          f_script=0;
                                 delete tag;                                  delete tag;
                         }                          }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top