1CLIENTLIB(3) Library Functions Manual CLIENTLIB(3)
2
3
4
6 clientlib - NNTP clientlib part of InterNetNews library
7
9 extern FILE *ser_rd_fp;
10 extern FILE *ser_wr_fp;
11 extern char ser_line[];
12
13 char *
14 getserverbyfile(file)
15 char *file;
16
17 int
18 server_init(host)
19 char *host;
20
21 int
22 handle_server_response(response, host)
23 int reponse;
24 char *host;
25
26 void
27 put_server(text)
28 char *text;
29
30 int
31 get_server(buff, buffsize)
32 char *buff;
33 int buffsize;
34
35 void
36 close_server()
37
39 The routines described in this manual page are part of the InterNetNews
40 library, libinn(3). They are replacements for the ``clientlib'' part
41 of the NNTP distribution, and are intended to be used in building pro‐
42 grams like rrn.
43
44 Getserverbyfile calls GetConfigValue to get the name of the local NNTP
45 server. It returns a pointer to static space. The file parameter is
46 ignored.
47
48 Server_init opens a connect to the NNTP server at the specified host.
49 It returns the server's response code or -1 on error. If a connection
50 was made, then ser_rd_fp and ser_wr_fp can be used to read from and
51 write to the server, respectively, and ser_line will contain the
52 server's response. Ser_line can also be used in other routines.
53
54 Handle_server_response decodes the response, which comes from the
55 server on host. If the client is authorized, it returns 0. A client
56 that is only allowed to read is authorized, but handle_server_response
57 will print a message on the standard output. If the client is not
58 authorized to talk to the server, then a message is printed and the
59 routine returns -1.
60
61 Put_server sends the text in buff to the server, adding the necessary
62 NNTP line terminators, and flushing the I/O buffer.
63
64 Get_server reads a line of text from the server into buff, reading at
65 most buffsize characters. Any trailing \r\n terminators are stripped
66 off. Get_server returns -1 on error.
67
68 Close_server sends a ``quit'' command to the server and closes the con‐
69 nection.
70
72 Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews. This is
73 revision 6312, dated 2003-05-04.
74
76 libinn(3).
77
78
79
80 CLIENTLIB(3)