diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2006-09-22 07:57:10 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2006-09-22 07:57:10 +0000 |
commit | 59fc2f43ed89dc2ad34e826c06ecc8f4eedf7ab4 (patch) | |
tree | 6e7865c72babd7583d9f23d225680b4a472dc35a /soltools | |
parent | cf4a2364534279fde574928ba2bf1a4a0e08252e (diff) |
INTEGRATION: CWS vgbugs04 (1.7.62); FILE MERGED
2006/09/15 15:19:53 vg 1.7.62.5: #i69015# -n switsh for windows-native slashes
2006/09/04 13:49:59 vg 1.7.62.4: #i69015# add slash at the end of the string
2006/09/01 11:29:37 vg 1.7.62.3: #i69015# use dmake slash variable
2006/08/31 10:34:13 vg 1.7.62.2: #i69015# generic paths for windows
2006/07/04 10:37:14 vg 1.7.62.1: #137785# optimize makedepend
Diffstat (limited to 'soltools')
-rw-r--r-- | soltools/mkdepend/main.c | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/soltools/mkdepend/main.c b/soltools/mkdepend/main.c index a1122c9b9ee8..f6353c53cda9 100644 --- a/soltools/mkdepend/main.c +++ b/soltools/mkdepend/main.c @@ -159,6 +159,8 @@ catch (sig) struct sigaction sig_act; #endif /* USGISH */ +boolean native_win_slashes = FALSE; + int main(argc, argv) int argc; char **argv; @@ -172,6 +174,7 @@ int main(argc, argv) struct symtab *psymp = predefs; char *endmarker = NULL; char *defincdir = NULL; + struct IncludesCollection* incCollection; ProgramName = argv[0]; @@ -283,6 +286,10 @@ int main(argc, argv) } else width = atoi(argv[0]+2); break; + case 'n': + // Use "-n" switch to generate dependencies with windows-native slash style + native_win_slashes = TRUE; + break; case 'o': if (endmarker) break; if (argv[0][2] == '\0') { @@ -345,6 +352,10 @@ int main(argc, argv) warning("ignoring option %s\n", argv[0]); } } + + convert_slashes(objprefix); + objprefix = append_slash(objprefix); + if (!defincdir) { #ifdef PREINCDIR if (incp >= includedirs + MAXDIRS) @@ -436,11 +447,13 @@ int main(argc, argv) /* * now peruse through the list of files. */ + incCollection = create_IncludesCollection(); + for(fp=filelist; *fp; fp++) { filecontent = getfile(*fp); ip = newinclude(*fp, (char *)NULL); - find_includes(filecontent, ip, ip, 0, FALSE); + find_includes(filecontent, ip, ip, 0, FALSE, incCollection); freefile(filecontent); recursive_pr_include(ip, ip->i_file, base_name(*fp)); inc_clean(); @@ -761,3 +774,41 @@ void warning1(msg,x1,x2,x3,x4,x5,x6,x7,x8,x9) #endif #endif /* DEBUG_MKDEPEND */ } + +void convert_slashes(path) + char* path; +{ +#if defined (WNT) + /* + * Convert backslashes to slashes + */ + char *ptr; + if (native_win_slashes) { + for (ptr = (char*)path; *ptr; ++ptr) + if (*ptr == '/') + *ptr = '\\'; + } else { + for (ptr = (char*)path; *ptr; ++ptr) + if (*ptr == '\\') + *ptr = '/'; + }; +#endif +} + +char* append_slash(path) + char* path; +{ + char *ptr, *new_string; + if ((path[strlen(path) - 1] == '/') || (path[strlen(path) - 1] == '\\')) { + new_string = path; + } else { + new_string = (char*)malloc(sizeof(char) * (strlen(path) + 2)); + strcpy(new_string, path); + if (native_win_slashes) + strcat(new_string, "\\"); + else + strcat(new_string, "/"); + }; + return new_string; +}; + |