summaryrefslogtreecommitdiffstats
path: root/Modules/config.c.in
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-06-03 17:05:13 (GMT)
committerGuido van Rossum <guido@python.org>1992-06-03 17:05:13 (GMT)
commitc888bf7caebb3a962f697141abe464c2722bfc9f (patch)
treedcd867ae399970515aa432c446bd05a75a5b507f /Modules/config.c.in
parent73b715e25988519e5c06cadfcc867486229e8d40 (diff)
downloadcpython-c888bf7caebb3a962f697141abe464c2722bfc9f.zip
cpython-c888bf7caebb3a962f697141abe464c2722bfc9f.tar.gz
cpython-c888bf7caebb3a962f697141abe464c2722bfc9f.tar.bz2
append the default path to $PYTHONPATH; ignore empty $PYTHONPATH.
default DATE is now 3 Jun 1992
Diffstat (limited to 'Modules/config.c.in')
-rw-r--r--Modules/config.c.in24
1 files changed, 19 insertions, 5 deletions
diff --git a/Modules/config.c.in b/Modules/config.c.in
index d17e7de..fb33b1c 100644
--- a/Modules/config.c.in
+++ b/Modules/config.c.in
@@ -24,6 +24,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Configurable Python configuration file */
+#include "PROTO.h"
+#include "malloc.h"
+
#include "patchlevel.h"
#define VERSION "0.9.%d (%s)"
@@ -31,7 +34,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifdef __DATE__
#define DATE __DATE__
#else
-#define DATE ">= 6 Apr 1992"
+#define DATE ">= 3 Jun 1992"
#endif
#include <stdio.h>
@@ -82,7 +85,7 @@ donecalls()
}
#ifndef PYTHONPATH
-#define PYTHONPATH ".:/usr/local/lib/python"
+#define PYTHONPATH ".:/usr/local/lib/python"
#endif
extern char *getenv();
@@ -91,9 +94,20 @@ char *
getpythonpath()
{
char *path = getenv("PYTHONPATH");
- if (path == 0)
- path = PYTHONPATH;
- return path;
+ char *defpath = PYTHONPATH;
+ char *buf;
+ int n;
+
+ if (path == 0 || *path == '\0')
+ return defpath;
+ n = strlen(path) + strlen(defpath) + 2;
+ buf = malloc(n);
+ if (buf == NULL)
+ return path; /* XXX too bad -- but not likely */
+ strcpy(buf, path);
+ strcat(buf, ":");
+ strcat(buf, defpath);
+ return buf;
}