From: Carlos Roberto do Nascimento Costa <crncosta@linux.vnet.ibm.com>
To: grub-devel@gnu.org
Cc: Manoel Rebelo Abranches <mrabran@linux.vnet.ibm.com>
Subject: [PATCH] add clear screen command
Date: Wed, 08 Apr 2009 16:04:19 -0300 [thread overview]
Message-ID: <49DCF533.6050809@linux.vnet.ibm.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 240 bytes --]
Hello,
This simple patch will add a new command to clear the terminal screen. Very
useful on the command-line.
Best Regards,
--
Carlos Roberto do Nascimento Costa
e-mail: crncosta@linux.vnet.ibm.com
IBM - Linux Technology Center Brasil
[-- Attachment #2: clear.patch --]
[-- Type: text/x-patch, Size: 2524 bytes --]
Index: conf/common.rmk
===================================================================
--- conf/common.rmk (revision 2070)
+++ conf/common.rmk (working copy)
@@ -332,7 +332,7 @@
# Commands.
pkglib_MODULES += minicmd.mod extcmd.mod hello.mod handler.mod \
- ls.mod cmp.mod cat.mod help.mod search.mod \
+ ls.mod cmp.mod cat.mod help.mod search.mod clear.mod \
loopback.mod fs_uuid.mod configfile.mod echo.mod \
terminfo.mod test.mod blocklist.mod hexdump.mod \
read.mod sleep.mod loadenv.mod crc.mod parttool.mod pcpart.mod
@@ -382,6 +382,11 @@
cat_mod_CFLAGS = $(COMMON_CFLAGS)
cat_mod_LDFLAGS = $(COMMON_LDFLAGS)
+# For clear.mod
+clear_mod_SOURCES = commands/clear.c
+clear_mod_CFLAGS = $(COMMON_CFLAGS)
+clear_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
# For echo.mod
echo_mod_SOURCES = commands/echo.c
echo_mod_CFLAGS = $(COMMON_CFLAGS)
Index: commands/clear.c
===================================================================
--- commands/clear.c (revision 0)
+++ commands/clear.c (revision 0)
@@ -0,0 +1,50 @@
+/* clear.c - command to clear the terminal screen. */
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2003,2007 Free Software Foundation, Inc.
+ * Copyright (C) 2003 NIIBE Yutaka <gniibe@m17n.org>
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/types.h>
+#include <grub/misc.h>
+#include <grub/err.h>
+#include <grub/dl.h>
+#include <grub/term.h>
+#include <grub/command.h>
+
+
+static grub_err_t
+grub_cmd_clear (struct grub_extcmd *cmd __attribute__ ((unused)),
+ int argc __attribute__ ((unused)),
+ char **args __attribute__ ((unused)))
+{
+ grub_cls ();
+ return 0;
+}
+
+static grub_command_t cmd;
+
+GRUB_MOD_INIT(clear)
+{
+ (void)mod; /* To stop warning. */
+ cmd = grub_register_command ("clear", grub_cmd_clear,
+ 0, "Clear the terminal screen.");
+}
+
+GRUB_MOD_FINI(clear)
+{
+ grub_unregister_extcmd (cmd);
+}
next reply other threads:[~2009-04-08 19:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-08 19:04 Carlos Roberto do Nascimento Costa [this message]
2009-04-08 19:21 ` [PATCH] add clear screen command Felix Zielcke
2009-04-08 19:32 ` phcoder
2009-04-08 22:51 ` Carlos Roberto do Nascimento Costa
2009-04-09 13:44 ` phcoder
2009-04-09 22:16 ` Manoel Rebelo Abranches
2009-04-08 22:34 ` Carlos Roberto do Nascimento Costa
2009-04-08 22:45 ` phcoder
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=49DCF533.6050809@linux.vnet.ibm.com \
--to=crncosta@linux.vnet.ibm.com \
--cc=grub-devel@gnu.org \
--cc=mrabran@linux.vnet.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.