xref: /illumos-gate/usr/src/contrib/ast/src/lib/libcmd/wc.h (revision b30d1939)
1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *          Copyright (c) 1992-2011 AT&T Intellectual Property          *
5 *                      and is licensed under the                       *
6 *                 Eclipse Public License, Version 1.0                  *
7 *                    by AT&T Intellectual Property                     *
8 *                                                                      *
9 *                A copy of the License is available at                 *
10 *          http://www.eclipse.org/org/documents/epl-v10.html           *
11 *         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
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 #define WC_NOUTF8	0x40
41 
42 typedef struct
43 {
44 	char	type[1<<CHAR_BIT];
45 	Sfoff_t words;
46 	Sfoff_t lines;
47 	Sfoff_t chars;
48 	Sfoff_t longest;
49 	int	mode;
50 	int	mb;
51 } Wc_t;
52 
53 #define wc_count	_cmd_wccount
54 #define wc_init		_cmd_wcinit
55 
56 extern Wc_t*		wc_init(int);
57 extern int		wc_count(Wc_t*, Sfio_t*, const char*);
58 
59 #endif /* _WC_H */
60