summary refs log tree commit diff
path: root/home
diff options
context:
space:
mode:
Diffstat (limited to 'home')
-rwxr-xr-xhome/.bin/hnel.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/home/.bin/hnel.c b/home/.bin/hnel.c
index 981355a6..3aec85b3 100755
--- a/home/.bin/hnel.c
+++ b/home/.bin/hnel.c
@@ -22,6 +22,13 @@ exec cc -Wall -Wextra -pedantic $@ -lutil -o $(dirname $0)/hnel $0
 #include <util.h>
 #endif
 
+static char table[256] = {
+    ['n'] = 'j', ['N'] = 'J', [CTRL('N')] = CTRL('J'),
+    ['e'] = 'k', ['E'] = 'K', [CTRL('E')] = CTRL('K'),
+    ['j'] = 'e', ['J'] = 'E', [CTRL('J')] = CTRL('E'),
+    ['k'] = 'n', ['K'] = 'N', [CTRL('K')] = CTRL('N'),
+};
+
 static ssize_t writeAll(int fd, const char *buf, size_t len) {
     ssize_t writeLen;
     while (0 < (writeLen = write(fd, buf, len))) {
@@ -42,13 +49,6 @@ int main(int argc, char *argv[]) {
 
     if (argc < 2) return EX_USAGE;
 
-    bool enable = true;
-    char table[256] = {0};
-    table['n'] = 'j'; table['N'] = 'J'; table[CTRL('N')] = CTRL('J');
-    table['e'] = 'k'; table['E'] = 'K'; table[CTRL('E')] = CTRL('K');
-    table['j'] = 'e'; table['J'] = 'E'; table[CTRL('J')] = CTRL('E');
-    table['k'] = 'n'; table['K'] = 'N'; table[CTRL('K')] = CTRL('N');
-
     error = tcgetattr(STDERR_FILENO, &saveTerm);
     if (error) err(EX_IOERR, "tcgetattr");
     atexit(restoreTerm);
@@ -71,6 +71,8 @@ int main(int argc, char *argv[]) {
         err(EX_OSERR, "%s", argv[1]);
     }
 
+    bool enable = true;
+
     struct pollfd fds[2] = {
         { .fd = STDIN_FILENO, .events = POLLIN },
         { .fd = master, .events = POLLIN },
'2019-02-08 16:24:25 -0500'>2019-02-08Elaborate hi man pageJune McEnroe 2019-02-08Use set for parent in hiJune McEnroe 2019-02-08Switch back to semantic keyword grouping in hiJune McEnroe 2019-02-08Match only the basename in hiJune McEnroe 2019-02-07Add mdoc syntax to hiJune McEnroe 2019-02-07Support multi-line C macros in hiJune McEnroe 2019-02-07Detect .mk files as makeJune McEnroe 2019-02-07Add make syntax to hiJune McEnroe 2019-02-07Add IRC output to hiJune McEnroe 2019-02-07Improve C syntax accuracy and add Format classJune McEnroe 2019-02-07Factor out hi checkJune McEnroe Fix subexpression bounds check and compile pattends. 2019-02-07Add Escape class to hiJune McEnroe 2019-02-07Add Todo class and parent syntax constraintJune McEnroeef='/src/commit/www/git.causal.agency/source-filter.sh?id=62b345dc27d1fa61c6dbe9e02b684f6efe347280&follow=1'>Hide line numbers when rendering mdocJune McEnroe 2019-12-18Customize cgit CSSJune McEnroe 2019-12-18Use :target rather than :focus pseudo-classJune McEnroe 2019-12-18Copy cgit auxiliary binaries properlyJune McEnroe 2019-12-18Add git.causal.agency cgit configJune McEnroe 2019-12-18Bail from hi if input is binaryJune McEnroe 2019-12-16Post "cgit setup"June McEnroe