]> git.pld-linux.org Git - packages/aumix-gtk.git/blob - aumix-home_etc.patch
- updated for 2.4
[packages/aumix-gtk.git] / aumix-home_etc.patch
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
3 @@ -115,15 +115,19 @@
4  go into interactive mode after doing things non-interactively.
5  .It Fl L
6  load settings from
7 -.Pa $HOME/.aumixrc ,
8 -or
9 +.Pa $CONFIG_DIR/aumixrc ,
10 +.Pa $HOME/.aumixrc
11 +(depreciated), or
12  .Pa /etc/aumixrc
13  if the former is inaccessible
14  .It Fl q
15  query all devices and print their settings
16  .It Fl S
17  save settings to
18 +.Pa $CONFIG_DIR/aumixrc
19 +or
20  .Pa $HOME/.aumixrc
21 +(depreciated)
22  .El
23  .Sh EXAMPLE
24  The command
25 @@ -179,7 +183,10 @@
26  show a description of the functions of keys
27  .It L or l
28  load settings from
29 -.Pa $HOME/.aumixrc ,
30 +.Pa $CONFIG_DIR/aumixrc ,
31 +or
32 +.Pa $HOME/.aumixrc
33 +(depreciated),
34  falling back to
35  .Pa /etc/aumixrc
36  .It M or m
37 @@ -247,8 +254,11 @@
38  Saved settings for the mixer are kept in the
39  .Pa /etc/aumixrc
40  and
41 -.Pa $HOME/.aumixrc
42 -files, but can be kept anywhere if specified explicitly.
43 +.Pa $CONFIG_DIR/aumixrc
44 +files, (
45 +.Pa $HOME/.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
49  by
50  .Ev DATADIRNAME
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
53 @@ -175,7 +175,7 @@
54  "other options:\n"
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"
61  msgstr ""
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
64 @@ -182,7 +182,7 @@
65  "other options:\n"
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"
72  msgstr ""
73 @@ -200,7 +200,7 @@
74  "Weitere Optionen:\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"
80  
81  #: src/common.c:694
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
84 @@ -181,7 +181,7 @@
85  "other options:\n"
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"
92  msgstr ""
93 @@ -199,7 +199,7 @@
94  "Otras opciones:\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"
101  
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
104 @@ -184,7 +184,7 @@
105  "other options:\n"
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"
112  msgstr ""
113 @@ -202,7 +202,7 @@
114  "autres options:\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"
121  
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
124 @@ -187,7 +187,7 @@
125  "other options:\n"
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"
132  msgstr ""
133 @@ -205,7 +205,7 @@
134  "outras opcións:\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"
141  
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
144 @@ -181,7 +181,7 @@
145  "other options:\n"
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"
152  msgstr ""
153 @@ -199,7 +199,7 @@
154  "inne opcje:\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"
161  
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
164 @@ -184,7 +184,7 @@
165  "other options:\n"
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"
172  msgstr ""
173 @@ -202,7 +202,7 @@
174  "outras opções:\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"
181  
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
184 @@ -188,7 +188,7 @@
185  "other options:\n"
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"
192  msgstr ""
193 @@ -207,7 +207,7 @@
194  "äÒÕÇÉÅ ÏÐÃÉÉ:\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"
200  "  h:  ÜÔÁ ÐÏÍÏÝØ\n"
201  
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
204 @@ -183,7 +183,7 @@
205  "other options:\n"
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"
212  msgstr ""
213 @@ -202,7 +202,7 @@
214  "¶ÎÛ¦ ÏÐæ§:\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"
220  "  h:  ÃÑ ÄÏÐÏÍÏÇÁ\n"
221  
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
224 @@ -1,7 +1,7 @@
225  bin_PROGRAMS   = aumix
226  bin_SCRIPTS    = xaumix
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
236 @@ -84,7 +84,7 @@
237  
238  bin_PROGRAMS = aumix
239  bin_SCRIPTS = xaumix
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
242  
243  localedir = $(datadir)/locale
244  INCLUDES = -I../intl -DLOCALEDIR=\"$(localedir)\" -I@includedir@
245 @@ -99,7 +99,7 @@
246  
247  CPPFLAGS = @CPPFLAGS@
248  LDFLAGS = @LDFLAGS@
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)
253  aumix_DEPENDENCIES = 
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
256 @@ -26,6 +26,7 @@
257  #include "gtk.h"
258  #endif                         /* HAVE_GTK */
259  #include "interactive.h"
260 +#include "userdir.h"
261  
262  void            ExitIfError(int error);
263  int             InitializeMixer(char *device_file);
264 @@ -578,7 +579,8 @@
265  {
266  /* Open the settings file for reading or writing.
267  
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.
272  
273     Input:
274 @@ -593,19 +595,24 @@
275         FILE           *setfile;
276         char           *home;
277         char            filename[FILENAME_MAX];
278 +       struct cfv     etcfile;
279 +       
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);
287 -               }
288 -               if (setfile == NULL) {
289 -                       return NULL;
290 -               }
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;
298 +
299 +            setfile = fopencfv(&etcfile, mode);
300 +            if (setfile == NULL) {
301 +               sprintf(filename, "%s/%s", AUMIXRC_PATH, AUMIXRC);
302 +                setfile = fopen(filename, mode);
303 +            }
304         } else
305 -               setfile = fopen(save_filename, mode);
306 +           setfile = fopen(save_filename, mode);
307         return setfile;
308  }
309  
310 @@ -688,7 +695,7 @@
311  other options:\n\
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"));
318  #ifdef HAVE_CURSES
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
321 @@ -0,0 +1,167 @@
322 +// $Id$
323 +#include "userdir.h"
324 +    
325 +static char *nonulhome = "";
326 +
327 +/******************************************************************************/
328 +    
329 +int getusercfv (char *variable, 
330 +                   char *home_dir, 
331 +                   char *user_dir, 
332 +                   size_t stringsize)
333 +{
334 +       struct stat st;
335 +       char *d;
336 +       
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);
342 +       if (*d == '/') 
343 +           {
344 +           strncpy (user_dir, d, stringsize-1);
345 +           }
346 +       else
347 +           {
348 +           snprintf (user_dir, stringsize-1, "%s/%s", home_dir, d);
349 +           }
350 +           
351 +       if (stat(user_dir,&st) != -1 && S_ISDIR(st.st_mode)) 
352 +           {
353 +           return (0);
354 +           }
355 +       
356 +       return (-1);
357 +}
358 +
359 +/******************************************************************************/
360 +
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);
366 +       return 0;
367 +}
368 +
369 +/******************************************************************************/
370 +
371 +int preparemain(struct cfv *CFV) {
372 +       char *p;
373 +       struct stat st;
374 +       if ((p = strrchr(CFV->result, '/')) && *(p+1) == '\0') 
375 +           p = '\0';
376 +       snprintf ((rindex(CFV->result,'\0')), MAXPATHLEN-1, "/%s", 
377 +                 CFV->subname);
378 +       if (stat( CFV->result,&st) != -1 
379 +            && CFV->mode ? 
380 +               S_ISDIR(st.st_mode) : 
381 +               S_ISREG(st.st_mode)) /* have file or dir */
382 +           return (1);
383 +       return 0;
384 +}
385 +
386 +/******************************************************************************/
387 +
388 +int preparehome(struct cfv *CFV) {
389 +       struct stat st;
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", 
393 +                      CFV->home_dir, 
394 +                      CFV->prefix? CFV->prefix:"",
395 +                      CFV->subname,
396 +                      CFV->suffix? CFV->suffix:"");
397 +       if (stat(CFV->result,&st) != -1 
398 +                && CFV->mode ? 
399 +                   S_ISDIR(st.st_mode) : 
400 +                   S_ISREG(st.st_mode)) /* have file or dir */
401 +               return (2);
402 +       return (-1);
403 +}
404 +
405 +/******************************************************************************/
406 +
407 +int usercfv (struct cfv *CFV) {
408 +       int gr;
409 +       gr = detectcfv(CFV);
410 +       if (gr) return gr;
411 +       /* get environment variable */
412 +       gr = getusercfv (CFV->variable, 
413 +                       CFV->home_dir, 
414 +                       CFV->result,
415 +                       MAXPATHLEN);
416 +       if (gr != -1)   /* have main directory */
417 +           {
418 +               gr = preparemain(CFV);
419 +               if (gr) return gr;
420 +           }
421 +       /* don't have main directory or a proper variable set */
422 +       gr = preparehome(CFV);
423 +       return gr;
424 +}
425 +       
426 +/******************************************************************************/
427 +
428 +/* If directory or file doesn't exist returns the best one wich may be created */
429 +int notnullusercfv (struct cfv *CFV) {
430 +       int gr;
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, 
436 +                           CFV->home_dir, 
437 +                           CFV->result,
438 +                           MAXPATHLEN);
439 +           if (gr != -1)       /* have main directory */
440 +               {
441 +                   gr = preparemain(CFV);
442 +                   return 0;
443 +               }
444 +           /* don't have main directory or a proper variable set */
445 +           gr = preparehome(CFV);
446 +           return 0;
447 +       }
448 +       return 0;       
449 +}
450 +    
451 +/******************************************************************************/
452 +
453 +FILE *maynullfopencfv (struct cfv *CFV, const char *mode)
454 +    {
455 +    FILE *cfvfile = NULL;
456 +    
457 +    CFV->mode = M_REGULAR_FILE;
458 +    if ((usercfv (CFV)) == -1) return (NULL);  
459 +    cfvfile = fopen (CFV->result, mode);
460 +    return (cfvfile);
461 +    }
462 +/******************************************************************************/
463 +
464 +FILE *notnullfopencfv (struct cfv *CFV, const char *mode)
465 +    {
466 +    FILE *cfvfile = NULL;
467 +    
468 +    CFV->mode = M_REGULAR_FILE;
469 +    if ((notnullusercfv (CFV)) == -1) return (NULL);   
470 +    cfvfile = fopen (CFV->result, mode);
471 +    return (cfvfile);
472 +    }
473 +
474 +/******************************************************************************/
475 +    
476 +FILE *fopencfv (struct cfv *CFV, const char *mode)
477 +    {
478 +    FILE *cfvfile = NULL;
479 +
480 +    if (cfvfile == NULL && (strpbrk(mode, "wa")) != NULL) /* create in best location */
481 +       cfvfile = notnullfopencfv (CFV, mode);
482 +    else 
483 +       cfvfile = maynullfopencfv (CFV, mode);
484 +    
485 +    return (cfvfile);
486 +    }
487 +
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
492 @@ -0,0 +1,56 @@
493 +// $Id$
494 +#ifndef USERDIR__H
495 +#define USERDIR__H
496 +
497 +#include <unistd.h>
498 +#include <string.h>
499 +#include <stdio.h>
500 +#include <stdlib.h>
501 +#include <sys/types.h>
502 +#include <sys/stat.h>
503 +#include <sys/param.h>
504 +
505 +#define        M_REGULAR_FILE  0
506 +#define        M_DIRECTORY     1
507 +
508 +struct cfv {
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      */
517 +       };
518 +
519 +/* reads environment variable. if the path isn't absolute will add $HOME/
520 + * at the beginning
521 + * return: 0 - directory exists
522 + *         -1 - directory doesn't exist
523 + */
524 +int getusercfv (char *variable, 
525 +                   char *home_dir, 
526 +                   char *user_dir,
527 +                   size_t stringsize);
528 +/* reads the $HOME variable */
529 +int detectcfv(struct cfv *CFV);
530 +
531 +/* looks for the config/data file/dir.
532 + * result: -1 - error - cannot find file/dir 
533 + *         0 - ok
534 + *         CFV.result set
535 + */
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.
540 + *              CFV.result set
541 + */              
542 +int notnullusercfv (struct cfv *CFV);
543 +
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);
547 +
548 +#endif
This page took 0.128385 seconds and 3 git commands to generate.