annotate RISCOS/Modules/getpath_riscos.c @ 65035:87f4b32905df 2.7

Cosmetic fix to use print function.
author Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
date Fri, 01 Oct 2010 10:48:47 +0000
parents fd25030223b0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16941
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
1 #include "Python.h"
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
2 #include "osdefs.h"
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
3
21087
41ea2abb74fb Use strncpy() instead of sprintf() in calculate_path().
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 20652
diff changeset
4 static char *prefix, *exec_prefix, *progpath, *module_search_path=NULL;
16941
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
5
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
6 static void
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
7 calculate_path()
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
8 {
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
9 char *pypath = getenv("Python$Path");
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
10 if (pypath) {
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
11 int pathlen = strlen(pypath);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
12 module_search_path = malloc(pathlen + 1);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
13 if (module_search_path)
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
14 strncpy(module_search_path, pypath, pathlen + 1);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
15 else {
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
16 fprintf(stderr,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
17 "Not enough memory for dynamic PYTHONPATH.\n"
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
18 "Using default static PYTHONPATH.\n");
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
19 }
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
20 }
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
21 if (!module_search_path)
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
22 module_search_path = "<Python$Dir>.Lib";
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
23 prefix = "<Python$Dir>";
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
24 exec_prefix = prefix;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
25 progpath = Py_GetProgramName();
16941
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
26 }
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
27
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
28 /* External interface */
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
29
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
30 char *
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
31 Py_GetPath()
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
32 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
33 if (!module_search_path)
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
34 calculate_path();
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
35 return module_search_path;
16941
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
36 }
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
37
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
38 char *
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
39 Py_GetPrefix()
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
40 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
41 if (!module_search_path)
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
42 calculate_path();
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
43 return prefix;
16941
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
44 }
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
45
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
46 char *
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
47 Py_GetExecPrefix()
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
48 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
49 if (!module_search_path)
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
50 calculate_path();
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
51 return exec_prefix;
16941
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
52 }
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
53
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
54 char *
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
55 Py_GetProgramFullPath()
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
56 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
57 if (!module_search_path)
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
58 calculate_path();
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 21436
diff changeset
59 return progpath;
16941
a015aed3a1ac RISCOS files by dschwertberger
Guido van Rossum <guido@python.org>
parents:
diff changeset
60 }