9 int main(int argc, char **argv)
15 printf("Usage %s file1 file2\n", argv[0]);
20 fd1 = open(argv[1], O_CREAT| O_RDWR, 0666);
22 printf("Error opening %s: %s\n", argv[1], strerror(errno));
26 fd2 = open(argv[2], O_RDONLY);
28 printf("Error opening %s: %s\n", argv[2], strerror(errno));
34 if ( write(fd1, "hello", strlen("hello")) != strlen("hello")) {
35 printf("Error writing: %s\n", strerror(errno));
39 if ( fstat(fd1, &st1) ) {
40 printf("Error statting %s: %s\n", argv[1], strerror(errno));
44 if ( fstat(fd2, &st2) ) {
45 printf("Error statting %s: %s\n", argv[2], strerror(errno));
49 if ( st1.st_size != st2.st_size ) {
50 printf("Sizes don't match %lu, %lu\n",
51 (unsigned long)st1.st_size,
52 (unsigned long)st2.st_size);
56 if ( st1.st_mtime != st2.st_mtime ) {
57 printf("Mtimes don't match %ld, %ld\n",
58 st1.st_mtime, st2.st_mtime);