ppd_find_choice(3)

πŸ“¦ version 0.10, in debian bookworm, ubuntu jammy

πŸ’… ppd_find_choice β€” bestie edition

okay so this is a page from the Library Functions Manual, and it's literally all about three lil functions that hand you back pointers to choices from PPD files. no cap. if you're out here digging through PPD files looking for a specific option or choice, these three are your girls. πŸŽ€


✨ SYNOPSIS ✨

#include <ppd.h>

PpdChoice *ppd_find_choice (PpdOption *o, const char *choice);

PpdChoice *ppd_find_marked_choice (PpdFile *ppd, const char *keyword);

PpdOption *ppd_find_option_by_keyword (PpdFile *ppd, const char *keyword);

like, include the header first bestie, that's the vibe. 🌸


🌈 DESCRIPTION 🌈

so these three functions? they're the whole friend group that lets you, the programmer, get at the options and choices inside a PPD file. it's giving backstage pass energy. πŸ‘‘

πŸ’– PpdChoice *ppd_find_choice (PpdOption *o, const char *choice);

this one takes two parameters, periodt.

  1. a pointer to a PPD option structure β€” that's the *o
  2. the name of the choice you're tryna locate

that's it. that's the function. she's simple, she's iconic. ✨

πŸ¦‹ PpdChoice *ppd_find_marked_choice (PpdFile *ppd, const char *keyword);

this one wants a valid PpdFile pointer (go look at ppd_file_new(3) if you need one, iykyk) plus a keyword or option name that you're hunting for inside the PPD file. hand her both and she goes looking. πŸ”

πŸ‘‘ PpdOption *ppd_find_option_by_keyword (PpdFile *ppd, const char *keyword);

okay so this one takes two parameters that are identical to the ones you'd use when you call ppd_find_marked_choice() β€” same ppd, same keyword. BUT. and this is the important part bestie, don't skip it:

ppd_find_option_by_keyword() does not mark the designated option as being selected.

so she finds the option, but she does not claim it. she's just looking. no strings attached. πŸ’…


πŸŽ€ RETURN VALUE πŸŽ€

  • ppd_find_choice() β€” returns a pointer to an option choice, and NULL in the case of a failure 😭
  • ppd_find_marked_choice() β€” returns the marked choice for the specified option, and NULL in the case of a failure 😭
  • ppd_find_option_by_keyword() β€” returns a pointer to the specified option, and NULL in the case of a failure 😭

so yeah, if you get NULL back, something went sideways. check your args, bestie. 🫢


πŸ”₯ SEE ALSO πŸ”₯

these ones are the mutuals, go say hi:


πŸ’œ AUTHOR πŸ’œ

this man page was written by Gerald Carter <gcarter@valinux.com>. it was then updated by Mark Fasheh <mfasheh@valinux.com> to reflect the changes in libppd 0.5. and plot twist β€” some of the code for these functions was originally part of the Common UNIX Printing System (CUPS). iconic lineage fr fr. 🌟


and that's the whole page, bestie β€” this was ppd_find_choice(3) from the Library Functions Manual, brought to you by libppd and dated the way the footer says it. mwah, go find your choices. πŸ’‹πŸŽ€βœ¨

πŸ“¦ where this page comes from