summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan Nicholson <dbn.lists@gmail.com>2009-10-10 10:29:52 -0700
committerDan Nicholson <dbn.lists@gmail.com>2009-10-10 15:02:19 -0700
commitd7f68d95f3eab032a93a908fae5b027c31caa386 (patch)
tree2b2fa64aa0baf505fa4fed826b7e57bbf1ec8a35 /src
parent082a784487223612431ad47969f5fa1481436b3a (diff)
Use a default TET_ROOT when not in the environment
Requiring an environment variable to be set in order to get any behavior is an obnoxious trait. Instead, a sane default TET_ROOT is built into the programs that use it. Users such as "make check" that need more control can continue using the environment variable. The scripts are now substituted from make so that we get full variable resolution.
Diffstat (limited to 'src')
-rw-r--r--src/tet3/tcc/Makefile.am3
-rw-r--r--src/tet3/tcc/tcc.c8
2 files changed, 8 insertions, 3 deletions
diff --git a/src/tet3/tcc/Makefile.am b/src/tet3/tcc/Makefile.am
index fc078aa5..95a0a185 100644
--- a/src/tet3/tcc/Makefile.am
+++ b/src/tet3/tcc/Makefile.am
@@ -1,4 +1,5 @@
-AM_CPPFLAGS = -I../inc -I$(top_srcdir)/include
+AM_CPPFLAGS = -I../inc -I$(top_srcdir)/include \
+ -DDEFAULT_TET_ROOT='"$(DEFAULT_TET_ROOT)"'
bin_PROGRAMS = tcc
tcc_LDADD = ../tcclib/libtcc.la
tcc_SOURCES = cleanup.c \
diff --git a/src/tet3/tcc/tcc.c b/src/tet3/tcc/tcc.c
index eead1371..290d7069 100644
--- a/src/tet3/tcc/tcc.c
+++ b/src/tet3/tcc/tcc.c
@@ -100,6 +100,10 @@ char tcc_options[] = "IT:Va:bcef:g:i:j:l:m:n:pr:s:t:v:x:y:";
static void badusage PROTOLIST((void));
static void prversioninfo PROTOLIST((void));
+/* default root directory */
+#ifndef DEFAULT_TET_ROOT
+#define DEFAULT_TET_ROOT "/usr/local/share"
+#endif
int main(argc, argv)
int argc;
@@ -146,8 +150,8 @@ char **argv;
/* determine the tet_root directory */
if ((p = getenv("TET_ROOT")) == (char *) 0 || !*p) {
- fatal(0, "TET_ROOT environment variable NULL or not set",
- (char *) 0);
+ strncpy(tet_root, DEFAULT_TET_ROOT, sizeof(tet_root));
+ tet_root[sizeof(tet_root) - 1] = '\0';
}
else
fullpath(cwd, p, tet_root, sizeof tet_root, 0);