summaryrefslogtreecommitdiffstats
path: root/libopkg/user.c
diff options
context:
space:
mode:
Diffstat (limited to 'libopkg/user.c')
-rw-r--r--libopkg/user.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libopkg/user.c b/libopkg/user.c
index 8c960dc..dda5013 100644
--- a/libopkg/user.c
+++ b/libopkg/user.c
@@ -15,13 +15,11 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
*/
-#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
-#include <string.h>
+#include <unistd.h>
#include "file_util.h"
#include "str_util.h"
-#include "user.h"
char *get_user_response(const char *format, ...)
{
@@ -32,6 +30,9 @@ char *get_user_response(const char *format, ...)
vprintf(format, ap);
va_end(ap);
+ if (isatty(fileno(stdin)))
+ return NULL;
+
response = (char *)file_read_line_alloc(stdin);
if (response == NULL)
return NULL;