libgnuregex: fix debug build.

Add missing "printchar.c", which is only used in DEBUG mode. The
function was recovered from original regex sources.

Note that the gnu regexp library is deprecated, and so is its
replacement, gnu rx. GNU suggests using the regex implementation from
the glibc, but that one isn't as portable.

Thanks to Andrew Lindesay for the investigations and initial patch!

Fixes #12952.
This commit is contained in:
Adrien Destugues 2016-10-16 11:34:15 +02:00
parent 534f22038c
commit 1e59399fd9
2 changed files with 44 additions and 0 deletions

View File

@ -2,6 +2,7 @@ SubDir HAIKU_TOP src build libgnuregex ;
BuildPlatformSharedLibrary libgnuregex_build.so :
regex.c
printchar.c
:
# no linked libraries here
;

View File

@ -0,0 +1,43 @@
/* Extended regular expression matching and search library,
version 0.12.
(Implements POSIX draft P10003.2/D11.2, except for
internationalization features.)
Copyright (C) 1993 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* (this file was downloaded from
* https://raw.githubusercontent.com/ge-ne/bibtool/master/regex-0.12/test/printchar.c ,
* where no copyright header is included).
*/
#ifdef DEBUG
void
printchar (c)
char c;
{
if (c < 040 || c >= 0177)
{
putchar ('\\');
putchar (((c >> 6) & 3) + '0');
putchar (((c >> 3) & 7) + '0');
putchar ((c & 7) + '0');
}
else
putchar (c);
}
#endif