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 @@ -548,22 +550,34 @@
107 Success: pointer to the default settings file structure
111 + FILE *setfile = NULL;
113 char filename[FILENAME_MAX];
114 + struct cfv etcfile;
116 if (save_filename == NULL) {
117 - home = getenv("HOME");
118 - sprintf(filename, "%s/.%s", home, AUMIXRC);
119 - setfile = fopen(filename, mode);
120 - if (setfile == NULL) {
121 - sprintf(filename, "%s/%s", AUMIXRC_PATH, AUMIXRC);
122 - setfile = fopen(filename, mode);
124 - if (setfile == NULL) {
127 + etcfile.variable = "CONFIG_DIR";
128 + etcfile.home_dir = NULL;
129 + etcfile.home_scd = NULL;
130 + etcfile.subname = AUMIXRC;
131 + etcfile.prefix = ".";
132 + etcfile.suffix = "";
133 + etcfile.mode = M_REGULAR_FILE;
135 + if ((usercfv (&etcfile)) == -1)
136 + setfile = notnullfopencfv(&etcfile, mode);
138 + setfile = fopen(etcfile.result, mode);
140 + if (setfile == NULL) {
141 + sprintf(filename, "%s/%s", AUMIXRC_PATH, AUMIXRC);
142 + setfile = fopen(filename, mode);
144 + if (setfile == NULL)
148 - setfile = fopen(save_filename, mode);
149 + setfile = fopen(save_filename, mode);
155 d: adjust a device besides /dev/mixer\n\
156 f: specify file for saving and loading settings (defaults to\n\
157 - ~ /.aumixrc or /etc/aumixrc)\n\
158 + $CONFIG_DIR/aumixrc, ~/.aumixrc or /etc/aumixrc)\n\
159 C: specify color scheme\n\
160 h: this helpful message\n"));
162 --- aumix-2.1/src/userdir.c Thu Jan 1 01:00:00 1970
163 +++ aumix-2.1.pius/src/userdir.c Thu Feb 3 01:24:28 2000
166 +#include "userdir.h"
168 +static char *nonulhome = "";
170 +/******************************************************************************/
172 +int getusercfv (char *variable,
180 + bzero (user_dir, stringsize);
181 + if (variable == NULL || *variable == '\0') return (-1);
182 + if (home_dir == NULL) home_dir = nonulhome;
183 + d = getenv (variable);
184 + if (d == NULL || *d == '\0') return (-1);
187 + strncpy (user_dir, d, stringsize-1);
191 + snprintf (user_dir, stringsize-1, "%s/%s", home_dir, d);
194 + if (stat(user_dir,&st) != -1 && S_ISDIR(st.st_mode))
202 +/******************************************************************************/
204 +int detectcfv(struct cfv *CFV) {
205 + if (CFV->subname == NULL) CFV->subname = nonulhome;
206 + if (CFV->home_dir == NULL) CFV->home_dir = getenv ("HOME");
207 + if (CFV->home_dir == NULL) CFV->home_dir = CFV->home_scd;
208 + if (CFV->home_dir == NULL) return (-1);
212 +int preparemain(struct cfv *CFV) {
215 + if ((p = strrchr(CFV->result, '/')) && *(p+1) == '\0')
217 + snprintf ((rindex(CFV->result,'\0')), MAXPATHLEN-1, "/%s",
219 + if (stat( CFV->result,&st) != -1
221 + S_ISDIR(st.st_mode) :
222 + S_ISREG(st.st_mode)) /* have file or dir */
227 +int preparehome(struct cfv *CFV) {
229 + if (CFV->home_dir == NULL || *(CFV->home_dir) == '\0') return (-1);
230 + if (CFV->prefix == NULL && CFV->suffix == NULL) return (-1);
231 + snprintf (CFV->result, MAXPATHLEN-1, "%s/%s%s%s",
233 + CFV->prefix? CFV->prefix:"",
235 + CFV->suffix? CFV->suffix:"");
236 + if (stat(CFV->result,&st) != -1
238 + S_ISDIR(st.st_mode) :
239 + S_ISREG(st.st_mode)) /* have file or dir */
244 +int usercfv (struct cfv *CFV) {
246 + gr = detectcfv(CFV);
248 + /* get environment variable */
249 + gr = getusercfv (CFV->variable,
253 + if (gr != -1) /* have main directory */
255 + gr = preparemain(CFV);
258 + /* don't have main directory or a proper variable set */
259 + gr = preparehome(CFV);
263 +/******************************************************************************/
265 +/* If directory or file doesn't exist returns the best one wich may be created*/
266 +int notnullusercfv (struct cfv *CFV) {
268 + if ((usercfv(CFV)) == -1) {
269 + gr = detectcfv(CFV);
271 + /* get environment variable */
272 + gr = getusercfv (CFV->variable,
276 + if (gr != -1) /* have main directory */
278 + gr = preparemain(CFV);
281 + /* don't have main directory or a proper variable set */
282 + gr = preparehome(CFV);
288 +/******************************************************************************/
290 +FILE *fopencfv (struct cfv *CFV, const char *mode)
292 + FILE *cfvfile = NULL;
294 + CFV->mode = M_REGULAR_FILE;
295 + if ((usercfv (CFV)) == -1) return (NULL);
296 + cfvfile = fopen (CFV->result, mode);
299 +/******************************************************************************/
301 +FILE *notnullfopencfv (struct cfv *CFV, const char *mode)
303 + FILE *cfvfile = NULL;
305 + CFV->mode = M_REGULAR_FILE;
306 + if ((notnullusercfv (CFV)) == -1) return (NULL);
307 + cfvfile = fopen (CFV->result, mode);
311 --- aumix-2.1/src/userdir.h Thu Jan 1 01:00:00 1970
312 +++ aumix-2.1.pius/src/userdir.h Thu Feb 3 01:58:57 2000
322 +#include <sys/types.h>
323 +#include <sys/stat.h>
324 +#include <sys/param.h>
326 +#define M_REGULAR_FILE 0
327 +#define M_DIRECTORY 1
330 + char result[MAXPATHLEN]; /* our result */
331 + char *variable; /* name of an environment variable */
332 + char *home_dir; /* home directory or NULL for autodetect */
333 + char *home_scd; /* directory if home_dir==NULL and no result */
334 + char *subname; /* core name of a file/directory */
335 + char *prefix; /* prefix when using directly home_dir */
336 + char *suffix; /* suffix when using directly home_dir */
337 + int mode; /* expected: M_REGULAR_FILE or M_DIRECTORY */
340 +/* reads environment variable. if the path isn't absolute will add $HOME/
342 + * return: 0 - directory exists
343 + * -1 - directory doesn't exist
345 +int getusercfv (char *variable,
348 + size_t stringsize);
349 +/* reads the $HOME variable */
350 +int detectcfv(struct cfv *CFV);
352 +/* looks for the config/data file/dir.
353 + * result: -1 - error - cannot find file/dir
357 +int usercfv (struct cfv *CFV);
358 +/* looks for the config/data file/dir.
359 + * result: -1 - error - cannot read $HOME
360 + * 0 - ok - if the CFV.result exists, read it. If not create it.
363 +int notnullusercfv (struct cfv *CFV);
365 +FILE *fopencfv (struct cfv *CFV, const char *mode);
366 +FILE *notnullfopencfv (struct cfv *CFV, const char *mode);
369 --- aumix-2.1/po/aumix.pot Mon Jan 31 23:30:12 2000
370 +++ aumix-2.1.pius/po/aumix.pot Fri Feb 4 01:11:42 2000
373 " d: adjust a device besides /dev/mixer\n"
374 " f: specify file for saving and loading settings (defaults to\n"
375 -" ~ /.aumixrc or /etc/aumixrc)\n"
376 +" $CONFIG_DIR/aumixrc, ~ /.aumixrc or /etc/aumixrc)\n"
377 " C: specify color scheme\n"
378 " h: this helpful message\n"
380 --- aumix-2.1/po/de.po Sun Nov 28 07:35:18 1999
381 +++ aumix-2.1.pius/po/de.po Fri Feb 4 01:10:08 2000
384 " d: adjust a device besides /dev/mixer\n"
385 " f: specify file for saving and loading settings (defaults to\n"
386 -" ~ /.aumixrc or /etc/aumixrc)\n"
387 +" $CONFIG_DIR/aumixrc, ~ /.aumixrc or /etc/aumixrc)\n"
388 " C: specify color scheme\n"
389 " h: this helpful message\n"
392 "Weitere Optionen:\n"
393 " d: Anderes Gerät als /dev/mixer benutzen\n"
394 " f: spezifizieren Sie Datei für Einsparung- und Ladeneinstellungen\n"
395 -" (Rückstellungen zum ~ /.aumixrc or /etc/aumixrc)\n"
396 +" (Rückstellungen zum $CONFIG_DIR/aumixrc, ~ /.aumixrc or /etc/aumixrc)\n"
397 " h: Diese nützlichen Informationen\n"
400 --- aumix-2.1/po/es.po Mon Dec 6 16:41:47 1999
401 +++ aumix-2.1.pius/po/es.po Fri Feb 4 01:10:21 2000
404 " d: adjust a device besides /dev/mixer\n"
405 " f: specify file for saving and loading settings (defaults to\n"
406 -" ~ /.aumixrc or /etc/aumixrc)\n"
407 +" $CONFIG_DIR/aumixrc, ~ /.aumixrc or /etc/aumixrc)\n"
408 " C: specify color scheme\n"
409 " h: this helpful message\n"
413 " d: ajustar dispositivos además de /dev/mixer\n"
414 " f: indicar el fichero para guardar y cargar las preferencias (por\n"
415 -" defecto es ~/.aumixrc o /etc/aumixrc\n"
416 +" defecto es $CONFIG_DIR/aumixrc, ~/.aumixrc o /etc/aumixrc\n"
417 " C: indicar el esquema de color\n"
418 " h: este mensaje de ayuda\n"
420 --- aumix-2.1/po/gl.po Mon Dec 6 16:41:47 1999
421 +++ aumix-2.1.pius/po/gl.po Fri Feb 4 01:10:34 2000
424 " d: adjust a device besides /dev/mixer\n"
425 " f: specify file for saving and loading settings (defaults to\n"
426 -" ~ /.aumixrc or /etc/aumixrc)\n"
427 +" $CONFIG_DIR/aumixrc, ~ /.aumixrc or /etc/aumixrc)\n"
428 " C: specify color scheme\n"
429 " h: this helpful message\n"
433 " d: axustar outro dispositivo que non sexa /dev/mixer\n"
434 " f: especificar ficheiro para gardar e cargar parámetros (por omisión é\n"
435 -" ~/.aumixrc ou /etc/aumixrc)\n"
436 +" $CONFIG_DIR/aumixrc, ~/.aumixrc ou /etc/aumixrc)\n"
437 " C: especifica-lo esquema de cor\n"
438 " h: amosar esta mensaxe de axuda\n"
440 --- aumix-2.1/po/pl.po Mon Dec 20 02:13:11 1999
441 +++ aumix-2.1.pius/po/pl.po Fri Feb 4 01:10:50 2000
444 " d: adjust a device besides /dev/mixer\n"
445 " f: specify file for saving and loading settings (defaults to\n"
446 -" ~/.aumixrc or /etc/aumixrc)\n"
447 +" $CONFIG_DIR/aumixrc, ~/.aumixrc or /etc/aumixrc)\n"
448 " C: specify color scheme\n"
449 " h: this helpful message\n"
453 " d: dostosowuje urz±dzenie inne ni¿ /dev/mixer\n"
454 " f: okre¶la plik do zapisywania i ³adowania ustawieñ (domy¶lnie jest to\n"
455 -" ~/.aumixrc lub /etc/aumixrc)\n"
456 +" $CONFIG_DIR/aumixrc, ~/.aumixrc lub /etc/aumixrc)\n"
457 " C: okre¶la plik zawieraj±cy schemat u¿ycia kolorów\n"
458 " h: ta pomocna informacja\n"
460 --- aumix-2.1/po/pt_BR.po Sun Nov 28 07:35:18 1999
461 +++ aumix-2.1.pius/po/pt_BR.po Fri Feb 4 01:11:01 2000
464 " d: adjust a device besides /dev/mixer\n"
465 " f: specify file for saving and loading settings (defaults to\n"
466 -" ~ /.aumixrc or /etc/aumixrc)\n"
467 +" $CONFIG_DIR/aumixrc, ~ /.aumixrc or /etc/aumixrc)\n"
468 " C: specify color scheme\n"
469 " h: this helpful message\n"
473 " d: usar outro dispositivo que não o /dev/mixer\n"
474 " f: SPECIFY FILE FOR SAVING AND LOADING SETTINGS (DEFAULTS TO\n"
475 -" ~ /.aumixrc or /etc/aumixrc)\n"
476 +" $CONFIG_DIR/aumixrc, ~ /.aumixrc or /etc/aumixrc)\n"
477 " C: SPECIFY COLOR SCHEME\n"
478 " h: esta mensagem de ajuda\n"
480 --- aumix-2.1/po/ru.po Mon Dec 20 02:13:11 1999
481 +++ aumix-2.1.pius/po/ru.po Fri Feb 4 01:11:14 2000
484 " d: adjust a device besides /dev/mixer\n"
485 " f: specify file for saving and loading settings (defaults to\n"
486 -" ~ /.aumixrc or /etc/aumixrc)\n"
487 +" $CONFIG_DIR/aumixrc, ~ /.aumixrc or /etc/aumixrc)\n"
488 " C: specify color scheme\n"
489 " h: this helpful message\n"
493 " d: ÒÅÇÕÌÉÒÏ×ÁÔØ ÕÓÔÒÏÊÓÔ×Á ËÒÏÍÅ /dev/mixer\n"
494 " f: ÕËÁÚÁÎÉÅ ÉÍÅÎÉ ÆÁÊÌÁ ÄÌÑ ÈÒÁÎÅÎÉÑ ÕÓÔÁÎÏ×ÏË (ÐÏ ÕÍÏÌÞÁÎÉÀ\n"
495 -" ~ /.aumixrc ÉÌÉ /etc/aumixrc)\n"
496 +" $CONFIG_DIR/aumixrc, ~ /.aumixrc ÉÌÉ /etc/aumixrc)\n"
497 " C: ×ÙÂÏÒ Ã×ÅÔÏ×ÏÊ ÓÈÅÍÙ\n"
500 --- aumix-2.1/po/uk.po Sun Nov 28 07:35:18 1999
501 +++ aumix-2.1.pius/po/uk.po Fri Feb 4 01:11:26 2000
504 " d: adjust a device besides /dev/mixer\n"
505 " f: specify file for saving and loading settings (defaults to\n"
506 -" ~ /.aumixrc or /etc/aumixrc)\n"
507 +" $CONFIG_DIR/aumixrc, ~ /.aumixrc or /etc/aumixrc)\n"
508 " C: specify color scheme\n"
509 " h: this helpful message\n"
513 " d: ÒÅÇÕÌÀ×ÁÔÉ ÐÒÉÓÔÒϧ ÏËÒ¦Í /dev/mixer\n"
514 " f: ×ËÁÚÁÎÎÑ ¦ÍÅΦ ÆÁÊÌÕ ÄÌÑ ÚÂÅÒ¦ÇÁÎÎÑ Ò¦×Î¦× (ÚÁ ÚÁÍÏ×ÞÁÎÎÑÍ\n"
515 -" ~ /.aumixrc ÞÉ /etc/aumixrc)\n"
516 +" $CONFIG_DIR/aumixrc, ~ /.aumixrc ÞÉ /etc/aumixrc)\n"
517 " C: SPECIFY COLOR SCHEME\n"