equal
deleted
inserted
replaced
1 // Since gets() is insecure and produces lots |
|
2 // of warnings, thereofre I use my own input |
|
3 // function instead. |
|
4 char ch; |
|
5 int i; |
|
6 |
|
7 void get_line(char *dst) { |
1 void get_line(char *dst) { |
8 char buffer[8]; |
2 char buffer[8]; |
9 i = 0; |
3 int i = 0; |
|
4 char ch; |
10 while ((ch = getchar()) != '\n') { |
5 while ((ch = getchar()) != '\n') { |
11 buffer[i++] = ch; |
6 buffer[i++] = ch; |
12 } |
7 } |
13 buffer[i] = '\0'; |
8 buffer[i] = '\0'; |
14 strcpy(dst, buffer); |
9 strcpy(dst, buffer); |
15 } |
10 } |
|
11 |
|
12 int match(char *s1, char *s2) { |
|
13 while(*s1 != '\0' && *s2 != '\0' && *s1 == *s2){ |
|
14 s1++; s2++; |
|
15 } |
|
16 return( *s1 - *s2 ); |
|
17 } |