#include <stdlib.h>
#include "util.h"
#include "strings.h"

UINT   string_length(s) STRING s; {
       int i = 0;
       while (*s++ != (char) 0) i++;
       return i;
       }

STRING string_copy(s) STRING s; {
       UINT n = string_length(s);
       STRING t = (STRING) malloc (n + 1);
       UINT i;
       for (i = 0; i <= n; i ++) t[i] = s[i];
       return t;
       }

UINT   string_hash(s) STRING s; {
       UINT i = 0;
       while (*s != 0) {
           i += (*s++ & 0x3f);
	   i = (i << 5) + (i >> 27);
           }
       return i;
       }

UINT   string_equal(s,t) STRING s,t; {
       while (*s != 0) if (*s++ != *t++) return 0;
       if (*t != 0) return 0; 
       return 1;
       }

VOID    string_free(s) STRING s; { FREE(s);}

