This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

install vs gcc wrt .exe



It would help if I attached the diff. :)

- Chris
--- org/install.c	Fri Feb 13 00:48:37 1998
+++ new/install.c	Mon Mar 02 20:16:19 1998
@@ -78,6 +78,10 @@
 # include <values.h>
 #endif
 
+#ifdef __CYGWIN32__
+# include <unistd.h>
+#endif
+
 #ifndef BITSPERBYTE
 # define BITSPERBYTE 8
 #endif
@@ -307,6 +311,22 @@
   exit (errors);
 }
 
+
+#ifdef __CYGWIN32__ 
+/* 
+   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 /* __CYGWIN32__ */
+
 /* Copy file FROM onto file TO and give TO the appropriate
    attributes.
    Return 0 if successful, 1 if an error occurs. */
@@ -316,7 +336,29 @@
 {
   int to_created;
   int no_need_to_chown;
+#ifdef __CYGWIN32__
+  char fromfile[MAXPATHLEN];
+  char tofile[MAXPATHLEN];
+  strcpy(fromfile, from);
+  strcpy(tofile, to);
+  if (!fileExists(from)) { /* probably exefile */
+    strcat(fromfile, ".exe");
+    if (!fileExists(fromfile))
+      strcpy(fromfile, from);
+    else {
+      strcat(tofile, ".exe");
+    }
+  }
 
+  if (copy_file (fromfile, tofile, &to_created))
+    return 1;
+  if (strip_files)
+    strip (to);
+  no_need_to_chown = (to_created
+		      && owner_name == NULL
+		      && group_name == NULL);
+  return change_attributes (tofile, no_need_to_chown);
+#else /* __CYGWIN32__ */
   if (copy_file (from, to, &to_created))
     return 1;
   if (strip_files)
@@ -325,6 +367,7 @@
 		      && owner_name == NULL
 		      && group_name == NULL);
   return change_attributes (to, no_need_to_chown);
+#endif /* __CYGWIN32__ */
 }
 
 /* Copy file FROM into directory TO_DIR, keeping its same name,
@@ -338,12 +381,28 @@
   char *to;
   int ret;
 
+#ifdef __CYGWIN32__
+  char fromfile[MAXPATHLEN];
+  strcpy(fromfile, from);
+  if (!fileExists(from)) { /* probably exefile */
+    strcat(fromfile, ".exe");
+    if (!fileExists(fromfile))
+      strcpy(fromfile, from);
+  }
+  from_base = basename (fromfile);
+  to = xmalloc ((unsigned) (strlen (to_dir) + strlen (from_base) + 2));
+  stpcpy (stpcpy (stpcpy (to, to_dir), "/"), from_base);
+  ret = install_file_in_file (fromfile, to);
+  free (to);
+  return ret;
+#else /* __CYGWIN32__ */
   from_base = basename (from);
   to = xmalloc ((unsigned) (strlen (to_dir) + strlen (from_base) + 2));
   stpcpy (stpcpy (stpcpy (to, to_dir), "/"), from_base);
   ret = install_file_in_file (from, to);
   free (to);
   return ret;
+#endif /* __CYGWIN32__ */
 }
 
 /* A chunk of a file being copied. */






Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]