summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2005-02-26 01:41:48 +0000
committerPaul Smith <psmith@gnu.org>2005-02-26 01:41:48 +0000
commit9d153cc1b1e467cd6245755c32f78efbd62142c2 (patch)
tree229919252d0b4a25e1e5c00d80ab744fbe5b5c81 /main.c
parent6d995b036e714ea3d61112ebc582b0671cc36e77 (diff)
downloadgunmake-9d153cc1b1e467cd6245755c32f78efbd62142c2.tar.gz
Add configure operations to support MINGW on Windows.
Diffstat (limited to 'main.c')
-rw-r--r--main.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/main.c b/main.c
index 33c15b4..42e1a00 100644
--- a/main.c
+++ b/main.c
@@ -1026,6 +1026,25 @@ main (int argc, char **argv, char **envp)
if (program == 0 && argv[0][1] == ':')
program = argv[0] + 1;
#endif
+#ifdef WINDOWS32
+ if (program == 0)
+ {
+ /* Extract program from full path */
+ int argv0_len;
+ char *p = strrchr (argv[0], '\\');
+ if (!p)
+ p = argv[0];
+ argv0_len = strlen(p);
+ if (argv0_len > 4
+ && streq (&p[argv0_len - 4], ".exe"))
+ {
+ /* Remove .exe extension */
+ p[argv0_len - 4] = '\0';
+ /* Increment past the initial '\' */
+ program = p + 1;
+ }
+ }
+#endif
if (program == 0)
program = argv[0];
else