rename index variables

Old implementations of string.[hc] rely on a global variable named
index. Old systems and compilers will warn about variable shadowing.