Update documentation, clean up
This commit is contained in:
2
xS/.gitignore
vendored
Normal file
2
xS/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/xS
|
||||
/xS-replies.go
|
||||
13
xS/Makefile
Normal file
13
xS/Makefile
Normal 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)
|
||||
@@ -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 "}"
|
||||
|
||||
@@ -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 '[':
|
||||
Reference in New Issue
Block a user