]> git.saurik.com Git - wxWidgets.git/blame - utils/Install/sfxace/uac_sys.c
Make scrollbars appear.
[wxWidgets.git] / utils / Install / sfxace / uac_sys.c
CommitLineData
f6bcfd97
BP
1/* ------------------------------------------------------------------------ */
2/* */
3/* Some basic things. */
4/* */
5/* ------------------------------------------------------------------------ */
6
7#include "os.h"
8
9#include <signal.h> // signal()
10#include <stdio.h> // fprintf() fflush() getch() putc()
11
12#include "globals.h"
13#include "uac_sys.h"
14
15
16void memset16(USHORT * dest, SHORT val, INT len) // fills short-array with
17{ // value
18 while (len--)
19 *(dest++) = val;
20}
21
22INT cancel(void) // checks whether to interrupt the program
23{
24#ifdef DOS
25 while (kbhit())
26 {
27 if (getch() == 27)
28 f_err = ERR_USER;
29 }
30#endif
31 return (f_err);
32}
33
34/*INT wrask(CHAR * s) // prompt-routine
35{
36 INT ch;
37
38 fprintf(stderr, "\n %s (Yes,Always,No,Cancel) ", s);
39 fflush(stderr);
40 do
41 {
42 ch = getch();
43 ch = upcase(ch);
44 }
45 while (ch != 'Y' && ch != 'A' && ch != 'N' && ch != 'C' && ch != 27);
46 fprintf(stderr, "%s", ch == 'Y' ? "Yes" : (ch == 'A' ? "Always" : (ch == 'N' ? "No" : "Cancel")));
47 fflush(stderr);
48 return (ch == 'Y' ? 0 : (ch == 'A' ? 1 : (ch == 'N' ? 2 : 3)));
49} */
50
51void beep(void) // makes some noise
52{
53#ifdef DOS
54 sound(800);
55 delay(250);
56 nosound();
57#endif
58#ifdef AMIGA
59 putc(0x07, stderr);
60#endif
61}
62
63void my_signalhandler(INT sig_number) // sets f_err if ctrl+c or ctrl+brk
64{
65 f_err = ERR_USER;
66 error("\nUser break\n");
67}
68
69#ifdef DOS // handles hardware errors
70#ifdef __BORLANDC__
71INT harderrhandler(UINT deverr, UINT errc, UINT * devhdr)
72#else
73INT __far harderrhandler(UINT deverr, UINT errc, UINT * devhdr)
74#endif
75{
76 f_criterr = 'A' + deverr & 0xff;
77 f_err = ERR_OTHER;
78 return (0x3);
79}
80#endif
81
82void set_handler(void) // initializes handlers
83{
84#if defined(DOS) && !defined(__BORLANDC__)
85 signal(SIGBREAK, my_signalhandler); // set ctrl-break/-c handlers
86#endif
87 signal(SIGINT, my_signalhandler);
88#if defined(DOS) && !defined(__CONSOLE__) // set hardware error handler
89#ifdef __BORLANDC__
90 harderr(harderrhandler);
91#else
92 _harderr(harderrhandler);
93#endif
94#endif
95}
96