Question about localedef for LC_TIME

2015-07-11 Thread Vladimir Támara Patiño


I would like to ask your advice about sending patches that include 
localedef and support for LC_TIME.


Some time ago I sent patches to support LC_TIME using source tables from 
FreeBSD:


  http://comments.gmane.org/gmane.os.openbsd.tech/36338

I understood from Stephan that source tables should be in localedef 
format and that starting with LC_TIME was good road.  I undertook that 
road, and I already have an implementation of localedef that can read 
LC_TIME from a file from CLDR and can produce tables in UTF-8 (tables 
that practically the function _loc in time/strftime.c can read).


This localedef is available at:
https://github.com/pasosdeJesus/adJ/blob/master/arboldes/usr/src/03-Tiempo-02-localedef.patch

My question is when would be good to send this and the other patches to 
support LC_TIME, in order to be reviewed?







---
Dios, gracias por tu amor infinito.
--
  Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/
  http://www.pasosdejesus.org/dominio_publico_colombia.html



Re: [patch] xlocale part 3: move _CurrentRuneLocale to locale_t (ctype)

2015-07-10 Thread Vladimir Támara Patiño


Looks good to me.

I though it was necessary to include __mb_cur_max in _locale_t (as FreeBSD 
and DragonFly do in their xlocale_ctype in mblocal.h) but just now I noticed 
that it is already included in lc_ctype-rl_citrus_ctype


Thanks for your work.

--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html



[Patch] mbsrtowcs and wcsrtombs can receive src in NULL

2014-10-02 Thread Vladimir Támara Patiño
POSIX doesn't specify behavior for wcsrtombs and mbsrtowcs when the
source parameter is NULL.
http://pubs.opengroup.org/onlinepubs/009695399/functions/mbsrtowcs.html
http://pubs.opengroup.org/onlinepubs/009695399/functions/wcsrtombs.html

However segfaulting in such cases, as happens with this example,  
IMHO, is not desirable.

--- nullsrc.c

#include locale.h
#include stdio.h
#include string.h
#include wchar.h

int main() {
char *msrc = NULL;
char mdst[100];
wchar_t *wsrc = NULL;
wchar_t wdst[100];
size_t s;
mbstate_t mbst;

bzero(mbst, sizeof(mbst));
mbsinit(mbst);

s = wcsrtombs(mdst, (const wchar_t **)wsrc, 5, mbst);
printf(fixed wcsrtombs without encoding\n);
s = mbsrtowcs(wdst, (const char **)msrc, 5, mbst);
printf(fixed mbsrtowcs without encoding\n);

setlocale(LC_ALL, POSIX.UTF-8);
s = wcsrtombs(mdst, (const wchar_t **)wsrc, 5, mbst);
printf(fixed wcsrtombs with UTF-8\n);
s = mbsrtowcs(wdst, (const char **)msrc, 5, mbst);
printf(fixed mbsrtowcs with UTF-8\n);

return 0;
}
---

cc -g -o nullsrc nullsrc.c
gdb nullsrc
...
(gdb) run
Starting program: /home/vtamara/tmp/nullsrc 

Program received signal SIGSEGV, Segmentation fault.
_citrus_none_ctype_wcsnrtombs (dst=0x7f7bee90 ,
src=0x7f7bee80, nwc=18446744073709551615, len=5,
pspriv=0x7f7bee00)
at /usr/src/lib/libc/citrus/citrus_none.c:155
155 wchar_t wc = (*src)[i];

---

The attached patch solves this by setting errno in EINVAL and 
returning (size_t)-1 when the source parameter is NULL or points
to NULL, also includes this information in the man page.


-- 
Dios, gracias por tu amor infinito.
--  
  Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/
  http://www.pasosdejesus.org/dominio_publico_colombia.html

diff -u src56-orig/lib/libc/citrus/citrus_none.c 
src/lib/libc/citrus/citrus_none.c
--- src56-orig/lib/libc/citrus/citrus_none.cThu Mar  7 13:12:31 2013
+++ src/lib/libc/citrus/citrus_none.c   Wed Oct  1 12:45:17 2014
@@ -93,6 +93,10 @@
/* dst may be NULL */
/* pspriv appears to be unused */
 
+   if (src == NULL || *src == NULL) {
+   errno = EINVAL;
+   return ((size_t)-1);
+   }
if (dst == NULL)
return strnlen(*src, nmc);
 
@@ -138,6 +142,10 @@
/* dst may be NULL */
/* pspriv appears to be unused */
 
+   if (src == NULL || *src == NULL) {
+   errno = EINVAL;
+   return ((size_t)-1);
+   }
if (dst == NULL) {
for (i = 0; i  nwc; i++) {
wchar_t wc = (*src)[i];
diff -u src56-orig/lib/libc/citrus/citrus_utf8.c 
src/lib/libc/citrus/citrus_utf8.c
--- src56-orig/lib/libc/citrus/citrus_utf8.cFri Sep 19 13:07:15 2014
+++ src/lib/libc/citrus/citrus_utf8.c   Wed Oct  1 12:44:01 2014
@@ -194,6 +194,10 @@
 
us = (struct _utf8_state *)pspriv;
 
+   if (src == NULL || *src == NULL) {
+   errno = EINVAL;
+return ((size_t)-1);
+}
if (dst == NULL) {
/*
 * The fast path in the loop below is not safe if an ASCII
@@ -346,6 +350,10 @@
return ((size_t)-1);
}
 
+   if (src == NULL || *src == NULL) {
+   errno = EINVAL;
+return ((size_t)-1);
+}
if (dst == NULL) {
for (i = o = 0; i  nwc; i++, o += r) {
wchar_t wc = (*src)[i];
diff -u src56-orig/lib/libc/locale/mbsrtowcs.3 src/lib/libc/locale/mbsrtowcs.3
--- src56-orig/lib/libc/locale/mbsrtowcs.3  Tue Jun  4 22:39:22 2013
+++ src/lib/libc/locale/mbsrtowcs.3 Wed Oct  1 13:34:47 2014
@@ -151,8 +151,8 @@
 is a null pointer, the value returned is the number of elements to contain
 the whole string converted, except for a terminating null wide character.
 .It (size_t)-1
-The array indirectly pointed to by
 .Fa src
+is NULL or points to NULL or to an array that
 contains a byte sequence forming invalid character.
 In this case,
 .Va errno
@@ -167,9 +167,8 @@
 functions may return the following errors:
 .Bl -tag -width Er
 .It Bq Er EILSEQ
-The pointer pointed to by
 .Fa src
-points to an invalid or incomplete multibyte character.
+is NULL or points to NULL or to an invalid or incomplete multibyte character.
 .It Bq Er EINVAL
 .Fa ps
 points to an invalid or uninitialized mbstate_t object.
diff -u src56-orig/lib/libc/locale/wcsrtombs.3 src/lib/libc/locale/wcsrtombs.3
--- src56-orig/lib/libc/locale/wcsrtombs.3  Tue Jun  4 22:39:22 2013
+++ src/lib/libc/locale/wcsrtombs.3 Wed Oct  1 13:37:31 2014
@@ -153,7 +153,7 @@
 will not be null-terminated.
 .It (size_t)-1
 .Fa src
-points to the string containing invalid wide character.
+is NULL or points to NULL or to a string containing invalid wide character.
 In this case,
 .Va errno
 is set to indicate

Bug in gethostbyaddr and patch to solve

2014-08-25 Thread Vladimir Támara Patiño

Using tcpdump in a firewall with 5.5 (also happens with 5.4 and I guess with
current) and certain addres of the LAN I got always a segfault.

It is a bug within the function gethostbyaddr.  It can be reproduced with 
the minimal test program available at:

http://openbsd.7691.n7.nabble.com/problem-with-gethostbyaddr-on-OBSD-5-4-td242329.html
and the following steps:

1. Create a entry in /etc/hosts with IP address but without name, for example:
echo 192.168.1.89  /etc/hosts
2. Compile the test program of the link
cc -o gethostbyaddr gethostbyaddr.c
3. Run de test program with the address added to /etc/hosts without name:
./gethostbyaddr 192.168.1.89

Using gdb to trace the problem I got:

Loaded symbols for /home/vtamara/comp/OpenBSD/buggethostbyaddr/gethostbyaddr
Reading symbols from /usr/lib/libc.so.73.1...done.
Loaded symbols for /usr/lib/libc.so.73.1
Reading symbols from /usr/libexec/ld.so...done.
Loaded symbols for /usr/libexec/ld.so
#0  0x18d69baa2ba2 in strlen (str=0x0)
   at /usr/src/lib/libc/string/strlen.c:43
43  for (s = str; *s; ++s)
(gdb) bt
#0  0x18d69baa2ba2 in strlen (str=0x0)
   at /usr/src/lib/libc/string/strlen.c:43
#1  0x18d69ba68d91 in hostent_set_cname (h=0x18d69bee9800, name=0x0, 
   isdname=Variable isdname is not available.

) at /usr/src/lib/libc/asr/gethostnamadr_async.c:579
#2  0x18d69ba696bd in gethostnamadr_async_run (as=0x18d6957d3d00, 
   ar=0x7f7f69c0) at /usr/src/lib/libc/asr/gethostnamadr_async.c:451

#3  0x18d69ba8078c in asr_async_run (as=0x18d6957d3d00, ar=0x7f7f69c0)
   at /usr/src/lib/libc/asr/asr.c:197
#4  0x18d69ba8085b in asr_async_run_sync (as=0x18d6957d3d00, 
   ar=0x7f7f69c0) at /usr/src/lib/libc/asr/asr.c:222

#5  0x18d69ba68824 in gethostbyaddr (addr=0x7f7f6a80, len=4, af=2)
   at /usr/src/lib/libc/asr/gethostnamadr.c:179
#6  0x18d495400fbb in main ()
  from /home/vtamara/comp/OpenBSD/buggethostbyaddr/gethostbyaddr

As shown hostent_set_cname receives name in NULL and tries to call strlen 
with it, a simple patch is attached.


--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html

diff -ruN src55-orig/lib/libc/asr/gethostnamadr_async.c 
src/lib/libc/asr/gethostnamadr_async.c
--- src55-orig/lib/libc/asr/gethostnamadr_async.c   Wed Feb 26 15:00:08 2014
+++ src/lib/libc/asr/gethostnamadr_async.c  Mon Aug 25 15:34:18 2014
@@ -565,7 +565,7 @@
charbuf[MAXDNAME];
size_t  n;
 
-   if (h-h.h_name)
+   if (h-h.h_name || name == NULL)
return (-1);
 
if (isdname) {


Re: Question and regression test for strftime adn wcsftime

2014-04-29 Thread Vladimir Támara Patiño
(col), %W, tl);
 +  p(strcmp(col, 14) == 0);
 +  wcsftime(wcol, sizeof(wcol), L%W, tl);
 +  p(wcscmp(wcol, L14) == 0);
 +
 +  strftime(col, sizeof(col), %X, tl);
 +  p(strcmp(col, 09:40:00) == 0);
 +  wcsftime(wcol, sizeof(wcol), L%X, tl);
 +  p(wcscmp(wcol, L09:40:00) == 0);
 +
 +  strftime(col, sizeof(col), %x, tl);
 +  p(strcmp(col, 04/08/14) == 0);
 +  wcsftime(wcol, sizeof(wcol), L%x, tl);
 +  p(wcscmp(wcol, L04/08/14) == 0);
 +
 +  strftime(col, sizeof(col), %Y, tl);
 +  p(strcmp(col, 2014) == 0);
 +  wcsftime(wcol, sizeof(wcol), L%Y, tl);
 +  p(wcscmp(wcol, L2014) == 0);
 +
 +  strftime(col, sizeof(col), %y, tl);
 +  p(strcmp(col, 14) == 0);
 +  wcsftime(wcol, sizeof(wcol), L%y, tl);
 +  p(wcscmp(wcol, L14) == 0);
 +
 +  strftime(col, sizeof(col), %Z, tl);
 +  p(strcmp(col, GMT) == 0);
 +  wcsftime(wcol, sizeof(wcol), L%Z, tl);
 +  p(wcscmp(wcol, LGMT) == 0);
 +
 +  strftime(col, sizeof(col), %z, tl);
 +  p(strcmp(col, +) == 0);
 +  wcsftime(wcol, sizeof(wcol), L%z, tl);
 +  p(wcscmp(wcol, L+) == 0);
 +
 +  strftime(col, sizeof(col), %%, tl);
 +  p(strcmp(col, %) == 0);
 +  wcsftime(wcol, sizeof(wcol), L%%, tl);
 +  p(wcscmp(wcol, L%) == 0);
 +
 +  strftime(col, sizeof(col), %+, tl);
 +  p(strcmp(col, Tue Apr  8 09:40:00 GMT 2014) == 0);
 +  wcsftime(wcol, sizeof(wcol), L%+, tl);
 +  p(wcscmp(wcol, LTue Apr  8 09:40:00 GMT 2014) == 0);
 +
 +  
 +
 +  }
 +}
 +
 +
 +int main()
 +{
 +  test_ftime_posix();
 +  
 +  return bad != 0;
 +}
 +



--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html

diff -ruN -x obj -x CVS -x *~ -x *patch -x *orig src56-orig/sys/sys/localedef.h 
src/sys/sys/localedef.h
--- src56-orig/sys/sys/localedef.h  Sun Apr 21 17:31:47 1996
+++ src/sys/sys/localedef.h Thu Apr 24 21:44:36 2014
@@ -84,15 +84,16 @@
 
 
 typedef struct {
-   const char *abday[7];
-   const char *day[7];
-   const char *abmon[12];
-   const char *mon[12];
-   const char *am_pm[2];
-   const char *d_t_fmt;
-   const char *d_fmt;
-   const char *t_fmt;
-   const char *t_fmt_ampm;
+   const char *abmon[12];  /*  mon */
+   const char *mon[12];/*  month   */
+   const char *abday[7];   /*  wday*/
+   const char *day[7]; /*  weekday */
+   const char *t_fmt;  /* %X   X_fmt   */
+   const char *d_fmt;  /* %x   x_fmt */
+   const char *d_t_fmt;/* %c   c_fmt */
+   const char *am_pm[2];   /*  am pm */
+   const char *date_fmt;   /* %+   date_fmt */
+   const char *t_fmt_ampm; /* %r   ampm_fmt */
 } _TimeLocale;
 
 extern const _TimeLocale *_CurrentTimeLocale;
diff -ruN -x obj -x CVS -x *~ -x *patch -x *orig 
src56-orig/lib/libc/locale/_def_time.c src/lib/libc/locale/_def_time.c
--- src56-orig/lib/libc/locale/_def_time.c  Sun Oct  9 01:39:53 2011
+++ src/lib/libc/locale/_def_time.c Thu Apr 24 21:20:12 2014
@@ -10,13 +10,6 @@
 const _TimeLocale _DefaultTimeLocale =
 {
{
-   Sun,Mon,Tue,Wed,Thu,Fri,Sat,
-   },
-   {
-   Sunday, Monday, Tuesday, Wednesday, Thursday,
-   Friday, Saturday
-   },
-   {
Jan, Feb, Mar, Apr, May, Jun,
Jul, Aug, Sep, Oct, Nov, Dec
},
@@ -25,11 +18,19 @@
August, September, October, November, December
},
{
-   AM, PM
+   Sun,Mon,Tue,Wed,Thu,Fri,Sat,
},
-   %a %b %e %H:%M:%S %Y,
-   %m/%d/%y,
+   {
+   Sunday, Monday, Tuesday, Wednesday, Thursday,
+   Friday, Saturday
+   },
%H:%M:%S,
+   %m/%d/%y,
+   %a %b %e %H:%M:%S %Y,
+   {
+   AM, PM
+   },
+   %a %b %e %H:%M:%S %Z %Y,
%I:%M:%S %p
 };
 
diff -ruN -x obj -x CVS -x *~ -x *patch -x *orig 
src56-orig/lib/libc/time/strftime.c src/lib/libc/time/strftime.c
--- src56-orig/lib/libc/time/strftime.c Thu Sep 13 06:14:20 2012
+++ src/lib/libc/time/strftime.cFri Apr 25 10:16:20 2014
@@ -30,79 +30,12 @@
 ** SUCH DAMAGE.
 */
 
-#include tzfile.h
+#include sys/localedef.h
+
 #include fcntl.h
 #include locale.h
+#include tzfile.h
 
-struct lc_time_T {
-   const char *mon[MONSPERYEAR];
-   const char *month[MONSPERYEAR];
-   const char *wday[DAYSPERWEEK];
-   const char *weekday[DAYSPERWEEK];
-   const char *X_fmt;
-   const char *x_fmt;
-   const char *c_fmt;
-   const char *am;
-   const char *pm;
-   const char *date_fmt;
-};
-
-#ifdef LOCALE_HOME
-#include sys/stat.h
-static struct

Question and regression test for strftime adn wcsftime

2014-04-22 Thread Vladimir Támara Patiño

I see a lot of duplication between lib/libc/time/strftime.c and
lib/libc/time/wcsftime.c.

Since I would like to implement LC_TIME support, I would prefer to
change only in one place but before that I prepared a simple 
regression test for strftime and wcsftime that is attached.


Checking NetBSD and FreeBSD sources I see they implemented wcsftime 
by translating the wide character strings to multibyte, then calling 
strftime and finally converting the result back to wide character:

http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/locale/wcsftime.c?rev=1.5content-type=text/x-cvsweb-markuponly_with_tag=MAIN
https://github.com/freebsd/freebsd/blob/master/lib/libc/locale/wcsftime.c

The drawbacks I see are:
1. It is a little less efficient (because it has to translate before 
  calling strftime and translate again after)

2. If there is no memory or the conversions fail the function must
  return 0 and set errno, and that is not specified in POSIX 
  http://pubs.opengroup.org/onlinepubs/009696799/functions/wcsftime.html


What way do you suggest me?
1. Implement like FreeBSD and NetBSD did
2. Change both functions? they use differente structures lc_time_T that at 
  least I would like to unify.


--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html

diff -ruN src56-orig/regress/lib/libc/time/Makefile 
src/regress/lib/libc/time/Makefile
--- src56-orig/regress/lib/libc/time/Makefile   Tue Jan 20 11:47:55 2004
+++ src/regress/lib/libc/time/Makefile  Thu Apr 17 08:37:20 2014
@@ -1,5 +1,5 @@
 #  $OpenBSD: Makefile,v 1.1 2004/01/20 16:47:55 millert Exp $
 
-SUBDIR+=strptime
+SUBDIR+=ftime strptime
 
 .include bsd.subdir.mk
diff -ruN src56-orig/regress/lib/libc/time/ftime/Makefile 
src/regress/lib/libc/time/ftime/Makefile
--- src56-orig/regress/lib/libc/time/ftime/Makefile Wed Dec 31 19:00:00 1969
+++ src/regress/lib/libc/time/ftime/MakefileThu Apr 17 08:37:05 2014
@@ -0,0 +1,11 @@
+
+NOMAN=
+PROG=check_ftime
+
+CFLAGS=-g
+
+
+run-regress-check_ftime: ${PROG}
+   ./${PROG} /dev/null
+
+.include bsd.regress.mk
diff -ruN src56-orig/regress/lib/libc/time/ftime/check_ftime.c 
src/regress/lib/libc/time/ftime/check_ftime.c
--- src56-orig/regress/lib/libc/time/ftime/check_ftime.cWed Dec 31 
19:00:00 1969
+++ src/regress/lib/libc/time/ftime/check_ftime.c   Thu Apr 17 11:46:19 2014
@@ -0,0 +1,268 @@
+/**
+ * Public domain according to Colombian Legislation. 
+ * http://www.pasosdejesus.org/dominio_publico_colombia.html
+ * 2014. vtam...@pasosdejesus.org
+ *
+ * $OpenBSD$
+ */
+
+#include locale.h
+#include stdio.h
+#include stdlib.h
+
+int bad;
+
+#define p(t) printf(%s:\t ,#t); \
+   if (t) { \
+   printf(\x1b[38;5;2mOK\x1b[0m\n); \
+   } else { \
+   bad++; \
+   printf(\x1b[38;5;1mERROR\x1b[0m\n); \
+   }
+
+
+void test_ftime_posix()
+{
+   char nom[256];
+   char col[512];
+   wchar_t wcol[512];
+   char *nl;
+   char *enc[]= { ISO8859-1, ISO8859-15, UTF-8 };
+   struct lconv *p;
+   struct tm tl;
+   int i;
+   time_t ti;
+   long ts;
+   for(i = 0; i  sizeof(enc) / sizeof(char *) ; i++) {
+   snprintf(nom, sizeof(nom), POSIX.%s, enc[i]);
+   printf(nom=%s\n, nom);
+   nl = setlocale(LC_ALL, nom);
+   printf(locale %s\n, nl);
+   p = localeconv();
+   ti = (time_t)139695; //Tue Apr  8 09:40:00 2014
+   gmtime_r(ti, tl) ;
+   /*p = strptime(, , tm); */
+   strftime(col, sizeof(col), %A, tl);
+   p(strcmp(col, Tuesday) == 0);
+   wcsftime(wcol, sizeof(wcol), L%A, tl);
+   p(wcscmp(wcol, LTuesday) == 0);
+
+   strftime(col, sizeof(col), %a, tl);
+   p(strcmp(col, Tue) == 0);
+   wcsftime(wcol, sizeof(wcol), L%a, tl);
+   p(wcscmp(wcol, LTue) == 0);
+
+   strftime(col, sizeof(col), %B, tl);
+   p(strcmp(col, April) == 0);
+   wcsftime(wcol, sizeof(wcol), L%B, tl);
+   p(wcscmp(wcol, LApril) == 0);
+
+   strftime(col, sizeof(col), %b, tl);
+   p(strcmp(col, Apr) == 0);
+   wcsftime(wcol, sizeof(wcol), L%b, tl);
+   p(wcscmp(wcol, LApr) == 0);
+
+   strftime(col, sizeof(col), %C, tl);
+   p(strcmp(col, 20) == 0);
+   wcsftime(wcol, sizeof(wcol), L%C, tl);
+   p(wcscmp(wcol, L20) == 0);
+
+   strftime(col, sizeof(col), %c, tl);
+   printf(%s\n, col);
+   p(strcmp(col, Tue Apr  8 09:40:00 2014) == 0);
+   wcsftime(wcol, sizeof(wcol), L%c, tl);
+   p(wcscmp(wcol, LTue Apr  8 09:40:00 2014) == 0);
+
+   strftime(col, sizeof(col), %D, tl);
+   p(strcmp(col, 04/08/14) == 0

Re: Problem with ciphers and OpenSMTP

2014-03-31 Thread Vladimir Támara Patiño

Just wanted to thank Daniel and Philip for their help, yes changing
the certificate for one with RSA solved.

On Mon, Feb 24, 2014 at 01:58:49PM -0800, Philip Guenther wrote:

On Mon, Feb 24, 2014 at 12:40 PM, Vladimir Támara Patiño
vtam...@pasosdejesus.org wrote:
 I have an OpenSTMP server on OpenBSD 5.4 working fine, the configuration
 (/etc/mail/smtpd.conf) includes:

  listen on all port 465 smtps certificate example.com auth-optional

 Sending email from thunderbird, roundcubemail and an android MUA works fine,
 however I'm having problems to send email from an iPhone with its default
 MUA.
 The failed connections from the iPhone reported in /var/log/maillog show:
...
 Feb 24 15:31:36 www smtpd[20008]: smtp-in: Disconnecting session
  0047fd78e967: IO error: error:1408A0C1:SSL
  routines:SSL3_GET_CLIENT_HELLO:no shared cipher
...
 | ssl-enum-ciphers: |   SSLv3: | ciphers: |
 TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA - strong
 |   TLS_DHE_DSS_WITH_AES_256_CBC_SHA - strong
 | compressors: |   NULL
 |   TLSv1.0: | ciphers: |   TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA -
 strong
 |   TLS_DHE_DSS_WITH_AES_128_CBC_SHA - strong
 |   TLS_DHE_DSS_WITH_AES_256_CBC_SHA - strong
 | compressors: |   NULL
 |   TLSv1.1: | ciphers: |   TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA -
 strong
 |   TLS_DHE_DSS_WITH_AES_128_CBC_SHA - strong
 |   TLS_DHE_DSS_WITH_AES_256_CBC_SHA - strong
 | compressors: |   NULL
 |   TLSv1.2: | ciphers: |   TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA -
 strong
 |   TLS_DHE_DSS_WITH_AES_128_CBC_SHA - strong
 |   TLS_DHE_DSS_WITH_AES_128_CBC_SHA256 - strong
 |   TLS_DHE_DSS_WITH_AES_128_GCM_SHA256 - strong
 |   TLS_DHE_DSS_WITH_AES_256_CBC_SHA - strong
 |   TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 - strong
 |   TLS_DHE_DSS_WITH_AES_256_GCM_SHA384 - strong
 | compressors: |   NULL
 |_  least strength: strong

Your certificate is apparently a DHE/DSS cert, so smtpd can only offer
the DHE-DSS suites and not the RSA suites that almost all sites use.
How confident are you that iOS supports DHE-DSS cipher suites by
default?


Philip Guenther



--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html



Fix for regress/lib/libc/locale/check_isw

2013-11-24 Thread Vladimir Támara Patiño

I'm following Martin advice of sending just one diff, with more
explanation.

In current doing:
 cd /usr/src/regress/lib/libc/locale/check_isw
 sudo make
produces
 ./check_isw /dev/null
 *** Error 1 in . (Makefile:7 'run-regress-check_isw')
 FAILED
 *** Error 1 in target 'regress' (ignored)

It happens in tests with chars with integer values above 127.

Since this test is for POSIX locale (because no other locale is set
in it), as I explained in 
http://openbsd.7691.n7.nabble.com/Fix-for-regress-lib-libc-locale-check-isw-td225266.html

in my humble opinion it should test only the portable character set
and the control characters set, since the standard says For other
characters, the behaviour is unspecified.   


As far as I understand the portable character set and the control
character set conforms the POSIX locale defined in
http://pubs.opengroup.org/onlinepubs/7908799/xbd/locale.html#tag_005_003
as:

LC_CTYPE
# The following is the POSIX locale LC_CTYPE.
# alpha is by default upper and lower
# alnum is by definition alpha and digit
# print is by default alnum, punct and the space character
# graph is by default alnum and punct
#
upperA;B;C;D;E;F;G;H;I;J;K;L;M;\
  N;O;P;Q;R;S;T;U;V;W;X;Y;Z
#
lowera;b;c;d;e;f;g;h;i;j;k;l;m;\
n;o;p;q;r;s;t;u;v;w;x;y;z
#
digit zero;one;two;three;four;five;six;\
 seven;eight;nine
#
space tab;newline;vertical-tab;form-feed;\
 carriage-return;space
#
cntrl alert;backspace;tab;newline;vertical-tab;\ 
   form-feed;carriage-return;\

   NUL;SOH;STX;ETX;EOT;ENQ;ACK;SO;\
   SI;DLE;DC1;DC2;DC3;DC4;NAK;SYN;\
   ETB;CAN;EM;SUB;ESC;IS4;IS3;IS2;\
   IS1;DEL
#
punct exclamation-mark;quotation-mark;number-sign;\
dollar-sign;percent-sign;ampersand;apostrophe;\
left-parenthesis;right-parenthesis;asterisk;\
plus-sign;comma;hyphen;period;slash;\
colon;semicolon;less-than-sign;equals-sign;\
greater-than-sign;question-mark;commercial-at;\
left-square-bracket;backslash;right-square-bracket;\
circumflex;underscore;grave-accent;left-curly-bracket;\
vertical-line;right-curly-bracket;tilde
#
xdigit zero;one;two;three;four;five;six;seven;\
 eight;nine;A;B;C;D;E;F;a;b;c;d;e;f
#
blank space;tab
#
toupper (a,A);(b,B);(c,C);(d,D);(e,E);\
  (f,F);(g,G);(h,H);(i,I);(j,J);\
  (k,K);(l,L);(m,M);(n,N);(o,O);\
  (p,P);(q,Q);(r,R);(s,S);(t,T);\
  (u,U);(v,V);(w,W);(x,X);(y,Y);(z,Z)
#
tolower (A,a);(B,b);(C,c);(D,d);(E,e);\
  (F,f);(G,g);(H,h);(I,i);(J,j);\
  (K,k);(L,l);(M,m);(N,n);(O,o);\
  (P,p);(Q,q);(R,r);(S,s);(T,t);\
  (U,u);(V,v);(W,w);(X,x);(Y,y);(Z,z)
END LC_CTYPE

(The table that follows this definition in the same page shows
the right categories for each character. )

In the default encoding in OpenBSD these characters are like in
ASCII, ISO8859-* and UTF-8 in the first 127 bytes (see 
_DefaultRuneLocale in lib/libc/locale/runetable.c) so I don't see

need to check anything else in the case of POSIX locale.

There should be tests for other locales in my humble opinion, but that
is a separate diff.

--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html

diff -ruN src55-orig/regress/lib/libc/locale/check_isw/check_isw.c 
src/regress/lib/libc/locale/check_isw/check_isw.c
diff -u src55-orig/regress/lib/libc/locale/check_isw/check_isw.c 
src/regress/lib/libc/locale/check_isw/check_isw.c
--- src55-orig/regress/lib/libc/locale/check_isw/check_isw.cThu Aug 11 
16:57:02 2005
+++ src/regress/lib/libc/locale/check_isw/check_isw.c   Sun Nov 24 07:17:09 2013
@@ -19,9 +19,10 @@
  * functions.
  */
 
+#include ctype.h
 #include stdio.h
 #include stdlib.h
-#include ctype.h
+#include string.h
 #include wchar.h
 #include wctype.h
 
@@ -50,7 +51,7 @@
 {
int i;
 
-   for (i = 0; i  256; i++) {
+   for (i = 0; i  128; i++) {
printf( %02x: , i);
check_bool(isalnum(i), iswalnum(i), '1');
check_bool(isalpha(i), iswalpha(i), '2');
@@ -69,7 +70,7 @@
if (i % 8 == 7)
printf(\n);
}
-   printf(%\n);
+   printf(\n);
 }
 
 void
@@ -82,7 +83,7 @@
wchar_t c, d;
mbstate_t state;
 
-   s = malloc(256);
+   s = malloc(128);
if (!s) {
bad++;
return;
@@ -93,14 +94,15 @@
free(s);
return;
}
-   for (i = 0; i  256; i++)
+   for (i = 0; i  127; i++)
s[i] = i+1;
 
j = 0;
+   memset(state, 0, sizeof(state));
mbrtowc(NULL, NULL, 1, state);
printf( %02x: , 0);
 
-   while ((n = mbrtowc(c, s+j, 256-j, state)) == 1) {
+   while (j  127  (n = mbrtowc(c, s+j, 256-j, state)) == 1) {
printf( %02x: , s[j]);
check_bool(isalnum(s[j]), iswalnum(c), '1');
check_bool(isalpha(s[j]), iswalpha(c), '2');
@@ -130,7 +132,7

LC_MONETARY 3: regression test

2013-11-20 Thread Vladimir Támara Patiño

Tests for POSIX, en_US and spanish speaking countries.

--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html

diff -ruN -x *~ -x obj -x *orig src55-orig/regress/lib/libc/locale/Makefile 
src55-mon/regress/lib/libc/locale/Makefile
--- src55-orig/regress/lib/libc/locale/Makefile Fri Oct 18 09:22:50 2013
+++ src55-mon/regress/lib/libc/locale/Makefile  Wed Nov 20 09:12:20 2013
@@ -1,7 +1,7 @@
 # $OpenBSD: Makefile,v 1.2 2013/08/01 21:26:30 kettenis Exp $
 
 .if defined(REGRESS_FULL)
-SUBDIR+= check_isw
+SUBDIR+= check_isw check_monetary
 .endif
 
 install:
diff -ruN -x *~ -x obj -x *orig 
src55-orig/regress/lib/libc/locale/check_monetary/Makefile 
src55-mon/regress/lib/libc/locale/check_monetary/Makefile
--- src55-orig/regress/lib/libc/locale/check_monetary/Makefile  Wed Dec 31 
19:00:00 1969
+++ src55-mon/regress/lib/libc/locale/check_monetary/Makefile   Tue Nov 19 
20:34:54 2013
@@ -0,0 +1,11 @@
+
+NOMAN=
+PROG=check_monetary
+
+CFLAGS=-g
+
+
+run-regress-check_monetary: ${PROG}
+   ./${PROG} /dev/null
+
+.include bsd.regress.mk
diff -ruN -x *~ -x obj -x *orig 
src55-orig/regress/lib/libc/locale/check_monetary/check_monetary.c 
src55-mon/regress/lib/libc/locale/check_monetary/check_monetary.c
--- src55-orig/regress/lib/libc/locale/check_monetary/check_monetary.c  Wed Dec 
31 19:00:00 1969
+++ src55-mon/regress/lib/libc/locale/check_monetary/check_monetary.c   Wed Nov 
20 09:08:21 2013
@@ -0,0 +1,574 @@
+/**
+ * Public domain according to Colombian Legislation. 
+ * http://www.pasosdejesus.org/dominio_publico_colombia.html
+ * 2013. vtam...@pasosdejesus.org
+ *
+ * $adJ$
+ */
+
+#include langinfo.h
+#include limits.h
+#include locale.h
+#include monetary.h
+#include stdio.h
+#include stdlib.h
+#include string.h
+#include wchar.h
+#include wctype.h
+
+int bad;
+
+#define p(t) printf(%s:\t ,#t); \
+   if (t) { \
+   printf(\x1b[38;5;2mOK\x1b[0m\n); \
+   } else { \
+   bad++; \
+   printf(\x1b[38;5;1mERROR\x1b[0m\n); \
+   }
+
+/** Adapted from lmonetary.c */
+void
+m_monetarydebug(struct lconv *p) {
+   printf( int_curr_symbol = %s\n
+   currency_symbol = %s\n
+   mon_decimal_point = %s\n
+   mon_thousands_sep = %s\n
+   mon_grouping[0] = %d\n
+   positive_sign = %s\n
+   negative_sign = %s\n
+   int_frac_digits = %d\n
+   frac_digits = %d\n
+   p_cs_precedes = %d\n
+   p_sep_by_space = %d\n
+   n_cs_precedes = %d\n
+   n_sep_by_space = %d\n
+   p_sign_posn = %d\n
+   n_sign_posn = %d\n,
+   p-int_curr_symbol,
+   p-currency_symbol,
+   p-mon_decimal_point,
+   p-mon_thousands_sep,
+   p-mon_grouping[0],
+   p-positive_sign,
+   p-negative_sign,
+   p-int_frac_digits,
+   p-frac_digits,
+   p-p_cs_precedes,
+   p-p_sep_by_space,
+   p-n_cs_precedes,
+   p-n_sep_by_space,
+   p-p_sign_posn,
+   p-n_sign_posn
+   );
+   printf( \n\n
+   int_p_cs_precedes = %d\n
+   int_p_sep_by_space = %d\n
+   int_n_cs_precedes = %d\n
+   int_n_sep_by_space = %d\n
+   int_p_sign_posn = %d\n
+   int_n_sign_posn = %d\n,
+   p-int_p_cs_precedes,
+   p-int_p_sep_by_space,
+   p-int_n_cs_precedes,
+   p-int_n_sep_by_space,
+   p-int_p_sign_posn,
+   p-int_n_sign_posn
+   );
+}
+
+void test_posix()
+{
+   char *nl = setlocale(LC_ALL, POSIX);
+   printf(locale %s\n, nl);
+   struct lconv *p = localeconv();
+   char col[512];
+
+   // Values from 
http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html#tag_07_03
+   p(strcmp(p-int_curr_symbol, ) == 0);
+   p(strcmp(p-currency_symbol, ) == 0);
+   p(strcmp(p-mon_decimal_point, ) == 0);
+   p(strcmp(p-mon_thousands_sep, ) == 0);
+   // there is like inconsistency in 
http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html#tag_07_03
 
+   // Since in the locale definition it shows mon_grouping -1 for POSIX
+   // locale
+   // But in the table below it shows  as the return value for
+   // localeconv
+   p(p-mon_grouping[0] == '\0');
+   p(strcmp(p-positive_sign, ) == 0);
+   p(strcmp(p-negative_sign, ) == 0);
+   p(p-int_frac_digits == CHAR_MAX);
+   p(p-frac_digits == CHAR_MAX);
+   p(p-p_cs_precedes == CHAR_MAX);
+   p(p-p_sep_by_space == CHAR_MAX);
+   p(p-n_cs_precedes == CHAR_MAX);
+   p(p-n_sep_by_space == CHAR_MAX);
+   p(p-p_sign_posn == CHAR_MAX);
+   p(p-n_sign_posn == CHAR_MAX);
+   p

Updating localeconv to C99

2013-11-11 Thread Vladimir Támara Patiño

The patch extends the structure lconv returned by localeconv(3)
by including fields added in C99, see:
http://pubs.opengroup.org/onlinepubs/009695399/functions/localeconv.html

--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html

diff -ruN -x obj -x CVS -x *~ -x *orig src55-orig/include/locale.h 
src/include/locale.h
--- src55-orig/include/locale.h Wed Jul 20 13:24:25 2011
+++ src/include/locale.hMon Nov 11 10:44:44 2013
@@ -29,7 +29,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * @(#)locale.h5.2 (Berkeley) 2/24/91
+ * @(#)locale.h8.1 (Berkeley) 6/2/93
  */
 
 #ifndef _LOCALE_H_
@@ -54,6 +54,12 @@
charn_sep_by_space;
charp_sign_posn;
charn_sign_posn;
+   charint_p_cs_precedes;
+   charint_n_cs_precedes;
+   charint_p_sep_by_space;
+   charint_n_sep_by_space;
+   charint_p_sign_posn;
+   charint_n_sign_posn;
 };
 
 #ifndef NULL
diff -ruN -x obj -x CVS -x *~ -x *orig src55-orig/lib/libc/locale/localeconv.c 
src/lib/libc/locale/localeconv.c
--- src55-orig/lib/libc/locale/localeconv.c Mon Aug  8 03:05:35 2005
+++ src/lib/libc/locale/localeconv.cMon Nov 11 11:24:36 2013
@@ -29,13 +29,13 @@
 
 if (__mlocale_changed) {
/* LC_MONETARY */
-   ret.int_curr_symbol = _CurrentMonetaryLocale-int_curr_symbol;
-   ret.currency_symbol = _CurrentMonetaryLocale-currency_symbol;
-   ret.mon_decimal_point   = _CurrentMonetaryLocale-mon_decimal_point;
-   ret.mon_thousands_sep   = _CurrentMonetaryLocale-mon_thousands_sep;
-   ret.mon_grouping= _CurrentMonetaryLocale-mon_grouping;
-   ret.positive_sign   = _CurrentMonetaryLocale-positive_sign;
-   ret.negative_sign   = _CurrentMonetaryLocale-negative_sign;
+   ret.int_curr_symbol = (char 
*)_CurrentMonetaryLocale-int_curr_symbol;
+   ret.currency_symbol = (char 
*)_CurrentMonetaryLocale-currency_symbol;
+   ret.mon_decimal_point   = (char 
*)_CurrentMonetaryLocale-mon_decimal_point;
+   ret.mon_thousands_sep   = (char 
*)_CurrentMonetaryLocale-mon_thousands_sep;
+   ret.mon_grouping= (char *)_CurrentMonetaryLocale-mon_grouping;
+   ret.positive_sign   = (char *)_CurrentMonetaryLocale-positive_sign;
+   ret.negative_sign   = (char *)_CurrentMonetaryLocale-negative_sign;
ret.int_frac_digits = _CurrentMonetaryLocale-int_frac_digits;
ret.frac_digits = _CurrentMonetaryLocale-frac_digits;
ret.p_cs_precedes   = _CurrentMonetaryLocale-p_cs_precedes;
@@ -44,6 +44,13 @@
ret.n_sep_by_space  = _CurrentMonetaryLocale-n_sep_by_space;
ret.p_sign_posn = _CurrentMonetaryLocale-p_sign_posn;
ret.n_sign_posn = _CurrentMonetaryLocale-n_sign_posn;
+   ret.int_p_cs_precedes   = _CurrentMonetaryLocale-int_p_cs_precedes;
+   ret.int_n_cs_precedes   = _CurrentMonetaryLocale-int_n_cs_precedes;
+   ret.int_p_sep_by_space  = _CurrentMonetaryLocale-int_p_sep_by_space;
+   ret.int_n_sep_by_space  = _CurrentMonetaryLocale-int_n_sep_by_space;
+   ret.int_p_sign_posn = _CurrentMonetaryLocale-int_p_sign_posn;
+   ret.int_n_sign_posn = _CurrentMonetaryLocale-int_n_sign_posn;
+
__mlocale_changed = 0;
 }


diff -u src55-orig/lib/libc/locale/setlocale.3 src/lib/libc/locale/setlocale.3
--- src55-orig/lib/libc/locale/setlocale.3  Sun Oct  6 20:04:49 2013
+++ src/lib/libc/locale/setlocale.3 Mon Nov 11 17:18:06 2013
@@ -150,6 +150,12 @@
charn_sep_by_space;
charp_sign_posn;
charn_sign_posn;
+   charint_p_cs_precedes;
+   charint_n_cs_precedes;
+   charint_p_sep_by_space;
+   charint_n_sep_by_space;
+   charint_p_sign_posn;
+   charint_n_sign_posn;
 };
 .Ed
 .Pp
@@ -236,6 +242,38 @@
 Like
 .Fa p_sign_posn
 but for negative currency values.
+.It Fa int_p_cs_precedes
+1 if the
+.Fa int_curr_symbol
+precedes the currency value for non-negative values, 0 if it follows.
+.It Fa int_n_cs_precedes
+1 if the
+.Fa int_curr_symbol
+precedes the currency value for negative values, 0 if it follows.
+.It Fa int_p_sep_by_space
+Indicates separation between currency symbol, sign string and quantity
+for non-negative quantities.
+.Pp
+.Bl -tag -width 3n -compact
+.It Li 0
+No space between currency symbol and quantity.
+.It Li 1
+When currency symbol and sign string are adjacent, space between them and the 
quantity.  When currency symbol and sign string are not adjacent, space between 
currency symbol and quantity.
+.It Li 2
+When currency symbol and sign string are adjacent, space between them and the 
quantity.  When currency symbol and sign string are not adjacent, space between 
sign string and quantity.
+.El
+.It Fa

LC_NUMERIC 1: in libc

2013-11-11 Thread Vladimir Támara Patiño

In the attached patch is an implementation of LC_NUMERIC in libc
(adapted from FreeBSD).   Big portion of it, is change to the
function __vfprintf to support the flag ' (See
http://pubs.opengroup.org/onlinepubs/95399/functions/printf.html )

The function __category_filename in ldpart.c tries to follow setrunelocale 
of minimizing directories in /usr/share/locale  (I think possible to

call it from setrunelocale).

--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html

diff -ruN -x obj -x CVS -x *~ -x *orig src55-orig/lib/libc/locale/Makefile.inc 
src/lib/libc/locale/Makefile.inc
--- src55-orig/lib/libc/locale/Makefile.inc Fri Oct 18 09:22:17 2013
+++ src/lib/libc/locale/Makefile.incMon Nov 11 12:07:40 2013
@@ -6,7 +6,8 @@
 # for LOCALECHARSETS
 .include ${.CURDIR}/../../share/locale/ctype/Makefile.inc
 
-SRCS+= btowc.c _def_messages.c _def_monetary.c _def_numeric.c _def_time.c \
+SRCS+= btowc.c _def_messages.c _def_monetary.c _def_time.c \
+   fix_grouping.c ldpart.c lnumeric.c \
localeconv.c nl_langinfo.c setlocale.c iswctype.c __mb_cur_max.c \
mblen.c mbrlen.c mbstowcs.c mbtowc.c multibyte_citrus.c wcscoll.c \
wcstombs.c wctob.c wctomb.c wcstof.c wcstod.c wcstold.c wcstol.c \
diff -ruN -x obj -x CVS -x *~ -x *orig 
src55-orig/lib/libc/locale/_def_numeric.c src/lib/libc/locale/_def_numeric.c
--- src55-orig/lib/libc/locale/_def_numeric.c   Mon Aug  8 03:05:35 2005
+++ src/lib/libc/locale/_def_numeric.c  Wed Dec 31 19:00:00 1969
@@ -1,17 +0,0 @@
-/* $OpenBSD: _def_numeric.c,v 1.4 2005/08/08 08:05:35 espie Exp $ */
-/*
- * Written by J.T. Conklin j...@netbsd.org.
- * Public domain.
- */
-
-#include sys/localedef.h
-#include locale.h
-
-const _NumericLocale _DefaultNumericLocale =
-{
-   .,
-   ,
-   
-};
-
-const _NumericLocale *_CurrentNumericLocale = _DefaultNumericLocale;
diff -ruN -x obj -x CVS -x *~ -x *orig 
src55-orig/lib/libc/locale/fix_grouping.c src/lib/libc/locale/fix_grouping.c
--- src55-orig/lib/libc/locale/fix_grouping.c   Wed Dec 31 19:00:00 1969
+++ src/lib/libc/locale/fix_grouping.c  Mon Nov 11 11:54:09 2013
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2001 Alexey Zelkin phan...@freebsd.org
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+
+#include ctype.h
+#include limits.h
+#include stddef.h
+
+static const char nogrouping[] = { CHAR_MAX, '\0' };
+
+/*
+ * Internal helper used to convert grouping sequences from string
+ * representation into POSIX specified form, i.e.
+ *
+ * 3;3;-1 - \003\003\177\000
+ */
+
+const char *
+__fix_locale_grouping_str(const char *str)
+{
+   char *src, *dst;
+   char n;
+
+   if (str == NULL || *str == '\0') {
+   return nogrouping;
+   }
+
+   for (src = (char*)str, dst = (char*)str; *src != '\0'; src++) {
+
+   /* input string examples: 3;3, 3;2;-1 */
+   if (*src == ';')
+   continue;
+   
+   if (*src == '-'  *(src+1) == '1') {
+   *dst++ = CHAR_MAX;
+   src++;
+   continue;
+   }
+
+   if (!isdigit((unsigned char)*src)) {
+   /* broken grouping string */
+   return nogrouping;
+   }
+
+   /* assume all numbers = 99 */
+   n = *src - '0';
+   if (isdigit((unsigned char)*(src+1))) {
+   src++;
+   n *= 10;
+   n += *src - '0';
+   }
+
+   *dst = n

LC_NUMERIC 2: locales

2013-11-11 Thread Vladimir Támara Patiño

Most of the attached numeric locales come from FreeBSD, I didn't include
others with encodings that I don't see in /usr/share/locale (like 
eucJP, eucCN, eucKR, PT154, ISCII-DEV, CP1131, CP866, CP949, Big5,

Big5HKSCS, GB18030, GB2312, GBK, SJIS).

Again tried to minimize space of /usr/share/locale with:
1. Default numeric locale for lang_territory.encoding in 
  /usr/share/locale/language.encoding
2. Exceptions for some territories in  
  /usr/share/locale/language_territory.encoding and if necessesary

  links to it from others


--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html

diff -ruN -x *out -x *orig -x obj -x *~ src55-orig/share/locale/Makefile 
src/share/locale/Makefile
--- src55-orig/share/locale/MakefileSun Jun  2 16:05:47 2013
+++ src/share/locale/Makefile   Tue Nov 12 01:18:01 2013
@@ -1,6 +1,6 @@
 #  $OpenBSD: Makefile,v 1.1 2005/08/07 10:03:44 espie Exp $
 
-SUBDIR=ctype
+SUBDIR=ctype numericdef

 
 .include bsd.subdir.mk
diff -ruN -x *out -x *orig -x obj -x *~ 
src55-orig/share/locale/numericdef/Makefile src/share/locale/numericdef/Makefile
--- src55-orig/share/locale/numericdef/Makefile Wed Dec 31 19:00:00 1969
+++ src/share/locale/numericdef/MakefileTue Nov 12 01:47:50 2013
@@ -0,0 +1,150 @@
+# Adapted from FreeBSD
+
+LOCALES=   af.ISO8859-1 \
+   am.UTF-8 \
+   be.CP1251 \
+   bg.CP1251 \
+   ca.ISO8859-1 \
+   cs.ISO8859-2 \
+   da.ISO8859-1 \
+   de_CH.ISO8859-1 \
+   de.ISO8859-1 \
+   el.ISO8859-7 \
+   en.ISO8859-1 \
+   es.ISO8859-1 \
+   es_PR.ISO8859-1 \
+   et.ISO8859-15 \
+   eu.ISO8859-1 \
+   fi.ISO8859-1 \
+   fr_BE.ISO8859-1 \
+   fr.ISO8859-1 \
+   hr.ISO8859-2 \
+   hu.ISO8859-2 \
+   hy.ARMSCII-8 \
+   is.ISO8859-1 \
+   it.ISO8859-1 \
+   lt.ISO8859-13 \
+   mn.UTF-8 \
+   nl.ISO8859-1 \
+   no.ISO8859-1 \
+   pl.ISO8859-2 \
+   pt_BR.ISO8859-1 \
+   pt.ISO8859-1 \
+   ro.ISO8859-2 \
+   ru.KOI8-R \
+   sk.ISO8859-2 \
+   sl.ISO8859-2 \
+   sr.ISO8859-2 \
+   sr.ISO8859-5 \
+   sv.ISO8859-1 \
+   tr.ISO8859-9 \
+   uk.KOI8-U
+
+LOCALEDIR= /usr/share/locale
+
+.SUFFIXES: .src .out
+
+.src.out:
+   grep -v '^#'  ${.IMPSRC}  ${.TARGET}
+
+FILES= ${LOCALES:S/$/.out/}
+FILESNAME= LC_NUMERIC
+
+all: ${FILES}
+
+.for locale in ${LOCALES}
+FILESDIR_${locale}.out= ${LOCALEDIR}/${locale}
+.endfor
+
+CLEANFILES=${FILES}
+
+ENCODINGS= ARMSCII-8  \
+   CP1251 CP866 \
+   ISO8859-1 ISO8859-2 ISO8859-4 ISO8859-5 ISO8859-7 ISO8859-9 \
+   ISO8859-13 ISO8859-15 \
+   KOI8-R KOI8-U US-ASCII UTF-8
+
+BE_LINKS=  fr_BE:nl_BE
+NO_LINKS=  no:nb_NO no:nn_NO
+ESPR_LINKS=es_PR:es_CR es_PR:es_MX es_PR:es_SV es_PR:es_US 
+
+ARMSCII-8_UTF-8= hy
+CP1251_ISO8859-5= be
+CP1251_UTF-8=  be bg
+CP866_UTF-8=   ru
+ISO8859-1_ISO8859-15= af ca da de_CH de en es es_PR eu \
+   fi fr_BE fr is it nl no pt_BR pt sv \
+   ${BE_LINKS} ${NO_LINKS} ${ESPR_LINKS}
+ISO8859-1_ISO8859-1= ${BE_LINKS} ${CA_LINKS} \
+   ${NO_LINKS} ${ESPR_LINKS}
+ISO8859-1_UTF-8= af ca da de_CH de en es es_PR eu fi fr \
+   fr_BE fr is it nl no pt_BR pt sv
+ISO8859-2_UTF-8= cs hr hu pl ro sk sl
+ISO8859-5_UTF-8= sr uk
+ISO8859-5_CP1251= uk
+ISO8859-7_UTF-8= el
+ISO8859-9_UTF-8= tr
+ISO8859-13_ISO8859-4= lt
+ISO8859-13_ISO8859-13= lt:lv
+ISO8859-13_UTF-8= lt lt:lv
+ISO8859-15_UTF-8= et
+KOI8-R_CP1251= ru
+KOI8-R_CP866=  ru
+KOI8-R_ISO8859-5= ru
+KOI8-U_ISO8859-5= uk
+US-ASCII_UTF-8=en:he
+UTF-8_UTF-8=   ${BE_LINKS} ${CA_LINKS} de \
+   ${NO_LINKS} ${ESPR_LINKS}
+
+SYMLINKS=
+.for enc1 in ${ENCODINGS}
+.for enc2 in ${ENCODINGS}
+.for lang_terr in ${${enc1}_${enc2}}
+SYMLINKS+= ../${lang_terr:C/:.*$//}.${enc1}/${FILESNAME} \
+   ${LOCALEDIR}/${lang_terr:C/^.*://}.${enc2}
+.endfor
+.endfor
+.endfor
+
+install:
+.for locale in ${LOCALES}
+   install -o ${LOCALEOWN} -g ${LOCALEGRP} -m ${DIRMODE} -d \
+   ${DESTDIR}${FILESDIR_${locale}.out}
+   install -o ${LOCALEOWN} -g ${LOCALEGRP} -m ${LOCALEMODE} \
+   ${locale}.out ${DESTDIR}/${FILESDIR_${locale}.out}/${FILESNAME}
+.endfor
+.for lnk file in ${SYMLINKS}
+   @l=${DESTDIR}${lnk}; \
+t=${DESTDIR}${file}; \
+echo $$t -\ $$l; \
+rm -f $$t/${FILESNAME}; mkdir -p $$t; ln -s $$l $$t
+.endfor
+
+uninstall:
+.for locale in ${LOCALES}
+   if (test -f ${DESTDIR}${LOCALEDIR}/${locale}/${FILESNAME}) then { \
+   rm -f ${DESTDIR

LC_NUMERIC 3: regression test

2013-11-11 Thread Vladimir Támara Patiño

Test attached, better to test with more countries.

--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html

diff -u src55-orig/regress/lib/libc/locale/Makefile 
src/regress/lib/libc/locale/Makefile
--- src55-orig/regress/lib/libc/locale/Makefile Fri Oct 18 09:22:50 2013
+++ src/regress/lib/libc/locale/MakefileMon Nov 11 15:25:35 2013
@@ -1,7 +1,7 @@
 # $OpenBSD: Makefile,v 1.2 2013/08/01 21:26:30 kettenis Exp $
 
 .if defined(REGRESS_FULL)
-SUBDIR+= check_isw
+SUBDIR+= check_isw check_numeric
 .endif
 
 install:
diff -ruN -x obj -x CVS -x *~ -x *orig 
src55-orig/regress/lib/libc/locale/check_numeric/Makefile 
src/regress/lib/libc/locale/check_numeric/Makefile
--- src55-orig/regress/lib/libc/locale/check_numeric/Makefile   Wed Dec 31 
19:00:00 1969
+++ src/regress/lib/libc/locale/check_numeric/Makefile  Mon Nov 11 12:01:52 2013
@@ -0,0 +1,11 @@
+
+NOMAN=
+PROG=check_numeric
+
+CFLAGS=-g
+
+
+run-regress-check_numeric: ${PROG}
+   ./${PROG} /dev/null
+
+.include bsd.regress.mk
diff -ruN -x obj -x CVS -x *~ -x *orig 
src55-orig/regress/lib/libc/locale/check_numeric/check_numeric.c 
src/regress/lib/libc/locale/check_numeric/check_numeric.c
--- src55-orig/regress/lib/libc/locale/check_numeric/check_numeric.cWed Dec 
31 19:00:00 1969
+++ src/regress/lib/libc/locale/check_numeric/check_numeric.c   Mon Nov 11 
12:01:52 2013
@@ -0,0 +1,159 @@
+/**
+ * Public domain according to Colombian Legislation. 
+ * http://www.pasosdejesus.org/dominio_publico_colombia.html
+ * 2013. vtam...@pasosdejesus.org
+ *
+ * $adJ$
+ */
+
+#include langinfo.h
+#include locale.h
+#include stdio.h
+#include stdlib.h
+#include string.h
+
+int bad;
+
+#define p(t) printf(%s:\t ,#t); \
+   if (t) { \
+   printf(\x1b[38;5;2mOK\x1b[0m\n); \
+   } else { \
+   bad++; \
+   printf(\x1b[38;5;1mERROR\x1b[0m\n); \
+   }
+
+/** Function adapted from lnumeric.c */
+void
+m_numericdebug(struct lconv *p) {
+   printf( decimal_point = %s\n
+   thousands_sep = %s\n
+   grouping = %d\n,
+   p-decimal_point,
+   p-thousands_sep,
+   p-grouping[0]
+ );
+}
+
+void test_posix()
+{
+   char nom[256];
+   char col[512];
+   char *nl;
+   char *enc[]= { ISO8859-1, ISO8859-15, UTF-8 };
+   struct lconv *p;
+   int i;
+   for(i = 0; i  sizeof(enc) / sizeof(char *) ; i++) {
+   snprintf(nom, sizeof(nom), POSIX.%s, enc[i]);
+   printf(nom=%s\n, nom);
+   nl = setlocale(LC_ALL, nom);
+   printf(locale %s\n, nl);
+   p = localeconv();
+
+   m_numericdebug(p);
+   p(strcmp(p-decimal_point, .) == 0);
+   p(strcmp(p-thousands_sep, ) == 0);
+   p(p-grouping[0] == 127);
+
+   snprintf(col, sizeof(col), %f, 100.01);
+   p(strcmp(col, 100.01) == 0);
+   snprintf(col, sizeof(col), %'d, 100);
+   printf(col=%s\n, col);
+   p(strcmp(col, 100) == 0);
+   snprintf(col, sizeof(col), %'f, 100.01);
+   printf(col=%s\n, col);
+   p(strcmp(col, 100.01) == 0);
+   p(strcmp(nl_langinfo(RADIXCHAR), .) == 0);
+   p(strcmp(nl_langinfo(THOUSEP), ) == 0);
+   }
+}
+
+// Locales where radix symbol is command, and there is grouping
+// of thousands separated by dot
+// Not sure if any of es_CR, es_MX, es_PR, es_SV should be here
+// http://es.wikipedia.org/wiki/Separador_decimal#cite_note-ref_duplicada_1-3
+void test_radixcomma_thousandsdot()
+{
+   char *c[] = { 
+   es_AR, es_BO, es_CL, es_CO, es_DO, es_EC, 
+   es_ES, es_GT, es_HN, es_NI, es_PA, es_PE, 
+   es_PY, es_UY, es_VE, pt_BR
+   };
+   char *enc[]= { ISO8859-1, ISO8859-15, UTF-8 };
+   struct lconv *p;
+   char nom[256];
+   char col[512];
+   char *nl;
+   int i, j;
+
+   for(i = 0; i  sizeof(enc) / sizeof(char *) ; i++) {
+   for(j = 0; j  sizeof(c) / sizeof(char *) ; j++) {
+   snprintf(nom, sizeof(nom), %s.%s, c[j], enc[i]);
+   printf(nom=%s\n, nom);
+   nl = setlocale(LC_ALL, nom);
+   printf(locale %s\n, nl);
+   p = localeconv();
+
+   p(strcmp(p-decimal_point, ,) == 0);
+   p(strcmp(p-thousands_sep, .) == 0);
+   p(p-grouping[0] == 3);
+
+   snprintf(col, sizeof(col), %f, 100.01);
+   p(strcmp(col, 100,01) == 0);
+   snprintf(col, sizeof(col), %'d, 100);
+   printf(col=%s\n, col);
+   p(strcmp(col

About LC_NUMERIC and updated fix for regress/lib/libc/locale/check_isw

2013-11-10 Thread Vladimir Támara Patiño

I want to send support for LC_NUMERIC adapted from FreeBSD. Will try to
do it in small diffs in several emails.  


Before that, I prefer to send first patch with an updated fix for
regress/lib/libc/locale/check_isw, the commentaries of
http://openbsd.7691.n7.nabble.com/Fix-for-regress-lib-libc-locale-check-isw-td225266.html
still apply.

Second patch are additional cases.

--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html

diff -ruN src55-orig/regress/lib/libc/locale/check_isw/check_isw.c 
src/regress/lib/libc/locale/check_isw/check_isw.c
--- src55-orig/regress/lib/libc/locale/check_isw/check_isw.cThu Aug 11 
16:57:02 2005
+++ src/regress/lib/libc/locale/check_isw/check_isw.c   Sun Nov 10 07:22:38 2013
@@ -19,9 +19,10 @@
  * functions.
  */
 
+#include ctype.h
 #include stdio.h
 #include stdlib.h
-#include ctype.h
+#include string.h
 #include wchar.h
 #include wctype.h
 
@@ -50,7 +51,7 @@
 {
int i;
 
-   for (i = 0; i  256; i++) {
+   for (i = 0; i  128; i++) {
printf( %02x: , i);
check_bool(isalnum(i), iswalnum(i), '1');
check_bool(isalpha(i), iswalpha(i), '2');
@@ -69,7 +70,7 @@
if (i % 8 == 7)
printf(\n);
}
-   printf(%\n);
+   printf(\n);
 }
 
 void
@@ -82,7 +83,7 @@
wchar_t c, d;
mbstate_t state;
 
-   s = malloc(256);
+   s = malloc(128);
if (!s) {
bad++;
return;
@@ -93,14 +94,15 @@
free(s);
return;
}
-   for (i = 0; i  256; i++)
+   for (i = 0; i  127; i++)
s[i] = i+1;
 
j = 0;
+   memset(state, 0, sizeof(state));
mbrtowc(NULL, NULL, 1, state);
printf( %02x: , 0);
 
-   while ((n = mbrtowc(c, s+j, 256-j, state)) == 1) {
+   while (j  127  (n = mbrtowc(c, s+j, 256-j, state)) == 1) {
printf( %02x: , s[j]);
check_bool(isalnum(s[j]), iswalnum(c), '1');
check_bool(isalpha(s[j]), iswalpha(c), '2');
@@ -129,9 +131,6 @@
if (s[j] % 8 == 7)
printf(\n);
j++;
-   }
-   if (n != 0 || j != 255) {
-   bad++;
}
free(s);
free(buf);

diff -ruN src55-p1/regress/lib/libc/locale/check_isw/check_isw.c 
src/regress/lib/libc/locale/check_isw/check_isw.c
--- src55-p1/regress/lib/libc/locale/check_isw/check_isw.c.orig Sun Nov 10 
07:31:25 2013
+++ src/regress/lib/libc/locale/check_isw/check_isw.c   Sun Nov 10 07:32:21 2013
@@ -20,6 +20,7 @@
  */
 
 #include ctype.h
+#include locale.h
 #include stdio.h
 #include stdlib.h
 #include string.h
@@ -28,6 +29,14 @@
 
 int bad = 0;
 
+#define p(t) printf(%s:\t ,#t); \
+   if (t) { \
+   printf(\x1b[38;5;2mOK\x1b[0m\n); \
+   } else { \
+   bad++; \
+   printf(\x1b[38;5;1mERROR\x1b[0m\n); \
+   }
+
 void
 check_bool(int v1, int v2, char msg)
 {
@@ -136,11 +145,87 @@
free(buf);
 }
 
+void
+test3()
+{
+   /** toupper, tolower single byte encoding */
+   char *nl = setlocale(LC_ALL, es_CO.ISO8859-1);
+   printf(locale %s\n, nl);
+   /* À - 0xc0, à - 0xe0 */
+   int c;
+   for(c = 0xc0; c  0xde; c++) {
+   if (c != 0xd7) { // 0xd7 - ×, 0xF7 - ÷
+   printf(c=%x , c);
+   p(tolower(c) == c+0x20); 
+   p(toupper(c+0x20) == c); 
+   }
+   }
+   /* http://en.wikipedia.org/w/index.php?title=ISO/IEC_8859-1 */
+   for (c = 0x21; c  0x2F; c++) {
+   printf(c=%x , c);
+   p(ispunct(c));
+   }
+   for (c = 0x30; c  0x39; c++) {
+   printf(c=%x , c);
+   p(isdigit(c));
+   }
+   for (c = 0x3A; c  0x40; c++) {
+   printf(c=%x , c);
+   p(ispunct(c));
+   }
+   for (c = 0x41; c  0x5A; c++) {
+   printf(c=%x , c);
+   p(isalpha(c));
+   p(isalpha(c+0x20));
+   }
+   for (c = 0x5B; c  0x60; c++) {
+   printf(c=%x , c);
+   p(ispunct(c));
+   }
+   p(ispunct(0x7B));
+   p(ispunct(0x7C));
+   p(ispunct(0x7D));
+   p(ispunct(0x7E));
+   for (c = 0xA1; c  0xBF; c++) {
+   printf(c=%x , c);
+   p(ispunct(c));
+   }
+   for (c = 0xC0; c  0xFF; c++) {
+   if (c != 0xD7  c != 0xF7) {
+   printf(c=%x , c);
+   p(isalpha(c));
+   }
+   }
+   
+   nl = setlocale(LC_ALL, ru_RU.KOI8-R);
+   printf(locale %s\n, nl);
+   /* a - 0xc0, A - 0xe0 */
+   for(c = 0xc0; c  0xdf; c++) {
+   printf(c=%x , c);
+   p(islower(c));
+   p(isupper(c+0x20));
+   p(toupper

Re: Kernel page fault in current

2013-10-24 Thread Vladimir Támara Patiño

You were right, after updating and recompiling kernel nor more page
fault.   Besides now I can move the windows smoothly (before they put
like lines while moving).  I also think in general faster X (I wonder
how to measure).

On Tue, Oct 22, 2013 at 10:53:36AM -0700, Philip Guenther wrote:

On Tue, Oct 22, 2013 at 5:21 AM, Vladimir Támara Patiño
vtam...@pasosdejesus.org wrote:
 Hi, I'm having problems with current, I'm using Xorg after some time there
 is a kernel trap (3 times I have seen the same one):

Current is a moving target, so saying current without a timestamp or
at least date isn't precise.  Indeed, there have been four commits to
the file holding wsdisplaypoll() since the Oct 18th.

So, refresh, rebuild, and see whether the most recent commits affect
it.  If it still happens, post a new trace, the date of your refresh,
AND THE DMESG THAT YOU LEFT OUT BEFORE.

Philip Guenther



--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html



Re: partial xlocale(3) port from FreeBSD

2013-10-23 Thread Vladimir Támara Patiño
+   __has_thread_locale = 1;


Here I added:

fake_tls = 1;

+
+static pthread_once_t once_control = PTHREAD_ONCE_INIT;
+/* Single threaded pthread_once(3).  libc won't have to -lpthread. */
+static int
+_once(pthread_once_t *o, void (*init_routine)(void))
+{
+   if (o-state == PTHREAD_DONE_INIT)
+   return (0);
+   init_routine();
+   o-state = PTHREAD_DONE_INIT;
+   return (0);
+}


I added this.   Thank you (what license does your patch have?).  


+   // XXX FreeBSD uses __xlocale_global_locale
+   return (l ? l : __xlocale_C_locale);


I also used __xlocale_global_localeo


Index: locale/xlocale_private.h
+/**
+ * Decrements the reference count of a reference-counted structure, freeing it
+ * if this is the last reference, calling its destructor if it has one.
+ */
+__attribute__((unused)) static void
+xlocale_release(void *val)
+{
+   struct xlocale_refcounted *obj = val;
+   long count = obj-retain_count--;
+   // XXX long count = atomic_fetchadd_long((obj-retain_count), -1) - 1;


Here I have
   obj-retain_count--;
   long count = obj-retain_count;

That I think is consistent with the implementation of atomic_fetchadd_long:
http://fxr.watson.org/fxr/source/ia64/include/atomic.h?im=excerpts#L379


Index: stdio/asprintf.c
Index: stdio/fscanf.c
Index: stdio/local.h
Index: stdio/scanf.c
Index: stdio/snprintf.c
Index: stdio/sprintf.c
Index: stdio/sscanf.c
Index: stdio/vasprintf.c
Index: stdio/vdprintf.c
Index: stdio/vfprintf.c
Index: stdio/vfscanf.c
Index: stdio/vsnprintf.c
Index: stdio/vsprintf.c
Index: stdio/vsscanf.c
Index: stdlib/strtoimax.c
Index: stdlib/strtol.c
Index: stdlib/strtoll.c
Index: stdlib/strtoul.c
Index: stdlib/strtoull.c
Index: stdlib/strtoumax.c


I didn't have these.


Index: string/wcscasecmp.c
I have wcsncasecmp_l 




Index: string/wcscmp.c
Index: string/wcsncmp.c
Index: string/wmemcmp.c


I didn't touch these


Index: time/strftime.c


I didn't have this one

Thank you, I updated my patches, and thanked you in commit message.
https://github.com/pasosdeJesus/adJ/commit/a5d66cd5bf2b814287cfc1bdc68e707cddf5ef17

I will be checking in detail new files you sent that I didn't have and
will try to add to my patches.


--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html



Kernel page fault in current

2013-10-22 Thread Vladimir Támara Patiño
Hi, I'm having problems with current, I'm using Xorg after some time there 
is a kernel trap (3 times I have seen the same one):


kernel: page fault trap, code=0
stopped at wsdisplaypoll+0x35 movq 0x60(%rdx, %rax, 8), %rax

Trace shows

wdisplaypoll() at wdisplaypoll+0x35
VOP_POLL() at VOP_POLL+0x2e
selscan() at selscan+0xec
dopselect() at dopselect+0x482
sys_select() at sys_select+0xaa
syscall() at syscall+0x249
--- syscall (number 71) ---
end of kernel
end trace frame: 0x7f, count: -6
0x8646ad8f2ca

show registers includes
rax 0x4
rdx 0x8000

Attaching my dmesg

Appreciate suggestions.
--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html

OpenBSD 5.4-current (GENERIC.MP) #73: Tue Oct 15 00:08:48 MDT 2013
dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
RTC BIOS diagnostic error 80clock_battery
real mem = 3986419712 (3801MB)
avail mem = 3872178176 (3692MB)
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.7 @ 0xe4800 (29 entries)
bios0: vendor Insyde Corp. version V1.03 date 04/11/2012
bios0: Acer Aspire E1-421
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP UEFI HPET APIC MCFG ASF! BOOT SLIC SPCR WDRT WDAT MSDM 
FPDT SSDT SSDT
acpi0: wakeup devices PB4_(S4) PB6_(S0) SPB0(S0) SPB1(S4) SPB2(S4) SPB3(S0) 
GEC_(S4) OHC1(S3) OHC2(S3) OHC3(S3) OHC4(S3) XHC0(S3) XHC1(S4) P2P_(S0)
acpitimer0 at acpi0: 3579545 Hz, 32 bits
acpihpet0 at acpi0: 14318180 Hz
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: AMD E-450 APU with Radeon(tm) HD Graphics, 1647.96 MHz
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,MWAIT,SSSE3,CX16,POPCNT,NXE,MMXX,FFXSR,LONG,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,IBS,SKINIT,ITSC
cpu0: 32KB 64b/line 2-way I-cache, 32KB 64b/line 8-way D-cache, 512KB 64b/line 
16-way L2 cache
cpu0: 8 4MB entries fully associative
cpu0: DTLB 40 4KB entries fully associative, 8 4MB entries fully associative
cpu0: smt 0, core 0, package 0
cpu0: apic clock running at 199MHz
cpu0: mwait min=64, max=64, C-substates=0.0.0.0.0, IBE
cpu1 at mainbus0: apid 1 (application processor)
cpu1: AMD E-450 APU with Radeon(tm) HD Graphics, 1647.01 MHz
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,MWAIT,SSSE3,CX16,POPCNT,NXE,MMXX,FFXSR,LONG,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,IBS,SKINIT,ITSC
cpu1: 32KB 64b/line 2-way I-cache, 32KB 64b/line 8-way D-cache, 512KB 64b/line 
16-way L2 cache
cpu1: 8 4MB entries fully associative
cpu1: DTLB 40 4KB entries fully associative, 8 4MB entries fully associative
cpu1: smt 0, core 1, package 0
ioapic0 at mainbus0: apid 4 pa 0xfec0, version 21, 24 pins
ioapic0: misconfigured as apic 0, remapped to apid 4
acpimcfg0 at acpi0 addr 0xf800, bus 0-63
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (PB4_)
acpiprt2 at acpi0: bus 2 (PB5_)
acpiprt3 at acpi0: bus -1 (PB6_)
acpiprt4 at acpi0: bus -1 (PB7_)
acpiprt5 at acpi0: bus -1 (SPB0)
acpiprt6 at acpi0: bus -1 (SPB1)
acpiprt7 at acpi0: bus -1 (SPB2)
acpiprt8 at acpi0: bus -1 (SPB3)
acpiprt9 at acpi0: bus 3 (P2P_)
acpiec0 at acpi0
acpicpu0 at acpi0: C2, PSS
acpicpu1 at acpi0: C2, PSS
acpitz0 at acpi0: critical temperature is 100 degC
acpibtn0 at acpi0: PWRB
acpibtn1 at acpi0: SLPB
acpiac0 at acpi0: AC unit online
acpibat0 at acpi0: BAT1 model AS10D71 serial 2179 type LION oem PANASONIC
acpibtn2 at acpi0: LID_
acpivideo0 at acpi0: VGA_
acpivout0 at acpivideo0: LCD_
cpu0: 1647 MHz: speeds: 1650 1320 825 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 AMD AMD64 14h Host rev 0x00
radeondrm0 at pci0 dev 1 function 0 ATI Radeon HD 6320 rev 0x00: apic 4 int 18
drm0 at radeondrm0
azalia0 at pci0 dev 1 function 1 ATI Radeon HD 6310 HD Audio rev 0x00: msi
azalia0: no supported codecs
ppb0 at pci0 dev 4 function 0 AMD AMD64 14h PCIE rev 0x00: msi
pci1 at ppb0 bus 1
alc0 at pci1 dev 0 function 0 Attansic Technology L1D rev 0xc0: msi, address 
04:7d:7b:9a:cb:a1
atphy0 at alc0 phy 0: F1 10/100/1000 PHY, rev. 0
ppb1 at pci0 dev 5 function 0 AMD AMD64 14h PCIE rev 0x00: msi
pci2 at ppb1 bus 2
Atheros AR9485 rev 0x01 at pci2 dev 0 function 0 not configured
AMD Hudson-2 xHCI rev 0x03 at pci0 dev 16 function 0 not configured
ahci0 at pci0 dev 17 function 0 AMD Hudson-2 SATA rev 0x00: msi, AHCI 1.3
scsibus0 at ahci0: 32 targets
sd0 at scsibus0 targ 0 lun 0: ATA, WDC WD5000BPVT-2, 01.0 SCSI3 0/direct 
fixed naa.50014ee602551702
sd0: 476940MB, 512 bytes/sector, 976773168 sectors
cd0 at scsibus0 targ 1 lun 0: Slimtype, DVD A DS8A8SH, KA14 ATAPI 5/cdrom 
removable
ohci0 at pci0 dev 18 function 0 AMD Hudson-2 USB rev 0x11: apic 4 int 18, 
version 1.0, legacy support
ehci0 at pci0 dev 18 function 2 AMD Hudson-2 USB2 rev 0x11: apic 4 int 17
usb0 at ehci0: USB revision 2.0

Re: partial xlocale(3) port from FreeBSD

2013-10-21 Thread Vladimir Támara Patiño

On Mon, Oct 21, 2013 at 02:14:32PM +0200, Martin Pelikan wrote:

 Indeed, doing collation properly (i.e. with Unicode, not just 8 bit
 characters like FreeBSD does) really is a non-trivial effort.
 
 It requires some expertise in linguistics and a solid understanding

 of the unicode standard. You'd need to make use of something like ICU
 (icu-project.org) to keep your sanity, or implement a whole lot of
 that code base yourself...

Unfortunately, that requires support in the 3rd party software itself.


Anyway, I updated to current the 8 bit collation support from FreeBSD I had 
sent in in March and that was reviewed by Stephan in the previous Hackathon:

https://github.com/pasosdeJesus/adJ/blob/OBSD_CURRENT/arboldes/usr/src/03-cotejacion.patch

Also updated the xlocale patch, also based in FreeBSD that I sent in
February:
https://github.com/pasosdeJesus/adJ/blob/OBSD_CURRENT/arboldes/usr/src/04-xlocale-wchar.patch
https://github.com/pasosdeJesus/adJ/blob/OBSD_CURRENT/arboldes/usr/src/05-xlocale-ctype.patch
https://github.com/pasosdeJesus/adJ/blob/OBSD_CURRENT/arboldes/usr/src/06-xlocale-str.patch

And also updated patch for regress/lib/libc/locale/check_isw sent in
March:
https://github.com/pasosdeJesus/adJ/blob/OBSD_CURRENT/arboldes/usr/src/01-check_isw.patch

I want to compare in detail with the implementation that Martin sent,
few differences I see:

* I changed the sources in order to avoid runetype.h in /usr/include
* Martin implemented some pieces that I have not (e.g strtorx_l), I want to 
 merge in what I have



 If we bother with collation I think we should try to do better.


I agree full Unicode support is desirable, but IMHO having 8 bits collation 
is better than nothing (for example withouth it spanish speakers have to

see ñ, á and other special symbols at the end of sorted results in
programs that support collations like PostgreSQL).


 The shim is going to be a lot less work, and doesn't preclude an
 implentation inside libc at a later stage.

Thanks for showing the right direction.  I'll look into it as soon as
I have more time; at least I know what is needed and how big is it.


Since xlocale is part of POSIX shouldn't we try to include that faster
in libc?

I think xlocale additions to POSIX were included in the Open Group Technical
Standard, 2006, Extended API Set Part 4.  That is what I understand
of the documentation of xlocale functions like strcoll_l, see bottom of:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/strcoll.html

However if Martin prefers to make a new library for this, hope the patches I
sent can be useful.

--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html



Re: switch /usr/share/locale to different layout

2013-05-31 Thread Vladimir Támara Patiño

On Thu, May 30, 2013 at 10:05:45PM +0200, Stefan Sperling wrote:

Does anyone see problems with this plan?


Sounds good.  


I agree with Andres, that a structure should be required for the locale
name, I guess fine starting with C, POSIX, C.encoding, POSIX.encoding, 
ll.encoding or ll_CC.encoding, with CC according to ISO 3166-1 alfa-2,

and ll according to ISO 639-1.

Although POSIX doesn't impose structure on the locale names, neither in
the directory structure, besides order, in my humble opinion it could make 
in future easier the implemenation of localedef (

http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html ).
to be able to put in the correct directory each part.

--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html



Links for LC_CTYPE in /usr/share/locale

2013-05-15 Thread Vladimir Támara Patiño

Attached.  Related to thread:
http://thread.gmane.org/gmane.os.openbsd.tech/31923

--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html

Index: Makefile
===
RCS file: /cvs/src/share/locale/ctype/Makefile,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile
--- Makefile16 Jul 2011 21:33:30 -  1.6
+++ Makefile15 May 2013 21:12:50 -
@@ -293,7 +293,6 @@ LOCALESRCS+=${LOCALESRC_${locale}}
 .endfor
 CLEANFILES+=   ${LOCALES:S/$/.out/g}
 
-# TODO: more use of symlinks?
 FILES= ${LOCALES:S/$/.out/g}
 .for locale in ${LOCALES}
 FILESDIR_${locale}.out=${LOCALEDIR}/${locale}
@@ -304,14 +303,21 @@ install:
 .for locale in ${LOCALES}
install -o ${LOCALEOWN} -g ${LOCALEGRP} -m ${DIRMODE} -d \
${DESTDIR}${LOCALEDIR}/${locale}
-   install -o ${LOCALEOWN} -g ${LOCALEGRP} -m ${LOCALEMODE} \
-   ${locale}.out ${DESTDIR}${LOCALEDIR}/${locale}/LC_CTYPE
+   if (test ${LOCALESRC_${locale}:S/ISO_/ISO/g:S/DIS_/ISO/g} != 
${locale}) then { \
+   ln -fs 
../${LOCALESRC_${locale}:S/ISO_/ISO/g:S/DIS_/ISO/g}/LC_CTYPE 
${DESTDIR}${LOCALEDIR}/${locale}/LC_CTYPE; \
+   } else { \
+   install -o ${LOCALEOWN} -g ${LOCALEGRP} -m ${LOCALEMODE} \
+   ${locale}.out ${DESTDIR}${LOCALEDIR}/${locale}/LC_CTYPE; \
+   } fi;
+
 .endfor
 
 .for locale in ${LOCALES}
 ${locale}.out: ${LOCALESRC_${locale}}.src
-   ${CPP} -I${.CURDIR}  ${.CURDIR}/${LOCALESRC_${locale}}.src | \
-   sed -e '/^#/d' | mklocale -o ${.TARGET}
+   if (test ${LOCALESRC_${locale}:S/ISO_/ISO/g:S/DIS_/ISO/g} = 
${locale}) then { \
+   ${CPP} -I${.CURDIR}  ${.CURDIR}/${LOCALESRC_${locale}}.src | \
+   sed -e '/^#/d' | mklocale -o ${.TARGET}; \
+   } fi;
 .endfor
 
 .SUFFIXES: .src .out


Re: LC_CTYPE for spanish speaking countries

2013-05-13 Thread Vladimir Támara Patiño


On Mon, May 13, 2013 at 09:16:39AM +0100, Stuart Henderson wrote:

Please send unified diffs, the default diff format is very hard to read

echo diff -uNp  ~/.cvsrc



Sorry and thank you, attached is unified

--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html

Index: Makefile
===
RCS file: /cvs/src/share/locale/ctype/Makefile,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile
--- Makefile16 Jul 2011 21:33:30 -  1.6
+++ Makefile13 May 2013 11:00:16 -
@@ -80,14 +80,15 @@ LOCALES += en_US.ISO8859-15
 LOCALES += en_US.UTF-8
  LOCALESRC_en_US.UTF-8 = en_US.UTF-8
 
-LOCALES += es_ES.ISO8859-1
- LOCALESRC_es_ES.ISO8859-1 = en_US.ISO_8859-1
-
-LOCALES += es_ES.ISO8859-15
- LOCALESRC_es_ES.ISO8859-15 = en_US.DIS_8859-15
-
-LOCALES += es_ES.UTF-8
- LOCALESRC_es_ES.UTF-8 = en_US.UTF-8
+LOCALES_ES = es_AR es_BO es_CH es_CO es_CR es_CU es_DO es_EC es_ES es_GQ es_GT 
es_HN es_MX es_NI es_PA es_PE es_PR es_PY es_SV es_US es_UY es_VE
+.for c in ${LOCALES_ES}
+LOCALES += ${c}.ISO8859-1
+ LOCALESRC_${c}.ISO8859-1 = en_US.ISO_8859-1
+LOCALES += ${c}.ISO8859-15
+ LOCALESRC_${c}.ISO8859-15 = en_US.DIS_8859-15
+LOCALES += ${c}.UTF-8
+ LOCALESRC_${c}.UTF-8 = en_US.UTF-8
+.endfor
 
 LOCALES += fa_IR.UTF-8
  LOCALESRC_fa_IR.UTF-8 = en_US.UTF-8
@@ -293,7 +294,6 @@ LOCALESRCS+=${LOCALESRC_${locale}}
 .endfor
 CLEANFILES+=   ${LOCALES:S/$/.out/g}
 
-# TODO: more use of symlinks?
 FILES= ${LOCALES:S/$/.out/g}
 .for locale in ${LOCALES}
 FILESDIR_${locale}.out=${LOCALEDIR}/${locale}
@@ -304,14 +304,21 @@ install:
 .for locale in ${LOCALES}
install -o ${LOCALEOWN} -g ${LOCALEGRP} -m ${DIRMODE} -d \
${DESTDIR}${LOCALEDIR}/${locale}
-   install -o ${LOCALEOWN} -g ${LOCALEGRP} -m ${LOCALEMODE} \
-   ${locale}.out ${DESTDIR}${LOCALEDIR}/${locale}/LC_CTYPE
+   if (test ${LOCALESRC_${locale}:S/ISO_/ISO/g:S/DIS_/ISO/g} != 
${locale}) then { \
+   ln -fs 
../${LOCALESRC_${locale}:S/ISO_/ISO/g:S/DIS_/ISO/g}/LC_CTYPE 
${DESTDIR}${LOCALEDIR}/${locale}/LC_CTYPE; \
+   } else { \
+   install -o ${LOCALEOWN} -g ${LOCALEGRP} -m ${LOCALEMODE} \
+   ${locale}.out ${DESTDIR}${LOCALEDIR}/${locale}/LC_CTYPE; \
+   } fi;
+
 .endfor
 
 .for locale in ${LOCALES}
 ${locale}.out: ${LOCALESRC_${locale}}.src
-   ${CPP} -I${.CURDIR}  ${.CURDIR}/${LOCALESRC_${locale}}.src | \
-   sed -e '/^#/d' | mklocale -o ${.TARGET}
+   if (test ${LOCALESRC_${locale}:S/ISO_/ISO/g:S/DIS_/ISO/g} = 
${locale}) then { \
+   ${CPP} -I${.CURDIR}  
${.CURDIR}/${LOCALESRC_${locale}:S/ISO_/ISO/g:S/DIS_/ISO/g}.src | \
+   sed -e '/^#/d' | mklocale -o ${.TARGET}; \
+   } fi;
 .endfor
 
 .SUFFIXES: .src .out


Re: LC_CTYPE for spanish speaking countries

2013-05-12 Thread Vladimir Támara Patiño


After private conversation with Stefan I'm sending patch that uses links
in /usr/share/locale for LC_CTYPE instead of copying (by the way there was a 
commentary in /usr/src/share/locale/ctype/Makefile suggesting using

symlinks!).
Besides this patch adds locales for spanish speaking countries.

This method reduces the size of /usr/shar/locale from 2.1M to 556K (even 
with new locales for all spanish speaking countries).


The same can be done with LC_COLLATE (after having collation support). 


Best regards.
--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html

? m
? obj
Index: Makefile
===
RCS file: /cvs/src/share/locale/ctype/Makefile,v
retrieving revision 1.6
diff -r1.6 Makefile
83,90c83,91
 LOCALES += es_ES.ISO8859-1
  LOCALESRC_es_ES.ISO8859-1 = en_US.ISO_8859-1
 
 LOCALES += es_ES.ISO8859-15
  LOCALESRC_es_ES.ISO8859-15 = en_US.DIS_8859-15
 
 LOCALES += es_ES.UTF-8
  LOCALESRC_es_ES.UTF-8 = en_US.UTF-8
---
 LOCALES_ES = es_AR es_BO es_CH es_CO es_CR es_CU es_DO es_EC es_ES es_GQ 
 es_GT es_HN es_MX es_NI es_PA es_PE es_PR es_PY es_SV es_US es_UY es_VE
 .for c in ${LOCALES_ES}
 LOCALES += ${c}.ISO8859-1
  LOCALESRC_${c}.ISO8859-1 = en_US.ISO_8859-1
 LOCALES += ${c}.ISO8859-15
  LOCALESRC_${c}.ISO8859-15 = en_US.DIS_8859-15
 LOCALES += ${c}.UTF-8
  LOCALESRC_${c}.UTF-8 = en_US.UTF-8
 .endfor
296d296
 # TODO: more use of symlinks?
307,308c307,313
   install -o ${LOCALEOWN} -g ${LOCALEGRP} -m ${LOCALEMODE} \
   ${locale}.out ${DESTDIR}${LOCALEDIR}/${locale}/LC_CTYPE
---
   if (test ${LOCALESRC_${locale}:S/ISO_/ISO/g:S/DIS_/ISO/g} != 
 ${locale}) then { \
   ln -fs 
 ../${LOCALESRC_${locale}:S/ISO_/ISO/g:S/DIS_/ISO/g}/LC_CTYPE 
 ${DESTDIR}${LOCALEDIR}/${locale}/LC_CTYPE; \
   } else { \
   install -o ${LOCALEOWN} -g ${LOCALEGRP} -m ${LOCALEMODE} \
   ${locale}.out ${DESTDIR}${LOCALEDIR}/${locale}/LC_CTYPE; \
   } fi;
 
313,314c318,321
   ${CPP} -I${.CURDIR}  ${.CURDIR}/${LOCALESRC_${locale}}.src | \
   sed -e '/^#/d' | mklocale -o ${.TARGET}
---
   if (test ${LOCALESRC_${locale}:S/ISO_/ISO/g:S/DIS_/ISO/g} = 
 ${locale}) then { \
   ${CPP} -I${.CURDIR}  
 ${.CURDIR}/${LOCALESRC_${locale}:S/ISO_/ISO/g:S/DIS_/ISO/g}.src | \
   sed -e '/^#/d' | mklocale -o ${.TARGET}; \
   } fi;


Re: Bug with setlocale and __mb_cur_max

2013-04-28 Thread Vladimir Támara Patiño

On Fri, Apr 26, 2013 at 01:04:26PM +0200, Stefan Sperling wrote:


Regarding your test program, I have a small nit: You've sent a test
program that uses the es_CO locale, which probably only exists on
your own patched system, so the test program doesn't work elsewhere.
Please consider sending tests programs that work on other peoples'
systems without modification -- just as a matter of courtesy.


Today I began to test symbolic links from es_ES.* to es_CO.* and seems
that can work.  I'll test more and report.


Regarding your fix: I've verified that it works, but I think there
is a better way of fixing this. It seems strange that the citrus
layer is concerned at all with setting the global __mb_cur_max variable,
a variable which is actually in the domain of code in the locale/ directory.

Consider the following idea: We add a new member to struct _citrus_ctype_rec,
called e.g. cc_mb_cur_max, which can be hard-coded to the correct value
during definitions of _citrus_ctype_rec objects we use.


In FreeBSD is done like that with a member __mb_cur_max in the structure
xlocale_ctype.


The generic locale/ code could then set __mb_cur_max based on that
constant value, at the bottom of the _xpg4_setrunelocale() function,
by pulling the correct value out of the rl-rl_citrus_ctype structure.

_citrus_ctype_open() won't have to fiddle with __mb_cur_max anymore,
which also fixes another bug: We currently change __mb_cur_max even if
setting the locale files after _citrus_ctype_open()!

Do you want to try implementing this idea?
I believe this idea would result in a smaller diff, too.


Attached, with reordering of #includes in setrunelocale.c to comply 
better with style (9).



--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html

Index: citrus/citrus_ctype.c
===
RCS file: /cvs/src/lib/libc/citrus/citrus_ctype.c,v
retrieving revision 1.3
diff -u -r1.3 citrus_ctype.c
--- citrus/citrus_ctype.c   5 Dec 2012 23:19:59 -   1.3
+++ citrus/citrus_ctype.c   28 Apr 2013 13:10:48 -
@@ -38,10 +38,12 @@
 
 struct _citrus_ctype_rec _citrus_ctype_none = {
_citrus_none_ctype_ops,/* cc_ops */
+   1,  /* cc_mb_cur_max */
 };
 
 struct _citrus_ctype_rec _citrus_ctype_utf8 = {
_citrus_utf8_ctype_ops,/* cc_ops */
+   _CITRUS_UTF8_MB_CUR_MAX,/* cc_mb_cur_max */
 };
 
 int
@@ -49,11 +51,9 @@
 {
if (!strcmp(encname, NONE)) {
*rcc = _citrus_ctype_none;
-   __mb_cur_max = 1;
return (0);
} else if (!strcmp(encname, UTF8)) {
*rcc = _citrus_ctype_utf8;
-   __mb_cur_max = _CITRUS_UTF8_MB_CUR_MAX;
return (0);
}
 
Index: citrus/citrus_ctype_local.h
===
RCS file: /cvs/src/lib/libc/citrus/citrus_ctype_local.h,v
retrieving revision 1.3
diff -u -r1.3 citrus_ctype_local.h
--- citrus/citrus_ctype_local.h 6 Jun 2012 16:58:02 -   1.3
+++ citrus/citrus_ctype_local.h 28 Apr 2013 13:10:49 -
@@ -81,6 +81,7 @@
 
 struct _citrus_ctype_rec {
struct _citrus_ctype_ops_rec*cc_ops;
+   size_t  cc_mb_cur_max;
 };
 
 #endif
Index: locale/setrunelocale.c
===
RCS file: /cvs/src/lib/libc/locale/setrunelocale.c,v
retrieving revision 1.7
diff -u -r1.7 setrunelocale.c
--- locale/setrunelocale.c  5 Dec 2012 23:20:00 -   1.7
+++ locale/setrunelocale.c  28 Apr 2013 13:10:49 -
@@ -88,18 +88,20 @@
  * SUCH DAMAGE.
  */
 
-#include rune.h
 #include assert.h
 #include errno.h
 #include limits.h
+#include locale.h
 #include paths.h
-#include string.h
 #include stdio.h
 #include stdlib.h
 #include stddef.h
+#include string.h
 #include unistd.h
-#include locale.h
-#include citrus/citrus_ctype.h
+
+#include citrus_ctype.h
+#include citrus_ctype_local.h
+#include rune.h
 #include rune_local.h
 
 struct localetable {
@@ -195,6 +197,7 @@
 
 found:
_CurrentRuneLocale = rl;
+   __mb_cur_max = rl-rl_citrus_ctype-cc_mb_cur_max;
 
return 0;
 }


Re: Bug with setlocale and __mb_cur_max

2013-04-16 Thread Vladimir Támara Patiño

On Wed, Apr 10, 2013 at 01:48:03PM +0200, Stefan Sperling wrote:

 +  return 1;  // If not UTF8 then single byte encoding

No C++ comments, please!


The attached patch doens't have C++ comments.


--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html

Common subdirectories: /usr/src-orig/lib/libc/citrus/CVS and 
/usr/src/lib/libc/citrus/CVS
diff -u -x *~ /usr/src-orig/lib/libc/citrus/citrus_ctype.c 
/usr/src/lib/libc/citrus/citrus_ctype.c
--- /usr/src-orig/lib/libc/citrus/citrus_ctype.cSat Feb  9 14:26:51 2013
+++ /usr/src/lib/libc/citrus/citrus_ctype.c Wed Apr 10 07:36:58 2013
@@ -45,15 +45,24 @@
 };
 
 int
+_citrus_ctype_mb_cur_max(char const *encname)
+{
+   if (strcmp(encname, UTF8) == 0) {
+   return _CITRUS_UTF8_MB_CUR_MAX;
+   }
+   return 1;  /* If not UTF8 then single byte encoding */
+}
+
+int
 _citrus_ctype_open(struct _citrus_ctype_rec **rcc, char const *encname)
 {
if (!strcmp(encname, NONE)) {
*rcc = _citrus_ctype_none;
-   __mb_cur_max = 1;
+   __mb_cur_max = _citrus_ctype_mb_cur_max(encname);
return (0);
} else if (!strcmp(encname, UTF8)) {
*rcc = _citrus_ctype_utf8;
-   __mb_cur_max = _CITRUS_UTF8_MB_CUR_MAX;
+   __mb_cur_max = _citrus_ctype_mb_cur_max(encname);
return (0);
}
 
diff -u -x *~ /usr/src-orig/lib/libc/citrus/citrus_ctype.h 
/usr/src/lib/libc/citrus/citrus_ctype.h
--- /usr/src-orig/lib/libc/citrus/citrus_ctype.hMon Aug  2 13:05:22 2010
+++ /usr/src/lib/libc/citrus/citrus_ctype.h Wed Apr 10 05:33:22 2013
@@ -35,6 +35,7 @@
 
 extern struct _citrus_ctype_rec _citrus_ctype_none;
 
+int _citrus_ctype_mb_cur_max(char const *);
 int _citrus_ctype_open(struct _citrus_ctype_rec **, char const *);
 
 #endif
--- /usr/src-orig/lib/libc/locale/setrunelocale.c   Sat Feb  9 14:26:52 2013
+++ /usr/src/lib/libc/locale/setrunelocale.cWed Apr 10 05:35:23 2013
@@ -100,6 +100,7 @@
 #include unistd.h
 #include locale.h
 #include citrus/citrus_ctype.h
+#include citrus/citrus_utf8.h
 #include rune_local.h
 
 struct localetable {
@@ -195,6 +196,7 @@
 
 found:
_CurrentRuneLocale = rl;
+   __mb_cur_max = _citrus_ctype_mb_cur_max(rl-rl_encoding);
 
return 0;
 }


Bug with setlocale and __mb_cur_max

2013-04-10 Thread Vladimir Támara Patiño

The attached test fails (in 5.2, 5.3 and current), producing:

locale es_CO.UTF-8/es_CO.UTF-8/C/C/C/es_CO.UTF-8
__mb_cur_max=4
locale es_CO.ISO8859-1/es_CO.ISO8859-1/C/C/C/es_CO.ISO8859-1
__mb_cur_max=1
locale es_CO.UTF-8/es_CO.UTF-8/C/C/C/es_CO.UTF-8
__mb_cur_max=1
assertion __mb_cur_max == 4 failed: file prob_mb_cur_max.c, line 21,
function main

The attached patch fixes the problem.  

By the way, in FreeBSD the structure xlocale_ctype has a member __mb_cur_max, 
and __mb_cur_max for UTF-8 is 6.


--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html

#include assert.h
#include locale.h
#include stdio.h
#include stdlib.h

int main() {
char *nl;
nl = setlocale(LC_ALL, es_CO.UTF-8);
printf(locale %s\n, nl);
printf(__mb_cur_max=%i\n, __mb_cur_max);
assert(__mb_cur_max == 4);

nl = setlocale(LC_ALL, es_CO.ISO8859-1);
printf(locale %s\n, nl);
printf(__mb_cur_max=%i\n, __mb_cur_max);
assert(__mb_cur_max == 1);

nl = setlocale(LC_ALL, es_CO.UTF-8);
printf(locale %s\n, nl);
printf(__mb_cur_max=%i\n, __mb_cur_max);
assert(__mb_cur_max == 4);

return 0;
}
diff -ruN -x CVS -x obj -x *~ src-orig/lib/libc/citrus/citrus_ctype.c 
src/lib/libc/citrus/citrus_ctype.c
--- src-orig/lib/libc/citrus/citrus_ctype.c Sat Feb  9 14:26:51 2013
+++ src/lib/libc/citrus/citrus_ctype.c  Wed Apr 10 05:40:34 2013
@@ -45,15 +45,24 @@
 };
 
 int
+_citrus_ctype_mb_cur_max(char const *encname)
+{
+   if (strcmp(encname, UTF8) == 0) {
+   return _CITRUS_UTF8_MB_CUR_MAX;
+   }
+   return 1;  // If not UTF8 then single byte encoding
+}
+
+int
 _citrus_ctype_open(struct _citrus_ctype_rec **rcc, char const *encname)
 {
if (!strcmp(encname, NONE)) {
*rcc = _citrus_ctype_none;
-   __mb_cur_max = 1;
+   __mb_cur_max = _citrus_ctype_mb_cur_max(encname);
return (0);
} else if (!strcmp(encname, UTF8)) {
*rcc = _citrus_ctype_utf8;
-   __mb_cur_max = _CITRUS_UTF8_MB_CUR_MAX;
+   __mb_cur_max = _citrus_ctype_mb_cur_max(encname);
return (0);
}
 
diff -ruN -x CVS -x obj -x *~ src-orig/lib/libc/citrus/citrus_ctype.h 
src/lib/libc/citrus/citrus_ctype.h
--- src-orig/lib/libc/citrus/citrus_ctype.h Mon Aug  2 13:05:22 2010
+++ src/lib/libc/citrus/citrus_ctype.h  Wed Apr 10 05:33:22 2013
@@ -35,6 +35,7 @@
 
 extern struct _citrus_ctype_rec _citrus_ctype_none;
 
+int _citrus_ctype_mb_cur_max(char const *);
 int _citrus_ctype_open(struct _citrus_ctype_rec **, char const *);
 
 #endif
--- src-orig/lib/libc/locale/setrunelocale.cSat Feb  9 14:26:52 2013
+++ src/lib/libc/locale/setrunelocale.c Wed Apr 10 05:35:23 2013
@@ -100,6 +100,7 @@
 #include unistd.h
 #include locale.h
 #include citrus/citrus_ctype.h
+#include citrus/citrus_utf8.h
 #include rune_local.h
 
 struct localetable {
@@ -195,6 +196,7 @@
 
 found:
_CurrentRuneLocale = rl;
+   __mb_cur_max = _citrus_ctype_mb_cur_max(rl-rl_encoding);
 
return 0;
 }


Re: strcasecmp and multibyte encodings

2013-04-10 Thread Vladimir Támara Patiño
Thanks for feedback to Stephan and Matthew.  


Updating patch with all your feedback, and having into account that
n in strncmp counts bytes on s1 (as stated in the thread of
the POSIX list sent byt Matthew).

On Tue, Apr 09, 2013 at 11:17:26AM -0700, Matthew Dempsky wrote:

These strlen() calls are also wrong, because they could read past the
n bytes allowed for strncasecmp().

O


 It seems strncasecmp() cannot return errors according to POSIX.
 Only the _l variants have errors defined.

The convention for methods like these to return errors is the caller
is required to set errno = 0; before the call, and then check for
errno != 0 after the call. :(

 While I recognize that POSIX mandates the current locale to be used for
 case conversion, I'm not sure this change is worth the extra complexity.
 As you point out, the standard seems to throw its hands up in the air
 when the question about conversion errors with strcasecmp() and strncasecmp()
 is raised, possibly because these functions are older than the locale concept.

The definition of strncasecmp() has actually been a pretty contentious
topic on the POSIX mailing list for the past few weeks, albeit mostly
focused on whether LC_CTYPE=POSIX allows for UTF-8 or not.

E.g., http://austingroupbugs.net/view.php?id=663

I'm inclined to leave the functions as is for now.


--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html

--- src53/lib/libc/string/strcasecmp.c  Mon Mar 25 18:28:29 2013
+++ src/lib/libc/string/strcasecmp.cWed Apr 10 04:20:02 2013
@@ -29,7 +29,10 @@
  * SUCH DAMAGE.
  */
 
+#include stdlib.h
 #include string.h
+#include wchar.h
+#include wctype.h
 
 typedef unsigned char u_char;
 
@@ -76,18 +79,11 @@
 int
 strcasecmp(const char *s1, const char *s2)
 {
-   const u_char *cm = charmap;
-   const u_char *us1 = (const u_char *)s1;
-   const u_char *us2 = (const u_char *)s2;
-
-   while (cm[*us1] == cm[*us2++])
-   if (*us1++ == '\0')
-   return (0);
-   return (cm[*us1] - cm[*--us2]);
+   return strncasecmp(s1, s2, strlen(s1) + 1);
 }
 
 int
-strncasecmp(const char *s1, const char *s2, size_t n)
+sbstrncasecmp(const char *s1, const char *s2, size_t n)
 {
if (n != 0) {
const u_char *cm = charmap;
@@ -100,6 +96,42 @@
if (*us1++ == '\0')
break;
} while (--n != 0);
+   }
+   return (0);
+}
+
+int
+strncasecmp(const char *s1, const char *s2, size_t n)
+{
+   mbstate_t mb1, mb2;
+
+   bzero(mb1, sizeof(mb1));
+   bzero(mb2, sizeof(mb2));
+   if (n != 0) {
+   const u_char *us1 = (const u_char *)s1;
+   const u_char *us2 = (const u_char *)s2;
+   size_t d1, d2;
+
+   do {
+   wchar_t w1, w2, l1, l2;
+   size_t ml = n  MB_CUR_MAX ? n : MB_CUR_MAX;
+   d1 = mbrtowc(w1, us1, ml, mb1);
+   if (d1 == (size_t)-1 || d1 == (size_t)-2) {
+   return sbstrncasecmp(s1, s2, n);
+   }
+   d2 = mbrtowc(w2, us2, ml, mb2);
+   if (d2 == (size_t)-1 || d2 == (size_t)-2) {
+   return sbstrncasecmp(s1, s2, n);
+   }
+   if ((l1 = towlower(w1)) != (l2 = towlower(w2))) {
+   return l1 - l2;
+   }
+   if (*us1 == '\0')
+   break;
+   us2 += d2;
+   us1 += d1;
+   n -= d1;
+   } while (n != 0);
}
return (0);
 }


Re: Bug with setlocale and __mb_cur_max

2013-04-10 Thread Vladimir Támara Patiño

On Wed, Apr 10, 2013 at 01:48:03PM +0200, Stefan Sperling wrote:

Thanks! I will try to get this committed, possibly with some cleanup.


Nice!


The longest UTF-8 character used to be 6 bytes long but this was
restricted to 4 bytes later. See RFC 3629.


Ok, thanks. 
 

No C++ comments, please!


Sorry, I forgot.

--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html



strcasecmp and multibyte encodings

2013-04-09 Thread Vladimir Támara Patiño
Although the behavior of strcasecmp is unsepecified for multibyte 
encodings (Is that right?)  
http://pubs.opengroup.org/onlinepubs/9699919799/


I wish the attached test (encoded in UTF-8) would pass,
so I'm also attaching a patch for strcasecmp and strncasecmp that makes
this test pass, it uses only LC_CTYPE (but not LC_COLLATE) and a
simple numeric comparision when the strings are different (as the 
previous version was doing).


--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html

#include locale.h
#include stdio.h
#include string.h

int main()
{
char *nl = setlocale(LC_ALL, es_CO.UTF-8);
if (strcasecmp(ñ, Ñ) == 0) {
printf(OK);
} else {
printf(Error);
}

return 0;
}
--- src53/lib/libc/string/strcasecmp.c  Mon Mar 25 18:28:29 2013
+++ src/lib/libc/string/strcasecmp.cTue Apr  9 11:34:44 2013
@@ -30,6 +30,8 @@
  */
 
 #include string.h
+#include wchar.h
+#include wctype.h
 
 typedef unsigned char u_char;
 
@@ -76,29 +78,36 @@
 int
 strcasecmp(const char *s1, const char *s2)
 {
-   const u_char *cm = charmap;
-   const u_char *us1 = (const u_char *)s1;
-   const u_char *us2 = (const u_char *)s2;
-
-   while (cm[*us1] == cm[*us2++])
-   if (*us1++ == '\0')
-   return (0);
-   return (cm[*us1] - cm[*--us2]);
+   return strncasecmp(s1, s2, strlen(s1) + 1);
 }
 
+/** Uses LC_CTYPE but not LC_COLLATE */
 int
 strncasecmp(const char *s1, const char *s2, size_t n)
 {
+   mbstate_t mb1, mb2;
+   bzero(mb1, sizeof(mb1));
+   bzero(mb2, sizeof(mb2));
+   mbsinit(mb1);
+   mbsinit(mb2);
+
if (n != 0) {
-   const u_char *cm = charmap;
const u_char *us1 = (const u_char *)s1;
const u_char *us2 = (const u_char *)s2;
+   size_t lus1 = strlen(us1);
+   size_t lus2 = strlen(us2);
 
do {
-   if (cm[*us1] != cm[*us2++])
-   return (cm[*us1] - cm[*--us2]);
-   if (*us1++ == '\0')
+   wchar_t w1, w2, l1, l2;
+   size_t d1 = mbrtowc(w1, us1, lus1, mb1);
+   size_t d2 = mbrtowc(w2, us2, lus2, mb2);
+   if ((l1 = towlower(w1)) != (l2 = towlower(w2))) {
+   return l1 - l2;
+   }
+   if (*us1 == '\0')
break;
+   us2 += d2;
+   us1 += d1;
} while (--n != 0);
}
return (0);


Re: /usr.bin/colldef and collation tables

2013-03-25 Thread Vladimir Támara Patiño

On Sat, Mar 23, 2013 at 04:09:12PM +0100, Stefan Sperling wrote:

On Sat, Mar 23, 2013 at 09:27:50AM -0500, Vladimir Támara Patiño wrote:
 Please change this to look like
 in other parse.y files in the OpenBSD src tree (e.g. look at bgpd).
 
 Could you change?


No, sorry. I don't have time for doing that.


My time is also limited.


Please cross-check the parse.y files yourself and make sure the new
parse.y file follows conventions used in the existing parse.y files.
We want our source tree to be consistent.


I think it is somehow similar to lex.l and yacc.y of usr.bin/mklocale

But, however I would like to know what conventions of other parse.y files 
are desirable (even for mklocale)?


* Using log.c ?
* Not using lex, but implementing the lexer in parse.y?


I see you're still tempted to copy code from FreeBSD without making
it perfect for OpenBSD. I'm not going to allow you to be that lazy ;-)


I made small changes, like improving documentation, using strlcpy
and strlcat, adding debugging of lexer when the option -d is used.

Comparing mklocale current implementations with NetBSD's,  I see 
improving documentation and renamings. What other conventions are

important?

Possible to show example with mklocale's lexer and parser?


Why do you compile colldef with COLLAGE_DEBUG by default?


To have the option -d that gives debuggin information (mklocale also has
it).


Don't expect me to hunt for additional opinions
and OKs before I've gotten around to review the libc changes you
sent as well, and before I'm perfectly happy with both diffs.


Ok.  Better then sending both parts as one patch?


I'm certainly not going to commit any of this without asking others
for review as well, so please don't be worried if it takes some time
to get this in.


Ok.


collate.h has this:
This should be named something like COLLATE_MAX_STR_LEN.


Ok.


Also, the collate.h file has:

 +__BEGIN_DECLS
 +#ifdef COLLATE_DEBUG
 +void  __collate_print_tables(void);

This is bogus. colldef.c declares and defines a collate_print_tables()
function. The __collate_print_tables() function is used in the libc
diff you sent, so it doesn't belong in the colldef diff.


Ok.

Should I sent now, only one diff (with changes for colldef, collation
tables and changes to libc ?)

--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html



Re: Collation support (minimal)

2013-03-22 Thread Vladimir Támara Patiño

On Sat, Mar 09, 2013 at 02:45:00PM +0100, Stefan Sperling wrote:

I'd like to concentrate on collation. To properly review your diff,
I need to understand what needs to be added to OpenBSD' locale implementation.


I hope the attached patch helps.


Instead, you should consider OpenBSD's code as your starting point.
And add to that _only_ what needs to be done to support collation.


Not so easy, because the implementation of collations that I know is
the one of FreeBSD (by the way mklocale and the ctype catalogues come from 
NetBSD, as well as part of the libc implementation --both from citrus). 
In future would be nice to implement collation in UTF-8 complete, but at 
least here something for single-byte encondings and UTF-8 translatable 
to ISO8859-1.


By the way to support UTF-8 translatable to ISO8859-1 I changed the
functions in collate.c with respect to the implementation of FreeBSD.
I don't have a FreeBSD at hand, but I guess it doesn't support
collations in locales like es_CO.UTF-8, while the attached
implementation does.


Adding new functions like strxfrm_l() etc. just doesn't make sense to me.
You shouldn't need to add any new functions. We already have strcoll()
and strxfrm(). Those are interfaces from C89, so they're a bit dated.
But they should be good enough for getting some basic collation support
going. We can talk about adding support for newer interfaces later, but
those should not matter for the initial implementation.


Those functions were removed (but I left the credit of the 
implementations that I used).



You have other unrelated changes in there, such as shuffling of MLINKS lists.
Those add noise to the diff and make it harder to review.


Other changes I sent in separate emails (including man pages for
wcscoll and wcsxfrm).

If there is interest in xlocale support after this or after having
other kind of collation support in OpenBSD, please let me know.  I 
also want to advance in other LC_* implementations.


Best regards.
--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html

diff -ruN -x obj -x CVS -x *~ src53orig/lib/libc/locale/Makefile.inc 
src/lib/libc/locale/Makefile.inc
--- src53orig/lib/libc/locale/Makefile.inc  Sat Mar  9 11:16:47 2013
+++ src/lib/libc/locale/Makefile.incTue Mar 19 05:52:30 2013
@@ -9,7 +9,7 @@
wcstombs.c wctob.c wctomb.c wcstof.c wcstod.c wcstold.c wcstol.c \
wcstoul.c wcstoll.c wcstoull.c wcstoimax.c wcstoumax.c \
setrunelocale.c runeglue.c rune.c runetable.c ___runetype_mb.c \
-   _wctrans.c wcsxfrm.c
+   _wctrans.c wcsxfrm.c collate.c
 
 MAN+=  nl_langinfo.3 setlocale.3 iswalnum.3 towlower.3 \
btowc.3 mblen.3 mbrlen.3 mbrtowc.3 mbsinit.3 mbsrtowcs.3 \
diff -ruN -x obj -x CVS -x *~ src53orig/lib/libc/locale/collate.c 
src/lib/libc/locale/collate.c
--- src53orig/lib/libc/locale/collate.c Wed Dec 31 19:00:00 1969
+++ src/lib/libc/locale/collate.c   Mon Mar 18 07:24:12 2013
@@ -0,0 +1,430 @@
+/*-
+ * Copyright (c) 1995 Alex Tatmanjants a...@elvisti.kiev.ua
+ * at Electronni Visti IA, Kiev, Ukraine.
+ * All rights reserved.
+ *
+ * Copyright (c) 2011 The FreeBSD Foundation
+ * All rights reserved.
+ * Portions of this software were developed by David Chisnall
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+/**
+ * Public domain according to Colombian Legislation. 
+ * http://www.pasosdejesus.org/dominio_publico_colombia.html
+ * 2013. vtam...@pasosdejesus.org.
+ */
+
+
+#include sys/cdefs.h
+
+#include arpa/inet.h
+#include errno.h
+#include paths.h
+#include stdio.h
+#include stdlib.h
+#include

Re: amd64 ports failures with new binutils

2013-03-22 Thread Vladimir Támara Patiño

(2) A whole bunch of ports fail along the lines of

ld: foo.o: relocation R_X86_64_PC32 against `bar' can not be used
when making a shared object; recompile with -fPIC


A similar issue compiling a program in current was discussed here:
https://groups.google.com/forum/?fromgroups=#!topic/OpenBSD-Colombia/Qi2X9Yyh3xc
Sergio solved it by adding -Wl,-non_shared in LDFLAGS

Helps?
--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html



Re: LC_CTYPE for spanish speaking countries

2013-03-21 Thread Vladimir Támara Patiño
Some ports in snapshot that include .po or .mo catalogs 
different to es_ES are (just listing few without repetition):


davical es_AR es_MX es_VE
gnomebaker es_CO, es_CR
poedit es_PR 
zarafa  es_CA


The following packages have other localization files practically for
every spanish speaking country (in the list I sent I have to add es_CA and
es_US that are already there):
concrete5, icinga-web,  ocaml-camomile, p5-DateTime-Locale, py-babel, 
py-turbogears, zendframework



Regarding the situtation with other languages, in 
/usr/src/share/locale/ctype/Makefile 
I find the following languages with countries pointing all of them to the 
same cmap definitions:
* de_AT, de_CH and de_DE 
* fr_BE, fr_CA, fr_CH, fr_FR

* it_CH, it_IT
* nl_BE, nl_NL

Why spanish is treated differently?

Finally I don't live in Spain but in Colombia, so I should be able to
use es_CO.
H

Best regards.

On Thu, Mar 21, 2013 at 01:24:34AM +0100, Stefan Sperling wrote:

On Wed, Mar 20, 2013 at 04:50:39PM -0430, Andres Perera wrote:
 On Wed, Mar 20, 2013 at 2:50 PM, Stefan Sperling s...@openbsd.org wrote:
  On Tue, Mar 19, 2013 at 06:44:59PM -0500, Vladimir Támara Patiño wrote:
  
+#http://en.wikipedia.org/wiki/List_of_countries_where_Spanish_is_an_official_language
  +ES_COUNTRIES= AR BO CH CO CR CU DO EC ES GQ GT HN MX NI PA PE PR PY SV UY 
VE
 
  Sorry, but I don't really see the point of this.
 
  All these names are going to map to the same ctype definitions.
  That just clutters the /usr/share/locale directory. Why can't people
  just use es_ES?
 
 Because that's wrong. es_VE for ctype alone won't make a difference,

 but BSF isn't the same as Euro, is it? (hah) Date formats, etc., are
 different. And dictionary files (e.g., spellings for common cities)
 are also different.

Yes, but unfortunately OpenBSD's locale implemnentation doesn't yet
support much of what you mention above. AFAIK we currently only
support the LC_CTYPE locale category.

Please show me a real benefit of this change within the current
implementation, or extend the implementation to create a benefit.

Or you could identify some ports which install message files where
adding new spanish locale variants will really make a difference. If such
ports exist, I'm happy to add the corresponding locale variants.

But I'm not going to bother making no-op changes to the system.


--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html



Fix for regress/lib/libc/locale/check_isw

2013-03-19 Thread Vladimir Támara Patiño

The regression test in regress/lib/libc/locale/check_isw doesn't pass
in current.  


My thinking for the attached patch is that since this test is
intended only for the POSIX locale, it should only test the portable 
character set and the control characters set.

http://pubs.opengroup.org/onlinepubs/7908799/xbd/locale.html
http://pubs.opengroup.org/onlinepubs/7908799/xbd/charset.html#tagt_1


--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html

Index: check_isw.c
===
RCS file: /cvs/src/regress/lib/libc/locale/check_isw/check_isw.c,v
retrieving revision 1.1
diff -u -r1.1 check_isw.c
--- check_isw.c 11 Aug 2005 21:57:02 -  1.1
+++ check_isw.c 19 Mar 2013 11:30:40 -
@@ -50,7 +50,7 @@
 {
int i;
 
-   for (i = 0; i  256; i++) {
+   for (i = 0; i  128; i++) {
printf( %02x: , i);
check_bool(isalnum(i), iswalnum(i), '1');
check_bool(isalpha(i), iswalpha(i), '2');
@@ -82,7 +82,7 @@
wchar_t c, d;
mbstate_t state;
 
-   s = malloc(256);
+   s = malloc(128);
if (!s) {
bad++;
return;
@@ -93,14 +93,14 @@
free(s);
return;
}
-   for (i = 0; i  256; i++)
+   for (i = 0; i  127; i++)
s[i] = i+1;
 
j = 0;
mbrtowc(NULL, NULL, 1, state);
printf( %02x: , 0);
 
-   while ((n = mbrtowc(c, s+j, 256-j, state)) == 1) {
+   while (j  127  (n = mbrtowc(c, s+j, 128-j, state)) == 1) {
printf( %02x: , s[j]);
check_bool(isalnum(s[j]), iswalnum(c), '1');
check_bool(isalpha(s[j]), iswalpha(c), '2');
@@ -130,7 +130,7 @@
printf(\n);
j++;
}
-   if (n != 0 || j != 255) {
+   if (n != 1 || j != 127) {
bad++;
}
free(s);


LC_CTYPE for spanish speaking countries

2013-03-19 Thread Vladimir Támara Patiño



--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html

Index: Makefile
===
RCS file: /cvs/src/share/locale/ctype/Makefile,v
retrieving revision 1.6
diff -u -r1.6 Makefile
--- Makefile16 Jul 2011 21:33:30 -  1.6
+++ Makefile19 Mar 2013 23:39:06 -
@@ -80,14 +80,17 @@
 LOCALES += en_US.UTF-8
  LOCALESRC_en_US.UTF-8 = en_US.UTF-8
 
-LOCALES += es_ES.ISO8859-1
- LOCALESRC_es_ES.ISO8859-1 = en_US.ISO_8859-1
-
-LOCALES += es_ES.ISO8859-15
- LOCALESRC_es_ES.ISO8859-15 = en_US.DIS_8859-15
-
-LOCALES += es_ES.UTF-8
- LOCALESRC_es_ES.UTF-8 = en_US.UTF-8
+#http://en.wikipedia.org/wiki/List_of_countries_where_Spanish_is_an_official_language
+ES_COUNTRIES= AR BO CH CO CR CU DO EC ES GQ GT HN MX NI PA PE PR PY SV UY VE 
+ES_ENCODINGS= ISO8859-1 ISO8859-15 UTF-8
+.for c in ${ES_COUNTRIES}
+LOCALES += es_${c}.UTF-8
+LOCALESRC_es_${c}.UTF-8 = en_US.UTF-8
+LOCALES += es_${c}.ISO8859-1
+LOCALESRC_es_${c}.ISO8859-1 = en_US.ISO_8859-1
+LOCALES += es_${c}.ISO8859-15
+LOCALESRC_es_${c}.ISO8859-15 = en_US.DIS_8859-15
+.endfor
 
 LOCALES += fa_IR.UTF-8
  LOCALESRC_fa_IR.UTF-8 = en_US.UTF-8


Updating src/share/locale/ctype with NetBSD

2013-03-19 Thread Vladimir Támara Patiño

Attached --includes patch for spanish speaking countries.

--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html

diff -ruN -x obj -x CVS src53orig/share/locale/ctype/Makefile 
src/share/locale/ctype/Makefile
--- src53orig/share/locale/ctype/Makefile   Wed Jul 20 13:26:08 2011
+++ src/share/locale/ctype/Makefile Tue Mar 19 20:34:47 2013
@@ -80,15 +80,18 @@
 LOCALES += en_US.UTF-8
  LOCALESRC_en_US.UTF-8 = en_US.UTF-8
 
-LOCALES += es_ES.ISO8859-1
- LOCALESRC_es_ES.ISO8859-1 = en_US.ISO_8859-1
+#http://en.wikipedia.org/wiki/List_of_countries_where_Spanish_is_an_official_language
+ES_COUNTRIES= AR BO CH CO CR CU DO EC ES GQ GT HN MX NI PA PE PR PY SV UY VE 
+ES_ENCODINGS= ISO8859-1 ISO8859-15 UTF-8
+.for c in ${ES_COUNTRIES}
+LOCALES += es_${c}.UTF-8
+LOCALESRC_es_${c}.UTF-8 = en_US.UTF-8
+LOCALES += es_${c}.ISO8859-1
+LOCALESRC_es_${c}.ISO8859-1 = en_US.ISO_8859-1
+LOCALES += es_${c}.ISO8859-15
+LOCALESRC_es_${c}.ISO8859-15 = en_US.DIS_8859-15
+.endfor
 
-LOCALES += es_ES.ISO8859-15
- LOCALESRC_es_ES.ISO8859-15 = en_US.DIS_8859-15
-
-LOCALES += es_ES.UTF-8
- LOCALESRC_es_ES.UTF-8 = en_US.UTF-8
-
 LOCALES += fa_IR.UTF-8
  LOCALESRC_fa_IR.UTF-8 = en_US.UTF-8
 
@@ -191,6 +194,9 @@
 #LOCALES += ko_KR.eucKR
 # LOCALESRC_ko_KR.eucKR = ko_KR.eucKR
 
+LOCALES += kk_KZ.PT154
+ LOCALESRC_kk_KZ.PT154 = kk_KZ.PT154
+
 LOCALES += ko_KR.UTF-8
  LOCALESRC_ko_KR.UTF-8 = en_US.UTF-8
 
@@ -263,9 +269,13 @@
 LOCALES += sv_SE.UTF-8
  LOCALESRC_sv_SE.UTF-8 = en_US.UTF-8
 
+LOCALES += tr_TR.ISO8859-9
+ LOCALESRC_tr_TR.ISO8859-9 = tr_TR.ISO8859-9
+
 LOCALES += uk_UA.KOI8-U
  LOCALESRC_uk_UA.KOI8-U = uk_UA.KOI8-U
 
+
 #LOCALES += zh_CN.eucCN
 # LOCALESRC_zh_CN.eucCN = zh_CN.eucCN
 
@@ -274,6 +284,9 @@
 
 LOCALES += zh_CN.UTF-8
  LOCALESRC_zh_CN.UTF-8 = en_US.UTF-8
+
+LOCALES += zh_HK.Big5-HKSCS
+ LOCALESRC_zh_HK.Big5-HKSCS = zh_HK.Big5-HKSCS
 
 #LOCALES += zh_TW.Big5
 # LOCALESRC_zh_TW.Big5 = zh_TW.BIG5
diff -ruN -x obj -x CVS src53orig/share/locale/ctype/charset/JISX0201-right 
src/share/locale/ctype/charset/JISX0201-right
--- src53orig/share/locale/ctype/charset/JISX0201-right Sun Aug  7 05:03:45 2005
+++ src/share/locale/ctype/charset/JISX0201-right   Tue Mar 19 19:05:40 2013
@@ -1,12 +1,13 @@
-/* $NetBSD: JISX0201-right,v 1.1 2000/12/30 02:33:20 itojun Exp $  */
+/* $NetBSD: JISX0201-right,v 1.2 2006/04/11 18:45:03 tnozaki Exp $ */
 
 /*
  * JIS X0201 right Code Set (ESC ( I)
  */
 CHARSET(I
 
+PUNCT  0x0021 - 0x0025
 SPECIAL0x0021 - 0x005f
-PHONOGRAM  0x0021 - 0x005f
+PHONOGRAM  0x0026 - 0x005f
 CONTROL0x0004 - 0x0017 0x001b - 0x001f
 CONTROL0x0060 - 0x007e
 SWIDTH10x0021 - 0x005f
diff -ruN -x obj -x CVS src53orig/share/locale/ctype/charset/JISX0208-1978 
src/share/locale/ctype/charset/JISX0208-1978
--- src53orig/share/locale/ctype/charset/JISX0208-1978  Sun Aug  7 05:03:45 2005
+++ src/share/locale/ctype/charset/JISX0208-1978Tue Mar 19 19:06:00 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: JISX0208-1978,v 1.1 2000/12/30 02:33:20 itojun Exp $   */
+/* $NetBSD: JISX0208-1978,v 1.2 2006/04/11 18:45:03 tnozaki Exp $  */
 
 /*
  * JIS X0208-1978 - (ESC $ ( @ or ESC $ @)
@@ -7,6 +7,8 @@
 CHARSET$(@
 
 SPACE  0x2121
+BLANK  0x2121
+PRINT  0x2121
 PHONOGRAM  0x213c
 SPECIAL0x2122 - 0x217e
 PUNCT  0x2122 - 0x2178 /* A few too many in here... */
diff -ruN -x obj -x CVS src53orig/share/locale/ctype/charset/JISX0208-1983 
src/share/locale/ctype/charset/JISX0208-1983
--- src53orig/share/locale/ctype/charset/JISX0208-1983  Sun Aug  7 05:03:45 2005
+++ src/share/locale/ctype/charset/JISX0208-1983Tue Mar 19 19:06:11 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: JISX0208-1983,v 1.1 2000/12/30 02:33:20 itojun Exp $   */
+/* $NetBSD: JISX0208-1983,v 1.2 2006/04/11 18:45:03 tnozaki Exp $  */
 
 /*
  * JIS X0208-1983 - (ESC $ ( B or ESC $ B)
@@ -6,6 +6,8 @@
 CHARSET$(B
 
 SPACE  0x2121
+BLANK  0x2121
+PRINT  0x2121
 PHONOGRAM  0x213c
 SPECIAL0x2122 - 0x217e
 PUNCT  0x2122 - 0x2178 /* A few too many in here... */
diff -ruN -x obj -x CVS src53orig/share/locale/ctype/en_US.UTF-8.src 
src/share/locale/ctype/en_US.UTF-8.src
--- src53orig/share/locale/ctype/en_US.UTF-8.srcSat Feb  9 14:27:36 2013
+++ src/share/locale/ctype/en_US.UTF-8.src  Tue Mar 19 19:07:05 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: en_US.UTF-8.src,v 1.4 2005/02/10 18:12:42 tnozaki Exp $
*/
+/* $NetBSD: en_US.UTF-8.src,v 1.5 2012/08/08 18:40:37 tnozaki Exp $
*/
 /* $FreeBSD: /repoman/r/ncvs/src/share/mklocale/UTF-8.src,v 1.1 2004/03/27 
08:14:14 tjr Exp $  */
 
 /*
@@ -491,9 +491,9 @@
  * U+0300 - U+036F : Combining Diacritical Marks
  */
 
-GRAPH 0x0300 - 0x034e  0x0350 - 0x036f

Problem chaning board with RTL8169SC

2013-03-17 Thread Vladimir Támara Patiño
In a firewall I was using for long time two cards RTL8169SC with 
5.2 on a board MSI M7312K9MM-V, today we changed the board to Asrock H55M-LE 
( http://www.asrock.com/mb/Intel/H55M-LE/?cat=Specifications ), and

the network cards refused to work, re0 would generate during boot:
Mar 16 19:42:46 beth /bsd: re0: PHY write failed
Mar 16 19:42:46 beth /bsd: re0: reset never completed!

I had two replace with two network cards with  RTL8169S and RTL8169
and with them everything is working right.

In the moment I cannot reproduce the errors because the hardware is used
in production, but wanted to report.


--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html



wcscoll.3 and wcsxfrm.3

2013-03-15 Thread Vladimir Támara Patiño

Attached are versions of those man pages based on FreeBSD.


--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html

diff -ruN -x CVS -x obj -x *~ src53orig/lib/libc/locale/Makefile.inc 
src/lib/libc/locale/Makefile.inc
--- src53orig/lib/libc/locale/Makefile.inc  Sat Mar  9 11:16:47 2013
+++ src/lib/libc/locale/Makefile.incFri Mar 15 23:17:14 2013
@@ -15,7 +15,9 @@
btowc.3 mblen.3 mbrlen.3 mbrtowc.3 mbsinit.3 mbsrtowcs.3 \
mbstowcs.3 mbtowc.3 wcrtomb.3 wcsrtombs.3 wcstod.3 wcstol.3 \
wcstombs.3 wctob.3 wctomb.3 \
-   wctype.3 iswctype.3 wctrans.3 towctrans.3 wcwidth.3
+   wctype.3 iswctype.3 wctrans.3 towctrans.3 wcwidth.3 \
+   wcscoll.3 wcsxfrm.3
+
 MLINKS+=setlocale.3 localeconv.3 \
iswalnum.3 iswalpha.3 \
iswalnum.3 iswblank.3 \
diff -ruN -x CVS -x obj -x *~ src53orig/lib/libc/locale/wcscoll.3 
src/lib/libc/locale/wcscoll.3
--- src53orig/lib/libc/locale/wcscoll.3 Wed Dec 31 19:00:00 1969
+++ src/lib/libc/locale/wcscoll.3   Fri Mar 15 23:20:53 2013
@@ -0,0 +1,100 @@
+.\ Copyright (c) 1990, 1991, 1993
+.\The Regents of the University of California.  All rights reserved.
+.\
+.\ This code is derived from software contributed to Berkeley by
+.\ Chris Torek and the American National Standards Committee X3,
+.\ on Information Processing Systems.
+.\
+.\ Redistribution and use in source and binary forms, with or without
+.\ modification, are permitted provided that the following conditions
+.\ are met:
+.\ 1. Redistributions of source code must retain the above copyright
+.\notice, this list of conditions and the following disclaimer.
+.\ 2. Redistributions in binary form must reproduce the above copyright
+.\notice, this list of conditions and the following disclaimer in the
+.\documentation and/or other materials provided with the distribution.
+.\ 4. Neither the name of the University nor the names of its contributors
+.\may be used to endorse or promote products derived from this software
+.\without specific prior written permission.
+.\
+.\ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\ ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\ SUCH DAMAGE.
+.\
+.\ @(#)strcoll.3  8.1 (Berkeley) 6/4/93
+.\ FreeBSD: src/lib/libc/string/strcoll.3,v 1.11 2001/10/01 16:09:00 ru Exp
+.\ $FreeBSD: src/lib/libc/string/wcscoll.3,v 1.3 2007/01/09 00:28:12 imp Exp $
+.\
+.Dd October 4, 2002
+.Dt WCSCOLL 3
+.Os
+.Sh NAME
+.Nm wcscoll
+.Nd compare wide strings according to current collation
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In wchar.h
+.Ft int
+.Fn wcscoll const wchar_t *s1 const wchar_t *s2
+.Sh DESCRIPTION
+The
+.Fn wcscoll
+function compares the null-terminated strings
+.Fa s1
+and
+.Fa s2
+according to the current locale collation order.
+In the
+.Dq Li C
+locale,
+.Fn wcscoll
+is equivalent to
+.Fn wcscmp .
+.Sh RETURN VALUES
+The
+.Fn wcscoll
+function
+returns an integer greater than, equal to, or less than 0,
+if
+.Fa s1
+is greater than, equal to, or less than
+.Fa s2 .
+.Pp
+No return value is reserved to indicate errors;
+callers should set
+.Va errno
+to 0 before calling
+.Fn wcscoll .
+If it is non-zero upon return from
+.Fn wcscoll ,
+an error has occurred.
+.Sh ERRORS
+The
+.Fn wcscoll
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EILSEQ
+An invalid wide character code was specified.
+.It Bq Er ENOMEM
+Cannot allocate enough memory for temporary buffers.
+.El
+.Sh SEE ALSO
+.Xr setlocale 3 ,
+.Xr strcoll 3 ,
+.Xr wcscmp 3 ,
+.Xr wcsxfrm 3
+.Sh STANDARDS
+The
+.Fn wcscoll
+function
+conforms to
+.St -isoC-99 .
diff -ruN -x CVS -x obj -x *~ src53orig/lib/libc/locale/wcsxfrm.3 
src/lib/libc/locale/wcsxfrm.3
--- src53orig/lib/libc/locale/wcsxfrm.3 Wed Dec 31 19:00:00 1969
+++ src/lib/libc/locale/wcsxfrm.3   Fri Mar 15 23:21:09 2013
@@ -0,0 +1,99 @@
+.\ Copyright (c) 1990, 1991, 1993
+.\The Regents of the University of California.  All rights reserved.
+.\
+.\ This code is derived from software contributed to Berkeley by
+.\ Chris Torek and the American National Standards Committee X3,
+.\ on Information Processing Systems.
+.\
+.\ Redistribution and use in source and binary forms, with or without
+.\ modification, are permitted provided

Order in variables of lib/libc/locale/Makefile.inc

2013-03-09 Thread Vladimir Támara Patiño

For example lib/libc/string/Makefile.inc has values of
SRCS, MAN and MLINK ordered alphabetically, making easier
to know where to add new values to those variables.

Trying the same with lib/libc/locale/Makefile with attached patch.


--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html

--- Makefile.inc.orig   Sat Mar  9 11:16:47 2013
+++ Makefile.incSat Mar  9 11:21:13 2013
@@ -3,21 +3,27 @@
 # locale sources
 .PATH: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/locale ${LIBCSRCDIR}/locale
 
-SRCS+= btowc.c _def_messages.c _def_monetary.c _def_numeric.c _def_time.c \
-   localeconv.c nl_langinfo.c setlocale.c iswctype.c __mb_cur_max.c \
-   mblen.c mbrlen.c mbstowcs.c mbtowc.c multibyte_citrus.c wcscoll.c \
-   wcstombs.c wctob.c wctomb.c wcstof.c wcstod.c wcstold.c wcstol.c \
-   wcstoul.c wcstoll.c wcstoull.c wcstoimax.c wcstoumax.c \
-   setrunelocale.c runeglue.c rune.c runetable.c ___runetype_mb.c \
-   _wctrans.c wcsxfrm.c
+SRCS+= btowc.c \
+   _def_messages.c _def_monetary.c _def_numeric.c _def_time.c \
+   iswctype.c localeconv.c __mb_cur_max.c \
+   mblen.c mbrlen.c mbstowcs.c mbtowc.c \
+   multibyte_citrus.c nl_langinfo.c \
+   rune.c runeglue.c runetable.c ___runetype_mb.c \
+   setrunelocale.c setlocale.c \
+   _wctrans.c wcscoll.c wcstoimax.c wcstod.c wcstof.c \
+   wcstol.c wcstold.c wcstoll.c wcstombs.c wcstoul.c wcstoull.c \
+   wcstoumax.c wcsxfrm.c wctob.c wctomb.c 
 
-MAN+=  nl_langinfo.3 setlocale.3 iswalnum.3 towlower.3 \
-   btowc.3 mblen.3 mbrlen.3 mbrtowc.3 mbsinit.3 mbsrtowcs.3 \
-   mbstowcs.3 mbtowc.3 wcrtomb.3 wcsrtombs.3 wcstod.3 wcstol.3 \
-   wcstombs.3 wctob.3 wctomb.3 \
-   wctype.3 iswctype.3 wctrans.3 towctrans.3 wcwidth.3
-MLINKS+=setlocale.3 localeconv.3 \
-   iswalnum.3 iswalpha.3 \
+MAN+=   btowc.3 iswalnum.3 iswctype.3 \
+   mblen.3 mbrlen.3 mbrtowc.3 \
+   mbsinit.3 mbsrtowcs.3 mbstowcs.3 mbtowc.3 \
+   nl_langinfo.3 setlocale.3 \
+   towctrans.3 towlower.3 \
+   wcrtomb.3 wcsrtombs.3 \
+   wcstod.3 wcstol.3 wcstombs.3 \
+   wctob.3 wctomb.3 wctrans.3 wctype.3 wcwidth.3
+
+MLINKS+= iswalnum.3 iswalpha.3 \
iswalnum.3 iswblank.3 \
iswalnum.3 iswcntrl.3 \
iswalnum.3 iswdigit.3 \
@@ -28,15 +34,16 @@
iswalnum.3 iswspace.3 \
iswalnum.3 iswupper.3 \
iswalnum.3 iswxdigit.3 \
+   mbsrtowcs.3 mbsnrtowcs.3 \
+   setlocale.3 localeconv.3 \
towlower.3 towupper.3 \
+   wcsrtombs.3 wcsnrtombs.3 \
wcstod.3 wcstof.3 \
wcstod.3 wcstold.3 \
wcstol.3 wcstoul.3 \
wcstol.3 wcstoll.3 \
wcstol.3 wcstoull.3 \
wcstol.3 wcstoimax.3 \
-   wcstol.3 wcstoumax.3 \
-   mbsrtowcs.3 mbsnrtowcs.3 \
-   wcsrtombs.3 wcsnrtombs.3
+   wcstol.3 wcstoumax.3 
 
 CFLAGS+=-I${.CURDIR} -I${LIBCSRCDIR}/citrus


Removing unnecessary assert from lib/libc/locale/wcscoll.c

2013-03-09 Thread Vladimir Támara Patiño

--- /usr/src53orig/lib/libc/locale/wcscoll.cSat Feb  9 14:26:52 2013
+++ wcscoll.c   Sat Mar  9 22:44:07 2013
@@ -27,7 +27,6 @@
 * SUCH DAMAGE.
 */

-#include assert.h

#include wchar.h
  
/*



--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html



One line fix for _citrus_none_ctype_wcrtomb

2013-03-07 Thread Vladimir Támara Patiño
Working on collations again (based on FreeBSD implementation) and reading 
wcrtomb I see that return value of wcrtomb should be either positive or 
(size_t)-1, then:


diff -ruN src53orig/lib/libc/citrus/citrus_none.c
src53coll/lib/libc/citrus/citr
us_none.c
--- src53orig/lib/libc/citrus/citrus_none.c Sat Feb  9 14:26:51 2013
+++ src53coll/lib/libc/citrus/citrus_none.c Sat Mar  2 06:59:58 2013
@@ -115,7 +115,7 @@
/* ps appears to be unused */

if (s == NULL)
-   return (0);
+   return (1);

if (wc  0 || wc  0xff) {
errno = EILSEQ;



--
Dios, gracias por tu amor infinito.
--  
 Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/

 http://www.pasosdejesus.org/dominio_publico_colombia.html