Lindenii Project Forge
Add colb from June McEnroe
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-FileContributor: Runxi Yu <https://runxiyu.org> .PHONY: clean version.go man CFLAGS = -Wall -Wextra -Werror -pedantic -std=c99 -D_GNU_SOURCE MAN_PAGES = forge.5 hookc.1 forge: version.go hookc/*.c hookc/hookc man # TODO go mod vendor go build . man: $(MAN_PAGES:%=man/%.html) $(MAN_PAGES:%=man/%.txt) man/%.html: man/% mandoc -Thtml -O style=./mandoc.css $< > $@
man/%.txt: man/% mandoc $< | col -b > $@
man/%.txt: man/% utils/colb mandoc $< | ./utils/colb > $@ utils/colb: utils/colb.c
hookc/hookc: version.go: printf 'package main\n\nconst VERSION = "%s"\n' `git describe --tags --always --dirty` > $@ clean: $(RM) forge version.go vendor
/colb
// SPDX-License-Identifier: GPL-3.0-only // SPDX-FileCopyrightText: Copyright (c) 2021 June McEnroe <june@causal.agency> #include <locale.h> #include <stdio.h> #include <wchar.h> int main(void) { setlocale(LC_CTYPE, "C.UTF-8"); wint_t next, prev = WEOF; while (WEOF != (next = getwchar())) { if (next == L'\b') { prev = WEOF; } else { if (prev != WEOF) putwchar(prev); prev = next; } } if (prev != WEOF) putwchar(prev); }