Changeset b7fd2a0 in mainline for uspace/app/bdsh
- Timestamp:
- 2018-01-13T03:10:29Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a53ed3a
- Parents:
- 36f0738
- Location:
- uspace/app/bdsh
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/builtins/batch/batch.c
r36f0738 rb7fd2a0 85 85 } 86 86 87 int rc = EOK;87 errno_t rc = EOK; 88 88 FILE *batch = fopen(argv[1], "r"); 89 89 if (batch == NULL) { -
uspace/app/bdsh/cmds/builtins/cd/cd.c
r36f0738 rb7fd2a0 51 51 static bool previous_directory_set = false; 52 52 53 static int chdir_and_remember(const char *new_dir)53 static errno_t chdir_and_remember(const char *new_dir) 54 54 { 55 55 56 int rc = vfs_cwd_get(previous_directory_tmp, PATH_MAX);56 errno_t rc = vfs_cwd_get(previous_directory_tmp, PATH_MAX); 57 57 previous_directory_valid = (rc == EOK); 58 58 previous_directory_set = true; … … 86 86 { 87 87 int argc; 88 int rc = EOK;88 errno_t rc = EOK; 89 89 90 90 argc = cli_count_args(argv); -
uspace/app/bdsh/cmds/modules/cat/cat.c
r36f0738 rb7fd2a0 187 187 off64_t file_size = 0, length = 0; 188 188 aoff64_t pos = 0; 189 int rc;189 errno_t rc; 190 190 191 191 bool reading_stdin = dash_represents_stdin && (str_cmp(fname, "-") == 0); … … 196 196 blen = STR_BOUNDS(1); 197 197 } else { 198 int rc = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ, &fd);198 errno_t rc = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ, &fd); 199 199 if (rc != EOK) { 200 200 fd = -1; … … 316 316 bool tailFirst = false; 317 317 sysarg_t rows, cols; 318 int rc;318 errno_t rc; 319 319 320 320 /* -
uspace/app/bdsh/cmds/modules/cmp/cmp.c
r36f0738 rb7fd2a0 70 70 } 71 71 72 static int cmp_files(const char *fn0, const char *fn1)72 static errno_t cmp_files(const char *fn0, const char *fn1) 73 73 { 74 int rc = EOK;74 errno_t rc = EOK; 75 75 const char *fn[2] = {fn0, fn1}; 76 76 int fd[2] = {-1, -1}; … … 117 117 int cmd_cmp(char **argv) 118 118 { 119 int rc;119 errno_t rc; 120 120 unsigned int argc; 121 121 int c, opt_ind; -
uspace/app/bdsh/cmds/modules/cp/cp.c
r36f0738 rb7fd2a0 82 82 struct stat s; 83 83 84 int r = vfs_stat_path(path, &s);84 errno_t r = vfs_stat_path(path, &s); 85 85 86 86 if (r != EOK) … … 176 176 } 177 177 178 static int do_copy(const char *src, const char *dest,178 static errno_t do_copy(const char *src, const char *dest, 179 179 size_t blen, int vb, int recursive, int force, int interactive) 180 180 { 181 int rc = EOK;181 errno_t rc = EOK; 182 182 char dest_path[PATH_MAX]; 183 183 char src_path[PATH_MAX]; … … 388 388 int fd1, fd2; 389 389 size_t rbytes, wbytes; 390 int rc;390 errno_t rc; 391 391 off64_t total; 392 392 char *buff = NULL; … … 479 479 int force = 0, interactive = 0; 480 480 int c, opt_ind; 481 int ret;481 errno_t ret; 482 482 483 483 con = console_init(stdin, stdout); -
uspace/app/bdsh/cmds/modules/ls/ls.c
r36f0738 rb7fd2a0 135 135 int i; 136 136 int nbdirs = 0; 137 int rc;137 errno_t rc; 138 138 int len; 139 139 char *buff; -
uspace/app/bdsh/cmds/modules/mkdir/mkdir.c
r36f0738 rb7fd2a0 94 94 95 95 int ret = 0; 96 int rc;96 errno_t rc; 97 97 98 98 if (!create_parents) { -
uspace/app/bdsh/cmds/modules/mkfile/mkfile.c
r36f0738 rb7fd2a0 89 89 * @return EOK on success or an error code 90 90 */ 91 static int read_size(const char *str, size_t *rsize)91 static errno_t read_size(const char *str, size_t *rsize) 92 92 { 93 93 size_t number, unit; … … 123 123 size_t to_write; 124 124 size_t nwritten; 125 int rc;125 errno_t rc; 126 126 char *file_name; 127 127 void *buffer; -
uspace/app/bdsh/cmds/modules/mount/mount.c
r36f0738 rb7fd2a0 78 78 mtab_ent_t *old_ent = NULL; 79 79 char *svc_name; 80 int rc;80 errno_t rc; 81 81 82 82 vfs_get_mtab_list(&mtab_list); … … 109 109 static void print_fstypes(void) 110 110 { 111 int rc;111 errno_t rc; 112 112 vfs_fstypes_t fstypes; 113 113 char **p; … … 132 132 const char *mopts = ""; 133 133 const char *dev = ""; 134 int rc;134 errno_t rc; 135 135 int c, opt_ind; 136 136 unsigned int instance = 0; -
uspace/app/bdsh/cmds/modules/mv/mv.c
r36f0738 rb7fd2a0 52 52 { 53 53 unsigned int argc; 54 int rc;54 errno_t rc; 55 55 56 56 argc = cli_count_args(argv); -
uspace/app/bdsh/cmds/modules/rm/rm.c
r36f0738 rb7fd2a0 195 195 static unsigned int rm_recursive(const char *path) 196 196 { 197 int rc;197 errno_t rc; 198 198 unsigned int ret = 0; 199 199 -
uspace/app/bdsh/cmds/modules/sleep/sleep.c
r36f0738 rb7fd2a0 62 62 * @return EOK if conversion was successful. 63 63 */ 64 static int decimal_to_useconds(const char *nptr, useconds_t *result)64 static errno_t decimal_to_useconds(const char *nptr, useconds_t *result) 65 65 { 66 int ret;66 errno_t ret; 67 67 uint64_t whole_seconds; 68 68 uint64_t frac_seconds; … … 112 112 int cmd_sleep(char **argv) 113 113 { 114 int ret;114 errno_t ret; 115 115 unsigned int argc; 116 116 useconds_t duration = 0; -
uspace/app/bdsh/cmds/modules/touch/touch.c
r36f0738 rb7fd2a0 123 123 if ((!no_create) || 124 124 ((no_create) && (vfs_stat_path(buff, &file_stat) == EOK))) { 125 int rc = vfs_lookup(buff, WALK_REGULAR | WALK_MAY_CREATE, &fd);125 errno_t rc = vfs_lookup(buff, WALK_REGULAR | WALK_MAY_CREATE, &fd); 126 126 if (rc != EOK) { 127 127 fd = -1; -
uspace/app/bdsh/cmds/modules/unmount/unmount.c
r36f0738 rb7fd2a0 57 57 { 58 58 unsigned int argc; 59 int rc;59 errno_t rc; 60 60 61 61 argc = cli_count_args(argv); -
uspace/app/bdsh/compl.c
r36f0738 rb7fd2a0 40 40 #include "tok.h" 41 41 42 static int compl_init(wchar_t *text, size_t pos, size_t *cstart, void **state);43 static int compl_get_next(void *state, char **compl);42 static errno_t compl_init(wchar_t *text, size_t pos, size_t *cstart, void **state); 43 static errno_t compl_get_next(void *state, char **compl); 44 44 static void compl_fini(void *state); 45 45 … … 87 87 * Set up iterators in completion object, based on current token. 88 88 */ 89 static int compl_init(wchar_t *text, size_t pos, size_t *cstart, void **state)89 static errno_t compl_init(wchar_t *text, size_t pos, size_t *cstart, void **state) 90 90 { 91 91 compl_t *cs = NULL; … … 93 93 char *prefix = NULL; 94 94 char *dirname = NULL; 95 int retval;95 errno_t retval; 96 96 97 97 token_t *tokens = calloc(WORD_MAX, sizeof(token_t)); … … 288 288 289 289 /** Get next match. */ 290 static int compl_get_next(void *state, char **compl)290 static errno_t compl_get_next(void *state, char **compl) 291 291 { 292 292 compl_t *cs = (compl_t *) state; -
uspace/app/bdsh/exec.c
r36f0738 rb7fd2a0 58 58 int fd; 59 59 60 int rc = vfs_lookup_open(f, WALK_REGULAR, MODE_READ, &fd);60 errno_t rc = vfs_lookup_open(f, WALK_REGULAR, MODE_READ, &fd); 61 61 if (rc == EOK) { 62 62 vfs_put(fd); … … 98 98 task_exit_t texit; 99 99 char *tmp; 100 int rc;100 errno_t rc; 101 101 int retval, i; 102 102 int file_handles[3] = { -1, -1, -1 }; -
uspace/app/bdsh/input.c
r36f0738 rb7fd2a0 65 65 * invokes the built-in entry point (a[0]) passing all arguments in a[] to 66 66 * the handler */ 67 int process_input(cliuser_t *usr)67 errno_t process_input(cliuser_t *usr) 68 68 { 69 69 token_t *tokens_buf = calloc(WORD_MAX, sizeof(token_t)); … … 73 73 74 74 char *cmd[WORD_MAX]; 75 int rc = EOK;75 errno_t rc = EOK; 76 76 tokenizer_t tok; 77 77 unsigned int i, pipe_count, processed_pipes; … … 259 259 { 260 260 char *str; 261 int rc;261 errno_t rc; 262 262 263 263 tinput_set_prompt(tinput, usr->prompt); -
uspace/app/bdsh/input.h
r36f0738 rb7fd2a0 35 35 36 36 extern void get_input(cliuser_t *); 37 extern int process_input(cliuser_t *);37 extern errno_t process_input(cliuser_t *); 38 38 extern int input_init(void); 39 39 -
uspace/app/bdsh/scli.c
r36f0738 rb7fd2a0 98 98 int main(int argc, char *argv[]) 99 99 { 100 int ret = 0;100 errno_t ret = 0; 101 101 102 102 stdiostate.stdin = stdin; -
uspace/app/bdsh/scli.h
r36f0738 rb7fd2a0 39 39 char *cwd; 40 40 char *prompt; 41 int lasterr;41 errno_t lasterr; 42 42 } cliuser_t; 43 43 -
uspace/app/bdsh/test/toktest.c
r36f0738 rb7fd2a0 46 46 str_cpy(input_buffer, MAX_INPUT, input); 47 47 48 int rc = tok_init(&tokenizer, input_buffer, tokens, MAX_TOKENS);48 errno_t rc = tok_init(&tokenizer, input_buffer, tokens, MAX_TOKENS); 49 49 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 50 50 -
uspace/app/bdsh/tok.c
r36f0738 rb7fd2a0 38 38 static wchar_t tok_get_char(tokenizer_t *); 39 39 static wchar_t tok_look_char(tokenizer_t *); 40 static int tok_push_char(tokenizer_t *, wchar_t);41 static int tok_push_token(tokenizer_t *);40 static errno_t tok_push_char(tokenizer_t *, wchar_t); 41 static errno_t tok_push_token(tokenizer_t *); 42 42 static bool tok_pending_chars(tokenizer_t *); 43 static int tok_finish_string(tokenizer_t *);43 static errno_t tok_finish_string(tokenizer_t *); 44 44 static void tok_start_token(tokenizer_t *, token_type_t); 45 45 … … 51 51 * @param max_tokens number of elements of the out_tokens array 52 52 */ 53 int tok_init(tokenizer_t *tok, char *input, token_t *out_tokens,53 errno_t tok_init(tokenizer_t *tok, char *input, token_t *out_tokens, 54 54 size_t max_tokens) 55 55 { … … 89 89 90 90 /** Tokenize the input string into the tokens */ 91 int tok_tokenize(tokenizer_t *tok, size_t *tokens_length)92 { 93 int rc;91 errno_t tok_tokenize(tokenizer_t *tok, size_t *tokens_length) 92 { 93 errno_t rc; 94 94 wchar_t next_char; 95 95 … … 178 178 179 179 /** Finish tokenizing an opened string */ 180 int tok_finish_string(tokenizer_t *tok)181 { 182 int rc;180 errno_t tok_finish_string(tokenizer_t *tok) 181 { 182 errno_t rc; 183 183 wchar_t next_char; 184 184 … … 233 233 234 234 /** Append a char to the end of the current token */ 235 int tok_push_char(tokenizer_t *tok, wchar_t ch)235 errno_t tok_push_char(tokenizer_t *tok, wchar_t ch) 236 236 { 237 237 return chr_encode(ch, tok->outbuf, &tok->outbuf_offset, tok->outbuf_size); … … 244 244 245 245 /** Push the current token to the output array */ 246 int tok_push_token(tokenizer_t *tok)246 errno_t tok_push_token(tokenizer_t *tok) 247 247 { 248 248 if (tok->outtok_offset >= tok->outtok_size) { -
uspace/app/bdsh/tok.h
r36f0738 rb7fd2a0 63 63 } tokenizer_t; 64 64 65 extern int tok_init(tokenizer_t *, char *, token_t *, size_t);65 extern errno_t tok_init(tokenizer_t *, char *, token_t *, size_t); 66 66 extern void tok_fini(tokenizer_t *); 67 extern int tok_tokenize(tokenizer_t *, size_t *);67 extern errno_t tok_tokenize(tokenizer_t *, size_t *); 68 68 69 69 #endif
Note:
See TracChangeset
for help on using the changeset viewer.