diff options
author | Paul Smith <psmith@gnu.org> | 2004-11-29 01:35:13 +0000 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2004-11-29 01:35:13 +0000 |
commit | be6a8bc869ece930f3bd5f725efd9fab7a2c2940 (patch) | |
tree | 969b7026f6b5c7b0153946d5f6b4f8cd412095d8 /main.c | |
parent | 539f513773b2e651d987a7bdbdffd8b5164d58cf (diff) | |
download | gunmake-be6a8bc869ece930f3bd5f725efd9fab7a2c2940.tar.gz |
Fix bug #10252: Remove any trailing slashes from -C arguments (WINDOWS32).
Add a regression test for "@" before a define/enddef vs. one inside.
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -1273,16 +1273,27 @@ main (int argc, char **argv, char **envp) for (i = 0; directories->list[i] != 0; ++i) { char *dir = directories->list[i]; + char *expanded = 0; if (dir[0] == '~') { - char *expanded = tilde_expand (dir); + expanded = tilde_expand (dir); if (expanded != 0) dir = expanded; } +#ifdef WINDOWS32 + /* WINDOWS32 chdir() doesn't work if the directory has a trailing '/' + But allow -C/ just in case someone wants that. */ + { + char *p = dir + strlen (dir) - 1; + while (p > dir && (p[0] == '/' || p[0] == '\\')) + --p; + p[1] = '\0'; + } +#endif if (chdir (dir) < 0) pfatal_with_name (dir); - if (dir != directories->list[i]) - free (dir); + if (expanded) + free (expanded); } #ifdef WINDOWS32 |