head	1.2;
access;
symbols
	RELEASE_4_2_0:1.1.1.1
	RELEASE_4_1_1:1.1.1.1
	RELEASE_4_1_0:1.1.1.1
	RELEASE_3_5_0:1.1.1.1
	RELEASE_4_0_0:1.1.1.1
	RELEASE_3_4_0:1.1.1.1
	RELEASE_3_3_0:1.1.1.1
	RELEASE_3_2_0:1.1.1.1
	v3_1_r:1.1.1.1
	SADA:1.1.1;
locks; strict;
comment	@# @;


1.2
date	2000.11.26.14.46.35;	author sada;	state dead;
branches;
next	1.1;

1.1
date	99.04.04.18.09.57;	author sada;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	99.04.04.18.09.57;	author sada;	state Exp;
branches;
next	;


desc
@@


1.2
log
@Unbroke - I abandon to build an aout lib.
Now this port installs binary files which were pulled up
from packages-4.1.1.
@
text
@--- locale/ansi.c.orig	Sun Oct 25 14:06:42 1998
+++ locale/ansi.c	Sun Feb 28 00:59:25 1999
@@@@ -42,6 +42,7 @@@@
 #include <limits.h>
 #include <stddef.h>
 #include <rune.h>
+#include <string.h>
 
 int
 mblen(s, n)
@@@@ -105,9 +106,19 @@@@
 	char const *e;
 	int cnt = 0;
 
-	if (!pwcs || !s)
+	if (!s)
 		return (-1);
 
+	if (!pwcs) {
+		while (*s) {
+			if (sgetrune(s, MB_LEN_MAX, &e) == _INVALID_RUNE)
+				return (-1);
+			s = e;
+			++cnt;
+		}
+		return (cnt);
+	}
+
 	while (n-- > 0) {
 		*pwcs = sgetrune(s, MB_LEN_MAX, &e);
 		if (*pwcs == _INVALID_RUNE)
@@@@ -132,6 +143,13 @@@@
 	if (!pwcs || !s || n > INT_MAX)
 		return (-1);
 
+if( (pwcs[0]&0xffff0000) || ((!(pwcs[0]&0x8000))&&(pwcs[0]&0xff00)) ){
+  int len;
+  strncpy(s, (char *)pwcs, n);
+  len = strlen((char *)pwcs);
+  return (len < n) ? len : n;
+}
+
 	nb = n;
 	cnt = 0;
 	while (nb > 0) {
@@@@ -141,8 +159,10 @@@@
 		}
 		if (!sputrune(*pwcs++, s, nb, &e))
 			return (-1);		/* encoding error */
-		if (!e)			/* too long */
+		if (!e) {			/* too long */
+			*s = 0;
 			return (cnt);
+		}
 		cnt += e - s;
 		nb -= e - s;
 		s = e;
@


1.1
log
@Initial revision
@
text
@@


1.1.1.1
log
@libxpg4 (aout) for Netscape Browser. This is against browser's locale bug.
Patches are created by <nagahama@@yasuda.comm.waseda.ac.jp>.
Refer to <URL:http://www.yasuda.comm.waseda.ac.jp/~nagahama/freebsd.html>.
@
text
@@
