[Issue 278] New: dmd.conf search path dosn't work

Thomas Kuehne thomas-dloop at kuehne.cn
Wed Sep 20 15:28:07 PDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Walter Bright schrieb am 2006-08-05:
> Frank Benoit wrote:
>>> I see, that explains why it worked for me (I used direct path names).
>> 
>> The "executable" name can also be a symbolic link.
>> 
>> ln -s /home/frank/dmd/bin/dmd ./lnk
>> ./lnk
>> 
>> 
>> Arg 0 show up with "./lnk". So it is necessary to follow those symbolic
>> links.
>
> I'm rather unfamiliar with that, any snippet of code available?


| #include <stdlib.h>
| #include <stdio.h>
| #include <errno.h>
| #include <unistd.h>
| 
| #if defined(__GLIBC__)
| #define realPath(a) realpath((a), NULL)
| #else
| char* realPath(char* path){
|     /* 4.4BSD, POSIX.1-2001 */
|     char* buf = NULL;
|     char* abs_path = NULL;
| 
|     #if defined(PATH_MAX)
|         #define len PATH_MAX
|     #else
|         ssize_t len;
|         len = pathconf(path, _PC_PATH_MAX);
|         if (len <= 0){
|             len = 4096;
|         }
|     #endif
|
|     buf = calloc(len, 1);
|     abs_path = realpath(path, buf);
|     errno = 0;
| 
|     return abs_path ? abs_path : path;
| }
| #endif
| 
| int main(int argc, char* argv[]){
|     printf("argv:\t%s\n", argv[0]);
|     printf("real:\t%s\n", realPath(argv[0]));
| 
|     return 0;
| }

Thomas


-----BEGIN PGP SIGNATURE-----

iD8DBQFFEc1cLK5blCcjpWoRAqe3AJ9yGXBkluauZjtHmBbroFg+3Ryx5wCglLTF
3gpxOtilRfYAdUxXsqH4idc=
=94mR
-----END PGP SIGNATURE-----



More information about the Digitalmars-d-bugs mailing list