Skip to contentSkip to conversation

add clear screen command

PATCH In review Carlos Roberto do Nascimento Costa 4 participants 8 messages Apr 8, 2009 – Apr 9, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add clear screen command

Hello,

This simple patch will add a new command to clear the terminal screen. Very useful on the command-line.

Best Regards,

Signature · 3 lines
Carlos Roberto do Nascimento Costa
e-mail: [email protected]
IBM - Linux Technology Center Brasil
common.rmk +6 -1
Index: conf/common.rmk
===================================================================
@@ -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)
clear.c +50 -0

50 lines not on this page · raw message

#1 lore raw

Am Mittwoch, den 08.04.2009, 16:04 -0300 schrieb Carlos Roberto do Nascimento Costa:

Quoted 5 lines

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 <[email protected]>

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.

Signature · 1 line
Felix Zielcke
#2 lore raw

Perhaps putting it into normal.mod instead of separate module is a good idea

Quoted 23 lines · Felix Zielcke

Am Mittwoch, den 08.04.2009, 16:04 -0300 schrieb Carlos Roberto do Nascimento Costa:

Quoted 5 lines

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 <[email protected]>

This should be just `Copyright (C) 2009 Free Software Foundation, Inc.', because it's a new file from this year.

clear.c +3 -0
+  (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.

Signature · 2 lines
Regards
Vladimir 'phcoder' Serbinenko
#6 lore raw
In reply to Felix Zielcke

Hi Felix, thank you for reviewing this patch.

Quoted 7 lines · Felix Zielcke

Hello,

+ * Copyright (C) 2003,2007 Free Software Foundation, Inc.
+ * Copyright (C) 2003 NIIBE Yutaka <[email protected]>

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.

Quoted 5 lines
(quoted diff) +3 -0
+  (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.

Quoted 2 lines

And please write a ChangeLog entry.

My bad. Now fixed too.

Best Regards,

Signature · 3 lines
Carlos Roberto do Nascimento Costa
E-mails: [email protected]
IBM - Linux Technology Center Brasil
ChangeLog +8 -0
Index: ChangeLog
===================================================================
@@ -1,3 +1,11 @@
+2009-04-08  Carlos Costa  <[email protected]>
+
+	* 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  <[email protected]>
 
 	* disk/lvm.c (grub_lvm_scan_device): Add a missing NULL check.
clear.c +50 -0

50 lines not on this page · raw message

common.rmk +6 -1
Index: conf/common.rmk
===================================================================
@@ -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)
#7 lore raw
Quoted 10 lines · Carlos Roberto do Nascimento Costa
Quoted 5 lines
(quoted diff) +3 -0
+  (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

Quoted 7 lines

------------------------------------------------------------------------

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'phcoder' Serbinenko
#3 lore raw
In reply to phcoder

Hello phcoder. thank you for reviewing this patch.

Quoted 2 lines · phcoder

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,

Signature · 3 lines
Carlos Roberto do Nascimento Costa
E-mails: [email protected]
IBM - Linux Technology Center Brasil
#4 lore raw
Quoted 1 line · Carlos Roberto do Nascimento Costa

Hello phcoder. thank you for reviewing this patch.

You're welcome

Quoted 11 lines
Quoted 2 lines · phcoder

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

Quoted 2 lines

Best regards,

Signature · 2 lines
Regards
Vladimir 'phcoder' Serbinenko
#5 lore raw
Quoted 12 lines · phcoder
Quoted 1 line · Carlos Roberto do Nascimento Costa

Hello phcoder. thank you for reviewing this patch.

You're welcome

Quoted 9 lines
Quoted 2 lines · phcoder

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.

Quoted 9 lines
Quoted 2 lines

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

Quoted 2 lines

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).

Signature · 4 lines
Best Regards,

Manoel Rebelo Abranches 
IBM Linux Technology Center Brazil