diff options
author | wdenk <wdenk> | 2005-04-20 09:28:54 +0000 |
---|---|---|
committer | wdenk <wdenk> | 2005-04-20 09:28:54 +0000 |
commit | b2323ea6f9ae478680baa964bdd97d8567507e91 (patch) | |
tree | 681d92f2578756ec5a24c8ff75b22ce283c6f304 /drivers/netconsole.c | |
parent | fddae7b8117c06cbc52027f297f5a657a87c8279 (diff) | |
download | u-boot-imx-b2323ea6f9ae478680baa964bdd97d8567507e91.zip u-boot-imx-b2323ea6f9ae478680baa964bdd97d8567507e91.tar.gz u-boot-imx-b2323ea6f9ae478680baa964bdd97d8567507e91.tar.bz2 |
Auto-size RAM on canmb board.
Cleanup.
Diffstat (limited to 'drivers/netconsole.c')
-rw-r--r-- | drivers/netconsole.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/netconsole.c b/drivers/netconsole.c index 6c27c08..9cf6cd6 100644 --- a/drivers/netconsole.c +++ b/drivers/netconsole.c @@ -153,11 +153,12 @@ int nc_start (void) nc_port = 6666; /* default port */ if (getenv ("ncip")) { + char *p; + nc_ip = getenv_IPaddr ("ncip"); if (!nc_ip) return -1; /* ncip is 0.0.0.0 */ - char *p = strchr (getenv ("ncip"), ':'); - if (p) + if ((p = strchr (getenv ("ncip"), ':')) != NULL) nc_port = simple_strtoul (p + 1, NULL, 10); } else nc_ip = ~0; /* ncip is not set */ @@ -188,13 +189,13 @@ void nc_putc (char c) void nc_puts (const char *s) { + int len; + if (output_recursion) return; output_recursion = 1; - int len = strlen (s); - - if (len > 512) + if ((len = strlen (s)) > 512) len = 512; nc_send_packet (s, len); @@ -204,6 +205,8 @@ void nc_puts (const char *s) int nc_getc (void) { + uchar c; + input_recursion = 1; net_timeout = 0; /* no timeout */ @@ -212,8 +215,8 @@ int nc_getc (void) input_recursion = 0; - uchar c = input_buffer[input_offset]; - input_offset++; + c = input_buffer[input_offset++]; + if (input_offset >= sizeof input_buffer) input_offset -= sizeof input_buffer; input_size--; |