~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Minix Cross Reference
Minix/test/t11b.c


  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 
 11 int 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 
 17 int main(argc, argv)
 18 int argc;
 19 char *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 
 33 int diff(s1, s2)
 34 char *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 
 44 void e(n)
 45 int 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 }
 56 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.