source: trunk/athena/bin/get_message/get_a_message.c @ 14063

Revision 14063, 1.7 KB checked in by danw, 25 years ago (diff)
get_message, formerly in athena/bin/gms
RevLine 
[14063]1/* Copyright 1988, 1998 by the Massachusetts Institute of Technology.
2 *
3 * Permission to use, copy, modify, and distribute this
4 * software and its documentation for any purpose and without
5 * fee is hereby granted, provided that the above copyright
6 * notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting
8 * documentation, and that the name of M.I.T. not be used in
9 * advertising or publicity pertaining to distribution of the
10 * software without specific, written prior permission.
11 * M.I.T. makes no representations about the suitability of
12 * this software for any purpose.  It is provided "as is"
13 * without express or implied warranty.
14 */
15
16static const char rcsid[] = "$Id: get_a_message.c,v 1.1 1999-12-08 22:06:44 danw Exp $";
17
18#include "globalmessage.h"
19#include <syslog.h>
20#include <com_err.h>
21
22
23/* return 0 status if the message is returned at all, else an error
24 * code of some sort.
25 */
26
27Code_t get_a_message(char **buf)
28{
29  Code_t status;
30  int size;
31  char **server;
32
33  status = get_servername(&server);
34  if(!status) {
35    status = get_message_from_server(buf, &size, server[0]);
36  }
37
38  if(status){
39    syslog(LOG_INFO, "GMS get server failed, %s", error_message(status));
40  }
41
42  if(!status) {
43    status = put_fallback_file(*buf, size, GMS_MESSAGE_NAME);
44    /* but we don't really care what it is, the message is ok */
45    if(status)
46      syslog(LOG_INFO, "GMS put failed, %s", error_message(status));
47    return(0);
48  }
49
50  status = get_fallback_file(buf, &size, GMS_MESSAGE_NAME);
51  if(status) {
52    syslog(LOG_INFO, "GMS put failed, %s", error_message(status));
53    /* we have no message at all... */
54    return(status);
55  } else {
56    return(0);
57  }
58}
Note: See TracBrowser for help on using the repository browser.