From: Junio C Hamano Date: Fri, 18 Nov 2005 23:44:46 GMT Subject: [PATCH] Do not show .exe in git command list. Message-ID: <7vacg1frm9.fsf_-_@assigned-by-dhcp.cox.net> In-Reply-To: <437E5A79.9070402@gmail.com> Truncate the result from readdir() in the exec-path if they end with .exe, to make it a bit more readable on Cygwin. Signed-off-by: Junio C Hamano --- Today I borrowed a Cygwin environment to build things without any customization (no config.mak nor make command line override), and I have to report that make test passed OK for me. git.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) applies-to: ff891e258456492507934e82d90fd8aacb124845 f9039f30d56e3815eaab870d8b19c7b94aded8aa diff --git a/git.c b/git.c index b9b8c62..bdd3f8d 100644 --- a/git.c +++ b/git.c @@ -59,7 +59,8 @@ static void add_cmdname(const char *name if (!ent) oom(); ent->len = len; - memcpy(ent->name, name, len+1); + memcpy(ent->name, name, len); + ent->name[len] = 0; cmdname[cmdname_cnt++] = ent; } @@ -132,6 +133,8 @@ static void list_commands(const char *ex continue; entlen = strlen(de->d_name); + if (4 < entlen && !strcmp(de->d_name + entlen - 4, ".exe")) + entlen -= 4; if (longest < entlen) longest = entlen; --- 0.99.9.GIT