2 Copyright © 2013 Alastair Stuart
4 This program is open source software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
19 #define VERSION "0.01"
25 int main(int argc
, char* argv
[])
27 flags
.newline
= false;
31 for (arg
= 1; arg
< argc
; arg
++)
33 if (strcmp("-n", argv
[arg
]) == 0) {
35 } else if (strcmp("--help", argv
[arg
]) == 0 || strcmp("-h", argv
[arg
]) == 0) {
36 printf("Usage: %s [options] [string ...]\n", argv
[0]);
38 " -n Don't print the trailing newline.\n"
40 " --help Print this message.\n"
41 " --version Show version info.\n");
43 } else if (strcmp("--version", argv
[arg
]) == 0 || strcmp("-v", argv
[arg
]) == 0) {
44 printf("echo (mutos) v"VERSION
"\n");
46 } else if (strcmp("--", argv
[arg
]) == 0) {
55 for ( ; arg
< argc
; arg
++)
57 printf("%s%s", argv
[arg
], arg
!= argc
- 1 ? " " : (flags
.newline
? "" : "\n"));