Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35)

Standard preamble:
========================================================================
..
..
.. Set up some character translations and predefined strings. \*(-- will
give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
double quote, and \*(R" will give a right double quote. \*(C+ will
give a nicer C++. Capital omega is used to do unbreakable dashes and
therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
nothing in troff, for use with C<>.
.tr \(*W- . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\}
Escape single quotes in literal strings from groff's Unicode transform.

If the F register is >0, we'll generate index entries on stderr for
titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
entries marked with X<> in POD. Of course, you'll have to process the
output yourself in some meaningful fashion.

Avoid warning from groff about undefined register 'F'.
.. .nr rF 0 . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF
Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] .\} . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents . \" corrections for vroff . \" for low resolution devices (crt and lpr) \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} ========================================================================

Title "clientlib 3"
clientlib 3 "2021-12-20" "INN 2.7.0" "InterNetNews Documentation"
For nroff, turn off justification. Always turn off hyphenation; it makes
way too many mistakes in technical documents.
"NAME"
clientlib - NNTP clientlib part of InterNetNews library
"SYNOPSIS"
Header "SYNOPSIS" .Vb 1 #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); .Ve
"DESCRIPTION"
Header "DESCRIPTION" The routines described in this manual page are part of the InterNetNews library, libinn\|(3). They are replacements for the clientlib part of the \s-1NNTP\s0 distribution, and are intended to be used in building news clients.

The getserverbyfile function retrieves the value of the server parameter in inn.conf (or the value of the \*(C`NNTPSERVER\*(C' environment variable if set) as the name of the local \s-1NNTP\s0 server. It returns a pointer to static space. The file parameter is ignored (inn.conf is forced).

The server_init function opens a connection to the \s-1NNTP\s0 server at the specified host, in reader mode. It returns the server's response code or \*(C`-1\*(C' on error. If a connection was made, then ser_rd_fp and \fIser_wr_fp can be used to read from and write to the server, respectively, and ser_line will contain the server's response (though you should use the more convenient put_server and get_server functions instead).

The handle_server_response function decodes the response code, which comes from the server on host. If the client is authorized, it returns 0. A client that is only allowed to read is 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 is printed and the routine returns \*(C`-1\*(C'.

The put_server function sends text to the server, adding the necessary \s-1NNTP\s0 line terminators, and flushing the I/O buffer.

The get_server function reads a line of text from the server into buff, reading at most buffsize characters. Any trailing \*(C`\er\en\*(C' terminators are stripped off. get_server returns \*(C`-1\*(C' on error, 0 on success.

The close_server function sends a \*(C`QUIT\*(C' command to the server and closes the connection.

"HISTORY"
Header "HISTORY" Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews. Rewritten into \s-1POD\s0 by Julien Elie.
"SEE ALSO"
Header "SEE ALSO" \fBlibinn\|(3).