1 --- aumix-2.4.pius/doc/aumix.1 Mon Jan 31 23:30:12 2000
2 +++ aumix-2.4/doc/aumix.1 Thu Mar 23 12:50:51 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
18 +.Pa $CONFIG_DIR/aumixrc
26 show a description of the functions of keys
30 +.Pa $CONFIG_DIR/aumixrc ,
38 Saved settings for the mixer are kept in the
42 -files, but can be kept anywhere if specified explicitly.
43 +.Pa $CONFIG_DIR/aumixrc
46 +is now obsolete, though it still works),
47 +but can be kept anywhere if specified explicitly.
48 Color schemes are normally kept in the directory given
51 --- aumix-2.4.pius/po/aumix.pot Thu Mar 23 02:01:18 2000
52 +++ aumix-2.4/po/aumix.pot Thu Mar 23 13:02:15 2000
55 " d: adjust a device besides /dev/mixer\n"
56 " f: specify file for saving and loading settings (defaults to\n"
57 -" ~/.aumixrc or /etc/aumixrc)\n"
58 +" $CONFIG_DIR/aumixrc, ~/.aumixrc or /etc/aumixrc)\n"
59 " C: specify color scheme\n"
60 " h: this helpful message\n"
62 --- aumix-2.4.pius/po/de.po Thu Mar 23 02:01:18 2000
63 +++ aumix-2.4/po/de.po Thu Mar 23 12:59:22 2000
66 " d: adjust a device besides /dev/mixer\n"
67 " f: specify file for saving and loading settings (defaults to\n"
68 -" ~/.aumixrc or /etc/aumixrc)\n"
69 +" $CONFIG_DIR/aumixrc, ~/.aumixrc or /etc/aumixrc)\n"
70 " C: specify color scheme\n"
71 " h: this helpful message\n"
75 " d: Anderes Gerät als /dev/mixer benutzen\n"
76 " f: spezifizieren Sie Datei für Einsparung- und Ladeneinstellungen\n"
77 -" (Rückstellungen zum ~/.aumixrc or /etc/aumixrc)\n"
78 +" (Rückstellungen zum $CONFIG_DIR/aumixrc, ~/.aumixrc or /etc/aumixrc)\n"
79 " h: Diese nützlichen Informationen\n"
82 --- aumix-2.4.pius/po/es.po Thu Mar 23 02:01:18 2000
83 +++ aumix-2.4/po/es.po Thu Mar 23 12:59:43 2000
86 " d: adjust a device besides /dev/mixer\n"
87 " f: specify file for saving and loading settings (defaults to\n"
88 -" ~/.aumixrc or /etc/aumixrc)\n"
89 +" $CONFIG_DIR/aumixrc, ~/.aumixrc or /etc/aumixrc)\n"
90 " C: specify color scheme\n"
91 " h: this helpful message\n"
95 " d: ajustar dispositivos además de /dev/mixer\n"
96 " f: indicar el fichero para guardar y cargar las preferencias (por\n"
97 -" defecto es ~/.aumixrc o /etc/aumixrc\n"
98 +" defecto es $CONFIG_DIR/aumixrc, ~/.aumixrc o /etc/aumixrc\n"
99 " C: indicar el esquema de color\n"
100 " h: este mensaje de ayuda\n"
102 --- aumix-2.4.pius/po/fr.po Thu Mar 23 02:01:18 2000
103 +++ aumix-2.4/po/fr.po Thu Mar 23 13:00:22 2000
106 " d: adjust a device besides /dev/mixer\n"
107 " f: specify file for saving and loading settings (defaults to\n"
108 -" ~/.aumixrc or /etc/aumixrc)\n"
109 +" $CONFIG_DIR/aumixrc, ~/.aumixrc or /etc/aumixrc)\n"
110 " C: specify color scheme\n"
111 " h: this helpful message\n"
115 " d: ajuster un périphérique autre que /dev/mixer\n"
116 " f: spécifier le fichier de sauvegarde/chargement des paramètres\n"
117 -" (par défaut il s'agit de ~/.aumixrc ou /etc/aumixrc)\n"
118 +" (par défaut il s'agit de $CONFIG_DIR/aumixrc, ~/.aumixrc ou /etc/aumixrc)\n"
119 " C: spécifier le modèle de couleurs\n"
120 " h: ce message d'aide\n"
122 --- aumix-2.4.pius/po/gl.po Thu Mar 23 02:01:18 2000
123 +++ aumix-2.4/po/gl.po Thu Mar 23 13:00:39 2000
126 " d: adjust a device besides /dev/mixer\n"
127 " f: specify file for saving and loading settings (defaults to\n"
128 -" ~/.aumixrc or /etc/aumixrc)\n"
129 +" $CONFIG_DIR/aumixrc, ~/.aumixrc or /etc/aumixrc)\n"
130 " C: specify color scheme\n"
131 " h: this helpful message\n"
135 " d: axustar outro dispositivo que non sexa /dev/mixer\n"
136 " f: especificar ficheiro para gardar e cargar parámetros (por omisión é\n"
137 -" ~/.aumixrc ou /etc/aumixrc)\n"
138 +" $CONFIG_DIR/aumixrc, ~/.aumixrc ou /etc/aumixrc)\n"
139 " C: especifica-lo esquema de cor\n"
140 " h: amosar esta mensaxe de axuda\n"
142 --- aumix-2.4.pius/po/pl.po Thu Mar 23 12:50:19 2000
143 +++ aumix-2.4/po/pl.po Thu Mar 23 13:00:58 2000
146 " d: adjust a device besides /dev/mixer\n"
147 " f: specify file for saving and loading settings (defaults to\n"
148 -" ~/.aumixrc or /etc/aumixrc)\n"
149 +" $CONFIG_DIR/aumixrc, ~/.aumixrc or /etc/aumixrc)\n"
150 " C: specify color scheme\n"
151 " h: this helpful message\n"
155 " d: dostosowuje urz±dzenie inne ni¿ /dev/mixer\n"
156 " f: okre¶la plik do zapisywania i ³adowania ustawieñ (domy¶lnie jest to\n"
157 -" ~/.aumixrc lub /etc/aumixrc)\n"
158 +" $CONFIG_DIR/aumixrc, ~/.aumixrc lub /etc/aumixrc)\n"
159 " C: okre¶la plik zawieraj±cy schemat u¿ycia kolorów\n"
160 " h: ta pomocna informacja\n"
162 --- aumix-2.4.pius/po/pt_BR.po Thu Mar 23 02:01:18 2000
163 +++ aumix-2.4/po/pt_BR.po Thu Mar 23 13:01:22 2000
166 " d: adjust a device besides /dev/mixer\n"
167 " f: specify file for saving and loading settings (defaults to\n"
168 -" ~/.aumixrc or /etc/aumixrc)\n"
169 +" $CONFIG_DIR/aumixrc, ~/.aumixrc or /etc/aumixrc)\n"
170 " C: specify color scheme\n"
171 " h: this helpful message\n"
175 " d: usar outro dispositivo que não o /dev/mixer\n"
176 " f: SPECIFY FILE FOR SAVING AND LOADING SETTINGS (DEFAULTS TO\n"
177 -" ~/.aumixrc or /etc/aumixrc)\n"
178 +" $CONFIG_DIR/aumixrc, ~/.aumixrc or /etc/aumixrc)\n"
179 " C: SPECIFY COLOR SCHEME\n"
180 " h: esta mensagem de ajuda\n"
182 --- aumix-2.4.pius/po/ru.po Thu Mar 23 02:01:18 2000
183 +++ aumix-2.4/po/ru.po Thu Mar 23 13:01:42 2000
186 " d: adjust a device besides /dev/mixer\n"
187 " f: specify file for saving and loading settings (defaults to\n"
188 -" ~/.aumixrc or /etc/aumixrc)\n"
189 +" $CONFIG_DIR/aumixrc, ~/.aumixrc or /etc/aumixrc)\n"
190 " C: specify color scheme\n"
191 " h: this helpful message\n"
195 " d: ÒÅÇÕÌÉÒÏ×ÁÔØ ÕÓÔÒÏÊÓÔ×Á ËÒÏÍÅ /dev/mixer\n"
196 " f: ÕËÁÚÁÎÉÅ ÉÍÅÎÉ ÆÁÊÌÁ ÄÌÑ ÈÒÁÎÅÎÉÑ ÕÓÔÁÎÏ×ÏË (ÐÏ ÕÍÏÌÞÁÎÉÀ\n"
197 -" ~/.aumixrc ÉÌÉ /etc/aumixrc)\n"
198 +" $CONFIG_DIR/aumixrc, ~/.aumixrc ÉÌÉ /etc/aumixrc)\n"
199 " C: ×ÙÂÏÒ Ã×ÅÔÏ×ÏÊ ÓÈÅÍÙ\n"
202 --- aumix-2.4.pius/po/uk.po Thu Mar 23 02:01:18 2000
203 +++ aumix-2.4/po/uk.po Thu Mar 23 13:01:58 2000
206 " d: adjust a device besides /dev/mixer\n"
207 " f: specify file for saving and loading settings (defaults to\n"
208 -" ~/.aumixrc or /etc/aumixrc)\n"
209 +" $CONFIG_DIR/aumixrc, ~/.aumixrc or /etc/aumixrc)\n"
210 " C: specify color scheme\n"
211 " h: this helpful message\n"
215 " d: ÒÅÇÕÌÀ×ÁÔÉ ÐÒÉÓÔÒϧ ÏËÒ¦Í /dev/mixer\n"
216 " f: ×ËÁÚÁÎÎÑ ¦ÍÅΦ ÆÁÊÌÕ ÄÌÑ ÚÂÅÒ¦ÇÁÎÎÑ Ò¦×Î¦× (ÚÁ ÚÁÍÏ×ÞÁÎÎÑÍ\n"
217 -" ~/.aumixrc ÞÉ /etc/aumixrc)\n"
218 +" $CONFIG_DIR/aumixrc, ~/.aumixrc ÞÉ /etc/aumixrc)\n"
219 " C: SPECIFY COLOR SCHEME\n"
222 --- aumix-2.4.pius/src/Makefile.am Thu Mar 23 02:01:18 2000
223 +++ aumix-2.4/src/Makefile.am Thu Mar 23 12:52:07 2000
227 -aumix_SOURCES = common.c curses.c dummy.c gpm-xterm.c gtk.c interactive.c \
228 - mouse.c common.h curses.h gpm-xterm.h gtk.h interactive.h \
229 +aumix_SOURCES = userdir.c common.c curses.c dummy.c gpm-xterm.c gtk.c interactive.c \
230 + mouse.c userdir.h common.h curses.h gpm-xterm.h gtk.h interactive.h \
231 mouse.h play.xpm record.xpm
232 localedir = $(datadir)/locale
233 INCLUDES = -I../intl -DLOCALEDIR=\"$(localedir)\" -I@includedir@
234 --- aumix-2.4.pius/src/Makefile.in Thu Mar 23 02:01:18 2000
235 +++ aumix-2.4/src/Makefile.in Thu Mar 23 12:52:53 2000
240 -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 play.xpm record.xpm
241 +aumix_SOURCES = userdir.c 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 play.xpm record.xpm
243 localedir = $(datadir)/locale
244 INCLUDES = -I../intl -DLOCALEDIR=\"$(localedir)\" -I@includedir@
247 CPPFLAGS = @CPPFLAGS@
249 -aumix_OBJECTS = common.o curses.o dummy.o gpm-xterm.o gtk.o \
250 +aumix_OBJECTS = userdir.o common.o curses.o dummy.o gpm-xterm.o gtk.o \
251 interactive.o mouse.o
252 aumix_LDADD = $(LDADD)
254 --- aumix-2.4.pius/src/common.c Thu Mar 23 02:01:18 2000
255 +++ aumix-2.4/src/common.c Thu Mar 23 12:58:29 2000
258 #endif /* HAVE_GTK */
259 #include "interactive.h"
260 +#include "userdir.h"
262 void ExitIfError(int error);
263 int InitializeMixer(char *device_file);
266 /* Open the settings file for reading or writing.
268 - Try first ${HOME}/.AUMIXRC, then AUMIXRC_PATH/AUMIXRC;
269 + Try first ${HOME}/.AUMIXRC, then then ${HOME}/.AUMIXRC
270 + and eventualy AUMIXRC_PATH/AUMIXRC;
271 become an error generator if neither can be opened.
274 @@ -593,19 +595,24 @@
277 char filename[FILENAME_MAX];
278 + struct cfv etcfile;
280 if (save_filename == NULL) {
281 - home = getenv("HOME");
282 - sprintf(filename, "%s/.%s", home, AUMIXRC);
283 - setfile = fopen(filename, mode);
284 - if (setfile == NULL) {
285 - sprintf(filename, "%s/%s", AUMIXRC_PATH, AUMIXRC);
286 - setfile = fopen(filename, mode);
288 - if (setfile == NULL) {
291 + etcfile.variable = "CONFIG_DIR";
292 + etcfile.home_dir = NULL;
293 + etcfile.home_scd = NULL;
294 + etcfile.subname = AUMIXRC;
295 + etcfile.prefix = ".";
296 + etcfile.suffix = "";
297 + etcfile.mode = M_REGULAR_FILE;
299 + setfile = fopencfv(&etcfile, mode);
300 + if (setfile == NULL) {
301 + sprintf(filename, "%s/%s", AUMIXRC_PATH, AUMIXRC);
302 + setfile = fopen(filename, mode);
305 - setfile = fopen(save_filename, mode);
306 + setfile = fopen(save_filename, mode);
312 d: adjust a device besides /dev/mixer\n\
313 f: specify file for saving and loading settings (defaults to\n\
314 - ~/.aumixrc or /etc/aumixrc)\n\
315 + $CONFIG_DIR/aumixrc, ~/.aumixrc or /etc/aumixrc)\n\
316 C: specify color scheme\n\
317 h: this helpful message\n"));
319 --- aumix-2.4.pius/src/userdir.c Thu Jan 1 01:00:00 1970
320 +++ aumix-2.4/src/userdir.c Thu Mar 23 12:50:51 2000
323 +#include "userdir.h"
325 +static char *nonulhome = "";
327 +/******************************************************************************/
329 +int getusercfv (char *variable,
337 + bzero (user_dir, stringsize);
338 + if (variable == NULL || *variable == '\0') return (-1);
339 + if (home_dir == NULL) home_dir = nonulhome;
340 + d = getenv (variable);
341 + if (d == NULL || *d == '\0') return (-1);
344 + strncpy (user_dir, d, stringsize-1);
348 + snprintf (user_dir, stringsize-1, "%s/%s", home_dir, d);
351 + if (stat(user_dir,&st) != -1 && S_ISDIR(st.st_mode))
359 +/******************************************************************************/
361 +int detectcfv(struct cfv *CFV) {
362 + if (CFV->subname == NULL) CFV->subname = nonulhome;
363 + if (CFV->home_dir == NULL) CFV->home_dir = getenv ("HOME");
364 + if (CFV->home_dir == NULL) CFV->home_dir = CFV->home_scd;
365 + if (CFV->home_dir == NULL) return (-1);
369 +/******************************************************************************/
371 +int preparemain(struct cfv *CFV) {
374 + if ((p = strrchr(CFV->result, '/')) && *(p+1) == '\0')
376 + snprintf ((rindex(CFV->result,'\0')), MAXPATHLEN-1, "/%s",
378 + if (stat( CFV->result,&st) != -1
380 + S_ISDIR(st.st_mode) :
381 + S_ISREG(st.st_mode)) /* have file or dir */
386 +/******************************************************************************/
388 +int preparehome(struct cfv *CFV) {
390 + if (CFV->home_dir == NULL || *(CFV->home_dir) == '\0') return (-1);
391 + if (CFV->prefix == NULL && CFV->suffix == NULL) return (-1);
392 + snprintf (CFV->result, MAXPATHLEN-1, "%s/%s%s%s",
394 + CFV->prefix? CFV->prefix:"",
396 + CFV->suffix? CFV->suffix:"");
397 + if (stat(CFV->result,&st) != -1
399 + S_ISDIR(st.st_mode) :
400 + S_ISREG(st.st_mode)) /* have file or dir */
405 +/******************************************************************************/
407 +int usercfv (struct cfv *CFV) {
409 + gr = detectcfv(CFV);
411 + /* get environment variable */
412 + gr = getusercfv (CFV->variable,
416 + if (gr != -1) /* have main directory */
418 + gr = preparemain(CFV);
421 + /* don't have main directory or a proper variable set */
422 + gr = preparehome(CFV);
426 +/******************************************************************************/
428 +/* If directory or file doesn't exist returns the best one wich may be created */
429 +int notnullusercfv (struct cfv *CFV) {
431 + if ((usercfv(CFV)) == -1) {
432 + gr = detectcfv(CFV);
433 + if (gr) return gr; /* remember, it works for errors! */
434 + /* get the environment variable */
435 + gr = getusercfv (CFV->variable,
439 + if (gr != -1) /* have main directory */
441 + gr = preparemain(CFV);
444 + /* don't have main directory or a proper variable set */
445 + gr = preparehome(CFV);
451 +/******************************************************************************/
453 +FILE *maynullfopencfv (struct cfv *CFV, const char *mode)
455 + FILE *cfvfile = NULL;
457 + CFV->mode = M_REGULAR_FILE;
458 + if ((usercfv (CFV)) == -1) return (NULL);
459 + cfvfile = fopen (CFV->result, mode);
462 +/******************************************************************************/
464 +FILE *notnullfopencfv (struct cfv *CFV, const char *mode)
466 + FILE *cfvfile = NULL;
468 + CFV->mode = M_REGULAR_FILE;
469 + if ((notnullusercfv (CFV)) == -1) return (NULL);
470 + cfvfile = fopen (CFV->result, mode);
474 +/******************************************************************************/
476 +FILE *fopencfv (struct cfv *CFV, const char *mode)
478 + FILE *cfvfile = NULL;
480 + if (cfvfile == NULL && (strpbrk(mode, "wa")) != NULL) /* create in best location */
481 + cfvfile = notnullfopencfv (CFV, mode);
483 + cfvfile = maynullfopencfv (CFV, mode);
488 +/******************************************************************************/
489 \ No newline at end of file
490 --- aumix-2.4.pius/src/userdir.h Thu Jan 1 01:00:00 1970
491 +++ aumix-2.4/src/userdir.h Thu Mar 23 12:50:51 2000
501 +#include <sys/types.h>
502 +#include <sys/stat.h>
503 +#include <sys/param.h>
505 +#define M_REGULAR_FILE 0
506 +#define M_DIRECTORY 1
509 + char result[MAXPATHLEN]; /* our result */
510 + char *variable; /* name of an environment variable */
511 + char *home_dir; /* home directory or NULL for autodetect */
512 + char *home_scd; /* directory if home_dir==NULL and no result */
513 + char *subname; /* core name of a file/directory */
514 + char *prefix; /* prefix when using directly home_dir */
515 + char *suffix; /* suffix when using directly home_dir */
516 + int mode; /* expected: M_REGULAR_FILE or M_DIRECTORY */
519 +/* reads environment variable. if the path isn't absolute will add $HOME/
521 + * return: 0 - directory exists
522 + * -1 - directory doesn't exist
524 +int getusercfv (char *variable,
527 + size_t stringsize);
528 +/* reads the $HOME variable */
529 +int detectcfv(struct cfv *CFV);
531 +/* looks for the config/data file/dir.
532 + * result: -1 - error - cannot find file/dir
536 +int usercfv (struct cfv *CFV);
537 +/* looks for the config/data file/dir.
538 + * result: -1 - error - cannot read $HOME
539 + * 0 - ok - if the CFV.result exists, read it. If not create it.
542 +int notnullusercfv (struct cfv *CFV);
544 +FILE *fopencfv (struct cfv *CFV, const char *mode);
545 +FILE *maynullfopencfv (struct cfv *CFV, const char *mode);
546 +FILE *notnullfopencfv (struct cfv *CFV, const char *mode);