]> git.pld-linux.org Git - packages/aumix.git/blob - aumix-home_etc.patch
- updated gettext BR
[packages/aumix.git] / aumix-home_etc.patch
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
4 @@ -115,15 +115,19 @@
5  go into interactive mode after doing things non-interactively.
6  .It Fl L
7  load settings from
8 -.Pa $HOME/.aumixrc ,
9 -or
10 +.Pa $CONFIG_DIR/aumixrc ,
11 +.Pa $HOME/.aumixrc
12 +(depreciated), or
13  .Pa /etc/aumixrc
14  if the former is inaccessible
15  .It Fl q
16  query all devices and print their settings
17  .It Fl S
18  save settings to
19 +.Pa $CONFIG_DIR/aumixrc
20 +or
21  .Pa $HOME/.aumixrc
22 +(depreciated)
23  .El
24  .Sh EXAMPLES
25  The command
26 @@ -189,7 +193,10 @@
27  show a description of the functions of keys
28  .It L or l
29  load settings from
30 -.Pa $HOME/.aumixrc ,
31 +.Pa $CONFIG_DIR/aumixrc ,
32 +or
33 +.Pa $HOME/.aumixrc
34 +(depreciated),
35  falling back to
36  .Pa /etc/aumixrc
37  .It M or m
38 @@ -264,8 +271,11 @@
39  Saved settings for the mixer are kept in the
40  .Pa /etc/aumixrc
41  and
42 -.Pa $HOME/.aumixrc
43 -files, but can be kept anywhere if specified explicitly.
44 +.Pa $CONFIG_DIR/aumixrc
45 +files, (
46 +.Pa $HOME/.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
50  by
51  .Ev DATADIR
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
55 @@ -206,12 +206,12 @@
56  msgid ""
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"
62  msgstr ""
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"
68  
69  #: src/common.c:689
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
73 @@ -206,12 +206,12 @@
74  msgid ""
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"
80  msgstr ""
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"
86  
87  #: src/common.c:689
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
91 @@ -206,12 +206,12 @@
92  msgid ""
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"
98  msgstr ""
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"
104  
105  #: src/common.c:689
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 @@
110  msgid ""
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"
116  msgstr ""
117  "  d:  axustar outro dispositivo que non sexa /dev/mixer\n"
118  "  f:  especificar ficheiro para gardar e cargar opcións (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"
122  
123  #: src/common.c:707
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 @@
128  msgid ""
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"
134  msgstr ""
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"
140  
141  #: src/common.c:689
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 @@
146  msgid ""
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"
152  msgstr ""
153  "  d:  ajusta um dispositivo em /dev/mixer\n"
154  "  f:  especifica um arquivo para ler e gravar as configurações (o padrão "
155 -"é       ~/.aumixrc or /etc/aumixrc)\n"
156 +"é       $CONFIG_DIR/.aumixrc or /etc/aumixrc)\n"
157  "  h:  essa mensagem de ajuda\n"
158  
159  #: src/common.c:716
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 @@
164  msgid ""
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"
170  msgstr ""
171  "  d:  ÒÅÇÕÌÉÒÏ×ÁÔØ ÕÓÔÒÏÊÓÔ×Á ËÒÏÍÅ /dev/mixer\n"
172  "  f:  ÕËÁÚÁÎÉÅ ÉÍÅÎÉ ÆÁÊÌÁ ÄÌÑ ÈÒÁÎÅÎÉÑ ÕÓÔÁÎÏ×ÏË (ÐÏ ÕÍÏÌÞÁÎÉÀ\n"
173 -"      ~/.aumixrc ÉÌÉ /etc/aumixrc)\n"
174 +"      $CONFIG_DIR/aumixrc ÉÌÉ /etc/aumixrc)\n"
175  "  h:  ÜÔÁ ÐÏÍÏÝØ\n"
176  
177  #: src/common.c:689
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 @@
182  msgid ""
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"
188  msgstr ""
189  "  d:  ÒÅÇÕÌÀ×ÁÔÉ ÐÒÉÓÔÒϧ ÏËҦ͠/dev/mixer\n"
190  "  f:  ×ËÁÚÁÔÉ ¦Í'Ñ ÆÁÊÌÕ ÄÌÑ ÚÂÅÒÅÖÅÎÎÑ Ò¦×Φנ(ÚÁ ÚÁÍÏ×ÞÁÎÎÑÍ\n"
191 -"      ~/.aumixrc ÞÉ /etc/aumixrc)\n"
192 +"      $CONFIG_DIR/aumixrc ÞÉ /etc/aumixrc)\n"
193  "  h:  ÃÑ ÄÏÐÏÍÏÇÁ\n"
194  
195  #: src/common.c:707
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
199 @@ -2,8 +2,8 @@
200  if CURSES
201  bin_SCRIPTS    = xaumix
202  endif
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/common.c aumix-2.6.1.new/src/common.c
211 --- aumix-2.6.1/src/common.c    Tue Jun 27 23:11:47 2000
212 +++ aumix-2.6.1.new/src/common.c        Wed Jun 28 00:10:45 2000
213 @@ -26,6 +26,7 @@
214  #include "gtk.h"
215  #endif                         /* HAVE_GTK */
216  #include "interactive.h"
217 +#include "userdir.h"
218  
219  FILE           *OpenDefaultFile(char *mode);
220  FILE           *setfile;
221 @@ -556,7 +557,8 @@
222  {
223  /* Open the settings file for reading or writing.
224  
225 -   Try first ${HOME}/.AUMIXRC, then AUMIXRC_PATH/AUMIXRC;
226 +   Try first ${HOME}/.AUMIXRC, then then ${HOME}/.AUMIXRC 
227 +   and eventualy AUMIXRC_PATH/AUMIXRC;
228     become an error generator if neither can be opened.
229  
230     Input:
231 @@ -571,6 +573,8 @@
232         FILE           *setfile;
233         char           *home;
234         char            filename[PATH_MAX];
235 +       struct cfv      etcfile;
236 +
237         if (save_filename == NULL) {
238                 home = getenv("HOME");
239                 if ((strlen(home) + strlen(AUMIXRC) + 2) < PATH_MAX) {
240 @@ -585,6 +589,19 @@
241                 }
242                 if (setfile == NULL) {
243                         return NULL;
244 +               }
245 +               etcfile.variable = "CONFIG_DIR";
246 +               etcfile.home_dir = NULL;
247 +               etcfile.home_scd = NULL;
248 +               etcfile.subname  = AUMIXRC;
249 +               etcfile.prefix   = ".";
250 +               etcfile.suffix   = "";
251 +               etcfile.mode     = M_REGULAR_FILE;
252 +
253 +               setfile = fopencfv(&etcfile, mode);
254 +               if (setfile == NULL) {
255 +                       sprintf(filename, "%s/%s", AUMIXRC_PATH, AUMIXRC);
256 +                       setfile = fopen(filename, mode);
257                 }
258         } else
259                 setfile = CheckAndOpen(save_filename, mode);
260 diff -Nru aumix-2.6.1/src/userdir.c aumix-2.6.1.new/src/userdir.c
261 --- aumix-2.6.1/src/userdir.c   Thu Jan  1 01:00:00 1970
262 +++ aumix-2.6.1.new/src/userdir.c       Tue Jun 27 23:11:28 2000
263 @@ -0,0 +1,167 @@
264 +// $Id$
265 +#include "userdir.h"
266 +    
267 +static char *nonulhome = "";
268 +
269 +/******************************************************************************/
270 +    
271 +int getusercfv (char *variable, 
272 +                   char *home_dir, 
273 +                   char *user_dir, 
274 +                   size_t stringsize)
275 +{
276 +       struct stat st;
277 +       char *d;
278 +       
279 +       bzero (user_dir, stringsize);
280 +       if (variable == NULL || *variable == '\0') return (-1);
281 +       if (home_dir == NULL) home_dir = nonulhome;
282 +       d = getenv (variable);  
283 +       if (d == NULL || *d == '\0') return (-1);
284 +       if (*d == '/') 
285 +           {
286 +           strncpy (user_dir, d, stringsize-1);
287 +           }
288 +       else
289 +           {
290 +           snprintf (user_dir, stringsize-1, "%s/%s", home_dir, d);
291 +           }
292 +           
293 +       if (stat(user_dir,&st) != -1 && S_ISDIR(st.st_mode)) 
294 +           {
295 +           return (0);
296 +           }
297 +       
298 +       return (-1);
299 +}
300 +
301 +/******************************************************************************/
302 +
303 +int detectcfv(struct cfv *CFV) {
304 +       if (CFV->subname == NULL) CFV->subname = nonulhome;
305 +       if (CFV->home_dir == NULL) CFV->home_dir = getenv ("HOME");
306 +       if (CFV->home_dir == NULL) CFV->home_dir = CFV->home_scd;
307 +       if (CFV->home_dir == NULL) return (-1);
308 +       return 0;
309 +}
310 +
311 +/******************************************************************************/
312 +
313 +int preparemain(struct cfv *CFV) {
314 +       char *p;
315 +       struct stat st;
316 +       if ((p = strrchr(CFV->result, '/')) && *(p+1) == '\0') 
317 +           p = '\0';
318 +       snprintf ((rindex(CFV->result,'\0')), MAXPATHLEN-1, "/%s", 
319 +                 CFV->subname);
320 +       if (stat( CFV->result,&st) != -1 
321 +            && CFV->mode ? 
322 +               S_ISDIR(st.st_mode) : 
323 +               S_ISREG(st.st_mode)) /* have file or dir */
324 +           return (1);
325 +       return 0;
326 +}
327 +
328 +/******************************************************************************/
329 +
330 +int preparehome(struct cfv *CFV) {
331 +       struct stat st;
332 +       if (CFV->home_dir == NULL || *(CFV->home_dir) == '\0') return (-1);
333 +       if (CFV->prefix == NULL && CFV->suffix == NULL) return (-1);
334 +       snprintf (CFV->result, MAXPATHLEN-1, "%s/%s%s%s", 
335 +                      CFV->home_dir, 
336 +                      CFV->prefix? CFV->prefix:"",
337 +                      CFV->subname,
338 +                      CFV->suffix? CFV->suffix:"");
339 +       if (stat(CFV->result,&st) != -1 
340 +                && CFV->mode ? 
341 +                   S_ISDIR(st.st_mode) : 
342 +                   S_ISREG(st.st_mode)) /* have file or dir */
343 +               return (2);
344 +       return (-1);
345 +}
346 +
347 +/******************************************************************************/
348 +
349 +int usercfv (struct cfv *CFV) {
350 +       int gr;
351 +       gr = detectcfv(CFV);
352 +       if (gr) return gr;
353 +       /* get environment variable */
354 +       gr = getusercfv (CFV->variable, 
355 +                       CFV->home_dir, 
356 +                       CFV->result,
357 +                       MAXPATHLEN);
358 +       if (gr != -1)   /* have main directory */
359 +           {
360 +               gr = preparemain(CFV);
361 +               if (gr) return gr;
362 +           }
363 +       /* don't have main directory or a proper variable set */
364 +       gr = preparehome(CFV);
365 +       return gr;
366 +}
367 +       
368 +/******************************************************************************/
369 +
370 +/* If directory or file doesn't exist returns the best one wich may be created */
371 +int notnullusercfv (struct cfv *CFV) {
372 +       int gr;
373 +       if ((usercfv(CFV)) == -1) {
374 +           gr = detectcfv(CFV);
375 +           if (gr) return gr;  /* remember, it works for errors! */
376 +           /* get the environment variable */
377 +           gr = getusercfv (CFV->variable, 
378 +                           CFV->home_dir, 
379 +                           CFV->result,
380 +                           MAXPATHLEN);
381 +           if (gr != -1)       /* have main directory */
382 +               {
383 +                   gr = preparemain(CFV);
384 +                   return 0;
385 +               }
386 +           /* don't have main directory or a proper variable set */
387 +           gr = preparehome(CFV);
388 +           return 0;
389 +       }
390 +       return 0;       
391 +}
392 +    
393 +/******************************************************************************/
394 +
395 +FILE *maynullfopencfv (struct cfv *CFV, const char *mode)
396 +    {
397 +    FILE *cfvfile = NULL;
398 +    
399 +    CFV->mode = M_REGULAR_FILE;
400 +    if ((usercfv (CFV)) == -1) return (NULL);  
401 +    cfvfile = fopen (CFV->result, mode);
402 +    return (cfvfile);
403 +    }
404 +/******************************************************************************/
405 +
406 +FILE *notnullfopencfv (struct cfv *CFV, const char *mode)
407 +    {
408 +    FILE *cfvfile = NULL;
409 +    
410 +    CFV->mode = M_REGULAR_FILE;
411 +    if ((notnullusercfv (CFV)) == -1) return (NULL);   
412 +    cfvfile = fopen (CFV->result, mode);
413 +    return (cfvfile);
414 +    }
415 +
416 +/******************************************************************************/
417 +    
418 +FILE *fopencfv (struct cfv *CFV, const char *mode)
419 +    {
420 +    FILE *cfvfile = NULL;
421 +
422 +    if (cfvfile == NULL && (strpbrk(mode, "wa")) != NULL) /* create in best location */
423 +       cfvfile = notnullfopencfv (CFV, mode);
424 +    else 
425 +       cfvfile = maynullfopencfv (CFV, mode);
426 +    
427 +    return (cfvfile);
428 +    }
429 +
430 +/******************************************************************************/
431 \ No newline at end of file
432 diff -Nru aumix-2.6.1/src/userdir.h aumix-2.6.1.new/src/userdir.h
433 --- aumix-2.6.1/src/userdir.h   Thu Jan  1 01:00:00 1970
434 +++ aumix-2.6.1.new/src/userdir.h       Tue Jun 27 23:11:28 2000
435 @@ -0,0 +1,56 @@
436 +// $Id$
437 +#ifndef USERDIR__H
438 +#define USERDIR__H
439 +
440 +#include <unistd.h>
441 +#include <string.h>
442 +#include <stdio.h>
443 +#include <stdlib.h>
444 +#include <sys/types.h>
445 +#include <sys/stat.h>
446 +#include <sys/param.h>
447 +
448 +#define        M_REGULAR_FILE  0
449 +#define        M_DIRECTORY     1
450 +
451 +struct cfv {
452 +       char result[MAXPATHLEN];        /* our result                   */
453 +       char *variable; /* name of an environment variable              */
454 +       char *home_dir; /* home directory or NULL for autodetect        */
455 +       char *home_scd; /* directory if home_dir==NULL and no result    */
456 +       char *subname;  /* core name of a file/directory                */
457 +       char *prefix;   /* prefix when using directly home_dir          */
458 +       char *suffix;   /* suffix when using directly home_dir          */
459 +       int mode;       /* expected: M_REGULAR_FILE or M_DIRECTORY      */
460 +       };
461 +
462 +/* reads environment variable. if the path isn't absolute will add $HOME/
463 + * at the beginning
464 + * return: 0 - directory exists
465 + *         -1 - directory doesn't exist
466 + */
467 +int getusercfv (char *variable, 
468 +                   char *home_dir, 
469 +                   char *user_dir,
470 +                   size_t stringsize);
471 +/* reads the $HOME variable */
472 +int detectcfv(struct cfv *CFV);
473 +
474 +/* looks for the config/data file/dir.
475 + * result: -1 - error - cannot find file/dir 
476 + *         0 - ok
477 + *         CFV.result set
478 + */
479 +int usercfv (struct cfv *CFV);
480 +/* looks for the config/data file/dir.
481 + * result: -1 - error - cannot read $HOME
482 + *          0 - ok - if the CFV.result exists, read it. If not create it.
483 + *              CFV.result set
484 + */              
485 +int notnullusercfv (struct cfv *CFV);
486 +
487 +FILE *fopencfv (struct cfv *CFV, const char *mode);
488 +FILE *maynullfopencfv (struct cfv *CFV, const char *mode);
489 +FILE *notnullfopencfv (struct cfv *CFV, const char *mode);
490 +
491 +#endif
This page took 0.076319 seconds and 3 git commands to generate.