xref: /onnv-gate/usr/src/lib/libcmd/common/wc.h (revision 12068:08a39a083754)
14887Schin /***********************************************************************
24887Schin *                                                                      *
34887Schin *               This software is part of the ast package               *
4*12068SRoger.Faulkner@Oracle.COM *          Copyright (c) 1992-2010 AT&T Intellectual Property          *
54887Schin *                      and is licensed under the                       *
64887Schin *                  Common Public License, Version 1.0                  *
78462SApril.Chin@Sun.COM *                    by AT&T Intellectual Property                     *
84887Schin *                                                                      *
94887Schin *                A copy of the License is available at                 *
104887Schin *            http://www.opensource.org/licenses/cpl1.0.txt             *
114887Schin *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
124887Schin *                                                                      *
134887Schin *              Information and Software Systems Research               *
144887Schin *                            AT&T Research                             *
154887Schin *                           Florham Park NJ                            *
164887Schin *                                                                      *
174887Schin *                 Glenn Fowler <gsf@research.att.com>                  *
184887Schin *                  David Korn <dgk@research.att.com>                   *
194887Schin *                                                                      *
204887Schin ***********************************************************************/
214887Schin #pragma prototyped
224887Schin /*
234887Schin  * David Korn
244887Schin  * AT&T Bell Laboratories
254887Schin  *
264887Schin  * header for wc library interface
274887Schin  */
284887Schin 
294887Schin #ifndef _WC_H
304887Schin #define _WC_H
314887Schin 
324887Schin #include <ast.h>
334887Schin 
344887Schin #define WC_LINES	0x01
354887Schin #define WC_WORDS	0x02
364887Schin #define WC_CHARS	0x04
374887Schin #define WC_MBYTE	0x08
384887Schin #define WC_LONGEST	0x10
394887Schin #define WC_QUIET	0x20
4010898Sroland.mainz@nrubsig.org #define WC_NOUTF8	0x40
414887Schin 
424887Schin typedef struct
434887Schin {
4410898Sroland.mainz@nrubsig.org 	char	type[1<<CHAR_BIT];
454887Schin 	Sfoff_t words;
464887Schin 	Sfoff_t lines;
474887Schin 	Sfoff_t chars;
484887Schin 	Sfoff_t longest;
494887Schin 	int	mode;
5010898Sroland.mainz@nrubsig.org 	int	mb;
514887Schin } Wc_t;
524887Schin 
534887Schin #define wc_count	_cmd_wccount
544887Schin #define wc_init		_cmd_wcinit
554887Schin 
564887Schin extern Wc_t*		wc_init(int);
574887Schin extern int		wc_count(Wc_t*, Sfio_t*, const char*);
584887Schin 
594887Schin #endif /* _WC_H */
60