1/* app-main.m 2 * 3 * Copyright (c) 2002-2012 Apple Inc. All rights reserved. 4 * 5 * Permission is hereby granted, free of charge, to any person 6 * obtaining a copy of this software and associated documentation files 7 * (the "Software"), to deal in the Software without restriction, 8 * including without limitation the rights to use, copy, modify, merge, 9 * publish, distribute, sublicense, and/or sell copies of the Software, 10 * and to permit persons to whom the Software is furnished to do so, 11 * subject to the following conditions: 12 * 13 * The above copyright notice and this permission notice shall be 14 * included in all copies or substantial portions of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT 20 * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 * DEALINGS IN THE SOFTWARE. 24 * 25 * Except as contained in this notice, the name(s) of the above 26 * copyright holders shall not be used in advertising or otherwise to 27 * promote the sale, use or other dealings in this Software without 28 * prior written authorization. 29 */ 30 31#include "pbproxy.h" 32#import "x-selection.h" 33 34/* Stubs */ 35char *display = NULL; 36 37static void 38signal_handler(int sig) 39{ 40 switch (sig) { 41 case SIGHUP: 42 xpbproxy_prefs_reload = YES; 43 break; 44 45 default: 46 _exit(EXIT_SUCCESS); 47 } 48} 49 50void 51ErrorF(const char * f, ...) 52{ 53 va_list args; 54 55 va_start(args, f); 56 vfprintf(stderr, f, args); 57 va_end(args); 58} 59 60/* TODO: Have this actually log to ASL */ 61void 62xq_asl_log(int level, const char *subsystem, const char *file, 63 const char *function, int line, const char *fmt, 64 ...) 65{ 66#ifdef DEBUG 67 va_list args; 68 69 va_start(args, fmt); 70 vfprintf(stderr, fmt, args); 71 va_end(args); 72#endif 73} 74 75int 76main(int argc, const char *argv[]) 77{ 78 xpbproxy_is_standalone = YES; 79 80 signal(SIGINT, signal_handler); 81 signal(SIGTERM, signal_handler); 82 signal(SIGHUP, signal_handler); 83 signal(SIGPIPE, SIG_IGN); 84 85 return xpbproxy_run(); 86} 87