All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Aguilar <davvid@gmail.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, peff@peff.net, markus.heidelberg@web.de,
	jnareb@gmail.com, j.sixt@viscovery.net
Subject: Re: [PATCH v6 2/3] compat: add a basename() compatibility function
Date: Sat, 30 May 2009 21:42:47 -0700	[thread overview]
Message-ID: <20090531044246.GA23995@gmail.com> (raw)
In-Reply-To: <1243744675-24160-2-git-send-email-davvid@gmail.com>

On Sat, May 30, 2009 at 09:37:54PM -0700, David Aguilar wrote:
> Some systems such as Windows lack libgen.h so provide a
> basename() implementation for cross-platform use.
> [...]
> diff --git a/compat/basename.c b/compat/basename.c
> new file mode 100644
> index 0000000..c45716a
> --- /dev/null
> +++ b/compat/basename.c
> @@ -0,0 +1,19 @@
> +#include "../git-compat-util.h"
> +
> +/* Adapted from libiberty's basename.c.  */
> +char *gitbasename (char *path)
> +{
> +	const char *base;
> +
> +#ifdef USE_WIN32_FS
> +	/* Skip over the disk name in MSDOS pathnames. */
> +	if (isalpha(path[0]) && path[1] == ':')
> +		path += 2;
> +#endif


Thanks for bearing through this series everyone.. ;)

Can someone with better win32 knowledge let me know if the
USE_WIN32_FS stuff is needed for msysgit?

I would really like it if there was a way to do without the
#define.



> +	for (base = path; *path; path++) {
> +		if (is_dir_sep(*path)) {
> +			base = path + 1;
> +		}
> +	}
> +	return (char *)base;
> +}

-- 
		David

  parent reply	other threads:[~2009-05-31  4:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-31  4:37 [PATCH v6 1/3] compat: add a mkstemps() compatibility function David Aguilar
2009-05-31  4:37 ` [PATCH v6 2/3] compat: add a basename() " David Aguilar
2009-05-31  4:37   ` [PATCH v6 3/3] diff: generate pretty filenames in prep_temp_blob() David Aguilar
2009-05-31  4:42   ` David Aguilar [this message]
2009-05-31  4:53     ` [PATCH v6 2/3] compat: add a basename() compatibility function Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2009-05-31  8:11 j.sixt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090531044246.GA23995@gmail.com \
    --to=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j.sixt@viscovery.net \
    --cc=jnareb@gmail.com \
    --cc=markus.heidelberg@web.de \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.