summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-10-03 07:45:00 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-10-03 07:45:00 -0700
commit502543ea94913ec4d4792dbd07151fba22220637 (patch)
treeaee75a1e3422974a602efb404b6e3c26296c4fcb /txr.1
parent82bab2edc729eacf73c04290be7c68abe0baca0b (diff)
downloadtxr-502543ea94913ec4d4792dbd07151fba22220637.tar.gz
txr-502543ea94913ec4d4792dbd07151fba22220637.tar.bz2
txr-502543ea94913ec4d4792dbd07151fba22220637.zip
New method: str-addr.
* socket.c (sock_set_entries): Intern str-addr symbol. There is no autoload on this because the struct types of which this is a method don't exist if the socket module has not been loaded. * stdlib/socket.tl ((sockaddr-in str-addr), (sockaddr-in6 str-addr), (sockaddr-un str-addr)): New methods. * tests/014/str-addr.tl: New file. This provides coverage not just for the str-addr method, but the hitherto untested address to text functions. This is why the bug was found, that was addressed in the previous commit. The test case which produces "8000::1" was actually producing "800:1". * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.142
1 files changed, 42 insertions, 0 deletions
diff --git a/txr.1 b/txr.1
index 11ffebd6..4e5b8575 100644
--- a/txr.1
+++ b/txr.1
@@ -75495,6 +75495,48 @@ is passed to
.codn inaddr-str .
.RE
+.coNP Method @ str-addr
+.synb
+.mets << sockaddr .(str-addr)
+.syne
+.desc
+A method named
+.code str-addr
+is defined for the struct types
+.codn sockaddr-in ,
+.code sockaddr-in6
+and
+.codn sockaddr-un .
+It returns a text representation of the address as a string. If the
+.code port
+slot of
+.code sockaddr-in
+or
+.code sockaddr-in6
+is a nonzero integer, then it is incorporated into the text representation.
+Likewise if the
+.code prefix
+slot has a non-default value specifying fewer bits than the width of
+the address, the prefix notation is produced.
+
+The intent is that the representations produced are suitable as input
+to the
+.code sockaddr-str
+function which will reproducing an address object of the same type,
+featuring the same
+.codn addr ,
+.code port
+and
+.codn prefix .
+In the case of
+.codn sockaddr-un ,
+the
+.code sockaddr-str
+function will reproduce the same address only if the
+.code path
+slot is a string starting with
+.strn / .
+
.SS* Unix Terminal Control
\*(TX provides access to the terminal control "termios" interfaces defined by