have echo use FD 1 for clarity

This commit is contained in:
Robert Morris 2019-09-04 10:12:53 -04:00
parent 25e113138d
commit c0beeccb1b

View file

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