[packages/aumix-gtk] Rel 4

arekm arekm at pld-linux.org
Sun May 17 00:59:45 CEST 2026


commit 20b869c86bad7502cf9339f18a2d4b4931897d9b
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sun May 17 00:59:09 2026 +0200

    Rel 4

 aumix-gtk.spec         |   4 +-
 aumix-home_etc.patch   | 491 -------------------------------------------------
 aumix-xdg-config.patch |  90 +++++++++
 3 files changed, 93 insertions(+), 492 deletions(-)
---
diff --git a/aumix-gtk.spec b/aumix-gtk.spec
index 608bdaa..4bc74b2 100644
--- a/aumix-gtk.spec
+++ b/aumix-gtk.spec
@@ -11,7 +11,7 @@ Summary(ru.UTF-8):	Аудио микшер на базе библиотеки cu
 Summary(uk.UTF-8):	Аудіо мікшер, базований на біблиотеці curses і GTK+
 Name:		aumix-gtk
 Version:	2.9.1
-Release:	3
+Release:	4
 License:	GPL v2+
 Group:		Applications/Sound
 Source0:	http://www.jpj.net/~trevor/aumix/releases/aumix-%{version}.tar.bz2
@@ -21,6 +21,7 @@ Source4:	aumix.png
 Patch1:		aumix-xaumix.patch
 Patch2:		aumix-fno-common.patch
 Patch3:		aumix-gtk-widget-destroy.patch
+Patch4:		aumix-xdg-config.patch
 URL:		http://www.jpj.net/~trevor/aumix.html
 BuildRequires:	autoconf
 BuildRequires:	automake
@@ -77,6 +78,7 @@ jak poziom sygnału wyjściowego.
 %patch -P1 -p1
 %patch -P2 -p1
 %patch -P3 -p1
+%patch -P4 -p1
 
 %build
 %{__gettextize}
diff --git a/aumix-home_etc.patch b/aumix-home_etc.patch
deleted file mode 100644
index 528b883..0000000
--- a/aumix-home_etc.patch
+++ /dev/null
@@ -1,491 +0,0 @@
-diff -Nru aumix-2.6.1/doc/aumix.1 aumix-2.6.1.new/doc/aumix.1
---- aumix-2.6.1/doc/aumix.1	Tue Jun 27 23:11:47 2000
-+++ aumix-2.6.1.new/doc/aumix.1	Tue Jun 27 23:11:28 2000
-@@ -115,15 +115,19 @@
- go into interactive mode after doing things non-interactively.
- .It Fl L
- load settings from
--.Pa $HOME/.aumixrc ,
--or
-+.Pa $CONFIG_DIR/aumixrc ,
-+.Pa $HOME/.aumixrc
-+(depreciated), or
- .Pa /etc/aumixrc
- if the former is inaccessible
- .It Fl q
- query all devices and print their settings
- .It Fl S
- save settings to
-+.Pa $CONFIG_DIR/aumixrc
-+or
- .Pa $HOME/.aumixrc
-+(depreciated)
- .El
- .Sh EXAMPLES
- The command
-@@ -189,7 +193,10 @@
- show a description of the functions of keys
- .It L or l
- load settings from
--.Pa $HOME/.aumixrc ,
-+.Pa $CONFIG_DIR/aumixrc ,
-+or
-+.Pa $HOME/.aumixrc
-+(depreciated),
- falling back to
- .Pa /etc/aumixrc
- .It M or m
-@@ -264,8 +271,11 @@
- Saved settings for the mixer are kept in the
- .Pa /etc/aumixrc
- and
--.Pa $HOME/.aumixrc
--files, but can be kept anywhere if specified explicitly.
-+.Pa $CONFIG_DIR/aumixrc
-+files, (
-+.Pa $HOME/.aumixrc 
-+is now obsolete, though it still works), 
-+but can be kept anywhere if specified explicitly.
- Color schemes are normally kept in the directory given
- by
- .Ev DATADIR
-diff -Nru aumix-2.6.1/po/de.po aumix-2.6.1.new/po/de.po
---- aumix-2.6.1/po/de.po	Tue Jun 27 23:11:47 2000
-+++ aumix-2.6.1.new/po/de.po	Tue Jun 27 23:15:28 2000
-@@ -206,12 +206,12 @@
- msgid ""
- "  d:  adjust a device besides /dev/mixer\n"
- "  f:  specify file for saving and loading settings (defaults to\n"
--"      ~/.aumixrc or /etc/aumixrc)\n"
-+"      $CONFIG_DIR/aumixrc or /etc/aumixrc)\n"
- "  h:  this helpful message\n"
- msgstr ""
- "  d:  Anderes Ger�t als /dev/mixer benutzen\n"
- "  f:  Spezifizieren Sie die Datei zum Speichern und Laden von Einstellungen\n"
--"      (Standard sind ~/.aumixrc oder /etc/aumixrc)\n"
-+"      (Standard sind $CONFIG_DIR/aumixrc oder /etc/aumixrc) or /etc/aumixrc)\n"
- "  h:  Diese n�tzlichen Informationen\n"
- 
- #: src/common.c:689
-diff -Nru aumix-2.6.1/po/es.po aumix-2.6.1.new/po/es.po
---- aumix-2.6.1/po/es.po	Tue Jun 27 23:11:47 2000
-+++ aumix-2.6.1.new/po/es.po	Tue Jun 27 23:14:48 2000
-@@ -206,12 +206,12 @@
- msgid ""
- "  d:  adjust a device besides /dev/mixer\n"
- "  f:  specify file for saving and loading settings (defaults to\n"
--"      ~/.aumixrc or /etc/aumixrc)\n"
-+"      $CONFIG_DIR/aumixrc or /etc/aumixrc)\n"
- "  h:  this helpful message\n"
- msgstr ""
- "  d:  ajustar dispositivos adem�s de /dev/mixer\n"
- "  f:  indicar el fichero para guardar y cargar las preferencias (por\n"
--"      defecto es ~/.aumixrc o /etc/aumixrc\n"
-+"      defecto es $CONFIG_DIR/aumixrc o /etc/aumixrc\n"
- "  h:  este mensaje de ayuda\n"
- 
- #: src/common.c:689
-diff -Nru aumix-2.6.1/po/fr.po aumix-2.6.1.new/po/fr.po
---- aumix-2.6.1/po/fr.po	Tue Jun 27 23:11:47 2000
-+++ aumix-2.6.1.new/po/fr.po	Tue Jun 27 23:15:18 2000
-@@ -206,12 +206,12 @@
- msgid ""
- "  d:  adjust a device besides /dev/mixer\n"
- "  f:  specify file for saving and loading settings (defaults to\n"
--"      ~/.aumixrc or /etc/aumixrc)\n"
-+"      $CONFIG_DIR/aumixrc or /etc/aumixrc)\n"
- "  h:  this helpful message\n"
- msgstr ""
- "  d:  ajuster un p�riph�rique autre que /dev/mixer\n"
- "  f:  sp�cifier le fichier de sauvegarde/chargement des param�tres\n"
--"      (par d�faut il s'agit de ~/.aumixrc ou /etc/aumixrc)\n"
-+"      (par d�faut il s'agit de $CONFIG_DIR/aumixrc ou /etc/aumixrc)\n"
- "  h:  ce message d'aide\n"
- 
- #: src/common.c:689
-diff -Nru aumix-2.6.1/po/gl.po aumix-2.6.1.new/po/gl.po
---- aumix-2.6.1/po/gl.po	Tue Jun 27 23:11:47 2000
-+++ aumix-2.6.1.new/po/gl.po	Tue Jun 27 23:14:38 2000
-@@ -214,12 +214,12 @@
- msgid ""
- "  d:  adjust a device besides /dev/mixer\n"
- "  f:  specify file for saving and loading settings (defaults to\n"
--"      ~/.aumixrc or /etc/aumixrc)\n"
-+"      $CONFIG_DIR/aumixrc or /etc/aumixrc)\n"
- "  h:  this helpful message\n"
- msgstr ""
- "  d:  axustar outro dispositivo que non sexa /dev/mixer\n"
- "  f:  especificar ficheiro para gardar e cargar opci�ns (por omisi�n �\n"
--"      ~/.aumixrc ou /etc/aumixrc)\n"
-+"      $CONFIG_DIR/aumixrc ou /etc/aumixrc)\n"
- "  h:  amosar esta mensaxe de axuda\n"
- 
- #: src/common.c:707
-diff -Nru aumix-2.6.1/po/pl.po aumix-2.6.1.new/po/pl.po
---- aumix-2.6.1/po/pl.po	Tue Jun 27 23:11:47 2000
-+++ aumix-2.6.1.new/po/pl.po	Tue Jun 27 23:16:16 2000
-@@ -210,12 +210,12 @@
- msgid ""
- "  d:  adjust a device besides /dev/mixer\n"
- "  f:  specify file for saving and loading settings (defaults to\n"
--"      ~/.aumixrc or /etc/aumixrc)\n"
-+"      $CONFIG_DIR/aumixrc or /etc/aumixrc)\n"
- "  h:  this helpful message\n"
- msgstr ""
- "  d:  dostosowuje urz�dzenie inne ni� /dev/mixer\n"
- "  f:  okre�la plik do zapisywania i �adowania ustawie� (domy�lnie jest to\n"
--"      ~/.aumixrc lub /etc/aumixrc)\n"
-+"      $CONFIG_DIR/aumixrc lub /etc/aumixrc)\n"
- "  h:  ta pomocna informacja\n"
- 
- #: src/common.c:689
-diff -Nru aumix-2.6.1/po/pt_BR.po aumix-2.6.1.new/po/pt_BR.po
---- aumix-2.6.1/po/pt_BR.po	Tue Jun 27 23:11:47 2000
-+++ aumix-2.6.1.new/po/pt_BR.po	Tue Jun 27 23:14:27 2000
-@@ -212,12 +212,12 @@
- msgid ""
- "  d:  adjust a device besides /dev/mixer\n"
- "  f:  specify file for saving and loading settings (defaults to\n"
--"      ~/.aumixrc or /etc/aumixrc)\n"
-+"      $CONFIG_DIR/aumixrc or /etc/aumixrc)\n"
- "  h:  this helpful message\n"
- msgstr ""
- "  d:  ajusta um dispositivo em /dev/mixer\n"
- "  f:  especifica um arquivo para ler e gravar as configura��es (o padr�o "
--"�       ~/.aumixrc or /etc/aumixrc)\n"
-+"�       $CONFIG_DIR/.aumixrc or /etc/aumixrc)\n"
- "  h:  essa mensagem de ajuda\n"
- 
- #: src/common.c:716
-diff -Nru aumix-2.6.1/po/ru.po aumix-2.6.1.new/po/ru.po
---- aumix-2.6.1/po/ru.po	Tue Jun 27 23:11:47 2000
-+++ aumix-2.6.1.new/po/ru.po	Tue Jun 27 23:16:07 2000
-@@ -210,12 +210,12 @@
- msgid ""
- "  d:  adjust a device besides /dev/mixer\n"
- "  f:  specify file for saving and loading settings (defaults to\n"
--"      ~/.aumixrc or /etc/aumixrc)\n"
-+"      $CONFIG_DIR/aumixrc or /etc/aumixrc)\n"
- "  h:  this helpful message\n"
- msgstr ""
- "  d:  ������������ ���������� ����� /dev/mixer\n"
- "  f:  �������� ����� ����� ��� �������� ��������� (�� ���������\n"
--"      ~/.aumixrc ��� /etc/aumixrc)\n"
-+"      $CONFIG_DIR/aumixrc ��� /etc/aumixrc)\n"
- "  h:  ��� ������\n"
- 
- #: src/common.c:689
-diff -Nru aumix-2.6.1/po/uk.po aumix-2.6.1.new/po/uk.po
---- aumix-2.6.1/po/uk.po	Tue Jun 27 23:11:47 2000
-+++ aumix-2.6.1.new/po/uk.po	Tue Jun 27 23:14:13 2000
-@@ -212,12 +212,12 @@
- msgid ""
- "  d:  adjust a device besides /dev/mixer\n"
- "  f:  specify file for saving and loading settings (defaults to\n"
--"      ~/.aumixrc or /etc/aumixrc)\n"
-+"      $CONFIG_DIR/aumixrc or /etc/aumixrc)\n"
- "  h:  this helpful message\n"
- msgstr ""
- "  d:  ���������� ������ϧ ��Ҧ� /dev/mixer\n"
- "  f:  ������� ��'� ����� ��� ���������� Ҧ�Φ� (�� �����������\n"
--"      ~/.aumixrc �� /etc/aumixrc)\n"
-+"      $CONFIG_DIR/aumixrc �� /etc/aumixrc)\n"
- "  h:  �� ��������\n"
- 
- #: src/common.c:707
-diff -Nru aumix-2.6.1/src/Makefile.am aumix-2.6.1.new/src/Makefile.am
---- aumix-2.6.1/src/Makefile.am	Tue Jun 27 23:11:47 2000
-+++ aumix-2.6.1.new/src/Makefile.am	Wed Jun 28 00:12:13 2000
-@@ -2,8 +2,8 @@
- if CURSES
- bin_SCRIPTS	= xaumix
- endif
--aumix_SOURCES	= common.c curses.c dummy.c gpm-xterm.c gtk.c interactive.c \
--		mouse.c common.h curses.h gpm-xterm.h gtk.h interactive.h  \
-+aumix_SOURCES	= userdir.c common.c curses.c dummy.c gpm-xterm.c gtk.c interactive.c \
-+		mouse.c userdir.h common.h curses.h gpm-xterm.h gtk.h interactive.h  \
- 		mouse.h play.xpm record.xpm
- localedir	= $(datadir)/locale
- INCLUDES	= -I../intl -DLOCALEDIR=\"$(localedir)\" -I at includedir@
-diff -Nru aumix-2.6.1/src/common.c aumix-2.6.1.new/src/common.c
---- aumix-2.6.1/src/common.c	Tue Jun 27 23:11:47 2000
-+++ aumix-2.6.1.new/src/common.c	Wed Jun 28 00:10:45 2000
-@@ -26,6 +26,7 @@
- #include "gtk.h"
- #endif				/* HAVE_GTK */
- #include "interactive.h"
-+#include "userdir.h"
- 
- FILE           *OpenDefaultFile(char *mode);
- FILE           *setfile;
-@@ -556,7 +557,8 @@
- {
- /* Open the settings file for reading or writing.
- 
--   Try first ${HOME}/.AUMIXRC, then AUMIXRC_PATH/AUMIXRC;
-+   Try first ${HOME}/.AUMIXRC, then then ${HOME}/.AUMIXRC 
-+   and eventualy AUMIXRC_PATH/AUMIXRC;
-    become an error generator if neither can be opened.
- 
-    Input:
-@@ -571,6 +573,8 @@
- 	FILE           *setfile;
- 	char           *home;
- 	char            filename[PATH_MAX];
-+	struct cfv	etcfile;
-+
- 	if (save_filename == NULL) {
- 		home = getenv("HOME");
- 		if ((strlen(home) + strlen(AUMIXRC) + 2) < PATH_MAX) {
-@@ -585,6 +589,19 @@
- 		}
- 		if (setfile == NULL) {
- 			return NULL;
-+		}
-+		etcfile.variable = "CONFIG_DIR";
-+		etcfile.home_dir = NULL;
-+		etcfile.home_scd = NULL;
-+		etcfile.subname  = AUMIXRC;
-+		etcfile.prefix   = ".";
-+		etcfile.suffix   = "";
-+		etcfile.mode     = M_REGULAR_FILE;
-+
-+		setfile = fopencfv(&etcfile, mode);
-+		if (setfile == NULL) {
-+			sprintf(filename, "%s/%s", AUMIXRC_PATH, AUMIXRC);
-+			setfile = fopen(filename, mode);
- 		}
- 	} else
- 		setfile = CheckAndOpen(save_filename, mode);
-diff -Nru aumix-2.6.1/src/userdir.c aumix-2.6.1.new/src/userdir.c
---- aumix-2.6.1/src/userdir.c	Thu Jan  1 01:00:00 1970
-+++ aumix-2.6.1.new/src/userdir.c	Tue Jun 27 23:11:28 2000
-@@ -0,0 +1,167 @@
-+// $Id$
-+#include "userdir.h"
-+    
-+static char *nonulhome = "";
-+
-+/******************************************************************************/
-+    
-+int getusercfv (char *variable, 
-+		    char *home_dir, 
-+		    char *user_dir, 
-+		    size_t stringsize)
-+{
-+	struct stat st;
-+	char *d;
-+	
-+	bzero (user_dir, stringsize);
-+	if (variable == NULL || *variable == '\0') return (-1);
-+	if (home_dir == NULL) home_dir = nonulhome;
-+	d = getenv (variable);	
-+	if (d == NULL || *d == '\0') return (-1);
-+	if (*d == '/') 
-+	    {
-+	    strncpy (user_dir, d, stringsize-1);
-+	    }
-+	else
-+	    {
-+	    snprintf (user_dir, stringsize-1, "%s/%s", home_dir, d);
-+	    }
-+	    
-+	if (stat(user_dir,&st) != -1 && S_ISDIR(st.st_mode)) 
-+	    {
-+	    return (0);
-+	    }
-+	
-+	return (-1);
-+}
-+
-+/******************************************************************************/
-+
-+int detectcfv(struct cfv *CFV) {
-+	if (CFV->subname == NULL) CFV->subname = nonulhome;
-+	if (CFV->home_dir == NULL) CFV->home_dir = getenv ("HOME");
-+	if (CFV->home_dir == NULL) CFV->home_dir = CFV->home_scd;
-+	if (CFV->home_dir == NULL) return (-1);
-+	return 0;
-+}
-+
-+/******************************************************************************/
-+
-+int preparemain(struct cfv *CFV) {
-+	char *p;
-+	struct stat st;
-+	if ((p = strrchr(CFV->result, '/')) && *(p+1) == '\0') 
-+	    p = '\0';
-+	snprintf ((rindex(CFV->result,'\0')), MAXPATHLEN-1, "/%s", 
-+		  CFV->subname);
-+	if (stat( CFV->result,&st) != -1 
-+	     && CFV->mode ? 
-+		S_ISDIR(st.st_mode) : 
-+		S_ISREG(st.st_mode)) /* have file or dir */
-+	    return (1);
-+	return 0;
-+}
-+
-+/******************************************************************************/
-+
-+int preparehome(struct cfv *CFV) {
-+	struct stat st;
-+    	if (CFV->home_dir == NULL || *(CFV->home_dir) == '\0') return (-1);
-+	if (CFV->prefix == NULL && CFV->suffix == NULL) return (-1);
-+	snprintf (CFV->result, MAXPATHLEN-1, "%s/%s%s%s", 
-+		       CFV->home_dir, 
-+		       CFV->prefix? CFV->prefix:"",
-+		       CFV->subname,
-+		       CFV->suffix? CFV->suffix:"");
-+	if (stat(CFV->result,&st) != -1 
-+		 && CFV->mode ? 
-+		    S_ISDIR(st.st_mode) : 
-+		    S_ISREG(st.st_mode)) /* have file or dir */
-+		return (2);
-+	return (-1);
-+}
-+
-+/******************************************************************************/
-+
-+int usercfv (struct cfv *CFV) {
-+	int gr;
-+	gr = detectcfv(CFV);
-+	if (gr) return gr;
-+	/* get environment variable */
-+	gr = getusercfv (CFV->variable, 
-+			CFV->home_dir, 
-+			CFV->result,
-+			MAXPATHLEN);
-+	if (gr != -1) 	/* have main directory */
-+	    {
-+		gr = preparemain(CFV);
-+		if (gr) return gr;
-+	    }
-+	/* don't have main directory or a proper variable set */
-+	gr = preparehome(CFV);
-+	return gr;
-+}
-+	
-+/******************************************************************************/
-+
-+/* If directory or file doesn't exist returns the best one wich may be created */
-+int notnullusercfv (struct cfv *CFV) {
-+	int gr;
-+	if ((usercfv(CFV)) == -1) {
-+	    gr = detectcfv(CFV);
-+	    if (gr) return gr;	/* remember, it works for errors! */
-+	    /* get the environment variable */
-+	    gr = getusercfv (CFV->variable, 
-+			    CFV->home_dir, 
-+			    CFV->result,
-+			    MAXPATHLEN);
-+	    if (gr != -1) 	/* have main directory */
-+		{
-+		    gr = preparemain(CFV);
-+		    return 0;
-+		}
-+	    /* don't have main directory or a proper variable set */
-+	    gr = preparehome(CFV);
-+	    return 0;
-+ 	}
-+	return 0;	
-+}
-+    
-+/******************************************************************************/
-+
-+FILE *maynullfopencfv (struct cfv *CFV, const char *mode)
-+    {
-+    FILE *cfvfile = NULL;
-+    
-+    CFV->mode = M_REGULAR_FILE;
-+    if ((usercfv (CFV)) == -1) return (NULL);	
-+    cfvfile = fopen (CFV->result, mode);
-+    return (cfvfile);
-+    }
-+/******************************************************************************/
-+
-+FILE *notnullfopencfv (struct cfv *CFV, const char *mode)
-+    {
-+    FILE *cfvfile = NULL;
-+    
-+    CFV->mode = M_REGULAR_FILE;
-+    if ((notnullusercfv (CFV)) == -1) return (NULL);	
-+    cfvfile = fopen (CFV->result, mode);
-+    return (cfvfile);
-+    }
-+
-+/******************************************************************************/
-+    
-+FILE *fopencfv (struct cfv *CFV, const char *mode)
-+    {
-+    FILE *cfvfile = NULL;
-+
-+    if (cfvfile == NULL && (strpbrk(mode, "wa")) != NULL) /* create in best location */
-+	cfvfile = notnullfopencfv (CFV, mode);
-+    else 
-+	cfvfile = maynullfopencfv (CFV, mode);
-+    
-+    return (cfvfile);
-+    }
-+
-+/******************************************************************************/
-\ No newline at end of file
-diff -Nru aumix-2.6.1/src/userdir.h aumix-2.6.1.new/src/userdir.h
---- aumix-2.6.1/src/userdir.h	Thu Jan  1 01:00:00 1970
-+++ aumix-2.6.1.new/src/userdir.h	Tue Jun 27 23:11:28 2000
-@@ -0,0 +1,56 @@
-+// $Id$
-+#ifndef USERDIR__H
-+#define USERDIR__H
-+
-+#include <unistd.h>
-+#include <string.h>
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <sys/types.h>
-+#include <sys/stat.h>
-+#include <sys/param.h>
-+
-+#define	M_REGULAR_FILE	0
-+#define	M_DIRECTORY	1
-+
-+struct cfv {
-+	char result[MAXPATHLEN];	/* our result			*/
-+	char *variable;	/* name of an environment variable		*/
-+	char *home_dir;	/* home directory or NULL for autodetect	*/
-+	char *home_scd; /* directory if home_dir==NULL and no result	*/
-+	char *subname;	/* core name of a file/directory		*/
-+    	char *prefix;	/* prefix when using directly home_dir		*/
-+	char *suffix;	/* suffix when using directly home_dir		*/
-+	int mode;	/* expected: M_REGULAR_FILE or M_DIRECTORY	*/
-+	};
-+
-+/* reads environment variable. if the path isn't absolute will add $HOME/
-+ * at the beginning
-+ * return: 0 - directory exists
-+ *         -1 - directory doesn't exist
-+ */
-+int getusercfv (char *variable, 
-+		    char *home_dir, 
-+		    char *user_dir,
-+		    size_t stringsize);
-+/* reads the $HOME variable */
-+int detectcfv(struct cfv *CFV);
-+
-+/* looks for the config/data file/dir.
-+ * result: -1 - error - cannot find file/dir 
-+ *         0 - ok
-+ *         CFV.result set
-+ */
-+int usercfv (struct cfv *CFV);
-+/* looks for the config/data file/dir.
-+ * result: -1 - error - cannot read $HOME
-+ *          0 - ok - if the CFV.result exists, read it. If not create it.
-+ *              CFV.result set
-+ */              
-+int notnullusercfv (struct cfv *CFV);
-+
-+FILE *fopencfv (struct cfv *CFV, const char *mode);
-+FILE *maynullfopencfv (struct cfv *CFV, const char *mode);
-+FILE *notnullfopencfv (struct cfv *CFV, const char *mode);
-+
-+#endif
diff --git a/aumix-xdg-config.patch b/aumix-xdg-config.patch
new file mode 100644
index 0000000..565afc9
--- /dev/null
+++ b/aumix-xdg-config.patch
@@ -0,0 +1,90 @@
+Add XDG Base Directory support for the per-user config file.
+
+Look for $XDG_CONFIG_HOME/aumixrc (or ~/.config/aumixrc if XDG_CONFIG_HOME
+is unset) before falling back to the legacy ~/.aumixrc.  Write new files
+to the XDG path, creating the parent directory if needed.  The
+/etc/aumixrc system fallback is unchanged.
+
+--- aumix-2.9.1.orig/src/common.c	2026-05-17 00:55:17.082637994 +0200
++++ aumix-2.9.1/src/common.c	2026-05-17 00:57:56.216307552 +0200
+@@ -585,12 +585,40 @@
+ 	return fopen(filename, mode);
+ }
+ 
++/* Build the XDG user config path for AUMIXRC.  Uses $XDG_CONFIG_HOME if
++   set to an absolute path, otherwise $HOME/.config.  Returns the parent
++   directory in *xdg_dir_out (caller may mkdir() it when writing).
++   Returns 0 on success, -1 if no usable HOME/XDG_CONFIG_HOME is set. */
++static int      BuildXdgConfigPath(char *buf, size_t buflen, char **xdg_dir_out)
++{
++	const char     *xdg = getenv("XDG_CONFIG_HOME");
++	const char     *home;
++	static char     dirbuf[PATH_MAX];
++	if (xdg && *xdg == '/') {
++		if ((size_t) snprintf(dirbuf, sizeof(dirbuf), "%s", xdg) >= sizeof(dirbuf))
++			return -1;
++	} else {
++		home = getenv("HOME");
++		if (!home)
++			return -1;
++		if ((size_t) snprintf(dirbuf, sizeof(dirbuf), "%s/.config", home) >= sizeof(dirbuf))
++			return -1;
++	}
++	if ((size_t) snprintf(buf, buflen, "%s/%s", dirbuf, AUMIXRC) >= buflen)
++		return -1;
++	if (xdg_dir_out)
++		*xdg_dir_out = dirbuf;
++	return 0;
++}
++
+ FILE           *OpenDefaultFile(char *mode)
+ {
+ /* Open the settings file for reading or writing.
+ 
+-   Try first ${HOME}/.AUMIXRC, then AUMIXRC_PATH/AUMIXRC;
+-   become an error generator if neither can be opened.
++   For read: try $XDG_CONFIG_HOME/AUMIXRC (or ~/.config/AUMIXRC), then the
++   legacy ${HOME}/.AUMIXRC, then AUMIXRC_PATH/AUMIXRC.
++   For write: write to the XDG path (creating its parent directory if
++   needed) and fall back to AUMIXRC_PATH/AUMIXRC.
+ 
+    Input:
+ 
+@@ -601,15 +629,24 @@
+    Success:   pointer to the default settings file structure
+    Failure:   NULL
+  */
+-	FILE           *setfile;
++	FILE           *setfile = NULL;
+ 	char           *home;
++	char           *xdg_dir;
+ 	char            filename[PATH_MAX];
++	int             writing = (mode && *mode == 'w');
+ 	if (save_filename == NULL) {
+-		home = getenv("HOME");
+-		if (home && ((strlen(home) + strlen(AUMIXRC) + 2) < PATH_MAX)) {
+-			sprintf(filename, "%s/.%s", home, AUMIXRC);
++		if (BuildXdgConfigPath(filename, sizeof(filename), &xdg_dir) == 0) {
++			if (writing)
++				(void) mkdir(xdg_dir, 0700);
+ 			setfile = CheckAndOpen(filename, mode);
+ 		}
++		if (setfile == NULL && !writing) {
++			home = getenv("HOME");
++			if (home && ((strlen(home) + strlen(AUMIXRC) + 2) < PATH_MAX)) {
++				sprintf(filename, "%s/.%s", home, AUMIXRC);
++				setfile = CheckAndOpen(filename, mode);
++			}
++		}
+ 		if (setfile == NULL) {
+ 			if ((strlen(AUMIXRC_PATH) + strlen(AUMIXRC) + 1) < PATH_MAX) {
+ 				sprintf(filename, "%s/%s", AUMIXRC_PATH, AUMIXRC);
+@@ -718,7 +755,7 @@
+ 	fprintf(fp, LOCAL_TEXT("\
+   d:  adjust a device besides /dev/mixer\n\
+   f:  specify file for saving and loading settings (defaults to\n\
+-      ~/.aumixrc or /etc/aumixrc)\n\
++      $XDG_CONFIG_HOME/aumixrc, ~/.aumixrc or /etc/aumixrc)\n\
+   h:  this helpful message\n"));
+ #if defined(HAVE_CURSES) || defined(HAVE_GTK)
+ 	fprintf(fp, LOCAL_TEXT("\
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/aumix-gtk.git/commitdiff/20b869c86bad7502cf9339f18a2d4b4931897d9b



More information about the pld-cvs-commit mailing list