Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
e0513dee
Commit
e0513dee
authored
Jan 26, 1992
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
getbinaryname is now part of dl_loadmod.
parent
b7e51608
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
63 deletions
+2
-63
Python/import.c
Python/import.c
+2
-63
No files found.
Python/import.c
View file @
e0513dee
...
...
@@ -46,7 +46,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifdef USE_DL
#include "dl.h"
static
char
*
getbinaryname
()
;
extern
char
*
argv0
;
#endif
/* Magic word to reject pre-0.9.4 .pyc files */
...
...
@@ -194,7 +194,7 @@ get_module(m, name, m_ret)
dl_funcptr
p
;
D
(
fprintf
(
stderr
,
"Found %s
\n
"
,
namebuf
));
sprintf
(
funcname
,
"init%s"
,
name
);
p
=
dl_loadmod
(
getbinaryname
()
,
namebuf
,
funcname
);
p
=
dl_loadmod
(
argv0
,
namebuf
,
funcname
);
if
(
p
==
NULL
)
{
D
(
fprintf
(
stderr
,
"dl_loadmod failed
\n
"
));
}
...
...
@@ -404,64 +404,3 @@ init_builtin(name)
}
return
0
;
}
#ifdef USE_DL
/* A function to find a filename for the currently executing binary.
Because this is not directly available, we have to search for argv[0]
along $PATH. But note that if argv[0] contains a slash anywhere,
sh(1) doesn't search $PATH -- so neither do we! */
/* XXX This should be moved to a more system-specific file */
#include <sys/types.h>
#include <sys/stat.h>
/* For stat */
extern
char
*
getenv
();
extern
char
*
argv0
;
/* In config.c */
/* Default path from sh(1) in Irix 4.0.1 */
#define DEF_PATH ":/usr/sbin:/usr/bsd:/bin:/usr/bin:/usr/bin/X11"
static
char
*
getbinaryname
()
{
char
*
p
,
*
q
;
char
*
path
;
static
char
buf
[
258
];
int
i
;
struct
stat
st
;
if
(
strchr
(
argv0
,
'/'
)
!=
NULL
)
{
D
(
fprintf
(
stderr
,
"binary includes slash: %s
\n
"
,
argv0
));
return
argv0
;
}
path
=
getenv
(
"PATH"
);
if
(
path
==
NULL
)
path
=
DEF_PATH
;
p
=
q
=
path
;
for
(;;)
{
while
(
*
q
&&
*
q
!=
':'
)
q
++
;
i
=
q
-
p
;
strncpy
(
buf
,
p
,
i
);
if
(
q
>
p
&&
q
[
-
1
]
!=
'/'
)
buf
[
i
++
]
=
'/'
;
strcpy
(
buf
+
i
,
argv0
);
if
(
stat
(
buf
,
&
st
)
>=
0
)
{
if
(
S_ISREG
(
st
.
st_mode
)
&&
(
st
.
st_mode
&
0111
))
{
D
(
fprintf
(
stderr
,
"found binary: %s
\n
"
,
buf
));
return
buf
;
}
}
if
(
!*
q
)
break
;
p
=
++
q
;
}
D
(
fprintf
(
stderr
,
"can't find binary: %s
\n
"
,
argv0
));
return
argv0
;
}
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment