jos/user/echo.c

22 lines
310 B
C
Raw Normal View History

2018-10-24 17:44:45 -07:00
#include <inc/lib.h>
void
umain(int argc, char **argv)
{
int i, nflag;
nflag = 0;
if (argc > 1 && strcmp(argv[1], "-n") == 0) {
nflag = 1;
argc--;
argv++;
}
for (i = 1; i < argc; i++) {
if (i > 1)
write(1, " ", 1);
write(1, argv[i], strlen(argv[i]));
}
if (!nflag)
write(1, "\n", 1);
}