]>
Commit | Line | Data |
---|---|---|
c7de829c WD |
1 | /**************************************************************************** |
2 | * | |
3 | * SciTech OS Portability Manager Library | |
4 | * | |
5 | * ======================================================================== | |
6 | * | |
7 | * The contents of this file are subject to the SciTech MGL Public | |
8 | * License Version 1.0 (the "License"); you may not use this file | |
9 | * except in compliance with the License. You may obtain a copy of | |
10 | * the License at http://www.scitechsoft.com/mgl-license.txt | |
11 | * | |
12 | * Software distributed under the License is distributed on an | |
13 | * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | |
14 | * implied. See the License for the specific language governing | |
15 | * rights and limitations under the License. | |
16 | * | |
17 | * The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. | |
18 | * | |
19 | * The Initial Developer of the Original Code is SciTech Software, Inc. | |
20 | * All Rights Reserved. | |
21 | * | |
22 | * ======================================================================== | |
23 | * | |
24 | * | |
25 | * Language: ANSI C | |
26 | * Environment: any | |
27 | * | |
28 | * Description: Test program to check the ability to install a C based | |
29 | * control C/break interrupt handler. | |
30 | * | |
31 | * Functions tested: PM_installBreakHandler() | |
32 | * PM_ctrlCHit() | |
33 | * PM_ctrlBreakHit() | |
34 | * PM_restoreBreakHandler() | |
35 | * | |
36 | * | |
37 | ****************************************************************************/ | |
38 | ||
39 | #include <stdlib.h> | |
40 | #include <stdio.h> | |
41 | #include "pmapi.h" | |
42 | ||
43 | int main(void) | |
44 | { | |
45 | printf("Program running in "); | |
46 | switch (PM_getModeType()) { | |
8bde7f77 WD |
47 | case PM_realMode: |
48 | printf("real mode.\n\n"); | |
49 | break; | |
50 | case PM_286: | |
51 | printf("16 bit protected mode.\n\n"); | |
52 | break; | |
53 | case PM_386: | |
54 | printf("32 bit protected mode.\n\n"); | |
55 | break; | |
56 | } | |
c7de829c WD |
57 | |
58 | PM_installBreakHandler(); | |
59 | printf("Control C/Break interrupt handler installed\n"); | |
60 | while (1) { | |
8bde7f77 WD |
61 | if (PM_ctrlCHit(1)) { |
62 | printf("Code termimated with Ctrl-C.\n"); | |
63 | break; | |
64 | } | |
65 | if (PM_ctrlBreakHit(1)) { | |
66 | printf("Code termimated with Ctrl-Break.\n"); | |
67 | break; | |
68 | } | |
69 | if (PM_kbhit() && PM_getch() == 0x1B) { | |
70 | printf("No break code detected!\n"); | |
71 | break; | |
72 | } | |
73 | printf("Hit Ctrl-C or Ctrl-Break to exit!\n"); | |
74 | } | |
c7de829c WD |
75 | |
76 | PM_restoreBreakHandler(); | |
77 | return 0; | |
78 | } |