This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
Re: install vs gcc wrt .exe
- To: gnu-win32 at cygnus dot com
- Subject: Re: install vs gcc wrt .exe
- From: Christopher Seawood <cseawood at qualcomm dot com>
- Date: Thu, 31 Dec 1998 01:41:54 -0800 (PST)
On Wed, 30 Dec 1998, it was written:
> that gcc can be made to do the "proper" thing so I've attached the patch
> from roger@isp.uni-kassel.de install to make install it check for foo.exe
Updated patch for b20.1.
- Chris
--- fileutils/src/install.c.cls Thu Feb 12 15:48:38 1998
+++ fileutils/src/install.c Wed Dec 30 21:15:29 1998
@@ -307,6 +307,22 @@
exit (errors);
}
+#ifdef __CYGWIN__
+/*
+ cannot use access, because exe files are automatically mapped here
+*/
+static int
+fileExists(char *file)
+{
+ FILE *f = fopen(file, "r");
+ if (!f)
+ return 0;
+ fclose(f);
+ return 1;
+}
+#endif /* __CYGWIN__ */
+
+
/* Copy file FROM onto file TO and give TO the appropriate
attributes.
Return 0 if successful, 1 if an error occurs. */
@@ -316,7 +332,20 @@
{
int to_created;
int no_need_to_chown;
-
+#ifdef __CYGWIN__
+ char fromfile[MAXPATHLEN];
+ char tofile[MAXPATHLEN];
+ strncpy(fromfile, from, MAXPATHLEN-4);
+ strncpy(tofile, to, MAXPATHLEN-4);
+ if (!fileExists(from)) {
+ strcat(fromfile, ".exe");
+ if (fileExists(fromfile)) {
+ strcat(tofile, ".exe");
+ from = fromfile;
+ to = tofile;
+ }
+ }
+#endif /* __CYGWIN__ */
if (copy_file (from, to, &to_created))
return 1;
if (strip_files)