xref: /original-bsd/bin/sh/parser.h (revision 5133e8a4)
1 /*-
2  * Copyright (c) 1991 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * Kenneth Almquist.
7  *
8  * %sccs.include.redist.c%
9  *
10  *	@(#)parser.h	5.3 (Berkeley) 06/23/92
11  */
12 
13 /* control characters in argument strings */
14 #define CTLESC '\201'
15 #define CTLVAR '\202'
16 #define CTLENDVAR '\203'
17 #define CTLBACKQ '\204'
18 #define CTLQUOTE 01		/* ored with CTLBACKQ code if in quotes */
19 /*	CTLBACKQ | CTLQUOTE == '\205' */
20 #define	CTLARI	'\206'
21 #define	CTLENDARI '\207'
22 
23 /* variable substitution byte (follows CTLVAR) */
24 #define VSTYPE 07		/* type of variable substitution */
25 #define VSNUL 040		/* colon--treat the empty string as unset */
26 #define VSQUOTE 0100		/* inside double quotes--suppress splitting */
27 
28 /* values of VSTYPE field */
29 #define VSNORMAL 1		/* normal variable:  $var or ${var} */
30 #define VSMINUS 2		/* ${var-text} */
31 #define VSPLUS 3		/* ${var+text} */
32 #define VSQUESTION 4		/* ${var?message} */
33 #define VSASSIGN 5		/* ${var=text} */
34 
35 
36 /*
37  * NEOF is returned by parsecmd when it encounters an end of file.  It
38  * must be distinct from NULL, so we use the address of a variable that
39  * happens to be handy.
40  */
41 extern int tokpushback;
42 #define NEOF ((union node *)&tokpushback)
43 extern int whichprompt;		/* 1 == PS1, 2 == PS2 */
44 
45 
46 #ifdef __STDC__
47 union node *parsecmd(int);
48 int goodname(char *);
49 char *getprompt(void *);
50 #else
51 union node *parsecmd();
52 int goodname();
53 char *getprompt();
54 #endif
55