From 28947ba98d62749376a60fc7596eaed46a88525d Mon Sep 17 00:00:00 2001 From: juandon Date: Mon, 10 Mar 2003 13:23:46 +0000 Subject: [PATCH] CONFIG_DIR support Changed files: esound-home_etc.patch -> 1.1 --- esound-home_etc.patch | 92 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 esound-home_etc.patch diff --git a/esound-home_etc.patch b/esound-home_etc.patch new file mode 100644 index 0000000..8925cd1 --- /dev/null +++ b/esound-home_etc.patch @@ -0,0 +1,92 @@ +diff -Nru esound-0.2.29/esd_config.c esound-0.2.29.new/esd_config.c +--- esound-0.2.29/esd_config.c Wed Jun 19 12:14:24 2002 ++++ esound-0.2.29.new/esd_config.c Mon Mar 10 13:18:20 2003 +@@ -41,12 +41,18 @@ + fclose(fh); + } + free(fn); +- +- tmpenv = getenv("HOME"); ++ tmpenv = getenv("CONFIG_DIR"); + if(tmpenv) { +- fn = malloc(strlen(tmpenv) + sizeof("/.esd.conf")); +- sprintf(fn, "%s/.esd.conf", tmpenv); +- ++ fn = malloc(strlen(tmpenv) + sizeof("/esd.conf")); ++ sprintf(fn, "%s/esd.conf", tmpenv); ++ } else { ++ tmpenv = getenv("HOME"); ++ if(tmpenv) { ++ fn = malloc(strlen(tmpenv) + sizeof("/.esd.conf")); ++ sprintf(fn, "%s/.esd.conf", tmpenv); ++ } ++ } ++ if(tmpenv) { + fh = fopen(fn, "r"); + + if(fh) +diff -Nru esound-0.2.29/esddsp.c esound-0.2.29.new/esddsp.c +--- esound-0.2.29/esddsp.c Mon Aug 26 16:39:55 2002 ++++ esound-0.2.29.new/esddsp.c Mon Mar 10 12:58:56 2003 +@@ -122,6 +122,13 @@ + { + use_mixer = 1; + ++ str = getenv ("CONFIG_DIR"); ++ if (str) ++ { ++ mixer = malloc (strlen (str) + strlen (ident) + 9); ++ sprintf (mixer, "%s/esddsp_%s", str, ident); ++ } ++ else { + str = getenv ("HOME"); + if (str) + { +@@ -133,7 +140,7 @@ + fprintf (stderr, "esddsp: can't get home directory\n"); + exit (1); + } +- ++ } + DPRINTF ("mixer settings file: %s\n", mixer); + } + } +diff -Nru esound-0.2.29/esdlib.c esound-0.2.29.new/esdlib.c +--- esound-0.2.29/esdlib.c Mon Jul 15 09:28:26 2002 ++++ esound-0.2.29.new/esdlib.c Mon Mar 10 13:02:41 2003 +@@ -159,6 +159,7 @@ + char *auth_filename = 0; + unsigned char auth_key[ESD_KEY_LEN]; + char *home = NULL; ++ char *config_dir = NULL; + int namelen, retval; + void (*phandler)(int); + +@@ -168,6 +169,18 @@ + phandler = signal( SIGPIPE, dummy_signal ); /* for closed esd conns */ + + /* assemble the authorization filename */ ++ config_dir = getenv("CONFIG_DIR"); ++ if (config_dir) { ++ namelen = strlen(config_dir) + sizeof("/esd_auth"); ++ if ((auth_filename = malloc(namelen + 1)) == 0) { ++ fprintf( stderr, "Memory exhausted\n" ); ++ signal( SIGPIPE, phandler ); ++ return -1; ++ } ++ ++ strcpy( auth_filename, config_dir ); ++ strcat( auth_filename, "/esd_auth" ); ++ } else { + home = getenv( "HOME" ); + if ( !home ) { + fprintf( stderr, "HOME environment variable not set?\n" ); +@@ -184,7 +197,7 @@ + + strcpy( auth_filename, home ); + strcat( auth_filename, "/.esd_auth" ); +- ++ } + retval = 0; + /* open the authorization file */ + if ( -1 == (auth_fd = open( auth_filename, O_RDONLY ) ) ) { -- 2.44.0