[syslinux] [PATCH 1/1] cmd.c32: allow an option for clearing the screen
Gene Cumm
gene.cumm at gmail.com
Fri Mar 13 14:45:54 PDT 2009
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++ = ' ';
More information about the Syslinux
mailing list