32,10 → 32,7 |
#include <stdio.h> |
#include <stdlib.h> |
#include <string.h> |
|
#ifdef HELENOS |
#include <io/stream.h> |
#endif |
|
#include "config.h" |
#include "util.h" |
121,7 → 118,6 |
return rc; |
} |
|
#ifdef HELENOS |
/* Borrowed from Jiri Svoboda's 'cli' uspace app */ |
void read_line(char *buffer, int n) |
{ |
148,9 → 144,7 |
putchar('\n'); |
buffer[chars] = '\0'; |
} |
#endif |
|
/* This is soupy, fix me */ |
void get_input(cliuser_t *usr) |
{ |
char line[INPUT_MAX]; |
157,11 → 151,7 |
size_t len = 0; |
|
printf("%s", usr->prompt); |
#ifdef HELENOS |
read_line(line, INPUT_MAX); |
#else |
fgets(line, INPUT_MAX, stdin); |
#endif |
len = strlen(line); |
/* Make sure we don't have rubbish or a C/R happy user */ |
if (len == 0 || line[0] == '\n') |
168,12 → 158,8 |
return; |
if (len == 1 && line[len-1] == '\n') |
return; |
#ifndef HELENOS |
/* Null terminate line */ |
if (len > 0 && line[len-1] == '\n') |
line[len-1] = '\0'; |
#endif |
usr->line = cli_strdup(line); |
|
return; |
} |
|