[PATCH BlueZ 2/2] shared/shell: Add "clear-history" API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thsi adds a new API function bt_shell_clear_history(). The
function can be used to clear up the command history, when
it gets too cluttered.
---
 src/shared/shell-ell.c | 5 +++++
 src/shared/shell.c     | 7 ++++++-
 src/shared/shell.h     | 1 +
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/shared/shell-ell.c b/src/shared/shell-ell.c
index 1b481e04e..1e3de521c 100644
--- a/src/shared/shell-ell.c
+++ b/src/shared/shell-ell.c
@@ -1318,3 +1318,8 @@ void *bt_shell_get_env(const char *name)
 
 	return env->value;
 }
+
+void bt_shell_clear_history(void)
+{
+	rl_clear_history();
+}
diff --git a/src/shared/shell.c b/src/shared/shell.c
index eac654f40..86f9b71df 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -2,7 +2,7 @@
  *
  *  BlueZ - Bluetooth protocol stack for Linux
  *
- *  Copyright (C) 2017  Intel Corporation. All rights reserved.
+ *  Copyright (C) 2017-2019  Intel Corporation. All rights reserved.
  *
  *
  *  This library is free software; you can redistribute it and/or
@@ -1328,3 +1328,8 @@ void *bt_shell_get_env(const char *name)
 
 	return env->value;
 }
+
+void bt_shell_clear_history(void)
+{
+	rl_clear_history();
+}
diff --git a/src/shared/shell.h b/src/shared/shell.h
index e14d58381..9ba4a20c8 100644
--- a/src/shared/shell.h
+++ b/src/shared/shell.h
@@ -94,4 +94,5 @@ bool bt_shell_detach(void);
 void bt_shell_set_env(const char *name, void *value);
 void *bt_shell_get_env(const char *name);
 
+void bt_shell_clear_history(void);
 void bt_shell_cleanup(void);
-- 
2.21.0




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux