LIBMAWK_APPEND_INPUT(3libmawk)

πŸ’– LIBMAWK_APPEND_INPUT πŸ’–

ok so this is libmawk_append_input(3libmawk) from the libmawk manual, bestie, and it's literally the "here's some input, go off" function. sit down, grab a strawberry, we're doing this πŸ“


✨ NAME ✨

libmawk_append_input β€” append a string to an input buffer πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <libmawk.h>

void libmawk_append_input(mawk_state_t *m, const char *input_str);

void libmawk_append_ninput(mawk_state_t *m, const char *input, intlen);

🌸 DESCRIPTION 🌸

okok so libmawk_append_input() and libmawk_append_ninput() are the two functions that let your application go fill up the input buffer of a libmawk context. it's giving "you bring the bytes, awk does the rest" πŸ’…

here's the tea tho: no record separator gets appended. literally none. only the exact bytes you donate via input_str or input. which means β€” and this is actually so useful β€” you can append partial records if you want. slay 🫢

another thing: appending to the input does not have the side effect of any script being run. nope, nothing fires yet. it's just chillin' in the buffer. so you can call libmawk_append_input() as many times as you want before you ever call libmawk_run_main(). and that latter one? that's the call that actually lets the script process the input buffer. that's the main character moment πŸ‘‘

the only difference between the two calls is the input format, periodt:

  • libmawk_append_input() β€” expects a nul-terminated string.
  • libmawk_append_ninput() β€” takes arbitrary binary data plus its length.

oh and the argument m? that's a libmawk context that you already got back from libmawk_initialize() or libmawk_initialize_stage3(). don't just make one up bestie, it has to come from there πŸ™ˆ


🌈 SEE ALSO 🌈


and that's the whole page, no cap πŸ’œ this was LIBMAWK_APPEND_INPUT(3libmawk) from the libmawk manual, dated 2009-08-10, source libmawk. go forth and append, icon πŸ’–βœ¨πŸŽ€