2 * Heirloom mailx - a mail user agent derived from Berkeley Mail.
4 * Copyright (c) 2000-2004 Gunnar Ritter, Freiburg i. Br., Germany.
7 * Copyright (c) 1980, 1993
8 * The Regents of the University of California. All rights reserved.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the University of
21 * California, Berkeley and its contributors.
22 * 4. Neither the name of the University nor the names of its contributors
23 * may be used to endorse or promote products derived from this software
24 * without specific prior written permission.
26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
41 static char sccsid
[] = "@(#)aux.c 2.83 (gritter) 3/4/06";
54 #endif /* HAVE_WCTYPE_H */
57 #endif /* HAVE_WCWIDTH */
69 * Mail -- a mail program
71 * Auxiliary functions.
75 * Return a pointer to a dynamic copy of the argument.
78 savestr(const char *str
)
81 int size
= strlen(str
) + 1;
83 if ((new = salloc(size
)) != NULL
)
84 memcpy(new, str
, size
);
89 * Make a copy of new argument incorporating old one.
92 save2str(const char *str
, const char *old
)
95 int newsize
= strlen(str
) + 1;
96 int oldsize
= old
? strlen(old
) + 1 : 0;
98 if ((new = salloc(newsize
+ oldsize
)) != NULL
) {
100 memcpy(new, old
, oldsize
);
101 new[oldsize
- 1] = ' ';
103 memcpy(new + oldsize
, str
, newsize
);
109 savecat(const char *s1
, const char *s2
)
114 np
= ns
= salloc(strlen(s1
) + strlen(s2
) + 1);
115 for (cp
= s1
; *cp
; cp
++)
117 for (cp
= s2
; *cp
; cp
++)
125 #ifndef HAVE_SNPRINTF
127 * Lazy vsprintf wrapper.
130 snprintf(char *str
, size_t size
, const char *format
, ...)
135 va_start(ap
, format
);
136 ret
= vsprintf(str
, format
, ap
);
140 #endif /* !HAVE_SNPRINTF */
143 * Announce a fatal error and die.
146 panic(const char *format
, ...)
150 va_start(ap
, format
);
151 fprintf(stderr
, catgets(catd
, CATSET
, 1, "panic: "));
152 vfprintf(stderr
, format
, ap
);
154 fprintf(stderr
, catgets(catd
, CATSET
, 2, "\n"));
165 sigaddset(&set
, SIGINT
);
166 sigprocmask(SIG_BLOCK
, &set
, NULL
);
175 sigaddset(&set
, SIGINT
);
176 sigprocmask(SIG_UNBLOCK
, &set
, NULL
);
180 * Touch the named message by setting its MTOUCH flag.
181 * Touched messages have the effect of not being sent
182 * back to the system mailbox on exit.
185 touch(struct message
*mp
)
188 mp
->m_flag
|= MTOUCH
;
189 if ((mp
->m_flag
& MREAD
) == 0)
190 mp
->m_flag
|= MREAD
|MSTATUS
;
194 * Test to see if the passed file name is a directory.
195 * Return true if it is.
202 if (stat(name
, &sbuf
) < 0)
204 return(S_ISDIR(sbuf
.st_mode
));
208 * Count the number of arguments in the given string raw list.
211 argcount(char **argv
)
215 for (ap
= argv
; *ap
++ != NULL
;)
217 return ap
- argv
- 1;
221 * Copy a string, lowercasing it as we go.
224 i_strcpy(char *dest
, const char *src
, int size
)
230 *dest
++ = lowerconv(*src
& 0377);
237 i_strdup(const char *src
)
242 sz
= strlen(src
) + 1;
244 i_strcpy(dest
, src
, sz
);
249 * Convert a string to lowercase, in-place and with multibyte-aware.
254 #if defined (HAVE_MBTOWC) && defined (HAVE_WCTYPE_H)
255 if (mb_cur_max
> 1) {
261 len
= mbtowc(&wc
, cp
, mb_cur_max
);
266 if (wctomb(tp
, wc
) == len
)
267 tp
+= len
, cp
+= len
;
273 #endif /* HAVE_MBTOWC && HAVE_WCTYPE_H */
276 *cp
= tolower(*cp
& 0377);
282 substr(const char *str
, const char *sub
)
284 const char *cp
, *backup
;
288 while (*str
&& *cp
) {
289 #if defined (HAVE_MBTOWC) && defined (HAVE_WCTYPE_H)
290 if (mb_cur_max
> 1) {
294 if ((sz
= mbtowc(&c
, cp
, mb_cur_max
)) < 0)
297 if ((sz
= mbtowc(&c2
, str
, mb_cur_max
)) < 0)
303 if ((sz
= mbtowc(&c
, backup
, mb_cur_max
)) > 0) {
311 #endif /* HAVE_MBTOWC && HAVE_WCTYPE_H */
315 #if defined (HAVE_MBTOWC) && defined (HAVE_WCTYPE_H)
317 #endif /* HAVE_MBTOWC && HAVE_WCTYPE_H */
334 colalign(const char *cp
, int col
, int fill
)
339 np
= nb
= salloc(mb_cur_max
* strlen(cp
) + col
+ 1);
341 #if defined (HAVE_MBTOWC) && defined (HAVE_WCWIDTH)
342 if (mb_cur_max
> 1) {
345 if ((sz
= mbtowc(&wc
, cp
, mb_cur_max
)) < 0) {
348 if ((n
= wcwidth(wc
)) < 0)
352 #endif /* HAVE_MBTOWC && HAVE_WCWIDTH */
359 if (sz
== 1 && spacechar(*cp
&0377)) {
382 while ((c
= getc(fp
)) != EOF
)
386 if (is_a_tty
[0] && is_a_tty
[1] && (cp
= value("crt")) != NULL
&&
387 lines
> (*cp
? atol(cp
) : scrnheight
))
388 run_command(get_pager(), 0, fileno(fp
), -1, NULL
, NULL
, NULL
);
390 while ((c
= getc(fp
)) != EOF
)
395 * The following code deals with input stacking to do source
396 * commands. All but the current file pointer are saved on
400 static int ssp
; /* Top of file stack */
402 FILE *s_file
; /* File we were in. */
403 enum condition s_cond
; /* Saved state of conditionals */
404 int s_loading
; /* Loading .mailrc, etc. */
409 * Pushdown current input file and switch to a new one.
410 * Set the global flag "sourcing" so that others will realize
411 * that they are no longer reading from a tty (in all probability).
420 if ((cp
= expand(*arglist
)) == NULL
)
422 if ((fi
= Fopen(cp
, "r")) == NULL
) {
426 if (ssp
>= SSTACK
- 1) {
427 printf(catgets(catd
, CATSET
, 3,
428 "Too much \"sourcing\" going on.\n"));
432 sstack
[ssp
].s_file
= input
;
433 sstack
[ssp
].s_cond
= cond
;
434 sstack
[ssp
].s_loading
= loading
;
444 * Pop the current input back to the previous level.
445 * Update the "sourcing" flag as appropriate.
451 printf(catgets(catd
, CATSET
, 4,
452 "\"Source\" stack over-pop.\n"));
458 printf(catgets(catd
, CATSET
, 5, "Unmatched \"if\"\n"));
460 cond
= sstack
[ssp
].s_cond
;
461 loading
= sstack
[ssp
].s_loading
;
462 input
= sstack
[ssp
].s_file
;
469 * Touch the indicated file.
470 * This is nifty for the shell.
480 utb
.actime
= time((time_t *)0) + 1;
481 utb
.modtime
= sb
.st_mtime
;
486 * Examine the passed line buffer and
487 * return true if it is all blanks and tabs.
490 blankline(char *linebuf
)
494 for (cp
= linebuf
; *cp
; cp
++)
495 if (!blankchar(*cp
& 0377))
501 * Are any of the characters in the two strings the same?
504 anyof(char *s1
, char *s2
)
508 if (strchr(s2
, *s1
++))
514 * Determine if as1 is a valid prefix of as2.
515 * Return true if yep.
518 is_prefix(const char *as1
, const char *as2
)
527 return(*--s1
== '\0');
531 last_at_before_slash(const char *sp
)
535 for (cp
= sp
; *cp
; cp
++)
538 while (cp
> sp
&& *--cp
!= '@');
539 return *cp
== '@' ? (char *)cp
: NULL
;
543 which_protocol(const char *name
)
545 register const char *cp
;
551 if (name
[0] == '%' && name
[1] == ':')
553 for (cp
= name
; *cp
&& *cp
!= ':'; cp
++)
554 if (!alnumchar(*cp
&0377))
556 if (cp
[0] == ':' && cp
[1] == '/' && cp
[2] == '/') {
557 if (strncmp(name
, "pop3://", 7) == 0)
559 if (strncmp(name
, "pop3s://", 8) == 0)
563 fprintf(stderr
, catgets(catd
, CATSET
, 225,
564 "No SSL support compiled in.\n"));
565 #endif /* !USE_SSL */
566 if (strncmp(name
, "imap://", 7) == 0)
568 if (strncmp(name
, "imaps://", 8) == 0)
572 fprintf(stderr
, catgets(catd
, CATSET
, 225,
573 "No SSL support compiled in.\n"));
574 #endif /* !USE_SSL */
575 return PROTO_UNKNOWN
;
577 file
: p
= PROTO_FILE
;
578 np
= ac_alloc((sz
= strlen(name
)) + 5);
580 if (stat(name
, &st
) == 0) {
581 if (S_ISDIR(st
.st_mode
)) {
582 strcpy(&np
[sz
], "/tmp");
583 if (stat(np
, &st
) == 0 && S_ISDIR(st
.st_mode
)) {
584 strcpy(&np
[sz
], "/new");
585 if (stat(np
, &st
) == 0 &&
586 S_ISDIR(st
.st_mode
)) {
587 strcpy(&np
[sz
], "/cur");
588 if (stat(np
, &st
) == 0 &&
595 strcpy(&np
[sz
], ".gz");
596 if (stat(np
, &st
) < 0) {
597 strcpy(&np
[sz
], ".bz2");
598 if (stat(np
, &st
) < 0) {
599 if ((cp
= value("newfolders")) != 0 &&
600 strcmp(cp
, "maildir") == 0)
611 protfile(const char *xcp
)
613 const char *cp
= xcp
;
617 if (cp
[0] == ':' && cp
[1] == '/' && cp
[2] == '/') {
621 if (cp
[0] == '/' && state
== 1)
631 protbase(const char *cp
)
633 char *n
= salloc(strlen(cp
) + 1);
637 if (cp
[0] == ':' && cp
[1] == '/' && cp
[2] == '/') {
641 } else if (cp
[0] == '/')
651 disconnected(const char *file
)
656 if (value("disconnected"))
659 if (strncmp(cp
, "imap://", 7) == 0)
661 else if (strncmp(cp
, "imaps://", 8) == 0)
665 if ((cq
= strchr(cp
, ':')) != NULL
)
667 vp
= ac_alloc(vs
= strlen(cp
) + 14);
668 snprintf(vp
, vs
, "disconnected-%s", cp
);
669 r
= value(vp
) != NULL
;
681 h
= (h
<< 4 & 0xffffffff) + (*cp
&0377);
682 if ((g
= h
& 0xf0000000) != 0) {
693 const long primes
[] = {
694 509, 1021, 2039, 4093, 8191, 16381, 32749, 65521,
695 131071, 262139, 524287, 1048573, 2097143, 4194301,
696 8388593, 16777213, 33554393, 67108859, 134217689,
697 268435399, 536870909, 1073741789, 2147483647
702 for (i
= 0; i
< sizeof primes
/ sizeof *primes
; i
++)
703 if ((mprime
= primes
[i
]) >= (n
< 65536 ? n
*4 :
704 n
< 262144 ? n
*2 : n
))
706 if (i
== sizeof primes
/ sizeof *primes
)
707 mprime
= n
; /* not so prime, but better than failure */
711 #define Hexchar(n) ((n)>9 ? (n)-10+'A' : (n)+'0')
712 #define hexchar(n) ((n)>9 ? (n)-10+'a' : (n)+'0')
715 strenc(const char *cp
)
719 np
= n
= salloc(strlen(cp
) * 3 + 1);
721 if (alnumchar(*cp
&0377) || *cp
== '_' || *cp
== '@' ||
722 (np
> n
&& (*cp
== '.' || *cp
== '-' ||
727 *np
++ = Hexchar((*cp
&0xf0) >> 4);
728 *np
++ = Hexchar(*cp
&0x0f);
737 strdec(const char *cp
)
741 np
= n
= salloc(strlen(cp
) + 1);
743 if (cp
[0] == '%' && cp
[1] && cp
[2]) {
744 *np
= (int)(cp
[1]>'9'?cp
[1]-'A'+10:cp
[1]-'0') << 4;
745 *np
++ |= cp
[2]>'9'?cp
[2]-'A'+10:cp
[2]-'0';
755 md5tohex(const void *vp
)
762 for (i
= 0; i
< 16; i
++) {
763 hex
[2*i
] = hexchar((cp
[i
]&0xf0) >> 4);
764 hex
[2*i
+1] = hexchar(cp
[i
]&0x0f);
771 cram_md5_string(const char *user
, const char *pass
, const char *b64
)
774 char digest
[16], *cp
, *sp
, *rp
, *xp
;
779 mime_fromb64(&in
, &out
, 0);
780 hmac_md5((unsigned char *)out
.s
, out
.l
,
781 (unsigned char *)pass
, strlen(pass
),
784 xp
= md5tohex(digest
);
785 sp
= ac_alloc(ss
= strlen(user
) + strlen(xp
) + 2);
786 snprintf(sp
, ss
, "%s %s", user
, xp
);
789 rp
= salloc(rs
= strlen(cp
) + 3);
790 snprintf(rp
, rs
, "%s\r\n", cp
);
798 char *line
= NULL
, *user
;
802 fputs("User: ", stdout
);
805 if (readline(stdin
, &line
, &linesize
) == 0) {
810 user
= savestr(line
);
816 getpassword(struct termios
*otio
, int *reset_tio
, const char *query
)
819 char *line
= NULL
, *pass
;
824 fputs(query
? query
: "Password:", stdout
);
828 tio
.c_lflag
&= ~(ECHO
| ECHOE
| ECHOK
| ECHONL
);
830 tcsetattr(0, TCSAFLUSH
, &tio
);
832 i
= readline(stdin
, &line
, &linesize
);
835 tcsetattr(0, TCSADRAIN
, otio
);
843 pass
= savestr(line
);
849 transflags(struct message
*omessage
, long omsgCount
, int transparent
)
851 struct message
*omp
, *nmp
, *newdot
, *newprevdot
;
858 while (omp
< &omessage
[omsgCount
] &&
859 nmp
< &message
[msgCount
]) {
860 if (dot
&& nmp
->m_uid
== dot
->m_uid
)
862 if (prevdot
&& nmp
->m_uid
== prevdot
->m_uid
)
864 if (omp
->m_uid
== nmp
->m_uid
) {
865 hf
= nmp
->m_flag
& MHIDDEN
;
866 if (transparent
&& mb
.mb_type
== MB_IMAP
)
867 omp
->m_flag
&= ~MHIDDEN
;
869 if (transparent
&& mb
.mb_type
== MB_CACHE
)
870 nmp
[-1].m_flag
|= hf
;
871 } else if (omp
->m_uid
< nmp
->m_uid
)
878 prevdot
= newprevdot
;
883 getrandstring(size_t length
)
885 static unsigned char nodedigest
[16];
892 data
= salloc(length
);
893 if ((fd
= open("/dev/urandom", O_RDONLY
)) < 0 ||
894 read(fd
, data
, length
) != length
) {
900 MD5Update(&ctx
, (unsigned char *)cp
, strlen(cp
));
901 MD5Final(nodedigest
, &ctx
);
903 for (i
= 0; i
< length
; i
++)
904 data
[i
] = (int)(255 * (rand() / (RAND_MAX
+ 1.0))) ^
905 nodedigest
[i
% sizeof nodedigest
];
909 cp
= memtob64(data
, length
);
910 rp
= salloc(length
+1);
911 strncpy(rp
, cp
, length
)[length
] = '\0';
929 if ((p
= malloc(s
)) == NULL
)
935 srealloc(void *v
, size_t s
)
943 if ((r
= realloc(v
, s
)) == NULL
)
949 scalloc(size_t nmemb
, size_t size
)
955 if ((vp
= calloc(nmemb
, size
)) == NULL
)
961 sstpcpy(char *dst
, const char *src
)
963 while ((*dst
= *src
++) != '\0')
969 sstrdup(const char *cp
)
974 dp
= smalloc(strlen(cp
) + 1);
982 makedir(const char *name
)
987 if (mkdir(name
, 0700) < 0) {
989 if ((e
== EEXIST
|| e
== ENOSYS
) &&
990 stat(name
, &st
) == 0 &&
991 (st
.st_mode
&S_IFMT
) == S_IFDIR
)
1000 cwget(struct cw
*cw
)
1002 if ((cw
->cw_fd
= open(".", O_RDONLY
)) < 0)
1004 if (fchdir(cw
->cw_fd
) < 0) {
1012 cwret(struct cw
*cw
)
1014 if (fchdir(cw
->cw_fd
) < 0)
1020 cwrelse(struct cw
*cw
)
1024 #else /* !HAVE_FCHDIR */
1026 cwget(struct cw
*cw
)
1028 if (getcwd(cw
->cw_wd
, sizeof cw
->cw_wd
) == NULL
|| chdir(cw
->cw_wd
) < 0)
1034 cwret(struct cw
*cw
)
1036 if (chdir(cw
->cw_wd
) < 0)
1043 cwrelse(struct cw
*cw
)
1046 #endif /* !HAVE_FCHDIR */
1049 makeprint(struct str
*in
, struct str
*out
)
1051 static int print_all_chars
= -1;
1055 out
->s
= smalloc(msz
= in
->l
+ 1);
1056 if (print_all_chars
== -1)
1057 print_all_chars
= value("print-all-chars") != NULL
;
1058 if (print_all_chars
) {
1059 memcpy(out
->s
, in
->s
, in
->l
);
1061 out
->s
[out
->l
] = '\0';
1066 #if defined (HAVE_MBTOWC) && defined (HAVE_WCTYPE_H)
1067 if (mb_cur_max
> 1) {
1069 char mb
[MB_LEN_MAX
+1];
1072 while (inp
< &in
->s
[in
->l
]) {
1074 n
= mbtowc(&wc
, inp
, &in
->s
[in
->l
] - inp
);
1080 mbtowc(&wc
, NULL
, mb_cur_max
);
1081 wc
= utf8
? 0xFFFD : '?';
1086 if (!iswprint(wc
) && wc
!= '\n' && wc
!= '\r' &&
1087 wc
!= '\b' && wc
!= '\t') {
1088 if ((wc
& ~(wchar_t)037) == 0)
1089 wc
= utf8
? 0x2400 | wc
: '?';
1090 else if (wc
== 0177)
1091 wc
= utf8
? 0x2421 : '?';
1093 wc
= utf8
? 0x2426 : '?';
1095 if ((n
= wctomb(mb
, wc
)) <= 0)
1098 if (out
->l
>= msz
- 1) {
1099 dist
= outp
- out
->s
;
1100 out
->s
= srealloc(out
->s
, msz
+= 32);
1101 outp
= &out
->s
[dist
];
1103 for (i
= 0; i
< n
; i
++)
1107 #endif /* HAVE_MBTOWC && HAVE_WCTYPE_H */
1110 while (inp
< &in
->s
[in
->l
]) {
1112 if (!isprint(c
) && c
!= '\n' && c
!= '\r' &&
1113 c
!= '\b' && c
!= '\t')
1119 out
->s
[out
->l
] = '\0';
1123 prstr(const char *s
)
1130 makeprint(&in
, &out
);
1131 rp
= salloc(out
.l
+ 1);
1132 memcpy(rp
, out
.s
, out
.l
);
1139 prout(const char *s
, size_t sz
, FILE *fp
)
1146 makeprint(&in
, &out
);
1147 n
= fwrite(out
.s
, 1, out
.l
, fp
);
1153 * Print out a Unicode character or a substitute for it.
1156 putuc(int u
, int c
, FILE *fp
)
1158 #if defined (HAVE_MBTOWC) && defined (HAVE_WCTYPE_H)
1159 if (utf8
&& u
& ~(wchar_t)0177) {
1160 char mb
[MB_LEN_MAX
];
1162 if ((n
= wctomb(mb
, u
)) > 0) {
1163 for (i
= 0; i
< n
; i
++)
1164 r
+= putc(mb
[i
] & 0377, fp
) != EOF
;
1167 return putc('\0', fp
) != EOF
;
1171 #endif /* HAVE_MBTOWC && HAVE_WCTYPE_H */
1172 return putc(c
, fp
) != EOF
;
1176 * Locale-independent character class functions.
1179 asccasecmp(const char *s1
, const char *s2
)
1184 if ((cmp
= lowerconv(*s1
& 0377) - lowerconv(*s2
& 0377)) != 0)
1186 while (*s1
++ != '\0' && *s2
++ != '\0');
1191 ascncasecmp(const char *s1
, const char *s2
, size_t sz
)
1199 if ((cmp
= lowerconv(*s1
& 0377) - lowerconv(*s2
& 0377)) != 0)
1201 while (i
++ < sz
&& *s1
++ != '\0' && *s2
++ != '\0');
1206 asccasestr(const char *haystack
, const char *xneedle
)
1208 char *needle
, *NEEDLE
;
1211 sz
= strlen(xneedle
);
1213 return (char *)haystack
;
1214 needle
= ac_alloc(sz
);
1215 NEEDLE
= ac_alloc(sz
);
1216 for (i
= 0; i
< sz
; i
++) {
1217 needle
[i
] = lowerconv(xneedle
[i
]&0377);
1218 NEEDLE
[i
] = upperconv(xneedle
[i
]&0377);
1221 if (*haystack
== *needle
|| *haystack
== *NEEDLE
) {
1222 for (i
= 1; i
< sz
; i
++)
1223 if (haystack
[i
] != needle
[i
] &&
1224 haystack
[i
] != NEEDLE
[i
])
1227 return (char *)haystack
;
1234 const unsigned char class_char
[] = {
1235 /* 000 nul 001 soh 002 stx 003 etx 004 eot 005 enq 006 ack 007 bel */
1236 C_CNTRL
,C_CNTRL
,C_CNTRL
,C_CNTRL
,C_CNTRL
,C_CNTRL
,C_CNTRL
,C_CNTRL
,
1237 /* 010 bs 011 ht 012 nl 013 vt 014 np 015 cr 016 so 017 si */
1238 C_CNTRL
,C_BLANK
,C_WHITE
,C_SPACE
,C_SPACE
,C_SPACE
,C_CNTRL
,C_CNTRL
,
1239 /* 020 dle 021 dc1 022 dc2 023 dc3 024 dc4 025 nak 026 syn 027 etb */
1240 C_CNTRL
,C_CNTRL
,C_CNTRL
,C_CNTRL
,C_CNTRL
,C_CNTRL
,C_CNTRL
,C_CNTRL
,
1241 /* 030 can 031 em 032 sub 033 esc 034 fs 035 gs 036 rs 037 us */
1242 C_CNTRL
,C_CNTRL
,C_CNTRL
,C_CNTRL
,C_CNTRL
,C_CNTRL
,C_CNTRL
,C_CNTRL
,
1243 /* 040 sp 041 ! 042 " 043 # 044 $ 045 % 046 & 047 ' */
1244 C_BLANK
,C_PUNCT
,C_PUNCT
,C_PUNCT
,C_PUNCT
,C_PUNCT
,C_PUNCT
,C_PUNCT
,
1245 /* 050 ( 051 ) 052 * 053 + 054 , 055 - 056 . 057 / */
1246 C_PUNCT
,C_PUNCT
,C_PUNCT
,C_PUNCT
,C_PUNCT
,C_PUNCT
,C_PUNCT
,C_PUNCT
,
1247 /* 060 0 061 1 062 2 063 3 064 4 065 5 066 6 067 7 */
1248 C_OCTAL
,C_OCTAL
,C_OCTAL
,C_OCTAL
,C_OCTAL
,C_OCTAL
,C_OCTAL
,C_OCTAL
,
1249 /* 070 8 071 9 072 : 073 ; 074 < 075 = 076 > 077 ? */
1250 C_DIGIT
,C_DIGIT
,C_PUNCT
,C_PUNCT
,C_PUNCT
,C_PUNCT
,C_PUNCT
,C_PUNCT
,
1251 /* 100 @ 101 A 102 B 103 C 104 D 105 E 106 F 107 G */
1252 C_PUNCT
,C_UPPER
,C_UPPER
,C_UPPER
,C_UPPER
,C_UPPER
,C_UPPER
,C_UPPER
,
1253 /* 110 H 111 I 112 J 113 K 114 L 115 M 116 N 117 O */
1254 C_UPPER
,C_UPPER
,C_UPPER
,C_UPPER
,C_UPPER
,C_UPPER
,C_UPPER
,C_UPPER
,
1255 /* 120 P 121 Q 122 R 123 S 124 T 125 U 126 V 127 W */
1256 C_UPPER
,C_UPPER
,C_UPPER
,C_UPPER
,C_UPPER
,C_UPPER
,C_UPPER
,C_UPPER
,
1257 /* 130 X 131 Y 132 Z 133 [ 134 \ 135 ] 136 ^ 137 _ */
1258 C_UPPER
,C_UPPER
,C_UPPER
,C_PUNCT
,C_PUNCT
,C_PUNCT
,C_PUNCT
,C_PUNCT
,
1259 /* 140 ` 141 a 142 b 143 c 144 d 145 e 146 f 147 g */
1260 C_PUNCT
,C_LOWER
,C_LOWER
,C_LOWER
,C_LOWER
,C_LOWER
,C_LOWER
,C_LOWER
,
1261 /* 150 h 151 i 152 j 153 k 154 l 155 m 156 n 157 o */
1262 C_LOWER
,C_LOWER
,C_LOWER
,C_LOWER
,C_LOWER
,C_LOWER
,C_LOWER
,C_LOWER
,
1263 /* 160 p 161 q 162 r 163 s 164 t 165 u 166 v 167 w */
1264 C_LOWER
,C_LOWER
,C_LOWER
,C_LOWER
,C_LOWER
,C_LOWER
,C_LOWER
,C_LOWER
,
1265 /* 170 x 171 y 172 z 173 { 174 | 175 } 176 ~ 177 del */
1266 C_LOWER
,C_LOWER
,C_LOWER
,C_PUNCT
,C_PUNCT
,C_PUNCT
,C_PUNCT
,C_CNTRL