Lindenii Project Forge
Login

server

Lindenii Forge’s main backend daemon
Commit info
ID
77d9b1a3211d23ce3f57928006eaab6e719f64af
Author
Runxi Yu <me@runxiyu.org>
Author date
Mon, 31 Mar 2025 10:29:20 +0800
Committer
Runxi Yu <me@runxiyu.org>
Committer date
Mon, 31 Mar 2025 10:29:20 +0800
Actions
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);
}