XMMS2
|
00001 /* XMMS2 - X Music Multiplexer System 00002 * Copyright (C) 2003-2011 XMMS2 Team 00003 * 00004 * PLUGINS ARE NOT CONSIDERED TO BE DERIVED WORK !!! 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 */ 00016 00017 /** @file 00018 * Miscellaneous internal utility functions. 00019 */ 00020 00021 #include <stdlib.h> 00022 #include <string.h> 00023 00024 #include "xmms_configuration.h" 00025 #include "xmmsc/xmmsc_util.h" 00026 00027 /** 00028 * Get the default connection path. 00029 * 00030 * @param buf A char buffer 00031 * @param len The length of buf (XMMS_PATH_MAX is a good choice) 00032 * @return A pointer to buf, or NULL if an error occured. 00033 */ 00034 const char * 00035 xmms_default_ipcpath_get (char *buf, int len) 00036 { 00037 const char *xmmspath; 00038 00039 xmmspath = getenv ("XMMS_PATH"); 00040 if (xmmspath && strlen (xmmspath) < len) { 00041 strcpy (buf, xmmspath); 00042 } else { 00043 return xmms_fallback_ipcpath_get (buf, len); 00044 } 00045 00046 return buf; 00047 }