/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Portions of this source code were derived from Berkeley
* under license from the Regents of the University of
* California.
*/
#include <stdio.h>
#include <ctype.h>
#include <limits.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/systeminfo.h>
#include <dlfcn.h>
#include "ypdefs.h"
#include "ypsym.h"
#ifdef SYSVCONFIG
extern void sysvconfig();
#endif
extern int yp_getalias();
static char *get_date();
static char *any();
static void addpair();
static void unmake();
static void usage();
int inode_dev_valid = 0;
/*
* Interpose close(2) to enable us to keep one of the output
* files open until process exit.
*/
int
static int (*fptr)() = 0;
if (fptr == 0) {
if (fptr == 0) {
dlerror());
return (-1);
}
}
/* Keep open; pretend successful */
return (0);
}
}
}
int
int argc;
char **argv;
{
char *p, ic;
int cnt, i;
int num_del_to_match = 0;
/* flag to indicate if matching char can be escaped */
int count_esp = 0;
/* Ignore existing umask, always force 077 (owner rw only) */
umask(077);
/* name to imbed in database */
argv++;
argc--;
while (argc > 0) {
switch (argv[0][1]) {
case 'i':
argv++;
argc--;
break;
case 'o':
argv++;
argc--;
break;
case 'm':
argv++;
argc--;
break;
case 'b':
interdomain_bind = argv[0];
break;
case 'd':
argv++;
argc--;
break;
case 'l':
lower_case_keys = argv[0];
break;
case 's':
break;
case 'S' :
"bad separator\n");
usage();
}
argv++;
argc--;
break;
case 'D' :
argv++;
argc--;
break;
case 'E' :
count_esp = 1;
break;
case 'u':
argv++;
argc--;
exit(0);
default:
usage();
}
else
usage();
argv++;
argc--;
}
usage();
/*
* do alias mapping if necessary
*/
if (last_slash) {
*last_slash = '\0';
} else next_to_last_slash = NULL;
#ifdef DEBUG
#endif /* DEBUG */
/* reads in alias file for system v filename translation */
#ifdef SYSVCONFIG
sysvconfig();
#endif
if (last_slash && next_to_last_slash) {
else
"makedbm: warning: no alias for %s\n",
last_slash+1);
}
#ifdef DEBUG
#endif /* DEBUG */
NAME_MAX) < 0) {
else
"makedbm: warning: no alias for %s\n",
}
#ifdef DEBUG
#endif /* DEBUG */
#ifdef DEBUG
#endif /* DEBUG */
} else if (last_slash) {
else
"makedbm: warning: no alias for %s\n",
last_slash+1);
}
else
"makedbm: warning: no alias for %s\n",
last_slash+1);
}
} else {
else
"makedbm: warning: no alias for %s\n",
outfile);
}
}
#ifdef DEBUG
#endif /* DEBUG */
/* Loop until we can lock the tmpdirbuf file */
for (;;) {
exit(1);
} else
exit(1);
}
exit(1);
}
/* Got exclusive access; save inode and dev */
exit(1);
}
inode_dev_valid = 1;
break;
}
exit(1);
}
/*
* Someone else is holding the lock.
* Close both output and input file
* (the latter to ensure consistency
* if the input file is updated while
* we're suspended), wait a little,
* and try again.
*/
sleep(1);
}
exit(1);
}
exit(1);
}
p = buf;
p += cnt-1;
goto breakout;
}
} else {
}
for (;;) {
"makedbm: source files is garbage!\n");
exit(1);
}
break;
p++;
}
if (lower_case_keys) {
}
}
printf("problem storing %.*s %.*s\n",
exit(1);
}
}
#ifdef DEBUG
else {
printf("duplicate: %.*s %.*s\n",
}
#endif
}
if (infilename)
if (outfilename)
if (domainname)
if (security)
if (interdomain_bind)
if (!mastername) {
}
#ifdef DEBUG
#endif
perror("makedbm: rename");
exit(1);
}
perror("makedbm: rename");
exit(1);
}
/*
* sprintf(buf, "mv %s %s", tmppagbuf, pagbuf);
* if (system(buf) < 0)
* perror("makedbm: rename");
* sprintf(buf, "mv %s %s", tmpdirbuf, dirbuf);
* if (system(buf) < 0)
* perror("makedbm: rename");
*/
exit(0);
}
/*
* scans cp, looking for a match with any character
* in match. Returns pointer to place in cp that matched
* (or NULL if no match)
*
* It will find the num_del_to_match+1
* matching character in the line.
*
* The backslash escapes a delimiter if count_esp==1
* We don't count it as a character match if
* an escape character precedes a matching character.
*
*/
static char *
register char *cp;
char *match;
int num_del_to_match;
int count_esp;
{
int num_del_matched;
num_del_matched = 0;
prev_char = ' ';
while (c = *cp) {
if (*mp == c) {
if (!count_esp) {
} else if (prev_char != '\\') {
}
if (num_del_matched > num_del_to_match)
return (cp);
}
}
prev_char = c;
cp++;
}
return ((char *)0);
}
static char *
char *name;
{
/* ASCII numeric string */
else {
exit(1);
}
}
return (ans);
}
void
usage()
{
"usage: makedbm -u file\n makedbm [-b] [-l] [-s] [-i YP_INPUT_FILE] "
"[-o YP_OUTPUT_FILE] [-d YP_DOMAIN_NAME] [-m YP_MASTER_NAME] "
"[-S DELIMITER] [-D NUM_DELIMITER_TO_SKIP] [-E] "
"infile outfile\n");
exit(1);
}
void
{
printf("makedbm: problem storing %.*s %.*s\n",
exit(1);
}
}
void
char *file;
{
usage();
exit(1);
}
}
}