* [PATCH] add clear screen command
@ 2009-04-08 19:04 Carlos Roberto do Nascimento Costa
2009-04-08 19:21 ` Felix Zielcke
0 siblings, 1 reply; 8+ messages in thread
From: Carlos Roberto do Nascimento Costa @ 2009-04-08 19:04 UTC (permalink / raw)
To: grub-devel; +Cc: Manoel Rebelo Abranches
[-- 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);
+}
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] add clear screen command 2009-04-08 19:04 [PATCH] add clear screen command Carlos Roberto do Nascimento Costa @ 2009-04-08 19:21 ` Felix Zielcke 2009-04-08 19:32 ` phcoder 2009-04-08 22:34 ` Carlos Roberto do Nascimento Costa 0 siblings, 2 replies; 8+ messages in thread From: Felix Zielcke @ 2009-04-08 19:21 UTC (permalink / raw) To: The development of GRUB 2 Am Mittwoch, den 08.04.2009, 16:04 -0300 schrieb Carlos Roberto do Nascimento Costa: > Hello, > > This simple patch will add a new command to clear the terminal screen. Very > useful on the command-line. > Hello, + * Copyright (C) 2003,2007 Free Software Foundation, Inc. + * Copyright (C) 2003 NIIBE Yutaka <gniibe@m17n.org> This should be just `Copyright (C) 2009 Free Software Foundation, Inc.', because it's a new file from this year. + (void)mod; /* To stop warning. */ + cmd = grub_register_command ("clear", grub_cmd_clear, + 0, "Clear the terminal screen."); I think there shouldn't be a `0' but `GRUB_COMMAND_FLAG_CMDLINE'. And please write a ChangeLog entry. -- Felix Zielcke ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] add clear screen command 2009-04-08 19:21 ` Felix Zielcke @ 2009-04-08 19:32 ` phcoder 2009-04-08 22:51 ` Carlos Roberto do Nascimento Costa 2009-04-08 22:34 ` Carlos Roberto do Nascimento Costa 1 sibling, 1 reply; 8+ messages in thread From: phcoder @ 2009-04-08 19:32 UTC (permalink / raw) To: The development of GRUB 2 Perhaps putting it into normal.mod instead of separate module is a good idea Felix Zielcke wrote: > Am Mittwoch, den 08.04.2009, 16:04 -0300 schrieb Carlos Roberto do > Nascimento Costa: >> Hello, >> >> This simple patch will add a new command to clear the terminal screen. Very >> useful on the command-line. >> > > Hello, > > + * Copyright (C) 2003,2007 Free Software Foundation, Inc. > + * Copyright (C) 2003 NIIBE Yutaka <gniibe@m17n.org> > > This should be just `Copyright (C) 2009 Free Software Foundation, Inc.', > because it's a new file from this year. > > + (void)mod; /* To stop warning. */ > + cmd = grub_register_command ("clear", grub_cmd_clear, > + 0, "Clear the terminal screen."); > > I think there shouldn't be a `0' but `GRUB_COMMAND_FLAG_CMDLINE'. > And please write a ChangeLog entry. > -- Regards Vladimir 'phcoder' Serbinenko ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] add clear screen command 2009-04-08 19:32 ` phcoder @ 2009-04-08 22:51 ` Carlos Roberto do Nascimento Costa 2009-04-09 13:44 ` phcoder 0 siblings, 1 reply; 8+ messages in thread From: Carlos Roberto do Nascimento Costa @ 2009-04-08 22:51 UTC (permalink / raw) To: The development of GRUB 2 Hello phcoder. thank you for reviewing this patch. phcoder wrote: > Perhaps putting it into normal.mod instead of separate module is a good > idea When I did this patch, I was thinking: clear is a command like ls, lspci, reboot, sleep, suspend, halt, exit, etc... so, clear needs to be at commands/ dir and follows the same ideas behind other commands. Is there any reason to not follows this idea? Best regards, -- Carlos Roberto do Nascimento Costa E-mails: crncosta@linux.vnet.ibm.com IBM - Linux Technology Center Brasil ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] add clear screen command 2009-04-08 22:51 ` Carlos Roberto do Nascimento Costa @ 2009-04-09 13:44 ` phcoder 2009-04-09 22:16 ` Manoel Rebelo Abranches 0 siblings, 1 reply; 8+ messages in thread From: phcoder @ 2009-04-09 13:44 UTC (permalink / raw) To: The development of GRUB 2 Carlos Roberto do Nascimento Costa wrote: > Hello phcoder. thank you for reviewing this patch. You're welcome > > phcoder wrote: >> Perhaps putting it into normal.mod instead of separate module is a good >> idea > > When I did this patch, I was thinking: clear is a command like ls, lspci, > reboot, sleep, suspend, halt, exit, etc... so, clear needs to be at commands/ > dir and follows the same ideas behind other commands. > > Is there any reason to not follows this idea? > With your patch the created elf contains much more overhead then code. While it isn't really a problem it's still a thing about which some thinking is needed > Best regards, > -- Regards Vladimir 'phcoder' Serbinenko ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] add clear screen command 2009-04-09 13:44 ` phcoder @ 2009-04-09 22:16 ` Manoel Rebelo Abranches 0 siblings, 0 replies; 8+ messages in thread From: Manoel Rebelo Abranches @ 2009-04-09 22:16 UTC (permalink / raw) To: The development of GRUB 2 On Thu, 2009-04-09 at 15:44 +0200, phcoder wrote: > Carlos Roberto do Nascimento Costa wrote: > > Hello phcoder. thank you for reviewing this patch. > You're welcome > > > > phcoder wrote: > >> Perhaps putting it into normal.mod instead of separate module is a good > >> idea > > > > When I did this patch, I was thinking: clear is a command like ls, lspci, > > reboot, sleep, suspend, halt, exit, etc... so, clear needs to be at commands/ > > dir and follows the same ideas behind other commands. > > > > Is there any reason to not follows this idea? > > > With your patch the created elf contains much more overhead then code. > While it isn't really a problem it's still a thing about which some > thinking is needed > > Best regards, > > > > I think this overhead is not very relevant since this module won't go in the image (created by grub-mkimage). Also it will be consistent with the other commands and better organized(the halt command is actually very similar). -- Best Regards, Manoel Rebelo Abranches IBM Linux Technology Center Brazil ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] add clear screen command 2009-04-08 19:21 ` Felix Zielcke 2009-04-08 19:32 ` phcoder @ 2009-04-08 22:34 ` Carlos Roberto do Nascimento Costa 2009-04-08 22:45 ` phcoder 1 sibling, 1 reply; 8+ messages in thread From: Carlos Roberto do Nascimento Costa @ 2009-04-08 22:34 UTC (permalink / raw) To: The development of GRUB 2 [-- Attachment #1: Type: text/plain, Size: 1062 bytes --] Hi Felix, thank you for reviewing this patch. Felix Zielcke wrote: > Hello, > > + * Copyright (C) 2003,2007 Free Software Foundation, Inc. > + * Copyright (C) 2003 NIIBE Yutaka <gniibe@m17n.org> > > This should be just `Copyright (C) 2009 Free Software Foundation, Inc.', > because it's a new file from this year. My bad, I'm sorry. Now is fixed, see new [clear2.patch] file attached. > + (void)mod; /* To stop warning. */ > + cmd = grub_register_command ("clear", grub_cmd_clear, > + 0, "Clear the terminal screen."); > > I think there shouldn't be a `0' but `GRUB_COMMAND_FLAG_CMDLINE'. Yes, you are right. grub_register_command isn't the correct function to register a command and grub_register_extcmd is the new way. However, there are still modules need to be fixed, right?! I'll write another e-mail about it soon. > And please write a ChangeLog entry. > My bad. Now fixed too. Best Regards, -- Carlos Roberto do Nascimento Costa E-mails: crncosta@linux.vnet.ibm.com IBM - Linux Technology Center Brasil [-- Attachment #2: clear2.patch --] [-- Type: text/x-patch, Size: 3031 bytes --] Index: ChangeLog =================================================================== --- ChangeLog (revision 2073) +++ ChangeLog (working copy) @@ -1,3 +1,11 @@ +2009-04-08 Carlos Costa <crncosta@linux.vnet.ibm.com> + + * commands/clear.c: new file. + * conf/common.rmk (pkglib_MODULES): Added clear.mod. + (clear_mod_SOURCES): new variable. + (clear_mod_CFLAGS): likewise. + (clear_mod_LDFLAGS): likewise. + 2009-04-08 Felix Zielcke <fzielcke@z-51.de> * disk/lvm.c (grub_lvm_scan_device): Add a missing NULL check. 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) 2009 Free Software Foundation, Inc. + * + * 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_extcmd ("clear", grub_cmd_clear, + GRUB_COMMAND_FLAG_CMDLINE,"clear", + "Clear the terminal screen.",0); +} + +GRUB_MOD_FINI(clear) +{ + grub_unregister_extcmd (cmd); +} Index: conf/common.rmk =================================================================== --- conf/common.rmk (revision 2073) +++ 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) ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] add clear screen command 2009-04-08 22:34 ` Carlos Roberto do Nascimento Costa @ 2009-04-08 22:45 ` phcoder 0 siblings, 0 replies; 8+ messages in thread From: phcoder @ 2009-04-08 22:45 UTC (permalink / raw) To: The development of GRUB 2 Carlos Roberto do Nascimento Costa wrote: >> + (void)mod; /* To stop warning. */ >> + cmd = grub_register_command ("clear", grub_cmd_clear, >> + 0, "Clear the terminal screen."); >> >> I think there shouldn't be a `0' but `GRUB_COMMAND_FLAG_CMDLINE'. > > Yes, you are right. grub_register_command isn't the correct function to register > a command and grub_register_extcmd is the new way. However, there are still > modules need to be fixed, right?! I'll write another e-mail about it soon. > Your declaration is correct > > ------------------------------------------------------------------------ > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/grub-devel -- Regards Vladimir 'phcoder' Serbinenko ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-04-09 22:16 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-04-08 19:04 [PATCH] add clear screen command Carlos Roberto do Nascimento Costa 2009-04-08 19:21 ` 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
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.