[PATCH] increase git el1T3nEss

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux