Struct to web style string I've had to make several functions to turn some structures into strings. I am a still green when it comes C so I am unsure if I am doing this a very awkward way. The system I am coding for does not have snprintf, I know that would be far more elegant, however I cannot use it.
Any advice?

int device_to_string(char* const asString, pDevice dev, size_t maxLength)
{
  char* ipAsString;
  size_t actualLength;
  struct in_addr addr;

  if (dev == NULL)
  {
    return NULL_ERROR;
  }

  addr.s_addr = dev-&gt;ip;
  ipAsString = inet_ntoa(addr);

  actualLength = strlen("name=")  + strlen(dev-&gt;name) +
                 strlen("&amp;ip=")   + strlen(ipAsString) +
                 strlen("&amp;mac=")  + strlen(dev-&gt;mac)  +
                 strlen("&amp;type=") + strlen(dev-&gt;type) + 1;

  if (actualLength &gt; maxLength)
  {
    return SIZE_ERROR;
  }

  strncat(asString, "name=",    strlen("name="));
  strncat(asString, dev-&gt;name,  strlen(dev-&gt;name));
  strncat(asString, "&amp;ip=",     strlen("&amp;ip="));
  strncat(asString, ipAsString, strlen(ipAsString));
  strncat(asString, "&amp;mac=",    strlen("&amp;mac="));
  strncat(asString, dev-&gt;mac,   strlen(dev-&gt;mac));
  strncat(asString, "&amp;type=",   strlen("&amp;type="));
  strncat(asString, dev-&gt;type,  strlen(dev-&gt;type));

  asString[actualLength] = '\0';

  return NO_ERROR;
}
Yeah, without snprintf and sprintf it gets a bit tedious, but I think this code is actually quite clear. You use your horizontal and vertical whitespace very well, and it's clear what you're doing with each block of code. You have also controlled for any possible issues that might come up (null pointer, insufficient buffer length, etc). Maybe there's a more concise way to do it, but in terms of clarity and maintainability I think this code will suffice.