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


Ignore:
Timestamp:
2010-03-13T12:04:37Z (16 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7715994
Parents:
94d484a
Message:

Update SBI to rev. 100.

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

Legend:

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

    r94d484a rd0febca  
    7575}
    7676
     77/** Get character from string at the given index. */
     78int os_str_get_char(const char *str, int index, int *out_char)
     79{
     80        size_t offset;
     81        int i;
     82        wchar_t c;
     83
     84        if (index < 0)
     85                return EINVAL;
     86
     87        offset = 0;
     88        for (i = 0; i <= index; ++i) {
     89                c = str_decode(str, &offset, STR_NO_LIMIT);
     90                if (c == '\0')
     91                        return EINVAL;
     92                if (c == U_SPECIAL)
     93                        return EIO;
     94        }
     95
     96        *out_char = (int) c;
     97        return EOK;
     98}
     99
    77100/** Simple command execution. */
    78101int os_exec(char *const cmd[])
  • uspace/app/sbi/src/os/os.h

    r94d484a rd0febca  
    3333int os_str_cmp(const char *a, const char *b);
    3434char *os_str_dup(const char *str);
     35int os_str_get_char(const char *str, int index, int *out_char);
    3536int os_exec(char *const cmd[]);
    3637
  • uspace/app/sbi/src/os/posix.c

    r94d484a rd0febca  
    7979}
    8080
     81/** Get character from string at the given index. */
     82int os_str_get_char(const char *str, int index, int *out_char)
     83{
     84        size_t len;
     85
     86        len = strlen(str);
     87        if (index < 0 || (size_t) index >= len)
     88                return EINVAL;
     89
     90        *out_char = str[index];
     91        return EOK;
     92}
     93
    8194/** Simple command execution. */
    8295int os_exec(char *const cmd[])
Note: See TracChangeset for help on using the changeset viewer.