From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (kristaps@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id pB20Lubl007891 for ; Thu, 1 Dec 2011 19:21:56 -0500 (EST) Received: (from kristaps@localhost) by krisdoz.my.domain (8.14.3/8.14.3/Submit) id pB20LuqB006477; Thu, 1 Dec 2011 19:21:56 -0500 (EST) Date: Thu, 1 Dec 2011 19:21:56 -0500 (EST) Message-Id: <201112020021.pB20LuqB006477@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: kristaps@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: This is a little gross: Linux and Apple need lots some cajoling X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- This is a little gross: Linux and Apple need lots some cajoling to work with byte-swapping. Tested on Mac. Any Linux machines somebody can test on? Anybody? While here, note the correct byte-size in mandocdb(8) and also note field widths and endianness. The btree is now endian-neutral. Modified Files: -------------- mdocml: apropos_db.c config.h.post mandocdb.8 mandocdb.c Revision Data ------------- Index: mandocdb.8 =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandocdb.8,v retrieving revision 1.10 retrieving revision 1.11 diff -Lmandocdb.8 -Lmandocdb.8 -u -p -r1.10 -r1.11 --- mandocdb.8 +++ mandocdb.8 @@ -137,11 +137,11 @@ The keyword database, is a .Xr btree 3 database of NUL-terminated keywords (record length is non-zero string -length plus one) mapping to a 8-byte binary field consisting of the -keyword type and source +length plus one) mapping to a 12-byte binary field consisting of the +64-bit keyword type and 32-bit source .Sx Index Database -record number. -The type, a 64-bit bit-mask in host order, consists of the following +record number, both in network-byte order. +The typet bit-mask consists of the following values mapping into .Xr mdoc 7 macro identifiers: Index: apropos_db.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/apropos_db.c,v retrieving revision 1.18 retrieving revision 1.19 diff -Lapropos_db.c -Lapropos_db.c -u -p -r1.18 -r1.19 --- apropos_db.c +++ apropos_db.c @@ -15,6 +15,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include @@ -24,8 +28,12 @@ #include #include -#ifdef __linux__ +#if defined(__linux__) +# include # include +#elif defined(__APPLE__) +# include +# include #else # include #endif Index: mandocdb.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandocdb.c,v retrieving revision 1.20 retrieving revision 1.21 diff -Lmandocdb.c -Lmandocdb.c -u -p -r1.20 -r1.21 --- mandocdb.c +++ mandocdb.c @@ -33,8 +33,12 @@ #include #include -#ifdef __linux__ +#if defined(__linux__) +# include # include +#elif defined(__APPLE__) +# include +# include #else # include #endif Index: config.h.post =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/config.h.post,v retrieving revision 1.2 retrieving revision 1.3 diff -Lconfig.h.post -Lconfig.h.post -u -p -r1.2 -r1.3 --- config.h.post +++ config.h.post @@ -15,6 +15,16 @@ # endif #endif +#if defined(__APPLE__) +# define htobe32(x) OSSwapHostToBigInt32(x) +# define betoh32(x) OSSwapBigToHostInt32(x) +# define htobe64(x) OSSwapHostToBigInt64(x) +# define betoh64(x) OSSwapBigToHostInt64(x) +#elif defined(__linux__) +# define betoh32(x) be32toh(x) +# define betoh64(x) be64toh(x) +#endif + #ifndef HAVE_STRLCAT extern size_t strlcat(char *, const char *, size_t); #endif -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv