-/* Displays input prompt on command line and takes input data from user */
-
-char *silc_client_get_input(const char *prompt)
-{
- char input[2048];
- int fd;
-
- fd = open("/dev/tty", O_RDONLY);
- if (fd < 0) {
- fprintf(stderr, "silc: %s\n", strerror(errno));
- return NULL;
- }
-
- memset(input, 0, sizeof(input));
-
- printf("%s", prompt);
- fflush(stdout);
-
- if ((read(fd, input, sizeof(input))) < 0) {
- fprintf(stderr, "silc: %s\n", strerror(errno));
- return NULL;
- }
-
- if (strlen(input) <= 1)
- return NULL;
-
- if (strchr(input, '\n'))
- *strchr(input, '\n') = '\0';
-
- return strdup(input);
-}
-