26 else if (
strcmp(cdCwd,
"..") == 0)
51 int onceResult, batchResult;
62 for (batchResult =
kNoErr, filePtr = fileList.
first;
64 filePtr = filePtr->
next)
74 batchResult = onceResult;
77 if (onceResult != 2) {
102 for (filePtr = fileList.
first;
104 filePtr = filePtr->
next)
112 if ((
file[0] ==
'.') && ((
file[1] ==
'\0') || ((
file[1] ==
'.') && (
file[2] ==
'\0'))))
200 int onceResult, batchResult;
208 if (batchResult !=
kNoErr)
209 return (batchResult);
211 for (batchResult =
kNoErr, filePtr = fileList.
first;
213 filePtr = filePtr->
next)
222 if (onceResult < 0) {
223 batchResult = onceResult;
226 if (onceResult != 2) {
232 if (onceResult < 0) {
233 batchResult = onceResult;
236 if (onceResult != 2) {
238 if (onceResult < 0) {
247 return (batchResult);
265 if ((newCwd ==
NULL) || (newCwdSize == 0)) {
324 if ((newCwd ==
NULL) || (cdCwd ==
NULL)) {
328 if (cdCwd[0] ==
'\0') {
338 if (
strcmp(cdCwd,
"..") == 0)
421 if ((cdCwd[0] ==
'\0') || (
strcmp(cdCwd,
".") == 0)) {
442 if (
strcmp(startcp,
".") == 0) {
444 if ((lastSubDir != 0) && (
pwd != 0))
446 }
else if ((lastSubDir != 0) && (
pwd != 0)) {
452 if ((mkd != 0) && (*startcp !=
'\0')) {
453 if (
FTPCmd(cip,
"MKD %s", startcp) == 2) {
463 }
while ((!lastSubDir) && (
result == 0));
472FTPMkdir2(
const FTPCIPtr cip,
const char *
const newDir,
const int recurse,
const char *
const curDir)
475 char *
cp, *newTreeStart, *cp2;
485 if ((newDir ==
NULL) || (newDir[0] ==
'\0')) {
491 if ((curDir ==
NULL) || (curDir[0] ==
'\0')) {
506 result2 =
FTPChdir(cip, ((curDir ==
NULL) || (curDir[0] ==
'\0')) ? cip->
buf : curDir);
536 if ((newDir ==
NULL) || (newDir[0] ==
'\0')) {
542 if ((*
cp !=
'/') && (*
cp !=
'\\')) {
572 if (
dir[0] ==
'\0') {
597 newTreeStart = dir2 + ((
cp + 1) -
dir);
598 for (
cp = newTreeStart; ; ) {
629 result2 =
FTPChdir(cip, ((curDir ==
NULL) || (curDir[0] ==
'\0')) ? cip->
buf : curDir);
630 if ((
result == 0) && (result2 < 0)) {
678 Error(cip,
kDontPerror,
"Warning: Server has Y2K Bug in \"MDTM\" command.\n");
711 if ((oldname ==
NULL) || (oldname[0] ==
'\0'))
713 if ((newname ==
NULL) || (oldname[0] ==
'\0'))
789 int onceResult, batchResult;
797 if (batchResult !=
kNoErr)
798 return (batchResult);
800 for (batchResult =
kNoErr, filePtr = fileList.
first;
802 filePtr = filePtr->
next)
811 if (onceResult < 0) {
812 batchResult = onceResult;
815 if (onceResult != 2) {
818 if (onceResult < 0) {
829 return (batchResult);
920#if defined(HAVE_LONG_LONG) && defined(SCANF_LONG_LONG)
922#elif defined(HAVE_LONG_LONG) && defined(HAVE_STRTOQ)
1048 result =
RCmd(cip, rp,
"STAT %s",
"NoSuchFile");
1088 return (cip->
errNo);
1241 (fileList.
nLines >= 1) &&
1264 return (cip->
errNo);
1293 (fileList.
nLines >= 1) &&
1321 (fileList.
nLines >= 1) &&
1350FTPFileExists2(
const FTPCIPtr cip,
const char *
const file,
const int tryMDTM,
const int trySIZE,
const int tryMLST,
const int trySTAT,
const int tryNLST)
1464 *mdtm = mlsInfo.
ftime;
1490 if (ftype ==
NULL) {
1498 *ftype = mlsInfo.
ftype;
1591 if ((lfrom[0] ==
'\0') || (lto[0] ==
'\0'))
1593 if (
FTPCmd(cip,
"SITE SYMLINK %s %s", lfrom, lto) == 2)
1608 if ((umsk ==
NULL) || (umsk[0] ==
'\0'))
1610 if (
FTPCmd(cip,
"SITE UMASK %s", umsk) == 2)
1629 buf[
sizeof(
buf) - 1] =
'\0';
1651 char mstr[64], astr[64], cstr[64];
1681 result =
RCmd(cip, rp,
"SITE UTIME %s %s %s %s UTC",
file, astr, mstr, cstr);
1685 }
else if (
result == 2) {
char * Strncpy(char *const, const char *const, const size_t)
int strcmp(const char *String1, const char *String2)
char * strstr(char *String1, char *String2)
ACPI_SIZE strlen(const char *String)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
char * strchr(const char *String, int ch)
#define STRNCPY(dst, src, n)
void pwd(int argc, const char *argv[])
void modtime(int argc, const char *argv[])
GLuint GLuint GLsizei GLenum type
GLdouble GLdouble GLdouble r
GLenum GLuint GLenum GLsizei const GLchar * buf
int UnMlsT(const char *const line0, const MLstItemPtr mlip)
int FTPRemoteGlob(FTPCIPtr cip, LineListPtr fileList, const char *pattern, int doGlob)
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
void InitLineList(LineListPtr list)
void DisposeLineListContents(LineListPtr list)
int CopyLineList(LineListPtr dst, LineListPtr src)
int FTPMListOneFile(const FTPCIPtr cip, const char *const file, const MLstItemPtr mlip)
int FTPRmdir(const FTPCIPtr cip, const char *const pattern, const int recurse, const int doGlob)
int FTPSymlink(const FTPCIPtr cip, const char *const lfrom, const char *const lto)
int FTPFileSizeAndModificationTime(const FTPCIPtr cip, const char *const file, longest_int *const size, const int type, time_t *const mdtm)
static void GmTimeStr(char *const dst, const size_t dstsize, time_t t)
int FTPFileExistsStat(const FTPCIPtr cip, const char *const file)
int FTPMkdir(const FTPCIPtr cip, const char *const newDir, const int recurse)
int FTPFileType(const FTPCIPtr cip, const char *const file, int *const ftype)
int FTPUtime(const FTPCIPtr cip, const char *const file, time_t actime, time_t modtime, time_t crtime)
int FTPFileModificationTime(const FTPCIPtr cip, const char *const file, time_t *const mdtm)
int FTPMkdir2(const FTPCIPtr cip, const char *const newDir, const int recurse, const char *const curDir)
int FTPFileExistsNlst(const FTPCIPtr cip, const char *const file)
static int FTPRmdirRecursive(const FTPCIPtr cip, const char *const dir)
int FTPFileExists2(const FTPCIPtr cip, const char *const file, const int tryMDTM, const int trySIZE, const int tryMLST, const int trySTAT, const int tryNLST)
int FTPChmod(const FTPCIPtr cip, const char *const pattern, const char *const mode, const int doGlob)
int FTPUmask(const FTPCIPtr cip, const char *const umsk)
int FTPDelete(const FTPCIPtr cip, const char *const pattern, const int recurse, const int doGlob)
int FTPRemoteHelp(const FTPCIPtr cip, const char *const pattern, const LineListPtr llp)
int FTPGetCWD(const FTPCIPtr cip, char *const newCwd, const size_t newCwdSize)
int FTPRename(const FTPCIPtr cip, const char *const oldname, const char *const newname)
int FTPIsDir(const FTPCIPtr cip, const char *const dir)
int FTPChdir(const FTPCIPtr cip, const char *const cdCwd)
int FTPIsRegularFile(const FTPCIPtr cip, const char *const file)
static int FTPRmdirRecursiveL2(const FTPCIPtr cip)
int FTPChdir3(FTPCIPtr cip, const char *const cdCwd, char *const newCwd, const size_t newCwdSize, int flags)
int FTPFileSize(const FTPCIPtr cip, const char *const file, longest_int *const size, const int type)
int FTPSetTransferType(const FTPCIPtr cip, int type)
int FTPFileExists(const FTPCIPtr cip, const char *const file)
int FTPChdirAndGetCWD(const FTPCIPtr cip, const char *const cdCwd, char *const newCwd, const size_t newCwdSize)
int FTPListToMemory2(const FTPCIPtr cip, const char *const pattern, const LineListPtr llines, const char *const lsflags, const int blankLines, int *const tryMLSD)
#define sprintf(buf, format,...)
int FTPCmd(const FTPCIPtr cip, const char *const cmdspec,...)
int RCmd(const FTPCIPtr, ResponsePtr, const char *,...)
#define kServerTypeNcFTPd
#define UNIMPLEMENTED_CMD(a)
#define kCommandAvailable
void DoneWithResponse(const FTPCIPtr, ResponsePtr)
#define StrFindLocalPathDelim(a)
time_t UnMDTMDate(char *)
#define kCommandAvailabilityUnknown
#define kCommandNotAvailable
ResponsePtr InitResponse(void)
#define kErrSTATwithFileNotAvailable
#define kErrSYMLINKFailed
#define kErrNLSTwithFileNotAvailable
#define kErrMLSTNotAvailable
#define kErrInvalidDirParam
#define kErrCantTellIfFileExists
#define kErrMDTMNotAvailable
#define kErrBadTransferType
#define kErrUTIMENotAvailable
#define kErrNoSuchFileOrDirectory
#define kErrInvalidMLSTResponse
#define kErrFileExistsButCannotDetermineType
#define kErrSIZENotAvailable
#define kErrCannotGoToPrevDir
_CRT_RESTORE_GCC_WARNINGS _CRT_DISABLE_GCC_WARNINGS _Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
_CRTIMP struct tm *__cdecl gmtime(const time_t *_Time)
char * startingWorkingDirectory
char lastFTPCmdResultStr[128]