Add support of /W prompts

-Erik
This commit is contained in:
Eric Andersen 2001-04-05 23:00:47 +00:00
parent 831ed16efc
commit c270ec1fa2
2 changed files with 26 additions and 0 deletions

View File

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

View File

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