/* xstr.c */
/* Extra string handling stuff */

#include <ctype.h>
#include <stdlib.h>
#include <string.h>

#include "xstr.h"

char *
xstrdup(const char *s)
{
  char *s2;
  int n;
  if (!s || s[0] < 32)
    return 0;
  n = strlen(s);
  s2 = malloc(n + 1);
  if (!s2)
    return 0;
  strcpy(s2, s);
  return s2;
}

void
xstr_toupper(char *s)
{
  for (; *s; ++s)
    *s = toupper(*s);
}
