ppd_file_new_from_filep(3)

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

πŸ’– ppd_file_new_from_filep β€” Library Functions Manual, section 3 πŸ’–

okay bestie, pull up a chair, because today we're learning how to make a ppd_file_t out of a PPD file and honestly? it's giving parser era ✨


🌸 NAME 🌸

ppd_file_new_from_filep, ppd_file_new_from_fd, ppd_file_new β€” these three cuties parse a ppd file and load it into the ppd_file_t structure. that's it, that's the job. no cap πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <ppd.h>

ppd_file_t *ppd_file_new_from_filep(FILE* fp");"

ppd_file_t *ppd_file_new_from_fd(int fd");"

ppd_file_t *ppd_file_new(const char * filename");"

(yes the signatures literally look like that, i don't make the rules, i just report them fr fr πŸ™ˆ)


πŸ¦‹ DESCRIPTION πŸ¦‹

so like, the ppd_file_new_from_filep function parses the specified PPD file. that's the whole vibe. it takes your file, reads it, and turns it into something the library can actually work with. iconic behavior honestly πŸ‘‘


✨ RETURN VALUES ✨

when everything goes right (as it should, main character energy only), ppd_file_new_from_filep, ppd_file_new_from_fd, and ppd_file_new all hand you back a ppd_file_t pointer. slay 🫢

but if things go sideways? NULL comes back instead, and errno gets set. the possibilities are:

  • ENODEV β€” the FILE pointer you passed into ppd_file_new_from_filep, or the file descriptor you passed into ppd_file_new_from_fd, is NULL. like bestie, you gave it nothing 😭
  • EBADF β€” the file doesn't appear to be a PPD file. it's giving imposter syndrome πŸ’€
  • ENOTTY β€” no idea what these errors are. probably PPD parse errors. the manpage said it, not me, and i respect the honesty ngl πŸ™ˆ

and also, other errors can be returned in errno by a failure in fdopen or fopen. so keep an eye on that too, okay? πŸ‘€


🌈 SEE ALSO 🌈


lowkey the entire plot of this page is "parse the file, get a pointer, or get NULL and an errno". but the way that it's still a whole journey?? obsessed πŸ’–

and that's a wrap, bestie πŸŽ€ this was the Linux Programmer's Manual, dated 14 July 2000 β€” yes she's vintage, and yes she still ate ✨ mwah, go parse something pretty πŸ’…

πŸ“¦ where this page comes from