Changeset c5cb943d in mainline for uspace/app/sbi/src/os


Ignore:
Timestamp:
2010-06-09T19:01:08Z (16 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1113c9e
Parents:
051bc69a
Message:

Update SBI to rev. 291.

Location:
uspace/app/sbi/src/os
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/sbi/src/os/helenos.c

    r051bc69a rc5cb943d  
    173173}
    174174
     175/** Convert character to new string.
     176 *
     177 * @param chr           Character
     178 * @return              Newly allocated string.
     179 */
     180char *os_chr_to_astr(wchar_t chr)
     181{
     182        char *str;
     183        size_t offset;
     184
     185        str = malloc(STR_BOUNDS(1) + 1);
     186        if (str == NULL) {
     187                printf("Memory allocation error.\n");
     188                exit(1);
     189        }
     190
     191        offset = 0;
     192        if (chr_encode(chr, str, &offset, STR_BOUNDS(1)) != EOK) {
     193                /* XXX Should handle gracefully */
     194                printf("String conversion error.\n");
     195                exit(1);
     196        }
     197
     198        str[offset] = '\0';
     199        return str;
     200}
     201
    175202/** Display survival help message. */
    176203void os_input_disp_help(void)
  • uspace/app/sbi/src/os/os.h

    r051bc69a rc5cb943d  
    3636size_t os_str_length(const char *str);
    3737int os_str_get_char(const char *str, int index, int *out_char);
     38char *os_chr_to_astr(wchar_t chr);
    3839void os_input_disp_help(void);
    3940int os_input_line(char **ptr);
  • uspace/app/sbi/src/os/posix.c

    r051bc69a rc5cb943d  
    159159}
    160160
     161/** Convert character to new string.
     162 *
     163 * @param chr           Character
     164 * @return              Newly allocated string.
     165 */
     166char *os_chr_to_astr(wchar_t chr)
     167{
     168        char *str;
     169
     170        str = malloc(2);
     171        if (str == NULL) {
     172                printf("Memory allocation error.\n");
     173                exit(1);
     174        }
     175
     176        str[0] = (char) chr;
     177        str[1] = '\0';
     178
     179        return str;
     180}
     181
    161182#define OS_INPUT_BUFFER_SIZE 256
    162183static char os_input_buffer[OS_INPUT_BUFFER_SIZE];
Note: See TracChangeset for help on using the changeset viewer.