737c974400
- Split tests/ (libc feature tests) and examples/ (real apps); shared
app.mk in repo root, was examples/example.mk
- libc/io/* split into libc/{conio,env,errno,file,mouse,string,sys,
time,video}/ — clearer module boundaries
- New examples/mdview/: markdown viewer (Phases 1-5 + light nested
lists). Headers (H1-H4), HR, ulist/olist/quote with nesting via
leading spaces, fenced code blocks, inline emphasis (bold/italic/
underscore/code), wrap/unwrap mode with soft wrap (F2), horizontal
pan (← →) with '>' truncation indicator
- libc additions: scroll() in conio (ESTEX SCROLL), strlwr/strupr,
gets() test
- Makefile updates across tests/ for the new shared app.mk path
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
32 lines
604 B
C
32 lines
604 B
C
#include <stdio.h>
|
|
#include <fcntl.h>
|
|
#include <unistd.h>
|
|
|
|
int main(void)
|
|
{
|
|
int fd = open("TEST.TXT", O_RDONLY);
|
|
if (fd < 0) {
|
|
puts("cat: cannot open TEST.TXT");
|
|
puts("Press any key to exit...");
|
|
(void)getchar();
|
|
return 1;
|
|
}
|
|
|
|
puts("--- TEST.TXT ---");
|
|
|
|
char buf[64];
|
|
int n;
|
|
while ((n = read(fd, buf, sizeof(buf))) > 0) {
|
|
for (int i = 0; i < n; i++) {
|
|
putchar((unsigned char)buf[i]);
|
|
}
|
|
}
|
|
|
|
close(fd);
|
|
|
|
puts("");
|
|
puts("--- end of file. Press any key to exit. ---");
|
|
(void)getchar();
|
|
return 0;
|
|
}
|