Go to the source code of this file.
|
#define | STREQ(a, b) (strcmp(a,b) == 0) |
|
#define | STRNEQ(a, b, s) (strncmp(a,b,(size_t)(s)) == 0) |
|
#define | ISTRCMP strcmp |
|
#define | ISTRNCMP strncmp |
|
#define | ISTREQ(a, b) (ISTRCMP(a,b) == 0) |
|
#define | ISTRNEQ(a, b, s) (ISTRNCMP(a,b,(size_t)(s)) == 0) |
|
#define | YESNO(i) ((i == 0) ? "no" : "yes") |
|
#define | ONOFF(i) ((i == 0) ? "off" : "on") |
|
#define | TRUEFALSE(i) ((i == 0) ? "false" : "true") |
|
#define | strcoll strcmp |
|
#define | strncoll strncmp |
|
#define | F_OK 0 |
|
#define | kOurDirectoryName ".ncftp" |
|
#define | kPasswordMagic "*encoded*" |
|
#define | kPasswordMagicLen 9 |
|
|
void | ToBase64 (void *, const void *, size_t, int) |
|
void | FromBase64 (void *, const void *, size_t, int) |
|
void | OutOfMemory (void) |
|
void * | Realloc (void *, size_t) |
|
char * | GetCWD (char *, size_t) |
|
void | MyInetAddr (char *, size_t, char **, int) |
|
struct hostent * | GetHostEntry (const char *, struct in_addr *) |
|
void | CompressPath (char *const dst, const char *const src, const size_t dsize) |
|
void | PathCat (char *const dst, const size_t dsize, const char *const cwd, const char *const src) |
|
char * | FileToURL (char *url, size_t urlsize, const char *const fn, const char *const rcwd, const char *const startdir, const char *const user, const char *const pass, const char *const hname, const unsigned int port) |
|
void | AbbrevStr (char *, const char *, size_t, int) |
|
char * | Path (char *const dst, const size_t siz, const char *const parent, const char *const fname) |
|
char * | OurDirectoryPath (char *const dst, const size_t siz, const char *const fname) |
|
void | InitOurDirectory (void) |
|
void | InitUserInfo (void) |
|
int | MayUseFirewall (const char *const, int, const char *const) |
|
int | StrToBool (const char *const) |
|
void | AbsoluteToRelative (char *const, const size_t, const char *const, const char *const, const size_t) |
|
int | GetHostByName (char *const volatile, size_t, const char *const, int) |
|
time_t | UnDate (char *dstr) |
|
int | DecodeDirectoryURL (const FTPCIPtr, char *, LineListPtr, char *, size_t) |
|
char * | OurInstallationPath (char *const dst, const size_t siz, const char *const fname) |
|
◆ F_OK
◆ ISTRCMP
◆ ISTREQ
◆ ISTRNCMP
◆ ISTRNEQ
◆ kOurDirectoryName
#define kOurDirectoryName ".ncftp" |
◆ kPasswordMagic
#define kPasswordMagic "*encoded*" |
◆ kPasswordMagicLen
◆ ONOFF
#define ONOFF |
( |
|
i | ) |
((i == 0) ? "off" : "on") |
◆ strcoll
◆ STREQ
◆ strncoll
◆ STRNEQ
◆ TRUEFALSE
◆ YESNO
◆ bsearch_proc_t
Definition at line 9 of file util.h.
◆ qsort_proc_t
Definition at line 8 of file util.h.
◆ sigproc_t
◆ vsigproc_t
◆ AbbrevStr()
Definition at line 451 of file util.c.
ACPI_SIZE strlen(const char *String)
char * Strncat(char *const, const char *const, const size_t)
static void(WINAPI *pDeinitMapiUtil)(void)
char * Strncpy(char *const, const char *const, const size_t)
char * strcpy(char *DstString, const char *SrcString)
Referenced by MakePrompt(), PrSizeAndRateMeter(), PrStatBar(), and Usage().
◆ AbsoluteToRelative()
Definition at line 785 of file util.c.
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
static void(WINAPI *pDeinitMapiUtil)(void)
char * Strncpy(char *const, const char *const, const size_t)
int strcmp(const char *String1, const char *String2)
Referenced by CurrentURL(), and FillBookmarkInfo().
◆ CompressPath()
Definition at line 247 of file util.c.
254 if (
src[0] ==
'\0') {
265 if (((
s ==
src) || (
s[-1] ==
'/')) && ((
s[1] ==
'/') || (
s[1] ==
'\0'))) {
270 }
else if (
d < lim) {
275 }
else if (
c ==
'/') {
286 }
else if (
c ==
'.') {
291 }
else if (
c ==
'\0') {
301 }
else if (
c ==
'\0') {
303 if ((
d[-1] ==
'/') && (
d > (
dst + 1)))
307 }
else if (
d < lim) {
332 if ((
b[0] ==
'.') && (
b[1] ==
'.')) {
340 if ((
a[0] ==
'.') && (
a[1] ==
'.')) {
343 if ((
b ==
dst) && (*
dst ==
'/'))
348 }
else if (
a[2] ==
'\0') {
350 if ((
b <=
dst + 1) && (*
dst ==
'/'))
#define memmove(s1, s2, n)
ACPI_SIZE strlen(const char *String)
GLboolean GLboolean GLboolean b
static void(WINAPI *pDeinitMapiUtil)(void)
GLboolean GLboolean GLboolean GLboolean a
Referenced by PathCat().
◆ DecodeDirectoryURL()
Definition at line 1086 of file util.c.
static GLenum _GLUfuncptr fn
#define STRNCPY(dst, src, n)
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
static void(WINAPI *pDeinitMapiUtil)(void)
int FTPDecodeURL(const FTPCIPtr cip, char *const url, LineListPtr cdlist, char *const fn, const size_t fnsize, int *const xtype, int *const wantnlst)
char * strchr(const char *String, int ch)
Referenced by OpenCmd(), and SetStartupURL().
◆ FileToURL()
Definition at line 387 of file util.c.
416 dsize = urlsize - ulen;
418 if ((startdir !=
NULL) && (startdir[0] !=
'\0') && (startdir[1] !=
'\0')) {
422 }
else if (isUser != 0) {
428 dst[dsize - 1] =
'\0';
429 dst[dsize - 2] =
'\0';
430 dst[dsize - 3] =
'\0';
431 dst[dsize - 4] =
'\0';
#define memmove(s1, s2, n)
ACPI_SIZE strlen(const char *String)
static GLenum _GLUfuncptr fn
#define sprintf(buf, format,...)
char * Strncat(char *const, const char *const, const size_t)
void PathCat(char *const dst, const size_t dsize, const char *const cwd, const char *const src)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
static void(WINAPI *pDeinitMapiUtil)(void)
char * Strncpy(char *const, const char *const, const size_t)
int strcmp(const char *String1, const char *String2)
void user(int argc, const char *argv[])
Referenced by PrPhilBar(), PrSizeAndRateMeter(), and PrStatBar().
◆ FromBase64()
Definition at line 128 of file util.c.
131 const unsigned char *
src, *srclim;
132 unsigned int c0, c1, c2, c3;
139 while (
src < srclim) {
void MSVCRT() terminate()
static const unsigned char B64DecodeTable[256]
Referenced by ParseHostLine().
◆ GetCWD()
◆ GetHostByName()
Definition at line 826 of file util.c.
828 #if defined(WIN32) || defined(_WINDOWS) 832 if (
inet_addr(hn) != (
unsigned long) 0xFFFFFFFF) {
849 #ifndef HAVE_INET_NTOP 853 #ifdef HAVE_INET_ATON 867 #ifdef HAVE_SIGSETJMP 868 osigpipe = osigint = osigalrm = (
sigproc_t) 0;
871 osigpipe = osigint = osigalrm = (
sigproc_t) 0;
882 Trace(0,
"Canceled GetHostByName because of signal %d.\n", gResolveSig);
889 (
void) alarm((
unsigned int)
t);
897 #ifdef HAVE_INET_NTOP
volatile sigproc_t vsigproc_t
static void CancelGetHostByName(int sigNum)
int __MINGW_NOTHROW __cdecl setjmp(jmp_buf _Buf)
PHOSTENT WSAAPI gethostbyname(IN const char FAR *name)
int sigsetjmp(sigjmp_buf buf, int savesigs)
#define inet_aton(ap, inp)
static void(WINAPI *pDeinitMapiUtil)(void)
#define memcpy(s1, s2, n)
char * Strncpy(char *const, const char *const, const size_t)
jmp_buf gGetHostByNameJmp
const char *WSAAPI inet_ntop(int af, const void *src, char *dst, size_t cnt)
Referenced by DoOpen().
◆ GetHostEntry()
Definition at line 215 of file util.c.
233 if (ip_address !=
NULL)
PHOSTENT WSAAPI gethostbyaddr(IN const char FAR *addr, IN int len, IN int type)
PHOSTENT WSAAPI gethostbyname(IN const char FAR *name)
◆ InitOurDirectory()
Definition at line 506 of file util.c.
508 #if defined(WIN32) || defined(_WINDOWS) 519 "Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\ncftp.exe",
567 if ((
cp !=
NULL) && (
cp[1] ==
'\0'))
574 if ((
cp !=
NULL) && (
cp[1] ==
'\0'))
578 if (
gUser[0] ==
'\0') {
char gOurInstallationPath[260]
#define STRNCPY(dst, src, n)
int MkDirs(const char *const newdir, int mode1)
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
#define GetModuleFileName
static void(WINAPI *pDeinitMapiUtil)(void)
char gOurDirectoryPath[260]
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
char * Path(char *const dst, const size_t siz, const char *const parent, const char *const fname)
#define kOurDirectoryName
#define StrRFindLocalPathDelim(a)
#define RegCloseKey(hKey)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
#define HKEY_LOCAL_MACHINE
Referenced by InitUserInfo().
◆ InitUserInfo()
Definition at line 630 of file util.c.
632 #if defined(WIN32) || defined(_WINDOWS) 644 if ((
cp !=
NULL) && (
cp[1] ==
'\0'))
649 struct passwd *pwptr;
653 pwptr = getpwuid(
gUid);
659 (
void)
fprintf(
stderr,
"You have a user id number of %d, but no username associated with it.\n", (
int)
gUid);
*nSize LPSTR _Inout_ LPDWORD nSize
#define STRNCPY(dst, src, n)
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
void InitOurDirectory(void)
_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_ char *__cdecl getenv(_In_z_ const char *_VarName)
Referenced by PreInit().
◆ MayUseFirewall()
Definition at line 695 of file util.c.
706 if (firewallExceptionList[0] ==
'\0') {
726 if (
strcmp(tok,
"localdomain") == 0)
char * strstr(char *String1, char *String2)
#define STRNCPY(dst, src, n)
#define kFirewallNotInUse
GLenum GLuint GLenum GLsizei const GLchar * buf
static void(WINAPI *pDeinitMapiUtil)(void)
char * strtok(char *String, const char *Delimiters)
char * strchr(const char *String, int ch)
int strcmp(const char *String1, const char *String2)
Referenced by OpenCmd(), and SetStartupURL().
◆ MyInetAddr()
Definition at line 185 of file util.c.
188 #ifndef HAVE_INET_NTOP 193 if (
src != (
char **) 0) {
195 #ifdef HAVE_INET_NTOP 199 if ((
cp != (
char *) 0) && (
cp != (
char *) -1) && (
cp[0] !=
'\0'))
static void(WINAPI *pDeinitMapiUtil)(void)
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 * Strncpy(char *const, const char *const, const size_t)
const char *WSAAPI inet_ntop(int af, const void *src, char *dst, size_t cnt)
◆ OurDirectoryPath()
Definition at line 486 of file util.c.
char gOurDirectoryPath[260]
char * Path(char *const dst, const size_t siz, const char *const parent, const char *const fname)
Referenced by CheckForNewV3User(), CloseTrace(), EndLog(), InitLog(), LoadFirewallPrefs(), LoadHistory(), LoadPrefs(), MkSpoolDir(), OpenBookmarkFile(), OpenTmpBookmarkFile(), OpenTrace(), RunBookmarkEditor(), SaveHistory(), SavePrefs(), SwapBookmarkFiles(), and TruncBatchLog().
◆ OurInstallationPath()
◆ OutOfMemory()
Definition at line 64 of file fc.c.
#define IDS_OUT_OF_MEMORY
void ConResPuts(FILE *fp, UINT nID)
Referenced by BinaryFileCompare().
◆ Path()
◆ PathCat()
Definition at line 368 of file util.c.
377 cp =
Strnpcpy(tmp, (
char *) cwd,
sizeof(tmp) - 1);
void CompressPath(char *const dst, const char *const src, const size_t dsize)
static void(WINAPI *pDeinitMapiUtil)(void)
char * Strnpcat(char *const, const char *const, size_t)
char * Strnpcpy(char *const, const char *const, size_t)
Referenced by Chdirs(), FileToURL(), Ls(), nFTPChdirAndGetCWD(), and RemoteCompletionFunction().
◆ Realloc()
◆ StrToBool()
◆ ToBase64()
Definition at line 83 of file util.c.
86 const unsigned char *
src, *srclim;
87 unsigned int c0, c1, c2;
94 while (
src < srclim) {
110 ch = ((c0 << 4) & 060) | ((c1 >> 4) & 017);
113 ch = ((c1 << 2) & 074) | ((c2 >> 6) & 03);
static const unsigned char B64EncodeTable[64]
void MSVCRT() terminate()
Referenced by SpoolX(), and WriteBmLine().
◆ UnDate()
Definition at line 917 of file util.c.
937 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 void(WINAPI *pDeinitMapiUtil)(void)
_CRTIMP struct tm *__cdecl localtime(const time_t *_Time)
_CRTIMP time_t __cdecl mktime(struct tm *_Tm)
Referenced by GetStartSpoolDate().