Rev 4255 | Rev 4266 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4255 | Rev 4264 | ||
---|---|---|---|
Line 144... | Line 144... | ||
144 | * Implement something like editline() / readline(), if even |
144 | * Implement something like editline() / readline(), if even |
145 | * just for command history and making arrows work. */ |
145 | * just for command history and making arrows work. */ |
146 | void get_input(cliuser_t *usr) |
146 | void get_input(cliuser_t *usr) |
147 | { |
147 | { |
148 | char line[INPUT_MAX]; |
148 | char line[INPUT_MAX]; |
149 | size_t len = 0; |
- | |
150 | 149 | ||
151 | console_set_style(STYLE_EMPHASIS); |
150 | console_set_style(STYLE_EMPHASIS); |
152 | printf("%s", usr->prompt); |
151 | printf("%s", usr->prompt); |
153 | console_set_style(STYLE_NORMAL); |
152 | console_set_style(STYLE_NORMAL); |
154 | 153 | ||
155 | read_line(line, INPUT_MAX); |
154 | read_line(line, INPUT_MAX); |
156 | len = strlen(line); |
- | |
157 | /* Make sure we don't have rubbish or a C/R happy user */ |
155 | /* Make sure we don't have rubbish or a C/R happy user */ |
158 | if (len == 0 || line[0] == '\n') |
156 | if (str_cmp(line, "") == 0 || str_cmp(line, "\n") == 0) |
159 | return; |
157 | return; |
160 | usr->line = strdup(line); |
158 | usr->line = strdup(line); |
161 | 159 | ||
162 | return; |
160 | return; |
163 | } |
161 | } |