From 1a06e54fa55909e1fff6d2f2b568c3d5f10054e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sun, 29 Mar 2015 02:00:15 +0000 Subject: [PATCH] [BIN2C][CAT]: Use stderr for printing errors (to not mix them up with normal output that should go to stdout. This is especially needed for cat). svn path=/trunk/; revision=66947 --- reactos/tools/bin2c.c | 8 ++++---- reactos/tools/cat.c | 15 ++++++++------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/reactos/tools/bin2c.c b/reactos/tools/bin2c.c index 3fab46f0064..87682c1a67a 100644 --- a/reactos/tools/bin2c.c +++ b/reactos/tools/bin2c.c @@ -19,7 +19,7 @@ int main(int argc, char *argv[]) /* Validate the arguments */ if (argc < 5) { - printf("Usage: bin2c infile.bin outfile.c outfile.h array_name [array_attribute [header_for_attribute]]\n"); + fprintf(stdout, "Usage: bin2c infile.bin outfile.c outfile.h array_name [array_attribute [header_for_attribute]]\n"); return -1; } @@ -27,14 +27,14 @@ int main(int argc, char *argv[]) inFile = fopen(argv[1], "rb"); if (!inFile) { - printf("ERROR: Couldn't open data file '%s'.\n", argv[1]); + fprintf(stderr, "ERROR: Couldn't open data file '%s'.\n", argv[1]); return -1; } outCFile = fopen(argv[2], "w"); if (!outCFile) { fclose(inFile); - printf("ERROR: Couldn't create output source file '%s'.\n", argv[2]); + fprintf(stderr, "ERROR: Couldn't create output source file '%s'.\n", argv[2]); return -1; } outHFile = fopen(argv[3], "w"); @@ -42,7 +42,7 @@ int main(int argc, char *argv[]) { fclose(outCFile); fclose(inFile); - printf("ERROR: Couldn't create output header file '%s'.\n", argv[3]); + fprintf(stderr, "ERROR: Couldn't create output header file '%s'.\n", argv[3]); return -1; } diff --git a/reactos/tools/cat.c b/reactos/tools/cat.c index 6d606e50dc2..f0530aaa4ad 100644 --- a/reactos/tools/cat.c +++ b/reactos/tools/cat.c @@ -23,11 +23,12 @@ void help(void) { - printf("\n" - "ReactOS File Concatenation Tool\n" - "\n" - "Usage: cat [options] [file [...]]\n" - "options - Currently ignored\n"); + fprintf(stdout, + "\n" + "ReactOS File Concatenation Tool\n" + "\n" + "Usage: cat [options] [file [...]]\n" + "options - Currently ignored\n"); } int main(int argc, char* argv[]) @@ -84,7 +85,7 @@ int main(int argc, char* argv[]) in = fopen(argv[i], "rb"); if (in == NULL) { - printf("Failed to open file '%s'\n", argv[i]); + fprintf(stderr, "Failed to open file '%s'\n", argv[i]); return -1; } @@ -104,7 +105,7 @@ int main(int argc, char* argv[]) */ if (!feof(in)) { - printf("Error while reading file '%s'\n", argv[i]); + fprintf(stderr, "Error while reading file '%s'\n", argv[i]); fclose(in); return -1; }