← Back to davo.co
summaryrefslogtreecommitdiffstats
path: root/esc.c
diff options
context:
space:
mode:
authorDavid Faulkner <[email protected]>2026-08-07 23:40:47 -0500
committerDavid Faulkner <[email protected]>2026-08-07 23:40:47 -0500
commitb3e9e62599532050fc776c5e8f076915b56c2235 (patch)
treeaf252346106a61b18cc6fc6fdbd32e962d096f1c /esc.c
Import official C23 code examples for Modern C (Jens Gustedt, 2024)HEADupstream-importmain
- Add official C source files, Makefile, c23-fallback.h, and LICENSE - Update README.md with study mirror notice
Diffstat (limited to 'esc.c')
-rw-r--r--esc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/esc.c b/esc.c
new file mode 100644
index 0000000..717e556
--- /dev/null
+++ b/esc.c
@@ -0,0 +1,12 @@
+#include "esc.h"
+
+void esc_move(FILE* f, int vert, int hori) {
+ if (vert > 0) fprintf(f, ESC_CSI "%dB", vert);
+ else if (vert < 0) fprintf(f, ESC_CSI "%dA", -vert);
+ if (hori > 0) fprintf(f, ESC_CSI "%dC", hori);
+ else if (hori < 0) fprintf(f, ESC_CSI "%dD", -hori);
+}
+
+void esc_goto(FILE* f, unsigned vert, unsigned hori) {
+ fprintf(f, ESC_CSI "%u;%uH", vert, hori);
+}