commit 9c85a63

wf  ·  2026-06-26 18:45:32 +0000 UTC
parent 9c85a63
init
5 files changed,  +63, -0
A README
A uni.c
+2, -0
1@@ -0,0 +1,2 @@
2+fbirth
3+uni
+6, -0
1@@ -0,0 +1,6 @@
2+SRC      = fbirth.c uni.c
3+OUT      = $(SRC:.c=)
4+DESTDIR ?= /usr/local
5+
6+all: $(OUT)
7+$(OUT): $(SRC)
A README
+4, -0
1@@ -0,0 +1,4 @@
2+bits
3+====
4+
5+Bits and pieces.
+32, -0
 1@@ -0,0 +1,32 @@
 2+#define _GNU_SOURCE
 3+
 4+#include <stdio.h>
 5+#include <inttypes.h>
 6+#include <sys/stat.h>
 7+#include <fcntl.h>
 8+#include <err.h>
 9+
10+int
11+main(int argc, char **argv) {
12+	if (argc < 2) {
13+		fprintf(stderr, "Usage: %s FILE...\n", argv[0]);
14+		return 1;
15+	}
16+
17+	struct statx buf;
18+
19+	for (int i = 1; i < argc; i++) {
20+		int r = statx(AT_FDCWD, argv[i],
21+			AT_STATX_SYNC_AS_STAT, STATX_BTIME, &buf);
22+		if (r < 0) err(1, "statx");
23+
24+		if (buf.stx_mask & STATX_BTIME)
25+			printf("%" PRIu64 "\n", buf.stx_btime.tv_sec);
26+		else {
27+			warn("statx");
28+			puts("0");
29+		}
30+	}
31+
32+	return 0;
33+}
A uni.c
+19, -0
 1@@ -0,0 +1,19 @@
 2+#include <stdio.h>
 3+#include <wchar.h>
 4+#include <locale.h>
 5+#include <string.h>
 6+#include <err.h>
 7+
 8+int
 9+main(int argc, char **argv) {
10+	if (argc != 2) {
11+		fprintf(stderr, "usage: %s RUNE\n", argv[0]);
12+		return 1;
13+	}
14+
15+	setlocale(LC_CTYPE, "");
16+	wchar_t rune = strtoul(argv[1], NULL, 16);
17+	wprintf(L"%lc", rune);
18+
19+	return 0;
20+}