/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <signal.h>
#include <sac.h>
#include <unistd.h>
#include "misc.h"
#include "structs.h"
#include "extern.h"
/*
* error - print out an error message and die
*
* args: msg - message to be printed, Saferrno previously set
*/
void
char *msg;
{
quit();
}
/*
* quit - exit the program with the status in Saferrno
*/
void
quit()
{
}
/*
* make_tempname - generate a temp name to be used for updating files.
* is from misc.h
*
* args: bname - the basename of the file. For example foo/_config
*/
char *
char *bname;
{
char *p; /* work pointer */
if (p == NULL)
else {
/* this zaps the trailing slash so the '.' can be stuck in */
*p = '\0';
*p = '/';
}
return(buf);
}
/*
* open_temp - open up a temp file
*
* args: tname - temp file name
*/
FILE *
char *tname;
{
(void) umask(0333);
error("tempfile busy; try again later");
}
error("cannot create tempfile");
}
return(fp);
}
/*
* replace - replace one file with another, only returns on success
*
* args: fname - name of target file
* tname - name of source file
*/
void
char *fname;
char *tname;
{
quit();
}
}
/*
* copy_file - copy information from one file to another, return 0 on
* success, -1 on failure
*
* args: fp - source file's file pointer
* tfp - destination file's file pointer
* start - starting line number
* finish - ending line number (-1 indicates entire file)
*/
int
{
int i; /* loop variable */
/*
* always start from the beginning because line numbers are absolute
*/
/*
* get to the starting point of interest
*/
if (start != 1) {
for (i = 1; i < start; i++)
return(-1);
}
/*
* copy as much as was requested
*/
if (finish != -1) {
return(-1);
return(-1);
}
}
else {
for (;;) {
break;
else
return(-1);
}
return(-1);
}
}
return(0);
}
/*
* find_pm - find an entry in _sactab for a particular port monitor
*
* args: fp - file pointer for _sactab
* pmtag - tag of port monitor we're looking for
*/
int
{
char *p; /* working pointer */
line++;
if (*p == '\0')
continue;
return(line);
}
error("error reading _sactab");
/* NOTREACHED */
return (0);
}
else
return(0);
}
/*
* do_config - take a config script and put it where it belongs or
* output an existing one. Saferrno is set if any errors
* are encountered. Calling routine may choose to quit or
* continue, in which case Saferrno will stay set, but may
* change value if another error is encountered.
*
* args: script - name of file containing script (if NULL, means output
* existing one instead)
* basename - name of script (relative to HOME (from misc.h))
*/
int
{
if (script) {
/* we're installing a new configuration script */
return(1);
}
return(1);
}
}
else {
return(1);
}
return(1);
}
/* note - open_temp only returns if successful */
error("error in writing tempfile");
}
}
error("error closing tempfile");
}
/* note - replace only returns if successful */
return(0);
}
else {
/* we're outputting a configuration script */
return(1);
}
return(1);
}
return(0);
}
}