xref: /titanic_44/usr/src/lib/libcmd/common/wc.h (revision 0398691684c2596072212e4ca9d7033ad7ccfa54)
1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *           Copyright (c) 1992-2007 AT&T Knowledge Ventures            *
5 *                      and is licensed under the                       *
6 *                  Common Public License, Version 1.0                  *
7 *                      by AT&T Knowledge Ventures                      *
8 *                                                                      *
9 *                A copy of the License is available at                 *
10 *            http://www.opensource.org/licenses/cpl1.0.txt             *
11 *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
12 *                                                                      *
13 *              Information and Software Systems Research               *
14 *                            AT&T Research                             *
15 *                           Florham Park NJ                            *
16 *                                                                      *
17 *                 Glenn Fowler <gsf@research.att.com>                  *
18 *                  David Korn <dgk@research.att.com>                   *
19 *                                                                      *
20 ***********************************************************************/
21 #pragma prototyped
22 /*
23  * David Korn
24  * AT&T Bell Laboratories
25  *
26  * header for wc library interface
27  */
28 
29 #ifndef _WC_H
30 #define _WC_H
31 
32 #include <ast.h>
33 
34 #define WC_LINES	0x01
35 #define WC_WORDS	0x02
36 #define WC_CHARS	0x04
37 #define WC_MBYTE	0x08
38 #define WC_LONGEST	0x10
39 #define WC_QUIET	0x20
40 
41 typedef struct
42 {
43 	signed char space[1<<CHAR_BIT];
44 	Sfoff_t words;
45 	Sfoff_t lines;
46 	Sfoff_t chars;
47 	Sfoff_t longest;
48 	int	mode;
49 } Wc_t;
50 
51 #define wc_count	_cmd_wccount
52 #define wc_init		_cmd_wcinit
53 
54 extern Wc_t*		wc_init(int);
55 extern int		wc_count(Wc_t*, Sfio_t*, const char*);
56 
57 #endif /* _WC_H */
58