cvsuser 04/11/22 03:46:55
Modified: src embed.c
Log:
search PBCs in runtime/parrot too
Revision Changes Path
1.122 +16 -12 parrot/src/embed.c
Index: embed.c
===================================================================
RCS file: /cvs/public/parrot/src/embed.c,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -r1.121 -r1.122
--- embed.c 17 Nov 2004 10:35:30 -0000 1.121
+++ embed.c 22 Nov 2004 11:46:55 -0000 1.122
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: embed.c,v 1.121 2004/11/17 10:35:30 leo Exp $
+$Id: embed.c,v 1.122 2004/11/22 11:46:55 leo Exp $
=head1 NAME
@@ -208,6 +208,7 @@
#ifdef PARROT_HAS_HEADER_SYSMMAN
int fd = -1;
#endif
+ char *fullname;
if (filename == NULL || strcmp(filename, "-") == 0) {
/* read from STDIN */
@@ -216,13 +217,16 @@
program_size = 0;
}
else {
+
STRING *fs;
- fs = interpreter->current_file = string_make(interpreter, filename,
- strlen(filename), "iso-8859-1", 0);
+ fullname = Parrot_locate_runtime_file(interpreter, filename,
+ PARROT_RUNTIME_FT_PBC);
+ fs = interpreter->current_file = string_make(interpreter, fullname,
+ strlen(fullname), "iso-8859-1", 0);
if (!Parrot_stat_info_intval(interpreter, fs, STAT_EXISTS)) {
PIO_eprintf(interpreter, "Parrot VM: Can't stat %s, code %i.\n",
- filename, errno);
+ fullname, errno);
return NULL;
}
/*
@@ -232,10 +236,10 @@
program_size = Parrot_stat_info_intval(interpreter, fs,
STAT_FILESIZE);
#ifndef PARROT_HAS_HEADER_SYSMMAN
- io = fopen(filename, "rb");
+ io = fopen(fullname, "rb");
if (!io) {
PIO_eprintf(interpreter, "Parrot VM: Can't open %s, code %i.\n",
- filename, errno);
+ fullname, errno);
return NULL;
}
#endif /* PARROT_HAS_HEADER_SYSMMAN */
@@ -287,10 +291,10 @@
#ifdef PARROT_HAS_HEADER_SYSMMAN
- fd = open(filename, O_RDONLY | O_BINARY);
+ fd = open(fullname, O_RDONLY | O_BINARY);
if (!fd) {
PIO_eprintf(interpreter, "Parrot VM: Can't open %s, code %i.\n",
- filename, errno);
+ fullname, errno);
return NULL;
}
@@ -300,13 +304,13 @@
if (program_code == (void *)MAP_FAILED) {
Parrot_warn(interpreter, PARROT_WARNINGS_IO_FLAG,
"Parrot VM: Can't mmap file %s, code %i.\n",
- filename, errno);
+ fullname, errno);
/* try again, now with IO reading the file */
- io = fopen(filename, "rb");
+ io = fopen(fullname, "rb");
if (!io) {
PIO_eprintf(interpreter,
"Parrot VM: Can't open %s, code %i.\n",
- filename, errno);
+ fullname, errno);
return NULL;
}
goto again;
@@ -330,7 +334,7 @@
if (!PackFile_unpack
(interpreter, pf, (opcode_t *)program_code, program_size)) {
PIO_eprintf(interpreter, "Parrot VM: Can't unpack packfile %s.\n",
- filename);
+ fullname);
return NULL;
}