request.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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 */
#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
/*
*
* Things used to handle special requests (eg. manual feed) globally or on a per
* page basis. Requests are passed through to the translator using the -R option.
* The argument to -R can be "request", "request:page", or "request:page:file".
* If page is omitted (as in the first form) or set to 0 request will be applied
* to the global environment. In all other cases it applies only to the selected
* page. If a file is given, page must be supplied, and the lookup is in that file
* rather than *requestfile.
*
*/
#include <stdio.h>
#include "gen.h" /* general purpose definitions */
#include "request.h" /* a few special definitions */
#include "path.h" /* for the default request file */
int nextreq = 0; /* goes in request[nextreq] */
/*****************************************************************************/
char *want; /* grab code for this stuff */
{
char *page; /* and save it for this page */
char *strtok();
/*
*
* Save the request until we get to appropriate page - don't even bother with
* the lookup right now. Format of *want string is "request", "request:page", or
* "request:page:file", and we assume we can change the string here as needed.
* If page is omitted or given as 0 the request will be done globally. If *want
* includes a file, request and page must also be given, and in that case *file
* will be used for the lookup.
*
*/
if ( nextreq < MAXREQUEST ) {
nextreq++;
} /* End of saverequest */
/*****************************************************************************/
int page; /* write everything for this page */
{
int i; /* loop index */
/*
*
* Writes out all the requests that have been saved for page. Page 0 refers to
* the global environment and is done during initial setup.
*
*/
for ( i = 0; i < nextreq; i++ )
} /* End of writerequest */
/*****************************************************************************/
char *want; /* look for this string */
char *file; /* in this file */
{
/*
*
* Looks for *want in the request file and if it's found the associated value
* is copied to the output file. Keywords (ie. the *want strings) begin an @ in
* the first column of file, while the values (ie. the stuff that's copied to
* the output file) starts on the next line and extends to the next keyword or
* to the end of file.
*
*/
continue;
else if ( buf[0] != '@' )
else break;
} /* End if */
} /* End of dumprequest */
/*****************************************************************************/