home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / unix / volume27 / runes / part01 < prev    next >
Encoding:
Text File  |  1993-09-07  |  58.3 KB  |  1,908 lines

  1. Newsgroups: comp.sources.unix
  2. From: prb@cray.com
  3. Subject: v27i027: REPOST runes - an implementation of setlocale(3) and all its friends, Part01/03
  4. Message-Id: <9309071427.AA14351@krystal.cray.com>
  5. Sender: unix-sources-moderator@gw.home.vix.com
  6. Approved: vixie@gw.home.vix.com
  7.  
  8. Submitted-By: prb@cray.com
  9. Posting-Number: Volume 27, Issue 27
  10. Archive-Name: runes/part01
  11.  
  12. Runes are a way of representing a character in any language by a single
  13. value.  Languages such as Japanese may have thousands of characters, hence
  14. a single 8 bit value will not work.  Multiple 8 bit values are commonly
  15. used (multibyte strings) but are difficult to work with.  This package
  16. contains the routines needed to convert between multibyte representations
  17. and Runes.  The ANSI C type wchar_t is mapped directly to rune_t.  The
  18. work with runes was inspired by Plan 9 from Bell Labs (hence the choice
  19. of rune_t over wchar_t, which is said to be "butt ugly").
  20.  
  21. #! /bin/sh
  22. # This is a shell archive.  Remove anything before this line, then unpack
  23. # it by saving it into a file and typing "sh file".  To overwrite existing
  24. # files, type "sh file -c".  You can also feed this as standard input via
  25. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  26. # will see the following message at the end:
  27. #        "End of archive 1 (of 3)."
  28. # Contents:  MANIFEST README doc/mbrune.3 doc/utf2.4 include/machine
  29. #   include/machine/ansi.changes include/machine/limits.changes
  30. #   include/rune.h include/runetype.h include/stddef.changes
  31. #   include/stdlib.changes libc libc/ansi.c libc/frune.c
  32. #   libc/isctype.c libc/mbrune.c libc/none.c libc/utf2.c mklocale
  33. #   mklocale/Japanese mklocale/Makefile mklocale/POSIX mklocale/ldef.h
  34. # Wrapped by prb@krystal.cray.com on Sun Sep  5 11:15:56 1993
  35. # Fixed on Tue Sep  7 09:26:28 CDT 1993
  36. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  37. if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  38.   echo shar: Will not clobber existing file \"'MANIFEST'\"
  39. else
  40. echo shar: Extracting \"'MANIFEST'\" \(1189 characters\)
  41. sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  42. X   File Name        Archive #    Description
  43. X-----------------------------------------------------------
  44. X MANIFEST                   1    
  45. X README                     1    
  46. X doc                        1    
  47. X doc/euc.4                  3    
  48. X doc/mbrune.3               1    
  49. X doc/multibyte.3            2    
  50. X doc/rune.3                 2    
  51. X doc/setlocale.3            3    
  52. X doc/utf2.4                 1    
  53. X include                    1    
  54. X include/ctype.h            2    
  55. X include/machine            1    
  56. X include/machine/ansi.changes  1    
  57. X include/machine/limits.changes  1    
  58. X include/rune.h             1    
  59. X include/runetype.h         1    
  60. X include/stddef.changes     1    
  61. X include/stdlib.changes     1    
  62. X libc                       1    
  63. X libc/ansi.c                1    
  64. X libc/euc.c                 2    
  65. X libc/frune.c               1    
  66. X libc/isctype.c             1    
  67. X libc/mbrune.c              1    
  68. X libc/none.c                1    
  69. X libc/rune.c                3    
  70. X libc/setlocale.c           2    
  71. X libc/table.c               2    
  72. X libc/utf2.c                1    
  73. X mklocale                   1    
  74. X mklocale/Japanese          1    
  75. X mklocale/Makefile          1    
  76. X mklocale/POSIX             1    
  77. X mklocale/ldef.h            1    
  78. X mklocale/lex.l             2    
  79. X mklocale/mklocale.1        2    
  80. X mklocale/yacc.y            3    
  81. END_OF_FILE
  82. if test 1189 -ne `wc -c <'MANIFEST'`; then
  83.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  84. fi
  85. # end of 'MANIFEST'
  86. fi
  87. if test -f 'README' -a "${1}" != "-c" ; then 
  88.   echo shar: Will not clobber existing file \"'README'\"
  89. else
  90. echo shar: Extracting \"'README'\" \(2967 characters\)
  91. sed "s/^X//" >'README' <<'END_OF_FILE'
  92. XThis directory contains the rune code I donated to BSD for the 4.4 release.
  93. XSince 4.4 is not quite available to the free world yet, I have decided to
  94. Xmake this much available, which I know is not encumbered by any license.
  95. XThere are also two manual pages written by Donn Seeley of BSDI which he
  96. Xdonated to BSD.  I am sending the versions with BSD copyright notices and
  97. Xversion numbers to aid people in the future when they receive BSD 4.4.
  98. X(And heck, they are better than any notice *I* could right :-)
  99. X
  100. XThe tree contains the following files:
  101. X
  102. X    include                Files to go in /usr/include
  103. X    include/machine
  104. X    include/machine/ansi.changes    Changes to the ansi.h file
  105. X    include/machine/limits.changes    Changes to limits.h file
  106. X    include/runetype.h            new file
  107. X    include/rune.h            new file
  108. X    include/ctype.h            replacement file
  109. X    include/stddef.changes        Changes to the stddef.h file
  110. X    include/stdlib.changes        Changes to the stddef.h file
  111. X
  112. X    libc                New and replacement code for libc
  113. X    libc/ansi.c                This code is in lib/libc/locale
  114. X    libc/euc.c                in 4.4BSD
  115. X    libc/frune.c
  116. X    libc/isctype.c
  117. X    libc/mbrune.c
  118. X    libc/none.c
  119. X    libc/rune.c
  120. X    libc/setlocale.c
  121. X    libc/table.c
  122. X    libc/utf2.c
  123. X
  124. X    doc                    Manual pages relating to runes
  125. X    doc/mbrune.3
  126. X    doc/rune.3
  127. X    doc/setlocale.3            (Written by Donn Seeley)
  128. X    doc/euc.4
  129. X    doc/utf2.4
  130. X    doc/multibyte.3            (Written by Donn Seeley)
  131. X
  132. X    mklocale                A simple command to build locale files
  133. X    mklocale/Japanese            Sample Japanese locale
  134. X    mklocale/Makefile
  135. X    mklocale/POSIX            Sample POSIX locale (not needed)
  136. X    mklocale/ldef.h
  137. X    mklocale/lex.l
  138. X    mklocale/mklocale.1
  139. X    mklocale/yacc.y
  140. X
  141. XA few comments about this software.  First, you will need to integrate it into
  142. Xyour C library if you really want everything to work correctly, though you
  143. Xshould be able to also build it by itself and include these .o's in your
  144. Xprogram before the C library.
  145. X
  146. XThe POSIX and C locale's are built into the library, so you do not need to
  147. Xinstall any locale files in order to run a regular program.
  148. X
  149. XCurrently collating sequences are not supported.  If anyone has
  150. Xexperience with this in non trivial languages (i.e. not an 8 bit European
  151. Xlanguage) I would like to hear from you.
  152. X
  153. XUnder BSDI 1.0 I made the following changes in /usr/src/lib/libc
  154. X
  155. X    gen/Makefile.inc
  156. X    removed ctype_.c and isctype.c from the SRCS
  157. X
  158. X    locale/Makefile.inc
  159. X    added ansi.c, euc.c, frune.c, mbrune.c, none.c, rune.c, table.c,
  160. X    utf2.c, and isctype.c to the SRCS and copied those files in.
  161. X    Also added:
  162. X    MAN3+= mbrune.3 multibyte.3 rune.3 setlocale.0
  163. X    MAN4+= euc.4 utf2.4
  164. X
  165. X    stdlib/Makefile.inc
  166. X    removed multibyte.c from the SRCS
  167. X
  168. X    /usr/include
  169. X    Add the .h files from this archive and change the couple files
  170. X    indicated above.
  171. X
  172. XI also rebuilt libX11, libXt, libXmu and libutil.
  173. X
  174. XReal bug reports are welcome, but I can not guarantee speedy responses.
  175. X
  176. XSept 4th, 1993
  177. X
  178. XPaul Borman
  179. XKrystal Technologies, Inc.
  180. Xprb@cray.com
  181. END_OF_FILE
  182. if test 2967 -ne `wc -c <'README'`; then
  183.     echo shar: \"'README'\" unpacked with wrong size!
  184. fi
  185. # end of 'README'
  186. fi
  187. if test ! -d 'doc' ; then
  188.     echo shar: Creating directory \"'doc'\"
  189.     mkdir 'doc'
  190. fi
  191. if test -f 'doc/mbrune.3' -a "${1}" != "-c" ; then 
  192.   echo shar: Will not clobber existing file \"'doc/mbrune.3'\"
  193. else
  194. echo shar: Extracting \"'doc/mbrune.3'\" \(3895 characters\)
  195. sed "s/^X//" >'doc/mbrune.3' <<'END_OF_FILE'
  196. X.\" Copyright (c) 1993
  197. X.\"    The Regents of the University of California.  All rights reserved.
  198. X.\"
  199. X.\" This code is derived from software contributed to Berkeley by
  200. X.\" Paul Borman at Krystal Technologies.
  201. X.\"
  202. X.\" Redistribution and use in source and binary forms, with or without
  203. X.\" modification, are permitted provided that the following conditions
  204. X.\" are met:
  205. X.\" 1. Redistributions of source code must retain the above copyright
  206. X.\"    notice, this list of conditions and the following disclaimer.
  207. X.\" 2. Redistributions in binary form must reproduce the above copyright
  208. X.\"    notice, this list of conditions and the following disclaimer in the
  209. X.\"    documentation and/or other materials provided with the distribution.
  210. X.\" 3. All advertising materials mentioning features or use of this software
  211. X.\"    must display the following acknowledgement:
  212. X.\"    This product includes software developed by the University of
  213. X.\"    California, Berkeley and its contributors.
  214. X.\" 4. Neither the name of the University nor the names of its contributors
  215. X.\"    may be used to endorse or promote products derived from this software
  216. X.\"    without specific prior written permission.
  217. X.\"
  218. X.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  219. X.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  220. X.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  221. X.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  222. X.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  223. X.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  224. X.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  225. X.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  226. X.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  227. X.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  228. X.\" SUCH DAMAGE.
  229. X.\"
  230. X.\"    @(#)mbrune.3    8.1 (Berkeley) 6/4/93
  231. X.\"
  232. X.Dd "June 4, 1993"
  233. X.Dt MBRUNE 3
  234. X.Os
  235. X.Sh NAME
  236. X.Nm mbrune ,
  237. X.Nm mbrrune ,
  238. X.Nm mbmb
  239. X.Nd multibyte rune support for C
  240. X.Sh SYNOPSIS
  241. X.Fd #include <rune.h>
  242. X.Ft char *
  243. X.Fn mbrune "const char *string" "rune_t rune"
  244. X.Ft char *
  245. X.Fn mbrrune "const char *string" "rune_t rune"
  246. X.Ft char *
  247. X.Fn mbmb "const char *string" "char *pattern"
  248. X.Sh DESCRIPTION
  249. XThese routines provide the corresponding functionality of
  250. X.Fn strchr ,
  251. X.Fn strrchr
  252. Xand
  253. X.Fn strstr
  254. Xfor multibyte strings.
  255. X.Pp
  256. XThe
  257. X.Fn mbrune
  258. Xfunction locates the first occurence of
  259. X.Fn rune
  260. Xin the string pointed to by
  261. X.Ar string .
  262. XThe terminating
  263. X.Dv NULL
  264. Xcharacter is considered part of the string.
  265. XIf
  266. X.Fa rune
  267. Xis
  268. X.Ql \e0 ,
  269. X.Fn mbrune
  270. Xlocates the terminating
  271. X.Ql \e0 .
  272. X.Pp
  273. XThe
  274. X.Fn mbrrune
  275. Xfunction
  276. Xlocates the last occurrence of
  277. X.Fa rune
  278. Xin the string
  279. X.Fa string .
  280. XIf
  281. X.Fa rune
  282. Xis
  283. X.Ql \e0 ,
  284. X.Fn mbrune
  285. Xlocates the terminating
  286. X.Ql \e0 .
  287. X.Pp
  288. XThe
  289. X.Fn mbmb
  290. Xfunction locates the first occurence of the null-terminated string
  291. X.Fa pattern
  292. Xin the null-terminated string
  293. X.Fa string.
  294. XIf
  295. X.Fa pattern
  296. Xis the empty string,
  297. X.Fn mbmb
  298. Xreturns
  299. X.Fa string ;
  300. Xif
  301. X.Fa pattern
  302. Xoccurs nowhere in
  303. X.Fa string ,
  304. X.Fn mbmb
  305. Xreturns
  306. X.Dv NULL ;
  307. Xotherwise
  308. X.Fn mbmb
  309. Xreturns a pointer to the first character of the first occurrence of
  310. X.Fa pattern .
  311. X.Sh RETURN VALUES
  312. XThe function
  313. X.Fn mbrune
  314. Xreturns a pointer to the located character, or
  315. X.Dv NULL
  316. Xif the character does not appear in the string.
  317. X.Pp
  318. XThe
  319. X.Fn mbrrune
  320. Xfunction
  321. Xreturns a pointer to the character, or
  322. X.Dv NULL
  323. Xif the character does not appear in the string.
  324. X.Pp
  325. XThe
  326. X.Fn mbmb
  327. Xfunction
  328. Xreturns a pointer to the 
  329. X.Fa pattern ,
  330. Xor
  331. X.Dv NULL
  332. Xif the 
  333. X.Fa pattern
  334. Xdoes not appear in the string.
  335. X.Sh "SEE ALSO
  336. X.Xr euc 4 ,
  337. X.Xr mbrune 3 ,
  338. X.Xr rune 3 ,
  339. X.Xr setlocale 3 ,
  340. X.Xr utf2 4
  341. X.Sh HISTORY
  342. XThe
  343. X.Fn mbrune ,
  344. X.Fn mbrrune ,
  345. Xand
  346. X.Fn mbmb
  347. Xfunctions
  348. Xfirst appeared in Plan 9 from Bell Labs as
  349. X.Fn utfrune ,
  350. X.Fn utfrrune ,
  351. Xand
  352. X.Fn utfutf .
  353. END_OF_FILE
  354. if test 3895 -ne `wc -c <'doc/mbrune.3'`; then
  355.     echo shar: \"'doc/mbrune.3'\" unpacked with wrong size!
  356. fi
  357. # end of 'doc/mbrune.3'
  358. fi
  359. if test -f 'doc/utf2.4' -a "${1}" != "-c" ; then 
  360.   echo shar: Will not clobber existing file \"'doc/utf2.4'\"
  361. else
  362. echo shar: Extracting \"'doc/utf2.4'\" \(3682 characters\)
  363. sed "s/^X//" >'doc/utf2.4' <<'END_OF_FILE'
  364. X.\" Copyright (c) 1993
  365. X.\"    The Regents of the University of California.  All rights reserved.
  366. X.\"
  367. X.\" This code is derived from software contributed to Berkeley by
  368. X.\" Paul Borman at Krystal Technologies.
  369. X.\"
  370. X.\" Redistribution and use in source and binary forms, with or without
  371. X.\" modification, are permitted provided that the following conditions
  372. X.\" are met:
  373. X.\" 1. Redistributions of source code must retain the above copyright
  374. X.\"    notice, this list of conditions and the following disclaimer.
  375. X.\" 2. Redistributions in binary form must reproduce the above copyright
  376. X.\"    notice, this list of conditions and the following disclaimer in the
  377. X.\"    documentation and/or other materials provided with the distribution.
  378. X.\" 3. All advertising materials mentioning features or use of this software
  379. X.\"    must display the following acknowledgement:
  380. X.\"    This product includes software developed by the University of
  381. X.\"    California, Berkeley and its contributors.
  382. X.\" 4. Neither the name of the University nor the names of its contributors
  383. X.\"    may be used to endorse or promote products derived from this software
  384. X.\"    without specific prior written permission.
  385. X.\"
  386. X.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  387. X.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  388. X.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  389. X.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  390. X.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  391. X.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  392. X.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  393. X.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  394. X.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  395. X.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  396. X.\" SUCH DAMAGE.
  397. X.\"
  398. X.\"    @(#)utf2.4    8.1 (Berkeley) 6/4/93
  399. X.\"
  400. X.Dd "June 4, 1993"
  401. X.Dt UTF2 4
  402. X.Os
  403. X.Sh NAME
  404. X.Nm UTF2
  405. X.Nd "Universal character set Transformation Format encoding of runes
  406. X.Sh SYNOPSIS
  407. X\fBENCODING "UTF2"\fP
  408. X.Sh DESCRIPTION
  409. XThe
  410. X.Nm UTF2
  411. Xencoding is based on a proposed X-Open multibyte
  412. X\s-1FSS-UCS-TF\s+1 (File System Safe Universal Character Set Transformation Format) encoding as used in
  413. X.Nm Plan 9 from Bell Labs.
  414. XAlthough it is capable of representing more than 16 bits,
  415. Xthe current implementation is limited to 16 bits as defined by the
  416. XUnicode Standard.
  417. X.Pp
  418. X.Nm UTF2
  419. Xrepresentation is backwards compatible with ASCII, so 0x00-0x7f refer to the
  420. XASCII character set.  The multibyte encoding of runes between 0x0080 and 0xffff
  421. Xconsist entirely of bytes whose high order bit is set.  The actual
  422. Xencoding is represented by the following table:
  423. X.Bd -literal
  424. X[0x0000 - 0x007f] [00000000.0bbbbbbb] -> 0bbbbbbb
  425. X[0x0080 - 0x03ff] [00000bbb.bbbbbbbb] -> 110bbbbb, 10bbbbbb
  426. X[0x0400 - 0xffff] [bbbbbbbb.bbbbbbbb] -> 1110bbbb, 10bbbbbb, 10bbbbbb
  427. X.Ed
  428. X.sp
  429. XIf more than a single representation of a value exists (for example,
  430. X0x00; 0xC0 0x80; 0xE0 0x80 0x80) the shortest representation is always
  431. Xused (but the longer ones will be correctly decoded).
  432. X.Pp
  433. XThe final three encodings provided by X-Open:
  434. X.Bd -literal
  435. X[00000000.000bbbbb.bbbbbbbb.bbbbbbbb] ->
  436. X    11110bbb, 10bbbbbb, 10bbbbbb, 10bbbbbb
  437. X
  438. X[000000bb.bbbbbbbb.bbbbbbbb.bbbbbbbb] ->
  439. X    111110bb, 10bbbbbb, 10bbbbbb, 10bbbbbb, 10bbbbbb
  440. X
  441. X[0bbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb] ->
  442. X    1111110b, 10bbbbbb, 10bbbbbb, 10bbbbbb, 10bbbbbb, 10bbbbbb
  443. X.Ed
  444. X.sp
  445. Xwhich provides for the entire proposed ISO-10646 31 bit standard are currently
  446. Xnot implemented.
  447. X.Sh "SEE ALSO"
  448. X.Xr mklocale 1 ,
  449. X.Xr setlocale 3
  450. END_OF_FILE
  451. if test 3682 -ne `wc -c <'doc/utf2.4'`; then
  452.     echo shar: \"'doc/utf2.4'\" unpacked with wrong size!
  453. fi
  454. # end of 'doc/utf2.4'
  455. fi
  456. if test ! -d 'include' ; then
  457.     echo shar: Creating directory \"'include'\"
  458.     mkdir 'include'
  459. fi
  460. if test ! -d 'include/machine' ; then
  461.     echo shar: Creating directory \"'include/machine'\"
  462.     mkdir 'include/machine'
  463. fi
  464. if test -f 'include/machine/ansi.changes' -a "${1}" != "-c" ; then 
  465.   echo shar: Will not clobber existing file \"'include/machine/ansi.changes'\"
  466. else
  467. echo shar: Extracting \"'include/machine/ansi.changes'\" \(1009 characters\)
  468. sed "s/^X//" >'include/machine/ansi.changes' <<'END_OF_FILE'
  469. X< #define _WCHAR_T_       unsigned long           /* wchar_t */
  470. X
  471. X> /*
  472. X>  * Runes (wchar_t) is declared to be an ``int'' instead of the more natural
  473. X>  * ``unsigned long'' or ``long''.  Two things are happening here.  It is not
  474. X>  * unsigned so that EOF (-1) can be naturally assigned to it and used.  Also,
  475. X>  * it looks like 10646 will be a 31 bit standard.  This means that if your
  476. X>  * ints cannot hold 32 bits, you will be in trouble.  The reason an int was
  477. X>  * chosen over a long is that the is*() and to*() routines take ints (says
  478. X>  * ANSI C), but they use _RUNE_T_ instead of int.  By changing it here, you
  479. X>  * lose a bit of ANSI conformance, but your programs will still work.
  480. X>  *
  481. X>  * Note that _WCHAR_T_ and _RUNE_T_ must be of the same type.  When wchar_t
  482. X>  * and rune_t are typedef'd, _WCHAR_T_ will be undef'd, but _RUNE_T remains
  483. X>  * defined for ctype.h.
  484. X>  */
  485. X> #define _BSD_WCHAR_T_   int                     /* wchar_t */
  486. X> #define _BSD_RUNE_T_    int                     /* rune_t */
  487. END_OF_FILE
  488. if test 1009 -ne `wc -c <'include/machine/ansi.changes'`; then
  489.     echo shar: \"'include/machine/ansi.changes'\" unpacked with wrong size!
  490. fi
  491. # end of 'include/machine/ansi.changes'
  492. fi
  493. if test -f 'include/machine/limits.changes' -a "${1}" != "-c" ; then 
  494.   echo shar: Will not clobber existing file \"'include/machine/limits.changes'\"
  495. else
  496. echo shar: Extracting \"'include/machine/limits.changes'\" \(139 characters\)
  497. sed "s/^X//" >'include/machine/limits.changes' <<'END_OF_FILE'
  498. X< #define MB_LEN_MAX      1               /* no multibyte characters */
  499. X
  500. X> #define MB_LEN_MAX      6               /* Allow 31 bit UTF2 */
  501. END_OF_FILE
  502. if test 139 -ne `wc -c <'include/machine/limits.changes'`; then
  503.     echo shar: \"'include/machine/limits.changes'\" unpacked with wrong size!
  504. fi
  505. # end of 'include/machine/limits.changes'
  506. fi
  507. if test -f 'include/rune.h' -a "${1}" != "-c" ; then 
  508.   echo shar: Will not clobber existing file \"'include/rune.h'\"
  509. else
  510. echo shar: Extracting \"'include/rune.h'\" \(2738 characters\)
  511. sed "s/^X//" >'include/rune.h' <<'END_OF_FILE'
  512. X/*-
  513. X * Copyright (c) 1993
  514. X *    The Regents of the University of California.  All rights reserved.
  515. X *
  516. X * This code is derived from software contributed to Berkeley by
  517. X * Paul Borman at Krystal Technologies.
  518. X *
  519. X * Redistribution and use in source and binary forms, with or without
  520. X * modification, are permitted provided that the following conditions
  521. X * are met:
  522. X * 1. Redistributions of source code must retain the above copyright
  523. X *    notice, this list of conditions and the following disclaimer.
  524. X * 2. Redistributions in binary form must reproduce the above copyright
  525. X *    notice, this list of conditions and the following disclaimer in the
  526. X *    documentation and/or other materials provided with the distribution.
  527. X * 3. All advertising materials mentioning features or use of this software
  528. X *    must display the following acknowledgement:
  529. X *    This product includes software developed by the University of
  530. X *    California, Berkeley and its contributors.
  531. X * 4. Neither the name of the University nor the names of its contributors
  532. X *    may be used to endorse or promote products derived from this software
  533. X *    without specific prior written permission.
  534. X *
  535. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  536. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  537. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  538. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  539. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  540. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  541. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  542. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  543. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  544. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  545. X * SUCH DAMAGE.
  546. X *
  547. X *    @(#)rune.h    8.1 (Berkeley) 6/27/93
  548. X */
  549. X
  550. X#ifndef    _RUNE_H_
  551. X#define    _RUNE_H_
  552. X
  553. X#include <runetype.h>
  554. X#include <stdio.h>
  555. X
  556. X#define    _PATH_LOCALE    "/usr/share/locale"
  557. X
  558. X#define _INVALID_RUNE   _CurrentRuneLocale->invalid_rune
  559. X
  560. X#define __sgetrune      _CurrentRuneLocale->sgetrune
  561. X#define __sputrune      _CurrentRuneLocale->sputrune
  562. X
  563. X#define sgetrune(s, n, r)       (*__sgetrune)((s), (n), (r))
  564. X#define sputrune(c, s, n, r)    (*__sputrune)((c), (s), (n), (r))
  565. X
  566. X__BEGIN_DECLS
  567. Xchar    *mbrune __P((const char *, rune_t));
  568. Xchar    *mbrrune __P((const char *, rune_t));
  569. Xchar    *mbmb __P((const char *, char *));
  570. Xlong     fgetrune __P((FILE *));
  571. Xint     fputrune __P((rune_t, FILE *));
  572. Xint     fungetrune __P((rune_t, FILE *));
  573. Xint     setrunelocale __P((char *));
  574. Xvoid     setinvalidrune __P((rune_t));
  575. X__END_DECLS
  576. X
  577. X#endif    /*! _RUNE_H_ */
  578. END_OF_FILE
  579. if test 2738 -ne `wc -c <'include/rune.h'`; then
  580.     echo shar: \"'include/rune.h'\" unpacked with wrong size!
  581. fi
  582. # end of 'include/rune.h'
  583. fi
  584. if test -f 'include/runetype.h' -a "${1}" != "-c" ; then 
  585.   echo shar: Will not clobber existing file \"'include/runetype.h'\"
  586. else
  587. echo shar: Extracting \"'include/runetype.h'\" \(3707 characters\)
  588. sed "s/^X//" >'include/runetype.h' <<'END_OF_FILE'
  589. X/*-
  590. X * Copyright (c) 1993
  591. X *    The Regents of the University of California.  All rights reserved.
  592. X *
  593. X * This code is derived from software contributed to Berkeley by
  594. X * Paul Borman at Krystal Technologies.
  595. X *
  596. X * Redistribution and use in source and binary forms, with or without
  597. X * modification, are permitted provided that the following conditions
  598. X * are met:
  599. X * 1. Redistributions of source code must retain the above copyright
  600. X *    notice, this list of conditions and the following disclaimer.
  601. X * 2. Redistributions in binary form must reproduce the above copyright
  602. X *    notice, this list of conditions and the following disclaimer in the
  603. X *    documentation and/or other materials provided with the distribution.
  604. X * 3. All advertising materials mentioning features or use of this software
  605. X *    must display the following acknowledgement:
  606. X *    This product includes software developed by the University of
  607. X *    California, Berkeley and its contributors.
  608. X * 4. Neither the name of the University nor the names of its contributors
  609. X *    may be used to endorse or promote products derived from this software
  610. X *    without specific prior written permission.
  611. X *
  612. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  613. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  614. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  615. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  616. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  617. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  618. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  619. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  620. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  621. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  622. X * SUCH DAMAGE.
  623. X *
  624. X *    @(#)runetype.h    8.1 (Berkeley) 6/2/93
  625. X */
  626. X
  627. X#ifndef    _RUNETYPE_H_
  628. X#define    _RUNETYPE_H_
  629. X
  630. X#include <machine/ansi.h>
  631. X#include <sys/cdefs.h>
  632. X
  633. X#ifdef  _BSD_WCHAR_T_
  634. Xtypedef _BSD_WCHAR_T_    rune_t;
  635. Xtypedef _BSD_WCHAR_T_    wchar_t;
  636. X#undef  _BSD_WCHAR_T_
  637. X#endif
  638. X
  639. X#define    _CACHED_RUNES    (1 <<8 )    /* Must be a power of 2 */
  640. X#define    _CRMASK        (~(_CACHED_RUNES - 1))
  641. X
  642. X/*
  643. X * The lower 8 bits of runetype[] contain the digit value of the rune.
  644. X */
  645. Xtypedef struct {
  646. X    rune_t        min;        /* First rune of the range */
  647. X    rune_t        max;        /* Last rune (inclusive) of the range */
  648. X    rune_t        map;        /* What first maps to in maps */
  649. X    unsigned long    *types;        /* Array of types in range */
  650. X} _RuneEntry;
  651. X
  652. Xtypedef struct {
  653. X    int        nranges;    /* Number of ranges stored */
  654. X    _RuneEntry    *ranges;    /* Pointer to the ranges */
  655. X} _RuneRange;
  656. X
  657. Xtypedef struct {
  658. X    char        magic[8];    /* Magic saying what version we are */
  659. X    char        encoding[32];    /* ASCII name of this encoding */
  660. X
  661. X    rune_t        (*sgetrune)
  662. X        __P((const char *, unsigned int, char const **));
  663. X    int        (*sputrune)
  664. X        __P((rune_t, char *, unsigned int, char **));
  665. X    rune_t        invalid_rune;
  666. X
  667. X    unsigned long    runetype[_CACHED_RUNES];
  668. X    rune_t        maplower[_CACHED_RUNES];
  669. X    rune_t        mapupper[_CACHED_RUNES];
  670. X
  671. X    /*
  672. X     * The following are to deal with Runes larger than _CACHED_RUNES - 1.
  673. X     * Their data is actually contiguous with this structure so as to make
  674. X     * it easier to read/write from/to disk.
  675. X     */
  676. X    _RuneRange    runetype_ext;
  677. X    _RuneRange    maplower_ext;
  678. X    _RuneRange    mapupper_ext;
  679. X
  680. X    void        *variable;    /* Data which depends on the encoding */
  681. X    int        variable_len;    /* how long that data is */
  682. X} _RuneLocale;
  683. X
  684. X#define    _RUNE_MAGIC_1    "RuneMagi"    /* Indicates version 0 of RuneLocale */
  685. X
  686. Xextern _RuneLocale _DefaultRuneLocale;
  687. Xextern _RuneLocale *_CurrentRuneLocale;
  688. X
  689. X#endif    /* !_RUNETYPE_H_ */
  690. END_OF_FILE
  691. if test 3707 -ne `wc -c <'include/runetype.h'`; then
  692.     echo shar: \"'include/runetype.h'\" unpacked with wrong size!
  693. fi
  694. # end of 'include/runetype.h'
  695. fi
  696. if test -f 'include/stddef.changes' -a "${1}" != "-c" ; then 
  697.   echo shar: Will not clobber existing file \"'include/stddef.changes'\"
  698. else
  699. echo shar: Extracting \"'include/stddef.changes'\" \(241 characters\)
  700. sed "s/^X//" >'include/stddef.changes' <<'END_OF_FILE'
  701. X< #ifdef  _WCHAR_T_
  702. X< typedef _WCHAR_T_       wchar_t;
  703. X< #undef  _WCHAR_T_
  704. X< #endif
  705. X
  706. X> #ifdef  _BSD_WCHAR_T_
  707. X> #ifndef _ANSI_SOURCE
  708. X> typedef _BSD_WCHAR_T_  rune_t;
  709. X> #endif
  710. X> typedef _BSD_WCHAR_T_  wchar_t;
  711. X> #undef  _BSD_WCHAR_T_
  712. X> #endif
  713. END_OF_FILE
  714. if test 241 -ne `wc -c <'include/stddef.changes'`; then
  715.     echo shar: \"'include/stddef.changes'\" unpacked with wrong size!
  716. fi
  717. # end of 'include/stddef.changes'
  718. fi
  719. if test -f 'include/stdlib.changes' -a "${1}" != "-c" ; then 
  720.   echo shar: Will not clobber existing file \"'include/stdlib.changes'\"
  721. else
  722. echo shar: Extracting \"'include/stdlib.changes'\" \(355 characters\)
  723. sed "s/^X//" >'include/stdlib.changes' <<'END_OF_FILE'
  724. X< #ifdef  _WCHAR_T_
  725. X< typedef _WCHAR_T_       wchar_t;
  726. X< #undef  _WCHAR_T_
  727. X< #endif
  728. X
  729. X> #ifdef  _BSD_WCHAR_T_
  730. X> #ifndef _ANSI_SOURCE
  731. X> typedef _BSD_WCHAR_T_   rune_t;
  732. X> #endif
  733. X> typedef _BSD_WCHAR_T_   wchar_t;
  734. X> #undef  _BSD_WCHAR_T_
  735. X> #endif
  736. X
  737. X< #define MB_CUR_MAX      1       /* XXX */
  738. X
  739. X> extern int __mb_cur_max;
  740. X> #define MB_CUR_MAX      __mb_cur_max
  741. END_OF_FILE
  742. if test 355 -ne `wc -c <'include/stdlib.changes'`; then
  743.     echo shar: \"'include/stdlib.changes'\" unpacked with wrong size!
  744. fi
  745. # end of 'include/stdlib.changes'
  746. fi
  747. if test ! -d 'libc' ; then
  748.     echo shar: Creating directory \"'libc'\"
  749.     mkdir 'libc'
  750. fi
  751. if test -f 'libc/ansi.c' -a "${1}" != "-c" ; then 
  752.   echo shar: Will not clobber existing file \"'libc/ansi.c'\"
  753. else
  754. echo shar: Extracting \"'libc/ansi.c'\" \(3602 characters\)
  755. sed "s/^X//" >'libc/ansi.c' <<'END_OF_FILE'
  756. X/*-
  757. X * Copyright (c) 1993
  758. X *    The Regents of the University of California.  All rights reserved.
  759. X *
  760. X * This code is derived from software contributed to Berkeley by
  761. X * Paul Borman at Krystal Technologies.
  762. X *
  763. X * Redistribution and use in source and binary forms, with or without
  764. X * modification, are permitted provided that the following conditions
  765. X * are met:
  766. X * 1. Redistributions of source code must retain the above copyright
  767. X *    notice, this list of conditions and the following disclaimer.
  768. X * 2. Redistributions in binary form must reproduce the above copyright
  769. X *    notice, this list of conditions and the following disclaimer in the
  770. X *    documentation and/or other materials provided with the distribution.
  771. X * 3. All advertising materials mentioning features or use of this software
  772. X *    must display the following acknowledgement:
  773. X *    This product includes software developed by the University of
  774. X *    California, Berkeley and its contributors.
  775. X * 4. Neither the name of the University nor the names of its contributors
  776. X *    may be used to endorse or promote products derived from this software
  777. X *    without specific prior written permission.
  778. X *
  779. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  780. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  781. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  782. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  783. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  784. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  785. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  786. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  787. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  788. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  789. X * SUCH DAMAGE.
  790. X */
  791. X
  792. X#if defined(LIBC_SCCS) && !defined(lint)
  793. Xstatic char sccsid[] = "@(#)ansi.c    8.1 (Berkeley) 6/27/93";
  794. X#endif /* LIBC_SCCS and not lint */
  795. X
  796. X#include <stdlib.h>
  797. X#include <limits.h>
  798. X#include <stddef.h>
  799. X#include <rune.h>
  800. X
  801. Xint
  802. Xmblen(s, n)
  803. X    const char *s;
  804. X    size_t n;
  805. X{
  806. X    char const *e;
  807. X
  808. X    if (s == 0 || *s == 0)
  809. X        return (0);    /* No support for state dependent encodings. */
  810. X
  811. X    if (sgetrune(s, (int)n, &e) == _INVALID_RUNE)
  812. X        return (s - e);
  813. X    return (e - s);
  814. X}
  815. X
  816. Xint
  817. Xmbtowc(pwc, s, n)
  818. X    wchar_t *pwc;
  819. X    const char *s;
  820. X    size_t n;
  821. X{
  822. X    char const *e;
  823. X    rune_t r;
  824. X
  825. X    if (s == 0 || *s == 0)
  826. X        return (0);    /* No support for state dependent encodings. */
  827. X
  828. X    if ((r = sgetrune(s, (int)n, &e)) == _INVALID_RUNE)
  829. X        return (s - e);
  830. X    if (pwc)
  831. X        *pwc = r;
  832. X    return (e - s);
  833. X}
  834. X
  835. Xint
  836. Xwctomb(s, wchar)
  837. X    char *s;
  838. X    wchar_t wchar;
  839. X{
  840. X    char *e;
  841. X
  842. X    if (s == 0)
  843. X        return (0);    /* No support for state dependent encodings. */
  844. X
  845. X    if (wchar == 0) {
  846. X        *s = 0;
  847. X        return (1);
  848. X    }
  849. X
  850. X    sputrune(wchar, s, MB_CUR_MAX, &e);
  851. X    return (e ? e - s : -1);
  852. X}
  853. X
  854. Xsize_t
  855. Xmbstowcs(pwcs, s, n)
  856. X    wchar_t *pwcs;
  857. X    const char *s;
  858. X    size_t n;
  859. X{
  860. X    char const *e;
  861. X    int cnt = 0;
  862. X
  863. X    if (!pwcs || !s)
  864. X        return (-1);
  865. X
  866. X    while (n-- > 0) {
  867. X        *pwcs = sgetrune(s, MB_LEN_MAX, &e);
  868. X        if (*pwcs == _INVALID_RUNE)
  869. X            return (-1);
  870. X        if (*pwcs++ == 0)
  871. X            break;
  872. X        s = e;
  873. X        ++cnt;
  874. X    }
  875. X    return (cnt);
  876. X}
  877. X
  878. Xsize_t
  879. Xwcstombs(s, pwcs, n)
  880. X    char *s;
  881. X    const wchar_t *pwcs;
  882. X    size_t n;
  883. X{
  884. X    char *e;
  885. X    int cnt = 0;
  886. X
  887. X    if (!pwcs || !s)
  888. X        return (-1);
  889. X
  890. X    while (n > 0) {
  891. X        if (*pwcs == 0) {
  892. X            *s = 0;
  893. X            break;
  894. X        }
  895. X        if (!sputrune(*pwcs++, s, (int)n, &e))
  896. X            return (-1);        /* encoding error */
  897. X        if (!e)            /* too long */
  898. X            return (cnt);
  899. X        cnt += e - s;
  900. X        s = e;
  901. X    }
  902. X    return (cnt);
  903. X}
  904. END_OF_FILE
  905. if test 3602 -ne `wc -c <'libc/ansi.c'`; then
  906.     echo shar: \"'libc/ansi.c'\" unpacked with wrong size!
  907. fi
  908. # end of 'libc/ansi.c'
  909. fi
  910. if test -f 'libc/frune.c' -a "${1}" != "-c" ; then 
  911.   echo shar: Will not clobber existing file \"'libc/frune.c'\"
  912. else
  913. echo shar: Extracting \"'libc/frune.c'\" \(2973 characters\)
  914. sed "s/^X//" >'libc/frune.c' <<'END_OF_FILE'
  915. X/*-
  916. X * Copyright (c) 1993
  917. X *    The Regents of the University of California.  All rights reserved.
  918. X *
  919. X * This code is derived from software contributed to Berkeley by
  920. X * Paul Borman at Krystal Technologies.
  921. X *
  922. X * Redistribution and use in source and binary forms, with or without
  923. X * modification, are permitted provided that the following conditions
  924. X * are met:
  925. X * 1. Redistributions of source code must retain the above copyright
  926. X *    notice, this list of conditions and the following disclaimer.
  927. X * 2. Redistributions in binary form must reproduce the above copyright
  928. X *    notice, this list of conditions and the following disclaimer in the
  929. X *    documentation and/or other materials provided with the distribution.
  930. X * 3. All advertising materials mentioning features or use of this software
  931. X *    must display the following acknowledgement:
  932. X *    This product includes software developed by the University of
  933. X *    California, Berkeley and its contributors.
  934. X * 4. Neither the name of the University nor the names of its contributors
  935. X *    may be used to endorse or promote products derived from this software
  936. X *    without specific prior written permission.
  937. X *
  938. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  939. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  940. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  941. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  942. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  943. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  944. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  945. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  946. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  947. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  948. X * SUCH DAMAGE.
  949. X */
  950. X
  951. X#if defined(LIBC_SCCS) && !defined(lint)
  952. Xstatic char sccsid[] = "@(#)frune.c    8.1 (Berkeley) 6/4/93";
  953. X#endif /* LIBC_SCCS and not lint */
  954. X
  955. X#include <limits.h>
  956. X#include <rune.h>
  957. X#include <stddef.h>
  958. X#include <stdio.h>
  959. X
  960. Xlong
  961. Xfgetrune(fp)
  962. X    FILE *fp;
  963. X{
  964. X    rune_t  r;
  965. X    int c, len;
  966. X    char buf[MB_LEN_MAX];
  967. X    char const *result;
  968. X
  969. X    len = 0;
  970. X    do {
  971. X        if ((c = getc(fp)) == EOF) {
  972. X            if (len)
  973. X                break;
  974. X            return (EOF);
  975. X        }
  976. X        buf[len++] = c;
  977. X
  978. X        if ((r = sgetrune(buf, len, &result)) != _INVALID_RUNE)
  979. X            return (r);
  980. X    } while (result == buf && len < MB_LEN_MAX);
  981. X
  982. X    while (--len > 0)
  983. X        ungetc(buf[len], fp);
  984. X    return (_INVALID_RUNE);
  985. X}
  986. X
  987. Xint
  988. Xfungetrune(r, fp)
  989. X    rune_t r;
  990. X    FILE* fp;
  991. X{
  992. X    int len;
  993. X    char buf[MB_LEN_MAX];
  994. X
  995. X    len = sputrune(r, buf, MB_LEN_MAX, 0);
  996. X    while (len-- > 0)
  997. X        if (ungetc(buf[len], fp) == EOF)
  998. X            return (EOF);
  999. X    return (0);
  1000. X}
  1001. X
  1002. Xint
  1003. Xfputrune(r, fp)
  1004. X    rune_t r;
  1005. X    FILE *fp;
  1006. X{
  1007. X    int i, len;
  1008. X    char buf[MB_LEN_MAX];
  1009. X
  1010. X    len = sputrune(r, buf, MB_LEN_MAX, 0);
  1011. X
  1012. X    for (i = 0; i < len; ++i)
  1013. X        if (putc(buf[i], fp) == EOF)
  1014. X            return (EOF);
  1015. X
  1016. X    return (0);
  1017. X}
  1018. END_OF_FILE
  1019. if test 2973 -ne `wc -c <'libc/frune.c'`; then
  1020.     echo shar: \"'libc/frune.c'\" unpacked with wrong size!
  1021. fi
  1022. # end of 'libc/frune.c'
  1023. fi
  1024. if test -f 'libc/isctype.c' -a "${1}" != "-c" ; then 
  1025.   echo shar: Will not clobber existing file \"'libc/isctype.c'\"
  1026. else
  1027. echo shar: Extracting \"'libc/isctype.c'\" \(3374 characters\)
  1028. sed "s/^X//" >'libc/isctype.c' <<'END_OF_FILE'
  1029. X/*
  1030. X * Copyright (c) 1989, 1993
  1031. X *    The Regents of the University of California.  All rights reserved.
  1032. X *
  1033. X * This code is derived from software contributed to Berkeley by
  1034. X * Paul Borman at Krystal Technologies.
  1035. X *
  1036. X * Redistribution and use in source and binary forms, with or without
  1037. X * modification, are permitted provided that the following conditions
  1038. X * are met:
  1039. X * 1. Redistributions of source code must retain the above copyright
  1040. X *    notice, this list of conditions and the following disclaimer.
  1041. X * 2. Redistributions in binary form must reproduce the above copyright
  1042. X *    notice, this list of conditions and the following disclaimer in the
  1043. X *    documentation and/or other materials provided with the distribution.
  1044. X * 3. All advertising materials mentioning features or use of this software
  1045. X *    must display the following acknowledgement:
  1046. X *    This product includes software developed by the University of
  1047. X *    California, Berkeley and its contributors.
  1048. X * 4. Neither the name of the University nor the names of its contributors
  1049. X *    may be used to endorse or promote products derived from this software
  1050. X *    without specific prior written permission.
  1051. X *
  1052. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1053. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1054. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1055. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1056. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1057. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1058. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1059. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1060. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1061. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1062. X * SUCH DAMAGE.
  1063. X */
  1064. X
  1065. X#if defined(LIBC_SCCS) && !defined(lint)
  1066. Xstatic char sccsid[] = "@(#)isctype.c    8.1 (Berkeley) 6/4/93";
  1067. X#endif /* LIBC_SCCS and not lint */
  1068. X
  1069. X#define _ANSI_LIBRARY
  1070. X#include <ctype.h>
  1071. X
  1072. X#undef isalnum
  1073. Xint
  1074. Xisalnum(c)
  1075. X    int c;
  1076. X{
  1077. X    return(__istype((c), (_A|_D)));
  1078. X}
  1079. X
  1080. X#undef isalpha
  1081. Xint
  1082. Xisalpha(c)
  1083. X    int c;
  1084. X{
  1085. X    return (__istype((c), _A));
  1086. X}
  1087. X
  1088. X#undef isascii
  1089. Xint
  1090. Xisascii(c)
  1091. X    int c;
  1092. X{
  1093. X    return((c & ~0x7F) == 0);
  1094. X}
  1095. X
  1096. X#undef isblank
  1097. Xint
  1098. Xisblank(c)
  1099. X    int c;
  1100. X{
  1101. X    return (__istype((c), _B));
  1102. X}
  1103. X
  1104. X#undef iscntrl
  1105. Xint
  1106. Xiscntrl(c)
  1107. X    int c;
  1108. X{
  1109. X    return (__istype((c), _C));
  1110. X}
  1111. X
  1112. X#undef isdigit
  1113. Xint
  1114. Xisdigit(c)
  1115. X    int c;
  1116. X{
  1117. X    return (__isctype((c), _D));
  1118. X}
  1119. X
  1120. X#undef isgraph
  1121. Xint
  1122. Xisgraph(c)
  1123. X    int c;
  1124. X{
  1125. X    return (__istype((c), _G));
  1126. X}
  1127. X
  1128. X#undef islower
  1129. Xint
  1130. Xislower(c)
  1131. X    int c;
  1132. X{
  1133. X    return (__istype((c), _L));
  1134. X}
  1135. X
  1136. X#undef isprint
  1137. Xint
  1138. Xisprint(c)
  1139. X    int c;
  1140. X{
  1141. X    return (__istype((c), _R));
  1142. X}
  1143. X
  1144. X#undef ispunct
  1145. Xint
  1146. Xispunct(c)
  1147. X    int c;
  1148. X{
  1149. X    return (__istype((c), _P));
  1150. X}
  1151. X
  1152. X#undef isspace
  1153. Xint
  1154. Xisspace(c)
  1155. X    int c;
  1156. X{
  1157. X    return (__istype((c), _S));
  1158. X}
  1159. X
  1160. X#undef isupper
  1161. Xint
  1162. Xisupper(c)
  1163. X    int c;
  1164. X{
  1165. X    return (__istype((c), _U));
  1166. X}
  1167. X
  1168. X#undef isxdigit
  1169. Xint
  1170. Xisxdigit(c)
  1171. X    int c;
  1172. X{
  1173. X    return (__isctype((c), _X));
  1174. X}
  1175. X
  1176. X#undef toascii
  1177. Xint
  1178. Xtoascii(c)
  1179. X    int c;
  1180. X{
  1181. X    return (c & 0177);
  1182. X}
  1183. X
  1184. X#undef tolower
  1185. Xint
  1186. Xtolower(c)
  1187. X    int c;
  1188. X{
  1189. X        return((c & _CRMASK) ? ___toupper(c) : _CurrentRuneLocale->mapupper[c]);
  1190. X}
  1191. X
  1192. X#undef toupper
  1193. Xint
  1194. Xtoupper(c)
  1195. X    int c;
  1196. X{
  1197. X        return((c & _CRMASK) ? ___tolower(c) : _CurrentRuneLocale->maplower[c]);
  1198. X}
  1199. END_OF_FILE
  1200. if test 3374 -ne `wc -c <'libc/isctype.c'`; then
  1201.     echo shar: \"'libc/isctype.c'\" unpacked with wrong size!
  1202. fi
  1203. # end of 'libc/isctype.c'
  1204. fi
  1205. if test -f 'libc/mbrune.c' -a "${1}" != "-c" ; then 
  1206.   echo shar: Will not clobber existing file \"'libc/mbrune.c'\"
  1207. else
  1208. echo shar: Extracting \"'libc/mbrune.c'\" \(3351 characters\)
  1209. sed "s/^X//" >'libc/mbrune.c' <<'END_OF_FILE'
  1210. X/*-
  1211. X * Copyright (c) 1993
  1212. X *    The Regents of the University of California.  All rights reserved.
  1213. X *
  1214. X * This code is derived from software contributed to Berkeley by
  1215. X * Paul Borman at Krystal Technologies.
  1216. X *
  1217. X * Redistribution and use in source and binary forms, with or without
  1218. X * modification, are permitted provided that the following conditions
  1219. X * are met:
  1220. X * 1. Redistributions of source code must retain the above copyright
  1221. X *    notice, this list of conditions and the following disclaimer.
  1222. X * 2. Redistributions in binary form must reproduce the above copyright
  1223. X *    notice, this list of conditions and the following disclaimer in the
  1224. X *    documentation and/or other materials provided with the distribution.
  1225. X * 3. All advertising materials mentioning features or use of this software
  1226. X *    must display the following acknowledgement:
  1227. X *    This product includes software developed by the University of
  1228. X *    California, Berkeley and its contributors.
  1229. X * 4. Neither the name of the University nor the names of its contributors
  1230. X *    may be used to endorse or promote products derived from this software
  1231. X *    without specific prior written permission.
  1232. X *
  1233. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1234. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1235. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1236. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1237. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1238. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1239. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1240. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1241. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1242. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1243. X * SUCH DAMAGE.
  1244. X */
  1245. X
  1246. X#if defined(LIBC_SCCS) && !defined(lint)
  1247. Xstatic char sccsid[] = "@(#)mbrune.c    8.1 (Berkeley) 6/27/93";
  1248. X#endif /* LIBC_SCCS and not lint */
  1249. X
  1250. X#include <limits.h>
  1251. X#include <rune.h>
  1252. X#include <stddef.h>
  1253. X#include <string.h>
  1254. X
  1255. Xchar *
  1256. Xmbrune(string, c)
  1257. X    const char *string;
  1258. X    rune_t c;
  1259. X{
  1260. X    char const *result;
  1261. X    rune_t r;
  1262. X
  1263. X    while ((r = sgetrune(string, MB_LEN_MAX, &result))) {
  1264. X        if (r == c)
  1265. X            return ((char *)string);
  1266. X        string = result == string ? string + 1 : result;
  1267. X    }
  1268. X
  1269. X    return (c == *string ? (char *)string : NULL);
  1270. X}
  1271. X
  1272. Xchar *
  1273. Xmbrrune(string, c)
  1274. X    const char *string;
  1275. X    rune_t c;
  1276. X{
  1277. X    const char *last = 0;
  1278. X    char const *result;
  1279. X    rune_t  r;
  1280. X
  1281. X    while ((r = sgetrune(string, MB_LEN_MAX, &result))) {
  1282. X        if (r == c)
  1283. X            last = string;
  1284. X        string = result == string ? string + 1 : result;
  1285. X    }
  1286. X    return (c == *string ? (char *)string : (char *)last);
  1287. X}
  1288. X
  1289. Xchar *
  1290. Xmbmb(string, pattern)
  1291. X    const char *string;
  1292. X    char *pattern;
  1293. X{
  1294. X    rune_t first, r;
  1295. X    size_t plen, slen;
  1296. X    char const *result;
  1297. X
  1298. X    plen = strlen(pattern);
  1299. X    slen = strlen(string);
  1300. X    if (plen > slen)
  1301. X        return (0);
  1302. X
  1303. X    first = sgetrune(pattern, plen, &result);
  1304. X    if (result == string)
  1305. X        return (0);
  1306. X
  1307. X    while (slen >= plen && (r = sgetrune(string, slen, &result))) {
  1308. X        if (r == first) {
  1309. X            if (strncmp(string, pattern, slen) == 0)
  1310. X                return ((char *) string);
  1311. X        }
  1312. X        if (result == string) {
  1313. X            --slen;
  1314. X            ++string;
  1315. X        } else {
  1316. X            slen -= result - string;
  1317. X            string = result;
  1318. X        }
  1319. X    }
  1320. X    return (0);
  1321. X}
  1322. END_OF_FILE
  1323. if test 3351 -ne `wc -c <'libc/mbrune.c'`; then
  1324.     echo shar: \"'libc/mbrune.c'\" unpacked with wrong size!
  1325. fi
  1326. # end of 'libc/mbrune.c'
  1327. fi
  1328. if test -f 'libc/none.c' -a "${1}" != "-c" ; then 
  1329.   echo shar: Will not clobber existing file \"'libc/none.c'\"
  1330. else
  1331. echo shar: Extracting \"'libc/none.c'\" \(2937 characters\)
  1332. sed "s/^X//" >'libc/none.c' <<'END_OF_FILE'
  1333. X/*-
  1334. X * Copyright (c) 1993
  1335. X *    The Regents of the University of California.  All rights reserved.
  1336. X *
  1337. X * This code is derived from software contributed to Berkeley by
  1338. X * Paul Borman at Krystal Technologies.
  1339. X *
  1340. X * Redistribution and use in source and binary forms, with or without
  1341. X * modification, are permitted provided that the following conditions
  1342. X * are met:
  1343. X * 1. Redistributions of source code must retain the above copyright
  1344. X *    notice, this list of conditions and the following disclaimer.
  1345. X * 2. Redistributions in binary form must reproduce the above copyright
  1346. X *    notice, this list of conditions and the following disclaimer in the
  1347. X *    documentation and/or other materials provided with the distribution.
  1348. X * 3. All advertising materials mentioning features or use of this software
  1349. X *    must display the following acknowledgement:
  1350. X *    This product includes software developed by the University of
  1351. X *    California, Berkeley and its contributors.
  1352. X * 4. Neither the name of the University nor the names of its contributors
  1353. X *    may be used to endorse or promote products derived from this software
  1354. X *    without specific prior written permission.
  1355. X *
  1356. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1357. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1358. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1359. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1360. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1361. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1362. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1363. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1364. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1365. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1366. X * SUCH DAMAGE.
  1367. X */
  1368. X
  1369. X#if defined(LIBC_SCCS) && !defined(lint)
  1370. Xstatic char sccsid[] = "@(#)none.c    8.1 (Berkeley) 6/4/93";
  1371. X#endif /* LIBC_SCCS and not lint */
  1372. X
  1373. X#include <stddef.h>
  1374. X#include <stdio.h>
  1375. X#include <rune.h>
  1376. X#include <errno.h>
  1377. X#include <stdlib.h>
  1378. X
  1379. Xrune_t    _none_sgetrune __P((const char *, size_t, char const **));
  1380. Xint    _none_sputrune __P((rune_t, char *, size_t, char **));
  1381. X
  1382. Xint
  1383. X_none_init(rl)
  1384. X    _RuneLocale *rl;
  1385. X{
  1386. X    rl->sgetrune = _none_sgetrune;
  1387. X    rl->sputrune = _none_sputrune;
  1388. X    _CurrentRuneLocale = rl;
  1389. X    __mb_cur_max = 1;
  1390. X    return(0);
  1391. X}
  1392. X
  1393. Xrune_t
  1394. X_none_sgetrune(string, n, result)
  1395. X    const char *string;
  1396. X    size_t n;
  1397. X    char const **result;
  1398. X{
  1399. X    int c;
  1400. X
  1401. X    if (n < 1) {
  1402. X        if (result)
  1403. X            *result = string;
  1404. X        return(_INVALID_RUNE);
  1405. X    }
  1406. X    if (result)
  1407. X        *result = string + 1;
  1408. X    return(*string & 0xff);
  1409. X}
  1410. X
  1411. Xint
  1412. X_none_sputrune(c, string, n, result)
  1413. X    rune_t c;
  1414. X    char *string, **result;
  1415. X    size_t n;
  1416. X{
  1417. X    if (n >= 1) {
  1418. X        if (string)
  1419. X            *string = c;
  1420. X        if (result)
  1421. X            *result = string + 1;
  1422. X    } else if (result)
  1423. X        *result = (char *)0;
  1424. X    return(1);
  1425. X}
  1426. END_OF_FILE
  1427. if test 2937 -ne `wc -c <'libc/none.c'`; then
  1428.     echo shar: \"'libc/none.c'\" unpacked with wrong size!
  1429. fi
  1430. # end of 'libc/none.c'
  1431. fi
  1432. if test -f 'libc/utf2.c' -a "${1}" != "-c" ; then 
  1433.   echo shar: Will not clobber existing file \"'libc/utf2.c'\"
  1434. else
  1435. echo shar: Extracting \"'libc/utf2.c'\" \(4147 characters\)
  1436. sed "s/^X//" >'libc/utf2.c' <<'END_OF_FILE'
  1437. X/*-
  1438. X * Copyright (c) 1993
  1439. X *    The Regents of the University of California.  All rights reserved.
  1440. X *
  1441. X * This code is derived from software contributed to Berkeley by
  1442. X * Paul Borman at Krystal Technologies.
  1443. X *
  1444. X * Redistribution and use in source and binary forms, with or without
  1445. X * modification, are permitted provided that the following conditions
  1446. X * are met:
  1447. X * 1. Redistributions of source code must retain the above copyright
  1448. X *    notice, this list of conditions and the following disclaimer.
  1449. X * 2. Redistributions in binary form must reproduce the above copyright
  1450. X *    notice, this list of conditions and the following disclaimer in the
  1451. X *    documentation and/or other materials provided with the distribution.
  1452. X * 3. All advertising materials mentioning features or use of this software
  1453. X *    must display the following acknowledgement:
  1454. X *    This product includes software developed by the University of
  1455. X *    California, Berkeley and its contributors.
  1456. X * 4. Neither the name of the University nor the names of its contributors
  1457. X *    may be used to endorse or promote products derived from this software
  1458. X *    without specific prior written permission.
  1459. X *
  1460. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1461. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1462. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1463. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1464. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1465. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1466. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1467. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1468. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1469. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1470. X * SUCH DAMAGE.
  1471. X */
  1472. X
  1473. X#if defined(LIBC_SCCS) && !defined(lint)
  1474. Xstatic char sccsid[] = "@(#)utf2.c    8.1 (Berkeley) 6/4/93";
  1475. X#endif /* LIBC_SCCS and not lint */
  1476. X
  1477. X#include <errno.h>
  1478. X#include <rune.h>
  1479. X#include <stddef.h>
  1480. X#include <stdio.h>
  1481. X#include <stdlib.h>
  1482. X
  1483. Xrune_t    _UTF2_sgetrune __P((const char *, size_t, char const **));
  1484. Xint    _UTF2_sputrune __P((rune_t, char *, size_t, char **));
  1485. X
  1486. Xstatic _utf_count[16] = {
  1487. X    1, 1, 1, 1, 1, 1, 1, 1,
  1488. X    0, 0, 0, 0, 2, 2, 3, 0,
  1489. X};
  1490. X
  1491. Xint
  1492. X_UTF2_init(rl)
  1493. X    _RuneLocale *rl;
  1494. X{
  1495. X    rl->sgetrune = _UTF2_sgetrune;
  1496. X    rl->sputrune = _UTF2_sputrune;
  1497. X    _CurrentRuneLocale = rl;
  1498. X    __mb_cur_max = 3;
  1499. X    return (0);
  1500. X}
  1501. X
  1502. Xrune_t
  1503. X_UTF2_sgetrune(string, n, result)
  1504. X    const char *string;
  1505. X    size_t n;
  1506. X    char const **result;
  1507. X{
  1508. X    int c;
  1509. X
  1510. X    if (n < 1 || (c = _utf_count[(*string >> 4) & 0xf]) > n) {
  1511. X        if (result)
  1512. X            *result = string;
  1513. X        return (_INVALID_RUNE);
  1514. X    }
  1515. X    switch (c) {
  1516. X    case 1:
  1517. X        if (result)
  1518. X            *result = string + 1;
  1519. X        return (*string & 0xff);
  1520. X    case 2:
  1521. X        if ((string[1] & 0xC0) != 0x80)
  1522. X            goto encoding_error;
  1523. X        if (result)
  1524. X            *result = string + 2;
  1525. X        return (((string[0] & 0x1F) << 6) | (string[1] & 0x3F));
  1526. X    case 3:
  1527. X        if ((string[1] & 0xC0) != 0x80 || (string[2] & 0xC0) != 0x80)
  1528. X            goto encoding_error;
  1529. X        if (result)
  1530. X            *result = string + 3;
  1531. X        return (((string[0] & 0x1F) << 12) | ((string[1] & 0x3F) << 6)
  1532. X            | (string[2] & 0x3F));
  1533. X    default:
  1534. Xencoding_error:    if (result)
  1535. X            *result = string + 1;
  1536. X        return (_INVALID_RUNE);
  1537. X    }
  1538. X}
  1539. X
  1540. Xint
  1541. X_UTF2_sputrune(c, string, n, result)
  1542. X    rune_t c;
  1543. X    char *string, **result;
  1544. X    size_t n;
  1545. X{
  1546. X    if (c & 0xF800) {
  1547. X        if (n >= 3) {
  1548. X            if (string) {
  1549. X                string[0] = 0xE0 | ((c >> 12) & 0x0F);
  1550. X                string[1] = 0x80 | ((c >> 6) & 0x3F);
  1551. X                string[2] = 0x80 | ((c) & 0x3F);
  1552. X            }
  1553. X            if (result)
  1554. X                *result = string + 3;
  1555. X        } else
  1556. X            if (result)
  1557. X                *result = NULL;
  1558. X
  1559. X        return (3);
  1560. X    } else
  1561. X        if (c & 0x0780) {
  1562. X            if (n >= 2) {
  1563. X                if (string) {
  1564. X                    string[0] = 0xC0 | ((c >> 6) & 0x1F);
  1565. X                    string[1] = 0x80 | ((c) & 0x3F);
  1566. X                }
  1567. X                if (result)
  1568. X                    *result = string + 2;
  1569. X            } else
  1570. X                if (result)
  1571. X                    *result = NULL;
  1572. X            return (2);
  1573. X        } else {
  1574. X            if (n >= 1) {
  1575. X                if (string)
  1576. X                    string[0] = c;
  1577. X                if (result)
  1578. X                    *result = string + 1;
  1579. X            } else
  1580. X                if (result)
  1581. X                    *result = NULL;
  1582. X            return (1);
  1583. X        }
  1584. X}
  1585. END_OF_FILE
  1586. if test 4147 -ne `wc -c <'libc/utf2.c'`; then
  1587.     echo shar: \"'libc/utf2.c'\" unpacked with wrong size!
  1588. fi
  1589. # end of 'libc/utf2.c'
  1590. fi
  1591. if test ! -d 'mklocale' ; then
  1592.     echo shar: Creating directory \"'mklocale'\"
  1593.     mkdir 'mklocale'
  1594. fi
  1595. if test -f 'mklocale/Japanese' -a "${1}" != "-c" ; then 
  1596.   echo shar: Will not clobber existing file \"'mklocale/Japanese'\"
  1597. else
  1598. echo shar: Extracting \"'mklocale/Japanese'\" \(3873 characters\)
  1599. sed "s/^X//" >'mklocale/Japanese' <<'END_OF_FILE'
  1600. X#    @(#)Japanese    8.1 (Berkeley) 6/6/93
  1601. X
  1602. X/*
  1603. X * Japanese LOCALE_CTYPE definitions using EUC of JIS character sets
  1604. X */
  1605. X
  1606. XENCODING    "EUC"
  1607. X
  1608. X/*        JIS     JIS      JIS            */
  1609. X/*        X201     X208      X201             */
  1610. X/*        00-7f          84-fe            */
  1611. X
  1612. XVARIABLE    1 0x0000 2 0x8080 2 0x0080 3 0x8000 0x8080
  1613. X
  1614. X/*
  1615. X * Code Set 1
  1616. X */
  1617. XALPHA        'A' - 'Z' 'a' - 'z'
  1618. XCONTROL        0x00 - 0x1f 0x7f
  1619. XDIGIT        '0' - '9'
  1620. XGRAPH        0x21 - 0x7e
  1621. XLOWER        'a' - 'z'
  1622. XPUNCT        0x21 - 0x2f 0x3a - 0x40 0x5b - 0x60 0x7b - 0x7e
  1623. XSPACE        0x09 - 0x0d 0x20
  1624. XUPPER        'A' - 'Z'
  1625. XXDIGIT        'a' - 'f' 'A' - 'F'
  1626. XBLANK        ' ' '\t'
  1627. XPRINT        0x20 - 0x7e
  1628. X
  1629. XMAPLOWER           < 'A' - 'Z' : 'a' >
  1630. XMAPLOWER           < 'a' - 'z' : 'a' >
  1631. XMAPUPPER           < 'A' - 'Z' : 'A' >
  1632. XMAPUPPER           < 'a' - 'z' : 'A' >
  1633. XTODIGIT           < '0' - '9' : 0 >
  1634. XTODIGIT           < 'A' - 'F' : 10 >
  1635. XTODIGIT           < 'a' - 'f' : 10 >
  1636. X
  1637. X/*
  1638. X * Code Set 2
  1639. X */
  1640. X
  1641. XSPACE        0xa1a1
  1642. XPHONOGRAM    0xa1bc
  1643. XSPECIAL         0xa1a2 - 0xa1fe
  1644. XPUNCT        0xa1a2 - 0xa1f8        /* A few too many in here... */
  1645. X
  1646. XSPECIAL        0xa2a1 - 0xa2ae 0xa2ba - 0xa2c1 0xa2ca - 0xa2d0 0xa2dc - 0xa2ea
  1647. XSPECIAL        0xa2f2 - 0xa2f9 0xa2fe
  1648. X
  1649. XDIGIT        0xa3b0 - 0xa3b9
  1650. XUPPER        0xa3c1 - 0xa3da                /* Romaji */
  1651. XLOWER        0xa3e1 - 0xa3fa                /* Romaji */
  1652. XMAPLOWER    < 0xa3c1 - 0xa3da : 0xa3e1 >        /* English */
  1653. XMAPLOWER    < 0xa3e1 - 0xa3fa : 0xa3e1 >        /* English */
  1654. XMAPUPPER    < 0xa3c1 - 0xa3da : 0xa3c1 >
  1655. XMAPUPPER    < 0xa3e1 - 0xa3fa : 0xa3c1 >
  1656. X
  1657. XXDIGIT        0xa3c1 - 0xa3c6 0xa3e1 - 0xa3e6
  1658. X
  1659. XTODIGIT        < 0xa3b0 - 0xa3b9 : 0 >
  1660. XTODIGIT        < 0xa3c1 - 0xa3c6 : 10 >
  1661. XTODIGIT        < 0xa3e1 - 0xa3e6 : 10 >
  1662. X
  1663. XPHONOGRAM    0xa4a1 - 0xa4f3
  1664. XPHONOGRAM    0xa5a1 - 0xa5f6
  1665. X
  1666. XUPPER        0xa6a1 - 0xa6b8                /* Greek */
  1667. XLOWER        0xa6c1 - 0xa6d8                /* Greek */
  1668. XMAPLOWER    < 0xa6a1 - 0xa6b8 : 0xa6c1 >
  1669. XMAPLOWER    < 0xa6c1 - 0xa6d8 : 0xa6c1 >
  1670. XMAPUPPER    < 0xa6a1 - 0xa6b8 : 0xa6a1 >
  1671. XMAPUPPER    < 0xa6c1 - 0xa6d8 : 0xa6a1 >
  1672. X
  1673. XUPPER        0xa7a1 - 0xa7c1                /* Cyrillic */
  1674. XLOWER        0xa7d1 - 0xa7f1                /* Cyrillic */
  1675. XMAPLOWER    < 0xa7a1 - 0xa7c1 : 0xa7d1 >
  1676. XMAPLOWER    < 0xa7d1 - 0xa7f1 : 0xa7d1 >
  1677. XMAPUPPER    < 0xa7a1 - 0xa7c1 : 0xa7a1 >
  1678. XMAPUPPER    < 0xa7d1 - 0xa7f1 : 0xa7a1 >
  1679. X
  1680. XSPECIAL        0xa8a1 - 0xa8c0
  1681. X
  1682. XIDEOGRAM    0xb0a1 - 0xb0fe
  1683. XIDEOGRAM    0xb1a1 - 0xb1fe
  1684. XIDEOGRAM    0xb2a1 - 0xb2fe
  1685. XIDEOGRAM    0xb3a1 - 0xb3fe
  1686. XIDEOGRAM    0xb4a1 - 0xb4fe
  1687. XIDEOGRAM    0xb5a1 - 0xb5fe
  1688. XIDEOGRAM    0xb6a1 - 0xb6fe
  1689. XIDEOGRAM    0xb7a1 - 0xb7fe
  1690. XIDEOGRAM    0xb8a1 - 0xb8fe
  1691. XIDEOGRAM    0xb9a1 - 0xb9fe
  1692. XIDEOGRAM    0xbaa1 - 0xbafe
  1693. XIDEOGRAM    0xbba1 - 0xbbfe
  1694. XIDEOGRAM    0xbca1 - 0xbcfe
  1695. XIDEOGRAM    0xbda1 - 0xbdfe
  1696. XIDEOGRAM    0xbea1 - 0xbefe
  1697. XIDEOGRAM    0xbfa1 - 0xbffe
  1698. XIDEOGRAM    0xc0a1 - 0xc0fe
  1699. XIDEOGRAM    0xc1a1 - 0xc1fe
  1700. XIDEOGRAM    0xc2a1 - 0xc2fe
  1701. XIDEOGRAM    0xc3a1 - 0xc3fe
  1702. XIDEOGRAM    0xc4a1 - 0xc4fe
  1703. XIDEOGRAM    0xc5a1 - 0xc5fe
  1704. XIDEOGRAM    0xc6a1 - 0xc6fe
  1705. XIDEOGRAM    0xc7a1 - 0xc7fe
  1706. XIDEOGRAM    0xc8a1 - 0xc8fe
  1707. XIDEOGRAM    0xc9a1 - 0xc9fe
  1708. XIDEOGRAM    0xcaa1 - 0xcafe
  1709. XIDEOGRAM    0xcba1 - 0xcbfe
  1710. XIDEOGRAM    0xcca1 - 0xccfe
  1711. XIDEOGRAM    0xcda1 - 0xcdfe
  1712. XIDEOGRAM    0xcea1 - 0xcefe
  1713. XIDEOGRAM    0xcfa1 - 0xcfd3
  1714. XIDEOGRAM    0xd0a1 - 0xd0fe
  1715. XIDEOGRAM    0xd1a1 - 0xd1fe
  1716. XIDEOGRAM    0xd2a1 - 0xd2fe
  1717. XIDEOGRAM    0xd3a1 - 0xd3fe
  1718. XIDEOGRAM    0xd4a1 - 0xd4fe
  1719. XIDEOGRAM    0xd5a1 - 0xd5fe
  1720. XIDEOGRAM    0xd6a1 - 0xd6fe
  1721. XIDEOGRAM    0xd7a1 - 0xd7fe
  1722. XIDEOGRAM    0xd8a1 - 0xd8fe
  1723. XIDEOGRAM    0xd9a1 - 0xd9fe
  1724. XIDEOGRAM    0xdaa1 - 0xdafe
  1725. XIDEOGRAM    0xdba1 - 0xdbfe
  1726. XIDEOGRAM    0xdca1 - 0xdcfe
  1727. XIDEOGRAM    0xdda1 - 0xddfe
  1728. XIDEOGRAM    0xdea1 - 0xdefe
  1729. XIDEOGRAM    0xdfa1 - 0xdffe
  1730. XIDEOGRAM    0xe0a1 - 0xe0fe
  1731. XIDEOGRAM    0xe1a1 - 0xe1fe
  1732. XIDEOGRAM    0xe2a1 - 0xe2fe
  1733. XIDEOGRAM    0xe3a1 - 0xe3fe
  1734. XIDEOGRAM    0xe4a1 - 0xe4fe
  1735. XIDEOGRAM    0xe5a1 - 0xe5fe
  1736. XIDEOGRAM    0xe6a1 - 0xe6fe
  1737. XIDEOGRAM    0xe7a1 - 0xe7fe
  1738. XIDEOGRAM    0xe8a1 - 0xe8fe
  1739. XIDEOGRAM    0xe9a1 - 0xe9fe
  1740. XIDEOGRAM    0xeaa1 - 0xeafe
  1741. XIDEOGRAM    0xeba1 - 0xebfe
  1742. XIDEOGRAM    0xeca1 - 0xecfe
  1743. XIDEOGRAM    0xeda1 - 0xedfe
  1744. XIDEOGRAM    0xeea1 - 0xeefe
  1745. XIDEOGRAM    0xefa1 - 0xeffe
  1746. XIDEOGRAM    0xf0a1 - 0xf0fe
  1747. XIDEOGRAM    0xf1a1 - 0xf1fe
  1748. XIDEOGRAM    0xf2a1 - 0xf2fe
  1749. XIDEOGRAM    0xf3a1 - 0xf3fe
  1750. XIDEOGRAM    0xf4a1 - 0xf4a4
  1751. X
  1752. X/*
  1753. X * This is for Code Set 3, half-width kana
  1754. X */
  1755. XSPECIAL        0xa1 - 0xdf
  1756. XPHONOGRAM    0xa1 - 0xdf
  1757. XCONTROL        0x84 - 0x97 0x9b - 0x9f 0xe0 - 0xfe
  1758. END_OF_FILE
  1759. if test 3873 -ne `wc -c <'mklocale/Japanese'`; then
  1760.     echo shar: \"'mklocale/Japanese'\" unpacked with wrong size!
  1761. fi
  1762. # end of 'mklocale/Japanese'
  1763. fi
  1764. if test -f 'mklocale/Makefile' -a "${1}" != "-c" ; then 
  1765.   echo shar: Will not clobber existing file \"'mklocale/Makefile'\"
  1766. else
  1767. echo shar: Extracting \"'mklocale/Makefile'\" \(141 characters\)
  1768. sed "s/^X//" >'mklocale/Makefile' <<'END_OF_FILE'
  1769. X#    @(#)Makefile    8.1 (Berkeley) 6/7/93
  1770. X
  1771. XPROG=    mklocale
  1772. XSRCS=    yacc.c lex.c
  1773. XCFLAGS+=-I.
  1774. XCLEANFILES+=y.tab.h yacc.c lex.c
  1775. X
  1776. X.include <bsd.prog.mk>
  1777. END_OF_FILE
  1778. if test 141 -ne `wc -c <'mklocale/Makefile'`; then
  1779.     echo shar: \"'mklocale/Makefile'\" unpacked with wrong size!
  1780. fi
  1781. # end of 'mklocale/Makefile'
  1782. fi
  1783. if test -f 'mklocale/POSIX' -a "${1}" != "-c" ; then 
  1784.   echo shar: Will not clobber existing file \"'mklocale/POSIX'\"
  1785. else
  1786. echo shar: Extracting \"'mklocale/POSIX'\" \(728 characters\)
  1787. sed "s/^X//" >'mklocale/POSIX' <<'END_OF_FILE'
  1788. X#    @(#)POSIX    8.1 (Berkeley) 6/6/93
  1789. X
  1790. X/*
  1791. X * Standard LOCALE_CTYPE for the C Locale
  1792. X */
  1793. XENCODING    "UTF2"
  1794. XVARIABLE    A comment line or data line.  Only 1 allowed.  Copied verbatim.
  1795. X
  1796. X#
  1797. X# This is a comment
  1798. X#
  1799. XALPHA        'A' - 'Z' 'a' - 'z'
  1800. XCONTROL        0x00 - 0x1f 0x7f
  1801. XDIGIT        '0' - '9'
  1802. XGRAPH        0x21 - 0x7e
  1803. XLOWER        'a' - 'z'
  1804. XPUNCT        0x21 - 0x2f 0x3a - 0x40 0x5b - 0x60 0x7b - 0x7e
  1805. XSPACE        0x09 - 0x0d 0x20
  1806. XUPPER        'A' - 'Z'
  1807. XXDIGIT        'a' - 'f' 'A' - 'F'
  1808. XBLANK        ' ' '\t'
  1809. XPRINT        0x20 - 0x7e
  1810. X# IDEOGRAM
  1811. X# SPECIAL
  1812. X# PHONEGRAM
  1813. X
  1814. XMAPLOWER           <'A' - 'Z' : 'a'>
  1815. XMAPLOWER           <'a' - 'z' : 'a'>
  1816. XMAPUPPER           <'A' - 'Z' : 'A'>
  1817. XMAPUPPER           <'a' - 'z' : 'A'>
  1818. XTODIGIT           <'0' - '9' : 0>
  1819. XTODIGIT           <'A' - 'F' : 10>
  1820. XTODIGIT           <'a' - 'f' : 10>
  1821. END_OF_FILE
  1822. if test 728 -ne `wc -c <'mklocale/POSIX'`; then
  1823.     echo shar: \"'mklocale/POSIX'\" unpacked with wrong size!
  1824. fi
  1825. # end of 'mklocale/POSIX'
  1826. fi
  1827. if test -f 'mklocale/ldef.h' -a "${1}" != "-c" ; then 
  1828.   echo shar: Will not clobber existing file \"'mklocale/ldef.h'\"
  1829. else
  1830. echo shar: Extracting \"'mklocale/ldef.h'\" \(2259 characters\)
  1831. sed "s/^X//" >'mklocale/ldef.h' <<'END_OF_FILE'
  1832. X/*-
  1833. X * Copyright (c) 1993
  1834. X *    The Regents of the University of California.  All rights reserved.
  1835. X *
  1836. X * This code is derived from software contributed to Berkeley by
  1837. X * Paul Borman at Krystal Technologies.
  1838. X *
  1839. X * Redistribution and use in source and binary forms, with or without
  1840. X * modification, are permitted provided that the following conditions
  1841. X * are met:
  1842. X * 1. Redistributions of source code must retain the above copyright
  1843. X *    notice, this list of conditions and the following disclaimer.
  1844. X * 2. Redistributions in binary form must reproduce the above copyright
  1845. X *    notice, this list of conditions and the following disclaimer in the
  1846. X *    documentation and/or other materials provided with the distribution.
  1847. X * 3. All advertising materials mentioning features or use of this software
  1848. X *    must display the following acknowledgement:
  1849. X *    This product includes software developed by the University of
  1850. X *    California, Berkeley and its contributors.
  1851. X * 4. Neither the name of the University nor the names of its contributors
  1852. X *    may be used to endorse or promote products derived from this software
  1853. X *    without specific prior written permission.
  1854. X *
  1855. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1856. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1857. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1858. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1859. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1860. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1861. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1862. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1863. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1864. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1865. X * SUCH DAMAGE.
  1866. X *
  1867. X *    @(#)ldef.h    8.1 (Berkeley) 6/6/93
  1868. X */
  1869. X
  1870. X/*
  1871. X * This should look a LOT like a _RuneEntry
  1872. X */
  1873. Xtypedef struct rune_list {
  1874. X    rune_t        min;
  1875. X    rune_t         max;
  1876. X    rune_t         map;
  1877. X    u_long        *types;
  1878. X    struct rune_list    *next;
  1879. X} rune_list;
  1880. X
  1881. Xtypedef struct rune_map {
  1882. X    u_long        map[_CACHED_RUNES];
  1883. X    rune_list        *root;
  1884. X} rune_map;
  1885. END_OF_FILE
  1886. if test 2259 -ne `wc -c <'mklocale/ldef.h'`; then
  1887.     echo shar: \"'mklocale/ldef.h'\" unpacked with wrong size!
  1888. fi
  1889. # end of 'mklocale/ldef.h'
  1890. fi
  1891. echo shar: End of archive 1 \(of 3\).
  1892. cp /dev/null ark1isdone
  1893. MISSING=""
  1894. for I in 1 2 3 ; do
  1895.     if test ! -f ark${I}isdone ; then
  1896.     MISSING="${MISSING} ${I}"
  1897.     fi
  1898. done
  1899. if test "${MISSING}" = "" ; then
  1900.     echo You have unpacked all 3 archives.
  1901.     rm -f ark[1-9]isdone
  1902. else
  1903.     echo You still need to unpack the following archives:
  1904.     echo "        " ${MISSING}
  1905. fi
  1906. ##  End of shell archive.
  1907. exit 0
  1908.