diff options
author | Eric Andersen | 2001-04-05 23:00:47 +0000 |
---|---|---|
committer | Eric Andersen | 2001-04-05 23:00:47 +0000 |
commit | c270ec1fa27e998d6d22bb43c3839789f8af4ba8 (patch) | |
tree | d0b6fab76b2d04d9fe09a3158cd82d40ed4317b7 | |
parent | 831ed16efca5dd12b51480a3004f3dc86fcf267d (diff) | |
download | busybox-c270ec1fa27e998d6d22bb43c3839789f8af4ba8.zip busybox-c270ec1fa27e998d6d22bb43c3839789f8af4ba8.tar.gz |
Add support of /W prompts
-Erik
-rw-r--r-- | cmdedit.c | 13 | ||||
-rw-r--r-- | shell/cmdedit.c | 13 |
2 files changed, 26 insertions, 0 deletions
@@ -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); diff --git a/shell/cmdedit.c b/shell/cmdedit.c index e317b86..a371081 100644 --- a/shell/cmdedit.c +++ b/shell/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); |