__private_extern__ void enable_service(int argc, char **argv) { SCNetworkServiceRef service; if (argc == 1) { service = _find_service(argv[0]); } else { if (net_service != NULL) { service = net_service; } else { SCPrint(TRUE, stdout, CFSTR("service not selected\n")); return; } } if (service == NULL) { return; } if (!SCNetworkServiceSetEnabled(service, TRUE)) { SCPrint(TRUE, stdout, CFSTR("%s\n"), SCErrorString(SCError())); return; } _prefs_changed = TRUE; return; }
__private_extern__ void do_dictRemoveKey(int argc, char **argv) { CFStringRef key; CFMutableDictionaryRef val; if (value == NULL) { SCPrint(TRUE, stdout, CFSTR("d.remove: dictionary must be initialized.\n")); return; } if (!isA_CFDictionary(value)) { SCPrint(TRUE, stdout, CFSTR("d.remove: data (fetched from configuration server) is not a dictionary.\n")); return; } val = CFDictionaryCreateMutableCopy(NULL, 0, value); CFRelease(value); value = val; key = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8); CFDictionaryRemoveValue((CFMutableDictionaryRef)value, key); CFRelease(key); return; }
static void nc_trigger(int argc, char **argv) { Boolean background = FALSE; int i; CFStringRef hostName = NULL; int port = 80; for (i = 0; i < 3 && i < argc; i++) { /* Parse host name. Must be first arg. */ if (i == 0) { hostName = CFStringCreateWithCString(NULL, argv[i], kCFStringEncodingUTF8); continue; } /* Check for optional background flag */ if (strcmp(argv[i], "background") == 0) { background = TRUE; continue; } /* Parse optional port number */ CFStringRef str = CFStringCreateWithCString(NULL, argv[i], kCFStringEncodingUTF8); if (str) { int num = CFStringGetIntValue(str); if (num) { port = num; } my_CFRelease(&str); } } if (hostName) { CFReadStreamRef readStream = NULL; CFWriteStreamRef writeStream = NULL; CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault, hostName, port, &readStream, &writeStream); if (background) { CFReadStreamSetProperty(readStream, CFSTR("kCFStreamNetworkServiceType"), CFSTR("kCFStreamNetworkServiceTypeBackground")); CFWriteStreamSetProperty(writeStream, CFSTR("kCFStreamNetworkServiceType"), CFSTR("kCFStreamNetworkServiceTypeBackground")); } if (readStream && writeStream) { CFReadStreamOpen(readStream); CFWriteStreamOpen(writeStream); SCPrint(TRUE, stdout, CFSTR("Opened stream to %@, port %d%s\n"), hostName, port, background ? ", background traffic class" : ""); sleep(1); } my_CFRelease(&readStream); my_CFRelease(&writeStream); } else { SCPrint(TRUE, stderr, CFSTR("Invalid or missing host name\n")); } my_CFRelease(&hostName); exit(0); }
/**************************************************************************** *功能:释放UDP通信器 ****************************************************************************/ int ReleaseUDPCommunicator(Communicator* p) { WaitForSingleObject(Connections::hUDPInitMutex,INFINITE); SCPrint(("%d:enter releasecomm\r\n",GetCurrentThreadId())); if(p->m_nCommtype==COMM_UDP) { p->m_nCommtype=NOT_CONNECT; if(p->udpConn->reference<=0) { p->udpConn->reference=0; ReleaseMutex(Connections::hUDPInitMutex); return SCERR_INVALID_COMM; } p->udpConn->reference--; if(p->udpConn->reference==0) { CloseUDPSocket(p->udpConn->s); Connections::udpCommManagerVector[p->csIndex].udpCommList.remove(p->udpConn); delete p->udpConn; SCPrint(("%d:delete udpconn:%08X\r\n",GetCurrentThreadId(),p->udpConn)); } SCPrint(("%d:delete communicatror:%08X,reference:%d\r\n",GetCurrentThreadId(),p,p->udpConn->reference)); memset(p,0,sizeof(Communicator)); delete p; ReleaseMutex(Connections::hUDPInitMutex); return 0; } SCPrint(("leave releasecomm\r\n")); ReleaseMutex(Connections::hUDPInitMutex); return SCERR_INVALID_COMM; }
__private_extern__ void do_dictShow(int argc, char **argv) { if (value == NULL) { SCPrint(TRUE, stdout, CFSTR("d.show: dictionary must be initialized.\n")); return; } SCPrint(TRUE, stdout, CFSTR("%@\n"), value); return; }
static int S_show_identities(int argc, char * argv[]) { int count; int i; CFArrayRef list; OSStatus status; status = EAPSecIdentityListCreate(&list); if (status != noErr) { fprintf(stderr, "EAPSecIdentityListCreate returned %ld\n", (long)status); return (-1); } count = CFArrayGetCount(list); printf("Number of identities: %d\n", count); for (i = 0; i < count; i++) { EAPSecIdentityHandleRef handle; SecIdentityRef identity; CFStringRef username; identity = (SecIdentityRef)CFArrayGetValueAtIndex(list, i); username = identity_copy_username(identity); SCPrint(TRUE, stdout, CFSTR("\n%d. '%@'\n"), i + 1, username); CFRelease(username); handle = EAPSecIdentityHandleCreate(identity); dump_as_xml(handle); CFRelease(handle); } CFRelease(list); return (0); }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ static void nc_enablevpn(int argc, char **argv) { CFStringRef argument = NULL; CFStringRef vendorType = NULL; int exit_code = 1; if (argc == 0) { SCPrint(TRUE, stderr, CFSTR("No service type or ID\n")); } else { argument = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8); vendorType = nc_copy_vendor_type(argument); my_CFRelease(&argument); if (!nc_enable_vpntype(vendorType)) { goto done; } #if !TARGET_OS_IPHONE if (argc >= 2) { argument = CFStringCreateWithCString(NULL, argv[1], kCFStringEncodingUTF8); nc_set_application_url(vendorType, argument); my_CFRelease(&argument); } #endif } exit_code = 0; done: my_CFRelease(&vendorType); exit(exit_code); }
static void nc_print_VPN_app_info(CFStringRef appInfo, CFDictionaryRef appInfoDict) { CFStringRef appName = NULL; Boolean isEnabled = FALSE; CFStringRef paddedAppInfo = NULL; CFStringRef paddedAppName = NULL; if (appInfo == NULL) { return; } isEnabled = VPNConfigurationIsVPNTypeEnabled(appInfo); CFDictionaryGetValueIfPresent(appInfoDict, CFSTR("CFBundleDisplayName"), (const void **)&appName); paddedAppName = copy_padded_string((appName == NULL) ? CFSTR("") : appName, 12, NULL, NULL); paddedAppInfo = copy_padded_string(appInfo, 30, NULL, NULL); SCPrint(TRUE, stdout, CFSTR("%@ %@ [%@]\n"), isEnabled ? CFSTR("(Enabled) ") : CFSTR("(Disabled)"), paddedAppName, appInfo); my_CFRelease(&paddedAppName); my_CFRelease(&paddedAppInfo); }
int main(int argc, char * argv[]) { CFDataRef duid; int i; interface_list_t * interfaces; CFMutableStringRef str; (void) openlog("DHCPDUIDIAID", LOG_PERROR | LOG_PID, LOG_DAEMON); interfaces = ifl_init(); ipconfigd_create_paths(); duid = DHCPDUIDGet(interfaces); if (duid == NULL) { fprintf(stderr, "Couldn't determine DUID\n"); exit(1); } str = CFStringCreateMutable(NULL, 0); DHCPDUIDPrintToString(str, (const DHCPDUIDRef)CFDataGetBytePtr(duid), CFDataGetLength(duid)); SCPrint(TRUE, stdout, CFSTR("%@\n"), str); CFRelease(str); if (argc > 1) { for (i = 1; i < argc; i++) { DHCPIAID iaid; iaid = DHCPIAIDGet(argv[i]); printf("%s = %d\n", argv[i], iaid); } } exit(0); return (0); }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ static void nc_select(int argc, char **argv) { SCNetworkSetRef current_set; int exit_code = 1; SCNetworkServiceRef service = NULL; Boolean status; do_prefs_init(); /* initialization */ do_prefs_open(0, NULL); /* open default prefs */ current_set = SCNetworkSetCopyCurrent(prefs); if (current_set == NULL) { SCPrint(TRUE, stderr, CFSTR("No current location\n"), SCErrorString(SCError())); goto done; } service = nc_copy_service_from_arguments(argc, argv, current_set); if (service == NULL) { SCPrint(TRUE, stderr, CFSTR("No service\n")); goto done; } #if !TARGET_OS_IPHONE status = SCNetworkServiceSetEnabled(service, TRUE); if (!status) { SCPrint(TRUE, stderr, CFSTR("Unable to enable service: %s\n"), SCErrorString(SCError())); goto done; } #else status = SCNetworkSetSetSelectedVPNService(current_set, service); if (!status) { SCPrint(TRUE, stderr, CFSTR("Unable to select service: %s\n"), SCErrorString(SCError())); goto done; } #endif _prefs_save(); exit_code = 0; done: my_CFRelease(&service); my_CFRelease(¤t_set); _prefs_close(); exit(exit_code); }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ static Boolean nc_enable_vpntype(CFStringRef vpnType) { Boolean is_enabled = FALSE; Boolean success = FALSE; if (vpnType == NULL) { SCPrint(TRUE, stderr, CFSTR("No VPN type provided\n")); goto done; } is_enabled = VPNConfigurationIsVPNTypeEnabled(vpnType); if (is_enabled) { SCPrint(TRUE, stdout, CFSTR("VPN is already enabled\n")); } else { #if !TARGET_OS_IPHONE AuthorizationRef authorization; authorization = _prefs_AuthorizationCreate(); if ((authorization == NULL) || !VPNConfigurationSetAuthorization(authorization)) { SCPrint(TRUE, stderr, CFSTR("VPNConfigurationSetAuthorization failed: %s\n"), SCErrorString(SCError())); goto done; } #endif // !TARGET_OS_IPHONE if (!VPNConfigurationEnableVPNType(vpnType)) { SCPrint(TRUE, stderr, CFSTR("VPN could not be enabled: %s\n"), SCErrorString(SCError())); goto done; } #if !TARGET_OS_IPHONE _prefs_AuthorizationFree(authorization); #endif // !TARGET_OS_IPHONE SCPrint(TRUE, stdout, CFSTR("VPN enabled\n")); } success = TRUE; done: return success; }
PRIVATE_EXTERN void inet6_addrlist_print(const inet6_addrlist_t * addr_list_p) { CFStringRef str; str = inet6_addrlist_copy_description(addr_list_p); SCPrint(TRUE, stdout, CFSTR("%@\n"), str); CFRelease(str); return; }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ static void nc_statistics(int argc, char **argv) { CFDictionaryRef stats_dict; nc_create_connection(argc, argv, TRUE); stats_dict = SCNetworkConnectionCopyStatistics(connection); if (stats_dict) { SCPrint(TRUE, stdout, CFSTR("%@\n"), stats_dict); } else { SCPrint(TRUE, stdout, CFSTR("No statistics available\n")); } my_CFRelease(&stats_dict); nc_release_connection(); exit(0); }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ static SCNetworkServiceRef nc_copy_service(SCNetworkSetRef set, CFStringRef identifier) { CFIndex i; CFIndex n; SCNetworkServiceRef selected = NULL; CFArrayRef services; services = SCNetworkConnectionCopyAvailableServices(set); if (services == NULL) { goto done; } n = CFArrayGetCount(services); // try to select the service by its serviceID for (i = 0; i < n; i++) { SCNetworkServiceRef service = NULL; CFStringRef serviceID; service = CFArrayGetValueAtIndex(services, i); serviceID = SCNetworkServiceGetServiceID(service); if (CFEqual(identifier, serviceID)) { selected = service; goto done; } } // try to select the service by service name for (i = 0; i < n; i++) { SCNetworkServiceRef service = NULL; CFStringRef serviceName; service = CFArrayGetValueAtIndex(services, i); serviceName = SCNetworkServiceGetName(service); if ((serviceName != NULL) && CFEqual(identifier, serviceName)) { if (selected == NULL) { selected = service; } else { // if multiple services match selected = NULL; SCPrint(TRUE, stderr, CFSTR("Multiple services match\n")); goto done; } } } done : if (selected != NULL) CFRetain(selected); if (services != NULL) CFRelease(services); return selected; }
void dhcp_packet_fprint(FILE * f, struct dhcp * dp, int pkt_len) { CFMutableStringRef str; str = CFStringCreateMutable(NULL, 0); dhcp_packet_print_cfstr(str, dp, pkt_len); SCPrint(TRUE, f, CFSTR("%@"), str); CFRelease(str); fflush(f); return; }
PRIVATE_EXTERN void fprint_bytes_sep(FILE * out_f, uint8_t * data_p, int n_bytes, char separator) { CFMutableStringRef str; str = CFStringCreateMutable(NULL, 0); print_bytes_sep_cfstr(str, data_p, n_bytes, separator); SCPrint(TRUE, out_f, CFSTR("%@"), str); CFRelease(str); fflush(out_f); return; }
PRIVATE_EXTERN void fprint_data(FILE * out_f, const uint8_t * data_p, int n_bytes) { CFMutableStringRef str; str = CFStringCreateMutable(NULL, 0); print_data_cfstr(str, data_p, n_bytes); SCPrint(TRUE, out_f, CFSTR("%@"), str); CFRelease(str); fflush(out_f); return; }
static void nc_callback(SCNetworkConnectionRef connection, SCNetworkConnectionStatus status, void *info) { int *n = (int *)info; CFDictionaryRef status_dict; // report status if (n != NULL) { if (*n == 0) { SCPrint(TRUE, stdout, CFSTR("Current status = ")); } else { struct tm tm_now; struct timeval tv_now; (void)gettimeofday(&tv_now, NULL); (void)localtime_r(&tv_now.tv_sec, &tm_now); SCPrint(TRUE, stdout, CFSTR("\n*** %2d:%02d:%02d.%03d\n\n"), tm_now.tm_hour, tm_now.tm_min, tm_now.tm_sec, tv_now.tv_usec / 1000); SCPrint(TRUE, stdout, CFSTR("Callback (%d) status = "), *n); } *n = *n + 1; } SCPrint(TRUE, stdout, CFSTR("%s%s%s\n"), nc_status_string(status), (status == kSCNetworkConnectionInvalid) ? ": " : "", (status == kSCNetworkConnectionInvalid) ? SCErrorString(SCError()) : ""); // report extended status status_dict = SCNetworkConnectionCopyExtendedStatus(connection); if (status_dict) { SCPrint(TRUE, stdout, CFSTR("Extended Status %@\n"), status_dict); CFRelease(status_dict); } return; }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ static void nc_stop(int argc, char **argv) { nc_create_connection(argc, argv, TRUE); if (!SCNetworkConnectionStop(connection, TRUE)) { SCPrint(TRUE, stderr, CFSTR("Could not stop connection: %s\n"), SCErrorString(SCError())); exit(1); }; nc_release_connection(); exit(0); }
static void nc_create_connection(int argc, char **argv, Boolean exit_on_failure) { SCNetworkConnectionContext context = { 0, &n_callback, NULL, NULL, NULL }; SCNetworkServiceRef service; service = nc_copy_service_from_arguments(argc, argv, NULL); if (service == NULL) { SCPrint(TRUE, stderr, CFSTR("No service\n")); if (exit_on_failure) exit(1); return; } connection = SCNetworkConnectionCreateWithService(NULL, service, nc_callback, &context); CFRelease(service); if (connection == NULL) { SCPrint(TRUE, stderr, CFSTR("Could not create connection: %s\n"), SCErrorString(SCError())); if (exit_on_failure) exit(1); return; } }
static bool S_dump_packet_description(FILE * out_f, const EAPPacketRef pkt, EAPClientPluginFuncCopyPacketDescription * copy_descr) { bool packet_is_valid = FALSE; CFStringRef str; str = (*copy_descr)(pkt, &packet_is_valid); if (str != NULL) { SCPrint(TRUE, out_f, CFSTR("%@"), str); CFRelease(str); } return (packet_is_valid); }
static void nc_ondemand_callback(SCDynamicStoreRef store, CFArrayRef changedKeys, void *info) { CFStringRef key = NULL; CFDictionaryRef ondemand_dict = NULL; struct tm tm_now; struct timeval tv_now; if (CFArrayGetCount(changedKeys) < 1) { return; } (void)gettimeofday(&tv_now, NULL); (void)localtime_r(&tv_now.tv_sec, &tm_now); SCPrint(TRUE, stdout, CFSTR("\n*** %2d:%02d:%02d.%03d\n\n"), tm_now.tm_hour, tm_now.tm_min, tm_now.tm_sec, tv_now.tv_usec / 1000); if (ondemand_nodename) { checkOnDemandHost(store, ondemand_nodename, FALSE); checkOnDemandHost(store, ondemand_nodename, TRUE); } else { key = CFArrayGetValueAtIndex(changedKeys, 0); ondemand_dict = SCDynamicStoreCopyValue(store, key); if (ondemand_dict) { SCPrint(TRUE, stdout, CFSTR("%@ %@\n"), kSCEntNetOnDemand, ondemand_dict); } else { SCPrint(TRUE, stdout, CFSTR("%@ not configured\n"), kSCEntNetOnDemand); } my_CFRelease(&ondemand_dict); } }
static void __show_service_protocols(SCNetworkServiceRef service, const char *prefix, Boolean skipEmpty) { CFIndex i; CFIndex n; CFArrayRef protocols; protocols = SCNetworkServiceCopyProtocols(service); if (protocols == NULL) { return; } n = CFArrayGetCount(protocols); if (n > 1) { CFMutableArrayRef sorted; sorted = CFArrayCreateMutableCopy(NULL, 0, protocols); CFArraySortValues(sorted, CFRangeMake(0, n), _compare_protocols, NULL); CFRelease(protocols); protocols = sorted; } for (i = 0; i < n; i++) { CFStringRef description; SCNetworkProtocolRef protocol; protocol = CFArrayGetValueAtIndex(protocols, i); description = _protocol_description(protocol, skipEmpty); if (description != NULL) { CFStringRef protocolType; protocolType = SCNetworkProtocolGetProtocolType(protocol); SCPrint(TRUE, stdout, CFSTR("%s%@%*s : %@\n"), prefix, protocolType, (int)(sizeof("Interface") - CFStringGetLength(protocolType) - 1), "", description); CFRelease(description); } } CFRelease(protocols); return; }
void fprint_bytes(FILE * out_f, const uint8_t * data_p, int n_bytes) { CFMutableStringRef str; str = CFStringCreateMutable(NULL, 0); if (out_f == NULL) { out_f = stdout; } print_bytes_cfstr(str, data_p, n_bytes); SCPrint(TRUE, out_f, CFSTR("%@"), str); CFRelease(str); fflush(out_f); return; }
__private_extern__ Boolean process_line(InputRef src) { char *arg; int argc = 0; char **argv = NULL; int i; char line[LINE_LENGTH]; char *s = line; // if end-of-file, exit if (getLine(line, sizeof(line), src) == NULL) return FALSE; if (nesting > 0) { SCPrint(TRUE, stdout, CFSTR("%d> %s\n"), nesting, line); } // break up the input line while ((arg = getString(&s)) != NULL) { if (argc == 0) argv = (char **)malloc(2 * sizeof(char *)); else argv = (char **)reallocf(argv, ((argc + 2) * sizeof(char *))); argv[argc++] = arg; } if (argc == 0) { return TRUE; // if no arguments } /* process the command */ if (*argv[0] != '#') { argv[argc] = NULL; // just in case... currentInput = src; do_command(argc, argv); } /* free the arguments */ for (i = 0; i < argc; i++) { free(argv[i]); } free(argv); return !termRequested; }
static void __show_service_interface(SCNetworkServiceRef service, const char *prefix) { CFStringRef description; SCNetworkInterfaceRef interface; interface = SCNetworkServiceGetInterface(service); if (interface == NULL) { return; } description = _interface_description(interface); SCPrint(TRUE, stdout, CFSTR("%s%@\n"), prefix, description); CFRelease(description); return; }
static void nc_print_VPN_service(SCNetworkServiceRef service) { SCNetworkInterfaceRef interface = NULL; CFStringRef display_name = NULL; CFStringRef display_name_padded = NULL; CFStringRef service_id = NULL; CFStringRef service_name = NULL; CFStringRef service_name_padded = NULL; CFStringRef service_status = NULL; CFStringRef service_status_padded = NULL; CFStringRef sub_type = NULL; CFStringRef type = NULL; nc_get_service_type_and_subtype(service, &type, &sub_type); service_name = SCNetworkServiceGetName(service); service_name_padded = copy_padded_string(service_name, 32, CFSTR("\""), CFSTR("\"")); service_id = SCNetworkServiceGetServiceID(service); interface = SCNetworkServiceGetInterface(service); display_name = SCNetworkInterfaceGetLocalizedDisplayName(interface); display_name_padded = copy_padded_string(display_name, 18, NULL, NULL); service_status = copy_VPN_status(service); service_status_padded = copy_padded_string(service_status, 16, CFSTR("("), CFSTR(")")); SCPrint(TRUE, stdout, CFSTR("%@ %@ %@ %@ %@ [%@%@%@]\n"), SCNetworkServiceGetEnabled(service) ? CFSTR("*") : CFSTR(" "), service_status_padded, service_id, display_name_padded, service_name_padded, type, (sub_type == NULL) ? CFSTR("") : CFSTR(":"), (sub_type == NULL) ? CFSTR("") : sub_type); CFRelease(display_name_padded); CFRelease(service_name_padded); CFRelease(service_status_padded); my_CFRelease(&service_status); }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ static SCNetworkServiceRef nc_copy_service_from_arguments(int argc, char **argv, SCNetworkSetRef set) { CFStringRef serviceID = NULL; SCNetworkServiceRef service = NULL; if (argc == 0) { serviceID = _copyStringFromSTDIN(CFSTR("Service"), NULL); } else { serviceID = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8); } if (serviceID == NULL) { SCPrint(TRUE, stderr, CFSTR("No service ID specified\n")); return NULL; } service = nc_copy_service(set, serviceID); my_CFRelease(&serviceID); return service; }
__private_extern__ void do_open(int argc, char **argv) { if (store) { CFRelease(store); CFRelease(watchedKeys); CFRelease(watchedPatterns); } if (argc < 1) { store = SCDynamicStoreCreate(NULL, CFSTR("scutil"), storeCallback, NULL); } else { CFMutableDictionaryRef options; options = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); CFDictionarySetValue(options, kSCDynamicStoreUseSessionKeys, kCFBooleanTrue); store = SCDynamicStoreCreateWithOptions(NULL, CFSTR("scutil"), options, storeCallback, NULL); CFRelease(options); } if (store == NULL) { SCPrint(TRUE, stdout, CFSTR(" %s\n"), SCErrorString(SCError())); return; } (void) SCDynamicStoreSetDisconnectCallBack(store, reconnected); watchedKeys = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); watchedPatterns = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); cache_close(); return; }
static void nc_watch(int argc, char **argv) { SCNetworkConnectionStatus status; nc_create_connection(argc, argv, TRUE); status = SCNetworkConnectionGetStatus(connection); // report initial status n_callback = 0; nc_callback(connection, status, &n_callback); // setup watcher if (doDispatch) { if (!SCNetworkConnectionSetDispatchQueue(connection, dispatch_get_main_queue())) { SCPrint(TRUE, stderr, CFSTR("Unable to schedule watch process: %s\n"), SCErrorString(SCError())); exit(1); } } else { if (!SCNetworkConnectionScheduleWithRunLoop(connection, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode)) { SCPrint(TRUE, stderr, CFSTR("Unable to schedule watch process: %s\n"), SCErrorString(SCError())); exit(1); } } // wait for changes CFRunLoopRun(); nc_release_connection(); exit(0); }