1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-09 06:29:38 +00:00

When generating the dependency file, escape spaces in file names.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5307 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2011-12-05 21:32:59 +00:00
parent e23d0e511c
commit 5449f21d9f

View File

@ -568,6 +568,21 @@ unsigned GetCurrentLine (void)
static void WriteEscaped (FILE* F, const char* Name)
/* Write a file name to a dependency file escaping spaces */
{
while (*Name) {
if (*Name == ' ') {
/* Escape spaces */
fputc ('\\', F);
}
fputc (*Name, F);
++Name;
}
}
static void WriteDep (FILE* F, InputType Types)
/* Helper function. Writes all file names that match Types to the output */
{
@ -590,8 +605,8 @@ static void WriteDep (FILE* F, InputType Types)
fputc (' ', F);
}
/* Print the dependency */
fputs (IF->Name, F);
/* Print the dependency escaping spaces */
WriteEscaped (F, IF->Name);
}
}
@ -602,8 +617,6 @@ static void CreateDepFile (const char* Name, InputType Types)
* all files with the given types there.
*/
{
const char* Target;
/* Open the file */
FILE* F = fopen (Name, "w");
if (F == 0) {
@ -614,11 +627,11 @@ static void CreateDepFile (const char* Name, InputType Types)
* file name as target, followed by a tab character.
*/
if (SB_IsEmpty (&DepTarget)) {
Target = OutputFilename;
WriteEscaped (F, OutputFilename);
} else {
Target = SB_GetConstBuf (&DepTarget);
WriteEscaped (F, SB_GetConstBuf (&DepTarget));
}
fprintf (F, "%s:\t", Target);
fputs (":\t", F);
/* Write out the dependencies for the output file */
WriteDep (F, Types);