summaryrefslogtreecommitdiff
path: root/payloads
diff options
context:
space:
mode:
Diffstat (limited to 'payloads')
-rw-r--r--payloads/libpayload/include/libpayload.h5
-rw-r--r--payloads/libpayload/libc/Makefile.inc1
-rw-r--r--payloads/libpayload/libc/lib.c12
3 files changed, 18 insertions, 0 deletions
diff --git a/payloads/libpayload/include/libpayload.h b/payloads/libpayload/include/libpayload.h
index 516bcc38ff..b7f7fe0276 100644
--- a/payloads/libpayload/include/libpayload.h
+++ b/payloads/libpayload/include/libpayload.h
@@ -298,5 +298,10 @@ void delay(unsigned int n);
/* i386/util.S */
#define abort() halt()
void halt(void) __attribute__ ((noreturn));
+void fatal(const char* msg) __attribute__ ((noreturn));
+
+/* libc/readline.c */
+char * readline(const char * prompt);
+int getline(char *buffer, int len)
#endif
diff --git a/payloads/libpayload/libc/Makefile.inc b/payloads/libpayload/libc/Makefile.inc
index bc82c9bc39..a4cd1bce6f 100644
--- a/payloads/libpayload/libc/Makefile.inc
+++ b/payloads/libpayload/libc/Makefile.inc
@@ -31,3 +31,4 @@
TARGETS-$(CONFIG_LIBC) += libc/malloc.o libc/printf.o libc/console.o libc/string.o
TARGETS-$(CONFIG_LIBC) += libc/memory.o libc/ctype.o libc/ipchecksum.o libc/lib.o
TARGETS-$(CONFIG_LIBC) += libc/rand.o libc/time.o libc/lar.o libc/exec.o
+TARGETS-$(CONFIG_LIBC) += libc/readline.o
diff --git a/payloads/libpayload/libc/lib.c b/payloads/libpayload/libc/lib.c
index e7eed68eb6..3f82acf378 100644
--- a/payloads/libpayload/libc/lib.c
+++ b/payloads/libpayload/libc/lib.c
@@ -101,3 +101,15 @@ u8 hex2bin(u8 h)
('A' <= h && h <= 'F') ? (h - 'A' + 10) : \
('a' <= h && h <= 'f') ? (h - 'a' + 10) : 0);
}
+
+/**
+ * Enters HALT state, after printing msg
+ *
+ * @param msg message to print
+ */
+void fatal(const char *msg)
+{
+ printf("%s",msg);
+ halt();
+}
+