10 static const char *
rwx[9] = {
"---",
"--x",
"-w-",
"-wx",
"r--",
"r-x",
"rw-",
"rwx",
NULL };
55 endp = dp +
sizeof(patPrefix) - 1;
57 for (
cp = (
char *)
pattern; dp < endp; ) {
69 plen = (
size_t) (dp - patPrefix);
72 for (lp=fileList->
first; lp !=
NULL; lp = nextLine) {
81 if ((*prev !=
'\0') && (
STREQ(
cur, prev))) {
115 if ((
cp !=
NULL) &&
STREQ(
cp,
": No such file or directory")) {
141 mon = (*
cp ==
'u') ? 7 : 3;
152 mon = (*
cp ==
'l') ? 6 : 5;
157 mon = (*++
cp ==
'r') ? 2 : 4;
176 const char *
const curdir,
249 if (((
cp[5] ==
'P') || (
cp[5] ==
'p')) && (hour < 12))
251 else if (((
cp[5] ==
'A') || (
cp[5] ==
'a')) && (hour == 12))
257 if (*ftype == (
time_t) -1)
265 if ((*
cp ==
'<') && (
cp[1] ==
'D')) {
270 }
else if ((*
cp ==
'<') && (
cp[1] ==
'J')) {
306 #if defined(HAVE_LONG_LONG) && defined(SCANF_LONG_LONG) 311 #elif defined(HAVE_LONG_LONG) && defined(HAVE_STRTOQ) 337 if (curdirlen == 0) {
354 const char *
const curdir,
368 int mon = 0, dd = 0,
hr = 0,
min = 0, year = 0;
369 char *monstart, *ddstart, *hrstart, *minstart, *yearstart;
370 char *linktostart, *filestart =
NULL;
428 year =
atoi(yearstart);
435 *plugend = (
int) (pe -
line) + 1;
467 *plugend = (
int) (pe -
line) + 1;
476 linktostart =
strstr(filestart,
" -> ");
477 if (linktostart !=
NULL) {
485 if (curdirlen == 0) {
510 }
else if (*
ftime > (
now + (15552000
L + 86400
L))) {
513 }
else if (*
ftime < (
now - (15552000
L + 86400
L))) {
527 #if defined(HAVE_LONG_LONG) && defined(SCANF_LONG_LONG) 529 #elif defined(HAVE_LONG_LONG) && defined(HAVE_STRTOQ) 565 int hadblankline = 0;
567 size_t curdirlen = 0;
580 int linesconverted = 0;
581 size_t maxFileLen = 0;
582 size_t maxPlugLen = 0;
591 thisyear = nowtm->
tm_year + 1900;
618 if ((hadblankline != 0) && (
line[
len - 1] ==
':')) {
621 if ((
line[0] ==
'.') && (
line[1] ==
'/')) {
625 }
else if ((
line[0] ==
'.') && (
line[1] ==
'\\')) {
638 rc =
UnLslRLine(
line, curdir, curdirlen, fname,
sizeof(fname), linkto,
sizeof(linkto), &ftype, &
fsize, &
ftime,
now, thisyear, &plugend);
649 if (fileLen > maxFileLen)
650 maxFileLen = fileLen;
660 fi.
plug = (
char *)
malloc((
size_t) plugend + 1);
663 fi.
plug[plugend] =
'\0';
664 if ((
size_t) plugend > maxPlugLen)
665 maxPlugLen = (
size_t) plugend;
670 strcpy(fi.
plug,
"---------- 1 ftpuser ftpusers");
686 return ((linesconverted > 0) ? linesconverted : (-1));
695 char *
cp, *
val, *fact;
720 while (*
cp !=
'\0') {
721 for (fact =
cp; ;
cp++) {
722 if ((*
cp ==
'\0') || (*
cp ==
' ')) {
741 }
else if (*
cp ==
';') {
755 if (
ISTREQ(fact,
"type")) {
770 }
else if (
ISTREQ(fact,
"UNIX.mode")) {
775 if (mlip->
mode != (-1))
777 }
else if (
ISTREQ(fact,
"perm")) {
779 }
else if (
ISTREQ(fact,
"size")) {
780 #if defined(HAVE_LONG_LONG) && defined(SCANF_LONG_LONG) 782 #elif defined(HAVE_LONG_LONG) && defined(HAVE_STRTOQ) 792 }
else if (
ISTREQ(fact,
"modify")) {
794 }
else if (
ISTREQ(fact,
"UNIX.owner")) {
796 }
else if (
ISTREQ(fact,
"UNIX.group")) {
798 }
else if (
ISTREQ(fact,
"UNIX.uid")) {
800 }
else if (
ISTREQ(fact,
"UNIX.gid")) {
802 }
else if (
ISTREQ(fact,
"perm")) {
812 if (
len > (
sizeof(mlip->
fname) - 1)) {
836 int linesconverted = 0;
837 int linesignored = 0;
838 size_t maxFileLen = 0;
839 size_t maxPlugLen = 0;
840 size_t fileLen, plugLen;
842 const char *cm1, *cm2, *cm3;
851 if (fileLen > maxFileLen)
852 maxFileLen = fileLen;
861 plug[0] = (
char) mli.
ftype;
866 if (mli.
mode != (-1)) {
867 m1 = (mli.
mode & 00700) >> 6;
868 m2 = (mli.
mode & 00070) >> 3;
869 m3 = (mli.
mode & 00007);
871 if (mli.
perm[0] !=
'\0') {
873 if (fi.
type ==
'd') {
901 sprintf(plug + 1,
"%s%s%s", cm1, cm2, cm3);
903 if (mli.
owner[0] !=
'\0') {
904 if (mli.
group[0] !=
'\0') {
922 if (plugLen > maxPlugLen)
923 maxPlugLen = plugLen;
926 }
else if (rc == (-2)) {
935 linesconverted += linesignored;
936 return ((linesconverted > 0) ? linesconverted : (-1));
960 n =
list->nFileInfos;
961 for (
i=0;
i<
n;
i++) {
1046 for (filePtr = fileList->
first;
1048 filePtr = nextFilePtr)
1050 nextFilePtr = filePtr->
next;
1052 rdir = filePtr->
line;
1086 #if defined(WIN32) || defined(_WINDOWS) 1099 if (relpath[0] !=
'\0') {
1105 fi.
mdtm = st->st_mtime;
1115 c2 = relpath +
strlen(relpath);
1119 memset(&ffd, 0,
sizeof(ffd));
1129 file = ffd.cFileName;
1130 if ((*
file ==
'.') && ((
file[1] ==
'\0') || ((
file[1] ==
'.') && (
file[2] ==
'\0')))) {
1138 if (
Lstat(fullpath, st) < 0) {
1143 fi.
relname =
StrDup(relpath + (((relpath[0] ==
'/') || (relpath[0] ==
'\\')) ? 1 : 0));
1146 fi.
mdtm = st->st_mtime;
1152 Traverse(cip, fullpath, st, relpath, filp);
1162 memset(&ffd, 0,
sizeof(ffd));
1164 #else // __REACTOS__ 1166 memset(&ffd, 0,
sizeof(ffd));
1168 #endif // __REACTOS__ 1194 if (relpath[0] !=
'\0') {
1200 fi.
mdtm = st->st_mtime;
1211 c2 = relpath +
strlen(relpath);
1224 if ((dname[0] ==
'.') && ((dname[1] ==
'\0') || ((dname[1] ==
'.') && (dname[2] ==
'\0'))))
1229 if (
Lstat(fullpath, st) < 0) {
1234 fi.
relname =
StrDup(relpath + (((relpath[0] ==
'/') || (relpath[0] ==
'\\')) ? 1 : 0));
1237 fi.
mdtm = st->st_mtime;
1248 Traverse(cip, fullpath, st, relpath, filp);
1279 #if defined(WIN32) || defined(_WINDOWS) 1292 for (filePtr = fileList->
first;
1294 filePtr = nextFilePtr)
1296 nextFilePtr = filePtr->
next;
1299 if ((erelative != 0) || (
strcmp(filePtr->
line,
".") == 0) || (filePtr->
line[0] ==
'\0'))
1305 if (
Lstat(fullpath, &st) < 0) {
1310 if (
S_ISDIR(st.st_mode) == 0) {
1311 fi.relname =
StrDup(relpath);
1313 fi.lname =
StrDup(fullpath);
1314 fi.mdtm = st.st_mtime;
1324 Traverse(cip, fullpath, &st, relpath, files);
1344 const char *lsflags;
1353 if (fileList ==
NULL)
1378 if (*lsflags ==
'\0')
1390 if (fileList->
first == fileList->
last) {
1391 #define glberr(a) (ISTRNEQ(cp, a, strlen(a))) 1397 if (
glberr(
": No such file or directory")) {
1401 }
else if (
glberr(
": No match")) {
1432 char *
cp, *rest, *firstent;
1433 #if defined(WIN32) || defined(_WINDOWS) 1448 if (pat[1] ==
'\0') {
1453 #if defined(WIN32) || defined(_WINDOWS) 1457 pw = getpwnam(pat + 1);
1459 firstent = pw->pw_dir;
1477 #if defined(WIN32) || defined(_WINDOWS) 1497 memset(&ffd, 0,
sizeof(ffd));
1503 return ((
dwErr == 0) ? 0 : -1);
1515 file = ffd.cFileName;
1516 if ((
file[0] ==
'.') && ((
file[1] ==
'\0') || ((
file[1] ==
'.') && (
file[2] ==
'\0')))) {
1549 #ifdef HAVE_SNPRINTF 1552 cmd[
sizeof(
cmd) - 1] =
'\0';
1566 PrintF(cip,
" Lglob [%s]\n", gfile);
1590 if (fileList ==
NULL)
1605 #if defined(WIN32) || defined(_WINDOWS) 1606 result = WinLocalGlob(cip, fileList, pattern2);
1631 if (maxdepth <= 0) {
1643 for (filePtr = fileList.
first;
1645 filePtr = filePtr->
next)
1653 if ((
file[0] ==
'.') && ((
file[1] ==
'\0') || ((
file[1] ==
'.') && (
file[2] ==
'\0'))))
1661 }
else if (
result == 1) {
1710 char savedcwd[1024];
1717 }
else if (
result == 0) {
1740 result2 = (*proc)(cip, curcwd,
kFtwDir);
int ComputeRNames(FileInfoListPtr dst, const char *dstdir, int pflag, int nochop)
#define IsLocalPathDelim(c)
#define memmove(s1, s2, n)
void SortFileInfoList(FileInfoListPtr list, int sortKey, int sortOrder)
int UnMlsT(const char *const line0, const MLstItemPtr mlip)
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
#define kCommandAvailable
int FTPLocalRecursiveFileList(FTPCIPtr cip, LineListPtr fileList, FileInfoListPtr files)
ACPI_SIZE strlen(const char *String)
int FTPFtw(const FTPCIPtr cip, const char *const dir, FTPFtwProc proc, int maxdepth)
char * strstr(char *String1, char *String2)
static void ExpandTilde(char *pattern, size_t siz)
#define kCommandAvailabilityUnknown
time_t UnMDTMDate(char *)
#define INVALID_HANDLE_VALUE
#define STRNCPY(dst, src, n)
DWORD WINAPI GetLastError(VOID)
void VectorizeFileInfoList(FileInfoListPtr list)
int FTPLocalRecursiveFileList2(FTPCIPtr cip, LineListPtr fileList, FileInfoListPtr files, int erelative)
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
_Check_return_ _CRTIMP int __cdecl isalnum(_In_ int _C)
int ConcatFileInfoList(FileInfoListPtr dst, FileInfoListPtr src)
#define sprintf(buf, format,...)
DIR *__cdecl opendir(const char *)
char * Strncat(char *const, const char *const, const size_t)
void UnvectorizeFileInfoList(FileInfoListPtr list)
int ConcatFileToFileInfoList(FileInfoListPtr dst, char *rfile)
int UnLslR(FileInfoListPtr filp, LineListPtr llp, int serverType)
static int LsMonthNameToNum(char *cp)
int FTPLocalGlob(FTPCIPtr cip, LineListPtr fileList, const char *pattern, int doGlob)
#define kServerTypeMicrosoftFTP
FileInfoPtr AddFileInfo(FileInfoListPtr list, FileInfoPtr src)
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
#define ERROR_NO_MORE_FILES
void InitFileInfoList(FileInfoListPtr list)
static int UnDosLine(char *const line, const char *const curdir, size_t curdirlen, char *fname, size_t fnamesize, int *ftype, longest_int *fsize, time_t *ftime)
#define FILE_ATTRIBUTE_DIRECTORY
char * FGets(char *, size_t, FILE *)
int FTPRemoteRecursiveFileList1(FTPCIPtr cip, char *const rdir, FileInfoListPtr files)
static int LazyUnixLocalGlob(FTPCIPtr cip, LineListPtr fileList, const char *const pattern)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
LinePtr AddLine(LineListPtr list, const char *buf1)
#define kErrNotADirectory
#define kErrCannotGoToPrevDir
int FTPRemoteRecursiveFileList(FTPCIPtr cip, LineListPtr fileList, FileInfoListPtr files)
#define memcpy(s1, s2, n)
_CRTIMP struct tm *__cdecl localtime(const time_t *_Time)
int __cdecl closedir(DIR *)
int FTPListToMemory2(const FTPCIPtr cip, const char *const pattern, const LineListPtr llines, const char *const lsflags, const int blankLines, int *const tryMLSD)
#define kCommandNotAvailable
struct dirent *__cdecl readdir(DIR *)
int FTPChdir(const FTPCIPtr cip, const char *const cdCwd)
static int UnLslRLine(char *const line, const char *const curdir, size_t curdirlen, char *fname, size_t fnamesize, char *linkto, size_t linktosize, int *ftype, longest_int *fsize, time_t *ftime, time_t now, int thisyear, int *plugend)
int FTPRemoteGlob(FTPCIPtr cip, LineListPtr fileList, const char *pattern, int doGlob)
#define kErrRecursionLimitReached
__CRT_INLINE void __cdecl ftime(struct timeb *_Tmb)
void PrintF(const FTPCIPtr cip, const char *const fmt,...)
void DisposeFileInfoListContents(FileInfoListPtr list)
int UnMlsD(FileInfoListPtr filp, LineListPtr llp)
static unsigned __int64 next
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
char * Strnpcat(char *const, const char *const, size_t)
#define GLOBCHARSINSTR(a)
char * Strncpy(char *const, const char *const, const size_t)
#define LOCAL_PATH_DELIM_STR
LinePtr RemoveLine(LineListPtr list, LinePtr killMe)
void InitLineList(LineListPtr list)
_CRTIMP time_t __cdecl mktime(struct tm *_Tm)
int FTPGetCWD(const FTPCIPtr cip, char *const newCwd, const size_t newCwdSize)
int FTPIsDir(const FTPCIPtr cip, const char *const dir)
char * strchr(const char *String, int ch)
void GetHomeDir(char *, size_t)
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
char * strcpy(char *DstString, const char *SrcString)
#define StrRFindLocalPathDelim(a)
int strcmp(const char *String1, const char *String2)
int readlink(const char *path, char *buf, size_t size)
int(* FTPFtwProc)(const FTPCIPtr cip, const char *fn, int flag)
_Check_return_ _CRTIMP int __cdecl ispunct(_In_ int _C)
void DisposeLineListContents(LineListPtr list)
static int FTPFtwL2(const FTPCIPtr cip, char *dir, char *end, size_t dirsize, FTPFtwProc proc, int maxdepth)
static void Traverse(FTPCIPtr cip, char *fullpath, struct Stat *st, char *relpath, FileInfoListPtr filp)
#define StrFindLocalPathDelim(a)
static const char * rwx[9]
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
BOOL WINAPI FindClose(HANDLE hFindFile)
static void RemoteGlobCollapse(const char *pattern, LineListPtr fileList)