On Wed 2008-04-16 03:41:43 UTC-0700, Renga Ramanujam ([EMAIL PROTECTED]) wrote:
> /* Category: C - Extract the directory information from a file name */
> /* /etc/local/bin/fdmount --> fdmount */
> /* This mimics the unix command 'basename'. */
If the source code to both Linux and BSD's version of basename() is
already freely available, why are you re-writing it?
Did you actually compile your code? Did you notice all these
warnings?
basename.c:6: warning: return type defaults to int'
basename.c: In function main':
basename.c:9: warning: implicit declaration of function printf'
basename.c:12: warning: control reaches end of non-void function
basename.c: In function basename':
basename.c:29: warning: assignment discards qualifiers from pointer target type
Also, your code is not 100% compatible with FreeBSD's basename(). For
example, using your version, basename("/") does not return "/".
And basename(NULL) will segfault using your version.