Mercurial > emacs
comparison lib-src/test-distrib.c @ 88155:d7ddb3e565de
sync with trunk
author | Henrik Enberg <henrik.enberg@telia.com> |
---|---|
date | Mon, 16 Jan 2006 00:03:54 +0000 |
parents | d8a417105504 |
children |
comparison
equal
deleted
inserted
replaced
88154:8ce476d3ba36 | 88155:d7ddb3e565de |
---|---|
1 /* test-distrib.c --- testing distribution of nonprinting chars | 1 /* test-distrib.c --- testing distribution of nonprinting chars |
2 | 2 |
3 Copyright (C) 1987, 1993, 1994, 1995, 1999, 2001 | 3 Copyright (C) 1987, 1993, 1994, 1995, 1999, 2001, 2002, 2003, |
4 Free Software Foundation Inc. | 4 2004, 2005 Free Software Foundation, Inc. |
5 | 5 |
6 This file is part of GNU Emacs. | 6 This file is part of GNU Emacs. |
7 | 7 |
8 GNU Emacs is free software; you can redistribute it and/or modify | 8 GNU Emacs is free software; you can redistribute it and/or modify |
9 it under the terms of the GNU General Public License as published by | 9 it under the terms of the GNU General Public License as published by |
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 GNU General Public License for more details. | 16 GNU General Public License for more details. |
17 | 17 |
18 You should have received a copy of the GNU General Public License | 18 You should have received a copy of the GNU General Public License |
19 along with GNU Emacs; see the file COPYING. If not, write to the | 19 along with GNU Emacs; see the file COPYING. If not, write to the |
20 Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 20 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
21 Boston, MA 02111-1307, USA. */ | 21 Boston, MA 02110-1301, USA. */ |
22 | 22 |
23 #ifdef HAVE_CONFIG_H | 23 #ifdef HAVE_CONFIG_H |
24 #include <config.h> | 24 #include <config.h> |
25 #endif | 25 #endif |
26 | 26 |
78 int fd; | 78 int fd; |
79 | 79 |
80 if (argc != 2) | 80 if (argc != 2) |
81 { | 81 { |
82 fprintf (stderr, "Usage: %s testfile\n", argv[0]); | 82 fprintf (stderr, "Usage: %s testfile\n", argv[0]); |
83 exit (2); | 83 exit (EXIT_FAILURE); |
84 } | 84 } |
85 fd = open (argv[1], O_RDONLY); | 85 fd = open (argv[1], O_RDONLY); |
86 if (fd < 0) | 86 if (fd < 0) |
87 { | 87 { |
88 perror (argv[1]); | 88 perror (argv[1]); |
89 exit (2); | 89 exit (EXIT_FAILURE); |
90 } | 90 } |
91 if (cool_read (fd, buf, sizeof string1) != sizeof string1 || | 91 if (cool_read (fd, buf, sizeof string1) != sizeof string1 || |
92 strcmp (buf, string1) || | 92 strcmp (buf, string1) || |
93 cool_read (fd, buf, sizeof string2) != sizeof string2 - 1 || | 93 cool_read (fd, buf, sizeof string2) != sizeof string2 - 1 || |
94 strncmp (buf, string2, sizeof string2 - 1)) | 94 strncmp (buf, string2, sizeof string2 - 1)) |
95 { | 95 { |
96 fprintf (stderr, "Data in file `%s' has been damaged.\n\ | 96 fprintf (stderr, "Data in file `%s' has been damaged.\n\ |
97 Most likely this means that many nonprinting characters\n\ | 97 Most likely this means that many nonprinting characters\n\ |
98 have been corrupted in the files of Emacs, and it will not work.\n", | 98 have been corrupted in the files of Emacs, and it will not work.\n", |
99 argv[1]); | 99 argv[1]); |
100 exit (2); | 100 exit (EXIT_FAILURE); |
101 } | 101 } |
102 close (fd); | 102 close (fd); |
103 #ifdef VMS | 103 return EXIT_SUCCESS; |
104 exit (1); /* On VMS, success is 1. */ | |
105 #endif | |
106 return (0); | |
107 } | 104 } |
105 | |
106 /* arch-tag: 3a89005d-df98-4c32-aa9f-33570e16a26a | |
107 (do not change this comment) */ | |
108 | |
109 /* test-distrib.c ends here */ |