]> git.pld-linux.org Git - packages/aumix-gtk.git/blob - aumix-home_etc.patch
- simplified a bit
[packages/aumix-gtk.git] / aumix-home_etc.patch
1 --- aumix-2.1/doc/aumix.1       Mon Jan 31 23:30:12 2000
2 +++ aumix-2.1.pius/doc/aumix.1  Tue Feb  8 02:09:41 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.1/po/aumix.pot      Mon Jan 31 23:30:12 2000
52 +++ aumix-2.1.pius/po/aumix.pot Tue Feb  8 02:09:41 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.1/po/de.po  Sun Nov 28 07:35:18 1999
63 +++ aumix-2.1.pius/po/de.po     Tue Feb  8 02:09:41 2000
64 @@ -81,7 +81,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 @@ -99,7 +99,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:567
82 --- aumix-2.1/po/es.po  Mon Dec  6 16:41:47 1999
83 +++ aumix-2.1.pius/po/es.po     Tue Feb  8 02:09:41 2000
84 @@ -81,7 +81,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 @@ -99,7 +99,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.1/po/gl.po  Mon Dec  6 16:41:47 1999
103 +++ aumix-2.1.pius/po/gl.po     Tue Feb  8 02:09:41 2000
104 @@ -89,7 +89,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 @@ -107,7 +107,7 @@
114  "outras opcións:\n"
115  "  d:  axustar outro dispositivo que non sexa /dev/mixer\n"
116  "  f:  especificar ficheiro para gardar e cargar parámetros (por omisión é\n"
117 -"      ~/.aumixrc ou /etc/aumixrc)\n"
118 +"      $CONFIG_DIR/aumixrc, ~/.aumixrc ou /etc/aumixrc)\n"
119  "  C:  especifica-lo esquema de cor\n"
120  "  h:  amosar esta mensaxe de axuda\n"
121  
122 --- aumix-2.1/po/pl.po  Tue Feb  8 02:15:54 2000
123 +++ aumix-2.1.pius/po/pl.po     Tue Feb  8 02:09:41 2000
124 @@ -181,7 +181,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 @@ -199,7 +199,7 @@
134  "inne opcje:\n"
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, ~/.aumixrc lub /etc/aumixrc)\n"
139  "  C:  okre¶la plik zawieraj±cy schemat u¿ycia kolorów\n"
140  "  h:  ta pomocna informacja\n"
141  
142 --- aumix-2.1/po/pt_BR.po       Sun Nov 28 07:35:18 1999
143 +++ aumix-2.1.pius/po/pt_BR.po  Tue Feb  8 02:09:41 2000
144 @@ -84,7 +84,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 @@ -102,7 +102,7 @@
154  "outras opções:\n"
155  "  d:  usar outro dispositivo que não o /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:  esta mensagem de ajuda\n"
161  
162 --- aumix-2.1/po/ru.po  Mon Dec 20 02:13:11 1999
163 +++ aumix-2.1.pius/po/ru.po     Tue Feb  8 02:09:41 2000
164 @@ -188,7 +188,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 @@ -207,7 +207,7 @@
174  "äÒÕÇÉÅ ÏÐÃÉÉ:\n"
175  "  d:  ÒÅÇÕÌÉÒÏ×ÁÔØ ÕÓÔÒÏÊÓÔ×Á ËÒÏÍÅ /dev/mixer\n"
176  "  f:  ÕËÁÚÁÎÉÅ ÉÍÅÎÉ ÆÁÊÌÁ ÄÌÑ ÈÒÁÎÅÎÉÑ ÕÓÔÁÎÏ×ÏË (ÐÏ ÕÍÏÌÞÁÎÉÀ\n"
177 -"      ~ /.aumixrc ÉÌÉ /etc/aumixrc)\n"
178 +"      $CONFIG_DIR/aumixrc, ~ /.aumixrc ÉÌÉ /etc/aumixrc)\n"
179  "  C:  ×ÙÂÏÒ Ã×ÅÔÏ×ÏÊ ÓÈÅÍÙ\n"
180  "  h:  ÜÔÁ ÐÏÍÏÝØ\n"
181  
182 --- aumix-2.1/po/uk.po  Sun Nov 28 07:35:18 1999
183 +++ aumix-2.1.pius/po/uk.po     Tue Feb  8 02:09:41 2000
184 @@ -82,7 +82,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 @@ -101,7 +101,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:  SPECIFY COLOR SCHEME\n"
200  "  h:  ÃÑ ÄÏÐÏÍÏÇÁ\n"
201  
202 --- aumix-2.1/src/Makefile.am   Sat Dec 25 17:53:54 1999
203 +++ aumix-2.1.pius/src/Makefile.am      Tue Feb  8 02:09:41 2000
204 @@ -1,8 +1,8 @@
205  bin_PROGRAMS   = aumix
206  bin_SCRIPTS    = xaumix
207 -aumix_SOURCES  = common.c curses.c dummy.c gpm-xterm.c gtk.c interactive.c \
208 -               mouse.c common.h curses.h gpm-xterm.h gtk.h interactive.h  \
209 -               mouse.h
210 +aumix_SOURCES  = userdir.c common.c curses.c dummy.c gpm-xterm.c gtk.c \
211 +               interactive.c mouse.c userdir.h common.h curses.h gpm-xterm.h \
212 +               gtk.h interactive.h mouse.h
213  localedir      = $(datadir)/locale
214  INCLUDES       = -I../intl -DLOCALEDIR=\"$(localedir)\" -I@includedir@
215  CFLAGS         = @CFLAGS@ @GLIB_CFLAGS@ @GTK_CFLAGS@
216 --- aumix-2.1/src/Makefile.in   Mon Jan 31 23:19:53 2000
217 +++ aumix-2.1.pius/src/Makefile.in      Tue Feb  8 02:09:41 2000
218 @@ -84,7 +84,7 @@
219  
220  bin_PROGRAMS = aumix
221  bin_SCRIPTS = xaumix
222 -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
223 +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
224  
225  localedir = $(datadir)/locale
226  INCLUDES = -I../intl -DLOCALEDIR=\"$(localedir)\" -I@includedir@
227 @@ -99,7 +99,7 @@
228  
229  CPPFLAGS = @CPPFLAGS@
230  LDFLAGS = @LDFLAGS@
231 -aumix_OBJECTS =  common.o curses.o dummy.o gpm-xterm.o gtk.o \
232 +aumix_OBJECTS =  userdir.o common.o curses.o dummy.o gpm-xterm.o gtk.o \
233  interactive.o mouse.o
234  aumix_LDADD = $(LDADD)
235  aumix_DEPENDENCIES = 
236 --- aumix-2.1/src/common.c      Mon Jan 31 23:30:12 2000
237 +++ aumix-2.1.pius/src/common.c Tue Feb  8 02:14:43 2000
238 @@ -24,6 +24,7 @@
239  #include "gtk.h"
240  #endif
241  #include "interactive.h"
242 +#include "userdir.h"
243  
244  void            ExitIfError(int error);
245  int             InitializeMixer(char *device_file);
246 @@ -536,7 +537,8 @@
247  {
248  /* Open the settings file for reading or writing.
249  
250 -   Try first ${HOME}/.AUMIXRC, then AUMIXRC_PATH/AUMIXRC;
251 +   Try first ${CONFIG_DIR}/AUMIXRC, then ${HOME}/.AUMIXRC
252 +   and eventually AUMIXRC_PATH/AUMIXRC;
253     become an error generator if neither can be opened.
254  
255     Input:
256 @@ -551,19 +553,25 @@
257         FILE           *setfile;
258         char           *home;
259         char            filename[FILENAME_MAX];
260 +       struct cfv     etcfile;
261 +       
262         if (save_filename == NULL) {
263 -               home = getenv("HOME");
264 -               sprintf(filename, "%s/.%s", home, AUMIXRC);
265 -               setfile = fopen(filename, mode);
266 -               if (setfile == NULL) {
267 -                       sprintf(filename, "%s/%s", AUMIXRC_PATH, AUMIXRC);
268 -                       setfile = fopen(filename, mode);
269 -               }
270 -               if (setfile == NULL) {
271 -                       return NULL;
272 -               }
273 +           etcfile.variable = "CONFIG_DIR";
274 +           etcfile.home_dir = NULL;
275 +           etcfile.home_scd = NULL;
276 +           etcfile.subname  = AUMIXRC;
277 +           etcfile.prefix   = ".";
278 +           etcfile.suffix   = "";
279 +           etcfile.mode     = M_REGULAR_FILE;
280 +
281 +           setfile = fopencfv(&etcfile, mode);
282 +                   
283 +           if (setfile == NULL) {
284 +                   sprintf(filename, "%s/%s", AUMIXRC_PATH, AUMIXRC);
285 +                   setfile = fopen(filename, mode);
286 +               }
287         } else
288 -               setfile = fopen(save_filename, mode);
289 +           setfile = fopen(save_filename, mode);
290         return setfile;
291  }
292  
293 @@ -649,7 +657,7 @@
294  other options:\n\
295    d:  adjust a device besides /dev/mixer\n\
296    f:  specify file for saving and loading settings (defaults to\n\
297 -      ~ /.aumixrc or /etc/aumixrc)\n\
298 +      $CONFIG_DIR/aumixrc, ~/.aumixrc or /etc/aumixrc)\n\
299    C:  specify color scheme\n\
300    h:  this helpful message\n"));
301  #ifdef HAVE_CURSES
302 --- aumix-2.1/src/userdir.c     Thu Jan  1 01:00:00 1970
303 +++ aumix-2.1.pius/src/userdir.c        Sat Feb  5 21:19:17 2000
304 @@ -0,0 +1,167 @@
305 +// $Id$
306 +#include "userdir.h"
307 +    
308 +static char *nonulhome = "";
309 +
310 +/******************************************************************************/
311 +    
312 +int getusercfv (char *variable, 
313 +                   char *home_dir, 
314 +                   char *user_dir, 
315 +                   size_t stringsize)
316 +{
317 +       struct stat st;
318 +       char *d;
319 +       
320 +       bzero (user_dir, stringsize);
321 +       if (variable == NULL || *variable == '\0') return (-1);
322 +       if (home_dir == NULL) home_dir = nonulhome;
323 +       d = getenv (variable);  
324 +       if (d == NULL || *d == '\0') return (-1);
325 +       if (*d == '/') 
326 +           {
327 +           strncpy (user_dir, d, stringsize-1);
328 +           }
329 +       else
330 +           {
331 +           snprintf (user_dir, stringsize-1, "%s/%s", home_dir, d);
332 +           }
333 +           
334 +       if (stat(user_dir,&st) != -1 && S_ISDIR(st.st_mode)) 
335 +           {
336 +           return (0);
337 +           }
338 +       
339 +       return (-1);
340 +}
341 +
342 +/******************************************************************************/
343 +
344 +int detectcfv(struct cfv *CFV) {
345 +       if (CFV->subname == NULL) CFV->subname = nonulhome;
346 +       if (CFV->home_dir == NULL) CFV->home_dir = getenv ("HOME");
347 +       if (CFV->home_dir == NULL) CFV->home_dir = CFV->home_scd;
348 +       if (CFV->home_dir == NULL) return (-1);
349 +       return 0;
350 +}
351 +
352 +/******************************************************************************/
353 +
354 +int preparemain(struct cfv *CFV) {
355 +       char *p;
356 +       struct stat st;
357 +       if ((p = strrchr(CFV->result, '/')) && *(p+1) == '\0') 
358 +           p = '\0';
359 +       snprintf ((rindex(CFV->result,'\0')), MAXPATHLEN-1, "/%s", 
360 +                 CFV->subname);
361 +       if (stat( CFV->result,&st) != -1 
362 +            && CFV->mode ? 
363 +               S_ISDIR(st.st_mode) : 
364 +               S_ISREG(st.st_mode)) /* have file or dir */
365 +           return (1);
366 +       return 0;
367 +}
368 +
369 +/******************************************************************************/
370 +
371 +int preparehome(struct cfv *CFV) {
372 +       struct stat st;
373 +       if (CFV->home_dir == NULL || *(CFV->home_dir) == '\0') return (-1);
374 +       if (CFV->prefix == NULL && CFV->suffix == NULL) return (-1);
375 +       snprintf (CFV->result, MAXPATHLEN-1, "%s/%s%s%s", 
376 +                      CFV->home_dir, 
377 +                      CFV->prefix? CFV->prefix:"",
378 +                      CFV->subname,
379 +                      CFV->suffix? CFV->suffix:"");
380 +       if (stat(CFV->result,&st) != -1 
381 +                && CFV->mode ? 
382 +                   S_ISDIR(st.st_mode) : 
383 +                   S_ISREG(st.st_mode)) /* have file or dir */
384 +               return (2);
385 +       return (-1);
386 +}
387 +
388 +/******************************************************************************/
389 +
390 +int usercfv (struct cfv *CFV) {
391 +       int gr;
392 +       gr = detectcfv(CFV);
393 +       if (gr) return gr;
394 +       /* get environment variable */
395 +       gr = getusercfv (CFV->variable, 
396 +                       CFV->home_dir, 
397 +                       CFV->result,
398 +                       MAXPATHLEN);
399 +       if (gr != -1)   /* have main directory */
400 +           {
401 +               gr = preparemain(CFV);
402 +               if (gr) return gr;
403 +           }
404 +       /* don't have main directory or a proper variable set */
405 +       gr = preparehome(CFV);
406 +       return gr;
407 +}
408 +       
409 +/******************************************************************************/
410 +
411 +/* If directory or file doesn't exist returns the best one wich may be created */
412 +int notnullusercfv (struct cfv *CFV) {
413 +       int gr;
414 +       if ((usercfv(CFV)) == -1) {
415 +           gr = detectcfv(CFV);
416 +           if (gr) return gr;  /* remember, it works for errors! */
417 +           /* get the environment variable */
418 +           gr = getusercfv (CFV->variable, 
419 +                           CFV->home_dir, 
420 +                           CFV->result,
421 +                           MAXPATHLEN);
422 +           if (gr != -1)       /* have main directory */
423 +               {
424 +                   gr = preparemain(CFV);
425 +                   return 0;
426 +               }
427 +           /* don't have main directory or a proper variable set */
428 +           gr = preparehome(CFV);
429 +           return 0;
430 +       }
431 +       return 0;       
432 +}
433 +    
434 +/******************************************************************************/
435 +
436 +FILE *maynullfopencfv (struct cfv *CFV, const char *mode)
437 +    {
438 +    FILE *cfvfile = NULL;
439 +    
440 +    CFV->mode = M_REGULAR_FILE;
441 +    if ((usercfv (CFV)) == -1) return (NULL);  
442 +    cfvfile = fopen (CFV->result, mode);
443 +    return (cfvfile);
444 +    }
445 +/******************************************************************************/
446 +
447 +FILE *notnullfopencfv (struct cfv *CFV, const char *mode)
448 +    {
449 +    FILE *cfvfile = NULL;
450 +    
451 +    CFV->mode = M_REGULAR_FILE;
452 +    if ((notnullusercfv (CFV)) == -1) return (NULL);   
453 +    cfvfile = fopen (CFV->result, mode);
454 +    return (cfvfile);
455 +    }
456 +
457 +/******************************************************************************/
458 +    
459 +FILE *fopencfv (struct cfv *CFV, const char *mode)
460 +    {
461 +    FILE *cfvfile = NULL;
462 +
463 +    if (cfvfile == NULL && (strpbrk(mode, "wa")) != NULL) /* create in best location */
464 +       cfvfile = notnullfopencfv (CFV, mode);
465 +    else 
466 +       cfvfile = maynullfopencfv (CFV, mode);
467 +    
468 +    return (cfvfile);
469 +    }
470 +
471 +/******************************************************************************/
472 \ No newline at end of file
473 --- aumix-2.1/src/userdir.h     Thu Jan  1 01:00:00 1970
474 +++ aumix-2.1.pius/src/userdir.h        Sat Feb  5 21:19:17 2000
475 @@ -0,0 +1,56 @@
476 +// $Id$
477 +#ifndef USERDIR__H
478 +#define USERDIR__H
479 +
480 +#include <unistd.h>
481 +#include <string.h>
482 +#include <stdio.h>
483 +#include <stdlib.h>
484 +#include <sys/types.h>
485 +#include <sys/stat.h>
486 +#include <sys/param.h>
487 +
488 +#define        M_REGULAR_FILE  0
489 +#define        M_DIRECTORY     1
490 +
491 +struct cfv {
492 +       char result[MAXPATHLEN];        /* our result                   */
493 +       char *variable; /* name of an environment variable              */
494 +       char *home_dir; /* home directory or NULL for autodetect        */
495 +       char *home_scd; /* directory if home_dir==NULL and no result    */
496 +       char *subname;  /* core name of a file/directory                */
497 +       char *prefix;   /* prefix when using directly home_dir          */
498 +       char *suffix;   /* suffix when using directly home_dir          */
499 +       int mode;       /* expected: M_REGULAR_FILE or M_DIRECTORY      */
500 +       };
501 +
502 +/* reads environment variable. if the path isn't absolute will add $HOME/
503 + * at the beginning
504 + * return: 0 - directory exists
505 + *         -1 - directory doesn't exist
506 + */
507 +int getusercfv (char *variable, 
508 +                   char *home_dir, 
509 +                   char *user_dir,
510 +                   size_t stringsize);
511 +/* reads the $HOME variable */
512 +int detectcfv(struct cfv *CFV);
513 +
514 +/* looks for the config/data file/dir.
515 + * result: -1 - error - cannot find file/dir 
516 + *         0 - ok
517 + *         CFV.result set
518 + */
519 +int usercfv (struct cfv *CFV);
520 +/* looks for the config/data file/dir.
521 + * result: -1 - error - cannot read $HOME
522 + *          0 - ok - if the CFV.result exists, read it. If not create it.
523 + *              CFV.result set
524 + */              
525 +int notnullusercfv (struct cfv *CFV);
526 +
527 +FILE *fopencfv (struct cfv *CFV, const char *mode);
528 +FILE *maynullfopencfv (struct cfv *CFV, const char *mode);
529 +FILE *notnullfopencfv (struct cfv *CFV, const char *mode);
530 +
531 +#endif
This page took 0.081072 seconds and 3 git commands to generate.