mirror of
https://github.com/sheumann/hush.git
synced 2024-12-27 01:32:08 +00:00
Add support of /W prompts
-Erik
This commit is contained in:
parent
831ed16efc
commit
c270ec1fa2
13
cmdedit.c
13
cmdedit.c
@ -441,6 +441,19 @@ static void parse_prompt(const char *prmt_ptr)
|
||||
add_to_prompt(&prmt_mem_ptr, &alm, &prmt_len, pwd_buf);
|
||||
continue;
|
||||
#endif
|
||||
case 'W':
|
||||
if (pwd_buf[0] == 0) {
|
||||
char *z;
|
||||
|
||||
getcwd(pwd_buf, PATH_MAX);
|
||||
z = strrchr(pwd_buf,'/');
|
||||
if ( (z != NULL) && (z != pwd_buf) ) {
|
||||
z++;
|
||||
strcpy(pwd_buf,z);
|
||||
}
|
||||
}
|
||||
add_to_prompt(&prmt_mem_ptr, &alm, &prmt_len, pwd_buf);
|
||||
continue;
|
||||
case '!':
|
||||
snprintf(buf, sizeof(buf), "%d", num_ok_lines);
|
||||
add_to_prompt(&prmt_mem_ptr, &alm, &prmt_len, buf);
|
||||
|
@ -441,6 +441,19 @@ static void parse_prompt(const char *prmt_ptr)
|
||||
add_to_prompt(&prmt_mem_ptr, &alm, &prmt_len, pwd_buf);
|
||||
continue;
|
||||
#endif
|
||||
case 'W':
|
||||
if (pwd_buf[0] == 0) {
|
||||
char *z;
|
||||
|
||||
getcwd(pwd_buf, PATH_MAX);
|
||||
z = strrchr(pwd_buf,'/');
|
||||
if ( (z != NULL) && (z != pwd_buf) ) {
|
||||
z++;
|
||||
strcpy(pwd_buf,z);
|
||||
}
|
||||
}
|
||||
add_to_prompt(&prmt_mem_ptr, &alm, &prmt_len, pwd_buf);
|
||||
continue;
|
||||
case '!':
|
||||
snprintf(buf, sizeof(buf), "%d", num_ok_lines);
|
||||
add_to_prompt(&prmt_mem_ptr, &alm, &prmt_len, buf);
|
||||
|
Loading…
Reference in New Issue
Block a user