/[global]/global/libutil/conf.c
ViewVC logotype

Diff of /global/libutil/conf.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.40 by shigio, Tue Mar 1 23:45:56 2005 UTC revision 1.41 by shigio, Wed Apr 6 02:40:32 2005 UTC
# Line 203  includelabel(sb, label, level) Line 203  includelabel(sb, label, level)
203   * configpath: get path of configuration file.   * configpath: get path of configuration file.
204   */   */
205  static char *  static char *
206  configpath() {  configpath()
207          static char config[MAXPATHLEN+1];  {
208            STATIC_STRBUF(sb);
209          char *p;          char *p;
210    
211            strbuf_clear(sb);
212          /*          /*
213           * at first, check environment variable GTAGSCONF.           * at first, check environment variable GTAGSCONF.
214           */           */
215          if (getenv("GTAGSCONF") != NULL)          if (getenv("GTAGSCONF") != NULL)
216                  strlimcpy(config, getenv("GTAGSCONF"), sizeof(config));                  strbuf_puts(sb, getenv("GTAGSCONF"));
217          /*          /*
218           * if GTAGSCONF not set then check standard config files.           * if GTAGSCONF not set then check standard config files.
219           */           */
220          else if ((p = get_home_directory()) && test("r", makepath(p, GTAGSRC, NULL)))          else if ((p = get_home_directory()) && test("r", makepath(p, GTAGSRC, NULL)))
221                  strlimcpy(config, makepath(p, GTAGSRC, NULL), sizeof(config));                  strbuf_puts(sb, makepath(p, GTAGSRC, NULL));
222  #ifdef __DJGPP__  #ifdef __DJGPP__
223          else if ((p = get_home_directory()) && test("r", makepath(p, DOS_GTAGSRC, NULL)))          else if ((p = get_home_directory()) && test("r", makepath(p, DOS_GTAGSRC, NULL)))
224                  strlimcpy(config, makepath(p, DOS_GTAGSRC, NULL), sizeof(config));                  strbuf_puts(sb, makepath(p, DOS_GTAGSRC, NULL));
225  #endif  #endif
226          else if (test("r", GTAGSCONF))          else if (test("r", GTAGSCONF))
227                  strlimcpy(config, GTAGSCONF, sizeof(config));                  strbuf_puts(sb, GTAGSCONF);
228          else if (test("r", OLD_GTAGSCONF))          else if (test("r", OLD_GTAGSCONF))
229                  strlimcpy(config, OLD_GTAGSCONF, sizeof(config));                  strbuf_puts(sb, OLD_GTAGSCONF);
230          else if (test("r", DEBIANCONF))          else if (test("r", DEBIANCONF))
231                  strlimcpy(config, DEBIANCONF, sizeof(config));                  strbuf_puts(sb, DEBIANCONF);
232          else if (test("r", OLD_DEBIANCONF))          else if (test("r", OLD_DEBIANCONF))
233                  strlimcpy(config, OLD_DEBIANCONF, sizeof(config));                  strbuf_puts(sb, OLD_DEBIANCONF);
234          else          else
235                  return NULL;                  return NULL;
236          return config;          return strbuf_value(sb);
237  }  }
238  /*  /*
239   * openconf: load configuration file.   * openconf: load configuration file.

Legend:
Removed from v.1.40  
changed lines
  Added in v.1.41

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26