Install sccs headers and copyright notices.
[unix-history] / usr / src / usr.bin / tn3270 / ctlr / options.c
CommitLineData
b3ef1ba3 1/*
992de934 2 * Copyright (c) 1984-1987 by the Regents of the
b3ef1ba3
GM
3 * University of California and by Gregory Glenn Minshall.
4 *
5 * Permission to use, copy, modify, and distribute these
6 * programs and their documentation for any purpose and
7 * without fee is hereby granted, provided that this
8 * copyright and permission appear on all copies and
9 * supporting documentation, the name of the Regents of
10 * the University of California not be used in advertising
11 * or publicity pertaining to distribution of the programs
12 * without specific prior permission, and notice be given in
13 * supporting documentation that copying and distribution is
14 * by permission of the Regents of the University of California
15 * and by Gregory Glenn Minshall. Neither the Regents of the
16 * University of California nor Gregory Glenn Minshall make
17 * representations about the suitability of this software
18 * for any purpose. It is provided "as is" without
19 * express or implied warranty.
20 */
21
22#ifndef lint
992de934 23static char sccsid[] = "@(#)options.c 1.3 (Berkeley) %G%";
b3ef1ba3
GM
24#endif /* ndef lint */
25
26/*
27 * this file contains the definitions, initialization, and processing of
28 * commands to handle the various local options (APL ON, etc.)
29 */
30
31#include "options.h"
32
96a643fe 33#include "../general/globals.h"
b3ef1ba3
GM
34#include "options.ext"
35
36void
37OptInit()
38{
39 register int i;
40
41 OptAPLmode = 0;
42 OptNullProcessing = 1; /* improved null processing */
43 OptZonesMode = 0; /* zones mode off */
44 OptEnterNL = 0; /* regular enter/new line keys */
45 OptColFieldTab = 0; /* regular column/field tab keys */
46 OptPacing = 1; /* do pacing */
47 OptAlphaInNumeric = 0; /* allow alpha in numeric fields */
48 for (i = 0; i < sizeof OptColTabs; i++) {
49 OptColTabs[i] = ((i%8) == 0); /* every 8 columns */
50 }
51 OptHome = 0;
52 OptLeftMargin = 0;
53 OptWordWrap = 0;
54}
55
56OptOrder(pointer, count, control)
57char *pointer;
58int count;
59int control;
60{
61 int i, j, character, origCount;
62
63 origCount = count;
64
65 if (count == 0) {
66 return(0);
67 }
68 character = *pointer&0xff;
69 pointer++;
70 count--;
71 switch (character) {
72 case 0xa0:
73 OptAPLmode = 1;
74 break;
75 case 0x61:
76 OptAPLmode = 0;
77 break;
78 case 0x95:
79 OptNullProcessing = 0;
80 break;
81 case 0xd5:
82 OptNullProcessing = 1;
83 break;
84 case 0xa9:
85 OptZonesMode = 1;
86 break;
87 case 0xe9:
88 OptZonesMode = 0;
89 break;
90 case 0x85:
91 OptEnterNL = 1;
92 break;
93 case 0xc5:
94 OptEnterNL = 0;
95 break;
96 case 0x83:
97 OptColFieldTab = 1;
98 break;
99 case 0xc3:
100 OptColFieldTab = 0;
101 break;
102 case 0x97:
103 OptPacing = 0;
104 break;
105 case 0xd7:
106 OptPacing = 1;
107 break;
108 case 0xa5:
109 OptAlphaInNumeric = 1;
110 break;
111 case 0xe5:
112 OptAlphaInNumeric = 0;
113 break;
114 case 0xe3:
115 if (!control && count < 30) {
116 return(0); /* want more! */
117 }
118 for (i = 0; i < sizeof OptColTabs; i++) {
119 OptColTabs[i] = 0;
120 }
121 if (!count) {
122 break;
123 }
124 j = (*pointer&0xff)-0x40;
125 count--;
126 pointer++;
127 if (j < 0 || j >= 24) {
128 break;
129 }
130 OptHome = j;
131 if (!count) {
132 break;
133 }
134 j = (*pointer&0xff)-0x40;
135 count--;
136 pointer++;
137 if (j < 0 || j >= 80) {
138 break;
139 }
140 OptLeftMargin = j;
141 if (!count) {
142 break;
143 }
144 i = count;
145 if (i > 28) {
146 i = 28;
147 }
148 while (i) {
149 j = (*pointer&0xff)-0x40;
150 if (j < 0 || j >= sizeof OptColTabs) {
151 break;
152 }
153 OptColTabs[j] = 1;
154 i --;
155 pointer++;
156 count--;
157 }
158 break;
159 case 0xa6:
160 OptWordWrap = 1;
161 break;
162 case 0xe6:
163 OptWordWrap = 0;
164 break;
165 default:
166 break;
167 }
168 return(origCount - count);
169}