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);
|
add_to_prompt(&prmt_mem_ptr, &alm, &prmt_len, pwd_buf);
|
||||||
continue;
|
continue;
|
||||||
#endif
|
#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 '!':
|
case '!':
|
||||||
snprintf(buf, sizeof(buf), "%d", num_ok_lines);
|
snprintf(buf, sizeof(buf), "%d", num_ok_lines);
|
||||||
add_to_prompt(&prmt_mem_ptr, &alm, &prmt_len, buf);
|
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);
|
add_to_prompt(&prmt_mem_ptr, &alm, &prmt_len, pwd_buf);
|
||||||
continue;
|
continue;
|
||||||
#endif
|
#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 '!':
|
case '!':
|
||||||
snprintf(buf, sizeof(buf), "%d", num_ok_lines);
|
snprintf(buf, sizeof(buf), "%d", num_ok_lines);
|
||||||
add_to_prompt(&prmt_mem_ptr, &alm, &prmt_len, buf);
|
add_to_prompt(&prmt_mem_ptr, &alm, &prmt_len, buf);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user