1 diff -Nru aumix-2.6.1/doc/aumix.1 aumix-2.6.1.new/doc/aumix.1
2 --- aumix-2.6.1/doc/aumix.1 Tue Jun 27 23:11:47 2000
3 +++ aumix-2.6.1.new/doc/aumix.1 Tue Jun 27 23:11:28 2000
5 go into interactive mode after doing things non-interactively.
10 +.Pa $CONFIG_DIR/aumixrc ,
14 if the former is inaccessible
16 query all devices and print their settings
19 +.Pa $CONFIG_DIR/aumixrc
27 show a description of the functions of keys
31 +.Pa $CONFIG_DIR/aumixrc ,
39 Saved settings for the mixer are kept in the
43 -files, but can be kept anywhere if specified explicitly.
44 +.Pa $CONFIG_DIR/aumixrc
47 +is now obsolete, though it still works),
48 +but can be kept anywhere if specified explicitly.
49 Color schemes are normally kept in the directory given
52 diff -Nru aumix-2.6.1/po/de.po aumix-2.6.1.new/po/de.po
53 --- aumix-2.6.1/po/de.po Tue Jun 27 23:11:47 2000
54 +++ aumix-2.6.1.new/po/de.po Tue Jun 27 23:15:28 2000
57 " d: adjust a device besides /dev/mixer\n"
58 " f: specify file for saving and loading settings (defaults to\n"
59 -" ~/.aumixrc or /etc/aumixrc)\n"
60 +" $CONFIG_DIR/aumixrc or /etc/aumixrc)\n"
61 " h: this helpful message\n"
63 " d: Anderes Gerät als /dev/mixer benutzen\n"
64 " f: Spezifizieren Sie die Datei zum Speichern und Laden von Einstellungen\n"
65 -" (Standard sind ~/.aumixrc oder /etc/aumixrc)\n"
66 +" (Standard sind $CONFIG_DIR/aumixrc oder /etc/aumixrc) or /etc/aumixrc)\n"
67 " h: Diese nützlichen Informationen\n"
70 diff -Nru aumix-2.6.1/po/es.po aumix-2.6.1.new/po/es.po
71 --- aumix-2.6.1/po/es.po Tue Jun 27 23:11:47 2000
72 +++ aumix-2.6.1.new/po/es.po Tue Jun 27 23:14:48 2000
75 " d: adjust a device besides /dev/mixer\n"
76 " f: specify file for saving and loading settings (defaults to\n"
77 -" ~/.aumixrc or /etc/aumixrc)\n"
78 +" $CONFIG_DIR/aumixrc or /etc/aumixrc)\n"
79 " h: this helpful message\n"
81 " d: ajustar dispositivos además de /dev/mixer\n"
82 " f: indicar el fichero para guardar y cargar las preferencias (por\n"
83 -" defecto es ~/.aumixrc o /etc/aumixrc\n"
84 +" defecto es $CONFIG_DIR/aumixrc o /etc/aumixrc\n"
85 " h: este mensaje de ayuda\n"
88 diff -Nru aumix-2.6.1/po/fr.po aumix-2.6.1.new/po/fr.po
89 --- aumix-2.6.1/po/fr.po Tue Jun 27 23:11:47 2000
90 +++ aumix-2.6.1.new/po/fr.po Tue Jun 27 23:15:18 2000
93 " d: adjust a device besides /dev/mixer\n"
94 " f: specify file for saving and loading settings (defaults to\n"
95 -" ~/.aumixrc or /etc/aumixrc)\n"
96 +" $CONFIG_DIR/aumixrc or /etc/aumixrc)\n"
97 " h: this helpful message\n"
99 " d: ajuster un périphérique autre que /dev/mixer\n"
100 " f: spécifier le fichier de sauvegarde/chargement des paramètres\n"
101 -" (par défaut il s'agit de ~/.aumixrc ou /etc/aumixrc)\n"
102 +" (par défaut il s'agit de $CONFIG_DIR/aumixrc ou /etc/aumixrc)\n"
103 " h: ce message d'aide\n"
106 diff -Nru aumix-2.6.1/po/gl.po aumix-2.6.1.new/po/gl.po
107 --- aumix-2.6.1/po/gl.po Tue Jun 27 23:11:47 2000
108 +++ aumix-2.6.1.new/po/gl.po Tue Jun 27 23:14:38 2000
109 @@ -214,12 +214,12 @@
111 " d: adjust a device besides /dev/mixer\n"
112 " f: specify file for saving and loading settings (defaults to\n"
113 -" ~/.aumixrc or /etc/aumixrc)\n"
114 +" $CONFIG_DIR/aumixrc or /etc/aumixrc)\n"
115 " h: this helpful message\n"
117 " d: axustar outro dispositivo que non sexa /dev/mixer\n"
118 " f: especificar ficheiro para gardar e cargar parámetros (por omisión é\n"
119 -" ~/.aumixrc ou /etc/aumixrc)\n"
120 +" $CONFIG_DIR/aumixrc ou /etc/aumixrc)\n"
121 " h: amosar esta mensaxe de axuda\n"
124 diff -Nru aumix-2.6.1/po/pl.po aumix-2.6.1.new/po/pl.po
125 --- aumix-2.6.1/po/pl.po Tue Jun 27 23:11:47 2000
126 +++ aumix-2.6.1.new/po/pl.po Tue Jun 27 23:16:16 2000
127 @@ -210,12 +210,12 @@
129 " d: adjust a device besides /dev/mixer\n"
130 " f: specify file for saving and loading settings (defaults to\n"
131 -" ~/.aumixrc or /etc/aumixrc)\n"
132 +" $CONFIG_DIR/aumixrc or /etc/aumixrc)\n"
133 " h: this helpful message\n"
135 " d: dostosowuje urz±dzenie inne ni¿ /dev/mixer\n"
136 " f: okre¶la plik do zapisywania i ³adowania ustawieñ (domy¶lnie jest to\n"
137 -" ~/.aumixrc lub /etc/aumixrc)\n"
138 +" $CONFIG_DIR/aumixrc lub /etc/aumixrc)\n"
139 " h: ta pomocna informacja\n"
142 diff -Nru aumix-2.6.1/po/pt_BR.po aumix-2.6.1.new/po/pt_BR.po
143 --- aumix-2.6.1/po/pt_BR.po Tue Jun 27 23:11:47 2000
144 +++ aumix-2.6.1.new/po/pt_BR.po Tue Jun 27 23:14:27 2000
145 @@ -212,12 +212,12 @@
147 " d: adjust a device besides /dev/mixer\n"
148 " f: specify file for saving and loading settings (defaults to\n"
149 -" ~/.aumixrc or /etc/aumixrc)\n"
150 +" $CONFIG_DIR/aumixrc or /etc/aumixrc)\n"
151 " h: this helpful message\n"
153 " d: usar outro dispositivo que não o /dev/mixer\n"
154 " f: SPECIFY FILE FOR SAVING AND LOADING SETTINGS (DEFAULTS TO\n"
155 -" ~/.aumixrc or /etc/aumixrc)\n"
156 +" $CONFIG_DIR/aumixrc or /etc/aumixrc)\n"
157 " h: esta mensagem de ajuda\n"
160 diff -Nru aumix-2.6.1/po/ru.po aumix-2.6.1.new/po/ru.po
161 --- aumix-2.6.1/po/ru.po Tue Jun 27 23:11:47 2000
162 +++ aumix-2.6.1.new/po/ru.po Tue Jun 27 23:16:07 2000
163 @@ -210,12 +210,12 @@
165 " d: adjust a device besides /dev/mixer\n"
166 " f: specify file for saving and loading settings (defaults to\n"
167 -" ~/.aumixrc or /etc/aumixrc)\n"
168 +" $CONFIG_DIR/aumixrc or /etc/aumixrc)\n"
169 " h: this helpful message\n"
171 " d: ÒÅÇÕÌÉÒÏ×ÁÔØ ÕÓÔÒÏÊÓÔ×Á ËÒÏÍÅ /dev/mixer\n"
172 " f: ÕËÁÚÁÎÉÅ ÉÍÅÎÉ ÆÁÊÌÁ ÄÌÑ ÈÒÁÎÅÎÉÑ ÕÓÔÁÎÏ×ÏË (ÐÏ ÕÍÏÌÞÁÎÉÀ\n"
173 -" ~/.aumixrc ÉÌÉ /etc/aumixrc)\n"
174 +" $CONFIG_DIR/aumixrc ÉÌÉ /etc/aumixrc)\n"
178 diff -Nru aumix-2.6.1/po/uk.po aumix-2.6.1.new/po/uk.po
179 --- aumix-2.6.1/po/uk.po Tue Jun 27 23:11:47 2000
180 +++ aumix-2.6.1.new/po/uk.po Tue Jun 27 23:14:13 2000
181 @@ -212,12 +212,12 @@
183 " d: adjust a device besides /dev/mixer\n"
184 " f: specify file for saving and loading settings (defaults to\n"
185 -" ~/.aumixrc or /etc/aumixrc)\n"
186 +" $CONFIG_DIR/aumixrc or /etc/aumixrc)\n"
187 " h: this helpful message\n"
189 " d: ÒÅÇÕÌÀ×ÁÔÉ ÐÒÉÓÔÒϧ ÏËÒ¦Í /dev/mixer\n"
190 " f: ×ËÁÚÁÎÎÑ ¦ÍÅΦ ÆÁÊÌÕ ÄÌÑ ÚÂÅÒ¦ÇÁÎÎÑ Ò¦×Î¦× (ÚÁ ÚÁÍÏ×ÞÁÎÎÑÍ\n"
191 -" ~/.aumixrc ÞÉ /etc/aumixrc)\n"
192 +" $CONFIG_DIR/aumixrc ÞÉ /etc/aumixrc)\n"
196 diff -Nru aumix-2.6.1/src/Makefile.am aumix-2.6.1.new/src/Makefile.am
197 --- aumix-2.6.1/src/Makefile.am Tue Jun 27 23:11:47 2000
198 +++ aumix-2.6.1.new/src/Makefile.am Wed Jun 28 00:12:13 2000
203 -aumix_SOURCES = common.c curses.c dummy.c gpm-xterm.c gtk.c interactive.c \
204 - mouse.c common.h curses.h gpm-xterm.h gtk.h interactive.h \
205 +aumix_SOURCES = userdir.c common.c curses.c dummy.c gpm-xterm.c gtk.c interactive.c \
206 + mouse.c userdir.h common.h curses.h gpm-xterm.h gtk.h interactive.h \
207 mouse.h play.xpm record.xpm
208 localedir = $(datadir)/locale
209 INCLUDES = -I../intl -DLOCALEDIR=\"$(localedir)\" -I@includedir@
210 diff -Nru aumix-2.6.1/src/Makefile.in aumix-2.6.1.new/src/Makefile.in
211 --- aumix-2.6.1/src/Makefile.in Tue Jun 27 23:11:47 2000
212 +++ aumix-2.6.1.new/src/Makefile.in Tue Jun 27 23:11:28 2000
215 CPPFLAGS = @CPPFLAGS@
217 -aumix_OBJECTS = common.o curses.o dummy.o gpm-xterm.o gtk.o \
218 +aumix_OBJECTS = userdir.o common.o curses.o dummy.o gpm-xterm.o gtk.o \
219 interactive.o mouse.o
220 aumix_LDADD = $(LDADD)
222 diff -Nru aumix-2.6.1/src/common.c aumix-2.6.1.new/src/common.c
223 --- aumix-2.6.1/src/common.c Tue Jun 27 23:11:47 2000
224 +++ aumix-2.6.1.new/src/common.c Wed Jun 28 00:10:45 2000
227 #endif /* HAVE_GTK */
228 #include "interactive.h"
229 +#include "userdir.h"
231 FILE *OpenDefaultFile(char *mode);
235 /* Open the settings file for reading or writing.
237 - Try first ${HOME}/.AUMIXRC, then AUMIXRC_PATH/AUMIXRC;
238 + Try first ${HOME}/.AUMIXRC, then then ${HOME}/.AUMIXRC
239 + and eventualy AUMIXRC_PATH/AUMIXRC;
240 become an error generator if neither can be opened.
246 char filename[FILENAME_MAX];
247 + struct cfv etcfile;
249 if (save_filename == NULL) {
250 home = getenv("HOME");
251 if ((strlen(home) + strlen(AUMIXRC)) < PATH_MAX) {
254 if (setfile == NULL) {
257 + etcfile.variable = "CONFIG_DIR";
258 + etcfile.home_dir = NULL;
259 + etcfile.home_scd = NULL;
260 + etcfile.subname = AUMIXRC;
261 + etcfile.prefix = ".";
262 + etcfile.suffix = "";
263 + etcfile.mode = M_REGULAR_FILE;
265 + setfile = fopencfv(&etcfile, mode);
266 + if (setfile == NULL) {
267 + sprintf(filename, "%s/%s", AUMIXRC_PATH, AUMIXRC);
268 + setfile = fopen(filename, mode);
271 setfile = fopen(save_filename, mode);
272 diff -Nru aumix-2.6.1/src/userdir.c aumix-2.6.1.new/src/userdir.c
273 --- aumix-2.6.1/src/userdir.c Thu Jan 1 01:00:00 1970
274 +++ aumix-2.6.1.new/src/userdir.c Tue Jun 27 23:11:28 2000
277 +#include "userdir.h"
279 +static char *nonulhome = "";
281 +/******************************************************************************/
283 +int getusercfv (char *variable,
291 + bzero (user_dir, stringsize);
292 + if (variable == NULL || *variable == '\0') return (-1);
293 + if (home_dir == NULL) home_dir = nonulhome;
294 + d = getenv (variable);
295 + if (d == NULL || *d == '\0') return (-1);
298 + strncpy (user_dir, d, stringsize-1);
302 + snprintf (user_dir, stringsize-1, "%s/%s", home_dir, d);
305 + if (stat(user_dir,&st) != -1 && S_ISDIR(st.st_mode))
313 +/******************************************************************************/
315 +int detectcfv(struct cfv *CFV) {
316 + if (CFV->subname == NULL) CFV->subname = nonulhome;
317 + if (CFV->home_dir == NULL) CFV->home_dir = getenv ("HOME");
318 + if (CFV->home_dir == NULL) CFV->home_dir = CFV->home_scd;
319 + if (CFV->home_dir == NULL) return (-1);
323 +/******************************************************************************/
325 +int preparemain(struct cfv *CFV) {
328 + if ((p = strrchr(CFV->result, '/')) && *(p+1) == '\0')
330 + snprintf ((rindex(CFV->result,'\0')), MAXPATHLEN-1, "/%s",
332 + if (stat( CFV->result,&st) != -1
334 + S_ISDIR(st.st_mode) :
335 + S_ISREG(st.st_mode)) /* have file or dir */
340 +/******************************************************************************/
342 +int preparehome(struct cfv *CFV) {
344 + if (CFV->home_dir == NULL || *(CFV->home_dir) == '\0') return (-1);
345 + if (CFV->prefix == NULL && CFV->suffix == NULL) return (-1);
346 + snprintf (CFV->result, MAXPATHLEN-1, "%s/%s%s%s",
348 + CFV->prefix? CFV->prefix:"",
350 + CFV->suffix? CFV->suffix:"");
351 + if (stat(CFV->result,&st) != -1
353 + S_ISDIR(st.st_mode) :
354 + S_ISREG(st.st_mode)) /* have file or dir */
359 +/******************************************************************************/
361 +int usercfv (struct cfv *CFV) {
363 + gr = detectcfv(CFV);
365 + /* get environment variable */
366 + gr = getusercfv (CFV->variable,
370 + if (gr != -1) /* have main directory */
372 + gr = preparemain(CFV);
375 + /* don't have main directory or a proper variable set */
376 + gr = preparehome(CFV);
380 +/******************************************************************************/
382 +/* If directory or file doesn't exist returns the best one wich may be created */
383 +int notnullusercfv (struct cfv *CFV) {
385 + if ((usercfv(CFV)) == -1) {
386 + gr = detectcfv(CFV);
387 + if (gr) return gr; /* remember, it works for errors! */
388 + /* get the environment variable */
389 + gr = getusercfv (CFV->variable,
393 + if (gr != -1) /* have main directory */
395 + gr = preparemain(CFV);
398 + /* don't have main directory or a proper variable set */
399 + gr = preparehome(CFV);
405 +/******************************************************************************/
407 +FILE *maynullfopencfv (struct cfv *CFV, const char *mode)
409 + FILE *cfvfile = NULL;
411 + CFV->mode = M_REGULAR_FILE;
412 + if ((usercfv (CFV)) == -1) return (NULL);
413 + cfvfile = fopen (CFV->result, mode);
416 +/******************************************************************************/
418 +FILE *notnullfopencfv (struct cfv *CFV, const char *mode)
420 + FILE *cfvfile = NULL;
422 + CFV->mode = M_REGULAR_FILE;
423 + if ((notnullusercfv (CFV)) == -1) return (NULL);
424 + cfvfile = fopen (CFV->result, mode);
428 +/******************************************************************************/
430 +FILE *fopencfv (struct cfv *CFV, const char *mode)
432 + FILE *cfvfile = NULL;
434 + if (cfvfile == NULL && (strpbrk(mode, "wa")) != NULL) /* create in best location */
435 + cfvfile = notnullfopencfv (CFV, mode);
437 + cfvfile = maynullfopencfv (CFV, mode);
442 +/******************************************************************************/
443 \ No newline at end of file
444 diff -Nru aumix-2.6.1/src/userdir.h aumix-2.6.1.new/src/userdir.h
445 --- aumix-2.6.1/src/userdir.h Thu Jan 1 01:00:00 1970
446 +++ aumix-2.6.1.new/src/userdir.h Tue Jun 27 23:11:28 2000
456 +#include <sys/types.h>
457 +#include <sys/stat.h>
458 +#include <sys/param.h>
460 +#define M_REGULAR_FILE 0
461 +#define M_DIRECTORY 1
464 + char result[MAXPATHLEN]; /* our result */
465 + char *variable; /* name of an environment variable */
466 + char *home_dir; /* home directory or NULL for autodetect */
467 + char *home_scd; /* directory if home_dir==NULL and no result */
468 + char *subname; /* core name of a file/directory */
469 + char *prefix; /* prefix when using directly home_dir */
470 + char *suffix; /* suffix when using directly home_dir */
471 + int mode; /* expected: M_REGULAR_FILE or M_DIRECTORY */
474 +/* reads environment variable. if the path isn't absolute will add $HOME/
476 + * return: 0 - directory exists
477 + * -1 - directory doesn't exist
479 +int getusercfv (char *variable,
482 + size_t stringsize);
483 +/* reads the $HOME variable */
484 +int detectcfv(struct cfv *CFV);
486 +/* looks for the config/data file/dir.
487 + * result: -1 - error - cannot find file/dir
491 +int usercfv (struct cfv *CFV);
492 +/* looks for the config/data file/dir.
493 + * result: -1 - error - cannot read $HOME
494 + * 0 - ok - if the CFV.result exists, read it. If not create it.
497 +int notnullusercfv (struct cfv *CFV);
499 +FILE *fopencfv (struct cfv *CFV, const char *mode);
500 +FILE *maynullfopencfv (struct cfv *CFV, const char *mode);
501 +FILE *notnullfopencfv (struct cfv *CFV, const char *mode);