jos/user/echo.c
Anish Athalye c67463e23c Lab 5
2018-10-24 20:44:45 -04:00

22 lines
310 B
C

#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);
}