1 /* 2 3 Copyright 1993, 1998 The Open Group 4 5 Permission to use, copy, modify, distribute, and sell this software and its 6 documentation for any purpose is hereby granted without fee, provided that 7 the above copyright notice appear in all copies and that both that 8 copyright notice and this permission notice appear in supporting 9 documentation. 10 11 The above copyright notice and this permission notice shall be included in 12 all copies or substantial portions of the Software. 13 14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 21 Except as contained in this notice, the name of The Open Group shall not be 22 used in advertising or otherwise to promote the sale, use or other dealings 23 in this Software without prior written authorization from The Open Group. 24 25 */ 26 27 /* 28 * Author: Ralph Mor, X Consortium 29 */ 30 31 #ifdef HAVE_CONFIG_H 32 #include <config.h> 33 #endif 34 #include <X11/SM/SMlib.h> 35 #include "SMlibint.h" 36 #include <stdio.h> 37 38 /* 39 * Free property 40 */ 41 42 void 43 SmFreeProperty(SmProp *prop) 44 { 45 if (prop) 46 { 47 int i; 48 49 if (prop->name) 50 free (prop->name); 51 if (prop->type) 52 free (prop->type); 53 if (prop->vals) 54 { 55 for (i = 0; i < prop->num_vals; i++) 56 if (prop->vals[i].value) 57 free (prop->vals[i].value); 58 free (prop->vals); 59 } 60 61 free (prop); 62 } 63 } 64 65 66 /* 67 * Free reason messages 68 */ 69 70 void 71 SmFreeReasons(int count, char **reasonMsgs) 72 { 73 if (reasonMsgs) 74 { 75 int i; 76 77 for (i = 0; i < count; i++) 78 free (reasonMsgs[i]); 79 80 free (reasonMsgs); 81 } 82 } 83 84 85 86 /* 88 * Smc informational functions 89 */ 90 91 int 92 SmcProtocolVersion(SmcConn smcConn) 93 { 94 return (smcConn->proto_major_version); 95 } 96 97 98 int 99 SmcProtocolRevision(SmcConn smcConn) 100 { 101 return (smcConn->proto_minor_version); 102 } 103 104 105 char * 106 SmcVendor(SmcConn smcConn) 107 { 108 return strdup(smcConn->vendor); 109 } 110 111 112 char * 113 SmcRelease(SmcConn smcConn) 114 { 115 return strdup(smcConn->release); 116 } 117 118 119 char * 120 SmcClientID(SmcConn smcConn) 121 { 122 return strdup(smcConn->client_id); 123 } 124 125 126 IceConn 127 SmcGetIceConnection(SmcConn smcConn) 128 { 129 return (smcConn->iceConn); 130 } 131 132 133 134 /* 136 * Sms informational functions 137 */ 138 139 int 140 SmsProtocolVersion(SmsConn smsConn) 141 { 142 return (smsConn->proto_major_version); 143 } 144 145 146 int 147 SmsProtocolRevision(SmsConn smsConn) 148 { 149 return (smsConn->proto_minor_version); 150 } 151 152 153 char * 154 SmsClientID(SmsConn smsConn) 155 { 156 return strdup(smsConn->client_id); 157 } 158 159 160 IceConn 161 SmsGetIceConnection(SmsConn smsConn) 162 { 163 return (smsConn->iceConn); 164 } 165