3 * This routine is part of the client library. It handles
4 * the protocol operations: invoking an update and getting the
5 * Moira message of the day.
7 * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology
8 * For copying and distribution information, please see the file
12 #include <mit-copyright.h>
14 #include "mr_private.h"
22 /* Invoke a DCM update. */
24 int mr_do_update(void)
28 struct mr_params *params = NULL;
29 struct mr_params *reply = NULL;
33 params->mr_version_no = sending_version_no;
34 params->mr_procno = MR_DO_UPDATE;
36 params->mr_argl = NULL;
37 params->mr_argv = NULL;
39 if ((status = mr_do_call(params, &reply)) == 0)
40 status = reply->mr_status;
42 mr_destroy_reply(reply);
48 /* Get the Moira motd. This returns a Moira status, and motd will either
49 * point to NULL or the motd in a static buffer.
52 int mr_motd(char **motd)
56 struct mr_params *params = NULL;
57 struct mr_params *reply = NULL;
58 static char *buffer = NULL;
63 params->mr_version_no = sending_version_no;
64 params->mr_procno = MR_MOTD;
66 params->mr_argl = NULL;
67 params->mr_argv = NULL;
69 if ((status = mr_do_call(params, &reply)))
72 while ((status = reply->mr_status) == MR_MORE_DATA)
74 if (reply->mr_argc > 0)
76 buffer = realloc(buffer, reply->mr_argl[0] + 1);
82 strcpy(buffer, reply->mr_argv[0]);
85 mr_destroy_reply(reply);
88 initialize_operation(_mr_recv_op, mr_start_recv, &reply, NULL);
89 queue_operation(_mr_conn, CON_INPUT, _mr_recv_op);
91 complete_operation(_mr_recv_op);
92 if (OP_STATUS(_mr_recv_op) != OP_COMPLETE)
100 mr_destroy_reply(reply);
101 /* for backwards compatability */
102 if (status == MR_UNKNOWN_PROC)