]> www.infradead.org Git - users/rw/armboot.git/commitdiff
Added pagelength environment variable to pause scrolling
authorrobertkaiser <robertkaiser>
Thu, 13 Mar 2003 17:37:25 +0000 (17:37 +0000)
committerrobertkaiser <robertkaiser>
Thu, 13 Mar 2003 17:37:25 +0000 (17:37 +0000)
common/cmd_mem.c
common/cmd_nvedit.c
common/command.c
common/console.c

index bd75e88f558594cab5932ca03b670e0dd609af10..c541353790e7d89ecd2782e8c94f4570d3368805 100644 (file)
@@ -129,7 +129,7 @@ int do_mem_md    (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
                }
                printf("\n");
                nbytes -= linebytes;
-       } while (nbytes > 0);
+       } while (nbytes > 0 && !had_ctrlc());
 
        dp_last_addr = addr;
        dp_last_length = length;
index 93cf6d5997c92bd07e88f37737fba334b61b422e..ebcf169d07591e98495fc455aa04fde0cc5a3017 100644 (file)
@@ -37,6 +37,8 @@
 #include "net.h"
 #endif
 
+extern int pagelength;
+
 /*
  * Table with supported baudrates (defined in config_xyz.h)
  */
@@ -397,6 +399,11 @@ int _do_setenv (bd_t *bd, int flag, int argc, char *argv[])
        return 0;
     }
 
+    if (strcmp(argv[1],"pagelength") == 0) {
+       pagelength = simple_strtoul(argv[2], NULL, 10);
+       return 0;
+    }
+
 #if (CONFIG_COMMANDS & CFG_CMD_NET)
     if (strcmp(argv[1],"bootfile") == 0) {
        copy_filename (BootFile, argv[2], sizeof(BootFile));
@@ -598,8 +605,8 @@ void env_relocate(bd_t *bd)
          s = (*e) ? e+1 : e;
     }
 
-    /* IP address */
 #if (CONFIG_COMMANDS & CFG_CMD_NET)
+    /* IP address */
     s = getenv(bd, "ipaddr");
     bd->bi_ip_addr = string_to_ip(s);
 #endif
@@ -608,6 +615,10 @@ void env_relocate(bd_t *bd)
         load_addr = simple_strtoul(s, NULL, 16);
     }
     
+    if ((s = getenv(bd, "pagelength")) != NULL) {
+       pagelength = simple_strtoul(s, NULL, 10);
+    }
+
 #if (CONFIG_COMMANDS & CFG_CMD_NET)
     if ((s = getenv(bd, "bootfile")) != NULL) {    
         copy_filename (BootFile, s, sizeof(BootFile));
index 5f0686871992b872dfdc4cf331370eb7deefb6a5..1b7d83369008c366a0a348a735cebadfea96b05b 100644 (file)
@@ -121,7 +121,7 @@ int do_help (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
 
                for (cmdtp=&cmd_tbl[0]; cmdtp->name; cmdtp++) {
                        /* allow user abort */
-                       if (ctrlc())
+                       if (had_ctrlc() || ctrlc())
                                return 1;
 
                        if (cmdtp->usage == NULL)
@@ -151,6 +151,8 @@ int do_help (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
                        if (cmdtp->usage)
                                puts (cmdtp->usage);
 #endif /* CFG_LONGHELP */
+                       if(had_ctrlc())
+                               break;
                }
                else {
                        printf ("Unknown command '%s' - try 'help'"
index 043a0ff4cb4fd7073dca8c24d6d323ca54924df3..caeca46003c5bec1ca3b9ba50e4d60bdb62b3c30 100644 (file)
@@ -44,12 +44,22 @@ extern int  kbd_getc(void);
 #      define CONSOLE_TSTC     serial_tstc
 #endif
 
+/* If pagelength is > 1, scrolling will pause every pagelength lines.
+ * Page length can be set through environment.
+ */
+#ifdef CONFIG_PAGELENGTH
+int pagelength = CONFIG_PAGELENGTH;
+#else
+int pagelength = 0;
+#endif
+static int linesout = 0;
+
 
 
 void serial_puts (const char *s)
 {
        while (*s) {
-               CONSOLE_PUTC (*s++);
+               putc(*s++);
        }
 }
 
@@ -73,6 +83,7 @@ void serial_printf(const char *fmt, ...)
 int    getc(void)
 {
     /* Send directly to the handler */
+       linesout = 0;
        return CONSOLE_GETC();
 }
 
@@ -82,12 +93,6 @@ int  tstc(void)
        return CONSOLE_TSTC();
 }
 
-void   putc(const char c)
-{
-       /* Send directly to the handler */
-       CONSOLE_PUTC (c);
-}
-
 void   puts(const char *s)
 {
        /* Send directly to the handler */
@@ -151,3 +156,25 @@ void clear_ctrlc(void)
        ctrlc_was_pressed = 0;
 }
 
+void   putc(const char c)
+{
+       /* Send directly to the handler */
+       CONSOLE_PUTC (c);
+       if(c == '\n') {
+               if(++linesout == pagelength) {
+                       char *s = "--MORE--";
+                       while(*s) {
+                               CONSOLE_PUTC(*s);
+                               ++s;
+                       }
+                       if(getc() == 0x03)
+                               ctrlc_was_pressed = 1;
+                       s = "\b\b\b\b\b\b\b\b";
+                       while(*s) {
+                               CONSOLE_PUTC(*s);
+                               ++s;
+                       }
+               }
+       }
+}
+