From f3ba4e94cd3c42c674feaaf2181848c8de378dd8 Mon Sep 17 00:00:00 2001 From: "[GPL]Ed" Date: Sat, 22 Apr 2023 20:29:05 +0000 Subject: [PATCH] `~/.zrc` modifications --- .zrc | 13 +++++++++++++ src/main.cpp | 11 ++++------- src/zlineedit.hpp | 3 ++- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.zrc b/.zrc index 0418973..cad8855 100755 --- a/.zrc +++ b/.zrc @@ -135,6 +135,19 @@ fn extract { } } +# Function from Xmodulo +fn kernelgraph { + lsmod | perl -e { + print "digraph \"lsmod\" {"; + <>; + while(<>){ + @_=split/\s+/; + print "\"$_[0]\" -> \"$_\"\n" for split/,/,$_[3] + } + print "}" + } | dot -Tpng | display -; +} + # Custom tools # https://github.com/Edd12321/{cstop,evct,zrc} alias top+ 'cstop;reset' diff --git a/src/main.cpp b/src/main.cpp index 6487d7e..1ad576e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -331,19 +331,16 @@ main(int argc, char *argv[]) std::ifstream fp; struct passwd *pw; - // make faster I/O + // make faster&unbuffered I/O std::ios_base::sync_with_stdio(false); - - // original file descriptors - o_in = dup(STDIN_FILENO); - o_out = dup(STDOUT_FILENO); - + setvbuf(stdout, NULL, _IONBF, 0); + // signal handlers signal2(SIGCHLD, sigchld_handler); signal2(SIGINT, sigint_handler); signal2(SIGTSTP, sigtstp_handler); signal2(SIGQUIT, sigquit_handler); - + // signal ignore signal2(SIGTTIN, SIG_IGN); signal2(SIGTTOU, SIG_IGN); diff --git a/src/zlineedit.hpp b/src/zlineedit.hpp index 74374ff..c3567b0 100644 --- a/src/zlineedit.hpp +++ b/src/zlineedit.hpp @@ -226,7 +226,7 @@ static inline void clearcin() { std::cin.clear(); - fflush(stdin); + //fflush(stdin); } static inline bool @@ -255,6 +255,7 @@ zlineedit(std::string& buf) dp_list = cursor_pos = 0; R(); buf.clear(); + clearcin(); while (zrawch(c)) { switch (c) {