JSTRING(3J) — UNIX Programmer’s Manual
NAME
jstrncat, jstrcmp, jstrncmp, jstrncpy, jstrlen, jindex, jrindex, jstrtok, jstradv, jstrmatch, jstrskip, btom, mtob − Japanese string operations
SYNOPSIS
#include <jstrings.h>
char ∗jstrncat(s1, s2, n)
char ∗s1, ∗s2;
. . .
DESCRIPTION
In this section, MOJI counts are used for KANJI or KATAKANA(EUC) strings instead of byte count. One MOJI-count means 2 byte.
If the second byte of 2-byte code is the null character, the first byte is regarded as the null character. Other codes, even if they are illigal, in the second byte are considered the component of the 2-byte code. There are no error checkings. (Exceptions, see bellow).
If you want to use EUC kanji code, a funciton, set_syskanji("euc"), should be called before using these functions.
char ∗jstradv(s, n)
char ∗s;
Jstradv returns the pointer to n-th MOJI-count in string s. It returns s if n is negative. In case of overflow of the string, it returns the null pointer.
int jstrcmp(s1, s2)
int jstrncmp(s1, s2, n)
char ∗s1, ∗s2;
They are the Kanji version of strcmp and strncmp. They return an integer greater than, equal to, or less than 0, depending on the string order ASCII < KATAKANA < KANJI. In jstrncmp, argument n is the MOJI-count.
int jstrlen(s)
char ∗s;
This is the Kanji version of strlen. Jstrlen returns the number of non-null MOJIs in string s. Two byte Kanji or Katakana(EUC) is counted as one MOJI-count.
char ∗jstrmatch(s, anys)
char ∗string, ∗anys;
char ∗jstrskip(s, notanys)
char ∗s, ∗notays;
jstrmatch returns the pointer to the first character in string s that matches any of characters specified by anys. Jstrskip returns the poniter to the first character in string s that does not match any of characters specified by notanys. In case of failure, they return zero.
char ∗jstrncat(s1, s2, n)
char ∗s1, ∗s2;
This is the Kanji version of strncat. Jstrncat appends the first n MOJIs of s2 to the end of s1. Two byte Kanji or Katakana is counted as one MOJI-count.
char ∗jstrncpy(s1, s2, n)
char ∗s1, ∗s2;
This is the Kanji version of strncpy. Jstrncpy copies s2 to s1. It copies exactly n MOJIs, truncating or null-padding s2; the target may not be null-terminated if the length of s2 is n or more. Two byte Kanji or Katakana is counted as one MOJI-count.
char ∗jstrtok(string, sepset)
char ∗string, ∗sepset;
Returns a pointer to the first token separated by sepset. In sucessive call with string of NULL, it returns pointer of the next token to the previous return. If string consumed, it returns NULL at last. All tokens are null terminated; and string is destroyed.
char ∗jindex(s, c)
char ∗jrindex(s, c)
char ∗s;
unsigned short c;
They are the Kanji version of index and rindex. Jindex returns the pointer to the first position of c in string s. The argument c can be used Kana/Kanji character, in this case, c needs unsigned short value as Kanji code. Jrindex returns the pointer to the last position of c in string.
int btom(string, nbyte) /∗ byte to moji ∗/
char ∗string;
int nbyte;
Btom returns the number of character in the string from the beginning to either string+nbyte or NULL whichever shorter. Two byte Kanji or Katakana is counted as one MOJI-count. Nbyte represents the number of byte. If string+nbyte points the second byte of Kanji character, that Kanji character is not counted. Returns 0 if nbyte is zero or negative.
int mtob(string, nmoji) /∗ moji to byte ∗/
char ∗string;
int nmoji;
mtob returns the number of byte from string up to nmoji MOJI, or the NULL terminated whichever shorter. Two byte Kanji or Katakana(EUC) is counted as one in nmoji.
FILES
/usr/include/jstrings.h
/lib/libc.a
SEE ALSO
jctype(3J), string(3), set_syscode(3J)
NEWS-OSRelease 3.3