input.h revision 199647
11556Srgrimes/*- 21556Srgrimes * Copyright (c) 1991, 1993 31556Srgrimes * The Regents of the University of California. All rights reserved. 41556Srgrimes * 51556Srgrimes * This code is derived from software contributed to Berkeley by 61556Srgrimes * Kenneth Almquist. 71556Srgrimes * 81556Srgrimes * Redistribution and use in source and binary forms, with or without 91556Srgrimes * modification, are permitted provided that the following conditions 101556Srgrimes * are met: 111556Srgrimes * 1. Redistributions of source code must retain the above copyright 121556Srgrimes * notice, this list of conditions and the following disclaimer. 131556Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 141556Srgrimes * notice, this list of conditions and the following disclaimer in the 151556Srgrimes * documentation and/or other materials provided with the distribution. 161556Srgrimes * 4. Neither the name of the University nor the names of its contributors 171556Srgrimes * may be used to endorse or promote products derived from this software 181556Srgrimes * without specific prior written permission. 191556Srgrimes * 201556Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 211556Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 221556Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 231556Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 241556Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 251556Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 261556Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 271556Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 281556Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 291556Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 301556Srgrimes * SUCH DAMAGE. 311556Srgrimes * 3217987Speter * @(#)input.h 8.2 (Berkeley) 5/4/95 3350471Speter * $FreeBSD: head/bin/sh/input.h 199647 2009-11-22 14:04:20Z jilles $ 341556Srgrimes */ 351556Srgrimes 361556Srgrimes/* PEOF (the end of file marker) is defined in syntax.h */ 371556Srgrimes 381556Srgrimes/* 391556Srgrimes * The input line number. Input.c just defines this variable, and saves 401556Srgrimes * and restores it when files are pushed and popped. The user of this 411556Srgrimes * package must set its value. 421556Srgrimes */ 431556Srgrimesextern int plinno; 441556Srgrimesextern int parsenleft; /* number of characters left in input buffer */ 451556Srgrimesextern char *parsenextc; /* next character in input buffer */ 461556Srgrimesextern int init_editline; /* 0 == not setup, 1 == OK, -1 == failed */ 471556Srgrimes 48199647Sjillesstruct parsefile; 49199647Sjilles 5090111Simpchar *pfgets(char *, int); 5190111Simpint pgetc(void); 5290111Simpint preadbuffer(void); 53194128Sjillesint preadateof(void); 5490111Simpvoid pungetc(void); 5590111Simpvoid pushstring(char *, int, void *); 5690111Simpvoid popstring(void); 5790111Simpvoid setinputfile(char *, int); 5890111Simpvoid setinputfd(int, int); 5990111Simpvoid setinputstring(char *, int); 6090111Simpvoid popfile(void); 61199647Sjillesstruct parsefile *getcurrentfile(void); 62199647Sjillesvoid popfilesupto(struct parsefile *); 6390111Simpvoid popallfiles(void); 6490111Simpvoid closescript(void); 651556Srgrimes 661556Srgrimes#define pgetc_macro() (--parsenleft >= 0? *parsenextc++ : preadbuffer()) 67