compat: add a basename() compatibility function

Some systems such as Windows lack libgen.h so provide a
basename() implementation for cross-platform use.

This introduces the NO_LIBGEN_H construct to the Makefile
and autoconf scripts.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
David Aguilar
2009-05-31 01:35:51 -07:00
committed by Junio C Hamano
parent 0620b39b3b
commit e1c0688692
5 changed files with 37 additions and 0 deletions

View File

@ -97,6 +97,13 @@
#include "compat/mingw.h"
#endif /* __MINGW32__ */
#ifndef NO_LIBGEN_H
#include <libgen.h>
#else
#define basename gitbasename
extern char *gitbasename(char *);
#endif
#ifndef NO_ICONV
#include <iconv.h>
#endif