Debian Codegraph @

upstream/debian-trixie/man3/EXIT_SUCCESS.3const

raw
1 .\" Copyright (c) 2022 by Thomas Voss <[email protected]>
2 .\"
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
4 .\"
5 .\"
6 .TH EXIT_SUCCESS 3const 2024-06-15 "Linux man-pages 6.9.1"
7 .SH NAME
8 EXIT_SUCCESS, EXIT_FAILURE \- termination status constants
9 .SH LIBRARY
10 Standard C library
11 .RI ( libc )
12 .SH SYNOPSIS
13 .nf
14 .B #include <stdlib.h>
15 .P
16 .BR "#define EXIT_SUCCESS " 0
17 .BR "#define EXIT_FAILURE " "/* nonzero */"
18 .fi
19 .SH DESCRIPTION
20 .B EXIT_SUCCESS
21 and
22 .B EXIT_FAILURE
23 represent a successful and unsuccessful exit status respectively,
24 and can be used as arguments to the
25 .BR exit (3)
26 function.
27 .SH STANDARDS
28 C11, POSIX.1-2008.
29 .SH HISTORY
30 C89, POSIX.1-2001.
31 .SH EXAMPLES
32 .\" SRC BEGIN (EXIT_SUCCESS.c)
33 .EX
34 #include <stdio.h>
35 #include <stdlib.h>
36 \&
37 int
38 main(int argc, char *argv[])
39 {
40 FILE *fp;
41 \&
42 if (argc != 2) {
43 fprintf(stderr, "Usage: %s <file>\[rs]n", argv[0]);
44 exit(EXIT_FAILURE);
45 }
46 \&
47 fp = fopen(argv[1], "r");
48 if (fp == NULL) {
49 perror(argv[1]);
50 exit(EXIT_FAILURE);
51 }
52 \&
53 /* Other code omitted */
54 \&
55 fclose(fp);
56 exit(EXIT_SUCCESS);
57 }
58 .EE
59 .\" SRC END
60 .SH SEE ALSO
61 .BR exit (3),
62 .BR sysexits.h (3head)