/*
 * |-----------------------------------------------------------|
 * | Copyright (c) 1990 MIPS Computer Systems, Inc.            |
 * | All Rights Reserved                                       |
 * |-----------------------------------------------------------|
 * |          Restricted Rights Legend                         |
 * | Use, duplication, or disclosure by the Government is      |
 * | subject to restrictions as set forth in                   |
 * | subparagraph (c)(1)(ii) of the Rights in Technical        |
 * | Data and Computer Software Clause of DFARS 52.227-7013.   |
 * |         MIPS Computer Systems, Inc.                       |
 * |         928 Arques Avenue                                 |
 * |         Sunnyvale, CA 94086                               |
 * |-----------------------------------------------------------|
 */
#ident	"$Header: getwidth.c,v 1.1.2.1 92/06/24 14:10:54 marker Exp $"

/*	Copyright (c) 1988 AT&T	*/
/*	  All Rights Reserved  	*/

/*	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T	*/
/*	The copyright notice above does not evidence any   	*/
/*	actual or intended publication of such source code.	*/

#ident	"@(#)libw:port/getwidth.c 1.0 AT&T-UP"

#include <libw.h>
#include <ctype.h>
#define CSWIDTH	514

void getwidth(eucstruct)
eucwidth_t *eucstruct;
{
	unsigned char *cswidth = &_ctype[CSWIDTH];
	eucstruct->_eucw1 = cswidth[0];
	eucstruct->_eucw2 = cswidth[1];
	eucstruct->_eucw3 = cswidth[2];
	eucstruct->_multibyte = (cswidth[6] > 1);
	if (cswidth[0] > sizeof(unsigned short) 
	|| cswidth[1] > sizeof(unsigned short) 
	|| cswidth[2] > sizeof(unsigned short))
		eucstruct->_pcw = sizeof(unsigned long);
	else
		eucstruct->_pcw = sizeof(unsigned short);
	eucstruct->_scrw1 = cswidth[3];
	eucstruct->_scrw2 = cswidth[4];
	eucstruct->_scrw3 = cswidth[5];
	return;
}
