Changeset 1c481ee in mainline
- Timestamp:
- 2019-03-09T15:40:05Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 587867a
- Parents:
- c56a3eb
- git-author:
- Matthieu Riolo <matthieu.riolo@…> (2019-03-02 15:55:07)
- git-committer:
- Matthieu Riolo <matthieu.riolo@…> (2019-03-09 15:40:05)
- Location:
- uspace/app/bdsh
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/compl.c
rc56a3eb r1c481ee 40 40 #include "exec.h" 41 41 #include "tok.h" 42 #include "util.h" 42 43 43 44 static errno_t compl_init(wchar_t *text, size_t pos, size_t *cstart, void **state); … … 209 210 } 210 211 *cstart += rpath_sep + 1 - prefix; 211 free(prefix);212 prefix = NULL;213 212 214 213 cs->path_list = malloc(sizeof(char *) * 2); … … 217 216 goto error; 218 217 } 219 cs->path_list[0] = dirname; 218 219 if (!is_path(prefix) && cs->is_command) { 220 cs->path_list[0] = malloc(sizeof(char) * PATH_MAX); 221 int ret = snprintf(cs->path_list[0], PATH_MAX, "%s/%s", search_dir[0], dirname); 222 if (ret < 0 || ret >= PATH_MAX) { 223 retval = ENOMEM; 224 goto error; 225 } 226 } else { 227 cs->path_list[0] = dirname; 228 } 229 220 230 cs->path_list[1] = NULL; 221 231 /* -
uspace/app/bdsh/exec.c
rc56a3eb r1c481ee 72 72 { 73 73 /* The user has specified a full or relative path, just give it back. */ 74 if (-1 != try_access(cmd)) { 75 return str_dup(cmd); 74 if (is_path(cmd)) { 75 if (-1 != try_access(cmd)) { 76 return str_dup(cmd); 77 } 76 78 } 77 79 -
uspace/app/bdsh/util.c
rc56a3eb r1c481ee 74 74 return 0; 75 75 } 76 77 /* 78 * Returns true if the string is a relative or an absolute path 79 */ 80 bool is_path(const char *cmd) 81 { 82 83 bool ret = str_lcmp(cmd, "/", 1) == 0; 84 ret = ret || str_lcmp(cmd, "./", 2) == 0; 85 ret = ret || str_lcmp(cmd, "../", 3) == 0; 86 87 return ret; 88 } -
uspace/app/bdsh/util.h
rc56a3eb r1c481ee 31 31 32 32 #include "scli.h" 33 #include <stdbool.h> 33 34 34 35 /* Utility functions */ 35 36 extern unsigned int cli_count_args(char **); 36 37 extern unsigned int cli_set_prompt(cliuser_t *usr); 38 extern bool is_path(const char *cmd); 37 39 38 40 #endif
Note:
See TracChangeset
for help on using the changeset viewer.