Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/cap_mkdb Add -b and -l options to generate big- or l...
details: https://anonhg.NetBSD.org/src/rev/e89ecba024ff
branches: trunk
changeset: 474055:e89ecba024ff
user: simonb <simonb%NetBSD.org@localhost>
date: Sun Jun 27 05:49:02 1999 +0000
description:
Add -b and -l options to generate big- or little-endian databases
regardless of host byte order.
diffstat:
usr.bin/cap_mkdb/cap_mkdb.1 | 14 +++++++++++++-
usr.bin/cap_mkdb/cap_mkdb.c | 20 +++++++++++++++-----
2 files changed, 28 insertions(+), 6 deletions(-)
diffs (98 lines):
diff -r 8584cb3ce5fa -r e89ecba024ff usr.bin/cap_mkdb/cap_mkdb.1
--- a/usr.bin/cap_mkdb/cap_mkdb.1 Sun Jun 27 04:35:42 1999 +0000
+++ b/usr.bin/cap_mkdb/cap_mkdb.1 Sun Jun 27 05:49:02 1999 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: cap_mkdb.1,v 1.7 1997/10/18 12:31:01 lukem Exp $
+.\" $NetBSD: cap_mkdb.1,v 1.8 1999/06/27 05:49:02 simonb Exp $
.\"
.\" Copyright (c) 1992, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -42,6 +42,7 @@
.Pp
.Sh SYNOPSIS
.Nm
+.Op Fl b | Fl l
.Op Fl v
.Op Fl f Ar outfile
.Ar file1
@@ -67,12 +68,23 @@
.Pp
The options as as follows:
.Bl -tag -width XXXXXX -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 the
+.Fl l
+flags are mutually exclusive. The default byte ordering is
+the current host order.
+.Pp
.Sh FORMAT
Each record is stored in the database using two different types of keys.
.Pp
diff -r 8584cb3ce5fa -r e89ecba024ff usr.bin/cap_mkdb/cap_mkdb.c
--- a/usr.bin/cap_mkdb/cap_mkdb.c Sun Jun 27 04:35:42 1999 +0000
+++ b/usr.bin/cap_mkdb/cap_mkdb.c Sun Jun 27 05:49:02 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cap_mkdb.c,v 1.9 1998/07/28 19:27:00 mycroft Exp $ */
+/* $NetBSD: cap_mkdb.c,v 1.10 1999/06/27 05:49:02 simonb Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)cap_mkdb.c 8.2 (Berkeley) 4/27/95";
#endif
-__RCSID("$NetBSD: cap_mkdb.c,v 1.9 1998/07/28 19:27:00 mycroft Exp $");
+__RCSID("$NetBSD: cap_mkdb.c,v 1.10 1999/06/27 05:49:02 simonb Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -89,11 +89,18 @@
int argc;
char *argv[];
{
- int c;
+ int c, byteorder;
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;
@@ -111,6 +118,9 @@
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.
@@ -260,6 +270,6 @@
usage()
{
(void)fprintf(stderr,
- "usage: cap_mkdb [-v] [-f outfile] file1 [file2 ...]\n");
+ "usage: cap_mkdb [-b|-l] [-v] [-f outfile] file1 [file2 ...]\n");
exit(1);
}
Home |
Main Index |
Thread Index |
Old Index