#include "net.h"
#endif
+extern int pagelength;
+
/*
* Table with supported baudrates (defined in config_xyz.h)
*/
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));
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
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));
for (cmdtp=&cmd_tbl[0]; cmdtp->name; cmdtp++) {
/* allow user abort */
- if (ctrlc())
+ if (had_ctrlc() || ctrlc())
return 1;
if (cmdtp->usage == NULL)
if (cmdtp->usage)
puts (cmdtp->usage);
#endif /* CFG_LONGHELP */
+ if(had_ctrlc())
+ break;
}
else {
printf ("Unknown command '%s' - try 'help'"
# 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++);
}
}
int getc(void)
{
/* Send directly to the handler */
+ linesout = 0;
return CONSOLE_GETC();
}
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 */
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;
+ }
+ }
+ }
+}
+