Some SlackBuild scripts for Slackware.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

107 lines
3.4 KiB

diff --git a/console/linphonec.c b/console/linphonec.c
index e032108..63cc7fa 100644
--- a/console/linphonec.c
+++ b/console/linphonec.c
@@ -666,10 +666,15 @@ linphonec_init(int argc, char **argv)
#ifndef _WIN32
- snprintf(configfile_name, PATH_MAX, "%s/.linphonerc",
- getenv("HOME"));
- snprintf(zrtpsecrets, PATH_MAX, "%s/.linphone-zidcache",
- getenv("HOME"));
+ char config_dir[PATH_MAX];
+ const char *xdg_config_home = getenv("XDG_CONFIG_HOME");
+ if (xdg_config_home==NULL){
+ snprintf(config_dir, PATH_MAX, "%s/.config/linphone", getenv("HOME"));
+ }else{
+ snprintf(config_dir, PATH_MAX, "%s/linphone", xdg_config_home);
+ }
+ snprintf(configfile_name, PATH_MAX, "%s/linphonerc", config_dir);
+ snprintf(zrtpsecrets, PATH_MAX, "%s/linphone-zidcache", config_dir);
#elif defined(_WIN32_WCE)
strncpy(configfile_name,PACKAGE_DIR "\\linphonerc",PATH_MAX);
mylogfile=fopen(PACKAGE_DIR "\\" "linphonec.log","w");
@@ -1051,6 +1056,9 @@ linphonec_idle_call ()
static int
linphonec_initialize_readline()
{
+ char cache_dir[PATH_MAX];
+ char *xdg_cache_home;
+
/*rl_bind_key('\t', rl_insert);*/
/* Allow conditional parsing of ~/.inputrc */
@@ -1061,8 +1069,12 @@ linphonec_initialize_readline()
rl_event_hook=linphonec_idle_call;
/* Set history file and read it */
- histfile_name = ms_strdup_printf ("%s/.linphonec_history",
- getenv("HOME"));
+ if ((xdg_cache_home=getenv("XDG_CACHE_HOME"))){
+ snprintf(cache_dir, PATH_MAX, "%s/linphone", xdg_cache_home);
+ }else{
+ snprintf(cache_dir, PATH_MAX, "%s/.cache/linphone", getenv("HOME"));
+ }
+ histfile_name = ms_strdup_printf ("%s/linphonec_history", cache_dir);
read_history(histfile_name);
/* Initialized last_in_history cache*/
diff --git a/gtk/main.c b/gtk/main.c
index 73e99cc..a52b706 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -124,13 +124,8 @@ static GOptionEntry linphone_options[]={
#define RELATIVE_XML_DIR
#define BUILD_TREE_XML_DIR "gtk"
-#ifndef WIN32
-#define CONFIG_FILE ".linphonerc"
-#define SECRETS_FILE ".linphone-zidcache"
-#else
#define CONFIG_FILE "linphonerc"
#define SECRETS_FILE "linphone-zidcache"
-#endif
char *linphone_gtk_get_config_file(const char *filename){
@@ -149,9 +144,10 @@ char *linphone_gtk_get_config_file(const char *filename){
snprintf(config_file,path_max,"%s\\%s\\%s",appdata,LINPHONE_CONFIG_DIR,filename);
}
#else
- const char *home=getenv("HOME");
- if (home==NULL) home=".";
- snprintf(config_file,path_max,"%s/%s",home,filename);
+ const char *config_dir=g_get_user_config_dir();
+ snprintf(config_file,path_max,"%s/linphone",config_dir);
+ g_mkdir_with_parents(config_file, 0700);
+ snprintf(config_file,path_max,"%s/linphone/%s",config_dir,filename);
#endif
}
return config_file;
diff --git a/oRTP/src/port.c b/oRTP/src/port.c
index 0f94e16..dd6a600 100644
--- a/oRTP/src/port.c
+++ b/oRTP/src/port.c
@@ -371,13 +371,20 @@ char * WSAAPI gai_strerror(int errnum){
#ifndef WIN32
+#include <stdlib.h>
#include <sys/socket.h>
#include <netdb.h>
#include <sys/un.h>
#include <sys/stat.h>
static char *make_pipe_name(const char *name){
- return ortp_strdup_printf("/tmp/%s",name);
+ char *runtime_dir=getenv("XDG_RUNTIME_DIR");
+ if (runtime_dir==NULL){
+ /* XDG Base Directory Specification mandates this warning. */
+ ortp_warning("XDG_RUNTIME_DIR not set, fallback to /tmp");
+ runtime_dir="/tmp";
+ }
+ return ortp_strdup_printf("%s/%s",runtime_dir,name);
}
/* portable named pipes */