[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
This commit is contained in:
Hermès Bélusca-Maïto 2015-03-29 02:00:15 +00:00
parent 02997eb8f4
commit 1a06e54fa5
2 changed files with 12 additions and 11 deletions

View file

@ -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;
}

View file

@ -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;
}