147140Sbostic /*- 247140Sbostic * Copyright (c) 1991 The Regents of the University of California. 347140Sbostic * All rights reserved. 447140Sbostic * 547140Sbostic * This code is derived from software contributed to Berkeley by 647140Sbostic * Kenneth Almquist. 747140Sbostic * 847140Sbostic * %sccs.include.redist.c% 947140Sbostic * 10*54326Smarc * @(#)parser.h 5.3 (Berkeley) 06/23/92 1147140Sbostic */ 1247140Sbostic 1347140Sbostic /* control characters in argument strings */ 1447140Sbostic #define CTLESC '\201' 1547140Sbostic #define CTLVAR '\202' 1647140Sbostic #define CTLENDVAR '\203' 1747140Sbostic #define CTLBACKQ '\204' 1847140Sbostic #define CTLQUOTE 01 /* ored with CTLBACKQ code if in quotes */ 1953303Smarc /* CTLBACKQ | CTLQUOTE == '\205' */ 2053303Smarc #define CTLARI '\206' 2153303Smarc #define CTLENDARI '\207' 2247140Sbostic 2347140Sbostic /* variable substitution byte (follows CTLVAR) */ 2447140Sbostic #define VSTYPE 07 /* type of variable substitution */ 2547140Sbostic #define VSNUL 040 /* colon--treat the empty string as unset */ 2647140Sbostic #define VSQUOTE 0100 /* inside double quotes--suppress splitting */ 2747140Sbostic 2847140Sbostic /* values of VSTYPE field */ 2947140Sbostic #define VSNORMAL 1 /* normal variable: $var or ${var} */ 3047140Sbostic #define VSMINUS 2 /* ${var-text} */ 3147140Sbostic #define VSPLUS 3 /* ${var+text} */ 3247140Sbostic #define VSQUESTION 4 /* ${var?message} */ 3347140Sbostic #define VSASSIGN 5 /* ${var=text} */ 3447140Sbostic 3547140Sbostic 3647140Sbostic /* 3747140Sbostic * NEOF is returned by parsecmd when it encounters an end of file. It 3847140Sbostic * must be distinct from NULL, so we use the address of a variable that 3947140Sbostic * happens to be handy. 4047140Sbostic */ 4147140Sbostic extern int tokpushback; 4247140Sbostic #define NEOF ((union node *)&tokpushback) 43*54326Smarc extern int whichprompt; /* 1 == PS1, 2 == PS2 */ 4447140Sbostic 4547140Sbostic 4647140Sbostic #ifdef __STDC__ 4747140Sbostic union node *parsecmd(int); 4847140Sbostic int goodname(char *); 49*54326Smarc char *getprompt(void *); 5047140Sbostic #else 5147140Sbostic union node *parsecmd(); 5247140Sbostic int goodname(); 53*54326Smarc char *getprompt(); 5447140Sbostic #endif 55