]>
Commit | Line | Data |
---|---|---|
e2a67c78 | 1 | /* |
2 | * $Source$ | |
3 | * $Author$ | |
4 | * $Header$ | |
5 | * | |
6 | * Copyright (C) 1987 by the Massachusetts Institute of Technology | |
7 | * | |
8 | * This routine is part of the client library. It handles | |
9 | * creating a connection to the sms server. | |
10 | */ | |
11 | ||
12 | #ifndef lint | |
13 | static char *rcsid_sms_connect_c = "$Header$"; | |
14 | #endif lint | |
15 | ||
e2a67c78 | 16 | #include "sms_private.h" |
17 | ||
18 | /* | |
19 | * Open a connection to the sms server. | |
20 | */ | |
21 | ||
22 | int sms_connect() | |
23 | { | |
83e80378 | 24 | extern int errno; |
6c00b7c4 | 25 | |
83e80378 | 26 | if (!sms_inited) sms_init(); |
27 | if (_sms_conn) return SMS_ALREADY_CONNECTED; | |
28 | ||
29 | /* | |
30 | * * should do a hesiod call to find the sms machine name & service | |
31 | * * number/name. | |
32 | * */ | |
33 | /* XXX gdb doesn't give real return codes. Can we trust errno?*/ | |
34 | errno = 0; | |
35 | _sms_conn = start_server_connection(SMS_GDB_SERV, ""); | |
36 | if (_sms_conn == NULL) { | |
37 | return errno; | |
38 | } | |
39 | return 0; | |
e2a67c78 | 40 | } |
41 | ||
42 | int sms_disconnect() | |
43 | { | |
83e80378 | 44 | CHECK_CONNECTED; |
45 | _sms_conn = sever_connection(_sms_conn); | |
46 | return 0; | |
e2a67c78 | 47 | } |
48 | ||
49 | int sms_noop() | |
50 | { | |
83e80378 | 51 | int status; |
52 | sms_params param_st; | |
53 | struct sms_params *params = NULL; | |
54 | struct sms_params *reply = NULL; | |
e2a67c78 | 55 | |
83e80378 | 56 | CHECK_CONNECTED; |
57 | params = ¶m_st; | |
58 | params->sms_procno = SMS_NOOP; | |
59 | params->sms_argc = 0; | |
60 | params->sms_argl = NULL; | |
61 | params->sms_argv = NULL; | |
e2a67c78 | 62 | |
83e80378 | 63 | if ((status = sms_do_call(params, &reply)) == 0) |
64 | status = reply->sms_status; | |
ca401c43 | 65 | |
83e80378 | 66 | sms_destroy_reply(reply); |
6c00b7c4 | 67 | |
83e80378 | 68 | return status; |
6c00b7c4 | 69 | } |
83e80378 | 70 | |
71 | /* | |
72 | * Local Variables: | |
73 | * mode: c | |
74 | * c-indent-level: 4 | |
75 | * c-continued-statement-offset: 4 | |
76 | * c-brace-offset: -4 | |
77 | * c-argdecl-indent: 4 | |
78 | * c-label-offset: -4 | |
79 | * End: | |
80 | */ |