Загрузить файлы в «src»
This commit is contained in:
parent
acd5298cb4
commit
266e932fd6
3
src/true.c
Normal file
3
src/true.c
Normal file
@ -0,0 +1,3 @@
|
||||
int main(void) {
|
||||
return 0;
|
||||
}
|
24
src/yes.c
Normal file
24
src/yes.c
Normal file
@ -0,0 +1,24 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void print(const char *buf, ssize_t len) {
|
||||
if (write(STDOUT_FILENO, buf, len) < 0)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int main(const int argc, const char **argv) {
|
||||
if (argc == 1)
|
||||
while (1)
|
||||
print("y\n", 2);
|
||||
|
||||
while (1) {
|
||||
for (ssize_t i = 1; i < argc; i++) {
|
||||
print(argv[i], strlen(argv[i]));
|
||||
print(" ", 1);
|
||||
}
|
||||
|
||||
print("\n", 1);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user