Linux bluetooth development
 help / color / mirror / Atom feed
From: Inga Stotland <inga.stotland@intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: brian.gix@intel.com, luiz.dentz@gmail.com,
	Inga Stotland <inga.stotland@intel.com>
Subject: [PATCH BlueZ 2/2] shared/shell: Add "clear-history" API
Date: Tue,  6 Aug 2019 23:47:47 -0700	[thread overview]
Message-ID: <20190807064747.6725-3-inga.stotland@intel.com> (raw)
In-Reply-To: <20190807064747.6725-1-inga.stotland@intel.com>

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


      parent reply	other threads:[~2019-08-07  6:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-07  6:47 [PATCH BlueZ 0/2] ELL-based bt_shell implementation Inga Stotland
2019-08-07  6:47 ` [PATCH BlueZ 1/2] shared/shell: Add ell based shell implementation Inga Stotland
2019-08-07 11:18   ` Luiz Augusto von Dentz
2019-08-07 19:27     ` Stotland, Inga
2019-08-07  6:47 ` Inga Stotland [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190807064747.6725-3-inga.stotland@intel.com \
    --to=inga.stotland@intel.com \
    --cc=brian.gix@intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox