Suggested change to psp-config: symlink expansion
Suggested change to psp-config: symlink expansion
Rational:
I would like psp-config to expand symlinks so that the real installation directory is found. I use a package system that installs several versions of sofware in parallell and offer a symlink form to the default version of those packages. unwinding the symlink makes the psp-config work in my setup.
Suggested change (minus the huge comment):
--- tools/psp-config.c.orig 2005-06-29 23:34:23.000000000 +0200
+++ tools/psp-config.c 2005-06-29 23:35:51.000000000 +0200
@@ -135,6 +135,11 @@
int suffix_len;
int path_len;
+ /* unwind links to get to read installation, allowing
+ for several installation with links to the default
+ one from for example /usr/local */
+ while(readlink(path, path, MAX_PATH) != -1);
+
suffix_len = strlen(PSPDEV_PATH_SUFFIX);
path_len = strlen(path);
I would like psp-config to expand symlinks so that the real installation directory is found. I use a package system that installs several versions of sofware in parallell and offer a symlink form to the default version of those packages. unwinding the symlink makes the psp-config work in my setup.
Suggested change (minus the huge comment):
--- tools/psp-config.c.orig 2005-06-29 23:34:23.000000000 +0200
+++ tools/psp-config.c 2005-06-29 23:35:51.000000000 +0200
@@ -135,6 +135,11 @@
int suffix_len;
int path_len;
+ /* unwind links to get to read installation, allowing
+ for several installation with links to the default
+ one from for example /usr/local */
+ while(readlink(path, path, MAX_PATH) != -1);
+
suffix_len = strlen(PSPDEV_PATH_SUFFIX);
path_len = strlen(path);
Seing as only one option is supported anyway, it shouldn't be a major issue to do without the call to getopt_long()... :-)
Hm, I need to make a proper patch for the endian conversion code in (un)pack-pbp.c too. It uses "NXSwapInt()" without defining it...
Code: Select all
/* Process the arguments */
int process_args(int argc, char **argv)
{
int i, ret = 0;
g_printpath = 0;
for(i=1; i<argc; i++)
if(!strcmp(argv[i], "-p") || !strcmp(argv[i], "--pspsdk-path"))
{
g_printpath = 1;
ret = 1;
}
else
{
fprintf(stderr, "Invalid option '%s'\n", argv[i]);
}
return ret;
}
Flying at a high speed
Having the courage
Getting over crisis
I rescue the people
Having the courage
Getting over crisis
I rescue the people
Yes, but the SDK does not link against libiberty. This can be fixed of course, but since libiberty might not be installed either, a better idea might be to include the getopt_long source from libiberty into the PSPSDK distro, and compile it if needed. libiberty is LGPL, so it should be possible (I haven't studied the AFL which the SDK is under to see if it's compatible though).crazyc wrote:getopt_long is in libiberty.a if your platform libc doesn't have it.
Flying at a high speed
Having the courage
Getting over crisis
I rescue the people
Having the courage
Getting over crisis
I rescue the people
I can do it if you give me write access. ;-)
Here's a patch for the endianness issue with (un)pack-pbp.c:
endian.patch
config.h.in will have to be regenerated too (is it a mistake that it is under version control? I expect so...).
Here's a patch for the endianness issue with (un)pack-pbp.c:
endian.patch
config.h.in will have to be regenerated too (is it a mistake that it is under version control? I expect so...).
Flying at a high speed
Having the courage
Getting over crisis
I rescue the people
Having the courage
Getting over crisis
I rescue the people