On 3/17/21 10:15 PM, Waldek Hebisch wrote:
> On Tue, Mar 16, 2021 at 08:55:02PM +0800, Qian Yun wrote:
>> The patch is here, discussions are welcome. If my idea is accepted,
>> I can refine the patch a bit more.
>>
>> It uses "argv[0]" to determine the path of "FRICASsys" binary,
>> not very reliable, but portable.
>>
>> So the logic is to use env var "FRICAS" first if it exists,
>> then use "newroot" if it is passed as function argument,
>> then use "$spadroot" which is build time value, use if it still exists,
>> then use the parent directory of "FRICASsys", if it contains
>> "algebra/compress.daase".
>
> In general that is very reasonable. I would probably look
> at "algebra/interp.daase" as it is more fundamental. I am
> not sure if we always have "argv[0]" (more precisely, if
> setting argv[0] to null is merely perverse or illegal).
OK, I'll try to generate a proper patch utilizing this idea.
argv[0] can be modified, that is unfortunate, but it is most
portable, because it is from C, unlike "$0" from shell.
Anyway, I'll check existence of "algebra/interp.daase" before use,
for both "$FRICAS", "$spadroot", and "argv[0]".
- Qian