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; |