summaryrefslogtreecommitdiffstats
path: root/eurephiadm/get_console_input.c
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2009-09-04 00:48:52 +0200
committerDavid Sommerseth <dazo@users.sourceforge.net>2009-09-04 00:48:52 +0200
commitda402ffcbe7e9a616bab83739b7294ce9f5e79c4 (patch)
tree8e85cd3f72a1cfa5b1600461b687917423eb2c9d /eurephiadm/get_console_input.c
parent2dcc5b5da4291e0cb4fb9fce6134dc836e92c344 (diff)
downloadeurephia-da402ffcbe7e9a616bab83739b7294ce9f5e79c4.tar.gz
eurephia-da402ffcbe7e9a616bab83739b7294ce9f5e79c4.tar.xz
eurephia-da402ffcbe7e9a616bab83739b7294ce9f5e79c4.zip
Added doxygen comments for the main eurephiadm parts
Diffstat (limited to 'eurephiadm/get_console_input.c')
-rw-r--r--eurephiadm/get_console_input.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/eurephiadm/get_console_input.c b/eurephiadm/get_console_input.c
index c64cefd..8914d7b 100644
--- a/eurephiadm/get_console_input.c
+++ b/eurephiadm/get_console_input.c
@@ -19,10 +19,31 @@
*
*/
+/**
+ * @file get_console_input.c
+ * @author David Sommerseth <dazo@users.sourceforge.net>
+ * @date 2008-11-29
+ *
+ * @brief Simple function to retrieve user input from the console
+ *
+ */
+
#include <stdio.h>
#include <termios.h>
#include <string.h>
+
+/**
+ * Prints a prompt to the screen and waits for user input via the tty.
+ *
+ * @param buf char* to the buffer where the user input is to be stored.
+ * @param len size of the input buffer
+ * @param prompt String printed before the user is asked for input
+ * @param hidden If set to 1, the user input will not be echoed to the tty,
+ * which is useful for passwords.
+ *
+ * @return Returns the number of bytes received from the user. On error -1 is returned
+ */
int get_console_input(char *buf, size_t len, const char *prompt, int hidden) {
struct termios term_orig, term_noecho;
char *ptr;
@@ -66,5 +87,3 @@ int get_console_input(char *buf, size_t len, const char *prompt, int hidden) {
return (buf != NULL ? strlen(buf) : -1);
}
-
-