catgets(3)
โจ catgets(3) โจ
okay bestie, welcome to the Library Functions Manual ๐ this is the page for catgets, and it's literally the "get me one message out of a message catalog" girlie. no cap, she's small but she's iconic. ๐
๐ธ NAME ๐ธ
catgets โ get a message from a message catalog ๐ฆ
๐ LIBRARY ๐
Standard C library (that's libc, aka -lc) ๐ซถ
โจ SYNOPSIS โจ
#include <nl_types.h>
char *catgets(nl_catd catalog, int set_number, int message_number,
const char *message);
๐ DESCRIPTION ๐
so here's the vibe ๐ catgets() reads message number message_number, inside set number set_number, out of the message catalog identified by catalog.
and where does catalog come from? it's a catalog descriptor you already got back from an earlier call to catopen(3). yes queen, you gotta call that one first, that's the whole pipeline ๐
the fourth argument, message, points to a default message string โ and that's what catgets() hands back to you if the message catalog it's looking for is not currently available. it's giving "backup plan but make it a pointer" ๐
big important tea ๐: the message text lives in an internal buffer area, so if you wanna save it or modify it, you (the application) have to copy it. don't go messing with the buffer, bestie, that's not yours ๐
and the return string is always terminated with a null byte ('\0'). every single time. periodt. ๐ฏ
โญ RETURN VALUE โญ
on success ๐ฅณ catgets() returns a pointer to an internal buffer area holding the null-terminated message string.
on failure ๐ญ catgets() returns the value message.
that's it, that's the whole deal. simple, clean, slay.
๐ฆ ATTRIBUTES ๐ฆ
for the explanation of the terms used in this section, go peek at attributes(7) ๐
catgets()โ Thread safety โMT-Safe๐
so yeah, she's MT-Safe. multiple threads can vibe with her at once, no drama. ๐ธ
๐ STANDARDS ๐
POSIX.1-2008.
๐ HISTORY ๐
POSIX.1-2001.catgets()is available only inlibc.so.4.4.4cand above. โญ- the Jan 1987 X/Open Portability Guide specifies a more subtle error return:
messageis returned if the message catalog specified bycatalogis not available, while an empty string is returned when the message catalog is available but does not contain the specified message. ๐ณ two different failure flavors! - those two possible error returns seem to be discarded in SUSv2 in favor of always returning
message. so yeah, the subtlety got dropped, and now it's just alwaysmessage. ๐
๐ SEE ALSO ๐
okay that's the whole page, you're officially educated ๐ง๐ this was Linux man-pages 6.20, dated 2026-02-08, for catgets(3) โ go forth and localize your messages, bestie, i'm obsessed with you ๐ซถโจ
๐ฆ where this page comes from
- arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- ๐ the page's license: Linux-man-pages-copyleft
- Copyright 1993, Mitchum DSouza <m.dsouza@mrc-apu.cam.ac.uk>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms