#include <string.h>

int CompareString(const char *s1, const char *s2)
{
/*  < 0 if s1 is less than s2
   == 0 if s1 is the same as s2
    > 0 if s1 is greater than s2
*/
unsigned char Loop = 1;
unsigned int counter = 0;
int CompareFlag = 0;

  for (counter = 0; Loop > 0; counter++){
    if(s2[counter] < s1[counter]){
        CompareFlag = -1;
        Loop = 0;
    } else if(s2[counter] > s1[counter]) {
        CompareFlag = 1;
        Loop = 0;
    } else if(s2[counter] == s1[counter]) {
      if((s2[counter] == '\0') & (s1[counter] == '\0')){
        CompareFlag = 0;
        Loop = 0;
      }
    }
    if((s2[counter] == '\0') & (s1[counter] != 0)){
      CompareFlag = -1;
      Loop = 0;
    } else if((s2[counter] != '\0') & (s1[counter] == 0)){
      CompareFlag = 1;
      Loop = 0;
    }
  }
return CompareFlag;
}
