The apastec program
apastec is a program that reads one or more files, or its standard input, and sends them to a preopened file descriptor.
Interface
apastec [ -r rtimeout ] [ -w wtimeout ] file...
- apastec expects to have, in addition to standard file descriptors 0, 1 and 2, its file descriptors 6 and 7 open and connected to a remote apasted server.
- For every file given as argument, it sends the contents of file over the network. If file is - (dash), then apastec's stdin is transmitted until EOF.
- The server answers with a blob of six printable characters, named a slug. Depending on the server configuration, it may embed the slug in a complete URL, for easy copy-paste into a browser; or it may embed it in another way.
- apastec prints the slug to its stdout, then exits 0.
Exit codes
- 0
- Success. The data has been recorded by the server and available in some way as indicated by the slug.
- 100
- Bad usage. apaste was run in an incorrect way.
- 111
- System call failed. This usually signals an issue with the underlying operating system, or with the network in some way.
Options
- -r rtimeout
- If the server isn't answering with a slug within rtimeout milliseconds, give up. The default is 0, meaning infinite: apastec will wait forever for a server reply if necessary.
- -w wtimeout
- If the server hasn't accepted all the data within wtimeout milliseconds, give up. The default is 0, meaning infinite: apastec will take as much time as it needs to send its data.
Typical usage
apastec isn't meant to be used directly. It is meant to be invoked as part of a command line crafted by the apaste command, where programs from the s6-networking package establish the connection to the server, then exec into apastec to read the user's data and transmit them with the apaste protocol.
Notes
- -, i.e. stdin, cannot be mentioned several times as an argument. It can be transmitted with other files, but cannot be duplicated.
