*p = '\0';
if (nr_bytes < todo) {  plen += hexnumnstr (plen, (ULONGEST) nr_bytes, plenlen); *plen = ':';   } break; case PACKET_DISABLE:  nr_bytes = bin2hex (myaddr, p, todo); p += 2 * nr_bytes; break; case PACKET_SUPPORT_UNKNOWN: internal_error (__FILE__, __LINE__, "remote_write_bytes: bad internal state"); default: internal_error (__FILE__, __LINE__, "bad switch"); }
remote_write_bytes (memaddr, myaddr, len)     CORE_ADDR memaddr;     char *myaddr;     int len;{  char buf[PBUFSIZ];  int i;  char *p;  int done;  /* Chop the transfer down if necessary */  done = 0;  while (done < len)    {      int todo = len - done;      int cando = min(remote_write_size, PBUFSIZ) / 2 - 32; /* num bytes that will fit */      if (todo > cando)	todo = cando;      /* FIXME-32x64: Need a version of print_address_numeric which puts the	 result in a buffer like sprintf.  */      sprintf (buf, "M%lx,%x:", (unsigned long) memaddr + done, todo);      /* We send target system values byte by byte, in increasing byte addresses,	 each byte encoded as two hex characters.  */      p = buf + strlen (buf);      for (i = 0; i < todo; i++)	{	  *p++ = tohex ((myaddr[i + done] >> 4) & 0xf);	  *p++ = tohex (myaddr[i + done] & 0xf);	}      *p = '\0';      putpkt (buf);      getpkt (buf, 0);      if (buf[0] == 'E')	{	  /* There is no correspondance between what the remote protocol uses	     for errors and errno codes.  We would like a cleaner way of	     representing errors (big enough to include errno codes, bfd_error	     codes, and others).  But for now just return EIO.  */	  errno = EIO;	  return 0;	}      done += todo;    }  return len;}