1 | /* This file is part of the Project Athena Global Message System. |
---|
2 | * Created by: Mark W. Eichin <eichin@athena.mit.edu> |
---|
3 | * $Source: /afs/dev.mit.edu/source/repository/athena/bin/gms/get_a_message.c,v $ |
---|
4 | * $Author: vrt $ |
---|
5 | * |
---|
6 | * Copyright (c) 1988 by the Massachusetts Institute of Technology. |
---|
7 | * For copying and distribution information, see the file |
---|
8 | * "mit-copyright.h". |
---|
9 | */ |
---|
10 | #include <mit-copyright.h> |
---|
11 | #ifndef lint |
---|
12 | static char rcsid_get_a_message_c[] = "$Header: /afs/dev.mit.edu/source/repository/athena/bin/gms/get_a_message.c,v 1.2 1994-04-30 13:17:25 vrt Exp $"; |
---|
13 | #endif lint |
---|
14 | |
---|
15 | #include "globalmessage.h" |
---|
16 | |
---|
17 | |
---|
18 | /* return 0 status if the message is returned at all, else an error |
---|
19 | * code of some sort. |
---|
20 | */ |
---|
21 | #ifndef ultrix |
---|
22 | #include <syslog.h> |
---|
23 | #else |
---|
24 | #include <nsyslog.h> |
---|
25 | #endif |
---|
26 | |
---|
27 | Code_t get_a_message(buf) |
---|
28 | char **buf; |
---|
29 | { |
---|
30 | Code_t status; |
---|
31 | int size; |
---|
32 | char **server; |
---|
33 | |
---|
34 | status = get_servername(&server); |
---|
35 | if(!status) { |
---|
36 | status = get_message_from_server(buf, &size, server[0]); |
---|
37 | } |
---|
38 | |
---|
39 | if(status){ |
---|
40 | syslog(LOG_INFO, "GMS get server failed, %s", error_message(status)); |
---|
41 | } |
---|
42 | |
---|
43 | if(!status) { |
---|
44 | status = put_fallback_file(*buf, size, GMS_MESSAGE_NAME); |
---|
45 | /* but we don't really care what it is, the message is ok */ |
---|
46 | if(status) |
---|
47 | syslog(LOG_INFO, "GMS put failed, %s", error_message(status)); |
---|
48 | return(0); |
---|
49 | } |
---|
50 | |
---|
51 | status = get_fallback_file(buf, &size, GMS_MESSAGE_NAME); |
---|
52 | if(status) { |
---|
53 | syslog(LOG_INFO, "GMS put failed, %s", error_message(status)); |
---|
54 | /* we have no message at all... */ |
---|
55 | return(status); |
---|
56 | } else { |
---|
57 | return(0); |
---|
58 | } |
---|
59 | } |
---|