snsplit,v0.3.8(8)

✨ snsplit β€” split an article stream into individual articles ✨

okay bestie, welcome to snsplit, version v0.3.8, straight out of the System Manager's Manual πŸ’… she's a tiny little program with big "cut the stream into pieces" energy and honestly? obsessed.


🌸 NAME 🌸

snsplit β€” split an article stream into individual articles πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

snsplit [-r] [field... -] prog...

like. that's it. that's the whole vibe. short king 🫢


πŸ’– DESCRIPTION πŸ’–

okay so here's the tea: snsplit reads an article stream from descriptor 0 and splits it into separate articles, then invokes prog... on each one, with the article available on descriptor 0. so every program you list gets handed one article at a time on its stdin. it's giving quick-and-dirty way of filtering an article stream β€” and we mean that as a compliment, lowkey. πŸ”₯

the incoming article stream is expected to be in wire format, bestie. that means:

  • lines ending in CRLF
  • leading dots doubled
  • delimited by a dot on a line by itself

then the article that actually gets presented to prog... is a whole different girl β€” she's been cleaned up:

  • her lines end in a bare newline
  • all her header lines are unfolded
  • leading dots are unstuffed
  • and she's terminated by end-of-file

so like, glow-up complete ✨ the wire format is the messy group-chat screenshots and what prog... sees is the polished carousel post. periodt.


πŸŽ€ ARGUMENTS πŸŽ€

  • prog... β€” is the program (with arguments) to run on each article. if prog... exits with any kind of failure, snsplit aborts. no second chances, no "maybe next article", she said nope πŸ’€
  • field... - β€” are optional header field names. if these are specified, the value of the first header field of that name will be exported into the environment. this field... list must be terminated by the hyphen. see also ENVIRONMENT below πŸ‘‡

✨ OPTIONS ✨

  • -r β€” expect input articles in rnews batch format instead. that's it. that's the only flag. she's minimal and she knows it 🌈

πŸ’œ ENVIRONMENT πŸ’œ

snsplit sets some environment variables, bestie. and if the environment already contains these variables, they will be overwritten β€” no negotiating, no asking, she just does it. πŸ™ˆ

  • SEQUENCE β€” if already set to a positive value, it is incremented for the first article. if it isn't set, it is set to one for the first article. thereafter it is incremented for each subsequent article. the value is always a 6-digit number with leading zeroes, and yes, it can roll over. little odometer energy πŸš—πŸ’¨
  • BYTES β€” contains the size of the current article.
  • HEAD_LINES β€” the number of lines in the head of the article, excluding the blank separator line.
  • BODY_LINES β€” the number of lines in the body of the article, excluding the blank separator line.
  • FLD_FIELD β€” if any fields are specified on the command line, where field is the name of an article header field, then FLD_FIELD will be set to the value of field, where FIELD is the same as field but with lower case characters changed to upper case, and all hyphens changed to underscores. confusing? yeah bestie, same 😭 here's the example: if field is message-id, then FLD_MESSAGE_ID will be set to the value of the first Message-ID field in the current article, if there is one.
so it's field in, SCREAMING_SNAKE_CASE out. the way that message-id becomes FLD_MESSAGE_ID… transformation of the century fr fr πŸ‘‘

πŸ”₯ EXIT CODES πŸ”₯

  • exits 0 on success πŸ’š
  • exits 1 on usage error
  • exits 2 on system error
  • exits 3 on article format error

and if prog... exits with other than 0, snsplit will also exit that value. she passes the message along, she's a good friend like that 🫢


🌟 SEE ALSO 🌟

okay there's genuinely nothing here in the original β€” no cross-references, no sibling pages. she stands alone. main character energy, no supporting cast πŸ’…βœ¨


🧚 N.B. 🧚

that's the whole page, bestie! every flag, every variable, every exit code, every CRLF β€” we kept it all. no cap.

and a lil cute sign-off: this iconic little manual page is brought to you by Harold Tay πŸŽ€ β€” from the System Manager's Manual, version snsplit,v0.3.8. slay, go filter some article streams, and remember: bare newline in, wire format out, iykyk πŸ’–πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from