set_charset.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 1997 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.11 */
/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
#include "stdio.h"
#include "string.h"
#include "errno.h"
#include "stdlib.h"
#include "lp.h"
#include "lp.set.h"
#if defined(__STDC__)
char * tparm ( char * , ... );
#else
extern char *tparm();
#endif
#if defined(__STDC__)
static int cat_charset ( char *, int , char * , int );
#else
static int cat_charset();
#endif
/**
** set_charset()
**/
int
#if defined(__STDC__)
char * char_set,
int putout,
char * type
)
#else
char *char_set;
int putout;
char *type;
#endif
{
int cs,
ret;
char *rest,
*p,
*q;
unsigned short has_print_wheel;
if (has_print_wheel)
return (E_SUCCESS);
if (
&& char_set[0] == 'c'
&& char_set[2]
&& !*rest
)
else {
if (
&& *char_set_nm
)
break;
if (cs > 63)
return (E_FAILURE);
}
if (cs == 0)
return (E_SUCCESS);
if (char_set_nm)
goto Return;
}
p = q = 0;
/*
* The ``start char. set def'n.'' capability
* is defined and set, so assume we MUST
* download the character set before using it.
*/
if (
)
;
else {
goto Return;
}
} else {
/*
* The ``start char. set def'n.'' capability
* is not defined and or set, so assume we MAY
* download the character set before using it.
*/
if (
)
;
}
if (putout)
putp (p);
} else
Return: if (p)
Free (p);
if (q)
Free (q);
if (char_set_nm)
Free (char_set_nm);
return (ret);
}
/**
** cat_charset() - DUMP CONTENT OF CHARACTER SET DEF'N FILE
**/
static int
#if defined(__STDC__)
char * name,
int number,
char * type,
int putout
)
#else
char *name;
int number,
char *type;
#endif
{
int fd;
char *p,
*parent,
*T,
int n,
ret;
if (!name)
parent = CHARSETDIR;
(T = "x")[0] = type[0];
if (!p)
return (-1);
Free (p);
return (-1);
}
Free (p);
if (putout) {
errno = 0;
if (errno != 0)
ret = -1;
else
ret = 0;
}
return (ret);
}