~ubuntu-branches/ubuntu/natty/ibm-3270/natty

« back to all changes in this revision

Viewing changes to s3270/see.c

  • Committer: Bazaar Package Importer
  • Author(s): Bastian Blank
  • Date: 2009-12-14 11:48:53 UTC
  • mfrom: (1.1.4 upstream) (2.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20091214114853-mywixml32hct9jr1
Tags: 3.3.10ga4-2
* Fix section to match override.
* Use debhelper compat level 7.
* Use 3.0 (quilt) source format.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright 1993, 1994, 1995, 1999, 2000, 2001, 2002, 2004, 2005 by Paul
3
 
 *   Mattes.
4
 
 * RPQNAMES modifications copyright 2004 by Don Russell.
5
 
 *  Permission to use, copy, modify, and distribute this software and its
6
 
 *  documentation for any purpose and without fee is hereby granted,
7
 
 *  provided that the above copyright notice appear in all copies and that
8
 
 *  both that copyright notice and this permission notice appear in
9
 
 *  supporting documentation.
10
 
 *
11
 
 * x3270, c3270, s3270, tcl3270 and pr3287 are distributed in the hope that
12
 
 * they will be useful, but WITHOUT ANY WARRANTY; without even the implied
13
 
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
 * file LICENSE for more details.
 
2
 * Copyright (c) 1993-2009, Paul Mattes.
 
3
 * Copyright (c) 2004, Don Russell.
 
4
 * All rights reserved.
 
5
 *
 
6
 * Redistribution and use in source and binary forms, with or without
 
7
 * modification, are permitted provided that the following conditions are met:
 
8
 *     * Redistributions of source code must retain the above copyright
 
9
 *       notice, this list of conditions and the following disclaimer.
 
10
 *     * Redistributions in binary form must reproduce the above copyright
 
11
 *       notice, this list of conditions and the following disclaimer in the
 
12
 *       documentation and/or other materials provided with the distribution.
 
13
 *     * Neither the names of Paul Mattes, Don Russell, Jeff Sparkes, GTRC nor
 
14
 *       the names of their contributors may be used to endorse or promote
 
15
 *       products derived from this software without specific prior written
 
16
 *       permission.
 
17
 *
 
18
 * THIS SOFTWARE IS PROVIDED BY PAUL MATTES AND DON RUSSELL "AS IS" AND ANY
 
19
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 
20
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 
21
 * DISCLAIMED. IN NO EVENT SHALL PAUL MATTES OR DON RUSSELL BE LIABLE FOR ANY
 
22
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 
23
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
24
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 
25
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
26
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 
27
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15
28
 */
16
29
 
17
30
/*
31
44
#include "3270ds.h"
32
45
 
33
46
#include "tablesc.h"
34
 
#if !defined(PR3287) /*[*/
35
47
#include "utf8c.h"
36
 
#endif /*]*/
37
48
#include "seec.h"
 
49
#include "unicodec.h"
38
50
 
39
51
const char *
40
52
unknown(unsigned char value)
49
61
see_ebc(unsigned char ch)
50
62
{
51
63
        static char buf[8];
52
 
        unsigned char e;
 
64
        char mb[16];
 
65
        ucs4_t uc;
53
66
 
54
67
        switch (ch) {
55
68
            case FCORDER_NULL:
75
88
            case FCORDER_SO:
76
89
                return "SO";
77
90
        }
78
 
        e = ebc2asc[ch];
79
 
        if (e && (e != ' ' || ch == 0x40))
80
 
                (void) sprintf(buf,
81
 
#if !defined(PR3287) /*[*/
82
 
                               "%s", utf8_expand(e)
83
 
#else /*][*/
84
 
                               "%c", ebc2asc[e]
85
 
#endif /*]*/
86
 
                               );
 
91
        if (ebcdic_to_multibyte_x(ch, CS_BASE, mb, sizeof(mb), EUO_NONE, &uc)
 
92
                    && (mb[0] != ' ' || ch == 0x40))
 
93
                strcpy(buf, mb);
87
94
        else
88
 
                (void) sprintf(buf, "X'%02X'", ch);
 
95
                (void) sprintf(buf, "X'%02X'", ch);
89
96
        return buf;
90
97
}
91
98