sbase/echo.c

28 lines
468 B
C
Raw Normal View History

2011-05-22 21:36:34 -04:00
/* See LICENSE file for copyright and license details. */
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
2011-05-23 20:13:34 -04:00
#include <unistd.h>
2011-06-09 21:56:13 -04:00
#include "util.h"
2011-05-22 21:36:34 -04:00
int
main(int argc, char *argv[])
{
bool nflag = false;
2011-05-23 20:13:34 -04:00
char c;
2011-05-22 21:36:34 -04:00
2011-05-23 20:13:34 -04:00
while((c = getopt(argc, argv, "n")) != -1)
switch(c) {
case 'n':
nflag = true;
break;
default:
exit(EXIT_FAILURE);
}
2011-06-09 21:56:13 -04:00
for(; optind < argc; optind++)
putword(argv[optind]);
2011-05-22 21:36:34 -04:00
if(!nflag)
2011-05-25 23:01:20 -04:00
putchar('\n');
2011-05-22 21:36:34 -04:00
return EXIT_SUCCESS;
}