Remove response_callback bits. Forgot to commit this before.
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Tue, 3 Nov 2009 06:19:56 +0000 (06:19 +0000)
committergraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Tue, 3 Nov 2009 06:19:56 +0000 (06:19 +0000)
git-svn-id: http://opkg.googlecode.com/svn/trunk@249 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

libopkg/user.c
libopkg/user.h

index 04dfd9e157a5251f3c1e4e462a6dafdf1e5ad649..8c960dc8bcdd5207694f5404b713bac2f5c9f7be 100644 (file)
 #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;
 }
index 8d2a0cfce20d9fb5b690ca16d2df7aeca32f90d9..81d72624126ec771e2b919974827096138801c62 100644 (file)
@@ -19,6 +19,5 @@
 #include <stdio.h>
 #include <stdarg.h>
 
-typedef char* (*opkg_response_callback)(char *question);
 char *get_user_response(const char *format, ...);