10 #if defined(WIN32) || defined(_WINDOWS) 12 extern void GetSpecialDir(
char *
dst,
size_t size,
int whichDir);
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) 130 #if defined(WIN32) || defined(_WINDOWS) 145 systemTime.
wHour * 3600 +
146 systemTime.
wDay * 86400;
158 #if defined(WIN32) || defined(_WINDOWS) 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) 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)
292 #if defined(WIN32) || defined(_WINDOWS) 315 else if ((
cp = (
const char *)
getenv(
"LOGNAME")) ==
NULL)
351 #ifdef HAVE_VSNPRINTF 353 buf[
sizeof(
buf) - 1] =
'\0';
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)
451 struct tm local_tm, utc_tm, *utc_tmptr;
452 time_t local_t, utc_t, utcOffset;
463 local_t =
mktime(&local_tm);
465 if (local_t != (
time_t) -1) {
466 utc_tmptr =
gmtime(&local_t);
475 utcOffset = (local_t - utc_t);
495 if (
strncmp(dstr,
"19100", 5) == 0) {
511 if (
sscanf(dstr,
"%04d%02d%02d%02d%02d%02d",
543 optsize =
sizeof(opt);
552 optsize =
sizeof(opt);
581 if (ssize > 0 || rsize > 0) {
583 optsize =
sizeof(opt);
590 optsize =
sizeof(opt);
595 optsize =
sizeof(opt);
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]));
629 #if defined(WIN32) || defined(_WINDOWS) 630 void WinSleep(
unsigned int seconds)
633 DWORD milliseconds = seconds * 1000;
635 if (milliseconds > 0) {
637 deadline =
now + milliseconds;
638 if (
now < deadline) {
641 milliseconds = deadline -
now;
644 }
while (
now < deadline);
648 milliseconds -= (0xFFFFFFFF -
now);
652 }
while (
now > deadline);
654 deadline =
now + milliseconds;
656 milliseconds = deadline -
now;
659 }
while (
now < deadline);
684 return ((
char *)
first);
704 return ((
char *)
last);
716 if ((
cp ==
NULL) || (
cp[1] !=
'\0'))
773 if ((
cp ==
NULL) || (
cp[1] !=
'\0'))
777 while ((
cp >
dst) && (*
cp ==
'/'))
785 MkDirs(
const char *
const newdir,
int mode1)
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) 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),
1025 #ifdef HAVE_SIGACTION 1028 struct sigaction
sa, osa;
1030 (
void) sigemptyset(&
sa.sa_mask);
1033 if (signum == SIGALRM) {
1035 sa.sa_flags |= SA_INTERRUPT;
1039 sa.sa_flags |= SA_RESTART;
1042 if (sigaction(signum, &
sa, &osa) < 0)
1044 return (osa.sa_handler);
#define IsLocalPathDelim(c)
void GetHomeDir(char *dst, size_t size)
time_t UnMDTMDate(char *dstr)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
char * GetPass(const char *const prompt)
ACPI_SIZE strlen(const char *String)
#define LocalPathToTVFSPath(s)
char * strstr(char *String1, char *String2)
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
DWORD WINAPI GetTickCount(VOID)
_Check_return_ _CRTIMP int __cdecl _isatty(_In_ int _FileHandle)
int MkDirs(const char *const newdir, int mode1)
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
const char * strerror(int err)
void Error(const FTPCIPtr cip, const int pError, const char *const fmt,...)
char * FGets(char *str, size_t size, FILE *fp)
#define sprintf(buf, format,...)
GLenum GLuint GLenum GLsizei const GLchar * buf
char * Strncat(char *const, const char *const, const size_t)
#define gettimeofday(tv, tz)
struct passwd * GetPwByName(void)
char * getpass(const char *prompt)
char * FTPGetLocalCWD(char *buf, size_t size)
#define StrRemoveTrailingLocalPathDelim
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
INT WSAAPI setsockopt(IN SOCKET s, IN INT level, IN INT optname, IN CONST CHAR FAR *optval, IN INT optlen)
#define GetCurrentDirectory
_Check_return_ _CRTIMP int __cdecl isatty(_In_ int _FileHandle)
int FilenameExtensionIndicatesASCII(const char *const pathName, const char *const extnList)
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
VOID WINAPI GetSystemTime(OUT LPSYSTEMTIME lpSystemTime)
void GetUsrName(char *dst, size_t size)
_Check_return_ _CRTIMP int __cdecl _access(_In_z_ const char *_Filename, _In_ int _AccessMode)
static time_t GetUTCOffset(int mon, int mday)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
int GetSockBufSize(int sockfd, size_t *rsize, size_t *ssize)
static void(WINAPI *pDeinitMapiUtil)(void)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_CRTIMP struct tm *__cdecl localtime(const time_t *_Time)
_Check_return_ _Ret_opt_z_ _CRTIMP char *__cdecl getcwd(_Out_writes_opt_(_SizeInBytes) char *_DstBuf, _In_ int _SizeInBytes)
_CRTIMP int __cdecl _stat(_In_z_ const char *_Name, _Out_ struct _stat *_Stat)
int SetSockBufSize(int sockfd, size_t rsize, size_t ssize)
INT WSAAPI getsockopt(IN SOCKET s, IN INT level, IN INT optname, OUT CHAR FAR *optval, IN OUT INT FAR *optlen)
void Scramble(unsigned char *dst, size_t dsize, unsigned char *src, char *key)
void PrintF(const FTPCIPtr cip, const char *const fmt,...)
_Check_return_opt_ _CRTIMP char *__cdecl fgets(_Out_writes_z_(_MaxCount) char *_Buf, _In_ int _MaxCount, _Inout_ FILE *_File)
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
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
_Check_return_opt_ _CRTIMP int __cdecl fflush(_Inout_opt_ FILE *_File)
GLuint GLint GLboolean GLint GLenum access
char * Strncpy(char *const, const char *const, const size_t)
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
_CRTIMP time_t __cdecl mktime(struct tm *_Tm)
void StrRemoveTrailingSlashes(char *dst)
void * Realloc(void *, size_t)
void int int ULONGLONG int va_list * ap
#define StrRFindLocalPathDelim(a)
#define TVFSPathToLocalPath(s)
_CRTIMP struct tm *__cdecl gmtime(const time_t *_Time)
UINT(* handler)(MSIPACKAGE *)
_Check_return_ _CRTIMP int __cdecl _fileno(_In_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl vfprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format, va_list _ArgList)
#define StrFindLocalPathDelim(a)
_Check_return_opt_ _CRTIMP int __cdecl fputs(_In_z_ const char *_Str, _Inout_ FILE *_File)
static struct sockaddr_in sa