1CLIENTLIB(3)               Library Functions Manual               CLIENTLIB(3)
2
3
4

NAME

6       clientlib - NNTP clientlib part of InterNetNews library
7

SYNOPSIS

9       extern FILE          *ser_rd_fp;
10       extern FILE          *ser_wr_fp;
11       extern char          ser_line[];
12
13       char *
14       getserverbyfile(char *file UNUSED);
15
16       int
17       server_init(char *host, int port);
18
19       int
20       handle_server_response(int response, char *host);
21
22       void
23       put_server(const char *buff);
24
25       int
26       get_server(char *buff, int buffsize);
27
28       void
29       close_server(void);
30

DESCRIPTION

32       The routines described in this manual page are part of the InterNetNews
33       library, libinn(3).  They are replacements for the  ``clientlib''  part
34       of  the NNTP distribution, and are intended to be used in building pro‐
35       grams like rrn.
36
37       Getserverbyfile calls GetConfigValue to get the name of the local  NNTP
38       server.   It  returns a pointer to static space.  The file parameter is
39       ignored.
40
41       Server_init opens a connect to the NNTP server at the  specified  host.
42       It  returns the server's response code or -1 on error.  If a connection
43       was made, then ser_rd_fp and ser_wr_fp can be used  to  read  from  and
44       write  to  the  server,  respectively,  and  ser_line  will contain the
45       server's response.  Ser_line can also be used in other routines.
46
47       Handle_server_response decodes  the  response,  which  comes  from  the
48       server  on  host.  If the client is authorized, it returns 0.  A client
49       that is only allowed to read is authorized, but  handle_server_response
50       will  print  a  message  on  the standard output.  If the client is not
51       authorized to talk to the server, then a message  is  printed  and  the
52       routine returns -1.
53
54       Put_server  sends  the text in buff to the server, adding the necessary
55       NNTP line terminators, and flushing the I/O buffer.
56
57       Get_server reads a line of text from the server into buff,  reading  at
58       most  buffsize  characters.  Any trailing \r\n terminators are stripped
59       off.  Get_server returns -1 on error.
60
61       Close_server sends a ``quit'' command to the server and closes the con‐
62       nection.
63

HISTORY

65       Written  by  Rich  $alz <rsalz@uunet.uu.net> for InterNetNews.  This is
66       revision 10281, dated 2018-05-14.
67

SEE ALSO

69       libinn(3).
70
71
72
73                                                                  CLIENTLIB(3)
Impressum