17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate * CDDL HEADER START
37c478bd9Sstevel@tonic-gate *
47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate * with the License.
87c478bd9Sstevel@tonic-gate *
97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate * and limitations under the License.
137c478bd9Sstevel@tonic-gate *
147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate *
207c478bd9Sstevel@tonic-gate * CDDL HEADER END
217c478bd9Sstevel@tonic-gate */
227c478bd9Sstevel@tonic-gate /*
23*a506a34cSth160488 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24*a506a34cSth160488 * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate */
267c478bd9Sstevel@tonic-gate
27*a506a34cSth160488
287c478bd9Sstevel@tonic-gate /*
297c478bd9Sstevel@tonic-gate * mkmap - program to convert the mail.aliases map into an
307c478bd9Sstevel@tonic-gate * inverse map of <user@host> back to <preferred-alias>
317c478bd9Sstevel@tonic-gate */
327c478bd9Sstevel@tonic-gate
337c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI"
347c478bd9Sstevel@tonic-gate
357c478bd9Sstevel@tonic-gate #include <stdlib.h>
367c478bd9Sstevel@tonic-gate #include <unistd.h>
377c478bd9Sstevel@tonic-gate #include <string.h>
387c478bd9Sstevel@tonic-gate #include <fcntl.h>
397c478bd9Sstevel@tonic-gate #include <ndbm.h>
407c478bd9Sstevel@tonic-gate #include <stdio.h>
417c478bd9Sstevel@tonic-gate #include <ctype.h>
427c478bd9Sstevel@tonic-gate #include <netdb.h>
437c478bd9Sstevel@tonic-gate #include <sys/systeminfo.h>
447c478bd9Sstevel@tonic-gate
457c478bd9Sstevel@tonic-gate #include "ypdefs.h"
467c478bd9Sstevel@tonic-gate USE_YP_PREFIX
477c478bd9Sstevel@tonic-gate USE_YP_MASTER_NAME
487c478bd9Sstevel@tonic-gate USE_YP_LAST_MODIFIED
497c478bd9Sstevel@tonic-gate
507c478bd9Sstevel@tonic-gate #define MKAL_INCLUDE ":include:"
517c478bd9Sstevel@tonic-gate
527c478bd9Sstevel@tonic-gate void CopyName(char *dst, char *src, int len);
537c478bd9Sstevel@tonic-gate int HostCheck(char *h, char *a);
547c478bd9Sstevel@tonic-gate void DoName(char *cp);
557c478bd9Sstevel@tonic-gate void UpperCase(char *cp);
567c478bd9Sstevel@tonic-gate void AddYPEntries(void);
577c478bd9Sstevel@tonic-gate
587c478bd9Sstevel@tonic-gate int Verbose = 0; /* to get the gory details */
597c478bd9Sstevel@tonic-gate int UucpOK = 0; /* pass all UUCP names right through */
607c478bd9Sstevel@tonic-gate int DomainOK = 0; /* pass all Domain names (with dots) */
617c478bd9Sstevel@tonic-gate int ErrorCheck = 0; /* check carefully for errors */
627c478bd9Sstevel@tonic-gate int NoOutput = 0; /* no output, just do the check */
637c478bd9Sstevel@tonic-gate int Simple = 0; /* Do not do the user name preference step */
647c478bd9Sstevel@tonic-gate int NameMode = 0; /* Try to capitalize as names */
657c478bd9Sstevel@tonic-gate
667c478bd9Sstevel@tonic-gate DBM *Indbm = NULL, *Scandbm = NULL, *Outdbm = NULL;
677c478bd9Sstevel@tonic-gate
687c478bd9Sstevel@tonic-gate int
IsMailingList(char * s)697c478bd9Sstevel@tonic-gate IsMailingList(char *s)
707c478bd9Sstevel@tonic-gate {
717c478bd9Sstevel@tonic-gate /*
727c478bd9Sstevel@tonic-gate * returns true if the given string is a mailing list
737c478bd9Sstevel@tonic-gate */
747c478bd9Sstevel@tonic-gate char *p;
757c478bd9Sstevel@tonic-gate
767c478bd9Sstevel@tonic-gate if (strchr(s, ','))
777c478bd9Sstevel@tonic-gate return (1);
787c478bd9Sstevel@tonic-gate if (strchr(s, '|'))
797c478bd9Sstevel@tonic-gate return (1);
807c478bd9Sstevel@tonic-gate p = strchr(s, ':');
817c478bd9Sstevel@tonic-gate if (p && strncmp(p, MKAL_INCLUDE, sizeof (MKAL_INCLUDE)))
827c478bd9Sstevel@tonic-gate return (1);
837c478bd9Sstevel@tonic-gate return (0);
847c478bd9Sstevel@tonic-gate }
857c478bd9Sstevel@tonic-gate
867c478bd9Sstevel@tonic-gate int
IsQualified(char * s,char * p,char * h)877c478bd9Sstevel@tonic-gate IsQualified(char *s, char *p, char *h)
887c478bd9Sstevel@tonic-gate {
897c478bd9Sstevel@tonic-gate /*
907c478bd9Sstevel@tonic-gate * returns true if the given string is qualified with a host name
917c478bd9Sstevel@tonic-gate */
927c478bd9Sstevel@tonic-gate register char *middle;
937c478bd9Sstevel@tonic-gate
947c478bd9Sstevel@tonic-gate middle = strchr(s, '@');
957c478bd9Sstevel@tonic-gate if (middle) {
967c478bd9Sstevel@tonic-gate for (middle = s; *middle != '@'; *p++ = *middle++)
977c478bd9Sstevel@tonic-gate continue;
987c478bd9Sstevel@tonic-gate *p = '\0';
997c478bd9Sstevel@tonic-gate CopyName(h, middle+1, strlen(middle + 1));
1007c478bd9Sstevel@tonic-gate return (1);
1017c478bd9Sstevel@tonic-gate }
1027c478bd9Sstevel@tonic-gate middle = strrchr(s, '!');
1037c478bd9Sstevel@tonic-gate if (middle) {
1047c478bd9Sstevel@tonic-gate strcpy(p, middle+1);
1057c478bd9Sstevel@tonic-gate *middle = '\0';
1067c478bd9Sstevel@tonic-gate CopyName(h, s, strlen(s));
1077c478bd9Sstevel@tonic-gate *middle = '!';
1087c478bd9Sstevel@tonic-gate return (1);
1097c478bd9Sstevel@tonic-gate }
1107c478bd9Sstevel@tonic-gate return (0);
1117c478bd9Sstevel@tonic-gate }
1127c478bd9Sstevel@tonic-gate
1137c478bd9Sstevel@tonic-gate int
IsMaint(char * s)1147c478bd9Sstevel@tonic-gate IsMaint(char *s)
1157c478bd9Sstevel@tonic-gate {
1167c478bd9Sstevel@tonic-gate /*
1177c478bd9Sstevel@tonic-gate * returns true if the given string is one of the maintenence
1187c478bd9Sstevel@tonic-gate * strings used in sendmail or NIS.
1197c478bd9Sstevel@tonic-gate */
1207c478bd9Sstevel@tonic-gate if (*s == '@')
1217c478bd9Sstevel@tonic-gate return (1);
1227c478bd9Sstevel@tonic-gate if (strncmp(s, yp_prefix, yp_prefix_sz) == 0)
1237c478bd9Sstevel@tonic-gate return (1);
1247c478bd9Sstevel@tonic-gate return (0);
1257c478bd9Sstevel@tonic-gate }
1267c478bd9Sstevel@tonic-gate
1277c478bd9Sstevel@tonic-gate void
CopyName(char * dst,char * src,int len)1287c478bd9Sstevel@tonic-gate CopyName(char *dst, char *src, int len)
1297c478bd9Sstevel@tonic-gate {
1307c478bd9Sstevel@tonic-gate /*
1317c478bd9Sstevel@tonic-gate * copy a string, but ignore white space
1327c478bd9Sstevel@tonic-gate */
1337c478bd9Sstevel@tonic-gate while (*src && len--) {
1347c478bd9Sstevel@tonic-gate if (isspace(*src))
1357c478bd9Sstevel@tonic-gate src++;
1367c478bd9Sstevel@tonic-gate else
1377c478bd9Sstevel@tonic-gate *dst++ = *src++;
1387c478bd9Sstevel@tonic-gate }
1397c478bd9Sstevel@tonic-gate *dst = '\0';
1407c478bd9Sstevel@tonic-gate }
1417c478bd9Sstevel@tonic-gate
1427c478bd9Sstevel@tonic-gate int
Compare(char * s1,char * s2)1437c478bd9Sstevel@tonic-gate Compare(char *s1, char *s2)
1447c478bd9Sstevel@tonic-gate {
1457c478bd9Sstevel@tonic-gate /*
1467c478bd9Sstevel@tonic-gate * compare strings, but ignore white space
1477c478bd9Sstevel@tonic-gate */
1487c478bd9Sstevel@tonic-gate while (*s1 != '\0' && isspace(*s1))
1497c478bd9Sstevel@tonic-gate s1++;
1507c478bd9Sstevel@tonic-gate while (*s2 != '\0' && isspace(*s2))
1517c478bd9Sstevel@tonic-gate s2++;
1527c478bd9Sstevel@tonic-gate return (strcmp(s1, s2));
1537c478bd9Sstevel@tonic-gate }
1547c478bd9Sstevel@tonic-gate
1557c478bd9Sstevel@tonic-gate void
ProcessMap(void)1567c478bd9Sstevel@tonic-gate ProcessMap(void)
1577c478bd9Sstevel@tonic-gate {
1587c478bd9Sstevel@tonic-gate datum key, value, part, partvalue;
1597c478bd9Sstevel@tonic-gate char address[PBLKSIZ]; /* qualified version */
1607c478bd9Sstevel@tonic-gate char user[PBLKSIZ]; /* unqualified version */
1617c478bd9Sstevel@tonic-gate char userpart[PBLKSIZ]; /* unqualified part of qualified addr. */
1627c478bd9Sstevel@tonic-gate char hostpart[PBLKSIZ]; /* rest of qualified addr. */
1637c478bd9Sstevel@tonic-gate
1647c478bd9Sstevel@tonic-gate for (key = dbm_firstkey(Scandbm); key.dptr != NULL;
1657c478bd9Sstevel@tonic-gate key = dbm_nextkey(Scandbm)) {
1667c478bd9Sstevel@tonic-gate value = dbm_fetch(Indbm, key);
1677c478bd9Sstevel@tonic-gate CopyName(address, value.dptr, value.dsize);
1687c478bd9Sstevel@tonic-gate CopyName(user, key.dptr, key.dsize);
1697c478bd9Sstevel@tonic-gate if (address == NULL) continue;
1707c478bd9Sstevel@tonic-gate if (IsMailingList(address)) continue;
1717c478bd9Sstevel@tonic-gate if (!IsQualified(address, userpart, hostpart)) continue;
1727c478bd9Sstevel@tonic-gate if (IsMaint(user)) continue;
1737c478bd9Sstevel@tonic-gate if (ErrorCheck && HostCheck(hostpart, address)) {
1747c478bd9Sstevel@tonic-gate printf("Invalid host %s in %s:%s\n",
1757c478bd9Sstevel@tonic-gate hostpart, user, address);
1767c478bd9Sstevel@tonic-gate continue;
1777c478bd9Sstevel@tonic-gate }
1787c478bd9Sstevel@tonic-gate part.dptr = userpart;
1797c478bd9Sstevel@tonic-gate part.dsize = strlen(userpart) + 1;
1807c478bd9Sstevel@tonic-gate if (Simple)
1817c478bd9Sstevel@tonic-gate partvalue.dptr = NULL;
1827c478bd9Sstevel@tonic-gate else
1837c478bd9Sstevel@tonic-gate partvalue = dbm_fetch(Indbm, part);
1847c478bd9Sstevel@tonic-gate value.dptr = address;
1857c478bd9Sstevel@tonic-gate value.dsize = strlen(address) + 1;
1867c478bd9Sstevel@tonic-gate if (partvalue.dptr != NULL &&
1877c478bd9Sstevel@tonic-gate Compare(partvalue.dptr, user) == 0) {
1887c478bd9Sstevel@tonic-gate
1897c478bd9Sstevel@tonic-gate if (NameMode)
1907c478bd9Sstevel@tonic-gate DoName(userpart);
1917c478bd9Sstevel@tonic-gate if (!NoOutput)
1927c478bd9Sstevel@tonic-gate dbm_store(Outdbm, value, part, DBM_REPLACE);
1937c478bd9Sstevel@tonic-gate if (Verbose) printf("%s --> %s --> %s\n",
1947c478bd9Sstevel@tonic-gate userpart, user, address);
1957c478bd9Sstevel@tonic-gate } else {
1967c478bd9Sstevel@tonic-gate if (NameMode)
1977c478bd9Sstevel@tonic-gate DoName(user);
1987c478bd9Sstevel@tonic-gate key.dptr = user;
1997c478bd9Sstevel@tonic-gate key.dsize = strlen(user) + 1;
2007c478bd9Sstevel@tonic-gate if (!NoOutput)
2017c478bd9Sstevel@tonic-gate dbm_store(Outdbm, value, key, DBM_REPLACE);
2027c478bd9Sstevel@tonic-gate if (Verbose)
2037c478bd9Sstevel@tonic-gate printf("%s --> %s\n", user, address);
2047c478bd9Sstevel@tonic-gate }
2057c478bd9Sstevel@tonic-gate }
2067c478bd9Sstevel@tonic-gate }
2077c478bd9Sstevel@tonic-gate
2087c478bd9Sstevel@tonic-gate
2097c478bd9Sstevel@tonic-gate /*
2107c478bd9Sstevel@tonic-gate * Returns true if this is an invalid host
2117c478bd9Sstevel@tonic-gate */
2127c478bd9Sstevel@tonic-gate int
HostCheck(char * h,char * a)2137c478bd9Sstevel@tonic-gate HostCheck(char *h, char *a)
2147c478bd9Sstevel@tonic-gate {
2157c478bd9Sstevel@tonic-gate struct hostent *hp;
2167c478bd9Sstevel@tonic-gate
2177c478bd9Sstevel@tonic-gate if (DomainOK && strchr(a, '.'))
2187c478bd9Sstevel@tonic-gate return (0);
2197c478bd9Sstevel@tonic-gate
2207c478bd9Sstevel@tonic-gate if (UucpOK && strchr(a, '!'))
2217c478bd9Sstevel@tonic-gate return (0);
2227c478bd9Sstevel@tonic-gate
2237c478bd9Sstevel@tonic-gate hp = gethostbyname(h);
2247c478bd9Sstevel@tonic-gate return (hp == NULL);
2257c478bd9Sstevel@tonic-gate }
2267c478bd9Sstevel@tonic-gate
2277c478bd9Sstevel@tonic-gate /*
2287c478bd9Sstevel@tonic-gate * Apply some Heurisitcs to upper case-ify the name
2297c478bd9Sstevel@tonic-gate * If it has a dot in it.
2307c478bd9Sstevel@tonic-gate */
2317c478bd9Sstevel@tonic-gate void
DoName(char * cp)2327c478bd9Sstevel@tonic-gate DoName(char *cp)
2337c478bd9Sstevel@tonic-gate {
2347c478bd9Sstevel@tonic-gate if (strchr(cp, '.') == NULL)
2357c478bd9Sstevel@tonic-gate return;
2367c478bd9Sstevel@tonic-gate
2377c478bd9Sstevel@tonic-gate while (*cp) {
2387c478bd9Sstevel@tonic-gate UpperCase(cp);
2397c478bd9Sstevel@tonic-gate while (*cp && *cp != '-' && *cp != '.')
2407c478bd9Sstevel@tonic-gate cp++;
2417c478bd9Sstevel@tonic-gate if (*cp)
2427c478bd9Sstevel@tonic-gate cp++; /* skip past punctuation */
2437c478bd9Sstevel@tonic-gate }
2447c478bd9Sstevel@tonic-gate }
2457c478bd9Sstevel@tonic-gate
2467c478bd9Sstevel@tonic-gate /*
2477c478bd9Sstevel@tonic-gate * upper cases one name - stops at a .
2487c478bd9Sstevel@tonic-gate */
2497c478bd9Sstevel@tonic-gate void
UpperCase(char * cp)2507c478bd9Sstevel@tonic-gate UpperCase(char *cp)
2517c478bd9Sstevel@tonic-gate {
252*a506a34cSth160488 int ch = cp[0];
2537c478bd9Sstevel@tonic-gate
2547c478bd9Sstevel@tonic-gate if (isupper(ch))
2557c478bd9Sstevel@tonic-gate ch = tolower(ch);
2567c478bd9Sstevel@tonic-gate
2577c478bd9Sstevel@tonic-gate if (ch == 'f' && cp[1] == 'f')
2587c478bd9Sstevel@tonic-gate return; /* handle ff */
2597c478bd9Sstevel@tonic-gate
2607c478bd9Sstevel@tonic-gate if (ch == 'm' && cp[1] == 'c' && islower(cp[2]))
2617c478bd9Sstevel@tonic-gate cp[2] = toupper(cp[2]);
2627c478bd9Sstevel@tonic-gate if (islower(ch))
2637c478bd9Sstevel@tonic-gate cp[0] = toupper(ch);
2647c478bd9Sstevel@tonic-gate }
2657c478bd9Sstevel@tonic-gate
2667c478bd9Sstevel@tonic-gate void
AddYPEntries(void)2677c478bd9Sstevel@tonic-gate AddYPEntries(void)
2687c478bd9Sstevel@tonic-gate {
2697c478bd9Sstevel@tonic-gate datum key, value;
2707c478bd9Sstevel@tonic-gate char last_modified[PBLKSIZ];
2717c478bd9Sstevel@tonic-gate char host_name[PBLKSIZ];
2727c478bd9Sstevel@tonic-gate time_t now;
2737c478bd9Sstevel@tonic-gate
2747c478bd9Sstevel@tonic-gate /*
2757c478bd9Sstevel@tonic-gate * Add the special NIS entries.
2767c478bd9Sstevel@tonic-gate */
2777c478bd9Sstevel@tonic-gate key.dptr = yp_last_modified;
2787c478bd9Sstevel@tonic-gate key.dsize = yp_last_modified_sz;
2797c478bd9Sstevel@tonic-gate time(&now);
2807c478bd9Sstevel@tonic-gate sprintf(last_modified, "%10.10d", now);
2817c478bd9Sstevel@tonic-gate value.dptr = last_modified;
2827c478bd9Sstevel@tonic-gate value.dsize = strlen(value.dptr);
2837c478bd9Sstevel@tonic-gate dbm_store(Outdbm, key, value, DBM_REPLACE);
2847c478bd9Sstevel@tonic-gate
2857c478bd9Sstevel@tonic-gate key.dptr = yp_master_name;
2867c478bd9Sstevel@tonic-gate key.dsize = yp_master_name_sz;
2877c478bd9Sstevel@tonic-gate sysinfo(SI_HOSTNAME, host_name, sizeof (host_name));
2887c478bd9Sstevel@tonic-gate value.dptr = host_name;
2897c478bd9Sstevel@tonic-gate value.dsize = strlen(value.dptr);
2907c478bd9Sstevel@tonic-gate dbm_store(Outdbm, key, value, DBM_REPLACE);
2917c478bd9Sstevel@tonic-gate }
2927c478bd9Sstevel@tonic-gate
2937c478bd9Sstevel@tonic-gate int
main(int argc,char * argv[])2947c478bd9Sstevel@tonic-gate main(int argc, char *argv[])
2957c478bd9Sstevel@tonic-gate {
2967c478bd9Sstevel@tonic-gate while (argc > 1 && argv[1][0] == '-') {
2977c478bd9Sstevel@tonic-gate switch (argv[1][1]) {
2987c478bd9Sstevel@tonic-gate case 'v':
2997c478bd9Sstevel@tonic-gate Verbose = 1;
3007c478bd9Sstevel@tonic-gate break;
3017c478bd9Sstevel@tonic-gate
3027c478bd9Sstevel@tonic-gate case 'u':
3037c478bd9Sstevel@tonic-gate UucpOK = 1;
3047c478bd9Sstevel@tonic-gate break;
3057c478bd9Sstevel@tonic-gate
3067c478bd9Sstevel@tonic-gate case 'd':
3077c478bd9Sstevel@tonic-gate DomainOK = 1;
3087c478bd9Sstevel@tonic-gate break;
3097c478bd9Sstevel@tonic-gate
3107c478bd9Sstevel@tonic-gate case 'e':
3117c478bd9Sstevel@tonic-gate ErrorCheck = 1;
3127c478bd9Sstevel@tonic-gate break;
3137c478bd9Sstevel@tonic-gate
3147c478bd9Sstevel@tonic-gate case 's':
3157c478bd9Sstevel@tonic-gate Simple = 1;
3167c478bd9Sstevel@tonic-gate break;
3177c478bd9Sstevel@tonic-gate
3187c478bd9Sstevel@tonic-gate case 'n':
3197c478bd9Sstevel@tonic-gate NameMode = 1;
3207c478bd9Sstevel@tonic-gate break;
3217c478bd9Sstevel@tonic-gate
3227c478bd9Sstevel@tonic-gate default:
3237c478bd9Sstevel@tonic-gate printf("Unknown option %c\n", argv[1][1]);
3247c478bd9Sstevel@tonic-gate break;
3257c478bd9Sstevel@tonic-gate }
3267c478bd9Sstevel@tonic-gate argc--; argv++;
3277c478bd9Sstevel@tonic-gate }
3287c478bd9Sstevel@tonic-gate if (argc < 2) {
3297c478bd9Sstevel@tonic-gate printf("Usage: mkalias [-e] [-v] [-u] [-d] [-s] [-n] <input> <output>\n");
3307c478bd9Sstevel@tonic-gate exit(1);
3317c478bd9Sstevel@tonic-gate }
3327c478bd9Sstevel@tonic-gate Indbm = dbm_open(argv[1], O_RDONLY, 0);
3337c478bd9Sstevel@tonic-gate if (Indbm == NULL) {
3347c478bd9Sstevel@tonic-gate printf("Unable to open input database %s\n", argv[1]);
3357c478bd9Sstevel@tonic-gate exit(1);
3367c478bd9Sstevel@tonic-gate }
3377c478bd9Sstevel@tonic-gate Scandbm = dbm_open(argv[1], O_RDONLY, 0);
3387c478bd9Sstevel@tonic-gate if (Scandbm == NULL) {
3397c478bd9Sstevel@tonic-gate printf("Unable to open input database %s\n", argv[1]);
3407c478bd9Sstevel@tonic-gate exit(1);
3417c478bd9Sstevel@tonic-gate }
3427c478bd9Sstevel@tonic-gate if (argv[2] == NULL)
3437c478bd9Sstevel@tonic-gate NoOutput = 1;
3447c478bd9Sstevel@tonic-gate else {
3457c478bd9Sstevel@tonic-gate Outdbm = dbm_open(argv[2], O_RDWR|O_CREAT|O_TRUNC, 0644);
3467c478bd9Sstevel@tonic-gate if (Outdbm == NULL) {
3477c478bd9Sstevel@tonic-gate printf("Unable to open output database %s\n", argv[2]);
3487c478bd9Sstevel@tonic-gate exit(1);
3497c478bd9Sstevel@tonic-gate }
3507c478bd9Sstevel@tonic-gate }
3517c478bd9Sstevel@tonic-gate ProcessMap();
3527c478bd9Sstevel@tonic-gate dbm_close(Indbm);
3537c478bd9Sstevel@tonic-gate dbm_close(Scandbm);
3547c478bd9Sstevel@tonic-gate if (!NoOutput) {
3557c478bd9Sstevel@tonic-gate AddYPEntries();
3567c478bd9Sstevel@tonic-gate dbm_close(Outdbm);
3577c478bd9Sstevel@tonic-gate }
3587c478bd9Sstevel@tonic-gate return (0);
3597c478bd9Sstevel@tonic-gate }
360