--- /dev/null
+# $OpenBSD: Makefile,v 1.1 2016/07/30 10:56:13 schwarze Exp $
+
+SUBDIR += binedit dbm_dump makeinodes run
+
+.include <bsd.subdir.mk>
--- /dev/null
+# $OpenBSD: Makefile,v 1.1 2016/07/30 10:56:13 schwarze Exp $
+
+PROG = binedit
+MAN =
+
+.include <bsd.prog.mk>
--- /dev/null
+.\" $OpenBSD: binedit.1,v 1.1 2016/07/30 10:56:13 schwarze Exp $
+.\"
+.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd $Mdocdate: July 30 2016 $
+.Dt BINEDIT 1
+.Os
+.Sh NAME
+.Nm binedit
+.Nd non-interactive binary file editor
+.Sh SYNOPSIS
+.Nm binedit
+.Ar command_string
+.Sh DESCRIPTION
+The
+.Nm
+utility reads a string of arbitrary bytes from the standard input,
+edits it according to the
+.Ar command_string ,
+and writes the resulting string of bytes to the standard output.
+.Pp
+The
+.Ar command_string
+consists of an arbitrary number of one-letter commands.
+Some commands take a numeric argument.
+No delimiters are used.
+.Pp
+Commands use two number registers:
+A
+.Va value
+set by
+.Ic r
+and
+.Ic w ,
+modfied by
+.Ic i ,
+and used by
+.Ic d ,
+and a
+.Va destination
+set by
+.Ic d
+and used by
+.Ic a .
+.Pp
+All numbers are signed 32-bit integers.
+On the command line, they are given in decimal notation,
+optionally preceded by a sign.
+In the input and output streams, they are represented in
+big endian (network) byte order.
+.Pp
+The commands are as follows:
+.Bl -tag -width Ds
+.It Ic a
+Advance: copy bytes up to and including the input
+.Va destination
+set with the
+.Ic d
+command.
+.It Ic c Ar bytes
+Copy the specified number of
+.Ar bytes .
+.It Ic d
+Set the input file
+.Va destination
+to the saved
+.Va value .
+Bytes are counted from 1.
+.It Ic f
+Finish: copy all remaining bytes.
+This command can only appear once at the end of the
+.Ar command_string .
+.It Ic i Op Ar amount
+Increment the saved
+.Va value
+by the given
+.Ar amount ,
+by default 1.
+.It Ic r
+Read one number from the standard input and save the
+.Va value .
+.It Ic s Ar bytes
+Skip the specified number of
+.Ar bytes
+on the standard input.
+.It Ic w Op Ar value
+Write the given
+.Ar value
+and also save it.
+If no argument is given, the saved
+.Va value
+is written.
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+See the file
+.Pa /usr/src/regress/usr.bin/mandoc/db/run/Makefile
+for several examples.
+For example, with the
+.Ar command_string
+.Ic c12rdwariwf ,
+.Nm
+reads a valid
+.Xr mandoc_db 5
+file from the standard input and prints a corrupted version to the
+standard output where the final magic is incremented by one.
+.Sh DIAGNOSTICS
+Error messages are formatted as follows:
+.Pp
+.D1 Ar command : message Ns Op Ns : Ar errno_message
+.Pp
+The
+.Ar message
+strings are as follows:
+.Bl -tag -width Ds
+.It Ar command : Sy EOF
+The input file ended prematurely.
+Can occur during the
+.Ic a ,
+.Ic c ,
+.Ic r ,
+and
+.Ic s
+commands.
+.It Ar command : Sy getchar : Ar errno_message
+The
+.Xr getchar 3
+function failed.
+Can occur during the
+.Ic a ,
+.Ic c ,
+.Ic f ,
+and
+.Ic s
+commands.
+.It Ic r : Sy fread : Ar errno_message
+The
+.Xr fread 3
+function failed while processing an
+.Ic r
+command.
+.It Ic w : Sy fwrite : Ar errno_message
+The
+.Xr fwrite 3
+function failed while processing a
+.Ic w
+command.
+.It Ic f Ns ... : Sy not the last command
+An
+.Ic f
+command was encountered before the end of the
+.Ar command_string .
+.It Ar command : Sy invalid command
+An invalid byte was found in the
+.Ar command_string ,
+or an argument was given after a command that does not accept one.
+.El
+.Sh AUTHORS
+.An Ingo Schwarze Aq Mt schwarze@openbsd.org
--- /dev/null
+/* $OpenBSD: binedit.c,v 1.1 2016/07/30 10:56:13 schwarze Exp $ */
+/*
+ * Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#include <ctype.h>
+#include <endian.h>
+#include <err.h>
+#include <stdint.h>
+#include <stdio.h>
+
+static int32_t getint(const char **);
+static int copybyte(const char);
+
+
+int
+main(int argc, char *argv[])
+{
+ const char *cmd; /* Command string from the command line. */
+ int32_t pos; /* Characters read so far. */
+ int32_t dest; /* Number of characters to be read. */
+ int32_t val; /* Value to be written. */
+ int32_t i; /* Auxiliary for reading and writing. */
+
+ if (argc != 2)
+ errx(1, "usage: binedit command_string");
+ cmd = argv[1];
+ dest = pos = val = 0;
+ while (*cmd != '\0') {
+ switch (*cmd++) {
+ case 'a': /* Advance to destination. */
+ while (pos < dest) {
+ pos++;
+ if (copybyte('a') == EOF)
+ errx(1, "a: EOF");
+ }
+ break;
+ case 'c': /* Copy. */
+ i = getint(&cmd);
+ pos += i;
+ while (i--)
+ if (copybyte('c') == EOF)
+ errx(1, "c: EOF");
+ break;
+ case 'd': /* Set destination. */
+ dest = val;
+ break;
+ case 'f': /* Finish. */
+ if (*cmd != '\0')
+ errx(1, "%s: not the last command", cmd - 1);
+ while (copybyte('f') != EOF)
+ continue;
+ break;
+ case 'i': /* Increment. */
+ i = getint(&cmd);
+ if (i == 0)
+ i = 1;
+ val += i;
+ break;
+ case 'r': /* Read. */
+ pos += sizeof(i);
+ if (fread(&i, sizeof(i), 1, stdin) != 1) {
+ if (ferror(stdin))
+ err(1, "r: fread");
+ else
+ errx(1, "r: EOF");
+ }
+ val = be32toh(i);
+ break;
+ case 's': /* Skip. */
+ i = getint(&cmd);
+ pos += i;
+ while (i--) {
+ if (getchar() == EOF) {
+ if (ferror(stdin))
+ err(1, "s: getchar");
+ else
+ errx(1, "s: EOF");
+ }
+ }
+ break;
+ case 'w': /* Write one integer. */
+ if (*cmd == '-' || *cmd == '+' ||
+ isdigit((unsigned char)*cmd))
+ val = getint(&cmd);
+ i = htobe32(val);
+ if (fwrite(&i, sizeof(i), 1, stdout) != 1)
+ err(1, "w: fwrite");
+ break;
+ default:
+ errx(1, "%c: invalid command", cmd[-1]);
+ }
+ }
+ return 0;
+}
+
+static int32_t
+getint(const char **cmd)
+{
+ int32_t res;
+ int minus;
+
+ res = 0;
+ minus = 0;
+ if (**cmd == '-') {
+ minus = 1;
+ (*cmd)++;
+ } else if (**cmd == '+')
+ (*cmd)++;
+ while(isdigit((unsigned char)**cmd))
+ res = res * 10 + *(*cmd)++ - '0';
+ return minus ? -res : res;
+}
+
+static int
+copybyte(const char cmd)
+{
+ int ch;
+
+ if ((ch = getchar()) == EOF) {
+ if (ferror(stdin))
+ err(1, "%c: getchar", cmd);
+ } else if (putchar(ch) == EOF)
+ err(1, "%c: putchar", cmd);
+ return ch;
+}
--- /dev/null
+# $OpenBSD: Makefile,v 1.1 2016/07/30 10:56:13 schwarze Exp $
+
+PROG = dbm_dump
+CPPFLAGS += -I${BSDSRCDIR}/usr.bin/mandoc
+LDADD += ${BSDOBJDIR}/usr.bin/mandoc/dbm.o
+LDADD += ${BSDOBJDIR}/usr.bin/mandoc/dbm_map.o
+
+.include <bsd.prog.mk>
--- /dev/null
+.\" $OpenBSD: dbm_dump.1,v 1.1 2016/07/30 10:56:13 schwarze Exp $
+.\"
+.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd $Mdocdate: July 30 2016 $
+.Dt DBM_DUMP 1
+.Os
+.Sh NAME
+.Nm dbm_dump
+.Nd dump a mandoc.db(5) file
+.Sh SYNOPSIS
+.Nm dbm_dump
+.Ar file
+.Sh DESCRIPTION
+The
+.Nm
+utility reads a
+.Xr mandoc_db 5
+database from the given
+.Ar file
+and dumps it to the standard output in a format that is suitable for
+.Xr diff 1 .
+.Pp
+Offsets are given in bytes, zero-based, and printed in hexadecimal numbers.
+Counts are printed in decimal numbers.
+.Pp
+Each non-empty table - the PAGES table, the MACROS table, and any
+MACRO table - is preceded and followed by a line beginning with
+three equal signs
+.Pq Sq === .
+Empty tables produce no output.
+.Pp
+In the PAGES table, an entry may produce four or five lines of output,
+depending on whether an
+.Fa arch
+value is present.
+Each
+.Fa name
+value is preceded by one or more attributes in square brackets,
+telling what kind of a name it is:
+.Pp
+.Bl -tag -width 1n -compact -offset indent
+.It Sy f
+a file name
+.It Sy h
+a header line name taken from a
+.Ic \&Dt
+or
+.Ic \&TH
+macro
+.It Sy 1
+the name from the first
+.Ic \&Nm
+macro in the NAME section
+.It Sy t
+a title name: a name from any
+.Ic \&Nm
+macro in the NAME section
+.It Sy s
+any name from a
+.Ic \&Nm
+macro in the SYNOPSIS section
+.El
+.Pp
+In each MACRO table, macro values are followed by the primary name
+of each page in which they occur.
+This does not uniquely identify the pages because several pages
+may share the same primary name.
+.Sh FILES
+The header files
+.Qq Pa mansearch.h ,
+.Qq Pa dbm_map.h ,
+and
+.Qq Pa dbm.h
+and the object files
+.Pa dbm_map.o
+and
+.Pa dbm.o
+from the
+.Xr mandoc 1
+build are required to compile and link
+.Nm .
+.Sh EXIT STATUS
+.Ex -std
+It fails when no argument or more than one argument is given or when
+.Fn dbm_open
+fails.
+The pointer jumps described below
+.Sx DIAGNOSTICS
+do not imply failure.
+.Sh EXAMPLES
+Several examples of
+.Nm
+output can be found in the directory
+.Pa /usr/src/regress/usr.bin/mandoc/db/out/ .
+Standard output is saved in files with the extension
+.Pa *.dout ,
+standard error is collected in the file
+.Pa all.derr .
+.Sh DIAGNOSTICS
+The function
+.Fn dbm_open
+detects various kinds of issues with the file format
+and reports them on the standard error output.
+.Pp
+Otherwise, the
+.Nm
+utility checks that the input file contains no holes
+and that no pointers point backwards.
+For each violation, the following message is printed:
+.Pp
+.D1 Ar pointer Sy jumps from Ar expected Sy to Ar specified
+.Pp
+Here,
+.Ar pointer
+specifies what the dubious pointer is supposed to point to:
+.Pp
+.Bl -tag -width macros -compact
+.It Sy name0
+the primary name of the first page
+.It Sy name
+the primary name of another page
+.It Sy sect0
+the first section of the first page
+.It Sy sect
+the first section of another page
+.It Sy arch0
+the first architecture of the first architecture-specific page
+.It Sy arch
+the first architecture of another page
+.It Sy desc0
+the one-line description of the first page
+.It Sy desc
+the one-line description of another page
+.It Sy file0
+the first filename of the first page
+.It Sy file
+the first filename of another page
+.It Sy macros
+the number of macro tables
+.It Sy macro0
+the number of entries in the first macro table
+.It Sy macro
+the number of entries in another macro table
+.It Sy value0
+the first value of a macro
+.It Sy value
+another value of a macro
+.It Sy pages0
+the list of pointers to pages mentioning the first macro value
+.It Sy pages
+the list of pointers to pages mentioning another macro value
+.It Sy end
+the final magic
+.El
+.Pp
+The hexadecimal 32-bit integers
+.Ar expected
+and
+.Ar specified
+give the byte offset of a specific data element in the file;
+respectively, the one
+.Ar expected
+from the end of the preceding data in the file and the one actually
+.Ar found
+when reading the location where the pointer ought to be.
+If
+.Ar found
+is greater than
+.Ar expected ,
+there is a hole, and the file could theoretically still be usable,
+even though it is not likely to be correct.
+If
+.Ar found
+is less than
+.Ar expected ,
+the file is corrupt because it contains a backward pointer.
+.Sh AUTHORS
+.An Ingo Schwarze Aq Mt schwarze@openbsd.org
--- /dev/null
+/* $OpenBSD: dbm_dump.c,v 1.1 2016/07/30 10:56:13 schwarze Exp $ */
+/*
+ * Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Function to dump an on-disk read-only mandoc database
+ * in diff(1)able format for debugging purposes.
+ */
+#include <err.h>
+#include <regex.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "mansearch.h"
+#include "dbm_map.h"
+#include "dbm.h"
+
+union ptr {
+ const char *c;
+ const int32_t *i;
+};
+
+static void dump(void);
+static const char *dump_macro(union ptr, int32_t);
+static const char *dump_macros(union ptr);
+static const char *dump_pages(union ptr);
+static void dump_str(const char **);
+static void dump_lst(const char **);
+static void pchk(const char *, const char **, const char *, int);
+
+
+int
+main(int argc, char *argv[])
+{
+ if (argc != 2)
+ errx(1, "usage: dump filename");
+ if (dbm_open(argv[1]) == -1)
+ err(1, "%s", argv[1]);
+ dump();
+ dbm_close();
+ return 0;
+}
+
+static void
+dump(void)
+{
+ union ptr p, macros, end;
+
+ p.i = dbm_getint(0);
+ printf("initial magic 0x%08x\n", be32toh(*p.i++));
+ printf("version 0x%08x\n", be32toh(*p.i++));
+ printf("macros offset 0x%08x\n", be32toh(*p.i));
+ macros.i = dbm_get(*p.i++);
+ printf("end offset 0x%08x\n", be32toh(*p.i));
+ end.i = dbm_get(*p.i++);
+ p.c = dump_pages(p);
+ pchk(macros.c, &p.c, "macros", 3);
+ p.c = dump_macros(p);
+ pchk(end.c, &p.c, "end", 0);
+ printf("final magic 0x%08x\n", be32toh(*p.i));
+}
+
+static const char *
+dump_pages(union ptr p)
+{
+ const char *name0, *sect0, *arch0, *desc0, *file0;
+ const char *namep, *sectp, *archp, *descp, *filep;
+ int32_t i, npages;
+
+ npages = be32toh(*p.i++);
+ printf("page count %d\n", npages);
+ if (npages == 0)
+ return p.c;
+ namep = name0 = dbm_get(p.i[0]);
+ sectp = sect0 = dbm_get(p.i[1]);
+ archp = arch0 = p.i[2] == 0 ? NULL : dbm_get(p.i[2]);
+ descp = desc0 = dbm_get(p.i[3]);
+ filep = file0 = dbm_get(p.i[4]);
+ printf("=== PAGES ===\n");
+ for (i = 0; i < npages; i++) {
+ pchk(dbm_get(*p.i++), &namep, "name", 0);
+ printf("page name ");
+ dump_lst(&namep);
+ pchk(dbm_get(*p.i++), §p, "sect", 0);
+ printf("page sect ");
+ dump_lst(§p);
+ if (*p.i++) {
+ if (arch0 == NULL)
+ archp = arch0 = dbm_get(p.i[-1]);
+ else
+ pchk(dbm_get(p.i[-1]), &archp, "arch", 0);
+ printf("page arch ");
+ dump_lst(&archp);
+ }
+ pchk(dbm_get(*p.i++), &descp, "desc", 0);
+ printf("page desc # ");
+ dump_str(&descp);
+ printf("\npage file ");
+ pchk(dbm_get(*p.i++), &filep, "file", 0);
+ switch(*filep++) {
+ case 1:
+ printf("src ");
+ break;
+ case 2:
+ printf("cat ");
+ break;
+ default:
+ printf("UNKNOWN FORMAT %d ", filep[-1]);
+ break;
+ }
+ dump_lst(&filep);
+ }
+ printf("=== END OF PAGES ===\n");
+ pchk(name0, &p.c, "name0", 0);
+ pchk(sect0, &namep, "sect0", 0);
+ if (arch0 != NULL) {
+ pchk(arch0, §p, "arch0", 0);
+ pchk(desc0, &archp, "desc0", 0);
+ } else
+ pchk(desc0, §p, "desc0", 0);
+ pchk(file0, &descp, "file0", 0);
+ return filep;
+}
+
+static const char *
+dump_macros(union ptr p)
+{
+ union ptr macro0, macrop;
+ int32_t i, nmacros;
+
+ nmacros = be32toh(*p.i++);
+ printf("macros count %d\n", nmacros);
+ if (nmacros == 0)
+ return p.c;
+ macrop.i = macro0.i = dbm_get(*p.i);
+ printf("=== MACROS ===\n");
+ for (i = 0; i < nmacros; i++) {
+ pchk(dbm_get(*p.i++), ¯op.c, "macro", 0);
+ macrop.c = dump_macro(macrop, i);
+ }
+ printf("=== END OF MACROS ===\n");
+ pchk(macro0.c, &p.c, "macro0", 0);
+ return macrop.c;
+}
+
+static const char *
+dump_macro(union ptr p, int32_t im)
+{
+ union ptr page0, pagep;
+ const char *val0, *valp;
+ int32_t i, nentries;
+
+ nentries = be32toh(*p.i++);
+ printf("macro %02d entry count %d\n", im, nentries);
+ if (nentries == 0)
+ return p.c;
+ valp = val0 = dbm_get(p.i[0]);
+ pagep.i = page0.i = dbm_get(p.i[1]);
+ printf("=== MACRO %02d ===\n", im);
+ for (i = 0; i < nentries; i++) {
+ pchk(dbm_get(*p.i++), &valp, "value", 0);
+ printf("macro %02d # ", im);
+ dump_str(&valp);
+ pchk(dbm_get(*p.i++), &pagep.c, "pages", 0);
+ while (*pagep.i++ != 0)
+ printf("# %s ", (char *)dbm_get(
+ *(int32_t *)dbm_get(pagep.i[-1])) + 1);
+ printf("\n");
+ }
+ printf("=== END OF MACRO %02d ===\n", im);
+ pchk(val0, &p.c, "value0", 0);
+ pchk(page0.c, &valp, "page0", 3);
+ return pagep.c;
+}
+
+static void
+dump_str(const char **cp)
+{
+ if (**cp <= (char)NAME_MASK) {
+ putchar('[');
+ if (**cp & NAME_FILE)
+ putchar('f');
+ if (**cp & NAME_HEAD)
+ putchar('h');
+ if (**cp & NAME_FIRST)
+ putchar('1');
+ if (**cp & NAME_TITLE)
+ putchar('t');
+ if (**cp & NAME_SYN)
+ putchar('s');
+ putchar(']');
+ (*cp)++;
+ }
+ while (**cp != '\0')
+ putchar(*(*cp)++);
+ putchar(' ');
+ (*cp)++;
+}
+
+static void
+dump_lst(const char **cp)
+{
+ while (**cp != '\0') {
+ printf("# ");
+ dump_str(cp);
+ }
+ (*cp)++;
+ printf("\n");
+}
+
+static void
+pchk(const char *want, const char **got, const char *name, int fuzz)
+{
+ if (*got > want || *got + fuzz < want)
+ warnx("%s jumps from 0x%x to 0x%x", name,
+ be32toh(dbm_addr(*got)), be32toh(dbm_addr(want)));
+ *got = want;
+}
--- /dev/null
+# $OpenBSD: Makefile,v 1.1 2016/07/30 10:56:13 schwarze Exp $
+
+PROG = makeinodes
+
+.include <bsd.prog.mk>
--- /dev/null
+.\" $OpenBSD: makeinodes.1,v 1.1 2016/07/30 10:56:13 schwarze Exp $
+.\"
+.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd $Mdocdate: July 30 2016 $
+.Dt MAKEINODES 1
+.Os
+.Sh NAME
+.Nm makeinodes
+.Nd create files such that inode numbers hash in a defined order
+.Sh SYNOPSIS
+.Nm makeinodes
+.Sh DESCRIPTION
+The
+.Nm
+utility creates a directory
+.Pa man/man1/
+and two empty files
+.Pa man/man1/1
+and
+.Pa man/man1/2
+such that the lowest six bits of the inode number of file 1
+are smaller than the lowest six bits of the inode number of file 2.
+.Pp
+This is useful to test the behaviour of the
+.Xr makewhatis 8
+program which hashes files with
+.Xr ohash 3
+according to their inode numbers, such that fully testing all the
+code paths requires test files hashing in a well-defined order.
+.Pp
+Once the files have been created with
+.Nm ,
+their content can be provided with
+.Xr cat 1
+and they can be renamed as desired with
+.Xr mv 1 .
+.Sh EXIT STATUS
+.Ex -std
+It may fail when creation of a directory or file,
+lookup of an inode number, or renaming of a file fails.
+.Sh AUTHORS
+.An Ingo Schwarze Aq Mt schwarze@openbsd.org
--- /dev/null
+/* $OpenBSD: makeinodes.c,v 1.1 2016/07/30 10:56:13 schwarze Exp $ */
+/*
+ * Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#include <sys/stat.h>
+#include <err.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#define HSIZE 64
+
+int
+main(void)
+{
+ struct stat sb1, sb2;
+ long long diff;
+ int fd;
+
+ if (mkdir("man", 0755) == -1)
+ err(1, "mkdir(man)");
+ if (chdir("man") == -1)
+ err(1, "chdir(man)");
+ if (mkdir("man1", 0755) == -1)
+ err(1, "mkdir(man1)");
+ if (chdir("man1") == -1)
+ err(1, "chdir(man1)");
+ if ((fd = open("1", O_WRONLY | O_CREAT | O_EXCL, 0644)) == -1)
+ err(1, "open(1)");
+ if (fstat(fd, &sb1) == -1)
+ err(1, "fstat(1)");
+ if (close(fd) == -1)
+ err(1, "close(1)");
+ if ((fd = open("2", O_WRONLY | O_CREAT | O_EXCL, 0644)) == -1)
+ err(1, "open(2)");
+ if (fstat(fd, &sb2) == -1)
+ err(1, "fstat(2)");
+ if (close(fd) == -1)
+ err(1, "close(2)");
+ while ((diff = sb2.st_ino % HSIZE - sb1.st_ino % HSIZE) == 0) {
+ if ((fd = open("3", O_WRONLY | O_CREAT | O_EXCL, 0644)) == -1)
+ err(1, "open(3)");
+ if (fstat(fd, &sb2) == -1)
+ err(1, "fstat(3)");
+ if (close(fd) == -1)
+ err(1, "close(3)");
+ if (rename("3", "2") == -1)
+ err(1, "rename(3, 2)");
+ }
+ if (diff < 0) {
+ if (rename("1", "3") == -1)
+ err(1, "rename(1, 3)");
+ if (rename("2", "1") == -1)
+ err(1, "rename(2, 1)");
+ if (rename("3", "2") == -1)
+ err(1, "rename(3, 2)");
+ }
+ return 0;
+}
--- /dev/null
+.Dd July 4, 2016
+.Dt EMPTY 1
+.Os
+.Sh NAME
+.Nm empty
+.Nd no title
--- /dev/null
+.Dd July 24, 2016
+.Dt FN 3
+.Os
+.Sh NAME
+.Nm \&Fn
+.Nd indexing of function prototype macros
+.Sh SYNOPSIS
+.Ft fn_type
+.Fn fn_func fn_arg
+.Ft fo_type
+.Fo fo_name
+.Fa fo_arg
+.Fc
--- /dev/null
+.Dd July 28, 2016
+.Dt IN 3
+.Os
+.Sh NAME
+.Nm \&In
+.Nd indexing of include macros
+.Sh SYNOPSIS
+.In in.h
+.Fd #include <fd.h>
--- /dev/null
+.Dd July 28, 2016
+.Dt SH 1
+.Os
+.Sh NAME
+.Nm \&Sh
+.Nd indexing of section header macros
+.Sh sh_title
+sh_text
+.Ss ss_title
+ss_text
--- /dev/null
+.Dd July 5, 2016
+.Dt SORTNAMES 1
+.Os
+.Sh NAME
+.Nm sortnames ,
+.Nm withsyn ,
+.Nm last ,
+.Nm another ,
+.Nm link
+.Nd sorting names
+.Sh SYNOPSIS
+.Nm withsyn
+.Nm onlysyn
--- /dev/null
+.Dd July 28, 2016
+.Dt VA 3
+.Os
+.Sh NAME
+.Nm \&Va
+.Nd indexing of variable type and name macros
+.Sh SYNOPSIS
+.Vt block vt_two
+.Sh DESCRIPTION
+.Vt vt_one
+.Va va_one
+.Vt struct vt_two
+.Va int va_two
--- /dev/null
+.Dd July 24, 2016
+.Dt XR 1
+.Os
+.Sh NAME
+.Nm \&Xr
+.Nd indexing of cross reference macros
+.Sh DESCRIPTION
+Without arguments:
+.Xr
+.Pp
+One argument:
+.Xr bare
+.Pp
+Two arguments:
+.Xr page 1
--- /dev/null
+
+>>> padipage
+dbm_dump: name0 jumps from 0x28 to 0x3c
+dbm_dump: sect0 jumps from 0x44 to 0x54
+dbm_dump: desc0 jumps from 0x57 to 0x5a
+dbm_dump: file0 jumps from 0x63 to 0x6c
+dbm_dump: macros jumps from 0x7b to 0x8c
+
+>>> padfpage
+dbm_dump: name0 jumps from 0x28 to 0x44
+dbm_dump: sect0 jumps from 0x54 to 0x57
+dbm_dump: desc0 jumps from 0x5a to 0x63
+dbm_dump: file0 jumps from 0x6c to 0x7b
+
+>>> padmpage
+dbm_dump: name jumps from 0x58 to 0x68
+dbm_dump: sect jumps from 0x7a to 0x7d
+dbm_dump: desc jumps from 0x89 to 0x92
+dbm_dump: file jumps from 0xaa to 0xba
+dbm_dump: name0 jumps from 0x3c to 0x50
+
+>>> padmacros
+dbm_dump: macros jumps from 0x14 to 0x4c
+
+>>> padimacro
+dbm_dump: macro0 jumps from 0xa8 to 0xac
+
+>>> padmmacro
+dbm_dump: macro jumps from 0xac to 0xb0
+
+>>> padientry
+dbm_dump: value0 jumps from 0xf4 to 0xfc
+dbm_dump: page0 jumps from 0x10c to 0x114
+dbm_dump: macro jumps from 0x124 to 0x12c
+
+>>> padfentry
+dbm_dump: value0 jumps from 0xf4 to 0x103
+dbm_dump: page0 jumps from 0x113 to 0x11c
+
+>>> padmentry
+dbm_dump: value jumps from 0x103 to 0x10c
+dbm_dump: pages jumps from 0x11c to 0x124
+dbm_dump: value0 jumps from 0xf4 to 0xfc
+
+>>> padfmagic
+dbm_dump: end jumps from 0x138 to 0x13c
+
+>>> nonexistent
+dbm_dump: nonexistent.db: No such file or directory
+
+>>> short
+dbm_dump: dbm_map(short.db): File too short
+dbm_dump: short.db: Inappropriate file type or format
+
+>>> badimagic
+dbm_dump: dbm_map(badimagic.db): Bad initial magic 3a7d0cdc (expected 3a7d0cdb)
+dbm_dump: badimagic.db: Inappropriate file type or format
+
+>>> badversion
+dbm_dump: dbm_map(badversion.db): Bad version number 1 (expected 0)
+dbm_dump: badversion.db: Inappropriate file type or format
+
+>>> badmacrosp
+dbm_dump: dbm_get: Database corrupt: offset 1000 > 316
+dbm_dump: dbm_open(badmacrosp.db): Invalid offset of macros array
+dbm_dump: badmacrosp.db: Inappropriate file type or format
+
+>>> badendp
+dbm_dump: dbm_map(badendp.db): Inconsistent file size 316 (expected 317)
+dbm_dump: badendp.db: Inappropriate file type or format
+
+>>> badnpages
+dbm_dump: dbm_open(badnpages.db): Invalid number of pages: -1
+dbm_dump: badnpages.db: Inappropriate file type or format
+
+>>> badnmacros
+dbm_dump: dbm_open(badnmacros.db): Invalid number of macros: 37
+dbm_dump: badnmacros.db: Inappropriate file type or format
+
+>>> badmacrop
+dbm_dump: dbm_get: Database corrupt: offset 1000 > 316
+dbm_dump: dbm_open(badmacrop.db): Invalid offset of macro 0
+dbm_dump: badmacrop.db: Inappropriate file type or format
+
+>>> badfmagic
+dbm_dump: dbm_map(badfmagic.db): Bad final magic 3a7d0cdc (expected 3a7d0cdb)
+dbm_dump: badfmagic.db: Inappropriate file type or format
--- /dev/null
+
+>>> empty
+
+>>> onepage
+empty(1) - no title
+
+>>> twopages
+> second
+man1/second.1
+> empty
+man1/empty.1
+man1/second.1
+
+>>> threepages
+> second
+man1/second.1
+> third
+man1/third.1
+> empty
+man1/empty.1
+man1/second.1
+man1/third.1
+
+>>> threemacros
+> Xr=one
+man1/empty.1
+> Xr~^t
+empty(1) - two(2) # three(3) # one(1)
+
+>>> sortpages
+one, empty(1) - no title
+two, empty(1) - no title
+
+>>> sortpages_rev
+one, empty(1) - no title
+two, empty(1) - no title
+
+>>> so
+man1/one.1
+
+>>> so_rev
+man1/one.1
+
+>>> sortnames
+sortnames, link, withsyn, another, last, onlysyn(1) - sorting names
+
+>>> twosect
+empty(1, 8) - no title
+
+>>> twoarch
+empty(1/amd64, i386) - no title
+
+>>> fn
+> fn_type
+man3/fn.3
+> fn_func
+man3/fn.3
+> fn_arg
+man3/fn.3
+> fo_type
+man3/fn.3
+> fo_func
+> fo_arg
+man3/fn.3
+
+>>> in
+> In
+man3/in.3
+> Fd
+man3/in.3
+
+>>> va
+> b2
+man3/va.3
+> t1
+man3/va.3
+> a1
+man3/va.3
+> t2
+man3/va.3
+> a2
+man3/va.3
+
+>>> sh
+> Sh
+man1/sh.1
+> Ss
+man1/sh.1
+
+>>> xr
+> bare
+man1/xr.1
+> page
+man1/xr.1
--- /dev/null
+initial magic 0x3a7d0cdb
+version 0x00000000
+macros offset 0x00000014
+end offset 0x00000138
+page count 0
+macros count 36
+=== MACROS ===
+macro 00 entry count 0
+macro 01 entry count 0
+macro 02 entry count 0
+macro 03 entry count 0
+macro 04 entry count 0
+macro 05 entry count 0
+macro 06 entry count 0
+macro 07 entry count 0
+macro 08 entry count 0
+macro 09 entry count 0
+macro 10 entry count 0
+macro 11 entry count 0
+macro 12 entry count 0
+macro 13 entry count 0
+macro 14 entry count 0
+macro 15 entry count 0
+macro 16 entry count 0
+macro 17 entry count 0
+macro 18 entry count 0
+macro 19 entry count 0
+macro 20 entry count 0
+macro 21 entry count 0
+macro 22 entry count 0
+macro 23 entry count 0
+macro 24 entry count 0
+macro 25 entry count 0
+macro 26 entry count 0
+macro 27 entry count 0
+macro 28 entry count 0
+macro 29 entry count 0
+macro 30 entry count 0
+macro 31 entry count 0
+macro 32 entry count 0
+macro 33 entry count 0
+macro 34 entry count 0
+macro 35 entry count 0
+=== END OF MACROS ===
+final magic 0x3a7d0cdb
--- /dev/null
+man: nothing appropriate
--- /dev/null
+initial magic 0x3a7d0cdb
+version 0x00000000
+macros offset 0x00000078
+end offset 0x0000022c
+page count 1
+=== PAGES ===
+page name # [f]fn # [1t]Fn # [s]fn_func # [s]fo_name
+page sect # 3
+page desc # indexing of function prototype macros
+page file src # man3/fn.3
+=== END OF PAGES ===
+macros count 36
+=== MACROS ===
+macro 00 entry count 0
+macro 01 entry count 0
+macro 02 entry count 2
+=== MACRO 02 ===
+macro 02 # fo_arg # fn
+macro 02 # fn_arg # fn
+=== END OF MACRO 02 ===
+macro 03 entry count 0
+macro 04 entry count 0
+macro 05 entry count 2
+=== MACRO 05 ===
+macro 05 # fo_name # fn
+macro 05 # fn_func # fn
+=== END OF MACRO 05 ===
+macro 06 entry count 0
+macro 07 entry count 0
+macro 08 entry count 0
+macro 09 entry count 0
+macro 10 entry count 0
+macro 11 entry count 0
+macro 12 entry count 0
+macro 13 entry count 2
+=== MACRO 13 ===
+macro 13 # fo_type # fn
+macro 13 # fn_type # fn
+=== END OF MACRO 13 ===
+macro 14 entry count 0
+macro 15 entry count 0
+macro 16 entry count 0
+macro 17 entry count 0
+macro 18 entry count 0
+macro 19 entry count 0
+macro 20 entry count 0
+macro 21 entry count 0
+macro 22 entry count 0
+macro 23 entry count 0
+macro 24 entry count 0
+macro 25 entry count 0
+macro 26 entry count 0
+macro 27 entry count 0
+macro 28 entry count 0
+macro 29 entry count 0
+macro 30 entry count 0
+macro 31 entry count 0
+macro 32 entry count 0
+macro 33 entry count 0
+macro 34 entry count 0
+macro 35 entry count 0
+=== END OF MACROS ===
+final magic 0x3a7d0cdb
--- /dev/null
+initial magic 0x3a7d0cdb
+version 0x00000000
+macros offset 0x0000005c
+end offset 0x000001ac
+page count 1
+=== PAGES ===
+page name # [f]in # [1t]In
+page sect # 3
+page desc # indexing of include macros
+page file src # man3/in.3
+=== END OF PAGES ===
+macros count 36
+=== MACROS ===
+macro 00 entry count 0
+macro 01 entry count 0
+macro 02 entry count 0
+macro 03 entry count 0
+macro 04 entry count 0
+macro 05 entry count 0
+macro 06 entry count 0
+macro 07 entry count 0
+macro 08 entry count 0
+macro 09 entry count 0
+macro 10 entry count 0
+macro 11 entry count 0
+macro 12 entry count 0
+macro 13 entry count 0
+macro 14 entry count 0
+macro 15 entry count 0
+macro 16 entry count 0
+macro 17 entry count 0
+macro 18 entry count 0
+macro 19 entry count 2
+=== MACRO 19 ===
+macro 19 # fd.h # in
+macro 19 # in.h # in
+=== END OF MACRO 19 ===
+macro 20 entry count 0
+macro 21 entry count 0
+macro 22 entry count 0
+macro 23 entry count 0
+macro 24 entry count 0
+macro 25 entry count 0
+macro 26 entry count 0
+macro 27 entry count 0
+macro 28 entry count 0
+macro 29 entry count 0
+macro 30 entry count 0
+macro 31 entry count 0
+macro 32 entry count 0
+macro 33 entry count 0
+macro 34 entry count 0
+macro 35 entry count 0
+=== END OF MACROS ===
+final magic 0x3a7d0cdb
--- /dev/null
+initial magic 0x3a7d0cdb
+version 0x00000000
+macros offset 0x0000004c
+end offset 0x00000170
+page count 1
+=== PAGES ===
+page name # [f1t]empty
+page sect # 1
+page desc # no title
+page file src # man1/empty.1
+=== END OF PAGES ===
+macros count 36
+=== MACROS ===
+macro 00 entry count 0
+macro 01 entry count 0
+macro 02 entry count 0
+macro 03 entry count 0
+macro 04 entry count 0
+macro 05 entry count 0
+macro 06 entry count 0
+macro 07 entry count 0
+macro 08 entry count 0
+macro 09 entry count 0
+macro 10 entry count 0
+macro 11 entry count 0
+macro 12 entry count 0
+macro 13 entry count 0
+macro 14 entry count 0
+macro 15 entry count 0
+macro 16 entry count 0
+macro 17 entry count 0
+macro 18 entry count 0
+macro 19 entry count 0
+macro 20 entry count 0
+macro 21 entry count 0
+macro 22 entry count 0
+macro 23 entry count 0
+macro 24 entry count 0
+macro 25 entry count 0
+macro 26 entry count 0
+macro 27 entry count 0
+macro 28 entry count 0
+macro 29 entry count 0
+macro 30 entry count 0
+macro 31 entry count 0
+macro 32 entry count 0
+macro 33 entry count 0
+macro 34 entry count 0
+macro 35 entry count 0
+=== END OF MACROS ===
+final magic 0x3a7d0cdb
--- /dev/null
+initial magic 0x3a7d0cdb
+version 0x00000000
+macros offset 0x0000004c
+end offset 0x000001b8
+page count 1
+=== PAGES ===
+page name # [f1t]empty
+page sect # 1
+page desc # no title
+page file src # man1/empty.1
+=== END OF PAGES ===
+macros count 36
+=== MACROS ===
+macro 00 entry count 2
+=== MACRO 00 ===
+macro 00 # three(3) # empty
+macro 00 # one(1) # empty
+=== END OF MACRO 00 ===
+macro 01 entry count 0
+macro 02 entry count 0
+macro 03 entry count 0
+macro 04 entry count 0
+macro 05 entry count 0
+macro 06 entry count 0
+macro 07 entry count 0
+macro 08 entry count 0
+macro 09 entry count 0
+macro 10 entry count 0
+macro 11 entry count 0
+macro 12 entry count 0
+macro 13 entry count 0
+macro 14 entry count 0
+macro 15 entry count 0
+macro 16 entry count 0
+macro 17 entry count 0
+macro 18 entry count 0
+macro 19 entry count 0
+macro 20 entry count 0
+macro 21 entry count 0
+macro 22 entry count 0
+macro 23 entry count 0
+macro 24 entry count 0
+macro 25 entry count 0
+macro 26 entry count 0
+macro 27 entry count 0
+macro 28 entry count 0
+macro 29 entry count 0
+macro 30 entry count 0
+macro 31 entry count 0
+macro 32 entry count 0
+macro 33 entry count 0
+macro 34 entry count 0
+macro 35 entry count 0
+=== END OF MACROS ===
+final magic 0x3a7d0cdb
--- /dev/null
+initial magic 0x3a7d0cdb
+version 0x00000000
+macros offset 0x00000014
+end offset 0x0000013c
+page count 0
+macros count 36
+=== MACROS ===
+macro 00 entry count 0
+macro 01 entry count 0
+macro 02 entry count 0
+macro 03 entry count 0
+macro 04 entry count 0
+macro 05 entry count 0
+macro 06 entry count 0
+macro 07 entry count 0
+macro 08 entry count 0
+macro 09 entry count 0
+macro 10 entry count 0
+macro 11 entry count 0
+macro 12 entry count 0
+macro 13 entry count 0
+macro 14 entry count 0
+macro 15 entry count 0
+macro 16 entry count 0
+macro 17 entry count 0
+macro 18 entry count 0
+macro 19 entry count 0
+macro 20 entry count 0
+macro 21 entry count 0
+macro 22 entry count 0
+macro 23 entry count 0
+macro 24 entry count 0
+macro 25 entry count 0
+macro 26 entry count 0
+macro 27 entry count 0
+macro 28 entry count 0
+macro 29 entry count 0
+macro 30 entry count 0
+macro 31 entry count 0
+macro 32 entry count 0
+macro 33 entry count 0
+macro 34 entry count 0
+macro 35 entry count 0
+=== END OF MACROS ===
+final magic 0x3a7d0cdb
--- /dev/null
+initial magic 0x3a7d0cdb
+version 0x00000000
+macros offset 0x0000008c
+end offset 0x000001b0
+page count 1
+=== PAGES ===
+page name # [f]second # [1t]empty
+page sect # 1
+page desc # no title
+page file src # man1/second.1
+=== END OF PAGES ===
+macros count 36
+=== MACROS ===
+macro 00 entry count 0
+macro 01 entry count 0
+macro 02 entry count 0
+macro 03 entry count 0
+macro 04 entry count 0
+macro 05 entry count 0
+macro 06 entry count 0
+macro 07 entry count 0
+macro 08 entry count 0
+macro 09 entry count 0
+macro 10 entry count 0
+macro 11 entry count 0
+macro 12 entry count 0
+macro 13 entry count 0
+macro 14 entry count 0
+macro 15 entry count 0
+macro 16 entry count 0
+macro 17 entry count 0
+macro 18 entry count 0
+macro 19 entry count 0
+macro 20 entry count 0
+macro 21 entry count 0
+macro 22 entry count 0
+macro 23 entry count 0
+macro 24 entry count 0
+macro 25 entry count 0
+macro 26 entry count 0
+macro 27 entry count 0
+macro 28 entry count 0
+macro 29 entry count 0
+macro 30 entry count 0
+macro 31 entry count 0
+macro 32 entry count 0
+macro 33 entry count 0
+macro 34 entry count 0
+macro 35 entry count 0
+=== END OF MACROS ===
+final magic 0x3a7d0cdb
--- /dev/null
+initial magic 0x3a7d0cdb
+version 0x00000000
+macros offset 0x0000004c
+end offset 0x000001b8
+page count 1
+=== PAGES ===
+page name # [f1t]empty
+page sect # 1
+page desc # no title
+page file src # man1/empty.1
+=== END OF PAGES ===
+macros count 36
+=== MACROS ===
+macro 00 entry count 2
+=== MACRO 00 ===
+macro 00 # two(2) # empty
+macro 00 # three(3) # empty
+=== END OF MACRO 00 ===
+macro 01 entry count 0
+macro 02 entry count 0
+macro 03 entry count 0
+macro 04 entry count 0
+macro 05 entry count 0
+macro 06 entry count 0
+macro 07 entry count 0
+macro 08 entry count 0
+macro 09 entry count 0
+macro 10 entry count 0
+macro 11 entry count 0
+macro 12 entry count 0
+macro 13 entry count 0
+macro 14 entry count 0
+macro 15 entry count 0
+macro 16 entry count 0
+macro 17 entry count 0
+macro 18 entry count 0
+macro 19 entry count 0
+macro 20 entry count 0
+macro 21 entry count 0
+macro 22 entry count 0
+macro 23 entry count 0
+macro 24 entry count 0
+macro 25 entry count 0
+macro 26 entry count 0
+macro 27 entry count 0
+macro 28 entry count 0
+macro 29 entry count 0
+macro 30 entry count 0
+macro 31 entry count 0
+macro 32 entry count 0
+macro 33 entry count 0
+macro 34 entry count 0
+macro 35 entry count 0
+=== END OF MACROS ===
+final magic 0x3a7d0cdb
--- /dev/null
+initial magic 0x3a7d0cdb
+version 0x00000000
+macros offset 0x00000014
+end offset 0x0000013c
+page count 0
+macros count 36
+=== MACROS ===
+macro 00 entry count 0
+macro 01 entry count 0
+macro 02 entry count 0
+macro 03 entry count 0
+macro 04 entry count 0
+macro 05 entry count 0
+macro 06 entry count 0
+macro 07 entry count 0
+macro 08 entry count 0
+macro 09 entry count 0
+macro 10 entry count 0
+macro 11 entry count 0
+macro 12 entry count 0
+macro 13 entry count 0
+macro 14 entry count 0
+macro 15 entry count 0
+macro 16 entry count 0
+macro 17 entry count 0
+macro 18 entry count 0
+macro 19 entry count 0
+macro 20 entry count 0
+macro 21 entry count 0
+macro 22 entry count 0
+macro 23 entry count 0
+macro 24 entry count 0
+macro 25 entry count 0
+macro 26 entry count 0
+macro 27 entry count 0
+macro 28 entry count 0
+macro 29 entry count 0
+macro 30 entry count 0
+macro 31 entry count 0
+macro 32 entry count 0
+macro 33 entry count 0
+macro 34 entry count 0
+macro 35 entry count 0
+=== END OF MACROS ===
+final magic 0x3a7d0cdb
--- /dev/null
+initial magic 0x3a7d0cdb
+version 0x00000000
+macros offset 0x0000008c
+end offset 0x000001b0
+page count 1
+=== PAGES ===
+page name # [f1t]empty
+page sect # 1
+page desc # no title
+page file src # man1/empty.1
+=== END OF PAGES ===
+macros count 36
+=== MACROS ===
+macro 00 entry count 0
+macro 01 entry count 0
+macro 02 entry count 0
+macro 03 entry count 0
+macro 04 entry count 0
+macro 05 entry count 0
+macro 06 entry count 0
+macro 07 entry count 0
+macro 08 entry count 0
+macro 09 entry count 0
+macro 10 entry count 0
+macro 11 entry count 0
+macro 12 entry count 0
+macro 13 entry count 0
+macro 14 entry count 0
+macro 15 entry count 0
+macro 16 entry count 0
+macro 17 entry count 0
+macro 18 entry count 0
+macro 19 entry count 0
+macro 20 entry count 0
+macro 21 entry count 0
+macro 22 entry count 0
+macro 23 entry count 0
+macro 24 entry count 0
+macro 25 entry count 0
+macro 26 entry count 0
+macro 27 entry count 0
+macro 28 entry count 0
+macro 29 entry count 0
+macro 30 entry count 0
+macro 31 entry count 0
+macro 32 entry count 0
+macro 33 entry count 0
+macro 34 entry count 0
+macro 35 entry count 0
+=== END OF MACROS ===
+final magic 0x3a7d0cdb
--- /dev/null
+initial magic 0x3a7d0cdb
+version 0x00000000
+macros offset 0x0000004c
+end offset 0x00000170
+page count 0
+macros count 36
+=== MACROS ===
+macro 00 entry count 0
+macro 01 entry count 0
+macro 02 entry count 0
+macro 03 entry count 0
+macro 04 entry count 0
+macro 05 entry count 0
+macro 06 entry count 0
+macro 07 entry count 0
+macro 08 entry count 0
+macro 09 entry count 0
+macro 10 entry count 0
+macro 11 entry count 0
+macro 12 entry count 0
+macro 13 entry count 0
+macro 14 entry count 0
+macro 15 entry count 0
+macro 16 entry count 0
+macro 17 entry count 0
+macro 18 entry count 0
+macro 19 entry count 0
+macro 20 entry count 0
+macro 21 entry count 0
+macro 22 entry count 0
+macro 23 entry count 0
+macro 24 entry count 0
+macro 25 entry count 0
+macro 26 entry count 0
+macro 27 entry count 0
+macro 28 entry count 0
+macro 29 entry count 0
+macro 30 entry count 0
+macro 31 entry count 0
+macro 32 entry count 0
+macro 33 entry count 0
+macro 34 entry count 0
+macro 35 entry count 0
+=== END OF MACROS ===
+final magic 0x3a7d0cdb
--- /dev/null
+initial magic 0x3a7d0cdb
+version 0x00000000
+macros offset 0x0000004c
+end offset 0x000001b8
+page count 1
+=== PAGES ===
+page name # [f1t]empty
+page sect # 1
+page desc # no title
+page file src # man1/empty.1
+=== END OF PAGES ===
+macros count 36
+=== MACROS ===
+macro 00 entry count 2
+=== MACRO 00 ===
+macro 00 # two(2) # empty
+macro 00 # one(1) # empty
+=== END OF MACRO 00 ===
+macro 01 entry count 0
+macro 02 entry count 0
+macro 03 entry count 0
+macro 04 entry count 0
+macro 05 entry count 0
+macro 06 entry count 0
+macro 07 entry count 0
+macro 08 entry count 0
+macro 09 entry count 0
+macro 10 entry count 0
+macro 11 entry count 0
+macro 12 entry count 0
+macro 13 entry count 0
+macro 14 entry count 0
+macro 15 entry count 0
+macro 16 entry count 0
+macro 17 entry count 0
+macro 18 entry count 0
+macro 19 entry count 0
+macro 20 entry count 0
+macro 21 entry count 0
+macro 22 entry count 0
+macro 23 entry count 0
+macro 24 entry count 0
+macro 25 entry count 0
+macro 26 entry count 0
+macro 27 entry count 0
+macro 28 entry count 0
+macro 29 entry count 0
+macro 30 entry count 0
+macro 31 entry count 0
+macro 32 entry count 0
+macro 33 entry count 0
+macro 34 entry count 0
+macro 35 entry count 0
+=== END OF MACROS ===
+final magic 0x3a7d0cdb
--- /dev/null
+initial magic 0x3a7d0cdb
+version 0x00000000
+macros offset 0x00000014
+end offset 0x0000013c
+page count 0
+macros count 36
+=== MACROS ===
+macro 00 entry count 0
+macro 01 entry count 0
+macro 02 entry count 0
+macro 03 entry count 0
+macro 04 entry count 0
+macro 05 entry count 0
+macro 06 entry count 0
+macro 07 entry count 0
+macro 08 entry count 0
+macro 09 entry count 0
+macro 10 entry count 0
+macro 11 entry count 0
+macro 12 entry count 0
+macro 13 entry count 0
+macro 14 entry count 0
+macro 15 entry count 0
+macro 16 entry count 0
+macro 17 entry count 0
+macro 18 entry count 0
+macro 19 entry count 0
+macro 20 entry count 0
+macro 21 entry count 0
+macro 22 entry count 0
+macro 23 entry count 0
+macro 24 entry count 0
+macro 25 entry count 0
+macro 26 entry count 0
+macro 27 entry count 0
+macro 28 entry count 0
+macro 29 entry count 0
+macro 30 entry count 0
+macro 31 entry count 0
+macro 32 entry count 0
+macro 33 entry count 0
+macro 34 entry count 0
+macro 35 entry count 0
+=== END OF MACROS ===
+final magic 0x3a7d0cdb
--- /dev/null
+initial magic 0x3a7d0cdb
+version 0x00000000
+macros offset 0x000000cc
+end offset 0x000001f0
+page count 2
+=== PAGES ===
+page name # [f1t]empty
+page sect # 1
+page desc # no title
+page file src # man1/empty.1
+page name # [f]third # [1t]empty
+page sect # 1
+page desc # no title
+page file src # man1/third.1
+=== END OF PAGES ===
+macros count 36
+=== MACROS ===
+macro 00 entry count 0
+macro 01 entry count 0
+macro 02 entry count 0
+macro 03 entry count 0
+macro 04 entry count 0
+macro 05 entry count 0
+macro 06 entry count 0
+macro 07 entry count 0
+macro 08 entry count 0
+macro 09 entry count 0
+macro 10 entry count 0
+macro 11 entry count 0
+macro 12 entry count 0
+macro 13 entry count 0
+macro 14 entry count 0
+macro 15 entry count 0
+macro 16 entry count 0
+macro 17 entry count 0
+macro 18 entry count 0
+macro 19 entry count 0
+macro 20 entry count 0
+macro 21 entry count 0
+macro 22 entry count 0
+macro 23 entry count 0
+macro 24 entry count 0
+macro 25 entry count 0
+macro 26 entry count 0
+macro 27 entry count 0
+macro 28 entry count 0
+macro 29 entry count 0
+macro 30 entry count 0
+macro 31 entry count 0
+macro 32 entry count 0
+macro 33 entry count 0
+macro 34 entry count 0
+macro 35 entry count 0
+=== END OF MACROS ===
+final magic 0x3a7d0cdb
--- /dev/null
+initial magic 0x3a7d0cdb
+version 0x00000000
+macros offset 0x00000064
+end offset 0x000001c0
+page count 1
+=== PAGES ===
+page name # [f]sh # [1t]Sh
+page sect # 1
+page desc # indexing of section header macros
+page file src # man1/sh.1
+=== END OF PAGES ===
+macros count 36
+=== MACROS ===
+macro 00 entry count 0
+macro 01 entry count 0
+macro 02 entry count 0
+macro 03 entry count 0
+macro 04 entry count 0
+macro 05 entry count 0
+macro 06 entry count 0
+macro 07 entry count 0
+macro 08 entry count 0
+macro 09 entry count 0
+macro 10 entry count 0
+macro 11 entry count 0
+macro 12 entry count 0
+macro 13 entry count 0
+macro 14 entry count 0
+macro 15 entry count 0
+macro 16 entry count 0
+macro 17 entry count 0
+macro 18 entry count 1
+=== MACRO 18 ===
+macro 18 # sh_title # sh
+=== END OF MACRO 18 ===
+macro 19 entry count 0
+macro 20 entry count 1
+=== MACRO 20 ===
+macro 20 # ss_title # sh
+=== END OF MACRO 20 ===
+macro 21 entry count 0
+macro 22 entry count 0
+macro 23 entry count 0
+macro 24 entry count 0
+macro 25 entry count 0
+macro 26 entry count 0
+macro 27 entry count 0
+macro 28 entry count 0
+macro 29 entry count 0
+macro 30 entry count 0
+macro 31 entry count 0
+macro 32 entry count 0
+macro 33 entry count 0
+macro 34 entry count 0
+macro 35 entry count 0
+=== END OF MACROS ===
+final magic 0x3a7d0cdb
--- /dev/null
+initial magic 0x3a7d0cdb
+version 0x00000000
+macros offset 0x00000060
+end offset 0x00000184
+page count 1
+=== PAGES ===
+page name # [f]one # [f]two # [1t]empty
+page sect # 1
+page desc # no title
+page file src # man1/one.1 # man1/two.1
+=== END OF PAGES ===
+macros count 36
+=== MACROS ===
+macro 00 entry count 0
+macro 01 entry count 0
+macro 02 entry count 0
+macro 03 entry count 0
+macro 04 entry count 0
+macro 05 entry count 0
+macro 06 entry count 0
+macro 07 entry count 0
+macro 08 entry count 0
+macro 09 entry count 0
+macro 10 entry count 0
+macro 11 entry count 0
+macro 12 entry count 0
+macro 13 entry count 0
+macro 14 entry count 0
+macro 15 entry count 0
+macro 16 entry count 0
+macro 17 entry count 0
+macro 18 entry count 0
+macro 19 entry count 0
+macro 20 entry count 0
+macro 21 entry count 0
+macro 22 entry count 0
+macro 23 entry count 0
+macro 24 entry count 0
+macro 25 entry count 0
+macro 26 entry count 0
+macro 27 entry count 0
+macro 28 entry count 0
+macro 29 entry count 0
+macro 30 entry count 0
+macro 31 entry count 0
+macro 32 entry count 0
+macro 33 entry count 0
+macro 34 entry count 0
+macro 35 entry count 0
+=== END OF MACROS ===
+final magic 0x3a7d0cdb
--- /dev/null
+initial magic 0x3a7d0cdb
+version 0x00000000
+macros offset 0x00000060
+end offset 0x00000184
+page count 1
+=== PAGES ===
+page name # [f]one # [f]two # [1t]empty
+page sect # 1
+page desc # no title
+page file src # man1/one.1 # man1/two.1
+=== END OF PAGES ===
+macros count 36
+=== MACROS ===
+macro 00 entry count 0
+macro 01 entry count 0
+macro 02 entry count 0
+macro 03 entry count 0
+macro 04 entry count 0
+macro 05 entry count 0
+macro 06 entry count 0
+macro 07 entry count 0
+macro 08 entry count 0
+macro 09 entry count 0
+macro 10 entry count 0
+macro 11 entry count 0
+macro 12 entry count 0
+macro 13 entry count 0
+macro 14 entry count 0
+macro 15 entry count 0
+macro 16 entry count 0
+macro 17 entry count 0
+macro 18 entry count 0
+macro 19 entry count 0
+macro 20 entry count 0
+macro 21 entry count 0
+macro 22 entry count 0
+macro 23 entry count 0
+macro 24 entry count 0
+macro 25 entry count 0
+macro 26 entry count 0
+macro 27 entry count 0
+macro 28 entry count 0
+macro 29 entry count 0
+macro 30 entry count 0
+macro 31 entry count 0
+macro 32 entry count 0
+macro 33 entry count 0
+macro 34 entry count 0
+macro 35 entry count 0
+=== END OF MACROS ===
+final magic 0x3a7d0cdb
--- /dev/null
+initial magic 0x3a7d0cdb
+version 0x00000000
+macros offset 0x0000008c
+end offset 0x000001b0
+page count 1
+=== PAGES ===
+page name # [f1t]sortnames # [ft]link # [ts]withsyn # [t]another # [t]last # [s]onlysyn
+page sect # 1
+page desc # sorting names
+page file src # man1/link.1 # man1/sortnames.1
+=== END OF PAGES ===
+macros count 36
+=== MACROS ===
+macro 00 entry count 0
+macro 01 entry count 0
+macro 02 entry count 0
+macro 03 entry count 0
+macro 04 entry count 0
+macro 05 entry count 0
+macro 06 entry count 0
+macro 07 entry count 0
+macro 08 entry count 0
+macro 09 entry count 0
+macro 10 entry count 0
+macro 11 entry count 0
+macro 12 entry count 0
+macro 13 entry count 0
+macro 14 entry count 0
+macro 15 entry count 0
+macro 16 entry count 0
+macro 17 entry count 0
+macro 18 entry count 0
+macro 19 entry count 0
+macro 20 entry count 0
+macro 21 entry count 0
+macro 22 entry count 0
+macro 23 entry count 0
+macro 24 entry count 0
+macro 25 entry count 0
+macro 26 entry count 0
+macro 27 entry count 0
+macro 28 entry count 0
+macro 29 entry count 0
+macro 30 entry count 0
+macro 31 entry count 0
+macro 32 entry count 0
+macro 33 entry count 0
+macro 34 entry count 0
+macro 35 entry count 0
+=== END OF MACROS ===
+final magic 0x3a7d0cdb
--- /dev/null
+initial magic 0x3a7d0cdb
+version 0x00000000
+macros offset 0x00000088
+end offset 0x000001ac
+page count 2
+=== PAGES ===
+page name # [f]one # [1t]empty
+page sect # 1
+page desc # no title
+page file src # man1/one.1
+page name # [f]two # [1t]empty
+page sect # 1
+page desc # no title
+page file src # man1/two.1
+=== END OF PAGES ===
+macros count 36
+=== MACROS ===
+macro 00 entry count 0
+macro 01 entry count 0
+macro 02 entry count 0
+macro 03 entry count 0
+macro 04 entry count 0
+macro 05 entry count 0
+macro 06 entry count 0
+macro 07 entry count 0
+macro 08 entry count 0
+macro 09 entry count 0
+macro 10 entry count 0
+macro 11 entry count 0
+macro 12 entry count 0
+macro 13 entry count 0
+macro 14 entry count 0
+macro 15 entry count 0
+macro 16 entry count 0
+macro 17 entry count 0
+macro 18 entry count 0
+macro 19 entry count 0
+macro 20 entry count 0
+macro 21 entry count 0
+macro 22 entry count 0
+macro 23 entry count 0
+macro 24 entry count 0
+macro 25 entry count 0
+macro 26 entry count 0
+macro 27 entry count 0
+macro 28 entry count 0
+macro 29 entry count 0
+macro 30 entry count 0
+macro 31 entry count 0
+macro 32 entry count 0
+macro 33 entry count 0
+macro 34 entry count 0
+macro 35 entry count 0
+=== END OF MACROS ===
+final magic 0x3a7d0cdb
--- /dev/null
+initial magic 0x3a7d0cdb
+version 0x00000000
+macros offset 0x00000088
+end offset 0x000001ac
+page count 2
+=== PAGES ===
+page name # [f]one # [1t]empty
+page sect # 1
+page desc # no title
+page file src # man1/one.1
+page name # [f]two # [1t]empty
+page sect # 1
+page desc # no title
+page file src # man1/two.1
+=== END OF PAGES ===
+macros count 36
+=== MACROS ===
+macro 00 entry count 0
+macro 01 entry count 0
+macro 02 entry count 0
+macro 03 entry count 0
+macro 04 entry count 0
+macro 05 entry count 0
+macro 06 entry count 0
+macro 07 entry count 0
+macro 08 entry count 0
+macro 09 entry count 0
+macro 10 entry count 0
+macro 11 entry count 0
+macro 12 entry count 0
+macro 13 entry count 0
+macro 14 entry count 0
+macro 15 entry count 0
+macro 16 entry count 0
+macro 17 entry count 0
+macro 18 entry count 0
+macro 19 entry count 0
+macro 20 entry count 0
+macro 21 entry count 0
+macro 22 entry count 0
+macro 23 entry count 0
+macro 24 entry count 0
+macro 25 entry count 0
+macro 26 entry count 0
+macro 27 entry count 0
+macro 28 entry count 0
+macro 29 entry count 0
+macro 30 entry count 0
+macro 31 entry count 0
+macro 32 entry count 0
+macro 33 entry count 0
+macro 34 entry count 0
+macro 35 entry count 0
+=== END OF MACROS ===
+final magic 0x3a7d0cdb
--- /dev/null
+initial magic 0x3a7d0cdb
+version 0x00000000
+macros offset 0x0000004c
+end offset 0x000001b8
+page count 1
+=== PAGES ===
+page name # [f1t]empty
+page sect # 1
+page desc # no title
+page file src # man1/empty.1
+=== END OF PAGES ===
+macros count 36
+=== MACROS ===
+macro 00 entry count 3
+=== MACRO 00 ===
+macro 00 # two(2) # empty
+macro 00 # three(3) # empty
+macro 00 # one(1) # empty
+=== END OF MACRO 00 ===
+macro 01 entry count 0
+macro 02 entry count 0
+macro 03 entry count 0
+macro 04 entry count 0
+macro 05 entry count 0
+macro 06 entry count 0
+macro 07 entry count 0
+macro 08 entry count 0
+macro 09 entry count 0
+macro 10 entry count 0
+macro 11 entry count 0
+macro 12 entry count 0
+macro 13 entry count 0
+macro 14 entry count 0
+macro 15 entry count 0
+macro 16 entry count 0
+macro 17 entry count 0
+macro 18 entry count 0
+macro 19 entry count 0
+macro 20 entry count 0
+macro 21 entry count 0
+macro 22 entry count 0
+macro 23 entry count 0
+macro 24 entry count 0
+macro 25 entry count 0
+macro 26 entry count 0
+macro 27 entry count 0
+macro 28 entry count 0
+macro 29 entry count 0
+macro 30 entry count 0
+macro 31 entry count 0
+macro 32 entry count 0
+macro 33 entry count 0
+macro 34 entry count 0
+macro 35 entry count 0
+=== END OF MACROS ===
+final magic 0x3a7d0cdb
--- /dev/null
+initial magic 0x3a7d0cdb
+version 0x00000000
+macros offset 0x000000cc
+end offset 0x000001f0
+page count 3
+=== PAGES ===
+page name # [f1t]empty
+page sect # 1
+page desc # no title
+page file src # man1/empty.1
+page name # [f]second # [1t]empty
+page sect # 1
+page desc # no title
+page file src # man1/second.1
+page name # [f]third # [1t]empty
+page sect # 1
+page desc # no title
+page file src # man1/third.1
+=== END OF PAGES ===
+macros count 36
+=== MACROS ===
+macro 00 entry count 0
+macro 01 entry count 0
+macro 02 entry count 0
+macro 03 entry count 0
+macro 04 entry count 0
+macro 05 entry count 0
+macro 06 entry count 0
+macro 07 entry count 0
+macro 08 entry count 0
+macro 09 entry count 0
+macro 10 entry count 0
+macro 11 entry count 0
+macro 12 entry count 0
+macro 13 entry count 0
+macro 14 entry count 0
+macro 15 entry count 0
+macro 16 entry count 0
+macro 17 entry count 0
+macro 18 entry count 0
+macro 19 entry count 0
+macro 20 entry count 0
+macro 21 entry count 0
+macro 22 entry count 0
+macro 23 entry count 0
+macro 24 entry count 0
+macro 25 entry count 0
+macro 26 entry count 0
+macro 27 entry count 0
+macro 28 entry count 0
+macro 29 entry count 0
+macro 30 entry count 0
+macro 31 entry count 0
+macro 32 entry count 0
+macro 33 entry count 0
+macro 34 entry count 0
+macro 35 entry count 0
+=== END OF MACROS ===
+final magic 0x3a7d0cdb
--- /dev/null
+initial magic 0x3a7d0cdb
+version 0x00000000
+macros offset 0x00000070
+end offset 0x00000194
+page count 1
+=== PAGES ===
+page name # [f1t]empty
+page sect # 1
+page arch # amd64 # i386
+page desc # no title
+page file src # man1/amd64/empty.1 # man1/i386/empty.1
+=== END OF PAGES ===
+macros count 36
+=== MACROS ===
+macro 00 entry count 0
+macro 01 entry count 0
+macro 02 entry count 0
+macro 03 entry count 0
+macro 04 entry count 0
+macro 05 entry count 0
+macro 06 entry count 0
+macro 07 entry count 0
+macro 08 entry count 0
+macro 09 entry count 0
+macro 10 entry count 0
+macro 11 entry count 0
+macro 12 entry count 0
+macro 13 entry count 0
+macro 14 entry count 0
+macro 15 entry count 0
+macro 16 entry count 0
+macro 17 entry count 0
+macro 18 entry count 0
+macro 19 entry count 0
+macro 20 entry count 0
+macro 21 entry count 0
+macro 22 entry count 0
+macro 23 entry count 0
+macro 24 entry count 0
+macro 25 entry count 0
+macro 26 entry count 0
+macro 27 entry count 0
+macro 28 entry count 0
+macro 29 entry count 0
+macro 30 entry count 0
+macro 31 entry count 0
+macro 32 entry count 0
+macro 33 entry count 0
+macro 34 entry count 0
+macro 35 entry count 0
+=== END OF MACROS ===
+final magic 0x3a7d0cdb
--- /dev/null
+initial magic 0x3a7d0cdb
+version 0x00000000
+macros offset 0x0000008c
+end offset 0x000001b0
+page count 2
+=== PAGES ===
+page name # [f1t]empty
+page sect # 1
+page desc # no title
+page file src # man1/empty.1
+page name # [f]second # [1t]empty
+page sect # 1
+page desc # no title
+page file src # man1/second.1
+=== END OF PAGES ===
+macros count 36
+=== MACROS ===
+macro 00 entry count 0
+macro 01 entry count 0
+macro 02 entry count 0
+macro 03 entry count 0
+macro 04 entry count 0
+macro 05 entry count 0
+macro 06 entry count 0
+macro 07 entry count 0
+macro 08 entry count 0
+macro 09 entry count 0
+macro 10 entry count 0
+macro 11 entry count 0
+macro 12 entry count 0
+macro 13 entry count 0
+macro 14 entry count 0
+macro 15 entry count 0
+macro 16 entry count 0
+macro 17 entry count 0
+macro 18 entry count 0
+macro 19 entry count 0
+macro 20 entry count 0
+macro 21 entry count 0
+macro 22 entry count 0
+macro 23 entry count 0
+macro 24 entry count 0
+macro 25 entry count 0
+macro 26 entry count 0
+macro 27 entry count 0
+macro 28 entry count 0
+macro 29 entry count 0
+macro 30 entry count 0
+macro 31 entry count 0
+macro 32 entry count 0
+macro 33 entry count 0
+macro 34 entry count 0
+macro 35 entry count 0
+=== END OF MACROS ===
+final magic 0x3a7d0cdb
--- /dev/null
+initial magic 0x3a7d0cdb
+version 0x00000000
+macros offset 0x0000005c
+end offset 0x00000180
+page count 1
+=== PAGES ===
+page name # [f1t]empty
+page sect # 1 # 8
+page desc # no title
+page file src # man8/empty.8 # man1/empty.1
+=== END OF PAGES ===
+macros count 36
+=== MACROS ===
+macro 00 entry count 0
+macro 01 entry count 0
+macro 02 entry count 0
+macro 03 entry count 0
+macro 04 entry count 0
+macro 05 entry count 0
+macro 06 entry count 0
+macro 07 entry count 0
+macro 08 entry count 0
+macro 09 entry count 0
+macro 10 entry count 0
+macro 11 entry count 0
+macro 12 entry count 0
+macro 13 entry count 0
+macro 14 entry count 0
+macro 15 entry count 0
+macro 16 entry count 0
+macro 17 entry count 0
+macro 18 entry count 0
+macro 19 entry count 0
+macro 20 entry count 0
+macro 21 entry count 0
+macro 22 entry count 0
+macro 23 entry count 0
+macro 24 entry count 0
+macro 25 entry count 0
+macro 26 entry count 0
+macro 27 entry count 0
+macro 28 entry count 0
+macro 29 entry count 0
+macro 30 entry count 0
+macro 31 entry count 0
+macro 32 entry count 0
+macro 33 entry count 0
+macro 34 entry count 0
+macro 35 entry count 0
+=== END OF MACROS ===
+final magic 0x3a7d0cdb
--- /dev/null
+initial magic 0x3a7d0cdb
+version 0x00000000
+macros offset 0x0000006c
+end offset 0x00000250
+page count 1
+=== PAGES ===
+page name # [f]va # [1t]Va
+page sect # 3
+page desc # indexing of variable type and name macros
+page file src # man3/va.3
+=== END OF PAGES ===
+macros count 36
+=== MACROS ===
+macro 00 entry count 0
+macro 01 entry count 0
+macro 02 entry count 0
+macro 03 entry count 0
+macro 04 entry count 0
+macro 05 entry count 0
+macro 06 entry count 0
+macro 07 entry count 0
+macro 08 entry count 0
+macro 09 entry count 0
+macro 10 entry count 0
+macro 11 entry count 0
+macro 12 entry count 3
+=== MACRO 12 ===
+macro 12 # va_one # va
+macro 12 # int va_two # va
+macro 12 # block vt_two # va
+=== END OF MACRO 12 ===
+macro 13 entry count 0
+macro 14 entry count 0
+macro 15 entry count 0
+macro 16 entry count 0
+macro 17 entry count 0
+macro 18 entry count 0
+macro 19 entry count 0
+macro 20 entry count 0
+macro 21 entry count 0
+macro 22 entry count 0
+macro 23 entry count 0
+macro 24 entry count 0
+macro 25 entry count 0
+macro 26 entry count 0
+macro 27 entry count 0
+macro 28 entry count 0
+macro 29 entry count 0
+macro 30 entry count 0
+macro 31 entry count 0
+macro 32 entry count 0
+macro 33 entry count 0
+macro 34 entry count 4
+=== MACRO 34 ===
+macro 34 # struct vt_two # va
+macro 34 # int va_two # va
+macro 34 # vt_one # va
+macro 34 # block vt_two # va
+=== END OF MACRO 34 ===
+macro 35 entry count 0
+=== END OF MACROS ===
+final magic 0x3a7d0cdb
--- /dev/null
+initial magic 0x3a7d0cdb
+version 0x00000000
+macros offset 0x00000064
+end offset 0x000001b8
+page count 1
+=== PAGES ===
+page name # [f]xr # [1t]Xr
+page sect # 1
+page desc # indexing of cross reference macros
+page file src # man1/xr.1
+=== END OF PAGES ===
+macros count 36
+=== MACROS ===
+macro 00 entry count 2
+=== MACRO 00 ===
+macro 00 # page(1) # xr
+macro 00 # bare # xr
+=== END OF MACRO 00 ===
+macro 01 entry count 0
+macro 02 entry count 0
+macro 03 entry count 0
+macro 04 entry count 0
+macro 05 entry count 0
+macro 06 entry count 0
+macro 07 entry count 0
+macro 08 entry count 0
+macro 09 entry count 0
+macro 10 entry count 0
+macro 11 entry count 0
+macro 12 entry count 0
+macro 13 entry count 0
+macro 14 entry count 0
+macro 15 entry count 0
+macro 16 entry count 0
+macro 17 entry count 0
+macro 18 entry count 0
+macro 19 entry count 0
+macro 20 entry count 0
+macro 21 entry count 0
+macro 22 entry count 0
+macro 23 entry count 0
+macro 24 entry count 0
+macro 25 entry count 0
+macro 26 entry count 0
+macro 27 entry count 0
+macro 28 entry count 0
+macro 29 entry count 0
+macro 30 entry count 0
+macro 31 entry count 0
+macro 32 entry count 0
+macro 33 entry count 0
+macro 34 entry count 0
+macro 35 entry count 0
+=== END OF MACROS ===
+final magic 0x3a7d0cdb
--- /dev/null
+# $OpenBSD: Makefile,v 1.1 2016/07/30 10:56:13 schwarze Exp $
+#
+# Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+OUT_TESTS = empty onepage twopages threepages threemacros
+OUT_TESTS += sortpages sortpages_rev so so_rev sortnames twosect twoarch
+OUT_TESTS += fn in va sh xr
+BOTH_TESTS = padipage padfpage padmpage padmacros padimacro padmmacro
+BOTH_TESTS += padientry padfentry padmentry padfmagic
+ERR_TESTS = nonexistent short badimagic badversion badmacrosp badendp
+ERR_TESTS += badnpages badnmacros badmacrop badfmagic
+ALL_TESTS = ${OUT_TESTS} ${BOTH_TESTS} ${ERR_TESTS}
+
+REGRESS_TARGETS = ${ALL_TESTS} diff.derr diff.mout diff.merr
+
+CLEANFILES = ${ALL_TESTS:C/$/.db/}
+CLEANFILES += ${ALL_TESTS:C/$/.dout/} ${ALL_TESTS:C/$/.derr/} all.derr
+CLEANFILES += ${OUT_TESTS:C/$/.mout/} all.mout empty.merr
+
+# === MAIN REGRESSION TARGETS ==========================================
+
+.for NAME in ${OUT_TESTS}
+${NAME}: ${NAME}.dout ${NAME}.derr
+ test \! -s ${NAME}.derr
+ @echo diffing ${NAME}.dout
+ @diff -u ${.CURDIR}/../out/${NAME}.dout ${NAME}.dout
+.endfor
+
+.for NAME in ${BOTH_TESTS}
+${NAME}: ${NAME}.dout ${NAME}.derr
+ test -s ${NAME}.derr
+ @echo diffing ${NAME}.dout
+ @diff -u ${.CURDIR}/../out/${NAME}.dout ${NAME}.dout
+.endfor
+
+.for NAME in ${ERR_TESTS}
+${NAME}: ${NAME}.dout ${NAME}.derr
+ test -s ${NAME}.derr
+ test \! -s ${NAME}.dout
+.endfor
+
+diff.derr: all.derr
+ @echo diffing all.derr
+ @diff -u ${.CURDIR}/../out/all.derr all.derr
+
+diff.mout: all.mout
+ @echo diffing all.mout
+ @diff -u ${.CURDIR}/../out/all.mout all.mout
+
+diff.merr: empty.merr
+ @echo diffing empty.merr
+ @diff -u ${.CURDIR}/../out/empty.merr empty.merr
+
+.PHONY: ${REGRESS_TARGETS}
+
+cleandir: cleandir_local
+
+cleandir_local:
+ rm -rf man binedit dbm_dump makeinodes
+
+
+# === RUNNING DBM_DUMP =================================================
+
+.for NAME in ${OUT_TESTS} ${BOTH_TESTS}
+${NAME}.dout ${NAME}.derr: dbm_dump ${NAME}.db
+ ./dbm_dump ${NAME}.db > ${NAME}.dout 2> ${NAME}.derr
+.endfor
+
+.for NAME in ${ERR_TESTS}
+${NAME}.dout ${NAME}.derr: dbm_dump ${NAME}.db
+ @echo dumping ${NAME}.db
+ @if ./dbm_dump ${NAME}.db > ${NAME}.dout 2> ${NAME}.derr; \
+ then false; else true; fi
+.endfor
+
+all.derr: ${BOTH_TESTS:C/$/.derr/} ${ERR_TESTS:C/$/.derr/}
+ @echo assembling $@
+ @for f in ${BOTH_TESTS} ${ERR_TESTS}; \
+ do printf "\n>>> $$f\n"; cat $$f.derr; done > $@
+
+
+# === RUNNING MAKEWHATIS AND MAN =======================================
+
+empty.db empty.mout empty.merr:
+ @echo making empty.db
+ @rm -rf man
+ @mkdir man
+ @makewhatis man
+ @if man -kM man something > empty.mout 2> empty.merr; \
+ then false; else test $$? -eq 5; fi
+ @mv man/mandoc.new.db empty.db
+ @rmdir man
+
+onepage.db onepage.mout: ${.CURDIR}/../man/empty.1
+ @echo making onepage.db
+ @rm -rf man
+ @mkdir -p man/man1
+ @cp ${.CURDIR}/../man/empty.1 man/man1/
+ @makewhatis man
+ @man -kM man title > onepage.mout
+ @mv man/mandoc.new.db onepage.db
+ @rm -rf man
+
+twopages.db twopages.mout: ${.CURDIR}/../man/empty.1
+ @rm -rf man
+ @mkdir -p man/man1
+ @cp ${.CURDIR}/../man/empty.1 man/man1/
+ @cp ${.CURDIR}/../man/empty.1 man/man1/second.1
+ @makewhatis man
+ @(echo "> second"; man -wM man second | sed 's#.*/man/##'; \
+ echo "> empty"; man -wM man empty | sed 's#.*/man/##') \
+ > twopages.mout
+ @mv man/mandoc.new.db twopages.db
+ @rm -rf man
+
+threepages.db threepages.mout: ${.CURDIR}/../man/empty.1
+ @rm -rf man
+ @mkdir -p man/man1
+ @cp ${.CURDIR}/../man/empty.1 man/man1/
+ @cp ${.CURDIR}/../man/empty.1 man/man1/second.1
+ @cp ${.CURDIR}/../man/empty.1 man/man1/third.1
+ @makewhatis man
+ @(echo "> second"; man -wM man second | sed 's#.*/man/##'; \
+ echo "> third"; man -wM man third | sed 's#.*/man/##'; \
+ echo "> empty"; man -wM man empty | sed 's#.*/man/##') \
+ > threepages.mout
+ @mv man/mandoc.new.db threepages.db
+ @rm -rf man
+
+threemacros.db threemacros.mout: ${.CURDIR}/../man/empty.1
+ @rm -rf man
+ @mkdir -p man/man1
+ @cp ${.CURDIR}/../man/empty.1 man/man1/
+ @printf ".Sh SEE ALSO\n.Xr one 1\n.Xr two 2\n.Xr three 3" \
+ >> man/man1/empty.1
+ @makewhatis man
+ @(echo "> Xr=one"; man -kwM man Xr=one | sed 's#.*/man/##'; \
+ echo "> Xr~^t"; man -kM man -O Xr Xr~^t;) > threemacros.mout
+ @mv man/mandoc.new.db threemacros.db
+ @rm -rf man
+
+sortpages.db sortpages.mout: makeinodes ${.CURDIR}/../man/empty.1
+ @rm -rf man
+ @./makeinodes
+ @cat ${.CURDIR}/../man/empty.1 >> man/man1/1
+ @cat ${.CURDIR}/../man/empty.1 >> man/man1/2
+ @mv man/man1/1 man/man1/one.1
+ @mv man/man1/2 man/man1/two.1
+ @makewhatis man
+ @man -kM man Nm=empty > sortpages.mout
+ @mv man/mandoc.new.db sortpages.db
+ @rm -rf man
+
+sortpages_rev.db sortpages_rev.mout: makeinodes ${.CURDIR}/../man/empty.1
+ @rm -rf man
+ @./makeinodes
+ @cat ${.CURDIR}/../man/empty.1 >> man/man1/1
+ @cat ${.CURDIR}/../man/empty.1 >> man/man1/2
+ @mv man/man1/2 man/man1/one.1
+ @mv man/man1/1 man/man1/two.1
+ @makewhatis man
+ @man -kM man Nm=empty > sortpages_rev.mout
+ @mv man/mandoc.new.db sortpages_rev.db
+ @rm -rf man
+
+so.db so.mout: makeinodes ${.CURDIR}/../man/empty.1
+ @rm -rf man
+ @./makeinodes
+ @cat ${.CURDIR}/../man/empty.1 >> man/man1/1
+ @echo ".so man1/one.1" >> man/man1/2
+ @mv man/man1/1 man/man1/one.1
+ @mv man/man1/2 man/man1/two.1
+ @makewhatis man
+ @man -wM man two | sed 's#.*/man/##' > so.mout
+ @mv man/mandoc.new.db so.db
+ @rm -rf man
+
+so_rev.db so_rev.mout: makeinodes ${.CURDIR}/../man/empty.1
+ @rm -rf man
+ @./makeinodes
+ @cat ${.CURDIR}/../man/empty.1 >> man/man1/2
+ @echo ".so man1/one.1" >> man/man1/1
+ @mv man/man1/2 man/man1/one.1
+ @mv man/man1/1 man/man1/two.1
+ @makewhatis man
+ @man -wM man two | sed 's#.*/man/##' > so_rev.mout
+ @mv man/mandoc.new.db so_rev.db
+ @rm -rf man
+
+sortnames.db sortnames.mout: ${.CURDIR}/../man/sortnames.1
+ @rm -rf man
+ @mkdir -p man/man1
+ @cp ${.CURDIR}/../man/sortnames.1 man/man1/
+ @ln man/man1/sortnames.1 man/man1/link.1
+ @makewhatis man
+ @man -kM man Nm=onlysyn > sortnames.mout
+ @mv man/mandoc.new.db sortnames.db
+ @rm -rf man
+
+twosect.db twosect.mout: ${.CURDIR}/../man/empty.1
+ @rm -rf man
+ @mkdir -p man/man1
+ @mkdir -p man/man8
+ @cp ${.CURDIR}/../man/empty.1 man/man1/
+ @ln man/man1/empty.1 man/man8/empty.8
+ @makewhatis man
+ @man -kM man -s 1 title > twosect.mout
+ @mv man/mandoc.new.db twosect.db
+ @rm -rf man
+
+twoarch.db twoarch.mout: ${.CURDIR}/../man/empty.1
+ @rm -rf man
+ @mkdir -p man/man1/i386
+ @mkdir -p man/man1/amd64
+ @cp ${.CURDIR}/../man/empty.1 man/man1/i386
+ @ln man/man1/i386/empty.1 man/man1/amd64/empty.1
+ @makewhatis man
+ @man -kM man -S i386 title > twoarch.mout
+ @mv man/mandoc.new.db twoarch.db
+ @rm -rf man
+
+fn.db fn.mout: ${.CURDIR}/../man/fn.3
+ @rm -rf man
+ @mkdir -p man/man3
+ @cp ${.CURDIR}/../man/fn.3 man/man3/
+ @makewhatis man
+ @(echo "> fn_type"; man -kwM man Ft=fn_type | sed 's#.*/man/##'; \
+ echo "> fn_func"; man -kwM man Fn=fn_func | sed 's#.*/man/##'; \
+ echo "> fn_arg"; man -kwM man Fa=fn_arg | sed 's#.*/man/##'; \
+ echo "> fo_type"; man -kwM man Ft=fo_type | sed 's#.*/man/##'; \
+ echo "> fo_func"; man -kwM man Fn=fo_func | sed 's#.*/man/##'; \
+ echo "> fo_arg"; man -kwM man Fa=fo_arg | sed 's#.*/man/##') \
+ > fn.mout
+ @mv man/mandoc.new.db fn.db
+ @rm -rf man
+
+in.db in.mout: ${.CURDIR}/../man/in.3
+ @rm -rf man
+ @mkdir -p man/man3
+ @cp ${.CURDIR}/../man/in.3 man/man3/
+ @makewhatis man
+ @(echo "> In"; man -kwM man In=in.h | sed 's#.*/man/##'; \
+ echo "> Fd"; man -kwM man In=fd.h | sed 's#.*/man/##') \
+ > in.mout
+ @mv man/mandoc.new.db in.db
+ @rm -rf man
+
+va.db va.mout: ${.CURDIR}/../man/va.3
+ @rm -rf man
+ @mkdir -p man/man3
+ @cp ${.CURDIR}/../man/va.3 man/man3/
+ @makewhatis man
+ @(echo "> b2"; man -kwM man Va='block vt_two' | sed 's#.*/man/##'; \
+ echo "> t1"; man -kwM man Vt='vt_one' | sed 's#.*/man/##'; \
+ echo "> a1"; man -kwM man Va='va_one' | sed 's#.*/man/##'; \
+ echo "> t2"; man -kwM man Vt='struct vt_two' | sed 's#.*/man/##'; \
+ echo "> a2"; man -kwM man Va='int va_two' | sed 's#.*/man/##') \
+ > va.mout
+ @mv man/mandoc.new.db va.db
+ @rm -rf man
+
+sh.db sh.mout: ${.CURDIR}/../man/sh.1
+ @rm -rf man
+ @mkdir -p man/man1
+ @cp ${.CURDIR}/../man/sh.1 man/man1/
+ @makewhatis man
+ @(echo "> Sh"; man -kwM man Sh=sh_title | sed 's#.*/man/##'; \
+ echo "> Ss"; man -kwM man Ss=ss_title | sed 's#.*/man/##') \
+ > sh.mout
+ @mv man/mandoc.new.db sh.db
+ @rm -rf man
+
+xr.db xr.mout: ${.CURDIR}/../man/xr.1
+ @rm -rf man
+ @mkdir -p man/man1
+ @cp ${.CURDIR}/../man/xr.1 man/man1/
+ @makewhatis man
+ @(echo "> bare"; man -kwM man 'Xr~^bare$$' | sed 's#.*/man/##'; \
+ echo "> page"; man -kwM man 'Xr=page(1)' | sed 's#.*/man/##') \
+ > xr.mout
+ @mv man/mandoc.new.db xr.db
+ @rm -rf man
+
+all.mout: ${OUT_TESTS:C/$/.mout/}
+ @echo assembling all.mout
+ @for f in ${OUT_TESTS}; do printf "\n>>> $$f\n"; \
+ test -e $$f.mout && cat $$f.mout || true; done > $@
+
+
+# === RUNNING BINEDIT ==================================================
+
+padipage.db: binedit twopages.db
+ ./binedit c16rw1f < twopages.db > $@
+
+padfpage.db: binedit twopages.db
+ ./binedit c16rw1s20c20w0w0w0w0w0f < twopages.db > $@
+
+padmpage.db: binedit threepages.db
+ ./binedit c16rw2c20s20c20w0w0w0w0w0f < threepages.db > $@
+
+padmacros.db: binedit onepage.db
+ ./binedit c16rw0f < onepage.db > $@
+
+padimacro.db: binedit empty.db
+ ./binedit c8rdwri4wac4s4c136rwi4ww0f < empty.db > $@
+
+padmmacro.db: binedit empty.db
+ ./binedit c8rdwri4wac8s4c132rwi4ww0f < empty.db > $@
+
+padientry.db: binedit threemacros.db
+ ./binedit c8rdwac4rdwarw2f < threemacros.db > $@
+
+padfentry.db: binedit threemacros.db
+ ./binedit c8rdwac4rdwarw2s8c16w0w0f < threemacros.db > $@
+
+padmentry.db: binedit threemacros.db
+ ./binedit c8rdwac4rdwarw2c8s8c8w0w0f < threemacros.db > $@
+
+padfmagic.db: binedit empty.db
+ ./binedit c12rdi4waw0f < empty.db > $@
+
+nonexistent.db:
+ rm -rf nonexistent.db
+
+short.db:
+ echo 'sho' > $@
+
+badimagic.db: binedit empty.db
+ ./binedit riwf < empty.db > $@
+
+badversion.db: binedit empty.db
+ ./binedit c4riwf < empty.db > $@
+
+badmacrosp.db: binedit empty.db
+ ./binedit c8rw1000f < empty.db > $@
+
+badendp.db: binedit empty.db
+ ./binedit c12riwf < empty.db > $@
+
+badnpages.db: binedit empty.db
+ ./binedit c16rw-1f < empty.db > $@
+
+badnmacros.db: binedit empty.db
+ ./binedit c8rdwariwf < empty.db > $@
+
+badmacrop.db: binedit empty.db
+ ./binedit c8rdwac4rw1000f < empty.db > $@
+
+badfmagic.db: binedit empty.db
+ ./binedit c12rdwariwf < empty.db > $@
+
+
+# === GETTING ACCESS TO THE UTILITIES ==================================
+
+binedit dbm_dump makeinodes:
+ @echo installing $@
+ @if [ -x ${.CURDIR}/../$@/obj/$@ ]; \
+ then ln -s ${.CURDIR}/../$@/obj/$@; \
+ elif [ -x ${.CURDIR}/../$@/$@ ]; \
+ then ln -s ${.CURDIR}/../$@/$@; \
+ else echo "Cannot find $@ binary; run 'make' in .." 1>&2; \
+ exit 1; fi
+
+.include <bsd.regress.mk>