Initial revision
This commit is contained in:
parent
c41f370421
commit
89c7440c0d
1 changed files with 21 additions and 0 deletions
21
first/myecho.c
Normal file
21
first/myecho.c
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
main(argc, argv)
|
||||||
|
int argc;
|
||||||
|
char *argv[];
|
||||||
|
{
|
||||||
|
int nflag = 0;
|
||||||
|
|
||||||
|
if(argc > 1 && ! strncmp(argv[1], "-n", 2)) {
|
||||||
|
nflag++;
|
||||||
|
argc--;
|
||||||
|
argv++;
|
||||||
|
}
|
||||||
|
while (--argc > 0) {
|
||||||
|
fputs(argv[1], stdout);
|
||||||
|
argv++;
|
||||||
|
if (argc > 1) putchar(' ');
|
||||||
|
}
|
||||||
|
if (!nflag) putchar('\n');
|
||||||
|
exit(0);
|
||||||
|
}
|
Loading…
Reference in a new issue