diff options
author | graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2009-11-03 01:19:56 (EST) |
---|---|---|
committer | graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2009-11-03 01:19:56 (EST) |
commit | a03d7bafd2ada5d8d8d67388a450362d7e427258 (patch) | |
tree | 7a265c0aefdc8c6e8fd63ebb8304529ab29613f0 /libopkg | |
parent | fe5e98ee4104f8d192a0107e0e7bb3fddd582dbe (diff) |
Remove response_callback bits. Forgot to commit this before.
git-svn-id: http://opkg.googlecode.com/svn/trunk@249 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg')
-rw-r--r-- | libopkg/user.c | 39 | ||||
-rw-r--r-- | libopkg/user.h | 1 |
2 files changed, 15 insertions, 25 deletions
diff --git a/libopkg/user.c b/libopkg/user.c index 04dfd9e..8c960dc 100644 --- a/libopkg/user.c +++ b/libopkg/user.c @@ -23,30 +23,21 @@ #include "str_util.h" #include "user.h" -static char *question = NULL; -static int question_len = 255; - -opkg_response_callback opkg_cb_response = NULL; - char *get_user_response(const char *format, ...) { - int len = question_len; - va_list ap; - char *response; - - do { - if (question == NULL || len > question_len) { - question = realloc(question, len + 1); - question_len = len; - } - - va_start(ap, format); - len = vsnprintf(question,question_len,format,ap); - va_end(ap); - } while (len > question_len); - response = strdup(opkg_cb_response(question)); - str_chomp(response); - str_tolower(response); - - return response; + va_list ap; + char *response; + + va_start(ap, format); + vprintf(format, ap); + va_end(ap); + + response = (char *)file_read_line_alloc(stdin); + if (response == NULL) + return NULL; + + str_chomp(response); + str_tolower(response); + + return response; } diff --git a/libopkg/user.h b/libopkg/user.h index 8d2a0cf..81d7262 100644 --- a/libopkg/user.h +++ b/libopkg/user.h @@ -19,6 +19,5 @@ #include <stdio.h> #include <stdarg.h> -typedef char* (*opkg_response_callback)(char *question); char *get_user_response(const char *format, ...); |