Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-11-01 02:14:29 +0300
committerChristopher Faylor <me@cgf.cx>2000-11-01 02:14:29 +0300
commitb12796a06d220e56474d2b28158fda9a193d9f37 (patch)
tree1333fe686fd71dd00c822095dc09969cd59a6c4f /winsup/cygwin/path.h
parent772e2322bd066c72b8af0f82f82c51306088bacc (diff)
* path.h (has_exec_chars): Standard function for checking for executable magic
numbers. * path.cc (symlink_info::check): Use the above function. * fhandler.cc (fhandler_disk_file::open): Ditto.
Diffstat (limited to 'winsup/cygwin/path.h')
-rw-r--r--winsup/cygwin/path.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h
index 14367c7f4..70ec2d229 100644
--- a/winsup/cygwin/path.h
+++ b/winsup/cygwin/path.h
@@ -122,6 +122,15 @@ const char * __stdcall find_exec (const char *name, path_conv& buf, const char *
#define isdrive(s) (isalpha (*(s)) && (s)[1] == ':')
+static inline bool
+has_exec_chars (const char *buf, int len)
+{
+ return len >= 2 &&
+ ((buf[0] == '#' && buf[1] == '!') ||
+ (buf[0] == ':' && buf[1] == '\n') ||
+ (buf[0] == 'M' && buf[1] == 'Z'));
+}
+
/* cwd cache stuff. */
class muto;