ReactOS  0.4.12-dev-36-g472787f
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 
11 typedef char string[160], str16[16], str32[32], str64[64];
12 typedef char longstring[512];
13 typedef 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 
36 typedef 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 */
75 char *FGets(char *, size_t, FILE *);
76 struct passwd *GetPwByName(void);
77 void GetHomeDir(char *, size_t);
78 void GetUsrName(char *, size_t);
79 void CloseFile(FILE **);
80 void PrintF(const FTPCIPtr cip, const char *const fmt, ...)
81 #if (defined(__GNUC__)) && (__GNUC__ >= 2)
82 __attribute__ ((format (printf, 2, 3)))
83 #endif
84 ;
85 void 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 ;
90 int GetSockBufSize(int sockfd, size_t *rsize, size_t *ssize);
91 int SetSockBufSize(int sockfd, size_t rsize, size_t ssize);
92 time_t UnMDTMDate(char *);
93 void Scramble(unsigned char *dst, size_t dsize, unsigned char *src, char *key);
94 #if defined(WIN32) || defined(_WINDOWS)
95 char *StrFindLocalPathDelim(const char *src);
96 char *StrRFindLocalPathDelim(const char *src);
97 void TVFSPathToLocalPath(char *dst);
98 void LocalPathToTVFSPath(char *dst);
99 int gettimeofday(struct timeval *const tp, void *junk);
100 #endif
101 
102 #ifdef HAVE_SIGACTION
103 void (*NcSignal(int signum, void (*handler)(int)))(int);
104 #elif !defined(NcSignal)
105 # define NcSignal signal
106 #endif
107 
108 #endif /* _util_h_ */
void CloseFile(FILE **)
Definition: util.c:327
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:47
#define LocalPathToTVFSPath(s)
Definition: ncftp.h:499
char pathname[512]
Definition: util.h:13
uint8_t junk[422]
Definition: fsck.fat.h:69
#define NcSignal
Definition: util.h:105
void Scramble(unsigned char *dst, size_t dsize, unsigned char *src, char *key)
Definition: util.c:607
_In_ UINT64 _In_ UINT64 _In_ UINT64 _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2630
time_t UnMDTMDate(char *)
Definition: util.c:486
#define __attribute__(Spec)
Definition: hlsl.tab.c:1213
struct passwd * GetPwByName(void)
Definition: util.c:165
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
char str16[16]
Definition: util.h:11
GLuint const GLubyte GLvoid * src
Definition: s_context.h:57
int(* cmp_t)(const void *, const void *)
Definition: util.h:36
#define gettimeofday(tv, tz)
Definition: adns_win32.h:159
char str64[64]
Definition: util.h:11
void GetUsrName(char *, size_t)
Definition: util.c:290
void Error(const FTPCIPtr cip, const int pError, const char *const fmt,...)
Definition: util.c:368
int GetSockBufSize(int sockfd, size_t *rsize, size_t *ssize)
Definition: util.c:534
__kernel_time_t time_t
Definition: linux.h:252
void GetHomeDir(char *, size_t)
Definition: util.c:240
GLuint const GLubyte GLvoid const GLvoid * dst
Definition: s_context.h:57
char longstring[512]
Definition: util.h:12
#define StrRFindLocalPathDelim(a)
Definition: ncftp.h:495
void PrintF(const FTPCIPtr cip, const char *const fmt,...)
Definition: util.c:340
char * FGets(char *, size_t, FILE *)
Definition: util.c:111
#define TVFSPathToLocalPath(s)
Definition: ncftp.h:498
char str32[32]
Definition: util.h:11
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7782
int SetSockBufSize(int sockfd, size_t rsize, size_t ssize)
Definition: util.c:572
#define StrFindLocalPathDelim(a)
Definition: ncftp.h:494
Definition: dsound.c:943
Definition: path.c:42
#define printf
Definition: config.h:203
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:29