~ubuntu-branches/ubuntu/natty/ncurses/natty

« back to all changes in this revision

Viewing changes to test/blue.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-05-17 09:00:42 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070517090042-86fgxrr6j5jzagot
Tags: 5.6-0ubuntu1
* New upstream version.
  - Remove patches applied upstream: ncurses.upstream, signed-chars.
  - Update patches: debian-backspace.
* Build-depend on g++-multilib instead of lib{32,64}c*-dev-*.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
 * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc.              *
 
3
 *                                                                          *
 
4
 * Permission is hereby granted, free of charge, to any person obtaining a  *
 
5
 * copy of this software and associated documentation files (the            *
 
6
 * "Software"), to deal in the Software without restriction, including      *
 
7
 * without limitation the rights to use, copy, modify, merge, publish,      *
 
8
 * distribute, distribute with modifications, sublicense, and/or sell       *
 
9
 * copies of the Software, and to permit persons to whom the Software is    *
 
10
 * furnished to do so, subject to the following conditions:                 *
 
11
 *                                                                          *
 
12
 * The above copyright notice and this permission notice shall be included  *
 
13
 * in all copies or substantial portions of the Software.                   *
 
14
 *                                                                          *
 
15
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
 
16
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
 
17
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
 
18
 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
 
19
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
 
20
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
 
21
 * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
 
22
 *                                                                          *
 
23
 * Except as contained in this notice, the name(s) of the above copyright   *
 
24
 * holders shall not be used in advertising or otherwise to promote the     *
 
25
 * sale, use or other dealings in this Software without prior written       *
 
26
 * authorization.                                                           *
 
27
 ****************************************************************************/
1
28
/*****************************************************************************
2
29
 *                                                                           *
3
30
 *                         B l u e   M o o n                                 *
13
40
 * results, use the ncurses(3) library.  On non-Intel machines, SVr4 curses is
14
41
 * just as good.
15
42
 *
16
 
 * $Id: blue.c,v 1.25 2005/05/28 21:38:03 tom Exp $
 
43
 * $Id: blue.c,v 1.29 2006/05/20 15:38:18 tom Exp $
17
44
 */
18
45
 
19
46
#include <test.priv.h>
90
117
    OR_COLORS('c', BLACK_ON_WHITE),     /* clubs */
91
118
};
92
119
 
93
 
#if defined(__i386__)
 
120
#if defined(__i386__) && defined(A_ALTCHARSET) && HAVE_TIGETSTR
94
121
static chtype glyphs[] =
95
122
{
96
123
    PC_COLORS('\003', RED_ON_WHITE),    /* hearts */
98
125
    PC_COLORS('\004', RED_ON_WHITE),    /* diamonds */
99
126
    PC_COLORS('\005', BLACK_ON_WHITE),  /* clubs */
100
127
};
 
128
#define USE_CP437 1
 
129
#else
 
130
#define USE_CP437 0
101
131
#endif /* __i386__ */
102
132
 
103
133
static chtype *suits = letters; /* this may change to glyphs below */
372
402
int
373
403
main(int argc, char *argv[])
374
404
{
375
 
    (void) signal(SIGINT, die);
 
405
    CATCHALL(die);
376
406
 
377
407
    setlocale(LC_ALL, "");
378
408
 
391
421
    letters[1] = OR_COLORS('s', BLACK_ON_WHITE);        /* spades */
392
422
    letters[2] = OR_COLORS('d', RED_ON_WHITE);  /* diamonds */
393
423
    letters[3] = OR_COLORS('c', BLACK_ON_WHITE);        /* clubs */
394
 
#if defined(__i386__) && defined(A_ALTCHARSET)
 
424
#if USE_CP437
395
425
    glyphs[0] = PC_COLORS('\003', RED_ON_WHITE);        /* hearts */
396
426
    glyphs[1] = PC_COLORS('\006', BLACK_ON_WHITE);      /* spades */
397
427
    glyphs[2] = PC_COLORS('\004', RED_ON_WHITE);        /* diamonds */
399
429
#endif
400
430
#endif
401
431
 
402
 
#if defined(__i386__) && defined(A_ALTCHARSET)
 
432
#if USE_CP437
403
433
    if (tigetstr("smpch"))
404
434
        suits = glyphs;
405
 
#endif /* __i386__ && A_ALTCHARSET */
 
435
#endif /* USE_CP437 */
406
436
 
407
437
    cbreak();
408
438