| 32 | |
| 33 | |
| 34 | int CLIB_ROUTINE main( int argc, char *argv[]) |
| 35 | { |
| 36 | /************************************** |
| 37 | * |
| 38 | * m a i n |
| 39 | * |
| 40 | ************************************** |
| 41 | * |
| 42 | * Functional description |
| 43 | * Initialize lock manager for process. |
| 44 | * |
| 45 | **************************************/ |
| 46 | if (argc < 2) |
| 47 | { |
| 48 | printf("usage: run_service service_path [args]\n"); |
| 49 | exit(FINI_ERROR); |
| 50 | } |
| 51 | |
| 52 | const char* service_path = argv[1]; |
| 53 | |
| 54 | char spb_buffer[2048]; |
| 55 | char* spb = spb_buffer; |
| 56 | const char* const spb_end = spb_buffer + sizeof(spb_buffer) - 1; |
| 57 | if (argc > 2) |
| 58 | { |
| 59 | *spb++ = isc_spb_version1; |
| 60 | *spb++ = isc_spb_command_line; |
| 61 | spb++; |
| 62 | for (argv += 2, argc -= 2; argc && spb < spb_end; --argc) |
| 63 | { |
| 64 | for (const char* p = *argv++; spb < spb_end && (*spb = *p++); spb++) |
| 65 | ; |
| 66 | *spb++ = ' '; |
| 67 | } |
| 68 | *--spb = 0; |
| 69 | fb_assert(spb < spb_end); |
| 70 | spb_buffer[2] = strlen(spb_buffer + 3); |
| 71 | } |
| 72 | |
| 73 | SLONG* handle = NULL; |
| 74 | isc_service_attach(NULL, 0, service_path, &handle, (SSHORT) (spb - spb_buffer), spb_buffer); |
| 75 | |
| 76 | SCHAR send_buffer[2048]; |
| 77 | |
| 78 | const char* send_items; |
| 79 | SSHORT send_item_length; |
| 80 | if (strstr(service_path, "start_cache")) |
| 81 | { |
| 82 | send_items = send_timeout; |
| 83 | send_item_length = sizeof(send_timeout); |
| 84 | } |
| 85 | else |
| 86 | { |
| 87 | send_items = send_buffer; |
| 88 | send_item_length = 0; |
| 89 | } |
| 90 | |
| 91 | if (send_item_length) |