fix bug that can cause recursive .forward files to fail
[unix-history] / usr / src / bin / sh / parser.h
CommitLineData
d46cf1d2 1/*-
d1b73048
KB
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
d46cf1d2
KB
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Kenneth Almquist.
7 *
8 * %sccs.include.redist.c%
9 *
d1b73048 10 * @(#)parser.h 8.1 (Berkeley) %G%
d46cf1d2
KB
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 */
df4e2023
MT
19/* CTLBACKQ | CTLQUOTE == '\205' */
20#define CTLARI '\206'
21#define CTLENDARI '\207'
d46cf1d2
KB
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 */
41extern int tokpushback;
42#define NEOF ((union node *)&tokpushback)
c660acc9 43extern int whichprompt; /* 1 == PS1, 2 == PS2 */
d46cf1d2
KB
44
45
46#ifdef __STDC__
47union node *parsecmd(int);
48int goodname(char *);
c660acc9 49char *getprompt(void *);
d46cf1d2
KB
50#else
51union node *parsecmd();
52int goodname();
c660acc9 53char *getprompt();
d46cf1d2 54#endif