dumpcs.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <limits.h>
#include <locale.h>
#include <wctype.h>
#include <getwidth.h>
#define SCRWID 80
#define LC_NAMELEN 255
#if !defined SS2
#define SS2 0x8e
#endif
#if !defined SS3
#define SS3 0x8f
#endif
static unsigned int cpl; /* current characters per line */
static unsigned int cplmax; /* maximum characters per line */
static int pinline; /* any printable to be listed in the line? */
static int omitting; /* omitting blank lines under no vflag? */
static int vflag = 0;
static int wflag = 0;
static int csprint();
static int prcode();
int
int ac;
char *av[];
{
int c;
short int eucw[4];
short int scrw[4];
int csflag[4];
int cs;
int i;
char *lc_ctype;
#if !defined(TEXT_DOMAIN)
#define TEXT_DOMAIN "SYS_TEST"
#endif
(void) textdomain(TEXT_DOMAIN);
eucw[0] = 1;
scrw[0] = 1;
for (i = 0; i <= 3; i++)
csflag[i] = 0;
for (i = 1; i < ac; i++)
if (*av[i] != '-')
goto usage;
switch (c) {
case '0':
case '1':
case '2':
case '3':
break;
case 'v':
vflag++;
break;
case 'w':
wflag++;
break;
default:
exit (1);
}
}
for (i = 0; i <= 3; i++)
csflag[i]++;
}
(void) printf("\n");
}
}
return (0);
}
int
{
int bytelen;
int minvalue;
int maxvalue;
cplmax = 1;
cplmax /= 2;
minvalue = 0x20;
maxvalue = 0x7f;
position = 0;
if (cs > 0) {
minvalue = 0xa0;
maxvalue = 0xff;
}
if (cs == 2) {
bytelen++;
}
if (cs == 3) {
bytelen++;
}
cpl = 0;
} else if (!omitting) {
(void) printf("\n*");
}
omitting = 0;
return (0);
}
/*
* prcode() prints series of len-byte codes, of which each byte can
* have a code value between min and max, in incremental code order.
*/
int
{
unsigned long widechar; /* limitting wchar_t width - not good */
char *prep;
int mbl;
}
} else {
if (!cpl) {
widechar = 0;
i = 0;
while (codestr[i] != '\0') {
(unsigned long) codestr[i++];
}
if (*linebuf) {
omitting = 0;
} else if (!omitting) {
(void) printf("\n*");
omitting++;
}
}
if (!wflag) {
widechar);
} else {
}
pinline = 0;
}
prep = " ";
MB_CUR_MAX)) < 0)
prep = "*";
if (mbl == 1) {
prep = "*";
if (prep[0] == '*') {
for (i = 1; i <= col; i++)
} else {
pinline = 1;
}
cpl++;
}
}
return (0);
}