summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/winsup.h
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2007-08-16 10:41:45 +0000
committerCorinna Vinschen <corinna@vinschen.de>2007-08-16 10:41:45 +0000
commit855e63eb4b1ea80dd892309e2bcd214626a90611 (patch)
tree1cc76ce8085ccddd3a47163c4fa09d092f28a8af /winsup/cygwin/winsup.h
parentc4bd83770022e78e9fbd7f1eefb57ad7c69456cd (diff)
downloadcygnal-855e63eb4b1ea80dd892309e2bcd214626a90611.tar.gz
cygnal-855e63eb4b1ea80dd892309e2bcd214626a90611.tar.bz2
cygnal-855e63eb4b1ea80dd892309e2bcd214626a90611.zip
* ntdll.h (RtlCreateUnicodeStringFromAsciiz): Fix declaration.
(RtlUpcaseUnicodeChar): Declare. * path.cc (hash_path_name): Split into three functions, taking the path as char *, PWCSTR, or PUNICODE_STRING. Move implementation into PUNICODE_STRING-based function. Drop old drive-relative path consideration. * winsup.h (iswdirsep): Like isdirsep but for WCHARs. (isabspath_u): Like isabspath, for PUNICODE_STRINGs. (iswabspath): Like isabspath, for PWCHARs. (hash_path_name): Add new declarations.
Diffstat (limited to 'winsup/cygwin/winsup.h')
-rw-r--r--winsup/cygwin/winsup.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h
index 2d099304b..9e949e846 100644
--- a/winsup/cygwin/winsup.h
+++ b/winsup/cygwin/winsup.h
@@ -143,6 +143,12 @@ extern HANDLE tty_mutex;
type flag () const { return (type) status.flag; }
/* Used when treating / and \ as equivalent. */
+#define iswdirsep(ch) \
+ ({ \
+ WCHAR __c = (ch); \
+ ((__c) == L'/' || (__c) == L'\\'); \
+ })
+
#define isdirsep(ch) \
({ \
char __c = (ch); \
@@ -160,6 +166,18 @@ extern int __api_fatal_exit_val;
#undef issep
#define issep(ch) (strchr (" \t\n\r", (ch)) != NULL)
+/* Every path beginning with / or \, as well as every path being X:
+ or starting with X:/ or X:\ */
+#define isabspath_u(p) \
+ ((p)->Length && \
+ (iswdirsep ((p)->Buffer[0]) || \
+ ((p)->Length > sizeof (WCHAR) && iswalpha ((p)->Buffer[0]) \
+ && (p)->Buffer[1] == L':' && \
+ ((p)->Length == 2 * sizeof (WCHAR) || iswdirsep ((p)->Buffer[2])))))
+
+#define iswabspath(p) \
+ (iswdirsep (*(p)) || (iswalpha (*(p)) && (p)[1] == L':' && (!(p)[2] || iswdirsep ((p)[2]))))
+
#define isabspath(p) \
(isdirsep (*(p)) || (isalpha (*(p)) && (p)[1] == ':' && (!(p)[2] || isdirsep ((p)[2]))))
@@ -239,6 +257,8 @@ extern bool cygwin_finished_initializing;
void __stdcall set_std_handle (int);
int __stdcall stat_dev (DWORD, int, unsigned long, struct __stat64 *);
+__ino64_t __stdcall hash_path_name (__ino64_t hash, PUNICODE_STRING name) __attribute__ ((regparm(2)));
+__ino64_t __stdcall hash_path_name (__ino64_t hash, PCWSTR name) __attribute__ ((regparm(2)));
__ino64_t __stdcall hash_path_name (__ino64_t hash, const char *name) __attribute__ ((regparm(2)));
void __stdcall nofinalslash (const char *src, char *dst) __attribute__ ((regparm(2)));
extern "C" char *__stdcall rootdir (const char *full_path, char *root_path) __attribute__ ((regparm(2)));