summaryrefslogtreecommitdiff
path: root/payloads/libpayload/libc
diff options
context:
space:
mode:
authorJordan Crouse <jordan.crouse@amd.com>2008-08-28 23:11:29 +0000
committerJordan Crouse <jordan.crouse@amd.com>2008-08-28 23:11:29 +0000
commit617120c8284c2abd054600207bd858a04d19b34d (patch)
tree87f4b86f3641aca0b5703a35fd9fe32b39cfa5e5 /payloads/libpayload/libc
parente2ad80628581273558b59ea70d8e155ba567f76b (diff)
downloadcoreboot-617120c8284c2abd054600207bd858a04d19b34d.tar.xz
[PATCH]: libpayload: Document readline
No code changes. Signed-off-by: Jordan Crouse <jordan.crouse@amd.com> Acked-by: Jordan Crouse <jordan.crouse@amd.com> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3550 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'payloads/libpayload/libc')
-rw-r--r--payloads/libpayload/libc/readline.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/payloads/libpayload/libc/readline.c b/payloads/libpayload/libc/readline.c
index 9c6a6a651d..4faf3d7895 100644
--- a/payloads/libpayload/libc/readline.c
+++ b/payloads/libpayload/libc/readline.c
@@ -27,16 +27,26 @@
* SUCH DAMAGE.
*/
+/** @file libc/readline.c
+ * @brief Simple readline implementation
+ */
+
#include <libpayload.h>
static char * readline_buffer;
static int readline_bufferlen;
/**
- * This readline implementation is rather simple, but it does more than the
- * original readline() because it allows us to have a pre-filled buffer. To
- * pre-fill the buffer, use the getline() function.
+ * @brief Read a line from the terminal and return it
+ * @param prompt A prompt to display on the line
+ * @return A pointer to the input string
+ *
+ * Read a line from the terminal and return it. This readline implementation
+ * is rather simple, but it does more than the original readline() because
+ * it allows us to have a pre-filled buffer. To pre-fill the buffer, use the
+ * getline() function.
*/
+
char * readline(const char * prompt)
{
char *buffer;
@@ -50,7 +60,7 @@ char * readline(const char * prompt)
}
buffer = readline_buffer;
-
+
/* print prompt */
if (prompt) {
current = 0;
@@ -140,6 +150,18 @@ out:
return buffer;
}
+/**
+ * @brief Read a line from the input and store it in a buffer
+ * @param prompt A buffer to store the line in
+ * @param len Length of the buffer
+ * @return The final length of the string
+ * This function allows the user to pass a predefined buffer to
+ * readline(). The buffer may be filled with a default value
+ * which will be displayed by readline and can be edited as normal.
+ * The final input string returned by readline will be returned in
+ * the buffer and the function will return the length of the string.
+ */
+
int getline(char *buffer, int len)
{
readline_buffer = buffer;