|
|
1.1 root 1: /*
2: * Copyright (c) 1980 Regents of the University of California.
3: * All rights reserved. The Berkeley Software License Agreement
4: * specifies the terms and conditions for redistribution.
5: *
6: * @(#)sh.char.h 5.4 (Berkeley) 6/6/88
7: */
8:
9: extern unsigned short _cmap[];
10:
11: #define _Q 0x001 /* '" */
12: #define _Q1 0x002 /* ` */
13: #define _SP 0x004 /* space and tab */
14: #define _NL 0x008 /* \n */
15: #define _META 0x010 /* lex meta characters, sp #'`";&<>()|\t\n */
16: #define _GLOB 0x020 /* glob characters, *?{[` */
17: #define _ESC 0x040 /* \ */
18: #define _DOL 0x080 /* $ */
19: #define _DIG 0x100 /* 0-9 */
20: #define _LET 0x200 /* a-z, A-Z, _ */
21:
22: #define cmap(c, bits) (_cmap[(unsigned char)(c)] & (bits))
23:
24: #define isglob(c) cmap(c, _GLOB)
25: #define isspace(c) cmap(c, _SP)
26: #define isspnl(c) cmap(c, _SP|_NL)
27: #define ismeta(c) cmap(c, _META)
28: #define digit(c) cmap(c, _DIG)
29: #define letter(c) cmap(c, _LET)
30: #define alnum(c) (digit(c) || letter(c))
31:
32: #define LINELEN 128
33: extern char *linp, linbuf[LINELEN];
34:
35: #define CSHPUTCHAR { \
36: if (!(ch"E) && (ch == 0177 || ch < ' ' && ch != '\t' && \
37: ch != '\n')) { \
38: *linp++ = '^'; \
39: if (ch == 0177) \
40: ch = '?'; \
41: else \
42: ch |= 'A' - 1; \
43: if (linp >= &linbuf[sizeof linbuf - 2]) \
44: flush(); \
45: } \
46: ch &= TRIM; \
47: *linp++ = ch; \
48: if (ch == '\n' || linp >= &linbuf[sizeof(linbuf) - 2]) \
49: flush(); \
50: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.