misc.c revision f928ce67ef743c33ea27c573c9c7e2d4a4833cbd
/*
* 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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI"
/*
*
* A few general purpose routines.
*
*/
#include <stdio.h>
#include <stdarg.h>
#include <ctype.h>
#include <fcntl.h>
#include "gen.h" /* a few general purpose definitions */
#include "ext.h" /* external variable declarations */
int nolist = 0; /* number of specified ranges */
void
{
/*
*
* Called when we've run into some kind of program error. *mesg is printed using
* the control string arguments a?. We'll quit if we're not ignoring errors and
* kind is FATAL.
*
*/
if ( lineno > 0 )
if ( position > 0 )
} /* End if */
} /* End if */
} /* End of error */
/*****************************************************************************/
/*****************************************************************************/
void
char *str; /* process ranges in this string */
{
/*
*
* Called to get the processing ranges that were specified by using the -o option.
* The range syntax should be identical to the one used in nroff and troff.
*
*/
} /* End while */
} /* End of out_list */
/*****************************************************************************/
int
int num; /* should we print this page? */
{
int i; /* just a loop index */
/*
*
* Returns ON if num represents a page that we're supposed to print. If no ranges
* were selected nolist will be 0 and we'll print everything.
*
*/
if ( nolist == 0 ) /* everything's included */
return(ON);
for ( i = 0; i < nolist; i += 2 )
return(ON);
return(OFF);
} /* End of in_olist */
/*****************************************************************************/
int
char *file; /* copy this file to stdout */
{
int fd_in; /* for the input */
int fd_out; /* and output files */
int count; /* number of bytes we just read */
/*
*
* Copies *file to stdout - mostly for the prologue. Returns FALSE if there was a
* problem and TRUE otherwise.
*
*/
return(FALSE);
return(TRUE);
} /* End of cat */
/*****************************************************************************/
int
char **str; /* get next number from this string */
int err; /* value returned on error */
{
int i; /* just a loop index */
/*
*
* Gets the next integer from **str and returns its value to the caller. If **str
* isn't an integer err is returned. *str is updated after each digit is processed.
*
*/
return(err);
return(i);
} /* End of str_convert */
/*****************************************************************************/
int sig; /* signal that we caught */
{
/*
*
* Called when we get a signal that we're supposed to catch.
*
*/
exit(1);
} /* End of interrupt */
/*****************************************************************************/