mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Added error detection to echo(1).
This commit is contained in:
parent
4dda38cab3
commit
b7788610da
1 changed files with 8 additions and 0 deletions
|
@ -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 = " ";
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue