Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

malloc(3C)

mbchar(3W)

widec(3W)

malloc(3X)

wstring(3W)                    04 Jun 1992                      wstring(3W)

NAME
     wstring: wscat, wsncat, wscmp, wsncmp, wscpy, wsncpy, wslen, wschr,
     wsrchr, wspbrk, wsspn, wscspn, wstok, wstostr, strtows - wchar_t
     string operations and type transformation

SYNOPSIS
     #include <widec.h>
     wchart *wscat(wchart *s1, wchart *s2);
     wchart *wsncat(wchart *s1, wchart *s2, int n);
     int wscmp(wchart *s1, wchart *s2);
     int wsncmp(wchart *s1, wchart *s2, int n);
     wchart *wscpy(wchart *s1, wchart *s2);
     wchart *wsncpy(wchart *s1, wchart *s2, int n);
     int wslen(wchart *s);
     wchart *wschr(wchart *s, int c);
     wchart *wsrchr(wchart *s, int c);
     wchart *wspbrk(wchart *s1, wchart *s2);
     int wsspn(wchart *s1, wchart *s2);
     int wscspn(wchart *s1, wchart *s2);
     wchart *wstok(wchart *s1, wchart *s2);
     char *wstostr(char *s1, wchart *s2);
     wchart *strtows(wchart *s1, char *s2);

DESCRIPTION (International Functions)
     The arguments s1, s2 and s point to wchart strings (that is, arrays
     of wchart characters terminated by a wchart null character). The
     functions wscat(), wsncat(), wscpy() and wsncpy() all modify s1. These
     functions do not check for an overflow condition of the array pointed
     to by s1.

     wscat() appends a copy of the wchart string s2 to the end of the
     wchart string s1. wsncat() appends at most n wchart characters. Each
     function returns s1.

     wscmp() compares its arguments and returns an integer less than, equal
     to, or greater than 0, depending on whether s1 is less than, equal to,
     or greater than s2. wsncmp() makes the same comparison but inspects
     most n wchart characters.

     wscpy() copies wchart string s2 to s1, stopping after the wchart
     null character has been copied. wsncpy() copies exactly n wchart
     characters, truncating s2 or adding wchart null characters to s1, if
     necessary. The result will not be wchart null-terminated if the
     length of s2 is n or more. Each function returns s1.

     wslen() returns the number of wchart characters in s, not including
     the terminating wchart null character.

     wschr() [wsrchr()] returns a pointer to the first [last] occurrence of
     wchart character c in wchart string s, or a null pointer, if c does
     not occur in the string. The wchart null character terminating a
     string is considered to be part of the string.



Page 1                       Reliant UNIX 5.44                       6, 194

wstring(3W)                    04 Jun 1992                      wstring(3W)

     wspbrk() returns a pointer to the first occurrence in wchart string
     s1 of any wchart character from wchart string s2, or a null pointer
     if there is no wchart character from s2 in s1.

     wsspn() [wscspn()] returns the length of the initial segment of
     wchart string s1, which consists [does not consist] entirely of
     wchart characters from wchart string s2.

     wstok() considers the wchart string s1 to consist of a sequence of
     zero or more text tokens, separated by spans of one or more wchart
     characters from the separator wchart string s2. The first call (with
     the pointer s1 specified) returns a pointer to the first wchart char-
     acter of the first token, and writes a wchart null character into s1
     immediately following the returned token. The function keeps track of
     its position in the wchart string between separate calls, so that
     subsequent calls (which must be made with the first argument a null
     pointer) will progress through the wchart string s1 immediately fol-
     lowing that token. Similarly, subsequent calls will progress through
     the wchart string s1 until no tokens remain. The wchart separator
     string s2 may be different from call to call. A null pointer is
     returned when no token remains in s1.

     wstostr() transforms wchart characters in wchart string s2 into EUC,
     and transfers them to character string s1, stopping after the wchart
     null character has been processed.

     strtows() transforms EUC in character string s2 into wchart charac-
     ters, and transfers them to wchart string s1, stopping after the null
     character has been processed.

DIAGNOSTICS
     On success, wstostr() and strtows() return s1. If an illegal byte
     sequence is detected, a null pointer is returned and errno is set to
     EILSEQ.

NOTES
     These functions can support either typedef unsigned short wchart or
     typedef long wchart conditionally, see mbchar(3W).

SEE ALSO
     malloc(3C), mbchar(3W), widec(3W), malloc(3X).













Page 2                       Reliant UNIX 5.44                       6, 194

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