|
|
1.1 ! root 1: #include <stdio.h> ! 2: ! 3: /* Break string in two parts to avoid buggy C compilers that ignore characters ! 4: after nulls in strings. */ ! 5: ! 6: char string1[] = "Testing distribution of nonprinting chars:\n\ ! 7: Should be 0177: \177 Should be 0377: \377 Should be 0212: \212.\n\ ! 8: Should be 0000: "; ! 9: ! 10: char string2[] = ".\n\ ! 11: This file is read by the `test-distribution' program.\n\ ! 12: If you change it, you will make that program fail.\n"; ! 13: ! 14: char buf[300]; ! 15: ! 16: main () ! 17: { ! 18: int fd = open ("testfile", 0); ! 19: ! 20: if (fd < 0) ! 21: { ! 22: perror ("opening `testfile'"); ! 23: exit (1); ! 24: } ! 25: if (read (fd, buf, sizeof string1) != sizeof string1 || ! 26: strcmp (buf, string1) || ! 27: read (fd, buf, sizeof string2) != sizeof string2 - 1 || ! 28: strncmp (buf, string2, sizeof string2 - 1)) ! 29: { ! 30: fprintf (stderr, "Data in file `testfile' has been damaged.\n\ ! 31: Most likely this means that many nonprinting characters\n\ ! 32: have been corrupted in the files of Emacs, and it will not work.\n"); ! 33: exit (1); ! 34: } ! 35: close (fd); ! 36: exit (0); ! 37: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.