aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-09-26 12:39:26 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-09-26 13:24:24 +0200
commit5863040f9323e210df0908333c6e85d63af000c0 (patch)
tree8c8838c68b7566b42d9dd84abe7212e93b1740ea
parentf891e5ca638ead13485cc490320e74d698641623 (diff)
downloadxK-5863040f9323e210df0908333c6e85d63af000c0.tar.gz
xK-5863040f9323e210df0908333c6e85d63af000c0.tar.xz
xK-5863040f9323e210df0908333c6e85d63af000c0.zip
Update documentation, clean up
-rw-r--r--NEWS2
-rw-r--r--README.adoc5
-rwxr-xr-xxD-gen-replies.awk10
-rw-r--r--xP/Makefile7
-rw-r--r--xS/.gitignore2
-rw-r--r--xS/Makefile13
-rw-r--r--xS/go.mod3
-rwxr-xr-xxS/xS-gen-replies.awk14
-rw-r--r--xS/xS.go (renamed from xS/main.go)2
-rw-r--r--xS/xS_test.go (renamed from xS/main_test.go)0
10 files changed, 41 insertions, 17 deletions
diff --git a/NEWS b/NEWS
index 1d3cd4a..803dc03 100644
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,8 @@
* Added a web frontend for xC called xP
+ * Added a Go port of xD called xS
+
1.5.0 (2021-12-21) "The Show Must Go On"
diff --git a/README.adoc b/README.adoc
index 3c09ba7..8d61855 100644
--- a/README.adoc
+++ b/README.adoc
@@ -47,8 +47,9 @@ What it notably doesn't support is online changes to configuration, any limits
besides the total number of connections and mode `+l`, or server linking
(which also means no services).
-This program has been https://git.janouch.name/p/haven/src/branch/master/hid[
-ported to Go] in a different project, and development continues over there.
+xS
+--
+The IRC daemon again, this time ported to Go, additionally supporting WEBIRC.
xB
--
diff --git a/xD-gen-replies.awk b/xD-gen-replies.awk
index c9e8882..015e743 100755
--- a/xD-gen-replies.awk
+++ b/xD-gen-replies.awk
@@ -2,14 +2,14 @@
BEGIN {
# The message catalog is a by-product
msg = "xD.msg"
- print "$quote \"" > msg;
- print "$set 1" > msg;
+ print "$quote \"" > msg
+ print "$set 1" > msg
}
/^[0-9]+ *IRC_(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)
print $1 " " texts[$2] > msg
}
diff --git a/xP/Makefile b/xP/Makefile
index 34de55a..c0198aa 100644
--- a/xP/Makefile
+++ b/xP/Makefile
@@ -1,5 +1,6 @@
.POSIX:
.SUFFIXES:
+AWK = env LC_ALL=C awk
outputs = xP proto.go public/proto.js public/mithril.js
all: $(outputs) public/ircfmt.woff2
@@ -7,11 +8,11 @@ all: $(outputs) public/ircfmt.woff2
xP: xP.go proto.go
go build -o $@
proto.go: ../xC-gen-proto.awk ../xC-gen-proto-go.awk ../xC-proto
- awk -f ../xC-gen-proto.awk -f ../xC-gen-proto-go.awk ../xC-proto > $@
+ $(AWK) -f ../xC-gen-proto.awk -f ../xC-gen-proto-go.awk ../xC-proto > $@
public/proto.js: ../xC-gen-proto.awk ../xC-gen-proto-js.awk ../xC-proto
- awk -f ../xC-gen-proto.awk -f ../xC-gen-proto-js.awk ../xC-proto > $@
+ $(AWK) -f ../xC-gen-proto.awk -f ../xC-gen-proto-js.awk ../xC-proto > $@
public/ircfmt.woff2: gen-ircfmt.awk
- awk -v Output=$@ -f gen-ircfmt.awk
+ $(AWK) -v Output=$@ -f gen-ircfmt.awk
public/mithril.js:
curl -Lo $@ https://unpkg.com/mithril/mithril.js
clean:
diff --git a/xS/.gitignore b/xS/.gitignore
new file mode 100644
index 0000000..4f7b84d
--- /dev/null
+++ b/xS/.gitignore
@@ -0,0 +1,2 @@
+/xS
+/xS-replies.go
diff --git a/xS/Makefile b/xS/Makefile
new file mode 100644
index 0000000..55ad4d2
--- /dev/null
+++ b/xS/Makefile
@@ -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)
diff --git a/xS/go.mod b/xS/go.mod
new file mode 100644
index 0000000..9752c95
--- /dev/null
+++ b/xS/go.mod
@@ -0,0 +1,3 @@
+module janouch.name/xK/xS
+
+go 1.19
diff --git a/xS/xS-gen-replies.awk b/xS/xS-gen-replies.awk
index fce7b50..94a338f 100755
--- a/xS/xS-gen-replies.awk
+++ b/xS/xS-gen-replies.awk
@@ -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 "}"
diff --git a/xS/main.go b/xS/xS.go
index 21851f1..e6c3b3c 100644
--- a/xS/main.go
+++ b/xS/xS.go
@@ -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 '[':
diff --git a/xS/main_test.go b/xS/xS_test.go
index 8241b4e..8241b4e 100644
--- a/xS/main_test.go
+++ b/xS/xS_test.go