git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Petr Baudis <pasky@suse.cz>
Cc: git@vger.kernel.org,
	Johannes Schindelin <johannes.schindelin@gmx.de>,
	Scott Chacon <schacon@gmail.com>,
	Tom Preston-Werner <tom@github.com>,
	"J.H." <warthog19@eaglescrag.net>, Sam Vilain <sam@vilain.net>,
	Christian Couder <chriscool@tuxfamily.org>,
	Kai Blin <kai@samba.org>
Subject: [PATCH] increase git el1T3nEss
Date: Wed, 29 Oct 2008 13:06:31 -0400	[thread overview]
Message-ID: <20081029170631.GA12078@sigill.intra.peff.net> (raw)
In-Reply-To: <1225257832-29086-1-git-send-email-pasky@suse.cz>

The uptake of git by script kiddies has been disappointingly
minimal. Let's make it more palatable by allowing mixed-case
and l33t-speak commands.

Signed-off-by: Jeff King <peff@peff.net>
---
This commit was made by "git c0mM1t".

 git.c |   27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/git.c b/git.c
index 89feb0b..fd0ca67 100644
--- a/git.c
+++ b/git.c
@@ -261,6 +261,31 @@ static int run_command(struct cmd_struct *p, int argc, const char **argv)
 	return 0;
 }
 
+static char deelite(char in) {
+	if (isalpha(in))
+		return tolower(in);
+	switch (in) {
+	case '0': return 'o';
+	case '1': return 'i';
+	case '3': return 'e';
+	case '5': return 's';
+	case '7': return 'l';
+	}
+	return in;
+}
+
+static int elitecmp(const char *a, const char *b) {
+	while (1) {
+		char ca = deelite(*a), cb = deelite(*b);
+		if (ca != cb)
+			return ca < cb ? -1 : 1;
+		if (!ca)
+			return 0;
+		a++;
+		b++;
+	}
+}
+
 static void handle_internal_command(int argc, const char **argv)
 {
 	const char *cmd = argv[0];
@@ -381,7 +406,7 @@ static void handle_internal_command(int argc, const char **argv)
 
 	for (i = 0; i < ARRAY_SIZE(commands); i++) {
 		struct cmd_struct *p = commands+i;
-		if (strcmp(p->cmd, cmd))
+		if (elitecmp(p->cmd, cmd))
 			continue;
 		exit(run_command(p, argc, argv));
 	}
-- 
1.6.0.3.764.ge6f2.dirty

  parent reply	other threads:[~2008-10-29 17:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-29  5:23 [PATCH 1/1] diff: support making output friendlier for fine, grand users Petr Baudis
2008-10-29 15:07 ` David Brown
2008-10-29 15:28   ` Johannes Schindelin
2008-10-29 17:06 ` Jeff King [this message]
2008-10-29 17:11   ` [PATCH] increase git el1T3nEss Miklos Vajna
2008-10-29 20:28   ` Daniel Barkalow
2008-10-29 21:50     ` Jeff King
2008-10-29 22:24 ` [PATCH 1/1] diff: support making output friendlier for fine, grand users Petr Baudis

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=20081029170631.GA12078@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=johannes.schindelin@gmx.de \
    --cc=kai@samba.org \
    --cc=pasky@suse.cz \
    --cc=sam@vilain.net \
    --cc=schacon@gmail.com \
    --cc=tom@github.com \
    --cc=warthog19@eaglescrag.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).