summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-09-28 17:13:21 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-09-28 17:13:21 +0200
commit4ab19268268cd96b9706625d42a16d2a629134eb (patch)
tree0894a92709675955abb1b15647e8fe2911d89c7f
parent96cf8dffe4f7b0b910f790066ae622dc429eb522 (diff)
update to version 25
-rw-r--r--BUILD2
-rw-r--r--CHANGELOG12
-rwxr-xr-xCONTENT63
-rwxr-xr-xCONTENT.md63
-rw-r--r--FILES329
-rw-r--r--INSTALL.md116
-rw-r--r--README.md90
-rw-r--r--VERSION2
-rw-r--r--byte.c99
-rw-r--r--conf-build2
-rwxr-xr-xconfigure2
-rw-r--r--include/alloc.h6
-rw-r--r--include/base64.h6
-rw-r--r--include/byte.h23
-rw-r--r--include/cdbmake.h9
-rw-r--r--include/constmap.h6
-rw-r--r--include/exit.h8
-rw-r--r--include/fifo.h8
-rw-r--r--include/fmt.h14
-rw-r--r--include/genalloc.h4
-rw-r--r--include/getoptb.h4
-rw-r--r--include/lock.h8
-rw-r--r--include/ndelay.h8
-rw-r--r--include/open.h8
-rw-r--r--include/select.h2
-rw-r--r--include/sig.h67
-rw-r--r--include/str.h4
-rw-r--r--include/uint_t.h24
-rw-r--r--include/wait.h8
-rwxr-xr-xinstall6
-rw-r--r--man/buffer.310
-rw-r--r--man/getln.338
-rw-r--r--man/getoptb.32
-rw-r--r--sig.c110
-rw-r--r--src/Makefile (renamed from Makefile)26
-rw-r--r--src/TARGETS79
-rw-r--r--src/alloc.c (renamed from alloc.c)23
-rw-r--r--src/base64.c (renamed from base64.c)13
-rw-r--r--src/buffer.c (renamed from buffer.c)38
-rw-r--r--src/byte.c82
-rw-r--r--src/case.c (renamed from case.c)38
-rw-r--r--src/cdbmake.c (renamed from cdbmake.c)10
-rw-r--r--src/cdbread.c (renamed from cdbread.c)10
-rw-r--r--src/constmap.c (renamed from constmap.c)9
-rw-r--r--src/dnsstub/Makefile (renamed from dnsstub/Makefile)9
-rw-r--r--src/dnsstub/README.md (renamed from dnsstub/README.md)6
-rw-r--r--src/dnsstub/TARGETS (renamed from dnsstub/TARGETS)0
-rw-r--r--src/dnsstub/dns_cname.c (renamed from dnsstub/dns_cname.c)6
-rw-r--r--src/dnsstub/dns_dfd.c (renamed from dnsstub/dns_dfd.c)10
-rw-r--r--src/dnsstub/dns_domain.c (renamed from dnsstub/dns_domain.c)10
-rw-r--r--src/dnsstub/dns_dtda.c (renamed from dnsstub/dns_dtda.c)10
-rw-r--r--src/dnsstub/dns_ip.c (renamed from dnsstub/dns_ip.c)10
-rw-r--r--src/dnsstub/dns_ipq.c (renamed from dnsstub/dns_ipq.c)17
-rw-r--r--src/dnsstub/dns_mx.c (renamed from dnsstub/dns_mx.c)12
-rw-r--r--src/dnsstub/dns_name.c (renamed from dnsstub/dns_name.c)10
-rw-r--r--src/dnsstub/dns_nd.c (renamed from dnsstub/dns_nd.c)10
-rw-r--r--src/dnsstub/dns_packet.c (renamed from dnsstub/dns_packet.c)12
-rw-r--r--src/dnsstub/dns_random.c (renamed from dnsstub/dns_random.c)10
-rw-r--r--src/dnsstub/dns_rcip.c (renamed from dnsstub/dns_rcip.c)10
-rw-r--r--src/dnsstub/dns_rcrw.c (renamed from dnsstub/dns_rcrw.c)10
-rw-r--r--src/dnsstub/dns_resolve.c (renamed from dnsstub/dns_resolve.c)10
-rw-r--r--src/dnsstub/dns_sortip.c (renamed from dnsstub/dns_sortip.c)10
-rw-r--r--src/dnsstub/dns_transmit.c (renamed from dnsstub/dns_transmit.c)18
-rw-r--r--src/dnsstub/dns_txt.c (renamed from dnsstub/dns_txt.c)7
-rw-r--r--src/env.c (renamed from env.c)23
-rw-r--r--src/errstr.c (renamed from errstr.c)10
-rw-r--r--src/fd.c (renamed from fd.c)15
-rw-r--r--src/fmt.c (renamed from fmt.c)32
-rw-r--r--src/getln.c (renamed from getln.c)14
-rw-r--r--src/getoptb.c (renamed from getoptb.c)14
-rw-r--r--src/iopause.c (renamed from iopause.c)12
-rw-r--r--src/ip4.c (renamed from ip4.c)90
-rw-r--r--src/ip6.c (renamed from ip6.c)144
-rw-r--r--src/lock.c (renamed from lock.c)10
-rw-r--r--src/logmsg.c (renamed from logmsg.c)10
-rw-r--r--src/ndelay.c (renamed from ndelay.c)10
-rw-r--r--src/open.c (renamed from open.c)10
-rw-r--r--src/pathexec.c (renamed from pathexec.c)10
-rw-r--r--src/prot.c (renamed from prot.c)10
-rw-r--r--src/readclose.c (renamed from readclose.c)14
-rw-r--r--src/scan.c (renamed from scan.c)56
-rw-r--r--src/seek.c (renamed from seek.c)28
-rw-r--r--src/sig.c169
-rw-r--r--src/socket_bind.c (renamed from socket_bind.c)10
-rw-r--r--src/socket_connect.c (renamed from socket_connect.c)10
-rw-r--r--src/socket_if.c (renamed from socket_if.c)10
-rw-r--r--src/socket_info.c (renamed from socket_info.c)14
-rw-r--r--src/socket_recv.c (renamed from socket_recv.c)12
-rw-r--r--src/socket_send.c (renamed from socket_send.c)10
-rw-r--r--src/socket_setup.c (renamed from socket_setup.c)12
-rw-r--r--src/socket_tcp.c (renamed from socket_tcp.c)10
-rw-r--r--src/socket_udp.c (renamed from socket_udp.c)10
-rw-r--r--src/str.c (renamed from str.c)48
-rw-r--r--src/stralloc.c (renamed from stralloc.c)10
-rw-r--r--src/tai.c (renamed from tai.c)10
-rw-r--r--src/taia.c (renamed from taia.c)10
-rw-r--r--src/timeout.c (renamed from timeout.c)11
-rw-r--r--src/timeoutconn.c (renamed from timeoutconn.c)10
-rw-r--r--src/uint128p.c (renamed from uint128p.c)10
-rw-r--r--src/uint16p.c (renamed from uint16p.c)10
-rw-r--r--src/uint32p.c (renamed from uint32p.c)10
-rw-r--r--src/uint64p.c (renamed from uint64p.c)10
-rw-r--r--src/uint8p.c (renamed from uint8p.c)8
-rw-r--r--src/wait.c (renamed from wait.c)10
104 files changed, 1432 insertions, 1192 deletions
diff --git a/BUILD b/BUILD
index da0237c..481bc43 100644
--- a/BUILD
+++ b/BUILD
@@ -1 +1 @@
-20230916182859
+20240921102900
diff --git a/CHANGELOG b/CHANGELOG
index 229e41e..80814d6 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -67,3 +67,15 @@ fehQlibs-22a
fehQlibs-23
More documentation for dns resolver routines.
Added function stralloc_free() which was alreday in the header.
+fehQlibs-24 Removed 'register' in functions. Added 'const' for input strings.
+fehQlibs-25 Compatibility with current gcc and clang compilers:
+ (Internal) Unrolling for() loops removed. Internal functions are static now.
+ (Internal) buffer_init uses now 'buffer_unixread' and 'buffer_unixwrite' with matching signatures.
+ (External) Added getopb() as external and thus removing getop() compatibility.
+ (Installation) Moved C source files to ./src. Added INSTALL.md to describe changes.
+ (Compilation) Added -fwrapv flag to the compiler (correctly handling two's complement).
+ Open issues:
+ 'constmap' is struct and function name!
+ (Internal) alloc_re()'s first argument is now a void pointer to a list [gcc 14.2].
+fehQlibs-25(b)
+ (Make) conf-build was not called due to move to ./src. Missing dot in ./configure.
diff --git a/CONTENT b/CONTENT
deleted file mode 100755
index 25fa27d..0000000
--- a/CONTENT
+++ /dev/null
@@ -1,63 +0,0 @@
-Content of fehQlibs
--------------------
-
-This list contains the generated archive and supplementary
-object files together with their main header files (to be
-found under ./include) and man pages (located at ./man).
-The list is incomplete.
-
-Archive/Object | Headers | Description
------------------------------------------------
-alloc.a alloc.h alloc.3
-buffer.a buffer.h buffer.3
- byte.h byte.3
-case.a case.h case.3
-cdb.a cdbmake.h cdbmake.3
- cdbread.h cdbread.3
-constmap.a constmap.h constmap.3
-dnsresolv.a dnsresolv.h dns.3, dnsstub.3
-env.a env.h env.3
-fd.a fd.h fd.3
-fs.a fmt.h fmt.3
- scan.h scan.3
-getln.a getln.h getln.3
-getopt.a getoptb.h getoptb.3
-ip.a ip.h ip4.3, ip6.3
-lock.a lock.h
-logmsg.a logmsg.h logmsg.3
- error.h error.3
-ndelay.a ndelay.h
-open.a open.h
-seek.a seek.h
-sig.a sig.h
-socket.a socket_if.h socket_bind.3, socket_connect.3
- ip.h socket_if.3, socket_info.3
- socket_recv.3, socket_send.3
- socket_setup.3, socket_tcp.3
- socket_udp.3
-str.a str.h
-stralloc.a stralloc.h stralloc.3
-time.a tai.h, taia.3
- timeout.h timeout.3
- timeoutconn.h timeoutconn.3
- iopause.h iopause.3
- select.h
-wait.a wait.h wait.3
-
-pathexec.o pathexec.h pathexec.3
-prot.o prot.h
-byte.o byte.h byte.3
- base64.h
-readclose.o readclose.h
-uint8p.o uint_t.h
-uint16p.o uint_t.h
-uint32p.o uint_t.h
-uint64p.o uint_t.h
-uint128p.o uint_t.h
-
-
-Two main archives are generated:
-
-- (lib)qlibs.a -- including all above, except for
-- (lib)dnsresolv.a -- routines located at ./dnsstub.
-
diff --git a/CONTENT.md b/CONTENT.md
new file mode 100755
index 0000000..ef42b84
--- /dev/null
+++ b/CONTENT.md
@@ -0,0 +1,63 @@
+Content of fehQlibs
+===================
+
+This list contains the generated archive and supplementary
+object files together with their main header files (to be
+found under ./include) and man pages (located at ./man).
+The list is incomplete.
+
+ Archive/Object | Headers | Description
+ -----------------------------------------------
+ alloc.a alloc.h alloc.3
+ buffer.a buffer.h buffer.3
+ byte.h byte.3
+ case.a case.h case.3
+ cdb.a cdbmake.h cdbmake.3
+ cdbread.h cdbread.3
+ constmap.a constmap.h constmap.3
+ dnsresolv.a dnsresolv.h dns.3, dnsstub.3
+ env.a env.h env.3
+ fd.a fd.h fd.3
+ fs.a fmt.h fmt.3
+ scan.h scan.3
+ getln.a getln.h getln.3
+ getopt.a getoptb.h getoptb.3
+ ip.a ip.h ip4.3, ip6.3
+ lock.a lock.h
+ logmsg.a logmsg.h logmsg.3
+ error.h error.3
+ ndelay.a ndelay.h
+ open.a open.h
+ seek.a seek.h
+ sig.a sig.h
+ socket.a socket_if.h socket_bind.3, socket_connect.3
+ ip.h socket_if.3, socket_info.3
+ socket_recv.3, socket_send.3
+ socket_setup.3, socket_tcp.3
+ socket_udp.3
+ str.a str.h
+ stralloc.a stralloc.h stralloc.3
+ time.a tai.h, taia.3
+ timeout.h timeout.3
+ timeoutconn.h timeoutconn.3
+ iopause.h iopause.3
+ select.h
+ wait.a wait.h wait.3
+
+ pathexec.o pathexec.h pathexec.3
+ prot.o prot.h
+ byte.o byte.h byte.3
+ base64.h
+ readclose.o readclose.h
+ uint8p.o uint_t.h
+ uint16p.o uint_t.h
+ uint32p.o uint_t.h
+ uint64p.o uint_t.h
+ uint128p.o uint_t.h
+
+
+Two main archives are generated:
+
+- (lib)qlibs.a -- including all above, except for
+- (lib)dnsresolv.a -- routines located at ./dnsstub.
+
diff --git a/FILES b/FILES
index 85b59ef..465217b 100644
--- a/FILES
+++ b/FILES
@@ -1,162 +1,167 @@
-./BUILD = 3119c820453717278177af253188e95c
-./CHANGELOG = ba424a3dd1cdb12d4c345a11de0a0817
-./CONTENT = 3478f3a562d003b32aa0762e93a75b26
-./LICENSE = 43df073a04022f63913c379646905da6
-./Makefile = abba48d9d52ca48f050208231de5c783
-./README.md = 60875952ce23f26102f84757329b9b31
-./TARGETS = a3800d82d6b95a77536b9c719b519b73
-./VERSION = 6cfc8c14f10d3a39524fed09959cdffa
-./alloc.c = 514e44b39a3c964d0e17efda78e9b8c7
-./base64.c = 3a2830988bc99a672f09557b288dfd81
-./buffer.c = 04489d0d0961e69081381983bbe26f56
-./byte.c = 67806bc236105f085b46ae4327e437ae
-./case.c = f03a5e250d1aff49d1304670f5b7254a
-./cdbmake.c = b038d803422618d1f7eaade9716a858e
-./cdbread.c = 5eeb568fb122813c7ac0a3d273b98591
-./conf-build = 52f94f184b80b29aa7800265da87de55
-./configure = 145494889bebdcc519320472d84566b6
-./constmap.c = e49f40971441ca0187a19a1feba012f1
-./dnsstub/Makefile = 8dcd8f647b1f8d7ec755cea81ed57a37
-./dnsstub/README.md = d50e01dbf9223e49ec52f131fa5916d8
-./dnsstub/TARGETS = 723bd9a97f59f9091fbe2fba10ef8e5e
-./dnsstub/dns_cname.c = f70db88df864eab7694b747fd77dbb6d
-./dnsstub/dns_dfd.c = 149da24f7b57761d9c0eec3278b63fb0
-./dnsstub/dns_domain.c = e79ee91862f5d06ec892a228489aca3f
-./dnsstub/dns_dtda.c = f9fc0ba7ea3cdaad5e85c0d0edd479a7
-./dnsstub/dns_ip.c = 811eec1cfe97536d6ea9a1d5e48801ce
-./dnsstub/dns_ipq.c = 273479eeae125ffbddaf4e95fbcfe0f0
-./dnsstub/dns_mx.c = 01c29dde656fbaf7ab19c4c3a28664ac
-./dnsstub/dns_name.c = 31cb8e08404ab22dca6c6098a2fc9317
-./dnsstub/dns_nd.c = 8d1c5bf17f2242d22d64903393a73768
-./dnsstub/dns_packet.c = d6e4035938817a47f10578265d52b0ab
-./dnsstub/dns_random.c = 7429f11a2181d0771046ffd85f4acb38
-./dnsstub/dns_rcip.c = 2762d62ad3fffe4caaadbafd3c007211
-./dnsstub/dns_rcrw.c = c57be390844bb9f26fb44dbce2837136
-./dnsstub/dns_resolve.c = 8ec11fea2c0bb173b73230e0f41b055b
-./dnsstub/dns_sortip.c = aa8effa053c3d6899a17242d3eebae40
-./dnsstub/dns_transmit.c = 8c2b07aa13b0abcc7697cb37d9fef821
-./dnsstub/dns_txt.c = 4a8d105d506ec11ac3c307f405393e42
-./env.c = 2aabee824c86ed685a17cc8b6eb6e1cf
-./errstr.c = e89bde5dd0320f24a399967ef64c4a27
-./fd.c = e1643064b0f9571c92cb17f5e6c2c3c9
-./fmt.c = b2627c34a39b7a492ec07969931c6bc9
-./getln.c = bb694220f8bedb7f7f8a8dd8a6d91347
-./getoptb.c = 92c4305401f59359b8dac69e1df84647
-./include/alloc.h = fc20a6d23d60eeaa84a913b19cea2a6f
-./include/base64.h = 518e08181673aff5e497eb526a427b1d
-./include/buffer.h = 4ff0a37e7b614e0d80123782f706f54a
-./include/byte.h = 6a7dc0cca790d6cbac23731e71c665fb
-./include/case.h = b0f7e31bd1e121850c3d1c3dc4c38d5c
-./include/cdbmake.h = 44c1444111c3fabd59ed63258b5d54ad
-./include/cdbread.h = d40f94c976c1cadb575044a3ef965978
-./include/close.h = a1a84cfde83c8cef39c5ca5f52796aee
-./include/constmap.h = f217b422c4d74890b6675e72dca753bf
-./include/direntry.h = ed9e2af8fed1975b017883488b0db2f7
-./include/dnsresolv.h = 717941c00c4e369241000ef70cf848f6
-./include/env.h = 70f96abf159cedaad9bbbfa4c27bc8a7
-./include/error.h = 7886039fc72d57919c1c6db56b5fc324
-./include/exit.h = 45e2e3e56314e2332837a61e1c866423
-./include/fd.h = d76deb5c0ed33bf690e25f4e5fc94359
-./include/fifo.h = 4aac02038e14acac8c2b6e28ec992406
-./include/fmt.h = 71b6a242a848044e65e407a5647d21eb
-./include/genalloc.h = 7d88ca8ee9f933f1cbb9ed0597dddf60
-./include/getln.h = 040da2a02c37a8aa50ea614410f2ed0c
-./include/getoptb.h = 988a7314fca7dff960dcffc134cc404c
-./include/iopause.h = b7680ea87e84b568b8f1f7c281ae739a
-./include/ip.h = a66be1788f98dc795cceeb4b0f0c9bb2
-./include/lock.h = 224879d2b1671dad51f8bbcd6f7c2426
-./include/logmsg.h = d90310844d3fa6cfbab0b37b54170d92
-./include/ndelay.h = cc914c481a7652e9aef10acdf69de7ff
-./include/open.h = 4f4d7371bbefccf2cec365f7811e874e
-./include/pathexec.h = 37af5ae960eb91892744c7a3802737d1
-./include/prot.h = 0f6816695dc713f927e09270696835a2
-./include/readclose.h = cfe01c7d37be0a17a492534faf2717b2
-./include/readwrite.h = 58ab91bb5433b835e97fe78fd6780633
-./include/rename.h = 3d13ce7562cd4f87578b94adaa5857f0
-./include/scan.h = 49a8521c05e6c06436637af85e3f7234
-./include/seek.h = be3607921c13b338365ecbf1e9e24f38
-./include/select.h = 019f9aadad2f1a5d14aa5ec8cdee6065
-./include/sig.h = 3012ce2f2f452e3b822aeb7c9765640a
-./include/socket_if.h = ba79b96dcdcd50983e7328ee28b209ec
-./include/str.h = 9b010e0767b85c44804424ad9436ab5a
-./include/stralloc.h = c9a7b068f19c896891c30fd12bd078bb
-./include/tai.h = ca3390aa0aa229108a4864c0f4a40e6f
-./include/taia.h = 4e9a6bd8f7f6884932d72a48d34301ef
-./include/timeout.h = be7d9294fe124d22abdd20204abcaa2f
-./include/timeoutconn.h = 3bc13384d2d2355d7327a73428027822
-./include/uint_t.h = 2bdc1c29b1a66a792dc41004b1e4d2fe
-./include/wait.h = fc9c628f22a862bb9af69fdd7a6b61a8
-./install = f6468f1ce0a61e581df2d3278d4f9d24
-./iopause.c = 7cbd896fbcca2c26b218a3299543c905
-./ip4.c = 8cf7ae24e43da943e4695f5cb4a50f6c
-./ip6.c = 16192261767a3056adc84c10bbcaf8ce
-./lock.c = 50aa9fca4611c86f943c49256b7a001a
-./logmsg.c = 7335546b87caf29a8fbf41a8ac89169c
-./man/INSTALL = c83cc4663e122994ea65d269982df554
-./man/alloc.3 = 2f666bfc6cb2d755e4047be92853c4c9
-./man/buffer.3 = 14df7a93cc6131f83e84ee438ec29f05
-./man/byte.3 = 3927c67098f880846b6d71c8d69d63af
-./man/case.3 = 6ee29d92e49bb6f91b2e8029c7a5ad04
-./man/cdbmake.3 = 54e604b19d139b0c5b451b86c58802d5
-./man/cdbread.3 = 81a48e1258f4919861b7537a7759c0a5
-./man/constmap.3 = 3308860b3c8b2032dff86d64aab332d0
-./man/dns.3 = 3a3834e729315537509ddfd06d76ecd7
-./man/dnsstub.3 = 63081eeab017fbf754f854010d8b1dc4
-./man/env.3 = 27c3a784e43a5ec37c2918014bcac3f8
-./man/error.3 = 2d2b4e9800b73983848581814065b074
-./man/fd.3 = c6115dbec98169a66af436ea929cc0bb
-./man/fmt.3 = 419b2e143438a3351f6a21828823a367
-./man/getln.3 = 5c4930df89e1132257de8cfa7dbbac3a
-./man/getoptb.3 = eb4ff31f223bcf561043fd96e8bf7fcd
-./man/iopause.3 = 4705db96ec459124a7cac08c75621b43
-./man/ip4.3 = 0ffc1d509fec9b8432638ba2e244599e
-./man/ip6.3 = 480b6a5f03a5a07c122c0dd427b5f671
-./man/logmsg.3 = 1aac69f1603735534b831b062a982b96
-./man/pathexec.3 = 0f320b89031f14099389f245ff0082c4
-./man/scan.3 = f838564ca05d7eb75e0f94601da0e247
-./man/socket_bind.3 = 603252820735a0586d2473d60b5368ba
-./man/socket_connect.3 = 7ede000da47f9d050b4a8b4a548c3fba
-./man/socket_if.3 = 939ee90dbc06e46530bdebb76f7868b7
-./man/socket_info.3 = 25bb53af29cacae415052b795bc9dbbf
-./man/socket_recv.3 = c7fbce83d73180901bacfd42329a1961
-./man/socket_send.3 = 559b6ca0e4e488c961adfec91298cb57
-./man/socket_setup.3 = 06509120a17c0fdc1e74183e4fdeec6e
-./man/socket_tcp.3 = 88a7db7c3f87f6e55676a8bbea04bebb
-./man/socket_udp.3 = 83ef36e87a0616a1f89c62ee10443d20
-./man/str.3 = 8aada587fbeaa6642b92f8259253e864
-./man/stralloc.3 = 62f213c041e32f3b9c807e69b9c2b0a4
-./man/taia.3 = ca40e8e64a68b1452629067f7f5ba82e
-./man/timeout.3 = c70003889aeb948b0083d6ecaf9a78fa
-./man/timeoutconn.3 = 2fa5bc7c6c042bb7c80c431bf5eac5b2
-./man/wait.3 = 13f3301b18e333666659b8e49864d389
-./man/x.html = 4eda1f156fe2348daebfbddf7a33c022
-./ndelay.c = 15de43ad20cb35ec2c80df851f606bd9
-./open.c = 1a793911a2e57e01ffa7bda1d08db8f4
-./pathexec.c = 23c0c5d5013a19eb4f6b4b03c87db8ec
-./prot.c = e1568767fcfb5fc119da935d9d3cf27f
-./readclose.c = deabaa3b8b50201d560bfc3c584ca1c3
-./scan.c = 6792e3f60344e4cf5fcee4fad55fae38
-./seek.c = 5c2ee16ea4ec99584d702ff55d9c9d19
-./sharedlib = bde12e503174244d57ad35135b5d25e9
-./sig.c = a8a98f1c8c27eece5f341ec05f46e80e
-./socket_bind.c = b463068c7160e01d6fb8c3fb903d5c8e
-./socket_connect.c = 96c784f10d7ea96720b10b5844fd4cd0
-./socket_if.c = c841f0681878e90fbac87dc4ce7ab6fe
-./socket_info.c = 623a97efe396c56ac31e0964b4b8025a
-./socket_recv.c = 66914af66c9bda8c2239f5308648cbac
-./socket_send.c = 80647ec33d769a5f5a7ead0b7e881015
-./socket_setup.c = 229bca06ab2f68f483b525b8e8e13886
-./socket_tcp.c = 5c8565ee6668341730d3b9eac7de0a7b
-./socket_udp.c = 50a0bb63dcea40f7c146e17b1aa1050b
-./str.c = ff3952e9e6bf49cd34a2bcafaf168208
-./stralloc.c = 85b65c1193b0d93039530edad5e1cab5
-./tai.c = 823b0274b23207ebade293fd14a1ab31
-./taia.c = 63de9eb6672c1c43296b383224fccc74
-./timeout.c = 35e6965f54a50838b6d3ae61ee8fd962
-./timeoutconn.c = 6acef79e4c36a795da73f2c0eb010d39
-./uint128p.c = 83da4a537b781df80316da49e54735e8
-./uint16p.c = 61e6fed3598e3ceaa41a75d91657bef0
-./uint32p.c = 5a1965fbf0e288aebbae066f341a442b
-./uint64p.c = b95d3d869c5ecc6fe65f65c04dcceeb2
-./uint8p.c = 4db811c33b483cd9fe08ca72c254bb0c
-./wait.c = 4048ebc18bc71a91e21da7ccab205558
+43df073a04022f63913c379646905da6 ./LICENSE
+e38263cd3556a47a617820b7f8075dfc ./CHANGELOG
+1a9639e5b692ae6ebff22db582b91ac1 ./README.md
+e0b1107a83a700404d8380732356aec7 ./configure
+a3800d82d6b95a77536b9c719b519b73 ./TARGETS
+d989cf4be5e835163431de86a545402f ./src/env.c
+8d5cc64913677cd3f1510b0ec0769043 ./src/uint32p.c
+d8d9e945e324297597b42bddfaef0d70 ./src/cdbread.c
+d9a5e47d22fe94c109c2f3b63681e635 ./src/constmap.c
+ac2d821c67a800fb672405f0618aa41b ./src/Makefile
+797ef1bf2cc8d5627dd0fa964bd62368 ./src/buffer.c
+a3800d82d6b95a77536b9c719b519b73 ./src/TARGETS
+718b152686cd951419cd86a909eb1122 ./src/seek.c
+6f905994cb9ffa51ae782e879850e514 ./src/timeout.c
+5c060f1e0cd9a9e1e49e3946210e84d1 ./src/socket_connect.c
+8ff07687bf2bb08faec098d8acdcff56 ./src/ip6.c
+43967af6fecc4d4eef2deffe6999047d ./src/socket_send.c
+90c44be0ab10cbdbd9991507a6de21a3 ./src/alloc.c
+d6c261182d92b78d6f66adec00432883 ./src/getoptb.c
+5857af130514a0fc66d3601d09c911f9 ./src/wait.c
+40abd7766051a4749a82408bbb0669cc ./src/lock.c
+73e7b95f53095e1f645142c9e9f978cf ./src/tai.c
+1c55e79cc713ef604a629a13380ceaf7 ./src/stralloc.c
+eb72075acf926ba92a41456125106084 ./src/sig.c
+fd72b318c3d8ddeff24fff13814f9dcc ./src/logmsg.c
+bf646d47b08d9ccf64d1d172f6837de1 ./src/uint128p.c
+223c843c280503ad709da9870a1c97ec ./src/ip4.c
+84d5eb8c8a9f888b4299c01c8095f497 ./src/ndelay.c
+f3ef026d760a2190c0bec465ff2c17bb ./src/socket_recv.c
+f2958020b5246f89fe75558a71fc81d4 ./src/iopause.c
+e63f1cd6aaa020b9e6a9c67a420e5d5f ./src/case.c
+7b82d7356bbd9d508ccd44dc499ed743 ./src/errstr.c
+a1219f1f6b55799f7c6ef58d59e5d64f ./src/timeoutconn.c
+fcafd37414abb6958ef616f28fc26b66 ./src/uint8p.c
+ff7113c7eca77d7b9f3dd01804fa5034 ./src/str.c
+8a9bbad7985ce1814e9dc54c3bb46ad4 ./src/open.c
+cbbdc60716ddc11f6da2eb60e8adfe4d ./src/socket_if.c
+0501d152c7db44915670eb434f01ee11 ./src/socket_bind.c
+2fb041cdd1a4dc31ba41bf3bf92c5a13 ./src/fd.c
+7632593882141efee3f7d7b506f93098 ./src/fmt.c
+274126672025f879a1d50c1783b7429a ./src/byte.c
+bde12e503174244d57ad35135b5d25e9 ./src/sharedlib
+107d7309a35369b25cc7ed6f18c326ca ./src/socket_setup.c
+be8c207d881800aec4e3c9e7e712ebb4 ./src/uint16p.c
+f4882c3c1eaacc0992ae5e1cf72b5dc6 ./src/getln.c
+79a815a0b0fcb9eeade48c1839cd0641 ./src/scan.c
+b8ba1fc87deb7b01b717c247fbf20405 ./src/pathexec.c
+6682f956fb3fcce1f3412055a376e859 ./src/cdbmake.c
+217540391d2e3b1a73cd4e70816450ac ./src/base64.c
+bde99f617768166384afa5d60a051f3c ./src/dnsstub/dns_random.c
+fc8786efefecaec49a974df18c0dc25c ./src/dnsstub/dns_name.c
+5752db80e5986db3464e2553347854d6 ./src/dnsstub/Makefile
+6f078428d499401d75f8c7540718c380 ./src/dnsstub/dns_dfd.c
+3c25a1b6c439ccd46ebd127ad922ff0f ./src/dnsstub/dns_sortip.c
+723bd9a97f59f9091fbe2fba10ef8e5e ./src/dnsstub/TARGETS
+63a27823692bc54740442a5637934be5 ./src/dnsstub/dns_packet.c
+08f0ddac37d01f2fbc07530d4354f9cb ./src/dnsstub/dns_rcip.c
+46674a28ed8a0d90401825a2ceb38441 ./src/dnsstub/dns_domain.c
+ea71564a2bf072b23640b64a9ca79a4c ./src/dnsstub/dns_ipq.c
+60542241eaa1d1c0a8a2e982b2dc5494 ./src/dnsstub/dns_rcrw.c
+8362746004516897de5ec255d22fec5d ./src/dnsstub/dns_nd.c
+2a9bd072394c358def231153427a9b40 ./src/dnsstub/dns_ip.c
+8a892c7008a6e2a597741dcc5bea5a68 ./src/dnsstub/dns_resolve.c
+2560b5fbd9afd63dc51080b80165ef8c ./src/dnsstub/dns_mx.c
+455925dc93c0fcd7909a4657f8c8b4ee ./src/dnsstub/dns_dtda.c
+b4aba3a8db9cdc9612bac2fc1763c5b8 ./src/dnsstub/dns_cname.c
+2a61cbf664d7e95eed7700e582d897c2 ./src/dnsstub/README.md
+8c6695a1cbccf974631a4c9f7ddb04f7 ./src/dnsstub/dns_txt.c
+8aa54782818fab29a600a1e40689c876 ./src/dnsstub/dns_transmit.c
+b8246d1439a1c5efddcc881e4eda18f0 ./src/socket_info.c
+79103dcf6fad6658f4d97cc5973c07b4 ./src/readclose.c
+63731f2aa9d0b655c43e7ea7fe9a9e7f ./src/taia.c
+6bac00628cb7bad4f12c43d186403c8b ./src/socket_tcp.c
+094b1417caa52c065b58e7139ae17403 ./src/prot.c
+063f6d9e54e228a4b628b083199edb59 ./src/uint64p.c
+3ab098524713f39c3a01bc0b9860d277 ./src/socket_udp.c
+facf6a7d37be70e3fe44b33c66ac2570 ./makelib
+bde12e503174244d57ad35135b5d25e9 ./sharedlib
+e36cfa8aec6df377caee4467d8b96a7f ./VERSION
+fe0f9caaa44877d38b6f73dd60710426 ./INSTALL.md
+8effeb247b1f5ea6609d9484099880f3 ./install
+19b16ec85a6f278d498522cce0fa8f92 ./BUILD
+58ab91bb5433b835e97fe78fd6780633 ./include/readwrite.h
+040da2a02c37a8aa50ea614410f2ed0c ./include/getln.h
+a1a84cfde83c8cef39c5ca5f52796aee ./include/close.h
+be3607921c13b338365ecbf1e9e24f38 ./include/seek.h
+70f96abf159cedaad9bbbfa4c27bc8a7 ./include/env.h
+3bc13384d2d2355d7327a73428027822 ./include/timeoutconn.h
+3d13ce7562cd4f87578b94adaa5857f0 ./include/rename.h
+954ca9f32023b2dec94c862d02fe7ca4 ./include/cdbmake.h
+ed9e2af8fed1975b017883488b0db2f7 ./include/direntry.h
+f3849b25c884d49c364c19320cdfad23 ./include/base64.h
+b0f7e31bd1e121850c3d1c3dc4c38d5c ./include/case.h
+0715579527de757b10176d399404b2b3 ./include/exit.h
+a7766f44651eedea6928f4e9ac5f2013 ./include/fifo.h
+d76deb5c0ed33bf690e25f4e5fc94359 ./include/fd.h
+0e053d8b527a93c843d7eae773bd7444 ./include/sig.h
+37af5ae960eb91892744c7a3802737d1 ./include/pathexec.h
+ca3390aa0aa229108a4864c0f4a40e6f ./include/tai.h
+b43784368cbeb191e78d1b7f9ee3d5ae ./include/wait.h
+d4c037d864067145fe97bb34154bf26b ./include/genalloc.h
+b536326f7ecfe3ef229a3d3ca3a0a554 ./include/lock.h
+1075e89ff1290cf522fb67794e096833 ./include/select.h
+e4a27a49c5dd49d19b1fa34af5bab197 ./include/byte.h
+7886039fc72d57919c1c6db56b5fc324 ./include/error.h
+b7680ea87e84b568b8f1f7c281ae739a ./include/iopause.h
+d6f6e984d583bd6d3eec14eeb52d5534 ./include/fmt.h
+5b98c40f0a89ca109a1e638a8fe33506 ./include/uint_t.h
+83614b78d8a937590fe905d3de9b4911 ./include/open.h
+717941c00c4e369241000ef70cf848f6 ./include/dnsresolv.h
+4ff0a37e7b614e0d80123782f706f54a ./include/buffer.h
+ecc1f8b2b13b77a8c016590618d73cc3 ./include/constmap.h
+58473a2f78e6e64cd1a67dd06ace92d9 ./include/str.h
+cfe01c7d37be0a17a492534faf2717b2 ./include/readclose.h
+d90310844d3fa6cfbab0b37b54170d92 ./include/logmsg.h
+4e9a6bd8f7f6884932d72a48d34301ef ./include/taia.h
+0f6816695dc713f927e09270696835a2 ./include/prot.h
+a66be1788f98dc795cceeb4b0f0c9bb2 ./include/ip.h
+9394aa5e8def374935aca019b9718a0a ./include/getoptb.h
+84583ba30e2ef88cfe8c53c7e13711ca ./include/ndelay.h
+ba79b96dcdcd50983e7328ee28b209ec ./include/socket_if.h
+be7d9294fe124d22abdd20204abcaa2f ./include/timeout.h
+4faf0a343fc405da9ccc93dd10b96d99 ./include/alloc.h
+c9a7b068f19c896891c30fd12bd078bb ./include/stralloc.h
+49a8521c05e6c06436637af85e3f7234 ./include/scan.h
+d40f94c976c1cadb575044a3ef965978 ./include/cdbread.h
+447646285c4a9d3d613307becac0f660 ./CONTENT.md
+ed9d85e6db765219dbed38de71d442a5 ./conf-build
+ceaf6033abb811be3a4e00c0abc725b7 ./compile
+25bb53af29cacae415052b795bc9dbbf ./man/socket_info.3
+13f3301b18e333666659b8e49864d389 ./man/wait.3
+2d2b4e9800b73983848581814065b074 ./man/error.3
+c83cc4663e122994ea65d269982df554 ./man/INSTALL
+6ee29d92e49bb6f91b2e8029c7a5ad04 ./man/case.3
+939ee90dbc06e46530bdebb76f7868b7 ./man/socket_if.3
+54e604b19d139b0c5b451b86c58802d5 ./man/cdbmake.3
+0f320b89031f14099389f245ff0082c4 ./man/pathexec.3
+419b2e143438a3351f6a21828823a367 ./man/fmt.3
+2f666bfc6cb2d755e4047be92853c4c9 ./man/alloc.3
+83ef36e87a0616a1f89c62ee10443d20 ./man/socket_udp.3
+88a7db7c3f87f6e55676a8bbea04bebb ./man/socket_tcp.3
+603252820735a0586d2473d60b5368ba ./man/socket_bind.3
+3a3834e729315537509ddfd06d76ecd7 ./man/dns.3
+06509120a17c0fdc1e74183e4fdeec6e ./man/socket_setup.3
+4eda1f156fe2348daebfbddf7a33c022 ./man/x.html
+2fa5bc7c6c042bb7c80c431bf5eac5b2 ./man/timeoutconn.3
+8aada587fbeaa6642b92f8259253e864 ./man/str.3
+63081eeab017fbf754f854010d8b1dc4 ./man/dnsstub.3
+c7fbce83d73180901bacfd42329a1961 ./man/socket_recv.3
+4705db96ec459124a7cac08c75621b43 ./man/iopause.3
+f838564ca05d7eb75e0f94601da0e247 ./man/scan.3
+0ffc1d509fec9b8432638ba2e244599e ./man/ip4.3
+ca40e8e64a68b1452629067f7f5ba82e ./man/taia.3
+d119ca0b17775f764fc4d0543c02255e ./man/buffer.3
+98b1a4adc93f98fa412a712e7d803e76 ./man/getln.3
+62f213c041e32f3b9c807e69b9c2b0a4 ./man/stralloc.3
+031965d5c617e7296b90f117b62db294 ./man/getoptb.3
+559b6ca0e4e488c961adfec91298cb57 ./man/socket_send.3
+480b6a5f03a5a07c122c0dd427b5f671 ./man/ip6.3
+c70003889aeb948b0083d6ecaf9a78fa ./man/timeout.3
+1aac69f1603735534b831b062a982b96 ./man/logmsg.3
+3927c67098f880846b6d71c8d69d63af ./man/byte.3
+c6115dbec98169a66af436ea929cc0bb ./man/fd.3
+7ede000da47f9d050b4a8b4a548c3fba ./man/socket_connect.3
+27c3a784e43a5ec37c2918014bcac3f8 ./man/env.3
+3308860b3c8b2032dff86d64aab332d0 ./man/constmap.3
+81a48e1258f4919861b7537a7759c0a5 ./man/cdbread.3
diff --git a/INSTALL.md b/INSTALL.md
new file mode 100644
index 0000000..a372829
--- /dev/null
+++ b/INSTALL.md
@@ -0,0 +1,116 @@
+fehQlibs installation
+=====================
+
+Configuration
+-------------
+
+Some build options can be configured through 'conf-build'.
+Read the comments in this file for more information.
+
+
+Building
+--------
+
+a) Static libs:
+
+Execute
+
+ $ make -C src
+
+which does the steps of './configure && make'.
+Don't forget to make sure that libs and headers will be found by the compiler/linker.
+
+In fehQlibs main directory you will find now
+
+- libdnsresolv.a
+- libqlibs.a
+
+ready for use.
+
+b) Shared objects libs:
+
+You can also build dynamic libaries for qlibs and dnsresolv. After
+
+ $ make -C src
+
+call
+
+ $ make -C src shared
+
+Additionally, the files
+
+- libdnsresolv.so
+- libqlibs.so
+
+are created.
+
+
+Deployment
+----------
+
+In case 'conf-build' has been customized to include the location of
+
+- HDRDIR
+- LIBDIR
+
+issue
+
+ $ make -C src install
+
+to deploy the include files and libs at the given location.
+By default, for the libs the parent directory is used.
+
+
+Cleaning
+--------
+
+Calling
+
+ $ make -C src clean
+
+will remove the object files in the src directories, but will
+leave the generated libraries as they are in the main directory.
+They will be overwritten on the next call of make.
+
+
+Verification
+------------
+
+Check the ELFCLASS of the generated binaries in the src directory while calling
+
+ $ file open.o
+
+They need to comply with your OS. See 'conf-build' for options.
+
+* Resulting libraries:
+
+The following libraries are generated:
+
+- qlibs.a - static basic [w/o DNS] lib (linked to libqlibs.a)
+- dnsresolv.a - static DNS resolver lib (linked to libdnsresolv.a)
+
+and perhaps
+
+- libqlibs.so - dynamic, position independent (PIC) 'shared object' lib
+- libdnsresolv.so - dynamic, position independent (PIC) 'shared object' lib
+
+These libs are of type ELF64 or ELF32 depending on the system.
+
+Use 'ar -t' to get the included members of the static libs.
+Use 'nm' to view the members and symbols of the libs.
+
+The shared object libs are known NOT not work on MacOS.
+You might need additional parameters in 'conf-build'.
+
+
+Man pages
+---------
+
+In the ./man directory the current man pages for the basic qlibs routines are included.
+Determine the current $mandir and (as root) install the man pages:
+
+ $ cp *.3 $mandir/man3/
+
+-----
+
+Updated: 20240920, Erwin Hoffmann
diff --git a/README.md b/README.md
index 0498792..a62eb90 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,4 @@
/*! \mainpage
-
qlibs - C library and headers based on "djb's libs" and libowfat
================================================================
@@ -30,82 +29,7 @@ See the README in the ./dnsstub directory for details.
Installation
------------
-Some build options can be configured through 'conf-build'.
-Read the comments in this file for more information.
-
-* Building:
-
-a) Static libs:
-
-Execute
-
- $ make
-
-which does the steps of './configure && make'.
-Don't forget to make sure that libs and headers will be found by the compiler/linker.
-For convenience, link the current version of fehQlibs to qlibs
-
- $ ln -s fehQlibs-XY qlibs
-
-b) Shared objects libs:
-
-You can also build dynamic libaries for qlibs and dnsresolv. After
-
- $ make
-
-call
-
- $ make shared
-
-* Deployment:
-
-In case conf-build has been customized to include the location of
-
-- HDRDIR
-- LIBDIR
-
-issue
-
- $ make install
-
-to deploy the include files and libs at the given location.
-By default, for the libs the parent directory is used.
-
-* Verification:
-
-Check the ELFCLASS of the generated binaries in the source directory while calling
-
- $ file open.o
-
-They need to comply with your OS. See 'conf-build' for options.
-
-* Resulting libraries:
-
-The following libraries are generated:
-
-- qlibs.a - static basic [w/o DNS] lib (linked to libqlibs.a)
-- dnsresolv.a - static DNS resolver lib (linked to libdnsresolv.a)
-
-and perhaps
-
-- libqlibs.so - dynamic, position independent (PIC) 'shared object' lib
-- libdnsresolv.so - dynamic, position independent (PIC) 'shared object' lib
-
-These libs are of type ELF64 or ELF32 depending on the system.
-
-Use 'ar -t' to get the included members of the static libs.
-Use 'nm' to view the members and symbols of the libs.
-
-The shared object libs are known NOT not work on MacOS.
-
-
-Man pages
----------
-
-In the ./man directory the current man pages for the basic qlibs routines are included.
-Determine the current $mandir and (as root) install the man pages:
-
- $ cp *.3 $mandir/man3/
+Check the INSTALL.md document.
Packaging
@@ -114,8 +38,8 @@ Packaging
The fehQlibs are incompatible with Gentoo's parallel compilation flag '-jN' for N > 1.
-Compilation
------------
+Compatibility
+-------------
Starting with version fehQlibs-15b, GCC 10 and Clang compatibility is provided,
which means ISO C conformance.
@@ -124,9 +48,15 @@ by the global (external) 'ipv4socket' variable are avoided.
stralloc.h is decoupled from genalloc.h (to be included separately).
This respects the GCC 10 compilation unit behavior.
+fehQlibs-25 provide compatibility with GCC 14 and Clang 18. Under the hood,
+the prototypes include now the correct types of arguments (signatures) required
+for function pointers. Some warning still exits; some are silly, others need to
+be tackled in forthcoming releases. This depends however on the development
+of the 'C' standard and the respective 'C' compilers.
+
-----
Updated: 20170329, Kai Peter
-Updated: 20220706, Erwin Hoffmann
+Updated: 20240804, Erwin Hoffmann
diff --git a/VERSION b/VERSION
index cf310ee..1aee5c2 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-fehQlibs-21
+fehQlibs-25
diff --git a/byte.c b/byte.c
deleted file mode 100644
index c9d6d23..0000000
--- a/byte.c
+++ /dev/null
@@ -1,99 +0,0 @@
-#include "byte.h"
-
-/**
- @file byte.c
- @author djb
- @brief byte manipulation functions
-*/
-
-unsigned int byte_chr(char *s,register unsigned int n,int c)
-{
- register char ch;
- register char *t;
-
- ch = c;
- t = s;
- for (;;) {
- if (!n) { break; } if (*t == ch) { break; } ++t; --n;
- if (!n) { break; } if (*t == ch) { break; } ++t; --n;
- if (!n) { break; } if (*t == ch) { break; } ++t; --n;
- if (!n) { break; } if (*t == ch) { break; } ++t; --n;
- }
- return t - s;
-}
-
-void byte_copy(register char *to,register unsigned int n,register char *from)
-{
- for (;;) {
- if (!n) { return; } *to++ = *from++; --n;
- if (!n) { return; } *to++ = *from++; --n;
- if (!n) { return; } *to++ = *from++; --n;
- if (!n) { return; } *to++ = *from++; --n;
- }
-}
-
-void byte_copyr(register char *to,register unsigned int n,register char *from)
-{
- to += n;
- from += n;
- for (;;) {
- if (!n) { return; } *--to = *--from; --n;
- if (!n) { return; } *--to = *--from; --n;
- if (!n) { return; } *--to = *--from; --n;
- if (!n) { return; } *--to = *--from; --n;
- }
-}
-
-int byte_diff(register char *s,register unsigned int n,register char *t)
-{
- for (;;) {
- if (!n) { return 0; } if (*s != *t) { break; } ++s; ++t; --n;
- if (!n) { return 0; } if (*s != *t) { break; } ++s; ++t; --n;
- if (!n) { return 0; } if (*s != *t) { break; } ++s; ++t; --n;
- if (!n) { return 0; } if (*s != *t) { break; } ++s; ++t; --n;
- }
- return ((int)(unsigned int)(unsigned char) *s)
- - ((int)(unsigned int)(unsigned char) *t);
-}
-
-unsigned int byte_rchr(char *s,register unsigned int n,int c)
-{
- register char ch;
- register char *t;
- register char *u;
-
- ch = c;
- t = s;
- u = 0;
- for (;;) {
- if (!n) { break; } if (*t == ch) { u = t; } ++t; --n;
- if (!n) { break; } if (*t == ch) { u = t; } ++t; --n;
- if (!n) { break; } if (*t == ch) { u = t; } ++t; --n;
- if (!n) { break; } if (*t == ch) { u = t; } ++t; --n;
- }
- if (!u) { u = t; }
- return u - s;
-}
-
-void byte_zero(char *s,register unsigned int n)
-{
- for (;;) {
- if (!n) { break; } *s++ = 0; --n;
- if (!n) { break; } *s++ = 0; --n;
- if (!n) { break; } *s++ = 0; --n;
- if (!n) { break; } *s++ = 0; --n;
- }
-}
-
-void byte_fill(char *s,register unsigned int n,const int c)
-{
- register char ch;
-
- ch = c;
- for (;;) {
- if (!n) { break; } *s++ = ch; --n;
- if (!n) { break; } *s++ = ch; --n;
- if (!n) { break; } *s++ = ch; --n;
- if (!n) { break; } *s++ = ch; --n;
- }
-}
diff --git a/conf-build b/conf-build
index a2428c4..66258c2 100644
--- a/conf-build
+++ b/conf-build
@@ -3,7 +3,7 @@
#
#********************************************************************************
# default compiler flags - usually this shouldn't be changed
-CFLAGS='-O2 -Iinclude -fPIC -Wall'
+CFLAGS='-O2 -Iinclude -fPIC -fwrapv -Wall'
# under OmniOS the binaries are build as 32 bit version; except enabling this:
#CFLAGS='-O2 -Iinclude -Wall -fPIC -m64'
diff --git a/configure b/configure
index 34785ac..47b0f08 100755
--- a/configure
+++ b/configure
@@ -2,7 +2,7 @@
#********************************************************************************
# Very simple configure script for qlibs
-. ./conf-build
+. ../conf-build
# Add $HDRDIR as include option to default $CFLAGS
[ "$HDRDIR" ] && CFLAGS="$CFLAGS -I$HDRDIR"
diff --git a/include/alloc.h b/include/alloc.h
index 56a4a52..daac8a5 100644
--- a/include/alloc.h
+++ b/include/alloc.h
@@ -1,9 +1,9 @@
#ifndef ALLOC_H
#define ALLOC_H
-extern /*@null@*//*@out@*/char *alloc();
-extern void alloc_free();
-extern int alloc_re();
+extern void *alloc(unsigned int);
+extern void alloc_free(void *);
+extern int alloc_re(void **, unsigned int, unsigned int);
/* use these names in the future */
#define qfree alloc_free
diff --git a/include/base64.h b/include/base64.h
index a9164c0..0f318c4 100644
--- a/include/base64.h
+++ b/include/base64.h
@@ -1,7 +1,9 @@
#ifndef BASE64_H
#define BASE64_H
-extern int b64decode();
-extern int b64encode();
+#include "stralloc.h"
+
+extern int b64decode(const unsigned char *in, int l, stralloc *out);
+extern int b64encode(stralloc *in, stralloc *out);
#endif
diff --git a/include/byte.h b/include/byte.h
index f437341..3ce3b31 100644
--- a/include/byte.h
+++ b/include/byte.h
@@ -2,19 +2,18 @@
#define BYTE_H
/**
- @file byte.h
- @author djb, feh
- @source s/qmail
- @comment no declaration of argument types; too many compiler errors
-*/
+ * @file byte.h
+ * @authors djb, feh, jmh
+ * @ref s/qmail
+ */
-extern unsigned int byte_chr();
-extern unsigned int byte_rchr();
-extern void byte_copy();
-extern void byte_copyr();
-extern int byte_diff();
-extern void byte_zero();
-extern void byte_fill();
+extern unsigned int byte_chr(char *, unsigned int, int);
+extern unsigned int byte_rchr(char *, unsigned int, int);
+extern void byte_copy(void *, unsigned int, const void *);
+extern void byte_copyr(void *, unsigned int, const void *);
+extern int byte_diff(const void *, unsigned int, const void *);
+extern void byte_zero(void *, unsigned int);
+extern void byte_fill(void *, unsigned int, int);
#define byte_equal(s,n,t) (!byte_diff((s),(n),(t)))
diff --git a/include/cdbmake.h b/include/cdbmake.h
index 9c20d2d..565e7ef 100644
--- a/include/cdbmake.h
+++ b/include/cdbmake.h
@@ -8,13 +8,16 @@
#define CDB_HPLIST 1000
-struct cdb_hp { uint32 h; uint32 p; } ;
+struct cdb_hp {
+ uint32 h;
+ uint32 p;
+};
struct cdb_hplist {
struct cdb_hp hp[CDB_HPLIST];
struct cdb_hplist *next;
int num;
-} ;
+};
struct cdb_make {
char bspace[8192];
@@ -28,7 +31,7 @@ struct cdb_make {
buffer b;
uint32 pos;
int fd;
-} ;
+};
extern int cdb_make_start(struct cdb_make *,int);
extern int cdb_make_addbegin(struct cdb_make *,unsigned int,unsigned int);
diff --git a/include/constmap.h b/include/constmap.h
index 750702e..26d945d 100644
--- a/include/constmap.h
+++ b/include/constmap.h
@@ -11,11 +11,11 @@ struct constmap {
int *next;
char **input;
int *inputlen;
-} ;
+};
int constmap_init(struct constmap *,char *,int,int);
int constmap_init_char(struct constmap *,char *,int,int,char);
-void constmap_free();
-char *constmap();
+void constmap_free(struct constmap *);
+char *constmap(struct constmap *,char *,int);
#endif
diff --git a/include/exit.h b/include/exit.h
index f74b741..e41b993 100644
--- a/include/exit.h
+++ b/include/exit.h
@@ -2,10 +2,10 @@
#define EXIT_H
/**
- @file exit.h
- @author djb, feh
- @source qmail
- @brief convenience header
+ * @file exit.h
+ * @author djb
+ * @ref qmail
+ * @brief convenience header
*/
extern void _exit(int);
diff --git a/include/fifo.h b/include/fifo.h
index 3c1bf68..d9a1b95 100644
--- a/include/fifo.h
+++ b/include/fifo.h
@@ -2,10 +2,10 @@
#define FIFO_H
/**
- @file fifo.h
- @author djb, feh
- @source s/qmail
-*/
+ * @file fifo.h
+ * @author djb
+ * @ref s/qmail
+ */
int fifo_make(char *,int);
diff --git a/include/fmt.h b/include/fmt.h
index 6e68d60..62eeefb 100644
--- a/include/fmt.h
+++ b/include/fmt.h
@@ -2,17 +2,17 @@
#define FMT_H
/**
- @file fmt.h
- @author djb, kp, feh
- @source qmail
- @brief conversion function declarations
- */
+ * @file fmt.h
+ * @authors djb, kp, feh
+ * @ref qmail
+ * @brief conversion function declarations
+ */
#define FMT_ULONG 40 /* enough space to hold 2^128 - 1 in decimal, plus \0 */
#define FMT_LEN ((char *) 0) /* convenient abbreviation */
-extern unsigned int fmt_str(char *,char *);
-extern unsigned int fmt_strn(char *,char *,unsigned int);
+extern unsigned int fmt_str(char *,const char *);
+extern unsigned int fmt_strn(char *,const char *,unsigned int);
extern unsigned int fmt_uint(char *,unsigned int);
extern unsigned int fmt_uint0(char *,unsigned int,unsigned int);
extern unsigned int fmt_ulong(char *,unsigned long);
diff --git a/include/genalloc.h b/include/genalloc.h
index ee489af..aaa17f3 100644
--- a/include/genalloc.h
+++ b/include/genalloc.h
@@ -48,7 +48,7 @@ int ta_ready(x,n) register ta *x; register unsigned int n; \
i = x->a; \
if (n > i) { \
x->a = base + n + (n >> 3); \
- if (alloc_re(&x->field,i * sizeof(type),x->a * sizeof(type))) return 1; \
+ if (alloc_re((void **)&x->field,i * sizeof(type),x->a * sizeof(type))) return 1; \
x->a = i; return 0; } \
return 1; } \
x->len = 0; \
@@ -61,7 +61,7 @@ int ta_rplus(x,n) register ta *x; register unsigned int n; \
i = x->a; n += x->len; \
if (n > i) { \
x->a = base + n + (n >> 3); \
- if (alloc_re(&x->field,i * sizeof(type),x->a * sizeof(type))) return 1; \
+ if (alloc_re((void **)&x->field,i * sizeof(type),x->a * sizeof(type))) return 1; \
x->a = i; return 0; } \
return 1; } \
x->len = 0; \
diff --git a/include/getoptb.h b/include/getoptb.h
index 0338a15..33e7cc4 100644
--- a/include/getoptb.h
+++ b/include/getoptb.h
@@ -2,6 +2,8 @@
#define BGETOPT_H
/*
+ * Revision 20240731, Erwin Hoffmann
+ * - added getoptb() prototype
* Revision 20160714, Kai Peter
* - consolidated 'sgetopt.h' and 'subgetopt.h' into '(b)getopt.h'
*/
@@ -15,6 +17,8 @@
#define SUBGETOPTDONE -1
+extern int getoptb(int,char **,char *);
+
extern int subgetopt(int,char **,char *);
extern char *subgetoptarg;
extern int subgetoptind;
diff --git a/include/lock.h b/include/lock.h
index 74df4c9..71c01fa 100644
--- a/include/lock.h
+++ b/include/lock.h
@@ -2,10 +2,10 @@
#define LOCK_H
/**
- @file lock.h
- @author djb, feh
- @source s/qmail
-*/
+ * @file lock.h
+ * @author djb
+ * @ref s/qmail
+ */
int lock_ex(int);
int lock_un(int);
diff --git a/include/ndelay.h b/include/ndelay.h
index 7a03a8d..4ef04c1 100644
--- a/include/ndelay.h
+++ b/include/ndelay.h
@@ -2,10 +2,10 @@
#define NDELAY_H
/**
- @brief ndelay.h
- @author djb, feh
- @source s/qmail
-*/
+ * @file ndelay.h
+ * @author djb
+ * @ref s/qmail
+ */
int ndelay_on(int);
int ndelay_off(int);
diff --git a/include/open.h b/include/open.h
index 428ebfb..2629a4d 100644
--- a/include/open.h
+++ b/include/open.h
@@ -2,10 +2,10 @@
#define OPEN_H
/**
- @file open.h
- @author djb, feh
- @source s/qmail
-*/
+ * @file open.h
+ * @authors djb, feh
+ * @ref s/qmail
+ */
int open_read(const char *);
int open_excl(const char *);
diff --git a/include/select.h b/include/select.h
index 646dd50..b2fe69e 100644
--- a/include/select.h
+++ b/include/select.h
@@ -8,6 +8,6 @@
#include <sys/select.h>
#endif
-extern int select();
+extern int select(int,fd_set *,fd_set *,fd_set *,struct timeval *);
#endif
diff --git a/include/sig.h b/include/sig.h
index 3efdd32..b4879b8 100644
--- a/include/sig.h
+++ b/include/sig.h
@@ -2,6 +2,7 @@
#define SIG_H
/*
+ * Revision 20240720, Erwin Hoffmann, jmh
* Revision 20160714, Kai Peter
* - updated some declarations no new(er) one's from ucspi-tcp-0.88
*/
@@ -14,10 +15,10 @@ extern int sig_hangup;
extern int sig_pipe;
extern int sig_term;
-extern void (*sig_defaulthandler)();
-extern void (*sig_ignorehandler)();
+extern void (*sig_defaulthandler)(int);
+extern void (*sig_ignorehandler)(int);
-extern void sig_catch(int,void (*)());
+extern void sig_catch(int,void (*)(int));
#define sig_ignore(s) (sig_catch((s),sig_ignorehandler))
#define sig_uncatch(s) (sig_catch((s),sig_defaulthandler))
@@ -29,35 +30,35 @@ extern void sig_pause(void);
extern void sig_dfl(int);
/* declaration of (net)qmail package (untouched) */
-extern void sig_miscignore();
-extern void sig_bugcatch();
-
-extern void sig_pipeignore();
-extern void sig_pipedefault();
-
-extern void sig_contblock();
-extern void sig_contunblock();
-extern void sig_contcatch();
-extern void sig_contdefault();
-
-extern void sig_termblock();
-extern void sig_termunblock();
-extern void sig_termcatch();
-extern void sig_termdefault();
-
-extern void sig_alarmblock();
-extern void sig_alarmunblock();
-extern void sig_alarmcatch();
-extern void sig_alarmdefault();
-
-extern void sig_childblock();
-extern void sig_childunblock();
-extern void sig_childcatch();
-extern void sig_childdefault();
-
-extern void sig_hangupblock();
-extern void sig_hangupunblock();
-extern void sig_hangupcatch();
-extern void sig_hangupdefault();
+extern void sig_miscignore(void);
+extern void sig_bugcatch(void (*)(int));
+
+extern void sig_pipeignore(void);
+extern void sig_pipedefault(void);
+
+extern void sig_contblock(void);
+extern void sig_contunblock(void);
+extern void sig_contcatch(void (*)(int));
+extern void sig_contdefault(void);
+
+extern void sig_termblock(void);
+extern void sig_termunblock(void);
+extern void sig_termcatch(void (*)(int));
+extern void sig_termdefault(void);
+
+extern void sig_alarmblock(void);
+extern void sig_alarmunblock(void);
+extern void sig_alarmcatch(void (*)(int));
+extern void sig_alarmdefault(void);
+
+extern void sig_childblock(void);
+extern void sig_childunblock(void);
+extern void sig_childcatch(void (*)(int));
+extern void sig_childdefault(void);
+
+extern void sig_hangupblock(void);
+extern void sig_hangupunblock(void);
+extern void sig_hangupcatch(void (*)(int));
+extern void sig_hangupdefault(void);
#endif
diff --git a/include/str.h b/include/str.h
index fe36d0b..4e3fc49 100644
--- a/include/str.h
+++ b/include/str.h
@@ -12,8 +12,8 @@ extern unsigned int str_copy(char *,const char *);
extern unsigned int str_copyb(char *,const char *,unsigned int);
extern int str_diff(const char *,const char *);
extern int str_diffn(const char *,const char *,unsigned int);
-//extern unsigned int str_len(char *); // --> this produces lot of warnings !!!
-extern unsigned int str_len();
+extern unsigned int str_len(const char *); // --> this produces lot of warnings !!!
+//extern unsigned int str_len();
extern unsigned int str_chr(const char *,int);
extern unsigned int str_rchr(const char *,int);
extern int str_start(const char *,const char *);
diff --git a/include/uint_t.h b/include/uint_t.h
index 84eb06e..aec9ed5 100644
--- a/include/uint_t.h
+++ b/include/uint_t.h
@@ -1,12 +1,12 @@
#include <stdint.h>
/**
- @file uint_t.h
- @author djb, kp, feh
- @source qmail, djbdns6
- @brief additional types and pack routines
- @brief define basic integer types and size through <stdint.h>
-*/
+ * @file uint_t.h
+ * @authors djb, kp, feh
+ * @ref qmail, djbdns6
+ * @brief additional types and pack routines
+ * @brief define basic integer types and size through <stdint.h>
+ */
#ifndef UINT8_H
#define UINT8_H
@@ -17,6 +17,10 @@ typedef uint8_t uint8;
typedef unsigned char uint8;
#endif
+extern void uint8_pack(char *,uint8);
+extern void uint8_pack_big(char *,uint8);
+extern void uint8_unpack(char *,uint8 *);
+extern void uint8_unpack_big(char *,uint8 *);
#endif
#ifndef UINT16_H
@@ -24,10 +28,10 @@ typedef unsigned char uint8;
typedef uint16_t uint16;
-extern void uint16_pack(char *,uint16);
-extern void uint16_pack_big(char *,uint16);
-extern void uint16_unpack(char *,uint16 *);
-extern void uint16_unpack_big(char *,uint16 *);
+extern void uint16_pack(char [16],uint16);
+extern void uint16_pack_big(char [16],uint16);
+extern void uint16_unpack(char [16],uint16 *);
+extern void uint16_unpack_big(char [16],uint16 *);
#endif
#ifndef UINT32_H
diff --git a/include/wait.h b/include/wait.h
index f7cfc60..846b838 100644
--- a/include/wait.h
+++ b/include/wait.h
@@ -2,10 +2,10 @@
#define WAIT_H
/**
- @file wait.h
- @author djb
- @source s/qmail
-*/
+ * @file wait.h
+ * @author djb
+ * @ref s/qmail
+ */
int wait_pid(int *,int);
int wait_nohang(int *);
diff --git a/install b/install
index ef58eaa..5401000 100755
--- a/install
+++ b/install
@@ -1,9 +1,11 @@
#!/bin/sh
-. ./conf-build
+# We are in ./src:
+
+. ../conf-build
install_libs() { cp *.a $OFILES "$LIBDIR" ; }
-install_hdrs() { cp include/*.h "$HDRDIR" ; }
+install_hdrs() { cp ../include/*.h "$HDRDIR" ; }
echo -n "Installing qlibs ..."
mkdir -p "$LIBDIR" "$HDRDIR" 2>/dev/null
diff --git a/man/buffer.3 b/man/buffer.3
index 2d4d0d2..331c32e 100644
--- a/man/buffer.3
+++ b/man/buffer.3
@@ -31,9 +31,9 @@ int \fBbuffer_flush\fP(buffer *\fIb\fR);
.br
int \fBbuffer_copy\fP(buffer *\fIbo\fR,buffer *\fIbi\fR);
-int \fBbuffer_unixread\fP(int \fIfd\fR,char *\fIbuf\fR,size_t \fIlen\fR);
+ssize_t \fBbuffer_unixread\fP(int \fIfd\fR,char *\fIbuf\fR,size_t \fIlen\fR);
.br
-int \fBbuffer_unixwrite\fP(int \fIfd\fR,char *\fIbuf\fR,size_t \fIlen\fR);
+ssize_t \fBbuffer_unixwrite\fP(int \fIfd\fR,char *\fIbuf\fR,size_t \fIlen\fR);
.SH DESCRIPTION
.B buffer.h
describes a generic buffer interface that can be used for
@@ -111,13 +111,17 @@ fills all available space with data before calling
copies one buffer to other one.
The output buffer needs to have at least the
preallocated size of the input buffer.
+
.B buffer_unixread
and
.B buffer_unixwrite
perform the same operation like standard Unix
.B read
or
-.BR write.
+.B write
+however provide the function return signature
+.IR ssize_t
+required to be used with the buffer interface.
.SH MACROS
Apart from this basic usage, some helpful macro
definitions are provided:
diff --git a/man/getln.3 b/man/getln.3
index bb4ae7c..01f8b89 100644
--- a/man/getln.3
+++ b/man/getln.3
@@ -4,11 +4,11 @@ getln \ - read one line of data
.SH SYNTAX
.B #include \(dqgetln.h\(dq
-int \fBgetln\fP(&buffer_0,&sa,&match,sep);
+int \fBgetln\fP(&buf,&sa,&match,sep);
.br
-int \fBgetln2\fP(&buffer_0,&sa,&cont,&clen,sep);
+int \fBgetln2\fP(&buf,&sa,&cont,&clen,sep);
-buffer \fIbuffer_0\fR;
+buffer \fIbuf\fR;
.br
stralloc \fIsa\fR;
.br
@@ -22,7 +22,7 @@ unsigned int \fIclen\fR;
.SH DESCRIPTION
.B getln
reads a line of characters, terminated by a sep character, from
-.IR buffer_0 .
+.IR buf .
It returns the line in
.I sa
and sets match to
@@ -39,18 +39,18 @@ and sets match to
.B getln2
reads a line of characters, terminated by a
.I sep
-character, from
-.IR buffer_0 .
+character from
+.IR buf .
The line is returned in two pieces. The first piece is stored in
.IR sa .
The second piece is
.IR cont ,
a pointer to
.I clen
-characters inside the
-.I buffer_0
-buffer. The second piece must be copied somewhere else before
-.I ss
+characters inside
+.IR buf .
+The second piece must be copied somewhere else before
+.I sa
is used again.
If
.B getln2
@@ -64,12 +64,19 @@ and does not set
.IR cont .
It puts the partial line into
.IR sa.
+.SH "BUFFER"
+.I buf
+can be a pre-allocated buffer like
+.I buffer_0
+reading from
+.I STDIN
+or any other explicitly generated buffer on a given file descriptor.
.SH "RETURN CODES"
.B getln
normally returns
.IR 0 .
If it runs out of memory, or encounters an error from
-.IR ss ,
+.IR sa ,
it returns
.IR -1 ,
setting
@@ -80,17 +87,12 @@ appropriately.
normally returns
.IR 0 .
If it runs out of memory, or encounters an error from
-.IR ss ,
+.IR sa ,
it returns
.IR -1 ,
setting
.I errno
appropriately.
-.SH NOTE
-The input buffer
-.I buffer_0
-is already pre-allocated.
-It can be used without initialization as synonym for STDIN.
.SH CREDITS
The
.B getln
@@ -99,4 +101,4 @@ and
man page were taken from Bruce Guenther and
originally published by Dan Bernstein for qmail-1.03.
.SH SEE ALSO
-stralloc(3)
+stralloc(3), buffer(3).
diff --git a/man/getoptb.3 b/man/getoptb.3
index f3e329b..1c5522a 100644
--- a/man/getoptb.3
+++ b/man/getoptb.3
@@ -5,7 +5,7 @@ getoptb \- get option character from command line
.B #include \(dqgetoptb.h\(dq
.SH DESCRIPTION
Qlib's
-.B getopt
+.B getoptb
is a replacement for the standard Unix
.B getopt
library, based on
diff --git a/sig.c b/sig.c
deleted file mode 100644
index 0963948..0000000
--- a/sig.c
+++ /dev/null
@@ -1,110 +0,0 @@
-#include <signal.h>
-#include "sig.h"
-
-/**
- @file sig.c
- @author djb
- @source qmail
- @brief signal handling functions
-*/
-
-void sig_alarmblock() { sig_block(SIGALRM); }
-void sig_alarmunblock() { sig_unblock(SIGALRM); }
-void sig_alarmcatch(f) void (*f)(); { sig_catch(SIGALRM,f); }
-void sig_alarmdefault() { sig_catch(SIGALRM,SIG_DFL); }
-int sig_alarm = SIGALRM;
-
-void sig_block(int sig)
-{
- sigset_t ss;
- sigemptyset(&ss);
- sigaddset(&ss,sig);
- sigprocmask(SIG_BLOCK,&ss,(sigset_t *) 0);
-}
-
-void sig_unblock(int sig)
-{
- sigset_t ss;
- sigemptyset(&ss);
- sigaddset(&ss,sig);
- sigprocmask(SIG_UNBLOCK,&ss,(sigset_t *) 0);
-}
-
-void sig_blocknone()
-{
- sigset_t ss;
- sigemptyset(&ss);
- sigprocmask(SIG_SETMASK,&ss,(sigset_t *) 0);
-}
-
-void sig_catch(int sig,void (*f)())
-{
- struct sigaction sa;
- sa.sa_handler = f;
- sa.sa_flags = 0;
- sigemptyset(&sa.sa_mask);
- sigaction(sig,&sa,(struct sigaction *) 0);
-}
-
-void sig_pause()
-{
- sigset_t ss;
- sigemptyset(&ss);
- sigsuspend(&ss);
-}
-
-void sig_pipeignore() { sig_catch(SIGPIPE,SIG_IGN); }
-void sig_pipedefault() { sig_catch(SIGPIPE,SIG_DFL); }
-int sig_pipe = SIGPIPE;
-
-void sig_childblock() { sig_block(SIGCHLD); }
-void sig_childunblock() { sig_unblock(SIGCHLD); }
-void sig_childcatch(f) void (*f)(); { sig_catch(SIGCHLD,f); }
-void sig_childdefault() { sig_catch(SIGCHLD,SIG_DFL); }
-int sig_child = SIGCHLD;
-
-void sig_hangupblock() { sig_block(SIGHUP); }
-void sig_hangupunblock() { sig_unblock(SIGHUP); }
-void sig_hangupcatch(f) void (*f)(); { sig_catch(SIGHUP,f); }
-void sig_hangupdefault() { sig_catch(SIGHUP,SIG_DFL); }
-int sig_hangup = SIGHUP;
-
-void sig_termblock() { sig_block(SIGTERM); }
-void sig_termunblock() { sig_unblock(SIGTERM); }
-void sig_termcatch(f) void (*f)(); { sig_catch(SIGTERM,f); }
-void sig_termdefault() { sig_catch(SIGTERM,SIG_DFL); }
-int sig_term = SIGTERM;
-
-void sig_bugcatch(void (*f)())
-{
- sig_catch(SIGILL,f);
- sig_catch(SIGABRT,f);
- sig_catch(SIGFPE,f);
- sig_catch(SIGBUS,f);
- sig_catch(SIGSEGV,f);
-#ifdef SIGSYS
- sig_catch(SIGSYS,f);
-#endif
-#ifdef SIGEMT
- sig_catch(SIGEMT,f);
-#endif
-}
-void (*sig_defaulthandler)() = SIG_DFL;
-
-void sig_miscignore()
-{
- sig_catch(SIGVTALRM,SIG_IGN);
- sig_catch(SIGPROF,SIG_IGN);
- sig_catch(SIGQUIT,SIG_IGN);
- sig_catch(SIGINT,SIG_IGN);
- sig_catch(SIGHUP,SIG_IGN);
-#ifdef SIGXCPU
- sig_catch(SIGXCPU,SIG_IGN);
-#endif
-#ifdef SIGXFSZ
- sig_catch(SIGXFSZ,SIG_IGN);
-#endif
-}
-void (*sig_ignorehandler)() = SIG_IGN;
-
-int sig_cont = SIGCONT;
diff --git a/Makefile b/src/Makefile
index 8426968..8ca5d6e 100644
--- a/Makefile
+++ b/src/Makefile
@@ -3,21 +3,21 @@
SHELL=/bin/sh
# static flags - DO NOT EDIT!
-CCFLAGS=-Iinclude
+CCFLAGS=-I../include
SRCS=*.c
OBJS=*.o
-COMPILE=./compile
-MAKELIB=./makelib
-SHAREDLIB=./sharedlib
+COMPILE=../compile
+MAKELIB=../makelib
+SHAREDLIB=../sharedlib
default: clean check libs
check:
- @[ -f $(COMPILE) ] && [ -f $(MAKELIB) ] || ./configure
+ @[ -f $(COMPILE) ] && [ -f $(MAKELIB) ] || ../configure
clean:
- @echo -n Cleaning up libs ...
+ @echo "Cleaning up libs ..."
@rm -f `cat TARGETS`
@cd dnsstub ; make -s clean ; cd ..
@echo " done!"
@@ -36,22 +36,26 @@ obj:
install: setup
setup:
- @./install
+ @../install
shared: $(COMPILE) $(SHAREDLIB) $(OBJS) ./dnsstub/$(OBJS)
- @echo Building shared qlibs ...
+ @echo "Building shared qlibs ..."
$(SHAREDLIB) $(LDFLAGS) $(OBJS) -o libqlibs.so
$(SHAREDLIB) $(LDFLAGS) ./dnsstub/$(OBJS) -o libdnsresolv.so
+ @ln -f libqlibs.so ../libqlibs.so
+ @ln -f libdnsresolv.so ../libdnsresolv.so
+
qlibs.a: obj socket.a
$(MAKELIB) $(LDFLAGS) qlibs.a *.o
- ln -sf qlibs.a libqlibs.a
+ @echo "Creating libqlibs ... "
+ @ln -f qlibs.a ../libqlibs.a
-dnsresolv.a:
+dnsresolv.a:
@echo "Building @dnsresolv lib ..."
@cd dnsstub ; make
@cp dnsstub/dnsresolv.a dnsresolv.a
- ln -sf dnsresolv.a libdnsresolv.a
+ @ln -f dnsresolv.a ../libdnsresolv.a
socket.a: ip.a
@echo "Building socket lib ..."
diff --git a/src/TARGETS b/src/TARGETS
new file mode 100644
index 0000000..df6d6ee
--- /dev/null
+++ b/src/TARGETS
@@ -0,0 +1,79 @@
+alloc.a
+alloc.o
+base64.o
+buffer.a
+buffer.o
+byte.o
+case.a
+case.o
+cdb.a
+cdbmake.o
+cdbread.o
+constmap.a
+constmap.o
+compile
+dnsresolv.a
+env.a
+env.o
+errstr.o
+fd.a
+fd.o
+fmt.o
+fs.a
+getln.a
+getln.o
+getopt.a
+getoptb.o
+iopause.o
+ip.a
+ip4.o
+ip6.o
+libdnsresolv.a
+libqlibs.a
+lock.a
+lock.o
+logmsg.a
+logmsg.o
+makelib
+ndelay.a
+ndelay.o
+open.a
+open.o
+pathexec.o
+prot.o
+qlibs.a
+readclose.o
+scan.o
+seek.a
+seek.o
+sig.a
+sig.o
+socket.a
+socket_bind.o
+socket_connect.o
+socket_if.o
+socket_info.o
+socket_recv.o
+socket_send.o
+socket_setup.o
+socket_tcp.o
+socket_udp.o
+str.a
+str.o
+stralloc.a
+stralloc.o
+sysmsg.o
+tai.o
+taia.o
+time.a
+timeout.o
+timeoutconn.o
+uint128p.o
+uint16p.o
+uint32p.o
+uint64p.o
+uint8p.o
+wait.a
+wait.o
+libdnsresolv.so
+libqlibs.so
diff --git a/alloc.c b/src/alloc.c
index 8ec0a7e..d6151ec 100644
--- a/alloc.c
+++ b/src/alloc.c
@@ -6,13 +6,26 @@
#define ALIGNMENT 16 /* XXX: assuming that this alignment is enough */
#define SPACE 4096 /* must be multiple of ALIGNMENT */
+#define space ((char *)realspace)
+
+/**
+ * @file alloc.c
+ * @authors djb, feh, jmh
+ * @ref qmail
+ * @brief Generic allocation of heap memory
+ */
+
+typedef union {
+ char irrelevant[ALIGNMENT];
+ double d;
+} aligned;
-typedef union { char irrelevant[ALIGNMENT]; double d; } aligned;
static aligned realspace[SPACE / ALIGNMENT];
-#define space ((char *) realspace)
static unsigned int avail = SPACE; /* multiple of ALIGNMENT; 0<=avail<=SPACE */
-/*@null@*//*@out@*/char *alloc(unsigned int n) {
+// /*@null@*//*@out@*/char *alloc(unsigned int n) -- old style
+void *alloc(unsigned int n)
+{
char *x;
/* Guninski exploit + patch from Qualys (CVE-2005-1513) */
@@ -29,7 +42,7 @@ static unsigned int avail = SPACE; /* multiple of ALIGNMENT; 0<=avail<=SPACE */
return x;
}
-void alloc_free(char *x)
+void alloc_free(void *x)
{
if (x >= space)
if (x < space + SPACE)
@@ -37,7 +50,7 @@ void alloc_free(char *x)
free(x);
}
-int alloc_re(char **x,unsigned int m,unsigned int n)
+int alloc_re(void **x,unsigned int m,unsigned int n)
{
char *y;
diff --git a/base64.c b/src/base64.c
index 986201e..d82ecdf 100644
--- a/base64.c
+++ b/src/base64.c
@@ -3,13 +3,12 @@
#include "str.h"
/**
- @file base64.c
- @author unkown
- @source unknown
- @brief base64 en+decoding of strings
-*/
+ * @file base64.c
+ * @author unkown
+ * @brief base64 en+decoding of strings
+ */
-static char *b64alpha =
+static const char *b64alpha =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
#define B64PAD '='
@@ -31,7 +30,7 @@ int b64decode(const unsigned char *in,int l,stralloc *out) /* not null terminat
while (in[l-1] == B64PAD) {
p ++;
- l--;
+ l--;
}
n = (l + p) / 4;
diff --git a/buffer.c b/src/buffer.c
index 92d72b1..06e3857 100644
--- a/buffer.c
+++ b/src/buffer.c
@@ -5,10 +5,10 @@
#include "error.h"
/**
- @file buffer.c
- @author djb
- @brief input/output routines
-*/
+ * @file buffer.c
+ * @author djb
+ * @brief input/output routines
+ */
void buffer_init(buffer *s,ssize_t (*op)(),int fd,char *buf,size_t len)
{
@@ -19,22 +19,32 @@ void buffer_init(buffer *s,ssize_t (*op)(),int fd,char *buf,size_t len)
s->n = len;
}
-ssize_t buffer_0_read(int fd,char *buf,size_t len)
+static ssize_t buffer_0_read(int fd,char *buf,size_t len)
{
if (buffer_flush(buffer_1) == -1) return -1;
return read(fd,buf,len);
}
+ssize_t buffer_unixread(int fd,char *buf,size_t len)
+{
+ return (ssize_t) read(fd,buf,len);
+}
+
+ssize_t buffer_unixwrite(int fd,char *buf,size_t len)
+{
+ return (ssize_t) write(fd,buf,len);
+}
+
char buffer_0_space[BUFFER_INSIZE];
static buffer it0 = BUFFER_INIT(buffer_0_read,0,buffer_0_space,sizeof(buffer_0_space));
buffer *buffer_0 = &it0;
char buffer_1_space[BUFFER_OUTSIZE];
-static buffer it1 = BUFFER_INIT(write,1,buffer_1_space,sizeof(buffer_1_space));
+static buffer it1 = BUFFER_INIT(buffer_unixwrite,1,buffer_1_space,sizeof(buffer_1_space));
buffer *buffer_1 = &it1;
char buffer_2_space[BUFFER_OUTSIZE];
-static buffer it2 = BUFFER_INIT(write,2,buffer_2_space,sizeof(buffer_2_space));
+static buffer it2 = BUFFER_INIT(buffer_unixwrite,2,buffer_2_space,sizeof(buffer_2_space));
buffer *buffer_2 = &it2;
char buffer_0_small[BUFFER_SMALL];
@@ -42,23 +52,13 @@ static buffer is0 = BUFFER_INIT(buffer_0_read,0,buffer_0_small,sizeof(buffer_0_s
buffer *buffer_0small = &is0;
char buffer_1_small[BUFFER_SMALL];
-static buffer is1 = BUFFER_INIT(write,1,buffer_1_small,sizeof(buffer_1_small));
+static buffer is1 = BUFFER_INIT(buffer_unixwrite,1,buffer_1_small,sizeof(buffer_1_small));
buffer *buffer_1small = &is1;
char buffer_2_small[BUFFER_SMALL];
-static buffer is2 = BUFFER_INIT(write,2,buffer_2_small,sizeof(buffer_2_small));
+static buffer is2 = BUFFER_INIT(buffer_unixwrite,2,buffer_2_small,sizeof(buffer_2_small));
buffer *buffer_2small = &is2;
-ssize_t buffer_unixread(int fd,char *buf,size_t len)
-{
- return read(fd,buf,len);
-}
-
-ssize_t buffer_unixwrite(int fd,char *buf,size_t len)
-{
- return write(fd,buf,len);
-}
-
int buffer_copy(buffer *bout,buffer *bin)
{
int n;
diff --git a/src/byte.c b/src/byte.c
new file mode 100644
index 0000000..c6ac6b0
--- /dev/null
+++ b/src/byte.c
@@ -0,0 +1,82 @@
+#include "byte.h"
+
+/**
+ * @file byte.c
+ * @author djb
+ * @brief byte manipulation functions
+ */
+
+unsigned int byte_chr(char *s,unsigned int n,int c)
+{
+ char ch = c;
+ char *t = s;
+
+ for (;;) {
+ if (!n) { break; } if (*t == ch) { break; } ++t; --n;
+ }
+ return t - s;
+}
+
+void byte_copy(void *to,unsigned int n,const void *from)
+{
+ char *out = to; // share same address
+ const char *in = from; // one byte
+
+ for (;;) {
+ if (!n) { return; } *out++ = *in++; --n;
+ }
+}
+
+void byte_copyr(void *to,unsigned int n,const void *from)
+{
+ char *out = to + n;
+ const char *in = from + n;
+
+ for (;;) {
+ if (!n) { return; } *--out = *--in; --n;
+ }
+}
+
+int byte_diff(const void *s,unsigned int n,const void *t)
+{
+ const char *a = s;
+ const char *b = t;
+
+ for (;;) {
+ if (!n) { return 0; } if (*a != *b) { break; } ++a; ++b; --n;
+ }
+ return ((int)(unsigned int)(unsigned char) *a)
+ - ((int)(unsigned int)(unsigned char) *b);
+}
+
+unsigned int byte_rchr(char *s,unsigned int n,int c)
+{
+ char ch = c;
+ char *t = s;
+ char *u = 0;
+
+ for (;;) {
+ if (!n) { break; } if (*t == ch) { u = t; } ++t; --n;
+ }
+ if (!u) { u = t; }
+ return u - s;
+}
+
+void byte_zero(void *s,unsigned int n)
+{
+ char *out = s;
+
+ for (;;) {
+ if (!n) { break; } *out++ = 0; --n;
+ }
+}
+
+void byte_fill(void *to,unsigned int n,int c)
+{
+ char *s = to;
+ char ch = c;
+
+ for (;;) {
+ if (!n) { break; } *s++ = ch; --n;
+ }
+}
diff --git a/case.c b/src/case.c
index 47eb8ed..b3aba2f 100644
--- a/case.c
+++ b/src/case.c
@@ -2,15 +2,15 @@
#include "str.h"
/**
- @file case.c
- @author djb
- @brief string comparison and helper functions; case insensitive
-*/
+ * @file case.c
+ * @author djb
+ * @brief string comparison and helper functions; case insensitive
+ */
-int case_diffb(register char *s,unsigned int len,register char *t)
+int case_diffb(char *s,unsigned int len,char *t)
{
- register unsigned char x;
- register unsigned char y;
+ unsigned char x;
+ unsigned char y;
while (len > 0) {
--len;
@@ -24,10 +24,10 @@ int case_diffb(register char *s,unsigned int len,register char *t)
return 0;
}
-int case_diffs(register char *s,register char *t)
+int case_diffs(char *s,char *t)
{
- register unsigned char x;
- register unsigned char y;
+ unsigned char x;
+ unsigned char y;
for (;;) {
x = *s++ - 'A';
@@ -40,10 +40,10 @@ int case_diffs(register char *s,register char *t)
return ((int)(unsigned int) x) - ((int)(unsigned int) y);
}
-int case_diffrs(register char *s,register char *t)
+int case_diffrs(char *s,char *t)
{
- register unsigned char x = 0;
- register unsigned char y = 0;
+ unsigned char x = 0;
+ unsigned char y = 0;
unsigned int lens = str_len(s);
unsigned int lent = str_len(t);
@@ -101,10 +101,10 @@ void case_uppers(char *s)
}
}
-int case_startb(register char *s,unsigned int len,register char *t)
+int case_startb(char *s,unsigned int len,char *t)
{
- register unsigned char x;
- register unsigned char y;
+ unsigned char x;
+ unsigned char y;
for (;;) {
y = *t++ - 'A';
@@ -118,10 +118,10 @@ int case_startb(register char *s,unsigned int len,register char *t)
}
}
-int case_starts(register char *s,register char *t)
+int case_starts(char *s,char *t)
{
- register unsigned char x;
- register unsigned char y;
+ unsigned char x;
+ unsigned char y;
for (;;) {
x = *s++ - 'A';
diff --git a/cdbmake.c b/src/cdbmake.c
index 28e170c..54372c1 100644
--- a/cdbmake.c
+++ b/src/cdbmake.c
@@ -6,11 +6,11 @@
#include "cdbmake.h"
/**
- @file cdbmake.c
- @author djb
- @source ucspi-tcp
- @brief constant data base (cdb) generation
-*/
+ * @file cdbmake.c
+ * @author djb
+ * @ref ucspi-tcp
+ * @brief constant data base (cdb) generation
+ */
int cdb_make_start(struct cdb_make *c,int fd)
{
diff --git a/cdbread.c b/src/cdbread.c
index c8ffa42..8387591 100644
--- a/cdbread.c
+++ b/src/cdbread.c
@@ -8,11 +8,11 @@
#include "cdbread.h"
/**
- @file cdbread.c
- @author djb
- @source ucspi-tcp, fastforward
- @brief read entries from a cdb
-*/
+ * @file cdbread.c
+ * @author djb
+ * @ref ucspi-tcp, fastforward
+ * @brief read entries from a cdb
+ */
uint32 cdb_unpack(unsigned char *buf)
{
diff --git a/constmap.c b/src/constmap.c
index ecd5a92..4b2eb87 100644
--- a/constmap.c
+++ b/src/constmap.c
@@ -2,6 +2,15 @@
#include "alloc.h"
#include "case.h"
+/**
+ * @file constmap.c
+ * @author djb
+ * @ref qmail
+ * @brief constant hash table
+ * @brief Attention! constmap is both function and struct
+ */
+
+
static constmap_hash hash(char *s,int len)
{
unsigned char ch;
diff --git a/dnsstub/Makefile b/src/dnsstub/Makefile
index 6c3bab3..c4ca883 100644
--- a/dnsstub/Makefile
+++ b/src/dnsstub/Makefile
@@ -1,12 +1,13 @@
+# dnsstub Makefile
-COMPILE=../compile
-MAKELIB=../makelib
-CCFLAGS=-I../include
+COMPILE=../../compile
+MAKELIB=../../makelib
+CCFLAGS=-I../../include
default: clean check dnsresolv.a
check:
- @[ -f $(COMPILE) ] && [ -f $(MAKELIB) ] || ( cd .. ; ./configure ; )
+ @[ -f $(COMPILE) ] && [ -f $(MAKELIB) ] || ( cd ../../ ; ./configure ; )
clean:
rm -f `cat TARGETS`
diff --git a/dnsstub/README.md b/src/dnsstub/README.md
index 95cd11c..f2543f3 100644
--- a/dnsstub/README.md
+++ b/src/dnsstub/README.md
@@ -1,7 +1,5 @@
-/*! \mainpage
-
-Stub Resolver
-=============
+DJBDNS Stub Resolver
+====================
Simple DJBDNS stub-resolver based on 'djbdns-1.05(IPv6)' allowing for each
calling application individually to include up to 16 DNSCACHEIP(s)
diff --git a/dnsstub/TARGETS b/src/dnsstub/TARGETS
index 62f40be..62f40be 100644
--- a/dnsstub/TARGETS
+++ b/src/dnsstub/TARGETS
diff --git a/dnsstub/dns_cname.c b/src/dnsstub/dns_cname.c
index 408949a..3694bb0 100644
--- a/dnsstub/dns_cname.c
+++ b/src/dnsstub/dns_cname.c
@@ -6,9 +6,9 @@
#include "dnsresolv.h"
/**
- @file dns_cname.c
- @author feh
- @brief DNS cname lookup
+ * @file dns_cname.c
+ * @author feh
+ * @brief DNS cname lookup
*/
static char *q = 0;
diff --git a/dnsstub/dns_dfd.c b/src/dnsstub/dns_dfd.c
index 756a1f8..cf3ca61 100644
--- a/dnsstub/dns_dfd.c
+++ b/src/dnsstub/dns_dfd.c
@@ -4,11 +4,11 @@
#include "dnsresolv.h"
/**
- @file dns_dfd.c
- @author djb
- @source ucspi-tcp
- @brief domain name qualification (domain from dot)
-*/
+ * @file dns_dfd.c
+ * @author djb
+ * @ref ucspi-tcp
+ * @brief domain name qualification (domain from dot)
+ */
int dns_domain_fromdot(char **out,const char *buf,unsigned int n)
{
diff --git a/dnsstub/dns_domain.c b/src/dnsstub/dns_domain.c
index 654a827..44de835 100644
--- a/dnsstub/dns_domain.c
+++ b/src/dnsstub/dns_domain.c
@@ -4,11 +4,11 @@
#include "dnsresolv.h"
/**
- @file dns_domain.c
- @author djb
- @source ucspi-tcp
- @brief domain qualification
-*/
+ * @file dns_domain.c
+ * @author djb
+ * @ref ucspi-tcp
+ * @brief domain qualification
+ */
unsigned int dns_domain_length(const char *dn)
{
diff --git a/dnsstub/dns_dtda.c b/src/dnsstub/dns_dtda.c
index 38358a2..f20ace2 100644
--- a/dnsstub/dns_dtda.c
+++ b/src/dnsstub/dns_dtda.c
@@ -2,11 +2,11 @@
#include "dnsresolv.h"
/**
- @file dns_dtda.c
- @author djb
- @source ucspi-tcp
- @brief domain to dot append
-*/
+ * @file dns_dtda.c
+ * @author djb
+ * @ref ucspi-tcp
+ * @brief domain to dot append
+ */
int dns_domain_todot_cat(stralloc *out,const char *d)
{
diff --git a/dnsstub/dns_ip.c b/src/dnsstub/dns_ip.c
index f89728c..74bc24f 100644
--- a/dnsstub/dns_ip.c
+++ b/src/dnsstub/dns_ip.c
@@ -5,11 +5,11 @@
#include "dnsresolv.h"
/**
- @file dns_ip.c
- @author djb, fefe, feh
- @source ucspi-tcp6
- @brief DNS IP query
-*/
+ * @file dns_ip.c
+ * @authors djb, fefe, feh
+ * @ref ucspi-tcp6
+ * @brief DNS IP query
+ */
static char *q = 0;
diff --git a/dnsstub/dns_ipq.c b/src/dnsstub/dns_ipq.c
index 26c3818..f298128 100644
--- a/dnsstub/dns_ipq.c
+++ b/src/dnsstub/dns_ipq.c
@@ -7,15 +7,14 @@
#include "ip.h"
/**
- @file dns_ipq.c
- @author djb, feh
- @source ucspi-tcp
- @brief DNS hostname qualification for ipv4 and ipv6
-*/
-
-/**
- @fn int doit -> @return number of added chars to name
-*/
+ * @file dns_ipq.c
+ * @authors djb, feh
+ * @ref ucspi-tcp
+ * @brief DNS hostname qualification for ipv4 and ipv6
+ */
+
+/** @fn int doit -> @return number of added chars to name */
+
static int doit(stralloc *work,const char *rule)
{
char ch;
diff --git a/dnsstub/dns_mx.c b/src/dnsstub/dns_mx.c
index c0845ef..ab321ec 100644
--- a/dnsstub/dns_mx.c
+++ b/src/dnsstub/dns_mx.c
@@ -4,12 +4,12 @@
#include "dnsresolv.h"
/**
- @file dns_mx.c
- @author djb
- @source qmail
- @brief dns MX query
- @param (on output) stralloc out
-*/
+ * @file dns_mx.c
+ * @author djb
+ * @ref qmail
+ * @brief dns MX query
+ * @param (on output) stralloc out
+ */
static char *q = 0;
diff --git a/dnsstub/dns_name.c b/src/dnsstub/dns_name.c
index 0723a8f..a53b5a5 100644
--- a/dnsstub/dns_name.c
+++ b/src/dnsstub/dns_name.c
@@ -5,11 +5,11 @@
#include "dnsresolv.h"
/**
- @file dns_name.c
- @author djb, fefe, feh
- @source ucspi-tcp
- @brief DNS name query (ptr)
-*/
+ * @file dns_name.c
+ * @authors djb, fefe, feh
+ * @ref ucspi-tcp
+ * @brief DNS name query (ptr)
+ */
static char *q = 0;
diff --git a/dnsstub/dns_nd.c b/src/dnsstub/dns_nd.c
index 6ce8ed9..bdef42b 100644
--- a/dnsstub/dns_nd.c
+++ b/src/dnsstub/dns_nd.c
@@ -4,11 +4,11 @@
#include "dnsresolv.h"
/**
- @file dns_nd.c
- @autor djb, fefe
- @source ucspi-tcp
- @brief DNS domain name for ip (wire format)
-*/
+ * @file dns_nd.c
+ * @authors djb, fefe
+ * @ref ucspi-tcp
+ * @brief DNS domain name for ip (wire format)
+ */
int dns_name4_domain(char name[DNS_NAME4_DOMAIN],const char ip[4])
{
diff --git a/dnsstub/dns_packet.c b/src/dnsstub/dns_packet.c
index ce322ea..b131635 100644
--- a/dnsstub/dns_packet.c
+++ b/src/dnsstub/dns_packet.c
@@ -2,12 +2,12 @@
#include "dnsresolv.h"
/**
- @file dns_packet.c
- @author djb
- @source ucspi-tcp
- @brief DNS low level packet routine
- @brief DNS should have used LZ77 instead of its own sophomoric compression algorithm.
-*/
+ * @file dns_packet.c
+ * @author djb
+ * @ref ucspi-tcp
+ * @brief DNS low level packet routine
+ * @brief DNS should have used LZ77 instead of its own sophomoric compression algorithm.
+ */
unsigned int dns_packet_copy(const char *buf,unsigned int len,unsigned int pos,char *out,unsigned int outlen)
{
diff --git a/dnsstub/dns_random.c b/src/dnsstub/dns_random.c
index 200cd6c..c300f6a 100644
--- a/dnsstub/dns_random.c
+++ b/src/dnsstub/dns_random.c
@@ -4,11 +4,11 @@
#include "dnsresolv.h"
/**
- @file dns_random.c
- @author djb
- @source ucspi-tcp
- @brief random use of DNS resolvers given their IP
-*/
+ * @file dns_random.c
+ * @author djb
+ * @ref ucspi-tcp
+ * @brief random use of DNS resolvers given their IP
+ */
static uint32 seed[32];
static uint32 in[12];
diff --git a/dnsstub/dns_rcip.c b/src/dnsstub/dns_rcip.c
index 93b0daa..97a1a6b 100644
--- a/dnsstub/dns_rcip.c
+++ b/src/dnsstub/dns_rcip.c
@@ -7,11 +7,11 @@
#include "socket_if.h"
/**
- @file dns_rcip.c
- @author djb, fefe, feh
- @source ucspi-tcp
- @brief DNS receive for query
-*/
+ * @file dns_rcip.c
+ * @author djb, fefe, feh
+ * @ref ucspi-tcp
+ * @brief DNS receive for query
+ */
static stralloc data = {0};
static stralloc ifname = {0};
diff --git a/dnsstub/dns_rcrw.c b/src/dnsstub/dns_rcrw.c
index 4633fed..c0cad86 100644
--- a/dnsstub/dns_rcrw.c
+++ b/src/dnsstub/dns_rcrw.c
@@ -7,11 +7,11 @@
#include "dnsresolv.h"
/**
- @file dns_rcrw.c
- @author djb
- @source ucspi-tcp
- @brief DNS receive rewrite
-*/
+ * @file dns_rcrw.c
+ * @author djb
+ * @ref ucspi-tcp
+ * @brief DNS receive rewrite
+ */
static stralloc data = {0};
diff --git a/dnsstub/dns_resolve.c b/src/dnsstub/dns_resolve.c
index bcc4308..f2b845c 100644
--- a/dnsstub/dns_resolve.c
+++ b/src/dnsstub/dns_resolve.c
@@ -5,11 +5,11 @@
#include "dnsresolv.h"
/**
- @file dns_resolve.c
- @author djb, fefe, feh
- @source ucspi-tcp
- @brief high-level DNS resolve function
-*/
+ * @file dns_resolve.c
+ * @authors djb, fefe, feh
+ * @ref ucspi-tcp
+ * @brief high-level DNS resolve function
+ */
struct dns_transmit dns_resolve_tx = {0};
diff --git a/dnsstub/dns_sortip.c b/src/dnsstub/dns_sortip.c
index 56742e0..38f5df2 100644
--- a/dnsstub/dns_sortip.c
+++ b/src/dnsstub/dns_sortip.c
@@ -3,11 +3,11 @@
#include "dnsresolv.h"
/**
- @file dns_sortip.c
- @authors djb, fefe, feh
- @source ucspi-tcp6
- @brief random sort of DNS servers per IP
-*/
+ * @file dns_sortip.c
+ * @authors djb, fefe, feh
+ * @ref ucspi-tcp6
+ * @brief random sort of DNS servers per IP
+ */
/* XXX: sort servers by configurable notion of closeness? */
/* XXX: pay attention to competence of each server? */
diff --git a/dnsstub/dns_transmit.c b/src/dnsstub/dns_transmit.c
index 2513565..93cc896 100644
--- a/dnsstub/dns_transmit.c
+++ b/src/dnsstub/dns_transmit.c
@@ -10,12 +10,12 @@
#include "dnsresolv.h"
/**
- @file dns_transmit.c
- @authors djb, fefe, feh
- @source qlibs
- @brief DNS query function
- @brief scope_ids[32] -> 32 LLU root servers supported
-*/
+ * @file dns_transmit.c
+ * @authors djb, fefe, feh
+ * @ref qlibs
+ * @brief DNS query function
+ * @brief scope_ids[32] -> 32 LLU root servers supported
+ */
#define DNSPORT 53
@@ -58,7 +58,7 @@ int serverfailed(const char *buf,unsigned int len)
return 0;
}
-int irrelevant(const struct dns_transmit *d,const char *buf,unsigned int len)
+static int irrelevant(const struct dns_transmit *d,const char *buf,unsigned int len)
{
char out[12];
char *dn;
@@ -137,7 +137,7 @@ int randombind4(struct dns_transmit *d)
return DNS_COM;
}
-int thisudp(struct dns_transmit *d)
+static int thisudp(struct dns_transmit *d)
{
const char *ip;
@@ -193,7 +193,7 @@ int nextudp(struct dns_transmit *d)
return thisudp(d);
}
-int thistcp(struct dns_transmit *d)
+static int thistcp(struct dns_transmit *d)
{
struct taia now;
const char *ip;
diff --git a/dnsstub/dns_txt.c b/src/dnsstub/dns_txt.c
index 9a1b56a..3c54773 100644
--- a/dnsstub/dns_txt.c
+++ b/src/dnsstub/dns_txt.c
@@ -3,6 +3,13 @@
#include "byte.h"
#include "dnsresolv.h"
+/**
+ * @file dns_txt.c
+ * @authors djb, fefe, feh
+ * @ref ucspi-tcp
+ * @brief DNS text query (txt)
+ */
+
int dns_txt_packet(stralloc *out,const char *buf,unsigned int len)
{
unsigned int pos;
diff --git a/env.c b/src/env.c
index 2ecaa83..053357b 100644
--- a/env.c
+++ b/src/env.c
@@ -3,11 +3,11 @@
#include "env.h"
/**
- @file env.c
- @author djb
- @source ucspi-tcp
- @brief setting up environment after fork
-*/
+ * @file env.c
+ * @author djb
+ * @ref ucspi-tcp
+ * @brief setting up environment after fork
+ */
extern /*@null@*/char *env_get(char *s)
{
@@ -57,14 +57,15 @@ int env_unset(char *s)
return 1;
}
-int env_set(char *s) {
+int env_set(char *s)
+{
char *t;
t = env_findeq(s);
if (t) env_unsetlen(s,t - s);
if (en == ea) {
ea += 30;
- if (!alloc_re(&environ,(en + 1) * sizeof(char *),(ea + 1) * sizeof(char *)))
+ if (!alloc_re((void **)&environ,(en + 1) * sizeof(char *),(ea + 1) * sizeof(char *)))
{ ea = en; return 0; }
}
environ[en++] = s;
@@ -72,7 +73,8 @@ int env_set(char *s) {
return 1;
}
-int env_puts(char *s) {
+int env_puts(char *s)
+{
char *u;
if (!env_isinit)
@@ -133,4 +135,7 @@ void env_clear() {
while (en) env_del(0);
else environ = &null;
}
-extern char *env_pick() { return environ[0]; }
+extern char *env_pick()
+{
+ return environ[0];
+}
diff --git a/errstr.c b/src/errstr.c
index e2290fb..e3d854b 100644
--- a/errstr.c
+++ b/src/errstr.c
@@ -1,11 +1,11 @@
#include "error.h"
/**
- @file errstr.c
- @author kp
- @source qlibs
- @brief error output to log for different conditions and OS
-*/
+ * @file errstr.c
+ * @author kp
+ * @ref qlibs
+ * @brief error output to log for different conditions and OS
+ */
#define X(e,s) if (code == e) return s;
diff --git a/fd.c b/src/fd.c
index 776575c..c3cc0f7 100644
--- a/fd.c
+++ b/src/fd.c
@@ -2,11 +2,11 @@
#include "fd.h"
/**
- @file fd.c
- @autor djb
- @source qmail
- @brief file descriptor manipulation
-*/
+ * @file fd.c
+ * @autor djb
+ * @ref qmail
+ * @brief file descriptor manipulation
+ */
int close(int __fd); /* we won't use unistd.h here */
@@ -27,4 +27,7 @@ int fd_move(int to,int from)
return 0;
}
-int fd_coe(int fd) {return fcntl(fd,F_SETFD,1); }
+int fd_coe(int fd)
+{
+ return fcntl(fd,F_SETFD,1);
+}
diff --git a/fmt.c b/src/fmt.c
index 52ab5dc..ff838be 100644
--- a/fmt.c
+++ b/src/fmt.c
@@ -1,15 +1,15 @@
#include "fmt.h"
/**
- @file fmt.c
- @author djb
- @source qmail
- @brief formating differnt inputs format for output printing
-*/
+ * @file fmt.c
+ * @authors djb, feh
+ * @ref qmail
+ * @brief formating differnt inputs format for output printing
+ */
-unsigned int fmt_str(register char *s,register char *t)
+unsigned int fmt_str(char *s,const char *t)
{
- register unsigned int len;
+ unsigned int len;
char ch;
len = 0;
if (s) { while ((ch = t[len])) s[len++] = ch; }
@@ -17,9 +17,9 @@ unsigned int fmt_str(register char *s,register char *t)
return len;
}
-unsigned int fmt_strn(register char *s,register char *t,register unsigned int n)
+unsigned int fmt_strn(char *s,const char *t,unsigned int n)
{
- register unsigned int len;
+ unsigned int len;
char ch;
len = 0;
if (s) { while (n-- && (ch = t[len])) s[len++] = ch; }
@@ -27,9 +27,9 @@ unsigned int fmt_strn(register char *s,register char *t,register unsigned int n)
return len;
}
-unsigned int fmt_uint(register char *s,register unsigned int u)
+unsigned int fmt_uint(char *s,unsigned int u)
{
- register unsigned long l; l = u; return fmt_ulong(s,l);
+ unsigned long l; l = u; return fmt_ulong(s,l);
}
unsigned int fmt_uint0(char *s,unsigned int u,unsigned int n)
@@ -41,9 +41,10 @@ unsigned int fmt_uint0(char *s,unsigned int u,unsigned int n)
return len;
}
-unsigned int fmt_ulong(register char *s,register unsigned long u)
+unsigned int fmt_ulong(char *s,unsigned long u)
{
- register unsigned int len; register unsigned long q;
+ unsigned int len;
+ unsigned long q;
len = 1; q = u;
while (q > 9) { ++len; q /= 10; }
if (s) {
@@ -53,9 +54,10 @@ unsigned int fmt_ulong(register char *s,register unsigned long u)
return len;
}
-unsigned int fmt_xlong(register char *s,register unsigned long u)
+unsigned int fmt_xlong(char *s,unsigned long u)
{
- register unsigned int len; register unsigned long q;
+ unsigned int len;
+ unsigned long q;
len = 1; q = u;
while (q > 15) { ++len; q /= 16; }
if (s) {
diff --git a/getln.c b/src/getln.c
index f83d3c2..84c875c 100644
--- a/getln.c
+++ b/src/getln.c
@@ -2,11 +2,11 @@
#include "getln.h"
/**
- @file getln.c
- @author djb
- @source qmail
- @brief evaluting tokenized input arguments
-*/
+ * @file getln.c
+ * @author djb
+ * @ref qmail
+ * @brief evaluating tokenized input arguments
+ */
int getln(buffer *b,stralloc *sa,int *match,int sep)
{
@@ -22,8 +22,8 @@ int getln(buffer *b,stralloc *sa,int *match,int sep)
int sgetln(buffer *b,stralloc *sa,char **cont,unsigned int *clen,int sep)
{
- register char *x;
- register unsigned int i;
+ char *x;
+ unsigned int i;
int n;
if (!stralloc_ready(sa,0)) return -1;
diff --git a/getoptb.c b/src/getoptb.c
index edee6b8..af7ffc2 100644
--- a/getoptb.c
+++ b/src/getoptb.c
@@ -2,11 +2,11 @@
#include "getoptb.h"
/**
- @file getoptb.c
- @author djb
- @source ucspi-tcp
- @brief 'getopt' version w/o stdlib
-*/
+ * @file getoptb.c
+ * @author djb
+ * @ref ucspi-tcp
+ * @brief 'getopt' version w/o stdlib
+ */
#define optind subgetoptind
#define optproblem subgetoptproblem
@@ -14,7 +14,7 @@
int opterr = 1;
char *optprogname = 0;
-int getopt(int argc,char **argv,char *opts)
+int getoptb(int argc,char **argv,char *opts)
{
int c;
char *s;
@@ -87,7 +87,7 @@ int subgetopt(int argc,char **argv,char *opts)
optproblem = c;
return '?';
}
- ++optind;
+ ++optind;
}
}
return c;
diff --git a/iopause.c b/src/iopause.c
index 94a6fea..2e24d45 100644
--- a/iopause.c
+++ b/src/iopause.c
@@ -4,12 +4,12 @@
#include "iopause.h"
/**
- @file iopause.c
- @author djb
- @source qmail
- @brief stateful reading from net
- @return > 0 if successful
-*/
+ * @file iopause.c
+ * @author djb
+ * @ref qmail
+ * @brief stateful reading from net
+ * @return > 0 if successful
+ */
int iopause(iopause_fd *x,unsigned int len,struct taia *deadline,struct taia *stamp)
{
diff --git a/ip4.c b/src/ip4.c
index e77cfb6..9b2047c 100644
--- a/ip4.c
+++ b/src/ip4.c
@@ -4,20 +4,19 @@
#include "ip.h"
/**
- @file ip4.c
- @author djb, fefe, feh, kp
- @source ucspi-tcp, ucspi-tcp6
- @brief handling of IPv4 addresses
-*/
+ * @file ip4.c
+ * @authors djb, fefe, feh, kp
+ * @ref ucspi-tcp, ucspi-tcp6
+ * @brief handling of IPv4 addresses
+ */
/**
- @brief ip4_fmt
- converts IPv4 address to dotted decimal string format
- @param input: IPv4 char array
- output: IPv4 address string
- @return int length of address (ok > 0)
- */
-
+ * @brief ip4_fmt
+ * converts IPv4 address to dotted decimal string format
+ * @param input: IPv4 char array
+ * output: IPv4 address string
+ * @return int length of address (ok > 0)
+ */
unsigned int ip4_fmt(char *s,char ip[4])
{
unsigned int len;
@@ -35,13 +34,12 @@ unsigned int ip4_fmt(char *s,char ip[4])
}
/**
- @brief ia4_fmt
- converts IPv4 address into DNS inverse nibble format
- @param input: IPv4 char array
- output: IPv4 address string
- @return int length of address (ok > 0)
- */
-
+ * @brief ia4_fmt
+ * converts IPv4 address into DNS inverse nibble format
+ * @param input: IPv4 char array
+ * output: IPv4 address string
+ * @return int length of address (ok > 0)
+ */
unsigned int ia4_fmt(char *s,char ip[4])
{
unsigned int i;
@@ -60,13 +58,12 @@ unsigned int ia4_fmt(char *s,char ip[4])
}
/**
- @brief ip4_scan
- parse IPv4 address string and convert to IP address array
- @param input: IPv4 address string
- output: IPv4 char array
- @return int length of ip_address (ok > 0)
- */
-
+ * @brief ip4_scan
+ * parse IPv4 address string and convert to IP address array
+ * @param input: IPv4 address string
+ * output: IPv4 char array
+ * @return int length of ip_address (ok > 0)
+ */
unsigned int ip4_scan(const char *s,char ip[4])
{
unsigned int i;
@@ -86,13 +83,12 @@ unsigned int ip4_scan(const char *s,char ip[4])
}
/**
- @brief ip4_scanbracket
- parse IPv4 address string enclosed in brackets and convert to IP address array
- @param input: IPv4 char array
- output: IPv4 char array
- @return int length of ip_address (ok > 0)
- */
-
+ * @brief ip4_scanbracket
+ * parse IPv4 address string enclosed in brackets and convert to IP address array
+ * @param input: IPv4 char array
+ * output: IPv4 char array
+ * @return int length of ip_address (ok > 0)
+ */
unsigned int ip4_scanbracket(const char *s,char ip[4])
{
unsigned int len;
@@ -105,14 +101,13 @@ unsigned int ip4_scanbracket(const char *s,char ip[4])
}
/**
- @brief ip4_cidr
- parse IPv4 address string
- concatinated with the prefix length: 192.168.1/24
- @param input: IPv6 char array
- output: IPv6 char array, long plen
- @return int length of ip6_address/ip
- */
-
+ * @brief ip4_cidr
+ * parse IPv4 address string
+ * concatinated with the prefix length: 192.168.1/24
+ * @param input: IPv6 char array
+ * output: IPv6 char array, long plen
+ * @return int length of ip6_address/ip
+ */
unsigned int ip4_cidr(char *s,char ip[4],unsigned long *plen)
{
unsigned int j = 0;
@@ -127,13 +122,12 @@ unsigned int ip4_cidr(char *s,char ip[4],unsigned long *plen)
}
/**
- @brief ip4_bytestring
- parse IPv4 address and represent as char string with length prefix
- @param input: IPv4 char array, prefix length
- output: pointer to stralloc bytestring
- @return n: number of bytes, if ok; -1: memory shortage; -2: input error
- */
-
+ * @brief ip4_bytestring
+ * parse IPv4 address and represent as char string with length prefix
+ * @param input: IPv4 char array, prefix length
+ * output: pointer to stralloc bytestring
+ * @return n: number of bytes, if ok; -1: memory shortage; -2: input error
+ */
unsigned int ip4_bytestring(stralloc *ipstring,char ip[4],int prefix)
{
int i, j, n = 0;
diff --git a/ip6.c b/src/ip6.c
index cf8d85b..a5a60fd 100644
--- a/ip6.c
+++ b/src/ip6.c
@@ -5,20 +5,19 @@
#include "str.h"
/**
- @file ip6.c
- @author djb, fefe, feh
- @source ucspi-tcp, ucspi-tcp6
- @brief handling of IPv6 addresses
-*/
-
-/***
- @brief ip6_fmt
- convert IPv6 address to compactified IPv6 address string
- @param input: IPv6 char array
- output: pointer to IPv6 address string
- @return int length of address (ok > 0)
+ * @file ip6.c
+ * @authors djb, fefe, feh
+ * @ref ucspi-tcp, ucspi-tcp6
+ * @brief handling of IPv6 addresses
*/
+/**
+ * @brief ip6_fmt
+ * convert IPv6 address to compactified IPv6 address string
+ * @param input: IPv6 char array
+ * output: pointer to IPv6 address string
+ * @return int length of address (ok > 0)
+ */
unsigned int ip6_fmt(char *s,char ip[16])
{
unsigned int len;
@@ -75,14 +74,13 @@ unsigned int ip6_fmt(char *s,char ip[16])
return len;
}
-/***
- @brief ip6_fmt_flat
- convert IPv6 address to IPv6 address string
- @param input: IPv6 char array
- output: pointer to IPv6 address string
- @return int length of address (ok > 0)
- */
-
+/**
+ * @brief ip6_fmt_flat
+ * convert IPv6 address to IPv6 address string
+ * @param input: IPv6 char array
+ * output: pointer to IPv6 address string
+ * @return int length of address (ok > 0)
+ */
unsigned int ip6_fmt_flat(char *s,char ip[16])
{
int i;
@@ -93,15 +91,14 @@ unsigned int ip6_fmt_flat(char *s,char ip[16])
return 32;
}
-/***
- @brief ia6_fmt
- convert IPv6 address to inverse DNS nibble format
- 1.2.3.4.5.6.7.8.9.a.b.c.d.e.f.1.2.3.4.5.6.7.8.9.a.b.c.d.e.f.ip6.arpa
- @param input: IPv6 char array
- output: pointer to IPv6 address string
- @return int length of address
- */
-
+/**
+ * @brief ia6_fmt
+ * convert IPv6 address to inverse DNS nibble format
+ * 1.2.3.4.5.6.7.8.9.a.b.c.d.e.f.1.2.3.4.5.6.7.8.9.a.b.c.d.e.f.ip6.arpa
+ * @param input: IPv6 char array
+ * output: pointer to IPv6 address string
+ * @return int length of address
+ */
unsigned int ia6_fmt(char *s,char ip[16])
{
unsigned int i;
@@ -122,15 +119,13 @@ unsigned int ia6_fmt(char *s,char ip[16])
return len;
}
-
-/***
- @brief ip6_scan_flat
- convert IPv6 address string to IPv6 address array
- @param input: pointer to IPv6 address string
- output: IPv6 char array
- @return int length of address (ok > 0)
- */
-
+/**
+ * @brief ip6_scan_flat
+ * convert IPv6 address string to IPv6 address array
+ * @param input: pointer to IPv6 address string
+ * output: IPv6 char array
+ * @return int length of address (ok > 0)
+ */
unsigned int ip6_scan_flat(const char *s,char ip[16])
{
int i, tmp;
@@ -146,14 +141,13 @@ unsigned int ip6_scan_flat(const char *s,char ip[16])
return 32;
}
-/***
- @brief ip6_scan
- parse compactified IPv6 address string and convert to IPv6 address array
- @param input: pointer to IPv6 address string
- output: IPv6 char array
- @return int length of ip6_address/ip
- */
-
+/**
+ * @brief ip6_scan
+ * parse compactified IPv6 address string and convert to IPv6 address array
+ * @param input: pointer to IPv6 address string
+ * output: IPv6 char array
+ * @return int length of ip6_address/ip
+ */
unsigned int ip6_scan(const char *s,char ip[16])
{
unsigned int i, j;
@@ -239,14 +233,13 @@ unsigned int ip6_scan(const char *s,char ip[16])
return len;
}
-/***
- @brief ip6_scanbracket
- parse IPv6 string address enclosed in brackets
- @param input: pointer to IPv6 address string
- output: IPv6 char array
- @return int length of ip_address (ok > 0)
- */
-
+/**
+ * @brief ip6_scanbracket
+ * parse IPv6 string address enclosed in brackets
+ * @param input: pointer to IPv6 address string
+ * output: IPv6 char array
+ * @return int length of ip_address (ok > 0)
+ */
unsigned int ip6_scanbracket(const char *s,char ip[16])
{
unsigned int len;
@@ -259,14 +252,13 @@ unsigned int ip6_scanbracket(const char *s,char ip[16])
}
/**
- @brief ip6_ifscan
- parse compactified IPv6 address string
- concatinated with the interface name: fe80::1%eth0
- @param input: pointer to IPv6 address string
- output: IPv6 char array, stralloc interface_name
- @return int length of ip6_address/ip
- */
-
+ * @brief ip6_ifscan
+ * parse compactified IPv6 address string
+ * concatinated with the interface name: fe80::1%eth0
+ * @param input: pointer to IPv6 address string
+ * output: IPv6 char array, stralloc interface_name
+ * @return int length of ip6_address/ip
+ */
unsigned int ip6_ifscan(char *s,char ip[16],stralloc *ifname)
{
int i;
@@ -288,14 +280,13 @@ unsigned int ip6_ifscan(char *s,char ip[16],stralloc *ifname)
}
/**
- @brief ip6_cidr
- parse compactified IPv6 address string
- concatinated with the prefix length: fe80::1/64
- @param input: pointer to IPv6 address string
- output: IPv6 char array, long plen
- @return int length of ip6_address/ip
- */
-
+ * @brief ip6_cidr
+ * parse compactified IPv6 address string
+ * concatinated with the prefix length: fe80::1/64
+ * @param input: pointer to IPv6 address string
+ * output: IPv6 char array, long plen
+ * @return int length of ip6_address/ip
+ */
unsigned int ip6_cidr(char *s,char ip[16],unsigned long *plen)
{
unsigned int j = 0;
@@ -310,13 +301,12 @@ unsigned int ip6_cidr(char *s,char ip[16],unsigned long *plen)
}
/**
- @brief ip6_bytestring
- parse IPv6 address and represent as char string with length prefix
- @param input: IPv6 char array, prefix length
- output: pointer to stralloc bit string;
- @return n: number of bytes, if ok; -1: memory shortage
- */
-
+ * @brief ip6_bytestring
+ * parse IPv6 address and represent as char string with length prefix
+ * @param input: IPv6 char array, prefix length
+ * output: pointer to stralloc bit string;
+ * @return n: number of bytes, if ok; -1: memory shortage
+ */
unsigned int ip6_bytestring(stralloc *ipstring,char ip[16],int prefix)
{
int i, j, n = 0;
diff --git a/lock.c b/src/lock.c
index 4ac6b40..5285210 100644
--- a/lock.c
+++ b/src/lock.c
@@ -5,11 +5,11 @@
#include "lock.h"
/**
- @file lock.c
- @author djb
- @source qmail
- @brief locking of resources
-*/
+ * @file lock.c
+ * @author djb
+ * @ref qmail
+ * @brief locking of resources
+ */
#ifdef HASFLOCK
int lock_ex(int fd) { return flock(fd,LOCK_EX); }
diff --git a/logmsg.c b/src/logmsg.c
index 3f079f4..97d832e 100644
--- a/logmsg.c
+++ b/src/logmsg.c
@@ -8,11 +8,11 @@
#include "logmsg.h"
/**
- @file logmsg.c
- @author kp, feh
- @source qlibs
- @brief unified system and error message handling
-*/
+ * @file logmsg.c
+ * @author kp, feh
+ * @ref qlibs
+ * @brief unified system and error message handling
+ */
#define WHO "logmsg"
diff --git a/ndelay.c b/src/ndelay.c
index f4b5eb8..d6769c7 100644
--- a/ndelay.c
+++ b/src/ndelay.c
@@ -3,11 +3,11 @@
#include "ndelay.h"
/**
- @file ndelay.c
- @author djb
- @soure qmail
- @brief delaying of IO operations
-*/
+ * @file ndelay.c
+ * @author djb
+ * @ref qmail
+ * @brief delaying of IO operations
+ */
#ifndef O_NONBLOCK
#define O_NONBLOCK O_NDELAY
diff --git a/open.c b/src/open.c
index c430698..842955a 100644
--- a/open.c
+++ b/src/open.c
@@ -3,11 +3,11 @@
#include "open.h"
/**
- @file open.c
- @author djb
- @source qmail
- @brief open a file
-*/
+ * @file open.c
+ * @author djb
+ * @ref qmail
+ * @brief open a file
+ */
int open_append(const char *fn)
{ return open(fn,O_WRONLY | O_NDELAY | O_APPEND | O_CREAT,0600); }
diff --git a/pathexec.c b/src/pathexec.c
index 2c1e7d1..564d65d 100644
--- a/pathexec.c
+++ b/src/pathexec.c
@@ -8,11 +8,11 @@
#include "pathexec.h"
/**
- @file pathexec.c
- @author djb
- @source ucspi-tcp, ucspi-ssl
- @brief populate environment after fork
-*/
+ * @file pathexec.c
+ * @author djb
+ * @ref ucspi-tcp, ucspi-ssl
+ * @brief populate environment after fork
+ */
static stralloc plus;
static stralloc tmp;
diff --git a/prot.c b/src/prot.c
index 907de52..078c4b5 100644
--- a/prot.c
+++ b/src/prot.c
@@ -5,11 +5,11 @@
#include "prot.h"
/**
- @file prot.c
- @author djb
- @source qmail
- @brief setting up uid an gid for OS (short group was for ancient solaris)
-*/
+ * @file prot.c
+ * @author djb
+ * @ref qmail
+ * @brief setting up uid an gid for OS (short group was for ancient solaris)
+ */
/* XXX: there are more portability problems here waiting to leap out at me */
diff --git a/readclose.c b/src/readclose.c
index b0bce7e..7f06b06 100644
--- a/readclose.c
+++ b/src/readclose.c
@@ -4,13 +4,13 @@
#include "readclose.h"
/**
- @file readclose.c
- @author kp
- @source qlibs
- @brief This is the successor of the older 'slurpclose.c' file. The function
- 'slurpclose' is now called 'readclose_append'. The other function
- 'readclose' was introduced here initial.
-*/
+ * @file readclose.c
+ * @author kp
+ * @ref qlibs
+ * @brief This is the successor of the older 'slurpclose.c' file.
+ * @brief The function * 'slurpclose' is now called 'readclose_append'.
+ * @brief The other function 'readclose' was introduced here initial.
+ */
int readclose_append(int fd,stralloc *sa,unsigned int bufsize)
{
diff --git a/scan.c b/src/scan.c
index da3d8ad..597e76c 100644
--- a/scan.c
+++ b/src/scan.c
@@ -1,11 +1,11 @@
#include "scan.h"
/**
- @file scan.c
- @author djb
- @source qmail, ucspi-tcp
- @brief scanning/conversion of strings to different variable types
-*/
+ * @file scan.c
+ * @author djb
+ * @ref qmail, ucspi-tcp
+ * @brief scanning/conversion of strings to different variable types
+ */
static long int fromhex(unsigned char c)
{
@@ -18,11 +18,11 @@ static long int fromhex(unsigned char c)
return -1;
}
-unsigned int scan_0x(register const char *s,register unsigned int *u)
+unsigned int scan_0x(const char *s,unsigned int *u)
{
- register unsigned int pos = 0;
- register unsigned long result = 0;
- register long int c;
+ unsigned int pos = 0;
+ unsigned long result = 0;
+ long int c;
while ((c = fromhex((unsigned char) (s[pos]))) >= 0) {
result = (result << 4) + c;
@@ -32,11 +32,11 @@ unsigned int scan_0x(register const char *s,register unsigned int *u)
return pos;
}
-unsigned int scan_8long(register const char *s,register unsigned long *u)
+unsigned int scan_8long(const char *s,unsigned long *u)
{
- register unsigned int pos = 0;
- register unsigned long result = 0;
- register unsigned long c;
+ unsigned int pos = 0;
+ unsigned long result = 0;
+ unsigned long c;
while ((c = (unsigned long) (unsigned char) (s[pos] - '0')) < 8) {
result = result * 8 + c;
@@ -46,9 +46,9 @@ unsigned int scan_8long(register const char *s,register unsigned long *u)
return pos;
}
-unsigned int scan_uint(register const char *s,register unsigned int *u)
+unsigned int scan_uint(const char *s,unsigned int *u)
{
- register unsigned int pos;
+ unsigned int pos;
unsigned long result;
pos = scan_ulong(s,&result);
@@ -56,18 +56,18 @@ unsigned int scan_uint(register const char *s,register unsigned int *u)
return pos;
}
-unsigned int scan_plusminus(register const char *s,register int *sign)
+unsigned int scan_plusminus(const char *s,register int *sign)
{
if (*s == '+') { *sign = 1; return 1; }
if (*s == '-') { *sign = -1; return 1; }
*sign = 1; return 0;
}
-unsigned int scan_long(register const char *s,register long *i)
+unsigned int scan_long(const char *s,register long *i)
{
int sign;
unsigned long u;
- register unsigned int len;
+ unsigned int len;
len = scan_plusminus(s,&sign); s += len;
len += scan_ulong(s,&u);
@@ -76,11 +76,11 @@ unsigned int scan_long(register const char *s,register long *i)
}
-unsigned int scan_ulong(register const char *s,register unsigned long *u)
+unsigned int scan_ulong(const char *s,unsigned long *u)
{
- register unsigned int pos = 0;
- register unsigned long result = 0;
- register unsigned long c;
+ unsigned int pos = 0;
+ unsigned long result = 0;
+ unsigned long c;
while ((c = (unsigned long) (unsigned char) (s[pos] - '0')) < 10) {
result = result * 10 + c;
@@ -92,9 +92,9 @@ unsigned int scan_ulong(register const char *s,register unsigned long *u)
unsigned int scan_xlong(const char *s,unsigned long *u)
{
- register const char *t = s;
- register int l = 0;
- register unsigned char c;
+ const char *t = s;
+ int l = 0;
+ unsigned char c;
while ((c = fromhex(*t)) < 16) {
l = (l<<4)+c;
@@ -106,9 +106,9 @@ unsigned int scan_xlong(const char *s,unsigned long *u)
unsigned int scan_xint(const char *s,unsigned int *i)
{
- register const char *t = s;
- register unsigned int l = 0;
- register unsigned char c;
+ const char *t = s;
+ unsigned int l = 0;
+ unsigned char c;
while ((l >> (sizeof(l)*8 - 4)) == 0
&& (c = (unsigned char)fromhex((unsigned char)*t))<16) {
diff --git a/seek.c b/src/seek.c
index ac761a9..a7b0cac 100644
--- a/seek.c
+++ b/src/seek.c
@@ -2,11 +2,11 @@
#include "seek.h"
/**
- @file seek.c
- @author djb
- @source qmail
- @brief seek in an open file descritor
-*/
+ * @file seek.c
+ * @author djb
+ * @ref qmail
+ * @brief seek in an open file descritor
+ */
off_t lseek(int fd,off_t offset,int whence);
int ftruncate(int fd, off_t length);
@@ -14,17 +14,27 @@ int ftruncate(int fd, off_t length);
#define CUR 1 /* sigh */
seek_pos seek_cur(int fd)
-{ return lseek(fd,(off_t) 0,CUR); }
+{
+ return lseek(fd,(off_t) 0,CUR);
+}
#define END 2 /* sigh */
int seek_end(int fd)
-{ if (lseek(fd,(off_t) 0,END) == -1) return -1; return 0; }
+{
+ if (lseek(fd,(off_t) 0,END) == -1) return -1;
+ return 0;
+}
#define SET 0 /* sigh */
int seek_set(int fd,seek_pos pos)
-{ if (lseek(fd,(off_t) pos,SET) == -1) return -1; return 0; }
+{
+ if (lseek(fd,(off_t) pos,SET) == -1) return -1;
+ return 0;
+}
int seek_trunc(int fd,seek_pos pos)
-{ return ftruncate(fd,(off_t) pos); }
+{
+ return ftruncate(fd,(off_t) pos);
+}
diff --git a/src/sig.c b/src/sig.c
new file mode 100644
index 0000000..e4d2bf0
--- /dev/null
+++ b/src/sig.c
@@ -0,0 +1,169 @@
+#include <signal.h>
+#include "sig.h"
+
+/**
+ * @file sig.c
+ * @authors djb, jmh
+ * @ref qmail
+ * @brief signal handling functions
+ */
+
+void sig_alarmblock()
+{
+ sig_block(SIGALRM);
+}
+void sig_alarmunblock()
+{
+ sig_unblock(SIGALRM);
+}
+void sig_alarmcatch(void (*f)(int))
+{
+ sig_catch(SIGALRM,f);
+}
+void sig_alarmdefault()
+{
+ sig_catch(SIGALRM,SIG_DFL);
+}
+
+int sig_alarm = SIGALRM;
+
+void sig_block(int sig)
+{
+ sigset_t ss;
+ sigemptyset(&ss);
+ sigaddset(&ss,sig);
+ sigprocmask(SIG_BLOCK,&ss,(sigset_t *)0);
+}
+
+void sig_unblock(int sig)
+{
+ sigset_t ss;
+ sigemptyset(&ss);
+ sigaddset(&ss,sig);
+ sigprocmask(SIG_UNBLOCK,&ss,(sigset_t *)0);
+}
+
+void sig_blocknone()
+{
+ sigset_t ss;
+ sigemptyset(&ss);
+ sigprocmask(SIG_SETMASK,&ss,(sigset_t *)0);
+}
+
+void sig_catch(int sig,void (*f)(int))
+{
+ struct sigaction sa;
+ sa.sa_handler = f;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+ sigaction(sig,&sa,(struct sigaction *)0);
+}
+
+void sig_pause()
+{
+ sigset_t ss;
+ sigemptyset(&ss);
+ sigsuspend(&ss);
+}
+
+void sig_pipeignore()
+{
+ sig_catch(SIGPIPE,SIG_IGN);
+}
+void sig_pipedefault()
+{
+ sig_catch(SIGPIPE,SIG_DFL);
+}
+
+int sig_pipe = SIGPIPE;
+
+void sig_childblock()
+{
+ sig_block(SIGCHLD);
+}
+void sig_childunblock()
+{
+ sig_unblock(SIGCHLD);
+}
+void sig_childcatch(void (*f)(int))
+{
+ sig_catch(SIGCHLD,f);
+}
+void sig_childdefault()
+{
+ sig_catch(SIGCHLD,SIG_DFL);
+}
+
+int sig_child = SIGCHLD;
+
+void sig_hangupblock()
+{
+ sig_block(SIGHUP);
+}
+void sig_hangupunblock()
+{
+ sig_unblock(SIGHUP);
+}
+void sig_hangupcatch(void (*f)(int))
+{
+ sig_catch(SIGHUP,f);
+}
+void sig_hangupdefault()
+{
+ sig_catch(SIGHUP,SIG_DFL);
+}
+
+int sig_hangup = SIGHUP;
+
+void sig_termblock()
+{
+ sig_block(SIGTERM);
+}
+void sig_termunblock()
+{
+ sig_unblock(SIGTERM);
+}
+void sig_termcatch( void (*f)(int))
+{
+ sig_catch(SIGTERM,f);
+}
+void sig_termdefault()
+{
+ sig_catch(SIGTERM,SIG_DFL);
+}
+
+int sig_term = SIGTERM;
+
+void sig_bugcatch(void (*f)(int))
+{
+ sig_catch(SIGILL,f);
+ sig_catch(SIGABRT,f);
+ sig_catch(SIGFPE,f);
+ sig_catch(SIGBUS,f);
+ sig_catch(SIGSEGV,f);
+#ifdef SIGSYS
+ sig_catch(SIGSYS,f);
+#endif
+#ifdef SIGEMT
+ sig_catch(SIGEMT,f);
+#endif
+}
+void (*sig_defaulthandler)(int) = SIG_DFL;
+
+void sig_miscignore()
+{
+ sig_catch(SIGVTALRM,SIG_IGN);
+ sig_catch(SIGPROF,SIG_IGN);
+ sig_catch(SIGQUIT,SIG_IGN);
+ sig_catch(SIGINT,SIG_IGN);
+ sig_catch(SIGHUP,SIG_IGN);
+#ifdef SIGXCPU
+ sig_catch(SIGXCPU,SIG_IGN);
+#endif
+#ifdef SIGXFSZ
+ sig_catch(SIGXFSZ,SIG_IGN);
+#endif
+}
+void (*sig_ignorehandler)() = SIG_IGN;
+
+int sig_cont = SIGCONT;
diff --git a/socket_bind.c b/src/socket_bind.c
index b942e20..261f386 100644
--- a/socket_bind.c
+++ b/src/socket_bind.c
@@ -7,11 +7,11 @@
#include "ip.h"
/**
- @file socket_bind.c
- @author djb, fefe, feh
- @source qmail, djbdns, ucspi-tcp6
- @brief binding a socket to a local resource
-*/
+ * @file socket_bind.c
+ * @author djb, fefe, feh
+ * @ref qmail, djbdns, ucspi-tcp6
+ * @brief binding a socket to a local resource
+ */
int socket_bind4(int s,const char ip[4],uint16 port)
{
diff --git a/socket_connect.c b/src/socket_connect.c
index 7b20659..4e0dbf0 100644
--- a/socket_connect.c
+++ b/src/socket_connect.c
@@ -8,11 +8,11 @@
#include "ip.h"
/**
- @file socket_connect.c
- @author djb, fefe, feh, kp
- @source qmail, ucscpi-tcp6
- @brief connection to remote IP host
-*/
+ * @file socket_connect.c
+ * @authors djb, fefe, feh, kp
+ * @ref qmail, ucscpi-tcp6
+ * @brief connection to remote IP host
+ */
int socket_connect6(int s,const char ip[16],uint16 port,uint32 scope_id)
{
diff --git a/socket_if.c b/src/socket_if.c
index f55af4e..a7b423a 100644
--- a/socket_if.c
+++ b/src/socket_if.c
@@ -6,11 +6,11 @@
#include "socket_if.h"
/**
- @file socket_if.c
- @author fefe, feh
- @source ucspi-tcp6
- @brief interface handling for LLU
-*/
+ * @file socket_if.c
+ * @authors fefe, feh
+ * @ref ucspi-tcp6
+ * @brief interface handling for LLU
+ */
const unsigned char V4loopback[4] = {127,0,0,1};
const unsigned char V4localnet[4] = {0,0,0,0};
diff --git a/socket_info.c b/src/socket_info.c
index e644798..6401cc2 100644
--- a/socket_info.c
+++ b/src/socket_info.c
@@ -7,11 +7,11 @@
#include "ip.h"
/**
- @file socket_info.c
- @author djb, fefe, feh
- @source ucspi-tcp6
- @brief querying local and remote info for socket
-*/
+ * @file socket_info.c
+ * @authors djb, fefe, feh
+ * @ref ucspi-tcp6
+ * @brief querying local and remote info for socket
+ */
int socket_local(int s,char ip[16],uint16 *port,uint32 *scope_id)
{
@@ -23,7 +23,7 @@ int socket_local(int s,char ip[16],uint16 *port,uint32 *scope_id)
if (sa.sin6_family == AF_INET) {
struct sockaddr_in *sa4 = (struct sockaddr_in*)&sa;
byte_copy(ip,12,V4mappedprefix);
- byte_copy(ip+12,4,(char *)&sa4->sin_addr);
+ byte_copy(ip + 12,4,(char *)&sa4->sin_addr);
uint16_unpack_big((char *)&sa4->sin_port,port);
if (scope_id) *scope_id = 0;
} else {
@@ -45,7 +45,7 @@ int socket_remote(int s,char ip[16],uint16 *port,uint32 *scope_id)
if (sa.sin6_family == AF_INET) {
struct sockaddr_in *sa4 = (struct sockaddr_in*)&sa;
byte_copy(ip,12,V4mappedprefix);
- byte_copy(ip+12,4,(char *)&sa4->sin_addr);
+ byte_copy(ip + 12,4,(char *)&sa4->sin_addr);
uint16_unpack_big((char *)&sa4->sin_port,port);
*scope_id = 0;
} else {
diff --git a/socket_recv.c b/src/socket_recv.c
index de8c856..7e0d8f9 100644
--- a/socket_recv.c
+++ b/src/socket_recv.c
@@ -7,11 +7,11 @@
#include "socket_if.h"
/**
- @file socket_recv.c
- @author djb, fefe
- @source ucspi-tcp6
- @brief setup receiving socket
-*/
+ * @file socket_recv.c
+ * @authors djb, fefe
+ * @ref ucspi-tcp6
+ * @brief setup receiving socket
+ */
int socket_recv(int s,char *buf,unsigned int len,char ip[16],uint16 *port,uint32 *scope_id)
{
@@ -26,7 +26,7 @@ int socket_recv(int s,char *buf,unsigned int len,char ip[16],uint16 *port,uint32
if (sa.sin6_family == AF_INET) {
struct sockaddr_in *sa4 = (struct sockaddr_in *)&sa;
byte_copy(ip,12,V4mappedprefix);
- byte_copy(ip+12,4,(char *)&sa4->sin_addr);
+ byte_copy(ip + 12,4,(char *)&sa4->sin_addr);
uint16_unpack_big((char *)&sa4->sin_port,port);
if (scope_id) *scope_id = 0;
} else {
diff --git a/socket_send.c b/src/socket_send.c
index 9f09520..73b15a2 100644
--- a/socket_send.c
+++ b/src/socket_send.c
@@ -7,11 +7,11 @@
#include "socket_if.h"
/**
- @file socket_send.c
- @author djb, fefe, feh
- @source ucspi-tcp6
- @brief setup sending socket
-*/
+ * @file socket_send.c
+ * @authors djb, fefe, feh
+ * @ref ucspi-tcp6
+ * @brief setup sending socket
+ */
int socket_send4(int s,const char *buf,unsigned int len,const char ip[4],uint16 port)
{
diff --git a/socket_setup.c b/src/socket_setup.c
index fb65fa2..9f6cd00 100644
--- a/socket_setup.c
+++ b/src/socket_setup.c
@@ -7,11 +7,11 @@
#include "ip.h"
/**
- @file socket_setup.c
- @author djb, feh
- @source ucspi-tcp6
- @brief setup listening socket
-*/
+ * @file socket_setup.c
+ * @authors djb, feh
+ * @ref ucspi-tcp6
+ * @brief setup listening socket
+ */
int socket_accept(int s,char ip[16],uint16 *port,uint32 *scope_id)
{
@@ -25,7 +25,7 @@ int socket_accept(int s,char ip[16],uint16 *port,uint32 *scope_id)
if (sa.sin6_family == AF_INET) {
struct sockaddr_in *sa4 = (struct sockaddr_in*)&sa;
byte_copy(ip,12,V4mappedprefix);
- byte_copy(ip+12,4,(char *)&sa4->sin_addr);
+ byte_copy(ip + 12,4,(char *)&sa4->sin_addr);
uint16_unpack_big((char *)&sa4->sin_port,port);
if (scope_id) *scope_id = 0;
} else {
diff --git a/socket_tcp.c b/src/socket_tcp.c
index 1ff050e..44667a4 100644
--- a/socket_tcp.c
+++ b/src/socket_tcp.c
@@ -13,11 +13,11 @@
#endif
/**
- @file socket_tcp.c
- @author djb, fefe, feh
- @source ucspi-tcp6
- @brief setup TCP stream socket
-*/
+ * @file socket_tcp.c
+ * @authors djb, fefe, feh
+ * @ref ucspi-tcp6
+ * @brief setup TCP stream socket
+ */
int socket_tcp4(void)
{
diff --git a/socket_udp.c b/src/socket_udp.c
index 743cdf1..2fe2ffc 100644
--- a/socket_udp.c
+++ b/src/socket_udp.c
@@ -13,11 +13,11 @@
#endif
/**
- @file socket_udp.c
- @author djb, fefe, feh
- @source ucspi-tcp6
- @brief setup a UDP message socket
-*/
+ * @file socket_udp.c
+ * @authors djb, fefe, feh
+ * @ref ucspi-tcp6
+ * @brief setup a UDP message socket
+ */
int socket_udp6(void)
{
diff --git a/str.c b/src/str.c
index 7d5ab5e..b632878 100644
--- a/str.c
+++ b/src/str.c
@@ -2,15 +2,15 @@
#include "stralloc.h"
/**
- @file str.c
- @author djb
- @source qmail
- @brief string handling functions
-*/
+ * @file str.c
+ * @authors djb, feh
+ * @ref qmail
+ * @brief string handling functions
+ */
-unsigned int str_copy(register char *s,register const char *t)
+unsigned int str_copy(char *s,const char *t)
{
- register int len;
+ int len;
len = 0;
for (;;) {
@@ -21,9 +21,9 @@ unsigned int str_copy(register char *s,register const char *t)
}
}
-unsigned int str_copyb(register char *s,register const char *t,unsigned int max)
+unsigned int str_copyb(char *s,const char *t,unsigned int max)
{
- register int len;
+ int len;
len = 0;
@@ -37,9 +37,9 @@ unsigned int str_copyb(register char *s,register const char *t,unsigned int max)
return len;
}
-int str_diff(register const char *s,register const char *t)
+int str_diff(const char *s,const char *t)
{
- register char x;
+ char x;
for (;;) {
x = *s; if (x != *t) { break; } if (!x) { break; } ++s; ++t;
@@ -51,9 +51,9 @@ int str_diff(register const char *s,register const char *t)
- ((int)(unsigned int)(unsigned char) *t);
}
-int str_diffn(register const char *s,register const char *t,unsigned int len)
+int str_diffn(const char *s,const char *t,unsigned int len)
{
- register char x;
+ char x;
for (;;) {
if (!len--) { return 0; } x = *s; if (x != *t) { break; } if (!x) { break; } ++s; ++t;
@@ -65,9 +65,9 @@ int str_diffn(register const char *s,register const char *t,unsigned int len)
- ((int)(unsigned int)(unsigned char) *t);
}
-unsigned int str_len(register const char *s)
+unsigned int str_len(const char *s)
{
- register const char *t;
+ const char *t;
t = s;
for (;;) {
@@ -78,10 +78,10 @@ unsigned int str_len(register const char *s)
}
}
-unsigned int str_chr(register const char *s,int c)
+unsigned int str_chr(const char *s,int c)
{
- register char ch;
- register const char *t;
+ char ch;
+ const char *t;
ch = c;
t = s;
@@ -94,11 +94,11 @@ unsigned int str_chr(register const char *s,int c)
return t - s;
}
-unsigned int str_rchr(register const char *s,int c)
+unsigned int str_rchr(const char *s,int c)
{
- register char ch;
- register const char *t;
- register const char *u;
+ char ch;
+ const char *t;
+ const char *u;
ch = c;
t = s;
@@ -113,9 +113,9 @@ unsigned int str_rchr(register const char *s,int c)
return u - s;
}
-int str_start(register const char *s,register const char *t)
+int str_start(const char *s,const char *t)
{
- register char x;
+ char x;
for (;;) {
x = *t++; if (!x) return 1; if (x != *s++) return 0;
diff --git a/stralloc.c b/src/stralloc.c
index 8c0335e..24bd068 100644
--- a/stralloc.c
+++ b/src/stralloc.c
@@ -5,11 +5,11 @@
#include "alloc.h"
/**
- @file stralloc.c
- @author djb
- @source qmail, ucspi-tcp
- @brief genious dynamic string handling
-*/
+ * @file stralloc.c
+ * @author djb
+ * @ref qmail, ucspi-tcp
+ * @brief genious dynamic string handling
+ */
int stralloc_starts(stralloc *sa,const char *s)
{
diff --git a/tai.c b/src/tai.c
index 65a8225..5ec7652 100644
--- a/tai.c
+++ b/src/tai.c
@@ -2,11 +2,11 @@
#include "tai.h"
/**
- @file tai.c
- @author djb
- @source qmail
- @brief 'temps atomic' time handling
-*/
+ * @file tai.c
+ * @author djb
+ * @ref qmail
+ * @brief 'temps atomic' time handling
+ */
void tai_add(struct tai *t,const struct tai *u,const struct tai *v)
{
diff --git a/taia.c b/src/taia.c
index 22bd816..92e5255 100644
--- a/taia.c
+++ b/src/taia.c
@@ -3,11 +3,11 @@
#include "taia.h"
/**
- @file taia.c
- @author djb
- @source qmail
- @brief 'tai' attosecond time handling
-*/
+ * @file taia.c
+ * @author djb
+ * @ref qmail
+ * @brief 'tai' attosecond time handling
+ */
/* XXX: breaks tai encapsulation */
diff --git a/timeout.c b/src/timeout.c
index e721b66..7d3f0b2 100644
--- a/timeout.c
+++ b/src/timeout.c
@@ -4,11 +4,12 @@
#include "timeout.h"
/**
- @file timeout.c
- @author djb
- @source qmail
- @brief read/write timeout handling
-*/
+ * @file timeout.c
+ * @author djb
+ * @ref qmail
+ * @brief read/write timeout handling
+ * @return same as read(2) or write(2); -1 on error
+ */
int timeoutread(int t,int fd,char *buf,int len)
{
diff --git a/timeoutconn.c b/src/timeoutconn.c
index c94f600..0702743 100644
--- a/timeoutconn.c
+++ b/src/timeoutconn.c
@@ -6,11 +6,11 @@
#include "ip.h"
/**
- @file timeoutconn.c
- @author djb, fefe, feh
- @source qmail
- @brief socket read/write timeout handling; return code of iopause considered
-*/
+ * @file timeoutconn.c
+ * @authors djb, fefe, feh
+ * @ref qmail
+ * @brief socket read/write timeout handling; return code of iopause considered
+ */
int timeoutconn4(int s,char ip[4],uint16 port,unsigned int timeout)
{
diff --git a/uint128p.c b/src/uint128p.c
index 57c713e..e109f94 100644
--- a/uint128p.c
+++ b/src/uint128p.c
@@ -1,11 +1,11 @@
#include "uint_t.h"
/**
- @file uint128p.c
- @author feh, jannis
- @source djbdns6
- @brief packing/unpacking 128 bit integer to/from char string
-*/
+ * @file uint128p.c
+ * @authors feh, jmh
+ * @ref djbdns6
+ * @brief packing/unpacking 128 bit integer to/from char string
+ */
void uint128_pack(char s[16],uint128 u)
{
diff --git a/uint16p.c b/src/uint16p.c
index 5dddf21..8d1d481 100644
--- a/uint16p.c
+++ b/src/uint16p.c
@@ -1,11 +1,11 @@
#include "uint_t.h"
/**
- @file uint16p.c
- @author djb
- @source qmail
- @brief packing/unpacking 16 bit integer to/from char string
-*/
+ * @file uint16p.c
+ * @author djb
+ * @ref qmail
+ * @brief packing/unpacking 16 bit integer to/from char string
+ */
void uint16_pack(char s[2],uint16 u)
{
diff --git a/uint32p.c b/src/uint32p.c
index f3f04ea..94327de 100644
--- a/uint32p.c
+++ b/src/uint32p.c
@@ -1,11 +1,11 @@
#include "uint_t.h"
/**
- @file uint32p.c
- @author djb
- @source qmail
- @brief packing/unpacking 32 bit integer to/from char string
-*/
+ * @file uint32p.c
+ * @author djb
+ * @ref qmail
+ * @brief packing/unpacking 32 bit integer to/from char string
+ */
void uint32_pack(char s[4],uint32 u)
{
diff --git a/uint64p.c b/src/uint64p.c
index 41b8ceb..b6f1988 100644
--- a/uint64p.c
+++ b/src/uint64p.c
@@ -1,11 +1,11 @@
#include "uint_t.h"
/**
- @file uint64p.c
- @author feh, jannis
- @source djbdns6
- @brief packing/unpacking 64 bit integer to/from char string
-*/
+ * @file uint64p.c
+ * @authors feh, jmh
+ * @ref djbdns6
+ * @brief packing/unpacking 64 bit integer to/from char string
+ */
void uint64_pack(char s[8],uint64 u)
{
diff --git a/uint8p.c b/src/uint8p.c
index a7a1460..3a41560 100644
--- a/uint8p.c
+++ b/src/uint8p.c
@@ -1,10 +1,10 @@
#include "uint_t.h"
/**
- @file uint8x.c
- @author feh
- @brief packing/unpacking 8 bit int to/from char string
-*/
+ * @file uint8p.c
+ * @author feh
+ * @brief packing/unpacking 8 bit int to/from char string
+ */
void uint8_pack(char s[2],uint8 u)
{
diff --git a/wait.c b/src/wait.c
index 869a120..4043a4f 100644
--- a/wait.c
+++ b/src/wait.c
@@ -3,11 +3,11 @@
#include "logmsg.h"
/**
- @file wait.c
- @author djb
- @source qmail
- @brief wait for forked processes
-*/
+ * @file wait.c
+ * @author djb
+ * @ref qmail
+ * @brief wait for forked processes
+ */
int wait_nohang(int *wstat)
{