File: gtm_tparm.c

package info (click to toggle)
fis-gtm 7.1-006-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 32,908 kB
  • sloc: ansic: 344,906; asm: 5,184; csh: 4,859; sh: 2,000; awk: 294; makefile: 73; sed: 13
file content (51 lines) | stat: -rwxr-xr-x 1,827 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/****************************************************************
 *								*
 *	Copyright 2001, 2009 Fidelity Information Services, Inc	*
 *								*
 *	This source code contains the intellectual property	*
 *	of its copyright holder(s), and is made available	*
 *	under a license.  If you do not know the terms of	*
 *	the license, please stop and do not read further.	*
 *								*
 ****************************************************************/

/*
 * This file wraps the curses tparm function to avoid a conflict with
 * the bool typedef in mdef.h and curses.h.  Since the only use
 * appears to be in sr_unix/iott_use.c, this is a reasonable detour.
 * The alternative would be to excise bool from all unix files, insuring
 * that persistent structures were correctly sized.
 */
#include "gtm_tparm.h"
#include <curses.h>
#include "gtm_term.h"
#include "gtm_sizeof.h"
#if defined(__MVS__) && __CHARSET_LIB==1	/* -qascii */
#include "ebc_xlat.h"
static char	gtm_tparm_buf[64];	/* static so it can be returned, room for expanded escape sequence */
#endif

char *gtm_tparm(char *c, int p1, int p2)
{
#if !(defined(__MVS__) && __CHARSET_LIB==1)	/* -qascii */
	return tparm(c, p1, p2, 0, 0, 0, 0, 0, 0, 0);
#else
	int	len;
	char	ebcdicbuf[32];	/* ESC_LEN in io.h is 16, allow extra */
	char	*retptr;

	len = strlen(c) + 1;
	if (SIZEOF(ebcdicbuf) <= len)
		len = SIZEOF(ebcdicbuf) - 1;
	asc_to_ebc((unsigned char *)ebcdicbuf, (unsigned char *)c, len);
	ebcdicbuf[len] = '\0';	/* ensure null terminated */
	retptr = tparm(ebcdicbuf, p1, p2, 0, 0, 0, 0, 0, 0, 0);
	len = strlen(retptr) + 1;
	if (SIZEOF(gtm_tparm_buf) <= len)
		len = SIZEOF(gtm_tparm_buf) - 1;
	ebc_to_asc((unsigned char *)gtm_tparm_buf, (unsigned char *)retptr, len);
	gtm_tparm_buf[len] = '\0';	/* ensure null terminated */
	return gtm_tparm_buf;
#endif
}