[packages/aumix] Rel 3

arekm arekm at pld-linux.org
Sun May 17 14:44:58 CEST 2026


commit 003b13d07f06cff457d427edc3ed60cdd944059f
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sun May 17 14:44:23 2026 +0200

    Rel 3

 aumix-fno-common.patch |  85 +++++++++
 aumix-home_etc.patch   | 491 -------------------------------------------------
 aumix-xdg-config.patch |  90 +++++++++
 aumix.spec             |  11 +-
 4 files changed, 182 insertions(+), 495 deletions(-)
---
diff --git a/aumix.spec b/aumix.spec
index a19da05..4dc55f4 100644
--- a/aumix.spec
+++ b/aumix.spec
@@ -10,7 +10,7 @@ Summary(ru.UTF-8):	Аудио микшер на базе библиотеки cu
 Summary(uk.UTF-8):	Аудіо мікшер, базований на біблиотеці curses
 Name:		aumix
 Version:	2.9.1
-Release:	2
+Release:	3
 License:	GPL v2+
 Group:		Applications/Sound
 Source0:	http://www.jpj.net/~trevor/aumix/releases/%{name}-%{version}.tar.bz2
@@ -19,8 +19,9 @@ Source1:	%{name}.init
 Source2:	%{name}.sysconfig
 Source3:	%{name}.desktop
 Source4:	%{name}.png
-Patch0:		%{name}-home_etc.patch
-Patch1:		%{name}-x%{name}.patch
+Patch0:		%{name}-x%{name}.patch
+Patch1:		%{name}-fno-common.patch
+Patch2:		%{name}-xdg-config.patch
 URL:		http://www.jpj.net/~trevor/aumix.html
 BuildRequires:	autoconf
 BuildRequires:	automake
@@ -106,11 +107,13 @@ systemu.
 %setup -q
 %patch -P0 -p1
 %patch -P1 -p1
+%patch -P2 -p1
 
 %build
 %{__gettextize}
-%{__aclocal}
+%{__aclocal} -I m4
 %{__autoconf}
+%{__autoheader}
 %{__automake}
 
 CPPFLAGS="-I/usr/include/ncurses"
diff --git a/aumix-fno-common.patch b/aumix-fno-common.patch
new file mode 100644
index 0000000..2c2ac73
--- /dev/null
+++ b/aumix-fno-common.patch
@@ -0,0 +1,85 @@
+--- a/src/common.c
++++ b/src/common.c
+@@ -36,6 +36,8 @@ char           *save_filename = NULL;	/*
+ char           *device_filename = "/dev/mixer";	/* name of mixer device file */
+ unsigned short  setfile_opened = FALSE, setfile_write_perm = FALSE, setfile_read_perm = FALSE;
+ int             current_dev = 0, mixer_fd = -1, mutelevel[SOUND_MIXER_NRDEVICES], devmask = 0, recmask = 0, recsrc = 0, stereodevs = 0, mutestate = 0, interactive = FALSE;
++int             ourlevel[SOUND_MIXER_NRDEVICES];
++int             our_recplay[SOUND_MIXER_NRDEVICES];
+ #ifdef USE_OWN_LABELS
+ /* This is to ease translation--don't use if this copy of aumix is very old.
+  * These labels correspond to the soundcard.h from Linux 2.3.12 or FreeBSD
+--- a/src/common.h
++++ b/src/common.h
+@@ -129,8 +129,8 @@ extern int      ReadLevel(int device, in
+ extern int      ReadRecSrc(void);
+ extern int      WriteRecSrc(void);
+ int             ReadWriteMixer(int device, char *rw, int *left, int *right, char *rp);
+-int             ourlevel[SOUND_MIXER_NRDEVICES];
+-int             our_recplay[SOUND_MIXER_NRDEVICES];	/* Store record/play settings for updates. */
++extern int      ourlevel[SOUND_MIXER_NRDEVICES];
++extern int      our_recplay[SOUND_MIXER_NRDEVICES];	/* Store record/play settings for updates. */
+ int             LoadSettings(void);
+ int             SaveSettings(void);
+ int             dummy_ioctl(int fd, unsigned long req, int *arg);
+--- a/src/curses.c
++++ b/src/curses.c
+@@ -27,7 +27,8 @@
+ #include "mouse.h"
+ 
+ unsigned char  *key_keys, *key_load, *key_mute, *key_only, *key_quit, *key_save, *key_undo, *lang;
+-int             current_dev, level_increment, balance_increment, menu_width, level_width, label_width, balance_width, levelbalmode, cols_saved, lines_saved;
++int             level_increment, balance_increment, menu_width, level_width, label_width, balance_width, levelbalmode, cols_saved, lines_saved;
++int             (*Wgetch)(WINDOW *win);
+ int             in_keysbox = FALSE;
+ static int	cursor_x, cursor_y;	/* keep track of cursor position */
+ 
+--- a/src/curses.h
++++ b/src/curses.h
+@@ -88,8 +88,8 @@ static int      LABELSIZES[] = {
+ };
+ #define ARROW_WIDTH 1		/* width of selection arrow */
+ #define R_P_WIDTH 1		/* width of record/play indicator */
+-int             level_increment, balance_increment, menu_width, level_width, label_width, balance_width, levelbalmode;
+-int             (*Wgetch) (WINDOW * win);
++extern int      level_increment, balance_increment, menu_width, level_width, label_width, balance_width, levelbalmode;
++extern int      (*Wgetch) (WINDOW * win);
+ #define Getch() (*Wgetch)(stdscr)
+ void            WakeUpCurses(void);
+ void            InitScreenCurses(void);
+--- a/src/interactive.h
++++ b/src/interactive.h
+@@ -7,7 +7,7 @@
+ #define MUTE_ONLY 2
+ #define        REFRESH_PERIOD 1	/* number of seconds between updates */
+ 
+-unsigned char  *key_keys, *key_load, *key_mute, *key_only, *key_quit, *key_save, *key_undo;
++extern unsigned char *key_keys, *key_load, *key_mute, *key_only, *key_quit, *key_save, *key_undo;
+ void            AumixSignalHandler(int signal_number);
+ void            InitScreen(void);
+ void            KeysBox(void);
+--- a/src/mouse.c
++++ b/src/mouse.c
+@@ -39,6 +39,13 @@ static int      xpos, ypos, buttons;
+ static int      cwidth = 8, cheight = 16;
+ #endif				/* HAVE_SYSMOUSE */
+ 
++/* Gpm_Wgetch() has an old-style no-arg declaration in gpm.h but Wgetch needs
++ * int (*)(WINDOW *).  Provide a typed wrapper so assignment is well-formed. */
++static int gpm_wgetch_wrapper(WINDOW *win)
++{
++	return Gpm_Wgetch();
++}
++
+ void            StartMouse(void)
+ {
+ 	Gpm_Connect     conn;
+@@ -77,7 +84,7 @@ void            StartMouse(void)
+ 	/* don't check for < 0, gpm-xterm returns -2 */
+ 	if (Gpm_Open(&conn, 0) != -1) {
+ 		gpm_handler = MouseHandler;
+-		Wgetch = Gpm_Wgetch;
++		Wgetch = gpm_wgetch_wrapper;
+ 	} else
+ 		Wgetch = wgetch;
+ #if HAVE_GETMOUSE
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.git/commitdiff/003b13d07f06cff457d427edc3ed60cdd944059f



More information about the pld-cvs-commit mailing list