remove empty dir
[reactos.git] / rosapps / net / ncftp / ncftp / util.h
1 /* util.h
2 *
3 * Copyright (c) 1992-2001 by Mike Gleason.
4 * All rights reserved.
5 *
6 */
7
8 typedef int (*qsort_proc_t)(const void *, const void *);
9 typedef int (*bsearch_proc_t)(const void *, const void *);
10 typedef void (*sigproc_t)(int);
11 typedef volatile sigproc_t vsigproc_t;
12
13 #define STREQ(a,b) (strcmp(a,b) == 0)
14 #define STRNEQ(a,b,s) (strncmp(a,b,(size_t)(s)) == 0)
15
16 #ifndef ISTRCMP
17 # ifdef HAVE_STRCASECMP
18 # define ISTRCMP strcasecmp
19 # define ISTRNCMP strncasecmp
20 # else
21 # define ISTRCMP strcmp
22 # define ISTRNCMP strncmp
23 # endif
24 #endif
25
26 #define ISTREQ(a,b) (ISTRCMP(a,b) == 0)
27 #define ISTRNEQ(a,b,s) (ISTRNCMP(a,b,(size_t)(s)) == 0)
28 #define YESNO(i) ((i == 0) ? "no" : "yes")
29 #define ONOFF(i) ((i == 0) ? "off" : "on")
30 #define TRUEFALSE(i) ((i == 0) ? "false" : "true")
31
32 #ifndef HAVE_STRCOLL
33 # ifndef strcoll
34 # define strcoll strcmp
35 # endif
36 # ifndef strncoll
37 # define strncoll strncmp
38 # endif
39 #endif
40
41 #ifndef F_OK
42 # define F_OK 0
43 #endif
44
45 #define kOurDirectoryName ".ncftp"
46
47 #define kPasswordMagic "*encoded*"
48 #define kPasswordMagicLen 9
49
50 #if defined(WIN32) || defined(_WINDOWS)
51 # define kNcFTPBookmarksMailslot "\\\\.\\mailslot\\ncftpbm.slt"
52 # define kNcFTPBookmarksMailslotMsgSize 128
53 #endif
54
55 /* util.c */
56 void ToBase64(void *, const void *, size_t, int);
57 void FromBase64(void *, const void *, size_t, int);
58 void OutOfMemory(void);
59 void *Realloc(void *, size_t);
60 char *GetCWD(char *, size_t);
61 void MyInetAddr(char *, size_t, char **, int);
62 struct hostent *GetHostEntry(const char *, struct in_addr *);
63 void CompressPath(char *const dst, const char *const src, const size_t dsize);
64 void PathCat(char *const dst, const size_t dsize, const char *const cwd, const char *const src);
65 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);
66 void AbbrevStr(char *, const char *, size_t, int);
67 char *Path(char *const dst, const size_t siz, const char *const parent, const char *const fname);
68 char *OurDirectoryPath(char *const dst, const size_t siz, const char *const fname);
69 void InitOurDirectory(void);
70 void InitUserInfo(void);
71 int MayUseFirewall(const char *const, int, const char *const);
72 int StrToBool(const char *const);
73 void AbsoluteToRelative(char *const, const size_t, const char *const, const char *const, const size_t);
74 int GetHostByName(char *const volatile, size_t, const char *const, int);
75 time_t UnDate(char *dstr);
76 int DecodeDirectoryURL(const FTPCIPtr, char *, LineListPtr, char *, size_t);
77 char *OurInstallationPath(char *const dst, const size_t siz, const char *const fname);
78 #if defined(WIN32) || defined(_WINDOWS)
79 void SysPerror(const char *const errMsg);
80 #endif
81
82 #if defined(HAVE_STRCOLL) && !defined(HAVE_STRNCOLL)
83 int strncoll(const char *a, const char *b, size_t n);
84 #endif