File: echo.c

package info (click to toggle)
discount 2.2.7-2.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,004 kB
  • sloc: ansic: 5,707; pascal: 1,027; sh: 287; makefile: 208
file content (25 lines) | stat: -rw-r--r-- 349 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdio.h>
#include <string.h>
#include <stdlib.h>


int
main(argc, argv)
char **argv;
{
    int nl = 1;
    int i;

    if ( (argc > 1) && (strcmp(argv[1], "-n") == 0) ) {
	++argv;
	--argc;
	nl = 0;
    }

    for ( i=1; i < argc; i++ ) {
	if ( i > 1 ) putchar(' ');
	fputs(argv[i], stdout);
    }
    if (nl) putchar('\n');
    exit(0);
}