home *** CD-ROM | disk | FTP | other *** search
/ Total Network Tools 2002 / NextStepPublishing-TotalNetworkTools2002-Win95.iso / Archive / Offline Browsing / HTTrack.exe / data1.cab / Sources / lib / httracklib.c < prev    next >
Encoding:
C/C++ Source or Header  |  2001-04-28  |  3.6 KB  |  122 lines

  1. /* ------------------------------------------------------------ */
  2. /*
  3. HTTrack Website Copier, Offline Browser for Windows and Unix
  4. Copyright (C) Xavier Roche and other contributors
  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 information 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 other contributors
  29. (see the greetings and readme files)
  30.  
  31.  
  32. Please visit our Website: http://www.httrack.com
  33. */
  34.  
  35. /* ------------------------------------------------------------ */
  36. /* File: httracklib.h:                                          */
  37. /* library calling                                              */
  38. /* ------------------------------------------------------------ */
  39.  
  40. #include "httracklib.h"
  41. #include "src/httrack.h"
  42. #include "src/htsmain.h"
  43. #ifdef _WIN32
  44. #include "Winsock.h"
  45. #endif
  46. #include <stdio.h>
  47.  
  48. /*
  49.  * Name:           HTTrackLib_main
  50.  * Description:    Main HTTrack function
  51.  * Parameters:     argc (number of arguments)
  52.  *                 argv (arguments)
  53.  * Returns:        Error status
  54. */
  55. int HTTrackLib_main(int argc, char **argv) {
  56.   return hts_main(argc,argv);
  57. }
  58.  
  59.  
  60.  
  61.  
  62. /* CALLBACK FUNCTIONS */
  63.  
  64. /* Initialize the Winsock */
  65. void hts_htmlcheck_init() {
  66.   HTTrackLib_Init();
  67.   /* 
  68.   */
  69. #ifdef _WIN32
  70.   {
  71.     WORD   wVersionRequested;   // requested version WinSock API
  72.     WSADATA wsadata;            // Windows Sockets API data
  73.     int stat;
  74.     wVersionRequested = 0x0101;
  75.     stat = WSAStartup( wVersionRequested, &wsadata );
  76.     if (stat != 0) {
  77.       printf("Winsock not found!\n");
  78.       return;
  79.     } else if (LOBYTE(wsadata.wVersion) != 1  && HIBYTE(wsadata.wVersion) != 1) {
  80.       printf("WINSOCK.DLL does not support version 1.1\n");
  81.       WSACleanup();
  82.       return;
  83.     }
  84.   }
  85. #endif
  86.  
  87. }
  88. void hts_htmlcheck_uninit() {
  89.   HTTrackLib_Close();
  90.   /*
  91.   */
  92. #ifdef _WIN32
  93.   WSACleanup();
  94. #endif
  95. }
  96. int hts_htmlcheck_start() {
  97.   return HTTrackLib_Start(); 
  98. }
  99. int  hts_htmlcheck_end() { 
  100.   return HTTrackLib_End(); 
  101. }
  102. int hts_htmlcheck(char* html,int len,char* url_adresse,char* url_fichier) {
  103.   return HTTrackLib_TestParse(url_adresse,url_fichier,html,len);
  104. }
  105. int   hts_htmlcheck_loop(lien_back* back,int back_max,int back_index,int lien_tot,int lien_ntot,LLint stat_bytes,LLint stat_bytes_recv,int stat_time,int stat_nsocket,LLint stat_written, int stat_updated, int stat_errors, int irate, int nbk ) {
  106.  return 1; 
  107. }
  108. char* hts_htmlcheck_query(char* question) {
  109.   return "";
  110. }
  111. char* hts_htmlcheck_query2(char* question) {
  112.   static char reponse[]="YES";
  113.   return reponse;
  114. }
  115. char* hts_htmlcheck_query3(char* question) {
  116.   static char reponse[]="4";
  117.   return reponse;
  118. }
  119. int hts_htmlcheck_check(char* adr,char* fil,int status) {
  120.   return HTTrackLib_TestLink(adr,fil,status);
  121. }
  122.