Update documentation, clean up

This commit is contained in:
2022-09-26 12:39:26 +02:00
parent f891e5ca63
commit 5863040f93
10 changed files with 41 additions and 17 deletions

2
xS/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
/xS
/xS-replies.go

13
xS/Makefile Normal file
View File

@@ -0,0 +1,13 @@
.POSIX:
.SUFFIXES:
AWK = env LC_ALL=C awk
outputs = xS xS-replies.go
all: $(outputs)
xS: xS.go xS-replies.go
go build -o $@
xS-replies.go: xS-gen-replies.awk xS-replies
$(AWK) -f xS-gen-replies.awk xS-replies > $@
clean:
rm -f $(outputs)

3
xS/go.mod Normal file
View File

@@ -0,0 +1,3 @@
module janouch.name/xK/xS
go 1.19

View File

@@ -1,15 +1,19 @@
#!/usr/bin/awk -f
/^[0-9]+ *(ERR|RPL)_[A-Z]+ *".*"$/ {
match($0, /".*"/);
ids[$1] = $2;
texts[$2] = substr($0, RSTART, RLENGTH);
match($0, /".*"/)
ids[$1] = $2
texts[$2] = substr($0, RSTART, RLENGTH)
}
END {
print "package " ENVIRON["GOPACKAGE"] "\n\nconst ("
print "package main"
print ""
print "const ("
for (i in ids)
printf("\t%s = %s\n", ids[i], i)
print ")\n\nvar defaultReplies = map[int]string{"
print ")"
print ""
print "var defaultReplies = map[int]string{"
for (i in ids)
print "\t" ids[i] ": " texts[ids[i]] ","
print "}"

View File

@@ -460,8 +460,6 @@ func (fd *floodDetector) check() bool {
// --- IRC protocol ------------------------------------------------------------
//go:generate sh -c "LC_ALL=C awk -f xS-gen-replies.awk > xS-replies.go < xS-replies"
func ircToLower(c byte) byte {
switch c {
case '[':