Changes in uspace/app/sbi/src/os/helenos.c [051bc69a:38aaacc2] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sbi/src/os/helenos.c
r051bc69a r38aaacc2 29 29 /** @file HelenOS-specific code. */ 30 30 31 #include <assert.h>32 31 #include <errno.h> 33 32 #include <stdio.h> … … 36 35 #include <task.h> 37 36 #include <tinput.h> 38 #include <str_error.h>39 37 40 38 #include "os.h" … … 74 72 75 73 return str; 76 }77 78 /** Return slice (substring) of a string.79 *80 * Copies the specified range of characters from @a str and returns it81 * as a newly allocated string. @a start + @a length must be less than82 * or equal to the length of @a str.83 *84 * @param str String85 * @param start Index of first character (starting from zero).86 * @param length Number of characters to copy.87 *88 * @return Newly allocated string holding the slice.89 */90 char *os_str_aslice(const char *str, size_t start, size_t length)91 {92 char *slice;93 size_t offset;94 size_t i;95 size_t size;96 wchar_t c;97 98 assert(start + length <= str_length(str));99 100 offset = 0;101 for (i = 0; i < start; ++i) {102 c = str_decode(str, &offset, STR_NO_LIMIT);103 assert(c != '\0');104 assert(c != U_SPECIAL);105 (void) c;106 }107 108 size = str_lsize(str, length);109 slice = str_ndup(str + offset, size);110 111 return slice;112 74 } 113 75 … … 224 186 int retval; 225 187 226 tid = task_spawn(cmd[0], (char const * const *) cmd , &retval);188 tid = task_spawn(cmd[0], (char const * const *) cmd); 227 189 if (tid == 0) { 228 printf("Error: Failed spawning '%s' (%s).\n", cmd[0], 229 str_error(retval)); 190 printf("Error: Failed spawning '%s'.\n", cmd[0]); 230 191 exit(1); 231 192 }
Note:
See TracChangeset
for help on using the changeset viewer.