new upstream release (3.3.0); modify package compatibility for Stretch
[ossec-hids.git] / src / addagent / read_from_user.c
1 /* Copyright (C) 2009 Trend Micro Inc.
2  * All rights reserved.
3  *
4  * This program is a free software; you can redistribute it
5  * and/or modify it under the terms of the GNU General Public
6  * License (version 2) as published by the FSF - Free Software
7  * Foundation
8  */
9
10 #include "manage_agents.h"
11
12 /* Global variables */
13 static char __user_buffer[USER_SIZE + 1];
14 static char *__user_buffer_pt;
15
16
17 char *read_from_user()
18 {
19     memset(__user_buffer, '\0', USER_SIZE + 1);
20
21     if ((fgets(__user_buffer, USER_SIZE - 1, stdin) == NULL) ||
22             (strlen(__user_buffer) >= (USER_SIZE - 2))) {
23         printf(INPUT_LARGE);
24         exit(1);
25     }
26
27     __user_buffer_pt = chomp(__user_buffer);
28
29     return (__user_buffer_pt);
30 }
31