4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
22 /* Copyright (c) 1988 AT&T */
23 /* All Rights Reserved */
27 * Copyright (c) 1997, by Sun Microsystems, Inc.
28 * All rights reserved.
31 #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
35 #include <sys/types.h>
40 * TYPE_ALPHA standard type
43 * set_field_type(f, TYPE_ALPHA, width);
45 * int width; minimum token width
47 static char *make_alpha(va_list *);
48 static char *copy_alpha(char *);
49 static void free_alpha(char *);
50 static int fcheck_alpha(FIELD
*, char *);
51 static int ccheck_alpha(int, char *);
53 static FIELDTYPE typeALPHA
=
57 (FIELDTYPE
*) 0, /* left */
58 (FIELDTYPE
*) 0, /* right */
59 make_alpha
, /* makearg */
60 copy_alpha
, /* copyarg */
61 free_alpha
, /* freearg */
62 fcheck_alpha
, /* fcheck */
63 ccheck_alpha
, /* ccheck */
64 (PTF_int
) 0, /* next */
65 (PTF_int
) 0, /* prev */
68 FIELDTYPE
* TYPE_ALPHA
= &typeALPHA
;
71 make_alpha(va_list *ap
)
75 if (Alloc(width
, int))
76 *width
= va_arg(*ap
, int);
77 return ((char *) width
);
85 if (Alloc(width
, int))
86 *width
= *((int *) arg
);
87 return ((char *) width
);
97 fcheck_alpha(FIELD
*f
, char *arg
)
99 int width
= *((int *) arg
);
101 char * v
= field_buffer(f
, 0);
103 while (*v
&& *v
== ' ')
107 while (*v
&& isalpha(*v
))
110 while (*v
&& *v
== ' ')
113 return (*v
|| n
< width
? FALSE
: TRUE
);
119 ccheck_alpha(int c
, char *arg
)