Diff for /libwww/Robot/src/HTRobot.c between versions 1.12 and 1.13

version 1.12, 1996/02/10 22:27:59 version 1.13, 1996/02/14 00:37:48
Line 101  PUBLIC HTStyleSheet * styleSheet = NULL; Line 101  PUBLIC HTStyleSheet * styleSheet = NULL;
   
 /* ------------------------------------------------------------------------- */  /* ------------------------------------------------------------------------- */
   
   /*      Standard (non-error) Output
   **      ---------------------------
   */
   PUBLIC int OutputData(const char  * fmt, ...)
   {
       int ret;
       va_list pArgs;
       va_start(pArgs, fmt);
       ret = vfprintf(stdout, fmt, pArgs);
       va_end(pArgs);
       return ret;
   }
   
   /* ------------------------------------------------------------------------- */
   
 /*      Create a "HyperDoc" object  /*      Create a "HyperDoc" object
 **      --------------------------  **      --------------------------
 **      A HyperDoc object contains information about whether we have already  **      A HyperDoc object contains information about whether we have already
Line 185  PRIVATE BOOL Robot_delete (Robot * me) Line 200  PRIVATE BOOL Robot_delete (Robot * me)
         if (me->output && me->output != STDOUT) fclose(me->output);          if (me->output && me->output != STDOUT) fclose(me->output);
         if (me->flags & MR_TIME) {          if (me->flags & MR_TIME) {
             time_t local = time(NULL);              time_t local = time(NULL);
             TTYPrint(TDEST, "Robot terminated %s\n",HTDateTimeStr(&local,YES));              HTTrace("Robot terminated %s\n",HTDateTimeStr(&local,YES));
         }          }
         HT_FREE(me->cwd);          HT_FREE(me->cwd);
         HT_FREE(me->tv);          HT_FREE(me->tv);
Line 246  PRIVATE void SetSignal (void) Line 261  PRIVATE void SetSignal (void)
     ** get `connection refused' back      ** get `connection refused' back
     */      */
     if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {      if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
         if (PROT_TRACE) TTYPrint(TDEST, "HTSignal.... Can't catch SIGPIPE\n");          if (PROT_TRACE) HTTrace("HTSignal.... Can't catch SIGPIPE\n");
     } else {      } else {
         if (PROT_TRACE) TTYPrint(TDEST, "HTSignal.... Ignoring SIGPIPE\n");          if (PROT_TRACE) HTTrace("HTSignal.... Ignoring SIGPIPE\n");
     }      }
 }  }
 #endif /* CATCH_SIG */  #endif /* CATCH_SIG */
   
 PRIVATE void VersionInfo (void)  PRIVATE void VersionInfo (void)
 {  {
     TTYPrint(OUTPUT,"\n\nW3C Reference Software\n\n");      OutputData("\n\nW3C Reference Software\n\n");
     TTYPrint(OUTPUT,"\tW3C Mini Robot (%s) version %s.\n",      OutputData("\tW3C Mini Robot (%s) version %s.\n",
              APP_NAME, APP_VERSION);               APP_NAME, APP_VERSION);
     TTYPrint(OUTPUT,"\tW3C Reference Library version %s.\n\n",HTLib_version());      OutputData("\tW3C Reference Library version %s.\n\n",HTLib_version());
     TTYPrint(OUTPUT,"Please send feedback to <libwww@w3.org>\n");      OutputData("Please send feedback to <libwww@w3.org>\n");
 }  }
   
 /*      terminate_handler  /*      terminate_handler
Line 286  PRIVATE int terminate_handler (HTRequest Line 301  PRIVATE int terminate_handler (HTRequest
 PRIVATE int timeout_handler (HTRequest * request)  PRIVATE int timeout_handler (HTRequest * request)
 {  {
     Robot * mr = (Robot *) HTRequest_context(request);      Robot * mr = (Robot *) HTRequest_context(request);
     if (SHOW_MSG) TTYPrint(TDEST, "Robot....... Request timeout...\n");      if (SHOW_MSG) HTTrace("Robot....... Request timeout...\n");
 #if 0  #if 0
     HTRequest_kill(request);      HTRequest_kill(request);
     Thread_delete(mr, request);      Thread_delete(mr, request);
Line 361  PUBLIC void HText_beginAnchor (HText * t Line 376  PUBLIC void HText_beginAnchor (HText * t
         char * uri = HTAnchor_address((HTAnchor *) dest_parent);          char * uri = HTAnchor_address((HTAnchor *) dest_parent);
         HyperDoc * hd = HTAnchor_document(dest_parent);          HyperDoc * hd = HTAnchor_document(dest_parent);
   
         if (SHOW_MSG) TTYPrint(TDEST, "Robot....... Found `%s\' - ", uri ? uri : "NULL");          if (SHOW_MSG) HTTrace("Robot....... Found `%s\' - ", uri ? uri : "NULL");
                   
         /* Test whether we already have a hyperdoc for this document */          /* Test whether we already have a hyperdoc for this document */
         if (mr->flags & MR_LINK && dest_parent && !hd) {          if (mr->flags & MR_LINK && dest_parent && !hd) {
Line 373  PUBLIC void HText_beginAnchor (HText * t Line 388  PUBLIC void HText_beginAnchor (HText * t
             HTRequest_setParent(newreq, HTRequest_anchor(text->request));              HTRequest_setParent(newreq, HTRequest_anchor(text->request));
             if (depth >= mr->depth) {              if (depth >= mr->depth) {
                 if (SHOW_MSG)                  if (SHOW_MSG)
                     TTYPrint(TDEST, "loading at depth %d using HEAD\n", depth);                      HTTrace("loading at depth %d using HEAD\n", depth);
                 HTRequest_setMethod(newreq, METHOD_HEAD);                  HTRequest_setMethod(newreq, METHOD_HEAD);
                 HTRequest_setOutputFormat(newreq, WWW_MIME);                  HTRequest_setOutputFormat(newreq, WWW_MIME);
             } else {              } else {
                 if (SHOW_MSG) TTYPrint(TDEST, "loading at depth %d\n", depth);                  if (SHOW_MSG) HTTrace("loading at depth %d\n", depth);
             }              }
             if (HTLoadAnchor((HTAnchor *) dest_parent, newreq) != YES) {              if (HTLoadAnchor((HTAnchor *) dest_parent, newreq) != YES) {
                 if (SHOW_MSG) TTYPrint(TDEST, "not tested!\n");                  if (SHOW_MSG) HTTrace("not tested!\n");
                 Thread_delete(mr, newreq);                  Thread_delete(mr, newreq);
             }              }
         } else {          } else {
             if (SHOW_MSG) TTYPrint(TDEST, "duplicate\n");              if (SHOW_MSG) HTTrace("duplicate\n");
         }          }
         HT_FREE(uri);          HT_FREE(uri);
     }      }
Line 408  PUBLIC void HText_appendImage (HText * t Line 423  PUBLIC void HText_appendImage (HText * t
             HyperDoc_new(mr, dest, depth);              HyperDoc_new(mr, dest, depth);
             if (SHOW_MSG) {              if (SHOW_MSG) {
                 char * uri = HTAnchor_address((HTAnchor *) dest);                  char * uri = HTAnchor_address((HTAnchor *) dest);
                 TTYPrint(TDEST, "Robot....... Checking Image `%s\'\n", uri);                  HTTrace("Robot....... Checking Image `%s\'\n", uri);
                 HT_FREE(uri);                  HT_FREE(uri);
             }              }
             if (HTLoadAnchor((HTAnchor *) dest, newreq) != YES) {              if (HTLoadAnchor((HTAnchor *) dest, newreq) != YES) {
                 if (SHOW_MSG)                  if (SHOW_MSG)
                     TTYPrint(TDEST, "Robot....... Image not tested!\n");                      HTTrace("Robot....... Image not tested!\n");
                 Thread_delete(mr, newreq);                  Thread_delete(mr, newreq);
             }              }
         }          }
Line 534  int main (int argc, char ** argv) Line 549  int main (int argc, char ** argv)
             /* Output start and end time */              /* Output start and end time */
             } else if (!strcmp(argv[arg], "-ss")) {              } else if (!strcmp(argv[arg], "-ss")) {
                 time_t local = time(NULL);                  time_t local = time(NULL);
                 TTYPrint(TDEST, "Robot started on %s\n",                  HTTrace("Robot started on %s\n",
                          HTDateTimeStr(&local, YES));                           HTDateTimeStr(&local, YES));
                 mr->flags |= MR_TIME;                  mr->flags |= MR_TIME;
   
Line 560  int main (int argc, char ** argv) Line 575  int main (int argc, char ** argv)
                       case 'u': WWWTRACE |= SHOW_URI_TRACE; break;                        case 'u': WWWTRACE |= SHOW_URI_TRACE; break;
                       default:                        default:
                         if (SHOW_MSG)                          if (SHOW_MSG)
                             TTYPrint(TDEST,"Bad parameter (%s) in -v option\n",                              HTTrace("Bad parameter (%s) in -v option\n",
                                      argv[arg]);                                       argv[arg]);
                     }                      }
                 }                  }
Line 568  int main (int argc, char ** argv) Line 583  int main (int argc, char ** argv)
 #endif  #endif
   
             } else {              } else {
                 if (SHOW_MSG) TTYPrint(TDEST,"Bad Argument (%s)\n", argv[arg]);                  if (SHOW_MSG) HTTrace("Bad Argument (%s)\n", argv[arg]);
             }              }
         } else {         /* If no leading `-' then check for URL or keywords */          } else {         /* If no leading `-' then check for URL or keywords */
             if (!keycnt) {              if (!keycnt) {
Line 594  int main (int argc, char ** argv) Line 609  int main (int argc, char ** argv)
 #endif  #endif
   
     if (!keycnt) {      if (!keycnt) {
         if (SHOW_MSG) TTYPrint(TDEST, "Please specify URL to check.\n");          if (SHOW_MSG) HTTrace("Please specify URL to check.\n");
         Cleanup(mr, -1);          Cleanup(mr, -1);
     }      }
   
Line 610  int main (int argc, char ** argv) Line 625  int main (int argc, char ** argv)
         HTRequest_setConversion(rr, list, YES);          HTRequest_setConversion(rr, list, YES);
         HTAlert_add(HTConfirm, HT_A_CONFIRM);          HTAlert_add(HTConfirm, HT_A_CONFIRM);
         if (HTLoadAnchor((HTAnchor *) ra, rr) != YES)          if (HTLoadAnchor((HTAnchor *) ra, rr) != YES)
             if (SHOW_MSG) TTYPrint(TDEST, "Can't access rules\n");              if (SHOW_MSG) HTTrace("Can't access rules\n");
         HTConversion_deleteAll(list);          HTConversion_deleteAll(list);
         HTRequest_delete(rr);          HTRequest_delete(rr);
         HTAlert_delete(HTConfirm);          HTAlert_delete(HTConfirm);
Line 620  int main (int argc, char ** argv) Line 635  int main (int argc, char ** argv)
     /* Output file specified? */      /* Output file specified? */
     if (mr->outputfile) {      if (mr->outputfile) {
         if ((mr->output = fopen(mr->outputfile, "wb")) == NULL) {          if ((mr->output = fopen(mr->outputfile, "wb")) == NULL) {
             if (SHOW_MSG) TTYPrint(TDEST, "Can't open `%s'\n", mr->outputfile);              if (SHOW_MSG) HTTrace("Can't open `%s'\n", mr->outputfile);
             mr->output = OUTPUT;              mr->output = OUTPUT;
         }          }
     }      }
Line 652  int main (int argc, char ** argv) Line 667  int main (int argc, char ** argv)
   
     if (keywords) HTChunk_delete(keywords);      if (keywords) HTChunk_delete(keywords);
     if (status != YES) {      if (status != YES) {
         if (SHOW_MSG) TTYPrint(TDEST, "Can't access resource\n");          if (SHOW_MSG) HTTrace("Can't access resource\n");
         Cleanup(mr, -1);          Cleanup(mr, -1);
     }      }
   

Removed from v.1.12  
changed lines
  Added in v.1.13


Webmaster