home *** CD-ROM | disk | FTP | other *** search
/ ftp.ncftp.com / ftp.ncftp.com.zip / ftp.ncftp.com / ncftp / older_versions / ncftp-3.2.2-src.tar.bz2 / ncftp-3.2.2-src.tar / ncftp-3.2.2 / libncftp / io_getonefile.c < prev    next >
C/C++ Source or Header  |  2005-01-01  |  2KB  |  91 lines

  1. /* io_getonefile.c
  2.  *
  3.  * Copyright (c) 1996-2005 Mike Gleason, NcFTP Software.
  4.  * All rights reserved.
  5.  *
  6.  */
  7.  
  8. #include "syshdrs.h"
  9. #ifdef PRAGMA_HDRSTOP
  10. #    pragma hdrstop
  11. #endif
  12.  
  13. #if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__)
  14. #    define ASCII_TRANSLATION 0
  15. #endif
  16.  
  17. #ifndef ASCII_TRANSLATION
  18. #    define ASCII_TRANSLATION 1
  19. #endif
  20.  
  21. #ifndef NO_SIGNALS
  22. #    define NO_SIGNALS 1
  23. #endif
  24.  
  25. #ifndef O_BINARY
  26.     /* Needed for platforms using different EOLN sequence (i.e. DOS) */
  27. #    ifdef _O_BINARY
  28. #        define O_BINARY _O_BINARY
  29. #    else
  30. #        define O_BINARY 0
  31. #    endif
  32. #endif
  33.  
  34. int
  35. FTPGetOneFile3(
  36.     const FTPCIPtr cip,
  37.     const char *const file,
  38.     const char *const dstfile,
  39.     const int xtype,
  40.     const int fdtouse,
  41.     const int resumeflag,
  42.     const int appendflag,
  43.     const int deleteflag,
  44.     const FTPConfirmResumeDownloadProc resumeProc,
  45.     int UNUSED(reserved))
  46. {
  47.     int result;
  48.  
  49.     LIBNCFTP_USE_VAR(reserved);
  50.     if (cip == NULL)
  51.         return (kErrBadParameter);
  52.     if (strcmp(cip->magic, kLibraryMagic))
  53.         return (kErrBadMagic);
  54.     
  55.     if ((file == NULL) || (file[0] == '\0'))
  56.         return (kErrBadParameter);
  57.     if (fdtouse < 0) {
  58.         if ((dstfile == NULL) || (dstfile[0] == '\0'))
  59.             return (kErrBadParameter);
  60.     }
  61.  
  62.     result = FTPGetOneF(cip, file, dstfile, xtype, fdtouse, kSizeUnknown, kModTimeUnknown, resumeflag, appendflag, deleteflag, resumeProc);
  63.     return (result);
  64. }    /* FTPGetOneFile3 */
  65.  
  66.  
  67.  
  68. int
  69. FTPGetOneFile(const FTPCIPtr cip, const char *const file, const char *const dstfile)
  70. {
  71.     return (FTPGetOneFile3(cip, file, dstfile, kTypeBinary, -1, kResumeNo, kAppendNo, kDeleteNo, (FTPConfirmResumeDownloadProc) 0, 0));
  72. }    /* FTPGetOneFile */
  73.  
  74.  
  75.  
  76.  
  77. int
  78. FTPGetOneFile2(const FTPCIPtr cip, const char *const file, const char *const dstfile, const int xtype, const int fdtouse, const int resumeflag, const int appendflag)
  79. {
  80.     return (FTPGetOneFile3(cip, file, dstfile, xtype, fdtouse, resumeflag, appendflag, kDeleteNo, (FTPConfirmResumeDownloadProc) 0, 0));
  81. }    /* FTPGetOneFile2 */
  82.  
  83.  
  84.  
  85.  
  86. int
  87. FTPGetOneFileAscii(const FTPCIPtr cip, const char *const file, const char *const dstfile)
  88. {
  89.     return (FTPGetOneFile3(cip, file, dstfile, kTypeAscii, -1, kResumeNo, kAppendNo, kDeleteNo, (FTPConfirmResumeDownloadProc) 0, 0));
  90. }    /* FTPGetOneFileAscii */
  91.