Changeset 1ebc1a62 in mainline for uspace/app/sbi/src/os
- Timestamp:
- 2010-03-29T20:30:29Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a95310e
- Parents:
- 5da468e
- Location:
- uspace/app/sbi/src/os
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sbi/src/os/helenos.c
r5da468e r1ebc1a62 34 34 #include <str.h> 35 35 #include <task.h> 36 #include <tinput.h> 36 37 37 38 #include "os.h" … … 40 41 * Using HelenOS-specific string API. 41 42 */ 43 44 static tinput_t *tinput = NULL; 42 45 43 46 /** Concatenate two strings. */ … … 98 101 } 99 102 103 /** Read one line of input from the user. */ 104 int os_input_line(char **ptr) 105 { 106 char *line; 107 108 if (tinput == NULL) { 109 tinput = tinput_new(); 110 if (tinput == NULL) 111 return EIO; 112 } 113 114 line = tinput_read(tinput); 115 if (line == NULL) 116 return EIO; 117 118 /* XXX Input module needs trailing newline to keep going. */ 119 *ptr = os_str_acat(line, "\n"); 120 free(line); 121 122 return EOK; 123 } 124 100 125 /** Simple command execution. */ 101 126 int os_exec(char *const cmd[]) -
uspace/app/sbi/src/os/os.h
r5da468e r1ebc1a62 34 34 char *os_str_dup(const char *str); 35 35 int os_str_get_char(const char *str, int index, int *out_char); 36 int os_input_line(char **ptr); 36 37 int os_exec(char *const cmd[]); 37 38 -
uspace/app/sbi/src/os/posix.c
r5da468e r1ebc1a62 92 92 } 93 93 94 #define OS_INPUT_BUFFER_SIZE 256 95 static char os_input_buffer[OS_INPUT_BUFFER_SIZE]; 96 97 /** Read one line of input from the user. */ 98 int os_input_line(char **ptr) 99 { 100 if (fgets(os_input_buffer, OS_INPUT_BUFFER_SIZE, stdin) == NULL) 101 os_input_buffer[0] = '\0'; 102 103 if (ferror(stdin)) { 104 *ptr = NULL; 105 return EIO; 106 } 107 108 *ptr = strdup(os_input_buffer); 109 return EOK; 110 } 111 94 112 /** Simple command execution. */ 95 113 int os_exec(char *const cmd[])
Note:
See TracChangeset
for help on using the changeset viewer.
