xref: /freebsd/usr.bin/fortune/strfile/strfile.h (revision bdcbfde31e8e9b343f113a1956384bdf30d1ed62)
1*6ae1554aSColin Percival /*-
2*6ae1554aSColin Percival  * Copyright (c) 1991, 1993
3*6ae1554aSColin Percival  *	The Regents of the University of California.  All rights reserved.
4*6ae1554aSColin Percival  *
5*6ae1554aSColin Percival  * This code is derived from software contributed to Berkeley by
6*6ae1554aSColin Percival  * Ken Arnold.
7*6ae1554aSColin Percival  *
8*6ae1554aSColin Percival  * Redistribution and use in source and binary forms, with or without
9*6ae1554aSColin Percival  * modification, are permitted provided that the following conditions
10*6ae1554aSColin Percival  * are met:
11*6ae1554aSColin Percival  * 1. Redistributions of source code must retain the above copyright
12*6ae1554aSColin Percival  *    notice, this list of conditions and the following disclaimer.
13*6ae1554aSColin Percival  * 2. Redistributions in binary form must reproduce the above copyright
14*6ae1554aSColin Percival  *    notice, this list of conditions and the following disclaimer in the
15*6ae1554aSColin Percival  *    documentation and/or other materials provided with the distribution.
16*6ae1554aSColin Percival  * 3. Neither the name of the University nor the names of its contributors
17*6ae1554aSColin Percival  *    may be used to endorse or promote products derived from this software
18*6ae1554aSColin Percival  *    without specific prior written permission.
19*6ae1554aSColin Percival  *
20*6ae1554aSColin Percival  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21*6ae1554aSColin Percival  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22*6ae1554aSColin Percival  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23*6ae1554aSColin Percival  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24*6ae1554aSColin Percival  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25*6ae1554aSColin Percival  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26*6ae1554aSColin Percival  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27*6ae1554aSColin Percival  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28*6ae1554aSColin Percival  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29*6ae1554aSColin Percival  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30*6ae1554aSColin Percival  * SUCH DAMAGE.
31*6ae1554aSColin Percival  */
32*6ae1554aSColin Percival 
33*6ae1554aSColin Percival #include <sys/types.h>
34*6ae1554aSColin Percival 
35*6ae1554aSColin Percival #define	STR_ENDSTRING(line,tbl) \
36*6ae1554aSColin Percival 	(((unsigned char)(line)[0]) == (tbl).str_delim && (line)[1] == '\n')
37*6ae1554aSColin Percival 
38*6ae1554aSColin Percival typedef struct {				/* information table */
39*6ae1554aSColin Percival #define	VERSION		1
40*6ae1554aSColin Percival 	uint32_t	str_version;		/* version number */
41*6ae1554aSColin Percival 	uint32_t	str_numstr;		/* # of strings in the file */
42*6ae1554aSColin Percival 	uint32_t	str_longlen;		/* length of longest string */
43*6ae1554aSColin Percival 	uint32_t	str_shortlen;		/* length of shortest string */
44*6ae1554aSColin Percival #define	STR_RANDOM	0x1			/* randomized pointers */
45*6ae1554aSColin Percival #define	STR_ORDERED	0x2			/* ordered pointers */
46*6ae1554aSColin Percival #define	STR_ROTATED	0x4			/* rot-13'd text */
47*6ae1554aSColin Percival #define	STR_COMMENTS	0x8			/* embedded comments */
48*6ae1554aSColin Percival 	uint32_t	str_flags;		/* bit field for flags */
49*6ae1554aSColin Percival 	unsigned char	stuff[4];		/* 64-bit aligned space */
50*6ae1554aSColin Percival #define	str_delim	stuff[0]		/* delimiting character */
51*6ae1554aSColin Percival } STRFILE;
52