home *** CD-ROM | disk | FTP | other *** search
/ PC Open 48 / pcopen48.iso / Internet / HtTrack / DATA1.CAB / Sources / lib / httracklib.c < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-21  |  3.5 KB  |  121 lines

  1. /* ------------------------------------------------------------ */
  2. /*
  3. HTTrack Website Copier, Offline Browser for Windows and Unix
  4. Copyright (C) Xavier Roche, Yann Philippot
  5.  
  6. This program is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU General Public License
  8. as published by the Free Software Foundation; either version 2
  9. of the License, or any later version.
  10.  
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  19.  
  20.  
  21. Important notes:
  22.  
  23. - We hereby ask people using this source NOT to use it in purpose of grabbing
  24. emails addresses, or collecting any other private informations on persons.
  25. This would disgrace our work, and spoil the many hours we spent on it.
  26.  
  27.  
  28. This project has been developed by Xavier Roche and Yann Philippot,
  29. and originally supervised by Daniel CarrΘ and Patrick Ducrot from
  30. "ISMRA - Ensi Caen", computing department (http://www.ismra.fr)
  31. Please visit our Web site: http://httrack.free.fr
  32. */
  33.  
  34. /* ------------------------------------------------------------ */
  35. /* File: httracklib.h:                                          */
  36. /* library calling                                              */
  37. /* ------------------------------------------------------------ */
  38.  
  39. #include "httracklib.h"
  40. #include "src/httrack.h"
  41. #include "src/htsmain.h"
  42. #ifdef _WIN32
  43. #include "Winsock.h"
  44. #endif
  45. #include <stdio.h>
  46.  
  47. /*
  48.  * Name:           HTTrackLib_main
  49.  * Description:    Main HTTrack function
  50.  * Parameters:     argc (number of arguments)
  51.  *                 argv (arguments)
  52.  * Returns:        Error status
  53. */
  54. int HTTrackLib_main(int argc, char **argv) {
  55.   return hts_main(argc,argv);
  56. }
  57.  
  58.  
  59.  
  60.  
  61. /* CALLBACK FUNCTIONS */
  62.  
  63. /* Initialize the Winsock */
  64. void hts_htmlcheck_init() {
  65.   HTTrackLib_Init();
  66.   /* 
  67.   */
  68. #ifdef _WIN32
  69.   {
  70.     WORD   wVersionRequested;   // requested version WinSock API
  71.     WSADATA wsadata;            // Windows Sockets API data
  72.     int stat;
  73.     wVersionRequested = 0x0101;
  74.     stat = WSAStartup( wVersionRequested, &wsadata );
  75.     if (stat != 0) {
  76.       printf("Winsock not found!\n");
  77.       return;
  78.     } else if (LOBYTE(wsadata.wVersion) != 1  && HIBYTE(wsadata.wVersion) != 1) {
  79.       printf("WINSOCK.DLL does not support version 1.1\n");
  80.       WSACleanup();
  81.       return;
  82.     }
  83.   }
  84. #endif
  85.  
  86. }
  87. void hts_htmlcheck_uninit() {
  88.   HTTrackLib_Close();
  89.   /*
  90.   */
  91. #ifdef _WIN32
  92.   WSACleanup();
  93. #endif
  94. }
  95. int hts_htmlcheck_start() {
  96.   return HTTrackLib_Start(); 
  97. }
  98. int  hts_htmlcheck_end() { 
  99.   return HTTrackLib_End(); 
  100. }
  101. int hts_htmlcheck(char* html,int len,char* url_adresse,char* url_fichier) {
  102.   return HTTrackLib_TestParse(url_adresse,url_fichier,html,len);
  103. }
  104. int hts_htmlcheck_loop(lien_back* back,int back_max,int back_index,int lien_n,int lien_tot,int stat_bytes,int stat_bytes_recv,int stat_time,int stat_nsocket ) {
  105.  return 1; 
  106. }
  107. char* hts_htmlcheck_query(char* question) {
  108.   return "";
  109. }
  110. char* hts_htmlcheck_query2(char* question) {
  111.   static char reponse[]="YES";
  112.   return reponse;
  113. }
  114. char* hts_htmlcheck_query3(char* question) {
  115.   static char reponse[]="4";
  116.   return reponse;
  117. }
  118. int hts_htmlcheck_check(char* adr,char* fil,int status) {
  119.   return HTTrackLib_TestLink(adr,fil,status);
  120. }
  121.