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 in libc.so.4.4.4c and above. โญ
  • the Jan 1987 X/Open Portability Guide specifies a more subtle error return: message is returned if the message catalog specified by catalog is 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 always message. ๐Ÿ’€

๐Ÿ’… 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
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms