have echo use FD 1 for clarity
This commit is contained in:
parent
25e113138d
commit
c0beeccb1b
10
user/echo.c
10
user/echo.c
|
@ -7,7 +7,13 @@ main(int argc, char *argv[])
|
|||
{
|
||||
int i;
|
||||
|
||||
for(i = 1; i < argc; i++)
|
||||
printf("%s%s", argv[i], i+1 < argc ? " " : "\n");
|
||||
for(i = 1; i < argc; i++){
|
||||
write(1, argv[i], strlen(argv[i]));
|
||||
if(i + 1 < argc){
|
||||
write(1, " ", 1);
|
||||
} else {
|
||||
write(1, "\n", 1);
|
||||
}
|
||||
}
|
||||
exit();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue