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>
29 lines
706 B
C
29 lines
706 B
C
/*
|
|
* cprintf — printf for the conio output set. Formats into a static
|
|
* buffer with vsprintf (from SDCC's stdlib), then emits via cputs which
|
|
* applies the current text attribute per character.
|
|
*
|
|
* No '\n' to CR LF translation — Turbo-C convention: callers write
|
|
* "\r\n" explicitly in the format string for line breaks.
|
|
*
|
|
* Not reentrant (single static buffer) but Z80 single-threaded is fine.
|
|
*/
|
|
|
|
#include <conio.h>
|
|
#include <stdarg.h>
|
|
#include <stdio.h>
|
|
|
|
#define CPRINTF_BUF_SIZE 256
|
|
|
|
static char cp_buf[CPRINTF_BUF_SIZE];
|
|
|
|
int cprintf(const char *fmt, ...)
|
|
{
|
|
va_list ap;
|
|
va_start(ap, fmt);
|
|
int n = vsprintf(cp_buf, fmt, ap);
|
|
va_end(ap);
|
|
cputs(cp_buf);
|
|
return n;
|
|
}
|