#include <devices.h>
#include <net.h>
-#ifndef CONFIG_NET_MULTI
-#error define CONFIG_NET_MULTI to use netconsole
-#endif
+DECLARE_GLOBAL_DATA_PTR;
static char input_buffer[512];
static int input_size = 0; /* char count in input buffer */
static void nc_send_packet (const char *buf, int len)
{
- DECLARE_GLOBAL_DATA_PTR;
-
struct eth_device *eth;
int inited = 0;
uchar *pkt;
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 */
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);
int nc_getc (void)
{
+ uchar c;
+
input_recursion = 1;
net_timeout = 0; /* no timeout */
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--;