1 --- aumix-2.1/doc/aumix.1 Mon Jan 31 23:30:12 2000
2 +++ aumix-2.1.pius/doc/aumix.1 Fri Feb 4 00:50:48 2000
4 go into interactive mode after doing things non-interactively.
9 +.Pa $CONFIG_DIR/aumixrc ,
13 if the former is inaccessible
15 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 --- aumix-2.1/src/Makefile.am Sat Dec 25 17:53:54 1999
53 +++ aumix-2.1.pius/src/Makefile.am Thu Feb 3 16:26:12 2000
57 -aumix_SOURCES = common.c curses.c dummy.c gpm-xterm.c gtk.c interactive.c \
58 - mouse.c common.h curses.h gpm-xterm.h gtk.h interactive.h \
60 +aumix_SOURCES = userdir.c common.c curses.c dummy.c gpm-xterm.c gtk.c \
61 + interactive.c mouse.c userdir.h common.h curses.h gpm-xterm.h \
62 + gtk.h interactive.h mouse.h
63 localedir = $(datadir)/locale
64 INCLUDES = -I../intl -DLOCALEDIR=\"$(localedir)\" -I@includedir@
65 CFLAGS = @CFLAGS@ @GLIB_CFLAGS@ @GTK_CFLAGS@
66 --- aumix-2.1/src/Makefile.in Mon Jan 31 23:19:53 2000
67 +++ aumix-2.1.pius/src/Makefile.in Thu Feb 3 16:25:03 2000
72 -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 mouse.h
73 +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
75 localedir = $(datadir)/locale
76 INCLUDES = -I../intl -DLOCALEDIR=\"$(localedir)\" -I@includedir@
81 -aumix_OBJECTS = common.o curses.o dummy.o gpm-xterm.o gtk.o \
82 +aumix_OBJECTS = userdir.o common.o curses.o dummy.o gpm-xterm.o gtk.o \
84 aumix_LDADD = $(LDADD)
86 --- aumix-2.1/src/common.c Mon Jan 31 23:30:12 2000
87 +++ aumix-2.1.pius/src/common.c Thu Feb 3 23:51:47 2000
91 #include "interactive.h"
94 void ExitIfError(int error);
95 int InitializeMixer(char *device_file);
98 /* Open the settings file for reading or writing.
100 - Try first ${HOME}/.AUMIXRC, then AUMIXRC_PATH/AUMIXRC;
101 + Try first ${CONFIG_DIR}/AUMIXRC, then ${HOME}/.AUMIXRC
102 + and eventually AUMIXRC_PATH/AUMIXRC;
103 become an error generator if neither can be opened.
106 @@ -545,19 +547,31 @@
109 char filename[FILENAME_MAX];
110 + struct cfv etcfile;
112 if (save_filename == NULL) {
113 - home = getenv("HOME");
114 - sprintf(filename, "%s/.%s", home, AUMIXRC);
115 - setfile = fopen(filename, mode);
116 - if (setfile == NULL) {
117 - sprintf(filename, "%s/%s", AUMIXRC_PATH, AUMIXRC);
118 - setfile = fopen(filename, mode);
120 - if (setfile == NULL) {
123 + etcfile.variable = "CONFIG_DIR";
124 + etcfile.home_dir = NULL;
125 + etcfile.home_scd = NULL;
126 + etcfile.subname = AUMIXRC;
127 + etcfile.prefix = ".";
128 + etcfile.suffix = "";
129 + etcfile.mode = M_REGULAR_FILE;
131 + if ((usercfv (&etcfile)) == -1)
132 + setfile = notnullfopencfv(&etcfile, mode);
134 + setfile = fopen(etcfile.result, mode);
136 + if (setfile == NULL) {
137 + sprintf(filename, "%s/%s", AUMIXRC_PATH, AUMIXRC);
138 + setfile = fopen(filename, mode);
140 + if (setfile == NULL)
144 - setfile = fopen(save_filename, mode);
145 + setfile = fopen(save_filename, mode);
151 d: adjust a device besides /dev/mixer\n\
152 f: specify file for saving and loading settings (defaults to\n\
153 - ~ /.aumixrc or /etc/aumixrc)\n\
154 + $CONFIG_DIR/aumixrc, ~/.aumixrc or /etc/aumixrc)\n\
155 C: specify color scheme\n\
156 h: this helpful message\n"));
158 --- aumix-2.1/src/userdir.c Thu Jan 1 01:00:00 1970
159 +++ aumix-2.1.pius/src/userdir.c Thu Feb 3 01:24:28 2000
162 +#include "userdir.h"
164 +static char *nonulhome = "";
166 +/******************************************************************************/
168 +int getusercfv (char *variable,
176 + bzero (user_dir, stringsize);
177 + if (variable == NULL || *variable == '\0') return (-1);
178 + if (home_dir == NULL) home_dir = nonulhome;
179 + d = getenv (variable);
180 + if (d == NULL || *d == '\0') return (-1);
183 + strncpy (user_dir, d, stringsize-1);
187 + snprintf (user_dir, stringsize-1, "%s/%s", home_dir, d);
190 + if (stat(user_dir,&st) != -1 && S_ISDIR(st.st_mode))
198 +/******************************************************************************/
200 +int detectcfv(struct cfv *CFV) {
201 + if (CFV->subname == NULL) CFV->subname = nonulhome;
202 + if (CFV->home_dir == NULL) CFV->home_dir = getenv ("HOME");
203 + if (CFV->home_dir == NULL) CFV->home_dir = CFV->home_scd;
204 + if (CFV->home_dir == NULL) return (-1);
208 +int preparemain(struct cfv *CFV) {
211 + if ((p = strrchr(CFV->result, '/')) && *(p+1) == '\0')
213 + snprintf ((rindex(CFV->result,'\0')), MAXPATHLEN-1, "/%s",
215 + if (stat( CFV->result,&st) != -1
217 + S_ISDIR(st.st_mode) :
218 + S_ISREG(st.st_mode)) /* have file or dir */
223 +int preparehome(struct cfv *CFV) {
225 + if (CFV->home_dir == NULL || *(CFV->home_dir) == '\0') return (-1);
226 + if (CFV->prefix == NULL && CFV->suffix == NULL) return (-1);
227 + snprintf (CFV->result, MAXPATHLEN-1, "%s/%s%s%s",
229 + CFV->prefix? CFV->prefix:"",
231 + CFV->suffix? CFV->suffix:"");
232 + if (stat(CFV->result,&st) != -1
234 + S_ISDIR(st.st_mode) :
235 + S_ISREG(st.st_mode)) /* have file or dir */
240 +int usercfv (struct cfv *CFV) {
242 + gr = detectcfv(CFV);
244 + /* get environment variable */
245 + gr = getusercfv (CFV->variable,
249 + if (gr != -1) /* have main directory */
251 + gr = preparemain(CFV);
254 + /* don't have main directory or a proper variable set */
255 + gr = preparehome(CFV);
259 +/******************************************************************************/
261 +/* If directory or file doesn't exist returns the best one wich may be created*/
262 +int notnullusercfv (struct cfv *CFV) {
264 + if ((usercfv(CFV)) == -1) {
265 + gr = detectcfv(CFV);
267 + /* get environment variable */
268 + gr = getusercfv (CFV->variable,
272 + if (gr != -1) /* have main directory */
274 + gr = preparemain(CFV);
277 + /* don't have main directory or a proper variable set */
278 + gr = preparehome(CFV);
284 +/******************************************************************************/
286 +FILE *fopencfv (struct cfv *CFV, const char *mode)
288 + FILE *cfvfile = NULL;
290 + CFV->mode = M_REGULAR_FILE;
291 + if ((usercfv (CFV)) == -1) return (NULL);
292 + cfvfile = fopen (CFV->result, mode);
295 +/******************************************************************************/
297 +FILE *notnullfopencfv (struct cfv *CFV, const char *mode)
299 + FILE *cfvfile = NULL;
301 + CFV->mode = M_REGULAR_FILE;
302 + if ((notnullusercfv (CFV)) == -1) return (NULL);
303 + cfvfile = fopen (CFV->result, mode);
307 --- aumix-2.1/src/userdir.h Thu Jan 1 01:00:00 1970
308 +++ aumix-2.1.pius/src/userdir.h Thu Feb 3 01:58:57 2000
318 +#include <sys/types.h>
319 +#include <sys/stat.h>
320 +#include <sys/param.h>
322 +#define M_REGULAR_FILE 0
323 +#define M_DIRECTORY 1
326 + char result[MAXPATHLEN]; /* our result */
327 + char *variable; /* name of an environment variable */
328 + char *home_dir; /* home directory or NULL for autodetect */
329 + char *home_scd; /* directory if home_dir==NULL and no result */
330 + char *subname; /* core name of a file/directory */
331 + char *prefix; /* prefix when using directly home_dir */
332 + char *suffix; /* suffix when using directly home_dir */
333 + int mode; /* expected: M_REGULAR_FILE or M_DIRECTORY */
336 +/* reads environment variable. if the path isn't absolute will add $HOME/
338 + * return: 0 - directory exists
339 + * -1 - directory doesn't exist
341 +int getusercfv (char *variable,
344 + size_t stringsize);
345 +/* reads the $HOME variable */
346 +int detectcfv(struct cfv *CFV);
348 +/* looks for the config/data file/dir.
349 + * result: -1 - error - cannot find file/dir
353 +int usercfv (struct cfv *CFV);
354 +/* looks for the config/data file/dir.
355 + * result: -1 - error - cannot read $HOME
356 + * 0 - ok - if the CFV.result exists, read it. If not create it.
359 +int notnullusercfv (struct cfv *CFV);
361 +FILE *fopencfv (struct cfv *CFV, const char *mode);
362 +FILE *notnullfopencfv (struct cfv *CFV, const char *mode);
365 --- aumix-2.1/po/aumix.pot Mon Jan 31 23:30:12 2000
366 +++ aumix-2.1.pius/po/aumix.pot Fri Feb 4 01:11:42 2000
369 " d: adjust a device besides /dev/mixer\n"
370 " f: specify file for saving and loading settings (defaults to\n"
371 -" ~ /.aumixrc or /etc/aumixrc)\n"
372 +" $CONFIG_DIR/aumixrc, ~ /.aumixrc or /etc/aumixrc)\n"
373 " C: specify color scheme\n"
374 " h: this helpful message\n"
376 --- aumix-2.1/po/de.po Sun Nov 28 07:35:18 1999
377 +++ aumix-2.1.pius/po/de.po Fri Feb 4 01:10:08 2000
380 " d: adjust a device besides /dev/mixer\n"
381 " f: specify file for saving and loading settings (defaults to\n"
382 -" ~ /.aumixrc or /etc/aumixrc)\n"
383 +" $CONFIG_DIR/aumixrc, ~ /.aumixrc or /etc/aumixrc)\n"
384 " C: specify color scheme\n"
385 " h: this helpful message\n"
388 "Weitere Optionen:\n"
389 " d: Anderes Gerät als /dev/mixer benutzen\n"
390 " f: spezifizieren Sie Datei für Einsparung- und Ladeneinstellungen\n"
391 -" (Rückstellungen zum ~ /.aumixrc or /etc/aumixrc)\n"
392 +" (Rückstellungen zum $CONFIG_DIR/aumixrc, ~ /.aumixrc or /etc/aumixrc)\n"
393 " h: Diese nützlichen Informationen\n"
396 --- aumix-2.1/po/es.po Mon Dec 6 16:41:47 1999
397 +++ aumix-2.1.pius/po/es.po Fri Feb 4 01:10:21 2000
400 " d: adjust a device besides /dev/mixer\n"
401 " f: specify file for saving and loading settings (defaults to\n"
402 -" ~ /.aumixrc or /etc/aumixrc)\n"
403 +" $CONFIG_DIR/aumixrc, ~ /.aumixrc or /etc/aumixrc)\n"
404 " C: specify color scheme\n"
405 " h: this helpful message\n"
409 " d: ajustar dispositivos además de /dev/mixer\n"
410 " f: indicar el fichero para guardar y cargar las preferencias (por\n"
411 -" defecto es ~/.aumixrc o /etc/aumixrc\n"
412 +" defecto es $CONFIG_DIR/aumixrc, ~/.aumixrc o /etc/aumixrc\n"
413 " C: indicar el esquema de color\n"
414 " h: este mensaje de ayuda\n"
416 --- aumix-2.1/po/gl.po Mon Dec 6 16:41:47 1999
417 +++ aumix-2.1.pius/po/gl.po Fri Feb 4 01:10:34 2000
420 " d: adjust a device besides /dev/mixer\n"
421 " f: specify file for saving and loading settings (defaults to\n"
422 -" ~ /.aumixrc or /etc/aumixrc)\n"
423 +" $CONFIG_DIR/aumixrc, ~ /.aumixrc or /etc/aumixrc)\n"
424 " C: specify color scheme\n"
425 " h: this helpful message\n"
429 " d: axustar outro dispositivo que non sexa /dev/mixer\n"
430 " f: especificar ficheiro para gardar e cargar parámetros (por omisión é\n"
431 -" ~/.aumixrc ou /etc/aumixrc)\n"
432 +" $CONFIG_DIR/aumixrc, ~/.aumixrc ou /etc/aumixrc)\n"
433 " C: especifica-lo esquema de cor\n"
434 " h: amosar esta mensaxe de axuda\n"
436 --- aumix-2.1/po/pl.po Mon Dec 20 02:13:11 1999
437 +++ aumix-2.1.pius/po/pl.po Fri Feb 4 01:10:50 2000
440 " d: adjust a device besides /dev/mixer\n"
441 " f: specify file for saving and loading settings (defaults to\n"
442 -" ~/.aumixrc or /etc/aumixrc)\n"
443 +" $CONFIG_DIR/aumixrc, ~/.aumixrc or /etc/aumixrc)\n"
444 " C: specify color scheme\n"
445 " h: this helpful message\n"
449 " d: dostosowuje urz±dzenie inne ni¿ /dev/mixer\n"
450 " f: okre¶la plik do zapisywania i ³adowania ustawieñ (domy¶lnie jest to\n"
451 -" ~/.aumixrc lub /etc/aumixrc)\n"
452 +" $CONFIG_DIR/aumixrc, ~/.aumixrc lub /etc/aumixrc)\n"
453 " C: okre¶la plik zawieraj±cy schemat u¿ycia kolorów\n"
454 " h: ta pomocna informacja\n"
456 --- aumix-2.1/po/pt_BR.po Sun Nov 28 07:35:18 1999
457 +++ aumix-2.1.pius/po/pt_BR.po Fri Feb 4 01:11:01 2000
460 " d: adjust a device besides /dev/mixer\n"
461 " f: specify file for saving and loading settings (defaults to\n"
462 -" ~ /.aumixrc or /etc/aumixrc)\n"
463 +" $CONFIG_DIR/aumixrc, ~ /.aumixrc or /etc/aumixrc)\n"
464 " C: specify color scheme\n"
465 " h: this helpful message\n"
469 " d: usar outro dispositivo que não o /dev/mixer\n"
470 " f: SPECIFY FILE FOR SAVING AND LOADING SETTINGS (DEFAULTS TO\n"
471 -" ~ /.aumixrc or /etc/aumixrc)\n"
472 +" $CONFIG_DIR/aumixrc, ~ /.aumixrc or /etc/aumixrc)\n"
473 " C: SPECIFY COLOR SCHEME\n"
474 " h: esta mensagem de ajuda\n"
476 --- aumix-2.1/po/ru.po Mon Dec 20 02:13:11 1999
477 +++ aumix-2.1.pius/po/ru.po Fri Feb 4 01:11:14 2000
480 " d: adjust a device besides /dev/mixer\n"
481 " f: specify file for saving and loading settings (defaults to\n"
482 -" ~ /.aumixrc or /etc/aumixrc)\n"
483 +" $CONFIG_DIR/aumixrc, ~ /.aumixrc or /etc/aumixrc)\n"
484 " C: specify color scheme\n"
485 " h: this helpful message\n"
489 " d: ÒÅÇÕÌÉÒÏ×ÁÔØ ÕÓÔÒÏÊÓÔ×Á ËÒÏÍÅ /dev/mixer\n"
490 " f: ÕËÁÚÁÎÉÅ ÉÍÅÎÉ ÆÁÊÌÁ ÄÌÑ ÈÒÁÎÅÎÉÑ ÕÓÔÁÎÏ×ÏË (ÐÏ ÕÍÏÌÞÁÎÉÀ\n"
491 -" ~ /.aumixrc ÉÌÉ /etc/aumixrc)\n"
492 +" $CONFIG_DIR/aumixrc, ~ /.aumixrc ÉÌÉ /etc/aumixrc)\n"
493 " C: ×ÙÂÏÒ Ã×ÅÔÏ×ÏÊ ÓÈÅÍÙ\n"
496 --- aumix-2.1/po/uk.po Sun Nov 28 07:35:18 1999
497 +++ aumix-2.1.pius/po/uk.po Fri Feb 4 01:11:26 2000
500 " d: adjust a device besides /dev/mixer\n"
501 " f: specify file for saving and loading settings (defaults to\n"
502 -" ~ /.aumixrc or /etc/aumixrc)\n"
503 +" $CONFIG_DIR/aumixrc, ~ /.aumixrc or /etc/aumixrc)\n"
504 " C: specify color scheme\n"
505 " h: this helpful message\n"
509 " d: ÒÅÇÕÌÀ×ÁÔÉ ÐÒÉÓÔÒϧ ÏËÒ¦Í /dev/mixer\n"
510 " f: ×ËÁÚÁÎÎÑ ¦ÍÅΦ ÆÁÊÌÕ ÄÌÑ ÚÂÅÒ¦ÇÁÎÎÑ Ò¦×Î¦× (ÚÁ ÚÁÍÏ×ÞÁÎÎÑÍ\n"
511 -" ~ /.aumixrc ÞÉ /etc/aumixrc)\n"
512 +" $CONFIG_DIR/aumixrc, ~ /.aumixrc ÞÉ /etc/aumixrc)\n"
513 " C: SPECIFY COLOR SCHEME\n"