@matheusbsbs / matheus-bagliano / commits / 81f3a188a3
Fork 0

fmt-patch: output file names to stdout

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>

Johannes Schindelin committed May 5, 2006 at 03:33 UTC 81f3a188a3781fa4a818ed27ee83430682a98ec4
1 file changed +6 -1
builtin-log.c
+6 -1
@@ -75,6 +75,8 @@ static int istitlechar(char c)
75 (c >= '0' && c <= '9') || c == '.' || c == '_';
76 }
77
78 +static FILE *realstdout = NULL;
79 +
80 static void reopen_stdout(struct commit *commit, int nr)
81 {
82 char filename[1024];
@@ -117,7 +119,7 @@ static void reopen_stdout(struct commit *commit, int nr)
119 len--;
120 }
121 strcpy(filename + len, ".txt");
120 - fprintf(stderr, "%s\n", filename);
122 + fprintf(realstdout, "%s\n", filename);
123 freopen(filename, "w", stdout);
124 }
125
@@ -149,6 +151,9 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
151 argv++;
152 }
153
154 + if (!use_stdout)
155 + realstdout = fdopen(dup(1), "w");
156 +
157 prepare_revision_walk(&rev);
158 while ((commit = get_revision(&rev)) != NULL) {
159 /* ignore merges */