xref: /illumos-gate/usr/src/man/man3c/setcat.3c (revision 6597d6fcfd3058014e6518bb93c97eb0a42b4c3e)
te
Copyright 1989 AT&T Copyright (c) 1998, Sun Microsystems, Inc. All Rights Reserved
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
SETCAT 3C "February 17, 2023"
NAME
setcat - define default catalog
SYNOPSIS
#include <pfmt.h>

char *setcat(const char *catalog);
DESCRIPTION
The setcat() function defines the default message catalog to be used by subsequent calls to gettxt(3C), lfmt(3C), or pfmt(3C) that do not explicitly specify a message catalog.

The catalog argument must be limited to 14 characters. These characters must be selected from a set of all characters values, excluding \e0 (null) and the ASCII codes for / (slash) and : (colon).

The setcat() function assumes that the catalog exists. No checking is done on the argument.

A null pointer passed as an argument will result in the return of a pointer to the current default message catalog name. A pointer to an empty string passed as an argument will cancel the default catalog.

If no default catalog is specified, or if catalog is an invalid catalog name, subsequent calls to gettxt(3C), lfmt(3C), or pfmt(3C) that do not explicitly specify a catalog name will use Message not found!!\en as default string.

RETURN VALUES
Upon successful completion, setcat() returns a pointer to the catalog name. Otherwise, it returns a null pointer.
EXAMPLES
Example 1 Example of setcat() function.
 setcat("test");
 gettxt(":10", "hello world\en")
ATTRIBUTES
See attributes(7) for descriptions of the following attributes:
ATTRIBUTE TYPE ATTRIBUTE VALUE
MT-Level MT-Safe
SEE ALSO
gettxt (3C), lfmt (3C), pfmt (3C), setlocale (3C), attributes (7), environ (7)