LIBMAWK_INITIALIZE(3libmawk)

πŸ’– LIBMAWK_INITIALIZE πŸ’–

okay bestie, welcome to the libmawk corner of the manual β€” this is the 3libmawk page, and it's literally the "hi, hello, let's go" function of the whole library 🫢


✨ NAME ✨

libmawk_initialize β€” create a new libmawk context 🌱

like, spawn a fresh little mawk universe. main character energy fr.


🌸 SYNOPSIS 🌸

#include <libmawk.h>

mawk_state_t *libmawk_initialize(int s, char *argv[]);

yes she takes an int s and a char *argv[], and yes she gives you back a mawk_state_t *. iconic.


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so, libmawk_initialize() returns a pointer to a newly created libmawk context. brand new, still smells like fresh code, no cap πŸ’…

and here's the slay part: any amount of libmawk contexts can live in parallel in an application ✨ like, not just one, not two β€” any amount, all vibing at the same time in the same process. it's giving polycule of interpreters, honestly.

the arguments you pass are the same as for a command line mawk session. so whatever you'd hand to mawk in your terminal, that's what goes in here. that means:

  • Scripts are loaded β€” either from the command line, or from files using -f πŸ“„
  • Variables are set β€” with -v πŸŽ€
  • Special options are set β€” with -W βš™οΈ
  • and <pink>etc.</pink> β€” you know how it goes, the whole mawk command line experience 🌈

πŸ”₯ RETURN VALUE πŸ”₯

you get a pointer to a new libmawk context πŸ’–

or, and hear me out, NULL on error 😭 so pls check it, bestie, don't just rawdog that pointer, k?


πŸ‘‘ SEE ALSO πŸ‘‘

go read the stage one next, it's the sequel, and uninitialize is the "ok bye clean up after yourself" arc 🧚


and that's the whole page, periodt. this was libmawk manual, dated 2009-08-10 β€” the page itself is called LIBMAWK_INITIALIZE(3libmawk) and yeah, it's been serving since 2009 and still ate πŸ’œ bye bestie, go make some contexts ✨