source: trunk/minix/test/t11b.c@ 20

Last change on this file since 20 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 934 bytes
Line 
1/* t11b */
2
3#include <sys/types.h>
4#include <errno.h>
5#include <stdlib.h>
6#include <unistd.h>
7#include <stdio.h>
8
9#define MAX_ERROR 4
10
11int errct, subtest=1;
12
13_PROTOTYPE(int main, (int argc, char *argv []));
14_PROTOTYPE(int diff, (char *s1, char *s2));
15_PROTOTYPE(void e, (int n));
16
17int main(argc, argv)
18int argc;
19char *argv[];
20{
21/* See if arguments passed ok. */
22
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);
29
30 exit(75);
31}
32
33int diff(s1, s2)
34char *s1, *s2;
35{
36 while (1) {
37 if (*s1 == 0 && *s2 == 0) return(0);
38 if (*s1 != *s2) return (1);
39 s1++;
40 s2++;
41 }
42}
43
44void e(n)
45int n;
46{
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);
54 }
55}
Note: See TracBrowser for help on using the repository browser.