src/world/bin/echo/src/echo.c

52 lines
1.7 KiB
C

/*
*----------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <jeang3nie@HitchHiker-Linux.org> wrote this file. As long as you
* retain this notice you can do whatever you want with this stuff. If
* we meet some day, and you think this stuff is worth it, you can buy
* me a beer in return.
* ---------------------------------------------------------------------
* ______ _______ _ _________
* ( __ \ ( ___ )( ( /|( )\__ __/
* | ( \ )| ( ) || \ ( ||/ ) (
* | | ) || | | || \ | | | |
* | | | || | | || (\ \) | | |
* | | ) || | | || | \ | | |
* | (__/ )| (___) || ) \ | | |
* (______/ (_______)|/ )_) )_(
*
* _______ _______ _ _________ _______
* ( ____ )( ___ )( \ /|\__ __/( ____ \
* | ( )|| ( ) || \ ( | ) ( | ( |/
* | (____)|| (___) || \ | | | | | |
* | _____)| ___ || (\ \) | | | | |
* | ( | ( ) || | \ | | | | |
* | ) | ) ( || ) \ |___) (___| (____|\
* |/ |/ \||/ \_)\_______/(_______/
*
*/
#include <locale.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char * argv[]) {
int n = 0, i = 1;
(void)setlocale(LC_ALL, "");
if ((argc > 1) && (!strcmp(argv[1], "-n"))) {
n = 1;
i = 2;
}
for (; i < argc; i++) {
(void)fputs(argv[i], stdout);
if (argv[i + 1] != NULL)
putchar(' ');
}
if (!n)
putchar('\n');
if (fflush(stdout))
return 1;
return 0;
}