annotate tests/test-atexit.c @ 8534:342c23c60847

Tests for module 'tsearch'.
author Bruno Haible <bruno@clisp.org>
date Sun, 25 Mar 2007 02:48:08 +0000
parents e227efdfe162
children 633babea5f62
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8413
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Test of execution of program termination handlers.
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2 Copyright (C) 2007 Free Software Foundation, Inc.
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 This program is free software; you can redistribute it and/or modify
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 the Free Software Foundation; either version 2, or (at your option)
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 any later version.
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 GNU General Public License for more details.
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 along with this program; if not, write to the Free Software Foundation,
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 /* Written by Bruno Haible <bruno@clisp.org>, 2007. */
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20 #ifdef HAVE_CONFIG_H
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 # include <config.h>
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22 #endif
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 #include <stdlib.h>
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 #include <unistd.h>
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 #define TEMPFILE "t-atexit.tmp"
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 static void
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30 clear_temp_file ()
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31 {
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 unlink (TEMPFILE);
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 }
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 int
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 main (int argc, char *argv[])
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 {
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 atexit (clear_temp_file);
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 if (argc > 1)
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 exit (atoi (argv[1]));
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 else
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 return 0;
e227efdfe162 Tests for module 'atexit'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 }