5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#ifndef lint
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsstatic char *rcsid = "$Id: filechecker.c,v 1.1 2003/06/04 00:25:52 marka Exp $";
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#endif
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews/*
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * Copyright (c) 2001,2002 Japan Network Information Center.
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * All rights reserved.
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews *
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * By using this file, you agree to the terms and conditions set forth bellow.
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews *
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * LICENSE TERMS AND CONDITIONS
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews *
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * The following License Terms and Conditions apply, unless a different
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * license is obtained from Japan Network Information Center ("JPNIC"),
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * Chiyoda-ku, Tokyo 101-0047, Japan.
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews *
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * 1. Use, Modification and Redistribution (including distribution of any
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * modified or derived work) in source and/or binary forms is permitted
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * under this License Terms and Conditions.
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews *
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * 2. Redistribution of source code must retain the copyright notices as they
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * appear in each source code file, this License Terms and Conditions.
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews *
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * 3. Redistribution in binary form must reproduce the Copyright Notice,
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * this License Terms and Conditions, in the documentation and/or other
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * materials provided with the distribution. For the purposes of binary
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * distribution the "Copyright Notice" refers to the following language:
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews *
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * 4. The name of JPNIC may not be used to endorse or promote products
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * derived from this Software without specific prior written approval of
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * JPNIC.
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews *
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews */
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#include <config.h>
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#include <stdlib.h>
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#include <stdio.h>
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#include <string.h>
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#include <ctype.h>
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#include <idn/result.h>
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#include <idn/assert.h>
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#include <idn/log.h>
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#include <idn/logmacro.h>
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#include <idn/ucsset.h>
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#include <idn/filechecker.h>
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#include <idn/debug.h>
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#define SUPPORT_VERSIONING
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsstruct idn__filechecker {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews idn_ucsset_t set;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews};
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsstatic idn_result_t read_file(const char *file, FILE *fp,
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews idn_ucsset_t set);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsstatic int get_range(char *s, unsigned long *ucs1,
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews unsigned long *ucs2);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsstatic char *get_ucs(char *p, unsigned long *vp);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsidn_result_t
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsidn__filechecker_create(const char *file, idn__filechecker_t *ctxp) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews FILE *fp;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews idn__filechecker_t ctx;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews idn_result_t r;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews assert(file != NULL && ctxp != NULL);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews TRACE(("idn__filechecker_create(file=\"%-.100s\")\n", file));
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews if ((fp = fopen(file, "r")) == NULL) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews WARNING(("idn__filechecker_create: cannot open %-.100s\n",
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews file));
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (idn_nofile);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews }
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews if ((ctx = malloc(sizeof(struct idn__filechecker))) == NULL)
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (idn_nomemory);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews if ((r = idn_ucsset_create(&ctx->set)) != idn_success) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews free(ctx);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (r);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews }
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews r = read_file(file, fp, ctx->set);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews fclose(fp);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews if (r == idn_success) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews idn_ucsset_fix(ctx->set);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews *ctxp = ctx;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews } else {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews idn_ucsset_destroy(ctx->set);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews free(ctx);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews }
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (r);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews}
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsvoid
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsidn__filechecker_destroy(idn__filechecker_t ctx) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews assert(ctx != NULL);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews TRACE(("idn__filechecker_destroy()\n"));
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews idn_ucsset_destroy(ctx->set);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews free(ctx);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews}
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsidn_result_t
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsidn__filechecker_lookup(idn__filechecker_t ctx, const unsigned long *str,
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews const unsigned long **found) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews idn_result_t r = idn_success;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews assert(ctx != NULL && str != NULL);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews TRACE(("idn__filechecker_lookup(str=\"%s\")\n",
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews idn__debug_ucs4xstring(str, 50)));
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews while (*str != '\0') {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews int exists;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews r = idn_ucsset_lookup(ctx->set, *str, &exists);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews if (r != idn_success) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (r);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews } else if (exists) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews /* Found. */
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews *found = str;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (idn_success);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews }
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews str++;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews }
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews *found = NULL;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (idn_success);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews}
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsstatic idn_result_t
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsread_file(const char *file, FILE *fp, idn_ucsset_t set) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews char line[256];
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews idn_result_t r;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews int lineno = 0;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews while (fgets(line, sizeof(line), fp) != NULL) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews char *p = line;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews unsigned long ucs1, ucs2;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews lineno++;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews while (isspace((unsigned char)*p))
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews p++;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews if (*p == '\0' || *p == '#')
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews continue;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#ifdef SUPPORT_VERSIONING
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews /* Skip version tag. */
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews if (lineno == 1 && strncmp("version=", line, 8) == 0)
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews continue;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#endif
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews if (!get_range(p, &ucs1, &ucs2)) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews WARNING(("syntax error in file \"%-.100s\" line %d: "
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews "%-.100s", file, lineno, line));
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (idn_invalid_syntax);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews }
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews if ((r = idn_ucsset_addrange(set, ucs1, ucs2)) != idn_success)
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (r);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews }
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (idn_success);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews}
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsstatic int
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsget_range(char *s, unsigned long *ucs1, unsigned long *ucs2) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews if ((s = get_ucs(s, ucs1)) == NULL)
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (0);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews *ucs2 = *ucs1;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews switch (s[0]) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews case '\0':
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews case '\n':
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews case '#':
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews case ';':
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (1);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews case '-':
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews break;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews default:
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (0);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews }
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews if ((s = get_ucs(s + 1, ucs2)) == NULL)
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (0);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews if (*ucs1 > *ucs2) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews INFO(("idn__filechecker_create: invalid range spec "
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews "U+%X-U+%X\n", *ucs1, *ucs2));
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (0);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews }
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews switch (s[0]) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews case '\0':
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews case '\n':
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews case '#':
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews case ';':
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (1);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews default:
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (0);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews }
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews}
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsstatic char *
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsget_ucs(char *p, unsigned long *vp) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews char *end;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews /* Skip leading space */
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews while (isspace((unsigned char)*p))
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews p++;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews /* Skip optional 'U+' */
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews if (strncmp(p, "U+", 2) == 0)
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews p += 2;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews *vp = strtoul(p, &end, 16);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews if (end == p) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews INFO(("idn__filechecker_create: UCS code point expected\n"));
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (NULL);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews }
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews p = end;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews /* Skip trailing space */
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews while (isspace((unsigned char)*p))
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews p++;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return p;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews}
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsidn_result_t
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsidn__filechecker_createproc(const char *parameter, void **ctxp) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return idn__filechecker_create(parameter, (idn__filechecker_t *)ctxp);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews}
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsvoid
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsidn__filechecker_destroyproc(void *ctxp) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews idn__filechecker_destroy((idn__filechecker_t)ctxp);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews}
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsidn_result_t
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsidn__filechecker_lookupproc(void *ctx, const unsigned long *str,
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews const unsigned long **found) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return idn__filechecker_lookup((idn__filechecker_t)ctx, str, found);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews}