small update to SDK (posix's glob/globfree, attached)

Have a question about our Software Developer Kit? Ask them here.
Post Reply
kas1e
Beta Tester
Beta Tester
Posts: 542
Joined: Sat Jun 18, 2011 7:56 am
Contact:

small update to SDK (posix's glob/globfree, attached)

Post by kas1e »

As we have many posix functions in the SDK already, i think it will worth to add some more functions which already tested and works. There i mean Glob() and GlobFree() functions, which generate pathnames matching a pattern.

Full description of glob() function are here
Full sescription of globfree() function are here

Functions uses from time to time in the unix games/apps (for example in the ports which do i, it was used in the Pentagram, Warzone2100, SuperTuxKart, AssaultCube , Epiar and some others). So having it in SDK will help as plain developers who want linux-unix kind functions, and the same for porters who just want to port one-two games to os4.

The source of the functions done by Frank Wille in 2005 for his posix-compilant library for VBCC, and which with very small changes i adapt for our SDK Changes are related to just adding of:
#ifdef __cplusplus
extern "C" {
#endif

....

#ifdef __cplusplus
}
#endif
To include file (to make plain C and C++ works fine with it), as well as some changes in includes and have added at top define __USE_INLINE__. No real source changes here, just some adaptation.

In attach you can found: all the source for those functions (for including it to any .a where most posix functions is stored) , main glob.h include (for put to SDK's includes) , and just as an example libglob.a , which can be used just for tests to see that all of this works. If any real-live examples will necessary, i will upload some small example as well.
Attachments
glob.zip
glob() and globfree() for SDK
(7.76 KiB) Downloaded 604 times
User avatar
Slayer
Beta Tester
Beta Tester
Posts: 851
Joined: Tue Dec 21, 2010 4:19 am
Location: New Zealand

Re: small update to SDK (posix's glob/globfree, attached)

Post by Slayer »

I'm all for this kind of thing!

Now if we can only convince you to release your secret fork() implementation that would be absolutely awesome! ;)

Thanks for the resource kas1e

please excuse the attempt at humor :lol:
~Yes I am a Kiwi, No, I did not appear as an extra in 'Lord of the Rings'~
1x AmigaOne X5000 2.0GHz 2gM RadeonR9280X AOS4.x
3x AmigaOne X1000 1.8GHz 2gM RadeonHD7970 AOS4.x
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 530
Joined: Sat Jun 18, 2011 3:12 pm
Location: Finland
Contact:

Re: small update to SDK (posix's glob/globfree, attached)

Post by salass00 »

There is a more advanced implementation of glob()/globfree() in libaos4util in amicygnix SDK. This one is BSD licensed and supports also GNU extensions.
kas1e
Beta Tester
Beta Tester
Posts: 542
Joined: Sat Jun 18, 2011 7:56 am
Contact:

Re: small update to SDK (posix's glob/globfree, attached)

Post by kas1e »

@salas00
The better version we will have in newlib, the better :) Its just sometime some apps from unix world want it, and will be nice to have them by default, especially if they implemented right.
Post Reply