PAVLOV(3)
๐ PAVLOV(3) โจ โ like, the whole manual page, bestie
okay so first things first: this is a page from the System Management Commands manual, and honestly? it's giving "tiny language, big main character energy". sit down, grab a strawberry ๐, let's go.
๐ธ NAME ๐ธ
pavlov โ Simple expect/response command langauge
(yes, "langauge". that's how it's spelled in the original and I refuse to gaslight the archive ๐ )
๐ฆ SYNOPSIS ๐ฆ
#include <arpa2/pavlov.h>
int pavlov (
int fdin, int fdout,
char *progname, int argc, char *argv[] )
pavlov <arg>...
๐ DESCRIPTION ๐
so the pavlov(3) function is almost like a normal main() program, but with a lil glow-up โจ. instead of just getting stdin/stdout vibes, it takes input and output file descriptors directly โ fdin and fdout respectively. iconic.
and the way it handles arguments? a whole different agenda. instead of receiving the program name in argv[0], pavlov(3) expects it in the progname parameter. the use of argc and argv reflects this too โ the program name is not expected in argv[0], and instead the arguments start immediately. no filler intro, we go straight into the content, periodt.
the arguments you provide reveal the expectations and responses of the pavlov(3) function. each word is a simple operation, and will be executed in the order of appearance in the current program version. fr fr, it's just a list, read left to right.
the pavlov command is a straightforward wrapper around the library function, which is designed for use in programs that need an easily scriptable expectation/response interaction. the command form is mostly useful for testing and development โ think of it as the little sister who mostly hangs out at home ๐ฅ.
๐ COMMANDS ๐
the following commands are available, and yes, each one is a single word, no spaces, no drama:
?<regex>โ matches a POSIX extended regular expression against a message as it arrives overfdin. โ ๏ธ heads up: this assumes that the input is not manually typed, as it would be withchat(8), but is instead expected to arrive in bursts, like network packets. the<regex>form is case-sensitive but may have multiple lines; the^and$symbols will respectively match the beginning and end of any of these lines. as soon as a match is found within the message, this command finishes; otherwise, another message is awaited. so likeโฆ it waits, and waits, and then slays ๐!<text>โ prints the<text>tofdout. it will unescape backslashes in the usual manner. and lowkey a caveat: support for groups in a prior<regex>is not built into the current version ofpavlov(3). so don't try to be cute with capture groups, bestie, it's not that kind of party ๐@<msdelay>โ waits for the number of milli-seconds indicated in the numeric<msdelay>value. that's it. that's the whole vibe. a little nap ๐ด
โญ RETURN VALUE โญ
when the last command is completed without error, the function returns 0 and the program delivers that as its exit code. clean, flawless, ate ๐
any error causes the function to return 1 and set errno to something appropriate. the command will return this return value 1 as its exit code to aid any scripts wrapped around it, and it will print an error message to aid any human user. so: scripts get the number, humans get the words. everybody eats ๐ซถ
๐ EXAMPLE ๐
the smallest program for pavlov that runs to successful completion is an empty program. literally. simply running the command without arguments, or calling the function with argc set to zero would lead to an immediate 0 return code. no thoughts, head empty, exit zero โจ
a more typical sequence of commands would be pavlov ?bell @100 !drool to express that upon encountering the word bell on its input, the command should send out the word drool on its output after a 0.1 second delay. (that's 100 ms, honey, do the math on the @100 ๐งฎ)
the intention of pavlov(3) however, is to jump through the slightly variable hoops that textual protocols need to be jumped to get a STARTTLS command agreed on. once a TLS handshake is complete, protocols tend to start from scratch and forget the preceding unencrypted protocol. rude, but okay ๐
such a use case could be handled with a sequence such as this for an SMTP server:
?^220 .*$โ to match an SMTP server's welcome message,!EHLO orvelte.nepโ to send our mail server name and greet the server,?^250-STARTTLS$โ to await the option that we desire to use,?^250 .*$โ to wait for the end of the options,!STARTTLSโ to request a switch to TLS,?^220 .*$โ to await acceptance.
this kind of exchange can indeed be useful in combination with the tlstunnel(8) command. iykyk ๐ฅ
๐ AUTHOR ๐
Written by Rick van Rein of OpenFortress.nl, for the ARPA2.net project. Pavlov starts its life as part of the TLS Pool, but may start a life of its own if it is considered generally useful. main character energy from day one, honestly ๐ฆ
๐ REPORTING BUGS ๐
for any discussion, including about bugs, please use the TLS Pool mailing list found on http://lists.arpa2.org/mailman/listinfo/tls-pool. come chat, we don't bite (much) ๐
please read the software distribution's README, INSTALL and TODO files for information about the tlspool-daemon(8) implementation status. yes, all three, they're not decoration ๐
๐ COPYRIGHT ๐
Copyright ยฉ 2019 Rick van Rein, ARPA2.net.
ARPA2 is funded from InternetWide.org, which in turns receives donations from various funding sources with an interest in a private and secure Internet that gives users control over their online presence. pretty iconic mission statement ngl ๐โจ
๐ฅ SEE ALSO ๐ฅ
online resources may be found on the project home page, http://tlspool.arpa2.net. go click, it's cute over there ๐ธ
ok that's the whole page, every single detail intact, no cap. now go forth and make your protocols converse ๐
and that's the wrap, bestie โ brought to you by ARPA2.net, dated April 2019, on manual page PAVLOV(3). see you in the next group chat ๐๐
๐ฆ where this page comes from
- nixos 26.05: tlspool 0.9.7
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms