Module: wine Branch: master Commit: 5eb4b094a39006af09d27dc21a9561f5d681123e URL: http://source.winehq.org/git/wine.git/?a=commit;h=5eb4b094a39006af09d27dc21a...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Mar 16 13:14:21 2010 +0100
makedep: Append the separator if not found in an existing makefile.
---
tools/makedep.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/makedep.c b/tools/makedep.c index 60278a9..c3b8720 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -929,15 +929,17 @@ static void output_dependencies(void) { char buffer[1024]; FILE *tmp_file = create_temp_file( &tmp_name ); + int found = 0;
- while (fgets( buffer, sizeof(buffer), file )) + while (fgets( buffer, sizeof(buffer), file ) && !found) { if (fwrite( buffer, 1, strlen(buffer), tmp_file ) != strlen(buffer)) fatal_error( "error writing to %s\n", tmp_name ); - if (!strncmp( buffer, Separator, strlen(Separator) )) break; + found = !strncmp( buffer, Separator, strlen(Separator) ); } fclose( file ); file = tmp_file; + if (!found && list_head(&sources)) fprintf( file, "\n%s\n", Separator ); } else {