1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef UPDATEDEFINES_H
6 #define UPDATEDEFINES_H
8 #include "readstrings.h"
12 # define MAXPATHLEN PATH_MAX
13 # elif defined(MAX_PATH)
14 # define MAXPATHLEN MAX_PATH
15 # elif defined(_MAX_PATH)
16 # define MAXPATHLEN _MAX_PATH
17 # elif defined(CCHMAXPATH)
18 # define MAXPATHLEN CCHMAXPATH
20 # define MAXPATHLEN 1024
35 # define S_ISDIR(s) (((s) & _S_IFMT) == _S_IFDIR)
36 # define S_ISREG(s) (((s) & _S_IFMT) == _S_IFREG)
38 # define access _access
40 # define putenv _putenv
41 # define DELETE_DIR L"tobedeleted"
42 # define CALLBACK_BACKUP_EXT L".moz-callback"
45 # define NS_T(str) L ## str
46 # define NS_SLASH NS_T('\\')
48 static inline int mywcsprintf(WCHAR
* dest
, size_t count
, const WCHAR
* fmt
, ...)
50 size_t _count
= count
- 1;
52 va_start(varargs
, fmt
);
53 int result
= _vsnwprintf(dest
, count
- 1, fmt
, varargs
);
58 #define NS_tsnprintf mywcsprintf
59 # define NS_taccess _waccess
60 # define NS_tchdir _wchdir
61 # define NS_tchmod _wchmod
62 # define NS_tfopen _wfopen
63 # define NS_tmkdir(path, perms) _wmkdir(path)
64 # define NS_tremove _wremove
65 // _wrename is used to avoid the link tracking service.
66 # define NS_trename _wrename
67 # define NS_trmdir _wrmdir
68 # define NS_tstat _wstat
69 # define NS_tlstat _wstat // No symlinks on Windows
70 # define NS_tstat_t _stat
71 # define NS_tstrcat wcscat
72 # define NS_tstrcmp wcscmp
73 # define NS_tstrncmp wcsncmp
74 # define NS_tstricmp wcsicmp
75 # define NS_tstrcpy wcscpy
76 # define NS_tstrncpy wcsncpy
77 # define NS_tstrlen wcslen
78 # define NS_tstrchr wcschr
79 # define NS_tstrrchr wcsrchr
80 # define NS_tstrstr wcsstr
81 # include "win_dirent.h"
83 # define NS_tdirent dirent
84 # define NS_topendir opendir
85 # define NS_tclosedir closedir
86 # define NS_treaddir readdir
88 # include <sys/wait.h>
92 # include <sys/stat.h>
99 # include <sys/time.h>
103 # define NS_T(str) str
104 # define NS_SLASH NS_T('/')
105 # define NS_tsnprintf snprintf
106 # define NS_taccess access
107 # define NS_tchdir chdir
108 # define NS_tchmod chmod
109 # define NS_tfopen fopen
110 # define NS_tmkdir mkdir
111 # define NS_tremove remove
112 # define NS_trename rename
113 # define NS_trmdir rmdir
114 # define NS_tstat stat
115 # define NS_tstat_t stat
116 # define NS_tlstat lstat
117 # define NS_tstrcat strcat
118 # define NS_tstrcmp strcmp
119 # define NS_tstrncmp strncmp
120 # define NS_tstricmp strcasecmp
121 # define NS_tstrcpy strcpy
122 # define NS_tstrncpy strncpy
123 # define NS_tstrlen strlen
124 # define NS_tstrrchr strrchr
125 # define NS_tstrstr strstr
127 # define NS_tdirent dirent
128 # define NS_topendir opendir
129 # define NS_tclosedir closedir
130 # define NS_treaddir readdir
133 #define BACKUP_EXT NS_T(".moz-backup")