xaizek / hstr (License: Apachev2) (since 2018-12-07)
Bash and Zsh shell history suggest box - easily view, navigate, search and manage your command history.
Commit 533d6c29064f5bc6ddac617dfecad256f8f31e3b

More #186 related fixes.
Author: Martin Dvorak
Author date (UTC): 2017-06-04 13:04
Committer name: Martin Dvorak
Committer date (UTC): 2017-06-04 13:04
Parent(s): 9d0000a95e3f5cb9390fd57c3bbccb9c3a87c7b1
Signing key:
Tree: b6f356e6b7f7ab312051bf0e137216544c038a7b
File Lines added Lines deleted
src/hstr_utils.c 10 10
File src/hstr_utils.c changed (mode: 100644) (index c9dde15..5d31597)
... ... void hstr_chop(char *s)
73 73 } }
74 74 } }
75 75
76 #ifndef __CYGWIN__
76 #if !defined(__MS_WSL__) && !defined(__CYGWIN__)
77 77 void tiocsti() void tiocsti()
78 78 { {
79 79 char buf[] = DEFAULT_COMMAND; char buf[] = DEFAULT_COMMAND;
 
... ... void tiocsti()
87 87 void fill_terminal_input(char *cmd, bool padding) void fill_terminal_input(char *cmd, bool padding)
88 88 { {
89 89 if(cmd && strlen(cmd)>0) { if(cmd && strlen(cmd)>0) {
90 #ifndef __CYGWIN__
90 #if defined(__MS_WSL__) || defined(__CYGWIN__)
91 fprintf(stderr,cmd);
92 if(padding) fprintf(stderr,"\n");
93 #else
91 94 size_t size = strlen(cmd); size_t size = strlen(cmd);
92 95 unsigned i; unsigned i;
93 96 char *c; char *c;
 
... ... void fill_terminal_input(char *cmd, bool padding)
98 101 } }
99 102 // echo, but don't flush to terminal // echo, but don't flush to terminal
100 103 if(padding) printf("\n"); if(padding) printf("\n");
101 #else
102 fprintf(stderr,cmd);
103 if(padding) fprintf(stderr,"\n");
104 104 #endif #endif
105 105 } }
106 106 } }
 
... ... char *get_shell_name_by_ppid(const int pid)
164 164 if(strlen(name) > 4){ if(strlen(name) > 4){
165 165 char* shell = getenv("SHELL"); char* shell = getenv("SHELL");
166 166 if(shell != NULL) { if(shell != NULL) {
167 shell=strrchr(shell,'/');
168 if(shell != NULL) {
169 shell++;
170 strncpy(name,shell,sizeof(char)*strlen(shell));
171 }
167 shell=strrchr(shell,'/');
168 if(shell != NULL) {
169 shell++;
170 strncpy(name,shell,sizeof(char)*strlen(shell));
171 }
172 172 } }
173 173 } }
174 174 return name; return name;
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/hstr

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/hstr

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master