5 /* mail_command_client 3
7 /* single-command client
9 /* #include <mail_proto.h>
11 /* int mail_command_client(class, name, type, attr, ...)
17 /* This module implements a client interface for single-command
18 /* clients: a client that sends a single command and expects
19 /* a single completion status code.
23 /* Service type: MAIL_CLASS_PUBLIC or MAIL_CLASS_PRIVATE
25 /* Service name (master.cf).
26 /* .IP "type, attr, ..."
27 /* Attribute information as defined in attr_print(3).
29 /* The result is -1 if the request could not be sent, otherwise
30 /* the result is the status reported by the server.
31 /* Warnings: problems connecting to the requested service.
32 /* Fatal: out of memory.
34 /* attr_print(3), send attributes over byte stream
35 /* mail_command_server(3), server interface
36 /* mail_proto(3h), client-server protocol
40 /* The Secure Mailer license must be distributed with this software.
43 /* IBM T.J. Watson Research
45 /* Yorktown Heights, NY 10598, USA
51 #include <stdlib.h> /* 44BSD stdarg.h uses abort() */
54 /* Utility library. */
60 #include <mail_proto.h>
62 /* mail_command_client - single-command transaction with completion status */
64 int mail_command_client(const char *class, const char *name
,...)
71 * Talk a little protocol with the specified service.
73 if ((stream
= mail_connect(class, name
, BLOCKING
)) == 0)
76 status
= attr_vprint(stream
, ATTR_FLAG_NONE
, ap
);
79 || attr_scan(stream
, ATTR_FLAG_STRICT
,
80 ATTR_TYPE_INT
, MAIL_ATTR_STATUS
, &status
, 0) != 1)
82 (void) vstream_fclose(stream
);