Go to the source code of this file.
|
#define | PTRZERO(p, siz) (void) memset(p, 0, (size_t) (siz)) |
|
#define | ZERO(a) PTRZERO(&(a), sizeof(a)) |
|
#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 | QSORT(base, n, s, cmp) qsort(base, (size_t)(n), (size_t)(s), (cmp_t)(cmp)) |
|
#define | BSEARCH(key, base, n, s, cmp) bsearch(key, base, (size_t)(n), (size_t)(s), (cmp_t)(cmp)) |
|
#define | kDoPerror 1 |
|
#define | kDontPerror 0 |
|
#define | kClosedFileDescriptor (-1) |
|
#define | SZ(a) ((size_t) (a)) |
|
#define | F_OK 0 |
|
#define | UNLINK unlink |
|
#define | SEEK_SET 0 |
|
#define | SEEK_CUR 1 |
|
#define | SEEK_END 2 |
|
#define | SETVBUF setvbuf |
|
#define | NcSignal signal |
|
|
char * | FGets (char *, size_t, FILE *) |
|
struct passwd * | GetPwByName (void) |
|
void | GetHomeDir (char *, size_t) |
|
void | GetUsrName (char *, size_t) |
|
void | CloseFile (FILE **) |
|
void | PrintF (const FTPCIPtr cip, const char *const fmt,...) |
|
void | Error (const FTPCIPtr cip, const int pError, const char *const fmt,...) |
|
int | GetSockBufSize (int sockfd, size_t *rsize, size_t *ssize) |
|
int | SetSockBufSize (int sockfd, size_t rsize, size_t ssize) |
|
time_t | UnMDTMDate (char *) |
|
void | Scramble (unsigned char *dst, size_t dsize, unsigned char *src, char *key) |
|
◆ BSEARCH
◆ F_OK
◆ ISTRCMP
◆ ISTREQ
◆ ISTRNCMP
◆ ISTRNEQ
◆ kClosedFileDescriptor
#define kClosedFileDescriptor (-1) |
◆ kDontPerror
◆ kDoPerror
◆ NcSignal
◆ PTRZERO
◆ QSORT
◆ SEEK_CUR
◆ SEEK_END
◆ SEEK_SET
◆ SETVBUF
◆ STREQ
◆ STRNEQ
◆ SZ
◆ UNLINK
◆ ZERO
◆ cmp_t
◆ longstring
typedef char longstring[512] |
◆ pathname
typedef char pathname[512] |
◆ str16
◆ str32
◆ str64
◆ string
◆ CloseFile()
◆ Error()
Definition at line 368 of file util.c.
369{
371 int errnum;
374 int endsinperiod;
375 int endsinnewline;
376#ifndef HAVE_STRERROR
377 char errnostr[16];
378#endif
379
382#ifdef HAVE_VSNPRINTF
384 buf[
sizeof(
buf) - 1] =
'\0';
385#else
387#endif
389
390 if (pError != 0) {
392 endsinperiod = 0;
393 endsinnewline = 0;
395 if (
buf[
len - 1] ==
'\n') {
396 endsinnewline = 1;
398 if (
buf[
len - 2] ==
'.') {
399 endsinperiod = 1;
401 }
402 }
else if (
buf[
len - 1] ==
'.') {
403 endsinperiod = 1;
405 }
406 }
407#ifdef HAVE_STRERROR
410#else
411# ifdef HAVE_SNPRINTF
412 sprintf(errnostr,
sizeof(errnostr) - 1,
" (errno = %d)", errnum);
413 errnostr[sizeof(errnostr) - 1] = '\0';
414# else
415 sprintf(errnostr,
" (errno = %d)", errnum);
416# endif
418#endif
419 if (endsinperiod != 0)
421 if (endsinnewline != 0)
423 }
424
428 }
433 }
434 }
437 }
440 }
441}
ACPI_SIZE strlen(const char *String)
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,...)
_Check_return_opt_ _CRTIMP int __cdecl fflush(_Inout_opt_ FILE *_File)
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
#define sprintf(buf, format,...)
const char * strerror(int err)
void int int ULONGLONG int va_list * ap
◆ FGets()
Definition at line 111 of file util.c.
112{
114
119 if (*nlptr == '\n')
120 *nlptr = '\0';
121 } else {
123 }
125}
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
_Check_return_opt_ _CRTIMP char *__cdecl fgets(_Out_writes_z_(_MaxCount) char *_Buf, _In_ int _MaxCount, _Inout_ FILE *_File)
Referenced by GetPass().
◆ GetHomeDir()
Definition at line 240 of file util.c.
241{
242#if defined(WIN32) || defined(_WINDOWS)
243 const char *homedrive, *homepath;
244
245 homedrive =
getenv(
"HOMEDRIVE");
246 homepath =
getenv(
"HOMEPATH");
247 if ((homedrive !=
NULL) && (homepath !=
NULL)) {
250 return;
251 }
252
253
254
255
256
257
258
259
260
261
262
263
264#else
266 struct passwd *pw;
267
269#if defined(USE_GETPWUID)
270
273#else
274
277#endif
280 else if ((
cp = (
const char *)
getenv(
"LOGNAME")) ==
NULL)
283#endif
284}
char * Strncat(char *const, const char *const, const size_t)
char * Strncpy(char *const, const char *const, const size_t)
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
struct passwd * GetPwByName(void)
◆ GetPwByName()
◆ GetSockBufSize()
Definition at line 534 of file util.c.
535{
536#ifdef SO_SNDBUF
537 int rc = -1;
538 int opt;
539 int optsize;
540
542 opt = 0;
543 optsize = sizeof(opt);
545 if (rc == 0)
547 else
548 *ssize = 0;
549 }
551 opt = 0;
552 optsize = sizeof(opt);
554 if (rc == 0)
556 else
557 *rsize = 0;
558 }
559 return (rc);
560#else
562 *ssize = 0;
564 *rsize = 0;
565 return (-1);
566#endif
567}
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.
291{
292#if defined(WIN32) || defined(_WINDOWS)
294
299#else
301 struct passwd *pw;
302
304#ifdef USE_GETPWUID
305
308#else
309
312#endif
315 else if ((
cp = (
const char *)
getenv(
"LOGNAME")) ==
NULL)
318#endif
319}
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
◆ PrintF()
Definition at line 340 of file util.c.
341{
344
349 }
351#ifdef HAVE_VSNPRINTF
353 buf[
sizeof(
buf) - 1] =
'\0';
354#else
356#endif
358 }
360}
_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.
608{
610 unsigned int ch;
611 unsigned char *k2;
612 size_t keyLen;
613
615 k2 = (
unsigned char *)
key;
616 for (
i=0;
i < (
int) dsize - 1;
i++) {
618 if (ch == 0)
619 break;
620 dst[
i] = (
unsigned char) (ch ^ (
int) (k2[
i % (
int) keyLen]));
621 }
623}
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.
573{
574#ifdef SO_SNDBUF
575 int rc = -1;
576 int opt;
577 int optsize;
578
579#ifdef TCP_RFC1323
580
581 if (ssize > 0 || rsize > 0) {
582 opt = 1;
583 optsize = sizeof(opt);
585 }
586#endif
587
588 if (ssize > 0) {
590 optsize = sizeof(opt);
592 }
593 if (rsize > 0) {
595 optsize = sizeof(opt);
597 }
598 return (rc);
599#else
600 return (-1);
601#endif
602}
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().
◆ UnMDTMDate()
Definition at line 486 of file util.c.
487{
488#ifndef HAVE_MKTIME
490#else
494
495 if (
strncmp(dstr,
"19100", 5) == 0) {
496
498 }
499
502
503
504
505
506
507
509
510
511 if (
sscanf(dstr,
"%04d%02d%02d%02d%02d%02d",
512 &ut.tm_year,
513 &ut.tm_mon,
514 &ut.tm_mday,
515 &ut.tm_hour,
516 &ut.tm_min,
517 &ut.tm_sec) == 6)
518 {
519 --ut.tm_mon;
520 ut.tm_year -= 1900;
525 }
526 }
528#endif
529}
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
_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)
_CRTIMP time_t __cdecl mktime(struct tm *_Tm)
_CRTIMP struct tm *__cdecl localtime(const time_t *_Time)