Go to the source code of this file.
|
char * | FTPGetLocalCWD (char *buf, size_t size) |
|
char * | FGets (char *str, size_t size, FILE *fp) |
|
struct passwd * | GetPwByName (void) |
|
char * | GetPass (const char *const prompt) |
|
void | GetHomeDir (char *dst, size_t size) |
|
void | GetUsrName (char *dst, size_t size) |
|
void | CloseFile (FILE **f) |
|
void | PrintF (const FTPCIPtr cip, const char *const fmt,...) |
|
void | Error (const FTPCIPtr cip, const int pError, const char *const fmt,...) |
|
static time_t | GetUTCOffset (int mon, int mday) |
|
time_t | UnMDTMDate (char *dstr) |
|
int | GetSockBufSize (int sockfd, size_t *rsize, size_t *ssize) |
|
int | SetSockBufSize (int sockfd, size_t rsize, size_t ssize) |
|
void | Scramble (unsigned char *dst, size_t dsize, unsigned char *src, char *key) |
|
void | StrRemoveTrailingSlashes (char *dst) |
|
int | MkDirs (const char *const newdir, int mode1) |
|
int | FilenameExtensionIndicatesASCII (const char *const pathName, const char *const extnList) |
|
◆ CloseFile()
◆ Error()
Definition at line 368 of file util.c.
376 #ifndef HAVE_STRERROR 382 #ifdef HAVE_VSNPRINTF 384 buf[
sizeof(
buf) - 1] =
'\0';
395 if (
buf[
len - 1] ==
'\n') {
398 if (
buf[
len - 2] ==
'.') {
402 }
else if (
buf[
len - 1] ==
'.') {
411 # ifdef HAVE_SNPRINTF 412 sprintf(errnostr,
sizeof(errnostr) - 1,
" (errno = %d)", errnum);
413 errnostr[
sizeof(errnostr) - 1] =
'\0';
415 sprintf(errnostr,
" (errno = %d)", errnum);
419 if (endsinperiod != 0)
421 if (endsinnewline != 0)
ACPI_SIZE strlen(const char *String)
const char * strerror(int err)
#define sprintf(buf, format,...)
GLenum GLuint GLenum GLsizei const GLchar * buf
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static void(WINAPI *pDeinitMapiUtil)(void)
_Check_return_opt_ _CRTIMP int __cdecl fflush(_Inout_opt_ FILE *_File)
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
void int int ULONGLONG int va_list * ap
Referenced by FTPGetLocalCWD().
◆ FGets()
◆ FilenameExtensionIndicatesASCII()
Definition at line 963 of file util.c.
968 char extnPattern[16];
970 extn = pathName +
strlen(pathName) - 1;
972 if (extn <= pathName)
982 if (
strlen(extn) > (
sizeof(extnPattern) - 2 - 1 - 1)) {
986 snprintf(extnPattern,
sizeof(extnPattern),
#define IsLocalPathDelim(c)
ACPI_SIZE strlen(const char *String)
char * strstr(char *String1, char *String2)
#define sprintf(buf, format,...)
Referenced by AutomaticallyUseASCIIModeDependingOnExtension().
◆ FTPGetLocalCWD()
Definition at line 29 of file util.c.
32 static char *cwdBuf =
NULL;
33 static size_t cwdBufSize = 0;
35 if (cwdBufSize == 0) {
37 cwdBuf = (
char *)
malloc(cwdBufSize);
52 cwdBuf = (
char *)
Realloc(cwdBuf, cwdBufSize);
58 static char *cwdBuf =
NULL;
93 #elif defined(WIN32) || defined(_WINDOWS)
void Error(const FTPCIPtr cip, const int pError, const char *const fmt,...)
GLenum GLuint GLenum GLsizei const GLchar * buf
#define GetCurrentDirectory
static void(WINAPI *pDeinitMapiUtil)(void)
_Check_return_ _Ret_opt_z_ _CRTIMP char *__cdecl getcwd(_Out_writes_opt_(_SizeInBytes) char *_DstBuf, _In_ int _SizeInBytes)
char * Strncpy(char *const, const char *const, const size_t)
void * Realloc(void *, size_t)
Referenced by DoOpen(), LocalChdirCmd(), LocalPwdCmd(), PostInit(), SpoolGetCmd(), SpoolPutCmd(), and SpoolX().
◆ GetHomeDir()
Definition at line 240 of file util.c.
242 #if defined(WIN32) || defined(_WINDOWS) 243 const char *homedrive, *homepath;
245 homedrive =
getenv(
"HOMEDRIVE");
246 homepath =
getenv(
"HOMEPATH");
247 if ((homedrive !=
NULL) && (homepath !=
NULL)) {
269 #if defined(USE_GETPWUID) 280 else if ((
cp = (
const char *)
getenv(
"LOGNAME")) ==
NULL)
char * Strncat(char *const, const char *const, const size_t)
struct passwd * GetPwByName(void)
static void(WINAPI *pDeinitMapiUtil)(void)
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
char * Strncpy(char *const, const char *const, const size_t)
Referenced by ExpandTilde().
◆ GetPass()
Definition at line 186 of file util.c.
190 #elif defined(_CONSOLE) && (defined(WIN32) || defined(_WINDOWS)) 191 static char pwbuf[128];
201 for (
dst = pwbuf, dlim =
dst +
sizeof(pwbuf) - 1;;) {
203 if ((
c == 0) || (
c == 0xe0)) {
207 if ((
c ==
'\r') || (
c ==
'\n'))
218 static char pwbuf[128];
221 #if defined(WIN32) || defined(_WINDOWS) _Check_return_ _CRTIMP int __cdecl _isatty(_In_ int _FileHandle)
char * FGets(char *str, size_t size, FILE *fp)
char * getpass(const char *prompt)
_Check_return_ _CRTIMP int __cdecl isatty(_In_ int _FileHandle)
static void(WINAPI *pDeinitMapiUtil)(void)
_Check_return_opt_ _CRTIMP int __cdecl fflush(_Inout_opt_ FILE *_File)
_Check_return_ _CRTIMP int __cdecl _fileno(_In_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl fputs(_In_z_ const char *_Str, _Inout_ FILE *_File)
Referenced by DECLARE_INTERFACE_().
◆ GetPwByName()
◆ GetSockBufSize()
Definition at line 534 of file util.c.
543 optsize =
sizeof(opt);
552 optsize =
sizeof(opt);
INT WSAAPI getsockopt(IN SOCKET s, IN INT level, IN INT optname, OUT CHAR FAR *optval, IN OUT INT FAR *optlen)
◆ GetUsrName()
Definition at line 290 of file util.c.
292 #if defined(WIN32) || defined(_WINDOWS) 315 else if ((
cp = (
const char *)
getenv(
"LOGNAME")) ==
NULL)
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
struct passwd * GetPwByName(void)
static void(WINAPI *pDeinitMapiUtil)(void)
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
char * Strncpy(char *const, const char *const, const size_t)
Referenced by FTPInitializeAnonPassword().
◆ GetUTCOffset()
Definition at line 449 of file util.c.
451 struct tm local_tm, utc_tm, *utc_tmptr;
452 time_t local_t, utc_t, utcOffset;
458 local_tm.tm_year = 94;
459 local_tm.tm_mon = mon;
460 local_tm.tm_mday = mday;
461 local_tm.tm_hour = 12;
462 local_tm.tm_isdst = -1;
463 local_t =
mktime(&local_tm);
465 if (local_t != (
time_t) -1) {
466 utc_tmptr =
gmtime(&local_t);
467 utc_tm.tm_year = utc_tmptr->
tm_year;
468 utc_tm.tm_mon = utc_tmptr->
tm_mon;
469 utc_tm.tm_mday = utc_tmptr->
tm_mday;
470 utc_tm.tm_hour = utc_tmptr->
tm_hour;
471 utc_tm.tm_isdst = -1;
475 utcOffset = (local_t - utc_t);
_CRTIMP time_t __cdecl mktime(struct tm *_Tm)
_CRTIMP struct tm *__cdecl gmtime(const time_t *_Time)
Referenced by UnMDTMDate().
◆ MkDirs()
Definition at line 785 of file util.c.
790 #if defined(WIN32) || defined(_WINDOWS) 798 #if defined(WIN32) || defined(_WINDOWS) 799 if ((
isalpha(newdir[0])) && (newdir[1] ==
':')) {
806 }
else if (newdir[3] ==
'\0') {
816 if (
_access(newdir, 00) == 0) {
817 if (
_stat(newdir, &st) < 0)
827 if (
Stat(newdir, &st) < 0)
838 if (
s[
sizeof(
s) - 1] !=
'\0') {
849 #if defined(WIN32) || defined(_WINDOWS) 857 }
else if (
cp[1] ==
'\0') {
868 #if defined(WIN32) || defined(_WINDOWS) 889 #if defined(WIN32) || defined(_WINDOWS) 943 #if defined(WIN32) || defined(_WINDOWS) #define IsLocalPathDelim(c)
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
_Check_return_ _CRTIMP int __cdecl _access(_In_z_ const char *_Filename, _In_ int _AccessMode)
static void(WINAPI *pDeinitMapiUtil)(void)
_CRTIMP int __cdecl _stat(_In_z_ const char *_Name, _Out_ struct _stat *_Stat)
GLuint GLint GLboolean GLint GLenum access
#define StrRFindLocalPathDelim(a)
#define StrFindLocalPathDelim(a)
Referenced by FTPGetFiles3(), InitOurDirectory(), LocalMkdirCmd(), and MkSpoolDir().
◆ PrintF()
Definition at line 340 of file util.c.
351 #ifdef HAVE_VSNPRINTF 353 buf[
sizeof(
buf) - 1] =
'\0';
GLenum GLuint GLenum GLsizei const GLchar * buf
static void(WINAPI *pDeinitMapiUtil)(void)
_Check_return_opt_ _CRTIMP int __cdecl fflush(_Inout_opt_ FILE *_File)
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
void int int ULONGLONG int va_list * ap
_Check_return_opt_ _CRTIMP int __cdecl vfprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format, va_list _ArgList)
Referenced by FTPAbortDataTransfer(), FTPGetFiles3(), FTPLoginHost(), FTPOpenHost(), FTPOpenHostNoLogin(), FTPPutFiles3(), FTPRemoteGlob(), LazyUnixLocalGlob(), OpenControlConnection(), PrintResponse(), SendCommand(), and TraceResponse().
◆ Scramble()
Definition at line 607 of file util.c.
615 k2 = (
unsigned char *)
key;
616 for (
i=0;
i < (
int) dsize - 1;
i++) {
620 dst[
i] = (
unsigned char) (ch ^ (
int) (k2[
i % (
int) keyLen]));
ACPI_SIZE strlen(const char *String)
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
◆ SetSockBufSize()
Definition at line 572 of file util.c.
581 if (ssize > 0 || rsize > 0) {
583 optsize =
sizeof(opt);
590 optsize =
sizeof(opt);
595 optsize =
sizeof(opt);
INT WSAAPI setsockopt(IN SOCKET s, IN INT level, IN INT optname, IN CONST CHAR FAR *optval, IN INT optlen)
Referenced by OpenControlConnection(), and OpenDataConnection().
◆ StrRemoveTrailingSlashes()
void StrRemoveTrailingSlashes |
( |
char * |
dst | ) |
|
◆ UnMDTMDate()
Definition at line 486 of file util.c.
495 if (
strncmp(dstr,
"19100", 5) == 0) {
511 if (
sscanf(dstr,
"%04d%02d%02d%02d%02d%02d",
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
static time_t GetUTCOffset(int mon, int mday)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
static void(WINAPI *pDeinitMapiUtil)(void)
_CRTIMP struct tm *__cdecl localtime(const time_t *_Time)
_CRTIMP time_t __cdecl mktime(struct tm *_Tm)
Referenced by FTPFileModificationTime(), and UnMlsT().