all you need to is kind create new command line string, should be too hard, you need some "" symbols around args, and you need to calculate size of buffer from number of args, and number of extra symbols like "", and null terminate symbol \0.
strcpy and strcat can do that, or you use sprintf, sure there are lots more, or you can write your own.
(NutsAboutAmiga)
Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
Important to note that exec() is not a very amiga thing. In princliple never returns but even with a drop in replacement, you'll to deal the fact that it *does* return on AmigaOS (when the executed program returns).
at some point the program will exit, and its going to wait for threads to finish, before exiting... this where badly ported programs sucks and fucks up memory and turn the Amiga into a brick.
(NutsAboutAmiga)
Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
AFAICT ftime() returns basically the same information as gettimeofday() only the fractional seconds part is milliseconds instead of microseconds, so the following simple replacement should work:
I know that Chris y. have execvp replacement (https://github.com/chris-y/git2/blob/m ... src/common/compat/amiga.c), but do we have repacements for execpl and other function of unistd?
The execvp() "replacement" you link to is just a dummy function which prints a message to the program's stdout.
In fact the pipe() function there is also wrong since it uses fopen() when it should be using open() instead.
Clib2 license allows you to do so as far as I understand it. It wouldn't be messy unless you did it messily.
However, if you need to extract largish lumps of clib2 to add to your port you should consider actually linking against clib2 instead of newlib.
What kind of thing are you porting? If it needs shared object support for mosule loading etc then you are somewhat stuck with newlib, but other wise there's no reason not to use clib2, and can quite a few reasons *to* do it.
abc-shell and the core-utils are linked against clib2 for good reason, for example. (Command argument handling, libunix function requirements etc etc)
if (TimerIO != NULL)
{
/* Open with UNIT_VBLANK, but any unit can be used */
if (!(error = IExec->OpenDevice(TIMERNAME,UNIT_VBLANK,(struct IORequest *)TimerIO,0L)))
{
/* Issue the command and wait for it to finish, then get the reply */
TimerIO->tr_node.io_Command = TR_GETSYSTIME;
IExec->DoIO((struct IORequest *) TimerIO);
/* Get the results and close the timer device */
mics = TimerIO->tr_time.tv_micro;
secs = TimerIO->tr_time.tv_secs;
/* Compute days, hours, etc. */
mins = secs / 60;
hrs = mins / 60;
days = hrs / 24;
secs = secs % 60;
mins = mins % 60;
hrs = hrs % 24;
/* Display the time */
IDOS->Printf("\nSystem Time (measured from Jan.1,1978)\n");
IDOS->Printf(" Days Hours Minutes Seconds Microseconds\n");
IDOS->Printf("%6ld %6ld %6ld %6ld %10ld\n", days, hrs, mins, secs, mics);
/* Close the timer device */
IExec->CloseDevice((struct IORequest *) TimerIO);
}
else
IDOS->Printf("\nError: Could not open timer device\n");
/* Delete the IORequest structure */
IExec->FreeSysObject(ASOT_IOREQUEST, TimerIO);
}
else
IDOS->Printf("\nError: Could not create I/O structure\n");
/* Delete the port */
IExec->FreeSysObject(ASOT_PORT, TimerMP);
}
else
IDOS->Printf("\nError: Could not create port\n");
return 0;
}
Gettime.c: In function 'main': Gettime.c:39: error: 'struct TimeRequest' has no member named 'tr_node' Gettime.c:43: error: 'struct TimeRequest' has no member named 'tr_time' Gettime.c:44: error: 'struct TimeRequest' has no member named 'tr_time' Gettime.c:78:2: warning: no newline at end of file
Replace tr_node with Request and tr_time with Time. TimerIO->tr_time.tv_micro => TimerIO->Time.Microseconds TimerIO->tr_time.tv_secs => TimerIO->Time.Seconds
Rock lobster bit me - so I'm here forever X1000 + AmigaOS 4.1 FE "Anyone can build a fast CPU. The trick is to build a fast system." - Seymour Cray
I need an ftime replacement and a few others functions. I currently disabled serial and ftime.
Did you miss the ftime() code that I posted earlier?
If you use timer.device directly you need to convert the time from AmigaOS to UNIX epoch and from local time to GMT, because this is the format that should be returned by the POSIX time functions.