Mail Archives: djgpp/2007/05/16/13:01:45
Michelle Konzack wrote:
> Hello Cesar,
>
> Am 2007-05-16 12:16:57, schrieb Cesar Rabak:
>> OK Michelle,
>>
>> I think I'm _almost_ understood what you need (or perhaps not ;-) let's see:
>>
>> It seems obvious at this time that just counting the number of dots in
>> the strings is not what you need/want, as this is trivial in C.
>>
>> So would you like to build a function in C that receiving as argument a
>> string like:
>>
>> ~/INBOX/ returns ~/INBOX/
>> /INBOX.ML_devel/ returns .ML_devel/
>> /INBOX.ML_devel.djgpp/ returns .djgpp/
>>
>> Is it there near of your needs?
>
> Nearly right, but I need the depth of it (e.g.: .djgpp = 2) and the name.
>
> If I use "#define _GNU_SOURCE" I can use under Linux glibc strdupa()
> and strtok().
>
> But since strdupa() does not exist under DJGPP, I have some problems
>
>
> Thanks, Greetings and nice Day
> Michelle Konzack
>
>
Do you only need strdup() or strdupa() ?? Why don't you write your own?
Like:
char *strdup(const char *s)
{
size_t len = strlen (s) + 1;
char *result = (char*) malloc (len);
if (result == (char*) 0)
return (char*) 0;
return (char*) memcpy (result, s, len);
}
(This is the code for the real strdup() function.)
All the best and sorry for writting if this wasn't your real problem
- Raw text -