musicmud-2.1.6/data/
musicmud-2.1.6/data/help/
musicmud-2.1.6/data/policy/
musicmud-2.1.6/data/wild/
musicmud-2.1.6/data/world/
musicmud-2.1.6/doc/
musicmud-2.1.6/src/ident/
musicmud-2.1.6/src/lua/
musicmud-2.1.6/src/lua/include/
musicmud-2.1.6/src/lua/src/lib/
musicmud-2.1.6/src/lua/src/lua/
musicmud-2.1.6/src/lua/src/luac/
#ifndef MUSICTOK
#define MUSICTOK

//! a string tokenizer - wrapper for strtok_r.
class StrTok {
  char *d;
  char *usr;
  int i;

public:

  StrTok(const char *str) {
    if (str)
      d = strdup(str);
    else
      d = 0;
    i = 1;
  }
  ~StrTok() {
    if (d)
      strfree(d);
  }
  
  //! get the next token in the sting. delimiter /tok/.
  const char *next(const char *tok) {
    if (!d) return NULL;
    const char *f=strtok_r(i?d:NULL, tok, &usr);
    i = 0;
    return f;
  }
};

inline std::vector<string> tokenize(string s) {
  std::vector<string> v;
  while (1) {
    string::size_type n = s.find(' ');
    if (n == string::npos)
      break;
    v.push_back(s.substr(0, n));
    s = s.substr(n+1);
  }

  if (s.length()) {
    v.push_back(s);
  }
  
  return v;
}

#endif