diff options
| author | cvs2svn <cvs2svn@FreeBSD.org> | 1999-01-21 00:55:32 +0000 |
|---|---|---|
| committer | cvs2svn <cvs2svn@FreeBSD.org> | 1999-01-21 00:55:32 +0000 |
| commit | 76b5366091f76c9bc73570149ef5055648fc2c39 (patch) | |
| tree | 590d020e0f2a5bea6e09d66d951a674443b21d67 /contrib/global/lib/getdbpath.c | |
| parent | 4b4d01da6f07f7754ff6a6e4f5223e9f0984d1a6 (diff) | |
Diffstat (limited to 'contrib/global/lib/getdbpath.c')
| -rw-r--r-- | contrib/global/lib/getdbpath.c | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/contrib/global/lib/getdbpath.c b/contrib/global/lib/getdbpath.c index 4529988ed6c86..73f1a4f480556 100644 --- a/contrib/global/lib/getdbpath.c +++ b/contrib/global/lib/getdbpath.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 1997, 1998 Shigio Yamaguchi. All rights reserved. + * Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -41,10 +41,12 @@ #include "die.h" #include "getdbpath.h" +#include "locatestring.h" #include "test.h" -static const char *makeobjdirprefix; /* obj partition */ -static const char *makeobjdir; /* obj directory */ +static char *makeobjdirprefix; /* obj partition */ +static char *makeobjdir; /* obj directory */ +static int bsd; /* if BSD */ /* * gtagsexist: test whether GTAGS's existence. @@ -65,15 +67,17 @@ char *dbpath; strcpy(dbpath, candidate); return 1; } - sprintf(path, "%s/%s/GTAGS", candidate, makeobjdir); - if (test("fr", path)) { - sprintf(dbpath, "%s/%s", candidate, makeobjdir); - return 1; - } - sprintf(path, "%s%s/GTAGS", makeobjdirprefix, candidate); - if (test("fr", path)) { - sprintf(dbpath, "%s%s", makeobjdirprefix, candidate); - return 1; + if (bsd) { + sprintf(path, "%s/%s/GTAGS", candidate, makeobjdir); + if (test("fr", path)) { + sprintf(dbpath, "%s/%s", candidate, makeobjdir); + return 1; + } + sprintf(path, "%s%s/GTAGS", makeobjdirprefix, candidate); + if (test("fr", path)) { + sprintf(dbpath, "%s%s", makeobjdirprefix, candidate); + return 1; + } } return 0; } @@ -106,14 +110,17 @@ char *dbpath; if (!strcmp(cwd, "/")) die("It's root directory! What are you doing?"); - if ((p = getenv("MAKEOBJDIRPREFIX")) != NULL) - makeobjdirprefix = p; - else - makeobjdirprefix = "/usr/obj"; - if ((p = getenv("MAKEOBJDIR")) != NULL) - makeobjdir = p; - else - makeobjdir = "obj"; + if (getenv("OSTYPE") && locatestring(getenv("OSTYPE"), "BSD", 0)) { + if ((p = getenv("MAKEOBJDIRPREFIX")) != NULL) + makeobjdirprefix = p; + else + makeobjdirprefix = "/usr/obj"; + if ((p = getenv("MAKEOBJDIR")) != NULL) + makeobjdir = p; + else + makeobjdir = "obj"; + bsd = 1; + } if ((p = getenv("GTAGSROOT")) != NULL) { if (*p != '/') |
