13 void usage(char *program
)
15 printf("Usage: %s [flags] [string ...]]\n", program
);
16 printf("\t-e, --escape\t\t parse escape characters.\n");
17 printf("\t-n, --no-newline\t don't print a finishing newline.\n");
19 printf("\t-h, --help\t\t print program help (this message).\n");
20 printf("\t-v, --version\t\t print program name and version.\n");
23 int main(int argc
, char* argv
[])
27 flags
.newline
= false;
32 for (i
= 1; i
< argc
; i
++) {
33 if (strcmp(argv
[i
], "-e") == 0 || strcmp(argv
[i
], "--escape") == 0) {
35 } else if (strcmp(argv
[i
], "-n") == 0 || strcmp(argv
[i
], "--no-newline") == 0) {
37 } else if (strcmp(argv
[i
], "-h") == 0 || strcmp(argv
[i
], "--help") == 0) {
40 } else if (strcmp(argv
[i
], "-v") == 0 || strcmp(argv
[i
], "--version") == 0) {
41 printf("echo (mutos) v"VERSION
"\n");
44 // done parsing arguments
49 // reuse i from previous loop to continue where we left off
50 for (; i
< argc
; i
++) {