summaryrefslogtreecommitdiffstats
path: root/usr.bin/cap_mkdb
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2005-02-22 23:29:54 +0000
committerru <ru@FreeBSD.org>2005-02-22 23:29:54 +0000
commit3305bcf4bbdffa9dfcdcef4bb7762485d95701a1 (patch)
treedb9603004953476330eb45d8b0660771e5a0be24 /usr.bin/cap_mkdb
parent9c75eea841ae95d54ab8b830910eccf703bcbff6 (diff)
downloadFreeBSD-src-3305bcf4bbdffa9dfcdcef4bb7762485d95701a1.zip
FreeBSD-src-3305bcf4bbdffa9dfcdcef4bb7762485d95701a1.tar.gz
Add endianness support to cap_mkdb(1), useful for cross builds.
Diffstat (limited to 'usr.bin/cap_mkdb')
-rw-r--r--usr.bin/cap_mkdb/cap_mkdb.117
-rw-r--r--usr.bin/cap_mkdb/cap_mkdb.c16
2 files changed, 27 insertions, 6 deletions
diff --git a/usr.bin/cap_mkdb/cap_mkdb.1 b/usr.bin/cap_mkdb/cap_mkdb.1
index 63c06ef..2ac09e3 100644
--- a/usr.bin/cap_mkdb/cap_mkdb.1
+++ b/usr.bin/cap_mkdb/cap_mkdb.1
@@ -32,7 +32,7 @@
.\" @(#)cap_mkdb.1 8.1 (Berkeley) 6/6/93
.\" $FreeBSD$
.\"
-.Dd June 6, 1993
+.Dd February 22, 2005
.Dt CAP_MKDB 1
.Os
.Sh NAME
@@ -40,10 +40,10 @@
.Nd create capability database
.Sh SYNOPSIS
.Nm
+.Op Fl b | l
.Op Fl v
.Op Fl f Ar outfile
-.Ar file
-.Op Ar
+.Ar
.Sh DESCRIPTION
The
.Nm
@@ -65,11 +65,22 @@ record is stored into the database.
.Pp
The following options are available:
.Bl -tag -width indent
+.It Fl b
+Use big-endian byte order for database metadata.
.It Fl f Ar outfile
Specify a different database basename.
+.It Fl l
+Use little-endian byte order for database metadata.
.It Fl v
Print out the number of capability records in the database.
.El
+.Pp
+The
+.Fl b
+and
+.Fl l
+flags are mutually exclusive.
+The default byte ordering is the current host order.
.Sh FORMAT
Each record is stored in the database using two different types of keys.
.Pp
diff --git a/usr.bin/cap_mkdb/cap_mkdb.c b/usr.bin/cap_mkdb/cap_mkdb.c
index 2cb0bed..32413c8 100644
--- a/usr.bin/cap_mkdb/cap_mkdb.c
+++ b/usr.bin/cap_mkdb/cap_mkdb.c
@@ -84,11 +84,18 @@ HASHINFO openinfo = {
int
main(int argc, char *argv[])
{
- int c;
+ int byteorder, c;
capname = NULL;
- while ((c = getopt(argc, argv, "f:v")) != -1) {
+ byteorder = 0;
+ while ((c = getopt(argc, argv, "bf:lv")) != -1) {
switch(c) {
+ case 'b':
+ case 'l':
+ if (byteorder != 0)
+ usage();
+ byteorder = c == 'b' ? 4321 : 1234;
+ break;
case 'f':
capname = optarg;
break;
@@ -106,6 +113,9 @@ main(int argc, char *argv[])
if (*argv == NULL)
usage();
+ /* Set byte order. */
+ openinfo.lorder = byteorder;
+
/*
* The database file is the first argument if no name is specified.
* Make arrangements to unlink it if exit badly.
@@ -257,6 +267,6 @@ void
usage(void)
{
(void)fprintf(stderr,
- "usage: cap_mkdb [-v] [-f outfile] file [file ...]\n");
+ "usage: cap_mkdb [-b | -l] [-v] [-f outfile] file ...\n");
exit(1);
}
OpenPOWER on IntegriCloud