Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
40 user(s) are online (24 user(s) are browsing Forums)

Members: 3
Guests: 37

FlynnTheAvatar, LiveForIt, PixelHi, more...

Headlines

 
  Register To Post  

Why with clib2 proc: requester popup as expected, and with newlib are not ?
Home away from home
Home away from home


See User information
@All
Can anybody explain why this code:

#define _POSIX_SOURCE
#include <unistd.h>
#undef _POSIX_SOURCE
#include <stdio.h>

int main() {
    
char cwd[256] = {0};

    if (
chdir("/proc/self/exe") != 0)
        
perror("chdir() error()");
    else {
        if (
getcwd(cwdsizeof(cwd)) == NULL)
            
perror("getcwd() error");
        else
            
printf("current working directory is: %s\n"cwd);
    }
}


When compile over clib2 correctly bring the "please insert volume proc:" requester, but when the same code builds via newlib it did not ?

In both cases used the same dos.library version (if it matter).

And i of course didn't have "proc:" assigned anywhere and pure type "proc:" in the shell bring the requester as well as expected.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Why with clib2 proc: requester popup as expected, and with newlib are not ?
Just popping in
Just popping in


See User information
@kas1e

isn't it because it is linux paths, should newlib really understand linux paths (without additional libs and/or configs in code)?

Go to top
Re: Why with clib2 proc: requester popup as expected, and with newlib are not ?
Just popping in
Just popping in


See User information
@kas1e
as trgswe write, it must be due to the linux path used with chdir().
In AmigaOS terms that means 'folder "proc" in the parent folder' and hence has nothing to do with any volume or assign which DOS needs to request for.

- Thomas
Go to top
Re: Why with clib2 proc: requester popup as expected, and with newlib are not ?
Home away from home
Home away from home


See User information
@kas1e

Is the clib2 version compiled with -lunix and the newlib version not?

12.RAM Disk:> gcc -o ram:testit_newlib test.c
12.RAM Disk:> testit_newlib
chdir() error(): Invalid argument
12.RAM Disk:> gcc -o ram:testit_newlib test.c -lunix
12.RAM Disk:> testit_newlib
chdir() error(): No such device or address
112.RAM Disk:> gcc -mcrt=clib2 -o ram:testit_clib2 test.c
12.RAM Disk:> testit_clib2
chdir() error(): Invalid argument
12.RAM Disk:> gcc -mcrt=clib2 -o ram:testit_clib2 test.c -lunix
12.RAM Disk:> testit_clib2
chdir() error(): Device not configured

Go to top
Re: Why with clib2 proc: requester popup as expected, and with newlib are not ?
Just popping in
Just popping in


See User information
@kas1e
If it is the new clib2 you must use the function EnableUnixPaths() early in the main function... or make that .unix folder to enable unix paths... is there something similar for newlib? Or for instance -lposix/-lunix?

Go to top
Re: Why with clib2 proc: requester popup as expected, and with newlib are not ?
Home away from home
Home away from home


See User information
@All
False alarm, it was because of mess with -lunix indeed.

While i build it with new clib2 and it have no needs to add -lunix, but instead just create empty .unix file in the root (not folder, but a file) which i have in my test dir i just have requester popup as expected.

Then i tested with newlib, but forget to add -lunix, so, it didn't swapn a requester, but with adding -lunix it is spawn as expected.

So it was just mess of unix path things, yeah.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project