Author: hbelusca Date: Sun Mar 29 02:00:15 2015 New Revision: 66947
URL: http://svn.reactos.org/svn/reactos?rev=66947&view=rev Log: [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).
Modified: trunk/reactos/tools/bin2c.c trunk/reactos/tools/cat.c
Modified: trunk/reactos/tools/bin2c.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/bin2c.c?rev=66947&... ============================================================================== --- trunk/reactos/tools/bin2c.c [iso-8859-1] (original) +++ trunk/reactos/tools/bin2c.c [iso-8859-1] Sun Mar 29 02:00:15 2015 @@ -19,7 +19,7 @@ /* 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 @@ 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 @@ { 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; }
Modified: trunk/reactos/tools/cat.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cat.c?rev=66947&r... ============================================================================== --- trunk/reactos/tools/cat.c [iso-8859-1] (original) +++ trunk/reactos/tools/cat.c [iso-8859-1] Sun Mar 29 02:00:15 2015 @@ -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 @@ 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 @@ */ 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; }