summary refs log tree commit diff
path: root/curtis/.bin
diff options
context:
space:
mode:
authorJune McEnroe <programble@gmail.com>2017-07-21 20:47:30 -0400
committerJune McEnroe <programble@gmail.com>2017-07-21 20:47:30 -0400
commitd4be6d8760a84fa26dfcbb30f5eae35f124dcf76 (patch)
treefad6e9c9daacefce4338194586beb9fd73798dc3 /curtis/.bin
parentAdd hnel (diff)
downloadsrc-d4be6d8760a84fa26dfcbb30f5eae35f124dcf76.tar.gz
src-d4be6d8760a84fa26dfcbb30f5eae35f124dcf76.zip
Set window size in hnel
Diffstat (limited to 'curtis/.bin')
-rwxr-xr-xcurtis/.bin/hnel.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/curtis/.bin/hnel.c b/curtis/.bin/hnel.c
index 0e270a5c..2f00711a 100755
--- a/curtis/.bin/hnel.c
+++ b/curtis/.bin/hnel.c
@@ -7,6 +7,8 @@ exec cc -Wall -Wextra -pedantic $@ -lutil -o $(dirname $0)/hnel $0
 #include <err.h>
 #include <poll.h>
 #include <stdlib.h>
+#include <sys/ioctl.h>
+#include <sys/wait.h>
 #include <sysexits.h>
 #include <termios.h>
 #include <unistd.h>
@@ -35,6 +37,7 @@ static void restoreTerm(void) {
 }
 
 int main(int argc, char *argv[]) {
+    int error;
     if (argc < 2) return EX_USAGE;
 
     char table[256] = {0};
@@ -43,8 +46,12 @@ int main(int argc, char *argv[]) {
     table['j'] = 'e'; table['J'] = 'E'; table[CTRL('J')] = CTRL('E');
     table['k'] = 'n'; table['K'] = 'N'; table[CTRL('K')] = CTRL('N');
 
+    struct winsize window;
+    error = ioctl(STDERR_FILENO, TIOCGWINSZ, &window);
+    if (error) err(EX_IOERR, "ioctl");
+
     int master;
-    pid_t pid = forkpty(&master, NULL, NULL, NULL);
+    pid_t pid = forkpty(&master, NULL, NULL, &window);
     if (pid < 0) err(EX_OSERR, "forkpty");
 
     if (!pid) {
@@ -52,7 +59,7 @@ int main(int argc, char *argv[]) {
         err(EX_OSERR, "%s", argv[1]);
     }
 
-    int error = tcgetattr(STDERR_FILENO, &saveTerm);
+    error = tcgetattr(STDERR_FILENO, &saveTerm);
     if (error) err(EX_IOERR, "tcgetattr");
     atexit(restoreTerm);
 
;id=907d4b4605a212a645fc78420a29fa34ed9c0642&follow=1'>Exit focus and paste modes on err exitJune McEnroe 2020-02-11Add startup GPLv3 note and URLJune McEnroe 2020-02-11Make sure -D_GNU_SOURCE ends up in CFLAGS on LinuxJune McEnroe 2020-02-11Add note about setting PKG_CONFIG_PATHJune McEnroe 2020-02-11Rename query ID on nick changeJune McEnroe 2020-02-11Call completeClear when closing a windowJune McEnroe 2020-02-11Don't insert color codes for non-mentionsJune McEnroe 2020-02-11Take first two words in colorMentionsJune McEnroe 2020-02-11Use time_t for save signatureJune McEnroe 2020-02-11Set self.nick to * initiallyJune McEnroe 2020-02-11Define ColorCap instead of hardcoding 100June McEnroe 2020-02-11Move hash to top of chat.hJune McEnroe 2020-02-11Move base64 out of chat.hJune McEnroe 2020-02-11Move XDG_SUBDIR out of chat.hJune McEnroe 2020-02-11Fix whois idle unit calculationJune McEnroe 2020-02-11Cast towupper to wchar_tJune McEnroe 2020-02-11Cast set but unused variables to voidJune McEnroe 2020-02-11Declare strlcatJune McEnroe 2020-02-11Check if VDSUSP existsJune McEnroe 2020-02-11Fix completeReplace iterationJune McEnroe 2020-02-11Use pkg(8) to configure on FreeBSDJune McEnroe 2020-02-11Remove legacy codeJune McEnroe 2020-02-11Add INSTALLING section to READMEJune McEnroe