1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
| #include <stdlib.h> | #include <SM/SMlib.h> | | //auxiliary function | void | callback( | SmcConn p1, | SmPointer p2, | int p3, | int p4, | int p5, | int p6){} | | //auxiliary function | void | callback_1(SmcConn p1, SmPointer p2){} | | int main(int argc, char *argv[]) | { | char networkIdsList [] = { | 'A', | 'B', | 'C', | 'D', | '\0'}; | SmPointer context = malloc(256); | SmPointer client_data = malloc(256); | SmPointer client_data_1 = malloc(256); | SmPointer client_data_2 = malloc(256); | SmPointer client_data_3 = malloc(256); | SmcCallbacks callbacks = { | .save_yourself = {.callback = &callback, .client_data = client_data}, | .die = {.callback = &callback_1, .client_data = client_data_1}, | .save_complete = {.callback = &callback_1, .client_data = client_data_2}, | .shutdown_cancelled = {.callback = &callback_1, .client_data = client_data_3}}; | SmcConn smcConn = SmcOpenConnection( | networkIdsList, | context, | 1, | 2, | 0, | &callbacks, | networkIdsList, | (char**)&networkIdsList, | 4, | networkIdsList); | SmPointer value = malloc(256); | SmPointer value_1 = malloc(256); | SmPointer value_2 = malloc(256); | SmPointer value_3 = malloc(256); | SmPropValue vals [] = { | (SmPropValue) {.length = 4, .value = value}, | (SmPropValue) {.length = 4, .value = value_1}, | (SmPropValue) {.length = 4, .value = value_2}, | (SmPropValue) {.length = 4, .value = value_3}, | (SmPropValue) {0}}; | SmProp prop = { | .name = "name", | .type = networkIdsList, | .num_vals = 3, | .vals = vals}; | SmProp* props [] = { | &prop, | &prop, | &prop, | &prop, | 0}; | SmcSetProperties(smcConn, 4, props); //target call | return 0; | } |
|