Gene Cumm
2009-Mar-13 21:45 UTC
[syslinux] [PATCH 1/1] cmd.c32: allow an option for clearing the screen
From: Gene Cumm <gene.cumm at gmail.com>
COM32/cmd.c32: Allow an option for clearing the screen
Signed-off-by: Gene Cumm <gene.cumm at gmail.com>
---
If "-c" is the first option to cmd.c32, it will first clear the screen
by dumping a series of newlines to the screen.
Applies against current head.
diff --git a/com32/modules/cmd.c b/com32/modules/cmd.c
index e1d646b..ff54128 100644
--- a/com32/modules/cmd.c
+++ b/com32/modules/cmd.c
@@ -20,19 +20,29 @@
#include <alloca.h>
#include <com32.h>
+#define NUM_NL 40
+ /* Number of lines to clear */
+
int main(int argc, const char *argv[])
{
size_t len = 0;
char *cmd;
char *tmp;
int i;
+ int argst = 1; /* Starting argument */
+
+ if (strcmp(argv[1], "-c") == 0) {
+ argst++;
+ for (i = 0; i < NUM_NL; i++)
+ printf("\n");
+ }
- for (i = 1; i < argc; i++)
+ for (i = argst; i < argc; i++)
len += strlen(argv[i]) + 1;
tmp = cmd = alloca(len);
- for (i = 1; i < argc; i++) {
+ for (i = argst; i < argc; i++) {
tmp = strpcpy(tmp, argv[i]);
if (i != argc-1)
*tmp++ = ' ';
H. Peter Anvin
2009-Mar-14 19:35 UTC
[syslinux] [PATCH 1/1] cmd.c32: allow an option for clearing the screen
Gene Cumm wrote:> > If "-c" is the first option to cmd.c32, it will first clear the screen > by dumping a series of newlines to the screen. > > Applies against current head. >Double NAK. First of all, I just removed the console dependencies to cmd.c32, which cut it down from 5K to some 600 bytes. Second, dumping newlines to the screen isn't really the best way to clear. -hpa -- H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.
Reasonably Related Threads
- NEW: COM32 module to run another command, optionally clearing the screen
- [PATCH, RFC] add APOP authentication mechanism
- [PATCH 1/1] gpxe: fix possible null pointer dereference
- [PATCH 1/1] gpxe: fix possible null pointer dereference
- [PATCH v2 29/33] iommu/omap: Convert to probe/release_device() call-backs