add directory study

This commit is contained in:
gohigh
2024-02-19 00:25:23 -05:00
parent b1306b38b1
commit f3774e2f8c
4001 changed files with 2285787 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
/* getlf - get a line feed Author: Andy Tanenbaum */
#include <sys/types.h>
#include <fcntl.h>
main(argc, argv)
int argc;
char *argv[];
{
char c;
/* Echo argument, if present. */
if (argc == 2) {
std_err(argv[1]);
std_err("\n");
}
close(0);
open("/dev/tty", O_RDONLY);
do {
if (read(0, &c, 1) <= 0) exit(1);
if (c <= 0) exit(1);
} while (c != '\n');
exit(0);
}