ReactOS 0.4.15-dev-7674-gc0b4db1
util.h
Go to the documentation of this file.
1/* Util.h
2 *
3 * Copyright (c) 1996-2001 Mike Gleason, NCEMRSoft.
4 * All rights reserved.
5 *
6 */
7
8#ifndef _util_h_
9#define _util_h_ 1
10
11typedef char string[160], str16[16], str32[32], str64[64];
12typedef char longstring[512];
13typedef char pathname[512];
14
15#ifndef PTRZERO
16# define PTRZERO(p,siz) (void) memset(p, 0, (size_t) (siz))
17#endif
18
19#define ZERO(a) PTRZERO(&(a), sizeof(a))
20#define STREQ(a,b) (strcmp(a,b) == 0)
21#define STRNEQ(a,b,s) (strncmp(a,b,(size_t)(s)) == 0)
22
23#ifndef ISTRCMP
24# ifdef HAVE_STRCASECMP
25# define ISTRCMP strcasecmp
26# define ISTRNCMP strncasecmp
27# else
28# define ISTRCMP strcmp
29# define ISTRNCMP strncmp
30# endif
31#endif
32
33#define ISTREQ(a,b) (ISTRCMP(a,b) == 0)
34#define ISTRNEQ(a,b,s) (ISTRNCMP(a,b,(size_t)(s)) == 0)
35
36typedef int (*cmp_t)(const void *, const void *);
37#define QSORT(base,n,s,cmp) \
38 qsort(base, (size_t)(n), (size_t)(s), (cmp_t)(cmp))
39
40#define BSEARCH(key,base,n,s,cmp) \
41 bsearch(key, base, (size_t)(n), (size_t)(s), (cmp_t)(cmp))
42
43/* For Error(): */
44#define kDoPerror 1
45#define kDontPerror 0
46
47#define kClosedFileDescriptor (-1)
48
49#define SZ(a) ((size_t) (a))
50
51#ifndef F_OK
52# define F_OK 0
53#endif
54
55#ifdef HAVE_REMOVE
56# define UNLINK remove
57#else
58# define UNLINK unlink
59#endif
60
61#ifndef SEEK_SET
62# define SEEK_SET 0
63# define SEEK_CUR 1
64# define SEEK_END 2
65#endif /* SEEK_SET */
66
67#ifdef SETVBUF_REVERSED
68# define SETVBUF(a,b,c,d) setvbuf(a,c,b,d)
69#else
70# define SETVBUF setvbuf
71#endif
72
73
74/* Util.c */
75char *FGets(char *, size_t, FILE *);
76struct passwd *GetPwByName(void);
77void GetHomeDir(char *, size_t);
78void GetUsrName(char *, size_t);
79void CloseFile(FILE **);
80void PrintF(const FTPCIPtr cip, const char *const fmt, ...)
81#if (defined(__GNUC__)) && (__GNUC__ >= 2)
82__attribute__ ((format (printf, 2, 3)))
83#endif
84;
85void Error(const FTPCIPtr cip, const int pError, const char *const fmt, ...)
86#if (defined(__GNUC__)) && (__GNUC__ >= 2)
87__attribute__ ((format (printf, 3, 4)))
88#endif
89;
90int GetSockBufSize(int sockfd, size_t *rsize, size_t *ssize);
91int SetSockBufSize(int sockfd, size_t rsize, size_t ssize);
92time_t UnMDTMDate(char *);
93void Scramble(unsigned char *dst, size_t dsize, unsigned char *src, char *key);
94#if defined(WIN32) || defined(_WINDOWS)
95char *StrFindLocalPathDelim(const char *src);
96char *StrRFindLocalPathDelim(const char *src);
97void TVFSPathToLocalPath(char *dst);
98void LocalPathToTVFSPath(char *dst);
99int gettimeofday(struct timeval *const tp, void *junk);
100#endif
101
102#ifdef HAVE_SIGACTION
103void (*NcSignal(int signum, void (*handler)(int)))(int);
104#elif !defined(NcSignal)
105# define NcSignal signal
106#endif
107
108#endif /* _util_h_ */
#define gettimeofday(tv, tz)
Definition: adns_win32.h:159
BOOL Error
Definition: chkdsk.c:66
#define __attribute__(x)
Definition: wpp_private.h:207
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7482
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2996
__kernel_time_t time_t
Definition: linux.h:252
#define printf
Definition: freeldr.h:94
uint8_t junk[422]
Definition: fsck.fat.h:34
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
int(* cmp_t)(const void *, const void *)
Definition: util.h:36
struct passwd * GetPwByName(void)
Definition: util.c:165
void GetHomeDir(char *, size_t)
Definition: util.c:240
int SetSockBufSize(int sockfd, size_t rsize, size_t ssize)
Definition: util.c:572
void CloseFile(FILE **)
Definition: util.c:327
char str16[16]
Definition: util.h:11
char longstring[512]
Definition: util.h:12
char pathname[512]
Definition: util.h:13
char str64[64]
Definition: util.h:11
void GetUsrName(char *, size_t)
Definition: util.c:290
void PrintF(const FTPCIPtr cip, const char *const fmt,...)
Definition: util.c:340
#define NcSignal
Definition: util.h:105
time_t UnMDTMDate(char *)
Definition: util.c:486
char str32[32]
Definition: util.h:11
int GetSockBufSize(int sockfd, size_t *rsize, size_t *ssize)
Definition: util.c:534
void Scramble(unsigned char *dst, size_t dsize, unsigned char *src, char *key)
Definition: util.c:607
char * FGets(char *, size_t, FILE *)
Definition: util.c:111
#define StrRFindLocalPathDelim(a)
Definition: ncftp.h:495
#define StrFindLocalPathDelim(a)
Definition: ncftp.h:494
#define LocalPathToTVFSPath(s)
Definition: ncftp.h:499
#define TVFSPathToLocalPath(s)
Definition: ncftp.h:498
Definition: dsound.c:943
Definition: copy.c:22