xref: /minix3/usr.bin/tail/extern.h (revision a967d739abf6b9e18d75e99925030c41b4f075ca)
1*a967d739SClaudio Martella /*	$NetBSD: extern.h,v 1.10 2011/09/03 09:02:20 christos Exp $	*/
2*a967d739SClaudio Martella 
3*a967d739SClaudio Martella /*-
4*a967d739SClaudio Martella  * Copyright (c) 1991, 1993
5*a967d739SClaudio Martella  *	The Regents of the University of California.  All rights reserved.
6*a967d739SClaudio Martella  *
7*a967d739SClaudio Martella  * Redistribution and use in source and binary forms, with or without
8*a967d739SClaudio Martella  * modification, are permitted provided that the following conditions
9*a967d739SClaudio Martella  * are met:
10*a967d739SClaudio Martella  * 1. Redistributions of source code must retain the above copyright
11*a967d739SClaudio Martella  *    notice, this list of conditions and the following disclaimer.
12*a967d739SClaudio Martella  * 2. Redistributions in binary form must reproduce the above copyright
13*a967d739SClaudio Martella  *    notice, this list of conditions and the following disclaimer in the
14*a967d739SClaudio Martella  *    documentation and/or other materials provided with the distribution.
15*a967d739SClaudio Martella  * 3. Neither the name of the University nor the names of its contributors
16*a967d739SClaudio Martella  *    may be used to endorse or promote products derived from this software
17*a967d739SClaudio Martella  *    without specific prior written permission.
18*a967d739SClaudio Martella  *
19*a967d739SClaudio Martella  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20*a967d739SClaudio Martella  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21*a967d739SClaudio Martella  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22*a967d739SClaudio Martella  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23*a967d739SClaudio Martella  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24*a967d739SClaudio Martella  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25*a967d739SClaudio Martella  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26*a967d739SClaudio Martella  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27*a967d739SClaudio Martella  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28*a967d739SClaudio Martella  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29*a967d739SClaudio Martella  * SUCH DAMAGE.
30*a967d739SClaudio Martella  *
31*a967d739SClaudio Martella  *	@(#)extern.h	8.1 (Berkeley) 6/6/93
32*a967d739SClaudio Martella  */
33*a967d739SClaudio Martella 
34*a967d739SClaudio Martella #define	WR(p, size) \
35*a967d739SClaudio Martella 	if (write(STDOUT_FILENO, p, size) != size) \
36*a967d739SClaudio Martella 		oerr();
37*a967d739SClaudio Martella 
38*a967d739SClaudio Martella enum STYLE { NOTSET = 0, FBYTES, FLINES, RBYTES, RLINES, REVERSE };
39*a967d739SClaudio Martella 
40*a967d739SClaudio Martella void forward(FILE *, enum STYLE, off_t, struct stat *);
41*a967d739SClaudio Martella void reverse(FILE *, enum STYLE, off_t, struct stat *);
42*a967d739SClaudio Martella 
43*a967d739SClaudio Martella int displaybytes(FILE *, off_t);
44*a967d739SClaudio Martella int displaylines(FILE *, off_t);
45*a967d739SClaudio Martella 
46*a967d739SClaudio Martella void xerr(int fatal, const char *fmt, ...) __printflike(2, 3);
47*a967d739SClaudio Martella void xerrx(int fatal, const char *fmt, ...) __printflike(2, 3);
48*a967d739SClaudio Martella void ierr(void);
49*a967d739SClaudio Martella void oerr(void);
50*a967d739SClaudio Martella 
51*a967d739SClaudio Martella extern int fflag, rflag, rval;
52*a967d739SClaudio Martella extern const char *fname;
53