blob: 6a44789b4a6bd5575b731de9cd82111ea9ff7262 (
plain)
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
26
|
#include "../command.h"
static void help(void) {
printf("Usage: yes [STRING]\n\n");
printf("Repeatedly output a line with all specified STRING(s), or 'y'.\n");
}
COMMAND(yes) {
const char* repeat;
int i;
parse_help(argc, argv, help);
if (argc == 0) {
repeat = "y";
} else {
repeat = argv[0];
for (i = 1; i < argc; i++) {
*(argv[i]-1) = ' ';
}
}
while (true) {
printf("%s\n", repeat);
}
}
|