Added error detection to echo(1).

This commit is contained in:
Jonas 'Sortie' Termansen 2012-05-27 14:28:59 +02:00
parent 4dda38cab3
commit b7788610da
1 changed files with 8 additions and 0 deletions

View File

@ -21,7 +21,9 @@
*******************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
int main(int argc, char* argv[])
{
@ -36,7 +38,13 @@ int main(int argc, char* argv[])
const char* prefix = "";
for ( int i = startfrom; i < argc; i++ )
{
errno = 0;
printf("%s%s", prefix, argv[i]);
if ( errno != 0 )
{
perror("<stdout>");
exit(1);
}
prefix = " ";
}