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_putonefile.c < prev    next >
C/C++ Source or Header  |  2005-01-01  |  2KB  |  93 lines

  1. /* io_putonefile.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. FTPPutOneFile3(
  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 appendflag,
  42.     const char *const tmppfx,
  43.     const char *const tmpsfx,
  44.     const int resumeflag,
  45.     const int deleteflag,
  46.     const FTPConfirmResumeUploadProc resumeProc,
  47.     int UNUSED(reserved))
  48. {
  49.     int result;
  50.  
  51.     LIBNCFTP_USE_VAR(reserved);
  52.     if (cip == NULL)
  53.         return (kErrBadParameter);
  54.     if (strcmp(cip->magic, kLibraryMagic))
  55.         return (kErrBadMagic);
  56.     
  57.     if ((dstfile == NULL) || (dstfile[0] == '\0'))
  58.         return (kErrBadParameter);
  59.     if (fdtouse < 0) {
  60.         if ((file == NULL) || (file[0] == '\0'))
  61.             return (kErrBadParameter);
  62.     }
  63.     result = FTPPutOneF(cip, file, dstfile, xtype, fdtouse, appendflag, tmppfx, tmpsfx, resumeflag, deleteflag, resumeProc);
  64.     return (result);
  65. }    /* FTPPutOneFile3 */
  66.  
  67.  
  68.  
  69.  
  70. int
  71. FTPPutOneFile(const FTPCIPtr cip, const char *const file, const char *const dstfile)
  72. {
  73.     return (FTPPutOneFile3(cip, file, dstfile, kTypeBinary, -1, 0, NULL, NULL, kResumeNo, kDeleteNo, kNoFTPConfirmResumeUploadProc, 0));
  74. }    /* FTPPutOneFile */
  75.  
  76.  
  77.  
  78.  
  79. int
  80. FTPPutOneFile2(const FTPCIPtr cip, const char *const file, const char *const dstfile, const int xtype, const int fdtouse, const int appendflag, const char *const tmppfx, const char *const tmpsfx)
  81. {
  82.     return (FTPPutOneFile3(cip, file, dstfile, xtype, fdtouse, appendflag, tmppfx, tmpsfx, kResumeNo, kDeleteNo, kNoFTPConfirmResumeUploadProc, 0));
  83. }    /* FTPPutOneFile2 */
  84.  
  85.  
  86.  
  87.  
  88. int
  89. FTPPutOneFileAscii(const FTPCIPtr cip, const char *const file, const char *const dstfile)
  90. {
  91.     return (FTPPutOneFile3(cip, file, dstfile, kTypeAscii, -1, 0, NULL, NULL, kResumeNo, kDeleteNo, kNoFTPConfirmResumeUploadProc, 0));
  92. }    /* FTPPutOneFileAscii */
  93.