[EMAIL PROTECTED] wrote:
> >The problem is that |basename()| does not accept |const char *| input
> >since it wants to delete any trailling '/'. Since they will never occur
> >at the string's end for the output of |getexecname()| I removed this
> >functionality from my copy of |basename()|, saving a whole |malloc()|.
> >If you still want that |libc/basename()| to be used we have to copy the
> >string to a writeable location (output of |getexecname()| is |const char
> >*|, |basename()| wants |const *| as input) - in that case I would prefer
> >C99 (e.g. int i=90 ; char s[i]; works in C99 like in ISO C++) and
> >allocate the string space from stack to avoid the |malloc()|.
> 
> Why don't you use "strrchr" then?

Original posting was written around Fri, 24 Mar 2006 23:44:09 +0100,
deeply in the night without having coffee available and at least half
the brain offline (which is no excuse for bad code - but the patch was
just a prototype anyway... :-) ) ... ;-(
Yes... |strrchr()| sounds much much easier... thanks! :-) Next patch
follows once my other ksh93-related work finishes building here...

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [EMAIL PROTECTED]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 7950090
 (;O/ \/ \O;)
_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org

Reply via email to