Last active
March 22, 2019 04:46
-
-
Save saagarjha/7460238ad10cad5c5f9479f82df158fb to your computer and use it in GitHub Desktop.
Disables bright colors in nano on macOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string.h> | |
int overridden_strncasecmp(const char *s1, const char *s2, size_t n) { | |
if (n != 6 || strncmp(s2, "bright", n)) { | |
return strncasecmp(s1, s2, n); | |
} else { | |
return !0; | |
} | |
} | |
int overridden_strcasecmp(const char *s1, const char *s2) { | |
if (!strncasecmp(s1, "bright", 6)) { | |
s1 += 6; | |
} | |
return strcasecmp(s1, s2); | |
} | |
__attribute__((used, section("__DATA,__interpose"))) static struct { | |
int (*overridden_strncasecmp)(); | |
int (*strncasecmp)(); | |
} overrides[] = { | |
{overridden_strncasecmp, strncasecmp}, | |
{overridden_strcasecmp, strcasecmp}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment