diff options
author | Kevin Ryde <user42@zip.com.au> | 2001-10-18 22:59:07 +0200 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2001-10-18 22:59:07 +0200 |
commit | 6c43ea0f214dded3bccbe6866f85d1419086be0a (patch) | |
tree | 5788cb80647a391decad32514b4eb96990fdd2d1 /tests | |
parent | 88e8060485e5bed40c222a1b919e34bbc063855c (diff) | |
download | gmp-6c43ea0f214dded3bccbe6866f85d1419086be0a.tar.gz |
* tests/spinner.c: Conditionalize alarm and SIGALRM availability, for
the benefit of mingw32.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/spinner.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/tests/spinner.c b/tests/spinner.c index 63412d1a3..1e9c0caaf 100644 --- a/tests/spinner.c +++ b/tests/spinner.c @@ -35,6 +35,14 @@ MA 02111-1307, USA. */ #include "tests.h" +/* "alarm" is not available on mingw32, and the SIGALRM constant is not + defined. Don't bother with a spinner in this case. */ +#if ! HAVE_ALARM || ! defined (SIGALRM) +#define alarm(n) abort() +#define signal(sig,func) SIG_ERR +#endif + + /* An application can update this to get a count printed with the spinner. If left at 0, no count is printed. */ @@ -51,7 +59,11 @@ spinner_signal (int signum) { spinner_tick = 1; - if (signal (SIGALRM, spinner_signal) == SIG_ERR) abort (); + if (signal (SIGALRM, spinner_signal) == SIG_ERR) + { + printf ("spinner_signal(): Oops, cannot reinstall SIGALRM\n"); + abort (); + } alarm (1); } @@ -76,7 +88,12 @@ spinner_init (void) if (!spinner_wanted) return; - if (signal (SIGALRM, spinner_signal) == SIG_ERR) abort (); + if (signal (SIGALRM, spinner_signal) == SIG_ERR) + { + printf ("(no spinner)\r"); + spinner_tick = 0; + return; + } alarm (1); /* unbufferred output so the spinner will show up */ |