1 /*
2
3 GNU GENERAL PUBLIC LICENSE
4 **************************
5
6
7 Copyright (C) 1999 Todd Martin Miller
8 tmiller@toddmiller.com
9
10 Everyone is permitted to copy and distribute verbatim copies
11 of this license document, but changing it is not allowed.
12
13 Preamble
14 ========
15
16 The licenses for most software are designed to take away your
17 freedom to share and change it. By contrast, the GNU General Public
18 License is intended to guarantee your freedom to share and change free
19 software--to make sure the software is free for all its users.
20
21 When we speak of free software, we are referring to freedom, not
22 price. Our General Public Licenses are designed to make sure that you
23 have the freedom to distribute copies of free software (and charge for
24 this service if you wish), that you receive source code or can get it
25 if you want it, that you can change the software or use pieces of it in
26 new free programs; and that you know you can do these things.
27
28 To protect your rights, we need to make restrictions that forbid
29 anyone to deny you these rights or to ask you to surrender the rights.
30 These restrictions translate to certain responsibilities for you if you
31 distribute copies of the software, or if you modify it.
32
33 For example, if you distribute copies of such a program, whether
34 gratis or for a fee, you must give the recipients all the rights that
35 you have. You must make sure that they, too, receive or can get the
36 source code. And you must show them these terms so they know their
37 rights.
38
39 We protect your rights with two steps: (1) copyright the software,
40 and (2) offer you this license which gives you legal permission to copy,
41 distribute and/or modify the software.
42
43 Also, for each author's protection and ours, we want to make certain
44 that everyone understands that there is no warranty for this free
45 software. If the software is modified by someone else and passed on, we
46 want its recipients to know that what they have is not the original, so
47 that any problems introduced by others will not reflect on the original
48 authors' reputations.
49
50 Finally, any free program is threatened constantly by software
51 patents. We wish to avoid the danger that redistributors of a free
52 program will individually obtain patent licenses, in effect making the
53 program proprietary. To prevent this, we have made it clear that any
54 patent must be licensed for everyone's free use or not licensed at all.
55
56 The precise terms and conditions for copying, distribution and
57 modification follow.
58
59 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
60
61 0. This License applies to any program or other work which contains a
62 notice placed by the copyright holder saying it may be distributed
63 under the terms of this General Public License. The "Program",
64 below, refers to any such program or work, and a "work based on
65 the Program" means either the Program or any derivative work under
66 copyright law: that is to say, a work containing the Program or a
67 portion of it, either verbatim or with modifications and/or
68 translated into another language. (Hereinafter, translation is
69 included without limitation in the term "modification".) Each
70 licensee is addressed as "you".
71
72 Activities other than copying, distribution and modification are
73 not covered by this License; they are outside its scope. The act
74 of running the Program is not restricted, and the output from the
75 Program is covered only if its contents constitute a work based on
76 the Program (independent of having been made by running the
77 Program). Whether that is true depends on what the Program does.
78
79 1. You may copy and distribute verbatim copies of the Program's
80 source code as you receive it, in any medium, provided that you
81 conspicuously and appropriately publish on each copy an appropriate
82 copyright notice and disclaimer of warranty; keep intact all the
83 notices that refer to this License and to the absence of any
84 warranty; and give any other recipients of the Program a copy of
85 this License along with the Program.
86
87 You may charge a fee for the physical act of transferring a copy,
88 and you may at your option offer warranty protection in exchange
89 for a fee.
90
91 2. You may modify your copy or copies of the Program or any portion
92 of it, thus forming a work based on the Program, and copy and
93 distribute such modifications or work under the terms of Section 1
94 above, provided that you also meet all of these conditions:
95
96 a. You must cause the modified files to carry prominent notices
97 stating that you changed the files and the date of any change.
98
99 b. You must cause any work that you distribute or publish, that
100 in whole or in part contains or is derived from the Program
101 or any part thereof, to be licensed as a whole at no charge
102 to all third parties under the terms of this License.
103
104 c. If the modified program normally reads commands interactively
105 when run, you must cause it, when started running for such
106 interactive use in the most ordinary way, to print or display
107 an announcement including an appropriate copyright notice and
108 a notice that there is no warranty (or else, saying that you
109 provide a warranty) and that users may redistribute the
110 program under these conditions, and telling the user how to
111 view a copy of this License. (Exception: if the Program
112 itself is interactive but does not normally print such an
113 announcement, your work based on the Program is not required
114 to print an announcement.)
115
116 These requirements apply to the modified work as a whole. If
117 identifiable sections of that work are not derived from the
118 Program, and can be reasonably considered independent and separate
119 works in themselves, then this License, and its terms, do not
120 apply to those sections when you distribute them as separate
121 works. But when you distribute the same sections as part of a
122 whole which is a work based on the Program, the distribution of
123 the whole must be on the terms of this License, whose permissions
124 for other licensees extend to the entire whole, and thus to each
125 and every part regardless of who wrote it.
126
127 Thus, it is not the intent of this section to claim rights or
128 contest your rights to work written entirely by you; rather, the
129 intent is to exercise the right to control the distribution of
130 derivative or collective works based on the Program.
131
132 In addition, mere aggregation of another work not based on the
133 Program with the Program (or with a work based on the Program) on
134 a volume of a storage or distribution medium does not bring the
135 other work under the scope of this License.
136
137 3. You may copy and distribute the Program (or a work based on it,
138 under Section 2) in object code or executable form under the terms
139 of Sections 1 and 2 above provided that you also do one of the
140 following:
141
142 a. Accompany it with the complete corresponding machine-readable
143 source code, which must be distributed under the terms of
144 Sections 1 and 2 above on a medium customarily used for
145 software interchange; or,
146
147 b. Accompany it with a written offer, valid for at least three
148 years, to give any third party, for a charge no more than your
149 cost of physically performing source distribution, a complete
150 machine-readable copy of the corresponding source code, to be
151 distributed under the terms of Sections 1 and 2 above on a
152 medium customarily used for software interchange; or,
153
154 c. Accompany it with the information you received as to the offer
155 to distribute corresponding source code. (This alternative is
156 allowed only for noncommercial distribution and only if you
157 received the program in object code or executable form with
158 such an offer, in accord with Subsection b above.)
159
160 The source code for a work means the preferred form of the work for
161 making modifications to it. For an executable work, complete
162 source code means all the source code for all modules it contains,
163 plus any associated interface definition files, plus the scripts
164 used to control compilation and installation of the executable.
165 However, as a special exception, the source code distributed need
166 not include anything that is normally distributed (in either
167 source or binary form) with the major components (compiler,
168 kernel, and so on) of the operating system on which the executable
169 runs, unless that component itself accompanies the executable.
170
171 If distribution of executable or object code is made by offering
172 access to copy from a designated place, then offering equivalent
173 access to copy the source code from the same place counts as
174 distribution of the source code, even though third parties are not
175 compelled to copy the source along with the object code.
176
177 4. You may not copy, modify, sublicense, or distribute the Program
178 except as expressly provided under this License. Any attempt
179 otherwise to copy, modify, sublicense or distribute the Program is
180 void, and will automatically terminate your rights under this
181 License. However, parties who have received copies, or rights,
182 from you under this License will not have their licenses
183 terminated so long as such parties remain in full compliance.
184
185 5. You are not required to accept this License, since you have not
186 signed it. However, nothing else grants you permission to modify
187 or distribute the Program or its derivative works. These actions
188 are prohibited by law if you do not accept this License.
189 Therefore, by modifying or distributing the Program (or any work
190 based on the Program), you indicate your acceptance of this
191 License to do so, and all its terms and conditions for copying,
192 distributing or modifying the Program or works based on it.
193
194 6. Each time you redistribute the Program (or any work based on the
195 Program), the recipient automatically receives a license from the
196 original licensor to copy, distribute or modify the Program
197 subject to these terms and conditions. You may not impose any
198 further restrictions on the recipients' exercise of the rights
199 granted herein. You are not responsible for enforcing compliance
200 by third parties to this License.
201
202 7. If, as a consequence of a court judgment or allegation of patent
203 infringement or for any other reason (not limited to patent
204 issues), conditions are imposed on you (whether by court order,
205 agreement or otherwise) that contradict the conditions of this
206 License, they do not excuse you from the conditions of this
207 License. If you cannot distribute so as to satisfy simultaneously
208 your obligations under this License and any other pertinent
209 obligations, then as a consequence you may not distribute the
210 Program at all. For example, if a patent license would not permit
211 royalty-free redistribution of the Program by all those who
212 receive copies directly or indirectly through you, then the only
213 way you could satisfy both it and this License would be to refrain
214 entirely from distribution of the Program.
215
216 If any portion of this section is held invalid or unenforceable
217 under any particular circumstance, the balance of the section is
218 intended to apply and the section as a whole is intended to apply
219 in other circumstances.
220
221 It is not the purpose of this section to induce you to infringe any
222 patents or other property right claims or to contest validity of
223 any such claims; this section has the sole purpose of protecting
224 the integrity of the free software distribution system, which is
225 implemented by public license practices. Many people have made
226 generous contributions to the wide range of software distributed
227 through that system in reliance on consistent application of that
228 system; it is up to the author/donor to decide if he or she is
229 willing to distribute software through any other system and a
230 licensee cannot impose that choice.
231
232 This section is intended to make thoroughly clear what is believed
233 to be a consequence of the rest of this License.
234
235 8. If the distribution and/or use of the Program is restricted in
236 certain countries either by patents or by copyrighted interfaces,
237 the original copyright holder who places the Program under this
238 License may add an explicit geographical distribution limitation
239 excluding those countries, so that distribution is permitted only
240 in or among countries not thus excluded. In such case, this
241 License incorporates the limitation as if written in the body of
242 this License.
243
244 9. The Free Software Foundation may publish revised and/or new
245 versions of the General Public License from time to time. Such
246 new versions will be similar in spirit to the present version, but
247 may differ in detail to address new problems or concerns.
248
249 Each version is given a distinguishing version number. If the
250 Program specifies a version number of this License which applies
251 to it and "any later version", you have the option of following
252 the terms and conditions either of that version or of any later
253 version published by the Free Software Foundation. If the Program
254 does not specify a version number of this License, you may choose
255 any version ever published by the Free Software Foundation.
256
257 10. If you wish to incorporate parts of the Program into other free
258 programs whose distribution conditions are different, write to the
259 author to ask for permission. For software which is copyrighted
260 by the Free Software Foundation, write to the Free Software
261 Foundation; we sometimes make exceptions for this. Our decision
262 will be guided by the two goals of preserving the free status of
263 all derivatives of our free software and of promoting the sharing
264 and reuse of software generally.
265
266
267 NO WARRANTY
268
269 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
270 WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
271 LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
272 HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
273 WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT
274 NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
275 FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE
276 QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
277 PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
278 SERVICING, REPAIR OR CORRECTION.
279
280 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
281 WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY
282 MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE
283 LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
284 INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
285 INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
286 DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU
287 OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY
288 OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN
289 ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
290
291 */
292
293
294 #include "periodic.h"
295 #ifdef VMS
296 #include <iodef.h>
297 #include <descrip.h>
298 #endif
299
300 extern short int ttchannel;
301
ttinp(void)302 int ttinp ( void )
303 {
304
305 int Status;
306 unsigned char inpbuf[1];
307 int key;
308 #ifdef VMS
309 Status = SYS$QIOW(0,ttchannel,(IO$_READVBLK|IO$M_NOECHO|IO$M_NOFILTR),0,0,0,
310 inpbuf,1,0,0,0,0);
311 if(Status != 1) LIB$SIGNAL(Status);
312 #else
313 key = getch();
314 ttflush();
315 inpbuf[0] = key;
316 #endif
317 return (int) inpbuf[0];
318 }
319