bglibs-2.04/0000775000076400007640000000000013244040127012243 5ustar bruceguenterbglibs-2.04/TARGETS0000664000076400007640000003056513244040126013307 0ustar bruceguenteradt/adt_sp.lo adt/adt_sp.o adt/ghash_add.lo adt/ghash_add.o adt/ghash_foreach.lo adt/ghash_foreach.o adt/ghash_free.lo adt/ghash_free.o adt/ghash_get.lo adt/ghash_get.o adt/ghash_init.lo adt/ghash_init.o adt/ghash_insert.lo adt/ghash_insert.o adt/ghash_iter.lo adt/ghash_iter.o adt/ghash_rebuild.lo adt/ghash_rebuild.o adt/ghash_rehash.lo adt/ghash_rehash.o adt/ghash_remove.lo adt/ghash_remove.o adt/ghash_search.lo adt/ghash_search.o adt/ghash_set.lo adt/ghash_set.o adt/gqueue_pop.lo adt/gqueue_pop.o adt/gqueue_push.lo adt/gqueue_push.o adt/gqueue_top.lo adt/gqueue_top.o adt/gstack_pop.lo adt/gstack_pop.o adt/gstack_push.lo adt/gstack_push.o adt/gstack_top.lo adt/gstack_top.o adt/hashb.lo adt/hashb.o adt/hashs.lo adt/hashs.o all base64/asc2bin.lo base64/asc2bin.o base64/bin2asc.lo base64/bin2asc.o base64/decode_line.lo base64/decode_line.o base64/decode_part.lo base64/decode_part.o base64/encode_line.lo base64/encode_line.o base64/encode_part.lo base64/encode_part.o bg-installer bg-installer-cli.c bg-installer-cli.h bg-installer-cli.o bg-installer.1 bg-installer.o cdb/cdb.lo cdb/cdb.o cdb/cdbhash.lo cdb/cdbhash.o cdb/find.lo cdb/find.o cdb/get.lo cdb/get.o cdb/getnext.lo cdb/getnext.o cdb/make.lo cdb/make.o cdb/read.lo cdb/read.o choose clean clean-spac cli-generate cli/help.lo cli/help.o cli/main.lo cli/main.o compile crc-gentab crc-gentab.o crc/crc16_arc_table.c crc/crc16_arc_table.lo crc/crc16_arc_table.o crc/crc16_ccitt_table.c crc/crc16_ccitt_table.lo crc/crc16_ccitt_table.o crc/crc16_xmodem_table.c crc/crc16_xmodem_table.lo crc/crc16_xmodem_table.o crc/crc32_table.c crc/crc32_table.lo crc/crc32_table.o crc/crc32c_table.c crc/crc32c_table.lo crc/crc32c_table.o crc/crc64_table.c crc/crc64_table.lo crc/crc64_table.o crc/gcrc16fwd.lo crc/gcrc16fwd.o crc/gcrc16rfl.lo crc/gcrc16rfl.o crc/gcrc32fwd.lo crc/gcrc32fwd.o crc/gcrc32rfl.lo crc/gcrc32rfl.o crc/gcrc64fwd.lo crc/gcrc64fwd.o crc/gcrc64rfl.lo crc/gcrc64rfl.o crypto/hmac-md5.lo crypto/hmac-md5.o crypto/hmac-sha1.lo crypto/hmac-sha1.o crypto/hmac-sha256.lo crypto/hmac-sha256.o crypto/hmac-sha384.lo crypto/hmac-sha384.o crypto/hmac-sha512.lo crypto/hmac-sha512.o crypto/hmac.lo crypto/hmac.o crypto/md4.lo crypto/md4.o crypto/md5-crypt.lo crypto/md5-crypt.o crypto/md5.lo crypto/md5.o crypto/sha1.lo crypto/sha1.o crypto/sha256.lo crypto/sha256.o crypto/sha384.lo crypto/sha384.o crypto/sha512.lo crypto/sha512.o crypto/surf.lo crypto/surf.o crypto/surfrand.lo crypto/surfrand.o dict/add.lo dict/add.o dict/dicthash.lo dict/dicthash.o dict/foreach.lo dict/foreach.o dict/free.lo dict/free.o dict/get.lo dict/get.o dict/init.lo dict/init.o dict/load_list.lo dict/load_list.o dict/load_map.lo dict/load_map.o dict/str_free.lo dict/str_free.o dl.lib fmt/char.lo fmt/char.o fmt/chars.lo fmt/chars.o fmt/lcase.lo fmt/lcase.o fmt/multi.lo fmt/multi.o fmt/pad.lo fmt/pad.o fmt/sdec.lo fmt/sdec.o fmt/sign_pad.lo fmt/sign_pad.o fmt/slldec.lo fmt/slldec.o fmt/sllnum.lo fmt/sllnum.o fmt/snum.lo fmt/snum.o fmt/ucase.lo fmt/ucase.o fmt/udec.lo fmt/udec.o fmt/uhexl.lo fmt/uhexl.o fmt/uhexu.lo fmt/uhexu.o fmt/ulldec.lo fmt/ulldec.o fmt/ullhexl.lo fmt/ullhexl.o fmt/ullhexu.lo fmt/ullhexu.o fmt/ullnum.lo fmt/ullnum.o fmt/unum.lo fmt/unum.o install iobuf/ibuf_copytofd.lo iobuf/ibuf_copytofd.o iobuf/ibuf_getc.lo iobuf/ibuf_getc.o iobuf/ibuf_getnetstring.lo iobuf/ibuf_getnetstring.o iobuf/ibuf_gets.lo iobuf/ibuf_gets.o iobuf/ibuf_getstr.lo iobuf/ibuf_getstr.o iobuf/ibuf_getstr_crlf.lo iobuf/ibuf_getstr_crlf.o iobuf/ibuf_getu.lo iobuf/ibuf_getu.o iobuf/ibuf_init.lo iobuf/ibuf_init.o iobuf/ibuf_open.lo iobuf/ibuf_open.o iobuf/ibuf_openreadclose.lo iobuf/ibuf_openreadclose.o iobuf/ibuf_peek.lo iobuf/ibuf_peek.o iobuf/ibuf_read.lo iobuf/ibuf_read.o iobuf/ibuf_readall.lo iobuf/ibuf_readall.o iobuf/ibuf_refill.lo iobuf/ibuf_refill.o iobuf/ibuf_seek.lo iobuf/ibuf_seek.o iobuf/ibuf_status.lo iobuf/ibuf_status.o iobuf/ibuf_stdin.lo iobuf/ibuf_stdin.o iobuf/ibuf_tell.lo iobuf/ibuf_tell.o iobuf/iobuf_close.lo iobuf/iobuf_close.o iobuf/iobuf_copy.lo iobuf/iobuf_copy.o iobuf/iobuf_init.lo iobuf/iobuf_init.o iobuf/iobuf_timeout.lo iobuf/iobuf_timeout.o iobuf/obuf_close.lo iobuf/obuf_close.o iobuf/obuf_copyfromfd.lo iobuf/obuf_copyfromfd.o iobuf/obuf_digits.lo iobuf/obuf_digits.o iobuf/obuf_endl.lo iobuf/obuf_endl.o iobuf/obuf_flush.lo iobuf/obuf_flush.o iobuf/obuf_init.lo iobuf/obuf_init.o iobuf/obuf_open.lo iobuf/obuf_open.o iobuf/obuf_pad.lo iobuf/obuf_pad.o iobuf/obuf_put2s.lo iobuf/obuf_put2s.o iobuf/obuf_put3s.lo iobuf/obuf_put3s.o iobuf/obuf_put4s.lo iobuf/obuf_put4s.o iobuf/obuf_put5s.lo iobuf/obuf_put5s.o iobuf/obuf_put6s.lo iobuf/obuf_put6s.o iobuf/obuf_put7s.lo iobuf/obuf_put7s.o iobuf/obuf_putc.lo iobuf/obuf_putc.o iobuf/obuf_putf.lo iobuf/obuf_putf.o iobuf/obuf_putnetstring.lo iobuf/obuf_putnetstring.o iobuf/obuf_putns.lo iobuf/obuf_putns.o iobuf/obuf_putsflush.lo iobuf/obuf_putsflush.o iobuf/obuf_putsllnumw.lo iobuf/obuf_putsllnumw.o iobuf/obuf_putsnumw.lo iobuf/obuf_putsnumw.o iobuf/obuf_putullnumw.lo iobuf/obuf_putullnumw.o iobuf/obuf_putunumw.lo iobuf/obuf_putunumw.o iobuf/obuf_seek.lo iobuf/obuf_seek.o iobuf/obuf_sign_pad.lo iobuf/obuf_sign_pad.o iobuf/obuf_stderr.lo iobuf/obuf_stderr.o iobuf/obuf_stdout.lo iobuf/obuf_stdout.o iobuf/obuf_sync.lo iobuf/obuf_sync.o iobuf/obuf_write.lo iobuf/obuf_write.o libbg-cli.la libbg.la libpwcmp-module.la libpwcmp.la libraries libvmailmgr.la load ltcompile ltload makeshlib man misc/random.lo misc/random.o misc/strtou.lo misc/strtou.o misc/ucspi.lo misc/ucspi.o misc/utoa.lo misc/utoa.o misc/utoa2.lo misc/utoa2.o msg/common.lo msg/common.o msg/commonf.lo msg/commonf.o msg/debug.lo msg/debug.o msg/debug_bits.lo msg/debug_bits.o msg/debug_init.lo msg/debug_init.o msg/debugf.lo msg/debugf.o msg/die.lo msg/die.o msg/dief.lo msg/dief.o msg/error.lo msg/error.o msg/errorf.lo msg/errorf.o msg/oom.lo msg/oom.o msg/show_pid.lo msg/show_pid.o msg/warn.lo msg/warn.o msg/warnf.lo msg/warnf.o msg/wrap_alloc.lo msg/wrap_alloc.o msg/wrap_chdir.lo msg/wrap_chdir.o msg/wrap_exit.lo msg/wrap_exit.o msg/wrap_str.lo msg/wrap_str.o net/accept4.lo net/accept4.o net/accept6.lo net/accept6.o net/acceptu.lo net/acceptu.o net/bind4.lo net/bind4.o net/bind6.lo net/bind6.o net/bindu.lo net/bindu.o net/broadcast.lo net/broadcast.o net/connect4.lo net/connect4.o net/connect4_timeout.lo net/connect4_timeout.o net/connect6.lo net/connect6.o net/connect6_timeout.lo net/connect6_timeout.o net/connected.lo net/connected.o net/connectu.lo net/connectu.o net/connectu_timeout.lo net/connectu_timeout.o net/cork.lo net/cork.o net/dns_domain.lo net/dns_domain.o net/dns_domain_fromdot.lo net/dns_domain_fromdot.o net/dns_domain_todot.lo net/dns_domain_todot.o net/dns_fmt.lo net/dns_fmt.o net/dns_ip4.lo net/dns_ip4.o net/dns_ip6.lo net/dns_ip6.o net/dns_mx.lo net/dns_mx.o net/dns_name4.lo net/dns_name4.o net/dns_name4_domain.lo net/dns_name4_domain.o net/dns_name6.lo net/dns_name6.o net/dns_name6_domain.lo net/dns_name6_domain.o net/dns_name_packet.lo net/dns_name_packet.o net/dns_packet.lo net/dns_packet.o net/dns_qualify.lo net/dns_qualify.o net/dns_random.lo net/dns_random.o net/dns_resolvconfip.lo net/dns_resolvconfip.o net/dns_resolvconfrewrite.lo net/dns_resolvconfrewrite.o net/dns_resolve.lo net/dns_resolve.o net/dns_result.lo net/dns_result.o net/dns_rotate.lo net/dns_rotate.o net/dns_sort.lo net/dns_sort.o net/dns_transmit.lo net/dns_transmit.o net/dns_txt.lo net/dns_txt.o net/getaddr4.lo net/getaddr4.o net/getaddr6.lo net/getaddr6.o net/ipv4_addr.lo net/ipv4_addr.o net/ipv4_format.lo net/ipv4_format.o net/ipv4_scan.lo net/ipv4_scan.o net/ipv6_addr.lo net/ipv6_addr.o net/ipv6_format.lo net/ipv6_format.o net/ipv6_scan.lo net/ipv6_scan.o net/linger.lo net/linger.o net/listen.lo net/listen.o net/notcpdelay.lo net/notcpdelay.o net/pairdgm.lo net/pairdgm.o net/pairstr.lo net/pairstr.o net/recv4.lo net/recv4.o net/recv6.lo net/recv6.o net/recvfd.lo net/recvfd.o net/recvu.lo net/recvu.o net/resolve_calldns.lo net/resolve_calldns.o net/resolve_ipv4addr.lo net/resolve_ipv4addr.o net/resolve_ipv4name.lo net/resolve_ipv4name.o net/reuse.lo net/reuse.o net/send4.lo net/send4.o net/send6.lo net/send6.o net/sendfd.lo net/sendfd.o net/sendu.lo net/sendu.o net/shutdown.lo net/shutdown.o net/tcp4.lo net/tcp4.o net/tcp6.lo net/tcp6.o net/udp4.lo net/udp4.o net/udp6.lo net/udp6.o net/uncork.lo net/uncork.o net/unixdgm.lo net/unixdgm.o net/unixstr.lo net/unixstr.o path/contains.lo path/contains.o path/fnmatch.lo path/fnmatch.o path/match.lo path/match.o path/merge.lo path/merge.o path/mkdirs.lo path/mkdirs.o path/mktemp.lo path/mktemp.o perl-head.pl programs pwcmp/client.lo pwcmp/client.o pwcmp/hex_encode.lo pwcmp/hex_encode.o pwcmp/module.lo pwcmp/module.o rt.lib selftest-cmp selftest-cmp.o selftests str/alloc.lo str/alloc.o str/buildmap.lo str/buildmap.o str/case_end.lo str/case_end.o str/case_glob.lo str/case_glob.o str/case_match.lo str/case_match.o str/case_start.lo str/case_start.o str/cat.lo str/cat.o str/cat2s.lo str/cat2s.o str/cat3s.lo str/cat3s.o str/cat4s.lo str/cat4s.o str/cat5s.lo str/cat5s.o str/cat6s.lo str/cat6s.o str/catf.lo str/catf.o str/catiw.lo str/catiw.o str/catiwll.lo str/catiwll.o str/catns.lo str/catns.o str/catsllnum.lo str/catsllnum.o str/catsnum.lo str/catsnum.o str/catullnum.lo str/catullnum.o str/catunum.lo str/catunum.o str/catuw.lo str/catuw.o str/catuwll.lo str/catuwll.o str/catxw.lo str/catxw.o str/catxwll.lo str/catxwll.o str/cmp.lo str/cmp.o str/copy.lo str/copy.o str/copy2s.lo str/copy2s.o str/copy3s.lo str/copy3s.o str/copy4s.lo str/copy4s.o str/copy5s.lo str/copy5s.o str/copy6s.lo str/copy6s.o str/copyf.lo str/copyf.o str/copyns.lo str/copyns.o str/count.lo str/count.o str/countof.lo str/countof.o str/cut.lo str/cut.o str/diff.lo str/diff.o str/digits.lo str/digits.o str/end.lo str/end.o str/env_find.lo str/env_find.o str/env_from_array.lo str/env_from_array.o str/env_from_string.lo str/env_from_string.o str/env_get.lo str/env_get.o str/env_make_array.lo str/env_make_array.o str/env_put.lo str/env_put.o str/env_set.lo str/env_set.o str/env_unset.lo str/env_unset.o str/findnext.lo str/findnext.o str/findnextof.lo str/findnextof.o str/findprev.lo str/findprev.o str/findprevof.lo str/findprevof.o str/free.lo str/free.o str/glob.lo str/glob.o str/init.lo str/init.o str/iter_advance.lo str/iter_advance.o str/iter_start.lo str/iter_start.o str/iter_valid.lo str/iter_valid.o str/join.lo str/join.o str/lower.lo str/lower.o str/lstrip.lo str/lstrip.o str/match.lo str/match.o str/rstrip.lo str/rstrip.o str/sort.lo str/sort.o str/splice.lo str/splice.o str/start.lo str/start.o str/subst.lo str/subst.o str/truncate.lo str/truncate.o str/upper.lo str/upper.o str/xlate.lo str/xlate.o sys/clock_gettime.lo sys/clock_gettime.o sys/getpeereid.lo sys/getpeereid.o sys/iopoll.lo sys/iopoll.o sys/setenv.lo sys/setenv.o sys/unsetenv.lo sys/unsetenv.o sysdeps.h systime.h uint16/get.lo uint16/get.o uint16/pack.lo uint16/pack.o uint16/unpack.lo uint16/unpack.o uint32/get_lsb.lo uint32/get_lsb.o uint32/get_msb.lo uint32/get_msb.o uint32/pack_lsb.lo uint32/pack_lsb.o uint32/pack_msb.lo uint32/pack_msb.o uint32/unpack_lsb.lo uint32/unpack_lsb.o uint32/unpack_msb.lo uint32/unpack_msb.o uint64/get_lsb.lo uint64/get_lsb.o uint64/get_msb.lo uint64/get_msb.o uint64/pack_lsb.lo uint64/pack_lsb.o uint64/pack_msb.lo uint64/pack_msb.o uint64/unpack_lsb.lo uint64/unpack_lsb.o uint64/unpack_msb.lo uint64/unpack_msb.o unix/cloexec_off.lo unix/cloexec_off.o unix/cloexec_on.lo unix/cloexec_on.o unix/fcntl_fd_off.lo unix/fcntl_fd_off.o unix/fcntl_fd_on.lo unix/fcntl_fd_on.o unix/fcntl_fl_off.lo unix/fcntl_fl_off.o unix/fcntl_fl_on.lo unix/fcntl_fl_on.o unix/nonblock_off.lo unix/nonblock_off.o unix/nonblock_on.lo unix/nonblock_on.o unix/selfpipe.lo unix/selfpipe.o unix/sig_alarm.lo unix/sig_alarm.o unix/sig_all.lo unix/sig_all.o unix/sig_block.lo unix/sig_block.o unix/sig_bug.lo unix/sig_bug.o unix/sig_catch.lo unix/sig_catch.o unix/sig_child.lo unix/sig_child.o unix/sig_hup.lo unix/sig_hup.o unix/sig_int.lo unix/sig_int.o unix/sig_misc.lo unix/sig_misc.o unix/sig_pipe.lo unix/sig_pipe.o unix/sig_quit.lo unix/sig_quit.o unix/sig_suspend.lo unix/sig_suspend.o unix/sig_term.lo unix/sig_term.o unix/signalfd.lo unix/signalfd.o unix/trigger_pull.lo unix/trigger_pull.o unix/trigger_set.lo unix/trigger_set.o vmailmgr/req_arg.lo vmailmgr/req_arg.o vmailmgr/req_init.lo vmailmgr/req_init.o vmailmgr/req_write.lo vmailmgr/req_write.o vmailmgr/resp_read.lo vmailmgr/resp_read.o vmailmgr/vpwentry_export.lo vmailmgr/vpwentry_export.o vmailmgr/vpwentry_free.lo vmailmgr/vpwentry_free.o vmailmgr/vpwentry_import.lo vmailmgr/vpwentry_import.o bglibs-2.04/conf-ld0000664000076400007640000000010613244040126013504 0ustar bruceguentergcc -g This will be used to link .o and .a files into an executable. bglibs-2.04/FILES0000664000076400007640000003744213244040126013041 0ustar bruceguenterANNOUNCEMENT AUTOFILES COPYING ChangeLog FILES INSTHIER LIBVERSION Makefile NEWS README SRCFILES TARGETS TODO VERSION adt/adt_sp.c adt/ghash_add.c adt/ghash_foreach.c adt/ghash_free.c adt/ghash_get.c adt/ghash_init.c adt/ghash_insert.c adt/ghash_iter.c adt/ghash_rebuild.c adt/ghash_rehash.c adt/ghash_remove.c adt/ghash_search.c adt/ghash_set.c adt/gqueue_pop.c adt/gqueue_push.c adt/gqueue_top.c adt/gstack_pop.c adt/gstack_push.c adt/gstack_top.c adt/hashb.c adt/hashs.c base64/asc2bin.c base64/bin2asc.c base64/decode_line.c base64/decode_part.c base64/encode_line.c base64/encode_part.c bg-installer-cli.c bg-installer-cli.h bg-installer.1 bg-installer.c bg-installer.cli bglibs-2.04.spec cdb/cdb.c cdb/cdbhash.c cdb/find.c cdb/get.c cdb/getnext.c cdb/make.c cdb/make.h cdb/read.c choose.sh cli-generate.1 cli-generate.pl cli/help.c cli/internal.h cli/main.c conf-bin conf-cc conf-include conf-ld conf-lib conf-man config.dxy crc-gentab.c crc/gcrc16fwd.c crc/gcrc16rfl.c crc/gcrc32fwd.c crc/gcrc32rfl.c crc/gcrc64fwd.c crc/gcrc64rfl.c crypto/hmac-md5.c crypto/hmac-sha1.c crypto/hmac-sha256.c crypto/hmac-sha384.c crypto/hmac-sha512.c crypto/hmac.c crypto/md4.c crypto/md5-crypt.c crypto/md5.c crypto/sha1.c crypto/sha256.c crypto/sha384.c crypto/sha512.c crypto/surf.c crypto/surfrand.c dict/add.c dict/dicthash.c dict/foreach.c dict/free.c dict/get.c dict/init.c dict/load_list.c dict/load_map.c dict/str_free.c dns-responder.c doc/html/adt_2ghash_test_8c-example.html doc/html/adt_2gqueue_test_8c-example.html doc/html/adt_2gstack_test_8c-example.html doc/html/adt__common_8h_source.html doc/html/annotated.html doc/html/base64_8h_source.html doc/html/bc_s.png doc/html/bdwn.png doc/html/cdb_8h_source.html doc/html/classes.html doc/html/cli_8h_source.html doc/html/closed.png doc/html/cmsg_8h_source.html doc/html/crc16__arc_8h_source.html doc/html/crc16__ccitt_8h_source.html doc/html/crc16__xmodem_8h_source.html doc/html/crc32_8h_source.html doc/html/crc32c_8h_source.html doc/html/crc64_8h_source.html doc/html/debug_8h_source.html doc/html/deprecated.html doc/html/dict_8h_source.html doc/html/dir_427baa8a9a5be237f298d4545d0d1ce2.html doc/html/dir_53403d93963d3f5d2fcffd0698f5bddb.html doc/html/dir_7e9e3a9dba0f8bf2fb326009354b80c2.html doc/html/dir_9ffb71a7992048c062aba831ce1b5b79.html doc/html/dir_a8dbd272f2688e4af1ebe53563b7574a.html doc/html/dir_b348de9074e53a33afe52e16e180f86e.html doc/html/dir_c882bb6fa009938b7b09c7ff2cbfbf0e.html doc/html/dir_d44c64559bbebec7f509842c48db8b23.html doc/html/dir_f8ab57e0d469b48445b5dfd63bafd7af.html doc/html/dns_8h_source.html doc/html/doc.png doc/html/doxygen.css doc/html/doxygen.png doc/html/dynsections.js doc/html/envstr_8h_source.html doc/html/examples.html doc/html/files.html doc/html/fmt_8h_source.html doc/html/folderclosed.png doc/html/folderopen.png doc/html/functions.html doc/html/functions_vars.html doc/html/gcrc_8h_source.html doc/html/ghash_8h_source.html doc/html/gqueue_8h_source.html doc/html/group__adt.html doc/html/group__adt__ghash.html doc/html/group__adt__gqueue.html doc/html/group__adt__gstack.html doc/html/group__crypto.html doc/html/group__dns.html doc/html/group__envstr.html doc/html/group__fmt.html doc/html/group__ibuf.html doc/html/group__iobuf.html doc/html/group__ipv4.html doc/html/group__ipv6.html doc/html/group__obuf.html doc/html/group__path.html doc/html/group__resolve.html doc/html/group__selfpipe.html doc/html/group__signalfd.html doc/html/group__socket.html doc/html/group__str.html doc/html/group__striter.html doc/html/group__surfrand.html doc/html/group__trigger.html doc/html/gstack_8h_source.html doc/html/hmac_8h_source.html doc/html/ibuf_8h_source.html doc/html/index.html doc/html/iobuf_8h_source.html doc/html/iobuf__common_8h_source.html doc/html/ipv4_8h_source.html doc/html/ipv6_8h_source.html doc/html/jquery.js doc/html/md4_8h_source.html doc/html/md5_8h_source.html doc/html/menu.js doc/html/menudata.js doc/html/misc_8h_source.html doc/html/modules.html doc/html/msg_8h_source.html doc/html/nav_f.png doc/html/nav_g.png doc/html/nav_h.png doc/html/obuf_8h_source.html doc/html/open.png doc/html/pages.html doc/html/path_8h_source.html doc/html/resolve_8h_source.html doc/html/selfpipe_8h_source.html doc/html/sha1_8h_source.html doc/html/sha256_8h_source.html doc/html/sha384_8h_source.html doc/html/sha512_8h_source.html doc/html/sig_8h_source.html doc/html/signalfd_8h_source.html doc/html/socket_8h_source.html doc/html/splitbar.png doc/html/str_8h_source.html doc/html/striter_8h_source.html doc/html/structSHA1__CTX.html doc/html/structSHA256__ctx.html doc/html/structSHA512__ctx.html doc/html/structcdb.html doc/html/structcdb__make.html doc/html/structcli__option.html doc/html/structcli__stringlist.html doc/html/structdict.html doc/html/structdict__entry.html doc/html/structdns__mx.html doc/html/structdns__result.html doc/html/structdns__transmit.html doc/html/structghash.html doc/html/structghashiter.html doc/html/structgqueue.html doc/html/structgqueue__node.html doc/html/structgstack.html doc/html/structgstack__node.html doc/html/structhmac__control__block.html doc/html/structibuf.html doc/html/structiobuf.html doc/html/structipv4addr.html doc/html/structipv6addr.html doc/html/structmd4__ctx.html doc/html/structmd5__ctx.html doc/html/structobuf.html doc/html/structstr.html doc/html/structstr__sortentry.html doc/html/structstriter.html doc/html/structsurfrand.html doc/html/surf_8h_source.html doc/html/surfrand_8h_source.html doc/html/sync_off.png doc/html/sync_on.png doc/html/tab_a.png doc/html/tab_b.png doc/html/tab_h.png doc/html/tab_s.png doc/html/tabs.css doc/html/trigger_8h_source.html doc/html/ucspi_8h_source.html doc/html/uniondns__result__rrs.html doc/html/unix_8h_source.html doc/html/wrap_8h_source.html doc/latex/Makefile doc/latex/adt_2ghash_test_8c-example.tex doc/latex/adt_2gqueue_test_8c-example.tex doc/latex/adt_2gstack_test_8c-example.tex doc/latex/annotated.tex doc/latex/deprecated.tex doc/latex/dir_427baa8a9a5be237f298d4545d0d1ce2.tex doc/latex/dir_53403d93963d3f5d2fcffd0698f5bddb.tex doc/latex/dir_7e9e3a9dba0f8bf2fb326009354b80c2.tex doc/latex/dir_9ffb71a7992048c062aba831ce1b5b79.tex doc/latex/dir_a8dbd272f2688e4af1ebe53563b7574a.tex doc/latex/dir_b348de9074e53a33afe52e16e180f86e.tex doc/latex/dir_c882bb6fa009938b7b09c7ff2cbfbf0e.tex doc/latex/dir_d44c64559bbebec7f509842c48db8b23.tex doc/latex/dir_f8ab57e0d469b48445b5dfd63bafd7af.tex doc/latex/doxygen.sty doc/latex/examples.tex doc/latex/group__adt.tex doc/latex/group__adt__ghash.tex doc/latex/group__adt__gqueue.tex doc/latex/group__adt__gstack.tex doc/latex/group__crypto.tex doc/latex/group__dns.tex doc/latex/group__envstr.tex doc/latex/group__fmt.tex doc/latex/group__ibuf.tex doc/latex/group__iobuf.tex doc/latex/group__ipv4.tex doc/latex/group__ipv6.tex doc/latex/group__obuf.tex doc/latex/group__path.tex doc/latex/group__resolve.tex doc/latex/group__selfpipe.tex doc/latex/group__signalfd.tex doc/latex/group__socket.tex doc/latex/group__str.tex doc/latex/group__striter.tex doc/latex/group__surfrand.tex doc/latex/group__trigger.tex doc/latex/modules.tex doc/latex/refman.tex doc/latex/structSHA1__CTX.tex doc/latex/structSHA256__ctx.tex doc/latex/structSHA512__ctx.tex doc/latex/structcdb.tex doc/latex/structcdb__make.tex doc/latex/structcli__option.tex doc/latex/structcli__stringlist.tex doc/latex/structdict.tex doc/latex/structdict__entry.tex doc/latex/structdns__mx.tex doc/latex/structdns__result.tex doc/latex/structdns__transmit.tex doc/latex/structghash.tex doc/latex/structghashiter.tex doc/latex/structgqueue.tex doc/latex/structgqueue__node.tex doc/latex/structgstack.tex doc/latex/structgstack__node.tex doc/latex/structhmac__control__block.tex doc/latex/structibuf.tex doc/latex/structiobuf.tex doc/latex/structipv4addr.tex doc/latex/structipv6addr.tex doc/latex/structmd4__ctx.tex doc/latex/structmd5__ctx.tex doc/latex/structobuf.tex doc/latex/structstr.tex doc/latex/structstr__sortentry.tex doc/latex/structstriter.tex doc/latex/structsurfrand.tex doc/latex/uniondns__result__rrs.tex doc/qualify.html doc/qualify.txt doc/template.cli fmt/char.c fmt/chars.c fmt/lcase.c fmt/multi.c fmt/pad.c fmt/sdec.c fmt/sign_pad.c fmt/slldec.c fmt/sllnum.c fmt/snum.c fmt/ucase.c fmt/udec.c fmt/uhexl.c fmt/uhexu.c fmt/ulldec.c fmt/ullhexl.c fmt/ullhexu.c fmt/ullnum.c fmt/unum.c include/bglibs include/bglibs/adt_common.h include/bglibs/base64.h include/bglibs/bglibs/str.h include/bglibs/cdb.h include/bglibs/cli.h include/bglibs/crc16_arc.h include/bglibs/crc16_ccitt.h include/bglibs/crc16_xmodem.h include/bglibs/crc32.h include/bglibs/crc32c.h include/bglibs/crc64.h include/bglibs/debug.h include/bglibs/dict.h include/bglibs/dns.h include/bglibs/envstr.h include/bglibs/fmt.h include/bglibs/gcrc.h include/bglibs/ghash.h include/bglibs/gqueue.h include/bglibs/gstack.h include/bglibs/hmac.h include/bglibs/ibuf.h include/bglibs/iobuf.h include/bglibs/iobuf_common.h include/bglibs/ipv4.h include/bglibs/ipv6.h include/bglibs/md4.h include/bglibs/md5.h include/bglibs/misc.h include/bglibs/msg.h include/bglibs/obuf.h include/bglibs/path.h include/bglibs/resolve.h include/bglibs/selfpipe.h include/bglibs/sha1.h include/bglibs/sha256.h include/bglibs/sha384.h include/bglibs/sha512.h include/bglibs/sig.h include/bglibs/signalfd.h include/bglibs/socket.h include/bglibs/str.h include/bglibs/striter.h include/bglibs/surf.h include/bglibs/surfrand.h include/bglibs/trigger.h include/bglibs/ucspi.h include/bglibs/unix.h include/bglibs/wrap.h include/fmt.h include/gcrc.h include/ibuf.h include/iobuf.h include/iobuf_common.h include/ipv4.h include/ipv6.h include/obuf.h include/path.h include/str.h iobuf/ibuf_copytofd.c iobuf/ibuf_getc.c iobuf/ibuf_getnetstring.c iobuf/ibuf_gets.c iobuf/ibuf_getstr.c iobuf/ibuf_getstr_crlf.c iobuf/ibuf_getu.c iobuf/ibuf_init.c iobuf/ibuf_open.c iobuf/ibuf_openreadclose.c iobuf/ibuf_peek.c iobuf/ibuf_read.c iobuf/ibuf_readall.c iobuf/ibuf_refill.c iobuf/ibuf_seek.c iobuf/ibuf_status.c iobuf/ibuf_stdin.c iobuf/ibuf_tell.c iobuf/iobuf_close.c iobuf/iobuf_copy.c iobuf/iobuf_init.c iobuf/iobuf_timeout.c iobuf/obuf_close.c iobuf/obuf_copyfromfd.c iobuf/obuf_digits.c iobuf/obuf_endl.c iobuf/obuf_flush.c iobuf/obuf_init.c iobuf/obuf_open.c iobuf/obuf_pad.c iobuf/obuf_put2s.c iobuf/obuf_put3s.c iobuf/obuf_put4s.c iobuf/obuf_put5s.c iobuf/obuf_put6s.c iobuf/obuf_put7s.c iobuf/obuf_putc.c iobuf/obuf_putf.c iobuf/obuf_putnetstring.c iobuf/obuf_putns.c iobuf/obuf_putsflush.c iobuf/obuf_putsllnumw.c iobuf/obuf_putsnumw.c iobuf/obuf_putullnumw.c iobuf/obuf_putunumw.c iobuf/obuf_seek.c iobuf/obuf_sign_pad.c iobuf/obuf_stderr.c iobuf/obuf_stdout.c iobuf/obuf_sync.c iobuf/obuf_write.c misc/random.c misc/strtou.c misc/ucspi.c misc/utoa.c misc/utoa2.c msg/common.c msg/commonf.c msg/debug.c msg/debug_bits.c msg/debug_init.c msg/debugf.c msg/die.c msg/dief.c msg/error.c msg/errorf.c msg/oom.c msg/show_pid.c msg/warn.c msg/warnf.c msg/wrap_alloc.c msg/wrap_chdir.c msg/wrap_exit.c msg/wrap_str.c net/accept4.c net/accept6.c net/acceptu.c net/bind4.c net/bind6.c net/bindu.c net/broadcast.c net/cmsg.h net/connect4.c net/connect4_timeout.c net/connect6.c net/connect6_timeout.c net/connected.c net/connectu.c net/connectu_timeout.c net/cork.c net/dns_domain.c net/dns_domain_fromdot.c net/dns_domain_todot.c net/dns_fmt.c net/dns_ip4.c net/dns_ip6.c net/dns_mx.c net/dns_name4.c net/dns_name4_domain.c net/dns_name6.c net/dns_name6_domain.c net/dns_name_packet.c net/dns_packet.c net/dns_qualify.c net/dns_random.c net/dns_resolvconfip.c net/dns_resolvconfrewrite.c net/dns_resolve.c net/dns_result.c net/dns_rotate.c net/dns_sort.c net/dns_transmit.c net/dns_txt.c net/getaddr4.c net/getaddr6.c net/ipv4_addr.c net/ipv4_format.c net/ipv4_scan.c net/ipv6_addr.c net/ipv6_format.c net/ipv6_scan.c net/linger.c net/listen.c net/notcpdelay.c net/pairdgm.c net/pairstr.c net/recv4.c net/recv6.c net/recvfd.c net/recvu.c net/resolve_calldns.c net/resolve_ipv4addr.c net/resolve_ipv4name.c net/reuse.c net/send4.c net/send6.c net/sendfd.c net/sendu.c net/shutdown.c net/tcp4.c net/tcp6.c net/udp4.c net/udp6.c net/uncork.c net/unixdgm.c net/unixstr.c path/contains.c path/fnmatch.c path/match.c path/merge.c path/mkdirs.c path/mktemp.c pwcmp/client.c pwcmp/client.h pwcmp/hex.h pwcmp/hex_encode.c pwcmp/module.c pwcmp/module.h selftest-cmp.c selftest.c selftests.sh str/alloc.c str/buildmap.c str/case_end.c str/case_glob.c str/case_match.c str/case_start.c str/cat.c str/cat2s.c str/cat3s.c str/cat4s.c str/cat5s.c str/cat6s.c str/catf.c str/catiw.c str/catiwll.c str/catns.c str/catsllnum.c str/catsnum.c str/catullnum.c str/catunum.c str/catuw.c str/catuwll.c str/catxw.c str/catxwll.c str/cmp.c str/copy.c str/copy2s.c str/copy3s.c str/copy4s.c str/copy5s.c str/copy6s.c str/copyf.c str/copyns.c str/count.c str/countof.c str/cut.c str/diff.c str/digits.c str/end.c str/env_find.c str/env_from_array.c str/env_from_string.c str/env_get.c str/env_make_array.c str/env_put.c str/env_set.c str/env_unset.c str/findnext.c str/findnextof.c str/findprev.c str/findprevof.c str/free.c str/glob.c str/init.c str/iter_advance.c str/iter_start.c str/iter_valid.c str/join.c str/lower.c str/lstrip.c str/match.c str/rstrip.c str/sort.c str/splice.c str/start.c str/subst.c str/truncate.c str/upper.c str/xlate.c sys/clock_gettime.c sys/getpeereid.c sys/hasattribute.h0 sys/hasattribute.h1 sys/hasclockgettime.h0 sys/hasclockgettime.h1 sys/hasdaylight.h0 sys/hasdaylight.h1 sys/hasdeprecated.h0 sys/hasdeprecated.h1 sys/hasdirent.h0 sys/hasdirent.h1 sys/hasdirentino.h0 sys/hasdirentino.h1 sys/hasdirenttype.h0 sys/hasdirenttype.h1 sys/hasdl.h0 sys/hasdl.h1 sys/hasendian.h0 sys/hasendian.h1 sys/hasflock.h0 sys/hasflock.h1 sys/hasgetpeereid.h0 sys/hasgetpeereid.h1 sys/hasinline.h0 sys/hasinline.h1 sys/hasipv6.h0 sys/hasipv6.h1 sys/hasmkfifo.h0 sys/hasmkfifo.h1 sys/hasnamedpipebug.h0 sys/hasnamedpipebug.h1 sys/hasnoreturn.h0 sys/hasnoreturn.h1 sys/haspeercred.h0 sys/haspeercred.h1 sys/haspoll.h0 sys/haspoll.h1 sys/hassendfile.h0 sys/hassendfile.h1 sys/hassetenv.h0 sys/hassetenv.h1 sys/hassigaction.h0 sys/hassigaction.h1 sys/hassigprocmask.h0 sys/hassigprocmask.h1 sys/hasspnam.h0 sys/hasspnam.h1 sys/hassysselect.h0 sys/hassysselect.h1 sys/hastimespec.h0 sys/hastimespec.h1 sys/hasulong32.h0 sys/hasulong32.h1 sys/hasulong64.h0 sys/hasulong64.h1 sys/hasunaligned.h0 sys/hasunaligned.h1 sys/hasunsetenv.h0 sys/hasunsetenv.h1 sys/hasuserpw.h0 sys/hasuserpw.h1 sys/hasvfork.h0 sys/hasvfork.h1 sys/haswaitp.h0 sys/haswaitp.h1 sys/haszlib.h0 sys/haszlib.h1 sys/iopoll.c sys/setenv.c sys/tryattribute.c sys/tryclockgettime.c sys/trydaylight.c sys/trydeprecated.c sys/trydirent.c sys/trydirentino.c sys/trydirenttype.c sys/trydl.c sys/tryendian.c sys/tryflock.c sys/trygetpeereid.c sys/tryinline.c sys/tryipv6.c sys/trymkfifo.c sys/trynamedpipebug.c sys/trynoreturn.c sys/trypeercred.c sys/trypoll.c sys/trysendfile.c sys/trysetenv.c sys/trysigaction.c sys/trysigprocmask.c sys/tryspnam.c sys/trysysselect.c sys/trysystime.c sys/trytime.c sys/trytimespec.c sys/tryulong32.c sys/tryulong64.c sys/tryunaligned.c sys/tryunsetenv.c sys/tryuserpw.c sys/tryvfork.c sys/trywaitp.c sys/tryzlib.c sys/unsetenv.c sysdeps-head.h sysdeps-tail.h uint16.h uint16/get.c uint16/pack.c uint16/unpack.c uint32.h uint32/get_lsb.c uint32/get_msb.c uint32/pack_lsb.c uint32/pack_msb.c uint32/unpack_lsb.c uint32/unpack_msb.c uint64.h uint64/get_lsb.c uint64/get_msb.c uint64/pack_lsb.c uint64/pack_msb.c uint64/unpack_lsb.c uint64/unpack_msb.c uintnn.h unix/cloexec_off.c unix/cloexec_on.c unix/fcntl_fd_off.c unix/fcntl_fd_on.c unix/fcntl_fl_off.c unix/fcntl_fl_on.c unix/nonblock_off.c unix/nonblock_on.c unix/selfpipe.c unix/sig_alarm.c unix/sig_all.c unix/sig_block.c unix/sig_bug.c unix/sig_catch.c unix/sig_child.c unix/sig_hup.c unix/sig_int.c unix/sig_misc.c unix/sig_pipe.c unix/sig_quit.c unix/sig_suspend.c unix/sig_term.c unix/signalfd.c unix/trigger_pull.c unix/trigger_set.c vmailmgr/client.h vmailmgr/req_arg.c vmailmgr/req_init.c vmailmgr/req_write.c vmailmgr/resp_read.c vmailmgr/vpwentry.h vmailmgr/vpwentry_export.c vmailmgr/vpwentry_free.c vmailmgr/vpwentry_import.c warn-auto.sh bglibs-2.04/bg-installer.10000664000076400007640000000672113244040126014715 0ustar bruceguenter.\" This file was automatically generated from bg-installer.cli, do not edit. .TH bg-installer 1 .SH NAME bg-installer \- Standardized installer program. .SH SYNOPSIS .B bg-installer .I \fR[\fItop-directory\fR]\fI ", if present, instruct bg-installer as to which base directory to use (see below). All other lines must have following format: .RS .nf CMD:[OWNER]:[GROUP]:MODE:DIR[:FILENAME[:SOURCE]] .fi .RE .TP \fICMD\fR is a single character specifying the installation command, optionally followed by "?" indicating the command should only execute if the source exists. If the "?" is followed by a name, it is used instead of \fISOURCE\fR as the filename to test. .TP \fIOWNER\fR (optional) is the owner user ID or name for the target file. .TP \fIGROUP\fR (optional) is the group ID or name for the target file. .TP \fIMODE\fR is the permissions of the installed file in octal. .TP \fIDIR\fR is the subdirectory of the installation prefix for the destination file. .TP \fIFILENAME\fR (optional) is the name of the file to install into the directory. It may be omitted for directories. .TP \fISOURCE\fR (optional) is the name of the source file to install, if it differs from the destination file, or the path in the symlink. .PP If \fISOURCE\fR contains wildcards, the command is repeated once for each matching filename. If \fIFILENAME\fR is empty, it is replaced with the value of \fISOURCE\fR after wildcard expansion. Each instance of "$N" in \fIFILENAME\fR where "N" is a single digit is replaced with the Nth part of the source filename. "$0" is replaced with the whole source filename. The target filename is "PREFIX/TOP/DIR/FILENAME" where "PREFIX" is the value of \fI$install_prefix\fR if it is set, \fITOP\fR is the directory given on the command line, and \fIDIR\fR and \fIFILENAME\fR given in the installation file. .TP o "c" lines copy regular files from the current directory .TP o "d" lines create directories .TP o "s" lines create symlinks (\fIUID\fR, \fIGID\fR, and \fIMODE\fR are ignored) .TP o "l" lines copy libraries using libtool .PP When \fBbg-installer\fR encounters a base directory directive, as indicated above, it opens the file named \fIconf-BASE\fR (where \fIBASE\fR is the word on the directive line), reads the first line, and uses that as the base directory (prefixed by \fI$install_prefix\fR as above). .SH OPTIONS .TP .B -v, --verbose List the files as they are processed. .TP .B -n, --dry-run Don't modify any files, just display. .TP .B -c, --check Check destinations instead of installing. .TP .B -h, --help Display usage information and exit. .SH EXAMPLES .RS .nf >bin c:::755::prog2 c?:root:root:4750::prog2 >include d:::755:package c:::644:package:base.h:pkgbase.h s:::::package.h:package/base.h .fi .RE This reads \fIconf-bin\fR, and installs \fIprog1\fR and setuid root \fIprog2\fR (if it was built) under it. It then reads \fIconf-include\fR, creates the directory \fIpackage\fR under it, and installs \fIpkgbase.h\fR as \fIbase.h\fR in that directory. It also creates a symlink \fIpackage.h\fR to \fIpackage/base.h\fR. .SH ENVIRONMENT .TP \fIinstall_prefix\fR If set, is prefixed to all destination file names. .SH AUTHOR Bruce Guenter bglibs-2.04/misc/0000755000076400007640000000000013244040127013174 5ustar bruceguenterbglibs-2.04/misc/ucspi.c0000664000076400007640000000247513244040127014475 0ustar bruceguenter#include #include #include "ucspi.h" static const char* proto; static unsigned protolen; static char* vartmp; #define MAXNAME 20 const char* ucspi_protocol(void) { if (proto == 0 && (proto = getenv("PROTO")) != 0) { protolen = strlen(proto); vartmp = malloc(protolen + MAXNAME+1); memcpy(vartmp, proto, protolen); memset(vartmp + protolen, 0, MAXNAME+1); } return proto; } const char* ucspi_getenv(const char* name) { if (ucspi_protocol() == 0) return 0; strncpy(vartmp + protolen, name, MAXNAME); return getenv(vartmp); } #ifdef SELFTEST_MAIN void put(const char* s) { obuf_puts(&outbuf, s); NL(); } MAIN { setenv("PROTO", "xyzzy", 1); setenv("xyzzyLOCALIP", "1.2.3.4", 1); setenv("xyzzyREMOTEIP", "5.6.7.8", 1); setenv("xyzzyLOCALHOST", "1.host.net", 1); setenv("xyzzyREMOTEHOST", "2.host.net", 1); setenv("xyzzy0123456789012345678", "19", 1); setenv("xyzzy01234567890123456789", "20", 1); setenv("xyzzy012345678901234567890", "21", 1); setenv("xyzzy012345678901234567890123456789", "30", 1); put(ucspi_protocol()); put(ucspi_localip()); put(ucspi_remoteip()); put(ucspi_localhost()); put(ucspi_remotehost()); put(ucspi_getenv("012345678901234567890123456789")); } #endif #ifdef SELFTEST_EXP xyzzy 1.2.3.4 5.6.7.8 1.host.net 2.host.net 20 #endif bglibs-2.04/misc/random.c0000664000076400007640000001542013244040127014624 0ustar bruceguenter/* This is the ``Mersenne Twister'' random number generator MT19937, which * generates pseudorandom integers uniformly distributed in 0..(2^32 - 1) * starting from any odd seed in 0..(2^32 - 1). This version is a recode * by Shawn Cokus (Cokus@math.washington.edu) on March 8, 1998 of a version by * Takuji Nishimura (who had suggestions from Topher Cooper and Marc Rieffel in * July-August 1997). * * Effectiveness of the recoding (on Goedel2.math.washington.edu, a DEC Alpha * running OSF/1) using GCC -O3 as a compiler: before recoding: 51.6 sec. to * generate 300 million random numbers; after recoding: 24.0 sec. for the same * (i.e., 46.5% of original time), so speed is now about 12.5 million random * number generations per second on this machine. * * According to the URL * (and paraphrasing a bit in places), the Mersenne Twister is ``designed * with consideration of the flaws of various existing generators,'' has * a period of 2^19937 - 1, gives a sequence that is 623-dimensionally * equidistributed, and ``has passed many stringent tests, including the * die-hard test of G. Marsaglia and the load test of P. Hellekalek and * S. Wegenkittl.'' It is efficient in memory usage (typically using 2506 * to 5012 bytes of static data, depending on data type sizes, and the code * is quite short as well). It generates random numbers in batches of 624 * at a time, so the caching and pipelining of modern systems is exploited. * It is also divide- and mod-free. * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Library General Public License as published by * the Free Software Foundation (either version 2 of the License or, at your * option, any later version). This library is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY, without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See * the GNU Library General Public License for more details. You should have * received a copy of the GNU Library General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple * Place, Suite 330, Boston, MA 02111-1307, USA. * * The code as Shawn received it included the following notice: * * Copyright (C) 1997 Makoto Matsumoto and Takuji Nishimura. When * you use this, send an e-mail to with * an appropriate reference to your work. * * It would be nice to CC: when you write. */ #include #include #include "sysdeps.h" #include "systime.h" #include "fmt.h" #define N (624) /* length of state vector */ #define M (397) /* a period parameter */ #define K (0x9908B0DFU) /* a magic constant */ #define hiBit(u) ((u) & 0x80000000U) /* mask all but highest bit of u */ #define loBit(u) ((u) & 0x00000001U) /* mask all but lowest bit of u */ #define loBits(u) ((u) & 0x7FFFFFFFU) /* mask the highest bit of u */ #define mixBits(u, v) (hiBit(u)|loBits(v)) /* move hi bit of u to hi bit of v */ static uint32 state[N+1]; /* state vector + 1 extra to not violate ANSI C */ static uint32 *next; /* next random value is computed from here */ static int left = -1; /* can *next++ this many times before reloading */ static void seedMT(uint32 seed) { /* * We initialize state[0..(N-1)] via the generator * * x_new = (69069 * x_old) mod 2^32 * * from Line 15 of Table 1, p. 106, Sec. 3.3.4 of Knuth's * _The Art of Computer Programming_, Volume 2, 3rd ed. * * Notes (SJC): I do not know what the initial state requirements * of the Mersenne Twister are, but it seems this seeding generator * could be better. It achieves the maximum period for its modulus * (2^30) iff x_initial is odd (p. 20-21, Sec. 3.2.1.2, Knuth); if * x_initial can be even, you have sequences like 0, 0, 0, ...; * 2^31, 2^31, 2^31, ...; 2^30, 2^30, 2^30, ...; 2^29, 2^29 + 2^31, * 2^29, 2^29 + 2^31, ..., etc. so I force seed to be odd below. * * Even if x_initial is odd, if x_initial is 1 mod 4 then * * the lowest bit of x is always 1, * the next-to-lowest bit of x is always 0, * the 2nd-from-lowest bit of x alternates ... 0 1 0 1 0 1 0 1 ... , * the 3rd-from-lowest bit of x 4-cycles ... 0 1 1 0 0 1 1 0 ... , * the 4th-from-lowest bit of x has the 8-cycle ... 0 0 0 1 1 1 1 0 ... , * ... * * and if x_initial is 3 mod 4 then * * the lowest bit of x is always 1, * the next-to-lowest bit of x is always 1, * the 2nd-from-lowest bit of x alternates ... 0 1 0 1 0 1 0 1 ... , * the 3rd-from-lowest bit of x 4-cycles ... 0 0 1 1 0 0 1 1 ... , * the 4th-from-lowest bit of x has the 8-cycle ... 0 0 1 1 1 1 0 0 ... , * ... * * The generator's potency (min. s>=0 with (69069-1)^s = 0 mod 2^32) is * 16, which seems to be alright by p. 25, Sec. 3.2.1.3 of Knuth. It * also does well in the dimension 2..5 spectral tests, but it could be * better in dimension 6 (Line 15, Table 1, p. 106, Sec. 3.3.4, Knuth). * * Note that the random number user does not see the values generated * here directly since reloadMT() will always munge them first, so maybe * none of all of this matters. In fact, the seed values made here could * even be extra-special desirable if the Mersenne Twister theory says * so-- that's why the only change I made is to restrict to odd seeds. */ register uint32 x = (seed | 1U) & 0xFFFFFFFFU, *s = state; register int j; for(left=0, *s++=x, j=N; --j; *s++ = (x*=69069U) & 0xFFFFFFFFU); } void random_init(uint32 seed) { if (seed == 0) { struct timeval t; pid_t pid = getpid(); pid_t ppid = getppid(); gettimeofday(&t, 0); seed = t.tv_sec ^ t.tv_usec ^ (t.tv_usec << 12) ^ pid ^ (pid << 16) ^ ppid ^ (ppid << 16); } seedMT(seed); } static uint32 reloadMT(void) { register uint32 *p0=state, *p2=state+2, *pM=state+M, s0, s1; register int j; if (left < -1) random_init(4357U); left=N-1, next=state+1; for(s0=state[0], s1=state[1], j=N-M+1; --j; s0=s1, s1=*p2++) *p0++ = *pM++ ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0U); for(pM=state, j=M; --j; s0=s1, s1=*p2++) *p0++ = *pM++ ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0U); s1 = state[0], *p0 = *pM ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0U); s1 ^= (s1 >> 11); s1 ^= (s1 << 7) & 0x9D2C5680U; s1 ^= (s1 << 15) & 0xEFC60000U; return s1 ^ (s1 >> 18); } uint32 random_int(void) { uint32 y; if(--left < 0) return reloadMT(); y = *next++; y ^= (y >> 11); y ^= (y << 7) & 0x9D2C5680U; y ^= (y << 15) & 0xEFC60000U; return y ^ (y >> 18); } bglibs-2.04/misc/utoa.c0000664000076400007640000000120413244040127014307 0ustar bruceguenter#include "fmt.h" static char utoa_buf[32]; const char* utoa(unsigned long i) { char* ptr = utoa_buf + sizeof utoa_buf - 1; *ptr-- = 0; while (i >= 10) { *ptr-- = (i % 10) + '0'; i /= 10; } *ptr = i + '0'; return ptr; } #ifdef SELFTEST_MAIN void test(unsigned long u) { obuf_putf(&outbuf, "{utoa(}lu{) = '}s{'}", u, utoa(u)); NL(); } MAIN { test(0); test(1); test(11); test(0x7fffffffUL); test(0x80000000UL); test(0xffffffffUL); } #endif #ifdef SELFTEST_EXP utoa(0) = '0' utoa(1) = '1' utoa(11) = '11' utoa(2147483647) = '2147483647' utoa(2147483648) = '2147483648' utoa(4294967295) = '4294967295' #endif bglibs-2.04/misc/strtou.c0000664000076400007640000000110213244040127014674 0ustar bruceguenter#include "fmt.h" unsigned long strtou(const char* s, const char** end) { unsigned long u; unsigned digit; for (u = 0; (digit = *s - '0') <= 9; ++s) u = u * 10 + digit; *end = s; return u; } #ifdef SELFTEST_MAIN void test(const char* s) { const char* end; unsigned long u; u = strtou(s, &end); obuf_putf(&outbuf, "{u=}lu{ end='}s{'}", u, end); NL(); } MAIN { test(""); test("0"); test("1"); test("1111f"); test("-12"); test("f"); } #endif #ifdef SELFTEST_EXP u=0 end='' u=0 end='' u=1 end='' u=1111 end='f' u=0 end='-12' u=0 end='f' #endif bglibs-2.04/misc/utoa2.c0000664000076400007640000000102213244040127014367 0ustar bruceguenter#include "fmt.h" char* utoa2(unsigned long i, char* buf) { if (i < 10) *buf = i + '0'; else { buf = utoa2(i / 10, buf); *buf = (i % 10) + '0'; } *++buf = 0; return buf; } #ifdef SELFTEST_MAIN void test(unsigned long u) { char buf[32]; char* ptr; ptr = utoa2(u, buf); obuf_write(&outbuf, buf, ptr - buf); NL(); } MAIN { test(0); test(1); test(11); test(0x7fffffffUL); test(0x80000000UL); test(0xffffffffUL); } #endif #ifdef SELFTEST_EXP 0 1 11 2147483647 2147483648 4294967295 #endif bglibs-2.04/conf-man0000664000076400007640000000021413244040127013661 0ustar bruceguenter/usr/local/man Man pages will be installed in subdirectories of this directory. An unformatted man page foo.1 will go into .../man1/foo.1. bglibs-2.04/sys/0000755000076400007640000000000013244040127013057 5ustar bruceguenterbglibs-2.04/sys/tryvfork.c0000664000076400007640000000003313244040127015107 0ustar bruceguentervoid main() { vfork(); } bglibs-2.04/sys/iopoll.c0000664000076400007640000000224313244040127014524 0ustar bruceguenter#include #include "sysdeps.h" #ifdef IOPOLL_SELECT int iopoll(iopoll_fd* fds, unsigned nfds, unsigned long timeout) { struct timeval tv; fd_set rfds; fd_set wfds; int fdmax; iopoll_fd* io; int fd; unsigned i; int r; FD_ZERO(&rfds); FD_ZERO(&wfds); for (fdmax = 0, i = 0, io = fds; i < nfds; ++i, ++io) { fd = io->fd; if (fd < 0) continue; if (fd >= fdmax) fdmax = fd + 1; if (io->events & IOPOLL_READ) FD_SET(fd, &rfds); if (io->events & IOPOLL_WRITE) FD_SET(fd, &wfds); } tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout % 1000) * 1000; if ((r = select(fdmax, &rfds, &wfds, (fd_set*)0, &tv)) <= 0) return r; for (i = 0, io = fds; i < nfds; ++i, ++io) { fd = io->fd; if (fd < 0) continue; if ((io->events & IOPOLL_READ) && FD_ISSET(fd, &rfds)) io->revents |= IOPOLL_READ; if ((io->events & IOPOLL_WRITE) && FD_ISSET(fd, &wfds)) io->revents |= IOPOLL_WRITE; } return r; } #endif int iopoll_restart(iopoll_fd* fds, unsigned nfds, unsigned long timeout) { int f; while ((f = iopoll(fds, nfds, timeout)) == -1) if (errno != EAGAIN && errno != EINTR) break; return f; } bglibs-2.04/sys/hasflock.h00000664000076400007640000000003113244040127015076 0ustar bruceguenter/* sysdep: -hasflock */ bglibs-2.04/sys/hasdirentino.h00000664000076400007640000000005613244040127016002 0ustar bruceguenter/* sysdep: -dirent_ino */ #undef HASDIRENTINO bglibs-2.04/sys/hasipv6.h10000664000076400007640000000005113244040127014667 0ustar bruceguenter/* sysdep: +hasipv6 */ #define HASIPV6 1 bglibs-2.04/sys/hasclockgettime.h00000664000076400007640000000037513244040127016465 0ustar bruceguenter/* sysdep: -clock_gettime */ #undef HASCLOCKGETTIME typedef int clockid_t; #define CLOCK_REALTIME 1 #define CLOCK_MONOTONIC 2 #define CLOCK_PROESS_CPUTIME_ID 3 #define CLOCK_THREAD_PUTIME_ID 4 int clock_getres(clockid_t clk_id, struct timespec *res); bglibs-2.04/sys/hassendfile.h10000664000076400007640000000007113244040127015576 0ustar bruceguenter/* sysdep: +linux_sendfile */ #define HASLINUXSENDFILE 1 bglibs-2.04/sys/hasunaligned.h00000664000076400007640000000006713244040127015757 0ustar bruceguenter/* sysdep: -unaligned */ #undef HAS_UNALIGNED_ACCESSES bglibs-2.04/sys/trysigprocmask.c0000664000076400007640000000021613244040127016305 0ustar bruceguenter#include main() { sigset_t ss; sigemptyset(&ss); sigaddset(&ss,SIGCHLD); sigprocmask(SIG_SETMASK,&ss,(sigset_t *) 0); } bglibs-2.04/sys/haswaitp.h00000664000076400007640000000002713244040127015131 0ustar bruceguenter/* sysdep: -waitpid */ bglibs-2.04/sys/trypeercred.c0000664000076400007640000000031513244040127015554 0ustar bruceguenter#define _GNU_SOURCE 1 #include #include int main() { struct ucred peer; int optlen = sizeof(peer); getsockopt(0, SOL_SOCKET, SO_PEERCRED, &peer, &optlen); return 0; } bglibs-2.04/sys/haszlib.h00000664000076400007640000000002713244040127014745 0ustar bruceguenter/* sysdep: -haszlib */ bglibs-2.04/sys/trysysselect.c0000664000076400007640000000015613244040127016004 0ustar bruceguenter#include #include #include /* SVR4 silliness */ void foo() { ; } bglibs-2.04/sys/hassigprocmask.h10000664000076400007640000000006413244040127016331 0ustar bruceguenter/* sysdep: +sigprocmask */ #define HASSIGPROCMASK 1 bglibs-2.04/sys/tryattribute.c0000664000076400007640000000004713244040127015770 0ustar bruceguenterint symbol __attribute__((__const__)); bglibs-2.04/sys/hasvfork.h10000664000076400007640000000014713244040127015140 0ustar bruceguenter#ifndef FORK_H #define FORK_H /* sysdep: +vfork */ extern pid_t fork(); extern pid_t vfork(); #endif bglibs-2.04/sys/hasdl.h10000664000076400007640000000004513244040127014405 0ustar bruceguenter/* sysdep: +hasdl */ #define HASDL 1 bglibs-2.04/sys/hasunaligned.h10000664000076400007640000000007213244040127015754 0ustar bruceguenter/* sysdep: +unaligned */ #define HAS_UNALIGNED_ACCESSES 1 bglibs-2.04/sys/hasdeprecated.h00000664000076400007640000000006413244040127016106 0ustar bruceguenter/* sysdep: -hasdeprecated */ #define __DEPRECATED__ bglibs-2.04/sys/hastimespec.h10000664000076400007640000000005613244040127015621 0ustar bruceguenter/* sysdep: +timespec */ #define HASTIMESPEC 1 bglibs-2.04/sys/haswaitp.h10000664000076400007640000000005413244040127015132 0ustar bruceguenter/* sysdep: +waitpid */ #define HASWAITPID 1 bglibs-2.04/sys/hassigprocmask.h00000664000076400007640000000003313244040127016324 0ustar bruceguenter/* sysdep: -sigprocmask */ bglibs-2.04/sys/hasspnam.h10000664000076400007640000000005313244040127015123 0ustar bruceguenter/* sysdep: +hasspnam */ #define HASSPNAM 1 bglibs-2.04/sys/hasvfork.h00000664000076400007640000000014413244040127015134 0ustar bruceguenter#ifndef FORK_H #define FORK_H /* sysdep: -vfork */ extern pid_t fork(); #define vfork fork #endif bglibs-2.04/sys/clock_gettime.c0000664000076400007640000000050613244040127016037 0ustar bruceguenter#include "sysdeps.h" #ifndef HASCLOCKGETTIME #include int clock_gettime(clockid_t clk_id, struct timespec* tp) { struct timeval tv; if (clk_id != CLOCK_REALTIME) { errno = EINVAL; return -1; } gettimeofday(&tv, 0); tp->tv_sec = tv.tv_sec; tp->tv_nsec = tv.tv_usec * 1000; return 0; } #endif bglibs-2.04/sys/setenv.c0000664000076400007640000000073413244040127014535 0ustar bruceguenter#include #include #include "sysdeps.h" #ifndef HASSETENV int setenv(const char* name, const char* value, int overwrite) { char* newenv; size_t namelen; size_t valuelen; if (!overwrite && getenv(name)) return 0; namelen = strlen(name); valuelen = strlen(value); newenv = malloc(namelen+1+valuelen+1); memcpy(newenv, name, namelen); newenv[namelen] = '='; memcpy(newenv+namelen+1, value, valuelen+1); return putenv(newenv); } #endif bglibs-2.04/sys/trywaitp.c0000664000076400007640000000012013244040127015101 0ustar bruceguenter#include #include void main() { waitpid(0,0,0); } bglibs-2.04/sys/hasmkfifo.h10000664000076400007640000000005513244040127015262 0ustar bruceguenter/* sysdep: +hasmkfifo */ #define HASMKFIFO 1 bglibs-2.04/sys/hasclockgettime.h10000664000076400007640000000006713244040127016464 0ustar bruceguenter/* sysdep: +clock_gettime */ #define HASCLOCKGETTIME 1 bglibs-2.04/sys/hasulong64.h00000664000076400007640000000011513244040127015301 0ustar bruceguenter/* sysdep: -ulong64 */ #undef HAS_ULONG64 typedef unsigned long long uint64; bglibs-2.04/sys/tryulong64.c0000664000076400007640000000051713244040127015265 0ustar bruceguentermain() { unsigned long u; u = 1; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; if (!u) _exit(1); _exit(0); } bglibs-2.04/sys/tryspnam.c0000664000076400007640000000014613244040127015103 0ustar bruceguenter#include void main() { struct spwd *spw; spw = getspnam(""); puts(spw->sp_pwdp); } bglibs-2.04/sys/haspoll.h10000664000076400007640000000037313244040127014760 0ustar bruceguenter/* sysdep: +poll */ #define IOPOLL_POLL #include typedef struct pollfd iopoll_fd; #define IOPOLL_READ POLLIN #define IOPOLL_WRITE POLLOUT #define iopoll poll extern int iopoll_restart(iopoll_fd* fds, unsigned nfds, unsigned long timeout); bglibs-2.04/sys/trysetenv.c0000664000076400007640000000011313244040127015263 0ustar bruceguenter#include int main() { setenv("FOO", "bar", 1); return 0; } bglibs-2.04/sys/tryulong32.c0000664000076400007640000000052413244040127015256 0ustar bruceguentervoid main() { unsigned long u; u = 1; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u; if (!u) _exit(0); _exit(1); } bglibs-2.04/sys/hasmkfifo.h00000664000076400007640000000003213244040127015254 0ustar bruceguenter/* sysdep: -hasmkfifo */ bglibs-2.04/sys/hasendian.h10000664000076400007640000000010013244040127015234 0ustar bruceguenter/* sysdep: endian=msb */ #undef ENDIAN_LSB #define ENDIAN_MSB 1 bglibs-2.04/sys/trydaylight.c0000664000076400007640000000007213244040127015570 0ustar bruceguenterextern int daylight; int main(void) { return daylight; } bglibs-2.04/sys/trytimespec.c0000664000076400007640000000005213244040127015572 0ustar bruceguenter#include "systime.h" struct timespec ts; bglibs-2.04/sys/trynamedpipebug.c0000664000076400007640000000072413244040127016427 0ustar bruceguenter#include #include #include #include int main(void) { const char filename[] = ".tmp.fifo"; int hasbug; struct timeval tv; fd_set rfds; int fd; if (mknod(filename, S_IFIFO | 0600, 0) != 0) return 1; fd = open(filename, O_RDONLY | O_NDELAY); FD_ZERO(&rfds); FD_SET(fd,&rfds); tv.tv_sec = tv.tv_usec = 0; hasbug = select(fd+1, &rfds, 0, 0, &tv) > 0; unlink(filename); return hasbug ? 0 : 1; } bglibs-2.04/sys/trydirentino.c0000664000076400007640000000013313244040127015754 0ustar bruceguenter#include #include void foo() { struct dirent *d; d->d_ino; } bglibs-2.04/sys/trysendfile.c0000664000076400007640000000022113244040127015550 0ustar bruceguenter#include #include #include void main(void) { int x; x = __NR_sendfile; sendfile(0, 1, 0, 0); } bglibs-2.04/sys/hasnoreturn.h10000664000076400007640000000011613244040127015661 0ustar bruceguenter/* sysdep: +hasnoreturn */ #define __NORETURN__ __attribute__((__noreturn__)) bglibs-2.04/sys/hassendfile.h00000664000076400007640000000003613244040127015576 0ustar bruceguenter/* sysdep: -linux_sendfile */ bglibs-2.04/sys/hasdaylight.h00000664000076400007640000000005313244040127015611 0ustar bruceguenter/* sysdep: -daylight */ #define daylight 1 bglibs-2.04/sys/tryuserpw.c0000664000076400007640000000015413244040127015311 0ustar bruceguenter#include void main() { struct userpw *upw; upw = getuserpw(""); puts(upw->upw_passwd); } bglibs-2.04/sys/haszlib.h10000664000076400007640000000005113244040127014743 0ustar bruceguenter/* sysdep: +haszlib */ #define HASZLIB 1 bglibs-2.04/sys/hasnoreturn.h00000664000076400007640000000006013244040127015656 0ustar bruceguenter/* sysdep: -hasnoreturn */ #define __NORETURN__ bglibs-2.04/sys/hasinline.h10000664000076400007640000000005313244040127015263 0ustar bruceguenter/* sysdep: +hasinline */ #define HASINLINE bglibs-2.04/sys/tryendian.c0000664000076400007640000000006713244040127015225 0ustar bruceguenterint main(void) { int x = 1; return *((char*)&x); } bglibs-2.04/sys/hasdeprecated.h10000664000076400007640000000012413244040127016104 0ustar bruceguenter/* sysdep: +hasdeprecated */ #define __DEPRECATED__ __attribute__((__deprecated__)) bglibs-2.04/sys/hasdirent.h10000664000076400007640000000021613244040127015273 0ustar bruceguenter#ifndef DIRENTRY_H #define DIRENTRY_H /* sysdep: -direct */ /* sysdep: +dirent */ #include #define direntry struct dirent #endif bglibs-2.04/sys/hasspnam.h00000664000076400007640000000003113244040127015116 0ustar bruceguenter/* sysdep: -hasspnam */ bglibs-2.04/sys/hasgetpeereid.h00000664000076400007640000000011413244040127016117 0ustar bruceguenter/* sysdep: -getpeereid */ extern int getpeereid(int s, uid_t* u, gid_t* g); bglibs-2.04/sys/hassigaction.h10000664000076400007640000000006013244040127015763 0ustar bruceguenter/* sysdep: +sigaction */ #define HASSIGACTION 1 bglibs-2.04/sys/tryclockgettime.c0000664000076400007640000000016113244040127016434 0ustar bruceguenter#include "systime.h" int main(void) { struct timespec ts; return clock_gettime(CLOCK_REALTIME, &ts) != 0; } bglibs-2.04/sys/hasattribute.h10000664000076400007640000000003413244040127016007 0ustar bruceguenter/* sysdep: +hasattribute */ bglibs-2.04/sys/hasunsetenv.h00000664000076400007640000000011513244040127015652 0ustar bruceguenter/* sysdep: -unsetenv */ #undef HASUNSETENV void unsetenv(const char* name); bglibs-2.04/sys/trydirenttype.c0000664000076400007640000000013413244040127016151 0ustar bruceguenter#include #include void foo() { struct dirent *d; d->d_type; } bglibs-2.04/sys/hassysselect.h00000664000076400007640000000016013244040127016021 0ustar bruceguenter#ifndef SELECT_H #define SELECT_H /* sysdep: -sysselect */ #include extern int select(); #endif bglibs-2.04/sys/hasdirenttype.h10000664000076400007640000000006413244040127016176 0ustar bruceguenter/* sysdep: +dirent_type */ #define HASDIRENTTYPE 1 bglibs-2.04/sys/trynoreturn.c0000664000076400007640000000005213244040127015635 0ustar bruceguenterint symbol __attribute__((__noreturn__)); bglibs-2.04/sys/unsetenv.c0000664000076400007640000000054613244040127015101 0ustar bruceguenter#include #include "sysdeps.h" #ifndef HASUNSETENV void unsetenv(const char *name) { extern char** environ; if (name) { unsigned long len = strlen(name); char** p = environ; while (*p) { if (strncmp(*p, name, len) == 0 && (*p)[len] == '=') { do *p = *(p + 1); while (*++p); } else ++p; } } } #endif bglibs-2.04/sys/trypoll.c0000664000076400007640000000042313244040127014731 0ustar bruceguenter#include #include #include int main() { struct pollfd x; x.fd = open("sys/trypoll.c",O_RDONLY); if (x.fd == -1) _exit(111); x.events = POLLIN; if (poll(&x,1,10) == -1) _exit(1); if (x.revents != POLLIN) _exit(1); _exit(0); } bglibs-2.04/sys/hasinline.h00000664000076400007640000000003213244040127015257 0ustar bruceguenter/* sysdep: -hasinline */ bglibs-2.04/sys/trydirent.c0000664000076400007640000000013313244040127015246 0ustar bruceguenter#include #include void foo() { DIR *dir; struct dirent *d; } bglibs-2.04/sys/hasuserpw.h00000664000076400007640000000003213244040127015326 0ustar bruceguenter/* sysdep: -hasuserpw */ bglibs-2.04/sys/hasattribute.h00000664000076400007640000000006513244040127016012 0ustar bruceguenter/* sysdep: -hasattribute */ #define __attribute__(X) bglibs-2.04/sys/hasulong32.h10000664000076400007640000000006513244040127015301 0ustar bruceguenter/* sysdep: +ulong32 */ typedef unsigned long uint32; bglibs-2.04/sys/trygetpeereid.c0000664000076400007640000000011413244040127016075 0ustar bruceguenter#include #include void main() { getpeereid(); } bglibs-2.04/sys/hasdl.h00000664000076400007640000000002513244040127014402 0ustar bruceguenter/* sysdep: -hasdl */ bglibs-2.04/sys/trydl.c0000664000076400007640000000023213244040127014360 0ustar bruceguenter#include int main(void) { void* handle; handle = dlopen("filename", 0); dlsym(handle, "symbol"); dlclose(handle); dlerror(); return 0; } bglibs-2.04/sys/trymkfifo.c0000664000076400007640000000013113244040127015232 0ustar bruceguenter#include #include int main(void) { mkfifo("nothing", 0); } bglibs-2.04/sys/hasflock.h10000664000076400007640000000005413244040127015104 0ustar bruceguenter/* sysdep: +hasflock */ #define HASFLOCK 1 bglibs-2.04/sys/haspoll.h00000664000076400007640000000047513244040127014762 0ustar bruceguenter/* sysdep: -poll */ #define IOPOLL_SELECT typedef struct { int fd; short events; short revents; } iopoll_fd; #define IOPOLL_READ 1 #define IOPOLL_WRITE 4 extern int iopoll(iopoll_fd* fds, unsigned nfds, unsigned long timeout); extern int iopoll_restart(iopoll_fd* fds, unsigned nfds, unsigned long timeout); bglibs-2.04/sys/hassysselect.h10000664000076400007640000000021013244040127016016 0ustar bruceguenter#ifndef SELECT_H #define SELECT_H /* sysdep: +sysselect */ #include #include extern int select(); #endif bglibs-2.04/sys/haspeercred.h10000664000076400007640000000014013244040127015573 0ustar bruceguenter/* sysdep: +struct ucred */ #define HASPEERCRED 1 #define _GNU_SOURCE 1 #include bglibs-2.04/sys/hasipv6.h00000664000076400007640000000002713244040127014671 0ustar bruceguenter/* sysdep: -hasipv6 */ bglibs-2.04/sys/haspeercred.h00000664000076400007640000000003413244040127015574 0ustar bruceguenter/* sysdep: -struct ucred */ bglibs-2.04/sys/tryunaligned.c0000664000076400007640000000111713244040127015732 0ustar bruceguenterint test_short(char* ptr); int test_int(char* ptr); int test_long(char* ptr); int test_longlong(char* ptr); int main(void) { long buf[2] = {0,0}; /* will be aligned */ char* ptr = ((char*)buf) + 1; /* will be unaligned */ return (test_short(ptr) + test_int(ptr) + test_long(ptr) + test_longlong(ptr)) == 10 ? 0 : 1; } int test_short(char* ptr) { return ++*((unsigned short*)ptr); } int test_int(char* ptr) { return ++*((unsigned int*)ptr); } int test_long(char* ptr) { return ++*((unsigned long*)ptr); } int test_longlong(char* ptr) { return ++*((unsigned long long*)ptr); } bglibs-2.04/sys/hassigaction.h00000664000076400007640000000003113244040127015760 0ustar bruceguenter/* sysdep: -sigaction */ bglibs-2.04/sys/trysigaction.c0000664000076400007640000000025313244040127015744 0ustar bruceguenter#include void main() { struct sigaction sa; sa.sa_handler = 0; sa.sa_flags = 0; sigemptyset(&sa.sa_mask); sigaction(0,&sa,(struct sigaction *) 0); } bglibs-2.04/sys/hasnamedpipebug.h00000664000076400007640000000004013244040127016440 0ustar bruceguenter/* sysdep: -hasnamedpipebug */ bglibs-2.04/sys/hasdaylight.h10000664000076400007640000000010313244040127015606 0ustar bruceguenter/* sysdep: +daylight */ #define HASDAYLIGHT 1 extern int daylight; bglibs-2.04/sys/trydeprecated.c0000664000076400007640000000005413244040127016063 0ustar bruceguenterint symbol __attribute__((__deprecated__)); bglibs-2.04/sys/hasdirentino.h10000664000076400007640000000006213244040127016000 0ustar bruceguenter/* sysdep: +dirent_ino */ #define HASDIRENTINO 1 bglibs-2.04/sys/tryipv6.c0000664000076400007640000000023613244040127014651 0ustar bruceguenter#include #include #include int main(void) { struct sockaddr_in6 sa; sa.sin6_family = AF_INET6; return 0; } bglibs-2.04/sys/trysystime.c0000664000076400007640000000002613244040127015457 0ustar bruceguenter#include bglibs-2.04/sys/tryflock.c0000664000076400007640000000017113244040127015061 0ustar bruceguenter#include #include #include void main() { flock(0,LOCK_EX | LOCK_UN | LOCK_NB); } bglibs-2.04/sys/trytime.c0000664000076400007640000000002213244040127014714 0ustar bruceguenter#include bglibs-2.04/sys/hasuserpw.h10000664000076400007640000000005513244040127015334 0ustar bruceguenter/* sysdep: +hasuserpw */ #define HASUSERPW 1 bglibs-2.04/sys/tryunsetenv.c0000664000076400007640000000007513244040127015635 0ustar bruceguenter#include void main(void) { unsetenv("PATH"); } bglibs-2.04/sys/hasulong32.h00000664000076400007640000000006413244040127015277 0ustar bruceguenter/* sysdep: -ulong32 */ typedef unsigned int uint32; bglibs-2.04/sys/hasulong64.h10000664000076400007640000000011313244040127015300 0ustar bruceguenter/* sysdep: +ulong64 */ #define HAS_ULONG64 1 typedef unsigned long uint64; bglibs-2.04/sys/hasdirent.h00000664000076400007640000000021713244040127015273 0ustar bruceguenter#ifndef DIRENTRY_H #define DIRENTRY_H /* sysdep: +direct */ /* sysdep: -dirent */ #include #define direntry struct direct #endif bglibs-2.04/sys/hasdirenttype.h00000664000076400007640000000006013244040127016171 0ustar bruceguenter/* sysdep: -dirent_type */ #undef HASDIRENTTYPE bglibs-2.04/sys/hassetenv.h10000664000076400007640000000007613244040127015316 0ustar bruceguenter/* sysdep: +setenv */ #define HASSETENV 1 #include bglibs-2.04/sys/getpeereid.c0000664000076400007640000000100113244040127015332 0ustar bruceguenter#include "sysdeps.h" #if ! HASGETPEEREID #include #include #include #include int getpeereid(int s, uid_t* u, gid_t* g) { #if HASPEERCRED struct ucred peer; socklen_t optlen = sizeof peer; if (getsockopt(s, SOL_SOCKET, SO_PEERCRED, &peer, &optlen) == -1) return -1; if (u != 0) *u = peer.uid; if (g != 0) *g = peer.gid; return 0; #else errno = ENOSYS; return -1; (void)s; (void)u; (void)g; #endif } #endif /* HASGETPEEREID */ bglibs-2.04/sys/tryzlib.c0000664000076400007640000000010313244040127014716 0ustar bruceguenter#include "zlib.h" int main(void) { z_stream test; return 0; } bglibs-2.04/sys/hasunsetenv.h10000664000076400007640000000005613244040127015657 0ustar bruceguenter/* sysdep: +unsetenv */ #define HASUNSETENV 1 bglibs-2.04/sys/hasendian.h00000664000076400007640000000010013244040127015233 0ustar bruceguenter/* sysdep: endian=lsb */ #define ENDIAN_LSB 1 #undef ENDIAN_MSB bglibs-2.04/sys/hasnamedpipebug.h10000664000076400007640000000007113244040127016445 0ustar bruceguenter/* sysdep: +hasnamedpipebug */ #define HASNAMEDPIPEBUG 1 bglibs-2.04/sys/hastimespec.h00000664000076400007640000000016213244040127015616 0ustar bruceguenter/* sysdep: -timespec */ struct timespec { time_t tv_sec; /* seconds */ long tv_nsec; /* nanoseconds */ }; bglibs-2.04/sys/tryinline.c0000664000076400007640000000010313244040127015234 0ustar bruceguenterinline int foo(void) { return 1; } int bar(void) { return foo(); } bglibs-2.04/sys/hasgetpeereid.h10000664000076400007640000000006213244040127016122 0ustar bruceguenter/* sysdep: +getpeereid */ #define HASGETPEEREID 1 bglibs-2.04/sys/hassetenv.h00000664000076400007640000000012613244040127015311 0ustar bruceguenter/* sysdep: -setenv */ int setenv(const char* name, const char* value, int overwrite); bglibs-2.04/selftest.c0000664000076400007640000000275113244040127014245 0ustar bruceguenter#ifndef SELFTEST_C #include #include #include #include "iobuf.h" #include "msg.h" #include "path.h" #include "str.h" const char program[] = "selftest"; const int msg_show_pid = 0; void NL(void) { obuf_putc(&outbuf, LF); obuf_flush(&outbuf); } void debugstr(const str* s) { obuf_puts(&outbuf, "len="); obuf_putu(&outbuf, s->len); obuf_puts(&outbuf, " size="); obuf_putu(&outbuf, s->size); if (s->s == 0) obuf_puts(&outbuf, " s is NULL"); else { obuf_puts(&outbuf, " s="); obuf_putstr(&outbuf, s); } NL(); } int debugstrfn(int result, const str* s) { obuf_puts(&outbuf, "result="); obuf_puti(&outbuf, result); obuf_putc(&outbuf, ' '); debugstr(s); return result; } int debugfn(int result) { obuf_puts(&outbuf, "result="); obuf_puti(&outbuf, result); NL(); return result; } int debugsys(int result) { obuf_puts(&outbuf, "result="); obuf_puti(&outbuf, result); NL(); if (result == -1) { obuf_puts(&outbuf, strerror(errno)); NL(); } return result; } void makefile(str* fn, const char* content) { long len = strlen(content); int fd = path_mktemp("./selftest.tmpfile", fn); if (fd < 0) die1(1, "Could not create temporary file"); if (write(fd, content, len) != len || close(fd) != 0) { unlink(fn->s); die1(1, "Could not write temporary file"); } } #define MAIN void selftest(void) extern MAIN; int main(void) { selftest(); obuf_flush(&outbuf); obuf_flush(&errbuf); return 0; } #endif bglibs-2.04/dict/0000755000076400007640000000000013244040127013164 5ustar bruceguenterbglibs-2.04/dict/get.c0000664000076400007640000000056213244040127014114 0ustar bruceguenter#include "dict.h" dict_entry* dict_get(dict* d, const str* s) { uint32 hash; unsigned i; dict_entry* slot; if (!d->size || !d->table) return 0; hash = dict_hashstr(s); i = hash % d->size; while ((slot = d->table[i]) != 0) { if (hash == slot->hash) if (str_diff(s, &slot->key) == 0) return slot; if (++i >= d->size) i = 0; } return 0; } bglibs-2.04/dict/dicthash.c0000664000076400007640000000033713244040127015124 0ustar bruceguenter#include "dict.h" /* Public domain hash function written by D. J. Bernstein */ uint32 dict_hashadd(uint32 h, const unsigned char* data, unsigned long len) { while (len--) h = (h + (h << 5)) ^ *data++; return h; } bglibs-2.04/dict/add.c0000664000076400007640000000464013244040127014066 0ustar bruceguenter#include #include #include "dict.h" static const unsigned size_prime_list[] = { /* The sizes were calculated as the largest prime less than a power of two. This gives them the distribution properties of primes while wasting a minimum of overhead space. The "q" below represents the smallest integer that results in a prime number. */ /* (2 ^ 5) - q */ 31U, /* (2 ^ 6) - q */ 61U, /* (2 ^ 7) - q */ 127U, /* (2 ^ 8) - q */ 251U, /* (2 ^ 9) - q */ 509U, /* (2 ^ 10) - q */ 1021U, /* (2 ^ 11) - q */ 2039U, /* (2 ^ 12) - q */ 4093U, /* (2 ^ 13) - q */ 8191U, /* (2 ^ 14) - q */ 16381U, /* (2 ^ 15) - q */ 32749U, /* (2 ^ 16) - q */ 65521U, /* (2 ^ 17) - q */ 131071U, /* (2 ^ 18) - q */ 262139U, /* (2 ^ 19) - q */ 524287U, /* (2 ^ 20) - q */ 1048573U, /* (2 ^ 21) - q */ 2097143U, /* (2 ^ 22) - q */ 4194301U, /* (2 ^ 23) - q */ 8388593U, /* (2 ^ 24) - q */ 16777213U, /* (2 ^ 25) - q */ 33554393U, /* (2 ^ 26) - q */ 67108859U, /* (2 ^ 27) - q */ 134217689U, /* (2 ^ 28) - q */ 268435399U, /* (2 ^ 29) - q */ 536870909U, /* (2 ^ 30) - q */ 1073741789U, /* (2 ^ 31) - q */ 2147483647U, /* (2 ^ 32) - q */ 4294967291U, }; static void dict_insert(dict* d, dict_entry* e) { unsigned i; for (i = e->hash % d->size; d->table[i]; i = (i + 1) % d->size) ; d->table[i] = e; ++d->count; } static int dict_grow(dict* d, unsigned count) { unsigned i; unsigned newsize; dict_entry** newtable; dict_entry** oldtable; unsigned oldsize; count *= 2; if (d->size >= count) return 1; for (i = 0; count > size_prime_list[i]; ++i) ; newsize = size_prime_list[i]; if ((newtable = malloc(newsize * sizeof *newtable)) == 0) return 0; memset(newtable, 0, newsize * sizeof *newtable); oldsize = d->size; oldtable = d->table; d->size = newsize; d->table = newtable; d->count = 0; for (i = 0; i < oldsize; i++) if (oldtable[i]) dict_insert(d, oldtable[i]); if (oldtable) free(oldtable); return 1; } int dict_add(dict* d, const str* key, void* data) { dict_entry* newe; if (!dict_grow(d, d->count + 1)) return 0; if ((newe = malloc(sizeof *newe)) == 0) return 0; memset(newe, 0, sizeof *newe); newe->hash = dict_hashstr(key); str_copy(&newe->key, key); newe->data = data; dict_insert(d, newe); return 1; } bglibs-2.04/dict/str_free.c0000664000076400007640000000020613244040127015141 0ustar bruceguenter#include #include "str.h" #include "dict.h" void dict_str_free(void* v) { str* s = (str*)v; str_free(s); free(s); } bglibs-2.04/dict/foreach.c0000664000076400007640000000044313244040127014742 0ustar bruceguenter#include #include #include "dict.h" void dict_foreach(dict* d, void (*fn)(const str* key, void** dataptr)) { unsigned i; dict_entry** entry; for (i = 0, entry = d->table; i < d->size; ++i, ++entry) if (*entry) fn(&(*entry)->key, &(*entry)->data); } bglibs-2.04/dict/init.c0000664000076400007640000000014413244040127014274 0ustar bruceguenter#include "dict.h" int dict_init(dict* d) { d->count = d->size = 0; d->table = 0; return 1; } bglibs-2.04/dict/load_map.c0000664000076400007640000000170113244040127015105 0ustar bruceguenter#include #include #include "iobuf.h" #include "str.h" #include "dict.h" int dict_load_map(dict* d, const char* filename, int mustexist, char sep, int (*keyxform)(str*), int (*valxform)(str*)) { ibuf in; unsigned i; str tmp = {0,0,0}; int result = 1; if (!dict_init(d)) return 0; if (!ibuf_open(&in, filename, 0)) return !mustexist; while (ibuf_getstr(&in, &tmp, '\n')) { str_strip(&tmp); if (tmp.len > 0 && tmp.s[0] != '#' && (i = str_findfirst(&tmp, sep)) != (unsigned)-1) { str* val; if ((val = malloc(sizeof *val)) == 0) { result = 0; break; } memset(val, 0, sizeof *val); if (!str_copyb(val, tmp.s+i+1, tmp.len-i-1) || (valxform != 0 && !valxform(val)) || !str_truncate(&tmp, i) || (keyxform != 0 && !keyxform(&tmp)) || !dict_add(d, &tmp, val)) { str_free(val); free(val); result = 0; break; } } } str_free(&tmp); ibuf_close(&in); return result; } bglibs-2.04/dict/free.c0000664000076400007640000000071713244040127014260 0ustar bruceguenter#include #include #include "dict.h" void dict_free(dict* d, void (*free_data)(void*)) { unsigned i; unsigned size = d->size; dict_entry** table = d->table; if (free_data) for (i = 0; i < size; ++i) if (table[i] && table[i]->data) free_data(table[i]->data); for (i = 0; i < size; i++) if (table[i]) { str_free(&table[i]->key); free(table[i]); } if (table) free(table); memset(d, 0, sizeof *d); } bglibs-2.04/dict/load_list.c0000664000076400007640000000107713244040127015311 0ustar bruceguenter#include "iobuf.h" #include "str.h" #include "dict.h" int dict_load_list(dict* d, const char* filename, int mustexist, int (*xform)(str*)) { ibuf in; str tmp = {0,0,0}; int result = 1; if (!dict_init(d)) return 0; if (!ibuf_open(&in, filename, 0)) return !mustexist; while (ibuf_getstr(&in, &tmp, '\n')) { str_strip(&tmp); if (tmp.len > 0 && tmp.s[0] != '#') { if (xform != 0) if (!xform(&tmp)) { result = 0; break; } if (!dict_add(d, &tmp, 0)) { result = 0; break; } } } str_free(&tmp); ibuf_close(&in); return result; } bglibs-2.04/bglibs-2.04.spec0000664000076400007640000000231713244040126014744 0ustar bruceguenterName: bglibs Summary: BG Libraries Collection Version: 2.04 Release: 1 License: GPL Group: Development/Libraries Source: http://untroubled.org/%{name}/%{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-buildroot BuildRequires: libtool URL: http://untroubled.org/%{name}/ Packager: Bruce Guenter %description BG Libraries Collection %package devel Summary: Development includes and libraries for bglibs Requires: bglibs = %{version} Group: Development/Libraries %description devel The bglibs-devel package contains the header and object files necessary for developing programs which use the bglibs libraries. %prep %setup echo gcc "%{optflags}" -g >conf-cc echo gcc -g -L. >conf-ld echo %{_includedir} >conf-include echo %{_libdir} >conf-lib echo %{_bindir} >conf-bin echo %{_mandir} >conf-man %build make %install rm -fr %{buildroot} make install_prefix=%{buildroot} install %clean rm -rf %{buildroot} %files %defattr(-,root,root) %doc ANNOUNCEMENT COPYING NEWS README %{_libdir}/*.so.* %{_bindir}/bg-installer %files devel %defattr(-,root,root) %{_includedir}/bglibs %{_libdir}/*.a %{_libdir}/*.la %{_libdir}/*.so %{_libdir}/*/*.a %{_bindir}/cli-generate %{_bindir}/crc-gentab %{_mandir}/*/* bglibs-2.04/COPYING0000664000076400007640000006350013244040126013301 0ustar bruceguenter GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! bglibs-2.04/SRCFILES0000664000076400007640000002175413244040126013410 0ustar bruceguenterINSTHIER adt/adt_sp.c adt/ghash_add.c adt/ghash_foreach.c adt/ghash_free.c adt/ghash_get.c adt/ghash_init.c adt/ghash_insert.c adt/ghash_iter.c adt/ghash_rebuild.c adt/ghash_rehash.c adt/ghash_remove.c adt/ghash_search.c adt/ghash_set.c adt/gqueue_pop.c adt/gqueue_push.c adt/gqueue_top.c adt/gstack_pop.c adt/gstack_push.c adt/gstack_top.c adt/hashb.c adt/hashs.c base64/asc2bin.c base64/bin2asc.c base64/decode_line.c base64/decode_part.c base64/encode_line.c base64/encode_part.c bg-installer.c bg-installer.cli cdb/cdb.c cdb/cdbhash.c cdb/find.c cdb/get.c cdb/getnext.c cdb/make.c cdb/make.h cdb/read.c cli-generate.pl cli/help.c cli/internal.h cli/main.c crc-gentab.c crc/gcrc16fwd.c crc/gcrc16rfl.c crc/gcrc32fwd.c crc/gcrc32rfl.c crc/gcrc64fwd.c crc/gcrc64rfl.c crypto/hmac-md5.c crypto/hmac-sha1.c crypto/hmac-sha256.c crypto/hmac-sha384.c crypto/hmac-sha512.c crypto/hmac.c crypto/md4.c crypto/md5-crypt.c crypto/md5.c crypto/sha1.c crypto/sha256.c crypto/sha384.c crypto/sha512.c crypto/surf.c crypto/surfrand.c dict/add.c dict/dicthash.c dict/foreach.c dict/free.c dict/get.c dict/init.c dict/load_list.c dict/load_map.c dict/str_free.c dns-responder.c fmt/char.c fmt/chars.c fmt/lcase.c fmt/multi.c fmt/pad.c fmt/sdec.c fmt/sign_pad.c fmt/slldec.c fmt/sllnum.c fmt/snum.c fmt/ucase.c fmt/udec.c fmt/uhexl.c fmt/uhexu.c fmt/ulldec.c fmt/ullhexl.c fmt/ullhexu.c fmt/ullnum.c fmt/unum.c include/bglibs/adt_common.h include/bglibs/base64.h include/bglibs/bglibs/str.h include/bglibs/cdb.h include/bglibs/cli.h include/bglibs/crc16_arc.h include/bglibs/crc16_ccitt.h include/bglibs/crc16_xmodem.h include/bglibs/crc32.h include/bglibs/crc32c.h include/bglibs/crc64.h include/bglibs/debug.h include/bglibs/dict.h include/bglibs/dns.h include/bglibs/envstr.h include/bglibs/fmt.h include/bglibs/gcrc.h include/bglibs/ghash.h include/bglibs/gqueue.h include/bglibs/gstack.h include/bglibs/hmac.h include/bglibs/ibuf.h include/bglibs/iobuf.h include/bglibs/iobuf_common.h include/bglibs/ipv4.h include/bglibs/ipv6.h include/bglibs/md4.h include/bglibs/md5.h include/bglibs/misc.h include/bglibs/msg.h include/bglibs/obuf.h include/bglibs/path.h include/bglibs/resolve.h include/bglibs/selfpipe.h include/bglibs/sha1.h include/bglibs/sha256.h include/bglibs/sha384.h include/bglibs/sha512.h include/bglibs/sig.h include/bglibs/signalfd.h include/bglibs/socket.h include/bglibs/str.h include/bglibs/striter.h include/bglibs/surf.h include/bglibs/surfrand.h include/bglibs/trigger.h include/bglibs/ucspi.h include/bglibs/unix.h include/bglibs/wrap.h include/fmt.h include/gcrc.h include/ibuf.h include/iobuf.h include/iobuf_common.h include/ipv4.h include/ipv6.h include/obuf.h include/path.h include/str.h iobuf/ibuf_copytofd.c iobuf/ibuf_getc.c iobuf/ibuf_getnetstring.c iobuf/ibuf_gets.c iobuf/ibuf_getstr.c iobuf/ibuf_getstr_crlf.c iobuf/ibuf_getu.c iobuf/ibuf_init.c iobuf/ibuf_open.c iobuf/ibuf_openreadclose.c iobuf/ibuf_peek.c iobuf/ibuf_read.c iobuf/ibuf_readall.c iobuf/ibuf_refill.c iobuf/ibuf_seek.c iobuf/ibuf_status.c iobuf/ibuf_stdin.c iobuf/ibuf_tell.c iobuf/iobuf_close.c iobuf/iobuf_copy.c iobuf/iobuf_init.c iobuf/iobuf_timeout.c iobuf/obuf_close.c iobuf/obuf_copyfromfd.c iobuf/obuf_digits.c iobuf/obuf_endl.c iobuf/obuf_flush.c iobuf/obuf_init.c iobuf/obuf_open.c iobuf/obuf_pad.c iobuf/obuf_put2s.c iobuf/obuf_put3s.c iobuf/obuf_put4s.c iobuf/obuf_put5s.c iobuf/obuf_put6s.c iobuf/obuf_put7s.c iobuf/obuf_putc.c iobuf/obuf_putf.c iobuf/obuf_putnetstring.c iobuf/obuf_putns.c iobuf/obuf_putsflush.c iobuf/obuf_putsllnumw.c iobuf/obuf_putsnumw.c iobuf/obuf_putullnumw.c iobuf/obuf_putunumw.c iobuf/obuf_seek.c iobuf/obuf_sign_pad.c iobuf/obuf_stderr.c iobuf/obuf_stdout.c iobuf/obuf_sync.c iobuf/obuf_write.c misc/random.c misc/strtou.c misc/ucspi.c misc/utoa.c misc/utoa2.c msg/common.c msg/commonf.c msg/debug.c msg/debug_bits.c msg/debug_init.c msg/debugf.c msg/die.c msg/dief.c msg/error.c msg/errorf.c msg/oom.c msg/show_pid.c msg/warn.c msg/warnf.c msg/wrap_alloc.c msg/wrap_chdir.c msg/wrap_exit.c msg/wrap_str.c net/accept4.c net/accept6.c net/acceptu.c net/bind4.c net/bind6.c net/bindu.c net/broadcast.c net/cmsg.h net/connect4.c net/connect4_timeout.c net/connect6.c net/connect6_timeout.c net/connected.c net/connectu.c net/connectu_timeout.c net/cork.c net/dns_domain.c net/dns_domain_fromdot.c net/dns_domain_todot.c net/dns_fmt.c net/dns_ip4.c net/dns_ip6.c net/dns_mx.c net/dns_name4.c net/dns_name4_domain.c net/dns_name6.c net/dns_name6_domain.c net/dns_name_packet.c net/dns_packet.c net/dns_qualify.c net/dns_random.c net/dns_resolvconfip.c net/dns_resolvconfrewrite.c net/dns_resolve.c net/dns_result.c net/dns_rotate.c net/dns_sort.c net/dns_transmit.c net/dns_txt.c net/getaddr4.c net/getaddr6.c net/ipv4_addr.c net/ipv4_format.c net/ipv4_scan.c net/ipv6_addr.c net/ipv6_format.c net/ipv6_scan.c net/linger.c net/listen.c net/notcpdelay.c net/pairdgm.c net/pairstr.c net/recv4.c net/recv6.c net/recvfd.c net/recvu.c net/resolve_calldns.c net/resolve_ipv4addr.c net/resolve_ipv4name.c net/reuse.c net/send4.c net/send6.c net/sendfd.c net/sendu.c net/shutdown.c net/tcp4.c net/tcp6.c net/udp4.c net/udp6.c net/uncork.c net/unixdgm.c net/unixstr.c path/contains.c path/fnmatch.c path/match.c path/merge.c path/mkdirs.c path/mktemp.c pwcmp/client.c pwcmp/client.h pwcmp/hex.h pwcmp/hex_encode.c pwcmp/module.c pwcmp/module.h selftest-cmp.c selftest.c selftests.sh str/alloc.c str/buildmap.c str/case_end.c str/case_glob.c str/case_match.c str/case_start.c str/cat.c str/cat2s.c str/cat3s.c str/cat4s.c str/cat5s.c str/cat6s.c str/catf.c str/catiw.c str/catiwll.c str/catns.c str/catsllnum.c str/catsnum.c str/catullnum.c str/catunum.c str/catuw.c str/catuwll.c str/catxw.c str/catxwll.c str/cmp.c str/copy.c str/copy2s.c str/copy3s.c str/copy4s.c str/copy5s.c str/copy6s.c str/copyf.c str/copyns.c str/count.c str/countof.c str/cut.c str/diff.c str/digits.c str/end.c str/env_find.c str/env_from_array.c str/env_from_string.c str/env_get.c str/env_make_array.c str/env_put.c str/env_set.c str/env_unset.c str/findnext.c str/findnextof.c str/findprev.c str/findprevof.c str/free.c str/glob.c str/init.c str/iter_advance.c str/iter_start.c str/iter_valid.c str/join.c str/lower.c str/lstrip.c str/match.c str/rstrip.c str/sort.c str/splice.c str/start.c str/subst.c str/truncate.c str/upper.c str/xlate.c sys/clock_gettime.c sys/getpeereid.c sys/hasattribute.h0 sys/hasattribute.h1 sys/hasclockgettime.h0 sys/hasclockgettime.h1 sys/hasdaylight.h0 sys/hasdaylight.h1 sys/hasdeprecated.h0 sys/hasdeprecated.h1 sys/hasdirent.h0 sys/hasdirent.h1 sys/hasdirentino.h0 sys/hasdirentino.h1 sys/hasdirenttype.h0 sys/hasdirenttype.h1 sys/hasdl.h0 sys/hasdl.h1 sys/hasendian.h0 sys/hasendian.h1 sys/hasflock.h0 sys/hasflock.h1 sys/hasgetpeereid.h0 sys/hasgetpeereid.h1 sys/hasinline.h0 sys/hasinline.h1 sys/hasipv6.h0 sys/hasipv6.h1 sys/hasmkfifo.h0 sys/hasmkfifo.h1 sys/hasnamedpipebug.h0 sys/hasnamedpipebug.h1 sys/hasnoreturn.h0 sys/hasnoreturn.h1 sys/haspeercred.h0 sys/haspeercred.h1 sys/haspoll.h0 sys/haspoll.h1 sys/hassendfile.h0 sys/hassendfile.h1 sys/hassetenv.h0 sys/hassetenv.h1 sys/hassigaction.h0 sys/hassigaction.h1 sys/hassigprocmask.h0 sys/hassigprocmask.h1 sys/hasspnam.h0 sys/hasspnam.h1 sys/hassysselect.h0 sys/hassysselect.h1 sys/hastimespec.h0 sys/hastimespec.h1 sys/hasulong32.h0 sys/hasulong32.h1 sys/hasulong64.h0 sys/hasulong64.h1 sys/hasunaligned.h0 sys/hasunaligned.h1 sys/hasunsetenv.h0 sys/hasunsetenv.h1 sys/hasuserpw.h0 sys/hasuserpw.h1 sys/hasvfork.h0 sys/hasvfork.h1 sys/haswaitp.h0 sys/haswaitp.h1 sys/haszlib.h0 sys/haszlib.h1 sys/iopoll.c sys/setenv.c sys/tryattribute.c sys/tryclockgettime.c sys/trydaylight.c sys/trydeprecated.c sys/trydirent.c sys/trydirentino.c sys/trydirenttype.c sys/trydl.c sys/tryendian.c sys/tryflock.c sys/trygetpeereid.c sys/tryinline.c sys/tryipv6.c sys/trymkfifo.c sys/trynamedpipebug.c sys/trynoreturn.c sys/trypeercred.c sys/trypoll.c sys/trysendfile.c sys/trysetenv.c sys/trysigaction.c sys/trysigprocmask.c sys/tryspnam.c sys/trysysselect.c sys/trysystime.c sys/trytime.c sys/trytimespec.c sys/tryulong32.c sys/tryulong64.c sys/tryunaligned.c sys/tryunsetenv.c sys/tryuserpw.c sys/tryvfork.c sys/trywaitp.c sys/tryzlib.c sys/unsetenv.c sysdeps-head.h sysdeps-tail.h uint16.h uint16/get.c uint16/pack.c uint16/unpack.c uint32.h uint32/get_lsb.c uint32/get_msb.c uint32/pack_lsb.c uint32/pack_msb.c uint32/unpack_lsb.c uint32/unpack_msb.c uint64.h uint64/get_lsb.c uint64/get_msb.c uint64/pack_lsb.c uint64/pack_msb.c uint64/unpack_lsb.c uint64/unpack_msb.c uintnn.h unix/cloexec_off.c unix/cloexec_on.c unix/fcntl_fd_off.c unix/fcntl_fd_on.c unix/fcntl_fl_off.c unix/fcntl_fl_on.c unix/nonblock_off.c unix/nonblock_on.c unix/selfpipe.c unix/sig_alarm.c unix/sig_all.c unix/sig_block.c unix/sig_bug.c unix/sig_catch.c unix/sig_child.c unix/sig_hup.c unix/sig_int.c unix/sig_misc.c unix/sig_pipe.c unix/sig_quit.c unix/sig_suspend.c unix/sig_term.c unix/signalfd.c unix/trigger_pull.c unix/trigger_set.c vmailmgr/client.h vmailmgr/req_arg.c vmailmgr/req_init.c vmailmgr/req_write.c vmailmgr/resp_read.c vmailmgr/vpwentry.h vmailmgr/vpwentry_export.c vmailmgr/vpwentry_free.c vmailmgr/vpwentry_import.c bglibs-2.04/uint64/0000755000076400007640000000000013244040127013372 5ustar bruceguenterbglibs-2.04/uint64/pack_msb.c0000664000076400007640000000120413244040127015314 0ustar bruceguenter#include "uint64.h" #include "uint32.h" #ifndef __INLINE_UINT_MSB void uint64_pack_msb(uint64 u, unsigned char b[4]) { #ifdef HAS_ULONG64 b[7] = u & 0xff; u >>= 8; b[6] = u & 0xff; u >>= 8; b[5] = u & 0xff; u >>= 8; b[4] = u & 0xff; u >>= 8; b[3] = u & 0xff; u >>= 8; b[2] = u & 0xff; u >>= 8; b[1] = u & 0xff; u >>= 8; b[0] = u; #else uint32 hi, lo; lo = u; b[7] = lo & 0xff; lo >>= 8; b[6] = lo & 0xff; lo >>= 8; b[5] = lo & 0xff; lo >>= 8; b[4] = lo; hi = u >> 32; b[3] = hi & 0xff; hi >>= 8; b[2] = hi & 0xff; hi >>= 8; b[1] = hi & 0xff; hi >>= 8; b[0] = hi; #endif } #endif bglibs-2.04/uint64/unpack_lsb.c0000664000076400007640000000124113244040127015657 0ustar bruceguenter#include "uint64.h" #include "uint32.h" #ifndef __INLINE_UINT_LSB void uint64_unpack_lsb(const unsigned char b[4], uint64* u) { #ifdef HAS_ULONG64 uint64 r; r = b[7]; r <<= 8; r += b[6]; r <<= 8; r += b[5]; r <<= 8; r += b[4]; r <<= 8; r += b[3]; r <<= 8; r += b[2]; r <<= 8; r += b[1]; r <<= 8; r += b[0]; *u = r; #else /* 64-bit operations are painfully expensive on 32-bit systems */ uint32 hi, lo; hi = b[7]; hi <<= 8; hi += b[6]; hi <<= 8; hi += b[5]; hi <<= 8; hi += b[4]; lo = b[3]; lo <<= 8; lo += b[2]; lo <<= 8; lo += b[1]; lo <<= 8; lo += b[0]; *u = (((uint64)hi) << 32) + lo; #endif } #endif bglibs-2.04/uint64/pack_lsb.c0000664000076400007640000000120413244040127015313 0ustar bruceguenter#include "uint64.h" #include "uint32.h" #ifndef __INLINE_UINT_LSB void uint64_pack_lsb(uint64 u, unsigned char b[4]) { #ifdef HAS_ULONG64 b[0] = u & 0xff; u >>= 8; b[1] = u & 0xff; u >>= 8; b[2] = u & 0xff; u >>= 8; b[3] = u & 0xff; u >>= 8; b[4] = u & 0xff; u >>= 8; b[5] = u & 0xff; u >>= 8; b[6] = u & 0xff; u >>= 8; b[7] = u; #else uint32 hi, lo; lo = u; b[0] = lo & 0xff; lo >>= 8; b[1] = lo & 0xff; lo >>= 8; b[2] = lo & 0xff; lo >>= 8; b[3] = lo; hi = u >> 32; b[4] = hi & 0xff; hi >>= 8; b[5] = hi & 0xff; hi >>= 8; b[6] = hi & 0xff; hi >>= 8; b[7] = hi; #endif } #endif bglibs-2.04/uint64/get_lsb.c0000664000076400007640000000123113244040127015154 0ustar bruceguenter#include "uint64.h" #include "uint32.h" #ifndef __INLINE_UINT_LSB uint64 uint64_get_lsb(const unsigned char b[4]) { #ifdef HAS_ULONG64 uint64 r; r = b[7]; r <<= 8; r += b[6]; r <<= 8; r += b[5]; r <<= 8; r += b[4]; r <<= 8; r += b[3]; r <<= 8; r += b[2]; r <<= 8; r += b[1]; r <<= 8; r += b[0]; return r; #else /* 64-bit operations are painfully expensive on 32-bit systems */ uint32 hi, lo; hi = b[7]; hi <<= 8; hi += b[6]; hi <<= 8; hi += b[5]; hi <<= 8; hi += b[4]; lo = b[3]; lo <<= 8; lo += b[2]; lo <<= 8; lo += b[1]; lo <<= 8; lo += b[0]; return (((uint64)hi) << 32) + lo; #endif } #endif bglibs-2.04/uint64/unpack_msb.c0000664000076400007640000000124113244040127015660 0ustar bruceguenter#include "uint64.h" #include "uint32.h" #ifndef __INLINE_UINT_MSB void uint64_unpack_msb(const unsigned char b[4], uint64* u) { #ifdef HAS_ULONG64 uint64 r; r = b[0]; r <<= 8; r += b[1]; r <<= 8; r += b[2]; r <<= 8; r += b[3]; r <<= 8; r += b[4]; r <<= 8; r += b[5]; r <<= 8; r += b[6]; r <<= 8; r += b[7]; *u = r; #else /* 64-bit operations are painfully expensive on 32-bit systems */ uint32 hi, lo; hi = b[0]; hi <<= 8; hi += b[1]; hi <<= 8; hi += b[2]; hi <<= 8; hi += b[3]; lo = b[4]; lo <<= 8; lo += b[5]; lo <<= 8; lo += b[6]; lo <<= 8; lo += b[7]; *u = (((uint64)hi) << 32) + lo; #endif } #endif bglibs-2.04/uint64/get_msb.c0000664000076400007640000000123113244040127015155 0ustar bruceguenter#include "uint64.h" #include "uint32.h" #ifndef __INLINE_UINT_MSB uint64 uint64_get_msb(const unsigned char b[4]) { #ifdef HAS_ULONG64 uint64 r; r = b[0]; r <<= 8; r += b[1]; r <<= 8; r += b[2]; r <<= 8; r += b[3]; r <<= 8; r += b[4]; r <<= 8; r += b[5]; r <<= 8; r += b[6]; r <<= 8; r += b[7]; return r; #else /* 64-bit operations are painfully expensive on 32-bit systems */ uint32 hi, lo; hi = b[0]; hi <<= 8; hi += b[1]; hi <<= 8; hi += b[2]; hi <<= 8; hi += b[3]; lo = b[4]; lo <<= 8; lo += b[5]; lo <<= 8; lo += b[6]; lo <<= 8; lo += b[7]; return (((uint64)hi) << 32) + lo; #endif } #endif bglibs-2.04/TODO0000664000076400007640000000077313244040126012741 0ustar bruceguenter- Rewrite the IPv6 library to accept/handle IPv4-only connections transparently. - Use a prefix of ::4444/32 to distinguish from ::ffff/32 and ::0/32 - Add Jenkin's lookup3 hash http://burtleburtle.net/bob/hash/doobs.html - Replace adt_hashb, or add some other library of hash functions - What about FNV or other good ones? - Add make-compile, make-load, make-makelib scripts - exec replacement? http://cr.yp.to/lib/pathexec.html - More ADTs: bag/set, tree - Add tests to adt/queue, adt/stack bglibs-2.04/crc-gentab.c0000664000076400007640000000567013244040127014424 0ustar bruceguenter#include #include #include "sysdeps.h" #include "iobuf.h" #include "msg.h" /* This generalized CRC table generator is derived from the descriptions in * ftp://ftp.adelaide.edu.au/pub/rocksoft/crc_v3.txt * The above is the best and most comprehensive description I have seen * to date of CRC theory, math, algorithms, and code. */ const char program[] = "crc-gentab"; const int msg_show_pid = 0; static int calc_columns(int bits, const char* suffix) { int width = (bits+3)/4 + strlen(suffix) + 1; int cols = 78 / width; if (cols >= 16) return 16; if (cols >= 8) return 8; if (cols >= 4) return 4; if (cols >= 2) return 2; return 1; } static uint64 reflect(uint64 value, int bits) { uint64 out = 0; while (bits-- > 0) { out <<= 1; if (value & 1) out |= 1; value >>= 1; } return out; } static uint64 crctab[256]; static void gentab(int bits, uint64 poly, int reflected) { int i; uint64 topbit = 1ULL << (bits-1); uint64 mask = ~0ULL >> (64-bits); for (i = 0; i < 256; ++i) { uint64 crc = i; int j; if (reflected) crc = reflect(crc, 8); crc <<= bits - 8; for (j = 0; j < 8; ++j) crc = (crc << 1) ^ ((crc & topbit) ? poly : 0); if (reflected) crc = reflect(crc, bits); crctab[i] = crc & mask; } } int main(int argc, char* argv[]) { const char* bitstr; const char* polystr; int bits; int digits; uint64 poly; const char* suffix; int columns; char* end; int i; const char* name; int reflected; if (argc != 5) { msg3("usage: ", program, " NAME BITS POLY [normal|reflected]"); return 1; } name = argv[1]; bitstr = argv[2]; bits = strtol(bitstr, &end, 0); if (*end != 0) die2(1, "Invalid bits value: ", bitstr); if (bits <= 0 || bits > 64) die1(1, "bits must be between 1 and 64"); digits = (bits + 3) / 4; if (bits > 32) suffix = "ULL,"; else if (bits > 16) suffix = "UL,"; else suffix = "U,"; columns = calc_columns(bits, suffix); polystr = argv[3]; poly = strtoull(polystr, &end, 0); if (*end != 0) die2(1, "Invalid poly value: ", polystr); reflected = 0; if (strcasecmp(argv[4], "reflected") == 0) reflected = 1; else if (strcasecmp(argv[4], "normal") != 0) die2(1, "Must be either 'normal' or 'reflected': ", argv[4]); gentab(bits, poly, reflected); obuf_put3s(&outbuf, "#include \"", name, ".h\"\n\n"); obuf_put5s(&outbuf, "const uint", bitstr, " ", name, "_table[256] = {\n"); for (i = 0; i < 256; ++i) { int column = i % columns; if (column == 0) obuf_puts(&outbuf, " "); obuf_puts(&outbuf, "0x"); if (bits > 32) { obuf_putxw(&outbuf, crctab[i]>>32, digits-8, '0'); obuf_putxw(&outbuf, crctab[i] & 0xffffffffUL, 8, '0'); } else obuf_putxw(&outbuf, crctab[i], digits, '0'); obuf_puts(&outbuf, suffix); obuf_putc(&outbuf, (column == (columns-1)) ? '\n' : ' '); } obuf_puts(&outbuf, "};\n"); obuf_flush(&outbuf); return 0; } bglibs-2.04/path/0000755000076400007640000000000013244040127013175 5ustar bruceguenterbglibs-2.04/path/mktemp.c0000664000076400007640000000174313244040127014645 0ustar bruceguenter#include #include #include "systime.h" #include #include #include "path.h" /** Create a temporary file. This function creates a temporary file by adding an difficult-to-predict suffix (using the PID and microsecond timestamp) to the given prefix. If this filename does not exist, it is opened in read/write mode. */ int path_mktemp(const char* prefix, str* filename) { struct stat s; static long pid = 0; struct timeval tv; if (pid == 0) pid = getpid(); do { if (!str_copys(filename, prefix)) return -1; if (!str_catc(filename, '.')) return -1; if (!str_catu(filename, pid)) return -1; gettimeofday(&tv, 0); if (!str_catc(filename, '.')) return -1; if (!str_catu(filename, tv.tv_sec)) return -1; if (!str_catc(filename, '.')) return -1; if (!str_catuw(filename, tv.tv_usec, 6, '0')) return -1; } while (lstat(filename->s, &s) != -1); return open(filename->s, O_RDWR | O_EXCL | O_CREAT, 0600); } bglibs-2.04/path/mkdirs.c0000664000076400007640000000202213244040127014630 0ustar bruceguenter#include "sysdeps.h" #include #include #include #include "path.h" /** Create a directory, optionally creating any parent directories. This function creates the named directory using mkdir. If any of the parent directories of the specified path do not exist, they are created as well (with the same mode). \note Unlike the "mkdir -p" command, this function will result in an error if the path already exists. */ int path_mkdirs(const char* path, unsigned mode) { int i; i = strlen(path); while (i > 0 && path[i-1] == '/') --i; while (i > 0 && path[i-1] != '/') --i; while (i > 0 && path[i-1] == '/') --i; if (i > 0) { struct stat st; char prefix[i+1]; memcpy(prefix, path, i); prefix[i] = 0; if (stat(prefix, &st) == 0) { if (!S_ISDIR(st.st_mode)) { errno = ENOTDIR; return -1; } } else if (errno != ENOENT) return -1; else if (path_mkdirs(prefix, mode) != 0) return -1; } return mkdir(path, mode); } bglibs-2.04/path/merge.c0000664000076400007640000000600713244040127014445 0ustar bruceguenter/* path/merge.c - Merge one path into another. * Copyright (C) 2001,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include "path.h" static int path_merge_part(str* path, const char* part, unsigned long len) { if (part[0] == '.') { /* "." parts get dropped */ if (len == 1) return 1; /* ".." parts cause truncation */ if (len == 2 && part[1] == '.') { int sep = str_findlast(path, '/'); /* Don't truncate a leading '/' */ if (sep == 0) sep = 1; /* If no '/' found, empty the string */ else if (sep == -1) sep = 0; str_truncate(path, sep); return 1; } } if (path->len) if (path->s[path->len-1] != '/') if (!str_catc(path, '/')) return 0; return str_catb(path, part, len); } /** Merge two paths together. This function takes a starting path, and merges the second path into it. If the second path starts with a "/", it replaces the existing path completely. If the second path contains any ".." components, the preceding directory component in the current path (if any) is removed. All "." components are removed. The effects of this function are equivalent to changing directory to the first path and then using the second one. */ int path_merge(str* path, const char* start) { /* If the path to merge in starts with a "/", drop the previous path */ if (*start == '/') if (!str_copys(path, "/")) return 0; /* This should possibly use a striter... */ while (*start) { const char* end; while (*start == '/') ++start; if ((end = strchr(start, '/')) != 0) { if (!path_merge_part(path, start, end - start)) return 0; start = end + 1; } else { if (!path_merge_part(path, start, strlen(start))) return 0; break; } } return 1; } #ifdef SELFTEST_MAIN #include "path.h" static str path; void showpath(void) { obuf_putstr(&outbuf, &path); NL(); } MAIN { str_copys(&path, "/"); path_merge(&path, "a"); showpath(); path_merge(&path, "b"); showpath(); path_merge(&path, "../c"); showpath(); path_merge(&path, "/d"); showpath(); str_copys(&path, ""); path_merge(&path, "a"); showpath(); path_merge(&path, "b"); showpath(); path_merge(&path, "../c"); showpath(); path_merge(&path, "/d"); showpath(); } #endif #ifdef SELFTEST_EXP /a /a/b /a/c /d a a/b a/c /d #endif bglibs-2.04/path/match.c0000664000076400007640000001407013244040127014441 0ustar bruceguenter/* path/match.c - Filename matching utility. * Copyright (C) 2001,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include "sysdeps.h" #include "str.h" #include "striter.h" #include "path.h" #include "msg.h" static str tmplist; static str tmpitem; static int exists(const char* path) { struct stat st; if (stat(path, &st) == 0) return 1; if (errno == ENOENT || errno == EACCES || errno == ENOTDIR) return 0; return -1; } static int match_first(int absolute, const str* part, str* result, unsigned options) { DIR* dir; direntry* entry; int count = 0; if (!str_truncate(result, 0)) return -1; if (has_magic(part->s)) { if ((dir = opendir(absolute ? "/" : ".")) == 0) return -1; while ((entry = readdir(dir)) != 0) { if (fnmatch(entry->d_name, part->s, options)) { if (absolute) if (!str_catc(result, '/')) return -1; if (!str_catb(result, entry->d_name, strlen(entry->d_name)+1)) { closedir(dir); return -1; } ++count; } } closedir(dir); return count; } else { switch (exists(part->s)) { case 1: str_copyb(result, part->s, part->len + 1); return 1; case 0: return 0; default: return -1; } } } static int match_next_magic(const str* part, str* result, unsigned options) { DIR* dir; direntry* entry; striter path; int count; count = 0; if (!str_copy(&tmplist, result)) return -1; if (!str_truncate(result, 0)) return -1; striter_loop(&path, &tmplist, 0) { if ((dir = opendir(path.startptr)) == 0) continue; while ((entry = readdir(dir)) != 0) { if (fnmatch(entry->d_name, part->s, options)) { if (!str_cats(result, path.startptr) || !str_catc(result, '/') || !str_catb(result, entry->d_name, strlen(entry->d_name)+1)) { closedir(dir); return -1; } ++count; } } closedir(dir); } return count; } static int match_next_nomagic(const str* part, str* result, unsigned options) { striter path; int count = 0; if (!fnmatch(part->s, part->s, options)) return 0; if (!str_copy(&tmplist, result)) return -1; if (!str_truncate(result, 0)) return -1; striter_loop(&path, &tmplist, 0) { if (!str_copyiter(&tmpitem, &path) || !str_catc(&tmpitem, '/') || !str_cat(&tmpitem, part)) return -1; switch (exists(tmpitem.s)) { case 1: str_catb(result, tmpitem.s, tmpitem.len+1); ++count; continue; case 0: continue; default: return -1; } } return count; } static int match_next(const str* part, str* result, unsigned options) { return has_magic(part->s) ? match_next_magic(part, result, options) : match_next_nomagic(part, result, options); } /** Matches the pattern against existing files. This function produces a list of existing files in \c result (in the current directory) that match the given pattern. If \c options has \c PATH_MATCH_DOTFILES set, the result may contain paths starting with ".". */ int path_match(const char* pattern, str* result, unsigned options) { /* FIXME: make this stack allocated */ static str part; int count; const char* patend; int absolute; const char* partend; absolute = pattern[0] == '/'; patend = pattern + strlen(pattern); /* Note and skip any leading slashes */ while (pattern < patend && *pattern == '/') ++pattern; if ((partend = strchr(pattern, '/')) == 0) partend = patend; if (!str_copyb(&part, pattern, partend-pattern)) return -1; if ((count = match_first(absolute, &part, result, options)) == -1) return -1; while (result->len > 0) { pattern = partend + 1; while (pattern < patend && *pattern == '/') ++pattern; if (pattern > patend) break; if ((partend = strchr(pattern, '/')) == 0) partend = patend; if (!str_copyb(&part, pattern, partend-pattern)) return -1; if ((count = match_next(&part, result, options)) == -1) return -1; } if (count == 0 && exists(pattern)) { if (!str_copys(result, pattern)) return -1; return 1; } if (!str_sort(result, 0, count, 0)) return -1; str_free(&tmplist); return count; } #ifdef SELFTEST_MAIN #include static void match(const char* pattern, unsigned options) { static str s; striter i; obuf_puts(&outbuf, pattern); obuf_putc(&outbuf, ' '); obuf_putu(&outbuf, options); obuf_puts(&outbuf, " => "); obuf_puti(&outbuf, path_match(pattern, &s, options)); NL(); for (striter_start(&i, &s, 0); striter_valid(&i); striter_advance(&i)) { obuf_putiter(&outbuf, &i); NL(); } } MAIN { match("*", 0); match("*.o", 0); match("*.o*", 0); match("*.[eo]", 0); match("t*", 0); match("*.o[u]*", 0); mkdir("[test]", 0777); close(open("[test]/.file", O_WRONLY | O_CREAT | O_TRUNC, 0666)); close(open("[test]/[f2]", O_WRONLY | O_CREAT | O_TRUNC, 0666)); match("[test]", 0); match("[test]/*", PATH_MATCH_DOTFILES); match("[test]/.file", 0); match("[test]/[f2]", 0); match("*/*", 0); match("*/*", PATH_MATCH_DOTFILES); match("*/[f2]", 0); unlink("[test]/.file"); unlink("[test]/[f2]"); rmdir("[test]"); } #endif #ifdef SELFTEST_EXP * 0 => 3 test test.o test.out *.o 0 => 1 test.o *.o* 0 => 2 test.o test.out *.[eo] 0 => 1 test.o t* 0 => 3 test test.o test.out *.o[u]* 0 => 1 test.out [test] 0 => 1 [test] [test]/* 1 => 0 [test]/.file 0 => 1 [test]/.file [test]/[f2] 0 => 1 [test]/[f2] */* 0 => 1 [test]/[f2] */* 1 => 2 [test]/.file [test]/[f2] */[f2] 0 => 0 #endif bglibs-2.04/path/fnmatch.c0000664000076400007640000000473613244040127014775 0ustar bruceguenter/* path/fnmatch.c - Filename pattern matching * Copyright (C) 2001,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include "path.h" /** Does the string have glob characters in it. Returns true if the given string contains at least one instance of either *, ?, or [. */ int has_magic(const char* s) { return strchr(s, '*') || strchr(s, '?') || strchr(s, '['); } /** Matches a path using glob patterns. */ int fnmatch(const char* filename, const char* pattern, unsigned options) { str t; /* Special handling for dotfiles: */ if (filename[0] == '.') { /* Always skip "." and ".." */ if (filename[1] == 0 || (filename[1] == '.' && filename[2] == 0)) return 0; /* If DOTFILES is not set, * only match dotfiles when pattern starts with a period */ if (!(options & PATH_MATCH_DOTFILES) && pattern[0] != '.') return 0; } /* Reuse the str_glob function. */ t.s = (char*)filename; t.len = strlen(filename); t.size = 0; return str_globs(&t, pattern); } #ifdef SELFTEST_MAIN void t(const char* filename, const char* pattern, unsigned options) { obuf_puts(&outbuf, filename); obuf_putc(&outbuf, ' '); obuf_puts(&outbuf, pattern); obuf_putc(&outbuf, ' '); obuf_putu(&outbuf, options); obuf_putc(&outbuf, ' '); debugfn(fnmatch(filename, pattern, options)); } void t1(const char* filename, const char* pattern) { t(filename, pattern, 0); t(filename, pattern, PATH_MATCH_DOTFILES); } MAIN { t1("abc", "*"); t1(".", "*"); t1("..", "*"); t1("...", "*"); t1(".abc", "*"); } #endif #ifdef SELFTEST_EXP abc * 0 result=1 abc * 1 result=1 . * 0 result=0 . * 1 result=0 .. * 0 result=0 .. * 1 result=0 ... * 0 result=0 ... * 1 result=1 .abc * 0 result=0 .abc * 1 result=1 #endif bglibs-2.04/path/contains.c0000664000076400007640000000276213244040127015170 0ustar bruceguenter/* path/contains.c - Filename component testing. * Copyright (C) 2001,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include "path.h" /** Test if a path contains a component. Returns true if the \c path contains \c part either at the start followed by a slash, at the end preceded by a slash, or elsewhere with a slash on either side. */ int path_contains(const char* path, const char* part) { long partlen = strlen(part); const char* pathend = path + strlen(path); while (path && path < pathend) { if (*path == '/') ++path; else { const char* slash = strchr(path, '/'); if (!slash) slash = pathend; if (slash-path == partlen && memcmp(path, part, partlen) == 0) return 1; path = slash; } } return 0; } bglibs-2.04/vmailmgr/0000755000076400007640000000000013244040127014057 5ustar bruceguenterbglibs-2.04/vmailmgr/vpwentry.h0000664000076400007640000000115713244040127016134 0ustar bruceguenter#ifndef VMAILMGR__VPWENTRY__H__ #define VMAILMGR__VPWENTRY__H__ #include struct vpwentry { str name; str pass; str directory; str forwards; str personal; unsigned hardquota; unsigned softquota; unsigned msgsize; unsigned msgcount; unsigned ctime; unsigned expiry; int has_mailbox; int is_mailbox_enabled; }; typedef struct vpwentry vpwentry; int vpwentry_import(vpwentry* vpw, const str* name, const str* data); int vpwentry_export(const vpwentry* vpw, str* result); void vpwentry_free(vpwentry* vpw); #define VPWENTRY_HAS_MAILBOX 10 #define VPWENTRY_MAILBOX_ENABLED 8 #endif bglibs-2.04/vmailmgr/resp_read.c0000664000076400007640000000105113244040127016166 0ustar bruceguenter#include #include #include #include "client.h" int vclient_resp_read(vclient_resp* vr, int fd) { unsigned char buf[3]; unsigned length; char* ptr; unsigned rd; if (read(fd, buf, 3) != 3) return 0; vr->code = buf[0]; length = buf[1] << 8 | buf[2]; if (!str_truncate(&vr->message, length)) return 0; for (ptr = vr->message.s; length > 0; ptr += rd, length -= rd) { if ((rd = read(fd, ptr, length)) == (unsigned)-1) if (errno != EINTR) return 0; } vr->message.len = length; return 1; } bglibs-2.04/vmailmgr/vpwentry_free.c0000664000076400007640000000036513244040127017130 0ustar bruceguenter#include #include "vpwentry.h" void vpwentry_free(vpwentry* vpw) { str_free(&vpw->name); str_free(&vpw->pass); str_free(&vpw->directory); str_free(&vpw->forwards); str_free(&vpw->personal); memset(vpw, 0, sizeof *vpw); } bglibs-2.04/vmailmgr/req_init.c0000664000076400007640000000036613244040127016044 0ustar bruceguenter#include "client.h" int vclient_req_init(vclient_req* vr, const str* cmd) { if (1 + 2 + cmd->len > VCLIENT_MAXLEN) return 0; if (!str_truncate(&vr->data, 0)) return 0; if (!vclient_req_arg(vr, cmd)) return 0; vr->args = 0; return 1; } bglibs-2.04/vmailmgr/client.h0000664000076400007640000000102113244040127015502 0ustar bruceguenter#ifndef VMAILMGR__CLIENT__H__ #define VMAILMGR__CLIENT__H__ #include #define VCLIENT_MAXLEN 65535 struct vclient_req { unsigned args; str data; }; typedef struct vclient_req vclient_req; struct vclient_resp { unsigned code; str message; }; typedef struct vclient_resp vclient_resp; int vclient_req_init(vclient_req* vr, const str* cmd); int vclient_req_arg(vclient_req* vr, const str* arg); int vclient_req_write(const vclient_req* vr, int fd); int vclient_resp_read(vclient_resp* vr, int fd); #endif bglibs-2.04/vmailmgr/req_arg.c0000664000076400007640000000053313244040127015646 0ustar bruceguenter#include "client.h" int vclient_req_arg(vclient_req* vr, const str* arg) { if (1 + vr->data.len + 2 + arg->len > VCLIENT_MAXLEN) return 0; if (!str_catc(&vr->data, (unsigned char)(arg->len >> 8))) return 0; if (!str_catc(&vr->data, (unsigned char)(arg->len))) return 0; if (!str_cat(&vr->data, arg)) return 0; ++vr->args; return 1; } bglibs-2.04/vmailmgr/req_write.c0000664000076400007640000000107113244040127016225 0ustar bruceguenter#include #include #include #include "client.h" int vclient_req_write(const vclient_req* vr, int fd) { unsigned wr; unsigned char buf[VCLIENT_MAXLEN+3]; unsigned total = vr->data.len + 1; unsigned char* ptr = buf; *ptr++ = 2; *ptr++ = (unsigned char)(total >> 8); *ptr++ = (unsigned char)total; *ptr++ = vr->args; memcpy(ptr, vr->data.s, vr->data.len); for (ptr = buf; total > 0; ptr += wr, total -= wr) { if ((wr = write(fd, ptr, total)) == (unsigned)-1) if (errno != EINTR) return 0; } return 1; } bglibs-2.04/vmailmgr/vpwentry_export.c0000664000076400007640000000222213244040127017522 0ustar bruceguenter#include "vpwentry.h" #include "str.h" static int str_catunul(str* result, unsigned long u) { if (u == (unsigned)-1) return str_catb(result, "-", 2); return str_catu(result, u) && str_catc(result, 0); } int vpwentry_export(const vpwentry* vpw, str* result) { char flagstmp[] = { 2, VPWENTRY_HAS_MAILBOX, vpw->has_mailbox && (vpw->directory.len > 0), VPWENTRY_MAILBOX_ENABLED, vpw->is_mailbox_enabled, 0 }; if (!str_copyb(result, flagstmp, 6)) return 0; if (!str_catb(result, vpw->pass.s, vpw->pass.len+1)) return 0; if (!str_catb(result, vpw->directory.s, vpw->directory.len+1)) return 0; if (vpw->forwards.len > 0) if (!str_catb(result, vpw->forwards.s, vpw->forwards.len+1)) return 0; if (!str_catc(result, 0)) return 0; if (!str_catb(result, vpw->personal.s, vpw->personal.len+1)) return 0; if (!str_catunul(result, vpw->hardquota)) return 0; if (!str_catunul(result, vpw->softquota)) return 0; if (!str_catunul(result, vpw->msgsize)) return 0; if (!str_catunul(result, vpw->msgcount)) return 0; if (!str_catunul(result, vpw->ctime)) return 0; if (!str_catunul(result, vpw->expiry)) return 0; return 1; } bglibs-2.04/vmailmgr/vpwentry_import.c0000664000076400007640000001016013244040127017513 0ustar bruceguenter#include #include #include #include "systime.h" #include "misc.h" #include "vpwentry.h" static const char* from_uint(const char* ptr, unsigned* u) { const char* tmp; if (ptr[0] == '-' && ptr[1] == 0) { *u = UINT_MAX; return ptr + 2; } *u = strtou(ptr, &tmp); return (*tmp == 0) ? ++tmp : 0; } static const char* import_flags(vpwentry* vpw, const char* ptr, const char* end) { while (ptr < end) { unsigned flag; unsigned value; if ((flag = *(unsigned char*)ptr++) == 0) return ptr; if (ptr >= end) return 0; value = *(unsigned char*)ptr++; switch(flag) { case VPWENTRY_HAS_MAILBOX: vpw->has_mailbox = value; break; case VPWENTRY_MAILBOX_ENABLED: vpw->is_mailbox_enabled = value; break; default: return 0; } } return 0; } static const char* import_base(vpwentry* vpw, const char* ptr, const char* end) { const char* start; str_copys(&vpw->pass, ptr); ptr += vpw->pass.len + 1; if (ptr >= end) return 0; str_copys(&vpw->directory, ptr); vpw->has_mailbox = (vpw->directory.len != 0); ptr += vpw->directory.len + 1; if (ptr >= end) return 0; start = ptr; while (ptr < end && *ptr != 0) ptr += strlen(ptr) + 1; if (ptr == start) str_truncate(&vpw->forwards, 0); else str_copyb(&vpw->forwards, start, ptr-start-1); if (ptr++ >= end) return 0; str_copys(&vpw->personal, ptr); ptr += vpw->personal.len + 1; if (ptr >= end) return 0; return ptr; } static const char* import_values(vpwentry* vpw, const char* ptr, const char* end) { if ((ptr = from_uint(ptr, &vpw->hardquota)) == 0 || ptr >= end) return 0; if ((ptr = from_uint(ptr, &vpw->softquota)) == 0 || ptr >= end) return 0; if ((ptr = from_uint(ptr, &vpw->msgsize)) == 0 || ptr >= end) return 0; if ((ptr = from_uint(ptr, &vpw->msgcount)) == 0 || ptr >= end) return 0; if ((ptr = from_uint(ptr, &vpw->ctime)) == 0 || ptr >= end) return 0; if ((ptr = from_uint(ptr, &vpw->expiry)) == 0 || ptr > end) return 0; return ptr; } static void set_defaults(vpwentry* vpw, int ctime_now, int set_flags) { /* FIXME: These need to be loaded from config files */ vpw->softquota = vpw->hardquota = vpw->msgsize = vpw->msgcount = 0; vpw->expiry = UINT_MAX; if (ctime_now) vpw->ctime = time(0); else vpw->ctime = 0; if(set_flags) { vpw->is_mailbox_enabled = 1; } } static int import_old(vpwentry* vpw, const str* data) { const char* end; if ((end = strchr(data->s+1, ':')) == 0) return 0; str_copyb(&vpw->pass, data->s+1, end-data->s-1); ++end; if(*end == '.' || *end == '/') { vpw->has_mailbox = 1; str_copys(&vpw->directory, end); str_truncate(&vpw->forwards, 0); } else { if(*end == '&') ++end; vpw->has_mailbox = 0; str_truncate(&vpw->directory, 0); str_copys(&vpw->forwards, end); str_subst(&vpw->forwards, ',', 0); } set_defaults(vpw, 0, 1); return 1; } static int import_ver1(vpwentry* vpw, const str* data) { const char* ptr; const char* end; // Sanity check to ensure that text conversions can't // fall off the end of the string. if (data->s[data->len-1] != 0) return 0; ptr = data->s; end = ptr++ + data->len; if ((ptr = import_base(vpw, ptr, end)) == 0) return 0; if ((ptr = import_values(vpw, ptr, end)) == 0) return 0; // Set defaults vpw->is_mailbox_enabled = 1; return ptr == end; } static int import_ver2(vpwentry* vpw, const str* data) { const char* ptr; const char* end; // Sanity check to ensure that text conversions can't // fall off the end of the string. if (data->s[data->len-1] != 0) return 0; ptr = data->s; end = ptr++ + data->len; if((ptr = import_flags(vpw, ptr, end)) == 0) return 0; if((ptr = import_base(vpw, ptr, end)) == 0) return 0; if((ptr = import_values(vpw, ptr, end)) == 0) return 0; return ptr == end; } int vpwentry_import(vpwentry* vpw, const str* name, const str* data) { str_copy(&vpw->name, name); switch (data->s[0]) { case 2: return import_ver2(vpw, data); case 1: return import_ver1(vpw, data); case ':': return import_old(vpw, data); default: return 0; } } bglibs-2.04/include/0000755000076400007640000000000013244040127013664 5ustar bruceguenterbglibs-2.04/include/obuf.h0000664000076400007640000001172113244040127014774 0ustar bruceguenter#ifndef IO_BUF__OBUF__H__ #define IO_BUF__OBUF__H__ #include #include "sysdeps.h" #include "iobuf_common.h" /** \defgroup obuf obuf: Output Buffer Management \par Calling Convention Unless otherwise specified, the return value is non-zero (true) if the entire requested operation completed, and \c 0 (false) otherwise. @{ */ /** \c obuf write function pointer prototype. */ typedef int (*obuf_fn)(int, const void*, unsigned long); /** Output specific buffer. */ struct obuf { /** Base \c iobuf structure. */ iobuf io; /** Current write position within the buffer. */ unsigned bufpos; /** The number of bytes written in the last operation. */ unsigned count; /** Function used to write data to the file descriptor. */ obuf_fn writefn; }; /** Output specific buffer typedef. */ typedef struct obuf obuf; extern obuf outbuf; extern obuf errbuf; extern const char obuf_dec_digits[10] __DEPRECATED__; extern const char obuf_hex_lcase_digits[16] __DEPRECATED__; extern const char obuf_hex_ucase_digits[16] __DEPRECATED__; /** Create the file if it does not already exist. */ #define OBUF_CREATE O_CREAT /** If \c OBUF_CREATE is set, fail to create the file if it already exists. */ #define OBUF_EXCLUSIVE O_EXCL /** If the file exists, truncate it to length 0. */ #define OBUF_TRUNCATE O_TRUNC /** All writes go to the end of the file. */ #define OBUF_APPEND O_APPEND int obuf_init(obuf* out, int fd, obuf_fn fn, unsigned flags, unsigned bufsize); int obuf_open(obuf* out, const char* filename, int oflags, int mode, unsigned bufsize); int obuf_close(obuf* out); /** Test if the \c obuf is in an error state. */ #define obuf_error(out) iobuf_error(&(out)->io) /** Test if the \c obuf has been closed. */ #define obuf_closed(out) iobuf_closed(&(out)->io) /** Test if the last \c obuf write timed out. */ #define obuf_timedout(out) iobuf_timedout(&((out)->io)) int obuf_flush(obuf* out); int obuf_sync(obuf* out); int obuf_write_large(obuf* out, const char* data, unsigned datalen); int obuf_write(obuf* out, const char* data, unsigned datalen); int obuf_seek(obuf* out, unsigned offset); /** Set the effective write position to the start of the file. */ #define obuf_rewind(out) obuf_seek(out,0) /** Look up the current effective write position. */ #define obuf_tell(out) ((out)->io.offset+(out)->bufpos) int obuf_pad(obuf* out, unsigned width, char ch); int obuf_endl(obuf* out); int obuf_putc(obuf* out, char ch); /** Write a C string to the \c obuf */ #define obuf_puts(out,str) obuf_write(out,str,strlen(str)) int obuf_put2s(obuf* out, const char* s1, const char* s2); int obuf_put3s(obuf* out, const char* s1, const char* s2, const char* s3); int obuf_put4s(obuf* out, const char* s1, const char* s2, const char* s3, const char* s4); int obuf_put5s(obuf* out, const char* s1, const char* s2, const char* s3, const char* s4, const char* s5); int obuf_put6s(obuf* out, const char* s1, const char* s2, const char* s3, const char* s4, const char* s5, const char* s6); int obuf_put7s(obuf* out, const char* s1, const char* s2, const char* s3, const char* s4, const char* s5, const char* s6, const char* s7); int obuf_putns(obuf* out, unsigned int count, ...); int obuf_putf(obuf* out, const char* format, ...); int obuf_putfv(obuf* out, const char* format, va_list ap); /** Write a dynamic string to the \c iobuf */ #define obuf_putstr(out,str) obuf_write(out,(str)->s,(str)->len) int obuf_putsflush(obuf* out, const char* s); int obuf_puti(obuf* out, long data); int obuf_putiw(obuf* out, long data, unsigned width, char pad); int obuf_putu(obuf* out, unsigned long data); int obuf_putuw(obuf* out, unsigned long data, unsigned width, char pad); int obuf_putill(obuf* out, long long data); int obuf_putiwll(obuf* out, long long data, unsigned width, char pad); int obuf_putull(obuf* out, unsigned long long data); int obuf_putuwll(obuf* out, unsigned long long data, unsigned width, char pad); int obuf_putx(obuf* out, unsigned long data); int obuf_putxw(obuf* out, unsigned long data, unsigned width, char pad); int obuf_putX(obuf* out, unsigned long data); int obuf_putXw(obuf* out, unsigned long data, unsigned width, char pad); int obuf_putxll(obuf* out, unsigned long long data); int obuf_putxwll(obuf* out, unsigned long long data, unsigned width, char pad); int obuf_putXll(obuf* out, unsigned long long data); int obuf_putXwll(obuf* out, unsigned long long data, unsigned width, char pad); int obuf_putsnumw(obuf* out, long num, unsigned width, char pad, unsigned base, const char* digits); int obuf_putunumw(obuf* out, unsigned long num, unsigned width, char pad, unsigned base, const char* digits); int obuf_putsllnumw(obuf* out, long long num, unsigned width, char pad, unsigned base, const char* digits); int obuf_putullnumw(obuf* out, unsigned long long num, unsigned width, char pad, unsigned base, const char* digits); int obuf_putnetstring(obuf* out, const char* data, unsigned datalen); int obuf_sign_pad(obuf* out, int sign, unsigned width, char pad); /** @} */ #endif bglibs-2.04/include/adt_common.h0000664000076400007640000000311413244040127016156 0ustar bruceguenter#ifndef BGLIBS__ADT__COMMON__H__ #define BGLIBS__ADT__COMMON__H__ /** \defgroup adt adt: Abstract Data Types. */ /** @{ */ /** The hash value type. All hash functions must output a value of this * type, and all functions that use a hash store it in this type. */ typedef unsigned long adt_hash_t; /** A function prototype used for freeing something. */ typedef void adt_free_fn(void*); /** A function prototype for copying something. The function is expected * to return false (zero) if the copy failed for any reason (ie could * not allocate memory). */ typedef int adt_copy_fn(void*, const void*); /** A function prototype for comparing two items. Such functions must * return zero if the two items are identical, positive if the first is * larger, and negative if the first is smaller. */ typedef int adt_cmp_fn(const void*, const void*); /** A function prototype for hasing an item (typically a key). */ typedef adt_hash_t adt_hash_fn(const void*); /** A sample function for hasing a block of memory. */ adt_hash_t adt_hashb(const unsigned char*, unsigned long); /** A sample function for hashing a C string. */ adt_hash_t adt_hashs(const unsigned char*); /** A sample function for hashing a C string pointer. */ adt_hash_t adt_hashsp(const char* const*); /** A sample function for comparing two C string pointers. */ int adt_cmpsp(const char* const* a, const char* const* b); /** A sample function for copying a C string pointer. */ int adt_copysp(const char** a, const char* const* b); /** A sample function for freeing a C string pointer. */ void adt_freesp(const char** a); /** @} */ #endif bglibs-2.04/include/hmac.h0000664000076400007640000000232513244040127014751 0ustar bruceguenter#ifndef CRYPTO__HMAC__H__ #define CRYPTO__HMAC__H__ typedef void (*hmac_init_fn)(void*); typedef void (*hmac_update_fn)(void*, const unsigned char*, unsigned long); typedef void (*hmac_finalize_fn)(void*, unsigned char*); typedef void (*hmac_extract_fn)(const void*, void*); typedef void (*hmac_inject_fn)(void*, const void*); struct hmac_control_block { unsigned state_size; unsigned block_size; unsigned digest_size; unsigned midstate_size; hmac_init_fn init; hmac_update_fn update; hmac_finalize_fn finalize; hmac_extract_fn extract; hmac_inject_fn inject; }; extern const struct hmac_control_block hmac_md5; extern const struct hmac_control_block hmac_sha1; extern const struct hmac_control_block hmac_sha256; extern const struct hmac_control_block hmac_sha384; extern const struct hmac_control_block hmac_sha512; struct str; extern void hmac_prepare(const struct hmac_control_block* hcb, void* midstate, const struct str* secret); extern void hmac_finish(const struct hmac_control_block* hcb, const void* midstate, const struct str* nonce, void* outout); extern void hmac(const struct hmac_control_block* hcb, const struct str* secret, const struct str* nonce, void* output); #endif bglibs-2.04/include/sha384.h0000664000076400007640000000044613244040127015055 0ustar bruceguenter#ifndef BGLIBS__SHA384__H__ #define BGLIBS__SHA384__H__ #include "sysdeps.h" #include "sha512.h" #define SHA384_DIGEST_LENGTH (384/8) typedef struct SHA512_ctx SHA384_ctx; void SHA384_init (SHA384_ctx*); #define SHA384_update SHA512_update void SHA384_final (SHA384_ctx*, uint8*); #endif bglibs-2.04/include/iobuf.h0000664000076400007640000000055113244040127015144 0ustar bruceguenter#ifndef IO_BUF__H__ #define IO_BUF__H__ #include "iobuf_common.h" #include "ibuf.h" #include "obuf.h" /** \addtogroup iobuf * @{ */ /** \name Mass copying functions. */ int iobuf_copy(ibuf* in, obuf* out); int iobuf_copyflush(ibuf* in, obuf* out); int ibuf_copytofd(ibuf* in, int out); int obuf_copyfromfd(int in, obuf* out); /** @} */ /** @} */ #endif bglibs-2.04/include/gstack.h0000664000076400007640000000432613244040127015320 0ustar bruceguenter#ifndef BGLIBS__GENERIC_STACK__H__ #define BGLIBS__GENERIC_STACK__H__ #include "adt_common.h" /** \defgroup adt_gstack adt gstack: Generic simple stack. * * A generic stack is a first-in-last-out structure defined here based * on three primary operations: push, top, and pop. Pushing an element * onto a stack adds it to the head of the list. The top operation * fetches the most recently pushed element still on the stack, and * popping removes it. */ /** @{ */ /** \example adt/gstack_test.c */ /** Generic stack node. */ struct gstack_node { /** Pointer to the next element in the stack linked list. */ struct gstack_node* next; /** The data contained in the stack node. */ char data[0]; }; /** Generic stack structure. */ struct gstack { /** Pointer to the first item in the stack. */ struct gstack_node* head; /** The number of items in the stack. */ unsigned count; }; int gstack_push(struct gstack* d, unsigned datasize, const void* data, adt_copy_fn* fn); void* gstack_top(const struct gstack* s); void gstack_pop(struct gstack* s, adt_free_fn* fn); /** Declare specialized \c gstack functions. */ #define GSTACK_DECL(PREFIX,TYPE) \ extern int PREFIX##_push(struct gstack* s, TYPE const* data); \ extern TYPE* PREFIX##_top(struct gstack* s); \ extern void PREFIX##_pop(struct gstack* s); /** Define a specialized \c gstack push function. */ #define GSTACK_PUSH_DEFN(PREFIX,TYPE,COPY) \ int PREFIX##_push(struct gstack* s, TYPE const* data) { \ return gstack_push(s, sizeof *data, data, (adt_copy_fn*)COPY); \ } /** Define a specialized \c gstack top function. */ #define GSTACK_TOP_DEFN(PREFIX,TYPE) \ TYPE* PREFIX##_top(struct gstack* s) { \ return (s->head == 0) ? 0 : (TYPE*)s->head->data; \ } /** Define a specialized \c gstack pop function. */ #define GSTACK_POP_DEFN(PREFIX,FREE) \ void PREFIX##_pop(struct gstack* s) { \ gstack_pop(s, (adt_free_fn*)(FREE)); \ } /** Define all the specialized \c gstack functions. If \c COPY is \c * NULL, a simple memcpy is used instead. If \c FREE is \c NULL, no * attempt is made to free the data. */ #define GSTACK_DEFN(PREFIX,TYPE,COPY,FREE) \ GSTACK_PUSH_DEFN(PREFIX,TYPE,COPY) \ GSTACK_TOP_DEFN(PREFIX,TYPE) \ GSTACK_POP_DEFN(PREFIX,FREE) /** @} */ #endif bglibs-2.04/include/str.h0000664000076400007640000002056013244040127014652 0ustar bruceguenter#ifndef STR__H__ #define STR__H__ #include #include "sysdeps.h" /** \defgroup str str: Dynamically allocated string library. \par Calling Convention The standard calling convention to \c str functions is to pass the string being examined or modified as the first argument. For most functions, the return value will be \c 0 (false) if an error occurred (ie memory allocation failed) and non-zero (true) otherwise. @{ */ /** The block size in which string memory is allocated. * * \c STR_BLOCKSIZE should be set to at least the size at which the * allocator (ie \c malloc) will align the data it returns. String data * will be allocated in steps of this number. Values smaller than the * alignment will only cause a small amount of space to be wasted, and * will not trigger bugs. */ #define STR_BLOCKSIZE 16 /** The basic string structure. \note Initialize to {0,0,0}. */ struct str { /** The pointer to the allocated data. This string will always be * terminated with a \c NUL byte to ensure compatibility with standard * C string functions. May be used directly by programs, but should * not be assigned. */ char* s; /** The length of the string data inside the above block. May be used * directly by programs, but should not be assigned a non-zero * value.*/ unsigned len; /** The size of the above block. */ unsigned size; }; /** String structure typedef. */ typedef struct str str; /** This struct is used to serve in lists of pointers into a string for sorting. Only used as parameters to the comparison function in \c str_sort */ struct str_sortentry { /** Pointer to the string data to compare. */ const char* str; /** Length of the string data to compare. */ unsigned long len; }; /** String sort entry typedef. */ typedef struct str_sortentry str_sortentry; /** \name Globals * @{ */ extern const char str_lcase_digits[36] __DEPRECATED__; extern const char str_ucase_digits[36] __DEPRECATED__; /** @} */ /** \name Overhead Functions * @{ */ int str_init(str* s); int str_alloc(str* s, unsigned size, int copy); /** Make sure string S has at least SZ bytes ready (no copy) */ #define str_ready(S,SZ) str_alloc(S,SZ,0) /** Reallocate string S to size SZ bytes, copying the existing string */ #define str_realloc(S,SZ) str_alloc(S,SZ,1) void str_free(str* s); int str_truncate(str* s, unsigned len); /** @} */ /** \name Assignment Functions * @{ */ int str_copy(str* s, const str* in); int str_copys(str* s, const char* in); int str_copyb(str* s, const char* in, unsigned len); int str_copyf(str* s, const char* format, ...); int str_copyfv(str* s, const char* format, va_list ap); int str_copyns(str* s, unsigned int count, ...); int str_copy2s(str* s, const char* a, const char* b); int str_copy3s(str* s, const char* a, const char* b, const char* c); int str_copy4s(str* s, const char* a, const char* b, const char* c, const char* d); int str_copy5s(str* s, const char* a, const char* b, const char* c, const char* d, const char* e); int str_copy6s(str* s, const char* a, const char* b, const char* c, const char* d, const char* e, const char* f); /** @} */ /** \name Appending Functions * @{ */ int str_cat(str* s, const str* in); int str_cats(str* s, const char* in); int str_catc(str* s, char in); int str_catb(str* s, const char* in, unsigned len); int str_catf(str* s, const char* format, ...); int str_catfv(str* s, const char* format, va_list ap); int str_cati(str* s, long in); int str_catiw(str* s, long in, unsigned width, char pad); int str_catu(str* s, unsigned long in); int str_catuw(str* s, unsigned long in, unsigned width, char pad); int str_catx(str* s, unsigned long in); int str_catxw(str* s, unsigned long in, unsigned width, char pad); int str_catill(str* s, long long in); int str_catiwll(str* s, long long in, unsigned width, char pad); int str_catull(str* s, unsigned long long in); int str_catuwll(str* s, unsigned long long in, unsigned width, char pad); int str_catxll(str* s, unsigned long long in); int str_catxwll(str* s, unsigned long long in, unsigned width, char pad); int str_catsnumw(str* s, long in, unsigned width, char pad, unsigned base, const char* digits); int str_catunumw(str* s, unsigned long in, unsigned width, char pad, unsigned base, const char* digits); int str_catsllnumw(str* s, long long in, unsigned width, char pad, unsigned base, const char* digits); int str_catullnumw(str* s, unsigned long long in, unsigned width, char pad, unsigned base, const char* digits); int str_catns(str* s, unsigned int count, ...); int str_cat2s(str* s, const char* a, const char* b); int str_cat3s(str* s, const char* a, const char* b, const char* c); int str_cat4s(str* s, const char* a, const char* b, const char* c, const char* d); int str_cat5s(str* s, const char* a, const char* b, const char* c, const char* d, const char* e); int str_cat6s(str* s, const char* a, const char* b, const char* c, const char* d, const char* e, const char* f); int str_join(str* s, char sep, const str* t); int str_joins(str* s, char sep, const char* in); int str_joinb(str* s, char sep, const char* in, unsigned len); /** @} */ /** \name In-place Modification Functions */ /* @{ */ void str_lower(str* s); void str_upper(str* s); long str_subst(str* s, char from, char to); void str_lstrip(str* s); void str_rstrip(str* s); #define str_strip(S) (str_rstrip(S), str_lstrip(S)) void str_lcut(str* s, unsigned count); void str_rcut(str* s, unsigned count); int str_sort(str* s, char sep, long count, int (*fn)(const str_sortentry* a, const str_sortentry* b)); int str_splice(str* s, unsigned start, unsigned len, const str* r); int str_splices(str* s, unsigned start, unsigned len, const char* r); int str_spliceb(str* s, unsigned start, unsigned len, const char* r, unsigned rlen); long str_xlate(str* s, const char* from, const char* to, unsigned nchars); /** @} */ /** \name Comparison Functions * @{ */ int str_cmp(const str* a, unsigned aoffset, const str* b, unsigned boffset); int str_cmps(const str* a, unsigned offset, const char* b); int str_cmpb(const str* a, unsigned offset, const char* b, unsigned len); int str_diff(const str* a, const str* b); int str_diffs(const str* a, const char* b); int str_diffb(const str* a, const char* b, unsigned len); int str_start(const str* a, const str* b); int str_starts(const str* a, const char* b); int str_startb(const str* a, const char* b, unsigned len); int str_case_start(const str* a, const str* b); int str_case_starts(const str* a, const char* b); int str_case_startb(const str* a, const char* b, unsigned len); int str_end(const str* a, const str* b); int str_ends(const str* a, const char* b); int str_endb(const str* a, const char* b, unsigned len); int str_case_end(const str* a, const str* b); int str_case_ends(const str* a, const char* b); int str_case_endb(const str* a, const char* b, unsigned len); /** @} */ /** \name Searching Functions * @{ */ void str_buildmap(int map[256], const char* list); unsigned str_count(const str* s, char ch); unsigned str_countof(const str* s, const char* list); #define str_findfirst(S,C) str_findnext(S,C,0) #define str_findfirstof(S,L) str_findnextof(S,L,0) #define str_findfirstnot(S,L) str_findnextnot(S,L,0) #define str_findlast(S,C) str_findprev(S,C,-1) #define str_findlastof(S,L) str_findprevof(S,L,-1) #define str_findlastnot(S,L) str_findprevof(S,L,-1) int str_findnext(const str* s, char ch, unsigned pos); int str_findnextof(const str* s, const char* list, unsigned pos); int str_findnextnot(const str* s, const char* list, unsigned pos); int str_findprev(const str* s, char ch, unsigned pos); int str_findprevof(const str* s, const char* list, unsigned pos); int str_findprevnot(const str* s, const char* list, unsigned pos); /** @} */ /** \name Pattern Matching Functions * @{ */ int str_match(const str* s, const str* pattern); int str_matchb(const str* s, const char* pptr, unsigned plen); int str_matchs(const str* s, const char* pattern); int str_case_match(const str* s, const str* pattern); int str_case_matchb(const str* s, const char* pptr, unsigned plen); int str_case_matchs(const str* s, const char* pattern); int str_glob(const str* s, const str* pattern); int str_globb(const str* s, const char* pptr, unsigned plen); int str_globs(const str* s, const char* pattern); int str_case_glob(const str* s, const str* pattern); int str_case_globb(const str* s, const char* pptr, unsigned plen); int str_case_globs(const str* s, const char* pattern); /** @} */ /** @} */ #endif bglibs-2.04/include/wrap.h0000664000076400007640000000026213244040127015010 0ustar bruceguenter#ifndef MSG__WRAP__H__ #define MSG__WRAP__H__ extern int wrap_exit; extern void wrap_chdir(const char*); extern void wrap_str(int); extern void wrap_alloc(const void*); #endif bglibs-2.04/include/bglibs0000777000076400007640000000000013244040127015126 2.ustar bruceguenterbglibs-2.04/include/striter.h0000664000076400007640000000256013244040127015536 0ustar bruceguenter#ifndef STR_ITER__H__ #define STR_ITER__H__ struct str; /** \defgroup striter striter: Iterator over substrings of a str. \par Calling Convention All non-void functions return \c 0 (false) if the function failed or the iterator is no longer valid, and non-zero (true) otherwise. @{ */ /** The basic striter data type. */ typedef struct { /** A pointer to the str being iterated over. */ const struct str* str; /** The starting offset of the current substring. */ unsigned start; /** Pointer to the current substring. */ const char* startptr; /** Length of the current substring. */ unsigned len; /** The seperator used to delimit the substrings. */ char sep; } striter; void striter_start(striter* iter, const struct str* s, char sep); int striter_valid(striter*); int striter_advance(striter*); /** Assign the current striter substring to a str. */ #define str_copyiter(STR,ITER) str_copyb(STR,(ITER)->startptr,(ITER)->len) /** Append the current striter substring to a str. */ #define str_catiter(STR,ITER) str_catb(STR,(ITER)->startptr,(ITER)->len) /** Output the current striter substring to an obuf. */ #define obuf_putiter(OBUF,ITER) obuf_write(OBUF,(ITER)->startptr,(ITER)->len) /** Loop macro; use in place of \c for(...) */ #define striter_loop(ITER,STR,SEP) for(striter_start(ITER,STR,SEP);striter_valid(ITER);striter_advance(ITER)) /** @} */ #endif bglibs-2.04/include/socket.h0000664000076400007640000000540313244040127015331 0ustar bruceguenter#ifndef NET__SOCKET__H__ #define NET__SOCKET__H__ #include "ipv4.h" #include "ipv6.h" /** \defgroup socket socket: General socket manipulations \par Calling Convention When calling a socket function, the socket file descriptor (where required) will always be the first parameter. Functions that return a file descriptor (either creating a new socket or accepting a connection on a socket return that file descriptor on success or \c -1 on error. All other functions return non-zero (true) on success or \c 0 (false) on error. All functions set errno on error. @{ */ /** \name IP socket functions @{ */ int socket_tcp4(void); int socket_tcp6(void); int socket_tcp(void); int socket_udp4(void); int socket_udp6(void); int socket_udp(void); int socket_connect4(int sock, const ipv4addr* ip, ipv4port port); int socket_connect4_timeout(int sock, const ipv4addr* ip, ipv4port port, int timeout); int socket_connect6(int sock, const ipv6addr* ip, ipv6port port); int socket_connect6_timeout(int sock, const ipv6addr* ip, ipv6port port, int timeout); int socket_bind4(int sock, const ipv4addr* ip, ipv4port port); int socket_bind6(int sock, const ipv6addr* ip, ipv6port port); int socket_accept4(int sock, ipv4addr* ip, ipv4port* port); int socket_accept6(int sock, ipv6addr* ip, ipv6port* port); int socket_recv4(int sock, char* buffer, unsigned buflen, ipv4addr* ip, ipv4port* port); int socket_recv6(int sock, char* buffer, unsigned buflen, ipv6addr* ip, ipv6port* port); int socket_send4(int sock, const char* buffer, unsigned buflen, const ipv4addr* ip, ipv4port port); int socket_send6(int sock, const char* buffer, unsigned buflen, const ipv6addr* ip, ipv6port port); int socket_getaddr4(int sock, ipv4addr* ip, ipv4port* port); int socket_getaddr6(int sock, ipv6addr* ip, ipv6port* port); int socket_cork(int sock); int socket_uncork(int sock); int socket_notcpdelay(int sock, int enable); /** @} */ /** \name UNIX local-domain socket functions @{ */ int socket_unixdgm(void); int socket_unixstr(void); int socket_connectu(int sock, const char* path); int socket_connectu_timeout(int sock, const char* path, int timeout); int socket_bindu(int sock, const char* path); int socket_acceptu(int sock); int socket_recvu(int sock, char* buffer, unsigned buflen); int socket_sendu(int sock, const char* buffer, unsigned buflen); int socket_pairstr(int fd[2]); int socket_pairdgm(int fd[2]); /** @} */ /** \name Functions for any type of socket @{ */ int socket_broadcast(int sock); int socket_connected(int sock); int socket_linger(int fd, int onoff, int seconds); int socket_listen(int sock, int backlog); int socket_reuse(int sock); int socket_shutdown(int sock, int shut_rd, int shut_wr); int socket_sendfd(int sock, int fd); int socket_recvfd(int sock); /** @} */ /** @} */ #endif bglibs-2.04/include/gcrc.h0000664000076400007640000000075113244040127014760 0ustar bruceguenter#ifndef GENERIC_CRC__H__ #define GENERIC_CRC__H__ #include "sysdeps.h" uint16 gcrc16fwd(uint16, const char*, long len, const uint16[256]); uint16 gcrc16rfl(uint16, const char*, long len, const uint16[256]); uint32 gcrc32fwd(uint32, const char*, long len, const uint32[256]); uint32 gcrc32rfl(uint32, const char*, long len, const uint32[256]); uint64 gcrc64fwd(uint64, const char*, long len, const uint64[256]); uint64 gcrc64rfl(uint64, const char*, long len, const uint64[256]); #endif bglibs-2.04/include/crc16_ccitt.h0000664000076400007640000000061513244040127016145 0ustar bruceguenter#ifndef CRC16__CCITT__H__ #define CRC16__CCITT__H__ #include "gcrc.h" #define CRC16_CCITT_POLY ((uint16)0x1021) #define CRC16_CCITT_INIT ((uint16)0xffff) #define CRC16_CCITT_POST ((uint16)0) extern const uint16 crc16_ccitt_table[256]; #define crc16_ccitt_update(C,D,L) gcrc16fwd((C),(D),(L),crc16_ccitt_table) #define crc16_ccitt_block(B,L) crc16_ccitt_update(CRC16_CCITT_INIT,(B),(L)) #endif bglibs-2.04/include/fmt.h0000664000076400007640000001102113244040127014620 0ustar bruceguenter#ifndef FMT__NUMBER__H__ #define FMT__NUMBER__H__ #include struct str; /** \defgroup fmt fmt: Formatting Functions \par Function Naming -# Prefix - \c fmt_ : Always present -# Data type - \c s : Signed integer (long) - \c u : Unsigned integer (long) - \c sll : Signed long long integer - \c ull : Unsigned long long integer -# Conversion type - \c num : Generic number - \c dec : Decimal - \c hex : Hexadecimal (lower case) - \c Hex : Hexadecimal (upper case) -# Width / Padding - \c w : (optional) Pad out the result to a minimum width For example, \c fmt_sdecw formats a signed integer using decimal with width padding. \par Calling Convention Parameters to the fmt functions are passed in the following order. The presence of all parameters, except for \c buffer, is dependant on which function is being used. -# \c buffer : The character string into which to put the data result. If this is \c NULL, no data is written, and only the length is calculated. This is useful for determining how long a formatted string might be. -# \c number or \c data : The input data item to convert. -# \c width : The minimum output width. -# \c pad : The character with which to pad the output. -# \c base : The numerical base to use. -# \c digits : The array of digits to use. \par Return Value All fmt functions return the number of bytes written to the buffer space. @{ */ /** The maximum space used by a formatted number. This value is long enough for 2^128 plus a trailing \c NUL byte. */ #define FMT_ULONG_LEN 40 extern const char fmt_lcase_digits[36]; extern const char fmt_ucase_digits[36]; extern unsigned fmt_pad(char* buffer, unsigned width, char pad); extern unsigned fmt_sign_pad(char* buffer, int sign, unsigned width, char pad); /** \name Signed integer conversions * @{ */ extern unsigned fmt_snumw(char* buffer, long num, unsigned width, char pad, unsigned base, const char* digits); extern unsigned fmt_sdec(char* buffer, long num); extern unsigned fmt_sdecw(char* buffer, long num, unsigned width, char pad); /** @} */ /** \name Signed long long integer conversions * @{ */ extern unsigned fmt_sllnumw(char* buffer, long long num, unsigned width, char pad, unsigned base, const char* digits); extern unsigned fmt_slldec(char* buffer, long long num); extern unsigned fmt_slldecw(char* buffer, long long num, unsigned width, char pad); /** @} */ /** \name Unsigned integer conversions * @{ */ extern unsigned fmt_unumw(char* buffer, unsigned long num, unsigned width, char pad, unsigned base, const char* digits); extern unsigned fmt_udec(char* buffer, unsigned long num); extern unsigned fmt_udecw(char* buffer, unsigned long num, unsigned width, char pad); extern unsigned fmt_uhex(char* buffer, unsigned long num); extern unsigned fmt_uhexw(char* buffer, unsigned long num, unsigned width, char pad); extern unsigned fmt_uHex(char* buffer, unsigned long num); extern unsigned fmt_uHexw(char* buffer, unsigned long num, unsigned width, char pad); /** @} */ /** \name Unsigned long long integer conversions * @{ */ extern unsigned fmt_ullnumw(char* buffer, unsigned long long num, unsigned width, char pad, unsigned base, const char* digits); extern unsigned fmt_ulldec(char* buffer, unsigned long long num); extern unsigned fmt_ulldecw(char* buffer, unsigned long long num, unsigned width, char pad); extern unsigned fmt_ullhex(char* buffer, unsigned long long num); extern unsigned fmt_ullhexw(char* buffer, unsigned long long num, unsigned width, char pad); extern unsigned fmt_ullHex(char* buffer, unsigned long long num); extern unsigned fmt_ullHexw(char* buffer, unsigned long long num, unsigned width, char pad); /** @} */ /** \name Miscelaneous formatting @{ */ extern unsigned fmt_char(char* buffer, int ch, unsigned width, char pad); extern unsigned fmt_mem(char* buffer, const char* s, unsigned length, unsigned width, char pad); extern unsigned fmt_chars(char* buffer, const char* s, unsigned width, char pad); extern unsigned fmt_str(char* buffer, const struct str* s, unsigned width, char pad); /** @} */ /** \name Multiple item formatting @{ */ /** Format function prototype, used by the "@" conversion in fmt_multi() */ typedef unsigned (*fmt_function)(char* buffer, const void* data, unsigned width, char pad); extern unsigned fmt_multi(char* buffer, const char* format, ...); extern unsigned fmt_multiv(char* buffer, const char* format, va_list ap); /** @} */ /** @} */ #endif bglibs-2.04/include/base64.h0000664000076400007640000000113113244040127015117 0ustar bruceguenter#ifndef BASE64__H__ #define BASE64__H__ #include "str.h" #define BASE64_PAD '=' extern const char base64_bin2asc[64]; extern void base64_encode_whole(const unsigned char bin[3], char encoded[4]); extern void base64_encode_part(const unsigned char bin[3], unsigned len, char encoded[4]); extern int base64_encode_line(const unsigned char* bin, unsigned long len, str* encoded); extern const signed char base64_asc2bin[256]; extern int base64_decode_part(const char encoded[4], unsigned char bin[3]); extern int base64_decode_line(const char* encoded, str* bin); #endif bglibs-2.04/include/ipv4.h0000664000076400007640000000154613244040127014727 0ustar bruceguenter#ifndef NET__IPV4__H__ #define NET__IPV4__H__ #include "sysdeps.h" /** \defgroup ipv4 ipv4: IPv4 Address Handling @{ */ /** IPv4 address structure. */ typedef struct { /** 32-bit IPv4 address, represented as 4 8-bit \c unsigned \c chars. */ uint8 addr[4]; } ipv4addr; /** IPv4 port number. */ typedef uint16 ipv4port; extern const ipv4addr IPV4ADDR_ANY; extern const ipv4addr IPV4ADDR_BROADCAST; extern const ipv4addr IPV4ADDR_LOOPBACK; extern int ipv4_parse(const char* s, ipv4addr* addr, const char** end) __DEPRECATED__; extern const char* ipv4_scan(const char* s, ipv4addr* addr); extern const char* ipv4_format(const ipv4addr* addr); extern const char* ipv4_format_reverse(const ipv4addr* addr); extern unsigned fmt_ipv4addr(char* buffer, const ipv4addr* addr); extern unsigned fmt_ipv4addr_reverse(char* buffer, const ipv4addr* addr); /** @} */ #endif bglibs-2.04/include/cli.h0000664000076400007640000000227613244040127014615 0ustar bruceguenter#ifndef CLI__H__ #define CLI__H__ enum cli_option_type { CLI_FLAG, CLI_COUNTER, CLI_INTEGER, CLI_UINTEGER, CLI_STRING, CLI_STRINGLIST, CLI_FUNCTION, CLI_SEPARATOR, }; typedef enum cli_option_type cli_option_type; struct cli_option { char ch; const char* name; cli_option_type type; int flag_value; void* dataptr; const char* helpstr; const char* defaultstr; }; typedef struct cli_option cli_option; struct cli_stringlist { const char* string; const struct cli_option* option; struct cli_stringlist* next; }; typedef struct cli_stringlist cli_stringlist; typedef void cli_function(const char* string, const struct cli_option* option); /* The following are required from the CLI program */ extern const char cli_help_prefix[]; extern const char cli_help_suffix[]; extern const char cli_args_usage[]; extern const int cli_args_min; extern const int cli_args_max; extern cli_option cli_options[]; extern int cli_main(int argc, char** argv); /* The following are provided to the CLI program */ extern const char* argv0; extern const char* argv0base; extern const char* argv0dir; extern void usage(int exit_value, const char* errorstr); extern void cli_show_help(void); #endif bglibs-2.04/include/md4.h0000664000076400007640000001055613244040127014532 0ustar bruceguenter/* Declaration of functions and data types used for MD4 hash computing library functions. Copyright (C) 2000,2002,2005 Bruce Guenter. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _MD4_H #define _MD4_H 1 #include #if defined HAVE_LIMITS_H || _LIBC # include #endif /* The following contortions are an attempt to use the C preprocessor to determine an unsigned integral type that is 32 bits wide. An alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but doing that would require that the configure script compile and *run* the resulting executable. Locally running cross-compiled executables is usually not possible. */ #ifdef _LIBC # include typedef u_int32_t md4_uint32; #else # if defined __STDC__ && __STDC__ # define UINT_MAX_32_BITS 4294967295U # else # define UINT_MAX_32_BITS 0xFFFFFFFF # endif /* If UINT_MAX isn't defined, assume it's a 32-bit type. This should be valid for all systems GNU cares about because that doesn't include 16-bit systems, and only modern systems (that certainly have ) have 64+-bit integral types. */ # ifndef UINT_MAX # define UINT_MAX UINT_MAX_32_BITS # endif # if UINT_MAX == UINT_MAX_32_BITS typedef unsigned int md4_uint32; # else # if USHRT_MAX == UINT_MAX_32_BITS typedef unsigned short md4_uint32; # else # if ULONG_MAX == UINT_MAX_32_BITS typedef unsigned long md4_uint32; # else /* The following line is intended to evoke an error. Using #error is not portable enough. */ "Cannot determine unsigned 32-bit data type." # endif # endif # endif #endif #undef __P #if defined (__STDC__) && __STDC__ # define __P(x) x #else # define __P(x) () #endif /* Structure to save state of computation between the single steps. */ struct md4_ctx { md4_uint32 A; md4_uint32 B; md4_uint32 C; md4_uint32 D; md4_uint32 total[2]; md4_uint32 buflen; char buffer[64]; }; typedef struct md4_ctx MD4_CTX; /* * The following three functions are build up the low level used in * the functions `md4_stream' and `md4_buffer'. */ /* Initialize structure containing state of computation. (RFC 1320, 3.3: Step 3) */ extern void md4_init_ctx __P ((struct md4_ctx *ctx)); /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is necessary that LEN is a multiple of 64!!! */ extern void md4_process_block __P ((const void *buffer, struct md4_ctx *ctx)); /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is NOT required that LEN is a multiple of 64. */ extern void md4_process_bytes __P ((const void *buffer, size_t len, struct md4_ctx *ctx)); /* Process the remaining bytes in the buffer and put result from CTX in first 16 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ extern void *md4_finish_ctx __P ((struct md4_ctx *ctx, void *resbuf)); /* Put result from CTX in first 16 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ extern void *md4_read_ctx __P ((const struct md4_ctx *ctx, void *resbuf)); #endif /* md4.h */ bglibs-2.04/include/path.h0000664000076400007640000000123213244040127014771 0ustar bruceguenter#ifndef LIB__PATH__H__ #define LIB__PATH__H__ #include "str.h" /** \defgroup path path: Filename manipulation functions @{ */ /** Make path_match include files starting with dots. */ #define PATH_MATCH_DOTFILES 1 extern int path_merge(str* path, const char* start); extern int fnmatch(const char* filename, const char* pattern, unsigned options); extern int has_magic(const char* s); extern int path_match(const char* pattern, str* result, unsigned options); extern int path_contains(const char* path, const char* part); extern int path_mktemp(const char* prefix, str* filename); extern int path_mkdirs(const char* path, unsigned mode); /** @} */ #endif bglibs-2.04/include/selfpipe.h0000664000076400007640000000035313244040127015647 0ustar bruceguenter#ifndef BGLIBS__SELF_PIPE__H__ #define BGLIBS__SELF_PIPE__H__ /** \defgroup selfpipe selfpipe: Safe child exit management. @{ */ int selfpipe_init(void); void selfpipe_close(void); void selfpipe_catch_signal(int); /** @} */ #endif bglibs-2.04/include/ghash.h0000664000076400007640000002142313244040127015133 0ustar bruceguenter#ifndef BGLIBS__GENERIC_HASH__H__ #define BGLIBS__GENERIC_HASH__H__ #include "adt_common.h" /** \defgroup adt_ghash adt ghash: Generic hash tables. * * The actual hash table manipulation functions use a simple linear * probing algorithm with a dynamic table size. Since many more slots * are allocated than are in use at any given time, there are always * plenty of empty slots available to make searches short. Since each * shot is a single pointer, these extra slots don't consume a * significant amount of memory. * * The structure at the center of the \c ghash implementation contains * pointers to the actual data (including all relevant metadata) plus * function pointers to the functions needed to manipulate the data. */ /** @{ */ /** \example adt/ghash_test.c */ /** The core generic hash table structure. */ struct ghash { /** The hash table itself is an array of pointers, the actual type of * which is dependant on the declaration of the table. */ void** table; /** The count is the number of items stored in the table. */ unsigned count; /** The size is the number of slots available in the table. */ unsigned size; /** The size, in bytes, of the key structure in each table entry. */ unsigned long keysize; /** The total size, in bytes, of an entry (key and data). */ unsigned long entrysize; /** Pointer to the function which produces a hash of a key. */ adt_hash_fn* hashfn; /** Pointer to the function which compares two keys. */ adt_cmp_fn* keycmp; /** Pointer to the function which copies a key. */ adt_copy_fn* keycopy; /** Pointer to the function which copies a data item. */ adt_copy_fn* datacopy; /** Pointer to the function which frees a key. */ adt_free_fn* keyfree; /** Pointer to the function which fressa a data item. */ adt_free_fn* datafree; }; /** The hash value stored within an entry \c P . */ #define ghash_entry_hash(P) (*(adt_hash_t*)(P)) /** The key structure address within an entry \c P . */ #define ghash_entry_keyptr(P) ((P)+sizeof(adt_hash_t)) /** The data structure address within an entry \c P . The offset * parameter \c L is the size of the key structure. */ #define ghash_entry_dataptr(P,L) ((P)+sizeof(adt_hash_t)+(L)) /** The \c adt_hashb function also works for ghash */ #define ghash_hashb adt_hashb /** The \c adt_hashs function also works for ghash */ #define ghash_hashs adt_hashs /** The \c adt_hashsp function also works for ghash */ #define ghash_hashsp adt_hashsp void ghash_insert(struct ghash* d, void* e); void* ghash_add(struct ghash* d, const void* key, const void* data); void* ghash_set(struct ghash* d, const void* key, const void* data); void ghash_free(struct ghash* d); void** ghash_find(struct ghash* d, const void* key); void* ghash_get(struct ghash* d, const void* key); void ghash_init(struct ghash* d, unsigned long keysize, unsigned long entrysize, adt_hash_fn* hashfn, adt_cmp_fn* keycmp, adt_copy_fn* keycopy, adt_copy_fn* datacopy, adt_free_fn* keyfree, adt_free_fn* datafree); int ghash_rebuild(struct ghash* d); int ghash_rehash(struct ghash* d); int ghash_remove(struct ghash* d, const void* key); void ghash_foreach(struct ghash* d, void (*fn)(void* entry)); void* ghash_search(struct ghash* d, int (*fn)(const void* entry)); /** Prototype for the \c ghash entry structure, containing a key of type * \c KTYPE and data of type \c DTYPE . */ #define GHASH_STRUCT_ENTRY(PREFIX,KTYPE,DTYPE) \ struct PREFIX##_entry { \ adt_hash_t hash; \ KTYPE key; \ DTYPE data; \ } /** The offset of the key into a specialized \c ghash entry. */ #define GHASH_KEYOFFSET(PREFIX) ((unsigned long)&((struct PREFIX##_entry*)0)->key) /** The offset of the data into a specialized \c ghash entry. */ #define GHASH_DATAOFFSET(PREFIX) ((unsigned long)&((struct PREFIX##_entry*)0)->data) /** The actual size of the key data in a specialized \c ghash entry. */ #define GHASH_KEYSIZE(PREFIX) ( \ GHASH_DATAOFFSET(PREFIX)-GHASH_KEYOFFSET(PREFIX) \ ) /** Declare all the prototypes for a \c ghash table, specialized to * particular key and data types. */ #define GHASH_DECL(PREFIX,KTYPE,DTYPE) \ GHASH_STRUCT_ENTRY(PREFIX,KTYPE,DTYPE); \ extern void PREFIX##_init(struct ghash* d); \ extern void PREFIX##_free(struct ghash* d); \ extern struct PREFIX##_entry* PREFIX##_add(struct ghash* d, \ KTYPE const* key, \ DTYPE const* data); \ extern struct PREFIX##_entry* PREFIX##_set(struct ghash* d, \ KTYPE const* key, \ DTYPE const* data); \ extern struct PREFIX##_entry* PREFIX##_get(struct ghash* d, \ KTYPE const* key); \ extern int PREFIX##_rebuild(struct ghash* d); \ extern int PREFIX##_rehash(struct ghash* d); \ extern int PREFIX##_remove(struct ghash* d, KTYPE const* key); \ extern void PREFIX##_foreach(struct ghash* d, \ void (*fn)(struct PREFIX##_entry*)); \ extern struct PREFIX##_entry* PREFIX##_search(struct ghash* d, \ int (*fn)(const struct PREFIX##_entry*)); /** Define a specialized \c ghash table init function. */ #define GHASH_INIT_DEFN(PREFIX,KTYPE,DTYPE,HASHFN,CMP,KCOPY,DCOPY,KFREE,DFREE)\ void PREFIX##_init(struct ghash* d) { \ ghash_init(d, \ GHASH_KEYSIZE(PREFIX), \ sizeof(struct PREFIX##_entry), \ (adt_hash_fn*)HASHFN, \ (adt_cmp_fn*)CMP, \ (adt_copy_fn*)KCOPY, \ (adt_copy_fn*)DCOPY, \ (adt_free_fn*)KFREE, \ (adt_free_fn*)DFREE); \ } /** Define a specialized \c ghash table free function. */ #define GHASH_FREE_DEFN(PREFIX) \ void PREFIX##_free(struct ghash* d) { \ ghash_free(d); \ } /** Define a specialized \c ghash table add function. */ #define GHASH_ADD_DEFN(PREFIX,KTYPE,DTYPE) \ struct PREFIX##_entry* PREFIX##_add(struct ghash* d, \ KTYPE const* key, DTYPE const* data) { \ return ghash_add(d, key, data); \ } /** Define a specialized \c ghash table add function. */ #define GHASH_SET_DEFN(PREFIX,KTYPE,DTYPE) \ struct PREFIX##_entry* PREFIX##_set(struct ghash* d, \ KTYPE const* key, DTYPE const* data) { \ return ghash_set(d, key, data); \ } /** Define a specialized \c ghash table get function. */ #define GHASH_GET_DEFN(PREFIX,KTYPE) \ struct PREFIX##_entry* PREFIX##_get(struct ghash* d, KTYPE const* key) { \ return ghash_get(d, key); \ } /** Define a specialized \c ghash table rebuild function. */ #define GHASH_REBUILD_DEFN(PREFIX) \ int PREFIX##_rebuild(struct ghash* d) { \ return ghash_rebuild(d); \ } /** Define a specialized \c ghash table rehash function. */ #define GHASH_REHASH_DEFN(PREFIX) \ int PREFIX##_rehash(struct ghash* d) { \ return ghash_rehash(d); \ } /** Define a specialized \c ghash table remove function. */ #define GHASH_REMOVE_DEFN(PREFIX,KTYPE) \ extern int PREFIX##_remove(struct ghash* d, KTYPE const* key) { \ return ghash_remove(d, (void*)key); \ } /** Define a specialized \c ghash table iterator function. */ #define GHASH_FOREACH_DEFN(PREFIX) \ void PREFIX##_foreach(struct ghash* d, void (*fn)(struct PREFIX##_entry*)) { \ ghash_foreach(d, (void (*)(void*))fn); \ } /** Define a specialized \c ghash table search function. */ #define GHASH_SEARCH_DEFN(PREFIX) \ struct PREFIX##_entry* PREFIX##_search(struct ghash* d, int (*fn)(const struct PREFIX##_entry*)) { \ return ghash_search(d, (int (*)(const void*))fn); \ } /** Define all necessary functions for a specialized \c ghash table. If * either of the copy functions \c KCOPY or \c DCOPY are \c NULL, a * simple memcpy is used instead. If either of the free functions \c * KFREE or \c DFREE are NULL, no data freeing is attempted. */ #define GHASH_DEFN(PREFIX,KTYPE,DTYPE,HASHFN,CMPFN,KCOPY,DCOPY,KFREE,DFREE) \ GHASH_INIT_DEFN(PREFIX,KTYPE,DTYPE,HASHFN,CMPFN,KCOPY,DCOPY,KFREE,DFREE) \ GHASH_FREE_DEFN(PREFIX) \ GHASH_ADD_DEFN(PREFIX,KTYPE,DTYPE) \ GHASH_SET_DEFN(PREFIX,KTYPE,DTYPE) \ GHASH_GET_DEFN(PREFIX,KTYPE) \ GHASH_REBUILD_DEFN(PREFIX) \ GHASH_REHASH_DEFN(PREFIX) \ GHASH_REMOVE_DEFN(PREFIX,KTYPE) \ GHASH_FOREACH_DEFN(PREFIX) \ GHASH_SEARCH_DEFN(PREFIX) /** The iterator data necessary to loop over a \c ghash table. */ struct ghashiter { /** A pointer to the source \c ghash table. */ const struct ghash* ghashp; /** The index of the current entry. */ unsigned index; /** A pointer to the current entry, for convenience. */ void* entry; }; void ghashiter_first(struct ghashiter*, const struct ghash*); int ghashiter_valid(const struct ghashiter*); void ghashiter_next(struct ghashiter*); /** A convenience macro which expands to a \c for loop using the \c * ghashiter I to iterate over the table \c G . */ #define ghashiter_loop(I,G) \ for(ghashiter_first(I,G);ghashiter_valid(I);ghashiter_next(I)) /** @} */ #endif bglibs-2.04/include/crc64.h0000664000076400007640000000126613244040127014765 0ustar bruceguenter#ifndef CRC64__H__ #define CRC64__H__ #include "gcrc.h" /* Polynomial: x^64 + x^62 + x^57 + x^55 + x^54 + x^53 + x^52 + x^47 + * x^46 + x^45 + x^40 + x^39 + x^38 + x^37 + x^35 + x^33 + x^32 + x^31 + * x^29 + x^27 + x^24 + x^23 + x^22 + x^21 + x^19 + x^17 + x^13 + x^12 + * x^10 + x^9 + x^7 + x^4 + x + 1 * Borrowed from the DLT1 spec (ECMA-182). */ #define CRC64POLY ((uint64)0x42F0E1EBA9EA3693ULL) #define CRC64INIT ((uint64)0xffffffffffffffffULL) #define CRC64POST ((uint64)0xffffffffffffffffULL) extern const uint64 crc64_table[256]; #define crc64_update(C,B,L) gcrc64fwd((C),(B),(L),crc64_table) #define crc64_block(B,L) (crc64_update(CRC64INIT,(B),(L))^CRC64POST) #endif bglibs-2.04/include/dict.h0000664000076400007640000000206213244040127014762 0ustar bruceguenter#ifndef DICT__H__ #define DICT__H__ #include "str.h" #include "uint32.h" #define DICT_HASHSTART 5381 uint32 dict_hashadd(uint32 h, const unsigned char* data, unsigned long len); #define dict_hash(BUF,LEN) dict_hashadd(DICT_HASHSTART,BUF,LEN) #define dict_hashstr(STR) dict_hashadd(DICT_HASHSTART,(const unsigned char*)(STR)->s,(STR)->len) struct dict_entry { uint32 hash; str key; void* data; }; typedef struct dict_entry dict_entry; struct dict { unsigned size; unsigned count; dict_entry** table; }; typedef struct dict dict; extern int dict_init(dict*); extern void dict_free(dict*, void (*free_data)(void*)); extern int dict_add(dict*, const str*, void*); extern dict_entry* dict_get(dict*, const str*); extern void dict_foreach(dict* d, void (*fn)(const str* key, void** dataptr)); extern void dict_str_free(void*); extern int dict_load_list(dict*, const char* filename, int mustexist, int (*xform)(str*)); extern int dict_load_map(dict*, const char* filename, int mustexist, char sep, int (*keyxform)(str*), int (*valxform)(str*)); #endif bglibs-2.04/include/surfrand.h0000664000076400007640000000154013244040127015663 0ustar bruceguenter#ifndef BGLIBS__SURFRAND__H__ #define BGLIBS__SURFRAND__H__ #include "surf.h" /** \defgroup surfrand surfrand: Random number generator based on SURF @{ */ /** The surfrand state structure */ struct surfrand { /** counts the number of bytes in \c generated that have been output * already */ unsigned left; /** temporary storage for the generated random data */ uint32 generated[SURF_OUT_U32]; /** the input seed data */ uint32 seed[SURF_SEED_U32]; /** a giant counter used as input to SURF */ uint32 counter[SURF_IN_U32]; }; void surfrand_init(struct surfrand* c, const uint32* data, unsigned words); uint32 surfrand_uint32(struct surfrand* c); double surfrand_double(struct surfrand* c); void surfrand_fill(struct surfrand* c, unsigned char* buf, unsigned len); uint32 surfrand_uniform(struct surfrand* c, uint32 bound); /** @} */ #endif bglibs-2.04/include/ibuf.h0000664000076400007640000000417613244040127014774 0ustar bruceguenter#ifndef IO_BUF__IBUF__H__ #define IO_BUF__IBUF__H__ #include "iobuf_common.h" /** \defgroup ibuf ibuf: Input Buffer Managemenet \par Calling Convention Unless otherwise specified, the return value is non-zero (true) if the entire requested operation completed, and \c 0 (false) otherwise. @{ */ /** \c ibuf read function pointer prototype. */ typedef int (*ibuf_fn)(int, void*, unsigned long); /** Input specific buffer. */ struct ibuf { /** Base \c iobuf structure. */ iobuf io; /** The number of bytes read in the last operation. */ unsigned count; /** Function used to read data from the file descriptor. */ ibuf_fn readfn; }; /** Input specific buffer typedef. */ typedef struct ibuf ibuf; extern ibuf inbuf; int ibuf_init(ibuf* in, int fd, ibuf_fn fn, unsigned flags, unsigned bufsize); int ibuf_open(ibuf* in, const char* filename, unsigned bufsize); int ibuf_eof(ibuf* in); /** Close the \c ibuf. */ #define ibuf_close(in) iobuf_close(&((in)->io)) /** Test if the \c ibuf has been closed. */ #define ibuf_closed(in) iobuf_closed(&((in)->io)) /** Test if the \c ibuf is in an error state. */ #define ibuf_error(in) iobuf_error(&((in)->io)) /** Test if the last \c ibuf read timed out. */ #define ibuf_timedout(in) iobuf_timedout(&((in)->io)) int ibuf_refill(ibuf* in); int ibuf_read_large(ibuf* in, char* data, unsigned datalen); int ibuf_read(ibuf* in, char* data, unsigned datalen); unsigned ibuf_tell(ibuf* in); int ibuf_seek(ibuf* in, unsigned offset); /** Set the effective read position to the start of the file. */ #define ibuf_rewind(in) ibuf_seek(in,0) /** Set the effective read position \c off bytes forward. */ #define ibuf_seekfwd(in,off) ibuf_seek(ibuf_tell(in)+(offset)) int ibuf_peek(ibuf* in, char* ch); int ibuf_getc(ibuf* in, char* ch); int ibuf_getu(ibuf* in, unsigned long* data); int ibuf_gets(ibuf* in, char* data, unsigned datalen, char boundary); int ibuf_getstr(ibuf* in, struct str* s, char boundary); int ibuf_getstr_crlf(ibuf* in, struct str* s); int ibuf_getnetstring(ibuf* in, struct str* s); int ibuf_readall(ibuf* in, struct str* s); int ibuf_openreadclose(const char* filename, struct str* s); /** @} */ #endif bglibs-2.04/include/msg.h0000664000076400007640000000715613244040127014636 0ustar bruceguenter#ifndef MSG__H__ #define MSG__H__ #include "sysdeps.h" #include #include "debug.h" extern const char program[] __attribute__((__weak__)); extern const int msg_show_pid __attribute__((__weak__)); void msg_common(const char* type, const char*, const char*, const char*, const char*, const char*, const char*, int); void msg_commonf(const char* type, int showsys, const char* format, ...); void msg_commonfv(const char* type, int showsys, const char* format, va_list ap); #define msg(a,b,c,d,e,f) msg_common(0,a,b,c,d,e,f,0) void msg_warn(const char*, const char*, const char*, const char*, const char*, const char*, int); void msg_warnf(int showsys, const char* format, ...); void msg_error(const char*, const char*, const char*, const char*, const char*, const char*, int); void msg_errorf(int showsys, const char* format, ...); void msg_die(int code, const char* a, const char* b, const char* c, const char* d, const char* e, const char* f, int showsys) __NORETURN__; void msg_dief(int code, int showsys, const char* format, ...) __NORETURN__; #define msg1(a) msg(a,0,0,0,0,0) #define msg2(a,b) msg(a,b,0,0,0,0) #define msg3(a,b,c) msg(a,b,c,0,0,0) #define msg4(a,b,c,d) msg(a,b,c,d,0,0) #define msg5(a,b,c,d,e) msg(a,b,c,d,e,0) #define msg6(a,b,c,d,e,f) msg(a,b,c,d,e,f) #define msgf(f,...) msg_commonf(0,0,f,__VA_ARGS__) #define warn1(a) msg_warn(a,0,0,0,0,0,0) #define warn2(a,b) msg_warn(a,b,0,0,0,0,0) #define warn3(a,b,c) msg_warn(a,b,c,0,0,0,0) #define warn4(a,b,c,d) msg_warn(a,b,c,d,0,0,0) #define warn5(a,b,c,d,e) msg_warn(a,b,c,d,e,0,0) #define warn6(a,b,c,d,e,f) msg_warn(a,b,c,d,e,f,0) #define warnf(f,...) msg_warnf(0,f,__VA_ARGS__) #define error1(a) msg_error(a,0,0,0,0,0,0) #define error2(a,b) msg_error(a,b,0,0,0,0,0) #define error3(a,b,c) msg_error(a,b,c,0,0,0,0) #define error4(a,b,c,d) msg_error(a,b,c,d,0,0,0) #define error5(a,b,c,d,e) msg_error(a,b,c,d,e,0,0) #define error6(a,b,c,d,e,f) msg_error(a,b,c,d,e,f,0) #define errorf(f,...) msg_errorf(0,f,__VA_ARGS__) #define die1(x,a) msg_die(x,a,0,0,0,0,0,0) #define die2(x,a,b) msg_die(x,a,b,0,0,0,0,0) #define die3(x,a,b,c) msg_die(x,a,b,c,0,0,0,0) #define die4(x,a,b,c,d) msg_die(x,a,b,c,d,0,0,0) #define die5(x,a,b,c,d,e) msg_die(x,a,b,c,d,e,0,0) #define die6(x,a,b,c,d,e,f) msg_die(x,a,b,c,d,e,f,0) #define dief(x,f,...) msg_dief(x,0,f,__VA_ARGS__) #define warn1sys(a) msg_warn(a,0,0,0,0,0,1) #define warn2sys(a,b) msg_warn(a,b,0,0,0,0,1) #define warn3sys(a,b,c) msg_warn(a,b,c,0,0,0,1) #define warn4sys(a,b,c,d) msg_warn(a,b,c,d,0,0,1) #define warn5sys(a,b,c,d,e) msg_warn(a,b,c,d,e,0,1) #define warn6sys(a,b,c,d,e,f) msg_warn(a,b,c,d,e,f,1) #define warnfsys(f,...) msg_warnf(1,f,__VA_ARGS__) #define error1sys(a) msg_error(a,0,0,0,0,0,1) #define error2sys(a,b) msg_error(a,b,0,0,0,0,1) #define error3sys(a,b,c) msg_error(a,b,c,0,0,0,1) #define error4sys(a,b,c,d) msg_error(a,b,c,d,0,0,1) #define error5sys(a,b,c,d,e) msg_error(a,b,c,d,e,0,1) #define error6sys(a,b,c,d,e,f) msg_error(a,b,c,d,e,f,1) #define errorfsys(f,...) msg_errorf(1,f,__VA_ARGS__) #define die1sys(x,a) msg_die(x,a,0,0,0,0,0,1) #define die2sys(x,a,b) msg_die(x,a,b,0,0,0,0,1) #define die3sys(x,a,b,c) msg_die(x,a,b,c,0,0,0,1) #define die4sys(x,a,b,c,d) msg_die(x,a,b,c,d,0,0,1) #define die5sys(x,a,b,c,d,e) msg_die(x,a,b,c,d,e,0,1) #define die6sys(x,a,b,c,d,e,f) msg_die(x,a,b,c,d,e,f,1) #define diefsys(x,f,...) msg_dief(x,1,f,__VA_ARGS__) extern void die_oom(int); #endif bglibs-2.04/include/crc16_arc.h0000664000076400007640000000054513244040127015606 0ustar bruceguenter#ifndef CRC16__ARC__H__ #define CRC16__ARC__H__ #include "gcrc.h" #define CRC16_ARC_POLY ((uint16)0x8005) #define CRC16_ARC_INIT ((uint16)0) #define CRC16_ARC_POST ((uint16)0) extern const uint16 crc16_arc_table[256]; #define crc16_arc_update(C,D,L) gcrc16rfl((C),(D),(L),crc16_arc_table) #define crc16_arc_block(B,L) crc16_arc_update(0,(B),(L)) #endif bglibs-2.04/include/crc32c.h0000664000076400007640000000057513244040127015125 0ustar bruceguenter#ifndef CRC32C__H__ #define CRC32C__H__ #include "gcrc.h" #define CRC32CPOLY ((uint32)0x1EDC6F41UL) #define CRC32CINIT ((uint32)0xFFFFFFFFUL) #define CRC32CPOST ((uint32)0xFFFFFFFFUL) extern const uint32 crc32c_table[256]; #define crc32c_update(C,D,L) gcrc32rfl((C),(D),(L),crc32c_table) #define crc32c_block(B,L) (crc32c_update(CRC32CINIT,(B),(L))^CRC32CPOST) #endif bglibs-2.04/include/crc32.h0000664000076400007640000000066113244040127014756 0ustar bruceguenter#ifndef CRC32__H__ #define CRC32__H__ #include "gcrc.h" #include "uint32.h" #define CRC32POLY ((uint32)0x04C11DB7UL) #define CRC32REVPOLY ((uint32)0xEDB88320UL) #define CRC32INIT ((uint32)0xFFFFFFFFUL) #define CRC32POST ((uint32)0xFFFFFFFFUL) extern const uint32 crc32_table[256]; #define crc32_update(C,D,L) gcrc32rfl((C),(D),(L),crc32_table) #define crc32_block(B,L) (crc32_update(CRC32INIT,(B),(L))^CRC32POST) #endif bglibs-2.04/include/surf.h0000664000076400007640000000125313244040127015017 0ustar bruceguenter#ifndef BGLIBS__SURF__H__ #define BGLIBS__SURF__H__ #include "uint32.h" /** \defgroup crypto crypto: Cryptographic routines @{ */ /** The number of 32-bit words output by surf */ #define SURF_OUT_U32 8 /** The number of 32-bit words used as input by surf */ #define SURF_IN_U32 12 /** The number of 32-bit words used as seed data by surf */ #define SURF_SEED_U32 32 /** The number of bytes output by surf */ #define SURF_OUT 32 /** The number of bytes used as input by surf */ #define SURF_IN 48 /** The number of bytes used as seed data by surf */ #define SURF_SEED 128 void surf(uint32 out[8], const uint32 in[12], const uint32 seed[32]); /** @} */ #endif bglibs-2.04/include/trigger.h0000664000076400007640000000265713244040127015514 0ustar bruceguenter#ifndef BGLIBS__UNIX__TRIGGER__H__ #define BGLIBS__UNIX__TRIGGER__H__ #include "sysdeps.h" /** \defgroup trigger trigger: Safe external event notification The \c trigger functions provide a safe mechanism for one program to notify another that an event has happened, using a named pipe. The traditional UNIX mechanism for doing this has been to use signals. Signals, however, suffer from several problems. First, in order to deliver a signal, the sender needs to determine the PID of the recipient. The process of determining the PID is filled with race conditions leaving the possibility of delivering the signal to the wrong process. On the receiving side, receiving the signal puts the receiver into an execution context where the set of safe system calls is restricted. By using a named pipe, the trigger mechanism avoids both these problems. First, there are no races in accessing the trigger, and no blocking paths either. Secondly, the receiver waits for an event by polling the file descriptor. Upon receiving an event, the receiver is in the same state as normal. Such events might include a new message being added to a queue etc. No data is delivered with the event. @{ */ extern int trigger_set(iopoll_fd* io, const char* path); /** Determine if a trigger has been pulled, after a polling loop indicates activity. */ #define trigger_pulled(IO) ((IO)->revents) extern void trigger_pull(const char* path); /** @} */ #endif bglibs-2.04/include/sha256.h0000664000076400007640000000051713244040127015052 0ustar bruceguenter#ifndef BGLIBS__SHA256__H__ #define BGLIBS__SHA256__H__ #include "sysdeps.h" #define SHA256_DIGEST_LENGTH (256/8) typedef struct { uint32 H[8]; uint64 bytes; uint8 M[64]; } SHA256_ctx; void SHA256_init(SHA256_ctx*); void SHA256_update(SHA256_ctx*, const void*, unsigned long); void SHA256_final(SHA256_ctx*, uint8*); #endif bglibs-2.04/include/envstr.h0000664000076400007640000000163513244040127015365 0ustar bruceguenter#ifndef BGLIBS__STR__ENV__H__ #define BGLIBS__STR__ENV__H__ struct str; /** \defgroup envstr envstr: Environment variables in a str. \par Calling Convention All functions that allocate memory return \c 0 (false) if the function failed due to being unable to allocate memory, and non-zero (true) otherwise. @{ */ extern const char* envstr_find(const struct str* env, const char* var, long varlen); extern const char* envstr_get(const struct str* env, const char* var); extern int envstr_set(struct str* env, const char* var, const char* val, int overwrite); extern void envstr_unset(struct str* env, const char* var); extern int envstr_put(struct str* env, const char* asgn, int overwrite); extern int envstr_from_array(struct str* env, char** array, int overwrite); extern int envstr_from_string(struct str* env, const char* s, int overwrite); extern char** envstr_make_array(const struct str* env); /** @} */ #endif bglibs-2.04/include/misc.h0000664000076400007640000000066613244040127015002 0ustar bruceguenter#ifndef MISC__H__ #define MISC__H__ #include "sysdeps.h" extern void random_init(uint32 seed); extern uint32 random_int(void); #define random_float() (random_int() * (double)(1.0/4294967296.0)) #define random_scale(S) ((unsigned int)(random_float() * (S))) #define random_trunc(T) (random_int() % (T)) unsigned long strtou(const char* str, const char** end); const char* utoa(unsigned long); char* utoa2(unsigned long, char*); #endif bglibs-2.04/include/debug.h0000664000076400007640000000234413244040127015130 0ustar bruceguenter#ifndef MSG__DEBUG__H__ #define MSG__DEBUG__H__ #include extern int msg_debug_bits; #ifdef MSG_NO_DEBUG #define msg_debug(I,A,B,C,D,E,F,X) do{}while(0) #define msg_debugf(I,X,F,...) do{}while(0) #else void msg_debug(int, const char*, const char*, const char*, const char*, const char*, const char*, int); void msg_debugf(int bit, int showsys, const char* format, ...); #endif void msg_debug_init(void); #define debug1(x,a) msg_debug(x,a,0,0,0,0,0,0) #define debug2(x,a,b) msg_debug(x,a,b,0,0,0,0,0) #define debug3(x,a,b,c) msg_debug(x,a,b,c,0,0,0,0) #define debug4(x,a,b,c,d) msg_debug(x,a,b,c,d,0,0,0) #define debug5(x,a,b,c,d,e) msg_debug(x,a,b,c,d,e,0,0) #define debug6(x,a,b,c,d,e,f) msg_debug(x,a,b,c,d,e,f,0) #define debugf(x,f,...) msg_debugf(x,0,f,__VA_ARGS__) #define debug1sys(x,a) msg_debug(x,a,0,0,0,0,0,1) #define debug2sys(x,a,b) msg_debug(x,a,b,0,0,0,0,1) #define debug3sys(x,a,b,c) msg_debug(x,a,b,c,0,0,0,1) #define debug4sys(x,a,b,c,d) msg_debug(x,a,b,c,d,0,0,1) #define debug5sys(x,a,b,c,d,e) msg_debug(x,a,b,c,d,e,0,1) #define debug6sys(x,a,b,c,d,e,f) msg_debug(x,a,b,c,d,e,f,1) #define debugfsys(x,f,...) msg_debugf(x,1,f,__VA_ARGS__) #endif bglibs-2.04/include/ucspi.h0000664000076400007640000000057213244040127015166 0ustar bruceguenter#ifndef BGLIBS__MISC__UCSPI__H__ #define BGLIBS__MISC__UCSPI__H__ extern const char* ucspi_protocol(void); extern const char* ucspi_getenv(const char* name); #define ucspi_localip() ucspi_getenv("LOCALIP") #define ucspi_localhost() ucspi_getenv("LOCALHOST") #define ucspi_remoteip() ucspi_getenv("REMOTEIP") #define ucspi_remotehost() ucspi_getenv("REMOTEHOST") #endif bglibs-2.04/include/cdb.h0000664000076400007640000000376013244040127014575 0ustar bruceguenter#ifndef CDB_H #define CDB_H #include "iobuf.h" #include "sysdeps.h" struct str; #define CDB_HASHSTART 5381 extern uint32 cdb_hashadd(uint32,unsigned char); extern uint32 cdb_hash(const char *,unsigned int); struct cdb { char *map; /* 0 if no map is available */ int fd; uint32 size; /* initialized if map is nonzero */ uint32 loop; /* number of hash slots searched under this key */ uint32 khash; /* initialized if loop is nonzero */ uint32 kpos; /* initialized if loop is nonzero */ uint32 hpos; /* initialized if loop is nonzero */ uint32 hslots; /* initialized if loop is nonzero */ uint32 dpos; /* initialized if cdb_findnext() returns 1 */ uint32 dlen; /* initialized if cdb_findnext() returns 1 */ uint32 nextrec; /* initialized if cdb_{first,next}rec() returns 1 */ /* (uint32)-1 means no next record */ }; extern void cdb_free(struct cdb *); extern void cdb_init(struct cdb *,int fd); extern int cdb_read(struct cdb *,unsigned char *,unsigned int,uint32); extern void cdb_findstart(struct cdb *); extern int cdb_findnext(struct cdb *,const char *,unsigned int); extern int cdb_find(struct cdb *,const char *,unsigned int); #define cdb_datapos(c) ((c)->dpos) #define cdb_datalen(c) ((c)->dlen) extern int cdb_get(struct cdb*, const struct str* key, struct str* data); extern int cdb_getnext(struct cdb*, const struct str* key, struct str* data); struct cdb_hp; struct cdb_hplist; struct cdb_make { unsigned char final[2048]; uint32 count[256]; uint32 start[256]; struct cdb_hplist *head; struct cdb_hp *split; /* includes space for hash */ struct cdb_hp *hash; uint32 numentries; obuf 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); extern int cdb_make_addend(struct cdb_make *,unsigned int,unsigned int,uint32); extern int cdb_make_add(struct cdb_make *,const char *,unsigned int,const char *,unsigned int); extern int cdb_make_finish(struct cdb_make *); #endif bglibs-2.04/include/gqueue.h0000664000076400007640000000444413244040127015340 0ustar bruceguenter#ifndef BGLIBS__GENERIC_QUEUE__H__ #define BGLIBS__GENERIC_QUEUE__H__ #include "adt_common.h" /** \defgroup adt_gqueue adt gqueue: Generic simple queue. * * A generic queue is a first-in-first-out structure defined here based * on three primary operations: push, top, and pop. Pushing an element * onto a queue adds it to the tail of the list. The top operation * fetches the least recently pushed element still on the queue, and * popping removes it. */ /** @{ */ /** \example adt/gqueue_test.c */ /** Generic queue node. */ struct gqueue_node { /** Pointer to the next element in the queue linked list. */ struct gqueue_node* next; /** The data contained in the queue node. */ char data[0]; }; /** Generic queue structure. */ struct gqueue { /** Pointer to the first item in the queue. */ struct gqueue_node* head; /** Pointer to the last item in the queue. */ struct gqueue_node* tail; /** The number of items in the queue. */ unsigned count; }; int gqueue_push(struct gqueue* d, unsigned datasize, const void* data, adt_copy_fn* fn); void* gqueue_top(const struct gqueue* q); void gqueue_pop(struct gqueue* q, adt_free_fn* fn); /** Declare specialized \c gqueue functions. */ #define GQUEUE_DECL(PREFIX,TYPE) \ extern int PREFIX##_push(struct gqueue* q, TYPE const* data); \ extern TYPE* PREFIX##_top(struct gqueue* q); \ extern void PREFIX##_pop(struct gqueue* q); /** Define a specialized \c gqueue push function. */ #define GQUEUE_PUSH_DEFN(PREFIX,TYPE,COPY) \ int PREFIX##_push(struct gqueue* q, TYPE const* data) { \ return gqueue_push(q, sizeof *data, data, (adt_copy_fn*)COPY); \ } /** Define a specialized \c gqueue top function. */ #define GQUEUE_TOP_DEFN(PREFIX,TYPE) \ TYPE* PREFIX##_top(struct gqueue* q) { \ return (q->head == 0) ? 0 : (TYPE*)q->head->data; \ } /** Define a specialized \c gqueue pop function. */ #define GQUEUE_POP_DEFN(PREFIX,FREE) \ void PREFIX##_pop(struct gqueue* q) { \ gqueue_pop(q, (adt_free_fn*)(FREE)); \ } /** Define all the specialized \c gqueue functions. If \c COPY is \c * NULL, a simple memcpy is used instead. If \c FREE is \c NULL, no * attempt is made to free the data. */ #define GQUEUE_DEFN(PREFIX,TYPE,COPY,FREE) \ GQUEUE_PUSH_DEFN(PREFIX,TYPE,COPY) \ GQUEUE_TOP_DEFN(PREFIX,TYPE) \ GQUEUE_POP_DEFN(PREFIX,FREE) /** @} */ #endif bglibs-2.04/include/md5.h0000664000076400007640000001265213244040127014532 0ustar bruceguenter/* Declaration of functions and data types used for MD5 sum computing library functions. Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _MD5_H #define _MD5_H 1 #include #if defined HAVE_LIMITS_H || _LIBC # include #endif /* The following contortions are an attempt to use the C preprocessor to determine an unsigned integral type that is 32 bits wide. An alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but doing that would require that the configure script compile and *run* the resulting executable. Locally running cross-compiled executables is usually not possible. */ #ifdef _LIBC # include typedef u_int32_t md5_uint32; #else # if defined __STDC__ && __STDC__ # define UINT_MAX_32_BITS 4294967295U # else # define UINT_MAX_32_BITS 0xFFFFFFFF # endif /* If UINT_MAX isn't defined, assume it's a 32-bit type. This should be valid for all systems GNU cares about because that doesn't include 16-bit systems, and only modern systems (that certainly have ) have 64+-bit integral types. */ # ifndef UINT_MAX # define UINT_MAX UINT_MAX_32_BITS # endif # if UINT_MAX == UINT_MAX_32_BITS typedef unsigned int md5_uint32; # else # if USHRT_MAX == UINT_MAX_32_BITS typedef unsigned short md5_uint32; # else # if ULONG_MAX == UINT_MAX_32_BITS typedef unsigned long md5_uint32; # else /* The following line is intended to evoke an error. Using #error is not portable enough. */ "Cannot determine unsigned 32-bit data type." # endif # endif # endif #endif #undef __P #if defined (__STDC__) && __STDC__ # define __P(x) x #else # define __P(x) () #endif /* Structure to save state of computation between the single steps. */ struct md5_ctx { md5_uint32 A; md5_uint32 B; md5_uint32 C; md5_uint32 D; md5_uint32 total[2]; md5_uint32 buflen; char buffer[128]; }; /* * The following three functions are build up the low level used in * the functions `md5_stream' and `md5_buffer'. */ /* Initialize structure containing state of computation. (RFC 1321, 3.3: Step 3) */ extern void __md5_init_ctx __P ((struct md5_ctx *ctx)); extern void md5_init_ctx __P ((struct md5_ctx *ctx)); /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is necessary that LEN is a multiple of 64!!! */ extern void __md5_process_block __P ((const void *buffer, size_t len, struct md5_ctx *ctx)); extern void md5_process_block __P ((const void *buffer, size_t len, struct md5_ctx *ctx)); /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is NOT required that LEN is a multiple of 64. */ extern void __md5_process_bytes __P ((const void *buffer, size_t len, struct md5_ctx *ctx)); extern void md5_process_bytes __P ((const void *buffer, size_t len, struct md5_ctx *ctx)); /* Process the remaining bytes in the buffer and put result from CTX in first 16 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ extern void *__md5_finish_ctx __P ((struct md5_ctx *ctx, void *resbuf)); extern void *md5_finish_ctx __P ((struct md5_ctx *ctx, void *resbuf)); /* Put result from CTX in first 16 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ extern void *__md5_read_ctx __P ((const struct md5_ctx *ctx, void *resbuf)); extern void *md5_read_ctx __P ((const struct md5_ctx *ctx, void *resbuf)); /* Compute MD5 message digest for bytes read from STREAM. The resulting message digest number will be written into the 16 bytes beginning at RESBLOCK. */ extern int __md5_stream __P ((FILE *stream, void *resblock)); /* Compute MD5 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ extern void *__md5_buffer __P ((const char *buffer, size_t len, void *resblock)); extern void *md5_buffer __P ((const char *buffer, size_t len, void *resblock)); #endif /* md5.h */ bglibs-2.04/include/sha512.h0000664000076400007640000000056113244040127015044 0ustar bruceguenter#ifndef BGLIBS__SHA512__H__ #define BGLIBS__SHA512__H__ #include "sysdeps.h" #define SHA512_DIGEST_LENGTH (512/8) struct SHA512_ctx { uint64 H[8]; uint64 bytes; uint8 M[256]; }; typedef struct SHA512_ctx SHA512_ctx; void SHA512_init (SHA512_ctx*); void SHA512_update(SHA512_ctx*, const void*, unsigned long); void SHA512_final (SHA512_ctx*, uint8*); #endif bglibs-2.04/include/dns.h0000664000076400007640000002034513244040127014627 0ustar bruceguenter#ifndef DNS_H #define DNS_H #include "sysdeps.h" #include "systime.h" #include "ipv4.h" #include "ipv6.h" #include "str.h" #include "uint16.h" /** True if \c struct \c timeval \c A is less than \c B */ #define TV_LESS(A,B) (((A)->tv_sec < (B)->tv_sec) || ((A)->tv_sec == (B)->tv_sec && (A)->tv_usec < (B)->tv_usec)) /** \defgroup dns dns: DNS Resolver Library @{ The DNS resolver library is a modified copy of the public domain library used in djbdns (http://cr.yp.to/djbdns.html). Many modifications have been made, both to make it fit within the bglibs library and to extend the functionality. Notable enhancements are: - support for IPv6 lookups (both forward and reverse) - qualification support for lookup types other than IPv4 addresses - support for multiple outstanding requests \return Functions that return an \c int return -1 on error and set \c errno. */ /** Record class: Internet protocol */ #define DNS_C_IN 1 /** Record class: Any */ #define DNS_C_ANY 255 /** Record type: Address (IPv4) */ #define DNS_T_A 1 /** Record type: Name server */ #define DNS_T_NS 2 /** Record type: Canonical name (alias) */ #define DNS_T_CNAME 5 /** Record type: Start of authority */ #define DNS_T_SOA 6 /** Record type: Pointer */ #define DNS_T_PTR 12 /** Record type: Host information */ #define DNS_T_HINFO 13 /** Record type: Mail exchanger */ #define DNS_T_MX 15 /** Record type: Text */ #define DNS_T_TXT 16 /** Record type: Responsible person */ #define DNS_T_RP 17 /** Record type: Signature */ #define DNS_T_SIG 24 /** Record type: Key record */ #define DNS_T_KEY 25 /** Record type: Address (IPv6) */ #define DNS_T_AAAA 28 /** Record type: Authoritative zone transfer */ #define DNS_T_AXFR 252 /** Record type: Any (all known records) */ #define DNS_T_ANY 255 /** Size of data used by \c dns_random_init */ #define DNS_RANDOM_SEED (32*4) /** Maximum number of IPs returned by \c dns_resolvconfip or used by \c dns_transmit_start */ #define DNS_MAX_IPS 16 /** Maximum output size of \c dns_name4_domain */ #define DNS_NAME4_DOMAIN (4*4+14) /** Maximum output size of \c dns_name6_domain */ #define DNS_NAME6_DOMAIN (32*2+10) /** DNS transmission record */ struct dns_transmit { /** The transmitted query packet. This will either be \c NULL or dynamically allocated. */ char *query; /** The length of the transmitted query packet. */ unsigned int querylen; /** The received response packet. This will either be \c NULL or dynamically allocated. */ char *packet; /** The length of the received response packet. */ unsigned int packetlen; /** The socket file descriptor used for data transmission. This will either be 0 or 1 + an open file descriptor. The addition is done to allow the uninitialized state to be all zeros. */ int s1; /** Current state of the TCP connection. Valid values are: \li 0 is uninitialized (ie using UDP) \li 1 is connecting \li 2 is connected, sending query \li 3 is query sent, waiting for start of response \li 4 is reading response length \li 5 is read packet length, reading response */ int tcpstate; /** Count of number of times the UDP query was sent to each server. */ unsigned int udploop; /** Index of the server we are currently sending to. */ unsigned int curserver; /** Deadline for considering a request timed out. */ struct timeval deadline; /** Current sending/receiving position within the buffer, for TCP transmissions. */ unsigned int pos; /** The list of servers to try. */ const ipv4addr *servers; /** The local IP address to transmit with. */ ipv4addr localip; /** The requested query type. */ uint16 qtype; }; /** An individual result from a \c dns_mx query. */ struct dns_mx { /** The distance (or preference) number for this MX. */ uint16 distance; /** The domain name of this MX. */ char* name; }; union dns_result_rrs { void* __ptr; ipv4addr* ip4; ipv6addr* ip6; struct dns_mx* mx; char** name; }; /** DNS query results. */ struct dns_result { /** The number of results present. */ int count; /** The record type of the results. */ int type; /** The individual record arrays. */ union dns_result_rrs rr; /** Internal use buffer pointer. */ void* __buffer; }; extern int dns_result_alloc(struct dns_result* d, int type, int count, int size); extern void dns_result_free(struct dns_result* d); extern void dns_random_init(const char [DNS_RANDOM_SEED]); extern unsigned int dns_random(unsigned int); extern void dns_rotate(unsigned char*, unsigned int n, unsigned int shift); extern void dns_rotateipv4(ipv4addr*, unsigned int); extern void dns_rotateipv6(ipv6addr*, unsigned int); extern void dns_sort_mx(struct dns_mx* mxs, int count); extern void dns_domain_free(char **); extern int dns_domain_copy(char **,const char *); extern unsigned int dns_domain_length(const char *); extern int dns_domain_equal(const char *,const char *); extern int dns_domain_suffix(const char *,const char *); extern unsigned int dns_domain_suffixpos(const char *,const char *); extern int dns_domain_fromdot(char **,const char *,unsigned int); extern int dns_domain_todot_cat(str *,const char *); extern unsigned int dns_packet_copy(const char *,unsigned int,unsigned int,unsigned char *,unsigned int); extern unsigned int dns_packet_getname(const char *,unsigned int,unsigned int,char **); extern unsigned int dns_packet_skipname(const char *,unsigned int,unsigned int); extern int dns_packet_extract(struct dns_result* out, const char* buf, unsigned int len, uint16 rrtype, uint16 rrclass, int (*sizefn)(const char* buf, unsigned int len, unsigned int pos, uint16 datalen), int (*copy)(struct dns_result* out, unsigned int index, unsigned int offset, const char* buf, unsigned int len, unsigned int pos, uint16 datalen)); extern int dns_transmit_start(struct dns_transmit *,const ipv4addr [DNS_MAX_IPS],int,const char *,uint16,const ipv4addr *); extern void dns_transmit_free(struct dns_transmit *); extern void dns_transmit_io(const struct dns_transmit *,iopoll_fd *,struct timeval *); extern int dns_transmit_get(struct dns_transmit *,const iopoll_fd *,const struct timeval *); extern int dns_read_resolvconf(str *out); extern int dns_resolvconfip(ipv4addr [DNS_MAX_IPS]); extern int dns_resolve(struct dns_transmit *,const char *,uint16); extern int dns_ip4_packet(struct dns_result*, const char*, unsigned int); extern int dns_ip4_r(struct dns_transmit*, struct dns_result*, const char *); extern int dns_ip4(struct dns_result*, const char *); extern int dns_ip6_packet(struct dns_result*, const char*, unsigned int); extern int dns_ip6_r(struct dns_transmit*, struct dns_result*, const char *); extern int dns_ip6(struct dns_result*, const char*); extern int dns_name_packet(struct dns_result*, const char *,unsigned int); extern void dns_name4_domain(char [DNS_NAME4_DOMAIN],const ipv4addr *); extern void dns_name6_domain(char [DNS_NAME6_DOMAIN],const ipv6addr *); extern int dns_name4_r(struct dns_transmit*, struct dns_result*, const ipv4addr*); extern int dns_name4(struct dns_result*, const ipv4addr*); extern int dns_name6_r(struct dns_transmit*, struct dns_result*, const ipv6addr*); extern int dns_name6(struct dns_result*, const ipv6addr*); extern int dns_txt_packet(struct dns_result*, const char *,unsigned int); extern int dns_txt_r(struct dns_transmit *,struct dns_result*, const char *); extern int dns_txt(struct dns_result*, const char *); extern int dns_mx_packet(struct dns_result*, const char *,unsigned int); extern int dns_mx_r(struct dns_transmit *,struct dns_result*, const char *); extern int dns_mx(struct dns_result*, const char *); extern int dns_resolvconfrewrite(str *); extern int dns_qualify_rules(struct dns_result*,str *,const char *,const str *, int (*)(struct dns_transmit*, struct dns_result*, const char*)); extern int dns_qualify(struct dns_result*,str *,const char *, int (*)(struct dns_transmit*, struct dns_result*, const char*)); extern unsigned fmt_dns_domain(char*, const char*); /** Wrapper macro to create a non-reentrant function from a \c dns_*_r function. */ #define DNS_R_FN_WRAP(NAME,TYPE) \ int dns_##NAME(struct dns_result* out,TYPE in) \ { \ struct dns_transmit tx = {0}; \ int r = dns_##NAME##_r(&tx,out,in); \ dns_transmit_free(&tx); \ return r; \ } /** @} */ #endif bglibs-2.04/include/ipv6.h0000664000076400007640000000127313244040127014726 0ustar bruceguenter#ifndef NET__IPV6__H__ #define NET__IPV6__H__ #include "sysdeps.h" /** \defgroup ipv6 ipv6: IPv6 Address Handling @{ */ /** IPv6 address structure. */ typedef struct { /** 128-bit IPv6 address, represented as 16 8-bit \c unsigned \c chars. */ uint8 addr[16]; } ipv6addr; /** IPv6 port number. */ typedef uint16 ipv6port; extern const ipv6addr IPV6ADDR_ANY; extern const ipv6addr IPV6ADDR_LOOPBACK; extern const ipv6addr IPV6ADDR_V4PREFIX; extern const char* ipv6_scan(const char* s, ipv6addr* addr); extern const char* ipv6_format(const ipv6addr* addr); extern unsigned fmt_ipv6addr(char* buffer, const ipv6addr* addr); extern int ipv6_isv4mapped(const ipv6addr* addr); /** @} */ #endif bglibs-2.04/include/iobuf_common.h0000664000076400007640000000461613244040127016522 0ustar bruceguenter#ifndef IO_BUF__COMMON__H__ #define IO_BUF__COMMON__H__ #include #define LF ((char)10) #define CR ((char)13) #define CRLF "\015\012" struct str; /** \defgroup iobuf iobuf: I/O Buffer Management \par Calling Convention Unless otherwise specified, the return value is non-zero (true) if the entire requested operation completed, and \c 0 (false) otherwise. @{ */ /** \name Status Flags * @{ */ /** Reading reached end of file. */ #define IOBUF_EOF 1 /** The iobuf has encountered an error. */ #define IOBUF_ERROR 2 /** The timeout expired before the read or write could be completed. */ #define IOBUF_TIMEOUT 4 /** Mask of all the error type flags. */ #define IOBUF_BADFLAGS 0xf /** \c lseek is possible on the file descriptor. */ #define IOBUF_SEEKABLE 0x10 /** The file descriptor needs to be closed. */ #define IOBUF_NEEDSCLOSE 0x20 /** The buffer needs to be deallocated with \c free */ #define IOBUF_NEEDSFREE 0x40 /** The buffer needs to be deallocated with \c munmap */ #define IOBUF_NEEDSMUNMAP 0x80 extern unsigned iobuf_bufsize; /** @} */ /** \name Common * @{ */ /** The base I/O buffer structure. */ struct iobuf { /** File descriptor being buffered. */ int fd; /** The buffer memory. */ char* buffer; /** Total buffer size. */ unsigned bufsize; /** Length of the data in the buffer. */ unsigned buflen; /** Start of the data in the buffer. */ unsigned bufstart; /** Current file read/write offset. */ unsigned offset; /** I/O timeout in ms (\c 0 for no timeout). */ unsigned timeout; /** Status flags. */ unsigned flags; /** Saved errno flag. */ int errnum; }; typedef struct iobuf iobuf; /** Set the error flag, save \c errno, and return false. */ #define IOBUF_SET_ERROR(io) \ do{ \ io->flags |= IOBUF_ERROR; \ io->errnum = errno; \ return 0; \ }while(0) int iobuf_init(iobuf* io, int fd, unsigned bufsize, char* buffer, unsigned flags); int iobuf_close(iobuf* io); /** True if the \c iobuf has been closed. */ #define iobuf_closed(io) ((io)->fd == -1) /** True if the \c iobuf has an error flag. */ #define iobuf_error(io) ((io)->flags & IOBUF_ERROR) /** True if the input or output to the \c iobuf previously timed out. */ #define iobuf_timedout(io) ((io)->flags & IOBUF_TIMEOUT) /** True if the \c iobuf is in a "bad" state. */ #define iobuf_bad(io) ((io)->flags & IOBUF_BADFLAGS) int iobuf_timeout(iobuf* io, int poll_out); /** @} */ /** @} */ #endif bglibs-2.04/include/signalfd.h0000664000076400007640000000043513244040127015630 0ustar bruceguenter#ifndef UNIX__SIGNALFD__H__ #define UNIX__SIGNALFD__H__ /** \defgroup signalfd signalfd: Pass signals along a file. @{ */ extern int signalfd_init(void); extern void signalfd_catch(int sig); extern void signalfd_uncatch(int sig); extern void signalfd_close(void); /** @} */ #endif bglibs-2.04/include/sig.h0000664000076400007640000000202013244040127014613 0ustar bruceguenter#ifndef UNIX__SIG__H__ #define UNIX__SIG__H__ typedef void (*signalfn)(int); void sig_block(int sig); void sig_unblock(int sig); void sig_suspend(void); void sig_catch(int sig, signalfn fn); void sig_default(int sig); void sig_ignore(int sig); void sig_misc_ignore(void); void sig_bug_catch(signalfn fn); #define SIG_FUNCTION_DECL(NAME) \ extern void sig_##NAME##_block(void); \ extern void sig_##NAME##_unblock(void); \ extern void sig_##NAME##_catch(signalfn fn); \ extern void sig_##NAME##_default(void) SIG_FUNCTION_DECL(alarm); SIG_FUNCTION_DECL(child); SIG_FUNCTION_DECL(hup); SIG_FUNCTION_DECL(int); SIG_FUNCTION_DECL(pipe); SIG_FUNCTION_DECL(quit); SIG_FUNCTION_DECL(term); SIG_FUNCTION_DECL(all); #undef SIG_FUNCTION_DECL #define SIG_FUNCTION_MAKE(NAME,SIG) \ extern void sig_##NAME##_block(void) { sig_block(SIG); } \ extern void sig_##NAME##_unblock(void) { sig_unblock(SIG); } \ extern void sig_##NAME##_catch(signalfn fn) { sig_catch(SIG, fn); } \ extern void sig_##NAME##_default(void) { sig_default(SIG); } \ #endif bglibs-2.04/include/unix.h0000664000076400007640000000045713244040127015030 0ustar bruceguenter#ifndef BGLIBS_UNIX__H__ #define BGLIBS_UNIX__H__ int cloexec_on(int fd); int cloexec_off(int fd); int fcntl_fd_on(int fd, int flag); int fcntl_fd_off(int fd, int flag); int fcntl_fl_on(int fd, int flag); int fcntl_fl_off(int fd, int flag); int nonblock_on(int fd); int nonblock_off(int fd); #endif bglibs-2.04/include/resolve.h0000664000076400007640000000210213244040127015511 0ustar bruceguenter#ifndef NET__RESOLVE__H__ #define NET__RESOLVE__H__ #include "ipv4.h" /** \defgroup resolve resolve: Domain name resolution functions @{ */ /** No error. */ #define RESOLVE_OK 0 /** Domain name not found. */ #define RESOLVE_NOTFOUND 1 /** Domain name exists, but has no address. */ #define RESOLVE_NOADDR 2 /** Non-recoverable name server error. */ #define RESOLVE_NSERROR 3 /** Temporary failure. */ #define RESOLVE_TEMPFAIL 4 extern const char* resolve_ipv4addr(const ipv4addr* addr); extern int resolve_ipv4name_n(const char* name, ipv4addr* addr, int maxaddrs); /** Compatibility macro for resolve_ipv4name_n */ #define resolve_ipv4name(N,A) resolve_ipv4name_n((N),(A),1) extern int __resolve_error; /** Look up the last resolve error code. */ #define resolve_error() (__resolve_error) struct dns_result; extern int resolve_calldns(int (*dnsfn)(), struct dns_result* out, const void* param); extern int resolve_qualdns(int (*dnsfn)(struct dns_transmit*, struct dns_result* out, const char*), struct dns_result* out, const char* name); /** @} */ #endif bglibs-2.04/include/crc16_xmodem.h0000664000076400007640000000061713244040127016332 0ustar bruceguenter#ifndef CRC16__XMODEM__H__ #define CRC16__XMODEM__H__ #include "uint16.h" #define CRC16_XMODEM_POLY ((uint16)0x8408) #define CRC16_XMODEM_INIT ((uint16)0x0000) #define CRC16_XMODEM_POST ((uint16)0x0000) extern const uint16 crc16_xmodem_table[256]; #define crc16_xmodem_update(C,D,L) gcrc16rfl((C),(D),(L),crc16_xmodem_table) #define crc16_xmodem_block(B,L) crc16_xmodem_update(0,(B),(L)) #endif bglibs-2.04/include/sha1.h0000664000076400007640000000137213244040127014676 0ustar bruceguenter/* SHA-1 in C By Steve Reid , with small changes to make it fit by Bruce Guenter */ #ifndef _SHA1_H # define _SHA1_H #include "sysdeps.h" #define SHA1_DIGEST_LENGTH 20 #define SHA1_BLOCK_LENGTH 64 typedef struct { uint32 state[5]; uint64 bytes; unsigned char buffer[SHA1_BLOCK_LENGTH]; } SHA1_CTX; void SHA1Transform(uint32 state[5], const unsigned char buffer[SHA1_BLOCK_LENGTH]); void SHA1Init(SHA1_CTX* context); void SHA1Update(SHA1_CTX* context, const unsigned char* data, uint32 len); void SHA1Final(SHA1_CTX* context, unsigned char digest[SHA1_DIGEST_LENGTH]); # define SHA1_Transform SHA1Transform # define SHA1_Init SHA1Init # define SHA1_Update SHA1Update # define SHA1_Final SHA1Final #endif bglibs-2.04/bg-installer.cli0000664000076400007640000000707613244040126015330 0ustar bruceguenterDescription: Standardized installer program. Min: 0 Max: 1 Show-Pid: 0 Usage: [top-directory] }, if present, instruct bg-installer as to which base directory to use (see below). All other lines must have following format: @verbatim CMD:[OWNER]:[GROUP]:MODE:DIR[:FILENAME[:SOURCE]] @end verbatim @table @var @item CMD is a single character specifying the installation command, optionally followed by @samp{?} indicating the command should only execute if the source exists. If the @samp{?} is followed by a name, it is used instead of @var{SOURCE} as the filename to test. @item OWNER (optional) is the owner user ID or name for the target file. @item GROUP (optional) is the group ID or name for the target file. @item MODE is the permissions of the installed file in octal. @item DIR is the subdirectory of the installation prefix for the destination file. @item FILENAME (optional) is the name of the file to install into the directory. It may be omitted for directories. @item SOURCE (optional) is the name of the source file to install, if it differs from the destination file, or the path in the symlink. @end table If @var{SOURCE} contains wildcards, the command is repeated once for each matching filename. If @var{FILENAME} is empty, it is replaced with the value of @var{SOURCE} after wildcard expansion. Each instance of @samp{$N} in @var{FILENAME} where @samp{N} is a single digit is replaced with the Nth part of the source filename. @samp{$0} is replaced with the whole source filename. The target filename is @samp{PREFIX/TOP/DIR/FILENAME} where @samp{PREFIX} is the value of @var{$install_prefix} if it is set, @var{TOP} is the directory given on the command line, and @var{DIR} and @var{FILENAME} given in the installation file. @itemize @item @samp{c} lines copy regular files from the current directory @item @samp{d} lines create directories @item @samp{s} lines create symlinks (@var{UID}, @var{GID}, and @var{MODE} are ignored) @item @samp{l} lines copy libraries using libtool @end itemize When @command{bg-installer} encounters a base directory directive, as indicated above, it opens the file named @file{conf-BASE} (where @var{BASE} is the word on the directive line), reads the first line, and uses that as the base directory (prefixed by @env{$install_prefix} as above). [examples] @verbatim >bin c:::755::prog2 c?:root:root:4750::prog2 >include d:::755:package c:::644:package:base.h:pkgbase.h s:::::package.h:package/base.h @end verbatim This reads @file{conf-bin}, and installs @file{prog1} and setuid root @file{prog2} (if it was built) under it. It then reads @file{conf-include}, creates the directory @file{package} under it, and installs @file{pkgbase.h} as @file{base.h} in that directory. It also creates a symlink @file{package.h} to @file{package/base.h}. [environment] @table @env @item install_prefix If set, is prefixed to all destination file names. @end table [author] Bruce Guenter bglibs-2.04/cli/0000755000076400007640000000000013244040126013007 5ustar bruceguenterbglibs-2.04/cli/help.c0000664000076400007640000000613213244040126014107 0ustar bruceguenter/* cli/help.c - Show dynamic help text * Copyright (C) 2001,2005,2006 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "iobuf.h" #include "msg.h" #include #include "systime.h" #include #include #include "cli.h" #include "internal.h" static unsigned calc_max_width() { /* maxwidth is the maximum width of the long argument */ unsigned maxwidth = 0; unsigned i; for(i = 0; i < cli_option_count; i++) { unsigned width = 0; cli_option* o = cli_full_options[i]; if(o->name) { width += strlen(o->name); switch(o->type) { case CLI_STRING: width += 6; break; case CLI_INTEGER: width += 4; break; case CLI_UINTEGER: width += 4; break; case CLI_STRINGLIST: width += 5; break; case CLI_FUNCTION: width += 6; break; case CLI_SEPARATOR: width = 0; break; case CLI_FLAG: break; case CLI_COUNTER: break; } } if(width > maxwidth) maxwidth = width; } return maxwidth; } static void show_option(cli_option* o, unsigned maxwidth) { if(o->type == CLI_SEPARATOR) { obuf_put3s(&outbuf, "\n", o->name, ":\n"); return; } if(o == &cli_help_option) obuf_putc(&outbuf, '\n'); if(o->ch) { obuf_puts(&outbuf, " -"); obuf_putc(&outbuf, o->ch); } else obuf_puts(&outbuf, " "); obuf_puts(&outbuf, (o->ch && o->name) ? ", " : " "); if(o->name) { const char* extra = ""; switch(o->type) { case CLI_STRING: extra = "=VALUE"; break; case CLI_INTEGER: extra = "=INT"; break; case CLI_UINTEGER: extra = "=UNS"; break; case CLI_STRINGLIST: extra = "=ITEM"; break; case CLI_FUNCTION: extra = "=VALUE"; break; case CLI_FLAG: break; case CLI_COUNTER: break; case CLI_SEPARATOR: break; } obuf_put3s(&outbuf, "--", o->name, extra); obuf_pad(&outbuf, maxwidth - strlen(o->name) - strlen(extra) + 2, ' '); } else obuf_pad(&outbuf, maxwidth+4, ' '); obuf_put2s(&outbuf, o->helpstr, "\n"); if(o->defaultstr) { obuf_pad(&outbuf, maxwidth+10, ' '); obuf_put3s(&outbuf, "(Defaults to ", o->defaultstr, ")\n"); } } void cli_show_help(void) { unsigned maxwidth; unsigned i; obuf_puts(&outbuf, cli_help_prefix); maxwidth = calc_max_width(); for(i = 0; i < cli_option_count; i++) show_option(cli_full_options[i], maxwidth); obuf_puts(&outbuf, cli_help_suffix); } bglibs-2.04/cli/internal.h0000664000076400007640000000025213244040126014775 0ustar bruceguenter#ifndef CLI__INTERNAL__H__ #define CLI__INTERNAL__H__ extern cli_option cli_help_option; extern cli_option** cli_full_options; extern unsigned cli_option_count; #endif bglibs-2.04/cli/main.c0000664000076400007640000001463713244040126014114 0ustar bruceguenter/* cli/main.c - Main routine for all CLI programs * Copyright (C) 2001,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "iobuf.h" #include "msg.h" #include #include "systime.h" #include #include #include "cli.h" #include "internal.h" static int do_show_usage = 0; const char* argv0; const char* argv0base; const char* argv0dir; cli_option cli_help_option = { 'h', "help", CLI_FLAG, 1, &do_show_usage, "Display this help and exit", 0 }; cli_option** cli_full_options; unsigned cli_option_count; static void build_options() { unsigned i; for(cli_option_count = 0; cli_options[cli_option_count].ch || cli_options[cli_option_count].name; cli_option_count++) ; cli_option_count++; cli_full_options = malloc(cli_option_count * sizeof *cli_full_options); for(i = 0; i < cli_option_count-1; i++) cli_full_options[i] = &cli_options[i]; cli_full_options[cli_option_count-1] = &cli_help_option; } static void show_usage() { obuf_put5s(&outbuf, "usage: ", program, " [flags] ", cli_args_usage, "\n"); } void usage(int exit_value, const char* errorstr) { if(errorstr) error1(errorstr); show_usage(); cli_show_help(); obuf_flush(&outbuf); exit(exit_value); } static cli_stringlist* stringlist_append(cli_stringlist* node, const char* newstr, const cli_option* option) { cli_stringlist* newnode; newnode = malloc(sizeof *newnode); newnode->string = newstr; newnode->option = option; newnode->next = 0; if(node) { cli_stringlist* head = node; while(node->next) node = node->next; node->next = newnode; return head; } else return newnode; } static int cli_option_set(cli_option* o, const char* arg) { char* endptr; switch(o->type) { case CLI_FLAG: *(int*)o->dataptr = o->flag_value; return 0; case CLI_COUNTER: *(int*)o->dataptr += o->flag_value; return 0; case CLI_INTEGER: *(int*)o->dataptr = strtol(arg, &endptr, 10); if(*endptr) { error2("Invalid integer: ", arg); return -1; } return 1; case CLI_UINTEGER: *(unsigned*)o->dataptr = strtoul(arg, &endptr, 10); if(*endptr) { error2("Invalid unsigned integer: ", arg); return -1; } return 1; case CLI_STRINGLIST: *(cli_stringlist**)o->dataptr = stringlist_append(*(cli_stringlist**)o->dataptr, arg, o); return 1; case CLI_FUNCTION: ((cli_function*)o->dataptr)(arg, o); return 1; default: *(const char**)o->dataptr = arg; return 1; } } static int parse_short(int argc, char* argv[]) { int i; int end = strlen(argv[0]) - 1; for(i = 1; i <= end; i++) { int ch = argv[0][i]; unsigned j; for(j = 0; j < cli_option_count; j++) { cli_option* o = cli_full_options[j]; if(o->ch == ch) { if(o->type != CLI_FLAG && o->type != CLI_COUNTER) { if(i < end) { if(cli_option_set(o, argv[0]+i+1) != -1) return 0; } else if(argc <= 1) { char tmp[] = "Option -X requires a value."; tmp[8] = o->ch; error1(tmp); } else if(cli_option_set(o, argv[1]) != -1) return 1; } else if(cli_option_set(o, 0) != -1) break; return -1; } } if(j >= cli_option_count) { char tmp[] = "Unknown option letter -X."; tmp[23] = argv[0][i]; error1(tmp); return -1; } } return 0; } static int cli_option_parse_long_eq(cli_option* o, const char* arg) { if(o->type == CLI_FLAG || o->type == CLI_COUNTER) { error3("Option --", o->name, " does not take a value."); return -1; } else return cli_option_set(o, arg) - 1; } static int cli_option_parse_long_noeq(cli_option* o, const char* arg) { if(o->type == CLI_FLAG || o->type == CLI_COUNTER) return cli_option_set(o, 0); else if(arg) return cli_option_set(o, arg); else { error3("Option --", o->name, " requires a value."); return -1; } } static int parse_long(char* argv[]) { unsigned j; const char* arg = argv[0]+2; for(j = 0; j < cli_option_count; j++) { cli_option* o = cli_full_options[j]; if(o->name) { size_t len = strlen(o->name); if(!memcmp(arg, o->name, len)) { if(arg[len] == '\0') return cli_option_parse_long_noeq(o, argv[1]); else if(arg[len] == '=') return cli_option_parse_long_eq(o, arg+len+1); } } } error3("Unknown option string: '--", arg, "'"); return -1; } static int parse_args(int argc, char* argv[]) { int i; int j; build_options(); for(i = 1; i < argc; i++) { const char* arg = argv[i]; // Stop at the first non-option argument if(arg[0] != '-') break; // Stop after the first "-" or "--" if(arg[1] == '\0' || (arg[1] == '-' && arg[2] == '\0')) { i++; break; } j = (arg[1] != '-') ? parse_short(argc-i, argv+i) : parse_long(argv+i); if(j < 0) usage(1, 0); else i += j; } return i; } static void set_argv0(const char* p) { static const char* empty = ""; const char* s = strrchr(p, '/'); size_t length; char* tmp; argv0 = p; if(s) { ++s; argv0base = s; length = s-p; tmp = malloc(length+1); memcpy(tmp, p, length); tmp[length] = 0; argv0dir = tmp; } else { argv0base = p; argv0dir = empty; } } int main(int argc, char* argv[]) { struct timeval tv; int lastarg; gettimeofday(&tv, 0); srandom(tv.tv_usec ^ tv.tv_sec); set_argv0(argv[0]); lastarg = parse_args(argc, argv); if(do_show_usage) usage(0, 0); argc -= lastarg; argv += lastarg; if(argc < cli_args_min) usage(1, "Too few command-line arguments"); if(cli_args_max >= cli_args_min && argc > cli_args_max) usage(1, "Too many command-line arguments"); return cli_main(argc, argv); } bglibs-2.04/uintnn.h0000664000076400007640000000435213244040127013733 0ustar bruceguenter#ifndef BGLIBS__UINTNN__H__ #define BGLIBS__UINTNN__H__ /* These macros are used to produce the declarations and inline * definitions for the various uint## pack/unpack msb/lsb functions */ #if defined(__GNUC__) && defined(HAS_UNALIGNED_ACCESSES) && defined(ENDIAN_LSB) #define __INLINE_UINT_LSB 1 #undef __INLINE_UINT_MSB #endif #if defined(__GNUC__) && defined(HAS_UNALIGNED_ACCESSES) && defined(ENDIAN_MSB) #define __INLINE_UINT_MSB 1 #undef __INLINE_UINT_LSB #endif #ifdef __INLINE_UINT_LSB #define __UINTNN_GET_LSB_DECL(B,N) \ static __inline__ uint##B uint##B##_get_lsb(const unsigned char b[N]) \ { return *((const uint##B *)b); } #define __UINTNN_PACK_LSB_DECL(B,N) \ static __inline__ void uint##B##_pack_lsb(uint##B u, unsigned char b[N]) \ { *((uint##B *)b) = u; } #define __UINTNN_UNPACK_LSB_DECL(B,N) \ static __inline__ void uint##B##_unpack_lsb(const unsigned char b[N], uint##B *u) \ { *u = *((uint##B *)b); } #else #define __UINTNN_GET_LSB_DECL(B,N) \ extern uint##B uint##B##_get_lsb(const unsigned char[N]); #define __UINTNN_PACK_LSB_DECL(B,N) \ extern void uint##B##_pack_lsb(uint##B, unsigned char[N]); #define __UINTNN_UNPACK_LSB_DECL(B,N) \ extern void uint##B##_unpack_lsb(const unsigned char[N], uint##B *); #endif #ifdef __INLINE_UINT_MSB #define __UINTNN_GET_MSB_DECL(B,N) \ static __inline__ uint##B uint##B##_get_msb(const unsigned char b[N]) \ { return *((const uint##B *)b); } #define __UINTNN_PACK_MSB_DECL(B,N) \ static __inline__ void uint##B##_pack_msb(uint##B u, unsigned char b[N]) \ { *((uint##B *)b) = u; } #define __UINTNN_UNPACK_MSB_DECL(B,N) \ static __inline__ void uint##B##_unpack_msb(const unsigned char b[N], uint##B *u) \ { *u = *((uint##B *)b); } #else #define __UINTNN_GET_MSB_DECL(B,N) \ extern uint##B uint##B##_get_msb(const unsigned char[N]); #define __UINTNN_PACK_MSB_DECL(B,N) \ extern void uint##B##_pack_msb(uint##B, unsigned char[N]); #define __UINTNN_UNPACK_MSB_DECL(B,N) \ extern void uint##B##_unpack_msb(const unsigned char[N], uint##B *); #endif #define __UINTNN_DECL(B,N) \ __UINTNN_GET_LSB_DECL(B,N) \ __UINTNN_PACK_LSB_DECL(B,N) \ __UINTNN_UNPACK_LSB_DECL(B,N) \ __UINTNN_GET_MSB_DECL(B,N) \ __UINTNN_PACK_MSB_DECL(B,N) \ __UINTNN_UNPACK_MSB_DECL(B,N) #endif bglibs-2.04/selftest-cmp.c0000664000076400007640000000453113244040127015020 0ustar bruceguenter#include #include "iobuf.h" #include "msg.h" #include "wrap.h" #include "path.h" #include "str.h" const char program[] = "selftest-cmp"; static int str_diff_fnmatch(const str* a, const str* b) { return !fnmatch(a->s, b->s, 0); } static int getline(ibuf* in, str* line, const char* src) { int i = ibuf_getstr(in, line, LF); if (!i && ibuf_error(in)) die2sys(111, "Error reading from ", src); return i; } static void escape(const str* in, str* out) { unsigned int i; unsigned int j; int ch; char buf[7*in->len]; for (i = j = 0; i < in->len; i++) { ch = (unsigned char)in->s[i]; if (ch < 32 && ch != '\t' && ch != '\n') { buf[j++] = '^'; buf[j++] = ch + 64; } else if (ch == 127) { buf[j++] = '^'; buf[j++] = '?'; } else if (ch >= 128) { buf[j++] = 'M'; buf[j++] = '-'; buf[j++] = (ch >= 192) ? 'C' : 'B'; buf[j++] = 'M'; buf[j++] = '-'; ch &= 0x3f; if (ch < 32) { buf[j++] = '^'; ch += 64; } buf[j++] = ch; } else buf[j++] = ch; } wrap_str(str_copyb(out, buf, j)); } int main(int argc, char* argv[]) { ibuf srcbuf; ibuf tstbuf; str sline = {0}; str tline = {0}; str xline = {0}; int lineno = 0; int (*cmp)(const str*, const str*) = str_diff; if (argc != 3) die1(111, "Usage: selftest-cmp SOURCE TEST-RESULT"); if (!ibuf_open(&srcbuf, argv[1], 0)) diefsys(111, "{Could not open }s", argv[1]); if (!ibuf_open(&tstbuf, argv[2], 0)) diefsys(111, "{Could not open }s", argv[2]); while (ibuf_getstr(&srcbuf, &sline, LF)) { if (str_starts(&sline, "#ifdef SELFTEST_EXP")) { if (str_starts(&sline, "#ifdef SELFTEST_EXP_FNMATCH")) cmp = str_diff_fnmatch; break; } } if (ibuf_error(&srcbuf)) die1sys(111, "Error reading from source"); while (getline(&srcbuf, &sline, "source")) { if (str_starts(&sline, "#endif")) break; if (!getline(&tstbuf, &tline, "test result")) die1(1, "EOF on test result"); escape(&tline, &xline); ++lineno; if (cmp(&xline, &sline)) { obuf_putf(&outbuf, "d{: }S", xline.len, &xline); obuf_putf(&outbuf, "d{: }S", sline.len, &sline); obuf_flush(&outbuf); dief(1, "{Line #}d{ mismatch}", lineno); } } if (getline(&tstbuf, &tline, "test result")) die1(1, "EOF on source"); return 0; } bglibs-2.04/cli-generate.pl0000664000076400007640000004357713244040126015156 0ustar bruceguenteruse strict; use Getopt::Std; my %opts; getopts('chmw', \%opts); if (scalar(@ARGV) != 1 || $opts{'c'} + $opts{'h'} + $opts{'m'} + $opts{'w'} != 1) { print "usage: $0 -c|-h|-m|-w program.cli >FILE\n", "Generate command-line parsing structures from a description file.\n", "\n", " -c Generate C source code\n", " -h Generate C header code\n", " -m Generate man page source\n", " -w Generate HTML (web) source\n"; exit(1); } my $filename = $ARGV[0]; open(IN, '<', $filename) || die "Could not open '$filename': $!\n"; my $program = $filename; $program =~ s/\.cli$//; $program =~ s/^.*\///; my %sections; my @options; my %decls; my %defns; my %header = ( 'include' => "\n" ); my @sections = ('return value', 'errors', 'examples', 'environment', 'files', 'see also', 'notes', 'caveats', 'warnings', 'diagnostics', 'bugs', 'restrictions', 'author', 'authors', 'history'); my %type_suffix = ( 'STRING' => '=VALUE', 'INTEGER' => '=INT', 'UINTEGER' => '=UNS', 'STRINGLIST' => '=ITEM', 'FUNCTION' => '=VALUE', 'FLAG' => undef, 'COUNTER' => undef, ); my %type_decl = ( 'STRING' => "extern const char* %s;\n", 'INTEGER' => "extern int %s;\n", 'UINTEGER' => "extern unsigned int %s;\n", 'STRINGLIST' => "extern cli_stringlist* %s;\n", 'FUNCTION' => "extern void %s(const char*, const struct cli_option*);\n", 'FLAG' => "extern int %s;\n", 'COUNTER' => "extern int %s;\n", ); my %type_defn = ( 'STRING' => "const char* %s = %s;\n", 'INTEGER' => "int %s = %s;\n", 'UINTEGER' => "unsigned int %s = %s;\n", 'STRINGLIST' => "cli_stringlist* %s = %s;\n", 'FUNCTION' => "extern void %s(const char*, const struct cli_option*);\n", 'FLAG' => "int %s = %s;\n", 'COUNTER' => "int %s = %s;\n", ); sub parse_options { my @lines = split('\n', $sections{'options'}); my $line; while ($line = shift(@lines)) { $line =~ s/\s+$//; next if !$line; if ($line =~ /^--\s+(.+)$/) { push(@options, { 'short' => undef, 'long' => undef, 'type' => 'SEPARATOR', 'flag' => '0', 'varname' => undef, 'init' => '0', 'help' => $1, 'default' => undef, 'description' => undef, }); } elsif ($line =~ /^(-([^-])\s+)?(--([^=]+)\s+)?([A-Z]+)(\s*=\s*(\S+))?\s+(\S+)(\s*=\s*("[^\"]*"|-?\d+))?$/ && ($2 ne '' || $4 ne '')) { my $shortopt = $2; my $longopt = $4; my $type = $5; my $flag = $7 || '0'; my $var = $8; my $init = $10; my $helpstr = shift(@lines); chomp($helpstr); my $default = ($helpstr =~ s/\s*=\s*([^=]+)$//) ? $1 : undef; my $description; while ($line = shift(@lines)) { chomp($line); last if $line =~ /^-/; if ($description || $line) { $description =~ s/$/\n$line/; } } push(@options, { 'short' => $shortopt, 'long' => $longopt, 'type' => $type, 'flag' => $flag, 'varname' => $var, 'init' => $init || '0', 'help' => $helpstr, 'default' => $default, 'description' => $description, }); } else { die "Option line is misformatted:\n $line\n"; } } } sub read_header { my $line; while ($line = ) { chomp($line); last unless $line; unless ($line =~ /^([^\s:]+):\s*(.*)$/) { die "Invalid header line:\n $line\n"; } my $field = $1; my $value = $2; $field =~ tr/A-Z/a-z/; $header{$field} .= "$value\n"; } } sub read_sections { my $line; my $section; my $text; $line = ; unless ($line =~ /^\[(.+)\]\s*$/) { die "Invalid section marker:\n $line\n"; } $section = $1; while ($line = ) { if ($line =~ /^\[(.+)\]\s*$/) { my $newsection = $1; $text =~ s/\s+$//; $sections{$section} = $text; $section = $newsection; $text = ''; } else { $text .= $line; } } if ($section) { $text =~ s/\s+$//; $sections{$section} = $text; } } sub header_num { my ($key,$default) = @_; $header{$key} = defined($header{$key}) ? $header{$key} + 0 : $default; } sub parse_header { my $line; my $key; foreach $key (keys %header) { chomp($header{$key}); } foreach $line (split('\n', $header{'include'})) { $header{'includes'} .= "#include $line\n"; } header_num('min', 0); header_num('max', -1); header_num('show-pid', 0); header_num('debug-bits', 0); } sub postprocess_options { foreach my $option (@options) { my $var = $$option{'varname'}; my $type = $$option{'type'}; if (my $decl = $type_decl{$type}) { $decls{$var} = sprintf($decl, $var); } if (my $defn = $type_defn{$type}) { $defns{$var} = sprintf($defn, $var, $$option{'init'}); } $$option{'help'} =~ s/([^\.])$/$1\./; my $short = defined($$option{'short'}) ? "-$$option{'short'}" : ' '; my $long = defined($$option{'long'}) ? "--$$option{'long'}$type_suffix{$type}" : ''; my $mid = (defined($$option{'short'}) && defined($$option{'long'})) ? ', ' : ' '; $$option{'prehelp'} = "$short$mid$long"; } } sub parse_text_list { local($_); my $part; my @parts; foreach my $part (split(/\@item\s+/s, shift)) { my @part = split(/\n\s*\n/, $part); push @parts, \@part; } shift @parts; # Assume first one is blank return @parts; } sub parse_text { local($_); $_ = shift; s/[ \t]+\n/\n/g; # Strip trailing spaces s/\n*$/\n/; # Make sure there is exactly one \n at the end s/^\n+//s; my @parts; while ($_) { my @part; # Block modes, match everything up to the following "@end MODE" if (s/^\@(example|verbatim)\n(.*?)\n\@end\s+.*?\n//s) { @part = ( $1, $2 ); } # Table mode, break into list items with following text elsif (s/^\@table\s+(\S+)\n(.*?\n)\@end\s+.*?\n//s) { my $mode = $1; my @items = parse_text_list($2); @part = ( 'table', \@items, $mode ); } # List modes, break into list items with optional paragraphs elsif (s/^\@(itemize|enumerate)\n(.*?\n)\@end\s+.*?\n//s) { my $mode = $1; my @items = parse_text_list($2); @part = ( $mode, \@items ); } # Otherwise, match the next paragraph else { s/^(.*?)(\n\s*\n|$)//s; @part = ( undef, $1 ); } push @parts, \@part; s/^([ \t]*\n)+//; } return @parts; } ############################################################################### # Functions for outputting C header file ############################################################################### sub output_h { my $guard = $filename; $guard =~ tr/a-z/A-Z/; $guard =~ s/[^0-9A-Z]/_/g; print "#ifndef ${guard}_H\n"; print "#define ${guard}_H\n"; print "/* This file was automatically generated from ${filename}, do not edit. */\n"; print $header{'includes'}; foreach my $var (sort keys %decls) { print $decls{$var}; } print "#endif\n"; } ############################################################################### # Functions for outputting C source ############################################################################### sub max_width { my $max = 10; foreach my $option (@options) { my $width = length($$option{'prehelp'}); $max = $width if $width > $max; } $max; } sub c_escape { my ($s) = @_; $s =~ s/\"/\\\"/g; $s =~ s/\n/\\n"\n"/g; $s; } sub reformat_c_tag { my ($tag, $text) = @_; if ($tag eq 'samp' || $tag eq 'file') { "\"$text\""; } else { # Just strip everything else $text; } } sub reformat_c_tags { my $line = shift; # Just strip out tags $line =~ s/\@([a-zA-Z]+)\{(.*?)\}/reformat_c_tag($1,$2)/eg; $line; } sub make_helpstr { my $width = max_width(); my $text; $text .= "$header{'description'}\n" if $header{'description'}; $text .= "$sections{'prefix'}\n" if $sections{'prefix'}; $text .= "\n"; foreach my $option (@options) { if ($$option{'type'} eq 'SEPARATOR') { $text .= sprintf("\n%s:\n", $$option{'help'}); } else { $text .= sprintf(" %-${width}s %s\n", reformat_c_tags($$option{'prehelp'}), reformat_c_tags($$option{'help'})); if (defined($$option{'default'})) { $text .= sprintf(" %${width}s (Defaults to %s)\n", '', reformat_c_tags($$option{'default'})); } } } $text .= sprintf("\n %-${width}s %s\n", '-h, --help', 'Display this help and exit'); $text .= $sections{'suffix'}; $text .= "\n"; $text; } sub output_c { print "/* This file was automatically generated from ${filename}, do not edit. */\n"; print "#include \n"; print "#include \n"; print $header{'includes'}; print "const char program[] = \"$program\";\n"; print "const char cli_args_usage[] = \"$header{'usage'}\";\n"; print "const int cli_args_min = $header{'min'};\n"; print "const int cli_args_max = $header{'max'};\n"; print "const int msg_show_pid = $header{'show-pid'};\n"; print "int msg_debug_bits = $header{'debug-bits'};\n"; my $helpstr = c_escape(make_helpstr()); print "void cli_show_help(void) {\n", " obuf_puts(&outbuf,\n", "\"$helpstr\");\n", "}\n"; foreach my $var (sort keys %defns) { print $defns{$var}; } print "cli_option cli_options[] = {\n"; foreach my $option (@options) { if ($$option{'type'} ne 'SEPARATOR') { my $default = c_escape(reformat_c_tags($$option{'default'})); my $varptr = $$option{'varname'}; if (defined($varptr)) { if ($$option{'type'} ne 'FUNCTION') { $varptr = "&$varptr"; } } else { $varptr = '0'; } printf " { %s, %s, CLI_%s, %s, %s, 0, 0 },\n", defined($$option{'short'}) ? "'$$option{'short'}'" : 0, defined($$option{'long'}) ? "\"$$option{'long'}\"" : 0, $$option{'type'}, $$option{'flag'}, $varptr; } } print " {0,0,0,0,0,0,0}\n"; print "};\n"; } ############################################################################### # Functions for outputting man page source ############################################################################### sub reformat_m_tag { my ($tag, $text) = @_; # TeXinfo tags: # kbd key verb dfn # cite abbr acronym indicateurl email if ($tag eq 'strong' || $tag eq 'command' || $tag eq 'option') { "\\fB$text\\fR"; } elsif ($tag eq 'emph' || $tag eq 'var' || $tag eq 'file' || $tag eq 'env') { "\\fI$text\\fR"; } elsif ($tag eq 'samp') { "\"$text\""; } elsif ($tag eq 'code') { "'$text'"; } elsif ($tag eq 'asis') { $text; } else { print STDERR "Warning, unknown tag \@$tag, ignoring\n"; $text; } } sub reformat_m_tags { my $line = shift; s/^\./\\./gm; $line =~ s/\@program\b/\\fB$program\\fR/g; $line =~ s/\@([a-zA-Z]+)\{(.*?)\}/reformat_m_tag($1,$2)/eg; $line; } sub parse_m_text { my @parts; foreach my $part (parse_text(shift)) { my $mode = $$part[0]; $_ = $$part[1]; if ($mode eq 'verbatim') { s/^\./\\./gm; s/^/.RS\n.nf\n/; s/$/\n.fi\n.RE/; } elsif ($mode eq 'example') { $_ = reformat_m_tags($_); s/^\./\\./gm; s/^/.EX\n/; s/$/\n.EE/; } elsif ($mode eq 'table') { my $tmode = $$part[2] || '@asis'; my $text = ''; foreach my $item (@$_) { $$item[0] = "$tmode\{$$item[0]\}"; @$item = map { reformat_m_tags($_) } @$item; $text .= ".TP\n" . join("\n\n", @$item) . "\n"; } $_ = $text . ".PP\n"; } elsif ($mode eq 'itemize') { my $text = ''; foreach my $item (@$_) { @$item = map { reformat_m_tags($_) } @$item; $text .= ".TP\no\n" . join("\n\n", @$item) . "\n"; } $_ = $text . ".PP\n"; } elsif ($mode eq 'enumerate') { my $n = 1; my $text = ''; foreach my $item (@$_) { @$item = map { reformat_m_tags($_) } @$item; $text .= ".TP\n${n}.\n" . join("\n\n", @$item) . "\n"; $n++; } $_ = $text . ".PP\n"; } else { $_ = reformat_m_tags($_); } s/$/\n/; push @parts, $_; } $_ = join("\n", @parts); # 3 or more line feeds always need to be reduced to 2. s/\n{3,}/\n\n/g; # Blank lines before .TP or .PP need to be removed. s/\n{2,}(\.(TP|PP))/\n$1/g; # Blank lines after .PP need to be removed. s/^\.PP\n{2,}/.PP\n/gm; # Remove blank lines betwee the first (unindented) and second # (indented) paragraphs in the .TP formatter. s/^(\.TP\n[^\n]+)\n+/$1\n/gm; # Strip leading blank lines in this section. s/^\n+//; # Strip extraneous trailing .PP lines. s/\.PP\n*$//; # Strip remaining trailing blank lines. s/\n+$//; $_; } sub output_m_section { my ($section) = @_; my $text = $sections{$section}; if ($text) { $section =~ tr/a-z/A-Z/; print ".SH $section\n"; print parse_m_text($text), "\n"; } } sub output_m_options { print ".SH OPTIONS\n"; foreach my $option (@options) { if ($$option{'type'} eq 'SEPARATOR') { print ".SS $$option{'help'}\n"; } else { print ".TP\n"; print ".B $$option{'prehelp'}\n"; print parse_m_text($$option{'help'}), "\n"; print parse_m_text($$option{'description'}), "\n" if $$option{'description'}; print "Defaults to ", parse_m_text($$option{'default'}), ".\n" if defined($$option{'default'}); } } print ".TP\n", ".B -h, --help\n", "Display usage information and exit.\n"; } sub output_m { my $section; if (!$header{'description'}) { print STDERR "Warning: The header is missing a 'description' field.\n"; } print ".\\\" This file was automatically generated from ${filename}, do not edit.\n", ".TH $program 1\n", ".SH NAME\n", "$program \\- $header{'description'}\n", ".SH SYNOPSIS\n", ".B $program\n"; $_ = $header{'usage'}; s/([\[\]])/\\fR$1\\fI/g; s/(^|\s+)(-\S+)/\\fB$1\\fI/g; print ".I $_\n"; output_m_section('description'); output_m_options() if @options; foreach $section (@sections) { output_m_section($section); } } ############################################################################### # Functions for outputting HTML source ############################################################################### sub reformat_w_tag { my ($tag, $text) = @_; if ($tag eq 'strong') { "$text"; } elsif ($tag eq 'emph') { "$text"; } elsif ($tag eq 'var') { "$text"; } elsif ($tag eq 'command' || $tag eq 'option' || $tag eq 'file' || $tag eq 'env') { "$text"; } elsif ($tag eq 'samp') { "\"$text\""; } elsif ($tag eq 'code') { "$text"; } elsif ($tag eq 'asis') { $text; } else { print STDERR "Warning, unknown tag \@$tag, ignoring\n"; $text; } } sub reformat_w_tags { my $line = shift; s/^\./\\./gm; $line =~ s/\@program\b/$program<\/tt><\/b>/g; $line =~ s/\@([a-zA-Z]+)\{(.*?)\}/reformat_w_tag($1,$2)/eg; $line; } sub parse_w_text { my @parts; foreach my $part (parse_text(shift)) { my $mode = $$part[0]; $_ = $$part[1]; if ($mode eq 'verbatim') { s/\&/\&/g; s//\>/g; s/^/
/;
	    s/$/<\/pre>/;
	}
	elsif ($mode eq 'example') {
	    $_ = reformat_w_tags($_);
	    s/^/
/; s/$/<\/blockquote>/; } elsif ($mode eq 'table') { my $text = "
\n"; my $tmode = $$part[2] || '@asis'; foreach my $item (@$_) { my $tag = 'dt'; foreach my $st (@$item) { $st = "$tmode\{$st\}" if $tag eq 'dt'; $text .= "<$tag>" . reformat_w_tags($st) . "\n"; $tag = 'dd'; } } $_ = $text . "
\n"; } elsif ($mode eq 'itemize') { my $text = "
    \n"; foreach my $item (@$_) { $text .= '
  • ' . join('

    ', map { reformat_w_tags($_) } @$item) . "
  • \n"; } $_ = $text . "
\n"; } elsif ($mode eq 'enumerate') { my $text = "
    \n"; foreach my $item (@$_) { $text .= '
  1. ' . join('

    ', map { reformat_w_tags($_) } @$item) . "
  2. \n"; } $_ = $text . "
\n"; } else { $_ = '

' . reformat_w_tags($_) . "

\n"; } push @parts, $_; } join("\n", @parts); } sub output_w_section { my ($section) = @_; my $text = $sections{$section}; if ($text) { $section =~ tr/a-z/A-Z/; print "

$section

\n"; print parse_w_text($text), "\n"; } } sub output_w_options { } sub output_w { my $section; my $usection; if (!$header{'description'}) { print STDERR "Warning: The header is missing a 'description' field.\n"; } print "\n", "\n", "\n", "\n", "Manual page for $program\n", "\n", "\n", "

$program

\n", "
\n", "

Index

\n", "
\n", "
NAME
\n", "
SYNOPSIS
\n"; print "
DESCRIPTION
\n" if $sections{'description'}; print "
OPTIONS
\n" if @options; foreach $section (@sections) { if ($sections{$section}) { my $name = $section; $name =~ tr/a-z/A-Z/; print "
$name
\n"; } } print "
\n", "
\n", "

NAME

\n", "

$program - $header{'description'}

\n", "

SYNOPSIS

\n"; $_ = $header{'usage'}; s{([\[\]])}{$1}g; s{(^|\s+)(-\S+)}{$1}g; print "

$_

\n"; output_w_section('description'); output_w_options() if @options; foreach $section (@sections) { output_w_section($section); } print "\n", "\n"; } ############################################################################### # Main routine ############################################################################### read_header(); read_sections(); parse_header(); parse_options(); postprocess_options(); if ($opts{'c'}) { output_c(); } elsif ($opts{'h'}) { output_h(); } elsif ($opts{'m'}) { output_m(); } elsif ($opts{'w'}) { output_w(); } bglibs-2.04/selftests.sh0000664000076400007640000000216413244040127014616 0ustar bruceguenter#!/bin/sh set -e || exit "$?" DIFF='diff -a -u' $DIFF $0 $0 >/dev/null 2>&1 || DIFF='diff' t=$0.tmp.$$ echo "Creating temporary directory $t" mkdir $t trap 'echo "Cleaning up $t"; rm -r $t' EXIT do_test() { echo "Testing $1" rm -f $t/* sed -e 's/-o ${base}.o//' compile | \ sh -s $1 -DSELFTEST_MAIN -o $t/test.o -include selftest.c || { echo "=====> Compile failed! <=====" return 1 } ./load $t/test .libs/libbg.a || { echo "=====> Load failed! <=====" return 1 } ( cd $t && ./test >./test.out 2>&1; ) || { echo "=====> Test output <=====" cat -v $t/test.out echo "=====> Test failed! <=====" return 1 } ./selftest-cmp $1 $t/test.out || { echo "=====> Expected output <=====" sed -e '1,/^#ifdef SELFTEST_EXP/d' -e '/^#endif/,$d' $1 echo "=====> Test output <=====" cat -v $t/test.out echo "=====> Output failed! <=====" return 1 } return 0 } exitcode=true if [ $# -gt 0 ]; then for c in "$@"; do do_test $c || exitcode=false done else for c in `fgrep -l '#ifdef SELFTEST_MAIN' */*.c` do do_test $c || exitcode=false done fi $exitcode bglibs-2.04/conf-bin0000664000076400007640000000007613244040126013663 0ustar bruceguenter/usr/local/bin Programs will be installed in this directory. bglibs-2.04/net/0000755000076400007640000000000013244040127013027 5ustar bruceguenterbglibs-2.04/net/udp4.c0000664000076400007640000000221613244040127014052 0ustar bruceguenter/* net/udp4.c - Create an IPv4 UDP socket * Copyright (C) 2004,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include "socket.h" /** Create a UDP/IPv4 socket. */ int socket_udp4(void) { return socket(AF_INET, SOCK_DGRAM, 0); } /** Create a UDP/IP socket. */ int socket_udp(void) { return socket_udp4(); } bglibs-2.04/net/dns_ip4.c0000664000076400007640000000525313244040127014542 0ustar bruceguenter#include #include #include "dns.h" static int getit(struct dns_result* out, unsigned int i, unsigned int offset, const char* buf, unsigned int len, unsigned int pos, uint16 datalen) { unsigned char header[4]; if (datalen != 4) { errno = EPROTO; return -1; } if (!dns_packet_copy(buf,len,pos,header,4)) { errno = EPROTO; return -1; } memcpy(&out->rr.ip4[i], header, 4); return 0; (void)offset; } /** Extract IPv4 address (A) records from a DNS response packet. */ int dns_ip4_packet(struct dns_result* out, const char* buf, unsigned int len) { if (dns_packet_extract(out, buf, len, DNS_T_A, DNS_C_IN, 0, getit) < 0) return -1; dns_rotateipv4(out->rr.ip4, out->count); return 0; } /** Request the IPv4 address (A) records for a domain name. */ int dns_ip4_r(struct dns_transmit* tx, struct dns_result *out, const char* fqdn) { char *q = 0; ipv4addr ip; const char* x; if ((x = ipv4_scan(fqdn, &ip)) != 0 && *x == 0) { if (dns_result_alloc(out, DNS_T_A, 1, 0) < 0) return -1; memcpy(out->rr.ip4, &ip, sizeof ip); return 0; } if (!dns_domain_fromdot(&q,fqdn,strlen(fqdn))) return -1; if (dns_resolve(tx,q,DNS_T_A) == -1) { free(q); return -1; } free(q); if (dns_ip4_packet(out,tx->packet,tx->packetlen) == -1) return -1; dns_transmit_free(tx); return 0; } /** \fn dns_ip4(struct dns_result*, const char*) Request the IPv4 address (A) records for a domain name. */ DNS_R_FN_WRAP(ip4, const char*) #ifdef SELFTEST_MAIN #include "dns-responder.c" DUMP { int i; for (i = 0; i < count; i++) { obuf_putc(&outbuf, ' '); obuf_puts(&outbuf, ipv4_format(&rr->ip4[i])); } NL(); } RESPONSE responses[] = { { 1, 1, 0, { { "\300\014", 2, 1, 1, 512, "\105\005\001\227", 4 }, { "\300\014", 2, 2, 1, 123456, "\003ns1\012untroubled\3org\0", 20 }, } }, { 3, 1, 0, { { "\300\014", 2, 1, 1, 512, "\105\005\001\227", 4 }, { "\300\014", 2, 1, 1, 512, "\105\005\001\226", 4 }, { "\300\014", 2, 1, 1, 512, "\105\005\001\225", 4 }, { "\300\014", 2, 2, 1, 123456, "\003ns1\012untroubled\3org\0", 20 }, } }, }; MAIN { const char* names[] = { "1.2.3.4", "example.com", "example.org", NULL }; do_dns_respond_tests(dns_ip4, names, responses, 2); } #endif #ifdef SELFTEST_EXP result=0 1.2.3.4: count=1 1.2.3.4 29: ID=XX QR=0 opcode=0 AA=0 TC=0 RD=1 RA=0 Z=0 RCODE=0 QDCOUNT=1 ANCOUNT=0 NSCOUNT=0 ARCOUNT=0 Question: example.com. QTYPE=1 QCLASS=1 result=0 example.com: count=1 69.5.1.151 29: ID=XX QR=0 opcode=0 AA=0 TC=0 RD=1 RA=0 Z=0 RCODE=0 QDCOUNT=1 ANCOUNT=0 NSCOUNT=0 ARCOUNT=0 Question: example.org. QTYPE=1 QCLASS=1 result=0 example.org: count=3 69.5.1.149 69.5.1.150 69.5.1.151 #endif bglibs-2.04/net/unixstr.c0000664000076400007640000000212313244040127014707 0ustar bruceguenter/* net/unixstr.c - Create UNIX domain stream socket * Copyright (C) 2001,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include "socket.h" /** Create UNIX domain stream socket. */ int socket_unixstr(void) { return socket(AF_UNIX, SOCK_STREAM, 0); } bglibs-2.04/net/bind6.c0000664000076400007640000000256313244040127014205 0ustar bruceguenter/* net/bind6.c - Bind an IPv6 address to a socket * Copyright (C) 2004,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "sysdeps.h" #include #include #include #include #include #include "socket.h" /** Bind a socket to an IPv6 address. */ int socket_bind6(int sock, const ipv6addr* ip, ipv6port port) { #if HASIPV6 struct sockaddr_in6 sa; memset(&sa, 0, sizeof sa); sa.sin6_family = AF_INET6; sa.sin6_port = htons(port); memcpy(&sa.sin6_addr, &ip->addr, 16); return bind(sock, (struct sockaddr*)&sa, sizeof sa) == 0; #else errno = EPROTONOSUPPORT; return 0; #endif } bglibs-2.04/net/dns_domain_fromdot.c0000664000076400007640000000405513244040127017046 0ustar bruceguenter#include #include #include #include "dns.h" /** Generate a DNS encoded domain name into \p out from the dotted string in \c buf. */ int dns_domain_fromdot(char **out,const char *buf,unsigned int n) { char label[63]; unsigned int labellen = 0; /* <= sizeof label */ char name[255]; unsigned int namelen = 0; /* <= sizeof name */ char ch; char *x; errno = EPROTO; for (;;) { if (!n) break; ch = *buf++; --n; if (ch == '.') { if (labellen) { if (namelen + labellen + 1 > sizeof name) return 0; name[namelen++] = labellen; memcpy(name + namelen,label,labellen); namelen += labellen; labellen = 0; } continue; } if (ch == '\\') { if (!n) break; ch = *buf++; --n; if ((ch >= '0') && (ch <= '7')) { ch -= '0'; if (n && (*buf >= '0') && (*buf <= '7')) { ch <<= 3; ch += *buf - '0'; ++buf; --n; if (n && (*buf >= '0') && (*buf <= '7')) { ch <<= 3; ch += *buf - '0'; ++buf; --n; } } } } if (labellen >= sizeof label) return 0; label[labellen++] = ch; } if (labellen) { if (namelen + labellen + 1 > sizeof name) return 0; name[namelen++] = labellen; memcpy(name + namelen,label,labellen); namelen += labellen; labellen = 0; } if (namelen + 1 > sizeof name) return 0; name[namelen++] = 0; x = malloc(namelen); if (!x) return 0; memcpy(x,name,namelen); if (*out) free(*out); *out = x; return 1; } #ifdef SELFTEST_MAIN #include "iobuf.h" void dump(const char* name) { int len; do { int i; len = *name++; obuf_putf(&outbuf, "\\[d\\]", len); for (i = 0; i < len; i++, name++) obuf_putc(&outbuf, *name); } while (len > 0); obuf_endl(&outbuf); } void testit(const char* dot) { char* name = 0; debugfn(dns_domain_fromdot(&name, dot, strlen(dot))); dump(name); } MAIN { testit("example.com"); testit("joe.example.org"); testit("\146oo"); } #endif #ifdef SELFTEST_EXP result=1 [7]example[3]com[0] result=1 [3]joe[7]example[3]org[0] result=1 [3]foo[0] #endif bglibs-2.04/net/connect6_timeout.c0000664000076400007640000000315013244040127016461 0ustar bruceguenter/* net/connect6_timeout.c - Make an IPv6 connection with a timeout * Copyright (C) 2004,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "sysdeps.h" #include #include "socket.h" #include "unix.h" /** Connect a socket to an IPv6 address, honouring a timeout. * * \note The socket will have nonblocking mode turned on on return from * this function. */ int socket_connect6_timeout(int sock, const ipv6addr* ip, ipv6port port, int timeout) { iopoll_fd pf; if (!nonblock_on(sock)) return 0; if (socket_connect6(sock, ip, port)) return 1; if (errno != EINPROGRESS && errno != EWOULDBLOCK) return 0; pf.fd = sock; pf.events = IOPOLL_WRITE; switch (iopoll_restart(&pf, 1, timeout)) { case 0: errno = ETIMEDOUT; return 0; case 1: if (socket_connected(sock)) return 1; /* No break, fall through */ default: return 0; } } bglibs-2.04/net/dns_sort.c0000664000076400007640000000043113244040127015026 0ustar bruceguenter#include "dns.h" static int mxcmp(const void* aptr, const void* bptr) { const struct dns_mx* a = aptr; const struct dns_mx* b = bptr; return (int)a->distance - (int)b->distance; } void dns_sort_mx(struct dns_mx* mxs, int count) { qsort(mxs, count, sizeof *mxs, mxcmp); } bglibs-2.04/net/connect6.c0000664000076400007640000000262113244040127014715 0ustar bruceguenter/* net/connect6.c - Make an IPv6 connection * Copyright (C) 2004,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "sysdeps.h" #include #include #include #include #include #include #include "socket.h" /** Connect a socket to an IPv6 address. */ int socket_connect6(int sock, const ipv6addr* ip, ipv6port port) { #if HASIPV6 struct sockaddr_in6 sa; memset(&sa, 0, sizeof sa); sa.sin6_family = AF_INET6; memcpy((char*)&sa.sin6_addr, &ip->addr, 16); sa.sin6_port = htons(port); return connect(sock, (struct sockaddr*)&sa, sizeof sa) == 0; #else errno = EPROTONOSUPPORT; return 0; #endif } bglibs-2.04/net/dns_name4.c0000664000076400007640000000370413244040127015051 0ustar bruceguenter#include #include "dns.h" /** Request the name (PTR) record for an IPv4 address. */ int dns_name4_r(struct dns_transmit* tx, struct dns_result* out, const ipv4addr *ip) { char name[DNS_NAME4_DOMAIN]; dns_name4_domain(name,ip); if (dns_resolve(tx,name,DNS_T_PTR) == -1) return -1; if (dns_name_packet(out,tx->packet,tx->packetlen) == -1) return -1; dns_transmit_free(tx); return 0; } /** \fn dns_name4(struct dns_result*, const ipv4addr*) Request the name (PTR) record for an IPv4 address. */ DNS_R_FN_WRAP(name4, const ipv4addr*) #ifdef SELFTEST_MAIN #include "dns-responder.c" DUMP { int i; for (i = 0; i < count; i++) { obuf_putc(&outbuf, ' '); obuf_puts(&outbuf, rr->name[i]); } NL(); } RESPONSE responses[] = { { 1, 1, 0, { { "\300\014", 2, DNS_T_PTR, DNS_C_IN, 86400, "\003one\007example\003com\000", 17 }, { "\300\014", 2, DNS_T_NS, DNS_C_IN, 123456, "\003ns1\007example\003org\000", 17 }, } }, { 1, 1, 0, { { "\300\014", 2, DNS_T_PTR, DNS_C_IN, 86400, "\003two\007example\003com\000", 17 }, { "\300\014", 2, DNS_T_NS, DNS_C_IN, 123456, "\003ns1\007example\003com\000", 17 }, } }, }; void doit(const ipv4addr* addr) { struct dns_result out = {0}; debugfn(dns_name4(&out, addr)); obuf_putf(&outbuf, "s{: count=}d{\n}", ipv4_format(addr), out.count); dump_rrs(out.count, &out.rr); obuf_flush(&outbuf); } MAIN { ipv4addr addr1 = {{ 1,4,2,8 }}; ipv4addr addr2 = {{ 9,8,7,6 }}; start_dns_responder(responses, 2); doit(&addr1); doit(&addr2); wait_dns_responder(); } #endif #ifdef SELFTEST_EXP 38: ID=XX QR=0 opcode=0 AA=0 TC=0 RD=1 RA=0 Z=0 RCODE=0 QDCOUNT=1 ANCOUNT=0 NSCOUNT=0 ARCOUNT=0 Question: 8.2.4.1.in-addr.arpa. QTYPE=12 QCLASS=1 result=0 1.4.2.8: count=1 one.example.com 38: ID=XX QR=0 opcode=0 AA=0 TC=0 RD=1 RA=0 Z=0 RCODE=0 QDCOUNT=1 ANCOUNT=0 NSCOUNT=0 ARCOUNT=0 Question: 6.7.8.9.in-addr.arpa. QTYPE=12 QCLASS=1 result=0 9.8.7.6: count=1 two.example.com #endif bglibs-2.04/net/reuse.c0000664000076400007640000000211313244040127014315 0ustar bruceguenter/* net/reuse.c - Mark a socket for reuse. * Copyright (C) 2001,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include "socket.h" /** Mark a socket for address reuse. */ int socket_reuse(int fd) { int opt = 1; return setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof opt) == 0; } bglibs-2.04/net/dns_name6.c0000664000076400007640000000425013244040127015050 0ustar bruceguenter#include "dns.h" /** Request the name (PTR) record for an IPv6 address. */ int dns_name6_r(struct dns_transmit *tx, struct dns_result* out, const ipv6addr* ip) { char name[DNS_NAME6_DOMAIN]; if (ipv6_isv4mapped(ip)) return dns_name4_r(tx, out, (ipv4addr*)&ip->addr[12]); dns_name6_domain(name,ip); if (dns_resolve(tx,name,DNS_T_PTR) == -1) return -1; if (dns_name_packet(out,tx->packet,tx->packetlen) == -1) return -1; dns_transmit_free(tx); return 0; } /** \fn dns_name6(struct dns_result*, const ipv6addr*) Request the name (PTR) record for an IPv6 address. */ DNS_R_FN_WRAP(name6, const ipv6addr*) #ifdef SELFTEST_MAIN #include "dns-responder.c" DUMP { int i; for (i = 0; i < count; i++) { obuf_putc(&outbuf, ' '); obuf_puts(&outbuf, rr->name[i]); } NL(); } RESPONSE responses[] = { { 1, 1, 0, { { "\300\014", 2, DNS_T_PTR, DNS_C_IN, 86400, "\003one\007example\003com\000", 17 }, { "\300\014", 2, DNS_T_NS, DNS_C_IN, 123456, "\003ns1\007example\003org\000", 17 }, } }, { 1, 1, 0, { { "\300\014", 2, DNS_T_PTR, DNS_C_IN, 86400, "\003two\007example\003com\000", 17 }, { "\300\014", 2, DNS_T_NS, DNS_C_IN, 123456, "\003ns1\007example\003com\000", 17 }, } }, }; void doit(const ipv6addr* addr) { struct dns_result out = {0}; debugfn(dns_name6(&out, addr)); obuf_putf(&outbuf, "s{: count=}d{\n}", ipv6_format(addr), out.count); dump_rrs(out.count, &out.rr); obuf_flush(&outbuf); } MAIN { ipv6addr addr1 = {{ 0,1,2,3,4,5,6,7,8,9,0xa,0xb,0xc,0xd,0xe,0xf }}; ipv6addr addr2 = {{ 0,0,0,0,0,0,0,0,0,0,0xff,0xff,0xab,10,42,99 }}; start_dns_responder(responses, 2); doit(&addr1); doit(&addr2); wait_dns_responder(); } #endif #ifdef SELFTEST_EXP 90: ID=XX QR=0 opcode=0 AA=0 TC=0 RD=1 RA=0 Z=0 RCODE=0 QDCOUNT=1 ANCOUNT=0 NSCOUNT=0 ARCOUNT=0 Question: f.0.e.0.d.0.c.0.b.0.a.0.9.0.8.0.7.0.6.0.5.0.4.0.3.0.2.0.1.0.0.0.ip6.arpa. QTYPE=12 QCLASS=1 result=0 1:203:405:607:809:a0b:c0d:e0f: count=1 one.example.com 43: ID=XX QR=0 opcode=0 AA=0 TC=0 RD=1 RA=0 Z=0 RCODE=0 QDCOUNT=1 ANCOUNT=0 NSCOUNT=0 ARCOUNT=0 Question: 99.42.10.171.in-addr.arpa. QTYPE=12 QCLASS=1 result=0 ::ffff:171.10.42.99: count=1 two.example.com #endif bglibs-2.04/net/udp6.c0000664000076400007640000000221613244040127014054 0ustar bruceguenter/* net/udp6 - Create an IPv6 UDP socket * Copyright (C) 2004,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "sysdeps.h" #include #include #include #include #include #include "socket.h" /** Create a UDP/IPv6 socket. */ int socket_udp6(void) { #if HASIPV6 return socket(AF_INET6, SOCK_DGRAM, 0); #else errno = EPROTONOSUPPORT; return -1; #endif } bglibs-2.04/net/ipv4_scan.c0000664000076400007640000000404313244040127015064 0ustar bruceguenter#include #include "ipv4.h" static const char* parse_part(const char* s, uint8* num) { uint8 i = 0; if (*s < '0' || *s > '9') return 0; do { unsigned newi; newi = i * 10 + *s - '0'; if (newi < i || newi > 255) return 0; ++s; i = newi; } while (*s >= '0' && *s <= '9'); *num = i; return s; } /** Scan a C string for an IPv4 address. \return \c NULL if parsing failed, otherwise a pointer to the first character after the end of the address. */ const char* ipv4_scan(const char* start, ipv4addr* addr) { const char* s; if ((s = parse_part(start, &addr->addr[0])) == 0) return 0; if (*s != '.' && addr->addr[0] == 0) { /* Special case -- The number "0" represents 0.0.0.0 */ memset(addr, 0, sizeof *addr); return s; } if ((s = parse_part(s+1, &addr->addr[1])) == 0 || *s != '.') return 0; if ((s = parse_part(s+1, &addr->addr[2])) == 0 || *s != '.') return 0; if ((s = parse_part(s+1, &addr->addr[3])) == 0) return 0; return s; } /** Parse an IPv4 address. \deprecated This function is a wrapper for \c ipv4_scan. \return Non-zero (true) if parsing succeeded, and sets \c *end to the first character past the end of the address. */ int ipv4_parse(const char* start, ipv4addr* addr, const char** end) { return (*end = ipv4_scan(start, addr)) != 0; } #ifdef SELFTEST_MAIN static void test(const char* start) { ipv4addr ip; int i; const char* end; obuf_put2s(&outbuf, start, ": "); end = ipv4_scan(start, &ip); if (end == 0) obuf_puts(&outbuf, "NULL"); else { for (i = 0; i < 4; ++i) { if (i > 0) obuf_putc(&outbuf, '.'); obuf_puti(&outbuf, ip.addr[i]); } if (*end != 0) obuf_put2s(&outbuf, " + ", end); } NL(); obuf_flush(&outbuf); } MAIN { test("0"); test("0."); test("0a"); test("0.0.0.0"); test("1.2.3.4"); test("111.222.333.444"); test("1.2.3.4a"); test("1,2,3,4"); } #endif #ifdef SELFTEST_EXP 0: 0.0.0.0 0.: NULL 0a: 0.0.0.0 + a 0.0.0.0: 0.0.0.0 1.2.3.4: 1.2.3.4 111.222.333.444: NULL 1.2.3.4a: 1.2.3.4 + a 1,2,3,4: NULL #endif bglibs-2.04/net/notcpdelay.c0000664000076400007640000000264213244040127015343 0ustar bruceguenter/* socket/notcpdelay.c - Turn on/off TCP "NODELAY" flag. * Copyright (C) 2003,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include "socket.h" #ifndef SOL_TCP #define SOL_TCP SOL_SOCKET #endif /** Turn on or off TCP NODELAY flag. Enabling NODELAY disables the standard Nagle algorithm, which tries to coalesce multiple short writes into one larger packet for better network efficiency. With NODELAY enabled, each write will immediately be sent out onto the network as a seperate packet. */ int socket_notcpdelay(int fd, int on) { return setsockopt(fd, SOL_TCP, TCP_NODELAY, &on, sizeof on) == 0; } bglibs-2.04/net/dns_transmit.c0000664000076400007640000002132213244040127015702 0ustar bruceguenter#include #include #include #include #include #include #include "socket.h" #include "dns.h" ipv4port dns_use_port = 53; static int serverwantstcp(const char *buf,unsigned int len) { unsigned char out[12]; if (!dns_packet_copy(buf,len,0,out,12)) return 1; if (out[2] & 2) return 1; return 0; } static int serverfailed(const char *buf,unsigned int len) { unsigned char out[12]; unsigned int rcode; if (!dns_packet_copy(buf,len,0,out,12)) return 1; rcode = out[3]; rcode &= 15; if (rcode && (rcode != 3)) { errno = EAGAIN; return 1; } return 0; } static int irrelevant(const struct dns_transmit *d,const char *buf,unsigned int len) { unsigned char out[12]; char *dn; unsigned int pos; pos = dns_packet_copy(buf,len,0,out,12); if (!pos) return 1; if (memcmp(out,d->query + 2,2)) return 1; if (out[4] != 0) return 1; if (out[5] != 1) return 1; dn = 0; pos = dns_packet_getname(buf,len,pos,&dn); if (!pos) return 1; if (!dns_domain_equal(dn,d->query + 14)) { free(dn); return 1; } free(dn); pos = dns_packet_copy(buf,len,pos,out,4); if (!pos) return 1; if (uint16_get_msb(out) != d->qtype) return 1; if (uint16_get_msb(out + 2) != DNS_C_IN) return 1; return 0; } static void packetfree(struct dns_transmit *d) { if (!d->packet) return; free(d->packet); d->packet = 0; } static void queryfree(struct dns_transmit *d) { if (!d->query) return; free(d->query); d->query = 0; } static void socketfree(struct dns_transmit *d) { if (!d->s1) return; close(d->s1 - 1); d->s1 = 0; } /** Free all allocated resources in a \c dns_transmit structure. */ void dns_transmit_free(struct dns_transmit *d) { queryfree(d); socketfree(d); packetfree(d); } static int randombind(struct dns_transmit *d) { int j; for (j = 0;j < 10;++j) if (socket_bind4(d->s1 - 1,&d->localip,1025 + dns_random(64510))) return 0; if (socket_bind4(d->s1 - 1,&d->localip,0)) return 0; return -1; } static const int timeouts[4] = { 1, 3, 11, 45 }; static int thisudp(struct dns_transmit *d) { const ipv4addr *ip; socketfree(d); while (d->udploop < 4) { for (;d->curserver < DNS_MAX_IPS;++d->curserver) { ip = d->servers + d->curserver; if (memcmp(ip,"\0\0\0\0",4)) { d->query[2] = dns_random(256); d->query[3] = dns_random(256); d->s1 = 1 + socket_udp(); if (!d->s1) { dns_transmit_free(d); return -1; } if (randombind(d) == -1) { dns_transmit_free(d); return -1; } if (socket_connect4(d->s1 - 1,ip,dns_use_port)) if (send(d->s1 - 1,d->query + 2,d->querylen - 2,0) == d->querylen - 2) { gettimeofday(&d->deadline,0); d->deadline.tv_sec += timeouts[d->udploop]; d->tcpstate = 0; return 0; } socketfree(d); } } ++d->udploop; d->curserver = 0; } dns_transmit_free(d); return -1; } static int firstudp(struct dns_transmit *d) { d->curserver = 0; return thisudp(d); } static int nextudp(struct dns_transmit *d) { ++d->curserver; return thisudp(d); } static int thistcp(struct dns_transmit *d) { const ipv4addr *ip; socketfree(d); packetfree(d); for (;d->curserver < DNS_MAX_IPS;++d->curserver) { ip = d->servers + d->curserver; if (memcmp(ip,"\0\0\0\0",4)) { d->query[2] = dns_random(256); d->query[3] = dns_random(256); d->s1 = 1 + socket_tcp(); if (!d->s1) { dns_transmit_free(d); return -1; } if (randombind(d) == -1) { dns_transmit_free(d); return -1; } gettimeofday(&d->deadline,0); d->deadline.tv_sec += 10; if (socket_connect4(d->s1 - 1,ip,dns_use_port)) { d->tcpstate = 2; return 0; } if ((errno == EINPROGRESS) || (errno == EWOULDBLOCK)) { d->tcpstate = 1; return 0; } socketfree(d); } } dns_transmit_free(d); return -1; } static int firsttcp(struct dns_transmit *d) { d->curserver = 0; return thistcp(d); } static int nexttcp(struct dns_transmit *d) { ++d->curserver; return thistcp(d); } /** Start the transmission of a DNS query. \param d The record of the transmission state. \param servers The list of servers to contact, typically filled by \c dns_resolvconfip. \param flagrecursive Use recursive queries (ie querying a cache). \param q The domain name to query, in DNS format. \param qtype The query type number. \param localip The local IP from which to send the query, may be \c NULL. */ int dns_transmit_start(struct dns_transmit *d,const ipv4addr servers[DNS_MAX_IPS],int flagrecursive,const char *q,uint16 qtype,const ipv4addr *localip) { unsigned int len; dns_transmit_free(d); errno = EIO; len = dns_domain_length(q); d->querylen = len + 18; d->query = malloc(d->querylen); if (!d->query) return -1; uint16_pack_msb(len+16,(unsigned char*)d->query); memcpy(d->query + 2,flagrecursive ? "\0\0\1\0\0\1\0\0\0\0\0\0" : "\0\0\0\0\0\1\0\0\0\0\0\0gcc-bug-workaround",12); memcpy(d->query + 14,q,len); uint16_pack_msb(qtype,(unsigned char*)d->query + 14 + len); uint16_pack_msb(DNS_C_IN,(unsigned char*)d->query + 16 + len); d->qtype = qtype; d->servers = servers; if (localip != 0) d->localip = *localip; else memset(&d->localip, 0, sizeof d->localip); d->udploop = flagrecursive ? 1 : 0; if (len + 16 > 512) return firsttcp(d); return firstudp(d); } /** Fill in the \c iopoll_fd structure from a \c dns_transmit structure. */ void dns_transmit_io(const struct dns_transmit *d,iopoll_fd *x,struct timeval *deadline) { x->fd = d->s1 - 1; switch(d->tcpstate) { case 0: case 3: case 4: case 5: x->events = IOPOLL_READ; break; case 1: case 2: x->events = IOPOLL_WRITE; break; } if (TV_LESS(&d->deadline,deadline)) *deadline = d->deadline; } /** Complete I/O on a DNS query. \returns 1 when the query is completed. */ int dns_transmit_get(struct dns_transmit *d,const iopoll_fd *x,const struct timeval *when) { char udpbuf[513]; unsigned char ch; int r; int fd; errno = EIO; fd = d->s1 - 1; if (!x->revents) { if (TV_LESS(when,&d->deadline)) return 0; errno = ETIMEDOUT; if (d->tcpstate == 0) return nextudp(d); return nexttcp(d); } if (d->tcpstate == 0) { /* have attempted to send UDP query to each server udploop times have sent query to curserver on UDP socket s */ r = recv(fd,udpbuf,sizeof udpbuf,0); if (r <= 0) { if (errno == ECONNREFUSED) if (d->udploop == 2) return 0; return nextudp(d); } if (r + 1 > (int)sizeof udpbuf) return 0; if (irrelevant(d,udpbuf,r)) return 0; if (serverwantstcp(udpbuf,r)) return firsttcp(d); if (serverfailed(udpbuf,r)) { if (d->udploop == 2) return 0; return nextudp(d); } socketfree(d); d->packetlen = r; d->packet = malloc(d->packetlen); if (!d->packet) { dns_transmit_free(d); return -1; } memcpy(d->packet,udpbuf,d->packetlen); queryfree(d); return 1; } if (d->tcpstate == 1) { /* have sent connection attempt to curserver on TCP socket s pos not defined */ if (!socket_connected(fd)) return nexttcp(d); d->pos = 0; d->tcpstate = 2; return 0; } if (d->tcpstate == 2) { /* have connection to curserver on TCP socket s have sent pos bytes of query */ r = write(fd,d->query + d->pos,d->querylen - d->pos); if (r <= 0) return nexttcp(d); d->pos += r; if (d->pos == d->querylen) { gettimeofday(&d->deadline,0); d->deadline.tv_sec += 10; d->tcpstate = 3; } return 0; } if (d->tcpstate == 3) { /* have sent entire query to curserver on TCP socket s pos not defined */ r = read(fd,&ch,1); if (r <= 0) return nexttcp(d); d->packetlen = ch; d->tcpstate = 4; return 0; } if (d->tcpstate == 4) { /* have sent entire query to curserver on TCP socket s pos not defined have received one byte of packet length into packetlen */ r = read(fd,&ch,1); if (r <= 0) return nexttcp(d); d->packetlen <<= 8; d->packetlen += ch; d->tcpstate = 5; d->pos = 0; d->packet = malloc(d->packetlen); if (!d->packet) { dns_transmit_free(d); return -1; } return 0; } if (d->tcpstate == 5) { /* have sent entire query to curserver on TCP socket s have received entire packet length into packetlen packet is allocated have received pos bytes of packet */ r = read(fd,d->packet + d->pos,d->packetlen - d->pos); if (r <= 0) return nexttcp(d); d->pos += r; if (d->pos < d->packetlen) return 0; socketfree(d); if (irrelevant(d,d->packet,d->packetlen)) return nexttcp(d); if (serverwantstcp(d->packet,d->packetlen)) return nexttcp(d); if (serverfailed(d->packet,d->packetlen)) return nexttcp(d); queryfree(d); return 1; } return 0; } bglibs-2.04/net/ipv4_format.c0000664000076400007640000000506513244040127015435 0ustar bruceguenter#include "ipv4.h" static char* format_part(unsigned char i, char* s) { if (i >= 10) { s = format_part(i / 10, s); i = i % 10; } *s++ = i + '0'; return s; } /** Produce a formatted C string from an IPv4 address. \note The return value is statically allocated. Multiple calls to this function will return pointers to the same string. */ const char* ipv4_format(const ipv4addr* addr) { static char buf[16]; buf[fmt_ipv4addr(buf, addr)] = 0; return buf; } /** Produce a reverse-formatted C string from an IPv4 address. \note The return value is statically allocated. Multiple calls to this function will return pointers to the same string. */ const char* ipv4_format_reverse(const ipv4addr* addr) { static char buf[16]; buf[fmt_ipv4addr_reverse(buf, addr)] = 0; return buf; } /** Produce a formatted string from an IPv4 address. The given buffer must be at least 15 bytes long, or 16 bytes if it needs to contain the standard trailing \c NUL byte. \return The number of bytes written to the buffer. \note This routine is thread and recursion safe. */ unsigned fmt_ipv4addr(char* buffer, const ipv4addr* addr) { char* s = buffer; s = format_part(addr->addr[0], s); *s++ = '.'; s = format_part(addr->addr[1], s); *s++ = '.'; s = format_part(addr->addr[2], s); *s++ = '.'; s = format_part(addr->addr[3], s); return s - buffer; } /** Produce a reverse-formatted string from an IPv4 address. The given buffer must be at least 15 bytes long, or 16 bytes if it needs to contain the standard trailing \c NUL byte. \return The number of bytes written to the buffer. \note This routine is thread and recursion safe. */ unsigned fmt_ipv4addr_reverse(char* buffer, const ipv4addr* addr) { char* s = buffer; s = format_part(addr->addr[3], s); *s++ = '.'; s = format_part(addr->addr[2], s); *s++ = '.'; s = format_part(addr->addr[1], s); *s++ = '.'; s = format_part(addr->addr[0], s); return s - buffer; } #ifdef SELFTEST_MAIN void testfn(const ipv4addr* ip, unsigned (*fn)(char*,const ipv4addr*)) { char buffer[32]; unsigned i; debugfn(i = fn(buffer, ip)); buffer[i++] = '\n'; buffer[i] = 0; obuf_putsflush(&outbuf, buffer); } void test(const ipv4addr* ip) { testfn(ip, fmt_ipv4addr); testfn(ip, fmt_ipv4addr_reverse); } MAIN { ipv4addr ip = {{1,2,3,4}}; test(&IPV4ADDR_ANY); test(&IPV4ADDR_BROADCAST); test(&IPV4ADDR_LOOPBACK); test(&ip); } #endif #ifdef SELFTEST_EXP result=7 0.0.0.0 result=7 0.0.0.0 result=15 255.255.255.255 result=15 255.255.255.255 result=9 127.0.0.1 result=9 1.0.0.127 result=7 1.2.3.4 result=7 4.3.2.1 #endif bglibs-2.04/net/accept4.c0000664000076400007640000000250113244040127014516 0ustar bruceguenter/* net/accept4.c - Accept an IPv4 connection * Copyright (C) 2006 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include "socket.h" /** Accept a connection on a socket from an IPv4 address. */ int socket_accept4(int sock, ipv4addr* ip, ipv4port *port) { struct sockaddr_in sa; socklen_t dummy; int fd; dummy = sizeof sa; if ((fd = accept(sock, (struct sockaddr*)&sa, &dummy)) != -1) { memcpy(&ip->addr, (char*)&sa.sin_addr, 4); *port = ntohs(sa.sin_port); } return fd; } bglibs-2.04/net/connect4.c0000664000076400007640000000350713244040127014717 0ustar bruceguenter/* net/connect4.c - Make an IPv4 connection * Copyright (C) 2001,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include #include #include "socket.h" /** Connect a socket to an IPv4 address. */ int socket_connect4(int sock, const ipv4addr* ip, ipv4port port) { struct sockaddr_in sa; memset(&sa, 0, sizeof sa); sa.sin_family = AF_INET; memcpy((char*)&sa.sin_addr, &ip->addr, 4); sa.sin_port = htons(port); return connect(sock, (struct sockaddr*)&sa, sizeof sa) == 0; } #ifdef SELFTEST_MAIN MAIN { int sock1; int sock2; ipv4port port = 12345; debugsys((sock1 = socket_tcp4()) >= 0); debugsys(socket_reuse(sock1)); for (port = 12345; port < 32768; ++port) if (socket_bind4(sock1, &IPV4ADDR_ANY, port) == 0) break; debugsys(socket_listen(sock1, 1)); debugsys((sock2 = socket_tcp4()) >= 0 && sock2 != sock1); debugsys(socket_connect4(sock2, &IPV4ADDR_LOOPBACK, port)); } #endif #ifdef SELFTEST_EXP result=1 result=1 result=1 result=1 result=0 #endif bglibs-2.04/net/dns_fmt.c0000664000076400007640000000147513244040127014636 0ustar bruceguenter#include "dns.h" /** Format a DNS domain name as a dotted name. */ unsigned fmt_dns_domain(char* out, const char* domain) { unsigned char ch; unsigned char ch2; char* orig; if (!*domain) { if (out) out[0] = '.'; return 1; } orig = out; for (;;) { ch = *domain++; while (ch--) { ch2 = *domain++; if ((ch2 >= 'A') && (ch2 <= 'Z')) ch2 += 32; if (((ch2 >= 'a') && (ch2 <= 'z')) || ((ch2 >= '0') && (ch2 <= '9')) || (ch2 == '-') || (ch2 == '_')) { if (orig) *out = ch2; out++; } else { if (orig) { out[3] = '0' + (ch2 & 7); ch2 >>= 3; out[2] = '0' + (ch2 & 7); ch2 >>= 3; out[1] = '0' + (ch2 & 7); out[0] = '\\'; } out += 4; } } if (*domain == 0) break; if (orig) *out = '.'; ++out; } return out - orig; } bglibs-2.04/net/resolve_ipv4addr.c0000664000076400007640000000075013244040127016453 0ustar bruceguenter#include "dns.h" #include "resolve.h" /** Look up the domain name corresponding to an IPv4 address. */ const char* resolve_ipv4addr(const ipv4addr* addr) { static struct dns_result out = {0}; if (!resolve_calldns(dns_name4, &out, addr)) return 0; return out.rr.name[0]; } #ifdef SELFTEST_MAIN MAIN { ipv4addr ip = {{ 69,5,1,51 }}; obuf_putf(&outbuf, "s{ => }s{\n}", ipv4_format(&ip), resolve_ipv4addr(&ip)); } #endif #ifdef SELFTEST_EXP 69.5.1.51 => untroubled.org #endif bglibs-2.04/net/send4.c0000664000076400007640000000253113244040127014213 0ustar bruceguenter/* net/send4.c - Send a datagram on a UDP socket * Copyright (C) 2001,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include "socket.h" /** Send a datagram on a UDP socket. */ int socket_send4(int sock, const char* buffer, unsigned buflen, const ipv4addr* ip, ipv4port port) { struct sockaddr_in sa; memset(&sa, 0, sizeof sa); sa.sin_family = AF_INET; memcpy((char*)&sa.sin_addr, &ip->addr, 4); sa.sin_port = htons(port); return sendto(sock, buffer, buflen, 0, (struct sockaddr*)&sa, sizeof sa); } bglibs-2.04/net/uncork.c0000664000076400007640000000302513244040127014476 0ustar bruceguenter/* net/uncork.c - Unstop a TCP socket from sending short writes. * Copyright (C) 2001,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include "socket.h" /** Unstop a TCP socket from sending short writes. */ int socket_uncork(int sock) { #if defined(TCP_CORK) int flag = 0; return setsockopt(sock, SOL_TCP, TCP_CORK, &flag, sizeof flag) == 0; #elif defined(TCP_NOPUSH) /* BSD's TCP_NOPUSH option only takes effect after a write/send. * Hopefully this extra write will cause the TCP stack to send out * any buffered writes. */ int flag = 0; if (setsockopt(sock, SOL_SOCKET, TCP_NOPUSH, &flag, sizeof flag) != 0) return 0; return write(sock, &flag, 0) == 0; #else return 1; #endif } bglibs-2.04/net/resolve_ipv4name.c0000664000076400007640000000233113244040127016456 0ustar bruceguenter#include "dns.h" #include "resolve.h" /** Look up the IPv4 address(es) corresponding to a domain name. */ int resolve_ipv4name_n(const char* name, ipv4addr* addr, int maxaddrs) { static struct dns_result out = {0}; int i; if (!resolve_qualdns(dns_ip4_r, &out, name)) return 0; for (i = 0; i < maxaddrs && i < out.count; ++i) addr[i] = out.rr.ip4[i]; return 1; } #ifdef SELFTEST_MAIN #include "dns-responder.c" RESPONSE response1 = { 2, 1, 0, { { "\300\014", 2, DNS_T_A, DNS_C_IN, 86400, "\002\004\006\010", 4 }, { "\300\014", 2, DNS_T_A, DNS_C_IN, 86400, "\002\004\006\011", 4 }, { "\300\014", 2, DNS_T_NS, DNS_C_IN, 123456, "\003ns1\007example\003org\0", 17}, } }; MAIN { ipv4addr ips[4]; int i; memset(ips, 0, sizeof ips); start_dns_responder(&response1, 1); setenv("LOCALDOMAIN", "example.org", 1); debugfn(resolve_ipv4name_n("test", ips, 4)); for (i = 0; i < 4; i++) obuf_putf(&outbuf, "d{ }s{\n}", i, ipv4_format(&ips[i])); wait_dns_responder(); } NODUMP #endif #ifdef SELFTEST_EXP 34: ID=XX QR=0 opcode=0 AA=0 TC=0 RD=1 RA=0 Z=0 RCODE=0 QDCOUNT=1 ANCOUNT=0 NSCOUNT=0 ARCOUNT=0 Question: test.example.org. QTYPE=1 QCLASS=1 result=1 0 2.4.6.9 1 2.4.6.8 2 0.0.0.0 3 0.0.0.0 #endif bglibs-2.04/net/connectu.c0000664000076400007640000000233413244040127015015 0ustar bruceguenter/* net/connect4.c - Make an UNIX domain connection * Copyright (C) 2001,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include #include "socket.h" /** Make an UNIX domain connection. */ int socket_connectu(int sock, const char* path) { struct sockaddr_un sa; sa.sun_family = AF_UNIX; strcpy(sa.sun_path, path); return connect(sock, (struct sockaddr*)&sa, sizeof sa) == 0; } bglibs-2.04/net/dns_name6_domain.c0000664000076400007640000000074513244040127016404 0ustar bruceguenter#include #include "fmt.h" #include "dns.h" /** Generate the reverse domain name for an IPv6 address. */ void dns_name6_domain(char name[DNS_NAME6_DOMAIN],const ipv6addr *addr) { unsigned int i; unsigned int j; unsigned char a; for (j = i = 0; i < 16; ++i, j += 4) { a = addr->addr[15-i]; name[j] = 1; name[j+1] = fmt_lcase_digits[a & 0xf]; name[j+2] = 1; name[j+3] = fmt_lcase_digits[a >> 4]; } memcpy(name + 32*2, "\3ip6\4arpa\0", 10); } bglibs-2.04/net/dns_qualify.c0000664000076400007640000001164713244040127015524 0ustar bruceguenter#include #include "dns.h" static int doit(str *work,const char *rule) { char ch; unsigned int colon; unsigned int prefixlen; const char *p; ch = *rule++; if ((ch != '?') && (ch != '=') && (ch != '*') && (ch != '-')) return 1; p = strchr(rule,':'); if (!p) return 1; colon = p - rule; if (work->len < colon) return 1; prefixlen = work->len - colon; if ((ch == '=') && prefixlen) return 1; if (strncasecmp(rule,work->s + prefixlen,colon)) return 1; if (ch == '?') { if (memchr(work->s,':',prefixlen)) return 1; if (memchr(work->s,'.',prefixlen)) return 1; if (memchr(work->s,'[',prefixlen)) return 1; if (memchr(work->s,']',prefixlen)) return 1; } work->len = prefixlen; if (ch == '-') work->len = 0; return str_cats(work,rule + colon + 1); } /** Qualify a domain name through DNS requests. This function is used to qualify what may be a partial domain name into a fully qualified domain name through a set of rules and a resolver function. The resolution rules are read by \c dns_resolvconfrewrite. For each possible qualification of the domain name, the resolver function is called to test if the qualified domain name exists. \param out Output storage for the DNS record results. \param fqdn Output storage for the fully qualified domain name. \param rules The list of rules to use to qualify the domain name. \param in Domain name (full or partial) to qualify. \param fn Function to call (such as \c dns_ip4) to determine if a qualified domain name exists. */ int dns_qualify_rules(struct dns_result* out, str *fqdn, const char *in, const str *rules, int (*fn)(struct dns_transmit*, struct dns_result*, const char*)) { unsigned int i; unsigned int j; unsigned int plus; unsigned int fqdnlen; const char *p; struct dns_transmit tx; if (!str_copys(fqdn,in)) return -1; memset(&tx, 0, sizeof tx); for (j = i = 0;j < rules->len;++j) if (!rules->s[j]) { if (!doit(fqdn,rules->s + i)) return -1; i = j + 1; } fqdnlen = fqdn->len; p = memchr(fqdn->s,'+',fqdnlen); if (!p) return fn(&tx,out,fqdn->s); plus = p - fqdn->s; i = plus + 1; for (;;) { p = memchr(fqdn->s + i,'+',fqdnlen - i); j = p ? p - (fqdn->s + i) : fqdnlen - i; memmove(fqdn->s + plus,fqdn->s + i,j); if (!str_truncate(fqdn, plus + j)) return -1; if (fn(&tx,out,fqdn->s) == -1) return -1; if (out->count) return 0; i += j; if (i >= fqdnlen) return 0; ++i; } } /** Qualify a domain name through DNS requests. Calls \c dns_resolvconfrewrite and \c dns_qualify_rules. \param out Output storage for the DNS record results. \param fqdn Output storage for the fully qualified domain name. \param in Domain name (full or partial) to qualify. \param fn Function to call (such as \c dns_ip4) to determine if a qualified domain name exists. */ int dns_qualify(struct dns_result* out, str* fqdn, const char* in, int (*fn)(struct dns_transmit*, struct dns_result*, const char*)) { static str rules; if (dns_resolvconfrewrite(&rules) == -1) return -1; return dns_qualify_rules(out,fqdn,in,&rules,fn); } #ifdef SELFTEST_MAIN static int skip = 0; static int dummy(struct dns_transmit* tx, struct dns_result* out, const char* fqdn) { obuf_putf(&outbuf, "{using }s\\\n", fqdn); out->count = !skip; if (skip > 0) --skip; return 0; (void)tx; (void)out; } MAIN { struct dns_result out = {0}; str fqdn = {0}; str rcfile = {0}; makefile(&rcfile, "-.local:me.local\n=me:127.0.0.1\n*.a:.af.mil\n?:+.domain1.com+.domain2.net\n*.:\n"); debugfn(setenv("DNSREWRITEFILE", rcfile.s, 1)); debugstrfn(dns_qualify(&out,&fqdn,"example.com",dummy), &fqdn); debugstrfn(dns_qualify(&out,&fqdn,"sth.local",dummy), &fqdn); debugstrfn(dns_qualify(&out,&fqdn,"me",dummy), &fqdn); debugstrfn(dns_qualify(&out,&fqdn,"sth.a",dummy), &fqdn); debugstrfn(dns_qualify(&out,&fqdn,"sth",dummy), &fqdn); skip = 1; debugstrfn(dns_qualify(&out,&fqdn,"sth",dummy), &fqdn); debugstrfn(dns_qualify(&out,&fqdn,"sth.",dummy), &fqdn); debugstrfn(dns_qualify(&out,&fqdn,"a.b+.c.d+.e.f+.g.h",dummy), &fqdn); skip = 1; debugstrfn(dns_qualify(&out,&fqdn,"a.b+.c.d+.e.f+.g.h",dummy), &fqdn); skip = 2; debugstrfn(dns_qualify(&out,&fqdn,"a.b+.c.d+.e.f+.g.h",dummy), &fqdn); unlink(rcfile.s); } #endif #ifdef SELFTEST_EXP result=0 using example.com result=0 len=11 size=16 s=example.com using me.local result=0 len=8 size=16 s=me.local using 127.0.0.1 result=0 len=9 size=16 s=127.0.0.1 using sth.af.mil result=0 len=10 size=16 s=sth.af.mil using sth.domain1.com result=0 len=15 size=48 s=sth.domain1.com using sth.domain1.com using sth.domain2.net result=0 len=15 size=48 s=sth.domain2.net using sth result=0 len=3 size=48 s=sth using a.b.c.d result=0 len=7 size=48 s=a.b.c.d using a.b.c.d using a.b.e.f result=0 len=7 size=48 s=a.b.e.f using a.b.c.d using a.b.e.f using a.b.g.h result=0 len=7 size=48 s=a.b.g.h #endif bglibs-2.04/net/dns_ip6.c0000664000076400007640000000500413244040127014536 0ustar bruceguenter#include #include #include "dns.h" static int getit(struct dns_result* out, unsigned int i, unsigned int offset, const char* buf, unsigned int len, unsigned int pos, uint16 datalen) { unsigned char header[16]; if (datalen != 16) { errno = EPROTO; return -1; } if (!dns_packet_copy(buf,len,pos,header,16)) return -1; memcpy(&out->rr.ip6[i], header, 16); return 0; (void)offset; } /** Extract IPv6 address (AAAA) records from a DNS response packet. */ int dns_ip6_packet(struct dns_result* out, const char* buf, unsigned int len) { if (dns_packet_extract(out, buf, len, DNS_T_AAAA, DNS_C_IN, 0, getit) < 0) return -1; dns_rotateipv6(out->rr.ip6, out->count); return 0; } /** Request the IPv6 address (AAAA) records for a domain name. */ int dns_ip6_r(struct dns_transmit* tx, struct dns_result* out, const char* fqdn) { char *q = 0; ipv6addr ip6; ipv4addr ip4; const char* x; if ((x = ipv6_scan(fqdn, &ip6)) != 0 && *x == 0) { if (dns_result_alloc(out, DNS_T_AAAA, 1, 0) < 0) return -1; memcpy(out->rr.ip6, &ip6, sizeof ip6); return 0; } if ((x = ipv4_scan(fqdn, &ip4)) != 0 && *x == 0) { if (dns_result_alloc(out, DNS_T_AAAA, 1, 0) < 0) return -1; memcpy(out->rr.ip6[0].addr, IPV6ADDR_V4PREFIX.addr, 12); memcpy(out->rr.ip6[0].addr+12, ip4.addr, 4); return 0; } if (!dns_domain_fromdot(&q,fqdn,strlen(fqdn))) return -1; if (dns_resolve(tx,q,DNS_T_AAAA) == -1) { free(q); return -1; } free(q); if (dns_ip6_packet(out,tx->packet,tx->packetlen) == -1) return -1; dns_transmit_free(tx); return 0; } /** \fn dns_ip6(struct dns_result*, const char*) Request the IPv6 address (AAAA) records for a domain name. */ DNS_R_FN_WRAP(ip6, const char*) #ifdef SELFTEST_MAIN #include "dns-responder.c" DUMP { int i; for (i = 0; i < count; i++) { obuf_putc(&outbuf, ' '); obuf_puts(&outbuf, ipv6_format(&rr->ip6[i])); } NL(); } RESPONSE response1 = { 1, 1, 0, { { "\300\014", 2, 28, 1, 123, "\x26\x07\xf8\xb0\x40\x0b\x08\x0b\x00\x00\x00\x00\x00\x00\x10\x17", 16 }, { "\300\014", 2, 2, 1, 123456, "\3ns1\6google\3com\0", 16 }, } }; MAIN { const char* names[] = { "1.2.3.4", "google.ca", NULL }; do_dns_respond_tests(dns_ip6, names, &response1, 1); } #endif #ifdef SELFTEST_EXP_FNMATCH result=0 1.2.3.4: count=1 ::ffff:1.2.3.4 27: ID=XX QR=0 opcode=0 AA=0 TC=0 RD=1 RA=0 Z=0 RCODE=0 QDCOUNT=1 ANCOUNT=0 NSCOUNT=0 ARCOUNT=0 Question: google.ca. QTYPE=28 QCLASS=1 result=0 google.ca: count=1 2607:f8b0:400b:80b::1017 #endif bglibs-2.04/net/listen.c0000664000076400007640000000205513244040127014475 0ustar bruceguenter/* net/listen.c - Listen to a socket * Copyright (C) 2001,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include "socket.h" /** Listen to a socket. */ int socket_listen(int sock, int backlog) { return listen(sock, backlog) == 0; } bglibs-2.04/net/connected.c0000664000076400007640000000225213244040127015140 0ustar bruceguenter/* net/connected.c - Test if a socket is connected * Copyright (C) 2001,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include "socket.h" /** Test if a socket is connected. */ int socket_connected(int sock) { struct sockaddr sa; socklen_t dummy; char ch; dummy = sizeof sa; if (getpeername(sock, &sa, &dummy) == -1) { read(sock,&ch,1); return 0; } return 1; } bglibs-2.04/net/broadcast.c0000664000076400007640000000215513244040127015142 0ustar bruceguenter/* net/broadcast.c - Mark a socket for broadcast transmission. * Copyright (C) 2001,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include "socket.h" /** Mark a socket for broadcast transmission. */ int socket_broadcast(int fd) { int opt = 1; return setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &opt, sizeof opt) == 0; } bglibs-2.04/net/dns_domain_todot.c0000664000076400007640000000127413244040127016525 0ustar bruceguenter#include "dns.h" /** Translate the domain name in \p d to a dotted text string in \p out. */ int dns_domain_todot_cat(str *out,const char *d) { unsigned int len = fmt_dns_domain(0, d); if (!str_realloc(out, out->len + len)) return 0; fmt_dns_domain(out->s + out->len, d); out->len += len; out->s[out->len] = 0; return 1; } #ifdef SELFTEST_MAIN #include "iobuf.h" void testit(const char* data) { str result = {0}; debugstrfn(dns_domain_todot_cat(&result, data), &result); } MAIN { testit("\007example\003com\000"); testit("\003joe\007example\003org\000"); } #endif #ifdef SELFTEST_EXP result=1 len=11 size=16 s=example.com result=1 len=15 size=32 s=joe.example.org #endif bglibs-2.04/net/linger.c0000664000076400007640000000223513244040127014457 0ustar bruceguenter/* net/linger.c - Set the socket linger option. * Copyright (C) 2001,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include "socket.h" /** Set the socket "linger" option. */ int socket_linger(int fd, int onoff, int seconds) { struct linger opt; opt.l_onoff = onoff; opt.l_linger = seconds; return setsockopt(fd, SOL_SOCKET, SO_LINGER, &opt, sizeof opt) == 0; } bglibs-2.04/net/ipv6_addr.c0000664000076400007640000000105513244040127015054 0ustar bruceguenter#include #include "ipv6.h" /** IPv6 "any" address constant. */ const ipv6addr IPV6ADDR_ANY = {{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }}; /** IPv6 loopback address constant. */ const ipv6addr IPV6ADDR_LOOPBACK = {{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }}; /** IPv4-in-IPv6 address prefix constant. */ const ipv6addr IPV6ADDR_V4PREFIX = {{ 0,0,0,0,0,0,0,0,0,0,0xff,0xff,0,0,0,0 }}; /** Return true if the IPv6 address is actually a wrapped IPv4 address. */ int ipv6_isv4mapped(const ipv6addr* addr) { return memcmp(&IPV6ADDR_V4PREFIX, addr, 12) == 0; } bglibs-2.04/net/bind4.c0000664000076400007640000000243413244040127014200 0ustar bruceguenter/* net/bind4.c - Bind an IPv4 address to a socket * Copyright (C) 2001,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include "socket.h" /** Bind a socket to an IPv4 address. */ int socket_bind4(int sock, const ipv4addr* ip, ipv4port port) { struct sockaddr_in sa; memset(&sa, 0, sizeof sa); sa.sin_family = AF_INET; sa.sin_port = htons(port); memcpy(&sa.sin_addr, &ip->addr, 4); return bind(sock, (struct sockaddr*)&sa, sizeof sa) == 0; } bglibs-2.04/net/pairstr.c0000664000076400007640000000214313244040127014661 0ustar bruceguenter/* net/pairstr.c - Create a pair of stream sockets * Copyright (C) 2002,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include "socket.h" /** Create a pair of stream sockets. */ int socket_pairstr(int fd[2]) { return socketpair(AF_UNIX, SOCK_STREAM, 0, fd) == 0; } bglibs-2.04/net/shutdown.c0000664000076400007640000000251213244040127015050 0ustar bruceguenter/* net/shutdown.c - Shutdown part of a socket. * Copyright (C) 2001,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include "socket.h" #ifndef SHUT_RD #define SHUT_RD 0 #endif #ifndef SHUT_WR #define SHUT_WR 1 #endif #ifndef SHUT_RDWR #define SHUT_RDWR 2 #endif /** Shut down part or all of a socket. */ int socket_shutdown(int sock, int shut_rd, int shut_wr) { int how; if (shut_rd && shut_wr) how = SHUT_RDWR; else if (shut_rd) how = SHUT_RD; else if (shut_wr) how = SHUT_WR; else return 1; return shutdown(sock, how) == 0; } bglibs-2.04/net/dns_resolvconfrewrite.c0000664000076400007640000001064713244040127017633 0ustar bruceguenter#include #include #include #include "ibuf.h" #include "striter.h" #include "dns.h" static str data = {0}; static int init(str *rules) { char host[256]; const char *x; int i; int j; int k; striter s; if (!str_copys(rules,"")) return -1; x = getenv("DNSREWRITEFILE"); if (!x) x = "/etc/dnsrewrite"; i = ibuf_openreadclose(x,&data); if (i == -1) return -1; if (i) { if (!str_catc(&data,'\n')) return -1; striter_loop(&s, &data, '\n') { if (!str_catb(rules, s.startptr, s.len)) return -1; while (rules->len) { if (rules->s[rules->len - 1] != ' ' && rules->s[rules->len - 1] != '\t' && rules->s[rules->len - 1] != '\r') break; --rules->len; } if (!str_catc(rules,0)) return -1; } return 0; } x = getenv("LOCALDOMAIN"); if (x) { if (!str_copys(&data,x)) return -1; if (!str_catc(&data,' ')) return -1; if (!str_copys(rules,"?:")) return -1; striter_loop(&s, &data, ' ') { if (!str_cats(rules, "+.")) return -1; if (!str_catb(rules, s.startptr, s.len)) return -1; } if (!str_catc(rules,0)) return -1; if (!str_cats(rules,"*.:")) return -1; if (!str_catc(rules,0)) return -1; return 0; } i = dns_read_resolvconf(&data); if (i == -1) return -1; if (i) { if (!str_catc(&data,'\n')) return -1; striter_loop(&s, &data, '\n') { if (memcmp("search ", s.startptr, 7) == 0 || memcmp("search\t", s.startptr, 7) == 0 || memcmp("domain ", s.startptr, 7) == 0 || memcmp("domain\t", s.startptr, 7) == 0) { if (!str_copys(rules,"?:")) return -1; i = 7; j = s.len; while (i < j) { x = memchr(s.startptr + i,' ',j - i); k = x ? x - (s.startptr + i) : j - i; x = memchr(s.startptr + i,'\t',k); k = x ? x - (s.startptr + i) : k; if (!k) { ++i; continue; } if (!str_cats(rules,"+.")) return -1; if (!str_catb(rules, s.startptr + i, k)) return -1; i += k; } if (!str_catc(rules,0)) return -1; if (!str_cats(rules,"*.:")) return -1; if (!str_catc(rules,0)) return -1; return 0; } } } host[0] = 0; if (gethostname(host,sizeof host) == -1) return -1; host[(sizeof host) - 1] = 0; x = strchr(host,'.'); if (x) { if (!str_copys(rules,"?:")) return -1; if (!str_cats(rules,host + i)) return -1; if (!str_catc(rules,0)) return -1; } if (!str_cats(rules,"*.:")) return -1; if (!str_catc(rules,0)) return -1; return 0; } static int ok = 0; static unsigned int uses; static struct timeval deadline; static str rules = {0}; /* defined if ok */ /** Load the domain name qualification rules. The rules are loaded from the file named by \c $DNSREWRITEFILE (defaults to "/etc/dnsrewrite"). For compatibility, if the rewriting rules file is not present, the qualification procedure looks for a local domain name in three places: -# The value of the \c $LOCALDOMAIN environment variable, if it is set. -# The first \c domain or \c search line in \c /etc/resolv.conf (if any). -# Everything after the first period in the system's hostname. It translate these into instructions that add the local domain name to any name without dots or brackets. See http://cr.yp.to/djbdns/qualify.html for complete details. */ int dns_resolvconfrewrite(str *out) { struct timeval now; gettimeofday(&now,0); if (TV_LESS(&deadline,&now)) ok = 0; if (!uses) ok = 0; if (!ok) { if (init(&rules) == -1) return -1; deadline = now; deadline.tv_sec += 600; uses = 10000; ok = 1; } --uses; if (!str_copy(out,&rules)) return -1; return 0; } #ifdef SELFTEST_MAIN MAIN { str rcfile = {0}; makefile(&rcfile, "search \tdomain1.com\ndomain domain2.com"); debugfn(setenv("DNSRESOLVCONF", rcfile.s, 1)); debugstrfn(dns_resolvconfrewrite(&rules), &rules); unlink(rcfile.s); uses = 0; data.len = 0; debugfn(setenv("LOCALDOMAIN", "local.domain", 1)); debugstrfn(dns_resolvconfrewrite(&rules), &rules); uses = 0; data.len = 0; makefile(&rcfile, "-.local:me.local\n=me:127.0.0.1\n*.a:.af.mil\n?:.heaven.af.mil\n*.:\n"); debugfn(setenv("DNSREWRITEFILE", rcfile.s, 1)); debugstrfn(dns_resolvconfrewrite(&rules), &rules); unlink(rcfile.s); } #endif #ifdef SELFTEST_EXP result=0 result=0 len=20 size=32 s=?:+.domain1.com^@*.:^@ result=0 result=0 len=21 size=32 s=?:+.local.domain^@*.:^@ result=0 result=0 len=65 size=80 s=-.local:me.local^@=me:127.0.0.1^@*.a:.af.mil^@?:.heaven.af.mil^@*.:^@^@ #endif bglibs-2.04/net/recvu.c0000664000076400007640000000214613244040127014324 0ustar bruceguenter/* net/recvu.c - Receive a datagram from a UNIX domain socket * Copyright (C) 2001,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include "socket.h" /** Receive a datagram from a UNIX domain socket. */ int socket_recvu(int sock, char* buffer, unsigned buflen) { return recvfrom(sock, buffer, buflen, 0, 0, 0); } bglibs-2.04/net/dns_random.c0000664000076400007640000000123513244040127015322 0ustar bruceguenter#include #include "dns.h" #include "uint32.h" #include "surfrand.h" static struct surfrand state; static int inited = 0; /** Initialize the DNS library random state. */ void dns_random_init(const char data[SURF_SEED]) { struct timeval tv; uint32 altdata[SURF_SEED_U32]; surfrand_init(&state, data ? (const uint32*)data : altdata, SURF_SEED_U32); gettimeofday(&tv,0); state.counter[8] = tv.tv_sec; state.counter[9] = tv.tv_usec; state.counter[10] = getpid(); state.counter[11] = getppid(); inited = 1; } /** Generate a random number less than \c n. */ unsigned int dns_random(unsigned int n) { return surfrand_uniform(&state, n); } bglibs-2.04/net/tcp6.c0000664000076400007640000000221713244040127014053 0ustar bruceguenter/* net/tcp6 - Create an IPv6 TCP socket * Copyright (C) 2004,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "sysdeps.h" #include #include #include #include #include #include "socket.h" /** Create a TCP/IPv6 socket. */ int socket_tcp6(void) { #if HASIPV6 return socket(AF_INET6, SOCK_STREAM, 0); #else errno = EPROTONOSUPPORT; return -1; #endif } bglibs-2.04/net/acceptu.c0000664000076400007640000000220713244040127014622 0ustar bruceguenter/* net/accept4.c - Accept an UNIX domain connection * Copyright (C) 2006 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include "socket.h" /** Accept a UNIX domain connection. */ int socket_acceptu(int sock) { struct sockaddr_un sa; socklen_t dummy; dummy = sizeof sa; return accept(sock, (struct sockaddr*)&sa, &dummy); } bglibs-2.04/net/dns_result.c0000664000076400007640000000210013244040127015350 0ustar bruceguenter#include #include #include #include "dns.h" /** Free a DNS result structure. */ void dns_result_free(struct dns_result* d) { if (d->rr.__ptr != 0) { free(d->rr.__ptr); d->rr.__ptr = 0; } if (d->__buffer != 0) { free(d->__buffer); d->__buffer = 0; } } /** Allocate a DNS result structure. */ int dns_result_alloc(struct dns_result* d, int type, int count, int bufsize) { int size; switch (type) { case DNS_T_A: size = sizeof(ipv4addr); break; case DNS_T_AAAA: size = sizeof(ipv6addr); break; case DNS_T_MX: size = sizeof(struct dns_mx); break; case DNS_T_PTR: case DNS_T_TXT: size = sizeof(void*); break; default: errno = EPROTO; return -1; } dns_result_free(d); if (count > 0) { if ((d->rr.__ptr = malloc(count * size)) == 0) { errno = ENOMEM; return -1; } memset(d->rr.__ptr, 0, count * size); if (bufsize > 0 && (d->__buffer = malloc(bufsize)) == 0) { errno = ENOMEM; return -1; } } d->count = count; d->type = type; return 0; } bglibs-2.04/net/recv4.c0000664000076400007640000000254413244040127014225 0ustar bruceguenter/* net/recv4.c - Receive a datagram from a UDP socket * Copyright (C) 2001,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include "socket.h" /** Receive a datagram from a UDP socket. */ int socket_recv4(int sock, char* buffer, unsigned buflen, ipv4addr* ip, ipv4port* port) { struct sockaddr_in sa; socklen_t dummy = sizeof sa; int r; r = recvfrom(sock, buffer, buflen, 0, (struct sockaddr*)&sa, &dummy); if (r != -1) { memcpy(&ip->addr, &sa.sin_addr, 4); *port = ntohs(sa.sin_port); } return r; } bglibs-2.04/net/dns_mx.c0000664000076400007640000000624313244040127014472 0ustar bruceguenter#include #include "dns.h" static int sizeit(const char* buf, unsigned int len, unsigned int pos, uint16 datalen) { char* q = 0; if (!dns_packet_getname(buf,len,pos + 2,&q)) return -1; len = fmt_dns_domain(0, q); free(q); return len + 1; (void)datalen; } static int getit(struct dns_result* out, unsigned int i, unsigned int offset, const char* buf, unsigned int len, unsigned int pos, uint16 datalen) { unsigned char pref[2]; char* q = 0; struct dns_mx* mx = &out->rr.mx[i]; if (!dns_packet_copy(buf,len,pos,pref,2)) return -1; mx->distance = uint16_get_msb(pref); if (!dns_packet_getname(buf,len,pos + 2,&q)) return -1; mx->name = out->__buffer + offset; len = fmt_dns_domain(mx->name, q); mx->name[len] = 0; free(q); return len + 1; (void)datalen; } /** Extract mail exchanger (MX) records from a DNS response packet. */ int dns_mx_packet(struct dns_result* out, const char* buf, unsigned int len) { return dns_packet_extract(out, buf, len, DNS_T_MX, DNS_C_IN, sizeit, getit); } /** Request the mail exchanger (MX) records for a domain name. */ int dns_mx_r(struct dns_transmit* tx, struct dns_result* out, const char* fqdn) { char *q = 0; if (!dns_domain_fromdot(&q,fqdn,strlen(fqdn))) return -1; if (dns_resolve(tx,q,DNS_T_MX) == -1) { free(q); return -1; } free(q); if (dns_mx_packet(out,tx->packet,tx->packetlen) == -1) return -1; dns_transmit_free(tx); return 0; } /** \fn dns_mx(struct dns_result*, const char*) Request the mail exchanger (MX) records for a domain name. */ DNS_R_FN_WRAP(mx, const char*) #ifdef SELFTEST_MAIN #include "dns-responder.c" DUMP { int i; dns_sort_mx(rr->mx, count); for (i = 0; i < count; ++i) obuf_putf(&outbuf, "d{ }d{: \"}s{\"\n}", i, rr->mx[i].distance, rr->mx[i].name); } RESPONSE responses[] = { { 1, 3, 0, { { "\300\014", 2, 15, 1, 86400, "2\1\2mx\vfuturequest\3net\0", 22 }, { "\300\014", 2, 1, 1, 123456, "\3ns2\300\061", 6 }, { "\300\014", 2, 1, 1, 123456, "\3ns1\300\061", 6 }, { "\300\014", 2, 1, 1, 123456, "\3ns3\300\061", 6 }, } }, { 5, 0, 0, { { "\300\014", 2, 15, 1, 86400, "\0\024\4alt1\5aspmx\1l\6google\3com\0", 27 }, { "\300\014", 2, 15, 1, 86400, "\0\012\5aspmx\1l\6google\3com\0", 22, }, { "\300\014", 2, 15, 1, 86400, "\0\036\4alt2\5aspmx\1l\6google\3com\0", 27 }, { "\300\014", 2, 15, 1, 86400, "\0\050\4alt3\5aspmx\1l\6google\3com\0", 27 }, { "\300\014", 2, 15, 1, 86400, "\0\062\4alt4\5aspmx\1l\6google\3com\0", 27 }, } }, }; MAIN { const char* names[] = { "untroubled.org", "google.com", NULL }; do_dns_respond_tests(dns_mx, names, responses, 2); } #endif #ifdef SELFTEST_EXP 32: ID=XX QR=0 opcode=0 AA=0 TC=0 RD=1 RA=0 Z=0 RCODE=0 QDCOUNT=1 ANCOUNT=0 NSCOUNT=0 ARCOUNT=0 Question: untroubled.org. QTYPE=15 QCLASS=1 result=0 untroubled.org: count=1 0 12801: "mx.futurequest.net" 28: ID=XX QR=0 opcode=0 AA=0 TC=0 RD=1 RA=0 Z=0 RCODE=0 QDCOUNT=1 ANCOUNT=0 NSCOUNT=0 ARCOUNT=0 Question: google.com. QTYPE=15 QCLASS=1 result=0 google.com: count=5 0 10: "aspmx.l.google.com" 1 20: "alt1.aspmx.l.google.com" 2 30: "alt2.aspmx.l.google.com" 3 40: "alt3.aspmx.l.google.com" 4 50: "alt4.aspmx.l.google.com" #endif bglibs-2.04/net/sendfd.c0000664000076400007640000000330413244040127014440 0ustar bruceguenter/* net/sendfd.c - Send a file descriptor over a socket * Copyright (C) 2002,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include "cmsg.h" #include "socket.h" /** Send a file descriptor over a socket. */ int socket_sendfd(int sock, int fd) { #if defined(CMSG_FIRSTHDR) && defined(MSG_NOSIGNAL) && defined(SCM_RIGHTS) struct msghdr msg; struct cmsghdr *cmsg; char buf[CMSG_SPACE(sizeof(int))]; /* ancillary data buffer */ memset(&msg, 0, sizeof msg); msg.msg_control = buf; msg.msg_controllen = sizeof buf; cmsg = CMSG_FIRSTHDR(&msg); cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_RIGHTS; cmsg->cmsg_len = CMSG_LEN(sizeof(int)); /* Initialize the payload: */ memcpy(CMSG_DATA(cmsg), &fd, sizeof fd); /* Sum of the length of all control messages in the buffer: */ msg.msg_controllen = cmsg->cmsg_len; return sendmsg(sock, &msg, MSG_NOSIGNAL); #else errno = ENOSYS; return -1; #endif } bglibs-2.04/net/ipv6_scan.c0000664000076400007640000000755113244040127015075 0ustar bruceguenter#include "ipv6.h" #include "ipv4.h" static int hex2bin(char c) { switch (c) { case '0': return 0x0; case '1': return 0x1; case '2': return 0x2; case '3': return 0x3; case '4': return 0x4; case '5': return 0x5; case '6': return 0x6; case '7': return 0x7; case '8': return 0x8; case '9': return 0x9; case 'A': case 'a': return 0xa; case 'B': case 'b': return 0xb; case 'C': case 'c': return 0xc; case 'D': case 'd': return 0xd; case 'E': case 'e': return 0xe; case 'F': case 'f': return 0xf; default: return -1; } } static const char* parse_hexpart(const char* s, uint16* num) { int i = 0; int t; while ((t = hex2bin(*s)) != -1) { ++s; i = (i << 4) | t; if (i > 0xffff) return 0; } *num = i; return s; } static void set(ipv6addr* addr, int offset, uint16 bit) { offset *= 2; addr->addr[offset++] = bit >> 8; addr->addr[offset] = bit; } /** Scan a C string for an IPv6 address. \return \c NULL if parsing failed, otherwise a pointer to the first character after the end of the address. */ const char* ipv6_scan(const char* s, ipv6addr* addr) { uint16 bits[8]; unsigned len1; unsigned len2; unsigned i; len1 = len2 = 0; if (s[0] == ':' && s[1] == ':') ++s; else { while (len1 < 8) { const char* news; if ((news = parse_hexpart(s, &bits[len1])) == 0 || (news == s && *news != ':')) return 0; s = news + (*news == ':'); ++len1; if (*s == ':') break; } for (i = 0; i < len1; ++i) set(addr, i, bits[i]); } if (len1 < 8) { ++s; while (len2 < 8-len1) { const char* news; if ((news = parse_hexpart(s, &bits[len2])) == 0) return 0; if (news == s) break; s = news; ++len2; if (*s != ':') break; ++s; } for (i = len1; i < 8-len2; ++i) set(addr, i, 0); for (i = 0; i < len2; ++i) set(addr, i+8-len2, bits[i]); } /* handle IPv4 convenience addresses */ if (len1+len2 <= 6 && *s == '.') { ipv4addr i4; while (*--s != ':') ; ++s; --len2; for (i = len1; i < 6-len2; ++i) set(addr, i, 0); for (i = 0; i < len2; ++i) set(addr, i+6-len2, bits[i]); // Parse IPv4 address here if ((s = ipv4_scan(s, &i4)) == 0) return 0; addr->addr[12] = i4.addr[0]; addr->addr[13] = i4.addr[1]; addr->addr[14] = i4.addr[2]; addr->addr[15] = i4.addr[3]; } return s; } #ifdef SELFTEST_MAIN static void test(const char* start) { ipv6addr ip; int i; const char* end; obuf_put2s(&outbuf, start, "="); end = ipv6_scan(start, &ip); if (end == 0) obuf_puts(&outbuf, "NULL"); else { for (i = 0; i < 16; ++i) { obuf_putxw(&outbuf, ip.addr[i], 2, '0'); } obuf_putc(&outbuf, '+'); if (*end != 0) obuf_puts(&outbuf, end); } NL(); obuf_flush(&outbuf); } MAIN { test("::"); test("::1"); test("::0.0.0.2"); test("::FFFF:1.20.100.200"); test("::FFFF:1.20.100.200x"); test("::101:0:0:0:0:0"); test("1080::8:800:200C:417A"); test("FF01::101"); test("FF01::"); test("FF01::x"); test("112:2334:4556:6778:899A:ABBC:CDDE:EFF0"); test("112:2334:4556:6778:899A:ABBC:CDDE:EFF0x"); } #endif #ifdef SELFTEST_EXP ::=00000000000000000000000000000000+ ::1=00000000000000000000000000000001+ ::0.0.0.2=00000000000000000000000000000002+ ::FFFF:1.20.100.200=00000000000000000000ffff011464c8+ ::FFFF:1.20.100.200x=00000000000000000000ffff011464c8+x ::101:0:0:0:0:0=00000000010100000000000000000000+ 1080::8:800:200C:417A=108000000000000000080800200c417a+ FF01::101=ff010000000000000000000000000101+ FF01::=ff010000000000000000000000000000+ FF01::x=ff010000000000000000000000000000+x 112:2334:4556:6778:899A:ABBC:CDDE:EFF0=0112233445566778899aabbccddeeff0+ 112:2334:4556:6778:899A:ABBC:CDDE:EFF0x=0112233445566778899aabbccddeeff0+x #endif bglibs-2.04/net/dns_name4_domain.c0000664000076400007640000000140613244040127016375 0ustar bruceguenter#include #include "fmt.h" #include "dns.h" /** Generate the reverse domain name for an IPv4 address. */ void dns_name4_domain(char name[DNS_NAME4_DOMAIN],const ipv4addr *ip) { unsigned int namelen; unsigned int i; namelen = 0; i = fmt_udec(name + namelen + 1,(unsigned long) (unsigned char) ip->addr[3]); name[namelen++] = i; namelen += i; i = fmt_udec(name + namelen + 1,(unsigned long) (unsigned char) ip->addr[2]); name[namelen++] = i; namelen += i; i = fmt_udec(name + namelen + 1,(unsigned long) (unsigned char) ip->addr[1]); name[namelen++] = i; namelen += i; i = fmt_udec(name + namelen + 1,(unsigned long) (unsigned char) ip->addr[0]); name[namelen++] = i; namelen += i; memcpy(name + namelen,"\7in-addr\4arpa\0",14); } bglibs-2.04/net/ipv6_format.c0000664000076400007640000000742613244040127015442 0ustar bruceguenter#include #include "ipv6.h" #include "ipv4.h" static char hex[16] = "0123456789abcdef"; static char* format_part(uint16 i, char* s) { if (i > 0xfff) *s++ = hex[(i >> 12) & 0xf]; if (i > 0xff) *s++ = hex[(i >> 8) & 0xf]; if (i > 0xf) *s++ = hex[(i >> 4) & 0xf]; *s++ = hex[i & 0xf]; return s; } static unsigned format_ipv4(char* buf, const ipv6addr* addr) { ipv4addr a4; memcpy(&a4.addr, &addr->addr[12], 4); return fmt_ipv4addr(buf, &a4); } /** Produce a formatted C string from an IPv6 address. \note The return value is statically allocated. Multiple calls to this function will return pointers to the same string. */ const char* ipv6_format(const ipv6addr* addr) { static char buf[40]; buf[fmt_ipv6addr(buf, addr)] = 0; return buf; } /** Produce a formatted string from an IPv6 address. The given buffer must be at least 39 bytes long, or 40 bytes if it needs to contain the standard trailing \c NUL byte. \return The number of bytes written to the buffer. \note This routine is thread and recursion safe. */ unsigned fmt_ipv6addr(char* buffer, const ipv6addr* addr) { uint16 bits[8]; int i; int first; char* s = buffer; /* Convert raw address to array of 16-bit parts */ for (i = 0; i < 8; ++i) bits[i] = addr->addr[i*2] << 8 | addr->addr[i*2+1]; for (first = 0; first < 8; ++first) if (bits[first] != 0) break; if (first >= 1) { *s++ = ':'; *s++ = ':'; /* A couple of special cases, to simplify IPv4 style output */ if (first >= 8) i = 1; else if (first == 7 && bits[7] == 1) *s++ = '1'; else if (first >= 6) s += format_ipv4(s, addr); else if (first == 5 && bits[5] == 0xffff) { memcpy(s, "ffff:", 5); s += 5; s += format_ipv4(s, addr); } else for (i = first; i < 8; ++i) { if (i > first) *s++ = ':'; s = format_part(bits[i], s); } } else { int zs = 8; int ze = 8; /* Find the largest internal run of zeros */ for (i = 1; i < 8; ++i) if (bits[i] == 0) { const int z = i; for (++i; i < 8 && bits[i] == 0; ++i) ; if (i-z > ze-zs) zs = z, ze = i; } for (i = 0; i < zs; ++i) { if (i > 0) *s++ = ':'; s = format_part(bits[i], s); } if (zs < 8) { *s++ = ':'; *s++ = ':'; for (i = ze; i < 8; ++i) { if (i > ze) *s++ = ':'; s = format_part(bits[i], s); } } } return s - buffer; } #ifdef SELFTEST_MAIN static void test(const char a[16]) { ipv6addr ip; int i; for (i = 0; i < 16; ++i) obuf_putxw(&outbuf, (unsigned char)a[i], 2, '0'); obuf_putc(&outbuf, '='); memcpy(&ip, a, 16); obuf_put2s(&outbuf, ipv6_format(&ip), "\n"); } MAIN { test("\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"); test("\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01"); test("\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02"); test("\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x01\x14\x64\xc8"); test("\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"); test("\x10\x80\x00\x00\x00\x00\x00\x00\x00\x08\x08\x00\x20\x0c\x41\x7a"); test("\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01"); test("\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"); test("\x01\x12\x23\x34\x45\x56\x67\x78\x89\x9a\xab\xbc\xcd\xde\xef\xf0"); } #endif #ifdef SELFTEST_EXP 00000000000000000000000000000000=:: 00000000000000000000000000000001=::1 00000000000000000000000000000002=::0.0.0.2 00000000000000000000ffff011464c8=::ffff:1.20.100.200 00000000010100000000000000000000=::101:0:0:0:0:0 108000000000000000080800200c417a=1080::8:800:200c:417a ff010000000000000000000000000101=ff01::101 ff010000000000000000000000000000=ff01:: 0112233445566778899aabbccddeeff0=112:2334:4556:6778:899a:abbc:cdde:eff0 #endif bglibs-2.04/net/dns_resolve.c0000664000076400007640000000256313244040127015526 0ustar bruceguenter#include #include "dns.h" static void iopause(iopoll_fd *x,unsigned int len,struct timeval *deadline,struct timeval *stamp) { int millisecs; unsigned int i; if (TV_LESS(deadline,stamp)) millisecs = 0; else { if (deadline->tv_sec - stamp->tv_sec > 1000) millisecs = 1000000; else millisecs = (deadline->tv_sec - stamp->tv_sec) * 1000 + (deadline->tv_usec - stamp->tv_usec) / 1000; millisecs += 20; } for (i = 0;i < len;++i) x[i].revents = 0; iopoll(x,len,millisecs); } /** Resolve a DNS query. This is the base query handler of the DNS library. It takes a domain name and query type, sends it to all configured nameservers, and handles reading the response packet. Callers are responsible for parsing the desired records out of the resulting packet. */ int dns_resolve(struct dns_transmit *tx,const char *q,uint16 qtype) { struct timeval stamp; struct timeval deadline; ipv4addr servers[DNS_MAX_IPS]; iopoll_fd x[1]; int r; if (dns_resolvconfip(servers) == -1) return -1; if (dns_transmit_start(tx,servers,1,q,qtype,0) == -1) return -1; for (;;) { gettimeofday(&stamp,0); deadline = stamp; deadline.tv_sec += 120; dns_transmit_io(tx,x,&deadline); iopause(x,1,&deadline,&stamp); r = dns_transmit_get(tx,x,&stamp); if (r == -1) return -1; if (r == 1) return 0; } } bglibs-2.04/net/accept6.c0000664000076400007640000000262713244040127014531 0ustar bruceguenter/* net/accept6.c - Accept an IPv6 connection * Copyright (C) 2006 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "sysdeps.h" #include #include #include #include #include #include "socket.h" /** Accept a connection on a socket from an IPv6 address. */ int socket_accept6(int sock, ipv6addr* ip, ipv6port *port) { #if HASIPV6 struct sockaddr_in6 sa; socklen_t dummy; int fd; dummy = sizeof sa; if ((fd = accept(sock, (struct sockaddr*)&sa, &dummy)) != -1) { memcpy(&ip->addr, (char*)&sa.sin6_addr, 16); *port = ntohs(sa.sin6_port); } return fd; #else errno = EPROTONOSUPPORT; return -1; #endif } bglibs-2.04/net/pairdgm.c0000664000076400007640000000214613244040127014623 0ustar bruceguenter/* net/pairdgm.c - Create a pair of datagram sockets * Copyright (C) 2002,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include "socket.h" /** Create a pair of datagram sockets. */ int socket_pairdgm(int fd[2]) { return socketpair(AF_UNIX, SOCK_DGRAM, 0, fd) == 0; } bglibs-2.04/net/dns_txt.c0000664000076400007640000000560113244040127014662 0ustar bruceguenter#include #include "dns.h" static int sizeit(const char* buf, unsigned int len, unsigned int pos, uint16 datalen) { if (pos + datalen > len) return -1; return datalen + 1; (void)buf; } static int getit(struct dns_result* out, unsigned int i, unsigned int offset, const char* buf, unsigned int len, unsigned int pos, uint16 datalen) { unsigned int txtlen; char ch; unsigned int j; unsigned int k; char* name = out->rr.name[i] = out->__buffer + offset; for (txtlen = j = 0; j < datalen; ) { ch = buf[pos + j]; txtlen += (unsigned char)ch; j += (unsigned char)ch + 1; } txtlen = 0; for (j = k = 0;j < datalen;++j) { ch = buf[pos + j]; if (!txtlen) txtlen = (unsigned char) ch; else { --txtlen; if (ch < 32) ch = '?'; if (ch > 126) ch = '?'; name[k++] = ch; } } name[k++] = 0; return k; (void)len; } /** Extract text (TXT) records from a DNS response packet. */ int dns_txt_packet(struct dns_result* out, const char* buf, unsigned int len) { return dns_packet_extract(out, buf, len, DNS_T_TXT, DNS_C_IN, sizeit, getit); } /** Request the text (TXT) records for a domain name. */ int dns_txt_r(struct dns_transmit* tx, struct dns_result* out, const char* fqdn) { char *q = 0; if (!dns_domain_fromdot(&q,fqdn,strlen(fqdn))) return -1; if (dns_resolve(tx,q,DNS_T_TXT) == -1) { free(q); return -1; } if (dns_txt_packet(out,tx->packet,tx->packetlen) == -1) { free(q); return -1; } free(q); return 0; } /** \fn dns_txt(struct dns_result*, const char*) Request the text (TXT) records for a domain name. */ DNS_R_FN_WRAP(txt, const char*) #ifdef SELFTEST_MAIN #include "dns-responder.c" DUMP { int i; for (i = 0; i < count; ++i) { obuf_puts(&outbuf, rr->name[i]); NL(); } } RESPONSE responses[] = { { 2, 1, 0, { { "\300\014", 2, 16, 1, 5, "\050http://www.spamhaus.org/sbl/query/SBL233", 41 }, { "\300\014", 2, 16, 1, 5, "\055http://www.spamhaus.org/query/bl?ip=127.0.0.2", 46 }, { "\300\026", 2, 2, 1, 3132, "\001g\002ns\300\036", 7 }, } }, { 1, 1, 0, { { "\300\014", 2, 16, 1, 512, "\037v=spf1 redirect=_spf.google.com", 32 }, { "\300\026", 2, 2, 1, 123456, "\003ns2\006google\300\022", 13 }, } }, }; MAIN { const char* names[] = { "2.0.0.127.sbl-xbl.spamhaus.org", "gmail.com", NULL }; do_dns_respond_tests(dns_txt, names, responses, 2); } #endif #ifdef SELFTEST_EXP 48: ID=XX QR=0 opcode=0 AA=0 TC=0 RD=1 RA=0 Z=0 RCODE=0 QDCOUNT=1 ANCOUNT=0 NSCOUNT=0 ARCOUNT=0 Question: 2.0.0.127.sbl-xbl.spamhaus.org. QTYPE=16 QCLASS=1 result=0 2.0.0.127.sbl-xbl.spamhaus.org: count=2 http://www.spamhaus.org/sbl/query/SBL233 http://www.spamhaus.org/query/bl?ip=127.0.0.2 27: ID=XX QR=0 opcode=0 AA=0 TC=0 RD=1 RA=0 Z=0 RCODE=0 QDCOUNT=1 ANCOUNT=0 NSCOUNT=0 ARCOUNT=0 Question: gmail.com. QTYPE=16 QCLASS=1 result=0 gmail.com: count=1 v=spf1 redirect=_spf.google.com #endif bglibs-2.04/net/getaddr6.c0000664000076400007640000000272713244040127014705 0ustar bruceguenter/* net/getaddr6.c - Determine the IPv6 address of a socket * Copyright (C) 2004,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "sysdeps.h" #include #include #include #include #include #include "socket.h" /** Determine the IPv6 address of a socket. */ int socket_getaddr6(int sock, ipv6addr* addr, ipv6port* port) { #if HASIPV6 struct sockaddr_in6 sa; socklen_t size; size = sizeof sa; if (getsockname(sock, (struct sockaddr*)&sa, &size) == -1) return 0; if (sa.sin6_family != AF_INET6) return 0; if (size != sizeof sa) return 0; memcpy(&addr->addr, &sa.sin6_addr, 16); *port = ntohs(sa.sin6_port); return 1; #else errno = EPROTONOSUPPORT; return 0; #endif } bglibs-2.04/net/resolve_calldns.c0000664000076400007640000000165613244040127016364 0ustar bruceguenter#include "dns.h" #include "resolve.h" /** Saved error code from last dns call. */ int __resolve_error = 0; /** Call a dns_* function and save an error code if necessary. */ int resolve_calldns(int (*dnsfn)(), struct dns_result* out, const void* param) { if (dnsfn(out, param) < 0) { __resolve_error = RESOLVE_TEMPFAIL; return 0; } if (out->count == 0) { __resolve_error = RESOLVE_NOTFOUND; return 0; } return 1; } /** Call a dns_* function using \c dns_qualify and save an error code if necessary. */ int resolve_qualdns(int (*dnsfn)(struct dns_transmit*, struct dns_result* out, const char*), struct dns_result* out, const char* name) { str fqdn = {0}; int r = dns_qualify(out, &fqdn, name, dnsfn); str_free(&fqdn); if (r < 0) { __resolve_error = RESOLVE_TEMPFAIL; return 0; } if (out->count == 0) { __resolve_error = RESOLVE_NOTFOUND; return 0; } return 1; } bglibs-2.04/net/bindu.c0000664000076400007640000000243313244040127014300 0ustar bruceguenter/* net/bind4.c - Bind a UNIX domain address to a socket * Copyright (C) 2001,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include #include "socket.h" /** Bind a UNIX domain address (path) to a socket. */ int socket_bindu(int sock, const char* path) { struct sockaddr_un sa; sa.sun_family = AF_UNIX; strcpy(sa.sun_path, path); if (unlink(path) && errno != ENOENT) return 0; return bind(sock, (struct sockaddr*)&sa, sizeof sa) == 0; } bglibs-2.04/net/recv6.c0000664000076400007640000000270013244040127014221 0ustar bruceguenter/* net/recv6.c - Receive a datagram from a UDP socket * Copyright (C) 2004,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "sysdeps.h" #include #include #include #include #include #include "socket.h" /** Receive a datagram from an IPv6 UDP socket. */ int socket_recv6(int sock, char* buffer, unsigned buflen, ipv6addr* ip, ipv6port* port) { #if HASIPV6 struct sockaddr_in6 sa; socklen_t dummy = sizeof sa; int r; r = recvfrom(sock, buffer, buflen, 0, (struct sockaddr*)&sa, &dummy); if (r != -1) { memcpy(&ip->addr, &sa.sin6_addr, 16); *port = ntohs(sa.sin6_port); } return r; #else errno = EPROTONOSUPPORT; return -1; #endif } bglibs-2.04/net/dns_rotate.c0000664000076400007640000000163313244040127015342 0ustar bruceguenter#include #include "dns.h" /** Rotate (shuffle) a block of fixed-length addresses. \param s The array of memory to shuffle. \param n The number of elements of the array. \param shift The size of each element, expressed as a power-of-two */ void dns_rotate(unsigned char *s, unsigned int n, unsigned int shift) { unsigned int i; unsigned int stride = 1 << shift; unsigned char tmp[stride]; while (n > 1) { i = dns_random(n); --n; memcpy(tmp, s + (i << shift), stride); memcpy(s + (i << shift), s + (n << shift), stride); memcpy(s + (n << shift), tmp, stride); } } /** Rotate (shuffle) a block of IPv4 addresses. */ void dns_rotateipv4(ipv4addr* addrs, unsigned int n) { dns_rotate((unsigned char*)addrs, n, 2); } /** Rotate (shuffle) a block of IPv6 addresses. */ void dns_rotateipv6(ipv6addr* addrs, unsigned int n) { dns_rotate((unsigned char*)addrs, n, 4); } bglibs-2.04/net/recvfd.c0000664000076400007640000000307313244040127014451 0ustar bruceguenter/* net/recvfd.c - Receive a file descriptor over a socket * Copyright (C) 2002,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include "cmsg.h" #include "socket.h" /** Receive a file descriptor over a socket. */ int socket_recvfd(int sock) { #if defined(CMSG_FIRSTHDR) && defined(MSG_NOSIGNAL) && defined(SCM_RIGHTS) char cbuf[CMSG_SPACE(sizeof(int))]; struct msghdr msg; struct cmsghdr* cm; int fd; memset(&msg, 0, sizeof msg); msg.msg_control = cbuf; msg.msg_controllen = sizeof cbuf; cm = CMSG_FIRSTHDR(&msg); cm->cmsg_len = CMSG_LEN(sizeof(int)); cm->cmsg_level = SOL_SOCKET; cm->cmsg_type = SCM_RIGHTS; if (recvmsg(sock, &msg, MSG_NOSIGNAL) == -1) return -1; memcpy(&fd, CMSG_DATA(cm), sizeof fd); return fd; #else errno = ENOSYS; return -1; #endif } bglibs-2.04/net/sendu.c0000664000076400007640000000214013244040127014310 0ustar bruceguenter/* net/sendu.c - Send a datagram on a UNIX domain socket * Copyright (C) 2001,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include "socket.h" /** Send a datagram on a UNIX domain socket. */ int socket_sendu(int sock, const char* buffer, unsigned buflen) { return sendto(sock, buffer, buflen, 0, 0, 0); } bglibs-2.04/net/dns_resolvconfip.c0000664000076400007640000000563513244040127016563 0ustar bruceguenter#include #include #include "ibuf.h" #include "misc.h" #include "striter.h" #include "dns.h" static str data = {0}; extern ipv4port dns_use_port; /** Read the \c /etc/resolv.conf file. If \c $DNSRESOLVCONF is set, it names a file to read instead of \c /etc/resolv.conf . */ int dns_read_resolvconf(str *out) { const char *x; x = getenv("DNSRESOLVCONF"); if (!x) x = "/etc/resolv.conf"; return ibuf_openreadclose(x, out); } static int init(ipv4addr ip[DNS_MAX_IPS]) { int i; striter j; int iplen = 0; const char *x; x = getenv("DNSCACHEPORT"); if (x && *x) { ipv4port p = strtou(x, &x); if (*x) dns_use_port = p; } x = getenv("DNSCACHEIP"); if (x) while (iplen <= 15) { if (*x == ',') ++x; else { x = ipv4_scan(x,ip + iplen); if (!x) break; iplen++; } } if (!iplen) { i = dns_read_resolvconf(&data); if (i == -1) return -1; if (i) { if (!str_catc(&data,'\n')) return -1; striter_loop(&j, &data, '\n') { if (memcmp("nameserver ", j.startptr, 11) == 0 || memcmp("nameserver\t", j.startptr, 11) == 0) { for (i = j.start + 10; data.s[i] == ' ' || data.s[i] == '\t'; ++i) ; if (iplen <= 15) if (ipv4_scan(data.s + i,ip + iplen)) { if (memcmp(ip + iplen,"\0\0\0\0",4) == 0) memcpy(ip + iplen,"\177\0\0\1",4); iplen++; } } } } } if (!iplen) { memcpy(ip,"\177\0\0\1",4); iplen = 4; } memset(ip + iplen,0,64 - iplen); return 0; } static int ok = 0; static unsigned int uses; static struct timeval deadline; static ipv4addr ip[DNS_MAX_IPS]; /* defined if ok */ /** Parse \c /etc/resolv.conf for a list of nameserver IPs. */ int dns_resolvconfip(ipv4addr s[DNS_MAX_IPS]) { struct timeval now; gettimeofday(&now,0); if (TV_LESS(&deadline,&now)) ok = 0; if (!uses) ok = 0; if (!ok) { if (init(ip) == -1) return -1; deadline = now; deadline.tv_sec += 600; uses = 10000; ok = 1; } --uses; memcpy(s,ip,64); return 0; } #ifdef SELFTEST_MAIN MAIN { ipv4addr ips[DNS_MAX_IPS]; int i; str rcfile = {0}; makefile(&rcfile, "nameserver 1.2.3.4\nnameserver\t 2.3.4.5\nnameserver \t3.4.5.6"); debugfn(setenv("DNSRESOLVCONF", rcfile.s, 1)); debugfn(dns_resolvconfip(ips)); for (i = 0; i < DNS_MAX_IPS; ++i) { obuf_puts(&outbuf, ipv4_format(&ips[i])); NL(); } uses = 0; debugfn(setenv("DNSCACHEIP", "192.168.1.2,192.168.1.3", 1)); debugfn(dns_resolvconfip(ips)); for (i = 0; i < DNS_MAX_IPS; ++i) { obuf_puts(&outbuf, ipv4_format(&ips[i])); NL(); } unlink(rcfile.s); } #endif #ifdef SELFTEST_EXP result=0 result=0 1.2.3.4 2.3.4.5 3.4.5.6 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 result=0 result=0 192.168.1.2 192.168.1.3 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 0.0.0.0 #endif bglibs-2.04/net/connectu_timeout.c0000664000076400007640000000313213244040127016560 0ustar bruceguenter/* net/connectu_timeout.c - Make an UNIX domain connection with a timeout * Copyright (C) 2004,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "sysdeps.h" #include #include "socket.h" #include "unix.h" /** Connect a socket to an UNIX domain address, honouring a timeout. * * \note The socket will have nonblocking mode turned on on return from * this function. */ int socket_connectu_timeout(int sock, const char* path, int timeout) { iopoll_fd pf; if (!nonblock_on(sock)) return 0; if (socket_connectu(sock, path)) return 1; if (errno != EINPROGRESS && errno != EWOULDBLOCK) return 0; pf.fd = sock; pf.events = IOPOLL_WRITE; switch (iopoll_restart(&pf, 1, timeout)) { case 0: errno = ETIMEDOUT; return 0; case 1: if (socket_connected(sock)) return 1; /* No break, fall through */ default: return 0; } } bglibs-2.04/net/connect4_timeout.c0000664000076400007640000000315013244040127016457 0ustar bruceguenter/* net/connect4_timeout.c - Make an IPv4 connection with a timeout * Copyright (C) 2004,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "sysdeps.h" #include #include "socket.h" #include "unix.h" /** Connect a socket to an IPv4 address, honouring a timeout. * * \note The socket will have nonblocking mode turned on on return from * this function. */ int socket_connect4_timeout(int sock, const ipv4addr* ip, ipv4port port, int timeout) { iopoll_fd pf; if (!nonblock_on(sock)) return 0; if (socket_connect4(sock, ip, port)) return 1; if (errno != EINPROGRESS && errno != EWOULDBLOCK) return 0; pf.fd = sock; pf.events = IOPOLL_WRITE; switch (iopoll_restart(&pf, 1, timeout)) { case 0: errno = ETIMEDOUT; return 0; case 1: if (socket_connected(sock)) return 1; /* No break, fall through */ default: return 0; } } bglibs-2.04/net/cmsg.h0000664000076400007640000000103213244040127014127 0ustar bruceguenter#ifndef BGLIBS__NET__CMSG__H__ #define BGLIBS__NET__CMSG__H__ #ifdef SOLARIS #define _XOPEN_SOURCE 500 #endif #include #ifndef MSG_NOSIGNAL #define MSG_NOSIGNAL 0 #endif #ifndef CMSG_ALIGN #define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \ & (size_t) ~(sizeof (size_t) - 1)) #endif #ifndef CMSG_SPACE #define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len)) #endif #ifndef CMSG_LEN #define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len)) #endif #endif bglibs-2.04/net/cork.c0000664000076400007640000000346113244040127014137 0ustar bruceguenter/* net/cork.c - Stop a TCP socket from sending short writes. * Copyright (C) 2001,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include "socket.h" /** Stop a TCP socket from sending short writes. Several UNIX OS's have a facility which can prevent packets from being sent across the wire until they are completely full, even if short writes are sent to the socket that would normally result in output packets. This routine attempts to enable that facility to optimize throughput for bulk data transfers. It is known to work on Linux (with the \c TCP_CORK option) and to at least compile on BSD (with the \c TCP_NOPUSH option). On OS's which lack either of these two options, this function is essentially a no-op. */ int socket_cork(int sock) { #if defined(TCP_CORK) int flag = 1; return setsockopt(sock, SOL_TCP, TCP_CORK, &flag, sizeof flag) == 0; #elif defined(TCP_NOPUSH) int flag = 1; return setsockopt(sock, SOL_SOCKET, TCP_NOPUSH, &flag, sizeof flag) == 0; #else return 1; #endif } bglibs-2.04/net/dns_name_packet.c0000664000076400007640000000157613244040127016321 0ustar bruceguenter#include #include "dns.h" static int sizeit(const char* buf, unsigned int len, unsigned int pos, uint16 datalen) { char* q = 0; if (!dns_packet_getname(buf,len,pos,&q)) return -1; len = fmt_dns_domain(0, q); free(q); return len + 1; (void)datalen; } static int getit(struct dns_result* out, unsigned int i, unsigned int offset, const char* buf, unsigned int len, unsigned int pos, uint16 datalen) { char* q = 0; char** name = &out->rr.name[i]; if (!dns_packet_getname(buf,len,pos,&q)) return -1; *name = out->__buffer + offset; len = fmt_dns_domain(*name, q); (*name)[len] = 0; free(q); return len + 1; (void)datalen; } /** Extract name (PTR) records from a DNS response packet. */ int dns_name_packet(struct dns_result* out, const char* buf, unsigned int len) { return dns_packet_extract(out, buf, len, DNS_T_PTR, DNS_C_IN, sizeit, getit); } bglibs-2.04/net/dns_domain.c0000664000076400007640000000303113244040127015305 0ustar bruceguenter#include #include #include #include "dns.h" /** Return the length of an encoded domain name. */ unsigned int dns_domain_length(const char *dn) { const char *x; unsigned char c; x = dn; while ((c = *x++) != 0) x += (unsigned int) c; return x - dn; } /** Free a pointer to a domain name. */ void dns_domain_free(char **out) { if (*out) { free(*out); *out = 0; } } /** Copy an encoded domain name to a new pointer. */ int dns_domain_copy(char **out,const char *in) { unsigned int len; char *x; len = dns_domain_length(in); x = malloc(len); if (!x) return 0; memcpy(x,in,len); if (*out) free(*out); *out = x; return 1; } /** Compare two domain names for equality. */ int dns_domain_equal(const char *dn1,const char *dn2) { unsigned int len; len = dns_domain_length(dn1); if (len != dns_domain_length(dn2)) return 0; if (strncasecmp(dn1,dn2,len)) return 0; /* safe since 63 < 'A' */ return 1; } /** Test if the domain name \p big ends with \p little. */ int dns_domain_suffix(const char *big,const char *little) { unsigned char c; for (;;) { if (dns_domain_equal(big,little)) return 1; c = *big++; if (!c) return 0; big += c; } } /** Determine the location of the suffix \c little within \c big . */ unsigned int dns_domain_suffixpos(const char *big,const char *little) { const char *orig = big; unsigned char c; for (;;) { if (dns_domain_equal(big,little)) return big - orig; c = *big++; if (!c) return 0; big += c; } } bglibs-2.04/net/send6.c0000664000076400007640000000266613244040127014226 0ustar bruceguenter/* net/send6.c - Send a datagram on a UDP socket * Copyright (C) 2004,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "sysdeps.h" #include #include #include #include #include #include "socket.h" /** Send a datagram on an IPv6 UDP socket. */ int socket_send6(int sock, const char* buffer, unsigned buflen, const ipv6addr* ip, ipv6port port) { #if HASIPV6 struct sockaddr_in6 sa; memset(&sa, 0, sizeof sa); sa.sin6_family = AF_INET6; memcpy((char*)&sa.sin6_addr, &ip->addr, 16); sa.sin6_port = htons(port); return sendto(sock, buffer, buflen, 0, (struct sockaddr*)&sa, sizeof sa); #else errno = EPROTONOSUPPORT; return 0; #endif } bglibs-2.04/net/tcp4.c0000664000076400007640000000261413244040127014052 0ustar bruceguenter/* net/tcp4 - Create an IPv4 TCP socket * Copyright (C) 2004,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include "socket.h" /** Create a TCP/IPv4 socket. */ int socket_tcp4(void) { return socket(AF_INET, SOCK_STREAM, 0); } /** Create a TCP/IP socket. */ int socket_tcp(void) { return socket_tcp4(); } #ifdef SELFTEST_MAIN #include MAIN { int fd; struct stat st; debugsys((fd = socket_tcp4()) >= 0); debugsys(fstat(fd, &st)); debugfn((st.st_mode & S_IFMT) == S_IFSOCK); } #endif #ifdef SELFTEST_EXP result=1 result=0 result=1 #endif bglibs-2.04/net/unixdgm.c0000664000076400007640000000212613244040127014651 0ustar bruceguenter/* net/unixdgm.c - Create UNIX domain datagram socket * Copyright (C) 2001,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include "socket.h" /** Create UNIX domain datagram socket. */ int socket_unixdgm(void) { return socket(AF_UNIX, SOCK_DGRAM, 0); } bglibs-2.04/net/getaddr4.c0000664000076400007640000000260013244040127014671 0ustar bruceguenter/* net/getaddr4.c - Determine the IPv4 address of a socket * Copyright (C) 2001,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include "socket.h" /** Determine the IPv4 address of a socket. */ int socket_getaddr4(int sock, ipv4addr* addr, ipv4port* port) { struct sockaddr_in sa; socklen_t size; size = sizeof sa; if (getsockname(sock, (struct sockaddr*)&sa, &size) == -1) return 0; if (sa.sin_family != AF_INET) return 0; if (size != sizeof sa) return 0; memcpy(&addr->addr, &sa.sin_addr, 4); *port = ntohs(sa.sin_port); return 1; } bglibs-2.04/net/ipv4_addr.c0000664000076400007640000000044213244040127015051 0ustar bruceguenter#include "ipv4.h" /** IPv4 "any" address constant. */ const ipv4addr IPV4ADDR_ANY = {{ 0,0,0,0 }}; /** IPv4 broadcast address constant. */ const ipv4addr IPV4ADDR_BROADCAST = {{ 255,255,255,255 }}; /** IPv4 loopback address constant. */ const ipv4addr IPV4ADDR_LOOPBACK = {{ 127,0,0,1 }}; bglibs-2.04/net/dns_packet.c0000664000076400007640000001030613244040127015310 0ustar bruceguenter/* DNS should have used LZ77 instead of its own sophomoric compression algorithm. */ #include #include "dns.h" /** Copy a block of data out of a packet. \returns the offset of the next byte of data, or \c 0 if the packet was too short. */ unsigned int dns_packet_copy(const char *buf,unsigned int len,unsigned int pos,unsigned char *out,unsigned int outlen) { while (outlen) { if (pos >= len) { errno = EPROTO; return 0; } *out = buf[pos++]; ++out; --outlen; } return pos; } /** Skip over a domain name within a packet. */ unsigned int dns_packet_skipname(const char *buf,unsigned int len,unsigned int pos) { unsigned char ch; for (;;) { if (pos >= len) break; ch = buf[pos++]; if (ch >= 192) return pos + 1; if (ch >= 64) break; if (!ch) return pos; pos += ch; } errno = EPROTO; return 0; } /** Extract a domain name out of a packet, handling name compression. */ unsigned int dns_packet_getname(const char *buf,unsigned int len,unsigned int pos,char **d) { unsigned int loop = 0; unsigned int state = 0; unsigned int firstcompress = 0; unsigned int where; unsigned char ch; char name[255]; unsigned int namelen = 0; for (;;) { if (pos >= len) goto PROTO; ch = buf[pos++]; if (++loop >= 1000) goto PROTO; if (state) { if (namelen + 1 > sizeof name) goto PROTO; name[namelen++] = ch; --state; } else { while (ch >= 192) { where = ch; where -= 192; where <<= 8; if (pos >= len) goto PROTO; ch = buf[pos++]; if (!firstcompress) firstcompress = pos; pos = where + ch; if (pos >= len) goto PROTO; ch = buf[pos++]; if (++loop >= 1000) goto PROTO; } if (ch >= 64) goto PROTO; if (namelen + 1 > sizeof name) goto PROTO; name[namelen++] = ch; if (!ch) break; state = ch; } } if (!dns_domain_copy(d,name)) return 0; if (firstcompress) return firstcompress; return pos; PROTO: errno = EPROTO; return 0; } /** Extract a series of records from a packet. \param out The result buffer into which to put the output. \param buf The packet buffer to parse. \param len The length of \c buf . \param rrtype The resource record type, one of \c DNS_T_*. \param rrclass The resource record class, one of \c DNS_C_*. \param sizefn The function to call to determine the required buffer size for each record. \param copy The function to call to copy each record into the result. */ int dns_packet_extract(struct dns_result* out, const char* buf, unsigned int len, uint16 rrtype, uint16 rrclass, int (*sizefn)(const char* buf, unsigned int len, unsigned int pos, uint16 datalen), int (*copy)(struct dns_result* out, unsigned int index, unsigned int offset, const char* buf, unsigned int len, unsigned int pos, uint16 datalen)) { unsigned int pos; unsigned int start; unsigned char header[12]; uint16 numanswers; uint16 datalen; unsigned int i; unsigned int size; int r; pos = dns_packet_copy(buf,len,0,header,12); if (!pos) return -1; numanswers = uint16_get_msb(header + 6); pos = dns_packet_skipname(buf,len,pos); if (!pos) return -1; start = pos += 4; /* Count the number of records */ for (i = size = 0; numanswers > 0; pos += datalen, --numanswers) { pos = dns_packet_skipname(buf,len,pos); if (!pos) return -1; pos = dns_packet_copy(buf,len,pos,header,10); if (!pos) return -1; datalen = uint16_get_msb(header + 8); if (uint16_get_msb(header) == rrtype && uint16_get_msb(header + 2) == rrclass) { if (sizefn) { if ((r = sizefn(buf, len, pos, datalen)) < 0) { errno = EPROTO; return -1; } size += r; } ++i; } } if (dns_result_alloc(out, rrtype, i, size) < 0) return -1; /* Copy the records into out */ pos = start; numanswers = i; for (i = size = 0; i < numanswers; pos += datalen) { pos = dns_packet_skipname(buf,len,pos); if (!pos) return -1; pos = dns_packet_copy(buf,len,pos,header,10); if (!pos) return -1; datalen = uint16_get_msb(header + 8); if (uint16_get_msb(header) == rrtype && uint16_get_msb(header + 2) == rrclass) { if ((r = copy(out, i, size, buf, len, pos, datalen)) < 0) return -1; size += r; ++i; } } return 0; } bglibs-2.04/crypto/0000755000076400007640000000000013244040127013561 5ustar bruceguenterbglibs-2.04/crypto/surfrand.c0000664000076400007640000001206013244040127015552 0ustar bruceguenter/* surfrand.c - Random number generator based on SURF * Copyright (C) 2008 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include "surfrand.h" static void generate(struct surfrand* c) { surf(c->generated, c->counter, c->seed); if (!++c->counter[0]) if (!++c->counter[1]) if (!++c->counter[2]) if (!++c->counter[3]) if (!++c->counter[4]) if (!++c->counter[5]) if (!++c->counter[6]) if (!++c->counter[7]) if (!++c->counter[8]) if (!++c->counter[9]) if (!++c->counter[10]) ++c->counter[11]; c->left = SURF_OUT_U32; } /** Initialize the \c surfrand structure. * * Initializes the seed in \c c from the input \c data, and sets the * counter to zero. If more than \c SURF_SEED_U32 bytes of input data * is given, the extra data is merged into the seed. If less, the given * data is repeated until the seed is filled. * * The counter is treated as a giant multi-word integer, and is * incremented once each time data is generated. This makes the * theoretical period of this generator 8*2^32^12 or >10^116. */ void surfrand_init(struct surfrand* c, const uint32* data, unsigned words) { uint32* ptr; unsigned i; /* If there are more bytes to use than the size of the seed, * add bytes together where they overlap. */ if (words > SURF_SEED_U32) { memcpy(c->seed, data, sizeof c->seed); data += SURF_SEED_U32; words -= SURF_SEED_U32; while (words > 0) { for (i = 0, ptr = c->seed; words > 0 && i < SURF_SEED_U32; ++i, --words) *ptr++ += *data++; } } /* Otherwise, repeat the given bytes until the seed is filled. */ else { for (i = 0, ptr = c->seed; i + words < SURF_SEED_U32; i += words, ptr += words) memcpy(ptr, data, words * 4); memcpy(ptr, data, sizeof c->seed - i * 4); } memset(c->counter, 0, sizeof c->counter); c->left = 0; } /** Output an random unsigned 32-bit integer. * * All the bits in the output integer are equally random. */ uint32 surfrand_uint32(struct surfrand* c) { if (c->left == 0) generate(c); return c->generated[--c->left]; } /** Output a random double precision floating-point number in the range 0-1. * * This routine uses two calls to surfrand_uint32 to fill all the * precision of a double precision floating-point with randomness. */ double surfrand_double(struct surfrand* c) { const uint32 u1 = surfrand_uint32(c); const uint32 u2 = surfrand_uint32(c); return u1 * (1.0/4294967296.0) + u2 * (1.0/4294967296.0/4294967296.0); } /** Fill the buffer with random data */ void surfrand_fill(struct surfrand* c, unsigned char* buf, unsigned len) { uint32 u; while (len >= 4) { u = surfrand_uint32(c); memcpy(buf, &u, 4); len -= 4; buf += 4; } if (len > 0) { u = surfrand_uint32(c); memcpy(buf, &u, len); } } /** Generate a uniformly distributed random number less than \c bound. The result is masked against bias by regenerating the result if it would cause bias. */ uint32 surfrand_uniform(struct surfrand* c, uint32 bound) { uint32 num; /* 2**BITS % x == (2**BITS - x) % x == -x % x */ uint32 min = - bound % bound; /* Avoid bias by keeping generating random numbers until one is within * [min..UINT32_MAX]. This could theoretically loop forever, but it * has a worst-case probability of 0.5 of success on each iteration, * so it should rarely need more than one iteration. */ do { num = surfrand_uint32(c); } while (num < min); return num % bound; } #ifdef SELFTEST_MAIN static void dumpn(struct surfrand* c, unsigned count) { while (count-- > 0) { obuf_putc(&outbuf, ' '); obuf_putxw(&outbuf, surfrand_uint32(c), 8, '0'); } NL(); } MAIN { uint32 seed[37] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,32,32,32,32,32 }; struct surfrand c; surfrand_init(&c, seed, 32); dumpn(&c, 8); dumpn(&c, 8); dumpn(&c, 8); surfrand_init(&c, seed, 1); dumpn(&c, 8); surfrand_init(&c, seed, 37); dumpn(&c, 8); } #endif #ifdef SELFTEST_EXP 15cd5f15 4a2d6392 d0e3b9ab 8a78e27f fee73aaf 23eada9c ea6787e8 4da5cfc1 695a7033 6f1da938 8e79aa53 80a7702e 94ccda9c 3194c1e5 c47585b0 eb027430 447861ef b9be75e2 9dae96f1 150c83eb 98575e80 0a2ba02b a60dbc9a 33dad740 1f1279e3 94216ab1 46cdc023 73a7f7c1 ed0e718e 5c705fc5 b32525a0 269087b5 07506597 514e2c77 a705e0b5 9f7a7b8e 7a64359d 589f20c0 46a46fc1 1f646f55 #endif bglibs-2.04/crypto/hmac-sha384.c0000664000076400007640000000407713244040127015657 0ustar bruceguenter #include #include "sysdeps.h" #include "hmac.h" #include "sha384.h" struct midstate { uint64 H[8]; }; static void extract(const void* statep, void* midstatep) { const SHA384_ctx* ctx = statep; struct midstate* mid = midstatep; memcpy(mid->H, ctx->H, 8 * sizeof(mid->H[0])); } static void inject(void* statep, const void* midstatep) { SHA384_ctx* ctx = statep; const struct midstate* mid = midstatep; memcpy(ctx->H, mid->H, 8 * sizeof(mid->H[0])); ctx->bytes = 128; } const struct hmac_control_block hmac_sha384 = { .state_size = sizeof(SHA384_ctx), .block_size = 128, .digest_size = SHA384_DIGEST_LENGTH, .midstate_size = sizeof(struct midstate), .init = (hmac_init_fn)SHA384_init, .update = (hmac_update_fn)SHA384_update, .finalize = (hmac_finalize_fn)SHA384_final, .extract = extract, .inject = inject, }; #ifdef SELFTEST_MAIN #include "obuf.h" #include "str.h" static void test_hmac(const char* key, const char* data) { const str key_str = { (char*)key, strlen(key), 0 }; const str data_str = { (char*)data, strlen(data), 0 }; unsigned char digest[SHA384_DIGEST_LENGTH]; unsigned i; hmac(&hmac_sha384, &key_str, &data_str, digest); for (i = 0; i < sizeof digest; ++i) obuf_putxw(&outbuf, digest[i], 2, '0'); obuf_endl(&outbuf); } MAIN { test_hmac("\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", "Hi There"); test_hmac("Jefe", "what do ya want for nothing?"); test_hmac("\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"); } #endif #ifdef SELFTEST_EXP 7afaa633e20d379b02395915fbc385ff8dc27dcd3885e1068ab942eeab52ec1f20ad382a92370d8b2e0ac8b83c4d53bf af45d2e376484031617f78d2b58a6b1b9c7ef464f5a01b47e42ec3736322445e8e2240ca5e69e2c78b3239ecfab21649 1383e82e28286b91f4cc7afbd13d5b5c6f887c05e7c4542484043a37a5fe45802a9470fb663bd7b6570fe2f503fc92f5 #endif bglibs-2.04/crypto/surf.c0000664000076400007640000000731313244040127014712 0ustar bruceguenter/* surf.c - Simple Unpredictable Random Function * Copyright (C) 2004,2005,2008 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * This implementation of SURF is derived directly from the description * given in http://cr.yp.to/papers/surf.ps */ #include "surf.h" #define ROTATE(x,b) (((x) << (b)) | ((x) >> (32 - (b)))) #define h(N,R) (((tmp ^ seed[N]) + a) ^ ROTATE(tmp,R)) /** Simple Unpredictable Random Function * * This function converts a 384-bit input into a 256-bit output, given a * 1024-bit seed k. When k is secret and uniformly selected, surf(k) * seems to be indistinguishable from a uniformly selected * 384-bit-to-256-bit function. * * See http://cr.yp.to/papers/surf.ps This implementation was derived * from this paper and from dns_random.c from djbdns-1.05, which was * made public domain as per http://cr.yp.to/distributors.html on * 2007-12-28. */ void surf(uint32 out[8], const uint32 in[12], const uint32 seed[32]) { uint32 x[12]; uint32 a; int i; int round; int loop; uint32 tmp; for (i = 0; i < 12; ++i) x[i] = in[i] ^ seed[i + 12]; for (i = 0; i < 8; ++i) out[i] = seed[i + 24]; a = 0; tmp = x[11]; for (loop = 0; loop < 2; ++loop) { for (round = 0; round < 16; ++round) { a += 2654435769UL; tmp = x[0] += h(0, 5); tmp = x[1] += h(1, 7); tmp = x[2] += h(2, 9); tmp = x[3] += h(3, 13); tmp = x[4] += h(4, 5); tmp = x[5] += h(5, 7); tmp = x[6] += h(6, 9); tmp = x[7] += h(7, 13); tmp = x[8] += h(8, 5); tmp = x[9] += h(9, 7); tmp = x[10] += h(10, 9); tmp = x[11] += h(11, 13); } for (i = 0; i < 8; ++i) out[i] ^= x[i + 4]; } } #ifdef SELFTEST_MAIN static void test(const uint32 s[32], const uint32 in[32]) { uint32 out[8]; int i; surf(out, in, s); for (i = 0; i < 8; ++i) obuf_putxw(&outbuf, out[i], 8, '0'); obuf_endl(&outbuf); } MAIN { const uint32 seed1[32] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 }; const uint32 in1[12] = { 0,1,2,3,4,5,6,7,8,9,10,11 }; const uint32 seed2[32] = { 965136454,479746425,372049829,788671599,207587135,82471478,337251274,593999156,890750140,208600969,839033205,548121119,948159788,21235830,70012315,259282220,38295658,134832975,612987741,415570019,815194940,765000498,981134726,331506518,401576148,818681223,982505486,728455333,1054946385,70995844,507840924,1012835195 }; const uint32 in2[12] = { 298244669,133876651,331758846,714669328,243927566,996052809,632023729,791929383,677656487,649629687,448549470,506001552 }; test(seed1, in1); test(seed2, in1); test(seed1, in2); test(seed2, in2); } #endif /* These values were generated using DJB's code directly. */ #ifdef SELFTEST_EXP c35ed4a7919860a94af6fa9767b18dfd1d58ff12f211e47df71b3fcf62709ad3 893a76356ca0dec34e58fcff18ffc540016d8bed7d668828e3f2a8a882266572 62e3659918b277d563bde36cbf53ce42209a1d8f57c3969c4fcd2fb13969779a 47a64ff75c94e3ad725cc2188196acd4c46eb59b58185a82f49fb92f25c598db #endif bglibs-2.04/crypto/sha384.c0000664000076400007640000000677513244040127014760 0ustar bruceguenter/* sha384.c - SHA-384 algorithm * Copyright (C) 2003,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * This code was derived from the official algorithm described in * http://csrc.nist.gov/cryptval/shs/sha256-384-512.pdf */ #include #include "sysdeps.h" #include "sha384.h" #include "uint64.h" #define min(X,Y) ((X)<(Y) ? (X) : (Y)) static const uint64 H0[8] = { 0xcbbb9d5dc1059ed8ULL, 0x629a292a367cd507ULL, 0x9159015a3070dd17ULL, 0x152fecd8f70e5939ULL, 0x67332667ffc00b31ULL, 0x8eb44a8768581511ULL, 0xdb0c2e0d64f98fa7ULL, 0x47b5481dbefa4fa4ULL }; void SHA384_init(SHA384_ctx* ctx) { memcpy(ctx->H, H0, sizeof H0); ctx->bytes = 0; } extern void SHA512_final_transform(SHA512_ctx* ctx); void SHA384_final(SHA384_ctx* ctx, uint8* digest) { unsigned i; SHA512_final_transform(ctx); for (i = 0; i < 6; ++i, digest += 8) uint64_pack_msb(ctx->H[i], digest); memset(ctx, 0, sizeof *ctx); } #ifdef SELFTEST_MAIN #include "obuf.h" static void test(const char* s) { SHA384_ctx ctx; unsigned i; unsigned char digest[SHA384_DIGEST_LENGTH]; SHA384_init(&ctx); SHA384_update(&ctx, s, strlen(s)); SHA384_final(&ctx, digest); for (i = 0; i < sizeof digest; ++i) obuf_putxw(&outbuf, digest[i], 2, '0'); obuf_endl(&outbuf); } MAIN { test("abc"); test("abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"); /* Additional test vectors found in * http://www.aarongifford.com/computers/sha.html */ test("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"); test(""); test("This is exactly 64 bytes long, not counting the terminating byte"); test("For this sample, this 63-byte string will be used as input data"); test("And this textual data, astonishing as it may appear, is exactly 128 bytes in length, as are both SHA-384 and SHA-512 block sizes"); test("By hashing data that is one byte less than a multiple of a hash block length (like this 127-byte string), bugs may be revealed."); } #endif #ifdef SELFTEST_EXP cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7 09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039 3391fdddfc8dc7393707a65b1b4709397cf8b1d162af05abfe8f450de5f36bc6b0455a8520bc4e6f5fe95b1fe3c8452b 38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b e28e35e25a1874908bf0958bb088b69f3d742a753c86993e9f4b1c4c21988f958bd1fe0315b195aca7b061213ac2a9bd 37b49ef3d08de53e9bd018b0630067bd43d09c427d06b05812f48531bce7d2a698ee2d1ed1ffed46fd4c3b9f38a8a557 e3e3602f4d90c935321d788f722071a8809f4f09366f2825cd85da97ccd2955eb6b8245974402aa64789ed45293e94ba 1ca650f38480fa9dfb5729636bec4a935ebc1cd4c0055ee50cad2aa627e066871044fd8e6fdb80edf10b85df15ba7aab #endif bglibs-2.04/crypto/md4.c0000664000076400007640000002306413244040127014420 0ustar bruceguenter/* md4.c - Functions to compute MD4 message digest according to the definition of MD4 in RFC 1320 from April 1992. Copyright (C) 2000,2003,2005 Bruce Guenter This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Based on the GNU C Library MD5 source code, Written by Ulrich Drepper , 1995. */ #include #include #include "sysdeps.h" #include "md4.h" #include "uint32.h" #ifdef ENDIAN_MSB # define SWAP(n) \ (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24)) #else # define SWAP(n) (n) #endif /* This array contains the bytes used to pad the buffer to the next 64-byte boundary. (RFC 1320, 3.1: Step 1) */ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; /* Initialize structure containing state of computation. (RFC 1320, 3.3: Step 3) */ void md4_init_ctx (ctx) struct md4_ctx *ctx; { ctx->A = 0x67452301; ctx->B = 0xefcdab89; ctx->C = 0x98badcfe; ctx->D = 0x10325476; ctx->total[0] = ctx->total[1] = 0; ctx->buflen = 0; } /* Put result from CTX in first 16 bytes following RESBUF. The result must be in little endian byte order. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ void * md4_read_ctx (ctx, resbuf) const struct md4_ctx *ctx; void *resbuf; { uint32_pack_lsb(ctx->A, resbuf); uint32_pack_lsb(ctx->B, resbuf + 4); uint32_pack_lsb(ctx->C, resbuf + 8); uint32_pack_lsb(ctx->D, resbuf + 12); return resbuf; } /* Process the remaining bytes in the internal buffer and the usual prolog according to the standard and write the result to RESBUF. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ void * md4_finish_ctx (ctx, resbuf) struct md4_ctx *ctx; void *resbuf; { /* Take yet unprocessed bytes into account. */ md4_uint32 bytes = ctx->buflen; md4_uint32 total0; md4_uint32 total1; /* Now count remaining bytes. */ ctx->total[0] += bytes; if (ctx->total[0] < bytes) ++ctx->total[1]; total0 = ctx->total[0]; total1 = ctx->total[1]; if (bytes >= 56) { memcpy(ctx->buffer+bytes, fillbuf, 64-bytes); md4_process_block(ctx->buffer, ctx); memcpy(ctx->buffer, fillbuf+8, 56); } else memcpy(ctx->buffer+bytes, fillbuf, 56-bytes); /* Put the 64-bit file length in *bits* at the end of the buffer. */ uint32_pack_lsb(total0 << 3, (unsigned char*)&ctx->buffer[56]); uint32_pack_lsb((total1 << 3) | (total0 >> 29), (unsigned char*)&ctx->buffer[60]); /* Process last bytes. */ md4_process_block (ctx->buffer, ctx); return md4_read_ctx (ctx, resbuf); } void md4_process_bytes (buffer, len, ctx) const void *buffer; size_t len; struct md4_ctx *ctx; { /* When we already have some bits in our internal buffer concatenate both inputs first. */ if (ctx->buflen != 0) { size_t left_over = ctx->buflen; size_t add = 64 - left_over; if (add > len) add = len; memcpy (&ctx->buffer[left_over], buffer, add); if (left_over + add == 64) md4_process_block (ctx->buffer, ctx); ctx->buflen += add; buffer = (const char *) buffer + add; len -= add; } /* Process available complete blocks. */ while (len > 64) { md4_process_block (buffer, ctx); buffer = (const char *) buffer + 64; len -= 64; } /* Move remaining bytes in internal buffer. */ if (len > 0) { memcpy (ctx->buffer, buffer, len); ctx->buflen = len; } } /* Compute MD4 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ void * md4_buffer (buffer, len, resblock) const char *buffer; size_t len; void *resblock; { struct md4_ctx ctx; /* Initialize the computation context. */ md4_init_ctx (&ctx); /* Process whole buffer but last len % 64 bytes. */ md4_process_bytes (buffer, len, &ctx); /* Put result in desired memory area. */ return md4_finish_ctx (&ctx, resblock); } /* These are the four functions used in the four steps of the MD4 algorithm and defined in the RFC 1320. The first function is a little bit optimized (as found in Colin Plumbs public domain MD5 implementation). */ /* #define FF(X,Y,Z) ((X & Y) | (~X & Z)) */ #define FF(X,Y,Z) (Z ^ (X & (Y ^ Z))) #define FG(X,Y,Z) ((X & Y) | (X & Z) | (Y & Z)) #define FH(X,Y,Z) (X ^ Y ^ Z) /* Process 64 bytes of BUFFER, accumulating context into CTX. */ void md4_process_block (buffer, ctx) const void *buffer; struct md4_ctx *ctx; { md4_uint32 correct_words[16]; const md4_uint32 *words = buffer; md4_uint32 A = ctx->A; md4_uint32 B = ctx->B; md4_uint32 C = ctx->C; md4_uint32 D = ctx->D; md4_uint32 *cwp = correct_words; /* First increment the byte count. RFC 1320 specifies the possible length of the file up to 2^64 bits. Here we only compute the number of bytes. Do a double word increment. */ ctx->total[0] += 64; if (ctx->total[0] < 64) ++ctx->total[1]; /* First round: using the given function, the context and a constant the next context is computed. Because the algorithms processing unit is a 32-bit word and it is determined to work on words in little endian byte order we perhaps have to change the byte order before the computation. To reduce the work for the next steps we store the swapped words in the array CORRECT_WORDS. */ #define OP(a, b, c, d, s) \ do \ { \ a += FF (b, c, d) + (*cwp++ = SWAP (*words)); \ ++words; \ CYCLIC (a, s); \ } \ while (0) /* It is unfortunate that C does not provide an operator for cyclic rotation. Hope the C compiler is smart enough. */ #define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s))) /* Round 1. */ OP(A,B,C,D, 3); OP(D,A,B,C, 7); OP(C,D,A,B,11); OP(B,C,D,A,19); OP(A,B,C,D, 3); OP(D,A,B,C, 7); OP(C,D,A,B,11); OP(B,C,D,A,19); OP(A,B,C,D, 3); OP(D,A,B,C, 7); OP(C,D,A,B,11); OP(B,C,D,A,19); OP(A,B,C,D, 3); OP(D,A,B,C, 7); OP(C,D,A,B,11); OP(B,C,D,A,19); /* For the second to fourth round we have the possibly swapped words in CORRECT_WORDS. Redefine the macro to take an additional first argument specifying the function to use. */ #undef OP #define OP(f, a, b, c, d, k, s, T) \ do \ { \ a += f (b, c, d) + correct_words[k] + T; \ CYCLIC (a, s); \ } \ while (0) /* Round 2. */ #define OP2(a,b,c,d,k,s) OP(FG,a,b,c,d,k,s,0x5A827999) OP2 (A, B, C, D, 0, 3); OP2 (D, A, B, C, 4, 5); OP2 (C, D, A, B, 8, 9); OP2 (B, C, D, A, 12, 13); OP2 (A, B, C, D, 1, 3); OP2 (D, A, B, C, 5, 5); OP2 (C, D, A, B, 9, 9); OP2 (B, C, D, A, 13, 13); OP2 (A, B, C, D, 2, 3); OP2 (D, A, B, C, 6, 5); OP2 (C, D, A, B, 10, 9); OP2 (B, C, D, A, 14, 13); OP2 (A, B, C, D, 3, 3); OP2 (D, A, B, C, 7, 5); OP2 (C, D, A, B, 11, 9); OP2 (B, C, D, A, 15, 13); /* Round 3. */ #define OP3(a,b,c,d,k,s) OP(FH,a,b,c,d,k,s,0x6ED9EBA1) OP3 (A, B, C, D, 0, 3); OP3 (D, A, B, C, 8, 9); OP3 (C, D, A, B, 4, 11); OP3 (B, C, D, A, 12, 15); OP3 (A, B, C, D, 2, 3); OP3 (D, A, B, C, 10, 9); OP3 (C, D, A, B, 6, 11); OP3 (B, C, D, A, 14, 15); OP3 (A, B, C, D, 1, 3); OP3 (D, A, B, C, 9, 9); OP3 (C, D, A, B, 5, 11); OP3 (B, C, D, A, 13, 15); OP3 (A, B, C, D, 3, 3); OP3 (D, A, B, C, 11, 9); OP3 (C, D, A, B, 7, 11); OP3 (B, C, D, A, 15, 15); /* Put checksum in context given as argument. */ ctx->A += A; ctx->B += B; ctx->C += C; ctx->D += D; } #ifdef SELFTEST_MAIN #include static void MDString(const char* s) { struct md4_ctx ctx; unsigned char digest[16]; unsigned int len = strlen(s); unsigned i; md4_init_ctx(&ctx); md4_process_bytes(s, len, &ctx); md4_finish_ctx(&ctx, digest); printf("MD4 (\"%s\") = ", s); for (i = 0; i < 16; i++) printf("%02x", digest[i]); printf("\n"); } MAIN { MDString(""); MDString("a"); MDString("abc"); MDString("message digest"); MDString("abcdefghijklmnopqrstuvwxyz"); MDString("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"); MDString("1234567890123456789012345678901234567890" "1234567890123456789012345678901234567890"); } #endif #ifdef SELFTEST_EXP MD4 ("") = 31d6cfe0d16ae931b73c59d7e0c089c0 MD4 ("a") = bde52cb31de33e46245e05fbdbd6fb24 MD4 ("abc") = a448017aaf21d8525fc10ae87aa6729d MD4 ("message digest") = d9130a8164549fe818874806e1c7014b MD4 ("abcdefghijklmnopqrstuvwxyz") = d79e1c308aa5bbcdeea8ed63df412da9 MD4 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = 043f8582f241db351ce627e153e7f0e4 MD4 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = e33b4ddc9c38f2199c3e7b164fcc0536 #endif bglibs-2.04/crypto/sha256.c0000664000076400007640000001466113244040127014747 0ustar bruceguenter/* sha256.c - SHA-256 algorithm * Copyright (C) 2003,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include "sha256.h" #include "uint32.h" #include "uint64.h" #define S(x,n) (((x)>>n) | ((x)<<(32-n))) #define R(x,n) ((x)>>n) /* This optimization was found in Colin Plumb's MD5 code. */ /* #define Ch(x,y,z) (((x)&(y)) ^ (~(x)&(z))) */ #define Ch(x,y,z) ((z) ^ ((x) & ((y) ^ (z)))) #define Maj(x,y,z) (((x)&(y)) ^ ((x)&(z)) ^ ((y)&(z))) #define S0(x) (S(x, 2) ^ S(x,13) ^ S(x,22)) #define S1(x) (S(x, 6) ^ S(x,11) ^ S(x,25)) #define s0(x) (S(x, 7) ^ S(x,18) ^ R(x, 3)) #define s1(x) (S(x,17) ^ S(x,19) ^ R(x,10)) #define F(a,b,c,d,e,f,g,h) \ T1 = h + S1(e) + Ch(e,f,g) + *Kp++ + *Wp++; \ T2 = S0(a) + Maj(a,b,c); \ d += T1; \ h = T1 + T2; \ static const uint32 K[64] = { 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, 0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, 0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL, 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, 0xc19bf174UL, 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL, 0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL, 0x983e5152UL, 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL, 0xc6e00bf3UL, 0xd5a79147UL, 0x06ca6351UL, 0x14292967UL, 0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL, 0x53380d13UL, 0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL, 0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL, 0xd192e819UL, 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL, 0x19a4c116UL, 0x1e376c08UL, 0x2748774cUL, 0x34b0bcb5UL, 0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL, 0x682e6ff3UL, 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL, 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL }; static const uint32 H0[8] = { 0x6a09e667UL, 0xbb67ae85UL, 0x3c6ef372UL, 0xa54ff53aUL, 0x510e527fUL, 0x9b05688cUL, 0x1f83d9abUL, 0x5be0cd19UL }; static void SHA256_transform(uint32* H, const uint8* M) { unsigned j; uint32 a = H[0]; uint32 b = H[1]; uint32 c = H[2]; uint32 d = H[3]; uint32 e = H[4]; uint32 f = H[5]; uint32 g = H[6]; uint32 h = H[7]; uint32 T1; uint32 T2; uint32 W[64]; uint32* Wp; const uint32* Kp; for (Wp = W, j = 0; j < 16; ++j, ++Wp, M += 4) *Wp = uint32_get_msb(M); for (j = 16; j < 64; ++j, ++Wp) *Wp = s1(Wp[-2]) + Wp[-7] + s0(Wp[-15]) + Wp[-16]; #ifdef SHA2_NO_UNROLL for (Wp = W, Kp = K, j = 0; j < 64; ++j) { /* Straight out of the standards document. */ T1 = h + S1(e) + Ch(e,f,g) + *Kp++ + *Wp++; T2 = S0(a) + Maj(a,b,c); h = g; g = f; f = e; e = d + T1; d = c; c = b; b = a; a = T1 + T2; } #else for (Wp = W, Kp = K, j = 0; j < 8; ++j) { /* Unrolled loop, eliminates most of the extraneous data copies. */ F(a,b,c,d,e,f,g,h); F(h,a,b,c,d,e,f,g); F(g,h,a,b,c,d,e,f); F(f,g,h,a,b,c,d,e); F(e,f,g,h,a,b,c,d); F(d,e,f,g,h,a,b,c); F(c,d,e,f,g,h,a,b); F(b,c,d,e,f,g,h,a); } #endif H[0] += a; H[1] += b; H[2] += c; H[3] += d; H[4] += e; H[5] += f; H[6] += g; H[7] += h; } void SHA256_init(SHA256_ctx* ctx) { memcpy(ctx->H, H0, sizeof H0); ctx->bytes = 0; } void SHA256_update(SHA256_ctx* ctx, const void* vdata, unsigned long data_len) { const uint8* data = vdata; unsigned long use; unsigned mlen = ctx->bytes % 64; ctx->bytes += data_len; if (mlen && data_len >= (use = 64 - mlen)) { memcpy(ctx->M + mlen, data, use); SHA256_transform(ctx->H, ctx->M); mlen = 0; data_len -= use; data += use; } while (data_len >= 64) { SHA256_transform(ctx->H, data); data_len -= 64; data += 64; } memcpy(ctx->M + mlen, data, data_len); } void SHA256_final(SHA256_ctx* ctx, uint8* digest) { unsigned i; unsigned mlen = ctx->bytes % 64; ctx->M[mlen++] = 0x80; memset(ctx->M + mlen, 0x00, 64 - mlen); if (mlen > 64-8) { SHA256_transform(ctx->H, ctx->M); memset(ctx->M, 0x00, 64-8); } uint64_pack_msb(ctx->bytes << 3, ctx->M+64-8); SHA256_transform(ctx->H, ctx->M); for (i = 0; i < 32/4; ++i, digest += 4) uint32_pack_msb(ctx->H[i], digest); memset(ctx, 0, sizeof *ctx); } #ifdef SELFTEST_MAIN #include "obuf.h" static void test(const char* s) { SHA256_ctx ctx; unsigned i; unsigned char digest[SHA256_DIGEST_LENGTH]; SHA256_init(&ctx); SHA256_update(&ctx, s, strlen(s)); SHA256_final(&ctx, digest); for (i = 0; i < sizeof digest; ++i) obuf_putxw(&outbuf, digest[i], 2, '0'); obuf_endl(&outbuf); } MAIN { test("abc"); test("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"); /* Additional test vectors found in * http://www.aarongifford.com/computers/sha.html */ test("abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"); test(""); test("This is exactly 64 bytes long, not counting the terminating byte"); test("For this sample, this 63-byte string will be used as input data"); test("And this textual data, astonishing as it may appear, is exactly 128 bytes in length, as are both SHA-384 and SHA-512 block sizes"); test("By hashing data that is one byte less than a multiple of a hash block length (like this 127-byte string), bugs may be revealed."); } #endif #ifdef SELFTEST_EXP ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad 248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1 cf5b16a778af8380036ce59e7b0492370b249b11e8f07a51afac45037afee9d1 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 ab64eff7e88e2e46165e29f2bce41826bd4c7b3552f6b382a9e7d3af47c245f8 f08a78cbbaee082b052ae0708f32fa1e50c5c421aa772ba5dbb406a2ea6be342 0ab803344830f92089494fb635ad00d76164ad6e57012b237722df0d7ad26896 e4326d0459653d7d3514674d713e74dc3df11ed4d30b4013fd327fdb9e394c26 #endif bglibs-2.04/crypto/md5.c0000664000076400007640000003311413244040127014416 0ustar bruceguenter/* md5.c - Functions to compute MD5 message digest of files or memory blocks according to the definition of MD5 in RFC 1321 from April 1992. Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Written by Ulrich Drepper , 1995. */ /* Self-tests added by Bruce Guenter , 2003. */ #include #include #include #include "sysdeps.h" #include "md5.h" #include "uint32.h" #ifdef ENDIAN_MSB # define SWAP(n) \ (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24)) #else # define SWAP(n) (n) #endif /* This array contains the bytes used to pad the buffer to the next 64-byte boundary. (RFC 1321, 3.1: Step 1) */ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; /* Initialize structure containing state of computation. (RFC 1321, 3.3: Step 3) */ void md5_init_ctx (ctx) struct md5_ctx *ctx; { ctx->A = 0x67452301; ctx->B = 0xefcdab89; ctx->C = 0x98badcfe; ctx->D = 0x10325476; ctx->total[0] = ctx->total[1] = 0; ctx->buflen = 0; } /* Put result from CTX in first 16 bytes following RESBUF. The result must be in little endian byte order. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ void * md5_read_ctx (ctx, resbuf) const struct md5_ctx *ctx; void *resbuf; { uint32_pack_lsb(ctx->A, resbuf); uint32_pack_lsb(ctx->B, resbuf + 4); uint32_pack_lsb(ctx->C, resbuf + 8); uint32_pack_lsb(ctx->D, resbuf + 12); return resbuf; } /* Process the remaining bytes in the internal buffer and the usual prolog according to the standard and write the result to RESBUF. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ void * md5_finish_ctx (ctx, resbuf) struct md5_ctx *ctx; void *resbuf; { /* Take yet unprocessed bytes into account. */ md5_uint32 bytes = ctx->buflen; size_t pad; /* Now count remaining bytes. */ ctx->total[0] += bytes; if (ctx->total[0] < bytes) ++ctx->total[1]; pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes; memcpy (&ctx->buffer[bytes], fillbuf, pad); /* Put the 64-bit file length in *bits* at the end of the buffer. */ uint32_pack_lsb(ctx->total[0] << 3, (unsigned char*)&ctx->buffer[bytes + pad]); uint32_pack_lsb((ctx->total[1] << 3) | (ctx->total[0] >> 29), (unsigned char*)&ctx->buffer[bytes + pad + 4]); /* Process last bytes. */ md5_process_block (ctx->buffer, bytes + pad + 8, ctx); return md5_read_ctx (ctx, resbuf); } /* Compute MD5 message digest for bytes read from STREAM. The resulting message digest number will be written into the 16 bytes beginning at RESBLOCK. */ int md5_stream (stream, resblock) FILE *stream; void *resblock; { /* Important: BLOCKSIZE must be a multiple of 64. */ #define BLOCKSIZE 4096 struct md5_ctx ctx; char buffer[BLOCKSIZE + 72]; size_t sum; /* Initialize the computation context. */ md5_init_ctx (&ctx); /* Iterate over full file contents. */ while (1) { /* We read the file in blocks of BLOCKSIZE bytes. One call of the computation function processes the whole buffer so that with the next round of the loop another block can be read. */ size_t n; sum = 0; /* Read block. Take care for partial reads. */ do { n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); sum += n; } while (sum < BLOCKSIZE && n != 0); if (n == 0 && ferror (stream)) return 1; /* If end of file is reached, end the loop. */ if (n == 0) break; /* Process buffer with BLOCKSIZE bytes. Note that BLOCKSIZE % 64 == 0 */ md5_process_block (buffer, BLOCKSIZE, &ctx); } /* Add the last bytes if necessary. */ if (sum > 0) md5_process_bytes (buffer, sum, &ctx); /* Construct result in desired memory. */ md5_finish_ctx (&ctx, resblock); return 0; } /* Compute MD5 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ void * md5_buffer (buffer, len, resblock) const char *buffer; size_t len; void *resblock; { struct md5_ctx ctx; /* Initialize the computation context. */ md5_init_ctx (&ctx); /* Process whole buffer but last len % 64 bytes. */ md5_process_bytes (buffer, len, &ctx); /* Put result in desired memory area. */ return md5_finish_ctx (&ctx, resblock); } void md5_process_bytes (buffer, len, ctx) const void *buffer; size_t len; struct md5_ctx *ctx; { /* When we already have some bits in our internal buffer concatenate both inputs first. */ if (ctx->buflen != 0) { size_t left_over = ctx->buflen; size_t add = 128 - left_over > len ? len : 128 - left_over; memcpy (&ctx->buffer[left_over], buffer, add); ctx->buflen += add; if (left_over + add > 64) { md5_process_block (ctx->buffer, (left_over + add) & ~63, ctx); /* The regions in the following copy operation cannot overlap. */ memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63], (left_over + add) & 63); ctx->buflen = (left_over + add) & 63; } buffer = (const char *) buffer + add; len -= add; } /* Process available complete blocks. */ if (len >= 64) { md5_process_block (buffer, len & ~63, ctx); buffer = (const char *) buffer + (len & ~63); len &= 63; } /* Move remaining bytes in internal buffer. */ if (len > 0) { memcpy (ctx->buffer, buffer, len); ctx->buflen = len; } } /* These are the four functions used in the four steps of the MD5 algorithm and defined in the RFC 1321. The first function is a little bit optimized (as found in Colin Plumbs public domain implementation). */ /* #define FF(b, c, d) ((b & c) | (~b & d)) */ #define FF(b, c, d) (d ^ (b & (c ^ d))) #define FG(b, c, d) FF (d, b, c) #define FH(b, c, d) (b ^ c ^ d) #define FI(b, c, d) (c ^ (b | ~d)) /* Process LEN bytes of BUFFER, accumulating context into CTX. It is assumed that LEN % 64 == 0. */ void md5_process_block (buffer, len, ctx) const void *buffer; size_t len; struct md5_ctx *ctx; { md5_uint32 correct_words[16]; const md5_uint32 *words = buffer; size_t nwords = len / sizeof (md5_uint32); const md5_uint32 *endp = words + nwords; md5_uint32 A = ctx->A; md5_uint32 B = ctx->B; md5_uint32 C = ctx->C; md5_uint32 D = ctx->D; /* First increment the byte count. RFC 1321 specifies the possible length of the file up to 2^64 bits. Here we only compute the number of bytes. Do a double word increment. */ ctx->total[0] += len; if (ctx->total[0] < len) ++ctx->total[1]; /* Process all bytes in the buffer with 64 bytes in each round of the loop. */ while (words < endp) { md5_uint32 *cwp = correct_words; md5_uint32 A_save = A; md5_uint32 B_save = B; md5_uint32 C_save = C; md5_uint32 D_save = D; /* First round: using the given function, the context and a constant the next context is computed. Because the algorithms processing unit is a 32-bit word and it is determined to work on words in little endian byte order we perhaps have to change the byte order before the computation. To reduce the work for the next steps we store the swapped words in the array CORRECT_WORDS. */ #define OP(a, b, c, d, s, T) \ do \ { \ a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \ ++words; \ CYCLIC (a, s); \ a += b; \ } \ while (0) /* It is unfortunate that C does not provide an operator for cyclic rotation. Hope the C compiler is smart enough. */ #define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s))) /* Before we start, one word to the strange constants. They are defined in RFC 1321 as T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64 */ /* Round 1. */ OP (A, B, C, D, 7, 0xd76aa478); OP (D, A, B, C, 12, 0xe8c7b756); OP (C, D, A, B, 17, 0x242070db); OP (B, C, D, A, 22, 0xc1bdceee); OP (A, B, C, D, 7, 0xf57c0faf); OP (D, A, B, C, 12, 0x4787c62a); OP (C, D, A, B, 17, 0xa8304613); OP (B, C, D, A, 22, 0xfd469501); OP (A, B, C, D, 7, 0x698098d8); OP (D, A, B, C, 12, 0x8b44f7af); OP (C, D, A, B, 17, 0xffff5bb1); OP (B, C, D, A, 22, 0x895cd7be); OP (A, B, C, D, 7, 0x6b901122); OP (D, A, B, C, 12, 0xfd987193); OP (C, D, A, B, 17, 0xa679438e); OP (B, C, D, A, 22, 0x49b40821); /* For the second to fourth round we have the possibly swapped words in CORRECT_WORDS. Redefine the macro to take an additional first argument specifying the function to use. */ #undef OP #define OP(f, a, b, c, d, k, s, T) \ do \ { \ a += f (b, c, d) + correct_words[k] + T; \ CYCLIC (a, s); \ a += b; \ } \ while (0) /* Round 2. */ OP (FG, A, B, C, D, 1, 5, 0xf61e2562); OP (FG, D, A, B, C, 6, 9, 0xc040b340); OP (FG, C, D, A, B, 11, 14, 0x265e5a51); OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa); OP (FG, A, B, C, D, 5, 5, 0xd62f105d); OP (FG, D, A, B, C, 10, 9, 0x02441453); OP (FG, C, D, A, B, 15, 14, 0xd8a1e681); OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8); OP (FG, A, B, C, D, 9, 5, 0x21e1cde6); OP (FG, D, A, B, C, 14, 9, 0xc33707d6); OP (FG, C, D, A, B, 3, 14, 0xf4d50d87); OP (FG, B, C, D, A, 8, 20, 0x455a14ed); OP (FG, A, B, C, D, 13, 5, 0xa9e3e905); OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8); OP (FG, C, D, A, B, 7, 14, 0x676f02d9); OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a); /* Round 3. */ OP (FH, A, B, C, D, 5, 4, 0xfffa3942); OP (FH, D, A, B, C, 8, 11, 0x8771f681); OP (FH, C, D, A, B, 11, 16, 0x6d9d6122); OP (FH, B, C, D, A, 14, 23, 0xfde5380c); OP (FH, A, B, C, D, 1, 4, 0xa4beea44); OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9); OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60); OP (FH, B, C, D, A, 10, 23, 0xbebfbc70); OP (FH, A, B, C, D, 13, 4, 0x289b7ec6); OP (FH, D, A, B, C, 0, 11, 0xeaa127fa); OP (FH, C, D, A, B, 3, 16, 0xd4ef3085); OP (FH, B, C, D, A, 6, 23, 0x04881d05); OP (FH, A, B, C, D, 9, 4, 0xd9d4d039); OP (FH, D, A, B, C, 12, 11, 0xe6db99e5); OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8); OP (FH, B, C, D, A, 2, 23, 0xc4ac5665); /* Round 4. */ OP (FI, A, B, C, D, 0, 6, 0xf4292244); OP (FI, D, A, B, C, 7, 10, 0x432aff97); OP (FI, C, D, A, B, 14, 15, 0xab9423a7); OP (FI, B, C, D, A, 5, 21, 0xfc93a039); OP (FI, A, B, C, D, 12, 6, 0x655b59c3); OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92); OP (FI, C, D, A, B, 10, 15, 0xffeff47d); OP (FI, B, C, D, A, 1, 21, 0x85845dd1); OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f); OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0); OP (FI, C, D, A, B, 6, 15, 0xa3014314); OP (FI, B, C, D, A, 13, 21, 0x4e0811a1); OP (FI, A, B, C, D, 4, 6, 0xf7537e82); OP (FI, D, A, B, C, 11, 10, 0xbd3af235); OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb); OP (FI, B, C, D, A, 9, 21, 0xeb86d391); /* Add the starting values of the context. */ A += A_save; B += B_save; C += C_save; D += D_save; } /* Put checksum in context given as argument. */ ctx->A = A; ctx->B = B; ctx->C = C; ctx->D = D; } #ifdef SELFTEST_MAIN #include #include "str.h" static void MDString(const char* s) { struct md5_ctx ctx; unsigned char digest[16]; unsigned int len = strlen(s); unsigned i; md5_init_ctx(&ctx); md5_process_bytes(s, len, &ctx); md5_finish_ctx(&ctx, digest); printf("MD5 (\"%s\") = ", s); for (i = 0; i < 16; i++) printf("%02x", digest[i]); printf("\n"); } MAIN { printf("MD5 test suite:\n"); MDString(""); MDString("a"); MDString("abc"); MDString("message digest"); MDString("abcdefghijklmnopqrstuvwxyz"); MDString("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"); MDString("1234567890123456789012345678901234567890" "1234567890123456789012345678901234567890"); } #endif #ifdef SELFTEST_EXP MD5 test suite: MD5 ("") = d41d8cd98f00b204e9800998ecf8427e MD5 ("a") = 0cc175b9c0f1b6a831c399e269772661 MD5 ("abc") = 900150983cd24fb0d6963f7d28e17f72 MD5 ("message digest") = f96b697d7cb7938d525a2f31aaf161d0 MD5 ("abcdefghijklmnopqrstuvwxyz") = c3fcd3d76192e4007dfb496cca67e13b MD5 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = d174ab98d277d9f5a5611c2c9f419d9f MD5 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = 57edf4a22be3c955ac49da2e2107b67a #endif bglibs-2.04/crypto/sha1.c0000664000076400007640000001443013244040127014565 0ustar bruceguenter/* SHA-1 in C By Steve Reid . Small changes to make it fit by Bruce Guenter 100% Public Domain. Test Vectors (from FIPS PUB 180-1) "abc" A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 A million repetitions of "a" 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F */ #include #include "sha1.h" #include "uint32.h" #include "uint64.h" #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) /* blk0() and blk() perform the initial expand. */ /* I got the idea of expanding during the round function from SSLeay */ #ifdef ENDIAN_MSB # define blk0(i) block->l[i] #else # define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \ |(rol(block->l[i],8)&0x00FF00FF)) #endif #define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \ ^block->l[(i+2)&15]^block->l[i&15],1)) /* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */ #define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30); #define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30); #define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30); #define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30); #define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30); /* Hash a single 512-bit block. This is the core of the algorithm. */ void SHA1Transform(uint32 state[5], const unsigned char buffer[SHA1_BLOCK_LENGTH]) { uint32 a, b, c, d, e; typedef union { unsigned char c[64]; uint32 l[16]; } CHAR64LONG16; CHAR64LONG16 block[1]; /* use array to appear as a pointer */ memcpy(block, buffer, SHA1_BLOCK_LENGTH); /* Copy context->state[] to working vars */ a = state[0]; b = state[1]; c = state[2]; d = state[3]; e = state[4]; /* 4 rounds of 20 operations each. Loop unrolled. */ R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3); R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7); R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11); R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15); R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19); R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23); R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27); R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31); R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35); R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39); R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43); R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47); R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51); R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55); R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59); R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63); R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67); R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71); R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75); R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79); /* Add the working vars back into context.state[] */ state[0] += a; state[1] += b; state[2] += c; state[3] += d; state[4] += e; /* Wipe variables */ a = b = c = d = e = 0; #ifdef SHA1HANDSOFF memset(block, '\0', sizeof(block)); #endif } /* SHA1Init - Initialize new context */ void SHA1Init(SHA1_CTX* context) { /* SHA1 initialization constants */ context->state[0] = 0x67452301; context->state[1] = 0xEFCDAB89; context->state[2] = 0x98BADCFE; context->state[3] = 0x10325476; context->state[4] = 0xC3D2E1F0; context->bytes = 0; } /* Run your data through this. */ void SHA1Update(SHA1_CTX* context, const unsigned char* data, uint32 len) { unsigned blen = context->bytes % SHA1_BLOCK_LENGTH; unsigned use; context->bytes += len; if (blen > 0 && len >= (use = SHA1_BLOCK_LENGTH - blen)) { memcpy(context->buffer + blen, data, use); SHA1Transform(context->state, context->buffer); blen = 0; len -= use; data += use; } while (len >= SHA1_BLOCK_LENGTH) { SHA1Transform(context->state, data); len -= SHA1_BLOCK_LENGTH; data += SHA1_BLOCK_LENGTH; } memcpy(context->buffer + blen, data, len); } /* Add padding and return the message digest. */ void SHA1Final(SHA1_CTX* context, unsigned char digest[SHA1_DIGEST_LENGTH]) { unsigned i; unsigned blen = context->bytes % SHA1_BLOCK_LENGTH; context->buffer[blen++] = 0x80; memset(context->buffer + blen, 0, SHA1_BLOCK_LENGTH - blen); if (blen > SHA1_BLOCK_LENGTH-8) { SHA1Transform(context->state, context->buffer); memset(context->buffer, 0, SHA1_BLOCK_LENGTH-8); } uint64_pack_msb((context->bytes << 3), context->buffer + SHA1_BLOCK_LENGTH - 8); SHA1Transform(context->state, context->buffer); for (i = 0; i < 5; ++i, digest += 4) uint32_pack_msb(context->state[i], digest); /* Wipe variables */ memset(context, 0, sizeof(*context)); } #ifdef SELFTEST_MAIN #include "str.h" static SHA1_CTX ctx; static void init(void) { SHA1_Init(&ctx); } static void hash(const char* ptr, long len) { SHA1_Update(&ctx, (const unsigned char*)ptr, len); } static void dump(void) { unsigned i; unsigned char digest[SHA1_DIGEST_LENGTH]; SHA1_Final(&ctx, digest); for (i = 0; i < sizeof(digest); ++i) obuf_putXw(&outbuf, digest[i], 2, '0'); NL(); } static void test(const char* ptr, long len) { init(); hash(ptr, len); dump(); } MAIN { unsigned i; /* Test Vectors (from FIPS PUB 180-1) */ test("abc", 3); test("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", 56); init(); for (i = 0; i < 1000000/64; ++i) hash("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 64); dump(); } #endif #ifdef SELFTEST_EXP A9993E364706816ABA3E25717850C26C9CD0D89D 84983E441C3BD26EBAAE4AA1F95129E5E54670F1 34AA973CD4C4DAA4F61EEB2BDBAD27316534016F #endif bglibs-2.04/crypto/md5-crypt.c0000664000076400007640000001614713244040127015564 0ustar bruceguenter/* One way encryption based on MD5 sum. Copyright (C) 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include #include #include "md5.h" /* Define our magic string to mark salt for MD5 "encryption" replacement. This is meant to be the same as for other MD5 based encryption implementations. */ static const char md5_salt_prefix[] = "$1$"; /* Table with characters for base64 transformation. */ static const char b64t[64] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; /* Prototypes for local functions. */ extern char *md5_crypt_r __P ((const char *key, const char *salt, char *buffer, int buflen)); extern char *md5_crypt __P ((const char *key, const char *salt)); #ifndef MAX #define MAX(X,Y) (((X)>(Y))?(X):(Y)) #endif #ifndef MIN #define MIN(X,Y) (((X)>(Y))?(Y):(X)) #endif /* This entry point is equivalent to the `crypt' function in Unix libcs. */ char * md5_crypt_r (key, salt, buffer, buflen) const char *key; const char *salt; char *buffer; int buflen; { unsigned char alt_result[16]; struct md5_ctx ctx; struct md5_ctx alt_ctx; size_t salt_len; size_t key_len; size_t cnt; char *cp; /* Find beginning of salt string. The prefix should normally always be present. Just in case it is not. */ if (strncmp (md5_salt_prefix, salt, sizeof (md5_salt_prefix) - 1) == 0) /* Skip salt prefix. */ salt += sizeof (md5_salt_prefix) - 1; salt_len = MIN (strcspn (salt, "$"), 8); key_len = strlen (key); /* Prepare for the real work. */ md5_init_ctx (&ctx); /* Add the key string. */ md5_process_bytes (key, key_len, &ctx); /* Because the SALT argument need not always have the salt prefix we add it separately. */ md5_process_bytes (md5_salt_prefix, sizeof (md5_salt_prefix) - 1, &ctx); /* The last part is the salt string. This must be at most 8 characters and it ends at the first `$' character (for compatibility which existing solutions). */ md5_process_bytes (salt, salt_len, &ctx); /* Compute alternate MD5 sum with input KEY, SALT, and KEY. The final result will be added to the first context. */ md5_init_ctx (&alt_ctx); /* Add key. */ md5_process_bytes (key, key_len, &alt_ctx); /* Add salt. */ md5_process_bytes (salt, salt_len, &alt_ctx); /* Add key again. */ md5_process_bytes (key, key_len, &alt_ctx); /* Now get result of this (16 bytes) and add it to the other context. */ md5_finish_ctx (&alt_ctx, alt_result); /* Add for any character in the key one byte of the alternate sum. */ for (cnt = key_len; cnt > 16; cnt -= 16) md5_process_bytes (alt_result, 16, &ctx); md5_process_bytes (alt_result, cnt, &ctx); /* For the following code we need a NUL byte. */ *alt_result = '\0'; /* The original implementation now does something weird: for every 1 bit in the key the first 0 is added to the buffer, for every 0 bit the first character of the key. This does not seem to be what was intended but we have to follow this to be compatible. */ for (cnt = key_len; cnt > 0; cnt >>= 1) md5_process_bytes ((cnt & 1) != 0 ? (const char *) alt_result : key, 1, &ctx); /* Create intermediate result. */ md5_finish_ctx (&ctx, alt_result); /* Now comes another weirdness. In fear of password crackers here comes a quite long loop which just processes the output of the previous round again. We cannot ignore this here. */ for (cnt = 0; cnt < 1000; ++cnt) { /* New context. */ md5_init_ctx (&ctx); /* Add key or last result. */ if ((cnt & 1) != 0) md5_process_bytes (key, key_len, &ctx); else md5_process_bytes (alt_result, 16, &ctx); /* Add salt for numbers not divisible by 3. */ if (cnt % 3 != 0) md5_process_bytes (salt, salt_len, &ctx); /* Add key for numbers not divisible by 7. */ if (cnt % 7 != 0) md5_process_bytes (key, key_len, &ctx); /* Add key or last result. */ if ((cnt & 1) != 0) md5_process_bytes (alt_result, 16, &ctx); else md5_process_bytes (key, key_len, &ctx); /* Create intermediate result. */ md5_finish_ctx (&ctx, alt_result); } /* Now we can construct the result string. It consists of three parts. */ strncpy (buffer, md5_salt_prefix, MAX (0, buflen)); buflen -= strlen (md5_salt_prefix); cp = buffer + strlen (md5_salt_prefix); strncpy (cp, salt, MIN ((size_t) buflen, salt_len)); buflen -= MIN ((size_t) buflen, salt_len); cp += MIN ((size_t) buflen, salt_len); if (buflen > 0) { *cp++ = '$'; --buflen; } #define b64_from_24bit(B2, B1, B0, N) \ do { \ unsigned int w = ((B2) << 16) | ((B1) << 8) | (B0); \ int n = (N); \ while (n-- > 0 && buflen > 0) \ { \ *cp++ = b64t[w & 0x3f]; \ --buflen; \ w >>= 6; \ } \ } while (0) b64_from_24bit (alt_result[0], alt_result[6], alt_result[12], 4); b64_from_24bit (alt_result[1], alt_result[7], alt_result[13], 4); b64_from_24bit (alt_result[2], alt_result[8], alt_result[14], 4); b64_from_24bit (alt_result[3], alt_result[9], alt_result[15], 4); b64_from_24bit (alt_result[4], alt_result[10], alt_result[5], 4); b64_from_24bit (0, 0, alt_result[11], 2); if (buflen <= 0) { errno = ERANGE; buffer = NULL; } else *cp = '\0'; /* Terminate the string. */ /* Clear the buffer for the intermediate result so that people attaching to processes or reading core dumps cannot get any information. */ memset (alt_result, '\0', sizeof (alt_result)); return buffer; } char * md5_crypt (key, salt) const char *key; const char *salt; { /* We don't want to have an arbitrary limit in the size of the password. We can compute the size of the result in advance and so we can prepare the buffer we pass to `md5_crypt_r'. */ static char *buffer = NULL; static int buflen = 0; int needed = 3 + strlen (salt) + 1 + 26 + 1; if (buflen < needed) { buflen = needed; if ((buffer = realloc (buffer, buflen)) == NULL) return NULL; } return md5_crypt_r (key, salt, buffer, buflen); } bglibs-2.04/crypto/hmac-md5.c0000664000076400007640000000437313244040127015331 0ustar bruceguenter/* $Id: md5.c 646 2005-12-01 22:07:11Z bruce $ */ #include #include #include #include "sysdeps.h" #include "hmac.h" #include "md5.h" struct midstate { uint32 A, B, C, D; }; static void extract(const void* statep, void* midstatep) { const struct md5_ctx* ctx = statep; struct midstate* mid = midstatep; mid->A = ctx->A; mid->B = ctx->B; mid->C = ctx->C; mid->D = ctx->D; } static void inject(void* statep, const void* midstatep) { struct md5_ctx* ctx = statep; const struct midstate* mid = midstatep; ctx->A = mid->A; ctx->B = mid->B; ctx->C = mid->C; ctx->D = mid->D; ctx->total[0] = 64; ctx->total[1] = 0; ctx->buflen = 0; } static void update(void* ctx, const unsigned char* bytes, unsigned long len) { md5_process_bytes(bytes, len, ctx); } const struct hmac_control_block hmac_md5 = { .state_size = sizeof(struct md5_ctx), .block_size = 64, .digest_size = 128/8, .midstate_size = sizeof(struct midstate), .init = (hmac_init_fn)md5_init_ctx, .update = update, .finalize = (hmac_finalize_fn)md5_finish_ctx, .extract = extract, .inject = inject, }; #ifdef SELFTEST_MAIN #include #include "str.h" static void HMACTest(const char* key, const char* data) { const str key_str = { (char*)key, strlen(key), 0 }; const str data_str = { (char*)data, strlen(data), 0 }; unsigned char digest[128/8]; unsigned i; hmac(&hmac_md5, &key_str, &data_str, digest); printf("HMAC (%d,%d) = ", key_str.len, data_str.len); for (i = 0; i < sizeof digest; ++i) printf("%02x", digest[i]); printf("\n"); } MAIN { /* Test vectors from RFC 2104 */ HMACTest("\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", "Hi There"); HMACTest("Jefe", "what do ya want for nothing?"); HMACTest("\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"); } #endif #ifdef SELFTEST_EXP HMAC (16,8) = 9294727a3638bb1c13f48ef8158bfc9d HMAC (4,28) = 750c783e6ab0b503eaa86e310a5db738 HMAC (16,50) = 56be34521d144c88dbb8c733f0e8b3f6 #endif bglibs-2.04/crypto/hmac-sha256.c0000664000076400007640000000371013244040127015646 0ustar bruceguenter #include #include "hmac.h" #include "sha256.h" struct midstate { uint32 H[8]; }; static void extract(const void* statep, void* midstatep) { const SHA256_ctx* ctx = statep; struct midstate* mid = midstatep; memcpy(mid->H, ctx->H, 8 * sizeof(mid->H[0])); } static void inject(void* statep, const void* midstatep) { SHA256_ctx* ctx = statep; const struct midstate* mid = midstatep; memcpy(ctx->H, mid->H, 8 * sizeof(mid->H[0])); ctx->bytes = 64; } const struct hmac_control_block hmac_sha256 = { .state_size = sizeof(SHA256_ctx), .block_size = 64, .digest_size = SHA256_DIGEST_LENGTH, .midstate_size = sizeof(struct midstate), .init = (hmac_init_fn)SHA256_init, .update = (hmac_update_fn)SHA256_update, .finalize = (hmac_finalize_fn)SHA256_final, .extract = extract, .inject = inject, }; #ifdef SELFTEST_MAIN #include "obuf.h" #include "str.h" static void test_hmac(const char* key, const char* data) { const str key_str = { (char*)key, strlen(key), 0 }; const str data_str = { (char*)data, strlen(data), 0 }; unsigned char digest[SHA256_DIGEST_LENGTH]; unsigned i; hmac(&hmac_sha256, &key_str, &data_str, digest); for (i = 0; i < sizeof digest; ++i) obuf_putxw(&outbuf, digest[i], 2, '0'); obuf_endl(&outbuf); } MAIN { test_hmac("\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", "Hi There"); test_hmac("Jefe", "what do ya want for nothing?"); test_hmac("\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"); } #endif #ifdef SELFTEST_EXP 492ce020fe2534a5789dc3848806c78f4f6711397f08e7e7a12ca5a4483c8aa6 5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843 7dda3cc169743a6484649f94f0eda0f9f2ff496a9733fb796ed5adb40a44c3c1 #endif bglibs-2.04/crypto/sha512.c0000664000076400007640000002033413244040127014734 0ustar bruceguenter/* sha512.c - SHA-512 algorithm * Copyright (C) 2003,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * This code was derived from the official algorithm described in * http://csrc.nist.gov/cryptval/shs/sha256-384-512.pdf */ #include #include "sysdeps.h" #include "sha512.h" #include "uint64.h" static const uint64 K[] = { 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, 0xb5c0fbcfec4d3b2fULL, 0xe9b5dba58189dbbcULL, 0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL, 0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL, 0xd807aa98a3030242ULL, 0x12835b0145706fbeULL, 0x243185be4ee4b28cULL, 0x550c7dc3d5ffb4e2ULL, 0x72be5d74f27b896fULL, 0x80deb1fe3b1696b1ULL, 0x9bdc06a725c71235ULL, 0xc19bf174cf692694ULL, 0xe49b69c19ef14ad2ULL, 0xefbe4786384f25e3ULL, 0x0fc19dc68b8cd5b5ULL, 0x240ca1cc77ac9c65ULL, 0x2de92c6f592b0275ULL, 0x4a7484aa6ea6e483ULL, 0x5cb0a9dcbd41fbd4ULL, 0x76f988da831153b5ULL, 0x983e5152ee66dfabULL, 0xa831c66d2db43210ULL, 0xb00327c898fb213fULL, 0xbf597fc7beef0ee4ULL, 0xc6e00bf33da88fc2ULL, 0xd5a79147930aa725ULL, 0x06ca6351e003826fULL, 0x142929670a0e6e70ULL, 0x27b70a8546d22ffcULL, 0x2e1b21385c26c926ULL, 0x4d2c6dfc5ac42aedULL, 0x53380d139d95b3dfULL, 0x650a73548baf63deULL, 0x766a0abb3c77b2a8ULL, 0x81c2c92e47edaee6ULL, 0x92722c851482353bULL, 0xa2bfe8a14cf10364ULL, 0xa81a664bbc423001ULL, 0xc24b8b70d0f89791ULL, 0xc76c51a30654be30ULL, 0xd192e819d6ef5218ULL, 0xd69906245565a910ULL, 0xf40e35855771202aULL, 0x106aa07032bbd1b8ULL, 0x19a4c116b8d2d0c8ULL, 0x1e376c085141ab53ULL, 0x2748774cdf8eeb99ULL, 0x34b0bcb5e19b48a8ULL, 0x391c0cb3c5c95a63ULL, 0x4ed8aa4ae3418acbULL, 0x5b9cca4f7763e373ULL, 0x682e6ff3d6b2b8a3ULL, 0x748f82ee5defb2fcULL, 0x78a5636f43172f60ULL, 0x84c87814a1f0ab72ULL, 0x8cc702081a6439ecULL, 0x90befffa23631e28ULL, 0xa4506cebde82bde9ULL, 0xbef9a3f7b2c67915ULL, 0xc67178f2e372532bULL, 0xca273eceea26619cULL, 0xd186b8c721c0c207ULL, 0xeada7dd6cde0eb1eULL, 0xf57d4f7fee6ed178ULL, 0x06f067aa72176fbaULL, 0x0a637dc5a2c898a6ULL, 0x113f9804bef90daeULL, 0x1b710b35131c471bULL, 0x28db77f523047d84ULL, 0x32caab7b40c72493ULL, 0x3c9ebe0a15c9bebcULL, 0x431d67c49c100d4cULL, 0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL, 0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL }; static const uint64 H0[8] = { 0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL, 0x3c6ef372fe94f82bULL, 0xa54ff53a5f1d36f1ULL, 0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL, 0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL }; #define S(X,N) ((X>>N)|(X<<(64-N))) #define R(X,N) (X>>N) /* This optimization was found in Colin Plumb's MD5 code. */ /* #define Ch(x,y,z) (((x)&(y)) ^ (~(x)&(z))) */ #define Ch(x,y,z) ((z) ^ ((x) & ((y) ^ (z)))) #define Maj(x,y,z) (((x)&(y)) | ((x)&(z)) | ((y)&(z))) #define S0(x) (S(x,28) ^ S(x,34) ^ S(x,39)) #define S1(x) (S(x,14) ^ S(x,18) ^ S(x,41)) #define s0(x) (S(x, 1) ^ S(x, 8) ^ R(x, 7)) #define s1(x) (S(x,19) ^ S(x,61) ^ R(x, 6)) #define F(a,b,c,d,e,f,g,h) \ T1 = h + S1(e) + Ch(e,f,g) + *Kp++ + *Wp++; \ T2 = S0(a) + Maj(a,b,c); \ d += T1; \ h = T1 + T2; \ static void SHA512_transform(uint64 H[8], const uint8 M[128]) { uint64 a = H[0]; uint64 b = H[1]; uint64 c = H[2]; uint64 d = H[3]; uint64 e = H[4]; uint64 f = H[5]; uint64 g = H[6]; uint64 h = H[7]; uint64 W[80]; uint64* Wp; const uint64* Kp; uint64 T1; uint64 T2; unsigned j; for (Wp = W, j = 0; j < 16; ++j, ++Wp, M += 8) *Wp = uint64_get_msb(M); for (j = 16; j < 80; ++j, ++Wp) *Wp = s1(Wp[-2]) + Wp[-7] + s0(Wp[-15]) + Wp[-16]; #ifdef SHA2_NO_UNROLL for (Wp = W, Kp = K, j = 0; j < 80; ++j) { /* Straight out of the standards document. */ T1 = h + S1(e) + Ch(e,f,g) + *Kp++ + *Wp++; T2 = S0(a) + Maj(a,b,c); h = g; g = f; f = e; e = d + T1; d = c; c = b; b = a; a = T1 + T2; } #else for (Wp = W, Kp = K, j = 0; j < 10; ++j) { /* Unrolled loop, eliminates most of the extraneous data copies. */ F(a,b,c,d,e,f,g,h); F(h,a,b,c,d,e,f,g); F(g,h,a,b,c,d,e,f); F(f,g,h,a,b,c,d,e); F(e,f,g,h,a,b,c,d); F(d,e,f,g,h,a,b,c); F(c,d,e,f,g,h,a,b); F(b,c,d,e,f,g,h,a); } #endif H[0] += a; H[1] += b; H[2] += c; H[3] += d; H[4] += e; H[5] += f; H[6] += g; H[7] += h; } void SHA512_init(SHA512_ctx* ctx) { memcpy(ctx->H, H0, sizeof H0); ctx->bytes = 0; } void SHA512_update(SHA512_ctx* ctx, const void* vdata, unsigned long data_len) { const uint8* data = vdata; unsigned use; unsigned mlen = ctx->bytes % 128; ctx->bytes += data_len; if (mlen > 0 && data_len >= (use = 128 - mlen)) { memcpy(ctx->M + mlen, data, use); SHA512_transform(ctx->H, ctx->M); mlen = 0; data_len -= use; data += use; } while (data_len >= 128) { SHA512_transform(ctx->H, data); data_len -= 128; data += 128; } memcpy(ctx->M + mlen, data, data_len); } void SHA512_final_transform(SHA512_ctx* ctx) { unsigned mlen = ctx->bytes % 128; ctx->M[mlen++] = 0x80; memset(ctx->M + mlen, 0x00, 128 - mlen); if (mlen > 128-16) { SHA512_transform(ctx->H, ctx->M); memset(ctx->M, 0x00, 128-16); } uint64_pack_msb(ctx->bytes >> 61, ctx->M+112); uint64_pack_msb(ctx->bytes << 3, ctx->M+120); SHA512_transform(ctx->H, ctx->M); } void SHA512_final(SHA512_ctx* ctx, uint8* digest) { unsigned i; SHA512_final_transform(ctx); for (i = 0; i < 8; ++i, digest += 8) uint64_pack_msb(ctx->H[i], digest); memset(ctx, 0, sizeof *ctx); } #ifdef SELFTEST_MAIN #include "obuf.h" static void test(const char* s) { SHA512_ctx ctx; unsigned i; unsigned char digest[SHA512_DIGEST_LENGTH]; SHA512_init(&ctx); SHA512_update(&ctx, s, strlen(s)); SHA512_final(&ctx, digest); for (i = 0; i < sizeof digest; ++i) obuf_putxw(&outbuf, digest[i], 2, '0'); obuf_endl(&outbuf); } MAIN { test("abc"); test("abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"); /* Additional test vectors found in * http://www.aarongifford.com/computers/sha.html */ test("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"); test(""); test("This is exactly 64 bytes long, not counting the terminating byte"); test("For this sample, this 63-byte string will be used as input data"); test("And this textual data, astonishing as it may appear, is exactly 128 bytes in length, as are both SHA-384 and SHA-512 block sizes"); test("By hashing data that is one byte less than a multiple of a hash block length (like this 127-byte string), bugs may be revealed."); } #endif #ifdef SELFTEST_EXP ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f 8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909 204a8fc6dda82f0a0ced7beb8e08a41657c16ef468b228a8279be331a703c33596fd15c13b1b07f9aa1d3bea57789ca031ad85c7a71dd70354ec631238ca3445 cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 70aefeaa0e7ac4f8fe17532d7185a289bee3b428d950c14fa8b713ca09814a387d245870e007a80ad97c369d193e41701aa07f3221d15f0e65a1ff970cedf030 b3de4afbc516d2478fe9b518d063bda6c8dd65fc38402dd81d1eb7364e72fb6e6663cf6d2771c8f5a6da09601712fb3d2a36c6ffea3e28b0818b05b0a8660766 97fb4ec472f3cb698b9c3c12a12768483e5b62bcdad934280750b4fa4701e5e0550a80bb0828342c19631ba55a55e1cee5de2fda91fc5d40e7bee1d4e6d415b3 d399507bbf5f2d0da51db1ff1fc51c1c9ff1de0937e00d01693b240e84fcc3400601429f45c297acc6e8fcf1e4e4abe9ff21a54a0d3d88888f298971bd206cd5 #endif bglibs-2.04/crypto/hmac.c0000664000076400007640000000722013244040127014640 0ustar bruceguenter/* crypto/hmac.c - Hashed Message Authentication Code * Copyright (C) 2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "sysdeps.h" #include #include "str.h" #include "hmac.h" /** Precalculate the HMAC intermediate values. * * Calculates the initialization vectors to effectively seed the hash * function with the result of H(K XOR ipad) and H(K XOR opad). The * results of this function are used by hmac_finish. This saves the * application of the hash's compression function on two blocks for each * use of the HMAC. * * \note \c midstate must be twice \c hcb->midstate_size bytes long. */ void hmac_prepare(const struct hmac_control_block* hcb, void* midstate, const str* secret) { unsigned char state[hcb->state_size]; unsigned char block[hcb->block_size]; unsigned i; /* Set up K XOR ipad, where ipad is 0x36 repeated B times */ if (secret->len >= hcb->block_size) { hcb->init(state); hcb->update(state, (const unsigned char*)secret->s, secret->len); hcb->finalize(state, block); memset(block + hcb->digest_size, 0, sizeof block - hcb->digest_size); } else { memcpy(block, secret->s, secret->len); memset(block + secret->len, 0, sizeof block - secret->len); } for (i = 0; i < sizeof block; ++i) block[i] ^= 0x36; /* Generate prestate for H(K XOR ipad) */ hcb->init(state); hcb->update(state, block, sizeof block); hcb->extract(state, midstate); /* Generate K XOR opad */ for (i = 0; i < sizeof block; ++i) block[i] ^= 0x36 ^ 0x5c; /* Generate prestate for H(K XOR opad) */ hcb->init(state); hcb->update(state, block, sizeof block); hcb->extract(state, midstate + hcb->midstate_size); memset(state, 0, sizeof state); memset(block, 0, sizeof block); } /** Calculate the final HMAC digest. * * This function uses the initialization vectors produced by \c * hmac_prepare to produce the final digest output from the HMAC. */ void hmac_finish(const struct hmac_control_block* hcb, const void* midstate, const str* nonce, void* output) { unsigned char state[hcb->state_size]; /* Generate H1 = H(K XOR ipad, nonce) */ hcb->inject(state, midstate); hcb->update(state, (const unsigned char*)nonce->s, nonce->len); hcb->finalize(state, output); /* Generate Output = H(K XOR opad, H1) */ hcb->inject(state, midstate + hcb->midstate_size); hcb->update(state, output, hcb->digest_size); hcb->finalize(state, output); memset(state, 0, sizeof state); } /** A generic RFC 2104 HMAC calculator. * * This function generates a HMAC (Keyed Hashing for Message * Authentication) according to RFC 2104, using a secure hash given in * the control block. */ void hmac(const struct hmac_control_block* hcb, const str* secret, const str* nonce, void* output) { unsigned char midstate[hcb->state_size*2]; hmac_prepare(hcb, midstate, secret); hmac_finish(hcb, midstate, nonce, output); memset(midstate, 0, sizeof midstate); } bglibs-2.04/crypto/hmac-sha512.c0000664000076400007640000000421313244040127015640 0ustar bruceguenter #include #include "sysdeps.h" #include "hmac.h" #include "sha512.h" struct midstate { uint64 H[8]; }; static void extract(const void* statep, void* midstatep) { const SHA512_ctx* ctx = statep; struct midstate* mid = midstatep; memcpy(mid->H, ctx->H, sizeof *mid); } static void inject(void* statep, const void* midstatep) { SHA512_ctx* ctx = statep; const struct midstate* mid = midstatep; memcpy(ctx->H, mid->H, sizeof *mid); ctx->bytes = 128; } const struct hmac_control_block hmac_sha512 = { .state_size = sizeof(SHA512_ctx), .block_size = 128, .digest_size = SHA512_DIGEST_LENGTH, .midstate_size = sizeof(struct midstate), .init = (hmac_init_fn)SHA512_init, .update = (hmac_update_fn)SHA512_update, .finalize = (hmac_finalize_fn)SHA512_final, .extract = extract, .inject = inject, }; #ifdef SELFTEST_MAIN #include "obuf.h" #include "str.h" static void test_hmac(const char* key, const char* data) { const str key_str = { (char*)key, strlen(key), 0 }; const str data_str = { (char*)data, strlen(data), 0 }; unsigned char digest[SHA512_DIGEST_LENGTH]; unsigned i; hmac(&hmac_sha512, &key_str, &data_str, digest); for (i = 0; i < sizeof digest; ++i) obuf_putxw(&outbuf, digest[i], 2, '0'); obuf_endl(&outbuf); } MAIN { test_hmac("\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", "Hi There"); test_hmac("Jefe", "what do ya want for nothing?"); test_hmac("\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"); } #endif #ifdef SELFTEST_EXP 7641c48a3b4aa8f887c07b3e83f96affb89c978fed8c96fcbbf4ad596eebfe496f9f16da6cd080ba393c6f365ad72b50d15c71bfb1d6b81f66a911786c6ce932 164b7a7bfcf819e2e395fbe73b56e0a387bd64222e831fd610270cd7ea2505549758bf75c05a994a6d034f65f8f0e6fdcaeab1a34d4a6b4b636e070a38bce737 ad9b5c7de72693737cd5e9d9f41170d18841fec1201c1c1b02e05cae116718009f771cad9946ddbf7e3cde3e818d9ae85d91b2badae94172d096a44a79c91e86 #endif bglibs-2.04/crypto/hmac-sha1.c0000664000076400007640000000366313244040127015501 0ustar bruceguenter #include #include #include #include "sysdeps.h" #include "hmac.h" #include "sha1.h" struct midstate { uint32 state[5]; }; static void extract(const void* statep, void* midstatep) { const SHA1_CTX* ctx = statep; struct midstate* mid = midstatep; memcpy(mid->state, ctx->state, 5 * sizeof(mid->state[0])); } static void inject(void* statep, const void* midstatep) { SHA1_CTX* ctx = statep; const struct midstate* mid = midstatep; memcpy(ctx->state, mid->state, 5 * sizeof(mid->state[0])); ctx->bytes = 64; } const struct hmac_control_block hmac_sha1 = { .state_size = sizeof(SHA1_CTX), .block_size = SHA1_BLOCK_LENGTH, .digest_size = SHA1_DIGEST_LENGTH, .midstate_size = sizeof(struct midstate), .init = (hmac_init_fn)SHA1Init, .update = (hmac_update_fn)SHA1Update, .finalize = (hmac_finalize_fn)SHA1Final, .extract = extract, .inject = inject, }; #ifdef SELFTEST_MAIN #include "str.h" static void test_hmac(const char* key, const char* data) { const str key_str = { (char*)key, strlen(key), 0 }; const str data_str = { (char*)data, strlen(data), 0 }; unsigned char digest[SHA1_DIGEST_LENGTH]; unsigned i; hmac(&hmac_sha1, &key_str, &data_str, digest); for (i = 0; i < sizeof digest; ++i) obuf_putXw(&outbuf, digest[i], 2, '0'); NL(); } MAIN { test_hmac("\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", "Hi There"); test_hmac("Jefe", "what do ya want for nothing?"); test_hmac("\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"); } #endif #ifdef SELFTEST_EXP 675B0B3A1B4DDF4E124872DA6C2F632BFED957E9 EFFCDF6AE5EB2FA2D27416D5F184DF9C259A7C79 D730594D167E35D5956FD8003D0DB3D3F46DC7BB #endif bglibs-2.04/ANNOUNCEMENT0000664000076400007640000000401313244040126014055 0ustar bruceguenterVersion 2.04 of bglibs is now available at: http://untroubled.org/bglibs/ ------------------------------------------------------------------------------ Changes in version 2.04 - Fixed DNS self-tests relying on external data. - Added support for DNS queries on an alternate port. - Added support for $MSG_NO_PROGRAM to suppress the "program: " prefix. - Fixed problem with struct ucred not being pulled in properly. - Fixed several problems with dns_qualify. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- bglibs One stop library package Bruce Guenter Version 2.04 2018-02-23 This package contains a collection of libraries written by myself and put in use in various packages. A mailing list has been set up to discuss this and other packages. To subscribe, send an email to: bgware-subscribe@lists.untroubled.org A mailing list archive is available at: http://lists.untroubled.org/ Development versions of bglibs are available at GitHub: https://github.com/bruceg/bglibs Installation: - Build the sources by running "make" - After the package has been compiled, run the following command as root: make install Copyright(C) 2018 Bruce Guenter This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA bglibs-2.04/fmt/0000755000076400007640000000000013244040127013027 5ustar bruceguenterbglibs-2.04/fmt/pad.c0000664000076400007640000000030513244040127013737 0ustar bruceguenter#include #include "fmt.h" /** Format a pad character. */ unsigned fmt_pad(char* buffer, unsigned width, char pad) { if (buffer != 0) memset(buffer, pad, width); return width; } bglibs-2.04/fmt/ulldec.c0000664000076400007640000000066213244040127014451 0ustar bruceguenter#include "fmt.h" /** Format an unsigned long long integer as decimal with padding. */ unsigned fmt_ulldecw(char* buffer, unsigned long long num, unsigned width, char pad) { return fmt_ullnumw(buffer, num, width, pad, 10, fmt_lcase_digits); } /** Format an unsigned long long integer as decimal. */ unsigned fmt_ulldec(char* buffer, unsigned long long num) { return fmt_ullnumw(buffer, num, 0, 0, 10, fmt_lcase_digits); } bglibs-2.04/fmt/sign_pad.c0000664000076400007640000000166213244040127014766 0ustar bruceguenter#include #include "fmt.h" /** Format padding for a signed number. */ unsigned fmt_sign_pad(char* buffer, int sign, unsigned width, char pad) { char* s = buffer; if (buffer == 0) return width + (sign != 0); if (!width) { if (sign) *s++ = '-'; } else { if (pad != '0') { memset(s, pad, width); s += width; } if (sign) *s++ = '-'; if (pad == '0') { memset(s, pad, width); s += width; } } return s - buffer; } #ifdef SELFTEST_MAIN void test(int sign, unsigned width, char pad) { char buf[10]; obuf_putu(&outbuf, fmt_sign_pad(0, sign, width, pad)); obuf_putc(&outbuf, ':'); buf[fmt_sign_pad(buf, sign, width, pad)] = 0; obuf_puts(&outbuf, buf); NL(); } MAIN { test(0, 0, 0); test(1, 0, 0); test(0, 4, 'x'); test(1, 4, 'x'); test(0, 4, '0'); test(1, 4, '0'); } #endif #ifdef SELFTEST_EXP 0: 1:- 4:xxxx 5:xxxx- 4:0000 5:-0000 #endif bglibs-2.04/fmt/ucase.c0000664000076400007640000000021613244040127014274 0ustar bruceguenter#include "fmt.h" /** Array of digits for upper-case conversions */ const char fmt_ucase_digits[36] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; bglibs-2.04/fmt/char.c0000664000076400007640000000245113244040127014114 0ustar bruceguenter/* fmt/char.c - Format a single character. * Copyright (C) 2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "fmt.h" /** Format a single character */ unsigned fmt_char(char* buffer, int ch, unsigned width, char pad) { unsigned i; if (buffer != 0) { for (i = width; i > 1; --i) *buffer++ = pad; *buffer = ch; } return width ? width : 1; } #ifdef SELFTEST_MAIN MAIN { char buf[99]; obuf_putu(&outbuf, fmt_char(0, 'f', 5, ' ')); obuf_write(&outbuf, buf, fmt_char(buf, 'f', 5, ' ')); obuf_endl(&outbuf); } #endif #ifdef SELFTEST_EXP 5 f #endif bglibs-2.04/fmt/multi.c0000664000076400007640000002315013244040127014330 0ustar bruceguenter/* fmt/multi.c - Format multiple items. * Copyright (C) 2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include "fmt.h" #include "fmt.h" #include "fmt.h" #include "str.h" /** Format multiple items. The \c format string used to describe the multiple items is related to what is used with printf and related functions, but has one critical difference: instead of formatted items being escaped, literal text must be escaped. This solves the largest security issue with using printf-style format strings, which is the possibility of accidentally treating untrusted text as the format string. The format string is composed of zero or more format items. Each item is composed of the following parts: Zero or more flag characters:
\c #
Use an "alternate form" to convert the value. For octal conversion, the result is prefixed with a \c 0 . For hexadecimal conversion, the result is prefixed with either \c 0x or \c 0X depending on the conversion type.
\c -
(not implemented) Pad on the right (left justified) instead of on the left (default right justified).
\c 0
Pad the result with zeros instead of spaces.
Field width. The option field width is a decimal digit string specifying the minimum field width. If the converted value has fewer characters than the field width, it will be padded out to the field width. Length modifier:
\c l
The following integer conversion uses a \c long type.
\c ll
The following integer conversion uses a \c long \c long type.
Conversion specifier.
\c d
\c i
The \c int argument is converted to a signed decimal string.
\c o
\c u
\c x
\c X
The \c unsigned \c int argument is converted to a unsigned octal, unsigned decimal, lowercase unsigned hexadecimal, or uppercase unsigned hexadecimal string respectively.
\c c
The \c int argument is converted to an unsigned char.
\c s
The \c const \c char* argument is converted.
\c S
The \c const \c str* argument is converted.
\c p
The \c void* argument is converted to a hexadecimal string.
\c m
The result of \c strerror(errno) is formatted.
\c \\
The next character literal from the format string is converted as with \c c conversion.
\c {string}
The literal string enclosed by the parenthesis is converted as with \c s conversion.
\c @
Formats an arbitrary object using two arguments: The first ::fmt_function argument is used to format the following \c void* argument. The ::fmt_function is passed the output buffer, the data pointer, width, and pad character, and is expected to return the number of bytes formatted.
*/ unsigned fmt_multi(char* buffer, const char* format, ...) { va_list ap; unsigned i; va_start(ap, format); i = fmt_multiv(buffer, format, ap); va_end(ap); return i; } static unsigned fmt_ullnumwa(char* buffer, unsigned long long u, unsigned width, char pad, unsigned base, const char* digits, const char* prefix) { unsigned prefixlen = 0; if (prefix != 0) { prefixlen = strlen(prefix); width = (width > prefixlen) ? width - prefixlen : 0; if (buffer != 0) for (; *prefix != 0; ++prefix, ++buffer) *buffer = *prefix; } return prefixlen + fmt_ullnumw(buffer, u, width, pad, base, digits); } static unsigned fmt_unumwa(char* buffer, unsigned long u, unsigned width, char pad, unsigned base, const char* digits, const char* prefix) { unsigned prefixlen = 0; if (prefix != 0) { prefixlen = strlen(prefix); width = (width > prefixlen) ? width - prefixlen : 0; if (buffer != 0) for (; *prefix != 0; ++prefix, ++buffer) *buffer = *prefix; } return prefixlen + fmt_unumw(buffer, u, width, pad, base, digits); } /** Format multiple items, using a va_list. This is the core function used to format multiple items. */ unsigned fmt_multiv(char* buffer, const char* format, va_list ap) { unsigned length; for (length = 0; *format != 0; ++format) { int pad = ' '; int islong = 0; int islonglong = 0; int altfmt = 0; int leftadj = 0; unsigned width; unsigned ilength; long long value = 0; const char* altstr; char conv; const str* strp; const void* voidp; fmt_function fn; for (; *format != 0; ++format) { switch (*format) { case '#': altfmt = 1; continue; case '-': leftadj = 1; continue; case '0': pad = '0'; continue; } break; } for (width = 0; *format >= '0' && *format <= '9'; ++format) width = (width * 10) + (*format - '0'); while (*format == 'l') { ++format; ++islong; } islonglong = islong >= 2; conv = *format; switch (conv) { case 'i': case 'd': case 'o': case 'u': case 'x': case 'X': value = islonglong ? va_arg(ap, long long) : islong ? va_arg(ap, long) : va_arg(ap, int); } switch (conv) { case 'i': case 'd': ilength = islonglong ? fmt_sllnumw(buffer, value, width, pad, 10, fmt_lcase_digits) : fmt_snumw(buffer, value, width, pad, 10, fmt_lcase_digits); break; case 'o': altstr = altfmt ? "0" : 0; ilength = islonglong ? fmt_ullnumwa(buffer, value, width, pad, 8, fmt_lcase_digits, altstr) : fmt_unumwa(buffer, value, width, pad, 8, fmt_lcase_digits, altstr); break; case 'u': ilength = islonglong ? fmt_ullnumw(buffer, value, width, pad, 10, fmt_lcase_digits) : fmt_unumw(buffer, value, width, pad, 10, fmt_lcase_digits); break; case 'x': altstr = altfmt ? "0x" : 0; ilength = islonglong ? fmt_ullnumwa(buffer, value, width, pad, 16, fmt_lcase_digits, altstr) : fmt_unumwa(buffer, value, width, pad, 16, fmt_lcase_digits, altstr); break; case 'X': altstr = altfmt ? "0X" : 0; ilength = islonglong ? fmt_ullnumwa(buffer, value, width, pad, 16, fmt_ucase_digits, altstr) : fmt_unumwa(buffer, value, width, pad, 16, fmt_ucase_digits, altstr); break; case 'c': ilength = fmt_char(buffer, va_arg(ap, int), width, pad); break; case 's': ilength = fmt_chars(buffer, va_arg(ap, const char*), width, pad); break; case 'S': strp = va_arg(ap, const str*); ilength = fmt_mem(buffer, strp->s, strp->len, width, pad); break; case 'p': ilength = fmt_unumwa(buffer, (unsigned long)va_arg(ap, void*), width, pad, 16, fmt_lcase_digits, "0x"); break; case 'm': ilength = fmt_chars(buffer, strerror(errno), width, pad); break; case '@': fn = va_arg(ap, fmt_function); voidp = va_arg(ap, const void*); ilength = fn(buffer, voidp, width, pad); break; case '\\': ilength = fmt_char(buffer, *++format, width, pad); break; case '{': { const char* start = ++format; for (; *format != 0 && *format != '}'; ++format) ; ilength = fmt_mem(buffer, start, format-start, width, pad); } break; default: ilength = 0; } if (buffer != 0) buffer += ilength; length += ilength; } return length; } #ifdef SELFTEST_MAIN unsigned fmt_bool(char* buffer, const void* data, unsigned width, char pad) { return fmt_chars(buffer, data ? "true" : "false", width, pad); } void testit(const char* format, ...) { char buffer[100]; unsigned length; va_list ap; va_start(ap, format); length = fmt_multiv(0, format, ap); va_end(ap); obuf_putu(&outbuf, length); obuf_putc(&outbuf, ':'); va_start(ap, format); length = fmt_multiv(buffer, format, ap); va_end(ap); obuf_putu(&outbuf, length); obuf_putc(&outbuf, ':'); obuf_write(&outbuf, buffer, length); obuf_endl(&outbuf); } MAIN { testit("s{|}1s{|zzz|}5s\\|05s", "one", "two", "nine", "ten"); testit("c\\|1c\\|5c\\|05c", 'a', 'b', 'c', 'd'); testit("09{foo}"); testit("o\\|x\\|X\\|i\\|d", 95, 95, 95, 95, 95); testit("#o\\|#x\\|#X\\|#i\\|#d", 95, 95, 95, 95, 95); testit("p", (void*)12345678); testit("o\\|lo\\|llo", 505050505U, 505050505UL, 5050505050505050505ULL); testit("u\\|lu\\|llu", 505050505U, 505050505UL, 5050505050505050505ULL); testit("x\\|lx\\|llx", 505050505U, 505050505UL, 5050505050505050505ULL); testit("X\\|lX\\|llX", 505050505U, 505050505UL, 5050505050505050505ULL); testit("i\\|li\\|lli", 505050505U, 505050505UL, 5050505050505050505ULL); testit("i\\|li\\|lli", -505050505U, -505050505UL, -5050505050505050505ULL); testit("10@\\|010@", fmt_bool, (void*)1, fmt_bool, (void*)0); } #endif #ifdef SELFTEST_EXP 23:23:one|two|zzz| nine|00ten 15:15:a|b| c|0000d 9:9:000000foo 15:15:137|5f|5F|95|95 20:20:0137|0x5f|0X5F|95|95 8:8:0xbc614e 43:43:3606472611|3606472611|430267771265752674611 39:39:505050505|505050505|5050505050505050505 34:34:1e1a7589|1e1a7589|4616ff95afab7989 34:34:1E1A7589|1E1A7589|4616FF95AFAB7989 39:39:505050505|505050505|5050505050505050505 42:42:-505050505|-505050505|-5050505050505050505 21:21: true|00000false #endif bglibs-2.04/fmt/ullhexl.c0000664000076400007640000000067213244040127014657 0ustar bruceguenter#include "fmt.h" /** Format an unsigned long long integer as hexadecimal with padding. */ unsigned fmt_ullhexw(char* buffer, unsigned long long num, unsigned width, char pad) { return fmt_ullnumw(buffer, num, width, pad, 16, fmt_lcase_digits); } /** Format an unsigned long long integer as hexadecimal. */ unsigned fmt_ullhex(char* buffer, unsigned long long num) { return fmt_ullnumw(buffer, num, 0, 0, 16, fmt_lcase_digits); } bglibs-2.04/fmt/unum.c0000664000076400007640000000513013244040127014160 0ustar bruceguenter/* fmt/unum.c - Format an unsigned number. * Copyright (C) 2004,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include "fmt.h" static unsigned rec(char* buffer, unsigned long num, unsigned width, char pad, unsigned base, const char* digits) { char* s = buffer; if (width) --width; if (num >= base) s += rec(s, num/base, width, pad, base, digits); else { memset(s, pad, width); s += width; } *s++ = digits[num % base]; return s - buffer; } /** Format an unsigned integer of arbitrary base with optional padding. */ unsigned fmt_unumw(char* buffer, unsigned long num, unsigned width, char pad, unsigned base, const char* digits) { char* s = buffer; if (buffer == 0) { unsigned len; for (len = 1; num >= base; ++len) num /= base; return (width > len) ? width : len; } if (num < base) { if (width) { --width; memset(buffer, pad, width); s = buffer + width; } *s++ = digits[num]; } else s = buffer + rec(buffer, num, width, pad, base, digits); return s - buffer; } #ifdef SELFTEST_MAIN static void test(unsigned (*fn)(char*, unsigned long, unsigned, char), unsigned long num, unsigned width, char pad) { char buf[FMT_ULONG_LEN]; obuf_putu(&outbuf, fn(0, num, width, pad)); obuf_putc(&outbuf, ':'); buf[fn(buf, num, width, pad)] = 0; obuf_puts(&outbuf, buf); NL(); } static void testall(unsigned (*fn)(char*, unsigned long, unsigned, char), unsigned long num) { test(fn, num, 0, 0); test(fn, num, 1, ' '); test(fn, num, 5, ' '); test(fn, num, 5, '0'); } MAIN { testall(fmt_udecw, 0); testall(fmt_udecw, 1); testall(fmt_udecw, 10); testall(fmt_uhexw, 30); testall(fmt_uHexw, 30); } #endif #ifdef SELFTEST_EXP 1:0 1:0 5: 0 5:00000 1:1 1:1 5: 1 5:00001 2:10 2:10 5: 10 5:00010 2:1e 2:1e 5: 1e 5:0001e 2:1E 2:1E 5: 1E 5:0001E #endif bglibs-2.04/fmt/snum.c0000664000076400007640000000471113244040127014162 0ustar bruceguenter/* fmt/snum.c - Format a signed integer. * Copyright (C) 2004,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "fmt.h" static unsigned rec(char* buffer, long num, int sign, unsigned width, char pad, unsigned base, const char* digits) { char* s = buffer; if (width) --width; if (num >= (long)base) s += rec(s, num/base, sign, width, pad, base, digits); else s += fmt_sign_pad(s, sign, width, pad); *s++ = digits[num % base]; return s - buffer; } /** Format a signed integer of arbitrary base with optional padding. */ unsigned fmt_snumw(char* buffer, long num, unsigned width, char pad, unsigned base, const char* digits) { char* s = buffer; int sign; sign = 0; if (num < 0) { sign = 1; num = -num; if (width) -- width; } if (buffer == 0) { unsigned len; for (len = 1; num >= (long)base; ++len) num /= base; return ((width > len) ? width : len) + sign; } if (num < (long)base) { if (width) --width; s += fmt_sign_pad(s, sign, width, pad); *s++ = digits[num]; } else s += rec(s, num, sign, width, pad, base, digits); return s - buffer; } #ifdef SELFTEST_MAIN void test(long num, unsigned width, char pad) { char buf[FMT_ULONG_LEN]; obuf_putu(&outbuf, fmt_sdecw(0, num, width, pad)); obuf_putc(&outbuf, ':'); buf[fmt_sdecw(buf, num, width, pad)] = 0; obuf_puts(&outbuf, buf); NL(); } void testall(long num) { test(num, 0, 0); test(num, 1, '0'); test(num, 5, ' '); test(num, 5, '0'); } MAIN { testall(0); testall(1); testall(-1); testall(10); testall(-10); } #endif #ifdef SELFTEST_EXP 1:0 1:0 5: 0 5:00000 1:1 1:1 5: 1 5:00001 2:-1 2:-1 5: -1 5:-0001 2:10 2:10 5: 10 5:00010 3:-10 3:-10 5: -10 5:-0010 #endif bglibs-2.04/fmt/chars.c0000664000076400007640000000345513244040127014304 0ustar bruceguenter/* fmt/chars.c - Format memory block or character string. * Copyright (C) 2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include "str.h" #include "fmt.h" /* Format a block of characters */ unsigned fmt_mem(char* buffer, const char* s, unsigned length, unsigned width, char pad) { unsigned i; if (length > width) width = length; if (buffer != 0) { for (i = width; i > length; --i) *buffer++ = pad; for (i = length; i > 0; --i) *buffer++ = *s++; } return width; } /* Format a character string terminated by ASCII \c NUL */ unsigned fmt_chars(char* buffer, const char* s, unsigned width, char pad) { return fmt_mem(buffer, s, strlen(s), width, pad); } /* Format a dynamic string */ unsigned fmt_str(char* buffer, const str* s, unsigned width, char pad) { return fmt_mem(buffer, s->s, s->len, width, pad); } #ifdef SELFTEST_MAIN MAIN { char buf[99]; obuf_putu(&outbuf, fmt_chars(0, "foo", 10, ' ')); obuf_write(&outbuf, buf, fmt_chars(buf, "foo", 10, ' ')); obuf_endl(&outbuf); } #endif #ifdef SELFTEST_EXP 10 foo #endif bglibs-2.04/fmt/ullhexu.c0000664000076400007640000000073013244040127014663 0ustar bruceguenter#include "fmt.h" /** Format an unsigned long long integer as (upper-case) hexadecimal with padding. */ unsigned fmt_ullHexw(char* buffer, unsigned long long num, unsigned width, char pad) { return fmt_ullnumw(buffer, num, width, pad, 16, fmt_ucase_digits); } /** Format an unsigned long long integer as (upper-case) hexadecimal. */ unsigned fmt_ullHex(char* buffer, unsigned long long num) { return fmt_ullnumw(buffer, num, 0, 0, 16, fmt_ucase_digits); } bglibs-2.04/fmt/lcase.c0000664000076400007640000000021613244040127014263 0ustar bruceguenter#include "fmt.h" /** Array of digits for lower-case conversions */ const char fmt_lcase_digits[36] = "0123456789abcdefghijklmnopqrstuvwxyz"; bglibs-2.04/fmt/slldec.c0000664000076400007640000000062313244040127014444 0ustar bruceguenter#include "fmt.h" /** Format a signed long long integer as decimal with padding. */ unsigned fmt_slldecw(char* buffer, long long num, unsigned width, char pad) { return fmt_sllnumw(buffer, num, width, pad, 10, fmt_lcase_digits); } /** Format a signed long long integer as decimal. */ unsigned fmt_slldec(char* buffer, long long num) { return fmt_sllnumw(buffer, num, 0, 0, 10, fmt_lcase_digits); } bglibs-2.04/fmt/udec.c0000664000076400007640000000060513244040127014116 0ustar bruceguenter#include "fmt.h" /** Format an unsigned integer as decimal with padding. */ unsigned fmt_udecw(char* buffer, unsigned long num, unsigned width, char pad) { return fmt_unumw(buffer, num, width, pad, 10, fmt_lcase_digits); } /** Format an unsigned integer as decimal. */ unsigned fmt_udec(char* buffer, unsigned long num) { return fmt_unumw(buffer, num, 0, 0, 10, fmt_lcase_digits); } bglibs-2.04/fmt/uhexu.c0000664000076400007640000000065313244040127014337 0ustar bruceguenter#include "fmt.h" /** Format an unsigned integer as (upper-case) hexadecimal with padding. */ unsigned fmt_uHexw(char* buffer, unsigned long num, unsigned width, char pad) { return fmt_unumw(buffer, num, width, pad, 16, fmt_ucase_digits); } /** Format an unsigned integer as (upper-case) hexadecimal. */ unsigned fmt_uHex(char* buffer, unsigned long num) { return fmt_unumw(buffer, num, 0, 0, 16, fmt_ucase_digits); } bglibs-2.04/fmt/sdec.c0000664000076400007640000000055513244040127014120 0ustar bruceguenter#include "fmt.h" /** Format a signed integer as decimal with padding. */ unsigned fmt_sdecw(char* buffer, long num, unsigned width, char pad) { return fmt_snumw(buffer, num, width, pad, 10, fmt_lcase_digits); } /** Format a signed integer as decimal. */ unsigned fmt_sdec(char* buffer, long num) { return fmt_snumw(buffer, num, 0, 0, 10, fmt_lcase_digits); } bglibs-2.04/fmt/uhexl.c0000664000076400007640000000065313244040127014326 0ustar bruceguenter#include "fmt.h" /** Format an unsigned integer as (lower-case) hexadecimal with padding. */ unsigned fmt_uhexw(char* buffer, unsigned long num, unsigned width, char pad) { return fmt_unumw(buffer, num, width, pad, 16, fmt_lcase_digits); } /** Format an unsigned integer as (lower-case) hexadecimal. */ unsigned fmt_uhex(char* buffer, unsigned long num) { return fmt_unumw(buffer, num, 0, 0, 16, fmt_lcase_digits); } bglibs-2.04/fmt/sllnum.c0000664000076400007640000000464513244040127014520 0ustar bruceguenter/* fmt/sllnum.c - Format a signed long long integer. * Copyright (C) 2004,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "fmt.h" static unsigned rec(char* buffer, long long num, int sign, unsigned width, char pad, unsigned base, const char* digits) { char* s = buffer; if (width) --width; if (num >= (long long)base) s += rec(s, num/base, sign, width, pad, base, digits); else s += fmt_sign_pad(s, sign, width, pad); *s++ = digits[num % base]; return s - buffer; } /** Format a signed long long integer of arbitrary base with optional padding. */ unsigned fmt_sllnumw(char* buffer, long long num, unsigned width, char pad, unsigned base, const char* digits) { char* s = buffer; int sign; sign = 0; if (num < 0) { sign = 1; num = -num; if (width) -- width; } if (buffer == 0) { unsigned len; for (len = 1; num >= base; ++len) num /= base; return ((width > len) ? width : len) + sign; } if (num < (long long)base) { s += fmt_sign_pad(s, sign, width-1, pad); *s++ = digits[num]; } else s += rec(s, num, sign, width, pad, base, digits); return s - buffer; } #ifdef SELFTEST_MAIN void test(long long num, unsigned width, char pad) { char buf[FMT_ULONG_LEN]; obuf_putu(&outbuf, fmt_slldecw(0, num, width, pad)); obuf_putc(&outbuf, ':'); buf[fmt_sdecw(buf, num, width, pad)] = 0; obuf_puts(&outbuf, buf); NL(); } MAIN { test( 0, 0, 0); test( 10, 0, 0); test(-10, 0, 0); test( 10, 1, '0'); test(-10, 1, '0'); test( 10, 5, ' '); test( 10, 5, '0'); test(-10, 5, ' '); test(-10, 5, '0'); } #endif #ifdef SELFTEST_EXP 1:0 2:10 3:-10 2:10 3:-10 5: 10 5:00010 5: -10 5:-0010 #endif bglibs-2.04/fmt/ullnum.c0000664000076400007640000000517513244040127014521 0ustar bruceguenter/* fmt/ullnum.c - Format an unsigned long long number. * Copyright (C) 2004,2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include "fmt.h" static unsigned rec(char* buffer, unsigned long long num, unsigned width, char pad, unsigned base, const char* digits) { char* s = buffer; if (width) --width; if (num >= base) s += rec(s, num/base, width, pad, base, digits); else { memset(s, pad, width); s += width; } *s++ = digits[num % base]; return s - buffer; } /** Format an unsigned long long integer of arbitrary base with optional padding. */ unsigned fmt_ullnumw(char* buffer, unsigned long long num, unsigned width, char pad, unsigned base, const char* digits) { char* s = buffer; if (buffer == 0) { unsigned len; for (len = 1; num >= base; ++len) num /= base; return (width > len) ? width : len; } if (num < base) { if (width) { --width; memset(buffer, pad, width); s = buffer + width; } *s++ = digits[num]; } else s = buffer + rec(buffer, num, width, pad, base, digits); return s - buffer; } #ifdef SELFTEST_MAIN static void test(unsigned (*fn)(char*, unsigned long long, unsigned, char), unsigned long long num, unsigned width, char pad) { char buf[FMT_ULONG_LEN]; obuf_putu(&outbuf, fn(0, num, width, pad)); obuf_putc(&outbuf, ':'); buf[fn(buf, num, width, pad)] = 0; obuf_puts(&outbuf, buf); NL(); } MAIN { test(fmt_ulldecw, 0, 0, 0); test(fmt_ulldecw, 10, 0, 0); test(fmt_ulldecw, 10, 1, ' '); test(fmt_ulldecw, 10, 5, ' '); test(fmt_ulldecw, 10, 5, '0'); test(fmt_ullhexw, 30, 0, 0); test(fmt_ullhexw, 30, 5, ' '); test(fmt_ullhexw, 30, 5, '0'); test(fmt_ullHexw, 30, 0, 0); test(fmt_ullHexw, 30, 5, ' '); test(fmt_ullHexw, 30, 5, '0'); } #endif #ifdef SELFTEST_EXP 1:0 2:10 2:10 5: 10 5:00010 2:1e 5: 1e 5:0001e 2:1E 5: 1E 5:0001E #endif bglibs-2.04/dns-responder.c0000664000076400007640000001106113244040127015171 0ustar bruceguenter#include "fmt.h" #include "iobuf.h" #include "ipv4.h" #include "msg.h" #include "socket.h" #include "uint16.h" #include "uint32.h" #include #define DUMP void dump_rrs(int count, const union dns_result_rrs* rr) #define NODUMP DUMP { (void)count; (void)rr; } #define RESPONSE static const struct dns_response extern DUMP; static int dns_responder_pid = 0; extern ipv4port dns_use_port; struct dns_response_rr { const char* name; uint16 namelen; uint16 type; uint16 class; uint32 ttl; const char* rdata; uint16 rdatalen; }; struct dns_response { uint16 ancount, nscount, arcount; struct dns_response_rr rr[8]; }; static long dump_name(const unsigned char* data) { long o = 0; unsigned char l; while ((l = data[o++]) > 0) { obuf_write(&outbuf, (const char*)data+o, l); obuf_putc(&outbuf, '.'); o += l; }; return o; } static long dump_request(const unsigned char* packet, long len) { uint16 first = uint16_get_msb(packet+2); uint16 qdcount = uint16_get_msb(packet+4); uint16 ancount = uint16_get_msb(packet+6); uint16 nscount = uint16_get_msb(packet+8); uint16 arcount = uint16_get_msb(packet+10); long o = 12; obuf_putf(&outbuf, "d{: ID=XX QR=}d{ opcode=}d{ AA=}d{ TC=}d{ RD=}d{ RA=}d{ Z=}d{ RCODE=}d{ QDCOUNT=}d{ ANCOUNT=}d{ NSCOUNT=}d{ ARCOUNT=}d{\n}", len, first >> 15, /* QR */ (first >> 11) & 0xf, /* Opcode */ (first >> 10) & 1, /* AA */ (first >> 9) & 1, /* TC */ (first >> 8) & 1, /* RD */ (first >> 7) & 1, /* RA */ (first >> 4) & 7, /* Z */ first & 0xf, /* RCODE */ qdcount, ancount, nscount, arcount); for (; qdcount > 0; qdcount--) { obuf_puts(&outbuf, "Question: "); o += dump_name(packet+o); obuf_putf(&outbuf, "{ QTYPE=}d{ QCLASS=}d{\n}", uint16_get_msb(packet+o), uint16_get_msb(packet+o+2)); o += 4; } obuf_flush(&outbuf); return o; } static int make_response(unsigned char* buf, int offset, const struct dns_response* response) { int r; uint16_pack_msb(response->ancount, buf+6); uint16_pack_msb(response->nscount, buf+8); uint16_pack_msb(response->arcount, buf+10); for (r = 0; r < response->ancount + response->nscount + response->arcount; r++) { const struct dns_response_rr* rr = &response->rr[r]; memcpy((char*)buf+offset, rr->name, rr->namelen); offset += rr->namelen; uint16_pack_msb(rr->type, buf+offset); uint16_pack_msb(rr->class, buf+offset+2); uint32_pack_msb(rr->ttl, buf+offset+4); uint16_pack_msb(rr->rdatalen, buf+offset+8); offset += 10; memcpy((char*)buf+offset, rr->rdata, rr->rdatalen); offset += rr->rdatalen; } return offset; } static void start_dns_responder(const struct dns_response* response, int count) { int sockfd; ipv4addr addr; ipv4port port; unsigned char buf[512]; long r; long offset; if ((sockfd = socket_udp()) < 0) die1sys(111, "Could not create DNS socket"); ipv4_scan("127.0.0.1", &addr); if (!socket_bind4(sockfd, &addr, 0)) die1sys(111, "Could not bind DNS socket"); if (!socket_getaddr4(sockfd, &addr, &port)) die1sys(111, "Could not get DNS socket address"); if (0 && !socket_listen(sockfd, 0)) die1sys(111, "Could not listen to DNS socket"); dns_use_port = port; buf[fmt_sdec((char*)buf, port)] = 0; if (setenv("DNSCACHEIP", "127.0.0.1", 1) < 0 || setenv("DNSCACHEPORT", (char*)buf, 1) < 0) die1sys(111, "Could not set up DNS responder environment variables"); if ((dns_responder_pid = fork()) < 0) die1sys(111, "Could not fork"); if (dns_responder_pid != 0) return; for (; count > 0; ++response, --count) { if ((r = socket_recv4(sockfd, (char*)buf, sizeof buf, &addr, &port)) < 0) die1sys(111, "Could not receive DNS packet"); offset = dump_request(buf, r); offset = make_response(buf, offset, response); if ((r = socket_send4(sockfd, (char*)buf, offset, &addr, port)) != offset) die1sys(111, "Could not send DNS response"); } exit(0); } static void wait_dns_responder(void) { waitpid(dns_responder_pid, NULL, 0); } void do_dns_test(const char* fqdn, int (*fn)(struct dns_result*, const char*)) { struct dns_result out = {0}; debugfn(fn(&out, fqdn)); obuf_putf(&outbuf, "s{: count=}d{\n}", fqdn, out.count); dump_rrs(out.count, &out.rr); } void do_dns_respond_tests(int (*fn)(struct dns_result*, const char*), const char** fqdn, const struct dns_response* responses, int count) { start_dns_responder(responses, count); while (*fqdn) { do_dns_test(*fqdn++, fn); obuf_flush(&outbuf); } wait_dns_responder(); } bglibs-2.04/ChangeLog0000664000076400007640000165170413244040126014032 0ustar bruceguentercommit 7dfd12522ec6496470ac381fe568721e45c42975 Author: Bruce Guenter Date: Wed Mar 2 15:33:15 2016 -0600 net/resolve: Use dns_qualify to provide qualification for IPv4 lookups dns-responder.c | 11 ++++++----- include/resolve.h | 2 ++ net/resolve_calldns.c | 18 ++++++++++++++++++ net/resolve_ipv4name.c | 22 ++++++++++++++++++---- 4 files changed, 44 insertions(+), 9 deletions(-) commit 458970d769df5cc0ee66d6c1129647887f10a5fa Author: Bruce Guenter Date: Wed Mar 2 16:19:17 2016 -0600 Bump version to 2.04 VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 40d99382080ad4c7fce7f4256f5f85a6b9c3dd27 Author: Bruce Guenter Date: Wed Mar 2 15:32:25 2016 -0600 dns-responder: Add support for multiple-packet DNS sequences dns-responder.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) commit 7c18a1adbf058f2f9a755620db67ee7d231ccbd4 Author: Bruce Guenter Date: Wed Mar 2 19:45:52 2016 -0600 net/dns: Fix handling of multiple + additions in dns_qualify NEWS | 5 +---- net/dns_qualify.c | 35 +++++++++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 10 deletions(-) commit d9e0bfdfcae3bce627e43730efb318059f2c3558 Author: Bruce Guenter Date: Wed Mar 2 19:18:15 2016 -0600 net/dns: Move dns_qualify tests into dns_qualify.c net/dns_qualify.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ net/dns_resolvconfrewrite.c | 28 ---------------------------- 2 files changed, 44 insertions(+), 28 deletions(-) commit 234376375ef0b5e9b69030d7067c446408508a7c Author: Bruce Guenter Date: Wed Mar 2 19:11:34 2016 -0600 net/dns: Test output of dns_resolvconfrewrite net/dns_resolvconfrewrite.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) commit d6b5534e3fc9c12f74466b50abb5e5d9167975ad Author: Bruce Guenter Date: Wed Mar 2 17:22:56 2016 -0600 net/dns: Add selftests for fromdot/todot net/dns_domain_fromdot.c | 39 +++++++++++++++++++++++++++++++++++++++ net/dns_domain_todot.c | 21 +++++++++++++++++++++ 2 files changed, 60 insertions(+) commit 48f83d871bd0562dfa83506aa1ccdc290c8cb924 Author: Bruce Guenter Date: Wed Mar 2 14:57:47 2016 -0600 net/dns: Fix prototype for (unused) dns_qualify The dns_qualify function is supposed to call one of the dns_* functions (like dns_ip4). It was providing a str* for the output, but those functions output via struct dns_result*. NEWS | 2 ++ include/dns.h | 8 ++++---- net/dns_qualify.c | 10 +++++----- net/dns_resolvconfrewrite.c | 4 ++-- 4 files changed, 13 insertions(+), 11 deletions(-) commit 742731135b2862b74ec3cbc9d13152ae7762fa08 Author: Bruce Guenter Date: Wed Mar 2 13:21:28 2016 -0600 Fix INCLUDES setting in (not used) automake files cdb++/Makefile.am | 2 +- cgi/Makefile.am | 2 +- cli++/Makefile.am | 2 +- fdbuf/Makefile.am | 2 +- mystring/Makefile.am | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) commit 87a72571d72563f566f6ad2e6beda6754a0d883d Author: Bruce Guenter Date: Thu Aug 13 21:54:45 2015 -0600 include: Remove obsolete cloexec.h and nonblock.h include/cloexec.h | 7 ------- include/nonblock.h | 7 ------- 2 files changed, 14 deletions(-) delete mode 100644 include/cloexec.h delete mode 100644 include/nonblock.h commit 9cc6039a7d32a7d5439d9057ba24200714801205 Author: Bruce Guenter Date: Sun May 17 13:57:15 2015 -0600 net/dns: Slight simplification of declarations dns-responder.c | 17 ++++++++--------- net/dns_ip4.c | 12 ++++++------ net/dns_ip6.c | 8 ++++---- net/dns_mx.c | 4 ++-- net/dns_txt.c | 10 +++++----- 5 files changed, 25 insertions(+), 26 deletions(-) commit 6b2e99762a99435f57e222aa655958ff92bddfad Author: Bruce Guenter Date: Sun May 17 13:49:42 2015 -0600 net/dns: Use captive data test for dns_mx dns-responder.c | 6 +++++- net/dns_mx.c | 43 ++++++++++++++++++++++++++++++------------- 2 files changed, 35 insertions(+), 14 deletions(-) commit ee11fdc1af957af4daa8e424e9f6f770208b0ec2 Author: Bruce Guenter Date: Sun May 17 12:13:55 2015 -0600 net/dns: Use captive test data for dns_ip[46] dns-responder.c | 11 +++++++++-- net/dns_ip4.c | 43 ++++++++++++++++++++++++++++++++----------- net/dns_ip6.c | 28 ++++++++++++++++++---------- net/dns_txt.c | 4 ++-- 4 files changed, 61 insertions(+), 25 deletions(-) commit 4b60936011db10521b5d12198927d6a3ff4a55dd Author: Bruce Guenter Date: Sun May 17 11:36:29 2015 -0600 net/dns: Modify selftest for dns_txt to use captive data net/dns_txt.c | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) commit 0b833be320670b76ec6aa98a15f892ed85417595 Author: Bruce Guenter Date: Sun May 17 11:36:05 2015 -0600 Add DNS test responder framework dns-responder.c | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 dns-responder.c commit 5d2747a60ebb9ccfcd4ddf4aa074a932a1532afe Author: Bruce Guenter Date: Sun May 17 11:53:24 2015 -0600 net/dns: Break out DNS RR union include/dns.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) commit 0e2e1788a29cd1f4ec494513f5744dbbc1e6ac6e Author: Bruce Guenter Date: Sat May 16 13:47:12 2015 -0600 net/dns: Support dns queries on alternate port with $DNSCACHEPORT NEWS | 2 ++ net/dns_resolvconfip.c | 10 ++++++++++ net/dns_transmit.c | 6 +++--- 3 files changed, 15 insertions(+), 3 deletions(-) commit 3477ae73bb4d774d095122e1515549f1ac53b509 Author: Bruce Guenter Date: Sat May 16 13:38:48 2015 -0600 net/dns_transmit.c: Add define for DNS port number net/dns_transmit.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) commit 501725b9dbdca2c20f913f87039594955614df6e Author: Bruce Guenter Date: Fri May 15 14:26:47 2015 -0600 sys: Need #define _GNU_SOURCE 1 for definition of struct ucred NEWS | 2 ++ sys/haspeercred.h1 | 1 + sys/trypeercred.c | 1 + sysdeps-head.h | 1 + 4 files changed, 5 insertions(+) commit 90478c13cb819d378e0dcab8aeba07b9ed6a5dd0 Author: Bruce Guenter Date: Fri May 15 13:54:17 2015 -0600 net/dns_qualify: Use memmove instead of memcpy since the areas overlap NEWS | 3 +++ net/dns_qualify.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) commit 92c0d51c7dba96715db2ff2e37bafb7385cda1ac Author: Bruce Guenter Date: Fri Feb 6 17:56:11 2015 -0600 Bump version to 2.03 NEWS | 5 +++++ VERSION | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) commit f6131aa9345616bd2b4e78915f44ef4627879f13 Author: Bruce Guenter Date: Fri Feb 6 17:54:35 2015 -0600 config.dxy: Fix list of INPUT subdirectories config.dxy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 4aa02e459c289c183e89045091a3879fed5d4485 Author: Bruce Guenter Date: Fri Feb 6 15:30:45 2015 -0600 Revert installed libbg-cli back to static linkage. The CLI lib calls cli_show_help when it needs to show help text. The library includes an implementation that dynamically generates the help text from the options structure, but cli-generate also builds its own function that has pre-generated text. In the dynamic .so file, this doesn't work, since it's all pre-linked internally. I could change cli_show_help to a weak symbol, but that adds a gcc dependancy, and the CLI library is small and doesn't change much, so just revert to static linkage. INSTHIER | 2 +- NEWS | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) commit 5ae53d7e9f6cc50f6fc46c3a4e42e51fdfe601fd Author: Bruce Guenter Date: Tue Feb 3 16:23:15 2015 -0600 Bump version to 2.02 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit be9735e90a586c582d77f80707246e5031ff445b Author: Bruce Guenter Date: Tue Feb 3 15:16:55 2015 -0600 obuf, str: Mark the *_digits constants as deprecated include/obuf.h | 7 ++++--- include/str.h | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) commit c97d6c8e6d11549b86ff7649dc00c39888f46119 Author: Bruce Guenter Date: Tue Feb 3 14:22:11 2015 -0600 Fix make race condition in compiling CLI C sources The CLI generated C source indirectly includes sysdeps.h, but did not depend on it, leading to a build race. %-cli.c.spac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit e896c122cb32ff081d99e6b96ead1cef5cecc32c Author: Bruce Guenter Date: Tue Feb 3 14:45:21 2015 -0600 str: Drop internal use of the str_*_digits constants str/catiw.c | 7 ++++--- str/catiwll.c | 7 ++++--- str/catuw.c | 7 ++++--- str/catuwll.c | 7 ++++--- str/catxw.c | 7 ++++--- str/catxwll.c | 7 ++++--- 6 files changed, 24 insertions(+), 18 deletions(-) commit c65de5c2b77d4bc6cdebc952cb288d29a49550e3 Author: Bruce Guenter Date: Tue Feb 3 14:34:38 2015 -0600 iobuf: Drop internal use of the obuf_*_digits constants crc-gentab=x | 3 ++- iobuf/obuf_putsllnumw.c | 4 ++-- iobuf/obuf_putsnumw.c | 4 ++-- iobuf/obuf_putullnumw.c | 12 ++++++------ iobuf/obuf_putunumw.c | 12 ++++++------ 5 files changed, 18 insertions(+), 17 deletions(-) commit b3adcf73200175a6a78293771ea24af503202daa Author: Bruce Guenter Date: Tue Feb 3 14:21:22 2015 -0600 cli-generate: Fix obuf.h include path in generated C files NEWS | 2 ++ cli-generate.pl | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) commit b9b087d00269c260e42b4613bf31746b0a846caa Author: Bruce Guenter Date: Tue Feb 3 11:11:42 2015 -0600 ipv4: Use internal __DEPRECATED__ sysdep include/ipv4.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 811812171b18fe9e9458035dbe71b19c6a39625a Author: Bruce Guenter Date: Tue Feb 3 10:10:10 2015 -0600 Make sure selftest.c source gets included in the dist NEWS | 2 ++ selftests.spac | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) commit aadb9377dbaf004bb94ed0615759a28ecfa5da80 Author: Bruce Guenter Date: Tue Feb 3 10:08:39 2015 -0600 iobuf, str: Use fmt for formatting numbers NEWS | 2 ++ TODO | 2 -- crc-gentab=x | 1 + iobuf/obuf_putsllnumw.c | 37 +++++-------------------------------- iobuf/obuf_putsnumw.c | 37 +++++-------------------------------- iobuf/obuf_putullnumw.c | 25 +++++-------------------- iobuf/obuf_putunumw.c | 24 +++++------------------- str/catsllnum.c | 32 +++++--------------------------- str/catsnum.c | 32 +++++--------------------------- str/catullnum.c | 23 ++++++----------------- str/catunum.c | 23 ++++++----------------- 11 files changed, 45 insertions(+), 193 deletions(-) commit 26089ab212e7fdc18499e3f5bb46ec2303487ad8 Author: Bruce Guenter Date: Fri Jan 30 15:45:13 2015 -0600 Bump version to 2.01 NEWS | 4 ++++ VERSION | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) commit 06bdacfc34cf2334d98f6d3173f2e9e4eb9d1bc2 Author: Bruce Guenter Date: Fri Jan 30 15:44:40 2015 -0600 Fix #include lines in uint##.h headers NEWS | 3 +++ uint16.h | 4 ++-- uint32.h | 4 ++-- uint64.h | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) commit e466f9c951187f7756abe74c8dccdceb1bcd8776 Author: Bruce Guenter Date: Fri Jan 30 09:39:59 2015 -0600 Move the example template CLI into doc EXTRADIST | 2 +- template.cli => doc/template.cli | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename template.cli => doc/template.cli (100%) commit b80a37480c99178b3ba461b17e290a1459d0292e Author: Bruce Guenter Date: Fri Jan 30 08:36:14 2015 -0600 config.dxy: Upgrade to Doxygen 1.8.5 config.dxy | 2305 +++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 1358 insertions(+), 947 deletions(-) commit 7e84fa9b68eb3dc352b431863db8d86fdb4da1a8 Author: Bruce Guenter Date: Thu Jan 29 17:00:11 2015 -0600 Add bglibs symlink in include to fix building the bg-installer cli bits EXTRADIST | 1 + INSTHIER | 2 +- include/bglibs | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) create mode 120000 include/bglibs commit c5e64398808a753947e594e56b486bdab690a817 Author: Bruce Guenter Date: Thu Jan 29 12:25:05 2015 -0600 Bump version to 2.00 LIBVERSION | 2 +- NEWS | 5 +++++ VERSION | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) commit de2585b87517c3d9bc63a3bf7fbbf09fe67487da Author: Bruce Guenter Date: Thu Jan 29 11:51:06 2015 -0600 Drop installed compatibility symlinks for header files INSTHIER | 82 ---------------------------------------------------------------- 1 file changed, 82 deletions(-) commit 7c34957b7561dcde406eb96fa9da48e02951fc59 Author: Bruce Guenter Date: Wed Jan 28 13:10:47 2015 -0600 Remove the libbg-sysdeps library, merged completely into libbg INSTHIER | 1 - bg-installer=x | 1 - crc-gentab=x | 2 +- libbg-sysdeps=l | 20 -------------------- libraries.spac | 1 - selftests.spac | 2 +- 6 files changed, 2 insertions(+), 25 deletions(-) delete mode 100644 libbg-sysdeps=l commit 2841941fadfd3269f55aacfbe3ba4e30be747122 Author: Bruce Guenter Date: Thu Jan 22 16:02:18 2015 -0600 reorg: Add libbg-sysdeps objects into libbg proper, and drop internal use libbg=l | 20 ++++++++++++++++++++ selftest-cmp=x | 1 - selftests.sh | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) commit 58a70337a4ea5c2118b5a3c2135414eb3b0dc820 Merge: e39ca61 632ed98 Author: Bruce Guenter Date: Thu Jan 22 15:16:42 2015 -0600 Merge branch 'reorg' Conflicts: libbg-net=l net/dns_mx.c net/dns_name4.c net/dns_name6.c commit 632ed980d779ae512399aea14d84fcc14cb3f1ae Author: Bruce Guenter Date: Wed Jan 21 16:18:14 2015 -0600 spec: Clean up for reorg changes spec | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) commit 4764b089db5288ac00cc992fb533bc3eb9730cdb Author: Bruce Guenter Date: Wed Jan 21 16:03:07 2015 -0600 reorg: Move the default install directories up a level to just /usr/local/* conf-include | 2 +- conf-lib | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) commit ad76e1dc367568af023e6226893296e4fb50a42a Author: Bruce Guenter Date: Wed Jan 21 16:01:22 2015 -0600 reorg: Install all includes in bglibs subdir except for pwcmp and vmailmgr INSTHIER | 138 +++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 69 insertions(+), 69 deletions(-) commit 89fb7c67e030e7a630bcc3b397e554fd46b76866 Author: Bruce Guenter Date: Wed Jan 21 15:48:37 2015 -0600 reorg: Install sysdeps.h, systime.h, and uint*.h into bglibs subdir INSTHIER | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) commit 2dcc7fd6174b1ac25c97077352d86e4f4732ae07 Author: Bruce Guenter Date: Wed Jan 21 15:38:26 2015 -0600 reorg: Drop compatibility pwcmp and vmailmgr lib links This prepares the lib install portion for going in .../lib directly INSTHIER | 9 --------- 1 file changed, 9 deletions(-) commit 8d24c6f8fde6c8b47303a8a7b262bc972caf8897 Author: Bruce Guenter Date: Wed Jan 21 15:33:52 2015 -0600 reorg: Drop the .lib installs INSTHIER | 9 --------- all.spac | 2 +- dotlibs.spac | 1 - spec | 1 - 4 files changed, 1 insertion(+), 12 deletions(-) delete mode 100644 dotlibs.spac commit bd5a466bc3edb74589ae68492e1b517a412edd88 Author: Bruce Guenter Date: Wed Apr 11 16:19:02 2012 -0600 reorg: Drop all libbg-* libraries except libbg-{cli,sysdeps} This requires crc-gentab link directly to needed objects. INSTHIER | 68 +----------- bg-installer=x | 6 +- crc-gentab=x | 15 ++- libbg-adt=l | 21 ---- libbg-base64=l | 6 -- libbg-cdb=l | 7 -- libbg-crc=l | 12 --- libbg-crypto=l | 15 --- libbg-dict=l | 9 -- libbg-fmt=l | 19 ---- libbg-iobuf=l | 51 --------- libbg-misc=l | 5 - libbg-msg=l | 18 ---- libbg-net=l | 69 ------------ libbg-path=l | 6 -- libbg-str=l | 69 ------------ libbg-unix=l | 25 ----- libbg.la.spac | 16 --- libbg=l | 332 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ libraries.spac | 2 +- 20 files changed, 348 insertions(+), 423 deletions(-) delete mode 100644 libbg-adt=l delete mode 100644 libbg-base64=l delete mode 100644 libbg-cdb=l delete mode 100644 libbg-crc=l delete mode 100644 libbg-crypto=l delete mode 100644 libbg-dict=l delete mode 100644 libbg-fmt=l delete mode 100644 libbg-iobuf=l delete mode 100644 libbg-misc=l delete mode 100644 libbg-msg=l delete mode 100644 libbg-net=l delete mode 100644 libbg-path=l delete mode 100644 libbg-str=l delete mode 100644 libbg-unix=l delete mode 100644 libbg.la.spac create mode 100644 libbg=l commit c59937292b7ad97c373c264d317085c6e6785538 Author: Bruce Guenter Date: Tue Apr 10 14:59:23 2012 -0600 reorg: Move misc/*.h INSTHIER | 4 ++-- {misc => include}/misc.h | 3 ++- {misc => include}/ucspi.h | 0 vmailmgr/vpwentry_import.c | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) rename {misc => include}/misc.h (94%) rename {misc => include}/ucspi.h (100%) commit fa71ff63f356e5ede1c82913190b865c4abcd600 Author: Bruce Guenter Date: Tue Apr 10 14:49:43 2012 -0600 reorg: Move and merge cdb/*.h into one cdb.h include INSTHIER | 6 +++--- cdb/get.c | 1 - cdb/getnext.c | 1 - cdb/make.h | 21 --------------------- cdb/str.h | 10 ---------- {cdb => include}/cdb.h | 32 +++++++++++++++++++++++++++++--- 6 files changed, 32 insertions(+), 39 deletions(-) delete mode 100644 cdb/str.h rename {cdb => include}/cdb.h (58%) commit 513dfa526a17c95fdac859fba32f8ecf0da03fdd Author: Bruce Guenter Date: Tue Apr 10 14:40:47 2012 -0600 reorg: Remove obsolete installer libraries INSTHIER | 7 --- instlib/installer.c | 139 ---------------------------------------------------- instlib/installer.h | 49 ------------------ instlib/instcheck.c | 113 ------------------------------------------ instlib/instmain.c | 22 --------- instlib/instshow.c | 129 ------------------------------------------------ libbg-installer=l | 39 --------------- libbg-instcheck=l | 38 -------------- libbg-instshow=l | 37 -------------- 9 files changed, 573 deletions(-) delete mode 100644 instlib/installer.c delete mode 100644 instlib/installer.h delete mode 100644 instlib/instcheck.c delete mode 100644 instlib/instmain.c delete mode 100644 instlib/instshow.c delete mode 100644 libbg-installer=l delete mode 100644 libbg-instcheck=l delete mode 100644 libbg-instshow=l commit 7fb7e632f60b2fd1a80949bd851c73ba18d911cd Author: Bruce Guenter Date: Tue Apr 10 13:48:03 2012 -0600 reorg: Unify unix/fcntl.h, cloexec.h, and nonblock.h into new unix.h INSTHIER | 6 +++--- include/unix.h | 15 +++++++++++++++ net/connect4_timeout.c | 2 +- net/connect6_timeout.c | 2 +- net/connectu_timeout.c | 2 +- unix/cloexec_off.c | 3 +-- unix/cloexec_on.c | 3 +-- unix/fcntl.c | 2 +- unix/fcntl.h | 9 --------- unix/fcntl_fd_off.c | 2 +- unix/fcntl_fd_on.c | 2 +- unix/fcntl_fl_off.c | 2 +- unix/fcntl_fl_on.c | 2 +- unix/nonblock_off.c | 3 +-- unix/nonblock_on.c | 3 +-- unix/selfpipe.c | 3 +-- unix/signalfd.c | 3 +-- 17 files changed, 32 insertions(+), 32 deletions(-) create mode 100644 include/unix.h delete mode 100644 unix/fcntl.h commit 7a0d23a9e76d3d1b8f2647c8c874ffa0746ff63c Author: Bruce Guenter Date: Tue Apr 10 13:33:48 2012 -0600 reorg: Move most of the unix/*.h (except fcntl.h) Moving the fcntl.h into the build include path breaks other things that depend on the system fcntl.h. INSTHIER | 12 ++++++------ {unix => include}/cloexec.h | 0 {unix => include}/nonblock.h | 0 {unix => include}/selfpipe.h | 0 {unix => include}/sig.h | 0 {unix => include}/signalfd.h | 0 {unix => include}/trigger.h | 2 +- net/connect4_timeout.c | 2 +- net/connect6_timeout.c | 2 +- net/connectu_timeout.c | 2 +- unix/selfpipe.c | 8 ++++---- unix/signalfd.c | 8 ++++---- 12 files changed, 18 insertions(+), 18 deletions(-) rename {unix => include}/cloexec.h (100%) rename {unix => include}/nonblock.h (100%) rename {unix => include}/selfpipe.h (100%) rename {unix => include}/sig.h (100%) rename {unix => include}/signalfd.h (100%) rename {unix => include}/trigger.h (98%) commit fd58cf78f00915ff5293b894aa9548ab1703e3f8 Author: Bruce Guenter Date: Tue Apr 10 13:17:35 2012 -0600 reorg: Remove obsolete err sources err/die.c | 10 ---------- err/err.h | 53 ----------------------------------------------------- err/error.c | 7 ------- err/message.c | 33 --------------------------------- err/warn.c | 7 ------- 5 files changed, 110 deletions(-) delete mode 100644 err/die.c delete mode 100644 err/err.h delete mode 100644 err/error.c delete mode 100644 err/message.c delete mode 100644 err/warn.c commit 109d03b574bb1d4c7e10c6f08bd63cb624417b52 Author: Bruce Guenter Date: Tue Apr 10 12:04:20 2012 -0600 reorg: Move all public net/*.h INSTHIER | 12 ++++++------ {net => include}/dns.h | 12 ++++++------ {net => include}/ipv4.h | 2 +- {net => include}/ipv6.h | 2 +- {net => include}/resolve.h | 0 {net => include}/socket.h | 0 net/connect4_timeout.c | 2 +- net/connect6_timeout.c | 2 +- net/connectu_timeout.c | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) rename {net => include}/dns.h (98%) rename {net => include}/ipv4.h (97%) rename {net => include}/ipv6.h (96%) rename {net => include}/resolve.h (100%) rename {net => include}/socket.h (100%) commit 2bafa72f2e9754c4aecd1d4ab8dc5a9170550cc9 Author: Bruce Guenter Date: Tue Apr 10 11:58:21 2012 -0600 reorg: Merge all of fmt/*.h into one new fmt.h header INSTHIER | 6 +++--- bg-installer.c | 2 +- fmt/char.c | 2 +- fmt/chars.c | 2 +- fmt/lcase.c | 2 +- fmt/misc.h | 27 --------------------------- fmt/multi.c | 6 +++--- fmt/multi.h | 27 --------------------------- fmt/pad.c | 2 +- fmt/sdec.c | 2 +- fmt/sign_pad.c | 2 +- fmt/slldec.c | 2 +- fmt/sllnum.c | 2 +- fmt/snum.c | 2 +- fmt/ucase.c | 2 +- fmt/udec.c | 2 +- fmt/uhexl.c | 2 +- fmt/uhexu.c | 2 +- fmt/ulldec.c | 2 +- fmt/ullhexl.c | 2 +- fmt/ullhexu.c | 2 +- fmt/ullnum.c | 2 +- fmt/unum.c | 2 +- fmt/number.h => include/fmt.h | 32 ++++++++++++++++++++++++++++++++ iobuf/obuf_putf.c | 2 +- misc/random.c | 2 +- misc/strtou.c | 2 +- misc/utoa.c | 2 +- misc/utoa2.c | 2 +- net/dns_name4_domain.c | 2 +- net/dns_name6_domain.c | 2 +- str/catf.c | 2 +- str/copyf.c | 2 +- 33 files changed, 66 insertions(+), 88 deletions(-) delete mode 100644 fmt/misc.h delete mode 100644 fmt/multi.h rename fmt/number.h => include/fmt.h (82%) commit 7f22db9bd48ead7286ddfb879de33ee93acaa945 Author: Bruce Guenter Date: Tue Apr 10 11:47:27 2012 -0600 reorg: Move dict/dict.h and merge in dict/load.h INSTHIER | 4 ++-- dict/load.h | 11 ----------- dict/load_list.c | 1 - dict/load_map.c | 1 - {dict => include}/dict.h | 7 ++++++- 5 files changed, 8 insertions(+), 16 deletions(-) delete mode 100644 dict/load.h rename {dict => include}/dict.h (77%) commit 2851d2658124bf99d2c4bc1dc6d58a4997d46075 Author: Bruce Guenter Date: Tue Apr 10 11:41:08 2012 -0600 reorg: Move path/path.h INSTHIER | 2 +- bg-installer.c | 2 +- {path => include}/path.h | 2 +- instlib/installer.c | 2 +- selftest-cmp.c | 2 +- selftest.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) rename {path => include}/path.h (96%) commit 8c43a790beba192c6f3df0530ee08b8ba5d208b9 Author: Bruce Guenter Date: Tue Apr 10 11:28:15 2012 -0600 reorg: Move adt/*.h INSTHIER | 7 +++---- adt/adt_sp.c | 2 +- adt/hashb.c | 2 +- adt/hashs.c | 2 +- adt/common.h => include/adt_common.h | 0 {adt => include}/ghash.h | 2 +- {adt => include}/gqueue.h | 2 +- {adt => include}/gstack.h | 2 +- 8 files changed, 9 insertions(+), 10 deletions(-) rename adt/common.h => include/adt_common.h (100%) rename {adt => include}/ghash.h (99%) rename {adt => include}/gqueue.h (98%) rename {adt => include}/gstack.h (98%) commit 3888e254f9313c160c6c2acab63a59804043965c Author: Bruce Guenter Date: Tue Apr 10 10:36:27 2012 -0600 reorg: Move cli/cli.h INSTHIER | 2 +- bg-installer.c | 2 +- cli-generate.pl | 2 +- {cli => include}/cli.h | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename {cli => include}/cli.h (100%) commit 63bf8ad16afd3452d22315a3fd76760caba02f5b Author: Bruce Guenter Date: Tue Apr 10 10:21:25 2012 -0600 reorg: Move msg/*.h INSTHIER | 6 +++--- bg-installer.c | 4 ++-- cli/help.c | 2 +- cli/main.c | 2 +- crc-gentab.c | 2 +- {msg => include}/debug.h | 0 {msg => include}/msg.h | 4 ++-- {msg => include}/wrap.h | 0 instlib/installer.c | 4 ++-- instlib/instcheck.c | 4 ++-- instlib/instshow.c | 4 ++-- path/match.c | 2 +- selftest-cmp.c | 4 ++-- selftest.c | 2 +- 14 files changed, 20 insertions(+), 20 deletions(-) rename {msg => include}/debug.h (100%) rename {msg => include}/msg.h (98%) rename {msg => include}/wrap.h (100%) commit c4f53f460d70cc0a183335de2ce5c1b25e78b3a1 Author: Bruce Guenter Date: Tue Apr 10 09:30:07 2012 -0600 reorg: Move crypto/*.h INSTHIER | 16 ++++++++-------- {crypto => include}/hmac.h | 0 {crypto => include}/md4.h | 0 {crypto => include}/md5.h | 0 {crypto => include}/sha1.h | 3 +-- {crypto => include}/sha256.h | 2 +- {crypto => include}/sha384.h | 4 ++-- {crypto => include}/sha512.h | 2 +- {crypto => include}/surf.h | 4 ++-- {crypto => include}/surfrand.h | 2 +- net/dns_random.c | 2 +- 11 files changed, 17 insertions(+), 18 deletions(-) rename {crypto => include}/hmac.h (100%) rename {crypto => include}/md4.h (100%) rename {crypto => include}/md5.h (100%) rename {crypto => include}/sha1.h (97%) rename {crypto => include}/sha256.h (93%) rename {crypto => include}/sha384.h (84%) rename {crypto => include}/sha512.h (94%) rename {crypto => include}/surf.h (89%) rename {crypto => include}/surfrand.h (97%) commit 44a86b3dd33259d9e5c6d9601c67a18e57afb325 Author: Bruce Guenter Date: Tue Apr 10 09:10:26 2012 -0600 reorg: Move crc/*.h INSTHIER | 14 +++++++------- {crc => include}/crc16_arc.h | 2 +- {crc => include}/crc16_ccitt.h | 2 +- {crc => include}/crc16_xmodem.h | 2 +- {crc => include}/crc32.h | 4 ++-- {crc => include}/crc32c.h | 2 +- {crc => include}/crc64.h | 2 +- {crc => include}/gcrc.h | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) rename {crc => include}/crc16_arc.h (93%) rename {crc => include}/crc16_ccitt.h (94%) rename {crc => include}/crc16_xmodem.h (94%) rename {crc => include}/crc32.h (90%) rename {crc => include}/crc32c.h (94%) rename {crc => include}/crc64.h (96%) rename {crc => include}/gcrc.h (95%) commit 2204474938e1d53306b4428ba134eb17f9d1b587 Author: Bruce Guenter Date: Tue Apr 10 09:03:45 2012 -0600 reorg: Move base64/base64.h INSTHIER | 2 +- {base64 => include}/base64.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename {base64 => include}/base64.h (96%) commit 16a03900797e89b4d798ce4750e253e23f59dd88 Author: Bruce Guenter Date: Tue Apr 10 09:00:28 2012 -0600 reorg: Move str/env.h to envstr.h INSTHIER | 2 +- str/env.h => include/envstr.h | 0 str/env_find.c | 2 +- str/env_from_array.c | 2 +- str/env_from_string.c | 2 +- str/env_get.c | 2 +- str/env_make_array.c | 2 +- str/env_put.c | 2 +- str/env_set.c | 2 +- str/env_unset.c | 2 +- 10 files changed, 9 insertions(+), 9 deletions(-) rename str/env.h => include/envstr.h (100%) commit c40e05baca83a4461beb88cace970c0912c921a7 Author: Bruce Guenter Date: Tue Apr 10 08:40:27 2012 -0600 reorg: Move str/iter.h INSTHIER | 2 +- bg-installer.c | 2 +- str/iter.h => include/striter.h | 0 net/dns_mx.c | 2 +- net/dns_name4.c | 2 +- net/dns_name6.c | 2 +- net/dns_resolvconfip.c | 2 +- net/dns_resolvconfrewrite.c | 2 +- path/match.c | 2 +- str/env_find.c | 2 +- str/env_get.c | 2 +- str/env_make_array.c | 2 +- str/iter_advance.c | 2 +- str/iter_start.c | 2 +- str/iter_valid.c | 2 +- 15 files changed, 14 insertions(+), 14 deletions(-) rename str/iter.h => include/striter.h (100%) commit daab2ca3c06f869fbb5cdb74bb89d7f5bac0da1b Author: Bruce Guenter Date: Tue Apr 10 07:35:58 2012 -0600 reorg: Flatten out the include path This will allow internal sources to use just "filename.h" instead of "bglibs/filename.h" base64/base64.h | 2 +- bg-installer.c | 2 +- build-includes | 1 + crypto/hmac-md5.c | 2 +- crypto/hmac-sha1.c | 2 +- crypto/hmac.c | 2 +- crypto/md5.c | 2 +- crypto/sha1.c | 2 +- dict/dict.h | 2 +- dict/str_free.c | 2 +- fmt/chars.c | 2 +- fmt/multi.c | 2 +- instlib/installer.c | 2 +- instlib/instcheck.c | 2 +- instlib/instshow.c | 2 +- net/dns.h | 2 +- path/match.c | 2 +- path/path.h | 2 +- selftest-cmp.c | 2 +- selftest.c | 2 +- str/alloc.c | 2 +- str/buildmap.c | 2 +- str/case_end.c | 2 +- str/case_glob.c | 2 +- str/case_match.c | 2 +- str/case_start.c | 2 +- str/cat.c | 2 +- str/cat2s.c | 2 +- str/cat3s.c | 2 +- str/cat4s.c | 2 +- str/cat5s.c | 2 +- str/cat6s.c | 2 +- str/catf.c | 2 +- str/catiw.c | 2 +- str/catiwll.c | 2 +- str/catns.c | 2 +- str/catsllnum.c | 2 +- str/catsnum.c | 2 +- str/catullnum.c | 2 +- str/catunum.c | 2 +- str/catuw.c | 2 +- str/catuwll.c | 2 +- str/catxw.c | 2 +- str/catxwll.c | 2 +- str/cmp.c | 2 +- str/copy.c | 2 +- str/copy2s.c | 2 +- str/copy3s.c | 2 +- str/copy4s.c | 2 +- str/copy5s.c | 2 +- str/copy6s.c | 2 +- str/copyf.c | 2 +- str/copyns.c | 2 +- str/count.c | 2 +- str/countof.c | 2 +- str/cut.c | 2 +- str/diff.c | 2 +- str/digits.c | 2 +- str/end.c | 2 +- str/env_find.c | 2 +- str/env_from_array.c | 2 +- str/env_from_string.c | 2 +- str/env_get.c | 2 +- str/env_make_array.c | 2 +- str/env_put.c | 2 +- str/env_set.c | 2 +- str/env_unset.c | 2 +- str/findnext.c | 2 +- str/findnextnot.c | 2 +- str/findnextof.c | 2 +- str/findprev.c | 2 +- str/findprevnot.c | 2 +- str/findprevof.c | 2 +- str/free.c | 2 +- str/glob.c | 2 +- str/init.c | 2 +- str/iter_advance.c | 2 +- str/iter_start.c | 2 +- str/iter_valid.c | 2 +- str/join.c | 2 +- str/lower.c | 2 +- str/lstrip.c | 2 +- str/match.c | 2 +- str/rstrip.c | 2 +- str/sort.c | 2 +- str/splice.c | 2 +- str/start.c | 2 +- str/subst.c | 2 +- str/truncate.c | 2 +- str/upper.c | 2 +- str/xlate.c | 2 +- vmailmgr/client.h | 2 +- vmailmgr/vpwentry.h | 2 +- vmailmgr/vpwentry_export.c | 2 +- 94 files changed, 94 insertions(+), 93 deletions(-) commit a6ca643a0ae72b5a5fc54604381dfc7831615668 Author: Bruce Guenter Date: Tue Apr 10 00:23:37 2012 -0600 reorg: Move str/str.h include INSTHIER | 2 +- base64/base64.h | 2 +- bg-installer.c | 2 +- cdb/get.c | 2 +- cdb/getnext.c | 2 +- crypto/hmac-md5.c | 2 +- crypto/hmac-sha1.c | 2 +- crypto/hmac-sha256.c | 2 +- crypto/hmac-sha384.c | 2 +- crypto/hmac-sha512.c | 2 +- crypto/hmac.c | 2 +- crypto/md5.c | 2 +- crypto/sha1.c | 2 +- crypto/sha256.c | 1 - crypto/sha384.c | 1 - crypto/sha512.c | 1 - dict/dict.h | 2 +- dict/load_list.c | 2 +- dict/load_map.c | 2 +- dict/str_free.c | 2 +- fmt/chars.c | 2 +- fmt/multi.c | 2 +- {str => include}/str.h | 0 instlib/installer.c | 2 +- instlib/instcheck.c | 2 +- instlib/instshow.c | 2 +- iobuf/ibuf_getnetstring.c | 2 +- iobuf/ibuf_getstr.c | 2 +- iobuf/ibuf_getstr_crlf.c | 2 +- iobuf/ibuf_openreadclose.c | 2 +- iobuf/ibuf_readall.c | 2 +- net/dns.h | 2 +- path/match.c | 2 +- path/path.h | 2 +- selftest-cmp.c | 2 +- selftest.c | 2 +- str/alloc.c | 2 +- str/buildmap.c | 2 +- str/case_end.c | 2 +- str/case_glob.c | 2 +- str/case_match.c | 2 +- str/case_start.c | 2 +- str/cat.c | 2 +- str/cat2s.c | 2 +- str/cat3s.c | 2 +- str/cat4s.c | 2 +- str/cat5s.c | 2 +- str/cat6s.c | 2 +- str/catf.c | 2 +- str/catiw.c | 2 +- str/catiwll.c | 2 +- str/catns.c | 2 +- str/catsllnum.c | 2 +- str/catsnum.c | 2 +- str/catullnum.c | 2 +- str/catunum.c | 2 +- str/catuw.c | 2 +- str/catuwll.c | 2 +- str/catxw.c | 2 +- str/catxwll.c | 2 +- str/cmp.c | 2 +- str/copy.c | 2 +- str/copy2s.c | 2 +- str/copy3s.c | 2 +- str/copy4s.c | 2 +- str/copy5s.c | 2 +- str/copy6s.c | 2 +- str/copyf.c | 2 +- str/copyns.c | 2 +- str/count.c | 2 +- str/countof.c | 2 +- str/cut.c | 2 +- str/diff.c | 2 +- str/digits.c | 2 +- str/end.c | 2 +- str/env_find.c | 2 +- str/env_from_array.c | 2 +- str/env_from_string.c | 2 +- str/env_get.c | 2 +- str/env_make_array.c | 2 +- str/env_put.c | 2 +- str/env_set.c | 2 +- str/env_unset.c | 2 +- str/findnext.c | 2 +- str/findnextnot.c | 2 +- str/findnextof.c | 2 +- str/findprev.c | 2 +- str/findprevnot.c | 2 +- str/findprevof.c | 2 +- str/free.c | 2 +- str/glob.c | 2 +- str/init.c | 2 +- str/iter_advance.c | 2 +- str/iter_start.c | 2 +- str/iter_valid.c | 2 +- str/join.c | 2 +- str/lower.c | 2 +- str/lstrip.c | 2 +- str/match.c | 2 +- str/rstrip.c | 2 +- str/sort.c | 2 +- str/splice.c | 2 +- str/start.c | 2 +- str/subst.c | 2 +- str/truncate.c | 2 +- str/upper.c | 2 +- str/xlate.c | 2 +- vmailmgr/client.h | 2 +- vmailmgr/vpwentry.h | 2 +- vmailmgr/vpwentry_export.c | 2 +- 110 files changed, 106 insertions(+), 109 deletions(-) rename {str => include}/str.h (100%) commit d73091502ec8cc105f286bcc01c1a53bf6e282b4 Author: Bruce Guenter Date: Mon Apr 9 16:36:12 2012 -0600 reorg: Move iobuf includes INSTHIER | 7 +++---- bg-installer.c | 6 +++--- cdb/make.h | 2 +- cli-generate.pl | 2 +- cli/help.c | 2 +- cli/main.c | 2 +- crc-gentab.c | 2 +- crypto/hmac-sha256.c | 2 +- crypto/hmac-sha384.c | 2 +- crypto/hmac-sha512.c | 2 +- crypto/sha256.c | 2 +- crypto/sha384.c | 2 +- crypto/sha512.c | 2 +- dict/load_list.c | 2 +- dict/load_map.c | 2 +- err/message.c | 2 +- {iobuf => include}/ibuf.h | 2 +- {iobuf => include}/iobuf.h | 6 +++--- iobuf/common.h => include/iobuf_common.h | 0 {iobuf => include}/obuf.h | 2 +- instlib/instmain.c | 2 +- instlib/instshow.c | 2 +- iobuf/ibuf_openreadclose.c | 2 +- iobuf/ibuf_readall.c | 2 +- msg/common.c | 2 +- msg/commonf.c | 2 +- net/dns_resolvconfip.c | 2 +- net/dns_resolvconfrewrite.c | 2 +- selftest-cmp.c | 2 +- selftest.c | 2 +- 30 files changed, 35 insertions(+), 36 deletions(-) rename {iobuf => include}/ibuf.h (98%) rename {iobuf => include}/iobuf.h (80%) rename iobuf/common.h => include/iobuf_common.h (100%) rename {iobuf => include}/obuf.h (99%) commit bfd7231332c376e0c8ab1e9da47c1564554c1c15 Author: Bruce Guenter Date: Mon Apr 9 16:35:43 2012 -0600 reorg: First stage, set up a new include directory for installation INSTHIER | 5 ++++- build-includes | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 build-includes commit c42e26337eef86d8ad5427dee3ab0392084f926f Author: Bruce Guenter Date: Wed Jan 21 15:02:33 2015 -0600 Add a 'programs' make target all.spac | 2 +- programs.spac | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 programs.spac commit e39ca61f2c8f6269707c669eb7de831ed77dbbdd Merge: 3539286 fd77b32 Author: Bruce Guenter Date: Tue Jan 20 13:40:12 2015 -0600 Merge branch 'dns_struct' Conflicts: net/dns_ip6.c commit 3539286abf56c454732f8d0d171c5c52aed23075 Author: Bruce Guenter Date: Tue Jan 20 13:37:41 2015 -0600 net/dns_ip6: Fix bogus short header length on stack net/dns_ip6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 321d0c7f379815efc5d8d3dc91fb182c6fa05013 Author: Bruce Guenter Date: Tue Jan 20 10:08:31 2015 -0600 crypto/surfrand: Fix selftest since words are produced in reverse order crypto/surfrand.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) commit 11694eafdc0b7186c2a1e75a1fbd5faa659d2c18 Author: Bruce Guenter Date: Thu Jan 15 17:07:43 2015 -0600 Remove misleading DNS comment in the TODO TODO | 3 --- 1 file changed, 3 deletions(-) commit fd77b32d664886fdd8aa39c336abe671ddaee236 Author: Bruce Guenter Date: Thu Apr 17 21:49:13 2014 -0600 net/dns: Add test of dns_mx for site with multiple MXs net/dns_mx.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) commit 0b32e269b9f41bae8cea8d4bf4f37cd2d38b8b9b Author: Bruce Guenter Date: Thu Apr 17 21:54:06 2014 -0600 net/dns: Add dns_sort_mx routine libbg-net=l | 1 + net/dns.h | 2 ++ net/dns_sort.c | 13 +++++++++++++ 3 files changed, 16 insertions(+) create mode 100644 net/dns_sort.c commit 95ab280c14e07af58d2a14b6f95fea8c187fa8dc Author: Bruce Guenter Date: Wed Apr 16 21:33:32 2014 -0600 net/resolve: Use the DNS library internally libbg-net=l | 2 +- net/resolve.h | 7 ++++++- net/resolve_calldns.c | 19 +++++++++++++++++++ net/resolve_error.c | 21 --------------------- net/resolve_ipv4addr.c | 23 ++++++++++++++++------- net/resolve_ipv4name.c | 39 +++++++++++++++++++++++++++------------ 6 files changed, 69 insertions(+), 42 deletions(-) create mode 100644 net/resolve_calldns.c delete mode 100644 net/resolve_error.c commit 0840a5bc3ab6289702e78aaecffd9b23f96cf4b2 Author: Bruce Guenter Date: Wed Apr 16 16:46:27 2014 -0600 net/dns: Allocate internal space for result names in single chunk net/dns.h | 7 +++++-- net/dns_ip4.c | 7 ++++--- net/dns_ip6.c | 9 +++++---- net/dns_mx.c | 23 ++++++++++++++++------- net/dns_name_packet.c | 21 +++++++++++++++------ net/dns_packet.c | 33 +++++++++++++++++++++++---------- net/dns_result.c | 42 +++++++++++++++++------------------------- net/dns_txt.c | 23 ++++++++++++++--------- 8 files changed, 99 insertions(+), 66 deletions(-) commit b5d24a37845a7ce91dd13f7c605af916ef3c8b8f Author: Bruce Guenter Date: Tue Apr 15 21:29:19 2014 -0600 net/dns: Return results from main functions in struct dns_result libbg-net=l | 1 + net/dns.h | 86 +++++++++++++++++++++++++++++++++++---------------- net/dns_ip4.c | 46 ++++++++++++++------------- net/dns_ip6.c | 53 +++++++++++++++++-------------- net/dns_mx.c | 41 ++++++++++++------------ net/dns_name4.c | 19 ++++++------ net/dns_name6.c | 19 +++++++----- net/dns_name_packet.c | 15 ++++++--- net/dns_packet.c | 45 +++++++++++++++++---------- net/dns_result.c | 61 ++++++++++++++++++++++++++++++++++++ net/dns_txt.c | 55 +++++++++++++++++++++++--------- 11 files changed, 297 insertions(+), 144 deletions(-) create mode 100644 net/dns_result.c commit ea4b42cb233bec9360a3e3d33a907c60cbb32bc0 Author: Bruce Guenter Date: Sun Apr 20 17:08:23 2014 -0600 net/dns: Use the existing surfrand implementation net/dns_random.c | 58 ++++++++++---------------------------------------------- 1 file changed, 10 insertions(+), 48 deletions(-) commit f987fcad2989465f2f6e3eca417d88e64bd51f96 Author: Bruce Guenter Date: Mon Apr 21 12:23:45 2014 -0600 surfrand: Change "used" counter into number of words left in output crypto/surfrand.c | 8 ++++---- crypto/surfrand.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) commit 4e8ef000414ae324ed08667efce66499ec6f0036 Author: Bruce Guenter Date: Sun Apr 20 17:30:24 2014 -0600 crypto: Add surfrand_uniform function NEWS | 2 ++ crypto/surfrand.c | 22 ++++++++++++++++++++++ crypto/surfrand.h | 1 + 3 files changed, 25 insertions(+) commit 7e0a61500d794d6ba8c2d653ca30c31eb03d3da9 Author: Bruce Guenter Date: Sun Apr 20 17:11:42 2014 -0600 crypto: Unroll inner loop in surfrand crypto/surfrand.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) commit 7aed9fee0ae46f30d20a8e1e0d8c244cf75f6927 Author: Bruce Guenter Date: Tue Apr 15 17:37:03 2014 -0600 selftests: Flush output in NL(), and dump program's output when it dies selftest.c | 2 +- selftests.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) commit 99448fbccc7a9eec83d5c3688f27c494b2618d6b Author: Bruce Guenter Date: Tue Apr 15 16:21:02 2014 -0600 net/dns: Add fmt_dns_domain function libbg-net=l | 1 + net/dns.h | 2 ++ net/dns_domain_todot.c | 36 +++++++----------------------------- net/dns_fmt.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 29 deletions(-) create mode 100644 net/dns_fmt.c commit c3c65aad189c28b4a7594677bc6969a9f67afcfe Author: Bruce Guenter Date: Fri Apr 11 19:20:52 2014 -0600 Rename some variables named "str" to avoid shadowed variable warnings crypto/md4.c | 8 ++++---- crypto/sha1test.c | 4 ++-- misc/strtou.c | 6 +++--- net/ipv4_format.c | 32 ++++++++++++++++---------------- net/ipv4_scan.c | 12 ++++++------ net/ipv6_format.c | 46 +++++++++++++++++++++++----------------------- 6 files changed, 54 insertions(+), 54 deletions(-) commit ec0cb420c08bca31889b30044f20cad8c7013b21 Merge: 560a7d0 402c788 Author: Bruce Guenter Date: Fri Apr 11 17:45:48 2014 -0600 Merge branch 'dns' commit 402c788df8e3b2aec068eb1723a73854ef4b2889 Author: Bruce Guenter Date: Thu Apr 10 09:01:44 2014 -0600 net/dns: Add documentation net/dns.h | 87 ++++++++++++++++++++++++++++++++++++++++----- net/dns_domain.c | 6 ++++ net/dns_domain_fromdot.c | 1 + net/dns_domain_todot.c | 1 + net/dns_ip4.c | 5 +++ net/dns_ip6.c | 5 +++ net/dns_mx.c | 5 +++ net/dns_name4.c | 4 +++ net/dns_name4_domain.c | 1 + net/dns_name6.c | 4 +++ net/dns_name6_domain.c | 1 + net/dns_name_packet.c | 1 + net/dns_packet.c | 16 +++++++++ net/dns_qualify.c | 26 ++++++++++++++ net/dns_random.c | 2 ++ net/dns_resolvconfip.c | 3 ++ net/dns_resolvconfrewrite.c | 18 ++++++++++ net/dns_resolve.c | 7 ++++ net/dns_rotate.c | 8 +++++ net/dns_transmit.c | 15 ++++++++ net/dns_txt.c | 5 +++ 21 files changed, 212 insertions(+), 9 deletions(-) commit c69b5fc6051e0036f060445a0de4fd54b6f6e53e Author: Bruce Guenter Date: Fri Apr 11 16:53:22 2014 -0600 net/dns: Use a dns_*_r function in dns_qualify{_rules} net/dns.h | 6 ++++-- net/dns_qualify.c | 12 ++++++++---- net/dns_resolvconfrewrite.c | 3 ++- 3 files changed, 14 insertions(+), 7 deletions(-) commit d1cb8a210d7fe2f14e51336d63bfbdc2f3d0b922 Author: Bruce Guenter Date: Fri Apr 11 13:26:59 2014 -0600 net/dns: Add another const marker to dns_transmit_io net/dns.h | 2 +- net/dns_transmit.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) commit 8fedff654f6c330da94eed30a4ade0f7cb2d867e Author: Bruce Guenter Date: Fri Apr 11 12:32:38 2014 -0600 net/dns: Allow NULL localip in dns_transmit_start net/dns_resolve.c | 4 +--- net/dns_transmit.c | 5 ++++- 2 files changed, 5 insertions(+), 4 deletions(-) commit 560a7d0e967ebdf3f845d8766182c04c41a21703 Author: Bruce Guenter Date: Thu Apr 10 09:02:02 2014 -0600 config.dxy: Upgrade with current version of doxygen config.dxy | 1793 ++++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 1076 insertions(+), 717 deletions(-) commit 61098422c2b37ff4c853a0ee775497fd374f856c Author: Bruce Guenter Date: Mon Apr 7 15:10:57 2014 -0600 net/dns: Add dns_ip6 function libbg-net=l | 1 + net/dns.h | 3 +++ net/dns_ip6.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 net/dns_ip6.c commit 96995f76aaa7126203f1ddc681ed1dc74917edee Author: Bruce Guenter Date: Mon Apr 7 17:23:59 2014 -0600 net/dns: Simplify IP literal parsing in dns_ip4 net/dns_ip4.c | 40 +++++++++------------------------------- 1 file changed, 9 insertions(+), 31 deletions(-) commit 50533ba2cee014876dc9c3f28c2b22cf2bef9b6f Author: Bruce Guenter Date: Sun Apr 6 01:56:21 2014 -0600 net/dns: Add dns_name6 functions libbg-net=l | 3 +++ net/dns.h | 11 ++++++++--- net/dns_name4.c | 18 +----------------- net/dns_name6.c | 38 ++++++++++++++++++++++++++++++++++++++ net/dns_name6_domain.c | 20 ++++++++++++++++++++ net/dns_name_packet.c | 19 +++++++++++++++++++ 6 files changed, 89 insertions(+), 20 deletions(-) create mode 100644 net/dns_name6.c create mode 100644 net/dns_name6_domain.c create mode 100644 net/dns_name_packet.c commit aecf7cf49ba7876452d99b0c20a2ff58ece4ac22 Author: Bruce Guenter Date: Sun Apr 6 07:46:13 2014 -0600 net/dns: Rename dns_sortip to dns_rotateipv4 and add dns_rotateipv6 libbg-net=l | 2 +- net/dns.h | 4 +++- net/dns_ip4.c | 2 +- net/dns_rotate.c | 28 ++++++++++++++++++++++++++++ net/dns_sortip.c | 21 --------------------- 5 files changed, 33 insertions(+), 24 deletions(-) create mode 100644 net/dns_rotate.c delete mode 100644 net/dns_sortip.c commit 8b2b7c143f13515b1832e3f10a2e28c94e498cee Author: Bruce Guenter Date: Sat Apr 5 08:48:33 2014 -0600 net/dns: Merge common dns packet extraction code into new function net/dns.h | 2 ++ net/dns_ip4.c | 38 +++++++++++++------------------------- net/dns_mx.c | 46 +++++++++++++++------------------------------- net/dns_name4.c | 41 ++++++++++++----------------------------- net/dns_packet.c | 30 ++++++++++++++++++++++++++++++ net/dns_txt.c | 56 ++++++++++++++++++++------------------------------------ 6 files changed, 92 insertions(+), 121 deletions(-) commit 0006be8ac1547a8f038fe7c89a18f03b751ec57f Author: Bruce Guenter Date: Fri Apr 4 14:02:11 2014 -0600 net/dns: Add selftests net/dns_ip4.c | 25 ++++++++++++++++++ net/dns_mx.c | 21 +++++++++++++++ net/dns_name4.c | 17 ++++++++++++ net/dns_resolvconfip.c | 64 +++++++++++++++++++++++++++++++++++++++++++++ net/dns_resolvconfrewrite.c | 64 +++++++++++++++++++++++++++++++++++++++++++++ net/dns_txt.c | 14 ++++++++++ selftest.c | 13 +++++++++ 7 files changed, 218 insertions(+) commit 7134925883d63f5c8d800545f4371ef9f960df7d Author: Bruce Guenter Date: Fri Apr 4 16:23:10 2014 -0600 net/dns: Rewrite dns_ip4_qualify to be more generic, supporting other functions libbg-net=l | 2 +- net/dns.h | 4 ++-- net/{dns_ip4_qualify.c => dns_qualify.c} | 11 ++++++----- 3 files changed, 9 insertions(+), 8 deletions(-) rename net/{dns_ip4_qualify.c => dns_qualify.c} (80%) commit 14217d7cdd49a9072f08d75d2bf2cbe61523c4e8 Author: Bruce Guenter Date: Fri Apr 4 14:59:02 2014 -0600 net/dns: Support overriding location of /etc/resolv.conf with $DNSRESOLVCONF net/dns.h | 1 + net/dns_resolvconfip.c | 11 ++++++++++- net/dns_resolvconfrewrite.c | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) commit d9cb4e20020f73984cca9deb4059986c3d1252c6 Author: Bruce Guenter Date: Fri Apr 4 14:52:05 2014 -0600 net/dns: IP addresses in $DNSCACHEIP are separated by ',' not '.' net/dns_resolvconfip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 0856c67494f1c7406ef2da3b34f19541065e9961 Author: Bruce Guenter Date: Fri Apr 4 13:51:09 2014 -0600 net/dns: Eliminate another static in the main dns query paths net/dns_ip4.c | 9 ++++----- net/dns_mx.c | 15 ++++++++------- net/dns_name4.c | 10 +++++----- net/dns_txt.c | 9 ++++----- 4 files changed, 21 insertions(+), 22 deletions(-) commit df43a7140f1288838d57f860763ab4586420e580 Author: Bruce Guenter Date: Fri Apr 4 12:29:45 2014 -0600 net/dns: Eliminate the dns_transmit_tx global, adding (semi)reentrant functions net/dns.h | 16 ++++++++++++++-- net/dns_ip4.c | 10 ++++++---- net/dns_mx.c | 10 ++++++---- net/dns_name4.c | 10 ++++++---- net/dns_resolve.c | 10 ++++------ net/dns_txt.c | 9 +++++---- 6 files changed, 41 insertions(+), 24 deletions(-) commit e0ff3ae414cc08270a8b1df8933ed0e4ee929ff3 Author: Bruce Guenter Date: Fri Apr 4 11:44:11 2014 -0600 net/dns: Convert text input parameters to char* for ease of calling net/dns.h | 10 +++++----- net/dns_ip4.c | 12 +++++++----- net/dns_ip4_qualify.c | 10 +++++----- net/dns_mx.c | 4 ++-- net/dns_txt.c | 4 ++-- 5 files changed, 21 insertions(+), 19 deletions(-) commit 57e8c639159d87948e801309048ce493486473b4 Author: Bruce Guenter Date: Fri Apr 4 11:21:13 2014 -0600 net/dns_random: Auto-initialize on first use net/dns_random.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) commit c94c90ada9f685cc6bedfddf04da2ae6015add1c Author: Bruce Guenter Date: Fri Apr 4 09:28:12 2014 -0600 net/dns: Add defined constants for some hard-coded limits net/dns.h | 9 ++++++--- net/dns_random.c | 2 +- net/dns_resolvconfip.c | 6 +++--- net/dns_resolve.c | 2 +- net/dns_transmit.c | 6 +++--- 5 files changed, 14 insertions(+), 11 deletions(-) commit c0aaf827bdb374218ad1f3e057b89a81133dbe5c Author: Bruce Guenter Date: Fri Apr 4 08:51:56 2014 -0600 net/dns: Convert DNS class/type constants from strings into integers net/dns.h | 39 ++++++++++++++++++++------------------- net/dns_ip4.c | 5 ++--- net/dns_mx.c | 5 ++--- net/dns_name4.c | 5 ++--- net/dns_resolve.c | 2 +- net/dns_transmit.c | 13 ++++++------- net/dns_txt.c | 5 ++--- 7 files changed, 35 insertions(+), 39 deletions(-) commit f2b835979e4971a804fee2df2328ba74ed2fc443 Author: Bruce Guenter Date: Thu Apr 3 19:49:39 2014 -0600 net/dns: Rewrite some string splitting loops using striter net/dns_resolvconfip.c | 31 ++++++++--------- net/dns_resolvconfrewrite.c | 81 ++++++++++++++++++++++----------------------- 2 files changed, 53 insertions(+), 59 deletions(-) commit e3529462f6cb7dfdaa6ac6f2f873b8c82f390eac Author: Bruce Guenter Date: Fri Apr 4 08:40:52 2014 -0600 net/dns: Resolve some signed/unsigned char pointer issues a different way net/dns.h | 2 +- net/dns_ip4.c | 8 ++++---- net/dns_mx.c | 10 +++++----- net/dns_name4.c | 6 +++--- net/dns_packet.c | 2 +- net/dns_transmit.c | 6 +++--- net/dns_txt.c | 6 +++--- 7 files changed, 20 insertions(+), 20 deletions(-) commit 531b0594c8c5e7f7951cbf6f558575fc74148fad Author: Bruce Guenter Date: Thu Apr 3 19:12:10 2014 -0600 net/dns: Eliminate some warnings net/dns_domain.c | 2 +- net/dns_mx.c | 4 ++-- net/dns_resolve.c | 2 +- net/dns_transmit.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) commit 4a103e74ed3c3d7b9b4f375e60be66666a9aec02 Author: Bruce Guenter Date: Thu Apr 3 19:03:58 2014 -0600 net/dns: Eliminate use of DJB case library net/dns_domain.c | 3 +-- net/dns_ip4_qualify.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) commit 4e296c3fbc545eb43dea9c08b83d638ed1541752 Author: Bruce Guenter Date: Thu Apr 3 16:02:05 2014 -0600 net/dns: Eliminate use of DNS tai/taia libraries net/dns.h | 10 ++++++---- net/dns_random.c | 11 ++++------- net/dns_resolvconfip.c | 13 ++++++------- net/dns_resolvconfrewrite.c | 13 ++++++------- net/dns_resolve.c | 27 ++++++++++++--------------- net/dns_transmit.c | 26 ++++++++++---------------- 6 files changed, 44 insertions(+), 56 deletions(-) commit 6f08002c361911cd9d17064f33b2fd55c04b491d Author: Bruce Guenter Date: Thu Apr 3 16:01:44 2014 -0600 net/dns: Eliminate use of DJB openreadclose function net/dns_resolvconfip.c | 4 ++-- net/dns_resolvconfrewrite.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) commit 2c54099a8219bb3395ae1100d1e59ab1207c4ad1 Author: Bruce Guenter Date: Thu Apr 3 16:01:28 2014 -0600 net/dns: Eliminate use of DJB ip4+socket libraries, and use ipv4addr addresses net/dns.h | 15 ++++++++------- net/dns_ip4.c | 2 +- net/dns_name4.c | 2 +- net/dns_name4_domain.c | 10 +++++----- net/dns_resolvconfip.c | 26 ++++++++++++-------------- net/dns_resolve.c | 6 ++++-- net/dns_sortip.c | 10 +++++----- net/dns_transmit.c | 20 ++++++++++---------- 8 files changed, 46 insertions(+), 45 deletions(-) commit 5cf915ab0e99cb7931d4cdfed2722d12007d5e6e Author: Bruce Guenter Date: Thu Apr 3 16:00:59 2014 -0600 net/dns: Internalize DJB iopause library net/dns.h | 6 +++--- net/dns_resolve.c | 26 ++++++++++++++++++++++++-- net/dns_transmit.c | 8 ++++---- 3 files changed, 31 insertions(+), 9 deletions(-) commit d1d05c399e518ed54a24e814f4cce1f74dd26562 Author: Bruce Guenter Date: Thu Apr 3 16:00:19 2014 -0600 net/dns: Eliminate use of DJB fmt library net/dns_name4_domain.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) commit 559fb8db6ea598e5a625c28b28ecb5a3c4a38aa5 Author: Bruce Guenter Date: Thu Apr 3 16:00:00 2014 -0600 net/dns: Eliminate use of DJB error library net/dns_domain.c | 2 +- net/dns_domain_fromdot.c | 4 ++-- net/dns_packet.c | 9 +++++---- net/dns_transmit.c | 14 +++++++------- 4 files changed, 15 insertions(+), 14 deletions(-) commit 2c2b6cf2831755b2c50b260962e21fb94acec6b7 Author: Bruce Guenter Date: Thu Apr 3 15:59:42 2014 -0600 net/dns: Eliminate use of DJB env library net/dns_resolvconfip.c | 4 ++-- net/dns_resolvconfrewrite.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) commit 648359defc9101a802e42c49406255cc6b90e1ad Author: Bruce Guenter Date: Thu Apr 3 15:59:26 2014 -0600 net/dns: Eliminate use of DJB byte library net/dns_domain.c | 4 ++-- net/dns_domain_fromdot.c | 8 ++++---- net/dns_ip4.c | 7 ++++--- net/dns_ip4_qualify.c | 18 ++++++++++-------- net/dns_mx.c | 7 ++++--- net/dns_name4.c | 7 ++++--- net/dns_name4_domain.c | 5 +++-- net/dns_resolvconfip.c | 11 ++++++----- net/dns_resolvconfrewrite.c | 9 +++++---- net/dns_resolve.c | 3 ++- net/dns_sortip.c | 9 +++++---- net/dns_transmit.c | 26 +++++++++++++------------- net/dns_txt.c | 7 ++++--- 13 files changed, 66 insertions(+), 55 deletions(-) commit 7ee4b144703dfc870f7aa182a7746da3e7c304a7 Author: Bruce Guenter Date: Thu Apr 3 15:59:01 2014 -0600 net/dns: Eliminate use of DJB alloc library net/dns_domain.c | 9 +++++---- net/dns_domain_fromdot.c | 7 ++++--- net/dns_transmit.c | 19 ++++++++++--------- 3 files changed, 19 insertions(+), 16 deletions(-) commit 4ff8f67091a4b2398cdaac12a6a9f779b3569a2d Author: Bruce Guenter Date: Thu Apr 3 15:58:42 2014 -0600 net/dns: Eliminate use of DJB uint## libraries net/dns_ip4.c | 4 ++-- net/dns_mx.c | 4 ++-- net/dns_name4.c | 4 ++-- net/dns_random.c | 4 ++-- net/dns_transmit.c | 2 +- net/dns_txt.c | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) commit fb786466d0fcfc17d4d63ec2a636050b2add5589 Author: Bruce Guenter Date: Thu Apr 3 15:58:21 2014 -0600 net/dns: Eliminate use of DJB stralloc library net/dns.h | 26 ++++++++++---------- net/dns_domain_todot.c | 11 ++++----- net/dns_ip4.c | 13 +++++----- net/dns_ip4_qualify.c | 13 +++++----- net/dns_mx.c | 11 ++++----- net/dns_name4.c | 7 +++--- net/dns_resolvconfip.c | 4 ++-- net/dns_resolvconfrewrite.c | 58 ++++++++++++++++++++++----------------------- net/dns_txt.c | 9 ++++--- 9 files changed, 73 insertions(+), 79 deletions(-) commit 886c72d936a315a1d9af2f69d78f46e22b1c7f24 Author: Bruce Guenter Date: Thu Apr 3 15:57:58 2014 -0600 net/dns: Eliminate use of DJB str library net/dns_ip4_qualify.c | 9 ++++++--- net/dns_resolvconfrewrite.c | 9 +++++---- 2 files changed, 11 insertions(+), 7 deletions(-) commit 0c4ec4bdf8c95da00983e67d97fdd12d2da85449 Author: Bruce Guenter Date: Thu Apr 3 20:01:23 2014 -0600 net/dns: Rename several files to more descriptive names libbg-net=l | 16 ++++++++-------- net/dns.h | 2 +- net/{dns_dfd.c => dns_domain_fromdot.c} | 0 net/{dns_dtda.c => dns_domain_todot.c} | 0 net/{dns_ip.c => dns_ip4.c} | 0 net/{dns_ipq.c => dns_ip4_qualify.c} | 0 net/{dns_name.c => dns_name4.c} | 4 ++-- net/{dns_nd.c => dns_name4_domain.c} | 0 net/{dns_rcip.c => dns_resolvconfip.c} | 0 net/{dns_rcrw.c => dns_resolvconfrewrite.c} | 0 10 files changed, 11 insertions(+), 11 deletions(-) rename net/{dns_dfd.c => dns_domain_fromdot.c} (100%) rename net/{dns_dtda.c => dns_domain_todot.c} (100%) rename net/{dns_ip.c => dns_ip4.c} (100%) rename net/{dns_ipq.c => dns_ip4_qualify.c} (100%) rename net/{dns_name.c => dns_name4.c} (87%) rename net/{dns_nd.c => dns_name4_domain.c} (100%) rename net/{dns_rcip.c => dns_resolvconfip.c} (100%) rename net/{dns_rcrw.c => dns_resolvconfrewrite.c} (100%) commit a39a5057da01aa78213a3b2069555b47b70c12d7 Author: Bruce Guenter Date: Thu Apr 3 15:55:54 2014 -0600 net: Initial commit of DNS library, copied from public domain djbdns-1.05 INSTHIER | 1 + NEWS | 2 + libbg-net=l | 16 +++ net/dns.h | 84 ++++++++++++ net/dns_dfd.c | 69 ++++++++++ net/dns_domain.c | 74 +++++++++++ net/dns_dtda.c | 35 +++++ net/dns_ip.c | 75 +++++++++++ net/dns_ipq.c | 71 +++++++++++ net/dns_mx.c | 49 +++++++ net/dns_name.c | 48 +++++++ net/dns_nd.c | 24 ++++ net/dns_packet.c | 77 +++++++++++ net/dns_random.c | 63 +++++++++ net/dns_rcip.c | 86 +++++++++++++ net/dns_rcrw.c | 131 +++++++++++++++++++ net/dns_resolve.c | 29 +++++ net/dns_sortip.c | 20 +++ net/dns_transmit.c | 366 +++++++++++++++++++++++++++++++++++++++++++++++++++++ net/dns_txt.c | 59 +++++++++ 20 files changed, 1379 insertions(+) create mode 100644 net/dns.h create mode 100644 net/dns_dfd.c create mode 100644 net/dns_domain.c create mode 100644 net/dns_dtda.c create mode 100644 net/dns_ip.c create mode 100644 net/dns_ipq.c create mode 100644 net/dns_mx.c create mode 100644 net/dns_name.c create mode 100644 net/dns_nd.c create mode 100644 net/dns_packet.c create mode 100644 net/dns_random.c create mode 100644 net/dns_rcip.c create mode 100644 net/dns_rcrw.c create mode 100644 net/dns_resolve.c create mode 100644 net/dns_sortip.c create mode 100644 net/dns_transmit.c create mode 100644 net/dns_txt.c commit dfb477f7843efa3ea530b42f1b94afa022e3322c Author: Bruce Guenter Date: Wed Apr 9 17:11:07 2014 -0600 net: Eliminate strict-aliasing warnings in recvfd and sendfd net/recvfd.c | 4 +++- net/sendfd.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) commit 20d18d40dbc408f8db1a34813faaa54fdc36f747 Author: Bruce Guenter Date: Wed Apr 9 17:09:56 2014 -0600 crypto: Use uint32_pack_lsb to eliminate strict-aliasing warning crypto/md4.c | 14 +++++++------- crypto/md5.c | 16 +++++++++------- 2 files changed, 16 insertions(+), 14 deletions(-) commit bbfe4a4121144e64467211c2304a7d041a4453aa Author: Bruce Guenter Date: Wed Apr 9 11:16:09 2014 -0600 path: Simplify fnmatch selftest path/fnmatch.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) commit 65f577ac24d61643b63d86273d1caefaf54eba4d Author: Bruce Guenter Date: Tue Apr 8 08:33:09 2014 -0600 selftests: Compare results using a new selftest-cmp program This new program optionally compares expected output with fnmatch style patterns, allowing for more flexible result testing in the presence of varying results. .gitignore | 1 + path/match.c | 12 +++---- selftest-cmp.c | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ selftest-cmp=x | 2 ++ selftests.sh | 7 ++-- selftests.spac | 2 +- 6 files changed, 116 insertions(+), 10 deletions(-) create mode 100644 selftest-cmp.c create mode 100644 selftest-cmp=x commit 7fe38d75e20165e14581cc23118df831a7aedc95 Author: Bruce Guenter Date: Mon Apr 7 17:35:19 2014 -0600 net: Switch IPv6 output format to use IETF recommended lower-case net/ipv6_format.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) commit ee3580afdaad3a0d08f8898b07afc60407f10c89 Author: Bruce Guenter Date: Mon Apr 7 15:07:52 2014 -0600 net: Rename ipv6_isv4addr to ipv6_isv4mapped net/ipv6.h | 2 +- net/ipv6_addr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) commit 21a3c799ab5a1131c3e408fcc745dcabbe546713 Author: Bruce Guenter Date: Sun Apr 6 01:39:18 2014 -0600 net/ipv6: Add bits to test for IPv4-in-IPv6 addresses net/ipv6.h | 2 ++ net/ipv6_addr.c | 10 ++++++++++ 2 files changed, 12 insertions(+) commit f897b39c8e6ca028ac4703f4b377ecbce429888a Author: Bruce Guenter Date: Sat Apr 5 19:46:29 2014 -0600 net/ipv6: Fix typos in IPV6ADDR constants net/ipv6_addr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) commit 4b44336d9fc733d53b38f1ae2f3fe3926c7e9975 Author: Bruce Guenter Date: Sat Apr 5 16:42:01 2014 -0600 net: Fix typo in ipv6 header net/ipv6.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit fd33c6cafafe59ece6ed2580bc4a41e05567af81 Author: Bruce Guenter Date: Fri Apr 4 14:38:32 2014 -0600 Automatically #include "selftest.c" when compiling for selftests adt/ghash_test.c | 1 - adt/gqueue_test.c | 1 - adt/gstack_test.c | 1 - crc/gcrc16fwd.c | 1 - crc/gcrc16rfl.c | 1 - crc/gcrc32rfl.c | 1 - crc/gcrc64fwd.c | 1 - crypto/hmac-md5.c | 3 +-- crypto/hmac-sha1.c | 1 - crypto/hmac-sha256.c | 4 +--- crypto/hmac-sha384.c | 4 +--- crypto/hmac-sha512.c | 4 +--- crypto/md4.c | 3 +-- crypto/md5.c | 3 +-- crypto/sha1.c | 1 - crypto/sha1test.c | 3 +-- crypto/sha256.c | 4 +--- crypto/sha384.c | 4 +--- crypto/sha512.c | 4 +--- crypto/surf.c | 1 - crypto/surfrand.c | 1 - fmt/char.c | 1 - fmt/chars.c | 1 - fmt/multi.c | 1 - fmt/sign_pad.c | 1 - fmt/sllnum.c | 1 - fmt/snum.c | 1 - fmt/ullnum.c | 1 - fmt/unum.c | 1 - iobuf/ibuf_getc.c | 1 - iobuf/ibuf_getnetstring.c | 1 - iobuf/ibuf_gets.c | 1 - iobuf/ibuf_getstr_crlf.c | 1 - iobuf/iobuf_init.c | 1 - iobuf/obuf_put2s.c | 1 - iobuf/obuf_put3s.c | 1 - iobuf/obuf_put4s.c | 1 - iobuf/obuf_put5s.c | 1 - iobuf/obuf_put6s.c | 1 - iobuf/obuf_put7s.c | 1 - iobuf/obuf_putf.c | 1 - iobuf/obuf_putns.c | 1 - iobuf/obuf_putsllnumw.c | 1 - iobuf/obuf_putsnumw.c | 1 - iobuf/obuf_putullnumw.c | 1 - iobuf/obuf_putunumw.c | 1 - iobuf/obuf_sign_pad.c | 1 - iobuf/obuf_write.c | 1 - misc/strtou.c | 1 - misc/ucspi.c | 1 - misc/utoa.c | 1 - misc/utoa2.c | 1 - msg/common.c | 1 - msg/commonf.c | 1 - msg/wrap_alloc.c | 1 - msg/wrap_chdir.c | 1 - msg/wrap_str.c | 1 - net/connect4.c | 1 - net/ipv4_format.c | 1 - net/ipv4_scan.c | 1 - net/ipv6_format.c | 1 - net/ipv6_scan.c | 1 - net/tcp4.c | 1 - path/fnmatch.c | 1 - path/match.c | 1 - path/merge.c | 1 - selftest.c | 6 +++++- selftests.sh | 2 +- str/alloc.c | 1 - str/case_end.c | 1 - str/case_glob.c | 1 - str/case_match.c | 1 - str/case_start.c | 1 - str/cat2s.c | 1 - str/cat3s.c | 1 - str/cat4s.c | 1 - str/cat5s.c | 1 - str/cat6s.c | 1 - str/catf.c | 1 - str/catns.c | 1 - str/copy.c | 1 - str/copy2s.c | 1 - str/copy3s.c | 1 - str/copy4s.c | 1 - str/copy5s.c | 1 - str/copy6s.c | 1 - str/copyf.c | 1 - str/copyns.c | 1 - str/end.c | 1 - str/env_find.c | 1 - str/env_from_array.c | 1 - str/env_from_string.c | 1 - str/env_get.c | 1 - str/env_make_array.c | 1 - str/env_put.c | 1 - str/env_set.c | 1 - str/env_unset.c | 1 - str/findnext.c | 1 - str/findnextof.c | 1 - str/findprev.c | 1 - str/findprevnot.c | 1 - str/findprevof.c | 1 - str/free.c | 1 - str/glob.c | 1 - str/init.c | 1 - str/join.c | 1 - str/match.c | 1 - str/splice.c | 1 - str/start.c | 1 - str/xlate.c | 1 - unix/fcntl.c | 1 - unix/selfpipe.c | 1 - unix/signalfd.c | 1 - 113 files changed, 16 insertions(+), 129 deletions(-) commit 45d7ad76e8346e8ea1a3373d1cbdd40930d35708 Author: Bruce Guenter Date: Tue Apr 1 18:12:30 2014 -0600 Add a template CLI source file for reference documentation EXTRADIST | 1 + template.cli | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 EXTRADIST create mode 100644 template.cli commit c17e8d5c6e95e25c6e4d8bbe010901925ab27dac Author: Bruce Guenter Date: Tue Apr 1 13:40:38 2014 -0600 bg-installer: Use cli-generate to make/install a man page %.1.spac | 7 +++++++ .gitignore | 1 + INSTHIER | 1 + all.spac | 2 +- man.spac | 1 + 5 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 %.1.spac create mode 100644 man.spac commit 39adf3d2e51edb549b10c14ebfd90acd843237b9 Author: Bruce Guenter Date: Tue Apr 1 10:18:30 2014 -0600 bg-installer: Use cli-generate to generate CLI interface %-cli.c.spac | 2 + %-cli.h.spac | 2 + .gitignore | 1 + bg-installer.c | 77 +------------------------------- bg-installer.cli | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 141 insertions(+), 75 deletions(-) create mode 100644 %-cli.c.spac create mode 100644 %-cli.h.spac create mode 100644 bg-installer.cli commit e52a6ecd884ca7579c59000167adda8c32e5792a Author: Bruce Guenter Date: Tue Apr 1 07:51:44 2014 -0600 cli-generate: Rewrite text section parsing to add support for itemize and enumerate NEWS | 2 + cli-generate.pl | 178 +++++++++++++++++++++++++++++++++----------------------- 2 files changed, 108 insertions(+), 72 deletions(-) commit 732e56e61640d840ac94dbbf434aae2c501838a5 Author: Bruce Guenter Date: Mon Mar 31 12:26:56 2014 -0600 cli-generate: Fix HTML output of @example sections cli-generate.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 6ba113c602615e9184d1c30ba2363732413461e2 Author: Bruce Guenter Date: Thu Mar 27 10:25:40 2014 -0600 Don't warn about unused return values conf-cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 823a31387eb4bfe8d6e7aad2b43c3dcd0175783f Author: Bruce Guenter Date: Thu Mar 27 10:18:40 2014 -0600 cli-generate: Fix handling of sections in HTML output cli-generate.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) commit 0e36002d3a64e7615e2f6787e5fcaff8797e54ca Author: Bruce Guenter Date: Sat Feb 22 10:24:36 2014 -0600 cli-generate: Parse tags in more places for C and man output cli-generate.pl | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) commit c7acae9d1483fbf48c2eef79a74c27bddeaef987 Author: Bruce Guenter Date: Fri Feb 21 14:30:45 2014 -0600 sys/getpeereid.c: Eliminate a parameter warning sys/getpeereid.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) commit 5180a6b69bf7f29f9aaa49afd9dad82682c7f153 Author: Bruce Guenter Date: Fri Feb 21 14:26:36 2014 -0600 README: Note development is on GitHub README.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) commit 60b060c321ea37c8604edd3e04c592152fcee6ec Author: Bruce Guenter Date: Tue Apr 10 00:18:24 2012 -0600 Ignore ltcompile and ltload instead of libcompile .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) commit a877158bbd1b332463ff44d0df48db6bec76cfc9 Author: Bruce Guenter Date: Tue Apr 10 00:16:43 2012 -0600 bg-installer: Add support for substitutions in the dest filename NEWS | 2 +- bg-installer.c | 50 +++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 46 insertions(+), 6 deletions(-) commit 3dd689f38392fac4f104bfe70a4a0ca82beef3e0 Author: Bruce Guenter Date: Tue Apr 10 00:04:36 2012 -0600 bg-installer: Tweak makepath to take a destination string parameter bg-installer.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) commit ff30912d1853ab2c2854469282174fa19ca95277 Author: Bruce Guenter Date: Mon Apr 9 23:56:59 2012 -0600 bg-installer: Add wildcard handling If the source filename has wildcards, the line is repeated once for each matching filename. Not too useful as it stands right now, substitution is coming. NEWS | 2 ++ bg-installer.c | 34 +++++++++++++++++++++++++++++----- 2 files changed, 31 insertions(+), 5 deletions(-) commit e4cfd39730886dd45a0e5d21fad677bcbbf7105e Author: Bruce Guenter Date: Mon Apr 9 17:18:49 2012 -0600 bg-installer: Reorganize the main loop bg-installer.c | 163 ++++++++++++++++++++++++++++++--------------------------- 1 file changed, 87 insertions(+), 76 deletions(-) commit 4e5067da2bb2b439c4c93965c7866498d4577e8b Author: Bruce Guenter Date: Mon Apr 9 16:27:38 2012 -0600 instlib: Fix compile problem with conflicting redefinition of opendir The system include declares opendir, but the declaration in instlib/installer.h conflicts. The naming choice on my part was unfortunate. instlib/installer.c | 3 +++ instlib/instcheck.c | 3 +++ instlib/instshow.c | 3 +++ 3 files changed, 9 insertions(+) commit f1e11652275d7f8d2f034d35c8f4cdf19c328028 Author: Bruce Guenter Date: Wed Apr 4 09:01:37 2012 -0600 msg: Mark die functions as "noreturn" This can fix warnings where a die will effectively terminate a loop or function but the compiler doesn't see that. msg/msg.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) commit 7f53b6143caf835e5231b8599ea5253db631446c Author: Bruce Guenter Date: Tue Jan 4 10:19:24 2011 -0600 sysdeps.h: Add test for noreturn attribute sys/hasnoreturn.h0 | 2 ++ sys/hasnoreturn.h1 | 2 ++ sys/trynoreturn.c | 1 + sysdeps.h.spac | 3 ++- 4 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 sys/hasnoreturn.h0 create mode 100644 sys/hasnoreturn.h1 create mode 100644 sys/trynoreturn.c commit 399527ffb98a858602115bb5296711402fd61cab Author: Bruce Guenter Date: Tue Dec 28 14:51:23 2010 -0600 Add TODO note about better hash functions TODO | 4 ++++ 1 file changed, 4 insertions(+) commit a40c0baaf9876a4918661faa543659a63c5e6aad Author: Jorge Valdes Date: Tue Dec 28 12:01:38 2010 -0600 net: Add reversed IPv4 format functions. NEWS | 1 + net/ipv4.h | 2 ++ net/ipv4_format.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 50 insertions(+), 2 deletions(-) commit 02ba61d3f543a082c887332bebd10c00b3c780a7 Author: Bruce Guenter Date: Mon Dec 27 23:14:09 2010 -0600 fmt: Add support for calling arbitrary functions within fmt_multiv NEWS | 2 ++ fmt/multi.c | 24 ++++++++++++++++++++++-- fmt/multi.h | 6 ++++++ 3 files changed, 30 insertions(+), 2 deletions(-) commit 0077ff52231432ea513671739aa7923c1f12c774 Author: Bruce Guenter Date: Tue Dec 28 08:58:13 2010 -0600 Upgrade the Doxygen config for version 1.5.8 config.dxy | 394 ++++++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 297 insertions(+), 97 deletions(-) commit d898a5d147471b030dd61e396edf5cb7fe1b00b7 Author: Bruce Guenter Date: Wed Dec 1 14:06:59 2010 -0600 str: Add str_end* and str_case_end* functions NEWS | 3 +++ libbg-str=l | 2 ++ str/{case_start.c => case_end.c} | 42 +++++++++++++++++++++------------------- str/{start.c => end.c} | 40 ++++++++++++++++++++------------------ str/str.h | 8 ++++++++ 5 files changed, 56 insertions(+), 39 deletions(-) copy str/{case_start.c => case_end.c} (59%) copy str/{start.c => end.c} (56%) commit 8f99f273495b4ec00a4458e00b6e83e44e8191c5 Author: Bruce Guenter Date: Wed Dec 1 13:59:57 2010 -0600 Start new version NEWS | 3 +++ VERSION | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) commit 48e3e9a260458d2164f5713f5cf511952a706995 Author: Bruce Guenter Date: Mon Feb 16 11:10:55 2009 -0600 Fixed installation of msg/debug.h header file. INSTHIER | 2 +- NEWS | 2 ++ msg/msg.h | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) commit 37524bfa95089fbebeecbd8e38c37f2ddc1efe3f Author: Bruce Guenter Date: Mon Feb 16 11:05:56 2009 -0600 Bumped version to 1.106 NEWS | 5 +++++ VERSION | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) commit a230cb4435b70ae47d29953ce5fb9f04d7af75ae Author: Bruce Guenter Date: Fri Feb 13 15:30:30 2009 -0600 Use -static instead of -static-libtool-libs in =x files. It appears that -static-libtool-libs is a recent change to libtool. bg-installer=x | 2 +- crc-gentab=x | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) commit d370a6bb82dddbe23ae3d3127499da1d7681b93e Author: Bruce Guenter Date: Fri Feb 13 11:02:55 2009 -0600 Fixed the copyright year in the README. README.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit ea7826ae23c10000ae5e73b07f4e66dcc2f18f42 Author: Bruce Guenter Date: Fri Feb 13 10:55:50 2009 -0600 Bumped LIBVERSION for release. LIBVERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit e13c7bce59d2b830261b798297b3d5c5c5de26e1 Author: Bruce Guenter Date: Thu Feb 12 19:32:46 2009 -0600 Modified the build procedure to build all libraries as shared. The problems were caused by a misunderstanding of how make works. If a makefile contains the rule: a b: doit it is 100% equivalent to: a: doit b: doit Which means that "doit" can be executed multiple times, even if "doit" generates the same two files. In this case, I had rules effectively: %.lo %.o: %.c ./libcompile $< However, while the libraries depended on the .lo files, the crc-gentab program depended on the .o files, to produce a static executable. What would happen is that make would occasionally try to use the .o file immediately before running libcompile again, which removes it. Bleh. So, this change builds everything to libtool .lo/.la files, and links from there, but installs the private .a from the .libs subdirectory. It's a somewhat internal feature of libtool, but it works. INSTHIER | 108 ++++++++++++++++++++++++++++----------------------------- NEWS | 3 ++ bg-installer=x | 15 ++++---- crc-gentab=x | 7 ++-- libraries.spac | 2 +- 5 files changed, 70 insertions(+), 65 deletions(-) commit 9befe53a58b7c7bb7ef4f6f47457d4ddb30b9c0d Author: Bruce Guenter Date: Fri Jan 30 10:32:54 2009 -0600 Fixed the debug messages to not enable any by default. NEWS | 2 ++ msg/debug_bits.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) commit e59377e762616f48bc2a1f24830f8793716b3b74 Author: Bruce Guenter Date: Thu Jan 29 23:22:20 2009 -0600 Split off the msg/debug functions into their own header. INSTHIER | 1 + msg/debug.h | 33 +++++++++++++++++++++++++++++++++ msg/msg.h | 26 +------------------------- 3 files changed, 35 insertions(+), 25 deletions(-) create mode 100644 msg/debug.h commit 1d185b8bb7ee6d58abda5cc99be9edc82f40a7ac Author: Bruce Guenter Date: Wed Jan 21 22:14:30 2009 -0600 Fixed the newer logic in path_match to mirror shell globbing properly. NEWS | 2 +- path/match.c | 59 ++++++++++++++++++++++++++++++----------------------------- 2 files changed, 31 insertions(+), 30 deletions(-) commit 4e0ee714d2ad5fca971342c19b7ea7cdfc6865fd Author: Bruce Guenter Date: Wed Jan 21 16:54:00 2009 -0600 Fixed a signed/unsigned comparison warning in envstr_unset. str/env_unset.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) commit b98013dcedc8f69e5a0b0f66a4f962ad1254f492 Author: Bruce Guenter Date: Wed Jan 21 16:24:30 2009 -0600 Cast pointers to unsigned long to cover both 32 and 64 bit systems. adt/ghash.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) commit 06f3102b883d2f3d1c75887355e25c60444131c2 Author: Bruce Guenter Date: Fri Jan 16 11:08:19 2009 -0600 Indicate the source file used by cli-generate in the generated files. NEWS | 2 ++ cli-generate.pl | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) commit 90a9598f0c0c8287683f08940aadefc3404e6a41 Author: Bruce Guenter Date: Fri Jan 16 11:00:54 2009 -0600 Fixed the path_match function to match filenames containing glob chars. NEWS | 3 +++ path/match.c | 39 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 3 deletions(-) commit c296cb6ad2fdb2165e85611b1088b3c343152cb8 Author: Bruce Guenter Date: Fri Jan 16 10:54:31 2009 -0600 Fixed up the comments in the ?buf_copy*fd functions. iobuf/ibuf_copytofd.c | 2 +- iobuf/obuf_copyfromfd.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) commit 44b3d026119b00b97a1aa511f525f4a3a3dee93e Author: Bruce Guenter Date: Fri Jan 16 10:53:52 2009 -0600 Added a proper .gitignore file. .gitignore | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .gitignore commit 085291acf4cfc362224aad077f5105acce5fc4ad Author: Bruce Guenter Date: Fri Jan 16 10:53:30 2009 -0600 Removed executable mode on spec file. spec | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 spec commit 30c43b89cf313fc6ba1be732a5d192336bfee1e7 Author: Bruce Guenter Date: Tue Apr 29 14:17:29 2008 -0600 Added sysdep for d_type in struct dirent. Also simplified the d_ino test slightly to prevent a potential assignment to read only location failure. NEWS | 2 +- sys/hasdirenttype.h0 | 2 ++ sys/hasdirenttype.h1 | 3 +++ sys/trydirentino.c | 2 +- sys/{trydirent.c => trydirenttype.c} | 2 +- sysdeps.h.spac | 3 ++- 6 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 sys/hasdirenttype.h0 create mode 100644 sys/hasdirenttype.h1 copy sys/{trydirent.c => trydirenttype.c} (85%) commit 06695e5d43fa890e5c04ad999a7fce780424282b Author: Bruce Guenter Date: Tue Apr 29 14:13:24 2008 -0600 Added sysdep for d_ino in struct dirent. NEWS | 2 ++ sys/hasdirentino.h0 | 2 ++ sys/hasdirentino.h1 | 3 +++ sys/{trydirent.c => trydirentino.c} | 2 +- sysdeps.h.spac | 4 +++- 5 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 sys/hasdirentino.h0 create mode 100644 sys/hasdirentino.h1 copy sys/{trydirent.c => trydirentino.c} (83%) commit a79700ba68fd3a3f8e8926fbb77330bb92cce7ae Author: Bruce Guenter Date: Sun Apr 13 22:49:13 2008 -0600 Fixed envstr_unset to remove all instances of the given name. NEWS | 1 + str/env_unset.c | 17 +++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) commit 6970809ba77c49f7b92c2cf5ce53b5d9f3f67adf Author: Bruce Guenter Date: Sun Apr 13 22:48:35 2008 -0600 Bumped version to 1.105 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit d9e3ccd1634a527f1d2d7e04332fc906c70e5bd3 Author: Bruce Guenter Date: Wed Apr 9 07:56:42 2008 -0600 Renamed some files that differed only in upper/lower case. This should fix building on OSX. Thanks to Amitai Schlair for pointing this out. NEWS | 3 +++ fmt/{uhex.c => uhexl.c} | 0 fmt/{uHex.c => uhexu.c} | 0 fmt/{ullhex.c => ullhexl.c} | 0 fmt/{ullHex.c => ullhexu.c} | 0 libbg-fmt=l | 8 ++++---- 6 files changed, 7 insertions(+), 4 deletions(-) rename fmt/{uhex.c => uhexl.c} (100%) rename fmt/{uHex.c => uhexu.c} (100%) rename fmt/{ullhex.c => ullhexl.c} (100%) rename fmt/{ullHex.c => ullhexu.c} (100%) commit deb8396b303c02b60a60c9b3b107b99b57ca8582 Author: Bruce Guenter Date: Fri Apr 4 11:45:55 2008 -0600 Made note of previous changes in the NEWS. NEWS | 1 + 1 file changed, 1 insertion(+) commit 96a65cc5e8f0eb83c62886b8a692be820364e639 Author: Bruce Guenter Date: Fri Apr 4 07:33:06 2008 -0600 Fix Require: syntax in spec file. Thanks again Giam Teck Choon spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 136d4ef275aa77992cf898a9397ad02e6a68d728 Author: Bruce Guenter Date: Thu Apr 3 15:49:21 2008 -0600 Bumped version to 1.104 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit 68307fcfbeb6504f7130794e60110d4f2c6558f0 Author: Bruce Guenter Date: Thu Apr 3 15:48:57 2008 -0600 Fixed typo in installation path of md5 library. INSTHIER | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit f8bbd07bde737018490573d0c44e5f128c1be629 Author: Bruce Guenter Date: Thu Apr 3 11:02:04 2008 -0600 Added missing no-bglibs control file. Without this file, spac will cause the "load" script to include -lbg-sysdeps, which will in turn cause all sysdeps that require linking to fail on systems that did not have bglibs installed previously. Thanks to Giam Teck Choon for pointing this out. cli-generate=pl => no-bglibs | 0 1 file changed, 0 insertions(+), 0 deletions(-) copy cli-generate=pl => no-bglibs (100%) commit 7368c8c9f479b39154d1ca2046c0362a1d19d3bc Author: Bruce Guenter Date: Wed Apr 2 17:40:27 2008 -0600 Include the .la files in the -devel RPM. spec | 1 + 1 file changed, 1 insertion(+) mode change 100644 => 100755 spec commit 13bff47d3639edbf2ec7f0e81418a9aac91f7995 Author: Bruce Guenter Date: Wed Apr 2 17:17:10 2008 -0600 Added missing COPYING file. COPYING | 504 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 504 insertions(+) create mode 100644 COPYING commit 11dd311ecb64d39c76872d1dcb6e94f1111bb7c5 Author: Bruce Guenter Date: Wed Apr 2 15:59:23 2008 -0600 Bumped up the libtool library version info. LIBVERSION | 40 +--------------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) commit b05c2264bccb780f54a588c2f6ec9fea5b391474 Author: Bruce Guenter Date: Wed Apr 2 13:53:11 2008 -0600 Put the development libs into their own RPM. TODO | 6 ------ spec | 31 +++++++++++++++++++++++++------ 2 files changed, 25 insertions(+), 12 deletions(-) commit f2ea788317308dde569c5de5ff0574785bb9725d Author: Bruce Guenter Date: Wed Apr 2 12:15:31 2008 -0600 Added some self-tests for misc conversion/formatting functions. misc/strtou.c | 30 ++++++++++++++++++++++++++++++ misc/utoa.c | 27 +++++++++++++++++++++++++++ misc/utoa2.c | 30 ++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+) commit eba3fd8ee02669cee4bc7302acee3f0095a3bed2 Author: Bruce Guenter Date: Tue Apr 1 23:40:03 2008 -0600 Added a #include to misc/random.c to avoid a parallel compile problem. misc/random.c | 1 + 1 file changed, 1 insertion(+) commit 5888f852931dfba36acc0797f6ec546cc297ccec Author: Bruce Guenter Date: Tue Apr 1 23:39:20 2008 -0600 Fixed up the ghash_set implementation and added a self-test. adt/ghash_set.c | 15 ++++++++++++--- adt/ghash_test.c | 13 +++++++++++-- 2 files changed, 23 insertions(+), 5 deletions(-) commit 11cf67c687f6c8dfcffd111b072c6f113dd44ab6 Author: Bruce Guenter Date: Tue Apr 1 14:19:38 2008 -0600 Fixed up typo in the systime.h build file. systime.h.spac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 491f24b48de64bd9309bab02444959849ef61924 Author: Bruce Guenter Date: Tue Apr 1 14:07:00 2008 -0600 Removed the now useless $Id$ tags from the source files. ac/dirent.h | 1 - ac/time.h | 1 - ac/wait.h | 1 - adt/adt_sp.c | 1 - adt/common.h | 1 - adt/ghash.h | 1 - adt/ghash_add.c | 1 - adt/ghash_foreach.c | 1 - adt/ghash_free.c | 1 - adt/ghash_get.c | 1 - adt/ghash_init.c | 1 - adt/ghash_insert.c | 1 - adt/ghash_iter.c | 1 - adt/ghash_rebuild.c | 1 - adt/ghash_rehash.c | 1 - adt/ghash_remove.c | 1 - adt/ghash_search.c | 1 - adt/ghash_set.c | 1 - adt/ghash_test.c | 1 - adt/gqueue.h | 1 - adt/gqueue_pop.c | 1 - adt/gqueue_push.c | 1 - adt/gqueue_test.c | 1 - adt/gqueue_top.c | 1 - adt/gstack.h | 1 - adt/gstack_pop.c | 1 - adt/gstack_push.c | 1 - adt/gstack_test.c | 1 - adt/gstack_top.c | 1 - adt/hashb.c | 1 - adt/hashs.c | 1 - base64/asc2bin.c | 1 - base64/base64.h | 1 - base64/bin2asc.c | 1 - base64/decode_line.c | 1 - base64/decode_part.c | 1 - base64/encode_line.c | 1 - base64/encode_part.c | 1 - bg-installer.c | 1 - cdb++/cdb++.h | 1 - cdb++/datum.h | 1 - cdb++/internal.h | 1 - cdb/cdb.c | 1 - cdb/cdb.h | 1 - cdb/cdbhash.c | 1 - cdb/find.c | 1 - cdb/get.c | 1 - cdb/getnext.c | 1 - cdb/make.c | 1 - cdb/make.h | 1 - cdb/read.c | 1 - cdb/str.h | 1 - cgi/cgi-args.h | 1 - cgi/cgi-base.h | 1 - cli++/cli++.h | 1 - cli-generate.1 | 1 - cli-generate.pl | 1 - cli/cli.h | 1 - cli/help.c | 1 - cli/internal.h | 1 - cli/main.c | 1 - crc-gentab.c | 1 - crc/crc16_arc.h | 1 - crc/crc16_ccitt.h | 1 - crc/crc16_xmodem.h | 1 - crc/crc32.h | 1 - crc/crc32c.h | 1 - crc/crc64.h | 1 - crc/gcrc.h | 1 - crc/gcrc16fwd.c | 1 - crc/gcrc16rfl.c | 1 - crc/gcrc32fwd.c | 1 - crc/gcrc32rfl.c | 1 - crc/gcrc64fwd.c | 1 - crc/gcrc64rfl.c | 1 - crypto/hmac-sha1.c | 1 - crypto/hmac-sha256.c | 1 - crypto/hmac-sha384.c | 1 - crypto/hmac-sha512.c | 1 - crypto/hmac.c | 1 - crypto/md4.c | 1 - crypto/md4.h | 1 - crypto/md5-crypt.c | 1 - crypto/md5.c | 1 - crypto/md5.h | 1 - crypto/sha1.c | 1 - crypto/sha1.h | 1 - crypto/sha1test.c | 1 - crypto/sha256.c | 1 - crypto/sha256.h | 1 - crypto/sha384.c | 1 - crypto/sha384.h | 1 - crypto/sha512.c | 1 - crypto/sha512.h | 1 - crypto/surf.c | 1 - crypto/surf.h | 1 - dict/add.c | 1 - dict/dict.h | 1 - dict/dicthash.c | 1 - dict/foreach.c | 1 - dict/free.c | 1 - dict/get.c | 1 - dict/init.c | 1 - dict/load.h | 1 - dict/load_list.c | 1 - dict/load_map.c | 1 - dict/str_free.c | 1 - err/die.c | 1 - err/err.h | 1 - err/error.c | 1 - err/message.c | 1 - err/warn.c | 1 - fdbuf/fdbuf.h | 1 - fdbuf/fdibuf.h | 1 - fdbuf/fdobuf.h | 1 - fmt/char.c | 1 - fmt/chars.c | 1 - fmt/lcase.c | 1 - fmt/misc.h | 1 - fmt/multi.c | 1 - fmt/multi.h | 1 - fmt/number.h | 1 - fmt/pad.c | 1 - fmt/sdec.c | 1 - fmt/sign_pad.c | 1 - fmt/slldec.c | 1 - fmt/sllnum.c | 1 - fmt/snum.c | 1 - fmt/uHex.c | 1 - fmt/ucase.c | 1 - fmt/udec.c | 1 - fmt/uhex.c | 1 - fmt/ullHex.c | 1 - fmt/ulldec.c | 1 - fmt/ullhex.c | 1 - fmt/ullnum.c | 1 - fmt/unum.c | 1 - instlib/installer.c | 1 - instlib/installer.h | 1 - instlib/instcheck.c | 1 - instlib/instmain.c | 1 - instlib/instshow.c | 1 - iobuf/common.h | 1 - iobuf/ibuf.h | 1 - iobuf/ibuf_copytofd.c | 1 - iobuf/ibuf_getc.c | 1 - iobuf/ibuf_getnetstring.c | 1 - iobuf/ibuf_gets.c | 1 - iobuf/ibuf_getstr.c | 1 - iobuf/ibuf_getstr_crlf.c | 1 - iobuf/ibuf_getu.c | 1 - iobuf/ibuf_init.c | 1 - iobuf/ibuf_open.c | 1 - iobuf/ibuf_openreadclose.c | 1 - iobuf/ibuf_peek.c | 1 - iobuf/ibuf_read.c | 1 - iobuf/ibuf_readall.c | 1 - iobuf/ibuf_refill.c | 1 - iobuf/ibuf_seek.c | 1 - iobuf/ibuf_status.c | 1 - iobuf/ibuf_stdin.c | 1 - iobuf/ibuf_tell.c | 1 - iobuf/iobuf.h | 1 - iobuf/iobuf_close.c | 1 - iobuf/iobuf_copy.c | 1 - iobuf/iobuf_init.c | 1 - iobuf/iobuf_timeout.c | 1 - iobuf/obuf.h | 1 - iobuf/obuf_close.c | 1 - iobuf/obuf_copyfromfd.c | 1 - iobuf/obuf_digits.c | 1 - iobuf/obuf_endl.c | 1 - iobuf/obuf_flush.c | 1 - iobuf/obuf_init.c | 1 - iobuf/obuf_open.c | 1 - iobuf/obuf_pad.c | 1 - iobuf/obuf_put2s.c | 1 - iobuf/obuf_put3s.c | 1 - iobuf/obuf_put4s.c | 1 - iobuf/obuf_put5s.c | 1 - iobuf/obuf_put6s.c | 1 - iobuf/obuf_put7s.c | 1 - iobuf/obuf_putc.c | 1 - iobuf/obuf_putf.c | 1 - iobuf/obuf_putnetstring.c | 1 - iobuf/obuf_putns.c | 1 - iobuf/obuf_putsflush.c | 1 - iobuf/obuf_putsllnumw.c | 1 - iobuf/obuf_putsnumw.c | 1 - iobuf/obuf_putullnumw.c | 1 - iobuf/obuf_putunumw.c | 1 - iobuf/obuf_seek.c | 1 - iobuf/obuf_sign_pad.c | 1 - iobuf/obuf_stderr.c | 1 - iobuf/obuf_stdout.c | 1 - iobuf/obuf_sync.c | 1 - iobuf/obuf_write.c | 1 - misc/misc.h | 1 - misc/random.c | 1 - misc/strtou.c | 1 - misc/ucspi.c | 1 - misc/ucspi.h | 1 - misc/utoa.c | 1 - misc/utoa2.c | 1 - msg/common.c | 1 - msg/commonf.c | 1 - msg/debug.c | 1 - msg/debug_init.c | 1 - msg/debugf.c | 1 - msg/die.c | 1 - msg/dief.c | 1 - msg/error.c | 1 - msg/errorf.c | 1 - msg/msg.h | 1 - msg/oom.c | 1 - msg/warn.c | 1 - msg/warnf.c | 1 - msg/wrap.h | 1 - msg/wrap_alloc.c | 1 - msg/wrap_chdir.c | 1 - msg/wrap_exit.c | 1 - msg/wrap_str.c | 1 - mystring/iter.h | 1 - mystring/join.h | 1 - mystring/mystring.h | 1 - mystring/rep.h | 1 - mystring/trace.h | 1 - net/accept4.c | 1 - net/accept6.c | 1 - net/acceptu.c | 1 - net/bind4.c | 1 - net/bind6.c | 1 - net/bindu.c | 1 - net/broadcast.c | 1 - net/cmsg.h | 1 - net/connect4.c | 1 - net/connect4_timeout.c | 1 - net/connect6.c | 1 - net/connect6_timeout.c | 1 - net/connected.c | 1 - net/connectu.c | 1 - net/connectu_timeout.c | 1 - net/cork.c | 1 - net/getaddr4.c | 1 - net/getaddr6.c | 1 - net/ipv4.h | 1 - net/ipv4_addr.c | 1 - net/ipv4_format.c | 1 - net/ipv4_scan.c | 1 - net/ipv6.h | 1 - net/ipv6_addr.c | 1 - net/ipv6_format.c | 1 - net/ipv6_scan.c | 1 - net/linger.c | 1 - net/listen.c | 1 - net/notcpdelay.c | 1 - net/pairdgm.c | 1 - net/pairstr.c | 1 - net/recv4.c | 1 - net/recv6.c | 1 - net/recvfd.c | 1 - net/recvu.c | 1 - net/resolve.h | 1 - net/resolve_error.c | 1 - net/resolve_ipv4addr.c | 1 - net/resolve_ipv4name.c | 1 - net/reuse.c | 1 - net/send4.c | 1 - net/send6.c | 1 - net/sendfd.c | 1 - net/sendu.c | 1 - net/setopt.c | 1 - net/shutdown.c | 1 - net/socket.h | 1 - net/tcp4.c | 1 - net/tcp6.c | 1 - net/udp4.c | 1 - net/udp6.c | 1 - net/uncork.c | 1 - net/unixdgm.c | 1 - net/unixstr.c | 1 - path/contains.c | 1 - path/fnmatch.c | 1 - path/match.c | 1 - path/merge.c | 1 - path/mkdirs.c | 1 - path/mktemp.c | 1 - path/path.h | 1 - selftest.c | 1 - str/alloc.c | 1 - str/buildmap.c | 1 - str/case_glob.c | 1 - str/case_match.c | 1 - str/case_start.c | 1 - str/cat.c | 1 - str/cat2s.c | 1 - str/cat3s.c | 1 - str/cat4s.c | 1 - str/cat5s.c | 1 - str/cat6s.c | 1 - str/catf.c | 1 - str/catiw.c | 1 - str/catiwll.c | 1 - str/catns.c | 1 - str/catsllnum.c | 1 - str/catsnum.c | 1 - str/catullnum.c | 1 - str/catunum.c | 1 - str/catuw.c | 1 - str/catuwll.c | 1 - str/catxw.c | 1 - str/catxwll.c | 1 - str/cmp.c | 1 - str/copy.c | 1 - str/copy2s.c | 1 - str/copy3s.c | 1 - str/copy4s.c | 1 - str/copy5s.c | 1 - str/copy6s.c | 1 - str/copyf.c | 1 - str/copyns.c | 1 - str/count.c | 1 - str/countof.c | 1 - str/cut.c | 1 - str/diff.c | 1 - str/digits.c | 1 - str/env.h | 1 - str/env_find.c | 1 - str/env_from_array.c | 1 - str/env_from_string.c | 1 - str/env_get.c | 1 - str/env_make_array.c | 1 - str/env_put.c | 1 - str/env_set.c | 1 - str/findnext.c | 1 - str/findnextnot.c | 1 - str/findnextof.c | 1 - str/findprev.c | 1 - str/findprevnot.c | 1 - str/findprevof.c | 1 - str/free.c | 1 - str/glob.c | 1 - str/init.c | 1 - str/iter.h | 1 - str/iter_advance.c | 1 - str/iter_start.c | 1 - str/iter_valid.c | 1 - str/join.c | 1 - str/lower.c | 1 - str/lstrip.c | 1 - str/match.c | 1 - str/rstrip.c | 1 - str/sort.c | 1 - str/splice.c | 1 - str/start.c | 1 - str/str.h | 1 - str/subst.c | 1 - str/truncate.c | 1 - str/upper.c | 1 - str/xlate.c | 1 - sys/clock_gettime.c | 1 - sys/getpeereid.c | 1 - sys/iopoll.c | 1 - sys/mkfifo.c | 1 - sys/setenv.c | 1 - sys/tryattribute.c | 1 - sys/tryclockgettime.c | 1 - sys/trydaylight.c | 1 - sys/trydeprecated.c | 1 - sys/trydirent.c | 1 - sys/tryendian.c | 1 - sys/tryflock.c | 1 - sys/trygetpeereid.c | 1 - sys/tryinline.c | 1 - sys/tryipv6.c | 1 - sys/trymkfifo.c | 1 - sys/trynamedpipebug.c | 1 - sys/trypeercred.c | 1 - sys/trypoll.c | 1 - sys/trysendfile.c | 1 - sys/trysetenv.c | 1 - sys/trysigaction.c | 1 - sys/trysigprocmask.c | 1 - sys/tryspnam.c | 1 - sys/trysysselect.c | 1 - sys/trysystime.c | 1 - sys/trytime.c | 1 - sys/trytimespec.c | 1 - sys/tryulong32.c | 1 - sys/tryulong64.c | 1 - sys/tryunaligned.c | 1 - sys/tryunsetenv.c | 1 - sys/tryuserpw.c | 1 - sys/tryvfork.c | 1 - sys/trywaitp.c | 1 - sys/tryzlib.c | 1 - sys/unsetenv.c | 1 - sysdeps-head.h | 1 - sysdeps-tail.h | 1 - uint16.h | 1 - uint16/get.c | 1 - uint16/pack.c | 1 - uint16/unpack.c | 1 - uint32.h | 1 - uint32/get_lsb.c | 1 - uint32/get_msb.c | 1 - uint32/pack_lsb.c | 1 - uint32/pack_msb.c | 1 - uint32/unpack_lsb.c | 1 - uint32/unpack_msb.c | 1 - uint64.h | 1 - uint64/get_lsb.c | 1 - uint64/get_msb.c | 1 - uint64/pack_lsb.c | 1 - uint64/pack_msb.c | 1 - uint64/unpack_lsb.c | 1 - uint64/unpack_msb.c | 1 - uintnn.h | 1 - unix/cloexec.h | 1 - unix/cloexec_off.c | 1 - unix/cloexec_on.c | 1 - unix/fcntl.c | 1 - unix/fcntl.h | 1 - unix/fcntl_fd_off.c | 1 - unix/fcntl_fd_on.c | 1 - unix/fcntl_fl_off.c | 1 - unix/fcntl_fl_on.c | 1 - unix/nonblock.h | 1 - unix/nonblock_off.c | 1 - unix/nonblock_on.c | 1 - unix/selfpipe.c | 1 - unix/selfpipe.h | 1 - unix/sig.h | 1 - unix/sig_alarm.c | 1 - unix/sig_all.c | 1 - unix/sig_block.c | 1 - unix/sig_bug.c | 1 - unix/sig_catch.c | 1 - unix/sig_child.c | 1 - unix/sig_hup.c | 1 - unix/sig_int.c | 1 - unix/sig_misc.c | 1 - unix/sig_pipe.c | 1 - unix/sig_quit.c | 1 - unix/sig_suspend.c | 1 - unix/sig_term.c | 1 - unix/signalfd.c | 1 - unix/trigger.h | 1 - unix/trigger_pull.c | 1 - unix/trigger_set.c | 1 - vmailmgr/client.h | 1 - vmailmgr/req_arg.c | 1 - vmailmgr/req_init.c | 1 - vmailmgr/req_write.c | 1 - vmailmgr/resp_read.c | 1 - vmailmgr/vpwentry.h | 1 - vmailmgr/vpwentry_export.c | 1 - vmailmgr/vpwentry_free.c | 1 - vmailmgr/vpwentry_import.c | 1 - 459 files changed, 459 deletions(-) commit 8697535351f68a5c9bf9edae2bf66795469b8c6e Author: Bruce Guenter Date: Tue Apr 1 13:16:00 2008 -0600 Updated copyright notes on the crypto files. crypto/surf.c | 2 +- crypto/surfrand.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) commit 806721b9e4861956b8d1564360d9ad309f946e7a Author: Bruce Guenter Date: Tue Apr 1 13:15:43 2008 -0600 Updated the README README.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) commit 9e654537538af3fe933cd63cdca51d2f66911caa Author: Bruce Guenter Date: Tue Apr 1 12:42:19 2008 -0600 Fixed a serious typo in the surfrand_fill function. crypto/surfrand.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) commit d6765585a8647042b4959738b4306c085482478b Author: Bruce Guenter Date: Mon Mar 31 23:22:33 2008 -0600 Added documentation for the new surf/surfrand functions. config.dxy | 1 + crypto/surf.c | 20 ++++++++++++++++---- crypto/surf.h | 11 +++++++++++ crypto/surfrand.c | 20 ++++++++++++++++++++ crypto/surfrand.h | 11 +++++++++++ 5 files changed, 59 insertions(+), 4 deletions(-) commit 368bf1149d3292779e43bfba3604e5ddb1e1d31b Author: Bruce Guenter Date: Mon Mar 31 22:35:39 2008 -0600 Updated the Doxygen configuration for version 1.5 config.dxy | 140 +++++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 99 insertions(+), 41 deletions(-) commit d2852a56dd04f9b164bfc9fce0f71a1bded39b6e Author: Bruce Guenter Date: Mon Mar 31 22:32:51 2008 -0600 Completed the signalfd implementation and self-tests. INSTHIER | 1 + libbg-unix=l | 1 + unix/signalfd.c | 39 +++++++++++++++++++++++---------------- 3 files changed, 25 insertions(+), 16 deletions(-) commit 8f8a2050baf67e8acac6e70710cff420e5a10e84 Author: Bruce Guenter Date: Mon Mar 31 22:13:07 2008 -0600 Fixed up msg selftest problems caused by previous selftest.c change. msg/common.c | 2 +- msg/commonf.c | 4 +--- msg/wrap_alloc.c | 4 +--- msg/wrap_chdir.c | 4 +--- msg/wrap_str.c | 4 +--- 5 files changed, 5 insertions(+), 13 deletions(-) commit 851fbafcb7a8d86edaf531117b68ff737f196c66 Author: Bruce Guenter Date: Mon Mar 31 17:35:44 2008 -0600 Added a random number generator based on SURF. INSTHIER | 3 +- NEWS | 2 + crypto/surfrand.c | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ crypto/surfrand.h | 19 +++++++++ libbg-crypto=l | 1 + 5 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 crypto/surfrand.c create mode 100644 crypto/surfrand.h commit e4ba26534e160078ae2f15f94d1355f7b6d0dbe1 Author: Bruce Guenter Date: Mon Mar 31 17:29:58 2008 -0600 Added files that were missing from the svn->git conversion. crypto/hmac-md5.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ str/env_unset.c | 28 +++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 crypto/hmac-md5.c create mode 100644 str/env_unset.c commit 99518c7ff759cf4cd23c9359fe578dc3f0a760a8 Author: Bruce Guenter Date: Mon Mar 31 17:28:52 2008 -0600 Fixed typos in two #include statements in headers. cdb/str.h | 2 +- dict/load.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) commit 0f15beb1c9d357a8ad67d8e95eecd82a15cd9bfc Author: Bruce Guenter Date: Fri Oct 5 08:46:55 2007 -0600 Added program and msg_show_pid definitions to the selftest. selftest.c | 3 +++ 1 file changed, 3 insertions(+) commit 7bb68b74932968e4c3c996adac1269a53c3b1a88 Author: Bruce Guenter Date: Fri Oct 5 08:35:22 2007 -0600 Added a set of "signalfd" functions as a generic self-pipe setup. NEWS | 2 ++ unix/{selfpipe.c => signalfd.c} | 71 ++++++++++++++++++++++------------------- unix/signalfd.h | 14 ++++++++ 3 files changed, 55 insertions(+), 32 deletions(-) copy unix/{selfpipe.c => signalfd.c} (55%) create mode 100644 unix/signalfd.h commit b7c615c318cf73b15a59e9a5e3b5ab333beb0a4e Author: Bruce Guenter Date: Fri Oct 5 08:34:25 2007 -0600 Added a ghash_set function (like ghash_add, but overwrites). NEWS | 2 ++ adt/ghash.h | 12 ++++++++++++ adt/ghash_set.c | 11 +++++++++++ libbg-adt=l | 1 + 4 files changed, 26 insertions(+) create mode 100644 adt/ghash_set.c commit 65da84c59d934380d682947e87a699d3f761c9d4 Author: Bruce Guenter Date: Wed Apr 11 03:08:38 2007 +0000 Added two missing header files: fmt/misc.h and fmt/multi.h INSTHIER | 2 ++ NEWS | 1 + 2 files changed, 3 insertions(+) commit b0f73b29f979bd1c9bcfceaeb856e038f1fbcc8b Author: Bruce Guenter Date: Wed Apr 11 03:08:05 2007 +0000 Bumped version to 1.103 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit e7fc34c5a1c56f32f3767a5373b43510d287678d Author: Bruce Guenter Date: Mon Oct 30 21:08:42 2006 +0000 I no longer have intentions to add FP to fmt, at least not until I (or somebody else using it) needs it. TODO | 4 ---- 1 file changed, 4 deletions(-) commit 6269bfc5887749ca8316c14cb89da0b5841a2f31 Author: Bruce Guenter Date: Mon Oct 30 21:08:18 2006 +0000 Bumped the implementation number in LIBVERSION. LIBVERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 9f6449cf74beca64f9c9373e274d7958fb16bdf9 Author: Bruce Guenter Date: Mon Oct 30 21:06:28 2006 +0000 Fixed a bug in resolve_ipv4name_n: when handling multiple IPs, it would always copy the first one multiple times. NEWS | 3 +++ net/resolve_ipv4name.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) commit 01f74a8835431ed226e93fb6ad3b18b6c389dca1 Author: Bruce Guenter Date: Tue Sep 12 17:49:06 2006 +0000 Added "m" format option for strerror(errno) NEWS | 4 +++- fmt/multi.c | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) commit f97c734bd52a18104ebf8e45f0f2d678bb9321b4 Author: Bruce Guenter Date: Mon Sep 11 18:19:54 2006 +0000 Made some of the net tests more lenient. Thanks Paul Jarc net/connect4.c | 8 ++++---- net/tcp4.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) commit 3804e9be68746ff94c4e45a9324a9487a832697a Author: Bruce Guenter Date: Mon Sep 11 16:40:58 2006 +0000 Added self-tests for str_join str/join.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) commit fe50620614d7b4704bf1da30c1021e28fdf5528d Author: Bruce Guenter Date: Tue Aug 22 17:32:50 2006 +0000 Added support for str formatting in fmt_multi with "S". NEWS | 1 + fmt/multi.c | 8 ++++++++ 2 files changed, 9 insertions(+) commit ec500dbaa3ddecb77a0c7b12a576a9b04ed9a5da Author: Bruce Guenter Date: Thu Aug 3 16:10:24 2006 +0000 Bumped version to 1.102 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit c42fd52fc3b47a33924d6fc1683a85bd7a0e98d3 Author: Bruce Guenter Date: Wed Aug 2 16:42:15 2006 +0000 Clarified NEWS entry. NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit eeeb6eba382fb348025a418a37f19a765caf3ade Author: Bruce Guenter Date: Tue Aug 1 15:22:11 2006 +0000 Marked some symbols as "weak" to prevent link errors if they aren't defined. NEWS | 3 +++ libbg-msg=l | 1 + msg/common.c | 21 +++++++++++---------- msg/commonf.c | 17 ++++++++++------- msg/msg.h | 4 ++-- msg/show_pid.c | 2 ++ 6 files changed, 29 insertions(+), 19 deletions(-) create mode 100644 msg/show_pid.c commit 5ead89175045ae00e121176fe514eb31df0188a4 Author: Bruce Guenter Date: Tue Aug 1 15:12:47 2006 +0000 Use __attribute__ directly instead of the __DEPRECATED__ macro. net/ipv4.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 5e83f0865576c33639c919fdef75e76d1503186f Author: Bruce Guenter Date: Tue Aug 1 05:51:38 2006 +0000 Added sysdep for __attribute__. NEWS | 2 ++ sys/hasattribute.h0 | 2 ++ sys/hasattribute.h1 | 1 + sys/tryattribute.c | 2 ++ sysdeps.h.spac | 7 ++++--- 5 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 sys/hasattribute.h0 create mode 100644 sys/hasattribute.h1 create mode 100644 sys/tryattribute.c commit 05a9d504ee7b87175e1fe2838a8549694b7cd5a8 Author: Bruce Guenter Date: Mon Jul 31 20:48:31 2006 +0000 Fixed include compatibility problem in sys/tryclockgettime.c. Thanks Amitai Schlair NEWS | 2 ++ sys/tryclockgettime.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) commit 5f94b6fcd4f7c8277ec156e8d793769c0fd2a930 Author: Bruce Guenter Date: Mon Jul 31 20:47:31 2006 +0000 Bumped version to 1.101 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit 875d2e8a79fe2f028b5745f1317e5f5f14ba027c Author: Bruce Guenter Date: Thu Jul 27 23:53:42 2006 +0000 Tidied up several pointer signedness warnings (emitted by newer GCCs). base64/base64.h | 2 +- base64/decode_line.c | 6 +++--- base64/decode_part.c | 10 +++++----- cdb/cdb.h | 2 +- cdb/find.c | 6 +++--- cdb/get.c | 3 ++- cdb/getnext.c | 3 ++- cdb/make.c | 12 ++++++------ cdb/make.h | 2 +- crc/gcrc16fwd.c | 2 +- crc/gcrc16rfl.c | 2 +- crc/gcrc32fwd.c | 2 +- crc/gcrc32rfl.c | 2 +- crc/gcrc64fwd.c | 2 +- crc/gcrc64rfl.c | 2 +- crypto/hmac.c | 4 ++-- crypto/sha1.c | 4 +++- crypto/sha1test.c | 2 +- dict/dict.h | 2 +- net/accept4.c | 4 ++-- net/accept6.c | 4 ++-- net/acceptu.c | 4 ++-- net/connected.c | 2 +- net/getaddr4.c | 2 +- net/getaddr6.c | 2 +- net/ipv6_format.c | 4 ++-- net/recv4.c | 2 +- net/recv6.c | 2 +- sys/getpeereid.c | 2 +- 29 files changed, 51 insertions(+), 47 deletions(-) commit 211ee7f469ea3b6d80badf5843ea01dd133c6fec Author: Bruce Guenter Date: Thu Jul 27 23:28:51 2006 +0000 Fixed up some missing bits in the spec needed for shared libraries. INSTHIER | 4 ++-- libraries.spac | 2 +- spec | 20 +++++++++++++++----- 3 files changed, 18 insertions(+), 8 deletions(-) commit e8ab8305ddf216416974d5b746f43c230dc3f6fa Author: Bruce Guenter Date: Thu Jul 27 23:10:08 2006 +0000 Add dl.lib to the installed files. INSTHIER | 1 + 1 file changed, 1 insertion(+) commit 69967a78379d016adcf302b31b4ab01c0a15aef0 Author: Bruce Guenter Date: Thu Jul 27 22:32:39 2006 +0000 Added documentation for the gqueue and gstack ADTs. adt/gqueue.h | 29 +++++++++++++++++++++++++++++ adt/gqueue_pop.c | 4 ++++ adt/gqueue_push.c | 10 +++++++--- adt/gqueue_test.c | 6 +++--- adt/gqueue_top.c | 2 ++ adt/gstack.h | 28 ++++++++++++++++++++++++++++ adt/gstack_pop.c | 4 ++++ adt/gstack_push.c | 2 ++ adt/gstack_top.c | 2 ++ 9 files changed, 81 insertions(+), 6 deletions(-) commit f6979d0f21f0ac49bb3c0ad9cc94b8b9eddea72e Author: Bruce Guenter Date: Thu Jul 27 22:32:21 2006 +0000 Allow for NULL key copy functions in ghash. adt/ghash.h | 5 ++++- adt/ghash_add.c | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) commit 748f6fe8f4d94aa2045d009e8522df611e762f79 Author: Bruce Guenter Date: Thu Jul 27 19:02:06 2006 +0000 Convert all "void selftest(void)" functions in selftests to simply "MAIN". adt/gqueue_test.c | 2 +- adt/gstack_test.c | 2 +- msg/common.c | 2 +- msg/commonf.c | 2 +- msg/wrap_alloc.c | 2 +- msg/wrap_chdir.c | 2 +- msg/wrap_str.c | 2 +- net/connect4.c | 2 +- net/ipv4_format.c | 2 +- net/ipv4_scan.c | 2 +- net/ipv6_scan.c | 2 +- net/tcp4.c | 2 +- path/merge.c | 2 +- str/alloc.c | 2 +- str/catf.c | 2 +- str/copy.c | 2 +- str/copyf.c | 2 +- str/env_find.c | 2 +- str/env_from_array.c | 2 +- str/env_from_string.c | 2 +- str/env_get.c | 2 +- str/env_make_array.c | 2 +- str/env_put.c | 2 +- str/env_set.c | 2 +- str/findnext.c | 2 +- str/findnextof.c | 2 +- str/findprev.c | 2 +- str/findprevnot.c | 2 +- str/findprevof.c | 2 +- str/free.c | 2 +- str/init.c | 2 +- str/splice.c | 2 +- 32 files changed, 32 insertions(+), 32 deletions(-) commit 20728a2e48c2d8baeae9423f7c3b03bc90dcb003 Author: Bruce Guenter Date: Thu Jul 27 19:01:19 2006 +0000 The version was mistakenly not bumped up to 1.100 VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit f3a0c99443b5c692bc3ef80e6a1a45c06d8748a8 Author: Bruce Guenter Date: Thu Jul 27 19:01:01 2006 +0000 Pointer signedness fixup. adt/adt_sp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit b934600d10ee1df341df920964deff4b608954ac Author: Bruce Guenter Date: Thu Jul 27 18:56:15 2006 +0000 Document the resolve_ipv4name macro. net/resolve.h | 1 + 1 file changed, 1 insertion(+) commit 8b7f0b256b155faecd0619541a93f4b2843e3f26 Author: Bruce Guenter Date: Thu Jul 27 18:56:01 2006 +0000 Added missing "@}" comment in iobuf/common.h that was causing some function documentation to be skipped. iobuf/common.h | 2 ++ 1 file changed, 2 insertions(+) commit cc48d83b7f4710117314f6bcb128d9c032a8d888 Author: Bruce Guenter Date: Thu Jul 27 18:53:17 2006 +0000 Moved the gqueue and gstack test code into seperate files. adt/gqueue_push.c | 31 ------------------------------- adt/{gqueue_push.c => gqueue_test.c} | 18 ------------------ adt/gstack_push.c | 31 ------------------------------- adt/{gstack_push.c => gstack_test.c} | 17 ----------------- 4 files changed, 97 deletions(-) copy adt/{gqueue_push.c => gqueue_test.c} (55%) copy adt/{gstack_push.c => gstack_test.c} (57%) commit 1bd712e32ab5996c926d9a3068a3679b13743614 Author: Bruce Guenter Date: Thu Jul 27 18:52:50 2006 +0000 Moved all selftest code into ghash_test.c, to make it a better example. adt/ghash_iter.c | 63 --------------------------------------------- adt/ghash_remove.c | 69 ------------------------------------------------- adt/ghash_test.c | 75 ++++++++++++++++++++++++++++++++++++++++++++---------- 3 files changed, 62 insertions(+), 145 deletions(-) commit 6bc8c114902fb4b8c7f3293ec8b148ace483751e Author: Bruce Guenter Date: Thu Jul 27 18:35:10 2006 +0000 Added Doxygen documentation to adt/ghash adt/common.h | 22 +++++++ adt/ghash.h | 64 +++++++++++++++++++- adt/ghash_add.c | 112 ++++------------------------------- adt/ghash_foreach.c | 1 + adt/ghash_free.c | 1 + adt/ghash_get.c | 8 +++ adt/ghash_init.c | 1 + adt/ghash_insert.c | 1 + adt/ghash_iter.c | 3 + adt/ghash_rebuild.c | 3 + adt/ghash_rehash.c | 2 + adt/ghash_remove.c | 6 ++ adt/ghash_search.c | 2 + adt/{ghash_remove.c => ghash_test.c} | 74 +++++++++++------------ config.dxy | 5 +- 15 files changed, 162 insertions(+), 143 deletions(-) copy adt/{ghash_remove.c => ghash_test.c} (54%) commit 81840784fc404ceb367a7b0832a75ca6ea4d498d Author: Bruce Guenter Date: Thu Jul 27 16:55:07 2006 +0000 Added self tests for the generic queue and stack implementations, fixing several bugs in the process. adt/gqueue.h | 6 +++--- adt/gqueue_pop.c | 3 ++- adt/gqueue_push.c | 36 +++++++++++++++++++++++++++++++++++- adt/gstack_pop.c | 3 ++- adt/gstack_push.c | 36 +++++++++++++++++++++++++++++++++++- 5 files changed, 77 insertions(+), 7 deletions(-) commit 262767baef76426777e1d5037c674c7c6d8b6b58 Author: Bruce Guenter Date: Thu Jul 27 05:56:55 2006 +0000 Updated the Doxygen config for version 1.4.7 config.dxy | 52 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 14 deletions(-) commit ab57cb2a16b7add3d3a243778946e45c1c88aeb8 Author: Bruce Guenter Date: Tue Jul 25 20:43:55 2006 +0000 Updated the Doxygen configuration. config.dxy | 255 +++++++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 206 insertions(+), 49 deletions(-) commit a6499926d68c6add20fd061e5c806e28227d9303 Author: Bruce Guenter Date: Tue Jul 25 14:51:21 2006 +0000 Added self test to ipv4_format.c net/ipv4_format.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) commit d2a35b16fedaf25cf644f4c1636c047725cc19ef Author: Bruce Guenter Date: Tue Jul 25 14:45:48 2006 +0000 Added self tests for several IPv4 functions. net/connect4.c | 25 +++++++++++++++++++++++++ net/tcp4.c | 18 ++++++++++++++++++ selftest.c | 13 +++++++++++++ 3 files changed, 56 insertions(+) commit cbb6535a88ed0aee33bccf6f8eb0b605970f5c61 Author: Bruce Guenter Date: Mon Jul 24 23:44:01 2006 +0000 Modified the package to install libbg and libbg-sysdeps as shared libraries using libtool. INSTHIER | 4 ++-- LIBVERSION | 39 +++++++++++++++++++++++++++++++++++++++ NEWS | 5 ++++- TODO | 2 ++ VERSION | 2 +- libbg.a.spac | 23 ----------------------- libbg.la.spac | 16 ++++++++++++++++ libraries.spac | 2 +- selftests.sh | 2 +- selftests.spac | 2 +- 10 files changed, 67 insertions(+), 30 deletions(-) create mode 100644 LIBVERSION delete mode 100644 libbg.a.spac create mode 100644 libbg.la.spac commit 0e9059e70000b736523609d1524b96c2d793ac8e Author: Bruce Guenter Date: Mon Jul 24 23:14:39 2006 +0000 Added support to bg-installer for installing shared libraries with libtool. NEWS | 3 +++ bg-installer.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 65 insertions(+), 1 deletion(-) commit e8e8d926c3220c42ed4d3ebfb07e66c69bf7acba Author: Bruce Guenter Date: Mon Jul 24 23:02:38 2006 +0000 Added missing libpwcmp library definition files. They were missed in a previous step because the actual pwcmp library is in a different repository. libpwcmp-module=l | 1 + libpwcmp=l | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 libpwcmp-module=l create mode 100644 libpwcmp=l commit fad30a6a90bbc5b1aa9140ab3571163416db47b1 Author: Bruce Guenter Date: Mon Jul 24 20:48:02 2006 +0000 Fixed a missing include in the old fdbuf C++ library. fdbuf/fdobuf.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) commit 16c8c0f04217e2010c4340772aa0f97b031a53f2 Author: Bruce Guenter Date: Mon Jul 24 19:57:47 2006 +0000 Fixed bug in error return of ibuf_openreadclose. Thanks Gerrit Pape NEWS | 2 ++ iobuf/ibuf_openreadclose.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) commit c2c08dff039d92dcfa21ac2099180fecb28b414e Author: Bruce Guenter Date: Thu Mar 23 04:25:47 2006 +0000 Fixed the missing vmailmgr/ prefix in libvmailmgr libvmailmgr=l | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) commit 7b598647f66951e11e967b2ec3a63fb1b58005ae Author: Bruce Guenter Date: Thu Mar 23 04:15:58 2006 +0000 Added missing source necessary in the libbg-msg library. msg/debug_bits.c | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 msg/debug_bits.c commit bfe9e1902e5d10863348a460937db0a37a92dac7 Author: Bruce Guenter Date: Thu Mar 23 04:14:35 2006 +0000 Renamed the library targets into the top directory with their final names. This will help make generation of shared libraries easier. INSTHIER | 42 ++++++++++++------------- adt/lib=l | 20 ------------ base64/lib=l | 6 ---- bg-installer=x | 8 +++-- cdb/lib=l | 7 ----- cli/lib=l | 2 -- crc-gentab=x | 4 +-- crc/lib=l | 12 ------- crypto/lib=l | 14 --------- dict/lib=l | 9 ------ fmt/lib=l | 19 ------------ iobuf/lib=l | 51 ------------------------------ libbg-adt=l | 20 ++++++++++++ libbg-base64=l | 6 ++++ libbg-cdb=l | 7 +++++ libbg-cli=l | 2 ++ libbg-crc=l | 12 +++++++ libbg-crypto=l | 14 +++++++++ libbg-dict=l | 9 ++++++ libbg-fmt=l | 19 ++++++++++++ installer=l => libbg-installer=l | 0 instcheck=l => libbg-instcheck=l | 0 instshow=l => libbg-instshow=l | 0 libbg-iobuf=l | 51 ++++++++++++++++++++++++++++++ libbg-misc=l | 5 +++ libbg-msg=l | 17 ++++++++++ libbg-net=l | 48 ++++++++++++++++++++++++++++ libbg-path=l | 6 ++++ libbg-str=l | 67 ++++++++++++++++++++++++++++++++++++++++ libbg-unix=l | 24 ++++++++++++++ libbg.a.spac | 6 ++-- libraries.spac | 2 +- vmailmgr/lib=l => libvmailmgr=l | 0 misc/lib=l | 5 --- msg/lib=l | 16 ---------- net/lib=l | 48 ---------------------------- path/lib=l | 6 ---- str/lib=l | 67 ---------------------------------------- unix/lib=l | 24 -------------- 39 files changed, 341 insertions(+), 334 deletions(-) delete mode 100644 adt/lib=l delete mode 100644 base64/lib=l delete mode 100644 cdb/lib=l delete mode 100644 cli/lib=l delete mode 100644 crc/lib=l delete mode 100644 crypto/lib=l delete mode 100644 dict/lib=l delete mode 100644 fmt/lib=l delete mode 100644 iobuf/lib=l create mode 100644 libbg-adt=l create mode 100644 libbg-base64=l create mode 100644 libbg-cdb=l create mode 100644 libbg-cli=l create mode 100644 libbg-crc=l create mode 100644 libbg-crypto=l create mode 100644 libbg-dict=l create mode 100644 libbg-fmt=l rename installer=l => libbg-installer=l (100%) rename instcheck=l => libbg-instcheck=l (100%) rename instshow=l => libbg-instshow=l (100%) create mode 100644 libbg-iobuf=l create mode 100644 libbg-misc=l create mode 100644 libbg-msg=l create mode 100644 libbg-net=l create mode 100644 libbg-path=l create mode 100644 libbg-str=l create mode 100644 libbg-unix=l rename vmailmgr/lib=l => libvmailmgr=l (100%) delete mode 100644 misc/lib=l delete mode 100644 msg/lib=l delete mode 100644 net/lib=l delete mode 100644 path/lib=l delete mode 100644 str/lib=l delete mode 100644 unix/lib=l commit 734671aaa013ba9272e38549e94f6e1ac143daa0 Author: Bruce Guenter Date: Sun Mar 19 05:51:54 2006 +0000 Simplified the result length-only formula in fmt/*num.c slightly. fmt/sllnum.c | 2 +- fmt/snum.c | 2 +- fmt/ullnum.c | 2 +- fmt/unum.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) commit a7a87e99cbe3e86b56c20323901dd1c30535ecab Author: Bruce Guenter Date: Sun Mar 19 05:48:23 2006 +0000 Fixed a bug in counting the length of signed and unsigned long long integers (0 was counted as having zero length). NEWS | 2 ++ fmt/sllnum.c | 6 ++++-- fmt/ullnum.c | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) commit ee65018d5fb44fa562970ec8747770a7b9d60889 Author: Bruce Guenter Date: Sun Mar 19 05:46:57 2006 +0000 Bumped version to 1.042 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit 14ffc6c8d8855bba6498593c1fc42e4c43136e58 Author: Bruce Guenter Date: Wed Mar 8 19:16:08 2006 +0000 Fixed up newline handling to deal with @verbatim and @example sections better. cli-generate.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) commit 6a220deaf2e12008dfa4bbeda530a87902c6f536 Author: Bruce Guenter Date: Fri Mar 3 21:49:04 2006 +0000 Renamed dict/hash.c and cdb/hash.c to prevent future linkage problems. cdb/{hash.c => cdbhash.c} | 0 cdb/lib=l | 3 +-- dict/{hash.c => dicthash.c} | 0 dict/lib=l | 2 +- 4 files changed, 2 insertions(+), 3 deletions(-) rename cdb/{hash.c => cdbhash.c} (100%) rename dict/{hash.c => dicthash.c} (100%) commit 21a5e64d1231e76a4cb58902a9e2ce8ae43a4592 Author: Bruce Guenter Date: Tue Feb 28 19:43:52 2006 +0000 Reverted revisions 677 and 678. From now on all crypto apps should target libtomcrypt (or some other better external library). NEWS | 7 +- VERSION | 2 +- crypto/hash-lookup.c | 43 --------- crypto/hash-md4.c | 196 -------------------------------------- crypto/hash-md5.c | 216 ------------------------------------------ crypto/hash-pack-uint128.c | 10 -- crypto/hash-pack-uint64.c | 14 --- crypto/hash-sha1.c | 168 --------------------------------- crypto/hash-sha256.c | 194 -------------------------------------- crypto/hash-sha384.c | 110 ---------------------- crypto/hash-sha512.c | 229 --------------------------------------------- crypto/hash.c | 102 -------------------- crypto/hash.h | 56 ----------- crypto/lib=l | 10 -- 14 files changed, 2 insertions(+), 1355 deletions(-) delete mode 100644 crypto/hash-lookup.c delete mode 100644 crypto/hash-md4.c delete mode 100644 crypto/hash-md5.c delete mode 100644 crypto/hash-pack-uint128.c delete mode 100644 crypto/hash-pack-uint64.c delete mode 100644 crypto/hash-sha1.c delete mode 100644 crypto/hash-sha256.c delete mode 100644 crypto/hash-sha384.c delete mode 100644 crypto/hash-sha512.c delete mode 100644 crypto/hash.c delete mode 100644 crypto/hash.h commit 031c40d85338d073a6ad7904bcb2fc46484f413a Author: Bruce Guenter Date: Tue Feb 28 19:36:45 2006 +0000 Removed extraneous #! header on cli-generate. cli-generate.pl | 1 - 1 file changed, 1 deletion(-) commit 77dfa60e69eda16aede787da9fbf6782ceab2ae4 Author: Bruce Guenter Date: Tue Feb 28 19:35:21 2006 +0000 Added support for HTML output to cli-generate. NEWS | 3 + TODO | 19 ---- cli-generate.1 | 5 + cli-generate.pl | 308 +++++++++++++++++++++++++++++++++++++++++++------------- 4 files changed, 246 insertions(+), 89 deletions(-) commit b37206f6738c07f76bb45602e755789ac358e8cf Author: Bruce Guenter Date: Tue Feb 28 17:56:45 2006 +0000 Added and fixed up the man page formatting codes. cli-generate.1 | 57 +++++++++++++++++++++++++++ cli-generate.pl | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 167 insertions(+), 10 deletions(-) commit ca6c8ac71e21dc88ba6d4a696fd6878f33e66bc8 Author: Bruce Guenter Date: Fri Feb 24 23:31:32 2006 +0000 Added some additional man page sections (warnings and authors). cli-generate.pl | 2 ++ 1 file changed, 2 insertions(+) commit 6d7318e69e795b5b7cd7ac79fedf8f7ddd42915d Author: Bruce Guenter Date: Wed Feb 22 18:05:12 2006 +0000 Added a crypto hash "lookup by name" function. NEWS | 2 ++ net/connect6.c => crypto/hash-lookup.c | 43 +++++++++++++++++----------------- crypto/hash-md4.c | 1 + crypto/hash-md5.c | 1 + crypto/hash-sha1.c | 1 + crypto/hash-sha256.c | 1 + crypto/hash-sha384.c | 1 + crypto/hash-sha512.c | 1 + crypto/hash.h | 3 +++ crypto/lib=l | 1 + 10 files changed, 34 insertions(+), 21 deletions(-) copy net/connect6.c => crypto/hash-lookup.c (55%) commit 3be0cb093130266be4907c9687cc3840d404fdf9 Author: Bruce Guenter Date: Wed Feb 22 17:18:37 2006 +0000 Modified all the crypto hash functions to fit a control block framework (like the HMAC system does), bumping the version to 1.050 NEWS | 5 +- VERSION | 2 +- crypto/hash-md4.c | 195 +++++++++++++++++++++++++++++++++ crypto/hash-md5.c | 215 +++++++++++++++++++++++++++++++++++++ crypto/hash-pack-uint128.c | 10 ++ crypto/hash-pack-uint64.c | 14 +++ crypto/hash-sha1.c | 167 ++++++++++++++++++++++++++++ crypto/{sha256.c => hash-sha256.c} | 127 +++++++++------------- crypto/{sha384.c => hash-sha384.c} | 60 ++++++----- crypto/{sha512.c => hash-sha512.c} | 140 ++++++++++-------------- crypto/hash.c | 102 ++++++++++++++++++ crypto/hash.h | 53 +++++++++ crypto/lib=l | 9 ++ 13 files changed, 910 insertions(+), 189 deletions(-) create mode 100644 crypto/hash-md4.c create mode 100644 crypto/hash-md5.c create mode 100644 crypto/hash-pack-uint128.c create mode 100644 crypto/hash-pack-uint64.c create mode 100644 crypto/hash-sha1.c copy crypto/{sha256.c => hash-sha256.c} (73%) copy crypto/{sha384.c => hash-sha384.c} (75%) copy crypto/{sha512.c => hash-sha512.c} (76%) create mode 100644 crypto/hash.c create mode 100644 crypto/hash.h commit 7acf82302ddf9d7276042350c036b9e4b5d00e45 Author: Bruce Guenter Date: Mon Feb 20 00:30:00 2006 +0000 Tweaked the hmac_finish prototype to properly indicate that the midstate is const and unmodified by the function. NEWS | 2 ++ TODO | 2 ++ crypto/hmac.c | 2 +- crypto/hmac.h | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) commit 870632edd85208e9fa6bbc6af1cb723680076e74 Author: Bruce Guenter Date: Mon Feb 20 00:29:20 2006 +0000 Bumped the version to 1.041 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit 9b41cfb62655535982f7447d7bc4d72abc561c3f Author: Bruce Guenter Date: Sun Feb 19 06:51:29 2006 +0000 Install the man page(s) into RPMs. spec | 2 ++ 1 file changed, 2 insertions(+) commit 83ba0bb8600f110fc20c449b09243cc9587cf36a Author: Bruce Guenter Date: Sun Feb 19 06:21:47 2006 +0000 Warn about missing Description: header in cli-generate. cli-generate.pl | 3 +++ 1 file changed, 3 insertions(+) commit 5340dbb5c3c6dd9748bb6d1987900654fef83dc3 Author: Bruce Guenter Date: Sun Feb 19 06:21:18 2006 +0000 Stop blocking SIGSEGV with the sig_all_* functions, as this has resulted in bugs causing endless signal loops. NEWS | 3 +++ unix/sig_all.c | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) commit 7741cd55f2b4babefae48c28070b38270bf2ddbb Author: Bruce Guenter Date: Sun Feb 19 06:20:09 2006 +0000 Added some more notes on the crypto hash rewriting. TODO | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) commit 2b75d700052c14d3d85fe82ef2622e68da6e489b Author: Bruce Guenter Date: Sun Feb 19 06:19:51 2006 +0000 Fixed a couple of installation bugs for the man page. INSTHIER | 1 + install.spac | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) commit 35b981474cc3443acb07ad50c98a0574e118134b Author: Bruce Guenter Date: Sun Feb 19 05:58:04 2006 +0000 Modified the crypto HMAC code to do precalculation of the intermediate hash results. NEWS | 3 ++ TODO | 11 ++++++++ crypto/hmac-sha1.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++ crypto/hmac-sha256.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++ crypto/hmac-sha384.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++ crypto/hmac-sha512.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++ crypto/hmac.c | 79 +++++++++++++++++++++++++++++++++++++++++----------- crypto/hmac.h | 16 +++++++++-- crypto/lib=l | 5 ++++ crypto/md5.c | 45 +----------------------------- crypto/sha1.c | 35 ----------------------- crypto/sha256.c | 35 ----------------------- crypto/sha384.c | 35 ----------------------- crypto/sha512.c | 35 ----------------------- 14 files changed, 397 insertions(+), 202 deletions(-) create mode 100644 crypto/hmac-sha1.c create mode 100644 crypto/hmac-sha256.c create mode 100644 crypto/hmac-sha384.c create mode 100644 crypto/hmac-sha512.c commit e8cac94621e86b6063267536a3577664a8e226b2 Author: Bruce Guenter Date: Fri Feb 17 19:31:54 2006 +0000 Cleaned up some bits I missed in the cli-generate man page. cli-generate.1 | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) commit e4232a8a4c44b3e6ce604f81725f648f75bf8e21 Author: Bruce Guenter Date: Fri Feb 17 19:27:15 2006 +0000 Added a man page for cli-generate. INSTHIER | 3 + cli-generate.1 | 192 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ cli-generate.pl | 2 +- conf-man | 4 ++ 4 files changed, 200 insertions(+), 1 deletion(-) create mode 100644 cli-generate.1 create mode 100644 conf-man commit 639d57a2a3cdc7053a4d3be27c9dd56f8150fe60 Author: Bruce Guenter Date: Fri Feb 17 18:59:15 2006 +0000 Account for the "-h, --help" options when calculating the minimum width. cli-generate.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit d340a7a14653eb180aecff0b423a742d2b83f1aa Author: Bruce Guenter Date: Fri Feb 17 18:27:43 2006 +0000 Added preliminary support for generating man pages. cli-generate.pl | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 115 insertions(+), 5 deletions(-) commit c696852303547a4bf3d48a59985fde5812b26d8f Author: Bruce Guenter Date: Fri Feb 17 15:42:23 2006 +0000 Simplified the header/section parsing mechanics to seperate dividing up the file into sections from parsing the content within the sections. This will make it simpler to add more kinds of sections (for docs). cli-generate.pl | 140 +++++++++++++++++++++++--------------------------------- 1 file changed, 57 insertions(+), 83 deletions(-) commit 8988b84338cb9eb40510b1ec3feccc08c4789149 Author: Bruce Guenter Date: Fri Feb 17 06:16:59 2006 +0000 Added a 'description' field to the header, and fixed up newline addition to the prefix in cli-generate. cli-generate.pl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) commit 494cc33e2b7bec1fbe824bedddc4a83ffc42c027 Author: Bruce Guenter Date: Thu Feb 16 22:48:18 2006 +0000 Tweaked the ghash_add function to return a pointer to the newly created entry (since some uses will want to use it immediately). NEWS | 3 +++ adt/ghash.h | 10 ++++++---- adt/ghash_add.c | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) commit 363c97ea96ae70ca466ea2c9d4aec6e0403ea0e6 Author: Bruce Guenter Date: Tue Jan 24 04:49:09 2006 +0000 Add support for outputting the msg_debug_bits flag in cli-generate. cli-generate.pl | 5 +++++ 1 file changed, 5 insertions(+) commit 94e1453440cbd753e0255f5998a930e7b21f9250 Author: Bruce Guenter Date: Sun Jan 22 04:27:57 2006 +0000 Large number of changes, mostly steming from reworking the program to work on a single file only, and send its output to stdout. Also made the script pre-calculate the help text (omitting it from cli_options), and fixed a number of bugs. cli-generate.pl | 206 +++++++++++++++++++++++++++----------------------------- 1 file changed, 99 insertions(+), 107 deletions(-) commit 8001d963c5ea5a528b02b87a404bd545f3797ef3 Author: Bruce Guenter Date: Fri Jan 20 22:53:58 2006 +0000 Split the help text output code out of the rest of the CLI library. cli/cli.h | 1 + cli/help.c | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++ cli/internal.h | 9 +++++ cli/lib=l | 1 + cli/main.c | 115 ++++++++++----------------------------------------------- 5 files changed, 134 insertions(+), 95 deletions(-) create mode 100644 cli/help.c create mode 100644 cli/internal.h commit 2985e0433cc349509e1347f11f92a9758a97ff2a Author: Bruce Guenter Date: Fri Jan 20 22:53:05 2006 +0000 Stamped the README with the year 2006. README.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 8dfdf539b5e98c728ae9a7cbee05a42d1bfc4310 Author: Bruce Guenter Date: Fri Jan 20 18:12:57 2006 +0000 Added cli-generate, a program to produce C header and source from command-line interface description files. INSTHIER | 1 + NEWS | 5 +- VERSION | 2 +- all.spac | 2 +- cli-generate.pl | 351 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ cli-generate=pl | 0 6 files changed, 358 insertions(+), 3 deletions(-) create mode 100644 cli-generate.pl create mode 100644 cli-generate=pl commit 3cfdc5051430a0ffb1accd87b52ae687c516daa6 Author: Bruce Guenter Date: Sun Dec 18 22:15:26 2005 +0000 Fixed base64 decoding on systems where char is unsigned by default. Thanks Gerrit Pape NEWS | 2 ++ base64/asc2bin.c | 2 +- base64/base64.h | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) commit 82d7628be2421058d715e937f98aee9681fa0db9 Author: Bruce Guenter Date: Sun Dec 18 22:13:52 2005 +0000 Bumped version to 1.032 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit e208c944df9a7da3392e31c76e5533bf604c058b Author: Bruce Guenter Date: Fri Dec 2 06:09:11 2005 +0000 Added note about missing installing hmac.h file. NEWS | 1 + 1 file changed, 1 insertion(+) commit 51afa18ddc6b3a745276af5617634a8391e7626c Author: Bruce Guenter Date: Fri Dec 2 06:08:30 2005 +0000 Bumped version to 1.031 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit c730153c1f548f6960a938daefd2b9d3a392ce41 Author: Bruce Guenter Date: Fri Dec 2 06:06:51 2005 +0000 Fixed missing installation of crypto/hmac.h INSTHIER | 1 + 1 file changed, 1 insertion(+) commit 409f51bd919f2924a6c51ab8bccd4ff5d2831c50 Author: Bruce Guenter Date: Fri Dec 2 04:26:39 2005 +0000 Bumped version to 1.030. VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 16024640f0c3df3019dd69c74eba6d4dbfb6b284 Author: Bruce Guenter Date: Fri Dec 2 03:51:31 2005 +0000 Fixed the copyright on the new HMAC code to the LGPL. crypto/hmac.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) commit 11b6420a5adc6dd82992fbe8a6d24e77f072a49d Author: Bruce Guenter Date: Thu Dec 1 22:07:11 2005 +0000 Added a RFC 2104 generic HMAC (keyed hashing for message authentication) routine to the crypto section, with control blocks for MD5, SHA1, SHA256, SHA384, and SHA512. NEWS | 6 ++++- crypto/hmac.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ crypto/hmac.h | 30 +++++++++++++++++++++++++ crypto/lib=l | 1 + crypto/md5.c | 52 +++++++++++++++++++++++++++++++++++++++---- crypto/sha1.c | 36 ++++++++++++++++++++++++++++++ crypto/sha256.c | 51 +++++++++++++++++++++++++++++++++++++------ crypto/sha384.c | 59 +++++++++++++++++++++++++++++++++++++++---------- crypto/sha512.c | 59 +++++++++++++++++++++++++++++++++++++++---------- 9 files changed, 328 insertions(+), 34 deletions(-) create mode 100644 crypto/hmac.c create mode 100644 crypto/hmac.h commit a68039a54400671ec7996f4877207a6d052b04b2 Author: Bruce Guenter Date: Wed Nov 30 03:52:22 2005 +0000 Updated the documentation inside bg-installer.c bg-installer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) commit 849b0974d8d5b42d11d852f5b908eeaff7198620 Author: Bruce Guenter Date: Tue Nov 29 18:56:38 2005 +0000 Added support for UID and GID names (instead of just numbers) in bg-installer. NEWS | 2 ++ bg-installer.c | 43 +++++++++++++++++++++++++++++++++++++------ 2 files changed, 39 insertions(+), 6 deletions(-) commit 9c2389f96ddcbaa6e8bd2ecde4da6278bc795ef8 Author: Bruce Guenter Date: Tue Nov 29 18:11:01 2005 +0000 Bumped version to 1.029 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit 859f719508f1154bb26233ceb3ee2c692f984294 Author: Bruce Guenter Date: Mon Nov 21 05:33:04 2005 +0000 Fixed missing dependancy in the sysdeps.h file. sysdeps.h.spac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) commit 28f6720b195359501f7c130b44d891939a0bacdf Author: Bruce Guenter Date: Mon Nov 21 04:51:21 2005 +0000 Fixed up copyright notice in the README. README.in | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) commit 6ef08c056e874189b79f3481dbadfd7464c93d82 Author: Bruce Guenter Date: Mon Nov 21 04:43:14 2005 +0000 Since the copyright changed, added a 2005 copyright stamp on all files claimed by myself. cdb++/cdb_get.cc | 2 +- cdb++/cdb_getrec.cc | 2 +- cdb++/cdb_make.cc | 2 +- cdb++/cdb_reader.cc | 2 +- cdb++/cdb_writer.cc | 2 +- cdb++/datum.cc | 2 +- cdb++/internal.h | 2 +- cdb/get.c | 2 +- cdb/getnext.c | 2 +- cgi/cgi-args.cc | 2 +- cgi/cgi-base.cc | 2 +- cli++/clitest.cc | 2 +- cli++/main.cc | 2 +- cli++/messages.cc | 2 +- cli/main.c | 2 +- crypto/md4.c | 2 +- crypto/md4.h | 2 +- crypto/sha256.c | 2 +- crypto/sha384.c | 2 +- crypto/sha512.c | 2 +- crypto/surf.c | 2 +- fdbuf/fdbuf.cc | 2 +- fdbuf/fdbuf.h | 2 +- fdbuf/fdbuf_copy.cc | 2 +- fdbuf/fdibuf.cc | 2 +- fdbuf/fdibuf.h | 2 +- fdbuf/fdibuf_mystring.cc | 2 +- fdbuf/fdibuf_netstring.cc | 2 +- fdbuf/fdobuf.cc | 2 +- fdbuf/fdobuf.h | 2 +- fdbuf/fdobuf_chownmod.cc | 2 +- fdbuf/fdobuf_seek.cc | 2 +- fdbuf/fdobuf_signed.cc | 2 +- fdbuf/fdobuf_unsigned.cc | 2 +- fmt/sllnum.c | 2 +- fmt/snum.c | 2 +- fmt/ullnum.c | 2 +- fmt/unum.c | 2 +- mystring/count.cc | 2 +- mystring/iter.cc | 2 +- mystring/iter.h | 2 +- mystring/join.h | 2 +- mystring/mystring.h | 2 +- mystring/rep.h | 2 +- net/accept4.c | 2 +- net/accept6.c | 2 +- net/acceptu.c | 2 +- net/bind4.c | 2 +- net/bind6.c | 2 +- net/bindu.c | 2 +- net/broadcast.c | 2 +- net/connect4.c | 2 +- net/connect4_timeout.c | 2 +- net/connect6.c | 2 +- net/connect6_timeout.c | 2 +- net/connected.c | 2 +- net/connectu.c | 2 +- net/connectu_timeout.c | 2 +- net/cork.c | 2 +- net/getaddr4.c | 2 +- net/getaddr6.c | 2 +- net/linger.c | 2 +- net/listen.c | 2 +- net/notcpdelay.c | 2 +- net/pairdgm.c | 2 +- net/pairstr.c | 2 +- net/recv4.c | 2 +- net/recv6.c | 2 +- net/recvfd.c | 2 +- net/recvu.c | 2 +- net/reuse.c | 2 +- net/send4.c | 2 +- net/send6.c | 2 +- net/sendfd.c | 2 +- net/sendu.c | 2 +- net/setopt.c | 2 +- net/shutdown.c | 2 +- net/tcp4.c | 2 +- net/tcp6.c | 2 +- net/udp4.c | 2 +- net/udp6.c | 2 +- net/uncork.c | 2 +- net/unixdgm.c | 2 +- net/unixstr.c | 2 +- path/contains.c | 2 +- path/fnmatch.c | 2 +- path/match.c | 2 +- path/merge.c | 2 +- python/template/__init__.py | 2 +- python/template/context.py | 2 +- python/template/functions.py | 2 +- python/template/lex.py | 2 +- python/template/parser.py | 2 +- python/template/syntax.py | 2 +- str/buildmap.c | 2 +- str/case_match.c | 2 +- str/case_start.c | 2 +- str/cat.c | 2 +- str/cat2s.c | 2 +- str/cat3s.c | 2 +- str/cat4s.c | 2 +- str/cat5s.c | 2 +- str/cat6s.c | 2 +- str/catiw.c | 2 +- str/catiwll.c | 2 +- str/catns.c | 2 +- str/catsllnum.c | 2 +- str/catsnum.c | 2 +- str/catullnum.c | 2 +- str/catunum.c | 2 +- str/catuw.c | 2 +- str/catuwll.c | 2 +- str/catxw.c | 2 +- str/catxwll.c | 2 +- str/cmp.c | 2 +- str/copy.c | 2 +- str/copy2s.c | 2 +- str/copy3s.c | 2 +- str/copy4s.c | 2 +- str/copy5s.c | 2 +- str/copy6s.c | 2 +- str/copyns.c | 2 +- str/count.c | 2 +- str/countof.c | 2 +- str/cut.c | 2 +- str/diff.c | 2 +- str/findnext.c | 2 +- str/findnextnot.c | 2 +- str/findnextof.c | 2 +- str/free.c | 2 +- str/init.c | 2 +- str/join.c | 2 +- str/lower.c | 2 +- str/lstrip.c | 2 +- str/match.c | 2 +- str/rstrip.c | 2 +- str/sort.c | 2 +- str/splice.c | 2 +- str/start.c | 2 +- str/subst.c | 2 +- str/truncate.c | 2 +- str/upper.c | 2 +- str/xlate.c | 2 +- unix/cloexec_off.c | 2 +- unix/cloexec_on.c | 2 +- unix/fcntl_fd_off.c | 2 +- unix/fcntl_fd_on.c | 2 +- unix/fcntl_fl_off.c | 2 +- unix/fcntl_fl_on.c | 2 +- unix/nonblock_off.c | 2 +- unix/nonblock_on.c | 2 +- unix/sig_block.c | 2 +- unix/sig_catch.c | 2 +- unix/sig_suspend.c | 2 +- 154 files changed, 154 insertions(+), 154 deletions(-) commit 7cc27b9b17c771df6c4645c044d44ec97c2725d0 Author: Bruce Guenter Date: Mon Nov 21 04:39:57 2005 +0000 Switched from standard GPL to LGPL-2.1 license. NEWS | 2 ++ bg-installer.c | 20 ++++++++++---------- cdb++/cdb++.h | 20 ++++++++++---------- cdb++/cdb_get.cc | 20 ++++++++++---------- cdb++/cdb_getrec.cc | 20 ++++++++++---------- cdb++/cdb_make.cc | 20 ++++++++++---------- cdb++/cdb_reader.cc | 20 ++++++++++---------- cdb++/cdb_writer.cc | 20 ++++++++++---------- cdb++/datum.cc | 20 ++++++++++---------- cdb++/internal.h | 20 ++++++++++---------- cdb/get.c | 20 ++++++++++---------- cdb/getnext.c | 20 ++++++++++---------- cgi/cgi-args.cc | 20 ++++++++++---------- cgi/cgi-base.cc | 20 ++++++++++---------- cli++/clitest.cc | 20 ++++++++++---------- cli++/main.cc | 20 ++++++++++---------- cli++/messages.cc | 20 ++++++++++---------- cli/main.c | 20 ++++++++++---------- crypto/md4.c | 20 ++++++++++---------- crypto/sha256.c | 20 ++++++++++---------- crypto/sha384.c | 20 ++++++++++---------- crypto/sha512.c | 20 ++++++++++---------- crypto/surf.c | 20 ++++++++++---------- fdbuf/fdbuf.cc | 20 ++++++++++---------- fdbuf/fdbuf.h | 20 ++++++++++---------- fdbuf/fdbuf_copy.cc | 20 ++++++++++---------- fdbuf/fdibuf.cc | 20 ++++++++++---------- fdbuf/fdibuf.h | 20 ++++++++++---------- fdbuf/fdibuf_mystring.cc | 20 ++++++++++---------- fdbuf/fdibuf_netstring.cc | 20 ++++++++++---------- fdbuf/fdobuf.cc | 20 ++++++++++---------- fdbuf/fdobuf.h | 20 ++++++++++---------- fdbuf/fdobuf_chownmod.cc | 20 ++++++++++---------- fdbuf/fdobuf_seek.cc | 20 ++++++++++---------- fdbuf/fdobuf_signed.cc | 20 ++++++++++---------- fdbuf/fdobuf_unsigned.cc | 20 ++++++++++---------- fmt/char.c | 20 ++++++++++---------- fmt/chars.c | 20 ++++++++++---------- fmt/multi.c | 20 ++++++++++---------- fmt/sllnum.c | 20 ++++++++++---------- fmt/snum.c | 20 ++++++++++---------- fmt/ullnum.c | 20 ++++++++++---------- fmt/unum.c | 20 ++++++++++---------- iobuf/ibuf_getstr_crlf.c | 20 ++++++++++---------- mystring/count.cc | 20 ++++++++++---------- mystring/iter.cc | 20 ++++++++++---------- mystring/iter.h | 20 ++++++++++---------- mystring/join.h | 20 ++++++++++---------- mystring/mystring.h | 20 ++++++++++---------- mystring/rep.h | 20 ++++++++++---------- net/accept4.c | 20 ++++++++++---------- net/accept6.c | 20 ++++++++++---------- net/acceptu.c | 20 ++++++++++---------- net/bind4.c | 20 ++++++++++---------- net/bind6.c | 20 ++++++++++---------- net/bindu.c | 20 ++++++++++---------- net/broadcast.c | 20 ++++++++++---------- net/connect4.c | 20 ++++++++++---------- net/connect4_timeout.c | 20 ++++++++++---------- net/connect6.c | 20 ++++++++++---------- net/connect6_timeout.c | 20 ++++++++++---------- net/connected.c | 20 ++++++++++---------- net/connectu.c | 20 ++++++++++---------- net/connectu_timeout.c | 20 ++++++++++---------- net/cork.c | 20 ++++++++++---------- net/getaddr4.c | 20 ++++++++++---------- net/getaddr6.c | 20 ++++++++++---------- net/linger.c | 20 ++++++++++---------- net/listen.c | 20 ++++++++++---------- net/notcpdelay.c | 20 ++++++++++---------- net/pairdgm.c | 20 ++++++++++---------- net/pairstr.c | 20 ++++++++++---------- net/recv4.c | 20 ++++++++++---------- net/recv6.c | 20 ++++++++++---------- net/recvfd.c | 20 ++++++++++---------- net/recvu.c | 20 ++++++++++---------- net/reuse.c | 20 ++++++++++---------- net/send4.c | 20 ++++++++++---------- net/send6.c | 20 ++++++++++---------- net/sendfd.c | 20 ++++++++++---------- net/sendu.c | 20 ++++++++++---------- net/setopt.c | 20 ++++++++++---------- net/shutdown.c | 20 ++++++++++---------- net/tcp4.c | 20 ++++++++++---------- net/tcp6.c | 20 ++++++++++---------- net/udp4.c | 20 ++++++++++---------- net/udp6.c | 20 ++++++++++---------- net/uncork.c | 20 ++++++++++---------- net/unixdgm.c | 20 ++++++++++---------- net/unixstr.c | 20 ++++++++++---------- path/contains.c | 20 ++++++++++---------- path/fnmatch.c | 20 ++++++++++---------- path/match.c | 20 ++++++++++---------- path/merge.c | 20 ++++++++++---------- python/template/__init__.py | 20 ++++++++++---------- python/template/context.py | 20 ++++++++++---------- python/template/functions.py | 20 ++++++++++---------- python/template/lex.py | 20 ++++++++++---------- python/template/parser.py | 20 ++++++++++---------- python/template/syntax.py | 20 ++++++++++---------- str/alloc.c | 20 ++++++++++---------- str/buildmap.c | 20 ++++++++++---------- str/case_match.c | 20 ++++++++++---------- str/case_start.c | 20 ++++++++++---------- str/cat.c | 20 ++++++++++---------- str/cat2s.c | 20 ++++++++++---------- str/cat3s.c | 20 ++++++++++---------- str/cat4s.c | 20 ++++++++++---------- str/cat5s.c | 20 ++++++++++---------- str/cat6s.c | 20 ++++++++++---------- str/catf.c | 20 ++++++++++---------- str/catiw.c | 20 ++++++++++---------- str/catiwll.c | 20 ++++++++++---------- str/catns.c | 20 ++++++++++---------- str/catsllnum.c | 20 ++++++++++---------- str/catsnum.c | 20 ++++++++++---------- str/catullnum.c | 20 ++++++++++---------- str/catunum.c | 20 ++++++++++---------- str/catuw.c | 20 ++++++++++---------- str/catuwll.c | 20 ++++++++++---------- str/catxw.c | 20 ++++++++++---------- str/catxwll.c | 20 ++++++++++---------- str/cmp.c | 20 ++++++++++---------- str/copy.c | 20 ++++++++++---------- str/copy2s.c | 20 ++++++++++---------- str/copy3s.c | 20 ++++++++++---------- str/copy4s.c | 20 ++++++++++---------- str/copy5s.c | 20 ++++++++++---------- str/copy6s.c | 20 ++++++++++---------- str/copyf.c | 20 ++++++++++---------- str/copyns.c | 20 ++++++++++---------- str/count.c | 20 ++++++++++---------- str/countof.c | 20 ++++++++++---------- str/cut.c | 20 ++++++++++---------- str/diff.c | 20 ++++++++++---------- str/findnext.c | 20 ++++++++++---------- str/findnextnot.c | 20 ++++++++++---------- str/findnextof.c | 20 ++++++++++---------- str/findprev.c | 20 ++++++++++---------- str/findprevnot.c | 20 ++++++++++---------- str/findprevof.c | 20 ++++++++++---------- str/free.c | 20 ++++++++++---------- str/init.c | 20 ++++++++++---------- str/join.c | 20 ++++++++++---------- str/lower.c | 20 ++++++++++---------- str/lstrip.c | 20 ++++++++++---------- str/match.c | 20 ++++++++++---------- str/rstrip.c | 20 ++++++++++---------- str/sort.c | 20 ++++++++++---------- str/splice.c | 20 ++++++++++---------- str/start.c | 20 ++++++++++---------- str/subst.c | 20 ++++++++++---------- str/truncate.c | 20 ++++++++++---------- str/upper.c | 20 ++++++++++---------- str/xlate.c | 20 ++++++++++---------- unix/cloexec_off.c | 20 ++++++++++---------- unix/cloexec_on.c | 20 ++++++++++---------- unix/fcntl_fd_off.c | 20 ++++++++++---------- unix/fcntl_fd_on.c | 20 ++++++++++---------- unix/fcntl_fl_off.c | 20 ++++++++++---------- unix/fcntl_fl_on.c | 20 ++++++++++---------- unix/nonblock_off.c | 20 ++++++++++---------- unix/nonblock_on.c | 20 ++++++++++---------- unix/sig_block.c | 20 ++++++++++---------- unix/sig_catch.c | 20 ++++++++++---------- unix/sig_suspend.c | 20 ++++++++++---------- 166 files changed, 1652 insertions(+), 1650 deletions(-) commit 5538b03d481d51e6fde31e4b53a8a98b8f059710 Author: Bruce Guenter Date: Sun Nov 20 23:38:23 2005 +0000 Switched email address from bruceg@em.ca to bruce@untroubled.org. README.in | 2 +- cdb++/cdb++.h | 2 +- cdb++/cdb_get.cc | 2 +- cdb++/cdb_getrec.cc | 2 +- cdb++/cdb_make.cc | 2 +- cdb++/cdb_reader.cc | 2 +- cdb++/cdb_writer.cc | 2 +- cdb++/datum.cc | 2 +- cdb++/internal.h | 2 +- cdb/get.c | 2 +- cdb/getnext.c | 2 +- cgi/cgi-args.cc | 2 +- cgi/cgi-base.cc | 2 +- cli++/clitest.cc | 2 +- cli++/main.cc | 2 +- cli++/messages.cc | 2 +- cli/main.c | 2 +- crypto/md5.c | 2 +- crypto/sha1.c | 2 +- crypto/sha1.h | 2 +- crypto/sha256.c | 2 +- crypto/sha384.c | 2 +- crypto/sha512.c | 2 +- crypto/surf.c | 2 +- fdbuf/fdbuf.cc | 2 +- fdbuf/fdbuf.h | 2 +- fdbuf/fdbuf_copy.cc | 2 +- fdbuf/fdibuf.cc | 2 +- fdbuf/fdibuf.h | 2 +- fdbuf/fdibuf_mystring.cc | 2 +- fdbuf/fdibuf_netstring.cc | 2 +- fdbuf/fdobuf.cc | 2 +- fdbuf/fdobuf.h | 2 +- fdbuf/fdobuf_chownmod.cc | 2 +- fdbuf/fdobuf_seek.cc | 2 +- fdbuf/fdobuf_signed.cc | 2 +- fdbuf/fdobuf_unsigned.cc | 2 +- fmt/char.c | 2 +- fmt/chars.c | 2 +- fmt/multi.c | 2 +- fmt/sllnum.c | 2 +- fmt/snum.c | 2 +- fmt/ullnum.c | 2 +- fmt/unum.c | 2 +- mystring/count.cc | 2 +- mystring/iter.cc | 2 +- mystring/iter.h | 2 +- mystring/join.h | 2 +- mystring/mystring.h | 2 +- mystring/rep.h | 2 +- net/accept4.c | 2 +- net/accept6.c | 2 +- net/acceptu.c | 2 +- net/bind4.c | 2 +- net/bind6.c | 2 +- net/bindu.c | 2 +- net/broadcast.c | 2 +- net/connect4.c | 2 +- net/connect4_timeout.c | 2 +- net/connect6.c | 2 +- net/connect6_timeout.c | 2 +- net/connected.c | 2 +- net/connectu.c | 2 +- net/connectu_timeout.c | 2 +- net/cork.c | 2 +- net/getaddr4.c | 2 +- net/getaddr6.c | 2 +- net/linger.c | 2 +- net/listen.c | 2 +- net/notcpdelay.c | 2 +- net/pairdgm.c | 2 +- net/pairstr.c | 2 +- net/recv4.c | 2 +- net/recv6.c | 2 +- net/recvfd.c | 2 +- net/recvu.c | 2 +- net/reuse.c | 2 +- net/send4.c | 2 +- net/send6.c | 2 +- net/sendfd.c | 2 +- net/sendu.c | 2 +- net/setopt.c | 2 +- net/shutdown.c | 2 +- net/tcp4.c | 2 +- net/tcp6.c | 2 +- net/udp4.c | 2 +- net/udp6.c | 2 +- net/uncork.c | 2 +- net/unixdgm.c | 2 +- net/unixstr.c | 2 +- path/contains.c | 2 +- path/fnmatch.c | 2 +- path/match.c | 2 +- path/merge.c | 2 +- python/template/__init__.py | 2 +- python/template/context.py | 2 +- python/template/functions.py | 2 +- python/template/lex.py | 2 +- python/template/parser.py | 2 +- python/template/syntax.py | 2 +- spec | 2 +- str/alloc.c | 2 +- str/buildmap.c | 2 +- str/case_match.c | 2 +- str/case_start.c | 2 +- str/cat.c | 2 +- str/cat2s.c | 2 +- str/cat3s.c | 2 +- str/cat4s.c | 2 +- str/cat5s.c | 2 +- str/cat6s.c | 2 +- str/catf.c | 2 +- str/catiw.c | 2 +- str/catiwll.c | 2 +- str/catns.c | 2 +- str/catsllnum.c | 2 +- str/catsnum.c | 2 +- str/catullnum.c | 2 +- str/catunum.c | 2 +- str/catuw.c | 2 +- str/catuwll.c | 2 +- str/catxw.c | 2 +- str/catxwll.c | 2 +- str/cmp.c | 2 +- str/copy.c | 2 +- str/copy2s.c | 2 +- str/copy3s.c | 2 +- str/copy4s.c | 2 +- str/copy5s.c | 2 +- str/copy6s.c | 2 +- str/copyf.c | 2 +- str/copyns.c | 2 +- str/count.c | 2 +- str/countof.c | 2 +- str/cut.c | 2 +- str/diff.c | 2 +- str/findnext.c | 2 +- str/findnextnot.c | 2 +- str/findnextof.c | 2 +- str/findprev.c | 2 +- str/findprevnot.c | 2 +- str/findprevof.c | 2 +- str/free.c | 2 +- str/init.c | 2 +- str/join.c | 2 +- str/lower.c | 2 +- str/lstrip.c | 2 +- str/match.c | 2 +- str/rstrip.c | 2 +- str/sort.c | 2 +- str/splice.c | 2 +- str/start.c | 2 +- str/subst.c | 2 +- str/truncate.c | 2 +- str/upper.c | 2 +- str/xlate.c | 2 +- unix/cloexec_off.c | 2 +- unix/cloexec_on.c | 2 +- unix/fcntl_fd_off.c | 2 +- unix/fcntl_fd_on.c | 2 +- unix/fcntl_fl_off.c | 2 +- unix/fcntl_fl_on.c | 2 +- unix/nonblock_off.c | 2 +- unix/nonblock_on.c | 2 +- unix/sig_block.c | 2 +- unix/sig_catch.c | 2 +- unix/sig_suspend.c | 2 +- 167 files changed, 167 insertions(+), 167 deletions(-) commit f4999098287c1be44ffd88e57e83e7db44315d56 Author: Bruce Guenter Date: Fri Nov 4 20:47:46 2005 +0000 Fixed bug in self test for unix/selfpipe.c that caused problems with running make -- the self test sent signals to "0", which is the process group, instead of to a single PID. NEWS | 3 +++ unix/selfpipe.c | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) commit 3b84c854ea167890c232d13714f6e3bca806c241 Author: Bruce Guenter Date: Wed Nov 2 17:37:50 2005 +0000 Expose the mystring::append functions publically. mystring/mystring.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) commit 3c9e872c084a6e4d7a48d1cf3bf3acd49cc61934 Author: Bruce Guenter Date: Sun Sep 4 04:41:12 2005 +0000 Fixed name of cli++topod.pl script. cli++/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 1b22e74d62493c5b455a5a3c3ea6dbc3601b1c89 Author: Bruce Guenter Date: Sun Sep 4 04:20:59 2005 +0000 Changed the definition of uint32 to just "unsigned" in order to make the cdb++ library work on both 32 and 64-bit systems. cdb++/cdb++.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) commit fec890671c833192b9ab6de342de1c817bc7e293 Author: Bruce Guenter Date: Mon Aug 29 17:39:54 2005 +0000 Fixed sysdep for clock_gettime to link with rt.lib. sysdeps.h.spac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) commit e6d4dbc1421c939f3feee704b5e93ec0ce494e15 Author: Bruce Guenter Date: Mon Aug 29 17:32:59 2005 +0000 Added sysdep for dynamic linker functions (dlopen etc). NEWS | 1 + choose.sh | 12 +++++++----- dotlibs.spac | 2 +- sys/hasdl.h0 | 1 + sys/hasdl.h1 | 2 ++ sys/trydl.c | 10 ++++++++++ sysdeps.h.spac | 4 +++- 7 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 sys/hasdl.h0 create mode 100644 sys/hasdl.h1 create mode 100644 sys/trydl.c commit 42aa4ab1ff9ebd23b95279dfbcaaffd9463a05eb Author: Bruce Guenter Date: Mon Aug 29 17:32:16 2005 +0000 Bumped version to 1.028 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit 32710ac43be298788556bfeba11e14e807154e43 Author: Bruce Guenter Date: Mon Aug 29 17:20:07 2005 +0000 Simplified sysdep choosing: All sysdeps follow the try*.c has*.h0 has*.h1 scheme. sys/{direntry.h0 => hasdirent.h0} | 0 sys/{direntry.h1 => hasdirent.h1} | 0 sys/{endian.h0 => hasendian.h0} | 0 sys/{endian.h1 => hasendian.h1} | 0 sys/{iopoll.h0 => haspoll.h0} | 5 ----- sys/{iopoll.h1 => haspoll.h1} | 5 ----- sys/{uint32.h0 => hasulong32.h0} | 0 sys/{uint32.h1 => hasulong32.h1} | 0 sys/{uint64.h0 => hasulong64.h0} | 0 sys/{uint64.h1 => hasulong64.h1} | 0 sys/{unaligned.h0 => hasunaligned.h0} | 0 sys/{unaligned.h1 => hasunaligned.h1} | 0 sys/{unsetenv.h0 => hasunsetenv.h0} | 0 sys/{unsetenv.h1 => hasunsetenv.h1} | 0 sysdeps.h.spac | 32 +++++++++++++------------------- 15 files changed, 13 insertions(+), 29 deletions(-) rename sys/{direntry.h0 => hasdirent.h0} (100%) rename sys/{direntry.h1 => hasdirent.h1} (100%) rename sys/{endian.h0 => hasendian.h0} (100%) rename sys/{endian.h1 => hasendian.h1} (100%) rename sys/{iopoll.h0 => haspoll.h0} (86%) rename sys/{iopoll.h1 => haspoll.h1} (85%) rename sys/{uint32.h0 => hasulong32.h0} (100%) rename sys/{uint32.h1 => hasulong32.h1} (100%) rename sys/{uint64.h0 => hasulong64.h0} (100%) rename sys/{uint64.h1 => hasulong64.h1} (100%) rename sys/{unaligned.h0 => hasunaligned.h0} (100%) rename sys/{unaligned.h1 => hasunaligned.h1} (100%) rename sys/{unsetenv.h0 => hasunsetenv.h0} (100%) rename sys/{unsetenv.h1 => hasunsetenv.h1} (100%) commit ae26188abdf34f5a918fd4f1d6eab583998c0497 Author: Bruce Guenter Date: Mon Aug 29 17:10:26 2005 +0000 Renamed .h2 to .h1 (1 meaning "on") and fixed up the choose.sh file to match. choose.sh | 8 ++++---- sys/{direntry.h2 => direntry.h1} | 0 sys/{endian.h2 => endian.h1} | 0 sys/{hasclockgettime.h2 => hasclockgettime.h1} | 0 sys/{hasdaylight.h2 => hasdaylight.h1} | 0 sys/{hasdeprecated.h2 => hasdeprecated.h1} | 0 sys/{hasflock.h2 => hasflock.h1} | 0 sys/{hasgetpeereid.h2 => hasgetpeereid.h1} | 0 sys/{hasinline.h2 => hasinline.h1} | 0 sys/{hasipv6.h2 => hasipv6.h1} | 0 sys/{hasmkfifo.h2 => hasmkfifo.h1} | 0 sys/{hasnamedpipebug.h2 => hasnamedpipebug.h1} | 0 sys/{haspeercred.h2 => haspeercred.h1} | 0 sys/{hassendfile.h2 => hassendfile.h1} | 0 sys/{hassetenv.h2 => hassetenv.h1} | 0 sys/{hassigaction.h2 => hassigaction.h1} | 0 sys/{hassigprocmask.h2 => hassigprocmask.h1} | 0 sys/{hasspnam.h2 => hasspnam.h1} | 0 sys/{hassysselect.h2 => hassysselect.h1} | 0 sys/{hastimespec.h2 => hastimespec.h1} | 0 sys/{hasuserpw.h2 => hasuserpw.h1} | 0 sys/{hasvfork.h2 => hasvfork.h1} | 0 sys/{haswaitp.h2 => haswaitp.h1} | 0 sys/{haszlib.h2 => haszlib.h1} | 0 sys/{iopoll.h2 => iopoll.h1} | 0 sys/{uint32.h2 => uint32.h1} | 0 sys/{uint64.h2 => uint64.h1} | 0 sys/{unaligned.h2 => unaligned.h1} | 0 sys/{unsetenv.h2 => unsetenv.h1} | 0 sysdeps.h.spac | 16 ++++++++-------- 30 files changed, 12 insertions(+), 12 deletions(-) rename sys/{direntry.h2 => direntry.h1} (100%) rename sys/{endian.h2 => endian.h1} (100%) rename sys/{hasclockgettime.h2 => hasclockgettime.h1} (100%) rename sys/{hasdaylight.h2 => hasdaylight.h1} (100%) rename sys/{hasdeprecated.h2 => hasdeprecated.h1} (100%) rename sys/{hasflock.h2 => hasflock.h1} (100%) rename sys/{hasgetpeereid.h2 => hasgetpeereid.h1} (100%) rename sys/{hasinline.h2 => hasinline.h1} (100%) rename sys/{hasipv6.h2 => hasipv6.h1} (100%) rename sys/{hasmkfifo.h2 => hasmkfifo.h1} (100%) rename sys/{hasnamedpipebug.h2 => hasnamedpipebug.h1} (100%) rename sys/{haspeercred.h2 => haspeercred.h1} (100%) rename sys/{hassendfile.h2 => hassendfile.h1} (100%) rename sys/{hassetenv.h2 => hassetenv.h1} (100%) rename sys/{hassigaction.h2 => hassigaction.h1} (100%) rename sys/{hassigprocmask.h2 => hassigprocmask.h1} (100%) rename sys/{hasspnam.h2 => hasspnam.h1} (100%) rename sys/{hassysselect.h2 => hassysselect.h1} (100%) rename sys/{hastimespec.h2 => hastimespec.h1} (100%) rename sys/{hasuserpw.h2 => hasuserpw.h1} (100%) rename sys/{hasvfork.h2 => hasvfork.h1} (100%) rename sys/{haswaitp.h2 => haswaitp.h1} (100%) rename sys/{haszlib.h2 => haszlib.h1} (100%) rename sys/{iopoll.h2 => iopoll.h1} (100%) rename sys/{uint32.h2 => uint32.h1} (100%) rename sys/{uint64.h2 => uint64.h1} (100%) rename sys/{unaligned.h2 => unaligned.h1} (100%) rename sys/{unsetenv.h2 => unsetenv.h1} (100%) commit 7949ef52ab42a717b4147fb118e8c618f6830e4a Author: Bruce Guenter Date: Mon Aug 29 17:10:02 2005 +0000 Switched from hard-coded constants to the symbolic names for vpwentry flag numbers. vmailmgr/vpwentry_import.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) commit 9369f973de71880e8e196f4beaf9471573d09933 Author: Bruce Guenter Date: Mon Aug 29 17:08:28 2005 +0000 First step of renaming has*.h# files: .h1 becomes .h0 (0 meaning not set) sys/{direntry.h1 => direntry.h0} | 0 sys/{endian.h1 => endian.h0} | 0 sys/{hasclockgettime.h1 => hasclockgettime.h0} | 0 sys/{hasdaylight.h1 => hasdaylight.h0} | 0 sys/{hasdeprecated.h1 => hasdeprecated.h0} | 0 sys/{hasflock.h1 => hasflock.h0} | 0 sys/{hasgetpeereid.h1 => hasgetpeereid.h0} | 0 sys/{hasinline.h1 => hasinline.h0} | 0 sys/{hasipv6.h1 => hasipv6.h0} | 0 sys/{hasmkfifo.h1 => hasmkfifo.h0} | 0 sys/{hasnamedpipebug.h1 => hasnamedpipebug.h0} | 0 sys/{haspeercred.h1 => haspeercred.h0} | 0 sys/{hassendfile.h1 => hassendfile.h0} | 0 sys/{hassetenv.h1 => hassetenv.h0} | 0 sys/{hassigaction.h1 => hassigaction.h0} | 0 sys/{hassigprocmask.h1 => hassigprocmask.h0} | 0 sys/{hasspnam.h1 => hasspnam.h0} | 0 sys/{hassysselect.h1 => hassysselect.h0} | 0 sys/{hastimespec.h1 => hastimespec.h0} | 0 sys/{hasuserpw.h1 => hasuserpw.h0} | 0 sys/{hasvfork.h1 => hasvfork.h0} | 0 sys/{haswaitp.h1 => haswaitp.h0} | 0 sys/{haszlib.h1 => haszlib.h0} | 0 sys/{iopoll.h1 => iopoll.h0} | 0 sys/{uint32.h1 => uint32.h0} | 0 sys/{uint64.h1 => uint64.h0} | 0 sys/{unaligned.h1 => unaligned.h0} | 0 sys/{unsetenv.h1 => unsetenv.h0} | 0 28 files changed, 0 insertions(+), 0 deletions(-) rename sys/{direntry.h1 => direntry.h0} (100%) rename sys/{endian.h1 => endian.h0} (100%) rename sys/{hasclockgettime.h1 => hasclockgettime.h0} (100%) rename sys/{hasdaylight.h1 => hasdaylight.h0} (100%) rename sys/{hasdeprecated.h1 => hasdeprecated.h0} (100%) rename sys/{hasflock.h1 => hasflock.h0} (100%) rename sys/{hasgetpeereid.h1 => hasgetpeereid.h0} (100%) rename sys/{hasinline.h1 => hasinline.h0} (100%) rename sys/{hasipv6.h1 => hasipv6.h0} (100%) rename sys/{hasmkfifo.h1 => hasmkfifo.h0} (100%) rename sys/{hasnamedpipebug.h1 => hasnamedpipebug.h0} (100%) rename sys/{haspeercred.h1 => haspeercred.h0} (100%) rename sys/{hassendfile.h1 => hassendfile.h0} (100%) rename sys/{hassetenv.h1 => hassetenv.h0} (100%) rename sys/{hassigaction.h1 => hassigaction.h0} (100%) rename sys/{hassigprocmask.h1 => hassigprocmask.h0} (100%) rename sys/{hasspnam.h1 => hasspnam.h0} (100%) rename sys/{hassysselect.h1 => hassysselect.h0} (100%) rename sys/{hastimespec.h1 => hastimespec.h0} (100%) rename sys/{hasuserpw.h1 => hasuserpw.h0} (100%) rename sys/{hasvfork.h1 => hasvfork.h0} (100%) rename sys/{haswaitp.h1 => haswaitp.h0} (100%) rename sys/{haszlib.h1 => haszlib.h0} (100%) rename sys/{iopoll.h1 => iopoll.h0} (100%) rename sys/{uint32.h1 => uint32.h0} (100%) rename sys/{uint64.h1 => uint64.h0} (100%) rename sys/{unaligned.h1 => unaligned.h0} (100%) rename sys/{unsetenv.h1 => unsetenv.h0} (100%) commit 63f1a5310315fcf7c360adfbc0b24f1be0f7ea40 Author: Bruce Guenter Date: Tue Aug 23 18:21:54 2005 +0000 Added some selftests for a few ibuf functions. iobuf/ibuf_getc.c | 24 ++++++++++++++++++++++++ iobuf/ibuf_getnetstring.c | 22 ++++++++++++++++++++++ iobuf/ibuf_gets.c | 21 +++++++++++++++++++++ iobuf/ibuf_getstr_crlf.c | 23 +++++++++++++++++++++++ 4 files changed, 90 insertions(+) commit 72f012097cbbb67957086f6cdad70416059398c8 Author: Bruce Guenter Date: Tue Aug 23 17:41:16 2005 +0000 Added notes about recent changes. NEWS | 4 ++++ 1 file changed, 4 insertions(+) commit 44ce8a40d02d639e86e84ad130531b2201a448f4 Author: Bruce Guenter Date: Tue Aug 23 17:37:44 2005 +0000 Added some generated .lib files, for testing. INSTHIER | 8 ++++++++ all.spac | 2 +- dotlibs.spac | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 dotlibs.spac commit 3e9d76cd863f67477c31ec454acbd4fc3b214fb3 Author: Bruce Guenter Date: Fri Aug 19 22:38:58 2005 +0000 Fixed numberic export glitch in vpwentry_export: (unsigned)-1 is represented in vpwentries as "-" instead of "4294967295". NEWS | 1 + vmailmgr/vpwentry_export.c | 2 ++ 2 files changed, 3 insertions(+) commit 0a79e129642369260cb5abae550c0ee47443b993 Author: Bruce Guenter Date: Fri Aug 19 22:37:20 2005 +0000 Bumped version to 1.027 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit 9ab7da66d422cf26328b8b70fa62b749407eea13 Author: Bruce Guenter Date: Fri Aug 19 20:39:41 2005 +0000 Added some dependancies in the selftests.sh spac file to allow "make -j" to work without errors. selftests.spac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 9e66d36c1a2901f00ab235ebf99957b1c541c3ac Author: Bruce Guenter Date: Fri Aug 19 20:17:04 2005 +0000 Change depricated Copyright: tag to License: in spec. spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 8612f91d9695a2a4a7d994e49461749931bff467 Author: Bruce Guenter Date: Fri Aug 19 20:11:01 2005 +0000 Added $Id$ tags to all C sources and includes. ac/dirent.h | 1 + ac/time.h | 1 + ac/wait.h | 1 + adt/adt_sp.c | 1 + adt/common.h | 1 + adt/ghash.h | 1 + adt/ghash_add.c | 1 + adt/ghash_foreach.c | 1 + adt/ghash_free.c | 1 + adt/ghash_get.c | 1 + adt/ghash_init.c | 1 + adt/ghash_insert.c | 1 + adt/ghash_iter.c | 1 + adt/ghash_rebuild.c | 1 + adt/ghash_rehash.c | 1 + adt/ghash_remove.c | 1 + adt/ghash_search.c | 1 + adt/gqueue.h | 1 + adt/gqueue_pop.c | 1 + adt/gqueue_push.c | 1 + adt/gqueue_top.c | 1 + adt/gstack.h | 1 + adt/gstack_pop.c | 1 + adt/gstack_push.c | 1 + adt/gstack_top.c | 1 + adt/hashb.c | 1 + adt/hashs.c | 1 + base64/asc2bin.c | 1 + base64/base64.h | 1 + base64/bin2asc.c | 1 + base64/decode_line.c | 1 + base64/decode_part.c | 1 + base64/encode_line.c | 1 + base64/encode_part.c | 1 + cdb++/cdb++.h | 1 + cdb++/datum.h | 1 + cdb++/internal.h | 1 + cdb/cdb.c | 1 + cdb/cdb.h | 1 + cdb/find.c | 1 + cdb/get.c | 1 + cdb/getnext.c | 1 + cdb/hash.c | 1 + cdb/make.c | 1 + cdb/make.h | 1 + cdb/read.c | 1 + cdb/str.h | 1 + cgi/cgi-args.h | 1 + cgi/cgi-base.h | 1 + cli++/cli++.h | 1 + cli/cli.h | 1 + cli/main.c | 1 + crc-gentab.c | 1 + crc/crc16_arc.h | 1 + crc/crc16_ccitt.h | 1 + crc/crc16_xmodem.h | 1 + crc/crc32.h | 1 + crc/crc32c.h | 1 + crc/crc64.h | 1 + crc/gcrc.h | 1 + crc/gcrc16fwd.c | 1 + crc/gcrc16rfl.c | 1 + crc/gcrc32fwd.c | 1 + crc/gcrc32rfl.c | 1 + crc/gcrc64fwd.c | 1 + crc/gcrc64rfl.c | 1 + crypto/md4.c | 1 + crypto/md4.h | 1 + crypto/md5-crypt.c | 1 + crypto/md5.c | 1 + crypto/md5.h | 1 + crypto/sha1.c | 1 + crypto/sha1.h | 1 + crypto/sha1test.c | 1 + crypto/sha256.c | 1 + crypto/sha256.h | 1 + crypto/sha384.c | 1 + crypto/sha384.h | 1 + crypto/sha512.c | 1 + crypto/sha512.h | 1 + crypto/surf.c | 1 + crypto/surf.h | 1 + dict/add.c | 1 + dict/dict.h | 1 + dict/foreach.c | 1 + dict/free.c | 1 + dict/get.c | 1 + dict/hash.c | 1 + dict/init.c | 1 + dict/load.h | 1 + dict/load_list.c | 1 + dict/load_map.c | 1 + dict/str_free.c | 1 + err/die.c | 1 + err/err.h | 1 + err/error.c | 1 + err/message.c | 1 + err/warn.c | 1 + fdbuf/fdbuf.h | 1 + fdbuf/fdibuf.h | 1 + fdbuf/fdobuf.h | 1 + fmt/char.c | 1 + fmt/chars.c | 1 + fmt/lcase.c | 1 + fmt/misc.h | 1 + fmt/multi.c | 1 + fmt/multi.h | 1 + fmt/number.h | 1 + fmt/pad.c | 1 + fmt/sdec.c | 1 + fmt/sign_pad.c | 1 + fmt/slldec.c | 1 + fmt/sllnum.c | 1 + fmt/snum.c | 1 + fmt/uHex.c | 1 + fmt/ucase.c | 1 + fmt/udec.c | 1 + fmt/uhex.c | 1 + fmt/ullHex.c | 1 + fmt/ulldec.c | 1 + fmt/ullhex.c | 1 + fmt/ullnum.c | 1 + fmt/unum.c | 1 + instlib/installer.c | 1 + instlib/installer.h | 1 + instlib/instcheck.c | 1 + instlib/instmain.c | 1 + instlib/instshow.c | 1 + iobuf/common.h | 1 + iobuf/ibuf.h | 1 + iobuf/ibuf_copytofd.c | 1 + iobuf/ibuf_getc.c | 1 + iobuf/ibuf_getnetstring.c | 1 + iobuf/ibuf_gets.c | 1 + iobuf/ibuf_getstr.c | 1 + iobuf/ibuf_getstr_crlf.c | 1 + iobuf/ibuf_getu.c | 1 + iobuf/ibuf_init.c | 1 + iobuf/ibuf_open.c | 1 + iobuf/ibuf_openreadclose.c | 1 + iobuf/ibuf_peek.c | 1 + iobuf/ibuf_read.c | 1 + iobuf/ibuf_readall.c | 1 + iobuf/ibuf_refill.c | 1 + iobuf/ibuf_seek.c | 1 + iobuf/ibuf_status.c | 1 + iobuf/ibuf_stdin.c | 1 + iobuf/ibuf_tell.c | 1 + iobuf/iobuf.h | 1 + iobuf/iobuf_close.c | 1 + iobuf/iobuf_copy.c | 1 + iobuf/iobuf_init.c | 1 + iobuf/iobuf_timeout.c | 1 + iobuf/obuf.h | 1 + iobuf/obuf_close.c | 1 + iobuf/obuf_copyfromfd.c | 1 + iobuf/obuf_digits.c | 1 + iobuf/obuf_endl.c | 1 + iobuf/obuf_flush.c | 1 + iobuf/obuf_init.c | 1 + iobuf/obuf_open.c | 1 + iobuf/obuf_pad.c | 1 + iobuf/obuf_put2s.c | 1 + iobuf/obuf_put3s.c | 1 + iobuf/obuf_put4s.c | 1 + iobuf/obuf_put5s.c | 1 + iobuf/obuf_put6s.c | 1 + iobuf/obuf_put7s.c | 1 + iobuf/obuf_putc.c | 1 + iobuf/obuf_putf.c | 1 + iobuf/obuf_putnetstring.c | 1 + iobuf/obuf_putns.c | 1 + iobuf/obuf_putsflush.c | 1 + iobuf/obuf_putsllnumw.c | 1 + iobuf/obuf_putsnumw.c | 1 + iobuf/obuf_putullnumw.c | 1 + iobuf/obuf_putunumw.c | 1 + iobuf/obuf_seek.c | 1 + iobuf/obuf_sign_pad.c | 1 + iobuf/obuf_stderr.c | 1 + iobuf/obuf_stdout.c | 1 + iobuf/obuf_sync.c | 1 + iobuf/obuf_write.c | 1 + misc/misc.h | 1 + misc/random.c | 1 + misc/strtou.c | 1 + misc/ucspi.c | 1 + misc/ucspi.h | 1 + misc/utoa.c | 1 + misc/utoa2.c | 1 + msg/common.c | 1 + msg/commonf.c | 1 + msg/debug.c | 1 + msg/debug_init.c | 1 + msg/debugf.c | 1 + msg/die.c | 1 + msg/dief.c | 1 + msg/error.c | 1 + msg/errorf.c | 1 + msg/msg.h | 1 + msg/oom.c | 1 + msg/warn.c | 1 + msg/warnf.c | 1 + msg/wrap.h | 1 + msg/wrap_alloc.c | 1 + msg/wrap_chdir.c | 1 + msg/wrap_exit.c | 1 + msg/wrap_str.c | 1 + mystring/iter.h | 1 + mystring/join.h | 1 + mystring/mystring.h | 1 + mystring/rep.h | 1 + mystring/trace.h | 1 + net/accept4.c | 1 + net/accept6.c | 1 + net/acceptu.c | 1 + net/bind4.c | 1 + net/bind6.c | 1 + net/bindu.c | 1 + net/broadcast.c | 1 + net/cmsg.h | 1 + net/connect4.c | 1 + net/connect4_timeout.c | 1 + net/connect6.c | 1 + net/connect6_timeout.c | 1 + net/connected.c | 1 + net/connectu.c | 1 + net/connectu_timeout.c | 1 + net/cork.c | 1 + net/getaddr4.c | 1 + net/getaddr6.c | 1 + net/ipv4.h | 1 + net/ipv4_addr.c | 1 + net/ipv4_format.c | 1 + net/ipv4_scan.c | 1 + net/ipv6.h | 1 + net/ipv6_addr.c | 1 + net/ipv6_format.c | 1 + net/ipv6_scan.c | 1 + net/linger.c | 1 + net/listen.c | 1 + net/notcpdelay.c | 1 + net/pairdgm.c | 1 + net/pairstr.c | 1 + net/recv4.c | 1 + net/recv6.c | 1 + net/recvfd.c | 1 + net/recvu.c | 1 + net/resolve.h | 1 + net/resolve_error.c | 1 + net/resolve_ipv4addr.c | 1 + net/resolve_ipv4name.c | 1 + net/reuse.c | 1 + net/send4.c | 1 + net/send6.c | 1 + net/sendfd.c | 1 + net/sendu.c | 1 + net/setopt.c | 1 + net/shutdown.c | 1 + net/socket.h | 1 + net/tcp4.c | 1 + net/tcp6.c | 1 + net/udp4.c | 1 + net/udp6.c | 1 + net/uncork.c | 1 + net/unixdgm.c | 1 + net/unixstr.c | 1 + path/contains.c | 1 + path/fnmatch.c | 1 + path/match.c | 1 + path/merge.c | 1 + path/mkdirs.c | 1 + path/mktemp.c | 1 + path/path.h | 1 + selftest.c | 1 + str/alloc.c | 1 + str/buildmap.c | 1 + str/case_glob.c | 1 + str/case_match.c | 1 + str/case_start.c | 1 + str/cat.c | 1 + str/cat2s.c | 1 + str/cat3s.c | 1 + str/cat4s.c | 1 + str/cat5s.c | 1 + str/cat6s.c | 1 + str/catf.c | 1 + str/catiw.c | 1 + str/catiwll.c | 1 + str/catns.c | 1 + str/catsllnum.c | 1 + str/catsnum.c | 1 + str/catullnum.c | 1 + str/catunum.c | 1 + str/catuw.c | 1 + str/catuwll.c | 1 + str/catxw.c | 1 + str/catxwll.c | 1 + str/cmp.c | 1 + str/copy.c | 1 + str/copy2s.c | 1 + str/copy3s.c | 1 + str/copy4s.c | 1 + str/copy5s.c | 1 + str/copy6s.c | 1 + str/copyf.c | 1 + str/copyns.c | 1 + str/count.c | 1 + str/countof.c | 1 + str/cut.c | 1 + str/diff.c | 1 + str/digits.c | 1 + str/env.h | 1 + str/env_find.c | 1 + str/env_from_array.c | 1 + str/env_from_string.c | 1 + str/env_get.c | 1 + str/env_make_array.c | 1 + str/env_put.c | 1 + str/env_set.c | 1 + str/findnext.c | 1 + str/findnextnot.c | 1 + str/findnextof.c | 1 + str/findprev.c | 1 + str/findprevnot.c | 1 + str/findprevof.c | 1 + str/free.c | 1 + str/glob.c | 1 + str/init.c | 1 + str/iter.h | 1 + str/iter_advance.c | 1 + str/iter_start.c | 1 + str/iter_valid.c | 1 + str/join.c | 1 + str/lower.c | 1 + str/lstrip.c | 1 + str/match.c | 1 + str/rstrip.c | 1 + str/sort.c | 1 + str/splice.c | 1 + str/start.c | 1 + str/str.h | 1 + str/subst.c | 1 + str/truncate.c | 1 + str/upper.c | 1 + str/xlate.c | 1 + sys/clock_gettime.c | 1 + sys/getpeereid.c | 1 + sys/iopoll.c | 1 + sys/mkfifo.c | 1 + sys/setenv.c | 1 + sys/tryclockgettime.c | 1 + sys/trydaylight.c | 1 + sys/trydeprecated.c | 1 + sys/trydirent.c | 1 + sys/tryendian.c | 1 + sys/tryflock.c | 1 + sys/trygetpeereid.c | 1 + sys/tryinline.c | 1 + sys/tryipv6.c | 1 + sys/trymkfifo.c | 1 + sys/trynamedpipebug.c | 1 + sys/trypeercred.c | 1 + sys/trypoll.c | 1 + sys/trysendfile.c | 1 + sys/trysetenv.c | 1 + sys/trysigaction.c | 1 + sys/trysigprocmask.c | 1 + sys/tryspnam.c | 1 + sys/trysysselect.c | 1 + sys/trysystime.c | 1 + sys/trytime.c | 1 + sys/trytimespec.c | 1 + sys/tryulong32.c | 1 + sys/tryulong64.c | 1 + sys/tryunaligned.c | 1 + sys/tryunsetenv.c | 1 + sys/tryuserpw.c | 1 + sys/tryvfork.c | 1 + sys/trywaitp.c | 1 + sys/tryzlib.c | 1 + sys/unsetenv.c | 1 + sysdeps-head.h | 1 + sysdeps-tail.h | 1 + uint16.h | 1 + uint16/get.c | 1 + uint16/pack.c | 1 + uint16/unpack.c | 1 + uint32.h | 1 + uint32/get_lsb.c | 1 + uint32/get_msb.c | 1 + uint32/pack_lsb.c | 1 + uint32/pack_msb.c | 1 + uint32/unpack_lsb.c | 1 + uint32/unpack_msb.c | 1 + uint64.h | 1 + uint64/get_lsb.c | 1 + uint64/get_msb.c | 1 + uint64/pack_lsb.c | 1 + uint64/pack_msb.c | 1 + uint64/unpack_lsb.c | 1 + uint64/unpack_msb.c | 1 + uintnn.h | 1 + unix/cloexec.h | 1 + unix/cloexec_off.c | 1 + unix/cloexec_on.c | 1 + unix/fcntl.c | 1 + unix/fcntl.h | 1 + unix/fcntl_fd_off.c | 1 + unix/fcntl_fd_on.c | 1 + unix/fcntl_fl_off.c | 1 + unix/fcntl_fl_on.c | 1 + unix/nonblock.h | 1 + unix/nonblock_off.c | 1 + unix/nonblock_on.c | 1 + unix/selfpipe.c | 1 + unix/selfpipe.h | 1 + unix/sig.h | 1 + unix/sig_alarm.c | 1 + unix/sig_all.c | 1 + unix/sig_block.c | 1 + unix/sig_bug.c | 1 + unix/sig_catch.c | 1 + unix/sig_child.c | 1 + unix/sig_hup.c | 1 + unix/sig_int.c | 1 + unix/sig_misc.c | 1 + unix/sig_pipe.c | 1 + unix/sig_quit.c | 1 + unix/sig_suspend.c | 1 + unix/sig_term.c | 1 + unix/trigger.h | 1 + unix/trigger_pull.c | 1 + unix/trigger_set.c | 1 + vmailmgr/client.h | 1 + vmailmgr/req_arg.c | 1 + vmailmgr/req_init.c | 1 + vmailmgr/req_write.c | 1 + vmailmgr/resp_read.c | 1 + vmailmgr/vpwentry.h | 1 + vmailmgr/vpwentry_export.c | 1 + vmailmgr/vpwentry_free.c | 1 + vmailmgr/vpwentry_import.c | 1 + 443 files changed, 443 insertions(+) commit b9d67931b3c082ee6435c521a63cd3abded507a8 Author: Bruce Guenter Date: Fri Aug 19 18:42:23 2005 +0000 Added the capability to bg-installer to optionally run commands based on the existance of the source (or another) file. NEWS | 3 +++ bg-installer.c | 22 +++++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) commit 61d00f912d13545e35f47134cabe4f4289088284 Author: Bruce Guenter Date: Fri Aug 19 18:26:12 2005 +0000 Fixed bg-installer to not create directories in "dry-run" mode. NEWS | 2 ++ bg-installer.c | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) commit 4f2f2bd24063448550fc25b5fc38f15dc90ed0ee Author: Bruce Guenter Date: Fri Aug 19 17:44:07 2005 +0000 Fixed negative indexing bug in ibuf_getstr_crlf. Thanks Gerrit Pape NEWS | 4 ++-- iobuf/ibuf_getstr_crlf.c | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) commit 0350f865ba86514e1d8e13d42e593104a2a30582 Author: Bruce Guenter Date: Fri Aug 19 17:38:38 2005 +0000 Fixed negative indexing bug in str_findprev* functions. Thanks Gerrit Pape NEWS | 2 ++ str/findprev.c | 15 +++++++++++---- str/findprevnot.c | 38 ++++++++++++++++++++++++++++++++------ str/findprevof.c | 18 ++++++++++++------ 4 files changed, 57 insertions(+), 16 deletions(-) commit 60dca018b89b52ce37b80f5c9c6ccebac4604c53 Author: Bruce Guenter Date: Fri Aug 19 17:34:15 2005 +0000 Bumped version to 1.026 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit b5eb65301d5c82a5bd07b4a3a2acd4e47c4cb062 Author: Bruce Guenter Date: Thu Aug 18 17:29:03 2005 +0000 Added a sysdep for clock_gettime. NEWS | 3 ++- libbg-sysdeps=l | 1 + sys/clock_gettime.c | 19 +++++++++++++++++++ sys/hasclockgettime.h1 | 10 ++++++++++ sys/hasclockgettime.h2 | 2 ++ sys/tryclockgettime.c | 7 +++++++ sysdeps.h.spac | 3 ++- 7 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 sys/clock_gettime.c create mode 100644 sys/hasclockgettime.h1 create mode 100644 sys/hasclockgettime.h2 create mode 100644 sys/tryclockgettime.c commit 576f9a3ca2430a2ecba8459d15ab36eb3f62408a Author: Bruce Guenter Date: Thu Aug 18 16:50:13 2005 +0000 Added copyright notice to bg-installer.c bg-installer.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) commit 37d9c74db35262464b5833a0dee42f0154fb6871 Author: Bruce Guenter Date: Thu Aug 18 16:40:19 2005 +0000 Use wrap_str to protect against OOM in string routines in bg-installer. bg-installer.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) commit 6c68963618f0502418bc62fdf6da5a9e9e43fa81 Author: Bruce Guenter Date: Thu Aug 18 16:37:57 2005 +0000 Converted the install setup to the new unified INSTHIER mechanism. BIN | 2 -- INCLUDE => INSTHIER | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++ LIB | 88 ------------------------------------------------- install.spac | 10 ++---- 4 files changed, 98 insertions(+), 97 deletions(-) delete mode 100644 BIN rename INCLUDE => INSTHIER (50%) delete mode 100644 LIB commit 712aa7e03713baaf20c4b2720b0199f6c4e38290 Author: Bruce Guenter Date: Thu Aug 18 16:33:46 2005 +0000 Two minor tweaks to path_mktemp: 1. Cache the PID to avoid one syscall if the routine is called repeatedly. 2. Format the microsecond number out to 6 digits. path/mktemp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) commit a843bade39c9b5a1cfdb49651cd89fe16f90f531 Author: Bruce Guenter Date: Thu Aug 18 16:32:12 2005 +0000 Added the capability to bg-installer to handle multiple destinations within the same source list. NEWS | 3 +++ bg-installer.c | 60 +++++++++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 48 insertions(+), 15 deletions(-) commit ebb8480c41d6d9f7599b3a0cb8d127640de8be1e Author: Bruce Guenter Date: Wed Aug 3 05:58:04 2005 +0000 Added a sysdep for struct timespec, which is defined if not present. NEWS | 2 ++ sys/hastimespec.h1 | 5 +++++ sys/hastimespec.h2 | 2 ++ sys/trytimespec.c | 3 +++ sysdeps.h.spac | 4 +++- 5 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 sys/hastimespec.h1 create mode 100644 sys/hastimespec.h2 create mode 100644 sys/trytimespec.c commit a70b8e2ea84127d4f37a4b6b8dbac7a4d647bf46 Author: Bruce Guenter Date: Sat Jul 16 22:25:45 2005 +0000 Renamed the "setmode" function in bg-installer that was causing compile problems on *BSD systems. NEWS | 2 ++ bg-installer.c | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) commit 354a38e5420da653eb8c87760e36ca39d99f5e97 Author: Bruce Guenter Date: Fri Jul 15 22:49:16 2005 +0000 Bumped version to 1.025 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit cfd410d68b89f21d6f2a6856e82a0ea46354505f Author: Bruce Guenter Date: Mon Jul 11 04:44:52 2005 +0000 Make the shared library a bit of a priority. TODO | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit a0c918e242e21c4edd7bcf23a30cf27539540575 Author: Bruce Guenter Date: Sun Jul 10 06:15:52 2005 +0000 Fixed (again) glob patterns to allow both "!" (like modern glob) or "^" (like existing shells) for negating character sets. NEWS | 2 ++ str/case_glob.c | 34 +++++++++++++++++++++++++++++++++- str/glob.c | 34 +++++++++++++++++++++++++++++++++- 3 files changed, 68 insertions(+), 2 deletions(-) commit 946766d5e69a85a347bf9d4dff2ef6982d21fcbd Author: Bruce Guenter Date: Sun Jul 10 06:11:10 2005 +0000 Bumped version to 1.024 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit cfbfdb9a09bf1f080fb576e806a6a350bcc04129 Author: Bruce Guenter Date: Sat Jul 9 15:44:37 2005 +0000 Fixed up the note about installation. README.in | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) commit c66f785f2e138f3f9d7e6557445638dea2601a11 Author: Bruce Guenter Date: Fri Jul 8 21:56:10 2005 +0000 Fixed the installer libraries to include all the necessary object files for producing the installer/instcheck/instshow programs. LIB | 6 +++--- NEWS | 3 +++ installer=l | 39 +++++++++++++++++++++++++++++++++++++++ instcheck=l | 38 ++++++++++++++++++++++++++++++++++++++ instlib/installer=l | 2 -- instlib/instcheck=l | 2 -- instlib/instshow=l | 2 -- instshow=l | 37 +++++++++++++++++++++++++++++++++++++ 8 files changed, 120 insertions(+), 9 deletions(-) create mode 100644 installer=l create mode 100644 instcheck=l delete mode 100644 instlib/installer=l delete mode 100644 instlib/instcheck=l delete mode 100644 instlib/instshow=l create mode 100644 instshow=l commit 5f4b55f8cde68963baad139a5e56c1b2b4da8168 Author: Bruce Guenter Date: Fri Jul 8 21:35:04 2005 +0000 Initial checkin of the stock configuration files. conf-bin | 3 +++ conf-cc | 3 +++ conf-include | 3 +++ conf-ld | 3 +++ conf-lib | 4 ++++ 5 files changed, 16 insertions(+) create mode 100644 conf-bin create mode 100644 conf-cc create mode 100644 conf-include create mode 100644 conf-ld create mode 100644 conf-lib commit 15b94541b4b3735b4fb7c2e20bffd420d7d8d1c2 Author: Bruce Guenter Date: Fri Jul 8 21:27:10 2005 +0000 Fixed glob pattern matches to use "!" instead of "~" for negating character sets like all other globs use. NEWS | 3 +++ path/match.c | 4 ++-- str/case_glob.c | 68 ++++++++++++++++++++++++++++----------------------------- str/glob.c | 68 ++++++++++++++++++++++++++++----------------------------- 4 files changed, 73 insertions(+), 70 deletions(-) commit 55e18f674696486c90ff456485395c362546b009 Author: Bruce Guenter Date: Thu Jun 23 04:53:23 2005 +0000 Tweaked str_alloc to use realloc when appropriate. NEWS | 1 + README.in | 6 ++---- str/alloc.c | 17 ++++++++++------- 3 files changed, 13 insertions(+), 11 deletions(-) commit e2ab47bec5ed01ccb51b2d936d0df5d30b465b42 Author: Bruce Guenter Date: Wed Jun 15 03:31:35 2005 +0000 Bumped version to 1.023 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit 43ada53fee4d91083324adb0c955708837ab4807 Author: Bruce Guenter Date: Fri Jun 10 17:07:21 2005 +0000 Use lstat instead of stat to get accurate information on links. bg-installer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit dc632fc9f6fecceab9d66ed199d44e483f39a45e Author: Bruce Guenter Date: Fri Jun 10 17:06:06 2005 +0000 Install files into temporary files and then rename them. NEWS | 3 ++- bg-installer.c | 28 +++++++++++++++++----------- instlib/installer.c | 14 +++++++++----- 3 files changed, 28 insertions(+), 17 deletions(-) commit 33c11d10aa071691435f67fbc971804fdd21ab0f Author: Bruce Guenter Date: Fri Jun 10 16:05:42 2005 +0000 Add the install prefix when making the top directory. bg-installer.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) commit 7760bf349976883ad25468bbcd3532a9ecc3946b Author: Bruce Guenter Date: Fri Jun 10 15:40:09 2005 +0000 Put programs into %{_bindir} spec | 2 ++ 1 file changed, 2 insertions(+) commit be42f59adbedf51e9312fbbb80d56c2287ce5417 Author: Bruce Guenter Date: Fri Jun 10 15:37:53 2005 +0000 Added missing source path/mkdirs.c path/mkdirs.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 path/mkdirs.c commit bd449c22fac0153f790281080d22b95cc57d3a10 Author: Bruce Guenter Date: Fri Jun 10 06:48:11 2005 +0000 Added documentation for path functions. config.dxy | 2 +- path/contains.c | 6 ++++++ path/fnmatch.c | 6 ++++++ path/match.c | 6 ++++++ path/merge.c | 11 +++++++++++ path/mktemp.c | 6 ++++++ path/path.h | 7 +++++++ 7 files changed, 43 insertions(+), 1 deletion(-) commit 61a38e3376158880c113cb08b6662710367cbb79 Author: Bruce Guenter Date: Fri Jun 10 06:31:02 2005 +0000 Modified the installers to create missing directories. NEWS | 2 ++ bg-installer.c | 11 ++++++++--- instlib/installer.c | 22 ++++++++++++++++------ spec | 1 - 4 files changed, 26 insertions(+), 10 deletions(-) commit 2b7bd1fe71b241cdbc0742539080993f56926699 Author: Bruce Guenter Date: Fri Jun 10 06:18:30 2005 +0000 Added path_mkdirs function. NEWS | 2 ++ path/lib=l | 1 + path/path.h | 1 + 3 files changed, 4 insertions(+) commit 310b69d2a1e5ecd62c75bd509d63eb20923508a5 Author: Bruce Guenter Date: Thu Jun 9 23:09:20 2005 +0000 Copy the docs onto the website after installation. makedist.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) commit 33ecc91f5c43e74da1ccdbe98188b55a986fbec1 Author: Bruce Guenter Date: Thu Jun 9 22:28:54 2005 +0000 Added a generic installer program, similar to the "install" program included with ezmlm. BIN | 2 + INCLUDE | 94 +++++++++++++++ LIB | 88 ++++++++++++++ NEWS | 3 + all.spac | 2 +- bg-installer.c | 334 ++++++++++++++++++++++++++++++++++++++++++++++++++++ bg-installer=x | 3 + config.dxy | 2 +- install.spac | 7 ++ installer.spac | 3 - instcheck.spac | 3 - insthier.c | 207 -------------------------------- instlib/installer.h | 2 +- instshow.spac | 3 - 14 files changed, 534 insertions(+), 219 deletions(-) create mode 100644 BIN create mode 100644 INCLUDE create mode 100644 LIB create mode 100644 bg-installer.c create mode 100644 bg-installer=x create mode 100644 install.spac delete mode 100644 installer.spac delete mode 100644 instcheck.spac delete mode 100644 insthier.c delete mode 100644 instshow.spac commit 32854e472778e431dc1342c071d8b9a7b719a5e8 Author: Bruce Guenter Date: Thu Jun 9 21:58:43 2005 +0000 Fixed typo in Doxygen grouping end tag. fmt/misc.h | 4 ++-- fmt/multi.h | 4 ++-- fmt/number.h | 10 +++++----- iobuf/common.h | 4 ++-- iobuf/ibuf.h | 2 +- iobuf/iobuf.h | 4 ++-- iobuf/obuf.h | 2 +- net/ipv4.h | 2 +- net/ipv6.h | 2 +- net/resolve.h | 2 +- net/socket.h | 8 ++++---- str/env.h | 2 +- str/iter.h | 2 +- str/str.h | 18 +++++++++--------- unix/selfpipe.h | 2 +- unix/trigger.h | 2 +- 16 files changed, 35 insertions(+), 35 deletions(-) commit 6da7d25f9ca609760405f77b595605445302c09d Author: Bruce Guenter Date: Thu Jun 9 17:44:55 2005 +0000 Moved some code into a common main function. instlib/installer.c | 14 ++------------ instlib/installer.h | 3 +++ instlib/installer=l | 1 + instlib/instcheck.c | 14 ++------------ instlib/instcheck=l | 1 + instlib/instmain.c | 22 ++++++++++++++++++++++ instlib/instshow.c | 18 ++++-------------- instlib/instshow=l | 1 + 8 files changed, 36 insertions(+), 38 deletions(-) create mode 100644 instlib/instmain.c commit 850327a2eb230d277a33b25d8e0098ef36746721 Author: Bruce Guenter Date: Thu Jun 9 17:26:50 2005 +0000 Fixed the instshow library to use and dispaly the install prefix just like the other instlib programs. NEWS | 2 ++ instlib/instshow.c | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) commit cbdaacccf298f5a345fde472dc85abe9f39c1160 Author: Bruce Guenter Date: Thu Jun 9 17:24:56 2005 +0000 Bumped version up to 1.022 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit e723d36878be2bb373b7874f4fea16fc0fca2752 Author: Bruce Guenter Date: Thu Jun 9 16:41:56 2005 +0000 Added self-tests for all wrap functions. msg/wrap_chdir.c | 17 +++++++++++++++++ msg/wrap_str.c | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) commit 67685eb0427d02142a61c5118b1a0b79773aa6a8 Author: Bruce Guenter Date: Thu Jun 9 16:39:41 2005 +0000 Added a wrapper for functions that allocate memory (returning a pointer). msg/lib=l | 1 + msg/wrap.h | 1 + msg/wrap_alloc.c | 25 +++++++++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 msg/wrap_alloc.c commit e6046d4e2d8b0a54a69328f2262683025f438473 Author: Bruce Guenter Date: Wed Jun 8 16:45:21 2005 +0000 Introducing variables in the middle of a block is not yet well supported. iobuf/obuf_putf.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) commit 202b416c714e6ce0784d5e614a2de472c299bde5 Author: Bruce Guenter Date: Wed Jun 8 16:37:34 2005 +0000 Allow the installers to use $install_prefix the same way autoconf based systems use it. NEWS | 3 ++- instlib/installer.c | 3 +++ instlib/instcheck.c | 3 +++ spec | 4 +--- 4 files changed, 9 insertions(+), 4 deletions(-) commit cd36dcbdced6bcf65064f334b6deecf0004c8e61 Author: Bruce Guenter Date: Wed Jun 8 16:22:20 2005 +0000 Doxygen needs to be told about recursing into the instlib directory. Missed this part of the previous commit. config.dxy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit cacf522995570b8a6a0a2d3d0ac0aa20b08cceef Author: Bruce Guenter Date: Wed Jun 8 16:21:41 2005 +0000 Added a little documentation for the installer libraries. instlib/installer.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) commit fc873b344bf972e4af81b5f967f1813cb4c22a22 Author: Bruce Guenter Date: Wed Jun 8 15:05:03 2005 +0000 Fixed 32-to-64 bit sign extension bug in fmt_multi on some 64-bit platforms. Thanks Gerrit Pape. NEWS | 3 +++ fmt/multi.c | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) commit af9666e291041c8612aa4d672e8af52daa2d278f Author: Bruce Guenter Date: Wed Jun 8 15:04:37 2005 +0000 Fixed the remaining typo in str_catfv. Thanks again Gerrit Pape. str/catf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit a1ad5cee3ad85a08e301d56ac2c26dabd1cc440f Author: Bruce Guenter Date: Wed Jun 8 06:17:22 2005 +0000 Fixed up the daylight missing header to be a macro instead of a static const, as the static will get multiply compiled into every object. NEWS | 3 +++ sys/hasdaylight.h1 | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) commit b9b7b47e6c5643d0b355bebef7f3977971478839 Author: Bruce Guenter Date: Wed Jun 8 04:17:15 2005 +0000 Added sysdep for "extern int daylight". sys/hasdaylight.h1 | 2 ++ sys/hasdaylight.h2 | 3 +++ sys/trydaylight.c | 4 ++++ sysdeps.h.spac | 3 ++- 4 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 sys/hasdaylight.h1 create mode 100644 sys/hasdaylight.h2 create mode 100644 sys/trydaylight.c commit f6cfad46d872743d9cd89c94bc7be28114dbb9cb Author: Bruce Guenter Date: Mon Jun 6 18:03:03 2005 +0000 Fixed typo bug in str_catfv and str_copyfv that caused failures on (at least) PPC and S390 architectures. Thanks Gerrit Pape NEWS | 3 +++ iobuf/obuf_putf.c | 13 ++++++------- str/catf.c | 4 ++-- str/copyf.c | 6 +++--- 4 files changed, 14 insertions(+), 12 deletions(-) commit 882c86de1e75a8fa31649b81b9b5aaf26375293a Author: Bruce Guenter Date: Fri Jun 3 00:10:54 2005 +0000 Renamed the "install" directory to "instlib" to prevent conflicts with the "install" target. installer.spac | 4 ++-- instcheck.spac | 4 ++-- insthier.c | 10 +++++----- {install => instlib}/installer.c | 0 {install => instlib}/installer.h | 0 {install => instlib}/installer=l | 0 {install => instlib}/instcheck.c | 0 {install => instlib}/instcheck=l | 0 {install => instlib}/instshow.c | 0 {install => instlib}/instshow=l | 0 instshow.spac | 4 ++-- 11 files changed, 11 insertions(+), 11 deletions(-) rename {install => instlib}/installer.c (100%) rename {install => instlib}/installer.h (100%) rename {install => instlib}/installer=l (100%) rename {install => instlib}/instcheck.c (100%) rename {install => instlib}/instcheck=l (100%) rename {install => instlib}/instshow.c (100%) rename {install => instlib}/instshow=l (100%) commit 15a3eadcc5be21c994a23f15e7006c5cd72dd9e0 Author: Bruce Guenter Date: Thu Jun 2 22:38:34 2005 +0000 Added an installation note to the README. Thanks Sebastian Benoit README.in | 9 +++++++++ 1 file changed, 9 insertions(+) commit 0dbc7c9cdf76ddb467bb3374f0272fe059d962b5 Author: Bruce Guenter Date: Thu Jun 2 22:37:55 2005 +0000 Removed unused config file. conf-home | 1 - 1 file changed, 1 deletion(-) delete mode 100644 conf-home commit f9d687211d16a0d551ffa437447df5e275b3e82a Author: Bruce Guenter Date: Thu Jun 2 22:26:11 2005 +0000 Added a to do note. TODO | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) commit 6b2f0a4bfcff864e60ad112408d1b5c62592a691 Author: Bruce Guenter Date: Thu Jun 2 22:10:18 2005 +0000 Installation is now done under seperate include/lib directories. NEWS | 2 ++ insthier.c | 15 ++++----------- spec | 4 +++- 3 files changed, 9 insertions(+), 12 deletions(-) commit 53d3a514c0a0388c328fee5b6836570bc3392b58 Author: Bruce Guenter Date: Thu Jun 2 22:07:49 2005 +0000 installer/instcheck program libraries now optionally install into a prefix directory specified on the command line. NEWS | 2 ++ install/installer.c | 27 ++++++++++++++++++++++----- install/instcheck.c | 30 +++++++++++++++++++++++------- spec | 10 ++++------ 4 files changed, 51 insertions(+), 18 deletions(-) commit 7bef496976fec243975c3f731b50d2957e8aea86 Author: Bruce Guenter Date: Thu Jun 2 21:17:06 2005 +0000 Bumped version to 1.021 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit e029a9b1441d8adf28a7a1f50d3207c412d1c80b Author: Bruce Guenter Date: Thu Jun 2 21:16:26 2005 +0000 Switched the installer from using stdio to bglibs install/installer.c | 48 ++++++++++--------------- install/instcheck.c | 46 ++++++++---------------- install/instshow.c | 100 ++++++++++++++++++++++++++++------------------------ installer.spac | 4 +-- instcheck.spac | 4 +-- instshow.spac | 4 +-- 6 files changed, 94 insertions(+), 112 deletions(-) commit e6f5ce2e2a22ee7d6dad94aac161e6057ea2c37f Author: Bruce Guenter Date: Fri May 27 22:20:49 2005 +0000 Reverted the previous change to the variadic macros, since other C9X/C99 features are in use (variable length arrays and va_copy). NEWS | 3 +++ msg/msg.h | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) commit 376931242b3ac93263761b3cff8ee621c09e5c37 Author: Bruce Guenter Date: Fri May 27 04:32:11 2005 +0000 Switched the variadic msg macros to the old GCC format so that older systems can continue to use bglibs. We'll see if this becomes a problem in practice. If so, the only solution will be to provide two different macros, one for older GCCs that don't understand the C9X standard variadic macro format, and the other for everybody else. msg/msg.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) commit 4f0a252b1ead09b297847653ffb62b153f218eb9 Author: Bruce Guenter Date: Fri May 27 03:49:35 2005 +0000 Fixed up the documentation so Doxygen produces fewer warnings. iobuf/ibuf.h | 1 + iobuf/ibuf_getnetstring.c | 2 +- iobuf/ibuf_openreadclose.c | 2 +- iobuf/ibuf_readall.c | 2 +- iobuf/obuf.h | 1 + iobuf/obuf_sign_pad.c | 7 +++++++ net/ipv4.h | 5 ++++- net/ipv6.h | 5 ++++- str/str.h | 4 ++++ 9 files changed, 24 insertions(+), 5 deletions(-) commit c77a641e7a85dc0f06bb2103a2a725fe87a67f7c Author: Bruce Guenter Date: Fri May 27 03:22:29 2005 +0000 Add support for long and long long data types. fmt/multi.c | 80 ++++++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 53 insertions(+), 27 deletions(-) commit bb89c9fadaae06914b9d8d3b48e79923d2f12aff Author: Bruce Guenter Date: Thu May 26 23:05:48 2005 +0000 Broke out some static functions from fmt/multi.c into their own objects. str/free.c => fmt/char.c | 38 ++++++++++++++--------------- fmt/chars.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ fmt/lib=l | 2 ++ fmt/misc.h | 27 +++++++++++++++++++++ fmt/multi.c | 34 ++------------------------ 5 files changed, 111 insertions(+), 52 deletions(-) copy str/free.c => fmt/char.c (61%) create mode 100644 fmt/chars.c create mode 100644 fmt/misc.h commit 33629a4f4370e48065fd3ea9162e538e637c4702 Author: Bruce Guenter Date: Thu May 26 22:47:15 2005 +0000 Added a set of formatted message functions. NEWS | 3 ++- msg/{common.c => commonf.c} | 35 +++++++++++++++++++++-------------- msg/debug.c | 9 --------- msg/debug_init.c | 10 ++++++++++ msg/debugf.c | 11 +++++++++++ msg/dief.c | 11 +++++++++++ msg/errorf.c | 9 +++++++++ msg/lib=l | 6 ++++++ msg/msg.h | 18 ++++++++++++++++++ msg/warn.c | 1 - msg/warnf.c | 9 +++++++++ selftests.sh | 2 +- 12 files changed, 98 insertions(+), 26 deletions(-) copy msg/{common.c => commonf.c} (62%) create mode 100644 msg/debug_init.c create mode 100644 msg/debugf.c create mode 100644 msg/dief.c create mode 100644 msg/errorf.c create mode 100644 msg/warnf.c commit a8a915354441c2c7b519e83381831bdcb6ecb682 Author: Bruce Guenter Date: Thu May 26 22:31:39 2005 +0000 Added format functions that take a va_list parameter. iobuf/obuf.h | 2 ++ iobuf/obuf_putf.c | 27 +++++++++++++++++---------- str/catf.c | 24 ++++++++++++++++-------- str/copyf.c | 24 ++++++++++++++++-------- str/str.h | 4 ++++ 5 files changed, 55 insertions(+), 26 deletions(-) commit 7c5f5145d03ed72ee013dc2771e4d7ed03f9c6e1 Author: Bruce Guenter Date: Thu May 26 21:51:15 2005 +0000 Moved the documentation around a bit and gave fmt_multi documentation. fmt/multi.c | 151 +++++++++++++++++++++++++++++++----------------------------- 1 file changed, 77 insertions(+), 74 deletions(-) commit e4236bb9b909943e748c21ed5e91332ae4aaa14c Author: Bruce Guenter Date: Thu May 26 21:36:14 2005 +0000 Added multiple-item formatting functions fmt_multi (similar to printf, but safer), fmt_multiv, obuf_putf, str_catf, and str_copyf. NEWS | 3 + fmt/lib=l | 1 + fmt/multi.c | 294 ++++++++++++++++++++++++++++++++++++++++++++++ fmt/multi.h | 21 ++++ iobuf/lib=l | 1 + iobuf/obuf.h | 1 + iobuf/obuf_putf.c | 37 ++++++ str/{copyns.c => catf.c} | 39 +++--- str/{copyns.c => copyf.c} | 38 +++--- str/lib=l | 2 + str/str.h | 2 + 11 files changed, 405 insertions(+), 34 deletions(-) create mode 100644 fmt/multi.c create mode 100644 fmt/multi.h create mode 100644 iobuf/obuf_putf.c copy str/{copyns.c => catf.c} (59%) copy str/{copyns.c => copyf.c} (61%) commit 4db5a874d8c8c67fd9af20ffd4d4d228918574eb Author: Bruce Guenter Date: Thu May 26 19:54:17 2005 +0000 Updated copyright year. README.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 79268b8fae821fbfca6f9e25bc4bddff6b5bb16d Author: Bruce Guenter Date: Thu Nov 18 16:11:48 2004 +0000 Mark ipv4_parse as deprecated. net/ipv4.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 8e080e7d71a64b7668dec3326d317fe859693844 Author: Bruce Guenter Date: Thu Nov 18 16:08:47 2004 +0000 Added a sysdep for GCC's __attribute__((__deprecated__)) tag. sys/hasdeprecated.h1 | 2 ++ sys/hasdeprecated.h2 | 2 ++ sys/trydeprecated.c | 1 + sysdeps.h.spac | 3 ++- 4 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 sys/hasdeprecated.h1 create mode 100644 sys/hasdeprecated.h2 create mode 100644 sys/trydeprecated.c commit fa772dda52a380c34dbf554ab3c49a1355f7ef07 Author: Bruce Guenter Date: Wed Nov 17 16:48:32 2004 +0000 Fixed a couple of length counting bugs in the fmt number code. NEWS | 2 ++ fmt/snum.c | 42 ++++++++++++++++++++++++++++++------------ fmt/unum.c | 36 +++++++++++++++++++++++++----------- 3 files changed, 57 insertions(+), 23 deletions(-) commit 90bc10ce772780e7474094240dc6ff749eedb971 Author: Bruce Guenter Date: Wed Nov 17 16:47:09 2004 +0000 Bumped version to 1.020 NEWS | 5 +++++ VERSION | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) commit c3097e8290c50f7fc67920233a4d4a7a20d68dcb Author: Bruce Guenter Date: Wed Nov 17 14:24:56 2004 +0000 Include the no-buffer length when testing this function. fmt/sign_pad.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) commit 2d8897d7e00b1f5baa706228309e1d9dfd23dd1b Author: Bruce Guenter Date: Tue Nov 16 21:19:11 2004 +0000 Added self-tests for the fcntl wrappers. unix/fcntl.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 unix/fcntl.c commit 6a2f8ed94646e7f8d9790de50ba503404281b4c6 Author: Bruce Guenter Date: Tue Nov 16 21:04:32 2004 +0000 Fixed up the iobuf documentation to produce the full doxygen output again. iobuf/ibuf.h | 10 ++++++++-- iobuf/iobuf.h | 5 +++++ iobuf/obuf.h | 10 ++++++++-- 3 files changed, 21 insertions(+), 4 deletions(-) commit f55b65e47dc602ef2e9642d0444ff44d681bd94a Author: Bruce Guenter Date: Mon Nov 15 20:49:40 2004 +0000 "Hide" the invocation of the hundreds of ln commands to avoid production of libbg.a from obliterating earlier errors. libbg.a.spac | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) commit fd372b389bdece95fb356a64560f8b9603e6e42a Author: Bruce Guenter Date: Mon Nov 15 20:44:38 2004 +0000 Only call the fcntl SET syscall if the desired flags are different from the existing ones. unix/fcntl_fd_off.c | 4 +++- unix/fcntl_fd_on.c | 4 +++- unix/fcntl_fl_off.c | 4 +++- unix/fcntl_fl_on.c | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) commit 34d464362c298cda33227dfba5b16f2a7b691b33 Author: Bruce Guenter Date: Mon Nov 15 20:38:34 2004 +0000 Fixed a couple of typos in the fcntl_fd_* functions. unix/fcntl_fd_off.c | 2 +- unix/fcntl_fd_on.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) commit f60d2f4ff687d96dac1f5fb4ab51e7b3b269d3c1 Author: Bruce Guenter Date: Mon Nov 15 20:27:37 2004 +0000 Added two new missing header files: unix/cloexec.h unix/fcntl.h insthier.c | 2 ++ 1 file changed, 2 insertions(+) commit ad4409a80c07cbe6d4351fdfdd3b4062b4992666 Author: Bruce Guenter Date: Thu Nov 4 18:14:53 2004 +0000 Changed the error in ibuf_getnetstring from EPROTO to EPROTOTYPE to fix compile errors on *BSD systems. Thanks Ville Walveranta. NEWS | 3 +++ iobuf/ibuf_getnetstring.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) commit 32ee969e72aa25ccb33dc02f7527753046fe7722 Author: Bruce Guenter Date: Thu Nov 4 17:15:20 2004 +0000 Selfpipes now close-on-exec to prevent the pipe from being exported to child processes. NEWS | 3 +++ unix/selfpipe.c | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) commit 2265b8bd6e981c5dbeb4c56a5a036d75f7310a38 Author: Bruce Guenter Date: Thu Nov 4 16:59:52 2004 +0000 Added cloexec_{off,on} functions to manipulate the close-on-exec flag. NEWS | 2 ++ unix/cloexec.h | 7 +++++++ unix/{nonblock_on.c => cloexec_off.c} | 12 ++++-------- unix/{nonblock_on.c => cloexec_on.c} | 12 ++++-------- unix/lib=l | 2 ++ 5 files changed, 19 insertions(+), 16 deletions(-) create mode 100644 unix/cloexec.h copy unix/{nonblock_on.c => cloexec_off.c} (80%) copy unix/{nonblock_on.c => cloexec_on.c} (80%) commit 3160b5ad48711c6dc34310bb91f44a1d08aec5c9 Author: Bruce Guenter Date: Thu Nov 4 15:48:50 2004 +0000 Rewrote the nonblock functions in terms of the new fcntl wrappers. unix/nonblock_off.c | 8 +++----- unix/nonblock_on.c | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) commit 3ff002a02febc079715401255385670fda116e34 Author: Bruce Guenter Date: Thu Nov 4 15:46:12 2004 +0000 Added low-level fcntl wrapper functions. NEWS | 2 ++ unix/fcntl.h | 9 +++++++++ net/tcp4.c => unix/fcntl_fd_off.c | 23 ++++++++--------------- net/tcp4.c => unix/fcntl_fd_on.c | 23 ++++++++--------------- unix/{nonblock_on.c => fcntl_fl_off.c} | 14 +++++--------- unix/{nonblock_on.c => fcntl_fl_on.c} | 14 +++++--------- unix/lib=l | 4 ++++ 7 files changed, 41 insertions(+), 48 deletions(-) create mode 100644 unix/fcntl.h copy net/tcp4.c => unix/fcntl_fd_off.c (70%) copy net/tcp4.c => unix/fcntl_fd_on.c (70%) copy unix/{nonblock_on.c => fcntl_fl_off.c} (75%) copy unix/{nonblock_on.c => fcntl_fl_on.c} (75%) commit ca31b2eade4f4ca572bbceb9526d7c3651e67bdc Author: Bruce Guenter Date: Fri Oct 29 23:31:01 2004 +0000 Broke the iobuf includes into smaller parts. NEWS | 4 +- insthier.c | 3 + iobuf/common.h | 93 ++++++++++++++++++ iobuf/ibuf.h | 58 +++++++++++ iobuf/ibuf_copytofd.c | 2 +- iobuf/ibuf_getc.c | 2 +- iobuf/ibuf_getnetstring.c | 2 +- iobuf/ibuf_gets.c | 2 +- iobuf/ibuf_getstr.c | 2 +- iobuf/ibuf_getstr_crlf.c | 2 +- iobuf/ibuf_getu.c | 2 +- iobuf/ibuf_init.c | 2 +- iobuf/ibuf_open.c | 2 +- iobuf/ibuf_peek.c | 2 +- iobuf/ibuf_read.c | 2 +- iobuf/ibuf_refill.c | 2 +- iobuf/ibuf_seek.c | 2 +- iobuf/ibuf_status.c | 2 +- iobuf/ibuf_stdin.c | 2 +- iobuf/ibuf_tell.c | 2 +- iobuf/iobuf.h | 244 +--------------------------------------------- iobuf/{iobuf.h => obuf.h} | 153 +---------------------------- iobuf/obuf_close.c | 2 +- iobuf/obuf_copyfromfd.c | 2 +- iobuf/obuf_digits.c | 2 +- iobuf/obuf_endl.c | 2 +- iobuf/obuf_flush.c | 2 +- iobuf/obuf_init.c | 2 +- iobuf/obuf_open.c | 2 +- iobuf/obuf_pad.c | 2 +- iobuf/obuf_put2s.c | 2 +- iobuf/obuf_put3s.c | 2 +- iobuf/obuf_put4s.c | 2 +- iobuf/obuf_put5s.c | 2 +- iobuf/obuf_put6s.c | 2 +- iobuf/obuf_put7s.c | 2 +- iobuf/obuf_putc.c | 2 +- iobuf/obuf_putnetstring.c | 2 +- iobuf/obuf_putns.c | 2 +- iobuf/obuf_putsflush.c | 2 +- iobuf/obuf_putsllnumw.c | 2 +- iobuf/obuf_putsnumw.c | 2 +- iobuf/obuf_putullnumw.c | 2 +- iobuf/obuf_putunumw.c | 2 +- iobuf/obuf_seek.c | 2 +- iobuf/obuf_sign_pad.c | 2 +- iobuf/obuf_stderr.c | 2 +- iobuf/obuf_stdout.c | 2 +- iobuf/obuf_sync.c | 2 +- iobuf/obuf_write.c | 2 +- 50 files changed, 207 insertions(+), 436 deletions(-) create mode 100644 iobuf/common.h create mode 100644 iobuf/ibuf.h copy iobuf/{iobuf.h => obuf.h} (50%) commit 4a299798e7156eb0ae60d0deec7015fae920b82a Author: Bruce Guenter Date: Fri Oct 29 22:46:47 2004 +0000 Bumped version to 1.019 NEWS | 5 +++++ VERSION | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) commit 2306480a23b47ddbd49e452ab07932317c649fd8 Author: Bruce Guenter Date: Tue Oct 26 04:59:01 2004 +0000 Added missing misc/ucspi.h header file. insthier.c | 1 + 1 file changed, 1 insertion(+) commit 3b34f5c908f4e746ab2f2c6689947c3d3bbbc35d Author: Bruce Guenter Date: Mon Oct 25 23:29:03 2004 +0000 Added missing #include. unix/selfpipe.c | 1 + 1 file changed, 1 insertion(+) commit 53bab4d3015e383ba360b299e0a052f88c5cd4ab Author: Bruce Guenter Date: Fri Oct 22 17:56:23 2004 +0000 Bugfix: when iterating over empty tables, don't crash because the table pointer is NULL. adt/ghash_iter.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) commit 78bc60c06b7611650169c1e5087769046270a8d1 Author: Bruce Guenter Date: Wed Aug 25 05:52:43 2004 +0000 Made the datacopy function optional by emulating it with a straight memcpy. adt/ghash_add.c | 13 +++++-------- adt/ghash_iter.c | 8 +------- adt/ghash_remove.c | 8 +------- 3 files changed, 7 insertions(+), 22 deletions(-) commit cba4794d0be947d38f4c2ef6de14c0584fcb4ea6 Author: Bruce Guenter Date: Mon Aug 23 21:20:23 2004 +0000 Added ghash_remove prototype and macros. adt/ghash.h | 9 +++++++++ 1 file changed, 9 insertions(+) commit fbaf51f567a68b6f5c0e6b280998b5d107b195b4 Author: Bruce Guenter Date: Mon Aug 23 21:19:59 2004 +0000 Add missing ghash_iter.o object file. adt/lib=l | 1 + 1 file changed, 1 insertion(+) commit 957f2a2e3a5bb8786c815674d10c68c4e7e9117a Author: Bruce Guenter Date: Mon Aug 23 20:16:51 2004 +0000 Added missing source from previous commit. adt/adt_sp.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 adt/adt_sp.c commit 9d4eaf51ff9444307438beee461d855102ae918a Author: Bruce Guenter Date: Mon Aug 23 18:45:22 2004 +0000 Reorganized and expanded the convenience functions for using const char* adt/common.h | 9 +++++++++ adt/ghash.h | 6 +++--- adt/ghash_add.c | 21 +++------------------ adt/ghash_hashs.c | 17 ----------------- adt/ghash_iter.c | 21 +++------------------ adt/ghash_remove.c | 21 +++------------------ adt/{ghash_hashb.c => hashb.c} | 4 ++-- adt/{ghash_hashb.c => hashs.c} | 6 +++--- adt/lib=l | 5 +++-- 9 files changed, 29 insertions(+), 81 deletions(-) delete mode 100644 adt/ghash_hashs.c copy adt/{ghash_hashb.c => hashb.c} (60%) rename adt/{ghash_hashb.c => hashs.c} (52%) commit 73974a7ca477384a7cb1f2882f509e5aff370632 Author: Bruce Guenter Date: Sun Aug 22 21:42:38 2004 +0000 Renamed the hash value type to adt_hash_t adt/common.h | 3 ++- adt/ghash.h | 14 +++++++------- adt/ghash_add.c | 9 ++------- adt/ghash_get.c | 2 +- adt/ghash_hashb.c | 4 ++-- adt/ghash_hashs.c | 6 +++--- adt/ghash_remove.c | 7 +------ 7 files changed, 18 insertions(+), 27 deletions(-) commit ee2cb3b6c52a8e1a9ee4060f2bc24dbf16818041 Author: Bruce Guenter Date: Sun Aug 22 21:30:06 2004 +0000 Added detector for the "inline" keyword. sys/hasinline.h1 | 2 ++ sys/hasinline.h2 | 2 ++ sys/tryinline.c | 2 ++ sysdeps.h.spac | 3 ++- 4 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 sys/hasinline.h1 create mode 100644 sys/hasinline.h2 create mode 100644 sys/tryinline.c commit 4148a31e3852d0de9acb79dc193a93250520adb8 Author: Bruce Guenter Date: Sun Aug 22 21:27:04 2004 +0000 Added ghashiter functions, for iteration over ghash tables. NEWS | 2 ++ adt/ghash.h | 13 +++++++ adt/ghash_iter.c | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 121 insertions(+) create mode 100644 adt/ghash_iter.c commit 38a7754c681e1d97df872f9297817d532c52541d Author: Bruce Guenter Date: Sun Aug 22 20:05:33 2004 +0000 Split up the two ghash_hash* functions, and added a ghash_hashsp function that is useful directly in hash tables that use const char* keys. adt/ghash.h | 1 + adt/{ghash_hash.c => ghash_hashb.c} | 5 ----- adt/ghash_hashs.c | 17 +++++++++++++++++ adt/lib=l | 3 ++- 4 files changed, 20 insertions(+), 6 deletions(-) rename adt/{ghash_hash.c => ghash_hashb.c} (71%) create mode 100644 adt/ghash_hashs.c commit a0529b494a7136b3a982331f733f163e5b107f69 Author: Bruce Guenter Date: Sun Aug 22 18:52:34 2004 +0000 Added ghash_remove function. NEWS | 2 + adt/ghash_remove.c | 130 +++++++++++++++++++++++++++++++++++++++++++++++++++++ adt/lib=l | 1 + 3 files changed, 133 insertions(+) create mode 100644 adt/ghash_remove.c commit 945299bbb61c2f6ed843d2f7c8e81ecdbf3067aa Author: Bruce Guenter Date: Sun Aug 22 18:51:12 2004 +0000 Rewrote the adt/ghash library to store the function pointers in the structure instead of requiring the pointers to be passed to every funciton. adt/ghash.h | 78 ++++++++++++++++++++++++++++++++---------------------- adt/ghash_add.c | 17 +++++------- adt/ghash_free.c | 14 +++++----- adt/ghash_get.c | 11 ++++---- adt/ghash_init.c | 20 +++++++++++++- adt/ghash_rehash.c | 4 +-- 6 files changed, 86 insertions(+), 58 deletions(-) commit 3c6344d6708816a653940b8da8e967f0c0179faa Author: Bruce Guenter Date: Fri Aug 20 18:02:29 2004 +0000 Break down the rehash process into two steps: (1) recompute the hash values (ghash_rehash) which shouldn't be needed often, if evern, and (2) rebuild the hash table (ghash_rebuild). adt/ghash.h | 7 +++++++ adt/{ghash_rehash.c => ghash_rebuild.c} | 6 ++---- adt/ghash_rehash.c | 22 +++++----------------- adt/lib=l | 1 + 4 files changed, 15 insertions(+), 21 deletions(-) copy adt/{ghash_rehash.c => ghash_rebuild.c} (75%) commit 6c6118ab2e4bbbdd0b4e96cd94ac589d4d226d1e Author: Bruce Guenter Date: Fri Aug 20 17:58:20 2004 +0000 Broke down the ghash_get primitive into two steps -- locate the entry (ghash_find), and then dereference it if it was found (ghash_get). ghash_find can be used by other functions that need to determine the slot. adt/ghash.h | 2 ++ adt/ghash_get.c | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) commit 1bdbe6f053ca2ff647aafb577e10440c79556ae0 Author: Bruce Guenter Date: Fri Aug 13 21:26:56 2004 +0000 Added str_getnetstring function. NEWS | 2 ++ iobuf/TODO | 1 - iobuf/ibuf_getnetstring.c | 29 +++++++++++++++++++++++++++++ iobuf/iobuf.h | 1 + iobuf/lib=l | 1 + 5 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 iobuf/ibuf_getnetstring.c commit 472617bac2bcb8e4d6988a781c4e7efa157fe698 Author: Bruce Guenter Date: Fri Aug 13 21:25:01 2004 +0000 Fix up function definitions to make them match with the prototypes, so that doxygen can match them up properly. str/env_find.c | 2 +- str/env_from_array.c | 2 +- str/env_from_string.c | 2 +- str/env_get.c | 2 +- str/env_make_array.c | 2 +- str/env_put.c | 2 +- str/env_set.c | 2 +- str/iter_start.c | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) commit d247b58f05d44a46d4b9c31bb9b32799ebc62f2b Author: Bruce Guenter Date: Fri Aug 13 18:41:35 2004 +0000 Use a forward struct str declaration to avoid recursive includes. str/iter.h | 6 +++--- str/iter_advance.c | 1 + str/iter_start.c | 1 + str/iter_valid.c | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) commit 85d984179dc8cd7b3a365229e592811ee592af3a Author: Bruce Guenter Date: Fri Aug 13 18:40:05 2004 +0000 Use a forward struct str declaration to avoid recursive includes. str/env.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) commit 2913b821e43a20d25cdb59064851b741bc24c196 Author: Bruce Guenter Date: Fri Aug 13 18:38:55 2004 +0000 Added missing str/env.h and unix/trigger.h header files. insthier.c | 2 ++ 1 file changed, 2 insertions(+) commit f328ece6f987f121564b7615f70f289b39bc8ec2 Author: Bruce Guenter Date: Fri Aug 13 16:59:26 2004 +0000 Added named pipe trigger functions. NEWS | 2 ++ unix/lib=l | 2 ++ unix/trigger.h | 41 +++++++++++++++++++++++++++++++++++++++++ unix/trigger_pull.c | 14 ++++++++++++++ unix/trigger_set.c | 34 ++++++++++++++++++++++++++++++++++ 5 files changed, 93 insertions(+) create mode 100644 unix/trigger.h create mode 100644 unix/trigger_pull.c create mode 100644 unix/trigger_set.c commit 9c4ba3423f80eacfab2d03c5196173cb032f5c06 Author: Bruce Guenter Date: Fri Aug 13 06:15:25 2004 +0000 Added environment string manipulation functions. NEWS | 2 ++ str/env.h | 27 +++++++++++++++++++++++++++ str/env_find.c | 32 ++++++++++++++++++++++++++++++++ str/env_from_array.c | 30 ++++++++++++++++++++++++++++++ str/env_from_string.c | 29 +++++++++++++++++++++++++++++ str/env_get.c | 27 +++++++++++++++++++++++++++ str/env_make_array.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ str/env_put.c | 38 ++++++++++++++++++++++++++++++++++++++ str/env_set.c | 34 ++++++++++++++++++++++++++++++++++ str/lib=l | 8 ++++++++ 10 files changed, 276 insertions(+) create mode 100644 str/env.h create mode 100644 str/env_find.c create mode 100644 str/env_from_array.c create mode 100644 str/env_from_string.c create mode 100644 str/env_get.c create mode 100644 str/env_make_array.c create mode 100644 str/env_put.c create mode 100644 str/env_set.c commit be007f19c734d08059de79fa2c2b417bd6809b2b Author: Bruce Guenter Date: Fri Aug 13 06:14:45 2004 +0000 Use "cat -v" to expose non-printing bytes. selftests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 2c938e1042d10e64ef136f6f10489369343cec54 Author: Bruce Guenter Date: Fri Aug 13 05:24:32 2004 +0000 Fixed bug in ibuf_getu: didn't subtract ASCII '0' offset from digits. NEWS | 2 ++ iobuf/ibuf_getu.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) commit 4b277b8565f64ee2acc26f5e072eeb3afb89b512 Author: Bruce Guenter Date: Fri Aug 13 05:22:53 2004 +0000 Added sysdep check for the "named pipe bug": polling a named pipe without a writer unconditionally succeeds. Source code was copied and modified from a similar check in nullmailer. NEWS | 3 +++ sys/hasnamedpipebug.h1 | 2 ++ sys/hasnamedpipebug.h2 | 2 ++ sys/trynamedpipebug.c | 22 ++++++++++++++++++++++ sysdeps.h.spac | 3 ++- 5 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 sys/hasnamedpipebug.h1 create mode 100644 sys/hasnamedpipebug.h2 create mode 100644 sys/trynamedpipebug.c commit afb187afaacd03b65c23f9312c18e5348844c477 Author: Bruce Guenter Date: Fri Aug 13 05:09:05 2004 +0000 Added sysdep and emulator function for mkfifo. NEWS | 2 ++ sys/hasmkfifo.h1 | 2 ++ sys/hasmkfifo.h2 | 2 ++ sys/mkfifo.c | 10 ++++++++++ sys/trymkfifo.c | 7 +++++++ sysdeps.h.spac | 3 ++- 6 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 sys/hasmkfifo.h1 create mode 100644 sys/hasmkfifo.h2 create mode 100644 sys/mkfifo.c create mode 100644 sys/trymkfifo.c commit b11b0122fa826df8d880af089436730797360b62 Author: Bruce Guenter Date: Tue Jul 27 16:59:48 2004 +0000 Added missing unix/selfpipe.h header to insthier. NEWS | 2 +- insthier.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) commit b3ee7a7580d18730ad13d988a97455c96ea73bfc Author: Bruce Guenter Date: Thu Mar 25 21:25:47 2004 +0000 Added missing crypto/surf.h header to insthier. NEWS | 1 + insthier.c | 1 + 2 files changed, 2 insertions(+) commit 764a49a6ead8b54c04e8567d8129838ba6ed690c Author: Bruce Guenter Date: Thu Mar 25 21:24:49 2004 +0000 Bumped version to 1.018 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit 17bd2f64776abc0547778402ffe545c50d36e1cb Author: Bruce Guenter Date: Wed Mar 24 03:53:47 2004 +0000 Fixed some silly typos. NEWS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) commit 22253e938c3b66409b3e47403d3b932e7246c570 Author: Bruce Guenter Date: Wed Mar 24 03:53:09 2004 +0000 Removed the surfc function. crypto/surf.c | 6 ------ crypto/surf.h | 2 -- 2 files changed, 8 deletions(-) commit e54ed27875187889703e7ef572dd01001d884a72 Author: Bruce Guenter Date: Tue Mar 23 00:13:05 2004 +0000 Fixed utoa to write into its buffer instead of before it. NEWS | 2 ++ misc/utoa.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) commit 71615e238569fa887c803b2ed3c5a24bcedcc3dc Author: Bruce Guenter Date: Mon Mar 22 17:29:20 2004 +0000 Added missing va_end calls. iobuf/obuf_putns.c | 1 + str/catns.c | 1 + str/copyns.c | 1 + 3 files changed, 3 insertions(+) commit f7ba1690823acca335b6b03413aaeac174cb2a0f Author: Bruce Guenter Date: Mon Mar 22 17:12:37 2004 +0000 Added str_copyns, str_catns, and obuf_putns functions. NEWS | 3 +++ iobuf/iobuf.h | 1 + iobuf/lib=l | 1 + iobuf/obuf_putns.c | 28 ++++++++++++++++++++++++++++ str/{cat2s.c => catns.c} | 30 +++++++++++++++--------------- str/{init.c => copyns.c} | 30 +++++++++++++++++------------- str/lib=l | 2 ++ str/str.h | 2 ++ 8 files changed, 69 insertions(+), 28 deletions(-) create mode 100644 iobuf/obuf_putns.c copy str/{cat2s.c => catns.c} (63%) copy str/{init.c => copyns.c} (62%) commit 637053f12c5d2de031d377d6b7872b65266b0f81 Author: Bruce Guenter Date: Sun Mar 14 06:30:55 2004 +0000 Added SURF code. NEWS | 2 ++ crypto/lib=l | 1 + crypto/surf.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ crypto/surf.h | 18 +++++++++++ 4 files changed, 121 insertions(+) create mode 100644 crypto/surf.c create mode 100644 crypto/surf.h commit 0a1d8c6c9587eaaa0c279afdb4502a7c428ffa0e Author: Bruce Guenter Date: Sun Mar 14 06:29:52 2004 +0000 Bumped version up to 1.017 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit 8d08c481ebd0e616cfa2aa71d914237614bb9188 Author: Bruce Guenter Date: Fri Mar 5 18:13:18 2004 +0000 Added notes about IPv6 plans. TODO | 4 ++++ 1 file changed, 4 insertions(+) commit 8b9a2c17457cca60ec34bbb85a8d17b9fb56a595 Author: Bruce Guenter Date: Thu Mar 4 23:41:51 2004 +0000 Added functions for querying UCSPI environment variables. NEWS | 2 ++ misc/lib=l | 1 + misc/ucspi.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ misc/ucspi.h | 12 ++++++++++++ 4 files changed, 78 insertions(+) create mode 100644 misc/ucspi.c create mode 100644 misc/ucspi.h commit 15e31732f88a64cc55f680ca4fc29f33c23d9935 Author: Bruce Guenter Date: Thu Mar 4 23:40:58 2004 +0000 Added back the definition of socket_tcp and socket_udp for compatability. NEWS | 3 +++ net/socket.h | 4 ++-- net/tcp4.c | 6 ++++++ net/udp4.c | 6 ++++++ 4 files changed, 17 insertions(+), 2 deletions(-) commit b6960c3091d4513fffdfb4f27922301f3d7cad5f Author: Bruce Guenter Date: Tue Mar 2 19:44:58 2004 +0000 Fixed socket_notcpdelay on FreeBSD 4.x (and possibly other BSDs). NEWS | 1 + net/notcpdelay.c | 4 ++++ 2 files changed, 5 insertions(+) commit 8315e3abb343f2142a589aa9d03700052b718029 Author: Bruce Guenter Date: Tue Mar 2 19:42:21 2004 +0000 Bumped version to 1.016 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit bfce95dee013017900b04b58ac715801c9b1371a Author: Bruce Guenter Date: Wed Feb 25 18:01:43 2004 +0000 Fixed mis-named gcrc.h header file, and added crc16_*.h headers. insthier.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) commit 1adbfd89339491ecebc05be766eb8749fa608c32 Author: Bruce Guenter Date: Wed Feb 25 05:09:32 2004 +0000 Modified linkage warning to add note about libbg. NEWS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) commit b491fb5cbe22b1b602ffe57167c1aad1001f4bd5 Author: Bruce Guenter Date: Wed Feb 25 05:01:40 2004 +0000 Added notes. TODO | 6 ++++++ 1 file changed, 6 insertions(+) commit b7931804e794ebc53efc402d159a0a458c1496ef Author: Bruce Guenter Date: Mon Feb 9 23:47:01 2004 +0000 Added a "libbg.a" build target, including all the other libraries that don't define a main routine. NEWS | 3 +++ insthier.c | 4 ++++ libbg.a.spac | 20 ++++++++++++++++++++ libraries.spac | 1 + 4 files changed, 28 insertions(+) create mode 100644 libbg.a.spac commit 1e8f37e70f7c6aacd234dd50004b4906aa99ecca Author: Bruce Guenter Date: Sat Feb 7 21:03:09 2004 +0000 Added missing control file. fmt/lib=l | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 fmt/lib=l commit ec0dc81ef4beae7ce0fbe1610588936a5308b024 Author: Bruce Guenter Date: Sat Feb 7 00:38:25 2004 +0000 Added CRC32C NEWS | 2 ++ crc/crc32c.h | 14 ++++++++++++++ crc/crc32c_table.c.spac | 2 ++ crc/gcrc32rfl.c | 17 +++++++++++++++++ crc/lib=l | 1 + 5 files changed, 36 insertions(+) create mode 100644 crc/crc32c.h create mode 100644 crc/crc32c_table.c.spac commit f21000c34f35789fb8bd71d76df72117a662cd2a Author: Bruce Guenter Date: Fri Feb 6 23:55:42 2004 +0000 Rewrote the CRC routines in terms of "generic" forward and reflected functions. NEWS | 3 +++ crc/crc16_arc.h | 4 ++-- crc/crc16_ccitt.h | 4 ++-- crc/crc16_xmodem.h | 2 +- crc/crc16_xmodem_update.c | 20 -------------------- crc/crc32.h | 3 ++- crc/crc64.h | 4 ++-- crc/gcrc.h | 13 +++++++++++++ crc/{crc16_ccitt_update.c => gcrc16fwd.c} | 8 +++++--- crc/{crc16_arc_update.c => gcrc16rfl.c} | 12 +++++++++--- crc/gcrc32fwd.c | 10 ++++++++++ crc/{crc32_update.c => gcrc32rfl.c} | 8 +++++--- crc/{crc64_update.c => gcrc64fwd.c} | 8 +++++--- crc/gcrc64rfl.c | 10 ++++++++++ crc/lib=l | 11 ++++++----- 15 files changed, 75 insertions(+), 45 deletions(-) delete mode 100644 crc/crc16_xmodem_update.c create mode 100644 crc/gcrc.h rename crc/{crc16_ccitt_update.c => gcrc16fwd.c} (88%) rename crc/{crc16_arc_update.c => gcrc16rfl.c} (73%) create mode 100644 crc/gcrc32fwd.c rename crc/{crc32_update.c => gcrc32rfl.c} (93%) rename crc/{crc64_update.c => gcrc64fwd.c} (61%) create mode 100644 crc/gcrc64rfl.c commit 1e3a539f92b224e56b40519f20e06784942ec0dd Author: Bruce Guenter Date: Wed Feb 4 16:04:26 2004 +0000 Added resolve_ipv4name_n, to resolve a name to more than one IP. NEWS | 2 ++ net/resolve.h | 3 ++- net/resolve_ipv4name.c | 10 ++++++---- 3 files changed, 10 insertions(+), 5 deletions(-) commit 45a1ef4b453b8e74142e0254e9b59a24ab47dd43 Author: Bruce Guenter Date: Wed Feb 4 16:00:00 2004 +0000 Bumped copyright end year to 2004. README.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 23b1acc06565d92692ce2e56ed7ede7b45c1e3a1 Author: Bruce Guenter Date: Tue Feb 3 21:16:58 2004 +0000 Mark the copied-in data as being present before flushing the buffer. Without this patch, no data is ever written. iobuf/obuf_copyfromfd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) commit 5b2101186897964f810950cb478cefafc2c7302a Author: Bruce Guenter Date: Mon Feb 2 22:54:30 2004 +0000 Fixed up the selftests (copy & paste error). fmt/ullnum.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) commit bd0236be20f5f675b8ab71a3ccc96367964f70a8 Author: Bruce Guenter Date: Fri Jan 30 20:42:54 2004 +0000 Added ibuf_copytofd and obuf_copyfromfd, modified versions of iobuf_copy. NEWS | 3 ++- iobuf/ibuf_copytofd.c | 27 +++++++++++++++++++++++++++ iobuf/iobuf.h | 4 +++- iobuf/lib=l | 2 ++ iobuf/obuf_copyfromfd.c | 22 ++++++++++++++++++++++ 5 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 iobuf/ibuf_copytofd.c create mode 100644 iobuf/obuf_copyfromfd.c commit 33d07dbb7faeb8c486f7c2a2fed9482b7c78d407 Author: Bruce Guenter Date: Fri Jan 30 20:34:08 2004 +0000 Modified iobuf_copy to use the existing buffer in the ibuf instead of a stack-allocated one. iobuf/iobuf_copy.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) commit 17530c3d7eceb106a74066446404117158e8aa93 Author: Bruce Guenter Date: Fri Jan 30 20:32:39 2004 +0000 Make sure to do sanity checking before any of the reading. iobuf/ibuf_readall.c | 2 ++ 1 file changed, 2 insertions(+) commit 498a28c600b7c89c2701b1529215032934120f64 Author: Bruce Guenter Date: Fri Jan 30 20:25:23 2004 +0000 Added ibuf_readall and ibuf_openreadclose. NEWS | 2 ++ iobuf/ibuf_openreadclose.c | 14 ++++++++++++++ iobuf/ibuf_readall.c | 16 ++++++++++++++++ iobuf/iobuf.h | 2 ++ iobuf/lib=l | 2 ++ 5 files changed, 36 insertions(+) create mode 100644 iobuf/ibuf_openreadclose.c create mode 100644 iobuf/ibuf_readall.c commit b718e88b968039e3fbc890d42cde551b7963ff22 Author: Bruce Guenter Date: Fri Jan 30 19:14:38 2004 +0000 Bumped version up to 1.015, as there are some significant changes in this release, and made a note about the fmt changes. NEWS | 6 +++++- VERSION | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) commit f75a318ea4a32685a2a39be2dc9a55e849387670 Author: Bruce Guenter Date: Fri Jan 30 18:29:25 2004 +0000 Added missing prototypes. net/socket.h | 5 +++++ 1 file changed, 5 insertions(+) commit 950429721e08ed3f3d2147a920cc422f24b4c712 Author: Bruce Guenter Date: Fri Jan 30 18:28:25 2004 +0000 Corrected broken use of #include <>. net/connect4_timeout.c | 6 +++--- net/connect6_timeout.c | 6 +++--- net/connectu_timeout.c | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) commit 5cc830952e610603e92812f37ab75d16808f5664 Author: Bruce Guenter Date: Fri Jan 30 18:22:15 2004 +0000 Added socket connect functions with a timeout. NEWS | 2 ++ net/connect4_timeout.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ net/connect6_timeout.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ net/connectu_timeout.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ net/lib=l | 3 +++ 5 files changed, 154 insertions(+) create mode 100644 net/connect4_timeout.c create mode 100644 net/connect6_timeout.c create mode 100644 net/connectu_timeout.c commit bfa2e37eb30ecf77720843525d9b551977ecfa03 Author: Bruce Guenter Date: Mon Jan 26 17:38:23 2004 +0000 Added str_xlate function. NEWS | 2 ++ str/lib=l | 1 + str/str.h | 1 + str/{subst.c => xlate.c} | 32 +++++++++++++++++++++++++++----- 4 files changed, 31 insertions(+), 5 deletions(-) copy str/{subst.c => xlate.c} (62%) commit 4b0da24801daec3940807a23b99f1ba4deed35f6 Author: Bruce Guenter Date: Mon Jan 26 17:13:53 2004 +0000 Modifed str_subst to return a count of substitutions. NEWS | 2 ++ str/str.h | 2 +- str/subst.c | 17 ++++++++++++----- 3 files changed, 15 insertions(+), 6 deletions(-) commit acfaaf2fa230d83ebe887e0946ab75b25e8c27d3 Author: Bruce Guenter Date: Sat Jan 24 19:28:55 2004 +0000 Renamed the IPv[46] format_r functions to match the new fmt_ library. net/ipv4.h | 2 +- net/ipv4_format.c | 4 ++-- net/ipv6.h | 2 +- net/ipv6_format.c | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) commit cbefbed6e5ad467f3635a0622b4edf277c85736b Author: Bruce Guenter Date: Fri Jan 2 19:31:32 2004 +0000 Added a library of number formatting routines. NEWS | 2 + config.dxy | 2 +- fmt/lcase.c | 4 ++ fmt/number.h | 122 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ fmt/pad.c | 10 +++++ fmt/sdec.c | 13 ++++++ fmt/sign_pad.c | 56 ++++++++++++++++++++++++++ fmt/slldec.c | 13 ++++++ fmt/sllnum.c | 96 +++++++++++++++++++++++++++++++++++++++++++++ fmt/snum.c | 95 ++++++++++++++++++++++++++++++++++++++++++++ fmt/uHex.c | 14 +++++++ fmt/ucase.c | 4 ++ fmt/udec.c | 13 ++++++ fmt/uhex.c | 14 +++++++ fmt/ullHex.c | 15 +++++++ fmt/ulldec.c | 14 +++++++ fmt/ullhex.c | 14 +++++++ fmt/ullnum.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++ fmt/unum.c | 99 ++++++++++++++++++++++++++++++++++++++++++++++ insthier.c | 4 ++ 20 files changed, 704 insertions(+), 1 deletion(-) create mode 100644 fmt/lcase.c create mode 100644 fmt/number.h create mode 100644 fmt/pad.c create mode 100644 fmt/sdec.c create mode 100644 fmt/sign_pad.c create mode 100644 fmt/slldec.c create mode 100644 fmt/sllnum.c create mode 100644 fmt/snum.c create mode 100644 fmt/uHex.c create mode 100644 fmt/ucase.c create mode 100644 fmt/udec.c create mode 100644 fmt/uhex.c create mode 100644 fmt/ullHex.c create mode 100644 fmt/ulldec.c create mode 100644 fmt/ullhex.c create mode 100644 fmt/ullnum.c create mode 100644 fmt/unum.c commit 204258febad2526e9f55d036add539fc6ee533c9 Author: Bruce Guenter Date: Fri Jan 2 19:28:06 2004 +0000 Installer missed installing net/ipv6.h header. insthier.c | 1 + 1 file changed, 1 insertion(+) commit f5beda9c7dd31d328d89c5fc7c843e0f0512fa96 Author: Bruce Guenter Date: Fri Jan 2 18:14:45 2004 +0000 Completed IPv6 network functions. NEWS | 2 +- net/{tcp6.c => accept6.c} | 19 ++++++++++++++----- net/{udp6.c => bind6.c} | 17 +++++++++++------ net/{udp6.c => connect6.c} | 16 +++++++++++----- net/{getaddr4.c => getaddr6.c} | 24 +++++++++++++++--------- net/lib=l | 6 ++++++ net/{recv4.c => recv6.c} | 24 +++++++++++++++--------- net/{tcp6.c => send6.c} | 18 ++++++++++++------ net/socket.h | 9 +++++++++ 9 files changed, 94 insertions(+), 41 deletions(-) copy net/{tcp6.c => accept6.c} (69%) copy net/{udp6.c => bind6.c} (70%) copy net/{udp6.c => connect6.c} (70%) copy net/{getaddr4.c => getaddr6.c} (67%) copy net/{recv4.c => recv6.c} (68%) copy net/{tcp6.c => send6.c} (67%) commit d56eb5f6b4b49340cee67bb7f7c26ae4d7c4e53e Author: Bruce Guenter Date: Fri Jan 2 18:03:13 2004 +0000 Fix errno typo -- wrong error code, missing semicolon. net/tcp6.c | 2 +- net/udp6.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) commit 14c15cece00556208fb09f92d2f6157022b6ae2b Author: Bruce Guenter Date: Fri Jan 2 17:32:41 2004 +0000 Renamed socket_tcp and socket_udp to match socket_tcp6 and socket_udp6. net/lib=l | 4 ++-- net/socket.h | 6 ++++-- net/{tcp.c => tcp4.c} | 8 ++++---- net/{udp.c => udp4.c} | 8 ++++---- 4 files changed, 14 insertions(+), 12 deletions(-) rename net/{tcp.c => tcp4.c} (85%) rename net/{udp.c => udp4.c} (85%) commit 30fdb6afeba148c42355ba9bcbb3babd022f90bf Author: Bruce Guenter Date: Fri Jan 2 17:31:57 2004 +0000 Fixed some comment and function naming typos. net/tcp6.c | 4 ++-- net/udp6.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) commit 4e7618b8fb20bb4aec0aeba8a90264c8ce2ff4e5 Author: Bruce Guenter Date: Fri Jan 2 17:26:26 2004 +0000 Added IPv6 TCP/UDP socket creation functions. net/lib=l | 2 ++ net/socket.h | 2 ++ net/{tcp.c => tcp6.c} | 16 +++++++++++----- net/{tcp.c => udp6.c} | 16 +++++++++++----- 4 files changed, 26 insertions(+), 10 deletions(-) copy net/{tcp.c => tcp6.c} (77%) copy net/{tcp.c => udp6.c} (77%) commit 84865e6fd76afc0d11bcfff30adb75291d5c0328 Author: Bruce Guenter Date: Fri Jan 2 17:17:12 2004 +0000 Simplified the choose script by one more step. choose.sh | 13 ++++++------- sysdeps.h.spac | 42 +++++++++++++++++++++--------------------- 2 files changed, 27 insertions(+), 28 deletions(-) commit 7d29310eb98848b3a71da36848ada638772c624b Author: Bruce Guenter Date: Fri Jan 2 17:11:17 2004 +0000 Added sysdep comments to header files that were missing them. sys/direntry.h1 | 2 ++ sys/direntry.h2 | 2 ++ sys/hasvfork.h1 | 1 + sys/hasvfork.h2 | 1 + sys/uint32.h1 | 1 + sys/uint32.h2 | 1 + 6 files changed, 8 insertions(+) commit 342c7a6b40919b0cc0d119917c2a99ad0b9ef2ee Author: Bruce Guenter Date: Fri Jan 2 14:55:07 2004 +0000 Renamed some sysdep files to make the naming convention more regular. sys/{setenv.h1 => hassetenv.h1} | 0 sys/{setenv.h2 => hassetenv.h2} | 0 sys/{hassgact.h1 => hassigaction.h1} | 0 sys/{hassgact.h2 => hassigaction.h2} | 0 sys/{hassgprm.h1 => hassigprocmask.h1} | 0 sys/{hassgprm.h2 => hassigprocmask.h2} | 0 sys/{select.h1 => hassysselect.h1} | 0 sys/{select.h2 => hassysselect.h2} | 0 sys/{fork.h1 => hasvfork.h1} | 0 sys/{fork.h2 => hasvfork.h2} | 0 sys/{trysgact.c => trysigaction.c} | 0 sys/{trysgprm.c => trysigprocmask.c} | 0 sys/{trysysel.c => trysysselect.c} | 0 sysdeps.h.spac | 15 ++++++--------- 14 files changed, 6 insertions(+), 9 deletions(-) rename sys/{setenv.h1 => hassetenv.h1} (100%) rename sys/{setenv.h2 => hassetenv.h2} (100%) rename sys/{hassgact.h1 => hassigaction.h1} (100%) rename sys/{hassgact.h2 => hassigaction.h2} (100%) rename sys/{hassgprm.h1 => hassigprocmask.h1} (100%) rename sys/{hassgprm.h2 => hassigprocmask.h2} (100%) rename sys/{select.h1 => hassysselect.h1} (100%) rename sys/{select.h2 => hassysselect.h2} (100%) rename sys/{fork.h1 => hasvfork.h1} (100%) rename sys/{fork.h2 => hasvfork.h2} (100%) rename sys/{trysgact.c => trysigaction.c} (100%) rename sys/{trysgprm.c => trysigprocmask.c} (100%) rename sys/{trysysel.c => trysysselect.c} (100%) commit 682efffc1177dfec4aa21ccbb37271f16ddd7c00 Author: Bruce Guenter Date: Thu Jan 1 22:07:14 2004 +0000 Fixed trivial typo: I put the ipv6 and getpeereid tests in the wrong place. sysdeps.h.spac | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) commit 8370237810b136ea399a153cd05b2605fcbe415d Author: Bruce Guenter Date: Thu Jan 1 22:04:43 2004 +0000 Simplified the sysdep production system by truncating prefixes used by the choose script. choose.sh | 14 ++++++++------ sysdeps.h.spac | 42 +++++++++++++++++++++--------------------- 2 files changed, 29 insertions(+), 27 deletions(-) commit f92c884f977b6b2c96406997eaf75dc4905b8934 Author: Bruce Guenter Date: Thu Jan 1 22:03:42 2004 +0000 Added control file necessary to generate systime.h. systime.h.spac | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 systime.h.spac commit d0cc2457467e27769134d4ac18b092d1986b9b28 Author: Bruce Guenter Date: Thu Jan 1 21:58:11 2004 +0000 Added missing config file. conf-home | 1 + 1 file changed, 1 insertion(+) create mode 100644 conf-home commit 09653bb76f5602558ee03bfe3a654b9f9e38ddba Author: Bruce Guenter Date: Thu Jan 1 21:45:57 2004 +0000 Added missing source. choose.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 choose.sh commit c7379d59a4f0d7ce2411bd0a2575583428fc7902 Author: Bruce Guenter Date: Thu Jan 1 20:55:06 2004 +0000 Add a sysdep testing for IPv6 defines and structures. sys/hasipv6.h1 | 1 + sys/hasipv6.h2 | 2 ++ sys/tryipv6.c | 9 +++++++++ sysdeps.h.spac | 2 ++ 4 files changed, 14 insertions(+) create mode 100644 sys/hasipv6.h1 create mode 100644 sys/hasipv6.h2 create mode 100644 sys/tryipv6.c commit b2ca2589253a6eb4699eea112d160d7c52b15ffe Author: Bruce Guenter Date: Tue Dec 30 19:22:51 2003 +0000 Added missing documentation for socket_notcpdelay net/notcpdelay.c | 7 +++++++ 1 file changed, 7 insertions(+) commit ef26a65d1a29a80df32c67b82ac5336e5db79ee8 Author: Bruce Guenter Date: Tue Dec 30 19:19:00 2003 +0000 Added TCP nodelay function. net/lib=l | 1 + net/{udp.c => notcpdelay.c} | 12 +++++------- net/socket.h | 1 + 3 files changed, 7 insertions(+), 7 deletions(-) copy net/{udp.c => notcpdelay.c} (77%) commit 87f472fbc015022d7026a2cf1dadc26c5f4e7f1e Author: Bruce Guenter Date: Tue Dec 30 18:06:39 2003 +0000 Added IPv4 loopback address constant. net/ipv4.h | 1 + net/ipv4_addr.c | 2 ++ 2 files changed, 3 insertions(+) commit 9b8e560b89c86ce71653eeedee94326194770220 Author: Bruce Guenter Date: Tue Dec 30 05:01:19 2003 +0000 Updated the Doxygen configuration for new version of doxygen. config.dxy | 485 ++++++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 321 insertions(+), 164 deletions(-) commit b86db2b5a1354488c3e64f40d7758cea884a3b45 Author: Bruce Guenter Date: Mon Dec 29 21:20:03 2003 +0000 Converted the _r formatting functions to return a count of bytes written to the formatted string instead of a pointer. net/ipv4.h | 2 +- net/ipv4_format.c | 9 +++++---- net/ipv6.h | 2 +- net/ipv6_format.c | 17 ++++++++++------- 4 files changed, 17 insertions(+), 13 deletions(-) commit 29bf8d7e60052f254ed61dbfcc00bb7097d76336 Author: Bruce Guenter Date: Mon Dec 29 20:50:18 2003 +0000 Added thread/recursion safe IP formatting routines. net/ipv4.h | 1 + net/ipv4_format.c | 20 +++++++++++++--- net/ipv6.h | 1 + net/ipv6_format.c | 72 ++++++++++++++++++++++++++++++------------------------- 4 files changed, 58 insertions(+), 36 deletions(-) commit 23cae50a100f5e5b17f3c626541abe3c0ae4ba5a Author: Bruce Guenter Date: Mon Dec 29 19:53:42 2003 +0000 Added IPv6 address parsing/formatting functions. NEWS | 2 + net/ipv6.h | 23 ++++++++ net/ipv6_addr.c | 6 ++ net/ipv6_format.c | 136 ++++++++++++++++++++++++++++++++++++++++++++ net/ipv6_scan.c | 166 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ net/lib=l | 3 + 6 files changed, 336 insertions(+) create mode 100644 net/ipv6.h create mode 100644 net/ipv6_addr.c create mode 100644 net/ipv6_format.c create mode 100644 net/ipv6_scan.c commit afa0f9db086f28b00c67f5f1faff8b52a21cf96a Author: Bruce Guenter Date: Thu Dec 18 04:30:48 2003 +0000 Added str_splice functions. NEWS | 1 + str/lib=l | 1 + str/splice.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ str/str.h | 4 ++++ 4 files changed, 82 insertions(+) create mode 100644 str/splice.c commit 76babe28f8d976e82dfac7f066424a296e9fdb2c Author: Bruce Guenter Date: Thu Dec 18 04:28:21 2003 +0000 Bumped version to 1.012 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit e745c8e8baf201f6dcb117229471aacf2003c159 Author: Bruce Guenter Date: Mon Dec 1 17:24:43 2003 +0000 Added note about missing include fix. NEWS | 3 +++ 1 file changed, 3 insertions(+) commit 1996d165c86a66cc31c76a7fc624187dbdc83527 Author: Bruce Guenter Date: Mon Dec 1 16:50:46 2003 +0000 Add missing include which declares strtol and strtoull. crc-gentab.c | 1 + 1 file changed, 1 insertion(+) commit d37e6eb4434dd582f8276e3d77f889fab08736a9 Author: Bruce Guenter Date: Thu Nov 27 21:42:28 2003 +0000 Internal changes to installer scripts to make it work on systems where the root directory is non-readable. NEWS | 3 +++ install/installer.c | 24 +++++++++++------------- install/instcheck.c | 18 +++++++++--------- 3 files changed, 23 insertions(+), 22 deletions(-) commit 67d05f55509bf9bad5876e0d2dcd0a540543d199 Author: Bruce Guenter Date: Tue Nov 18 23:00:15 2003 +0000 Return the result of debugged functions, and flush stderr on exit. selftest.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) commit e23fe6ba5d30186da56fd77b2177fb712071e7b6 Author: Bruce Guenter Date: Tue Nov 18 22:59:18 2003 +0000 Fixed up parsing of illegal IP addresses, and added self tests. net/ipv4_scan.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) commit b33f65b9a9cb2b0108ee0f8114c25754e06217cc Author: Bruce Guenter Date: Tue Nov 18 21:03:18 2003 +0000 Fixed ipv4 address parsing number validation. NEWS | 2 ++ net/ipv4_scan.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) commit 136185af0eece6c9b741d4a487a770da3310d0d6 Author: Bruce Guenter Date: Tue Nov 18 21:02:41 2003 +0000 Fixed up crc64 table generation on 64-bit platforms. NEWS | 2 ++ crc-gentab.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) commit 05f2202ca33d814b90f4df7646df36635d825cfd Author: Bruce Guenter Date: Mon Nov 17 22:24:01 2003 +0000 Fixed missing "ULL" on a constant. NEWS | 2 ++ crypto/sha512.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) commit 29eb3913617d00824e37ac3623592f1f9270d5b0 Author: Bruce Guenter Date: Mon Nov 17 22:23:17 2003 +0000 Added mailing list archive site. README.in | 2 ++ makedist.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) commit 7e575f893a2ba423295a3b4437fd93ed09b219e2 Author: Bruce Guenter Date: Mon Nov 17 21:51:22 2003 +0000 Fixed up self-test on selfpipe if different fds are opened. NEWS | 2 ++ unix/selfpipe.c | 14 ++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) commit 6db051cb348bf398c70bd901c79445b49dd33eb3 Author: Bruce Guenter Date: Mon Nov 17 21:38:29 2003 +0000 Bumped version to 1.011 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit e34899d3c38ffc214e49d233e4404d892d9fa948 Author: Bruce Guenter Date: Mon Nov 17 20:14:38 2003 +0000 Fixed up the mailing list subscribe address. README.in | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) commit bd66d787d2f8925db08fc957a513ee03e2f44c34 Author: Bruce Guenter Date: Mon Nov 17 19:27:39 2003 +0000 Bugfix: avoid using opendir to set up the root directory fd, as opendir does a chdir first, which is bad. install/installer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) commit afd62723573651416400ebb809e58da465fd37bc Author: Bruce Guenter Date: Mon Nov 17 18:22:14 2003 +0000 Force FD 0 to be the root directory when installing; fixup resulting multiple "/" prefixes in instshow. install/installer.c | 3 +++ install/instcheck.c | 3 +++ install/instshow.c | 13 ++++++++----- insthier.c | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) commit df7268d2b57fb064ef377aa1043f1bef7e76e4e0 Author: Bruce Guenter Date: Mon Nov 17 18:02:04 2003 +0000 Export the signal catch routine to allow other signals to be handled. unix/selfpipe.c | 9 +++++++-- unix/selfpipe.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) commit d40019001588c1ccf6676f95aba2666f48b31a26 Author: Bruce Guenter Date: Mon Nov 17 17:58:10 2003 +0000 Write the signal number to the pipe instead of arbitrary data; make the signal catching mechanism more generic. unix/selfpipe.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) commit a9076e8b8cfd3144887944de548f1da967a83e53 Author: Bruce Guenter Date: Tue Jul 22 21:43:45 2003 +0000 Fixed insthier installing "installer.o" in place of "instcheck.o" NEWS | 3 +++ insthier.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) commit a8e2ca9287478c947b0987b0a5056e545bb81c98 Author: Bruce Guenter Date: Wed Jun 18 16:56:43 2003 +0000 Added macros for uint*_*_native functions, to be defined as using the system's native byte order. On systems that support unalligned memory accesses, this provides for high-performance multi-byte accesses. uint16.h | 10 ++++++++++ uint32.h | 10 ++++++++++ uint64.h | 10 ++++++++++ 3 files changed, 30 insertions(+) commit d4f905e06e7e8efdc848b039fbe298e53f22e14e Author: Bruce Guenter Date: Thu Jun 12 22:25:10 2003 +0000 Added documentation for selfpipe functions, and fixed up an (highly unlikely) file descriptor leak on error. config.dxy | 2 +- unix/selfpipe.c | 24 +++++++++++++++++++++++- unix/selfpipe.h | 5 +++++ 3 files changed, 29 insertions(+), 2 deletions(-) commit b075128343af5c45eb98bbbe7fa89126e1e7c5d4 Author: Bruce Guenter Date: Wed Jun 11 22:56:32 2003 +0000 Broke the wrapper functions into their own modules, and added wrap_str. msg/lib=l | 4 +++- msg/wrap.h | 1 + msg/{wrap.c => wrap_chdir.c} | 2 -- msg/wrap_exit.c | 4 ++++ msg/wrap_str.c | 8 ++++++++ 5 files changed, 16 insertions(+), 3 deletions(-) rename msg/{wrap.c => wrap_chdir.c} (89%) create mode 100644 msg/wrap_exit.c create mode 100644 msg/wrap_str.c commit f419fc3aad6436f8da2127d920cf507c7e13cf95 Author: Bruce Guenter Date: Wed Jun 11 22:41:52 2003 +0000 Added "out of memory" standard function. msg/lib=l | 1 + msg/msg.h | 2 ++ msg/oom.c | 6 ++++++ 3 files changed, 9 insertions(+) create mode 100644 msg/oom.c commit 8b778e5e47db980d0cc7868040340dfe42faedbe Author: Bruce Guenter Date: Wed Jun 11 21:20:42 2003 +0000 Removed old note about building CRC tables. TODO | 4 ---- 1 file changed, 4 deletions(-) commit 5540a5bbe6a9798b2a257aef492df3a22a6f732d Author: Bruce Guenter Date: Wed Jun 11 21:08:30 2003 +0000 Added self-pipe SIGCHLD handling functions. NEWS | 2 ++ unix/lib=l | 1 + unix/selfpipe.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ unix/selfpipe.h | 7 ++++++ 4 files changed, 84 insertions(+) create mode 100644 unix/selfpipe.c create mode 100644 unix/selfpipe.h commit 264185407d1b2d902cd410ce5256cf42c93a4865 Author: Bruce Guenter Date: Wed Jun 11 18:04:16 2003 +0000 Use a modified "compile" script to compile selftests, as some versions of gcc (and maybe other cc's) don't like multiple "-o" options. selftests.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) commit 91b4255329a4c6c2f34d3ea13b9c00fef79de21e Author: Bruce Guenter Date: Wed Jun 11 17:28:38 2003 +0000 Make sure MAP_FAILED is defined before using it. iobuf/iobuf_init.c | 4 ++++ 1 file changed, 4 insertions(+) commit f18a454fb91e72fd10f01cd98a1747664a08cc21 Author: Bruce Guenter Date: Wed Jun 11 17:16:55 2003 +0000 Added getpeereid sysdep function. NEWS | 2 ++ libbg-sysdeps=l | 1 + sys/getpeereid.c | 29 +++++++++++++++++++++++++++ sys/hasgetpeereid.h1 | 2 ++ sys/hasgetpeereid.h2 | 2 ++ sys/{trywaitp.c => trygetpeereid.c} | 4 ++-- sysdeps.h.spac | 40 +++++++++++++++++++------------------ 7 files changed, 59 insertions(+), 21 deletions(-) create mode 100644 sys/getpeereid.c create mode 100644 sys/hasgetpeereid.h1 create mode 100644 sys/hasgetpeereid.h2 copy sys/{trywaitp.c => trygetpeereid.c} (50%) commit c21f57c8115fa52ec49c89870a490b7b84267cc1 Author: Bruce Guenter Date: Wed May 28 19:53:40 2003 +0000 Fixed the 64-bit constants to use "ULL" notation. crypto/sha512.c | 80 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 40 insertions(+), 40 deletions(-) commit bede20569ff6128dc4b5dbf89c50ebc25e0e6f9e Author: Bruce Guenter Date: Wed May 14 17:49:58 2003 +0000 Added str_start functions. NEWS | 2 ++ str/case_start.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++ str/lib=l | 2 ++ str/{copy.c => start.c} | 57 +++++++++++++++++++++--------------- str/str.h | 8 +++++ 5 files changed, 123 insertions(+), 23 deletions(-) create mode 100644 str/case_start.c copy str/{copy.c => start.c} (50%) commit d190cba0aecf890940977e33658d3ffa15adcc46 Author: Bruce Guenter Date: Wed May 14 17:26:31 2003 +0000 wrap_* functions can now exit with a customized error code. NEWS | 2 ++ msg/wrap.c | 4 +++- msg/wrap.h | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) commit 756188f06917ddf91c66d300fa3d1e0140ea5d19 Author: Bruce Guenter Date: Wed May 14 17:21:00 2003 +0000 Use the modified str_glob API. path/fnmatch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit c908f5c460d563f8d00a69f04a0b15490c3fa1b9 Author: Bruce Guenter Date: Wed May 14 17:20:23 2003 +0000 Split the case insensitive parts of the str_glob and str_match functions into str_case_glob and str_case_match respectively. NEWS | 3 + str/case_glob.c | 394 ++++++++++++++++++++++++++++++++++ str/{match.c => case_match.c} | 116 +++++----- str/glob.c | 476 +++++++++++++++++++----------------------- str/lib=l | 2 + str/match.c | 116 +++++----- str/str.h | 18 +- 7 files changed, 724 insertions(+), 401 deletions(-) create mode 100644 str/case_glob.c copy str/{match.c => case_match.c} (55%) commit fb12e61397a0204dfcde83a0175e0c5d23c20cdc Author: Bruce Guenter Date: Wed Apr 16 23:38:45 2003 +0000 Removed stale directory. commit 6dcd72788d2abdb97865735af7590eec12aa74e3 Author: Bruce Guenter Date: Wed Apr 16 23:34:28 2003 +0000 Make all the CRC tables generated at build-time. NEWS | 2 ++ crc/gentab.c => crc-gentab.c | 2 +- crc-gentab=x | 3 +++ crc/crc16_arc_table.c.spac | 2 ++ crc/crc16_ccitt_table.c.spac | 2 ++ crc/crc16_xmodem_table.c.spac | 2 ++ crc/crc32_table.c.spac | 2 ++ crc/crc64_table.c.spac | 2 ++ 8 files changed, 16 insertions(+), 1 deletion(-) rename crc/gentab.c => crc-gentab.c (98%) create mode 100644 crc-gentab=x create mode 100644 crc/crc16_arc_table.c.spac create mode 100644 crc/crc16_ccitt_table.c.spac create mode 100644 crc/crc16_xmodem_table.c.spac create mode 100644 crc/crc32_table.c.spac create mode 100644 crc/crc64_table.c.spac commit f46e9e38edd52b151bd688d0c91c641c90b87c18 Author: Bruce Guenter Date: Wed Apr 16 23:31:04 2003 +0000 Removed depricated file. path/all.spac | 1 - 1 file changed, 1 deletion(-) delete mode 100644 path/all.spac commit 1086cd8957c596fb8f1685766a174f35695079b1 Author: Bruce Guenter Date: Tue Apr 15 23:38:16 2003 +0000 Removed the cvm libraries (merged into the main cvm package). NEWS | 2 ++ cvm-sasl/authenticate.c | 13 ------------- cvm-sasl/cram_md5.c | 44 -------------------------------------------- cvm-sasl/cvm-sasl.h | 35 ----------------------------------- cvm-sasl/cvm-sasl.html | 40 ---------------------------------------- cvm-sasl/init.c | 48 ------------------------------------------------ cvm-sasl/internal.h | 17 ----------------- cvm-sasl/lib=l | 6 ------ cvm-sasl/login.c | 28 ---------------------------- cvm-sasl/plain.c | 26 -------------------------- cvm-sasl/start.c | 19 ------------------- insthier.c | 23 ----------------------- 12 files changed, 2 insertions(+), 299 deletions(-) delete mode 100644 cvm-sasl/authenticate.c delete mode 100644 cvm-sasl/cram_md5.c delete mode 100644 cvm-sasl/cvm-sasl.h delete mode 100644 cvm-sasl/cvm-sasl.html delete mode 100644 cvm-sasl/init.c delete mode 100644 cvm-sasl/internal.h delete mode 100644 cvm-sasl/lib=l delete mode 100644 cvm-sasl/login.c delete mode 100644 cvm-sasl/plain.c delete mode 100644 cvm-sasl/start.c commit abd86d205186c1b7c0e41f4c086283f7b5be85d0 Author: Bruce Guenter Date: Tue Apr 15 23:34:45 2003 +0000 Updated with past changes. NEWS | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) commit 29154c93d44079cf25aa6080dad294785214d5a1 Author: Bruce Guenter Date: Tue Apr 15 23:33:26 2003 +0000 Keep track of the message length in bytes instead of bits, avoiding extra computations every time a block is processed. crypto/sha256.c | 24 ++++++++++++------------ crypto/sha256.h | 3 +-- crypto/sha384.c | 4 +--- crypto/sha512.c | 39 ++++++++++++++------------------------- crypto/sha512.h | 5 ++--- 5 files changed, 30 insertions(+), 45 deletions(-) commit 7bb558922ac83c9c20dab2f968eccfb388ad1a9d Author: Bruce Guenter Date: Wed Apr 9 21:00:33 2003 +0000 Applied some major optimizations to the main update loop and the final stage, cutting the overhead cost in half. crypto/sha1.c | 84 ++++++++++++++++++++++++----------------------------------- crypto/sha1.h | 5 ++-- 2 files changed, 36 insertions(+), 53 deletions(-) commit 810eff7e701efd042971e3ab4aaf049f5a424398 Author: Bruce Guenter Date: Wed Apr 9 20:58:40 2003 +0000 Fixed a one-off bug, noticed when comparing the new SHA code to the existing SHA-1 code. crypto/sha256.c | 2 +- crypto/sha512.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) commit 79a51bcc7aa5f0431a584cfbcfbb1c6912191245 Author: Bruce Guenter Date: Tue Apr 8 19:56:50 2003 +0000 Added a small optimization to the SHA-256/512 code found in the MD5 implementation. NEWS | 1 + crypto/sha256.c | 4 +++- crypto/sha512.c | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) commit be5104e241f9fd3cdb70d20bc4cc4c0ab6becddb Author: Bruce Guenter Date: Tue Apr 8 16:11:25 2003 +0000 Bumped up version to 1.010 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit 2a297efa60ab5bd40a46693ac0b3f1215be171d1 Author: Bruce Guenter Date: Mon Apr 7 17:42:29 2003 +0000 Turn off recv/sendfd if the appropriate defines are missing. NEWS | 2 ++ net/recvfd.c | 6 ++++++ net/sendfd.c | 6 ++++++ 3 files changed, 14 insertions(+) commit 5811940c4074d27210bc12e09f2034a0559125fc Author: Bruce Guenter Date: Mon Apr 7 17:07:12 2003 +0000 Fixed iobuf/iobuf_init.c for systems that lack anonymous mmap. NEWS | 2 ++ iobuf/iobuf_init.c | 12 +++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) commit 763e4c42412d341306c1758a4c990d3fc4a4a1c7 Author: Bruce Guenter Date: Mon Apr 7 17:00:46 2003 +0000 Added note about SHA-256/384/512 changes. NEWS | 2 ++ 1 file changed, 2 insertions(+) commit c87fe8a83fa51d12fae876e3c8331e1017a43394 Author: Bruce Guenter Date: Mon Apr 7 16:35:15 2003 +0000 Install the right SHA headers. insthier.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) commit 12ba7e0445ba73e3cee11c01caad586d9e14de84 Author: Bruce Guenter Date: Mon Apr 7 16:34:53 2003 +0000 Broke out the uint## macros into a separate header, to speed up compilations that don't require these macros. insthier.c | 1 + sysdeps-tail.h | 58 ---------------------------------------------- uint16.h | 1 + uint32.h | 1 + uint64.h | 1 + sysdeps-tail.h => uintnn.h | 3 +++ 6 files changed, 7 insertions(+), 58 deletions(-) copy sysdeps-tail.h => uintnn.h (97%) commit 7ad9b7a22c975485cbca2a1a825e7dc0bfc749ca Author: Bruce Guenter Date: Mon Apr 7 16:18:21 2003 +0000 Broke the SHA512 final transform and the copying of the digest into separate routines, so that SHA384 doesn't have to do a double copy. crypto/sha384.c | 10 +++++++--- crypto/sha512.c | 8 ++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) commit ed07f469dce82524a65752104a4a03ff24803a36 Author: Bruce Guenter Date: Mon Apr 7 15:53:52 2003 +0000 Two optimizations: 1. Avoid copying input data into ctx->M when possible. 2. Use a rolling pointer to set up the initial value of W. crypto/sha256.c | 61 ++++++++++++++++++++---------------- crypto/sha384.c | 4 +-- crypto/sha512.c | 95 +++++++++++++++++++++++++++++++-------------------------- 3 files changed, 87 insertions(+), 73 deletions(-) commit 73db245a30f56eb0645165413ed5f32f0017a516 Author: Bruce Guenter Date: Mon Apr 7 15:24:05 2003 +0000 Rewrote the SHA-256 algorithm from scratch, based on the SHA-512 code. crypto/sha256.c | 396 +++++++++++++++++++++++++------------------------------- crypto/sha256.h | 19 ++- 2 files changed, 187 insertions(+), 228 deletions(-) commit e79694e601d9d78685060b6cea0c35e720dafdc7 Author: Bruce Guenter Date: Sat Apr 5 13:56:06 2003 +0000 Adds SHA384, a trivial derivation of SHA512. crypto/lib=l | 1 + crypto/sha384.c | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ crypto/sha384.h | 15 +++++++++ 3 files changed, 110 insertions(+) create mode 100644 crypto/sha384.c create mode 100644 crypto/sha384.h commit 3e099abe0824ea117f6599c3d786b0aead39a042 Author: Bruce Guenter Date: Sat Apr 5 13:55:04 2003 +0000 Removed the 32-bit implementation, as the native 64-bit code compiles to smaller and faster objects. crypto/sha512.c | 183 ++------------------------------------------------------ crypto/sha512.h | 4 -- 2 files changed, 5 insertions(+), 182 deletions(-) commit a299b1fb65705c50c744c945b251aa066ce4c077 Author: Bruce Guenter Date: Sat Apr 5 04:47:46 2003 +0000 Fixed a harmless warning, and added several more test vectors from http://www.aarongifford.com/computers/sha.html crypto/sha512.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) commit 2fa8456afe52b1b41e6c5e81f195a5d21f33b783 Author: Bruce Guenter Date: Sat Apr 5 04:38:16 2003 +0000 Renamed sha512a to sha512, and merged in a 64-bit native implementation. crypto/lib=l | 2 +- crypto/{sha512a.c => sha512.c} | 321 ++++++++++++++++++++++++++++------------- crypto/sha512.h | 24 +++ crypto/sha512a.h | 20 --- 4 files changed, 243 insertions(+), 124 deletions(-) rename crypto/{sha512a.c => sha512.c} (52%) create mode 100644 crypto/sha512.h delete mode 100644 crypto/sha512a.h commit 2cb1fefe702f168d2ab514fae4f5847c4b89bd9d Author: Bruce Guenter Date: Fri Apr 4 18:25:38 2003 +0000 First round of portability fixes. crypto/sha256.c | 2 +- crypto/sha512a.c | 149 ++++++++++++++++++++++++------------------------------- crypto/sha512a.h | 16 +++--- 3 files changed, 72 insertions(+), 95 deletions(-) commit 91673333efcd6f86a47393dd4a36e07f9c1fffe2 Author: Bruce Guenter Date: Wed Apr 2 16:54:39 2003 +0000 Bumped up version to 1.009 NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit 5e7c963834bf7c8fe2e2c7d7e287cb20a7e4d308 Author: Bruce Guenter Date: Wed Apr 2 16:54:13 2003 +0000 More portability fixes: don't use "local", and switch to using short-circuit logic so "set -e" can be used. selftests.sh | 46 ++++++++++++++-------------------------------- 1 file changed, 14 insertions(+), 32 deletions(-) commit 0c5d3e7051f2a83f4110d502dae9c809efeb4296 Author: Bruce Guenter Date: Wed Apr 2 15:21:59 2003 +0000 Clean up warnings about unused parameters. install/instcheck.c | 1 + install/instshow.c | 1 + 2 files changed, 2 insertions(+) commit e6ef2254bc811e942fcf863c292c0b728be78fbf Author: Bruce Guenter Date: Tue Apr 1 23:02:21 2003 +0000 Noted miscelaneous changes. NEWS | 5 +++++ 1 file changed, 5 insertions(+) commit 87f4ca133d1adf719935017c568cd3696a5d73ed Author: Bruce Guenter Date: Tue Apr 1 22:59:38 2003 +0000 Another portability fix. unix/sig_all.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) commit a4ca0149d1fb3fc048b3815c98e2c7921a1efe5e Author: Bruce Guenter Date: Tue Apr 1 22:55:48 2003 +0000 Annotate sources for test vectors. crc/crc16_arc_update.c | 6 ++++++ crc/crc16_ccitt_update.c | 4 ++++ 2 files changed, 10 insertions(+) commit a4761eba29007ecc16a5acae0a63342c340a8a5a Author: Bruce Guenter Date: Tue Apr 1 22:54:13 2003 +0000 Compatibility fixes for Solaris (among others). net/cmsg.h | 27 +++++++++++++++++++++++++++ net/recvfd.c | 6 +----- net/sendfd.c | 6 +----- 3 files changed, 29 insertions(+), 10 deletions(-) create mode 100644 net/cmsg.h commit e9cbdf285e05e520c85a068faf362255e1c764d5 Author: Bruce Guenter Date: Tue Apr 1 22:42:42 2003 +0000 Note to self... TODO | 2 ++ 1 file changed, 2 insertions(+) commit 3b390ef9b978b7b3b44b355c12befe580a917e11 Author: Bruce Guenter Date: Tue Apr 1 22:42:27 2003 +0000 Switch from uint32_unpack to uint32_get (could produce better code). cdb/find.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) commit f793d488616189905b80bd11b1bb294828d77ab9 Author: Bruce Guenter Date: Tue Apr 1 22:41:59 2003 +0000 Remember to close (and thereby flush) the output file. cdb/make.c | 1 + 1 file changed, 1 insertion(+) commit bbf56464ce32501a5d4475e28b89c02f80c9c4a8 Author: Bruce Guenter Date: Tue Apr 1 22:41:20 2003 +0000 Install all the ADT headers. insthier.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) commit e1ca04504483d1a640c80062ff075063ec1309c8 Author: Bruce Guenter Date: Tue Apr 1 22:40:59 2003 +0000 Don't blow up when retrieving an entry from an empty table. adt/ghash_get.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) commit 77cd79c67f7ee145ac2b8987bd05d35ec2ff8696 Author: Bruce Guenter Date: Tue Apr 1 22:40:23 2003 +0000 Add support for separators in long option listings. cli/cli.h | 1 + cli/main.c | 6 ++++++ 2 files changed, 7 insertions(+) commit 2a8e0cc4e339fd139600e10b4c4d3f2c4d27dd1a Author: Bruce Guenter Date: Tue Apr 1 13:31:37 2003 +0000 Add a new option type: CLI_FUNCTION. When options of this type are found, a function is called with the corresponding command-line argument. cli/cli.h | 3 +++ cli/main.c | 5 +++++ 2 files changed, 8 insertions(+) commit c7d79a032814798d42307df767b678db34ff0d3e Author: Bruce Guenter Date: Tue Apr 1 13:19:49 2003 +0000 Add a pointer to the option in each stringlist node, for setups where multiple options add to the same list. cli/cli.h | 15 ++++++++------- cli/main.c | 6 ++++-- 2 files changed, 12 insertions(+), 9 deletions(-) commit a5fe13d8374692a0083b2ddde234ed5377678eb6 Author: Bruce Guenter Date: Wed Mar 26 17:52:36 2003 +0000 Added note about Subversion repository. README.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) commit 16b5f11add7fcf51a83f50bd69b4ffa5f2e6b18c Author: Bruce Guenter Date: Wed Mar 26 17:17:03 2003 +0000 Modified to allow running individual tests. selftests.sh | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) commit ed716837b68761c055037022c4ad2122c7a5a12a Author: Bruce Guenter Date: Wed Mar 26 17:16:43 2003 +0000 Reuse the str glob function, add dotfile tests. path/fnmatch.c | 236 ++++++++------------------------------------------------- 1 file changed, 30 insertions(+), 206 deletions(-) commit 3dcb73152d6220e9dbacaa90c386634516d91ff3 Author: Bruce Guenter Date: Wed Mar 26 17:08:55 2003 +0000 Added case insensitivity to str_match*. NEWS | 2 ++ str/match.c | 113 +++++++++++++++++++++++++++++++++++++++--------------------- str/str.h | 10 +++--- 3 files changed, 80 insertions(+), 45 deletions(-) commit ec66ca3808fabd809b2ec5d87f11c423030ed5d9 Author: Bruce Guenter Date: Wed Mar 26 16:44:14 2003 +0000 Added globbing function to str library. NEWS | 2 + str/glob.c | 433 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ str/lib=l | 1 + str/str.h | 5 +- 4 files changed, 440 insertions(+), 1 deletion(-) create mode 100644 str/glob.c commit 5120802c08343fd9e78b1db4b010f01099746423 Author: Bruce Guenter Date: Tue Mar 25 23:04:26 2003 +0000 Changed API for str_match function to allow for matching against binary or dynamic strings. str/match.c | 33 ++++++++++++++++++++++++--------- str/str.h | 4 +++- 2 files changed, 27 insertions(+), 10 deletions(-) commit 668ca6322b3e057b60b607228d51f29b3e6a708c Author: Bruce Guenter Date: Tue Mar 25 18:46:23 2003 +0000 Moved tests into the ghash sources so the selftests mechanism will run them. adt/ghash_add.c | 122 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ adt/ghash_test.c | 53 ------------------------ 2 files changed, 122 insertions(+), 53 deletions(-) delete mode 100644 adt/ghash_test.c commit d364fbe6f3f75d6a323f53748a72857f3f5f45f1 Author: Bruce Guenter Date: Tue Mar 25 17:24:29 2003 +0000 Renamed global to avoid naming conflicts. adt/ghash_test.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) commit 88536a72caa8b233564f76f2866726f0c2027a29 Author: Bruce Guenter Date: Tue Mar 25 17:24:01 2003 +0000 Added stack and queue ADTs. NEWS | 1 + TODO | 2 +- adt/gqueue.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ adt/gqueue_pop.c | 17 +++++++++++++++++ adt/gqueue_push.c | 19 +++++++++++++++++++ adt/gqueue_top.c | 6 ++++++ adt/gstack.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ adt/gstack_pop.c | 15 +++++++++++++++ adt/gstack_push.c | 18 ++++++++++++++++++ adt/gstack_top.c | 6 ++++++ adt/lib=l | 6 ++++++ 11 files changed, 186 insertions(+), 1 deletion(-) create mode 100644 adt/gqueue.h create mode 100644 adt/gqueue_pop.c create mode 100644 adt/gqueue_push.c create mode 100644 adt/gqueue_top.c create mode 100644 adt/gstack.h create mode 100644 adt/gstack_pop.c create mode 100644 adt/gstack_push.c create mode 100644 adt/gstack_top.c commit 2f3793931d93495fc13733e5c87eb04620dbe32b Author: Bruce Guenter Date: Tue Mar 25 17:22:44 2003 +0000 Moved the function prototypes into a common header. adt/common.h | 9 +++++++++ adt/ghash.h | 35 ++++++++++++++++------------------- adt/ghash_add.c | 6 +++--- adt/ghash_free.c | 4 ++-- adt/ghash_get.c | 2 +- adt/ghash_rehash.c | 2 +- 6 files changed, 32 insertions(+), 26 deletions(-) create mode 100644 adt/common.h commit b40ce9174623784157bc49ffc16e0ea5e658fb50 Author: Bruce Guenter Date: Fri Mar 21 22:32:22 2003 +0000 Added some more tests, and URLs to where I found the vectors. crc/crc32_update.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) commit ba506625808346b9b9c098c0e7db34d30c9350ba Author: Bruce Guenter Date: Fri Mar 21 20:36:03 2003 +0000 Moved (most of) the self-tests into the main source module so they will get included in the resulting tarball. crypto/md4-test.c | 43 -------------------- crypto/md4.c | 101 +++++++++++++++++------------------------------ crypto/md5-test.c | 45 --------------------- crypto/md5.c | 92 +++++++++++++++++++++---------------------- crypto/sha1.c | 72 ++++++++++++++++----------------- crypto/sha256.c | 107 +++++++++++++++++++++++++++++++++----------------- crypto/sha256.h | 15 ++++--- crypto/sha256test.c | 38 ------------------ crypto/sha512a-test.c | 38 ------------------ crypto/sha512a.c | 38 ++++++++++++++++++ 10 files changed, 235 insertions(+), 354 deletions(-) delete mode 100644 crypto/md4-test.c delete mode 100644 crypto/md5-test.c delete mode 100644 crypto/sha256test.c delete mode 100644 crypto/sha512a-test.c commit 35be84027bab228f1ccf2661b3da78459491e51f Author: Bruce Guenter Date: Fri Mar 21 20:05:00 2003 +0000 Don't try to output the entire self-test contents in the diff. selftests.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) commit 817462de86b116a072bbc0cb9b46de95f85622c9 Author: Bruce Guenter Date: Fri Mar 21 20:04:31 2003 +0000 Added self-tests. path/match.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ str/match.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) commit 94f0ba071ff79955e342c854111897c0e7d8e215 Author: Bruce Guenter Date: Fri Mar 21 20:03:54 2003 +0000 Added self-tests, which showed up several bugs. path/fnmatch.c | 179 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 175 insertions(+), 4 deletions(-) commit f0d1e5c2d9fafd1f46359a2002d48a374b89a8bb Author: Bruce Guenter Date: Thu Mar 20 21:40:20 2003 +0000 Moved the iopoll, setenv, and unsetenv objects into the sys subdirectory. libbg-sysdeps=l | 6 +++--- iopoll.c => sys/iopoll.c | 0 setenv.c => sys/setenv.c | 0 unsetenv.c => sys/unsetenv.c | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename iopoll.c => sys/iopoll.c (100%) rename setenv.c => sys/setenv.c (100%) rename unsetenv.c => sys/unsetenv.c (100%) commit 451941fc65964b5fdb206ee7703f29be099d3a6b Author: Bruce Guenter Date: Thu Mar 20 21:02:04 2003 +0000 Don't strip the environment, for setups where env vars are required to compile. selftests.spac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit b66c8459d25e555884181e4032966147d7ee2793 Author: Bruce Guenter Date: Thu Mar 20 19:25:36 2003 +0000 Broke out the #ifdef and #endif constants into the head/tail files. sysdeps-head.h | 3 +++ sysdeps-tail.h | 1 + sysdeps.h.spac | 3 --- 3 files changed, 4 insertions(+), 3 deletions(-) commit 6db54cc166297de7f7c1bc91cee43839cf0c41f6 Author: Bruce Guenter Date: Thu Mar 20 19:22:43 2003 +0000 msg_show_pid should be const. msg/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 91a83c0177b7e1c9fe08fdc198a2a0f5ab2b2376 Author: Bruce Guenter Date: Thu Mar 20 19:22:22 2003 +0000 Since is already included, just use pid_t instead of int. sys/fork.h1 | 2 +- sys/fork.h2 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) commit 6f003695c2a04c21af9a6fc55baa032fbb7973d2 Author: Bruce Guenter Date: Thu Mar 20 19:22:01 2003 +0000 Merged the includes of into one place. sys/direntry.h1 | 1 - sys/direntry.h2 | 1 - sys/haspeercred.h2 | 1 - sys/iopoll.h2 | 1 - sys/select.h1 | 1 - sys/select.h2 | 1 - sysdeps-head.h | 1 + 7 files changed, 1 insertion(+), 6 deletions(-) commit b774f94be658a93d20dc26dc5f2a5dc0695cf52a Author: Bruce Guenter Date: Thu Mar 20 17:25:19 2003 +0000 Portability fixes. selftests.sh | 36 ++++++++++++++++++++++++++++++------ selftests.spac | 2 +- 2 files changed, 31 insertions(+), 7 deletions(-) commit ff68c278d7a101f5469dc6adea5ae816ede3400d Author: Bruce Guenter Date: Thu Mar 20 17:24:52 2003 +0000 Added missing define. crypto/sha512a.h | 2 ++ 1 file changed, 2 insertions(+) commit 92f1a3f6194199cca07d3f6dfb63d7a77b1c5b50 Author: Bruce Guenter Date: Thu Mar 20 17:23:12 2003 +0000 Added SHA-1 test vectors, parsed from the FIPS reference document. crypto/sha1test.c | 490 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 490 insertions(+) create mode 100644 crypto/sha1test.c commit 1c0195d78e5e6a128a56b58612f2cb7142f9ac55 Author: Bruce Guenter Date: Thu Mar 20 17:22:32 2003 +0000 Added MD4 code and tests. crypto/lib=l | 1 + crypto/md4-test.c | 43 ++++++ crypto/md4.c | 366 ++++++++++++++++++++++++++++++++++++++++++++++++ crypto/{md5.h => md4.h} | 75 ++++------ 4 files changed, 436 insertions(+), 49 deletions(-) create mode 100644 crypto/md4-test.c create mode 100644 crypto/md4.c copy crypto/{md5.h => md4.h} (63%) commit 37e234b19f8d59d11e721a3d7f166c747be64098 Author: Bruce Guenter Date: Thu Mar 20 17:22:06 2003 +0000 Fixed up these tests so the selftest system would run them. crypto/md5-test.c | 13 +++++++ crypto/sha256test.c | 102 +++++++++++++------------------------------------- crypto/sha512a-test.c | 102 ++++++++++++-------------------------------------- 3 files changed, 61 insertions(+), 156 deletions(-) commit daec8389b9a32c1761ebea3e99938e763cac8bd3 Author: Bruce Guenter Date: Thu Mar 20 17:21:24 2003 +0000 Fixed typo in endian detection test. crypto/sha1.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) commit 97398ad89d6121ca00c21b94a51b66ca387d4e2a Author: Bruce Guenter Date: Thu Mar 20 17:20:46 2003 +0000 Bumped up version number. NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit 92ed7e59e572f7a157eb14372232e59892cde10a Author: Bruce Guenter Date: Wed Mar 19 23:00:22 2003 +0000 Added missing (assumed) library. selftests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 82f430e37534ffa2b405669198a0409b062477e0 Author: Bruce Guenter Date: Wed Mar 19 22:46:19 2003 +0000 Some portability and cleanliness fixes. selftests.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) commit 813cc450e71c531598394dcf56ea59149a40a17e Author: Bruce Guenter Date: Wed Mar 19 22:35:38 2003 +0000 Fixed up selftests target so it gets properly included in distributed tarball. selftests.spac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit c02fdf8ae12dfb774eb1f04f4f2cef4c3b4fba63 Author: Bruce Guenter Date: Wed Mar 19 22:27:01 2003 +0000 Rewrote the test cases to make adding more cases easier. crc/crc16_xmodem_update.c | 3 +-- crc/crc64_update.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) commit 82f52a1bd2bee5035bf004a3352f8be88d37390a Author: Bruce Guenter Date: Wed Mar 19 22:26:43 2003 +0000 Added more test cases gleaned from the web. Still looking for more XMODEM CRC test cases. crc/crc16_arc_update.c | 9 +++++++-- crc/crc16_ccitt_update.c | 23 +++++++++++++++++++++-- crc/crc32_update.c | 31 +++++++++++++++++++++++++++++-- 3 files changed, 57 insertions(+), 6 deletions(-) commit d8744fed163743b497ae3a35662983b3fa336271 Author: Bruce Guenter Date: Wed Mar 19 22:25:43 2003 +0000 Fixed wrong polynomial value for XMODEM CRC. crc/crc16_xmodem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 0bceaf967da35db976e615d8fba1fa071e416078 Author: Bruce Guenter Date: Tue Mar 18 22:19:07 2003 +0000 Added tests to check the mmap bug in iobuf_init. iobuf/iobuf_init.c | 20 ++++++++++++++++++++ selftest.c | 7 +++++++ 2 files changed, 27 insertions(+) commit 35b1d57977d819451009ad6533628c6688a4acc0 Author: Bruce Guenter Date: Tue Mar 18 20:07:24 2003 +0000 Added self-tests for CRC routines. I only have confirmation on the ARC and CRC32 check codes from external sources. The other three (CCITT, XMODEM, and CRC64) may be suspect. crc/crc16_arc_update.c | 12 ++++++++++++ crc/crc16_ccitt_update.c | 12 ++++++++++++ crc/crc16_xmodem_update.c | 12 ++++++++++++ crc/crc32_update.c | 12 ++++++++++++ crc/crc64_update.c | 12 ++++++++++++ 5 files changed, 60 insertions(+) commit 1a03e24c1fc2b24620212b1fc3e36f85b64fcffd Author: Bruce Guenter Date: Tue Mar 18 17:07:32 2003 +0000 Using a while loop made $exitcode a local variable, preventing a proper error exit when one test failed. selftests.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) commit 4df7a2014796645f7a6a4920a7715065fad0e873 Author: Bruce Guenter Date: Tue Mar 18 17:03:16 2003 +0000 Added prototype and lib entry for common obuf_sign_pad function. iobuf/iobuf.h | 1 + iobuf/lib=l | 1 + 2 files changed, 2 insertions(+) commit e107ecf4e0362ee4deab04c4385ab64efee4a9d1 Author: Bruce Guenter Date: Tue Mar 18 17:02:49 2003 +0000 Removed old self test files. err/test.c | 11 ----------- err/test=x | 2 -- iobuf/test.c | 27 --------------------------- iobuf/test.exp | 14 -------------- iobuf/test=x | 1 - msg/test.c | 11 ----------- msg/test=x | 2 -- path/test.c | 28 ---------------------------- path/test.exp | 8 -------- path/test=x | 4 ---- str/test.c | 32 -------------------------------- str/test.exp | 11 ----------- str/test=x | 1 - 13 files changed, 152 deletions(-) delete mode 100644 err/test.c delete mode 100644 err/test=x delete mode 100644 iobuf/test.c delete mode 100644 iobuf/test.exp delete mode 100644 iobuf/test=x delete mode 100644 msg/test.c delete mode 100644 msg/test=x delete mode 100644 path/test.c delete mode 100644 path/test.exp delete mode 100644 path/test=x delete mode 100644 str/test.c delete mode 100644 str/test.exp delete mode 100644 str/test=x commit d5e7431450e642c42619aafd15f23b2baacee2d1 Author: Bruce Guenter Date: Tue Mar 18 17:01:52 2003 +0000 Added initial tests; fixed some new bugs in iobuf/obuf_put*numw.c iobuf/obuf_put2s.c | 15 +++++++++++++++ iobuf/obuf_put3s.c | 17 +++++++++++++++++ iobuf/obuf_put4s.c | 19 +++++++++++++++++++ iobuf/obuf_put5s.c | 21 +++++++++++++++++++++ iobuf/obuf_put6s.c | 23 +++++++++++++++++++++++ iobuf/obuf_put7s.c | 25 +++++++++++++++++++++++++ iobuf/obuf_putsllnumw.c | 50 ++++++++++++++++++++++++++++++++++++------------- iobuf/obuf_putsnumw.c | 34 ++++++++++++++++++++++----------- iobuf/obuf_putullnumw.c | 45 ++++++++++++++++++++++++++++++++++++++------ iobuf/obuf_putunumw.c | 35 ++++++++++++++++++++++++++++++---- iobuf/obuf_sign_pad.c | 31 ++++++++++++++++++++++++++++++ iobuf/obuf_write.c | 21 +++++++++++++++++++++ msg/common.c | 13 +++++++++++++ path/merge.c | 31 ++++++++++++++++++++++++++++++ str/alloc.c | 24 ++++++++++++++++++++++++ str/cat2s.c | 13 +++++++++++++ str/cat3s.c | 13 +++++++++++++ str/cat4s.c | 13 +++++++++++++ str/cat5s.c | 13 +++++++++++++ str/cat6s.c | 13 +++++++++++++ str/copy.c | 16 ++++++++++++++++ str/copy2s.c | 12 ++++++++++++ str/copy3s.c | 12 ++++++++++++ str/copy4s.c | 12 ++++++++++++ str/copy5s.c | 12 ++++++++++++ str/copy6s.c | 12 ++++++++++++ str/findnext.c | 18 ++++++++++++++++++ str/findnextof.c | 18 ++++++++++++++++++ str/findprev.c | 20 ++++++++++++++++++++ str/findprevof.c | 21 +++++++++++++++++++++ str/free.c | 16 ++++++++++++++++ str/init.c | 12 ++++++++++++ 32 files changed, 616 insertions(+), 34 deletions(-) create mode 100644 iobuf/obuf_sign_pad.c commit 8f5c90d21324325a56b15283746bf4a45c8ec561 Author: Bruce Guenter Date: Tue Mar 18 16:58:21 2003 +0000 Added missing SPAC files to repository. installer.spac | 3 +++ instcheck.spac | 3 +++ instshow.spac | 3 +++ 3 files changed, 9 insertions(+) create mode 100644 installer.spac create mode 100644 instcheck.spac create mode 100644 instshow.spac commit 97c8edd65a3e934b3b1c0f4a9ed4e90748a5decb Author: Bruce Guenter Date: Tue Mar 18 16:57:57 2003 +0000 Started building up self-test framework. all.spac | 2 +- selftest.c | 40 ++++++++++++++++++++++++++++++++++++++++ selftests.sh | 29 +++++++++++++++++++++++++++++ selftests.spac | 2 ++ 4 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 selftest.c create mode 100644 selftests.sh create mode 100644 selftests.spac commit 0e4de1bdff8ec75a7826e1467195b004fc7f7ed8 Author: Bruce Guenter Date: Mon Mar 17 23:56:08 2003 +0000 Added note about CRC generation. TODO | 4 ++++ 1 file changed, 4 insertions(+) commit f05eba66898947bfaf673dabb7141fc868b298cf Author: Bruce Guenter Date: Mon Mar 17 23:28:50 2003 +0000 Added generic number appending routines to str. NEWS | 3 ++- str/catiw.c | 41 +++++++++-------------------------------- str/catiwll.c | 40 +++++++++------------------------------- str/{catiwll.c => catsllnum.c} | 19 ++++++++++--------- str/{catiw.c => catsnum.c} | 18 +++++++++--------- str/{catuwll.c => catullnum.c} | 19 ++++++++++--------- str/{catuw.c => catunum.c} | 18 +++++++++--------- str/catuw.c | 28 ++++++++-------------------- str/catuwll.c | 31 ++++++++++--------------------- str/catxw.c | 30 ++++++++---------------------- str/{findnext.c => catxwll.c} | 22 ++++++++++++---------- str/digits.c | 7 +++++++ str/lib=l | 6 ++++++ str/str.h | 26 +++++++++++++++++++++----- 14 files changed, 130 insertions(+), 178 deletions(-) copy str/{catiwll.c => catsllnum.c} (74%) copy str/{catiw.c => catsnum.c} (75%) copy str/{catuwll.c => catullnum.c} (69%) copy str/{catuw.c => catunum.c} (70%) copy str/{findnext.c => catxwll.c} (59%) create mode 100644 str/digits.c commit 637185658fa0181674c56180166e87ec4ea1a72e Author: Bruce Guenter Date: Mon Mar 17 21:09:01 2003 +0000 Added some documentation notes, and merged the digit strings. iobuf/iobuf.h | 4 ++++ iobuf/lib=l | 1 + iobuf/obuf_digits.c | 5 +++++ iobuf/obuf_putsllnumw.c | 10 +++++----- iobuf/obuf_putsnumw.c | 8 ++++---- iobuf/obuf_putullnumw.c | 32 +++++++++++++++++++------------- iobuf/obuf_putunumw.c | 26 ++++++++++++++------------ 7 files changed, 52 insertions(+), 34 deletions(-) create mode 100644 iobuf/obuf_digits.c commit 5af764100d18ec6d1998cff2f8b3c54fd764b25e Author: Bruce Guenter Date: Mon Mar 17 20:31:09 2003 +0000 Added generic number output routines, replacing the existing specific ones. NEWS | 2 ++ iobuf/iobuf.h | 24 ++++++++++--- iobuf/lib=l | 9 +++-- iobuf/obuf_putiwll.c | 42 ---------------------- iobuf/obuf_putsllnumw.c | 60 +++++++++++++++++++++++++++++++ iobuf/{obuf_putiw.c => obuf_putsnumw.c} | 31 +++++++++++----- iobuf/obuf_putullnumw.c | 64 +++++++++++++++++++++++++++++++++ iobuf/obuf_putunumw.c | 62 ++++++++++++++++++++++++++++++++ iobuf/obuf_putuw.c | 24 ------------- iobuf/obuf_putuwll.c | 25 ------------- iobuf/obuf_putxw.c | 27 -------------- 11 files changed, 234 insertions(+), 136 deletions(-) delete mode 100644 iobuf/obuf_putiwll.c create mode 100644 iobuf/obuf_putsllnumw.c rename iobuf/{obuf_putiw.c => obuf_putsnumw.c} (54%) create mode 100644 iobuf/obuf_putullnumw.c create mode 100644 iobuf/obuf_putunumw.c delete mode 100644 iobuf/obuf_putuw.c delete mode 100644 iobuf/obuf_putuwll.c delete mode 100644 iobuf/obuf_putxw.c commit 25afa6edcc43e523b840b16eb7957407aa30b195 Author: Bruce Guenter Date: Fri Mar 14 20:40:28 2003 +0000 Added 3 16-bit CRC functions. NEWS | 2 ++ crc/crc16_arc.h | 14 ++++++++++++++ crc/crc16_arc_update.c | 9 +++++++++ crc/crc16_ccitt.h | 14 ++++++++++++++ crc/crc16_ccitt_update.c | 9 +++++++++ crc/crc16_xmodem.h | 14 ++++++++++++++ crc/crc16_xmodem_update.c | 9 +++++++++ crc/lib=l | 6 ++++++ 8 files changed, 77 insertions(+) create mode 100644 crc/crc16_arc.h create mode 100644 crc/crc16_arc_update.c create mode 100644 crc/crc16_ccitt.h create mode 100644 crc/crc16_ccitt_update.c create mode 100644 crc/crc16_xmodem.h create mode 100644 crc/crc16_xmodem_update.c commit 20a282648c705b6995a42ac9e420d644882ffcae Author: Bruce Guenter Date: Fri Mar 14 20:40:08 2003 +0000 Fixed some minor bugs, mostly related to 16-bit usage. crc/gentab.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) commit 7feac98299e46b7d35518974e46a7f4338f0b444 Author: Bruce Guenter Date: Fri Mar 14 20:38:25 2003 +0000 Added missing note about 64-bit CRC changes. NEWS | 3 +++ 1 file changed, 3 insertions(+) commit 2d2d4081dc2dacb47fbf68b278ef54be5f87027e Author: Bruce Guenter Date: Fri Mar 14 20:18:46 2003 +0000 Removed the (now) unneeded build rules. load.spac | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 load.spac commit 7a85382b76be0a827a66e031721876fa91dc645e Author: Bruce Guenter Date: Fri Mar 14 20:07:27 2003 +0000 Switched the 64-bit CRC code from a "reversed" to a "normal" algorithm. crc/crc64_update.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 68d30a3e24d661b0da82b9c4ba2ddc81a1b9f70e Author: Bruce Guenter Date: Fri Mar 14 20:06:45 2003 +0000 Added CRC##POST and crc##_block definitions. crc/crc32.h | 3 +++ crc/crc64.h | 1 + 2 files changed, 4 insertions(+) commit ab788b0e87f22583eb8b6994c9ace69d751f989e Author: Bruce Guenter Date: Fri Mar 14 20:04:32 2003 +0000 Switched the polynomial to something more useful looking, first seen in the PostgreSQL code, taken in turn from the DLT1 spec (ECMA-182). crc/crc64.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) commit 48014b4a7bf9c9ade7783e0814230490941821cc Author: Bruce Guenter Date: Fri Mar 14 20:00:44 2003 +0000 Expanded the code to allow for normal and reversed generators. crc/gentab.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 69 insertions(+), 21 deletions(-) commit 35cdba285220782b782dac3b4fd240fbea766ac5 Author: Bruce Guenter Date: Sun Mar 9 02:45:58 2003 +0000 Fixed bug in parameters to mmap in iobuf_init. NEWS | 2 ++ iobuf/iobuf_init.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) commit f5cb0ef7dd24ca8ab286ebed71d3bd6078a5f647 Author: Bruce Guenter Date: Sun Mar 9 02:44:04 2003 +0000 Bumped up version. NEWS | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) commit e2f640c2537b4904e24c99f1de60c987733a76a4 Author: Bruce Guenter Date: Wed Mar 5 23:21:51 2003 +0000 Don't copy the documentation until SPAC makedist knows how. makedist.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 915badfd3694a183bf13049c644b0987fb705615 Author: Bruce Guenter Date: Wed Mar 5 22:30:06 2003 +0000 Reorganized the installed library (again). insthier.c | 109 +++++++++++++++++----------------------- libsysdeps=l => libbg-sysdeps=l | 0 2 files changed, 46 insertions(+), 63 deletions(-) rename libsysdeps=l => libbg-sysdeps=l (100%) commit c49aa5dc8ccaf821fe6c5d43ea6026e968b175e5 Author: Bruce Guenter Date: Wed Mar 5 22:29:02 2003 +0000 Add the documentation to the web site. makedist.py | 1 + 1 file changed, 1 insertion(+) commit 668de4a5ff5b9d5fd27919107fbb76a44742715e Author: Bruce Guenter Date: Wed Mar 5 22:26:43 2003 +0000 More notes. TODO | 5 +++++ 1 file changed, 5 insertions(+) commit 8453d1aac2e372452e0f4dbc8a5030c47310ea76 Author: Bruce Guenter Date: Wed Mar 5 21:04:41 2003 +0000 Add the documentation to the resulting RPM (and comment on it). NEWS | 2 ++ spec | 1 + 2 files changed, 3 insertions(+) commit bf9fcbf6fa42d204f3f6657f493061801546dc0a Author: Bruce Guenter Date: Fri Feb 21 20:40:59 2003 +0000 Add random_trunc function, which truncates (with integer modulus) instead of scaling (with floating point divide and multiply) the base random number. misc/misc.h | 1 + 1 file changed, 1 insertion(+) commit a88f7ebf5200a7df1ac75591d94e1988d41995ee Author: Bruce Guenter Date: Fri Feb 21 20:39:48 2003 +0000 Avoid variable name conflict with "uint". vmailmgr/vpwentry_import.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) commit f0d80da28dbc7142ca0aec096e8adc967390e4f9 Author: Bruce Guenter Date: Tue Feb 11 15:36:58 2003 +0000 Added the "Mersenne Twister" random number generator MT19937. NEWS | 3 +- misc/lib=l | 1 + misc/misc.h | 6 +++ misc/random.c | 171 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 180 insertions(+), 1 deletion(-) create mode 100644 misc/random.c commit 7af33db8b4004d484e20218ed5501036a8277fde Author: Bruce Guenter Date: Tue Feb 11 00:01:57 2003 +0000 Added note about portability fixes. NEWS | 2 ++ 1 file changed, 2 insertions(+) commit 33f09e7c1eba2c0b5f33d974eda664e8fa1fc97e Author: Bruce Guenter Date: Tue Feb 11 00:00:44 2003 +0000 Added missing cvm and pwcmp symlinks. insthier.c | 6 ++++++ 1 file changed, 6 insertions(+) commit fbf5b9c1da353780074ca0129f80dd5f6b43664e Author: Bruce Guenter Date: Mon Feb 10 23:41:31 2003 +0000 Work on systems that don't define _NSIG unix/sig_all.c | 8 ++++++++ 1 file changed, 8 insertions(+) commit d68ec2788995c9d7f4a9b78e814c5de5fa033d35 Author: Bruce Guenter Date: Tue Feb 4 00:04:30 2003 +0000 Added a standard msg_debug_init function to allow setting msg_debug_bits at runtime from $MSG_DEBUG msg/debug.c | 9 +++++++++ msg/msg.h | 1 + 2 files changed, 10 insertions(+) commit 676d09895d506b23bc37d0cc063e84e76dd42d57 Author: Bruce Guenter Date: Mon Feb 3 23:53:59 2003 +0000 Remember to actually increment the slot pointer when probing. adt/ghash_get.c | 1 + 1 file changed, 1 insertion(+) commit f61b78518a157e32eecf928e7f9cde9e9a67a3b7 Author: Bruce Guenter Date: Mon Feb 3 23:52:28 2003 +0000 Added 32 and 64 bit CRC functions. NEWS | 2 ++ crc/crc32.h | 12 +++++++++ crc/crc32_update.c | 9 +++++++ crc/crc64.h | 13 ++++++++++ crc/crc64_update.c | 9 +++++++ crc/gentab.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ crc/lib=l | 4 +++ insthier.c | 6 +++++ 8 files changed, 129 insertions(+) create mode 100644 crc/crc32.h create mode 100644 crc/crc32_update.c create mode 100644 crc/crc64.h create mode 100644 crc/crc64_update.c create mode 100644 crc/gentab.c create mode 100644 crc/lib=l commit 0cc23ead39744ee511ee11b34054aa1bdce8cab6 Author: Bruce Guenter Date: Wed Jan 22 18:07:13 2003 +0000 Fixed a typo -- need to look at in->count, not ibuf.count. Thanks to Lars Uffmann for the fix. iobuf/ibuf_getstr_crlf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 58d67ff4f9d0926932b238e2b958ba8e31054347 Author: Bruce Guenter Date: Tue Jan 21 22:29:48 2003 +0000 Added new ADT (abstract data type): generic hash table. adt/ghash.h | 115 ++++++++++++++++++++++++++++++++++++++++++ dict/add.c => adt/ghash_add.c | 54 +++++++++++--------- adt/ghash_foreach.c | 10 ++++ adt/ghash_free.c | 27 ++++++++++ adt/ghash_get.c | 20 ++++++++ adt/ghash_hash.c | 17 +++++++ adt/ghash_init.c | 8 +++ adt/ghash_insert.c | 11 ++++ adt/ghash_rehash.c | 26 ++++++++++ adt/ghash_search.c | 12 +++++ adt/ghash_test.c | 53 +++++++++++++++++++ adt/lib=l | 9 ++++ insthier.c | 5 ++ 13 files changed, 343 insertions(+), 24 deletions(-) create mode 100644 adt/ghash.h copy dict/add.c => adt/ghash_add.c (66%) create mode 100644 adt/ghash_foreach.c create mode 100644 adt/ghash_free.c create mode 100644 adt/ghash_get.c create mode 100644 adt/ghash_hash.c create mode 100644 adt/ghash_init.c create mode 100644 adt/ghash_insert.c create mode 100644 adt/ghash_rehash.c create mode 100644 adt/ghash_search.c create mode 100644 adt/ghash_test.c create mode 100644 adt/lib=l commit d9014be863617765beeba0e6906547ff109d3644 Author: Bruce Guenter Date: Thu Jan 9 22:32:08 2003 +0000 Added Doxygen documentation to the iobuf library. config.dxy | 2 +- iobuf/ibuf_getc.c | 1 + iobuf/ibuf_gets.c | 1 + iobuf/ibuf_getstr.c | 3 +- iobuf/ibuf_getstr_crlf.c | 3 +- iobuf/ibuf_getu.c | 1 + iobuf/ibuf_init.c | 1 + iobuf/ibuf_open.c | 1 + iobuf/ibuf_peek.c | 2 + iobuf/ibuf_read.c | 12 ++++++ iobuf/ibuf_refill.c | 4 ++ iobuf/ibuf_seek.c | 1 + iobuf/ibuf_status.c | 1 + iobuf/ibuf_stdin.c | 1 + iobuf/ibuf_tell.c | 1 + iobuf/iobuf.h | 103 +++++++++++++++++++++++++++++++++++++++++----- iobuf/iobuf_close.c | 1 + iobuf/iobuf_copy.c | 3 ++ iobuf/iobuf_init.c | 2 + iobuf/iobuf_timeout.c | 1 + iobuf/obuf_close.c | 1 + iobuf/obuf_endl.c | 3 +- iobuf/obuf_flush.c | 1 + iobuf/obuf_init.c | 1 + iobuf/obuf_open.c | 1 + iobuf/obuf_pad.c | 1 + iobuf/obuf_put2s.c | 1 + iobuf/obuf_put3s.c | 1 + iobuf/obuf_put4s.c | 1 + iobuf/obuf_put5s.c | 1 + iobuf/obuf_put6s.c | 1 + iobuf/obuf_put7s.c | 1 + iobuf/obuf_putc.c | 1 + iobuf/obuf_putiw.c | 1 + iobuf/obuf_putiwll.c | 2 + iobuf/obuf_putnetstring.c | 1 + iobuf/obuf_putsflush.c | 1 + iobuf/obuf_putuw.c | 1 + iobuf/obuf_putuwll.c | 2 + iobuf/obuf_putxw.c | 2 + iobuf/obuf_seek.c | 1 + iobuf/obuf_stderr.c | 1 + iobuf/obuf_stdout.c | 1 + iobuf/obuf_sync.c | 1 + iobuf/obuf_write.c | 2 + 45 files changed, 161 insertions(+), 15 deletions(-) commit a493e75f9cfb9a3066ddd23f5d4e10989274dbed Author: Bruce Guenter Date: Wed Jan 8 17:13:25 2003 +0000 Added Doxygen documentation to the net library. config.dxy | 2 +- net/accept4.c | 3 ++- net/acceptu.c | 1 + net/bind4.c | 3 ++- net/bindu.c | 1 + net/broadcast.c | 1 + net/connect4.c | 3 ++- net/connected.c | 1 + net/connectu.c | 1 + net/cork.c | 11 +++++++++++ net/getaddr4.c | 3 ++- net/ipv4.h | 10 ++++++++++ net/ipv4_addr.c | 2 ++ net/ipv4_format.c | 5 +++++ net/ipv4_scan.c | 12 ++++++++++++ net/linger.c | 1 + net/listen.c | 1 + net/pairdgm.c | 1 + net/pairstr.c | 1 + net/recv4.c | 3 ++- net/recvfd.c | 1 + net/recvu.c | 1 + net/resolve.h | 10 ++++++++++ net/resolve_error.c | 1 + net/resolve_ipv4addr.c | 1 + net/resolve_ipv4name.c | 1 + net/reuse.c | 1 + net/send4.c | 3 ++- net/sendfd.c | 1 + net/sendu.c | 1 + net/shutdown.c | 1 + net/socket.h | 27 ++++++++++++++++++++++++--- net/tcp.c | 1 + net/udp.c | 1 + net/uncork.c | 1 + net/unixdgm.c | 1 + net/unixstr.c | 1 + 37 files changed, 110 insertions(+), 10 deletions(-) commit 6159ca5d688f00b31c43de9b5062b796ad900ccf Author: Bruce Guenter Date: Tue Jan 7 19:35:10 2003 +0000 Created initial Doxygen configuration. config.dxy | 921 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 921 insertions(+) create mode 100644 config.dxy commit 95d999f51066fb656e73fdeeb6ce966c5dfc654e Author: Bruce Guenter Date: Tue Jan 7 19:34:40 2003 +0000 Added some doxygen-style documentation to the str library. str/alloc.c | 10 +++++++++ str/buildmap.c | 6 +++++ str/cat.c | 4 ++++ str/cat2s.c | 1 + str/cat3s.c | 1 + str/cat4s.c | 1 + str/cat5s.c | 1 + str/cat6s.c | 1 + str/catiw.c | 2 ++ str/catiwll.c | 2 ++ str/catuw.c | 2 ++ str/catuwll.c | 2 ++ str/catxw.c | 2 ++ str/cmp.c | 9 ++++++++ str/copy.c | 3 +++ str/copy2s.c | 1 + str/copy3s.c | 1 + str/copy4s.c | 1 + str/copy5s.c | 1 + str/copy6s.c | 1 + str/count.c | 1 + str/countof.c | 1 + str/cut.c | 2 ++ str/diff.c | 10 +++++++++ str/findnext.c | 1 + str/findnextnot.c | 2 ++ str/findnextof.c | 2 ++ str/findprev.c | 1 + str/findprevnot.c | 2 ++ str/findprevof.c | 2 ++ str/free.c | 3 +++ str/init.c | 1 + str/iter.h | 23 +++++++++++++++++++ str/iter_advance.c | 1 + str/iter_start.c | 1 + str/iter_valid.c | 1 + str/join.c | 4 +++- str/lower.c | 1 + str/lstrip.c | 1 + str/match.c | 1 + str/rstrip.c | 1 + str/sort.c | 11 +++++++++ str/str.h | 66 +++++++++++++++++++++++++++++++++++++++++++++--------- str/subst.c | 1 + str/truncate.c | 7 ++++++ str/upper.c | 1 + 46 files changed, 189 insertions(+), 11 deletions(-) commit ba1f4be52cfdf6a1d99bc77f9bf4e7d26d4e8d21 Author: Bruce Guenter Date: Mon Jan 6 21:20:02 2003 +0000 Added 2003 to Copyright stamp. README.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 9a618a03c435bbafe040d758e59ae2f1405e3633 Author: Bruce Guenter Date: Fri Jan 3 19:46:29 2003 +0000 Fixed some remaining bugs in the install paths. insthier.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) commit d3ae65d40732080cbe7b56b9a4e10407c4322c9c Author: Bruce Guenter Date: Fri Jan 3 19:46:02 2003 +0000 Reflect the new path of trypoll.c in the hard-coded path. sys/trypoll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit b55e44ead638d0fd53ded7504d48a4c5eb10d326 Author: Bruce Guenter Date: Fri Jan 3 19:45:37 2003 +0000 Report the source filename, not the destination file name, when reporting a failure to open a file. install/installer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 6e3764fe327fc887f9854bbd9e3fbe0ec9b1b79a Author: Bruce Guenter Date: Fri Jan 3 18:03:07 2003 +0000 Added note about internal reorganizations. NEWS | 2 ++ 1 file changed, 2 insertions(+) commit 26596afc17d56e70c0e1242c60e28ea394920968 Author: Bruce Guenter Date: Fri Jan 3 18:02:31 2003 +0000 Moved all the uint16/32/64 source code into subdirectories. libsysdeps=l | 30 +++++++++++++++--------------- uint16_get.c => uint16/get.c | 0 uint16_pack.c => uint16/pack.c | 0 uint16_unpack.c => uint16/unpack.c | 0 uint32_get_lsb.c => uint32/get_lsb.c | 0 uint32_get_msb.c => uint32/get_msb.c | 0 uint32_pack_lsb.c => uint32/pack_lsb.c | 0 uint32_pack_msb.c => uint32/pack_msb.c | 0 uint32_unpack_lsb.c => uint32/unpack_lsb.c | 0 uint32_unpack_msb.c => uint32/unpack_msb.c | 0 uint64_get_lsb.c => uint64/get_lsb.c | 0 uint64_get_msb.c => uint64/get_msb.c | 0 uint64_pack_lsb.c => uint64/pack_lsb.c | 0 uint64_pack_msb.c => uint64/pack_msb.c | 0 uint64_unpack_lsb.c => uint64/unpack_lsb.c | 0 uint64_unpack_msb.c => uint64/unpack_msb.c | 0 16 files changed, 15 insertions(+), 15 deletions(-) rename uint16_get.c => uint16/get.c (100%) rename uint16_pack.c => uint16/pack.c (100%) rename uint16_unpack.c => uint16/unpack.c (100%) rename uint32_get_lsb.c => uint32/get_lsb.c (100%) rename uint32_get_msb.c => uint32/get_msb.c (100%) rename uint32_pack_lsb.c => uint32/pack_lsb.c (100%) rename uint32_pack_msb.c => uint32/pack_msb.c (100%) rename uint32_unpack_lsb.c => uint32/unpack_lsb.c (100%) rename uint32_unpack_msb.c => uint32/unpack_msb.c (100%) rename uint64_get_lsb.c => uint64/get_lsb.c (100%) rename uint64_get_msb.c => uint64/get_msb.c (100%) rename uint64_pack_lsb.c => uint64/pack_lsb.c (100%) rename uint64_pack_msb.c => uint64/pack_msb.c (100%) rename uint64_unpack_lsb.c => uint64/unpack_lsb.c (100%) rename uint64_unpack_msb.c => uint64/unpack_msb.c (100%) commit 7671a92e1241b8864751de5574759c84ed6a91e3 Author: Bruce Guenter Date: Fri Jan 3 17:58:53 2003 +0000 Moved system dependancy tests and headers into a "sys" subdirectory. direntry.h1 => sys/direntry.h1 | 0 direntry.h2 => sys/direntry.h2 | 0 endian.h1 => sys/endian.h1 | 0 endian.h2 => sys/endian.h2 | 0 fork.h1 => sys/fork.h1 | 0 fork.h2 => sys/fork.h2 | 0 hasflock.h1 => sys/hasflock.h1 | 0 hasflock.h2 => sys/hasflock.h2 | 0 haspeercred.h1 => sys/haspeercred.h1 | 0 haspeercred.h2 => sys/haspeercred.h2 | 0 hassendfile.h1 => sys/hassendfile.h1 | 0 hassendfile.h2 => sys/hassendfile.h2 | 0 hassgact.h1 => sys/hassgact.h1 | 0 hassgact.h2 => sys/hassgact.h2 | 0 hassgprm.h1 => sys/hassgprm.h1 | 0 hassgprm.h2 => sys/hassgprm.h2 | 0 hasspnam.h1 => sys/hasspnam.h1 | 0 hasspnam.h2 => sys/hasspnam.h2 | 0 hasuserpw.h1 => sys/hasuserpw.h1 | 0 hasuserpw.h2 => sys/hasuserpw.h2 | 0 haswaitp.h1 => sys/haswaitp.h1 | 0 haswaitp.h2 => sys/haswaitp.h2 | 0 haszlib.h1 => sys/haszlib.h1 | 0 haszlib.h2 => sys/haszlib.h2 | 0 iopoll.h1 => sys/iopoll.h1 | 0 iopoll.h2 => sys/iopoll.h2 | 0 select.h1 => sys/select.h1 | 0 select.h2 => sys/select.h2 | 0 setenv.h1 => sys/setenv.h1 | 0 setenv.h2 => sys/setenv.h2 | 0 trydirent.c => sys/trydirent.c | 0 tryendian.c => sys/tryendian.c | 0 tryflock.c => sys/tryflock.c | 0 trypeercred.c => sys/trypeercred.c | 0 trypoll.c => sys/trypoll.c | 0 trysendfile.c => sys/trysendfile.c | 0 trysetenv.c => sys/trysetenv.c | 0 trysgact.c => sys/trysgact.c | 0 trysgprm.c => sys/trysgprm.c | 0 tryspnam.c => sys/tryspnam.c | 0 trysysel.c => sys/trysysel.c | 0 trysystime.c => sys/trysystime.c | 0 trytime.c => sys/trytime.c | 0 tryulong32.c => sys/tryulong32.c | 0 tryulong64.c => sys/tryulong64.c | 0 tryunaligned.c => sys/tryunaligned.c | 0 tryunsetenv.c => sys/tryunsetenv.c | 0 tryuserpw.c => sys/tryuserpw.c | 0 tryvfork.c => sys/tryvfork.c | 0 trywaitp.c => sys/trywaitp.c | 0 tryzlib.c => sys/tryzlib.c | 0 uint32.h1 => sys/uint32.h1 | 0 uint32.h2 => sys/uint32.h2 | 0 uint64.h1 => sys/uint64.h1 | 0 uint64.h2 => sys/uint64.h2 | 0 unaligned.h1 => sys/unaligned.h1 | 0 unaligned.h2 => sys/unaligned.h2 | 0 unsetenv.h1 => sys/unsetenv.h1 | 0 unsetenv.h2 => sys/unsetenv.h2 | 0 sysdeps.h.spac | 60 ++++++++++++++++++------------------ 60 files changed, 30 insertions(+), 30 deletions(-) rename direntry.h1 => sys/direntry.h1 (100%) rename direntry.h2 => sys/direntry.h2 (100%) rename endian.h1 => sys/endian.h1 (100%) rename endian.h2 => sys/endian.h2 (100%) rename fork.h1 => sys/fork.h1 (100%) rename fork.h2 => sys/fork.h2 (100%) rename hasflock.h1 => sys/hasflock.h1 (100%) rename hasflock.h2 => sys/hasflock.h2 (100%) rename haspeercred.h1 => sys/haspeercred.h1 (100%) rename haspeercred.h2 => sys/haspeercred.h2 (100%) rename hassendfile.h1 => sys/hassendfile.h1 (100%) rename hassendfile.h2 => sys/hassendfile.h2 (100%) rename hassgact.h1 => sys/hassgact.h1 (100%) rename hassgact.h2 => sys/hassgact.h2 (100%) rename hassgprm.h1 => sys/hassgprm.h1 (100%) rename hassgprm.h2 => sys/hassgprm.h2 (100%) rename hasspnam.h1 => sys/hasspnam.h1 (100%) rename hasspnam.h2 => sys/hasspnam.h2 (100%) rename hasuserpw.h1 => sys/hasuserpw.h1 (100%) rename hasuserpw.h2 => sys/hasuserpw.h2 (100%) rename haswaitp.h1 => sys/haswaitp.h1 (100%) rename haswaitp.h2 => sys/haswaitp.h2 (100%) rename haszlib.h1 => sys/haszlib.h1 (100%) rename haszlib.h2 => sys/haszlib.h2 (100%) rename iopoll.h1 => sys/iopoll.h1 (100%) rename iopoll.h2 => sys/iopoll.h2 (100%) rename select.h1 => sys/select.h1 (100%) rename select.h2 => sys/select.h2 (100%) rename setenv.h1 => sys/setenv.h1 (100%) rename setenv.h2 => sys/setenv.h2 (100%) rename trydirent.c => sys/trydirent.c (100%) rename tryendian.c => sys/tryendian.c (100%) rename tryflock.c => sys/tryflock.c (100%) rename trypeercred.c => sys/trypeercred.c (100%) rename trypoll.c => sys/trypoll.c (100%) rename trysendfile.c => sys/trysendfile.c (100%) rename trysetenv.c => sys/trysetenv.c (100%) rename trysgact.c => sys/trysgact.c (100%) rename trysgprm.c => sys/trysgprm.c (100%) rename tryspnam.c => sys/tryspnam.c (100%) rename trysysel.c => sys/trysysel.c (100%) rename trysystime.c => sys/trysystime.c (100%) rename trytime.c => sys/trytime.c (100%) rename tryulong32.c => sys/tryulong32.c (100%) rename tryulong64.c => sys/tryulong64.c (100%) rename tryunaligned.c => sys/tryunaligned.c (100%) rename tryunsetenv.c => sys/tryunsetenv.c (100%) rename tryuserpw.c => sys/tryuserpw.c (100%) rename tryvfork.c => sys/tryvfork.c (100%) rename trywaitp.c => sys/trywaitp.c (100%) rename tryzlib.c => sys/tryzlib.c (100%) rename uint32.h1 => sys/uint32.h1 (100%) rename uint32.h2 => sys/uint32.h2 (100%) rename uint64.h1 => sys/uint64.h1 (100%) rename uint64.h2 => sys/uint64.h2 (100%) rename unaligned.h1 => sys/unaligned.h1 (100%) rename unaligned.h2 => sys/unaligned.h2 (100%) rename unsetenv.h1 => sys/unsetenv.h1 (100%) rename unsetenv.h2 => sys/unsetenv.h2 (100%) commit ce1676596d3dab020ddaa4581d1d40564d113454 Author: Bruce Guenter Date: Fri Jan 3 16:52:39 2003 +0000 Added str_catxw function. str/{catuwll.c => catxw.c} | 16 +++++++++------- str/lib=l | 1 + str/str.h | 2 ++ 3 files changed, 12 insertions(+), 7 deletions(-) copy str/{catuwll.c => catxw.c} (76%) commit 7f13ce268f1549046a433d7674d642172b3ba6f0 Author: Bruce Guenter Date: Tue Dec 31 22:51:13 2002 +0000 Moved library definition files back into their own subdirectories, to reduce clutter in the base directory. base64/lib=l | 6 +++++ cdb/lib=l | 8 +++++++ cli/lib=l | 1 + crypto/lib=l | 5 ++++ cvm-sasl/lib=l | 6 +++++ dict/lib=l | 9 ++++++++ installer.c => install/installer.c | 0 installer.h => install/installer.h | 0 libinstaller=l => install/installer=l | 0 instcheck.c => install/instcheck.c | 0 libinstcheck=l => install/instcheck=l | 0 instshow.c => install/instshow.c | 0 libinstshow=l => install/instshow=l | 0 insthier.c | 27 ++++++++++++++++------ iobuf/lib=l | 43 +++++++++++++++++++++++++++++++++++ libbase64=l | 6 ----- libcdb=l | 8 ------- libcli=l | 1 - libcrypto=l | 5 ---- libcvm-client=l | 5 ---- libcvm-command=l | 4 ---- libcvm-local=l | 5 ---- libcvm-sasl=l | 6 ----- libcvm-udp=l | 5 ---- libdict=l | 9 -------- libiobuf=l | 43 ----------------------------------- libmisc=l | 3 --- libmsg=l | 6 ----- libnet=l | 33 --------------------------- libpath=l | 5 ---- libpwcmp-module=l | 1 - libpwcmp=l | 2 -- libstr=l | 41 --------------------------------- libunix=l | 15 ------------ libvmailmgr=l | 7 ------ misc/lib=l | 3 +++ msg/lib=l | 6 +++++ net/lib=l | 33 +++++++++++++++++++++++++++ path/lib=l | 5 ++++ str/lib=l | 41 +++++++++++++++++++++++++++++++++ unix/lib=l | 15 ++++++++++++ vmailmgr/lib=l | 7 ++++++ 42 files changed, 208 insertions(+), 217 deletions(-) create mode 100644 base64/lib=l create mode 100644 cdb/lib=l create mode 100644 cli/lib=l create mode 100644 crypto/lib=l create mode 100644 cvm-sasl/lib=l create mode 100644 dict/lib=l rename installer.c => install/installer.c (100%) rename installer.h => install/installer.h (100%) rename libinstaller=l => install/installer=l (100%) rename instcheck.c => install/instcheck.c (100%) rename libinstcheck=l => install/instcheck=l (100%) rename instshow.c => install/instshow.c (100%) rename libinstshow=l => install/instshow=l (100%) create mode 100644 iobuf/lib=l delete mode 100644 libbase64=l delete mode 100644 libcdb=l delete mode 100644 libcli=l delete mode 100644 libcrypto=l delete mode 100644 libcvm-client=l delete mode 100644 libcvm-command=l delete mode 100644 libcvm-local=l delete mode 100644 libcvm-sasl=l delete mode 100644 libcvm-udp=l delete mode 100644 libdict=l delete mode 100644 libiobuf=l delete mode 100644 libmisc=l delete mode 100644 libmsg=l delete mode 100644 libnet=l delete mode 100644 libpath=l delete mode 100644 libpwcmp-module=l delete mode 100644 libpwcmp=l delete mode 100644 libstr=l delete mode 100644 libunix=l delete mode 100644 libvmailmgr=l create mode 100644 misc/lib=l create mode 100644 msg/lib=l create mode 100644 net/lib=l create mode 100644 path/lib=l create mode 100644 str/lib=l create mode 100644 unix/lib=l create mode 100644 vmailmgr/lib=l commit 1f7293bc3595c7a2f208a8f43e87a275e5f33175 Author: Bruce Guenter Date: Tue Dec 31 17:15:21 2002 +0000 Added obuf_putxw function for outputting hex numbers. iobuf/iobuf.h | 2 ++ iobuf/obuf_putxw.c | 25 +++++++++++++++++++++++++ libiobuf=l | 1 + 3 files changed, 28 insertions(+) create mode 100644 iobuf/obuf_putxw.c commit 1f90607801af1f52e7e67434ac0ed8bb857c208f Author: Bruce Guenter Date: Tue Dec 31 17:06:56 2002 +0000 Handle single-digit negative integers properly. iobuf/obuf_putiw.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) commit 41d8d9d8098f2bf249bcb6ddab6494114959f19b Author: Bruce Guenter Date: Tue Dec 31 04:56:26 2002 +0000 Replaced the str_ready and str_realloc functions with str_alloc and two #define wrappers. libstr=l | 3 +-- str/{realloc.c => alloc.c} | 23 ++++++++++++----------- str/ready.c | 37 ------------------------------------- str/str.h | 5 +++-- 4 files changed, 16 insertions(+), 52 deletions(-) rename str/{realloc.c => alloc.c} (64%) delete mode 100644 str/ready.c commit d7ca70320b028fb69cc80ea06dbf82c50db6d075 Author: Bruce Guenter Date: Tue Dec 31 04:55:36 2002 +0000 Prevent name clash with str type. net/ipv4.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) commit d2b868224ea7a402b991f2e5616b92d6b9c070c3 Author: Bruce Guenter Date: Tue Dec 31 04:49:09 2002 +0000 Protect additions against integer overflow. str/ready.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) commit 601f13f51e5dc3a9b592e0bcd093de3d7f49a437 Author: Bruce Guenter Date: Fri Dec 27 23:49:53 2002 +0000 Created new routine ipv4_scan; redefined ipv4_parse based on ipv4_scan. libnet=l | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit ce50b31c66e8d9f17e8400d91985e89bbdff8ab6 Author: Bruce Guenter Date: Fri Dec 27 23:49:14 2002 +0000 Created new routine ipv4_scan; redefined ipv4_parse based on ipv4_scan. net/ipv4.h | 1 + net/ipv4_parse.c | 35 ----------------------------------- net/ipv4_scan.c | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 35 deletions(-) delete mode 100644 net/ipv4_parse.c create mode 100644 net/ipv4_scan.c commit ccb422aeb8f41c312126c0327f78762e58397f25 Author: Bruce Guenter Date: Fri Dec 27 23:48:38 2002 +0000 Redefined ipv4addr and ipv4port in terms of uint8/16. net/ipv4.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) commit 70ae6f501eb172a16383bb2803565784be163017 Author: Bruce Guenter Date: Fri Dec 27 17:01:16 2002 +0000 Added note about ipv4addr change. NEWS | 4 ++++ 1 file changed, 4 insertions(+) commit 0c525aeb0081160151c6966fd54283a9d73121c5 Author: Bruce Guenter Date: Fri Dec 27 17:00:06 2002 +0000 Converted the ipv4addr typedef from just a char array to a struct. This makes it obvious when it's being passed by reference, and when it could be modified. Unfortunately, it also breaks source code compatibility with everything that uses it, but the breakages will be obvious. net/accept4.c | 4 ++-- net/bind4.c | 4 ++-- net/connect4.c | 4 ++-- net/getaddr4.c | 4 ++-- net/ipv4.h | 10 +++++----- net/ipv4_addr.c | 4 ++-- net/ipv4_format.c | 10 +++++----- net/ipv4_parse.c | 14 +++++++------- net/recv4.c | 4 ++-- net/resolve.h | 4 ++-- net/resolve_ipv4addr.c | 4 ++-- net/resolve_ipv4name.c | 6 +++--- net/send4.c | 4 ++-- net/socket.h | 12 ++++++------ 14 files changed, 44 insertions(+), 44 deletions(-) commit b6e75458baa7e3cb6cd69109d4f6b76243bc4bcf Author: Bruce Guenter Date: Fri Dec 27 16:53:51 2002 +0000 Use the correct header files for uint32 usage. cdb/cdb.h | 2 +- cdb/find.c | 1 + cdb/make.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) commit 8e8c55c937ab80ebb7cb23774f12a11af4b21c68 Author: Bruce Guenter Date: Fri Dec 27 16:52:35 2002 +0000 Make sure to install the uint16.h header file. insthier.c | 1 + 1 file changed, 1 insertion(+) commit d2fe5bd6cc244e6cbe2329786bae956bacd90d32 Author: Bruce Guenter Date: Fri Dec 27 16:52:08 2002 +0000 Use the sysdeps.h macros to conditionally compile only the necessary bits. uint16_get.c | 4 +++- uint16_pack.c | 4 ++++ uint16_unpack.c | 4 ++++ uint32_get_lsb.c | 2 ++ uint32_get_msb.c | 2 ++ uint32_pack_lsb.c | 2 ++ uint32_pack_msb.c | 2 ++ uint32_unpack_lsb.c | 2 ++ uint32_unpack_msb.c | 2 ++ uint64_get_lsb.c | 2 ++ uint64_get_msb.c | 4 +++- uint64_pack_lsb.c | 2 ++ uint64_pack_msb.c | 2 ++ uint64_unpack_lsb.c | 2 ++ uint64_unpack_msb.c | 4 +++- 15 files changed, 37 insertions(+), 3 deletions(-) commit 41204bb17db195b8ce72b9861249c349a233b0a1 Author: Bruce Guenter Date: Fri Dec 27 16:51:05 2002 +0000 Moved the uint32/64 function declarations into their own seperate headers. uint32.h | 10 ++++++++++ uint64.h | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100644 uint32.h create mode 100644 uint64.h commit a2d9fc2de86ab8ad48351059e80c4282b2ff40be Author: Bruce Guenter Date: Fri Dec 27 16:50:22 2002 +0000 Reformatted these headers for inclusion into the sysdeps.h header. uint32.h1 | 15 --------------- uint32.h2 | 15 --------------- uint64.h1 | 16 ---------------- uint64.h2 | 16 ---------------- 4 files changed, 62 deletions(-) commit 6f02a777f1b1d41a8679fa2670cc8c3ad27f2eaa Author: Bruce Guenter Date: Fri Dec 27 16:49:30 2002 +0000 Moved the uint32/64 typedefs into sysdeps.h header. uint32.h.spac | 2 -- uint64.h.spac | 3 --- 2 files changed, 5 deletions(-) delete mode 100644 uint32.h.spac delete mode 100644 uint64.h.spac commit 2bc478bbfd3f6cba64fe898e9c10ed8c90e9dd57 Author: Bruce Guenter Date: Fri Dec 27 16:48:51 2002 +0000 Switched to the standard UINTNN macros. uint16.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) commit 2cbf720bfbcdf177ee85aa1eea86b16fa6daee02 Author: Bruce Guenter Date: Fri Dec 27 16:47:34 2002 +0000 Added test to determine system's endian order. endian.h1 | 3 +++ endian.h2 | 3 +++ sysdeps.h.spac | 2 ++ tryendian.c | 4 ++++ 4 files changed, 12 insertions(+) create mode 100644 endian.h1 create mode 100644 endian.h2 create mode 100644 tryendian.c commit 7d7e4959e81f13ca945cdf0453e878900148c699 Author: Bruce Guenter Date: Fri Dec 27 16:46:34 2002 +0000 Moved the uint16/32/64 typedefs into the sysdeps.h header. sysdeps-head.h | 2 ++ sysdeps-tail.h | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ sysdeps.h.spac | 14 +++++++------- 3 files changed, 68 insertions(+), 7 deletions(-) create mode 100644 sysdeps-head.h create mode 100644 sysdeps-tail.h commit b8515afcdcab22f1d9670b4984c67281c9295b49 Author: Bruce Guenter Date: Tue Dec 24 07:34:35 2002 +0000 Added uint 16/32/64 get functions, like unpack but return the result. libsysdeps=l | 5 +++++ uint16.h | 3 +++ uint16_get.c | 14 ++++++++++++++ uint32.h1 | 3 +++ uint32.h2 | 3 +++ uint32_unpack_lsb.c => uint32_get_lsb.c | 4 ++-- uint32_unpack_msb.c => uint32_get_msb.c | 4 ++-- uint64.h1 | 3 +++ uint64.h2 | 3 +++ uint64_unpack_lsb.c => uint64_get_lsb.c | 6 +++--- uint64_unpack_msb.c => uint64_get_msb.c | 6 +++--- 11 files changed, 44 insertions(+), 10 deletions(-) create mode 100644 uint16_get.c copy uint32_unpack_lsb.c => uint32_get_lsb.c (63%) copy uint32_unpack_msb.c => uint32_get_msb.c (63%) copy uint64_unpack_lsb.c => uint64_get_lsb.c (83%) copy uint64_unpack_msb.c => uint64_get_msb.c (83%) commit bcdbb0659a1923517a5d822afdbd49862c3c103a Author: Bruce Guenter Date: Tue Dec 24 07:29:06 2002 +0000 Move the uint## includes to the end, to allow them to take advantage of the unaligned definition; fixed typo in tryunaligned choice. sysdeps.h.spac | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) commit 7f71b21df5e3de42ebbad98436d02ad9bcf7a8d5 Author: Bruce Guenter Date: Tue Dec 24 07:21:40 2002 +0000 Added a test for unaligned accesses, to speed up uint## get/put operations. sysdeps.h.spac | 2 ++ tryunaligned.c | 17 +++++++++++++++++ unaligned.h1 | 2 ++ unaligned.h2 | 2 ++ 4 files changed, 23 insertions(+) create mode 100644 tryunaligned.c create mode 100644 unaligned.h1 create mode 100644 unaligned.h2 commit 33640204bc6a22c90d2cdba9f08f0ecd93030afe Author: Bruce Guenter Date: Tue Dec 24 06:25:23 2002 +0000 Packed uint64 values are 8 bytes, not 4. uint64.h1 | 8 ++++---- uint64.h2 | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) commit ccdef007956f11f6d382764a59f448fb8eafdd33 Author: Bruce Guenter Date: Tue Dec 24 06:25:00 2002 +0000 Change prototypes to reflect that packed uint16 values are two bytes. uint16.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) commit b6365db55422f32944ad6b9fbf755964d730ec6f Author: Bruce Guenter Date: Sat Dec 21 06:11:28 2002 +0000 Added note about pack/unpack functions. NEWS | 2 ++ 1 file changed, 2 insertions(+) commit e842ba0adcbc374d27834971d9d4e3fb81f0b868 Author: Bruce Guenter Date: Sat Dec 21 06:11:14 2002 +0000 Bumped version to 1.006 NEWS | 5 +++++ VERSION | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) commit fa4ccc5634413cda826329fa0df44a5b2b41b3d4 Author: Bruce Guenter Date: Sat Dec 21 06:07:24 2002 +0000 Don't both include uint32/64.h and run the same test as generates them. sysdeps.h.spac | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) commit a13b99b1163ca49da04af7b951bf42cec27d1379 Author: Bruce Guenter Date: Sat Dec 21 06:04:04 2002 +0000 Added uint16 prototype and pack/unpack functions. libsysdeps=l | 2 ++ uint16.h | 13 +++++++++++++ uint16_pack.c | 13 +++++++++++++ uint16_unpack.c | 11 +++++++++++ 4 files changed, 39 insertions(+) create mode 100644 uint16.h create mode 100644 uint16_pack.c create mode 100644 uint16_unpack.c commit 8dc57072a1fc82aa6845507aba191840a59e9714 Author: Bruce Guenter Date: Sat Dec 21 05:19:20 2002 +0000 Use the built-in (to libsysdeps.a) uint32 pack/unpack functions. cdb/find.c | 2 -- cdb/make.c | 14 ++++++-------- cdb/uint32_pack.c | 21 --------------------- cdb/uint32_unpack.c | 31 ------------------------------- libcdb=l | 2 -- 5 files changed, 6 insertions(+), 64 deletions(-) delete mode 100644 cdb/uint32_pack.c delete mode 100644 cdb/uint32_unpack.c commit f51c2d7a6568ebc3fc159fbeecb3f2a3fbfb51d3 Author: Bruce Guenter Date: Sat Dec 21 05:15:06 2002 +0000 Use the right operator -- && (logical and) should have been & (bitwise) uint32_pack_lsb.c | 2 +- uint32_pack_msb.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) commit 650863fdad1d677cbf04ea630cb2df23e6e945af Author: Bruce Guenter Date: Sat Dec 21 05:14:33 2002 +0000 Use the right implementation of uint64 pack/unpack this time, instead of the editor glitch. uint64_pack_lsb.c | 58 +++++++++++++++++++++++++++---------------------------- uint64_pack_msb.c | 21 ++++++++++++++++++++ 2 files changed, 50 insertions(+), 29 deletions(-) commit de68cd52f8d402985ad14df0ca8819e0cf20649d Author: Bruce Guenter Date: Sat Dec 21 05:10:22 2002 +0000 Added uin64 pack/unpack functions. libsysdeps=l | 4 ++++ uint64.h1 | 8 ++++++++ uint64.h2 | 8 ++++++++ uint64_pack_lsb.c | 41 +++++++++++++++++++++++++++++++++++++++++ uint64_pack_msb.c | 20 ++++++++++++++++++++ uint64_unpack_lsb.c | 43 +++++++++++++++++++++++++++++++++++++++++++ uint64_unpack_msb.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 167 insertions(+) create mode 100644 uint64_pack_lsb.c create mode 100644 uint64_pack_msb.c create mode 100644 uint64_unpack_lsb.c create mode 100644 uint64_unpack_msb.c commit 5ccad1177b77900dd4a6f6cdad04b0f4dd6627fc Author: Bruce Guenter Date: Fri Dec 20 23:05:54 2002 +0000 Added uint32 pack/unpack functions. libsysdeps=l | 4 ++++ uint32.h1 | 7 +++++++ uint32.h2 | 7 +++++++ uint32_pack_lsb.c | 12 ++++++++++++ uint32_pack_msb.c | 12 ++++++++++++ uint32_unpack_lsb.c | 14 ++++++++++++++ uint32_unpack_msb.c | 14 ++++++++++++++ 7 files changed, 70 insertions(+) create mode 100644 uint32_pack_lsb.c create mode 100644 uint32_pack_msb.c create mode 100644 uint32_unpack_lsb.c create mode 100644 uint32_unpack_msb.c commit 20906e151e425e2d86c8c36571579284ae2bdbe0 Author: Bruce Guenter Date: Tue Dec 17 23:25:39 2002 +0000 Don't avoid building the sysdeps.h target. spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 2bebf4f0a344b134057d6f722a6f272f6b47be48 Author: Bruce Guenter Date: Tue Dec 17 23:23:23 2002 +0000 Added a manual sysdeps.h dependancy to make sure it gets built first. all.spac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit d6c23e861c0e872eb3d93212042d9290a6b2b27b Author: Bruce Guenter Date: Tue Dec 17 23:10:45 2002 +0000 Added ChangeLog to the list of web-installed files. makedist.py | 1 + 1 file changed, 1 insertion(+) commit beb6406eb4b2e03e34a95d0d64a659ef8f39925a Author: Bruce Guenter Date: Tue Dec 17 22:44:41 2002 +0000 Added note about new lib structure. NEWS | 2 ++ 1 file changed, 2 insertions(+) commit 624d740adfc6a17ce26827b67a33047e64100c44 Author: Bruce Guenter Date: Tue Dec 17 22:44:25 2002 +0000 Switched to a templated README. README => README.in | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) rename README => README.in (77%) commit cfb001922527daa6a6ed6af48414a700a22017fd Author: Bruce Guenter Date: Tue Dec 17 22:38:23 2002 +0000 Bumped version to 1.005, just for kicks. NEWS | 2 +- VERSION | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) commit 1996066bc94779009199eabc878934cf3c720077 Author: Bruce Guenter Date: Tue Dec 17 22:25:09 2002 +0000 Flattened out the lib directory structure, adding symlinks for compatibility where necessary. base64/base64=l | 6 ---- cdb/cdb=l | 5 --- cdb/make=l | 3 -- cdb/str=l | 2 -- cli/cli=l | 1 - crypto/md5=l | 2 -- crypto/sha1=l | 1 - crypto/sha256=l | 1 - crypto/sha512a=l | 1 - cvm-sasl/cvm-sasl=l | 6 ---- dict/dict=l | 7 ---- dict/load=l | 2 -- insthier.c | 92 +++++++++++++++++++++++++++++++++-------------------- iobuf/iobuf=l | 40 ----------------------- iobuf/str=l | 2 -- libbase64=l | 6 ++++ libcdb=l | 10 ++++++ libcli=l | 1 + libcrypto=l | 5 +++ libcvm-client=l | 5 +++ libcvm-command=l | 4 +++ libcvm-local=l | 5 +++ libcvm-sasl=l | 6 ++++ libcvm-udp=l | 5 +++ libdict=l | 9 ++++++ libiobuf=l | 42 ++++++++++++++++++++++++ libmisc=l | 3 ++ libmsg=l | 6 ++++ libnet=l | 33 +++++++++++++++++++ libpath=l | 5 +++ libpwcmp-module=l | 1 + libpwcmp=l | 2 ++ libstr=l | 42 ++++++++++++++++++++++++ libunix=l | 15 +++++++++ libvmailmgr=l | 7 ++++ misc/misc=l | 3 -- msg/msg=l | 5 --- msg/wrap=l | 1 - net/ipv4=l | 3 -- net/resolve=l | 3 -- net/socket=l | 27 ---------------- path/path=l | 5 --- str/iter=l | 3 -- str/str=l | 39 ----------------------- unix/nonblock=l | 2 -- unix/sig=l | 13 -------- vmailmgr/client=l | 4 --- vmailmgr/vpwentry=l | 3 -- 48 files changed, 269 insertions(+), 225 deletions(-) delete mode 100644 base64/base64=l delete mode 100644 cdb/cdb=l delete mode 100644 cdb/make=l delete mode 100644 cdb/str=l delete mode 100644 cli/cli=l delete mode 100644 crypto/md5=l delete mode 100644 crypto/sha1=l delete mode 100644 crypto/sha256=l delete mode 100644 crypto/sha512a=l delete mode 100644 cvm-sasl/cvm-sasl=l delete mode 100644 dict/dict=l delete mode 100644 dict/load=l delete mode 100644 iobuf/iobuf=l delete mode 100644 iobuf/str=l create mode 100644 libbase64=l create mode 100644 libcdb=l create mode 100644 libcli=l create mode 100644 libcrypto=l create mode 100644 libcvm-client=l create mode 100644 libcvm-command=l create mode 100644 libcvm-local=l create mode 100644 libcvm-sasl=l create mode 100644 libcvm-udp=l create mode 100644 libdict=l create mode 100644 libiobuf=l create mode 100644 libmisc=l create mode 100644 libmsg=l create mode 100644 libnet=l create mode 100644 libpath=l create mode 100644 libpwcmp-module=l create mode 100644 libpwcmp=l create mode 100644 libstr=l create mode 100644 libunix=l create mode 100644 libvmailmgr=l delete mode 100644 misc/misc=l delete mode 100644 msg/msg=l delete mode 100644 msg/wrap=l delete mode 100644 net/ipv4=l delete mode 100644 net/resolve=l delete mode 100644 net/socket=l delete mode 100644 path/path=l delete mode 100644 str/iter=l delete mode 100644 str/str=l delete mode 100644 unix/nonblock=l delete mode 100644 unix/sig=l delete mode 100644 vmailmgr/client=l delete mode 100644 vmailmgr/vpwentry=l commit 33d6da59eb8324008ee9539f533512623ea6449a Author: Bruce Guenter Date: Tue Dec 17 20:37:46 2002 +0000 Start reorganizing how libraries are installed. insthier.c | 90 ++++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 50 insertions(+), 40 deletions(-) commit cf8623fb4c61147bedd772967ebf5bedfe481347 Author: Bruce Guenter Date: Tue Dec 17 20:36:56 2002 +0000 Make sure to add "." as a library path. load.spac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit af436f26bd572f2c9019ac1bf1819d0301d36ff0 Author: Bruce Guenter Date: Tue Dec 17 20:15:47 2002 +0000 Eliminated another shadowed global variable. iobuf/iobuf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit efee6bcabcb302b4e791c8ca490330ce8234178e Author: Bruce Guenter Date: Tue Dec 17 20:11:13 2002 +0000 Removed unused directory. commit 245f1cddd101d7ad1ad50ab721a86209d4503e3f Author: Bruce Guenter Date: Tue Dec 17 16:54:41 2002 +0000 Remove symlinks before creating them so existing ones can be recreated. installer.c | 1 + 1 file changed, 1 insertion(+) commit 9303a20f97e6b5440085c4d0e30ec611e1ef496d Author: Bruce Guenter Date: Sat Dec 14 20:56:58 2002 +0000 Fixed the shadowed global variable naming conflicts. NEWS | 2 ++ net/recvfd.c | 4 ++-- path/fnmatch.c | 4 ++-- path/path.h | 2 +- str/iter.h | 2 +- str/iter_start.c | 10 +++++----- unix/sig_block.c | 12 ++++++------ 7 files changed, 19 insertions(+), 17 deletions(-) commit 61a9d8559814c531b3be3704f68c6b817f7e95ac Author: Bruce Guenter Date: Sat Dec 14 20:46:45 2002 +0000 Fixed up the filename in the header. cdb/get.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) commit 6516ed256ed52fccea2dbc276f9514db89f8017c Author: Bruce Guenter Date: Wed Nov 20 04:59:53 2002 +0000 Added more signal catchers -- all, int, and quit. unix/sig.h | 4 ++++ unix/sig=l | 3 +++ unix/sig_all.c | 47 ++++++++++++++++++++++++++++++++++++++++ unix/{sig_hup.c => sig_int.c} | 2 +- unix/{sig_alarm.c => sig_quit.c} | 2 +- 5 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 unix/sig_all.c copy unix/{sig_hup.c => sig_int.c} (54%) copy unix/{sig_alarm.c => sig_quit.c} (52%) commit 2e13039f4710ca355b960c8131f5ff18795346a4 Author: Bruce Guenter Date: Fri Oct 18 02:07:14 2002 +0000 Added obuf_put*ll functions. NEWS | 2 +- iobuf/iobuf.h | 4 ++++ iobuf/iobuf=l | 2 ++ iobuf/{obuf_putiw.c => obuf_putiwll.c} | 10 +++++----- iobuf/{obuf_putuw.c => obuf_putuwll.c} | 10 +++++----- 5 files changed, 17 insertions(+), 11 deletions(-) copy iobuf/{obuf_putiw.c => obuf_putiwll.c} (70%) copy iobuf/{obuf_putuw.c => obuf_putuwll.c} (50%) commit c1c277e8e010310a8e220ff3e21afe5937df8dc6 Author: Bruce Guenter Date: Fri Oct 18 02:06:40 2002 +0000 Fixed a minor bug -- don't return success on EOF. iobuf/ibuf_getstr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit e6fff1ddbfc14339d25d6142e753ccf45cd3b690 Author: Bruce Guenter Date: Fri Oct 18 02:06:10 2002 +0000 Bumped version to 1.004 VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 59fe17d5fa2003fd9a40ec4d506d8f8c13173f9d Author: Bruce Guenter Date: Fri Oct 18 02:05:56 2002 +0000 Added str_match function. NEWS | 2 ++ str/{findprevnot.c => match.c} | 27 +++++++++++++++++---------- str/str.h | 3 +++ str/str=l | 1 + 4 files changed, 23 insertions(+), 10 deletions(-) copy str/{findprevnot.c => match.c} (61%) commit 02de89dcbfc33814ae81499206b75e9401d46c33 Author: Bruce Guenter Date: Wed Oct 16 11:57:11 2002 +0000 Added long long str_cat*ll functions. NEWS | 2 ++ 1 file changed, 2 insertions(+) commit e8664142c467b1a7a4c0decbf6f52df22e6739ea Author: Bruce Guenter Date: Wed Oct 16 11:56:21 2002 +0000 Added long long (64 bit) str_cat functions. str/{catiw.c => catiwll.c} | 8 ++++---- str/{catuw.c => catuwll.c} | 8 ++++---- str/str.h | 4 ++++ str/str=l | 2 ++ 4 files changed, 14 insertions(+), 8 deletions(-) copy str/{catiw.c => catiwll.c} (88%) copy str/{catuw.c => catuwll.c} (84%) commit 9fcdca856887476ab897de02c56bd86ea4192160 Author: Bruce Guenter Date: Wed Oct 16 11:56:00 2002 +0000 Fixed up comment header. str/catiw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 2a6032bcfd77a17277ea15366c069e3e502962b5 Author: Bruce Guenter Date: Wed Oct 16 11:55:29 2002 +0000 If MSG_NO_DEBUG is defined, omit all debugging messages. NEWS | 3 +++ msg/msg.h | 4 ++++ 2 files changed, 7 insertions(+) commit 31a772ddd8cecf9e9240c58f771c69614ce566b5 Author: Bruce Guenter Date: Wed Oct 16 11:54:20 2002 +0000 *** empty log message *** NEWS | 7 +++++++ 1 file changed, 7 insertions(+) commit c804b5c55d42fcdc645dd81014d6bef253bd9f39 Author: Bruce Guenter Date: Tue Oct 8 05:55:31 2002 +0000 Use MAP_ANON if MAP_ANONYMOUS is not defined. iobuf/iobuf_init.c | 5 +++++ 1 file changed, 5 insertions(+) commit d48da33692ba1d34325715e363f2455440c98bf1 Author: Bruce Guenter Date: Tue Oct 8 05:55:20 2002 +0000 Add missing include. iobuf/iobuf_close.c | 1 + 1 file changed, 1 insertion(+) commit 589938e5c073c0b69d6532e30012fe579dde6f64 Author: Bruce Guenter Date: Sat Sep 28 05:23:15 2002 +0000 Bumped version. README | 4 ++-- VERSION | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) commit a649104ee7348ab7fb67519f797a0352cb86d702 Author: Bruce Guenter Date: Sat Sep 28 03:15:27 2002 +0000 Clarify path changes. NEWS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) commit d93edf8241c64675703b79954977085187bbd4d0 Author: Bruce Guenter Date: Thu Sep 26 22:40:06 2002 +0000 Try to mmap the iobuf data buffer. NEWS | 3 +++ iobuf/iobuf.h | 2 +- iobuf/iobuf_close.c | 7 ++++++- iobuf/iobuf_init.c | 12 +++++++++--- 4 files changed, 19 insertions(+), 5 deletions(-) commit fc7fc0f05942d73e7dec2ae3779a10c1cb3c5c97 Author: Bruce Guenter Date: Thu Sep 26 22:36:36 2002 +0000 Seeks to current read/write position should not cause a lseek syscall. NEWS | 2 ++ iobuf/ibuf_seek.c | 2 +- iobuf/obuf_seek.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) commit f4bce6dd34a39ac77e11cddbe6a9f363f1d334bd Author: Bruce Guenter Date: Wed Sep 11 10:38:51 2002 +0000 Fixed missing +offset bug in str/cmp.c NEWS | 2 ++ str/cmp.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) commit f937ae7f1a99305c739001c9ad2e33e974657912 Author: Bruce Guenter Date: Tue Aug 27 09:39:21 2002 +0000 Don't do directory listings on intermediary paths unless necessary. NEWS | 8 ++++++ path/match.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 75 insertions(+), 14 deletions(-) commit ad589c5fd6a69a3bd7b12d5a3c6f1af13737ee48 Author: Bruce Guenter Date: Sat Aug 17 03:05:47 2002 +0000 Bumped up date. README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 55905e9a4b78623ce8b9082e441a0da735517f42 Author: Bruce Guenter Date: Sat Aug 17 03:05:11 2002 +0000 The regsub module is depricated in newer versions of Python. python/template/context.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 4a150dd31ba54a557b6fa6dcbbe08d83284e85b1 Author: Bruce Guenter Date: Thu Aug 15 10:11:25 2002 +0000 Portability fixes for FreeBSD (and possibly others). NEWS | 2 ++ 1 file changed, 2 insertions(+) commit 5f1f72f1bc3a738fa4f54199024339f44411d753 Author: Bruce Guenter Date: Thu Aug 15 10:09:36 2002 +0000 Portability fixes for FreeBSD (possibly others). net/recvfd.c | 4 ++++ net/resolve_ipv4addr.c | 1 + net/resolve_ipv4name.c | 1 + net/sendfd.c | 4 ++++ net/uncork.c | 1 + 5 files changed, 11 insertions(+) commit 88fc2f2f4953ab455da99119367792a30e1946c8 Author: Bruce Guenter Date: Thu Aug 15 05:36:54 2002 +0000 Make sure to increase the string length in str_cat#s NEWS | 3 +++ str/cat2s.c | 1 + str/cat3s.c | 1 + str/cat4s.c | 1 + str/cat5s.c | 1 + str/cat6s.c | 1 + 6 files changed, 8 insertions(+) commit b66c1725377ab488a7f124cd7d90be07213ed780 Author: Bruce Guenter Date: Thu Aug 15 04:36:10 2002 +0000 Added new dict_foreach routine. NEWS | 3 +++ dict/dict.h | 1 + dict/dict=l | 1 + dict/foreach.c | 13 +++++++++++++ 4 files changed, 18 insertions(+) create mode 100644 dict/foreach.c commit 4866bf03158930e283a9dfd756968bf847955f47 Author: Bruce Guenter Date: Mon Aug 5 22:34:37 2002 +0000 Bumped version. README | 4 ++-- VERSION | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) commit 5ab7c9e2c92beea961f554bae95b9372b01bde25 Author: Bruce Guenter Date: Fri Jun 21 00:23:06 2002 +0000 Removed prototype for srandom that appears to only cause problems. cli/main.c | 4 ---- 1 file changed, 4 deletions(-) commit 84a19f34ec1af56a2a997be69c79318bfb8e1e63 Author: Bruce Guenter Date: Fri Jun 21 00:22:14 2002 +0000 Removed silly trailing "." from common message output code. NEWS | 2 ++ msg/common.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) commit c5b06174ed04b5e0a18b4e9ddaad5a30ae3e13b3 Author: Bruce Guenter Date: Fri Jun 21 00:20:19 2002 +0000 Added in crypto library. NEWS | 7 + crypto/md5-crypt.c | 235 ++++++++++++++++++++++++++ crypto/md5-test.c | 32 ++++ crypto/md5.c | 447 ++++++++++++++++++++++++++++++++++++++++++++++++++ crypto/md5.h | 156 ++++++++++++++++++ crypto/md5=l | 2 + crypto/sha1.c | 212 ++++++++++++++++++++++++ crypto/sha1.h | 35 ++++ crypto/sha1=l | 1 + crypto/sha256.c | 215 ++++++++++++++++++++++++ crypto/sha256.h | 21 +++ crypto/sha256=l | 1 + crypto/sha256test.c | 90 ++++++++++ crypto/sha512a-test.c | 94 +++++++++++ crypto/sha512a.c | 276 +++++++++++++++++++++++++++++++ crypto/sha512a.h | 20 +++ crypto/sha512a=l | 1 + insthier.c | 12 ++ 18 files changed, 1857 insertions(+) create mode 100644 crypto/md5-crypt.c create mode 100644 crypto/md5-test.c create mode 100644 crypto/md5.c create mode 100644 crypto/md5.h create mode 100644 crypto/md5=l create mode 100644 crypto/sha1.c create mode 100644 crypto/sha1.h create mode 100644 crypto/sha1=l create mode 100644 crypto/sha256.c create mode 100644 crypto/sha256.h create mode 100644 crypto/sha256=l create mode 100644 crypto/sha256test.c create mode 100644 crypto/sha512a-test.c create mode 100644 crypto/sha512a.c create mode 100644 crypto/sha512a.h create mode 100644 crypto/sha512a=l commit 6cabb5ffcd56f0d4ea4252dc9e5fe4589bb96d55 Author: Bruce Guenter Date: Sat Jun 1 12:21:34 2002 +0000 *** empty log message *** NEWS | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) commit 6d9ff9a1f6677dd3e1a0877ac2025fdbc5dbb89e Author: Bruce Guenter Date: Sat Jun 1 12:21:30 2002 +0000 Bumped up date. README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 4d1de8e2c05c932ae352700e0a0d7eefbf484b65 Author: Bruce Guenter Date: Sat Jun 1 04:31:26 2002 +0000 Fixed a typo. unix/sig_block.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) commit 78454fa8bd4c78507d597118851a537b778bbafb Author: Bruce Guenter Date: Sat Jun 1 04:31:15 2002 +0000 *** empty log message *** NEWS | 10 ++++++++++ TODO | 5 +++-- 2 files changed, 13 insertions(+), 2 deletions(-) commit cb95a345dd1860769daee899a82fbae0b0d24e60 Author: Bruce Guenter Date: Sat Jun 1 04:31:06 2002 +0000 Copied from spac tree, without the -lsysdeps default target. load.spac | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 load.spac commit 20ae50cc170495f66efc94220cc115bf753996a0 Author: Bruce Guenter Date: Sat Jun 1 04:30:29 2002 +0000 Bumped up version. README | 4 ++-- VERSION | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) commit 2792dcf4f03dd4d74404bcb6ec35f130d5d8b21d Author: Bruce Guenter Date: Sat Jun 1 04:30:03 2002 +0000 Make sure the subshell fails if any of the commands fail. sysdeps.h.spac | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) commit 4b631198a03e98d3e5dfd2f077e91853c76d24a6 Author: Bruce Guenter Date: Sat Jun 1 03:36:25 2002 +0000 Added missing uint(32|64).h targets. uint32.h.spac | 2 ++ uint64.h.spac | 3 +++ 2 files changed, 5 insertions(+) create mode 100644 uint32.h.spac create mode 100644 uint64.h.spac commit 0608918b8d4980dac797b7309f282082300511b8 Author: Bruce Guenter Date: Sat Jun 1 03:35:45 2002 +0000 Nuked in favour of conf-home setup. conf_inc.c.spac | 5 ----- conf_lib.c.spac | 5 ----- 2 files changed, 10 deletions(-) delete mode 100644 conf_inc.c.spac delete mode 100644 conf_lib.c.spac commit e4c32bc42d0d1fb9fd8f429a92d3f7a528adccd4 Author: Bruce Guenter Date: Sat Jun 1 03:18:41 2002 +0000 Moved all installed files under /usr/local/bglibs insthier.c | 19 +++++++++++++++---- spec | 11 ++++------- 2 files changed, 19 insertions(+), 11 deletions(-) commit 3c30cf7aa67d4916969e05b382f2c97680152f87 Author: Bruce Guenter Date: Fri May 31 19:47:59 2002 +0000 Removed bogus '*.html' file list. makedist.py | 1 - 1 file changed, 1 deletion(-) commit ddffe390db5aedd8eb93ae59d15df7eee279b116 Author: Bruce Guenter Date: Fri May 31 19:27:13 2002 +0000 *** empty log message *** README | 6 +++--- TODO | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) commit 5da4106c6c0a06ac76dcecc67795567d29a10a24 Author: Bruce Guenter Date: Fri May 31 19:27:03 2002 +0000 Use #include "sysdeps.h", not iobuf/iobuf_timeout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 1d517f8fbf3d391ef666d0431789a68263756d77 Author: Bruce Guenter Date: Fri May 31 19:26:24 2002 +0000 Added missing #include "load.h" dict/load_list.c | 1 + dict/load_map.c | 1 + 2 files changed, 2 insertions(+) commit 5292b752917e9971a59f70cc8d3a6394e9d67cd9 Author: Bruce Guenter Date: Fri May 31 06:01:50 2002 +0000 First check in. NEWS | 0 README | 26 +++++++ TODO | 2 + VERSION | 1 + all.spac | 1 + conf_inc.c.spac | 5 ++ conf_lib.c.spac | 5 ++ insthier.c | 141 +++++++++++++++++++++++++++++++++++++ libinstaller=l | 1 + libinstcheck=l | 1 + libinstshow=l | 1 + libraries.spac | 1 + libsysdeps=l | 3 + makedist.py | 35 ++++++++++ spec | 43 ++++++++++++ sysdeps.h.spac | 32 +++++++++ vmailmgr/client.h | 26 +++++++ vmailmgr/client=l | 4 ++ vmailmgr/req_arg.c | 11 +++ vmailmgr/req_init.c | 10 +++ vmailmgr/req_write.c | 23 ++++++ vmailmgr/resp_read.c | 23 ++++++ vmailmgr/vpwentry.h | 31 +++++++++ vmailmgr/vpwentry=l | 3 + vmailmgr/vpwentry_export.c | 33 +++++++++ vmailmgr/vpwentry_free.c | 12 ++++ vmailmgr/vpwentry_import.c | 169 +++++++++++++++++++++++++++++++++++++++++++++ 27 files changed, 643 insertions(+) create mode 100644 NEWS create mode 100644 README create mode 100644 TODO create mode 100644 VERSION create mode 100644 all.spac create mode 100644 conf_inc.c.spac create mode 100644 conf_lib.c.spac create mode 100644 insthier.c create mode 100644 libinstaller=l create mode 100644 libinstcheck=l create mode 100644 libinstshow=l create mode 100644 libraries.spac create mode 100644 libsysdeps=l create mode 100644 makedist.py create mode 100644 spec create mode 100644 sysdeps.h.spac create mode 100644 vmailmgr/client.h create mode 100644 vmailmgr/client=l create mode 100644 vmailmgr/req_arg.c create mode 100644 vmailmgr/req_init.c create mode 100644 vmailmgr/req_write.c create mode 100644 vmailmgr/resp_read.c create mode 100644 vmailmgr/vpwentry.h create mode 100644 vmailmgr/vpwentry=l create mode 100644 vmailmgr/vpwentry_export.c create mode 100644 vmailmgr/vpwentry_free.c create mode 100644 vmailmgr/vpwentry_import.c commit 9f66821d7873db4ac3f09da11a2d99013a6c7f5c Author: Bruce Guenter Date: Fri May 31 06:01:36 2002 +0000 Copied from spac tree. direntry.h1 | 8 ++++ direntry.h2 | 8 ++++ fork.h1 | 7 ++++ fork.h2 | 7 ++++ hasflock.h1 | 2 + hasflock.h2 | 3 ++ haspeercred.h1 | 1 + haspeercred.h2 | 4 ++ hassendfile.h1 | 1 + hassendfile.h2 | 2 + hassgact.h1 | 1 + hassgact.h2 | 2 + hassgprm.h1 | 1 + hassgprm.h2 | 2 + hasspnam.h1 | 2 + hasspnam.h2 | 2 + hasuserpw.h1 | 2 + hasuserpw.h2 | 2 + haswaitp.h1 | 1 + haswaitp.h2 | 2 + haszlib.h1 | 1 + haszlib.h2 | 2 + installer.c | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ installer.h | 15 ++++++++ instcheck.c | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++++ instshow.c | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ iopoll.c | 53 +++++++++++++++++++++++++ iopoll.h1 | 19 +++++++++ iopoll.h2 | 17 ++++++++ select.h1 | 10 +++++ select.h2 | 11 ++++++ setenv.c | 20 ++++++++++ setenv.h1 | 2 + setenv.h2 | 3 ++ trydirent.c | 8 ++++ tryflock.c | 8 ++++ trypeercred.c | 10 +++++ trypoll.c | 16 ++++++++ trysendfile.c | 9 +++++ trysetenv.c | 7 ++++ trysgact.c | 10 +++++ trysgprm.c | 10 +++++ tryspnam.c | 9 +++++ trysysel.c | 8 ++++ trysystime.c | 1 + trytime.c | 1 + tryulong32.c | 11 ++++++ tryulong64.c | 11 ++++++ tryunsetenv.c | 5 +++ tryuserpw.c | 9 +++++ tryvfork.c | 4 ++ trywaitp.c | 7 ++++ tryzlib.c | 6 +++ uint32.h1 | 6 +++ uint32.h2 | 6 +++ uint64.h1 | 8 ++++ uint64.h2 | 8 ++++ unsetenv.c | 24 ++++++++++++ unsetenv.h1 | 4 ++ unsetenv.h2 | 2 + 60 files changed, 769 insertions(+) create mode 100644 direntry.h1 create mode 100644 direntry.h2 create mode 100644 fork.h1 create mode 100644 fork.h2 create mode 100644 hasflock.h1 create mode 100644 hasflock.h2 create mode 100644 haspeercred.h1 create mode 100644 haspeercred.h2 create mode 100644 hassendfile.h1 create mode 100644 hassendfile.h2 create mode 100644 hassgact.h1 create mode 100644 hassgact.h2 create mode 100644 hassgprm.h1 create mode 100644 hassgprm.h2 create mode 100644 hasspnam.h1 create mode 100644 hasspnam.h2 create mode 100644 hasuserpw.h1 create mode 100644 hasuserpw.h2 create mode 100644 haswaitp.h1 create mode 100644 haswaitp.h2 create mode 100644 haszlib.h1 create mode 100644 haszlib.h2 create mode 100644 installer.c create mode 100644 installer.h create mode 100644 instcheck.c create mode 100644 instshow.c create mode 100644 iopoll.c create mode 100644 iopoll.h1 create mode 100644 iopoll.h2 create mode 100644 select.h1 create mode 100644 select.h2 create mode 100644 setenv.c create mode 100644 setenv.h1 create mode 100644 setenv.h2 create mode 100644 trydirent.c create mode 100644 tryflock.c create mode 100644 trypeercred.c create mode 100644 trypoll.c create mode 100644 trysendfile.c create mode 100644 trysetenv.c create mode 100644 trysgact.c create mode 100644 trysgprm.c create mode 100644 tryspnam.c create mode 100644 trysysel.c create mode 100644 trysystime.c create mode 100644 trytime.c create mode 100644 tryulong32.c create mode 100644 tryulong64.c create mode 100644 tryunsetenv.c create mode 100644 tryuserpw.c create mode 100644 tryvfork.c create mode 100644 trywaitp.c create mode 100644 tryzlib.c create mode 100644 uint32.h1 create mode 100644 uint32.h2 create mode 100644 uint64.h1 create mode 100644 uint64.h2 create mode 100644 unsetenv.c create mode 100644 unsetenv.h1 create mode 100644 unsetenv.h2 commit b5fba26aa6d953fa628930cb72501c84297776b7 Author: Bruce Guenter Date: Fri May 31 05:59:00 2002 +0000 First check-in. misc/misc.h | 8 ++++++++ misc/misc=l | 3 +++ misc/strtou.c | 11 +++++++++++ misc/utoa.c | 15 +++++++++++++++ misc/utoa2.c | 13 +++++++++++++ 5 files changed, 50 insertions(+) create mode 100644 misc/misc.h create mode 100644 misc/misc=l create mode 100644 misc/strtou.c create mode 100644 misc/utoa.c create mode 100644 misc/utoa2.c commit 8175ce9ff0868e3c1cc6ac069ffb63b6947b4670 Author: Bruce Guenter Date: Fri May 31 05:58:42 2002 +0000 Fixed command regex's to handle multi-line cases. python/template/lex.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) commit 9bd0cb6755b9401991d5e8c67c9b1bdf0a76fc0e Author: Bruce Guenter Date: Fri May 31 05:58:24 2002 +0000 Added additional time and sys modules. python/template/functions.py | 3 +++ 1 file changed, 3 insertions(+) commit e97bb9276ec41f5ca4aa2020e0f37753b4991024 Author: Bruce Guenter Date: Fri May 31 05:57:31 2002 +0000 Rewrote parts of the make library. cdb/make.c | 43 ++++++++++++++++++++++++------------------- cdb/make.h | 7 +++---- cdb/make=l | 3 +++ 3 files changed, 30 insertions(+), 23 deletions(-) create mode 100644 cdb/make=l commit 628199cd9728e273c225d3a69865814c2a51e380 Author: Bruce Guenter Date: Fri May 31 05:57:15 2002 +0000 *** empty log message *** cdb/uint32_pack.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 cdb/uint32_pack.c commit 2db550dea93d9ce3b1b115d8e04d6bb8426ff5a6 Author: Bruce Guenter Date: Fri May 31 05:56:04 2002 +0000 Split up cdb.c into multiple files. cdb/cdb=l | 2 ++ 1 file changed, 2 insertions(+) commit 2e0c69446b90bdfcf79845d72de7b7e50f1eb998 Author: Bruce Guenter Date: Fri May 31 05:55:44 2002 +0000 Added str library. str/copy.c => cdb/get.c | 27 ++++++++++----------------- str/init.c => cdb/getnext.c | 19 ++++++++++--------- cdb/str.h | 10 ++++++++++ cdb/str=l | 2 ++ 4 files changed, 32 insertions(+), 26 deletions(-) copy str/copy.c => cdb/get.c (65%) copy str/init.c => cdb/getnext.c (64%) create mode 100644 cdb/str.h create mode 100644 cdb/str=l commit a970268ce0f00d28645eb10bc6fa855212c25f9f Author: Bruce Guenter Date: Fri May 31 05:55:10 2002 +0000 Split cdb.c into multiple files. cdb/cdb.c | 96 --------------------------------------------------- cdb/cdb.h | 7 ++-- cdb/{cdb.c => find.c} | 39 +++------------------ cdb/read.c | 20 +++++++++++ 4 files changed, 30 insertions(+), 132 deletions(-) copy cdb/{cdb.c => find.c} (79%) create mode 100644 cdb/read.c commit 775543238e87a7ed0f952e4fd3c41acc8682d8b6 Author: Bruce Guenter Date: Fri May 31 05:50:48 2002 +0000 Removed the socket library. socket/accept4.c | 36 ------------------------------------ socket/acceptu.c | 33 --------------------------------- socket/bind4.c | 33 --------------------------------- socket/bindu.c | 33 --------------------------------- socket/broadcast.c | 29 ----------------------------- socket/connect4.c | 35 ----------------------------------- socket/connected.c | 35 ----------------------------------- socket/connectu.c | 32 -------------------------------- socket/cork.c | 35 ----------------------------------- socket/getaddr4.c | 36 ------------------------------------ socket/ipv4addr.c | 4 ---- socket/listen.c | 27 --------------------------- socket/recv4.c | 38 -------------------------------------- socket/recvu.c | 26 -------------------------- socket/reuse.c | 29 ----------------------------- socket/send4.c | 34 ---------------------------------- socket/sendu.c | 26 -------------------------- socket/shutdown.c | 31 ------------------------------- socket/socket.h | 38 -------------------------------------- socket/socket=l | 23 ----------------------- socket/tcp.c | 28 ---------------------------- socket/udp.c | 28 ---------------------------- socket/uncork.c | 39 --------------------------------------- socket/unixdgm.c | 28 ---------------------------- socket/unixstr.c | 28 ---------------------------- 25 files changed, 764 deletions(-) delete mode 100644 socket/accept4.c delete mode 100644 socket/acceptu.c delete mode 100644 socket/bind4.c delete mode 100644 socket/bindu.c delete mode 100644 socket/broadcast.c delete mode 100644 socket/connect4.c delete mode 100644 socket/connected.c delete mode 100644 socket/connectu.c delete mode 100644 socket/cork.c delete mode 100644 socket/getaddr4.c delete mode 100644 socket/ipv4addr.c delete mode 100644 socket/listen.c delete mode 100644 socket/recv4.c delete mode 100644 socket/recvu.c delete mode 100644 socket/reuse.c delete mode 100644 socket/send4.c delete mode 100644 socket/sendu.c delete mode 100644 socket/shutdown.c delete mode 100644 socket/socket.h delete mode 100644 socket/socket=l delete mode 100644 socket/tcp.c delete mode 100644 socket/udp.c delete mode 100644 socket/uncork.c delete mode 100644 socket/unixdgm.c delete mode 100644 socket/unixstr.c commit 3f71d79fa4d8cbe173434447225d75b87ac37bfb Author: Bruce Guenter Date: Fri May 31 05:45:53 2002 +0000 Use new sysdeps.h header. path/match.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 258e0e6f3917d61d71688845ff9becf9e5a7a0a5 Author: Bruce Guenter Date: Fri May 31 05:45:17 2002 +0000 Use new iopoll_restart function. iobuf/iobuf_timeout.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) commit 92ab3bd9b47805a58e982968945c0d9e86762935 Author: Bruce Guenter Date: Fri May 31 05:44:46 2002 +0000 Remember to free the key string memory. dict/free.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) commit dc8d8bcd28e2f6aa565596d81eaddee3cae69a6d Author: Bruce Guenter Date: Fri May 31 05:44:00 2002 +0000 Renamed socket_pair to socket_pairstr, and added the corresponding socket_pairdgm function. net/{pair.c => pairdgm.c} | 6 +++--- net/{pair.c => pairstr.c} | 4 ++-- net/socket.h | 3 ++- net/socket=l | 3 ++- 4 files changed, 9 insertions(+), 7 deletions(-) copy net/{pair.c => pairdgm.c} (86%) rename net/{pair.c => pairstr.c} (92%) commit cab5d42d2e924f948df196978774ec932e6642d9 Author: Bruce Guenter Date: Fri May 31 05:43:25 2002 +0000 Corrected typo in function name. net/sendfd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 635fd7aa42fcfabaa22d54a4debf840e7b1286f8 Author: Bruce Guenter Date: Fri May 31 05:41:17 2002 +0000 Added non-sigaction/sigprocmask support. unix/sig_block.c | 10 +++++++++- unix/sig_catch.c | 5 +++++ unix/sig_suspend.c | 5 +++++ 3 files changed, 19 insertions(+), 1 deletion(-) commit 29e9f42b64cc73365e9f93bcd54f576c4d4c1438 Author: Bruce Guenter Date: Thu May 30 23:16:40 2002 +0000 Disabled this library, in favour of the generic msg library. err/err=l | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 err/err=l commit e0578710d279a5051b3f6a4f8cdbfa8bd3caa48b Author: Bruce Guenter Date: Tue May 28 20:16:35 2002 +0000 Added send/receive FD functions. net/{pair.c => recvfd.c} | 23 +++++++++++++++++------ net/{pair.c => sendfd.c} | 26 ++++++++++++++++++++------ net/socket.h | 3 +++ net/socket=l | 2 ++ 4 files changed, 42 insertions(+), 12 deletions(-) copy net/{pair.c => recvfd.c} (62%) copy net/{pair.c => sendfd.c} (56%) commit 59ab6ab605de9d525181fb71ba49bb42984e52bf Author: Bruce Guenter Date: Fri May 10 23:58:20 2002 +0000 Fixed major bug -- copy#s functions didn't set len. str/copy2s.c | 4 +++- str/copy3s.c | 4 +++- str/copy4s.c | 4 +++- str/copy5s.c | 4 +++- str/copy6s.c | 4 +++- 5 files changed, 15 insertions(+), 5 deletions(-) commit 442a791ca3526aff6eb8160180f51eae93c57f2d Author: Bruce Guenter Date: Thu May 2 23:41:20 2002 +0000 Cleaned up the implementation of find{next,prev}of slightly. str/findnextof.c | 7 +++---- str/findprevof.c | 5 +++-- 2 files changed, 6 insertions(+), 6 deletions(-) commit 6846ec2b5e92164b5777aef5332c9c180c00fccf Author: Bruce Guenter Date: Thu May 2 23:39:18 2002 +0000 Added str_find{first,last,next,prev}not functions. str/{findnextof.c => findnextnot.c} | 13 ++++++------- str/{findprevof.c => findprevnot.c} | 13 +++++++------ str/str.h | 4 ++++ 3 files changed, 17 insertions(+), 13 deletions(-) copy str/{findnextof.c => findnextnot.c} (77%) copy str/{findprevof.c => findprevnot.c} (74%) commit e2499a009bc0e8e47c51e2c667e7b50b9f2124d2 Author: Bruce Guenter Date: Fri Apr 26 00:15:57 2002 +0000 Fixed includes. cli/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) commit 46b3ab28374be8ef127978d9f10a1af2e044a423 Author: Bruce Guenter Date: Fri Apr 19 01:57:29 2002 +0000 Renamed "socket/" to "net/" net/accept4.c | 2 +- net/acceptu.c | 2 +- net/bind4.c | 2 +- net/bindu.c | 2 +- net/broadcast.c | 2 +- net/connect4.c | 2 +- net/connected.c | 2 +- net/connectu.c | 2 +- net/cork.c | 2 +- net/getaddr4.c | 2 +- net/linger.c | 2 +- net/listen.c | 2 +- net/recv4.c | 2 +- net/recvu.c | 2 +- net/reuse.c | 2 +- net/send4.c | 2 +- net/sendu.c | 2 +- net/setopt.c | 2 +- net/shutdown.c | 2 +- net/tcp.c | 2 +- net/udp.c | 2 +- net/uncork.c | 2 +- net/unixdgm.c | 2 +- net/unixstr.c | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) commit a14aabb2af48662a4afcaaca4f23648f0839db9d Author: Bruce Guenter Date: Fri Apr 19 01:56:26 2002 +0000 Added new wrapper function for socketpair. net/{tcp.c => pair.c} | 8 ++++---- net/socket.h | 2 ++ net/socket=l | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) copy net/{tcp.c => pair.c} (82%) commit cb53bfda3ce54b4f1ec93c92c042f507c63de875 Author: Bruce Guenter Date: Wed Apr 17 04:55:13 2002 +0000 Added needsfree flag support. iobuf/iobuf_init.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) commit 74be743c3fd7ee3e50b39738c5bf527b1f4ef73d Author: Bruce Guenter Date: Wed Apr 17 04:55:02 2002 +0000 Fixed error handling case. iobuf/obuf_write.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit ae995c4215cdf62d2365fa199908e4fcc92b81db Author: Bruce Guenter Date: Wed Apr 17 04:52:53 2002 +0000 Added new function, path_mktemp. path/mktemp.c | 24 ++++++++++++++++++++++++ path/path.h | 1 + path/path=l | 1 + 3 files changed, 26 insertions(+) create mode 100644 path/mktemp.c commit 732ac5611e541e70af6d00ee9c83742be48df2dc Author: Bruce Guenter Date: Wed Apr 17 04:52:38 2002 +0000 Use new form of str_sort. path/match.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 254fed842baccc1a2206c7705e6c8428069e98f4 Author: Bruce Guenter Date: Wed Apr 17 04:44:33 2002 +0000 First check-in unix/nonblock.h | 7 ++++++ unix/nonblock=l | 2 ++ socket/connected.c => unix/nonblock_off.c | 25 ++++++++++----------- socket/connected.c => unix/nonblock_on.c | 25 ++++++++++----------- unix/sig.h | 36 +++++++++++++++++++++++++++++++ unix/sig=l | 10 +++++++++ unix/sig_alarm.c | 4 ++++ net/recvu.c => unix/sig_block.c | 24 +++++++++++++++------ unix/sig_bug.c | 22 +++++++++++++++++++ net/recvu.c => unix/sig_catch.c | 19 ++++++++++------ unix/sig_child.c | 4 ++++ unix/sig_hup.c | 4 ++++ unix/sig_misc.c | 19 ++++++++++++++++ unix/sig_pipe.c | 4 ++++ str/free.c => unix/sig_suspend.c | 15 ++++++------- unix/sig_term.c | 4 ++++ 16 files changed, 174 insertions(+), 50 deletions(-) create mode 100644 unix/nonblock.h create mode 100644 unix/nonblock=l copy socket/connected.c => unix/nonblock_off.c (72%) copy socket/connected.c => unix/nonblock_on.c (72%) create mode 100644 unix/sig.h create mode 100644 unix/sig=l create mode 100644 unix/sig_alarm.c copy net/recvu.c => unix/sig_block.c (68%) create mode 100644 unix/sig_bug.c copy net/recvu.c => unix/sig_catch.c (67%) create mode 100644 unix/sig_child.c create mode 100644 unix/sig_hup.c create mode 100644 unix/sig_misc.c create mode 100644 unix/sig_pipe.c copy str/free.c => unix/sig_suspend.c (81%) create mode 100644 unix/sig_term.c commit d22ddd0fd8f0ae292d324192752405c7395d32cf Author: Bruce Guenter Date: Thu Mar 7 22:56:25 2002 +0000 First check-in. err/message.c => msg/common.c | 27 +++++++++------ msg/debug.c | 9 +++++ msg/die.c | 10 ++++++ msg/error.c | 7 ++++ msg/msg.h | 78 +++++++++++++++++++++++++++++++++++++++++++ err/err=l => msg/msg=l | 3 +- {err => msg}/test.c | 2 +- {err => msg}/test=x | 0 msg/warn.c | 8 +++++ msg/wrap.c | 10 ++++++ msg/wrap.h | 6 ++++ msg/wrap=l | 1 + 12 files changed, 148 insertions(+), 13 deletions(-) copy err/message.c => msg/common.c (52%) create mode 100644 msg/debug.c create mode 100644 msg/die.c create mode 100644 msg/error.c create mode 100644 msg/msg.h copy err/err=l => msg/msg=l (55%) copy {err => msg}/test.c (90%) copy {err => msg}/test=x (100%) create mode 100644 msg/warn.c create mode 100644 msg/wrap.c create mode 100644 msg/wrap.h create mode 100644 msg/wrap=l commit a5c7c2dc02c04f7e759801191ed8cdb27eec2a59 Author: Bruce Guenter Date: Wed Mar 6 22:37:56 2002 +0000 Initial check-in. {socket => net}/accept4.c | 7 ++++--- {socket => net}/acceptu.c | 4 +--- {socket => net}/bind4.c | 2 +- {socket => net}/bindu.c | 2 +- {socket => net}/broadcast.c | 4 +--- {socket => net}/connect4.c | 2 +- {socket => net}/connected.c | 0 {socket => net}/connectu.c | 2 +- {socket => net}/cork.c | 4 ++-- {socket => net}/getaddr4.c | 0 net/ipv4.h | 12 ++++++++++++ net/ipv4=l | 3 +++ socket/ipv4addr.c => net/ipv4_addr.c | 2 +- net/ipv4_format.c | 22 ++++++++++++++++++++++ net/ipv4_parse.c | 35 +++++++++++++++++++++++++++++++++++ socket/listen.c => net/linger.c | 10 ++++++---- {socket => net}/listen.c | 2 +- {socket => net}/recv4.c | 0 {socket => net}/recvu.c | 0 net/resolve.h | 16 ++++++++++++++++ net/resolve=l | 3 +++ net/resolve_error.c | 20 ++++++++++++++++++++ net/resolve_ipv4addr.c | 11 +++++++++++ net/resolve_ipv4name.c | 15 +++++++++++++++ {socket => net}/reuse.c | 4 +--- {socket => net}/send4.c | 0 {socket => net}/sendu.c | 0 socket/unixdgm.c => net/setopt.c | 8 +++----- {socket => net}/shutdown.c | 14 +++++++++++++- {socket => net}/socket.h | 21 ++++++++++----------- {socket => net}/socket=l | 2 +- {socket => net}/tcp.c | 0 {socket => net}/udp.c | 0 {socket => net}/uncork.c | 4 ++-- {socket => net}/unixdgm.c | 0 {socket => net}/unixstr.c | 0 36 files changed, 187 insertions(+), 44 deletions(-) copy {socket => net}/accept4.c (88%) copy {socket => net}/acceptu.c (91%) copy {socket => net}/bind4.c (95%) copy {socket => net}/bindu.c (95%) copy {socket => net}/broadcast.c (90%) copy {socket => net}/connect4.c (94%) copy {socket => net}/connected.c (100%) copy {socket => net}/connectu.c (94%) copy {socket => net}/cork.c (93%) copy {socket => net}/getaddr4.c (100%) create mode 100644 net/ipv4.h create mode 100644 net/ipv4=l copy socket/ipv4addr.c => net/ipv4_addr.c (81%) create mode 100644 net/ipv4_format.c create mode 100644 net/ipv4_parse.c copy socket/listen.c => net/linger.c (78%) copy {socket => net}/listen.c (96%) copy {socket => net}/recv4.c (100%) copy {socket => net}/recvu.c (100%) create mode 100644 net/resolve.h create mode 100644 net/resolve=l create mode 100644 net/resolve_error.c create mode 100644 net/resolve_ipv4addr.c create mode 100644 net/resolve_ipv4name.c copy {socket => net}/reuse.c (90%) copy {socket => net}/send4.c (100%) copy {socket => net}/sendu.c (100%) copy socket/unixdgm.c => net/setopt.c (83%) copy {socket => net}/shutdown.c (87%) copy {socket => net}/socket.h (62%) copy {socket => net}/socket=l (94%) copy {socket => net}/tcp.c (100%) copy {socket => net}/udp.c (100%) copy {socket => net}/uncork.c (94%) copy {socket => net}/unixdgm.c (100%) copy {socket => net}/unixstr.c (100%) commit f2c012e137a86993a0881a40e00e14ace444bb08 Author: Bruce Guenter Date: Wed Feb 13 04:28:40 2002 +0000 Depricated the use of $CVM_SASL_LOGIN in favour of $CVM_SASL_PLAIN. cvm-sasl/cvm-sasl.html | 8 +++++--- cvm-sasl/init.c | 27 +++++++++++++++++++-------- 2 files changed, 24 insertions(+), 11 deletions(-) commit e0e81aea7bdc672c2c05cde5f08210f22d4f8de7 Author: Bruce Guenter Date: Fri Feb 1 23:05:27 2002 +0000 Modified str_sort to take a comparison function parameter. str/sort.c | 19 +++++++------------ str/str.h | 10 +++++++++- 2 files changed, 16 insertions(+), 13 deletions(-) commit ffc0e43ec7c94b3274738bfa6ba7a291f9a1e80a Author: Bruce Guenter Date: Sat Oct 20 01:42:07 2001 +0000 Added routines for corking/uncorking a socket. socket/{listen.c => cork.c} | 18 +++++++++++++----- socket/socket.h | 2 ++ socket/socket=l | 2 ++ socket/{getaddr4.c => uncork.c} | 29 ++++++++++++++++------------- 4 files changed, 33 insertions(+), 18 deletions(-) copy socket/{listen.c => cork.c} (70%) copy socket/{getaddr4.c => uncork.c} (60%) commit 5365900113739b3a0a19b1df61dfd89d69d297f0 Author: Bruce Guenter Date: Thu Oct 18 00:13:15 2001 +0000 Completed the alternate read/write function modification. Added a seekable flag. Merged the do_close and do_free flags into the flags field. iobuf/ibuf_init.c | 4 ++-- iobuf/ibuf_open.c | 2 +- iobuf/ibuf_refill.c | 2 +- iobuf/ibuf_stdin.c | 4 +++- iobuf/iobuf.h | 16 ++++++++++------ iobuf/iobuf_close.c | 4 ++-- iobuf/iobuf_init.c | 12 ++++++------ iobuf/obuf_flush.c | 2 +- iobuf/obuf_init.c | 4 ++-- iobuf/obuf_open.c | 6 +++--- iobuf/obuf_putc.c | 2 +- iobuf/obuf_seek.c | 2 +- iobuf/obuf_stderr.c | 4 +++- iobuf/obuf_stdout.c | 4 +++- iobuf/obuf_write.c | 2 +- iobuf/test.c | 2 +- 16 files changed, 41 insertions(+), 31 deletions(-) commit 10ed001fa92c6406e8280eaffb54362263d9a2af Author: Bruce Guenter Date: Wed Oct 17 23:41:52 2001 +0000 Added support for alternate read/write functions. iobuf/ibuf_init.c | 5 ++++- iobuf/ibuf_read.c | 2 +- iobuf/ibuf_refill.c | 2 +- iobuf/iobuf.h | 11 +++++++++-- iobuf/obuf_flush.c | 3 ++- iobuf/obuf_init.c | 5 ++++- iobuf/obuf_write.c | 2 +- 7 files changed, 22 insertions(+), 8 deletions(-) commit 5071006ccf5d449191ad1d64b8610a49e5cab4b4 Author: Bruce Guenter Date: Wed Oct 17 23:40:53 2001 +0000 Added implementation of seek. iobuf/iobuf=l | 1 + iobuf/obuf_seek.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 iobuf/obuf_seek.c commit bfb9ee9323350c024b551357304661fc0eba1507 Author: Bruce Guenter Date: Sat Oct 13 02:31:30 2001 +0000 Removed cdb_ prefix from cdb_hash.c and cdb_make.[ch] cdb/cdb=l | 2 +- cdb/{cdb_hash.c => hash.c} | 0 cdb/{cdb_make.c => make.c} | 0 cdb/{cdb_make.h => make.h} | 0 4 files changed, 1 insertion(+), 1 deletion(-) rename cdb/{cdb_hash.c => hash.c} (100%) rename cdb/{cdb_make.c => make.c} (100%) rename cdb/{cdb_make.h => make.h} (100%) commit f2411a5643a610a195b8e699c88dc953692e041e Author: Bruce Guenter Date: Sat Sep 29 03:19:40 2001 +0000 Realloc padsize+etc *more* space. str/catiw.c | 2 +- str/catuw.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) commit d0911badbebdb5a89ca726e85b23cd9050929cf3 Author: Bruce Guenter Date: Sat Sep 29 03:19:10 2001 +0000 Make sure the temporary string is freed before returning. str/sort.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) commit 3977866ce42db45f9e9b4dabb96e41b2ac2e1f8c Author: Bruce Guenter Date: Sat Sep 22 09:29:53 2001 +0000 Added a new function, socket_connected. socket/{reuse.c => connected.c} | 16 +++++++++++----- socket/socket.h | 1 + socket/socket=l | 1 + 3 files changed, 13 insertions(+), 5 deletions(-) copy socket/{reuse.c => connected.c} (77%) commit c7dbb499091583075d3a8da5414437b4c79e1b70 Author: Bruce Guenter Date: Sat Sep 15 04:32:11 2001 +0000 Ignore the first portion of the credential string instead of requiring it to be equal to the second portion. cvm-sasl/plain.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) commit 95916546f231fc544cf89bddfcad99f79455ca0e Author: Bruce Guenter Date: Sat Sep 15 04:31:36 2001 +0000 Fixed up generation of the domain name in the challenge string. cvm-sasl/cram_md5.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) commit 7ccf56ad8e849dbee1f81468033ddd9cd49554ff Author: Bruce Guenter Date: Fri Sep 14 11:46:31 2001 +0000 Added a transform function parameter to dictionary loading functions. dict/load.h | 11 +++++++++++ dict/load_list.c | 7 +++++-- dict/load_map.c | 5 ++++- 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 dict/load.h commit 6db1a369dad077e2df239c8945a19cc193cd0d1c Author: Bruce Guenter Date: Sat Sep 8 00:13:31 2001 +0000 Always set a NUL byte at len, to avoid non-NUL-terminated strings. str/truncate.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) commit fbd42f376e24e8330283b6f4321fca9a520ffb73 Author: Bruce Guenter Date: Sat Sep 8 00:12:37 2001 +0000 Fixed operation of the PLAIN mechanism. cvm-sasl/plain.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) commit 3a838cfab63c0f99b617fcd9a97cdbd93a9ff17a Author: Bruce Guenter Date: Sat Sep 8 00:12:24 2001 +0000 *** empty log message *** cvm-sasl/start.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 825b413641ad29eabef1855b7686ce9f045e0d7b Author: Bruce Guenter Date: Fri Sep 7 12:38:53 2001 +0000 Added ibuf_getstr_crlf object. iobuf/str=l | 1 + 1 file changed, 1 insertion(+) commit 400ff6b5e968186858bbf18571d4ec829ef85712 Author: Bruce Guenter Date: Fri Sep 7 12:38:40 2001 +0000 Added new function ibuf_getstr_crlf, to retrieve [CR]LF terminated strings. iobuf/ibuf_getstr_crlf.c | 15 +++++++++++++++ iobuf/iobuf.h | 4 ++++ 2 files changed, 19 insertions(+) create mode 100644 iobuf/ibuf_getstr_crlf.c commit a6e1f0a1059619f40d2157e39e58e20abadea226 Author: Bruce Guenter Date: Fri Sep 7 12:38:04 2001 +0000 Fixed missing include. iobuf/obuf_write.c | 1 + 1 file changed, 1 insertion(+) commit cf9eab3bb34f89b5441a17d4833af0d1dbaa6b07 Author: Bruce Guenter Date: Fri Sep 7 12:37:32 2001 +0000 Fixed the order of parameters to memmove. str/cut.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 0a4ec19bdbd0e5a9f6bada9ea06727b158f8c874 Author: Bruce Guenter Date: Fri Sep 7 12:36:36 2001 +0000 Added missing objects. str/str=l | 4 ++++ 1 file changed, 4 insertions(+) commit 3ca1dd4503b0f9d18133165e69ea12f9cd802b72 Author: Bruce Guenter Date: Fri Sep 7 12:36:21 2001 +0000 Fixed typo in declaration of str_findnextof macro. str/str.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 32bec39c79aa2310760592bc3baa360b4557937e Author: Bruce Guenter Date: Sat Aug 25 11:14:21 2001 +0000 Added some documentation. cvm-sasl/cvm-sasl.html | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 cvm-sasl/cvm-sasl.html commit 36b415ccfa42ac0a64d5bfb052cf249505f45db8 Author: Bruce Guenter Date: Sat Aug 25 11:14:14 2001 +0000 Modified the list of mechanisms to be a more intelligent linked list. cvm-sasl/cvm-sasl.h | 4 +++- cvm-sasl/init.c | 31 +++++++++++++++++++++++-------- cvm-sasl/start.c | 4 ++-- 3 files changed, 28 insertions(+), 11 deletions(-) commit 6b7e12c3b8caa3e3d245aee3de47211a29878c1d Author: Bruce Guenter Date: Sat Aug 25 02:32:14 2001 +0000 Added extra "parse account" parameter to cvm_authenticate. cvm-sasl/authenticate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 516aec4ef41d452ef416e99448146e0716cf5855 Author: Bruce Guenter Date: Sat Aug 11 04:10:16 2001 +0000 First checkin. cvm-sasl/authenticate.c | 13 +++++++++++++ cvm-sasl/cram_md5.c | 43 +++++++++++++++++++++++++++++++++++++++++++ cvm-sasl/cvm-sasl.h | 33 +++++++++++++++++++++++++++++++++ cvm-sasl/cvm-sasl=l | 6 ++++++ cvm-sasl/init.c | 22 ++++++++++++++++++++++ cvm-sasl/internal.h | 17 +++++++++++++++++ cvm-sasl/login.c | 28 ++++++++++++++++++++++++++++ cvm-sasl/plain.c | 21 +++++++++++++++++++++ cvm-sasl/start.c | 19 +++++++++++++++++++ 9 files changed, 202 insertions(+) create mode 100644 cvm-sasl/authenticate.c create mode 100644 cvm-sasl/cram_md5.c create mode 100644 cvm-sasl/cvm-sasl.h create mode 100644 cvm-sasl/cvm-sasl=l create mode 100644 cvm-sasl/init.c create mode 100644 cvm-sasl/internal.h create mode 100644 cvm-sasl/login.c create mode 100644 cvm-sasl/plain.c create mode 100644 cvm-sasl/start.c commit 0be25083c229b61f60042ec53f14691fec309d1b Author: Bruce Guenter Date: Sat Aug 11 01:55:01 2001 +0000 Added standard routines for loading up dictionaries. dict/load=l | 2 ++ dict/load_list.c | 21 +++++++++++++++++++++ dict/load_map.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 dict/load=l create mode 100644 dict/load_list.c create mode 100644 dict/load_map.c commit 2dd993a3737c56e8719df62536f4c312e489d00d Author: Bruce Guenter Date: Sat Aug 11 01:54:41 2001 +0000 *** empty log message *** dict/dict=l | 1 + 1 file changed, 1 insertion(+) commit 51e2b3221da4cbef116844bd3dad4ccd47a6c9ac Author: Bruce Guenter Date: Sat Aug 11 01:54:31 2001 +0000 Added a convenience function for freeing dictionaries of strings. dict/dict.h | 1 + dict/str_free.c | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 dict/str_free.c commit b090cdd78553f57b8a7e0e6002b20ba2477edaa5 Author: Bruce Guenter Date: Thu Aug 9 09:21:41 2001 +0000 Turned some char* into char[] types, making them constant. cli/cli.h | 8 ++++---- cli/main.c | 10 +++------- 2 files changed, 7 insertions(+), 11 deletions(-) commit 7e17b6dce4bdcf839d660f7dadb98ad506f66841 Author: Bruce Guenter Date: Thu Aug 9 09:20:52 2001 +0000 Removed system-dependant alloca.h include. str/sort.c | 1 - 1 file changed, 1 deletion(-) commit 1fa70ad01788f3abe041472cbcd78550eba90bad Author: Bruce Guenter Date: Thu Aug 9 09:20:33 2001 +0000 Header fixups. socket/accept4.c | 1 + socket/bind4.c | 1 + socket/connect4.c | 1 + socket/getaddr4.c | 1 + socket/recv4.c | 1 + socket/send4.c | 1 + 6 files changed, 6 insertions(+) commit 302752673f5edc4218bc8ce680ea8ceab8dbabb7 Author: Bruce Guenter Date: Thu Aug 9 09:19:42 2001 +0000 First check in of dict library. dict/add.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ dict/dict.h | 33 ++++++++++++++++++++++++ dict/dict=l | 5 ++++ dict/free.c | 19 ++++++++++++++ dict/get.c | 18 +++++++++++++ dict/hash.c | 10 ++++++++ dict/init.c | 8 ++++++ 7 files changed, 177 insertions(+) create mode 100644 dict/add.c create mode 100644 dict/dict.h create mode 100644 dict/dict=l create mode 100644 dict/free.c create mode 100644 dict/get.c create mode 100644 dict/hash.c create mode 100644 dict/init.c commit a565c7bc2c770ee31832041f1a26f00373fa0aa8 Author: Bruce Guenter Date: Thu Aug 9 09:18:51 2001 +0000 First import of CDB library. cdb/cdb.c | 135 ++++++++++++++++++++++++++++++++++++++++++++++ cdb/cdb.h | 37 +++++++++++++ cdb/cdb=l | 3 ++ cdb/cdb_hash.c | 21 ++++++++ cdb/cdb_make.c | 152 ++++++++++++++++++++++++++++++++++++++++++++++++++++ cdb/cdb_make.h | 39 ++++++++++++++ cdb/uint32_unpack.c | 31 +++++++++++ 7 files changed, 418 insertions(+) create mode 100644 cdb/cdb.c create mode 100644 cdb/cdb.h create mode 100644 cdb/cdb=l create mode 100644 cdb/cdb_hash.c create mode 100644 cdb/cdb_make.c create mode 100644 cdb/cdb_make.h create mode 100644 cdb/uint32_unpack.c commit d5992d127c8e31b11e47a64f25c3c51819360af1 Author: Bruce Guenter Date: Thu Aug 9 09:18:10 2001 +0000 First import of base64 library. base64/asc2bin.c | 19 +++++++++++++++++++ base64/base64.h | 20 ++++++++++++++++++++ base64/base64=l | 6 ++++++ base64/bin2asc.c | 3 +++ base64/decode_line.c | 15 +++++++++++++++ base64/decode_part.c | 20 ++++++++++++++++++++ base64/encode_line.c | 18 ++++++++++++++++++ base64/encode_part.c | 26 ++++++++++++++++++++++++++ 8 files changed, 127 insertions(+) create mode 100644 base64/asc2bin.c create mode 100644 base64/base64.h create mode 100644 base64/base64=l create mode 100644 base64/bin2asc.c create mode 100644 base64/decode_line.c create mode 100644 base64/decode_part.c create mode 100644 base64/encode_line.c create mode 100644 base64/encode_part.c commit c8e499c6d45b490ceeacbedd53f7bc54c3f2729d Author: Bruce Guenter Date: Tue Jul 31 10:42:05 2001 +0000 Added options to control matching of dotfiles. path/fnmatch.c | 42 +++++++++++++++++++++++++++++------------- path/match.c | 17 ++++++++--------- path/path.h | 7 +++++-- 3 files changed, 42 insertions(+), 24 deletions(-) commit 62b445c2d8cd6cbb77474991275479f1bf7c9e3c Author: Bruce Guenter Date: Thu Jul 26 03:32:38 2001 +0000 First check-in python/template/TODO | 15 +++ python/template/__init__.py | 34 +++++ python/template/bench-parse | 9 ++ python/template/bench-preparse | 15 +++ python/template/context.py | 66 ++++++++++ python/template/functions.py | 80 ++++++++++++ python/template/lex.py | 68 ++++++++++ python/template/parser.py | 151 ++++++++++++++++++++++ python/template/showtree | 13 ++ python/template/syntax.py | 275 +++++++++++++++++++++++++++++++++++++++++ python/template/template.html | 64 ++++++++++ 11 files changed, 790 insertions(+) create mode 100644 python/template/TODO create mode 100644 python/template/__init__.py create mode 100644 python/template/bench-parse create mode 100644 python/template/bench-preparse create mode 100644 python/template/context.py create mode 100644 python/template/functions.py create mode 100644 python/template/lex.py create mode 100644 python/template/parser.py create mode 100644 python/template/showtree create mode 100644 python/template/syntax.py create mode 100644 python/template/template.html commit dbda59b71edcf26a51ffc1805078e2aa185f201b Author: Bruce Guenter Date: Fri Jul 6 00:23:10 2001 +0000 *** empty log message *** iobuf/TODO | 2 ++ path/TODO | 2 ++ 2 files changed, 4 insertions(+) commit 1fca9e1728ef889887dfdd5ebc605112951398b3 Author: Bruce Guenter Date: Fri Jul 6 00:22:42 2001 +0000 Increase the maximum number of arguments from 4 to 6, and add the PID to all messages. err/message.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) commit 4ed74ac0f950062cd4d4d554f47997c9f58f7d66 Author: Bruce Guenter Date: Fri Jul 6 00:22:16 2001 +0000 Increase the maximum number of arguments from 4 to 6. err/die.c | 4 ++-- err/err.h | 68 ++++++++++++++++++++++++++++++++++++------------------------- err/error.c | 4 ++-- err/warn.c | 4 ++-- 4 files changed, 46 insertions(+), 34 deletions(-) commit cb03d892cccf64b647986e07d0773fe0a8d1da29 Author: Bruce Guenter Date: Fri Jul 6 00:20:27 2001 +0000 Call _exit instead of exit on assertion failure. iobuf/ibuf_refill.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit bdb918724774a0b1e71b2de1001e74ba527276cc Author: Bruce Guenter Date: Fri Jul 6 00:20:09 2001 +0000 Added new function for reading lines into a str. iobuf/{ibuf_gets.c => ibuf_getstr.c} | 9 +++++---- iobuf/iobuf.h | 6 ++++++ iobuf/str=l | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) copy iobuf/{ibuf_gets.c => ibuf_getstr.c} (72%) create mode 100644 iobuf/str=l commit 74b989be489c419c634e6e367e27dad2af79ab4e Author: Bruce Guenter Date: Fri Jul 6 00:18:59 2001 +0000 Added new function obuf_put7s. iobuf/iobuf=l | 1 + iobuf/{obuf_put6s.c => obuf_put7s.c} | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) copy iobuf/{obuf_put6s.c => obuf_put7s.c} (64%) commit cd6f3283d433060d70876766ed7cd90bf6aef9b3 Author: Bruce Guenter Date: Fri Jul 6 00:18:35 2001 +0000 Added missing include of string.h iobuf/ibuf_read.c | 1 + iobuf/iobuf_init.c | 1 + 2 files changed, 2 insertions(+) commit 9cbbb1707f067cd7806a6a408e9e25a258649209 Author: Bruce Guenter Date: Fri Jul 6 00:17:53 2001 +0000 Use iopoll instead of poll directly. iobuf/iobuf_timeout.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) commit aa2601d72c094436cb4cdb8dba15efe8215323db Author: Bruce Guenter Date: Sat Jun 30 03:38:05 2001 +0000 Added routines to sort a list, and to chop bytes off the front or end of a string. str/{copy.c => cut.c} | 29 ++++++++++--------- str/iter.h | 4 ++- str/sort.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++ str/str.h | 3 ++ str/str=l | 2 ++ 5 files changed, 101 insertions(+), 15 deletions(-) copy str/{copy.c => cut.c} (64%) create mode 100644 str/sort.c commit 87ebcb539d28a11de974f4c5a4dfab81c867aae9 Author: Bruce Guenter Date: Sat Jun 30 03:37:21 2001 +0000 Added a routine to get the IPv4 address of a socket. socket/{accept4.c => getaddr4.c} | 18 +++++++++--------- socket/socket.h | 3 ++- socket/socket=l | 1 + 3 files changed, 12 insertions(+), 10 deletions(-) copy socket/{accept4.c => getaddr4.c} (72%) commit 6f1b9dbf08c44ac5c1a8ee7e74c329b05aefca0c Author: Bruce Guenter Date: Fri Jun 29 12:10:22 2001 +0000 Initial revision path/TODO | 6 +++ path/all.spac | 1 + str/lstrip.c => path/contains.c | 26 +++++++---- path/fnmatch.c | 72 +++++++++++++++++++++++++++++ path/match.c | 100 ++++++++++++++++++++++++++++++++++++++++ path/merge.c | 62 +++++++++++++++++++++++++ path/path.h | 12 +++++ path/path=l | 4 ++ path/test.c | 28 +++++++++++ path/test.exp | 8 ++++ path/test=x | 4 ++ 11 files changed, 314 insertions(+), 9 deletions(-) create mode 100644 path/TODO create mode 100644 path/all.spac copy str/lstrip.c => path/contains.c (62%) create mode 100644 path/fnmatch.c create mode 100644 path/match.c create mode 100644 path/merge.c create mode 100644 path/path.h create mode 100644 path/path=l create mode 100644 path/test.c create mode 100644 path/test.exp create mode 100644 path/test=x commit c4b6c8d42729e899cd63bffec7f0329214a2d5af Author: Bruce Guenter Date: Fri Jun 15 04:13:50 2001 +0000 Added missing object files. str/str=l | 2 ++ 1 file changed, 2 insertions(+) commit 7fd33ffd1e9b24a49a2afa2767acec1882fd28d7 Author: Bruce Guenter Date: Fri Jun 15 04:13:35 2001 +0000 Fixed a typo in the loop. str/diff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 6c4710ca4fa04771c6d5d9422781430fc8f0ede6 Author: Bruce Guenter Date: Fri Jun 15 04:13:20 2001 +0000 Use memmove instead of memcpy due to the fact that the strings will be overlapping. str/lstrip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) commit 8920457597f7f7930b69acad2d0da0754a7f2f68 Author: Bruce Guenter Date: Fri Jun 15 04:12:51 2001 +0000 Need to include string.h str/realloc.c | 1 + 1 file changed, 1 insertion(+) commit 1973ff1006aadb9ef802ff813a7878eca00e4be3 Author: Bruce Guenter Date: Fri Jun 15 04:12:39 2001 +0000 Fixed the ordering of the digits and properly inserted padding. str/catiw.c | 16 ++++++++-------- str/catuw.c | 14 ++++++++------ 2 files changed, 16 insertions(+), 14 deletions(-) commit 3f54f7b75b27de70bf9e7684b8da8f18529d9a9a Author: Bruce Guenter Date: Fri Mar 30 21:30:36 2001 +0000 Added striter functions to this library. str/iter.h | 22 ++++++++++++++++++++++ str/iter=l | 3 +++ str/iter_advance.c | 15 +++++++++++++++ str/iter_start.c | 12 ++++++++++++ str/iter_valid.c | 6 ++++++ 5 files changed, 58 insertions(+) create mode 100644 str/iter.h create mode 100644 str/iter=l create mode 100644 str/iter_advance.c create mode 100644 str/iter_start.c create mode 100644 str/iter_valid.c commit 3060e87a70c30dbde6b41b7edbce6f67c4cc7133 Author: Bruce Guenter Date: Thu Mar 29 03:03:05 2001 +0000 Added string comparison functions. str/{copy.c => cmp.c} | 23 ++++++++++++----------- str/{copy.c => diff.c} | 26 +++++++++++++++----------- 2 files changed, 27 insertions(+), 22 deletions(-) copy str/{copy.c => cmp.c} (61%) copy str/{copy.c => diff.c} (62%) commit cc51c9a7c63a3d6d0e9d52fc817cde2c7cfac79e Author: Bruce Guenter Date: Thu Mar 29 03:02:57 2001 +0000 *** empty log message *** str/str.h | 10 ++++++++++ str/str=l | 3 +++ 2 files changed, 13 insertions(+) commit 72615eb817b5a395da3eb5830a0498d9d6e748a4 Author: Bruce Guenter Date: Thu Mar 29 03:02:36 2001 +0000 Added a string truncation function, different than reallocation or readying. str/{free.c => truncate.c} | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) copy str/{free.c => truncate.c} (78%) commit fcc5ea622709407156735cc0a7b3ba4386e9ac9e Author: Bruce Guenter Date: Wed Mar 28 21:28:05 2001 +0000 Added new functions to handle UNIX-domain sockets. socket/{accept4.c => acceptu.c} | 10 ++++------ socket/{bind4.c => bindu.c} | 17 +++++++++-------- socket/{connect4.c => connectu.c} | 14 ++++++-------- socket/{udp.c => recvu.c} | 8 +++----- socket/{udp.c => sendu.c} | 8 +++----- socket/{udp.c => unixdgm.c} | 6 +++--- socket/{udp.c => unixstr.c} | 6 +++--- 7 files changed, 31 insertions(+), 38 deletions(-) copy socket/{accept4.c => acceptu.c} (81%) copy socket/{bind4.c => bindu.c} (76%) copy socket/{connect4.c => connectu.c} (77%) copy socket/{udp.c => recvu.c} (83%) copy socket/{udp.c => sendu.c} (83%) copy socket/{udp.c => unixdgm.c} (88%) copy socket/{udp.c => unixstr.c} (88%) commit 6e9bdb8b2ca6ff533151ac65dec654bff1914d54 Author: Bruce Guenter Date: Wed Mar 28 21:27:52 2001 +0000 Added new functions. socket/socket.h | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) commit 5a2cd49dfef1210a66d12612f4f28d5a381fade5 Author: Bruce Guenter Date: Wed Mar 28 21:27:41 2001 +0000 Added new routine to shut down sockets. socket/{reuse.c => shutdown.c} | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) copy socket/{reuse.c => shutdown.c} (75%) commit 2ef0b30ef2c2fd087220b5f96972c7410fe95dca Author: Bruce Guenter Date: Wed Mar 28 21:27:11 2001 +0000 *** empty log message *** socket/socket=l | 10 ++++++++++ 1 file changed, 10 insertions(+) commit 6142295d98652a24c633f4fcfa0e618e2f2217fb Author: Bruce Guenter Date: Wed Mar 28 21:26:34 2001 +0000 Don't handle interrupted connections. socket/connect4.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) commit 0ec5938062fb4370b36d5793a6da74d83eae41c5 Author: Bruce Guenter Date: Wed Mar 28 21:26:16 2001 +0000 Added source for ipv4 address constants. socket/ipv4addr.c | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 socket/ipv4addr.c commit 56b6f87bd799be4534665866a1ecea1dcb607cf8 Author: Bruce Guenter Date: Wed Mar 28 21:25:42 2001 +0000 Added function to set broadcast mode flag. socket/{reuse.c => broadcast.c} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) copy socket/{reuse.c => broadcast.c} (85%) commit 3dd96670ed3d7b40def8645d5d2afd9ac78fe0a7 Author: Bruce Guenter Date: Wed Mar 28 21:25:08 2001 +0000 Removed unnecessary include. socket/reuse.c | 1 - 1 file changed, 1 deletion(-) commit 786b221b28a272e48baa7aac1cb741bacfc8fa8b Author: Bruce Guenter Date: Wed Mar 28 21:24:31 2001 +0000 Don't automatically set non-blocking mode on new sockets. socket/tcp.c | 9 +-------- socket/udp.c | 9 +-------- 2 files changed, 2 insertions(+), 16 deletions(-) commit 9e080527efeb178c98eeae5039d1f6686e3b3f91 Author: Bruce Guenter Date: Thu Mar 8 22:24:04 2001 +0000 Removed unused argc parameter in parse_long. cli/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) commit d7ca9b7d4ee3f7c9fbd7cf0c199c211d4b2ca2b8 Author: Bruce Guenter Date: Thu Mar 8 22:22:39 2001 +0000 Added some unsigned type conversions to remove warnings. iobuf/ibuf_read.c | 3 ++- iobuf/ibuf_refill.c | 2 +- iobuf/obuf_flush.c | 2 +- iobuf/obuf_write.c | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) commit 4fd9b9f507843f0ae27d6b8349092f85bc12b754 Author: Bruce Guenter Date: Thu Mar 8 22:22:11 2001 +0000 Added missing "do_close" initializer. iobuf/ibuf_stdin.c | 2 +- iobuf/obuf_stderr.c | 2 +- iobuf/obuf_stdout.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) commit 10fb0e1a72cabe943c0575ca205753b794c671a7 Author: Bruce Guenter Date: Thu Mar 8 21:45:06 2001 +0000 The position has to be a signed integer, not unsigned. str/count.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit df2e60bbfb2f55564ad635551b6f23566f895923 Author: Bruce Guenter Date: Thu Mar 8 21:43:39 2001 +0000 Added new multi-string copy functions. str/{cat2s.c => copy2s.c} | 8 ++++---- str/{cat3s.c => copy3s.c} | 8 ++++---- str/{cat4s.c => copy4s.c} | 10 +++++----- str/{cat5s.c => copy5s.c} | 10 +++++----- str/{cat6s.c => copy6s.c} | 10 +++++----- 5 files changed, 23 insertions(+), 23 deletions(-) copy str/{cat2s.c => copy2s.c} (84%) copy str/{cat3s.c => copy3s.c} (83%) copy str/{cat4s.c => copy4s.c} (82%) copy str/{cat5s.c => copy5s.c} (82%) copy str/{cat6s.c => copy6s.c} (82%) commit f943573980293ba4e9db68cf3e3097f5f84b624e Author: Bruce Guenter Date: Thu Mar 8 21:43:26 2001 +0000 Added new multi-string catenation functions. str/{copy.c => cat2s.c} | 26 ++++++++++---------------- str/{copy.c => cat3s.c} | 28 ++++++++++++---------------- str/{copy.c => cat4s.c} | 31 +++++++++++++++---------------- str/{copy.c => cat5s.c} | 33 +++++++++++++++++---------------- str/{copy.c => cat6s.c} | 35 +++++++++++++++++++---------------- 5 files changed, 73 insertions(+), 80 deletions(-) copy str/{copy.c => cat2s.c} (70%) copy str/{copy.c => cat3s.c} (65%) copy str/{copy.c => cat4s.c} (61%) copy str/{copy.c => cat5s.c} (57%) copy str/{copy.c => cat6s.c} (54%) commit b0230e8de88e0af9e392ab86fb1fac0325bc89f6 Author: Bruce Guenter Date: Thu Mar 8 21:43:06 2001 +0000 Added new functions. str/str.h | 11 +++++++++++ str/str=l | 17 +++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) commit fcfa23f1dc7099a31c3f0479af06a1e5d0a32f1a Author: Bruce Guenter Date: Thu Mar 8 21:42:52 2001 +0000 Removed the memory copy and actually free the old memory block. str/ready.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) commit e52405d904c7c19f91034fbb183e384769632c55 Author: Bruce Guenter Date: Thu Mar 8 21:42:22 2001 +0000 Added new "str_realloc" function that does the memory copy that "str_ready" used to do. str/cat.c | 4 ++-- str/catiw.c | 2 +- str/catuw.c | 2 +- str/join.c | 2 +- str/{ready.c => realloc.c} | 8 +++++--- 5 files changed, 10 insertions(+), 8 deletions(-) copy str/{ready.c => realloc.c} (88%) commit a8b47e78b50b34fe82e5647292234a90a17507bf Author: Bruce Guenter Date: Thu Mar 8 03:35:32 2001 +0000 Initial revision str/findnext.c => socket/accept4.c | 25 ++++++++++++++++--------- str/buildmap.c => socket/bind4.c | 22 +++++++++++++--------- str/buildmap.c => socket/connect4.c | 25 ++++++++++++++++--------- str/free.c => socket/listen.c | 16 ++++++++-------- str/lstrip.c => socket/recv4.c | 26 +++++++++++++++++--------- str/init.c => socket/reuse.c | 20 ++++++++++---------- str/buildmap.c => socket/send4.c | 23 ++++++++++++++--------- socket/socket.h | 19 +++++++++++++++++++ socket/socket=l | 9 +++++++++ str/lstrip.c => socket/tcp.c | 24 +++++++++++++++--------- str/lstrip.c => socket/udp.c | 24 +++++++++++++++--------- 11 files changed, 152 insertions(+), 81 deletions(-) copy str/findnext.c => socket/accept4.c (63%) copy str/buildmap.c => socket/bind4.c (64%) copy str/buildmap.c => socket/connect4.c (60%) copy str/free.c => socket/listen.c (76%) copy str/lstrip.c => socket/recv4.c (61%) copy str/init.c => socket/reuse.c (73%) copy str/buildmap.c => socket/send4.c (60%) create mode 100644 socket/socket.h create mode 100644 socket/socket=l copy str/lstrip.c => socket/tcp.c (68%) copy str/lstrip.c => socket/udp.c (68%) commit 0a1620e839bb98164334927511a50f72784e9476 Author: Bruce Guenter Date: Thu Mar 8 03:15:10 2001 +0000 Added SPAC library file. cli/cli=l | 1 + 1 file changed, 1 insertion(+) create mode 100644 cli/cli=l commit f6801224fee06fa9b0e33604c419db4ff0bd3b30 Author: Bruce Guenter Date: Thu Mar 8 03:14:06 2001 +0000 Converted to a C-based implementation (the C++ version is now in lib/cli++). cli/ChangeLog | 119 ------------------- cli/Makefile.am | 9 -- cli/cli.h | 45 +++----- cli/clitest.cc | 47 -------- cli/main.c | 348 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ cli/main.cc | 342 ------------------------------------------------------- cli/messages.cc | 44 ------- 7 files changed, 365 insertions(+), 589 deletions(-) delete mode 100644 cli/ChangeLog delete mode 100644 cli/Makefile.am delete mode 100644 cli/clitest.cc create mode 100644 cli/main.c delete mode 100644 cli/main.cc delete mode 100644 cli/messages.cc commit 73f814a111404651633a3091a1e358839ae94ce5 Author: Bruce Guenter Date: Thu Mar 8 01:30:28 2001 +0000 Renamed lib to libcli++.a cli++/Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) commit e08db0201b6cca7d0c2c626a173c264153e0b31f Author: Bruce Guenter Date: Thu Mar 8 01:24:58 2001 +0000 Renamed cli2pod.pl to cli++topod.pl cli++/{cli2pod.pl => cli++topod.pl} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename cli++/{cli2pod.pl => cli++topod.pl} (100%) commit a8cdc521d0a80613b308d12484faf72a586cb4e0 Author: Bruce Guenter Date: Thu Mar 8 01:24:10 2001 +0000 Renamed cli.h to cli++.h cli++/ChangeLog | 4 ++++ cli++/Makefile.am | 2 +- cli++/clitest.cc | 2 +- cli++/main.cc | 2 +- cli++/messages.cc | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) commit c1e754b9fee20c783e0a609c77863ab5bff7007f Author: Bruce Guenter Date: Thu Mar 8 01:22:36 2001 +0000 Renamed cli to cli++ cli++/{cli.h => cli++.h} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename cli++/{cli.h => cli++.h} (92%) commit 55a9eea8c56ede0fb8d65d588b59b8fba9080fe6 Author: Bruce Guenter Date: Wed Mar 7 20:45:28 2001 +0000 Call iobuf_close even if obuf_flush fails. iobuf/obuf_close.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) commit 05768530fcebb10e33060fadea601d76e97048a4 Author: Bruce Guenter Date: Mon Mar 5 04:25:26 2001 +0000 Fixed error checking logic. iobuf/ibuf_getc.c | 4 ++-- iobuf/ibuf_gets.c | 15 +++++++++------ iobuf/ibuf_peek.c | 4 ++-- iobuf/ibuf_read.c | 19 +++++++++---------- iobuf/ibuf_refill.c | 8 ++++++-- 5 files changed, 28 insertions(+), 22 deletions(-) commit 8dffb162e5d8a447627762fa4d48c0a4b1dd1a32 Author: Bruce Guenter Date: Sun Mar 4 11:11:34 2001 +0000 Fixed typos. iobuf/ibuf_peek.c | 2 +- iobuf/ibuf_read.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) commit 51aa07a54138ebbfcea53e4b0cd00cfc79877e57 Author: Bruce Guenter Date: Sun Mar 4 11:10:13 2001 +0000 Take into account timeout in refill. Simplified some logic. iobuf/ibuf_gets.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) commit b4c0882a62a1efa1cb15ea8c57af914066e29e16 Author: Bruce Guenter Date: Sun Mar 4 11:09:35 2001 +0000 Take into account error conditions and EOF. iobuf/ibuf_peek.c | 2 +- iobuf/ibuf_read.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) commit 81ce9ca40b028fef0269470f08bf2dfe0101f4b2 Author: Bruce Guenter Date: Sun Mar 4 11:06:17 2001 +0000 Take into account timeout. iobuf/ibuf_getc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit 95fbd99705702a349e407e1a59c79c187e340099 Author: Bruce Guenter Date: Sun Mar 4 11:05:52 2001 +0000 Fixed the logic used so it will actually return, and simplified the loop. iobuf/iobuf_timeout.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) commit b62d2a8bf3f4bec68f511c9d7a6f3c0677572ccf Author: Bruce Guenter Date: Sun Mar 4 02:11:32 2001 +0000 Use new IOBUF_SET_ERROR macro. iobuf/ibuf_seek.c | 7 ++----- iobuf/obuf_sync.c | 6 +----- 2 files changed, 3 insertions(+), 10 deletions(-) commit 722759e641151222fa8fe9f7a19963f8ec7d0039 Author: Bruce Guenter Date: Sun Mar 4 02:11:22 2001 +0000 Added missing object files. iobuf/iobuf=l | 6 ++++++ 1 file changed, 6 insertions(+) commit 8c86c2b094c03fb1c33097bda1f6cc20fcafd212 Author: Bruce Guenter Date: Sun Mar 4 02:11:09 2001 +0000 Bulk-zero the iobuf structure before setting any values. iobuf/iobuf_init.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) commit 705e6979a9a4814b10844e143274950c29823a30 Author: Bruce Guenter Date: Sun Mar 4 02:10:52 2001 +0000 Added timeout handling. iobuf/ibuf_read.c | 8 +++----- iobuf/ibuf_refill.c | 7 +++---- iobuf/iobuf.h | 15 ++++++++++++++- iobuf/iobuf_timeout.c | 24 ++++++++++++++++++++++++ iobuf/obuf_flush.c | 7 ++----- iobuf/obuf_write.c | 8 ++------ 6 files changed, 48 insertions(+), 21 deletions(-) create mode 100644 iobuf/iobuf_timeout.c commit 08b223eafc63fc350a66bbc4a2ffba75b37c821a Author: Bruce Guenter Date: Thu Mar 1 10:45:55 2001 +0000 Updated the comment. str/str.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) commit 306d420a298bd64de9e4344002ef07754a82dff0 Author: Bruce Guenter Date: Thu Mar 1 10:43:32 2001 +0000 Renamed STR_MINSIZE and STR_ROUNDSIZE to STR_BLOCKSIZE. str/init.c | 4 ++-- str/str.h | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) commit 2b32727bfcae1dc55de222fcad50b83d91dbd4f1 Author: Bruce Guenter Date: Thu Mar 1 10:43:13 2001 +0000 Modified the allocation policy to overallocate 1/8 of the requested size (rounded up to STR_BLOCKSIZE) in anticipation of future concatenations. str/ready.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) commit 2e41e5b0abceb5cf8fe026e427fc56e9cb4da369 Author: Bruce Guenter Date: Thu Mar 1 09:14:41 2001 +0000 Modified these functions to conditionally output the strings if they are non-null. iobuf/obuf_put2s.c | 4 +++- iobuf/obuf_put3s.c | 7 ++++--- iobuf/obuf_put4s.c | 10 +++++----- iobuf/obuf_put5s.c | 12 ++++++------ iobuf/obuf_put6s.c | 14 +++++++------- 5 files changed, 25 insertions(+), 22 deletions(-) commit a5e3cb4c8e7c133cbe499199d8b17925414c9808 Author: Bruce Guenter Date: Thu Mar 1 09:01:31 2001 +0000 Added 2 to 6 multi-string convenience output functions. iobuf/iobuf.h | 8 ++++++++ iobuf/obuf_put2s.c | 7 +++++++ iobuf/obuf_put3s.c | 9 +++++++++ iobuf/obuf_put4s.c | 12 ++++++++++++ iobuf/obuf_put5s.c | 13 +++++++++++++ iobuf/obuf_put6s.c | 14 ++++++++++++++ 6 files changed, 63 insertions(+) create mode 100644 iobuf/obuf_put2s.c create mode 100644 iobuf/obuf_put3s.c create mode 100644 iobuf/obuf_put4s.c create mode 100644 iobuf/obuf_put5s.c create mode 100644 iobuf/obuf_put6s.c commit dc889e2234341bf39b14ebcbde4f3c26c6cab21f Author: Bruce Guenter Date: Thu Mar 1 02:04:01 2001 +0000 *** empty log message *** iobuf/TODO | 1 + 1 file changed, 1 insertion(+) commit 754741cd532923e1b6c4beee8fa62ab6a30865fb Author: Bruce Guenter Date: Thu Mar 1 02:03:57 2001 +0000 Rewrote the tests. iobuf/test.c | 28 ++++++++++++++++++++-------- iobuf/test.exp | 19 ++++++++++++++----- 2 files changed, 34 insertions(+), 13 deletions(-) commit 7e6f720939ef851f05b50c561c7700d3f92228c0 Author: Bruce Guenter Date: Thu Mar 1 01:50:33 2001 +0000 Added tests for the put[ui]w functions. iobuf/test.c | 6 +++++- iobuf/test.exp | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 iobuf/test.exp commit 840dc2cfb465aa4cfac6bb1c3c767d51d43ad3d4 Author: Bruce Guenter Date: Thu Mar 1 01:48:16 2001 +0000 Fixed padding of numbers, and added support for non-space padding. iobuf/iobuf.h | 8 ++++---- iobuf/obuf_putiw.c | 37 +++++++++++++++++++++++++++++++++---- iobuf/obuf_putuw.c | 5 ++--- 3 files changed, 39 insertions(+), 11 deletions(-) commit d66f7af117abe3e58b50993e240c092ab44dcb96 Author: Bruce Guenter Date: Thu Mar 1 01:30:11 2001 +0000 Allow for non-space padding. iobuf/obuf_putuw.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) commit daa39c5ca5adceca8473edd8a4ea260f60c3a65d Author: Bruce Guenter Date: Thu Mar 1 01:15:49 2001 +0000 Removed the conditional modification of the str, as it will have virtually no impact on performance. str/rstrip.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) commit a32f501fd41fac4d977f6121fe63ea33a1355c19 Author: Bruce Guenter Date: Thu Mar 1 00:55:34 2001 +0000 Various prototype changes. str/str.h | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) commit 36dff908b79bf5cab24f7640e3872ae529fa1194 Author: Bruce Guenter Date: Thu Mar 1 00:55:23 2001 +0000 Added new modification functions. str/{cat.c => join.c} | 40 +++++++++++++++++++++++----------------- str/{free.c => lower.c} | 14 +++++++------- str/{free.c => lstrip.c} | 16 +++++++++------- str/{free.c => rstrip.c} | 16 +++++++++------- str/{free.c => subst.c} | 14 +++++++------- str/{free.c => upper.c} | 14 +++++++------- 6 files changed, 62 insertions(+), 52 deletions(-) copy str/{cat.c => join.c} (55%) copy str/{free.c => lower.c} (78%) copy str/{free.c => lstrip.c} (75%) copy str/{free.c => rstrip.c} (76%) copy str/{free.c => subst.c} (77%) copy str/{free.c => upper.c} (78%) commit 20cfd23f7560e7a0aeb281399b59e27a8ff4003b Author: Bruce Guenter Date: Thu Mar 1 00:55:06 2001 +0000 Made the source str targets const. str/cat.c | 2 +- str/copy.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) commit ea8a5b62a69675004320b2e36a31c83e3daf9638 Author: Bruce Guenter Date: Thu Mar 1 00:51:59 2001 +0000 Removed these extraneous functions. str/findfirst.c | 27 --------------------------- str/findfirstof.c | 30 ------------------------------ str/findlast.c | 26 -------------------------- str/findlastof.c | 28 ---------------------------- 4 files changed, 111 deletions(-) delete mode 100644 str/findfirst.c delete mode 100644 str/findfirstof.c delete mode 100644 str/findlast.c delete mode 100644 str/findlastof.c commit b17c4d448ec2f3c7bfe477367d94da376090f9df Author: Bruce Guenter Date: Thu Mar 1 00:16:30 2001 +0000 Made the string parameter constant for search functions. str/findfirst.c | 2 +- str/findfirstof.c | 2 +- str/findlast.c | 2 +- str/findlastof.c | 2 +- str/findnext.c | 2 +- str/findnextof.c | 2 +- str/findprev.c | 2 +- str/findprevof.c | 2 +- str/str.h | 18 ++++++++++-------- 9 files changed, 18 insertions(+), 16 deletions(-) commit 230b385715be58ac916fc856500a59ce36ef62be Author: Bruce Guenter Date: Thu Mar 1 00:16:11 2001 +0000 *** empty log message *** str/str=l | 6 ++++++ 1 file changed, 6 insertions(+) commit 02355232772f9d82f07b5a84b11212d1f95d8410 Author: Bruce Guenter Date: Thu Mar 1 00:15:55 2001 +0000 Added counting functions. str/{findnext.c => count.c} | 18 ++++++++++-------- str/{findfirstof.c => countof.c} | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 16 deletions(-) copy str/{findnext.c => count.c} (75%) copy str/{findfirstof.c => countof.c} (73%) commit 5347cfc2d2dba1e61a34f160624ea38ee1193fb6 Author: Bruce Guenter Date: Wed Feb 28 23:10:57 2001 +0000 Added the find{last,prev}{,of} functions. str/TODO | 2 +- str/{findfirst.c => findlast.c} | 11 +++++------ str/{findfirstof.c => findlastof.c} | 12 +++++------- str/{init.c => findprev.c} | 15 ++++++--------- str/{findfirstof.c => findprevof.c} | 13 ++++++------- str/str.h | 8 ++++---- 6 files changed, 27 insertions(+), 34 deletions(-) copy str/{findfirst.c => findlast.c} (81%) copy str/{findfirstof.c => findlastof.c} (79%) copy str/{init.c => findprev.c} (77%) copy str/{findfirstof.c => findprevof.c} (76%) commit 96fa4548b84674f9848fc1df1315e621806a10ad Author: Bruce Guenter Date: Wed Feb 28 22:58:00 2001 +0000 Made the minsize and roundsize globals into defines. str/str.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) commit a11ee7f2012845d02f22df56ec72c58c5efccee5 Author: Bruce Guenter Date: Wed Feb 28 22:57:38 2001 +0000 NUL-terminate the string after modifying it. str/cat.c | 2 ++ str/catiw.c | 1 + str/catuw.c | 1 + str/copy.c | 1 + str/init.c | 7 +++---- 5 files changed, 8 insertions(+), 4 deletions(-) commit acff424a88443f5c71c22893114f9aa7932cf16c Author: Bruce Guenter Date: Wed Feb 28 22:57:09 2001 +0000 Always make sure there is size+1 bytes of space available. str/ready.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) commit 87044467fa1a9ec5602eefd760d76ca936818d7a Author: Bruce Guenter Date: Wed Feb 28 11:44:01 2001 +0000 Added routines to append signed and unsigned numbers. str/{ready.c => catiw.c} | 42 ++++++++++++++++++++++++++++-------------- str/{findfirstof.c => catuw.c} | 25 ++++++++++++++++--------- str/str.h | 4 ++++ 3 files changed, 48 insertions(+), 23 deletions(-) copy str/{ready.c => catiw.c} (51%) copy str/{findfirstof.c => catuw.c} (63%) commit d518476bc483aed438bc47c1b617e8fb48884b4c Author: Bruce Guenter Date: Wed Feb 28 05:49:50 2001 +0000 Initial revision err/die.c | 10 +++++ err/err.h | 41 +++++++++++++++++++ err/err=l | 4 ++ err/error.c | 7 ++++ err/message.c | 25 ++++++++++++ err/test.c | 11 +++++ err/test=x | 2 + err/warn.c | 7 ++++ iobuf/TODO | 7 ++++ iobuf/ibuf_getc.c | 13 ++++++ iobuf/ibuf_gets.c | 15 +++++++ iobuf/ibuf_getu.c | 16 ++++++++ iobuf/ibuf_init.c | 7 ++++ iobuf/ibuf_open.c | 13 ++++++ iobuf/ibuf_peek.c | 11 +++++ iobuf/ibuf_read.c | 63 +++++++++++++++++++++++++++++ iobuf/ibuf_refill.c | 37 +++++++++++++++++ iobuf/ibuf_seek.c | 28 +++++++++++++ iobuf/ibuf_status.c | 7 ++++ iobuf/ibuf_stdin.c | 5 +++ iobuf/ibuf_tell.c | 8 ++++ iobuf/iobuf.h | 101 ++++++++++++++++++++++++++++++++++++++++++++++ iobuf/iobuf=l | 30 ++++++++++++++ iobuf/iobuf_close.c | 17 ++++++++ iobuf/iobuf_copy.c | 19 +++++++++ iobuf/iobuf_init.c | 25 ++++++++++++ iobuf/obuf_close.c | 7 ++++ iobuf/obuf_endl.c | 6 +++ iobuf/obuf_flush.c | 26 ++++++++++++ iobuf/obuf_init.c | 8 ++++ iobuf/obuf_open.c | 9 +++++ iobuf/obuf_pad.c | 10 +++++ iobuf/obuf_putc.c | 16 ++++++++ iobuf/obuf_putiw.c | 11 +++++ iobuf/obuf_putnetstring.c | 10 +++++ iobuf/obuf_putsflush.c | 7 ++++ iobuf/obuf_putuw.c | 23 +++++++++++ iobuf/obuf_stderr.c | 5 +++ iobuf/obuf_stdout.c | 5 +++ iobuf/obuf_sync.c | 16 ++++++++ iobuf/obuf_write.c | 57 ++++++++++++++++++++++++++ iobuf/test.c | 11 +++++ iobuf/test=x | 1 + str/TODO | 1 + str/buildmap.c | 28 +++++++++++++ str/cat.c | 44 ++++++++++++++++++++ str/copy.c | 37 +++++++++++++++++ str/findfirst.c | 27 +++++++++++++ str/findfirstof.c | 30 ++++++++++++++ str/findnext.c | 28 +++++++++++++ str/findnextof.c | 31 ++++++++++++++ str/free.c | 27 +++++++++++++ str/init.c | 31 ++++++++++++++ str/ready.c | 36 +++++++++++++++++ str/str.h | 35 ++++++++++++++++ str/str=l | 10 +++++ str/test.c | 32 +++++++++++++++ str/test.exp | 11 +++++ str/test=x | 1 + 59 files changed, 1166 insertions(+) create mode 100644 err/die.c create mode 100644 err/err.h create mode 100644 err/err=l create mode 100644 err/error.c create mode 100644 err/message.c create mode 100644 err/test.c create mode 100644 err/test=x create mode 100644 err/warn.c create mode 100644 iobuf/TODO create mode 100644 iobuf/ibuf_getc.c create mode 100644 iobuf/ibuf_gets.c create mode 100644 iobuf/ibuf_getu.c create mode 100644 iobuf/ibuf_init.c create mode 100644 iobuf/ibuf_open.c create mode 100644 iobuf/ibuf_peek.c create mode 100644 iobuf/ibuf_read.c create mode 100644 iobuf/ibuf_refill.c create mode 100644 iobuf/ibuf_seek.c create mode 100644 iobuf/ibuf_status.c create mode 100644 iobuf/ibuf_stdin.c create mode 100644 iobuf/ibuf_tell.c create mode 100644 iobuf/iobuf.h create mode 100644 iobuf/iobuf=l create mode 100644 iobuf/iobuf_close.c create mode 100644 iobuf/iobuf_copy.c create mode 100644 iobuf/iobuf_init.c create mode 100644 iobuf/obuf_close.c create mode 100644 iobuf/obuf_endl.c create mode 100644 iobuf/obuf_flush.c create mode 100644 iobuf/obuf_init.c create mode 100644 iobuf/obuf_open.c create mode 100644 iobuf/obuf_pad.c create mode 100644 iobuf/obuf_putc.c create mode 100644 iobuf/obuf_putiw.c create mode 100644 iobuf/obuf_putnetstring.c create mode 100644 iobuf/obuf_putsflush.c create mode 100644 iobuf/obuf_putuw.c create mode 100644 iobuf/obuf_stderr.c create mode 100644 iobuf/obuf_stdout.c create mode 100644 iobuf/obuf_sync.c create mode 100644 iobuf/obuf_write.c create mode 100644 iobuf/test.c create mode 100644 iobuf/test=x create mode 100644 str/TODO create mode 100644 str/buildmap.c create mode 100644 str/cat.c create mode 100644 str/copy.c create mode 100644 str/findfirst.c create mode 100644 str/findfirstof.c create mode 100644 str/findnext.c create mode 100644 str/findnextof.c create mode 100644 str/free.c create mode 100644 str/init.c create mode 100644 str/ready.c create mode 100644 str/str.h create mode 100644 str/str=l create mode 100644 str/test.c create mode 100644 str/test.exp create mode 100644 str/test=x commit b61b4d8a5596038aaa33cbb8962685864bdf9c14 Author: Bruce Guenter Date: Tue Nov 21 08:52:44 2000 +0000 New mmap-based CDB implementation continues. cdb++/ChangeLog | 4 +++ cdb++/cdb++.h | 11 ++++----- cdb++/cdb_get.cc | 70 +++++++++++++++++------------------------------------ cdb++/cdb_reader.cc | 53 ++++++++++++++++++++-------------------- 4 files changed, 57 insertions(+), 81 deletions(-) commit d128b15654542c11831720699674752cbd8b604e Author: Bruce Guenter Date: Thu Oct 26 02:20:11 2000 +0000 Fixed minor bug in parsing the terminating option. cli++/ChangeLog | 4 ++++ cli++/cli2pod.pl | 1 + cli/ChangeLog | 4 ++++ cli/cli2pod.pl | 1 + 4 files changed, 10 insertions(+) commit 660a28a5a45e7650a16cc96c478af603f2aa68c7 Author: Bruce Guenter Date: Mon Oct 2 23:21:41 2000 +0000 Added some missing includes. mystring/append.cc | 1 + 1 file changed, 1 insertion(+) commit 7f9e7eb6f54801eafe57ee2bd45f7d84c4195222 Author: Bruce Guenter Date: Sun Sep 24 02:11:07 2000 +0000 Added cli2pod.pl to EXTRA_DIST. cli++/Makefile.am | 2 +- cli/Makefile.am | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) commit e92e935e648a43b351b53497168a1a69c7f3f158 Author: Bruce Guenter Date: Tue Aug 22 23:26:10 2000 +0000 Fixed up the error number accessor. fdbuf/ChangeLog | 4 ++-- fdbuf/fdbuf.h | 1 - fdbuf/fdibuf.h | 1 + fdbuf/fdobuf.h | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) commit e6bf1285aa25dacac5c19fd076b787bd54e4bc44 Author: Bruce Guenter Date: Tue Aug 22 23:21:56 2000 +0000 Added an error number accessor. fdbuf/ChangeLog | 5 +++++ fdbuf/fdbuf.h | 1 + 2 files changed, 6 insertions(+) commit 9252b9ee8831cd00e8f673da90cb034ceb0d20ad Author: Bruce Guenter Date: Wed Aug 16 11:28:05 2000 +0000 Reorganized the logic slightly. cli++/cli2pod.pl | 12 ++++++++---- cli/cli2pod.pl | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) commit fb0db00e6f9b4f3050ba22fad96b8e0eadc72968 Author: Bruce Guenter Date: Wed Aug 16 10:28:01 2000 +0000 *** empty log message *** cli++/cli2pod.pl | 6 +++--- cli/cli2pod.pl | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) commit 1d4ce65b9971138e8eed2fe6e986318b80c3c435 Author: Bruce Guenter Date: Wed Aug 16 07:58:02 2000 +0000 Replaced all the CLI documentation generators with cli2pod.pl cli++/ChangeLog | 15 ++++ cli++/cli2html.pl | 84 ---------------------- cli++/cli2man.pl | 73 ------------------- cli++/cli2pod.pl | 208 +++++++++++++++++++++++++++++++++++++++++++++++++++++ cli++/cli_parse.pl | 145 ------------------------------------- cli/ChangeLog | 15 ++++ cli/cli2html.pl | 84 ---------------------- cli/cli2man.pl | 73 ------------------- cli/cli2pod.pl | 208 +++++++++++++++++++++++++++++++++++++++++++++++++++++ cli/cli_parse.pl | 145 ------------------------------------- 10 files changed, 446 insertions(+), 604 deletions(-) delete mode 100644 cli++/cli2html.pl delete mode 100644 cli++/cli2man.pl create mode 100644 cli++/cli2pod.pl delete mode 100644 cli++/cli_parse.pl delete mode 100644 cli/cli2html.pl delete mode 100644 cli/cli2man.pl create mode 100644 cli/cli2pod.pl delete mode 100644 cli/cli_parse.pl commit 9ab606591c47aa5d277a1d76d3dfc009bfa3c861 Author: Bruce Guenter Date: Sun Aug 13 12:18:44 2000 +0000 Fixed description paragraph parsing some. cli++/ChangeLog | 4 ++++ cli++/cli_parse.pl | 16 +++++++++++----- cli/ChangeLog | 4 ++++ cli/cli_parse.pl | 16 +++++++++++----- 4 files changed, 30 insertions(+), 10 deletions(-) commit 56e2c7faa4099b95e4954aec6d43a19a1d80a34f Author: Bruce Guenter Date: Sun Aug 13 11:01:37 2000 +0000 Improved the modularity of the two programs -- moved more of the functionality into cli_parse.pl. cli++/cli2html.pl | 86 +++++++++++++++++++++++++++++------------------------- cli++/cli2man.pl | 84 +++++++++++++++++++++++++++------------------------- cli++/cli_parse.pl | 33 +++++++++++++++++++-- cli/cli2html.pl | 86 +++++++++++++++++++++++++++++------------------------- cli/cli2man.pl | 84 +++++++++++++++++++++++++++------------------------- cli/cli_parse.pl | 33 +++++++++++++++++++-- 6 files changed, 242 insertions(+), 164 deletions(-) commit 24fc2e164086032942bb01aac5a2b385d717c381 Author: Bruce Guenter Date: Sun Aug 13 00:13:50 2000 +0000 Added a simple parsing framework to turn CLI programs into either man pages or HTML documentation (that looks like a man page). cli++/cli2html.pl | 76 ++++++++++++++++++++++++++++++++++++ cli++/cli2man.pl | 69 +++++++++++++++++++++++++++++++++ cli++/cli_parse.pl | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++ cli/cli2html.pl | 76 ++++++++++++++++++++++++++++++++++++ cli/cli2man.pl | 69 +++++++++++++++++++++++++++++++++ cli/cli_parse.pl | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 514 insertions(+) create mode 100644 cli++/cli2html.pl create mode 100644 cli++/cli2man.pl create mode 100644 cli++/cli_parse.pl create mode 100644 cli/cli2html.pl create mode 100644 cli/cli2man.pl create mode 100644 cli/cli_parse.pl commit 23ff61d2cca7f85848114088e4d7de3cf11627e7 Author: Bruce Guenter Date: Fri Aug 11 04:08:35 2000 +0000 Fixed a bug in fdibuf::read_large fdbuf/ChangeLog | 7 +++++++ fdbuf/fdibuf.cc | 7 ++++++- fdbuf/fdibuf_mystring.cc | 14 ++++++++------ 3 files changed, 21 insertions(+), 7 deletions(-) commit 9d37ce4cd0a166a5be3f5f15fb23c15407aa3756 Author: Bruce Guenter Date: Wed Aug 2 04:27:09 2000 +0000 Fixed several width glitches. cli++/ChangeLog | 4 ++++ cli++/main.cc | 14 ++++++++------ cli/ChangeLog | 4 ++++ cli/main.cc | 14 ++++++++------ 4 files changed, 24 insertions(+), 12 deletions(-) commit b4a604532d2078b268df20f8a6c30e4348ee6d8f Author: Bruce Guenter Date: Wed Jul 19 01:15:36 2000 +0000 Added uinteger type, fixed last mystring remenant. cli++/ChangeLog | 6 ++++++ cli++/cli.h | 2 +- cli++/main.cc | 19 +++++++++++++++++-- cli/ChangeLog | 6 ++++++ cli/cli.h | 2 +- cli/main.cc | 19 +++++++++++++++++-- 6 files changed, 48 insertions(+), 6 deletions(-) commit e32d1249a9929d6d4f93f51b985ae43ae92ad43d Author: Bruce Guenter Date: Thu Jul 13 22:08:40 2000 +0000 Modified the makefile to allow for packages without a dependancy on mystring. fdbuf/Makefile.am | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) commit c373291437589c1e386907ee2f140e9ba612d72c Author: Bruce Guenter Date: Thu Jul 13 22:00:39 2000 +0000 Removed dependancy on mystring. cli++/ChangeLog | 4 ++++ cli++/main.cc | 1 - cli++/messages.cc | 1 - cli/ChangeLog | 4 ++++ cli/main.cc | 1 - cli/messages.cc | 1 - 6 files changed, 8 insertions(+), 4 deletions(-) commit b3db7e6e56df4f37f9085a17c115a4782a47ea29 Author: Bruce Guenter Date: Mon Apr 10 23:11:38 2000 +0000 Small change to order of inline definitions in header file. mystring/mystring.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) commit b687ce0240a54f4e2274a0507a85e78c99eecb05 Author: Bruce Guenter Date: Mon Apr 10 09:19:14 2000 +0000 Added "count" method. mystring/ChangeLog | 5 +++++ mystring/Makefile.am | 1 + cdb++/cdb_getrec.cc => mystring/count.cc | 10 ++++++---- mystring/mystring.h | 2 ++ 4 files changed, 14 insertions(+), 4 deletions(-) copy cdb++/cdb_getrec.cc => mystring/count.cc (81%) commit 666b55f5e24141f5273ab64667ed99555c03bb35 Author: Bruce Guenter Date: Sun Apr 9 10:15:03 2000 +0000 Fixed a bug in read_large. fdbuf/ChangeLog | 5 +++++ fdbuf/fdibuf.cc | 1 + 2 files changed, 6 insertions(+) commit 941b9e6134401386626c159a743adb14d1a99aa0 Author: Bruce Guenter Date: Sat Apr 8 01:12:17 2000 +0000 *** empty log message *** fdbuf/fdobuf.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) commit 4edcf3a492f82819786f4b185e5dcdfbe6dd5d20 Author: Bruce Guenter Date: Fri Apr 7 22:09:01 2000 +0000 Some file reorganization. Added more efficient large block read and write. fdbuf/ChangeLog | 21 ++++ fdbuf/Makefile.am | 6 +- fdbuf/fdibuf.cc | 33 +++++++ fdbuf/fdibuf.h | 1 + fdbuf/fdibuf_mystring.cc | 22 ----- fdbuf/{fdobuf_chownmod.cc => fdibuf_netstring.cc} | 31 +++--- fdbuf/fdobuf.cc | 112 ++++++++-------------- fdbuf/fdobuf.h | 1 + fdbuf/{fdobuf_chownmod.cc => fdobuf_seek.cc} | 36 ++++--- fdbuf/{fdobuf_chownmod.cc => fdobuf_signed.cc} | 30 +++--- fdbuf/{fdobuf_chownmod.cc => fdobuf_unsigned.cc} | 26 ++--- 11 files changed, 174 insertions(+), 145 deletions(-) copy fdbuf/{fdobuf_chownmod.cc => fdibuf_netstring.cc} (66%) copy fdbuf/{fdobuf_chownmod.cc => fdobuf_seek.cc} (63%) copy fdbuf/{fdobuf_chownmod.cc => fdobuf_signed.cc} (68%) copy fdbuf/{fdobuf_chownmod.cc => fdobuf_unsigned.cc} (71%) commit e76086eb8c7aa7d7821a8c413ce2115db2cffbb2 Author: Bruce Guenter Date: Fri Apr 7 05:13:32 2000 +0000 File reorganization. fdbuf/ChangeLog | 8 ++++ fdbuf/Makefile.am | 2 + fdbuf/fdbuf.h | 98 ++------------------------------------------- fdbuf/fdibuf.h | 48 ++++++++++++++++++++++ fdbuf/{fdbuf.h => fdobuf.h} | 94 ++----------------------------------------- 5 files changed, 64 insertions(+), 186 deletions(-) create mode 100644 fdbuf/fdibuf.h copy fdbuf/{fdbuf.h => fdobuf.h} (54%) commit 39ba8c0a564d1ea52ef3c47206f7e62d1c6e8781 Author: Bruce Guenter Date: Fri Apr 7 05:02:05 2000 +0000 Renamed find_{first,last} to find_{first,last}_of. Some file reorganization. mystring/ChangeLog | 15 +++++ mystring/Makefile.am | 6 +- mystring/fdobuf.cc | 9 +++ mystring/find_first_of.cc | 12 ++-- mystring/find_last_of.cc | 12 ++-- cdb++/datum.cc => mystring/iter.h | 30 ++++++---- mystring/join.h | 75 +++++++++++++++++++++++ mystring/mystring.h | 122 ++++---------------------------------- cdb++/datum.cc => mystring/rep.h | 34 +++++++---- 9 files changed, 167 insertions(+), 148 deletions(-) create mode 100644 mystring/fdobuf.cc copy cdb++/datum.cc => mystring/iter.h (64%) create mode 100644 mystring/join.h copy cdb++/datum.cc => mystring/rep.h (60%) commit 38d467383ca1fbc6e22f61ec63231054b11a82e2 Author: Bruce Guenter Date: Thu Apr 6 01:29:35 2000 +0000 Use new include scheme. cdb++/Makefile.am | 2 +- cdb++/cdb++.h | 6 +++--- cdb++/cdb_writer.cc | 1 - cdb++/datum.cc | 2 -- cdb++/datum.h | 4 ++-- cgi/Makefile.am | 2 +- cgi/cgi-args.cc | 3 +-- cgi/cgi-args.h | 2 +- cgi/cgi-base.cc | 3 +-- cgi/cgi-base.h | 4 ++-- cli++/Makefile.am | 2 +- cli++/clitest.cc | 2 +- cli++/main.cc | 15 +++------------ cli++/messages.cc | 4 ++-- cli/Makefile.am | 2 +- cli/clitest.cc | 2 +- cli/main.cc | 15 +++------------ cli/messages.cc | 4 ++-- 18 files changed, 26 insertions(+), 49 deletions(-) commit 7a72b0e250d1bf17e580eae1aa6de74892cdeac9 Author: Bruce Guenter Date: Thu Apr 6 01:22:43 2000 +0000 Use new include scheme. fdbuf/Makefile.am | 2 +- fdbuf/fdibuf_mystring.cc | 2 +- mystring/Makefile.am | 2 +- mystring/mystring.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) commit 01d9fba700e6d9d5f48da4a1fd53db31fb6e1d81 Author: Bruce Guenter Date: Tue Apr 4 00:22:15 2000 +0000 Updated copyright notice in source files. cdb++/cdb++.h | 2 +- cdb++/cdb_get.cc | 2 +- cdb++/cdb_getrec.cc | 2 +- cdb++/cdb_make.cc | 2 +- cdb++/cdb_reader.cc | 2 +- cdb++/cdb_writer.cc | 2 +- cdb++/datum.cc | 2 +- cdb++/internal.h | 2 +- cgi/cgi-args.cc | 2 +- cgi/cgi-base.cc | 2 +- cli++/clitest.cc | 2 +- cli++/main.cc | 2 +- cli++/messages.cc | 2 +- cli/clitest.cc | 2 +- cli/main.cc | 2 +- cli/messages.cc | 2 +- fdbuf/fdbuf.cc | 2 +- fdbuf/fdbuf.h | 2 +- fdbuf/fdbuf_copy.cc | 2 +- fdbuf/fdibuf.cc | 2 +- fdbuf/fdibuf_mystring.cc | 2 +- fdbuf/fdobuf.cc | 2 +- fdbuf/fdobuf_chownmod.cc | 2 +- mystring/iter.cc | 2 +- mystring/mystring.h | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) commit eb52b31df18790d58c0953ec79be46c762fd8ce9 Author: Bruce Guenter Date: Mon Apr 3 21:31:36 2000 +0000 Fixed problem with INCLUDES to change away from using "-I../../include" cgi/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit a19d4a82c6eafd95a5d4448c513ea8fff1ecf46b Author: Bruce Guenter Date: Tue Mar 28 11:00:59 2000 +0000 Initial revision ac/dirent.h | 17 +++++++++++++++++ ac/time.h | 10 ++++++++++ ac/wait.h | 10 ++++++++++ 3 files changed, 37 insertions(+) create mode 100644 ac/dirent.h create mode 100644 ac/time.h create mode 100644 ac/wait.h commit e845a89e93f49d2979a30250e67d1abb062c118c Author: Bruce Guenter Date: Sun Feb 13 11:20:24 2000 +0000 Initial check in. cdb++/ChangeLog | 48 +++++++ cdb++/Makefile.am | 16 +++ cdb++/cdb++.h | 114 ++++++++++++++++ cdb++/cdb_get.cc | 87 ++++++++++++ cdb++/cdb_getrec.cc | 23 ++++ cdb++/cdb_make.cc | 118 ++++++++++++++++ cdb++/cdb_reader.cc | 81 +++++++++++ cdb++/cdb_writer.cc | 93 +++++++++++++ cdb++/cdbtest.cc | 15 +++ cdb++/datum.cc | 34 +++++ cdb++/datum.h | 18 +++ cdb++/internal.h | 49 +++++++ cgi/ChangeLog | 8 ++ cgi/Makefile.am | 8 ++ cgi/cgi-args.cc | 143 ++++++++++++++++++++ cgi/cgi-args.h | 52 +++++++ cgi/cgi-base.cc | 111 +++++++++++++++ cgi/cgi-base.h | 39 ++++++ cli++/ChangeLog | 82 ++++++++++++ cli++/Makefile.am | 9 ++ cli++/cli.h | 59 ++++++++ cli++/clitest.cc | 47 +++++++ cli++/main.cc | 335 ++++++++++++++++++++++++++++++++++++++++++++++ cli++/messages.cc | 45 +++++++ cli/ChangeLog | 82 ++++++++++++ cli/Makefile.am | 9 ++ cli/cli.h | 59 ++++++++ cli/clitest.cc | 47 +++++++ cli/main.cc | 335 ++++++++++++++++++++++++++++++++++++++++++++++ cli/messages.cc | 45 +++++++ fdbuf/ChangeLog | 115 ++++++++++++++++ fdbuf/Makefile.am | 11 ++ fdbuf/fdbuf.cc | 107 +++++++++++++++ fdbuf/fdbuf.h | 174 ++++++++++++++++++++++++ fdbuf/fdbuf_copy.cc | 38 ++++++ fdbuf/fdbuf_test.cc | 16 +++ fdbuf/fdibuf.cc | 153 +++++++++++++++++++++ fdbuf/fdibuf_mystring.cc | 72 ++++++++++ fdbuf/fdobuf.cc | 243 +++++++++++++++++++++++++++++++++ fdbuf/fdobuf_chownmod.cc | 34 +++++ mystring/ChangeLog | 96 +++++++++++++ mystring/Makefile.am | 24 ++++ mystring/append.cc | 18 +++ mystring/assign.cc | 55 ++++++++ mystring/find_first_ch.cc | 11 ++ mystring/find_first_of.cc | 22 +++ mystring/find_last_ch.cc | 14 ++ mystring/find_last_of.cc | 24 ++++ mystring/iter.cc | 48 +++++++ mystring/join.cc | 61 +++++++++ mystring/lower.cc | 19 +++ mystring/lstrip.cc | 10 ++ mystring/mystring.cc | 28 ++++ mystring/mystring.h | 223 ++++++++++++++++++++++++++++++ mystring/operator_in.cc | 33 +++++ mystring/rep.cc | 157 ++++++++++++++++++++++ mystring/rstrip.cc | 10 ++ mystring/strip.cc | 13 ++ mystring/sub.cc | 37 +++++ mystring/subst.cc | 18 +++ mystring/trace.h | 10 ++ mystring/upper.cc | 21 +++ 62 files changed, 4126 insertions(+) create mode 100644 cdb++/ChangeLog create mode 100644 cdb++/Makefile.am create mode 100644 cdb++/cdb++.h create mode 100644 cdb++/cdb_get.cc create mode 100644 cdb++/cdb_getrec.cc create mode 100644 cdb++/cdb_make.cc create mode 100644 cdb++/cdb_reader.cc create mode 100644 cdb++/cdb_writer.cc create mode 100644 cdb++/cdbtest.cc create mode 100644 cdb++/datum.cc create mode 100644 cdb++/datum.h create mode 100644 cdb++/internal.h create mode 100644 cgi/ChangeLog create mode 100644 cgi/Makefile.am create mode 100644 cgi/cgi-args.cc create mode 100644 cgi/cgi-args.h create mode 100644 cgi/cgi-base.cc create mode 100644 cgi/cgi-base.h create mode 100644 cli++/ChangeLog create mode 100644 cli++/Makefile.am create mode 100644 cli++/cli.h create mode 100644 cli++/clitest.cc create mode 100644 cli++/main.cc create mode 100644 cli++/messages.cc create mode 100644 cli/ChangeLog create mode 100644 cli/Makefile.am create mode 100644 cli/cli.h create mode 100644 cli/clitest.cc create mode 100644 cli/main.cc create mode 100644 cli/messages.cc create mode 100644 fdbuf/ChangeLog create mode 100644 fdbuf/Makefile.am create mode 100644 fdbuf/fdbuf.cc create mode 100644 fdbuf/fdbuf.h create mode 100644 fdbuf/fdbuf_copy.cc create mode 100644 fdbuf/fdbuf_test.cc create mode 100644 fdbuf/fdibuf.cc create mode 100644 fdbuf/fdibuf_mystring.cc create mode 100644 fdbuf/fdobuf.cc create mode 100644 fdbuf/fdobuf_chownmod.cc create mode 100644 mystring/ChangeLog create mode 100644 mystring/Makefile.am create mode 100644 mystring/append.cc create mode 100644 mystring/assign.cc create mode 100644 mystring/find_first_ch.cc create mode 100644 mystring/find_first_of.cc create mode 100644 mystring/find_last_ch.cc create mode 100644 mystring/find_last_of.cc create mode 100644 mystring/iter.cc create mode 100644 mystring/join.cc create mode 100644 mystring/lower.cc create mode 100644 mystring/lstrip.cc create mode 100644 mystring/mystring.cc create mode 100644 mystring/mystring.h create mode 100644 mystring/operator_in.cc create mode 100644 mystring/rep.cc create mode 100644 mystring/rstrip.cc create mode 100644 mystring/strip.cc create mode 100644 mystring/sub.cc create mode 100644 mystring/subst.cc create mode 100644 mystring/trace.h create mode 100644 mystring/upper.cc bglibs-2.04/VERSION0000664000076400007640000000001413244040126013305 0ustar bruceguenterbglibs 2.04 bglibs-2.04/uint16/0000755000076400007640000000000013244040127013367 5ustar bruceguenterbglibs-2.04/uint16/pack.c0000664000076400007640000000041413244040127014452 0ustar bruceguenter#include "uint16.h" #ifndef __INLINE_UINT_LSB void uint16_pack_lsb(uint16 u, unsigned char s[2]) { s[0] = u & 255; s[1] = u >> 8; } #endif #ifndef __INLINE_UINT_MSB void uint16_pack_msb(uint16 u, unsigned char s[2]) { s[1] = u & 255; s[0] = u >> 8; } #endif bglibs-2.04/uint16/get.c0000664000076400007640000000041613244040127014315 0ustar bruceguenter#include #include "uint16.h" #ifndef __INLINE_UINT_LSB uint16 uint16_get_lsb(const unsigned char s[2]) { return (s[1] << 8) + s[0]; } #endif #ifndef __INLINE_UINT_MSB uint16 uint16_get_msb(const unsigned char s[2]) { return (s[0] << 8) + s[1]; } #endif bglibs-2.04/uint16/unpack.c0000664000076400007640000000041613244040127015017 0ustar bruceguenter#include "uint16.h" #ifndef __INLINE_UINT_LSB void uint16_unpack_lsb(const unsigned char s[2], uint16* u) { *u = (s[1] << 8) + s[0]; } #endif #ifndef __INLINE_UINT_MSB void uint16_unpack_msb(const unsigned char s[2], uint16* u) { *u = (s[0] << 8) + s[1]; } #endif bglibs-2.04/bg-installer-cli.c0000664000076400007640000000202013244040126015530 0ustar bruceguenter/* This file was automatically generated from bg-installer.cli, do not edit. */ #include #include #include const char program[] = "bg-installer"; const char cli_args_usage[] = "[top-directory] /dev/null 2>&1 || result="${h}0" ;; esac case "$mode" in *l*) ./load "$try" "$@" >/dev/null 2>&1 || result="${h}0" ;; esac case "$mode" in *r*) ./"$try" >/dev/null 2>&1 || result="${h}0" ;; esac rm -f "$try".o "$try" exec cat "$result" bglibs-2.04/crc/0000755000076400007640000000000013244040127013010 5ustar bruceguenterbglibs-2.04/crc/gcrc32fwd.c0000664000076400007640000000040413244040127014740 0ustar bruceguenter#include "gcrc.h" uint32 gcrc32fwd(uint32 crc, const char* data, long len, const uint32 table[256]) { const unsigned char* ptr = (const unsigned char*)data; while (len-- > 0) crc = table[((crc >> 24) ^ *ptr++) & 0xff] ^ (crc << 8); return crc; } bglibs-2.04/crc/gcrc64fwd.c0000664000076400007640000000065613244040127014756 0ustar bruceguenter#include "gcrc.h" uint64 gcrc64fwd(uint64 crc, const char* data, long len, const uint64 table[256]) { const unsigned char* ptr = (const unsigned char*)data; while (len-- > 0) crc = table[((crc >> 56) ^ *ptr++) & 0xff] ^ (crc << 8); return crc; } #ifdef SELFTEST_MAIN #include "crc64.h" MAIN { obuf_putXwll(&outbuf, crc64_block("123456789", 9), 16, '0'); NL(); } #endif #ifdef SELFTEST_EXP 62EC59E3F1A4F00A #endif bglibs-2.04/crc/gcrc16rfl.c0000664000076400007640000000174313244040127014754 0ustar bruceguenter#include "gcrc.h" uint16 gcrc16rfl(uint16 crc, const char* data, long len, const uint16 table[256]) { const unsigned char* ptr = (const unsigned char*)data; while (len-- > 0) crc = table[(crc ^ *ptr++) & 0xff] ^ (crc >> 8); return crc; } #ifdef SELFTEST_MAIN #include "crc16_arc.h" #include "crc16_xmodem.h" MAIN { /* Test vectors gleaned from: * ftp://ftp.adelaide.edu.au/pub/rocksoft/crc_v3.txt * http://www.netrino.com/Connecting/2000-01/ * http://www.efg2.com/Lab/Mathematics/FelipeRochaMachado.TXT * http://www.efg2.com/Lab/Mathematics/CRC.htm */ obuf_putXw(&outbuf, crc16_arc_block("123456789", 9), 4, '0'); NL(); obuf_putXw(&outbuf, crc16_arc_block("abc", 3), 4, '0'); NL(); obuf_putXw(&outbuf, crc16_arc_block("ABC", 3), 4, '0'); NL(); obuf_putXw(&outbuf, crc16_arc_block("This is a string", 16), 4, '0'); NL(); obuf_putXw(&outbuf, crc16_xmodem_block("123456789", 9), 4, '0'); NL(); } #endif #ifdef SELFTEST_EXP BB3D 9738 4521 4C44 0C73 #endif bglibs-2.04/crc/gcrc32rfl.c0000664000076400007640000001135613244040127014753 0ustar bruceguenter#include "gcrc.h" uint32 gcrc32rfl(uint32 crc, const char* data, long len, const uint32 table[256]) { const unsigned char* ptr = (const unsigned char*)data; while (len-- > 0) crc = table[(crc ^ *ptr++) & 0xff] ^ (crc >> 8); return crc; } #ifdef SELFTEST_MAIN #include "crc32.h" #include "crc32c.h" MAIN { /* Test vectors gleaned from: * ftp://ftp.adelaide.edu.au/pub/rocksoft/crc_v3.txt * http://www.di-mgt.com.au/src/basCRC32.txt * http://forth.sourceforge.net/algorithm/crc32/crc32-32b.txt * http://www.createwindow.com/programming/crc32/crcverify.htm * http://www.efg2.com/Lab/Mathematics/CRC.htm * http://home.t-online.de/home/uwe.mnich/Wissen/Delphi/Utilities/Utilities.html */ obuf_putXw(&outbuf, crc32_block("123456789", 9), 8, '0'); NL(); obuf_putXw(&outbuf, crc32_block("", 0), 8, '0'); NL(); obuf_putXw(&outbuf, crc32_block("a", 1), 8, '0'); NL(); obuf_putXw(&outbuf, crc32_block("resume", 6), 8, '0'); NL(); obuf_putXw(&outbuf, crc32_block("abc", 3), 8, '0'); NL(); obuf_putXw(&outbuf, crc32_block("ABC", 3), 8, '0'); NL(); obuf_putXw(&outbuf, crc32_block("This is a string", 16), 8, '0'); NL(); obuf_putXw(&outbuf, crc32_update(0, "1234567890", 1), 8, '0'); NL(); obuf_putXw(&outbuf, crc32_update(0, "1234567890", 2), 8, '0'); NL(); obuf_putXw(&outbuf, crc32_update(0, "1234567890", 3), 8, '0'); NL(); obuf_putXw(&outbuf, crc32_update(0, "1234567890", 4), 8, '0'); NL(); obuf_putXw(&outbuf, crc32_update(0, "1234567890", 5), 8, '0'); NL(); obuf_putXw(&outbuf, crc32_update(0, "1234567890", 6), 8, '0'); NL(); obuf_putXw(&outbuf, crc32_update(0, "1234567890", 7), 8, '0'); NL(); obuf_putXw(&outbuf, crc32_update(0, "1234567890", 8), 8, '0'); NL(); obuf_putXw(&outbuf, crc32_update(0, "1234567890", 9), 8, '0'); NL(); obuf_putXw(&outbuf, crc32_update(0, "1234567890", 10), 8, '0'); NL(); obuf_putXw(&outbuf, crc32_block("hello world", 11), 8, '0'); NL(); obuf_putXw(&outbuf, crc32_block("Hello world", 11), 8, '0'); NL(); obuf_putXw(&outbuf, crc32_block("An Arbitrary String", 19), 8, '0'); NL(); obuf_putXw(&outbuf, crc32_block("ZYXWVUTSRQPONMLKJIHGFEDBCA", 26), 8, '0'); NL(); /* Extracted from http://lwn.net/Articles/66994/ */ obuf_putXw(&outbuf, crc32c_block("\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28", 40), 8, '0'); NL(); obuf_putXw(&outbuf, crc32c_block("\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50", 40), 8, '0'); NL(); obuf_putXw(&outbuf, crc32c_block("\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78", 40), 8, '0'); NL(); obuf_putXw(&outbuf, crc32c_block("\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0", 40), 8, '0'); NL(); obuf_putXw(&outbuf, crc32c_block("\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8", 40), 8, '0'); NL(); obuf_putXw(&outbuf, crc32c_block("\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0", 40), 8, '0'); NL(); obuf_putXw(&outbuf, crc32c_block("\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0", 240), 8, '0'); NL(); } #endif #ifdef SELFTEST_EXP CBF43926 00000000 E8B7BE43 60C1D0A0 352441C2 A3830348 0876633F 51DE003A 0E8A5632 7709BAC0 BAA73FBF 0DD7CD01 B8B072C2 CD6FB6E1 FFC205C6 2DFD2D88 C597C693 0D4A1185 8BD69E52 6FBEAAE7 99CDFDB2 0E2C157F E980EBF6 DE74BDED D579C862 BA979AD0 2B29D913 24C5D375 #endif bglibs-2.04/crc/gcrc16fwd.c0000664000076400007640000000261013244040127014743 0ustar bruceguenter#include "gcrc.h" uint16 gcrc16fwd(uint16 crc, const char* data, long len, const uint16 table[256]) { const unsigned char* ptr = (const unsigned char*)data; while (len-- > 0) crc = table[((crc >> 8) ^ *ptr++) & 0xff] ^ (crc << 8); return crc; } #ifdef SELFTEST_MAIN #include "crc16_ccitt.h" MAIN { /* Test vectors gleaned from: * http://www.netrino.com/Connecting/2000-01/ * http://home.t-online.de/home/uwe.mnich/Wissen/Delphi/Utilities/Utilities.html */ obuf_putXw(&outbuf, crc16_ccitt_block("123456789", 9), 4, '0'); NL(); obuf_putXw(&outbuf, crc16_ccitt_update(0, "1234567890", 1), 4, '0'); NL(); obuf_putXw(&outbuf, crc16_ccitt_update(0, "1234567890", 2), 4, '0'); NL(); obuf_putXw(&outbuf, crc16_ccitt_update(0, "1234567890", 3), 4, '0'); NL(); obuf_putXw(&outbuf, crc16_ccitt_update(0, "1234567890", 4), 4, '0'); NL(); obuf_putXw(&outbuf, crc16_ccitt_update(0, "1234567890", 5), 4, '0'); NL(); obuf_putXw(&outbuf, crc16_ccitt_update(0, "1234567890", 6), 4, '0'); NL(); obuf_putXw(&outbuf, crc16_ccitt_update(0, "1234567890", 7), 4, '0'); NL(); obuf_putXw(&outbuf, crc16_ccitt_update(0, "1234567890", 8), 4, '0'); NL(); obuf_putXw(&outbuf, crc16_ccitt_update(0, "1234567890", 9), 4, '0'); NL(); obuf_putXw(&outbuf, crc16_ccitt_update(0, "1234567890", 10), 4, '0'); NL(); } #endif #ifdef SELFTEST_EXP 29B1 2672 20B5 9752 D789 546C 20E4 86D6 9015 31C3 D321 #endif bglibs-2.04/crc/gcrc64rfl.c0000664000076400007640000000037413244040127014756 0ustar bruceguenter#include "gcrc.h" uint64 gcrc64rfl(uint64 crc, const char* data, long len, const uint64 table[256]) { const unsigned char* ptr = (const unsigned char*)data; while (len-- > 0) crc = table[(crc ^ *ptr++) & 0xff] ^ (crc >> 8); return crc; } bglibs-2.04/base64/0000755000076400007640000000000013244040126013324 5ustar bruceguenterbglibs-2.04/base64/decode_line.c0000664000076400007640000000052313244040126015724 0ustar bruceguenter#include "base64.h" int base64_decode_line(const char* encoded, str* bin) { unsigned char tmp[3]; int len; while ((len = base64_decode_part(encoded, tmp)) == 3) { encoded += 4; if (!str_catb(bin, (char*)tmp, 3)) return 0; } if (len > 0) return str_catb(bin, (char*)tmp, len); if (*encoded) return 0; return 1; } bglibs-2.04/base64/encode_line.c0000664000076400007640000000057313244040126015743 0ustar bruceguenter#include "base64.h" int base64_encode_line(const unsigned char* bin, unsigned long len, str* encoded) { char tmp[4]; while (len >= 3) { base64_encode_whole(bin, tmp); if (!str_catb(encoded, tmp, 4)) return 0; bin += 3; len -= 3; } if (len) { base64_encode_part(bin, len, tmp); if (!str_catb(encoded, tmp, 4)) return 0; } return 1; } bglibs-2.04/base64/decode_part.c0000664000076400007640000000121113244040126015736 0ustar bruceguenter#include "base64.h" int base64_decode_part(const char encoded[4], unsigned char bin[3]) { int e0; int e1; int e2; int e3; if (encoded[0] == BASE64_PAD) return 0; if ((e0 = base64_asc2bin[(unsigned char)encoded[0]]) == -1 || (e1 = base64_asc2bin[(unsigned char)encoded[1]]) == -1) return -1; bin[0] = (e0 << 2) | (e1 >> 4); if (encoded[2] == BASE64_PAD) return 1; if ((e2 = base64_asc2bin[(unsigned char)encoded[2]]) == -1) return -1; bin[1] = (e1 << 4) | (e2 >> 2); if (encoded[3] == BASE64_PAD) return 2; if ((e3 = base64_asc2bin[(unsigned char)encoded[3]]) == -1) return -1; bin[2] = (e2 << 6) | e3; return 3; } bglibs-2.04/base64/bin2asc.c0000664000076400007640000000017013244040126015011 0ustar bruceguenter#include "base64.h" const char base64_bin2asc[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; bglibs-2.04/base64/asc2bin.c0000664000076400007640000000210313244040126015007 0ustar bruceguenter#include "base64.h" const signed char base64_asc2bin[256] = { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 0-15 */ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 16-31 */ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63, /* 32-47 */ 52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1, /* 48-63 */ -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14, /* 64-79 */ 15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1, /* 80-95 */ -1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, /* 96-111 */ 41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1, /* 112-127 */ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 128-143 */ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 144-159 */ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 160-175 */ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 176-191 */ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 192-207 */ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 208-223 */ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 224-239 */ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 240-255 */ }; bglibs-2.04/base64/encode_part.c0000664000076400007640000000147413244040126015763 0ustar bruceguenter#include "base64.h" void base64_encode_whole(const unsigned char bin[3], char encoded[4]) { encoded[0] = base64_bin2asc[bin[0] >> 2]; encoded[1] = base64_bin2asc[(bin[0] << 4 | bin[1] >> 4) & 0x3f]; encoded[2] = base64_bin2asc[(bin[1] << 2 | bin[2] >> 6) & 0x3f]; encoded[3] = base64_bin2asc[bin[2] & 0x3f]; } void base64_encode_part(const unsigned char bin[3], unsigned len, char encoded[4]) { encoded[0] = base64_bin2asc[bin[0] >> 2]; /* len must be 1 or 2, as 0 produces nothing, and 3 would be handled * by _whole */ if (len == 1) { encoded[1] = base64_bin2asc[(bin[0] << 4) & 0x3f]; encoded[2] = encoded[3] = BASE64_PAD; } else { encoded[1] = base64_bin2asc[(bin[0] << 4 | bin[1] >> 4) & 0x3f]; encoded[2] = base64_bin2asc[(bin[1] << 2) & 0x3f]; encoded[3] = BASE64_PAD; } } bglibs-2.04/LIBVERSION0000664000076400007640000000000613244040126013635 0ustar bruceguenter2:0:0 bglibs-2.04/AUTOFILES0000664000076400007640000000017613244040126013524 0ustar bruceguenterAUTOFILES LIBVERSION Makefile SRCFILES TARGETS choose.sh conf-bin conf-cc conf-include conf-ld conf-lib conf-man warn-auto.sh bglibs-2.04/sysdeps-tail.h0000664000076400007640000000001013244040127015024 0ustar bruceguenter #endif bglibs-2.04/iobuf/0000755000076400007640000000000013244040127013345 5ustar bruceguenterbglibs-2.04/iobuf/obuf_put7s.c0000664000076400007640000000223013244040127015605 0ustar bruceguenter#include #include "obuf.h" /** Write 7 C strings to the \c obuf */ int obuf_put7s(obuf* out, const char* s1, const char* s2, const char* s3, const char* s4, const char* s5, const char* s6, const char* s7) { if (s1 && !obuf_puts(out, s1)) return 0; if (s2 && !obuf_puts(out, s2)) return 0; if (s3 && !obuf_puts(out, s3)) return 0; if (s4 && !obuf_puts(out, s4)) return 0; if (s5 && !obuf_puts(out, s5)) return 0; if (s6 && !obuf_puts(out, s6)) return 0; if (s7 && !obuf_puts(out, s7)) return 0; return 1; } #ifdef SELFTEST_MAIN MAIN { obuf_put7s(&outbuf, "1", "2", "3", "4", "5", "6", "7"); NL(); obuf_put7s(&outbuf, 0, "2", "3", "4", "5", "6", "7"); NL(); obuf_put7s(&outbuf, "1", 0, "3", "4", "5", "6", "7"); NL(); obuf_put7s(&outbuf, "1", "2", 0, "4", "5", "6", "7"); NL(); obuf_put7s(&outbuf, "1", "2", "3", 0, "5", "6", "7"); NL(); obuf_put7s(&outbuf, "1", "2", "3", "4", 0, "6", "7"); NL(); obuf_put7s(&outbuf, "1", "2", "3", "4", "5", 0, "7"); NL(); obuf_put7s(&outbuf, "1", "2", "3", "4", "5", "6", 0); NL(); } #endif #ifdef SELFTEST_EXP 1234567 234567 134567 124567 123567 123467 123457 123456 #endif bglibs-2.04/iobuf/obuf_putf.c0000664000076400007640000000141213244040127015502 0ustar bruceguenter#include #include "obuf.h" #include "fmt.h" /** Write a formatted string using \c fmt_multi from a \c va_list */ int obuf_putfv(obuf* out, const char* format, va_list ap) { unsigned length; int i; va_list ap2; va_copy(ap2, ap); length = fmt_multiv(0, format, ap2); va_end(ap2); { char buf[length]; fmt_multiv(buf, format, ap); i = obuf_write(out, buf, length); } return i; } /** Write a formatted string using \c fmt_multi from variable arguments */ int obuf_putf(obuf* out, const char* format, ...) { int i; va_list ap; va_start(ap, format); i = obuf_putfv(out, format, ap); va_end(ap); return i; } #ifdef SELFTEST_MAIN MAIN { obuf_putf(&outbuf, "d{bar}x", 10, 20); NL(); } #endif #ifdef SELFTEST_EXP 10bar14 #endif bglibs-2.04/iobuf/ibuf_gets.c0000664000076400007640000000150213244040127015460 0ustar bruceguenter#include "ibuf.h" /** Read a line from the \c ibuf into a C string. */ int ibuf_gets(ibuf* in, char* data, unsigned datalen, char boundary) { iobuf* io; int ch; io = &in->io; in->count = 0; if (ibuf_eof(in) || ibuf_error(in) || ibuf_timedout(in)) return 0; while (datalen > 1) { if (io->bufstart >= io->buflen && !ibuf_refill(in)) { if (ibuf_eof(in)) break; return 0; } in->count++; ch = io->buffer[io->bufstart++]; *data++ = ch; if (ch == boundary) break; } *data = 0; return 1; } #ifdef SELFTEST_MAIN #include ibuf in = { { -1, "a\0bcd\0efgh", 10, 10, 0, 0, 0, 0, 0 }, 0, (ibuf_fn)read }; MAIN { char buf[999]; while (ibuf_gets(&in, buf, sizeof buf, 0)) obuf_putf(&outbuf, "u{:}s{\n}", in.count, buf); } #endif #ifdef SELFTEST_EXP 2:a 4:bcd #endif bglibs-2.04/iobuf/obuf_stderr.c0000664000076400007640000000030513244040127016027 0ustar bruceguenter#include #include "obuf.h" static char buffer[4096]; /** Output buffer for \c stderr */ obuf errbuf = { { 2, buffer, 4096, 0, 0, 0, 0, IOBUF_NEEDSCLOSE, 0 }, 0, 0, (obuf_fn)write }; bglibs-2.04/iobuf/ibuf_tell.c0000664000076400007640000000027013244040127015457 0ustar bruceguenter#include "ibuf.h" /** Look up the current effective read position. */ unsigned ibuf_tell(ibuf* in) { iobuf* io; io = &(in->io); return io->offset - io->buflen + io->bufstart; } bglibs-2.04/iobuf/ibuf_getc.c0000664000076400007640000000111013244040127015433 0ustar bruceguenter#include "ibuf.h" /** Retrieve a single character from the \c ibuf. */ int ibuf_getc(ibuf* in, char* ch) { iobuf* io; io = &(in->io); in->count = 0; if (ibuf_eof(in) || ibuf_error(in)) return 0; if (io->bufstart >= io->buflen && !ibuf_refill(in)) return 0; *ch = io->buffer[io->bufstart++]; in->count = 1; return 1; } #ifdef SELFTEST_MAIN #include ibuf in = { { -1, "abcde", 5, 5, 0, 0, 0, 0, 0 }, 0, (ibuf_fn)read }; MAIN { char ch; while (ibuf_getc(&in, &ch)) obuf_putf(&outbuf, "c\\\n", ch); } #endif #ifdef SELFTEST_EXP a b c d e #endif bglibs-2.04/iobuf/obuf_put6s.c0000664000076400007640000000175413244040127015616 0ustar bruceguenter#include #include "obuf.h" /** Write 6 C strings to the \c obuf */ int obuf_put6s(obuf* out, const char* s1, const char* s2, const char* s3, const char* s4, const char* s5, const char* s6) { if (s1 && !obuf_puts(out, s1)) return 0; if (s2 && !obuf_puts(out, s2)) return 0; if (s3 && !obuf_puts(out, s3)) return 0; if (s4 && !obuf_puts(out, s4)) return 0; if (s5 && !obuf_puts(out, s5)) return 0; if (s6 && !obuf_puts(out, s6)) return 0; return 1; } #ifdef SELFTEST_MAIN MAIN { obuf_put6s(&outbuf, "1", "2", "3", "4", "5", "6"); NL(); obuf_put6s(&outbuf, 0, "2", "3", "4", "5", "6"); NL(); obuf_put6s(&outbuf, "1", 0, "3", "4", "5", "6"); NL(); obuf_put6s(&outbuf, "1", "2", 0, "4", "5", "6"); NL(); obuf_put6s(&outbuf, "1", "2", "3", 0, "5", "6"); NL(); obuf_put6s(&outbuf, "1", "2", "3", "4", 0, "6"); NL(); obuf_put6s(&outbuf, "1", "2", "3", "4", "5", 0); NL(); } #endif #ifdef SELFTEST_EXP 123456 23456 13456 12456 12356 12346 12345 #endif bglibs-2.04/iobuf/ibuf_getu.c0000664000076400007640000000050013244040127015457 0ustar bruceguenter#include "ibuf.h" /** Read an unsigned long from the \c ibuf */ int ibuf_getu(ibuf* in, unsigned long* data) { char ch; int chars; *data = 0; chars = 0; while (ibuf_peek(in, &ch) && ch >= '0' && ch <= '9') { *data = (*data * 10) + ch - '0'; ibuf_getc(in, &ch); chars = 1; } return chars; } bglibs-2.04/iobuf/ibuf_read.c0000664000076400007640000000413413244040127015435 0ustar bruceguenter#include #include #include #include "ibuf.h" /** Read a block of data from the \c ibuf. This routine differs from \c ibuf_read in that the data is, as much as is possible, read directly into the given buffer, rather than first being read into the \c iobuf buffer and then into the given buffer. \c ibuf_read automatically calls this routine if the requested \c datalen is larger than or equal to the \c iobuf buffer size. */ int ibuf_read_large(ibuf* in, char* data, unsigned datalen) { iobuf* io; unsigned len; unsigned rd; in->count = 0; io = &(in->io); if (ibuf_eof(in) || ibuf_error(in)) return 0; /* If there's any content in the buffer, memcpy it out first */ len = io->buflen - io->bufstart; if (len > datalen) len = datalen; memcpy(data, io->buffer+io->bufstart, len); data += len; datalen -= len; io->bufstart += len; in->count += len; /* After the buffer is empty and there's still more data to read, * read it straight from the fd instead of copying it through the buffer. */ while (datalen) { if (io->timeout && !iobuf_timeout(io, 0)) return 0; if ((rd = in->readfn(io->fd, data, datalen)) == (unsigned)-1) IOBUF_SET_ERROR(io); if (rd == 0) { io->flags |= IOBUF_EOF; return 0; } data += rd; datalen -= rd; io->offset += rd; in->count += rd; } return 1; } /** Read a block of data from the \c ibuf Returns true only if the entire block was read. If the return value is false, the caller will need to check if a partial block was read. */ int ibuf_read(ibuf* in, char* data, unsigned datalen) { iobuf* io; unsigned len; io = &(in->io); if (datalen >= io->bufsize) return ibuf_read_large(in, data, datalen); in->count = 0; if (ibuf_eof(in) || ibuf_error(in)) return 0; while (datalen) { if (io->bufstart >= io->buflen && !ibuf_refill(in)) return 0; len = io->buflen - io->bufstart; if (len > datalen) len = datalen; memcpy(data, io->buffer+io->bufstart, len); data += len; datalen -= len; io->bufstart += len; in->count += len; } return 1; } bglibs-2.04/iobuf/obuf_sign_pad.c0000664000076400007640000000167613244040127016324 0ustar bruceguenter#include "obuf.h" /** Pad the output with \c width instances of the single character \c ch, preceded by an optional negative sign at an appropriate place. If the pad character is \c '0' then any negative sign is placed as the first character, followed by padding. Otherwise, it is preceded by the padding. */ int obuf_sign_pad(obuf* out, int sign, unsigned width, char pad) { if (!width) return !sign || obuf_putc(out, '-'); if (pad != '0' && !obuf_pad(out, width, pad)) return 0; if (sign && !obuf_putc(out, '-')) return 0; if (pad == '0' && !obuf_pad(out, width, pad)) return 0; return 1; } #ifdef SELFTEST_MAIN MAIN { obuf_sign_pad(&outbuf, 0, 0, 0); NL(); obuf_sign_pad(&outbuf, 1, 0, 0); NL(); obuf_sign_pad(&outbuf, 0, 4, 'x'); NL(); obuf_sign_pad(&outbuf, 1, 4, 'x'); NL(); obuf_sign_pad(&outbuf, 0, 4, '0'); NL(); obuf_sign_pad(&outbuf, 1, 4, '0'); NL(); } #endif #ifdef SELFTEST_EXP - xxxx xxxx- 0000 -0000 #endif bglibs-2.04/iobuf/obuf_write.c0000664000076400007640000000337113244040127015664 0ustar bruceguenter#include #include #include #include "obuf.h" /** Write a large block of data to the \c obuf, avoiding copying. */ int obuf_write_large(obuf* out, const char* data, unsigned datalen) { iobuf* io; unsigned wr; io = &out->io; if (iobuf_bad(io)) return 0; out->count = 0; if (!obuf_flush(out)) return 0; while (datalen > 0) { if (io->timeout && !iobuf_timeout(io, 1)) return 0; if ((wr = out->writefn(io->fd, data, datalen)) == (unsigned)-1) IOBUF_SET_ERROR(io); datalen -= wr; data += wr; io->offset += wr; out->count += wr; } return 1; } /** Write a block of data to the \c obuf */ int obuf_write(obuf* out, const char* data, unsigned datalen) { iobuf* io; unsigned avail; io = &out->io; if (iobuf_bad(io)) return 0; if (datalen >= io->bufsize) return obuf_write_large(out, data, datalen); out->count = 0; avail = io->bufsize - out->bufpos; while (datalen >= avail) { memcpy(io->buffer+out->bufpos, data, avail); out->bufpos = io->bufsize; io->buflen = io->bufsize; datalen -= avail; data += avail; if (!obuf_flush(out)) return 0; out->count += avail; avail = io->bufsize - out->bufpos; } memcpy(io->buffer+out->bufpos, data, datalen); out->count += datalen; out->bufpos += datalen; if (out->bufpos > io->buflen) io->buflen = out->bufpos; return 1; } #ifdef SELFTEST_MAIN MAIN { obuf buf; obuf_init(&buf, 1, 0, 0, 8); /* Test proper merging of short writes */ obuf_puts(&buf, "0123"); write(1,"brk\n",4); obuf_puts(&buf, "456789\n"); write(1,"brk\n",4); /* Test pass-through of large writes */ obuf_write(&buf, "01234567\n", 9); write(1,"brk\n",4); } #endif #ifdef SELFTEST_EXP brk 01234567brk 89 01234567 brk #endif bglibs-2.04/iobuf/obuf_putunumw.c0000664000076400007640000000412313244040127016432 0ustar bruceguenter#include "fmt.h" #include "obuf.h" /** Write an unsigned integer to the \c obuf with optional padding. */ int obuf_putunumw(obuf* out, unsigned long data, unsigned width, char pad, unsigned base, const char* digits) { unsigned len = fmt_unumw(0, data, width, pad, base, digits); char buf[len]; fmt_unumw(buf, data, width, pad, base, digits); return obuf_write(out, buf, len); } /** Write an unsigned integer as decimal to the \c obuf with padding. */ int obuf_putuw(obuf* out, unsigned long data, unsigned width, char pad) { return obuf_putunumw(out, data, width, pad, 10, fmt_lcase_digits); } /** Write an unsigned integer as decimal to the \c obuf. */ int obuf_putu(obuf* out, unsigned long data) { return obuf_putunumw(out, data, 0, 0, 10, fmt_lcase_digits); } /** Write an unsigned integer as (lower-case) hexadecimal to the \c obuf with padding. */ int obuf_putxw(obuf* out, unsigned long data, unsigned width, char pad) { return obuf_putunumw(out, data, width, pad, 16, fmt_lcase_digits); } /** Write an unsigned integer as (lower-case) hexadecimal to the \c obuf. */ int obuf_putx(obuf* out, unsigned long data) { return obuf_putunumw(out, data, 0, 0, 16, fmt_lcase_digits); } /** Write an unsigned integer as (upper-case) hexadecimal to the \c obuf with padding. */ int obuf_putXw(obuf* out, unsigned long data, unsigned width, char pad) { return obuf_putunumw(out, data, width, pad, 16, fmt_ucase_digits); } /** Write an unsigned integer as (upper-case) hexadecimal to the \c obuf. */ int obuf_putX(obuf* out, unsigned long data) { return obuf_putunumw(out, data, 0, 0, 16, fmt_ucase_digits); } #ifdef SELFTEST_MAIN MAIN { obuf_putuw(&outbuf, 10, 0, 0); NL(); obuf_putuw(&outbuf, 10, 5, ' '); NL(); obuf_putuw(&outbuf, 10, 5, '0'); NL(); obuf_putxw(&outbuf, 30, 0, 0); NL(); obuf_putxw(&outbuf, 30, 5, ' '); NL(); obuf_putxw(&outbuf, 30, 5, '0'); NL(); obuf_putXw(&outbuf, 30, 0, 0); NL(); obuf_putXw(&outbuf, 30, 5, ' '); NL(); obuf_putXw(&outbuf, 30, 5, '0'); NL(); } #endif #ifdef SELFTEST_EXP 10 10 00010 1e 1e 0001e 1E 1E 0001E #endif bglibs-2.04/iobuf/ibuf_copytofd.c0000664000076400007640000000113513244040127016347 0ustar bruceguenter#include #include "ibuf.h" /** Copy all the data from an \c ibuf to an output file descriptor. */ int ibuf_copytofd(ibuf* in, int out) { const char* buf; long len; long wr; if (ibuf_eof(in)) return 1; if (ibuf_error(in)) return 0; in->count = 0; for (;;) { buf = in->io.buffer + in->io.bufstart; len = in->io.buflen - in->io.bufstart; while (len > 0) { if ((wr = write(out, buf, len)) <= 0) return 0; buf += wr; len -= wr; in->count += wr; } in->io.bufstart = in->io.buflen; if (!ibuf_refill(in)) return ibuf_eof(in); } } bglibs-2.04/iobuf/obuf_putc.c0000664000076400007640000000056713244040127015511 0ustar bruceguenter#include "obuf.h" /** Write a single character to the \c obuf */ int obuf_putc(obuf* out, char ch) { iobuf* io; io = &out->io; if (iobuf_bad(io)) return 0; out->count = 0; io->buffer[out->bufpos++] = ch; if (out->bufpos >= io->buflen) io->buflen = out->bufpos; if (io->buflen >= io->bufsize && !obuf_flush(out)) return 0; out->count = 1; return 1; } bglibs-2.04/iobuf/ibuf_status.c0000664000076400007640000000026013244040127016041 0ustar bruceguenter#include "ibuf.h" /** Test if the \c ibuf has reaced end of file. */ int ibuf_eof(ibuf* in) { return (in->io.flags & IOBUF_EOF) && (in->io.bufstart >= in->io.buflen); } bglibs-2.04/iobuf/obuf_close.c0000664000076400007640000000025013244040127015630 0ustar bruceguenter#include "obuf.h" /** Flush and close the \c obuf */ int obuf_close(obuf* out) { int result; result = obuf_flush(out); return iobuf_close(&out->io) && result; } bglibs-2.04/iobuf/obuf_seek.c0000664000076400007640000000122313244040127015453 0ustar bruceguenter#include #include #include #include "obuf.h" /** Set the effective write position. */ int obuf_seek(obuf* out, unsigned offset) { iobuf* io; unsigned buf_start; unsigned buf_end; io = &out->io; if (iobuf_bad(io)) return 0; buf_start = io->offset; buf_end = io->offset + io->buflen; if (offset >= buf_start && offset <= buf_end) out->bufpos = offset - buf_start; else { if (!obuf_flush(out)) return 0; if (lseek(io->fd, offset, SEEK_SET) == -1) { io->errnum = errno; io->flags |= IOBUF_ERROR; return 0; } io->offset = offset; } out->count = 0; return 1; } bglibs-2.04/iobuf/obuf_copyfromfd.c0000664000076400007640000000105013244040127016672 0ustar bruceguenter#include #include "obuf.h" /** Copy all the data from an input file descriptor to an \c obuf. */ int obuf_copyfromfd(int in, obuf* out) { long rd; if (obuf_error(out)) return 0; out->count = 0; for (;;) { if ((rd = read(in, out->io.buffer + out->bufpos, out->io.bufsize - out->bufpos)) == -1) return 0; if (rd == 0) break; out->bufpos += rd; if (out->io.buflen < out->bufpos) out->io.buflen = out->bufpos; if (!obuf_flush(out)) return 0; out->count += rd; } return 1; } bglibs-2.04/iobuf/obuf_put2s.c0000664000076400007640000000065413244040127015610 0ustar bruceguenter#include #include "obuf.h" /** Write 2 C strings to the \c obuf */ int obuf_put2s(obuf* out, const char* s1, const char* s2) { if (s1 && !obuf_puts(out, s1)) return 0; if (s2 && !obuf_puts(out, s2)) return 0; return 1; } #ifdef SELFTEST_MAIN MAIN { obuf_put2s(&outbuf, "1", "2"); NL(); obuf_put2s(&outbuf, 0, "2"); NL(); obuf_put2s(&outbuf, "1", 0); NL(); } #endif #ifdef SELFTEST_EXP 12 2 1 #endif bglibs-2.04/iobuf/obuf_putns.c0000664000076400007640000000073013244040127015677 0ustar bruceguenter#include #include #include "obuf.h" /** Write N C strings to the \c obuf */ int obuf_putns(obuf* out, unsigned int count, ...) { const char* ptr; va_list ap; va_start(ap, count); while (count-- > 0) { if ((ptr = va_arg(ap, const char*)) != 0) if (!obuf_puts(out, ptr)) return 0; } va_end(ap); return 1; } #ifdef SELFTEST_MAIN MAIN { obuf_putns(&outbuf, 4, "1", 0, "2", "3"); NL(); } #endif #ifdef SELFTEST_EXP 123 #endif bglibs-2.04/iobuf/obuf_init.c0000664000076400007640000000052513244040127015473 0ustar bruceguenter#include #include "obuf.h" /** Initialize an \c obuf from an already-opened file descriptor. */ int obuf_init(obuf* out, int fd, obuf_fn fn, unsigned flags, unsigned bufsize) { if (fn == 0) fn = (obuf_fn)write; out->bufpos = 0; out->count = 0; out->writefn = fn; return iobuf_init(&(out->io), fd, bufsize, 0, flags); } bglibs-2.04/iobuf/ibuf_openreadclose.c0000664000076400007640000000044113244040127017342 0ustar bruceguenter#include "iobuf.h" #include "str.h" /** Open and read the entire file into the \c str . */ int ibuf_openreadclose(const char* filename, struct str* out) { ibuf in; int r; if (!ibuf_open(&in, filename, 0)) return 0; r = ibuf_readall(&in, out); ibuf_close(&in); return r; } bglibs-2.04/iobuf/ibuf_readall.c0000664000076400007640000000064613244040127016132 0ustar bruceguenter#include "iobuf.h" #include "str.h" /** Read the remainder of the \c ibuf into the \c str. */ int ibuf_readall(ibuf* in, struct str* out) { if (ibuf_eof(in)) return 1; if (ibuf_error(in)) return 0; for (;;) { if (!str_catb(out, in->io.buffer+in->io.bufstart, in->io.buflen-in->io.bufstart)) return 0; in->io.bufstart = in->io.buflen; if (!ibuf_refill(in)) return ibuf_eof(in); } } bglibs-2.04/iobuf/ibuf_peek.c0000664000076400007640000000053113244040127015443 0ustar bruceguenter#include "ibuf.h" /** Retrieve the next character in the \c ibuf without advancing the current read position. */ int ibuf_peek(ibuf* in, char* ch) { iobuf* io; io = &(in->io); if (ibuf_eof(in) || ibuf_error(in)) return 0; if (io->bufstart >= io->buflen && !ibuf_refill(in)) return 0; *ch = io->buffer[io->bufstart]; return 1; } bglibs-2.04/iobuf/ibuf_getnetstring.c0000664000076400007640000000176413244040127017245 0ustar bruceguenter#include #include "ibuf.h" #include "str.h" /** Read a netstring from the given \c ibuf . If the input is not a netstring, \c errno (and \c in->io.errnum ) will be set to \c EPROTOTYPE and the state of \c in will be undefined. */ int ibuf_getnetstring(ibuf* in, struct str* s) { unsigned long len; char ch; if (!ibuf_getu(in, &len)) return 0; if (!ibuf_getc(in, &ch)) return 0; if (ch != ':') { errno = in->io.errnum = EPROTOTYPE; return 0; } if (!str_ready(s, len)) return 0; if (!ibuf_read(in, s->s, len)) return 0; s->s[s->len = len] = 0; if (!ibuf_getc(in, &ch)) return 0; if (ch != ',') { errno = in->io.errnum = EPROTOTYPE; return 0; } return 1; } #ifdef SELFTEST_MAIN #include ibuf in = { { -1, "0:,1:a,10:0123456789,4:", 23, 23, 0, 0, 0, 0, 0 }, 0, (ibuf_fn)read }; MAIN { static str s; while (ibuf_getnetstring(&in, &s)) obuf_putf(&outbuf, "u{:}s{\n}", s.len, s.s); } #endif #ifdef SELFTEST_EXP 0: 1:a 10:0123456789 #endif bglibs-2.04/iobuf/ibuf_refill.c0000664000076400007640000000206313244040127015776 0ustar bruceguenter#include #include #include "ibuf.h" static const char errmsg[] = "ibuf_refill called with non-empty buffer!\n"; /** (Re)fill the buffer from the file descriptor. \note This function may only be called when the buffer is completely empty. */ int ibuf_refill(ibuf* in) { iobuf* io; unsigned oldlen; unsigned rd; io = &(in->io); if (iobuf_bad(io)) return 0; if (io->bufstart != 0) { if (io->bufstart < io->buflen) { write(1, errmsg, sizeof errmsg); _exit(1); /* io->buflen -= io->bufstart; */ /* memcpy(io->buffer, io->buffer+io->bufstart, io->buflen); */ } else io->buflen = 0; io->bufstart = 0; } oldlen = io->buflen; if(io->buflen < io->bufsize) { if (io->timeout && !iobuf_timeout(io, 0)) return 0; rd = in->readfn(io->fd, io->buffer+io->buflen, io->bufsize-io->buflen); if(rd == (unsigned)-1) IOBUF_SET_ERROR(io); else if(rd == 0) io->flags |= IOBUF_EOF; else { io->buflen += rd; io->offset += rd; } } return io->buflen > oldlen; } bglibs-2.04/iobuf/obuf_putullnumw.c0000664000076400007640000000516513244040127016771 0ustar bruceguenter#include "fmt.h" #include "obuf.h" /** Write an unsigned long long integer to the \c obuf with optional padding. */ int obuf_putullnumw(obuf* out, unsigned long long data, unsigned width, char pad, unsigned base, const char* digits) { unsigned len = fmt_ullnumw(0, data, width, pad, base, digits); char buf[len]; fmt_ullnumw(buf, data, width, pad, base, digits); return obuf_write(out, buf, len); } /** Write an unsigned long long integer as decimal to the \c obuf with padding. */ int obuf_putuwll(obuf* out, unsigned long long data, unsigned width, char pad) { return obuf_putullnumw(out, data, width, pad, 10, fmt_lcase_digits); } /** Write an unsigned long long integer as decimal to the \c obuf. */ int obuf_putull(obuf* out, unsigned long long data) { return obuf_putullnumw(out, data, 0, 0, 10, fmt_lcase_digits); } /** Write an unsigned long long integer as (lower-case) hexadecimal to the \c obuf with padding. */ int obuf_putxwll(obuf* out, unsigned long long data, unsigned width, char pad) { return obuf_putullnumw(out, data, width, pad, 16, fmt_lcase_digits); } /** Write an unsigned long long integer as (lower-case) hexadecimal to the \c obuf. */ int obuf_putxll(obuf* out, unsigned long long data) { return obuf_putullnumw(out, data, 0, 0, 16, fmt_lcase_digits); } /** Write an unsigned long long integer as (upper-case) hexadecimal to the \c obuf with padding. */ int obuf_putXwll(obuf* out, unsigned long long data, unsigned width, char pad) { return obuf_putullnumw(out, data, width, pad, 16, fmt_ucase_digits); } /** Write an unsigned long long integer as (upper-case) hexadecimal to the \c obuf. */ int obuf_putXll(obuf* out, unsigned long long data) { return obuf_putullnumw(out, data, 0, 0, 16, fmt_ucase_digits); } #ifdef SELFTEST_MAIN MAIN { obuf_putuwll(&outbuf, 10, 0, 0); NL(); obuf_putuwll(&outbuf, 10, 5, ' '); NL(); obuf_putuwll(&outbuf, 10, 5, '0'); NL(); obuf_putuwll(&outbuf, 1000000000000ULL, 0, 0); NL(); obuf_putuwll(&outbuf, 1000000000000ULL, 15, ' '); NL(); obuf_putuwll(&outbuf, 1000000000000ULL, 15, '0'); NL(); obuf_putxwll(&outbuf, 1000000000000ULL, 0, 0); NL(); obuf_putxwll(&outbuf, 1000000000000ULL, 15, ' '); NL(); obuf_putxwll(&outbuf, 1000000000000ULL, 15, '0'); NL(); obuf_putXwll(&outbuf, 1000000000000ULL, 0, 0); NL(); obuf_putXwll(&outbuf, 1000000000000ULL, 15, ' '); NL(); obuf_putXwll(&outbuf, 1000000000000ULL, 15, '0'); NL(); } #endif #ifdef SELFTEST_EXP 10 10 00010 1000000000000 1000000000000 001000000000000 e8d4a51000 e8d4a51000 00000e8d4a51000 E8D4A51000 E8D4A51000 00000E8D4A51000 #endif bglibs-2.04/iobuf/obuf_put5s.c0000664000076400007640000000151413244040127015607 0ustar bruceguenter#include #include "obuf.h" /** Write 5 C strings to the \c obuf */ int obuf_put5s(obuf* out, const char* s1, const char* s2, const char* s3, const char* s4, const char* s5) { if (s1 && !obuf_puts(out, s1)) return 0; if (s2 && !obuf_puts(out, s2)) return 0; if (s3 && !obuf_puts(out, s3)) return 0; if (s4 && !obuf_puts(out, s4)) return 0; if (s5 && !obuf_puts(out, s5)) return 0; return 1; } #ifdef SELFTEST_MAIN MAIN { obuf_put5s(&outbuf, "1", "2", "3", "4", "5"); NL(); obuf_put5s(&outbuf, 0, "2", "3", "4", "5"); NL(); obuf_put5s(&outbuf, "1", 0, "3", "4", "5"); NL(); obuf_put5s(&outbuf, "1", "2", 0, "4", "5"); NL(); obuf_put5s(&outbuf, "1", "2", "3", 0, "5"); NL(); obuf_put5s(&outbuf, "1", "2", "3", "4", 0); NL(); } #endif #ifdef SELFTEST_EXP 12345 2345 1345 1245 1235 1234 #endif bglibs-2.04/iobuf/obuf_stdout.c0000664000076400007640000000030513244040127016046 0ustar bruceguenter#include #include "obuf.h" static char buffer[4096]; /** Output buffer for \c stdout */ obuf outbuf = { { 1, buffer, 4096, 0, 0, 0, 0, IOBUF_NEEDSCLOSE, 0 }, 0, 0, (obuf_fn)write }; bglibs-2.04/iobuf/obuf_open.c0000664000076400007640000000051313244040127015466 0ustar bruceguenter#include "obuf.h" /** Initialize an \c obuf by opening a file for writing. */ int obuf_open(obuf* out, const char* filename, int oflags, int mode, unsigned bufsize) { int fd; if ((fd = open(filename, O_WRONLY | oflags, mode)) == -1) return 0; return obuf_init(out, fd, 0, IOBUF_NEEDSCLOSE|IOBUF_SEEKABLE, bufsize); } bglibs-2.04/iobuf/ibuf_stdin.c0000664000076400007640000000030413244040127015636 0ustar bruceguenter#include #include "ibuf.h" static char buffer[4096]; /** Input buffer for \c stdin */ ibuf inbuf = { { 0, buffer, 4096, 0, 0, 0, 0, IOBUF_NEEDSCLOSE, 0 }, 0, (ibuf_fn)read }; bglibs-2.04/iobuf/obuf_putsflush.c0000664000076400007640000000030013244040127016554 0ustar bruceguenter#include #include "obuf.h" /** Write a C string to the \c obuf and flush it. */ int obuf_putsflush(obuf* out, const char* str) { return obuf_puts(out, str) && obuf_flush(out); } bglibs-2.04/iobuf/iobuf_timeout.c0000664000076400007640000000072313244040127016367 0ustar bruceguenter#include #include "sysdeps.h" #include "iobuf.h" /** Wait for a file descriptor to be ready for reading or writing. */ int iobuf_timeout(iobuf* io, int poll_out) { iopoll_fd pfd; int result; if (!io->timeout) return 1; pfd.fd = io->fd; pfd.events = poll_out ? IOPOLL_WRITE : IOPOLL_READ; if ((result = iopoll_restart(&pfd, 1, io->timeout)) == -1) IOBUF_SET_ERROR(io); if (result) return 1; io->flags |= IOBUF_TIMEOUT; return 0; } bglibs-2.04/iobuf/obuf_flush.c0000664000076400007640000000111313244040127015643 0ustar bruceguenter#include #include #include "obuf.h" /** Write all pending data in the \c obuf to the file descriptor. */ int obuf_flush(obuf* out) { iobuf* io; unsigned wr; io = &out->io; if (iobuf_bad(io)) return 0; while (io->bufstart < io->buflen) { if (io->timeout && !iobuf_timeout(io, 1)) return 0; wr = out->writefn(io->fd, io->buffer+io->bufstart, io->buflen-io->bufstart); if (wr == (unsigned)-1) IOBUF_SET_ERROR(io); io->bufstart += wr; io->offset += wr; } io->buflen = 0; io->bufstart = 0; out->bufpos = 0; return 1; } bglibs-2.04/iobuf/iobuf_init.c0000664000076400007640000000263013244040127015643 0ustar bruceguenter#include #include #include #include #include "iobuf.h" /** The default iobuf buffer size, defaults to 8192. */ unsigned iobuf_bufsize = 8192; #if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) #define MAP_ANONYMOUS MAP_ANON #endif #ifndef MAP_FAILED #define MAP_FAILED ((void*)-1) #endif /** Initialize an \c iobuf structure. */ int iobuf_init(iobuf* io, int fd, unsigned bufsize, char* buffer, unsigned flags) { memset(io, 0, sizeof *io); if (!bufsize) bufsize = iobuf_bufsize; #ifdef MAP_ANONYMOUS if (!buffer) { if ((buffer = mmap(0, bufsize, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)) != MAP_FAILED) flags |= IOBUF_NEEDSMUNMAP; } #endif if (!buffer) { if ((buffer = malloc(bufsize)) == 0) return 0; flags |= IOBUF_NEEDSFREE; } io->fd = fd; io->buffer = buffer; io->bufsize = bufsize; io->flags = flags; return 1; } #ifdef SELFTEST_MAIN MAIN { static iobuf io; debugfn(iobuf_init(&io, 1, 0, 0, 0x100)); if (io.buffer == 0) obuf_puts(&outbuf, "buffer is NULL!\n"); if (io.buffer == MAP_FAILED) obuf_puts(&outbuf, "mmap failed!\n"); obuf_puts(&outbuf, "bufsize="); obuf_putu(&outbuf, io.bufsize); NL(); obuf_puts(&outbuf, "flags="); obuf_putx(&outbuf, io.flags); NL(); obuf_puts(&outbuf, "fd="); obuf_puti(&outbuf, io.fd); NL(); } #endif #ifdef SELFTEST_EXP result=1 bufsize=8192 flags=180 fd=1 #endif bglibs-2.04/iobuf/obuf_put3s.c0000664000076400007640000000105013244040127015600 0ustar bruceguenter#include #include "obuf.h" /** Write 3 C strings to the \c obuf */ int obuf_put3s(obuf* out, const char* s1, const char* s2, const char* s3) { if (s1 && !obuf_puts(out, s1)) return 0; if (s2 && !obuf_puts(out, s2)) return 0; if (s3 && !obuf_puts(out, s3)) return 0; return 1; } #ifdef SELFTEST_MAIN MAIN { obuf_put3s(&outbuf, "1", "2", "3"); NL(); obuf_put3s(&outbuf, 0, "2", "3"); NL(); obuf_put3s(&outbuf, "1", 0, "3"); NL(); obuf_put3s(&outbuf, "1", "2", 0); NL(); } #endif #ifdef SELFTEST_EXP 123 23 13 12 #endif bglibs-2.04/iobuf/obuf_digits.c0000664000076400007640000000027013244040127016010 0ustar bruceguenter#include "obuf.h" const char obuf_dec_digits[10] = "0123456789"; const char obuf_hex_lcase_digits[16] = "0123456789abcdef"; const char obuf_hex_ucase_digits[16] = "0123456789ABCDEF"; bglibs-2.04/iobuf/ibuf_getstr_crlf.c0000664000076400007640000000301013244040127017030 0ustar bruceguenter/* Copyright (C) 2005 Bruce Guenter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "ibuf.h" #include "str.h" /** Read a line from the \c ibuf into a dynamic string, terminated by a CR+LF pair. */ int ibuf_getstr_crlf(ibuf* in, struct str* s) { unsigned len; if (!ibuf_getstr(in, s, LF)) return 0; if (in->count == 0) return 0; /* Strip the trailing LF */ len = s->len-1; /* Strip a trailing CRs if present */ if (len > 0 && s->s[len-1] == CR) --len; str_truncate(s, len); return 1; } #ifdef SELFTEST_MAIN #include ibuf in = { { -1, "\n\r\na\nb\r\nd", 9, 9, 0, 0, 0, 0, 0 }, 0, (ibuf_fn)read }; MAIN { static str s; while (ibuf_getstr_crlf(&in, &s)) obuf_putf(&outbuf, "u{:}u{:}s{\n}", in.count, s.len, s.s); } #endif #ifdef SELFTEST_EXP 1:0: 2:0: 2:1:a 3:1:b #endif bglibs-2.04/iobuf/obuf_endl.c0000664000076400007640000000022413244040127015446 0ustar bruceguenter#include "obuf.h" /** Write a newline to the \c obuf and flush it. */ int obuf_endl(obuf* out) { return obuf_putc(out, LF) && obuf_flush(out); } bglibs-2.04/iobuf/obuf_sync.c0000664000076400007640000000042313244040127015501 0ustar bruceguenter#include #include #include "obuf.h" /** Flush the \c obuf and then \c fsync the file descriptor. */ int obuf_sync(obuf* out) { iobuf* io; if (!obuf_flush(out)) return 0; io = &out->io; if (fsync(io->fd) == -1) IOBUF_SET_ERROR(io); return 1; } bglibs-2.04/iobuf/obuf_pad.c0000664000076400007640000000035313244040127015273 0ustar bruceguenter#include "obuf.h" /** Pad the output with \c width instances of the single character \c ch. */ int obuf_pad(obuf* out, unsigned width, char ch) { while (width) { if (!obuf_putc(out, ch)) return 0; --width; } return 1; } bglibs-2.04/iobuf/obuf_putsllnumw.c0000664000076400007640000000311113244040127016754 0ustar bruceguenter#include "fmt.h" #include "obuf.h" /** Write a signed long long integer to the \c obuf with optional padding. */ int obuf_putsllnumw(obuf* out, long long data, unsigned width, char pad, unsigned base, const char* digits) { unsigned len = fmt_sllnumw(0, data, width, pad, base, digits); char buf[len]; fmt_sllnumw(buf, data, width, pad, base, digits); return obuf_write(out, buf, len); } /** Write a signed long long integer as decimal to the \c obuf with padding. */ int obuf_putiwll(obuf* out, long long data, unsigned width, char pad) { return obuf_putsllnumw(out, data, width, pad, 10, fmt_lcase_digits); } /** Write a signed long long integer as decimal to the \c obuf. */ int obuf_putill(obuf* out, long long data) { return obuf_putsllnumw(out, data, 0, 0, 10, fmt_lcase_digits); } #ifdef SELFTEST_MAIN MAIN { obuf_putiwll(&outbuf, 10, 0, 0); NL(); obuf_putiwll(&outbuf, -10, 0, 0); NL(); obuf_putiwll(&outbuf, 10, 5, ' '); NL(); obuf_putiwll(&outbuf, 10, 5, '0'); NL(); obuf_putiwll(&outbuf, -10, 5, ' '); NL(); obuf_putiwll(&outbuf, -10, 5, '0'); NL(); obuf_putiwll(&outbuf, 1000000000000LL, 0, 0); NL(); obuf_putiwll(&outbuf, -1000000000000LL, 0, 0); NL(); obuf_putiwll(&outbuf, 1000000000000LL, 15, ' '); NL(); obuf_putiwll(&outbuf, -1000000000000LL, 15, ' '); NL(); obuf_putiwll(&outbuf, 1000000000000LL, 15, '0'); NL(); obuf_putiwll(&outbuf, -1000000000000LL, 15, '0'); NL(); } #endif #ifdef SELFTEST_EXP 10 -10 10 00010 -10 -0010 1000000000000 -1000000000000 1000000000000 -1000000000000 001000000000000 -01000000000000 #endif bglibs-2.04/iobuf/obuf_putsnumw.c0000664000076400007640000000210713244040127016430 0ustar bruceguenter#include "fmt.h" #include "obuf.h" /** Write a signed integer to the \c obuf with optional padding. */ int obuf_putsnumw(obuf* out, long data, unsigned width, char pad, unsigned base, const char* digits) { unsigned len = fmt_snumw(0, data, width, pad, base, digits); char buf[len]; fmt_snumw(buf, data, width, pad, base, digits); return obuf_write(out, buf, len); } /** Write a signed integer as decimal to the \c obuf with padding. */ int obuf_putiw(obuf* out, long data, unsigned width, char pad) { return obuf_putsnumw(out, data, width, pad, 10, fmt_lcase_digits); } /** Write a signed integer as decimal to the \c obuf. */ int obuf_puti(obuf* out, long data) { return obuf_putsnumw(out, data, 0, 0, 10, fmt_lcase_digits); } #ifdef SELFTEST_MAIN MAIN { obuf_putiw(&outbuf, 10, 0, 0); NL(); obuf_putiw(&outbuf, -10, 0, 0); NL(); obuf_putiw(&outbuf, 10, 5, ' '); NL(); obuf_putiw(&outbuf, 10, 5, '0'); NL(); obuf_putiw(&outbuf, -10, 5, ' '); NL(); obuf_putiw(&outbuf, -10, 5, '0'); NL(); } #endif #ifdef SELFTEST_EXP 10 -10 10 00010 -10 -0010 #endif bglibs-2.04/iobuf/iobuf_copy.c0000664000076400007640000000120413244040127015646 0ustar bruceguenter#include "iobuf.h" /** Copy all the data from an \c ibuf to an \c obuf. */ int iobuf_copy(ibuf* in, obuf* out) { if (ibuf_eof(in)) return 1; if (ibuf_error(in) || obuf_error(out)) return 0; for (;;) { if (!obuf_write_large(out, in->io.buffer+in->io.bufstart, in->io.buflen-in->io.bufstart)) return 0; in->io.bufstart = in->io.buflen; if (!ibuf_refill(in)) return ibuf_eof(in); } } /** Copy all the data from an \c ibuf to an \c obuf, and flush the \c obuf after writing is completed. */ int iobuf_copyflush(ibuf* in, obuf* out) { if (!iobuf_copy(in, out)) return 0; return obuf_flush(out); } bglibs-2.04/iobuf/obuf_putnetstring.c0000664000076400007640000000051613244040127017276 0ustar bruceguenter#include "obuf.h" /** Write the binary block to the \c obuf as a "netstring". */ int obuf_putnetstring(obuf* out, const char* data, unsigned datalen) { if (!obuf_putu(out, datalen)) return 0; if (!obuf_putc(out, ':')) return 0; if (!obuf_write(out, data, datalen)) return 0; if (!obuf_putc(out, ',')) return 0; return 1; } bglibs-2.04/iobuf/ibuf_init.c0000664000076400007640000000047413244040127015470 0ustar bruceguenter#include #include "ibuf.h" /** Initialize an \c ibuf from an already-opened file descriptor. */ int ibuf_init(ibuf* in, int fd, ibuf_fn fn, unsigned flags, unsigned bufsize) { if (fn == 0) fn = (ibuf_fn)read; in->count = 0; in->readfn = fn; return iobuf_init(&(in->io), fd, bufsize, 0, flags); } bglibs-2.04/iobuf/obuf_put4s.c0000664000076400007640000000127013244040127015605 0ustar bruceguenter#include #include "obuf.h" /** Write 4 C strings to the \c obuf */ int obuf_put4s(obuf* out, const char* s1, const char* s2, const char* s3, const char* s4) { if (s1 && !obuf_puts(out, s1)) return 0; if (s2 && !obuf_puts(out, s2)) return 0; if (s3 && !obuf_puts(out, s3)) return 0; if (s4 && !obuf_puts(out, s4)) return 0; return 1; } #ifdef SELFTEST_MAIN MAIN { obuf_put4s(&outbuf, "1", "2", "3", "4"); NL(); obuf_put4s(&outbuf, 0, "2", "3", "4"); NL(); obuf_put4s(&outbuf, "1", 0, "3", "4"); NL(); obuf_put4s(&outbuf, "1", "2", 0, "4"); NL(); obuf_put4s(&outbuf, "1", "2", "3", 0); NL(); } #endif #ifdef SELFTEST_EXP 1234 234 134 124 123 #endif bglibs-2.04/iobuf/iobuf_close.c0000664000076400007640000000101413244040127016000 0ustar bruceguenter#include #include #include #include #include "iobuf.h" /** Close an \c iobuf and deallocate the buffer. */ int iobuf_close(iobuf* io) { int status; if (io->flags & IOBUF_NEEDSMUNMAP) { munmap(io->buffer, io->bufsize); io->buffer = 0; } else if (io->flags & IOBUF_NEEDSFREE) { free(io->buffer); io->buffer = 0; } status = 1; if ((io->flags & IOBUF_NEEDSCLOSE) && io->fd != -1) status = close(io->fd) != -1; io->fd = -1; return status; } bglibs-2.04/iobuf/ibuf_open.c0000664000076400007640000000053613244040127015465 0ustar bruceguenter#include #include "ibuf.h" /** Initialize an \c ibuf by opening a file for reading. */ int ibuf_open(ibuf* in, const char* filename, unsigned bufsize) { int fd; if ((fd = open(filename, O_RDONLY)) == -1) return 0; if (!ibuf_init(in, fd, 0, IOBUF_SEEKABLE|IOBUF_NEEDSCLOSE, bufsize)) { close(fd); return 0; } return 1; } bglibs-2.04/iobuf/ibuf_seek.c0000664000076400007640000000107413244040127015451 0ustar bruceguenter#include #include #include #include "ibuf.h" /** Set the effective read position. */ int ibuf_seek(ibuf* in, unsigned offset) { iobuf* io; unsigned buf_start; io = &(in->io); buf_start = io->offset - io->buflen; if (offset >= buf_start && offset <= io->offset) io->bufstart = offset - buf_start; else { if (lseek(io->fd, offset, SEEK_SET) != (off_t)offset) IOBUF_SET_ERROR(io); io->offset = offset; io->buflen = 0; io->bufstart = 0; } in->count = 0; io->flags &= ~IOBUF_EOF; return 1; } bglibs-2.04/iobuf/ibuf_getstr.c0000664000076400007640000000110213244040127016022 0ustar bruceguenter#include "ibuf.h" #include "str.h" /** Read a line from the \c ibuf into a dynamic string. */ int ibuf_getstr(ibuf* in, struct str* s, char boundary) { iobuf* io; int ch; io = &in->io; in->count = 0; str_truncate(s, 0); if (ibuf_eof(in) || ibuf_error(in) || ibuf_timedout(in)) return 0; for (;;) { if (io->bufstart >= io->buflen && !ibuf_refill(in)) { if (ibuf_eof(in)) break; return 0; } in->count++; ch = io->buffer[io->bufstart++]; if (!str_catc(s, ch)) return 0; if (ch == boundary) break; } return in->count > 0; } bglibs-2.04/conf-lib0000664000076400007640000000010013244040126013645 0ustar bruceguenter/usr/local/lib Libraries will be installed in this directory. bglibs-2.04/conf-cc0000664000076400007640000000013013244040126013467 0ustar bruceguentergcc -W -Wall -Wshadow -Wno-unused-result -Os -g This will be used to compile .c files. bglibs-2.04/warn-auto.sh0000664000076400007640000000010013244040127014503 0ustar bruceguenter#!/bin/sh # WARNING: This file was auto-generated. Do not edit! bglibs-2.04/pwcmp/0000755000076400007640000000000013244040127013367 5ustar bruceguenterbglibs-2.04/pwcmp/hex_encode.c0000664000076400007640000000214213244040127015635 0ustar bruceguenter/* hex_encode.c - Binary to hexadecimal encoding routine * Copyright (C) 2001 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "hex.h" const char hex_digits[16] = "0123456789abcdef"; void hex_encode(const unsigned char* bin, unsigned long len, char* hex) { while (len--) { unsigned char ch = *bin++; *hex++ = hex_digits[(ch >> 4) & 0xf]; *hex++ = hex_digits[ch & 0xf]; } *hex = 0; } bglibs-2.04/pwcmp/hex.h0000664000076400007640000000025513244040127014330 0ustar bruceguenter#ifndef PW_CMP__HEX__H__ #define PW_CMP__HEX__H__ extern void hex_encode(const unsigned char* bin, unsigned long len, char* hex); extern const char hex_digits[16]; #endif bglibs-2.04/pwcmp/client.h0000664000076400007640000000027713244040127015026 0ustar bruceguenter#ifndef PW_CMP__H__ #define PW_CMP__H__ extern int pwcmp_start(const char* module); extern int pwcmp_check(const char* plaintext, const char* encoded); extern void pwcmp_stop(void); #endif bglibs-2.04/pwcmp/module.h0000664000076400007640000000034613244040127015032 0ustar bruceguenter#ifndef PW_CMP__MODULE__H__ #define PW_CMP__MODULE__H__ /* The following, single symbol must be defined by the module. Everything else is taken care of. */ extern int pwcmp_check(const char* plain, const char* encod); #endif bglibs-2.04/pwcmp/client.c0000664000076400007640000000604513244040127015020 0ustar bruceguenter/* pwcmp/client.c - Password comparison client library * Copyright (C) 2001 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include "sysdeps.h" #include "client.h" typedef int (*pwcmpfn)(const char*, const char*); static long pid; static int fd0; static int fd1; static pwcmpfn cmpfn; static int pwcmp_plain(const char* plaintext, const char* encoded) { return strcmp(plaintext, encoded) == 0 ? 0 : 1; } static int pwcmp_crypt(const char* plaintext, const char* encoded) { extern char* crypt(const char* key, const char* salt); plaintext = crypt(plaintext, encoded); return pwcmp_plain(plaintext, encoded); } static int rwrite(int fd, const char* buf, unsigned long len) { while (len > 0) { unsigned long wr = write(fd, buf, len); if (wr == (unsigned long)-1) return 0; len -= wr; buf += wr; } return 1; } static int pwcmp_pipe(const char* plaintext, const char* encoded) { char buf[1]; if (!rwrite(fd0, plaintext, strlen(plaintext)+1)) return -1; if (!rwrite(fd0, encoded, strlen(encoded)+1)) return -1; if (read(fd1, buf, 1) != 1) return -1; return buf[0] == 0 ? 0 : 1; } static int pwcmp_start_pipe(const char* module) { int pipe0[2]; int pipe1[2]; if (pipe(pipe0) == -1) return 0; if (pipe(pipe1) == -1) { close(pipe0[0]); close(pipe0[1]); return 0; } if ((pid = fork()) == -1) { close(pipe0[0]); close(pipe0[1]); close(pipe1[0]); close(pipe1[1]); return 0; } if (pid == 0) { close(0); dup2(pipe0[0], 0); close(1); dup2(pipe1[1], 1); close(pipe0[0]); close(pipe0[1]); close(pipe1[0]); close(pipe1[1]); execlp(module, module, NULL); _exit(1); } else { close(pipe0[0]); fd0 = pipe0[1]; close(pipe1[1]); fd1 = pipe1[0]; } return 1; } int pwcmp_start(const char* module) { if (!module || module[0] == 0 || strcmp(module, "plain") == 0) cmpfn = pwcmp_plain; else if (strcmp(module, "crypt") == 0) cmpfn = pwcmp_crypt; else { cmpfn = pwcmp_pipe; if (!pwcmp_start_pipe(module)) return 0; } return 1; } int pwcmp_check(const char* plaintext, const char* encoded) { if (!cmpfn) return -1; return cmpfn(plaintext, encoded); } void pwcmp_stop(void) { if (cmpfn == pwcmp_pipe) { close(fd0); close(fd1); waitpid(pid, 0, WUNTRACED); } cmpfn = 0; } bglibs-2.04/pwcmp/module.c0000664000076400007640000000334313244040127015025 0ustar bruceguenter/* pwcmp/module.c - Password comparison module base code * Copyright (C) 2001 Bruce Guenter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include "module.h" static char buf[4096]; static unsigned buflen; static unsigned bufpos; static const char* plain; static const char* encod; static int do_read(void) { if (bufpos) { memmove(buf, buf+bufpos, buflen-bufpos); buflen -= bufpos; } while (buflen < sizeof buf) { const char* tmp; unsigned long rd; if (buflen) { if ((tmp = memchr(buf, 0, buflen)) != 0) { unsigned len; plain = buf; encod = tmp + 1; len = encod - buf; if ((tmp = memchr(encod, 0, buflen - len)) != 0) { ++tmp; bufpos = tmp - buf; return 1; } } } if ((rd = read(0, buf + buflen, sizeof buf - buflen)) == 0 || rd == (unsigned long)-1) break; buflen += rd; } return 0; } int main(void) { while (do_read()) { char tmp[1]; tmp[0] = pwcmp_check(plain, encod) ? 1 : 0; if (write(1, tmp, 1) != 1) break; } return 1; } bglibs-2.04/doc/0000755000076400007640000000000013244040127013006 5ustar bruceguenterbglibs-2.04/doc/qualify.html0000664000076400007640000001213313244040127015350 0ustar bruceguenter D. J. Bernstein
Internet publication
djbdns

User's guide to name qualification

Qualification means conversion of a short host name that you type, such as cheetah, into a complete (``fully qualified'') domain name, such as cheetah.heaven.af.mil.

This page explains the djbdns qualification procedure. These rules are followed by the dns_ip4_qualify library routine in djbdns, and by programs that use the dns_ip4_qualify routine.

Rewriting instructions

Normally the djbdns qualification procedure follows instructions listed in /etc/dnsrewrite, a file created by your system administrator. You can override /etc/dnsrewrite by creating your own file and setting the $DNSREWRITEFILE environment variable to the name of that file.

Sample instructions:

     # anything.local -> me
     -.local:me
     # me -> 127.0.0.1
     =me:127.0.0.1
     # any.name.a -> any.name.af.mil
     *.a:.af.mil
     # any-name-without-dots -> any-name-without-dots.heaven.af.mil
     ?:.heaven.af.mil
     # remove trailing dot
     *.:

Instructions are followed in order, each at most once. There are four types of instructions:

  • =post:new means that the host name post is replaced by new.
  • *post:new means that any name of the form prepost is replaced by prenew.
  • ?post:new means that any name of the form prepost, where pre does not contain dots or brackets, is replaced by prenew.
  • -post:new means that any name of the form prepost is replaced by new.

Searching

The djbdns qualification procedure can search through DNS for several possible qualifications of a name. For example, the name
     cheetah+.heaven.af.mil+.af.mil
is qualified as cheetah.heaven.af.mil if that name has IP addresses listed in DNS, or cheetah.af.mil otherwise.

In general, x+y1+y2+y3 is qualified as xy1 if xy1 has IP addresses listed in DNS; otherwise, as xy2 if xy2 has IP addresses listed in DNS; otherwise, as xy3. You can list any number of +'s.

Searching is applied after rewriting, so you can use a rewriting instruction such as

     ?:+.heaven.af.mil+.af.mil
to have lion qualified as lion.heaven.af.mil or lion.af.mil, and tiger qualified as tiger.heaven.af.mil or tiger.af.mil, and so on.

Searching is generally not a recommended feature. If you rely on gw being qualified as gw.af.mil, and someone suddenly adds a new gw.heaven.af.mil, you'll end up talking to the wrong host. It's better to rely on syntactic rules that you control.

Compatibility mechanisms

If the rewriting-instructions file does not exist, the djbdns qualification procedure looks for a local domain name in three places:
  1. the $LOCALDOMAIN environment variable, if it is set; or
  2. the first domain or search line in /etc/resolv.conf, if /etc/resolv.conf exists and has such a line; or
  3. everything after the first dot in the system's hostname.
It then creates rewriting instructions of the form
     ?:.domain
     *.:
so that .domain is added to any name without dots or brackets.

You can specify searching in $LOCALDOMAIN by using several domain names separated by spaces. Your system administrator can specify searching in /etc/resolv.conf by putting several domains on a search line.

Compatibility notes

Different DNS client programs use different qualification procedures. Two major differences between the djbdns qualification procedure and other qualification procedures:
  • Most programs use only /etc/resolv.conf. They don't know anything about /etc/dnsrewrite and $DNSREWRITEFILE.
  • Most long-running programs don't notice changes in /etc/resolv.conf; they read /etc/resolv.conf when they start, and they don't reread it until they are restarted. In contrast, the djbdns qualification procedure checks for changes every 10 minutes or 10000 uses.
Two minor differences:
  • Some programs interpret a domain line in /etc/resolv.conf as specifying a search list consisting of various suffixes of the domain.
  • Many programs will search the local domain for names with dots.
If you want the local domain searched for names with dots, you can set it up with rewriting:
     # aol.com -> aol.com or aol.com.heaven.af.mil
     *:++.heaven.af.mil
     # but skip directly to heaven.af.mil if no dots
     ?++.heaven.af.mil:.heaven.af.mil
bglibs-2.04/doc/template.cli0000664000076400007640000000341613244040127015320 0ustar bruceguenterDescription: A one-line description of what the program does. Include: #include Min: 0 Max: -1 Show-Pid: 0 Usage: FILE [FILE ...] [prefix] The text in this section is shown in the command usage before the options description. [options] The list of options this program accepts. Format is: -S --long TYPE[=VALUE] VARIABLE =default One line help text =default-text TYPE is one of: FLAG, COUNTER, INTEGER, UINTEGER, STRING, STRINGLIST, FUNCTION, or SEPARATOR. Examples: -q --quiet FLAG=0 opt_verbose Eliminate all program output except errors -v --verbose COUNTER=1 opt_verbose Generate more program output --count INTEGER opt_count =1 How many items to process =only the first -x STRINGLIST opt_extensions Add an extension name [suffix] The text in this section is shown in the command usage after the options description. [description] Long drawn out discussion of the program. [return value] What the program or function returns if successful. [errors] Exceptions, return codes, exit stati, and errno settings. [examples] Give some example uses of the program. [environment] @table @env @item NAME What setting @env{$NAME} does. @end table [files] All files used by the program. @table @file @item filename @end table [see also] Other man pages to check out, like man(1), man(7), makewhatis(8), or catman(8). [notes] Miscellaneous commentary. [caveats] Things to take special care with; sometimes called [warnings]. [diagnostics] All possible messages the program can print out--and what they mean. [bugs] Things that are broken or just don't work quite right. [restrictions] Bugs you don't plan to fix :-) [author] Who wrote it (or AUTHORS if multiple) [history] Programs derived from other sources sometimes have this, or you might keep a modification log here. bglibs-2.04/doc/qualify.txt0000664000076400007640000001102513244040127015222 0ustar bruceguenter [1]D. J. Bernstein [2]Internet publication [3]djbdns User's guide to name qualification Qualification means conversion of a short host name that you type, such as cheetah, into a complete (``fully qualified'') domain name, such as cheetah.heaven.af.mil. This page explains the djbdns qualification procedure. These rules are followed by the dns_ip4_qualify library routine in djbdns, and by programs that use the dns_ip4_qualify routine. Rewriting instructions Normally the djbdns qualification procedure follows instructions listed in /etc/dnsrewrite, a file created by your system administrator. You can override /etc/dnsrewrite by creating your own file and setting the $DNSREWRITEFILE environment variable to the name of that file. Sample instructions: # anything.local -> me -.local:me # me -> 127.0.0.1 =me:127.0.0.1 # any.name.a -> any.name.af.mil *.a:.af.mil # any-name-without-dots -> any-name-without-dots.heaven.af.mil ?:.heaven.af.mil # remove trailing dot *.: Instructions are followed in order, each at most once. There are four types of instructions: * =post:new means that the host name post is replaced by new. * *post:new means that any name of the form prepost is replaced by prenew. * ?post:new means that any name of the form prepost, where pre does not contain dots or brackets, is replaced by prenew. * -post:new means that any name of the form prepost is replaced by new. Searching The djbdns qualification procedure can search through DNS for several possible qualifications of a name. For example, the name cheetah+.heaven.af.mil+.af.mil is qualified as cheetah.heaven.af.mil if that name has IP addresses listed in DNS, or cheetah.af.mil otherwise. In general, x+y1+y2+y3 is qualified as xy1 if xy1 has IP addresses listed in DNS; otherwise, as xy2 if xy2 has IP addresses listed in DNS; otherwise, as xy3. You can list any number of +'s. Searching is applied after rewriting, so you can use a rewriting instruction such as ?:+.heaven.af.mil+.af.mil to have lion qualified as lion.heaven.af.mil or lion.af.mil, and tiger qualified as tiger.heaven.af.mil or tiger.af.mil, and so on. Searching is generally not a recommended feature. If you rely on gw being qualified as gw.af.mil, and someone suddenly adds a new gw.heaven.af.mil, you'll end up talking to the wrong host. It's better to rely on syntactic rules that you control. Compatibility mechanisms If the rewriting-instructions file does not exist, the djbdns qualification procedure looks for a local domain name in three places: 1. the $LOCALDOMAIN environment variable, if it is set; or 2. the first domain or search line in /etc/resolv.conf, if /etc/resolv.conf exists and has such a line; or 3. everything after the first dot in the system's hostname. It then creates rewriting instructions of the form ?:.domain *.: so that .domain is added to any name without dots or brackets. You can specify searching in $LOCALDOMAIN by using several domain names separated by spaces. Your system administrator can specify searching in /etc/resolv.conf by putting several domains on a search line. Compatibility notes Different DNS client programs use different qualification procedures. Two major differences between the djbdns qualification procedure and other qualification procedures: * Most programs use only /etc/resolv.conf. They don't know anything about /etc/dnsrewrite and $DNSREWRITEFILE. * Most long-running programs don't notice changes in /etc/resolv.conf; they read /etc/resolv.conf when they start, and they don't reread it until they are restarted. In contrast, the djbdns qualification procedure checks for changes every 10 minutes or 10000 uses. Two minor differences: * Some programs interpret a domain line in /etc/resolv.conf as specifying a search list consisting of various suffixes of the domain. * Many programs will search the local domain for names with dots. If you want the local domain searched for names with dots, you can set it up with rewriting: # aol.com -> aol.com or aol.com.heaven.af.mil *:++.heaven.af.mil # but skip directly to heaven.af.mil if no dots ?++.heaven.af.mil:.heaven.af.mil References 1. file:///home/bruce/dev/djb.html 2. file:///home/bruce/dev/web.html 3. file:///home/bruce/dev/djbdns.html bglibs-2.04/NEWS0000664000076400007640000005324413244040126012751 0ustar bruceguenter------------------------------------------------------------------------------- Changes in version 2.04 - Fixed DNS self-tests relying on external data. - Added support for DNS queries on an alternate port. - Added support for $MSG_NO_PROGRAM to suppress the "program: " prefix. - Fixed problem with struct ucred not being pulled in properly. - Fixed several problems with dns_qualify. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 2.03 - Reverted libbg-cli back to static linkage (for now) to fix problem with cli-generate generated code. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 2.02 - Fixed header include path in cli-generate. - Rewrote iobuf and str number formatting using fmt. - Added missing selftest.c file to the dist tarball (oops). Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 2.01 - Fixed uint##.h headers. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 2.00 - Flattened out the installed headers and libraries. NOTE: This means this package is not backwards compatible. - Added dns library (modified from public domain djbdns-1.05) - Added wildcard handling and substitution to bg-installer. - Added reversed IPv4 formatting functions (from Jorge Valdes). - Added str_end* and str_case_end* functions, parallel to str_start* and str_case_start* but for suffixes. - Added the ability to use arbitrary format functions in fmt_multi. - Added support for enumerate and itemize in cli-generate. - Added surfrand_uniform function, protected against bias. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.106 - Fixed installation of msg/debug.h header file. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.105 - Fixed envstr_unset to remove all instances of the given name. - Added sysdep for d_ino and d_type in struct dirent. - Fixed the path_match function to match filenames containing pattern characters (ie [filename] etc) the same way shells do. - Files generated by cli-generate now indicate the source .cli file. - Fixed the debug messages to not enable any by default. - Modified the build procedure to build all sources with libtool. This should fix problems with parallel make. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.104 - Fixed several typos in the installation files. - Renamed some files that differed only in upper/lower case. This should fix building on OSX. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.103 - Added two missing header files: fmt/misc.h and fmt/multi.h - Added a ghash_set function (like ghash_add, but overwrites). - Added a set of "signalfd" functions as a generic self-pipe setup. - Added a random number generator based on SURF. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.102 - Fixed a bug in resolve_ipv4name_n: when handling multiple IPs, it would always copy the first one multiple times. - Added more conversions to fmt_multi: S - formats a str m - formats the result of strerror(errno) Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.101 - Fixed include compatibility problem in sys/tryclockgettime.c. Thanks Amitai Schlair - Added sysdep for __attribute__. - Marked some symbols as "weak" to prevent link errors if they aren't defined by programs using -lbg. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.100 * This package now builds and installs as a shared library. * Requires libtool to be installed. - Added support to bg-installer for installing shared libraries with libtool. - Fixed a bug in counting the length of signed and unsigned long long integers (0 was counted as having zero length). - Fixed bug in error return of ibuf_openreadclose. Thanks Gerrit Pape. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.041 - Modified cli-generate to add man page and HTML output options, and more formatting commands. - Tweaked the hmac_finish prototype to properly indicate that the midstate is const and unmodified by the function. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.040 - Added cli-generate, a program to produce C header and source from command-line interface description files. - Modified the crypto HMAC code to do precalculation of the intermediate hash results. - Fixed base64 decoding on systems where char is unsigned by default. Thanks Gerrit Pape. - Tweaked the ghash_add function to return a pointer to the newly created entry (since some uses will want to use it immediately). - Stop blocking SIGSEGV with the sig_all_* functions, as this has resulted in bugs causing endless signal loops. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.031 - Brown paper bag release to fix missing header file for HMAC support. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.030 - Added a RFC 2104 generic HMAC (keyed hashing for message authentication) routine to the crypto section, with control blocks for MD5, SHA1, SHA256, SHA384, and SHA512. - Added support for UID and GID names (instead of just numbers) in bg-installer. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.028 - Added sysdep for dynamic linker functions (dlopen etc). - Fixed bug in self test for unix/selfpipe.c that caused problems with running make. - Switched from standard GPL to LGPL-2.1 license. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.027 - Fixed numberic export glitch in vpwentry_export. - Fixed dependancies to let "make -j" work properly. - Added some pre-computed .lib files (such as socket.lib). Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.026 - Fixed negative indexing bugs in str_findprev* and ibuf_getstr_crlf functions. Thanks Gerrit Pape. - Added the capability to bg-installer to optionally run commands based on the existance of the source (or another) file. - Fixed bg-installer to not create directories in "dry-run" mode. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.025 - Added the capability to bg-installer to handle multiple destinations within the same source list. - Renamed the "setmode" function in bg-installer that was causing compile problems on *BSD systems. - Added a sysdep for struct timespec and clock_gettime, which are defined if not present. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.024 - Fixed (again) glob patterns to allow both "!" (like modern glob) or "^" (like existing shells) for negating character sets. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.023 - Tweaked str_alloc to use realloc when appropriate. - Fixed glob pattern matches to use "!" instead of "~" for negating character sets like all other globs use. - Fixed the installer libraries to include all the necessary object files for producing the installer/instcheck/instshow programs. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.022 - Added a generic installer program, similar to the "install" program included with ezmlm. - Fixed the instshow library to use and dispaly the install prefix just like the other instlib programs. - The installers now automatically create missing directories, and installs into temporary files that get renamed. - Added path_mkdirs function. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.021 - Fixed typo bug in str_catfv and str_copyfv that caused failures on (at least) PPC and S390 architectures. Thanks Gerrit Pape. - Fixed 32-to-64 bit sign extension bug in fmt_multi on some 64-bit platforms. Thanks Gerrit Pape. - installer/instcheck program libraries now optionally install into a prefix directory specified on the command line or with $install_prefix (which can be set on the make command line). - Installation is now done under seperate include/lib directories. - Added sysdep for "extern int daylight" (replaced by a macro if not present). Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.020 - Fixed a couple of length counting bugs in the fmt number code. - Added multiple-item formatting functions fmt_multi (similar to printf, but safer), fmt_multiv, obuf_putf, str_catf, and str_copyf, as well as a set of formatted message functions. Note: As of this version, a C99-compatible compiler is required to build the software. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.019 - Broke the iobuf includes into smaller parts. - Added low-level fcntl wrapper functions: fcntl_{fd,fl}_{off,on} - Added cloexec_{off,on} functions to manipulate the close-on-exec flag. - Selfpipes now close-on-exec to prevent the pipe from being exported to child processes. - Changed the error in ibuf_getnetstring from EPROTO to EPROTOTYPE to fix compile errors on *BSD systems. Thanks Ville Walveranta. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.018 - Added missing crypto/surf.h and unix/selfpipe.h headers to insthier. - Added sysdep and emulator function for mkfifo. - Added sysdep check for the "named pipe bug": polling a named pipe without a writer unconditionally succeeds. - Fixed bug in ibuf_getu: didn't subtract ASCII '0' offset from digits. - Added environment string manipulation functions. - Added named pipe trigger functions. - Added str_getnetstring function. - Added ghash_remove function. - Added ghashiter functions, for iteration over ghash tables. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.017 - Added SURF (Simple Unpredictable Random Function) from the algorithm described in http://cr.yp.to/papers/surf.ps - Added str_catns, str_copyns, and obuf_putns functions that take a variable number of char* parameters. - Fixed utoa to write into its buffer instead of before it. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.016 - Fixed socket_notcpdelay on FreeBSD 4.x (and possibly other BSDs). - Added back the definition of socket_tcp and socket_udp, the omission of which broke linking with libraries compiled against older bglibs. - Added functions for querying UCSPI environment variables. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.015 - Added a "libbg.a" build target, including all the other libraries that don't define a main routine (like cli). - Added set of str_splice functions, to insert one string into another. - Added IPv6 address parsing/formatting and network functions. - Added a library of number formatting routines. - Modifed str_subst to return a count of substitutions. - Added str_xlate function. - Added socket connect functions with a timeout. - Added ibuf_readall, ibuf_openreadclose, ibuf_copytofd, and obuf_copyfromfd. - Added resolve_ipv4name_n, to resolve a name to more than one IP. - Rewrote the CRC routines in terms of "generic" forward and reflected functions. - Added CRC32C (used in iSCSI) functions. NOTE: The next non-bugfix version of bglibs will be rewritten to use the new formatting routines in the appropriate iobuf and str functions. This will require linking against additional libraries in the future, or against the all-inclusive libbg.a. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.011 - Fixed up the selftests in unix/selfpipe.c to work if additional file descriptors are already opened. - Fixed missing "ULL" on one constant in the SHA-512 library. - Fixed up crc64 table generation on 64-bit platforms. - Fixed ipv4 address parsing number validation. - Fixed crc table generation on Solaris caused by missing #include - Internal changes to installer scripts to make it work on systems where the root directory is non-readable. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.010 - Added a getpeereid sysdep function. - Added self-pipe SIGCHLD handling functions. - Added some small optimizations to the SHA-256/512 code and fixed a one-off bug. - Added some major optimizations to the SHA-1 update/final code. - Removed the cvm libraries. - All the CRC tables are now generated at build time. - Split the case insensitive parts of the str_glob and str_match functions into str_case_glob and str_case_match respectively. - wrap_* functions can now exit with a customized error code. - Added str_start functions. - Fixed another installer bug, which caused the "installer.a" library to get installed as "instcheck.a" Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.009 - Rewrite the SHA-256 and SHA-512 algorithms to make them work on both 64-bit and MSB platforms, and added the SHA-384 algorithm. - Fixed iobuf/iobuf_init.c for systems that lack anonymous mmap. - Turn off recv/sendfd if the appropriate defines are missing. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.008 - Added queue and stack ADT's. - Added globbing function to the str library. - Changed str_match functions to add case insensitivity. - Added "function" options, and option separators to the CLI library, as well as enhancing the string list type. - More portability fixes. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.007 - Fixed bug in iobuf/iobuf_init.c -- parameters to mmap happened to work on Linux but were completely bogus for portability. - Switched the 64-bit CRC function to use the polynomial specified in the DLT1 spec (ECMA-182). - Added (count 'em) three 16-bit CRC functions -- ARC, CCITT, and XMODEM. - Added generic number output routines to iobuf, and generic number appending routines to str. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.006 - Added uint16, uint32, and uint64 pack/unpack functions. - Added 32 and 64 bit CRC functions, and the Mersenne Twister random number generator. - Changed the ipv4addr typedef to make explicit when it's being passed by reference. This breaks source code compatibility with previous versions. - Major internal reorganization moving many files into subdirectories. - More portability fixes. - Started working on adding Doxygen documentation to the sources. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.005 - Portability fixes for *BSD (possibly others). - #define MSG_NO_DEBUG before including and no debugging messages will be compiled into the object code. - Added long long str_cat*ll and obuf_put*ll functions. - Added str_match simple pattern-matching function. - Fixed the shadowed global variable naming conflicts. - Flattened out and simplified the installed lib files. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.003 - Optimized path matching to only stat intermediate entries if they don't contain any meta-characters, instead of reading the entire directory and matching. - Fixed a bug in str/cmp.c: it missed adding offset to the string pointer. - Fixed bug in iobuf/[io]buf_seek.c -- seeks to the current read/write position should not cause an lseek syscall. - The iobuf library now uses an anonymous mmap region for I/O instead of a malloced buffer, if possible. Some OS's can optimize away a data copy using this kind of mechanism. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.002 - Fixed bug in str_cat#s routines: they didn't increase the string length. - Added crypto hash libraries (MD5, SHA1, SHA256, SHA512). - Added a dict_foreach routine for iterating over the contents of a dictionary. - Removed the silly trailing "." from the common message output code. - Portability fixes for FreeBSD (and possibly others). Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- Changes in version 1.001 - Moved the file destination to /usr/local/bglibs/* from /usr/local/*/bglibs - Added missing pwcmp/client include & library. - Added missing uint32.h and uint64.h targets. Development of this version has been sponsored by FutureQuest, Inc. ossi@FutureQuest.net http://www.FutureQuest.net/ ------------------------------------------------------------------------------- bglibs-2.04/cli-generate.10000664000076400007640000001112613244040126014664 0ustar bruceguenter.TH cli-generate 1 .SH NAME cli-generate \- Generate source and documentation from CLI descriptions .SH SYNOPSIS .B cli-generate [ .B -c | .B -h | .B -m | .B -w ] .I FILENAME.cli .SH DESCRIPTION .SS Operation .B cli-generate reads in a CLI (command line interface) description file, parses it into its various sections, and prints out one of a set of output files. In typical usage, that output would be directed to a file and later compiled or included in other sources. The CLI file (named \fBPROGRAM\fI.cli\fR) is divided into two parts, a header (formatted much like a standard mail header) and a series of sections. Headers and sections other than those specified below are ignored. All headers and sections are optional. .SS File Format .nf file = header "\\n" *section header = *(header-line "\\n") header-line = header-field ":" whitespace value whitespace = *(SPACE / TAB) section = "[" name "]" "\\n" lines lines = *( line "\\n" ) .fi .SS Headers .TP .B Description: A one-line description of what the program does. .TP .B Include: Add C statements to #include the given source file. Must be formatted as either .I or .I "file" .TP .B Min: The minimum number of allowed non-option arguments. Defaults to 0. .TP .B Max: The maximum number of allowed non-option arguments. Negative values mean unlimited. Defaults to -1. .TP .B Show-Pid: Set to non-zero if the resulting program is to show its PID with every output message. Defaults to 0. .TP .B Usage: A one-line description of the intended usage. Defaults to empty. .SS Section Names .TP .B [prefix] The text in this section is shown in the command usage before the options description. .TP .B [options] The list of options this program accepts. See below for their format. .TP .B [suffix] The text in this section is shown in the command usage after the options description. .TP .B [description] .TP .B [return value] .TP .B [errors] .TP .B [examples] .TP .B [environment] .TP .B [files] .TP .B [see also] .TP .B [notes] .TP .B [caveats] .TP .B [diagnostics] .TP .B [bugs] .TP .B [restrictions] .TP .B [author] .TP .B [history] These sections are formatted and copied into the man page in the standard order. .SS Options Format .nf options = *(option / separator) option = option1 "\\n" option2 "\\n" *(line "\\n") option1 = [shortopt] [longopt] type ["=" flag-value] variable ["=" init] option2 = helpstr ["=" default] separator = "-- " text "\\n" shortopt = "-" character longopt = "--" word type = "FLAG" / "COUNTER" / "INTEGER" / "UINTEGER" / "STRING" / "STRINGLIST" / "FUNCTION" .fi If not specified, .I flag-value and .I init are .IR 0 , and .I default is empty. .SS Formatting Except for .BR [prefix] , .BR [options] , and .BR [suffix] , all of the sections support formatting instructions similar to that of TeXinfo (but greatly simplified). .TP .I @strong{text} Use "strong" (bold) text. .TP .I @command{text} Indicate the name of a command. .TP .I @option{text} Indicate a command-line option. .TP .I @emph{text} Use "emphatic" (italicized) text. .TP .I @var{text} Indicate a metasyntactic variable. .TP .I @env{text} Indicate an environment variable. .TP .I @file{text} Indicate the name of a file. .TP .I @code{text} Indicate text that is a literal example of a piece of a program. .TP .I @samp{text} Indicate text that is a literal example of a sequence of characters. .TP .I @example .TP .I @end example The text between these two tags is indented. .TP .I @verbatim .TP .I @end verbatim Everything between these two tags is passed as-is (verbatim) to the output. .TP .I @table @format .TP .I @end table Mark up a two-column table, or "definition list". .TP .I @item paragraph Add an item to a table. The .I @item starts a paragraph that will be the actual list entry. Any subsequent paragraphs will be typeset seperately. .SH OPTIONS .TP .B \-c Output C source code. .TP .B \-h Output C header file. .TP .B \-m Output a UNIX man page. .TP .B \-w Output HTML (web) markup. .SH EXAMPLES Here is a sample CLI file, containing many of the described elements. .nf Min: 1 Max: 1 Usage: PATH Description: Create a file. Show-Pid: 0 Include: [prefix] If the given PATH is a directory, it is suffixed with another name. [description] @program generates a new random file from a variety of sources including @command{ls} and @command{ps} output. If the given @option{PATH} is a directory, it is suffixed with another name of my choosing. [options] -v --verbose FLAG=1 opt_verbose -t --type STRING opt_type = "type1" The type of the file to generate. = type1 Possible types for this include @option{type1} and @option{base64}. .fi .SH AUTHOR Bruce Guenter bglibs-2.04/uint16.h0000664000076400007640000000077413244040127013552 0ustar bruceguenter#ifndef UINT16_H #define UINT16_H #include "sysdeps.h" #include "uintnn.h" __UINTNN_DECL(16,2) #define uint16_get uint16_get_lsb #define uint16_pack uint16_pack_lsb #define uint16_unpack uint16_unpack_lsb #ifdef ENDIAN_LSB #define uint16_get_native uint16_get_lsb #define uint16_pack_native uint16_pack_lsb #define uint16_unpack_native uint16_unpack_lsb #else #define uint16_get_native uint16_get_msb #define uint16_pack_native uint16_pack_msb #define uint16_unpack_native uint16_unpack_msb #endif #endif bglibs-2.04/INSTHIER0000664000076400007640000000140713244040126013414 0ustar bruceguenter>bin c:::755::bg-installer c:::755::cli-generate c:::755::crc-gentab >include d:::755:bglibs c:::644:bglibs:sysdeps.h c:::644:bglibs:systime.h c:::644:bglibs:uintnn.h c:::644:bglibs:uint16.h c:::644:bglibs:uint32.h c:::644:bglibs:uint64.h c:::644:bglibs:$2:include/*.h d:::755:pwcmp c:::644:pwcmp:client.h:pwcmp/client.h c:::644:pwcmp:hex.h:pwcmp/hex.h c:::644:pwcmp:module.h:pwcmp/module.h d:::755:vmailmgr c:::644:vmailmgr:client.h:vmailmgr/client.h c:::644:vmailmgr:vpwentry.h:vmailmgr/vpwentry.h >lib l:::755::libbg.la c:::644::libbg-cli.a:.libs/libbg-cli.a c:::644::libpwcmp.a:.libs/libpwcmp.a c:::644::libpwcmp-module.a:.libs/libpwcmp-module.a c:::644::libvmailmgr.a:.libs/libvmailmgr.a >man d:::755:man1 c:::644:man1:bg-installer.1 c:::644:man1:cli-generate.1 bglibs-2.04/Makefile0000664000076400007640000024170413244040126013712 0ustar bruceguenter# Don't edit Makefile! Use conf-* for configuration. # # Generated by spac see http://untroubled.org/spac/ SHELL=/bin/sh DEFAULT: all adt/adt_sp.lo adt/adt_sp.o: ltcompile adt/adt_sp.c include/bglibs/adt_common.h ./ltcompile adt/adt_sp.c adt/ghash_add.lo adt/ghash_add.o: ltcompile adt/ghash_add.c include/bglibs/ghash.h include/bglibs/adt_common.h ./ltcompile adt/ghash_add.c adt/ghash_foreach.lo adt/ghash_foreach.o: ltcompile adt/ghash_foreach.c include/bglibs/ghash.h include/bglibs/adt_common.h ./ltcompile adt/ghash_foreach.c adt/ghash_free.lo adt/ghash_free.o: ltcompile adt/ghash_free.c include/bglibs/ghash.h include/bglibs/adt_common.h ./ltcompile adt/ghash_free.c adt/ghash_get.lo adt/ghash_get.o: ltcompile adt/ghash_get.c include/bglibs/ghash.h include/bglibs/adt_common.h ./ltcompile adt/ghash_get.c adt/ghash_init.lo adt/ghash_init.o: ltcompile adt/ghash_init.c include/bglibs/ghash.h include/bglibs/adt_common.h ./ltcompile adt/ghash_init.c adt/ghash_insert.lo adt/ghash_insert.o: ltcompile adt/ghash_insert.c include/bglibs/ghash.h include/bglibs/adt_common.h ./ltcompile adt/ghash_insert.c adt/ghash_iter.lo adt/ghash_iter.o: ltcompile adt/ghash_iter.c include/bglibs/ghash.h include/bglibs/adt_common.h ./ltcompile adt/ghash_iter.c adt/ghash_rebuild.lo adt/ghash_rebuild.o: ltcompile adt/ghash_rebuild.c include/bglibs/ghash.h include/bglibs/adt_common.h ./ltcompile adt/ghash_rebuild.c adt/ghash_rehash.lo adt/ghash_rehash.o: ltcompile adt/ghash_rehash.c include/bglibs/ghash.h include/bglibs/adt_common.h ./ltcompile adt/ghash_rehash.c adt/ghash_remove.lo adt/ghash_remove.o: ltcompile adt/ghash_remove.c include/bglibs/ghash.h include/bglibs/adt_common.h ./ltcompile adt/ghash_remove.c adt/ghash_search.lo adt/ghash_search.o: ltcompile adt/ghash_search.c include/bglibs/ghash.h include/bglibs/adt_common.h ./ltcompile adt/ghash_search.c adt/ghash_set.lo adt/ghash_set.o: ltcompile adt/ghash_set.c include/bglibs/ghash.h include/bglibs/adt_common.h ./ltcompile adt/ghash_set.c adt/gqueue_pop.lo adt/gqueue_pop.o: ltcompile adt/gqueue_pop.c include/bglibs/gqueue.h include/bglibs/adt_common.h ./ltcompile adt/gqueue_pop.c adt/gqueue_push.lo adt/gqueue_push.o: ltcompile adt/gqueue_push.c include/bglibs/gqueue.h include/bglibs/adt_common.h ./ltcompile adt/gqueue_push.c adt/gqueue_top.lo adt/gqueue_top.o: ltcompile adt/gqueue_top.c include/bglibs/gqueue.h include/bglibs/adt_common.h ./ltcompile adt/gqueue_top.c adt/gstack_pop.lo adt/gstack_pop.o: ltcompile adt/gstack_pop.c include/bglibs/gstack.h include/bglibs/adt_common.h ./ltcompile adt/gstack_pop.c adt/gstack_push.lo adt/gstack_push.o: ltcompile adt/gstack_push.c include/bglibs/gstack.h include/bglibs/adt_common.h ./ltcompile adt/gstack_push.c adt/gstack_top.lo adt/gstack_top.o: ltcompile adt/gstack_top.c include/bglibs/gstack.h include/bglibs/adt_common.h ./ltcompile adt/gstack_top.c adt/hashb.lo adt/hashb.o: ltcompile adt/hashb.c include/bglibs/adt_common.h ./ltcompile adt/hashb.c adt/hashs.lo adt/hashs.o: ltcompile adt/hashs.c include/bglibs/adt_common.h ./ltcompile adt/hashs.c all: sysdeps.h libraries programs man selftests base64/asc2bin.lo base64/asc2bin.o: ltcompile base64/asc2bin.c include/bglibs/base64.h include/bglibs/str.h sysdeps.h ./ltcompile base64/asc2bin.c base64/bin2asc.lo base64/bin2asc.o: ltcompile base64/bin2asc.c include/bglibs/base64.h include/bglibs/str.h sysdeps.h ./ltcompile base64/bin2asc.c base64/decode_line.lo base64/decode_line.o: ltcompile base64/decode_line.c include/bglibs/base64.h include/bglibs/str.h sysdeps.h ./ltcompile base64/decode_line.c base64/decode_part.lo base64/decode_part.o: ltcompile base64/decode_part.c include/bglibs/base64.h include/bglibs/str.h sysdeps.h ./ltcompile base64/decode_part.c base64/encode_line.lo base64/encode_line.o: ltcompile base64/encode_line.c include/bglibs/base64.h include/bglibs/str.h sysdeps.h ./ltcompile base64/encode_line.c base64/encode_part.lo base64/encode_part.o: ltcompile base64/encode_part.c include/bglibs/base64.h include/bglibs/str.h sysdeps.h ./ltcompile base64/encode_part.c bg-installer: bg-installer.o ltload libbg-cli.la libbg.la bg-installer-cli.o ./ltload bg-installer libbg-cli.la libbg.la bg-installer-cli.o -lbg-cli -static bg-installer-cli.c: bg-installer.cli cli-generate sysdeps.h ./cli-generate -c $< >$@ bg-installer-cli.h: bg-installer.cli cli-generate ./cli-generate -h $< >$@ bg-installer-cli.o: compile bg-installer-cli.c ./compile bg-installer-cli.c bg-installer.1: bg-installer.cli cli-generate ./cli-generate -m $< >$@ bg-installer.o: compile bg-installer.c sysdeps.h include/bglibs/cli.h include/bglibs/fmt.h include/bglibs/ibuf.h include/bglibs/iobuf_common.h include/bglibs/obuf.h sysdeps.h include/iobuf_common.h include/bglibs/iobuf.h include/ibuf.h include/obuf.h sysdeps.h include/bglibs/msg.h sysdeps.h include/bglibs/debug.h include/bglibs/wrap.h include/bglibs/path.h include/bglibs/str.h sysdeps.h include/str.h sysdeps.h include/bglibs/striter.h bg-installer-cli.h ./compile bg-installer.c cdb/cdb.lo cdb/cdb.o: ltcompile cdb/cdb.c include/bglibs/cdb.h include/bglibs/iobuf.h include/bglibs/iobuf_common.h include/bglibs/ibuf.h include/iobuf_common.h include/bglibs/obuf.h sysdeps.h sysdeps.h ./ltcompile cdb/cdb.c cdb/cdbhash.lo cdb/cdbhash.o: ltcompile cdb/cdbhash.c include/bglibs/cdb.h include/bglibs/iobuf.h include/bglibs/iobuf_common.h include/bglibs/ibuf.h include/iobuf_common.h include/bglibs/obuf.h sysdeps.h sysdeps.h ./ltcompile cdb/cdbhash.c cdb/find.lo cdb/find.o: ltcompile cdb/find.c include/bglibs/cdb.h include/bglibs/iobuf.h include/bglibs/iobuf_common.h include/bglibs/ibuf.h include/iobuf_common.h include/bglibs/obuf.h sysdeps.h sysdeps.h uint32.h sysdeps.h uintnn.h ./ltcompile cdb/find.c cdb/get.lo cdb/get.o: ltcompile cdb/get.c include/bglibs/cdb.h include/bglibs/iobuf.h include/bglibs/iobuf_common.h include/bglibs/ibuf.h include/iobuf_common.h include/bglibs/obuf.h sysdeps.h sysdeps.h include/bglibs/str.h sysdeps.h ./ltcompile cdb/get.c cdb/getnext.lo cdb/getnext.o: ltcompile cdb/getnext.c include/bglibs/cdb.h include/bglibs/iobuf.h include/bglibs/iobuf_common.h include/bglibs/ibuf.h include/iobuf_common.h include/bglibs/obuf.h sysdeps.h sysdeps.h include/bglibs/str.h sysdeps.h ./ltcompile cdb/getnext.c cdb/make.lo cdb/make.o: ltcompile cdb/make.c include/bglibs/cdb.h include/bglibs/iobuf.h include/bglibs/iobuf_common.h include/bglibs/ibuf.h include/iobuf_common.h include/bglibs/obuf.h sysdeps.h sysdeps.h cdb/make.h include/iobuf.h include/ibuf.h include/obuf.h sysdeps.h sysdeps.h uint32.h sysdeps.h uintnn.h ./ltcompile cdb/make.c cdb/read.lo cdb/read.o: ltcompile cdb/read.c include/bglibs/cdb.h include/bglibs/iobuf.h include/bglibs/iobuf_common.h include/bglibs/ibuf.h include/iobuf_common.h include/bglibs/obuf.h sysdeps.h sysdeps.h ./ltcompile cdb/read.c choose: warn-auto.sh choose.sh cat warn-auto.sh choose.sh >choose chmod 755 choose clean: TARGETS rm -f `cat TARGETS` clean-spac: clean AUTOFILES rm -f `cat AUTOFILES` cli-generate: perl-head.pl cli-generate.pl cat perl-head.pl cli-generate.pl >cli-generate chmod 755 cli-generate cli/help.lo cli/help.o: ltcompile cli/help.c include/bglibs/iobuf.h include/bglibs/iobuf_common.h include/bglibs/ibuf.h include/iobuf_common.h include/bglibs/obuf.h sysdeps.h include/bglibs/msg.h sysdeps.h include/bglibs/debug.h systime.h include/bglibs/cli.h cli/internal.h ./ltcompile cli/help.c cli/main.lo cli/main.o: ltcompile cli/main.c include/bglibs/iobuf.h include/bglibs/iobuf_common.h include/bglibs/ibuf.h include/iobuf_common.h include/bglibs/obuf.h sysdeps.h include/bglibs/msg.h sysdeps.h include/bglibs/debug.h systime.h include/bglibs/cli.h cli/internal.h ./ltcompile cli/main.c compile: conf-cc ( echo '#!/bin/sh'; \ echo 'source=$$1; shift'; \ echo 'base=`echo "$$source" | sed -e s:\\\\.c$$::`'; \ echo exec `head -n 1 conf-cc` -I. "-I'include/bglibs'" "-I'include'" '-o $${base}.o -c $$source $${1+"$$@"}'; \ ) >compile chmod 755 compile crc-gentab: crc-gentab.o load fmt/lcase.o fmt/ucase.o fmt/unum.o iobuf/iobuf_timeout.o iobuf/obuf_flush.o iobuf/obuf_pad.o iobuf/obuf_put3s.o iobuf/obuf_put5s.o iobuf/obuf_putc.o iobuf/obuf_putunumw.o iobuf/obuf_stderr.o iobuf/obuf_stdout.o iobuf/obuf_write.o msg/common.o msg/die.o sys/iopoll.o ./load crc-gentab fmt/lcase.o fmt/ucase.o fmt/unum.o iobuf/iobuf_timeout.o iobuf/obuf_flush.o iobuf/obuf_pad.o iobuf/obuf_put3s.o iobuf/obuf_put5s.o iobuf/obuf_putc.o iobuf/obuf_putunumw.o iobuf/obuf_stderr.o iobuf/obuf_stdout.o iobuf/obuf_write.o msg/common.o msg/die.o sys/iopoll.o -static crc-gentab.o: compile crc-gentab.c sysdeps.h include/bglibs/iobuf.h include/bglibs/iobuf_common.h include/bglibs/ibuf.h include/iobuf_common.h include/bglibs/obuf.h sysdeps.h include/bglibs/msg.h sysdeps.h include/bglibs/debug.h ./compile crc-gentab.c crc/crc16_arc_table.c: crc-gentab ./crc-gentab crc16_arc 16 0x8005 reflected >$@ crc/crc16_arc_table.lo crc/crc16_arc_table.o: ltcompile crc/crc16_arc_table.c ./ltcompile crc/crc16_arc_table.c crc/crc16_ccitt_table.c: crc-gentab ./crc-gentab crc16_ccitt 16 0x1021 normal >$@ crc/crc16_ccitt_table.lo crc/crc16_ccitt_table.o: ltcompile crc/crc16_ccitt_table.c ./ltcompile crc/crc16_ccitt_table.c crc/crc16_xmodem_table.c: crc-gentab ./crc-gentab crc16_xmodem 16 0x8408 reflected >$@ crc/crc16_xmodem_table.lo crc/crc16_xmodem_table.o: ltcompile crc/crc16_xmodem_table.c ./ltcompile crc/crc16_xmodem_table.c crc/crc32_table.c: crc-gentab ./crc-gentab crc32 32 0x04C11DB7 reflected >$@ crc/crc32_table.lo crc/crc32_table.o: ltcompile crc/crc32_table.c ./ltcompile crc/crc32_table.c crc/crc32c_table.c: crc-gentab ./crc-gentab crc32c 32 0x1EDC6F41 reflected >$@ crc/crc32c_table.lo crc/crc32c_table.o: ltcompile crc/crc32c_table.c ./ltcompile crc/crc32c_table.c crc/crc64_table.c: crc-gentab ./crc-gentab crc64 64 0x42F0E1EBA9EA3693 normal >$@ crc/crc64_table.lo crc/crc64_table.o: ltcompile crc/crc64_table.c ./ltcompile crc/crc64_table.c crc/gcrc16fwd.lo crc/gcrc16fwd.o: ltcompile crc/gcrc16fwd.c include/bglibs/gcrc.h sysdeps.h include/bglibs/crc16_ccitt.h include/gcrc.h sysdeps.h ./ltcompile crc/gcrc16fwd.c crc/gcrc16rfl.lo crc/gcrc16rfl.o: ltcompile crc/gcrc16rfl.c include/bglibs/gcrc.h sysdeps.h include/bglibs/crc16_arc.h include/gcrc.h sysdeps.h include/bglibs/crc16_xmodem.h uint16.h sysdeps.h uintnn.h ./ltcompile crc/gcrc16rfl.c crc/gcrc32fwd.lo crc/gcrc32fwd.o: ltcompile crc/gcrc32fwd.c include/bglibs/gcrc.h sysdeps.h ./ltcompile crc/gcrc32fwd.c crc/gcrc32rfl.lo crc/gcrc32rfl.o: ltcompile crc/gcrc32rfl.c include/bglibs/gcrc.h sysdeps.h include/bglibs/crc32.h include/gcrc.h sysdeps.h uint32.h sysdeps.h uintnn.h include/bglibs/crc32c.h ./ltcompile crc/gcrc32rfl.c crc/gcrc64fwd.lo crc/gcrc64fwd.o: ltcompile crc/gcrc64fwd.c include/bglibs/gcrc.h sysdeps.h include/bglibs/crc64.h include/gcrc.h sysdeps.h ./ltcompile crc/gcrc64fwd.c crc/gcrc64rfl.lo crc/gcrc64rfl.o: ltcompile crc/gcrc64rfl.c include/bglibs/gcrc.h sysdeps.h ./ltcompile crc/gcrc64rfl.c crypto/hmac-md5.lo crypto/hmac-md5.o: ltcompile crypto/hmac-md5.c sysdeps.h include/bglibs/hmac.h include/bglibs/md5.h include/bglibs/str.h sysdeps.h ./ltcompile crypto/hmac-md5.c crypto/hmac-sha1.lo crypto/hmac-sha1.o: ltcompile crypto/hmac-sha1.c sysdeps.h include/bglibs/hmac.h include/bglibs/sha1.h sysdeps.h include/bglibs/str.h sysdeps.h ./ltcompile crypto/hmac-sha1.c crypto/hmac-sha256.lo crypto/hmac-sha256.o: ltcompile crypto/hmac-sha256.c include/bglibs/hmac.h include/bglibs/sha256.h sysdeps.h include/bglibs/obuf.h sysdeps.h include/bglibs/iobuf_common.h include/bglibs/str.h sysdeps.h ./ltcompile crypto/hmac-sha256.c crypto/hmac-sha384.lo crypto/hmac-sha384.o: ltcompile crypto/hmac-sha384.c sysdeps.h include/bglibs/hmac.h include/bglibs/sha384.h sysdeps.h include/bglibs/sha512.h sysdeps.h include/bglibs/obuf.h sysdeps.h include/bglibs/iobuf_common.h include/bglibs/str.h sysdeps.h ./ltcompile crypto/hmac-sha384.c crypto/hmac-sha512.lo crypto/hmac-sha512.o: ltcompile crypto/hmac-sha512.c sysdeps.h include/bglibs/hmac.h include/bglibs/sha512.h sysdeps.h include/bglibs/obuf.h sysdeps.h include/bglibs/iobuf_common.h include/bglibs/str.h sysdeps.h ./ltcompile crypto/hmac-sha512.c crypto/hmac.lo crypto/hmac.o: ltcompile crypto/hmac.c sysdeps.h include/bglibs/str.h sysdeps.h include/bglibs/hmac.h ./ltcompile crypto/hmac.c crypto/md4.lo crypto/md4.o: ltcompile crypto/md4.c sysdeps.h include/bglibs/md4.h uint32.h sysdeps.h uintnn.h ./ltcompile crypto/md4.c crypto/md5-crypt.lo crypto/md5-crypt.o: ltcompile crypto/md5-crypt.c include/bglibs/md5.h ./ltcompile crypto/md5-crypt.c crypto/md5.lo crypto/md5.o: ltcompile crypto/md5.c sysdeps.h include/bglibs/md5.h uint32.h sysdeps.h uintnn.h include/bglibs/str.h sysdeps.h ./ltcompile crypto/md5.c crypto/sha1.lo crypto/sha1.o: ltcompile crypto/sha1.c include/bglibs/sha1.h sysdeps.h uint32.h sysdeps.h uintnn.h uint64.h sysdeps.h include/bglibs/str.h sysdeps.h ./ltcompile crypto/sha1.c crypto/sha256.lo crypto/sha256.o: ltcompile crypto/sha256.c include/bglibs/sha256.h sysdeps.h uint32.h sysdeps.h uintnn.h uint64.h sysdeps.h include/bglibs/obuf.h sysdeps.h include/bglibs/iobuf_common.h ./ltcompile crypto/sha256.c crypto/sha384.lo crypto/sha384.o: ltcompile crypto/sha384.c sysdeps.h include/bglibs/sha384.h sysdeps.h include/bglibs/sha512.h sysdeps.h uint64.h sysdeps.h uintnn.h include/bglibs/obuf.h sysdeps.h include/bglibs/iobuf_common.h ./ltcompile crypto/sha384.c crypto/sha512.lo crypto/sha512.o: ltcompile crypto/sha512.c sysdeps.h include/bglibs/sha512.h sysdeps.h uint64.h sysdeps.h uintnn.h include/bglibs/obuf.h sysdeps.h include/bglibs/iobuf_common.h ./ltcompile crypto/sha512.c crypto/surf.lo crypto/surf.o: ltcompile crypto/surf.c include/bglibs/surf.h uint32.h sysdeps.h uintnn.h ./ltcompile crypto/surf.c crypto/surfrand.lo crypto/surfrand.o: ltcompile crypto/surfrand.c include/bglibs/surfrand.h include/bglibs/surf.h uint32.h sysdeps.h uintnn.h ./ltcompile crypto/surfrand.c dict/add.lo dict/add.o: ltcompile dict/add.c include/bglibs/dict.h include/bglibs/str.h sysdeps.h uint32.h sysdeps.h uintnn.h ./ltcompile dict/add.c dict/dicthash.lo dict/dicthash.o: ltcompile dict/dicthash.c include/bglibs/dict.h include/bglibs/str.h sysdeps.h uint32.h sysdeps.h uintnn.h ./ltcompile dict/dicthash.c dict/foreach.lo dict/foreach.o: ltcompile dict/foreach.c include/bglibs/dict.h include/bglibs/str.h sysdeps.h uint32.h sysdeps.h uintnn.h ./ltcompile dict/foreach.c dict/free.lo dict/free.o: ltcompile dict/free.c include/bglibs/dict.h include/bglibs/str.h sysdeps.h uint32.h sysdeps.h uintnn.h ./ltcompile dict/free.c dict/get.lo dict/get.o: ltcompile dict/get.c include/bglibs/dict.h include/bglibs/str.h sysdeps.h uint32.h sysdeps.h uintnn.h ./ltcompile dict/get.c dict/init.lo dict/init.o: ltcompile dict/init.c include/bglibs/dict.h include/bglibs/str.h sysdeps.h uint32.h sysdeps.h uintnn.h ./ltcompile dict/init.c dict/load_list.lo dict/load_list.o: ltcompile dict/load_list.c include/bglibs/iobuf.h include/bglibs/iobuf_common.h include/bglibs/ibuf.h include/iobuf_common.h include/bglibs/obuf.h sysdeps.h include/bglibs/str.h sysdeps.h include/bglibs/dict.h include/str.h sysdeps.h uint32.h sysdeps.h uintnn.h ./ltcompile dict/load_list.c dict/load_map.lo dict/load_map.o: ltcompile dict/load_map.c include/bglibs/iobuf.h include/bglibs/iobuf_common.h include/bglibs/ibuf.h include/iobuf_common.h include/bglibs/obuf.h sysdeps.h include/bglibs/str.h sysdeps.h include/bglibs/dict.h include/str.h sysdeps.h uint32.h sysdeps.h uintnn.h ./ltcompile dict/load_map.c dict/str_free.lo dict/str_free.o: ltcompile dict/str_free.c include/bglibs/str.h sysdeps.h include/bglibs/dict.h include/str.h sysdeps.h uint32.h sysdeps.h uintnn.h ./ltcompile dict/str_free.c dl.lib: compile load @echo -n 'Checking for -ldl: ' @echo 'main() { ; }' >trylib-ldl.c @{ ./compile trylib-ldl.c && ./load trylib-ldl -ldl; } >/dev/null 2>&1 \ && { echo -ldl >dl.lib; echo yes; } \ || { echo >dl.lib; echo no; } @rm -f trylib-ldl.c trylib-ldl.o trylib-ldl fmt/char.lo fmt/char.o: ltcompile fmt/char.c include/bglibs/fmt.h ./ltcompile fmt/char.c fmt/chars.lo fmt/chars.o: ltcompile fmt/chars.c include/bglibs/str.h sysdeps.h include/bglibs/fmt.h ./ltcompile fmt/chars.c fmt/lcase.lo fmt/lcase.o: ltcompile fmt/lcase.c include/bglibs/fmt.h ./ltcompile fmt/lcase.c fmt/multi.lo fmt/multi.o: ltcompile fmt/multi.c include/bglibs/fmt.h include/fmt.h include/bglibs/str.h sysdeps.h ./ltcompile fmt/multi.c fmt/pad.lo fmt/pad.o: ltcompile fmt/pad.c include/bglibs/fmt.h ./ltcompile fmt/pad.c fmt/sdec.lo fmt/sdec.o: ltcompile fmt/sdec.c include/bglibs/fmt.h ./ltcompile fmt/sdec.c fmt/sign_pad.lo fmt/sign_pad.o: ltcompile fmt/sign_pad.c include/bglibs/fmt.h ./ltcompile fmt/sign_pad.c fmt/slldec.lo fmt/slldec.o: ltcompile fmt/slldec.c include/bglibs/fmt.h ./ltcompile fmt/slldec.c fmt/sllnum.lo fmt/sllnum.o: ltcompile fmt/sllnum.c include/bglibs/fmt.h ./ltcompile fmt/sllnum.c fmt/snum.lo fmt/snum.o: ltcompile fmt/snum.c include/bglibs/fmt.h ./ltcompile fmt/snum.c fmt/ucase.lo fmt/ucase.o: ltcompile fmt/ucase.c include/bglibs/fmt.h ./ltcompile fmt/ucase.c fmt/udec.lo fmt/udec.o: ltcompile fmt/udec.c include/bglibs/fmt.h ./ltcompile fmt/udec.c fmt/uhexl.lo fmt/uhexl.o: ltcompile fmt/uhexl.c include/bglibs/fmt.h ./ltcompile fmt/uhexl.c fmt/uhexu.lo fmt/uhexu.o: ltcompile fmt/uhexu.c include/bglibs/fmt.h ./ltcompile fmt/uhexu.c fmt/ulldec.lo fmt/ulldec.o: ltcompile fmt/ulldec.c include/bglibs/fmt.h ./ltcompile fmt/ulldec.c fmt/ullhexl.lo fmt/ullhexl.o: ltcompile fmt/ullhexl.c include/bglibs/fmt.h ./ltcompile fmt/ullhexl.c fmt/ullhexu.lo fmt/ullhexu.o: ltcompile fmt/ullhexu.c include/bglibs/fmt.h ./ltcompile fmt/ullhexu.c fmt/ullnum.lo fmt/ullnum.o: ltcompile fmt/ullnum.c include/bglibs/fmt.h ./ltcompile fmt/ullnum.c fmt/unum.lo fmt/unum.o: ltcompile fmt/unum.c include/bglibs/fmt.h ./ltcompile fmt/unum.c install: bg-installer INSTHIER conf-bin conf-include conf-lib conf-man ./bg-installer -v load chmod 755 load ltcompile: conf-cc ( if libtool --tag=CC --help >/dev/null 2>&1; then tag='--tag=CC'; fi; \ echo '#!/bin/sh'; \ echo 'source=$$1; shift'; \ echo 'base=`echo "$$source" | sed -e s:\\\\.c$$::`'; \ echo exec libtool --mode=compile --silent $$tag `head -n 1 conf-cc` -I. "-I'include/bglibs'" "-I'include'" '-o $${base}.lo -c $$source $${1+"$$@"}'; \ ) >ltcompile chmod 755 ltcompile ltload: conf-ld ( if libtool --tag=CC --help >/dev/null 2>&1; then tag='--tag=CC'; fi; \ echo '#!/bin/sh';\ echo 'main="$$1"; shift';\ echo exec libtool --mode=link --silent $$tag `head -n 1 conf-ld` -L. '-o "$$main" "$$main.o" $${1+"$$@"}' ; \ ) >ltload chmod 755 ltload makeshlib: conf-ld conf-lib LIBVERSION Makefile ( if libtool --tag=CC --help >/dev/null 2>&1; then tag='--tag=CC'; fi; \ echo '#!/bin/sh'; \ echo 'lib="$$1"; shift';\ echo 'rm -f "$$lib"';\ echo libtool --mode=link --silent $$tag `head -n 1 conf-ld` '-o "$$lib" -rpath' `head -n 1 conf-lib` -version-info `head -n 1 LIBVERSION` '$${1+"$$@"}';\ ) >makeshlib chmod 755 makeshlib man: bg-installer.1 misc/random.lo misc/random.o: ltcompile misc/random.c sysdeps.h systime.h include/bglibs/fmt.h ./ltcompile misc/random.c misc/strtou.lo misc/strtou.o: ltcompile misc/strtou.c include/bglibs/fmt.h ./ltcompile misc/strtou.c misc/ucspi.lo misc/ucspi.o: ltcompile misc/ucspi.c include/bglibs/ucspi.h ./ltcompile misc/ucspi.c misc/utoa.lo misc/utoa.o: ltcompile misc/utoa.c include/bglibs/fmt.h ./ltcompile misc/utoa.c misc/utoa2.lo misc/utoa2.o: ltcompile misc/utoa2.c include/bglibs/fmt.h ./ltcompile misc/utoa2.c msg/common.lo msg/common.o: ltcompile msg/common.c include/bglibs/iobuf.h include/bglibs/iobuf_common.h include/bglibs/ibuf.h include/iobuf_common.h include/bglibs/obuf.h sysdeps.h include/bglibs/msg.h sysdeps.h include/bglibs/debug.h ./ltcompile msg/common.c msg/commonf.lo msg/commonf.o: ltcompile msg/commonf.c include/bglibs/obuf.h sysdeps.h include/bglibs/iobuf_common.h include/bglibs/msg.h sysdeps.h include/bglibs/debug.h ./ltcompile msg/commonf.c msg/debug.lo msg/debug.o: ltcompile msg/debug.c include/bglibs/msg.h sysdeps.h include/bglibs/debug.h ./ltcompile msg/debug.c msg/debug_bits.lo msg/debug_bits.o: ltcompile msg/debug_bits.c include/bglibs/msg.h sysdeps.h include/bglibs/debug.h ./ltcompile msg/debug_bits.c msg/debug_init.lo msg/debug_init.o: ltcompile msg/debug_init.c include/bglibs/msg.h sysdeps.h include/bglibs/debug.h ./ltcompile msg/debug_init.c msg/debugf.lo msg/debugf.o: ltcompile msg/debugf.c include/bglibs/msg.h sysdeps.h include/bglibs/debug.h ./ltcompile msg/debugf.c msg/die.lo msg/die.o: ltcompile msg/die.c include/bglibs/msg.h sysdeps.h include/bglibs/debug.h ./ltcompile msg/die.c msg/dief.lo msg/dief.o: ltcompile msg/dief.c include/bglibs/msg.h sysdeps.h include/bglibs/debug.h ./ltcompile msg/dief.c msg/error.lo msg/error.o: ltcompile msg/error.c include/bglibs/msg.h sysdeps.h include/bglibs/debug.h ./ltcompile msg/error.c msg/errorf.lo msg/errorf.o: ltcompile msg/errorf.c include/bglibs/msg.h sysdeps.h include/bglibs/debug.h ./ltcompile msg/errorf.c msg/oom.lo msg/oom.o: ltcompile msg/oom.c include/bglibs/msg.h sysdeps.h include/bglibs/debug.h ./ltcompile msg/oom.c msg/show_pid.lo msg/show_pid.o: ltcompile msg/show_pid.c include/bglibs/msg.h sysdeps.h include/bglibs/debug.h ./ltcompile msg/show_pid.c msg/warn.lo msg/warn.o: ltcompile msg/warn.c include/bglibs/msg.h sysdeps.h include/bglibs/debug.h ./ltcompile msg/warn.c msg/warnf.lo msg/warnf.o: ltcompile msg/warnf.c include/bglibs/msg.h sysdeps.h include/bglibs/debug.h ./ltcompile msg/warnf.c msg/wrap_alloc.lo msg/wrap_alloc.o: ltcompile msg/wrap_alloc.c include/bglibs/msg.h sysdeps.h include/bglibs/debug.h include/bglibs/wrap.h ./ltcompile msg/wrap_alloc.c msg/wrap_chdir.lo msg/wrap_chdir.o: ltcompile msg/wrap_chdir.c include/bglibs/msg.h sysdeps.h include/bglibs/debug.h include/bglibs/wrap.h ./ltcompile msg/wrap_chdir.c msg/wrap_exit.lo msg/wrap_exit.o: ltcompile msg/wrap_exit.c include/bglibs/msg.h sysdeps.h include/bglibs/debug.h include/bglibs/wrap.h ./ltcompile msg/wrap_exit.c msg/wrap_str.lo msg/wrap_str.o: ltcompile msg/wrap_str.c include/bglibs/msg.h sysdeps.h include/bglibs/debug.h include/bglibs/wrap.h ./ltcompile msg/wrap_str.c net/accept4.lo net/accept4.o: ltcompile net/accept4.c include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/accept4.c net/accept6.lo net/accept6.o: ltcompile net/accept6.c sysdeps.h include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/accept6.c net/acceptu.lo net/acceptu.o: ltcompile net/acceptu.c include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/acceptu.c net/bind4.lo net/bind4.o: ltcompile net/bind4.c include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/bind4.c net/bind6.lo net/bind6.o: ltcompile net/bind6.c sysdeps.h include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/bind6.c net/bindu.lo net/bindu.o: ltcompile net/bindu.c include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/bindu.c net/broadcast.lo net/broadcast.o: ltcompile net/broadcast.c include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/broadcast.c net/connect4.lo net/connect4.o: ltcompile net/connect4.c include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/connect4.c net/connect4_timeout.lo net/connect4_timeout.o: ltcompile net/connect4_timeout.c sysdeps.h include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/unix.h ./ltcompile net/connect4_timeout.c net/connect6.lo net/connect6.o: ltcompile net/connect6.c sysdeps.h include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/connect6.c net/connect6_timeout.lo net/connect6_timeout.o: ltcompile net/connect6_timeout.c sysdeps.h include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/unix.h ./ltcompile net/connect6_timeout.c net/connected.lo net/connected.o: ltcompile net/connected.c include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/connected.c net/connectu.lo net/connectu.o: ltcompile net/connectu.c include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/connectu.c net/connectu_timeout.lo net/connectu_timeout.o: ltcompile net/connectu_timeout.c sysdeps.h include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/unix.h ./ltcompile net/connectu_timeout.c net/cork.lo net/cork.o: ltcompile net/cork.c include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/cork.c net/dns_domain.lo net/dns_domain.o: ltcompile net/dns_domain.c include/bglibs/dns.h sysdeps.h systime.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/str.h sysdeps.h uint16.h sysdeps.h uintnn.h ./ltcompile net/dns_domain.c net/dns_domain_fromdot.lo net/dns_domain_fromdot.o: ltcompile net/dns_domain_fromdot.c include/bglibs/dns.h sysdeps.h systime.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/str.h sysdeps.h uint16.h sysdeps.h uintnn.h include/bglibs/iobuf.h include/bglibs/iobuf_common.h include/bglibs/ibuf.h include/iobuf_common.h include/bglibs/obuf.h sysdeps.h ./ltcompile net/dns_domain_fromdot.c net/dns_domain_todot.lo net/dns_domain_todot.o: ltcompile net/dns_domain_todot.c include/bglibs/dns.h sysdeps.h systime.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/str.h sysdeps.h uint16.h sysdeps.h uintnn.h include/bglibs/iobuf.h include/bglibs/iobuf_common.h include/bglibs/ibuf.h include/iobuf_common.h include/bglibs/obuf.h sysdeps.h ./ltcompile net/dns_domain_todot.c net/dns_fmt.lo net/dns_fmt.o: ltcompile net/dns_fmt.c include/bglibs/dns.h sysdeps.h systime.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/str.h sysdeps.h uint16.h sysdeps.h uintnn.h ./ltcompile net/dns_fmt.c net/dns_ip4.lo net/dns_ip4.o: ltcompile net/dns_ip4.c include/bglibs/dns.h sysdeps.h systime.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/str.h sysdeps.h uint16.h sysdeps.h uintnn.h dns-responder.c include/bglibs/fmt.h include/bglibs/iobuf.h include/bglibs/iobuf_common.h include/bglibs/ibuf.h include/iobuf_common.h include/bglibs/obuf.h sysdeps.h include/ipv4.h sysdeps.h include/bglibs/msg.h sysdeps.h include/bglibs/debug.h include/bglibs/socket.h include/ipv6.h sysdeps.h uint32.h sysdeps.h ./ltcompile net/dns_ip4.c net/dns_ip6.lo net/dns_ip6.o: ltcompile net/dns_ip6.c include/bglibs/dns.h sysdeps.h systime.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/str.h sysdeps.h uint16.h sysdeps.h uintnn.h dns-responder.c include/bglibs/fmt.h include/bglibs/iobuf.h include/bglibs/iobuf_common.h include/bglibs/ibuf.h include/iobuf_common.h include/bglibs/obuf.h sysdeps.h include/ipv4.h sysdeps.h include/bglibs/msg.h sysdeps.h include/bglibs/debug.h include/bglibs/socket.h include/ipv6.h sysdeps.h uint32.h sysdeps.h ./ltcompile net/dns_ip6.c net/dns_mx.lo net/dns_mx.o: ltcompile net/dns_mx.c include/bglibs/dns.h sysdeps.h systime.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/str.h sysdeps.h uint16.h sysdeps.h uintnn.h dns-responder.c include/bglibs/fmt.h include/bglibs/iobuf.h include/bglibs/iobuf_common.h include/bglibs/ibuf.h include/iobuf_common.h include/bglibs/obuf.h sysdeps.h include/ipv4.h sysdeps.h include/bglibs/msg.h sysdeps.h include/bglibs/debug.h include/bglibs/socket.h include/ipv6.h sysdeps.h uint32.h sysdeps.h ./ltcompile net/dns_mx.c net/dns_name4.lo net/dns_name4.o: ltcompile net/dns_name4.c include/bglibs/dns.h sysdeps.h systime.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/str.h sysdeps.h uint16.h sysdeps.h uintnn.h dns-responder.c include/bglibs/fmt.h include/bglibs/iobuf.h include/bglibs/iobuf_common.h include/bglibs/ibuf.h include/iobuf_common.h include/bglibs/obuf.h sysdeps.h include/ipv4.h sysdeps.h include/bglibs/msg.h sysdeps.h include/bglibs/debug.h include/bglibs/socket.h include/ipv6.h sysdeps.h uint32.h sysdeps.h ./ltcompile net/dns_name4.c net/dns_name4_domain.lo net/dns_name4_domain.o: ltcompile net/dns_name4_domain.c include/bglibs/fmt.h include/bglibs/dns.h sysdeps.h systime.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/str.h sysdeps.h uint16.h sysdeps.h uintnn.h ./ltcompile net/dns_name4_domain.c net/dns_name6.lo net/dns_name6.o: ltcompile net/dns_name6.c include/bglibs/dns.h sysdeps.h systime.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/str.h sysdeps.h uint16.h sysdeps.h uintnn.h dns-responder.c include/bglibs/fmt.h include/bglibs/iobuf.h include/bglibs/iobuf_common.h include/bglibs/ibuf.h include/iobuf_common.h include/bglibs/obuf.h sysdeps.h include/ipv4.h sysdeps.h include/bglibs/msg.h sysdeps.h include/bglibs/debug.h include/bglibs/socket.h include/ipv6.h sysdeps.h uint32.h sysdeps.h ./ltcompile net/dns_name6.c net/dns_name6_domain.lo net/dns_name6_domain.o: ltcompile net/dns_name6_domain.c include/bglibs/fmt.h include/bglibs/dns.h sysdeps.h systime.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/str.h sysdeps.h uint16.h sysdeps.h uintnn.h ./ltcompile net/dns_name6_domain.c net/dns_name_packet.lo net/dns_name_packet.o: ltcompile net/dns_name_packet.c include/bglibs/dns.h sysdeps.h systime.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/str.h sysdeps.h uint16.h sysdeps.h uintnn.h ./ltcompile net/dns_name_packet.c net/dns_packet.lo net/dns_packet.o: ltcompile net/dns_packet.c include/bglibs/dns.h sysdeps.h systime.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/str.h sysdeps.h uint16.h sysdeps.h uintnn.h ./ltcompile net/dns_packet.c net/dns_qualify.lo net/dns_qualify.o: ltcompile net/dns_qualify.c include/bglibs/dns.h sysdeps.h systime.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/str.h sysdeps.h uint16.h sysdeps.h uintnn.h ./ltcompile net/dns_qualify.c net/dns_random.lo net/dns_random.o: ltcompile net/dns_random.c include/bglibs/dns.h sysdeps.h systime.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/str.h sysdeps.h uint16.h sysdeps.h uintnn.h uint32.h sysdeps.h include/bglibs/surfrand.h include/bglibs/surf.h ./ltcompile net/dns_random.c net/dns_resolvconfip.lo net/dns_resolvconfip.o: ltcompile net/dns_resolvconfip.c include/bglibs/ibuf.h include/bglibs/iobuf_common.h include/bglibs/misc.h sysdeps.h include/bglibs/striter.h include/bglibs/dns.h sysdeps.h systime.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/str.h sysdeps.h uint16.h sysdeps.h uintnn.h ./ltcompile net/dns_resolvconfip.c net/dns_resolvconfrewrite.lo net/dns_resolvconfrewrite.o: ltcompile net/dns_resolvconfrewrite.c include/bglibs/ibuf.h include/bglibs/iobuf_common.h include/bglibs/striter.h include/bglibs/dns.h sysdeps.h systime.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/str.h sysdeps.h uint16.h sysdeps.h uintnn.h ./ltcompile net/dns_resolvconfrewrite.c net/dns_resolve.lo net/dns_resolve.o: ltcompile net/dns_resolve.c include/bglibs/dns.h sysdeps.h systime.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/str.h sysdeps.h uint16.h sysdeps.h uintnn.h ./ltcompile net/dns_resolve.c net/dns_result.lo net/dns_result.o: ltcompile net/dns_result.c include/bglibs/dns.h sysdeps.h systime.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/str.h sysdeps.h uint16.h sysdeps.h uintnn.h ./ltcompile net/dns_result.c net/dns_rotate.lo net/dns_rotate.o: ltcompile net/dns_rotate.c include/bglibs/dns.h sysdeps.h systime.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/str.h sysdeps.h uint16.h sysdeps.h uintnn.h ./ltcompile net/dns_rotate.c net/dns_sort.lo net/dns_sort.o: ltcompile net/dns_sort.c include/bglibs/dns.h sysdeps.h systime.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/str.h sysdeps.h uint16.h sysdeps.h uintnn.h ./ltcompile net/dns_sort.c net/dns_transmit.lo net/dns_transmit.o: ltcompile net/dns_transmit.c sysdeps.h include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/dns.h sysdeps.h systime.h include/ipv4.h sysdeps.h include/ipv6.h sysdeps.h include/bglibs/str.h sysdeps.h uint16.h sysdeps.h uintnn.h ./ltcompile net/dns_transmit.c net/dns_txt.lo net/dns_txt.o: ltcompile net/dns_txt.c include/bglibs/dns.h sysdeps.h systime.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/str.h sysdeps.h uint16.h sysdeps.h uintnn.h dns-responder.c include/bglibs/fmt.h include/bglibs/iobuf.h include/bglibs/iobuf_common.h include/bglibs/ibuf.h include/iobuf_common.h include/bglibs/obuf.h sysdeps.h include/ipv4.h sysdeps.h include/bglibs/msg.h sysdeps.h include/bglibs/debug.h include/bglibs/socket.h include/ipv6.h sysdeps.h uint32.h sysdeps.h ./ltcompile net/dns_txt.c net/getaddr4.lo net/getaddr4.o: ltcompile net/getaddr4.c include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/getaddr4.c net/getaddr6.lo net/getaddr6.o: ltcompile net/getaddr6.c sysdeps.h include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/getaddr6.c net/ipv4_addr.lo net/ipv4_addr.o: ltcompile net/ipv4_addr.c include/bglibs/ipv4.h sysdeps.h ./ltcompile net/ipv4_addr.c net/ipv4_format.lo net/ipv4_format.o: ltcompile net/ipv4_format.c include/bglibs/ipv4.h sysdeps.h ./ltcompile net/ipv4_format.c net/ipv4_scan.lo net/ipv4_scan.o: ltcompile net/ipv4_scan.c include/bglibs/ipv4.h sysdeps.h ./ltcompile net/ipv4_scan.c net/ipv6_addr.lo net/ipv6_addr.o: ltcompile net/ipv6_addr.c include/bglibs/ipv6.h sysdeps.h ./ltcompile net/ipv6_addr.c net/ipv6_format.lo net/ipv6_format.o: ltcompile net/ipv6_format.c include/bglibs/ipv6.h sysdeps.h include/bglibs/ipv4.h sysdeps.h ./ltcompile net/ipv6_format.c net/ipv6_scan.lo net/ipv6_scan.o: ltcompile net/ipv6_scan.c include/bglibs/ipv6.h sysdeps.h include/bglibs/ipv4.h sysdeps.h ./ltcompile net/ipv6_scan.c net/linger.lo net/linger.o: ltcompile net/linger.c include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/linger.c net/listen.lo net/listen.o: ltcompile net/listen.c include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/listen.c net/notcpdelay.lo net/notcpdelay.o: ltcompile net/notcpdelay.c include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/notcpdelay.c net/pairdgm.lo net/pairdgm.o: ltcompile net/pairdgm.c include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/pairdgm.c net/pairstr.lo net/pairstr.o: ltcompile net/pairstr.c include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/pairstr.c net/recv4.lo net/recv4.o: ltcompile net/recv4.c include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/recv4.c net/recv6.lo net/recv6.o: ltcompile net/recv6.c sysdeps.h include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/recv6.c net/recvfd.lo net/recvfd.o: ltcompile net/recvfd.c net/cmsg.h include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/recvfd.c net/recvu.lo net/recvu.o: ltcompile net/recvu.c include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/recvu.c net/resolve_calldns.lo net/resolve_calldns.o: ltcompile net/resolve_calldns.c include/bglibs/dns.h sysdeps.h systime.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/str.h sysdeps.h uint16.h sysdeps.h uintnn.h include/bglibs/resolve.h include/ipv4.h sysdeps.h ./ltcompile net/resolve_calldns.c net/resolve_ipv4addr.lo net/resolve_ipv4addr.o: ltcompile net/resolve_ipv4addr.c include/bglibs/dns.h sysdeps.h systime.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/str.h sysdeps.h uint16.h sysdeps.h uintnn.h include/bglibs/resolve.h include/ipv4.h sysdeps.h ./ltcompile net/resolve_ipv4addr.c net/resolve_ipv4name.lo net/resolve_ipv4name.o: ltcompile net/resolve_ipv4name.c include/bglibs/dns.h sysdeps.h systime.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h include/bglibs/str.h sysdeps.h uint16.h sysdeps.h uintnn.h include/bglibs/resolve.h include/ipv4.h sysdeps.h dns-responder.c include/bglibs/fmt.h include/bglibs/iobuf.h include/bglibs/iobuf_common.h include/bglibs/ibuf.h include/iobuf_common.h include/bglibs/obuf.h sysdeps.h include/bglibs/msg.h sysdeps.h include/bglibs/debug.h include/bglibs/socket.h include/ipv6.h sysdeps.h uint32.h sysdeps.h ./ltcompile net/resolve_ipv4name.c net/reuse.lo net/reuse.o: ltcompile net/reuse.c include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/reuse.c net/send4.lo net/send4.o: ltcompile net/send4.c include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/send4.c net/send6.lo net/send6.o: ltcompile net/send6.c sysdeps.h include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/send6.c net/sendfd.lo net/sendfd.o: ltcompile net/sendfd.c net/cmsg.h include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/sendfd.c net/sendu.lo net/sendu.o: ltcompile net/sendu.c include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/sendu.c net/shutdown.lo net/shutdown.o: ltcompile net/shutdown.c include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/shutdown.c net/tcp4.lo net/tcp4.o: ltcompile net/tcp4.c include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/tcp4.c net/tcp6.lo net/tcp6.o: ltcompile net/tcp6.c sysdeps.h include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/tcp6.c net/udp4.lo net/udp4.o: ltcompile net/udp4.c include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/udp4.c net/udp6.lo net/udp6.o: ltcompile net/udp6.c sysdeps.h include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/udp6.c net/uncork.lo net/uncork.o: ltcompile net/uncork.c include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/uncork.c net/unixdgm.lo net/unixdgm.o: ltcompile net/unixdgm.c include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/unixdgm.c net/unixstr.lo net/unixstr.o: ltcompile net/unixstr.c include/bglibs/socket.h include/bglibs/ipv4.h sysdeps.h include/bglibs/ipv6.h sysdeps.h ./ltcompile net/unixstr.c path/contains.lo path/contains.o: ltcompile path/contains.c include/bglibs/path.h include/bglibs/str.h sysdeps.h ./ltcompile path/contains.c path/fnmatch.lo path/fnmatch.o: ltcompile path/fnmatch.c include/bglibs/path.h include/bglibs/str.h sysdeps.h ./ltcompile path/fnmatch.c path/match.lo path/match.o: ltcompile path/match.c sysdeps.h include/bglibs/str.h sysdeps.h include/bglibs/striter.h include/bglibs/path.h include/str.h sysdeps.h include/bglibs/msg.h sysdeps.h include/bglibs/debug.h ./ltcompile path/match.c path/merge.lo path/merge.o: ltcompile path/merge.c include/bglibs/path.h include/bglibs/str.h sysdeps.h include/path.h include/str.h sysdeps.h ./ltcompile path/merge.c path/mkdirs.lo path/mkdirs.o: ltcompile path/mkdirs.c sysdeps.h include/bglibs/path.h include/bglibs/str.h sysdeps.h ./ltcompile path/mkdirs.c path/mktemp.lo path/mktemp.o: ltcompile path/mktemp.c systime.h include/bglibs/path.h include/bglibs/str.h sysdeps.h ./ltcompile path/mktemp.c perl-head.pl: ( set -e; PATH="/bin:/usr/bin:/usr/local/bin:$$PATH"; export PATH; \ perl=`which perl`; \ echo "#! $$perl"; \ echo "# WARNING: This file was auto-generated. Do not edit!"; \ echo ) >perl-head.pl programs: bg-installer cli-generate pwcmp/client.lo pwcmp/client.o: ltcompile pwcmp/client.c sysdeps.h pwcmp/client.h ./ltcompile pwcmp/client.c pwcmp/hex_encode.lo pwcmp/hex_encode.o: ltcompile pwcmp/hex_encode.c pwcmp/hex.h ./ltcompile pwcmp/hex_encode.c pwcmp/module.lo pwcmp/module.o: ltcompile pwcmp/module.c pwcmp/module.h ./ltcompile pwcmp/module.c rt.lib: compile load @echo -n 'Checking for -lrt: ' @echo 'main() { ; }' >trylib-lrt.c @{ ./compile trylib-lrt.c && ./load trylib-lrt -lrt; } >/dev/null 2>&1 \ && { echo -lrt >rt.lib; echo yes; } \ || { echo >rt.lib; echo no; } @rm -f trylib-lrt.c trylib-lrt.o trylib-lrt selftest-cmp: selftest-cmp.o ltload libbg.la ./ltload selftest-cmp libbg.la selftest-cmp.o: compile selftest-cmp.c include/bglibs/iobuf.h include/bglibs/iobuf_common.h include/bglibs/ibuf.h include/iobuf_common.h include/bglibs/obuf.h sysdeps.h include/bglibs/msg.h sysdeps.h include/bglibs/debug.h include/bglibs/wrap.h include/bglibs/path.h include/bglibs/str.h sysdeps.h include/str.h sysdeps.h ./compile selftest-cmp.c selftests: selftests.sh sysdeps.h libbg.la selftest-cmp selftest.c sh selftests.sh str/alloc.lo str/alloc.o: ltcompile str/alloc.c include/bglibs/str.h sysdeps.h ./ltcompile str/alloc.c str/buildmap.lo str/buildmap.o: ltcompile str/buildmap.c include/bglibs/str.h sysdeps.h ./ltcompile str/buildmap.c str/case_end.lo str/case_end.o: ltcompile str/case_end.c include/bglibs/str.h sysdeps.h ./ltcompile str/case_end.c str/case_glob.lo str/case_glob.o: ltcompile str/case_glob.c include/bglibs/str.h sysdeps.h ./ltcompile str/case_glob.c str/case_match.lo str/case_match.o: ltcompile str/case_match.c include/bglibs/str.h sysdeps.h ./ltcompile str/case_match.c str/case_start.lo str/case_start.o: ltcompile str/case_start.c include/bglibs/str.h sysdeps.h ./ltcompile str/case_start.c str/cat.lo str/cat.o: ltcompile str/cat.c include/bglibs/str.h sysdeps.h ./ltcompile str/cat.c str/cat2s.lo str/cat2s.o: ltcompile str/cat2s.c include/bglibs/str.h sysdeps.h ./ltcompile str/cat2s.c str/cat3s.lo str/cat3s.o: ltcompile str/cat3s.c include/bglibs/str.h sysdeps.h ./ltcompile str/cat3s.c str/cat4s.lo str/cat4s.o: ltcompile str/cat4s.c include/bglibs/str.h sysdeps.h ./ltcompile str/cat4s.c str/cat5s.lo str/cat5s.o: ltcompile str/cat5s.c include/bglibs/str.h sysdeps.h ./ltcompile str/cat5s.c str/cat6s.lo str/cat6s.o: ltcompile str/cat6s.c include/bglibs/str.h sysdeps.h ./ltcompile str/cat6s.c str/catf.lo str/catf.o: ltcompile str/catf.c include/bglibs/str.h sysdeps.h include/bglibs/fmt.h ./ltcompile str/catf.c str/catiw.lo str/catiw.o: ltcompile str/catiw.c include/bglibs/fmt.h include/bglibs/str.h sysdeps.h ./ltcompile str/catiw.c str/catiwll.lo str/catiwll.o: ltcompile str/catiwll.c include/bglibs/fmt.h include/bglibs/str.h sysdeps.h ./ltcompile str/catiwll.c str/catns.lo str/catns.o: ltcompile str/catns.c include/bglibs/str.h sysdeps.h ./ltcompile str/catns.c str/catsllnum.lo str/catsllnum.o: ltcompile str/catsllnum.c include/bglibs/fmt.h include/bglibs/str.h sysdeps.h ./ltcompile str/catsllnum.c str/catsnum.lo str/catsnum.o: ltcompile str/catsnum.c include/bglibs/fmt.h include/bglibs/str.h sysdeps.h ./ltcompile str/catsnum.c str/catullnum.lo str/catullnum.o: ltcompile str/catullnum.c include/bglibs/fmt.h include/bglibs/str.h sysdeps.h ./ltcompile str/catullnum.c str/catunum.lo str/catunum.o: ltcompile str/catunum.c include/bglibs/fmt.h include/bglibs/str.h sysdeps.h ./ltcompile str/catunum.c str/catuw.lo str/catuw.o: ltcompile str/catuw.c include/bglibs/fmt.h include/bglibs/str.h sysdeps.h ./ltcompile str/catuw.c str/catuwll.lo str/catuwll.o: ltcompile str/catuwll.c include/bglibs/fmt.h include/bglibs/str.h sysdeps.h ./ltcompile str/catuwll.c str/catxw.lo str/catxw.o: ltcompile str/catxw.c include/bglibs/fmt.h include/bglibs/str.h sysdeps.h ./ltcompile str/catxw.c str/catxwll.lo str/catxwll.o: ltcompile str/catxwll.c include/bglibs/fmt.h include/bglibs/str.h sysdeps.h ./ltcompile str/catxwll.c str/cmp.lo str/cmp.o: ltcompile str/cmp.c include/bglibs/str.h sysdeps.h ./ltcompile str/cmp.c str/copy.lo str/copy.o: ltcompile str/copy.c include/bglibs/str.h sysdeps.h ./ltcompile str/copy.c str/copy2s.lo str/copy2s.o: ltcompile str/copy2s.c include/bglibs/str.h sysdeps.h ./ltcompile str/copy2s.c str/copy3s.lo str/copy3s.o: ltcompile str/copy3s.c include/bglibs/str.h sysdeps.h ./ltcompile str/copy3s.c str/copy4s.lo str/copy4s.o: ltcompile str/copy4s.c include/bglibs/str.h sysdeps.h ./ltcompile str/copy4s.c str/copy5s.lo str/copy5s.o: ltcompile str/copy5s.c include/bglibs/str.h sysdeps.h ./ltcompile str/copy5s.c str/copy6s.lo str/copy6s.o: ltcompile str/copy6s.c include/bglibs/str.h sysdeps.h ./ltcompile str/copy6s.c str/copyf.lo str/copyf.o: ltcompile str/copyf.c include/bglibs/str.h sysdeps.h include/bglibs/fmt.h ./ltcompile str/copyf.c str/copyns.lo str/copyns.o: ltcompile str/copyns.c include/bglibs/str.h sysdeps.h ./ltcompile str/copyns.c str/count.lo str/count.o: ltcompile str/count.c include/bglibs/str.h sysdeps.h ./ltcompile str/count.c str/countof.lo str/countof.o: ltcompile str/countof.c include/bglibs/str.h sysdeps.h ./ltcompile str/countof.c str/cut.lo str/cut.o: ltcompile str/cut.c include/bglibs/str.h sysdeps.h ./ltcompile str/cut.c str/diff.lo str/diff.o: ltcompile str/diff.c include/bglibs/str.h sysdeps.h ./ltcompile str/diff.c str/digits.lo str/digits.o: ltcompile str/digits.c include/bglibs/str.h sysdeps.h ./ltcompile str/digits.c str/end.lo str/end.o: ltcompile str/end.c include/bglibs/str.h sysdeps.h ./ltcompile str/end.c str/env_find.lo str/env_find.o: ltcompile str/env_find.c include/bglibs/str.h sysdeps.h include/bglibs/striter.h include/bglibs/envstr.h ./ltcompile str/env_find.c str/env_from_array.lo str/env_from_array.o: ltcompile str/env_from_array.c include/bglibs/str.h sysdeps.h include/bglibs/envstr.h ./ltcompile str/env_from_array.c str/env_from_string.lo str/env_from_string.o: ltcompile str/env_from_string.c include/bglibs/str.h sysdeps.h include/bglibs/envstr.h ./ltcompile str/env_from_string.c str/env_get.lo str/env_get.o: ltcompile str/env_get.c include/bglibs/str.h sysdeps.h include/bglibs/striter.h include/bglibs/envstr.h ./ltcompile str/env_get.c str/env_make_array.lo str/env_make_array.o: ltcompile str/env_make_array.c include/bglibs/str.h sysdeps.h include/bglibs/striter.h include/bglibs/envstr.h ./ltcompile str/env_make_array.c str/env_put.lo str/env_put.o: ltcompile str/env_put.c include/bglibs/str.h sysdeps.h include/bglibs/envstr.h ./ltcompile str/env_put.c str/env_set.lo str/env_set.o: ltcompile str/env_set.c include/bglibs/str.h sysdeps.h include/bglibs/envstr.h ./ltcompile str/env_set.c str/env_unset.lo str/env_unset.o: ltcompile str/env_unset.c include/bglibs/str.h sysdeps.h include/bglibs/envstr.h ./ltcompile str/env_unset.c str/findnext.lo str/findnext.o: ltcompile str/findnext.c include/bglibs/str.h sysdeps.h ./ltcompile str/findnext.c str/findnextof.lo str/findnextof.o: ltcompile str/findnextof.c include/bglibs/str.h sysdeps.h ./ltcompile str/findnextof.c str/findprev.lo str/findprev.o: ltcompile str/findprev.c include/bglibs/str.h sysdeps.h ./ltcompile str/findprev.c str/findprevof.lo str/findprevof.o: ltcompile str/findprevof.c include/bglibs/str.h sysdeps.h ./ltcompile str/findprevof.c str/free.lo str/free.o: ltcompile str/free.c include/bglibs/str.h sysdeps.h ./ltcompile str/free.c str/glob.lo str/glob.o: ltcompile str/glob.c include/bglibs/str.h sysdeps.h ./ltcompile str/glob.c str/init.lo str/init.o: ltcompile str/init.c include/bglibs/str.h sysdeps.h ./ltcompile str/init.c str/iter_advance.lo str/iter_advance.o: ltcompile str/iter_advance.c include/bglibs/striter.h include/bglibs/str.h sysdeps.h ./ltcompile str/iter_advance.c str/iter_start.lo str/iter_start.o: ltcompile str/iter_start.c include/bglibs/striter.h include/bglibs/str.h sysdeps.h ./ltcompile str/iter_start.c str/iter_valid.lo str/iter_valid.o: ltcompile str/iter_valid.c include/bglibs/striter.h include/bglibs/str.h sysdeps.h ./ltcompile str/iter_valid.c str/join.lo str/join.o: ltcompile str/join.c include/bglibs/str.h sysdeps.h ./ltcompile str/join.c str/lower.lo str/lower.o: ltcompile str/lower.c include/bglibs/str.h sysdeps.h ./ltcompile str/lower.c str/lstrip.lo str/lstrip.o: ltcompile str/lstrip.c include/bglibs/str.h sysdeps.h ./ltcompile str/lstrip.c str/match.lo str/match.o: ltcompile str/match.c include/bglibs/str.h sysdeps.h ./ltcompile str/match.c str/rstrip.lo str/rstrip.o: ltcompile str/rstrip.c include/bglibs/str.h sysdeps.h ./ltcompile str/rstrip.c str/sort.lo str/sort.o: ltcompile str/sort.c include/bglibs/str.h sysdeps.h ./ltcompile str/sort.c str/splice.lo str/splice.o: ltcompile str/splice.c include/bglibs/str.h sysdeps.h ./ltcompile str/splice.c str/start.lo str/start.o: ltcompile str/start.c include/bglibs/str.h sysdeps.h ./ltcompile str/start.c str/subst.lo str/subst.o: ltcompile str/subst.c include/bglibs/str.h sysdeps.h ./ltcompile str/subst.c str/truncate.lo str/truncate.o: ltcompile str/truncate.c include/bglibs/str.h sysdeps.h ./ltcompile str/truncate.c str/upper.lo str/upper.o: ltcompile str/upper.c include/bglibs/str.h sysdeps.h ./ltcompile str/upper.c str/xlate.lo str/xlate.o: ltcompile str/xlate.c include/bglibs/str.h sysdeps.h ./ltcompile str/xlate.c sys/clock_gettime.lo sys/clock_gettime.o: ltcompile sys/clock_gettime.c sysdeps.h ./ltcompile sys/clock_gettime.c sys/getpeereid.lo sys/getpeereid.o: ltcompile sys/getpeereid.c sysdeps.h ./ltcompile sys/getpeereid.c sys/iopoll.lo sys/iopoll.o: ltcompile sys/iopoll.c sysdeps.h ./ltcompile sys/iopoll.c sys/setenv.lo sys/setenv.o: ltcompile sys/setenv.c sysdeps.h ./ltcompile sys/setenv.c sys/unsetenv.lo sys/unsetenv.o: ltcompile sys/unsetenv.c sysdeps.h ./ltcompile sys/unsetenv.c sysdeps.h: Makefile choose compile load sysdeps-head.h sysdeps-tail.h systime.h sys/tryattribute.c sys/hasattribute.h0 sys/hasattribute.h1 sys/tryclockgettime.c sys/hasclockgettime.h0 sys/hasclockgettime.h1 sys/trydaylight.c sys/hasdaylight.h0 sys/hasdaylight.h1 sys/trydeprecated.c sys/hasdeprecated.h0 sys/hasdeprecated.h1 sys/trydirent.c sys/hasdirent.h0 sys/hasdirent.h1 sys/trydirentino.c sys/hasdirentino.h0 sys/hasdirentino.h1 sys/trydirenttype.c sys/hasdirenttype.h0 sys/hasdirenttype.h1 sys/trydl.c sys/hasdl.h0 sys/hasdl.h1 sys/tryendian.c sys/hasendian.h0 sys/hasendian.h1 sys/tryflock.c sys/hasflock.h0 sys/hasflock.h1 sys/trygetpeereid.c sys/hasgetpeereid.h0 sys/hasgetpeereid.h1 sys/tryinline.c sys/hasinline.h0 sys/hasinline.h1 sys/tryipv6.c sys/hasipv6.h0 sys/hasipv6.h1 sys/trymkfifo.c sys/hasmkfifo.h0 sys/hasmkfifo.h1 sys/trynamedpipebug.c sys/hasnamedpipebug.h0 sys/hasnamedpipebug.h1 sys/trynoreturn.c sys/hasnoreturn.h0 sys/hasnoreturn.h1 sys/trypeercred.c sys/haspeercred.h0 sys/haspeercred.h1 sys/trypoll.c sys/haspoll.h0 sys/haspoll.h1 sys/trysendfile.c sys/hassendfile.h0 sys/hassendfile.h1 sys/trysetenv.c sys/hassetenv.h0 sys/hassetenv.h1 sys/trysigaction.c sys/hassigaction.h0 sys/hassigaction.h1 sys/trysigprocmask.c sys/hassigprocmask.h0 sys/hassigprocmask.h1 sys/tryspnam.c sys/hasspnam.h0 sys/hasspnam.h1 sys/trysysselect.c sys/hassysselect.h0 sys/hassysselect.h1 sys/trytimespec.c sys/hastimespec.h0 sys/hastimespec.h1 sys/tryulong32.c sys/hasulong32.h0 sys/hasulong32.h1 sys/tryulong64.c sys/hasulong64.h0 sys/hasulong64.h1 sys/tryunaligned.c sys/hasunaligned.h0 sys/hasunaligned.h1 sys/tryunsetenv.c sys/hasunsetenv.h0 sys/hasunsetenv.h1 sys/tryuserpw.c sys/hasuserpw.h0 sys/hasuserpw.h1 sys/tryvfork.c sys/hasvfork.h0 sys/hasvfork.h1 sys/trywaitp.c sys/haswaitp.h0 sys/haswaitp.h1 sys/tryzlib.c sys/haszlib.h0 sys/haszlib.h1 systime.h dl.lib rt.lib ( set -e; \ cat sysdeps-head.h; \ ./choose c attribute; \ ./choose cl daylight; \ ./choose c deprecated; \ ./choose clr ulong32; \ ./choose clr ulong64; \ ./choose clr endian; \ ./choose c dirent; \ ./choose c direntino; \ ./choose c direnttype; \ ./choose cl dl `cat dl.lib`; \ ./choose c ipv6; \ ./choose cl vfork; \ ./choose cl getpeereid; \ ./choose cl flock; \ ./choose cl peercred; \ ./choose cl sendfile; \ ./choose cl sigaction; \ ./choose cl sigprocmask; \ ./choose cl spnam; \ ./choose cl userpw; \ ./choose cl waitp; \ ./choose c zlib; \ ./choose clr poll; \ ./choose c sysselect; \ ./choose cl setenv; \ ./choose c timespec; \ ./choose cl clockgettime `cat rt.lib`; \ ./choose cl unsetenv; \ ./choose clr unaligned; \ ./choose cl mkfifo; \ ./choose clr namedpipebug; \ ./choose c inline; \ ./choose c noreturn; \ cat sysdeps-tail.h; \ ) >sysdeps.h systime.h: compile sys/trysystime.c sys/trytime.c ( ( ./compile sys/trysystime.c >/dev/null 2>&1 && \ echo '#include ' ); \ ( ./compile sys/trytime.c >/dev/null 2>&1 && \ echo '#include ' ) ) >systime.h rm -f sys/trysystime.o sys/trytime.o uint16/get.lo uint16/get.o: ltcompile uint16/get.c uint16.h sysdeps.h uintnn.h ./ltcompile uint16/get.c uint16/pack.lo uint16/pack.o: ltcompile uint16/pack.c uint16.h sysdeps.h uintnn.h ./ltcompile uint16/pack.c uint16/unpack.lo uint16/unpack.o: ltcompile uint16/unpack.c uint16.h sysdeps.h uintnn.h ./ltcompile uint16/unpack.c uint32/get_lsb.lo uint32/get_lsb.o: ltcompile uint32/get_lsb.c uint32.h sysdeps.h uintnn.h ./ltcompile uint32/get_lsb.c uint32/get_msb.lo uint32/get_msb.o: ltcompile uint32/get_msb.c uint32.h sysdeps.h uintnn.h ./ltcompile uint32/get_msb.c uint32/pack_lsb.lo uint32/pack_lsb.o: ltcompile uint32/pack_lsb.c uint32.h sysdeps.h uintnn.h ./ltcompile uint32/pack_lsb.c uint32/pack_msb.lo uint32/pack_msb.o: ltcompile uint32/pack_msb.c uint32.h sysdeps.h uintnn.h ./ltcompile uint32/pack_msb.c uint32/unpack_lsb.lo uint32/unpack_lsb.o: ltcompile uint32/unpack_lsb.c uint32.h sysdeps.h uintnn.h ./ltcompile uint32/unpack_lsb.c uint32/unpack_msb.lo uint32/unpack_msb.o: ltcompile uint32/unpack_msb.c uint32.h sysdeps.h uintnn.h ./ltcompile uint32/unpack_msb.c uint64/get_lsb.lo uint64/get_lsb.o: ltcompile uint64/get_lsb.c uint64.h sysdeps.h uintnn.h uint32.h sysdeps.h ./ltcompile uint64/get_lsb.c uint64/get_msb.lo uint64/get_msb.o: ltcompile uint64/get_msb.c uint64.h sysdeps.h uintnn.h uint32.h sysdeps.h ./ltcompile uint64/get_msb.c uint64/pack_lsb.lo uint64/pack_lsb.o: ltcompile uint64/pack_lsb.c uint64.h sysdeps.h uintnn.h uint32.h sysdeps.h ./ltcompile uint64/pack_lsb.c uint64/pack_msb.lo uint64/pack_msb.o: ltcompile uint64/pack_msb.c uint64.h sysdeps.h uintnn.h uint32.h sysdeps.h ./ltcompile uint64/pack_msb.c uint64/unpack_lsb.lo uint64/unpack_lsb.o: ltcompile uint64/unpack_lsb.c uint64.h sysdeps.h uintnn.h uint32.h sysdeps.h ./ltcompile uint64/unpack_lsb.c uint64/unpack_msb.lo uint64/unpack_msb.o: ltcompile uint64/unpack_msb.c uint64.h sysdeps.h uintnn.h uint32.h sysdeps.h ./ltcompile uint64/unpack_msb.c unix/cloexec_off.lo unix/cloexec_off.o: ltcompile unix/cloexec_off.c include/bglibs/unix.h ./ltcompile unix/cloexec_off.c unix/cloexec_on.lo unix/cloexec_on.o: ltcompile unix/cloexec_on.c include/bglibs/unix.h ./ltcompile unix/cloexec_on.c unix/fcntl_fd_off.lo unix/fcntl_fd_off.o: ltcompile unix/fcntl_fd_off.c include/bglibs/unix.h ./ltcompile unix/fcntl_fd_off.c unix/fcntl_fd_on.lo unix/fcntl_fd_on.o: ltcompile unix/fcntl_fd_on.c include/bglibs/unix.h ./ltcompile unix/fcntl_fd_on.c unix/fcntl_fl_off.lo unix/fcntl_fl_off.o: ltcompile unix/fcntl_fl_off.c include/bglibs/unix.h ./ltcompile unix/fcntl_fl_off.c unix/fcntl_fl_on.lo unix/fcntl_fl_on.o: ltcompile unix/fcntl_fl_on.c include/bglibs/unix.h ./ltcompile unix/fcntl_fl_on.c unix/nonblock_off.lo unix/nonblock_off.o: ltcompile unix/nonblock_off.c include/bglibs/unix.h ./ltcompile unix/nonblock_off.c unix/nonblock_on.lo unix/nonblock_on.o: ltcompile unix/nonblock_on.c include/bglibs/unix.h ./ltcompile unix/nonblock_on.c unix/selfpipe.lo unix/selfpipe.o: ltcompile unix/selfpipe.c sysdeps.h include/bglibs/unix.h include/bglibs/sig.h include/bglibs/selfpipe.h ./ltcompile unix/selfpipe.c unix/sig_alarm.lo unix/sig_alarm.o: ltcompile unix/sig_alarm.c include/bglibs/sig.h ./ltcompile unix/sig_alarm.c unix/sig_all.lo unix/sig_all.o: ltcompile unix/sig_all.c include/bglibs/sig.h sysdeps.h ./ltcompile unix/sig_all.c unix/sig_block.lo unix/sig_block.o: ltcompile unix/sig_block.c include/bglibs/sig.h sysdeps.h ./ltcompile unix/sig_block.c unix/sig_bug.lo unix/sig_bug.o: ltcompile unix/sig_bug.c include/bglibs/sig.h ./ltcompile unix/sig_bug.c unix/sig_catch.lo unix/sig_catch.o: ltcompile unix/sig_catch.c include/bglibs/sig.h sysdeps.h ./ltcompile unix/sig_catch.c unix/sig_child.lo unix/sig_child.o: ltcompile unix/sig_child.c include/bglibs/sig.h ./ltcompile unix/sig_child.c unix/sig_hup.lo unix/sig_hup.o: ltcompile unix/sig_hup.c include/bglibs/sig.h ./ltcompile unix/sig_hup.c unix/sig_int.lo unix/sig_int.o: ltcompile unix/sig_int.c include/bglibs/sig.h ./ltcompile unix/sig_int.c unix/sig_misc.lo unix/sig_misc.o: ltcompile unix/sig_misc.c include/bglibs/sig.h ./ltcompile unix/sig_misc.c unix/sig_pipe.lo unix/sig_pipe.o: ltcompile unix/sig_pipe.c include/bglibs/sig.h ./ltcompile unix/sig_pipe.c unix/sig_quit.lo unix/sig_quit.o: ltcompile unix/sig_quit.c include/bglibs/sig.h ./ltcompile unix/sig_quit.c unix/sig_suspend.lo unix/sig_suspend.o: ltcompile unix/sig_suspend.c include/bglibs/sig.h sysdeps.h ./ltcompile unix/sig_suspend.c unix/sig_term.lo unix/sig_term.o: ltcompile unix/sig_term.c include/bglibs/sig.h ./ltcompile unix/sig_term.c unix/signalfd.lo unix/signalfd.o: ltcompile unix/signalfd.c sysdeps.h include/bglibs/unix.h include/bglibs/sig.h include/bglibs/signalfd.h ./ltcompile unix/signalfd.c unix/trigger_pull.lo unix/trigger_pull.o: ltcompile unix/trigger_pull.c sysdeps.h include/bglibs/trigger.h sysdeps.h ./ltcompile unix/trigger_pull.c unix/trigger_set.lo unix/trigger_set.o: ltcompile unix/trigger_set.c sysdeps.h include/bglibs/trigger.h sysdeps.h ./ltcompile unix/trigger_set.c vmailmgr/req_arg.lo vmailmgr/req_arg.o: ltcompile vmailmgr/req_arg.c vmailmgr/client.h include/bglibs/bglibs/str.h sysdeps.h ./ltcompile vmailmgr/req_arg.c vmailmgr/req_init.lo vmailmgr/req_init.o: ltcompile vmailmgr/req_init.c vmailmgr/client.h include/bglibs/bglibs/str.h sysdeps.h ./ltcompile vmailmgr/req_init.c vmailmgr/req_write.lo vmailmgr/req_write.o: ltcompile vmailmgr/req_write.c vmailmgr/client.h include/bglibs/bglibs/str.h sysdeps.h ./ltcompile vmailmgr/req_write.c vmailmgr/resp_read.lo vmailmgr/resp_read.o: ltcompile vmailmgr/resp_read.c vmailmgr/client.h include/bglibs/bglibs/str.h sysdeps.h ./ltcompile vmailmgr/resp_read.c vmailmgr/vpwentry_export.lo vmailmgr/vpwentry_export.o: ltcompile vmailmgr/vpwentry_export.c vmailmgr/vpwentry.h include/bglibs/bglibs/str.h sysdeps.h include/bglibs/str.h sysdeps.h ./ltcompile vmailmgr/vpwentry_export.c vmailmgr/vpwentry_free.lo vmailmgr/vpwentry_free.o: ltcompile vmailmgr/vpwentry_free.c vmailmgr/vpwentry.h include/bglibs/bglibs/str.h sysdeps.h ./ltcompile vmailmgr/vpwentry_free.c vmailmgr/vpwentry_import.lo vmailmgr/vpwentry_import.o: ltcompile vmailmgr/vpwentry_import.c systime.h include/bglibs/misc.h sysdeps.h vmailmgr/vpwentry.h include/bglibs/bglibs/str.h sysdeps.h ./ltcompile vmailmgr/vpwentry_import.c bglibs-2.04/uint64.h0000664000076400007640000000077413244040127013555 0ustar bruceguenter#ifndef UINT64_H #define UINT64_H #include "sysdeps.h" #include "uintnn.h" __UINTNN_DECL(64,8) #define uint64_get uint64_get_lsb #define uint64_pack uint64_pack_lsb #define uint64_unpack uint64_unpack_lsb #ifdef ENDIAN_LSB #define uint64_get_native uint64_get_lsb #define uint64_pack_native uint64_pack_lsb #define uint64_unpack_native uint64_unpack_lsb #else #define uint64_get_native uint64_get_msb #define uint64_pack_native uint64_pack_msb #define uint64_unpack_native uint64_unpack_msb #endif #endif bglibs-2.04/config.dxy0000664000076400007640000030224113244040127014240 0ustar bruceguenter# Doxyfile 1.8.5 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. # # All text after a double hash (##) is considered a comment and is placed in # front of the TAG it is preceding. # # All text after a single hash (#) is considered a comment and will be ignored. # The format is: # TAG = value [value, ...] # For lists, items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (\" \"). #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all text # before the first occurrence of this tag. Doxygen uses libiconv (or the iconv # built into libc) for the transcoding. See http://www.gnu.org/software/libiconv # for the list of possible encodings. # The default value is: UTF-8. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded by # double-quotes, unless you are using Doxywizard) that should identify the # project for which the documentation is generated. This name is used in the # title of most generated pages and in a few other places. # The default value is: My Project. PROJECT_NAME = bglibs # The PROJECT_NUMBER tag can be used to enter a project or revision number. This # could be handy for archiving the generated documentation or if some version # control system is used. PROJECT_NUMBER = # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a # quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = # With the PROJECT_LOGO tag one can specify an logo or icon that is included in # the documentation. The maximum height of the logo should not exceed 55 pixels # and the maximum width should not exceed 200 pixels. Doxygen will copy the logo # to the output directory. PROJECT_LOGO = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # into which the generated documentation will be written. If a relative path is # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. OUTPUT_DIRECTORY = doc # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub- # directories (in 2 levels) under the output directory of each output format and # will distribute the generated files over these directories. Enabling this # option can be useful when feeding doxygen a huge amount of source files, where # putting all generated files in the same directory would otherwise causes # performance problems for the file system. # The default value is: NO. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # Possible values are: Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese- # Traditional, Croatian, Czech, Danish, Dutch, English, Esperanto, Farsi, # Finnish, French, German, Greek, Hungarian, Italian, Japanese, Japanese-en, # Korean, Korean-en, Latvian, Norwegian, Macedonian, Persian, Polish, # Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, # Turkish, Ukrainian and Vietnamese. # The default value is: English. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member # descriptions after the members that are listed in the file and class # documentation (similar to Javadoc). Set to NO to disable this. # The default value is: YES. BRIEF_MEMBER_DESC = NO # If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief # description of a member or function before the detailed description # # Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. # The default value is: YES. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator that is # used to form the text in various listings. Each string in this list, if found # as the leading text of the brief description, will be stripped from the text # and the result, after processing the whole list, is used as the annotated # text. Otherwise, the brief description is used as-is. If left blank, the # following values are used ($name is automatically replaced with the name of # the entity):The $name class, The $name widget, The $name file, is, provides, # specifies, contains, represents, a, an and the. ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # doxygen will generate a detailed section even if there is only a brief # description. # The default value is: NO. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. # The default value is: NO. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path # before files name in the file list and in the header files. If set to NO the # shortest path that makes the file name unique will be used # The default value is: YES. FULL_PATH_NAMES = NO # The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. # Stripping is only done if one of the specified strings matches the left-hand # part of the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the path to # strip. # # Note that you can specify absolute paths here, but also relative paths, which # will be relative from the directory where doxygen is started. # This tag requires that the tag FULL_PATH_NAMES is set to YES. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the # path mentioned in the documentation of a class, which tells the reader which # header file to include in order to use a class. If left blank only the name of # the header file containing the class definition is used. Otherwise one should # specify the list of include paths that are normally passed to the compiler # using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but # less readable) file names. This can be useful is your file systems doesn't # support long names like on DOS, Mac, or CD-ROM. # The default value is: NO. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the # first line (until the first dot) of a Javadoc-style comment as the brief # description. If set to NO, the Javadoc-style will behave just like regular Qt- # style comments (thus requiring an explicit @brief command for a brief # description.) # The default value is: NO. JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first # line (until the first dot) of a Qt-style comment as the brief description. If # set to NO, the Qt-style will behave just like regular Qt-style comments (thus # requiring an explicit \brief command for a brief description.) # The default value is: NO. QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a # multi-line C++ special comment block (i.e. a block of //! or /// comments) as # a brief description. This used to be the default behavior. The new default is # to treat a multi-line C++ comment block as a detailed description. Set this # tag to YES if you prefer the old behavior instead. # # Note that setting this tag to YES also means that rational rose comments are # not recognized any more. # The default value is: NO. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the # documentation from any documented member that it re-implements. # The default value is: YES. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a # new page for each member. If set to NO, the documentation of a member will be # part of the file/class/namespace that contains it. # The default value is: NO. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen # uses this value to replace tabs by spaces in code fragments. # Minimum value: 1, maximum value: 16, default value: 4. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that act as commands in # the documentation. An alias has the form: # name=value # For example adding # "sideeffect=@par Side Effects:\n" # will allow you to put the command \sideeffect (or @sideeffect) in the # documentation, which will result in a user-defined paragraph with heading # "Side Effects:". You can put \n's in the value part of an alias to insert # newlines. ALIASES = # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example adding "class=itcl::class" # will allow you to use the command class in the itcl::class meaning. TCL_SUBST = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For # instance, some of the names that are used will be different. The list of all # members will be omitted, etc. # The default value is: NO. OPTIMIZE_OUTPUT_FOR_C = YES # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or # Python sources only. Doxygen will then generate output that is more tailored # for that language. For instance, namespaces will be presented as packages, # qualified scopes will look different, etc. # The default value is: NO. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources. Doxygen will then generate output that is tailored for Fortran. # The default value is: NO. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for VHDL. # The default value is: NO. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, and # language is one of the parsers supported by doxygen: IDL, Java, Javascript, # C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make # doxygen treat .inc files as Fortran files (default is PHP), and .f files as C # (default is Fortran), use: inc=Fortran f=C. # # Note For files without extension you can use no_extension as a placeholder. # # Note that for custom extensions you also need to set FILE_PATTERNS otherwise # the files are not read by doxygen. EXTENSION_MAPPING = # If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments # according to the Markdown format, which allows for more readable # documentation. See http://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you can # mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in # case of backward compatibilities issues. # The default value is: YES. MARKDOWN_SUPPORT = YES # When enabled doxygen tries to link words that correspond to documented # classes, or namespaces to their corresponding documentation. Such a link can # be prevented in individual cases by by putting a % sign in front of the word # or globally by setting AUTOLINK_SUPPORT to NO. # The default value is: YES. AUTOLINK_SUPPORT = YES # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should set this # tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); # versus func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. # The default value is: NO. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. # The default value is: NO. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip (see: # http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen # will parse them like normal C++ but will assume all classes use public instead # of private inheritance when no explicit protection keyword is present. # The default value is: NO. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate # getter and setter methods for a property. Setting this option to YES will make # doxygen to replace the get and set methods by a property in the documentation. # This will only work if the methods are indeed getting or setting a simple # type. If this is not the case, or you want to show the methods anyway, you # should set this option to NO. # The default value is: YES. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. # The default value is: NO. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES to allow class member groups of the same type # (for instance a group of public functions) to be put as a subgroup of that # type (e.g. under the Public Functions section). Set it to NO to prevent # subgrouping. Alternatively, this can be done per class using the # \nosubgrouping command. # The default value is: YES. SUBGROUPING = YES # When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions # are shown inside the group in which they are included (e.g. using \ingroup) # instead of on a separate page (for HTML and Man pages) or section (for LaTeX # and RTF). # # Note that this feature does not work in combination with # SEPARATE_MEMBER_PAGES. # The default value is: NO. INLINE_GROUPED_CLASSES = NO # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions # with only public data fields or simple typedef fields will be shown inline in # the documentation of the scope in which they are defined (i.e. file, # namespace, or group documentation), provided this scope is documented. If set # to NO, structs, classes, and unions are shown on a separate page (for HTML and # Man pages) or section (for LaTeX and RTF). # The default value is: NO. INLINE_SIMPLE_STRUCTS = NO # When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or # enum is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically be # useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. # The default value is: NO. TYPEDEF_HIDES_STRUCT = NO # The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This # cache is used to resolve symbols given their name and scope. Since this can be # an expensive process and often the same symbol appears multiple times in the # code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small # doxygen will become slower. If the cache is too large, memory is wasted. The # cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range # is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 # symbols. At the end of a run doxygen will report the cache usage and suggest # the optimal cache size from a speed point of view. # Minimum value: 0, maximum value: 9, default value: 0. LOOKUP_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. Private # class members and static file members will be hidden unless the # EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. # Note: This will also disable the warnings about undocumented members that are # normally produced when WARNINGS is set to YES. # The default value is: NO. EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES all private members of a class will # be included in the documentation. # The default value is: NO. EXTRACT_PRIVATE = NO # If the EXTRACT_PACKAGE tag is set to YES all members with package or internal # scope will be included in the documentation. # The default value is: NO. EXTRACT_PACKAGE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file will be # included in the documentation. # The default value is: NO. EXTRACT_STATIC = NO # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined # locally in source files will be included in the documentation. If set to NO # only classes defined in header files are included. Does not have any effect # for Java sources. # The default value is: YES. EXTRACT_LOCAL_CLASSES = NO # This flag is only useful for Objective-C code. When set to YES local methods, # which are defined in the implementation section but not in the interface are # included in the documentation. If set to NO only methods in the interface are # included. # The default value is: NO. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base name of # the file that contains the anonymous namespace. By default anonymous namespace # are hidden. # The default value is: NO. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all # undocumented members inside documented classes or files. If set to NO these # members will be included in the various overviews, but no documentation # section is generated. This option has no effect if EXTRACT_ALL is enabled. # The default value is: NO. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. If set # to NO these classes will be included in the various overviews. This option has # no effect if EXTRACT_ALL is enabled. # The default value is: NO. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend # (class|struct|union) declarations. If set to NO these declarations will be # included in the documentation. # The default value is: NO. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any # documentation blocks found inside the body of a function. If set to NO these # blocks will be appended to the function's detailed documentation block. # The default value is: NO. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation that is typed after a # \internal command is included. If the tag is set to NO then the documentation # will be excluded. Set it to YES to include the internal documentation. # The default value is: NO. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file # names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. # The default value is: system dependent. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with # their full class and namespace scopes in the documentation. If set to YES the # scope will be hidden. # The default value is: NO. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of # the files that are included by a file in the documentation of that file. # The default value is: YES. SHOW_INCLUDE_FILES = YES # If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include # files with double quotes in the documentation rather than with sharp brackets. # The default value is: NO. FORCE_LOCAL_INCLUDES = NO # If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the # documentation for inline members. # The default value is: YES. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the # (detailed) documentation of file and class members alphabetically by member # name. If set to NO the members will appear in declaration order. # The default value is: YES. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief # descriptions of file, namespace and class members alphabetically by member # name. If set to NO the members will appear in declaration order. # The default value is: NO. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the # (brief and detailed) documentation of class members so that constructors and # destructors are listed first. If set to NO the constructors will appear in the # respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. # Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief # member documentation. # Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting # detailed member documentation. # The default value is: NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy # of group names into alphabetical order. If set to NO the group names will # appear in their defined order. # The default value is: NO. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by # fully-qualified names, including namespaces. If set to NO, the class list will # be sorted only by class name, not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the alphabetical # list. # The default value is: NO. SORT_BY_SCOPE_NAME = NO # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper # type resolution of all parameters of a function it will reject a match between # the prototype and the implementation of a member function even if there is # only one candidate or it is obvious which candidate to choose by doing a # simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still # accept a match between prototype and implementation in such cases. # The default value is: NO. STRICT_PROTO_MATCHING = NO # The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the # todo list. This list is created by putting \todo commands in the # documentation. # The default value is: YES. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the # test list. This list is created by putting \test commands in the # documentation. # The default value is: YES. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug # list. This list is created by putting \bug commands in the documentation. # The default value is: YES. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO) # the deprecated list. This list is created by putting \deprecated commands in # the documentation. # The default value is: YES. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional documentation # sections, marked by \if ... \endif and \cond # ... \endcond blocks. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the # initial value of a variable or macro / define can have for it to appear in the # documentation. If the initializer consists of more lines than specified here # it will be hidden. Use a value of 0 to hide initializers completely. The # appearance of the value of individual variables and macros / defines can be # controlled using \showinitializer or \hideinitializer command in the # documentation regardless of this setting. # Minimum value: 0, maximum value: 10000, default value: 30. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated at # the bottom of the documentation of classes and structs. If set to YES the list # will mention the files that were used to generate the documentation. # The default value is: YES. SHOW_USED_FILES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. This # will remove the Files entry from the Quick Index and from the Folder Tree View # (if specified). # The default value is: YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces # page. This will remove the Namespaces entry from the Quick Index and from the # Folder Tree View (if specified). # The default value is: YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command command input-file, where command is the value of the # FILE_VERSION_FILTER tag, and input-file is the name of an input file provided # by doxygen. Whatever the program writes to standard output is used as the file # version. For an example see the documentation. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. To create the layout file # that represents doxygen's defaults, run doxygen with the -l option. You can # optionally specify a file name after the option, if omitted DoxygenLayout.xml # will be used as the name of the layout file. # # Note that if you run doxygen from a directory containing a file called # DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE # tag is left empty. LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib # extension is automatically appended if omitted. This requires the bibtex tool # to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. # For LaTeX the style of the bibliography can be controlled using # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the # search path. Do not use file names with spaces, bibtex cannot handle them. See # also \cite for info how to create references. CITE_BIB_FILES = #--------------------------------------------------------------------------- # Configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated to # standard output by doxygen. If QUIET is set to YES this implies that the # messages are off. # The default value is: NO. QUIET = YES # The WARNINGS tag can be used to turn on/off the warning messages that are # generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES # this implies that the warnings are on. # # Tip: Turn warnings on while writing the documentation. # The default value is: YES. WARNINGS = YES # If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate # warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag # will automatically be disabled. # The default value is: YES. WARN_IF_UNDOCUMENTED = YES # If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some parameters # in a documented function, or documenting parameters that don't exist or using # markup commands wrongly. # The default value is: YES. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that # are documented, but have no documentation for their parameters or return # value. If set to NO doxygen will only warn about wrong or incomplete parameter # documentation, but not about the absence of documentation. # The default value is: NO. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that doxygen # can produce. The string should contain the $file, $line, and $text tags, which # will be replaced by the file and line number from which the warning originated # and the warning text. Optionally the format may contain $version, which will # be replaced by the version of the file (if it could be obtained via # FILE_VERSION_FILTER) # The default value is: $file:$line: $text. WARN_FORMAT = "$file:$line: $text " # The WARN_LOGFILE tag can be used to specify a file to which warning and error # messages should be written. If left blank the output is written to standard # error (stderr). WARN_LOGFILE = #--------------------------------------------------------------------------- # Configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag is used to specify the files and/or directories that contain # documented source files. You may enter file names like myfile.cpp or # directories like /usr/src/myproject. Separate the files or directories with # spaces. # Note: If this tag is empty the current directory is searched. INPUT = bg-installer.c \ adt \ crypto \ fmt \ include \ iobuf \ net \ path \ str \ unix # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv # documentation (see: http://www.gnu.org/software/libiconv) for the list of # possible encodings. # The default value is: UTF-8. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and # *.h) to filter out the source-files in the directories. If left blank the # following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, # *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, # *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, # *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, # *.qsf, *.as and *.js. FILE_PATTERNS = # The RECURSIVE tag can be used to specify whether or not subdirectories should # be searched for input files as well. # The default value is: NO. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should be # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. # # Note that relative paths are relative to the directory from which doxygen is # run. EXCLUDE = .svn # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded # from the input. # The default value is: NO. EXCLUDE_SYMLINKS = YES # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. # # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test # # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories use the pattern */test/* EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or directories # that contain example code fragments that are included (see the \include # command). EXAMPLE_PATH = . # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and # *.h) to filter out the source-files in the directories. If left blank all # files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude commands # irrespective of the value of the RECURSIVE tag. # The default value is: NO. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or directories # that contain images that are to be included in the documentation (see the # \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command: # # # # where is the value of the INPUT_FILTER tag, and is the # name of an input file. Doxygen will then use the output that the filter # program writes to standard output. If FILTER_PATTERNS is specified, this tag # will be ignored. # # Note that the filter must not add or remove lines; it is applied before the # code is scanned, but not when the output code is generated. If lines are added # or removed, the anchors will not be placed correctly. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: pattern=filter # (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how # filters are used. If the FILTER_PATTERNS tag is empty or if none of the # patterns match the file name, INPUT_FILTER is applied. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER ) will also be used to filter the input files that are used for # producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). # The default value is: NO. FILTER_SOURCE_FILES = NO # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file # pattern. A pattern will override the setting for FILTER_PATTERN (if any) and # it is also possible to disable source filtering for a specific pattern using # *.ext= (so without naming a filter). # This tag requires that the tag FILTER_SOURCE_FILES is set to YES. FILTER_SOURCE_PATTERNS = # If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that # is part of the input, its contents will be placed on the main page # (index.html). This can be useful if you have a project on for instance GitHub # and want to reuse the introduction page also for the doxygen output. USE_MDFILE_AS_MAINPAGE = #--------------------------------------------------------------------------- # Configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will be # generated. Documented entities will be cross-referenced with these sources. # # Note: To get rid of all source code in the generated output, make sure that # also VERBATIM_HEADERS is set to NO. # The default value is: NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body of functions, # classes and enums directly into the documentation. # The default value is: NO. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any # special comment blocks from generated source code fragments. Normal C, C++ and # Fortran comments will always remain visible. # The default value is: YES. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES then for each documented # function all documented functions referencing it will be listed. # The default value is: NO. REFERENCED_BY_RELATION = YES # If the REFERENCES_RELATION tag is set to YES then for each documented function # all documented entities called/used by that function will be listed. # The default value is: NO. REFERENCES_RELATION = YES # If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set # to YES, then the hyperlinks from functions in REFERENCES_RELATION and # REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will # link to the documentation. # The default value is: YES. REFERENCES_LINK_SOURCE = YES # If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the # source code will show a tooltip with additional information such as prototype, # brief description and links to the definition and documentation. Since this # will make the HTML file larger and loading of large files a bit slower, you # can opt to disable this feature. # The default value is: YES. # This tag requires that the tag SOURCE_BROWSER is set to YES. SOURCE_TOOLTIPS = YES # If the USE_HTAGS tag is set to YES then the references to source code will # point to the HTML generated by the htags(1) tool instead of doxygen built-in # source browser. The htags tool is part of GNU's global source tagging system # (see http://www.gnu.org/software/global/global.html). You will need version # 4.8.6 or higher. # # To use it do the following: # - Install the latest version of global # - Enable SOURCE_BROWSER and USE_HTAGS in the config file # - Make sure the INPUT points to the root of the source tree # - Run doxygen as normal # # Doxygen will invoke htags (and that will in turn invoke gtags), so these # tools must be available from the command line (i.e. in the search path). # # The result: instead of the source browser generated by doxygen, the links to # source code will now point to the output of htags. # The default value is: NO. # This tag requires that the tag SOURCE_BROWSER is set to YES. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a # verbatim copy of the header file for each class for which an include is # specified. Set to NO to disable this. # See also: Section \class. # The default value is: YES. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all # compounds will be generated. Enable this if the project contains a lot of # classes, structs, unions or interfaces. # The default value is: YES. ALPHABETICAL_INDEX = YES # The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in # which the alphabetical index list will be split. # Minimum value: 1, maximum value: 20, default value: 5. # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all classes will # be put under the same header in the alphabetical index. The IGNORE_PREFIX tag # can be used to specify a prefix (or a list of prefixes) that should be ignored # while generating the index headers. # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. IGNORE_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES doxygen will generate HTML output # The default value is: YES. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of # it. # The default directory is: html. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for each # generated HTML page (for example: .htm, .php, .asp). # The default value is: .html. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a user-defined HTML header file for # each generated HTML page. If the tag is left blank doxygen will generate a # standard header. # # To get valid HTML the header file that includes any scripts and style sheets # that doxygen needs, which is dependent on the configuration options used (e.g. # the setting GENERATE_TREEVIEW). It is highly recommended to start with a # default header using # doxygen -w html new_header.html new_footer.html new_stylesheet.css # YourConfigFile # and then modify the file new_header.html. See also section "Doxygen usage" # for information on how to generate the default header that doxygen normally # uses. # Note: The header is subject to change so you typically have to regenerate the # default header when upgrading to a newer version of doxygen. For a description # of the possible markers and block names see the documentation. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each # generated HTML page. If the tag is left blank doxygen will generate a standard # footer. See HTML_HEADER for more information on how to generate a default # footer and what special commands can be used inside the footer. See also # section "Doxygen usage" for information on how to generate the default footer # that doxygen normally uses. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading style # sheet that is used by each HTML page. It can be used to fine-tune the look of # the HTML output. If left blank doxygen will generate a default style sheet. # See also section "Doxygen usage" for information on how to generate the style # sheet that doxygen normally uses. # Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as # it is more robust and this tag (HTML_STYLESHEET) will in the future become # obsolete. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_STYLESHEET = # The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user- # defined cascading style sheet that is included after the standard style sheets # created by doxygen. Using this option one can overrule certain style aspects. # This is preferred over using HTML_STYLESHEET since it does not replace the # standard style sheet and is therefor more robust against future updates. # Doxygen will copy the style sheet file to the output directory. For an example # see the documentation. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_STYLESHEET = # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note # that these files will be copied to the base HTML output directory. Use the # $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these # files. In the HTML_STYLESHEET file, use the file name only. Also note that the # files will be copied as-is; there are no commands or markers available. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the stylesheet and background images according to # this color. Hue is specified as an angle on a colorwheel, see # http://en.wikipedia.org/wiki/Hue for more information. For instance the value # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 # purple, and 360 is red again. # Minimum value: 0, maximum value: 359, default value: 220. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors # in the HTML output. For a value of 0 the output will use grayscales only. A # value of 255 will produce the most vivid colors. # Minimum value: 0, maximum value: 255, default value: 100. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_SAT = 100 # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the # luminance component of the colors in the HTML output. Values below 100 # gradually make the output lighter, whereas values above 100 make the output # darker. The value divided by 100 is the actual gamma applied, so 80 represents # a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not # change the gamma. # Minimum value: 40, maximum value: 240, default value: 80. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting this # to NO can help when comparing the output of multiple runs. # The default value is: YES. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_TIMESTAMP = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_DYNAMIC_SECTIONS = NO # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries # shown in the various tree structured indices initially; the user can expand # and collapse entries dynamically later on. Doxygen will expand the tree to # such a level that at most the specified number of entries are visible (unless # a fully collapsed tree already exceeds this amount). So setting the number of # entries 1 will produce a full collapsed tree by default. 0 is a special value # representing an infinite number of entries and will result in a full expanded # tree by default. # Minimum value: 0, maximum value: 9999, default value: 100. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development # environment (see: http://developer.apple.com/tools/xcode/), introduced with # OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a # Makefile in the HTML output directory. Running make will produce the docset in # that directory and running make install will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at # startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_DOCSET = NO # This tag determines the name of the docset feed. A documentation feed provides # an umbrella under which multiple documentation sets from a single provider # (such as a company or product suite) can be grouped. # The default value is: Doxygen generated docs. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_FEEDNAME = "Doxygen generated docs" # This tag specifies a string that should uniquely identify the documentation # set bundle. This should be a reverse domain-name style string, e.g. # com.mycompany.MyDocSet. Doxygen will append .docset to the name. # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_BUNDLE_ID = org.doxygen.Project # The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify # the documentation publisher. This should be a reverse domain-name style # string, e.g. com.mycompany.MyDocSet.documentation. # The default value is: org.doxygen.Publisher. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_PUBLISHER_ID = org.doxygen.Publisher # The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. # The default value is: Publisher. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three # additional HTML index files: index.hhp, index.hhc, and index.hhk. The # index.hhp is a project file that can be read by Microsoft's HTML Help Workshop # (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on # Windows. # # The HTML Help Workshop contains a compiler that can convert all HTML output # generated by doxygen into a single compiled HTML file (.chm). Compiled HTML # files are now used as the Windows 98 help format, and will replace the old # Windows help format (.hlp) on all Windows platforms in the future. Compressed # HTML files also contain an index, a table of contents, and you can search for # words in the documentation. The HTML workshop also contains a viewer for # compressed HTML files. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_HTMLHELP = NO # The CHM_FILE tag can be used to specify the file name of the resulting .chm # file. You can add a path in front of the file if the result should not be # written to the html output directory. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. CHM_FILE = # The HHC_LOCATION tag can be used to specify the location (absolute path # including file name) of the HTML help compiler ( hhc.exe). If non-empty # doxygen will try to run the HTML help compiler on the generated index.hhp. # The file has to be specified with full path. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated ( # YES) or that it should be included in the master .chm file ( NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. GENERATE_CHI = NO # The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc) # and project file content. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. CHM_INDEX_ENCODING = # The BINARY_TOC flag controls whether a binary table of contents is generated ( # YES) or a normal table of contents ( NO) in the .chm file. # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members to # the table of contents of the HTML help documentation and to the tree view. # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that # can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help # (.qch) of the generated HTML documentation. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify # the file name of the resulting .qch file. The path specified is relative to # the HTML output folder. # This tag requires that the tag GENERATE_QHP is set to YES. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help # Project output. For more information please see Qt Help Project / Namespace # (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_QHP is set to YES. QHP_NAMESPACE = # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt # Help Project output. For more information please see Qt Help Project / Virtual # Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- # folders). # The default value is: doc. # This tag requires that the tag GENERATE_QHP is set to YES. QHP_VIRTUAL_FOLDER = doc # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom # filter to add. For more information please see Qt Help Project / Custom # Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- # filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_NAME = # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see Qt Help Project / Custom # Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- # filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's filter section matches. Qt Help Project / Filter Attributes (see: # http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_SECT_FILTER_ATTRS = # The QHG_LOCATION tag can be used to specify the location of Qt's # qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the # generated .qhp file. # This tag requires that the tag GENERATE_QHP is set to YES. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be # generated, together with the HTML files, they form an Eclipse help plugin. To # install this plugin and make it available under the help contents menu in # Eclipse, the contents of the directory containing the HTML and XML files needs # to be copied into the plugins directory of eclipse. The name of the directory # within the plugins directory should be the same as the ECLIPSE_DOC_ID value. # After copying Eclipse needs to be restarted before the help appears. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_ECLIPSEHELP = NO # A unique identifier for the Eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have this # name. Each documentation set should have its own identifier. # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. ECLIPSE_DOC_ID = org.doxygen.Project # If you want full control over the layout of the generated HTML pages it might # be necessary to disable the index and replace it with your own. The # DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top # of each HTML page. A value of NO enables the index and the value YES disables # it. Since the tabs in the index contain the same information as the navigation # tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. DISABLE_INDEX = NO # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. If the tag # value is set to YES, a side panel will be generated containing a tree-like # index structure (just like the one that is generated for HTML Help). For this # to work a browser that supports JavaScript, DHTML, CSS and frames is required # (i.e. any modern browser). Windows users are probably better off using the # HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can # further fine-tune the look of the index. As an example, the default style # sheet generated by doxygen has an example that shows how to put an image at # the root of the tree instead of the PROJECT_NAME. Since the tree basically has # the same information as the tab index, you could consider setting # DISABLE_INDEX to YES when enabling this option. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_TREEVIEW = NO # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that # doxygen will group on one line in the generated HTML documentation. # # Note that a value of 0 will completely suppress the enum values from appearing # in the overview section. # Minimum value: 0, maximum value: 20, default value: 4. # This tag requires that the tag GENERATE_HTML is set to YES. ENUM_VALUES_PER_LINE = 4 # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used # to set the initial width (in pixels) of the frame in which the tree is shown. # Minimum value: 0, maximum value: 1500, default value: 250. # This tag requires that the tag GENERATE_HTML is set to YES. TREEVIEW_WIDTH = 250 # When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to # external symbols imported via tag files in a separate window. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. EXT_LINKS_IN_WINDOW = NO # Use this tag to change the font size of LaTeX formulas included as images in # the HTML documentation. When you change the font size after a successful # doxygen run you need to manually remove any form_*.png images from the HTML # output directory to force them to be regenerated. # Minimum value: 8, maximum value: 50, default value: 10. # This tag requires that the tag GENERATE_HTML is set to YES. FORMULA_FONTSIZE = 10 # Use the FORMULA_TRANPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are not # supported properly for IE 6.0, but are supported on all modern browsers. # # Note that when changing this option you need to delete any form_*.png files in # the HTML output directory before the changes have effect. # The default value is: YES. # This tag requires that the tag GENERATE_HTML is set to YES. FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see # http://www.mathjax.org) which uses client side Javascript for the rendering # instead of using prerendered bitmaps. Use this if you do not have LaTeX # installed or if you want to formulas look prettier in the HTML output. When # enabled you may also need to install MathJax separately and configure the path # to it using the MATHJAX_RELPATH option. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. USE_MATHJAX = NO # When MathJax is enabled you can set the default output format to be used for # the MathJax output. See the MathJax site (see: # http://docs.mathjax.org/en/latest/output.html) for more details. # Possible values are: HTML-CSS (which is slower, but has the best # compatibility), NativeMML (i.e. MathML) and SVG. # The default value is: HTML-CSS. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_FORMAT = HTML-CSS # When MathJax is enabled you need to specify the location relative to the HTML # output directory using the MATHJAX_RELPATH option. The destination directory # should contain the MathJax.js script. For instance, if the mathjax directory # is located at the same level as the HTML output directory, then # MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax # Content Delivery Network so you can quickly see the result without installing # MathJax. However, it is strongly recommended to install a local copy of # MathJax from http://www.mathjax.org before deployment. # The default value is: http://cdn.mathjax.org/mathjax/latest. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest # The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax # extension names that should be enabled during MathJax rendering. For example # MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_EXTENSIONS = # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site # (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_CODEFILE = # When the SEARCHENGINE tag is enabled doxygen will generate a search box for # the HTML output. The underlying search engine uses javascript and DHTML and # should work on any modern browser. Note that when using HTML help # (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) # there is already a search function so this one should typically be disabled. # For large projects the javascript based search engine can be slow, then # enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to # search using the keyboard; to jump to the search box use + S # (what the is depends on the OS and browser, but it is typically # , /