Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ jrindex(3J) — NEWS-os 4.1C

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

jctype(3J)

string(3)

setlocale(3)

JSTRING(3J)  —  NEWS-OS Programmer’s Manual

NAME

jstrncat, jstrcmp, jstrncmp, jstrncpy, jstrlen, jindex, jrindex, jstrtok, jstradv, jstrmatch, jstrskip, btom, mtob − multibyte character string operations

SYNOPSIS

#include <jstrings.h>

char ∗jstrncat(s1, s2, n)
char ∗s1, ∗s2;
.....

DESCRIPTION

These functions handle multibyte character strings not with byte count but with character count.  The functions in string(3) handle character strings with byte count.

You can use these functions for either Shift-JIS code, EUC, ISO 88859-1, or TCA code after calling setlocale(LC_CTYPE, ""). 

char ∗jstradv(s, n)
char ∗s;

jstradv returns the pointer to n-th character 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;

These are a multibyte character version of strcmp and strncmp. They return an integer greater than, equal to, or less than 0, depending the result of string comparison using the character order ASCII < KATAKANA < KANJI. In jstrncmp, argument n is a character count. 

int jstrlen(s)
char ∗s;

This is a multibyte character version of strlen. jstrlen returns the number of non-null characters in string s.

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 a multibyte character version of strncat. jstrncat appends the first n characters of s2 to the end of s1.

char ∗jstrncpy(s1, s2, n)
char ∗s1, ∗s2;

This is a multibyte character version of strncpy. jstrncpy copies s2 to s1. It copies exactly n characters, truncating or null-padding s2; the target may not be null-terminated if the length of s2 is n or more. 

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;

These are a multibyte character version of index and rindex. jindex returns the pointer to the first position of c in string s. 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.  nbyte represents the number of byte.  If string + nbyte points the second byte of 2-byte-code character, that 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 characters, or the NULL terminated whichever shorter. 

FILES

/usr/include/jstrings.h
/lib/libc.a

SEE ALSO

jctype(3J), string(3), setlocale(3)

NEWS-OSRelease 4.1C

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026