Files
Sprinter-SDCC/tests/stest2/stest2.c
T
snark13 737c974400 Add mdview markdown viewer, reorganize tests/examples and libc layout
- 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>
2026-06-04 22:23:36 +03:00

44 lines
950 B
C

/*
* stattest — exercise POSIX stat() and fstat() over ESTEX file metadata.
*
* Calls:
* stat() on a file by path
* stat() on a directory (current dir)
* stat() on a non-existent file (expects errno=ENOENT)
* fstat() on a freshly opened file
*/
#include <stdio.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <time.h>
#include <dir.h>
int main(int argc, char **argv)
{
struct stat st;
puts("stattest: stat() / fstat() smoke test");
ffblk_t ffb;
if (ffirst(argv[0], &ffb, FA_DIREC) == 0) {
printf("File %s, size = %d\n", argv[0], ffb.size);
} else {
printf("File %s, error\n", argv[0]);
}
if (argc > 1) {
if (ffirst(argv[1], &ffb, FA_DIREC) == 0) {
printf("File %s, size = %d\n", argv[1], ffb.size);
} else {
printf("File %s, error\n", argv[1]);
}
}
return 0;
}