bglibs-1.106/0000775000076400007640000000000011147311330012322 5ustar bruceguenterbglibs-1.106/FILES0000664000076400007640000003213311147311327013117 0ustar bruceguenterANNOUNCEMENT AUTOFILES COPYING ChangeLog FILES INSTHIER LIBVERSION Makefile NEWS README SRCFILES TARGETS TODO VERSION adt/adt_sp.c adt/common.h adt/ghash.h 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.h adt/gqueue_pop.c adt/gqueue_push.c adt/gqueue_top.c adt/gstack.h adt/gstack_pop.c adt/gstack_push.c adt/gstack_top.c adt/hashb.c adt/hashs.c base64/asc2bin.c base64/base64.h base64/bin2asc.c base64/decode_line.c base64/decode_part.c base64/encode_line.c base64/encode_part.c bg-installer.c bglibs-1.106.spec cdb/cdb.c cdb/cdb.h cdb/cdbhash.c cdb/find.c cdb/get.c cdb/getnext.c cdb/make.c cdb/make.h cdb/read.c cdb/str.h choose.sh cli-generate.1 cli-generate.pl cli/cli.h 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/crc16_arc.h crc/crc16_ccitt.h crc/crc16_xmodem.h crc/crc32.h crc/crc32c.h crc/crc64.h crc/gcrc.h 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/hmac.h crypto/md4.c crypto/md4.h crypto/md5-crypt.c crypto/md5.c crypto/md5.h crypto/sha1.c crypto/sha1.h crypto/sha256.c crypto/sha256.h crypto/sha384.c crypto/sha384.h crypto/sha512.c crypto/sha512.h crypto/surf.c crypto/surf.h crypto/surfrand.c crypto/surfrand.h dict/add.c dict/dict.h dict/dicthash.c dict/foreach.c dict/free.c dict/get.c dict/init.c dict/load.h dict/load_list.c dict/load_map.c dict/str_free.c doc/html/adt_2common_8h-source.html 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/annotated.html doc/html/classes.html doc/html/cloexec_8h-source.html doc/html/cmsg_8h-source.html doc/html/deprecated.html doc/html/dir_201548bc8cd7b18da7ab15618d9a7744.html doc/html/dir_28609d2f6b17322077df409bed0e8d02.html doc/html/dir_3fb7bf5367cadb161b081662ce57c8a3.html doc/html/dir_74e682a418f682a90c4a9d71beb28fdd.html doc/html/dir_a2e2a6ddf2b9459cbc3be164f3c73476.html doc/html/dir_b467e31085870d6887ee57c7b172ec7c.html doc/html/dir_dd30a1940344e6186e300b1ab56c7d11.html doc/html/dir_e79ee0b49666b683d4b4444c8b170e6b.html doc/html/dir_f74869e8b4fdb609276034ecde8dfb36.html doc/html/dirs.html doc/html/doxygen.css doc/html/doxygen.png doc/html/env_8h-source.html doc/html/examples.html doc/html/fcntl_8h-source.html doc/html/files.html doc/html/functions.html doc/html/functions_vars.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__envstr.html doc/html/group__fmt.html doc/html/group__ibuf.html doc/html/group__installer.html doc/html/group__instlib.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/installer_8h-source.html doc/html/iobuf_2common_8h-source.html doc/html/iobuf_8h-source.html doc/html/ipv4_8h-source.html doc/html/ipv6_8h-source.html doc/html/iter_8h-source.html doc/html/md4_8h-source.html doc/html/md5_8h-source.html doc/html/misc_8h-source.html doc/html/modules.html doc/html/multi_8h-source.html doc/html/nonblock_8h-source.html doc/html/number_8h-source.html doc/html/obuf_8h-source.html 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/str_8h-source.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/structibuf.html doc/html/structiobuf.html doc/html/structipv4addr.html doc/html/structipv6addr.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/tab_b.gif doc/html/tab_l.gif doc/html/tab_r.gif doc/html/tabs.css doc/html/trigger_8h-source.html doc/latex/FreeSans.ttf 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_201548bc8cd7b18da7ab15618d9a7744.tex doc/latex/dir_28609d2f6b17322077df409bed0e8d02.tex doc/latex/dir_3fb7bf5367cadb161b081662ce57c8a3.tex doc/latex/dir_74e682a418f682a90c4a9d71beb28fdd.tex doc/latex/dir_a2e2a6ddf2b9459cbc3be164f3c73476.tex doc/latex/dir_b467e31085870d6887ee57c7b172ec7c.tex doc/latex/dir_dd30a1940344e6186e300b1ab56c7d11.tex doc/latex/dir_e79ee0b49666b683d4b4444c8b170e6b.tex doc/latex/dir_f74869e8b4fdb609276034ecde8dfb36.tex doc/latex/dirs.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__envstr.tex doc/latex/group__fmt.tex doc/latex/group__ibuf.tex doc/latex/group__installer.tex doc/latex/group__instlib.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/pages.tex doc/latex/refman.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/structibuf.tex doc/latex/structiobuf.tex doc/latex/structipv4addr.tex doc/latex/structipv6addr.tex doc/latex/structobuf.tex doc/latex/structstr.tex doc/latex/structstr__sortentry.tex doc/latex/structstriter.tex doc/latex/structsurfrand.tex fmt/char.c fmt/chars.c fmt/lcase.c fmt/misc.h fmt/multi.c fmt/multi.h fmt/number.h 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 instlib/installer.c instlib/installer.h instlib/instcheck.c instlib/instmain.c instlib/instshow.c iobuf/common.h iobuf/ibuf.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.h iobuf/iobuf_close.c iobuf/iobuf_copy.c iobuf/iobuf_init.c iobuf/iobuf_timeout.c iobuf/obuf.h 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/misc.h misc/random.c misc/strtou.c misc/ucspi.c misc/ucspi.h misc/utoa.c misc/utoa2.c msg/common.c msg/commonf.c msg/debug.c msg/debug.h msg/debug_bits.c msg/debug_init.c msg/debugf.c msg/die.c msg/dief.c msg/error.c msg/errorf.c msg/msg.h msg/oom.c msg/show_pid.c msg/warn.c msg/warnf.c msg/wrap.h 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/getaddr4.c net/getaddr6.c net/ipv4.h net/ipv4_addr.c net/ipv4_format.c net/ipv4_scan.c net/ipv6.h 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.h net/resolve_error.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/socket.h 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 path/path.h pwcmp/client.c pwcmp/client.h pwcmp/hex.h pwcmp/hex_encode.c pwcmp/module.c pwcmp/module.h selftest.c selftests.sh str/alloc.c str/buildmap.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/env.h 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.h 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/str.h 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/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/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.h unix/cloexec_off.c unix/cloexec_on.c unix/fcntl.h unix/fcntl_fd_off.c unix/fcntl_fd_on.c unix/fcntl_fl_off.c unix/fcntl_fl_on.c unix/nonblock.h unix/nonblock_off.c unix/nonblock_on.c unix/selfpipe.c unix/selfpipe.h unix/sig.h 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/signalfd.h unix/trigger.h 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-1.106/NEWS0000664000076400007640000004665111147311327013043 0ustar bruceguenter------------------------------------------------------------------------------- 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-1.106/uint16.h0000664000076400007640000000077411147311330013631 0ustar bruceguenter#ifndef UINT16_H #define UINT16_H #include #include __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-1.106/uint64.h0000664000076400007640000000077411147311330013634 0ustar bruceguenter#ifndef UINT64_H #define UINT64_H #include #include __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-1.106/conf-bin0000664000076400007640000000007611147311327013751 0ustar bruceguenter/usr/local/bin Programs will be installed in this directory. bglibs-1.106/conf-cc0000664000076400007640000000010511147311327013557 0ustar bruceguentergcc -W -Wall -Wshadow -Os -g This will be used to compile .c files. bglibs-1.106/instlib/0000755000076400007640000000000011147311327013772 5ustar bruceguenterbglibs-1.106/instlib/installer.c0000664000076400007640000000646411147311327016147 0ustar bruceguenter#include #include #include #include #include #include #include #include "msg/msg.h" #include "msg/wrap.h" #include "path/path.h" #include "str/str.h" #include "installer.h" const char program[] = "installer"; static int sourcedir; static char buffer[4096]; static str path; static const char* makepath(const char* name) { wrap_str(str_copys(&path, install_prefix)); if (name[0] != '/') wrap_str(str_catc(&path, '/')); wrap_str(str_cats(&path, name)); return path.s; } static void xchdir(int fd) { if (((fd == 0) ? chdir("/") : fchdir(fd)) == -1) die1sys(1, "Could not change base directory"); } static void setmodes(const char* filename, unsigned uid, unsigned gid, unsigned mode) { if (chown(filename, uid, gid) == -1) diefsys(1, "{Could not set owner or group for }s", filename); if (chmod(filename, mode) == -1) diefsys(1, "{Could not set mode for }s", filename); } void cf(int dir, const char* filename, unsigned uid, unsigned gid, unsigned mode, const char* srcfile) { int fdin; int fdout; size_t rd; size_t wr; size_t offset; static str tmpname; xchdir(sourcedir); if ((fdin = open(srcfile, O_RDONLY)) == -1) diefsys(1, "{Could not open input file }s", srcfile); xchdir(dir); if ((fdout = path_mktemp(filename, &tmpname)) == -1) die1sys(1, "Could not create temporary file"); while ((rd = read(fdin, buffer, sizeof buffer)) != 0) { if (rd == (unsigned)-1) diefsys(1, "{Error reading from input file }s", filename); for (offset = 0; offset < rd; offset += wr) { if ((wr = write(fdout, buffer+offset, rd-offset)) == (unsigned)-1) die1sys(1, "Error writing to output file"); } } if (close(fdout) == -1) diefsys(1, "{Error closing output file }s", tmpname.s); setmodes(tmpname.s, uid, gid, mode); if (rename(tmpname.s, filename)) diefsys(1, "{Could not rename '}s{' to '}s{'}", tmpname.s, filename); close(fdin); } void c(int dir, const char* filename, unsigned uid, unsigned gid, unsigned mode) { cf(dir, filename, uid, gid, mode, filename); } int d(int dir, const char* subdir, unsigned uid, unsigned gid, unsigned mode) { xchdir(dir); if (path_mkdirs(subdir, 0700) == -1 && errno != EEXIST) diefsys(1, "{Could not create directory }s", subdir); if ((dir = open(subdir, O_RDONLY)) == -1) diefsys(1, "{Could not open created directory }s", subdir); setmodes(subdir, uid, gid, mode); return dir; } void s(int dir, const char* name, const char* target) { xchdir(dir); unlink(name); if (symlink(target, name) == -1) diefsys(1, "{Could not create symlink }s", name); } static int dochdir(const char* dir) { int fd; if (chdir(dir) == -1) diefsys(1, "{Could not change directory to }s", dir); if ((fd = open(".", O_RDONLY)) == -1) diefsys(1, "{Could not open directory }s", dir); return fd; } int opendir(const char* dir) { dir = makepath(dir); if (path_mkdirs(dir, 0777) == -1 && errno != EEXIST) diefsys(1, "{Could not create directory }s", dir); return dochdir(dir); } int opensubdir(int dir, const char* subdir) { xchdir(dir); return dochdir(subdir); } void instprep(void) { if ((sourcedir = open(".", O_RDONLY)) == -1) die1sys(1, "Could not open working directory"); umask(077); } bglibs-1.106/instlib/instmain.c0000664000076400007640000000062111147311327015761 0ustar bruceguenter#include #include "iobuf/obuf.h" #include "installer.h" const int msg_show_pid = 0; extern void instprep(void); const char* install_prefix = ""; int main(int argc, char* argv[]) { const char* tmp; if (argc > 1) install_prefix = argv[1]; else if ((tmp = getenv("install_prefix")) != 0) install_prefix = tmp; instprep(); insthier(); obuf_flush(&outbuf); return 0; } bglibs-1.106/instlib/instcheck.c0000664000076400007640000000527111147311327016120 0ustar bruceguenter#include #include #include #include #include #include #include #include "msg/msg.h" #include "msg/wrap.h" #include "str/str.h" #include "installer.h" const char program[] = "instcheck"; static struct stat statbuf; static str path; static const char* makepath(const char* name) { wrap_str(str_copys(&path, install_prefix)); if (name[0] != '/') wrap_str(str_catc(&path, '/')); wrap_str(str_cats(&path, name)); return path.s; } static void xchdir(int fd) { if (((fd == 0) ? chdir("/") : fchdir(fd)) == -1) die1sys(1, "Could not change base directory"); } static void testmode(int dir, const char* filename, unsigned uid, unsigned gid, unsigned mode, unsigned type) { xchdir(dir); if (lstat(filename, &statbuf) == -1) { if (errno == ENOENT) warnf("{Missing file: }s", filename); else diefsys(1, "{Could not stat file: }s", filename); } if ((statbuf.st_mode & S_IFMT) != type) warnf("{Wrong file type: }s", filename); if (uid != (unsigned)-1 && statbuf.st_uid != uid) warnf("{Wrong owner: }s", filename); if (gid != (unsigned)-1 && statbuf.st_gid != gid) warnf("{Wrong group: }s", filename); if (mode != (unsigned)-1 && (statbuf.st_mode & 07777) != mode) warnf("{Wrong permissions: }s", filename); } void cf(int dir, const char* filename, unsigned uid, unsigned gid, unsigned mode, const char* srcfile) { testmode(dir, filename, uid, gid, mode, S_IFREG); (void)srcfile; } void c(int dir, const char* filename, unsigned uid, unsigned gid, unsigned mode) { cf(dir, filename, uid, gid, mode, filename); } int d(int dir, const char* subdir, unsigned uid, unsigned gid, unsigned mode) { testmode(dir, subdir, uid, gid, mode, S_IFDIR); xchdir(dir); if ((dir = open(subdir, O_RDONLY)) == -1) diefsys(1, "{Could not open directory }s", subdir); return dir; } void s(int dir, const char* name, const char* target) { char linkbuf[4096]; int linklen; int targetlen; xchdir(dir); testmode(dir, name, -1, -1, -1, S_IFLNK); if ((linklen = readlink(name, linkbuf, sizeof linkbuf)) == -1) diefsys(1, "{Could not read symlink: }s", name); targetlen = strlen(target); if (targetlen != linklen || memcmp(linkbuf, target, linklen) != 0) warnf("{Wrong symlink target: }s", name); } int opendir(const char* dir) { int fd; if (chdir(makepath(dir)) == -1) diefsys(1, "{Could not change directory: }s", path.s); if ((fd = open(".", O_RDONLY)) == -1) diefsys(1, "{Could not open directory: }s", path.s); return fd; } int opensubdir(int dir, const char* subdir) { xchdir(dir); return opendir(subdir); } void instprep(void) { } bglibs-1.106/instlib/installer.h0000664000076400007640000000332611147311327016146 0ustar bruceguenter#ifndef SPAC__INSTALLER__H__ #define SPAC__INSTALLER__H__ /** \defgroup instlib instlib: Installation program generation The installer libraries provide for building a program to install files, to verify (check) an installation, and to show what would be installed, from a single source. This single source is typically called \c insthier.c and contains a single routine also named \c insthier (so-named as it provides the installation hierarchy). The libraries provide the \c main function that calls \c insthier as well as all the necessary support functions. Where given, \c uid and \c gid may be set to \c -1 if there is no need to force the installed UID and GID to a particular value. The \c dir argument is a directory number previously opened by \c opendir. @{ */ /** The directory prefix under which all files are placed. */ extern const char* install_prefix; /** Open a directory and provide a file handle reference for future * operations. */ int opendir(const char* dir); /** Open a subdirectory of a directory already opened by \c opendir. */ int opensubdir(int dir, const char* subdir); /** Create a subdirectory. */ int d(int dir, const char* subdir, unsigned uid, unsigned gid, unsigned mode); /** Copy a file from the source directory to a different name. */ void cf(int dir, const char* file, unsigned uid, unsigned gid, unsigned mode, const char* srcfile); /** Copy a file from the source directory, retaining its name. */ void c(int dir, const char* file, unsigned uid, unsigned gid, unsigned mode); /** Create a symbolic link. */ void s(int dir, const char* file, const char* target); /** The single function that the \c insthier.c source needs to define. */ extern void insthier(void); /** @} */ #endif bglibs-1.106/instlib/instshow.c0000664000076400007640000000570511147311327016025 0ustar bruceguenter#include #include #include #include #include #include #include "iobuf/obuf.h" #include "msg/msg.h" #include "msg/wrap.h" #include "str/str.h" #include "installer.h" const char program[] = "instshow"; #define DENTRY_SLOTS 250 static str dentries[DENTRY_SLOTS]; static int last_dentry = 1; static void showmode(char type, unsigned mode) { obuf_putf(&outbuf, "cccccccccc", type, (mode & 0400) ? 'r' : '-', (mode & 0200) ? 'w' : '-', (mode & 0100) ? (mode & 04000) ? 's' : 'x' : (mode & 04000) ? 'S' : '-', (mode & 040) ? 'r' : '-', (mode & 020) ? 'w' : '-', (mode & 010) ? (mode & 02000) ? 's' : 'x' : (mode & 02000) ? 'S' : '-', (mode & 04) ? 'r' : '-', (mode & 02) ? 'w' : '-', (mode & 01) ? (mode & 01000) ? 't' : 'x' : (mode & 01000) ? 'T' : '-'); } #define UID_NA " N/A" static void show(char type, int dir, const char* filename, unsigned uid, unsigned gid, unsigned mode, const char* endline) { showmode(type, mode); if (uid == (unsigned)-1) obuf_puts(&outbuf, UID_NA); else obuf_putf(&outbuf, "\\ 8d", uid); if (gid == (unsigned)-1) obuf_puts(&outbuf, UID_NA); else obuf_putf(&outbuf, "\\ 8d", gid); obuf_putc(&outbuf, ' '); if (filename[0] != '/') { obuf_puts(&outbuf, install_prefix); if (dentries[dir].s[0] != '/') obuf_putc(&outbuf, '/'); obuf_putstr(&outbuf, &dentries[dir]); obuf_putc(&outbuf, '/'); } obuf_puts(&outbuf, filename); obuf_puts(&outbuf, endline); } void c(int dir, const char* filename, unsigned uid, unsigned gid, unsigned mode) { show('-', dir, filename, uid, gid, mode, "\n"); } void cf(int dir, const char* filename, unsigned uid, unsigned gid, unsigned mode, const char* srcfile) { /* show('-', dir, filename, uid, gid, mode, " <= "); obuf_puts(&outbuf, srcfile); obuf_putc(&outbuf, '\n'); */ c(dir, filename, uid, gid, mode); (void)srcfile; } int d(int dir, const char* subdir, unsigned uid, unsigned gid, unsigned mode) { show('d', dir, subdir, uid, gid, mode, "\n"); return opensubdir(dir, subdir); } void s(int dir, const char* name, const char* target) { show('l', dir, name, -1, -1, 0777, " -> "); obuf_puts(&outbuf, target); obuf_putc(&outbuf, '\n'); } int opendir(const char* dir) { if (last_dentry >= DENTRY_SLOTS) die1(1, "Too many open directories"); wrap_str(str_copys(&dentries[last_dentry], dir)); return last_dentry++; } int opensubdir(int dir, const char* subdir) { if (last_dentry >= DENTRY_SLOTS) die1(1, "Too many open directories"); wrap_str(str_copy(&dentries[last_dentry], &dentries[dir])); if (dir > 0) wrap_str(str_catc(&dentries[last_dentry], '/')); wrap_str(str_cats(&dentries[last_dentry], subdir)); return last_dentry++; } void instprep(void) { dentries[0].s = ""; dentries[0].len = 0; obuf_puts(&outbuf, " type/mode owner group path\n"); } bglibs-1.106/bg-installer.c0000664000076400007640000003232011147311327015057 0ustar bruceguenter/* bg-installer.c - Standard bglibs installer system. * 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 #include #include #include #include "cli/cli.h" #include "fmt/number.h" #include "iobuf/ibuf.h" #include "iobuf/obuf.h" #include "iobuf/iobuf.h" #include "msg/msg.h" #include "msg/wrap.h" #include "path/path.h" #include "str/str.h" static int opt_verbose = 0; static int opt_dryrun = 0; static int opt_check = 0; const char program[] = "bg-installer"; const int msg_show_pid = 0; const char cli_help_prefix[] = "\n"; const char cli_help_suffix[] = "See http://untroubled.org/bglibs/docs/group__installer.html\n" "for more information\n"; const char cli_args_usage[] = "[top-directory] >, if present, instruct bg-installer as to which base directory to use (see below). All other lines must have following format: CMD:[OWNER]:[GROUP]:MODE:DIR[:FILENAME[:SOURCE]] - CMD is a single character specifying the installation command, optionally followed by \c ? indicating the command should only execute if the source exists. If the \c ? is followed by a name, it is used instead of \c SOURCE as the filename to test. - OWNER (optional) is the owner user ID or name for the target file. - GROUP (optional) is the group ID or name for the target file. - MODE is the permissions of the installed file in octal. - DIR is the subdirectory of the installation prefix for the destination file. - FILENAME (optional) is the name of the file to install into the directory. It may be omitted for directories. - SOURCE (optional) is the name of the source file to install, if it differs from the destination file, or the path in the symlink. The target filename is \c PREFIX/TOP/DIR/FILENAME where \c PREFIX is the value of \c $install_prefix if it is set, \c TOP is the directory given on the command line, and \c DIR and \c FILENAME given in the installation file. - c lines copy regular files from the current directory - d lines create directories - s lines create symlinks (\c UID, \c GID, and \c MODE are ignored) - l lines copy libraries using libtool When \c bg-installer encounters a base directory directive, as indicated above, it opens the file named \c conf-BASE (where \c BASE is the word on the directive line), reads the first line, and uses that as the base directory (prefixed by \c $install_prefix as above). */ static const char* prefix; static unsigned lineno = 0; static str topdir; static str path; static str line; static int errors = 0; static int getpwnam_uid(const char* s, unsigned* i) { struct passwd* pw; if ((pw = getpwnam(s)) != 0) { *i = pw->pw_uid; return 1; } return 0; } static int getgrnam_gid(const char* s, unsigned *i) { struct group* gr; if ((gr = getgrnam(s)) != 0) { *i = gr->gr_gid; return 1; } return 0; } static int getint(const char* s, unsigned* i, int base, const char* desc, int (*xlate)(const char*, unsigned*)) { char* end; if (*s == 0) *i = -1; else { *i = strtoul(s, &end, base); if (*end != 0) { if (xlate != 0) { if (!xlate(s, i)) { warnf("{Line #}u{ has invalid }s{, skipping\n}", lineno, desc); return 0; } } else { warnf("{Line #}u{ has invalid }s{ number, skipping\n}", lineno, desc); return 0; } } } return 1; } static void makepath(const char* dir, const char* file) { path.len = 0; if (prefix != 0) wrap_str(str_copys(&path, prefix)); wrap_str(str_join(&path, '/', &topdir)); if (dir != 0) wrap_str(str_joins(&path, '/', dir)); if (file != 0) wrap_str(str_joins(&path, '/', file)); } static void error(const char* msg) { errorf("{Path '}s{' }s", path.s, msg); ++errors; } static void show(char type, unsigned uid, unsigned gid, unsigned mode, const char* a, const char* b) { static const char UID_NA[] = " N/A"; if (!opt_verbose) return; obuf_putf(&outbuf, "cccccccccc", type, (mode & 0400) ? 'r' : '-', (mode & 0200) ? 'w' : '-', (mode & 0100) ? (mode & 04000) ? 's' : 'x' : (mode & 04000) ? 'S' : '-', (mode & 040) ? 'r' : '-', (mode & 020) ? 'w' : '-', (mode & 010) ? (mode & 02000) ? 's' : 'x' : (mode & 02000) ? 'S' : '-', (mode & 04) ? 'r' : '-', (mode & 02) ? 'w' : '-', (mode & 01) ? (mode & 01000) ? 't' : 'x' : (mode & 01000) ? 'T' : '-'); if (uid == (unsigned)-1) obuf_puts(&outbuf, UID_NA); else obuf_putf(&outbuf, "\\ 8d", uid); if (gid == (unsigned)-1) obuf_puts(&outbuf, UID_NA); else obuf_putf(&outbuf, "\\ 8d", gid); obuf_putc(&outbuf, ' '); obuf_putstr(&outbuf, &path); if (a != 0) obuf_puts(&outbuf, a); if (b != 0) obuf_puts(&outbuf, b); obuf_endl(&outbuf); } static void setperms(const char* filename, unsigned uid, unsigned gid, unsigned mode) { if (chown(filename, uid, gid) != 0) diefsys(1, "{Could not set owner on '}s{'}", path.s); if (chmod(filename, mode) != 0) diefsys(1, "{Could not set permissions on '}s{'}", path.s); } static void checkmode(unsigned uid, unsigned gid, unsigned mode, unsigned type) { struct stat st; if (lstat(path.s, &st) == -1) { if (errno == ENOENT) error("does not exist"); else diefsys(1, "{Could not stat '}s{'}", path.s); } else { if (uid != (unsigned)-1 && st.st_uid != uid) error("has wrong UID"); if (gid != (unsigned)-1 && st.st_gid != gid) error("has wrong GID"); if ((st.st_mode & 07777) != mode) error("has wrong permissions"); if ((st.st_mode & ~07777) != type) error("is wrong file type"); } } static void c(unsigned uid, unsigned gid, unsigned mode, const char* src) { ibuf in; int out; static str pathtmp; show('-', uid, gid, mode, " <= ", src); if (!opt_dryrun) { if (unlink(path.s) != 0 && errno != ENOENT) diefsys(1, "{Could not remove '}s{'}", path.s); if (!ibuf_open(&in, src, 0)) diefsys(1, "{Could not open '}s{'}", src); if ((out = path_mktemp(path.s, &pathtmp)) == -1) die1sys(1, "Could not create temporary file"); if (!ibuf_copytofd(&in, out) || close(out) != 0) diefsys(1, "{Could not write '}s{'}", pathtmp.s); setperms(pathtmp.s, uid, gid, mode); if (rename(pathtmp.s, path.s) != 0) diefsys(1, "{Could not rename '}s{' to '}s{'}", pathtmp.s, path.s); ibuf_close(&in); } if (opt_check) { checkmode(uid, gid, mode, S_IFREG); } } static void d(unsigned uid, unsigned gid, unsigned mode) { struct stat st; show('d', uid, gid, mode, 0, 0); if (!opt_dryrun) { if (stat(path.s, &st) != 0) { if (path_mkdirs(path.s, 0700) == -1) diefsys(1, "{Could not create directory '}s{'}", path.s); } else if (!S_ISDIR(st.st_mode)) dief(1, "{Path '}s{' exists but is not a directory}", path.s); setperms(path.s, uid, gid, mode); } if (opt_check) { checkmode(uid, gid, mode, S_IFDIR); } } static void l(unsigned uid, unsigned gid, unsigned mode, const char* src) { int i; pid_t pid; const char* argv[] = { "libtool", "--silent", "--mode=install", "install", 0, 0, /* -g GID */ 0, 0, /* -u UID */ 0, 0, /* -m MODE */ 0, /* srcfile */ 0, /* dstfile */ 0 }; char gidbuf[FMT_ULONG_LEN]; char uidbuf[FMT_ULONG_LEN]; char modebuf[FMT_ULONG_LEN]; show('-', uid, gid, mode, 0, 0); if (!opt_dryrun) { i = 4; if (gid != (unsigned)-1) { gidbuf[fmt_udec(gidbuf, gid)] = 0; argv[i++] = "-g"; argv[i++] = gidbuf; } if (uid != (unsigned)-1) { uidbuf[fmt_udec(uidbuf, uid)] = 0; argv[i++] = "-u"; argv[i++] = uidbuf; } modebuf[fmt_unumw(modebuf, mode, 0, 0, 8, fmt_lcase_digits)] = 0; argv[i++] = "-m"; argv[i++] = modebuf; argv[i++] = src; argv[i++] = path.s; if ((pid = fork()) == -1) die1sys(1, "Could not fork"); if (pid == 0) { execvp(argv[0], (char**)argv); exit(111); } if (waitpid(pid, &i, 0) != pid) die1sys(1, "Failed to catch libtool exit"); if (!WIFEXITED(i) || WEXITSTATUS(i) != 0) die1(1, "libtool failed"); } if (opt_check) { checkmode(uid, gid, mode, S_IFREG); } } static void s(const char* src) { char buf[4096]; int len; if (src == 0) { warnf("{Line #}u{ is missing link source\n}", lineno); return; } show('l', -1, -1, 0777, " -> ", src); if (!opt_dryrun) { if (unlink(path.s) != 0 && errno != ENOENT) diefsys(1, "{Could not remove '}s{'}", path.s); if (symlink(src, path.s) != 0) diefsys(1, "{Could not create symlink '}s{'}", path.s); } if (opt_check) { if ((len = readlink(path.s, buf, sizeof buf)) == -1) { if (errno == ENOENT) error("does not exist"); else diefsys(1, "{Could not read symlink '}s{'}", path.s); } else if (len != (int)strlen(src) || memcmp(buf, src, len) != 0) error("contains wrong symlink"); } } void setup_topdir(const char* newpath) { if (newpath[0] != '/') die1(1, "Top directory must start with a slash"); wrap_str(str_copys(&topdir, newpath)); makepath(0, 0); if (!opt_dryrun) { if (path_mkdirs(path.s, 0777) != 0 && errno != EEXIST) diefsys(1, "{Could not create directory '}s{'}", topdir); } } void read_setup_topdir(const char* name) { ibuf in; wrap_str(str_copy2s(&path, "conf-", name)); if (!ibuf_open(&in, path.s, 0)) diefsys(1, "{Could not open '}s{'}", path.s); if (!ibuf_getstr(&in, &line, LF)) diefsys(1, "{Could not read line from '}s{'}", path.s); ibuf_close(&in); str_strip(&line); setup_topdir(line.s); } int cli_main(int argc, char* argv[]) { if (opt_check) opt_dryrun = 1; prefix = getenv("install_prefix"); if (argv[0] != 0) setup_topdir(argv[0]); while (ibuf_getstr(&inbuf, &line, LF)) { const char* uidstr = 0; const char* gidstr = 0; const char* modestr = 0; const char* dir = 0; const char* file = 0; const char* src = 0; unsigned uid; unsigned gid; unsigned mode; int i; ++lineno; str_rstrip(&line); if (line.len == 0 || line.s[0] == '#') continue; if (line.s[0] == '>') { read_setup_topdir(line.s+1); continue; } str_subst(&line, ':', 0); if ((i = str_findfirst(&line, 0)) > 0) { uidstr = line.s + ++i; if ((i = str_findnext(&line, 0, i)) > 0) { gidstr = line.s + ++i; if ((i = str_findnext(&line, 0, i)) > 0) { modestr = line.s + ++i; if ((i = str_findnext(&line, 0, i)) > 0) { dir = line.s + ++i; if ((i = str_findnext(&line, 0, i)) > 0) { file = line.s + ++i; if ((i = str_findnext(&line, 0, i)) > 0) src = line.s + ++i; } } } } } if (dir == 0 || (line.s[0] != 'd' && file == 0)) { warnf("{Line #}u{ is missing required fields\n}", lineno); continue; } if (!getint(uidstr, &uid, 10, "UID", getpwnam_uid)) continue; if (!getint(gidstr, &gid, 10, "GID", getgrnam_gid)) continue; if (!getint(modestr, &mode, 8, "permissions", 0)) continue; makepath(dir, file); if (src == 0 || *src == 0) src = file; if (line.s[1] == '?') { const char* testfile; struct stat st; testfile = (line.s[2] != 0) ? line.s + 2 : src; if (lstat(testfile, &st) == -1) { if (errno == ENOENT) continue; else diefsys(1, "{Could not stat '}s{'}", testfile); } } switch (line.s[0]) { case 'c': c(uid, gid, mode, src); break; case 'd': d(uid, gid, mode); break; case 'l': l(uid, gid, mode, src); break; case 's': s(src); break; default: warnf("{Line #}u{ has invalid command letter, skipping\n}", lineno); } } if (errors > 0) dief(1, "d{ errors were detected}", errors); return 0; (void)argc; } bglibs-1.106/pwcmp/0000755000076400007640000000000011147311330013446 5ustar bruceguenterbglibs-1.106/pwcmp/hex_encode.c0000664000076400007640000000214211147311330015714 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-1.106/pwcmp/client.c0000664000076400007640000000604511147311330015077 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-1.106/pwcmp/client.h0000664000076400007640000000027711147311330015105 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-1.106/pwcmp/hex.h0000664000076400007640000000025511147311330014407 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-1.106/pwcmp/module.h0000664000076400007640000000034611147311330015111 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-1.106/pwcmp/module.c0000664000076400007640000000334311147311330015104 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-1.106/conf-ld0000664000076400007640000000010611147311327013572 0ustar bruceguentergcc -g This will be used to link .o and .a files into an executable. bglibs-1.106/cdb/0000755000076400007640000000000011147311327013056 5ustar bruceguenterbglibs-1.106/cdb/make.c0000664000076400007640000000727011147311327014147 0ustar bruceguenter/* Public domain. */ #include #include #include "cdb.h" #include "make.h" #include "uint32.h" int cdb_make_start(struct cdb_make *c,int fd) { c->head = 0; c->split = 0; c->hash = 0; c->numentries = 0; c->fd = fd; c->pos = sizeof c->final; if (!obuf_init(&c->b,fd,0,IOBUF_SEEKABLE,8192)) return -1; if (!obuf_write(&c->b,(char*)c->final,sizeof c->final)) { obuf_close(&c->b); return -1; } return 0; } static int posplus(struct cdb_make *c,uint32 len) { uint32 newpos = c->pos + len; if (newpos < len) { errno = ENOMEM; return -1; } c->pos = newpos; return 0; } int cdb_make_addend(struct cdb_make *c,unsigned int keylen,unsigned int datalen,uint32 h) { struct cdb_hplist *head; head = c->head; if (!head || (head->num >= CDB_HPLIST)) { head = (struct cdb_hplist *) malloc(sizeof(struct cdb_hplist)); if (!head) return -1; head->num = 0; head->next = c->head; c->head = head; } head->hp[head->num].h = h; head->hp[head->num].p = c->pos; ++head->num; ++c->numentries; if (posplus(c,8) == -1) return -1; if (posplus(c,keylen) == -1) return -1; if (posplus(c,datalen) == -1) return -1; return 0; } int cdb_make_addbegin(struct cdb_make *c,unsigned int keylen,unsigned int datalen) { unsigned char buf[8]; if (keylen > 0xffffffff) { errno = ENOMEM; return -1; } if (datalen > 0xffffffff) { errno = ENOMEM; return -1; } uint32_pack(keylen,buf); uint32_pack(datalen,buf + 4); if (!obuf_write(&c->b,(char*)buf,8)) return -1; return 0; } int cdb_make_add(struct cdb_make *c,const char *key,unsigned int keylen,const char *data,unsigned int datalen) { if (cdb_make_addbegin(c,keylen,datalen) == -1) return -1; if (!obuf_write(&c->b,key,keylen)) return -1; if (!obuf_write(&c->b,data,datalen)) return -1; return cdb_make_addend(c,keylen,datalen,cdb_hash(key,keylen)); } int cdb_make_finish(struct cdb_make *c) { unsigned char buf[8]; int i; uint32 len; uint32 u; uint32 memsize; uint32 count; uint32 where; struct cdb_hplist *x; struct cdb_hp *hp; for (i = 0;i < 256;++i) c->count[i] = 0; for (x = c->head;x;x = x->next) { i = x->num; while (i--) ++c->count[255 & x->hp[i].h]; } memsize = 1; for (i = 0;i < 256;++i) { u = c->count[i] * 2; if (u > memsize) memsize = u; } memsize += c->numentries; /* no overflow possible up to now */ u = (uint32) 0 - (uint32) 1; u /= sizeof(struct cdb_hp); if (memsize > u) { errno = ENOMEM; return -1; } c->split = (struct cdb_hp *) malloc(memsize * sizeof(struct cdb_hp)); if (!c->split) return -1; c->hash = c->split + c->numentries; u = 0; for (i = 0;i < 256;++i) { u += c->count[i]; /* bounded by numentries, so no overflow */ c->start[i] = u; } for (x = c->head;x;x = x->next) { i = x->num; while (i--) c->split[--c->start[255 & x->hp[i].h]] = x->hp[i]; } for (i = 0;i < 256;++i) { count = c->count[i]; len = count + count; /* no overflow possible */ uint32_pack(c->pos,c->final + 8 * i); uint32_pack(len,c->final + 8 * i + 4); for (u = 0;u < len;++u) c->hash[u].h = c->hash[u].p = 0; hp = c->split + c->start[i]; for (u = 0;u < count;++u) { where = (hp->h >> 8) % len; while (c->hash[where].p) if (++where == len) where = 0; c->hash[where] = *hp++; } for (u = 0;u < len;++u) { uint32_pack(c->hash[u].h,buf); uint32_pack(c->hash[u].p,buf + 4); if (!obuf_write(&c->b,(char*)buf,8)) return -1; if (posplus(c,8) == -1) return -1; } } if (!obuf_seek(&c->b,0)) return -1; if (!obuf_write(&c->b,(char*)c->final,sizeof c->final)) return -1; if (!obuf_close(&c->b)) return -1; return 0; } bglibs-1.106/cdb/read.c0000664000076400007640000000056011147311327014140 0ustar bruceguenter/* Adapted from public domain sources written by D. J. Bernstein */ #include #include #include #include "cdb.h" #if 0 int cdb_firstrec(struct cdb* c, uint32* keylen, uint32* datalen) { c->nextrec = 0; if (c->map) { if (size <= 2048) return 0; } int cdb_nextrec(struct cdb* c, uint32* keylen, uint32* datalen) { } #endif bglibs-1.106/cdb/cdb.h0000664000076400007640000000232011147311327013756 0ustar bruceguenter/* Public domain. */ #ifndef CDB_H #define CDB_H #include #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) #endif bglibs-1.106/cdb/cdbhash.c0000664000076400007640000000043511147311327014622 0ustar bruceguenter/* Public domain. */ #include "cdb.h" uint32 cdb_hashadd(uint32 h,unsigned char c) { h += (h << 5); return h ^ c; } uint32 cdb_hash(const char *buf,unsigned int len) { uint32 h; h = CDB_HASHSTART; while (len) { h = cdb_hashadd(h,*buf++); --len; } return h; } bglibs-1.106/cdb/cdb.c0000664000076400007640000000120111147311327013746 0ustar bruceguenter/* Adapted from public domain sources written by D. J. Bernstein */ #include #include #include #include #include "cdb.h" void cdb_free(struct cdb *c) { if (c->map) { munmap(c->map,c->size); c->map = 0; } } void cdb_findstart(struct cdb *c) { c->loop = 0; } void cdb_init(struct cdb *c,int fd) { struct stat st; char *x; cdb_free(c); cdb_findstart(c); c->fd = fd; if (fstat(fd,&st) == 0) if ((uint32)st.st_size <= 0xffffffff) { x = mmap(0,st.st_size,PROT_READ,MAP_SHARED,fd,0); if (x + 1) { c->size = st.st_size; c->map = x; } } } bglibs-1.106/cdb/get.c0000664000076400007640000000240311147311327014002 0ustar bruceguenter/* cdb/get.c -- Retrieve a record from a CDB as a str * Copyright (C) 2001-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 "cdb.h" #include "str.h" #include "str/str.h" int cdb_get(struct cdb* cdb, const str* key, str* data) { if (cdb == 0 || key == 0 || data == 0) return -1; if (!cdb_find(cdb, key->s, key->len)) return 0; if (!str_ready(data, cdb->dlen)) return -1; if (cdb_read(cdb, (unsigned char*)data->s, cdb->dlen, cdb->dpos) == -1) return -1; data->len = cdb->dlen; data->s[data->len] = 0; return 1; } bglibs-1.106/cdb/getnext.c0000664000076400007640000000242411147311327014704 0ustar bruceguenter/* cdb/strgetnext.c -- Retrieve the next record from a CDB as a str * 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 "cdb.h" #include "str.h" #include "str/str.h" int cdb_getnext(struct cdb* cdb, const str* key, str* data) { if (cdb == 0 || key == 0 || data == 0) return -1; if (!cdb_findnext(cdb, key->s, key->len)) return 0; if (!str_ready(data, cdb->dlen)) return -1; if (cdb_read(cdb, (unsigned char*)data->s, cdb->dlen, cdb->dpos) == -1) return -1; data->len = cdb->dlen; data->s[data->len] = 0; return 1; } bglibs-1.106/cdb/make.h0000664000076400007640000000155611147311327014155 0ustar bruceguenter/* Public domain. */ #ifndef CDB_MAKE_H #define CDB_MAKE_H #include "iobuf/iobuf.h" #include "sysdeps.h" #define CDB_HPLIST 1000 struct cdb_hp { uint32 h; uint32 p; } ; struct cdb_hplist { struct cdb_hp hp[CDB_HPLIST]; struct cdb_hplist *next; int num; } ; struct cdb_make { 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-1.106/cdb/find.c0000664000076400007640000000423111147311327014144 0ustar bruceguenter/* Adapted from public domain sources written by D. J. Bernstein */ #include #include #include #include "cdb.h" #include "uint32.h" int cdb_read(struct cdb *c,unsigned char *buf,unsigned int len,uint32 pos) { if (c->map) { if ((pos > c->size) || (c->size - pos < len)) goto FORMAT; memcpy(buf, c->map + pos, len); } else { if (lseek(c->fd, pos, SEEK_SET) == -1) return -1; while (len > 0) { int r; do r = read(c->fd,buf,len); while ((r == -1) && (errno == EINTR)); if (r == -1) return -1; if (r == 0) goto FORMAT; buf += r; len -= r; } } return 0; FORMAT: #ifdef EPROTO errno = EPROTO; #else errno = EINTR; #endif return -1; } static int match(struct cdb *c,const char *key,unsigned int len,uint32 pos) { unsigned char buf[32]; unsigned int n; while (len > 0) { n = sizeof buf; if (n > len) n = len; if (cdb_read(c,buf,n,pos) == -1) return -1; if (memcmp(buf, key, n) != 0) return 0; pos += n; key += n; len -= n; } return 1; } int cdb_findnext(struct cdb *c,const char *key,unsigned int len) { unsigned char buf[8]; uint32 pos; uint32 u; if (!c->loop) { u = cdb_hash(key,len); if (cdb_read(c,buf,8,(u << 3) & 2047) == -1) return -1; c->hslots = uint32_get(buf + 4); if (!c->hslots) return 0; c->hpos = uint32_get(buf); c->khash = u; u >>= 8; u %= c->hslots; u <<= 3; c->kpos = c->hpos + u; } while (c->loop < c->hslots) { if (cdb_read(c,buf,8,c->kpos) == -1) return -1; pos = uint32_get(buf + 4); if (!pos) return 0; c->loop += 1; c->kpos += 8; if (c->kpos == c->hpos + (c->hslots << 3)) c->kpos = c->hpos; u = uint32_get(buf); if (u == c->khash) { if (cdb_read(c,buf,8,pos) == -1) return -1; u = uint32_get(buf); if (u == len) switch(match(c,key,len,pos + 8)) { case -1: return -1; case 1: c->dlen = uint32_get(buf + 4); c->dpos = pos + 8 + len; return 1; } } } return 0; } int cdb_find(struct cdb *c,const char *key,unsigned int len) { cdb_findstart(c); return cdb_findnext(c,key,len); } bglibs-1.106/cdb/str.h0000664000076400007640000000035711147311327014046 0ustar bruceguenter#ifndef CDB__STR__H__ #define CDB__STR__H__ #include struct str; 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); #endif bglibs-1.106/uint16/0000755000076400007640000000000011147311330013446 5ustar bruceguenterbglibs-1.106/uint16/unpack.c0000664000076400007640000000041611147311330015076 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-1.106/uint16/get.c0000664000076400007640000000041611147311330014374 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-1.106/uint16/pack.c0000664000076400007640000000041411147311330014531 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-1.106/msg/0000755000076400007640000000000011147311330013106 5ustar bruceguenterbglibs-1.106/msg/dief.c0000664000076400007640000000033011147311330014157 0ustar bruceguenter#include #include "msg.h" void msg_dief(int code, int showsys, const char* format, ...) { va_list ap; va_start(ap, format); msg_commonfv("Fatal", showsys, format, ap); exit(code); va_end(ap); } bglibs-1.106/msg/error.c0000664000076400007640000000030611147311330014404 0ustar bruceguenter#include "msg.h" void msg_error(const char* a, const char* b, const char* c, const char* d, const char* e, const char* f, int showsys) { msg_common("Error", a, b, c, d, e, f, showsys); } bglibs-1.106/msg/show_pid.c0000664000076400007640000000005511147311330015070 0ustar bruceguenter#include "msg.h" const int msg_show_pid = 0; bglibs-1.106/msg/debug.c0000664000076400007640000000036511147311330014346 0ustar bruceguenter#include "msg.h" void msg_debug(int bit, const char* a, const char* b, const char* c, const char* d, const char* e, const char* f, int showsys) { if (msg_debug_bits & bit) msg_common("Debug", a, b, c, d, e, f, showsys); } bglibs-1.106/msg/wrap_str.c0000664000076400007640000000047411147311330015122 0ustar bruceguenter#include "msg.h" #include "wrap.h" void wrap_str(int result) { if (!result) die_oom(wrap_exit); } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { wrap_exit = 0; wrap_str(1); obuf_putsflush(&outbuf, "worked\n"); wrap_str(0); } #endif #ifdef SELFTEST_EXP worked selftest: Fatal: Out of memory #endif bglibs-1.106/msg/die.c0000664000076400007640000000036411147311330014020 0ustar bruceguenter#include #include "msg.h" 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) { msg_common("Fatal", a, b, c, d, e, f, showsys); exit(code); } bglibs-1.106/msg/wrap.h0000664000076400007640000000026211147311330014232 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-1.106/msg/wrap_chdir.c0000664000076400007640000000074011147311330015377 0ustar bruceguenter#include #include "msg.h" #include "wrap.h" void wrap_chdir(const char* dir) { if (chdir(dir) != 0) die3sys(wrap_exit, "Could not chdir to '", dir, "'"); } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { wrap_exit = 0; wrap_chdir("."); obuf_putsflush(&outbuf, "worked\n"); wrap_chdir("/this/dir/should/not/exist"); } #endif #ifdef SELFTEST_EXP worked selftest: Fatal: Could not chdir to '/this/dir/should/not/exist': No such file or directory #endif bglibs-1.106/msg/commonf.c0000664000076400007640000000206411147311330014714 0ustar bruceguenter#include #include #include #include #include "iobuf/obuf.h" #include "msg.h" static pid_t pid = 0; void msg_commonfv(const char* type, int showsys, const char* format, va_list ap) { if (program != 0) { obuf_puts(&errbuf, program); if (&msg_show_pid != 0 && msg_show_pid) { if (!pid || msg_show_pid < 0) pid = getpid(); obuf_putc(&errbuf, '['); obuf_putu(&errbuf, pid); obuf_putc(&errbuf, ']'); } obuf_puts(&errbuf, ": "); } if (type) { obuf_puts(&errbuf, type); obuf_puts(&errbuf, ": "); } obuf_putfv(&errbuf, format, ap); if (showsys) { obuf_puts(&errbuf, ": "); obuf_puts(&errbuf, strerror(errno)); } obuf_endl(&errbuf); } void msg_commonf(const char* type, int showsys, const char* format, ...) { va_list ap; va_start(ap, format); msg_commonfv(type, showsys, format, ap); va_end(ap); } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { warnf("ss", "a", "b"); } #endif #ifdef SELFTEST_EXP selftest: Warning: ab #endif bglibs-1.106/msg/oom.c0000664000076400007640000000011411147311330014042 0ustar bruceguenter#include "msg.h" void die_oom(int code) { die1(code, "Out of memory"); } bglibs-1.106/msg/debug.h0000664000076400007640000000234411147311330014352 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-1.106/msg/common.c0000664000076400007640000000214311147311330014544 0ustar bruceguenter#include #include #include #include #include "iobuf/iobuf.h" #include "msg.h" static pid_t pid = 0; void msg_common(const char* type, const char* a, const char* b, const char* c, const char* d, const char* e, const char* f, int showsys) { if (program != 0) { obuf_puts(&errbuf, program); if (&msg_show_pid != 0 && msg_show_pid) { if (!pid || msg_show_pid < 0) pid = getpid(); obuf_putc(&errbuf, '['); obuf_putu(&errbuf, pid); obuf_putc(&errbuf, ']'); } obuf_puts(&errbuf, ": "); } if (type) { obuf_puts(&errbuf, type); obuf_puts(&errbuf, ": "); } if (a) obuf_puts(&errbuf, a); if (b) obuf_puts(&errbuf, b); if (c) obuf_puts(&errbuf, c); if (d) obuf_puts(&errbuf, d); if (e) obuf_puts(&errbuf, e); if (f) obuf_puts(&errbuf, f); if (showsys) { obuf_puts(&errbuf, ": "); obuf_puts(&errbuf, strerror(errno)); } obuf_putc(&errbuf, '\n'); obuf_flush(&errbuf); } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { warn2("a", "b"); } #endif #ifdef SELFTEST_EXP selftest: Warning: ab #endif bglibs-1.106/msg/wrap_alloc.c0000664000076400007640000000051311147311330015376 0ustar bruceguenter#include "msg.h" #include "wrap.h" void wrap_alloc(const void* p) { if (p == 0) die_oom(wrap_exit); } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { wrap_exit = 0; wrap_alloc(selftest); obuf_putsflush(&outbuf, "worked\n"); wrap_alloc(0); } #endif #ifdef SELFTEST_EXP worked selftest: Fatal: Out of memory #endif bglibs-1.106/msg/errorf.c0000664000076400007640000000025611147311330014556 0ustar bruceguenter#include "msg.h" void msg_errorf(int showsys, const char* format, ...) { va_list ap; va_start(ap, format); msg_commonfv("Error", showsys, format, ap); va_end(ap); } bglibs-1.106/msg/msg.h0000664000076400007640000000705211147311330014053 0ustar bruceguenter#ifndef MSG__H__ #define MSG__H__ #include #include "msg/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, const char*, const char*, const char*, const char*, const char*, const char*, int); void msg_dief(int code, int showsys, const char* format, ...); #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-1.106/msg/debug_init.c0000664000076400007640000000025211147311330015364 0ustar bruceguenter#include #include "msg.h" void msg_debug_init(void) { const char* env; if ((env = getenv("MSG_DEBUG")) != 0) msg_debug_bits = strtoul(env, 0, 10); } bglibs-1.106/msg/warnf.c0000664000076400007640000000025711147311330014375 0ustar bruceguenter#include "msg.h" void msg_warnf(int showsys, const char* format, ...) { va_list ap; va_start(ap, format); msg_commonfv("Warning", showsys, format, ap); va_end(ap); } bglibs-1.106/msg/warn.c0000664000076400007640000000030611147311330014222 0ustar bruceguenter#include "msg.h" void msg_warn(const char* a, const char* b, const char* c, const char* d, const char* e, const char* f, int showsys) { msg_common("Warning", a, b, c, d, e, f, showsys); } bglibs-1.106/msg/wrap_exit.c0000664000076400007640000000006711147311330015261 0ustar bruceguenter#include "msg.h" #include "wrap.h" int wrap_exit = 1; bglibs-1.106/msg/debug_bits.c0000664000076400007640000000005111147311330015357 0ustar bruceguenter#include "msg.h" int msg_debug_bits = 0; bglibs-1.106/msg/debugf.c0000664000076400007640000000034111147311330014506 0ustar bruceguenter#include "msg.h" void msg_debugf(int bit, int showsys, const char* format, ...) { if (msg_debug_bits & bit) { va_list ap; va_start(ap, format); msg_commonfv("Debug", showsys, format, ap); va_end(ap); } } bglibs-1.106/crc/0000755000076400007640000000000011147311327013075 5ustar bruceguenterbglibs-1.106/crc/crc16_ccitt.h0000664000076400007640000000062111147311327015353 0ustar bruceguenter#ifndef CRC16__CCITT__H__ #define CRC16__CCITT__H__ #include #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-1.106/crc/gcrc32rfl.c0000664000076400007640000001140411147311327015032 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" #include "selftest.c" 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-1.106/crc/gcrc16rfl.c0000664000076400007640000000177111147311327015042 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" #include "selftest.c" 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-1.106/crc/crc64.h0000664000076400007640000000127211147311327014173 0ustar bruceguenter#ifndef CRC64__H__ #define CRC64__H__ #include /* 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-1.106/crc/gcrc16fwd.c0000664000076400007640000000263611147311327015040 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" #include "selftest.c" 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-1.106/crc/gcrc32fwd.c0000664000076400007640000000040411147311327015025 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-1.106/crc/crc16_xmodem.h0000664000076400007640000000061711147311327015543 0ustar bruceguenter#ifndef CRC16__XMODEM__H__ #define CRC16__XMODEM__H__ #include #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-1.106/crc/gcrc64rfl.c0000664000076400007640000000037411147311327015043 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-1.106/crc/crc32.h0000664000076400007640000000066511147311327014173 0ustar bruceguenter#ifndef CRC32__H__ #define CRC32__H__ #include #include #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-1.106/crc/gcrc.h0000664000076400007640000000075111147311327014171 0ustar bruceguenter#ifndef GENERIC_CRC__H__ #define GENERIC_CRC__H__ #include 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-1.106/crc/gcrc64fwd.c0000664000076400007640000000070411147311327015035 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" #include "selftest.c" MAIN { obuf_putXwll(&outbuf, crc64_block("123456789", 9), 16, '0'); NL(); } #endif #ifdef SELFTEST_EXP 62EC59E3F1A4F00A #endif bglibs-1.106/crc/crc32c.h0000664000076400007640000000060111147311327014324 0ustar bruceguenter#ifndef CRC32C__H__ #define CRC32C__H__ #include #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-1.106/crc/crc16_arc.h0000664000076400007640000000055111147311327015014 0ustar bruceguenter#ifndef CRC16__ARC__H__ #define CRC16__ARC__H__ #include #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-1.106/config.dxy0000664000076400007640000015345511147311327014340 0ustar bruceguenter# Doxyfile 1.5.4 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a 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. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the 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 = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # 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 cause performance problems for the file system. 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. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, # Italian, Japanese, Japanese-en (Japanese with English messages), Korean, # Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, # Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) 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. BRIEF_MEMBER_DESC = NO # If the REPEAT_BRIEF tag is set to YES (the default) 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. 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" "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. 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. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then 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. FULL_PATH_NAMES = NO # If the FULL_PATH_NAMES tag is set to YES then 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. 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 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. 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 # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) 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 comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) 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 behaviour. # 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 behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the DETAILS_AT_TOP tag is set to YES then Doxygen # will output the detailed description near the top, like JavaDoc. # If set to NO, the detailed description appears after the member # documentation. DETAILS_AT_TOP = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. 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. 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. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that acts # 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 = # 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. OPTIMIZE_OUTPUT_FOR_C = YES # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for Java. # For instance, namespaces will be presented as packages, qualified scopes # will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # 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); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip 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. SIP_SUPPORT = NO # 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. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) 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. SUBGROUPING = YES # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct (or union) is # documented as struct 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 where the coding convention is that all structs are # typedef'ed and only the typedef is referenced never the struct's name. TYPEDEF_HIDES_STRUCT = NO #--------------------------------------------------------------------------- # 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 and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. 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. 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 (the default) only methods in the interface are included. 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. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) 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. 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 (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. 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 (the default) these declarations will be included in the # documentation. 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 (the default) these blocks will be appended to the # function's detailed documentation block. 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 (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. 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. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) 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. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = 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 default), 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. SORT_BY_SCOPE_NAME = 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. 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. 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. 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. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of 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 initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. 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. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = 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 , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = YES # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED 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. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR 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. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. 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) 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 stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be 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. INPUT = bg-installer.c \ adt \ crypto \ fmt \ instlib \ 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, which is also the default # input encoding. 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. 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 pattern (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 *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 FILE_PATTERNS = # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should # 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. EXCLUDE = .svn # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. 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 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. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are 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. 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 # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # 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 also # VERBATIM_HEADERS is set to NO. If you have enabled CALL_GRAPH or CALLER_GRAPH # then you must also enable this option. If you don't then doxygen will produce # a warning and turn it on anyway SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES (the default) # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = YES # If the REFERENCES_RELATION tag is set to YES (the default) # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = YES # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # 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 documentstion. REFERENCES_LINK_SOURCE = 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. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) 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. 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. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) 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 one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. 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. If left blank `html' will be used as the default path. 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). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. 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 the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compressed HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # 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. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = NO # If the GENERATE_HTMLHELP tag is set to YES, 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. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, 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. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, 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). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, 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. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # If the GENERATE_TREEVIEW tag 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 (for instance Mozilla 1.0+, # Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are # probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # 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. TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = YES # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = NO # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. This is useful # if you want to understand what is going on. On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = NO # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to # produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to # specify the directory where the mscgen tool resides. If left empty the tool is assumed to # be found in the default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will # generate a call dependency graph for every global function or class method. # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable call graphs for selected # functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will # generate a caller dependency graph for every global function or class method. # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable caller graphs for selected # functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the number # of direct children of the root node in a graph is already larger than # MAX_DOT_GRAPH_NOTES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, which results in a white background. # Warning: Depending on the platform used, enabling this option may lead to # badly anti-aliased labels on the edges of a graph (i.e. they become hard to # read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::additions related to the search engine #--------------------------------------------------------------------------- # The SEARCHENGINE tag specifies whether or not a search engine should be # used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO bglibs-1.106/fmt/0000755000076400007640000000000011147311327013114 5ustar bruceguenterbglibs-1.106/fmt/unum.c0000664000076400007640000000516111147311327014251 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 "number.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 #include "selftest.c" 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-1.106/fmt/number.h0000664000076400007640000000734111147311327014564 0ustar bruceguenter#ifndef FMT__NUMBER__H__ #define FMT__NUMBER__H__ /** \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); /** @} */ /** @} */ #endif bglibs-1.106/fmt/sllnum.c0000664000076400007640000000467611147311327014611 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 "number.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 #include "selftest.c" 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-1.106/fmt/misc.h0000664000076400007640000000102211147311327014215 0ustar bruceguenter#ifndef FMT__MISC__H__ #define FMT__MISC__H__ #include struct str; /** \addtogroup fmt @{ */ /** \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); /** @} */ /** @} */ #endif bglibs-1.106/fmt/uhexu.c0000664000076400007640000000065611147311327014427 0ustar bruceguenter#include "number.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-1.106/fmt/pad.c0000664000076400007640000000031011147311327014020 0ustar bruceguenter#include #include "number.h" /** Format a pad character. */ unsigned fmt_pad(char* buffer, unsigned width, char pad) { if (buffer != 0) memset(buffer, pad, width); return width; } bglibs-1.106/fmt/ullnum.c0000664000076400007640000000522611147311327014603 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 "number.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 #include "selftest.c" 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-1.106/fmt/snum.c0000664000076400007640000000474211147311327014253 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 "number.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 #include "selftest.c" 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-1.106/fmt/uhexl.c0000664000076400007640000000065611147311327014416 0ustar bruceguenter#include "number.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-1.106/fmt/ullhexl.c0000664000076400007640000000067511147311327014747 0ustar bruceguenter#include "number.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-1.106/fmt/ullhexu.c0000664000076400007640000000073311147311327014753 0ustar bruceguenter#include "number.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-1.106/fmt/ulldec.c0000664000076400007640000000066511147311327014541 0ustar bruceguenter#include "number.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-1.106/fmt/char.c0000664000076400007640000000250011147311327014174 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 "misc.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 #include "selftest.c" 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-1.106/fmt/chars.c0000664000076400007640000000351011147311327014361 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/str.h" #include "misc.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 #include "selftest.c" 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-1.106/fmt/sign_pad.c0000664000076400007640000000171311147311327015050 0ustar bruceguenter#include #include "number.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 #include "selftest.c" 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-1.106/fmt/sdec.c0000664000076400007640000000056011147311327014201 0ustar bruceguenter#include "number.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-1.106/fmt/lcase.c0000664000076400007640000000022111147311327014344 0ustar bruceguenter#include "number.h" /** Array of digits for lower-case conversions */ const char fmt_lcase_digits[36] = "0123456789abcdefghijklmnopqrstuvwxyz"; bglibs-1.106/fmt/multi.c0000664000076400007640000002165611147311327014426 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 "misc.h" #include "multi.h" #include "number.h" #include "str/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 conversion uses a \c long integer type.
\c ll
The following conversion uses a \c long \c long integer 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.
*/ 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; 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 '\\': 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 #include "selftest.c" 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); } #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 #endif bglibs-1.106/fmt/udec.c0000664000076400007640000000061011147311327014177 0ustar bruceguenter#include "number.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-1.106/fmt/multi.h0000664000076400007640000000046711147311327014430 0ustar bruceguenter#ifndef FMT__MULTI__H__ #define FMT__MULTI__H__ #include /** \addtogroup fmt @{ */ /** \name Multiple item formatting @{ */ extern unsigned fmt_multi(char* buffer, const char* format, ...); extern unsigned fmt_multiv(char* buffer, const char* format, va_list ap); /** @} */ /** @} */ #endif bglibs-1.106/fmt/ucase.c0000664000076400007640000000022111147311327014355 0ustar bruceguenter#include "number.h" /** Array of digits for upper-case conversions */ const char fmt_ucase_digits[36] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; bglibs-1.106/fmt/slldec.c0000664000076400007640000000062611147311327014534 0ustar bruceguenter#include "number.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-1.106/LIBVERSION0000664000076400007640000000000611147311327013723 0ustar bruceguenter2:1:1 bglibs-1.106/uint32.h0000664000076400007640000000077411147311330013627 0ustar bruceguenter#ifndef UINT32_H #define UINT32_H #include #include __UINTNN_DECL(32,4) #define uint32_get uint32_get_lsb #define uint32_pack uint32_pack_lsb #define uint32_unpack uint32_unpack_lsb #ifdef ENDIAN_LSB #define uint32_get_native uint32_get_lsb #define uint32_pack_native uint32_pack_lsb #define uint32_unpack_native uint32_unpack_lsb #else #define uint32_get_native uint32_get_msb #define uint32_pack_native uint32_pack_msb #define uint32_unpack_native uint32_unpack_msb #endif #endif bglibs-1.106/doc/0000755000076400007640000000000011147311327013073 5ustar bruceguenterbglibs-1.106/doc/html/0000755000076400007640000000000011147311327014037 5ustar bruceguenterbglibs-1.106/doc/html/dir_e79ee0b49666b683d4b4444c8b170e6b.html0000664000076400007640000000461311147311327022107 0ustar bruceguenter bglibs: path/ Directory Reference

path Directory Reference


Files

file  contains.c
file  fnmatch.c
file  path/match.c
file  merge.c
file  mkdirs.c
file  mktemp.c
file  path.h [code]

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/structgqueue.html0000664000076400007640000001077711147311327017503 0ustar bruceguenter bglibs: gqueue Struct Reference

gqueue Struct Reference
[adt gqueue: Generic simple queue.]

#include <gqueue.h>


Data Fields

struct gqueue_nodehead
struct gqueue_nodetail
unsigned count


Detailed Description

Generic queue structure.
Examples:

adt/gqueue_test.c.


Field Documentation

struct gqueue_node* gqueue::head [read]

Pointer to the first item in the queue.

struct gqueue_node* gqueue::tail [read]

Pointer to the last item in the queue.

unsigned gqueue::count

The number of items in the queue.


The documentation for this struct was generated from the following file:
Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/md5_8h-source.html0000664000076400007640000004251311147311327017316 0ustar bruceguenter bglibs: md5.h Source File

md5.h

00001 /* Declaration of functions and data types used for MD5 sum computing
00002    library functions.
00003    Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
00004    This file is part of the GNU C Library.
00005 
00006    The GNU C Library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public License as
00008    published by the Free Software Foundation; either version 2 of the
00009    License, or (at your option) any later version.
00010 
00011    The GNU C Library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Library General Public License for more details.
00015 
00016    You should have received a copy of the GNU Library General Public
00017    License along with the GNU C Library; see the file COPYING.LIB.  If not,
00018    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019    Boston, MA 02111-1307, USA.  */
00020 
00021 #ifndef _MD5_H
00022 #define _MD5_H 1
00023 
00024 #include <stdio.h>
00025 
00026 #if defined HAVE_LIMITS_H || _LIBC
00027 # include <limits.h>
00028 #endif
00029 
00030 /* The following contortions are an attempt to use the C preprocessor
00031    to determine an unsigned integral type that is 32 bits wide.  An
00032    alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
00033    doing that would require that the configure script compile and *run*
00034    the resulting executable.  Locally running cross-compiled executables
00035    is usually not possible.  */
00036 
00037 #ifdef _LIBC
00038 # include <sys/types.h>
00039 typedef u_int32_t md5_uint32;
00040 #else
00041 # if defined __STDC__ && __STDC__
00042 #  define UINT_MAX_32_BITS 4294967295U
00043 # else
00044 #  define UINT_MAX_32_BITS 0xFFFFFFFF
00045 # endif
00046 
00047 /* If UINT_MAX isn't defined, assume it's a 32-bit type.
00048    This should be valid for all systems GNU cares about because
00049    that doesn't include 16-bit systems, and only modern systems
00050    (that certainly have <limits.h>) have 64+-bit integral types.  */
00051 
00052 # ifndef UINT_MAX
00053 #  define UINT_MAX UINT_MAX_32_BITS
00054 # endif
00055 
00056 # if UINT_MAX == UINT_MAX_32_BITS
00057    typedef unsigned int md5_uint32;
00058 # else
00059 #  if USHRT_MAX == UINT_MAX_32_BITS
00060     typedef unsigned short md5_uint32;
00061 #  else
00062 #   if ULONG_MAX == UINT_MAX_32_BITS
00063      typedef unsigned long md5_uint32;
00064 #   else
00065      /* The following line is intended to evoke an error.
00066         Using #error is not portable enough.  */
00067      "Cannot determine unsigned 32-bit data type."
00068 #   endif
00069 #  endif
00070 # endif
00071 #endif
00072 
00073 #undef __P
00074 #if defined (__STDC__) && __STDC__
00075 # define __P(x) x
00076 #else
00077 # define __P(x) ()
00078 #endif
00079 
00080 /* Structure to save state of computation between the single steps.  */
00081 struct md5_ctx
00082 {
00083   md5_uint32 A;
00084   md5_uint32 B;
00085   md5_uint32 C;
00086   md5_uint32 D;
00087 
00088   md5_uint32 total[2];
00089   md5_uint32 buflen;
00090   char buffer[128];
00091 };
00092 
00093 /*
00094  * The following three functions are build up the low level used in
00095  * the functions `md5_stream' and `md5_buffer'.
00096  */
00097 
00098 /* Initialize structure containing state of computation.
00099    (RFC 1321, 3.3: Step 3)  */
00100 extern void __md5_init_ctx __P ((struct md5_ctx *ctx));
00101 extern void md5_init_ctx __P ((struct md5_ctx *ctx));
00102 
00103 /* Starting with the result of former calls of this function (or the
00104    initialization function update the context for the next LEN bytes
00105    starting at BUFFER.
00106    It is necessary that LEN is a multiple of 64!!! */
00107 extern void __md5_process_block __P ((const void *buffer, size_t len,
00108                                       struct md5_ctx *ctx));
00109 extern void md5_process_block __P ((const void *buffer, size_t len,
00110                                     struct md5_ctx *ctx));
00111 
00112 /* Starting with the result of former calls of this function (or the
00113    initialization function update the context for the next LEN bytes
00114    starting at BUFFER.
00115    It is NOT required that LEN is a multiple of 64.  */
00116 extern void __md5_process_bytes __P ((const void *buffer, size_t len,
00117                                       struct md5_ctx *ctx));
00118 extern void md5_process_bytes __P ((const void *buffer, size_t len,
00119                                     struct md5_ctx *ctx));
00120 
00121 /* Process the remaining bytes in the buffer and put result from CTX
00122    in first 16 bytes following RESBUF.  The result is always in little
00123    endian byte order, so that a byte-wise output yields to the wanted
00124    ASCII representation of the message digest.
00125 
00126    IMPORTANT: On some systems it is required that RESBUF is correctly
00127    aligned for a 32 bits value.  */
00128 extern void *__md5_finish_ctx __P ((struct md5_ctx *ctx, void *resbuf));
00129 extern void *md5_finish_ctx __P ((struct md5_ctx *ctx, void *resbuf));
00130 
00131 
00132 /* Put result from CTX in first 16 bytes following RESBUF.  The result is
00133    always in little endian byte order, so that a byte-wise output yields
00134    to the wanted ASCII representation of the message digest.
00135 
00136    IMPORTANT: On some systems it is required that RESBUF is correctly
00137    aligned for a 32 bits value.  */
00138 extern void *__md5_read_ctx __P ((const struct md5_ctx *ctx, void *resbuf));
00139 extern void *md5_read_ctx __P ((const struct md5_ctx *ctx, void *resbuf));
00140 
00141 
00142 /* Compute MD5 message digest for bytes read from STREAM.  The
00143    resulting message digest number will be written into the 16 bytes
00144    beginning at RESBLOCK.  */
00145 extern int __md5_stream __P ((FILE *stream, void *resblock));
00146 
00147 /* Compute MD5 message digest for LEN bytes beginning at BUFFER.  The
00148    result is always in little endian byte order, so that a byte-wise
00149    output yields to the wanted ASCII representation of the message
00150    digest.  */
00151 extern void *__md5_buffer __P ((const char *buffer, size_t len,
00152                                 void *resblock));
00153 extern void *md5_buffer __P ((const char *buffer, size_t len,
00154                               void *resblock));
00155 
00156 #endif /* md5.h */

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/selfpipe_8h-source.html0000664000076400007640000000436111147311327020437 0ustar bruceguenter bglibs: selfpipe.h Source File

selfpipe.h

00001 #ifndef BGLIBS__SELF_PIPE__H__
00002 #define BGLIBS__SELF_PIPE__H__
00003 
00007 int selfpipe_init(void);
00008 void selfpipe_close(void);
00009 void selfpipe_catch_signal(int);
00010 
00013 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/dir_f74869e8b4fdb609276034ecde8dfb36.html0000664000076400007640000001467411147311327022272 0ustar bruceguenter bglibs: unix/ Directory Reference

unix Directory Reference


Files

file  cloexec.h [code]
file  cloexec_off.c
file  cloexec_on.c
file  fcntl.c
file  fcntl.h [code]
file  fcntl_fd_off.c
file  fcntl_fd_on.c
file  fcntl_fl_off.c
file  fcntl_fl_on.c
file  nonblock.h [code]
file  nonblock_off.c
file  nonblock_on.c
file  selfpipe.c
file  selfpipe.h [code]
file  sig.h [code]
file  sig_alarm.c
file  sig_all.c
file  sig_block.c
file  sig_bug.c
file  sig_catch.c
file  sig_child.c
file  sig_hup.c
file  sig_int.c
file  sig_misc.c
file  sig_pipe.c
file  sig_quit.c
file  sig_suspend.c
file  sig_term.c
file  signalfd.c
file  signalfd.h [code]
file  trigger.h [code]
file  trigger_pull.c
file  trigger_set.c

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/group__adt.html0000664000076400007640000003062511147311327017060 0ustar bruceguenter bglibs: adt: Abstract Data Types.

adt: Abstract Data Types.


Typedefs

typedef unsigned long adt_hash_t
typedef void adt_free_fn (void *)
typedef int adt_copy_fn (void *, const void *)
typedef int adt_cmp_fn (const void *, const void *)
typedef adt_hash_t adt_hash_fn (const void *)

Functions

adt_hash_t adt_hashb (const unsigned char *, unsigned long)
adt_hash_t adt_hashs (const unsigned char *)
adt_hash_t adt_hashsp (const char *const *)
int adt_cmpsp (const char *const *a, const char *const *b)
int adt_copysp (const char **a, const char *const *b)
void adt_freesp (const char **a)

Detailed Description


Typedef Documentation

typedef int adt_cmp_fn(const 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_copy_fn(void *, const 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 void adt_free_fn(void *)

A function prototype used for freeing something.

typedef adt_hash_t adt_hash_fn(const void *)

A function prototype for hasing an item (typically a key).

typedef unsigned long adt_hash_t

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.


Function Documentation

int adt_cmpsp ( const char *const *  a,
const char *const *  b 
)

A sample function for comparing two C string pointers.

int adt_copysp ( const char **  a,
const char *const *  b 
)

A sample function for copying a C string pointer.

void adt_freesp ( const char **  a  ) 

A sample function for freeing a C string pointer.

adt_hash_t adt_hashb ( const unsigned char *  ,
unsigned  long 
)

A sample function for hasing a block of memory.

adt_hash_t adt_hashs ( const unsigned char *   ) 

A sample function for hashing a C string.

adt_hash_t adt_hashsp ( const char *const *   ) 

A sample function for hashing a C string pointer.


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/group__ibuf.html0000664000076400007640000010376411147311327017242 0ustar bruceguenter bglibs: ibuf: Input Buffer Managemenet

ibuf: Input Buffer Managemenet


Data Structures

struct  ibuf

Defines

#define ibuf_close(in)   iobuf_close(&((in)->io))
#define ibuf_closed(in)   iobuf_closed(&((in)->io))
#define ibuf_error(in)   iobuf_error(&((in)->io))
#define ibuf_timedout(in)   iobuf_timedout(&((in)->io))
#define ibuf_rewind(in)   ibuf_seek(in,0)
#define ibuf_seekfwd(in, off)   ibuf_seek(ibuf_tell(in)+(offset))

Typedefs

typedef int(* ibuf_fn )(int, void *, unsigned long)
typedef struct ibuf ibuf

Functions

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)
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)
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)

Variables

ibuf inbuf

Detailed Description

Calling Convention
Unless otherwise specified, the return value is non-zero (true) if the entire requested operation completed, and 0 (false) otherwise.

Define Documentation

#define ibuf_close ( in   )     iobuf_close(&((in)->io))

Close the ibuf.

#define ibuf_closed ( in   )     iobuf_closed(&((in)->io))

Test if the ibuf has been closed.

#define ibuf_error ( in   )     iobuf_error(&((in)->io))

Test if the ibuf is in an error state.

#define ibuf_rewind ( in   )     ibuf_seek(in,0)

Set the effective read position to the start of the file.

#define ibuf_seekfwd ( in,
off   )     ibuf_seek(ibuf_tell(in)+(offset))

Set the effective read position off bytes forward.

#define ibuf_timedout ( in   )     iobuf_timedout(&((in)->io))

Test if the last ibuf read timed out.


Typedef Documentation

typedef struct ibuf ibuf

Input specific buffer typedef.

typedef int(* ibuf_fn)(int, void *, unsigned long)

ibuf read function pointer prototype.


Function Documentation

int ibuf_eof ( ibuf in  ) 

Test if the ibuf has reaced end of file.

int ibuf_getc ( ibuf in,
char *  ch 
)

Retrieve a single character from the ibuf.

int ibuf_getnetstring ( ibuf in,
struct str s 
)

Read a netstring from the given ibuf .

If the input is not a netstring, errno (and in->io.errnum ) will be set to EPROTOTYPE and the state of in will be undefined.

int ibuf_gets ( ibuf in,
char *  data,
unsigned  datalen,
char  boundary 
)

Read a line from the ibuf into a C string.

int ibuf_getstr ( ibuf in,
struct str s,
char  boundary 
)

Read a line from the ibuf into a dynamic string.

int ibuf_getstr_crlf ( ibuf in,
struct str s 
)

Read a line from the ibuf into a dynamic string, terminated by a CR+LF pair.

int ibuf_getu ( ibuf in,
unsigned long *  data 
)

Read an unsigned long from the ibuf

int ibuf_init ( ibuf in,
int  fd,
ibuf_fn  fn,
unsigned  flags,
unsigned  bufsize 
)

Initialize an ibuf from an already-opened file descriptor.

int ibuf_open ( ibuf in,
const char *  filename,
unsigned  bufsize 
)

Initialize an ibuf by opening a file for reading.

int ibuf_openreadclose ( const char *  filename,
struct str out 
)

Open and read the entire file into the str .

int ibuf_peek ( ibuf in,
char *  ch 
)

Retrieve the next character in the ibuf without advancing the current read position.

int ibuf_read ( ibuf in,
char *  data,
unsigned  datalen 
)

Read a block of data from the 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_large ( ibuf in,
char *  data,
unsigned  datalen 
)

Read a block of data from the ibuf.

This routine differs from 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 iobuf buffer and then into the given buffer. ibuf_read automatically calls this routine if the requested datalen is larger than or equal to the iobuf buffer size.

int ibuf_readall ( ibuf in,
struct str out 
)

Read the remainder of the ibuf into the str.

int ibuf_refill ( ibuf in  ) 

(Re)fill the buffer from the file descriptor.

Note:
This function may only be called when the buffer is completely empty.

int ibuf_seek ( ibuf in,
unsigned  offset 
)

Set the effective read position.

unsigned ibuf_tell ( ibuf in  ) 

Look up the current effective read position.


Variable Documentation

Input buffer for stdin


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/examples.html0000664000076400007640000000262111147311327016546 0ustar bruceguenter bglibs: Examples

bglibs Examples

Here is a list of all examples:
Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/signalfd_8h-source.html0000664000076400007640000000510711147311327020416 0ustar bruceguenter bglibs: signalfd.h Source File

signalfd.h

00001 #ifndef UNIX__SIGNALFD__H__
00002 #define UNIX__SIGNALFD__H__
00003 
00007 extern int signalfd_init(void);
00008 extern void signalfd_catch(int sig);
00009 extern void signalfd_uncatch(int sig);
00010 extern void signalfd_close(void);
00011 
00014 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/trigger_8h-source.html0000664000076400007640000000512411147311327020271 0ustar bruceguenter bglibs: trigger.h Source File

trigger.h

00001 #ifndef BGLIBS__UNIX__TRIGGER__H__
00002 #define BGLIBS__UNIX__TRIGGER__H__
00003 
00004 #include <sysdeps.h>
00005 
00031 extern int trigger_set(iopoll_fd* io, const char* path);
00032 
00035 #define trigger_pulled(IO) ((IO)->revents)
00036 
00037 extern void trigger_pull(const char* path);
00038 
00041 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/structstr__sortentry.html0000664000076400007640000000714711147311327021305 0ustar bruceguenter bglibs: str_sortentry Struct Reference

str_sortentry Struct Reference
[str: Dynamically allocated string library.]

#include <str.h>


Data Fields

const char * str
unsigned long len


Detailed Description

This struct is used to serve in lists of pointers into a string for sorting. Only used as parameters to the comparison function in str_sort

Field Documentation

const char* str_sortentry::str

Pointer to the string data to compare.

unsigned long str_sortentry::len

Length of the string data to compare.


The documentation for this struct was generated from the following file:
Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/structghash.html0000664000076400007640000002576011147311327017300 0ustar bruceguenter bglibs: ghash Struct Reference

ghash Struct Reference
[adt ghash: Generic hash tables.]

#include <ghash.h>


Data Fields

void ** table
unsigned count
unsigned size
unsigned long keysize
unsigned long entrysize
adt_hash_fnhashfn
adt_cmp_fnkeycmp
adt_copy_fnkeycopy
adt_copy_fndatacopy
adt_free_fnkeyfree
adt_free_fndatafree


Detailed Description

The core generic hash table structure.
Examples:

adt/ghash_test.c.


Field Documentation

void** ghash::table

The hash table itself is an array of pointers, the actual type of which is dependant on the declaration of the table.

unsigned ghash::count

The count is the number of items stored in the table.

unsigned ghash::size

The size is the number of slots available in the table.

unsigned long ghash::keysize

The size, in bytes, of the key structure in each table entry.

unsigned long ghash::entrysize

The total size, in bytes, of an entry (key and data).

Pointer to the function which produces a hash of a key.

Pointer to the function which compares two keys.

Pointer to the function which copies a key.

Pointer to the function which copies a data item.

Pointer to the function which frees a key.

Pointer to the function which fressa a data item.


The documentation for this struct was generated from the following file:
Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/structgstack__node.html0000664000076400007640000000715211147311327020621 0ustar bruceguenter bglibs: gstack_node Struct Reference

gstack_node Struct Reference
[adt gstack: Generic simple stack.]

#include <gstack.h>


Data Fields

struct gstack_nodenext
char data [0]


Detailed Description

Generic stack node.

Field Documentation

Pointer to the next element in the stack linked list.

The data contained in the stack node.


The documentation for this struct was generated from the following file:
Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/sig_8h-source.html0000664000076400007640000001105211147311327017405 0ustar bruceguenter bglibs: sig.h Source File

sig.h

00001 #ifndef UNIX__SIG__H__
00002 #define UNIX__SIG__H__
00003 
00004 typedef void (*signalfn)(int);
00005 
00006 void sig_block(int sig);
00007 void sig_unblock(int sig);
00008 void sig_suspend(void);
00009 void sig_catch(int sig, signalfn fn);
00010 void sig_default(int sig);
00011 void sig_ignore(int sig);
00012 
00013 void sig_misc_ignore(void);
00014 void sig_bug_catch(signalfn fn);
00015 
00016 #define SIG_FUNCTION_DECL(NAME) \
00017 extern void sig_##NAME##_block(void); \
00018 extern void sig_##NAME##_unblock(void); \
00019 extern void sig_##NAME##_catch(signalfn fn); \
00020 extern void sig_##NAME##_default(void)
00021 
00022 SIG_FUNCTION_DECL(alarm);
00023 SIG_FUNCTION_DECL(child);
00024 SIG_FUNCTION_DECL(hup);
00025 SIG_FUNCTION_DECL(int);
00026 SIG_FUNCTION_DECL(pipe);
00027 SIG_FUNCTION_DECL(quit);
00028 SIG_FUNCTION_DECL(term);
00029 
00030 SIG_FUNCTION_DECL(all);
00031 
00032 #undef SIG_FUNCTION_DECL
00033 
00034 #define SIG_FUNCTION_MAKE(NAME,SIG) \
00035 extern void sig_##NAME##_block(void) { sig_block(SIG); } \
00036 extern void sig_##NAME##_unblock(void) { sig_unblock(SIG); } \
00037 extern void sig_##NAME##_catch(signalfn fn) { sig_catch(SIG, fn); } \
00038 extern void sig_##NAME##_default(void) { sig_default(SIG); } \
00039 
00040 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/dir_74e682a418f682a90c4a9d71beb28fdd.html0000664000076400007640000002251611147311327022246 0ustar bruceguenter bglibs: net/ Directory Reference

net Directory Reference


Files

file  accept4.c
file  accept6.c
file  acceptu.c
file  bind4.c
file  bind6.c
file  bindu.c
file  broadcast.c
file  cmsg.h [code]
file  connect4.c
file  connect4_timeout.c
file  connect6.c
file  connect6_timeout.c
file  connected.c
file  connectu.c
file  connectu_timeout.c
file  cork.c
file  getaddr4.c
file  getaddr6.c
file  ipv4.h [code]
file  ipv4_addr.c
file  ipv4_format.c
file  ipv4_scan.c
file  ipv6.h [code]
file  ipv6_addr.c
file  ipv6_format.c
file  ipv6_scan.c
file  linger.c
file  listen.c
file  notcpdelay.c
file  pairdgm.c
file  pairstr.c
file  recv4.c
file  recv6.c
file  recvfd.c
file  recvu.c
file  resolve.h [code]
file  resolve_error.c
file  resolve_ipv4addr.c
file  resolve_ipv4name.c
file  reuse.c
file  send4.c
file  send6.c
file  sendfd.c
file  sendu.c
file  setopt.c
file  shutdown.c
file  socket.h [code]
file  tcp4.c
file  tcp6.c
file  udp4.c
file  udp6.c
file  uncork.c
file  unixdgm.c
file  unixstr.c

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/group__resolve.html0000664000076400007640000002223211147311327017762 0ustar bruceguenter bglibs: resolve: Domain name resolution functions

resolve: Domain name resolution functions


Defines

#define RESOLVE_OK   0
#define RESOLVE_NOTFOUND   1
#define RESOLVE_NOADDR   2
#define RESOLVE_NSERROR   3
#define RESOLVE_TEMPFAIL   4
#define resolve_ipv4name(N, A)   resolve_ipv4name_n((N),(A),1)

Functions

const char * resolve_ipv4addr (const ipv4addr *addr)
int resolve_ipv4name_n (const char *name, ipv4addr *addr, int maxaddrs)
int resolve_error (void)

Define Documentation

#define resolve_ipv4name ( N,
 )     resolve_ipv4name_n((N),(A),1)

Compatibility macro for resolve_ipv4name_n

#define RESOLVE_NOADDR   2

Domain name exists, but has no address.

#define RESOLVE_NOTFOUND   1

Domain name not found.

#define RESOLVE_NSERROR   3

Non-recoverable name server error.

#define RESOLVE_OK   0

No error.

#define RESOLVE_TEMPFAIL   4

Temporary failure.


Function Documentation

int resolve_error ( void   ) 

Look up the last resolve error code.

const char* resolve_ipv4addr ( const ipv4addr addr  ) 

Look up the domain name corresponding to an IPv4 address.

int resolve_ipv4name_n ( const char *  name,
ipv4addr addr,
int  maxaddrs 
)

Look up the IPv4 address(es) corresponding to a domain name.


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/tab_l.gif0000664000076400007640000000130211147311327015605 0ustar bruceguenterGIF89a ,Õö÷ùñô÷öøúüýþúûüùúûøùúêïóïóöÆÕßÒÞæØâéÞçíÝæìåìñèîòô÷ùóöø³ÈÕÁÒÝËÙâÏÜäÖá薴ŹɯÂÍ»ÎÙÃÔÞÂÓÝÈ×àÌÚâÕáèÙäê×âèåìðëðó„°ÇÑÞåÜæëãëïëñôîóõ÷úûûüüÿÿÿþþþ, ,ÿ@–P±É`H$!%CqVe2X­ŠÌJ(“Ä +€˜3 2$ÀÆ ¼kvŠä-Ëçõu*…"}ã|}|~q(" $f„ 'Žl(Œ&&$r‘™ › & ! )¢¤›{¨£¥r­ª°©¯„±¯¬´¦·»º³®«§¾¶ÃÂÀ¿²¹ÇÄËÆ²ÌÉεҽͼ„ÔÈÓ×иÙÝÕÏÙÊâÜßãçæê¾äÛÅëÇíáîÖìéïøñ÷õüÑðåùü¤Pß?‚ƒœÇÛBm åAœÎáÀ†%V܈î!Çk÷Ø/áÄ;^¤¨²$Æ–#Mf)f͇(WÎL‰“æKçÒ„° ’I)L:eD ¡Cµ´x*4 U¨h  %A«£^ÁNKb¬Ùe§X±‚´k»x!ÁÖí—2tÝÖ !¯š5tÛæé—À]$¬´%ƒXíâ.i[¬]Y­•ÊfžEëõkg`µ††:zëçÒž;£}ºµj×aa‹–Mš¶é׸cçž½»vïÛºƒóî›8ðáÈ‹'?®¼9óç©G_>Ýyuè¬_ßž]zwêß­‡Ç¾º¼mîæµG~½ûôÞთ/ž>ùööÙ«Ïÿ¿ÿýÿÅà|ÖWà}v;bglibs-1.106/doc/html/tab_b.gif0000664000076400007640000000004311147311327015574 0ustar bruceguenterGIF89a€„°Ç,D;bglibs-1.106/doc/html/surf_8h-source.html0000664000076400007640000000652611147311327017614 0ustar bruceguenter bglibs: surf.h Source File

surf.h

00001 #ifndef BGLIBS__SURF__H__
00002 #define BGLIBS__SURF__H__
00003 
00004 #include <uint32.h>
00005 
00010 #define SURF_OUT_U32  8
00011 
00012 #define SURF_IN_U32   12
00013 
00014 #define SURF_SEED_U32 32
00015 
00017 #define SURF_OUT      32
00018 
00019 #define SURF_IN       48
00020 
00021 #define SURF_SEED     128
00022 
00023 void surf(uint32 out[8], const uint32 in[12], const uint32 seed[32]);
00024 
00027 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/group__adt__gqueue.html0000664000076400007640000003602711147311327020574 0ustar bruceguenter bglibs: adt gqueue: Generic simple queue.

adt gqueue: Generic simple queue.


Data Structures

struct  gqueue_node
struct  gqueue

Defines

#define GQUEUE_DECL(PREFIX, TYPE)
#define GQUEUE_PUSH_DEFN(PREFIX, TYPE, COPY)
#define GQUEUE_TOP_DEFN(PREFIX, TYPE)
#define GQUEUE_POP_DEFN(PREFIX, FREE)
#define GQUEUE_DEFN(PREFIX, TYPE, COPY, FREE)

Functions

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)

Detailed Description

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.

Define Documentation

#define GQUEUE_DECL ( PREFIX,
TYPE   ) 

Value:

extern int PREFIX##_push(struct gqueue* q, TYPE const* data); \
extern TYPE* PREFIX##_top(struct gqueue* q); \
extern void PREFIX##_pop(struct gqueue* q);
Declare specialized gqueue functions.
Examples:
adt/gqueue_test.c.

#define GQUEUE_DEFN ( PREFIX,
TYPE,
COPY,
FREE   ) 

Value:

GQUEUE_PUSH_DEFN(PREFIX,TYPE,COPY) \
GQUEUE_TOP_DEFN(PREFIX,TYPE) \
GQUEUE_POP_DEFN(PREFIX,FREE)
Define all the specialized gqueue functions. If COPY is NULL, a simple memcpy is used instead. If FREE is NULL, no attempt is made to free the data.
Examples:
adt/gqueue_test.c.

#define GQUEUE_POP_DEFN ( PREFIX,
FREE   ) 

Value:

void PREFIX##_pop(struct gqueue* q) { \
  gqueue_pop(q, (adt_free_fn*)(FREE)); \
}
Define a specialized gqueue pop function.

#define GQUEUE_PUSH_DEFN ( PREFIX,
TYPE,
COPY   ) 

Value:

int PREFIX##_push(struct gqueue* q, TYPE const* data) { \
  return gqueue_push(q, sizeof *data, data, (adt_copy_fn*)COPY); \
}
Define a specialized gqueue push function.

#define GQUEUE_TOP_DEFN ( PREFIX,
TYPE   ) 

Value:

TYPE* PREFIX##_top(struct gqueue* q) { \
  return (q->head == 0) ? 0 : (TYPE*)q->head->data; \
}
Define a specialized gqueue top function.


Function Documentation

void gqueue_pop ( struct gqueue q,
adt_free_fn fn 
)

Remove the first (least recently pushed) element from the queue. If the free function fn is NULL no data freeing is done. Note that this does not return a pointer to the popped item, as once the item has been popped it is also freed.

int gqueue_push ( struct gqueue q,
unsigned  datasize,
const void *  data,
adt_copy_fn fn 
)

Add a new element onto the queue. If the copy function fn is NULL memcpy is used in its place.

void* gqueue_top ( const struct gqueue q  ) 

Return the address of first (least recently pushed) element in the queue.


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/structghashiter.html0000664000076400007640000001102211147311327020146 0ustar bruceguenter bglibs: ghashiter Struct Reference

ghashiter Struct Reference
[adt ghash: Generic hash tables.]

#include <ghash.h>


Data Fields

struct ghashghashp
unsigned index
void * entry


Detailed Description

The iterator data necessary to loop over a ghash table.
Examples:

adt/ghash_test.c.


Field Documentation

struct ghash* ghashiter::ghashp [read]

A pointer to the source ghash table.

unsigned ghashiter::index

The index of the current entry.

A pointer to the current entry, for convenience.


The documentation for this struct was generated from the following file:
Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/dir_28609d2f6b17322077df409bed0e8d02.html0000664000076400007640000002316111147311327022006 0ustar bruceguenter bglibs: iobuf/ Directory Reference

iobuf Directory Reference


Files

file  iobuf/common.h [code]
file  ibuf.h [code]
file  ibuf_copytofd.c
file  ibuf_getc.c
file  ibuf_getnetstring.c
file  ibuf_gets.c
file  ibuf_getstr.c
file  ibuf_getstr_crlf.c
file  ibuf_getu.c
file  ibuf_init.c
file  ibuf_open.c
file  ibuf_openreadclose.c
file  ibuf_peek.c
file  ibuf_read.c
file  ibuf_readall.c
file  ibuf_refill.c
file  ibuf_seek.c
file  ibuf_status.c
file  ibuf_stdin.c
file  ibuf_tell.c
file  iobuf.h [code]
file  iobuf_close.c
file  iobuf_copy.c
file  iobuf_init.c
file  iobuf_timeout.c
file  obuf.h [code]
file  obuf_close.c
file  obuf_copyfromfd.c
file  obuf_digits.c
file  obuf_endl.c
file  obuf_flush.c
file  obuf_init.c
file  obuf_open.c
file  obuf_pad.c
file  obuf_put2s.c
file  obuf_put3s.c
file  obuf_put4s.c
file  obuf_put5s.c
file  obuf_put6s.c
file  obuf_put7s.c
file  obuf_putc.c
file  obuf_putf.c
file  obuf_putnetstring.c
file  obuf_putns.c
file  obuf_putsflush.c
file  obuf_putsllnumw.c
file  obuf_putsnumw.c
file  obuf_putullnumw.c
file  obuf_putunumw.c
file  obuf_seek.c
file  obuf_sign_pad.c
file  obuf_stderr.c
file  obuf_stdout.c
file  obuf_sync.c
file  obuf_write.c

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/adt_2gqueue__test_8c-example.html0000664000076400007640000000532211147311327022357 0ustar bruceguenter bglibs: adt/gqueue_test.c

adt/gqueue_test.c

#include <stdlib.h>
#include <string.h>

#include "gqueue.h"

#ifdef SELFTEST_MAIN
#include "selftest.c"

GQUEUE_DECL(test,int);
GQUEUE_DEFN(test,int,0,0);
static struct gqueue queue;

MAIN
{
  int i;
  int* p;
  for (i = 0; i < 4; ++i)
    debugfn(test_push(&queue, &i));
  while ((p = test_top(&queue)) != 0) {
    obuf_puti(&outbuf, *p); NL();
    test_pop(&queue);
  }
}

#endif
#ifdef SELFTEST_EXP
result=1
result=1
result=1
result=1
0
1
2
3
#endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/adt_2ghash__test_8c-example.html0000664000076400007640000002316511147311327022163 0ustar bruceguenter bglibs: adt/ghash_test.c

adt/ghash_test.c

#include <stdlib.h>
#include <string.h>

#include "ghash.h"

#ifdef SELFTEST_MAIN
#include "selftest.c"

static struct ghash dict;
GHASH_DECL(test,const char*,int);
GHASH_DEFN(test,const char*,int,adt_hashsp,adt_cmpsp,adt_copysp,0,adt_freesp,0);

static void print(struct test_entry* entry)
{
  obuf_putf(&outbuf, "{[}s{] = }i{\n}", entry->key, entry->data);
}

const char* keys[] = {
  "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
  "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
  0
};

static void testkeys(void)
{
  int i;
  struct test_entry* p;
  for (i = 0; keys[i] != 0; ++i) {
    if ((p = test_get(&dict, &keys[i])) == 0)
      obuf_putf(&outbuf, "{Could not locate key [}s{]\n}", keys[i]);
    else if (p->data != i)
      obuf_putf(&outbuf,
                "{Result for key [}s{] is wrong (was }d{ should be }d{)\n}",
                keys[i], p->data, i);
  }
}

MAIN
{
  int i;
  struct test_entry* p;
  struct ghashiter iter;

  test_init(&dict);
  obuf_putf(&outbuf, "{size=}d{ count=}d{\n}", dict.size, dict.count);

  for (i = 0; keys[i] != 0; ++i) {
    test_add(&dict, &keys[i], &i);
    obuf_putf(&outbuf, "{size=}d{ count=}d{\n}", dict.size, dict.count);
  }

  testkeys();

  test_foreach(&dict, print);

  ghash_remove(&dict, &keys[1]);
  ghash_remove(&dict, &keys[11]);
  ghash_remove(&dict, &keys[24]);
  testkeys();

  i = 1010;
  if ((p = ghash_set(&dict, &keys[10], &i)) != 0)
    obuf_putf(&outbuf, "{Set [}s{] to }d{\n}", p->key, p->data);
  i = 1020;
  if ((p = ghash_set(&dict, &keys[20], &i)) != 0)
    obuf_putf(&outbuf, "{Set [}s{] to }d{\n}", p->key, p->data);

  ghashiter_loop(&iter, &dict) {
    p = iter.entry;
    obuf_putf(&outbuf, "{[}s{] = }i{\n}", p->key, p->data);
  }

  test_free(&dict);
}
#endif
#ifdef SELFTEST_EXP
size=0 count=0
size=31 count=1
size=31 count=2
size=31 count=3
size=31 count=4
size=31 count=5
size=31 count=6
size=31 count=7
size=31 count=8
size=31 count=9
size=31 count=10
size=31 count=11
size=31 count=12
size=31 count=13
size=31 count=14
size=31 count=15
size=61 count=16
size=61 count=17
size=61 count=18
size=61 count=19
size=61 count=20
size=61 count=21
size=61 count=22
size=61 count=23
size=61 count=24
size=61 count=25
size=61 count=26
[e] = 4
[d] = 3
[g] = 6
[f] = 5
[a] = 0
[c] = 2
[b] = 1
[m] = 12
[l] = 11
[o] = 14
[n] = 13
[i] = 8
[h] = 7
[k] = 10
[j] = 9
[u] = 20
[t] = 19
[w] = 22
[v] = 21
[q] = 16
[p] = 15
[s] = 18
[r] = 17
[y] = 24
[x] = 23
[z] = 25
Could not locate key [b]
Could not locate key [l]
Could not locate key [y]
Set [k] to 1010
Set [u] to 1020
[e] = 4
[d] = 3
[g] = 6
[f] = 5
[a] = 0
[c] = 2
[m] = 12
[o] = 14
[n] = 13
[i] = 8
[h] = 7
[k] = 1010
[j] = 9
[u] = 1020
[t] = 19
[w] = 22
[v] = 21
[q] = 16
[p] = 15
[s] = 18
[r] = 17
[x] = 23
[z] = 25
#endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/ghash_8h-source.html0000664000076400007640000006342611147311327017731 0ustar bruceguenter bglibs: ghash.h Source File

ghash.h

00001 #ifndef BGLIBS__GENERIC_HASH__H__
00002 #define BGLIBS__GENERIC_HASH__H__
00003 
00004 #include <adt/common.h>
00005 
00025 struct ghash
00026 {
00029   void** table;
00031   unsigned count;
00033   unsigned size;
00034 
00036   unsigned long keysize;
00038   unsigned long entrysize;
00039 
00041   adt_hash_fn* hashfn;
00043   adt_cmp_fn* keycmp;
00045   adt_copy_fn* keycopy;
00047   adt_copy_fn* datacopy;
00049   adt_free_fn* keyfree;
00051   adt_free_fn* datafree;
00052 };
00053 
00055 #define ghash_entry_hash(P) (*(adt_hash_t*)(P))
00056 
00057 #define ghash_entry_keyptr(P) ((P)+sizeof(adt_hash_t))
00058 
00060 #define ghash_entry_dataptr(P,L) ((P)+sizeof(adt_hash_t)+(L))
00061 
00063 #define ghash_hashb adt_hashb
00064 
00065 #define ghash_hashs adt_hashs
00066 
00067 #define ghash_hashsp adt_hashsp
00068 
00069 void ghash_insert(struct ghash* d, void* e);
00070 void* ghash_add(struct ghash* d, const void* key, const void* data);
00071 void* ghash_set(struct ghash* d, const void* key, const void* data);
00072 void ghash_free(struct ghash* d);
00073 void** ghash_find(struct ghash* d, const void* key);
00074 void* ghash_get(struct ghash* d, const void* key);
00075 void ghash_init(struct ghash* d,
00076                 unsigned long keysize,
00077                 unsigned long entrysize,
00078                 adt_hash_fn* hashfn,
00079                 adt_cmp_fn* keycmp,
00080                 adt_copy_fn* keycopy,
00081                 adt_copy_fn* datacopy,
00082                 adt_free_fn* keyfree,
00083                 adt_free_fn* datafree);
00084 int ghash_rebuild(struct ghash* d);
00085 int ghash_rehash(struct ghash* d);
00086 int ghash_remove(struct ghash* d, const void* key);
00087 void ghash_foreach(struct ghash* d, void (*fn)(void* entry));
00088 void* ghash_search(struct ghash* d, int (*fn)(const void* entry));
00089 
00092 #define GHASH_STRUCT_ENTRY(PREFIX,KTYPE,DTYPE) \
00093 struct PREFIX##_entry { \
00094   adt_hash_t hash; \
00095   KTYPE key; \
00096   DTYPE data; \
00097 }
00098 
00100 #define GHASH_KEYOFFSET(PREFIX) ((unsigned long)&((struct PREFIX##_entry*)0)->key)
00101 
00102 #define GHASH_DATAOFFSET(PREFIX) ((unsigned long)&((struct PREFIX##_entry*)0)->data)
00103 
00104 #define GHASH_KEYSIZE(PREFIX) ( \
00105   GHASH_DATAOFFSET(PREFIX)-GHASH_KEYOFFSET(PREFIX) \
00106 )
00107 
00110 #define GHASH_DECL(PREFIX,KTYPE,DTYPE) \
00111 GHASH_STRUCT_ENTRY(PREFIX,KTYPE,DTYPE); \
00112 extern void PREFIX##_init(struct ghash* d); \
00113 extern void PREFIX##_free(struct ghash* d); \
00114 extern struct PREFIX##_entry* PREFIX##_add(struct ghash* d, \
00115                                            KTYPE const* key, \
00116                                            DTYPE const* data); \
00117 extern struct PREFIX##_entry* PREFIX##_set(struct ghash* d, \
00118                                            KTYPE const* key, \
00119                                            DTYPE const* data); \
00120 extern struct PREFIX##_entry* PREFIX##_get(struct ghash* d, \
00121                                            KTYPE const* key); \
00122 extern int PREFIX##_rebuild(struct ghash* d); \
00123 extern int PREFIX##_rehash(struct ghash* d); \
00124 extern int PREFIX##_remove(struct ghash* d, KTYPE const* key); \
00125 extern void PREFIX##_foreach(struct ghash* d, \
00126                              void (*fn)(struct PREFIX##_entry*)); \
00127 extern struct PREFIX##_entry* PREFIX##_search(struct ghash* d, \
00128                                               int (*fn)(const struct PREFIX##_entry*));
00129 
00131 #define GHASH_INIT_DEFN(PREFIX,KTYPE,DTYPE,HASHFN,CMP,KCOPY,DCOPY,KFREE,DFREE)\
00132 void PREFIX##_init(struct ghash* d) { \
00133   ghash_init(d, \
00134              GHASH_KEYSIZE(PREFIX), \
00135              sizeof(struct PREFIX##_entry), \
00136              (adt_hash_fn*)HASHFN, \
00137              (adt_cmp_fn*)CMP, \
00138              (adt_copy_fn*)KCOPY, \
00139              (adt_copy_fn*)DCOPY, \
00140              (adt_free_fn*)KFREE, \
00141              (adt_free_fn*)DFREE); \
00142 }
00143 
00145 #define GHASH_FREE_DEFN(PREFIX) \
00146 void PREFIX##_free(struct ghash* d) { \
00147   ghash_free(d); \
00148 }
00149 
00151 #define GHASH_ADD_DEFN(PREFIX,KTYPE,DTYPE) \
00152 struct PREFIX##_entry* PREFIX##_add(struct ghash* d, \
00153                                     KTYPE const* key, DTYPE const* data) { \
00154   return ghash_add(d, key, data); \
00155 }
00156 
00158 #define GHASH_SET_DEFN(PREFIX,KTYPE,DTYPE) \
00159 struct PREFIX##_entry* PREFIX##_set(struct ghash* d, \
00160                                     KTYPE const* key, DTYPE const* data) { \
00161   return ghash_set(d, key, data); \
00162 }
00163 
00165 #define GHASH_GET_DEFN(PREFIX,KTYPE) \
00166 struct PREFIX##_entry* PREFIX##_get(struct ghash* d, KTYPE const* key) { \
00167   return ghash_get(d, key); \
00168 }
00169 
00171 #define GHASH_REBUILD_DEFN(PREFIX) \
00172 int PREFIX##_rebuild(struct ghash* d) { \
00173   return ghash_rebuild(d); \
00174 }
00175 
00177 #define GHASH_REHASH_DEFN(PREFIX) \
00178 int PREFIX##_rehash(struct ghash* d) { \
00179   return ghash_rehash(d); \
00180 }
00181 
00183 #define GHASH_REMOVE_DEFN(PREFIX,KTYPE) \
00184 extern int PREFIX##_remove(struct ghash* d, KTYPE const* key) { \
00185   return ghash_remove(d, (void*)key); \
00186 }
00187 
00189 #define GHASH_FOREACH_DEFN(PREFIX) \
00190 void PREFIX##_foreach(struct ghash* d, void (*fn)(struct PREFIX##_entry*)) { \
00191   ghash_foreach(d, (void (*)(void*))fn); \
00192 }
00193 
00195 #define GHASH_SEARCH_DEFN(PREFIX) \
00196 struct PREFIX##_entry* PREFIX##_search(struct ghash* d, int (*fn)(const struct PREFIX##_entry*)) { \
00197   return ghash_search(d, (int (*)(const void*))fn); \
00198 }
00199 
00204 #define GHASH_DEFN(PREFIX,KTYPE,DTYPE,HASHFN,CMPFN,KCOPY,DCOPY,KFREE,DFREE) \
00205 GHASH_INIT_DEFN(PREFIX,KTYPE,DTYPE,HASHFN,CMPFN,KCOPY,DCOPY,KFREE,DFREE) \
00206 GHASH_FREE_DEFN(PREFIX) \
00207 GHASH_ADD_DEFN(PREFIX,KTYPE,DTYPE) \
00208 GHASH_SET_DEFN(PREFIX,KTYPE,DTYPE) \
00209 GHASH_GET_DEFN(PREFIX,KTYPE) \
00210 GHASH_REBUILD_DEFN(PREFIX) \
00211 GHASH_REHASH_DEFN(PREFIX) \
00212 GHASH_REMOVE_DEFN(PREFIX,KTYPE) \
00213 GHASH_FOREACH_DEFN(PREFIX) \
00214 GHASH_SEARCH_DEFN(PREFIX)
00215 
00217 struct ghashiter
00218 {
00220   const struct ghash* ghashp;
00222   unsigned index;
00224   void* entry;
00225 };
00226 
00227 void ghashiter_first(struct ghashiter*, const struct ghash*);
00228 int ghashiter_valid(const struct ghashiter*);
00229 void ghashiter_next(struct ghashiter*);
00232 #define ghashiter_loop(I,G) \
00233   for(ghashiter_first(I,G);ghashiter_valid(I);ghashiter_next(I))
00234 
00237 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/group__obuf.html0000664000076400007640000025252311147311327017246 0ustar bruceguenter bglibs: obuf: Output Buffer Management

obuf: Output Buffer Management


Data Structures

struct  obuf

Defines

#define OBUF_CREATE   O_CREAT
#define OBUF_EXCLUSIVE   O_EXCL
#define OBUF_TRUNCATE   O_TRUNC
#define OBUF_APPEND   O_APPEND
#define obuf_error(out)   iobuf_error(&(out)->io)
#define obuf_closed(out)   iobuf_closed(&(out)->io)
#define obuf_timedout(out)   iobuf_timedout(&((out)->io))
#define obuf_rewind(out)   obuf_seek(out,0)
#define obuf_tell(out)   ((out)->io.offset+(out)->bufpos)
#define obuf_puts(out, str)   obuf_write(out,str,strlen(str))
#define obuf_putstr(out, str)   obuf_write(out,(str)->s,(str)->len)

Typedefs

typedef int(* obuf_fn )(int, const void *, unsigned long)
typedef struct obuf obuf

Functions

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)
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)
int obuf_pad (obuf *out, unsigned width, char ch)
int obuf_endl (obuf *out)
int obuf_putc (obuf *out, char ch)
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)
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)

Variables

obuf outbuf
obuf errbuf
const char obuf_dec_digits [10]
const char obuf_hex_lcase_digits [16]
const char obuf_hex_ucase_digits [16]

Detailed Description

Calling Convention
Unless otherwise specified, the return value is non-zero (true) if the entire requested operation completed, and 0 (false) otherwise.

Define Documentation

#define OBUF_APPEND   O_APPEND

All writes go to the end of the file.

#define obuf_closed ( out   )     iobuf_closed(&(out)->io)

Test if the obuf has been closed.

#define OBUF_CREATE   O_CREAT

Create the file if it does not already exist.

#define obuf_error ( out   )     iobuf_error(&(out)->io)

Test if the obuf is in an error state.

#define OBUF_EXCLUSIVE   O_EXCL

If OBUF_CREATE is set, fail to create the file if it already exists.

#define obuf_puts ( out,
str   )     obuf_write(out,str,strlen(str))

Write a C string to the obuf

#define obuf_putstr ( out,
str   )     obuf_write(out,(str)->s,(str)->len)

Write a dynamic string to the iobuf

#define obuf_rewind ( out   )     obuf_seek(out,0)

Set the effective write position to the start of the file.

#define obuf_tell ( out   )     ((out)->io.offset+(out)->bufpos)

Look up the current effective write position.

#define obuf_timedout ( out   )     iobuf_timedout(&((out)->io))

Test if the last obuf write timed out.

#define OBUF_TRUNCATE   O_TRUNC

If the file exists, truncate it to length 0.


Typedef Documentation

typedef struct obuf obuf

Output specific buffer typedef.

typedef int(* obuf_fn)(int, const void *, unsigned long)

obuf write function pointer prototype.


Function Documentation

int obuf_close ( obuf out  ) 

Flush and close the obuf

int obuf_endl ( obuf out  ) 

Write a newline to the obuf and flush it.

int obuf_flush ( obuf out  ) 

Write all pending data in the obuf to the file descriptor.

int obuf_init ( obuf out,
int  fd,
obuf_fn  fn,
unsigned  flags,
unsigned  bufsize 
)

Initialize an obuf from an already-opened file descriptor.

int obuf_open ( obuf out,
const char *  filename,
int  oflags,
int  mode,
unsigned  bufsize 
)

Initialize an obuf by opening a file for writing.

int obuf_pad ( obuf out,
unsigned  width,
char  ch 
)

Pad the output with width instances of the single character ch.

int obuf_put2s ( obuf out,
const char *  s1,
const char *  s2 
)

Write 2 C strings to the obuf

int obuf_put3s ( obuf out,
const char *  s1,
const char *  s2,
const char *  s3 
)

Write 3 C strings to the obuf

int obuf_put4s ( obuf out,
const char *  s1,
const char *  s2,
const char *  s3,
const char *  s4 
)

Write 4 C strings to the obuf

int obuf_put5s ( obuf out,
const char *  s1,
const char *  s2,
const char *  s3,
const char *  s4,
const char *  s5 
)

Write 5 C strings to the obuf

int obuf_put6s ( obuf out,
const char *  s1,
const char *  s2,
const char *  s3,
const char *  s4,
const char *  s5,
const char *  s6 
)

Write 6 C strings to the 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 
)

Write 7 C strings to the obuf

int obuf_putc ( obuf out,
char  ch 
)

Write a single character to the obuf

int obuf_putf ( obuf out,
const char *  format,
  ... 
)

Write a formatted string using fmt_multi from variable arguments

Examples:
adt/ghash_test.c.

int obuf_putfv ( obuf out,
const char *  format,
va_list  ap 
)

Write a formatted string using fmt_multi from a va_list

int obuf_puti ( obuf out,
long  data 
)

Write a signed integer as decimal to the obuf.

Examples:
adt/gqueue_test.c, and adt/gstack_test.c.

int obuf_putill ( obuf out,
long long  data 
)

Write a signed long long integer as decimal to the obuf.

int obuf_putiw ( obuf out,
long  data,
unsigned  width,
char  pad 
)

Write a signed integer as decimal to the obuf with padding.

int obuf_putiwll ( obuf out,
long long  data,
unsigned  width,
char  pad 
)

Write a signed long long integer as decimal to the obuf with padding.

int obuf_putnetstring ( obuf out,
const char *  data,
unsigned  datalen 
)

Write the binary block to the obuf as a "netstring".

int obuf_putns ( obuf out,
unsigned int  count,
  ... 
)

Write N C strings to the obuf

int obuf_putsflush ( obuf out,
const char *  str 
)

Write a C string to the obuf and flush it.

int obuf_putsllnumw ( obuf out,
long long  data,
unsigned  width,
char  pad,
unsigned  base,
const char *  digits 
)

Write a signed long long integer to the obuf with optional padding.

int obuf_putsnumw ( obuf out,
long  data,
unsigned  width,
char  pad,
unsigned  base,
const char *  digits 
)

Write a signed integer to the obuf with optional padding.

int obuf_putu ( obuf out,
unsigned long  data 
)

Write an unsigned integer as decimal to the obuf.

int obuf_putull ( obuf out,
unsigned long long  data 
)

Write an unsigned long long integer as decimal to the obuf.

int obuf_putullnumw ( obuf out,
unsigned long long  data,
unsigned  width,
char  pad,
unsigned  base,
const char *  digits 
)

Write an unsigned long long integer to the obuf with optional padding.

int obuf_putunumw ( obuf out,
unsigned long  data,
unsigned  width,
char  pad,
unsigned  base,
const char *  digits 
)

Write an unsigned integer to the obuf with optional padding.

int obuf_putuw ( obuf out,
unsigned long  data,
unsigned  width,
char  pad 
)

Write an unsigned integer as decimal to the obuf with padding.

int obuf_putuwll ( obuf out,
unsigned long long  data,
unsigned  width,
char  pad 
)

Write an unsigned long long integer as decimal to the obuf with padding.

int obuf_putX ( obuf out,
unsigned long  data 
)

Write an unsigned integer as (upper-case) hexadecimal to the obuf.

int obuf_putx ( obuf out,
unsigned long  data 
)

Write an unsigned integer as (lower-case) hexadecimal to the obuf.

int obuf_putXll ( obuf out,
unsigned long long  data 
)

Write an unsigned long long integer as (upper-case) hexadecimal to the obuf.

int obuf_putxll ( obuf out,
unsigned long long  data 
)

Write an unsigned long long integer as (lower-case) hexadecimal to the obuf.

int obuf_putXw ( obuf out,
unsigned long  data,
unsigned  width,
char  pad 
)

Write an unsigned integer as (upper-case) hexadecimal to the obuf with padding.

int obuf_putxw ( obuf out,
unsigned long  data,
unsigned  width,
char  pad 
)

Write an unsigned integer as (lower-case) hexadecimal to the obuf with padding.

int obuf_putXwll ( obuf out,
unsigned long long  data,
unsigned  width,
char  pad 
)

Write an unsigned long long integer as (upper-case) hexadecimal to the obuf with padding.

int obuf_putxwll ( obuf out,
unsigned long long  data,
unsigned  width,
char  pad 
)

Write an unsigned long long integer as (lower-case) hexadecimal to the obuf with padding.

int obuf_seek ( obuf out,
unsigned  offset 
)

Set the effective write position.

int obuf_sign_pad ( obuf out,
int  sign,
unsigned  width,
char  pad 
)

Pad the output with width instances of the single character ch, preceded by an optional negative sign at an appropriate place.

If the pad character is '0' then any negative sign is placed as the first character, followed by padding. Otherwise, it is preceded by the padding.

int obuf_sync ( obuf out  ) 

Flush the obuf and then fsync the file descriptor.

int obuf_write ( obuf out,
const char *  data,
unsigned  datalen 
)

Write a block of data to the obuf

int obuf_write_large ( obuf out,
const char *  data,
unsigned  datalen 
)

Write a large block of data to the obuf, avoiding copying.


Variable Documentation

Output buffer for stderr

Output buffer for stdout

Examples:
adt/ghash_test.c, adt/gqueue_test.c, and adt/gstack_test.c.


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/dir_3fb7bf5367cadb161b081662ce57c8a3.html0000664000076400007640000001315111147311327022222 0ustar bruceguenter bglibs: adt/ Directory Reference

adt Directory Reference


Files

file  adt_sp.c
file  adt/common.h [code]
file  ghash.h [code]
file  ghash_add.c
file  ghash_foreach.c
file  ghash_free.c
file  ghash_get.c
file  ghash_init.c
file  ghash_insert.c
file  ghash_iter.c
file  ghash_rebuild.c
file  ghash_rehash.c
file  ghash_remove.c
file  ghash_search.c
file  ghash_set.c
file  ghash_test.c
file  gqueue.h [code]
file  gqueue_pop.c
file  gqueue_push.c
file  gqueue_test.c
file  gqueue_top.c
file  gstack.h [code]
file  gstack_pop.c
file  gstack_push.c
file  gstack_test.c
file  gstack_top.c
file  hashb.c
file  hashs.c

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/md4_8h-source.html0000664000076400007640000003421711147311327017317 0ustar bruceguenter bglibs: md4.h Source File

md4.h

00001 /* Declaration of functions and data types used for MD4 hash computing
00002    library functions.
00003    Copyright (C) 2000,2002,2005 Bruce Guenter.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public License as
00007    published by the Free Software Foundation; either version 2 of the
00008    License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public
00016    License along with the GNU C Library; see the file COPYING.LIB.  If not,
00017    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, USA.  */
00019 
00020 #ifndef _MD4_H
00021 #define _MD4_H 1
00022 
00023 #include <stdio.h>
00024 
00025 #if defined HAVE_LIMITS_H || _LIBC
00026 # include <limits.h>
00027 #endif
00028 
00029 /* The following contortions are an attempt to use the C preprocessor
00030    to determine an unsigned integral type that is 32 bits wide.  An
00031    alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
00032    doing that would require that the configure script compile and *run*
00033    the resulting executable.  Locally running cross-compiled executables
00034    is usually not possible.  */
00035 
00036 #ifdef _LIBC
00037 # include <sys/types.h>
00038 typedef u_int32_t md4_uint32;
00039 #else
00040 # if defined __STDC__ && __STDC__
00041 #  define UINT_MAX_32_BITS 4294967295U
00042 # else
00043 #  define UINT_MAX_32_BITS 0xFFFFFFFF
00044 # endif
00045 
00046 /* If UINT_MAX isn't defined, assume it's a 32-bit type.
00047    This should be valid for all systems GNU cares about because
00048    that doesn't include 16-bit systems, and only modern systems
00049    (that certainly have <limits.h>) have 64+-bit integral types.  */
00050 
00051 # ifndef UINT_MAX
00052 #  define UINT_MAX UINT_MAX_32_BITS
00053 # endif
00054 
00055 # if UINT_MAX == UINT_MAX_32_BITS
00056    typedef unsigned int md4_uint32;
00057 # else
00058 #  if USHRT_MAX == UINT_MAX_32_BITS
00059     typedef unsigned short md4_uint32;
00060 #  else
00061 #   if ULONG_MAX == UINT_MAX_32_BITS
00062      typedef unsigned long md4_uint32;
00063 #   else
00064      /* The following line is intended to evoke an error.
00065         Using #error is not portable enough.  */
00066      "Cannot determine unsigned 32-bit data type."
00067 #   endif
00068 #  endif
00069 # endif
00070 #endif
00071 
00072 #undef __P
00073 #if defined (__STDC__) && __STDC__
00074 # define __P(x) x
00075 #else
00076 # define __P(x) ()
00077 #endif
00078 
00079 /* Structure to save state of computation between the single steps.  */
00080 struct md4_ctx
00081 {
00082   md4_uint32 A;
00083   md4_uint32 B;
00084   md4_uint32 C;
00085   md4_uint32 D;
00086 
00087   md4_uint32 total[2];
00088   md4_uint32 buflen;
00089   char buffer[64];
00090 };
00091 typedef struct md4_ctx MD4_CTX;
00092 
00093 /*
00094  * The following three functions are build up the low level used in
00095  * the functions `md4_stream' and `md4_buffer'.
00096  */
00097 
00098 /* Initialize structure containing state of computation.
00099    (RFC 1320, 3.3: Step 3)  */
00100 extern void md4_init_ctx __P ((struct md4_ctx *ctx));
00101 
00102 /* Starting with the result of former calls of this function (or the
00103    initialization function update the context for the next LEN bytes
00104    starting at BUFFER.
00105    It is necessary that LEN is a multiple of 64!!! */
00106 extern void md4_process_block __P ((const void *buffer, struct md4_ctx *ctx));
00107 
00108 /* Starting with the result of former calls of this function (or the
00109    initialization function update the context for the next LEN bytes
00110    starting at BUFFER.
00111    It is NOT required that LEN is a multiple of 64.  */
00112 extern void md4_process_bytes __P ((const void *buffer, size_t len,
00113                                     struct md4_ctx *ctx));
00114 
00115 /* Process the remaining bytes in the buffer and put result from CTX
00116    in first 16 bytes following RESBUF.  The result is always in little
00117    endian byte order, so that a byte-wise output yields to the wanted
00118    ASCII representation of the message digest.
00119 
00120    IMPORTANT: On some systems it is required that RESBUF is correctly
00121    aligned for a 32 bits value.  */
00122 extern void *md4_finish_ctx __P ((struct md4_ctx *ctx, void *resbuf));
00123 
00124 
00125 /* Put result from CTX in first 16 bytes following RESBUF.  The result is
00126    always in little endian byte order, so that a byte-wise output yields
00127    to the wanted ASCII representation of the message digest.
00128 
00129    IMPORTANT: On some systems it is required that RESBUF is correctly
00130    aligned for a 32 bits value.  */
00131 extern void *md4_read_ctx __P ((const struct md4_ctx *ctx, void *resbuf));
00132 
00133 #endif /* md4.h */

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/gstack_8h-source.html0000664000076400007640000001665611147311327020116 0ustar bruceguenter bglibs: gstack.h Source File

gstack.h

00001 #ifndef BGLIBS__GENERIC_STACK__H__
00002 #define BGLIBS__GENERIC_STACK__H__
00003 
00004 #include <adt/common.h>
00005 
00020 struct gstack_node
00021 {
00023   struct gstack_node* next;
00025   char data[0];
00026 };
00027 
00029 struct gstack
00030 {
00032   struct gstack_node* head;
00034   unsigned count;
00035 };
00036 
00037 int gstack_push(struct gstack* d, unsigned datasize, const void* data,
00038                 adt_copy_fn* fn);
00039 void* gstack_top(const struct gstack* s);
00040 void gstack_pop(struct gstack* s, adt_free_fn* fn);
00041 
00043 #define GSTACK_DECL(PREFIX,TYPE) \
00044 extern int PREFIX##_push(struct gstack* s, TYPE const* data); \
00045 extern TYPE* PREFIX##_top(struct gstack* s); \
00046 extern void PREFIX##_pop(struct gstack* s);
00047 
00049 #define GSTACK_PUSH_DEFN(PREFIX,TYPE,COPY) \
00050 int PREFIX##_push(struct gstack* s, TYPE const* data) { \
00051   return gstack_push(s, sizeof *data, data, (adt_copy_fn*)COPY); \
00052 }
00053 
00055 #define GSTACK_TOP_DEFN(PREFIX,TYPE) \
00056 TYPE* PREFIX##_top(struct gstack* s) { \
00057   return (s->head == 0) ? 0 : (TYPE*)s->head->data; \
00058 }
00059 
00061 #define GSTACK_POP_DEFN(PREFIX,FREE) \
00062 void PREFIX##_pop(struct gstack* s) { \
00063   gstack_pop(s, (adt_free_fn*)(FREE)); \
00064 }
00065 
00069 #define GSTACK_DEFN(PREFIX,TYPE,COPY,FREE) \
00070 GSTACK_PUSH_DEFN(PREFIX,TYPE,COPY) \
00071 GSTACK_TOP_DEFN(PREFIX,TYPE) \
00072 GSTACK_POP_DEFN(PREFIX,FREE)
00073 
00076 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/ipv6_8h-source.html0000664000076400007640000000770311147311327017517 0ustar bruceguenter bglibs: ipv6.h Source File

ipv6.h

00001 #ifndef NET__IPV6__H__
00002 #define NET__IPV6__H__
00003 
00004 #include <sysdeps.h>
00005 
00011 typedef struct {
00013   uint8 addr[16];
00014 } ipv6addr;
00016 typedef uint16 ipv6port;
00017 
00018 extern const ipv6addr IPV6ADDR_ANY;
00019 extern const ipv6addr IPV6ADDR_LOOPBACK;
00020 
00021 extern const char* ipv6_scan(const char* s, ipv6addr* addr);
00022 extern const char* ipv6_format(const ipv6addr* addr);
00023 extern unsigned fmt_ipv6addr(char* buffer, const ipv6addr* addr);
00024 
00027 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/cmsg_8h-source.html0000664000076400007640000000736511147311327017570 0ustar bruceguenter bglibs: cmsg.h Source File

cmsg.h

00001 #ifndef BGLIBS__NET__CMSG__H__
00002 #define BGLIBS__NET__CMSG__H__
00003 
00004 #ifdef SOLARIS
00005 #define _XOPEN_SOURCE 500
00006 #endif
00007 
00008 #include <sys/socket.h>
00009 
00010 #ifndef MSG_NOSIGNAL
00011 #define MSG_NOSIGNAL 0
00012 #endif
00013 
00014 #ifndef CMSG_ALIGN
00015 #define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \
00016                          & (size_t) ~(sizeof (size_t) - 1))
00017 #endif
00018 
00019 #ifndef CMSG_SPACE
00020 #define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len))
00021 #endif
00022 
00023 #ifndef CMSG_LEN
00024 #define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
00025 #endif
00026 
00027 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/installer_8h-source.html0000664000076400007640000001077011147311327020626 0ustar bruceguenter bglibs: installer.h Source File

installer.h

00001 #ifndef SPAC__INSTALLER__H__
00002 #define SPAC__INSTALLER__H__
00003 
00021 extern const char* install_prefix;
00022 
00025 int opendir(const char* dir);
00026 
00028 int opensubdir(int dir, const char* subdir);
00029 
00031 int d(int dir, const char* subdir,
00032       unsigned uid, unsigned gid, unsigned mode);
00033 
00035 void cf(int dir, const char* file, unsigned uid, unsigned gid, unsigned mode,
00036         const char* srcfile);
00037 
00039 void c(int dir, const char* file, unsigned uid, unsigned gid, unsigned mode);
00040 
00042 void s(int dir, const char* file, const char* target);
00043 
00045 extern void insthier(void);
00046 
00049 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/structgqueue__node.html0000664000076400007640000000715211147311327020640 0ustar bruceguenter bglibs: gqueue_node Struct Reference

gqueue_node Struct Reference
[adt gqueue: Generic simple queue.]

#include <gqueue.h>


Data Fields

struct gqueue_nodenext
char data [0]


Detailed Description

Generic queue node.

Field Documentation

Pointer to the next element in the queue linked list.

The data contained in the queue node.


The documentation for this struct was generated from the following file:
Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/iobuf_8h-source.html0000664000076400007640000000566011147311327017737 0ustar bruceguenter bglibs: iobuf.h Source File

iobuf.h

00001 #ifndef IO_BUF__H__
00002 #define IO_BUF__H__
00003 
00004 #include <iobuf/common.h>
00005 #include <iobuf/ibuf.h>
00006 #include <iobuf/obuf.h>
00007 
00013 int iobuf_copy(ibuf* in, obuf* out);
00014 int iobuf_copyflush(ibuf* in, obuf* out);
00015 int ibuf_copytofd(ibuf* in, int out);
00016 int obuf_copyfromfd(int in, obuf* out);
00017 
00022 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/structobuf.html0000664000076400007640000001224111147311327017127 0ustar bruceguenter bglibs: obuf Struct Reference

obuf Struct Reference
[obuf: Output Buffer Management]

#include <obuf.h>


Data Fields

iobuf io
unsigned bufpos
unsigned count
obuf_fn writefn


Detailed Description

Output specific buffer.

Field Documentation

Base iobuf structure.

unsigned obuf::bufpos

Current write position within the buffer.

unsigned obuf::count

The number of bytes written in the last operation.

Examples:
adt/ghash_test.c.

Function used to write data to the file descriptor.


The documentation for this struct was generated from the following file:
Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/str_8h-source.html0000664000076400007640000012655511147311327017452 0ustar bruceguenter bglibs: str.h Source File

str.h

00001 #ifndef STR__H__
00002 #define STR__H__
00003 
00004 #include <stdarg.h>
00005 
00024 #define STR_BLOCKSIZE 16
00025 
00029 struct str
00030 {
00035   char* s;
00039   unsigned len;
00041   unsigned size;
00042 };
00044 typedef struct str str;
00045 
00050 struct str_sortentry
00051 {
00053   const char* str;
00055   unsigned long len;
00056 };
00058 typedef struct str_sortentry str_sortentry;
00059 
00062 extern const char str_lcase_digits[36];
00063 extern const char str_ucase_digits[36];
00068 int str_init(str* s);
00069 int str_alloc(str* s, unsigned size, int copy);
00071 #define str_ready(S,SZ) str_alloc(S,SZ,0)
00072 
00073 #define str_realloc(S,SZ) str_alloc(S,SZ,1)
00074 void str_free(str* s);
00075 int str_truncate(str* s, unsigned len);
00080 int str_copy(str* s, const str* in);
00081 int str_copys(str* s, const char* in);
00082 int str_copyb(str* s, const char* in, unsigned len);
00083 int str_copyf(str* s, const char* format, ...);
00084 int str_copyfv(str* s, const char* format, va_list ap);
00085 int str_copyns(str* s, unsigned int count, ...);
00086 int str_copy2s(str* s, const char* a, const char* b);
00087 int str_copy3s(str* s, const char* a, const char* b, const char* c);
00088 int str_copy4s(str* s, const char* a, const char* b, const char* c, const char* d);
00089 int str_copy5s(str* s, const char* a, const char* b, const char* c, const char* d, const char* e);
00090 int str_copy6s(str* s, const char* a, const char* b, const char* c, const char* d, const char* e, const char* f);
00095 int str_cat(str* s, const str* in);
00096 int str_cats(str* s, const char* in);
00097 int str_catc(str* s, char in);
00098 int str_catb(str* s, const char* in, unsigned len);
00099 int str_catf(str* s, const char* format, ...);
00100 int str_catfv(str* s, const char* format, va_list ap);
00101 int str_cati(str* s, long in);
00102 int str_catiw(str* s, long in, unsigned width, char pad);
00103 int str_catu(str* s, unsigned long in);
00104 int str_catuw(str* s, unsigned long in, unsigned width, char pad);
00105 int str_catx(str* s, unsigned long in);
00106 int str_catxw(str* s, unsigned long in, unsigned width, char pad);
00107 int str_catill(str* s, long long in);
00108 int str_catiwll(str* s, long long in, unsigned width, char pad);
00109 int str_catull(str* s, unsigned long long in);
00110 int str_catuwll(str* s, unsigned long long in, unsigned width, char pad);
00111 int str_catxll(str* s, unsigned long long in);
00112 int str_catxwll(str* s, unsigned long long in, unsigned width, char pad);
00113 int str_catsnumw(str* s, long in, unsigned width, char pad,
00114                  unsigned base, const char* digits);
00115 int str_catunumw(str* s, unsigned long in, unsigned width, char pad,
00116                  unsigned base, const char* digits);
00117 int str_catsllnumw(str* s, long long in, unsigned width, char pad,
00118                    unsigned base, const char* digits);
00119 int str_catullnumw(str* s, unsigned long long in, unsigned width, char pad,
00120                    unsigned base, const char* digits);
00121 int str_catns(str* s, unsigned int count, ...);
00122 int str_cat2s(str* s, const char* a, const char* b);
00123 int str_cat3s(str* s, const char* a, const char* b, const char* c);
00124 int str_cat4s(str* s, const char* a, const char* b, const char* c, const char* d);
00125 int str_cat5s(str* s, const char* a, const char* b, const char* c, const char* d, const char* e);
00126 int str_cat6s(str* s, const char* a, const char* b, const char* c, const char* d, const char* e, const char* f);
00127 
00128 int str_join(str* s, char sep, const str* t);
00129 int str_joins(str* s, char sep, const char* in);
00130 int str_joinb(str* s, char sep, const char* in, unsigned len);
00134 /* @{ */
00135 void str_lower(str* s);
00136 void str_upper(str* s);
00137 long str_subst(str* s, char from, char to);
00138 void str_lstrip(str* s);
00139 void str_rstrip(str* s);
00140 #define str_strip(S) (str_rstrip(S), str_lstrip(S))
00141 void str_lcut(str* s, unsigned count);
00142 void str_rcut(str* s, unsigned count);
00143 int str_sort(str* s, char sep, long count,
00144              int (*fn)(const str_sortentry* a, const str_sortentry* b));
00145 int str_splice(str* s, unsigned start, unsigned len, const str* r);
00146 int str_splices(str* s, unsigned start, unsigned len, const char* r);
00147 int str_spliceb(str* s, unsigned start, unsigned len,
00148                 const char* r, unsigned rlen);
00149 long str_xlate(str* s, const char* from, const char* to, unsigned nchars);
00154 int str_cmp(const str* a, unsigned aoffset, const str* b, unsigned boffset);
00155 int str_cmps(const str* a, unsigned offset, const char* b);
00156 int str_cmpb(const str* a, unsigned offset, const char* b, unsigned len);
00157 
00158 int str_diff(const str* a, const str* b);
00159 int str_diffs(const str* a, const char* b);
00160 int str_diffb(const str* a, const char* b, unsigned len);
00161 
00162 int str_start(const str* a, const str* b);
00163 int str_starts(const str* a, const char* b);
00164 int str_startb(const str* a, const char* b, unsigned len);
00165 
00166 int str_case_start(const str* a, const str* b);
00167 int str_case_starts(const str* a, const char* b);
00168 int str_case_startb(const str* a, const char* b, unsigned len);
00173 void str_buildmap(int map[256], const char* list);
00174 unsigned str_count(const str* s, char ch);
00175 unsigned str_countof(const str* s, const char* list);
00176 #define str_findfirst(S,C) str_findnext(S,C,0)
00177 #define str_findfirstof(S,L) str_findnextof(S,L,0)
00178 #define str_findfirstnot(S,L) str_findnextnot(S,L,0)
00179 #define str_findlast(S,C) str_findprev(S,C,-1)
00180 #define str_findlastof(S,L) str_findprevof(S,L,-1)
00181 #define str_findlastnot(S,L) str_findprevof(S,L,-1)
00182 int str_findnext(const str* s, char ch, unsigned pos);
00183 int str_findnextof(const str* s, const char* list, unsigned pos);
00184 int str_findnextnot(const str* s, const char* list, unsigned pos);
00185 int str_findprev(const str* s, char ch, unsigned pos);
00186 int str_findprevof(const str* s, const char* list, unsigned pos);
00187 int str_findprevnot(const str* s, const char* list, unsigned pos);
00192 int str_match(const str* s, const str* pattern);
00193 int str_matchb(const str* s, const char* pptr, unsigned plen);
00194 int str_matchs(const str* s, const char* pattern);
00195 int str_case_match(const str* s, const str* pattern);
00196 int str_case_matchb(const str* s, const char* pptr, unsigned plen);
00197 int str_case_matchs(const str* s, const char* pattern);
00198 int str_glob(const str* s, const str* pattern);
00199 int str_globb(const str* s, const char* pptr, unsigned plen);
00200 int str_globs(const str* s, const char* pattern);
00201 int str_case_glob(const str* s, const str* pattern);
00202 int str_case_globb(const str* s, const char* pptr, unsigned plen);
00203 int str_case_globs(const str* s, const char* pattern);
00208 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/dir_b467e31085870d6887ee57c7b172ec7c.html0000664000076400007640000002742711147311327022047 0ustar bruceguenter bglibs: str/ Directory Reference

str Directory Reference


Files

file  alloc.c
file  buildmap.c
file  case_glob.c
file  case_match.c
file  case_start.c
file  cat.c
file  cat2s.c
file  cat3s.c
file  cat4s.c
file  cat5s.c
file  cat6s.c
file  catf.c
file  catiw.c
file  catiwll.c
file  catns.c
file  catsllnum.c
file  catsnum.c
file  catullnum.c
file  catunum.c
file  catuw.c
file  catuwll.c
file  catxw.c
file  catxwll.c
file  cmp.c
file  copy.c
file  copy2s.c
file  copy3s.c
file  copy4s.c
file  copy5s.c
file  copy6s.c
file  copyf.c
file  copyns.c
file  count.c
file  countof.c
file  cut.c
file  diff.c
file  digits.c
file  env.h [code]
file  env_find.c
file  env_from_array.c
file  env_from_string.c
file  env_get.c
file  env_make_array.c
file  env_put.c
file  env_set.c
file  env_unset.c
file  findnext.c
file  findnextnot.c
file  findnextof.c
file  findprev.c
file  findprevnot.c
file  findprevof.c
file  free.c
file  glob.c
file  init.c
file  iter.h [code]
file  iter_advance.c
file  iter_start.c
file  iter_valid.c
file  join.c
file  lower.c
file  lstrip.c
file  str/match.c
file  rstrip.c
file  sort.c
file  splice.c
file  start.c
file  str.h [code]
file  subst.c
file  truncate.c
file  upper.c
file  xlate.c

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/structiobuf.html0000664000076400007640000002026511147311327017305 0ustar bruceguenter bglibs: iobuf Struct Reference

iobuf Struct Reference
[iobuf: I/O Buffer Management]

#include <common.h>


Data Fields

int fd
char * buffer
unsigned bufsize
unsigned buflen
unsigned bufstart
unsigned offset
unsigned timeout
unsigned flags
int errnum


Detailed Description

The base I/O buffer structure.

Field Documentation

int iobuf::fd

File descriptor being buffered.

The buffer memory.

unsigned iobuf::bufsize

Total buffer size.

unsigned iobuf::buflen

Length of the data in the buffer.

unsigned iobuf::bufstart

Start of the data in the buffer.

unsigned iobuf::offset

Current file read/write offset.

unsigned iobuf::timeout

I/O timeout in ms (0 for no timeout).

unsigned iobuf::flags

Status flags.

Saved errno flag.


The documentation for this struct was generated from the following file:
Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/ibuf_8h-source.html0000664000076400007640000002436311147311327017561 0ustar bruceguenter bglibs: ibuf.h Source File

ibuf.h

00001 #ifndef IO_BUF__IBUF__H__
00002 #define IO_BUF__IBUF__H__
00003 
00004 #include <iobuf/common.h>
00005 
00016 typedef int (*ibuf_fn)(int, void*, unsigned long);
00017 
00019 struct ibuf
00020 {
00022   iobuf io;
00024   unsigned count;
00026   ibuf_fn readfn;
00027 };
00029 typedef struct ibuf ibuf;
00030 
00031 extern ibuf inbuf;
00032 
00033 int ibuf_init(ibuf* in, int fd, ibuf_fn fn, unsigned flags, unsigned bufsize);
00034 int ibuf_open(ibuf* in, const char* filename, unsigned bufsize);
00035 int ibuf_eof(ibuf* in);
00037 #define ibuf_close(in) iobuf_close(&((in)->io))
00038 
00039 #define ibuf_closed(in) iobuf_closed(&((in)->io))
00040 
00041 #define ibuf_error(in) iobuf_error(&((in)->io))
00042 
00043 #define ibuf_timedout(in) iobuf_timedout(&((in)->io))
00044 int ibuf_refill(ibuf* in);
00045 int ibuf_read_large(ibuf* in, char* data, unsigned datalen);
00046 int ibuf_read(ibuf* in, char* data, unsigned datalen);
00047 unsigned ibuf_tell(ibuf* in);
00048 int ibuf_seek(ibuf* in, unsigned offset);
00050 #define ibuf_rewind(in) ibuf_seek(in,0)
00051 
00052 #define ibuf_seekfwd(in,off) ibuf_seek(ibuf_tell(in)+(offset))
00053 
00054 int ibuf_peek(ibuf* in, char* ch);
00055 int ibuf_getc(ibuf* in, char* ch);
00056 int ibuf_getu(ibuf* in, unsigned long* data);
00057 int ibuf_gets(ibuf* in, char* data, unsigned datalen, char boundary);
00058 int ibuf_getstr(ibuf* in, struct str* s, char boundary);
00059 int ibuf_getstr_crlf(ibuf* in, struct str* s);
00060 int ibuf_getnetstring(ibuf* in, struct str* s);
00061 int ibuf_readall(ibuf* in, struct str* s);
00062 int ibuf_openreadclose(const char* filename, struct str* s);
00065 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/structsurfrand.html0000664000076400007640000001210111147311327020013 0ustar bruceguenter bglibs: surfrand Struct Reference

surfrand Struct Reference
[surfrand: Random number generator based on SURF]

#include <surfrand.h>


Data Fields

unsigned used
uint32 generated [SURF_OUT_U32]
uint32 seed [SURF_SEED_U32]
uint32 counter [SURF_IN_U32]


Detailed Description

The surfrand state structure

Field Documentation

unsigned surfrand::used

counts the number of bytes in generated that have been output already

uint32 surfrand::generated[SURF_OUT_U32]

temporary storage for the generated random data

uint32 surfrand::seed[SURF_SEED_U32]

the input seed data

uint32 surfrand::counter[SURF_IN_U32]

a giant counter used as input to SURF


The documentation for this struct was generated from the following file:
Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/path_8h-source.html0000664000076400007640000001062311147311327017562 0ustar bruceguenter bglibs: path.h Source File

path.h

00001 #ifndef LIB__PATH__H__
00002 #define LIB__PATH__H__
00003 
00004 #include "str/str.h"
00005 
00011 #define PATH_MATCH_DOTFILES 1
00012 
00013 extern int path_merge(str* path, const char* start);
00014 extern int fnmatch(const char* filename, const char* pattern,
00015                    unsigned options);
00016 extern int has_magic(const char* s);
00017 extern int path_match(const char* pattern, str* result, unsigned options);
00018 extern int path_contains(const char* path, const char* part);
00019 extern int path_mktemp(const char* prefix, str* filename);
00020 extern int path_mkdirs(const char* path, unsigned mode);
00021 
00024 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/sha384_8h-source.html0000664000076400007640000000472511147311327017646 0ustar bruceguenter bglibs: sha384.h Source File

sha384.h

00001 #ifndef BGLIBS__SHA384__H__
00002 #define BGLIBS__SHA384__H__
00003 
00004 #include <sysdeps.h>
00005 #include <crypto/sha512.h>
00006 
00007 #define SHA384_DIGEST_LENGTH (384/8)
00008 
00009 typedef struct SHA512_ctx SHA384_ctx;
00010 
00011 void SHA384_init  (SHA384_ctx*);
00012 #define SHA384_update SHA512_update
00013 void SHA384_final (SHA384_ctx*, uint8*);
00014 
00015 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/group__instlib.html0000664000076400007640000003145611147311327017757 0ustar bruceguenter bglibs: instlib: Installation program generation

instlib: Installation program generation


Functions

int opendir (const char *dir)
int opensubdir (int dir, const char *subdir)
int d (int dir, const char *subdir, unsigned uid, unsigned gid, unsigned mode)
void cf (int dir, const char *file, unsigned uid, unsigned gid, unsigned mode, const char *srcfile)
void c (int dir, const char *file, unsigned uid, unsigned gid, unsigned mode)
void s (int dir, const char *file, const char *target)
void insthier (void)

Variables

const char * install_prefix

Detailed Description

The installer libraries provide for building a program to install files, to verify (check) an installation, and to show what would be installed, from a single source. This single source is typically called insthier.c and contains a single routine also named insthier (so-named as it provides the installation hierarchy). The libraries provide the main function that calls insthier as well as all the necessary support functions.

Where given, uid and gid may be set to -1 if there is no need to force the installed UID and GID to a particular value. The dir argument is a directory number previously opened by opendir.


Function Documentation

void c ( int  dir,
const char *  file,
unsigned  uid,
unsigned  gid,
unsigned  mode 
)

Copy a file from the source directory, retaining its name.

void cf ( int  dir,
const char *  file,
unsigned  uid,
unsigned  gid,
unsigned  mode,
const char *  srcfile 
)

Copy a file from the source directory to a different name.

int d ( int  dir,
const char *  subdir,
unsigned  uid,
unsigned  gid,
unsigned  mode 
)

Create a subdirectory.

void insthier ( void   ) 

The single function that the insthier.c source needs to define.

int opendir ( const char *  dir  ) 

Open a directory and provide a file handle reference for future operations.

int opensubdir ( int  dir,
const char *  subdir 
)

Open a subdirectory of a directory already opened by opendir.

void s ( int  dir,
const char *  file,
const char *  target 
)

Create a symbolic link.


Variable Documentation

const char* install_prefix

The directory prefix under which all files are placed.


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/dir_dd30a1940344e6186e300b1ab56c7d11.html0000664000076400007640000001112511147311327021754 0ustar bruceguenter bglibs: fmt/ Directory Reference

fmt Directory Reference


Files

file  char.c
file  chars.c
file  lcase.c
file  misc.h [code]
file  multi.c
file  multi.h [code]
file  number.h [code]
file  pad.c
file  sdec.c
file  sign_pad.c
file  slldec.c
file  sllnum.c
file  snum.c
file  ucase.c
file  udec.c
file  uhexl.c
file  uhexu.c
file  ulldec.c
file  ullhexl.c
file  ullhexu.c
file  ullnum.c
file  unum.c

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/fcntl_8h-source.html0000664000076400007640000000440311147311327017733 0ustar bruceguenter bglibs: fcntl.h Source File

fcntl.h

00001 #ifndef UNIX__FCNTL__H__
00002 #define UNIX__FCNTL__H__
00003 
00004 int fcntl_fd_on(int fd, int flag);
00005 int fcntl_fd_off(int fd, int flag);
00006 int fcntl_fl_on(int fd, int flag);
00007 int fcntl_fl_off(int fd, int flag);
00008 
00009 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/structgstack.html0000664000076400007640000000725111147311327017455 0ustar bruceguenter bglibs: gstack Struct Reference

gstack Struct Reference
[adt gstack: Generic simple stack.]

#include <gstack.h>


Data Fields

struct gstack_nodehead
unsigned count


Detailed Description

Generic stack structure.
Examples:

adt/gstack_test.c.


Field Documentation

struct gstack_node* gstack::head [read]

Pointer to the first item in the stack.

unsigned gstack::count

The number of items in the stack.


The documentation for this struct was generated from the following file:
Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/structstriter.html0000664000076400007640000001332511147311327017674 0ustar bruceguenter bglibs: striter Struct Reference

striter Struct Reference
[striter: Iterator over substrings of a str.]

#include <iter.h>


Data Fields

struct strstr
unsigned start
const char * startptr
unsigned len
char sep


Detailed Description

The basic striter data type.

Field Documentation

struct str* striter::str [read]

A pointer to the str being iterated over.

unsigned striter::start

The starting offset of the current substring.

const char* striter::startptr

Pointer to the current substring.

unsigned striter::len

Length of the current substring.

The seperator used to delimit the substrings.


The documentation for this struct was generated from the following file:
Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/multi_8h-source.html0000664000076400007640000000460311147311327017761 0ustar bruceguenter bglibs: multi.h Source File

multi.h

00001 #ifndef FMT__MULTI__H__
00002 #define FMT__MULTI__H__
00003 
00004 #include <stdarg.h>
00005 
00014 extern unsigned fmt_multi(char* buffer, const char* format, ...);
00015 extern unsigned fmt_multiv(char* buffer, const char* format, va_list ap);
00016 
00021 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/group__ipv6.html0000664000076400007640000002030011147311327017161 0ustar bruceguenter bglibs: ipv6: IPv6 Address Handling

ipv6: IPv6 Address Handling


Data Structures

struct  ipv6addr

Typedefs

typedef uint16 ipv6port

Functions

const char * ipv6_scan (const char *s, ipv6addr *addr)
const char * ipv6_format (const ipv6addr *addr)
unsigned fmt_ipv6addr (char *buffer, const ipv6addr *addr)

Variables

const ipv6addr IPV6ADDR_ANY
const ipv6addr IPV6ADDR_LOOPBACK

Typedef Documentation

typedef uint16 ipv6port

IPv6 port number.


Function Documentation

unsigned fmt_ipv6addr ( char *  buffer,
const ipv6addr addr 
)

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 NUL byte.

Returns:
The number of bytes written to the buffer.
Note:
This routine is thread and recursion safe.

const char* ipv6_format ( const ipv6addr addr  ) 

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_scan ( const char *  s,
ipv6addr addr 
)

Scan a C string for an IPv6 address.

Returns:
NULL if parsing failed, otherwise a pointer to the first character after the end of the address.


Variable Documentation

IPv6 "any" address constant.

IPv6 loopback address constant.


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/dir_201548bc8cd7b18da7ab15618d9a7744.html0000664000076400007640000000417611147311327022076 0ustar bruceguenter bglibs: instlib/ Directory Reference

instlib Directory Reference


Files

file  installer.c
file  installer.h [code]
file  instcheck.c
file  instmain.c
file  instshow.c

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/group__socket.html0000664000076400007640000015420311147311327017577 0ustar bruceguenter bglibs: socket: General socket manipulations

socket: General socket manipulations


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)

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])

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)

Detailed Description

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 -1 on error. All other functions return non-zero (true) on success or 0 (false) on error. All functions set errno on error.

Function Documentation

int socket_accept4 ( int  sock,
ipv4addr ip,
ipv4port port 
)

Accept a connection on a socket from an IPv4 address.

int socket_accept6 ( int  sock,
ipv6addr ip,
ipv6port port 
)

Accept a connection on a socket from an IPv6 address.

int socket_acceptu ( int  sock  ) 

Accept a UNIX domain connection.

int socket_bind4 ( int  sock,
const ipv4addr ip,
ipv4port  port 
)

Bind a socket to an IPv4 address.

int socket_bind6 ( int  sock,
const ipv6addr ip,
ipv6port  port 
)

Bind a socket to an IPv6 address.

int socket_bindu ( int  sock,
const char *  path 
)

Bind a UNIX domain address (path) to a socket.

int socket_broadcast ( int  fd  ) 

Mark a socket for broadcast transmission.

int socket_connect4 ( int  sock,
const ipv4addr ip,
ipv4port  port 
)

Connect a socket to an IPv4 address.

int socket_connect4_timeout ( int  sock,
const ipv4addr ip,
ipv4port  port,
int  timeout 
)

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_connect6 ( int  sock,
const ipv6addr ip,
ipv6port  port 
)

Connect a socket to an IPv6 address.

int socket_connect6_timeout ( int  sock,
const ipv6addr ip,
ipv6port  port,
int  timeout 
)

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_connected ( int  sock  ) 

Test if a socket is connected.

int socket_connectu ( int  sock,
const char *  path 
)

Make an UNIX domain connection.

int socket_connectu_timeout ( int  sock,
const char *  path,
int  timeout 
)

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_cork ( int  sock  ) 

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 TCP_CORK option) and to at least compile on BSD (with the TCP_NOPUSH option). On OS's which lack either of these two options, this function is essentially a no-op.

int socket_getaddr4 ( int  sock,
ipv4addr addr,
ipv4port port 
)

Determine the IPv4 address of a socket.

int socket_getaddr6 ( int  sock,
ipv6addr addr,
ipv6port port 
)

Determine the IPv6 address of a socket.

int socket_linger ( int  fd,
int  onoff,
int  seconds 
)

Set the socket "linger" option.

int socket_listen ( int  sock,
int  backlog 
)

Listen to a socket.

int socket_notcpdelay ( int  fd,
int  on 
)

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_pairdgm ( int  fd[2]  ) 

Create a pair of datagram sockets.

int socket_pairstr ( int  fd[2]  ) 

Create a pair of stream sockets.

int socket_recv4 ( int  sock,
char *  buffer,
unsigned  buflen,
ipv4addr ip,
ipv4port port 
)

Receive a datagram from a UDP socket.

int socket_recv6 ( int  sock,
char *  buffer,
unsigned  buflen,
ipv6addr ip,
ipv6port port 
)

Receive a datagram from an IPv6 UDP socket.

int socket_recvfd ( int  sock  ) 

Receive a file descriptor over a socket.

int socket_recvu ( int  sock,
char *  buffer,
unsigned  buflen 
)

Receive a datagram from a UNIX domain socket.

int socket_reuse ( int  fd  ) 

Mark a socket for address reuse.

int socket_send4 ( int  sock,
const char *  buffer,
unsigned  buflen,
const ipv4addr ip,
ipv4port  port 
)

Send a datagram on a UDP socket.

int socket_send6 ( int  sock,
const char *  buffer,
unsigned  buflen,
const ipv6addr ip,
ipv6port  port 
)

Send a datagram on an IPv6 UDP socket.

int socket_sendfd ( int  sock,
int  fd 
)

Send a file descriptor over a socket.

int socket_sendu ( int  sock,
const char *  buffer,
unsigned  buflen 
)

Send a datagram on a UNIX domain socket.

int socket_shutdown ( int  sock,
int  shut_rd,
int  shut_wr 
)

Shut down part or all of a socket.

int socket_tcp ( void   ) 

Create a TCP/IP socket.

int socket_tcp4 ( void   ) 

Create a TCP/IPv4 socket.

int socket_tcp6 ( void   ) 

Create a TCP/IPv6 socket.

int socket_udp ( void   ) 

Create a UDP/IP socket.

int socket_udp4 ( void   ) 

Create a UDP/IPv4 socket.

int socket_udp6 ( void   ) 

Create a UDP/IPv6 socket.

int socket_uncork ( int  sock  ) 

Unstop a TCP socket from sending short writes.

int socket_unixdgm ( void   ) 

Create UNIX domain datagram socket.

int socket_unixstr ( void   ) 

Create UNIX domain stream socket.


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/adt_2common_8h-source.html0000664000076400007640000001270111147311327021027 0ustar bruceguenter bglibs: common.h Source File

adt/common.h

00001 #ifndef BGLIBS__ADT__COMMON__H__
00002 #define BGLIBS__ADT__COMMON__H__
00003 
00010 typedef unsigned long adt_hash_t;
00012 typedef void adt_free_fn(void*);
00016 typedef int adt_copy_fn(void*, const void*);
00020 typedef int adt_cmp_fn(const void*, const void*);
00022 typedef adt_hash_t adt_hash_fn(const void*);
00023 
00025 adt_hash_t adt_hashb(const unsigned char*, unsigned long);
00026 
00028 adt_hash_t adt_hashs(const unsigned char*);
00029 
00031 adt_hash_t adt_hashsp(const char* const*);
00033 int adt_cmpsp(const char* const* a, const char* const* b);
00035 int adt_copysp(const char** a, const char* const* b);
00037 void adt_freesp(const char** a);
00038 
00041 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/structibuf.html0000664000076400007640000001052211147311327017121 0ustar bruceguenter bglibs: ibuf Struct Reference

ibuf Struct Reference
[ibuf: Input Buffer Managemenet]

#include <ibuf.h>


Data Fields

iobuf io
unsigned count
ibuf_fn readfn


Detailed Description

Input specific buffer.

Field Documentation

Base iobuf structure.

unsigned ibuf::count

The number of bytes read in the last operation.

Function used to read data from the file descriptor.


The documentation for this struct was generated from the following file:
Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/sha1_8h-source.html0000664000076400007640000001040511147311327017460 0ustar bruceguenter bglibs: sha1.h Source File

sha1.h

00001 /*
00002  SHA-1 in C
00003 
00004  By Steve Reid <steve@edmweb.com>, with small changes to make it
00005  fit by Bruce Guenter <bruce@untroubled.org>
00006 
00007 */
00008 
00009 #ifndef _SHA1_H
00010 # define _SHA1_H
00011 
00012 #include <sysdeps.h>
00013 
00014 #define SHA1_DIGEST_LENGTH 20
00015 #define SHA1_BLOCK_LENGTH 64
00016 
00017 typedef struct {
00018   uint32 state[5];
00019   uint64 bytes;
00020   unsigned char buffer[SHA1_BLOCK_LENGTH];
00021 } SHA1_CTX;
00022 
00023 void SHA1Transform(uint32 state[5], const unsigned char buffer[SHA1_BLOCK_LENGTH]);
00024 void SHA1Init(SHA1_CTX* context);
00025 void SHA1Update(SHA1_CTX* context, const unsigned char* data, uint32 len);
00026 void SHA1Final(SHA1_CTX* context, unsigned char digest[SHA1_DIGEST_LENGTH]);
00027 
00028 # define SHA1_Transform SHA1Transform
00029 # define SHA1_Init SHA1Init
00030 # define SHA1_Update SHA1Update
00031 # define SHA1_Final SHA1Final
00032 
00033 #endif
00034 

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/classes.html0000664000076400007640000000737111147311327016374 0ustar bruceguenter bglibs: Alphabetical List

bglibs Data Structure Index

G | I | O | S

  G  
gqueue_node   ibuf   
  O  
str_sortentry   
ghash   gstack   iobuf   obuf   striter   
ghashiter   gstack_node   ipv4addr   
  S  
surfrand   
gqueue   
  I  
ipv6addr   str   

G | I | O | S


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/group__adt__gstack.html0000664000076400007640000003677111147311327020563 0ustar bruceguenter bglibs: adt gstack: Generic simple stack.

adt gstack: Generic simple stack.


Data Structures

struct  gstack_node
struct  gstack

Defines

#define GSTACK_DECL(PREFIX, TYPE)
#define GSTACK_PUSH_DEFN(PREFIX, TYPE, COPY)
#define GSTACK_TOP_DEFN(PREFIX, TYPE)
#define GSTACK_POP_DEFN(PREFIX, FREE)
#define GSTACK_DEFN(PREFIX, TYPE, COPY, FREE)

Functions

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)

Detailed Description

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.

Define Documentation

#define GSTACK_DECL ( PREFIX,
TYPE   ) 

Value:

extern int PREFIX##_push(struct gstack* s, TYPE const* data); \
extern TYPE* PREFIX##_top(struct gstack* s); \
extern void PREFIX##_pop(struct gstack* s);
Declare specialized gstack functions.
Examples:
adt/gstack_test.c.

#define GSTACK_DEFN ( PREFIX,
TYPE,
COPY,
FREE   ) 

Value:

GSTACK_PUSH_DEFN(PREFIX,TYPE,COPY) \
GSTACK_TOP_DEFN(PREFIX,TYPE) \
GSTACK_POP_DEFN(PREFIX,FREE)
Define all the specialized gstack functions. If COPY is NULL, a simple memcpy is used instead. If FREE is NULL, no attempt is made to free the data.
Examples:
adt/gstack_test.c.

#define GSTACK_POP_DEFN ( PREFIX,
FREE   ) 

Value:

void PREFIX##_pop(struct gstack* s) { \
  gstack_pop(s, (adt_free_fn*)(FREE)); \
}
Define a specialized gstack pop function.

#define GSTACK_PUSH_DEFN ( PREFIX,
TYPE,
COPY   ) 

Value:

int PREFIX##_push(struct gstack* s, TYPE const* data) { \
  return gstack_push(s, sizeof *data, data, (adt_copy_fn*)COPY); \
}
Define a specialized gstack push function.

#define GSTACK_TOP_DEFN ( PREFIX,
TYPE   ) 

Value:

TYPE* PREFIX##_top(struct gstack* s) { \
  return (s->head == 0) ? 0 : (TYPE*)s->head->data; \
}
Define a specialized gstack top function.


Function Documentation

void gstack_pop ( struct gstack s,
adt_free_fn fn 
)

Remove the first (most recently pushed) element from the queue. If the free function fn is NULL no data freeing is done. Note that this does not return a pointer to the popped item, as once the item has been popped it is also freed.

int gstack_push ( struct gstack s,
unsigned  datasize,
const void *  data,
adt_copy_fn fn 
)

Add a new element onto the stack. If the copy function fn is NULL memcpy is used in its place.

void* gstack_top ( const struct gstack s  ) 

Return the address of first (most recently pushed) element in the queue.


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/group__signalfd.html0000664000076400007640000001330311147311327020071 0ustar bruceguenter bglibs: signalfd: Pass signals along a file.

signalfd: Pass signals along a file.


Functions

int signalfd_init (void)
void signalfd_catch (int sig)
void signalfd_uncatch (int sig)
void signalfd_close (void)

Function Documentation

void signalfd_catch ( int  sig  ) 

Mark a signal as being caught through the signalfd interface.

void signalfd_close ( void   ) 

Close the signalfd interface.

int signalfd_init ( void   ) 

Initialize the signal file descriptor.

This function creates a pipe through which signals will get passed. This is a way of handling signals that avoids most problems posed by UNIX signals. When a signal is caught by this interface, the numerical value of the signal is passed down the pipe as a native integer. The file descriptor is set to non-blocking mode to prevent blocking when reading from it.

To use the file descriptor, use either poll or select to determine when it is readable. When it becomes readable, read a single byte from it. The value of this byte indicates what signal was caught.

Due to the global nature of UNIX signal handling, only a single signalfd interface may be active at any time. Do not call signalfd_init multiple times without calling signalfd_close first.

Returns:
-1 if an error occurred, otherwise the return value is the file descriptor opened for reading.

void signalfd_uncatch ( int  sig  ) 

Unmark a signal as being caught through the signalfd interface.


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/group__str.html0000664000076400007640000041676211147311327017132 0ustar bruceguenter bglibs: str: Dynamically allocated string library.

str: Dynamically allocated string library.


Data Structures

struct  str
struct  str_sortentry

Globals

const char str_lcase_digits [36]
const char str_ucase_digits [36]

Overhead Functions

int str_init (str *s)
int str_alloc (str *s, unsigned size, int copy)
void str_free (str *s)
int str_truncate (str *s, unsigned len)
#define str_ready(S, SZ)   str_alloc(S,SZ,0)
#define str_realloc(S, SZ)   str_alloc(S,SZ,1)

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)

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)

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)
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)
#define str_strip(S)   (str_rstrip(S), str_lstrip(S))

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)

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)
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)
#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)

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)

Defines

#define STR_BLOCKSIZE   16

Typedefs

typedef struct str str
typedef struct str_sortentry str_sortentry

Detailed Description

Calling Convention
The standard calling convention to str functions is to pass the string being examined or modified as the first argument. For most functions, the return value will be 0 (false) if an error occurred (ie memory allocation failed) and non-zero (true) otherwise.

Define Documentation

#define STR_BLOCKSIZE   16

The block size in which string memory is allocated.

STR_BLOCKSIZE should be set to at least the size at which the allocator (ie 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_ready ( S,
SZ   )     str_alloc(S,SZ,0)

Make sure string S has at least SZ bytes ready (no copy)

#define str_realloc ( S,
SZ   )     str_alloc(S,SZ,1)

Reallocate string S to size SZ bytes, copying the existing string


Typedef Documentation

typedef struct str str

String structure typedef.

typedef struct str_sortentry str_sortentry

String sort entry typedef.


Function Documentation

int str_alloc ( str s,
unsigned  size,
int  copy 
)

Allocate storage for a string.

Parameters:
s String to modify.
size Minimum number of bytes for which to allocate.
copy If set, the existing string will be copied into the new string.
The size given is incremented to account for adding a trailing NUL byte (to ensure compatibility with C string functions) and is then rounded up to the nearest STR_BLOCKSIZE interval.

void str_buildmap ( int  map[256],
const char *  list 
)

Build a map from the list of characters.

Each byte in the output map contains either -1 if the corresponding character was not present in the input string, or the offset of the last instance of the character in the list.

int str_case_match ( const str s,
const str pattern 
)

Simple pattern match on dynamic string pattern.

int str_case_matchb ( const str s,
const char *  pptr,
unsigned  plen 
)

Simple but fast (linear time) pattern matching on binary pattern.

int str_case_matchs ( const str s,
const char *  pattern 
)

Simple pattern match on C string pattern.

int str_case_start ( const str a,
const str b 
)

Match the prefix of the string to another string.

int str_case_startb ( const str a,
const char *  b,
unsigned  len 
)

Match the prefix of the string to a binary chunk.

int str_case_starts ( const str a,
const char *  b 
)

Match the prefix of the string to a C string.

int str_cat ( str s,
const str in 
)

Append another string

int str_cat2s ( str s,
const char *  a,
const char *  b 
)

Append 2 C strings

int str_cat3s ( str s,
const char *  a,
const char *  b,
const char *  c 
)

Append 3 C strings

int str_cat4s ( str s,
const char *  a,
const char *  b,
const char *  c,
const char *  d 
)

Append 4 C strings

int str_cat5s ( str s,
const char *  a,
const char *  b,
const char *  c,
const char *  d,
const char *  e 
)

Append 5 C strings

int str_cat6s ( str s,
const char *  a,
const char *  b,
const char *  c,
const char *  d,
const char *  e,
const char *  f 
)

Append 6 C strings

int str_catb ( str s,
const char *  in,
unsigned  len 
)

Append a binary block

int str_catc ( str s,
char  in 
)

Append a single character

int str_catf ( str s,
const char *  format,
  ... 
)

Append formatted data using fmt_multi from variable arguments

int str_catfv ( str s,
const char *  format,
va_list  ap 
)

Append formatted data using fmt_multi from a va_list

int str_cati ( str s,
long  in 
)

Append a signed integer in decimal.

int str_catill ( str s,
long long  in 
)

Append a signed long long integer in decimal.

int str_catiw ( str s,
long  in,
unsigned  width,
char  pad 
)

Append a signed integer in decimal, padded to a minimum width.

int str_catiwll ( str s,
long long  in,
unsigned  width,
char  pad 
)

Append a signed long long integer in decimal, padded to a minimum width.

int str_catns ( str s,
unsigned int  count,
  ... 
)

Append N C strings

int str_cats ( str s,
const char *  in 
)

Append a C string

int str_catsllnumw ( str s,
long long  in,
unsigned  width,
char  pad,
unsigned  base,
const char *  digits 
)

Append a signed long long integer, optionally padded to a minimum width

int str_catsnumw ( str s,
long  in,
unsigned  width,
char  pad,
unsigned  base,
const char *  digits 
)

Append a signed integer, optionally padded to a minimum width

int str_catu ( str s,
unsigned long  in 
)

Append an unsigned integer in decimal, padded to a minimum width.

int str_catull ( str s,
unsigned long long  in 
)

Append an unsigned long long integer in decimal.

int str_catullnumw ( str s,
unsigned long long  in,
unsigned  width,
char  pad,
unsigned  base,
const char *  digits 
)

Append an unsigned long long integer, optionally padded to a minimum width

int str_catunumw ( str s,
unsigned long  in,
unsigned  width,
char  pad,
unsigned  base,
const char *  digits 
)

Append an unsigned integer, optionally padded to a minimum width

int str_catuw ( str s,
unsigned long  in,
unsigned  width,
char  pad 
)

Append an unsigned integer in decimal.

int str_catuwll ( str s,
unsigned long long  in,
unsigned  width,
char  pad 
)

Append an unsigned long long integer in decimal, padded to a minimum width.

int str_catx ( str s,
unsigned long  in 
)

Append an unsigned integer in hexadecimal, padded to a minimum width.

int str_catxll ( str s,
unsigned long long  in 
)

Append an unsigned long long integer in hexadecimal.

int str_catxw ( str s,
unsigned long  in,
unsigned  width,
char  pad 
)

Append an unsigned integer in hexadecimal.

int str_catxwll ( str s,
unsigned long long  in,
unsigned  width,
char  pad 
)

Append an unsigned long long integer in hexadecimal, padded to a minimum width.

int str_cmp ( const str a,
unsigned  aoffset,
const str b,
unsigned  boffset 
)

Compare part of two strings.

This function compares two strings, starting at aoffset bytes into a and boffset bytes into b. The first non-zero difference is returned. If the portion of b is longer than the portion of a, the result is positive.

int str_cmpb ( const str a,
unsigned  offset,
const char *  b,
unsigned  len 
)

Compare a string against a binary block.

int str_cmps ( const str a,
unsigned  offset,
const char *  b 
)

Compare a string against a C string.

int str_copy ( str s,
const str in 
)

Copy in a string

int str_copy2s ( str s,
const char *  a,
const char *  b 
)

Copy in the concatenation of 2 C strings

int str_copy3s ( str s,
const char *  a,
const char *  b,
const char *  c 
)

Copy in the concatenation of 3 C strings

int str_copy4s ( str s,
const char *  a,
const char *  b,
const char *  c,
const char *  d 
)

Copy in the concatenation of 4 C strings

int str_copy5s ( str s,
const char *  a,
const char *  b,
const char *  c,
const char *  d,
const char *  e 
)

Copy in the concatenation of 5 C strings

int str_copy6s ( str s,
const char *  a,
const char *  b,
const char *  c,
const char *  d,
const char *  e,
const char *  f 
)

Copy in the concatenation of 6 C strings

int str_copyb ( str s,
const char *  in,
unsigned  len 
)

Copy in a binary block

int str_copyf ( str s,
const char *  format,
  ... 
)

Copy formatted data using fmt_multi from variable arguments

int str_copyfv ( str s,
const char *  format,
va_list  ap 
)

Copy formatted data using fmt_multi from a va_list

int str_copyns ( str s,
unsigned int  count,
  ... 
)

Copy in the concatenation of N C strings

int str_copys ( str s,
const char *  in 
)

Copy in a C string

unsigned str_count ( const str s,
char  ch 
)

Count the number of instances of a character

unsigned str_countof ( const str s,
const char *  list 
)

Count the number of instances of a list of characters

int str_diff ( const str a,
const str b 
)

Differentiate two strings.

The first non-zero difference between a and b is returned. If a is longer than b and no differences are found up to the length of b, then the return value is positive. If b is longer than a and no differences are found up to the length of a, then the return value is negative.

int str_diffb ( const str a,
const char *  b,
unsigned  len 
)

Differentiate a string and a binary block.

int str_diffs ( const str a,
const char *  b 
)

Differentiate a string and a C string.

int str_findnext ( const str s,
char  ch,
unsigned  pos 
)

Find the next instance of the given character, on or after pos

int str_findnextnot ( const str s,
const char *  list,
unsigned  pos 
)

Find the next instance of a character not in the given list of characters, on or after pos

int str_findnextof ( const str s,
const char *  list,
unsigned  pos 
)

Find the next instance of the given list of characters, on or after pos

int str_findprev ( const str s,
char  ch,
unsigned  pos 
)

Find the previous instance of the given character on or before pos

int str_findprevnot ( const str s,
const char *  list,
unsigned  pos 
)

Find the previous instance of a character not in the given list of characters, on or before pos

int str_findprevof ( const str s,
const char *  list,
unsigned  pos 
)

Find the previous instance of the given list of characters, on or before pos

void str_free ( str s  ) 

Free a string's storage. This function also sets all the members of the structure to zero.

int str_init ( str s  ) 

Initialize a string, giving it a small empty allocation.

int str_join ( str s,
char  sep,
const str in 
)

Join two strings together with exactly one instance of the seperator.

int str_joinb ( str s,
char  sep,
const char *  in,
unsigned  len 
)

Join a binary block to this string

int str_joins ( str s,
char  sep,
const char *  in 
)

Join a C string to this string

void str_lcut ( str s,
unsigned  count 
)

Cut count bytes from the left (front) of the string

void str_lower ( str s  ) 

Translate all upper-case characters to lower-case

void str_lstrip ( str s  ) 

Strip all white space from the left (front) of the string

int str_match ( const str s,
const str pattern 
)

Simple pattern match on dynamic string pattern.

int str_matchb ( const str s,
const char *  pptr,
unsigned  plen 
)

Simple but fast (linear time) pattern matching on binary pattern.

int str_matchs ( const str s,
const char *  pattern 
)

Simple pattern match on C string pattern.

void str_rcut ( str s,
unsigned  count 
)

Cut count bytes from the right (end) of the string

void str_rstrip ( str s  ) 

Strip all white space from the right (end) of the string

int str_sort ( str s,
char  sep,
long  count,
int(*)(const str_sortentry *a, const str_sortentry *b)  fn 
)

Sort a string.

Parameters:
s The string to sort.
sep The character which delimits the substrings.
count The number of substrings within s (set to -1 if not known).
fn The comparison function. Defaults to a function that works like memcmp.
Note:
This function allocates a temporary array of substring pointers, and so may return 0 if memory allocation fails. The string itself is not reallocated.

int str_start ( const str a,
const str b 
)

Match the prefix of the string to another string.

int str_startb ( const str a,
const char *  b,
unsigned  len 
)

Match the prefix of the string to a binary chunk.

int str_starts ( const str a,
const char *  b 
)

Match the prefix of the string to a C string.

long str_subst ( str s,
char  from,
char  to 
)

Substitute one character for another throughout the string.

Returns:
the number of substitutions made.

int str_truncate ( str s,
unsigned  len 
)

Truncate a string.

If len is larger than the current size, the string is reallocated. If len is less than the existing length (not size), the length of the string is reduced to len. A NUL marker is placed at len.

void str_upper ( str s  ) 

Translate all lower-case characters to upper-case

long str_xlate ( str s,
const char *  from,
const char *  to,
unsigned  nchars 
)

Substitute one character for another throughout the string.

Returns:
the number of substitutions made.


Variable Documentation

const char str_lcase_digits[36]

Lower-case digits, also used for decimal numbers.

const char str_ucase_digits[36]

Upper-case digits.


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/dirs.html0000664000076400007640000000361411147311327015674 0ustar bruceguenter bglibs: Directory Hierarchy

bglibs Directories

This directory hierarchy is sorted roughly, but not completely, alphabetically:
Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/index.html0000664000076400007640000000220111147311327016031 0ustar bruceguenter bglibs: Main Page

bglibs Documentation


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/obuf_8h-source.html0000664000076400007640000005651411147311327017572 0ustar bruceguenter bglibs: obuf.h Source File

obuf.h

00001 #ifndef IO_BUF__OBUF__H__
00002 #define IO_BUF__OBUF__H__
00003 
00004 #include <stdarg.h>
00005 #include <iobuf/common.h>
00006 
00017 typedef int (*obuf_fn)(int, const void*, unsigned long);
00018 
00020 struct obuf
00021 {
00023   iobuf io;
00025   unsigned bufpos;
00027   unsigned count;
00029   obuf_fn writefn;
00030 };
00032 typedef struct obuf obuf;
00033 
00034 extern obuf outbuf;
00035 extern obuf errbuf;
00036 
00037 extern const char obuf_dec_digits[10];
00038 extern const char obuf_hex_lcase_digits[16];
00039 extern const char obuf_hex_ucase_digits[16];
00040 
00042 #define OBUF_CREATE O_CREAT
00043 
00044 #define OBUF_EXCLUSIVE O_EXCL
00045 
00046 #define OBUF_TRUNCATE O_TRUNC
00047 
00048 #define OBUF_APPEND O_APPEND
00049 
00050 int obuf_init(obuf* out, int fd, obuf_fn fn, unsigned flags, unsigned bufsize);
00051 int obuf_open(obuf* out, const char* filename, int oflags, int mode, unsigned bufsize);
00052 int obuf_close(obuf* out);
00054 #define obuf_error(out) iobuf_error(&(out)->io)
00055 
00056 #define obuf_closed(out) iobuf_closed(&(out)->io)
00057 
00058 #define obuf_timedout(out) iobuf_timedout(&((out)->io))
00059 int obuf_flush(obuf* out);
00060 int obuf_sync(obuf* out);
00061 int obuf_write_large(obuf* out, const char* data, unsigned datalen);
00062 int obuf_write(obuf* out, const char* data, unsigned datalen);
00063 int obuf_seek(obuf* out, unsigned offset);
00065 #define obuf_rewind(out) obuf_seek(out,0)
00066 
00067 #define obuf_tell(out) ((out)->io.offset+(out)->bufpos)
00068 
00069 int obuf_pad(obuf* out, unsigned width, char ch);
00070 int obuf_endl(obuf* out);
00071 int obuf_putc(obuf* out, char ch);
00073 #define obuf_puts(out,str) obuf_write(out,str,strlen(str))
00074 int obuf_put2s(obuf* out, const char* s1, const char* s2);
00075 int obuf_put3s(obuf* out, const char* s1, const char* s2, const char* s3);
00076 int obuf_put4s(obuf* out, const char* s1, const char* s2, const char* s3,
00077                const char* s4);
00078 int obuf_put5s(obuf* out, const char* s1, const char* s2, const char* s3,
00079                const char* s4, const char* s5);
00080 int obuf_put6s(obuf* out, const char* s1, const char* s2, const char* s3,
00081                const char* s4, const char* s5, const char* s6);
00082 int obuf_put7s(obuf* out, const char* s1, const char* s2, const char* s3,
00083                const char* s4, const char* s5, const char* s6, const char* s7);
00084 int obuf_putns(obuf* out, unsigned int count, ...);
00085 int obuf_putf(obuf* out, const char* format, ...);
00086 int obuf_putfv(obuf* out, const char* format, va_list ap);
00088 #define obuf_putstr(out,str) obuf_write(out,(str)->s,(str)->len)
00089 int obuf_putsflush(obuf* out, const char* s);
00090 int obuf_puti(obuf* out, long data);
00091 int obuf_putiw(obuf* out, long data, unsigned width, char pad);
00092 int obuf_putu(obuf* out, unsigned long data);
00093 int obuf_putuw(obuf* out, unsigned long data, unsigned width, char pad);
00094 int obuf_putill(obuf* out, long long data);
00095 int obuf_putiwll(obuf* out, long long data, unsigned width, char pad);
00096 int obuf_putull(obuf* out, unsigned long long data);
00097 int obuf_putuwll(obuf* out, unsigned long long data, unsigned width, char pad);
00098 int obuf_putx(obuf* out, unsigned long data);
00099 int obuf_putxw(obuf* out, unsigned long data, unsigned width, char pad);
00100 int obuf_putX(obuf* out, unsigned long data);
00101 int obuf_putXw(obuf* out, unsigned long data, unsigned width, char pad);
00102 int obuf_putxll(obuf* out, unsigned long long data);
00103 int obuf_putxwll(obuf* out, unsigned long long data, unsigned width, char pad);
00104 int obuf_putXll(obuf* out, unsigned long long data);
00105 int obuf_putXwll(obuf* out, unsigned long long data, unsigned width, char pad);
00106 int obuf_putsnumw(obuf* out, long num, unsigned width, char pad,
00107                   unsigned base, const char* digits);
00108 int obuf_putunumw(obuf* out, unsigned long num, unsigned width, char pad,
00109                   unsigned base, const char* digits);
00110 int obuf_putsllnumw(obuf* out, long long num, unsigned width, char pad,
00111                     unsigned base, const char* digits);
00112 int obuf_putullnumw(obuf* out, unsigned long long num, unsigned width, char pad,
00113                     unsigned base, const char* digits);
00114 int obuf_putnetstring(obuf* out, const char* data, unsigned datalen);
00115 int obuf_sign_pad(obuf* out, int sign, unsigned width, char pad);
00118 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/group__striter.html0000664000076400007640000002435211147311327020004 0ustar bruceguenter bglibs: striter: Iterator over substrings of a str.

striter: Iterator over substrings of a str.


Data Structures

struct  striter

Defines

#define str_copyiter(STR, ITER)   str_copyb(STR,(ITER)->startptr,(ITER)->len)
#define str_catiter(STR, ITER)   str_catb(STR,(ITER)->startptr,(ITER)->len)
#define obuf_putiter(OBUF, ITER)   obuf_write(OBUF,(ITER)->startptr,(ITER)->len)
#define striter_loop(ITER, STR, SEP)   for(striter_start(ITER,STR,SEP);striter_valid(ITER);striter_advance(ITER))

Functions

void striter_start (striter *iter, const struct str *s, char sep)
int striter_valid (striter *)
int striter_advance (striter *)

Detailed Description

Calling Convention
All non-void functions return 0 (false) if the function failed or the iterator is no longer valid, and non-zero (true) otherwise.

Define Documentation

#define obuf_putiter ( OBUF,
ITER   )     obuf_write(OBUF,(ITER)->startptr,(ITER)->len)

Output the current striter substring to an obuf.

#define str_catiter ( STR,
ITER   )     str_catb(STR,(ITER)->startptr,(ITER)->len)

Append the current striter substring to a str.

#define str_copyiter ( STR,
ITER   )     str_copyb(STR,(ITER)->startptr,(ITER)->len)

Assign the current striter substring to a str.

#define striter_loop ( ITER,
STR,
SEP   )     for(striter_start(ITER,STR,SEP);striter_valid(ITER);striter_advance(ITER))

Loop macro; use in place of for(...)


Function Documentation

int striter_advance ( striter iter  ) 

Advance a striter to the next substring.

void striter_start ( striter iter,
const struct str s,
char  sep 
)

Start (initialize) a striter.

int striter_valid ( striter iter  ) 

Determine if a striter is valid (after initialization or advancing).


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/group__crypto.html0000664000076400007640000001664211147311327017633 0ustar bruceguenter bglibs: crypto: Cryptographic routines

crypto: Cryptographic routines


Defines

#define SURF_OUT_U32   8
#define SURF_IN_U32   12
#define SURF_SEED_U32   32
#define SURF_OUT   32
#define SURF_IN   48
#define SURF_SEED   128

Functions

void surf (uint32 out[8], const uint32 in[12], const uint32 seed[32])

Define Documentation

#define SURF_IN   48

The number of bytes used as input by surf

#define SURF_IN_U32   12

The number of 32-bit words used as input by surf

#define SURF_OUT   32

The number of bytes output by surf

#define SURF_OUT_U32   8

The number of 32-bit words output by surf

#define SURF_SEED   128

The number of bytes used as seed data by surf

#define SURF_SEED_U32   32

The number of 32-bit words used as seed data by surf


Function Documentation

void surf ( uint32  out[8],
const uint32  in[12],
const uint32  seed[32] 
)

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.


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/pages.html0000664000076400007640000000237011147311327016030 0ustar bruceguenter bglibs: Page Index

bglibs Related Pages

Here is a list of all related documentation pages:
Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/surfrand_8h-source.html0000664000076400007640000001121311147311327020446 0ustar bruceguenter bglibs: surfrand.h Source File

surfrand.h

00001 #ifndef BGLIBS__SURFRAND__H__
00002 #define BGLIBS__SURFRAND__H__
00003 
00004 #include <crypto/surf.h>
00005 
00010 struct surfrand
00011 {
00014   unsigned used;
00016   uint32 generated[SURF_OUT_U32];
00018   uint32 seed[SURF_SEED_U32];
00020   uint32 counter[SURF_IN_U32];
00021 };
00022 
00023 void surfrand_init(struct surfrand* c, const uint32* data, unsigned words);
00024 uint32 surfrand_uint32(struct surfrand* c);
00025 double surfrand_double(struct surfrand* c);
00026 void surfrand_fill(struct surfrand* c, unsigned char* buf, unsigned len);
00027 
00030 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/number_8h-source.html0000664000076400007640000003014511147311327020117 0ustar bruceguenter bglibs: number.h Source File

number.h

00001 #ifndef FMT__NUMBER__H__
00002 #define FMT__NUMBER__H__
00003 
00051 #define FMT_ULONG_LEN 40
00052 
00053 extern const char fmt_lcase_digits[36];
00054 extern const char fmt_ucase_digits[36];
00055 
00056 extern unsigned fmt_pad(char* buffer, unsigned width, char pad);
00057 extern unsigned fmt_sign_pad(char* buffer, int sign,
00058                              unsigned width, char pad);
00059 
00063 extern unsigned fmt_snumw(char* buffer, long num,
00064                           unsigned width, char pad,
00065                           unsigned base, const char* digits);
00066 extern unsigned fmt_sdec(char* buffer, long num);
00067 extern unsigned fmt_sdecw(char* buffer, long num,
00068                           unsigned width, char pad);
00069 
00075 extern unsigned fmt_sllnumw(char* buffer, long long num,
00076                             unsigned width, char pad,
00077                             unsigned base, const char* digits);
00078 extern unsigned fmt_slldec(char* buffer, long long num);
00079 extern unsigned fmt_slldecw(char* buffer, long long num,
00080                             unsigned width, char pad);
00081 
00087 extern unsigned fmt_unumw(char* buffer, unsigned long num,
00088                           unsigned width, char pad,
00089                           unsigned base, const char* digits);
00090 extern unsigned fmt_udec(char* buffer, unsigned long num);
00091 extern unsigned fmt_udecw(char* buffer, unsigned long num,
00092                           unsigned width, char pad);
00093 extern unsigned fmt_uhex(char* buffer, unsigned long num);
00094 extern unsigned fmt_uhexw(char* buffer, unsigned long num,
00095                           unsigned width, char pad);
00096 extern unsigned fmt_uHex(char* buffer, unsigned long num);
00097 extern unsigned fmt_uHexw(char* buffer, unsigned long num,
00098                           unsigned width, char pad);
00099 
00105 extern unsigned fmt_ullnumw(char* buffer, unsigned long long num,
00106                             unsigned width, char pad,
00107                             unsigned base, const char* digits);
00108 extern unsigned fmt_ulldec(char* buffer, unsigned long long num);
00109 extern unsigned fmt_ulldecw(char* buffer, unsigned long long num,
00110                             unsigned width, char pad);
00111 extern unsigned fmt_ullhex(char* buffer, unsigned long long num);
00112 extern unsigned fmt_ullhexw(char* buffer, unsigned long long num,
00113                             unsigned width, char pad);
00114 extern unsigned fmt_ullHex(char* buffer, unsigned long long num);
00115 extern unsigned fmt_ullHexw(char* buffer, unsigned long long num,
00116                             unsigned width, char pad);
00117 
00122 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/group__envstr.html0000664000076400007640000003254611147311327017635 0ustar bruceguenter bglibs: envstr: Environment variables in a str.

envstr: Environment variables in a str.


Functions

const char * envstr_find (const struct str *env, const char *var, long varlen)
const char * envstr_get (const struct str *env, const char *var)
int envstr_set (struct str *env, const char *var, const char *val, int overwrite)
void envstr_unset (struct str *env, const char *var)
int envstr_put (struct str *env, const char *asgn, int overwrite)
int envstr_from_array (struct str *env, char **array, int overwrite)
int envstr_from_string (struct str *env, const char *s, int overwrite)
char ** envstr_make_array (const struct str *env)

Detailed Description

Calling Convention
All functions that allocate memory return 0 (false) if the function failed due to being unable to allocate memory, and non-zero (true) otherwise.

Function Documentation

const char* envstr_find ( const struct str env,
const char *  var,
long  len 
)

Find the named variable in the environment string.

Returns:
a pointer to the start of the assignment.

int envstr_from_array ( struct str env,
char **  array,
int  overwrite 
)

Adds the assignments from the array of pointers to the environment string. The array must be terminated by a NULL pointer, just the same as the standard environ array.

int envstr_from_string ( struct str env,
const char *  s,
int  overwrite 
)

Adds the string-based list of assignments to the environment string. Each individual assignment in the list must be ASCII NUL terminated, and the final assignment must be followed by two ASCII NULs.

const char* envstr_get ( const struct str env,
const char *  var 
)

Get the value of an assignment from an environment string.

char** envstr_make_array ( const struct str env  ) 

Make a environ compatable array of pointers to the environment string.

Note:
The returned pointer is dynamically allocated, and must be freed.

int envstr_put ( struct str env,
const char *  asgn,
int  overwrite 
)

Put an assignment, in NAME=value format, into the environment string.

Note:
Unlike putenv, a copy of the assignment is made instead of keeping a copy of the given pointer.

int envstr_set ( struct str env,
const char *  var,
const char *  val,
int  overwrite 
)

Set the named variable to the given value in the environment string.

void envstr_unset ( struct str env,
const char *  var 
)

Unset the named variable in the environment string.


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/structipv6addr.html0000664000076400007640000000537611147311327017726 0ustar bruceguenter bglibs: ipv6addr Struct Reference

ipv6addr Struct Reference
[ipv6: IPv6 Address Handling]

#include <ipv6.h>


Data Fields

uint8 addr [16]


Detailed Description

IPv6 address structure.

Field Documentation

uint8 ipv6addr::addr[16]

128-bit IPv4 address, represented as 16 8-bit unsigned chars.


The documentation for this struct was generated from the following file:
Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/group__path.html0000664000076400007640000003001511147311327017235 0ustar bruceguenter bglibs: path: Filename manipulation functions

path: Filename manipulation functions


Defines

#define PATH_MATCH_DOTFILES   1

Functions

int path_merge (str *path, const char *start)
int fnmatch (const char *filename, const char *pattern, unsigned options)
int has_magic (const char *s)
int path_match (const char *pattern, str *result, unsigned options)
int path_contains (const char *path, const char *part)
int path_mktemp (const char *prefix, str *filename)
int path_mkdirs (const char *path, unsigned mode)

Define Documentation

#define PATH_MATCH_DOTFILES   1

Make path_match include files starting with dots.


Function Documentation

int fnmatch ( const char *  filename,
const char *  pattern,
unsigned  options 
)

Matches a path using glob patterns.

int has_magic ( const char *  s  ) 

Does the string have glob characters in it.

Returns true if the given string contains at least one instance of either *, ?, or [.

int path_contains ( const char *  path,
const char *  part 
)

Test if a path contains a component.

Returns true if the path contains 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_match ( const char *  pattern,
str result,
unsigned  options 
)

Matches the pattern against existing files.

This function produces a list of existing files in result (in the current directory) that match the given pattern. If options has PATH_MATCH_DOTFILES set, the result may contain paths starting with ".".

int path_merge ( str path,
const char *  start 
)

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_mkdirs ( const char *  path,
unsigned  mode 
)

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 "<tt>mkdir -p</tt>" command, this function will result in an error if the path already exists.

int path_mktemp ( const char *  prefix,
str filename 
)

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.


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/annotated.html0000664000076400007640000000630711147311327016712 0ustar bruceguenter bglibs: Data Structures

bglibs Data Structures

Here are the data structures with brief descriptions:
ghash
ghashiter
gqueue
gqueue_node
gstack
gstack_node
ibuf
iobuf
ipv4addr
ipv6addr
obuf
str
str_sortentry
striter
surfrand

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/deprecated.html0000664000076400007640000000257611147311327017041 0ustar bruceguenter bglibs: Deprecated List

Deprecated List

Global ipv4_parse
This function is a wrapper for ipv4_scan.


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/adt_2gstack__test_8c-example.html0000664000076400007640000000532211147311327022340 0ustar bruceguenter bglibs: adt/gstack_test.c

adt/gstack_test.c

#include <stdlib.h>
#include <string.h>

#include "gstack.h"

#ifdef SELFTEST_MAIN
#include "selftest.c"

GSTACK_DECL(test,int);
GSTACK_DEFN(test,int,0,0);
static struct gstack stack;

MAIN
{
  int i;
  int* p;
  for (i = 0; i < 4; ++i)
    debugfn(test_push(&stack, &i));
  while ((p = test_top(&stack)) != 0) {
    obuf_puti(&outbuf, *p); NL();
    test_pop(&stack);
  }
}

#endif
#ifdef SELFTEST_EXP
result=1
result=1
result=1
result=1
3
2
1
0
#endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/group__installer.html0000664000076400007640000000666011147311327020307 0ustar bruceguenter bglibs: bg-installer: Standardzied installer program

bg-installer: Standardzied installer program

The program bg-installer reads an installation instruction file from standard input, and executes the instructions in the directory named on the command line.

Each line in the file is an individual instruction. Blank lines and lines beginning with # are ignored. Lines beginning with >, if present, instruct bg-installer as to which base directory to use (see below). All other lines must have following format:

CMD:[OWNER]:[GROUP]:MODE:DIR[:FILENAME[:SOURCE]]

  • CMD 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 SOURCE as the filename to test.
  • OWNER (optional) is the owner user ID or name for the target file.
  • GROUP (optional) is the group ID or name for the target file.
  • MODE is the permissions of the installed file in octal.
  • DIR is the subdirectory of the installation prefix for the destination file.
  • FILENAME (optional) is the name of the file to install into the directory. It may be omitted for directories.
  • SOURCE (optional) is the name of the source file to install, if it differs from the destination file, or the path in the symlink.

The target filename is PREFIX/TOP/DIR/FILENAME where PREFIX is the value of $install_prefix if it is set, TOP is the directory given on the command line, and DIR and FILENAME given in the installation file.

  • c lines copy regular files from the current directory
  • d lines create directories
  • s lines create symlinks (UID, GID, and MODE are ignored)
  • l lines copy libraries using libtool

When bg-installer encounters a base directory directive, as indicated above, it opens the file named conf-BASE (where BASE is the word on the directive line), reads the first line, and uses that as the base directory (prefixed by $install_prefix as above).


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/nonblock_8h-source.html0000664000076400007640000000356611147311327020443 0ustar bruceguenter bglibs: nonblock.h Source File

nonblock.h

00001 #ifndef UNIX__NONBLOCK__H__
00002 #define UNIX__NONBLOCK__H__
00003 
00004 int nonblock_on(int fd);
00005 int nonblock_off(int fd);
00006 
00007 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/gqueue_8h-source.html0000664000076400007640000001705711147311327020131 0ustar bruceguenter bglibs: gqueue.h Source File

gqueue.h

00001 #ifndef BGLIBS__GENERIC_QUEUE__H__
00002 #define BGLIBS__GENERIC_QUEUE__H__
00003 
00004 #include <adt/common.h>
00005 
00020 struct gqueue_node
00021 {
00023   struct gqueue_node* next;
00025   char data[0];
00026 };
00027 
00029 struct gqueue
00030 {
00032   struct gqueue_node* head;
00034   struct gqueue_node* tail;
00036   unsigned count;
00037 };
00038 
00039 int gqueue_push(struct gqueue* d, unsigned datasize, const void* data,
00040                 adt_copy_fn* fn);
00041 void* gqueue_top(const struct gqueue* q);
00042 void gqueue_pop(struct gqueue* q, adt_free_fn* fn);
00043 
00045 #define GQUEUE_DECL(PREFIX,TYPE) \
00046 extern int PREFIX##_push(struct gqueue* q, TYPE const* data); \
00047 extern TYPE* PREFIX##_top(struct gqueue* q); \
00048 extern void PREFIX##_pop(struct gqueue* q);
00049 
00051 #define GQUEUE_PUSH_DEFN(PREFIX,TYPE,COPY) \
00052 int PREFIX##_push(struct gqueue* q, TYPE const* data) { \
00053   return gqueue_push(q, sizeof *data, data, (adt_copy_fn*)COPY); \
00054 }
00055 
00057 #define GQUEUE_TOP_DEFN(PREFIX,TYPE) \
00058 TYPE* PREFIX##_top(struct gqueue* q) { \
00059   return (q->head == 0) ? 0 : (TYPE*)q->head->data; \
00060 }
00061 
00063 #define GQUEUE_POP_DEFN(PREFIX,FREE) \
00064 void PREFIX##_pop(struct gqueue* q) { \
00065   gqueue_pop(q, (adt_free_fn*)(FREE)); \
00066 }
00067 
00071 #define GQUEUE_DEFN(PREFIX,TYPE,COPY,FREE) \
00072 GQUEUE_PUSH_DEFN(PREFIX,TYPE,COPY) \
00073 GQUEUE_TOP_DEFN(PREFIX,TYPE) \
00074 GQUEUE_POP_DEFN(PREFIX,FREE)
00075 
00078 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/structstr.html0000664000076400007640000001060611147311327017007 0ustar bruceguenter bglibs: str Struct Reference

str Struct Reference
[str: Dynamically allocated string library.]

#include <str.h>


Data Fields

char * s
unsigned len
unsigned size


Detailed Description

The basic string structure.
Note:
Initialize to {0,0,0}.

Field Documentation

char* str::s

The pointer to the allocated data. This string will always be terminated with a NUL byte to ensure compatibility with standard C string functions. May be used directly by programs, but should not be assigned.

unsigned str::len

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 str::size

The size of the above block.


The documentation for this struct was generated from the following file:
Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/tabs.css0000664000076400007640000000333611147311327015511 0ustar bruceguenter/* tabs styles, based on http://www.alistapart.com/articles/slidingdoors */ DIV.tabs { float : left; width : 100%; background : url("tab_b.gif") repeat-x bottom; margin-bottom : 4px; } DIV.tabs UL { margin : 0px; padding-left : 10px; list-style : none; } DIV.tabs LI, DIV.tabs FORM { display : inline; margin : 0px; padding : 0px; } DIV.tabs FORM { float : right; } DIV.tabs A { float : left; background : url("tab_r.gif") no-repeat right top; border-bottom : 1px solid #84B0C7; font-size : x-small; font-weight : bold; text-decoration : none; } DIV.tabs A:hover { background-position: 100% -150px; } DIV.tabs A:link, DIV.tabs A:visited, DIV.tabs A:active, DIV.tabs A:hover { color: #1A419D; } DIV.tabs SPAN { float : left; display : block; background : url("tab_l.gif") no-repeat left top; padding : 5px 9px; white-space : nowrap; } DIV.tabs INPUT { float : right; display : inline; font-size : 1em; } DIV.tabs TD { font-size : x-small; font-weight : bold; text-decoration : none; } /* Commented Backslash Hack hides rule from IE5-Mac \*/ DIV.tabs SPAN {float : none;} /* End IE5-Mac hack */ DIV.tabs A:hover SPAN { background-position: 0% -150px; } DIV.tabs LI.current A { background-position: 100% -150px; border-width : 0px; } DIV.tabs LI.current SPAN { background-position: 0% -150px; padding-bottom : 6px; } DIV.nav { background : none; border : none; border-bottom : 1px solid #84B0C7; } bglibs-1.106/doc/html/iobuf_2common_8h-source.html0000664000076400007640000002273111147311327021367 0ustar bruceguenter bglibs: common.h Source File

iobuf/common.h

00001 #ifndef IO_BUF__COMMON__H__
00002 #define IO_BUF__COMMON__H__
00003 
00004 #include <fcntl.h>
00005 
00006 #define LF ((char)10)
00007 #define CR ((char)13)
00008 #define CRLF "\015\012"
00009 
00010 struct str;
00011 
00025 #define IOBUF_EOF 1
00026 
00027 #define IOBUF_ERROR 2
00028 
00029 #define IOBUF_TIMEOUT 4
00030 
00031 #define IOBUF_BADFLAGS 0xf
00032 
00033 #define IOBUF_SEEKABLE 0x10
00034 
00035 #define IOBUF_NEEDSCLOSE 0x20
00036 
00037 #define IOBUF_NEEDSFREE 0x40
00038 
00039 #define IOBUF_NEEDSMUNMAP 0x80
00040 extern unsigned iobuf_bufsize;
00041 
00048 struct iobuf
00049 {
00051   int fd;
00053   char* buffer;
00055   unsigned bufsize;
00057   unsigned buflen;
00059   unsigned bufstart;
00061   unsigned offset;
00063   unsigned timeout;
00065   unsigned flags;
00067   int errnum;
00068 };
00069 typedef struct iobuf iobuf;
00070 
00072 #define IOBUF_SET_ERROR(io) \
00073 do{ \
00074   io->flags |= IOBUF_ERROR; \
00075   io->errnum = errno; \
00076   return 0; \
00077 }while(0)
00078 
00079 int iobuf_init(iobuf* io, int fd, unsigned bufsize, char* buffer,
00080                unsigned flags);
00081 int iobuf_close(iobuf* io);
00083 #define iobuf_closed(io) ((io)->fd == -1)
00084 
00085 #define iobuf_error(io) ((io)->flags & IOBUF_ERROR)
00086 
00087 #define iobuf_timedout(io) ((io)->flags & IOBUF_TIMEOUT)
00088 
00089 #define iobuf_bad(io) ((io)->flags & IOBUF_BADFLAGS)
00090 int iobuf_timeout(iobuf* io, int poll_out);
00095 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/group__adt__ghash.html0000664000076400007640000017365611147311327020405 0ustar bruceguenter bglibs: adt ghash: Generic hash tables.

adt ghash: Generic hash tables.


Data Structures

struct  ghash
struct  ghashiter

Defines

#define ghash_entry_hash(P)   (*(adt_hash_t*)(P))
#define ghash_entry_keyptr(P)   ((P)+sizeof(adt_hash_t))
#define ghash_entry_dataptr(P, L)   ((P)+sizeof(adt_hash_t)+(L))
#define ghash_hashb   adt_hashb
#define ghash_hashs   adt_hashs
#define ghash_hashsp   adt_hashsp
#define GHASH_STRUCT_ENTRY(PREFIX, KTYPE, DTYPE)
#define GHASH_KEYOFFSET(PREFIX)   ((unsigned long)&((struct PREFIX##_entry*)0)->key)
#define GHASH_DATAOFFSET(PREFIX)   ((unsigned long)&((struct PREFIX##_entry*)0)->data)
#define GHASH_KEYSIZE(PREFIX)
#define GHASH_DECL(PREFIX, KTYPE, DTYPE)
#define GHASH_INIT_DEFN(PREFIX, KTYPE, DTYPE, HASHFN, CMP, KCOPY, DCOPY, KFREE, DFREE)
#define GHASH_FREE_DEFN(PREFIX)
#define GHASH_ADD_DEFN(PREFIX, KTYPE, DTYPE)
#define GHASH_SET_DEFN(PREFIX, KTYPE, DTYPE)
#define GHASH_GET_DEFN(PREFIX, KTYPE)
#define GHASH_REBUILD_DEFN(PREFIX)
#define GHASH_REHASH_DEFN(PREFIX)
#define GHASH_REMOVE_DEFN(PREFIX, KTYPE)
#define GHASH_FOREACH_DEFN(PREFIX)
#define GHASH_SEARCH_DEFN(PREFIX)
#define GHASH_DEFN(PREFIX, KTYPE, DTYPE, HASHFN, CMPFN, KCOPY, DCOPY, KFREE, DFREE)
#define ghashiter_loop(I, G)   for(ghashiter_first(I,G);ghashiter_valid(I);ghashiter_next(I))

Functions

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))
void ghashiter_first (struct ghashiter *, const struct ghash *)
int ghashiter_valid (const struct ghashiter *)
void ghashiter_next (struct ghashiter *)

Detailed Description

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 ghash implementation contains pointers to the actual data (including all relevant metadata) plus function pointers to the functions needed to manipulate the data.


Define Documentation

#define GHASH_ADD_DEFN ( PREFIX,
KTYPE,
DTYPE   ) 

Value:

struct PREFIX##_entry* PREFIX##_add(struct ghash* d, \
                                    KTYPE const* key, DTYPE const* data) { \
  return ghash_add(d, key, data); \
}
Define a specialized ghash table add function.

#define GHASH_DATAOFFSET ( PREFIX   )     ((unsigned long)&((struct PREFIX##_entry*)0)->data)

The offset of the data into a specialized ghash entry.

#define GHASH_DECL ( PREFIX,
KTYPE,
DTYPE   ) 

Value:

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*));
Declare all the prototypes for a ghash table, specialized to particular key and data types.
Examples:
adt/ghash_test.c.

#define GHASH_DEFN ( PREFIX,
KTYPE,
DTYPE,
HASHFN,
CMPFN,
KCOPY,
DCOPY,
KFREE,
DFREE   ) 

Value:

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)
Define all necessary functions for a specialized ghash table. If either of the copy functions KCOPY or DCOPY are NULL, a simple memcpy is used instead. If either of the free functions KFREE or DFREE are NULL, no data freeing is attempted.
Examples:
adt/ghash_test.c.

#define ghash_entry_dataptr ( P,
 )     ((P)+sizeof(adt_hash_t)+(L))

The data structure address within an entry P . The offset parameter L is the size of the key structure.

#define ghash_entry_hash (  )     (*(adt_hash_t*)(P))

The hash value stored within an entry P .

#define ghash_entry_keyptr (  )     ((P)+sizeof(adt_hash_t))

The key structure address within an entry P .

#define GHASH_FOREACH_DEFN ( PREFIX   ) 

Value:

void PREFIX##_foreach(struct ghash* d, void (*fn)(struct PREFIX##_entry*)) { \
  ghash_foreach(d, (void (*)(void*))fn); \
}
Define a specialized ghash table iterator function.

#define GHASH_FREE_DEFN ( PREFIX   ) 

Value:

void PREFIX##_free(struct ghash* d) { \
  ghash_free(d); \
}
Define a specialized ghash table free function.

#define GHASH_GET_DEFN ( PREFIX,
KTYPE   ) 

Value:

struct PREFIX##_entry* PREFIX##_get(struct ghash* d, KTYPE const* key) { \
  return ghash_get(d, key); \
}
Define a specialized ghash table get function.

#define ghash_hashb   adt_hashb

The adt_hashb function also works for ghash

#define ghash_hashs   adt_hashs

The adt_hashs function also works for ghash

#define ghash_hashsp   adt_hashsp

The adt_hashsp function also works for ghash

#define GHASH_INIT_DEFN ( PREFIX,
KTYPE,
DTYPE,
HASHFN,
CMP,
KCOPY,
DCOPY,
KFREE,
DFREE   ) 

Value:

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 ghash table init function.

#define GHASH_KEYOFFSET ( PREFIX   )     ((unsigned long)&((struct PREFIX##_entry*)0)->key)

The offset of the key into a specialized ghash entry.

#define GHASH_KEYSIZE ( PREFIX   ) 

Value:

( \
  GHASH_DATAOFFSET(PREFIX)-GHASH_KEYOFFSET(PREFIX) \
)
The actual size of the key data in a specialized ghash entry.

#define GHASH_REBUILD_DEFN ( PREFIX   ) 

Value:

int PREFIX##_rebuild(struct ghash* d) { \
  return ghash_rebuild(d); \
}
Define a specialized ghash table rebuild function.

#define GHASH_REHASH_DEFN ( PREFIX   ) 

Value:

int PREFIX##_rehash(struct ghash* d) { \
  return ghash_rehash(d); \
}
Define a specialized ghash table rehash function.

#define GHASH_REMOVE_DEFN ( PREFIX,
KTYPE   ) 

Value:

extern int PREFIX##_remove(struct ghash* d, KTYPE const* key) { \
  return ghash_remove(d, (void*)key); \
}
Define a specialized ghash table remove function.

#define GHASH_SEARCH_DEFN ( PREFIX   ) 

Value:

struct PREFIX##_entry* PREFIX##_search(struct ghash* d, int (*fn)(const struct PREFIX##_entry*)) { \
  return ghash_search(d, (int (*)(const void*))fn); \
}
Define a specialized ghash table search function.

#define GHASH_SET_DEFN ( PREFIX,
KTYPE,
DTYPE   ) 

Value:

struct PREFIX##_entry* PREFIX##_set(struct ghash* d, \
                                    KTYPE const* key, DTYPE const* data) { \
  return ghash_set(d, key, data); \
}
Define a specialized ghash table add function.

#define GHASH_STRUCT_ENTRY ( PREFIX,
KTYPE,
DTYPE   ) 

Value:

struct PREFIX##_entry { \
  adt_hash_t hash; \
  KTYPE key; \
  DTYPE data; \
}
Prototype for the ghash entry structure, containing a key of type KTYPE and data of type DTYPE .

#define ghashiter_loop ( I,
 )     for(ghashiter_first(I,G);ghashiter_valid(I);ghashiter_next(I))

A convenience macro which expands to a for loop using the ghashiter I to iterate over the table G .

Examples:
adt/ghash_test.c.


Function Documentation

void* ghash_add ( struct ghash d,
const void *  key,
const void *  data 
)

Add an entry into a generic hash table. This function adds a new entry into the given hash table. If the table is too small to provide sufficient slots for efficient access, the table is automatically expanded to the next larger size and all the existing entries are copied over.

void** ghash_find ( struct ghash d,
const void *  key 
)

Find an entry in a ghash table.

Returns:
A pointer to the entry structure, or NULL if the key was not found.

void ghash_foreach ( struct ghash d,
void(*)(void *entry)  fn 
)

Iterate over a ghash table, calling a function for each entry.

void ghash_free ( struct ghash d  ) 

Free all data (and entries) in a ghash table.

void* ghash_get ( struct ghash d,
const void *  key 
)

Find an entry in a ghash table.

Returns:
A pointer to the data structure or NULL if the key was not found.

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 
)

Initialize an empty ghash table.

void ghash_insert ( struct ghash d,
void *  e 
)

Insert an entry into a ghash table, without resizing it.

int ghash_rebuild ( struct ghash d  ) 

Rebuild the entry pointer table in a ghash table. This function is used internally after either rehashing the table or removing an entry.

int ghash_rehash ( struct ghash d  ) 

Regenerate all the hash values in a ghash table and then rebuild it. Use this function when any of the keys change value.

int ghash_remove ( struct ghash d,
const void *  key 
)

Remove an entry from a ghash table. This function attempts to do the minimum amount of rebuilding necessary to adjust the positions of entries that may fall in the same slot as the newly removed entry.

Returns:
True if the entry was found (and removed), false otherwise.
Examples:
adt/ghash_test.c.

void* ghash_search ( struct ghash d,
int(*)(const void *entry)  fn 
)

Search for the first entry in the ghash table for which the given function returns true.

void* ghash_set ( struct ghash d,
const void *  key,
const void *  data 
)

Replace or add an entry into a generic hash table.

Examples:
adt/ghash_test.c.

void ghashiter_first ( struct ghashiter iter,
const struct ghash h 
)

Set a ghash iterator to the first element in the table.

void ghashiter_next ( struct ghashiter iter  ) 

Advance the ghash iterator to the next element in the table.

int ghashiter_valid ( const struct ghashiter iter  ) 

Check if the ghash iterator is still valid.


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/tab_r.gif0000664000076400007640000000503111147311327015616 0ustar bruceguenterGIF89a,Õö÷ùñô÷öøúüýþúûüùúûøùúêïóïóöÆÕßÒÞæØâéÞçíÝæìåìñèîòô÷ùóöø³ÈÕÁÒÝËÙâÏÜäÖá薴ŹɯÂÍ»ÎÙÃÔÞÂÓÝÈ×àÌÚâÕáèÙäê×âèåìðëðó„°ÇÑÞåÜæëãëïëñôîóõ÷úûûüüÿÿÿþþþ,,ÿ@’pH,ȤrÉl:ŸÐ¨tJ­Z¯Ø¬v •h<¬pkL.›Ïè´zÍn»ßð¸|N¯Ûïø¼~ÏwVa+‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ “*)^,*ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂö)'ÆÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæÚ¥(" ðñòóôõö÷øùúûüýþÿ H° ÁƒòK"ƒRHœH±¢Å‹3jÜȱ£Ç CŠI²¤É“(Sª\éÅu&@€ Á²¦Í›8sêÜɳ§Oÿ–(±€DУH“*]Ê´©Ó§P£JJµªÕ«X³jÝʵ«×¯S84± ‰hÓª]˶­Û·pãÊK·®Ý»xóêÝË·¯ß¿€Ó} âDÌf(^̸±ãÇ#KžL¹²å˘3kÞ̹³çÏ C‹m¹ðCÄHœXͺµë×°cËžM»¶íÛ¸sëÞÍ»·ïßÀƒ N÷ÃJ” Á®¹óçУKŸN½ºõëØ³kßν»÷ïàËO¾úñ€ dÇ@€‚‚L¤"ÉÈF:ò‘Œ¤$9† (8…&ÉÉNzò“  ¥(G©FB^²!˨)WÉÊVºò•°l¤)1™ wÄò–¸Ì¥.wÊYºäƒà¥0‡IÌbó¾|ÉHpÌf:ó™Ðìe pJ±ˆ€}Ȧ6·ÉÍnzó›à §8û0Â%"¸æ8×ÉÎvºóðŒ§<ÉPÎQ`ò%×$€>÷ÉÏ~úóŸ ¨@JЂô M¨BÊІ:ô¡¨D'ZPKF Ö¼&16ÊÑŽzô£ ©HGJRb ÷Lç5ÏÁÒ–ºô¥ÿ0©LgJÓšš#(e>¯‰Óžúô§@ ªP‡JÔ¢õ¨HMªR—ÊÔ¦:õ©PªT§JÕª&5;%U·ÊÕ®zõ«` «XÇJV«ÂC§‹ÑjY×ÊÖ¶ºõ­p«\ŠU´À¦xÍ«^÷Ê×¾úõ¯ÐÀi)$‚”ô°ˆM¬bËØÆ:vˆ, ಘͬf7ËÙÎzö³  ­hGKÚÒšö´¨M­jWËÚÖºöµ°­*$ÛSPô¶¸Í­nwËÛÞúö·ÀÅm +„â¸ÈM®r—ËÜæ:÷¹ÐE®?±9ÏêZ÷ºØÍ®v¿9€î"‚ºÛ ¯xÇKÞòb—™ÑLÿ¯z×Ë^A¢·½ð¯|ç†÷Ò÷¾øÍ¯0í«ßþú÷¿¡ä/€Là»×ÀN°‚ï(à;øÁ n0„'LaýJ¸ÂÎ0{/¬á{ؘþ°ˆG|Ë“øÄ(¥‰SÌâCrÅ.ޱŒ ãÛøÆv¬1ŽwÌc6ê¸Ç@ÞñƒLd¹ÈHNñ‘“Ìd/¹ÉPÎð“£LeO¹ÊXŽp–·|â+sùËýõ2˜ÇL_1“ùÌí53š×M5³ùÍÇt3œç¼_:ÛÙÂwÎs™õÌgøÊ¹Ï€p ýÌ?úÐ/F´¢ë¼èFãÒÐŽŽt!-éJã‘Ò–Îô1­éN»‘ÓžuÿA-êP“ºÔ>5ª3­êUWºÕ®Ž4¬cÝèYÓZѶ¾õ¡s­ëAóº×€þ5°ù,ìaç¹ØÆ¶3²“=çe3ûÍÎ~öš£-í3S»Úc¾6¶¿¬ímo¹ÛÞÆ2¸ÃMåq“Êæ>7“Ó­n$³»ÝD~7¼,ïyó¸ÞöÆ1¾ómã}óÛÈÿvµ¿Þâ\É/µÁNâ…3ÜÉ÷´Ã#Þá‰S\ÊguÆ-mñO¸ã0ÈC¾à‘“\Ë'_´ÉS^à•³|À.ùc.ó0לÐ4¿9~s®ó=÷¼Ï<ÿy|ƒ.ô4]ÏD?ºz“®ô67]ÙO§3Ó£ÞÌ©SÄW‡vÖÙl>õ­3Úëdî:Øu)ö±?ÚìÙF;˜Ë®öW²½í­|;ÜW)÷¹²îvtÞ˽w¾÷Ý|à×=xÂÞÝA;bglibs-1.106/doc/html/group__trigger.html0000664000076400007640000001323411147311327017750 0ustar bruceguenter bglibs: trigger: Safe external event notification

trigger: Safe external event notification


Defines

#define trigger_pulled(IO)   ((IO)->revents)

Functions

int trigger_set (iopoll_fd *io, const char *path)
void trigger_pull (const char *path)

Detailed Description

The 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.


Define Documentation

#define trigger_pulled ( IO   )     ((IO)->revents)

Determine if a trigger has been pulled, after a polling loop indicates activity.


Function Documentation

void trigger_pull ( const char *  path  ) 

Activate a trigger.

int trigger_set ( iopoll_fd *  io,
const char *  path 
)

Set up a trigger for polling.

The passed iopoll_fd must have at least two slots, as the second slot may be required in the event the OS exhibits the "named pipe bug". This function must be called every time the trigger is pulled to reset the trigger's state.


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/functions.html0000664000076400007640000002136011147311327016741 0ustar bruceguenter bglibs: Data Fields

Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:

- a -

- b -

- c -

- d -

- e -

- f -

- g -

- h -

- i -

- k -

- l -

- n -

- o -

- r -

- s -

- t -

- u -

- w -


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/group__fmt.html0000664000076400007640000013624411147311327017102 0ustar bruceguenter bglibs: fmt: Formatting Functions

fmt: Formatting Functions


Miscelaneous formatting

unsigned fmt_char (char *buffer, int ch, unsigned width, char pad)
unsigned fmt_mem (char *buffer, const char *s, unsigned length, unsigned width, char pad)
unsigned fmt_chars (char *buffer, const char *s, unsigned width, char pad)
unsigned fmt_str (char *buffer, const struct str *s, unsigned width, char pad)

Multiple item formatting

unsigned fmt_multi (char *buffer, const char *format,...)
unsigned fmt_multiv (char *buffer, const char *format, va_list ap)

Signed integer conversions

unsigned fmt_snumw (char *buffer, long num, unsigned width, char pad, unsigned base, const char *digits)
unsigned fmt_sdec (char *buffer, long num)
unsigned fmt_sdecw (char *buffer, long num, unsigned width, char pad)

Signed long long integer conversions

unsigned fmt_sllnumw (char *buffer, long long num, unsigned width, char pad, unsigned base, const char *digits)
unsigned fmt_slldec (char *buffer, long long num)
unsigned fmt_slldecw (char *buffer, long long num, unsigned width, char pad)

Unsigned integer conversions

unsigned fmt_unumw (char *buffer, unsigned long num, unsigned width, char pad, unsigned base, const char *digits)
unsigned fmt_udec (char *buffer, unsigned long num)
unsigned fmt_udecw (char *buffer, unsigned long num, unsigned width, char pad)
unsigned fmt_uhex (char *buffer, unsigned long num)
unsigned fmt_uhexw (char *buffer, unsigned long num, unsigned width, char pad)
unsigned fmt_uHex (char *buffer, unsigned long num)
unsigned fmt_uHexw (char *buffer, unsigned long num, unsigned width, char pad)

Unsigned long long integer conversions

unsigned fmt_ullnumw (char *buffer, unsigned long long num, unsigned width, char pad, unsigned base, const char *digits)
unsigned fmt_ulldec (char *buffer, unsigned long long num)
unsigned fmt_ulldecw (char *buffer, unsigned long long num, unsigned width, char pad)
unsigned fmt_ullhex (char *buffer, unsigned long long num)
unsigned fmt_ullhexw (char *buffer, unsigned long long num, unsigned width, char pad)
unsigned fmt_ullHex (char *buffer, unsigned long long num)
unsigned fmt_ullHexw (char *buffer, unsigned long long num, unsigned width, char pad)

Defines

#define FMT_ULONG_LEN   40

Functions

unsigned fmt_pad (char *buffer, unsigned width, char pad)
unsigned fmt_sign_pad (char *buffer, int sign, unsigned width, char pad)

Variables

const char fmt_lcase_digits [36]
const char fmt_ucase_digits [36]

Detailed Description

Function Naming
  1. Prefix
    • fmt_ : Always present
  2. Data type
    • s : Signed integer (long)
    • u : Unsigned integer (long)
    • sll : Signed long long integer
    • ull : Unsigned long long integer
  3. Conversion type
    • num : Generic number
    • dec : Decimal
    • hex : Hexadecimal (lower case)
    • Hex : Hexadecimal (upper case)
  4. Width / Padding
    • w : (optional) Pad out the result to a minimum width

For example, fmt_sdecw formats a signed integer using decimal with width padding.

Calling Convention
Parameters to the fmt functions are passed in the following order. The presence of all parameters, except for buffer, is dependant on which function is being used.

  1. buffer : The character string into which to put the data result. If this is NULL, no data is written, and only the length is calculated. This is useful for determining how long a formatted string might be.
  2. number or data : The input data item to convert.
  3. width : The minimum output width.
  4. pad : The character with which to pad the output.
  5. base : The numerical base to use.
  6. digits : The array of digits to use.

Return Value
All fmt functions return the number of bytes written to the buffer space.

Define Documentation

#define FMT_ULONG_LEN   40

The maximum space used by a formatted number. This value is long enough for 2^128 plus a trailing NUL byte.


Function Documentation

unsigned fmt_char ( char *  buffer,
int  ch,
unsigned  width,
char  pad 
)

Format a single character

unsigned fmt_multi ( char *  buffer,
const char *  format,
  ... 
)

Format multiple items.

The 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:

#
Use an "alternate form" to convert the value. For octal conversion, the result is prefixed with a 0 . For hexadecimal conversion, the result is prefixed with either 0x or 0X depending on the conversion type.

-
(not implemented) Pad on the right (left justified) instead of on the left (default right justified).

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:

l
The following conversion uses a long integer type.

ll
The following conversion uses a long long integer type.

Conversion specifier.

d
i
The int argument is converted to a signed decimal string.

o
u
x
X
The unsigned int argument is converted to a unsigned octal, unsigned decimal, lowercase unsigned hexadecimal, or uppercase unsigned hexadecimal string respectively.

c
The int argument is converted to an unsigned char.

s
The const char* argument is converted.

S
The const str* argument is converted.

p
The void* argument is converted to a hexadecimal string.

m
The result of strerror(errno) is formatted.

\
The next character literal from the format string is converted as with c conversion.

{string}
The literal string enclosed by the parenthesis is converted as with s conversion.

unsigned fmt_multiv ( char *  buffer,
const char *  format,
va_list  ap 
)

Format multiple items, using a va_list.

This is the core function used to format multiple items.

unsigned fmt_pad ( char *  buffer,
unsigned  width,
char  pad 
)

Format a pad character.

unsigned fmt_sdec ( char *  buffer,
long  num 
)

Format a signed integer as decimal.

unsigned fmt_sdecw ( char *  buffer,
long  num,
unsigned  width,
char  pad 
)

Format a signed integer as decimal with padding.

unsigned fmt_sign_pad ( char *  buffer,
int  sign,
unsigned  width,
char  pad 
)

Format padding for a signed number.

unsigned fmt_slldec ( char *  buffer,
long long  num 
)

Format a signed long long integer as decimal.

unsigned fmt_slldecw ( char *  buffer,
long long  num,
unsigned  width,
char  pad 
)

Format a signed long long integer as decimal with padding.

unsigned fmt_sllnumw ( char *  buffer,
long long  num,
unsigned  width,
char  pad,
unsigned  base,
const char *  digits 
)

Format a signed long long integer of arbitrary base with optional padding.

unsigned fmt_snumw ( char *  buffer,
long  num,
unsigned  width,
char  pad,
unsigned  base,
const char *  digits 
)

Format a signed integer of arbitrary base with optional padding.

unsigned fmt_udec ( char *  buffer,
unsigned long  num 
)

Format an unsigned integer as decimal.

unsigned fmt_udecw ( char *  buffer,
unsigned long  num,
unsigned  width,
char  pad 
)

Format an unsigned integer as decimal with padding.

unsigned fmt_uHex ( char *  buffer,
unsigned long  num 
)

Format an unsigned integer as (upper-case) hexadecimal.

unsigned fmt_uhex ( char *  buffer,
unsigned long  num 
)

Format an unsigned integer as (lower-case) hexadecimal.

unsigned fmt_uHexw ( char *  buffer,
unsigned long  num,
unsigned  width,
char  pad 
)

Format an unsigned integer as (upper-case) hexadecimal with padding.

unsigned fmt_uhexw ( char *  buffer,
unsigned long  num,
unsigned  width,
char  pad 
)

Format an unsigned integer as (lower-case) hexadecimal with padding.

unsigned fmt_ulldec ( char *  buffer,
unsigned long long  num 
)

Format an unsigned long long integer as decimal.

unsigned fmt_ulldecw ( char *  buffer,
unsigned long long  num,
unsigned  width,
char  pad 
)

Format an unsigned long long integer as decimal with padding.

unsigned fmt_ullHex ( char *  buffer,
unsigned long long  num 
)

Format an unsigned long long integer as (upper-case) hexadecimal.

unsigned fmt_ullhex ( char *  buffer,
unsigned long long  num 
)

Format an unsigned long long integer as hexadecimal.

unsigned fmt_ullHexw ( char *  buffer,
unsigned long long  num,
unsigned  width,
char  pad 
)

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 
)

Format an unsigned long long integer as hexadecimal with padding.

unsigned fmt_ullnumw ( char *  buffer,
unsigned long long  num,
unsigned  width,
char  pad,
unsigned  base,
const char *  digits 
)

Format an unsigned long long integer of arbitrary base with optional padding.

unsigned fmt_unumw ( char *  buffer,
unsigned long  num,
unsigned  width,
char  pad,
unsigned  base,
const char *  digits 
)

Format an unsigned integer of arbitrary base with optional padding.


Variable Documentation

const char fmt_lcase_digits[36]

Array of digits for lower-case conversions

const char fmt_ucase_digits[36]

Array of digits for upper-case conversions


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/files.html0000664000076400007640000001322511147311327016034 0ustar bruceguenter bglibs: File Index

bglibs File List

Here is a list of all documented files with brief descriptions:
cloexec.h [code]
cmsg.h [code]
adt/common.h [code]
iobuf/common.h [code]
env.h [code]
fcntl.h [code]
ghash.h [code]
gqueue.h [code]
gstack.h [code]
hmac.h [code]
ibuf.h [code]
installer.h [code]
iobuf.h [code]
ipv4.h [code]
ipv6.h [code]
iter.h [code]
md4.h [code]
md5.h [code]
misc.h [code]
multi.h [code]
nonblock.h [code]
number.h [code]
obuf.h [code]
path.h [code]
resolve.h [code]
selfpipe.h [code]
sha1.h [code]
sha256.h [code]
sha384.h [code]
sha512.h [code]
sig.h [code]
signalfd.h [code]
socket.h [code]
str.h [code]
surf.h [code]
surfrand.h [code]
trigger.h [code]

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/group__ipv4.html0000664000076400007640000002555111147311327017174 0ustar bruceguenter bglibs: ipv4: IPv4 Address Handling

ipv4: IPv4 Address Handling


Data Structures

struct  ipv4addr

Typedefs

typedef uint16 ipv4port

Functions

int ipv4_parse (const char *s, ipv4addr *addr, const char **end) __attribute__((__deprecated__))
const char * ipv4_scan (const char *s, ipv4addr *addr)
const char * ipv4_format (const ipv4addr *addr)
unsigned fmt_ipv4addr (char *buffer, const ipv4addr *addr)

Variables

const ipv4addr IPV4ADDR_ANY
const ipv4addr IPV4ADDR_BROADCAST
const ipv4addr IPV4ADDR_LOOPBACK

Typedef Documentation

typedef uint16 ipv4port

IPv4 port number.


Function Documentation

unsigned fmt_ipv4addr ( char *  buffer,
const ipv4addr addr 
)

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 NUL byte.

Returns:
The number of bytes written to the buffer.
Note:
This routine is thread and recursion safe.

const char* ipv4_format ( const ipv4addr addr  ) 

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.

int ipv4_parse ( const char *  start,
ipv4addr addr,
const char **  end 
)

Parse an IPv4 address.

Deprecated:
This function is a wrapper for ipv4_scan.
Returns:
Non-zero (true) if parsing succeeded, and sets *end to the first character past the end of the address.

const char* ipv4_scan ( const char *  start,
ipv4addr addr 
)

Scan a C string for an IPv4 address.

Returns:
NULL if parsing failed, otherwise a pointer to the first character after the end of the address.


Variable Documentation

IPv4 "any" address constant.

IPv4 broadcast address constant.

IPv4 loopback address constant.


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/iter_8h-source.html0000664000076400007640000001203711147311327017572 0ustar bruceguenter bglibs: iter.h Source File

iter.h

00001 #ifndef STR_ITER__H__
00002 #define STR_ITER__H__
00003 
00004 struct str;
00005 
00015 typedef struct
00016 {
00018   const struct str* str;
00020   unsigned start;
00022   const char* startptr;
00024   unsigned len;
00026   char sep;
00027 } striter;
00028 
00029 void striter_start(striter* iter, const struct str* s, char sep);
00030 int striter_valid(striter*);
00031 int striter_advance(striter*);
00032 
00034 #define str_copyiter(STR,ITER) str_copyb(STR,(ITER)->startptr,(ITER)->len)
00035 
00037 #define str_catiter(STR,ITER) str_catb(STR,(ITER)->startptr,(ITER)->len)
00038 
00040 #define obuf_putiter(OBUF,ITER) obuf_write(OBUF,(ITER)->startptr,(ITER)->len)
00041 
00043 #define striter_loop(ITER,STR,SEP) for(striter_start(ITER,STR,SEP);striter_valid(ITER);striter_advance(ITER))
00044 
00047 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/group__selfpipe.html0000664000076400007640000001142211147311327020111 0ustar bruceguenter bglibs: selfpipe: Safe child exit management.

selfpipe: Safe child exit management.


Functions

int selfpipe_init (void)
void selfpipe_close (void)
void selfpipe_catch_signal (int)

Function Documentation

void selfpipe_catch_signal ( int  signal  ) 

Catch a signal and write it to the self-pipe.

This routine can be used with sig_*_catch() to send other signals through the self-pipe.

void selfpipe_close ( void   ) 

Shut down the self-pipe.

int selfpipe_init ( void   ) 

Set up a self-pipe for catching child exit events.

This function opens up a pipe within the program used to safely handle exiting child processes. Every time a child exits, a single byte is written to the pipe. The resulting file descriptor is statically assigned, so do not call this function more than once within a single program. The file descriptor is set to non-blocking mode to prevent blocking when reading from it.

To use the file descriptor, use either poll or select to determine when it is readable. When it becomes readable, read the data written to it (and throw it away), and use wait or equivalent to catch the exit value from the child process(es).

Returns:
-1 if an error occurred, otherwise the return value is the file descriptor opened for reading.


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/group__surfrand.html0000664000076400007640000001633011147311327020131 0ustar bruceguenter bglibs: surfrand: Random number generator based on SURF

surfrand: Random number generator based on SURF


Data Structures

struct  surfrand

Functions

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)

Function Documentation

double surfrand_double ( struct surfrand c  ) 

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.

void surfrand_fill ( struct surfrand c,
unsigned char *  buf,
unsigned  len 
)

Fill the buffer with random data

void surfrand_init ( struct surfrand c,
const uint32 *  data,
unsigned  words 
)

Initialize the surfrand structure.

Initializes the seed in c from the input data, and sets the counter to zero. If more than 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.

uint32 surfrand_uint32 ( struct surfrand c  ) 

Output an random unsigned 32-bit integer.

All the bits in the output integer are equally random.


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/group__iobuf.html0000664000076400007640000005662111147311327017420 0ustar bruceguenter bglibs: iobuf: I/O Buffer Management

iobuf: I/O Buffer Management


Data Structures

struct  iobuf

Status Flags

unsigned iobuf_bufsize
#define IOBUF_EOF   1
#define IOBUF_ERROR   2
#define IOBUF_TIMEOUT   4
#define IOBUF_BADFLAGS   0xf
#define IOBUF_SEEKABLE   0x10
#define IOBUF_NEEDSCLOSE   0x20
#define IOBUF_NEEDSFREE   0x40
#define IOBUF_NEEDSMUNMAP   0x80

Common

typedef struct iobuf iobuf
int iobuf_init (iobuf *io, int fd, unsigned bufsize, char *buffer, unsigned flags)
int iobuf_close (iobuf *io)
int iobuf_timeout (iobuf *io, int poll_out)
#define IOBUF_SET_ERROR(io)
#define iobuf_closed(io)   ((io)->fd == -1)
#define iobuf_error(io)   ((io)->flags & IOBUF_ERROR)
#define iobuf_timedout(io)   ((io)->flags & IOBUF_TIMEOUT)
#define iobuf_bad(io)   ((io)->flags & IOBUF_BADFLAGS)

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)

Detailed Description

Calling Convention
Unless otherwise specified, the return value is non-zero (true) if the entire requested operation completed, and 0 (false) otherwise.

Define Documentation

#define iobuf_bad ( io   )     ((io)->flags & IOBUF_BADFLAGS)

True if the iobuf is in a "bad" state.

#define IOBUF_BADFLAGS   0xf

Mask of all the error type flags.

#define iobuf_closed ( io   )     ((io)->fd == -1)

True if the iobuf has been closed.

#define IOBUF_EOF   1

Reading reached end of file.

#define iobuf_error ( io   )     ((io)->flags & IOBUF_ERROR)

True if the iobuf has an error flag.

#define IOBUF_ERROR   2

The iobuf has encountered an error.

#define IOBUF_NEEDSCLOSE   0x20

The file descriptor needs to be closed.

#define IOBUF_NEEDSFREE   0x40

The buffer needs to be deallocated with free

#define IOBUF_NEEDSMUNMAP   0x80

The buffer needs to be deallocated with munmap

#define IOBUF_SEEKABLE   0x10

lseek is possible on the file descriptor.

#define IOBUF_SET_ERROR ( io   ) 

Value:

do{ \
  io->flags |= IOBUF_ERROR; \
  io->errnum = errno; \
  return 0; \
}while(0)
Set the error flag, save errno, and return false.

#define iobuf_timedout ( io   )     ((io)->flags & IOBUF_TIMEOUT)

True if the input or output to the iobuf previously timed out.

#define IOBUF_TIMEOUT   4

The timeout expired before the read or write could be completed.


Function Documentation

int ibuf_copytofd ( ibuf in,
int  out 
)

Copy all the data from an ibuf to an output file descriptor.

int iobuf_close ( iobuf io  ) 

Close an iobuf and deallocate the buffer.

int iobuf_copy ( ibuf in,
obuf out 
)

Copy all the data from an ibuf to an obuf.

int iobuf_copyflush ( ibuf in,
obuf out 
)

Copy all the data from an ibuf to an obuf, and flush the obuf after writing is completed.

int iobuf_init ( iobuf io,
int  fd,
unsigned  bufsize,
char *  buffer,
unsigned  flags 
)

Initialize an iobuf structure.

int iobuf_timeout ( iobuf io,
int  poll_out 
)

Wait for a file descriptor to be ready for reading or writing.

int obuf_copyfromfd ( int  in,
obuf out 
)

Copy all the data from an input file descriptor to an obuf.


Variable Documentation

unsigned iobuf_bufsize

The default iobuf buffer size, defaults to 8192.


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/dir_a2e2a6ddf2b9459cbc3be164f3c73476.html0000664000076400007640000001244611147311327022315 0ustar bruceguenter bglibs: crypto/ Directory Reference

crypto Directory Reference


Files

file  hmac-md5.c
file  hmac-sha1.c
file  hmac-sha256.c
file  hmac-sha384.c
file  hmac-sha512.c
file  hmac.c
file  hmac.h [code]
file  md4.c
file  md4.h [code]
file  md5-crypt.c
file  md5.c
file  md5.h [code]
file  sha1.c
file  sha1.h [code]
file  sha1test.c
file  sha256.c
file  sha256.h [code]
file  sha384.c
file  sha384.h [code]
file  sha512.c
file  sha512.h [code]
file  surf.c
file  surf.h [code]
file  surfrand.c
file  surfrand.h [code]

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/structipv4addr.html0000664000076400007640000000537111147311327017717 0ustar bruceguenter bglibs: ipv4addr Struct Reference

ipv4addr Struct Reference
[ipv4: IPv4 Address Handling]

#include <ipv4.h>


Data Fields

uint8 addr [4]


Detailed Description

IPv4 address structure.

Field Documentation

uint8 ipv4addr::addr[4]

32-bit IPv4 address, represented as 4 8-bit unsigned chars.


The documentation for this struct was generated from the following file:
Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/modules.html0000664000076400007640000000606211147311327016403 0ustar bruceguenter bglibs: Module Index

bglibs Modules

Here is a list of all modules:
Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/misc_8h-source.html0000664000076400007640000000722711147311327017567 0ustar bruceguenter bglibs: misc.h Source File

misc.h

00001 #ifndef FMT__MISC__H__
00002 #define FMT__MISC__H__
00003 
00004 #include <stdarg.h>
00005 struct str;
00006 
00015 extern unsigned fmt_char(char* buffer, int ch, unsigned width, char pad);
00016 extern unsigned fmt_mem(char* buffer, const char* s, unsigned length,
00017                         unsigned width, char pad);
00018 extern unsigned fmt_chars(char* buffer, const char* s,
00019                           unsigned width, char pad);
00020 extern unsigned fmt_str(char* buffer, const struct str* s,
00021                         unsigned width, char pad);
00022 
00027 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/sha512_8h-source.html0000664000076400007640000000532711147311327017636 0ustar bruceguenter bglibs: sha512.h Source File

sha512.h

00001 #ifndef BGLIBS__SHA512__H__
00002 #define BGLIBS__SHA512__H__
00003 
00004 #include <sysdeps.h>
00005 
00006 #define SHA512_DIGEST_LENGTH (512/8)
00007 
00008 struct SHA512_ctx {
00009   uint64 H[8];
00010   uint64 bytes;
00011   uint8 M[256];
00012 };
00013 typedef struct SHA512_ctx SHA512_ctx;
00014 
00015 void SHA512_init  (SHA512_ctx*);
00016 void SHA512_update(SHA512_ctx*, const void*, unsigned long);
00017 void SHA512_final (SHA512_ctx*, uint8*);
00018 
00019 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/hmac_8h-source.html0000664000076400007640000001407111147311327017537 0ustar bruceguenter bglibs: hmac.h Source File

hmac.h

00001 #ifndef CRYPTO__HMAC__H__
00002 #define CRYPTO__HMAC__H__
00003 
00004 typedef void (*hmac_init_fn)(void*);
00005 typedef void (*hmac_update_fn)(void*, const unsigned char*, unsigned long);
00006 typedef void (*hmac_finalize_fn)(void*, unsigned char*);
00007 typedef void (*hmac_extract_fn)(const void*, void*);
00008 typedef void (*hmac_inject_fn)(void*, const void*);
00009 
00010 struct hmac_control_block
00011 {
00012   unsigned state_size;
00013   unsigned block_size;
00014   unsigned digest_size;
00015   unsigned midstate_size;
00016   hmac_init_fn init;
00017   hmac_update_fn update;
00018   hmac_finalize_fn finalize;
00019   hmac_extract_fn extract;
00020   hmac_inject_fn inject;
00021 };
00022 
00023 extern const struct hmac_control_block hmac_md5;
00024 extern const struct hmac_control_block hmac_sha1;
00025 extern const struct hmac_control_block hmac_sha256;
00026 extern const struct hmac_control_block hmac_sha384;
00027 extern const struct hmac_control_block hmac_sha512;
00028 
00029 struct str;
00030 extern void hmac_prepare(const struct hmac_control_block* hcb,
00031                          void* midstate,
00032                          const struct str* secret);
00033 extern void hmac_finish(const struct hmac_control_block* hcb,
00034                         const void* midstate,
00035                         const struct str* nonce,
00036                         void* outout);
00037 extern void hmac(const struct hmac_control_block* hcb,
00038                  const struct str* secret,
00039                  const struct str* nonce,
00040                  void* output);
00041 
00042 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/cloexec_8h-source.html0000664000076400007640000000356011147311327020252 0ustar bruceguenter bglibs: cloexec.h Source File

cloexec.h

00001 #ifndef UNIX__CLOEXEC__H__
00002 #define UNIX__CLOEXEC__H__
00003 
00004 int cloexec_on(int fd);
00005 int cloexec_off(int fd);
00006 
00007 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/doxygen.png0000664000076400007640000000240111147311327016221 0ustar bruceguenter‰PNG  IHDRd-ok>ÂgAMAÖØÔOX2tEXtSoftwareAdobe ImageReadyqÉe<]PLTEǾÏ"&©ÈÎï¶»ÖÓÚú“¢Þ ¬à¶Âõ‡§ÕÙêÉÊÎáâæ{ŽÔ¡ëˆ™× ²ø§¬¹ÀÀ±ÝÝÎùùéõõçëëåED9×ÖËhg]_X<@:#mhUÿÿÿÝÀ1tRNSÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÍvÿIDATxÚbC£: d#„„………h` @¡X",***LKˆ.–], ºX@t± €èb @ÑÅ€BµD„6–š%""´° € ˜% ˆ™B:H¢ˆ²Áf@• ˆRPy"K`\PbC(!II!h©…ëƒ(ñ„Ä!ꈬC„Ä…àl!0[X\J\$TMˆ(’>a$S„ Ù@ Ш@R.$‚¬LJBR¢‰AÌG1 ¬ Â(FȃÔPhhÁTÀ¢„%!`€&q°%u P ¹¢ ¬ € ¹CT$B¢à|‚ºW„¤Àl £!B`R$( …Ĉ‘’ž@AÅ%ĤÄ%@,(—ʂڱ%$ÁââRPmB U`1IˆYB  99€\1 yCCCÿf"[N 'Ü=TGÈ’øl8˜^Kû5<êSæRɤ”%î@@ à›Ê b1 qÅAXHˆ¸&ØB’R y n˜P„Ìã–4A €€j¹€€>Ü ˜ t!˜+(.ÈÅWQ±A2ÜÜMUÜ‚’’‚‚â `1 %`19€F< 3cZÄ`óe!\ˆ DÈ+. 83‹³Àä¸!lYYA -6‚EJŠ¢V €@©žXXX 4„å Ê@86Ð`RdB´€4I "Ý "–@xrÊŒ‚H€AÊ`—f ÉȰCŒ"XV0ɲ³C b@2…¬H ¬È“ p)!(ì‚ 0Ž4ˆ)(%RÁÎ ¶$€TÊ€¥Àþb‡b,säÐ@7À üѰ‚Òî?f¥Ö—\PIx!I´¦"”Ȉ’3¨ QY˜ÿt^^ÛØgv- }>WJOAV`$&#”¦8ùøø8€\FF ›SFJ$ÂÆ€ÐƊС䈉ÀÀ 4ª…Èäå -Á§‡ €H²…—ŸŸŸf ?ðâ5„ €k1Âd‰,ŒÃ ³ƒ“€.€"­F™ËË€àñ‚½ÁIÈ€"±Ù4ÉH gx|‚f©m)))9´. aMDƒ& ºX@t± €èb @ÑÅ€¢‹%DKˆ.–], ºX@t± €èb @€d`‚ɽSµOIEND®B`‚bglibs-1.106/doc/html/doxygen.css0000664000076400007640000001764111147311327016241 0ustar bruceguenterBODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV { font-family: Geneva, Arial, Helvetica, sans-serif; } BODY,TD { font-size: 90%; } H1 { text-align: center; font-size: 160%; } H2 { font-size: 120%; } H3 { font-size: 100%; } CAPTION { font-weight: bold } DIV.qindex { width: 100%; background-color: #e8eef2; border: 1px solid #84b0c7; text-align: center; margin: 2px; padding: 2px; line-height: 140%; } DIV.nav { width: 100%; background-color: #e8eef2; border: 1px solid #84b0c7; text-align: center; margin: 2px; padding: 2px; line-height: 140%; } DIV.navtab { background-color: #e8eef2; border: 1px solid #84b0c7; text-align: center; margin: 2px; margin-right: 15px; padding: 2px; } TD.navtab { font-size: 70%; } A.qindex { text-decoration: none; font-weight: bold; color: #1A419D; } A.qindex:visited { text-decoration: none; font-weight: bold; color: #1A419D } A.qindex:hover { text-decoration: none; background-color: #ddddff; } A.qindexHL { text-decoration: none; font-weight: bold; background-color: #6666cc; color: #ffffff; border: 1px double #9295C2; } A.qindexHL:hover { text-decoration: none; background-color: #6666cc; color: #ffffff; } A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff } A.el { text-decoration: none; font-weight: bold } A.elRef { font-weight: bold } A.code:link { text-decoration: none; font-weight: normal; color: #0000FF} A.code:visited { text-decoration: none; font-weight: normal; color: #0000FF} A.codeRef:link { font-weight: normal; color: #0000FF} A.codeRef:visited { font-weight: normal; color: #0000FF} A:hover { text-decoration: none; background-color: #f2f2ff } DL.el { margin-left: -1cm } .fragment { font-family: monospace, fixed; font-size: 95%; } PRE.fragment { border: 1px solid #CCCCCC; background-color: #f5f5f5; margin-top: 4px; margin-bottom: 4px; margin-left: 2px; margin-right: 8px; padding-left: 6px; padding-right: 6px; padding-top: 4px; padding-bottom: 4px; } DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px } DIV.groupHeader { margin-left: 16px; margin-top: 12px; margin-bottom: 6px; font-weight: bold; } DIV.groupText { margin-left: 16px; font-style: italic; font-size: 90% } BODY { background: white; color: black; margin-right: 20px; margin-left: 20px; } TD.indexkey { background-color: #e8eef2; font-weight: bold; padding-right : 10px; padding-top : 2px; padding-left : 10px; padding-bottom : 2px; margin-left : 0px; margin-right : 0px; margin-top : 2px; margin-bottom : 2px; border: 1px solid #CCCCCC; } TD.indexvalue { background-color: #e8eef2; font-style: italic; padding-right : 10px; padding-top : 2px; padding-left : 10px; padding-bottom : 2px; margin-left : 0px; margin-right : 0px; margin-top : 2px; margin-bottom : 2px; border: 1px solid #CCCCCC; } TR.memlist { background-color: #f0f0f0; } P.formulaDsp { text-align: center; } IMG.formulaDsp { } IMG.formulaInl { vertical-align: middle; } SPAN.keyword { color: #008000 } SPAN.keywordtype { color: #604020 } SPAN.keywordflow { color: #e08000 } SPAN.comment { color: #800000 } SPAN.preprocessor { color: #806020 } SPAN.stringliteral { color: #002080 } SPAN.charliteral { color: #008080 } .mdescLeft { padding: 0px 8px 4px 8px; font-size: 80%; font-style: italic; background-color: #FAFAFA; border-top: 1px none #E0E0E0; border-right: 1px none #E0E0E0; border-bottom: 1px none #E0E0E0; border-left: 1px none #E0E0E0; margin: 0px; } .mdescRight { padding: 0px 8px 4px 8px; font-size: 80%; font-style: italic; background-color: #FAFAFA; border-top: 1px none #E0E0E0; border-right: 1px none #E0E0E0; border-bottom: 1px none #E0E0E0; border-left: 1px none #E0E0E0; margin: 0px; } .memItemLeft { padding: 1px 0px 0px 8px; margin: 4px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #E0E0E0; border-right-color: #E0E0E0; border-bottom-color: #E0E0E0; border-left-color: #E0E0E0; border-top-style: solid; border-right-style: none; border-bottom-style: none; border-left-style: none; background-color: #FAFAFA; font-size: 80%; } .memItemRight { padding: 1px 8px 0px 8px; margin: 4px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #E0E0E0; border-right-color: #E0E0E0; border-bottom-color: #E0E0E0; border-left-color: #E0E0E0; border-top-style: solid; border-right-style: none; border-bottom-style: none; border-left-style: none; background-color: #FAFAFA; font-size: 80%; } .memTemplItemLeft { padding: 1px 0px 0px 8px; margin: 4px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #E0E0E0; border-right-color: #E0E0E0; border-bottom-color: #E0E0E0; border-left-color: #E0E0E0; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; background-color: #FAFAFA; font-size: 80%; } .memTemplItemRight { padding: 1px 8px 0px 8px; margin: 4px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #E0E0E0; border-right-color: #E0E0E0; border-bottom-color: #E0E0E0; border-left-color: #E0E0E0; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; background-color: #FAFAFA; font-size: 80%; } .memTemplParams { padding: 1px 0px 0px 8px; margin: 4px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #E0E0E0; border-right-color: #E0E0E0; border-bottom-color: #E0E0E0; border-left-color: #E0E0E0; border-top-style: solid; border-right-style: none; border-bottom-style: none; border-left-style: none; color: #606060; background-color: #FAFAFA; font-size: 80%; } .search { color: #003399; font-weight: bold; } FORM.search { margin-bottom: 0px; margin-top: 0px; } INPUT.search { font-size: 75%; color: #000080; font-weight: normal; background-color: #e8eef2; } TD.tiny { font-size: 75%; } a { color: #1A41A8; } a:visited { color: #2A3798; } .dirtab { padding: 4px; border-collapse: collapse; border: 1px solid #84b0c7; } TH.dirtab { background: #e8eef2; font-weight: bold; } HR { height: 1px; border: none; border-top: 1px solid black; } /* Style for detailed member documentation */ .memtemplate { font-size: 80%; color: #606060; font-weight: normal; margin-left: 3px; } .memnav { background-color: #e8eef2; border: 1px solid #84b0c7; text-align: center; margin: 2px; margin-right: 15px; padding: 2px; } .memitem { padding: 4px; background-color: #eef3f5; border-width: 1px; border-style: solid; border-color: #dedeee; -moz-border-radius: 8px 8px 8px 8px; } .memname { white-space: nowrap; font-weight: bold; } .memdoc{ padding-left: 10px; } .memproto { background-color: #d5e1e8; width: 100%; border-width: 1px; border-style: solid; border-color: #84b0c7; font-weight: bold; -moz-border-radius: 8px 8px 8px 8px; } .paramkey { text-align: right; } .paramtype { white-space: nowrap; } .paramname { color: #602020; font-style: italic; white-space: nowrap; } /* End Styling for detailed member documentation */ /* for the tree view */ .ftvtree { font-family: sans-serif; margin:0.5em; } .directory { font-size: 9pt; font-weight: bold; } .directory h3 { margin: 0px; margin-top: 1em; font-size: 11pt; } .directory > h3 { margin-top: 0; } .directory p { margin: 0px; white-space: nowrap; } .directory div { display: none; margin: 0px; } .directory img { vertical-align: -30%; } bglibs-1.106/doc/html/env_8h-source.html0000664000076400007640000001206211147311327017415 0ustar bruceguenter bglibs: env.h Source File

env.h

00001 #ifndef BGLIBS__STR__ENV__H__
00002 #define BGLIBS__STR__ENV__H__
00003 
00004 struct str;
00005 
00016 extern const char* envstr_find(const struct str* env, const char* var, long varlen);
00017 extern const char* envstr_get(const struct str* env, const char* var);
00018 extern int envstr_set(struct str* env, const char* var, const char* val, int overwrite);
00019 extern void envstr_unset(struct str* env, const char* var);
00020 extern int envstr_put(struct str* env, const char* asgn, int overwrite);
00021 extern int envstr_from_array(struct str* env, char** array, int overwrite);
00022 extern int envstr_from_string(struct str* env, const char* s, int overwrite);
00023 extern char** envstr_make_array(const struct str* env);
00024 
00027 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/ipv4_8h-source.html0000664000076400007640000001131111147311327017503 0ustar bruceguenter bglibs: ipv4.h Source File

ipv4.h

00001 #ifndef NET__IPV4__H__
00002 #define NET__IPV4__H__
00003 
00004 #include <sysdeps.h>
00005 
00011 typedef struct {
00013   uint8 addr[4];
00014 } ipv4addr;
00016 typedef uint16 ipv4port;
00017 
00018 extern const ipv4addr IPV4ADDR_ANY;
00019 extern const ipv4addr IPV4ADDR_BROADCAST;
00020 extern const ipv4addr IPV4ADDR_LOOPBACK;
00021 
00022 extern int ipv4_parse(const char* s, ipv4addr* addr, const char** end) __attribute__((__deprecated__));
00023 extern const char* ipv4_scan(const char* s, ipv4addr* addr);
00024 extern const char* ipv4_format(const ipv4addr* addr);
00025 extern unsigned fmt_ipv4addr(char* buffer, const ipv4addr* addr);
00026 
00029 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/resolve_8h-source.html0000664000076400007640000001002311147311327020277 0ustar bruceguenter bglibs: resolve.h Source File

resolve.h

00001 #ifndef NET__RESOLVE__H__
00002 #define NET__RESOLVE__H__
00003 
00004 #include "ipv4.h"
00005 
00010 #define RESOLVE_OK 0
00011 
00012 #define RESOLVE_NOTFOUND 1
00013 
00014 #define RESOLVE_NOADDR 2
00015 
00016 #define RESOLVE_NSERROR 3
00017 
00018 #define RESOLVE_TEMPFAIL 4
00019 
00020 extern const char* resolve_ipv4addr(const ipv4addr* addr);
00021 extern int resolve_ipv4name_n(const char* name, ipv4addr* addr, int maxaddrs);
00023 #define resolve_ipv4name(N,A) resolve_ipv4name_n((N),(A),1)
00024 extern int resolve_error(void);
00025 
00028 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/sha256_8h-source.html0000664000076400007640000000517511147311327017644 0ustar bruceguenter bglibs: sha256.h Source File

sha256.h

00001 #ifndef BGLIBS__SHA256__H__
00002 #define BGLIBS__SHA256__H__
00003 
00004 #include <sysdeps.h>
00005 
00006 #define SHA256_DIGEST_LENGTH (256/8)
00007 
00008 typedef struct {
00009   uint32 H[8];
00010   uint64 bytes;
00011   uint8 M[64];
00012 } SHA256_ctx;
00013 
00014 void SHA256_init(SHA256_ctx*);
00015 void SHA256_update(SHA256_ctx*, const void*, unsigned long);
00016 void SHA256_final(SHA256_ctx*, uint8*);
00017 
00018 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/functions_vars.html0000664000076400007640000002121511147311327017773 0ustar bruceguenter bglibs: Data Fields - Variables

 

- a -

- b -

- c -

- d -

- e -

- f -

- g -

- h -

- i -

- k -

- l -

- n -

- o -

- r -

- s -

- t -

- u -

- w -


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/html/socket_8h-source.html0000664000076400007640000003367211147311327020127 0ustar bruceguenter bglibs: socket.h Source File

socket.h

00001 #ifndef NET__SOCKET__H__
00002 #define NET__SOCKET__H__
00003 
00004 #include "ipv4.h"
00005 #include "ipv6.h"
00006 
00022 int socket_tcp4(void);
00023 int socket_tcp6(void);
00024 int socket_tcp(void);
00025 int socket_udp4(void);
00026 int socket_udp6(void);
00027 int socket_udp(void);
00028 int socket_connect4(int sock, const ipv4addr* ip, ipv4port port);
00029 int socket_connect4_timeout(int sock, const ipv4addr* ip, ipv4port port,
00030                             int timeout);
00031 int socket_connect6(int sock, const ipv6addr* ip, ipv6port port);
00032 int socket_connect6_timeout(int sock, const ipv6addr* ip, ipv6port port,
00033                             int timeout);
00034 int socket_bind4(int sock, const ipv4addr* ip, ipv4port port);
00035 int socket_bind6(int sock, const ipv6addr* ip, ipv6port port);
00036 int socket_accept4(int sock, ipv4addr* ip, ipv4port* port);
00037 int socket_accept6(int sock, ipv6addr* ip, ipv6port* port);
00038 int socket_recv4(int sock, char* buffer, unsigned buflen,
00039                  ipv4addr* ip, ipv4port* port);
00040 int socket_recv6(int sock, char* buffer, unsigned buflen,
00041                  ipv6addr* ip, ipv6port* port);
00042 int socket_send4(int sock, const char* buffer, unsigned buflen,
00043                  const ipv4addr* ip, ipv4port port);
00044 int socket_send6(int sock, const char* buffer, unsigned buflen,
00045                  const ipv6addr* ip, ipv6port port);
00046 int socket_getaddr4(int sock, ipv4addr* ip, ipv4port* port);
00047 int socket_getaddr6(int sock, ipv6addr* ip, ipv6port* port);
00048 int socket_cork(int sock);
00049 int socket_uncork(int sock);
00050 int socket_notcpdelay(int sock, int enable);
00055 int socket_unixdgm(void);
00056 int socket_unixstr(void);
00057 int socket_connectu(int sock, const char* path);
00058 int socket_connectu_timeout(int sock, const char* path, int timeout);
00059 int socket_bindu(int sock, const char* path);
00060 int socket_acceptu(int sock);
00061 int socket_recvu(int sock, char* buffer, unsigned buflen);
00062 int socket_sendu(int sock, const char* buffer, unsigned buflen);
00063 
00064 int socket_pairstr(int fd[2]);
00065 int socket_pairdgm(int fd[2]);
00070 int socket_broadcast(int sock);
00071 int socket_connected(int sock);
00072 int socket_linger(int fd, int onoff, int seconds);
00073 int socket_listen(int sock, int backlog);
00074 int socket_reuse(int sock);
00075 int socket_shutdown(int sock, int shut_rd, int shut_wr);
00076 
00077 int socket_sendfd(int sock, int fd);
00078 int socket_recvfd(int sock);
00083 #endif

Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4
bglibs-1.106/doc/latex/0000755000076400007640000000000011147311327014210 5ustar bruceguenterbglibs-1.106/doc/latex/dir_dd30a1940344e6186e300b1ab56c7d11.tex0000664000076400007640000000160611147311327021764 0ustar bruceguenter\hypertarget{dir_dd30a1940344e6186e300b1ab56c7d11}{ \section{fmt/ Directory Reference} \label{dir_dd30a1940344e6186e300b1ab56c7d11}\index{fmt/ Directory Reference@{fmt/ Directory Reference}} } \subsection*{Files} \begin{CompactItemize} \item file \textbf{char.c} \item file \textbf{chars.c} \item file \textbf{lcase.c} \item file \textbf{misc.h} \item file \textbf{multi.c} \item file \textbf{multi.h} \item file \textbf{number.h} \item file \textbf{pad.c} \item file \textbf{sdec.c} \item file \textbf{sign\_\-pad.c} \item file \textbf{slldec.c} \item file \textbf{sllnum.c} \item file \textbf{snum.c} \item file \textbf{ucase.c} \item file \textbf{udec.c} \item file \textbf{uhexl.c} \item file \textbf{uhexu.c} \item file \textbf{ulldec.c} \item file \textbf{ullhexl.c} \item file \textbf{ullhexu.c} \item file \textbf{ullnum.c} \item file \textbf{unum.c} \end{CompactItemize} bglibs-1.106/doc/latex/structiobuf.tex0000664000076400007640000000742011147311327017310 0ustar bruceguenter\hypertarget{structiobuf}{ \section{iobuf Struct Reference} \label{structiobuf}\index{iobuf@{iobuf}} } {\tt \#include $<$common.h$>$} \subsection*{Data Fields} \begin{CompactItemize} \item int \hyperlink{structiobuf_39fefd983790dde768ea2d6ce7f39753}{fd} \item char $\ast$ \hyperlink{structiobuf_3e5ab042bc7ae0de23cbb37576c7d440}{buffer} \item unsigned \hyperlink{structiobuf_8c7a5c6de1c07bce9ae1b9e92ae43ec1}{bufsize} \item unsigned \hyperlink{structiobuf_cdd25d09435430775e0e0978a93255db}{buflen} \item unsigned \hyperlink{structiobuf_d40dc3e7f45409eb0e517f33ecf09fda}{bufstart} \item unsigned \hyperlink{structiobuf_06aea14c129c6dad509acee84e22a60c}{offset} \item unsigned \hyperlink{structiobuf_f14cd5b09990519bd52b08119e22cb74}{timeout} \item unsigned \hyperlink{structiobuf_d72c10a4d7e1072bb6e45c972a1ddcf4}{flags} \item int \hyperlink{structiobuf_423f0d37d10f4d2c5c19adef80519fdd}{errnum} \end{CompactItemize} \subsection{Detailed Description} The base I/O buffer structure. \subsection{Field Documentation} \hypertarget{structiobuf_39fefd983790dde768ea2d6ce7f39753}{ \index{iobuf@{iobuf}!fd@{fd}} \index{fd@{fd}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf iobuf::fd}}} \label{structiobuf_39fefd983790dde768ea2d6ce7f39753} File descriptor being buffered. \hypertarget{structiobuf_3e5ab042bc7ae0de23cbb37576c7d440}{ \index{iobuf@{iobuf}!buffer@{buffer}} \index{buffer@{buffer}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ {\bf iobuf::buffer}}} \label{structiobuf_3e5ab042bc7ae0de23cbb37576c7d440} The buffer memory. \hypertarget{structiobuf_8c7a5c6de1c07bce9ae1b9e92ae43ec1}{ \index{iobuf@{iobuf}!bufsize@{bufsize}} \index{bufsize@{bufsize}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned {\bf iobuf::bufsize}}} \label{structiobuf_8c7a5c6de1c07bce9ae1b9e92ae43ec1} Total buffer size. \hypertarget{structiobuf_cdd25d09435430775e0e0978a93255db}{ \index{iobuf@{iobuf}!buflen@{buflen}} \index{buflen@{buflen}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned {\bf iobuf::buflen}}} \label{structiobuf_cdd25d09435430775e0e0978a93255db} Length of the data in the buffer. \hypertarget{structiobuf_d40dc3e7f45409eb0e517f33ecf09fda}{ \index{iobuf@{iobuf}!bufstart@{bufstart}} \index{bufstart@{bufstart}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned {\bf iobuf::bufstart}}} \label{structiobuf_d40dc3e7f45409eb0e517f33ecf09fda} Start of the data in the buffer. \hypertarget{structiobuf_06aea14c129c6dad509acee84e22a60c}{ \index{iobuf@{iobuf}!offset@{offset}} \index{offset@{offset}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned {\bf iobuf::offset}}} \label{structiobuf_06aea14c129c6dad509acee84e22a60c} Current file read/write offset. \hypertarget{structiobuf_f14cd5b09990519bd52b08119e22cb74}{ \index{iobuf@{iobuf}!timeout@{timeout}} \index{timeout@{timeout}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned {\bf iobuf::timeout}}} \label{structiobuf_f14cd5b09990519bd52b08119e22cb74} I/O timeout in ms ({\tt 0} for no timeout). \hypertarget{structiobuf_d72c10a4d7e1072bb6e45c972a1ddcf4}{ \index{iobuf@{iobuf}!flags@{flags}} \index{flags@{flags}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned {\bf iobuf::flags}}} \label{structiobuf_d72c10a4d7e1072bb6e45c972a1ddcf4} Status flags. \hypertarget{structiobuf_423f0d37d10f4d2c5c19adef80519fdd}{ \index{iobuf@{iobuf}!errnum@{errnum}} \index{errnum@{errnum}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf iobuf::errnum}}} \label{structiobuf_423f0d37d10f4d2c5c19adef80519fdd} Saved errno flag. The documentation for this struct was generated from the following file:\begin{CompactItemize} \item iobuf/common.h\end{CompactItemize} bglibs-1.106/doc/latex/annotated.tex0000664000076400007640000000277011147311327016717 0ustar bruceguenter\section{bglibs Data Structures} Here are the data structures with brief descriptions:\begin{CompactList} \item\contentsline{section}{\hyperlink{structghash}{ghash} }{\pageref{structghash}}{} \item\contentsline{section}{\hyperlink{structghashiter}{ghashiter} }{\pageref{structghashiter}}{} \item\contentsline{section}{\hyperlink{structgqueue}{gqueue} }{\pageref{structgqueue}}{} \item\contentsline{section}{\hyperlink{structgqueue__node}{gqueue\_\-node} }{\pageref{structgqueue__node}}{} \item\contentsline{section}{\hyperlink{structgstack}{gstack} }{\pageref{structgstack}}{} \item\contentsline{section}{\hyperlink{structgstack__node}{gstack\_\-node} }{\pageref{structgstack__node}}{} \item\contentsline{section}{\hyperlink{structibuf}{ibuf} }{\pageref{structibuf}}{} \item\contentsline{section}{\hyperlink{structiobuf}{iobuf} }{\pageref{structiobuf}}{} \item\contentsline{section}{\hyperlink{structipv4addr}{ipv4addr} }{\pageref{structipv4addr}}{} \item\contentsline{section}{\hyperlink{structipv6addr}{ipv6addr} }{\pageref{structipv6addr}}{} \item\contentsline{section}{\hyperlink{structobuf}{obuf} }{\pageref{structobuf}}{} \item\contentsline{section}{\hyperlink{structstr}{str} }{\pageref{structstr}}{} \item\contentsline{section}{\hyperlink{structstr__sortentry}{str\_\-sortentry} }{\pageref{structstr__sortentry}}{} \item\contentsline{section}{\hyperlink{structstriter}{striter} }{\pageref{structstriter}}{} \item\contentsline{section}{\hyperlink{structsurfrand}{surfrand} }{\pageref{structsurfrand}}{} \end{CompactList} bglibs-1.106/doc/latex/structgstack.tex0000664000076400007640000000265011147311327017460 0ustar bruceguenter\hypertarget{structgstack}{ \section{gstack Struct Reference} \label{structgstack}\index{gstack@{gstack}} } {\tt \#include $<$gstack.h$>$} \subsection*{Data Fields} \begin{CompactItemize} \item struct \hyperlink{structgstack__node}{gstack\_\-node} $\ast$ \hyperlink{structgstack_d339b0b08c44d8c4b9ec6cd5ecf0ec7c}{head} \item unsigned \hyperlink{structgstack_458b56c5ebea6733181bc922bc22dd6a}{count} \end{CompactItemize} \subsection{Detailed Description} Generic stack structure. \begin{Desc} \item[Examples: ]\par \hyperlink{adt_2gstack__test_8c-example}{adt/gstack\_\-test.c}.\end{Desc} \subsection{Field Documentation} \hypertarget{structgstack_d339b0b08c44d8c4b9ec6cd5ecf0ec7c}{ \index{gstack@{gstack}!head@{head}} \index{head@{head}!gstack@{gstack}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf gstack\_\-node}$\ast$ {\bf gstack::head}\hspace{0.3cm}{\tt \mbox{[}read\mbox{]}}}} \label{structgstack_d339b0b08c44d8c4b9ec6cd5ecf0ec7c} Pointer to the first item in the stack. \hypertarget{structgstack_458b56c5ebea6733181bc922bc22dd6a}{ \index{gstack@{gstack}!count@{count}} \index{count@{count}!gstack@{gstack}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned {\bf gstack::count}}} \label{structgstack_458b56c5ebea6733181bc922bc22dd6a} The number of items in the stack. The documentation for this struct was generated from the following file:\begin{CompactItemize} \item gstack.h\end{CompactItemize} bglibs-1.106/doc/latex/dir_74e682a418f682a90c4a9d71beb28fdd.tex0000664000076400007640000000371411147311327022252 0ustar bruceguenter\hypertarget{dir_74e682a418f682a90c4a9d71beb28fdd}{ \section{net/ Directory Reference} \label{dir_74e682a418f682a90c4a9d71beb28fdd}\index{net/ Directory Reference@{net/ Directory Reference}} } \subsection*{Files} \begin{CompactItemize} \item file \textbf{accept4.c} \item file \textbf{accept6.c} \item file \textbf{acceptu.c} \item file \textbf{bind4.c} \item file \textbf{bind6.c} \item file \textbf{bindu.c} \item file \textbf{broadcast.c} \item file \textbf{cmsg.h} \item file \textbf{connect4.c} \item file \textbf{connect4\_\-timeout.c} \item file \textbf{connect6.c} \item file \textbf{connect6\_\-timeout.c} \item file \textbf{connected.c} \item file \textbf{connectu.c} \item file \textbf{connectu\_\-timeout.c} \item file \textbf{cork.c} \item file \textbf{getaddr4.c} \item file \textbf{getaddr6.c} \item file \textbf{ipv4.h} \item file \textbf{ipv4\_\-addr.c} \item file \textbf{ipv4\_\-format.c} \item file \textbf{ipv4\_\-scan.c} \item file \textbf{ipv6.h} \item file \textbf{ipv6\_\-addr.c} \item file \textbf{ipv6\_\-format.c} \item file \textbf{ipv6\_\-scan.c} \item file \textbf{linger.c} \item file \textbf{listen.c} \item file \textbf{notcpdelay.c} \item file \textbf{pairdgm.c} \item file \textbf{pairstr.c} \item file \textbf{recv4.c} \item file \textbf{recv6.c} \item file \textbf{recvfd.c} \item file \textbf{recvu.c} \item file \textbf{resolve.h} \item file \textbf{resolve\_\-error.c} \item file \textbf{resolve\_\-ipv4addr.c} \item file \textbf{resolve\_\-ipv4name.c} \item file \textbf{reuse.c} \item file \textbf{send4.c} \item file \textbf{send6.c} \item file \textbf{sendfd.c} \item file \textbf{sendu.c} \item file \textbf{setopt.c} \item file \textbf{shutdown.c} \item file \textbf{socket.h} \item file \textbf{tcp4.c} \item file \textbf{tcp6.c} \item file \textbf{udp4.c} \item file \textbf{udp6.c} \item file \textbf{uncork.c} \item file \textbf{unixdgm.c} \item file \textbf{unixstr.c} \end{CompactItemize} bglibs-1.106/doc/latex/group__path.tex0000664000076400007640000001404711147311327017251 0ustar bruceguenter\hypertarget{group__path}{ \section{path: Filename manipulation functions} \label{group__path}\index{path: Filename manipulation functions@{path: Filename manipulation functions}} } \subsection*{Defines} \begin{CompactItemize} \item \#define \hyperlink{group__path_g03cca24a2a9859b58cd517f5231c46e7}{PATH\_\-MATCH\_\-DOTFILES}~1 \end{CompactItemize} \subsection*{Functions} \begin{CompactItemize} \item int \hyperlink{group__path_g3824d65862af5b0b924b5fe04f477b11}{path\_\-merge} (\hyperlink{structstr}{str} $\ast$path, const char $\ast$start) \item int \hyperlink{group__path_g008d97b69772c505673b77c8bd6d2d02}{fnmatch} (const char $\ast$filename, const char $\ast$pattern, unsigned options) \item int \hyperlink{group__path_g9d3d2b90a484ecb5e7d23b95c5b1a7ea}{has\_\-magic} (const char $\ast$s) \item int \hyperlink{group__path_g3a22e9e172a01e5b3480988f3a85f6ba}{path\_\-match} (const char $\ast$pattern, \hyperlink{structstr}{str} $\ast$result, unsigned options) \item int \hyperlink{group__path_g773978c103a04f5d151085cde2b4a019}{path\_\-contains} (const char $\ast$path, const char $\ast$part) \item int \hyperlink{group__path_g7531dc468913cc8df67bf4b0b5595c5a}{path\_\-mktemp} (const char $\ast$prefix, \hyperlink{structstr}{str} $\ast$filename) \item int \hyperlink{group__path_g6e1b0edb51abca88c8cfa307342bc8ac}{path\_\-mkdirs} (const char $\ast$path, unsigned mode) \end{CompactItemize} \subsection{Define Documentation} \hypertarget{group__path_g03cca24a2a9859b58cd517f5231c46e7}{ \index{path@{path}!PATH\_\-MATCH\_\-DOTFILES@{PATH\_\-MATCH\_\-DOTFILES}} \index{PATH\_\-MATCH\_\-DOTFILES@{PATH\_\-MATCH\_\-DOTFILES}!path@{path}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define PATH\_\-MATCH\_\-DOTFILES~1}} \label{group__path_g03cca24a2a9859b58cd517f5231c46e7} Make path\_\-match include files starting with dots. \subsection{Function Documentation} \hypertarget{group__path_g008d97b69772c505673b77c8bd6d2d02}{ \index{path@{path}!fnmatch@{fnmatch}} \index{fnmatch@{fnmatch}!path@{path}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int fnmatch (const char $\ast$ {\em filename}, const char $\ast$ {\em pattern}, unsigned {\em options})}} \label{group__path_g008d97b69772c505673b77c8bd6d2d02} Matches a path using glob patterns. \hypertarget{group__path_g9d3d2b90a484ecb5e7d23b95c5b1a7ea}{ \index{path@{path}!has\_\-magic@{has\_\-magic}} \index{has\_\-magic@{has\_\-magic}!path@{path}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int has\_\-magic (const char $\ast$ {\em s})}} \label{group__path_g9d3d2b90a484ecb5e7d23b95c5b1a7ea} Does the string have glob characters in it. Returns true if the given string contains at least one instance of either {\tt $\ast$}, {\tt ?}, or {\tt \mbox{[}}. \hypertarget{group__path_g773978c103a04f5d151085cde2b4a019}{ \index{path@{path}!path\_\-contains@{path\_\-contains}} \index{path\_\-contains@{path\_\-contains}!path@{path}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int path\_\-contains (const char $\ast$ {\em path}, const char $\ast$ {\em part})}} \label{group__path_g773978c103a04f5d151085cde2b4a019} Test if a path contains a component. Returns true if the {\tt path} contains {\tt part} either at the start followed by a slash, at the end preceded by a slash, or elsewhere with a slash on either side. \hypertarget{group__path_g3a22e9e172a01e5b3480988f3a85f6ba}{ \index{path@{path}!path\_\-match@{path\_\-match}} \index{path\_\-match@{path\_\-match}!path@{path}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int path\_\-match (const char $\ast$ {\em pattern}, {\bf str} $\ast$ {\em result}, unsigned {\em options})}} \label{group__path_g3a22e9e172a01e5b3480988f3a85f6ba} Matches the pattern against existing files. This function produces a list of existing files in {\tt result} (in the current directory) that match the given pattern. If {\tt options} has {\tt PATH\_\-MATCH\_\-DOTFILES} set, the result may contain paths starting with \char`\"{}.\char`\"{}. \hypertarget{group__path_g3824d65862af5b0b924b5fe04f477b11}{ \index{path@{path}!path\_\-merge@{path\_\-merge}} \index{path\_\-merge@{path\_\-merge}!path@{path}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int path\_\-merge ({\bf str} $\ast$ {\em path}, const char $\ast$ {\em start})}} \label{group__path_g3824d65862af5b0b924b5fe04f477b11} Merge two paths together. This function takes a starting path, and merges the second path into it. If the second path starts with a \char`\"{}/\char`\"{}, it replaces the existing path completely. If the second path contains any \char`\"{}..\char`\"{} components, the preceding directory component in the current path (if any) is removed. All \char`\"{}.\char`\"{} components are removed. The effects of this function are equivalent to changing directory to the first path and then using the second one. \hypertarget{group__path_g6e1b0edb51abca88c8cfa307342bc8ac}{ \index{path@{path}!path\_\-mkdirs@{path\_\-mkdirs}} \index{path\_\-mkdirs@{path\_\-mkdirs}!path@{path}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int path\_\-mkdirs (const char $\ast$ {\em path}, unsigned {\em mode})}} \label{group__path_g6e1b0edb51abca88c8cfa307342bc8ac} Create a directory, optionally creating any parent directories. This function creates the named directory using {\tt mkdir}. If any of the parent directories of the specified path do not exist, they are created as well (with the same mode). \begin{Desc} \item[Note:]Unlike the \char`\"{}$<$tt$>$mkdir -p$<$/tt$>$\char`\"{} command, this function will result in an error if the path already exists. \end{Desc} \hypertarget{group__path_g7531dc468913cc8df67bf4b0b5595c5a}{ \index{path@{path}!path\_\-mktemp@{path\_\-mktemp}} \index{path\_\-mktemp@{path\_\-mktemp}!path@{path}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int path\_\-mktemp (const char $\ast$ {\em prefix}, {\bf str} $\ast$ {\em filename})}} \label{group__path_g7531dc468913cc8df67bf4b0b5595c5a} 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. bglibs-1.106/doc/latex/group__striter.tex0000664000076400007640000001223511147311327020006 0ustar bruceguenter\hypertarget{group__striter}{ \section{striter: Iterator over substrings of a str.} \label{group__striter}\index{striter: Iterator over substrings of a str.@{striter: Iterator over substrings of a str.}} } \subsection*{Data Structures} \begin{CompactItemize} \item struct \hyperlink{structstriter}{striter} \end{CompactItemize} \subsection*{Defines} \begin{CompactItemize} \item \#define \hyperlink{group__striter_g3b984e73388f3c5535d51fc4e1081ed7}{str\_\-copyiter}(STR, ITER)~str\_\-copyb(STR,(ITER) $\rightarrow$ startptr,(ITER) $\rightarrow$ len) \item \#define \hyperlink{group__striter_gf83fc1e3a1bb3c8fa675313c3f763857}{str\_\-catiter}(STR, ITER)~str\_\-catb(STR,(ITER) $\rightarrow$ startptr,(ITER) $\rightarrow$ len) \item \#define \hyperlink{group__striter_gf531e0fa5b190d8c588dbd190022dee6}{obuf\_\-putiter}(OBUF, ITER)~obuf\_\-write(OBUF,(ITER) $\rightarrow$ startptr,(ITER) $\rightarrow$ len) \item \#define \hyperlink{group__striter_g0eda5f095414f384376e11bf29bd9329}{striter\_\-loop}(ITER, STR, SEP)~for(striter\_\-start(ITER,STR,SEP);striter\_\-valid(ITER);striter\_\-advance(ITER)) \end{CompactItemize} \subsection*{Functions} \begin{CompactItemize} \item void \hyperlink{group__striter_g0c34c11320670c96e85e9ee6d87374b4}{striter\_\-start} (\hyperlink{structstriter}{striter} $\ast$iter, const struct \hyperlink{structstr}{str} $\ast$s, char sep) \item int \hyperlink{group__striter_g88b26577db55ed705de91602f48f0a76}{striter\_\-valid} (\hyperlink{structstriter}{striter} $\ast$) \item int \hyperlink{group__striter_ge42a28441725b60271f0f885bc74aa8a}{striter\_\-advance} (\hyperlink{structstriter}{striter} $\ast$) \end{CompactItemize} \subsection{Detailed Description} \begin{Desc} \item[Calling Convention]All non-void functions return {\tt 0} (false) if the function failed or the iterator is no longer valid, and non-zero (true) otherwise. \end{Desc} \subsection{Define Documentation} \hypertarget{group__striter_gf531e0fa5b190d8c588dbd190022dee6}{ \index{striter@{striter}!obuf\_\-putiter@{obuf\_\-putiter}} \index{obuf\_\-putiter@{obuf\_\-putiter}!striter@{striter}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define obuf\_\-putiter(OBUF, ITER)~obuf\_\-write(OBUF,(ITER) $\rightarrow$ startptr,(ITER) $\rightarrow$ len)}} \label{group__striter_gf531e0fa5b190d8c588dbd190022dee6} Output the current \hyperlink{structstriter}{striter} substring to an \hyperlink{structobuf}{obuf}. \hypertarget{group__striter_gf83fc1e3a1bb3c8fa675313c3f763857}{ \index{striter@{striter}!str\_\-catiter@{str\_\-catiter}} \index{str\_\-catiter@{str\_\-catiter}!striter@{striter}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define str\_\-catiter(STR, ITER)~str\_\-catb(STR,(ITER) $\rightarrow$ startptr,(ITER) $\rightarrow$ len)}} \label{group__striter_gf83fc1e3a1bb3c8fa675313c3f763857} Append the current \hyperlink{structstriter}{striter} substring to a \hyperlink{structstr}{str}. \hypertarget{group__striter_g3b984e73388f3c5535d51fc4e1081ed7}{ \index{striter@{striter}!str\_\-copyiter@{str\_\-copyiter}} \index{str\_\-copyiter@{str\_\-copyiter}!striter@{striter}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define str\_\-copyiter(STR, ITER)~str\_\-copyb(STR,(ITER) $\rightarrow$ startptr,(ITER) $\rightarrow$ len)}} \label{group__striter_g3b984e73388f3c5535d51fc4e1081ed7} Assign the current \hyperlink{structstriter}{striter} substring to a \hyperlink{structstr}{str}. \hypertarget{group__striter_g0eda5f095414f384376e11bf29bd9329}{ \index{striter@{striter}!striter\_\-loop@{striter\_\-loop}} \index{striter\_\-loop@{striter\_\-loop}!striter@{striter}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define striter\_\-loop(ITER, STR, SEP)~for(striter\_\-start(ITER,STR,SEP);striter\_\-valid(ITER);striter\_\-advance(ITER))}} \label{group__striter_g0eda5f095414f384376e11bf29bd9329} Loop macro; use in place of {\tt for}(...) \subsection{Function Documentation} \hypertarget{group__striter_ge42a28441725b60271f0f885bc74aa8a}{ \index{striter@{striter}!striter\_\-advance@{striter\_\-advance}} \index{striter\_\-advance@{striter\_\-advance}!striter@{striter}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int striter\_\-advance ({\bf striter} $\ast$ {\em iter})}} \label{group__striter_ge42a28441725b60271f0f885bc74aa8a} Advance a \hyperlink{structstriter}{striter} to the next substring. \hypertarget{group__striter_g0c34c11320670c96e85e9ee6d87374b4}{ \index{striter@{striter}!striter\_\-start@{striter\_\-start}} \index{striter\_\-start@{striter\_\-start}!striter@{striter}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void striter\_\-start ({\bf striter} $\ast$ {\em iter}, const struct {\bf str} $\ast$ {\em s}, char {\em sep})}} \label{group__striter_g0c34c11320670c96e85e9ee6d87374b4} Start (initialize) a \hyperlink{structstriter}{striter}. \hypertarget{group__striter_g88b26577db55ed705de91602f48f0a76}{ \index{striter@{striter}!striter\_\-valid@{striter\_\-valid}} \index{striter\_\-valid@{striter\_\-valid}!striter@{striter}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int striter\_\-valid ({\bf striter} $\ast$ {\em iter})}} \label{group__striter_g88b26577db55ed705de91602f48f0a76} Determine if a \hyperlink{structstriter}{striter} is valid (after initialization or advancing). bglibs-1.106/doc/latex/group__str.tex0000664000076400007640000016130011147311327017120 0ustar bruceguenter\hypertarget{group__str}{ \section{str: Dynamically allocated string library.} \label{group__str}\index{str: Dynamically allocated string library.@{str: Dynamically allocated string library.}} } \subsection*{Data Structures} \begin{CompactItemize} \item struct \hyperlink{structstr}{str} \item struct \hyperlink{structstr__sortentry}{str\_\-sortentry} \end{CompactItemize} \subsection*{Globals} \begin{CompactItemize} \item const char \hyperlink{group__str_gb17c3827c0b106c7103a9879751ea843}{str\_\-lcase\_\-digits} \mbox{[}36\mbox{]} \item const char \hyperlink{group__str_g46d474d8d0f88e74ba454722af30ac08}{str\_\-ucase\_\-digits} \mbox{[}36\mbox{]} \end{CompactItemize} \subsection*{Overhead Functions} \begin{CompactItemize} \item int \hyperlink{group__str_g49aec9c56d91c2a8a18bf4677b5e8a5b}{str\_\-init} (\hyperlink{structstr}{str} $\ast$s) \item int \hyperlink{group__str_gca368420555c886139b10d887df45941}{str\_\-alloc} (\hyperlink{structstr}{str} $\ast$s, unsigned size, int copy) \item void \hyperlink{group__str_ga45f56943ecb5e8705e041ff6b70df95}{str\_\-free} (\hyperlink{structstr}{str} $\ast$s) \item int \hyperlink{group__str_g174d1bf12ba03f33d6bfe98c566fec4e}{str\_\-truncate} (\hyperlink{structstr}{str} $\ast$s, unsigned len) \item \#define \hyperlink{group__str_g5130cf1a57c497bab66091fbdb9fd6d3}{str\_\-ready}(S, SZ)~str\_\-alloc(S,SZ,0) \item \#define \hyperlink{group__str_g05c5854c9d40dbe953625279b5deb5c7}{str\_\-realloc}(S, SZ)~str\_\-alloc(S,SZ,1) \end{CompactItemize} \subsection*{Assignment Functions} \begin{CompactItemize} \item int \hyperlink{group__str_g9156aedd17aac54cd238c8caa6dc6e85}{str\_\-copy} (\hyperlink{structstr}{str} $\ast$s, const \hyperlink{structstr}{str} $\ast$in) \item int \hyperlink{group__str_g100c559e82996e86f9bb9472c0ce9331}{str\_\-copys} (\hyperlink{structstr}{str} $\ast$s, const char $\ast$in) \item int \hyperlink{group__str_g26880681d1ed8fd1a80ccd4e39ce6e61}{str\_\-copyb} (\hyperlink{structstr}{str} $\ast$s, const char $\ast$in, unsigned len) \item int \hyperlink{group__str_ga48f044aa7889f07df12b69a9f9dc081}{str\_\-copyf} (\hyperlink{structstr}{str} $\ast$s, const char $\ast$format,...) \item int \hyperlink{group__str_g6782b26e389f10eaf3ea8a3cb1fe7390}{str\_\-copyfv} (\hyperlink{structstr}{str} $\ast$s, const char $\ast$format, va\_\-list ap) \item int \hyperlink{group__str_g27fcdd2e902c5efac54fce1c2c9f4319}{str\_\-copyns} (\hyperlink{structstr}{str} $\ast$s, unsigned int count,...) \item int \hyperlink{group__str_g0883eb2957281e989efab5d1591c6e94}{str\_\-copy2s} (\hyperlink{structstr}{str} $\ast$s, const char $\ast$a, const char $\ast$b) \item int \hyperlink{group__str_g59d4d0111c25f28598949d4fa3ccb277}{str\_\-copy3s} (\hyperlink{structstr}{str} $\ast$s, const char $\ast$a, const char $\ast$b, const char $\ast$c) \item int \hyperlink{group__str_gd15c9de561eed3870cee0d2993eb1085}{str\_\-copy4s} (\hyperlink{structstr}{str} $\ast$s, const char $\ast$a, const char $\ast$b, const char $\ast$c, const char $\ast$d) \item int \hyperlink{group__str_g4b05822e5ae0fee9491141c268ce2866}{str\_\-copy5s} (\hyperlink{structstr}{str} $\ast$s, const char $\ast$a, const char $\ast$b, const char $\ast$c, const char $\ast$d, const char $\ast$e) \item int \hyperlink{group__str_g16ed7543ffa368a468b00cc4b572e012}{str\_\-copy6s} (\hyperlink{structstr}{str} $\ast$s, const char $\ast$a, const char $\ast$b, const char $\ast$c, const char $\ast$d, const char $\ast$e, const char $\ast$f) \end{CompactItemize} \subsection*{Appending Functions} \begin{CompactItemize} \item int \hyperlink{group__str_g6da816627202e243e6c3b3fdac1ff12d}{str\_\-cat} (\hyperlink{structstr}{str} $\ast$s, const \hyperlink{structstr}{str} $\ast$in) \item int \hyperlink{group__str_g18e74bb0d26292957bf7737b2f497de2}{str\_\-cats} (\hyperlink{structstr}{str} $\ast$s, const char $\ast$in) \item int \hyperlink{group__str_gd684484056b8aa9e5937a7bd5fb1546a}{str\_\-catc} (\hyperlink{structstr}{str} $\ast$s, char in) \item int \hyperlink{group__str_g7d1534a006941bdb22c4ce4b9b305cda}{str\_\-catb} (\hyperlink{structstr}{str} $\ast$s, const char $\ast$in, unsigned len) \item int \hyperlink{group__str_g1cf63dbdaa6703b26d8ce72e6901ffbe}{str\_\-catf} (\hyperlink{structstr}{str} $\ast$s, const char $\ast$format,...) \item int \hyperlink{group__str_g7e35e57a0e6189350eab468449770fd8}{str\_\-catfv} (\hyperlink{structstr}{str} $\ast$s, const char $\ast$format, va\_\-list ap) \item int \hyperlink{group__str_ge7813ee8c5777ac1933667492ae8a678}{str\_\-cati} (\hyperlink{structstr}{str} $\ast$s, long in) \item int \hyperlink{group__str_g3143a40d753401322ef385b3fdbadb16}{str\_\-catiw} (\hyperlink{structstr}{str} $\ast$s, long in, unsigned width, char pad) \item int \hyperlink{group__str_g7f65270d3b4b0fb5c12590094176bc9f}{str\_\-catu} (\hyperlink{structstr}{str} $\ast$s, unsigned long in) \item int \hyperlink{group__str_gd640ad0f22f32ac02d6f9a5468288096}{str\_\-catuw} (\hyperlink{structstr}{str} $\ast$s, unsigned long in, unsigned width, char pad) \item int \hyperlink{group__str_g18708cef8d28920a765ca52cb31384cd}{str\_\-catx} (\hyperlink{structstr}{str} $\ast$s, unsigned long in) \item int \hyperlink{group__str_g046ba4fd6ae781e69c403ac8bdb8a4c0}{str\_\-catxw} (\hyperlink{structstr}{str} $\ast$s, unsigned long in, unsigned width, char pad) \item int \hyperlink{group__str_gfd20d5489dd738b8eb92a50e229c9e6c}{str\_\-catill} (\hyperlink{structstr}{str} $\ast$s, long long in) \item int \hyperlink{group__str_g656f6072b556cea1cc241e569147026e}{str\_\-catiwll} (\hyperlink{structstr}{str} $\ast$s, long long in, unsigned width, char pad) \item int \hyperlink{group__str_g9225e94eba3cd097f75fffced7067309}{str\_\-catull} (\hyperlink{structstr}{str} $\ast$s, unsigned long long in) \item int \hyperlink{group__str_g6d2d541e6d58bf6a66b4384d72e8c637}{str\_\-catuwll} (\hyperlink{structstr}{str} $\ast$s, unsigned long long in, unsigned width, char pad) \item int \hyperlink{group__str_ge0b9b4c32606fee5347462764df26d58}{str\_\-catxll} (\hyperlink{structstr}{str} $\ast$s, unsigned long long in) \item int \hyperlink{group__str_gc34f93772aa9ff884e08b1e9e9af252e}{str\_\-catxwll} (\hyperlink{structstr}{str} $\ast$s, unsigned long long in, unsigned width, char pad) \item int \hyperlink{group__str_geb7177e96cecb7853ecdf9f5e3095304}{str\_\-catsnumw} (\hyperlink{structstr}{str} $\ast$s, long in, unsigned width, char pad, unsigned base, const char $\ast$digits) \item int \hyperlink{group__str_g03abaeebd39c746d305aefd271a5ed67}{str\_\-catunumw} (\hyperlink{structstr}{str} $\ast$s, unsigned long in, unsigned width, char pad, unsigned base, const char $\ast$digits) \item int \hyperlink{group__str_g1d1f106f84cda58651c02b89b1e44096}{str\_\-catsllnumw} (\hyperlink{structstr}{str} $\ast$s, long long in, unsigned width, char pad, unsigned base, const char $\ast$digits) \item int \hyperlink{group__str_gc6568910addff1f7163b5755fcfd4386}{str\_\-catullnumw} (\hyperlink{structstr}{str} $\ast$s, unsigned long long in, unsigned width, char pad, unsigned base, const char $\ast$digits) \item int \hyperlink{group__str_g67112113aa1d19fba4088a1fd7459be5}{str\_\-catns} (\hyperlink{structstr}{str} $\ast$s, unsigned int count,...) \item int \hyperlink{group__str_gf0fddce8535bf2959969ff59e2fe99b4}{str\_\-cat2s} (\hyperlink{structstr}{str} $\ast$s, const char $\ast$a, const char $\ast$b) \item int \hyperlink{group__str_gb4790ea2df2856a08daac7d5277451b0}{str\_\-cat3s} (\hyperlink{structstr}{str} $\ast$s, const char $\ast$a, const char $\ast$b, const char $\ast$c) \item int \hyperlink{group__str_g9e13b2db85a12a2496dc2e55fdd93a08}{str\_\-cat4s} (\hyperlink{structstr}{str} $\ast$s, const char $\ast$a, const char $\ast$b, const char $\ast$c, const char $\ast$d) \item int \hyperlink{group__str_g513f21f2da4a0de972ce4ee7872ad19f}{str\_\-cat5s} (\hyperlink{structstr}{str} $\ast$s, const char $\ast$a, const char $\ast$b, const char $\ast$c, const char $\ast$d, const char $\ast$e) \item int \hyperlink{group__str_gcf819cd99a8b3676c65447447e62dcaa}{str\_\-cat6s} (\hyperlink{structstr}{str} $\ast$s, const char $\ast$a, const char $\ast$b, const char $\ast$c, const char $\ast$d, const char $\ast$e, const char $\ast$f) \item int \hyperlink{group__str_gf76c4c5b41641d9437002d2b299d9580}{str\_\-join} (\hyperlink{structstr}{str} $\ast$s, char sep, const \hyperlink{structstr}{str} $\ast$t) \item int \hyperlink{group__str_g2e8f8918d04489ad5deea5a2322f54b4}{str\_\-joins} (\hyperlink{structstr}{str} $\ast$s, char sep, const char $\ast$in) \item int \hyperlink{group__str_gde075ea52e0a95ac5198b3cb44362f29}{str\_\-joinb} (\hyperlink{structstr}{str} $\ast$s, char sep, const char $\ast$in, unsigned len) \end{CompactItemize} \subsection*{In-place Modification Functions} \begin{CompactItemize} \item void \hyperlink{group__str_gb338bac7017bdd4759f6a876fa3c1b36}{str\_\-lower} (\hyperlink{structstr}{str} $\ast$s) \item void \hyperlink{group__str_g1b08b4fba3b7ea32ced0109a50ef7d06}{str\_\-upper} (\hyperlink{structstr}{str} $\ast$s) \item long \hyperlink{group__str_g7aa699416198667b7b2198591ee1811f}{str\_\-subst} (\hyperlink{structstr}{str} $\ast$s, char from, char to) \item void \hyperlink{group__str_g97329d0205007c89bf197446f30c75de}{str\_\-lstrip} (\hyperlink{structstr}{str} $\ast$s) \item void \hyperlink{group__str_g095c8adc8d7a7279e8c71746a5974ee6}{str\_\-rstrip} (\hyperlink{structstr}{str} $\ast$s) \item void \hyperlink{group__str_g369b7dda6ed587477dde663240cf175f}{str\_\-lcut} (\hyperlink{structstr}{str} $\ast$s, unsigned count) \item void \hyperlink{group__str_gb12e6ee45d534e52ef16f4d3f0d54390}{str\_\-rcut} (\hyperlink{structstr}{str} $\ast$s, unsigned count) \item int \hyperlink{group__str_g1185bbfed7209ff269342cea523de7dd}{str\_\-sort} (\hyperlink{structstr}{str} $\ast$s, char sep, long count, int($\ast$fn)(const \hyperlink{structstr__sortentry}{str\_\-sortentry} $\ast$a, const \hyperlink{structstr__sortentry}{str\_\-sortentry} $\ast$b)) \item \hypertarget{group__str_g5ec7d27f578d2ea17f7be976acb3b214}{ int \textbf{str\_\-splice} (\hyperlink{structstr}{str} $\ast$s, unsigned start, unsigned len, const \hyperlink{structstr}{str} $\ast$r)} \label{group__str_g5ec7d27f578d2ea17f7be976acb3b214} \item \hypertarget{group__str_g9e8aad09dbf83c86642761c1ed7547bf}{ int \textbf{str\_\-splices} (\hyperlink{structstr}{str} $\ast$s, unsigned start, unsigned len, const char $\ast$r)} \label{group__str_g9e8aad09dbf83c86642761c1ed7547bf} \item \hypertarget{group__str_gcc492d40b0c7c80df98cc0ecf88607f6}{ int \textbf{str\_\-spliceb} (\hyperlink{structstr}{str} $\ast$s, unsigned start, unsigned len, const char $\ast$r, unsigned rlen)} \label{group__str_gcc492d40b0c7c80df98cc0ecf88607f6} \item long \hyperlink{group__str_g46b3436a55500d66b1343ff7c8122831}{str\_\-xlate} (\hyperlink{structstr}{str} $\ast$s, const char $\ast$from, const char $\ast$to, unsigned nchars) \item \hypertarget{group__str_ga09ac31a610a1a52a332668efeb65098}{ \#define \textbf{str\_\-strip}(S)~(str\_\-rstrip(S), str\_\-lstrip(S))} \label{group__str_ga09ac31a610a1a52a332668efeb65098} \end{CompactItemize} \subsection*{Comparison Functions} \begin{CompactItemize} \item int \hyperlink{group__str_geb74139283badb56982c06173e3a9079}{str\_\-cmp} (const \hyperlink{structstr}{str} $\ast$a, unsigned aoffset, const \hyperlink{structstr}{str} $\ast$b, unsigned boffset) \item int \hyperlink{group__str_g1491b9a90c43057bb3c67c59773214cb}{str\_\-cmps} (const \hyperlink{structstr}{str} $\ast$a, unsigned offset, const char $\ast$b) \item int \hyperlink{group__str_g46acafcb25f47a15c621f04440f8dfd9}{str\_\-cmpb} (const \hyperlink{structstr}{str} $\ast$a, unsigned offset, const char $\ast$b, unsigned len) \item int \hyperlink{group__str_g74a4a36ff6330ef20d06aef6ce435880}{str\_\-diff} (const \hyperlink{structstr}{str} $\ast$a, const \hyperlink{structstr}{str} $\ast$b) \item int \hyperlink{group__str_g47e06bbe9f29fa4ef17c8ed8ce86a254}{str\_\-diffs} (const \hyperlink{structstr}{str} $\ast$a, const char $\ast$b) \item int \hyperlink{group__str_g883a558554aff991f4605481553e95b5}{str\_\-diffb} (const \hyperlink{structstr}{str} $\ast$a, const char $\ast$b, unsigned len) \item int \hyperlink{group__str_gcfb8337b4272957c4c69778aa638abb3}{str\_\-start} (const \hyperlink{structstr}{str} $\ast$a, const \hyperlink{structstr}{str} $\ast$b) \item int \hyperlink{group__str_g30962ec2d9c3c344551d207f60ed1678}{str\_\-starts} (const \hyperlink{structstr}{str} $\ast$a, const char $\ast$b) \item int \hyperlink{group__str_geee63556363e5c44a1f3b6316cc0ac65}{str\_\-startb} (const \hyperlink{structstr}{str} $\ast$a, const char $\ast$b, unsigned len) \item int \hyperlink{group__str_g7a6b0a9d047f8a0e09c26e3e85cad7e5}{str\_\-case\_\-start} (const \hyperlink{structstr}{str} $\ast$a, const \hyperlink{structstr}{str} $\ast$b) \item int \hyperlink{group__str_g8dd1e9b84f7196e52763003e066c447e}{str\_\-case\_\-starts} (const \hyperlink{structstr}{str} $\ast$a, const char $\ast$b) \item int \hyperlink{group__str_g436a9c8d8bed864651729b8956289b2e}{str\_\-case\_\-startb} (const \hyperlink{structstr}{str} $\ast$a, const char $\ast$b, unsigned len) \end{CompactItemize} \subsection*{Searching Functions} \begin{CompactItemize} \item void \hyperlink{group__str_g8eaf81912158733331aa9a8b8f92bd7c}{str\_\-buildmap} (int map\mbox{[}256\mbox{]}, const char $\ast$list) \item unsigned \hyperlink{group__str_g54f4ff27f4a2ee0eb842a44b1b16b600}{str\_\-count} (const \hyperlink{structstr}{str} $\ast$s, char ch) \item unsigned \hyperlink{group__str_g3ce731047986d72c5514d83876d259f4}{str\_\-countof} (const \hyperlink{structstr}{str} $\ast$s, const char $\ast$list) \item int \hyperlink{group__str_g192b55272495861b19f9928a2e677717}{str\_\-findnext} (const \hyperlink{structstr}{str} $\ast$s, char ch, unsigned pos) \item int \hyperlink{group__str_g00a17536de20c68dd23fa8e872f8a713}{str\_\-findnextof} (const \hyperlink{structstr}{str} $\ast$s, const char $\ast$list, unsigned pos) \item int \hyperlink{group__str_g1fd2973086658d66dc34a27b45b43286}{str\_\-findnextnot} (const \hyperlink{structstr}{str} $\ast$s, const char $\ast$list, unsigned pos) \item int \hyperlink{group__str_gd132f32bf7d02f19f86aca10a0c5f1cc}{str\_\-findprev} (const \hyperlink{structstr}{str} $\ast$s, char ch, unsigned pos) \item int \hyperlink{group__str_g34f902a8bd040b4d44802c7f5f2ca24a}{str\_\-findprevof} (const \hyperlink{structstr}{str} $\ast$s, const char $\ast$list, unsigned pos) \item int \hyperlink{group__str_g58db78418ff61c2b7b7e11f7021c9726}{str\_\-findprevnot} (const \hyperlink{structstr}{str} $\ast$s, const char $\ast$list, unsigned pos) \item \hypertarget{group__str_gcafe63caac1303c441db7c110be027fa}{ \#define \textbf{str\_\-findfirst}(S, C)~str\_\-findnext(S,C,0)} \label{group__str_gcafe63caac1303c441db7c110be027fa} \item \hypertarget{group__str_g7a0a2b90aa7d8d6205eaea575fdfd1d0}{ \#define \textbf{str\_\-findfirstof}(S, L)~str\_\-findnextof(S,L,0)} \label{group__str_g7a0a2b90aa7d8d6205eaea575fdfd1d0} \item \hypertarget{group__str_g9cf04df9caf73233932f12d804e84267}{ \#define \textbf{str\_\-findfirstnot}(S, L)~str\_\-findnextnot(S,L,0)} \label{group__str_g9cf04df9caf73233932f12d804e84267} \item \hypertarget{group__str_g86dc14ff56c94ae7eab5c60fc0ef2c82}{ \#define \textbf{str\_\-findlast}(S, C)~str\_\-findprev(S,C,-1)} \label{group__str_g86dc14ff56c94ae7eab5c60fc0ef2c82} \item \hypertarget{group__str_g7ac5797d7f29eaf3117e7a1a25865acc}{ \#define \textbf{str\_\-findlastof}(S, L)~str\_\-findprevof(S,L,-1)} \label{group__str_g7ac5797d7f29eaf3117e7a1a25865acc} \item \hypertarget{group__str_gd4f15c8af11ced1540e121be2ca5645f}{ \#define \textbf{str\_\-findlastnot}(S, L)~str\_\-findprevof(S,L,-1)} \label{group__str_gd4f15c8af11ced1540e121be2ca5645f} \end{CompactItemize} \subsection*{Pattern Matching Functions} \begin{CompactItemize} \item int \hyperlink{group__str_g4241fa2b3265e698c4f327ac878b5090}{str\_\-match} (const \hyperlink{structstr}{str} $\ast$s, const \hyperlink{structstr}{str} $\ast$pattern) \item int \hyperlink{group__str_gd41f66c803aaaecccbd8f9e5e987d24f}{str\_\-matchb} (const \hyperlink{structstr}{str} $\ast$s, const char $\ast$pptr, unsigned plen) \item int \hyperlink{group__str_g3c70c8b87d7a5bd64d8ac1d6da3e9165}{str\_\-matchs} (const \hyperlink{structstr}{str} $\ast$s, const char $\ast$pattern) \item int \hyperlink{group__str_g1fd18484f9102d187a58f1091aa5bc61}{str\_\-case\_\-match} (const \hyperlink{structstr}{str} $\ast$s, const \hyperlink{structstr}{str} $\ast$pattern) \item int \hyperlink{group__str_g8b1e8bad767b5a420c491d63a1695047}{str\_\-case\_\-matchb} (const \hyperlink{structstr}{str} $\ast$s, const char $\ast$pptr, unsigned plen) \item int \hyperlink{group__str_g8250bc117392792ef3ae306a01f85594}{str\_\-case\_\-matchs} (const \hyperlink{structstr}{str} $\ast$s, const char $\ast$pattern) \item \hypertarget{group__str_g3b4be3810f8daf7cc70746821b259099}{ int \textbf{str\_\-glob} (const \hyperlink{structstr}{str} $\ast$s, const \hyperlink{structstr}{str} $\ast$pattern)} \label{group__str_g3b4be3810f8daf7cc70746821b259099} \item \hypertarget{group__str_g19331678b1141ae60d39df94abf2db32}{ int \textbf{str\_\-globb} (const \hyperlink{structstr}{str} $\ast$s, const char $\ast$pptr, unsigned plen)} \label{group__str_g19331678b1141ae60d39df94abf2db32} \item \hypertarget{group__str_g853fcc01b7932506f5b27c1b30a00472}{ int \textbf{str\_\-globs} (const \hyperlink{structstr}{str} $\ast$s, const char $\ast$pattern)} \label{group__str_g853fcc01b7932506f5b27c1b30a00472} \item \hypertarget{group__str_g4b5f38a048003c512b546137ad26a310}{ int \textbf{str\_\-case\_\-glob} (const \hyperlink{structstr}{str} $\ast$s, const \hyperlink{structstr}{str} $\ast$pattern)} \label{group__str_g4b5f38a048003c512b546137ad26a310} \item \hypertarget{group__str_g83cd6e57aab22035b4bf568f07e295f4}{ int \textbf{str\_\-case\_\-globb} (const \hyperlink{structstr}{str} $\ast$s, const char $\ast$pptr, unsigned plen)} \label{group__str_g83cd6e57aab22035b4bf568f07e295f4} \item \hypertarget{group__str_g9259ff806cd84c922bb8658fda8a1308}{ int \textbf{str\_\-case\_\-globs} (const \hyperlink{structstr}{str} $\ast$s, const char $\ast$pattern)} \label{group__str_g9259ff806cd84c922bb8658fda8a1308} \end{CompactItemize} \subsection*{Defines} \begin{CompactItemize} \item \#define \hyperlink{group__str_gccab40639d169842336c62cf80d807d8}{STR\_\-BLOCKSIZE}~16 \end{CompactItemize} \subsection*{Typedefs} \begin{CompactItemize} \item typedef struct \hyperlink{structstr}{str} \hyperlink{group__str_g07f60e1f2e898b38cc50a76452b31784}{str} \item typedef struct \hyperlink{structstr__sortentry}{str\_\-sortentry} \hyperlink{group__str_g689b2adc03eb9a807c497b0b1e7abbb9}{str\_\-sortentry} \end{CompactItemize} \subsection{Detailed Description} \begin{Desc} \item[Calling Convention]The standard calling convention to {\tt \hyperlink{structstr}{str}} functions is to pass the string being examined or modified as the first argument. For most functions, the return value will be {\tt 0} (false) if an error occurred (ie memory allocation failed) and non-zero (true) otherwise. \end{Desc} \subsection{Define Documentation} \hypertarget{group__str_gccab40639d169842336c62cf80d807d8}{ \index{str@{str}!STR\_\-BLOCKSIZE@{STR\_\-BLOCKSIZE}} \index{STR\_\-BLOCKSIZE@{STR\_\-BLOCKSIZE}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define STR\_\-BLOCKSIZE~16}} \label{group__str_gccab40639d169842336c62cf80d807d8} The block size in which string memory is allocated. {\tt STR\_\-BLOCKSIZE} should be set to at least the size at which the allocator (ie {\tt 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. \hypertarget{group__str_g5130cf1a57c497bab66091fbdb9fd6d3}{ \index{str@{str}!str\_\-ready@{str\_\-ready}} \index{str\_\-ready@{str\_\-ready}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define str\_\-ready(S, SZ)~str\_\-alloc(S,SZ,0)}} \label{group__str_g5130cf1a57c497bab66091fbdb9fd6d3} Make sure string S has at least SZ bytes ready (no copy) \hypertarget{group__str_g05c5854c9d40dbe953625279b5deb5c7}{ \index{str@{str}!str\_\-realloc@{str\_\-realloc}} \index{str\_\-realloc@{str\_\-realloc}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define str\_\-realloc(S, SZ)~str\_\-alloc(S,SZ,1)}} \label{group__str_g05c5854c9d40dbe953625279b5deb5c7} Reallocate string S to size SZ bytes, copying the existing string \subsection{Typedef Documentation} \hypertarget{group__str_g07f60e1f2e898b38cc50a76452b31784}{ \index{str@{str}!str@{str}} \index{str@{str}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef struct {\bf str} {\bf str}}} \label{group__str_g07f60e1f2e898b38cc50a76452b31784} String structure typedef. \hypertarget{group__str_g689b2adc03eb9a807c497b0b1e7abbb9}{ \index{str@{str}!str\_\-sortentry@{str\_\-sortentry}} \index{str\_\-sortentry@{str\_\-sortentry}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef struct {\bf str\_\-sortentry} {\bf str\_\-sortentry}}} \label{group__str_g689b2adc03eb9a807c497b0b1e7abbb9} String sort entry typedef. \subsection{Function Documentation} \hypertarget{group__str_gca368420555c886139b10d887df45941}{ \index{str@{str}!str\_\-alloc@{str\_\-alloc}} \index{str\_\-alloc@{str\_\-alloc}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-alloc ({\bf str} $\ast$ {\em s}, unsigned {\em size}, int {\em copy})}} \label{group__str_gca368420555c886139b10d887df45941} Allocate storage for a string. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em s}]String to modify. \item[{\em size}]Minimum number of bytes for which to allocate. \item[{\em copy}]If set, the existing string will be copied into the new string.\end{description} \end{Desc} The size given is incremented to account for adding a trailing {\tt NUL} byte (to ensure compatibility with C string functions) and is then rounded up to the nearest {\tt STR\_\-BLOCKSIZE} interval. \hypertarget{group__str_g8eaf81912158733331aa9a8b8f92bd7c}{ \index{str@{str}!str\_\-buildmap@{str\_\-buildmap}} \index{str\_\-buildmap@{str\_\-buildmap}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void str\_\-buildmap (int {\em map}\mbox{[}256\mbox{]}, const char $\ast$ {\em list})}} \label{group__str_g8eaf81912158733331aa9a8b8f92bd7c} Build a map from the list of characters. Each byte in the output map contains either {\tt -1} if the corresponding character was not present in the input string, or the offset of the last instance of the character in the list. \hypertarget{group__str_g1fd18484f9102d187a58f1091aa5bc61}{ \index{str@{str}!str\_\-case\_\-match@{str\_\-case\_\-match}} \index{str\_\-case\_\-match@{str\_\-case\_\-match}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-case\_\-match (const {\bf str} $\ast$ {\em s}, const {\bf str} $\ast$ {\em pattern})}} \label{group__str_g1fd18484f9102d187a58f1091aa5bc61} Simple pattern match on dynamic string pattern. \hypertarget{group__str_g8b1e8bad767b5a420c491d63a1695047}{ \index{str@{str}!str\_\-case\_\-matchb@{str\_\-case\_\-matchb}} \index{str\_\-case\_\-matchb@{str\_\-case\_\-matchb}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-case\_\-matchb (const {\bf str} $\ast$ {\em s}, const char $\ast$ {\em pptr}, unsigned {\em plen})}} \label{group__str_g8b1e8bad767b5a420c491d63a1695047} Simple but fast (linear time) pattern matching on binary pattern. \hypertarget{group__str_g8250bc117392792ef3ae306a01f85594}{ \index{str@{str}!str\_\-case\_\-matchs@{str\_\-case\_\-matchs}} \index{str\_\-case\_\-matchs@{str\_\-case\_\-matchs}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-case\_\-matchs (const {\bf str} $\ast$ {\em s}, const char $\ast$ {\em pattern})}} \label{group__str_g8250bc117392792ef3ae306a01f85594} Simple pattern match on C string pattern. \hypertarget{group__str_g7a6b0a9d047f8a0e09c26e3e85cad7e5}{ \index{str@{str}!str\_\-case\_\-start@{str\_\-case\_\-start}} \index{str\_\-case\_\-start@{str\_\-case\_\-start}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-case\_\-start (const {\bf str} $\ast$ {\em a}, const {\bf str} $\ast$ {\em b})}} \label{group__str_g7a6b0a9d047f8a0e09c26e3e85cad7e5} Match the prefix of the string to another string. \hypertarget{group__str_g436a9c8d8bed864651729b8956289b2e}{ \index{str@{str}!str\_\-case\_\-startb@{str\_\-case\_\-startb}} \index{str\_\-case\_\-startb@{str\_\-case\_\-startb}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-case\_\-startb (const {\bf str} $\ast$ {\em a}, const char $\ast$ {\em b}, unsigned {\em len})}} \label{group__str_g436a9c8d8bed864651729b8956289b2e} Match the prefix of the string to a binary chunk. \hypertarget{group__str_g8dd1e9b84f7196e52763003e066c447e}{ \index{str@{str}!str\_\-case\_\-starts@{str\_\-case\_\-starts}} \index{str\_\-case\_\-starts@{str\_\-case\_\-starts}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-case\_\-starts (const {\bf str} $\ast$ {\em a}, const char $\ast$ {\em b})}} \label{group__str_g8dd1e9b84f7196e52763003e066c447e} Match the prefix of the string to a C string. \hypertarget{group__str_g6da816627202e243e6c3b3fdac1ff12d}{ \index{str@{str}!str\_\-cat@{str\_\-cat}} \index{str\_\-cat@{str\_\-cat}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-cat ({\bf str} $\ast$ {\em s}, const {\bf str} $\ast$ {\em in})}} \label{group__str_g6da816627202e243e6c3b3fdac1ff12d} Append another string \hypertarget{group__str_gf0fddce8535bf2959969ff59e2fe99b4}{ \index{str@{str}!str\_\-cat2s@{str\_\-cat2s}} \index{str\_\-cat2s@{str\_\-cat2s}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-cat2s ({\bf str} $\ast$ {\em s}, const char $\ast$ {\em a}, const char $\ast$ {\em b})}} \label{group__str_gf0fddce8535bf2959969ff59e2fe99b4} Append 2 C strings \hypertarget{group__str_gb4790ea2df2856a08daac7d5277451b0}{ \index{str@{str}!str\_\-cat3s@{str\_\-cat3s}} \index{str\_\-cat3s@{str\_\-cat3s}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-cat3s ({\bf str} $\ast$ {\em s}, const char $\ast$ {\em a}, const char $\ast$ {\em b}, const char $\ast$ {\em c})}} \label{group__str_gb4790ea2df2856a08daac7d5277451b0} Append 3 C strings \hypertarget{group__str_g9e13b2db85a12a2496dc2e55fdd93a08}{ \index{str@{str}!str\_\-cat4s@{str\_\-cat4s}} \index{str\_\-cat4s@{str\_\-cat4s}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-cat4s ({\bf str} $\ast$ {\em s}, const char $\ast$ {\em a}, const char $\ast$ {\em b}, const char $\ast$ {\em c}, const char $\ast$ {\em d})}} \label{group__str_g9e13b2db85a12a2496dc2e55fdd93a08} Append 4 C strings \hypertarget{group__str_g513f21f2da4a0de972ce4ee7872ad19f}{ \index{str@{str}!str\_\-cat5s@{str\_\-cat5s}} \index{str\_\-cat5s@{str\_\-cat5s}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-cat5s ({\bf str} $\ast$ {\em s}, const char $\ast$ {\em a}, const char $\ast$ {\em b}, const char $\ast$ {\em c}, const char $\ast$ {\em d}, const char $\ast$ {\em e})}} \label{group__str_g513f21f2da4a0de972ce4ee7872ad19f} Append 5 C strings \hypertarget{group__str_gcf819cd99a8b3676c65447447e62dcaa}{ \index{str@{str}!str\_\-cat6s@{str\_\-cat6s}} \index{str\_\-cat6s@{str\_\-cat6s}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-cat6s ({\bf str} $\ast$ {\em s}, const char $\ast$ {\em a}, const char $\ast$ {\em b}, const char $\ast$ {\em c}, const char $\ast$ {\em d}, const char $\ast$ {\em e}, const char $\ast$ {\em f})}} \label{group__str_gcf819cd99a8b3676c65447447e62dcaa} Append 6 C strings \hypertarget{group__str_g7d1534a006941bdb22c4ce4b9b305cda}{ \index{str@{str}!str\_\-catb@{str\_\-catb}} \index{str\_\-catb@{str\_\-catb}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-catb ({\bf str} $\ast$ {\em s}, const char $\ast$ {\em in}, unsigned {\em len})}} \label{group__str_g7d1534a006941bdb22c4ce4b9b305cda} Append a binary block \hypertarget{group__str_gd684484056b8aa9e5937a7bd5fb1546a}{ \index{str@{str}!str\_\-catc@{str\_\-catc}} \index{str\_\-catc@{str\_\-catc}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-catc ({\bf str} $\ast$ {\em s}, char {\em in})}} \label{group__str_gd684484056b8aa9e5937a7bd5fb1546a} Append a single character \hypertarget{group__str_g1cf63dbdaa6703b26d8ce72e6901ffbe}{ \index{str@{str}!str\_\-catf@{str\_\-catf}} \index{str\_\-catf@{str\_\-catf}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-catf ({\bf str} $\ast$ {\em s}, const char $\ast$ {\em format}, {\em ...})}} \label{group__str_g1cf63dbdaa6703b26d8ce72e6901ffbe} Append formatted data using {\tt fmt\_\-multi} from variable arguments \hypertarget{group__str_g7e35e57a0e6189350eab468449770fd8}{ \index{str@{str}!str\_\-catfv@{str\_\-catfv}} \index{str\_\-catfv@{str\_\-catfv}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-catfv ({\bf str} $\ast$ {\em s}, const char $\ast$ {\em format}, va\_\-list {\em ap})}} \label{group__str_g7e35e57a0e6189350eab468449770fd8} Append formatted data using {\tt fmt\_\-multi} from a {\tt va\_\-list} \hypertarget{group__str_ge7813ee8c5777ac1933667492ae8a678}{ \index{str@{str}!str\_\-cati@{str\_\-cati}} \index{str\_\-cati@{str\_\-cati}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-cati ({\bf str} $\ast$ {\em s}, long {\em in})}} \label{group__str_ge7813ee8c5777ac1933667492ae8a678} Append a signed integer in decimal. \hypertarget{group__str_gfd20d5489dd738b8eb92a50e229c9e6c}{ \index{str@{str}!str\_\-catill@{str\_\-catill}} \index{str\_\-catill@{str\_\-catill}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-catill ({\bf str} $\ast$ {\em s}, long long {\em in})}} \label{group__str_gfd20d5489dd738b8eb92a50e229c9e6c} Append a signed long long integer in decimal. \hypertarget{group__str_g3143a40d753401322ef385b3fdbadb16}{ \index{str@{str}!str\_\-catiw@{str\_\-catiw}} \index{str\_\-catiw@{str\_\-catiw}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-catiw ({\bf str} $\ast$ {\em s}, long {\em in}, unsigned {\em width}, char {\em pad})}} \label{group__str_g3143a40d753401322ef385b3fdbadb16} Append a signed integer in decimal, padded to a minimum width. \hypertarget{group__str_g656f6072b556cea1cc241e569147026e}{ \index{str@{str}!str\_\-catiwll@{str\_\-catiwll}} \index{str\_\-catiwll@{str\_\-catiwll}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-catiwll ({\bf str} $\ast$ {\em s}, long long {\em in}, unsigned {\em width}, char {\em pad})}} \label{group__str_g656f6072b556cea1cc241e569147026e} Append a signed long long integer in decimal, padded to a minimum width. \hypertarget{group__str_g67112113aa1d19fba4088a1fd7459be5}{ \index{str@{str}!str\_\-catns@{str\_\-catns}} \index{str\_\-catns@{str\_\-catns}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-catns ({\bf str} $\ast$ {\em s}, unsigned int {\em count}, {\em ...})}} \label{group__str_g67112113aa1d19fba4088a1fd7459be5} Append N C strings \hypertarget{group__str_g18e74bb0d26292957bf7737b2f497de2}{ \index{str@{str}!str\_\-cats@{str\_\-cats}} \index{str\_\-cats@{str\_\-cats}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-cats ({\bf str} $\ast$ {\em s}, const char $\ast$ {\em in})}} \label{group__str_g18e74bb0d26292957bf7737b2f497de2} Append a C string \hypertarget{group__str_g1d1f106f84cda58651c02b89b1e44096}{ \index{str@{str}!str\_\-catsllnumw@{str\_\-catsllnumw}} \index{str\_\-catsllnumw@{str\_\-catsllnumw}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-catsllnumw ({\bf str} $\ast$ {\em s}, long long {\em in}, unsigned {\em width}, char {\em pad}, unsigned {\em base}, const char $\ast$ {\em digits})}} \label{group__str_g1d1f106f84cda58651c02b89b1e44096} Append a signed long long integer, optionally padded to a minimum width \hypertarget{group__str_geb7177e96cecb7853ecdf9f5e3095304}{ \index{str@{str}!str\_\-catsnumw@{str\_\-catsnumw}} \index{str\_\-catsnumw@{str\_\-catsnumw}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-catsnumw ({\bf str} $\ast$ {\em s}, long {\em in}, unsigned {\em width}, char {\em pad}, unsigned {\em base}, const char $\ast$ {\em digits})}} \label{group__str_geb7177e96cecb7853ecdf9f5e3095304} Append a signed integer, optionally padded to a minimum width \hypertarget{group__str_g7f65270d3b4b0fb5c12590094176bc9f}{ \index{str@{str}!str\_\-catu@{str\_\-catu}} \index{str\_\-catu@{str\_\-catu}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-catu ({\bf str} $\ast$ {\em s}, unsigned long {\em in})}} \label{group__str_g7f65270d3b4b0fb5c12590094176bc9f} Append an unsigned integer in decimal, padded to a minimum width. \hypertarget{group__str_g9225e94eba3cd097f75fffced7067309}{ \index{str@{str}!str\_\-catull@{str\_\-catull}} \index{str\_\-catull@{str\_\-catull}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-catull ({\bf str} $\ast$ {\em s}, unsigned long long {\em in})}} \label{group__str_g9225e94eba3cd097f75fffced7067309} Append an unsigned long long integer in decimal. \hypertarget{group__str_gc6568910addff1f7163b5755fcfd4386}{ \index{str@{str}!str\_\-catullnumw@{str\_\-catullnumw}} \index{str\_\-catullnumw@{str\_\-catullnumw}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-catullnumw ({\bf str} $\ast$ {\em s}, unsigned long long {\em in}, unsigned {\em width}, char {\em pad}, unsigned {\em base}, const char $\ast$ {\em digits})}} \label{group__str_gc6568910addff1f7163b5755fcfd4386} Append an unsigned long long integer, optionally padded to a minimum width \hypertarget{group__str_g03abaeebd39c746d305aefd271a5ed67}{ \index{str@{str}!str\_\-catunumw@{str\_\-catunumw}} \index{str\_\-catunumw@{str\_\-catunumw}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-catunumw ({\bf str} $\ast$ {\em s}, unsigned long {\em in}, unsigned {\em width}, char {\em pad}, unsigned {\em base}, const char $\ast$ {\em digits})}} \label{group__str_g03abaeebd39c746d305aefd271a5ed67} Append an unsigned integer, optionally padded to a minimum width \hypertarget{group__str_gd640ad0f22f32ac02d6f9a5468288096}{ \index{str@{str}!str\_\-catuw@{str\_\-catuw}} \index{str\_\-catuw@{str\_\-catuw}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-catuw ({\bf str} $\ast$ {\em s}, unsigned long {\em in}, unsigned {\em width}, char {\em pad})}} \label{group__str_gd640ad0f22f32ac02d6f9a5468288096} Append an unsigned integer in decimal. \hypertarget{group__str_g6d2d541e6d58bf6a66b4384d72e8c637}{ \index{str@{str}!str\_\-catuwll@{str\_\-catuwll}} \index{str\_\-catuwll@{str\_\-catuwll}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-catuwll ({\bf str} $\ast$ {\em s}, unsigned long long {\em in}, unsigned {\em width}, char {\em pad})}} \label{group__str_g6d2d541e6d58bf6a66b4384d72e8c637} Append an unsigned long long integer in decimal, padded to a minimum width. \hypertarget{group__str_g18708cef8d28920a765ca52cb31384cd}{ \index{str@{str}!str\_\-catx@{str\_\-catx}} \index{str\_\-catx@{str\_\-catx}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-catx ({\bf str} $\ast$ {\em s}, unsigned long {\em in})}} \label{group__str_g18708cef8d28920a765ca52cb31384cd} Append an unsigned integer in hexadecimal, padded to a minimum width. \hypertarget{group__str_ge0b9b4c32606fee5347462764df26d58}{ \index{str@{str}!str\_\-catxll@{str\_\-catxll}} \index{str\_\-catxll@{str\_\-catxll}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-catxll ({\bf str} $\ast$ {\em s}, unsigned long long {\em in})}} \label{group__str_ge0b9b4c32606fee5347462764df26d58} Append an unsigned long long integer in hexadecimal. \hypertarget{group__str_g046ba4fd6ae781e69c403ac8bdb8a4c0}{ \index{str@{str}!str\_\-catxw@{str\_\-catxw}} \index{str\_\-catxw@{str\_\-catxw}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-catxw ({\bf str} $\ast$ {\em s}, unsigned long {\em in}, unsigned {\em width}, char {\em pad})}} \label{group__str_g046ba4fd6ae781e69c403ac8bdb8a4c0} Append an unsigned integer in hexadecimal. \hypertarget{group__str_gc34f93772aa9ff884e08b1e9e9af252e}{ \index{str@{str}!str\_\-catxwll@{str\_\-catxwll}} \index{str\_\-catxwll@{str\_\-catxwll}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-catxwll ({\bf str} $\ast$ {\em s}, unsigned long long {\em in}, unsigned {\em width}, char {\em pad})}} \label{group__str_gc34f93772aa9ff884e08b1e9e9af252e} Append an unsigned long long integer in hexadecimal, padded to a minimum width. \hypertarget{group__str_geb74139283badb56982c06173e3a9079}{ \index{str@{str}!str\_\-cmp@{str\_\-cmp}} \index{str\_\-cmp@{str\_\-cmp}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-cmp (const {\bf str} $\ast$ {\em a}, unsigned {\em aoffset}, const {\bf str} $\ast$ {\em b}, unsigned {\em boffset})}} \label{group__str_geb74139283badb56982c06173e3a9079} Compare part of two strings. This function compares two strings, starting at {\tt aoffset} bytes into {\tt a} and {\tt boffset} bytes into {\tt b}. The first non-zero difference is returned. If the portion of {\tt b} is longer than the portion of {\tt a}, the result is positive. \hypertarget{group__str_g46acafcb25f47a15c621f04440f8dfd9}{ \index{str@{str}!str\_\-cmpb@{str\_\-cmpb}} \index{str\_\-cmpb@{str\_\-cmpb}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-cmpb (const {\bf str} $\ast$ {\em a}, unsigned {\em offset}, const char $\ast$ {\em b}, unsigned {\em len})}} \label{group__str_g46acafcb25f47a15c621f04440f8dfd9} Compare a string against a binary block. \hypertarget{group__str_g1491b9a90c43057bb3c67c59773214cb}{ \index{str@{str}!str\_\-cmps@{str\_\-cmps}} \index{str\_\-cmps@{str\_\-cmps}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-cmps (const {\bf str} $\ast$ {\em a}, unsigned {\em offset}, const char $\ast$ {\em b})}} \label{group__str_g1491b9a90c43057bb3c67c59773214cb} Compare a string against a C string. \hypertarget{group__str_g9156aedd17aac54cd238c8caa6dc6e85}{ \index{str@{str}!str\_\-copy@{str\_\-copy}} \index{str\_\-copy@{str\_\-copy}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-copy ({\bf str} $\ast$ {\em s}, const {\bf str} $\ast$ {\em in})}} \label{group__str_g9156aedd17aac54cd238c8caa6dc6e85} Copy in a string \hypertarget{group__str_g0883eb2957281e989efab5d1591c6e94}{ \index{str@{str}!str\_\-copy2s@{str\_\-copy2s}} \index{str\_\-copy2s@{str\_\-copy2s}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-copy2s ({\bf str} $\ast$ {\em s}, const char $\ast$ {\em a}, const char $\ast$ {\em b})}} \label{group__str_g0883eb2957281e989efab5d1591c6e94} Copy in the concatenation of 2 C strings \hypertarget{group__str_g59d4d0111c25f28598949d4fa3ccb277}{ \index{str@{str}!str\_\-copy3s@{str\_\-copy3s}} \index{str\_\-copy3s@{str\_\-copy3s}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-copy3s ({\bf str} $\ast$ {\em s}, const char $\ast$ {\em a}, const char $\ast$ {\em b}, const char $\ast$ {\em c})}} \label{group__str_g59d4d0111c25f28598949d4fa3ccb277} Copy in the concatenation of 3 C strings \hypertarget{group__str_gd15c9de561eed3870cee0d2993eb1085}{ \index{str@{str}!str\_\-copy4s@{str\_\-copy4s}} \index{str\_\-copy4s@{str\_\-copy4s}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-copy4s ({\bf str} $\ast$ {\em s}, const char $\ast$ {\em a}, const char $\ast$ {\em b}, const char $\ast$ {\em c}, const char $\ast$ {\em d})}} \label{group__str_gd15c9de561eed3870cee0d2993eb1085} Copy in the concatenation of 4 C strings \hypertarget{group__str_g4b05822e5ae0fee9491141c268ce2866}{ \index{str@{str}!str\_\-copy5s@{str\_\-copy5s}} \index{str\_\-copy5s@{str\_\-copy5s}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-copy5s ({\bf str} $\ast$ {\em s}, const char $\ast$ {\em a}, const char $\ast$ {\em b}, const char $\ast$ {\em c}, const char $\ast$ {\em d}, const char $\ast$ {\em e})}} \label{group__str_g4b05822e5ae0fee9491141c268ce2866} Copy in the concatenation of 5 C strings \hypertarget{group__str_g16ed7543ffa368a468b00cc4b572e012}{ \index{str@{str}!str\_\-copy6s@{str\_\-copy6s}} \index{str\_\-copy6s@{str\_\-copy6s}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-copy6s ({\bf str} $\ast$ {\em s}, const char $\ast$ {\em a}, const char $\ast$ {\em b}, const char $\ast$ {\em c}, const char $\ast$ {\em d}, const char $\ast$ {\em e}, const char $\ast$ {\em f})}} \label{group__str_g16ed7543ffa368a468b00cc4b572e012} Copy in the concatenation of 6 C strings \hypertarget{group__str_g26880681d1ed8fd1a80ccd4e39ce6e61}{ \index{str@{str}!str\_\-copyb@{str\_\-copyb}} \index{str\_\-copyb@{str\_\-copyb}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-copyb ({\bf str} $\ast$ {\em s}, const char $\ast$ {\em in}, unsigned {\em len})}} \label{group__str_g26880681d1ed8fd1a80ccd4e39ce6e61} Copy in a binary block \hypertarget{group__str_ga48f044aa7889f07df12b69a9f9dc081}{ \index{str@{str}!str\_\-copyf@{str\_\-copyf}} \index{str\_\-copyf@{str\_\-copyf}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-copyf ({\bf str} $\ast$ {\em s}, const char $\ast$ {\em format}, {\em ...})}} \label{group__str_ga48f044aa7889f07df12b69a9f9dc081} Copy formatted data using {\tt fmt\_\-multi} from variable arguments \hypertarget{group__str_g6782b26e389f10eaf3ea8a3cb1fe7390}{ \index{str@{str}!str\_\-copyfv@{str\_\-copyfv}} \index{str\_\-copyfv@{str\_\-copyfv}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-copyfv ({\bf str} $\ast$ {\em s}, const char $\ast$ {\em format}, va\_\-list {\em ap})}} \label{group__str_g6782b26e389f10eaf3ea8a3cb1fe7390} Copy formatted data using {\tt fmt\_\-multi} from a {\tt va\_\-list} \hypertarget{group__str_g27fcdd2e902c5efac54fce1c2c9f4319}{ \index{str@{str}!str\_\-copyns@{str\_\-copyns}} \index{str\_\-copyns@{str\_\-copyns}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-copyns ({\bf str} $\ast$ {\em s}, unsigned int {\em count}, {\em ...})}} \label{group__str_g27fcdd2e902c5efac54fce1c2c9f4319} Copy in the concatenation of N C strings \hypertarget{group__str_g100c559e82996e86f9bb9472c0ce9331}{ \index{str@{str}!str\_\-copys@{str\_\-copys}} \index{str\_\-copys@{str\_\-copys}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-copys ({\bf str} $\ast$ {\em s}, const char $\ast$ {\em in})}} \label{group__str_g100c559e82996e86f9bb9472c0ce9331} Copy in a C string \hypertarget{group__str_g54f4ff27f4a2ee0eb842a44b1b16b600}{ \index{str@{str}!str\_\-count@{str\_\-count}} \index{str\_\-count@{str\_\-count}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned str\_\-count (const {\bf str} $\ast$ {\em s}, char {\em ch})}} \label{group__str_g54f4ff27f4a2ee0eb842a44b1b16b600} Count the number of instances of a character \hypertarget{group__str_g3ce731047986d72c5514d83876d259f4}{ \index{str@{str}!str\_\-countof@{str\_\-countof}} \index{str\_\-countof@{str\_\-countof}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned str\_\-countof (const {\bf str} $\ast$ {\em s}, const char $\ast$ {\em list})}} \label{group__str_g3ce731047986d72c5514d83876d259f4} Count the number of instances of a list of characters \hypertarget{group__str_g74a4a36ff6330ef20d06aef6ce435880}{ \index{str@{str}!str\_\-diff@{str\_\-diff}} \index{str\_\-diff@{str\_\-diff}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-diff (const {\bf str} $\ast$ {\em a}, const {\bf str} $\ast$ {\em b})}} \label{group__str_g74a4a36ff6330ef20d06aef6ce435880} Differentiate two strings. The first non-zero difference between {\tt a} and {\tt b} is returned. If {\tt a} is longer than {\tt b} and no differences are found up to the length of {\tt b}, then the return value is positive. If {\tt b} is longer than {\tt a} and no differences are found up to the length of {\tt a}, then the return value is negative. \hypertarget{group__str_g883a558554aff991f4605481553e95b5}{ \index{str@{str}!str\_\-diffb@{str\_\-diffb}} \index{str\_\-diffb@{str\_\-diffb}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-diffb (const {\bf str} $\ast$ {\em a}, const char $\ast$ {\em b}, unsigned {\em len})}} \label{group__str_g883a558554aff991f4605481553e95b5} Differentiate a string and a binary block. \hypertarget{group__str_g47e06bbe9f29fa4ef17c8ed8ce86a254}{ \index{str@{str}!str\_\-diffs@{str\_\-diffs}} \index{str\_\-diffs@{str\_\-diffs}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-diffs (const {\bf str} $\ast$ {\em a}, const char $\ast$ {\em b})}} \label{group__str_g47e06bbe9f29fa4ef17c8ed8ce86a254} Differentiate a string and a C string. \hypertarget{group__str_g192b55272495861b19f9928a2e677717}{ \index{str@{str}!str\_\-findnext@{str\_\-findnext}} \index{str\_\-findnext@{str\_\-findnext}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-findnext (const {\bf str} $\ast$ {\em s}, char {\em ch}, unsigned {\em pos})}} \label{group__str_g192b55272495861b19f9928a2e677717} Find the next instance of the given character, on or after {\tt pos} \hypertarget{group__str_g1fd2973086658d66dc34a27b45b43286}{ \index{str@{str}!str\_\-findnextnot@{str\_\-findnextnot}} \index{str\_\-findnextnot@{str\_\-findnextnot}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-findnextnot (const {\bf str} $\ast$ {\em s}, const char $\ast$ {\em list}, unsigned {\em pos})}} \label{group__str_g1fd2973086658d66dc34a27b45b43286} Find the next instance of a character not in the given list of characters, on or after {\tt pos} \hypertarget{group__str_g00a17536de20c68dd23fa8e872f8a713}{ \index{str@{str}!str\_\-findnextof@{str\_\-findnextof}} \index{str\_\-findnextof@{str\_\-findnextof}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-findnextof (const {\bf str} $\ast$ {\em s}, const char $\ast$ {\em list}, unsigned {\em pos})}} \label{group__str_g00a17536de20c68dd23fa8e872f8a713} Find the next instance of the given list of characters, on or after {\tt pos} \hypertarget{group__str_gd132f32bf7d02f19f86aca10a0c5f1cc}{ \index{str@{str}!str\_\-findprev@{str\_\-findprev}} \index{str\_\-findprev@{str\_\-findprev}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-findprev (const {\bf str} $\ast$ {\em s}, char {\em ch}, unsigned {\em pos})}} \label{group__str_gd132f32bf7d02f19f86aca10a0c5f1cc} Find the previous instance of the given character on or before {\tt pos} \hypertarget{group__str_g58db78418ff61c2b7b7e11f7021c9726}{ \index{str@{str}!str\_\-findprevnot@{str\_\-findprevnot}} \index{str\_\-findprevnot@{str\_\-findprevnot}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-findprevnot (const {\bf str} $\ast$ {\em s}, const char $\ast$ {\em list}, unsigned {\em pos})}} \label{group__str_g58db78418ff61c2b7b7e11f7021c9726} Find the previous instance of a character not in the given list of characters, on or before {\tt pos} \hypertarget{group__str_g34f902a8bd040b4d44802c7f5f2ca24a}{ \index{str@{str}!str\_\-findprevof@{str\_\-findprevof}} \index{str\_\-findprevof@{str\_\-findprevof}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-findprevof (const {\bf str} $\ast$ {\em s}, const char $\ast$ {\em list}, unsigned {\em pos})}} \label{group__str_g34f902a8bd040b4d44802c7f5f2ca24a} Find the previous instance of the given list of characters, on or before {\tt pos} \hypertarget{group__str_ga45f56943ecb5e8705e041ff6b70df95}{ \index{str@{str}!str\_\-free@{str\_\-free}} \index{str\_\-free@{str\_\-free}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void str\_\-free ({\bf str} $\ast$ {\em s})}} \label{group__str_ga45f56943ecb5e8705e041ff6b70df95} Free a string's storage. This function also sets all the members of the structure to zero. \hypertarget{group__str_g49aec9c56d91c2a8a18bf4677b5e8a5b}{ \index{str@{str}!str\_\-init@{str\_\-init}} \index{str\_\-init@{str\_\-init}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-init ({\bf str} $\ast$ {\em s})}} \label{group__str_g49aec9c56d91c2a8a18bf4677b5e8a5b} Initialize a string, giving it a small empty allocation. \hypertarget{group__str_gf76c4c5b41641d9437002d2b299d9580}{ \index{str@{str}!str\_\-join@{str\_\-join}} \index{str\_\-join@{str\_\-join}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-join ({\bf str} $\ast$ {\em s}, char {\em sep}, const {\bf str} $\ast$ {\em in})}} \label{group__str_gf76c4c5b41641d9437002d2b299d9580} Join two strings together with exactly one instance of the seperator. \hypertarget{group__str_gde075ea52e0a95ac5198b3cb44362f29}{ \index{str@{str}!str\_\-joinb@{str\_\-joinb}} \index{str\_\-joinb@{str\_\-joinb}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-joinb ({\bf str} $\ast$ {\em s}, char {\em sep}, const char $\ast$ {\em in}, unsigned {\em len})}} \label{group__str_gde075ea52e0a95ac5198b3cb44362f29} Join a binary block to this string \hypertarget{group__str_g2e8f8918d04489ad5deea5a2322f54b4}{ \index{str@{str}!str\_\-joins@{str\_\-joins}} \index{str\_\-joins@{str\_\-joins}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-joins ({\bf str} $\ast$ {\em s}, char {\em sep}, const char $\ast$ {\em in})}} \label{group__str_g2e8f8918d04489ad5deea5a2322f54b4} Join a C string to this string \hypertarget{group__str_g369b7dda6ed587477dde663240cf175f}{ \index{str@{str}!str\_\-lcut@{str\_\-lcut}} \index{str\_\-lcut@{str\_\-lcut}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void str\_\-lcut ({\bf str} $\ast$ {\em s}, unsigned {\em count})}} \label{group__str_g369b7dda6ed587477dde663240cf175f} Cut {\tt count} bytes from the left (front) of the string \hypertarget{group__str_gb338bac7017bdd4759f6a876fa3c1b36}{ \index{str@{str}!str\_\-lower@{str\_\-lower}} \index{str\_\-lower@{str\_\-lower}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void str\_\-lower ({\bf str} $\ast$ {\em s})}} \label{group__str_gb338bac7017bdd4759f6a876fa3c1b36} Translate all upper-case characters to lower-case \hypertarget{group__str_g97329d0205007c89bf197446f30c75de}{ \index{str@{str}!str\_\-lstrip@{str\_\-lstrip}} \index{str\_\-lstrip@{str\_\-lstrip}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void str\_\-lstrip ({\bf str} $\ast$ {\em s})}} \label{group__str_g97329d0205007c89bf197446f30c75de} Strip all white space from the left (front) of the string \hypertarget{group__str_g4241fa2b3265e698c4f327ac878b5090}{ \index{str@{str}!str\_\-match@{str\_\-match}} \index{str\_\-match@{str\_\-match}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-match (const {\bf str} $\ast$ {\em s}, const {\bf str} $\ast$ {\em pattern})}} \label{group__str_g4241fa2b3265e698c4f327ac878b5090} Simple pattern match on dynamic string pattern. \hypertarget{group__str_gd41f66c803aaaecccbd8f9e5e987d24f}{ \index{str@{str}!str\_\-matchb@{str\_\-matchb}} \index{str\_\-matchb@{str\_\-matchb}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-matchb (const {\bf str} $\ast$ {\em s}, const char $\ast$ {\em pptr}, unsigned {\em plen})}} \label{group__str_gd41f66c803aaaecccbd8f9e5e987d24f} Simple but fast (linear time) pattern matching on binary pattern. \hypertarget{group__str_g3c70c8b87d7a5bd64d8ac1d6da3e9165}{ \index{str@{str}!str\_\-matchs@{str\_\-matchs}} \index{str\_\-matchs@{str\_\-matchs}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-matchs (const {\bf str} $\ast$ {\em s}, const char $\ast$ {\em pattern})}} \label{group__str_g3c70c8b87d7a5bd64d8ac1d6da3e9165} Simple pattern match on C string pattern. \hypertarget{group__str_gb12e6ee45d534e52ef16f4d3f0d54390}{ \index{str@{str}!str\_\-rcut@{str\_\-rcut}} \index{str\_\-rcut@{str\_\-rcut}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void str\_\-rcut ({\bf str} $\ast$ {\em s}, unsigned {\em count})}} \label{group__str_gb12e6ee45d534e52ef16f4d3f0d54390} Cut {\tt count} bytes from the right (end) of the string \hypertarget{group__str_g095c8adc8d7a7279e8c71746a5974ee6}{ \index{str@{str}!str\_\-rstrip@{str\_\-rstrip}} \index{str\_\-rstrip@{str\_\-rstrip}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void str\_\-rstrip ({\bf str} $\ast$ {\em s})}} \label{group__str_g095c8adc8d7a7279e8c71746a5974ee6} Strip all white space from the right (end) of the string \hypertarget{group__str_g1185bbfed7209ff269342cea523de7dd}{ \index{str@{str}!str\_\-sort@{str\_\-sort}} \index{str\_\-sort@{str\_\-sort}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-sort ({\bf str} $\ast$ {\em s}, char {\em sep}, long {\em count}, int($\ast$)(const {\bf str\_\-sortentry} $\ast$a, const {\bf str\_\-sortentry} $\ast$b) {\em fn})}} \label{group__str_g1185bbfed7209ff269342cea523de7dd} Sort a string. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em s}]The string to sort. \item[{\em sep}]The character which delimits the substrings. \item[{\em count}]The number of substrings within {\tt s} (set to {\tt -1} if not known). \item[{\em fn}]The comparison function. Defaults to a function that works like {\tt memcmp}.\end{description} \end{Desc} \begin{Desc} \item[Note:]This function allocates a temporary array of substring pointers, and so may return {\tt 0} if memory allocation fails. The string itself is not reallocated. \end{Desc} \hypertarget{group__str_gcfb8337b4272957c4c69778aa638abb3}{ \index{str@{str}!str\_\-start@{str\_\-start}} \index{str\_\-start@{str\_\-start}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-start (const {\bf str} $\ast$ {\em a}, const {\bf str} $\ast$ {\em b})}} \label{group__str_gcfb8337b4272957c4c69778aa638abb3} Match the prefix of the string to another string. \hypertarget{group__str_geee63556363e5c44a1f3b6316cc0ac65}{ \index{str@{str}!str\_\-startb@{str\_\-startb}} \index{str\_\-startb@{str\_\-startb}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-startb (const {\bf str} $\ast$ {\em a}, const char $\ast$ {\em b}, unsigned {\em len})}} \label{group__str_geee63556363e5c44a1f3b6316cc0ac65} Match the prefix of the string to a binary chunk. \hypertarget{group__str_g30962ec2d9c3c344551d207f60ed1678}{ \index{str@{str}!str\_\-starts@{str\_\-starts}} \index{str\_\-starts@{str\_\-starts}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-starts (const {\bf str} $\ast$ {\em a}, const char $\ast$ {\em b})}} \label{group__str_g30962ec2d9c3c344551d207f60ed1678} Match the prefix of the string to a C string. \hypertarget{group__str_g7aa699416198667b7b2198591ee1811f}{ \index{str@{str}!str\_\-subst@{str\_\-subst}} \index{str\_\-subst@{str\_\-subst}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}long str\_\-subst ({\bf str} $\ast$ {\em s}, char {\em from}, char {\em to})}} \label{group__str_g7aa699416198667b7b2198591ee1811f} Substitute one character for another throughout the string. \begin{Desc} \item[Returns:]the number of substitutions made. \end{Desc} \hypertarget{group__str_g174d1bf12ba03f33d6bfe98c566fec4e}{ \index{str@{str}!str\_\-truncate@{str\_\-truncate}} \index{str\_\-truncate@{str\_\-truncate}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int str\_\-truncate ({\bf str} $\ast$ {\em s}, unsigned {\em len})}} \label{group__str_g174d1bf12ba03f33d6bfe98c566fec4e} Truncate a string. If {\tt len} is larger than the current size, the string is reallocated. If {\tt len} is less than the existing length (not size), the length of the string is reduced to {\tt len}. A {\tt NUL} marker is placed at {\tt len}. \hypertarget{group__str_g1b08b4fba3b7ea32ced0109a50ef7d06}{ \index{str@{str}!str\_\-upper@{str\_\-upper}} \index{str\_\-upper@{str\_\-upper}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void str\_\-upper ({\bf str} $\ast$ {\em s})}} \label{group__str_g1b08b4fba3b7ea32ced0109a50ef7d06} Translate all lower-case characters to upper-case \hypertarget{group__str_g46b3436a55500d66b1343ff7c8122831}{ \index{str@{str}!str\_\-xlate@{str\_\-xlate}} \index{str\_\-xlate@{str\_\-xlate}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}long str\_\-xlate ({\bf str} $\ast$ {\em s}, const char $\ast$ {\em from}, const char $\ast$ {\em to}, unsigned {\em nchars})}} \label{group__str_g46b3436a55500d66b1343ff7c8122831} Substitute one character for another throughout the string. \begin{Desc} \item[Returns:]the number of substitutions made. \end{Desc} \subsection{Variable Documentation} \hypertarget{group__str_gb17c3827c0b106c7103a9879751ea843}{ \index{str@{str}!str\_\-lcase\_\-digits@{str\_\-lcase\_\-digits}} \index{str\_\-lcase\_\-digits@{str\_\-lcase\_\-digits}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char {\bf str\_\-lcase\_\-digits}\mbox{[}36\mbox{]}}} \label{group__str_gb17c3827c0b106c7103a9879751ea843} Lower-case digits, also used for decimal numbers. \hypertarget{group__str_g46d474d8d0f88e74ba454722af30ac08}{ \index{str@{str}!str\_\-ucase\_\-digits@{str\_\-ucase\_\-digits}} \index{str\_\-ucase\_\-digits@{str\_\-ucase\_\-digits}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char {\bf str\_\-ucase\_\-digits}\mbox{[}36\mbox{]}}} \label{group__str_g46d474d8d0f88e74ba454722af30ac08} Upper-case digits. bglibs-1.106/doc/latex/structghashiter.tex0000664000076400007640000000374011147311327020163 0ustar bruceguenter\hypertarget{structghashiter}{ \section{ghashiter Struct Reference} \label{structghashiter}\index{ghashiter@{ghashiter}} } {\tt \#include $<$ghash.h$>$} \subsection*{Data Fields} \begin{CompactItemize} \item struct \hyperlink{structghash}{ghash} $\ast$ \hyperlink{structghashiter_9400ebff2f46daeac1fb7e0c27698349}{ghashp} \item unsigned \hyperlink{structghashiter_ac422825dcc6676300a007805243d883}{index} \item void $\ast$ \hyperlink{structghashiter_a28b45460b26b4dd85d1b5219b6778f1}{entry} \end{CompactItemize} \subsection{Detailed Description} The iterator data necessary to loop over a {\tt \hyperlink{structghash}{ghash}} table. \begin{Desc} \item[Examples: ]\par \hyperlink{adt_2ghash__test_8c-example}{adt/ghash\_\-test.c}.\end{Desc} \subsection{Field Documentation} \hypertarget{structghashiter_9400ebff2f46daeac1fb7e0c27698349}{ \index{ghashiter@{ghashiter}!ghashp@{ghashp}} \index{ghashp@{ghashp}!ghashiter@{ghashiter}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf ghash}$\ast$ {\bf ghashiter::ghashp}\hspace{0.3cm}{\tt \mbox{[}read\mbox{]}}}} \label{structghashiter_9400ebff2f46daeac1fb7e0c27698349} A pointer to the source {\tt \hyperlink{structghash}{ghash}} table. \hypertarget{structghashiter_ac422825dcc6676300a007805243d883}{ \index{ghashiter@{ghashiter}!index@{index}} \index{index@{index}!ghashiter@{ghashiter}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned {\bf ghashiter::index}}} \label{structghashiter_ac422825dcc6676300a007805243d883} The index of the current entry. \hypertarget{structghashiter_a28b45460b26b4dd85d1b5219b6778f1}{ \index{ghashiter@{ghashiter}!entry@{entry}} \index{entry@{entry}!ghashiter@{ghashiter}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ {\bf ghashiter::entry}}} \label{structghashiter_a28b45460b26b4dd85d1b5219b6778f1} A pointer to the current entry, for convenience. The documentation for this struct was generated from the following file:\begin{CompactItemize} \item ghash.h\end{CompactItemize} bglibs-1.106/doc/latex/adt_2ghash__test_8c-example.tex0000664000076400007640000000556711147311327022176 0ustar bruceguenter\hypertarget{adt_2ghash__test_8c-example}{ \section{adt/ghash\_\-test.c} } \begin{DocInclude}\begin{verbatim}#include #include #include "ghash.h" #ifdef SELFTEST_MAIN #include "selftest.c" static struct ghash dict; GHASH_DECL(test,const char*,int); GHASH_DEFN(test,const char*,int,adt_hashsp,adt_cmpsp,adt_copysp,0,adt_freesp,0); static void print(struct test_entry* entry) { obuf_putf(&outbuf, "{[}s{] = }i{\n}", entry->key, entry->data); } const char* keys[] = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", 0 }; static void testkeys(void) { int i; struct test_entry* p; for (i = 0; keys[i] != 0; ++i) { if ((p = test_get(&dict, &keys[i])) == 0) obuf_putf(&outbuf, "{Could not locate key [}s{]\n}", keys[i]); else if (p->data != i) obuf_putf(&outbuf, "{Result for key [}s{] is wrong (was }d{ should be }d{)\n}", keys[i], p->data, i); } } MAIN { int i; struct test_entry* p; struct ghashiter iter; test_init(&dict); obuf_putf(&outbuf, "{size=}d{ count=}d{\n}", dict.size, dict.count); for (i = 0; keys[i] != 0; ++i) { test_add(&dict, &keys[i], &i); obuf_putf(&outbuf, "{size=}d{ count=}d{\n}", dict.size, dict.count); } testkeys(); test_foreach(&dict, print); ghash_remove(&dict, &keys[1]); ghash_remove(&dict, &keys[11]); ghash_remove(&dict, &keys[24]); testkeys(); i = 1010; if ((p = ghash_set(&dict, &keys[10], &i)) != 0) obuf_putf(&outbuf, "{Set [}s{] to }d{\n}", p->key, p->data); i = 1020; if ((p = ghash_set(&dict, &keys[20], &i)) != 0) obuf_putf(&outbuf, "{Set [}s{] to }d{\n}", p->key, p->data); ghashiter_loop(&iter, &dict) { p = iter.entry; obuf_putf(&outbuf, "{[}s{] = }i{\n}", p->key, p->data); } test_free(&dict); } #endif #ifdef SELFTEST_EXP size=0 count=0 size=31 count=1 size=31 count=2 size=31 count=3 size=31 count=4 size=31 count=5 size=31 count=6 size=31 count=7 size=31 count=8 size=31 count=9 size=31 count=10 size=31 count=11 size=31 count=12 size=31 count=13 size=31 count=14 size=31 count=15 size=61 count=16 size=61 count=17 size=61 count=18 size=61 count=19 size=61 count=20 size=61 count=21 size=61 count=22 size=61 count=23 size=61 count=24 size=61 count=25 size=61 count=26 [e] = 4 [d] = 3 [g] = 6 [f] = 5 [a] = 0 [c] = 2 [b] = 1 [m] = 12 [l] = 11 [o] = 14 [n] = 13 [i] = 8 [h] = 7 [k] = 10 [j] = 9 [u] = 20 [t] = 19 [w] = 22 [v] = 21 [q] = 16 [p] = 15 [s] = 18 [r] = 17 [y] = 24 [x] = 23 [z] = 25 Could not locate key [b] Could not locate key [l] Could not locate key [y] Set [k] to 1010 Set [u] to 1020 [e] = 4 [d] = 3 [g] = 6 [f] = 5 [a] = 0 [c] = 2 [m] = 12 [o] = 14 [n] = 13 [i] = 8 [h] = 7 [k] = 1010 [j] = 9 [u] = 1020 [t] = 19 [w] = 22 [v] = 21 [q] = 16 [p] = 15 [s] = 18 [r] = 17 [x] = 23 [z] = 25 #endif \end{verbatim} \end{DocInclude} bglibs-1.106/doc/latex/structstr__sortentry.tex0000664000076400007640000000300111147311327021273 0ustar bruceguenter\hypertarget{structstr__sortentry}{ \section{str\_\-sortentry Struct Reference} \label{structstr__sortentry}\index{str\_\-sortentry@{str\_\-sortentry}} } {\tt \#include $<$str.h$>$} \subsection*{Data Fields} \begin{CompactItemize} \item const char $\ast$ \hyperlink{structstr__sortentry_6edf04fcf1e7921174c748119466fb34}{str} \item unsigned long \hyperlink{structstr__sortentry_572a5b779790fddd28b75cf434a16384}{len} \end{CompactItemize} \subsection{Detailed Description} This struct is used to serve in lists of pointers into a string for sorting. Only used as parameters to the comparison function in {\tt str\_\-sort} \subsection{Field Documentation} \hypertarget{structstr__sortentry_6edf04fcf1e7921174c748119466fb34}{ \index{str\_\-sortentry@{str\_\-sortentry}!str@{str}} \index{str@{str}!str_sortentry@{str\_\-sortentry}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ {\bf str\_\-sortentry::str}}} \label{structstr__sortentry_6edf04fcf1e7921174c748119466fb34} Pointer to the string data to compare. \hypertarget{structstr__sortentry_572a5b779790fddd28b75cf434a16384}{ \index{str\_\-sortentry@{str\_\-sortentry}!len@{len}} \index{len@{len}!str_sortentry@{str\_\-sortentry}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned long {\bf str\_\-sortentry::len}}} \label{structstr__sortentry_572a5b779790fddd28b75cf434a16384} Length of the string data to compare. The documentation for this struct was generated from the following file:\begin{CompactItemize} \item str.h\end{CompactItemize} bglibs-1.106/doc/latex/refman.tex0000664000076400007640000000554011147311327016210 0ustar bruceguenter\documentclass[a4paper]{book} \usepackage{a4wide} \usepackage{makeidx} \usepackage{fancyhdr} \usepackage{graphicx} \usepackage{multicol} \usepackage{float} \usepackage{textcomp} \usepackage{alltt} \usepackage{ifpdf} \ifpdf \usepackage[pdftex, pagebackref=true, colorlinks=true, linkcolor=blue, unicode ]{hyperref} \else \usepackage[ps2pdf, pagebackref=true, colorlinks=true, linkcolor=blue, unicode ]{hyperref} \usepackage{pspicture} \fi \usepackage[utf8]{inputenc} \usepackage{doxygen} \makeindex \setcounter{tocdepth}{1} \renewcommand{\footrulewidth}{0.4pt} \begin{document} \begin{titlepage} \vspace*{7cm} \begin{center} {\Large bglibs Reference Manual}\\ \vspace*{1cm} {\large Generated by Doxygen 1.5.4}\\ \vspace*{0.5cm} {\small Thu Feb 19 11:11:50 2009}\\ \end{center} \end{titlepage} \clearemptydoublepage \pagenumbering{roman} \tableofcontents \clearemptydoublepage \pagenumbering{arabic} \chapter{bglibs Module Index} \input{modules} \chapter{bglibs Directory Hierarchy} \input{dirs} \chapter{bglibs Data Structure Index} \input{annotated} \chapter{bglibs Page Index} \input{pages} \chapter{bglibs Module Documentation} \input{group__installer} \include{group__adt} \include{group__adt__ghash} \include{group__adt__gqueue} \include{group__adt__gstack} \include{group__crypto} \include{group__surfrand} \include{group__fmt} \include{group__instlib} \include{group__iobuf} \include{group__ibuf} \include{group__obuf} \include{group__ipv4} \include{group__ipv6} \include{group__resolve} \include{group__socket} \include{group__path} \include{group__envstr} \include{group__striter} \include{group__str} \include{group__selfpipe} \include{group__signalfd} \include{group__trigger} \chapter{bglibs Directory Documentation} \input{dir_3fb7bf5367cadb161b081662ce57c8a3} \include{dir_a2e2a6ddf2b9459cbc3be164f3c73476} \include{dir_dd30a1940344e6186e300b1ab56c7d11} \include{dir_201548bc8cd7b18da7ab15618d9a7744} \include{dir_28609d2f6b17322077df409bed0e8d02} \include{dir_74e682a418f682a90c4a9d71beb28fdd} \include{dir_e79ee0b49666b683d4b4444c8b170e6b} \include{dir_b467e31085870d6887ee57c7b172ec7c} \include{dir_f74869e8b4fdb609276034ecde8dfb36} \chapter{bglibs Data Structure Documentation} \input{structghash} \include{structghashiter} \include{structgqueue} \include{structgqueue__node} \include{structgstack} \include{structgstack__node} \include{structibuf} \include{structiobuf} \include{structipv4addr} \include{structipv6addr} \include{structobuf} \include{structstr} \include{structstr__sortentry} \include{structstriter} \include{structsurfrand} \chapter{bglibs Example Documentation} \input{adt_2ghash__test_8c-example} \include{adt_2gqueue__test_8c-example} \include{adt_2gstack__test_8c-example} \chapter{bglibs Page Documentation} \input{deprecated} \printindex \end{document} bglibs-1.106/doc/latex/dir_201548bc8cd7b18da7ab15618d9a7744.tex0000664000076400007640000000066011147311327022075 0ustar bruceguenter\hypertarget{dir_201548bc8cd7b18da7ab15618d9a7744}{ \section{instlib/ Directory Reference} \label{dir_201548bc8cd7b18da7ab15618d9a7744}\index{instlib/ Directory Reference@{instlib/ Directory Reference}} } \subsection*{Files} \begin{CompactItemize} \item file \textbf{installer.c} \item file \textbf{installer.h} \item file \textbf{instcheck.c} \item file \textbf{instmain.c} \item file \textbf{instshow.c} \end{CompactItemize} bglibs-1.106/doc/latex/group__resolve.tex0000664000076400007640000001165111147311327017772 0ustar bruceguenter\hypertarget{group__resolve}{ \section{resolve: Domain name resolution functions} \label{group__resolve}\index{resolve: Domain name resolution functions@{resolve: Domain name resolution functions}} } \subsection*{Defines} \begin{CompactItemize} \item \#define \hyperlink{group__resolve_g52c62ae9074a54e79ab75024561d946e}{RESOLVE\_\-OK}~0 \item \#define \hyperlink{group__resolve_gd2d21305042928ba3d239004d3585e99}{RESOLVE\_\-NOTFOUND}~1 \item \#define \hyperlink{group__resolve_ge81cbf2bd87287659571253bdcdec082}{RESOLVE\_\-NOADDR}~2 \item \#define \hyperlink{group__resolve_gd7d99b293d7b17f4e45844ad106c2af5}{RESOLVE\_\-NSERROR}~3 \item \#define \hyperlink{group__resolve_gfba9a6b28ce9c48feb5edb10001be29b}{RESOLVE\_\-TEMPFAIL}~4 \item \#define \hyperlink{group__resolve_g78da8a799cb19600dca99019c8992493}{resolve\_\-ipv4name}(N, A)~resolve\_\-ipv4name\_\-n((N),(A),1) \end{CompactItemize} \subsection*{Functions} \begin{CompactItemize} \item const char $\ast$ \hyperlink{group__resolve_g97eeaa5f16ca8625115d2b9d0f34f7d5}{resolve\_\-ipv4addr} (const \hyperlink{structipv4addr}{ipv4addr} $\ast$addr) \item int \hyperlink{group__resolve_g1a3afae7178330b7ff72d77296fd481d}{resolve\_\-ipv4name\_\-n} (const char $\ast$name, \hyperlink{structipv4addr}{ipv4addr} $\ast$addr, int maxaddrs) \item int \hyperlink{group__resolve_g180ee6193c02b030d5e681233d0aeb68}{resolve\_\-error} (void) \end{CompactItemize} \subsection{Define Documentation} \hypertarget{group__resolve_g78da8a799cb19600dca99019c8992493}{ \index{resolve@{resolve}!resolve\_\-ipv4name@{resolve\_\-ipv4name}} \index{resolve\_\-ipv4name@{resolve\_\-ipv4name}!resolve@{resolve}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define resolve\_\-ipv4name(N, A)~resolve\_\-ipv4name\_\-n((N),(A),1)}} \label{group__resolve_g78da8a799cb19600dca99019c8992493} Compatibility macro for resolve\_\-ipv4name\_\-n \hypertarget{group__resolve_ge81cbf2bd87287659571253bdcdec082}{ \index{resolve@{resolve}!RESOLVE\_\-NOADDR@{RESOLVE\_\-NOADDR}} \index{RESOLVE\_\-NOADDR@{RESOLVE\_\-NOADDR}!resolve@{resolve}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define RESOLVE\_\-NOADDR~2}} \label{group__resolve_ge81cbf2bd87287659571253bdcdec082} Domain name exists, but has no address. \hypertarget{group__resolve_gd2d21305042928ba3d239004d3585e99}{ \index{resolve@{resolve}!RESOLVE\_\-NOTFOUND@{RESOLVE\_\-NOTFOUND}} \index{RESOLVE\_\-NOTFOUND@{RESOLVE\_\-NOTFOUND}!resolve@{resolve}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define RESOLVE\_\-NOTFOUND~1}} \label{group__resolve_gd2d21305042928ba3d239004d3585e99} Domain name not found. \hypertarget{group__resolve_gd7d99b293d7b17f4e45844ad106c2af5}{ \index{resolve@{resolve}!RESOLVE\_\-NSERROR@{RESOLVE\_\-NSERROR}} \index{RESOLVE\_\-NSERROR@{RESOLVE\_\-NSERROR}!resolve@{resolve}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define RESOLVE\_\-NSERROR~3}} \label{group__resolve_gd7d99b293d7b17f4e45844ad106c2af5} Non-recoverable name server error. \hypertarget{group__resolve_g52c62ae9074a54e79ab75024561d946e}{ \index{resolve@{resolve}!RESOLVE\_\-OK@{RESOLVE\_\-OK}} \index{RESOLVE\_\-OK@{RESOLVE\_\-OK}!resolve@{resolve}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define RESOLVE\_\-OK~0}} \label{group__resolve_g52c62ae9074a54e79ab75024561d946e} No error. \hypertarget{group__resolve_gfba9a6b28ce9c48feb5edb10001be29b}{ \index{resolve@{resolve}!RESOLVE\_\-TEMPFAIL@{RESOLVE\_\-TEMPFAIL}} \index{RESOLVE\_\-TEMPFAIL@{RESOLVE\_\-TEMPFAIL}!resolve@{resolve}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define RESOLVE\_\-TEMPFAIL~4}} \label{group__resolve_gfba9a6b28ce9c48feb5edb10001be29b} Temporary failure. \subsection{Function Documentation} \hypertarget{group__resolve_g180ee6193c02b030d5e681233d0aeb68}{ \index{resolve@{resolve}!resolve\_\-error@{resolve\_\-error}} \index{resolve\_\-error@{resolve\_\-error}!resolve@{resolve}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int resolve\_\-error (void)}} \label{group__resolve_g180ee6193c02b030d5e681233d0aeb68} Look up the last resolve error code. \hypertarget{group__resolve_g97eeaa5f16ca8625115d2b9d0f34f7d5}{ \index{resolve@{resolve}!resolve\_\-ipv4addr@{resolve\_\-ipv4addr}} \index{resolve\_\-ipv4addr@{resolve\_\-ipv4addr}!resolve@{resolve}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ resolve\_\-ipv4addr (const {\bf ipv4addr} $\ast$ {\em addr})}} \label{group__resolve_g97eeaa5f16ca8625115d2b9d0f34f7d5} Look up the domain name corresponding to an IPv4 address. \hypertarget{group__resolve_g1a3afae7178330b7ff72d77296fd481d}{ \index{resolve@{resolve}!resolve\_\-ipv4name\_\-n@{resolve\_\-ipv4name\_\-n}} \index{resolve\_\-ipv4name\_\-n@{resolve\_\-ipv4name\_\-n}!resolve@{resolve}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int resolve\_\-ipv4name\_\-n (const char $\ast$ {\em name}, {\bf ipv4addr} $\ast$ {\em addr}, int {\em maxaddrs})}} \label{group__resolve_g1a3afae7178330b7ff72d77296fd481d} Look up the IPv4 address(es) corresponding to a domain name. bglibs-1.106/doc/latex/dir_f74869e8b4fdb609276034ecde8dfb36.tex0000664000076400007640000000261411147311327022266 0ustar bruceguenter\hypertarget{dir_f74869e8b4fdb609276034ecde8dfb36}{ \section{unix/ Directory Reference} \label{dir_f74869e8b4fdb609276034ecde8dfb36}\index{unix/ Directory Reference@{unix/ Directory Reference}} } \subsection*{Files} \begin{CompactItemize} \item file \textbf{cloexec.h} \item file \textbf{cloexec\_\-off.c} \item file \textbf{cloexec\_\-on.c} \item file \textbf{fcntl.c} \item file \textbf{fcntl.h} \item file \textbf{fcntl\_\-fd\_\-off.c} \item file \textbf{fcntl\_\-fd\_\-on.c} \item file \textbf{fcntl\_\-fl\_\-off.c} \item file \textbf{fcntl\_\-fl\_\-on.c} \item file \textbf{nonblock.h} \item file \textbf{nonblock\_\-off.c} \item file \textbf{nonblock\_\-on.c} \item file \textbf{selfpipe.c} \item file \textbf{selfpipe.h} \item file \textbf{sig.h} \item file \textbf{sig\_\-alarm.c} \item file \textbf{sig\_\-all.c} \item file \textbf{sig\_\-block.c} \item file \textbf{sig\_\-bug.c} \item file \textbf{sig\_\-catch.c} \item file \textbf{sig\_\-child.c} \item file \textbf{sig\_\-hup.c} \item file \textbf{sig\_\-int.c} \item file \textbf{sig\_\-misc.c} \item file \textbf{sig\_\-pipe.c} \item file \textbf{sig\_\-quit.c} \item file \textbf{sig\_\-suspend.c} \item file \textbf{sig\_\-term.c} \item file \textbf{signalfd.c} \item file \textbf{signalfd.h} \item file \textbf{trigger.h} \item file \textbf{trigger\_\-pull.c} \item file \textbf{trigger\_\-set.c} \end{CompactItemize} bglibs-1.106/doc/latex/examples.tex0000664000076400007640000000046511147311327016557 0ustar bruceguenter\section{bglibs Examples} Here is a list of all examples:\begin{CompactItemize} \item \hyperlink{adt_2ghash__test_8c-example}{adt/ghash\_\-test.c} \item \hyperlink{adt_2gqueue__test_8c-example}{adt/gqueue\_\-test.c} \item \hyperlink{adt_2gstack__test_8c-example}{adt/gstack\_\-test.c} \end{CompactItemize} bglibs-1.106/doc/latex/group__ibuf.tex0000664000076400007640000003775611147311327017256 0ustar bruceguenter\hypertarget{group__ibuf}{ \section{ibuf: Input Buffer Managemenet} \label{group__ibuf}\index{ibuf: Input Buffer Managemenet@{ibuf: Input Buffer Managemenet}} } \subsection*{Data Structures} \begin{CompactItemize} \item struct \hyperlink{structibuf}{ibuf} \end{CompactItemize} \subsection*{Defines} \begin{CompactItemize} \item \#define \hyperlink{group__ibuf_ge8db32d2fbfc0f36f0b90bbdff19cb0c}{ibuf\_\-close}(in)~iobuf\_\-close(\&((in) $\rightarrow$ io)) \item \#define \hyperlink{group__ibuf_g48f3c2afd17dff6255f807d5f660ff03}{ibuf\_\-closed}(in)~iobuf\_\-closed(\&((in) $\rightarrow$ io)) \item \#define \hyperlink{group__ibuf_g65f2c22ccee8c5c2c6cab03426ebc14a}{ibuf\_\-error}(in)~iobuf\_\-error(\&((in) $\rightarrow$ io)) \item \#define \hyperlink{group__ibuf_g6a2e3d67bb56780e30c85c2c4b34d354}{ibuf\_\-timedout}(in)~iobuf\_\-timedout(\&((in) $\rightarrow$ io)) \item \#define \hyperlink{group__ibuf_g43682921fe9e0b50d36871af333991b2}{ibuf\_\-rewind}(in)~ibuf\_\-seek(in,0) \item \#define \hyperlink{group__ibuf_g55e6bd13f5e337a7b189452d6ec60526}{ibuf\_\-seekfwd}(in, off)~ibuf\_\-seek(ibuf\_\-tell(in)+(offset)) \end{CompactItemize} \subsection*{Typedefs} \begin{CompactItemize} \item typedef int($\ast$ \hyperlink{group__ibuf_gef08f9c3cf7f85292ca368ca62ab0e4a}{ibuf\_\-fn} )(int, void $\ast$, unsigned long) \item typedef struct \hyperlink{structibuf}{ibuf} \hyperlink{group__ibuf_g26425f9cf9ca74cbe93d1ba2a35009fb}{ibuf} \end{CompactItemize} \subsection*{Functions} \begin{CompactItemize} \item int \hyperlink{group__ibuf_gde09b49be139f74da5cb5ec62147e681}{ibuf\_\-init} (\hyperlink{structibuf}{ibuf} $\ast$in, int fd, \hyperlink{group__ibuf_gef08f9c3cf7f85292ca368ca62ab0e4a}{ibuf\_\-fn} fn, unsigned flags, unsigned bufsize) \item int \hyperlink{group__ibuf_g0310201d000ed4435933d33d1679ce70}{ibuf\_\-open} (\hyperlink{structibuf}{ibuf} $\ast$in, const char $\ast$filename, unsigned bufsize) \item int \hyperlink{group__ibuf_g02e54c2639a121fe88dfbec72143b7ac}{ibuf\_\-eof} (\hyperlink{structibuf}{ibuf} $\ast$in) \item int \hyperlink{group__ibuf_g15b46604ef239c3115eae097fc53f188}{ibuf\_\-refill} (\hyperlink{structibuf}{ibuf} $\ast$in) \item int \hyperlink{group__ibuf_gc908f8f9a933b89d2e379bb7896a5a46}{ibuf\_\-read\_\-large} (\hyperlink{structibuf}{ibuf} $\ast$in, char $\ast$data, unsigned datalen) \item int \hyperlink{group__ibuf_g67cfbcf45fd52dc8380fd442549464f9}{ibuf\_\-read} (\hyperlink{structibuf}{ibuf} $\ast$in, char $\ast$data, unsigned datalen) \item unsigned \hyperlink{group__ibuf_gb4db49bd4c7b25b3f3607293875a8b22}{ibuf\_\-tell} (\hyperlink{structibuf}{ibuf} $\ast$in) \item int \hyperlink{group__ibuf_gae3ebb5fdd9151d1653653578cba9bd9}{ibuf\_\-seek} (\hyperlink{structibuf}{ibuf} $\ast$in, unsigned offset) \item int \hyperlink{group__ibuf_gb6877639711be2c0936763ba8ca54871}{ibuf\_\-peek} (\hyperlink{structibuf}{ibuf} $\ast$in, char $\ast$ch) \item int \hyperlink{group__ibuf_g3c42e8e028e2203c4d76879d3d8ee01a}{ibuf\_\-getc} (\hyperlink{structibuf}{ibuf} $\ast$in, char $\ast$ch) \item int \hyperlink{group__ibuf_g3b3a79dcbd986f2e1d9b39346c17bf4e}{ibuf\_\-getu} (\hyperlink{structibuf}{ibuf} $\ast$in, unsigned long $\ast$data) \item int \hyperlink{group__ibuf_g858fcf15103325cc8e9659f72625a891}{ibuf\_\-gets} (\hyperlink{structibuf}{ibuf} $\ast$in, char $\ast$data, unsigned datalen, char boundary) \item int \hyperlink{group__ibuf_g4d96478aa74b230e1fcfc70f715de8a4}{ibuf\_\-getstr} (\hyperlink{structibuf}{ibuf} $\ast$in, struct \hyperlink{structstr}{str} $\ast$s, char boundary) \item int \hyperlink{group__ibuf_g288d0416864dc0874f95561df885be29}{ibuf\_\-getstr\_\-crlf} (\hyperlink{structibuf}{ibuf} $\ast$in, struct \hyperlink{structstr}{str} $\ast$s) \item int \hyperlink{group__ibuf_gf79c746e3eb82c33678902371c3d1c0e}{ibuf\_\-getnetstring} (\hyperlink{structibuf}{ibuf} $\ast$in, struct \hyperlink{structstr}{str} $\ast$s) \item int \hyperlink{group__ibuf_gd0d75b2244c133c3f2065f9d6cef1695}{ibuf\_\-readall} (\hyperlink{structibuf}{ibuf} $\ast$in, struct \hyperlink{structstr}{str} $\ast$s) \item int \hyperlink{group__ibuf_gcf65fca50e5136a789d41f1e6f51ce0d}{ibuf\_\-openreadclose} (const char $\ast$filename, struct \hyperlink{structstr}{str} $\ast$s) \end{CompactItemize} \subsection*{Variables} \begin{CompactItemize} \item \hyperlink{structibuf}{ibuf} \hyperlink{group__ibuf_g12636ea071a8e4a9a355aa1b08a6f354}{inbuf} \end{CompactItemize} \subsection{Detailed Description} \begin{Desc} \item[Calling Convention]\end{Desc} Unless otherwise specified, the return value is non-zero (true) if the entire requested operation completed, and {\tt 0} (false) otherwise. \subsection{Define Documentation} \hypertarget{group__ibuf_ge8db32d2fbfc0f36f0b90bbdff19cb0c}{ \index{ibuf@{ibuf}!ibuf\_\-close@{ibuf\_\-close}} \index{ibuf\_\-close@{ibuf\_\-close}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define ibuf\_\-close(in)~iobuf\_\-close(\&((in) $\rightarrow$ io))}} \label{group__ibuf_ge8db32d2fbfc0f36f0b90bbdff19cb0c} Close the {\tt \hyperlink{structibuf}{ibuf}}. \hypertarget{group__ibuf_g48f3c2afd17dff6255f807d5f660ff03}{ \index{ibuf@{ibuf}!ibuf\_\-closed@{ibuf\_\-closed}} \index{ibuf\_\-closed@{ibuf\_\-closed}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define ibuf\_\-closed(in)~iobuf\_\-closed(\&((in) $\rightarrow$ io))}} \label{group__ibuf_g48f3c2afd17dff6255f807d5f660ff03} Test if the {\tt \hyperlink{structibuf}{ibuf}} has been closed. \hypertarget{group__ibuf_g65f2c22ccee8c5c2c6cab03426ebc14a}{ \index{ibuf@{ibuf}!ibuf\_\-error@{ibuf\_\-error}} \index{ibuf\_\-error@{ibuf\_\-error}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define ibuf\_\-error(in)~iobuf\_\-error(\&((in) $\rightarrow$ io))}} \label{group__ibuf_g65f2c22ccee8c5c2c6cab03426ebc14a} Test if the {\tt \hyperlink{structibuf}{ibuf}} is in an error state. \hypertarget{group__ibuf_g43682921fe9e0b50d36871af333991b2}{ \index{ibuf@{ibuf}!ibuf\_\-rewind@{ibuf\_\-rewind}} \index{ibuf\_\-rewind@{ibuf\_\-rewind}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define ibuf\_\-rewind(in)~ibuf\_\-seek(in,0)}} \label{group__ibuf_g43682921fe9e0b50d36871af333991b2} Set the effective read position to the start of the file. \hypertarget{group__ibuf_g55e6bd13f5e337a7b189452d6ec60526}{ \index{ibuf@{ibuf}!ibuf\_\-seekfwd@{ibuf\_\-seekfwd}} \index{ibuf\_\-seekfwd@{ibuf\_\-seekfwd}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define ibuf\_\-seekfwd(in, off)~ibuf\_\-seek(ibuf\_\-tell(in)+(offset))}} \label{group__ibuf_g55e6bd13f5e337a7b189452d6ec60526} Set the effective read position {\tt off} bytes forward. \hypertarget{group__ibuf_g6a2e3d67bb56780e30c85c2c4b34d354}{ \index{ibuf@{ibuf}!ibuf\_\-timedout@{ibuf\_\-timedout}} \index{ibuf\_\-timedout@{ibuf\_\-timedout}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define ibuf\_\-timedout(in)~iobuf\_\-timedout(\&((in) $\rightarrow$ io))}} \label{group__ibuf_g6a2e3d67bb56780e30c85c2c4b34d354} Test if the last {\tt \hyperlink{structibuf}{ibuf}} read timed out. \subsection{Typedef Documentation} \hypertarget{group__ibuf_g26425f9cf9ca74cbe93d1ba2a35009fb}{ \index{ibuf@{ibuf}!ibuf@{ibuf}} \index{ibuf@{ibuf}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef struct {\bf ibuf} {\bf ibuf}}} \label{group__ibuf_g26425f9cf9ca74cbe93d1ba2a35009fb} Input specific buffer typedef. \hypertarget{group__ibuf_gef08f9c3cf7f85292ca368ca62ab0e4a}{ \index{ibuf@{ibuf}!ibuf\_\-fn@{ibuf\_\-fn}} \index{ibuf\_\-fn@{ibuf\_\-fn}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef int($\ast$ {\bf ibuf\_\-fn})(int, void $\ast$, unsigned long)}} \label{group__ibuf_gef08f9c3cf7f85292ca368ca62ab0e4a} {\tt \hyperlink{structibuf}{ibuf}} read function pointer prototype. \subsection{Function Documentation} \hypertarget{group__ibuf_g02e54c2639a121fe88dfbec72143b7ac}{ \index{ibuf@{ibuf}!ibuf\_\-eof@{ibuf\_\-eof}} \index{ibuf\_\-eof@{ibuf\_\-eof}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-eof ({\bf ibuf} $\ast$ {\em in})}} \label{group__ibuf_g02e54c2639a121fe88dfbec72143b7ac} Test if the {\tt \hyperlink{structibuf}{ibuf}} has reaced end of file. \hypertarget{group__ibuf_g3c42e8e028e2203c4d76879d3d8ee01a}{ \index{ibuf@{ibuf}!ibuf\_\-getc@{ibuf\_\-getc}} \index{ibuf\_\-getc@{ibuf\_\-getc}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-getc ({\bf ibuf} $\ast$ {\em in}, char $\ast$ {\em ch})}} \label{group__ibuf_g3c42e8e028e2203c4d76879d3d8ee01a} Retrieve a single character from the {\tt \hyperlink{structibuf}{ibuf}}. \hypertarget{group__ibuf_gf79c746e3eb82c33678902371c3d1c0e}{ \index{ibuf@{ibuf}!ibuf\_\-getnetstring@{ibuf\_\-getnetstring}} \index{ibuf\_\-getnetstring@{ibuf\_\-getnetstring}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-getnetstring ({\bf ibuf} $\ast$ {\em in}, struct {\bf str} $\ast$ {\em s})}} \label{group__ibuf_gf79c746e3eb82c33678902371c3d1c0e} Read a netstring from the given {\tt \hyperlink{structibuf}{ibuf}} . If the input is not a netstring, {\tt errno} (and {\tt in-$>$io.errnum} ) will be set to {\tt EPROTOTYPE} and the state of {\tt in} will be undefined. \hypertarget{group__ibuf_g858fcf15103325cc8e9659f72625a891}{ \index{ibuf@{ibuf}!ibuf\_\-gets@{ibuf\_\-gets}} \index{ibuf\_\-gets@{ibuf\_\-gets}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-gets ({\bf ibuf} $\ast$ {\em in}, char $\ast$ {\em data}, unsigned {\em datalen}, char {\em boundary})}} \label{group__ibuf_g858fcf15103325cc8e9659f72625a891} Read a line from the {\tt \hyperlink{structibuf}{ibuf}} into a C string. \hypertarget{group__ibuf_g4d96478aa74b230e1fcfc70f715de8a4}{ \index{ibuf@{ibuf}!ibuf\_\-getstr@{ibuf\_\-getstr}} \index{ibuf\_\-getstr@{ibuf\_\-getstr}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-getstr ({\bf ibuf} $\ast$ {\em in}, struct {\bf str} $\ast$ {\em s}, char {\em boundary})}} \label{group__ibuf_g4d96478aa74b230e1fcfc70f715de8a4} Read a line from the {\tt \hyperlink{structibuf}{ibuf}} into a dynamic string. \hypertarget{group__ibuf_g288d0416864dc0874f95561df885be29}{ \index{ibuf@{ibuf}!ibuf\_\-getstr\_\-crlf@{ibuf\_\-getstr\_\-crlf}} \index{ibuf\_\-getstr\_\-crlf@{ibuf\_\-getstr\_\-crlf}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-getstr\_\-crlf ({\bf ibuf} $\ast$ {\em in}, struct {\bf str} $\ast$ {\em s})}} \label{group__ibuf_g288d0416864dc0874f95561df885be29} Read a line from the {\tt \hyperlink{structibuf}{ibuf}} into a dynamic string, terminated by a CR+LF pair. \hypertarget{group__ibuf_g3b3a79dcbd986f2e1d9b39346c17bf4e}{ \index{ibuf@{ibuf}!ibuf\_\-getu@{ibuf\_\-getu}} \index{ibuf\_\-getu@{ibuf\_\-getu}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-getu ({\bf ibuf} $\ast$ {\em in}, unsigned long $\ast$ {\em data})}} \label{group__ibuf_g3b3a79dcbd986f2e1d9b39346c17bf4e} Read an unsigned long from the {\tt \hyperlink{structibuf}{ibuf}} \hypertarget{group__ibuf_gde09b49be139f74da5cb5ec62147e681}{ \index{ibuf@{ibuf}!ibuf\_\-init@{ibuf\_\-init}} \index{ibuf\_\-init@{ibuf\_\-init}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-init ({\bf ibuf} $\ast$ {\em in}, int {\em fd}, {\bf ibuf\_\-fn} {\em fn}, unsigned {\em flags}, unsigned {\em bufsize})}} \label{group__ibuf_gde09b49be139f74da5cb5ec62147e681} Initialize an {\tt \hyperlink{structibuf}{ibuf}} from an already-opened file descriptor. \hypertarget{group__ibuf_g0310201d000ed4435933d33d1679ce70}{ \index{ibuf@{ibuf}!ibuf\_\-open@{ibuf\_\-open}} \index{ibuf\_\-open@{ibuf\_\-open}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-open ({\bf ibuf} $\ast$ {\em in}, const char $\ast$ {\em filename}, unsigned {\em bufsize})}} \label{group__ibuf_g0310201d000ed4435933d33d1679ce70} Initialize an {\tt \hyperlink{structibuf}{ibuf}} by opening a file for reading. \hypertarget{group__ibuf_gcf65fca50e5136a789d41f1e6f51ce0d}{ \index{ibuf@{ibuf}!ibuf\_\-openreadclose@{ibuf\_\-openreadclose}} \index{ibuf\_\-openreadclose@{ibuf\_\-openreadclose}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-openreadclose (const char $\ast$ {\em filename}, struct {\bf str} $\ast$ {\em out})}} \label{group__ibuf_gcf65fca50e5136a789d41f1e6f51ce0d} Open and read the entire file into the {\tt \hyperlink{structstr}{str}} . \hypertarget{group__ibuf_gb6877639711be2c0936763ba8ca54871}{ \index{ibuf@{ibuf}!ibuf\_\-peek@{ibuf\_\-peek}} \index{ibuf\_\-peek@{ibuf\_\-peek}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-peek ({\bf ibuf} $\ast$ {\em in}, char $\ast$ {\em ch})}} \label{group__ibuf_gb6877639711be2c0936763ba8ca54871} Retrieve the next character in the {\tt \hyperlink{structibuf}{ibuf}} without advancing the current read position. \hypertarget{group__ibuf_g67cfbcf45fd52dc8380fd442549464f9}{ \index{ibuf@{ibuf}!ibuf\_\-read@{ibuf\_\-read}} \index{ibuf\_\-read@{ibuf\_\-read}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-read ({\bf ibuf} $\ast$ {\em in}, char $\ast$ {\em data}, unsigned {\em datalen})}} \label{group__ibuf_g67cfbcf45fd52dc8380fd442549464f9} Read a block of data from the {\tt \hyperlink{structibuf}{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. \hypertarget{group__ibuf_gc908f8f9a933b89d2e379bb7896a5a46}{ \index{ibuf@{ibuf}!ibuf\_\-read\_\-large@{ibuf\_\-read\_\-large}} \index{ibuf\_\-read\_\-large@{ibuf\_\-read\_\-large}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-read\_\-large ({\bf ibuf} $\ast$ {\em in}, char $\ast$ {\em data}, unsigned {\em datalen})}} \label{group__ibuf_gc908f8f9a933b89d2e379bb7896a5a46} Read a block of data from the {\tt \hyperlink{structibuf}{ibuf}}. This routine differs from {\tt 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 {\tt \hyperlink{structiobuf}{iobuf}} buffer and then into the given buffer. {\tt ibuf\_\-read} automatically calls this routine if the requested {\tt datalen} is larger than or equal to the {\tt \hyperlink{structiobuf}{iobuf}} buffer size. \hypertarget{group__ibuf_gd0d75b2244c133c3f2065f9d6cef1695}{ \index{ibuf@{ibuf}!ibuf\_\-readall@{ibuf\_\-readall}} \index{ibuf\_\-readall@{ibuf\_\-readall}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-readall ({\bf ibuf} $\ast$ {\em in}, struct {\bf str} $\ast$ {\em out})}} \label{group__ibuf_gd0d75b2244c133c3f2065f9d6cef1695} Read the remainder of the {\tt \hyperlink{structibuf}{ibuf}} into the {\tt \hyperlink{structstr}{str}}. \hypertarget{group__ibuf_g15b46604ef239c3115eae097fc53f188}{ \index{ibuf@{ibuf}!ibuf\_\-refill@{ibuf\_\-refill}} \index{ibuf\_\-refill@{ibuf\_\-refill}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-refill ({\bf ibuf} $\ast$ {\em in})}} \label{group__ibuf_g15b46604ef239c3115eae097fc53f188} (Re)fill the buffer from the file descriptor. \begin{Desc} \item[Note:]This function may only be called when the buffer is completely empty. \end{Desc} \hypertarget{group__ibuf_gae3ebb5fdd9151d1653653578cba9bd9}{ \index{ibuf@{ibuf}!ibuf\_\-seek@{ibuf\_\-seek}} \index{ibuf\_\-seek@{ibuf\_\-seek}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-seek ({\bf ibuf} $\ast$ {\em in}, unsigned {\em offset})}} \label{group__ibuf_gae3ebb5fdd9151d1653653578cba9bd9} Set the effective read position. \hypertarget{group__ibuf_gb4db49bd4c7b25b3f3607293875a8b22}{ \index{ibuf@{ibuf}!ibuf\_\-tell@{ibuf\_\-tell}} \index{ibuf\_\-tell@{ibuf\_\-tell}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned ibuf\_\-tell ({\bf ibuf} $\ast$ {\em in})}} \label{group__ibuf_gb4db49bd4c7b25b3f3607293875a8b22} Look up the current effective read position. \subsection{Variable Documentation} \hypertarget{group__ibuf_g12636ea071a8e4a9a355aa1b08a6f354}{ \index{ibuf@{ibuf}!inbuf@{inbuf}} \index{inbuf@{inbuf}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf ibuf} {\bf inbuf}}} \label{group__ibuf_g12636ea071a8e4a9a355aa1b08a6f354} Input buffer for {\tt stdin} bglibs-1.106/doc/latex/doxygen.sty0000664000076400007640000000446411147311327016440 0ustar bruceguenter\NeedsTeXFormat{LaTeX2e} \ProvidesPackage{doxygen} \RequirePackage{calc} \RequirePackage{array} \pagestyle{fancyplain} \newcommand{\clearemptydoublepage}{\newpage{\pagestyle{empty}\cleardoublepage}} \renewcommand{\chaptermark}[1]{\markboth{#1}{}} \renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}} \lhead[\fancyplain{}{\bfseries\thepage}] {\fancyplain{}{\bfseries\rightmark}} \rhead[\fancyplain{}{\bfseries\leftmark}] {\fancyplain{}{\bfseries\thepage}} \rfoot[\fancyplain{}{\bfseries\scriptsize Generated on Thu Feb 19 11:11:50 2009 for bglibs by Doxygen }]{} \lfoot[]{\fancyplain{}{\bfseries\scriptsize Generated on Thu Feb 19 11:11:50 2009 for bglibs by Doxygen }} \cfoot{} \newenvironment{Code} {\footnotesize} {\normalsize} \newcommand{\doxyref}[3]{\textbf{#1} (\textnormal{#2}\,\pageref{#3})} \newenvironment{DocInclude} {\footnotesize} {\normalsize} \newenvironment{VerbInclude} {\footnotesize} {\normalsize} \newenvironment{Image} {\begin{figure}[H]} {\end{figure}} \newenvironment{ImageNoCaption}{}{} \newenvironment{CompactList} {\begin{list}{}{ \setlength{\leftmargin}{0.5cm} \setlength{\itemsep}{0pt} \setlength{\parsep}{0pt} \setlength{\topsep}{0pt} \renewcommand{\makelabel}{\hfill}}} {\end{list}} \newenvironment{CompactItemize} { \begin{itemize} \setlength{\itemsep}{-3pt} \setlength{\parsep}{0pt} \setlength{\topsep}{0pt} \setlength{\partopsep}{0pt} } {\end{itemize}} \newcommand{\PBS}[1]{\let\temp=\\#1\let\\=\temp} \newlength{\tmplength} \newenvironment{TabularC}[1] { \setlength{\tmplength} {\linewidth/(#1)-\tabcolsep*2-\arrayrulewidth*(#1+1)/(#1)} \par\begin{tabular*}{\linewidth} {*{#1}{|>{\PBS\raggedright\hspace{0pt}}p{\the\tmplength}}|} } {\end{tabular*}\par} \newcommand{\entrylabel}[1]{ {\parbox[b]{\labelwidth-4pt}{\makebox[0pt][l]{\textbf{#1}}\vspace{1.5\baselineskip}}}} \newenvironment{Desc} {\begin{list}{} { \settowidth{\labelwidth}{40pt} \setlength{\leftmargin}{\labelwidth} \setlength{\parsep}{0pt} \setlength{\itemsep}{-4pt} \renewcommand{\makelabel}{\entrylabel} } } {\end{list}} \newenvironment{Indent} {\begin{list}{}{\setlength{\leftmargin}{0.5cm}} \item[]\ignorespaces} {\unskip\end{list}} \setlength{\parindent}{0cm} \setlength{\parskip}{0.2cm} \addtocounter{secnumdepth}{1} \sloppy \usepackage[T1]{fontenc} bglibs-1.106/doc/latex/group__socket.tex0000664000076400007640000006130511147311327017604 0ustar bruceguenter\hypertarget{group__socket}{ \section{socket: General socket manipulations} \label{group__socket}\index{socket: General socket manipulations@{socket: General socket manipulations}} } \subsection*{IP socket functions} \begin{CompactItemize} \item int \hyperlink{group__socket_gc3ff4662c65f65784534be54ef73a5c1}{socket\_\-tcp4} (void) \item int \hyperlink{group__socket_ga40101a7969252728f0f29a7b40afbb0}{socket\_\-tcp6} (void) \item int \hyperlink{group__socket_g88d576380c2025501e9a8266bcddc759}{socket\_\-tcp} (void) \item int \hyperlink{group__socket_g6f5bd2aa2b03be301bdd402a96d8c1cc}{socket\_\-udp4} (void) \item int \hyperlink{group__socket_g97257e7446c72c21b3b80b56efae5114}{socket\_\-udp6} (void) \item int \hyperlink{group__socket_gaa146f612229109460767f7b33264436}{socket\_\-udp} (void) \item int \hyperlink{group__socket_gd2216a950b5878a7480f2cbba5bb923a}{socket\_\-connect4} (int sock, const \hyperlink{structipv4addr}{ipv4addr} $\ast$ip, \hyperlink{group__ipv4_g113bbf93f3b0011263ce519bb1ca7481}{ipv4port} port) \item int \hyperlink{group__socket_g758f2bc0d9366148f783e391b918c6e7}{socket\_\-connect4\_\-timeout} (int sock, const \hyperlink{structipv4addr}{ipv4addr} $\ast$ip, \hyperlink{group__ipv4_g113bbf93f3b0011263ce519bb1ca7481}{ipv4port} port, int timeout) \item int \hyperlink{group__socket_g748c5c143180e767205d07f047ca679d}{socket\_\-connect6} (int sock, const \hyperlink{structipv6addr}{ipv6addr} $\ast$ip, \hyperlink{group__ipv6_ga71ffb8f46cd4fa830090d23eb752847}{ipv6port} port) \item int \hyperlink{group__socket_gd0524d7851f2c470f69560eb84730c5b}{socket\_\-connect6\_\-timeout} (int sock, const \hyperlink{structipv6addr}{ipv6addr} $\ast$ip, \hyperlink{group__ipv6_ga71ffb8f46cd4fa830090d23eb752847}{ipv6port} port, int timeout) \item int \hyperlink{group__socket_g456030863437a411c047f2cd2580bdc0}{socket\_\-bind4} (int sock, const \hyperlink{structipv4addr}{ipv4addr} $\ast$ip, \hyperlink{group__ipv4_g113bbf93f3b0011263ce519bb1ca7481}{ipv4port} port) \item int \hyperlink{group__socket_g7a5368c8328a7dece54a854fb973f643}{socket\_\-bind6} (int sock, const \hyperlink{structipv6addr}{ipv6addr} $\ast$ip, \hyperlink{group__ipv6_ga71ffb8f46cd4fa830090d23eb752847}{ipv6port} port) \item int \hyperlink{group__socket_gc7bc14346128667097799f4754d37929}{socket\_\-accept4} (int sock, \hyperlink{structipv4addr}{ipv4addr} $\ast$ip, \hyperlink{group__ipv4_g113bbf93f3b0011263ce519bb1ca7481}{ipv4port} $\ast$port) \item int \hyperlink{group__socket_g196889012f2f3d11f509233255e2ac99}{socket\_\-accept6} (int sock, \hyperlink{structipv6addr}{ipv6addr} $\ast$ip, \hyperlink{group__ipv6_ga71ffb8f46cd4fa830090d23eb752847}{ipv6port} $\ast$port) \item int \hyperlink{group__socket_g1a5ee61f2d55733cb8fd5b359d10a7a1}{socket\_\-recv4} (int sock, char $\ast$buffer, unsigned buflen, \hyperlink{structipv4addr}{ipv4addr} $\ast$ip, \hyperlink{group__ipv4_g113bbf93f3b0011263ce519bb1ca7481}{ipv4port} $\ast$port) \item int \hyperlink{group__socket_gbd201f10a5f8a183a47f4c04094611f2}{socket\_\-recv6} (int sock, char $\ast$buffer, unsigned buflen, \hyperlink{structipv6addr}{ipv6addr} $\ast$ip, \hyperlink{group__ipv6_ga71ffb8f46cd4fa830090d23eb752847}{ipv6port} $\ast$port) \item int \hyperlink{group__socket_g6c2d6ff938d1d397727eed25c7eec506}{socket\_\-send4} (int sock, const char $\ast$buffer, unsigned buflen, const \hyperlink{structipv4addr}{ipv4addr} $\ast$ip, \hyperlink{group__ipv4_g113bbf93f3b0011263ce519bb1ca7481}{ipv4port} port) \item int \hyperlink{group__socket_g59f8b78cd870be6e55b0205ce69780b1}{socket\_\-send6} (int sock, const char $\ast$buffer, unsigned buflen, const \hyperlink{structipv6addr}{ipv6addr} $\ast$ip, \hyperlink{group__ipv6_ga71ffb8f46cd4fa830090d23eb752847}{ipv6port} port) \item int \hyperlink{group__socket_g0af45ad3d942c5e666c6c849612b31b9}{socket\_\-getaddr4} (int sock, \hyperlink{structipv4addr}{ipv4addr} $\ast$ip, \hyperlink{group__ipv4_g113bbf93f3b0011263ce519bb1ca7481}{ipv4port} $\ast$port) \item int \hyperlink{group__socket_g369bac4cc0a9f7b0102619c3c51c7b9b}{socket\_\-getaddr6} (int sock, \hyperlink{structipv6addr}{ipv6addr} $\ast$ip, \hyperlink{group__ipv6_ga71ffb8f46cd4fa830090d23eb752847}{ipv6port} $\ast$port) \item int \hyperlink{group__socket_g9b04337ecf3bf5baa28b40452cd21222}{socket\_\-cork} (int sock) \item int \hyperlink{group__socket_ge754518918db3d63dda03d9fd7497f24}{socket\_\-uncork} (int sock) \item int \hyperlink{group__socket_g3e40999be94c2b893b7b143b6b15e85e}{socket\_\-notcpdelay} (int sock, int enable) \end{CompactItemize} \subsection*{UNIX local-domain socket functions} \begin{CompactItemize} \item int \hyperlink{group__socket_g3c74e521debc5d71da6cb975c24f5a6f}{socket\_\-unixdgm} (void) \item int \hyperlink{group__socket_g8d8f154af4bc27c718676848aeca4517}{socket\_\-unixstr} (void) \item int \hyperlink{group__socket_gba7a8b6004c3a3b4ec2760654b932d34}{socket\_\-connectu} (int sock, const char $\ast$path) \item int \hyperlink{group__socket_g60efe220e9b4f32c40f1f23ee856f9f2}{socket\_\-connectu\_\-timeout} (int sock, const char $\ast$path, int timeout) \item int \hyperlink{group__socket_gb8bb1362103f0b7d0b92a26740a25202}{socket\_\-bindu} (int sock, const char $\ast$path) \item int \hyperlink{group__socket_g47526944d4d396e915254ad74b1718cd}{socket\_\-acceptu} (int sock) \item int \hyperlink{group__socket_g4a076351ffd2c95067db1d480aad0d74}{socket\_\-recvu} (int sock, char $\ast$buffer, unsigned buflen) \item int \hyperlink{group__socket_g2e1e867a59f55178bd91943937be27e8}{socket\_\-sendu} (int sock, const char $\ast$buffer, unsigned buflen) \item int \hyperlink{group__socket_g2ee545eb11adc079c12653558ce1d43a}{socket\_\-pairstr} (int fd\mbox{[}2\mbox{]}) \item int \hyperlink{group__socket_g3518be90b2771241b0dd8330763f524a}{socket\_\-pairdgm} (int fd\mbox{[}2\mbox{]}) \end{CompactItemize} \subsection*{Functions for any type of socket} \begin{CompactItemize} \item int \hyperlink{group__socket_g1cd775b2c588a9c1c9f993d760088e4c}{socket\_\-broadcast} (int sock) \item int \hyperlink{group__socket_gbfc66cb9c05f20a016cec536293d391e}{socket\_\-connected} (int sock) \item int \hyperlink{group__socket_g30b66242db4c2ac40b93f73bbe6d4add}{socket\_\-linger} (int fd, int onoff, int seconds) \item int \hyperlink{group__socket_gdc9f509d40c47189452bbde14b5d4fee}{socket\_\-listen} (int sock, int backlog) \item int \hyperlink{group__socket_g3836ac2b7108e2f6e203278c846ef56e}{socket\_\-reuse} (int sock) \item int \hyperlink{group__socket_gc91dfda7ec1b043b277fdcd205eb79e8}{socket\_\-shutdown} (int sock, int shut\_\-rd, int shut\_\-wr) \item int \hyperlink{group__socket_g0b2ab1619356b51c379c3b3cfd047bf9}{socket\_\-sendfd} (int sock, int fd) \item int \hyperlink{group__socket_g45a3df16f6b78995662a5a3f485f5edb}{socket\_\-recvfd} (int sock) \end{CompactItemize} \subsection{Detailed Description} \begin{Desc} \item[Calling Convention]\end{Desc} 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 {\tt -1} on error. All other functions return non-zero (true) on success or {\tt 0} (false) on error. All functions set errno on error. \subsection{Function Documentation} \hypertarget{group__socket_gc7bc14346128667097799f4754d37929}{ \index{socket@{socket}!socket\_\-accept4@{socket\_\-accept4}} \index{socket\_\-accept4@{socket\_\-accept4}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-accept4 (int {\em sock}, {\bf ipv4addr} $\ast$ {\em ip}, {\bf ipv4port} $\ast$ {\em port})}} \label{group__socket_gc7bc14346128667097799f4754d37929} Accept a connection on a socket from an IPv4 address. \hypertarget{group__socket_g196889012f2f3d11f509233255e2ac99}{ \index{socket@{socket}!socket\_\-accept6@{socket\_\-accept6}} \index{socket\_\-accept6@{socket\_\-accept6}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-accept6 (int {\em sock}, {\bf ipv6addr} $\ast$ {\em ip}, {\bf ipv6port} $\ast$ {\em port})}} \label{group__socket_g196889012f2f3d11f509233255e2ac99} Accept a connection on a socket from an IPv6 address. \hypertarget{group__socket_g47526944d4d396e915254ad74b1718cd}{ \index{socket@{socket}!socket\_\-acceptu@{socket\_\-acceptu}} \index{socket\_\-acceptu@{socket\_\-acceptu}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-acceptu (int {\em sock})}} \label{group__socket_g47526944d4d396e915254ad74b1718cd} Accept a UNIX domain connection. \hypertarget{group__socket_g456030863437a411c047f2cd2580bdc0}{ \index{socket@{socket}!socket\_\-bind4@{socket\_\-bind4}} \index{socket\_\-bind4@{socket\_\-bind4}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-bind4 (int {\em sock}, const {\bf ipv4addr} $\ast$ {\em ip}, {\bf ipv4port} {\em port})}} \label{group__socket_g456030863437a411c047f2cd2580bdc0} Bind a socket to an IPv4 address. \hypertarget{group__socket_g7a5368c8328a7dece54a854fb973f643}{ \index{socket@{socket}!socket\_\-bind6@{socket\_\-bind6}} \index{socket\_\-bind6@{socket\_\-bind6}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-bind6 (int {\em sock}, const {\bf ipv6addr} $\ast$ {\em ip}, {\bf ipv6port} {\em port})}} \label{group__socket_g7a5368c8328a7dece54a854fb973f643} Bind a socket to an IPv6 address. \hypertarget{group__socket_gb8bb1362103f0b7d0b92a26740a25202}{ \index{socket@{socket}!socket\_\-bindu@{socket\_\-bindu}} \index{socket\_\-bindu@{socket\_\-bindu}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-bindu (int {\em sock}, const char $\ast$ {\em path})}} \label{group__socket_gb8bb1362103f0b7d0b92a26740a25202} Bind a UNIX domain address (path) to a socket. \hypertarget{group__socket_g1cd775b2c588a9c1c9f993d760088e4c}{ \index{socket@{socket}!socket\_\-broadcast@{socket\_\-broadcast}} \index{socket\_\-broadcast@{socket\_\-broadcast}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-broadcast (int {\em fd})}} \label{group__socket_g1cd775b2c588a9c1c9f993d760088e4c} Mark a socket for broadcast transmission. \hypertarget{group__socket_gd2216a950b5878a7480f2cbba5bb923a}{ \index{socket@{socket}!socket\_\-connect4@{socket\_\-connect4}} \index{socket\_\-connect4@{socket\_\-connect4}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-connect4 (int {\em sock}, const {\bf ipv4addr} $\ast$ {\em ip}, {\bf ipv4port} {\em port})}} \label{group__socket_gd2216a950b5878a7480f2cbba5bb923a} Connect a socket to an IPv4 address. \hypertarget{group__socket_g758f2bc0d9366148f783e391b918c6e7}{ \index{socket@{socket}!socket\_\-connect4\_\-timeout@{socket\_\-connect4\_\-timeout}} \index{socket\_\-connect4\_\-timeout@{socket\_\-connect4\_\-timeout}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-connect4\_\-timeout (int {\em sock}, const {\bf ipv4addr} $\ast$ {\em ip}, {\bf ipv4port} {\em port}, int {\em timeout})}} \label{group__socket_g758f2bc0d9366148f783e391b918c6e7} Connect a socket to an IPv4 address, honouring a timeout. \begin{Desc} \item[Note:]The socket will have nonblocking mode turned on on return from this function. \end{Desc} \hypertarget{group__socket_g748c5c143180e767205d07f047ca679d}{ \index{socket@{socket}!socket\_\-connect6@{socket\_\-connect6}} \index{socket\_\-connect6@{socket\_\-connect6}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-connect6 (int {\em sock}, const {\bf ipv6addr} $\ast$ {\em ip}, {\bf ipv6port} {\em port})}} \label{group__socket_g748c5c143180e767205d07f047ca679d} Connect a socket to an IPv6 address. \hypertarget{group__socket_gd0524d7851f2c470f69560eb84730c5b}{ \index{socket@{socket}!socket\_\-connect6\_\-timeout@{socket\_\-connect6\_\-timeout}} \index{socket\_\-connect6\_\-timeout@{socket\_\-connect6\_\-timeout}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-connect6\_\-timeout (int {\em sock}, const {\bf ipv6addr} $\ast$ {\em ip}, {\bf ipv6port} {\em port}, int {\em timeout})}} \label{group__socket_gd0524d7851f2c470f69560eb84730c5b} Connect a socket to an IPv6 address, honouring a timeout. \begin{Desc} \item[Note:]The socket will have nonblocking mode turned on on return from this function. \end{Desc} \hypertarget{group__socket_gbfc66cb9c05f20a016cec536293d391e}{ \index{socket@{socket}!socket\_\-connected@{socket\_\-connected}} \index{socket\_\-connected@{socket\_\-connected}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-connected (int {\em sock})}} \label{group__socket_gbfc66cb9c05f20a016cec536293d391e} Test if a socket is connected. \hypertarget{group__socket_gba7a8b6004c3a3b4ec2760654b932d34}{ \index{socket@{socket}!socket\_\-connectu@{socket\_\-connectu}} \index{socket\_\-connectu@{socket\_\-connectu}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-connectu (int {\em sock}, const char $\ast$ {\em path})}} \label{group__socket_gba7a8b6004c3a3b4ec2760654b932d34} Make an UNIX domain connection. \hypertarget{group__socket_g60efe220e9b4f32c40f1f23ee856f9f2}{ \index{socket@{socket}!socket\_\-connectu\_\-timeout@{socket\_\-connectu\_\-timeout}} \index{socket\_\-connectu\_\-timeout@{socket\_\-connectu\_\-timeout}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-connectu\_\-timeout (int {\em sock}, const char $\ast$ {\em path}, int {\em timeout})}} \label{group__socket_g60efe220e9b4f32c40f1f23ee856f9f2} Connect a socket to an UNIX domain address, honouring a timeout. \begin{Desc} \item[Note:]The socket will have nonblocking mode turned on on return from this function. \end{Desc} \hypertarget{group__socket_g9b04337ecf3bf5baa28b40452cd21222}{ \index{socket@{socket}!socket\_\-cork@{socket\_\-cork}} \index{socket\_\-cork@{socket\_\-cork}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-cork (int {\em sock})}} \label{group__socket_g9b04337ecf3bf5baa28b40452cd21222} 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 {\tt TCP\_\-CORK} option) and to at least compile on BSD (with the {\tt TCP\_\-NOPUSH} option). On OS's which lack either of these two options, this function is essentially a no-op. \hypertarget{group__socket_g0af45ad3d942c5e666c6c849612b31b9}{ \index{socket@{socket}!socket\_\-getaddr4@{socket\_\-getaddr4}} \index{socket\_\-getaddr4@{socket\_\-getaddr4}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-getaddr4 (int {\em sock}, {\bf ipv4addr} $\ast$ {\em addr}, {\bf ipv4port} $\ast$ {\em port})}} \label{group__socket_g0af45ad3d942c5e666c6c849612b31b9} Determine the IPv4 address of a socket. \hypertarget{group__socket_g369bac4cc0a9f7b0102619c3c51c7b9b}{ \index{socket@{socket}!socket\_\-getaddr6@{socket\_\-getaddr6}} \index{socket\_\-getaddr6@{socket\_\-getaddr6}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-getaddr6 (int {\em sock}, {\bf ipv6addr} $\ast$ {\em addr}, {\bf ipv6port} $\ast$ {\em port})}} \label{group__socket_g369bac4cc0a9f7b0102619c3c51c7b9b} Determine the IPv6 address of a socket. \hypertarget{group__socket_g30b66242db4c2ac40b93f73bbe6d4add}{ \index{socket@{socket}!socket\_\-linger@{socket\_\-linger}} \index{socket\_\-linger@{socket\_\-linger}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-linger (int {\em fd}, int {\em onoff}, int {\em seconds})}} \label{group__socket_g30b66242db4c2ac40b93f73bbe6d4add} Set the socket \char`\"{}linger\char`\"{} option. \hypertarget{group__socket_gdc9f509d40c47189452bbde14b5d4fee}{ \index{socket@{socket}!socket\_\-listen@{socket\_\-listen}} \index{socket\_\-listen@{socket\_\-listen}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-listen (int {\em sock}, int {\em backlog})}} \label{group__socket_gdc9f509d40c47189452bbde14b5d4fee} Listen to a socket. \hypertarget{group__socket_g3e40999be94c2b893b7b143b6b15e85e}{ \index{socket@{socket}!socket\_\-notcpdelay@{socket\_\-notcpdelay}} \index{socket\_\-notcpdelay@{socket\_\-notcpdelay}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-notcpdelay (int {\em fd}, int {\em on})}} \label{group__socket_g3e40999be94c2b893b7b143b6b15e85e} 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. \hypertarget{group__socket_g3518be90b2771241b0dd8330763f524a}{ \index{socket@{socket}!socket\_\-pairdgm@{socket\_\-pairdgm}} \index{socket\_\-pairdgm@{socket\_\-pairdgm}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-pairdgm (int {\em fd}\mbox{[}2\mbox{]})}} \label{group__socket_g3518be90b2771241b0dd8330763f524a} Create a pair of datagram sockets. \hypertarget{group__socket_g2ee545eb11adc079c12653558ce1d43a}{ \index{socket@{socket}!socket\_\-pairstr@{socket\_\-pairstr}} \index{socket\_\-pairstr@{socket\_\-pairstr}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-pairstr (int {\em fd}\mbox{[}2\mbox{]})}} \label{group__socket_g2ee545eb11adc079c12653558ce1d43a} Create a pair of stream sockets. \hypertarget{group__socket_g1a5ee61f2d55733cb8fd5b359d10a7a1}{ \index{socket@{socket}!socket\_\-recv4@{socket\_\-recv4}} \index{socket\_\-recv4@{socket\_\-recv4}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-recv4 (int {\em sock}, char $\ast$ {\em buffer}, unsigned {\em buflen}, {\bf ipv4addr} $\ast$ {\em ip}, {\bf ipv4port} $\ast$ {\em port})}} \label{group__socket_g1a5ee61f2d55733cb8fd5b359d10a7a1} Receive a datagram from a UDP socket. \hypertarget{group__socket_gbd201f10a5f8a183a47f4c04094611f2}{ \index{socket@{socket}!socket\_\-recv6@{socket\_\-recv6}} \index{socket\_\-recv6@{socket\_\-recv6}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-recv6 (int {\em sock}, char $\ast$ {\em buffer}, unsigned {\em buflen}, {\bf ipv6addr} $\ast$ {\em ip}, {\bf ipv6port} $\ast$ {\em port})}} \label{group__socket_gbd201f10a5f8a183a47f4c04094611f2} Receive a datagram from an IPv6 UDP socket. \hypertarget{group__socket_g45a3df16f6b78995662a5a3f485f5edb}{ \index{socket@{socket}!socket\_\-recvfd@{socket\_\-recvfd}} \index{socket\_\-recvfd@{socket\_\-recvfd}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-recvfd (int {\em sock})}} \label{group__socket_g45a3df16f6b78995662a5a3f485f5edb} Receive a file descriptor over a socket. \hypertarget{group__socket_g4a076351ffd2c95067db1d480aad0d74}{ \index{socket@{socket}!socket\_\-recvu@{socket\_\-recvu}} \index{socket\_\-recvu@{socket\_\-recvu}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-recvu (int {\em sock}, char $\ast$ {\em buffer}, unsigned {\em buflen})}} \label{group__socket_g4a076351ffd2c95067db1d480aad0d74} Receive a datagram from a UNIX domain socket. \hypertarget{group__socket_g3836ac2b7108e2f6e203278c846ef56e}{ \index{socket@{socket}!socket\_\-reuse@{socket\_\-reuse}} \index{socket\_\-reuse@{socket\_\-reuse}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-reuse (int {\em fd})}} \label{group__socket_g3836ac2b7108e2f6e203278c846ef56e} Mark a socket for address reuse. \hypertarget{group__socket_g6c2d6ff938d1d397727eed25c7eec506}{ \index{socket@{socket}!socket\_\-send4@{socket\_\-send4}} \index{socket\_\-send4@{socket\_\-send4}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-send4 (int {\em sock}, const char $\ast$ {\em buffer}, unsigned {\em buflen}, const {\bf ipv4addr} $\ast$ {\em ip}, {\bf ipv4port} {\em port})}} \label{group__socket_g6c2d6ff938d1d397727eed25c7eec506} Send a datagram on a UDP socket. \hypertarget{group__socket_g59f8b78cd870be6e55b0205ce69780b1}{ \index{socket@{socket}!socket\_\-send6@{socket\_\-send6}} \index{socket\_\-send6@{socket\_\-send6}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-send6 (int {\em sock}, const char $\ast$ {\em buffer}, unsigned {\em buflen}, const {\bf ipv6addr} $\ast$ {\em ip}, {\bf ipv6port} {\em port})}} \label{group__socket_g59f8b78cd870be6e55b0205ce69780b1} Send a datagram on an IPv6 UDP socket. \hypertarget{group__socket_g0b2ab1619356b51c379c3b3cfd047bf9}{ \index{socket@{socket}!socket\_\-sendfd@{socket\_\-sendfd}} \index{socket\_\-sendfd@{socket\_\-sendfd}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-sendfd (int {\em sock}, int {\em fd})}} \label{group__socket_g0b2ab1619356b51c379c3b3cfd047bf9} Send a file descriptor over a socket. \hypertarget{group__socket_g2e1e867a59f55178bd91943937be27e8}{ \index{socket@{socket}!socket\_\-sendu@{socket\_\-sendu}} \index{socket\_\-sendu@{socket\_\-sendu}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-sendu (int {\em sock}, const char $\ast$ {\em buffer}, unsigned {\em buflen})}} \label{group__socket_g2e1e867a59f55178bd91943937be27e8} Send a datagram on a UNIX domain socket. \hypertarget{group__socket_gc91dfda7ec1b043b277fdcd205eb79e8}{ \index{socket@{socket}!socket\_\-shutdown@{socket\_\-shutdown}} \index{socket\_\-shutdown@{socket\_\-shutdown}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-shutdown (int {\em sock}, int {\em shut\_\-rd}, int {\em shut\_\-wr})}} \label{group__socket_gc91dfda7ec1b043b277fdcd205eb79e8} Shut down part or all of a socket. \hypertarget{group__socket_g88d576380c2025501e9a8266bcddc759}{ \index{socket@{socket}!socket\_\-tcp@{socket\_\-tcp}} \index{socket\_\-tcp@{socket\_\-tcp}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-tcp (void)}} \label{group__socket_g88d576380c2025501e9a8266bcddc759} Create a TCP/IP socket. \hypertarget{group__socket_gc3ff4662c65f65784534be54ef73a5c1}{ \index{socket@{socket}!socket\_\-tcp4@{socket\_\-tcp4}} \index{socket\_\-tcp4@{socket\_\-tcp4}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-tcp4 (void)}} \label{group__socket_gc3ff4662c65f65784534be54ef73a5c1} Create a TCP/IPv4 socket. \hypertarget{group__socket_ga40101a7969252728f0f29a7b40afbb0}{ \index{socket@{socket}!socket\_\-tcp6@{socket\_\-tcp6}} \index{socket\_\-tcp6@{socket\_\-tcp6}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-tcp6 (void)}} \label{group__socket_ga40101a7969252728f0f29a7b40afbb0} Create a TCP/IPv6 socket. \hypertarget{group__socket_gaa146f612229109460767f7b33264436}{ \index{socket@{socket}!socket\_\-udp@{socket\_\-udp}} \index{socket\_\-udp@{socket\_\-udp}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-udp (void)}} \label{group__socket_gaa146f612229109460767f7b33264436} Create a UDP/IP socket. \hypertarget{group__socket_g6f5bd2aa2b03be301bdd402a96d8c1cc}{ \index{socket@{socket}!socket\_\-udp4@{socket\_\-udp4}} \index{socket\_\-udp4@{socket\_\-udp4}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-udp4 (void)}} \label{group__socket_g6f5bd2aa2b03be301bdd402a96d8c1cc} Create a UDP/IPv4 socket. \hypertarget{group__socket_g97257e7446c72c21b3b80b56efae5114}{ \index{socket@{socket}!socket\_\-udp6@{socket\_\-udp6}} \index{socket\_\-udp6@{socket\_\-udp6}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-udp6 (void)}} \label{group__socket_g97257e7446c72c21b3b80b56efae5114} Create a UDP/IPv6 socket. \hypertarget{group__socket_ge754518918db3d63dda03d9fd7497f24}{ \index{socket@{socket}!socket\_\-uncork@{socket\_\-uncork}} \index{socket\_\-uncork@{socket\_\-uncork}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-uncork (int {\em sock})}} \label{group__socket_ge754518918db3d63dda03d9fd7497f24} Unstop a TCP socket from sending short writes. \hypertarget{group__socket_g3c74e521debc5d71da6cb975c24f5a6f}{ \index{socket@{socket}!socket\_\-unixdgm@{socket\_\-unixdgm}} \index{socket\_\-unixdgm@{socket\_\-unixdgm}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-unixdgm (void)}} \label{group__socket_g3c74e521debc5d71da6cb975c24f5a6f} Create UNIX domain datagram socket. \hypertarget{group__socket_g8d8f154af4bc27c718676848aeca4517}{ \index{socket@{socket}!socket\_\-unixstr@{socket\_\-unixstr}} \index{socket\_\-unixstr@{socket\_\-unixstr}!socket@{socket}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int socket\_\-unixstr (void)}} \label{group__socket_g8d8f154af4bc27c718676848aeca4517} Create UNIX domain stream socket. bglibs-1.106/doc/latex/structipv6addr.tex0000664000076400007640000000162311147311327017722 0ustar bruceguenter\hypertarget{structipv6addr}{ \section{ipv6addr Struct Reference} \label{structipv6addr}\index{ipv6addr@{ipv6addr}} } {\tt \#include $<$ipv6.h$>$} \subsection*{Data Fields} \begin{CompactItemize} \item uint8 \hyperlink{structipv6addr_3848435a6d22106452f52a86439accc5}{addr} \mbox{[}16\mbox{]} \end{CompactItemize} \subsection{Detailed Description} IPv6 address structure. \subsection{Field Documentation} \hypertarget{structipv6addr_3848435a6d22106452f52a86439accc5}{ \index{ipv6addr@{ipv6addr}!addr@{addr}} \index{addr@{addr}!ipv6addr@{ipv6addr}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}uint8 {\bf ipv6addr::addr}\mbox{[}16\mbox{]}}} \label{structipv6addr_3848435a6d22106452f52a86439accc5} 128-bit IPv4 address, represented as 16 8-bit {\tt unsigned} {\tt chars}. The documentation for this struct was generated from the following file:\begin{CompactItemize} \item ipv6.h\end{CompactItemize} bglibs-1.106/doc/latex/structsurfrand.tex0000664000076400007640000000450611147311327020032 0ustar bruceguenter\hypertarget{structsurfrand}{ \section{surfrand Struct Reference} \label{structsurfrand}\index{surfrand@{surfrand}} } {\tt \#include $<$surfrand.h$>$} \subsection*{Data Fields} \begin{CompactItemize} \item unsigned \hyperlink{structsurfrand_6f15a78fbf375c12cd71db452ab993df}{used} \item uint32 \hyperlink{structsurfrand_84462e4f078546b98644df624788d49f}{generated} \mbox{[}SURF\_\-OUT\_\-U32\mbox{]} \item uint32 \hyperlink{structsurfrand_0d0b020bc598e847f08610ec16e9f1d1}{seed} \mbox{[}SURF\_\-SEED\_\-U32\mbox{]} \item uint32 \hyperlink{structsurfrand_4bbd5dabfc8d9a334d5474cf9c4e5d6f}{counter} \mbox{[}SURF\_\-IN\_\-U32\mbox{]} \end{CompactItemize} \subsection{Detailed Description} The \hyperlink{structsurfrand}{surfrand} state structure \subsection{Field Documentation} \hypertarget{structsurfrand_6f15a78fbf375c12cd71db452ab993df}{ \index{surfrand@{surfrand}!used@{used}} \index{used@{used}!surfrand@{surfrand}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned {\bf surfrand::used}}} \label{structsurfrand_6f15a78fbf375c12cd71db452ab993df} counts the number of bytes in {\tt generated} that have been output already \hypertarget{structsurfrand_84462e4f078546b98644df624788d49f}{ \index{surfrand@{surfrand}!generated@{generated}} \index{generated@{generated}!surfrand@{surfrand}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}uint32 {\bf surfrand::generated}\mbox{[}SURF\_\-OUT\_\-U32\mbox{]}}} \label{structsurfrand_84462e4f078546b98644df624788d49f} temporary storage for the generated random data \hypertarget{structsurfrand_0d0b020bc598e847f08610ec16e9f1d1}{ \index{surfrand@{surfrand}!seed@{seed}} \index{seed@{seed}!surfrand@{surfrand}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}uint32 {\bf surfrand::seed}\mbox{[}SURF\_\-SEED\_\-U32\mbox{]}}} \label{structsurfrand_0d0b020bc598e847f08610ec16e9f1d1} the input seed data \hypertarget{structsurfrand_4bbd5dabfc8d9a334d5474cf9c4e5d6f}{ \index{surfrand@{surfrand}!counter@{counter}} \index{counter@{counter}!surfrand@{surfrand}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}uint32 {\bf surfrand::counter}\mbox{[}SURF\_\-IN\_\-U32\mbox{]}}} \label{structsurfrand_4bbd5dabfc8d9a334d5474cf9c4e5d6f} a giant counter used as input to SURF The documentation for this struct was generated from the following file:\begin{CompactItemize} \item surfrand.h\end{CompactItemize} bglibs-1.106/doc/latex/pages.tex0000664000076400007640000000027611147311327016040 0ustar bruceguenter\section{bglibs Related Pages} Here is a list of all related documentation pages:\begin{CompactList} \item \contentsline{section}{Deprecated List}{\pageref{deprecated}}{} \end{CompactList} bglibs-1.106/doc/latex/structipv4addr.tex0000664000076400007640000000161711147311327017723 0ustar bruceguenter\hypertarget{structipv4addr}{ \section{ipv4addr Struct Reference} \label{structipv4addr}\index{ipv4addr@{ipv4addr}} } {\tt \#include $<$ipv4.h$>$} \subsection*{Data Fields} \begin{CompactItemize} \item uint8 \hyperlink{structipv4addr_e66b66a566da9be0ad0a43ef2e84b5f6}{addr} \mbox{[}4\mbox{]} \end{CompactItemize} \subsection{Detailed Description} IPv4 address structure. \subsection{Field Documentation} \hypertarget{structipv4addr_e66b66a566da9be0ad0a43ef2e84b5f6}{ \index{ipv4addr@{ipv4addr}!addr@{addr}} \index{addr@{addr}!ipv4addr@{ipv4addr}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}uint8 {\bf ipv4addr::addr}\mbox{[}4\mbox{]}}} \label{structipv4addr_e66b66a566da9be0ad0a43ef2e84b5f6} 32-bit IPv4 address, represented as 4 8-bit {\tt unsigned} {\tt chars}. The documentation for this struct was generated from the following file:\begin{CompactItemize} \item ipv4.h\end{CompactItemize} bglibs-1.106/doc/latex/structstr.tex0000664000076400007640000000344011147311327017012 0ustar bruceguenter\hypertarget{structstr}{ \section{str Struct Reference} \label{structstr}\index{str@{str}} } {\tt \#include $<$str.h$>$} \subsection*{Data Fields} \begin{CompactItemize} \item char $\ast$ \hyperlink{structstr_1fc4ce5d6a790001388349ca5b735383}{s} \item unsigned \hyperlink{structstr_c9e429e2e67d3f69a8e2dd5037efff07}{len} \item unsigned \hyperlink{structstr_513408f9e493c26f5c35a3c77837d156}{size} \end{CompactItemize} \subsection{Detailed Description} The basic string structure. \begin{Desc} \item[Note:]Initialize to {\tt \{0,0,0\}}. \end{Desc} \subsection{Field Documentation} \hypertarget{structstr_1fc4ce5d6a790001388349ca5b735383}{ \index{str@{str}!s@{s}} \index{s@{s}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ {\bf str::s}}} \label{structstr_1fc4ce5d6a790001388349ca5b735383} The pointer to the allocated data. This string will always be terminated with a {\tt NUL} byte to ensure compatibility with standard C string functions. May be used directly by programs, but should not be assigned. \hypertarget{structstr_c9e429e2e67d3f69a8e2dd5037efff07}{ \index{str@{str}!len@{len}} \index{len@{len}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned {\bf str::len}}} \label{structstr_c9e429e2e67d3f69a8e2dd5037efff07} 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. \hypertarget{structstr_513408f9e493c26f5c35a3c77837d156}{ \index{str@{str}!size@{size}} \index{size@{size}!str@{str}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned {\bf str::size}}} \label{structstr_513408f9e493c26f5c35a3c77837d156} The size of the above block. The documentation for this struct was generated from the following file:\begin{CompactItemize} \item str.h\end{CompactItemize} bglibs-1.106/doc/latex/adt_2gqueue__test_8c-example.tex0000664000076400007640000000113011147311327022355 0ustar bruceguenter\hypertarget{adt_2gqueue__test_8c-example}{ \section{adt/gqueue\_\-test.c} } \begin{DocInclude}\begin{verbatim}#include #include #include "gqueue.h" #ifdef SELFTEST_MAIN #include "selftest.c" GQUEUE_DECL(test,int); GQUEUE_DEFN(test,int,0,0); static struct gqueue queue; MAIN { int i; int* p; for (i = 0; i < 4; ++i) debugfn(test_push(&queue, &i)); while ((p = test_top(&queue)) != 0) { obuf_puti(&outbuf, *p); NL(); test_pop(&queue); } } #endif #ifdef SELFTEST_EXP result=1 result=1 result=1 result=1 0 1 2 3 #endif \end{verbatim} \end{DocInclude} bglibs-1.106/doc/latex/structstriter.tex0000664000076400007640000000504111147311327017675 0ustar bruceguenter\hypertarget{structstriter}{ \section{striter Struct Reference} \label{structstriter}\index{striter@{striter}} } {\tt \#include $<$iter.h$>$} \subsection*{Data Fields} \begin{CompactItemize} \item struct \hyperlink{structstr}{str} $\ast$ \hyperlink{structstriter_523ec694677f455dc6fe2b3c34737591}{str} \item unsigned \hyperlink{structstriter_02f10ae7c8a4646a78428dbaa907d65e}{start} \item const char $\ast$ \hyperlink{structstriter_f7c2852e3e6537118bf0070fc5883442}{startptr} \item unsigned \hyperlink{structstriter_771126fb0a1945ce2c9443953ea42aeb}{len} \item char \hyperlink{structstriter_3917d5ef03eca7e86fb079d73b28aa2d}{sep} \end{CompactItemize} \subsection{Detailed Description} The basic \hyperlink{structstriter}{striter} data type. \subsection{Field Documentation} \hypertarget{structstriter_523ec694677f455dc6fe2b3c34737591}{ \index{striter@{striter}!str@{str}} \index{str@{str}!striter@{striter}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf str}$\ast$ {\bf striter::str}\hspace{0.3cm}{\tt \mbox{[}read\mbox{]}}}} \label{structstriter_523ec694677f455dc6fe2b3c34737591} A pointer to the \hyperlink{structstr}{str} being iterated over. \hypertarget{structstriter_02f10ae7c8a4646a78428dbaa907d65e}{ \index{striter@{striter}!start@{start}} \index{start@{start}!striter@{striter}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned {\bf striter::start}}} \label{structstriter_02f10ae7c8a4646a78428dbaa907d65e} The starting offset of the current substring. \hypertarget{structstriter_f7c2852e3e6537118bf0070fc5883442}{ \index{striter@{striter}!startptr@{startptr}} \index{startptr@{startptr}!striter@{striter}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ {\bf striter::startptr}}} \label{structstriter_f7c2852e3e6537118bf0070fc5883442} Pointer to the current substring. \hypertarget{structstriter_771126fb0a1945ce2c9443953ea42aeb}{ \index{striter@{striter}!len@{len}} \index{len@{len}!striter@{striter}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned {\bf striter::len}}} \label{structstriter_771126fb0a1945ce2c9443953ea42aeb} Length of the current substring. \hypertarget{structstriter_3917d5ef03eca7e86fb079d73b28aa2d}{ \index{striter@{striter}!sep@{sep}} \index{sep@{sep}!striter@{striter}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}char {\bf striter::sep}}} \label{structstriter_3917d5ef03eca7e86fb079d73b28aa2d} The seperator used to delimit the substrings. The documentation for this struct was generated from the following file:\begin{CompactItemize} \item iter.h\end{CompactItemize} bglibs-1.106/doc/latex/group__ipv6.tex0000664000076400007640000001024511147311327017175 0ustar bruceguenter\hypertarget{group__ipv6}{ \section{ipv6: IPv6 Address Handling} \label{group__ipv6}\index{ipv6: IPv6 Address Handling@{ipv6: IPv6 Address Handling}} } \subsection*{Data Structures} \begin{CompactItemize} \item struct \hyperlink{structipv6addr}{ipv6addr} \end{CompactItemize} \subsection*{Typedefs} \begin{CompactItemize} \item typedef uint16 \hyperlink{group__ipv6_ga71ffb8f46cd4fa830090d23eb752847}{ipv6port} \end{CompactItemize} \subsection*{Functions} \begin{CompactItemize} \item const char $\ast$ \hyperlink{group__ipv6_ge6b6644458f3e4ac3443b4fa88829c2d}{ipv6\_\-scan} (const char $\ast$s, \hyperlink{structipv6addr}{ipv6addr} $\ast$addr) \item const char $\ast$ \hyperlink{group__ipv6_g683855a6d2d7d00e6ecf40d31012ee67}{ipv6\_\-format} (const \hyperlink{structipv6addr}{ipv6addr} $\ast$addr) \item unsigned \hyperlink{group__ipv6_gaa6f5339fb79b2791ff30c46e78be373}{fmt\_\-ipv6addr} (char $\ast$buffer, const \hyperlink{structipv6addr}{ipv6addr} $\ast$addr) \end{CompactItemize} \subsection*{Variables} \begin{CompactItemize} \item const \hyperlink{structipv6addr}{ipv6addr} \hyperlink{group__ipv6_gc24ae37b02435529dc159f137cecb438}{IPV6ADDR\_\-ANY} \item const \hyperlink{structipv6addr}{ipv6addr} \hyperlink{group__ipv6_g81cb63b2c6a88dc751ee66ddb9a41ae8}{IPV6ADDR\_\-LOOPBACK} \end{CompactItemize} \subsection{Typedef Documentation} \hypertarget{group__ipv6_ga71ffb8f46cd4fa830090d23eb752847}{ \index{ipv6@{ipv6}!ipv6port@{ipv6port}} \index{ipv6port@{ipv6port}!ipv6@{ipv6}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef uint16 {\bf ipv6port}}} \label{group__ipv6_ga71ffb8f46cd4fa830090d23eb752847} IPv6 port number. \subsection{Function Documentation} \hypertarget{group__ipv6_gaa6f5339fb79b2791ff30c46e78be373}{ \index{ipv6@{ipv6}!fmt\_\-ipv6addr@{fmt\_\-ipv6addr}} \index{fmt\_\-ipv6addr@{fmt\_\-ipv6addr}!ipv6@{ipv6}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned fmt\_\-ipv6addr (char $\ast$ {\em buffer}, const {\bf ipv6addr} $\ast$ {\em addr})}} \label{group__ipv6_gaa6f5339fb79b2791ff30c46e78be373} 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 {\tt NUL} byte. \begin{Desc} \item[Returns:]The number of bytes written to the buffer.\end{Desc} \begin{Desc} \item[Note:]This routine is thread and recursion safe. \end{Desc} \hypertarget{group__ipv6_g683855a6d2d7d00e6ecf40d31012ee67}{ \index{ipv6@{ipv6}!ipv6\_\-format@{ipv6\_\-format}} \index{ipv6\_\-format@{ipv6\_\-format}!ipv6@{ipv6}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ ipv6\_\-format (const {\bf ipv6addr} $\ast$ {\em addr})}} \label{group__ipv6_g683855a6d2d7d00e6ecf40d31012ee67} Produce a formatted C string from an IPv6 address. \begin{Desc} \item[Note:]The return value is statically allocated. Multiple calls to this function will return pointers to the same string. \end{Desc} \hypertarget{group__ipv6_ge6b6644458f3e4ac3443b4fa88829c2d}{ \index{ipv6@{ipv6}!ipv6\_\-scan@{ipv6\_\-scan}} \index{ipv6\_\-scan@{ipv6\_\-scan}!ipv6@{ipv6}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ ipv6\_\-scan (const char $\ast$ {\em s}, {\bf ipv6addr} $\ast$ {\em addr})}} \label{group__ipv6_ge6b6644458f3e4ac3443b4fa88829c2d} Scan a C string for an IPv6 address. \begin{Desc} \item[Returns:]{\tt NULL} if parsing failed, otherwise a pointer to the first character after the end of the address. \end{Desc} \subsection{Variable Documentation} \hypertarget{group__ipv6_gc24ae37b02435529dc159f137cecb438}{ \index{ipv6@{ipv6}!IPV6ADDR\_\-ANY@{IPV6ADDR\_\-ANY}} \index{IPV6ADDR\_\-ANY@{IPV6ADDR\_\-ANY}!ipv6@{ipv6}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf ipv6addr} {\bf IPV6ADDR\_\-ANY}}} \label{group__ipv6_gc24ae37b02435529dc159f137cecb438} IPv6 \char`\"{}any\char`\"{} address constant. \hypertarget{group__ipv6_g81cb63b2c6a88dc751ee66ddb9a41ae8}{ \index{ipv6@{ipv6}!IPV6ADDR\_\-LOOPBACK@{IPV6ADDR\_\-LOOPBACK}} \index{IPV6ADDR\_\-LOOPBACK@{IPV6ADDR\_\-LOOPBACK}!ipv6@{ipv6}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf ipv6addr} {\bf IPV6ADDR\_\-LOOPBACK}}} \label{group__ipv6_g81cb63b2c6a88dc751ee66ddb9a41ae8} IPv6 loopback address constant. bglibs-1.106/doc/latex/dir_3fb7bf5367cadb161b081662ce57c8a3.tex0000664000076400007640000000235711147311327022235 0ustar bruceguenter\hypertarget{dir_3fb7bf5367cadb161b081662ce57c8a3}{ \section{adt/ Directory Reference} \label{dir_3fb7bf5367cadb161b081662ce57c8a3}\index{adt/ Directory Reference@{adt/ Directory Reference}} } \subsection*{Files} \begin{CompactItemize} \item file \textbf{adt\_\-sp.c} \item file \textbf{adt/common.h} \item file \textbf{ghash.h} \item file \textbf{ghash\_\-add.c} \item file \textbf{ghash\_\-foreach.c} \item file \textbf{ghash\_\-free.c} \item file \textbf{ghash\_\-get.c} \item file \textbf{ghash\_\-init.c} \item file \textbf{ghash\_\-insert.c} \item file \textbf{ghash\_\-iter.c} \item file \textbf{ghash\_\-rebuild.c} \item file \textbf{ghash\_\-rehash.c} \item file \textbf{ghash\_\-remove.c} \item file \textbf{ghash\_\-search.c} \item file \textbf{ghash\_\-set.c} \item file \textbf{ghash\_\-test.c} \item file \textbf{gqueue.h} \item file \textbf{gqueue\_\-pop.c} \item file \textbf{gqueue\_\-push.c} \item file \textbf{gqueue\_\-test.c} \item file \textbf{gqueue\_\-top.c} \item file \textbf{gstack.h} \item file \textbf{gstack\_\-pop.c} \item file \textbf{gstack\_\-push.c} \item file \textbf{gstack\_\-test.c} \item file \textbf{gstack\_\-top.c} \item file \textbf{hashb.c} \item file \textbf{hashs.c} \end{CompactItemize} bglibs-1.106/doc/latex/dir_a2e2a6ddf2b9459cbc3be164f3c73476.tex0000664000076400007640000000177511147311327022325 0ustar bruceguenter\hypertarget{dir_a2e2a6ddf2b9459cbc3be164f3c73476}{ \section{crypto/ Directory Reference} \label{dir_a2e2a6ddf2b9459cbc3be164f3c73476}\index{crypto/ Directory Reference@{crypto/ Directory Reference}} } \subsection*{Files} \begin{CompactItemize} \item file \textbf{hmac-md5.c} \item file \textbf{hmac-sha1.c} \item file \textbf{hmac-sha256.c} \item file \textbf{hmac-sha384.c} \item file \textbf{hmac-sha512.c} \item file \textbf{hmac.c} \item file \textbf{hmac.h} \item file \textbf{md4.c} \item file \textbf{md4.h} \item file \textbf{md5-crypt.c} \item file \textbf{md5.c} \item file \textbf{md5.h} \item file \textbf{sha1.c} \item file \textbf{sha1.h} \item file \textbf{sha1test.c} \item file \textbf{sha256.c} \item file \textbf{sha256.h} \item file \textbf{sha384.c} \item file \textbf{sha384.h} \item file \textbf{sha512.c} \item file \textbf{sha512.h} \item file \textbf{surf.c} \item file \textbf{surf.h} \item file \textbf{surfrand.c} \item file \textbf{surfrand.h} \end{CompactItemize} bglibs-1.106/doc/latex/group__surfrand.tex0000664000076400007640000000701711147311327020140 0ustar bruceguenter\hypertarget{group__surfrand}{ \section{surfrand: Random number generator based on SURF} \label{group__surfrand}\index{surfrand: Random number generator based on SURF@{surfrand: Random number generator based on SURF}} } \subsection*{Data Structures} \begin{CompactItemize} \item struct \hyperlink{structsurfrand}{surfrand} \end{CompactItemize} \subsection*{Functions} \begin{CompactItemize} \item void \hyperlink{group__surfrand_g543f668d9157853de725e637ca8e31b7}{surfrand\_\-init} (struct \hyperlink{structsurfrand}{surfrand} $\ast$c, const uint32 $\ast$data, unsigned words) \item uint32 \hyperlink{group__surfrand_g48d5b73169fc296c6e9665afa9bce0a2}{surfrand\_\-uint32} (struct \hyperlink{structsurfrand}{surfrand} $\ast$c) \item double \hyperlink{group__surfrand_gf98246673277f05e14bb4fc80a9cf97a}{surfrand\_\-double} (struct \hyperlink{structsurfrand}{surfrand} $\ast$c) \item void \hyperlink{group__surfrand_g860a0ec8878526164d13a8f21db204d3}{surfrand\_\-fill} (struct \hyperlink{structsurfrand}{surfrand} $\ast$c, unsigned char $\ast$buf, unsigned len) \end{CompactItemize} \subsection{Function Documentation} \hypertarget{group__surfrand_gf98246673277f05e14bb4fc80a9cf97a}{ \index{surfrand@{surfrand}!surfrand\_\-double@{surfrand\_\-double}} \index{surfrand\_\-double@{surfrand\_\-double}!surfrand@{surfrand}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}double surfrand\_\-double (struct {\bf surfrand} $\ast$ {\em c})}} \label{group__surfrand_gf98246673277f05e14bb4fc80a9cf97a} 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. \hypertarget{group__surfrand_g860a0ec8878526164d13a8f21db204d3}{ \index{surfrand@{surfrand}!surfrand\_\-fill@{surfrand\_\-fill}} \index{surfrand\_\-fill@{surfrand\_\-fill}!surfrand@{surfrand}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void surfrand\_\-fill (struct {\bf surfrand} $\ast$ {\em c}, unsigned char $\ast$ {\em buf}, unsigned {\em len})}} \label{group__surfrand_g860a0ec8878526164d13a8f21db204d3} Fill the buffer with random data \hypertarget{group__surfrand_g543f668d9157853de725e637ca8e31b7}{ \index{surfrand@{surfrand}!surfrand\_\-init@{surfrand\_\-init}} \index{surfrand\_\-init@{surfrand\_\-init}!surfrand@{surfrand}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void surfrand\_\-init (struct {\bf surfrand} $\ast$ {\em c}, const uint32 $\ast$ {\em data}, unsigned {\em words})}} \label{group__surfrand_g543f668d9157853de725e637ca8e31b7} Initialize the {\tt \hyperlink{structsurfrand}{surfrand}} structure. Initializes the seed in {\tt c} from the input {\tt data}, and sets the counter to zero. If more than {\tt 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$\ast$2$^\wedge$32$^\wedge$12 or $>$10$^\wedge$116. \hypertarget{group__surfrand_g48d5b73169fc296c6e9665afa9bce0a2}{ \index{surfrand@{surfrand}!surfrand\_\-uint32@{surfrand\_\-uint32}} \index{surfrand\_\-uint32@{surfrand\_\-uint32}!surfrand@{surfrand}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}uint32 surfrand\_\-uint32 (struct {\bf surfrand} $\ast$ {\em c})}} \label{group__surfrand_g48d5b73169fc296c6e9665afa9bce0a2} Output an random unsigned 32-bit integer. All the bits in the output integer are equally random. bglibs-1.106/doc/latex/group__ipv4.tex0000664000076400007640000001312611147311327017174 0ustar bruceguenter\hypertarget{group__ipv4}{ \section{ipv4: IPv4 Address Handling} \label{group__ipv4}\index{ipv4: IPv4 Address Handling@{ipv4: IPv4 Address Handling}} } \subsection*{Data Structures} \begin{CompactItemize} \item struct \hyperlink{structipv4addr}{ipv4addr} \end{CompactItemize} \subsection*{Typedefs} \begin{CompactItemize} \item typedef uint16 \hyperlink{group__ipv4_g113bbf93f3b0011263ce519bb1ca7481}{ipv4port} \end{CompactItemize} \subsection*{Functions} \begin{CompactItemize} \item int \hyperlink{group__ipv4_g970fa2560edacb238d78e599bb1729f7}{ipv4\_\-parse} (const char $\ast$s, \hyperlink{structipv4addr}{ipv4addr} $\ast$addr, const char $\ast$$\ast$end) \_\-\_\-attribute\_\-\_\-((\_\-\_\-deprecated\_\-\_\-)) \item const char $\ast$ \hyperlink{group__ipv4_g628d2958c84e84cdb15bbae2b767eb53}{ipv4\_\-scan} (const char $\ast$s, \hyperlink{structipv4addr}{ipv4addr} $\ast$addr) \item const char $\ast$ \hyperlink{group__ipv4_ga161182e19993a2316e01bb34bfb4ef9}{ipv4\_\-format} (const \hyperlink{structipv4addr}{ipv4addr} $\ast$addr) \item unsigned \hyperlink{group__ipv4_g7dd8903f9d4e123f9698ad77ca49853f}{fmt\_\-ipv4addr} (char $\ast$buffer, const \hyperlink{structipv4addr}{ipv4addr} $\ast$addr) \end{CompactItemize} \subsection*{Variables} \begin{CompactItemize} \item const \hyperlink{structipv4addr}{ipv4addr} \hyperlink{group__ipv4_g1c3c3f0e39c1c5506d05cf23abace292}{IPV4ADDR\_\-ANY} \item const \hyperlink{structipv4addr}{ipv4addr} \hyperlink{group__ipv4_g189f4cbb8d0108e25d2b264b494311ba}{IPV4ADDR\_\-BROADCAST} \item const \hyperlink{structipv4addr}{ipv4addr} \hyperlink{group__ipv4_ga8e14bddb429c1dcd44dcdbfca7c6f7f}{IPV4ADDR\_\-LOOPBACK} \end{CompactItemize} \subsection{Typedef Documentation} \hypertarget{group__ipv4_g113bbf93f3b0011263ce519bb1ca7481}{ \index{ipv4@{ipv4}!ipv4port@{ipv4port}} \index{ipv4port@{ipv4port}!ipv4@{ipv4}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef uint16 {\bf ipv4port}}} \label{group__ipv4_g113bbf93f3b0011263ce519bb1ca7481} IPv4 port number. \subsection{Function Documentation} \hypertarget{group__ipv4_g7dd8903f9d4e123f9698ad77ca49853f}{ \index{ipv4@{ipv4}!fmt\_\-ipv4addr@{fmt\_\-ipv4addr}} \index{fmt\_\-ipv4addr@{fmt\_\-ipv4addr}!ipv4@{ipv4}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned fmt\_\-ipv4addr (char $\ast$ {\em buffer}, const {\bf ipv4addr} $\ast$ {\em addr})}} \label{group__ipv4_g7dd8903f9d4e123f9698ad77ca49853f} 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 {\tt NUL} byte. \begin{Desc} \item[Returns:]The number of bytes written to the buffer.\end{Desc} \begin{Desc} \item[Note:]This routine is thread and recursion safe. \end{Desc} \hypertarget{group__ipv4_ga161182e19993a2316e01bb34bfb4ef9}{ \index{ipv4@{ipv4}!ipv4\_\-format@{ipv4\_\-format}} \index{ipv4\_\-format@{ipv4\_\-format}!ipv4@{ipv4}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ ipv4\_\-format (const {\bf ipv4addr} $\ast$ {\em addr})}} \label{group__ipv4_ga161182e19993a2316e01bb34bfb4ef9} Produce a formatted C string from an IPv4 address. \begin{Desc} \item[Note:]The return value is statically allocated. Multiple calls to this function will return pointers to the same string. \end{Desc} \hypertarget{group__ipv4_g970fa2560edacb238d78e599bb1729f7}{ \index{ipv4@{ipv4}!ipv4\_\-parse@{ipv4\_\-parse}} \index{ipv4\_\-parse@{ipv4\_\-parse}!ipv4@{ipv4}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ipv4\_\-parse (const char $\ast$ {\em start}, {\bf ipv4addr} $\ast$ {\em addr}, const char $\ast$$\ast$ {\em end})}} \label{group__ipv4_g970fa2560edacb238d78e599bb1729f7} Parse an IPv4 address. \begin{Desc} \item[\hyperlink{deprecated__deprecated000001}{Deprecated}]This function is a wrapper for {\tt ipv4\_\-scan}.\end{Desc} \begin{Desc} \item[Returns:]Non-zero (true) if parsing succeeded, and sets {\tt $\ast$end} to the first character past the end of the address. \end{Desc} \hypertarget{group__ipv4_g628d2958c84e84cdb15bbae2b767eb53}{ \index{ipv4@{ipv4}!ipv4\_\-scan@{ipv4\_\-scan}} \index{ipv4\_\-scan@{ipv4\_\-scan}!ipv4@{ipv4}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ ipv4\_\-scan (const char $\ast$ {\em start}, {\bf ipv4addr} $\ast$ {\em addr})}} \label{group__ipv4_g628d2958c84e84cdb15bbae2b767eb53} Scan a C string for an IPv4 address. \begin{Desc} \item[Returns:]{\tt NULL} if parsing failed, otherwise a pointer to the first character after the end of the address. \end{Desc} \subsection{Variable Documentation} \hypertarget{group__ipv4_g1c3c3f0e39c1c5506d05cf23abace292}{ \index{ipv4@{ipv4}!IPV4ADDR\_\-ANY@{IPV4ADDR\_\-ANY}} \index{IPV4ADDR\_\-ANY@{IPV4ADDR\_\-ANY}!ipv4@{ipv4}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf ipv4addr} {\bf IPV4ADDR\_\-ANY}}} \label{group__ipv4_g1c3c3f0e39c1c5506d05cf23abace292} IPv4 \char`\"{}any\char`\"{} address constant. \hypertarget{group__ipv4_g189f4cbb8d0108e25d2b264b494311ba}{ \index{ipv4@{ipv4}!IPV4ADDR\_\-BROADCAST@{IPV4ADDR\_\-BROADCAST}} \index{IPV4ADDR\_\-BROADCAST@{IPV4ADDR\_\-BROADCAST}!ipv4@{ipv4}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf ipv4addr} {\bf IPV4ADDR\_\-BROADCAST}}} \label{group__ipv4_g189f4cbb8d0108e25d2b264b494311ba} IPv4 broadcast address constant. \hypertarget{group__ipv4_ga8e14bddb429c1dcd44dcdbfca7c6f7f}{ \index{ipv4@{ipv4}!IPV4ADDR\_\-LOOPBACK@{IPV4ADDR\_\-LOOPBACK}} \index{IPV4ADDR\_\-LOOPBACK@{IPV4ADDR\_\-LOOPBACK}!ipv4@{ipv4}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf ipv4addr} {\bf IPV4ADDR\_\-LOOPBACK}}} \label{group__ipv4_ga8e14bddb429c1dcd44dcdbfca7c6f7f} IPv4 loopback address constant. bglibs-1.106/doc/latex/structgqueue.tex0000664000076400007640000000364311147311327017502 0ustar bruceguenter\hypertarget{structgqueue}{ \section{gqueue Struct Reference} \label{structgqueue}\index{gqueue@{gqueue}} } {\tt \#include $<$gqueue.h$>$} \subsection*{Data Fields} \begin{CompactItemize} \item struct \hyperlink{structgqueue__node}{gqueue\_\-node} $\ast$ \hyperlink{structgqueue_58fa37f19569e23f996ee356aab59481}{head} \item struct \hyperlink{structgqueue__node}{gqueue\_\-node} $\ast$ \hyperlink{structgqueue_886b778be352db6ee48e47e9f4a1e7ff}{tail} \item unsigned \hyperlink{structgqueue_f5e944eb8f11a59adcac2b3a3e42a5c1}{count} \end{CompactItemize} \subsection{Detailed Description} Generic queue structure. \begin{Desc} \item[Examples: ]\par \hyperlink{adt_2gqueue__test_8c-example}{adt/gqueue\_\-test.c}.\end{Desc} \subsection{Field Documentation} \hypertarget{structgqueue_58fa37f19569e23f996ee356aab59481}{ \index{gqueue@{gqueue}!head@{head}} \index{head@{head}!gqueue@{gqueue}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf gqueue\_\-node}$\ast$ {\bf gqueue::head}\hspace{0.3cm}{\tt \mbox{[}read\mbox{]}}}} \label{structgqueue_58fa37f19569e23f996ee356aab59481} Pointer to the first item in the queue. \hypertarget{structgqueue_886b778be352db6ee48e47e9f4a1e7ff}{ \index{gqueue@{gqueue}!tail@{tail}} \index{tail@{tail}!gqueue@{gqueue}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf gqueue\_\-node}$\ast$ {\bf gqueue::tail}\hspace{0.3cm}{\tt \mbox{[}read\mbox{]}}}} \label{structgqueue_886b778be352db6ee48e47e9f4a1e7ff} Pointer to the last item in the queue. \hypertarget{structgqueue_f5e944eb8f11a59adcac2b3a3e42a5c1}{ \index{gqueue@{gqueue}!count@{count}} \index{count@{count}!gqueue@{gqueue}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned {\bf gqueue::count}}} \label{structgqueue_f5e944eb8f11a59adcac2b3a3e42a5c1} The number of items in the queue. The documentation for this struct was generated from the following file:\begin{CompactItemize} \item gqueue.h\end{CompactItemize} bglibs-1.106/doc/latex/structghash.tex0000664000076400007640000001313611147311327017277 0ustar bruceguenter\hypertarget{structghash}{ \section{ghash Struct Reference} \label{structghash}\index{ghash@{ghash}} } {\tt \#include $<$ghash.h$>$} \subsection*{Data Fields} \begin{CompactItemize} \item void $\ast$$\ast$ \hyperlink{structghash_75a14a2d91ed8df59c5915d6ffa2a438}{table} \item unsigned \hyperlink{structghash_85062447ab8fc6ce1ace49ea19352da4}{count} \item unsigned \hyperlink{structghash_5059677cb7a590ba556c018fb948160d}{size} \item unsigned long \hyperlink{structghash_135a3980fc664e44994d77ae07732efe}{keysize} \item unsigned long \hyperlink{structghash_329f39e342ffbe2785c98942d495e442}{entrysize} \item \hyperlink{group__adt_gd6ce53fbc11dbf67ca1c126cd17ee81a}{adt\_\-hash\_\-fn} $\ast$ \hyperlink{structghash_df5a40df7d67fc67ff491e62f1e424b2}{hashfn} \item \hyperlink{group__adt_g03ed35b7331128b069dc77ab33798782}{adt\_\-cmp\_\-fn} $\ast$ \hyperlink{structghash_e00fae5ef0ac14fb3585d1a9df7365ca}{keycmp} \item \hyperlink{group__adt_ga98f7f3499407a5dc1afdcbb20df2e15}{adt\_\-copy\_\-fn} $\ast$ \hyperlink{structghash_3058447f36633ec2dd3648339199c03f}{keycopy} \item \hyperlink{group__adt_ga98f7f3499407a5dc1afdcbb20df2e15}{adt\_\-copy\_\-fn} $\ast$ \hyperlink{structghash_4cbd9f574c6f87da77716502f86edb9c}{datacopy} \item \hyperlink{group__adt_g87ba7ca9dce36c22fe75a730a1d768a9}{adt\_\-free\_\-fn} $\ast$ \hyperlink{structghash_bb606fc7cd6c3a8c6e25b571648bd372}{keyfree} \item \hyperlink{group__adt_g87ba7ca9dce36c22fe75a730a1d768a9}{adt\_\-free\_\-fn} $\ast$ \hyperlink{structghash_12837bf8bfcdc555608b0108c2e11231}{datafree} \end{CompactItemize} \subsection{Detailed Description} The core generic hash table structure. \begin{Desc} \item[Examples: ]\par \hyperlink{adt_2ghash__test_8c-example}{adt/ghash\_\-test.c}.\end{Desc} \subsection{Field Documentation} \hypertarget{structghash_75a14a2d91ed8df59c5915d6ffa2a438}{ \index{ghash@{ghash}!table@{table}} \index{table@{table}!ghash@{ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void$\ast$$\ast$ {\bf ghash::table}}} \label{structghash_75a14a2d91ed8df59c5915d6ffa2a438} The hash table itself is an array of pointers, the actual type of which is dependant on the declaration of the table. \hypertarget{structghash_85062447ab8fc6ce1ace49ea19352da4}{ \index{ghash@{ghash}!count@{count}} \index{count@{count}!ghash@{ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned {\bf ghash::count}}} \label{structghash_85062447ab8fc6ce1ace49ea19352da4} The count is the number of items stored in the table. \hypertarget{structghash_5059677cb7a590ba556c018fb948160d}{ \index{ghash@{ghash}!size@{size}} \index{size@{size}!ghash@{ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned {\bf ghash::size}}} \label{structghash_5059677cb7a590ba556c018fb948160d} The size is the number of slots available in the table. \hypertarget{structghash_135a3980fc664e44994d77ae07732efe}{ \index{ghash@{ghash}!keysize@{keysize}} \index{keysize@{keysize}!ghash@{ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned long {\bf ghash::keysize}}} \label{structghash_135a3980fc664e44994d77ae07732efe} The size, in bytes, of the key structure in each table entry. \hypertarget{structghash_329f39e342ffbe2785c98942d495e442}{ \index{ghash@{ghash}!entrysize@{entrysize}} \index{entrysize@{entrysize}!ghash@{ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned long {\bf ghash::entrysize}}} \label{structghash_329f39e342ffbe2785c98942d495e442} The total size, in bytes, of an entry (key and data). \hypertarget{structghash_df5a40df7d67fc67ff491e62f1e424b2}{ \index{ghash@{ghash}!hashfn@{hashfn}} \index{hashfn@{hashfn}!ghash@{ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf adt\_\-hash\_\-fn}$\ast$ {\bf ghash::hashfn}}} \label{structghash_df5a40df7d67fc67ff491e62f1e424b2} Pointer to the function which produces a hash of a key. \hypertarget{structghash_e00fae5ef0ac14fb3585d1a9df7365ca}{ \index{ghash@{ghash}!keycmp@{keycmp}} \index{keycmp@{keycmp}!ghash@{ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf adt\_\-cmp\_\-fn}$\ast$ {\bf ghash::keycmp}}} \label{structghash_e00fae5ef0ac14fb3585d1a9df7365ca} Pointer to the function which compares two keys. \hypertarget{structghash_3058447f36633ec2dd3648339199c03f}{ \index{ghash@{ghash}!keycopy@{keycopy}} \index{keycopy@{keycopy}!ghash@{ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf adt\_\-copy\_\-fn}$\ast$ {\bf ghash::keycopy}}} \label{structghash_3058447f36633ec2dd3648339199c03f} Pointer to the function which copies a key. \hypertarget{structghash_4cbd9f574c6f87da77716502f86edb9c}{ \index{ghash@{ghash}!datacopy@{datacopy}} \index{datacopy@{datacopy}!ghash@{ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf adt\_\-copy\_\-fn}$\ast$ {\bf ghash::datacopy}}} \label{structghash_4cbd9f574c6f87da77716502f86edb9c} Pointer to the function which copies a data item. \hypertarget{structghash_bb606fc7cd6c3a8c6e25b571648bd372}{ \index{ghash@{ghash}!keyfree@{keyfree}} \index{keyfree@{keyfree}!ghash@{ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf adt\_\-free\_\-fn}$\ast$ {\bf ghash::keyfree}}} \label{structghash_bb606fc7cd6c3a8c6e25b571648bd372} Pointer to the function which frees a key. \hypertarget{structghash_12837bf8bfcdc555608b0108c2e11231}{ \index{ghash@{ghash}!datafree@{datafree}} \index{datafree@{datafree}!ghash@{ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf adt\_\-free\_\-fn}$\ast$ {\bf ghash::datafree}}} \label{structghash_12837bf8bfcdc555608b0108c2e11231} Pointer to the function which fressa a data item. The documentation for this struct was generated from the following file:\begin{CompactItemize} \item ghash.h\end{CompactItemize} bglibs-1.106/doc/latex/structibuf.tex0000664000076400007640000000321711147311327017131 0ustar bruceguenter\hypertarget{structibuf}{ \section{ibuf Struct Reference} \label{structibuf}\index{ibuf@{ibuf}} } {\tt \#include $<$ibuf.h$>$} \subsection*{Data Fields} \begin{CompactItemize} \item \hyperlink{structiobuf}{iobuf} \hyperlink{structibuf_d0d711b17de745f857fc4184bcc59786}{io} \item unsigned \hyperlink{structibuf_7e005577893b9eee0ec57bc50775b885}{count} \item \hyperlink{group__ibuf_gef08f9c3cf7f85292ca368ca62ab0e4a}{ibuf\_\-fn} \hyperlink{structibuf_68420a8b6a6bad68c27106f10abbbb75}{readfn} \end{CompactItemize} \subsection{Detailed Description} Input specific buffer. \subsection{Field Documentation} \hypertarget{structibuf_d0d711b17de745f857fc4184bcc59786}{ \index{ibuf@{ibuf}!io@{io}} \index{io@{io}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf iobuf} {\bf ibuf::io}}} \label{structibuf_d0d711b17de745f857fc4184bcc59786} Base {\tt \hyperlink{structiobuf}{iobuf}} structure. \hypertarget{structibuf_7e005577893b9eee0ec57bc50775b885}{ \index{ibuf@{ibuf}!count@{count}} \index{count@{count}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned {\bf ibuf::count}}} \label{structibuf_7e005577893b9eee0ec57bc50775b885} The number of bytes read in the last operation. \hypertarget{structibuf_68420a8b6a6bad68c27106f10abbbb75}{ \index{ibuf@{ibuf}!readfn@{readfn}} \index{readfn@{readfn}!ibuf@{ibuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf ibuf\_\-fn} {\bf ibuf::readfn}}} \label{structibuf_68420a8b6a6bad68c27106f10abbbb75} Function used to read data from the file descriptor. The documentation for this struct was generated from the following file:\begin{CompactItemize} \item ibuf.h\end{CompactItemize} bglibs-1.106/doc/latex/group__fmt.tex0000664000076400007640000005227611147311327017111 0ustar bruceguenter\hypertarget{group__fmt}{ \section{fmt: Formatting Functions} \label{group__fmt}\index{fmt: Formatting Functions@{fmt: Formatting Functions}} } \subsection*{Miscelaneous formatting} \begin{CompactItemize} \item unsigned \hyperlink{group__fmt_g8cf2587d24ebfb689584ac2b720848f7}{fmt\_\-char} (char $\ast$buffer, int ch, unsigned width, char pad) \item \hypertarget{group__fmt_gaf1fd5e741f2c3a6be876911833255b5}{ unsigned \textbf{fmt\_\-mem} (char $\ast$buffer, const char $\ast$s, unsigned length, unsigned width, char pad)} \label{group__fmt_gaf1fd5e741f2c3a6be876911833255b5} \item \hypertarget{group__fmt_g1c7ea5ce60e156ae7af948f655e696d8}{ unsigned \textbf{fmt\_\-chars} (char $\ast$buffer, const char $\ast$s, unsigned width, char pad)} \label{group__fmt_g1c7ea5ce60e156ae7af948f655e696d8} \item \hypertarget{group__fmt_gc19fba32fbe6d25affc39a39732bfbfa}{ unsigned \textbf{fmt\_\-str} (char $\ast$buffer, const struct \hyperlink{structstr}{str} $\ast$s, unsigned width, char pad)} \label{group__fmt_gc19fba32fbe6d25affc39a39732bfbfa} \end{CompactItemize} \subsection*{Multiple item formatting} \begin{CompactItemize} \item unsigned \hyperlink{group__fmt_g4aa700e3901cdb492952b0bce2bc5ef7}{fmt\_\-multi} (char $\ast$buffer, const char $\ast$format,...) \item unsigned \hyperlink{group__fmt_gfaa2bfdb6564f3673ecc146ae211c34c}{fmt\_\-multiv} (char $\ast$buffer, const char $\ast$format, va\_\-list ap) \end{CompactItemize} \subsection*{Signed integer conversions} \begin{CompactItemize} \item unsigned \hyperlink{group__fmt_g03ef4589754b709c3aef3e3143275f52}{fmt\_\-snumw} (char $\ast$buffer, long num, unsigned width, char pad, unsigned base, const char $\ast$digits) \item unsigned \hyperlink{group__fmt_g9952c09d2faa2199c44f82e0107efb11}{fmt\_\-sdec} (char $\ast$buffer, long num) \item unsigned \hyperlink{group__fmt_gd6ce18c84381ca01d1881677e04e7319}{fmt\_\-sdecw} (char $\ast$buffer, long num, unsigned width, char pad) \end{CompactItemize} \subsection*{Signed long long integer conversions} \begin{CompactItemize} \item unsigned \hyperlink{group__fmt_g846c37d2986b307ac3247b4a08a2c0e9}{fmt\_\-sllnumw} (char $\ast$buffer, long long num, unsigned width, char pad, unsigned base, const char $\ast$digits) \item unsigned \hyperlink{group__fmt_gea966b25aa32c5ba418ce06a69ceb7d4}{fmt\_\-slldec} (char $\ast$buffer, long long num) \item unsigned \hyperlink{group__fmt_g9e912f164c9cb793ef6dc480086dfbf6}{fmt\_\-slldecw} (char $\ast$buffer, long long num, unsigned width, char pad) \end{CompactItemize} \subsection*{Unsigned integer conversions} \begin{CompactItemize} \item unsigned \hyperlink{group__fmt_g21aed97705f1db6ab7cd56e95ccc2957}{fmt\_\-unumw} (char $\ast$buffer, unsigned long num, unsigned width, char pad, unsigned base, const char $\ast$digits) \item unsigned \hyperlink{group__fmt_gb6f4bdfdc75deed202cc4403f972dca2}{fmt\_\-udec} (char $\ast$buffer, unsigned long num) \item unsigned \hyperlink{group__fmt_gdb632bcf182ecb82ba69de83370bdb5d}{fmt\_\-udecw} (char $\ast$buffer, unsigned long num, unsigned width, char pad) \item unsigned \hyperlink{group__fmt_g7208c091848b3193265cfb8a2b2335f2}{fmt\_\-uhex} (char $\ast$buffer, unsigned long num) \item unsigned \hyperlink{group__fmt_g5c9c916ec100fd2c45f4d99455609158}{fmt\_\-uhexw} (char $\ast$buffer, unsigned long num, unsigned width, char pad) \item unsigned \hyperlink{group__fmt_gcd4bc1820b0553b90a4a51bad560e031}{fmt\_\-uHex} (char $\ast$buffer, unsigned long num) \item unsigned \hyperlink{group__fmt_g30218a8ef109106e929070089568b939}{fmt\_\-uHexw} (char $\ast$buffer, unsigned long num, unsigned width, char pad) \end{CompactItemize} \subsection*{Unsigned long long integer conversions} \begin{CompactItemize} \item unsigned \hyperlink{group__fmt_g4f6d7ff7ce9d19a4332223241370f5c9}{fmt\_\-ullnumw} (char $\ast$buffer, unsigned long long num, unsigned width, char pad, unsigned base, const char $\ast$digits) \item unsigned \hyperlink{group__fmt_g7db138d3b4d516185e867968fdd9a2ca}{fmt\_\-ulldec} (char $\ast$buffer, unsigned long long num) \item unsigned \hyperlink{group__fmt_g4aa867fd5f5a77bf0b2f280599d6aa79}{fmt\_\-ulldecw} (char $\ast$buffer, unsigned long long num, unsigned width, char pad) \item unsigned \hyperlink{group__fmt_gf58bf0ada39489279c7d3f470259a225}{fmt\_\-ullhex} (char $\ast$buffer, unsigned long long num) \item unsigned \hyperlink{group__fmt_ga6cc0111bbf26bf10be7eba8823307ae}{fmt\_\-ullhexw} (char $\ast$buffer, unsigned long long num, unsigned width, char pad) \item unsigned \hyperlink{group__fmt_g4be421a6bbb01aec3585eabc588c70ae}{fmt\_\-ullHex} (char $\ast$buffer, unsigned long long num) \item unsigned \hyperlink{group__fmt_g3d136fd67f2772fa36c723dc7bf48460}{fmt\_\-ullHexw} (char $\ast$buffer, unsigned long long num, unsigned width, char pad) \end{CompactItemize} \subsection*{Defines} \begin{CompactItemize} \item \#define \hyperlink{group__fmt_g43dd71c59052b32ecf086b3690ef4216}{FMT\_\-ULONG\_\-LEN}~40 \end{CompactItemize} \subsection*{Functions} \begin{CompactItemize} \item unsigned \hyperlink{group__fmt_g23e3b855943d828c0236b6dae609cb71}{fmt\_\-pad} (char $\ast$buffer, unsigned width, char pad) \item unsigned \hyperlink{group__fmt_g36373924f1c9d9860f6f71ea2b09a206}{fmt\_\-sign\_\-pad} (char $\ast$buffer, int sign, unsigned width, char pad) \end{CompactItemize} \subsection*{Variables} \begin{CompactItemize} \item const char \hyperlink{group__fmt_g7147653a54c1ddfd3a1bdbdd96c1ea18}{fmt\_\-lcase\_\-digits} \mbox{[}36\mbox{]} \item const char \hyperlink{group__fmt_ge7dc3d439e1a77e25abdf523e64f25f2}{fmt\_\-ucase\_\-digits} \mbox{[}36\mbox{]} \end{CompactItemize} \subsection{Detailed Description} \begin{Desc} \item[Function Naming]\end{Desc} \begin{enumerate} \item Prefix\begin{itemize} \item {\tt fmt\_\-} : Always present\end{itemize} \item Data type\begin{itemize} \item {\tt s} : Signed integer (long)\item {\tt u} : Unsigned integer (long)\item {\tt sll} : Signed long long integer\item {\tt ull} : Unsigned long long integer\end{itemize} \item Conversion type\begin{itemize} \item {\tt num} : Generic number\item {\tt dec} : Decimal\item {\tt hex} : Hexadecimal (lower case)\item {\tt Hex} : Hexadecimal (upper case)\end{itemize} \item Width / Padding\begin{itemize} \item {\tt w} : (optional) Pad out the result to a minimum width\end{itemize} \end{enumerate} For example, {\tt fmt\_\-sdecw} formats a signed integer using decimal with width padding. \begin{Desc} \item[Calling Convention]\end{Desc} Parameters to the fmt functions are passed in the following order. The presence of all parameters, except for {\tt buffer}, is dependant on which function is being used. \begin{enumerate} \item {\tt buffer} : The character string into which to put the data result. If this is {\tt NULL}, no data is written, and only the length is calculated. This is useful for determining how long a formatted string might be.\item {\tt number} or {\tt data} : The input data item to convert.\item {\tt width} : The minimum output width.\item {\tt pad} : The character with which to pad the output.\item {\tt base} : The numerical base to use.\item {\tt digits} : The array of digits to use.\end{enumerate} \begin{Desc} \item[Return Value]\end{Desc} All fmt functions return the number of bytes written to the buffer space. \subsection{Define Documentation} \hypertarget{group__fmt_g43dd71c59052b32ecf086b3690ef4216}{ \index{fmt@{fmt}!FMT\_\-ULONG\_\-LEN@{FMT\_\-ULONG\_\-LEN}} \index{FMT\_\-ULONG\_\-LEN@{FMT\_\-ULONG\_\-LEN}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define FMT\_\-ULONG\_\-LEN~40}} \label{group__fmt_g43dd71c59052b32ecf086b3690ef4216} The maximum space used by a formatted number. This value is long enough for 2$^\wedge$128 plus a trailing {\tt NUL} byte. \subsection{Function Documentation} \hypertarget{group__fmt_g8cf2587d24ebfb689584ac2b720848f7}{ \index{fmt@{fmt}!fmt\_\-char@{fmt\_\-char}} \index{fmt\_\-char@{fmt\_\-char}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned fmt\_\-char (char $\ast$ {\em buffer}, int {\em ch}, unsigned {\em width}, char {\em pad})}} \label{group__fmt_g8cf2587d24ebfb689584ac2b720848f7} Format a single character \hypertarget{group__fmt_g4aa700e3901cdb492952b0bce2bc5ef7}{ \index{fmt@{fmt}!fmt\_\-multi@{fmt\_\-multi}} \index{fmt\_\-multi@{fmt\_\-multi}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned fmt\_\-multi (char $\ast$ {\em buffer}, const char $\ast$ {\em format}, {\em ...})}} \label{group__fmt_g4aa700e3901cdb492952b0bce2bc5ef7} Format multiple items. The {\tt 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: {\bf Zero or more flag characters:} \begin{description} \item[{\tt \#} ]Use an \char`\"{}alternate form\char`\"{} to convert the value. For octal conversion, the result is prefixed with a {\tt 0} . For hexadecimal conversion, the result is prefixed with either {\tt 0x} or {\tt 0X} depending on the conversion type. \item[{\tt -} ](not implemented) Pad on the right (left justified) instead of on the left (default right justified). \item[{\tt 0} ]Pad the result with zeros instead of spaces. \end{description} {\bf 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. {\bf Length modifier:} \begin{description} \item[{\tt l} ]The following conversion uses a {\tt long} integer type. \item[{\tt ll} ]The following conversion uses a {\tt long} {\tt long} integer type. \end{description} {\bf Conversion specifier.} \begin{description} \item[{\tt d} ]\item[{\tt i} ]The {\tt int} argument is converted to a signed decimal string. \item[{\tt o} ]\item[{\tt u} ]\item[{\tt x} ]\item[{\tt X} ]The {\tt unsigned} {\tt int} argument is converted to a unsigned octal, unsigned decimal, lowercase unsigned hexadecimal, or uppercase unsigned hexadecimal string respectively. \item[{\tt c} ]The {\tt int} argument is converted to an unsigned char. \item[{\tt s} ]The {\tt const} {\tt char$\ast$} argument is converted. \item[{\tt S} ]The {\tt const} {\tt str$\ast$} argument is converted. \item[{\tt p} ]The {\tt void$\ast$} argument is converted to a hexadecimal string. \item[{\tt m} ]The result of {\tt strerror(errno)} is formatted. \item[{\tt $\backslash$} ]The next character literal from the format string is converted as with {\tt c} conversion. \item[{\tt \{string\}} ]The literal string enclosed by the parenthesis is converted as with {\tt s} conversion. \end{description} \hypertarget{group__fmt_gfaa2bfdb6564f3673ecc146ae211c34c}{ \index{fmt@{fmt}!fmt\_\-multiv@{fmt\_\-multiv}} \index{fmt\_\-multiv@{fmt\_\-multiv}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned fmt\_\-multiv (char $\ast$ {\em buffer}, const char $\ast$ {\em format}, va\_\-list {\em ap})}} \label{group__fmt_gfaa2bfdb6564f3673ecc146ae211c34c} Format multiple items, using a va\_\-list. This is the core function used to format multiple items. \hypertarget{group__fmt_g23e3b855943d828c0236b6dae609cb71}{ \index{fmt@{fmt}!fmt\_\-pad@{fmt\_\-pad}} \index{fmt\_\-pad@{fmt\_\-pad}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned fmt\_\-pad (char $\ast$ {\em buffer}, unsigned {\em width}, char {\em pad})}} \label{group__fmt_g23e3b855943d828c0236b6dae609cb71} Format a pad character. \hypertarget{group__fmt_g9952c09d2faa2199c44f82e0107efb11}{ \index{fmt@{fmt}!fmt\_\-sdec@{fmt\_\-sdec}} \index{fmt\_\-sdec@{fmt\_\-sdec}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned fmt\_\-sdec (char $\ast$ {\em buffer}, long {\em num})}} \label{group__fmt_g9952c09d2faa2199c44f82e0107efb11} Format a signed integer as decimal. \hypertarget{group__fmt_gd6ce18c84381ca01d1881677e04e7319}{ \index{fmt@{fmt}!fmt\_\-sdecw@{fmt\_\-sdecw}} \index{fmt\_\-sdecw@{fmt\_\-sdecw}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned fmt\_\-sdecw (char $\ast$ {\em buffer}, long {\em num}, unsigned {\em width}, char {\em pad})}} \label{group__fmt_gd6ce18c84381ca01d1881677e04e7319} Format a signed integer as decimal with padding. \hypertarget{group__fmt_g36373924f1c9d9860f6f71ea2b09a206}{ \index{fmt@{fmt}!fmt\_\-sign\_\-pad@{fmt\_\-sign\_\-pad}} \index{fmt\_\-sign\_\-pad@{fmt\_\-sign\_\-pad}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned fmt\_\-sign\_\-pad (char $\ast$ {\em buffer}, int {\em sign}, unsigned {\em width}, char {\em pad})}} \label{group__fmt_g36373924f1c9d9860f6f71ea2b09a206} Format padding for a signed number. \hypertarget{group__fmt_gea966b25aa32c5ba418ce06a69ceb7d4}{ \index{fmt@{fmt}!fmt\_\-slldec@{fmt\_\-slldec}} \index{fmt\_\-slldec@{fmt\_\-slldec}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned fmt\_\-slldec (char $\ast$ {\em buffer}, long long {\em num})}} \label{group__fmt_gea966b25aa32c5ba418ce06a69ceb7d4} Format a signed long long integer as decimal. \hypertarget{group__fmt_g9e912f164c9cb793ef6dc480086dfbf6}{ \index{fmt@{fmt}!fmt\_\-slldecw@{fmt\_\-slldecw}} \index{fmt\_\-slldecw@{fmt\_\-slldecw}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned fmt\_\-slldecw (char $\ast$ {\em buffer}, long long {\em num}, unsigned {\em width}, char {\em pad})}} \label{group__fmt_g9e912f164c9cb793ef6dc480086dfbf6} Format a signed long long integer as decimal with padding. \hypertarget{group__fmt_g846c37d2986b307ac3247b4a08a2c0e9}{ \index{fmt@{fmt}!fmt\_\-sllnumw@{fmt\_\-sllnumw}} \index{fmt\_\-sllnumw@{fmt\_\-sllnumw}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned fmt\_\-sllnumw (char $\ast$ {\em buffer}, long long {\em num}, unsigned {\em width}, char {\em pad}, unsigned {\em base}, const char $\ast$ {\em digits})}} \label{group__fmt_g846c37d2986b307ac3247b4a08a2c0e9} Format a signed long long integer of arbitrary base with optional padding. \hypertarget{group__fmt_g03ef4589754b709c3aef3e3143275f52}{ \index{fmt@{fmt}!fmt\_\-snumw@{fmt\_\-snumw}} \index{fmt\_\-snumw@{fmt\_\-snumw}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned fmt\_\-snumw (char $\ast$ {\em buffer}, long {\em num}, unsigned {\em width}, char {\em pad}, unsigned {\em base}, const char $\ast$ {\em digits})}} \label{group__fmt_g03ef4589754b709c3aef3e3143275f52} Format a signed integer of arbitrary base with optional padding. \hypertarget{group__fmt_gb6f4bdfdc75deed202cc4403f972dca2}{ \index{fmt@{fmt}!fmt\_\-udec@{fmt\_\-udec}} \index{fmt\_\-udec@{fmt\_\-udec}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned fmt\_\-udec (char $\ast$ {\em buffer}, unsigned long {\em num})}} \label{group__fmt_gb6f4bdfdc75deed202cc4403f972dca2} Format an unsigned integer as decimal. \hypertarget{group__fmt_gdb632bcf182ecb82ba69de83370bdb5d}{ \index{fmt@{fmt}!fmt\_\-udecw@{fmt\_\-udecw}} \index{fmt\_\-udecw@{fmt\_\-udecw}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned fmt\_\-udecw (char $\ast$ {\em buffer}, unsigned long {\em num}, unsigned {\em width}, char {\em pad})}} \label{group__fmt_gdb632bcf182ecb82ba69de83370bdb5d} Format an unsigned integer as decimal with padding. \hypertarget{group__fmt_gcd4bc1820b0553b90a4a51bad560e031}{ \index{fmt@{fmt}!fmt\_\-uHex@{fmt\_\-uHex}} \index{fmt\_\-uHex@{fmt\_\-uHex}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned fmt\_\-uHex (char $\ast$ {\em buffer}, unsigned long {\em num})}} \label{group__fmt_gcd4bc1820b0553b90a4a51bad560e031} Format an unsigned integer as (upper-case) hexadecimal. \hypertarget{group__fmt_g7208c091848b3193265cfb8a2b2335f2}{ \index{fmt@{fmt}!fmt\_\-uhex@{fmt\_\-uhex}} \index{fmt\_\-uhex@{fmt\_\-uhex}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned fmt\_\-uhex (char $\ast$ {\em buffer}, unsigned long {\em num})}} \label{group__fmt_g7208c091848b3193265cfb8a2b2335f2} Format an unsigned integer as (lower-case) hexadecimal. \hypertarget{group__fmt_g30218a8ef109106e929070089568b939}{ \index{fmt@{fmt}!fmt\_\-uHexw@{fmt\_\-uHexw}} \index{fmt\_\-uHexw@{fmt\_\-uHexw}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned fmt\_\-uHexw (char $\ast$ {\em buffer}, unsigned long {\em num}, unsigned {\em width}, char {\em pad})}} \label{group__fmt_g30218a8ef109106e929070089568b939} Format an unsigned integer as (upper-case) hexadecimal with padding. \hypertarget{group__fmt_g5c9c916ec100fd2c45f4d99455609158}{ \index{fmt@{fmt}!fmt\_\-uhexw@{fmt\_\-uhexw}} \index{fmt\_\-uhexw@{fmt\_\-uhexw}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned fmt\_\-uhexw (char $\ast$ {\em buffer}, unsigned long {\em num}, unsigned {\em width}, char {\em pad})}} \label{group__fmt_g5c9c916ec100fd2c45f4d99455609158} Format an unsigned integer as (lower-case) hexadecimal with padding. \hypertarget{group__fmt_g7db138d3b4d516185e867968fdd9a2ca}{ \index{fmt@{fmt}!fmt\_\-ulldec@{fmt\_\-ulldec}} \index{fmt\_\-ulldec@{fmt\_\-ulldec}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned fmt\_\-ulldec (char $\ast$ {\em buffer}, unsigned long long {\em num})}} \label{group__fmt_g7db138d3b4d516185e867968fdd9a2ca} Format an unsigned long long integer as decimal. \hypertarget{group__fmt_g4aa867fd5f5a77bf0b2f280599d6aa79}{ \index{fmt@{fmt}!fmt\_\-ulldecw@{fmt\_\-ulldecw}} \index{fmt\_\-ulldecw@{fmt\_\-ulldecw}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned fmt\_\-ulldecw (char $\ast$ {\em buffer}, unsigned long long {\em num}, unsigned {\em width}, char {\em pad})}} \label{group__fmt_g4aa867fd5f5a77bf0b2f280599d6aa79} Format an unsigned long long integer as decimal with padding. \hypertarget{group__fmt_g4be421a6bbb01aec3585eabc588c70ae}{ \index{fmt@{fmt}!fmt\_\-ullHex@{fmt\_\-ullHex}} \index{fmt\_\-ullHex@{fmt\_\-ullHex}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned fmt\_\-ullHex (char $\ast$ {\em buffer}, unsigned long long {\em num})}} \label{group__fmt_g4be421a6bbb01aec3585eabc588c70ae} Format an unsigned long long integer as (upper-case) hexadecimal. \hypertarget{group__fmt_gf58bf0ada39489279c7d3f470259a225}{ \index{fmt@{fmt}!fmt\_\-ullhex@{fmt\_\-ullhex}} \index{fmt\_\-ullhex@{fmt\_\-ullhex}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned fmt\_\-ullhex (char $\ast$ {\em buffer}, unsigned long long {\em num})}} \label{group__fmt_gf58bf0ada39489279c7d3f470259a225} Format an unsigned long long integer as hexadecimal. \hypertarget{group__fmt_g3d136fd67f2772fa36c723dc7bf48460}{ \index{fmt@{fmt}!fmt\_\-ullHexw@{fmt\_\-ullHexw}} \index{fmt\_\-ullHexw@{fmt\_\-ullHexw}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned fmt\_\-ullHexw (char $\ast$ {\em buffer}, unsigned long long {\em num}, unsigned {\em width}, char {\em pad})}} \label{group__fmt_g3d136fd67f2772fa36c723dc7bf48460} Format an unsigned long long integer as (upper-case) hexadecimal with padding. \hypertarget{group__fmt_ga6cc0111bbf26bf10be7eba8823307ae}{ \index{fmt@{fmt}!fmt\_\-ullhexw@{fmt\_\-ullhexw}} \index{fmt\_\-ullhexw@{fmt\_\-ullhexw}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned fmt\_\-ullhexw (char $\ast$ {\em buffer}, unsigned long long {\em num}, unsigned {\em width}, char {\em pad})}} \label{group__fmt_ga6cc0111bbf26bf10be7eba8823307ae} Format an unsigned long long integer as hexadecimal with padding. \hypertarget{group__fmt_g4f6d7ff7ce9d19a4332223241370f5c9}{ \index{fmt@{fmt}!fmt\_\-ullnumw@{fmt\_\-ullnumw}} \index{fmt\_\-ullnumw@{fmt\_\-ullnumw}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned fmt\_\-ullnumw (char $\ast$ {\em buffer}, unsigned long long {\em num}, unsigned {\em width}, char {\em pad}, unsigned {\em base}, const char $\ast$ {\em digits})}} \label{group__fmt_g4f6d7ff7ce9d19a4332223241370f5c9} Format an unsigned long long integer of arbitrary base with optional padding. \hypertarget{group__fmt_g21aed97705f1db6ab7cd56e95ccc2957}{ \index{fmt@{fmt}!fmt\_\-unumw@{fmt\_\-unumw}} \index{fmt\_\-unumw@{fmt\_\-unumw}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned fmt\_\-unumw (char $\ast$ {\em buffer}, unsigned long {\em num}, unsigned {\em width}, char {\em pad}, unsigned {\em base}, const char $\ast$ {\em digits})}} \label{group__fmt_g21aed97705f1db6ab7cd56e95ccc2957} Format an unsigned integer of arbitrary base with optional padding. \subsection{Variable Documentation} \hypertarget{group__fmt_g7147653a54c1ddfd3a1bdbdd96c1ea18}{ \index{fmt@{fmt}!fmt\_\-lcase\_\-digits@{fmt\_\-lcase\_\-digits}} \index{fmt\_\-lcase\_\-digits@{fmt\_\-lcase\_\-digits}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char {\bf fmt\_\-lcase\_\-digits}\mbox{[}36\mbox{]}}} \label{group__fmt_g7147653a54c1ddfd3a1bdbdd96c1ea18} Array of digits for lower-case conversions \hypertarget{group__fmt_ge7dc3d439e1a77e25abdf523e64f25f2}{ \index{fmt@{fmt}!fmt\_\-ucase\_\-digits@{fmt\_\-ucase\_\-digits}} \index{fmt\_\-ucase\_\-digits@{fmt\_\-ucase\_\-digits}!fmt@{fmt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char {\bf fmt\_\-ucase\_\-digits}\mbox{[}36\mbox{]}}} \label{group__fmt_ge7dc3d439e1a77e25abdf523e64f25f2} Array of digits for upper-case conversions bglibs-1.106/doc/latex/group__iobuf.tex0000664000076400007640000003024211147311327017414 0ustar bruceguenter\hypertarget{group__iobuf}{ \section{iobuf: I/O Buffer Management} \label{group__iobuf}\index{iobuf: I/O Buffer Management@{iobuf: I/O Buffer Management}} } \subsection*{Data Structures} \begin{CompactItemize} \item struct \hyperlink{structiobuf}{iobuf} \end{CompactItemize} \subsection*{Status Flags} \begin{CompactItemize} \item unsigned \hyperlink{group__iobuf_g2c854014f77658545278463b09758cd5}{iobuf\_\-bufsize} \item \#define \hyperlink{group__iobuf_ga9922524dac6fa4139c68411cb2dec8d}{IOBUF\_\-EOF}~1 \item \#define \hyperlink{group__iobuf_g7a539e207e174c527cf0a8dab7331bdb}{IOBUF\_\-ERROR}~2 \item \#define \hyperlink{group__iobuf_g4c4cf7dac5cc7cac920c53c919b54a55}{IOBUF\_\-TIMEOUT}~4 \item \#define \hyperlink{group__iobuf_gd7612c4c1636fb11daf6bd74ef302d52}{IOBUF\_\-BADFLAGS}~0xf \item \#define \hyperlink{group__iobuf_g724f6d12b6627f3813a762cd84c7bd28}{IOBUF\_\-SEEKABLE}~0x10 \item \#define \hyperlink{group__iobuf_g49715bfac7e883555379b6f23f4aa713}{IOBUF\_\-NEEDSCLOSE}~0x20 \item \#define \hyperlink{group__iobuf_gace66a8b07b3bb95258588d79854d489}{IOBUF\_\-NEEDSFREE}~0x40 \item \#define \hyperlink{group__iobuf_g189c4467a682c5d0d97e750f99a8a424}{IOBUF\_\-NEEDSMUNMAP}~0x80 \end{CompactItemize} \subsection*{Common} \begin{CompactItemize} \item \hypertarget{group__iobuf_g690c6cce9ede03409c28d27a2be73ba9}{ typedef struct \hyperlink{structiobuf}{iobuf} \textbf{iobuf}} \label{group__iobuf_g690c6cce9ede03409c28d27a2be73ba9} \item int \hyperlink{group__iobuf_g1f577ec79ef10d4ffa30b23981536ac8}{iobuf\_\-init} (\hyperlink{structiobuf}{iobuf} $\ast$io, int fd, unsigned bufsize, char $\ast$buffer, unsigned flags) \item int \hyperlink{group__iobuf_g02d1cff3c2911677d2ba3257f0c73259}{iobuf\_\-close} (\hyperlink{structiobuf}{iobuf} $\ast$io) \item int \hyperlink{group__iobuf_g92ccfacce7d0d0c03b3e7ea0d5e49c6b}{iobuf\_\-timeout} (\hyperlink{structiobuf}{iobuf} $\ast$io, int poll\_\-out) \item \#define \hyperlink{group__iobuf_gd8df365380fe10ef962692eb2123f061}{IOBUF\_\-SET\_\-ERROR}(io) \item \#define \hyperlink{group__iobuf_g8f5ac893f0d359136bfb72a96863a4a0}{iobuf\_\-closed}(io)~((io) $\rightarrow$ fd == -1) \item \#define \hyperlink{group__iobuf_g880c0546f9a201b0e2ba7d8f37e018ef}{iobuf\_\-error}(io)~((io) $\rightarrow$ flags \& IOBUF\_\-ERROR) \item \#define \hyperlink{group__iobuf_gd3c3c0e8bb56ad8405669ae0ee1fff01}{iobuf\_\-timedout}(io)~((io) $\rightarrow$ flags \& IOBUF\_\-TIMEOUT) \item \#define \hyperlink{group__iobuf_g9ff81d3db610c54cf21d19967bea5c3f}{iobuf\_\-bad}(io)~((io) $\rightarrow$ flags \& IOBUF\_\-BADFLAGS) \end{CompactItemize} \subsection*{Mass copying functions.} \begin{CompactItemize} \item int \hyperlink{group__iobuf_g2d8a3151c65892ca5146330f46dd9b3a}{iobuf\_\-copy} (\hyperlink{structibuf}{ibuf} $\ast$in, \hyperlink{structobuf}{obuf} $\ast$out) \item int \hyperlink{group__iobuf_g6434153f5f1fa56f26fcfa305a47d264}{iobuf\_\-copyflush} (\hyperlink{structibuf}{ibuf} $\ast$in, \hyperlink{structobuf}{obuf} $\ast$out) \item int \hyperlink{group__iobuf_g5e1d63bc6e2127fd5cd043caac078867}{ibuf\_\-copytofd} (\hyperlink{structibuf}{ibuf} $\ast$in, int out) \item int \hyperlink{group__iobuf_gf21d1424bd0e9de6f80d56070e45f1cc}{obuf\_\-copyfromfd} (int in, \hyperlink{structobuf}{obuf} $\ast$out) \end{CompactItemize} \subsection{Detailed Description} \begin{Desc} \item[Calling Convention]\end{Desc} Unless otherwise specified, the return value is non-zero (true) if the entire requested operation completed, and {\tt 0} (false) otherwise. \subsection{Define Documentation} \hypertarget{group__iobuf_g9ff81d3db610c54cf21d19967bea5c3f}{ \index{iobuf@{iobuf}!iobuf\_\-bad@{iobuf\_\-bad}} \index{iobuf\_\-bad@{iobuf\_\-bad}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define iobuf\_\-bad(io)~((io) $\rightarrow$ flags \& IOBUF\_\-BADFLAGS)}} \label{group__iobuf_g9ff81d3db610c54cf21d19967bea5c3f} True if the {\tt \hyperlink{structiobuf}{iobuf}} is in a \char`\"{}bad\char`\"{} state. \hypertarget{group__iobuf_gd7612c4c1636fb11daf6bd74ef302d52}{ \index{iobuf@{iobuf}!IOBUF\_\-BADFLAGS@{IOBUF\_\-BADFLAGS}} \index{IOBUF\_\-BADFLAGS@{IOBUF\_\-BADFLAGS}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define IOBUF\_\-BADFLAGS~0xf}} \label{group__iobuf_gd7612c4c1636fb11daf6bd74ef302d52} Mask of all the error type flags. \hypertarget{group__iobuf_g8f5ac893f0d359136bfb72a96863a4a0}{ \index{iobuf@{iobuf}!iobuf\_\-closed@{iobuf\_\-closed}} \index{iobuf\_\-closed@{iobuf\_\-closed}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define iobuf\_\-closed(io)~((io) $\rightarrow$ fd == -1)}} \label{group__iobuf_g8f5ac893f0d359136bfb72a96863a4a0} True if the {\tt \hyperlink{structiobuf}{iobuf}} has been closed. \hypertarget{group__iobuf_ga9922524dac6fa4139c68411cb2dec8d}{ \index{iobuf@{iobuf}!IOBUF\_\-EOF@{IOBUF\_\-EOF}} \index{IOBUF\_\-EOF@{IOBUF\_\-EOF}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define IOBUF\_\-EOF~1}} \label{group__iobuf_ga9922524dac6fa4139c68411cb2dec8d} Reading reached end of file. \hypertarget{group__iobuf_g880c0546f9a201b0e2ba7d8f37e018ef}{ \index{iobuf@{iobuf}!iobuf\_\-error@{iobuf\_\-error}} \index{iobuf\_\-error@{iobuf\_\-error}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define iobuf\_\-error(io)~((io) $\rightarrow$ flags \& IOBUF\_\-ERROR)}} \label{group__iobuf_g880c0546f9a201b0e2ba7d8f37e018ef} True if the {\tt \hyperlink{structiobuf}{iobuf}} has an error flag. \hypertarget{group__iobuf_g7a539e207e174c527cf0a8dab7331bdb}{ \index{iobuf@{iobuf}!IOBUF\_\-ERROR@{IOBUF\_\-ERROR}} \index{IOBUF\_\-ERROR@{IOBUF\_\-ERROR}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define IOBUF\_\-ERROR~2}} \label{group__iobuf_g7a539e207e174c527cf0a8dab7331bdb} The \hyperlink{structiobuf}{iobuf} has encountered an error. \hypertarget{group__iobuf_g49715bfac7e883555379b6f23f4aa713}{ \index{iobuf@{iobuf}!IOBUF\_\-NEEDSCLOSE@{IOBUF\_\-NEEDSCLOSE}} \index{IOBUF\_\-NEEDSCLOSE@{IOBUF\_\-NEEDSCLOSE}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define IOBUF\_\-NEEDSCLOSE~0x20}} \label{group__iobuf_g49715bfac7e883555379b6f23f4aa713} The file descriptor needs to be closed. \hypertarget{group__iobuf_gace66a8b07b3bb95258588d79854d489}{ \index{iobuf@{iobuf}!IOBUF\_\-NEEDSFREE@{IOBUF\_\-NEEDSFREE}} \index{IOBUF\_\-NEEDSFREE@{IOBUF\_\-NEEDSFREE}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define IOBUF\_\-NEEDSFREE~0x40}} \label{group__iobuf_gace66a8b07b3bb95258588d79854d489} The buffer needs to be deallocated with {\tt free} \hypertarget{group__iobuf_g189c4467a682c5d0d97e750f99a8a424}{ \index{iobuf@{iobuf}!IOBUF\_\-NEEDSMUNMAP@{IOBUF\_\-NEEDSMUNMAP}} \index{IOBUF\_\-NEEDSMUNMAP@{IOBUF\_\-NEEDSMUNMAP}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define IOBUF\_\-NEEDSMUNMAP~0x80}} \label{group__iobuf_g189c4467a682c5d0d97e750f99a8a424} The buffer needs to be deallocated with {\tt munmap} \hypertarget{group__iobuf_g724f6d12b6627f3813a762cd84c7bd28}{ \index{iobuf@{iobuf}!IOBUF\_\-SEEKABLE@{IOBUF\_\-SEEKABLE}} \index{IOBUF\_\-SEEKABLE@{IOBUF\_\-SEEKABLE}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define IOBUF\_\-SEEKABLE~0x10}} \label{group__iobuf_g724f6d12b6627f3813a762cd84c7bd28} {\tt lseek} is possible on the file descriptor. \hypertarget{group__iobuf_gd8df365380fe10ef962692eb2123f061}{ \index{iobuf@{iobuf}!IOBUF\_\-SET\_\-ERROR@{IOBUF\_\-SET\_\-ERROR}} \index{IOBUF\_\-SET\_\-ERROR@{IOBUF\_\-SET\_\-ERROR}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define IOBUF\_\-SET\_\-ERROR(io)}} \label{group__iobuf_gd8df365380fe10ef962692eb2123f061} \textbf{Value:} \begin{Code}\begin{verbatim}do{ \ io->flags |= IOBUF_ERROR; \ io->errnum = errno; \ return 0; \ }while(0) \end{verbatim} \end{Code} Set the error flag, save {\tt errno}, and return false. \hypertarget{group__iobuf_gd3c3c0e8bb56ad8405669ae0ee1fff01}{ \index{iobuf@{iobuf}!iobuf\_\-timedout@{iobuf\_\-timedout}} \index{iobuf\_\-timedout@{iobuf\_\-timedout}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define iobuf\_\-timedout(io)~((io) $\rightarrow$ flags \& IOBUF\_\-TIMEOUT)}} \label{group__iobuf_gd3c3c0e8bb56ad8405669ae0ee1fff01} True if the input or output to the {\tt \hyperlink{structiobuf}{iobuf}} previously timed out. \hypertarget{group__iobuf_g4c4cf7dac5cc7cac920c53c919b54a55}{ \index{iobuf@{iobuf}!IOBUF\_\-TIMEOUT@{IOBUF\_\-TIMEOUT}} \index{IOBUF\_\-TIMEOUT@{IOBUF\_\-TIMEOUT}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define IOBUF\_\-TIMEOUT~4}} \label{group__iobuf_g4c4cf7dac5cc7cac920c53c919b54a55} The timeout expired before the read or write could be completed. \subsection{Function Documentation} \hypertarget{group__iobuf_g5e1d63bc6e2127fd5cd043caac078867}{ \index{iobuf@{iobuf}!ibuf\_\-copytofd@{ibuf\_\-copytofd}} \index{ibuf\_\-copytofd@{ibuf\_\-copytofd}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ibuf\_\-copytofd ({\bf ibuf} $\ast$ {\em in}, int {\em out})}} \label{group__iobuf_g5e1d63bc6e2127fd5cd043caac078867} Copy all the data from an {\tt \hyperlink{structibuf}{ibuf}} to an output file descriptor. \hypertarget{group__iobuf_g02d1cff3c2911677d2ba3257f0c73259}{ \index{iobuf@{iobuf}!iobuf\_\-close@{iobuf\_\-close}} \index{iobuf\_\-close@{iobuf\_\-close}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int iobuf\_\-close ({\bf iobuf} $\ast$ {\em io})}} \label{group__iobuf_g02d1cff3c2911677d2ba3257f0c73259} Close an {\tt \hyperlink{structiobuf}{iobuf}} and deallocate the buffer. \hypertarget{group__iobuf_g2d8a3151c65892ca5146330f46dd9b3a}{ \index{iobuf@{iobuf}!iobuf\_\-copy@{iobuf\_\-copy}} \index{iobuf\_\-copy@{iobuf\_\-copy}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int iobuf\_\-copy ({\bf ibuf} $\ast$ {\em in}, {\bf obuf} $\ast$ {\em out})}} \label{group__iobuf_g2d8a3151c65892ca5146330f46dd9b3a} Copy all the data from an {\tt \hyperlink{structibuf}{ibuf}} to an {\tt \hyperlink{structobuf}{obuf}}. \hypertarget{group__iobuf_g6434153f5f1fa56f26fcfa305a47d264}{ \index{iobuf@{iobuf}!iobuf\_\-copyflush@{iobuf\_\-copyflush}} \index{iobuf\_\-copyflush@{iobuf\_\-copyflush}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int iobuf\_\-copyflush ({\bf ibuf} $\ast$ {\em in}, {\bf obuf} $\ast$ {\em out})}} \label{group__iobuf_g6434153f5f1fa56f26fcfa305a47d264} Copy all the data from an {\tt \hyperlink{structibuf}{ibuf}} to an {\tt \hyperlink{structobuf}{obuf}}, and flush the {\tt \hyperlink{structobuf}{obuf}} after writing is completed. \hypertarget{group__iobuf_g1f577ec79ef10d4ffa30b23981536ac8}{ \index{iobuf@{iobuf}!iobuf\_\-init@{iobuf\_\-init}} \index{iobuf\_\-init@{iobuf\_\-init}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int iobuf\_\-init ({\bf iobuf} $\ast$ {\em io}, int {\em fd}, unsigned {\em bufsize}, char $\ast$ {\em buffer}, unsigned {\em flags})}} \label{group__iobuf_g1f577ec79ef10d4ffa30b23981536ac8} Initialize an {\tt \hyperlink{structiobuf}{iobuf}} structure. \hypertarget{group__iobuf_g92ccfacce7d0d0c03b3e7ea0d5e49c6b}{ \index{iobuf@{iobuf}!iobuf\_\-timeout@{iobuf\_\-timeout}} \index{iobuf\_\-timeout@{iobuf\_\-timeout}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int iobuf\_\-timeout ({\bf iobuf} $\ast$ {\em io}, int {\em poll\_\-out})}} \label{group__iobuf_g92ccfacce7d0d0c03b3e7ea0d5e49c6b} Wait for a file descriptor to be ready for reading or writing. \hypertarget{group__iobuf_gf21d1424bd0e9de6f80d56070e45f1cc}{ \index{iobuf@{iobuf}!obuf\_\-copyfromfd@{obuf\_\-copyfromfd}} \index{obuf\_\-copyfromfd@{obuf\_\-copyfromfd}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-copyfromfd (int {\em in}, {\bf obuf} $\ast$ {\em out})}} \label{group__iobuf_gf21d1424bd0e9de6f80d56070e45f1cc} Copy all the data from an input file descriptor to an {\tt \hyperlink{structobuf}{obuf}}. \subsection{Variable Documentation} \hypertarget{group__iobuf_g2c854014f77658545278463b09758cd5}{ \index{iobuf@{iobuf}!iobuf\_\-bufsize@{iobuf\_\-bufsize}} \index{iobuf\_\-bufsize@{iobuf\_\-bufsize}!iobuf@{iobuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned {\bf iobuf\_\-bufsize}}} \label{group__iobuf_g2c854014f77658545278463b09758cd5} The default \hyperlink{structiobuf}{iobuf} buffer size, defaults to 8192. bglibs-1.106/doc/latex/deprecated.tex0000664000076400007640000000051311147311327017033 0ustar bruceguenter\hypertarget{deprecated}{}\section{Deprecated List }\label{deprecated} \label{deprecated__deprecated000001} \hypertarget{deprecated__deprecated000001}{} \begin{description} \item[Global \hyperlink{group__ipv4_g970fa2560edacb238d78e599bb1729f7}{ipv4\_\-parse} ]This function is a wrapper for {\tt ipv4\_\-scan}. \end{description} bglibs-1.106/doc/latex/structobuf.tex0000664000076400007640000000420711147311327017137 0ustar bruceguenter\hypertarget{structobuf}{ \section{obuf Struct Reference} \label{structobuf}\index{obuf@{obuf}} } {\tt \#include $<$obuf.h$>$} \subsection*{Data Fields} \begin{CompactItemize} \item \hyperlink{structiobuf}{iobuf} \hyperlink{structobuf_7e0bc26697eb0b1a5c0c80378b4d9259}{io} \item unsigned \hyperlink{structobuf_26c5351c5726dc878076246ef0e2db95}{bufpos} \item unsigned \hyperlink{structobuf_5bfa6e170a7e1a6f7a8eed3b3f8863b9}{count} \item \hyperlink{group__obuf_ga39dfad0e8745cdcb31ffe6353758c48}{obuf\_\-fn} \hyperlink{structobuf_71b46e06b992a73757e04170ae32a036}{writefn} \end{CompactItemize} \subsection{Detailed Description} Output specific buffer. \subsection{Field Documentation} \hypertarget{structobuf_7e0bc26697eb0b1a5c0c80378b4d9259}{ \index{obuf@{obuf}!io@{io}} \index{io@{io}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf iobuf} {\bf obuf::io}}} \label{structobuf_7e0bc26697eb0b1a5c0c80378b4d9259} Base {\tt \hyperlink{structiobuf}{iobuf}} structure. \hypertarget{structobuf_26c5351c5726dc878076246ef0e2db95}{ \index{obuf@{obuf}!bufpos@{bufpos}} \index{bufpos@{bufpos}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned {\bf obuf::bufpos}}} \label{structobuf_26c5351c5726dc878076246ef0e2db95} Current write position within the buffer. \hypertarget{structobuf_5bfa6e170a7e1a6f7a8eed3b3f8863b9}{ \index{obuf@{obuf}!count@{count}} \index{count@{count}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned {\bf obuf::count}}} \label{structobuf_5bfa6e170a7e1a6f7a8eed3b3f8863b9} The number of bytes written in the last operation. \begin{Desc} \item[Examples: ]\par \hyperlink{adt_2ghash__test_8c-example}{adt/ghash\_\-test.c}.\end{Desc} \hypertarget{structobuf_71b46e06b992a73757e04170ae32a036}{ \index{obuf@{obuf}!writefn@{writefn}} \index{writefn@{writefn}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf obuf\_\-fn} {\bf obuf::writefn}}} \label{structobuf_71b46e06b992a73757e04170ae32a036} Function used to write data to the file descriptor. The documentation for this struct was generated from the following file:\begin{CompactItemize} \item obuf.h\end{CompactItemize} bglibs-1.106/doc/latex/group__selfpipe.tex0000664000076400007640000000516611147311327020126 0ustar bruceguenter\hypertarget{group__selfpipe}{ \section{selfpipe: Safe child exit management.} \label{group__selfpipe}\index{selfpipe: Safe child exit management.@{selfpipe: Safe child exit management.}} } \subsection*{Functions} \begin{CompactItemize} \item int \hyperlink{group__selfpipe_gc4db7cc1f56335163a95ce02ebe7303a}{selfpipe\_\-init} (void) \item void \hyperlink{group__selfpipe_gb1d668ed406e732dec94a07369ca3934}{selfpipe\_\-close} (void) \item void \hyperlink{group__selfpipe_g7b26bb58c5dca4e851f1ad4426f6a66d}{selfpipe\_\-catch\_\-signal} (int) \end{CompactItemize} \subsection{Function Documentation} \hypertarget{group__selfpipe_g7b26bb58c5dca4e851f1ad4426f6a66d}{ \index{selfpipe@{selfpipe}!selfpipe\_\-catch\_\-signal@{selfpipe\_\-catch\_\-signal}} \index{selfpipe\_\-catch\_\-signal@{selfpipe\_\-catch\_\-signal}!selfpipe@{selfpipe}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void selfpipe\_\-catch\_\-signal (int {\em signal})}} \label{group__selfpipe_g7b26bb58c5dca4e851f1ad4426f6a66d} Catch a signal and write it to the self-pipe. This routine can be used with sig\_\-$\ast$\_\-catch() to send other signals through the self-pipe. \hypertarget{group__selfpipe_gb1d668ed406e732dec94a07369ca3934}{ \index{selfpipe@{selfpipe}!selfpipe\_\-close@{selfpipe\_\-close}} \index{selfpipe\_\-close@{selfpipe\_\-close}!selfpipe@{selfpipe}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void selfpipe\_\-close (void)}} \label{group__selfpipe_gb1d668ed406e732dec94a07369ca3934} Shut down the self-pipe. \hypertarget{group__selfpipe_gc4db7cc1f56335163a95ce02ebe7303a}{ \index{selfpipe@{selfpipe}!selfpipe\_\-init@{selfpipe\_\-init}} \index{selfpipe\_\-init@{selfpipe\_\-init}!selfpipe@{selfpipe}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int selfpipe\_\-init (void)}} \label{group__selfpipe_gc4db7cc1f56335163a95ce02ebe7303a} Set up a self-pipe for catching child exit events. This function opens up a pipe within the program used to safely handle exiting child processes. Every time a child exits, a single byte is written to the pipe. The resulting file descriptor is statically assigned, so do not call this function more than once within a single program. The file descriptor is set to non-blocking mode to prevent blocking when reading from it. To use the file descriptor, use either {\tt poll} or {\tt select} to determine when it is readable. When it becomes readable, read the data written to it (and throw it away), and use {\tt wait} or equivalent to catch the {\tt exit} value from the child process(es). \begin{Desc} \item[Returns:]-1 if an error occurred, otherwise the return value is the file descriptor opened for reading. \end{Desc} bglibs-1.106/doc/latex/group__crypto.tex0000664000076400007640000001027411147311327017633 0ustar bruceguenter\hypertarget{group__crypto}{ \section{crypto: Cryptographic routines} \label{group__crypto}\index{crypto: Cryptographic routines@{crypto: Cryptographic routines}} } \subsection*{Defines} \begin{CompactItemize} \item \#define \hyperlink{group__crypto_g56e01db1767174c4359ae51c7b77739c}{SURF\_\-OUT\_\-U32}~8 \item \#define \hyperlink{group__crypto_g80bb1afcac12078eb93f38a507e28196}{SURF\_\-IN\_\-U32}~12 \item \#define \hyperlink{group__crypto_gb557630b9a4844d6b0323def2be8e45c}{SURF\_\-SEED\_\-U32}~32 \item \#define \hyperlink{group__crypto_gda3fd98f7f26a8c20d926da44dfbc1c4}{SURF\_\-OUT}~32 \item \#define \hyperlink{group__crypto_g9d68135a00f183d21702742b22f96b5e}{SURF\_\-IN}~48 \item \#define \hyperlink{group__crypto_g64048d6cfc3aa02d819c0f43290fe202}{SURF\_\-SEED}~128 \end{CompactItemize} \subsection*{Functions} \begin{CompactItemize} \item void \hyperlink{group__crypto_gcf891244c9dc004ef62b51eadedf48d6}{surf} (uint32 out\mbox{[}8\mbox{]}, const uint32 in\mbox{[}12\mbox{]}, const uint32 seed\mbox{[}32\mbox{]}) \end{CompactItemize} \subsection{Define Documentation} \hypertarget{group__crypto_g9d68135a00f183d21702742b22f96b5e}{ \index{crypto@{crypto}!SURF\_\-IN@{SURF\_\-IN}} \index{SURF\_\-IN@{SURF\_\-IN}!crypto@{crypto}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define SURF\_\-IN~48}} \label{group__crypto_g9d68135a00f183d21702742b22f96b5e} The number of bytes used as input by surf \hypertarget{group__crypto_g80bb1afcac12078eb93f38a507e28196}{ \index{crypto@{crypto}!SURF\_\-IN\_\-U32@{SURF\_\-IN\_\-U32}} \index{SURF\_\-IN\_\-U32@{SURF\_\-IN\_\-U32}!crypto@{crypto}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define SURF\_\-IN\_\-U32~12}} \label{group__crypto_g80bb1afcac12078eb93f38a507e28196} The number of 32-bit words used as input by surf \hypertarget{group__crypto_gda3fd98f7f26a8c20d926da44dfbc1c4}{ \index{crypto@{crypto}!SURF\_\-OUT@{SURF\_\-OUT}} \index{SURF\_\-OUT@{SURF\_\-OUT}!crypto@{crypto}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define SURF\_\-OUT~32}} \label{group__crypto_gda3fd98f7f26a8c20d926da44dfbc1c4} The number of bytes output by surf \hypertarget{group__crypto_g56e01db1767174c4359ae51c7b77739c}{ \index{crypto@{crypto}!SURF\_\-OUT\_\-U32@{SURF\_\-OUT\_\-U32}} \index{SURF\_\-OUT\_\-U32@{SURF\_\-OUT\_\-U32}!crypto@{crypto}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define SURF\_\-OUT\_\-U32~8}} \label{group__crypto_g56e01db1767174c4359ae51c7b77739c} The number of 32-bit words output by surf \hypertarget{group__crypto_g64048d6cfc3aa02d819c0f43290fe202}{ \index{crypto@{crypto}!SURF\_\-SEED@{SURF\_\-SEED}} \index{SURF\_\-SEED@{SURF\_\-SEED}!crypto@{crypto}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define SURF\_\-SEED~128}} \label{group__crypto_g64048d6cfc3aa02d819c0f43290fe202} The number of bytes used as seed data by surf \hypertarget{group__crypto_gb557630b9a4844d6b0323def2be8e45c}{ \index{crypto@{crypto}!SURF\_\-SEED\_\-U32@{SURF\_\-SEED\_\-U32}} \index{SURF\_\-SEED\_\-U32@{SURF\_\-SEED\_\-U32}!crypto@{crypto}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define SURF\_\-SEED\_\-U32~32}} \label{group__crypto_gb557630b9a4844d6b0323def2be8e45c} The number of 32-bit words used as seed data by surf \subsection{Function Documentation} \hypertarget{group__crypto_gcf891244c9dc004ef62b51eadedf48d6}{ \index{crypto@{crypto}!surf@{surf}} \index{surf@{surf}!crypto@{crypto}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void surf (uint32 {\em out}\mbox{[}8\mbox{]}, const uint32 {\em in}\mbox{[}12\mbox{]}, const uint32 {\em seed}\mbox{[}32\mbox{]})}} \label{group__crypto_gcf891244c9dc004ef62b51eadedf48d6} 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 \href{http://cr.yp.to/papers/surf.ps}{\tt http://cr.yp.to/papers/surf.ps} This implementation was derived from this paper and from \hyperlink{group__instlib_g13082ea1fd1c182bb722b84a62f7dfbe}{dns\_\-random.c} from djbdns-1.05, which was made public domain as per \href{http://cr.yp.to/distributors.html}{\tt http://cr.yp.to/distributors.html} on 2007-12-28. bglibs-1.106/doc/latex/group__envstr.tex0000664000076400007640000001417511147311327017640 0ustar bruceguenter\hypertarget{group__envstr}{ \section{envstr: Environment variables in a str.} \label{group__envstr}\index{envstr: Environment variables in a str.@{envstr: Environment variables in a str.}} } \subsection*{Functions} \begin{CompactItemize} \item const char $\ast$ \hyperlink{group__envstr_g84cbf1d8cde4ec649b75eb81104279ea}{envstr\_\-find} (const struct \hyperlink{structstr}{str} $\ast$env, const char $\ast$var, long varlen) \item const char $\ast$ \hyperlink{group__envstr_g492560b180478b56cd21bd8ba575b2f4}{envstr\_\-get} (const struct \hyperlink{structstr}{str} $\ast$env, const char $\ast$var) \item int \hyperlink{group__envstr_g555d75c4667f80b5a92df9eab32cbe5a}{envstr\_\-set} (struct \hyperlink{structstr}{str} $\ast$env, const char $\ast$var, const char $\ast$val, int overwrite) \item void \hyperlink{group__envstr_gc01247f87c994910acfaa32b67f78a13}{envstr\_\-unset} (struct \hyperlink{structstr}{str} $\ast$env, const char $\ast$var) \item int \hyperlink{group__envstr_gc805aa4431ebdb4bf588bd9809494c5b}{envstr\_\-put} (struct \hyperlink{structstr}{str} $\ast$env, const char $\ast$asgn, int overwrite) \item int \hyperlink{group__envstr_g534e89d64679f5a75cab6aa987952719}{envstr\_\-from\_\-array} (struct \hyperlink{structstr}{str} $\ast$env, char $\ast$$\ast$array, int overwrite) \item int \hyperlink{group__envstr_g54ce162466679a29cadf5c4e20e2df01}{envstr\_\-from\_\-string} (struct \hyperlink{structstr}{str} $\ast$env, const char $\ast$s, int overwrite) \item char $\ast$$\ast$ \hyperlink{group__envstr_gd725f553159f1c37bd3994d9f0e845f1}{envstr\_\-make\_\-array} (const struct \hyperlink{structstr}{str} $\ast$env) \end{CompactItemize} \subsection{Detailed Description} \begin{Desc} \item[Calling Convention]\end{Desc} All functions that allocate memory return {\tt 0} (false) if the function failed due to being unable to allocate memory, and non-zero (true) otherwise. \subsection{Function Documentation} \hypertarget{group__envstr_g84cbf1d8cde4ec649b75eb81104279ea}{ \index{envstr@{envstr}!envstr\_\-find@{envstr\_\-find}} \index{envstr\_\-find@{envstr\_\-find}!envstr@{envstr}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ envstr\_\-find (const struct {\bf str} $\ast$ {\em env}, const char $\ast$ {\em var}, long {\em len})}} \label{group__envstr_g84cbf1d8cde4ec649b75eb81104279ea} Find the named variable in the environment string. \begin{Desc} \item[Returns:]a pointer to the {\bf start} of the assignment. \end{Desc} \hypertarget{group__envstr_g534e89d64679f5a75cab6aa987952719}{ \index{envstr@{envstr}!envstr\_\-from\_\-array@{envstr\_\-from\_\-array}} \index{envstr\_\-from\_\-array@{envstr\_\-from\_\-array}!envstr@{envstr}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int envstr\_\-from\_\-array (struct {\bf str} $\ast$ {\em env}, char $\ast$$\ast$ {\em array}, int {\em overwrite})}} \label{group__envstr_g534e89d64679f5a75cab6aa987952719} Adds the assignments from the array of pointers to the environment string. The array must be terminated by a {\tt NULL} pointer, just the same as the standard {\tt environ} array. \hypertarget{group__envstr_g54ce162466679a29cadf5c4e20e2df01}{ \index{envstr@{envstr}!envstr\_\-from\_\-string@{envstr\_\-from\_\-string}} \index{envstr\_\-from\_\-string@{envstr\_\-from\_\-string}!envstr@{envstr}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int envstr\_\-from\_\-string (struct {\bf str} $\ast$ {\em env}, const char $\ast$ {\em s}, int {\em overwrite})}} \label{group__envstr_g54ce162466679a29cadf5c4e20e2df01} Adds the string-based list of assignments to the environment string. Each individual assignment in the list must be ASCII NUL terminated, and the final assignment must be followed by two ASCII NULs. \hypertarget{group__envstr_g492560b180478b56cd21bd8ba575b2f4}{ \index{envstr@{envstr}!envstr\_\-get@{envstr\_\-get}} \index{envstr\_\-get@{envstr\_\-get}!envstr@{envstr}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ envstr\_\-get (const struct {\bf str} $\ast$ {\em env}, const char $\ast$ {\em var})}} \label{group__envstr_g492560b180478b56cd21bd8ba575b2f4} Get the value of an assignment from an environment string. \hypertarget{group__envstr_gd725f553159f1c37bd3994d9f0e845f1}{ \index{envstr@{envstr}!envstr\_\-make\_\-array@{envstr\_\-make\_\-array}} \index{envstr\_\-make\_\-array@{envstr\_\-make\_\-array}!envstr@{envstr}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$$\ast$ envstr\_\-make\_\-array (const struct {\bf str} $\ast$ {\em env})}} \label{group__envstr_gd725f553159f1c37bd3994d9f0e845f1} Make a {\tt environ} compatable array of pointers to the environment string. \begin{Desc} \item[Note:]The returned pointer is dynamically allocated, and must be freed. \end{Desc} \hypertarget{group__envstr_gc805aa4431ebdb4bf588bd9809494c5b}{ \index{envstr@{envstr}!envstr\_\-put@{envstr\_\-put}} \index{envstr\_\-put@{envstr\_\-put}!envstr@{envstr}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int envstr\_\-put (struct {\bf str} $\ast$ {\em env}, const char $\ast$ {\em asgn}, int {\em overwrite})}} \label{group__envstr_gc805aa4431ebdb4bf588bd9809494c5b} Put an assignment, in {\tt NAME=value} format, into the environment string. \begin{Desc} \item[Note:]Unlike putenv, a copy of the assignment is made instead of keeping a copy of the given pointer. \end{Desc} \hypertarget{group__envstr_g555d75c4667f80b5a92df9eab32cbe5a}{ \index{envstr@{envstr}!envstr\_\-set@{envstr\_\-set}} \index{envstr\_\-set@{envstr\_\-set}!envstr@{envstr}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int envstr\_\-set (struct {\bf str} $\ast$ {\em env}, const char $\ast$ {\em var}, const char $\ast$ {\em val}, int {\em overwrite})}} \label{group__envstr_g555d75c4667f80b5a92df9eab32cbe5a} Set the named variable to the given value in the environment string. \hypertarget{group__envstr_gc01247f87c994910acfaa32b67f78a13}{ \index{envstr@{envstr}!envstr\_\-unset@{envstr\_\-unset}} \index{envstr\_\-unset@{envstr\_\-unset}!envstr@{envstr}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void envstr\_\-unset (struct {\bf str} $\ast$ {\em env}, const char $\ast$ {\em var})}} \label{group__envstr_gc01247f87c994910acfaa32b67f78a13} Unset the named variable in the environment string. bglibs-1.106/doc/latex/group__instlib.tex0000664000076400007640000001245111147311327017756 0ustar bruceguenter\hypertarget{group__instlib}{ \section{instlib: Installation program generation} \label{group__instlib}\index{instlib: Installation program generation@{instlib: Installation program generation}} } \subsection*{Functions} \begin{CompactItemize} \item int \hyperlink{group__instlib_g35385692dd2b6117364b408be6e1a9ac}{opendir} (const char $\ast$dir) \item int \hyperlink{group__instlib_g3fc82592e1d0a5ddc7bdca095ad0b7e2}{opensubdir} (int dir, const char $\ast$subdir) \item int \hyperlink{group__instlib_g499d97e4291fd8e79e5164dafb2770cc}{d} (int dir, const char $\ast$subdir, unsigned uid, unsigned gid, unsigned mode) \item void \hyperlink{group__instlib_g107f416f0e46995c55caf97d05ee7d4a}{cf} (int dir, const char $\ast$file, unsigned uid, unsigned gid, unsigned mode, const char $\ast$srcfile) \item void \hyperlink{group__instlib_g13082ea1fd1c182bb722b84a62f7dfbe}{c} (int dir, const char $\ast$file, unsigned uid, unsigned gid, unsigned mode) \item void \hyperlink{group__instlib_g346f8f89a44bdef281c2bf180d9fee4f}{s} (int dir, const char $\ast$file, const char $\ast$target) \item void \hyperlink{group__instlib_g8c75d0affb18233f98f81133c0a70e04}{insthier} (void) \end{CompactItemize} \subsection*{Variables} \begin{CompactItemize} \item const char $\ast$ \hyperlink{group__instlib_g0bda4e008d03f06c67ad84106059106f}{install\_\-prefix} \end{CompactItemize} \subsection{Detailed Description} The installer libraries provide for building a program to install files, to verify (check) an installation, and to show what would be installed, from a single source. This single source is typically called {\tt \hyperlink{group__instlib_g13082ea1fd1c182bb722b84a62f7dfbe}{insthier.c}} and contains a single routine also named {\tt insthier} (so-named as it provides the installation hierarchy). The libraries provide the {\tt main} function that calls {\tt insthier} as well as all the necessary support functions. Where given, {\tt uid} and {\tt gid} may be set to {\tt -1} if there is no need to force the installed UID and GID to a particular value. The {\tt dir} argument is a directory number previously opened by {\tt opendir}. \subsection{Function Documentation} \hypertarget{group__instlib_g13082ea1fd1c182bb722b84a62f7dfbe}{ \index{instlib@{instlib}!c@{c}} \index{c@{c}!instlib@{instlib}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void c (int {\em dir}, const char $\ast$ {\em file}, unsigned {\em uid}, unsigned {\em gid}, unsigned {\em mode})}} \label{group__instlib_g13082ea1fd1c182bb722b84a62f7dfbe} Copy a file from the source directory, retaining its name. \hypertarget{group__instlib_g107f416f0e46995c55caf97d05ee7d4a}{ \index{instlib@{instlib}!cf@{cf}} \index{cf@{cf}!instlib@{instlib}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void cf (int {\em dir}, const char $\ast$ {\em file}, unsigned {\em uid}, unsigned {\em gid}, unsigned {\em mode}, const char $\ast$ {\em srcfile})}} \label{group__instlib_g107f416f0e46995c55caf97d05ee7d4a} Copy a file from the source directory to a different name. \hypertarget{group__instlib_g499d97e4291fd8e79e5164dafb2770cc}{ \index{instlib@{instlib}!d@{d}} \index{d@{d}!instlib@{instlib}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int d (int {\em dir}, const char $\ast$ {\em subdir}, unsigned {\em uid}, unsigned {\em gid}, unsigned {\em mode})}} \label{group__instlib_g499d97e4291fd8e79e5164dafb2770cc} Create a subdirectory. \hypertarget{group__instlib_g8c75d0affb18233f98f81133c0a70e04}{ \index{instlib@{instlib}!insthier@{insthier}} \index{insthier@{insthier}!instlib@{instlib}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void insthier (void)}} \label{group__instlib_g8c75d0affb18233f98f81133c0a70e04} The single function that the {\tt \hyperlink{group__instlib_g13082ea1fd1c182bb722b84a62f7dfbe}{insthier.c}} source needs to define. \hypertarget{group__instlib_g35385692dd2b6117364b408be6e1a9ac}{ \index{instlib@{instlib}!opendir@{opendir}} \index{opendir@{opendir}!instlib@{instlib}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int opendir (const char $\ast$ {\em dir})}} \label{group__instlib_g35385692dd2b6117364b408be6e1a9ac} Open a directory and provide a file handle reference for future operations. \hypertarget{group__instlib_g3fc82592e1d0a5ddc7bdca095ad0b7e2}{ \index{instlib@{instlib}!opensubdir@{opensubdir}} \index{opensubdir@{opensubdir}!instlib@{instlib}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int opensubdir (int {\em dir}, const char $\ast$ {\em subdir})}} \label{group__instlib_g3fc82592e1d0a5ddc7bdca095ad0b7e2} Open a subdirectory of a directory already opened by {\tt opendir}. \hypertarget{group__instlib_g346f8f89a44bdef281c2bf180d9fee4f}{ \index{instlib@{instlib}!s@{s}} \index{s@{s}!instlib@{instlib}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void s (int {\em dir}, const char $\ast$ {\em file}, const char $\ast$ {\em target})}} \label{group__instlib_g346f8f89a44bdef281c2bf180d9fee4f} Create a symbolic link. \subsection{Variable Documentation} \hypertarget{group__instlib_g0bda4e008d03f06c67ad84106059106f}{ \index{instlib@{instlib}!install\_\-prefix@{install\_\-prefix}} \index{install\_\-prefix@{install\_\-prefix}!instlib@{instlib}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ {\bf install\_\-prefix}}} \label{group__instlib_g0bda4e008d03f06c67ad84106059106f} The directory prefix under which all files are placed. bglibs-1.106/doc/latex/structgqueue__node.tex0000664000076400007640000000275511147311327020651 0ustar bruceguenter\hypertarget{structgqueue__node}{ \section{gqueue\_\-node Struct Reference} \label{structgqueue__node}\index{gqueue\_\-node@{gqueue\_\-node}} } {\tt \#include $<$gqueue.h$>$} \subsection*{Data Fields} \begin{CompactItemize} \item struct \hyperlink{structgqueue__node}{gqueue\_\-node} $\ast$ \hyperlink{structgqueue__node_0ec78b4127080d03ec4cf0fe475ad694}{next} \item char \hyperlink{structgqueue__node_41f491a2676949c12df7fceadadfa3e6}{data} \mbox{[}0\mbox{]} \end{CompactItemize} \subsection{Detailed Description} Generic queue node. \subsection{Field Documentation} \hypertarget{structgqueue__node_0ec78b4127080d03ec4cf0fe475ad694}{ \index{gqueue\_\-node@{gqueue\_\-node}!next@{next}} \index{next@{next}!gqueue_node@{gqueue\_\-node}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf gqueue\_\-node}$\ast$ {\bf gqueue\_\-node::next}\hspace{0.3cm}{\tt \mbox{[}read\mbox{]}}}} \label{structgqueue__node_0ec78b4127080d03ec4cf0fe475ad694} Pointer to the next element in the queue linked list. \hypertarget{structgqueue__node_41f491a2676949c12df7fceadadfa3e6}{ \index{gqueue\_\-node@{gqueue\_\-node}!data@{data}} \index{data@{data}!gqueue_node@{gqueue\_\-node}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}char {\bf gqueue\_\-node::data}\mbox{[}0\mbox{]}}} \label{structgqueue__node_41f491a2676949c12df7fceadadfa3e6} The data contained in the queue node. The documentation for this struct was generated from the following file:\begin{CompactItemize} \item gqueue.h\end{CompactItemize} bglibs-1.106/doc/latex/group__trigger.tex0000664000076400007640000000637311147311327017763 0ustar bruceguenter\hypertarget{group__trigger}{ \section{trigger: Safe external event notification} \label{group__trigger}\index{trigger: Safe external event notification@{trigger: Safe external event notification}} } \subsection*{Defines} \begin{CompactItemize} \item \#define \hyperlink{group__trigger_g7d26b2b96773d6691536c3a38e17be88}{trigger\_\-pulled}(IO)~((IO) $\rightarrow$ revents) \end{CompactItemize} \subsection*{Functions} \begin{CompactItemize} \item int \hyperlink{group__trigger_gb7afaf88cd57889a717c1b3437a82114}{trigger\_\-set} (iopoll\_\-fd $\ast$io, const char $\ast$path) \item void \hyperlink{group__trigger_g082e2543c9bc7d2da426d8b2040651ca}{trigger\_\-pull} (const char $\ast$path) \end{CompactItemize} \subsection{Detailed Description} The {\tt 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. \subsection{Define Documentation} \hypertarget{group__trigger_g7d26b2b96773d6691536c3a38e17be88}{ \index{trigger@{trigger}!trigger\_\-pulled@{trigger\_\-pulled}} \index{trigger\_\-pulled@{trigger\_\-pulled}!trigger@{trigger}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define trigger\_\-pulled(IO)~((IO) $\rightarrow$ revents)}} \label{group__trigger_g7d26b2b96773d6691536c3a38e17be88} Determine if a trigger has been pulled, after a polling loop indicates activity. \subsection{Function Documentation} \hypertarget{group__trigger_g082e2543c9bc7d2da426d8b2040651ca}{ \index{trigger@{trigger}!trigger\_\-pull@{trigger\_\-pull}} \index{trigger\_\-pull@{trigger\_\-pull}!trigger@{trigger}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void trigger\_\-pull (const char $\ast$ {\em path})}} \label{group__trigger_g082e2543c9bc7d2da426d8b2040651ca} Activate a trigger. \hypertarget{group__trigger_gb7afaf88cd57889a717c1b3437a82114}{ \index{trigger@{trigger}!trigger\_\-set@{trigger\_\-set}} \index{trigger\_\-set@{trigger\_\-set}!trigger@{trigger}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int trigger\_\-set (iopoll\_\-fd $\ast$ {\em io}, const char $\ast$ {\em path})}} \label{group__trigger_gb7afaf88cd57889a717c1b3437a82114} Set up a trigger for polling. The passed {\tt iopoll\_\-fd} must have at least two slots, as the second slot may be required in the event the OS exhibits the \char`\"{}named pipe bug\char`\"{}. This function must be called every time the trigger is pulled to reset the trigger's state. bglibs-1.106/doc/latex/dir_b467e31085870d6887ee57c7b172ec7c.tex0000664000076400007640000000472511147311327022050 0ustar bruceguenter\hypertarget{dir_b467e31085870d6887ee57c7b172ec7c}{ \section{str/ Directory Reference} \label{dir_b467e31085870d6887ee57c7b172ec7c}\index{str/ Directory Reference@{str/ Directory Reference}} } \subsection*{Files} \begin{CompactItemize} \item file \textbf{alloc.c} \item file \textbf{buildmap.c} \item file \textbf{case\_\-glob.c} \item file \textbf{case\_\-match.c} \item file \textbf{case\_\-start.c} \item file \textbf{cat.c} \item file \textbf{cat2s.c} \item file \textbf{cat3s.c} \item file \textbf{cat4s.c} \item file \textbf{cat5s.c} \item file \textbf{cat6s.c} \item file \textbf{catf.c} \item file \textbf{catiw.c} \item file \textbf{catiwll.c} \item file \textbf{catns.c} \item file \textbf{catsllnum.c} \item file \textbf{catsnum.c} \item file \textbf{catullnum.c} \item file \textbf{catunum.c} \item file \textbf{catuw.c} \item file \textbf{catuwll.c} \item file \textbf{catxw.c} \item file \textbf{catxwll.c} \item file \textbf{cmp.c} \item file \textbf{copy.c} \item file \textbf{copy2s.c} \item file \textbf{copy3s.c} \item file \textbf{copy4s.c} \item file \textbf{copy5s.c} \item file \textbf{copy6s.c} \item file \textbf{copyf.c} \item file \textbf{copyns.c} \item file \textbf{count.c} \item file \textbf{countof.c} \item file \textbf{cut.c} \item file \textbf{diff.c} \item file \textbf{digits.c} \item file \textbf{env.h} \item file \textbf{env\_\-find.c} \item file \textbf{env\_\-from\_\-array.c} \item file \textbf{env\_\-from\_\-string.c} \item file \textbf{env\_\-get.c} \item file \textbf{env\_\-make\_\-array.c} \item file \textbf{env\_\-put.c} \item file \textbf{env\_\-set.c} \item file \textbf{env\_\-unset.c} \item file \textbf{findnext.c} \item file \textbf{findnextnot.c} \item file \textbf{findnextof.c} \item file \textbf{findprev.c} \item file \textbf{findprevnot.c} \item file \textbf{findprevof.c} \item file \textbf{free.c} \item file \textbf{glob.c} \item file \textbf{init.c} \item file \textbf{iter.h} \item file \textbf{iter\_\-advance.c} \item file \textbf{iter\_\-start.c} \item file \textbf{iter\_\-valid.c} \item file \textbf{join.c} \item file \textbf{lower.c} \item file \textbf{lstrip.c} \item file \textbf{str/match.c} \item file \textbf{rstrip.c} \item file \textbf{sort.c} \item file \textbf{splice.c} \item file \textbf{start.c} \item file \textbf{str.h} \item file \textbf{subst.c} \item file \textbf{truncate.c} \item file \textbf{upper.c} \item file \textbf{xlate.c} \end{CompactItemize} bglibs-1.106/doc/latex/group__signalfd.tex0000664000076400007640000000617311147311327020105 0ustar bruceguenter\hypertarget{group__signalfd}{ \section{signalfd: Pass signals along a file.} \label{group__signalfd}\index{signalfd: Pass signals along a file.@{signalfd: Pass signals along a file.}} } \subsection*{Functions} \begin{CompactItemize} \item int \hyperlink{group__signalfd_g059bff6a5a276e3add55103147dc1a46}{signalfd\_\-init} (void) \item void \hyperlink{group__signalfd_gd0c7324a233f709ca5c68ab88baa696d}{signalfd\_\-catch} (int sig) \item void \hyperlink{group__signalfd_g158526355d92fca1cb9d116f0468a871}{signalfd\_\-uncatch} (int sig) \item void \hyperlink{group__signalfd_g9f1de42e4d96723e5cd23740946291ba}{signalfd\_\-close} (void) \end{CompactItemize} \subsection{Function Documentation} \hypertarget{group__signalfd_gd0c7324a233f709ca5c68ab88baa696d}{ \index{signalfd@{signalfd}!signalfd\_\-catch@{signalfd\_\-catch}} \index{signalfd\_\-catch@{signalfd\_\-catch}!signalfd@{signalfd}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void signalfd\_\-catch (int {\em sig})}} \label{group__signalfd_gd0c7324a233f709ca5c68ab88baa696d} Mark a signal as being caught through the signalfd interface. \hypertarget{group__signalfd_g9f1de42e4d96723e5cd23740946291ba}{ \index{signalfd@{signalfd}!signalfd\_\-close@{signalfd\_\-close}} \index{signalfd\_\-close@{signalfd\_\-close}!signalfd@{signalfd}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void signalfd\_\-close (void)}} \label{group__signalfd_g9f1de42e4d96723e5cd23740946291ba} Close the signalfd interface. \hypertarget{group__signalfd_g059bff6a5a276e3add55103147dc1a46}{ \index{signalfd@{signalfd}!signalfd\_\-init@{signalfd\_\-init}} \index{signalfd\_\-init@{signalfd\_\-init}!signalfd@{signalfd}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int signalfd\_\-init (void)}} \label{group__signalfd_g059bff6a5a276e3add55103147dc1a46} Initialize the signal file descriptor. This function creates a pipe through which signals will get passed. This is a way of handling signals that avoids most problems posed by UNIX signals. When a signal is caught by this interface, the numerical value of the signal is passed down the pipe as a native integer. The file descriptor is set to non-blocking mode to prevent blocking when reading from it. To use the file descriptor, use either {\tt poll} or {\tt select} to determine when it is readable. When it becomes readable, read a single byte from it. The value of this byte indicates what signal was caught. Due to the global nature of UNIX signal handling, only a single signalfd interface may be active at any time. Do not call {\tt signalfd\_\-init} multiple times without calling {\tt signalfd\_\-close} first. \begin{Desc} \item[Returns:]-1 if an error occurred, otherwise the return value is the file descriptor opened for reading. \end{Desc} \hypertarget{group__signalfd_g158526355d92fca1cb9d116f0468a871}{ \index{signalfd@{signalfd}!signalfd\_\-uncatch@{signalfd\_\-uncatch}} \index{signalfd\_\-uncatch@{signalfd\_\-uncatch}!signalfd@{signalfd}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void signalfd\_\-uncatch (int {\em sig})}} \label{group__signalfd_g158526355d92fca1cb9d116f0468a871} Unmark a signal as being caught through the signalfd interface. bglibs-1.106/doc/latex/group__adt__gstack.tex0000664000076400007640000001634111147311327020557 0ustar bruceguenter\hypertarget{group__adt__gstack}{ \section{adt gstack: Generic simple stack.} \label{group__adt__gstack}\index{adt gstack: Generic simple stack.@{adt gstack: Generic simple stack.}} } \subsection*{Data Structures} \begin{CompactItemize} \item struct \hyperlink{structgstack__node}{gstack\_\-node} \item struct \hyperlink{structgstack}{gstack} \end{CompactItemize} \subsection*{Defines} \begin{CompactItemize} \item \#define \hyperlink{group__adt__gstack_g4f8f96eebb71e97682246e416882860a}{GSTACK\_\-DECL}(PREFIX, TYPE) \item \#define \hyperlink{group__adt__gstack_g1a6b766c1e85ad942288d34b3b452a51}{GSTACK\_\-PUSH\_\-DEFN}(PREFIX, TYPE, COPY) \item \#define \hyperlink{group__adt__gstack_g9fa46018a9c712216d216afe6cc43fea}{GSTACK\_\-TOP\_\-DEFN}(PREFIX, TYPE) \item \#define \hyperlink{group__adt__gstack_gb5b75f18ad1625de1b08b456290554a3}{GSTACK\_\-POP\_\-DEFN}(PREFIX, FREE) \item \#define \hyperlink{group__adt__gstack_g6db6fa756dd91724aab0a0d9513389cb}{GSTACK\_\-DEFN}(PREFIX, TYPE, COPY, FREE) \end{CompactItemize} \subsection*{Functions} \begin{CompactItemize} \item int \hyperlink{group__adt__gstack_gf83a5565c8a02ed6a2a95aacebfdd448}{gstack\_\-push} (struct \hyperlink{structgstack}{gstack} $\ast$d, unsigned datasize, const void $\ast$data, \hyperlink{group__adt_ga98f7f3499407a5dc1afdcbb20df2e15}{adt\_\-copy\_\-fn} $\ast$fn) \item void $\ast$ \hyperlink{group__adt__gstack_g89d5e3c467a1d97c60cb817ed5f4f3f6}{gstack\_\-top} (const struct \hyperlink{structgstack}{gstack} $\ast$s) \item void \hyperlink{group__adt__gstack_g1e4ffbe6a4c391351d7543ae47f9c2bf}{gstack\_\-pop} (struct \hyperlink{structgstack}{gstack} $\ast$s, \hyperlink{group__adt_g87ba7ca9dce36c22fe75a730a1d768a9}{adt\_\-free\_\-fn} $\ast$fn) \end{CompactItemize} \subsection{Detailed Description} 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. \subsection{Define Documentation} \hypertarget{group__adt__gstack_g4f8f96eebb71e97682246e416882860a}{ \index{adt\_\-gstack@{adt\_\-gstack}!GSTACK\_\-DECL@{GSTACK\_\-DECL}} \index{GSTACK\_\-DECL@{GSTACK\_\-DECL}!adt_gstack@{adt\_\-gstack}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define GSTACK\_\-DECL(PREFIX, TYPE)}} \label{group__adt__gstack_g4f8f96eebb71e97682246e416882860a} \textbf{Value:} \begin{Code}\begin{verbatim}extern int PREFIX##_push(struct gstack* s, TYPE const* data); \ extern TYPE* PREFIX##_top(struct gstack* s); \ extern void PREFIX##_pop(struct gstack* s); \end{verbatim} \end{Code} Declare specialized {\tt \hyperlink{structgstack}{gstack}} functions. \begin{Desc} \item[Examples: ]\par \hyperlink{adt_2gstack__test_8c-example}{adt/gstack\_\-test.c}.\end{Desc} \hypertarget{group__adt__gstack_g6db6fa756dd91724aab0a0d9513389cb}{ \index{adt\_\-gstack@{adt\_\-gstack}!GSTACK\_\-DEFN@{GSTACK\_\-DEFN}} \index{GSTACK\_\-DEFN@{GSTACK\_\-DEFN}!adt_gstack@{adt\_\-gstack}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define GSTACK\_\-DEFN(PREFIX, TYPE, COPY, FREE)}} \label{group__adt__gstack_g6db6fa756dd91724aab0a0d9513389cb} \textbf{Value:} \begin{Code}\begin{verbatim}GSTACK_PUSH_DEFN(PREFIX,TYPE,COPY) \ GSTACK_TOP_DEFN(PREFIX,TYPE) \ GSTACK_POP_DEFN(PREFIX,FREE) \end{verbatim} \end{Code} Define all the specialized {\tt \hyperlink{structgstack}{gstack}} functions. If {\tt COPY} is {\tt NULL}, a simple memcpy is used instead. If {\tt FREE} is {\tt NULL}, no attempt is made to free the data. \begin{Desc} \item[Examples: ]\par \hyperlink{adt_2gstack__test_8c-example}{adt/gstack\_\-test.c}.\end{Desc} \hypertarget{group__adt__gstack_gb5b75f18ad1625de1b08b456290554a3}{ \index{adt\_\-gstack@{adt\_\-gstack}!GSTACK\_\-POP\_\-DEFN@{GSTACK\_\-POP\_\-DEFN}} \index{GSTACK\_\-POP\_\-DEFN@{GSTACK\_\-POP\_\-DEFN}!adt_gstack@{adt\_\-gstack}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define GSTACK\_\-POP\_\-DEFN(PREFIX, FREE)}} \label{group__adt__gstack_gb5b75f18ad1625de1b08b456290554a3} \textbf{Value:} \begin{Code}\begin{verbatim}void PREFIX##_pop(struct gstack* s) { \ gstack_pop(s, (adt_free_fn*)(FREE)); \ } \end{verbatim} \end{Code} Define a specialized {\tt \hyperlink{structgstack}{gstack}} pop function. \hypertarget{group__adt__gstack_g1a6b766c1e85ad942288d34b3b452a51}{ \index{adt\_\-gstack@{adt\_\-gstack}!GSTACK\_\-PUSH\_\-DEFN@{GSTACK\_\-PUSH\_\-DEFN}} \index{GSTACK\_\-PUSH\_\-DEFN@{GSTACK\_\-PUSH\_\-DEFN}!adt_gstack@{adt\_\-gstack}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define GSTACK\_\-PUSH\_\-DEFN(PREFIX, TYPE, COPY)}} \label{group__adt__gstack_g1a6b766c1e85ad942288d34b3b452a51} \textbf{Value:} \begin{Code}\begin{verbatim}int PREFIX##_push(struct gstack* s, TYPE const* data) { \ return gstack_push(s, sizeof *data, data, (adt_copy_fn*)COPY); \ } \end{verbatim} \end{Code} Define a specialized {\tt \hyperlink{structgstack}{gstack}} push function. \hypertarget{group__adt__gstack_g9fa46018a9c712216d216afe6cc43fea}{ \index{adt\_\-gstack@{adt\_\-gstack}!GSTACK\_\-TOP\_\-DEFN@{GSTACK\_\-TOP\_\-DEFN}} \index{GSTACK\_\-TOP\_\-DEFN@{GSTACK\_\-TOP\_\-DEFN}!adt_gstack@{adt\_\-gstack}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define GSTACK\_\-TOP\_\-DEFN(PREFIX, TYPE)}} \label{group__adt__gstack_g9fa46018a9c712216d216afe6cc43fea} \textbf{Value:} \begin{Code}\begin{verbatim}TYPE* PREFIX##_top(struct gstack* s) { \ return (s->head == 0) ? 0 : (TYPE*)s->head->data; \ } \end{verbatim} \end{Code} Define a specialized {\tt \hyperlink{structgstack}{gstack}} top function. \subsection{Function Documentation} \hypertarget{group__adt__gstack_g1e4ffbe6a4c391351d7543ae47f9c2bf}{ \index{adt\_\-gstack@{adt\_\-gstack}!gstack\_\-pop@{gstack\_\-pop}} \index{gstack\_\-pop@{gstack\_\-pop}!adt_gstack@{adt\_\-gstack}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void gstack\_\-pop (struct {\bf gstack} $\ast$ {\em s}, {\bf adt\_\-free\_\-fn} $\ast$ {\em fn})}} \label{group__adt__gstack_g1e4ffbe6a4c391351d7543ae47f9c2bf} Remove the first (most recently pushed) element from the queue. If the free function {\tt fn} is {\tt NULL} no data freeing is done. Note that this does not return a pointer to the popped item, as once the item has been popped it is also freed. \hypertarget{group__adt__gstack_gf83a5565c8a02ed6a2a95aacebfdd448}{ \index{adt\_\-gstack@{adt\_\-gstack}!gstack\_\-push@{gstack\_\-push}} \index{gstack\_\-push@{gstack\_\-push}!adt_gstack@{adt\_\-gstack}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int gstack\_\-push (struct {\bf gstack} $\ast$ {\em s}, unsigned {\em datasize}, const void $\ast$ {\em data}, {\bf adt\_\-copy\_\-fn} $\ast$ {\em fn})}} \label{group__adt__gstack_gf83a5565c8a02ed6a2a95aacebfdd448} Add a new element onto the stack. If the copy function {\tt fn} is {\tt NULL} memcpy is used in its place. \hypertarget{group__adt__gstack_g89d5e3c467a1d97c60cb817ed5f4f3f6}{ \index{adt\_\-gstack@{adt\_\-gstack}!gstack\_\-top@{gstack\_\-top}} \index{gstack\_\-top@{gstack\_\-top}!adt_gstack@{adt\_\-gstack}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ gstack\_\-top (const struct {\bf gstack} $\ast$ {\em s})}} \label{group__adt__gstack_g89d5e3c467a1d97c60cb817ed5f4f3f6} Return the address of first (most recently pushed) element in the queue. bglibs-1.106/doc/latex/group__adt.tex0000664000076400007640000001473711147311327017073 0ustar bruceguenter\hypertarget{group__adt}{ \section{adt: Abstract Data Types.} \label{group__adt}\index{adt: Abstract Data Types.@{adt: Abstract Data Types.}} } \subsection*{Typedefs} \begin{CompactItemize} \item typedef unsigned long \hyperlink{group__adt_gab1a0335d8d46afee323cf2b3d132145}{adt\_\-hash\_\-t} \item typedef void \hyperlink{group__adt_g87ba7ca9dce36c22fe75a730a1d768a9}{adt\_\-free\_\-fn} (void $\ast$) \item typedef int \hyperlink{group__adt_ga98f7f3499407a5dc1afdcbb20df2e15}{adt\_\-copy\_\-fn} (void $\ast$, const void $\ast$) \item typedef int \hyperlink{group__adt_g03ed35b7331128b069dc77ab33798782}{adt\_\-cmp\_\-fn} (const void $\ast$, const void $\ast$) \item typedef \hyperlink{group__adt_gab1a0335d8d46afee323cf2b3d132145}{adt\_\-hash\_\-t} \hyperlink{group__adt_gd6ce53fbc11dbf67ca1c126cd17ee81a}{adt\_\-hash\_\-fn} (const void $\ast$) \end{CompactItemize} \subsection*{Functions} \begin{CompactItemize} \item \hyperlink{group__adt_gab1a0335d8d46afee323cf2b3d132145}{adt\_\-hash\_\-t} \hyperlink{group__adt_gd9ce9e50c1be3b099d94315960807237}{adt\_\-hashb} (const unsigned char $\ast$, unsigned long) \item \hyperlink{group__adt_gab1a0335d8d46afee323cf2b3d132145}{adt\_\-hash\_\-t} \hyperlink{group__adt_g9b98c9ab4f62ccca61ad6903a0ebd798}{adt\_\-hashs} (const unsigned char $\ast$) \item \hyperlink{group__adt_gab1a0335d8d46afee323cf2b3d132145}{adt\_\-hash\_\-t} \hyperlink{group__adt_g7e68b73378693c9b0945a11f849f3063}{adt\_\-hashsp} (const char $\ast$const $\ast$) \item int \hyperlink{group__adt_g84ea1556ed78318147cfc5d9a6674e13}{adt\_\-cmpsp} (const char $\ast$const $\ast$a, const char $\ast$const $\ast$b) \item int \hyperlink{group__adt_g6fa5c9c6df55cb8f4b73cfede896ed66}{adt\_\-copysp} (const char $\ast$$\ast$a, const char $\ast$const $\ast$b) \item void \hyperlink{group__adt_g28e2128b21e2a458f09423111ade4595}{adt\_\-freesp} (const char $\ast$$\ast$a) \end{CompactItemize} \subsection{Detailed Description} \subsection{Typedef Documentation} \hypertarget{group__adt_g03ed35b7331128b069dc77ab33798782}{ \index{adt@{adt}!adt\_\-cmp\_\-fn@{adt\_\-cmp\_\-fn}} \index{adt\_\-cmp\_\-fn@{adt\_\-cmp\_\-fn}!adt@{adt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef int {\bf adt\_\-cmp\_\-fn}(const void $\ast$, const void $\ast$)}} \label{group__adt_g03ed35b7331128b069dc77ab33798782} 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. \hypertarget{group__adt_ga98f7f3499407a5dc1afdcbb20df2e15}{ \index{adt@{adt}!adt\_\-copy\_\-fn@{adt\_\-copy\_\-fn}} \index{adt\_\-copy\_\-fn@{adt\_\-copy\_\-fn}!adt@{adt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef int {\bf adt\_\-copy\_\-fn}(void $\ast$, const void $\ast$)}} \label{group__adt_ga98f7f3499407a5dc1afdcbb20df2e15} 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). \hypertarget{group__adt_g87ba7ca9dce36c22fe75a730a1d768a9}{ \index{adt@{adt}!adt\_\-free\_\-fn@{adt\_\-free\_\-fn}} \index{adt\_\-free\_\-fn@{adt\_\-free\_\-fn}!adt@{adt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef void {\bf adt\_\-free\_\-fn}(void $\ast$)}} \label{group__adt_g87ba7ca9dce36c22fe75a730a1d768a9} A function prototype used for freeing something. \hypertarget{group__adt_gd6ce53fbc11dbf67ca1c126cd17ee81a}{ \index{adt@{adt}!adt\_\-hash\_\-fn@{adt\_\-hash\_\-fn}} \index{adt\_\-hash\_\-fn@{adt\_\-hash\_\-fn}!adt@{adt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef {\bf adt\_\-hash\_\-t} {\bf adt\_\-hash\_\-fn}(const void $\ast$)}} \label{group__adt_gd6ce53fbc11dbf67ca1c126cd17ee81a} A function prototype for hasing an item (typically a key). \hypertarget{group__adt_gab1a0335d8d46afee323cf2b3d132145}{ \index{adt@{adt}!adt\_\-hash\_\-t@{adt\_\-hash\_\-t}} \index{adt\_\-hash\_\-t@{adt\_\-hash\_\-t}!adt@{adt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef unsigned long {\bf adt\_\-hash\_\-t}}} \label{group__adt_gab1a0335d8d46afee323cf2b3d132145} 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. \subsection{Function Documentation} \hypertarget{group__adt_g84ea1556ed78318147cfc5d9a6674e13}{ \index{adt@{adt}!adt\_\-cmpsp@{adt\_\-cmpsp}} \index{adt\_\-cmpsp@{adt\_\-cmpsp}!adt@{adt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int adt\_\-cmpsp (const char $\ast$const $\ast$ {\em a}, const char $\ast$const $\ast$ {\em b})}} \label{group__adt_g84ea1556ed78318147cfc5d9a6674e13} A sample function for comparing two C string pointers. \hypertarget{group__adt_g6fa5c9c6df55cb8f4b73cfede896ed66}{ \index{adt@{adt}!adt\_\-copysp@{adt\_\-copysp}} \index{adt\_\-copysp@{adt\_\-copysp}!adt@{adt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int adt\_\-copysp (const char $\ast$$\ast$ {\em a}, const char $\ast$const $\ast$ {\em b})}} \label{group__adt_g6fa5c9c6df55cb8f4b73cfede896ed66} A sample function for copying a C string pointer. \hypertarget{group__adt_g28e2128b21e2a458f09423111ade4595}{ \index{adt@{adt}!adt\_\-freesp@{adt\_\-freesp}} \index{adt\_\-freesp@{adt\_\-freesp}!adt@{adt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void adt\_\-freesp (const char $\ast$$\ast$ {\em a})}} \label{group__adt_g28e2128b21e2a458f09423111ade4595} A sample function for freeing a C string pointer. \hypertarget{group__adt_gd9ce9e50c1be3b099d94315960807237}{ \index{adt@{adt}!adt\_\-hashb@{adt\_\-hashb}} \index{adt\_\-hashb@{adt\_\-hashb}!adt@{adt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf adt\_\-hash\_\-t} adt\_\-hashb (const unsigned char $\ast$, unsigned {\em long})}} \label{group__adt_gd9ce9e50c1be3b099d94315960807237} A sample function for hasing a block of memory. \hypertarget{group__adt_g9b98c9ab4f62ccca61ad6903a0ebd798}{ \index{adt@{adt}!adt\_\-hashs@{adt\_\-hashs}} \index{adt\_\-hashs@{adt\_\-hashs}!adt@{adt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf adt\_\-hash\_\-t} adt\_\-hashs (const unsigned char $\ast$)}} \label{group__adt_g9b98c9ab4f62ccca61ad6903a0ebd798} A sample function for hashing a C string. \hypertarget{group__adt_g7e68b73378693c9b0945a11f849f3063}{ \index{adt@{adt}!adt\_\-hashsp@{adt\_\-hashsp}} \index{adt\_\-hashsp@{adt\_\-hashsp}!adt@{adt}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf adt\_\-hash\_\-t} adt\_\-hashsp (const char $\ast$const $\ast$)}} \label{group__adt_g7e68b73378693c9b0945a11f849f3063} A sample function for hashing a C string pointer. bglibs-1.106/doc/latex/group__installer.tex0000664000076400007640000000447411147311327020315 0ustar bruceguenter\hypertarget{group__installer}{ \section{bg-installer: Standardzied installer program} \label{group__installer}\index{bg-installer: Standardzied installer program@{bg-installer: Standardzied installer program}} } The program {\tt bg-installer} reads an installation instruction file from standard input, and executes the instructions in the directory named on the command line. Each line in the file is an individual instruction. Blank lines and lines beginning with {\tt \#} are ignored. Lines beginning with {\tt $>$}, if present, instruct bg-installer as to which base directory to use (see below). All other lines must have following format: {\tt CMD:\mbox{[}OWNER\mbox{]}:\mbox{[}GROUP\mbox{]}:MODE:DIR\mbox{[}:FILENAME\mbox{[}:SOURCE\mbox{]}\mbox{]}} \begin{itemize} \item CMD is a single character specifying the installation command, optionally followed by {\tt }? indicating the command should only execute if the source exists. If the {\tt }? is followed by a name, it is used instead of {\tt 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{itemize} The target filename is {\tt PREFIX/TOP/DIR/FILENAME} where {\tt PREFIX} is the value of {\tt \$install\_\-prefix} if it is set, {\tt TOP} is the directory given on the command line, and {\tt DIR} and {\tt FILENAME} given in the installation file. \begin{itemize} \item c lines copy regular files from the current directory\item d lines create directories\item s lines create symlinks ({\tt UID}, {\tt GID}, and {\tt MODE} are ignored)\item l lines copy libraries using libtool\end{itemize} When {\tt bg-installer} encounters a base directory directive, as indicated above, it opens the file named {\tt conf-BASE} (where {\tt BASE} is the word on the directive line), reads the first line, and uses that as the base directory (prefixed by {\tt \$install\_\-prefix} as above). bglibs-1.106/doc/latex/dir_28609d2f6b17322077df409bed0e8d02.tex0000664000076400007640000000443211147311327022013 0ustar bruceguenter\hypertarget{dir_28609d2f6b17322077df409bed0e8d02}{ \section{iobuf/ Directory Reference} \label{dir_28609d2f6b17322077df409bed0e8d02}\index{iobuf/ Directory Reference@{iobuf/ Directory Reference}} } \subsection*{Files} \begin{CompactItemize} \item file \textbf{iobuf/common.h} \item file \textbf{ibuf.h} \item file \textbf{ibuf\_\-copytofd.c} \item file \textbf{ibuf\_\-getc.c} \item file \textbf{ibuf\_\-getnetstring.c} \item file \textbf{ibuf\_\-gets.c} \item file \textbf{ibuf\_\-getstr.c} \item file \textbf{ibuf\_\-getstr\_\-crlf.c} \item file \textbf{ibuf\_\-getu.c} \item file \textbf{ibuf\_\-init.c} \item file \textbf{ibuf\_\-open.c} \item file \textbf{ibuf\_\-openreadclose.c} \item file \textbf{ibuf\_\-peek.c} \item file \textbf{ibuf\_\-read.c} \item file \textbf{ibuf\_\-readall.c} \item file \textbf{ibuf\_\-refill.c} \item file \textbf{ibuf\_\-seek.c} \item file \textbf{ibuf\_\-status.c} \item file \textbf{ibuf\_\-stdin.c} \item file \textbf{ibuf\_\-tell.c} \item file \textbf{iobuf.h} \item file \textbf{iobuf\_\-close.c} \item file \textbf{iobuf\_\-copy.c} \item file \textbf{iobuf\_\-init.c} \item file \textbf{iobuf\_\-timeout.c} \item file \textbf{obuf.h} \item file \textbf{obuf\_\-close.c} \item file \textbf{obuf\_\-copyfromfd.c} \item file \textbf{obuf\_\-digits.c} \item file \textbf{obuf\_\-endl.c} \item file \textbf{obuf\_\-flush.c} \item file \textbf{obuf\_\-init.c} \item file \textbf{obuf\_\-open.c} \item file \textbf{obuf\_\-pad.c} \item file \textbf{obuf\_\-put2s.c} \item file \textbf{obuf\_\-put3s.c} \item file \textbf{obuf\_\-put4s.c} \item file \textbf{obuf\_\-put5s.c} \item file \textbf{obuf\_\-put6s.c} \item file \textbf{obuf\_\-put7s.c} \item file \textbf{obuf\_\-putc.c} \item file \textbf{obuf\_\-putf.c} \item file \textbf{obuf\_\-putnetstring.c} \item file \textbf{obuf\_\-putns.c} \item file \textbf{obuf\_\-putsflush.c} \item file \textbf{obuf\_\-putsllnumw.c} \item file \textbf{obuf\_\-putsnumw.c} \item file \textbf{obuf\_\-putullnumw.c} \item file \textbf{obuf\_\-putunumw.c} \item file \textbf{obuf\_\-seek.c} \item file \textbf{obuf\_\-sign\_\-pad.c} \item file \textbf{obuf\_\-stderr.c} \item file \textbf{obuf\_\-stdout.c} \item file \textbf{obuf\_\-sync.c} \item file \textbf{obuf\_\-write.c} \end{CompactItemize} bglibs-1.106/doc/latex/dir_e79ee0b49666b683d4b4444c8b170e6b.tex0000664000076400007640000000073211147311327022112 0ustar bruceguenter\hypertarget{dir_e79ee0b49666b683d4b4444c8b170e6b}{ \section{path/ Directory Reference} \label{dir_e79ee0b49666b683d4b4444c8b170e6b}\index{path/ Directory Reference@{path/ Directory Reference}} } \subsection*{Files} \begin{CompactItemize} \item file \textbf{contains.c} \item file \textbf{fnmatch.c} \item file \textbf{path/match.c} \item file \textbf{merge.c} \item file \textbf{mkdirs.c} \item file \textbf{mktemp.c} \item file \textbf{path.h} \end{CompactItemize} bglibs-1.106/doc/latex/structgstack__node.tex0000664000076400007640000000275511147311327020632 0ustar bruceguenter\hypertarget{structgstack__node}{ \section{gstack\_\-node Struct Reference} \label{structgstack__node}\index{gstack\_\-node@{gstack\_\-node}} } {\tt \#include $<$gstack.h$>$} \subsection*{Data Fields} \begin{CompactItemize} \item struct \hyperlink{structgstack__node}{gstack\_\-node} $\ast$ \hyperlink{structgstack__node_0192f0cb25f62b64628e3b7eb479e3af}{next} \item char \hyperlink{structgstack__node_4769bda6786e113cc265ef516e16f6b4}{data} \mbox{[}0\mbox{]} \end{CompactItemize} \subsection{Detailed Description} Generic stack node. \subsection{Field Documentation} \hypertarget{structgstack__node_0192f0cb25f62b64628e3b7eb479e3af}{ \index{gstack\_\-node@{gstack\_\-node}!next@{next}} \index{next@{next}!gstack_node@{gstack\_\-node}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}struct {\bf gstack\_\-node}$\ast$ {\bf gstack\_\-node::next}\hspace{0.3cm}{\tt \mbox{[}read\mbox{]}}}} \label{structgstack__node_0192f0cb25f62b64628e3b7eb479e3af} Pointer to the next element in the stack linked list. \hypertarget{structgstack__node_4769bda6786e113cc265ef516e16f6b4}{ \index{gstack\_\-node@{gstack\_\-node}!data@{data}} \index{data@{data}!gstack_node@{gstack\_\-node}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}char {\bf gstack\_\-node::data}\mbox{[}0\mbox{]}}} \label{structgstack__node_4769bda6786e113cc265ef516e16f6b4} The data contained in the stack node. The documentation for this struct was generated from the following file:\begin{CompactItemize} \item gstack.h\end{CompactItemize} bglibs-1.106/doc/latex/dirs.tex0000664000076400007640000000162111147311327015675 0ustar bruceguenter\section{bglibs Directories} This directory hierarchy is sorted roughly, but not completely, alphabetically:\begin{CompactList} \item \contentsline{section}{adt}{\pageref{dir_3fb7bf5367cadb161b081662ce57c8a3}}{} \item \contentsline{section}{crypto}{\pageref{dir_a2e2a6ddf2b9459cbc3be164f3c73476}}{} \item \contentsline{section}{fmt}{\pageref{dir_dd30a1940344e6186e300b1ab56c7d11}}{} \item \contentsline{section}{instlib}{\pageref{dir_201548bc8cd7b18da7ab15618d9a7744}}{} \item \contentsline{section}{iobuf}{\pageref{dir_28609d2f6b17322077df409bed0e8d02}}{} \item \contentsline{section}{net}{\pageref{dir_74e682a418f682a90c4a9d71beb28fdd}}{} \item \contentsline{section}{path}{\pageref{dir_e79ee0b49666b683d4b4444c8b170e6b}}{} \item \contentsline{section}{str}{\pageref{dir_b467e31085870d6887ee57c7b172ec7c}}{} \item \contentsline{section}{unix}{\pageref{dir_f74869e8b4fdb609276034ecde8dfb36}}{} \end{CompactList} bglibs-1.106/doc/latex/FreeSans.ttf0000664000076400007640000005462411147311327016452 0ustar bruceguenter€pGDEF ãH(*GPOS™ŠIPBGSUB¨…’ HTüOS/2g?ÏxVcmapæ×‘=ìŠcvt !yxgaspÿÿH glyf³X¯A7Êhead羬ü6hhea»ò4$hmtxU IâÐlocaÝ,¶|”maxp³X name…ós?ÜipostFõØFHÖŠº­_<õ ÀD؉ÀD؉ÿÓþ=œÑÑþ=xÿÓÿÒœÄÉfI@‡3™×3™f 'PfEd@ ÜfþfÑÀ¿ß÷‰²99þ×jrrD;Vj‡b©–©NR¬f9²©^9²9ÿðrXrÑrFrBr9rHrXr^rLrN9á9á¬\¬f¬fržFV#V¢ÆbƶV¸ã¸9Zƪ9Í#V¢r¤©šÆœ9NVº9NƾVbã+Æ®V=-V-Vã99ƒ9ÿð9/ÀZrÿÓ©-rVro?r5rR9%r;rƇÆÿÛwÆ‹©rrJror5©F9r…Æ #)?¬Xͬ;¬š99úrjr5r‰rÍrX©=åÿåõLrɬR©^åÿå©9Ù5¬fÎ'Î!©¼r…Kb9²©PÎ}ëRrÉó}ó}ó!rÅV#V#V#V#V#V#ÆbV¸V¸V¸V¸9Í9Í9Í9Æ)Æœ9N9N9N9N9N¬Ã9=ƮƮƮƮVSºã‰rVrVrVrVrVrVF?rRrRrRrR9999rJrrJrJrJrJrJ¬fã%r…r…r…r…)po)„h ~ÿ1ÆËÚÜÿÿ   1ÆÊÚÜÿÿÿöÿõÿäÿÃÿ’ýþýûýíý쓳 À¡Á€|vuipš  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ab‡ˆŠŒ”™Ÿ¤£¥§¦¨ª¬«­®°¯±²´¶µ·¹¸½¼¾¿sefjy¢qlwk‰›thxm}©»‚don~cƒ†˜ºÂz…„Ž‹‘’–—•žœr{!y.Hå]ÉÙý >Vly…“ÃÚc€¾ *„Ôæ+?},mªÓìPhv™µÆâúGrÇ  W j ¢ Á à ÷  / A T a p Ñ > y º Ü 4 [ o ‘ ® ¼ û ! U Œ Æ ã/U{ŽªÉìCPÀÈÒs¾èûw‰\xˆ•$Ut±ø8Zh™±ê=”ù'3?KrÜèô $0<p|ˆ” ¬¸Ù.:FR^j•ßë÷'©)5@KVaµÁÍÙåñý`lx„œ×ãããããã㉾Ñ!!!¾üˬýÝ#Ñø/щùAþªÕ ##5ª-P-ª¬ÕýLþ7É´ûÕÕj¶q¬ 3#%3#j¿7P8H¿8P7¬ãþíããþíÿ×V“3#3#####53#533!#!áI¾Ù@×ïPœNþP›NÏé@ÞøJœJHcþA“þo‹þ›‹þP°þP°‹e‹‘þo‘ýäþ›Dþþ%)/8A#5$'&=3&'&'&5476753#&'&'67654'&'%°j¡xþìf4¡ .›«> ’ÌTtxÛiJ¢YA<–ùtF ÓÓ½a†#w1} -3' hÃøh+ood…I2þ'I¡?`ìz-6¦Cý‰6Ci93-;ÿ×߬%)?O2#"'&'4547676"327654'&%3#2#"'&'4547676"327654'&˜‘ee``‡ feb`ˆ ^>3H;N\?3H:ù‡üׇË“eda_… Œeea`ˆ ^>3H;N]?3J9{ek’‰edbaŠ ‹feG;M]?3F:Ma>2Àú+¼ei’ˆec b`‰ ‹edG:L^>3G9Kb>1jÿѬ)9F%#"'&54767&'&547632674=3#67654'&#" 3276ºJ'Ž­ÈthIF½|ef”œ^SK?:¤múàþ)F/>g/fþ¸©1SNkun' Ii{n®Ž]\nœV+0†]_eY„ySFRþ²hs ´³þËsZ@+7Z2"L+9:2,ýD™lW6BpMI[b¶#¬3#bÁ7R8¬ãþí–þNTÕ3#&&56ãqÓ6³.8q¾X7‰QÕþ«þwtqþvþ‚a[úGɺ1?½NþN Õ#65&'3¾pÒ6´-7p¿Y6‰RþNSŠtqŽ~`Yúþ¹ÊºþÑþ¾R‡¾Õ37''7'7H Ú&ÝifÝ'ÙÕåMx>¶J¿¿J¶>xMfÿìFË !#!5!3FþXþX¨#þY§¨þX²þÓ‰Õ 73#5676=#²××L{ÕöþôN,'d%^ìF!5Fþ““²‡Õ%#5‡ÕÕÕÕÿðÿ×FÕ3#ÕqþpÕúXÿѬ%63 # & !265X$Re}LÑlžþÏo;ÛþÝÇ?!¾C†%þw“þ'®ZD«Lý°ýª†ÑIÑǬ !5>7673#þ¿³$wµ CP)OúTF¬#!2!!67676?654'&# fÑЂþį̀7 üü: HE§(0½Ä[Qsþþ´øyv»ÿ¤ oZ^1B²à}xkjp¯|OEþÍBÿÑ ¬2"#%632# &'3327654'&##567654'&)Ò2´J\óuRÊ£4Ž…Øþ£_´  8L³M-ÿLÄKUk>³6NpPe›ÞO8wEfÖ|sRkê8wFeó™+2„“@$9)¬ !533##žý›”…××´þ9\¿‘üR¢þ¤þ{ý…HÿѬ&!672# &'3327654'&#"#Ïý¤:|‘Ï‚ƒ…‚ÎþqM´=Õ °T9tQxqM$(¦l¬²þjV„†Ùà‘Œ {ç |U¾]A;/XÿѬ"2%632#&'&#"632# &%"327654'&XiˆÈrM´ v+3ÂQ0vØ¿|~}{ÁþB&ð“UE]SwSLoF–3¥>_›/Û„È¢|~Ç͉† V5‹eRz“^T`Y‚´S4^)¬ #!5)þ¥”<#ÀV‹~õü﬘þ3þ<ºÉz ]²LÿѬ,<"#"'&'47&'&54632"327654'&"327654'&!úƒ…Õ׈…ø~)ôÀÈzr>,þ¶‹D-^A]‹E,c?Z™TBcQwŸU?fQüwôÂ|~}ƒÂñxOM:WªÙsk¥xI4ØY:Rz>+X9P‚>'ý bLoŒQAeKnŽP?NÿѬ"2#"'&'332767#"'&'476763 "327654'&þêjŠÇrM´r-6ÂQ0nŽ%+Â}}}zÁž@ þƒSKnGfUI]SçýЦ@Œ_—1Û„È„~†É͉† þ[¼bXƒ³S5bS|•^Tá¶1%#5#5¶ÕÕÕÕÕÕ\ÕÕáþÓ¸1#53#5676=#¸Õ××M{1ÕÕü¤öþôN,'d%\ÿîFË5 \êüÙ'–¨¢þ¶þ°¡fãFÓ!5!5Fü àü Óþ fÿîPË5 5Pü'üÙ#þX¡JP¢žî#'#5476767654'&#"#%632#5n[X¸f]a_DcÄ1®HYÜwaþ’¸d™zQP:.4`pxoXZC38{A.¢?_|P€hûÏÕÕFþÝœîQe332767654'&'&#"327# '&'&57676763 #"'#"'&547676322767654'&#"Rª¸.obe’ŒÙjoýÔÁY:ž—ñiq£è9æéþÉöÙ`=Lj¶ü~zéÍ[:{›âÅu_axmžEF¬Nþ{y_NG3Fr_aH9ýÃE"/nrŸ,,Ï©¡>šØ•ó¹°=A‰V¡ŽßŒ™î€`¦B!™†Î‚‹Ì·%!¶jl¡¼Ÿ5²ý‡™~˜#[6'loœ rH8#9Õ !#3# ËýÀËö ÕÎæöÁþ?Õú+`¨ýX¢üÕ&#!! 4'&#!!27627654'&#!ü‚w¿ý^^m6ν7ÿÐ)2þq÷+ ˸=gBcþ/ªÇvmÕ´YnäbH…C;Éþ%Ÿ#ü”Œ5?’D,ýþbÿÑjî#47%63 #&'&#"327673! &&be’::?¢| Ã/²LfÞ~y‘Óìf6ÄCýÝþ±v ÙüÅ. þ›W›C(Nÿ‡ðî3'# '&&576%63 6'&'&#"32767'Ý`×±ÖþàÁ½) ¨žAF»* Óþ¼¶¢Ž‡Üä” ‰ß uo —w²h°¬ GK?ÓÆ, ¯ªþãHMþ¡è–¶¨¡ ›Ÿþöþî©¡ 1¾oÕ(#&=4'&#!#! 4'&#!!276J#2è){2Iþ¿±(j4g2-¦5Jþ3ÍÛ6áD‘=‰9:#/`”…Ã2ý}Õ¶Z«b0"É+ýþ†2bÿÑøî2% 7654'&'%$4763 #&'&#"! '&'3¼"G¥/>þþÛžè1Žcµ¥Ty²\@K7tvÒJ"b—þ±þ䜓µtly¨/7‡GbL×vj§t´ÁI%^A]b5'e9IWŸuµ†÷ §\U+¾Õ#!5!Õ¾þ“-úÓ-¨¨®ÿÑ)Õ3! '&5332765j¿þúþàš¿®VxÙfBÕûçᆄšÐûçÐM&{Px=)Õ!#3 3#ÍýçÍ·ËÕûð-oÕ !# #3 3 3ôÑþ¨þ²ÑþÕKÍTÕËû5ÕûD¼ûD¼-1Õ # # 3 3!ëþhþfçþçäþýoý‘þ×ý¶JJÕ#3 3¿ýÁ붪äJý¶J‹ý)×9ªÕ !!5!5¦üƒûü¹Õ¬û¨¨…¨ƒþNÕ#3!ÓÓþƒÕ“ùŸ“‡ÿðÿ×FÕ#`æqþÕúþ/þN¬Õ53#5!/ÓÓ}þN“a“øyZ¢f¬3# #“–=úø¬üöfýšÿÓþ˜ þþ!5 û3þþff-¼Ùì#Å{þÏìþÐ0VÿÑHP1@%63 327#"'&'#"'&5476767676=4'&#"276=… C.31LF H-# ”#&À^BwTÆ%^„ ‚0>·1ª›aF8˜œðkE™ÿ¡•¥\5ÿÑöÕ$#5#"'&7632"327654'&ö˜b…2=â~s‡}ÉÔnþÓ“WNkS|SInMÕú+Ž! ª› œš+ýÛ}q²ÒsZ}o¯ârPRÿÑP(!3273#"'&57632!654'&#"üé(OÒG¬'£m”ìƒx…ÙŃF%+üíZZUz•V>ß„H {×ÓaA¦—üŸ–|B]sXˆ\WtU%Û###53547632&#"²ªr:P/1'w1‹üZ¦‹¶š< m¨;þBéP*:"'&'&576723253#"'&'33276="32765'&ö¬y‰ €x¿ Ä~EZð&*óp? ®¢"(¾A,ds2™P@xIj›M:€D/‘ø£˜±›üþㇰ‰Ln’‚X¯7$á‰m¬ôlAi¥ h7ãÕ4'&#"#367632#9y/5‘PBªª^g>U¾Y;ªç0ua”ý°ÕýÉz#pJküÕ‡3Õ#5#3¬¬©Õ××þ\ûÏ1ÿÛþB9Õ#53#"'5327659ªªÎ(/#]Õ××þ\úð¹ ‘.@wÕ 3 ##!ÆÜþ‹¶Óþ–¦ªÕü•ÇþýBF¤þ^Õ‹7Õ#7¬Õú+ÕP*36763267632#4'&#"#4'&#"#ž]r6ET^b:OÔF¬b+:lJF¬q%1lJF¬1—ƒ"^(q •@VüÛãŽ2VQqý^ãœ,VQqý^åP367632#4'&#"#ž]z=P¶]Aª\5L‘PB¬1´”*kKoüÕçz8!ua”ý°JÿÑP #"'&576"327654'&-`šÌùk |ÉŸSAwLpSC~JPÕðþÞ˜}´•ö/™xžŠm«îmF†l©ýl?oþB/P!36 #"'&'"327654'&oz¸}tˆ|Ç©r+‘SGkMs‘WOmQþBï¢Á§þúþõœŽmýÑno°ÛrRzp¯ÜsW5þBöP$##"'&5763253"327654'&öª`%*Ý|r‰ËÃz ˜þ+”WOkS|SImMþB9£–ú¢•Ž}q²ÒsZ}n®ãsP‘P#367632‘°NZ¬žd_-5*œIUÎýÓ1¢+FÿѬP2327654'&/&'&547632#&'&#"# '&'ú~y“B%O"5 ÔH8€o­ü\,´£:e(:¤Ñ> ˆv¼þ¤A ?r^J(6P' '3RAo¡ZMšIg–M%0P+'2m:R¦]Qü4>ÿÑX#327#"'&5#533°+6P;ž& ‘‘ª1‹ý!E i$+‹'þÙ…ÿÑÛ1!#5#"'&53327653Û™`qAU¹\Aª\5L“PBª–‡(lKn;ýz8!va”`ã1!#3 3H»þ‡Á/À1üšf ª1 !# #333oÃÙÏÀþȽÛÍÑÒÕÁJü¶1ü½Cü½C#É1 # # 3 3VsÇþôþïÂ{þ™ÃÀ+ýÕœþd#þ{…)þBÓ13#"'53276?3¸þ#TÁA1;L$ Aþ–¶1úîÝš 6ª5ü½?¨1 !!5!5‹ýƒšü—‚ý©1—üü–š•XþN5Õ*#";#"'&54'&'5676547635U=%F‹%A^Ž62#K^" o0@Õ…&Eþ®J.A­'.þ[…z=UV¦<*A=ŠV³>ÍþNHÕ3#Í{{Õøy;þNÕ*5327654767&'&54'&+532#;!Vy%B!a’53"G]!q0@þN…&FsÔS C·"(s[…}…þª´>š%"#676323276=3#"/&'&s^l ‡"(95ð9-QlY5IOWÈ((ø•ê2 !#M' !–E)5ÿÿÿÿúþ\¦1¤1Àjÿ '673#5&'&576753#&'&Æ#¬ e•Vàxg–s¶Vïb2¬k,ç €;²ü»ïØqPÇɬ“à {¸¶©Vw“:üÃ?+þß,2ïi15ÿÑHÕA!!632327#"'&'&#"'67654'#53&'&54767632#!"-4>HþéO5nyEr`3O[Vg{X‚u6mrb³11â¦T zzºøtTµ þóšP7/V]mqW:_lIoP#>‡e ,)L‡šn=CLSq‹:$4¬{z¡vÄ;aC‰éh/'#"''7&'454767'76327"327654'&áwlR{nRirb<?osqYmwRytp2;þ¾bA6J>S^B9K=…nl=3iudRn q[qlp59lwpWhg_›I=Q_@6G=OdA4\¬!!!#!5!5!5!3 3öþ¤\þ¤µþ `þ 5þ]®zo®þeÕhžiþšfižh×ým“ý)ÍþNHÕ3#3#Í{{{{ÕüËþãüËXþL ÕEU327654'&'%&'&54767&'&54767232#54'&#"#"'&567654'%L’"m6!T þ£‘ q*4Á\\A]ìSbN$’bduhºòüAi~gàGB &H/"=å^¸#5!#5Õ!Õ¸ÓÓÓÓÿåÿÓð!9Q#"'&547632#&'&#"32767 #"'&'&57676"32767654'&'&j(^ȯooyn¬×V‘$M$4„F6QFi–5åпO,Ÿ’è{…øÍ¼R1œŽà~‡Þ¯¤9ˆ~ÀX]籦7‹€ÅXŠIªƒ„Òâ†yÄ5D‰$x\Œ¢dV¼#qœŽß~†þöÑÀL)™ŒÛƒ‹пO-ƒËX]ß³¥<†ÏTYⲦ:Lmªð-<!5%#"'&'#"'&54767676=4'&#"#6763232'32765ýÉR "Per7KJ¬OTS y«)0ù0 ­%jc N[9'ÕhhÃ[ 8XW/?k0/  D'3²$Áþ’0ú-L6%,ÉÙ¤ 5%75%É7ÙÙm7ÙÙѶúªªªªø¶úªªªªR°Z!#!Rü‡ý°Á^ìF!5Fþ““ÿåÿÓð%=U#&?4'&#!#! %!27654'&#! #"'&'&57676"32767654'&'&öU)¢"E%þî¦+þ M.þøÇпO,Ÿ’è{…øÍ¼R1œŽà~‡Þ¯¤9ˆ~ÀX]籦7‹€ÅXá7lA3QLRk þ…ÕZ5Yf ÜŽß~†þöÑÀL)™ŒÛƒ‹пO-ƒËX]ß³¥<†ÏTYⲦ:9 jœ!5jýÏœ5¢}2#"'&'46"327654'&m€[Z^[|Z[·Y<.D6D_:,E5}[[„[YZ`~€µuE6EY<.G5GZ9-fÿéFü !#!5!3!5FþXþX¨¨ü TþX¨¨þXý%'Fœ¬%"#67632!!67676?654'&m‹Æ.:–U@ª Y! Õý‘54wyC/?…)þ. [Dc›_B/6%v–NLM?AaN-!)“¬0"#7632#"'&53327654'&'򀴦'&Z~ ô§J,u‘mS}ÈI$a"0}*?i™+M"?]#6 e7673#HËlJX¤^ 8V üšRm˜ð#!52#"'&5476"327654'&ƒýå »E#yFd±I)‚C^h,V%1e-[#Õhh¡QsÏX3’TzÞU,kh:R¢:d:Sª8ÉÙœ 57'557'5þÅÝÝÓþÄÝ݉¶úªªªªø¶úªªªª}ÿ×ˬ #57>7673#3#%!533##HËlJXÝwübw<þ¡_‰‰þ÷¤^ 8V üšfú+öy ýÓlÍ9]þ£}ÿ×Á¬ 5#57>7673#3#"#7632!!67676?654'&HËlJX¬vücw;Ó*2–U@ª Y! Õý’54wxC.¤^ 8V üšfú+#Ž#)[Dcš`A/6%w—MMK?@bN-!ÿ×ˬ04?B"#7632#"'&53327654'&'򀴦'&%3#%!533##Z~ ô§J,u‘mS}ÈI$a"0}*?i™+M"²wübv'þ¡_‰‰þ÷?]#6 eYS]!/+h2/C <!?šO!'·I'e’::?¢| Ã-£Pqà~y‘‚wa¬ýà,DTm2$ R0.:(„ü†˜üÅ. þ›ÒÇ+ ¦ÂIÇ·þñ+,þÂÒÆ+ ¸¬‹[ƒ›žþøÔbü¡—šžêÿÿ®ÿÑ)Õ'Ƙ˜9ÿÿ®ÿÑ)Õ'Ř˜9ÿÿ®ÿÑ)Õ'Äž–9ÿÿ®ÿÑ);'kžƒ9ÿÿJÕ'Åj˜=ºîÕ#3!2#%!27654'&#!y¿¿ªð{`wtµþ+®G&wCaþsƒþ}Õöq±½xu¨r>VžC%‰ÿá‘Ó1 7654'&#"#4763 #"'53 7654'&+Z)qNyÑ9´‹}Ñ…e—qF6ßy¬1;--#0 ì2>!j¬ ~=*‡<`ûìBÂmb~`“¾f z^]þ¿{B™Ú)0ï' ÿÿVÿÑHP'ÆìEÿÿVÿÑHP'ÅìÿþEÿÿVÿÑHP'ÄåEÿÿVÿÑHP'ÈçÿãEÿÿVÿÑH'kåÿåEÿÿVÿÑHP'ÇÝEFÿÑÃP<MV3273#"'&/#"'&5476%63676=4'&#"#%63 6763227676=!4'&#"¬§ANÑJ¬&Ÿn–·w$!¢—=D³^G˜p~ ¤#*·1 ¬  :F_Q–$&57632#&'&#"323#632#"'&'7327654'&#"'ÍþòY'‹‚Ñóm= ¬ƒ,7¥N6zIjÚ,¬ ‹r«w! g=XOS$:+i1/B= +2pŠ¡•¥\†©0›l§ði>Óq\DQo1 T0.:ÿÿRÿÑP'ÆòIÿÿRÿÑP'ÅöÿþIÿÿRÿÑP'ÄüIÿÿRÿÑ'kðÿåIÿÿ&ÆËüÃÿÿ&ÅÉþÃÿÿ&ÄÉÃÿÿÊ'&kÉåÃJÿÑò$47632&'&''7&'&'77# '&"327654'&JÇmŠ3NHd ÇJ®8dZE_'ÆR¸™Wзw·þó}[åŸSAuLrSC~J]OJT \PR+9Z;\LTujûþ¿þ±’`Ç‘‰Šm«ênI†l©ýl?ÿÿåP'ÈîÿãRÿÿJÿÑP'ÆßSÿÿJÿÑP'ÅáSÿÿJÿÑP'ÄáSÿÿJÿÑP'ÈáÿãSÿÿJÿÑ'kßÿåSfFÇ !5#5#5Fü [ÕÕÕ+þªÕÕòÕÕ%ÿÃ;P +#"''7&576327327654 &'&#";Z¡|ÆÒ|}A‡b¡}ÇÆw½þX£R>ýÅéIyŸSA’”áþΘu9—’ë1˜wx…þ¨ýÙbŽk¨‰þˆ'\ Šm«Œÿÿ…ÿÑÛ1'ÆÝÿþYÿÿ…ÿÑÛ1'ÅÝYÿÿ…ÿÑÛ1'ÄãYÿÿ…ÿÑÛ'káÿåYÿÿ)þBÓ1'Ŧÿþ]oþB-¶$367632#"'&'"327654'&oªYŸ'*Ð|ˆ|Ç©r+‘SGkMs‘WOmQþBtýö þóþõœŽmýÑno°ÛrRzp¯ÜsWÿÿ)þBÓ'k°ÿå]"žfœ ·JÌ>4\­ ŒÈHX 3h®Å% R’¿ FV$ç,f f œ  · JÌ > 4\ ­ ŒÈ H X $“$ †£$H+$TuCopyleft 2002, 2003, 2005 Free Software Foundation.Copyleft 2002, 2003, 2005 Free Software Foundation.FreeSansFreeSansMediumMediumFontForge 1.0 : Free Sans : 26-1-2006FontForge 1.0 : Free Sans : 26-1-2006Free SansFree SansVersion $Revision: 1.76 $ Version $Revision: 1.76 $ FreeSansFreeSansThe use of this font is granted subject to GNU General Public License.The use of this font is granted subject to GNU General Public License.http://www.gnu.org/copyleft/gpl.htmlhttp://www.gnu.org/copyleft/gpl.htmlThe quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.navadnoDovoljena je uporaba v skladu z licenco GNU General Public License.http://www.gnu.org/copyleft/gpl.html`erif bo za vajo spet kuhal doma e ~gance.þËfÉ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`a¬£„…½–膎‹©¤ŠÚƒ“òó—ˆÃÞñžªõôö¢­ÉÇ®bcdËeÈÊÏÌÍÎéfÓÐѯgð‘ÖÔÕhëí‰jikmln oqprsutvwêxzy{}|¸¡~€ìîº×ØÝÙglyph3 softhyphenuni02CAuni02CBÿÿ "jkkl ŽœDFLT2armnbengHdevaRgujr\gurufhebrplatnzÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿkernkernŽz FTÿÿÿ3ÿÿÿ¬ÿÿÿš %ÿò8ÿ\:ÿ¢;ÿÙ=ÿD„ÿò‡ÿòˆÿò‰ÿéÿÿÿ1ÿÿÿ¬ÿÿÿ˜ %ÿš8þþ:ÿB;ÿy=þð„ÿš‡ÿšˆÿš‰ÿ‘~’Hš4z¤ÚP‚”æ\®Ø.¤ÎŒÂ\îª´ÊØâüB\fp®´Æàþ   À Ê   x Þ ø b  0 ^ Ð F L Z p ~ Œ ¦ ¬ ² Ð Ö ø"0>LZhv|&ÿÿÿ®ÿÿÿÿÿÿ{ÿÿÿéÿÿÿ¶ ÿú 'ÿ¶+ÿ¸3ÿ¼5ÿ¾8ÿB9ÿ´:ÿf;ÿ˜=ÿ5EÿøFGÿéHÿðIÿßKÿìSÿåUÿðXÿßYÿçZÿÁ[ÿÕ]ÿºnÿ¦Šÿ¶™ÿ¼œÿ´ÿ´žÿ´Ÿÿ´ªÿìÿÿÿö%ÿÕ3ÿò:ÿ¬;ÿÍ=ÿ¦„ÿÕ…ÿÕ†ÿÕ‡ÿÕˆÿÕ‰ÿÕ•ÿò–ÿò—ÿò™ÿò›ÿþ %ÿ¾,ÿç/ÿì3ÿð„ÿ¾‡ÿ¾ˆÿ¾‰ÿ¼–ÿð™ÿð %ÿª.ÿö8ÿ¤:ÿ˜;ÿÅ<ÿ“=ÿƒÿª„ÿª…ÿª†ÿª‡ÿªˆÿªÿÿÿÑÿ#ÿãÿ#%ÿs.ÿ˜3ÿÓEÿ¼IÿÏMÿìNÿçSÿÕVÿ¸Yÿ¼ƒÿs„ÿs…ÿs†ÿs‡ÿsˆÿs™ÿÓ¤ÿ¼§ÿ¼¨ÿ¼©ÿŬÿ϶ÿÕ¹ÿÕ»ÿÕ %ÿô8ÿ¦:ÿš;ÿÇ=ÿƒÿô„ÿô…ÿô†ÿô‡ÿôˆÿô‰ÿú%ÿ¾‡ÿ¾ˆÿ¾‰ÿÁÿÿÿ¤ÿ 'ÿ˜+ÿ˜3ÿž7ÿ²8)EÿéIÿ¾SÿÅYÿÙ]ÿ–ÿž™ÿž§ÿé¨ÿé©ÿò¶ÿŹÿÅ¿ÿÙÿÿþßÿÿþÏÿÿÿÙÿÿÿ¬ÿ%#'ÿ¬+ÿª3ÿ¬7ÿÙ8ÿ)9ÿ¸:ÿ);ÿu=ÿYÿò]ÿ„#‡#ˆ#‰)Šÿ´•ÿ¬–ÿ¬—ÿ¬˜ÿ¬™ÿ¬Ÿÿ¸¿ÿòÿÿÿúÿòÿò%ÿî'ÿú+ÿüEÿöS„ÿî‡ÿîˆÿî‰ÿôŠÿú¤ÿö§ÿö¨ÿö©ÿü¶¹» %ÿ¸8ÿª:ÿ¤;ÿÑ<ÿ¢=ÿ‡„ÿ¸‡ÿ¸ˆÿ¸‰ÿ°ÿÿÿÇþìÿ®þì%ÿ`.ÿ`EÿÇIÿÁSÿÉ„ÿ`‡ÿ`ˆÿ`‰ÿP¤ÿǧÿǨÿÇ©ÿϬÿÁ¶ÿɹÿÉ»ÿÉÿÿÿéÿÿÿéÿü'ÿß+ÿá3ÿå8ÿÑ9ÿÝ:ÿ°;ÿÉ=ÿ¨EÿáIÿçSÿîYÿî]ÿðŠÿß–ÿå™ÿåŸÿݤÿá§ÿá¨ÿá©ÿç¬ÿç¶ÿî¹ÿî½ÿî¿ÿî %ÿÓ8ÿÇ:ÿª;ÿÇ=ÿžXÿú„ÿÓ‡ÿÓˆÿÓ‰ÿÓ/ÿÿÿÿÿÿ…ÿÿÿÏÿÿÿ¸ÿ3ÿbÿ3þðþø%ÿ='ÿ¦+ÿ¤.ÿ33ÿª7ÿÏ:;!=)Eÿ3GÿHIÿ=KÿJMÿúNÿöSÿDVÿDWÿDYÿFZÿ=[ÿB]ÿ3nÿƒÿ=„ÿ=…ÿ=†ÿ=‡ÿ=ˆÿ=‰ÿ9•ÿª–ÿª—ÿª˜ÿª™ÿª›ÿ¬©ÿ9»ÿN ÿÉÿÍ%ÿ¶QÿøRÿøTVÿø„ÿ¶…ÿ¶†ÿ¶‡ÿ¶ˆÿ¶‰ÿ°&ÿÿÿ\ÿÿÿ¸ÿÿÿ¨ÿJÿ²ÿJÿyÿy%ÿo'ÿ¨+ÿª3ÿ®7ÿ¸8Eÿ‡Iÿ‹KÿšMÿöSÿ‘VÿªYÿ¬]ÿ×nÿVƒÿo„ÿo…ÿo†ÿo‡ÿoˆÿo‰ÿ`•ÿ®–ÿ®—ÿ®˜ÿ®™ÿ®›ÿ¼©ÿ»ÿš$ÿÿÿ‘ÿÿåÿÿ–ÿ“%ÿš'ÿÑ+ÿÓ3ÿ×7ÿÏ8'Eÿ²Iÿ¾KÿÍMÿþSÿÅVÿÇYÿÇ]ÿônÿ‰ƒÿš„ÿš…ÿš†ÿš‡ÿšˆÿš‰ÿ•ÿ×–ÿ×—ÿטÿ×™ÿ×›ÿå©ÿº»ÿÍ ÿ˜'ÿž3ÿ¤5ÿ¦EÿáIÿ¶Sÿ¼YÿÏ]ÿƒ™ÿ¤$ÿÿÿ ÿÿTÿÿNÿL%ÿ;'ÿ‰+ÿ‰3ÿ7ÿ¬8/EÿLIÿJKÿVMSÿPTÿ‘YÿZÿ¶nÿƒÿ;„ÿ;…ÿ;†ÿ;‡ÿ;ˆÿ;‰ÿ-•ÿ–ÿ—ÿ˜ÿ™ÿ›ÿ‘©ÿT»ÿXZÿ¼]ÿ²ÿÿÿÑNÿøZÿÕ[ÿå]ÿËZÿé[ÿú]ÿáLOÿÿÿÛXÿìZÿá[ÿî\ÿÉ]ÿÙÿÿÿçEÿîIÿáJ-MÿüNÿøPÿúSÿìX1¤ÿî§ÿî¨ÿî©ÿö¬ÿá¶ÿì¹ÿì»ÿîEÿö§ÿö¨ÿö©ÿþ¶¹ÿÿÿá]ÿÛ8ÿòNÿúÿ¬EÿüIÿÕKÿßSÿÙWÿúYÿé¤ÿü§ÿü¨ÿü©¬ÿÕ¶ÿÙ¹ÿÙ¿ÿô]ÿöT Zÿå[ÿò]ÿÛÿÿÿã8ÿ;T Zÿå[ÿò]ÿÛÿÿÿÕ8ÿ5XÿìZÿÛ[ÿì\ÿÉ]ÿÓXÿø]ÿßGY+ÿÿÿÿÿðÿÿÿôÿsÿ ÿsÿÓÿÓEÿöGÿôHÿþIÿéJ5KÿøMO PSÿôTUÿúWX9YZ;[?\)]1^£ÿö¤ÿö¥ÿö§ÿö¨ÿö©ÿþªÿî«ÿé¬ÿé­ÿéµÿô¶ÿô·ÿô¹ÿô»ÿôÿÿÿÓXÿúÿÿÿþÿÇÿÇ7ÿðEÿþIÿãLÿúSÿç¤ÿþ§ÿþ¨ÿþ©¬ÿã¶ÿç¹ÿçÿÿÿðÿÿÿßÿsÿçÿsÿÑÿÑEÿÛGÿßIÿÕKÿãSÿÝWÿî£ÿÛ¤ÿÛ¥ÿÛ¦ÿÛ§ÿÛ¨ÿÛ©ÿã«ÿÕ¬ÿÕ­ÿÕµÿݶÿݹÿÝ»ÿÝÿšÿþÿšÿÑÿÑEÿáGÿòIÿçKÿôSÿîWÿö£ÿá¤ÿá¥ÿá¦ÿá§ÿá¨ÿá©ÿé«ÿç¬ÿç­ÿçµÿî¶ÿî¹ÿî»ÿôEÿÝGÿÑIÿÇSÿÍUÿ׬ÿÇÿqÿãÿqÿÉÿÉEÿÓGÿÙIÿÏKÿÝPÿøSÿ×Wÿç£ÿÓ¤ÿÓ¥ÿÓ¦ÿÓ§ÿÓ¨ÿÓ©ÿÛ«ÿϬÿÏ­ÿϵÿ×¶ÿ×¹ÿ×»ÿÙ   'ÿ¶+ÿ¸3ÿ¼5ÿ¾8ÿB9ÿ´:ÿf;ÿ˜=ÿ5ÿÿÿ®ÿÿÿ{ ÿú 'ÿ¶+ÿ¸3ÿ¼5ÿ¾8ÿB9ÿ´:ÿf;ÿ˜=ÿ5EÿøFGÿéHÿðIÿßKÿìSÿåUÿðXÿßYÿçZÿÁ[ÿÕ]ÿºnÿ¦   'ÿ¶+ÿ¸3ÿ¼5ÿ¾8ÿB9ÿ´:ÿf;ÿ˜=ÿ5   'ÿ¶+ÿ¸3ÿ¼5ÿ¾8ÿB9ÿ´:ÿf;ÿ˜=ÿ5ÿÿÿ®ÿÿÿÿÿÿ{ ÿú 'ÿ¶+ÿ¸3ÿ¼5ÿ¾8ÿB9ÿ´:ÿf;ÿ˜=ÿ5EÿøFGÿéHÿðKÿìSÿåUÿðXÿßYÿçZÿÁ[ÿÕ]ÿºnÿ¦ÿÿÿ®ÿÿÿÿÿÿ{ ÿú 'ÿ¶+ÿ¸3ÿ¼5ÿ¾8ÿB9ÿ´:ÿf;ÿ˜=ÿ5EÿøFGÿéHÿðIÿßKÿìSÿåUÿðXÿßYÿçZÿÁ[ÿÕ]ÿºnÿ¦%ÿÁ8ÿª:ÿ¤=ÿ‡%ÿ¸8ÿª:ÿ¤;ÿÑ=ÿ‡8ÿª:ÿ¤=ÿ‡8ÿª:ÿ¤=ÿ‡%ÿ¸8ÿª:ÿ¤;ÿÑ<ÿ¢=ÿ‡%ÿ¼%ÿ¶ÿÉÿÍ%ÿ¶QÿøRÿøTVÿø%ÿ¶ÿÉÿÍ%ÿ¶FQÿøRÿøTVÿøZÿÕ[ÿå]ÿËZÿÕ[ÿå]ÿËZÿÕ[ÿå]ÿËZÿÕ[ÿå]ÿËZÿß[ÿì]ÿ×Zÿá[ÿî]ÿÙZÿá[ÿî]ÿÙZÿÛ[ÿì]ÿÓZÿÛ[ÿì]ÿÓXÿìXÿìZÿÛ[ÿì\ÿÉ]ÿÓ%(*+.024 6> EGIMO]ƒˆ,ŠŠ2•™3›Ÿ8£¤=§©?¬­Bµ·D¹¹Gbglibs-1.106/doc/latex/modules.tex0000664000076400007640000000427411147311327016413 0ustar bruceguenter\section{bglibs Modules} Here is a list of all modules:\begin{CompactList} \item \contentsline{section}{bg-installer: Standardzied installer program}{\pageref{group__installer}}{} \item \contentsline{section}{adt: Abstract Data Types.}{\pageref{group__adt}}{} \item \contentsline{section}{adt ghash: Generic hash tables.}{\pageref{group__adt__ghash}}{} \item \contentsline{section}{adt gqueue: Generic simple queue.}{\pageref{group__adt__gqueue}}{} \item \contentsline{section}{adt gstack: Generic simple stack.}{\pageref{group__adt__gstack}}{} \item \contentsline{section}{crypto: Cryptographic routines}{\pageref{group__crypto}}{} \item \contentsline{section}{surfrand: Random number generator based on SURF}{\pageref{group__surfrand}}{} \item \contentsline{section}{fmt: Formatting Functions}{\pageref{group__fmt}}{} \item \contentsline{section}{instlib: Installation program generation}{\pageref{group__instlib}}{} \item \contentsline{section}{iobuf: I/O Buffer Management}{\pageref{group__iobuf}}{} \item \contentsline{section}{ibuf: Input Buffer Managemenet}{\pageref{group__ibuf}}{} \item \contentsline{section}{obuf: Output Buffer Management}{\pageref{group__obuf}}{} \item \contentsline{section}{ipv4: IPv4 Address Handling}{\pageref{group__ipv4}}{} \item \contentsline{section}{ipv6: IPv6 Address Handling}{\pageref{group__ipv6}}{} \item \contentsline{section}{resolve: Domain name resolution functions}{\pageref{group__resolve}}{} \item \contentsline{section}{socket: General socket manipulations}{\pageref{group__socket}}{} \item \contentsline{section}{path: Filename manipulation functions}{\pageref{group__path}}{} \item \contentsline{section}{envstr: Environment variables in a str.}{\pageref{group__envstr}}{} \item \contentsline{section}{striter: Iterator over substrings of a str.}{\pageref{group__striter}}{} \item \contentsline{section}{str: Dynamically allocated string library.}{\pageref{group__str}}{} \item \contentsline{section}{selfpipe: Safe child exit management.}{\pageref{group__selfpipe}}{} \item \contentsline{section}{signalfd: Pass signals along a file.}{\pageref{group__signalfd}}{} \item \contentsline{section}{trigger: Safe external event notification}{\pageref{group__trigger}}{} \end{CompactList} bglibs-1.106/doc/latex/group__obuf.tex0000664000076400007640000011062711147311327017251 0ustar bruceguenter\hypertarget{group__obuf}{ \section{obuf: Output Buffer Management} \label{group__obuf}\index{obuf: Output Buffer Management@{obuf: Output Buffer Management}} } \subsection*{Data Structures} \begin{CompactItemize} \item struct \hyperlink{structobuf}{obuf} \end{CompactItemize} \subsection*{Defines} \begin{CompactItemize} \item \#define \hyperlink{group__obuf_gf0b8d24d432d19c4c3fe9f8f1aa5a976}{OBUF\_\-CREATE}~O\_\-CREAT \item \#define \hyperlink{group__obuf_g2f097eb9e0814eddffeba24e86a513df}{OBUF\_\-EXCLUSIVE}~O\_\-EXCL \item \#define \hyperlink{group__obuf_gf21027144be2cdf09f8fb62184d036e0}{OBUF\_\-TRUNCATE}~O\_\-TRUNC \item \#define \hyperlink{group__obuf_gbbdf0f428faeb7f324fbeb02dfc86922}{OBUF\_\-APPEND}~O\_\-APPEND \item \#define \hyperlink{group__obuf_g62b6e576bfc1cd1f9184a144467eb125}{obuf\_\-error}(out)~iobuf\_\-error(\&(out) $\rightarrow$ io) \item \#define \hyperlink{group__obuf_gdb3db33d9e3b8b4993afc9152f78cbbe}{obuf\_\-closed}(out)~iobuf\_\-closed(\&(out) $\rightarrow$ io) \item \#define \hyperlink{group__obuf_ge82c646b1252e975b43a59fa5dbfc594}{obuf\_\-timedout}(out)~iobuf\_\-timedout(\&((out) $\rightarrow$ io)) \item \#define \hyperlink{group__obuf_gcfc4d6943e15538903c3667dea9a9f09}{obuf\_\-rewind}(out)~obuf\_\-seek(out,0) \item \#define \hyperlink{group__obuf_g078f3950712509205177452270e73b20}{obuf\_\-tell}(out)~((out) $\rightarrow$ io.offset+(out) $\rightarrow$ bufpos) \item \#define \hyperlink{group__obuf_g06c401948c88cae85fe586a9fd3580c8}{obuf\_\-puts}(out, \hyperlink{structstr}{str})~obuf\_\-write(out,\hyperlink{structstr}{str},strlen(\hyperlink{structstr}{str})) \item \#define \hyperlink{group__obuf_g70a608bd004fc6f255852cafe415f716}{obuf\_\-putstr}(out, \hyperlink{structstr}{str})~obuf\_\-write(out,(\hyperlink{structstr}{str}) $\rightarrow$ s,(\hyperlink{structstr}{str}) $\rightarrow$ len) \end{CompactItemize} \subsection*{Typedefs} \begin{CompactItemize} \item typedef int($\ast$ \hyperlink{group__obuf_ga39dfad0e8745cdcb31ffe6353758c48}{obuf\_\-fn} )(int, const void $\ast$, unsigned long) \item typedef struct \hyperlink{structobuf}{obuf} \hyperlink{group__obuf_g5d21ad371d3d1522bbec6915145ef02d}{obuf} \end{CompactItemize} \subsection*{Functions} \begin{CompactItemize} \item int \hyperlink{group__obuf_gb9eeed3514560048a940ee7b24dd1347}{obuf\_\-init} (\hyperlink{structobuf}{obuf} $\ast$out, int fd, \hyperlink{group__obuf_ga39dfad0e8745cdcb31ffe6353758c48}{obuf\_\-fn} fn, unsigned flags, unsigned bufsize) \item int \hyperlink{group__obuf_g3dea7751e7b1097224be09ff1e71888f}{obuf\_\-open} (\hyperlink{structobuf}{obuf} $\ast$out, const char $\ast$filename, int oflags, int mode, unsigned bufsize) \item int \hyperlink{group__obuf_g610bff3f5c0764568ca4a4741340cfcc}{obuf\_\-close} (\hyperlink{structobuf}{obuf} $\ast$out) \item int \hyperlink{group__obuf_g6ddac728408520e6d56da0505c6e03ad}{obuf\_\-flush} (\hyperlink{structobuf}{obuf} $\ast$out) \item int \hyperlink{group__obuf_g926e867fc325f0b221ce507d6a6285e4}{obuf\_\-sync} (\hyperlink{structobuf}{obuf} $\ast$out) \item int \hyperlink{group__obuf_g165f549a8931c793af8aef1db88a64d4}{obuf\_\-write\_\-large} (\hyperlink{structobuf}{obuf} $\ast$out, const char $\ast$data, unsigned datalen) \item int \hyperlink{group__obuf_g03421ac22a31290e1e94462257b13781}{obuf\_\-write} (\hyperlink{structobuf}{obuf} $\ast$out, const char $\ast$data, unsigned datalen) \item int \hyperlink{group__obuf_g2f5fa6c89c5d58023125710fa42285f4}{obuf\_\-seek} (\hyperlink{structobuf}{obuf} $\ast$out, unsigned offset) \item int \hyperlink{group__obuf_g608698be2e8e24767cf1b27716653660}{obuf\_\-pad} (\hyperlink{structobuf}{obuf} $\ast$out, unsigned width, char ch) \item int \hyperlink{group__obuf_g3076cb0bd4009f248207baba2e420197}{obuf\_\-endl} (\hyperlink{structobuf}{obuf} $\ast$out) \item int \hyperlink{group__obuf_g875c0262a092dcb73bcbd0a3fa557d26}{obuf\_\-putc} (\hyperlink{structobuf}{obuf} $\ast$out, char ch) \item int \hyperlink{group__obuf_g9ec0f20a3f1928e44691f57425703b57}{obuf\_\-put2s} (\hyperlink{structobuf}{obuf} $\ast$out, const char $\ast$s1, const char $\ast$s2) \item int \hyperlink{group__obuf_gb34e2094f765c45757394f1a0c13de9b}{obuf\_\-put3s} (\hyperlink{structobuf}{obuf} $\ast$out, const char $\ast$s1, const char $\ast$s2, const char $\ast$s3) \item int \hyperlink{group__obuf_ge39b3c2511685f4fe16e62fd9d509136}{obuf\_\-put4s} (\hyperlink{structobuf}{obuf} $\ast$out, const char $\ast$s1, const char $\ast$s2, const char $\ast$s3, const char $\ast$s4) \item int \hyperlink{group__obuf_g7cb66052946afe11c239ef23ea767c5a}{obuf\_\-put5s} (\hyperlink{structobuf}{obuf} $\ast$out, const char $\ast$s1, const char $\ast$s2, const char $\ast$s3, const char $\ast$s4, const char $\ast$s5) \item int \hyperlink{group__obuf_g864c5f97b57eee47292f643648f21d65}{obuf\_\-put6s} (\hyperlink{structobuf}{obuf} $\ast$out, const char $\ast$s1, const char $\ast$s2, const char $\ast$s3, const char $\ast$s4, const char $\ast$s5, const char $\ast$s6) \item int \hyperlink{group__obuf_ga71c9bbbbacfe3b4a13ec56804ac6d13}{obuf\_\-put7s} (\hyperlink{structobuf}{obuf} $\ast$out, const char $\ast$s1, const char $\ast$s2, const char $\ast$s3, const char $\ast$s4, const char $\ast$s5, const char $\ast$s6, const char $\ast$s7) \item int \hyperlink{group__obuf_g04c43549b6398ac77ef9f2364ddb26f2}{obuf\_\-putns} (\hyperlink{structobuf}{obuf} $\ast$out, unsigned int count,...) \item int \hyperlink{group__obuf_gf9c5d5661c1da0dffbc3c2c8c951f3ca}{obuf\_\-putf} (\hyperlink{structobuf}{obuf} $\ast$out, const char $\ast$format,...) \item int \hyperlink{group__obuf_gb0e0f78155d17a50e83d61d2f686d945}{obuf\_\-putfv} (\hyperlink{structobuf}{obuf} $\ast$out, const char $\ast$format, va\_\-list ap) \item int \hyperlink{group__obuf_geb191f028a654a047f02148a9af9811d}{obuf\_\-putsflush} (\hyperlink{structobuf}{obuf} $\ast$out, const char $\ast$s) \item int \hyperlink{group__obuf_gd0ee3632bc0d26a9819377aba16d406f}{obuf\_\-puti} (\hyperlink{structobuf}{obuf} $\ast$out, long data) \item int \hyperlink{group__obuf_g2cf372af70bc6147a2db479d8a85df5d}{obuf\_\-putiw} (\hyperlink{structobuf}{obuf} $\ast$out, long data, unsigned width, char pad) \item int \hyperlink{group__obuf_g75231da78e1b0dcc2a9307f487c0a47d}{obuf\_\-putu} (\hyperlink{structobuf}{obuf} $\ast$out, unsigned long data) \item int \hyperlink{group__obuf_gb733b82803b4ddf12e7ff1140cd4eaf4}{obuf\_\-putuw} (\hyperlink{structobuf}{obuf} $\ast$out, unsigned long data, unsigned width, char pad) \item int \hyperlink{group__obuf_g54410e8023b4cf933657c1aad5842413}{obuf\_\-putill} (\hyperlink{structobuf}{obuf} $\ast$out, long long data) \item int \hyperlink{group__obuf_g9735a1718e14888c15a68391fcfa8a32}{obuf\_\-putiwll} (\hyperlink{structobuf}{obuf} $\ast$out, long long data, unsigned width, char pad) \item int \hyperlink{group__obuf_geb1a75d1bc3f7ae6bfaa91773bac1b0a}{obuf\_\-putull} (\hyperlink{structobuf}{obuf} $\ast$out, unsigned long long data) \item int \hyperlink{group__obuf_gbd73e29249fddf85754a3248ad9b8909}{obuf\_\-putuwll} (\hyperlink{structobuf}{obuf} $\ast$out, unsigned long long data, unsigned width, char pad) \item int \hyperlink{group__obuf_g73b0e1bad7d14bce50996b0a79e3e60f}{obuf\_\-putx} (\hyperlink{structobuf}{obuf} $\ast$out, unsigned long data) \item int \hyperlink{group__obuf_g63bc25bd5decb5affccd967701181e02}{obuf\_\-putxw} (\hyperlink{structobuf}{obuf} $\ast$out, unsigned long data, unsigned width, char pad) \item int \hyperlink{group__obuf_gf571b1aee85e5536ead2f139fe723a89}{obuf\_\-putX} (\hyperlink{structobuf}{obuf} $\ast$out, unsigned long data) \item int \hyperlink{group__obuf_g4349ac8d9999d042abd3e885a96b42e0}{obuf\_\-putXw} (\hyperlink{structobuf}{obuf} $\ast$out, unsigned long data, unsigned width, char pad) \item int \hyperlink{group__obuf_ge0ed6f7cf0658c006863ace5c2716a79}{obuf\_\-putxll} (\hyperlink{structobuf}{obuf} $\ast$out, unsigned long long data) \item int \hyperlink{group__obuf_g34cdd4dc150b9ebeebbe6b4e63b16f1a}{obuf\_\-putxwll} (\hyperlink{structobuf}{obuf} $\ast$out, unsigned long long data, unsigned width, char pad) \item int \hyperlink{group__obuf_g2991868a52edf6fffa2ea17f5f8fee93}{obuf\_\-putXll} (\hyperlink{structobuf}{obuf} $\ast$out, unsigned long long data) \item int \hyperlink{group__obuf_g89141b7b75a203e1f2ba61a8396be456}{obuf\_\-putXwll} (\hyperlink{structobuf}{obuf} $\ast$out, unsigned long long data, unsigned width, char pad) \item int \hyperlink{group__obuf_gc91df37cd8f3fbb0384e296440d1ce42}{obuf\_\-putsnumw} (\hyperlink{structobuf}{obuf} $\ast$out, long num, unsigned width, char pad, unsigned base, const char $\ast$digits) \item int \hyperlink{group__obuf_gd5b1e82de1a914549ce29defdbd11af9}{obuf\_\-putunumw} (\hyperlink{structobuf}{obuf} $\ast$out, unsigned long num, unsigned width, char pad, unsigned base, const char $\ast$digits) \item int \hyperlink{group__obuf_g4e8023a4f1fdc030650fcbbac89d73ea}{obuf\_\-putsllnumw} (\hyperlink{structobuf}{obuf} $\ast$out, long long num, unsigned width, char pad, unsigned base, const char $\ast$digits) \item int \hyperlink{group__obuf_g8df75140cd8e7e7e09d3416e1a89a4e3}{obuf\_\-putullnumw} (\hyperlink{structobuf}{obuf} $\ast$out, unsigned long long num, unsigned width, char pad, unsigned base, const char $\ast$digits) \item int \hyperlink{group__obuf_ged03a0d0778f8b3e6af12cad3446eadd}{obuf\_\-putnetstring} (\hyperlink{structobuf}{obuf} $\ast$out, const char $\ast$data, unsigned datalen) \item int \hyperlink{group__obuf_gbef86026d605262194142e28a3e192a4}{obuf\_\-sign\_\-pad} (\hyperlink{structobuf}{obuf} $\ast$out, int sign, unsigned width, char pad) \end{CompactItemize} \subsection*{Variables} \begin{CompactItemize} \item \hyperlink{structobuf}{obuf} \hyperlink{group__obuf_g7786baf4fe0e6d14e304536eb40d6354}{outbuf} \item \hyperlink{structobuf}{obuf} \hyperlink{group__obuf_gfa9e5277c3780b0832a2a278eef7c59e}{errbuf} \item \hypertarget{group__obuf_gf323837f74b28200d29102786dea80a8}{ const char \textbf{obuf\_\-dec\_\-digits} \mbox{[}10\mbox{]}} \label{group__obuf_gf323837f74b28200d29102786dea80a8} \item \hypertarget{group__obuf_g585c0dddc1175a6d7d8230fc968e9a8b}{ const char \textbf{obuf\_\-hex\_\-lcase\_\-digits} \mbox{[}16\mbox{]}} \label{group__obuf_g585c0dddc1175a6d7d8230fc968e9a8b} \item \hypertarget{group__obuf_gc7e9df74b8581cd333f3ed05f3e2ec70}{ const char \textbf{obuf\_\-hex\_\-ucase\_\-digits} \mbox{[}16\mbox{]}} \label{group__obuf_gc7e9df74b8581cd333f3ed05f3e2ec70} \end{CompactItemize} \subsection{Detailed Description} \begin{Desc} \item[Calling Convention]\end{Desc} Unless otherwise specified, the return value is non-zero (true) if the entire requested operation completed, and {\tt 0} (false) otherwise. \subsection{Define Documentation} \hypertarget{group__obuf_gbbdf0f428faeb7f324fbeb02dfc86922}{ \index{obuf@{obuf}!OBUF\_\-APPEND@{OBUF\_\-APPEND}} \index{OBUF\_\-APPEND@{OBUF\_\-APPEND}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define OBUF\_\-APPEND~O\_\-APPEND}} \label{group__obuf_gbbdf0f428faeb7f324fbeb02dfc86922} All writes go to the end of the file. \hypertarget{group__obuf_gdb3db33d9e3b8b4993afc9152f78cbbe}{ \index{obuf@{obuf}!obuf\_\-closed@{obuf\_\-closed}} \index{obuf\_\-closed@{obuf\_\-closed}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define obuf\_\-closed(out)~iobuf\_\-closed(\&(out) $\rightarrow$ io)}} \label{group__obuf_gdb3db33d9e3b8b4993afc9152f78cbbe} Test if the {\tt \hyperlink{structobuf}{obuf}} has been closed. \hypertarget{group__obuf_gf0b8d24d432d19c4c3fe9f8f1aa5a976}{ \index{obuf@{obuf}!OBUF\_\-CREATE@{OBUF\_\-CREATE}} \index{OBUF\_\-CREATE@{OBUF\_\-CREATE}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define OBUF\_\-CREATE~O\_\-CREAT}} \label{group__obuf_gf0b8d24d432d19c4c3fe9f8f1aa5a976} Create the file if it does not already exist. \hypertarget{group__obuf_g62b6e576bfc1cd1f9184a144467eb125}{ \index{obuf@{obuf}!obuf\_\-error@{obuf\_\-error}} \index{obuf\_\-error@{obuf\_\-error}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define obuf\_\-error(out)~iobuf\_\-error(\&(out) $\rightarrow$ io)}} \label{group__obuf_g62b6e576bfc1cd1f9184a144467eb125} Test if the {\tt \hyperlink{structobuf}{obuf}} is in an error state. \hypertarget{group__obuf_g2f097eb9e0814eddffeba24e86a513df}{ \index{obuf@{obuf}!OBUF\_\-EXCLUSIVE@{OBUF\_\-EXCLUSIVE}} \index{OBUF\_\-EXCLUSIVE@{OBUF\_\-EXCLUSIVE}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define OBUF\_\-EXCLUSIVE~O\_\-EXCL}} \label{group__obuf_g2f097eb9e0814eddffeba24e86a513df} If {\tt OBUF\_\-CREATE} is set, fail to create the file if it already exists. \hypertarget{group__obuf_g06c401948c88cae85fe586a9fd3580c8}{ \index{obuf@{obuf}!obuf\_\-puts@{obuf\_\-puts}} \index{obuf\_\-puts@{obuf\_\-puts}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define obuf\_\-puts(out, {\bf str})~obuf\_\-write(out,{\bf str},strlen({\bf str}))}} \label{group__obuf_g06c401948c88cae85fe586a9fd3580c8} Write a C string to the {\tt \hyperlink{structobuf}{obuf}} \hypertarget{group__obuf_g70a608bd004fc6f255852cafe415f716}{ \index{obuf@{obuf}!obuf\_\-putstr@{obuf\_\-putstr}} \index{obuf\_\-putstr@{obuf\_\-putstr}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define obuf\_\-putstr(out, {\bf str})~obuf\_\-write(out,({\bf str}) $\rightarrow$ s,({\bf str}) $\rightarrow$ len)}} \label{group__obuf_g70a608bd004fc6f255852cafe415f716} Write a dynamic string to the {\tt \hyperlink{structiobuf}{iobuf}} \hypertarget{group__obuf_gcfc4d6943e15538903c3667dea9a9f09}{ \index{obuf@{obuf}!obuf\_\-rewind@{obuf\_\-rewind}} \index{obuf\_\-rewind@{obuf\_\-rewind}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define obuf\_\-rewind(out)~obuf\_\-seek(out,0)}} \label{group__obuf_gcfc4d6943e15538903c3667dea9a9f09} Set the effective write position to the start of the file. \hypertarget{group__obuf_g078f3950712509205177452270e73b20}{ \index{obuf@{obuf}!obuf\_\-tell@{obuf\_\-tell}} \index{obuf\_\-tell@{obuf\_\-tell}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define obuf\_\-tell(out)~((out) $\rightarrow$ io.offset+(out) $\rightarrow$ bufpos)}} \label{group__obuf_g078f3950712509205177452270e73b20} Look up the current effective write position. \hypertarget{group__obuf_ge82c646b1252e975b43a59fa5dbfc594}{ \index{obuf@{obuf}!obuf\_\-timedout@{obuf\_\-timedout}} \index{obuf\_\-timedout@{obuf\_\-timedout}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define obuf\_\-timedout(out)~iobuf\_\-timedout(\&((out) $\rightarrow$ io))}} \label{group__obuf_ge82c646b1252e975b43a59fa5dbfc594} Test if the last {\tt \hyperlink{structobuf}{obuf}} write timed out. \hypertarget{group__obuf_gf21027144be2cdf09f8fb62184d036e0}{ \index{obuf@{obuf}!OBUF\_\-TRUNCATE@{OBUF\_\-TRUNCATE}} \index{OBUF\_\-TRUNCATE@{OBUF\_\-TRUNCATE}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define OBUF\_\-TRUNCATE~O\_\-TRUNC}} \label{group__obuf_gf21027144be2cdf09f8fb62184d036e0} If the file exists, truncate it to length 0. \subsection{Typedef Documentation} \hypertarget{group__obuf_g5d21ad371d3d1522bbec6915145ef02d}{ \index{obuf@{obuf}!obuf@{obuf}} \index{obuf@{obuf}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef struct {\bf obuf} {\bf obuf}}} \label{group__obuf_g5d21ad371d3d1522bbec6915145ef02d} Output specific buffer typedef. \hypertarget{group__obuf_ga39dfad0e8745cdcb31ffe6353758c48}{ \index{obuf@{obuf}!obuf\_\-fn@{obuf\_\-fn}} \index{obuf\_\-fn@{obuf\_\-fn}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef int($\ast$ {\bf obuf\_\-fn})(int, const void $\ast$, unsigned long)}} \label{group__obuf_ga39dfad0e8745cdcb31ffe6353758c48} {\tt \hyperlink{structobuf}{obuf}} write function pointer prototype. \subsection{Function Documentation} \hypertarget{group__obuf_g610bff3f5c0764568ca4a4741340cfcc}{ \index{obuf@{obuf}!obuf\_\-close@{obuf\_\-close}} \index{obuf\_\-close@{obuf\_\-close}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-close ({\bf obuf} $\ast$ {\em out})}} \label{group__obuf_g610bff3f5c0764568ca4a4741340cfcc} Flush and close the {\tt \hyperlink{structobuf}{obuf}} \hypertarget{group__obuf_g3076cb0bd4009f248207baba2e420197}{ \index{obuf@{obuf}!obuf\_\-endl@{obuf\_\-endl}} \index{obuf\_\-endl@{obuf\_\-endl}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-endl ({\bf obuf} $\ast$ {\em out})}} \label{group__obuf_g3076cb0bd4009f248207baba2e420197} Write a newline to the {\tt \hyperlink{structobuf}{obuf}} and flush it. \hypertarget{group__obuf_g6ddac728408520e6d56da0505c6e03ad}{ \index{obuf@{obuf}!obuf\_\-flush@{obuf\_\-flush}} \index{obuf\_\-flush@{obuf\_\-flush}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-flush ({\bf obuf} $\ast$ {\em out})}} \label{group__obuf_g6ddac728408520e6d56da0505c6e03ad} Write all pending data in the {\tt \hyperlink{structobuf}{obuf}} to the file descriptor. \hypertarget{group__obuf_gb9eeed3514560048a940ee7b24dd1347}{ \index{obuf@{obuf}!obuf\_\-init@{obuf\_\-init}} \index{obuf\_\-init@{obuf\_\-init}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-init ({\bf obuf} $\ast$ {\em out}, int {\em fd}, {\bf obuf\_\-fn} {\em fn}, unsigned {\em flags}, unsigned {\em bufsize})}} \label{group__obuf_gb9eeed3514560048a940ee7b24dd1347} Initialize an {\tt \hyperlink{structobuf}{obuf}} from an already-opened file descriptor. \hypertarget{group__obuf_g3dea7751e7b1097224be09ff1e71888f}{ \index{obuf@{obuf}!obuf\_\-open@{obuf\_\-open}} \index{obuf\_\-open@{obuf\_\-open}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-open ({\bf obuf} $\ast$ {\em out}, const char $\ast$ {\em filename}, int {\em oflags}, int {\em mode}, unsigned {\em bufsize})}} \label{group__obuf_g3dea7751e7b1097224be09ff1e71888f} Initialize an {\tt \hyperlink{structobuf}{obuf}} by opening a file for writing. \hypertarget{group__obuf_g608698be2e8e24767cf1b27716653660}{ \index{obuf@{obuf}!obuf\_\-pad@{obuf\_\-pad}} \index{obuf\_\-pad@{obuf\_\-pad}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-pad ({\bf obuf} $\ast$ {\em out}, unsigned {\em width}, char {\em ch})}} \label{group__obuf_g608698be2e8e24767cf1b27716653660} Pad the output with {\tt width} instances of the single character {\tt ch}. \hypertarget{group__obuf_g9ec0f20a3f1928e44691f57425703b57}{ \index{obuf@{obuf}!obuf\_\-put2s@{obuf\_\-put2s}} \index{obuf\_\-put2s@{obuf\_\-put2s}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-put2s ({\bf obuf} $\ast$ {\em out}, const char $\ast$ {\em s1}, const char $\ast$ {\em s2})}} \label{group__obuf_g9ec0f20a3f1928e44691f57425703b57} Write 2 C strings to the {\tt \hyperlink{structobuf}{obuf}} \hypertarget{group__obuf_gb34e2094f765c45757394f1a0c13de9b}{ \index{obuf@{obuf}!obuf\_\-put3s@{obuf\_\-put3s}} \index{obuf\_\-put3s@{obuf\_\-put3s}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-put3s ({\bf obuf} $\ast$ {\em out}, const char $\ast$ {\em s1}, const char $\ast$ {\em s2}, const char $\ast$ {\em s3})}} \label{group__obuf_gb34e2094f765c45757394f1a0c13de9b} Write 3 C strings to the {\tt \hyperlink{structobuf}{obuf}} \hypertarget{group__obuf_ge39b3c2511685f4fe16e62fd9d509136}{ \index{obuf@{obuf}!obuf\_\-put4s@{obuf\_\-put4s}} \index{obuf\_\-put4s@{obuf\_\-put4s}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-put4s ({\bf obuf} $\ast$ {\em out}, const char $\ast$ {\em s1}, const char $\ast$ {\em s2}, const char $\ast$ {\em s3}, const char $\ast$ {\em s4})}} \label{group__obuf_ge39b3c2511685f4fe16e62fd9d509136} Write 4 C strings to the {\tt \hyperlink{structobuf}{obuf}} \hypertarget{group__obuf_g7cb66052946afe11c239ef23ea767c5a}{ \index{obuf@{obuf}!obuf\_\-put5s@{obuf\_\-put5s}} \index{obuf\_\-put5s@{obuf\_\-put5s}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-put5s ({\bf obuf} $\ast$ {\em out}, const char $\ast$ {\em s1}, const char $\ast$ {\em s2}, const char $\ast$ {\em s3}, const char $\ast$ {\em s4}, const char $\ast$ {\em s5})}} \label{group__obuf_g7cb66052946afe11c239ef23ea767c5a} Write 5 C strings to the {\tt \hyperlink{structobuf}{obuf}} \hypertarget{group__obuf_g864c5f97b57eee47292f643648f21d65}{ \index{obuf@{obuf}!obuf\_\-put6s@{obuf\_\-put6s}} \index{obuf\_\-put6s@{obuf\_\-put6s}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-put6s ({\bf obuf} $\ast$ {\em out}, const char $\ast$ {\em s1}, const char $\ast$ {\em s2}, const char $\ast$ {\em s3}, const char $\ast$ {\em s4}, const char $\ast$ {\em s5}, const char $\ast$ {\em s6})}} \label{group__obuf_g864c5f97b57eee47292f643648f21d65} Write 6 C strings to the {\tt \hyperlink{structobuf}{obuf}} \hypertarget{group__obuf_ga71c9bbbbacfe3b4a13ec56804ac6d13}{ \index{obuf@{obuf}!obuf\_\-put7s@{obuf\_\-put7s}} \index{obuf\_\-put7s@{obuf\_\-put7s}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-put7s ({\bf obuf} $\ast$ {\em out}, const char $\ast$ {\em s1}, const char $\ast$ {\em s2}, const char $\ast$ {\em s3}, const char $\ast$ {\em s4}, const char $\ast$ {\em s5}, const char $\ast$ {\em s6}, const char $\ast$ {\em s7})}} \label{group__obuf_ga71c9bbbbacfe3b4a13ec56804ac6d13} Write 7 C strings to the {\tt \hyperlink{structobuf}{obuf}} \hypertarget{group__obuf_g875c0262a092dcb73bcbd0a3fa557d26}{ \index{obuf@{obuf}!obuf\_\-putc@{obuf\_\-putc}} \index{obuf\_\-putc@{obuf\_\-putc}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-putc ({\bf obuf} $\ast$ {\em out}, char {\em ch})}} \label{group__obuf_g875c0262a092dcb73bcbd0a3fa557d26} Write a single character to the {\tt \hyperlink{structobuf}{obuf}} \hypertarget{group__obuf_gf9c5d5661c1da0dffbc3c2c8c951f3ca}{ \index{obuf@{obuf}!obuf\_\-putf@{obuf\_\-putf}} \index{obuf\_\-putf@{obuf\_\-putf}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-putf ({\bf obuf} $\ast$ {\em out}, const char $\ast$ {\em format}, {\em ...})}} \label{group__obuf_gf9c5d5661c1da0dffbc3c2c8c951f3ca} Write a formatted string using {\tt fmt\_\-multi} from variable arguments \begin{Desc} \item[Examples: ]\par \hyperlink{adt_2ghash__test_8c-example}{adt/ghash\_\-test.c}.\end{Desc} \hypertarget{group__obuf_gb0e0f78155d17a50e83d61d2f686d945}{ \index{obuf@{obuf}!obuf\_\-putfv@{obuf\_\-putfv}} \index{obuf\_\-putfv@{obuf\_\-putfv}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-putfv ({\bf obuf} $\ast$ {\em out}, const char $\ast$ {\em format}, va\_\-list {\em ap})}} \label{group__obuf_gb0e0f78155d17a50e83d61d2f686d945} Write a formatted string using {\tt fmt\_\-multi} from a {\tt va\_\-list} \hypertarget{group__obuf_gd0ee3632bc0d26a9819377aba16d406f}{ \index{obuf@{obuf}!obuf\_\-puti@{obuf\_\-puti}} \index{obuf\_\-puti@{obuf\_\-puti}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-puti ({\bf obuf} $\ast$ {\em out}, long {\em data})}} \label{group__obuf_gd0ee3632bc0d26a9819377aba16d406f} Write a signed integer as decimal to the {\tt \hyperlink{structobuf}{obuf}}. \begin{Desc} \item[Examples: ]\par \hyperlink{adt_2gqueue__test_8c-example}{adt/gqueue\_\-test.c}, and \hyperlink{adt_2gstack__test_8c-example}{adt/gstack\_\-test.c}.\end{Desc} \hypertarget{group__obuf_g54410e8023b4cf933657c1aad5842413}{ \index{obuf@{obuf}!obuf\_\-putill@{obuf\_\-putill}} \index{obuf\_\-putill@{obuf\_\-putill}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-putill ({\bf obuf} $\ast$ {\em out}, long long {\em data})}} \label{group__obuf_g54410e8023b4cf933657c1aad5842413} Write a signed long long integer as decimal to the {\tt \hyperlink{structobuf}{obuf}}. \hypertarget{group__obuf_g2cf372af70bc6147a2db479d8a85df5d}{ \index{obuf@{obuf}!obuf\_\-putiw@{obuf\_\-putiw}} \index{obuf\_\-putiw@{obuf\_\-putiw}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-putiw ({\bf obuf} $\ast$ {\em out}, long {\em data}, unsigned {\em width}, char {\em pad})}} \label{group__obuf_g2cf372af70bc6147a2db479d8a85df5d} Write a signed integer as decimal to the {\tt \hyperlink{structobuf}{obuf}} with padding. \hypertarget{group__obuf_g9735a1718e14888c15a68391fcfa8a32}{ \index{obuf@{obuf}!obuf\_\-putiwll@{obuf\_\-putiwll}} \index{obuf\_\-putiwll@{obuf\_\-putiwll}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-putiwll ({\bf obuf} $\ast$ {\em out}, long long {\em data}, unsigned {\em width}, char {\em pad})}} \label{group__obuf_g9735a1718e14888c15a68391fcfa8a32} Write a signed long long integer as decimal to the {\tt \hyperlink{structobuf}{obuf}} with padding. \hypertarget{group__obuf_ged03a0d0778f8b3e6af12cad3446eadd}{ \index{obuf@{obuf}!obuf\_\-putnetstring@{obuf\_\-putnetstring}} \index{obuf\_\-putnetstring@{obuf\_\-putnetstring}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-putnetstring ({\bf obuf} $\ast$ {\em out}, const char $\ast$ {\em data}, unsigned {\em datalen})}} \label{group__obuf_ged03a0d0778f8b3e6af12cad3446eadd} Write the binary block to the {\tt \hyperlink{structobuf}{obuf}} as a \char`\"{}netstring\char`\"{}. \hypertarget{group__obuf_g04c43549b6398ac77ef9f2364ddb26f2}{ \index{obuf@{obuf}!obuf\_\-putns@{obuf\_\-putns}} \index{obuf\_\-putns@{obuf\_\-putns}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-putns ({\bf obuf} $\ast$ {\em out}, unsigned int {\em count}, {\em ...})}} \label{group__obuf_g04c43549b6398ac77ef9f2364ddb26f2} Write N C strings to the {\tt \hyperlink{structobuf}{obuf}} \hypertarget{group__obuf_geb191f028a654a047f02148a9af9811d}{ \index{obuf@{obuf}!obuf\_\-putsflush@{obuf\_\-putsflush}} \index{obuf\_\-putsflush@{obuf\_\-putsflush}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-putsflush ({\bf obuf} $\ast$ {\em out}, const char $\ast$ {\em str})}} \label{group__obuf_geb191f028a654a047f02148a9af9811d} Write a C string to the {\tt \hyperlink{structobuf}{obuf}} and flush it. \hypertarget{group__obuf_g4e8023a4f1fdc030650fcbbac89d73ea}{ \index{obuf@{obuf}!obuf\_\-putsllnumw@{obuf\_\-putsllnumw}} \index{obuf\_\-putsllnumw@{obuf\_\-putsllnumw}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-putsllnumw ({\bf obuf} $\ast$ {\em out}, long long {\em data}, unsigned {\em width}, char {\em pad}, unsigned {\em base}, const char $\ast$ {\em digits})}} \label{group__obuf_g4e8023a4f1fdc030650fcbbac89d73ea} Write a signed long long integer to the {\tt \hyperlink{structobuf}{obuf}} with optional padding. \hypertarget{group__obuf_gc91df37cd8f3fbb0384e296440d1ce42}{ \index{obuf@{obuf}!obuf\_\-putsnumw@{obuf\_\-putsnumw}} \index{obuf\_\-putsnumw@{obuf\_\-putsnumw}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-putsnumw ({\bf obuf} $\ast$ {\em out}, long {\em data}, unsigned {\em width}, char {\em pad}, unsigned {\em base}, const char $\ast$ {\em digits})}} \label{group__obuf_gc91df37cd8f3fbb0384e296440d1ce42} Write a signed integer to the {\tt \hyperlink{structobuf}{obuf}} with optional padding. \hypertarget{group__obuf_g75231da78e1b0dcc2a9307f487c0a47d}{ \index{obuf@{obuf}!obuf\_\-putu@{obuf\_\-putu}} \index{obuf\_\-putu@{obuf\_\-putu}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-putu ({\bf obuf} $\ast$ {\em out}, unsigned long {\em data})}} \label{group__obuf_g75231da78e1b0dcc2a9307f487c0a47d} Write an unsigned integer as decimal to the {\tt \hyperlink{structobuf}{obuf}}. \hypertarget{group__obuf_geb1a75d1bc3f7ae6bfaa91773bac1b0a}{ \index{obuf@{obuf}!obuf\_\-putull@{obuf\_\-putull}} \index{obuf\_\-putull@{obuf\_\-putull}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-putull ({\bf obuf} $\ast$ {\em out}, unsigned long long {\em data})}} \label{group__obuf_geb1a75d1bc3f7ae6bfaa91773bac1b0a} Write an unsigned long long integer as decimal to the {\tt \hyperlink{structobuf}{obuf}}. \hypertarget{group__obuf_g8df75140cd8e7e7e09d3416e1a89a4e3}{ \index{obuf@{obuf}!obuf\_\-putullnumw@{obuf\_\-putullnumw}} \index{obuf\_\-putullnumw@{obuf\_\-putullnumw}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-putullnumw ({\bf obuf} $\ast$ {\em out}, unsigned long long {\em data}, unsigned {\em width}, char {\em pad}, unsigned {\em base}, const char $\ast$ {\em digits})}} \label{group__obuf_g8df75140cd8e7e7e09d3416e1a89a4e3} Write an unsigned long long integer to the {\tt \hyperlink{structobuf}{obuf}} with optional padding. \hypertarget{group__obuf_gd5b1e82de1a914549ce29defdbd11af9}{ \index{obuf@{obuf}!obuf\_\-putunumw@{obuf\_\-putunumw}} \index{obuf\_\-putunumw@{obuf\_\-putunumw}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-putunumw ({\bf obuf} $\ast$ {\em out}, unsigned long {\em data}, unsigned {\em width}, char {\em pad}, unsigned {\em base}, const char $\ast$ {\em digits})}} \label{group__obuf_gd5b1e82de1a914549ce29defdbd11af9} Write an unsigned integer to the {\tt \hyperlink{structobuf}{obuf}} with optional padding. \hypertarget{group__obuf_gb733b82803b4ddf12e7ff1140cd4eaf4}{ \index{obuf@{obuf}!obuf\_\-putuw@{obuf\_\-putuw}} \index{obuf\_\-putuw@{obuf\_\-putuw}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-putuw ({\bf obuf} $\ast$ {\em out}, unsigned long {\em data}, unsigned {\em width}, char {\em pad})}} \label{group__obuf_gb733b82803b4ddf12e7ff1140cd4eaf4} Write an unsigned integer as decimal to the {\tt \hyperlink{structobuf}{obuf}} with padding. \hypertarget{group__obuf_gbd73e29249fddf85754a3248ad9b8909}{ \index{obuf@{obuf}!obuf\_\-putuwll@{obuf\_\-putuwll}} \index{obuf\_\-putuwll@{obuf\_\-putuwll}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-putuwll ({\bf obuf} $\ast$ {\em out}, unsigned long long {\em data}, unsigned {\em width}, char {\em pad})}} \label{group__obuf_gbd73e29249fddf85754a3248ad9b8909} Write an unsigned long long integer as decimal to the {\tt \hyperlink{structobuf}{obuf}} with padding. \hypertarget{group__obuf_gf571b1aee85e5536ead2f139fe723a89}{ \index{obuf@{obuf}!obuf\_\-putX@{obuf\_\-putX}} \index{obuf\_\-putX@{obuf\_\-putX}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-putX ({\bf obuf} $\ast$ {\em out}, unsigned long {\em data})}} \label{group__obuf_gf571b1aee85e5536ead2f139fe723a89} Write an unsigned integer as (upper-case) hexadecimal to the {\tt \hyperlink{structobuf}{obuf}}. \hypertarget{group__obuf_g73b0e1bad7d14bce50996b0a79e3e60f}{ \index{obuf@{obuf}!obuf\_\-putx@{obuf\_\-putx}} \index{obuf\_\-putx@{obuf\_\-putx}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-putx ({\bf obuf} $\ast$ {\em out}, unsigned long {\em data})}} \label{group__obuf_g73b0e1bad7d14bce50996b0a79e3e60f} Write an unsigned integer as (lower-case) hexadecimal to the {\tt \hyperlink{structobuf}{obuf}}. \hypertarget{group__obuf_g2991868a52edf6fffa2ea17f5f8fee93}{ \index{obuf@{obuf}!obuf\_\-putXll@{obuf\_\-putXll}} \index{obuf\_\-putXll@{obuf\_\-putXll}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-putXll ({\bf obuf} $\ast$ {\em out}, unsigned long long {\em data})}} \label{group__obuf_g2991868a52edf6fffa2ea17f5f8fee93} Write an unsigned long long integer as (upper-case) hexadecimal to the {\tt \hyperlink{structobuf}{obuf}}. \hypertarget{group__obuf_ge0ed6f7cf0658c006863ace5c2716a79}{ \index{obuf@{obuf}!obuf\_\-putxll@{obuf\_\-putxll}} \index{obuf\_\-putxll@{obuf\_\-putxll}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-putxll ({\bf obuf} $\ast$ {\em out}, unsigned long long {\em data})}} \label{group__obuf_ge0ed6f7cf0658c006863ace5c2716a79} Write an unsigned long long integer as (lower-case) hexadecimal to the {\tt \hyperlink{structobuf}{obuf}}. \hypertarget{group__obuf_g4349ac8d9999d042abd3e885a96b42e0}{ \index{obuf@{obuf}!obuf\_\-putXw@{obuf\_\-putXw}} \index{obuf\_\-putXw@{obuf\_\-putXw}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-putXw ({\bf obuf} $\ast$ {\em out}, unsigned long {\em data}, unsigned {\em width}, char {\em pad})}} \label{group__obuf_g4349ac8d9999d042abd3e885a96b42e0} Write an unsigned integer as (upper-case) hexadecimal to the {\tt \hyperlink{structobuf}{obuf}} with padding. \hypertarget{group__obuf_g63bc25bd5decb5affccd967701181e02}{ \index{obuf@{obuf}!obuf\_\-putxw@{obuf\_\-putxw}} \index{obuf\_\-putxw@{obuf\_\-putxw}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-putxw ({\bf obuf} $\ast$ {\em out}, unsigned long {\em data}, unsigned {\em width}, char {\em pad})}} \label{group__obuf_g63bc25bd5decb5affccd967701181e02} Write an unsigned integer as (lower-case) hexadecimal to the {\tt \hyperlink{structobuf}{obuf}} with padding. \hypertarget{group__obuf_g89141b7b75a203e1f2ba61a8396be456}{ \index{obuf@{obuf}!obuf\_\-putXwll@{obuf\_\-putXwll}} \index{obuf\_\-putXwll@{obuf\_\-putXwll}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-putXwll ({\bf obuf} $\ast$ {\em out}, unsigned long long {\em data}, unsigned {\em width}, char {\em pad})}} \label{group__obuf_g89141b7b75a203e1f2ba61a8396be456} Write an unsigned long long integer as (upper-case) hexadecimal to the {\tt \hyperlink{structobuf}{obuf}} with padding. \hypertarget{group__obuf_g34cdd4dc150b9ebeebbe6b4e63b16f1a}{ \index{obuf@{obuf}!obuf\_\-putxwll@{obuf\_\-putxwll}} \index{obuf\_\-putxwll@{obuf\_\-putxwll}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-putxwll ({\bf obuf} $\ast$ {\em out}, unsigned long long {\em data}, unsigned {\em width}, char {\em pad})}} \label{group__obuf_g34cdd4dc150b9ebeebbe6b4e63b16f1a} Write an unsigned long long integer as (lower-case) hexadecimal to the {\tt \hyperlink{structobuf}{obuf}} with padding. \hypertarget{group__obuf_g2f5fa6c89c5d58023125710fa42285f4}{ \index{obuf@{obuf}!obuf\_\-seek@{obuf\_\-seek}} \index{obuf\_\-seek@{obuf\_\-seek}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-seek ({\bf obuf} $\ast$ {\em out}, unsigned {\em offset})}} \label{group__obuf_g2f5fa6c89c5d58023125710fa42285f4} Set the effective write position. \hypertarget{group__obuf_gbef86026d605262194142e28a3e192a4}{ \index{obuf@{obuf}!obuf\_\-sign\_\-pad@{obuf\_\-sign\_\-pad}} \index{obuf\_\-sign\_\-pad@{obuf\_\-sign\_\-pad}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-sign\_\-pad ({\bf obuf} $\ast$ {\em out}, int {\em sign}, unsigned {\em width}, char {\em pad})}} \label{group__obuf_gbef86026d605262194142e28a3e192a4} Pad the output with {\tt width} instances of the single character {\tt ch}, preceded by an optional negative sign at an appropriate place. If the pad character is {\tt '0'} then any negative sign is placed as the first character, followed by padding. Otherwise, it is preceded by the padding. \hypertarget{group__obuf_g926e867fc325f0b221ce507d6a6285e4}{ \index{obuf@{obuf}!obuf\_\-sync@{obuf\_\-sync}} \index{obuf\_\-sync@{obuf\_\-sync}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-sync ({\bf obuf} $\ast$ {\em out})}} \label{group__obuf_g926e867fc325f0b221ce507d6a6285e4} Flush the {\tt \hyperlink{structobuf}{obuf}} and then {\tt fsync} the file descriptor. \hypertarget{group__obuf_g03421ac22a31290e1e94462257b13781}{ \index{obuf@{obuf}!obuf\_\-write@{obuf\_\-write}} \index{obuf\_\-write@{obuf\_\-write}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-write ({\bf obuf} $\ast$ {\em out}, const char $\ast$ {\em data}, unsigned {\em datalen})}} \label{group__obuf_g03421ac22a31290e1e94462257b13781} Write a block of data to the {\tt \hyperlink{structobuf}{obuf}} \hypertarget{group__obuf_g165f549a8931c793af8aef1db88a64d4}{ \index{obuf@{obuf}!obuf\_\-write\_\-large@{obuf\_\-write\_\-large}} \index{obuf\_\-write\_\-large@{obuf\_\-write\_\-large}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int obuf\_\-write\_\-large ({\bf obuf} $\ast$ {\em out}, const char $\ast$ {\em data}, unsigned {\em datalen})}} \label{group__obuf_g165f549a8931c793af8aef1db88a64d4} Write a large block of data to the {\tt \hyperlink{structobuf}{obuf}}, avoiding copying. \subsection{Variable Documentation} \hypertarget{group__obuf_gfa9e5277c3780b0832a2a278eef7c59e}{ \index{obuf@{obuf}!errbuf@{errbuf}} \index{errbuf@{errbuf}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf obuf} {\bf errbuf}}} \label{group__obuf_gfa9e5277c3780b0832a2a278eef7c59e} Output buffer for {\tt stderr} \hypertarget{group__obuf_g7786baf4fe0e6d14e304536eb40d6354}{ \index{obuf@{obuf}!outbuf@{outbuf}} \index{outbuf@{outbuf}!obuf@{obuf}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf obuf} {\bf outbuf}}} \label{group__obuf_g7786baf4fe0e6d14e304536eb40d6354} Output buffer for {\tt stdout} \begin{Desc} \item[Examples: ]\par \hyperlink{adt_2ghash__test_8c-example}{adt/ghash\_\-test.c}, \hyperlink{adt_2gqueue__test_8c-example}{adt/gqueue\_\-test.c}, and \hyperlink{adt_2gstack__test_8c-example}{adt/gstack\_\-test.c}.\end{Desc} bglibs-1.106/doc/latex/group__adt__gqueue.tex0000664000076400007640000001634511147311327020602 0ustar bruceguenter\hypertarget{group__adt__gqueue}{ \section{adt gqueue: Generic simple queue.} \label{group__adt__gqueue}\index{adt gqueue: Generic simple queue.@{adt gqueue: Generic simple queue.}} } \subsection*{Data Structures} \begin{CompactItemize} \item struct \hyperlink{structgqueue__node}{gqueue\_\-node} \item struct \hyperlink{structgqueue}{gqueue} \end{CompactItemize} \subsection*{Defines} \begin{CompactItemize} \item \#define \hyperlink{group__adt__gqueue_gb1fc0e8ea556c098adf58484aac34622}{GQUEUE\_\-DECL}(PREFIX, TYPE) \item \#define \hyperlink{group__adt__gqueue_g479aaa6063ce1b74c80107e508f295fd}{GQUEUE\_\-PUSH\_\-DEFN}(PREFIX, TYPE, COPY) \item \#define \hyperlink{group__adt__gqueue_g37c8e9aef40bd5d22b303b62a8e6bd2e}{GQUEUE\_\-TOP\_\-DEFN}(PREFIX, TYPE) \item \#define \hyperlink{group__adt__gqueue_gc1cf75461e0f2d3f62fef39b88d9d18a}{GQUEUE\_\-POP\_\-DEFN}(PREFIX, FREE) \item \#define \hyperlink{group__adt__gqueue_g8fc5d1d658bcffae05b406d1bdb20988}{GQUEUE\_\-DEFN}(PREFIX, TYPE, COPY, FREE) \end{CompactItemize} \subsection*{Functions} \begin{CompactItemize} \item int \hyperlink{group__adt__gqueue_gdfc89797b379787018452c54b27dcf47}{gqueue\_\-push} (struct \hyperlink{structgqueue}{gqueue} $\ast$d, unsigned datasize, const void $\ast$data, \hyperlink{group__adt_ga98f7f3499407a5dc1afdcbb20df2e15}{adt\_\-copy\_\-fn} $\ast$fn) \item void $\ast$ \hyperlink{group__adt__gqueue_g904529a3ba107ceae877634fa0a09572}{gqueue\_\-top} (const struct \hyperlink{structgqueue}{gqueue} $\ast$q) \item void \hyperlink{group__adt__gqueue_gaac0a9032a341307e9ab54458f1d7d2e}{gqueue\_\-pop} (struct \hyperlink{structgqueue}{gqueue} $\ast$q, \hyperlink{group__adt_g87ba7ca9dce36c22fe75a730a1d768a9}{adt\_\-free\_\-fn} $\ast$fn) \end{CompactItemize} \subsection{Detailed Description} 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. \subsection{Define Documentation} \hypertarget{group__adt__gqueue_gb1fc0e8ea556c098adf58484aac34622}{ \index{adt\_\-gqueue@{adt\_\-gqueue}!GQUEUE\_\-DECL@{GQUEUE\_\-DECL}} \index{GQUEUE\_\-DECL@{GQUEUE\_\-DECL}!adt_gqueue@{adt\_\-gqueue}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define GQUEUE\_\-DECL(PREFIX, TYPE)}} \label{group__adt__gqueue_gb1fc0e8ea556c098adf58484aac34622} \textbf{Value:} \begin{Code}\begin{verbatim}extern int PREFIX##_push(struct gqueue* q, TYPE const* data); \ extern TYPE* PREFIX##_top(struct gqueue* q); \ extern void PREFIX##_pop(struct gqueue* q); \end{verbatim} \end{Code} Declare specialized {\tt \hyperlink{structgqueue}{gqueue}} functions. \begin{Desc} \item[Examples: ]\par \hyperlink{adt_2gqueue__test_8c-example}{adt/gqueue\_\-test.c}.\end{Desc} \hypertarget{group__adt__gqueue_g8fc5d1d658bcffae05b406d1bdb20988}{ \index{adt\_\-gqueue@{adt\_\-gqueue}!GQUEUE\_\-DEFN@{GQUEUE\_\-DEFN}} \index{GQUEUE\_\-DEFN@{GQUEUE\_\-DEFN}!adt_gqueue@{adt\_\-gqueue}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define GQUEUE\_\-DEFN(PREFIX, TYPE, COPY, FREE)}} \label{group__adt__gqueue_g8fc5d1d658bcffae05b406d1bdb20988} \textbf{Value:} \begin{Code}\begin{verbatim}GQUEUE_PUSH_DEFN(PREFIX,TYPE,COPY) \ GQUEUE_TOP_DEFN(PREFIX,TYPE) \ GQUEUE_POP_DEFN(PREFIX,FREE) \end{verbatim} \end{Code} Define all the specialized {\tt \hyperlink{structgqueue}{gqueue}} functions. If {\tt COPY} is {\tt NULL}, a simple memcpy is used instead. If {\tt FREE} is {\tt NULL}, no attempt is made to free the data. \begin{Desc} \item[Examples: ]\par \hyperlink{adt_2gqueue__test_8c-example}{adt/gqueue\_\-test.c}.\end{Desc} \hypertarget{group__adt__gqueue_gc1cf75461e0f2d3f62fef39b88d9d18a}{ \index{adt\_\-gqueue@{adt\_\-gqueue}!GQUEUE\_\-POP\_\-DEFN@{GQUEUE\_\-POP\_\-DEFN}} \index{GQUEUE\_\-POP\_\-DEFN@{GQUEUE\_\-POP\_\-DEFN}!adt_gqueue@{adt\_\-gqueue}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define GQUEUE\_\-POP\_\-DEFN(PREFIX, FREE)}} \label{group__adt__gqueue_gc1cf75461e0f2d3f62fef39b88d9d18a} \textbf{Value:} \begin{Code}\begin{verbatim}void PREFIX##_pop(struct gqueue* q) { \ gqueue_pop(q, (adt_free_fn*)(FREE)); \ } \end{verbatim} \end{Code} Define a specialized {\tt \hyperlink{structgqueue}{gqueue}} pop function. \hypertarget{group__adt__gqueue_g479aaa6063ce1b74c80107e508f295fd}{ \index{adt\_\-gqueue@{adt\_\-gqueue}!GQUEUE\_\-PUSH\_\-DEFN@{GQUEUE\_\-PUSH\_\-DEFN}} \index{GQUEUE\_\-PUSH\_\-DEFN@{GQUEUE\_\-PUSH\_\-DEFN}!adt_gqueue@{adt\_\-gqueue}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define GQUEUE\_\-PUSH\_\-DEFN(PREFIX, TYPE, COPY)}} \label{group__adt__gqueue_g479aaa6063ce1b74c80107e508f295fd} \textbf{Value:} \begin{Code}\begin{verbatim}int PREFIX##_push(struct gqueue* q, TYPE const* data) { \ return gqueue_push(q, sizeof *data, data, (adt_copy_fn*)COPY); \ } \end{verbatim} \end{Code} Define a specialized {\tt \hyperlink{structgqueue}{gqueue}} push function. \hypertarget{group__adt__gqueue_g37c8e9aef40bd5d22b303b62a8e6bd2e}{ \index{adt\_\-gqueue@{adt\_\-gqueue}!GQUEUE\_\-TOP\_\-DEFN@{GQUEUE\_\-TOP\_\-DEFN}} \index{GQUEUE\_\-TOP\_\-DEFN@{GQUEUE\_\-TOP\_\-DEFN}!adt_gqueue@{adt\_\-gqueue}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define GQUEUE\_\-TOP\_\-DEFN(PREFIX, TYPE)}} \label{group__adt__gqueue_g37c8e9aef40bd5d22b303b62a8e6bd2e} \textbf{Value:} \begin{Code}\begin{verbatim}TYPE* PREFIX##_top(struct gqueue* q) { \ return (q->head == 0) ? 0 : (TYPE*)q->head->data; \ } \end{verbatim} \end{Code} Define a specialized {\tt \hyperlink{structgqueue}{gqueue}} top function. \subsection{Function Documentation} \hypertarget{group__adt__gqueue_gaac0a9032a341307e9ab54458f1d7d2e}{ \index{adt\_\-gqueue@{adt\_\-gqueue}!gqueue\_\-pop@{gqueue\_\-pop}} \index{gqueue\_\-pop@{gqueue\_\-pop}!adt_gqueue@{adt\_\-gqueue}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void gqueue\_\-pop (struct {\bf gqueue} $\ast$ {\em q}, {\bf adt\_\-free\_\-fn} $\ast$ {\em fn})}} \label{group__adt__gqueue_gaac0a9032a341307e9ab54458f1d7d2e} Remove the first (least recently pushed) element from the queue. If the free function {\tt fn} is {\tt NULL} no data freeing is done. Note that this does not return a pointer to the popped item, as once the item has been popped it is also freed. \hypertarget{group__adt__gqueue_gdfc89797b379787018452c54b27dcf47}{ \index{adt\_\-gqueue@{adt\_\-gqueue}!gqueue\_\-push@{gqueue\_\-push}} \index{gqueue\_\-push@{gqueue\_\-push}!adt_gqueue@{adt\_\-gqueue}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int gqueue\_\-push (struct {\bf gqueue} $\ast$ {\em q}, unsigned {\em datasize}, const void $\ast$ {\em data}, {\bf adt\_\-copy\_\-fn} $\ast$ {\em fn})}} \label{group__adt__gqueue_gdfc89797b379787018452c54b27dcf47} Add a new element onto the queue. If the copy function {\tt fn} is {\tt NULL} memcpy is used in its place. \hypertarget{group__adt__gqueue_g904529a3ba107ceae877634fa0a09572}{ \index{adt\_\-gqueue@{adt\_\-gqueue}!gqueue\_\-top@{gqueue\_\-top}} \index{gqueue\_\-top@{gqueue\_\-top}!adt_gqueue@{adt\_\-gqueue}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ gqueue\_\-top (const struct {\bf gqueue} $\ast$ {\em q})}} \label{group__adt__gqueue_g904529a3ba107ceae877634fa0a09572} Return the address of first (least recently pushed) element in the queue. bglibs-1.106/doc/latex/adt_2gstack__test_8c-example.tex0000664000076400007640000000113011147311327022336 0ustar bruceguenter\hypertarget{adt_2gstack__test_8c-example}{ \section{adt/gstack\_\-test.c} } \begin{DocInclude}\begin{verbatim}#include #include #include "gstack.h" #ifdef SELFTEST_MAIN #include "selftest.c" GSTACK_DECL(test,int); GSTACK_DEFN(test,int,0,0); static struct gstack stack; MAIN { int i; int* p; for (i = 0; i < 4; ++i) debugfn(test_push(&stack, &i)); while ((p = test_top(&stack)) != 0) { obuf_puti(&outbuf, *p); NL(); test_pop(&stack); } } #endif #ifdef SELFTEST_EXP result=1 result=1 result=1 result=1 3 2 1 0 #endif \end{verbatim} \end{DocInclude} bglibs-1.106/doc/latex/Makefile0000664000076400007640000000152711147311327015657 0ustar bruceguenterall: clean refman.dvi ps: refman.ps pdf: refman.pdf ps_2on1: refman_2on1.ps pdf_2on1: refman_2on1.pdf refman.ps: refman.dvi dvips -o refman.ps refman.dvi refman.pdf: refman.ps ps2pdf refman.ps refman.pdf refman.dvi: refman.tex doxygen.sty echo "Running latex..." latex refman.tex echo "Running makeindex..." makeindex refman.idx echo "Rerunning latex...." latex refman.tex latex_count=5 ; \ while egrep -s 'Rerun (LaTeX|to get cross-references right)' refman.log && [ $$latex_count -gt 0 ] ;\ do \ echo "Rerunning latex...." ;\ latex refman.tex ;\ latex_count=`expr $$latex_count - 1` ;\ done refman_2on1.ps: refman.ps psnup -2 refman.ps >refman_2on1.ps refman_2on1.pdf: refman_2on1.ps ps2pdf refman_2on1.ps refman_2on1.pdf clean: rm -f *.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log *.out refman.pdf bglibs-1.106/doc/latex/group__adt__ghash.tex0000664000076400007640000007576411147311327020413 0ustar bruceguenter\hypertarget{group__adt__ghash}{ \section{adt ghash: Generic hash tables.} \label{group__adt__ghash}\index{adt ghash: Generic hash tables.@{adt ghash: Generic hash tables.}} } \subsection*{Data Structures} \begin{CompactItemize} \item struct \hyperlink{structghash}{ghash} \item struct \hyperlink{structghashiter}{ghashiter} \end{CompactItemize} \subsection*{Defines} \begin{CompactItemize} \item \#define \hyperlink{group__adt__ghash_g06408a9495c3264536eb441f2cfe21f0}{ghash\_\-entry\_\-hash}(P)~($\ast$(\hyperlink{group__adt_gab1a0335d8d46afee323cf2b3d132145}{adt\_\-hash\_\-t}$\ast$)(P)) \item \#define \hyperlink{group__adt__ghash_g3f6b74b60133f8479a5351213ad097e9}{ghash\_\-entry\_\-keyptr}(P)~((P)+sizeof(\hyperlink{group__adt_gab1a0335d8d46afee323cf2b3d132145}{adt\_\-hash\_\-t})) \item \#define \hyperlink{group__adt__ghash_gb20f65db478dd9d049cf30b5c0e46798}{ghash\_\-entry\_\-dataptr}(P, L)~((P)+sizeof(\hyperlink{group__adt_gab1a0335d8d46afee323cf2b3d132145}{adt\_\-hash\_\-t})+(L)) \item \#define \hyperlink{group__adt__ghash_g1cf13ef03b3c316a344d5a7f5af2ef9f}{ghash\_\-hashb}~adt\_\-hashb \item \#define \hyperlink{group__adt__ghash_ga793802d1ccac89ba8f2450041b19510}{ghash\_\-hashs}~adt\_\-hashs \item \#define \hyperlink{group__adt__ghash_g67d80747f0e39bdaaaa34c1a3efa45b9}{ghash\_\-hashsp}~adt\_\-hashsp \item \#define \hyperlink{group__adt__ghash_gda65697b1f72b4e162981b6e5ac590e8}{GHASH\_\-STRUCT\_\-ENTRY}(PREFIX, KTYPE, DTYPE) \item \#define \hyperlink{group__adt__ghash_g4275ace9d4a3af4cac0ffb37cfb0285a}{GHASH\_\-KEYOFFSET}(PREFIX)~((unsigned long)\&((struct PREFIX\#\#\_\-entry$\ast$)0) $\rightarrow$ key) \item \#define \hyperlink{group__adt__ghash_gd9dcfdb435e30e32b276f8ba0cc04b0a}{GHASH\_\-DATAOFFSET}(PREFIX)~((unsigned long)\&((struct PREFIX\#\#\_\-entry$\ast$)0) $\rightarrow$ data) \item \#define \hyperlink{group__adt__ghash_g3464d7a289b27e168f574b1d8f8a8be3}{GHASH\_\-KEYSIZE}(PREFIX) \item \#define \hyperlink{group__adt__ghash_gc1e305054793738b716c40999cfea9bf}{GHASH\_\-DECL}(PREFIX, KTYPE, DTYPE) \item \#define \hyperlink{group__adt__ghash_g46a99956ed09905f7f8c32c603347bd3}{GHASH\_\-INIT\_\-DEFN}(PREFIX, KTYPE, DTYPE, HASHFN, CMP, KCOPY, DCOPY, KFREE, DFREE) \item \#define \hyperlink{group__adt__ghash_gf8c5a4c9b22f8c620ed8875de9545f3e}{GHASH\_\-FREE\_\-DEFN}(PREFIX) \item \#define \hyperlink{group__adt__ghash_g928454c59f629fbab0bb20e0fec7033c}{GHASH\_\-ADD\_\-DEFN}(PREFIX, KTYPE, DTYPE) \item \#define \hyperlink{group__adt__ghash_g5c819bab0cc126b53ffe8b7c6e38bb27}{GHASH\_\-SET\_\-DEFN}(PREFIX, KTYPE, DTYPE) \item \#define \hyperlink{group__adt__ghash_gabe08d7de7829f19e51789b06b1a95da}{GHASH\_\-GET\_\-DEFN}(PREFIX, KTYPE) \item \#define \hyperlink{group__adt__ghash_g5462bc3c7d1eea455b6733ce60bd39d5}{GHASH\_\-REBUILD\_\-DEFN}(PREFIX) \item \#define \hyperlink{group__adt__ghash_g2293adaa2df56053b058ff937e7c7254}{GHASH\_\-REHASH\_\-DEFN}(PREFIX) \item \#define \hyperlink{group__adt__ghash_g4de5f1ce7dc082245c22f16635a9f5c5}{GHASH\_\-REMOVE\_\-DEFN}(PREFIX, KTYPE) \item \#define \hyperlink{group__adt__ghash_g28d6134ab05a63015feb36a32ebc6b0f}{GHASH\_\-FOREACH\_\-DEFN}(PREFIX) \item \#define \hyperlink{group__adt__ghash_ge84cc453db9361a299216c9211abc968}{GHASH\_\-SEARCH\_\-DEFN}(PREFIX) \item \#define \hyperlink{group__adt__ghash_g7d55343d7fd6bd32f4f1107be14f219a}{GHASH\_\-DEFN}(PREFIX, KTYPE, DTYPE, HASHFN, CMPFN, KCOPY, DCOPY, KFREE, DFREE) \item \#define \hyperlink{group__adt__ghash_g7db779509845eb235a86abc751e44887}{ghashiter\_\-loop}(I, G)~for(ghashiter\_\-first(I,G);ghashiter\_\-valid(I);ghashiter\_\-next(I)) \end{CompactItemize} \subsection*{Functions} \begin{CompactItemize} \item void \hyperlink{group__adt__ghash_ge774815d548201157ed715de43e3ea9d}{ghash\_\-insert} (struct \hyperlink{structghash}{ghash} $\ast$d, void $\ast$e) \item void $\ast$ \hyperlink{group__adt__ghash_g6550c0dfe54e19112959dba7b164058a}{ghash\_\-add} (struct \hyperlink{structghash}{ghash} $\ast$d, const void $\ast$key, const void $\ast$data) \item void $\ast$ \hyperlink{group__adt__ghash_g199afecbf45d644c8371b612141df54b}{ghash\_\-set} (struct \hyperlink{structghash}{ghash} $\ast$d, const void $\ast$key, const void $\ast$data) \item void \hyperlink{group__adt__ghash_ge609d6df48e1e10a1391d1c94c1dc9ac}{ghash\_\-free} (struct \hyperlink{structghash}{ghash} $\ast$d) \item void $\ast$$\ast$ \hyperlink{group__adt__ghash_g92c681d50d718324d18ea35118593e0b}{ghash\_\-find} (struct \hyperlink{structghash}{ghash} $\ast$d, const void $\ast$key) \item void $\ast$ \hyperlink{group__adt__ghash_g4b02b70d7c67a779a9dca5aa23b7f0f4}{ghash\_\-get} (struct \hyperlink{structghash}{ghash} $\ast$d, const void $\ast$key) \item void \hyperlink{group__adt__ghash_g5b2766288f28271bbcf0c45f17e82b89}{ghash\_\-init} (struct \hyperlink{structghash}{ghash} $\ast$d, unsigned long keysize, unsigned long entrysize, \hyperlink{group__adt_gd6ce53fbc11dbf67ca1c126cd17ee81a}{adt\_\-hash\_\-fn} $\ast$hashfn, \hyperlink{group__adt_g03ed35b7331128b069dc77ab33798782}{adt\_\-cmp\_\-fn} $\ast$keycmp, \hyperlink{group__adt_ga98f7f3499407a5dc1afdcbb20df2e15}{adt\_\-copy\_\-fn} $\ast$keycopy, \hyperlink{group__adt_ga98f7f3499407a5dc1afdcbb20df2e15}{adt\_\-copy\_\-fn} $\ast$datacopy, \hyperlink{group__adt_g87ba7ca9dce36c22fe75a730a1d768a9}{adt\_\-free\_\-fn} $\ast$keyfree, \hyperlink{group__adt_g87ba7ca9dce36c22fe75a730a1d768a9}{adt\_\-free\_\-fn} $\ast$datafree) \item int \hyperlink{group__adt__ghash_g6a6bba38a9aaf20a6b10eeaabaa9b869}{ghash\_\-rebuild} (struct \hyperlink{structghash}{ghash} $\ast$d) \item int \hyperlink{group__adt__ghash_g4beb7c3192aa1ee02a8bf0142758e1af}{ghash\_\-rehash} (struct \hyperlink{structghash}{ghash} $\ast$d) \item int \hyperlink{group__adt__ghash_gad78f59b6f21c62f96285d1583e017fb}{ghash\_\-remove} (struct \hyperlink{structghash}{ghash} $\ast$d, const void $\ast$key) \item void \hyperlink{group__adt__ghash_g4778a040ba311b5925ca15d7ca640bf9}{ghash\_\-foreach} (struct \hyperlink{structghash}{ghash} $\ast$d, void($\ast$fn)(void $\ast$entry)) \item void $\ast$ \hyperlink{group__adt__ghash_g0065ab7531db704c0e51250c519693cc}{ghash\_\-search} (struct \hyperlink{structghash}{ghash} $\ast$d, int($\ast$fn)(const void $\ast$entry)) \item void \hyperlink{group__adt__ghash_g3c21bcee8850adc76bee68ee8dd7df3e}{ghashiter\_\-first} (struct \hyperlink{structghashiter}{ghashiter} $\ast$, const struct \hyperlink{structghash}{ghash} $\ast$) \item int \hyperlink{group__adt__ghash_g03c8f3d628d6ea8c54ecffe4e892178f}{ghashiter\_\-valid} (const struct \hyperlink{structghashiter}{ghashiter} $\ast$) \item void \hyperlink{group__adt__ghash_g733a92b13ce772e7e3810ea65fcd6454}{ghashiter\_\-next} (struct \hyperlink{structghashiter}{ghashiter} $\ast$) \end{CompactItemize} \subsection{Detailed Description} 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 {\tt \hyperlink{structghash}{ghash}} implementation contains pointers to the actual data (including all relevant metadata) plus function pointers to the functions needed to manipulate the data. \subsection{Define Documentation} \hypertarget{group__adt__ghash_g928454c59f629fbab0bb20e0fec7033c}{ \index{adt\_\-ghash@{adt\_\-ghash}!GHASH\_\-ADD\_\-DEFN@{GHASH\_\-ADD\_\-DEFN}} \index{GHASH\_\-ADD\_\-DEFN@{GHASH\_\-ADD\_\-DEFN}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define GHASH\_\-ADD\_\-DEFN(PREFIX, KTYPE, DTYPE)}} \label{group__adt__ghash_g928454c59f629fbab0bb20e0fec7033c} \textbf{Value:} \begin{Code}\begin{verbatim}struct PREFIX##_entry* PREFIX##_add(struct ghash* d, \ KTYPE const* key, DTYPE const* data) { \ return ghash_add(d, key, data); \ } \end{verbatim} \end{Code} Define a specialized {\tt \hyperlink{structghash}{ghash}} table add function. \hypertarget{group__adt__ghash_gd9dcfdb435e30e32b276f8ba0cc04b0a}{ \index{adt\_\-ghash@{adt\_\-ghash}!GHASH\_\-DATAOFFSET@{GHASH\_\-DATAOFFSET}} \index{GHASH\_\-DATAOFFSET@{GHASH\_\-DATAOFFSET}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define GHASH\_\-DATAOFFSET(PREFIX)~((unsigned long)\&((struct PREFIX\#\#\_\-entry$\ast$)0) $\rightarrow$ data)}} \label{group__adt__ghash_gd9dcfdb435e30e32b276f8ba0cc04b0a} The offset of the data into a specialized {\tt \hyperlink{structghash}{ghash}} entry. \hypertarget{group__adt__ghash_gc1e305054793738b716c40999cfea9bf}{ \index{adt\_\-ghash@{adt\_\-ghash}!GHASH\_\-DECL@{GHASH\_\-DECL}} \index{GHASH\_\-DECL@{GHASH\_\-DECL}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define GHASH\_\-DECL(PREFIX, KTYPE, DTYPE)}} \label{group__adt__ghash_gc1e305054793738b716c40999cfea9bf} \textbf{Value:} \begin{Code}\begin{verbatim}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*)); \end{verbatim} \end{Code} Declare all the prototypes for a {\tt \hyperlink{structghash}{ghash}} table, specialized to particular key and data types. \begin{Desc} \item[Examples: ]\par \hyperlink{adt_2ghash__test_8c-example}{adt/ghash\_\-test.c}.\end{Desc} \hypertarget{group__adt__ghash_g7d55343d7fd6bd32f4f1107be14f219a}{ \index{adt\_\-ghash@{adt\_\-ghash}!GHASH\_\-DEFN@{GHASH\_\-DEFN}} \index{GHASH\_\-DEFN@{GHASH\_\-DEFN}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define GHASH\_\-DEFN(PREFIX, KTYPE, DTYPE, HASHFN, CMPFN, KCOPY, DCOPY, KFREE, DFREE)}} \label{group__adt__ghash_g7d55343d7fd6bd32f4f1107be14f219a} \textbf{Value:} \begin{Code}\begin{verbatim}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) \end{verbatim} \end{Code} Define all necessary functions for a specialized {\tt \hyperlink{structghash}{ghash}} table. If either of the copy functions {\tt KCOPY} or {\tt DCOPY} are {\tt NULL}, a simple memcpy is used instead. If either of the free functions {\tt KFREE} or {\tt DFREE} are NULL, no data freeing is attempted. \begin{Desc} \item[Examples: ]\par \hyperlink{adt_2ghash__test_8c-example}{adt/ghash\_\-test.c}.\end{Desc} \hypertarget{group__adt__ghash_gb20f65db478dd9d049cf30b5c0e46798}{ \index{adt\_\-ghash@{adt\_\-ghash}!ghash\_\-entry\_\-dataptr@{ghash\_\-entry\_\-dataptr}} \index{ghash\_\-entry\_\-dataptr@{ghash\_\-entry\_\-dataptr}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define ghash\_\-entry\_\-dataptr(P, L)~((P)+sizeof({\bf adt\_\-hash\_\-t})+(L))}} \label{group__adt__ghash_gb20f65db478dd9d049cf30b5c0e46798} The data structure address within an entry {\tt P} . The offset parameter {\tt L} is the size of the key structure. \hypertarget{group__adt__ghash_g06408a9495c3264536eb441f2cfe21f0}{ \index{adt\_\-ghash@{adt\_\-ghash}!ghash\_\-entry\_\-hash@{ghash\_\-entry\_\-hash}} \index{ghash\_\-entry\_\-hash@{ghash\_\-entry\_\-hash}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define ghash\_\-entry\_\-hash(P)~($\ast$({\bf adt\_\-hash\_\-t}$\ast$)(P))}} \label{group__adt__ghash_g06408a9495c3264536eb441f2cfe21f0} The hash value stored within an entry {\tt P} . \hypertarget{group__adt__ghash_g3f6b74b60133f8479a5351213ad097e9}{ \index{adt\_\-ghash@{adt\_\-ghash}!ghash\_\-entry\_\-keyptr@{ghash\_\-entry\_\-keyptr}} \index{ghash\_\-entry\_\-keyptr@{ghash\_\-entry\_\-keyptr}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define ghash\_\-entry\_\-keyptr(P)~((P)+sizeof({\bf adt\_\-hash\_\-t}))}} \label{group__adt__ghash_g3f6b74b60133f8479a5351213ad097e9} The key structure address within an entry {\tt P} . \hypertarget{group__adt__ghash_g28d6134ab05a63015feb36a32ebc6b0f}{ \index{adt\_\-ghash@{adt\_\-ghash}!GHASH\_\-FOREACH\_\-DEFN@{GHASH\_\-FOREACH\_\-DEFN}} \index{GHASH\_\-FOREACH\_\-DEFN@{GHASH\_\-FOREACH\_\-DEFN}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define GHASH\_\-FOREACH\_\-DEFN(PREFIX)}} \label{group__adt__ghash_g28d6134ab05a63015feb36a32ebc6b0f} \textbf{Value:} \begin{Code}\begin{verbatim}void PREFIX##_foreach(struct ghash* d, void (*fn)(struct PREFIX##_entry*)) { \ ghash_foreach(d, (void (*)(void*))fn); \ } \end{verbatim} \end{Code} Define a specialized {\tt \hyperlink{structghash}{ghash}} table iterator function. \hypertarget{group__adt__ghash_gf8c5a4c9b22f8c620ed8875de9545f3e}{ \index{adt\_\-ghash@{adt\_\-ghash}!GHASH\_\-FREE\_\-DEFN@{GHASH\_\-FREE\_\-DEFN}} \index{GHASH\_\-FREE\_\-DEFN@{GHASH\_\-FREE\_\-DEFN}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define GHASH\_\-FREE\_\-DEFN(PREFIX)}} \label{group__adt__ghash_gf8c5a4c9b22f8c620ed8875de9545f3e} \textbf{Value:} \begin{Code}\begin{verbatim}void PREFIX##_free(struct ghash* d) { \ ghash_free(d); \ } \end{verbatim} \end{Code} Define a specialized {\tt \hyperlink{structghash}{ghash}} table free function. \hypertarget{group__adt__ghash_gabe08d7de7829f19e51789b06b1a95da}{ \index{adt\_\-ghash@{adt\_\-ghash}!GHASH\_\-GET\_\-DEFN@{GHASH\_\-GET\_\-DEFN}} \index{GHASH\_\-GET\_\-DEFN@{GHASH\_\-GET\_\-DEFN}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define GHASH\_\-GET\_\-DEFN(PREFIX, KTYPE)}} \label{group__adt__ghash_gabe08d7de7829f19e51789b06b1a95da} \textbf{Value:} \begin{Code}\begin{verbatim}struct PREFIX##_entry* PREFIX##_get(struct ghash* d, KTYPE const* key) { \ return ghash_get(d, key); \ } \end{verbatim} \end{Code} Define a specialized {\tt \hyperlink{structghash}{ghash}} table get function. \hypertarget{group__adt__ghash_g1cf13ef03b3c316a344d5a7f5af2ef9f}{ \index{adt\_\-ghash@{adt\_\-ghash}!ghash\_\-hashb@{ghash\_\-hashb}} \index{ghash\_\-hashb@{ghash\_\-hashb}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define ghash\_\-hashb~adt\_\-hashb}} \label{group__adt__ghash_g1cf13ef03b3c316a344d5a7f5af2ef9f} The {\tt adt\_\-hashb} function also works for \hyperlink{structghash}{ghash} \hypertarget{group__adt__ghash_ga793802d1ccac89ba8f2450041b19510}{ \index{adt\_\-ghash@{adt\_\-ghash}!ghash\_\-hashs@{ghash\_\-hashs}} \index{ghash\_\-hashs@{ghash\_\-hashs}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define ghash\_\-hashs~adt\_\-hashs}} \label{group__adt__ghash_ga793802d1ccac89ba8f2450041b19510} The {\tt adt\_\-hashs} function also works for \hyperlink{structghash}{ghash} \hypertarget{group__adt__ghash_g67d80747f0e39bdaaaa34c1a3efa45b9}{ \index{adt\_\-ghash@{adt\_\-ghash}!ghash\_\-hashsp@{ghash\_\-hashsp}} \index{ghash\_\-hashsp@{ghash\_\-hashsp}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define ghash\_\-hashsp~adt\_\-hashsp}} \label{group__adt__ghash_g67d80747f0e39bdaaaa34c1a3efa45b9} The {\tt adt\_\-hashsp} function also works for \hyperlink{structghash}{ghash} \hypertarget{group__adt__ghash_g46a99956ed09905f7f8c32c603347bd3}{ \index{adt\_\-ghash@{adt\_\-ghash}!GHASH\_\-INIT\_\-DEFN@{GHASH\_\-INIT\_\-DEFN}} \index{GHASH\_\-INIT\_\-DEFN@{GHASH\_\-INIT\_\-DEFN}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define GHASH\_\-INIT\_\-DEFN(PREFIX, KTYPE, DTYPE, HASHFN, CMP, KCOPY, DCOPY, KFREE, DFREE)}} \label{group__adt__ghash_g46a99956ed09905f7f8c32c603347bd3} \textbf{Value:} \begin{Code}\begin{verbatim}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); \ } \end{verbatim} \end{Code} Define a specialized {\tt \hyperlink{structghash}{ghash}} table init function. \hypertarget{group__adt__ghash_g4275ace9d4a3af4cac0ffb37cfb0285a}{ \index{adt\_\-ghash@{adt\_\-ghash}!GHASH\_\-KEYOFFSET@{GHASH\_\-KEYOFFSET}} \index{GHASH\_\-KEYOFFSET@{GHASH\_\-KEYOFFSET}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define GHASH\_\-KEYOFFSET(PREFIX)~((unsigned long)\&((struct PREFIX\#\#\_\-entry$\ast$)0) $\rightarrow$ key)}} \label{group__adt__ghash_g4275ace9d4a3af4cac0ffb37cfb0285a} The offset of the key into a specialized {\tt \hyperlink{structghash}{ghash}} entry. \hypertarget{group__adt__ghash_g3464d7a289b27e168f574b1d8f8a8be3}{ \index{adt\_\-ghash@{adt\_\-ghash}!GHASH\_\-KEYSIZE@{GHASH\_\-KEYSIZE}} \index{GHASH\_\-KEYSIZE@{GHASH\_\-KEYSIZE}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define GHASH\_\-KEYSIZE(PREFIX)}} \label{group__adt__ghash_g3464d7a289b27e168f574b1d8f8a8be3} \textbf{Value:} \begin{Code}\begin{verbatim}( \ GHASH_DATAOFFSET(PREFIX)-GHASH_KEYOFFSET(PREFIX) \ ) \end{verbatim} \end{Code} The actual size of the key data in a specialized {\tt \hyperlink{structghash}{ghash}} entry. \hypertarget{group__adt__ghash_g5462bc3c7d1eea455b6733ce60bd39d5}{ \index{adt\_\-ghash@{adt\_\-ghash}!GHASH\_\-REBUILD\_\-DEFN@{GHASH\_\-REBUILD\_\-DEFN}} \index{GHASH\_\-REBUILD\_\-DEFN@{GHASH\_\-REBUILD\_\-DEFN}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define GHASH\_\-REBUILD\_\-DEFN(PREFIX)}} \label{group__adt__ghash_g5462bc3c7d1eea455b6733ce60bd39d5} \textbf{Value:} \begin{Code}\begin{verbatim}int PREFIX##_rebuild(struct ghash* d) { \ return ghash_rebuild(d); \ } \end{verbatim} \end{Code} Define a specialized {\tt \hyperlink{structghash}{ghash}} table rebuild function. \hypertarget{group__adt__ghash_g2293adaa2df56053b058ff937e7c7254}{ \index{adt\_\-ghash@{adt\_\-ghash}!GHASH\_\-REHASH\_\-DEFN@{GHASH\_\-REHASH\_\-DEFN}} \index{GHASH\_\-REHASH\_\-DEFN@{GHASH\_\-REHASH\_\-DEFN}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define GHASH\_\-REHASH\_\-DEFN(PREFIX)}} \label{group__adt__ghash_g2293adaa2df56053b058ff937e7c7254} \textbf{Value:} \begin{Code}\begin{verbatim}int PREFIX##_rehash(struct ghash* d) { \ return ghash_rehash(d); \ } \end{verbatim} \end{Code} Define a specialized {\tt \hyperlink{structghash}{ghash}} table rehash function. \hypertarget{group__adt__ghash_g4de5f1ce7dc082245c22f16635a9f5c5}{ \index{adt\_\-ghash@{adt\_\-ghash}!GHASH\_\-REMOVE\_\-DEFN@{GHASH\_\-REMOVE\_\-DEFN}} \index{GHASH\_\-REMOVE\_\-DEFN@{GHASH\_\-REMOVE\_\-DEFN}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define GHASH\_\-REMOVE\_\-DEFN(PREFIX, KTYPE)}} \label{group__adt__ghash_g4de5f1ce7dc082245c22f16635a9f5c5} \textbf{Value:} \begin{Code}\begin{verbatim}extern int PREFIX##_remove(struct ghash* d, KTYPE const* key) { \ return ghash_remove(d, (void*)key); \ } \end{verbatim} \end{Code} Define a specialized {\tt \hyperlink{structghash}{ghash}} table remove function. \hypertarget{group__adt__ghash_ge84cc453db9361a299216c9211abc968}{ \index{adt\_\-ghash@{adt\_\-ghash}!GHASH\_\-SEARCH\_\-DEFN@{GHASH\_\-SEARCH\_\-DEFN}} \index{GHASH\_\-SEARCH\_\-DEFN@{GHASH\_\-SEARCH\_\-DEFN}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define GHASH\_\-SEARCH\_\-DEFN(PREFIX)}} \label{group__adt__ghash_ge84cc453db9361a299216c9211abc968} \textbf{Value:} \begin{Code}\begin{verbatim}struct PREFIX##_entry* PREFIX##_search(struct ghash* d, int (*fn)(const struct PREFIX##_entry*)) { \ return ghash_search(d, (int (*)(const void*))fn); \ } \end{verbatim} \end{Code} Define a specialized {\tt \hyperlink{structghash}{ghash}} table search function. \hypertarget{group__adt__ghash_g5c819bab0cc126b53ffe8b7c6e38bb27}{ \index{adt\_\-ghash@{adt\_\-ghash}!GHASH\_\-SET\_\-DEFN@{GHASH\_\-SET\_\-DEFN}} \index{GHASH\_\-SET\_\-DEFN@{GHASH\_\-SET\_\-DEFN}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define GHASH\_\-SET\_\-DEFN(PREFIX, KTYPE, DTYPE)}} \label{group__adt__ghash_g5c819bab0cc126b53ffe8b7c6e38bb27} \textbf{Value:} \begin{Code}\begin{verbatim}struct PREFIX##_entry* PREFIX##_set(struct ghash* d, \ KTYPE const* key, DTYPE const* data) { \ return ghash_set(d, key, data); \ } \end{verbatim} \end{Code} Define a specialized {\tt \hyperlink{structghash}{ghash}} table add function. \hypertarget{group__adt__ghash_gda65697b1f72b4e162981b6e5ac590e8}{ \index{adt\_\-ghash@{adt\_\-ghash}!GHASH\_\-STRUCT\_\-ENTRY@{GHASH\_\-STRUCT\_\-ENTRY}} \index{GHASH\_\-STRUCT\_\-ENTRY@{GHASH\_\-STRUCT\_\-ENTRY}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define GHASH\_\-STRUCT\_\-ENTRY(PREFIX, KTYPE, DTYPE)}} \label{group__adt__ghash_gda65697b1f72b4e162981b6e5ac590e8} \textbf{Value:} \begin{Code}\begin{verbatim}struct PREFIX##_entry { \ adt_hash_t hash; \ KTYPE key; \ DTYPE data; \ } \end{verbatim} \end{Code} Prototype for the {\tt \hyperlink{structghash}{ghash}} entry structure, containing a key of type {\tt KTYPE} and data of type {\tt DTYPE} . \hypertarget{group__adt__ghash_g7db779509845eb235a86abc751e44887}{ \index{adt\_\-ghash@{adt\_\-ghash}!ghashiter\_\-loop@{ghashiter\_\-loop}} \index{ghashiter\_\-loop@{ghashiter\_\-loop}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define ghashiter\_\-loop(I, G)~for(ghashiter\_\-first(I,G);ghashiter\_\-valid(I);ghashiter\_\-next(I))}} \label{group__adt__ghash_g7db779509845eb235a86abc751e44887} A convenience macro which expands to a {\tt for} loop using the {\tt \hyperlink{structghashiter}{ghashiter}} I to iterate over the table {\tt G} . \begin{Desc} \item[Examples: ]\par \hyperlink{adt_2ghash__test_8c-example}{adt/ghash\_\-test.c}.\end{Desc} \subsection{Function Documentation} \hypertarget{group__adt__ghash_g6550c0dfe54e19112959dba7b164058a}{ \index{adt\_\-ghash@{adt\_\-ghash}!ghash\_\-add@{ghash\_\-add}} \index{ghash\_\-add@{ghash\_\-add}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ ghash\_\-add (struct {\bf ghash} $\ast$ {\em d}, const void $\ast$ {\em key}, const void $\ast$ {\em data})}} \label{group__adt__ghash_g6550c0dfe54e19112959dba7b164058a} Add an entry into a generic hash table. This function adds a new entry into the given hash table. If the table is too small to provide sufficient slots for efficient access, the table is automatically expanded to the next larger size and all the existing entries are copied over. \hypertarget{group__adt__ghash_g92c681d50d718324d18ea35118593e0b}{ \index{adt\_\-ghash@{adt\_\-ghash}!ghash\_\-find@{ghash\_\-find}} \index{ghash\_\-find@{ghash\_\-find}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void$\ast$$\ast$ ghash\_\-find (struct {\bf ghash} $\ast$ {\em d}, const void $\ast$ {\em key})}} \label{group__adt__ghash_g92c681d50d718324d18ea35118593e0b} Find an entry in a {\tt \hyperlink{structghash}{ghash}} table. \begin{Desc} \item[Returns:]A pointer to the entry structure, or {\tt NULL} if the {\tt key} was not found. \end{Desc} \hypertarget{group__adt__ghash_g4778a040ba311b5925ca15d7ca640bf9}{ \index{adt\_\-ghash@{adt\_\-ghash}!ghash\_\-foreach@{ghash\_\-foreach}} \index{ghash\_\-foreach@{ghash\_\-foreach}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ghash\_\-foreach (struct {\bf ghash} $\ast$ {\em d}, void($\ast$)(void $\ast$entry) {\em fn})}} \label{group__adt__ghash_g4778a040ba311b5925ca15d7ca640bf9} Iterate over a {\tt \hyperlink{structghash}{ghash}} table, calling a function for each entry. \hypertarget{group__adt__ghash_ge609d6df48e1e10a1391d1c94c1dc9ac}{ \index{adt\_\-ghash@{adt\_\-ghash}!ghash\_\-free@{ghash\_\-free}} \index{ghash\_\-free@{ghash\_\-free}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ghash\_\-free (struct {\bf ghash} $\ast$ {\em d})}} \label{group__adt__ghash_ge609d6df48e1e10a1391d1c94c1dc9ac} Free all data (and entries) in a {\tt \hyperlink{structghash}{ghash}} table. \hypertarget{group__adt__ghash_g4b02b70d7c67a779a9dca5aa23b7f0f4}{ \index{adt\_\-ghash@{adt\_\-ghash}!ghash\_\-get@{ghash\_\-get}} \index{ghash\_\-get@{ghash\_\-get}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ ghash\_\-get (struct {\bf ghash} $\ast$ {\em d}, const void $\ast$ {\em key})}} \label{group__adt__ghash_g4b02b70d7c67a779a9dca5aa23b7f0f4} Find an entry in a {\tt \hyperlink{structghash}{ghash}} table. \begin{Desc} \item[Returns:]A pointer to the data structure or {\tt NULL} if the {\tt key} was not found. \end{Desc} \hypertarget{group__adt__ghash_g5b2766288f28271bbcf0c45f17e82b89}{ \index{adt\_\-ghash@{adt\_\-ghash}!ghash\_\-init@{ghash\_\-init}} \index{ghash\_\-init@{ghash\_\-init}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ghash\_\-init (struct {\bf ghash} $\ast$ {\em d}, unsigned long {\em keysize}, unsigned long {\em entrysize}, {\bf adt\_\-hash\_\-fn} $\ast$ {\em hashfn}, {\bf adt\_\-cmp\_\-fn} $\ast$ {\em keycmp}, {\bf adt\_\-copy\_\-fn} $\ast$ {\em keycopy}, {\bf adt\_\-copy\_\-fn} $\ast$ {\em datacopy}, {\bf adt\_\-free\_\-fn} $\ast$ {\em keyfree}, {\bf adt\_\-free\_\-fn} $\ast$ {\em datafree})}} \label{group__adt__ghash_g5b2766288f28271bbcf0c45f17e82b89} Initialize an empty {\tt \hyperlink{structghash}{ghash}} table. \hypertarget{group__adt__ghash_ge774815d548201157ed715de43e3ea9d}{ \index{adt\_\-ghash@{adt\_\-ghash}!ghash\_\-insert@{ghash\_\-insert}} \index{ghash\_\-insert@{ghash\_\-insert}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ghash\_\-insert (struct {\bf ghash} $\ast$ {\em d}, void $\ast$ {\em e})}} \label{group__adt__ghash_ge774815d548201157ed715de43e3ea9d} Insert an entry into a {\tt \hyperlink{structghash}{ghash}} table, without resizing it. \hypertarget{group__adt__ghash_g6a6bba38a9aaf20a6b10eeaabaa9b869}{ \index{adt\_\-ghash@{adt\_\-ghash}!ghash\_\-rebuild@{ghash\_\-rebuild}} \index{ghash\_\-rebuild@{ghash\_\-rebuild}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ghash\_\-rebuild (struct {\bf ghash} $\ast$ {\em d})}} \label{group__adt__ghash_g6a6bba38a9aaf20a6b10eeaabaa9b869} Rebuild the entry pointer table in a {\tt \hyperlink{structghash}{ghash}} table. This function is used internally after either rehashing the table or removing an entry. \hypertarget{group__adt__ghash_g4beb7c3192aa1ee02a8bf0142758e1af}{ \index{adt\_\-ghash@{adt\_\-ghash}!ghash\_\-rehash@{ghash\_\-rehash}} \index{ghash\_\-rehash@{ghash\_\-rehash}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ghash\_\-rehash (struct {\bf ghash} $\ast$ {\em d})}} \label{group__adt__ghash_g4beb7c3192aa1ee02a8bf0142758e1af} Regenerate all the hash values in a {\tt \hyperlink{structghash}{ghash}} table and then rebuild it. Use this function when any of the keys change value. \hypertarget{group__adt__ghash_gad78f59b6f21c62f96285d1583e017fb}{ \index{adt\_\-ghash@{adt\_\-ghash}!ghash\_\-remove@{ghash\_\-remove}} \index{ghash\_\-remove@{ghash\_\-remove}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ghash\_\-remove (struct {\bf ghash} $\ast$ {\em d}, const void $\ast$ {\em key})}} \label{group__adt__ghash_gad78f59b6f21c62f96285d1583e017fb} Remove an entry from a {\tt \hyperlink{structghash}{ghash}} table. This function attempts to do the minimum amount of rebuilding necessary to adjust the positions of entries that may fall in the same slot as the newly removed entry. \begin{Desc} \item[Returns:]True if the entry was found (and removed), false otherwise. \end{Desc} \begin{Desc} \item[Examples: ]\par \hyperlink{adt_2ghash__test_8c-example}{adt/ghash\_\-test.c}.\end{Desc} \hypertarget{group__adt__ghash_g0065ab7531db704c0e51250c519693cc}{ \index{adt\_\-ghash@{adt\_\-ghash}!ghash\_\-search@{ghash\_\-search}} \index{ghash\_\-search@{ghash\_\-search}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ ghash\_\-search (struct {\bf ghash} $\ast$ {\em d}, int($\ast$)(const void $\ast$entry) {\em fn})}} \label{group__adt__ghash_g0065ab7531db704c0e51250c519693cc} Search for the first entry in the {\tt \hyperlink{structghash}{ghash}} table for which the given function returns true. \hypertarget{group__adt__ghash_g199afecbf45d644c8371b612141df54b}{ \index{adt\_\-ghash@{adt\_\-ghash}!ghash\_\-set@{ghash\_\-set}} \index{ghash\_\-set@{ghash\_\-set}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ ghash\_\-set (struct {\bf ghash} $\ast$ {\em d}, const void $\ast$ {\em key}, const void $\ast$ {\em data})}} \label{group__adt__ghash_g199afecbf45d644c8371b612141df54b} Replace or add an entry into a generic hash table. \begin{Desc} \item[Examples: ]\par \hyperlink{adt_2ghash__test_8c-example}{adt/ghash\_\-test.c}.\end{Desc} \hypertarget{group__adt__ghash_g3c21bcee8850adc76bee68ee8dd7df3e}{ \index{adt\_\-ghash@{adt\_\-ghash}!ghashiter\_\-first@{ghashiter\_\-first}} \index{ghashiter\_\-first@{ghashiter\_\-first}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ghashiter\_\-first (struct {\bf ghashiter} $\ast$ {\em iter}, const struct {\bf ghash} $\ast$ {\em h})}} \label{group__adt__ghash_g3c21bcee8850adc76bee68ee8dd7df3e} Set a {\tt \hyperlink{structghash}{ghash}} iterator to the first element in the table. \hypertarget{group__adt__ghash_g733a92b13ce772e7e3810ea65fcd6454}{ \index{adt\_\-ghash@{adt\_\-ghash}!ghashiter\_\-next@{ghashiter\_\-next}} \index{ghashiter\_\-next@{ghashiter\_\-next}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ghashiter\_\-next (struct {\bf ghashiter} $\ast$ {\em iter})}} \label{group__adt__ghash_g733a92b13ce772e7e3810ea65fcd6454} Advance the {\tt \hyperlink{structghash}{ghash}} iterator to the next element in the table. \hypertarget{group__adt__ghash_g03c8f3d628d6ea8c54ecffe4e892178f}{ \index{adt\_\-ghash@{adt\_\-ghash}!ghashiter\_\-valid@{ghashiter\_\-valid}} \index{ghashiter\_\-valid@{ghashiter\_\-valid}!adt_ghash@{adt\_\-ghash}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ghashiter\_\-valid (const struct {\bf ghashiter} $\ast$ {\em iter})}} \label{group__adt__ghash_g03c8f3d628d6ea8c54ecffe4e892178f} Check if the {\tt \hyperlink{structghash}{ghash}} iterator is still valid. bglibs-1.106/bglibs-1.106.spec0000664000076400007640000000302211147311327015106 0ustar bruceguenter%define basedir /usr/local/bglibs %define _libdir %{basedir}/lib %define _includedir %{basedir}/include Name: bglibs Summary: BG Libraries Collection Version: 1.106 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 cp -a doc %{buildroot}%{basedir} %clean rm -rf %{buildroot} %post fgrep -x /usr/local/bglibs/lib /etc/ld.so.conf >/dev/null \ || echo /usr/local/bglibs/lib >>/etc/ld.so.conf /sbin/ldconfig %files %defattr(-,root,root) %doc ANNOUNCEMENT COPYING NEWS README %{basedir}/lib/*.so.* %{_bindir}/bg-installer %files devel %defattr(-,root,root) %{basedir}/doc %{basedir}/include %{basedir}/lib/*.a %{basedir}/lib/*.la %{basedir}/lib/*.lib %{basedir}/lib/*.so %{basedir}/lib/*/*.a %{_bindir}/cli-generate %{_bindir}/crc-gentab %{_mandir}/*/* bglibs-1.106/crypto/0000755000076400007640000000000011147311327013646 5ustar bruceguenterbglibs-1.106/crypto/surf.h0000664000076400007640000000125411147311327015002 0ustar bruceguenter#ifndef BGLIBS__SURF__H__ #define BGLIBS__SURF__H__ #include /** \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-1.106/crypto/surf.c0000664000076400007640000000734111147311327015000 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 #include "selftest.c" 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-1.106/crypto/sha512.h0000664000076400007640000000056111147311327015026 0ustar bruceguenter#ifndef BGLIBS__SHA512__H__ #define BGLIBS__SHA512__H__ #include #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-1.106/crypto/hmac-sha256.c0000664000076400007640000000375111147311327015740 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 "iobuf/obuf.h" #include "str/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); } int main(void) { 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"); return 0; } #endif #ifdef SELFTEST_EXP 492ce020fe2534a5789dc3848806c78f4f6711397f08e7e7a12ca5a4483c8aa6 5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843 7dda3cc169743a6484649f94f0eda0f9f2ff496a9733fb796ed5adb40a44c3c1 #endif bglibs-1.106/crypto/surfrand.h0000664000076400007640000000145411147311327015651 0ustar bruceguenter#ifndef BGLIBS__SURFRAND__H__ #define BGLIBS__SURFRAND__H__ #include /** \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 used; /** 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); /** @} */ #endif bglibs-1.106/crypto/hmac-sha384.c0000664000076400007640000000414011147311327015733 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 "iobuf/obuf.h" #include "str/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); } int main(void) { 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"); return 0; } #endif #ifdef SELFTEST_EXP 7afaa633e20d379b02395915fbc385ff8dc27dcd3885e1068ab942eeab52ec1f20ad382a92370d8b2e0ac8b83c4d53bf af45d2e376484031617f78d2b58a6b1b9c7ef464f5a01b47e42ec3736322445e8e2240ca5e69e2c78b3239ecfab21649 1383e82e28286b91f4cc7afbd13d5b5c6f887c05e7c4542484043a37a5fe45802a9470fb663bd7b6570fe2f503fc92f5 #endif bglibs-1.106/crypto/sha384.h0000664000076400007640000000045511147311327015037 0ustar bruceguenter#ifndef BGLIBS__SHA384__H__ #define BGLIBS__SHA384__H__ #include #include #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-1.106/crypto/sha1.c0000664000076400007640000001446211147311327014657 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 "selftest.c" #include "str/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-1.106/crypto/hmac-sha1.c0000664000076400007640000000371511147311327015564 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 "selftest.c" #include "str/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-1.106/crypto/hmac-sha512.c0000664000076400007640000000425411147311327015732 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 "iobuf/obuf.h" #include "str/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); } int main(void) { 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"); return 0; } #endif #ifdef SELFTEST_EXP 7641c48a3b4aa8f887c07b3e83f96affb89c978fed8c96fcbbf4ad596eebfe496f9f16da6cd080ba393c6f365ad72b50d15c71bfb1d6b81f66a911786c6ce932 164b7a7bfcf819e2e395fbe73b56e0a387bd64222e831fd610270cd7ea2505549758bf75c05a994a6d034f65f8f0e6fdcaeab1a34d4a6b4b636e070a38bce737 ad9b5c7de72693737cd5e9d9f41170d18841fec1201c1c1b02e05cae116718009f771cad9946ddbf7e3cde3e818d9ae85d91b2badae94172d096a44a79c91e86 #endif bglibs-1.106/crypto/surfrand.c0000664000076400007640000001034411147311327015642 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) { unsigned i = 0; uint32* p; surf(c->generated, c->counter, c->seed); for (p = c->counter, i = 0; i < SURF_IN_U32; ++i, ++p) if (++*p > 0) break; c->used = 0; } /** 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->used = SURF_OUT_U32; } /** 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->used >= SURF_OUT_U32) generate(c); return c->generated[c->used++]; } /** 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); } } #ifdef SELFTEST_MAIN #include "selftest.c" 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 4da5cfc1 ea6787e8 23eada9c fee73aaf 8a78e27f d0e3b9ab 4a2d6392 15cd5f15 eb027430 c47585b0 3194c1e5 94ccda9c 80a7702e 8e79aa53 6f1da938 695a7033 33dad740 a60dbc9a 0a2ba02b 98575e80 150c83eb 9dae96f1 b9be75e2 447861ef 269087b5 b32525a0 5c705fc5 ed0e718e 73a7f7c1 46cdc023 94216ab1 1f1279e3 1f646f55 46a46fc1 589f20c0 7a64359d 9f7a7b8e a705e0b5 514e2c77 07506597 #endif bglibs-1.106/crypto/sha256.c0000664000076400007640000001474311147311327015035 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 "iobuf/obuf.h" #include "str/str.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); } int main(void) { 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."); return 0; } #endif #ifdef SELFTEST_EXP ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad 248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1 cf5b16a778af8380036ce59e7b0492370b249b11e8f07a51afac45037afee9d1 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 ab64eff7e88e2e46165e29f2bce41826bd4c7b3552f6b382a9e7d3af47c245f8 f08a78cbbaee082b052ae0708f32fa1e50c5c421aa772ba5dbb406a2ea6be342 0ab803344830f92089494fb635ad00d76164ad6e57012b237722df0d7ad26896 e4326d0459653d7d3514674d713e74dc3df11ed4d30b4013fd327fdb9e394c26 #endif bglibs-1.106/crypto/md4.c0000664000076400007640000002310011147311327014474 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" #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; { ((md4_uint32 *) resbuf)[0] = SWAP (ctx->A); ((md4_uint32 *) resbuf)[1] = SWAP (ctx->B); ((md4_uint32 *) resbuf)[2] = SWAP (ctx->C); ((md4_uint32 *) resbuf)[3] = SWAP (ctx->D); 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. */ *(md4_uint32 *) &ctx->buffer[56] = SWAP (total0 << 3); *(md4_uint32 *) &ctx->buffer[60] = SWAP ((total1 << 3) | (total0 >> 29)); /* 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* str) { struct md4_ctx ctx; unsigned char digest[16]; unsigned int len = strlen(str); unsigned i; md4_init_ctx(&ctx); md4_process_bytes(str, len, &ctx); md4_finish_ctx(&ctx, digest); printf("MD4 (\"%s\") = ", str); for (i = 0; i < 16; i++) printf("%02x", digest[i]); printf("\n"); } int main(void) { MDString(""); MDString("a"); MDString("abc"); MDString("message digest"); MDString("abcdefghijklmnopqrstuvwxyz"); MDString("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"); MDString("1234567890123456789012345678901234567890" "1234567890123456789012345678901234567890"); return 0; } #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-1.106/crypto/sha1.h0000664000076400007640000000137311147311327014661 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 #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-1.106/crypto/md5-crypt.c0000664000076400007640000001614711147311327015651 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-1.106/crypto/sha256.h0000664000076400007640000000051711147311327015034 0ustar bruceguenter#ifndef BGLIBS__SHA256__H__ #define BGLIBS__SHA256__H__ #include #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-1.106/crypto/hmac.c0000664000076400007640000000722411147311327014731 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/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-1.106/crypto/hmac.h0000664000076400007640000000232511147311327014733 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-1.106/crypto/sha384.c0000664000076400007640000000705711147311327015037 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 "iobuf/obuf.h" #include "str/str.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); } int main(void) { 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."); return 0; } #endif #ifdef SELFTEST_EXP cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7 09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039 3391fdddfc8dc7393707a65b1b4709397cf8b1d162af05abfe8f450de5f36bc6b0455a8520bc4e6f5fe95b1fe3c8452b 38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b e28e35e25a1874908bf0958bb088b69f3d742a753c86993e9f4b1c4c21988f958bd1fe0315b195aca7b061213ac2a9bd 37b49ef3d08de53e9bd018b0630067bd43d09c427d06b05812f48531bce7d2a698ee2d1ed1ffed46fd4c3b9f38a8a557 e3e3602f4d90c935321d788f722071a8809f4f09366f2825cd85da97ccd2955eb6b8245974402aa64789ed45293e94ba 1ca650f38480fa9dfb5729636bec4a935ebc1cd4c0055ee50cad2aa627e066871044fd8e6fdb80edf10b85df15ba7aab #endif bglibs-1.106/crypto/md4.h0000664000076400007640000001055611147311327014514 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-1.106/crypto/md5.h0000664000076400007640000001265211147311327014514 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-1.106/crypto/hmac-md5.c0000664000076400007640000000442511147311327015414 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/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"); } int main(void) { /* 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"); return 0; } #endif #ifdef SELFTEST_EXP HMAC (16,8) = 9294727a3638bb1c13f48ef8158bfc9d HMAC (4,28) = 750c783e6ab0b503eaa86e310a5db738 HMAC (16,50) = 56be34521d144c88dbb8c733f0e8b3f6 #endif bglibs-1.106/crypto/md5.c0000664000076400007640000003313611147311327014507 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" #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; { ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A); ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B); ((md5_uint32 *) resbuf)[2] = SWAP (ctx->C); ((md5_uint32 *) resbuf)[3] = SWAP (ctx->D); 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. */ *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3); *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29)); /* 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/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"); } int main(void) { printf("MD5 test suite:\n"); MDString(""); MDString("a"); MDString("abc"); MDString("message digest"); MDString("abcdefghijklmnopqrstuvwxyz"); MDString("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"); MDString("1234567890123456789012345678901234567890" "1234567890123456789012345678901234567890"); return 0; } #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-1.106/crypto/sha512.c0000664000076400007640000002041611147311327015022 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 "iobuf/obuf.h" #include "str/str.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); } int main(void) { 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."); return 0; } #endif #ifdef SELFTEST_EXP ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f 8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909 204a8fc6dda82f0a0ced7beb8e08a41657c16ef468b228a8279be331a703c33596fd15c13b1b07f9aa1d3bea57789ca031ad85c7a71dd70354ec631238ca3445 cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 70aefeaa0e7ac4f8fe17532d7185a289bee3b428d950c14fa8b713ca09814a387d245870e007a80ad97c369d193e41701aa07f3221d15f0e65a1ff970cedf030 b3de4afbc516d2478fe9b518d063bda6c8dd65fc38402dd81d1eb7364e72fb6e6663cf6d2771c8f5a6da09601712fb3d2a36c6ffea3e28b0818b05b0a8660766 97fb4ec472f3cb698b9c3c12a12768483e5b62bcdad934280750b4fa4701e5e0550a80bb0828342c19631ba55a55e1cee5de2fda91fc5d40e7bee1d4e6d415b3 d399507bbf5f2d0da51db1ff1fc51c1c9ff1de0937e00d01693b240e84fcc3400601429f45c297acc6e8fcf1e4e4abe9ff21a54a0d3d88888f298971bd206cd5 #endif bglibs-1.106/ChangeLog0000664000076400007640000144120711147311327014113 0ustar bruceguentercommit 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 files changed, 1 insertions(+), 1 deletions(-) commit ea7826ae23c10000ae5e73b07f4e66dcc2f18f42 Author: Bruce Guenter Date: Fri Feb 13 10:55:50 2009 -0600 Bumped LIBVERSION for release. LIBVERSION | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) 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 | 112 ++++++++++++++++++++++++++++---------------------------- NEWS | 3 + bg-installer=x | 15 ++++--- crc-gentab=x | 7 ++- libraries.spac | 2 +- 5 files changed, 72 insertions(+), 67 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 deletions(-) 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 files changed, 2 insertions(+), 1 deletions(-) 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 files 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 files changed, 30 insertions(+), 0 deletions(-) create mode 100644 .gitignore commit 085291acf4cfc362224aad077f5105acce5fc4ad Author: Bruce Guenter Date: Fri Jan 16 10:53:30 2009 -0600 Removed executable mode on spec file. 0 files 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 deletions(-) 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 files changed, 1 insertions(+), 0 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) 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 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) 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 files 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 files changed, 1 insertions(+), 0 deletions(-) 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 files changed, 504 insertions(+), 0 deletions(-) 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 files changed, 1 insertions(+), 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(+), 0 deletions(-) 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 files changed, 1 insertions(+), 0 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) 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, 0 insertions(+), 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 files 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 files 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 files 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 deletions(-) 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(+), 0 deletions(-) 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 files changed, 3 insertions(+), 0 deletions(-) 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(+), 0 deletions(-) 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(+), 0 deletions(-) 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 deletions(-) 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 files changed, 0 insertions(+), 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 files changed, 1 insertions(+), 1 deletions(-) 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 deletions(-) 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 deletions(-) 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 files changed, 17 insertions(+), 0 deletions(-) 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(+), 0 deletions(-) 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 deletions(-) commit c42fd52fc3b47a33924d6fc1683a85bd7a0e98d3 Author: Bruce Guenter Date: Wed Aug 2 16:42:15 2006 +0000 Clarified NEWS entry. NEWS | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) 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 deletions(-) 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 deletions(-) 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 files changed, 1 insertions(+), 0 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) commit f3a0c99443b5c692bc3ef80e6a1a45c06d8748a8 Author: Bruce Guenter Date: Thu Jul 27 19:01:01 2006 +0000 Pointer signedness fixup. adt/adt_sp.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit b934600d10ee1df341df920964deff4b608954ac Author: Bruce Guenter Date: Thu Jul 27 18:56:15 2006 +0000 Document the resolve_ipv4name macro. net/resolve.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) 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 files changed, 2 insertions(+), 0 deletions(-) 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_test.c | 36 ++++++++++++++++++++++++++++++++++++ adt/gstack_push.c | 31 ------------------------------- adt/gstack_test.c | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 72 insertions(+), 62 deletions(-) create mode 100644 adt/gqueue_test.c create mode 100644 adt/gstack_test.c 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 files 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 files 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 files changed, 32 insertions(+), 0 deletions(-) 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(+), 0 deletions(-) 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 deletions(-) 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(+), 0 deletions(-) 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 files changed, 3 insertions(+), 1 deletions(-) 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 deletions(-) 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 files 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 files changed, 2 insertions(+), 0 deletions(-) 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 | 46 +++++++++++++------------- 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, 343 insertions(+), 336 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 deletions(-) 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 files 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 files changed, 0 insertions(+), 1 deletions(-) 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 files changed, 2 insertions(+), 0 deletions(-) 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} | 58 ++++++---- crypto/{sha512.c => hash-sha512.c} | 140 ++++++++++-------------- crypto/hash.c | 102 +++++++++++++++++ crypto/hash.h | 53 +++++++++ crypto/lib=l | 9 ++ 13 files changed, 909 insertions(+), 188 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 deletions(-) commit 9b41cfb62655535982f7447d7bc4d72abc561c3f Author: Bruce Guenter Date: Sun Feb 19 06:51:29 2006 +0000 Install the man page(s) into RPMs. spec | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) 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 files changed, 3 insertions(+), 0 deletions(-) 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 files changed, 7 insertions(+), 1 deletions(-) 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 deletions(-) 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 | 77 ++++++++++++++++++++++++++++++++++++++++---------- 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, 396 insertions(+), 201 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 files 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 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) 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 files 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 files 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 files 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 files changed, 5 insertions(+), 0 deletions(-) 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 files 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 files changed, 1 insertions(+), 1 deletions(-) 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 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 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 deletions(-) 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 files changed, 1 insertions(+), 0 deletions(-) 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 deletions(-) commit c730153c1f548f6960a938daefd2b9d3a392ce41 Author: Bruce Guenter Date: Fri Dec 2 06:06:51 2005 +0000 Fixed missing installation of crypto/hmac.h INSTHIER | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) commit 409f51bd919f2924a6c51ab8bccd4ff5d2831c50 Author: Bruce Guenter Date: Fri Dec 2 04:26:39 2005 +0000 Bumped version to 1.030. VERSION | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) 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 files 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 files 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 deletions(-) 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 files 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 files 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 files 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 files changed, 1 insertions(+), 1 deletions(-) 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 files 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 files 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 deletions(-) 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 files 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(+), 0 deletions(-) commit 72f012097cbbb67957086f6cdad70416059398c8 Author: Bruce Guenter Date: Tue Aug 23 17:41:16 2005 +0000 Added notes about recent changes. NEWS | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) 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 deletions(-) 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(+), 0 deletions(-) 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 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) 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(+), 0 deletions(-) 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 deletions(-) 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 files changed, 18 insertions(+), 0 deletions(-) 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 files 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 | 94 ----------------------------- INSTHIER | 189 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ LIB | 88 --------------------------- install.spac | 10 +-- 5 files changed, 192 insertions(+), 191 deletions(-) delete mode 100644 BIN delete mode 100644 INCLUDE create mode 100644 INSTHIER 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 files 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 deletions(-) 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 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) 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 deletions(-) commit cfbfdb9a09bf1f080fb576e806a6a350bcc04129 Author: Bruce Guenter Date: Sat Jul 9 15:44:37 2005 +0000 Fixed up the note about installation. README.in | 3 +-- 1 files changed, 1 insertions(+), 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(+), 0 deletions(-) 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 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) 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 files 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 files changed, 2 insertions(+), 0 deletions(-) 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 files changed, 43 insertions(+), 0 deletions(-) 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 deletions(-) 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(+), 0 deletions(-) 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 files 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 deletions(-) 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 deletions(-) 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(+), 0 deletions(-) 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(+), 0 deletions(-) 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 files 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 files changed, 1 insertions(+), 1 deletions(-) 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 files changed, 31 insertions(+), 0 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) 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 deletions(-) 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 deletions(-) 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 files changed, 9 insertions(+), 0 deletions(-) commit 0dbc7c9cdf76ddb467bb3374f0272fe059d962b5 Author: Bruce Guenter Date: Thu Jun 2 22:37:55 2005 +0000 Removed unused config file. conf-home | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) 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 files 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 | 8 +++----- 4 files changed, 50 insertions(+), 17 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 deletions(-) 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 files 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 files 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 | 141 ++++++++++++++++++++++++++++++----------------------------- 1 files changed, 72 insertions(+), 69 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 files changed, 1 insertions(+), 1 deletions(-) commit 79268b8fae821fbfca6f9e25bc4bddff6b5bb16d Author: Bruce Guenter Date: Thu Nov 18 16:11:48 2004 +0000 Mark ipv4_parse as deprecated. net/ipv4.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) 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 deletions(-) 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 deletions(-) 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 files 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 files changed, 45 insertions(+), 0 deletions(-) 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 files changed, 2 insertions(+), 1 deletions(-) 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 files changed, 2 insertions(+), 0 deletions(-) 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 deletions(-) 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/obuf.h | 108 ++++++++++++++++++++ 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, 312 insertions(+), 286 deletions(-) create mode 100644 iobuf/common.h create mode 100644 iobuf/ibuf.h create mode 100644 iobuf/obuf.h 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 deletions(-) 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 files changed, 1 insertions(+), 0 deletions(-) commit 3b34f5c908f4e746ab2f2c6689947c3d3bbbc35d Author: Bruce Guenter Date: Mon Oct 25 23:29:03 2004 +0000 Added missing #include. unix/selfpipe.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) 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 files 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 files changed, 9 insertions(+), 0 deletions(-) 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 files changed, 1 insertions(+), 0 deletions(-) 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 files changed, 24 insertions(+), 0 deletions(-) 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 deletions(-) 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(+), 0 deletions(-) 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(+), 0 deletions(-) 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 deletions(-) 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 files 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 files changed, 2 insertions(+), 0 deletions(-) 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(+), 0 deletions(-) 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(+), 0 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) 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 deletions(-) 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 deletions(-) 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 deletions(-) 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 deletions(-) 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(+), 0 deletions(-) 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 deletions(-) commit 17bd2f64776abc0547778402ffe545c50d36e1cb Author: Bruce Guenter Date: Wed Mar 24 03:53:47 2004 +0000 Fixed some silly typos. NEWS | 4 ++-- 1 files 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, 0 insertions(+), 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 deletions(-) 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(+), 0 deletions(-) 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(+), 0 deletions(-) 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 deletions(-) commit 8d08c481ebd0e616cfa2aa71d914237614bb9188 Author: Bruce Guenter Date: Fri Mar 5 18:13:18 2004 +0000 Added notes about IPv6 plans. TODO | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) 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(+), 0 deletions(-) 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(+), 0 deletions(-) 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 deletions(-) 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 files changed, 4 insertions(+), 1 deletions(-) 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 files changed, 2 insertions(+), 1 deletions(-) commit b491fb5cbe22b1b602ffe57167c1aad1001f4bd5 Author: Bruce Guenter Date: Wed Feb 25 05:01:40 2004 +0000 Added notes. TODO | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) 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(+), 0 deletions(-) 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 files changed, 16 insertions(+), 0 deletions(-) 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(+), 0 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) 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 files changed, 4 insertions(+), 1 deletions(-) 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 files 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 files 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 files changed, 2 insertions(+), 0 deletions(-) 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(+), 0 deletions(-) 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 files changed, 5 insertions(+), 0 deletions(-) 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(+), 0 deletions(-) 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 deletions(-) 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 files changed, 1 insertions(+), 0 deletions(-) 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/{tcp6.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/{tcp6.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(+), 0 deletions(-) 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 files changed, 1 insertions(+), 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 files changed, 6 insertions(+), 0 deletions(-) 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 files changed, 1 insertions(+), 0 deletions(-) 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 files changed, 18 insertions(+), 0 deletions(-) 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(+), 0 deletions(-) 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 files changed, 7 insertions(+), 0 deletions(-) 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(+), 0 deletions(-) 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 | 481 ++++++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 319 insertions(+), 162 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(+), 0 deletions(-) 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(+), 0 deletions(-) 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 deletions(-) commit e745c8e8baf201f6dcb117229471aacf2003c159 Author: Bruce Guenter Date: Mon Dec 1 17:24:43 2003 +0000 Added note about missing include fix. NEWS | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) 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 files changed, 1 insertions(+), 0 deletions(-) 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 files 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 files 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 deletions(-) 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 deletions(-) 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 deletions(-) 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 deletions(-) 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 files changed, 1 insertions(+), 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 files 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 files 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(+), 0 deletions(-) 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(+), 0 deletions(-) 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 files changed, 0 insertions(+), 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(+), 0 deletions(-) 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 files changed, 2 insertions(+), 1 deletions(-) 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 files changed, 4 insertions(+), 0 deletions(-) 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 files 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 files changed, 1 insertions(+), 1 deletions(-) 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 deletions(-) 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 files changed, 0 insertions(+), 1 deletions(-) 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 files 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 deletions(-) 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(+), 0 deletions(-) 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 files changed, 2 insertions(+), 0 deletions(-) commit c87fe8a83fa51d12fae876e3c8331e1017a43394 Author: Bruce Guenter Date: Mon Apr 7 16:35:15 2003 +0000 Install the right SHA headers. insthier.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) 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 | 97 +++++++++++++++++++++++++++++------------------------- 3 files changed, 88 insertions(+), 74 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(+), 0 deletions(-) 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 files changed, 16 insertions(+), 0 deletions(-) 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 | 151 +++++++++++++++++++++++------------------------------- crypto/sha512a.h | 16 +++--- 3 files changed, 73 insertions(+), 96 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 deletions(-) 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 files 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(+), 0 deletions(-) commit e6ef2254bc811e942fcf863c292c0b728be78fbf Author: Bruce Guenter Date: Tue Apr 1 23:02:21 2003 +0000 Noted miscelaneous changes. NEWS | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) commit 87f4ca133d1adf719935017c568cd3696a5d73ed Author: Bruce Guenter Date: Tue Apr 1 22:59:38 2003 +0000 Another portability fix. unix/sig_all.c | 9 +++++---- 1 files 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(+), 0 deletions(-) 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 files changed, 2 insertions(+), 0 deletions(-) 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 files 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 files changed, 1 insertions(+), 0 deletions(-) commit bbf56464ce32501a5d4475e28b89c02f80c9c4a8 Author: Bruce Guenter Date: Tue Apr 1 22:41:20 2003 +0000 Install all the ADT headers. insthier.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) 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 files 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(+), 0 deletions(-) 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(+), 0 deletions(-) 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 files 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 files 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 files 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 deletions(-) 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 files 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 deletions(-) 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 files changed, 20 insertions(+), 0 deletions(-) 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 files 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(+), 0 deletions(-) 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 files 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 files changed, 1 insertions(+), 1 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) 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 insertions(+), 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 files changed, 2 insertions(+), 0 deletions(-) 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 files changed, 490 insertions(+), 0 deletions(-) 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} | 77 ++++------- 4 files changed, 437 insertions(+), 50 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 files changed, 2 insertions(+), 1 deletions(-) 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 deletions(-) commit 92ed7e59e572f7a157eb14372232e59892cde10a Author: Bruce Guenter Date: Wed Mar 19 23:00:22 2003 +0000 Added missing (assumed) library. selftests.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) commit 82f430e37534ffa2b405669198a0409b062477e0 Author: Bruce Guenter Date: Wed Mar 19 22:46:19 2003 +0000 Some portability and cleanliness fixes. selftests.sh | 8 +++++--- 1 files 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 files changed, 1 insertions(+), 1 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) 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(+), 0 deletions(-) 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(+), 0 deletions(-) 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 files 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(+), 0 deletions(-) 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, 0 insertions(+), 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(+), 0 deletions(-) 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 deletions(-) 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 files changed, 4 insertions(+), 0 deletions(-) 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(+), 0 deletions(-) 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 files 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 files changed, 3 insertions(+), 0 deletions(-) commit 2d2d4081dc2dacb47fbf68b278ef54be5f87027e Author: Bruce Guenter Date: Fri Mar 14 20:18:46 2003 +0000 Removed the (now) unneeded build rules. load.spac | 6 ------ 1 files changed, 0 insertions(+), 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 files changed, 1 insertions(+), 1 deletions(-) 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(+), 0 deletions(-) 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 files 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 files 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 deletions(-) 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 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) 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 files changed, 1 insertions(+), 0 deletions(-) commit 668de4a5ff5b9d5fd27919107fbb76a44742715e Author: Bruce Guenter Date: Wed Mar 5 22:26:43 2003 +0000 More notes. TODO | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) 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(+), 0 deletions(-) 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 files changed, 1 insertions(+), 0 deletions(-) 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 files 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 deletions(-) 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 files changed, 2 insertions(+), 0 deletions(-) commit 33f09e7c1eba2c0b5f33d974eda664e8fa1fc97e Author: Bruce Guenter Date: Tue Feb 11 00:00:44 2003 +0000 Added missing cvm and pwcmp symlinks. insthier.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) 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 files changed, 8 insertions(+), 0 deletions(-) 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(+), 0 deletions(-) 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 files changed, 1 insertions(+), 0 deletions(-) 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(+), 0 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) 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 files changed, 921 insertions(+), 0 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) 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 files 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 files changed, 1 insertions(+), 1 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) commit 6e3764fe327fc887f9854bbd9e3fbe0ec9b1b79a Author: Bruce Guenter Date: Fri Jan 3 18:03:07 2003 +0000 Added note about internal reorganizations. NEWS | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) 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(+), 0 deletions(-) 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 files changed, 5 insertions(+), 1 deletions(-) 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 files 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 files 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 files changed, 1 insertions(+), 1 deletions(-) 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 files 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 files changed, 4 insertions(+), 0 deletions(-) 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 deletions(-) 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 files changed, 1 insertions(+), 0 deletions(-) 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(+), 0 deletions(-) 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, 0 insertions(+), 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, 0 insertions(+), 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 files 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(+), 0 deletions(-) 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 files 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(+), 0 deletions(-) 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 files 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 files changed, 2 insertions(+), 0 deletions(-) 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 deletions(-) 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 files 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(+), 0 deletions(-) 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 | 50 +++++++++++++++++++++++++------------------------- uint64_pack_msb.c | 21 +++++++++++++++++++++ 2 files changed, 46 insertions(+), 25 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(+), 0 deletions(-) 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(+), 0 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) 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 files changed, 1 insertions(+), 0 deletions(-) commit beb6406eb4b2e03e34a95d0d64a659ef8f39925a Author: Bruce Guenter Date: Tue Dec 17 22:44:41 2002 +0000 Added note about new lib structure. NEWS | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) commit 624d740adfc6a17ce26827b67a33047e64100c44 Author: Bruce Guenter Date: Tue Dec 17 22:44:25 2002 +0000 Switched to a templated README. README => README.in | 10 +++------- 1 files 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 | 94 +++++++++++++++++++++++++++++++------------------- 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, 270 insertions(+), 226 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 files 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 files changed, 1 insertions(+), 1 deletions(-) commit af436f26bd572f2c9019ac1bf1819d0301d36ff0 Author: Bruce Guenter Date: Tue Dec 17 20:15:47 2002 +0000 Eliminated another shadowed global variable. iobuf/iobuf.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) 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 files changed, 1 insertions(+), 0 deletions(-) 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 files 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 files changed, 1 insertions(+), 1 deletions(-) commit e6fff1ddbfc14339d25d6142e753ccf45cd3b690 Author: Bruce Guenter Date: Fri Oct 18 02:06:10 2002 +0000 Bumped version to 1.004 VERSION | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) 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 files changed, 2 insertions(+), 0 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) 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(+), 0 deletions(-) commit 31a772ddd8cecf9e9240c58f771c69614ce566b5 Author: Bruce Guenter Date: Wed Oct 16 11:54:20 2002 +0000 *** empty log message *** NEWS | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) 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 files changed, 5 insertions(+), 0 deletions(-) commit d48da33692ba1d34325715e363f2455440c98bf1 Author: Bruce Guenter Date: Tue Oct 8 05:55:20 2002 +0000 Add missing include. iobuf/iobuf_close.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) 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 files changed, 2 insertions(+), 1 deletions(-) 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 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) commit 4a150dd31ba54a557b6fa6dcbbe08d83284e85b1 Author: Bruce Guenter Date: Thu Aug 15 10:11:25 2002 +0000 Portability fixes for FreeBSD (and possibly others). NEWS | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) 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(+), 0 deletions(-) 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(+), 0 deletions(-) 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(+), 0 deletions(-) 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 files changed, 0 insertions(+), 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 deletions(-) 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(+), 0 deletions(-) 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 files 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 files changed, 1 insertions(+), 1 deletions(-) commit 4d1de8e2c05c932ae352700e0a0d7eefbf484b65 Author: Bruce Guenter Date: Sat Jun 1 04:31:26 2002 +0000 Fixed a typo. unix/sig_block.c | 4 ++-- 1 files 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 files changed, 6 insertions(+), 0 deletions(-) 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 files changed, 2 insertions(+), 1 deletions(-) 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(+), 0 deletions(-) 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, 0 insertions(+), 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 files changed, 0 insertions(+), 1 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) 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(+), 0 deletions(-) commit 5292b752917e9971a59f70cc8d3a6394e9d67cd9 Author: Bruce Guenter Date: Fri May 31 06:01:50 2002 +0000 First check in. 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 ++++++++++++++++++++++++++++++++++++++++++++ 26 files changed, 643 insertions(+), 0 deletions(-) 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(+), 0 deletions(-) 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(+), 0 deletions(-) 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 files 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 files changed, 3 insertions(+), 0 deletions(-) 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 files changed, 21 insertions(+), 0 deletions(-) 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 files changed, 2 insertions(+), 0 deletions(-) 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, 0 insertions(+), 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 files changed, 1 insertions(+), 1 deletions(-) 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 files 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 files 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 files changed, 1 insertions(+), 1 deletions(-) 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 deletions(-) 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 files changed, 0 insertions(+), 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 files 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/{unixstr.c => pair.c} | 8 ++++---- net/socket.h | 2 ++ net/socket=l | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) copy net/{unixstr.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 files 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 files changed, 1 insertions(+), 1 deletions(-) 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(+), 0 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) 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/listen.c => net/setopt.c | 7 ++--- {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(+), 43 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/listen.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/{udp.c => cork.c} | 19 +++++++++++++------ socket/socket.h | 2 ++ socket/socket=l | 2 ++ socket/{getaddr4.c => uncork.c} | 29 ++++++++++++++++------------- 4 files changed, 33 insertions(+), 19 deletions(-) copy socket/{udp.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(+), 0 deletions(-) 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 insertions(+), 1 deletions(-) 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 files changed, 2 insertions(+), 1 deletions(-) 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 files 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 files changed, 2 insertions(+), 1 deletions(-) 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 files 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 files 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 files changed, 1 insertions(+), 1 deletions(-) commit 825b413641ad29eabef1855b7686ce9f045e0d7b Author: Bruce Guenter Date: Fri Sep 7 12:38:53 2001 +0000 Added ibuf_getstr_crlf object. iobuf/str=l | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) 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(+), 0 deletions(-) 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 files changed, 1 insertions(+), 0 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) commit 0a4ec19bdbd0e5a9f6bada9ea06727b158f8c874 Author: Bruce Guenter Date: Fri Sep 7 12:36:36 2001 +0000 Added missing objects. str/str=l | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) commit 32bec39c79aa2310760592bc3baa360b4557937e Author: Bruce Guenter Date: Sat Aug 25 11:14:21 2001 +0000 Added some documentation. cvm-sasl/cvm-sasl.html | 38 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 38 insertions(+), 0 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) 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(+), 0 deletions(-) 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(+), 0 deletions(-) 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 files changed, 1 insertions(+), 0 deletions(-) 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(+), 0 deletions(-) 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 files changed, 0 insertions(+), 1 deletions(-) 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(+), 0 deletions(-) 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(+), 0 deletions(-) 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(+), 0 deletions(-) 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(+), 0 deletions(-) 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(+), 0 deletions(-) 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(+), 0 deletions(-) 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 files 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 | 80 ++++++++++++++++++++++++++++++++++------------------------- err/error.c | 4 +- err/warn.c | 4 +- 4 files changed, 52 insertions(+), 40 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 files changed, 1 insertions(+), 1 deletions(-) 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(+), 0 deletions(-) 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 files 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 files changed, 2 insertions(+), 0 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) 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 files changed, 2 insertions(+), 1 deletions(-) commit 8920457597f7f7930b69acad2d0da0754a7f2f68 Author: Bruce Guenter Date: Fri Jun 15 04:12:51 2001 +0000 Need to include string.h str/realloc.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) 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(+), 0 deletions(-) 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(+), 0 deletions(-) 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 files 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/{tcp.c => unixdgm.c} | 6 +++--- socket/{tcp.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/{tcp.c => unixdgm.c} (88%) copy socket/{tcp.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 files 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 files 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 files changed, 10 insertions(+), 0 deletions(-) commit 6142295d98652a24c633f4fcfa0e618e2f2217fb Author: Bruce Guenter Date: Wed Mar 28 21:26:34 2001 +0000 Don't handle interrupted connections. socket/connect4.c | 3 +-- 1 files changed, 1 insertions(+), 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 files changed, 4 insertions(+), 0 deletions(-) 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 files 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 files changed, 0 insertions(+), 1 deletions(-) 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 files 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 files changed, 1 insertions(+), 1 deletions(-) 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 files changed, 1 insertions(+), 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/copy.c => socket/connect4.c | 35 ++++++++++++++++------------------- str/lower.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(+), 91 deletions(-) copy str/findnext.c => socket/accept4.c (63%) copy str/buildmap.c => socket/bind4.c (64%) copy str/copy.c => socket/connect4.c (60%) copy str/lower.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 files changed, 1 insertions(+), 0 deletions(-) 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 | 47 +++----- cli/clitest.cc | 47 -------- cli/main.c | 348 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ cli/main.cc | 342 ------------------------------------------------------ cli/messages.cc | 44 ------- 7 files changed, 366 insertions(+), 590 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 files 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 files 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 files 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 files 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 files changed, 6 insertions(+), 1 deletions(-) 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 files changed, 1 insertions(+), 1 deletions(-) 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 files 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 files changed, 6 insertions(+), 0 deletions(-) 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 files changed, 1 insertions(+), 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 files changed, 3 insertions(+), 1 deletions(-) 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 files 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(+), 0 deletions(-) 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 files changed, 1 insertions(+), 0 deletions(-) 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 deletions(-) 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 files 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 files 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 files 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, 0 insertions(+), 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 files changed, 6 insertions(+), 0 deletions(-) commit 02355232772f9d82f07b5a84b11212d1f95d8410 Author: Bruce Guenter Date: Thu Mar 1 00:15:55 2001 +0000 Added counting functions. str/{findprev.c => count.c} | 17 ++++++++++------- str/{findlastof.c => countof.c} | 16 ++++++++++------ 2 files changed, 20 insertions(+), 13 deletions(-) copy str/{findprev.c => count.c} (75%) copy str/{findlastof.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 files 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 files 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(+), 0 deletions(-) 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(+), 0 deletions(-) commit 660a28a5a45e7650a16cc96c478af603f2aa68c7 Author: Bruce Guenter Date: Mon Oct 2 23:21:41 2000 +0000 Added some missing includes. mystring/append.cc | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) 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(+), 0 deletions(-) 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 | 74 +++++++++++++++++++++++--------------------- cli++/cli_parse.pl | 33 ++++++++++++++++++-- cli/cli2html.pl | 86 ++++++++++++++++++++++++++++----------------------- cli/cli2man.pl | 74 +++++++++++++++++++++++--------------------- cli/cli_parse.pl | 33 ++++++++++++++++++-- 6 files changed, 232 insertions(+), 154 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(+), 0 deletions(-) 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 files 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 files 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(+), 0 deletions(-) commit 941b9e6134401386626c159a743adb14d1a99aa0 Author: Bruce Guenter Date: Sat Apr 8 01:12:17 2000 +0000 *** empty log message *** fdbuf/fdobuf.cc | 12 ++++++------ 1 files 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 | 108 +++++++-------------- 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, 172 insertions(+), 143 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/fdobuf.h | 86 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 147 insertions(+), 95 deletions(-) create mode 100644 fdbuf/fdibuf.h create mode 100644 fdbuf/fdobuf.h 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 +++--------------------------------- mystring/{iter.cc => rep.h} | 50 +++++++-------- 9 files changed, 167 insertions(+), 164 deletions(-) create mode 100644 mystring/fdobuf.cc copy cdb++/datum.cc => mystring/iter.h (64%) create mode 100644 mystring/join.h copy mystring/{iter.cc => 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 files changed, 1 insertions(+), 1 deletions(-) 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(+), 0 deletions(-) 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(+), 0 deletions(-) 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-1.106/selftests.sh0000664000076400007640000000175411147311330014701 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 '1,/^#ifdef SELFTEST_EXP$/d' -e '/^#endif/,$d' $1 >$t/test.exp sed -e 's/-o ${base}.o//' compile | \ sh -s $1 -DSELFTEST_MAIN -o $t/test.o || { echo "=====> Compile failed! <=====" return 1 } ./load $t/test .libs/libbg.a .libs/libbg-sysdeps.a || { echo "=====> Load failed! <=====" return 1 } ( cd $t && ./test >./test.out 2>&1; ) || { echo "=====> Test failed! <=====" return 1 } cat -v $t/test.out | $DIFF $t/test.exp - || { 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-1.106/README0000664000076400007640000000257111147311327013215 0ustar bruceguenterbglibs One stop library package Bruce Guenter Version 1.106 2009-02-19 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 via git at: http://untroubled.org/git/bglibs.git Installation: - Build the sources by running "make" - After the package has been compiled, run the following command as root: make install Copyright(C) 2009 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-1.106/conf-man0000664000076400007640000000021411147311327013746 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-1.106/misc/0000755000076400007640000000000011147311330013253 5ustar bruceguenterbglibs-1.106/misc/random.c0000664000076400007640000001542111147311327014712 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 "misc.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-1.106/misc/misc.h0000664000076400007640000000066511147311327014376 0ustar bruceguenter#ifndef MISC__H__ #define MISC__H__ #include 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-1.106/misc/ucspi.h0000664000076400007640000000057211147311327014563 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-1.106/misc/strtou.c0000664000076400007640000000114111147311327014764 0ustar bruceguenter#include "misc.h" unsigned long strtou(const char* str, const char** end) { unsigned long u; unsigned digit; for (u = 0; (digit = *str - '0') <= 9; ++str) u = u * 10 + digit; *end = str; return u; } #ifdef SELFTEST_MAIN #include "selftest.c" 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-1.106/misc/utoa.c0000664000076400007640000000123311147311327014376 0ustar bruceguenter#include "misc.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 #include "selftest.c" 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-1.106/misc/utoa2.c0000664000076400007640000000105111147311330014450 0ustar bruceguenter#include "misc.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 #include "selftest.c" 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-1.106/misc/ucspi.c0000664000076400007640000000252311147311327014554 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 #include "selftest.c" 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-1.106/SRCFILES0000664000076400007640000001770011147311327013472 0ustar bruceguenterINSTHIER adt/adt_sp.c adt/common.h adt/ghash.h 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.h adt/gqueue_pop.c adt/gqueue_push.c adt/gqueue_top.c adt/gstack.h adt/gstack_pop.c adt/gstack_push.c adt/gstack_top.c adt/hashb.c adt/hashs.c base64/asc2bin.c base64/base64.h base64/bin2asc.c base64/decode_line.c base64/decode_part.c base64/encode_line.c base64/encode_part.c bg-installer.c cdb/cdb.c cdb/cdb.h cdb/cdbhash.c cdb/find.c cdb/get.c cdb/getnext.c cdb/make.c cdb/make.h cdb/read.c cdb/str.h cli-generate.pl cli/cli.h cli/help.c cli/internal.h cli/main.c crc-gentab.c crc/crc16_arc.h crc/crc16_ccitt.h crc/crc16_xmodem.h crc/crc32.h crc/crc32c.h crc/crc64.h crc/gcrc.h 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/hmac.h crypto/md4.c crypto/md4.h crypto/md5-crypt.c crypto/md5.c crypto/md5.h crypto/sha1.c crypto/sha1.h crypto/sha256.c crypto/sha256.h crypto/sha384.c crypto/sha384.h crypto/sha512.c crypto/sha512.h crypto/surf.c crypto/surf.h crypto/surfrand.c crypto/surfrand.h dict/add.c dict/dict.h dict/dicthash.c dict/foreach.c dict/free.c dict/get.c dict/init.c dict/load.h dict/load_list.c dict/load_map.c dict/str_free.c fmt/char.c fmt/chars.c fmt/lcase.c fmt/misc.h fmt/multi.c fmt/multi.h fmt/number.h 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 instlib/installer.c instlib/installer.h instlib/instcheck.c instlib/instmain.c instlib/instshow.c iobuf/common.h iobuf/ibuf.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.h iobuf/iobuf_close.c iobuf/iobuf_copy.c iobuf/iobuf_init.c iobuf/iobuf_timeout.c iobuf/obuf.h 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/misc.h misc/random.c misc/strtou.c misc/ucspi.c misc/ucspi.h misc/utoa.c misc/utoa2.c msg/common.c msg/commonf.c msg/debug.c msg/debug.h msg/debug_bits.c msg/debug_init.c msg/debugf.c msg/die.c msg/dief.c msg/error.c msg/errorf.c msg/msg.h msg/oom.c msg/show_pid.c msg/warn.c msg/warnf.c msg/wrap.h 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/getaddr4.c net/getaddr6.c net/ipv4.h net/ipv4_addr.c net/ipv4_format.c net/ipv4_scan.c net/ipv6.h 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.h net/resolve_error.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/socket.h 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 path/path.h pwcmp/client.c pwcmp/client.h pwcmp/hex.h pwcmp/hex_encode.c pwcmp/module.c pwcmp/module.h selftest.c selftests.sh str/alloc.c str/buildmap.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/env.h 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.h 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/str.h 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/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/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.h unix/cloexec_off.c unix/cloexec_on.c unix/fcntl.h unix/fcntl_fd_off.c unix/fcntl_fd_on.c unix/fcntl_fl_off.c unix/fcntl_fl_on.c unix/nonblock.h unix/nonblock_off.c unix/nonblock_on.c unix/selfpipe.c unix/selfpipe.h unix/sig.h 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/signalfd.h unix/trigger.h 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-1.106/uint64/0000755000076400007640000000000011147311330013451 5ustar bruceguenterbglibs-1.106/uint64/get_lsb.c0000664000076400007640000000123111147311330015233 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-1.106/uint64/pack_msb.c0000664000076400007640000000120411147311330015373 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-1.106/uint64/unpack_msb.c0000664000076400007640000000124111147311330015737 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-1.106/uint64/unpack_lsb.c0000664000076400007640000000124111147311330015736 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-1.106/uint64/get_msb.c0000664000076400007640000000123111147311330015234 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-1.106/uint64/pack_lsb.c0000664000076400007640000000120411147311330015372 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-1.106/sysdeps-head.h0000664000076400007640000000020011147311330015054 0ustar bruceguenter#ifndef SYS_DEPS__H__ #define SYS_DEPS__H__ #include typedef unsigned char uint8; typedef unsigned short uint16; bglibs-1.106/TARGETS0000664000076400007640000002751611147311327013377 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.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 crypt.lib 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 dotlibs 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 instlib/installer.lo instlib/installer.o instlib/instcheck.lo instlib/instcheck.o instlib/instmain.lo instlib/instmain.o instlib/instshow.lo instlib/instshow.o 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-adt.la libbg-base64.la libbg-cdb.la libbg-cli.la libbg-crc.la libbg-crypto.la libbg-dict.la libbg-fmt.la libbg-installer.la libbg-instcheck.la libbg-instshow.la libbg-iobuf.la libbg-misc.la libbg-msg.la libbg-net.la libbg-path.la libbg-str.la libbg-sysdeps.la libbg-unix.la libbg.la libpwcmp-module.la libpwcmp.la libraries libvmailmgr.la load ltcompile ltload m.lib makeshlib 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.lib 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/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_error.lo net/resolve_error.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 pwcmp/client.lo pwcmp/client.o pwcmp/hex_encode.lo pwcmp/hex_encode.o pwcmp/module.lo pwcmp/module.o rt.lib s.lib selftests shadow.lib socket.lib str/alloc.lo str/alloc.o str/buildmap.lo str/buildmap.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/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-1.106/cli-generate.10000664000076400007640000001112611147311327014752 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-1.106/crc-gentab.c0000664000076400007640000000570211147311327014505 0ustar bruceguenter#include #include #include "sysdeps.h" #include "iobuf/iobuf.h" #include "msg/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-1.106/path/0000755000076400007640000000000011147311330013254 5ustar bruceguenterbglibs-1.106/path/path.h0000664000076400007640000000123611147311330014365 0ustar bruceguenter#ifndef LIB__PATH__H__ #define LIB__PATH__H__ #include "str/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-1.106/path/mktemp.c0000664000076400007640000000174311147311330014724 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-1.106/path/mkdirs.c0000664000076400007640000000202211147311330014707 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-1.106/path/contains.c0000664000076400007640000000276211147311330015247 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-1.106/path/fnmatch.c0000664000076400007640000000474111147311330015050 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 #include "selftest.c" 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)); } MAIN { t("abc", "*", 0); t("abc", "*", 1); t(".", "*", 0); t(".", "*", 1); t("..", "*", 0); t("..", "*", 1); t("...", "*", 0); t("...", "*", 1); t(".abc", "*", 0); t(".abc", "*", 1); } #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-1.106/path/match.c0000664000076400007640000001415111147311330014520 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/str.h" #include "str/iter.h" #include "path.h" #include "msg/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 "selftest.c" #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]*", 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 => 4 test test.exp test.o test.out *.o 0 => 1 test.o *.o* 0 => 2 test.o test.out *.[eo] 0 => 1 test.o t* 0 => 4 test test.exp test.o test.out *.[!o]* 0 => 1 test.exp [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-1.106/path/merge.c0000664000076400007640000000603511147311330014525 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 "selftest.c" #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-1.106/str/0000755000076400007640000000000011147311330013130 5ustar bruceguenterbglibs-1.106/str/env_from_string.c0000664000076400007640000000125111147311330016476 0ustar bruceguenter#include #include "str.h" #include "env.h" /** Adds the string-based list of assignments to the environment string. * Each individual assignment in the list must be ASCII NUL terminated, * and the final assignment must be followed by two ASCII NULs. */ int envstr_from_string(struct str* env, const char* s, int overwrite) { long len; while ((len = strlen(s)) > 0) { if (!envstr_put(env, s, overwrite)) return 0; s += len + 1; } return 1; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { static str env; debugstrfn(envstr_from_string(&env, "A=3\0C=4\0", 1), &env); } #endif #ifdef SELFTEST_EXP result=1 len=8 size=16 s=A=3^@C=4^@ #endif bglibs-1.106/str/iter_valid.c0000664000076400007640000000031111147311330015413 0ustar bruceguenter#include "iter.h" #include "str.h" /** Determine if a striter is valid (after initialization or advancing). */ int striter_valid(striter* iter) { return iter->str && iter->start < iter->str->len; } bglibs-1.106/str/rstrip.c0000664000076400007640000000212711147311330014623 0ustar bruceguenter/* str/rstrip.c - Strip whitespace from the right of a string * 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 "str.h" /** Strip all white space from the right (end) of the string */ void str_rstrip(str* s) { unsigned len; for (len = s->len; len > 0 && isspace(s->s[len-1]); --len) ; s->len = len; s->s[len] = 0; } bglibs-1.106/str/cmp.c0000664000076400007640000000331411147311330014056 0ustar bruceguenter/* str/cmp.c - Compare part of two strings * 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 "str.h" /** Compare part of two strings. This function compares two strings, starting at \c aoffset bytes into \c a and \c boffset bytes into \c b. The first non-zero difference is returned. If the portion of \c b is longer than the portion of \c a, the result is positive. */ int str_cmp(const str* a, unsigned aoffset, const str* b, unsigned boffset) { return str_cmpb(a, aoffset, b->s+boffset, b->len-boffset); } /** Compare a string against a C string. */ int str_cmps(const str* a, unsigned offset, const char* b) { return str_cmpb(a, offset, b, strlen(b)); } /** Compare a string against a binary block. */ int str_cmpb(const str* a, unsigned offset, const char* b, unsigned len) { char* aptr; if (len + offset > a->len) return 1; for (aptr = a->s+offset; len; ++aptr, ++b, --len) if (*b - *aptr) return *b - *aptr; return 0; } bglibs-1.106/str/catiwll.c0000664000076400007640000000234511147311330014741 0ustar bruceguenter/* str/catiwll.c - Append an signed long long integer * 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 "str.h" /** Append a signed long long integer in decimal. */ int str_catill(str* s, long long in) { return str_catsllnumw(s, in, 0, 0, 10, str_lcase_digits); } /** Append a signed long long integer in decimal, padded to a minimum width. */ int str_catiwll(str* s, long long in, unsigned width, char pad) { return str_catsllnumw(s, in, width, pad, 10, str_lcase_digits); } bglibs-1.106/str/start.c0000664000076400007640000000331711147311330014437 0ustar bruceguenter/* str/start.c - String prefix matching * 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 "str.h" /** Match the prefix of the string to a C string. */ int str_starts(const str* a, const char* b) { return str_startb(a, b, strlen(b)); } /** Match the prefix of the string to another string. */ int str_start(const str* a, const str* b) { return str_startb(a, b->s, b->len); } /** Match the prefix of the string to a binary chunk. */ int str_startb(const str* a, const char* b, unsigned len) { if (len > a->len) return 0; return memcmp(a->s, b, len) == 0; } #ifdef SELFTEST_MAIN #include "selftest.c" static str s = { "Return-Path: <>\n", 16, 0 }; void t(const char* f) { obuf_putu(&outbuf, str_starts(&s, f)); obuf_endl(&outbuf); } MAIN { t("Return-"); t("return-"); t("XYZZY"); t("Return-Path: <>\n"); t("Return-Path: <>\n "); t("return-path: <>\n"); t("return-path: <>\n "); } #endif #ifdef SELFTEST_EXP 1 0 0 1 0 0 0 #endif bglibs-1.106/str/copyf.c0000664000076400007640000000317511147311330014424 0ustar bruceguenter/* str/copyf.c - Copy formatted data into a 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 "str.h" #include "fmt/multi.h" /** Copy formatted data using \c fmt_multi from a \c va_list */ int str_copyfv(str* s, const char* format, va_list ap) { unsigned length; va_list ap2; va_copy(ap2, ap); length = fmt_multiv(0, format, ap2); va_end(ap2); if (!str_ready(s, length)) return 0; fmt_multiv(s->s, format, ap); s->s[s->len = length] = 0; return 1; } /** Copy formatted data using \c fmt_multi from variable arguments */ int str_copyf(str* s, const char* format, ...) { int i; va_list ap; va_start(ap, format); i = str_copyfv(s, format, ap); va_end(ap); return i; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { static str s; debugstrfn(str_copyf(&s, "d{bar}x", 10, 20), &s); } #endif #ifdef SELFTEST_EXP result=1 len=7 size=16 s=10bar14 #endif bglibs-1.106/str/cat.c0000664000076400007640000000267611147311330014060 0ustar bruceguenter/* str/cat.c - Append to a string * 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 "str.h" /** Append another string */ int str_cat(str* s, const str* in) { return str_catb(s, in->s, in->len); } /** Append a C string */ int str_cats(str* s, const char* in) { return str_catb(s, in, strlen(in)); } /** Append a single character */ int str_catc(str* s, char in) { if (!str_realloc(s, s->len+1)) return 0; s->s[s->len++] = in; s->s[s->len] = 0; return 1; } /** Append a binary block */ int str_catb(str* s, const char* in, unsigned len) { if (!str_realloc(s, s->len + len)) return 0; memcpy(s->s+s->len, in, len); s->len += len; s->s[s->len] = 0; return 1; } bglibs-1.106/str/env_put.c0000664000076400007640000000174311147311330014763 0ustar bruceguenter#include #include "str.h" #include "env.h" /** Put an assignment, in \c NAME=value format, into the environment * string. * \note Unlike putenv, a copy of the assignment is made instead of * keeping a copy of the given pointer. */ int envstr_put(struct str* env, const char* asgn, int overwrite) { long varlen; const char* found; found = strchr(asgn, '='); varlen = (found == 0) ? (long)strlen(asgn) : found - asgn; if ((found = envstr_find(env, asgn, varlen)) != 0) { if (!overwrite) return 1; str_spliceb(env, found - env->s, strlen(found) + 1, 0, 0); } return str_cats(env, asgn) && str_catc(env, 0); } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { static str env; debugstrfn(envstr_put(&env, "A=4", 0), &env); debugstrfn(envstr_put(&env, "A=5", 0), &env); debugstrfn(envstr_put(&env, "A=6", 1), &env); } #endif #ifdef SELFTEST_EXP result=1 len=4 size=16 s=A=4^@ result=1 len=4 size=16 s=A=4^@ result=1 len=4 size=16 s=A=6^@ #endif bglibs-1.106/str/cat2s.c0000664000076400007640000000265511147311330014322 0ustar bruceguenter/* str/cat2s.c - Append two C strings to a dynamic str * 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 "str.h" /** Append 2 C strings */ int str_cat2s(str* s, const char* a, const char* b) { char* ptr; unsigned alen = strlen(a); unsigned blen = strlen(b); if (!str_realloc(s, s->len+alen+blen)) return 0; ptr = s->s + s->len; s->len += alen+blen; memcpy(ptr, a, alen); ptr += alen; memcpy(ptr, b, blen); ptr += blen; *ptr = 0; return 1; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { static str s; str_copyb(&s, "abc", 3); debugstrfn(str_cat2s(&s, "1", "2"), &s); } #endif #ifdef SELFTEST_EXP result=1 len=5 size=16 s=abc12 #endif bglibs-1.106/str/iter.h0000664000076400007640000000256011147311330014251 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-1.106/str/findnextof.c0000664000076400007640000000312611147311330015444 0ustar bruceguenter/* str/findnextof.c - Find the next character of a set in a string * 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 "str.h" /** Find the next instance of the given list of characters, on or after \c pos */ int str_findnextof(const str* s, const char* list, unsigned pos) { char* p; int map[256]; if (pos >= s->len) return -1; str_buildmap(map, list); for (p = s->s + pos; pos < s->len; pos++, p++) if (map[*(unsigned char*)p] >= 0) return pos; return -1; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { str s = { "01234567890123456", 16, 0 }; obuf_puti(&outbuf, str_findnextof(&s, "654", 0)); NL(); obuf_puti(&outbuf, str_findnextof(&s, "654", 4)); NL(); obuf_puti(&outbuf, str_findnextof(&s, "654", 5)); NL(); obuf_puti(&outbuf, str_findnextof(&s, "678", 9)); NL(); } #endif #ifdef SELFTEST_EXP 4 4 5 -1 #endif bglibs-1.106/str/countof.c0000664000076400007640000000232111147311330014751 0ustar bruceguenter/* str/count.c - Count the instances of a character set * 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 "str.h" /** Count the number of instances of a list of characters */ unsigned str_countof(const str* s, const char* list) { const char* ptr; unsigned pos; unsigned count; int map[256]; str_buildmap(map, list); count = 0; for (pos = 0, ptr = s->s; pos < s->len; ++ptr, ++pos) if (map[*(unsigned char*)ptr] >= 0) ++count; return count; } bglibs-1.106/str/catuw.c0000664000076400007640000000231111147311330014416 0ustar bruceguenter/* str/catuw.c - Append an unsigned integer * 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 "str.h" /** Append an unsigned integer in decimal. */ int str_catuw(str* s, unsigned long in, unsigned width, char pad) { return str_catunumw(s, in, width, pad, 10, str_lcase_digits); } /** Append an unsigned integer in decimal, padded to a minimum width. */ int str_catu(str* s, unsigned long in) { return str_catunumw(s, in, 0, 0, 10, str_lcase_digits); } bglibs-1.106/str/case_start.c0000664000076400007640000000372111147311330015431 0ustar bruceguenter/* str/case_start.c - Case insensitive string prefix matching * 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 "str.h" /** Match the prefix of the string to a binary chunk. */ int str_case_startb(const str* a, const char* b, unsigned len) { const char* aptr; if (len > a->len) return 0; for (aptr = a->s; len > 0; --len) { char bc = *b++; char ac = *aptr++; if (isupper(bc)) bc = tolower(bc); if (isupper(ac)) ac = tolower(ac); if (ac != bc) return 0; } return 1; } /** Match the prefix of the string to a C string. */ int str_case_starts(const str* a, const char* b) { return str_case_startb(a, b, strlen(b)); } /** Match the prefix of the string to another string. */ int str_case_start(const str* a, const str* b) { return str_case_startb(a, b->s, b->len); } #ifdef SELFTEST_MAIN #include "selftest.c" static str s = { "Return-Path: <>\n", 16, 0 }; void t(const char* f) { obuf_putu(&outbuf, str_case_starts(&s, f)); obuf_endl(&outbuf); } MAIN { t("Return-"); t("return-"); t("XYZZY"); t("Return-Path: <>\n"); t("Return-Path: <>\n "); t("return-path: <>\n"); t("return-path: <>\n "); } #endif #ifdef SELFTEST_EXP 1 1 0 1 0 1 0 #endif bglibs-1.106/str/catxwll.c0000664000076400007640000000240711147311330014757 0ustar bruceguenter/* str/catuwll.c - Append an unsigned long long integer * 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 "str.h" /** Append an unsigned long long integer in hexadecimal. */ int str_catxll(str* s, unsigned long long in) { return str_catullnumw(s, in, 0, 0, 10, str_lcase_digits); } /** Append an unsigned long long integer in hexadecimal, padded to a minimum width. */ int str_catxwll(str* s, unsigned long long in, unsigned width, char pad) { return str_catullnumw(s, in, width, pad, 10, str_lcase_digits); } bglibs-1.106/str/cat6s.c0000664000076400007640000000347011147311330014322 0ustar bruceguenter/* str/cat6s.c - Append six C strings to a dynamic str * 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 "str.h" /** Append 6 C strings */ int str_cat6s(str* s, const char* a, const char* b, const char* c, const char* d, const char* e, const char* f) { char* ptr; unsigned alen = strlen(a); unsigned blen = strlen(b); unsigned clen = strlen(c); unsigned dlen = strlen(d); unsigned elen = strlen(e); unsigned flen = strlen(f); if (!str_realloc(s, s->len+alen+blen+clen+dlen+elen+flen)) return 0; ptr = s->s + s->len; s->len += alen+blen+clen+dlen+elen+flen; memcpy(ptr, a, alen); ptr += alen; memcpy(ptr, b, blen); ptr += blen; memcpy(ptr, c, clen); ptr += clen; memcpy(ptr, d, dlen); ptr += dlen; memcpy(ptr, e, elen); ptr += elen; memcpy(ptr, f, flen); ptr += flen; *ptr = 0; return 1; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { static str s; str_copyb(&s, "abc", 3); debugstrfn(str_cat6s(&s, "1", "2", "3", "4", "5", "6"), &s); } #endif #ifdef SELFTEST_EXP result=1 len=9 size=16 s=abc123456 #endif bglibs-1.106/str/cat5s.c0000664000076400007640000000333011147311330014314 0ustar bruceguenter/* str/cat5s.c - Append five C strings to a dynamic str * 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 "str.h" /** Append 5 C strings */ int str_cat5s(str* s, const char* a, const char* b, const char* c, const char* d, const char* e) { char* ptr; unsigned alen = strlen(a); unsigned blen = strlen(b); unsigned clen = strlen(c); unsigned dlen = strlen(d); unsigned elen = strlen(e); if (!str_realloc(s, s->len+alen+blen+clen+dlen+elen)) return 0; ptr = s->s + s->len; s->len += alen+blen+clen+dlen+elen; memcpy(ptr, a, alen); ptr += alen; memcpy(ptr, b, blen); ptr += blen; memcpy(ptr, c, clen); ptr += clen; memcpy(ptr, d, dlen); ptr += dlen; memcpy(ptr, e, elen); ptr += elen; *ptr = 0; return 1; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { static str s; str_copyb(&s, "abc", 3); debugstrfn(str_cat5s(&s, "1", "2", "3", "4", "5"), &s); } #endif #ifdef SELFTEST_EXP result=1 len=8 size=16 s=abc12345 #endif bglibs-1.106/str/copy4s.c0000664000076400007640000000316211147311330014521 0ustar bruceguenter/* str/copy4s.c - Copy four C strings into a dynamic str * 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 "str.h" /** Copy in the concatenation of 4 C strings */ int str_copy4s(str* s, const char* a, const char* b, const char* c, const char* d) { char* ptr; unsigned alen = strlen(a); unsigned blen = strlen(b); unsigned clen = strlen(c); unsigned dlen = strlen(d); unsigned total = alen + blen + clen + dlen; if (!str_ready(s, total)) return 0; s->len = total; ptr = s->s; memcpy(ptr, a, alen); ptr += alen; memcpy(ptr, b, blen); ptr += blen; memcpy(ptr, c, clen); ptr += clen; memcpy(ptr, d, dlen); ptr += dlen; *ptr = 0; return 1; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { static str s; debugstrfn(str_copy4s(&s, "1", "2", "3", "4"), &s); } #endif #ifdef SELFTEST_EXP result=1 len=4 size=16 s=1234 #endif bglibs-1.106/str/copy5s.c0000664000076400007640000000332011147311330014516 0ustar bruceguenter/* str/copy5s.c - Copy five C strings into a dynamic str * 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 "str.h" /** Copy in the concatenation of 5 C strings */ int str_copy5s(str* s, const char* a, const char* b, const char* c, const char* d, const char* e) { char* ptr; unsigned alen = strlen(a); unsigned blen = strlen(b); unsigned clen = strlen(c); unsigned dlen = strlen(d); unsigned elen = strlen(e); unsigned total = alen + blen + clen + dlen + elen; if (!str_ready(s, total)) return 0; s->len = total; ptr = s->s; memcpy(ptr, a, alen); ptr += alen; memcpy(ptr, b, blen); ptr += blen; memcpy(ptr, c, clen); ptr += clen; memcpy(ptr, d, dlen); ptr += dlen; memcpy(ptr, e, elen); ptr += elen; *ptr = 0; return 1; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { static str s; debugstrfn(str_copy5s(&s, "1", "2", "3", "4", "5"), &s); } #endif #ifdef SELFTEST_EXP result=1 len=5 size=16 s=12345 #endif bglibs-1.106/str/iter_start.c0000664000076400007640000000047411147311330015463 0ustar bruceguenter#include "iter.h" #include "str.h" /** Start (initialize) a striter. */ void striter_start(striter* iter, const struct str* s, char sep) { iter->str = s; iter->start = 0; iter->startptr = s->s; iter->len = str_findfirst(s, sep); iter->sep = sep; if (iter->len == (unsigned)-1) iter->len = s->len; } bglibs-1.106/str/cut.c0000664000076400007640000000262711147311330014100 0ustar bruceguenter/* str/cut.c - Cut characters from the left or right of a string. * 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 "str.h" /** Cut \c count bytes from the right (end) of the string */ void str_rcut(str* s, unsigned count) { unsigned newlen; newlen = (s->len < count) ? 0 : s->len - count; str_truncate(s, newlen); } /** Cut \c count bytes from the left (front) of the string */ void str_lcut(str* s, unsigned count) { unsigned newlen; newlen = (s->len < count) ? 0 : s->len - count; if (count > s->len) newlen = 0; else { newlen = s->len - count; memmove(s->s, s->s+count, newlen); } str_truncate(s, newlen); } bglibs-1.106/str/catuwll.c0000664000076400007640000000237711147311330014762 0ustar bruceguenter/* str/catuwll.c - Append an unsigned long long integer * 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 "str.h" /** Append an unsigned long long integer in decimal. */ int str_catull(str* s, unsigned long long in) { return str_catullnumw(s, in, 0, 0, 10, str_lcase_digits); } /** Append an unsigned long long integer in decimal, padded to a minimum width. */ int str_catuwll(str* s, unsigned long long in, unsigned width, char pad) { return str_catullnumw(s, in, width, pad, 10, str_lcase_digits); } bglibs-1.106/str/lower.c0000664000076400007640000000211611147311330014426 0ustar bruceguenter/* str/lower.c - Translate a string into lowercase * 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 "str.h" /** Translate all upper-case characters to lower-case */ void str_lower(str* s) { char* ptr; unsigned i; for (i = 0, ptr = s->s; i < s->len; ++i, ++ptr) if (isupper(*ptr)) *ptr = tolower(*ptr); } bglibs-1.106/str/findprev.c0000664000076400007640000000323411147311330015115 0ustar bruceguenter/* str/findprev.c - Find the previous instance of a character * 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 "str.h" /** Find the previous instance of the given character on or before \c pos */ int str_findprev(const str* s, char ch, unsigned pos) { char* p; if (s->len > 0) { if (pos >= s->len) pos = s->len - 1; for (p = s->s + pos; p >= s->s; --p) if (*p == ch) return p - s->s; } return -1; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { str s = { "01234567890123456", 16, 0 }; str e = { 0, 0, 0 }; obuf_puti(&outbuf, str_findprev(&s, '6', 10)); NL(); obuf_puti(&outbuf, str_findprev(&s, '6', 6)); NL(); obuf_puti(&outbuf, str_findprev(&s, '6', 5)); NL(); obuf_puti(&outbuf, str_findprev(&s, '4', -1)); NL(); obuf_puti(&outbuf, str_findprev(&s, '6', -1)); NL(); obuf_puti(&outbuf, str_findprev(&e, '6', -1)); NL(); } #endif #ifdef SELFTEST_EXP 6 6 -1 14 6 -1 #endif bglibs-1.106/str/count.c0000664000076400007640000000216011147311330014425 0ustar bruceguenter/* str/count.c - Count the instances of a character * 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 "str.h" /** Count the number of instances of a character */ unsigned str_count(const str* s, char ch) { int pos; unsigned count; count = 0; for (pos = str_findfirst(s, ch); pos >= 0; pos = str_findnext(s, ch, pos+1)) ++count; return count; } bglibs-1.106/str/catxw.c0000664000076400007640000000232311147311330014424 0ustar bruceguenter/* str/catxw.c - Append an hexadecimal number * 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 "str.h" /** Append an unsigned integer in hexadecimal. */ int str_catxw(str* s, unsigned long in, unsigned width, char pad) { return str_catunumw(s, in, width, pad, 10, str_lcase_digits); } /** Append an unsigned integer in hexadecimal, padded to a minimum width. */ int str_catx(str* s, unsigned long in) { return str_catunumw(s, in, 0, 0, 10, str_lcase_digits); } bglibs-1.106/str/alloc.c0000664000076400007640000000430211147311330014367 0ustar bruceguenter/* str/alloc.c - Allocate storage for a string * 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 "str.h" /** Allocate storage for a string. * * \param s String to modify. * \param size Minimum number of bytes for which to allocate. * \param copy If set, the existing string will be copied into the new string. * * The size given is incremented to account for adding a trailing \c NUL * byte (to ensure compatibility with C string functions) and is then * rounded up to the nearest \c STR_BLOCKSIZE interval. */ int str_alloc(str* s, unsigned size, int copy) { char* news; unsigned newsize; /* overflow protection */ if ((newsize = size + 1) < size) return 0; if (newsize >= s->size) { newsize += newsize/8 + STR_BLOCKSIZE-1; newsize -= newsize % STR_BLOCKSIZE; /* more overflow protection */ if (newsize <= size) return 0; if ((news = copy ? realloc(s->s, newsize) : malloc(newsize)) == 0) return 0; if (!copy) free(s->s); s->size = newsize; s->s = news; } return 1; } #ifdef SELFTEST_MAIN #include "selftest.c" void test(str* s, unsigned size) { debugstrfn(str_alloc(s, size, 0), s); } MAIN { static str s; test(&s, 0); test(&s, 1); test(&s, 14); test(&s, 15); test(&s, 16); } #endif #ifdef SELFTEST_EXP result=1 len=0 size=16 s= result=1 len=0 size=16 s= result=1 len=0 size=16 s= result=1 len=0 size=32 s= result=1 len=0 size=32 s= #endif bglibs-1.106/str/cat4s.c0000664000076400007640000000316711147311330014323 0ustar bruceguenter/* str/cat4s.c - Append four C strings to a dynamic str * 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 "str.h" /** Append 4 C strings */ int str_cat4s(str* s, const char* a, const char* b, const char* c, const char* d) { char* ptr; unsigned alen = strlen(a); unsigned blen = strlen(b); unsigned clen = strlen(c); unsigned dlen = strlen(d); if (!str_realloc(s, s->len+alen+blen+clen+dlen)) return 0; ptr = s->s + s->len; s->len += alen+blen+clen+dlen; memcpy(ptr, a, alen); ptr += alen; memcpy(ptr, b, blen); ptr += blen; memcpy(ptr, c, clen); ptr += clen; memcpy(ptr, d, dlen); ptr += dlen; *ptr = 0; return 1; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { static str s; str_copyb(&s, "abc", 3); debugstrfn(str_cat4s(&s, "1", "2", "3", "4"), &s); } #endif #ifdef SELFTEST_EXP result=1 len=7 size=16 s=abc1234 #endif bglibs-1.106/str/join.c0000664000076400007640000000374511147311330014246 0ustar bruceguenter/* str/join.c - Join two strings together * 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 "str.h" /** Join two strings together with exactly one instance of the seperator. */ int str_join(str* s, char sep, const str* in) { return str_joinb(s, sep, in->s, in->len); } /** Join a C string to this string */ int str_joins(str* s, char sep, const char* in) { return str_joinb(s, sep, in, strlen(in)); } /** Join a binary block to this string */ int str_joinb(str* s, char sep, const char* in, unsigned len) { unsigned len1; unsigned off2; unsigned len2; len1 = s->len; while (len1 > 0 && s->s[len1-1] == sep) --len1; off2 = 0; while (off2 < len && in[off2] == sep) ++off2; len2 = len - off2; if (!str_realloc(s, len1+1+len2)) return 0; s->s[len1++] = sep; memcpy(s->s+len1, in+off2, len2); s->len = len1 + len2; s->s[s->len] = 0; return 1; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { static str s; debugstrfn(str_copys(&s, "one//"), &s); debugstrfn(str_joins(&s, '/', "two"), &s); debugstrfn(str_joins(&s, '/', "//three/"), &s); } #endif #ifdef SELFTEST_EXP result=1 len=5 size=16 s=one// result=1 len=7 size=16 s=one/two result=1 len=14 size=16 s=one/two/three/ #endif bglibs-1.106/str/copy6s.c0000664000076400007640000000345511147311330014530 0ustar bruceguenter/* str/copy6s.c - Copy six C strings into a dynamic str * 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 "str.h" /** Copy in the concatenation of 6 C strings */ int str_copy6s(str* s, const char* a, const char* b, const char* c, const char* d, const char* e, const char* f) { char* ptr; unsigned alen = strlen(a); unsigned blen = strlen(b); unsigned clen = strlen(c); unsigned dlen = strlen(d); unsigned elen = strlen(e); unsigned flen = strlen(f); unsigned total = alen + blen + clen + dlen + elen + flen; if (!str_ready(s, total)) return 0; s->len = total; ptr = s->s; memcpy(ptr, a, alen); ptr += alen; memcpy(ptr, b, blen); ptr += blen; memcpy(ptr, c, clen); ptr += clen; memcpy(ptr, d, dlen); ptr += dlen; memcpy(ptr, e, elen); ptr += elen; memcpy(ptr, f, flen); ptr += flen; *ptr = 0; return 1; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { static str s; debugstrfn(str_copy6s(&s, "1", "2", "3", "4", "5", "6"), &s); } #endif #ifdef SELFTEST_EXP result=1 len=6 size=16 s=123456 #endif bglibs-1.106/str/glob.c0000664000076400007640000002061011147311330014220 0ustar bruceguenter#include #include #include #include /* GLOB patterns: * * matches everything * ? matches any single character * [seq] matches any sing echaracter in seq * [!seq] matches any single character not in seq */ static unsigned make_set(const char* pptr, unsigned plen, char set[256]) { unsigned orig_plen = plen; char value; if (plen == 0 || *pptr != '[') return 0; ++pptr; --plen; if (*pptr == '!' || *pptr == '^') { memset(set, 1, 256); value = 0; ++pptr; --plen; } else { value = 1; memset(set, 0, 256); } while (plen > 0) { unsigned char p = *pptr++; --plen; if (p == ']') return orig_plen - plen - 1; if (p == '\\') { p = *pptr++; --plen; } set[p] = value; } return 0; } static int glob_match(const str* s, unsigned offset, const char* pptr, unsigned plen); static int glob_search(const str* s, unsigned offset, const char* pptr, unsigned plen) { char start; int r; while (plen > 0) { /* Strip off leading "*"s. */ if ((start = *pptr) == '*') ++pptr, --plen; /* Leading "?"s always match a single character, so just advance past. */ else if (start == '?') ++pptr, --plen, ++offset; else break; } /* Searching at end of pattern always succeeds. */ if (plen == 0) return 1; /* Searching at end of string (with non-empty pattern) always fails. */ if (offset >= s->len) return 0; /* Optimize for searching for a set by only computing the set once. */ if ((start = *pptr) == '[') { char set[256]; unsigned len; if ((len = make_set(pptr, plen, set)) == 0) return -1; ++len; pptr += len; plen -= len; for (; offset < s->len; ++offset) { if (set[(unsigned char)s->s[offset]] && (r = glob_match(s, offset+1, pptr, plen)) != 0) return r; } } /* Otherwise search for a normal character. */ else { ++pptr, --plen; do { char c = s->s[offset++]; if (c == start && (r = glob_match(s, offset, pptr, plen)) != 0) return r; } while (offset < s->len); #if 0 do { if ((r = glob_match(s, offset, pptr, plen)) != 0) return r; ++offset; } while (offset < s->len); #endif } #if 0 else { for (; offset < s->len; ++offset) { char c = s->s[offset]; if (c == start && (r = glob_match(s, offset+1, pptr+1, plen-1)) != 0) return r; } } #endif return 0; } static int glob_match(const str* s, unsigned offset, const char* pptr, unsigned plen) { for (; plen > 0; ++pptr, --plen, ++offset) { char p = *pptr; if (p == '*') return glob_search(s, offset, pptr+1, plen-1); if (offset >= s->len) break; switch (p) { case '?': continue; case '[': { char set[256]; unsigned len; if ((len = make_set(pptr, plen, set)) == 0) return -1; pptr += len; plen -= len; if (!set[(unsigned char)s->s[offset]]) return 0; continue; } default: if (p != s->s[offset]) return 0; } } return offset == s->len && plen == 0; } int str_globb(const str* s, const char* pptr, unsigned plen) { return glob_match(s, 0, pptr, plen); } int str_globs(const str* s, const char* pattern) { return glob_match(s, 0, pattern, strlen(pattern)); } int str_glob(const str* s, const str* pattern) { return glob_match(s, 0, pattern->s, pattern->len); } #ifdef SELFTEST_MAIN #include "selftest.c" void t(const char* string, const char* pattern) { str s; str p; s.s = (char*)string; s.len = strlen(string); s.size = 0; p.s = (char*)pattern; p.len = strlen(pattern); p.size = 0; obuf_putstr(&outbuf, &s); obuf_putc(&outbuf, ' '); obuf_putstr(&outbuf, &p); obuf_putc(&outbuf, ' '); debugfn(str_glob(&s, &p)); } MAIN { /* Empty string */ t("", ""); t("", "*"); t("", "**"); t("", "?"); t("", "[abc]"); /* Case sensitivity: single char */ t("a", "a"); t("a", "A"); t("A", "a"); t("A", "A"); /* Case sensitivity: normal set */ t("a", "[a]"); t("a", "[A]"); t("A", "[a]"); t("A", "[A]"); /* Case sensitivity: negated set */ t("a", "[!a]"); t("a", "[!A]"); t("A", "[!a]"); t("A", "[!A]"); t("a", "[^a]"); t("a", "[^A]"); t("A", "[^a]"); t("A", "[^A]"); /* Case sensitivity: search */ t("a", "*a"); t("a", "*A"); t("A", "*a"); t("A", "*A"); /* Miscelaneous matches */ t("abc", ""); t("abc", "*"); t("abc", "**"); t("abc", "?"); t("abc", "??"); t("abc", "???"); t("abc", "????"); t("abc", "abc"); t("abc", "*abc"); t("abc", "*bc"); t("abc", "*c"); t("abc", "?bc"); t("abc", "a?c"); t("abc", "ab?"); t("abc", "[axy][bxy][cxy]"); /* Three patterns for each case: * 1 at start of filename * 2 in filename * 3 at end of filename * Four characters to test: * 1 First filename character "a" * 2 Second filename character "b" * 3 Third filename character "c" * 4 Non-filename character "x" */ /* First case: single character */ t("abc", "a*"); t("abc", "*a*"); t("abc", "*a"); t("abc", "b*"); t("abc", "*b*"); t("abc", "*b"); t("abc", "c*"); t("abc", "*c*"); t("abc", "*c"); t("abc", "x*"); t("abc", "*x*"); t("abc", "*x"); /* Second case: character in a set */ t("abc", "[axy]*"); t("abc", "*[axy]*"); t("abc", "*[axy]"); t("abc", "[bxy]*"); t("abc", "*[bxy]*"); t("abc", "*[bxy]"); t("abc", "[cxy]*"); t("abc", "*[cxy]*"); t("abc", "*[cxy]"); t("abc", "[xyz]*"); t("abc", "*[xyz]*"); t("abc", "*[xyz]"); /* Third case: negated set */ t("abc", "[!a]*"); t("abc", "*[!a]*"); t("abc", "*[!a]"); t("abc", "[!b]*"); t("abc", "*[!b]*"); t("abc", "*[!b]"); t("abc", "[!c]*"); t("abc", "*[!c]*"); t("abc", "*[!c]"); t("abc", "[!x]*"); t("abc", "*[!x]*"); t("abc", "*[!x]"); t("abc", "[^a]*"); t("abc", "*[^a]*"); t("abc", "*[^a]"); t("abc", "[^b]*"); t("abc", "*[^b]*"); t("abc", "*[^b]"); t("abc", "[^c]*"); t("abc", "*[^c]*"); t("abc", "*[^c]"); t("abc", "[^x]*"); t("abc", "*[^x]*"); t("abc", "*[^x]"); /* Fourth case: preceding wildcard */ t("abc", "?a*"); t("abc", "*?a*"); t("abc", "*?a"); t("abc", "?b*"); t("abc", "*?b*"); t("abc", "*?b"); t("abc", "?c*"); t("abc", "*?c*"); t("abc", "*?c"); t("abc", "?x*"); t("abc", "*?x*"); t("abc", "*?x"); /* Fifth case: following wildcard */ t("abc", "a?*"); t("abc", "*a?*"); t("abc", "*a?"); t("abc", "b?*"); t("abc", "*b?*"); t("abc", "*b?"); t("abc", "c?*"); t("abc", "*c?*"); t("abc", "*c?"); t("abc", "x?*"); t("abc", "*x?*"); t("abc", "*x?"); } #endif #ifdef SELFTEST_EXP result=1 * result=1 ** result=1 ? result=0 [abc] result=0 a a result=1 a A result=0 A a result=0 A A result=1 a [a] result=1 a [A] result=0 A [a] result=0 A [A] result=1 a [!a] result=0 a [!A] result=1 A [!a] result=1 A [!A] result=0 a [^a] result=0 a [^A] result=1 A [^a] result=1 A [^A] result=0 a *a result=1 a *A result=0 A *a result=0 A *A result=1 abc result=0 abc * result=1 abc ** result=1 abc ? result=0 abc ?? result=0 abc ??? result=1 abc ???? result=0 abc abc result=1 abc *abc result=1 abc *bc result=1 abc *c result=1 abc ?bc result=1 abc a?c result=1 abc ab? result=1 abc [axy][bxy][cxy] result=1 abc a* result=1 abc *a* result=1 abc *a result=0 abc b* result=0 abc *b* result=1 abc *b result=0 abc c* result=0 abc *c* result=1 abc *c result=1 abc x* result=0 abc *x* result=0 abc *x result=0 abc [axy]* result=1 abc *[axy]* result=1 abc *[axy] result=0 abc [bxy]* result=0 abc *[bxy]* result=1 abc *[bxy] result=0 abc [cxy]* result=0 abc *[cxy]* result=1 abc *[cxy] result=1 abc [xyz]* result=0 abc *[xyz]* result=0 abc *[xyz] result=0 abc [!a]* result=0 abc *[!a]* result=1 abc *[!a] result=1 abc [!b]* result=1 abc *[!b]* result=1 abc *[!b] result=1 abc [!c]* result=1 abc *[!c]* result=1 abc *[!c] result=0 abc [!x]* result=1 abc *[!x]* result=1 abc *[!x] result=1 abc [^a]* result=0 abc *[^a]* result=1 abc *[^a] result=1 abc [^b]* result=1 abc *[^b]* result=1 abc *[^b] result=1 abc [^c]* result=1 abc *[^c]* result=1 abc *[^c] result=0 abc [^x]* result=1 abc *[^x]* result=1 abc *[^x] result=1 abc ?a* result=0 abc *?a* result=0 abc *?a result=0 abc ?b* result=1 abc *?b* result=1 abc *?b result=0 abc ?c* result=0 abc *?c* result=1 abc *?c result=1 abc ?x* result=0 abc *?x* result=0 abc *?x result=0 abc a?* result=1 abc *a?* result=1 abc *a? result=0 abc b?* result=0 abc *b?* result=1 abc *b? result=1 abc c?* result=0 abc *c?* result=0 abc *c? result=0 abc x?* result=0 abc *x?* result=0 abc *x? result=0 #endif bglibs-1.106/str/xlate.c0000664000076400007640000000330511147311330014414 0ustar bruceguenter/* str/xlate.c - Perform 1-to-1 character translation on a string. * 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 "str.h" /** Substitute one character for another throughout the string. \returns the number of substitutions made. */ long str_xlate(str* s, const char* from, const char* to, unsigned nchars) { int map[256]; unsigned i; char* ptr; long count; int ch; for (i = 0; i < 256; ++i) map[i] = -1; for (i = 0; i < nchars; ++i) map[(unsigned char)from[i]] = (unsigned char)to[i]; for (count = 0, i = 0, ptr = s->s; i < s->len; ++i, ++ptr) if ((ch = map[(unsigned char)*ptr]) != -1) { *ptr = ch; ++count; } return count; } #ifdef SELFTEST_MAIN #include "selftest.c" static str s; MAIN { str_copys(&s, "Test string goes here."); obuf_putu(&outbuf, str_xlate(&s, "Ttx", "xyz", 3)); NL(); debugstr(&s); } #endif #ifdef SELFTEST_EXP 3 len=22 size=32 s=xesy syring goes here. #endif bglibs-1.106/str/catsnum.c0000664000076400007640000000334711147311330014757 0ustar bruceguenter/* str/catsllnum.c - Append an signed integer. * 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 "str.h" /** Append a signed integer, optionally padded to a minimum width */ int str_catsnumw(str* s, long in, unsigned width, char pad, unsigned base, const char* digits) { long tmp; unsigned size; unsigned i; unsigned sign; unsigned padsize; sign = 0; if (in < 0) { sign = 1; in = -in; } if (in < (long)base) size = 1; else for (tmp = in, size = 0; tmp; tmp /= base, ++size) ; padsize = (width > sign+size) ? width - sign+size : 0; if (!str_realloc(s, s->len + padsize+sign+size)) return 0; /* If the padding is a zero, put it after the sign, otherwise before */ if (pad != '0') while (padsize--) s->s[s->len++] = pad; if (sign) s->s[s->len++] = pad; if (pad == '0') while (padsize--) s->s[s->len++] = pad; for (i = size; i-- > 0; in /= base) s->s[s->len+i] = digits[in % base]; s->len += size; s->s[s->len] = 0; return 1; } bglibs-1.106/str/catf.c0000664000076400007640000000325511147311330014220 0ustar bruceguenter/* str/catf.c - Append formatted data to a 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 "str.h" #include "fmt/multi.h" /** Append formatted data using \c fmt_multi from a \c va_list */ int str_catfv(str* s, const char* format, va_list ap) { unsigned length; va_list ap2; va_copy(ap2, ap); length = fmt_multiv(0, format, ap2); va_end(ap2); if (!str_realloc(s, s->len + length)) return 0; fmt_multiv(s->s + s->len, format, ap); s->s[s->len += length] = 0; return 1; } /** Append formatted data using \c fmt_multi from variable arguments */ int str_catf(str* s, const char* format, ...) { int i; va_list ap; va_start(ap, format); i = str_catfv(s, format, ap); va_end(ap); return i; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { static str s; str_copys(&s, "foo"); debugstrfn(str_catf(&s, "d{bar}x", 10, 20), &s); } #endif #ifdef SELFTEST_EXP result=1 len=10 size=16 s=foo10bar14 #endif bglibs-1.106/str/copy.c0000664000076400007640000000314711147311330014255 0ustar bruceguenter/* str/copy.c - Copy one string 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 "str.h" /** Copy in a string */ int str_copy(str* s, const str* in) { return str_copyb(s, in->s, in->len); } /** Copy in a C string */ int str_copys(str* s, const char* in) { return str_copyb(s, in, strlen(in)); } /** Copy in a binary block */ int str_copyb(str* s, const char* in, unsigned len) { if (!str_ready(s, len)) return 0; memcpy(s->s, in, len); s->len = len; s->s[len] = 0; return 1; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { static str s; debugstrfn(str_copys(&s, "foo"), &s); debugstrfn(str_copyb(&s, "012345678901234567", 17), &s); debugstrfn(str_copys(&s, "foo"), &s); } #endif #ifdef SELFTEST_EXP result=1 len=3 size=16 s=foo result=1 len=17 size=32 s=01234567890123456 result=1 len=3 size=32 s=foo #endif bglibs-1.106/str/init.c0000664000076400007640000000241011147311330014236 0ustar bruceguenter/* str/init.c - Initialize a string to a minimum size * 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 "str.h" /** Initialize a string, giving it a small empty allocation. */ int str_init(str* s) { char* p; if ((p = malloc(STR_BLOCKSIZE)) == 0) return 0; p[0] = 0; s->s = p; s->len = 0; s->size = STR_BLOCKSIZE; return 1; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { static str s; debugstrfn(str_init(&s), &s); } #endif #ifdef SELFTEST_EXP result=1 len=0 size=16 s= #endif bglibs-1.106/str/match.c0000664000076400007640000000470111147311330014374 0ustar bruceguenter/* str/match.c - Simple pattern matching * 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 "str.h" /** Simple but fast (linear time) pattern matching on binary pattern. */ int str_matchb(const str* s, const char* pptr, unsigned plen) { const char* sptr; long slen = s->len; if (plen == 0) return slen == 0; for (sptr = s->s; plen > 0; ++sptr, --slen, ++pptr, --plen) { char p = *pptr; if (p == '*') { ++pptr, --plen; if (plen == 0) return 1; p = *pptr; while (slen > 0) { if (*sptr == p) break; ++sptr, --slen; } if (slen == 0) return 0; } else { if (slen == 0) return 0; if (*sptr != p) return 0; } } return slen == 0; } /** Simple pattern match on dynamic string pattern. */ int str_match(const str* s, const str* pattern) { return str_matchb(s, pattern->s, pattern->len); } /** Simple pattern match on C string pattern. */ int str_matchs(const str* s, const char* pattern) { return str_matchb(s, pattern, strlen(pattern)); } #ifdef SELFTEST_MAIN #include "selftest.c" static const str s = { "abc", 3, 0 }; void t(const char* pattern) { obuf_puts(&outbuf, pattern); obuf_putc(&outbuf, ' '); debugfn(str_matchs(&s, pattern)); } MAIN { t(""); t("*"); t("**"); t("abc"); t("ABC"); t("a"); t("a*"); t("*a*"); t("*a"); t("b*"); t("*b*"); t("*b"); t("c*"); t("*c*"); t("*c"); t("d*"); t("*d*"); t("*d"); t("*C"); } #endif #ifdef SELFTEST_EXP result=0 * result=1 ** result=0 abc result=1 ABC result=0 a result=0 a* result=1 *a* result=1 *a result=0 b* result=0 *b* result=1 *b result=0 c* result=0 *c* result=1 *c result=1 d* result=0 *d* result=0 *d result=0 *C result=0 #endif bglibs-1.106/str/copyns.c0000664000076400007640000000263311147311330014615 0ustar bruceguenter/* str/copyns.c - Copy N C strings into a dynamic str * 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 "str.h" /** Copy in the concatenation of N C strings */ int str_copyns(str* s, unsigned int count, ...) { const char* ptr; va_list ap; va_start(ap, count); s->len = 0; while (count-- > 0) { if ((ptr = va_arg(ap, const char*)) != 0) if (!str_cats(s, ptr)) return 0; } va_end(ap); return 1; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { static str s; debugstrfn(str_copyns(&s, 7, "1", 0, "2", "3", "4", "5", "6"), &s); } #endif #ifdef SELFTEST_EXP result=1 len=6 size=16 s=123456 #endif bglibs-1.106/str/copy2s.c0000664000076400007640000000265511147311330014525 0ustar bruceguenter/* str/copy2s.c - Copy two C strings into a dynamic str * 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 "str.h" /** Copy in the concatenation of 2 C strings */ int str_copy2s(str* s, const char* a, const char* b) { char* ptr; unsigned alen = strlen(a); unsigned blen = strlen(b); unsigned total = alen + blen; if (!str_ready(s, total)) return 0; s->len = total; ptr = s->s; memcpy(ptr, a, alen); ptr += alen; memcpy(ptr, b, blen); ptr += blen; *ptr = 0; return 1; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { static str s; debugstrfn(str_copy2s(&s, "1", "2"), &s); } #endif #ifdef SELFTEST_EXP result=1 len=2 size=16 s=12 #endif bglibs-1.106/str/digits.c0000664000076400007640000000037211147311330014563 0ustar bruceguenter#include "str.h" /** Lower-case digits, also used for decimal numbers. */ const char str_lcase_digits[36] = "0123456789abcdefghijklmnopqrstuvwxyz"; /** Upper-case digits. */ const char str_ucase_digits[36] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; bglibs-1.106/str/env.h0000664000076400007640000000163511147311330014100 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-1.106/str/catsllnum.c0000664000076400007640000000341511147311330015303 0ustar bruceguenter/* str/catsllnum.c - Append an signed long long integer. * 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 "str.h" /** Append a signed long long integer, optionally padded to a minimum width */ int str_catsllnumw(str* s, long long in, unsigned width, char pad, unsigned base, const char* digits) { long long tmp; unsigned size; unsigned i; unsigned sign; unsigned padsize; sign = 0; if (in < 0) { sign = 1; in = -in; } if (in < (long)base) size = 1; else for (tmp = in, size = 0; tmp; tmp /= base, ++size) ; padsize = (width > sign+size) ? width - sign+size : 0; if (!str_realloc(s, s->len + padsize+sign+size)) return 0; /* If the padding is a zero, put it after the sign, otherwise before */ if (pad != '0') while (padsize--) s->s[s->len++] = pad; if (sign) s->s[s->len++] = pad; if (pad == '0') while (padsize--) s->s[s->len++] = pad; for (i = size; i-- > 0; in /= base) s->s[s->len+i] = digits[in % base]; s->len += size; s->s[s->len] = 0; return 1; } bglibs-1.106/str/subst.c0000664000076400007640000000233111147311330014435 0ustar bruceguenter/* str/subst.c - Substitute one character for another * 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 "str.h" /** Substitute one character for another throughout the string. \returns the number of substitutions made. */ long str_subst(str* s, char from, char to) { char* ptr; unsigned i; long count; for (count = 0, i = 0, ptr = s->s; i < s->len; ++i, ++ptr) if (*ptr == from) { *ptr = to; ++count; } return count; } bglibs-1.106/str/env_find.c0000664000076400007640000000122311147311330015064 0ustar bruceguenter#include #include "str.h" #include "iter.h" #include "env.h" /** Find the named variable in the environment string. * \returns a pointer to the \b start of the assignment. */ const char* envstr_find(const struct str* env, const char* var, long len) { striter i; striter_loop(&i, env, 0) { if (memcmp(i.startptr, var, len) == 0 && i.startptr[len] == '=') return i.startptr; } return 0; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { static const str env = {"A=1\0B=2\0C=3\0", 12, 0}; const char* c; c = envstr_find(&env, "B", 1); obuf_puts(&outbuf, c); obuf_endl(&outbuf); } #endif #ifdef SELFTEST_EXP B=2 #endif bglibs-1.106/str/splice.c0000664000076400007640000000510111147311330014552 0ustar bruceguenter/* str/splice.c - Insert into the middle of a string. * 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 "str.h" /* Insert one string into another */ int str_splice(str* s, unsigned start, unsigned len, const str* r) { return str_spliceb(s, start, len, r->s, r->len); } /* Insert a C string into a string */ int str_splices(str* s, unsigned start, unsigned len, const char* r) { return str_spliceb(s, start, len, r, strlen(r)); } /* Insert a binary block into a string */ int str_spliceb(str* s, unsigned start, unsigned len, const char* r, unsigned rlen) { if (start > s->len || start + len > s->len) return 0; if (rlen != len) { const long diff = rlen - len; if (!str_realloc(s, s->len + diff)) return 0; memmove(s->s + start + rlen, s->s + start + len, s->len - start - len + 1); s->len += diff; } memcpy(s->s + start, r, rlen); return 1; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { static str s; str_copyb(&s, "abcde", 5); debugstrfn(str_splices(&s, 6, 0, ""), &s); /* start is too large */ debugstrfn(str_splices(&s, 4, 4, ""), &s); /* len is too large */ debugstrfn(str_splices(&s, 0, 1, "fg"), &s); /* expand the front */ debugstrfn(str_splices(&s, 1, 1, "hi"), &s); /* expand the middle */ debugstrfn(str_splices(&s, 6, 1, "jk"), &s); /* expand the end */ debugstrfn(str_splices(&s, 4, 2, "lm"), &s); /* replace */ debugstrfn(str_splices(&s, 3, 3, "no"), &s); /* contract */ debugstrfn(str_splices(&s, 7, 0, "pqrstuvwxyz"), &s); /* grow string */ } #endif #ifdef SELFTEST_EXP result=0 len=5 size=16 s=abcde result=0 len=5 size=16 s=abcde result=1 len=6 size=16 s=fgbcde result=1 len=7 size=16 s=fhibcde result=1 len=8 size=16 s=fhibcdjk result=1 len=8 size=16 s=fhiblmjk result=1 len=7 size=16 s=fhinojk result=1 len=18 size=32 s=fhinojkpqrstuvwxyz #endif bglibs-1.106/str/diff.c0000664000076400007640000000336611147311330014216 0ustar bruceguenter/* str/diff.c - Differentiate two strings * 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 "str.h" /** Differentiate two strings. The first non-zero difference between \c a and \c b is returned. If \c a is longer than \c b and no differences are found up to the length of \c b, then the return value is positive. If \c b is longer than \c a and no differences are found up to the length of \c a, then the return value is negative. */ int str_diff(const str* a, const str* b) { return str_diffb(a, b->s, b->len); } /** Differentiate a string and a C string. */ int str_diffs(const str* a, const char* b) { return str_diffb(a, b, strlen(b)); } /** Differentiate a string and a binary block. */ int str_diffb(const str* a, const char* b, unsigned len) { unsigned max; char* aptr; max = a->len; if (max > len) max = len; for (aptr = a->s; max; ++aptr, ++b, --max) if (*b - *aptr) return *b - *aptr; if (a->len > len) return 1; if (a->len < len) return -1; return 0; } bglibs-1.106/str/catullnum.c0000664000076400007640000000300511147311330015300 0ustar bruceguenter/* str/catunumw.c - Append an unsigned long long integer * 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 "str.h" /** Append an unsigned long long integer, optionally padded to a minimum width */ int str_catullnumw(str* s, unsigned long long in, unsigned width, char pad, unsigned base, const char* digits) { unsigned long long tmp; unsigned size; unsigned padsize; unsigned i; if (in < base) size = 1; else for (tmp = in, size = 0; tmp; tmp /= base, ++size) ; padsize = (width > size) ? width - size : 0; if (!str_realloc(s, s->len + padsize+size)) return 0; while (padsize--) s->s[s->len++] = pad; for (i = size; i-- > 0; in /= base) s->s[s->len+i] = digits[in % base]; s->len += size; s->s[s->len] = 0; return 1; } bglibs-1.106/str/sort.c0000664000076400007640000000530411147311330014267 0ustar bruceguenter/* str/sort.c - Split up a string and sort its pieces. * 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 "str.h" static int default_cmp(const str_sortentry* a, const str_sortentry* b) { int i; unsigned long alen = a->len; unsigned long blen = b->len; if (alen < blen) { if ((i = memcmp(a->str, b->str, alen)) != 0) return i; return -1; } else if (alen > blen) { if ((i = memcmp(a->str, b->str, blen)) != 0) return i; return 1; } else return memcmp(a->str, b->str, blen); } /** Sort a string. \param s The string to sort. \param sep The character which delimits the substrings. \param count The number of substrings within \c s (set to \c -1 if not known). \param fn The comparison function. Defaults to a function that works like \c memcmp. \note This function allocates a temporary array of substring pointers, and so may return \c 0 if memory allocation fails. The string itself is not reallocated. */ int str_sort(str* s, char sep, long count, int (*fn)(const str_sortentry* a, const str_sortentry* b)) { str_sortentry* ptrs; const char* ptr; const char* end; long i; str tmp = {0,0,0}; if (count == -1) { for (count = 0, ptr = s->s, end = s->s+s->len; ptr != 0 && ptr < end; ++count) { ptr = memchr(ptr, sep, end-ptr); if (ptr) ++ptr; } } if ((ptrs = alloca(count * sizeof *ptrs)) == 0) return 0; if (!str_copy(&tmp, s)) { str_free(&tmp); return 0; } if (fn == 0) fn = default_cmp; for (i = 0, ptr = tmp.s, end = tmp.s+tmp.len; i < count; ++i) { const char* ptrend = memchr(ptr, sep, end-ptr); if (ptrend == 0) ptrend = end; ptrs[i].str = ptr; ptrs[i].len = ptrend - ptr; ptr = ptrend + 1; } qsort(ptrs, count, sizeof(*ptrs), (int (*)(const void*,const void*))fn); str_truncate(s, 0); for (i = 0; i < count; i++) { str_catb(s, ptrs[i].str, ptrs[i].len); str_catc(s, sep); } str_free(&tmp); return 1; } bglibs-1.106/str/truncate.c0000664000076400007640000000240711147311330015126 0ustar bruceguenter/* str/truncate.c - Truncate a string to a particular length * 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 "str.h" /** Truncate a string. * * If \c len is larger than the current size, the string is reallocated. * If \c len is less than the existing length (not size), the length of * the string is reduced to \c len. A \c NUL marker is placed at \c * len. */ int str_truncate(str* s, unsigned len) { if (!str_realloc(s, len)) return 0; if (len < s->len) s->len = len; s->s[len] = 0; return 1; } bglibs-1.106/str/env_get.c0000664000076400007640000000105311147311330014724 0ustar bruceguenter#include #include "str.h" #include "iter.h" #include "env.h" /** Get the value of an assignment from an environment string. */ const char* envstr_get(const struct str* env, const char* var) { long varlen = strlen(var); if ((var = envstr_find(env, var, varlen)) != 0) var += varlen + 1; return var; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { static const str env = {"A=1\0B=2\0C=3\0", 12, 0}; const char* c; c = envstr_get(&env, "B"); obuf_puts(&outbuf, c); obuf_endl(&outbuf); } #endif #ifdef SELFTEST_EXP 2 #endif bglibs-1.106/str/env_set.c0000664000076400007640000000152711147311330014746 0ustar bruceguenter#include #include "str.h" #include "env.h" /** Set the named variable to the given value in the environment string. */ int envstr_set(struct str* env, const char* var, const char* val, int overwrite) { const char* found; if ((found = envstr_find(env, var, strlen(var))) != 0) { if (!overwrite) return 1; str_spliceb(env, found - env->s, strlen(found) + 1, 0, 0); } return str_cats(env, var) && str_catc(env, '=') && str_cats(env, val) && str_catc(env, 0); } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { static str env; debugstrfn(envstr_set(&env, "A", "4", 0), &env); debugstrfn(envstr_set(&env, "A", "5", 0), &env); debugstrfn(envstr_set(&env, "A", "6", 1), &env); } #endif #ifdef SELFTEST_EXP result=1 len=4 size=16 s=A=4^@ result=1 len=4 size=16 s=A=4^@ result=1 len=4 size=16 s=A=6^@ #endif bglibs-1.106/str/copy3s.c0000664000076400007640000000301511147311330014515 0ustar bruceguenter/* str/copy3s.c - Copy three C strings into a dynamic str * 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 "str.h" /** Copy in the concatenation of 3 C strings */ int str_copy3s(str* s, const char* a, const char* b, const char* c) { char* ptr; unsigned alen = strlen(a); unsigned blen = strlen(b); unsigned clen = strlen(c); unsigned total = alen + blen + clen; if (!str_ready(s, total)) return 0; s->len = total; ptr = s->s; memcpy(ptr, a, alen); ptr += alen; memcpy(ptr, b, blen); ptr += blen; memcpy(ptr, c, clen); ptr += clen; *ptr = 0; return 1; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { static str s; debugstrfn(str_copy3s(&s, "1", "2", "3"), &s); } #endif #ifdef SELFTEST_EXP result=1 len=3 size=16 s=123 #endif bglibs-1.106/str/case_match.c0000664000076400007640000000531611147311330015372 0ustar bruceguenter/* str/match.c - Simple case insensitive pattern matching * 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 "str.h" /** Simple but fast (linear time) pattern matching on binary pattern. */ int str_case_matchb(const str* s, const char* pptr, unsigned plen) { const char* sptr; long slen = s->len; if (plen == 0) return slen == 0; for (sptr = s->s; plen > 0; ++sptr, --slen, ++pptr, --plen) { char p = *pptr; char c; if (p == '*') { ++pptr, --plen; if (plen == 0) return 1; p = *pptr; if (isupper(p)) p = tolower(p); while (slen > 0) { c = *sptr; if (isupper(c)) c = tolower(c); if (c == p) break; ++sptr, --slen; } if (slen == 0) return 0; } else { if (slen == 0) return 0; c = *sptr; if (isupper(c)) c = tolower(c); if (isupper(p)) p = tolower(p); if (c != p) return 0; } } return slen == 0; } /** Simple pattern match on dynamic string pattern. */ int str_case_match(const str* s, const str* pattern) { return str_case_matchb(s, pattern->s, pattern->len); } /** Simple pattern match on C string pattern. */ int str_case_matchs(const str* s, const char* pattern) { return str_case_matchb(s, pattern, strlen(pattern)); } #ifdef SELFTEST_MAIN #include "selftest.c" static const str s = { "abc", 3, 0 }; void t(const char* pattern) { obuf_puts(&outbuf, pattern); obuf_putc(&outbuf, ' '); debugfn(str_case_matchs(&s, pattern)); } MAIN { t(""); t("*"); t("**"); t("abc"); t("ABC"); t("a"); t("a*"); t("*a*"); t("*a"); t("b*"); t("*b*"); t("*b"); t("c*"); t("*c*"); t("*c"); t("d*"); t("*d*"); t("*d"); t("*c"); t("*C"); } #endif #ifdef SELFTEST_EXP result=0 * result=1 ** result=0 abc result=1 ABC result=1 a result=0 a* result=1 *a* result=1 *a result=0 b* result=0 *b* result=1 *b result=0 c* result=0 *c* result=1 *c result=1 d* result=0 *d* result=0 *d result=0 *c result=1 *C result=1 #endif bglibs-1.106/str/buildmap.c0000664000076400007640000000245411147311330015100 0ustar bruceguenter/* str/buildmap.c - Build a lookup table for find*of functions * 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 "str.h" /** Build a map from the list of characters. Each byte in the output map contains either \c -1 if the corresponding character was not present in the input string, or the offset of the last instance of the character in the list. */ void str_buildmap(int map[256], const char* list) { unsigned i; for (i = 0; i < 256; i++) map[i] = -1; for (i = 0; *list; i++, list++) map[*(unsigned char*)list] = i; } bglibs-1.106/str/env_unset.c0000664000076400007640000000155711147311330015314 0ustar bruceguenter#include #include "str.h" #include "env.h" /** Unset the named variable in the environment string. */ void envstr_unset(struct str* env, const char* var) { const char* found; unsigned long varlen = strlen(var); while ((found = envstr_find(env, var, varlen)) != 0) { unsigned long foundlen = strlen(found) + 1; unsigned long foundoff = found - env->s; if (foundoff + foundlen > env->len - foundoff) foundlen = env->len - (found - env->s); str_spliceb(env, found - env->s, foundlen, 0, 0); } } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { static str env; str_copyb(&env, "A=1\0B=2\0C=3\0B=2", 15); envstr_unset(&env, "B"); debugstr(&env); envstr_unset(&env, "A"); debugstr(&env); envstr_unset(&env, "C"); debugstr(&env); } #endif #ifdef SELFTEST_EXP len=8 size=32 s=A=1^@C=3^@ len=4 size=32 s=C=3^@ len=0 size=32 s= #endif bglibs-1.106/str/env_make_array.c0000664000076400007640000000203011147311330016254 0ustar bruceguenter#include #include #include "str.h" #include "iter.h" #include "env.h" /** Make a \c environ compatable array of pointers to the environment * string. * \note The returned pointer is dynamically allocated, and must be * freed. */ char** envstr_make_array(const struct str* env) { striter i; int count; char** array; for (striter_start(&i, env, 0), count = 0; striter_valid(&i); striter_advance(&i), ++count) ; array = malloc((count + 1) * sizeof *array); for (striter_start(&i, env, 0), count = 0; striter_valid(&i); striter_advance(&i), ++count) array[count] = (char*)i.startptr; array[count] = 0; return array; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { static const str env = {"A=1\0B=2\0C=3\0", 12, 0}; char** e; int i; e = envstr_make_array(&env); for (i = 0; e[i] != 0; ++i) { obuf_puti(&outbuf, i); obuf_putc(&outbuf, ':'); obuf_puts(&outbuf, e[i]); obuf_endl(&outbuf); } } #endif #ifdef SELFTEST_EXP 0:A=1 1:B=2 2:C=3 #endif bglibs-1.106/str/env_from_array.c0000664000076400007640000000122211147311330016304 0ustar bruceguenter#include #include "str.h" #include "env.h" /** Adds the assignments from the array of pointers to the environment * string. * The array must be terminated by a \c NULL pointer, just the same as * the standard \c environ array. */ int envstr_from_array(struct str* env, char** array, int overwrite) { while (*array) { if (!envstr_put(env, *array, overwrite)) return 0; ++array; } return 1; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { static str env; char* array[3] = {"A=1","B=2",0}; debugstrfn(envstr_from_array(&env, array, 1), &env); } #endif #ifdef SELFTEST_EXP result=1 len=8 size=16 s=A=1^@B=2^@ #endif bglibs-1.106/str/catiw.c0000664000076400007640000000225711147311330014413 0ustar bruceguenter/* str/catiw.c - Append an signed integer * 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 "str.h" /** Append a signed integer in decimal. */ int str_cati(str* s, long in) { return str_catsnumw(s, in, 0, 0, 10, str_lcase_digits); } /** Append a signed integer in decimal, padded to a minimum width. */ int str_catiw(str* s, long in, unsigned width, char pad) { return str_catsnumw(s, in, width, pad, 10, str_lcase_digits); } bglibs-1.106/str/findprevof.c0000664000076400007640000000342711147311330015446 0ustar bruceguenter/* str/findprevof.c - Find the previous instance of a character set * 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 "str.h" /** Find the previous instance of the given list of characters, on or before \c pos */ int str_findprevof(const str* s, const char* list, unsigned pos) { char* p; int map[256]; if (s->len > 0) { str_buildmap(map, list); if (pos >= s->len) pos = s->len - 1; for (p = s->s + pos; p >= s->s; --p, --pos) if (map[*(unsigned char*)p] >= 0) return pos; } return -1; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { str s = { "01234567890123456", 16, 0 }; str e = { 0, 0, 0 }; obuf_puti(&outbuf, str_findprevof(&s, "654", 10)); NL(); obuf_puti(&outbuf, str_findprevof(&s, "654", 5)); NL(); obuf_puti(&outbuf, str_findprevof(&s, "654", 3)); NL(); obuf_puti(&outbuf, str_findprevof(&s, "456", -1)); NL(); obuf_puti(&outbuf, str_findprevof(&s, "678", -1)); NL(); obuf_puti(&outbuf, str_findprevof(&e, "678", -1)); NL(); } #endif #ifdef SELFTEST_EXP 6 5 -1 15 8 -1 #endif bglibs-1.106/str/str.h0000664000076400007640000002002211147311330014107 0ustar bruceguenter#ifndef STR__H__ #define STR__H__ #include /** \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]; extern const char str_ucase_digits[36]; /** @} */ /** \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); /** @} */ /** \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-1.106/str/upper.c0000664000076400007640000000211611147311330014431 0ustar bruceguenter/* str/upper.c - Translate a string into uppercase * 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 "str.h" /** Translate all lower-case characters to upper-case */ void str_upper(str* s) { char* ptr; unsigned i; for (i = 0, ptr = s->s; i < s->len; ++i, ++ptr) if (islower(*ptr)) *ptr = toupper(*ptr); } bglibs-1.106/str/catns.c0000664000076400007640000000262211147311330014410 0ustar bruceguenter/* str/catns.c - Append N C strings to a dynamic str * 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 "str.h" /** Append N C strings */ int str_catns(str* s, 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 (!str_cats(s, ptr)) return 0; } va_end(ap); return 1; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { static str s; str_copyb(&s, "abc", 3); debugstrfn(str_catns(&s, 7, "1", "2", 0, "3", "4", "5", "6"), &s); } #endif #ifdef SELFTEST_EXP result=1 len=9 size=16 s=abc123456 #endif bglibs-1.106/str/iter_advance.c0000664000076400007640000000071211147311330015722 0ustar bruceguenter#include "iter.h" #include "str.h" /** Advance a striter to the next substring. */ int striter_advance(striter* iter) { unsigned end; if (!iter->str) return 0; iter->start += iter->len + 1; iter->startptr = iter->str->s + iter->start; if (iter->start >= iter->str->len) return 0; end = str_findnext(iter->str, iter->sep, iter->start); iter->len = (end == (unsigned)-1) ? iter->str->len - iter->start : end - iter->start; return 1; } bglibs-1.106/str/catunum.c0000664000076400007640000000273711147311330014763 0ustar bruceguenter/* str/catunumw.c - Append an unsigned integer * 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 "str.h" /** Append an unsigned integer, optionally padded to a minimum width */ int str_catunumw(str* s, unsigned long in, unsigned width, char pad, unsigned base, const char* digits) { unsigned long tmp; unsigned size; unsigned padsize; unsigned i; if (in < base) size = 1; else for (tmp = in, size = 0; tmp; tmp /= base, ++size) ; padsize = (width > size) ? width - size : 0; if (!str_realloc(s, s->len + padsize+size)) return 0; while (padsize--) s->s[s->len++] = pad; for (i = size; i-- > 0; in /= base) s->s[s->len+i] = digits[in % base]; s->len += size; s->s[s->len] = 0; return 1; } bglibs-1.106/str/case_glob.c0000664000076400007640000002141511147311330015217 0ustar bruceguenter#include #include #include #include /* GLOB patterns: * * matches everything * ? matches any single character * [seq] matches any sing echaracter in seq * [!seq] matches any single character not in seq */ static unsigned make_set(const char* pptr, unsigned plen, char set[256]) { unsigned orig_plen = plen; char value; if (plen == 0 || *pptr != '[') return 0; ++pptr; --plen; if (*pptr == '!' || *pptr == '^') { memset(set, 1, 256); value = 0; ++pptr; --plen; } else { value = 1; memset(set, 0, 256); } while (plen > 0) { unsigned char p = *pptr++; --plen; if (p == ']') return orig_plen - plen - 1; if (p == '\\') { p = *pptr++; --plen; } set[p] = value; if (isupper(p)) set[tolower(p)] = value; else if (islower(p)) set[toupper(p)] = value; } return 0; } static int glob_match(const str* s, unsigned offset, const char* pptr, unsigned plen); static int glob_search(const str* s, unsigned offset, const char* pptr, unsigned plen) { char start; int r; while (plen > 0) { /* Strip off leading "*"s. */ if ((start = *pptr) == '*') ++pptr, --plen; /* Leading "?"s always match a single character, so just advance past. */ else if (start == '?') ++pptr, --plen, ++offset; else break; } /* Searching at end of pattern always succeeds. */ if (plen == 0) return 1; /* Searching at end of string (with non-empty pattern) always fails. */ if (offset >= s->len) return 0; /* Optimize for searching for a set by only computing the set once. */ if ((start = *pptr) == '[') { char set[256]; unsigned len; if ((len = make_set(pptr, plen, set)) == 0) return -1; ++len; pptr += len; plen -= len; for (; offset < s->len; ++offset) { if (set[(unsigned char)s->s[offset]] && (r = glob_match(s, offset+1, pptr, plen)) != 0) return r; } } /* Otherwise search for a normal character. */ else { ++pptr, --plen; if (isupper(start)) start = tolower(start); do { char c = s->s[offset++]; if (isupper(c)) c = tolower(c); if (c == start && (r = glob_match(s, offset, pptr, plen)) != 0) return r; } while (offset < s->len); #if 0 do { if ((r = glob_match(s, offset, pptr, plen)) != 0) return r; ++offset; } while (offset < s->len); #endif } #if 0 else { if (isupper(start)) start = tolower(start); for (; offset < s->len; ++offset) { char c = s->s[offset]; if (isupper(c)) c = tolower(c); if (c == start && (r = glob_match(s, offset+1, pptr+1, plen-1)) != 0) return r; } } #endif return 0; } static int glob_match(const str* s, unsigned offset, const char* pptr, unsigned plen) { for (; plen > 0; ++pptr, --plen, ++offset) { char p = *pptr; if (p == '*') return glob_search(s, offset, pptr+1, plen-1); if (offset >= s->len) break; switch (p) { case '?': continue; case '[': { char set[256]; unsigned len; if ((len = make_set(pptr, plen, set)) == 0) return -1; pptr += len; plen -= len; if (!set[(unsigned char)s->s[offset]]) return 0; continue; } default: { char c = s->s[offset]; if (isupper(c)) c = tolower(c); if (isupper(p)) p = tolower(p); if (p != c) return 0; } } } return offset == s->len && plen == 0; } int str_case_globb(const str* s, const char* pptr, unsigned plen) { return glob_match(s, 0, pptr, plen); } int str_case_globs(const str* s, const char* pattern) { return glob_match(s, 0, pattern, strlen(pattern)); } int str_case_glob(const str* s, const str* pattern) { return glob_match(s, 0, pattern->s, pattern->len); } #ifdef SELFTEST_MAIN #include "selftest.c" void t(const char* string, const char* pattern) { str s; str p; s.s = (char*)string; s.len = strlen(string); s.size = 0; p.s = (char*)pattern; p.len = strlen(pattern); p.size = 0; obuf_putstr(&outbuf, &s); obuf_putc(&outbuf, ' '); obuf_putstr(&outbuf, &p); obuf_putc(&outbuf, ' '); debugfn(str_case_glob(&s, &p)); } MAIN { /* Empty string */ t("", ""); t("", "*"); t("", "**"); t("", "?"); t("", "[abc]"); /* Case sensitivity: single char */ t("a", "a"); t("a", "A"); t("A", "a"); t("A", "A"); /* Case sensitivity: normal set */ t("a", "[a]"); t("a", "[A]"); t("A", "[a]"); t("A", "[A]"); /* Case sensitivity: negated set */ t("a", "[!a]"); t("a", "[!A]"); t("A", "[!a]"); t("A", "[!A]"); t("a", "[^a]"); t("a", "[^A]"); t("A", "[^a]"); t("A", "[^A]"); /* Case sensitivity: search */ t("a", "*a"); t("a", "*A"); t("A", "*a"); t("A", "*A"); /* Miscelaneous matches */ t("abc", ""); t("abc", "*"); t("abc", "**"); t("abc", "?"); t("abc", "??"); t("abc", "???"); t("abc", "????"); t("abc", "abc"); t("abc", "*abc"); t("abc", "*bc"); t("abc", "*c"); t("abc", "?bc"); t("abc", "a?c"); t("abc", "ab?"); t("abc", "[axy][bxy][cxy]"); /* Three patterns for each case: * 1 at start of filename * 2 in filename * 3 at end of filename * Four characters to test: * 1 First filename character "a" * 2 Second filename character "b" * 3 Third filename character "c" * 4 Non-filename character "x" */ /* First case: single character */ t("abc", "a*"); t("abc", "*a*"); t("abc", "*a"); t("abc", "b*"); t("abc", "*b*"); t("abc", "*b"); t("abc", "c*"); t("abc", "*c*"); t("abc", "*c"); t("abc", "x*"); t("abc", "*x*"); t("abc", "*x"); /* Second case: character in a set */ t("abc", "[axy]*"); t("abc", "*[axy]*"); t("abc", "*[axy]"); t("abc", "[bxy]*"); t("abc", "*[bxy]*"); t("abc", "*[bxy]"); t("abc", "[cxy]*"); t("abc", "*[cxy]*"); t("abc", "*[cxy]"); t("abc", "[xyz]*"); t("abc", "*[xyz]*"); t("abc", "*[xyz]"); /* Third case: negated set */ t("abc", "[!a]*"); t("abc", "*[!a]*"); t("abc", "*[!a]"); t("abc", "[!b]*"); t("abc", "*[!b]*"); t("abc", "*[!b]"); t("abc", "[!c]*"); t("abc", "*[!c]*"); t("abc", "*[!c]"); t("abc", "[!x]*"); t("abc", "*[!x]*"); t("abc", "*[!x]"); t("abc", "[^a]*"); t("abc", "*[^a]*"); t("abc", "*[^a]"); t("abc", "[^b]*"); t("abc", "*[^b]*"); t("abc", "*[^b]"); t("abc", "[^c]*"); t("abc", "*[^c]*"); t("abc", "*[^c]"); t("abc", "[^x]*"); t("abc", "*[^x]*"); t("abc", "*[^x]"); /* Fourth case: preceding wildcard */ t("abc", "?a*"); t("abc", "*?a*"); t("abc", "*?a"); t("abc", "?b*"); t("abc", "*?b*"); t("abc", "*?b"); t("abc", "?c*"); t("abc", "*?c*"); t("abc", "*?c"); t("abc", "?x*"); t("abc", "*?x*"); t("abc", "*?x"); /* Fifth case: following wildcard */ t("abc", "a?*"); t("abc", "*a?*"); t("abc", "*a?"); t("abc", "b?*"); t("abc", "*b?*"); t("abc", "*b?"); t("abc", "c?*"); t("abc", "*c?*"); t("abc", "*c?"); t("abc", "x?*"); t("abc", "*x?*"); t("abc", "*x?"); } #endif #ifdef SELFTEST_EXP result=1 * result=1 ** result=1 ? result=0 [abc] result=0 a a result=1 a A result=1 A a result=1 A A result=1 a [a] result=1 a [A] result=1 A [a] result=1 A [A] result=1 a [!a] result=0 a [!A] result=0 A [!a] result=0 A [!A] result=0 a [^a] result=0 a [^A] result=0 A [^a] result=0 A [^A] result=0 a *a result=1 a *A result=1 A *a result=1 A *A result=1 abc result=0 abc * result=1 abc ** result=1 abc ? result=0 abc ?? result=0 abc ??? result=1 abc ???? result=0 abc abc result=1 abc *abc result=1 abc *bc result=1 abc *c result=1 abc ?bc result=1 abc a?c result=1 abc ab? result=1 abc [axy][bxy][cxy] result=1 abc a* result=1 abc *a* result=1 abc *a result=0 abc b* result=0 abc *b* result=1 abc *b result=0 abc c* result=0 abc *c* result=1 abc *c result=1 abc x* result=0 abc *x* result=0 abc *x result=0 abc [axy]* result=1 abc *[axy]* result=1 abc *[axy] result=0 abc [bxy]* result=0 abc *[bxy]* result=1 abc *[bxy] result=0 abc [cxy]* result=0 abc *[cxy]* result=1 abc *[cxy] result=1 abc [xyz]* result=0 abc *[xyz]* result=0 abc *[xyz] result=0 abc [!a]* result=0 abc *[!a]* result=1 abc *[!a] result=1 abc [!b]* result=1 abc *[!b]* result=1 abc *[!b] result=1 abc [!c]* result=1 abc *[!c]* result=1 abc *[!c] result=0 abc [!x]* result=1 abc *[!x]* result=1 abc *[!x] result=1 abc [^a]* result=0 abc *[^a]* result=1 abc *[^a] result=1 abc [^b]* result=1 abc *[^b]* result=1 abc *[^b] result=1 abc [^c]* result=1 abc *[^c]* result=1 abc *[^c] result=0 abc [^x]* result=1 abc *[^x]* result=1 abc *[^x] result=1 abc ?a* result=0 abc *?a* result=0 abc *?a result=0 abc ?b* result=1 abc *?b* result=1 abc *?b result=0 abc ?c* result=0 abc *?c* result=1 abc *?c result=1 abc ?x* result=0 abc *?x* result=0 abc *?x result=0 abc a?* result=1 abc *a?* result=1 abc *a? result=0 abc b?* result=0 abc *b?* result=1 abc *b? result=1 abc c?* result=0 abc *c?* result=0 abc *c? result=0 abc x?* result=0 abc *x?* result=0 abc *x? result=0 #endif bglibs-1.106/str/findnext.c0000664000076400007640000000276011147311330015122 0ustar bruceguenter/* str/findnext.c - Find the next instance of a single character * 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 "str.h" /** Find the next instance of the given character, on or after \c pos */ int str_findnext(const str* s, char ch, unsigned pos) { char* p; if (pos >= s->len) return -1; p = memchr(s->s+pos, ch, s->len-pos); if (!p) return -1; return p - s->s; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { str s = { "01234567890123456", 16, 0 }; obuf_puti(&outbuf, str_findnext(&s, '4', 0)); NL(); obuf_puti(&outbuf, str_findnext(&s, '4', 4)); NL(); obuf_puti(&outbuf, str_findnext(&s, '4', 5)); NL(); obuf_puti(&outbuf, str_findnext(&s, '6', 7)); NL(); } #endif #ifdef SELFTEST_EXP 4 4 14 -1 #endif bglibs-1.106/str/free.c0000664000076400007640000000243411147311330014222 0ustar bruceguenter/* str/free.c - Free the storage allocated by a string * 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 "str.h" /** Free a string's storage. * This function also sets all the members of the structure to zero. */ void str_free(str* s) { if (s->s) free(s->s); s->s = 0; s->len = 0; s->size = 0; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { static str s; str_alloc(&s, 1, 0); debugstr(&s); str_free(&s); debugstr(&s); } #endif #ifdef SELFTEST_EXP len=0 size=16 s= len=0 size=0 s is NULL #endif bglibs-1.106/str/lstrip.c0000664000076400007640000000222711147311330014616 0ustar bruceguenter/* str/lstrip.c - Strip whitespace from the left of a string * 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 "str.h" /** Strip all white space from the left (front) of the string */ void str_lstrip(str* s) { unsigned off; for (off = 0; off < s->len && isspace(s->s[off]); ++off) ; if (off) { memmove(s->s, s->s+off, s->len-off+1); s->len -= off; } } bglibs-1.106/str/cat3s.c0000664000076400007640000000302011147311330014306 0ustar bruceguenter/* str/cat3s.c - Append three C strings to a dynamic str * 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 "str.h" /** Append 3 C strings */ int str_cat3s(str* s, const char* a, const char* b, const char* c) { char* ptr; unsigned alen = strlen(a); unsigned blen = strlen(b); unsigned clen = strlen(c); if (!str_realloc(s, s->len+alen+blen+clen)) return 0; ptr = s->s + s->len; s->len += alen+blen+clen; memcpy(ptr, a, alen); ptr += alen; memcpy(ptr, b, blen); ptr += blen; memcpy(ptr, c, clen); ptr += clen; *ptr = 0; return 1; } #ifdef SELFTEST_MAIN #include "selftest.c" MAIN { static str s; str_copyb(&s, "abc", 3); debugstrfn(str_cat3s(&s, "1", "2", "3"), &s); } #endif #ifdef SELFTEST_EXP result=1 len=6 size=16 s=abc123 #endif bglibs-1.106/dict/0000755000076400007640000000000011147311327013251 5ustar bruceguenterbglibs-1.106/dict/load_list.c0000664000076400007640000000113311147311327015367 0ustar bruceguenter#include "iobuf/iobuf.h" #include "str/str.h" #include "dict.h" #include "load.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-1.106/dict/str_free.c0000664000076400007640000000021211147311327015223 0ustar bruceguenter#include #include "str/str.h" #include "dict.h" void dict_str_free(void* v) { str* s = (str*)v; str_free(s); free(s); } bglibs-1.106/dict/add.c0000664000076400007640000000464011147311327014153 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-1.106/dict/load_map.c0000664000076400007640000000173511147311327015201 0ustar bruceguenter#include #include #include "iobuf/iobuf.h" #include "str/str.h" #include "dict.h" #include "load.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-1.106/dict/dict.h0000664000076400007640000000152211147311327014347 0ustar bruceguenter#ifndef DICT__H__ #define DICT__H__ #include "str/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*); #endif bglibs-1.106/dict/init.c0000664000076400007640000000014411147311327014361 0ustar bruceguenter#include "dict.h" int dict_init(dict* d) { d->count = d->size = 0; d->table = 0; return 1; } bglibs-1.106/dict/get.c0000664000076400007640000000056211147311327014201 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-1.106/dict/dicthash.c0000664000076400007640000000033711147311327015211 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-1.106/dict/foreach.c0000664000076400007640000000044311147311327015027 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-1.106/dict/load.h0000664000076400007640000000046411147311327014347 0ustar bruceguenter#ifndef DICT__LOAD__H__ #define DICT__LOAD__H__ #include 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-1.106/dict/free.c0000664000076400007640000000071711147311327014345 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-1.106/INSTHIER0000664000076400007640000001321111147311327013476 0ustar bruceguenter>bin c:::755::bg-installer c:::755::cli-generate c:::755::crc-gentab >include c:::644::installer.h:instlib/installer.h c:::644::sysdeps.h c:::644::sysdeps.h c:::644::systime.h c:::644::uintnn.h c:::644::uint16.h c:::644::uint32.h c:::644::uint64.h d:::755:adt c:::644:adt:common.h:adt/common.h c:::644:adt:ghash.h:adt/ghash.h c:::644:adt:gqueue.h:adt/gqueue.h c:::644:adt:gstack.h:adt/gstack.h d:::755:base64 c:::644:base64:base64.h:base64/base64.h d:::755:cdb c:::644:cdb:cdb.h:cdb/cdb.h c:::644:cdb:make.h:cdb/make.h c:::644:cdb:str.h:cdb/str.h d:::755:cli c:::644:cli:cli.h:cli/cli.h d:::755:crc c:::644:crc:crc16_arc.h:crc/crc16_arc.h c:::644:crc:crc16_ccitt.h:crc/crc16_ccitt.h c:::644:crc:crc16_xmodem.h:crc/crc16_xmodem.h c:::644:crc:crc32.h:crc/crc32.h c:::644:crc:crc32c.h:crc/crc32c.h c:::644:crc:crc64.h:crc/crc64.h c:::644:crc:gcrc.h:crc/gcrc.h d:::755:crypto c:::644:crypto:hmac.h:crypto/hmac.h c:::644:crypto:md5.h:crypto/md5.h c:::644:crypto:sha1.h:crypto/sha1.h c:::644:crypto:sha256.h:crypto/sha256.h c:::644:crypto:sha384.h:crypto/sha384.h c:::644:crypto:sha512.h:crypto/sha512.h c:::644:crypto:surf.h:crypto/surf.h c:::644:crypto:surfrand.h:crypto/surfrand.h d:::755:dict c:::644:dict:dict.h:dict/dict.h c:::644:dict:load.h:dict/load.h d:::755:fmt c:::644:fmt:misc.h:fmt/misc.h c:::644:fmt:multi.h:fmt/multi.h c:::644:fmt:number.h:fmt/number.h d:::755:iobuf c:::644:iobuf:common.h:iobuf/common.h c:::644:iobuf:ibuf.h:iobuf/ibuf.h c:::644:iobuf:iobuf.h:iobuf/iobuf.h c:::644:iobuf:obuf.h:iobuf/obuf.h d:::755:misc c:::644:misc:misc.h:misc/misc.h c:::644:misc:ucspi.h:misc/ucspi.h d:::755:msg c:::644:msg:debug.h:msg/debug.h c:::644:msg:msg.h:msg/msg.h c:::644:msg:wrap.h:msg/wrap.h d:::755:net c:::644:net:ipv4.h:net/ipv4.h c:::644:net:ipv6.h:net/ipv6.h c:::644:net:resolve.h:net/resolve.h c:::644:net:socket.h:net/socket.h d:::755:path c:::644:path:path.h:path/path.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:str c:::644:str:env.h:str/env.h c:::644:str:iter.h:str/iter.h c:::644:str:str.h:str/str.h d:::755:unix c:::644:unix:cloexec.h:unix/cloexec.h c:::644:unix:fcntl.h:unix/fcntl.h c:::644:unix:nonblock.h:unix/nonblock.h c:::644:unix:selfpipe.h:unix/selfpipe.h c:::644:unix:signalfd.h:unix/signalfd.h c:::644:unix:sig.h:unix/sig.h c:::644:unix:trigger.h:unix/trigger.h d:::755:vmailmgr c:::644:vmailmgr:client.h:vmailmgr/client.h c:::644:vmailmgr:vpwentry.h:vmailmgr/vpwentry.h >lib c:::644::crypt.lib c:::644::dl.lib c:::644::m.lib c:::644::net.lib c:::644::rt.lib c:::644::s.lib c:::644::shadow.lib c:::644::socket.lib l:::755::libbg.la l:::755::libbg-sysdeps.la c:::644::libbg-installer.a:.libs/libbg-installer.a c:::644::libbg-instcheck.a:.libs/libbg-instcheck.a c:::644::libbg-instshow.a:.libs/libbg-instshow.a c:::644::libbg-adt.a:.libs/libbg-adt.a c:::644::libbg-base64.a:.libs/libbg-base64.a c:::644::libbg-cdb.a:.libs/libbg-cdb.a c:::644::libbg-cli.a:.libs/libbg-cli.a c:::644::libbg-crc.a:.libs/libbg-crc.a c:::644::libbg-crypto.a:.libs/libbg-crypto.a c:::644::libbg-dict.a:.libs/libbg-dict.a c:::644::libbg-fmt.a:.libs/libbg-fmt.a c:::644::libbg-iobuf.a:.libs/libbg-iobuf.a c:::644::libbg-misc.a:.libs/libbg-misc.a c:::644::libbg-msg.a:.libs/libbg-msg.a c:::644::libbg-net.a:.libs/libbg-net.a c:::644::libbg-path.a:.libs/libbg-path.a c:::644::libbg-str.a:.libs/libbg-str.a c:::644::libbg-unix.a:.libs/libbg-unix.a c:::644::libpwcmp.a:.libs/libpwcmp.a c:::644::libpwcmp-module.a:.libs/libpwcmp-module.a c:::644::libvmailmgr.a:.libs/libvmailmgr.a # Compatibility links s:::::libsysdeps.a:libbg-sysdeps.a:.libs/libbg-sysdeps.a s:::::libinstaller.a:libbg-installer.a:.libs/libbg-installer.a s:::::libinstcheck.a:libbg-instcheck.a:.libs/libbg-instcheck.a s:::::libinstshow.a:libbg-instshow.a:.libs/libbg-instshow.a d:::755:base64 s::::base64:base64.a:../libbg-base64.a:.libs/../libbg-base64.a d:::755:cdb s::::cdb:cdb.a:../libbg-cdb.a:.libs/../libbg-cdb.a s::::cdb:make.a:../libbg-cdb.a:.libs/../libbg-cdb.a s::::cdb:str.a:../libbg-cdb.a:.libs/../libbg-cdb.a d:::755:cli s::::cli:cli.a:../libbg-cli.a:.libs/../libbg-cli.a d:::755:crypto s::::crypto:md5.a:../libbg-crypto.a:.libs/../libbg-crypto.a s::::crypto:sha1.a:../libbg-crypto.a:.libs/../libbg-crypto.a s::::crypto:sha256.a:../libbg-crypto.a:.libs/../libbg-crypto.a s::::crypto:sha512a.a:../libbg-crypto.a:.libs/../libbg-crypto.a d:::755:dict s::::dict:dict.a:../libbg-dict.a:.libs/../libbg-dict.a s::::dict:load.a:../libbg-dict.a:.libs/../libbg-dict.a d:::755:iobuf s::::iobuf:iobuf.a:../libbg-iobuf.a:.libs/../libbg-iobuf.a s::::iobuf:str.a:../libbg-iobuf.a:.libs/../libbg-iobuf.a d:::755:misc s::::misc:misc.a:../libbg-misc.a:.libs/../libbg-misc.a d:::755:msg s::::msg:msg.a:../libbg-msg.a:.libs/../libbg-msg.a s::::msg:wrap.a:../libbg-msg.a:.libs/../libbg-msg.a d:::755:net s::::net:ipv4.a:../libbg-net.a:.libs/../libbg-net.a s::::net:resolve.a:../libbg-net.a:.libs/../libbg-net.a s::::net:socket.a:../libbg-net.a:.libs/../libbg-net.a d:::755:path s::::path:path.a:../libbg-path.a:.libs/../libbg-path.a d:::755:pwcmp s::::pwcmp:client.a:../libpwcmp.a:.libs/../libpwcmp.a s::::pwcmp:hex.a:../libpwcmp.a:.libs/../libpwcmp.a s::::pwcmp:module.a:../libpwcmp-module.a:.libs/../libpwcmp-module.a d:::755:str s::::str:iter.a:../libbg-str.a:.libs/../libbg-str.a s::::str:str.a:../libbg-str.a:.libs/../libbg-str.a d:::755:unix s::::unix:nonblock.a:../libbg-unix.a:.libs/../libbg-unix.a s::::unix:sig.a:../libbg-unix.a:.libs/../libbg-unix.a d:::755:vmailmgr s::::vmailmgr:client.a:../libvmailmgr.a:.libs/../libvmailmgr.a s::::vmailmgr:vpwentry.a:../libvmailmgr.a:.libs/../libvmailmgr.a >man d:::755:man1 c:::644:man1:cli-generate.1 bglibs-1.106/conf-lib0000664000076400007640000000010711147311327013742 0ustar bruceguenter/usr/local/bglibs/lib Libraries will be installed in this directory. bglibs-1.106/cli-generate.pl0000664000076400007640000004015611147311327015232 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 { $_ = shift; s/^\n+//; s/\n*$/\n/; # Split the text into paragraphs my @lines = split("\n", $_); my @parts; my $part; my $mode; while (@lines) { $_ = shift(@lines); # Major modes, match everything up to the following "@end MODE" if (/^\@(example|verbatim)$/) { push @parts, $part if $part; $mode = $1; $part = $_; while (@lines) { $_ = shift(@lines); last if /^\@end\s+$mode$/; $part =~ s/$/\n$_/; } push @parts, $part; $part = ''; } # single line sections, keep them seperate from the text paragraphs elsif (/^\@(table\s+\S+|end\s+table)$/) { push @parts, $part if $part; push @parts, $_; $part = ''; } elsif (!$_ || /^\@item($|\s)/) { push @parts, $part if $part; $part = $_; } else { $part .= ' ' if $part; $part .= $_; } } push @parts, $part if $part; foreach (@parts) { s/[ \t]+/ /g; } @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 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", $$option{'prehelp'}, $$option{'help'}); if (defined($$option{'default'})) { $text .= sprintf(" %${width}s (Defaults to %s)\n", '', $$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($$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 = parse_text(shift); my $tmode; foreach (@parts) { if (s/^\@verbatim($|\n)//) { s/^\./\\./gm; s/^/.nf\n/; s/$/\n.fi/; } elsif (s/^\@example($|\n)//) { $_ = reformat_m_tags($_); s/^/.RS\n/; s/$/\n.RE/; } elsif (/^\@table( (\@\S+))?$/) { $tmode = $2 || '@asis'; $_ = ''; } elsif (/^\@end table$/) { $_ = '.PP'; } elsif (s/^\@itemx? //s) { $_ = reformat_m_tags("$tmode\{$_\}"); s/^/.TP\n/; } else { $_ = reformat_m_tags($_); } s/$/\n/; } $_ = 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 $$option{'help'}, "\n"; print parse_m_text($$option{'description'}), "\n" if $$option{'description'}; print "Defaults to $$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 = parse_text(shift); my $tmode; my $par = 'p'; foreach (@parts) { if (s/^\@verbatim($| )//) { s/\&/\&/g; s//\>/g; s/^/
/;
	    s/$/<\/pre>/;
	}
	elsif (s/^\@example($| )//) {
	    $_ = reformat_w_tags($_);
	    s/^/
/; s/$/<\/blockquote>/; } elsif (/^\@table( (\@\S+))?$/) { $tmode = $2 || '@asis'; $_ = '
'; } elsif (/^\@end table$/) { $_ = '
'; $par = 'p'; } elsif (s/^\@itemx? //s) { $_ = reformat_w_tags("$tmode\{$_\}"); s/^/
/; s/$/<\/dt>/; $par = 'dd'; } else { $_ = reformat_w_tags($_); s/^/<$par>/; s/$/<\/$par>/; } } 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}) { $section =~ tr/a-z/A-Z/; print "
$section
\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-1.106/choose.sh0000664000076400007640000000054111147311327014144 0ustar bruceguentermode="$1" try="sys/try$2" h="sys/has$2.h" result="${h}1" shift 2 case "$mode" in *c*) ./compile "$try".c >/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-1.106/unix/0000755000076400007640000000000011147311330013303 5ustar bruceguenterbglibs-1.106/unix/fcntl.h0000664000076400007640000000031111147311330014557 0ustar bruceguenter#ifndef UNIX__FCNTL__H__ #define UNIX__FCNTL__H__ 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); #endif bglibs-1.106/unix/sig_all.c0000664000076400007640000000171511147311330015067 0ustar bruceguenter#include #include #include "sig.h" #include "sysdeps.h" #if defined(_SIG_MAXSIG) #define SIGMAX _SIG_MAXSIG #elif defined(NSIG) #define SIGMAX NSIG #elif defined(_NSIG) #define SIGMAX _NSIG #else #define SIGMAX 32 #endif void sig_all_catch(signalfn fn) { int i; for (i = 1; i < SIGMAX; i++) if (i != SIGPROF || i != SIGSEGV) sig_catch(i, fn); } void sig_all_default(void) { int i; for (i = 1; i < SIGMAX; i++) if (i != SIGPROF || i != SIGSEGV) sig_default(i); } void sig_all_block(void) { int i; #ifdef HASSIGPROCMASK sigset_t set; sigemptyset(&set); for (i = 1; i < SIGMAX; i++) if (i != SIGPROF || i != SIGSEGV) sigaddset(&set, i); sigprocmask(SIG_BLOCK, &set, 0); #else sigblock(~(1 << (SIGPROF-1)) & ~(1 << (SIGSEGV-1))); #endif } void sig_all_unblock(void) { #ifdef HASSIGPROCMASK sigset_t set; sigemptyset(&set); sigprocmask(SIG_UNBLOCK, &set, 0); #else sigsetmask(0); #endif } bglibs-1.106/unix/sig_quit.c0000664000076400007640000000011011147311330015265 0ustar bruceguenter#include #include "sig.h" SIG_FUNCTION_MAKE(quit, SIGQUIT); bglibs-1.106/unix/sig_child.c0000664000076400007640000000011011147311330015366 0ustar bruceguenter#include #include "sig.h" SIG_FUNCTION_MAKE(child, SIGCHLD) bglibs-1.106/unix/sig_catch.c0000664000076400007640000000243711147311330015403 0ustar bruceguenter/* sig_catch.c - Cause a signal to be handled (caught) by a function * 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 "sig.h" #include "sysdeps.h" void sig_catch(int sig, signalfn fn) { #ifdef HASSIGACTION struct sigaction sa; sa.sa_handler = fn; sa.sa_flags = 0; sigemptyset(&sa.sa_mask); sigaction(sig, &sa, 0); #else signal(sig,fn); /* won't work under System V, even nowadays---dorks */ #endif } void sig_default(int sig) { sig_catch(sig, SIG_DFL); } void sig_ignore(int sig) { sig_catch(sig, SIG_IGN); } bglibs-1.106/unix/signalfd.c0000664000076400007640000000607311147311330015246 0ustar bruceguenter#include #include #include "sysdeps.h" #include "unix/cloexec.h" #include "unix/nonblock.h" #include "unix/sig.h" #include "unix/signalfd.h" static int fds[2] = { -1, -1 }; static void signalfd_handler(int sig) { char signum = sig; write(fds[1], &signum, 1); } /** Initialize the signal file descriptor. * * This function creates a pipe through which signals will get passed. * This is a way of handling signals that avoids most problems posed by * UNIX signals. When a signal is caught by this interface, the * numerical value of the signal is passed down the pipe as a native * integer. The file descriptor is set to non-blocking mode to prevent * blocking when reading from it. * * To use the file descriptor, use either \c poll or \c select to * determine when it is readable. When it becomes readable, read a * single byte from it. The value of this byte indicates what signal * was caught. * * Due to the global nature of UNIX signal handling, only a single * signalfd interface may be active at any time. Do not call \c * signalfd_init multiple times without calling \c signalfd_close first. * * \return -1 if an error occurred, otherwise the return value is the * file descriptor opened for reading. */ int signalfd_init(void) { if (pipe(fds) == -1) return -1; if (!cloexec_on(fds[0]) || !nonblock_on(fds[0]) || !cloexec_on(fds[1]) || !nonblock_on(fds[1])) signalfd_close(); return fds[0]; } /** Mark a signal as being caught through the signalfd interface. */ void signalfd_catch(int sig) { sig_catch(sig, signalfd_handler); } /** Unmark a signal as being caught through the signalfd interface. */ void signalfd_uncatch(int sig) { sig_default(sig); } /** Close the signalfd interface. */ void signalfd_close(void) { close(fds[0]); close(fds[1]); fds[0] = fds[1] = -1; } #ifdef SELFTEST_MAIN #include #include #include "selftest.c" void puti(const char* word, long i) { obuf_put2s(&outbuf, word, ": "); obuf_puti(&outbuf, i); obuf_endl(&outbuf); } MAIN { char buf[4]; int fd; pid_t pid; for (fd = 3; fd < 32; ++fd) close(fd); fd = signalfd_init(); signalfd_catch(SIGCHLD); puti("FD[0]", fds[0]); puti("FD[1]", fds[1]); puti("Returned FD", fd); puti("read before SIGCHLD", read(fd, &buf, sizeof buf)); puti("errno is EAGAIN", errno == EAGAIN); pid = getpid(); kill(pid, SIGCHLD); puti("read after SIGCHLD", read(fd, &buf, sizeof buf)); puti("data is SIGCHLD", buf[0] == SIGCHLD); puti("second read", read(fd, &buf, sizeof buf)); kill(pid, SIGCHLD); kill(pid, SIGCHLD); puti("read after two SIGCHLDs", read(fd, &buf, sizeof buf)); puti("second read", read(fd, &buf, sizeof buf)); signalfd_close(); puti("read after close", read(fd, &buf, sizeof buf)); puti("errno is EBADF", errno == EBADF); } #endif #ifdef SELFTEST_EXP FD[0]: 3 FD[1]: 4 Returned FD: 3 read before SIGCHLD: -1 errno is EAGAIN: 1 read after SIGCHLD: 1 data is SIGCHLD: 1 second read: -1 read after two SIGCHLDs: 2 second read: -1 read after close: -1 errno is EBADF: 1 #endif bglibs-1.106/unix/sig_bug.c0000664000076400007640000000055611147311330015076 0ustar bruceguenter#include #include "sig.h" void sig_bug_catch(signalfn fn) { sig_catch(SIGILL, fn); sig_catch(SIGABRT, fn); sig_catch(SIGFPE, fn); sig_catch(SIGSEGV, fn); #ifdef SIGEMT sig_catch(SIGEMT, fn); #endif #ifdef SIGBUS sig_catch(SIGBUS, fn); #endif #ifdef SIGSYS sig_catch(SIGSYS, fn); #endif #ifdef SIGSTKFLT sig_catch(SIGSTKFLT, fn); #endif } bglibs-1.106/unix/fcntl_fl_off.c0000664000076400007640000000220211147311330016066 0ustar bruceguenter/* unix/fcntl_fl_off.c - Turn off flag with fcntl F_SETFL * 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 "fcntl.h" int fcntl_fl_off(int fd, int flag) { int flags; int newflags; if ((flags = fcntl(fd, F_GETFL, 0)) == -1) return 0; if ((newflags = flags & ~flag) != flags) if (fcntl(fd, F_SETFL, newflags)) return 0; return 1; } bglibs-1.106/unix/sig_pipe.c0000664000076400007640000000010711147311330015246 0ustar bruceguenter#include #include "sig.h" SIG_FUNCTION_MAKE(pipe, SIGPIPE) bglibs-1.106/unix/signalfd.h0000664000076400007640000000043511147311330015247 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-1.106/unix/sig_suspend.c0000664000076400007640000000202611147311330015774 0ustar bruceguenter/* sig_suspend - Suspend delivery of signals * 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 "sig.h" #include "sysdeps.h" void sig_suspend(void) { #ifdef HASSIGPROCMASK sigset_t set; sigemptyset(&set); sigsuspend(&set); #else sigpause(0); #endif } bglibs-1.106/unix/nonblock.h0000664000076400007640000000016411147311330015264 0ustar bruceguenter#ifndef UNIX__NONBLOCK__H__ #define UNIX__NONBLOCK__H__ int nonblock_on(int fd); int nonblock_off(int fd); #endif bglibs-1.106/unix/sig_alarm.c0000664000076400007640000000011011147311330015377 0ustar bruceguenter#include #include "sig.h" SIG_FUNCTION_MAKE(alarm, SIGALRM) bglibs-1.106/unix/selfpipe.c0000664000076400007640000000553411147311330015267 0ustar bruceguenter#include #include #include "sysdeps.h" #include "unix/cloexec.h" #include "unix/nonblock.h" #include "unix/sig.h" #include "unix/selfpipe.h" static int fds[2] = { -1, -1 }; /** Catch a signal and write it to the self-pipe. * * This routine can be used with sig_*_catch() to send other signals * through the self-pipe. */ void selfpipe_catch_signal(int signal) { char c = signal; write(fds[1], &c, 1); } /** Set up a self-pipe for catching child exit events. * * This function opens up a pipe within the program used to safely * handle exiting child processes. Every time a child exits, a single * byte is written to the pipe. The resulting file descriptor is * statically assigned, so do not call this function more than once * within a single program. The file descriptor is set to non-blocking * mode to prevent blocking when reading from it. * * To use the file descriptor, use either \c poll or \c select to * determine when it is readable. When it becomes readable, read the * data written to it (and throw it away), and use \c wait or equivalent * to catch the \c exit value from the child process(es). * * \return -1 if an error occurred, otherwise the return value is the * file descriptor opened for reading. */ int selfpipe_init(void) { if (pipe(fds) == -1) return -1; if (!nonblock_on(fds[0]) || !cloexec_on(fds[0]) || !nonblock_on(fds[1]) || !cloexec_on(fds[1])) { close(fds[0]); close(fds[1]); return -1; } sig_child_catch(selfpipe_catch_signal); return fds[0]; } /** Shut down the self-pipe. */ void selfpipe_close(void) { close(fds[0]); close(fds[1]); sig_child_default(); } #ifdef SELFTEST_MAIN #include #include #include "selftest.c" void puti(const char* word, long i) { obuf_put2s(&outbuf, word, ": "); obuf_puti(&outbuf, i); obuf_endl(&outbuf); } MAIN { int buf; int fd = selfpipe_init(); pid_t pid = getpid(); puti("FD[0] >= 0", fds[0] >= 0); puti("FD[1] >= 0", fds[1] >= 0); puti("FD[0] != FD[1]", fds[0] != fds[1]); puti("Returned FD == FD[0]", fd == fds[0]); puti("read before SIGCHLD", read(fd, &buf, sizeof buf)); puti("errno is EAGAIN", errno == EAGAIN); kill(pid, SIGCHLD); puti("read after SIGCHLD", read(fd, &buf, sizeof buf)); puti("second read", read(fd, &buf, sizeof buf)); kill(pid, SIGCHLD); kill(pid, SIGCHLD); puti("read after two SIGCHLDs", read(fd, &buf, sizeof buf)); puti("second read", read(fd, &buf, sizeof buf)); selfpipe_close(); puti("read after close", read(fd, &buf, sizeof buf)); puti("errno is EBADF", errno == EBADF); } #endif #ifdef SELFTEST_EXP FD[0] >= 0: 1 FD[1] >= 0: 1 FD[0] != FD[1]: 1 Returned FD == FD[0]: 1 read before SIGCHLD: -1 errno is EAGAIN: 1 read after SIGCHLD: 1 second read: -1 read after two SIGCHLDs: 2 second read: -1 read after close: -1 errno is EBADF: 1 #endif bglibs-1.106/unix/fcntl_fd_off.c0000664000076400007640000000220211147311330016056 0ustar bruceguenter/* unix/fcntl_fd_off.c - Turn off flag with fcntl F_SETFD * 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 "fcntl.h" int fcntl_fd_off(int fd, int flag) { int flags; int newflags; if ((flags = fcntl(fd, F_GETFD, 0)) == -1) return 0; if ((newflags = flags & ~flag) != flags) if (fcntl(fd, F_SETFD, newflags)) return 0; return 1; } bglibs-1.106/unix/nonblock_off.c0000664000076400007640000000206711147311330016115 0ustar bruceguenter/* unix/nonblock_off.c - Turn off non-blocking I/O mode on a fd * 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 "fcntl.h" #include "nonblock.h" #ifndef O_NONBLOCK #define O_NONBLOCK O_NDELAY #endif int nonblock_off(int fd) { return fcntl_fl_off(fd, O_NONBLOCK); } bglibs-1.106/unix/sig.h0000664000076400007640000000202011147311330014232 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-1.106/unix/sig_block.c0000664000076400007640000000242311147311330015406 0ustar bruceguenter/* sig_block.c - Block and unblock signals * 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 "sig.h" #include "sysdeps.h" void sig_block(int s) { #ifdef HASSIGPROCMASK sigset_t set; sigemptyset(&set); sigaddset(&set, s); sigprocmask(SIG_BLOCK, &set, 0); #else sigblock(1 << (s - 1)); #endif } void sig_unblock(int s) { #ifdef HASSIGPROCMASK sigset_t set; sigemptyset(&set); sigaddset(&set, s); sigprocmask(SIG_UNBLOCK, &set, 0); #else sigsetmask(sigsetmask(~0) & ~(1 << (s - 1))); #endif } bglibs-1.106/unix/sig_misc.c0000664000076400007640000000050011147311330015241 0ustar bruceguenter#include #include "sig.h" void sig_misc_ignore(void) { sig_ignore(SIGHUP); sig_ignore(SIGINT); sig_ignore(SIGQUIT); sig_ignore(SIGUSR1); sig_ignore(SIGUSR2); #ifdef SIGXCPU sig_ignore(SIGXCPU); #endif #ifdef SIGXFSZ sig_ignore(SIGXFSZ); #endif sig_ignore(SIGVTALRM); sig_ignore(SIGPROF); } bglibs-1.106/unix/selfpipe.h0000664000076400007640000000035311147311330015266 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-1.106/unix/cloexec_off.c0000664000076400007640000000177211147311330015734 0ustar bruceguenter/* unix/cloexec_off.c - Turn off close-on-exec mode on a fd * 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 "fcntl.h" #include "cloexec.h" int cloexec_off(int fd) { return fcntl_fd_off(fd, FD_CLOEXEC); } bglibs-1.106/unix/trigger_pull.c0000664000076400007640000000037511147311330016155 0ustar bruceguenter#include "sysdeps.h" #include #include #include "trigger.h" /** Activate a trigger. */ void trigger_pull(const char* path) { int fd; if ((fd = open(path, O_WRONLY | O_NDELAY)) >= 0) { write(fd, "", 1); close(fd); } } bglibs-1.106/unix/fcntl_fd_on.c0000664000076400007640000000217611147311330015732 0ustar bruceguenter/* unix/fcntl_fd_on.c - Turn on flag with fcntl F_SETFD * 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 "fcntl.h" int fcntl_fd_on(int fd, int flag) { int flags; int newflags; if ((flags = fcntl(fd, F_GETFD, 0)) == -1) return 0; if ((newflags = flags | flag) != flags) if (fcntl(fd, F_SETFD, newflags)) return 0; return 1; } bglibs-1.106/unix/sig_hup.c0000664000076400007640000000010511147311330015103 0ustar bruceguenter#include #include "sig.h" SIG_FUNCTION_MAKE(hup, SIGHUP) bglibs-1.106/unix/cloexec_on.c0000664000076400007640000000176611147311330015601 0ustar bruceguenter/* unix/cloexec_on.c - Turn on close-on-exec mode on a fd * 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 "fcntl.h" #include "cloexec.h" int cloexec_on(int fd) { return fcntl_fd_on(fd, FD_CLOEXEC); } bglibs-1.106/unix/sig_term.c0000664000076400007640000000010711147311330015260 0ustar bruceguenter#include #include "sig.h" SIG_FUNCTION_MAKE(term, SIGTERM) bglibs-1.106/unix/fcntl_fl_on.c0000664000076400007640000000217611147311330015742 0ustar bruceguenter/* unix/fcntl_fl_on.c - Turn on flag with fcntl F_SETFL * 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 "fcntl.h" int fcntl_fl_on(int fd, int flag) { int flags; int newflags; if ((flags = fcntl(fd, F_GETFL, 0)) == -1) return 0; if ((newflags = flags | flag) != flags) if (fcntl(fd, F_SETFL, newflags)) return 0; return 1; } bglibs-1.106/unix/trigger.h0000664000076400007640000000265711147311330015133 0ustar bruceguenter#ifndef BGLIBS__UNIX__TRIGGER__H__ #define BGLIBS__UNIX__TRIGGER__H__ #include /** \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-1.106/unix/nonblock_on.c0000664000076400007640000000206311147311330015753 0ustar bruceguenter/* unix/nonblock_on.c - Turn on non-blocking I/O mode on a fd * 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 "fcntl.h" #include "nonblock.h" #ifndef O_NONBLOCK #define O_NONBLOCK O_NDELAY #endif int nonblock_on(int fd) { return fcntl_fl_on(fd, O_NONBLOCK); } bglibs-1.106/unix/sig_int.c0000664000076400007640000000010611147311330015102 0ustar bruceguenter#include #include "sig.h" SIG_FUNCTION_MAKE(int, SIGINT); bglibs-1.106/unix/cloexec.h0000664000076400007640000000016011147311330015075 0ustar bruceguenter#ifndef UNIX__CLOEXEC__H__ #define UNIX__CLOEXEC__H__ int cloexec_on(int fd); int cloexec_off(int fd); #endif bglibs-1.106/unix/trigger_set.c0000664000076400007640000000150211147311330015765 0ustar bruceguenter#include "sysdeps.h" #include #include #include "trigger.h" /** Set up a trigger for polling. * * The passed \c iopoll_fd must have at least two slots, as the second * slot may be required in the event the OS exhibits the "named pipe * bug". This function must be called every time the trigger is pulled * to reset the trigger's state. */ int trigger_set(iopoll_fd* io, const char* path) { if (io[0].fd > 0) close(io[0].fd); #ifdef HASNAMEDPIPEBUG if (io[1].fd > 0) close(io[1].fd); #endif if ((io[0].fd = open(path, O_RDONLY | O_NDELAY)) == -1) return 0; io[0].events = IOPOLL_READ; io[0].revents = 0; #ifdef HASNAMEDPIPEBUG if ((io[1].fd = open(path, O_WRONLY | O_NDELAY)) == -1) return 0; #else io[1].fd = -1; #endif io[1].events = 0; io[1].revents = 0; return 1; } bglibs-1.106/warn-auto.sh0000664000076400007640000000010011147311330014562 0ustar bruceguenter#!/bin/sh # WARNING: This file was auto-generated. Do not edit! bglibs-1.106/net/0000755000076400007640000000000011147311330013106 5ustar bruceguenterbglibs-1.106/net/recv6.c0000664000076400007640000000270011147311330014300 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-1.106/net/sendu.c0000664000076400007640000000214011147311330014367 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-1.106/net/acceptu.c0000664000076400007640000000220711147311330014701 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-1.106/net/accept4.c0000664000076400007640000000250111147311330014575 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-1.106/net/ipv4.h0000664000076400007640000000135711147311330014151 0ustar bruceguenter#ifndef NET__IPV4__H__ #define NET__IPV4__H__ #include /** \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) __attribute__((__deprecated__)); extern const char* ipv4_scan(const char* s, ipv4addr* addr); extern const char* ipv4_format(const ipv4addr* addr); extern unsigned fmt_ipv4addr(char* buffer, const ipv4addr* addr); /** @} */ #endif bglibs-1.106/net/ipv6.h0000664000076400007640000000114211147311330014143 0ustar bruceguenter#ifndef NET__IPV6__H__ #define NET__IPV6__H__ #include /** \defgroup ipv6 ipv6: IPv6 Address Handling @{ */ /** IPv6 address structure. */ typedef struct { /** 128-bit IPv4 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 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); /** @} */ #endif bglibs-1.106/net/reuse.c0000664000076400007640000000211311147311330014374 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-1.106/net/udp6.c0000664000076400007640000000221611147311330014133 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-1.106/net/pairdgm.c0000664000076400007640000000214611147311330014702 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-1.106/net/notcpdelay.c0000664000076400007640000000264211147311330015422 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-1.106/net/broadcast.c0000664000076400007640000000215511147311330015221 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-1.106/net/connectu.c0000664000076400007640000000233411147311330015074 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-1.106/net/connect4_timeout.c0000664000076400007640000000316511147311330016544 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 "net/socket.h" #include "unix/nonblock.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-1.106/net/socket.h0000664000076400007640000000540311147311330014553 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-1.106/net/ipv6_format.c0000664000076400007640000000754411147311330015522 0ustar bruceguenter#include #include "ipv6.h" #include "ipv4.h" static char hex[16] = "0123456789ABCDEF"; static char* format_part(uint16 i, char* str) { if (i > 0xfff) *str++ = hex[(i >> 12) & 0xf]; if (i > 0xff) *str++ = hex[(i >> 8) & 0xf]; if (i > 0xf) *str++ = hex[(i >> 4) & 0xf]; *str++ = hex[i & 0xf]; return str; } 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* str = 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) { *str++ = ':'; *str++ = ':'; /* A couple of special cases, to simplify IPv4 style output */ if (first >= 8) i = 1; else if (first == 7 && bits[7] == 1) *str++ = '1'; else if (first >= 6) str += format_ipv4(str, addr); else if (first == 5 && bits[5] == 0xffff) { memcpy(str, "FFFF:", 5); str += 5; str += format_ipv4(str, addr); } else for (i = first; i < 8; ++i) { if (i > first) *str++ = ':'; str = format_part(bits[i], str); } } 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) *str++ = ':'; str = format_part(bits[i], str); } if (zs < 8) { *str++ = ':'; *str++ = ':'; for (i = ze; i < 8; ++i) { if (i > ze) *str++ = ':'; str = format_part(bits[i], str); } } } return str - buffer; } #ifdef SELFTEST_MAIN #include "selftest.c" 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-1.106/net/ipv4_scan.c0000664000076400007640000000411111147311330015137 0ustar bruceguenter#include #include "ipv4.h" static const char* parse_part(const char* str, uint8* num) { uint8 i = 0; if (*str < '0' || *str > '9') return 0; do { unsigned newi; newi = i * 10 + *str - '0'; if (newi < i || newi > 255) return 0; ++str; i = newi; } while (*str >= '0' && *str <= '9'); *num = i; return str; } /** 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 #include "selftest.c" 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-1.106/net/resolve.h0000664000076400007640000000133311147311330014740 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(void); /** @} */ #endif bglibs-1.106/net/ipv4_addr.c0000664000076400007640000000044211147311330015130 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-1.106/net/connectu_timeout.c0000664000076400007640000000314711147311330016645 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 "net/socket.h" #include "unix/nonblock.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-1.106/net/tcp4.c0000664000076400007640000000264211147311330014132 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 #include "selftest.c" 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-1.106/net/bindu.c0000664000076400007640000000243311147311330014357 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-1.106/net/recvu.c0000664000076400007640000000214611147311330014403 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-1.106/net/ipv6_scan.c0000664000076400007640000000757711147311330015164 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 #include "selftest.c" 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-1.106/net/resolve_error.c0000664000076400007640000000067111147311330016150 0ustar bruceguenter#include #include "resolve.h" /** Look up the last resolve error code. */ int resolve_error(void) { switch (h_errno) { case 0: return RESOLVE_OK; case HOST_NOT_FOUND: return RESOLVE_NOTFOUND; case NO_ADDRESS: #ifdef NO_DATA #if NO_DATA != NO_ADDRESS case NO_DATA: #endif #endif return RESOLVE_NOADDR; case NO_RECOVERY: return RESOLVE_NSERROR; case TRY_AGAIN: return RESOLVE_TEMPFAIL; default: return -1; } } bglibs-1.106/net/cmsg.h0000664000076400007640000000103211147311330014206 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-1.106/net/connect6_timeout.c0000664000076400007640000000316511147311330016546 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 "net/socket.h" #include "unix/nonblock.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-1.106/net/connect4.c0000664000076400007640000000353511147311330014777 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 #include "selftest.c" 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-1.106/net/getaddr4.c0000664000076400007640000000260011147311330014750 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-1.106/net/resolve_ipv4addr.c0000664000076400007640000000052111147311330016526 0ustar bruceguenter#include #include #include #include "resolve.h" /** Look up the domain name corresponding to an IPv4 address. */ const char* resolve_ipv4addr(const ipv4addr* addr) { struct hostent* ent; h_errno = 0; if ((ent = gethostbyaddr(&addr->addr, 4, AF_INET)) == 0) return 0; return ent->h_name; } bglibs-1.106/net/linger.c0000664000076400007640000000223511147311330014536 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-1.106/net/send4.c0000664000076400007640000000253111147311330014272 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-1.106/net/resolve_ipv4name.c0000664000076400007640000000104011147311330016531 0ustar bruceguenter#include #include #include #include #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) { struct hostent* ent; int i; h_errno = 0; if ((ent = gethostbyname(name)) == 0) return 0; if (ent->h_addrtype != AF_INET || ent->h_length != 4) return 0; for (i = 0; i < maxaddrs && ent->h_addr_list[i] != 0; ++i) memcpy(&addr[i].addr, ent->h_addr_list[i], 4); return i; } bglibs-1.106/net/sendfd.c0000664000076400007640000000327111147311330014522 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: */ *(int *)CMSG_DATA(cmsg) = 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-1.106/net/accept6.c0000664000076400007640000000262711147311330014610 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-1.106/net/ipv6_addr.c0000664000076400007640000000031511147311330015131 0ustar bruceguenter#include "ipv6.h" /** IPv6 "any" address constant. */ const ipv6addr IPV6ADDR_ANY = {{ 0,0,0,0,0,0,0,0 }}; /** IPv6 loopback address constant. */ const ipv6addr IPV6ADDR_LOOPBACK = {{ 0,0,0,0,0,0,0,1 }}; bglibs-1.106/net/pairstr.c0000664000076400007640000000214311147311330014740 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-1.106/net/getaddr6.c0000664000076400007640000000272711147311330014764 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-1.106/net/connected.c0000664000076400007640000000225211147311330015217 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-1.106/net/bind6.c0000664000076400007640000000256311147311330014264 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-1.106/net/unixdgm.c0000664000076400007640000000212611147311330014730 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-1.106/net/cork.c0000664000076400007640000000346111147311330014216 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-1.106/net/bind4.c0000664000076400007640000000243411147311330014257 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-1.106/net/unixstr.c0000664000076400007640000000212311147311330014766 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-1.106/net/listen.c0000664000076400007640000000205511147311330014554 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-1.106/net/uncork.c0000664000076400007640000000302511147311330014555 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-1.106/net/send6.c0000664000076400007640000000266611147311330014305 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-1.106/net/connect6.c0000664000076400007640000000262111147311330014774 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-1.106/net/udp4.c0000664000076400007640000000221611147311330014131 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-1.106/net/ipv4_format.c0000664000076400007640000000301711147311330015507 0ustar bruceguenter#include "ipv4.h" static char* format_part(unsigned char i, char* str) { if (i >= 10) { str = format_part(i / 10, str); i = i % 10; } *str++ = i + '0'; return str; } /** 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 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* str = buffer; str = format_part(addr->addr[0], str); *str++ = '.'; str = format_part(addr->addr[1], str); *str++ = '.'; str = format_part(addr->addr[2], str); *str++ = '.'; str = format_part(addr->addr[3], str); return str - buffer; } #ifdef SELFTEST_MAIN #include "selftest.c" void test(const ipv4addr* ip) { char buffer[32]; unsigned i; debugfn(i = fmt_ipv4addr(buffer, ip)); buffer[i++] = '\n'; buffer[i] = 0; obuf_putsflush(&outbuf, buffer); } 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=15 255.255.255.255 result=9 127.0.0.1 result=7 1.2.3.4 #endif bglibs-1.106/net/shutdown.c0000664000076400007640000000251211147311330015127 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-1.106/net/recvfd.c0000664000076400007640000000303211147311330014523 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; 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; return *(int*)CMSG_DATA(cm); #else errno = ENOSYS; return -1; #endif } bglibs-1.106/net/tcp6.c0000664000076400007640000000221711147311330014132 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-1.106/net/recv4.c0000664000076400007640000000254411147311330014304 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-1.106/iobuf/0000755000076400007640000000000011147311327013432 5ustar bruceguenterbglibs-1.106/iobuf/obuf_putsllnumw.c0000664000076400007640000000430211147311327017044 0ustar bruceguenter#include "obuf.h" static int obuf_putsnumw_rec(obuf* out, long long data, int sign, unsigned width, char pad, unsigned base, const char* digits) { if (width) --width; if (data >= (long)base) { if (!obuf_putsnumw_rec(out, data/base, sign, width, pad, base, digits)) return 0; } else { if (!obuf_sign_pad(out, sign, width, pad)) return 0; } return obuf_putc(out, (data % base) + '0'); } /** 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) { int sign; sign = 0; if (data < 0) { sign = 1; data = -data; if (width) -- width; } if (data < (long)base) { if (width) { if (!obuf_sign_pad(out, sign, width-1, pad)) return 0; } else if (sign) if (!obuf_putc(out, '-')) return 0; return obuf_putc(out, data + '0'); } return obuf_putsnumw_rec(out, data, sign, width, pad, base, digits); } /** 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, obuf_dec_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, obuf_dec_digits); } #ifdef SELFTEST_MAIN #include "selftest.c" 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-1.106/iobuf/ibuf_open.c0000664000076400007640000000053611147311327015552 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-1.106/iobuf/ibuf_readall.c0000664000076400007640000000066011147311327016213 0ustar bruceguenter#include #include /** 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-1.106/iobuf/ibuf_gets.c0000664000076400007640000000153011147311327015546 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 #include "selftest.c" 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-1.106/iobuf/iobuf_copy.c0000664000076400007640000000120411147311327015733 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-1.106/iobuf/obuf_stderr.c0000664000076400007640000000030511147311327016114 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-1.106/iobuf/obuf_putc.c0000664000076400007640000000056711147311327015576 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-1.106/iobuf/obuf_putullnumw.c0000664000076400007640000000605211147311327017052 0ustar bruceguenter#include "obuf.h" static int obuf_putullnumw_rec(obuf* out, unsigned long long data, unsigned width, char pad, unsigned base, const char* digits) { if (width) --width; if (data >= base) { if (!obuf_putullnumw_rec(out, data/base, width, pad, base, digits)) return 0; } else { if (!obuf_pad(out, width, pad)) return 0; } return obuf_putc(out, digits[data % base]); } /** 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) { if (data < base) { if (width && !obuf_pad(out, --width, pad)) return 0; return obuf_putc(out, digits[data]); } return obuf_putullnumw_rec(out, data, width, pad, base, digits); } /** 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, obuf_dec_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, obuf_dec_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, obuf_hex_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, obuf_hex_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, obuf_hex_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, obuf_hex_ucase_digits); } #ifdef SELFTEST_MAIN #include "selftest.c" 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-1.106/iobuf/obuf_open.c0000664000076400007640000000051311147311327015553 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-1.106/iobuf/ibuf_status.c0000664000076400007640000000026011147311327016126 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-1.106/iobuf/obuf_sign_pad.c0000664000076400007640000000172411147311327016403 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 #include "selftest.c" 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-1.106/iobuf/obuf_endl.c0000664000076400007640000000022411147311327015533 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-1.106/iobuf/obuf_putsflush.c0000664000076400007640000000030011147311327016641 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-1.106/iobuf/ibuf_peek.c0000664000076400007640000000053111147311327015530 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-1.106/iobuf/ibuf_getu.c0000664000076400007640000000050011147311327015544 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-1.106/iobuf/ibuf_stdin.c0000664000076400007640000000030411147311327015723 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-1.106/iobuf/iobuf_close.c0000664000076400007640000000101411147311327016065 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-1.106/iobuf/ibuf_getc.c0000664000076400007640000000113611147311327015530 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 #include "selftest.c" 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-1.106/iobuf/obuf_stdout.c0000664000076400007640000000030511147311327016133 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-1.106/iobuf/iobuf.h0000664000076400007640000000056511147311327014717 0ustar bruceguenter#ifndef IO_BUF__H__ #define IO_BUF__H__ #include #include #include /** \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-1.106/iobuf/ibuf_refill.c0000664000076400007640000000206311147311327016063 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-1.106/iobuf/obuf_sync.c0000664000076400007640000000042311147311327015566 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-1.106/iobuf/ibuf.h0000664000076400007640000000417611147311327014542 0ustar bruceguenter#ifndef IO_BUF__IBUF__H__ #define IO_BUF__IBUF__H__ #include /** \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-1.106/iobuf/obuf_putunumw.c0000664000076400007640000000476711147311327016535 0ustar bruceguenter#include "obuf.h" static int obuf_putunumw_rec(obuf* out, unsigned long data, unsigned width, char pad, unsigned base, const char* digits) { if (width) --width; if (data >= base) { if (!obuf_putunumw_rec(out, data/base, width, pad, base, digits)) return 0; } else { if (!obuf_pad(out, width, pad)) return 0; } return obuf_putc(out, digits[data % base]); } /** 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) { if (data < base) { if (width && !obuf_pad(out, --width, pad)) return 0; return obuf_putc(out, digits[data]); } return obuf_putunumw_rec(out, data, width, pad, base, digits); } /** 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, obuf_dec_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, obuf_dec_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, obuf_hex_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, obuf_hex_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, obuf_hex_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, obuf_hex_ucase_digits); } #ifdef SELFTEST_MAIN #include "selftest.c" 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-1.106/iobuf/obuf_put6s.c0000664000076400007640000000200211147311327015666 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 #include "selftest.c" 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-1.106/iobuf/obuf.h0000664000076400007640000001161711147311327014546 0ustar bruceguenter#ifndef IO_BUF__OBUF__H__ #define IO_BUF__OBUF__H__ #include #include /** \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]; extern const char obuf_hex_lcase_digits[16]; extern const char obuf_hex_ucase_digits[16]; /** 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-1.106/iobuf/ibuf_tell.c0000664000076400007640000000027011147311327015544 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-1.106/iobuf/ibuf_getstr_crlf.c0000664000076400007640000000304211147311327017122 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/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 #include "selftest.c" 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-1.106/iobuf/obuf_write.c0000664000076400007640000000341711147311327015752 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 #include "selftest.c" 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-1.106/iobuf/obuf_putnetstring.c0000664000076400007640000000051611147311327017363 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-1.106/iobuf/ibuf_read.c0000664000076400007640000000413411147311327015522 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-1.106/iobuf/obuf_flush.c0000664000076400007640000000111311147311327015730 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-1.106/iobuf/obuf_put4s.c0000664000076400007640000000131611147311327015673 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 #include "selftest.c" 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-1.106/iobuf/ibuf_copytofd.c0000664000076400007640000000113511147311327016434 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-1.106/iobuf/ibuf_seek.c0000664000076400007640000000107411147311327015536 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-1.106/iobuf/obuf_init.c0000664000076400007640000000052511147311327015560 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-1.106/iobuf/ibuf_getstr.c0000664000076400007640000000110611147311327016113 0ustar bruceguenter#include "ibuf.h" #include "str/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-1.106/iobuf/obuf_putsnumw.c0000664000076400007640000000327711147311327016526 0ustar bruceguenter#include "obuf.h" static int obuf_putsnumw_rec(obuf* out, long data, int sign, unsigned width, char pad, unsigned base, const char* digits) { if (width) --width; if (data >= (long)base) { if (!obuf_putsnumw_rec(out, data/base, sign, width, pad, base, digits)) return 0; } else { if (!obuf_sign_pad(out, sign, width, pad)) return 0; } return obuf_putc(out, (data % base) + '0'); } /** 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) { int sign; sign = 0; if (data < 0) { sign = 1; data = -data; if (width) -- width; } if (data < (long)base) { if (width) { if (!obuf_sign_pad(out, sign, width-1, pad)) return 0; } else if (sign) if (!obuf_putc(out, '-')) return 0; return obuf_putc(out, data + '0'); } return obuf_putsnumw_rec(out, data, sign, width, pad, base, digits); } /** 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, obuf_dec_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, obuf_dec_digits); } #ifdef SELFTEST_MAIN #include "selftest.c" 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-1.106/iobuf/iobuf_init.c0000664000076400007640000000265611147311327015740 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 #include "selftest.c" 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-1.106/iobuf/ibuf_openreadclose.c0000664000076400007640000000045311147311327017432 0ustar bruceguenter#include #include /** 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-1.106/iobuf/common.h0000664000076400007640000000461611147311327015104 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-1.106/iobuf/obuf_copyfromfd.c0000664000076400007640000000105011147311327016757 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-1.106/iobuf/ibuf_init.c0000664000076400007640000000047411147311327015555 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-1.106/iobuf/obuf_put3s.c0000664000076400007640000000107611147311327015675 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 #include "selftest.c" 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-1.106/iobuf/obuf_putf.c0000664000076400007640000000144611147311327015576 0ustar bruceguenter#include #include "obuf.h" #include "fmt/multi.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 #include "selftest.c" MAIN { obuf_putf(&outbuf, "d{bar}x", 10, 20); NL(); } #endif #ifdef SELFTEST_EXP 10bar14 #endif bglibs-1.106/iobuf/obuf_put2s.c0000664000076400007640000000070211147311327015667 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 #include "selftest.c" 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-1.106/iobuf/obuf_digits.c0000664000076400007640000000027011147311327016075 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-1.106/iobuf/obuf_pad.c0000664000076400007640000000035311147311327015360 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-1.106/iobuf/obuf_seek.c0000664000076400007640000000122311147311327015540 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-1.106/iobuf/obuf_put7s.c0000664000076400007640000000225611147311327015702 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 #include "selftest.c" 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-1.106/iobuf/ibuf_getnetstring.c0000664000076400007640000000201611147311327017321 0ustar bruceguenter#include #include "ibuf.h" #include "str/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 #include "selftest.c" 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-1.106/iobuf/iobuf_timeout.c0000664000076400007640000000072311147311327016454 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-1.106/iobuf/obuf_close.c0000664000076400007640000000025011147311327015715 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-1.106/iobuf/obuf_putns.c0000664000076400007640000000075611147311327015774 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 #include "selftest.c" MAIN { obuf_putns(&outbuf, 4, "1", 0, "2", "3"); NL(); } #endif #ifdef SELFTEST_EXP 123 #endif bglibs-1.106/iobuf/obuf_put5s.c0000664000076400007640000000154211147311327015675 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 #include "selftest.c" 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-1.106/COPYING0000664000076400007640000006350011147311327013367 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-1.106/uint32/0000755000076400007640000000000011147311330013444 5ustar bruceguenterbglibs-1.106/uint32/get_lsb.c0000664000076400007640000000032611147311330015232 0ustar bruceguenter#include "uint32.h" #ifndef __INLINE_UINT_LSB uint32 uint32_get_lsb(const unsigned char b[4]) { uint32 r; r = b[3]; r <<= 8; r += b[2]; r <<= 8; r += b[1]; r <<= 8; r += b[0]; return r; } #endif bglibs-1.106/uint32/pack_msb.c0000664000076400007640000000032311147311330015367 0ustar bruceguenter#include "uint32.h" #ifndef __INLINE_UINT_MSB void uint32_pack_msb(uint32 u, unsigned char b[4]) { b[3] = u & 0xff; u >>= 8; b[2] = u & 0xff; u >>= 8; b[1] = u & 0xff; u >>= 8; b[0] = u; } #endif bglibs-1.106/uint32/unpack_msb.c0000664000076400007640000000034011147311330015731 0ustar bruceguenter#include "uint32.h" #ifndef __INLINE_UINT_MSB void uint32_unpack_msb(const unsigned char b[4], uint32* u) { uint32 r; r = b[0]; r <<= 8; r += b[1]; r <<= 8; r += b[2]; r <<= 8; r += b[3]; *u = r; } #endif bglibs-1.106/uint32/unpack_lsb.c0000664000076400007640000000034011147311330015730 0ustar bruceguenter#include "uint32.h" #ifndef __INLINE_UINT_LSB void uint32_unpack_lsb(const unsigned char b[4], uint32* u) { uint32 r; r = b[3]; r <<= 8; r += b[2]; r <<= 8; r += b[1]; r <<= 8; r += b[0]; *u = r; } #endif bglibs-1.106/uint32/get_msb.c0000664000076400007640000000032611147311330015233 0ustar bruceguenter#include "uint32.h" #ifndef __INLINE_UINT_MSB uint32 uint32_get_msb(const unsigned char b[4]) { uint32 r; r = b[0]; r <<= 8; r += b[1]; r <<= 8; r += b[2]; r <<= 8; r += b[3]; return r; } #endif bglibs-1.106/uint32/pack_lsb.c0000664000076400007640000000032311147311330015366 0ustar bruceguenter#include "uint32.h" #ifndef __INLINE_UINT_LSB void uint32_pack_lsb(uint32 u, unsigned char b[4]) { b[0] = u & 0xff; u >>= 8; b[1] = u & 0xff; u >>= 8; b[2] = u & 0xff; u >>= 8; b[3] = u; } #endif bglibs-1.106/cli/0000755000076400007640000000000011147311327013075 5ustar bruceguenterbglibs-1.106/cli/help.c0000664000076400007640000000614411147311327014200 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/iobuf.h" #include "msg/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-1.106/cli/internal.h0000664000076400007640000000025211147311327015063 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-1.106/cli/main.c0000664000076400007640000001465111147311327014176 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/iobuf.h" #include "msg/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-1.106/cli/cli.h0000664000076400007640000000227611147311327014026 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-1.106/selftest.c0000664000076400007640000000213611147311330014321 0ustar bruceguenter#include #include #include "iobuf/iobuf.h" #include "msg/msg.h" #include "str/str.h" const char program[] = "selftest"; const int msg_show_pid = 0; void NL(void) { obuf_putc(&outbuf, LF); } 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; } #define MAIN void selftest(void) MAIN; int main(void) { selftest(); obuf_flush(&outbuf); obuf_flush(&errbuf); return 0; } bglibs-1.106/conf-include0000664000076400007640000000011711147311327014620 0ustar bruceguenter/usr/local/bglibs/include C header files will be installed in this directory. bglibs-1.106/TODO0000664000076400007640000000067011147311327013023 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 - Rewrite iobuf and str number conversion routines to use fmt - Finish DNS library! - Implement TCP queries - 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-1.106/adt/0000755000076400007640000000000011147311327013076 5ustar bruceguenterbglibs-1.106/adt/ghash_get.c0000664000076400007640000000167111147311327015202 0ustar bruceguenter#include "ghash.h" /** Find an entry in a \c ghash table. * * \returns A pointer to the entry structure, or \c NULL if the \c key * was not found. */ void** ghash_find(struct ghash* d, const void* key) { const adt_hash_t hash = d->hashfn(key); const unsigned size = d->size; unsigned start; unsigned i; void** p; if (size == 0) return 0; start = hash % size; i = start; p = d->table + start; do { void* entry = *p; if (entry == 0) return 0; if (ghash_entry_hash(entry) == hash && d->keycmp(key, ghash_entry_keyptr(entry)) == 0) return p; ++p; if (++i >= size) i = 0, p = d->table; } while (i != start); return 0; } /** Find an entry in a \c ghash table. * * \returns A pointer to the data structure or \c NULL if the \c key was * not found. */ void* ghash_get(struct ghash* d, const void* key) { void** entry; if ((entry = ghash_find(d, key)) == 0) return 0; return *entry; } bglibs-1.106/adt/gqueue.h0000664000076400007640000000444411147311327014552 0ustar bruceguenter#ifndef BGLIBS__GENERIC_QUEUE__H__ #define BGLIBS__GENERIC_QUEUE__H__ #include /** \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-1.106/adt/ghash_free.c0000664000076400007640000000117711147311327015345 0ustar bruceguenter#include #include #include "ghash.h" /** Free all data (and entries) in a \c ghash table. */ void ghash_free(struct ghash* d) { unsigned long i; void** p; if (d->table != 0) { if (d->keyfree != 0) { for (i = 0, p = d->table; i < d->size; ++i, ++p) if (*p != 0) d->keyfree(ghash_entry_keyptr(*p)); } if (d->datafree != 0) { for (i = 0, p = d->table; i < d->size; ++i, ++p) if (*p != 0) d->datafree(ghash_entry_dataptr(*p, d->keysize)); } for (i = 0, p = d->table; i < d->size; ++i, ++p) if (*p != 0) free(*p); free(d->table); } memset(d, 0, sizeof *d); } bglibs-1.106/adt/ghash_rehash.c0000664000076400007640000000066611147311327015700 0ustar bruceguenter#include #include #include "ghash.h" /** Regenerate all the hash values in a \c ghash table and then rebuild * it. Use this function when any of the keys change value. */ int ghash_rehash(struct ghash* d) { unsigned i; void** entry; for (i = 0, entry = d->table; i < d->size; ++i, ++entry) if (*entry) ghash_entry_hash(*entry) = d->hashfn(ghash_entry_keyptr(*entry)); return ghash_rebuild(d); } bglibs-1.106/adt/gstack_top.c0000664000076400007640000000030211147311327015375 0ustar bruceguenter#include "gstack.h" /** Return the address of first (most recently pushed) element in the * queue. */ void* gstack_top(const struct gstack* s) { return (s->head == 0) ? 0 : s->head->data; } bglibs-1.106/adt/gqueue_push.c0000664000076400007640000000107511147311327015601 0ustar bruceguenter#include #include #include "gqueue.h" /** Add a new element onto the queue. If the copy function \c fn is \c * NULL memcpy is used in its place. */ int gqueue_push(struct gqueue* q, unsigned datasize, const void* data, adt_copy_fn* fn) { struct gqueue_node* n; if ((n = malloc(datasize + sizeof *n)) == 0) return 0; if (fn == 0) memcpy(n->data, data, datasize); else if (!fn(n->data, data)) { free(n); return 0; } if (q->tail == 0) q->head = n; else q->tail->next = n; q->tail = n; ++q->count; return 1; } bglibs-1.106/adt/hashb.c0000664000076400007640000000033411147311327014331 0ustar bruceguenter#include #include #include "common.h" adt_hash_t adt_hashb(const unsigned char* data, unsigned long len) { adt_hash_t h = 0x1505; while (len--) h = (h + (h << 5)) ^ *data++; return h; } bglibs-1.106/adt/ghash_rebuild.c0000664000076400007640000000123511147311327016045 0ustar bruceguenter#include #include #include "ghash.h" /** Rebuild the entry pointer table in a \c ghash table. This function * is used internally after either rehashing the table or removing an * entry. */ int ghash_rebuild(struct ghash* d) { unsigned i; void** newtable; void** oldtable; void** oldptr; if (d->table) { if ((newtable = malloc(d->size * sizeof *newtable)) == 0) return 0; memset(newtable, 0, d->size * sizeof *newtable); oldptr = oldtable = d->table; d->table = newtable; d->count = 0; for (i = 0; i < d->size; ++i, ++oldptr) if (*oldptr) ghash_insert(d, *oldptr); free(oldtable); } return 1; } bglibs-1.106/adt/ghash_set.c0000664000076400007640000000074511147311327015217 0ustar bruceguenter#include #include "ghash.h" /** Replace or add an entry into a generic hash table. */ void* ghash_set(struct ghash* d, const void* key, const void* data) { void* e; void* dataptr; if ((e = ghash_get(d, key)) == 0) return ghash_add(d, key, data); dataptr = ghash_entry_dataptr(e, d->keysize); if (d->datacopy == 0) memcpy(dataptr, data, d->entrysize - d->keysize - sizeof(adt_hash_t)); else if (!d->datacopy(dataptr, data)) return 0; return e; } bglibs-1.106/adt/gstack_pop.c0000664000076400007640000000077711147311327015411 0ustar bruceguenter#include #include "gstack.h" /** Remove the first (most recently pushed) element from the queue. If * the free function \c fn is \c NULL no data freeing is done. Note that * this does not return a pointer to the popped item, as once the item * has been popped it is also freed. */ void gstack_pop(struct gstack* s, adt_free_fn* fn) { if (s->head) { struct gstack_node* head = s->head; if (fn != 0) fn(head->data); s->head = head->next; free(head); --s->count; } } bglibs-1.106/adt/adt_sp.c0000664000076400007640000000060711147311327014521 0ustar bruceguenter#include #include #include "common.h" int adt_cmpsp(const char* const* a, const char* const* b) { return strcmp(*a, *b); } int adt_copysp(const char** a, const char* const* b) { return (*a = strdup(*b)) != 0; } adt_hash_t adt_hashsp(const char* const* p) { return adt_hashs((const unsigned char*)*p); } void adt_freesp(const char** a) { free((char*)*a); } bglibs-1.106/adt/hashs.c0000664000076400007640000000031611147311327014352 0ustar bruceguenter#include #include #include "common.h" adt_hash_t adt_hashs(const unsigned char* data) { adt_hash_t h = 0x1505; while (*data != 0) h = (h + (h << 5)) ^ *data++; return h; } bglibs-1.106/adt/ghash_remove.c0000664000076400007640000000206511147311327015716 0ustar bruceguenter#include #include #include "ghash.h" /** Remove an entry from a \c ghash table. This function attempts to do * the minimum amount of rebuilding necessary to adjust the positions of * entries that may fall in the same slot as the newly removed entry. * * \returns True if the entry was found (and removed), false otherwise. */ int ghash_remove(struct ghash* d, const void* key) { void* entry; void** slot; unsigned i; /* First, locate the key in the hash table. */ if ((slot = ghash_find(d, key)) == 0) return 0; entry = *slot; /* Then free it, and empty out its slot. */ if (d->keyfree != 0) d->keyfree(ghash_entry_keyptr(entry)); if (d->datafree != 0) d->datafree(ghash_entry_dataptr(entry, d->keysize)); free(entry); *slot = 0; --d->count; /* Finally, make sure all subsequent entries are properly inserted. */ for (i = (slot - d->table + 1) % d->size; (entry = d->table[i]) != 0; i = (i + 1) % d->size) { --d->count; d->table[i] = 0; ghash_insert(d, entry); } return 1; } bglibs-1.106/adt/ghash_insert.c0000664000076400007640000000042111147311327015717 0ustar bruceguenter#include "ghash.h" /** Insert an entry into a \c ghash table, without resizing it. */ void ghash_insert(struct ghash* d, void* e) { unsigned i; i = ghash_entry_hash(e) % d->size; while (d->table[i] != 0) i = (i + 1) % d->size; d->table[i] = e; ++d->count; } bglibs-1.106/adt/gqueue_pop.c0000664000076400007640000000106711147311327015421 0ustar bruceguenter#include #include "gqueue.h" /** Remove the first (least recently pushed) element from the queue. If * the free function \c fn is \c NULL no data freeing is done. Note that * this does not return a pointer to the popped item, as once the item * has been popped it is also freed. */ void gqueue_pop(struct gqueue* q, adt_free_fn* fn) { if (q->head) { struct gqueue_node* head = q->head; if (fn != 0) fn(head->data); if ((q->head = head->next) == 0) q->tail = 0, q->count = 0; else --q->count; free(head); } } bglibs-1.106/adt/ghash_init.c0000664000076400007640000000103611147311327015361 0ustar bruceguenter#include "ghash.h" /** Initialize an empty \c ghash table. */ 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) { d->table = 0; d->count = 0; d->size = 0; d->keysize = keysize; d->entrysize = entrysize; d->hashfn = hashfn; d->keycmp = keycmp; d->keycopy = keycopy; d->datacopy = datacopy; d->keyfree = keyfree; d->datafree = datafree; } bglibs-1.106/adt/gstack.h0000664000076400007640000000432611147311327014532 0ustar bruceguenter#ifndef BGLIBS__GENERIC_STACK__H__ #define BGLIBS__GENERIC_STACK__H__ #include /** \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-1.106/adt/ghash_add.c0000664000076400007640000000610411147311327015147 0ustar bruceguenter#include #include #include "ghash.h" /** A list of prime numbers to use as sizes for hash tables. These * sizes were calculated as the largest prime less than each power of * two fro 2^5 to 2^32. 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. */ static const unsigned size_prime_list[] = { /* (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 int ghash_grow(struct ghash* d, unsigned count) { unsigned i; unsigned newsize; void** newtable; void** 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; if (oldtable) { for (i = 0; i < oldsize; i++) if (oldtable[i]) ghash_insert(d, oldtable[i]); free(oldtable); } return 1; } /** Add an entry into a generic hash table. This function adds a new * entry into the given hash table. If the table is too small to * provide sufficient slots for efficient access, the table is * automatically expanded to the next larger size and all the existing * entries are copied over. */ void* ghash_add(struct ghash* d, const void* key, const void* data) { const adt_hash_t hash = d->hashfn(key); void* newe; if (!ghash_grow(d, d->count + 1)) return 0; if ((newe = malloc(d->entrysize)) == 0) return 0; memset(newe, 0, d->entrysize); ghash_entry_hash(newe) = hash; if (d->keycopy == 0) memcpy(ghash_entry_keyptr(newe), key, d->keysize); else if (!d->keycopy(ghash_entry_keyptr(newe), key)) { free(newe); return 0; } if (d->datacopy == 0) memcpy(ghash_entry_dataptr(newe, d->keysize), data, d->entrysize - d->keysize - sizeof(adt_hash_t)); else if (!d->datacopy(ghash_entry_dataptr(newe, d->keysize), data)) { d->keyfree(ghash_entry_keyptr(newe)); free(newe); return 0; } ghash_insert(d, newe); return newe; } bglibs-1.106/adt/ghash_iter.c0000664000076400007640000000145311147311327015364 0ustar bruceguenter#include "ghash.h" static void next(struct ghashiter* iter, unsigned i) { if (iter->ghashp->table != 0) { while (i < iter->ghashp->size && iter->ghashp->table[i] == 0) ++i; iter->index = i; iter->entry = iter->ghashp->table[i]; } } /** Set a \c ghash iterator to the first element in the table. */ void ghashiter_first(struct ghashiter* iter, const struct ghash* h) { iter->ghashp = h; next(iter, 0); } /** Check if the \c ghash iterator is still valid. */ int ghashiter_valid(const struct ghashiter* iter) { return iter->ghashp->table != 0 && iter->index < iter->ghashp->size && iter->ghashp->table[iter->index] != 0; } /** Advance the \c ghash iterator to the next element in the table. */ void ghashiter_next(struct ghashiter* iter) { next(iter, iter->index + 1); } bglibs-1.106/adt/common.h0000664000076400007640000000311411147311327014540 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-1.106/adt/gqueue_top.c0000664000076400007640000000030311147311327015415 0ustar bruceguenter#include "gqueue.h" /** Return the address of first (least recently pushed) element in the * queue. */ void* gqueue_top(const struct gqueue* q) { return (q->head == 0) ? 0 : q->head->data; } bglibs-1.106/adt/ghash_foreach.c0000664000076400007640000000041711147311327016027 0ustar bruceguenter#include "ghash.h" /** Iterate over a \c ghash table, calling a function for each entry. */ void ghash_foreach(struct ghash* d, void (*fn)(void* entry)) { void** p; unsigned long i; for (i = 0, p = d->table; i < d->size; ++i, ++p) if (*p != 0) fn(*p); } bglibs-1.106/adt/gstack_push.c0000664000076400007640000000101711147311327015556 0ustar bruceguenter#include #include #include "gstack.h" /** Add a new element onto the stack. If the copy function \c fn is \c * NULL memcpy is used in its place. */ int gstack_push(struct gstack* s, unsigned datasize, const void* data, adt_copy_fn* fn) { struct gstack_node* n; if ((n = malloc(datasize + sizeof *n)) == 0) return 0; if (fn == 0) memcpy(n->data, data, datasize); else if (!fn(n->data, data)) { free(n); return 0; } n->next = s->head; s->head = n; ++s->count; return 1; } bglibs-1.106/adt/ghash.h0000664000076400007640000002142311147311327014345 0ustar bruceguenter#ifndef BGLIBS__GENERIC_HASH__H__ #define BGLIBS__GENERIC_HASH__H__ #include /** \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-1.106/adt/ghash_search.c0000664000076400007640000000051511147311327015664 0ustar bruceguenter#include "ghash.h" /** Search for the first entry in the \c ghash table for which the given * function returns true. */ void* ghash_search(struct ghash* d, int (*fn)(const void* entry)) { void** p; unsigned long i; for (i = 0, p = d->table; i < d->size; ++i, ++p) if (*p != 0) if (fn(*p)) return *p; return 0; } bglibs-1.106/VERSION0000664000076400007640000000001511147311327013374 0ustar bruceguenterbglibs 1.106 bglibs-1.106/vmailmgr/0000755000076400007640000000000011147311330014136 5ustar bruceguenterbglibs-1.106/vmailmgr/vpwentry.h0000664000076400007640000000115411147311330016210 0ustar bruceguenter#ifndef VMAILMGR__VPWENTRY__H__ #define VMAILMGR__VPWENTRY__H__ #include "str/str.h" 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-1.106/vmailmgr/req_arg.c0000664000076400007640000000053311147311330015725 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-1.106/vmailmgr/req_write.c0000664000076400007640000000107111147311330016304 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-1.106/vmailmgr/client.h0000664000076400007640000000101611147311330015565 0ustar bruceguenter#ifndef VMAILMGR__CLIENT__H__ #define VMAILMGR__CLIENT__H__ #include "str/str.h" #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-1.106/vmailmgr/resp_read.c0000664000076400007640000000105111147311330016245 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-1.106/vmailmgr/vpwentry_import.c0000664000076400007640000001016511147311330017577 0ustar bruceguenter#include #include #include #include "systime.h" #include "misc/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-1.106/vmailmgr/req_init.c0000664000076400007640000000036611147311330016123 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-1.106/vmailmgr/vpwentry_free.c0000664000076400007640000000036511147311330017207 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-1.106/vmailmgr/vpwentry_export.c0000664000076400007640000000222611147311330017605 0ustar bruceguenter#include "vpwentry.h" #include "str/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-1.106/sys/0000755000076400007640000000000011147311330013136 5ustar bruceguenterbglibs-1.106/sys/tryclockgettime.c0000664000076400007640000000016111147311330016513 0ustar bruceguenter#include "systime.h" int main(void) { struct timespec ts; return clock_gettime(CLOCK_REALTIME, &ts) != 0; } bglibs-1.106/sys/hasdirentino.h10000664000076400007640000000006211147311330016057 0ustar bruceguenter/* sysdep: +dirent_ino */ #define HASDIRENTINO 1 bglibs-1.106/sys/trysetenv.c0000664000076400007640000000011311147311330015342 0ustar bruceguenter#include int main() { setenv("FOO", "bar", 1); return 0; } bglibs-1.106/sys/hasdaylight.h10000664000076400007640000000010311147311330015665 0ustar bruceguenter/* sysdep: +daylight */ #define HASDAYLIGHT 1 extern int daylight; bglibs-1.106/sys/trydeprecated.c0000664000076400007640000000005411147311330016142 0ustar bruceguenterint symbol __attribute__((__deprecated__)); bglibs-1.106/sys/getpeereid.c0000664000076400007640000000076711147311330015433 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; s = 0; u = 0; g = 0; #endif } #endif /* HASGETPEEREID */ bglibs-1.106/sys/hastimespec.h00000664000076400007640000000016211147311330015675 0ustar bruceguenter/* sysdep: -timespec */ struct timespec { time_t tv_sec; /* seconds */ long tv_nsec; /* nanoseconds */ }; bglibs-1.106/sys/hasspnam.h10000664000076400007640000000005311147311330015202 0ustar bruceguenter/* sysdep: +hasspnam */ #define HASSPNAM 1 bglibs-1.106/sys/hasdl.h10000664000076400007640000000004511147311330014464 0ustar bruceguenter/* sysdep: +hasdl */ #define HASDL 1 bglibs-1.106/sys/haszlib.h10000664000076400007640000000005111147311330015022 0ustar bruceguenter/* sysdep: +haszlib */ #define HASZLIB 1 bglibs-1.106/sys/hasattribute.h00000664000076400007640000000006511147311330016071 0ustar bruceguenter/* sysdep: -hasattribute */ #define __attribute__(X) bglibs-1.106/sys/trypoll.c0000664000076400007640000000042311147311330015010 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-1.106/sys/hassendfile.h10000664000076400007640000000007111147311330015655 0ustar bruceguenter/* sysdep: +linux_sendfile */ #define HASLINUXSENDFILE 1 bglibs-1.106/sys/tryspnam.c0000664000076400007640000000014611147311330015162 0ustar bruceguenter#include void main() { struct spwd *spw; spw = getspnam(""); puts(spw->sp_pwdp); } bglibs-1.106/sys/hasinline.h00000664000076400007640000000003211147311330015336 0ustar bruceguenter/* sysdep: -hasinline */ bglibs-1.106/sys/tryulong32.c0000664000076400007640000000052411147311330015335 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-1.106/sys/hasdirenttype.h10000664000076400007640000000006411147311330016255 0ustar bruceguenter/* sysdep: +dirent_type */ #define HASDIRENTTYPE 1 bglibs-1.106/sys/hasspnam.h00000664000076400007640000000003111147311330015175 0ustar bruceguenter/* sysdep: -hasspnam */ bglibs-1.106/sys/hasdirentino.h00000664000076400007640000000005611147311330016061 0ustar bruceguenter/* sysdep: -dirent_ino */ #undef HASDIRENTINO bglibs-1.106/sys/hasdirenttype.h00000664000076400007640000000006011147311330016250 0ustar bruceguenter/* sysdep: -dirent_type */ #undef HASDIRENTTYPE bglibs-1.106/sys/hasendian.h10000664000076400007640000000010011147311330015313 0ustar bruceguenter/* sysdep: endian=msb */ #undef ENDIAN_LSB #define ENDIAN_MSB 1 bglibs-1.106/sys/hasnamedpipebug.h10000664000076400007640000000007111147311330016524 0ustar bruceguenter/* sysdep: +hasnamedpipebug */ #define HASNAMEDPIPEBUG 1 bglibs-1.106/sys/trydirenttype.c0000664000076400007640000000013411147311330016230 0ustar bruceguenter#include #include void foo() { struct dirent *d; d->d_type; } bglibs-1.106/sys/trydirent.c0000664000076400007640000000013311147311330015325 0ustar bruceguenter#include #include void foo() { DIR *dir; struct dirent *d; } bglibs-1.106/sys/hasinline.h10000664000076400007640000000005311147311330015342 0ustar bruceguenter/* sysdep: +hasinline */ #define HASINLINE bglibs-1.106/sys/haspeercred.h10000664000076400007640000000011211147311330015651 0ustar bruceguenter/* sysdep: +struct ucred */ #define HASPEERCRED 1 #include bglibs-1.106/sys/tryunaligned.c0000664000076400007640000000111711147311330016011 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-1.106/sys/trysigprocmask.c0000664000076400007640000000021611147311330016364 0ustar bruceguenter#include main() { sigset_t ss; sigemptyset(&ss); sigaddset(&ss,SIGCHLD); sigprocmask(SIG_SETMASK,&ss,(sigset_t *) 0); } bglibs-1.106/sys/hasulong64.h00000664000076400007640000000011511147311330015360 0ustar bruceguenter/* sysdep: -ulong64 */ #undef HAS_ULONG64 typedef unsigned long long uint64; bglibs-1.106/sys/hasunsetenv.h10000664000076400007640000000005611147311330015736 0ustar bruceguenter/* sysdep: +unsetenv */ #define HASUNSETENV 1 bglibs-1.106/sys/trysigaction.c0000664000076400007640000000025311147311330016023 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-1.106/sys/trysystime.c0000664000076400007640000000002611147311330015536 0ustar bruceguenter#include bglibs-1.106/sys/hastimespec.h10000664000076400007640000000005611147311330015700 0ustar bruceguenter/* sysdep: +timespec */ #define HASTIMESPEC 1 bglibs-1.106/sys/tryunsetenv.c0000664000076400007640000000007511147311330015714 0ustar bruceguenter#include void main(void) { unsetenv("PATH"); } bglibs-1.106/sys/haspeercred.h00000664000076400007640000000003411147311330015653 0ustar bruceguenter/* sysdep: -struct ucred */ bglibs-1.106/sys/haswaitp.h10000664000076400007640000000005411147311330015211 0ustar bruceguenter/* sysdep: +waitpid */ #define HASWAITPID 1 bglibs-1.106/sys/hassysselect.h00000664000076400007640000000016011147311330016100 0ustar bruceguenter#ifndef SELECT_H #define SELECT_H /* sysdep: -sysselect */ #include extern int select(); #endif bglibs-1.106/sys/trydaylight.c0000664000076400007640000000007211147311330015647 0ustar bruceguenterextern int daylight; int main(void) { return daylight; } bglibs-1.106/sys/unsetenv.c0000664000076400007640000000054611147311330015160 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-1.106/sys/hasuserpw.h10000664000076400007640000000005511147311330015413 0ustar bruceguenter/* sysdep: +hasuserpw */ #define HASUSERPW 1 bglibs-1.106/sys/hasvfork.h00000664000076400007640000000014411147311330015213 0ustar bruceguenter#ifndef FORK_H #define FORK_H /* sysdep: -vfork */ extern pid_t fork(); #define vfork fork #endif bglibs-1.106/sys/setenv.c0000664000076400007640000000073411147311330014614 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-1.106/sys/hasflock.h10000664000076400007640000000005411147311330015163 0ustar bruceguenter/* sysdep: +hasflock */ #define HASFLOCK 1 bglibs-1.106/sys/iopoll.c0000664000076400007640000000224311147311330014603 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-1.106/sys/hasendian.h00000664000076400007640000000010011147311330015312 0ustar bruceguenter/* sysdep: endian=lsb */ #define ENDIAN_LSB 1 #undef ENDIAN_MSB bglibs-1.106/sys/hasclockgettime.h10000664000076400007640000000006711147311330016543 0ustar bruceguenter/* sysdep: +clock_gettime */ #define HASCLOCKGETTIME 1 bglibs-1.106/sys/hassysselect.h10000664000076400007640000000021011147311330016075 0ustar bruceguenter#ifndef SELECT_H #define SELECT_H /* sysdep: +sysselect */ #include #include extern int select(); #endif bglibs-1.106/sys/haswaitp.h00000664000076400007640000000002711147311330015210 0ustar bruceguenter/* sysdep: -waitpid */ bglibs-1.106/sys/trysendfile.c0000664000076400007640000000022111147311330015627 0ustar bruceguenter#include #include #include void main(void) { int x; x = __NR_sendfile; sendfile(0, 1, 0, 0); } bglibs-1.106/sys/hasmkfifo.h00000664000076400007640000000003211147311330015333 0ustar bruceguenter/* sysdep: -hasmkfifo */ bglibs-1.106/sys/hasunaligned.h10000664000076400007640000000007211147311330016033 0ustar bruceguenter/* sysdep: +unaligned */ #define HAS_UNALIGNED_ACCESSES 1 bglibs-1.106/sys/hasgetpeereid.h00000664000076400007640000000011411147311330016176 0ustar bruceguenter/* sysdep: -getpeereid */ extern int getpeereid(int s, uid_t* u, gid_t* g); bglibs-1.106/sys/hassetenv.h10000664000076400007640000000007611147311330015375 0ustar bruceguenter/* sysdep: +setenv */ #define HASSETENV 1 #include bglibs-1.106/sys/hasulong32.h00000664000076400007640000000006411147311330015356 0ustar bruceguenter/* sysdep: -ulong32 */ typedef unsigned int uint32; bglibs-1.106/sys/trysysselect.c0000664000076400007640000000015611147311330016063 0ustar bruceguenter#include #include #include /* SVR4 silliness */ void foo() { ; } bglibs-1.106/sys/clock_gettime.c0000664000076400007640000000050611147311330016116 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-1.106/sys/hasdeprecated.h10000664000076400007640000000012411147311330016163 0ustar bruceguenter/* sysdep: +hasdeprecated */ #define __DEPRECATED__ __attribute__((__deprecated__)) bglibs-1.106/sys/hasulong64.h10000664000076400007640000000011311147311330015357 0ustar bruceguenter/* sysdep: +ulong64 */ #define HAS_ULONG64 1 typedef unsigned long uint64; bglibs-1.106/sys/trypeercred.c0000664000076400007640000000026711147311330015641 0ustar bruceguenter#include #include int main() { struct ucred peer; int optlen = sizeof(peer); getsockopt(0, SOL_SOCKET, SO_PEERCRED, &peer, &optlen); return 0; } bglibs-1.106/sys/hasipv6.h00000664000076400007640000000002711147311330014750 0ustar bruceguenter/* sysdep: -hasipv6 */ bglibs-1.106/sys/hasnamedpipebug.h00000664000076400007640000000004011147311330016517 0ustar bruceguenter/* sysdep: -hasnamedpipebug */ bglibs-1.106/sys/haspoll.h00000664000076400007640000000047511147311330015041 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-1.106/sys/hasgetpeereid.h10000664000076400007640000000006211147311330016201 0ustar bruceguenter/* sysdep: +getpeereid */ #define HASGETPEEREID 1 bglibs-1.106/sys/hasattribute.h10000664000076400007640000000003411147311330016066 0ustar bruceguenter/* sysdep: +hasattribute */ bglibs-1.106/sys/hasclockgettime.h00000664000076400007640000000037511147311330016544 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-1.106/sys/tryzlib.c0000664000076400007640000000010311147311330014775 0ustar bruceguenter#include "zlib.h" int main(void) { z_stream test; return 0; } bglibs-1.106/sys/hasunsetenv.h00000664000076400007640000000011511147311330015731 0ustar bruceguenter/* sysdep: -unsetenv */ #undef HASUNSETENV void unsetenv(const char* name); bglibs-1.106/sys/trynamedpipebug.c0000664000076400007640000000072411147311330016506 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-1.106/sys/tryattribute.c0000664000076400007640000000004711147311330016047 0ustar bruceguenterint symbol __attribute__((__const__)); bglibs-1.106/sys/hassigprocmask.h10000664000076400007640000000006411147311330016410 0ustar bruceguenter/* sysdep: +sigprocmask */ #define HASSIGPROCMASK 1 bglibs-1.106/sys/hasdirent.h10000664000076400007640000000021611147311330015352 0ustar bruceguenter#ifndef DIRENTRY_H #define DIRENTRY_H /* sysdep: -direct */ /* sysdep: +dirent */ #include #define direntry struct dirent #endif bglibs-1.106/sys/hasipv6.h10000664000076400007640000000005111147311330014746 0ustar bruceguenter/* sysdep: +hasipv6 */ #define HASIPV6 1 bglibs-1.106/sys/trytime.c0000664000076400007640000000002211147311330014773 0ustar bruceguenter#include bglibs-1.106/sys/hasvfork.h10000664000076400007640000000014711147311330015217 0ustar bruceguenter#ifndef FORK_H #define FORK_H /* sysdep: +vfork */ extern pid_t fork(); extern pid_t vfork(); #endif bglibs-1.106/sys/hasdirent.h00000664000076400007640000000021711147311330015352 0ustar bruceguenter#ifndef DIRENTRY_H #define DIRENTRY_H /* sysdep: +direct */ /* sysdep: -dirent */ #include #define direntry struct direct #endif bglibs-1.106/sys/tryuserpw.c0000664000076400007640000000015411147311330015370 0ustar bruceguenter#include void main() { struct userpw *upw; upw = getuserpw(""); puts(upw->upw_passwd); } bglibs-1.106/sys/hassigaction.h00000664000076400007640000000003111147311330016037 0ustar bruceguenter/* sysdep: -sigaction */ bglibs-1.106/sys/haszlib.h00000664000076400007640000000002711147311330015024 0ustar bruceguenter/* sysdep: -haszlib */ bglibs-1.106/sys/trywaitp.c0000664000076400007640000000012011147311330015160 0ustar bruceguenter#include #include void main() { waitpid(0,0,0); } bglibs-1.106/sys/tryendian.c0000664000076400007640000000006711147311330015304 0ustar bruceguenterint main(void) { int x = 1; return *((char*)&x); } bglibs-1.106/sys/hasunaligned.h00000664000076400007640000000006711147311330016036 0ustar bruceguenter/* sysdep: -unaligned */ #undef HAS_UNALIGNED_ACCESSES bglibs-1.106/sys/trydl.c0000664000076400007640000000023211147311330014437 0ustar bruceguenter#include int main(void) { void* handle; handle = dlopen("filename", 0); dlsym(handle, "symbol"); dlclose(handle); dlerror(); return 0; } bglibs-1.106/sys/hasulong32.h10000664000076400007640000000006511147311330015360 0ustar bruceguenter/* sysdep: +ulong32 */ typedef unsigned long uint32; bglibs-1.106/sys/haspoll.h10000664000076400007640000000037311147311330015037 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-1.106/sys/hassendfile.h00000664000076400007640000000003611147311330015655 0ustar bruceguenter/* sysdep: -linux_sendfile */ bglibs-1.106/sys/hasflock.h00000664000076400007640000000003111147311330015155 0ustar bruceguenter/* sysdep: -hasflock */ bglibs-1.106/sys/hasmkfifo.h10000664000076400007640000000005511147311330015341 0ustar bruceguenter/* sysdep: +hasmkfifo */ #define HASMKFIFO 1 bglibs-1.106/sys/hassetenv.h00000664000076400007640000000012611147311330015370 0ustar bruceguenter/* sysdep: -setenv */ int setenv(const char* name, const char* value, int overwrite); bglibs-1.106/sys/hasdeprecated.h00000664000076400007640000000006411147311330016165 0ustar bruceguenter/* sysdep: -hasdeprecated */ #define __DEPRECATED__ bglibs-1.106/sys/tryipv6.c0000664000076400007640000000023611147311330014730 0ustar bruceguenter#include #include #include int main(void) { struct sockaddr_in6 sa; sa.sin6_family = AF_INET6; return 0; } bglibs-1.106/sys/hassigprocmask.h00000664000076400007640000000003311147311330016403 0ustar bruceguenter/* sysdep: -sigprocmask */ bglibs-1.106/sys/hassigaction.h10000664000076400007640000000006011147311330016042 0ustar bruceguenter/* sysdep: +sigaction */ #define HASSIGACTION 1 bglibs-1.106/sys/hasdl.h00000664000076400007640000000002511147311330014461 0ustar bruceguenter/* sysdep: -hasdl */ bglibs-1.106/sys/tryvfork.c0000664000076400007640000000003311147311330015166 0ustar bruceguentervoid main() { vfork(); } bglibs-1.106/sys/tryflock.c0000664000076400007640000000017111147311330015140 0ustar bruceguenter#include #include #include void main() { flock(0,LOCK_EX | LOCK_UN | LOCK_NB); } bglibs-1.106/sys/tryulong64.c0000664000076400007640000000051711147311330015344 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-1.106/sys/trydirentino.c0000664000076400007640000000013311147311330016033 0ustar bruceguenter#include #include void foo() { struct dirent *d; d->d_ino; } bglibs-1.106/sys/tryinline.c0000664000076400007640000000010311147311330015313 0ustar bruceguenterinline int foo(void) { return 1; } int bar(void) { return foo(); } bglibs-1.106/sys/hasuserpw.h00000664000076400007640000000003211147311330015405 0ustar bruceguenter/* sysdep: -hasuserpw */ bglibs-1.106/sys/trygetpeereid.c0000664000076400007640000000011411147311330016154 0ustar bruceguenter#include #include void main() { getpeereid(); } bglibs-1.106/sys/trytimespec.c0000664000076400007640000000005211147311330015651 0ustar bruceguenter#include "systime.h" struct timespec ts; bglibs-1.106/sys/hasdaylight.h00000664000076400007640000000005311147311330015670 0ustar bruceguenter/* sysdep: -daylight */ #define daylight 1 bglibs-1.106/sys/trymkfifo.c0000664000076400007640000000013111147311330015311 0ustar bruceguenter#include #include int main(void) { mkfifo("nothing", 0); } bglibs-1.106/sysdeps-tail.h0000664000076400007640000000001011147311330015103 0ustar bruceguenter #endif bglibs-1.106/Makefile0000664000076400007640000025267511147311327014011 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 adt/common.h ./ltcompile adt/adt_sp.c adt/ghash_add.lo adt/ghash_add.o: ltcompile adt/ghash_add.c adt/ghash.h adt/common.h ./ltcompile adt/ghash_add.c adt/ghash_foreach.lo adt/ghash_foreach.o: ltcompile adt/ghash_foreach.c adt/ghash.h adt/common.h ./ltcompile adt/ghash_foreach.c adt/ghash_free.lo adt/ghash_free.o: ltcompile adt/ghash_free.c adt/ghash.h adt/common.h ./ltcompile adt/ghash_free.c adt/ghash_get.lo adt/ghash_get.o: ltcompile adt/ghash_get.c adt/ghash.h adt/common.h ./ltcompile adt/ghash_get.c adt/ghash_init.lo adt/ghash_init.o: ltcompile adt/ghash_init.c adt/ghash.h adt/common.h ./ltcompile adt/ghash_init.c adt/ghash_insert.lo adt/ghash_insert.o: ltcompile adt/ghash_insert.c adt/ghash.h adt/common.h ./ltcompile adt/ghash_insert.c adt/ghash_iter.lo adt/ghash_iter.o: ltcompile adt/ghash_iter.c adt/ghash.h adt/common.h ./ltcompile adt/ghash_iter.c adt/ghash_rebuild.lo adt/ghash_rebuild.o: ltcompile adt/ghash_rebuild.c adt/ghash.h adt/common.h ./ltcompile adt/ghash_rebuild.c adt/ghash_rehash.lo adt/ghash_rehash.o: ltcompile adt/ghash_rehash.c adt/ghash.h adt/common.h ./ltcompile adt/ghash_rehash.c adt/ghash_remove.lo adt/ghash_remove.o: ltcompile adt/ghash_remove.c adt/ghash.h adt/common.h ./ltcompile adt/ghash_remove.c adt/ghash_search.lo adt/ghash_search.o: ltcompile adt/ghash_search.c adt/ghash.h adt/common.h ./ltcompile adt/ghash_search.c adt/ghash_set.lo adt/ghash_set.o: ltcompile adt/ghash_set.c adt/ghash.h adt/common.h ./ltcompile adt/ghash_set.c adt/gqueue_pop.lo adt/gqueue_pop.o: ltcompile adt/gqueue_pop.c adt/gqueue.h adt/common.h ./ltcompile adt/gqueue_pop.c adt/gqueue_push.lo adt/gqueue_push.o: ltcompile adt/gqueue_push.c adt/gqueue.h adt/common.h ./ltcompile adt/gqueue_push.c adt/gqueue_top.lo adt/gqueue_top.o: ltcompile adt/gqueue_top.c adt/gqueue.h adt/common.h ./ltcompile adt/gqueue_top.c adt/gstack_pop.lo adt/gstack_pop.o: ltcompile adt/gstack_pop.c adt/gstack.h adt/common.h ./ltcompile adt/gstack_pop.c adt/gstack_push.lo adt/gstack_push.o: ltcompile adt/gstack_push.c adt/gstack.h adt/common.h ./ltcompile adt/gstack_push.c adt/gstack_top.lo adt/gstack_top.o: ltcompile adt/gstack_top.c adt/gstack.h adt/common.h ./ltcompile adt/gstack_top.c adt/hashb.lo adt/hashb.o: ltcompile adt/hashb.c adt/common.h ./ltcompile adt/hashb.c adt/hashs.lo adt/hashs.o: ltcompile adt/hashs.c adt/common.h ./ltcompile adt/hashs.c all: dotlibs sysdeps.h libraries bg-installer cli-generate selftests base64/asc2bin.lo base64/asc2bin.o: ltcompile base64/asc2bin.c base64/base64.h str/str.h ./ltcompile base64/asc2bin.c base64/bin2asc.lo base64/bin2asc.o: ltcompile base64/bin2asc.c base64/base64.h str/str.h ./ltcompile base64/bin2asc.c base64/decode_line.lo base64/decode_line.o: ltcompile base64/decode_line.c base64/base64.h str/str.h ./ltcompile base64/decode_line.c base64/decode_part.lo base64/decode_part.o: ltcompile base64/decode_part.c base64/base64.h str/str.h ./ltcompile base64/decode_part.c base64/encode_line.lo base64/encode_line.o: ltcompile base64/encode_line.c base64/base64.h str/str.h ./ltcompile base64/encode_line.c base64/encode_part.lo base64/encode_part.o: ltcompile base64/encode_part.c base64/base64.h str/str.h ./ltcompile base64/encode_part.c bg-installer: bg-installer.o ltload libbg-cli.la libbg-msg.la libbg-path.la libbg-iobuf.la libbg-fmt.la libbg-str.la libbg-sysdeps.la ./ltload bg-installer libbg-cli.la libbg-msg.la libbg-path.la libbg-iobuf.la libbg-fmt.la libbg-str.la libbg-sysdeps.la -static bg-installer.o: compile bg-installer.c sysdeps.h cli/cli.h fmt/number.h iobuf/ibuf.h iobuf/common.h iobuf/obuf.h iobuf/iobuf.h msg/msg.h msg/debug.h msg/wrap.h path/path.h str/str.h ./compile bg-installer.c cdb/cdb.lo cdb/cdb.o: ltcompile cdb/cdb.c cdb/cdb.h sysdeps.h ./ltcompile cdb/cdb.c cdb/cdbhash.lo cdb/cdbhash.o: ltcompile cdb/cdbhash.c cdb/cdb.h sysdeps.h ./ltcompile cdb/cdbhash.c cdb/find.lo cdb/find.o: ltcompile cdb/find.c cdb/cdb.h sysdeps.h uint32.h sysdeps.h uintnn.h ./ltcompile cdb/find.c cdb/get.lo cdb/get.o: ltcompile cdb/get.c cdb/cdb.h sysdeps.h cdb/str.h str/str.h ./ltcompile cdb/get.c cdb/getnext.lo cdb/getnext.o: ltcompile cdb/getnext.c cdb/cdb.h sysdeps.h cdb/str.h str/str.h ./ltcompile cdb/getnext.c cdb/make.lo cdb/make.o: ltcompile cdb/make.c cdb/cdb.h sysdeps.h cdb/make.h iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h sysdeps.h uint32.h sysdeps.h uintnn.h ./ltcompile cdb/make.c cdb/read.lo cdb/read.o: ltcompile cdb/read.c cdb/cdb.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 iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h systime.h cli/cli.h cli/internal.h ./ltcompile cli/help.c cli/main.lo cli/main.o: ltcompile cli/main.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h systime.h cli/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. '-o $${base}.o -c $$source $${1+"$$@"}'; \ ) >compile chmod 755 compile crc-gentab: crc-gentab.o ltload libbg-msg.la libbg-iobuf.la libbg-sysdeps.la ./ltload crc-gentab libbg-msg.la libbg-iobuf.la libbg-sysdeps.la -static crc-gentab.o: compile crc-gentab.c sysdeps.h iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/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 crc/gcrc.h sysdeps.h crc/crc16_ccitt.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h str/str.h ./ltcompile crc/gcrc16fwd.c crc/gcrc16rfl.lo crc/gcrc16rfl.o: ltcompile crc/gcrc16rfl.c crc/gcrc.h sysdeps.h crc/crc16_arc.h crc/crc16_xmodem.h uint16.h sysdeps.h uintnn.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h str/str.h ./ltcompile crc/gcrc16rfl.c crc/gcrc32fwd.lo crc/gcrc32fwd.o: ltcompile crc/gcrc32fwd.c crc/gcrc.h sysdeps.h ./ltcompile crc/gcrc32fwd.c crc/gcrc32rfl.lo crc/gcrc32rfl.o: ltcompile crc/gcrc32rfl.c crc/gcrc.h sysdeps.h crc/crc32.h uint32.h sysdeps.h uintnn.h crc/crc32c.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h str/str.h ./ltcompile crc/gcrc32rfl.c crc/gcrc64fwd.lo crc/gcrc64fwd.o: ltcompile crc/gcrc64fwd.c crc/gcrc.h sysdeps.h crc/crc64.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h str/str.h ./ltcompile crc/gcrc64fwd.c crc/gcrc64rfl.lo crc/gcrc64rfl.o: ltcompile crc/gcrc64rfl.c crc/gcrc.h sysdeps.h ./ltcompile crc/gcrc64rfl.c crypt.lib: compile load @echo -n 'Checking for -lcrypt: ' @echo 'main() { ; }' >trylib-lcrypt.c @{ ./compile trylib-lcrypt.c && ./load trylib-lcrypt -lcrypt; } >/dev/null 2>&1 \ && { echo -lcrypt >crypt.lib; echo yes; } \ || { echo -n >crypt.lib; echo no; } @rm -f trylib-lcrypt.c trylib-lcrypt.o trylib-lcrypt crypto/hmac-md5.lo crypto/hmac-md5.o: ltcompile crypto/hmac-md5.c sysdeps.h crypto/hmac.h crypto/md5.h str/str.h ./ltcompile crypto/hmac-md5.c crypto/hmac-sha1.lo crypto/hmac-sha1.o: ltcompile crypto/hmac-sha1.c sysdeps.h crypto/hmac.h crypto/sha1.h sysdeps.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h str/str.h ./ltcompile crypto/hmac-sha1.c crypto/hmac-sha256.lo crypto/hmac-sha256.o: ltcompile crypto/hmac-sha256.c crypto/hmac.h crypto/sha256.h sysdeps.h iobuf/obuf.h iobuf/common.h str/str.h ./ltcompile crypto/hmac-sha256.c crypto/hmac-sha384.lo crypto/hmac-sha384.o: ltcompile crypto/hmac-sha384.c sysdeps.h crypto/hmac.h crypto/sha384.h sysdeps.h crypto/sha512.h sysdeps.h iobuf/obuf.h iobuf/common.h str/str.h ./ltcompile crypto/hmac-sha384.c crypto/hmac-sha512.lo crypto/hmac-sha512.o: ltcompile crypto/hmac-sha512.c sysdeps.h crypto/hmac.h crypto/sha512.h sysdeps.h iobuf/obuf.h iobuf/common.h str/str.h ./ltcompile crypto/hmac-sha512.c crypto/hmac.lo crypto/hmac.o: ltcompile crypto/hmac.c sysdeps.h str/str.h crypto/hmac.h ./ltcompile crypto/hmac.c crypto/md4.lo crypto/md4.o: ltcompile crypto/md4.c sysdeps.h crypto/md4.h ./ltcompile crypto/md4.c crypto/md5-crypt.lo crypto/md5-crypt.o: ltcompile crypto/md5-crypt.c crypto/md5.h ./ltcompile crypto/md5-crypt.c crypto/md5.lo crypto/md5.o: ltcompile crypto/md5.c sysdeps.h crypto/md5.h str/str.h ./ltcompile crypto/md5.c crypto/sha1.lo crypto/sha1.o: ltcompile crypto/sha1.c crypto/sha1.h sysdeps.h uint32.h sysdeps.h uintnn.h uint64.h sysdeps.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h str/str.h ./ltcompile crypto/sha1.c crypto/sha256.lo crypto/sha256.o: ltcompile crypto/sha256.c crypto/sha256.h sysdeps.h uint32.h sysdeps.h uintnn.h uint64.h sysdeps.h iobuf/obuf.h iobuf/common.h str/str.h ./ltcompile crypto/sha256.c crypto/sha384.lo crypto/sha384.o: ltcompile crypto/sha384.c sysdeps.h crypto/sha384.h sysdeps.h crypto/sha512.h sysdeps.h uint64.h sysdeps.h uintnn.h iobuf/obuf.h iobuf/common.h str/str.h ./ltcompile crypto/sha384.c crypto/sha512.lo crypto/sha512.o: ltcompile crypto/sha512.c sysdeps.h crypto/sha512.h sysdeps.h uint64.h sysdeps.h uintnn.h iobuf/obuf.h iobuf/common.h str/str.h ./ltcompile crypto/sha512.c crypto/surf.lo crypto/surf.o: ltcompile crypto/surf.c crypto/surf.h uint32.h sysdeps.h uintnn.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h str/str.h ./ltcompile crypto/surf.c crypto/surfrand.lo crypto/surfrand.o: ltcompile crypto/surfrand.c crypto/surfrand.h crypto/surf.h uint32.h sysdeps.h uintnn.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h str/str.h ./ltcompile crypto/surfrand.c dict/add.lo dict/add.o: ltcompile dict/add.c dict/dict.h str/str.h uint32.h sysdeps.h uintnn.h ./ltcompile dict/add.c dict/dicthash.lo dict/dicthash.o: ltcompile dict/dicthash.c dict/dict.h str/str.h uint32.h sysdeps.h uintnn.h ./ltcompile dict/dicthash.c dict/foreach.lo dict/foreach.o: ltcompile dict/foreach.c dict/dict.h str/str.h uint32.h sysdeps.h uintnn.h ./ltcompile dict/foreach.c dict/free.lo dict/free.o: ltcompile dict/free.c dict/dict.h str/str.h uint32.h sysdeps.h uintnn.h ./ltcompile dict/free.c dict/get.lo dict/get.o: ltcompile dict/get.c dict/dict.h str/str.h uint32.h sysdeps.h uintnn.h ./ltcompile dict/get.c dict/init.lo dict/init.o: ltcompile dict/init.c dict/dict.h str/str.h uint32.h sysdeps.h uintnn.h ./ltcompile dict/init.c dict/load_list.lo dict/load_list.o: ltcompile dict/load_list.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h str/str.h dict/dict.h uint32.h sysdeps.h uintnn.h dict/load.h ./ltcompile dict/load_list.c dict/load_map.lo dict/load_map.o: ltcompile dict/load_map.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h str/str.h dict/dict.h uint32.h sysdeps.h uintnn.h dict/load.h ./ltcompile dict/load_map.c dict/str_free.lo dict/str_free.o: ltcompile dict/str_free.c str/str.h dict/dict.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 -n >dl.lib; echo no; } @rm -f trylib-ldl.c trylib-ldl.o trylib-ldl dotlibs: crypt.lib dl.lib m.lib net.lib rt.lib s.lib shadow.lib socket.lib fmt/char.lo fmt/char.o: ltcompile fmt/char.c fmt/misc.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h str/str.h ./ltcompile fmt/char.c fmt/chars.lo fmt/chars.o: ltcompile fmt/chars.c str/str.h fmt/misc.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile fmt/chars.c fmt/lcase.lo fmt/lcase.o: ltcompile fmt/lcase.c fmt/number.h ./ltcompile fmt/lcase.c fmt/multi.lo fmt/multi.o: ltcompile fmt/multi.c fmt/misc.h fmt/multi.h fmt/number.h str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile fmt/multi.c fmt/pad.lo fmt/pad.o: ltcompile fmt/pad.c fmt/number.h ./ltcompile fmt/pad.c fmt/sdec.lo fmt/sdec.o: ltcompile fmt/sdec.c fmt/number.h ./ltcompile fmt/sdec.c fmt/sign_pad.lo fmt/sign_pad.o: ltcompile fmt/sign_pad.c fmt/number.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h str/str.h ./ltcompile fmt/sign_pad.c fmt/slldec.lo fmt/slldec.o: ltcompile fmt/slldec.c fmt/number.h ./ltcompile fmt/slldec.c fmt/sllnum.lo fmt/sllnum.o: ltcompile fmt/sllnum.c fmt/number.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h str/str.h ./ltcompile fmt/sllnum.c fmt/snum.lo fmt/snum.o: ltcompile fmt/snum.c fmt/number.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h str/str.h ./ltcompile fmt/snum.c fmt/ucase.lo fmt/ucase.o: ltcompile fmt/ucase.c fmt/number.h ./ltcompile fmt/ucase.c fmt/udec.lo fmt/udec.o: ltcompile fmt/udec.c fmt/number.h ./ltcompile fmt/udec.c fmt/uhexl.lo fmt/uhexl.o: ltcompile fmt/uhexl.c fmt/number.h ./ltcompile fmt/uhexl.c fmt/uhexu.lo fmt/uhexu.o: ltcompile fmt/uhexu.c fmt/number.h ./ltcompile fmt/uhexu.c fmt/ulldec.lo fmt/ulldec.o: ltcompile fmt/ulldec.c fmt/number.h ./ltcompile fmt/ulldec.c fmt/ullhexl.lo fmt/ullhexl.o: ltcompile fmt/ullhexl.c fmt/number.h ./ltcompile fmt/ullhexl.c fmt/ullhexu.lo fmt/ullhexu.o: ltcompile fmt/ullhexu.c fmt/number.h ./ltcompile fmt/ullhexu.c fmt/ullnum.lo fmt/ullnum.o: ltcompile fmt/ullnum.c fmt/number.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h str/str.h ./ltcompile fmt/ullnum.c fmt/unum.lo fmt/unum.o: ltcompile fmt/unum.c fmt/number.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h str/str.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. '-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 m.lib: compile load @echo -n 'Checking for -lm: ' @echo 'main() { ; }' >trylib-lm.c @{ ./compile trylib-lm.c && ./load trylib-lm -lm; } >/dev/null 2>&1 \ && { echo -lm >m.lib; echo yes; } \ || { echo -n >m.lib; echo no; } @rm -f trylib-lm.c trylib-lm.o trylib-lm 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 misc/random.lo misc/random.o: ltcompile misc/random.c sysdeps.h systime.h misc/misc.h sysdeps.h ./ltcompile misc/random.c misc/strtou.lo misc/strtou.o: ltcompile misc/strtou.c misc/misc.h sysdeps.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h str/str.h ./ltcompile misc/strtou.c misc/ucspi.lo misc/ucspi.o: ltcompile misc/ucspi.c misc/ucspi.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h str/str.h ./ltcompile misc/ucspi.c misc/utoa.lo misc/utoa.o: ltcompile misc/utoa.c misc/misc.h sysdeps.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h str/str.h ./ltcompile misc/utoa.c misc/utoa2.lo misc/utoa2.o: ltcompile misc/utoa2.c misc/misc.h sysdeps.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h str/str.h ./ltcompile misc/utoa2.c msg/common.lo msg/common.o: ltcompile msg/common.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h selftest.c str/str.h ./ltcompile msg/common.c msg/commonf.lo msg/commonf.o: ltcompile msg/commonf.c iobuf/obuf.h iobuf/common.h msg/msg.h msg/debug.h selftest.c iobuf/iobuf.h iobuf/ibuf.h str/str.h ./ltcompile msg/commonf.c msg/debug.lo msg/debug.o: ltcompile msg/debug.c msg/msg.h msg/debug.h ./ltcompile msg/debug.c msg/debug_bits.lo msg/debug_bits.o: ltcompile msg/debug_bits.c msg/msg.h msg/debug.h ./ltcompile msg/debug_bits.c msg/debug_init.lo msg/debug_init.o: ltcompile msg/debug_init.c msg/msg.h msg/debug.h ./ltcompile msg/debug_init.c msg/debugf.lo msg/debugf.o: ltcompile msg/debugf.c msg/msg.h msg/debug.h ./ltcompile msg/debugf.c msg/die.lo msg/die.o: ltcompile msg/die.c msg/msg.h msg/debug.h ./ltcompile msg/die.c msg/dief.lo msg/dief.o: ltcompile msg/dief.c msg/msg.h msg/debug.h ./ltcompile msg/dief.c msg/error.lo msg/error.o: ltcompile msg/error.c msg/msg.h msg/debug.h ./ltcompile msg/error.c msg/errorf.lo msg/errorf.o: ltcompile msg/errorf.c msg/msg.h msg/debug.h ./ltcompile msg/errorf.c msg/oom.lo msg/oom.o: ltcompile msg/oom.c msg/msg.h msg/debug.h ./ltcompile msg/oom.c msg/show_pid.lo msg/show_pid.o: ltcompile msg/show_pid.c msg/msg.h msg/debug.h ./ltcompile msg/show_pid.c msg/warn.lo msg/warn.o: ltcompile msg/warn.c msg/msg.h msg/debug.h ./ltcompile msg/warn.c msg/warnf.lo msg/warnf.o: ltcompile msg/warnf.c msg/msg.h msg/debug.h ./ltcompile msg/warnf.c msg/wrap_alloc.lo msg/wrap_alloc.o: ltcompile msg/wrap_alloc.c msg/msg.h msg/debug.h msg/wrap.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h str/str.h ./ltcompile msg/wrap_alloc.c msg/wrap_chdir.lo msg/wrap_chdir.o: ltcompile msg/wrap_chdir.c msg/msg.h msg/debug.h msg/wrap.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h str/str.h ./ltcompile msg/wrap_chdir.c msg/wrap_exit.lo msg/wrap_exit.o: ltcompile msg/wrap_exit.c msg/msg.h msg/debug.h msg/wrap.h ./ltcompile msg/wrap_exit.c msg/wrap_str.lo msg/wrap_str.o: ltcompile msg/wrap_str.c msg/msg.h msg/debug.h msg/wrap.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h str/str.h ./ltcompile msg/wrap_str.c net.lib: compile load @echo -n 'Checking for -lnet: ' @echo 'main() { ; }' >trylib-lnet.c @{ ./compile trylib-lnet.c && ./load trylib-lnet -lnet; } >/dev/null 2>&1 \ && { echo -lnet >net.lib; echo yes; } \ || { echo -n >net.lib; echo no; } @rm -f trylib-lnet.c trylib-lnet.o trylib-lnet net/accept4.lo net/accept4.o: ltcompile net/accept4.c net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/accept4.c net/accept6.lo net/accept6.o: ltcompile net/accept6.c sysdeps.h net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/accept6.c net/acceptu.lo net/acceptu.o: ltcompile net/acceptu.c net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/acceptu.c net/bind4.lo net/bind4.o: ltcompile net/bind4.c net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/bind4.c net/bind6.lo net/bind6.o: ltcompile net/bind6.c sysdeps.h net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/bind6.c net/bindu.lo net/bindu.o: ltcompile net/bindu.c net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/bindu.c net/broadcast.lo net/broadcast.o: ltcompile net/broadcast.c net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/broadcast.c net/connect4.lo net/connect4.o: ltcompile net/connect4.c net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h str/str.h ./ltcompile net/connect4.c net/connect4_timeout.lo net/connect4_timeout.o: ltcompile net/connect4_timeout.c sysdeps.h net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h unix/nonblock.h ./ltcompile net/connect4_timeout.c net/connect6.lo net/connect6.o: ltcompile net/connect6.c sysdeps.h net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/connect6.c net/connect6_timeout.lo net/connect6_timeout.o: ltcompile net/connect6_timeout.c sysdeps.h net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h unix/nonblock.h ./ltcompile net/connect6_timeout.c net/connected.lo net/connected.o: ltcompile net/connected.c net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/connected.c net/connectu.lo net/connectu.o: ltcompile net/connectu.c net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/connectu.c net/connectu_timeout.lo net/connectu_timeout.o: ltcompile net/connectu_timeout.c sysdeps.h net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h unix/nonblock.h ./ltcompile net/connectu_timeout.c net/cork.lo net/cork.o: ltcompile net/cork.c net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/cork.c net/getaddr4.lo net/getaddr4.o: ltcompile net/getaddr4.c net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/getaddr4.c net/getaddr6.lo net/getaddr6.o: ltcompile net/getaddr6.c sysdeps.h net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/getaddr6.c net/ipv4_addr.lo net/ipv4_addr.o: ltcompile net/ipv4_addr.c net/ipv4.h sysdeps.h ./ltcompile net/ipv4_addr.c net/ipv4_format.lo net/ipv4_format.o: ltcompile net/ipv4_format.c net/ipv4.h sysdeps.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h str/str.h ./ltcompile net/ipv4_format.c net/ipv4_scan.lo net/ipv4_scan.o: ltcompile net/ipv4_scan.c net/ipv4.h sysdeps.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h str/str.h ./ltcompile net/ipv4_scan.c net/ipv6_addr.lo net/ipv6_addr.o: ltcompile net/ipv6_addr.c net/ipv6.h sysdeps.h ./ltcompile net/ipv6_addr.c net/ipv6_format.lo net/ipv6_format.o: ltcompile net/ipv6_format.c net/ipv6.h sysdeps.h net/ipv4.h sysdeps.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h str/str.h ./ltcompile net/ipv6_format.c net/ipv6_scan.lo net/ipv6_scan.o: ltcompile net/ipv6_scan.c net/ipv6.h sysdeps.h net/ipv4.h sysdeps.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h str/str.h ./ltcompile net/ipv6_scan.c net/linger.lo net/linger.o: ltcompile net/linger.c net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/linger.c net/listen.lo net/listen.o: ltcompile net/listen.c net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/listen.c net/notcpdelay.lo net/notcpdelay.o: ltcompile net/notcpdelay.c net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/notcpdelay.c net/pairdgm.lo net/pairdgm.o: ltcompile net/pairdgm.c net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/pairdgm.c net/pairstr.lo net/pairstr.o: ltcompile net/pairstr.c net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/pairstr.c net/recv4.lo net/recv4.o: ltcompile net/recv4.c net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/recv4.c net/recv6.lo net/recv6.o: ltcompile net/recv6.c sysdeps.h net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/recv6.c net/recvfd.lo net/recvfd.o: ltcompile net/recvfd.c net/cmsg.h net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/recvfd.c net/recvu.lo net/recvu.o: ltcompile net/recvu.c net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/recvu.c net/resolve_error.lo net/resolve_error.o: ltcompile net/resolve_error.c net/resolve.h net/ipv4.h sysdeps.h ./ltcompile net/resolve_error.c net/resolve_ipv4addr.lo net/resolve_ipv4addr.o: ltcompile net/resolve_ipv4addr.c net/resolve.h net/ipv4.h sysdeps.h ./ltcompile net/resolve_ipv4addr.c net/resolve_ipv4name.lo net/resolve_ipv4name.o: ltcompile net/resolve_ipv4name.c net/resolve.h net/ipv4.h sysdeps.h ./ltcompile net/resolve_ipv4name.c net/reuse.lo net/reuse.o: ltcompile net/reuse.c net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/reuse.c net/send4.lo net/send4.o: ltcompile net/send4.c net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/send4.c net/send6.lo net/send6.o: ltcompile net/send6.c sysdeps.h net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/send6.c net/sendfd.lo net/sendfd.o: ltcompile net/sendfd.c net/cmsg.h net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/sendfd.c net/sendu.lo net/sendu.o: ltcompile net/sendu.c net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/sendu.c net/shutdown.lo net/shutdown.o: ltcompile net/shutdown.c net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/shutdown.c net/tcp4.lo net/tcp4.o: ltcompile net/tcp4.c net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h str/str.h ./ltcompile net/tcp4.c net/tcp6.lo net/tcp6.o: ltcompile net/tcp6.c sysdeps.h net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/tcp6.c net/udp4.lo net/udp4.o: ltcompile net/udp4.c net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/udp4.c net/udp6.lo net/udp6.o: ltcompile net/udp6.c sysdeps.h net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/udp6.c net/uncork.lo net/uncork.o: ltcompile net/uncork.c net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/uncork.c net/unixdgm.lo net/unixdgm.o: ltcompile net/unixdgm.c net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/unixdgm.c net/unixstr.lo net/unixstr.o: ltcompile net/unixstr.c net/socket.h net/ipv4.h sysdeps.h net/ipv6.h sysdeps.h ./ltcompile net/unixstr.c path/contains.lo path/contains.o: ltcompile path/contains.c path/path.h str/str.h ./ltcompile path/contains.c path/fnmatch.lo path/fnmatch.o: ltcompile path/fnmatch.c path/path.h str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile path/fnmatch.c path/match.lo path/match.o: ltcompile path/match.c sysdeps.h str/str.h str/iter.h path/path.h msg/msg.h msg/debug.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h ./ltcompile path/match.c path/merge.lo path/merge.o: ltcompile path/merge.c path/path.h str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile path/merge.c path/mkdirs.lo path/mkdirs.o: ltcompile path/mkdirs.c sysdeps.h path/path.h str/str.h ./ltcompile path/mkdirs.c path/mktemp.lo path/mktemp.o: ltcompile path/mktemp.c systime.h path/path.h str/str.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 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 -n >rt.lib; echo no; } @rm -f trylib-lrt.c trylib-lrt.o trylib-lrt s.lib: compile load @echo -n 'Checking for -ls: ' @echo 'main() { ; }' >trylib-ls.c @{ ./compile trylib-ls.c && ./load trylib-ls -ls; } >/dev/null 2>&1 \ && { echo -ls >s.lib; echo yes; } \ || { echo -n >s.lib; echo no; } @rm -f trylib-ls.c trylib-ls.o trylib-ls selftests: selftests.sh sysdeps.h libbg-sysdeps.la libbg.la sh selftests.sh shadow.lib: compile load @echo -n 'Checking for -lshadow: ' @echo 'main() { ; }' >trylib-lshadow.c @{ ./compile trylib-lshadow.c && ./load trylib-lshadow -lshadow; } >/dev/null 2>&1 \ && { echo -lshadow >shadow.lib; echo yes; } \ || { echo -n >shadow.lib; echo no; } @rm -f trylib-lshadow.c trylib-lshadow.o trylib-lshadow socket.lib: compile load @echo -n 'Checking for socket libraries: ' @echo 'main() { ; }' >trylib-lsocket.c @{ ./compile trylib-lsocket.c && ./load trylib-lsocket -lsocket -lnsl; } >/dev/null 2>&1 \ && { echo -lsocket -lnsl >socket.lib; echo -lsocket -lnsl; } \ || { : >socket.lib; echo no; } @rm -f trylib-lsocket.c trylib-lsocket.o trylib-lsocket str/alloc.lo str/alloc.o: ltcompile str/alloc.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/alloc.c str/buildmap.lo str/buildmap.o: ltcompile str/buildmap.c str/str.h ./ltcompile str/buildmap.c str/case_glob.lo str/case_glob.o: ltcompile str/case_glob.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/case_glob.c str/case_match.lo str/case_match.o: ltcompile str/case_match.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/case_match.c str/case_start.lo str/case_start.o: ltcompile str/case_start.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/case_start.c str/cat.lo str/cat.o: ltcompile str/cat.c str/str.h ./ltcompile str/cat.c str/cat2s.lo str/cat2s.o: ltcompile str/cat2s.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/cat2s.c str/cat3s.lo str/cat3s.o: ltcompile str/cat3s.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/cat3s.c str/cat4s.lo str/cat4s.o: ltcompile str/cat4s.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/cat4s.c str/cat5s.lo str/cat5s.o: ltcompile str/cat5s.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/cat5s.c str/cat6s.lo str/cat6s.o: ltcompile str/cat6s.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/cat6s.c str/catf.lo str/catf.o: ltcompile str/catf.c str/str.h fmt/multi.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/catf.c str/catiw.lo str/catiw.o: ltcompile str/catiw.c str/str.h ./ltcompile str/catiw.c str/catiwll.lo str/catiwll.o: ltcompile str/catiwll.c str/str.h ./ltcompile str/catiwll.c str/catns.lo str/catns.o: ltcompile str/catns.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/catns.c str/catsllnum.lo str/catsllnum.o: ltcompile str/catsllnum.c str/str.h ./ltcompile str/catsllnum.c str/catsnum.lo str/catsnum.o: ltcompile str/catsnum.c str/str.h ./ltcompile str/catsnum.c str/catullnum.lo str/catullnum.o: ltcompile str/catullnum.c str/str.h ./ltcompile str/catullnum.c str/catunum.lo str/catunum.o: ltcompile str/catunum.c str/str.h ./ltcompile str/catunum.c str/catuw.lo str/catuw.o: ltcompile str/catuw.c str/str.h ./ltcompile str/catuw.c str/catuwll.lo str/catuwll.o: ltcompile str/catuwll.c str/str.h ./ltcompile str/catuwll.c str/catxw.lo str/catxw.o: ltcompile str/catxw.c str/str.h ./ltcompile str/catxw.c str/catxwll.lo str/catxwll.o: ltcompile str/catxwll.c str/str.h ./ltcompile str/catxwll.c str/cmp.lo str/cmp.o: ltcompile str/cmp.c str/str.h ./ltcompile str/cmp.c str/copy.lo str/copy.o: ltcompile str/copy.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/copy.c str/copy2s.lo str/copy2s.o: ltcompile str/copy2s.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/copy2s.c str/copy3s.lo str/copy3s.o: ltcompile str/copy3s.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/copy3s.c str/copy4s.lo str/copy4s.o: ltcompile str/copy4s.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/copy4s.c str/copy5s.lo str/copy5s.o: ltcompile str/copy5s.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/copy5s.c str/copy6s.lo str/copy6s.o: ltcompile str/copy6s.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/copy6s.c str/copyf.lo str/copyf.o: ltcompile str/copyf.c str/str.h fmt/multi.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/copyf.c str/copyns.lo str/copyns.o: ltcompile str/copyns.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/copyns.c str/count.lo str/count.o: ltcompile str/count.c str/str.h ./ltcompile str/count.c str/countof.lo str/countof.o: ltcompile str/countof.c str/str.h ./ltcompile str/countof.c str/cut.lo str/cut.o: ltcompile str/cut.c str/str.h ./ltcompile str/cut.c str/diff.lo str/diff.o: ltcompile str/diff.c str/str.h ./ltcompile str/diff.c str/digits.lo str/digits.o: ltcompile str/digits.c str/str.h ./ltcompile str/digits.c str/env_find.lo str/env_find.o: ltcompile str/env_find.c str/str.h str/iter.h str/env.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/env_find.c str/env_from_array.lo str/env_from_array.o: ltcompile str/env_from_array.c str/str.h str/env.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/env_from_array.c str/env_from_string.lo str/env_from_string.o: ltcompile str/env_from_string.c str/str.h str/env.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/env_from_string.c str/env_get.lo str/env_get.o: ltcompile str/env_get.c str/str.h str/iter.h str/env.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/env_get.c str/env_make_array.lo str/env_make_array.o: ltcompile str/env_make_array.c str/str.h str/iter.h str/env.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/env_make_array.c str/env_put.lo str/env_put.o: ltcompile str/env_put.c str/str.h str/env.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/env_put.c str/env_set.lo str/env_set.o: ltcompile str/env_set.c str/str.h str/env.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/env_set.c str/env_unset.lo str/env_unset.o: ltcompile str/env_unset.c str/str.h str/env.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/env_unset.c str/findnext.lo str/findnext.o: ltcompile str/findnext.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/findnext.c str/findnextof.lo str/findnextof.o: ltcompile str/findnextof.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/findnextof.c str/findprev.lo str/findprev.o: ltcompile str/findprev.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/findprev.c str/findprevof.lo str/findprevof.o: ltcompile str/findprevof.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/findprevof.c str/free.lo str/free.o: ltcompile str/free.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/free.c str/glob.lo str/glob.o: ltcompile str/glob.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/glob.c str/init.lo str/init.o: ltcompile str/init.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/init.c str/iter_advance.lo str/iter_advance.o: ltcompile str/iter_advance.c str/iter.h str/str.h ./ltcompile str/iter_advance.c str/iter_start.lo str/iter_start.o: ltcompile str/iter_start.c str/iter.h str/str.h ./ltcompile str/iter_start.c str/iter_valid.lo str/iter_valid.o: ltcompile str/iter_valid.c str/iter.h str/str.h ./ltcompile str/iter_valid.c str/join.lo str/join.o: ltcompile str/join.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/join.c str/lower.lo str/lower.o: ltcompile str/lower.c str/str.h ./ltcompile str/lower.c str/lstrip.lo str/lstrip.o: ltcompile str/lstrip.c str/str.h ./ltcompile str/lstrip.c str/match.lo str/match.o: ltcompile str/match.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/match.c str/rstrip.lo str/rstrip.o: ltcompile str/rstrip.c str/str.h ./ltcompile str/rstrip.c str/sort.lo str/sort.o: ltcompile str/sort.c str/str.h ./ltcompile str/sort.c str/splice.lo str/splice.o: ltcompile str/splice.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/splice.c str/start.lo str/start.o: ltcompile str/start.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h ./ltcompile str/start.c str/subst.lo str/subst.o: ltcompile str/subst.c str/str.h ./ltcompile str/subst.c str/truncate.lo str/truncate.o: ltcompile str/truncate.c str/str.h ./ltcompile str/truncate.c str/upper.lo str/upper.o: ltcompile str/upper.c str/str.h ./ltcompile str/upper.c str/xlate.lo str/xlate.o: ltcompile str/xlate.c str/str.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.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/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; \ 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 unix/fcntl.h unix/cloexec.h ./ltcompile unix/cloexec_off.c unix/cloexec_on.lo unix/cloexec_on.o: ltcompile unix/cloexec_on.c unix/fcntl.h unix/cloexec.h ./ltcompile unix/cloexec_on.c unix/fcntl_fd_off.lo unix/fcntl_fd_off.o: ltcompile unix/fcntl_fd_off.c unix/fcntl.h ./ltcompile unix/fcntl_fd_off.c unix/fcntl_fd_on.lo unix/fcntl_fd_on.o: ltcompile unix/fcntl_fd_on.c unix/fcntl.h ./ltcompile unix/fcntl_fd_on.c unix/fcntl_fl_off.lo unix/fcntl_fl_off.o: ltcompile unix/fcntl_fl_off.c unix/fcntl.h ./ltcompile unix/fcntl_fl_off.c unix/fcntl_fl_on.lo unix/fcntl_fl_on.o: ltcompile unix/fcntl_fl_on.c unix/fcntl.h ./ltcompile unix/fcntl_fl_on.c unix/nonblock_off.lo unix/nonblock_off.o: ltcompile unix/nonblock_off.c unix/fcntl.h unix/nonblock.h ./ltcompile unix/nonblock_off.c unix/nonblock_on.lo unix/nonblock_on.o: ltcompile unix/nonblock_on.c unix/fcntl.h unix/nonblock.h ./ltcompile unix/nonblock_on.c unix/selfpipe.lo unix/selfpipe.o: ltcompile unix/selfpipe.c sysdeps.h unix/cloexec.h unix/nonblock.h unix/sig.h unix/selfpipe.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h str/str.h ./ltcompile unix/selfpipe.c unix/sig_alarm.lo unix/sig_alarm.o: ltcompile unix/sig_alarm.c unix/sig.h ./ltcompile unix/sig_alarm.c unix/sig_all.lo unix/sig_all.o: ltcompile unix/sig_all.c unix/sig.h sysdeps.h ./ltcompile unix/sig_all.c unix/sig_block.lo unix/sig_block.o: ltcompile unix/sig_block.c unix/sig.h sysdeps.h ./ltcompile unix/sig_block.c unix/sig_bug.lo unix/sig_bug.o: ltcompile unix/sig_bug.c unix/sig.h ./ltcompile unix/sig_bug.c unix/sig_catch.lo unix/sig_catch.o: ltcompile unix/sig_catch.c unix/sig.h sysdeps.h ./ltcompile unix/sig_catch.c unix/sig_child.lo unix/sig_child.o: ltcompile unix/sig_child.c unix/sig.h ./ltcompile unix/sig_child.c unix/sig_hup.lo unix/sig_hup.o: ltcompile unix/sig_hup.c unix/sig.h ./ltcompile unix/sig_hup.c unix/sig_int.lo unix/sig_int.o: ltcompile unix/sig_int.c unix/sig.h ./ltcompile unix/sig_int.c unix/sig_misc.lo unix/sig_misc.o: ltcompile unix/sig_misc.c unix/sig.h ./ltcompile unix/sig_misc.c unix/sig_pipe.lo unix/sig_pipe.o: ltcompile unix/sig_pipe.c unix/sig.h ./ltcompile unix/sig_pipe.c unix/sig_quit.lo unix/sig_quit.o: ltcompile unix/sig_quit.c unix/sig.h ./ltcompile unix/sig_quit.c unix/sig_suspend.lo unix/sig_suspend.o: ltcompile unix/sig_suspend.c unix/sig.h sysdeps.h ./ltcompile unix/sig_suspend.c unix/sig_term.lo unix/sig_term.o: ltcompile unix/sig_term.c unix/sig.h ./ltcompile unix/sig_term.c unix/signalfd.lo unix/signalfd.o: ltcompile unix/signalfd.c sysdeps.h unix/cloexec.h unix/nonblock.h unix/sig.h unix/signalfd.h selftest.c iobuf/iobuf.h iobuf/common.h iobuf/ibuf.h iobuf/obuf.h msg/msg.h msg/debug.h str/str.h ./ltcompile unix/signalfd.c unix/trigger_pull.lo unix/trigger_pull.o: ltcompile unix/trigger_pull.c sysdeps.h unix/fcntl.h unix/trigger.h sysdeps.h ./ltcompile unix/trigger_pull.c unix/trigger_set.lo unix/trigger_set.o: ltcompile unix/trigger_set.c sysdeps.h unix/fcntl.h unix/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 str/str.h ./ltcompile vmailmgr/req_arg.c vmailmgr/req_init.lo vmailmgr/req_init.o: ltcompile vmailmgr/req_init.c vmailmgr/client.h str/str.h ./ltcompile vmailmgr/req_init.c vmailmgr/req_write.lo vmailmgr/req_write.o: ltcompile vmailmgr/req_write.c vmailmgr/client.h str/str.h ./ltcompile vmailmgr/req_write.c vmailmgr/resp_read.lo vmailmgr/resp_read.o: ltcompile vmailmgr/resp_read.c vmailmgr/client.h str/str.h ./ltcompile vmailmgr/resp_read.c vmailmgr/vpwentry_export.lo vmailmgr/vpwentry_export.o: ltcompile vmailmgr/vpwentry_export.c vmailmgr/vpwentry.h str/str.h ./ltcompile vmailmgr/vpwentry_export.c vmailmgr/vpwentry_free.lo vmailmgr/vpwentry_free.o: ltcompile vmailmgr/vpwentry_free.c vmailmgr/vpwentry.h str/str.h ./ltcompile vmailmgr/vpwentry_free.c vmailmgr/vpwentry_import.lo vmailmgr/vpwentry_import.o: ltcompile vmailmgr/vpwentry_import.c systime.h misc/misc.h sysdeps.h vmailmgr/vpwentry.h str/str.h ./ltcompile vmailmgr/vpwentry_import.c bglibs-1.106/AUTOFILES0000664000076400007640000000017611147311327013612 0ustar bruceguenterAUTOFILES LIBVERSION Makefile SRCFILES TARGETS choose.sh conf-bin conf-cc conf-include conf-ld conf-lib conf-man warn-auto.sh bglibs-1.106/ANNOUNCEMENT0000664000076400007640000000344611147311327014154 0ustar bruceguenterVersion 1.106 of bglibs is now available at: http://untroubled.org/bglibs/ ------------------------------------------------------------------------------ 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/ ------------------------------------------------------------------------------- bglibs One stop library package Bruce Guenter Version 1.106 2009-02-19 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 via git at: http://untroubled.org/git/bglibs.git Installation: - Build the sources by running "make" - After the package has been compiled, run the following command as root: make install Copyright(C) 2009 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-1.106/base64/0000755000076400007640000000000011147311327013412 5ustar bruceguenterbglibs-1.106/base64/encode_part.c0000664000076400007640000000147411147311327016051 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-1.106/base64/base64.h0000664000076400007640000000113511147311327014651 0ustar bruceguenter#ifndef BASE64__H__ #define BASE64__H__ #include "str/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-1.106/base64/bin2asc.c0000664000076400007640000000017011147311327015077 0ustar bruceguenter#include "base64.h" const char base64_bin2asc[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; bglibs-1.106/base64/encode_line.c0000664000076400007640000000057311147311327016031 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-1.106/base64/asc2bin.c0000664000076400007640000000210311147311327015075 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-1.106/base64/decode_line.c0000664000076400007640000000052311147311327016012 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-1.106/base64/decode_part.c0000664000076400007640000000121111147311327016024 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-1.106/uintnn.h0000664000076400007640000000435211147311330014012 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