Changeset 1b20da0 in mainline for uspace/app/bdsh
- Timestamp:
- 2018-02-28T17:52:03Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3061bc1
- Parents:
- df6ded8
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:26:03)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:52:03)
- Location:
- uspace/app/bdsh
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/cp/cp.c
rdf6ded8 r1b20da0 231 231 /* e.g. cp file_name existing_file */ 232 232 233 /* dest already exists, 233 /* dest already exists, 234 234 * if force is set we will try to remove it. 235 235 * if interactive is set user input is required. … … 414 414 vfs_put(fd1); 415 415 vfs_put(fd2); 416 return -1; 416 return -1; 417 417 } 418 418 … … 486 486 for (c = 0, optreset = 1, optind = 0, opt_ind = 0; c != -1;) { 487 487 c = getopt_long(argc, argv, "hvVfirb:", long_options, &opt_ind); 488 switch (c) { 488 switch (c) { 489 489 case 'h': 490 490 help_cmd_cp(1); -
uspace/app/bdsh/cmds/modules/ls/ls.c
rdf6ded8 r1b20da0 129 129 * 0 otherwise. 130 130 */ 131 static signed int ls_scan_dir(const char *d, DIR *dirp, 131 static signed int ls_scan_dir(const char *d, DIR *dirp, 132 132 struct dir_elem_t **dir_list_ptr) 133 133 { … … 198 198 /* Populate the directory list. */ 199 199 if (ls.recursive) { 200 tmp = (struct dir_elem_t *) realloc(*dir_list_ptr, 200 tmp = (struct dir_elem_t *) realloc(*dir_list_ptr, 201 201 nbdirs * sizeof(struct dir_elem_t)); 202 202 if (!tmp) { 203 203 cli_error(CL_ENOMEM, "ls: failed to scan %s", d); 204 204 goto out; 205 } 205 } 206 206 *dir_list_ptr = tmp; 207 207 … … 253 253 } 254 254 255 nbdirs = ls_scan_dir(path, dirp, &dir_list); 255 nbdirs = ls_scan_dir(path, dirp, &dir_list); 256 256 if (nbdirs == -1) { 257 257 ret = CMD_FAILURE; … … 292 292 ret = CMD_FAILURE; 293 293 goto out; 294 } 294 } 295 295 } 296 296 297 ret = CMD_SUCCESS; 297 ret = CMD_SUCCESS; 298 298 299 299 out: … … 405 405 if (ls.recursive) 406 406 ret = ls_recursive(de.name, dirp); 407 else 407 else 408 408 ret = ls_scan_dir(de.name, dirp, NULL); 409 409 -
uspace/app/bdsh/cmds/modules/printf/printf.c
rdf6ded8 r1b20da0 60 60 61 61 /** Print a formatted data with lib printf. 62 * 62 * 63 63 * Currently available format flags are: 64 64 * '%d' - integer. 65 65 * '%u' - unsigned integer. 66 66 * '%s' - null-terminated string. 67 ***** 67 ***** 68 68 * @param ch formatted flag. 69 69 * @param arg string with data to print. … … 88 88 89 89 /** Process a control character. 90 * 90 * 91 91 * Currently available characters are: 92 92 * '\n' - new line. 93 ***** 93 ***** 94 94 * @param ch Control character. 95 95 */ … … 107 107 108 108 109 /** Prints formatted data. 109 /** Prints formatted data. 110 110 * 111 111 * Accepted format flags: … … 143 143 144 144 case '\\': 145 if (esc_flag) 145 if (esc_flag) 146 146 goto emit; 147 147 esc_flag = true; … … 149 149 150 150 case '%': 151 if (esc_flag) 151 if (esc_flag) 152 152 goto emit; 153 153 ch = str_decode(fmt, &pos, fmt_sz); 154 if (!ch) { 154 if (!ch) { 155 155 putchar('%'); 156 156 break; … … 170 170 break; 171 171 } 172 putchar(ch); 172 putchar(ch); 173 173 break; 174 174 … … 177 177 esc_flag = false; 178 178 } 179 } 179 } 180 180 181 181 return CMD_SUCCESS; -
uspace/app/bdsh/cmds/modules/sleep/sleep.c
rdf6ded8 r1b20da0 92 92 93 93 int ndigits = endptr - nptr; 94 for (; ndigits < 6; ndigits++) 94 for (; ndigits < 6; ndigits++) 95 95 frac_seconds *= 10; 96 96 for (; ndigits > 6; ndigits--) -
uspace/app/bdsh/input.c
rdf6ded8 r1b20da0 107 107 /* Until full support for pipes is implemented, allow for a simple case: 108 108 * [from <file> |] command [| to <file>] 109 * 109 * 110 110 * First find the pipes and check that there are no more 111 111 */ -
uspace/app/bdsh/tok.c
rdf6ded8 r1b20da0 45 45 46 46 /** Initialize the token parser 47 * 47 * 48 48 * @param tok the tokenizer structure to initialize 49 49 * @param input the input string to tokenize … … 53 53 errno_t tok_init(tokenizer_t *tok, char *input, token_t *out_tokens, 54 54 size_t max_tokens) 55 { 55 { 56 56 tok->in = input; 57 57 tok->in_offset = 0;
Note:
See TracChangeset
for help on using the changeset viewer.