Commit | Line | Data |
---|---|---|
051b1e55 DF |
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 | ||
7 | #ifndef lint | |
8 | static char sccsid[] = "@(#)escseq.c 5.1 (Berkeley) %G%"; | |
9 | #endif not lint | |
10 | ||
75cca8e4 RC |
11 | /* |
12 | * escseq: get us out of any escape sequence we are in the middle of | |
13 | * and put us into the requested kind of escape sequence. | |
14 | */ | |
15 | ||
16 | #include "2648.h" | |
17 | ||
18 | escseq(mode) | |
19 | int mode; | |
20 | { | |
21 | if (mode == _escmode) | |
22 | return; | |
23 | /* Get out of previous mode */ | |
24 | switch (_escmode) { | |
25 | case NONE: | |
26 | break; | |
27 | case ESCD: | |
28 | if (mode == TEXT) { | |
29 | outchar('s'); | |
30 | _escmode = mode; | |
31 | return; | |
32 | } | |
33 | case ESCP: | |
34 | case ESCM: | |
35 | outchar('Z'); /* no-op */ | |
36 | break; | |
37 | case TEXT: | |
38 | outstr("\33*dT"); | |
39 | break; | |
40 | } | |
41 | /* Get into new mode */ | |
42 | switch (_escmode = mode) { | |
43 | case NONE: | |
44 | break; | |
45 | case ESCD: | |
46 | outstr("\33*d"); | |
47 | break; | |
48 | case ESCP: | |
49 | outstr("\33*p"); | |
50 | break; | |
51 | case ESCM: | |
52 | outstr("\33*m"); | |
53 | break; | |
54 | case TEXT: | |
55 | outstr("\33*dS"); | |
56 | break; | |
57 | } | |
58 | } |