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"
20 /* Invoke a DCM update. */
22 int mr_do_update(void)
26 struct mr_params *params = NULL;
27 struct mr_params *reply = NULL;
31 params->mr_version_no = sending_version_no;
32 params->mr_procno = MR_DO_UPDATE;
34 params->mr_argl = NULL;
35 params->mr_argv = NULL;
37 if ((status = mr_do_call(params, &reply)) == 0)
38 status = reply->mr_status;
40 mr_destroy_reply(reply);
46 /* Get the Moira motd. This returns a Moira status, and motd will either
47 * point to NULL or the motd in a static buffer.
50 int mr_motd(char **motd)
54 struct mr_params *params = NULL;
55 struct mr_params *reply = NULL;
56 static char buffer[1024];
61 params->mr_version_no = sending_version_no;
62 params->mr_procno = MR_MOTD;
64 params->mr_argl = NULL;
65 params->mr_argv = NULL;
67 if ((status = mr_do_call(params, &reply)))
70 while ((status = reply->mr_status) == MR_MORE_DATA)
72 if (reply->mr_argc > 0)
74 strncpy(buffer, reply->mr_argv[0], sizeof(buffer));
77 mr_destroy_reply(reply);
80 initialize_operation(_mr_recv_op, mr_start_recv, &reply, NULL);
81 queue_operation(_mr_conn, CON_INPUT, _mr_recv_op);
83 complete_operation(_mr_recv_op);
84 if (OP_STATUS(_mr_recv_op) != OP_COMPLETE)
92 mr_destroy_reply(reply);
93 /* for backwards compatability */
94 if (status == MR_UNKNOWN_PROC)