libinn_clientlib(3)
π clientlib β the NNTP clientlib part of the InterNetNews library
okay so first things first, bestie: this page lives in the InterNetNews docs, volume 3, and it's literally titled libinn_clientlib(3). Welcome to the group chat π«Ά
β¨ SYNOPSIS β¨
#include <inn/libinn.h>
extern FILE *ser_rd_fp;
extern FILE *ser_wr_fp;
extern char ser_line[];
extern char *getserverbyfile(char *file UNUSED);
extern int server_init(char *host, int port);
extern int handle_server_response(int response, char *host);
extern void put_server(const char *text);
extern int get_server(char *buff, int buffsize);
extern void close_server(void);
π¦ DESCRIPTION π¦
So the routines on this page are part of the InterNetNews library, libinn(3). They're the replacements for the clientlib part of the NNTP distribution, and they exist so you can go build news clients with them. It's giving "glow-up era" honestly π
π getserverbyfile
This one retrieves the value of the server parameter in inn.conf β or the value of the NNTPSERVER environment variable if that's set β and hands it back as the name of the local NNTP server. It returns a pointer to static space. And the file parameter? Completely ignored, no cap. inn.conf is forced. π
π server_init
server_init opens a connection to the NNTP server at the specified host, in reader mode. It returns the server's response code, or -1 on error. If a connection was made, then ser_rd_fp and ser_wr_fp can be used to read from and write to the server respectively, and ser_line will contain the server's response β though lowkey you should use the way more convenient put_server and get_server functions instead. iykyk β¨
π handle_server_response
This icon decodes the response code, which comes from the server on host. If the client is authorized, it returns 0. A client that's only allowed to read is still authorized, but handle_server_response will print a message on the standard output. If the client is not authorized to talk to the server, then a message gets printed and the routine returns -1. Not me getting rejected π
π put_server
Sends text to the server, adding the necessary NNTP line terminators, and flushing the I/O buffer. Slay, flushes are important π
π get_server
Reads a line of text from the server into buff, reading at most buffsize characters. Any trailing \r\n terminators are stripped off. get_server returns -1 on error and 0 on success. Clean, iconic, periodt. π
π close_server
Sends a QUIT command to the server and closes the connection. Say bye bestie π
πΈ HISTORY πΈ
Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews. Rewritten into POD by Julien Elie. shoutout to the legends π«Ά
π SEE ALSO π
ngl, everything above is straight from the InterNetNews docs β INN 2.7.4, dated 2022-07-10. Now go build your news client, bestie, and remember: QUIT before you ghost the server πβ¨
π¦ where this page comes from
- arch rolling: inn 2.7.4-4 Β· ISC
- epel 10: inn-devel 2.7.4-5.el10_3 Β· ISC AND BSD-3-Clause AND BSD-4-Clause AND FSFAP AND (GPL-1.0-or-later OR Artistic-1.0-Perl) AND GPL-3.0-or-later WITH Bison-exception-2.2 AND LicenseRef-Fedora-Public-Domain AND MIT AND NTP
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms