. use library function to parse memory string
[minix3.git] / test / t11b.c
blobc0b28a91278421013149c411a01d942a38a46f8b
1 /* t11b */
3 #include <sys/types.h>
4 #include <errno.h>
5 #include <stdlib.h>
6 #include <unistd.h>
7 #include <stdio.h>
9 #define MAX_ERROR 4
11 int errct, subtest=1;
13 _PROTOTYPE(int main, (int argc, char *argv []));
14 _PROTOTYPE(int diff, (char *s1, char *s2));
15 _PROTOTYPE(void e, (int n));
17 int main(argc, argv)
18 int argc;
19 char *argv[];
21 /* See if arguments passed ok. */
23 if (diff(argv[0], "t11b")) e(31);
24 if (diff(argv[1], "abc")) e(32);
25 if (diff(argv[2], "defghi")) e(33);
26 if (diff(argv[3], "j")) e(34);
27 if (argv[4] != 0) e(35);
28 if (argc != 4) e(36);
30 exit(75);
33 int diff(s1, s2)
34 char *s1, *s2;
36 while (1) {
37 if (*s1 == 0 && *s2 == 0) return(0);
38 if (*s1 != *s2) return (1);
39 s1++;
40 s2++;
44 void e(n)
45 int n;
47 printf("Subtest %d, error %d errno=%d ", subtest, n, errno);
48 perror("");
49 if (errct++ > MAX_ERROR) {
50 printf("Too many errors; test aborted\n");
51 chdir("..");
52 system("rm -rf DIR*");
53 exit(1);