#ifndef lint
#endif
/*
* Copyright (c) 2000,2002 Japan Network Information Center.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set forth bellow.
*
* LICENSE TERMS AND CONDITIONS
*
* The following License Terms and Conditions apply, unless a different
* license is obtained from Japan Network Information Center ("JPNIC"),
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
* Chiyoda-ku, Tokyo 101-0047, Japan.
*
* 1. Use, Modification and Redistribution (including distribution of any
* under this License Terms and Conditions.
*
* 2. Redistribution of source code must retain the copyright notices as they
* appear in each source code file, this License Terms and Conditions.
*
* 3. Redistribution in binary form must reproduce the Copyright Notice,
* materials provided with the distribution. For the purposes of binary
* distribution the "Copyright Notice" refers to the following language:
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
*
* 4. The name of JPNIC may not be used to endorse or promote products
* derived from this Software without specific prior written approval of
* JPNIC.
*
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
* "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 JPNIC 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 DAMAGES.
*/
#include <config.h>
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <idn/converter.h>
#include "util.h"
#include "selectiveencode.h"
extern int line_number;
{
for (;;) {
int len;
idn_result_t r;
char save;
/*
* Find the region that needs conversion.
*/
®ion_end);
if (r == idn_notfound) {
/*
* Not found. Just copy the whole thing.
*/
return (idn_buffer_overflow);
return (idn_success);
} else if (r != idn_success) {
/* This should not happen.. */
errormsg("internal error at line %d: %s\n",
return (r);
}
/*
* We have found a region to convert.
* First, copy the prefix part verbatim.
*/
errormsg("internal buffer overflow at line %d\n",
return (idn_buffer_overflow);
}
/*
* Terminate the region with NUL.
*/
save = *region_end;
*region_end = '\0';
/*
* Encode the region.
*/
/*
* Restore character.
*/
*region_end = save;
if (r != idn_success)
return (r);
from = region_end;
}
}
{
char *domain_name;
char *ignored_chunk;
char save;
int len;
idn_result_t r;
/*
* While `*from' points to a character in a string which may be
* a domain name, `domain_name' refers to the beginning of the
* domain name.
*/
domain_name = NULL;
/*
* We ignore chunks matching to the regular expression:
* [\-\.][0-9A-Za-z\-\.]*
*
* While `*from' points to a character in such a chunk,
* `ignored_chunk' refers to the beginning of the chunk.
*/
for (;;) {
if (*from == '-') {
/*
* We don't recognize `.-' as a part of domain name.
*/
if (domain_name != NULL) {
domain_name = NULL;
}
} else if (ignored_chunk == NULL) {
}
} else if (*from == '.') {
/*
* We don't recognize `-.' nor `..' as a part of
* domain name.
*/
if (domain_name != NULL) {
domain_name = NULL;
}
} else if (ignored_chunk == NULL) {
}
domain_name = from;
} else {
if (ignored_chunk != NULL) {
/*
* `from' reaches the end of the ignored chunk.
* Copy the chunk to `to'.
*/
return (idn_buffer_overflow);
} else if (domain_name != NULL) {
/*
* `from' reaches the end of the domain name.
* Decode the domain name, and copy the result
* to `to'.
*/
*from = '\0';
if (r == idn_success) {
} else if (r == idn_invalid_encoding) {
return (idn_buffer_overflow);
} else {
return (r);
}
}
/*
* Copy a character `*from' to `to'.
*/
if (tolen < 1)
return (idn_buffer_overflow);
to++;
tolen--;
domain_name = NULL;
if (*from == '\0')
break;
}
from++;
}
return (idn_success);
}
void
idn_result_t r;
errormsg("error setting default configuration: %s\n",
idn_result_tostring(r));
exit(1);
}
}
void
idn_result_t r;
errormsg("error reading configuration file: %s\n",
idn_result_tostring(r));
exit(1);
}
}
void
idn_result_t r;
if ((r = idn_converter_resetalias()) != idn_success) {
errormsg("cannot reset alias information: %s\n",
idn_result_tostring(r));
exit(1);
}
errormsg("cannot read alias file %s: %s\n",
exit(1);
}
}
void
idn_result_t r;
if (r != idn_success) {
errormsg("cannot create converter for codeset %s: %s\n",
code, idn_result_tostring(r));
exit(1);
}
}
void
idn_result_t r;
if (r != idn_success) {
errormsg("cannot create converter for codeset %s: %s\n",
code, idn_result_tostring(r));
exit(1);
}
}
void
int ndelimiters) {
idn_result_t r;
if (r != idn_success) {
errormsg("cannot add delimiter: %s\n",
idn_result_tostring(r));
exit(1);
}
}
void
idn_result_t r;
/* Add mapping. */
(const char **)mappers,
nmappers);
if (r != idn_success) {
errormsg("cannot add local map: %s\n",
idn_result_tostring(r));
exit(1);
}
}
void
idn_result_t r;
if (r != idn_success) {
errormsg("error setting nameprep %s: %s\n",
version, idn_result_tostring(r));
exit(1);
}
}
void
idn_result_t r;
/* Configure mapper. */
nmappers);
if (r != idn_success) {
errormsg("cannot add nameprep map: %s\n",
idn_result_tostring(r));
exit(1);
}
}
void
idn_result_t r;
(const char **)normalizers,
if (r != idn_success) {
errormsg("cannot add normalizer: %s\n",
idn_result_tostring(r));
exit(1);
}
}
void
idn_result_t r;
(const char **)prohibits,
if (r != idn_success) {
errormsg("cannot add prohibit checker: %s\n",
idn_result_tostring(r));
exit(1);
}
}
void
idn_result_t r;
(const char **)unassigns,
if (r != idn_success) {
errormsg("cannot add unassigned checker: %s\n",
idn_result_tostring(r));
exit(1);
}
}
void
}
/*
* Dynamic Stirng Buffer Utility
*/
void
/*
* Initialize the given string buffer.
* Caller must allocate the structure (idnconv_strbuf_t)
* as an automatic variable or by malloc().
*/
}
void
/*
* Reset the given string buffer.
* Free memory allocated by this utility, and
* re-initialize.
*/
}
}
char *
/*
* Get the pointer of the buffer.
*/
}
/*
* Get the allocated size of the buffer.
*/
}
char *
/*
* Copy STR to BUF.
*/
return (NULL);
}
char *
/*
* Append STR to the end of BUF.
*/
char *p;
if (p != NULL)
return (p);
}
char *
/*
* Reallocate the buffer of BUF if needed
* so that BUF can hold SIZE bytes of data at least.
*/
char *p;
return (NULL);
} else {
return (NULL);
}
}
char *
/*
* Double the size of the buffer of BUF.
*/
}
char *
/*
* Read a line from FP.
*/
char s[256];
return (NULL);
}
return (NULL);
}