Re: mg: dirname, basename

2011-01-19 Thread Henri Kemppainen
Comments? Looks quite fine, but I noticed there are no NULL checks for the newly allocated strings. Aborting a command gracefully might be better than crashing, should anyone ever be unfortunate enough to hit this. Also: @@ -415,8 +421,11 @@ ewprintf(Directory name too long);

Re: mg: dirname, basename

2011-01-19 Thread Henri Kemppainen
Thus, I propose the following respin: implement xdirname and xbasename using a strlcat/strlcpy semantic. This is more natural in most calls anyway. Good idea. Being used to the strlfoo functions, it looks a bit strange to make xplen the middlemost argument, but I'm just being me now. :-) +

Re: mg: dirname, basename

2011-01-19 Thread kjell
Looks quite fine, but I noticed there are no NULL checks for the newly allocated strings. Aborting a command gracefully might be better than crashing, should anyone ever be unfortunate enough to hit this. Absolutely true. And in thinking about adding such checks, I realize they just ugify

mg: dirname, basename

2011-01-18 Thread kjell
And this is the other frequently encountered issue for people trying to port our mg changes elsewhere. dirname and basename are usually stupid on other platforms, modifying their input strings, and other such silliness. This fixes this issue by wrapping everything in allocating routines. It