Index: Makefile.inc1 =================================================================== --- Makefile.inc1 (revision 260983) +++ Makefile.inc1 (working copy) @@ -771,7 +771,7 @@ ITOOLS= [ awk cap_mkdb cat chflags chmod chown \ date echo egrep find grep id install ${_install-info} \ ln lockf make mkdir mtree ${_nmtree_itools} mv pwd_mkdb \ - rm sed sh sysctl test true uname wc ${_zoneinfo} + rm sed services_mkdb sh sysctl test true uname wc ${_zoneinfo} # # distributeworld Index: etc/Makefile =================================================================== --- etc/Makefile (revision 260983) +++ etc/Makefile (working copy) @@ -198,6 +198,8 @@ ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ ${BIN1} ${DESTDIR}/etc; \ cap_mkdb ${CAP_MKDB_ENDIAN} ${DESTDIR}/etc/login.conf; \ + services_mkdb ${CAP_MKDB_ENDIAN} -o ${DESTDIR}/var/db/services.db \ + ${DESTDIR}/etc/services; \ ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 \ ${BIN2} ${DESTDIR}/etc; \ ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \ Index: usr.sbin/etcupdate/etcupdate.sh =================================================================== --- usr.sbin/etcupdate/etcupdate.sh (revision 260983) +++ usr.sbin/etcupdate/etcupdate.sh (working copy) @@ -213,7 +213,8 @@ # Purge auto-generated files. Only the source files need to # be updated after which these files are regenerated. - rm -f $1/etc/*.db $1/etc/passwd >&3 2>&1 || return 1 + rm -f $1/etc/*.db $1/etc/passwd $1/var/db/services.db >&3 2>&1 || \ + return 1 # Remove empty files. These just clutter the output of 'diff'. find $1 -type f -size 0 -delete >&3 2>&1 || return 1 Index: usr.sbin/mergemaster/mergemaster.sh =================================================================== --- usr.sbin/mergemaster/mergemaster.sh (revision 260983) +++ usr.sbin/mergemaster/mergemaster.sh (working copy) @@ -699,7 +699,8 @@ # or spwd.db. Instead, we want to compare the text versions, and run *_mkdb. # Prompt the user to do so below, as needed. # - rm -f ${TEMPROOT}/etc/*.db ${TEMPROOT}/etc/passwd + rm -f ${TEMPROOT}/etc/*.db ${TEMPROOT}/etc/passwd \ + ${TEMPROOT}/var/db/services.db # We only need to compare things like freebsd.cf once find ${TEMPROOT}/usr/obj -type f -delete 2>/dev/null Index: usr.sbin/services_mkdb/extern.h =================================================================== --- usr.sbin/services_mkdb/extern.h (revision 260983) +++ usr.sbin/services_mkdb/extern.h (working copy) @@ -29,6 +29,6 @@ * $FreeBSD$ */ -extern const HASHINFO hinfo; +extern HASHINFO hinfo; void uniq(const char *); Index: usr.sbin/services_mkdb/services_mkdb.8 =================================================================== --- usr.sbin/services_mkdb/services_mkdb.8 (revision 260983) +++ usr.sbin/services_mkdb/services_mkdb.8 (working copy) @@ -37,6 +37,7 @@ .Nd generate the services database .Sh SYNOPSIS .Nm +.Op Fl b | l .Op Fl q .Op Fl o Ar database .Op Ar file @@ -61,6 +62,10 @@ .Pp The options are as follows: .Bl -tag -width indent +.It Fl b +Use big-endian byte order for database metadata. +.It Fl l +Use little-endian byte order for database metadata. .It Fl o Ar database Put the output databases in the named file. .It Fl q @@ -70,6 +75,13 @@ .El .Pp The databases are used by the C library services routines (see +.Pp +The +.Fl b +and +.Fl l +flags are mutually exclusive. +The default byte ordering is the current host order. .Xr getservent 3 ) . .Sh FILES .Bl -tag -width ".Pa /var/db/services.db.tmp" -compact Index: usr.sbin/services_mkdb/services_mkdb.c =================================================================== --- usr.sbin/services_mkdb/services_mkdb.c (revision 260983) +++ usr.sbin/services_mkdb/services_mkdb.c (working copy) @@ -67,7 +67,7 @@ static const char *mkaliases(StringList *, char *, size_t); static void usage(void); -const HASHINFO hinfo = { +HASHINFO hinfo = { .bsize = 256, .ffactor = 4, .nelem = 32768, @@ -87,6 +87,7 @@ int warndup = 1; int unique = 0; int otherflag = 0; + int byteorder = 0; size_t cnt = 0; StringList *sl, ***svc; size_t port, proto; @@ -93,8 +94,14 @@ setprogname(argv[0]); - while ((ch = getopt(argc, argv, "qo:u")) != -1) + while ((ch = getopt(argc, argv, "blo:qu")) != -1) switch (ch) { + case 'b': + case 'l': + if (byteorder != 0) + usage(); + byteorder = ch == 'b' ? 4321 : 1234; + break; case 'q': otherflag = 1; warndup = 0; @@ -119,6 +126,9 @@ if (argc == 1) fname = argv[0]; + /* Set byte order. */ + hinfo.lorder = byteorder; + if (unique) uniq(fname); @@ -423,7 +433,8 @@ static void usage(void) { - (void)fprintf(stderr, "Usage:\t%s [-q] [-o ] []\n" + (void)fprintf(stderr, + "Usage:\t%s [-b | -l] [-q] [-o ] []\n" "\t%s -u []\n", getprogname(), getprogname()); exit(1); }