17c478bdstevel@tonic-gate/*
27c478bdstevel@tonic-gate * CDDL HEADER START
37c478bdstevel@tonic-gate *
47c478bdstevel@tonic-gate * The contents of this file are subject to the terms of the
57c478bdstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
67c478bdstevel@tonic-gate * (the "License").  You may not use this file except in compliance
77c478bdstevel@tonic-gate * with the License.
87c478bdstevel@tonic-gate *
97c478bdstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bdstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
117c478bdstevel@tonic-gate * See the License for the specific language governing permissions
127c478bdstevel@tonic-gate * and limitations under the License.
137c478bdstevel@tonic-gate *
147c478bdstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
157c478bdstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bdstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
177c478bdstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
187c478bdstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bdstevel@tonic-gate *
207c478bdstevel@tonic-gate * CDDL HEADER END
217c478bdstevel@tonic-gate */
227c478bdstevel@tonic-gate/*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
237c478bdstevel@tonic-gate/*	  All Rights Reserved  	*/
247c478bdstevel@tonic-gate
257c478bdstevel@tonic-gate
267c478bdstevel@tonic-gate#ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.10.1.1	*/
277c478bdstevel@tonic-gate/*
287c478bdstevel@tonic-gate *	UNIX shell
297c478bdstevel@tonic-gate */
307c478bdstevel@tonic-gate
317c478bdstevel@tonic-gate
327c478bdstevel@tonic-gate/* table 1 */
337c478bdstevel@tonic-gate#define T_SUB	01
347c478bdstevel@tonic-gate#define T_MET	02
357c478bdstevel@tonic-gate#define	T_SPC	04
367c478bdstevel@tonic-gate#define T_DIP	010
377c478bdstevel@tonic-gate#define T_EOF	020
387c478bdstevel@tonic-gate#define T_EOR	040
397c478bdstevel@tonic-gate#define T_QOT	0100
407c478bdstevel@tonic-gate#define T_ESC	0200
417c478bdstevel@tonic-gate
427c478bdstevel@tonic-gate/* table 2 */
437c478bdstevel@tonic-gate#define T_BRC	01
447c478bdstevel@tonic-gate#define T_DEF	02
457c478bdstevel@tonic-gate#define T_AST	04
467c478bdstevel@tonic-gate#define	T_DIG	010
477c478bdstevel@tonic-gate#define T_SHN	040
487c478bdstevel@tonic-gate#define	T_IDC	0100
497c478bdstevel@tonic-gate#define T_SET	0200
507c478bdstevel@tonic-gate
517c478bdstevel@tonic-gate/* for single chars */
527c478bdstevel@tonic-gate#define _TAB	(T_SPC)
537c478bdstevel@tonic-gate#define _SPC	(T_SPC)
547c478bdstevel@tonic-gate#define _UPC	(T_IDC)
557c478bdstevel@tonic-gate#define _LPC	(T_IDC)
567c478bdstevel@tonic-gate#define _DIG	(T_DIG)
577c478bdstevel@tonic-gate#define _EOF	(T_EOF)
587c478bdstevel@tonic-gate#define _EOR	(T_EOR)
597c478bdstevel@tonic-gate#define _BAR	(T_DIP)
607c478bdstevel@tonic-gate#define _HAT	(T_MET)
617c478bdstevel@tonic-gate#define _BRA	(T_MET)
627c478bdstevel@tonic-gate#define _KET	(T_MET)
637c478bdstevel@tonic-gate#define _AMP	(T_DIP)
647c478bdstevel@tonic-gate#define _SEM	(T_DIP)
657c478bdstevel@tonic-gate#define _LT	(T_DIP)
667c478bdstevel@tonic-gate#define _GT	(T_DIP)
677c478bdstevel@tonic-gate#define _LQU	(T_QOT|T_ESC)
687c478bdstevel@tonic-gate#define _BSL	(T_ESC)
697c478bdstevel@tonic-gate#define _DQU	(T_QOT|T_ESC)
707c478bdstevel@tonic-gate#define _DOL1	(T_SUB|T_ESC)
717c478bdstevel@tonic-gate
727c478bdstevel@tonic-gate#define _CBR	T_BRC
737c478bdstevel@tonic-gate#define _CKT	T_DEF
747c478bdstevel@tonic-gate#define _AST	(T_AST)
757c478bdstevel@tonic-gate#define _EQ	(T_DEF)
767c478bdstevel@tonic-gate#define _MIN	(T_DEF|T_SHN)
777c478bdstevel@tonic-gate#define _PCS	(T_SHN)
787c478bdstevel@tonic-gate#define _NUM	(T_SHN)
797c478bdstevel@tonic-gate#define _DOL2	(T_SHN)
807c478bdstevel@tonic-gate#define _PLS	(T_DEF|T_SET)
817c478bdstevel@tonic-gate#define _AT	(T_AST)
827c478bdstevel@tonic-gate#define _QU	(T_DEF|T_SHN)
837c478bdstevel@tonic-gate
847c478bdstevel@tonic-gate/* abbreviations for tests */
857c478bdstevel@tonic-gate#define _IDCH	(T_IDC|T_DIG)
867c478bdstevel@tonic-gate#define _META	(T_SPC|T_DIP|T_MET|T_EOR)
877c478bdstevel@tonic-gate
887c478bdstevel@tonic-gateextern
897c478bdstevel@tonic-gate#ifdef __STDC__
907c478bdstevel@tonic-gateconst
917c478bdstevel@tonic-gate#endif
927c478bdstevel@tonic-gateunsigned char	_ctype1[];
937c478bdstevel@tonic-gate
947c478bdstevel@tonic-gate/* nb these args are not call by value !!!! */
957c478bdstevel@tonic-gate#define	space(c)	((c<QUOTE) && _ctype1[c]&(T_SPC))
967c478bdstevel@tonic-gate#define eofmeta(c)	((c<QUOTE) && _ctype1[c]&(_META|T_EOF))
977c478bdstevel@tonic-gate#define qotchar(c)	((c<QUOTE) && _ctype1[c]&(T_QOT))
987c478bdstevel@tonic-gate#define eolchar(c)	((c<QUOTE) && _ctype1[c]&(T_EOR|T_EOF))
997c478bdstevel@tonic-gate#define dipchar(c)	((c<QUOTE) && _ctype1[c]&(T_DIP))
1007c478bdstevel@tonic-gate#define subchar(c)	((c<QUOTE) && _ctype1[c]&(T_SUB|T_QOT))
1017c478bdstevel@tonic-gate#define escchar(c)	((c<QUOTE) && _ctype1[c]&(T_ESC))
1027c478bdstevel@tonic-gate
1037c478bdstevel@tonic-gateextern
1047c478bdstevel@tonic-gate#ifdef __STDC__
1057c478bdstevel@tonic-gateconst
1067c478bdstevel@tonic-gate#endif
1077c478bdstevel@tonic-gateunsigned char   _ctype2[];
1087c478bdstevel@tonic-gate
1097c478bdstevel@tonic-gate#define	digit(c)	((c<QUOTE) && _ctype2[c]&(T_DIG))
1107c478bdstevel@tonic-gate#define dolchar(c)	((c<QUOTE) && _ctype2[c]&(T_AST|T_BRC|T_DIG|T_IDC|T_SHN))
1117c478bdstevel@tonic-gate#define defchar(c)	((c<QUOTE) && _ctype2[c]&(T_DEF))
1127c478bdstevel@tonic-gate#define setchar(c)	((c<QUOTE) && _ctype2[c]&(T_SET))
1137c478bdstevel@tonic-gate#define digchar(c)	((c<QUOTE) && _ctype2[c]&(T_AST|T_DIG))
1147c478bdstevel@tonic-gate#define	letter(c)	((c<QUOTE) && _ctype2[c]&(T_IDC))
1157c478bdstevel@tonic-gate#define alphanum(c)	((c<QUOTE) && _ctype2[c]&(_IDCH))
1167c478bdstevel@tonic-gate#define astchar(c)	((c<QUOTE) && _ctype2[c]&(T_AST))
117