char *copy(char *dest, const char *src, int capacity) {
for (int i = 0; i < capacity && src[i] != '\0'; i++) {
    dest[i] = src[i];
    for ( ; i < capacity; i++) {
      dest[i] = '\0';
    }
  }
  return dest;
}