~martin-decky/helenos/rcu

« back to all changes in this revision

Viewing changes to uspace/app/sbi/src/os/posix.c

  • Committer: Jiri Svoboda
  • Date: 2010-04-23 23:09:56 UTC
  • mfrom: (301.1.22 sysel)
  • Revision ID: jiri@wiwaxia-20100423230956-qlvja3q8qfwgnmnw
Merge from lp:~jsvoboda/helenos/sysel. New: generic classes, autoboxing, delegates.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
/*
47
47
 * The string functions are in fact standard C, but would not work under
48
48
 * HelenOS.
 
49
 * 
 
50
 * XXX String functions used here only work with 8-bit text encoding.
49
51
 */
50
52
 
51
 
/** Concatenate two strings. */
 
53
/** Concatenate two strings.
 
54
 *
 
55
 * @param a     First string
 
56
 * @param b     Second string
 
57
 * @return      New string, concatenation of @a a and @a b.
 
58
 */
52
59
char *os_str_acat(const char *a, const char *b)
53
60
{
54
61
        int a_len, b_len;
70
77
        return str;
71
78
}
72
79
 
73
 
/** Compare two strings. */
 
80
/** Compare two strings.
 
81
 *
 
82
 * @param a     First string
 
83
 * @param b     Second string
 
84
 * @return      Zero if equal, nonzero if not equal
 
85
 */
74
86
int os_str_cmp(const char *a, const char *b)
75
87
{
76
88
        return strcmp(a, b);
77
89
}
78
90
 
79
 
/** Return number of characters in string. */
 
91
/** Return number of characters in string.
 
92
 *
 
93
 * @param str   String
 
94
 * @return      Number of characters in @a str.
 
95
 */
80
96
size_t os_str_length(const char *str)
81
97
{
82
98
        return strlen(str);
83
99
}
84
100
 
85
 
/** Duplicate string. */
 
101
/** Duplicate string.
 
102
 *
 
103
 * @param str   String
 
104
 * @return      New string, duplicate of @a str.
 
105
 */
86
106
char *os_str_dup(const char *str)
87
107
{
88
108
        return strdup(str);
89
109
}
90
110
 
91
 
/** Get character from string at the given index. */
 
111
/** Get character from string at the given index.
 
112
 *
 
113
 * @param str           String
 
114
 * @param index         Character index (starting from zero).
 
115
 * @param out_char      Place to store character.
 
116
 * @return              EOK on success, EINVAL if index is out of bounds,
 
117
 *                      EIO on decoding error.
 
118
 */
92
119
int os_str_get_char(const char *str, int index, int *out_char)
93
120
{
94
121
        size_t len;
110
137
        printf("Send ^C (SIGINT) to quit.\n");
111
138
}
112
139
 
113
 
/** Read one line of input from the user. */
 
140
/** Read one line of input from the user.
 
141
 *
 
142
 * @param ptr   Place to store pointer to new string.
 
143
 */
114
144
int os_input_line(char **ptr)
115
145
{
116
146
        if (fgets(os_input_buffer, OS_INPUT_BUFFER_SIZE, stdin) == NULL)
125
155
        return EOK;
126
156
}
127
157
 
128
 
/** Simple command execution. */
 
158
/** Simple command execution.
 
159
 *
 
160
 * @param cmd   Command and arguments (NULL-terminated list of strings.)
 
161
 *              Command is present just one, not duplicated.
 
162
 */
129
163
int os_exec(char *const cmd[])
130
164
{
131
165
        pid_t pid;
156
190
        return EOK;
157
191
}
158
192
 
159
 
/** Store the executable file path via which we were executed. */
 
193
/** Store the executable file path via which we were executed.
 
194
 *
 
195
 * @param path  Executable path via which we were executed.
 
196
 */
160
197
void os_store_ef_path(char *path)
161
198
{
162
199
        ef_path = path;