extern.h revision 74876
1204123Sattilio/*-
2204123Sattilio * Copyright (c) 1991, 1993
3204123Sattilio *	The Regents of the University of California.  All rights reserved.
4204123Sattilio *
5204123Sattilio * Redistribution and use in source and binary forms, with or without
6204123Sattilio * modification, are permitted provided that the following conditions
7204123Sattilio * are met:
8204123Sattilio * 1. Redistributions of source code must retain the above copyright
9204123Sattilio *    notice, this list of conditions and the following disclaimer.
10204123Sattilio * 2. Redistributions in binary form must reproduce the above copyright
11204123Sattilio *    notice, this list of conditions and the following disclaimer in the
12204123Sattilio *    documentation and/or other materials provided with the distribution.
13204123Sattilio * 3. All advertising materials mentioning features or use of this software
14204123Sattilio *    must display the following acknowledgement:
15204123Sattilio *	This product includes software developed by the University of
16204123Sattilio *	California, Berkeley and its contributors.
17204123Sattilio * 4. Neither the name of the University nor the names of its contributors
18204123Sattilio *    may be used to endorse or promote products derived from this software
19204123Sattilio *    without specific prior written permission.
20204123Sattilio *
21204123Sattilio * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22204123Sattilio * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23204123Sattilio * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24204123Sattilio * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25204123Sattilio * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26204123Sattilio * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27204123Sattilio * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28204123Sattilio * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29204123Sattilio * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30204123Sattilio * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31204123Sattilio * SUCH DAMAGE.
32204123Sattilio *
33204123Sattilio *	@(#)extern.h	8.1 (Berkeley) 6/6/93
34204123Sattilio *
35204123Sattilio * $FreeBSD: head/usr.bin/tail/extern.h 74876 2001-03-27 20:37:34Z dwmalone $
36204123Sattilio */
37204123Sattilio
38204123Sattilio#define	WR(p, size) do { \
39204123Sattilio	if (write(STDOUT_FILENO, p, size) != size) \
40204123Sattilio		oerr(); \
41204123Sattilio	} while(0)
42204123Sattilio
43204123Sattilio#define TAILMAPLEN (4<<20)
44204123Sattilio
45204123Sattiliostruct mapinfo {
46204123Sattilio	off_t	mapoff;
47204123Sattilio	off_t	maxoff;
48204123Sattilio	size_t	maplen;
49204123Sattilio	char	*start;
50204123Sattilio	int	fd;
51204123Sattilio};
52204123Sattilio
53204123Sattilioenum STYLE { NOTSET = 0, FBYTES, FLINES, RBYTES, RLINES, REVERSE };
54204123Sattilio
55204123Sattiliovoid forward __P((FILE *, enum STYLE, long, struct stat *));
56204123Sattiliovoid reverse __P((FILE *, enum STYLE, long, struct stat *));
57204123Sattilio
58204123Sattilioint bytes __P((FILE *, off_t));
59204123Sattilioint lines __P((FILE *, off_t));
60204123Sattilio
61204123Sattiliovoid ierr __P((void));
62204123Sattiliovoid oerr __P((void));
63204123Sattilioint mapprint __P((struct mapinfo *, off_t, off_t));
64204123Sattilioint maparound __P((struct mapinfo *, off_t));
65204123Sattilio
66204123Sattilioextern int Fflag, fflag, rflag, rval;
67204123Sattilioextern char *fname;
68204123Sattilio